FLASHC driver for AVR32 UC3.
Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | AVR32_FLASHC_REGIONS |
Number of flash regions defined by the FLASHC. More... | |
Functions | |
Flash Properties | |
unsigned int | flashc_get_flash_size (void) |
Gets the size of the whole flash array. More... | |
unsigned int | flashc_get_page_count (void) |
Gets the total number of pages in the flash array. More... | |
unsigned int | flashc_get_page_count_per_region (void) |
Gets the number of pages in each flash region. More... | |
unsigned int | flashc_get_page_region (int page_number) |
Gets the region number of a page. More... | |
unsigned int | flashc_get_region_first_page_number (unsigned int region) |
Gets the number of the first page of a region. More... | |
FLASHC Command Control | |
unsigned int | flashc_get_command (void) |
Gets the last issued FLASHC command. More... | |
unsigned int | flashc_get_page_number (void) |
Gets the current FLASHC page number. More... | |
void | flashc_issue_command (unsigned int command, int page_number) |
Issues a FLASHC command. More... | |
FLASHC Global Commands | |
void | flashc_no_operation (void) |
Issues a No Operation command to the FLASHC. More... | |
void | flashc_erase_all (void) |
Issues an Erase All command to the FLASHC. More... | |
FLASHC Protection Mechanisms | |
bool | flashc_is_security_bit_active (void) |
Tells whether the Security bit is active. More... | |
void | flashc_activate_security_bit (void) |
Activates the Security bit. More... | |
unsigned int | flashc_get_bootloader_protected_size (void) |
Gets the bootloader protected size. More... | |
unsigned int | flashc_set_bootloader_protected_size (unsigned int bootprot_size) |
Sets the bootloader protected size. More... | |
bool | flashc_is_external_privileged_fetch_locked (void) |
Tells whether external privileged fetch is locked. More... | |
void | flashc_lock_external_privileged_fetch (bool lock) |
Locks or unlocks external privileged fetch. More... | |
bool | flashc_is_page_region_locked (int page_number) |
Tells whether the region of a page is locked. More... | |
bool | flashc_is_region_locked (unsigned int region) |
Tells whether a region is locked. More... | |
void | flashc_lock_page_region (int page_number, bool lock) |
Locks or unlocks the region of a page. More... | |
void | flashc_lock_region (unsigned int region, bool lock) |
Locks or unlocks a region. More... | |
void | flashc_lock_all_regions (bool lock) |
Locks or unlocks all regions. More... | |
Access to General-Purpose Fuses | |
bool | flashc_read_gp_fuse_bit (unsigned int gp_fuse_bit) |
Reads a general-purpose fuse bit. More... | |
uint64_t | flashc_read_gp_fuse_bitfield (unsigned int pos, unsigned int width) |
Reads a general-purpose fuse bit-field. More... | |
uint8_t | flashc_read_gp_fuse_byte (unsigned int gp_fuse_byte) |
Reads a general-purpose fuse byte. More... | |
uint64_t | flashc_read_all_gp_fuses (void) |
Reads all general-purpose fuses. More... | |
bool | flashc_erase_gp_fuse_bit (unsigned int gp_fuse_bit, bool check) |
Erases a general-purpose fuse bit. More... | |
bool | flashc_erase_gp_fuse_bitfield (unsigned int pos, unsigned int width, bool check) |
Erases a general-purpose fuse bit-field. More... | |
bool | flashc_erase_gp_fuse_byte (unsigned int gp_fuse_byte, bool check) |
Erases a general-purpose fuse byte. More... | |
bool | flashc_erase_all_gp_fuses (bool check) |
Erases all general-purpose fuses. More... | |
void | flashc_write_gp_fuse_bit (unsigned int gp_fuse_bit, bool value) |
Writes a general-purpose fuse bit. More... | |
void | flashc_write_gp_fuse_bitfield (unsigned int pos, unsigned int width, uint64_t value) |
Writes a general-purpose fuse bit-field. More... | |
void | flashc_write_gp_fuse_byte (unsigned int gp_fuse_byte, uint8_t value) |
Writes a general-purpose fuse byte. More... | |
void | flashc_write_all_gp_fuses (uint64_t value) |
Writes all general-purpose fuses. More... | |
void | flashc_set_gp_fuse_bit (unsigned int gp_fuse_bit, bool value) |
Sets a general-purpose fuse bit with the appropriate erase and write operations. More... | |
void | flashc_set_gp_fuse_bitfield (unsigned int pos, unsigned int width, uint64_t value) |
Sets a general-purpose fuse bit-field with the appropriate erase and write operations. More... | |
void | flashc_set_gp_fuse_byte (unsigned int gp_fuse_byte, uint8_t value) |
Sets a general-purpose fuse byte with the appropriate erase and write operations. More... | |
void | flashc_set_all_gp_fuses (uint64_t value) |
Sets all general-purpose fuses with the appropriate erase and write operations. More... | |
FLASHC Control | |
#define | flash_set_bus_freq(cpu_f_hz) flashc_set_bus_freq(cpu_f_hz) |
Alias on the flashc_set_bus_freq() function. More... | |
unsigned int | flashc_get_wait_state (void) |
Gets the number of wait states of flash read accesses. More... | |
void | flashc_set_wait_state (unsigned int wait_state) |
Sets the number of wait states of flash read accesses. More... | |
void | flashc_set_bus_freq (unsigned int cpu_f_hz) |
Depending on the CPU frequency, set the wait states of flash read accesses. More... | |
bool | flashc_is_ready_int_enabled (void) |
Tells whether the Flash Ready interrupt is enabled. More... | |
void | flashc_enable_ready_int (bool enable) |
Enables or disables the Flash Ready interrupt. More... | |
bool | flashc_is_lock_error_int_enabled (void) |
Tells whether the Lock Error interrupt is enabled. More... | |
void | flashc_enable_lock_error_int (bool enable) |
Enables or disables the Lock Error interrupt. More... | |
bool | flashc_is_prog_error_int_enabled (void) |
Tells whether the Programming Error interrupt is enabled. More... | |
void | flashc_enable_prog_error_int (bool enable) |
Enables or disables the Programming Error interrupt. More... | |
FLASHC Status | |
void(*volatile | flashc_wait_until_ready )(void) |
Pointer to the function used by the driver when it needs to wait until the FLASHC is ready to run a new command. More... | |
bool | flashc_is_ready (void) |
Tells whether the FLASHC is ready to run a new command. More... | |
void | flashc_default_wait_until_ready (void) |
Waits actively until the FLASHC is ready to run a new command. More... | |
bool | flashc_is_lock_error (void) |
Tells whether a Lock Error has occurred during the last function called that issued one or more FLASHC commands. More... | |
bool | flashc_is_programming_error (void) |
Tells whether a Programming Error has occurred during the last function called that issued one or more FLASHC commands. More... | |
Access to Flash Pages | |
#define | flashc_memset(dst, src, src_width, nbytes, erase) TPASTE2(flashc_memset, src_width)((dst), (src), (nbytes), (erase)) |
Copies nbytes bytes to the flash destination pointed to by dst from the repeated src big-endian source pattern. More... | |
void | flashc_clear_page_buffer (void) |
Clears the page buffer. More... | |
bool | flashc_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 | flashc_quick_page_read (int page_number) |
Applies the Quick Page Read command to a page. More... | |
bool | flashc_erase_page (int page_number, bool check) |
Erases a page. More... | |
bool | flashc_erase_all_pages (bool check) |
Erases all pages within the flash array. More... | |
void | flashc_write_page (int page_number) |
Writes a page from the page buffer. More... | |
bool | flashc_quick_user_page_read (void) |
Issues a Quick Page Read User Page command to the FLASHC. More... | |
bool | flashc_erase_user_page (bool check) |
Erases the User page. More... | |
void | flashc_write_user_page (void) |
Writes the User page from the page buffer. More... | |
volatile void * | flashc_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 * | flashc_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 * | flashc_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 * | flashc_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 * | flashc_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... | |
void | flashc_set_flash_waitstate_and_readmode (unsigned long cpu_f_hz) |
Depending to the CPU frequency, set the wait states of flash read accesses and enable or disable the High speed read mode. More... | |