1
0
mirror of https://github.com/bmartini/zynq-axis.git synced 2024-09-05 19:19:27 +08:00
zynq-axis/lib/interface.h
Berin Martini a53998a69d Replace axis_memory_offset function with mem_alloc_state
The functionality of the axis_memory_offset function can be replicated by using
mem_alloc_state while at the same times provides a more powerful interface to
the memory allocation system.

The 1st argument passed to the new mem_alloc_state functions is a pointer to a
void pointer (start) whose value will be overwritten to be the start pointer of
the CMA memory area. The 2nd argument is a pointer to a unsigned int whose
values will be overwritten to be the current 'offset' from that start pointer
and thus represents how many bytes has been allocated.
2015-10-29 14:42:25 +00:00

48 lines
1.0 KiB
C

#ifndef INTERFACE_H
#define INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#define REGISTER_NB 32
#define MEM_SIZE (126*1024*1024)
// init/exit function for device interface
int axis_init(const char *path);
int axis_exit();
// configuration bus
void cfg_write(unsigned int addr, unsigned int data);
void cfg_write_array(unsigned int addr, unsigned int *data, int length);
void cfg_write_sequence(unsigned int *addr,
unsigned int *data, int length);
int cfg_read(unsigned int addr);
void cfg_poll(unsigned int addr, unsigned int data);
// dma memory
void *mem_alloc(const int length, const int byte_nb);
int mem_alloc_size(const int length, const int byte_nb);
int mem_alloc_length(const int length, const int byte_nb);
void mem_alloc_state(void **start, unsigned int *offset);
// axis ports
unsigned int axis_port_id(const int index, const int dirc);
unsigned int axis_memory_addr(void *ptr);
unsigned int axis_stream_length(const int length, const int byte_nb);
#ifdef __cplusplus
}
#endif
#endif /* INTERFACE_H */