Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
settings_arch.c File Reference

Persistent settings low level flash routines lpc21. More...

#include "subsystems/settings.h"
#include "LPC21xx.h"
#include <BOARD_CONFIG>
#include "armVIC.h"
+ Include dependency graph for settings_arch.c:

Go to the source code of this file.

Data Structures

struct  FlashInfo
 

Macros

#define IAP_LOCATION   0x7FFFFFF1
 
#define IAP_PREPARE_SECTORS   50
 
#define IAP_COPY_RAM_TO_FLASH   51
 
#define IAP_ERASE_SECTORS   52
 
#define IAP_BLANK_CHECK_SECTORS   53
 
#define IAP_READ_PART_ID   54
 
#define IAP_COMPARE   56
 
#define BOUND   256
 
#define FSIZ   8
 
#define FCHK   4
 

Typedefs

typedef void(* IAP )(uint32_t[], uint32_t[])
 

Functions

static uint32_t pflash_checksum (uint32_t ptr, uint32_t size)
 
static int32_t flash_detect (FlashInfo *flash)
 
static int32_t pflash_erase_page (FlashInfo *flash)
 
static int32_t pflash_program_array (FlashInfo *flash, uint32_t dest, uint32_t src)
 
static int32_t pflash_program_bytes (FlashInfo *flash, uint32_t src, uint32_t size, uint32_t chksum)
 
int32_t persistent_write (void *ptr, uint32_t size)
 
int32_t persistent_read (void *ptr, uint32_t size)
 
int32_t persistent_clear (void)
 

Detailed Description

Persistent settings low level flash routines lpc21.

Persistent settings low level flash routines stm32.

LPC2148 flash data is located in the last available page

0x00000000: Paparazzi bootloader (16k) 0x00004000: Paparazzi code (480k) 0x0007C000: persistent settings (4k) 0x0007D000: Philips/NXP bootloader (12k)

data flash_addr data_size flash_end - FSIZ checksum flash_end - FCHK

LPC21: minimum write size 256 bytes, endurance 100k cycles, max sector erase time 400ms, max prog time 1ms per 256 bytes

data flash_addr data_size flash_end - FSIZ checksum flash_end - FCHK

STM32: minimum write size 2 bytes, endurance 10k cycles, max sector erase time 40ms, max prog time 70us per 2 bytes

Definition in file settings_arch.c.


Data Structure Documentation

struct FlashInfo

Definition at line 65 of file settings_arch.c.

Data Fields
uint32_t addr
uint32_t page_nr
uint32_t page_size
uint32_t total_size

Macro Definition Documentation

#define BOUND   256

Definition at line 58 of file settings_arch.c.

Referenced by pflash_program_array(), and pflash_program_bytes().

#define FCHK   4

Definition at line 61 of file settings_arch.c.

Referenced by persistent_read(), and pflash_program_bytes().

#define FSIZ   8

Definition at line 60 of file settings_arch.c.

Referenced by persistent_read(), persistent_write(), and pflash_program_bytes().

#define IAP_BLANK_CHECK_SECTORS   53

Definition at line 53 of file settings_arch.c.

Referenced by pflash_erase_page().

#define IAP_COMPARE   56

Definition at line 55 of file settings_arch.c.

#define IAP_COPY_RAM_TO_FLASH   51

Definition at line 51 of file settings_arch.c.

Referenced by pflash_program_array().

#define IAP_ERASE_SECTORS   52

Definition at line 52 of file settings_arch.c.

Referenced by pflash_erase_page().

#define IAP_LOCATION   0x7FFFFFF1

Definition at line 48 of file settings_arch.c.

Referenced by flash_detect(), pflash_erase_page(), and pflash_program_array().

#define IAP_PREPARE_SECTORS   50

Definition at line 50 of file settings_arch.c.

Referenced by pflash_erase_page(), and pflash_program_array().

#define IAP_READ_PART_ID   54

Definition at line 54 of file settings_arch.c.

Referenced by flash_detect().

Typedef Documentation

typedef void(* IAP)(uint32_t[], uint32_t[])

Definition at line 63 of file settings_arch.c.

Function Documentation

static int32_t flash_detect ( FlashInfo flash)
static

Definition at line 96 of file settings_arch.c.

References FlashInfo::addr, disableIRQ(), enableIRQ(), IAP_LOCATION, IAP_READ_PART_ID, FlashInfo::page_nr, and FlashInfo::page_size.

Referenced by persistent_clear(), persistent_read(), and persistent_write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32_t persistent_clear ( void  )

Definition at line 285 of file settings_arch.c.

References flash_detect(), and pflash_erase_page().

+ Here is the call graph for this function:

int32_t persistent_read ( void *  ptr,
uint32_t  size 
)

Definition at line 261 of file settings_arch.c.

References FlashInfo::addr, FCHK, flash_detect(), FSIZ, FlashInfo::page_size, and pflash_checksum().

+ Here is the call graph for this function:

int32_t persistent_write ( void *  ptr,
uint32_t  size 
)

Definition at line 248 of file settings_arch.c.

References flash_detect(), FSIZ, FlashInfo::page_size, pflash_checksum(), and pflash_program_bytes().

+ Here is the call graph for this function:

static uint32_t pflash_checksum ( uint32_t  ptr,
uint32_t  size 
)
static

Definition at line 84 of file settings_arch.c.

Referenced by persistent_read(), and persistent_write().

+ Here is the caller graph for this function:

static int32_t pflash_erase_page ( FlashInfo flash)
static

Definition at line 136 of file settings_arch.c.

References disableIRQ(), enableIRQ(), IAP_BLANK_CHECK_SECTORS, IAP_ERASE_SECTORS, IAP_LOCATION, IAP_PREPARE_SECTORS, and FlashInfo::page_nr.

Referenced by persistent_clear(), and pflash_program_bytes().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int32_t pflash_program_array ( FlashInfo flash,
uint32_t  dest,
uint32_t  src 
)
static

Definition at line 171 of file settings_arch.c.

References BOUND, CCLK, dest, disableIRQ(), enableIRQ(), IAP_COPY_RAM_TO_FLASH, IAP_LOCATION, IAP_PREPARE_SECTORS, and FlashInfo::page_nr.

Referenced by pflash_program_bytes().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int32_t pflash_program_bytes ( FlashInfo flash,
uint32_t  src,
uint32_t  size,
uint32_t  chksum 
)
static

Definition at line 203 of file settings_arch.c.

References FlashInfo::addr, BOUND, FCHK, FSIZ, FlashInfo::page_size, pflash_erase_page(), and pflash_program_array().

Referenced by persistent_write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: