dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Flash Partition Abstraction

Flash Partition Abstraction to hide details of underlying flash device details. More...

Files

file  pios_flash_jedec_priv.h
 Driver for talking to most JEDEC flash chips.
 

Data Structures

struct  pios_flash_jedec_cfg
 
struct  pios_flash_driver
 
struct  pios_flash_sector_range
 
struct  pios_flash_chip
 
struct  pios_flash_partition
 

Macros

#define JEDEC_MANUFACTURER_ANY   0x00
 
#define JEDEC_MANUFACTURER_ST   0x20
 
#define JEDEC_MANUFACTURER_MACRONIX   0xC2
 
#define JEDEC_MANUFACTURER_WINBOND   0xEF
 
#define JEDEC_MANUFACTURER_SPANSION   0x01
 
#define JEDEC_MANUFACTURER_MICRON   0x20
 
#define JEDEC_MEMORYTYPE_ANY   0x00
 
#define FLASH_SECTOR_1KB   ( 1 * 1024)
 
#define FLASH_SECTOR_2KB   ( 2 * 1024)
 
#define FLASH_SECTOR_4KB   ( 4 * 1024)
 
#define FLASH_SECTOR_8KB   ( 8 * 1024)
 
#define FLASH_SECTOR_16KB   ( 16 * 1024)
 
#define FLASH_SECTOR_32KB   ( 32 * 1024)
 
#define FLASH_SECTOR_64KB   ( 64 * 1024)
 
#define FLASH_SECTOR_128KB   (128 * 1024)
 

Enumerations

enum  pios_flash_partition_labels {
  FLASH_PARTITION_LABEL_BL, FLASH_PARTITION_LABEL_FW, FLASH_PARTITION_LABEL_EE, FLASH_PARTITION_LABEL_SETTINGS,
  FLASH_PARTITION_LABEL_AUTOTUNE, FLASH_PARTITION_LABEL_LOG, FLASH_PARTITION_LABEL_LOADABLE_EXTENSION, FLASH_PARTITION_NUM_LABELS
}
 

Functions

int32_t PIOS_FLASH_find_partition_id (enum pios_flash_partition_labels label, uintptr_t *partition_id)
 
uint16_t PIOS_FLASH_get_num_partitions (void)
 
int32_t PIOS_FLASH_get_partition_size (uintptr_t partition_id, uint32_t *partition_size)
 
int32_t PIOS_FLASH_start_transaction (uintptr_t partition_id)
 
int32_t PIOS_FLASH_end_transaction (uintptr_t partition_id)
 
int32_t PIOS_FLASH_erase_partition (uintptr_t partition_id)
 
int32_t PIOS_FLASH_erase_range (uintptr_t partition_id, uint32_t start_offset, uint32_t size)
 
int32_t PIOS_FLASH_write_data (uintptr_t partition_id, uint32_t offset, const uint8_t *data, uint16_t len)
 
int32_t PIOS_FLASH_read_data (uintptr_t partition_id, uint32_t offset, uint8_t *data, uint16_t len)
 
void * PIOS_FLASH_get_address (uintptr_t partition_id, uint32_t *partition_size)
 
int32_t PIOS_Flash_Jedec_Init (uintptr_t *flash_id, pios_spi_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg *cfg)
 
int32_t PIOS_Flash_Jedec_ReadOTPData (uintptr_t chip_id, uint32_t chip_offset, uint8_t *data, uint16_t len)
 
uint32_t PIOS_Flash_Jedec_GetCapacity (uintptr_t chip_id)
 
void PIOS_FLASH_register_partition_table (const struct pios_flash_partition partition_table[], uint8_t num_partitions)
 
void PIOS_FLASH_fixup_partitions_for_capacity (struct pios_flash_partition *partition_table, uint8_t partition_table_len, const struct pios_flash_chip *descriptor, struct pios_flash_sector_range *sectors, uint32_t num_bytes)
 

Variables

const struct pios_flash_driver pios_jedec_flash_driver
 
uint8_t pios_flash_jedec_cfg::expect_manufacturer
 
uint8_t pios_flash_jedec_cfg::expect_memorytype
 
uint8_t pios_flash_jedec_cfg::expect_capacity
 
uint32_t pios_flash_jedec_cfg::sector_erase
 
int32_t(* pios_flash_driver::start_transaction )(uintptr_t chip_id)
 
int32_t(* pios_flash_driver::end_transaction )(uintptr_t chip_id)
 
int32_t(* pios_flash_driver::erase_sector )(uintptr_t chip_id, uint32_t chip_sector, uint32_t chip_offset)
 
int32_t(* pios_flash_driver::write_data )(uintptr_t chip_id, uint32_t chip_offset, const uint8_t *data, uint16_t len)
 
int32_t(* pios_flash_driver::read_data )(uintptr_t chip_id, uint32_t chip_offset, uint8_t *data, uint16_t len)
 
void *(* pios_flash_driver::get_pointer )(uintptr_t chip_id, uint32_t chip_offset)
 
uint16_t pios_flash_sector_range::base_sector
 
uint16_t pios_flash_sector_range::last_sector
 
uint32_t pios_flash_sector_range::sector_size
 
const struct pios_flash_driverpios_flash_chip::driver
 
uintptr_t * pios_flash_chip::chip_id
 
uint32_t pios_flash_chip::page_size
 
const struct
pios_flash_sector_range
pios_flash_chip::sector_blocks
 
uint32_t pios_flash_chip::num_blocks
 
enum pios_flash_partition_labels pios_flash_partition::label
 
const struct pios_flash_chippios_flash_partition::chip_desc
 
uint16_t pios_flash_partition::first_sector
 
uint16_t pios_flash_partition::last_sector
 
uint32_t pios_flash_partition::chip_offset
 
uint32_t pios_flash_partition::size
 

Detailed Description

Flash Partition Abstraction to hide details of underlying flash device details.

Flash Driver API Definition.

Macro Definition Documentation

#define FLASH_SECTOR_128KB   (128 * 1024)

Definition at line 98 of file pios_flash_priv.h.

#define FLASH_SECTOR_16KB   ( 16 * 1024)

Definition at line 95 of file pios_flash_priv.h.

#define FLASH_SECTOR_1KB   ( 1 * 1024)

Definition at line 91 of file pios_flash_priv.h.

#define FLASH_SECTOR_2KB   ( 2 * 1024)

Definition at line 92 of file pios_flash_priv.h.

#define FLASH_SECTOR_32KB   ( 32 * 1024)

Definition at line 96 of file pios_flash_priv.h.

#define FLASH_SECTOR_4KB   ( 4 * 1024)

Definition at line 93 of file pios_flash_priv.h.

#define FLASH_SECTOR_64KB   ( 64 * 1024)

Definition at line 97 of file pios_flash_priv.h.

#define FLASH_SECTOR_8KB   ( 8 * 1024)

Definition at line 94 of file pios_flash_priv.h.

#define JEDEC_MANUFACTURER_ANY   0x00

Definition at line 37 of file pios_flash_jedec_priv.h.

#define JEDEC_MANUFACTURER_MACRONIX   0xC2

Definition at line 39 of file pios_flash_jedec_priv.h.

#define JEDEC_MANUFACTURER_MICRON   0x20

Definition at line 42 of file pios_flash_jedec_priv.h.

#define JEDEC_MANUFACTURER_SPANSION   0x01

Definition at line 41 of file pios_flash_jedec_priv.h.

#define JEDEC_MANUFACTURER_ST   0x20

Definition at line 38 of file pios_flash_jedec_priv.h.

#define JEDEC_MANUFACTURER_WINBOND   0xEF

Definition at line 40 of file pios_flash_jedec_priv.h.

#define JEDEC_MEMORYTYPE_ANY   0x00

Definition at line 44 of file pios_flash_jedec_priv.h.

Enumeration Type Documentation

Enumerator
FLASH_PARTITION_LABEL_BL 
FLASH_PARTITION_LABEL_FW 
FLASH_PARTITION_LABEL_EE 
FLASH_PARTITION_LABEL_SETTINGS 
FLASH_PARTITION_LABEL_AUTOTUNE 
FLASH_PARTITION_LABEL_LOG 
FLASH_PARTITION_LABEL_LOADABLE_EXTENSION 
FLASH_PARTITION_NUM_LABELS 

Definition at line 31 of file pios_flash.h.

Function Documentation

int32_t PIOS_FLASH_end_transaction ( uintptr_t  partition_id)
int32_t PIOS_FLASH_erase_partition ( uintptr_t  partition_id)
int32_t PIOS_FLASH_erase_range ( uintptr_t  partition_id,
uint32_t  start_offset,
uint32_t  size 
)
int32_t PIOS_FLASH_find_partition_id ( enum pios_flash_partition_labels  label,
uintptr_t *  partition_id 
)
void PIOS_FLASH_fixup_partitions_for_capacity ( struct pios_flash_partition partition_table,
uint8_t  partition_table_len,
const struct pios_flash_chip descriptor,
struct pios_flash_sector_range sectors,
uint32_t  num_bytes 
)
void* PIOS_FLASH_get_address ( uintptr_t  partition_id,
uint32_t *  partition_size 
)
uint16_t PIOS_FLASH_get_num_partitions ( void  )
int32_t PIOS_FLASH_get_partition_size ( uintptr_t  partition_id,
uint32_t *  partition_size 
)
uint32_t PIOS_Flash_Jedec_GetCapacity ( uintptr_t  chip_id)
int32_t PIOS_Flash_Jedec_Init ( uintptr_t *  flash_id,
pios_spi_t  spi_id,
uint32_t  slave_num,
const struct pios_flash_jedec_cfg cfg 
)
int32_t PIOS_Flash_Jedec_ReadOTPData ( uintptr_t  chip_id,
uint32_t  chip_offset,
uint8_t *  data,
uint16_t  len 
)
int32_t PIOS_FLASH_read_data ( uintptr_t  partition_id,
uint32_t  offset,
uint8_t *  data,
uint16_t  len 
)
void PIOS_FLASH_register_partition_table ( const struct pios_flash_partition  partition_table[],
uint8_t  num_partitions 
)
int32_t PIOS_FLASH_start_transaction ( uintptr_t  partition_id)
int32_t PIOS_FLASH_write_data ( uintptr_t  partition_id,
uint32_t  offset,
const uint8_t *  data,
uint16_t  len 
)

Variable Documentation

uint16_t pios_flash_sector_range::base_sector

Definition at line 49 of file pios_flash_priv.h.

const struct pios_flash_chip* pios_flash_partition::chip_desc

Definition at line 84 of file pios_flash_priv.h.

uintptr_t* pios_flash_chip::chip_id

Definition at line 68 of file pios_flash_priv.h.

uint32_t pios_flash_partition::chip_offset

Definition at line 87 of file pios_flash_priv.h.

const struct pios_flash_driver* pios_flash_chip::driver

Definition at line 67 of file pios_flash_priv.h.

int32_t(* pios_flash_driver::end_transaction)(uintptr_t chip_id)

Definition at line 37 of file pios_flash_priv.h.

int32_t(* pios_flash_driver::erase_sector)(uintptr_t chip_id, uint32_t chip_sector, uint32_t chip_offset)

Definition at line 39 of file pios_flash_priv.h.

uint8_t pios_flash_jedec_cfg::expect_capacity

Definition at line 49 of file pios_flash_jedec_priv.h.

uint8_t pios_flash_jedec_cfg::expect_manufacturer

Definition at line 47 of file pios_flash_jedec_priv.h.

uint8_t pios_flash_jedec_cfg::expect_memorytype

Definition at line 48 of file pios_flash_jedec_priv.h.

uint16_t pios_flash_partition::first_sector

Definition at line 85 of file pios_flash_priv.h.

void*(* pios_flash_driver::get_pointer)(uintptr_t chip_id, uint32_t chip_offset)

Definition at line 42 of file pios_flash_priv.h.

enum pios_flash_partition_labels pios_flash_partition::label

Definition at line 83 of file pios_flash_priv.h.

uint16_t pios_flash_sector_range::last_sector

Definition at line 50 of file pios_flash_priv.h.

uint16_t pios_flash_partition::last_sector

Definition at line 86 of file pios_flash_priv.h.

uint32_t pios_flash_chip::num_blocks

Definition at line 71 of file pios_flash_priv.h.

uint32_t pios_flash_chip::page_size

Definition at line 69 of file pios_flash_priv.h.

const struct pios_flash_driver pios_jedec_flash_driver
int32_t(* pios_flash_driver::read_data)(uintptr_t chip_id, uint32_t chip_offset, uint8_t *data, uint16_t len)

Definition at line 41 of file pios_flash_priv.h.

const struct pios_flash_sector_range* pios_flash_chip::sector_blocks

Definition at line 70 of file pios_flash_priv.h.

uint32_t pios_flash_jedec_cfg::sector_erase

Definition at line 50 of file pios_flash_jedec_priv.h.

uint32_t pios_flash_sector_range::sector_size

Definition at line 51 of file pios_flash_priv.h.

uint32_t pios_flash_partition::size

Definition at line 88 of file pios_flash_priv.h.

int32_t(* pios_flash_driver::start_transaction)(uintptr_t chip_id)

Definition at line 36 of file pios_flash_priv.h.

int32_t(* pios_flash_driver::write_data)(uintptr_t chip_id, uint32_t chip_offset, const uint8_t *data, uint16_t len)

Definition at line 40 of file pios_flash_priv.h.