Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_spi_master.h"
60 #define FLASH8_CMD_READ_CELL_ARRAY 0x13
61 #define FLASH8_CMD_READ_BUFFER 0x03
62 #define FLASH8_CMD_READ_BUFFER_1 0x0B
63 #define FLASH8_CMD_PROGRAM_LOAD 0x02
64 #define FLASH8_CMD_PROGRAM_EXECUTE 0x10
65 #define FLASH8_CMD_PROTECT_EXECUTE 0x2A
66 #define FLASH8_CMD_PROGRAM_LOAD_RANDOM_DATA 0x84
67 #define FLASH8_CMD_BLOCK_ERASE 0xD8
68 #define FLASH8_CMD_RESET 0xFF
69 #define FLASH8_CMD_RESET_1 0xFE
70 #define FLASH8_CMD_WRITE_ENABLE 0x06
71 #define FLASH8_CMD_WRITE_DISABLE 0x04
72 #define FLASH8_CMD_GET_FEATURE 0x0F
73 #define FLASH8_CMD_SET_FEATURE 0x1F
74 #define FLASH8_CMD_READ_ID 0x9F
75 #define FLASH8_FEATURE_A0 0xA0
76 #define FLASH8_FEATURE_B0 0xB0
77 #define FLASH8_FEATURE_C0 0xC0
78 #define FLASH8_FEATURE_10 0x10
79 #define FLASH8_FEATURE_20 0x20
80 #define FLASH8_FEATURE_30 0x30
81 #define FLASH8_FEATURE_40 0x40
82 #define FLASH8_FEATURE_50 0x50
83 #define FLASH8_FEATURE_60 0x60
84 #define FLASH8_FEATURE_70 0x70
102 #define FLASH8_SET_BRWD_ENABLE 0x00
103 #define FLASH8_SET_BRWD_DISABLE 0x01
104 #define FLASH8_SET_BL_ALL_UNLOCKED 0x00
105 #define FLASH8_SET_BL_UPPER_1_64_LOCKED 0x01
106 #define FLASH8_SET_BL_UPPER_1_32_LOCKED 0x02
107 #define FLASH8_SET_BL_UPPER_1_16_LOCKED 0x03
108 #define FLASH8_SET_BL_UPPER_1_8_LOCKED 0x04
109 #define FLASH8_SET_BL_UPPER_1_4_LOCKED 0x05
110 #define FLASH8_SET_BL_UPPER_1_2_LOCKED 0x06
111 #define FLASH8_SET_BL_ALLLOCKED 0x07
117 #define FLASH8_SET_IDR_E_NORMAL_OPERATION 0x00
118 #define FLASH8_SET_IDR_E_PARAMETER_PAGE_READ 0x01
119 #define FLASH8_SET_ECC_E_INTERNAL_ECC_DISABLE 0x00
120 #define FLASH8_SET_ECC_E_INTERNAL_ECC_ENABLE 0x01
121 #define FLASH8_SET_PRT_E_NORMAL_OPERATION 0x00
122 #define FLASH8_SET_PRT_EBLOCK_PROTECTION_ENABLE 0x01
123 #define FLASH8_SET_HSE_HIGH_SPEED_MODE_DISABLE 0x00
124 #define FLASH8_SET_HSE_HIGH_SPEED_MODE_ENABLE 0x01
125 #define FLASH8_SET_HOLD_D_HOLD_IS_ENABLED 0x00
126 #define FLASH8_SET_HOLD_D_HOLD_IS_DISABLED 0x01
132 #define FLASH8_SET_WEL_WRITE_DISABLE 0x00
133 #define FLASH8_SET_WEL_WRITE_ENABLE 0x01
152 #define FLASH8_GET_ECCS_NO_BIT_FLIPS_WERE_DETECT 0x00
153 #define FLASH8_GET_ECCS_BIT_FLIPS_DETECT_CORRECT 0x10
154 #define FLASH8_GET_ECCS_MULTI_BIT_FLIPS_NOT_CORRECT 0x20
155 #define FLASH8_GET_ECCS_BIT_FLIPS_DETECT_CORRECTED 0x30
156 #define FLASH8_GET_PRG_F_PROGRAM_PASS 0x00
157 #define FLASH8_GET_PRG_F_PROGRAM_FAIL 0x08
158 #define FLASH8_GET_PRG_F_PROGRAM_PASS 0x00
159 #define FLASH8_GET_ERS_F_ERASE_FAIL 0x04
160 #define FLASH8_GET_WEL_WRITE_DISABLE 0x00
161 #define FLASH8_GET_WEL_WRITE_ENABLE 0x02
162 #define FLASH8_GET_OIP_READY_STATE 0x00
163 #define FLASH8_GET_OIP_BUSY_STATE 0x01
182 #define FLASH8_MAP_MIKROBUS( cfg, mikrobus ) \
183 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
184 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
185 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
186 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
187 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
188 cfg.hld = MIKROBUS( mikrobus, MIKROBUS_PWM )
666 uint8_t *data_in, uint16_t len, uint8_t *feature_status_out );
688 uint8_t *data_out, uint16_t len, uint8_t *feature_status_out );
pin_name_t miso
Definition: flash8.h:217
err_t flash8_protect_execute(flash8_t *ctx, uint32_t row_address, uint8_t *feature_status_out)
Flash 8 protect execute function.
uint8_t hse
Definition: flash8.h:244
pin_name_t sck
Definition: flash8.h:219
err_t flash8_generic_read(flash8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Flash 8 data reading function.
pin_name_t hld
Definition: flash8.h:224
void flash8_default_cfg(flash8_t *ctx)
Flash 8 default configuration function.
err_t flash8_read_buffer(flash8_t *ctx, uint16_t column_address, uint8_t *read_data)
Flash 8 read buffer function.
err_t flash8_get_config_feature(flash8_t *ctx, feature_cfg_t *feature_data)
Flash 8 get config feature function.
err_t flash8_write_memory(flash8_t *ctx, uint32_t row_address, uint16_t column_address, uint8_t *data_in, uint16_t len, uint8_t *feature_status_out)
Flash 8 write memory function.
pin_name_t cs
Definition: flash8.h:220
err_t flash8_generic_write(flash8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Flash 8 data writing function.
err_t flash8_program_load_random(flash8_t *ctx, uint16_t column_address, uint8_t *data_in, uint8_t len)
Flash 8 program load random function.
err_t flash8_get_feature(flash8_t *ctx, uint8_t feature_addr, uint8_t *feature_data)
Flash 8 get feature function.
void flash8_write_protect_enable(flash8_t *ctx)
Flash 8 enable write protection function.
err_t flash8_write_disable(flash8_t *ctx)
Flash 8 write disable function.
digital_out_t wp
Definition: flash8.h:200
pin_name_t chip_select
Definition: flash8.h:206
uint8_t prt_e
Definition: flash8.h:243
pin_name_t wp
Definition: flash8.h:223
uint8_t ecc_e
Definition: flash8.h:242
@ FLASH8_ERROR
Definition: flash8.h:261
Flash 8 Click context object.
Definition: flash8.h:198
spi_master_t spi
Definition: flash8.h:204
uint8_t bl
Definition: flash8.h:240
err_t flash8_init(flash8_t *ctx, flash8_cfg_t *cfg)
Flash 8 initialization function.
digital_out_t hld
Definition: flash8.h:201
@ FLASH8_OK
Definition: flash8.h:260
err_t flash8_block_erase(flash8_t *ctx, uint32_t row_address, uint8_t *feat_data)
Flash 8 block erase function.
void flash8_hold_enable(flash8_t *ctx)
Flash 8 hold enable function.
err_t flash8_set_feature(flash8_t *ctx, uint8_t feature_addr, uint8_t feature_data)
Flash 8 set feature function.
err_t flash8_read_memory(flash8_t *ctx, uint32_t row_address, uint16_t column_address, uint8_t *data_out, uint16_t len, uint8_t *feature_status_out)
Flash 8 read memory function.
uint8_t brwd
Definition: flash8.h:239
err_t flash8_write_enable(flash8_t *ctx)
Flash 8 write enable function.
uint8_t ers_f
Definition: flash8.h:248
err_t flash8_sw_reset(flash8_t *ctx, uint8_t *feat_data)
Flash 8 soft reset function.
err_t flash8_program_load(flash8_t *ctx, uint16_t column_address, uint8_t *data_in, uint16_t len)
Flash 8 program load function.
uint8_t idr_e
Definition: flash8.h:241
uint32_t spi_speed
Definition: flash8.h:227
spi_master_mode_t spi_mode
Definition: flash8.h:228
uint8_t eccs
Definition: flash8.h:246
err_t flash8_read_cell_array(flash8_t *ctx, uint32_t row_address, uint16_t column_address, uint8_t *feature_status_out)
Flash 8 read cell array function.
flash8_return_value_t
Flash 8 Click return value data.
Definition: flash8.h:259
void flash8_write_protect_disable(flash8_t *ctx)
Flash 8 disable write protection function.
Flash 8 Click configuration object.
Definition: flash8.h:215
uint8_t oip
Definition: flash8.h:250
err_t flash8_read_id(flash8_t *ctx, uint8_t *manufacture_id, uint8_t *device_id, uint8_t *organization_id)
Flash 8 read ID function.
Flash 8 Feature operation object.
Definition: flash8.h:238
void flash8_cfg_setup(flash8_cfg_t *cfg)
Flash 8 configuration object setup function.
spi_master_chip_select_polarity_t cs_polarity
Definition: flash8.h:229
pin_name_t mosi
Definition: flash8.h:218
uint8_t hold_d
Definition: flash8.h:245
err_t flash8_protected_area_all_unlocked(flash8_t *ctx)
Flash 8 protected area all unlocked function.
uint8_t wel
Definition: flash8.h:249
uint8_t prg_f
Definition: flash8.h:247
err_t flash8_program_execute(flash8_t *ctx, uint32_t row_address)
Flash 8 program execute function.
void flash8_hold_disable(flash8_t *ctx)
Flash 8 hold disable function.
err_t flash8_set_config_feature(flash8_t *ctx, feature_cfg_t feature_data)
Flash 8 set config feature function.