UDMA Fifo
- group UDMA_FIFO
The UDMA FIFO driver provides an interface to use UDMA FIFO channel.
Typedefs
-
typedef struct pi_udma_fifo_conf pi_udma_fifo_conf_t
This structure is used to pass the desired UDMA FIFO configuration to the runtime when opening a device.
Enums
-
enum pi_udma_fifo_ioctl_e
Commands for pi_udma_fifo_ioctl.
This is used to tell which command to execute through pi_udma_fifo_ioctl. Parameters are passed as pointers.
Values:
-
enumerator PI_UDMA_FIFO_GET_ID
type uint32_t: return the fifo id
-
enumerator PI_UDMA_FIFO_SET_SIZE
set the FIFO size (in bytes, minimum 16)
-
enumerator PI_UDMA_FIFO_GET_LEVEL
get current number of bytes in FIFO
-
enumerator PI_UDMA_FIFO_SET_EVENT_THRESHOLD
type uint32_t: set the number of bytes after which the event will be triggered. Setting a value greater than 0 enable the event, setting 0 disables it
-
enumerator PI_UDMA_FIFO_SET_EVENT_CB
type pi_evt_t: set the event callback, use NULL for no callback
-
enumerator PI_UDMA_FIFO_PUSH8
type uint8_t: push 8 bits in the FIFO
-
enumerator PI_UDMA_FIFO_PUSH16
type uint16_t: push 16 bits in the FIFO
-
enumerator PI_UDMA_FIFO_PUSH24
type uint32_t: push 24 bits in the FIFO
-
enumerator PI_UDMA_FIFO_PUSH32
type uint32_t: push 32 bits in the FIFO
-
enumerator PI_UDMA_FIFO_POP8
type uint8_t: pop 8 bits from the FIFO
-
enumerator PI_UDMA_FIFO_POP16
type uint16_t: pop 16 bits from the FIFO
-
enumerator PI_UDMA_FIFO_POP24
type uint32_t: pop 24 bits from the FIFO
-
enumerator PI_UDMA_FIFO_POP32
type uint32_t: pop 32 bits from the FIFO
-
enumerator PI_UDMA_FIFO_GET_ID
Functions
-
void pi_udma_fifo_conf_init(pi_udma_fifo_conf_t *conf)
Initialize an UDMA FIFO configuration with default values.
This function can be called to get default values for all parameters before setting some of them. The structure containing the configuration must be kept alive until the UDMA FIFO device is opened.
- Parameters:
conf – A pointer to the UDMA FIFO configuration.
-
int pi_udma_fifo_open(pi_device_t *device)
Open an UDMA FIFO device.
This function must be called before the UDMA FIFO device can be used. It will do all the needed configuration to make it usable and initialize the handle used to refer to this opened device when calling other functions.
Warning
The fifo needs at least one UDMA peripheral enabled to be enabled. Else configuration will not be set, and application will get stuck on push/pop commands.
- Parameters:
device – A pointer to the device structure of the device to open. This structure is allocated by the called and must be kept alive until the device is closed.
- Returns:
0 if the operation is successfull, -1 if there was an error.
-
void pi_udma_fifo_close(pi_device_t *device)
Close an opened UDMA FIFO device.
This function can be called to close an opened UDMA FIFO device once it is not needed anymore, in order to free all allocated resources. Once this function is called, the device is not accessible anymore and must be opened again before being used.
- Parameters:
device – The device structure of the device to close.
-
void pi_udma_fifo_ioctl(pi_device_t *device, uint32_t cmd, void *arg)
UDMA FIFO IOCTL function.
- Parameters:
device – A pi device structure pointing to UDMA FIFO device
cmd – ioctl number
arg – argument to be passed to ioctl
-
typedef struct pi_udma_fifo_conf pi_udma_fifo_conf_t