![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
System DMA (Direct Memory Access) driver for Allwinner (sunxi) platforms. More...
#include <io.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <types.h>#include <log.h>#include <sys-dma.h>
Macros | |
| #define | SUNXI_DMA_MAX 4 |
| Maximum number of DMA channels supported. | |
Functions | |
| static sunxi_dma_desc_t dma_channel_desc[SUNXI_DMA_MAX] | __attribute__ ((aligned(64))) |
| Array of DMA descriptor structures. | |
| void | sunxi_dma_clk_init (sunxi_dma_t *dma) |
| Initialize DMA clock. | |
| void | sunxi_dma_init (sunxi_dma_t *dma) |
| Initialize the DMA controller. | |
| void | sunxi_dma_exit (sunxi_dma_t *dma) |
| Exit and clean up DMA resources. | |
| uint32_t | sunxi_dma_request_from_last (uint32_t dmatype) |
| Request a DMA channel starting from the last available. | |
| uint32_t | sunxi_dma_request (uint32_t dmatype) |
| Request a DMA channel. | |
| int | sunxi_dma_release (uint32_t dma_fd) |
| Release a DMA channel. | |
| int | sunxi_dma_setting (uint32_t dma_fd, sunxi_dma_set_t *cfg) |
| Configure DMA channel settings. | |
| int | sunxi_dma_start (uint32_t dma_fd, uint32_t saddr, uint32_t daddr, uint32_t bytes) |
| Start a DMA transfer. | |
| int | sunxi_dma_stop (uint32_t dma_fd) |
| Stop a DMA transfer. | |
| int | sunxi_dma_querystatus (uint32_t dma_fd) |
| Query DMA transfer status. | |
| int | sunxi_dma_install_int (uint32_t dma_fd, void *p) |
| Install interrupt handler for DMA channel. | |
| int | sunxi_dma_enable_int (uint32_t dma_fd) |
| Enable interrupts for a DMA channel. | |
| int | sunxi_dma_disable_int (uint32_t dma_fd) |
| Disable interrupts for a DMA channel. | |
| int | sunxi_dma_free_int (uint32_t dma_fd) |
| Free interrupt handler for a DMA channel. | |
| int | sunxi_dma_test (uint32_t *src_addr, uint32_t *dst_addr, uint32_t len) |
| Test DMA functionality. | |
Variables | |
| static int | dma_int_cnt = 0 |
| Interrupt count tracking variable. | |
| static int | dma_init_ok = -1 |
| DMA initialization status. | |
| static sunxi_dma_source_t | dma_channel_source [SUNXI_DMA_MAX] |
| Array of DMA channel source structures. | |
| static uint32_t | DMA_REG_BASE = 0x0 |
| Base address of DMA registers. | |
System DMA (Direct Memory Access) driver for Allwinner (sunxi) platforms.
This file implements DMA functionality for transferring data between memory and peripherals without CPU intervention, supporting multiple channels, interrupt handling, and various DMA operations.
| #define SUNXI_DMA_MAX 4 |
Maximum number of DMA channels supported.
Define the maximum number of DMA channels available in the system. Defaults to 4 if not already defined.
|
static |
Array of DMA descriptor structures.
Stores DMA transfer descriptors for each channel, aligned to 64 bytes
| void sunxi_dma_clk_init | ( | sunxi_dma_t * | dma | ) |
Initialize DMA clock.
Configures the clock settings for the DMA controller, including bus clock gating, DMA reset, and DMA clock gating.
| dma | Pointer to DMA configuration structure containing clock register information |
| int sunxi_dma_disable_int | ( | uint32_t | dma_fd | ) |
Disable interrupts for a DMA channel.
Disables interrupts for the specified DMA.
Disables interrupts for a specific DMA channel.
| dma_fd | Handle to the DMA channel |
| int sunxi_dma_enable_int | ( | uint32_t | dma_fd | ) |
Enable interrupts for a DMA channel.
Enables interrupts for the specified DMA.
Enables interrupts for a specific DMA channel, specifically package end interrupts.
| dma_fd | Handle to the DMA channel |
| void sunxi_dma_exit | ( | sunxi_dma_t * | dma | ) |
Exit and clean up DMA resources.
Clean up and exit the DMA subsystem.
Releases all DMA channels, disables interrupts, and shuts down the DMA controller.
| dma | Pointer to DMA configuration structure |
| int sunxi_dma_free_int | ( | uint32_t | dma_fd | ) |
Free interrupt handler for a DMA channel.
Frees the interrupt resources for the specified DMA.
Releases the interrupt handler associated with a DMA channel and clears pending interrupts.
| dma_fd | Handle to the DMA channel |
| void sunxi_dma_init | ( | sunxi_dma_t * | dma | ) |
Initialize the DMA controller.
Initialize the DMA subsystem.
Initializes the DMA controller by setting up registers, clearing interrupts, configuring auto clock gating, and initializing channel structures.
| dma | Pointer to DMA configuration structure containing base addresses and settings |
| int sunxi_dma_install_int | ( | uint32_t | dma_fd, |
| void * | p | ||
| ) |
Install interrupt handler for DMA channel.
Installs an interrupt handler for the DMA.
Sets up an interrupt handler for a DMA channel and clears any pending interrupts.
| dma_fd | Handle to the DMA channel |
| p | User data to associate with the interrupt handler |
| int sunxi_dma_querystatus | ( | uint32_t | dma_fd | ) |
Query DMA transfer status.
Query the status of a DMA transfer.
Checks whether a DMA transfer is still in progress on the specified channel.
| dma_fd | Handle to the DMA channel to query |
| int sunxi_dma_release | ( | uint32_t | dma_fd | ) |
Release a DMA channel.
Release a previously requested DMA channel.
Releases a previously requested DMA channel, disabling its interrupts.
| dma_fd | Handle to the DMA channel to release |
Request a DMA channel.
Request a DMA channel of the specified type.
Searches for an available DMA channel starting from channel 0.
| dmatype | Type of DMA channel to request (currently unused) |
Request a DMA channel starting from the last available.
Request a DMA channel from the last allocated channel of the specified type.
Searches for an available DMA channel starting from the highest-numbered channel.
| dmatype | Type of DMA channel to request (currently unused) |
| int sunxi_dma_setting | ( | uint32_t | dma_fd, |
| sunxi_dma_set_t * | cfg | ||
| ) |
Configure DMA channel settings.
Configure the settings of a DMA channel.
Sets up a DMA channel with specified configuration parameters like loop mode, wait cycles, and data block size.
| dma_fd | Handle to the DMA channel to configure |
| cfg | Pointer to configuration structure containing DMA settings |
Start a DMA transfer.
Initiates a DMA data transfer from source to destination address with specified size.
| dma_fd | Handle to the DMA channel to use |
| saddr | Source address for the DMA transfer |
| daddr | Destination address for the DMA transfer |
| bytes | Number of bytes to transfer |
| int sunxi_dma_stop | ( | uint32_t | dma_fd | ) |
Stop a DMA transfer.
Stop a currently running DMA transfer.
Halts an ongoing DMA transfer on the specified channel.
| dma_fd | Handle to the DMA channel to stop |
Test DMA functionality.
Perform a test DMA transfer between the specified source and destination addresses.
Performs a DMA transfer test between two memory regions, verifies data integrity, and reports transfer performance.
| src_addr | Source memory address for test transfer |
| dst_addr | Destination memory address for test transfer |
| len | Length of data to transfer in bytes |
|
static |
Array of DMA channel source structures.
Stores information about each DMA channel's state and configuration
|
static |
DMA initialization status.
Tracks whether DMA has been initialized (-1 = not initialized, >=0 = initialized)
|
static |
Interrupt count tracking variable.
Tracks the number of active DMA interrupts
|
static |
Base address of DMA registers.
Stores the base address of the DMA controller registers