1 2 #ifndef __REC_FLASH_H__ 3 #define __REC_FLASH_H__ 4 5 #include "rec_pub.h" 6 7 #define REG_READ(addr) *((volatile UINT32 *)(addr)) 8 #define REG_WRITE(addr, _data) (*((volatile UINT32 *)(addr)) = (_data)) 9 10 #define MODE_STD 0 11 #define MODE_DUAL 1 12 #define MODE_QUAD 2 13 14 #define FLASH_WRITE_UNIT 32 15 16 #define FLASH_BASE (0x00803000) 17 18 #define REG_FLASH_OPERATE_SW (FLASH_BASE + 0 * 4) 19 #define ADDR_SW_REG_POSI (0) 20 #define ADDR_SW_REG_MASK (0xFFFFFF) 21 #define OP_TYPE_SW_POSI (24) 22 #define OP_TYPE_SW_MASK (0x1F) 23 #define OP_SW (0x01UL << 29) 24 #define WP_VALUE (0x01UL << 30) 25 #define BUSY_SW (0x01UL << 31) 26 27 #define REG_FLASH_DATA_SW_FLASH (FLASH_BASE + 1 * 4) 28 29 #define REG_FLASH_DATA_FLASH_SW (FLASH_BASE + 2 * 4) 30 31 #define REG_FLASH_RDID_DATA_FLASH (FLASH_BASE + 4 * 4) 32 33 #define REG_FLASH_SR_DATA_CRC_CNT (FLASH_BASE + 5 * 4) 34 #define SR_DATA_FLASH_POSI (0) 35 #define SR_DATA_FLASH_MASK (0xFF) 36 #define CRC_ERROR_COUNT_POSI (8) 37 #define CRC_ERROR_COUNT_MASK (0xFF) 38 #define DATA_FLASH_SW_SEL_POSI (16) 39 #define DATA_FLASH_SW_SEL_MASK (0x07) 40 #define DATA_SW_FLASH_SEL_POSI (19) 41 #define DATA_SW_FLASH_SEL_MASK (0x07) 42 43 #define REG_FLASH_CONF (FLASH_BASE + 7 * 4) 44 #define FLASH_CLK_CONF_POSI (0) 45 #define FLASH_CLK_CONF_MASK (0x0F) 46 #define MODEL_SEL_POSI (4) 47 #define MODEL_SEL_MASK (0x1F) 48 #define FWREN_FLASH_CPU (0x01UL << 9) 49 #define WRSR_DATA_POSI (10) 50 #define WRSR_DATA_MASK (0xFFFF) 51 #define CRC_EN (0x01UL << 26) 52 53 typedef enum 54 { 55 FLASH_OPCODE_WREN = 1, 56 FLASH_OPCODE_WRDI = 2, 57 FLASH_OPCODE_RDSR = 3, 58 FLASH_OPCODE_WRSR = 4, 59 FLASH_OPCODE_READ = 5, 60 FLASH_OPCODE_RDSR2 = 6, 61 FLASH_OPCODE_WRSR2 = 7, 62 FLASH_OPCODE_PP = 12, 63 FLASH_OPCODE_SE = 13, 64 FLASH_OPCODE_BE1 = 14, 65 FLASH_OPCODE_BE2 = 15, 66 FLASH_OPCODE_CE = 16, 67 FLASH_OPCODE_DP = 17, 68 FLASH_OPCODE_RFDP = 18, 69 FLASH_OPCODE_RDID = 20, 70 FLASH_OPCODE_HPM = 21, 71 FLASH_OPCODE_CRMR = 22, 72 FLASH_OPCODE_CRMR2 = 23, 73 } FLASH_OPCODE; 74 75 #endif // __REC_FLASH_H__ 76 77