1 /* 2 * =========================================================================================== 3 * 4 * Filename: sunxi_eise.h 5 * 6 * Description: EISE HAL definition. 7 * 8 * Version: Melis3.0 9 * Create: 2020-01-09 11:11:56 10 * Revision: none 11 * Compiler: 12 * 13 * Author: ganqiuye(ganqiuye@allwinnertech.com) 14 * Organization: SWC-MPD 15 * Last Modified: 2020-04-02 17:32:52 16 * 17 * =========================================================================================== 18 */ 19 20 #ifndef SUNXI_HAL_EISE_H 21 #define SUNXI_HAL_EISE_H 22 #include <hal_clk.h> 23 #include "hal_sem.h" 24 #ifdef __cplusplus 25 extern "C" 26 { 27 #endif 28 29 #include "sunxi_hal_common.h" 30 31 #define DEVICE_NAME "sunxi_eise" 32 33 /* system address */ 34 #define PLL_ISE_CTRL_REG (0x00D0) 35 #define EISE_CLK_REG (0x06D0) 36 #define MBUS_CLK_GATING_REG (0x0804) 37 #define EISE_BGR_REG (0x06DC) 38 39 /* eise register */ 40 #define EISE_CTRL_REG (0x00) 41 #define EISE_IN_SIZE (0x28) 42 #define EISE_OUT_SIZE (0x38) 43 #define EISE_ICFG_REG (0x04) 44 #define EISE_OCFG_REG (0x08) 45 #define EISE_INTERRUPT_EN (0x0c) 46 #define EISE_TIME_OUT_NUM (0x3c) 47 48 #define EISE_INTERRUPT_STATUS (0x10) 49 #define EISE_ERROR_FLAG (0x14) 50 #define EISE_RESET_REG (0x88) 51 52 53 struct eise_register{ 54 unsigned int addr; 55 unsigned int value; 56 }; 57 58 typedef struct hal_eise_t{ 59 unsigned int eise_base_addr; 60 unsigned int ccmu_base_addr; 61 // unsigned long err_cnt; 62 //unsigned long interrupt_times; 63 unsigned int irq_id; 64 hal_clk_id_t pclk; 65 hal_clk_id_t mclk; 66 hal_sem_t hal_sem; 67 }hal_eise_t; 68 69 typedef struct sunxi_hal_driver_eise 70 { 71 int32_t (*initialize)(int32_t dev); 72 73 int32_t (*uninitialize)(int32_t dev); 74 75 int32_t (*send)(int32_t dev, const char *data, uint32_t num); 76 77 int32_t (*receive)(int32_t dev, int *data, uint32_t num); 78 79 int32_t (*control)(int32_t dev, uint32_t control, void* arg); 80 sunxi_hal_poll_ops *poll_ops; 81 } const sunxi_hal_driver_eise_t; 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif 88