FlashCALW driver for SAM4L.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
Flash Properties | |
uint32_t | flashcalw_get_flash_size (void) |
Gets the size of the whole flash array. More... | |
uint32_t | flashcalw_get_page_count (void) |
Gets the total number of pages in the flash array. More... | |
uint32_t | flashcalw_get_page_count_per_region (void) |
Gets the number of pages in each flash region. More... | |
uint32_t | flashcalw_get_page_region (int32_t page_number) |
Gets the region number of a page. More... | |
uint32_t | flashcalw_get_region_first_page_number (uint32_t region) |
Gets the number of the first page of a region. More... | |
FLASHCALW Command Control | |
uint32_t | flashcalw_get_command (void) |
Gets the last issued FLASHCALW command. More... | |
uint32_t | flashcalw_get_page_number (void) |
Gets the current FLASHCALW page number. More... | |
void | flashcalw_issue_command (uint32_t command, int page_number) |
Issues a FLASHCALW command. More... | |
FLASHCALW Global Commands | |
void | flashcalw_no_operation (void) |
Issues a No Operation command to the FLASHCALW. More... | |
void | flashcalw_erase_all (void) |
Issues an Erase All command to the FLASHCALW. More... | |
FLASHCALW Protection Mechanisms | |
bool | flashcalw_is_security_bit_active (void) |
Tells whether the Security bit is active. More... | |
void | flashcalw_set_security_bit (void) |
Activates the Security bit. More... | |
bool | flashcalw_is_page_region_locked (uint32_t page_number) |
Tells whether the region of a page is locked. More... | |
bool | flashcalw_is_region_locked (uint32_t region) |
Tells whether a region is locked. More... | |
void | flashcalw_lock_page_region (int page_number, bool lock) |
Locks or unlocks the region of a page. More... | |
void | flashcalw_lock_region (uint32_t region, bool lock) |
Locks or unlocks a region. More... | |
void | flashcalw_lock_all_regions (bool lock) |
Locks or unlocks all regions. More... | |
Access to General-Purpose Fuses | |
bool | flashcalw_read_gp_fuse_bit (uint32_t gp_fuse_bit) |
Reads a general-purpose fuse bit. More... | |
uint64_t | flashcalw_read_gp_fuse_bitfield (uint32_t pos, uint32_t width) |
Reads a general-purpose fuse bit-field. More... | |
uint8_t | flashcalw_read_gp_fuse_byte (uint32_t gp_fuse_byte) |
Reads a general-purpose fuse byte. More... | |
uint64_t | flashcalw_read_all_gp_fuses (void) |
Reads all general-purpose fuses. More... | |
bool | flashcalw_erase_gp_fuse_bit (uint32_t gp_fuse_bit, bool check) |
Erases a general-purpose fuse bit. More... | |
bool | flashcalw_erase_gp_fuse_bitfield (uint32_t pos, uint32_t width, bool check) |
Erases a general-purpose fuse bit-field. More... | |
bool | flashcalw_erase_gp_fuse_byte (uint32_t gp_fuse_byte, bool check) |
Erases a general-purpose fuse byte. More... | |
bool | flashcalw_erase_all_gp_fuses (bool check) |
Erases all general-purpose fuses. More... | |
void | flashcalw_write_gp_fuse_bit (uint32_t gp_fuse_bit, bool value) |
Writes a general-purpose fuse bit. More... | |
void | flashcalw_write_gp_fuse_bitfield (uint32_t pos, uint32_t width, uint64_t value) |
Writes a general-purpose fuse bit-field. More... | |
void | flashcalw_write_gp_fuse_byte (uint32_t gp_fuse_byte, uint8_t value) |
Writes a general-purpose fuse byte. More... | |
void | flashcalw_write_all_gp_fuses (uint64_t value) |
Writes all general-purpose fuses. More... | |
void | flashcalw_set_gp_fuse_bit (uint32_t gp_fuse_bit, bool value) |
Sets a general-purpose fuse bit with the appropriate erase and write operations. More... | |
void | flashcalw_set_gp_fuse_bitfield (uint32_t pos, uint32_t width, uint64_t value) |
Sets a general-purpose fuse bit-field with the appropriate erase and write operations. More... | |
void | flashcalw_set_gp_fuse_byte (uint32_t gp_fuse_byte, uint8_t value) |
Sets a general-purpose fuse byte with the appropriate erase and write operations. More... | |
void | flashcalw_set_all_gp_fuses (uint64_t value) |
Sets all general-purpose fuses with the appropriate erase and write operations. More... | |
Access to Flash Pages | |
void | flashcalw_clear_page_buffer (void) |
Clears the page buffer. More... | |
bool | flashcalw_is_page_erased (void) |
Tells whether the page to which the last Quick Page Read or Quick Page Read User Page command was applied was erased. More... | |
bool | flashcalw_quick_page_read (int page_number) |
Applies the Quick Page Read command to a page. More... | |
bool | flashcalw_erase_page (int page_number, bool check) |
Erases a page. More... | |
bool | flashcalw_erase_all_pages (bool check) |
Erases all pages within the flash array. More... | |
void | flashcalw_write_page (int page_number) |
Writes a page from the page buffer. More... | |
bool | flashcalw_quick_user_page_read (void) |
Issues a Quick Page Read User Page command to the FLASHCALW. More... | |
bool | flashcalw_erase_user_page (bool check) |
Erases the User page. More... | |
void | flashcalw_write_user_page (void) |
Writes the User page from the page buffer. More... | |
volatile void * | flashcalw_memset8 (volatile void *dst, uint8_t src, size_t nbytes, bool erase) |
Copies nbytes bytes to the flash destination pointed to by dst from the repeated src source byte. More... | |
volatile void * | flashcalw_memset16 (volatile void *dst, uint16_t src, size_t nbytes, bool erase) |
Copies nbytes bytes to the flash destination pointed to by dst from the repeated src big-endian source half-word. More... | |
volatile void * | flashcalw_memset32 (volatile void *dst, uint32_t src, size_t nbytes, bool erase) |
Copies nbytes bytes to the flash destination pointed to by dst from the repeated src big-endian source word. More... | |
volatile void * | flashcalw_memset64 (volatile void *dst, uint64_t src, size_t nbytes, bool erase) |
Copies nbytes bytes to the flash destination pointed to by dst from the repeated src big-endian source double-word. More... | |
volatile void * | flashcalw_memcpy (volatile void *dst, const void *src, size_t nbytes, bool erase) |
Copies nbytes bytes to the flash destination pointed to by dst from the source pointed to by src. More... | |
PicoCache interfaces | |
void | flashcalw_picocache_enable (void) |
Enable PicoCache. More... | |
void | flashcalw_picocache_disable (void) |
Disable PicoCache. More... | |
uint32_t | flashcalw_picocache_get_status (void) |
Get PicoCache status. More... | |
void | flashcalw_picocache_invalid_all (void) |
Invalid all PicoCache lines. More... | |
void | flashcalw_picocache_invalid_line (uint32_t index) |
Invalid specific cache line. More... | |
void | flashcalw_picocache_set_monitor_mode (uint32_t mode) |
Set PicoCache monitor mode. More... | |
void | flashcalw_picocache_enable_monitor (void) |
Enable PicoCache monitor. More... | |
void | flashcalw_picocache_disable_monitor (void) |
Disable PicoCache monitor. More... | |
void | flashcalw_picocache_reset_monitor (void) |
Reset PicoCache monitor. More... | |
uint32_t | flashcalw_picocache_get_monitor_cnt (void) |
Get PicoCache monitor count number. More... | |
uint32_t | flashcalw_picocache_get_version (void) |
Get PicoCache version. More... | |
FLASHC Control | |
#define | FLASH_FWS_0_MAX_FREQ CHIP_FREQ_FWS_0 |
#define | FLASH_FWS_1_MAX_FREQ CHIP_FREQ_FWS_1 |
#define | FLASH_HSEN_FWS_0_MAX_FREQ CHIP_FREQ_FLASH_HSEN_FWS_0 |
#define | FLASH_HSEN_FWS_1_MAX_FREQ CHIP_FREQ_FLASH_HSEN_FWS_1 |
uint32_t | flashcalw_get_wait_state (void) |
Gets the number of wait states of flash read accesses. More... | |
void | flashcalw_set_wait_state (uint32_t wait_state) |
Sets the number of wait states of flash read accesses. More... | |
void | flashcalw_set_flash_waitstate_and_readmode (uint32_t cpu_f_hz, uint32_t ps_value, bool is_fwu_enabled) |
Depending on the CPU frequency, on the Power Scaling mode and on the Fast Wakeup mode, set the wait states of flash read accesses and enable or disable the High speed read mode. More... | |
bool | flashcalw_is_ready_int_enabled (void) |
Tells whether the Flash Ready interrupt is enabled. More... | |
void | flashcalw_enable_ready_int (bool enable) |
Enables or disables the Flash Ready interrupt. More... | |
bool | flashcalw_is_lock_error_int_enabled (void) |
Tells whether the Lock Error interrupt is enabled. More... | |
void | flashcalw_enable_lock_error_int (bool enable) |
Enables or disables the Lock Error interrupt. More... | |
bool | flashcalw_is_prog_error_int_enabled (void) |
Tells whether the Programming Error interrupt is enabled. More... | |
void | flashcalw_enable_prog_error_int (bool enable) |
Enables or disables the Programming Error interrupt. More... | |
FLASHCALW Status | |
void(*volatile | flashcalw_wait_until_ready )(void) = flashcalw_default_wait_until_ready |
Pointer to the function used by the driver when it needs to wait until the FLASHCALW is ready to run a new command. More... | |
static uint32_t | flashcalw_error_status = 0 |
Sticky error status of the FLASHCALW. More... | |
bool | flashcalw_is_ready (void) |
Tells whether the FLASHCALW is ready to run a new command. More... | |
void | flashcalw_default_wait_until_ready (void) |
Waits actively until the FLASHCALW is ready to run a new command. More... | |
static uint32_t | flashcalw_get_error_status (void) |
Gets the error status of the FLASHCALW. More... | |
bool | flashcalw_is_lock_error (void) |
Tells whether a Lock Error has occurred during the last function called that issued one or more FLASHCALW commands. More... | |
bool | flashcalw_is_programming_error (void) |
Tells whether a Programming Error has occurred during the last function called that issued one or more FLASHCALW commands. More... | |