![]() |
no-OS
|
#include "flash_storage.h"#include "afe_calibration.h"#include "pqlib_example.h"#include "afe_config.h"#include "ade9430.h"#include "flc.h"#include "icc.h"#include "mxc_device.h"#include "mxc_delay.h"#include <stdio.h>#include <string.h>Macros | |
| #define | FLASH_CAL_PAGE_ADDR ((MXC_FLASH_MEM_BASE + MXC_FLASH_MEM_SIZE) - (2 * MXC_FLASH_PAGE_SIZE)) |
| #define | FLASH_CAL_BACKUP_ADDR ((MXC_FLASH_MEM_BASE + MXC_FLASH_MEM_SIZE) - (1 * MXC_FLASH_PAGE_SIZE)) |
| #define | CRC32_POLYNOMIAL 0xEDB88320 |
Functions | |
| uint32_t | flash_calculate_crc32 (const void *data, uint32_t len) |
| Calculate CRC32 for data. | |
| int | flash_storage_init (void) |
| Initialize flash storage. | |
| int | flash_storage_remove (void) |
| De-initialize flash storage. | |
| bool | flash_storage_is_initialized (void) |
| Check if flash storage is initialized. | |
| int | flash_read_calibration (FLASH_CALIBRATION_DATA *data) |
| Read calibration data from flash. | |
| int | flash_write_calibration (const FLASH_CALIBRATION_DATA *data) |
| Write calibration data to flash. | |
| int | flash_erase_calibration (void) |
| Erase calibration data from flash. | |
| bool | flash_has_valid_calibration (void) |
| Check if valid calibration data exists in flash. | |
| int | flash_load_and_apply_calibration (void) |
| Load calibration from flash and apply to AFE registers. | |
| int | flash_save_calibration_channel (uint8_t channel) |
| Save current calibration context to flash for specified channel. | |
| int | flash_save_all_calibration (void) |
| Save all calibration data to flash. | |
| const char * | flash_status_to_string (FLASH_STATUS status) |
| Get status string for flash status code. | |
| #define CRC32_POLYNOMIAL 0xEDB88320 |
| #define FLASH_CAL_BACKUP_ADDR ((MXC_FLASH_MEM_BASE + MXC_FLASH_MEM_SIZE) - (1 * MXC_FLASH_PAGE_SIZE)) |
| #define FLASH_CAL_PAGE_ADDR ((MXC_FLASH_MEM_BASE + MXC_FLASH_MEM_SIZE) - (2 * MXC_FLASH_PAGE_SIZE)) |
| uint32_t flash_calculate_crc32 | ( | const void * | data, |
| uint32_t | len ) |
Calculate CRC32 for data.
| data | - Pointer to data |
| len | - Length of data in bytes |
| int flash_erase_calibration | ( | void | ) |
Erase calibration data from flash.
| bool flash_has_valid_calibration | ( | void | ) |
Check if valid calibration data exists in flash.
| int flash_load_and_apply_calibration | ( | void | ) |
Load calibration from flash and apply to AFE registers.
| int flash_read_calibration | ( | FLASH_CALIBRATION_DATA * | data | ) |
Read calibration data from flash.
| data | - Pointer to calibration data structure |
| int flash_save_all_calibration | ( | void | ) |
Save all calibration data to flash.
| int flash_save_calibration_channel | ( | uint8_t | channel | ) |
Save current calibration context to flash for specified channel.
| channel | - Channel to save (0=A, 1=B, 2=C) |
| const char * flash_status_to_string | ( | FLASH_STATUS | status | ) |
Get status string for flash status code.
| status | - Flash status code |
| int flash_storage_init | ( | void | ) |
Initialize flash storage.
| bool flash_storage_is_initialized | ( | void | ) |
Check if flash storage is initialized.
| int flash_storage_remove | ( | void | ) |
De-initialize flash storage.
| int flash_write_calibration | ( | const FLASH_CALIBRATION_DATA * | data | ) |
Write calibration data to flash.
| data | - Pointer to calibration data structure |