Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
settings_arch.c File Reference
#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.

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

Persistent settings low level flash routines stm32.

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

◆ FlashInfo

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

◆ BOUND

#define BOUND   256

Definition at line 58 of file settings_arch.c.

◆ FCHK

#define FCHK   4

Definition at line 61 of file settings_arch.c.

◆ FSIZ

#define FSIZ   8

Definition at line 60 of file settings_arch.c.

◆ IAP_BLANK_CHECK_SECTORS

#define IAP_BLANK_CHECK_SECTORS   53

Definition at line 53 of file settings_arch.c.

◆ IAP_COMPARE

#define IAP_COMPARE   56

Definition at line 55 of file settings_arch.c.

◆ IAP_COPY_RAM_TO_FLASH

#define IAP_COPY_RAM_TO_FLASH   51

Definition at line 51 of file settings_arch.c.

◆ IAP_ERASE_SECTORS

#define IAP_ERASE_SECTORS   52

Definition at line 52 of file settings_arch.c.

◆ IAP_LOCATION

#define IAP_LOCATION   0x7FFFFFF1

Definition at line 48 of file settings_arch.c.

◆ IAP_PREPARE_SECTORS

#define IAP_PREPARE_SECTORS   50

Definition at line 50 of file settings_arch.c.

◆ IAP_READ_PART_ID

#define IAP_READ_PART_ID   54

Definition at line 54 of file settings_arch.c.

Typedef Documentation

◆ IAP

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

Definition at line 63 of file settings_arch.c.

Function Documentation

◆ flash_detect()

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:

◆ persistent_clear()

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:

◆ persistent_read()

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:

◆ persistent_write()

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:

◆ pflash_checksum()

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:

◆ pflash_erase_page()

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:

◆ pflash_program_array()

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:

◆ pflash_program_bytes()

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: