Non-oETP DMA
openenoc_endpoint_dma.hopenenoc_endpoint_dma.cThese functions require advertised non-oETP DMA support. Frames include Ethernet header and payload, excluding preamble, SFD, and FCS. TX and RX maintain separate commands, byte counts, and sticky error records.
-
openenoc_endpoint_status_t openenoc_endpoint_non_oetp_dma_tx_request(volatile csr__endpoint_interface_t *endpoint, uint32_t buffer_address, uint32_t frame_length_bytes)
Submit one raw Ethernet frame for TX DMA.
- Parameters:
endpoint – In; required mapped, word-aligned endpoint-interface pointer.
buffer_address – In; first-byte address on the local 32-bit memory bus.
frame_length_bytes – In; nonzero complete-frame length, at most the advertised raw-frame limit.
- Returns:
OK;INVALID_ARGUMENTfor an invalid endpoint pointer;UNSUPPORTEDwhen raw DMA is absent;OUT_OF_RANGEfor length or address-space overflow;NOT_READYfor pending TX commands or active TX DMA.- Preconditions:
Capture previous status/count first. Keep the buffer accessible and synchronized until completion.
- Side effects:
Writes the TX address and length, then submits request without waiting.
-
openenoc_endpoint_status_t openenoc_endpoint_non_oetp_dma_rx_arm(volatile csr__endpoint_interface_t *endpoint, uint32_t buffer_address, uint32_t buffer_capacity_bytes)
Submit a one-frame receive buffer for RX DMA.
- Parameters:
endpoint – In; required mapped, word-aligned endpoint-interface pointer.
buffer_address – In; first-byte address on the local 32-bit memory bus.
buffer_capacity_bytes – In; nonzero capacity, at most the advertised raw-frame limit.
- Returns:
OK;INVALID_ARGUMENTfor an invalid endpoint pointer;UNSUPPORTEDwhen raw DMA is absent;OUT_OF_RANGEfor capacity or address-space overflow;NOT_READYfor pending RX commands or active/armed RX DMA.- Preconditions:
Capture previous status/count first. Keep the receive buffer accessible and synchronize it after completion.
- Side effects:
Writes the RX address and capacity, then submits arm without waiting. Once accepted and armed, eligible non-oETP traffic is routed to DMA.
-
openenoc_endpoint_status_t openenoc_endpoint_non_oetp_dma_get_status(volatile const csr__endpoint_interface_t *endpoint, openenoc_endpoint_dma_channel_t channel, openenoc_endpoint_non_oetp_dma_status_t *status)
Read a selected raw DMA channel status.
- Parameters:
endpoint – In; required mapped, word-aligned endpoint-interface pointer.
channel – In;
OPENENOC_ENDPOINT_DMA_TXorOPENENOC_ENDPOINT_DMA_RX.status – Out; required channel-status destination. transferred_bytes is TX bytes or RX bytes written; armed is false for TX.
- Returns:
OK;INVALID_ARGUMENTfor invalid endpoint pointer/channel/output;UNSUPPORTEDwhen raw DMA is absent.- Side effects:
Reads command/status and byte-count CSRs; preserves their state.
-
openenoc_endpoint_status_t openenoc_endpoint_non_oetp_dma_request_clear_errors(volatile csr__endpoint_interface_t *endpoint, openenoc_endpoint_dma_channel_t channel)
Submit error clearing for one raw DMA channel.
- Parameters:
endpoint – In; required mapped, word-aligned endpoint-interface pointer.
channel – In;
OPENENOC_ENDPOINT_DMA_TXorOPENENOC_ENDPOINT_DMA_RX.
- Returns:
OK;INVALID_ARGUMENTfor invalid endpoint pointer/channel;UNSUPPORTEDwhen raw DMA is absent;NOT_READYwhile a channel request or clear command is pending.- Side effects:
Submits clear without waiting. Hardware preserves active/armed work, done, byte count, and IRQ claims; new failures win a simultaneous clear.
Public declarations
The maintained header below provides the exact public type and enum definitions.
1typedef enum {
2 OPENENOC_ENDPOINT_DMA_TX = 0,
3 OPENENOC_ENDPOINT_DMA_RX = 1
4} openenoc_endpoint_dma_channel_t;
5
6typedef struct {
7 bool request_pending;
8 bool clear_errors_pending;
9 bool idle;
10 bool armed;
11 bool done;
12 bool error;
13 openenoc_endpoint_error_t error_code;
14 uint32_t transferred_bytes;
15} openenoc_endpoint_non_oetp_dma_status_t;
16