|
VSF Documented
|
Go to the source code of this file.
Data Structures | |
| struct | vsf_dma_cfg_t |
| Configuration structure for DMA. More... | |
| struct | vsf_dma_channel_hint_t |
| DMA channel hint structure for channel allocation. More... | |
| struct | vsf_dma_isr_t |
| struct | vsf_dma_channel_cfg_t |
| dma configuration More... | |
| struct | vsf_dma_channel_sg_desc_t |
| DMA scatter-gather descriptor structure. More... | |
| struct | vsf_dma_channel_status_t |
| struct | vsf_dma_capability_t |
| DMA capability structure that can be reimplemented in specific HAL drivers. More... | |
| struct | vsf_dma_op_t |
| struct | vsf_dma_t |
Macros | |
| #define | VSF_DMA_CFG_MULTI_CLASS ENABLED |
| Enable multi-class support by default for maximum availability. | |
| #define | VSF_DMA_CFG_PREFIX vsf |
| We can redefine macro VSF_DMA_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code. | |
| #define | VSF_DMA_CFG_FUNCTION_RENAME ENABLED |
| Disable VSF_DMA_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_dma_init()). | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE DISABLED |
| Enable the option to reimplement channel mode type in specific hardware drivers. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED |
| Enable the option to reimplement interrupt mask type in specific hardware drivers. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_ADDR DISABLED |
| Enable the option to reimplement DMA address type in specific hardware drivers. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_HINT DISABLED |
| Enable the option to reimplement Channel Hint type configuration in specific hardware drivers. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG DISABLED |
| Enable the option to reimplement channel configuration type. For compatibility, do not delete members when redefining vsf_dma_channel_cfg_t The vsf_dma_isr_handler_t and vsf_dma_isr_t types also need to be redefined. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_SG_CFG DISABLED |
| Enable the option to reimplement DMA channel scatter-gather configuration type. | |
| #define | __VSF_DMA_CFG_SUPPORT_STANDARD_OPTIONAL DISABLED |
| Enable standard optional features support. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CFG DISABLED |
| Enable the option to reimplement DMA configuration type. For compatibility, do not delete members when redefining vsf_dma_cfg_t. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_STATUS DISABLED |
| Enable the option to reimplement DMA channel status type. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL DISABLED |
| In specific hardware driver, enable macro VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL to redefine enum vsf_dma_ctrl_t. | |
| #define | VSF_DMA_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED |
| Enable the option to reimplement capability type. For compatibility, do not delete members when redefining vsf_dma_capability_t. | |
| #define | VSF_DMA_CFG_INHERIT_HAL_CAPABILITY ENABLED |
| Enable inheriting HAL capability to reuse common capability definitions. | |
| #define | VSF_DMA_CHANNEL_SG_ARRAY(__NAME, __COUNT, ...) |
| DMA scatter-gather configuration macro. | |
| #define | VSF_DMA_CHANNEL_SG_ITEM(__MODE, __SRC_ADDR, __DST_ADDR, __CNT, ...) |
| DMA scatter-gather item configuration macro. | |
| #define | VSF_DMA_APIS(__prefix_name) |
| DMA API template, used to generate DMA type, specific prefix function declarations, etc. | |
| #define | __VSF_DMA_GET_ARG_OR_DEFAULT(__DEFAULT, __ARG, ...) (__ARG) |
| #define | VSF_DMA_CHANNEL_HINT_INIT(__CHANNEL, __REQUEST_LINE, ...) |
| #define | VSF_DMA_CHANNEL_CFG_INIT(__MODE, __ISR, __IRQ_MASK, __SRC_REQ_IDX, __DST_REQ_IDX, ...) |
| Initialize vsf_dma_channel_cfg_t structure with default values. | |
Typedefs | |
| typedef uintptr_t | vsf_dma_addr_t |
| DMA address type, used for source address, destination address and scatter-gather descriptor address. | |
| typedef enum vsf_dma_channel_mode_t | vsf_dma_channel_mode_t |
| typedef enum vsf_dma_irq_mask_t | vsf_dma_irq_mask_t |
| typedef struct vsf_dma_cfg_t | vsf_dma_cfg_t |
| Configuration structure for DMA. | |
| typedef struct vsf_dma_channel_hint_t | vsf_dma_channel_hint_t |
| DMA channel hint structure for channel allocation. | |
| typedef struct vsf_dma_t | vsf_dma_t |
| typedef void | vsf_dma_isr_handler_t(void *target_ptr, vsf_dma_t *dma_ptr, int8_t channel, vsf_dma_irq_mask_t irq_mask) |
| typedef struct vsf_dma_isr_t | vsf_dma_isr_t |
| typedef struct vsf_dma_channel_cfg_t | vsf_dma_channel_cfg_t |
| dma configuration | |
| typedef struct vsf_dma_channel_sg_desc_t | vsf_dma_channel_sg_desc_t |
| DMA scatter-gather descriptor structure. | |
| typedef struct vsf_dma_channel_status_t | vsf_dma_channel_status_t |
| typedef enum vsf_dma_ctrl_t | vsf_dma_ctrl_t |
| Predefined VSF DMA control commands that can be reimplemented in specific HAL drivers. | |
| typedef struct vsf_dma_capability_t | vsf_dma_capability_t |
| DMA capability structure that can be reimplemented in specific HAL drivers. | |
| typedef struct vsf_dma_op_t | vsf_dma_op_t |
Functions | |
| vsf_err_t | vsf_dma_init (vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr) |
| Initialize a DMA instance. | |
| void | vsf_dma_fini (vsf_dma_t *dma_ptr) |
| Finalize a DMA instance. | |
| vsf_err_t | vsf_dma_get_configuration (vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr) |
| Get the current configuration of DMA instance. | |
| vsf_dma_capability_t | vsf_dma_capability (vsf_dma_t *dma_ptr) |
| Get the capabilities of DMA instance. | |
| vsf_err_t | vsf_dma_channel_acquire (vsf_dma_t *dma_ptr, vsf_dma_channel_hint_t *channel_hint_ptr) |
| DMA acquire a new channel. | |
| void | vsf_dma_channel_release (vsf_dma_t *dma_ptr, uint8_t channel) |
| Release a DMA channel. | |
| vsf_err_t | vsf_dma_channel_config (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr) |
| Configure a DMA channel. | |
| vsf_err_t | vsf_dma_channel_get_configuration (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr) |
| Get the current configuration of a DMA channel. | |
| vsf_err_t | vsf_dma_channel_start (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_addr_t src_address, vsf_dma_addr_t dst_address, uint32_t count) |
| Start a DMA channel transfer. | |
| vsf_err_t | vsf_dma_channel_cancel (vsf_dma_t *dma_ptr, uint8_t channel) |
| Cancel the transmission of a specific DMA channel. | |
| vsf_err_t | vsf_dma_channel_sg_config_desc (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_isr_t isr, vsf_dma_channel_sg_desc_t *sg_desc_ptr, uint32_t sg_count) |
| Configure a DMA channel for scatter-gather transfer. | |
| vsf_err_t | vsf_dma_channel_sg_start (vsf_dma_t *dma_ptr, uint8_t channel) |
| Start a DMA scatter-gather transfer. | |
| uint32_t | vsf_dma_channel_get_transferred_count (vsf_dma_t *dma_ptr, uint8_t channel) |
| Get the count of data items transferred for a specific DMA channel. | |
| vsf_dma_channel_status_t | vsf_dma_channel_status (vsf_dma_t *dma_ptr, uint8_t channel) |
| Get status of a DMA channel. | |
| vsf_err_t | vsf_dma_ctrl (vsf_dma_t *dma_ptr, vsf_dma_ctrl_t ctrl, void *param) |
| Execute a control command on a DMA instance. | |
| #define VSF_DMA_CFG_MULTI_CLASS ENABLED |
Enable multi-class support by default for maximum availability.
| #define VSF_DMA_CFG_PREFIX vsf |
We can redefine macro VSF_DMA_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code.
| #define VSF_DMA_CFG_FUNCTION_RENAME ENABLED |
Disable VSF_DMA_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_dma_init()).
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_MODE DISABLED |
Enable the option to reimplement channel mode type in specific hardware drivers.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED |
Enable the option to reimplement interrupt mask type in specific hardware drivers.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_ADDR DISABLED |
Enable the option to reimplement DMA address type in specific hardware drivers.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_HINT DISABLED |
Enable the option to reimplement Channel Hint type configuration in specific hardware drivers.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_CFG DISABLED |
Enable the option to reimplement channel configuration type. For compatibility, do not delete members when redefining vsf_dma_channel_cfg_t The vsf_dma_isr_handler_t and vsf_dma_isr_t types also need to be redefined.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_SG_CFG DISABLED |
Enable the option to reimplement DMA channel scatter-gather configuration type.
| #define __VSF_DMA_CFG_SUPPORT_STANDARD_OPTIONAL DISABLED |
Enable standard optional features support.
This macro controls the availability of standard optional features in the template. Standard optional features include:
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CFG DISABLED |
Enable the option to reimplement DMA configuration type. For compatibility, do not delete members when redefining vsf_dma_cfg_t.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CHANNEL_STATUS DISABLED |
Enable the option to reimplement DMA channel status type.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL DISABLED |
In specific hardware driver, enable macro VSF_DMA_CFG_REIMPLEMENT_TYPE_CTRL to redefine enum vsf_dma_ctrl_t.
| #define VSF_DMA_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED |
Enable the option to reimplement capability type. For compatibility, do not delete members when redefining vsf_dma_capability_t.
| #define VSF_DMA_CFG_INHERIT_HAL_CAPABILITY ENABLED |
Enable inheriting HAL capability to reuse common capability definitions.
| #define VSF_DMA_CHANNEL_SG_ARRAY | ( | __NAME, | |
| __COUNT, | |||
| ... | |||
| ) |
DMA scatter-gather configuration macro.
| #define VSF_DMA_CHANNEL_SG_ITEM | ( | __MODE, | |
| __SRC_ADDR, | |||
| __DST_ADDR, | |||
| __CNT, | |||
| ... | |||
| ) |
DMA scatter-gather item configuration macro.
| #define VSF_DMA_APIS | ( | __prefix_name | ) |
DMA API template, used to generate DMA type, specific prefix function declarations, etc.
| [in] | __prefix_name | The prefix used for generating DMA functions. |
| #define __VSF_DMA_GET_ARG_OR_DEFAULT | ( | __DEFAULT, | |
| __ARG, | |||
| ... | |||
| ) | (__ARG) |
| #define VSF_DMA_CHANNEL_HINT_INIT | ( | __CHANNEL, | |
| __REQUEST_LINE, | |||
| ... | |||
| ) |
| #define VSF_DMA_CHANNEL_CFG_INIT | ( | __MODE, | |
| __ISR, | |||
| __IRQ_MASK, | |||
| __SRC_REQ_IDX, | |||
| __DST_REQ_IDX, | |||
| ... | |||
| ) |
Initialize vsf_dma_channel_cfg_t structure with default values.
| [in] | __MODE | DMA channel mode |
| [in] | __ISR | Interrupt service routine configuration |
| [in] | __IRQ_MASK | Interrupt mask |
| [in] | __SRC_REQ_IDX | Source request index |
| [in] | __DST_REQ_IDX | Destination request index |
| [in] | ... | Optional interrupt priority. If not provided, defaults to vsf_arch_prio_invalid. |
| typedef uintptr_t vsf_dma_addr_t |
DMA address type, used for source address, destination address and scatter-gather descriptor address.
| typedef enum vsf_dma_channel_mode_t vsf_dma_channel_mode_t |
| typedef enum vsf_dma_irq_mask_t vsf_dma_irq_mask_t |
| typedef struct vsf_dma_cfg_t vsf_dma_cfg_t |
Configuration structure for DMA.
| typedef struct vsf_dma_channel_hint_t vsf_dma_channel_hint_t |
DMA channel hint structure for channel allocation.
| typedef void vsf_dma_isr_handler_t(void *target_ptr, vsf_dma_t *dma_ptr, int8_t channel, vsf_dma_irq_mask_t irq_mask) |
| typedef struct vsf_dma_isr_t vsf_dma_isr_t |
| typedef struct vsf_dma_channel_cfg_t vsf_dma_channel_cfg_t |
dma configuration
DMA channel configuration structure for transfer setup
| typedef struct vsf_dma_channel_sg_desc_t vsf_dma_channel_sg_desc_t |
DMA scatter-gather descriptor structure.
| typedef struct vsf_dma_channel_status_t vsf_dma_channel_status_t |
| typedef enum vsf_dma_ctrl_t vsf_dma_ctrl_t |
Predefined VSF DMA control commands that can be reimplemented in specific HAL drivers.
Optional control commands require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can check for supported features at compile-time.
Feature Classification:
| typedef struct vsf_dma_capability_t vsf_dma_capability_t |
DMA capability structure that can be reimplemented in specific HAL drivers.
| typedef struct vsf_dma_op_t vsf_dma_op_t |
| anonymous enum |
| enum vsf_dma_irq_mask_t |
| enum vsf_dma_ctrl_t |
Predefined VSF DMA control commands that can be reimplemented in specific HAL drivers.
Optional control commands require one or more enumeration options and a macro with the same name to determine if they are supported at runtime. If the feature supports more than one option, it is recommended to provide the corresponding MASK option, so that the user can check for supported features at compile-time.
Feature Classification:
|
extern |
Initialize a DMA instance.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | cfg_ptr | a pointer to structure vsf_dma_cfg_t |
|
extern |
|
extern |
Get the current configuration of DMA instance.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [out] | cfg_ptr | a pointer to structure vsf_dma_cfg_t to store the current configuration |
|
extern |
Get the capabilities of DMA instance.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
|
extern |
DMA acquire a new channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in,out] | channel_hint_ptr | a pointer to DMA channel hint. User should provide appropriate hint information based on actual requirements. If the actually allocated channel or other configuration differs from user's expectation, the function may modify channel_hint_ptr to notify the user of the actual allocation. The allocated channel number will be stored in channel_hint_ptr->channel. |
Release a DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
|
extern |
Configure a DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
| [in] | cfg_ptr | a pointer to DMA channel configuration |
|
extern |
Get the current configuration of a DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
| [out] | cfg_ptr | a pointer to structure vsf_dma_channel_cfg_t to store the current configuration |
|
extern |
Start a DMA channel transfer.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
| [in] | src_address | source address |
| [in] | dst_address | destination address |
| [in] | count | number of data items to be transferred |
Cancel the transmission of a specific DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
|
extern |
Configure a DMA channel for scatter-gather transfer.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
| [in] | isr | DMA interrupt handler |
| [in] | cfg_ptr | a pointer to DMA channel scatter-gather configuration |
| [in] | sg_count | number of scatter-gather configurations |
Start a DMA scatter-gather transfer.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
Get the count of data items transferred for a specific DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
|
extern |
Get status of a DMA channel.
| [in] | dma_ptr | a pointer to structure vsf_dma_t |
| [in] | channel | channel number |
|
extern |
Execute a control command on a DMA instance.
| [in,out] | dma_ptr | pointer to DMA instance structure vsf_dma_t |
| [in] | ctrl | Control command from vsf_dma_ctrl_t enumeration |
| [in] | param | Command-specific parameter (can be NULL depending on command) |