High level interface for interacting with the memory-to-memory direct memory access (DMA).
This driver allows transferring data to/from the radio RAM from/to the main application RAM. For general-purpose DMA transfers, use the DMA driver.
Typedefs | |
| typedef void(* | cyhal_m2m_event_callback_t) (void *callback_arg, cyhal_m2m_event_t event) |
| Event handler for M2M interrupts. | |
Enumerations | |
| enum | cyhal_m2m_rx_status_t { CYHAL_M2M_RX_DISABLED = 0x0 , CYHAL_M2M_RX_ACTIVE = 0x1 , CYHAL_M2M_RX_IDLE_WAIT = 0x2 , CYHAL_M2M_RX_STOPPED = 0x3 } |
| Enum of M2M RX channel activity status. More... | |
| enum | cyhal_m2m_event_t { CYHAL_M2M_NO_INTR = 0 , CYHAL_M2M_DESCRIPTOR_READ_ERROR = (1 << 0) , CYHAL_M2M_DATA_TRANSFER_ERROR = (1 << 1) , CYHAL_M2M_DESCRIPTOR_PROGRAM_ERROR = (1 << 2) , CYHAL_M2M_NO_DESCRIPTOR_ERROR = (1 << 3) , CYHAL_M2M_RX_CHANNEL_INTERRUPT = (1 << 4) , CYHAL_M2M_TX_CHANNEL_INTERRUPT = (1 << 5) } |
| Flags enum of M2M events. More... | |
Functions | |
| cy_rslt_t | cyhal_m2m_init (cyhal_m2m_t *obj, uint32_t rx_buffer_size) |
| Initialize the M2M peripheral. More... | |
| void | cyhal_m2m_free (cyhal_m2m_t *obj) |
| Free the M2M object. More... | |
| bool | cyhal_m2m_is_busy (cyhal_m2m_t *obj) |
| Checks if the transfer has been triggered, but not yet complete (eg: is pending, blocked or running) More... | |
| void | cyhal_m2m_register_callback (cyhal_m2m_t *obj, cyhal_m2m_event_callback_t callback, void *callback_arg) |
| Register an M2M callback handler. More... | |
| void | cyhal_m2m_enable_event (cyhal_m2m_t *obj, cyhal_m2m_event_t event, uint8_t intr_priority, bool enable) |
| Configure M2M event enablement. More... | |
| cy_rslt_t | cyhal_m2m_tx_send (cyhal_m2m_t *obj, void *buffer) |
| Send M2M TX data packet. More... | |
| void | cyhal_m2m_tx_release (cyhal_m2m_t *obj) |
| Release next completed M2M TX data packet. More... | |
| void | cyhal_m2m_rx_receive (cyhal_m2m_t *obj, void **rxd_handle, uint16_t **hwtag) |
| Receive and read M2M RX data packet. More... | |
| bool | cyhal_m2m_rx_prepare (cyhal_m2m_t *obj) |
| Prepare M2M RX ring buffer. More... | |
| cyhal_m2m_rx_status_t | cyhal_m2m_rx_status (cyhal_m2m_t *obj) |
| M2M RX activity status. More... | |
| cyhal_m2m_event_t | cyhal_m2m_intr_status (cyhal_m2m_t *obj, bool *signal_txdone) |
| Read M2M TX and RX interrupt status. More... | |
Enum of M2M RX channel activity status.
| enum cyhal_m2m_event_t |
Flags enum of M2M events.
Multiple events can be enabled via cyhal_m2m_enable_event and the callback from cyhal_m2m_register_callback will be run to notify.
| cy_rslt_t cyhal_m2m_init | ( | cyhal_m2m_t * | obj, |
| uint32_t | rx_buffer_size | ||
| ) |
Initialize the M2M peripheral.
| [out] | obj | Pointer to an M2M object. The caller must allocate the memory for this object but the init function will initialize its contents. |
| [in] | rx_buffer_size | Size of the RX buffer. |
| void cyhal_m2m_free | ( | cyhal_m2m_t * | obj | ) |
Free the M2M object.
Freeing a M2M object while a transfer is in progress (cyhal_m2m_is_busy) is invalid.
| [in,out] | obj | The M2M object |
| bool cyhal_m2m_is_busy | ( | cyhal_m2m_t * | obj | ) |
Checks if the transfer has been triggered, but not yet complete (eg: is pending, blocked or running)
| [in] | obj | The M2M object |
| void cyhal_m2m_register_callback | ( | cyhal_m2m_t * | obj, |
| cyhal_m2m_event_callback_t | callback, | ||
| void * | callback_arg | ||
| ) |
Register an M2M callback handler.
This function will be called when one of the events enabled by cyhal_m2m_enable_event occurs.
| [in] | obj | The M2M object |
| [in] | callback | The callback handler which will be invoked when an event triggers |
| [in] | callback_arg | Generic argument that will be provided to the callback when called |
| void cyhal_m2m_enable_event | ( | cyhal_m2m_t * | obj, |
| cyhal_m2m_event_t | event, | ||
| uint8_t | intr_priority, | ||
| bool | enable | ||
| ) |
Configure M2M event enablement.
When an enabled event occurs, the function specified by cyhal_m2m_register_callback will be called.
| [in] | obj | The M2M object |
| [in] | event | The M2M event type |
| [in] | intr_priority | The priority for NVIC interrupt events. The priority from the most recent call will take precedence, i.e all events will have the same priority. |
| [in] | enable | True to turn on interrupts, False to turn off |
| cy_rslt_t cyhal_m2m_tx_send | ( | cyhal_m2m_t * | obj, |
| void * | buffer | ||
| ) |
Send M2M TX data packet.
This function sends a TX data packet. WHD is expected to set the packet size and send the "data" with whd_buffer_t type. The buffer type is dependent on the network stack. For example for LWIP, it is structured as follows: p->payload = payload; //packet data p->len = len; //packet size
| [in] | obj | The M2M object |
| [in] | buffer | Data buffer to use in the packet transaction |
| void cyhal_m2m_tx_release | ( | cyhal_m2m_t * | obj | ) |
Release next completed M2M TX data packet.
This function is used to free the TX data packet if TX error occurs.
| [in] | obj | The M2M object |
| void cyhal_m2m_rx_receive | ( | cyhal_m2m_t * | obj, |
| void ** | rxd_handle, | ||
| uint16_t ** | hwtag | ||
| ) |
Receive and read M2M RX data packet.
This function reads the next available RX packet.
| [in] | obj | The M2M object |
| [out] | rxd_handle | RX packet handle |
| [out] | hwtag | Hardware tag used to read the frame header |
| bool cyhal_m2m_rx_prepare | ( | cyhal_m2m_t * | obj | ) |
Prepare M2M RX ring buffer.
Prepares the internal M2M RX buffer (allocated during initialization) for receiving RX data packets.
| [in] | obj | The M2M object |
| cyhal_m2m_rx_status_t cyhal_m2m_rx_status | ( | cyhal_m2m_t * | obj | ) |
M2M RX activity status.
| [in] | obj | The M2M object |
| cyhal_m2m_event_t cyhal_m2m_intr_status | ( | cyhal_m2m_t * | obj, |
| bool * | signal_txdone | ||
| ) |
Read M2M TX and RX interrupt status.
Reads the interrupt status for TX and RX channels.
| [in] | obj | The M2M object |
| [out] | signal_txdone | TX done state as signaled by the RX interrupt |