1 /*********************************************************************************************************//** 2 * @file ht32f5xxxx_ebi.h 3 * @version $Rev:: 2772 $ 4 * @date $Date:: 2018-05-15 #$ 5 * @brief The header file of the EBI library. 6 ************************************************************************************************************* 7 * @attention 8 * 9 * Firmware Disclaimer Information 10 * 11 * 1. The customer hereby acknowledges and agrees that the program technical documentation, including the 12 * code, which is supplied by Holtek Semiconductor Inc., (hereinafter referred to as "HOLTEK") is the 13 * proprietary and confidential intellectual property of HOLTEK, and is protected by copyright law and 14 * other intellectual property laws. 15 * 16 * 2. The customer hereby acknowledges and agrees that the program technical documentation, including the 17 * code, is confidential information belonging to HOLTEK, and must not be disclosed to any third parties 18 * other than HOLTEK and the customer. 19 * 20 * 3. The program technical documentation, including the code, is provided "as is" and for customer reference 21 * only. After delivery by HOLTEK, the customer shall use the program technical documentation, including 22 * the code, at their own risk. HOLTEK disclaims any expressed, implied or statutory warranties, including 23 * the warranties of merchantability, satisfactory quality and fitness for a particular purpose. 24 * 25 * <h2><center>Copyright (C) Holtek Semiconductor Inc. All rights reserved</center></h2> 26 ************************************************************************************************************/ 27 28 /* Define to prevent recursive inclusion -------------------------------------------------------------------*/ 29 #ifndef __HT32F5XXXX_EBI_H 30 #define __HT32F5XXXX_EBI_H 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* Includes ------------------------------------------------------------------------------------------------*/ 37 #include "ht32.h" 38 39 /** @addtogroup HT32F5xxxx_Peripheral_Driver HT32F5xxxx Peripheral Driver 40 * @{ 41 */ 42 43 /** @addtogroup EBI 44 * @{ 45 */ 46 47 48 /* Exported types ------------------------------------------------------------------------------------------*/ 49 /** @defgroup EBI_Exported_Types EBI exported types 50 * @{ 51 */ 52 typedef struct 53 { 54 u32 EBI_Bank; 55 u32 EBI_Mode; 56 u32 EBI_IdleCycle; 57 u32 EBI_ChipSelectPolarity; 58 u32 EBI_AddressLatchPolarity; 59 u32 EBI_WriteEnablePolarity; 60 u32 EBI_ReadEnablePolarity; 61 u32 EBI_IdleCycleTime; 62 u32 EBI_AddressSetupTime; 63 u32 EBI_AddressHoldTime; 64 u32 EBI_WriteSetupTime; 65 u32 EBI_WriteStrobeTime; 66 u32 EBI_WriteHoldTime; 67 u32 EBI_ReadSetupTime; 68 u32 EBI_ReadStrobeTime; 69 u32 EBI_ReadHoldTime; 70 } EBI_InitTypeDef; 71 /** 72 * @} 73 */ 74 75 /* Exported constants --------------------------------------------------------------------------------------*/ 76 /** @defgroup EBI_Exported_Constants EBI exported constants 77 * @{ 78 */ 79 #define EBI_BANK_0 ((u32)0x00000000) 80 #define EBI_BANK_1 ((u32)0x00000001) 81 #define EBI_BANK_2 ((u32)0x00000002) 82 #define EBI_BANK_3 ((u32)0x00000003) 83 84 #define IS_EBI_BANK(BANK) ((BANK == EBI_BANK_0) || \ 85 (BANK == EBI_BANK_1) || \ 86 (BANK == EBI_BANK_2) || \ 87 (BANK == EBI_BANK_3)) 88 89 90 #define EBI_MODE_D8A8 ((u32)0x00000000) 91 #define EBI_MODE_D16A16ALE ((u32)0x00000001) 92 #define EBI_MODE_D8A24ALE ((u32)0x00000002) 93 #define EBI_MODE_D16 ((u32)0x00000003) 94 95 #define IS_EBI_MODE(MODE) ((MODE == EBI_MODE_D8A8) || \ 96 (MODE == EBI_MODE_D16A16ALE) || \ 97 (MODE == EBI_MODE_D8A24ALE) || \ 98 (MODE == EBI_MODE_D16)) 99 100 101 #define EBI_IDLECYCLE_ENABLE ((u32)0x00000000) 102 #define EBI_IDLECYCLE_DISABLE ((u32)0x00001000) 103 104 #define IS_EBI_IDLECYCLE(IDLECYCLE) ((IDLECYCLE == EBI_IDLECYCLE_ENABLE) || \ 105 (IDLECYCLE == EBI_IDLECYCLE_DISABLE)) 106 107 108 #define EBI_CHIPSELECTPOLARITY_LOW ((u32)0x00000000) 109 #define EBI_CHIPSELECTPOLARITY_HIGH ((u32)0x00000001) 110 111 #define IS_EBI_CS_POLARITY(POLARITY) ((POLARITY == EBI_CHIPSELECTPOLARITY_LOW) || \ 112 (POLARITY == EBI_CHIPSELECTPOLARITY_HIGH)) 113 114 115 #define EBI_ADDRESSLATCHPOLARITY_LOW ((u32)0x00000000) 116 #define EBI_ADDRESSLATCHPOLARITY_HIGH ((u32)0x00000001) 117 118 #define IS_EBI_ALE_POLARITY(POLARITY) ((POLARITY == EBI_ADDRESSLATCHPOLARITY_LOW) || \ 119 (POLARITY == EBI_ADDRESSLATCHPOLARITY_HIGH)) 120 121 122 #define EBI_WRITEENABLEPOLARITY_LOW ((u32)0x00000000) 123 #define EBI_WRITEENABLEPOLARITY_HIGH ((u32)0x00000001) 124 125 #define IS_EBI_WE_POLARITY(POLARITY) ((POLARITY == EBI_WRITEENABLEPOLARITY_LOW) || \ 126 (POLARITY == EBI_WRITEENABLEPOLARITY_HIGH)) 127 128 129 #define EBI_READENABLEPOLARITY_LOW ((u32)0x00000000) 130 #define EBI_READENABLEPOLARITY_HIGH ((u32)0x00000001) 131 132 #define IS_EBI_RE_POLARITY(POLARITY) ((POLARITY == EBI_READENABLEPOLARITY_LOW) || \ 133 (POLARITY == EBI_READENABLEPOLARITY_HIGH)) 134 135 136 #define IS_EBI_IDLE_CYCLE_TIME(TIME) (TIME < 0x10) 137 138 #define IS_EBI_ADDRESS_SETUP_TIME(TIME) (TIME < 0x10) 139 140 #define IS_EBI_ADDRESS_HOLD_TIME(TIME) (TIME < 0x10) 141 142 #define IS_EBI_WRITE_SETUP_TIME(TIME) (TIME < 0x10) 143 144 #define IS_EBI_WRITE_STROBE_TIME(TIME) (TIME < 0x40) 145 146 #define IS_EBI_WRITE_HOLD_TIME(TIME) (TIME < 0x10) 147 148 #define IS_EBI_READ_SETUP_TIME(TIME) (TIME < 0x10) 149 150 #define IS_EBI_READ_STROBE_TIME(TIME) (TIME < 0x40) 151 152 #define IS_EBI_READ_HOLD_TIME(TIME) (TIME < 0x10) 153 /** 154 * @} 155 */ 156 157 /* Exported functions --------------------------------------------------------------------------------------*/ 158 /** @defgroup EBI_Exported_Functions EBI exported functions 159 * @{ 160 */ 161 void EBI_DeInit(void); 162 void EBI_Init(EBI_InitTypeDef* EBI_InitStruct); 163 void EBI_StructInit(EBI_InitTypeDef* EBI_InitStruct); 164 void EBI_Cmd(u32 EBI_Bank, ControlStatus NewState); 165 FlagStatus EBI_GetBusyStatus(void); 166 /** 167 * @} 168 */ 169 170 171 /** 172 * @} 173 */ 174 175 /** 176 * @} 177 */ 178 179 #ifdef __cplusplus 180 } 181 #endif 182 183 #endif 184