-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As defined in DMA wiki, adding a new event queue specific to DMA streams vents. As DMA streams events are specific, consolidated, events types, they should be pushed up to userspace tasks as such, instead of pushing bare IRQn. Bare IRQn are useless to userspace, as DMA IRQ acknowledge is under the kernel control. Instead pushing consolidated event is useful for user task, as they can directly manipulate such event for functional implementation. A DMA event is then received as a specific event of the `wait_for_event()` syscall. In that case, the event received looks like the following tuple: ``` typedef enum dma_chan_state { GPDMA_STATE_IDLE = 1, /**< DMA channel idle (not set or unused) */ GPDMA_STATE_RUNNING = 2, /**< DMA channel is running */ GPDMA_STATE_ABORTED = 3, /**< DMA stream aborted on SW request */ GPDMA_STATE_SUSPENDED = 4, /**< DMA stream suspended on SW request*/ GPDMA_STATE_TRANSMISSION_FAILURE = 5, /**< DMA transmission failure */ GPDMA_STATE_CONFIGURATION_FAILURE = 6, /**< DMA channel configuration failure */ GPDMA_STATE_OVERRUN = 7, /**< DMA transmission overrun */ GPDMA_STATE_TRANSFER_COMPLETE = 8, /**< DMA transfer complete for this channel */ GPDMA_STATE_HALF_TRANSFER = 9, /**< DMA transfer half-complete for this channel */ } dma_chan_state_t; { dma_handle, dma_event_state } ``` This tuple allows to directly associate the handle with a userspace context, and the DMA event type used to react to various events as required. The DMA event structure pushed by the kernel is the following, respecting the exchange_event_t standard Sentry header: ```c { header.type = EVENT_TYPE_DMA, header.length = 1, /* 1 data byte: the DMA event type */ header.magic = 0x4242, /* hardcoded by now */ header.source = dma_stream_handle, header.data[0] = dma_stream_event; } ``` This allows such a usage: ```c uint8_t dma_event_buf[sizeof(exchange_event_t)+sizeof(uint8_t)]; sys_dma_start(dmah); if (sys_wait_for_event(EVENT_TYPE_DMA, WAIT_FOREVER) == STATUS_OKAY) { copy_to_user(dma_event_buf, sizeof(exchange_event_t)+sizeof(uint8_t)); /* manipulate dma event info locally */ exchange_event_t *event = &dma_event_buf[0]; printf("dma event %d, from handle %lx\n", event->data[0], event->source); switch (event->data[0]) { case GPDMA_STATE_TRANSMISSION_FAILURE: // case GPDMA_STATE_USER_FAILURE: // case GPDMA_STATE_TRANSFER_COMPLETE: // } } ``` - [x] push DMA event type to uapi types.h header - [x] add support for DMA event queue in task context - [x] add support for DMA event queue push interface - [x] make DMA IRQn handler pushing the event to the corresponding stream owner - [x] Add DMA event to the `wait_for_event()` events list - [x] add support for DMA event pull interface from task context - [x] add support for DMA event at `wait_for_event()` syscall level - [x] update autotest to support this new API depends on #44 closes #60
- Loading branch information
Showing
13 changed files
with
344 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.