Mouse code for the MacroRat
mbed-dev/targets/TARGET_NUVOTON/TARGET_NUC472/device/StdDriver/nuc472_ebi.h@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /****************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file ebi.h |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @version V0.10 |
sahilmgandhi | 18:6a4db94011d3 | 4 | * $Revision: 6 $ |
sahilmgandhi | 18:6a4db94011d3 | 5 | * $Date: 14/09/30 1:12p $ |
sahilmgandhi | 18:6a4db94011d3 | 6 | * @brief NUC472/NUC442 EBI driver header file |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * @note |
sahilmgandhi | 18:6a4db94011d3 | 9 | * Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 10 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 11 | #ifndef __EBI_H__ |
sahilmgandhi | 18:6a4db94011d3 | 12 | #define __EBI_H__ |
sahilmgandhi | 18:6a4db94011d3 | 13 | |
sahilmgandhi | 18:6a4db94011d3 | 14 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 15 | extern "C" |
sahilmgandhi | 18:6a4db94011d3 | 16 | { |
sahilmgandhi | 18:6a4db94011d3 | 17 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 18 | |
sahilmgandhi | 18:6a4db94011d3 | 19 | |
sahilmgandhi | 18:6a4db94011d3 | 20 | /** @addtogroup NUC472_442_Device_Driver NUC472/NUC442 Device Driver |
sahilmgandhi | 18:6a4db94011d3 | 21 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 22 | */ |
sahilmgandhi | 18:6a4db94011d3 | 23 | |
sahilmgandhi | 18:6a4db94011d3 | 24 | /** @addtogroup NUC472_442_EBI_Driver EBI Driver |
sahilmgandhi | 18:6a4db94011d3 | 25 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 26 | */ |
sahilmgandhi | 18:6a4db94011d3 | 27 | |
sahilmgandhi | 18:6a4db94011d3 | 28 | /** @addtogroup NUC472_442_EBI_EXPORTED_CONSTANTS EBI Exported Constants |
sahilmgandhi | 18:6a4db94011d3 | 29 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 30 | */ |
sahilmgandhi | 18:6a4db94011d3 | 31 | |
sahilmgandhi | 18:6a4db94011d3 | 32 | /* Bank-0 constants */ |
sahilmgandhi | 18:6a4db94011d3 | 33 | #define EBI0_BASE_ADDR 0x60000000 ///<EBI bank 0 base address , 0x60000000 ~ 0x63FFFFFF \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 34 | #define EBI0_MAX_SIZE 0x400000 ///<EBI bank 0 max. size \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 35 | |
sahilmgandhi | 18:6a4db94011d3 | 36 | #define EBI0_READ_DATA8(Addr) *((volatile unsigned char *)(EBI0_BASE_ADDR+Addr)) ///< Read 8-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 37 | #define EBI0_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI0_BASE_ADDR+Addr))=Data ///< Write 8-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 38 | #define EBI0_READ_DATA16(Addr) *((volatile unsigned short *)(EBI0_BASE_ADDR+Addr)) ///< Read 16-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 39 | #define EBI0_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI0_BASE_ADDR+Addr))=Data ///< Write 16-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 40 | #define EBI0_READ_DATA32(Addr) *((volatile unsigned int *)(EBI0_BASE_ADDR+Addr)) ///< Read 32-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 41 | #define EBI0_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI0_BASE_ADDR+Addr))=Data ///< Write 32-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 42 | |
sahilmgandhi | 18:6a4db94011d3 | 43 | /* Bank-1 constants */ |
sahilmgandhi | 18:6a4db94011d3 | 44 | #define EBI1_BASE_ADDR 0x64000000 ///<EBI bank 1 base address , 0x64000000 ~ 0x67FFFFFF \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 45 | #define EBI1_MAX_SIZE 0x400000 ///<EBI bank 1 max. size \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 46 | |
sahilmgandhi | 18:6a4db94011d3 | 47 | #define EBI1_READ_DATA8(Addr) *((volatile unsigned char *)(EBI1_BASE_ADDR+Addr)) ///< Read 8-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 48 | #define EBI1_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI1_BASE_ADDR+Addr))=Data ///< Write 8-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 49 | #define EBI1_READ_DATA16(Addr) *((volatile unsigned short *)(EBI1_BASE_ADDR+Addr)) ///< Read 16-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 50 | #define EBI1_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI1_BASE_ADDR+Addr))=Data ///< Write 16-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 51 | #define EBI1_READ_DATA32(Addr) *((volatile unsigned int *)(EBI1_BASE_ADDR+Addr)) ///< Read 32-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 52 | #define EBI1_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI1_BASE_ADDR+Addr))=Data ///< Write 32-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 53 | |
sahilmgandhi | 18:6a4db94011d3 | 54 | /* Bank-2 constants */ |
sahilmgandhi | 18:6a4db94011d3 | 55 | #define EBI2_BASE_ADDR 0x68000000 ///<EBI bank 2 base address , 0x68000000 ~ 0x6BFFFFFF |
sahilmgandhi | 18:6a4db94011d3 | 56 | #define EBI2_MAX_SIZE 0x400000 ///<EBI bank 2 max. size |
sahilmgandhi | 18:6a4db94011d3 | 57 | |
sahilmgandhi | 18:6a4db94011d3 | 58 | #define EBI2_READ_DATA8(Addr) *((volatile unsigned char *)(EBI2_BASE_ADDR+Addr)) ///< Read 8-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 59 | #define EBI2_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI2_BASE_ADDR+Addr))=Data ///< Write 8-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 60 | #define EBI2_READ_DATA16(Addr) *((volatile unsigned short *)(EBI2_BASE_ADDR+Addr)) ///< Read 16-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 61 | #define EBI2_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI2_BASE_ADDR+Addr))=Data ///< Write 16-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 62 | #define EBI2_READ_DATA32(Addr) *((volatile unsigned int *)(EBI2_BASE_ADDR+Addr)) ///< Read 32-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 63 | #define EBI2_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI2_BASE_ADDR+Addr))=Data ///< Write 32-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 64 | |
sahilmgandhi | 18:6a4db94011d3 | 65 | /* Bank-3 constants */ |
sahilmgandhi | 18:6a4db94011d3 | 66 | #define EBI3_BASE_ADDR 0x6C000000 ///<EBI bank 3 base address , 0x6C000000 ~ 0x6FFFFFFF \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 67 | #define EBI3_MAX_SIZE 0x400000 ///<EBI bank 3 max. size \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 68 | |
sahilmgandhi | 18:6a4db94011d3 | 69 | #define EBI3_READ_DATA8(Addr) *((volatile unsigned char *)(EBI3_BASE_ADDR+Addr)) ///< Read 8-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 70 | #define EBI3_WRITE_DATA8(Addr, Data) *((volatile unsigned char *)(EBI3_BASE_ADDR+Addr))=Data ///< Write 8-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 71 | #define EBI3_READ_DATA16(Addr) *((volatile unsigned short *)(EBI3_BASE_ADDR+Addr)) ///< Read 16-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 72 | #define EBI3_WRITE_DATA16(Addr, Data) *((volatile unsigned short *)(EBI3_BASE_ADDR+Addr))=Data ///< Write 16-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 73 | #define EBI3_READ_DATA32(Addr) *((volatile unsigned int *)(EBI3_BASE_ADDR+Addr)) ///< Read 32-bit data from EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 74 | #define EBI3_WRITE_DATA32(Addr, Data) *((volatile unsigned int *)(EBI3_BASE_ADDR+Addr))=Data ///< Write 32-bit data to EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 75 | |
sahilmgandhi | 18:6a4db94011d3 | 76 | |
sahilmgandhi | 18:6a4db94011d3 | 77 | /* Constants for EBI bank number */ |
sahilmgandhi | 18:6a4db94011d3 | 78 | #define EBI_BANK0 0 ///< EBI bank 0 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 79 | #define EBI_BANK1 0x1 ///< EBI bank 1 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 80 | #define EBI_BANK2 0x2 ///< EBI bank 2 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 81 | #define EBI_BANK3 0x3 ///< EBI bank 3 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 82 | |
sahilmgandhi | 18:6a4db94011d3 | 83 | /* Constants for EBI CS Active Level */ |
sahilmgandhi | 18:6a4db94011d3 | 84 | #define EBI_CS_ACTIVE_HIGH 1 ///< EBI CS active level is high \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 85 | #define EBI_CS_ACTIVE_LOW 0 ///< EBI CS active level is low \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 86 | |
sahilmgandhi | 18:6a4db94011d3 | 87 | /* Constants for EBI data bus width */ |
sahilmgandhi | 18:6a4db94011d3 | 88 | #define EBI_BUSWIDTH_8BIT 8 ///< EBI bus width is 8-bit \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 89 | #define EBI_BUSWIDTH_16BIT 16 ///< EBI bus width is 16-bit \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 90 | |
sahilmgandhi | 18:6a4db94011d3 | 91 | /* Constants for EBI separate mode */ |
sahilmgandhi | 18:6a4db94011d3 | 92 | #define EBI_SEPARATEMODE_ENABLE 0x1 ///< Enable EBI separate mode \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 93 | #define EBI_SEPARATEMODE_DISABLE 0 ///< Disable EBI separate mode \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 94 | |
sahilmgandhi | 18:6a4db94011d3 | 95 | /* Constants for EBI MCLK divider */ |
sahilmgandhi | 18:6a4db94011d3 | 96 | #define EBI_MCLKDIV_1 0 ///< EBI clock is MCLK div 1 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 97 | #define EBI_MCLKDIV_2 0x1 ///< EBI clock is MCLK div 2 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 98 | #define EBI_MCLKDIV_4 0x2 ///< EBI clock is MCLK div 4 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 99 | #define EBI_MCLKDIV_8 0x3 ///< EBI clock is MCLK div 8 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 100 | #define EBI_MCLKDIV_16 0x4 ///< EBI clock is MCLK div 16 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 101 | #define EBI_MCLKDIV_32 0x5 ///< EBI clock is MCLK div 32 \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 102 | |
sahilmgandhi | 18:6a4db94011d3 | 103 | #define EBI_TIMING_FASTEST 0x0 ///< EBI timing is the fastest \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 104 | #define EBI_TIMING_VERYFAST 0x1 ///< EBI timing is very fast \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 105 | #define EBI_TIMING_FAST 0x2 ///< EBI timing is fast \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 106 | #define EBI_TIMING_NORMAL 0x3 ///< EBI timing is normal \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 107 | #define EBI_TIMING_SLOW 0x4 ///< EBI timing is slow \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 108 | #define EBI_TIMING_VERYSLOW 0x5 ///< EBI timing is very slow \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 109 | #define EBI_TIMING_SLOWEST 0x6 ///< EBI timing is the slowest \hideinitializer |
sahilmgandhi | 18:6a4db94011d3 | 110 | |
sahilmgandhi | 18:6a4db94011d3 | 111 | /*@}*/ /* end of group NUC472_442_EBI_EXPORTED_CONSTANTS */ |
sahilmgandhi | 18:6a4db94011d3 | 112 | |
sahilmgandhi | 18:6a4db94011d3 | 113 | |
sahilmgandhi | 18:6a4db94011d3 | 114 | /** @addtogroup NUC472_442_EBI_EXPORTED_FUNCTIONS EBI Exported Functions |
sahilmgandhi | 18:6a4db94011d3 | 115 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 116 | */ |
sahilmgandhi | 18:6a4db94011d3 | 117 | void EBI_Open(uint32_t u32Bank, uint32_t u32DataWidth, uint32_t u32TimingClass, uint32_t u32BusMode, uint32_t u32CSActiveLevel); |
sahilmgandhi | 18:6a4db94011d3 | 118 | void EBI_Close(uint32_t u32Bank); |
sahilmgandhi | 18:6a4db94011d3 | 119 | void EBI_SetBusTiming(uint32_t u32Bank, uint32_t u32TimingConfig, uint32_t u32MclkDiv); |
sahilmgandhi | 18:6a4db94011d3 | 120 | void EBI_EnableCrypto(uint32_t u32Bank, uint32_t *u32Key); |
sahilmgandhi | 18:6a4db94011d3 | 121 | void EBI_DisbleCrypto(uint32_t u32Bank); |
sahilmgandhi | 18:6a4db94011d3 | 122 | |
sahilmgandhi | 18:6a4db94011d3 | 123 | |
sahilmgandhi | 18:6a4db94011d3 | 124 | /*@}*/ /* end of group NUC472_442_EBI_EXPORTED_FUNCTIONS */ |
sahilmgandhi | 18:6a4db94011d3 | 125 | |
sahilmgandhi | 18:6a4db94011d3 | 126 | /*@}*/ /* end of group NUC472_442_EBI_Driver */ |
sahilmgandhi | 18:6a4db94011d3 | 127 | |
sahilmgandhi | 18:6a4db94011d3 | 128 | /*@}*/ /* end of group NUC472_442_Device_Driver */ |
sahilmgandhi | 18:6a4db94011d3 | 129 | |
sahilmgandhi | 18:6a4db94011d3 | 130 | #ifdef __cplusplus |
sahilmgandhi | 18:6a4db94011d3 | 131 | } |
sahilmgandhi | 18:6a4db94011d3 | 132 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 133 | |
sahilmgandhi | 18:6a4db94011d3 | 134 | #endif //__EBI_H__ |
sahilmgandhi | 18:6a4db94011d3 | 135 | |
sahilmgandhi | 18:6a4db94011d3 | 136 | /*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/ |