TMPM4G(1) Group Peripheral Driver User Manual  V1.0.0.0
txz_smif.h
Go to the documentation of this file.
1 
13 /*------------------------------------------------------------------------------*/
14 /* Define to prevent recursive inclusion */
15 /*------------------------------------------------------------------------------*/
16 #ifndef __SMIF_H
17 #define __SMIF_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /*------------------------------------------------------------------------------*/
24 /* Includes */
25 /*------------------------------------------------------------------------------*/
26 #include "txz_driver_def.h"
36 /*------------------------------------------------------------------------------*/
37 /* Macro Function */
38 /*------------------------------------------------------------------------------*/
44 /* no define */
45  /* End of group SMIF_Private_macro */
49 
50 
51 /*------------------------------------------------------------------------------*/
52 /* Configuration */
53 /*------------------------------------------------------------------------------*/
59 /* no define */
60  /* End of group SMIF_Private_define */
64 
65 
66 /*------------------------------------------------------------------------------*/
67 /* Macro Definition */
68 /*------------------------------------------------------------------------------*/
79 #define SMIF_NULL ((void *)0)
80  /* End of name SMIF_NULL Pointer */
83 
89 #define SMIF_MAX_CHANNEL (1) /* End of SMIF MAX Channel */
94  /* End of group SMIF_Private_define */
98 
99 
100 /*------------------------------------------------------------------------------*/
101 /* Enumerated Type Definition */
102 /*------------------------------------------------------------------------------*/
114 #define SMIF_MAP_BASE_MIN ((uint32_t)0x00000000)
115 #define SMIF_MAP_BASE_MAX ((uint32_t)0x00FFFFFF) /* End of group SMIF_BASE_Range */
119 
125  #define SMIF_FDEN_64KB (0x00)
126  #define SMIF_FDEN_128KB (0x01)
127  #define SMIF_FDEN_256KB (0x02)
128  #define SMIF_FDEN_512KB (0x03)
129  #define SMIF_FDEN_1MB (0x04)
130  #define SMIF_FDEN_2MB (0x05)
131  #define SMIF_FDEN_4MB (0x06)
132  #define SMIF_FDEN_8MB (0x07)
133  #define SMIF_FDEN_16MB (0x08) /* End of group SMIF_Capacity */
137 
143  #define SMIF_MAP_DISABLE (0x00)
144  #define SMIF_MAP_ENABLE (0x01) /* End of group SMIF_WIP_POLLING */
148 
155 #define SMIF_TRANS_CLOCK_MIN ((uint32_t)0x00000001)
156 #define SMIF_TRANS_CLOCK_MAX ((uint32_t)0x0000001F) /* End of group SMIF_TRANS_CLOCK_Range */
160 
167 #define SMIF_DEASERT_TIME_MIN ((uint32_t)0x00000000)
168 #define SMIF_DEASERT_TIME_MAX ((uint32_t)0x000000FF) /* End of group SMIF_DEASERT_TIME_Range */
172 
178  #define SMIF_WIP_POLLING_DISABLE (0x00)
179  #define SMIF_WIP_POLLING_ENABLE (0x01) /* End of group SMIF_WIP_POLLING */
183 
189  #define SMIF_CMD_FAST_READ (0x0B)
190  #define SMIF_CMD_DUAL_OUTPUT (0x3B)
191  #define SMIF_CMD_DUAL_I_O (0xBB)
192  #define SMIF_CMD_QUAD_OUTPUT (0x6B)
193  #define SMIF_CMD_QUAD_I_O (0xEB) /* End of group SMIF_DIRECT_COMMAND_OPCODE */
197 
203  #define SMIF_READ_ID_LEN (0x03) /* End of group SMIF_READ_ID_LENGTH */
207  /* End of group SMIF_Private_define */
211 
212 /*------------------------------------------------------------------------------*/
213 /* Structure Definition */
214 /*------------------------------------------------------------------------------*/
219 /*----------------------------------*/
223 /*----------------------------------*/
224 typedef struct
225 {
226  uint32_t base;
227  uint32_t capacity;
228  uint32_t enable;
230 
231 /*----------------------------------*/
235 /*----------------------------------*/
236 typedef struct
237 {
238  uint32_t trans_clock;
239  uint32_t deasert_time;
240  uint32_t poll_wip;
242 
243 /*----------------------------------*/
247 /*----------------------------------*/
248 typedef struct
249 {
250  uint32_t CmdOP;
252 /*----------------------------------*/
256 /*----------------------------------*/
257 typedef struct
258 {
259  SMIF_mapping_setting_t map[SMIF_MAX_CHANNEL+1]; /* mapping setting. */
263 
264 /*----------------------------------*/
268 /*----------------------------------*/
269 typedef struct
270 {
271  TSB_SMI_TypeDef *p_instance;
273 } SMIF_t;
274 
275  /* End of group SMIF_Private_typedef */
279 /*------------------------------------------------------------------------------*/
280 /* Inline Functions */
281 /*------------------------------------------------------------------------------*/ /* End of group SMIF_Private_functions */
289 
290 /*------------------------------------------------------------------------------*/
291 /* Functions */
292 /*------------------------------------------------------------------------------*/
297 TXZ_Result smif_init(SMIF_t *p_obj);
299 TXZ_Result smif_erase_chip(uint8_t ch);
300 TXZ_Result smif_erase_sector(uint8_t *p_address, uint8_t ch);
301 TXZ_Result smif_write_data(uint8_t *p_dst, uint8_t *p_src, uint32_t length, uint8_t ch);
302 TXZ_Result smif_sflash_read_id(uint8_t *id, uint8_t ch);
303 TXZ_Result smif_bank_read(uint8_t *bank, uint8_t ch);
304 TXZ_Result smif_bank_write(uint8_t bank, uint8_t ch); /* End of group SMIF_Exported_functions */
308  /* End of group SMIF */
312  /* End of group Periph_Driver */
316 
317 #ifdef __cplusplus
318 }
319 #endif /* __cplusplus */
320 #endif /* __SMIF_H */
TXZ_Result smif_bank_read(uint8_t *bank, uint8_t ch)
TXZ_Result smif_write_data(uint8_t *p_dst, uint8_t *p_src, uint32_t length, uint8_t ch)
TXZ_Result smif_erase_chip(uint8_t ch)
uint32_t poll_wip
Definition: txz_smif.h:240
SMIF_initial_setting_t init
Definition: txz_smif.h:272
#define SMIF_MAX_CHANNEL
Definition: txz_smif.h:89
TXZ_Result
Definition: txz_driver_def.h:43
uint32_t capacity
Definition: txz_smif.h:227
Initial setting structure definition.
Definition: txz_smif.h:257
uint32_t deasert_time
Definition: txz_smif.h:239
SMIF handle structure definition.
Definition: txz_smif.h:269
uint32_t CmdOP
Definition: txz_smif.h:250
SMIF_clock_setting_t clock
Definition: txz_smif.h:260
uint32_t base
Definition: txz_smif.h:226
TSB_SMI_TypeDef * p_instance
Definition: txz_smif.h:271
uint32_t enable
Definition: txz_smif.h:228
TXZ_Result smif_erase_sector(uint8_t *p_address, uint8_t ch)
TXZ_Result smif_sflash_read_id(uint8_t *id, uint8_t ch)
uint32_t trans_clock
Definition: txz_smif.h:238
All common macro and definition for TXZ peripheral drivers.
Direct Read setting structure definition.
Definition: txz_smif.h:248
TXZ_Result smif_bank_write(uint8_t bank, uint8_t ch)
Mapping setting structure definition.
Definition: txz_smif.h:224
TXZ_Result smif_init(SMIF_t *p_obj)
Clock setting structure definition.
Definition: txz_smif.h:236
TXZ_Result smif_finalize(void)