00001 00013 #ifndef _HAL_DMA_H_ 00014 #define _HAL_DMA_H_ 00015 00025 /* 00026 * INCLUDE FILES 00027 **************************************************************************************** 00028 */ 00029 #include "co_int.h" 00030 #include "co_bool.h" 00031 // for NULL and size_t 00032 #include <stddef.h> 00033 00034 // for target dependent directives 00035 #include "rwnx_config.h" 00036 00037 // for __INLINE 00038 #include "compiler.h" 00039 00040 // for list definitions 00041 #include "co_list.h" 00042 00043 // for DMA definitions 00044 #include "dma.h" 00045 00046 /* 00047 * DEFINITIONS 00048 **************************************************************************************** 00049 */ 00050 00052 #define HAL_DMA_POOL (RW_BFMER_EN) 00053 00054 #if (HAL_DMA_POOL) 00056 #define HAL_DMA_DESC_POOL_SIZE (10) 00057 #endif //(HAL_DMA_POOL) 00058 00059 /* 00060 * ENUMERATIONS 00061 **************************************************************************************** 00062 */ 00064 enum 00065 { 00067 DMA_DL, 00069 DMA_UL, 00071 DMA_MAX 00072 }; 00073 00074 /* 00075 * STRUCTURE DECLARATIONS 00076 **************************************************************************************** 00077 */ 00079 typedef void (*cb_dma_func_ptr)(void *, int); 00080 00082 struct hal_dma_desc_tag 00083 { 00085 struct co_list_hdr hdr; 00087 struct dma_desc *dma_desc; 00089 cb_dma_func_ptr cb; 00091 void *env; 00092 }; 00093 00095 struct hal_dma_env_tag 00096 { 00098 struct co_list prog[DMA_MAX]; 00100 struct co_list free_gp_dma_descs; 00102 uint16_t lli_cnt[DMA_MAX]; 00103 }; 00104 00105 /* 00106 * GLOBAL VARIABLES DECLARATIONS 00107 **************************************************************************************** 00108 */ 00110 extern struct hal_dma_env_tag hal_dma_env; 00111 00112 /* 00113 * FUNCTION DECLARATIONS 00114 **************************************************************************************** 00115 */ 00121 void hal_dma_init(void); 00122 00131 void hal_dma_push(struct hal_dma_desc_tag *desc, int type); 00132 00140 void hal_dma_evt(int dma_queue); 00141 00147 void hal_dma_dl_irq(void); 00148 00154 void hal_dma_ul_irq(void); 00155 00156 #if (HAL_DMA_POOL) 00157 00168 struct hal_dma_desc_tag *hal_dma_get_desc(void); 00169 00177 void hal_dma_release_desc(struct hal_dma_desc_tag *gp_dma_desc); 00178 #endif //(HAL_DMA_POOL) 00179 00181 00182 #endif // _HAL_DMA_H_
1.6.1