OpenOCD
bl602.c File Reference
Include dependency graph for bl602.c:

Go to the source code of this file.

Data Structures

struct  bl602_flash_bank
 
struct  bl602_part_info
 

Macros

#define BL602_DEFAULT_TIMEOUT_MS   5000
 
#define SFLASH_CFG_BUSY_BIT_POS   0x2D
 
#define SFLASH_CFG_BUSY_INDEX_POS   0x2A
 
#define SFLASH_CFG_BUSY_READ_REG_LEN_POS   0x33
 
#define SFLASH_CFG_FAST_READ_CMD_POS   0x18
 
#define SFLASH_CFG_JEDEC_ID_CMD_DMY_CLK_POS   0x09
 
#define SFLASH_CFG_JEDEC_ID_CMD_POS   0x08
 
#define SFLASH_CFG_PAGE_PROGRAM_CMD_POS   0x15
 
#define SFLASH_CFG_PAGE_SIZE_POS   0x0E
 
#define SFLASH_CFG_READ_STATUS_REG1_POS   0x34
 
#define SFLASH_CFG_SECTOR_ERASE_CMD_POS   0x11
 
#define SFLASH_CFG_SECTOR_SIZE_POS   0x0C
 
#define SFLASH_CFG_SIZE   84
 
#define SFLASH_CFG_TIME_ERASE_SECTOR_POS   0x48
 
#define SFLASH_CFG_TIME_PAGE_PGM_POS   0x4E
 
#define SFLASH_CFG_WRITE_ENABLE_BIT_POS   0x2B
 
#define SFLASH_CFG_WRITE_ENABLE_CMD_POS   0x14
 
#define SFLASH_CFG_WRITE_ENABLE_INDEX_POS   0x28
 
#define SFLASH_CFG_WRITE_ENABLE_READ_REG_LEN_POS   0x2F
 

Enumerations

enum  bflb_series { BFLB_SERIES_BL602 , BFLB_SERIES_BL702 , BFLB_SERIES_BL702L }
 

Functions

static int bl602_alloc_bounce_buffer (struct flash_bank *bank, struct working_area **working_area, uint32_t count)
 
static int bl602_alloc_sflash_cfg (struct flash_bank *bank, struct working_area **working_area)
 
static int bl602_auto_probe (struct flash_bank *bank)
 
static int bl602_call_func (struct target *target, uint32_t func_addr, uint32_t arg_data[], unsigned int n_args, uint32_t *return_data, unsigned int timeout_ms)
 
static int bl602_call_romapi_func (struct target *target, uint32_t romapi_func_addr, uint32_t arg_data[], unsigned int n_args, uint32_t *return_data, unsigned int timeout_ms)
 
static int bl602_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int bl602_flash_gpio_init (struct flash_bank *bank)
 
static int bl602_flash_init (struct flash_bank *bank)
 
static int bl602_flash_read_id (struct flash_bank *bank, uint32_t *jedec_id)
 
static int bl602_probe (struct flash_bank *bank)
 
static int bl602_read (struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int bl602_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
 FLASH_BANK_COMMAND_HANDLER (bl602_flash_bank_command)
 

Variables

const struct flash_driver bl602_flash
 
static const struct bl602_part_info bl602_parts []
 
static const uint8_t bl602_sflash_ctrl_cfg []
 
static const uint8_t bl702l_sflash_ctrl_cfg []
 

Macro Definition Documentation

◆ BL602_DEFAULT_TIMEOUT_MS

#define BL602_DEFAULT_TIMEOUT_MS   5000

Definition at line 55 of file bl602.c.

◆ SFLASH_CFG_BUSY_BIT_POS

#define SFLASH_CFG_BUSY_BIT_POS   0x2D

Definition at line 37 of file bl602.c.

◆ SFLASH_CFG_BUSY_INDEX_POS

#define SFLASH_CFG_BUSY_INDEX_POS   0x2A

Definition at line 38 of file bl602.c.

◆ SFLASH_CFG_BUSY_READ_REG_LEN_POS

#define SFLASH_CFG_BUSY_READ_REG_LEN_POS   0x33

Definition at line 39 of file bl602.c.

◆ SFLASH_CFG_FAST_READ_CMD_POS

#define SFLASH_CFG_FAST_READ_CMD_POS   0x18

Definition at line 40 of file bl602.c.

◆ SFLASH_CFG_JEDEC_ID_CMD_DMY_CLK_POS

#define SFLASH_CFG_JEDEC_ID_CMD_DMY_CLK_POS   0x09

Definition at line 41 of file bl602.c.

◆ SFLASH_CFG_JEDEC_ID_CMD_POS

#define SFLASH_CFG_JEDEC_ID_CMD_POS   0x08

Definition at line 42 of file bl602.c.

◆ SFLASH_CFG_PAGE_PROGRAM_CMD_POS

#define SFLASH_CFG_PAGE_PROGRAM_CMD_POS   0x15

Definition at line 43 of file bl602.c.

◆ SFLASH_CFG_PAGE_SIZE_POS

#define SFLASH_CFG_PAGE_SIZE_POS   0x0E

Definition at line 44 of file bl602.c.

◆ SFLASH_CFG_READ_STATUS_REG1_POS

#define SFLASH_CFG_READ_STATUS_REG1_POS   0x34

Definition at line 45 of file bl602.c.

◆ SFLASH_CFG_SECTOR_ERASE_CMD_POS

#define SFLASH_CFG_SECTOR_ERASE_CMD_POS   0x11

Definition at line 46 of file bl602.c.

◆ SFLASH_CFG_SECTOR_SIZE_POS

#define SFLASH_CFG_SECTOR_SIZE_POS   0x0C

Definition at line 47 of file bl602.c.

◆ SFLASH_CFG_SIZE

#define SFLASH_CFG_SIZE   84

Definition at line 36 of file bl602.c.

◆ SFLASH_CFG_TIME_ERASE_SECTOR_POS

#define SFLASH_CFG_TIME_ERASE_SECTOR_POS   0x48

Definition at line 48 of file bl602.c.

◆ SFLASH_CFG_TIME_PAGE_PGM_POS

#define SFLASH_CFG_TIME_PAGE_PGM_POS   0x4E

Definition at line 49 of file bl602.c.

◆ SFLASH_CFG_WRITE_ENABLE_BIT_POS

#define SFLASH_CFG_WRITE_ENABLE_BIT_POS   0x2B

Definition at line 50 of file bl602.c.

◆ SFLASH_CFG_WRITE_ENABLE_CMD_POS

#define SFLASH_CFG_WRITE_ENABLE_CMD_POS   0x14

Definition at line 51 of file bl602.c.

◆ SFLASH_CFG_WRITE_ENABLE_INDEX_POS

#define SFLASH_CFG_WRITE_ENABLE_INDEX_POS   0x28

Definition at line 52 of file bl602.c.

◆ SFLASH_CFG_WRITE_ENABLE_READ_REG_LEN_POS

#define SFLASH_CFG_WRITE_ENABLE_READ_REG_LEN_POS   0x2F

Definition at line 53 of file bl602.c.

Enumeration Type Documentation

◆ bflb_series

Enumerator
BFLB_SERIES_BL602 
BFLB_SERIES_BL702 
BFLB_SERIES_BL702L 

Definition at line 57 of file bl602.c.

Function Documentation

◆ bl602_alloc_bounce_buffer()

static int bl602_alloc_bounce_buffer ( struct flash_bank bank,
struct working_area **  working_area,
uint32_t  count 
)
static

◆ bl602_alloc_sflash_cfg()

static int bl602_alloc_sflash_cfg ( struct flash_bank bank,
struct working_area **  working_area 
)
static

◆ bl602_auto_probe()

static int bl602_auto_probe ( struct flash_bank bank)
static

Definition at line 694 of file bl602.c.

References bank, bl602_probe(), ERROR_OK, and priv.

◆ bl602_call_func()

static int bl602_call_func ( struct target target,
uint32_t  func_addr,
uint32_t  arg_data[],
unsigned int  n_args,
uint32_t *  return_data,
unsigned int  timeout_ms 
)
static

◆ bl602_call_romapi_func()

static int bl602_call_romapi_func ( struct target target,
uint32_t  romapi_func_addr,
uint32_t  arg_data[],
unsigned int  n_args,
uint32_t *  return_data,
unsigned int  timeout_ms 
)
static

◆ bl602_erase()

◆ bl602_flash_gpio_init()

◆ bl602_flash_init()

◆ bl602_flash_read_id()

◆ bl602_probe()

◆ bl602_read()

◆ bl602_write()

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( bl602_flash_bank_command  )

Definition at line 707 of file bl602.c.

Variable Documentation

◆ bl602_flash

const struct flash_driver bl602_flash
Initial value:
= {
.name = "bl602",
.flash_bank_command = bl602_flash_bank_command,
.erase = bl602_erase,
.write = bl602_write,
.read = bl602_read,
.probe = bl602_probe,
.auto_probe = bl602_auto_probe,
.erase_check = default_flash_blank_check,
.free_driver_priv = default_flash_free_driver_priv
}
static int bl602_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: bl602.c:430
static int bl602_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: bl602.c:544
static int bl602_auto_probe(struct flash_bank *bank)
Definition: bl602.c:694
static int bl602_probe(struct flash_bank *bank)
Definition: bl602.c:615
static int bl602_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: bl602.c:472
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.

Definition at line 707 of file bl602.c.

◆ bl602_parts

const struct bl602_part_info bl602_parts[]
static

Definition at line 1 of file bl602.c.

Referenced by bl602_probe().

◆ bl602_sflash_ctrl_cfg

const uint8_t bl602_sflash_ctrl_cfg[]
static
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00
}

Definition at line 309 of file bl602.c.

Referenced by bl602_flash_init().

◆ bl702l_sflash_ctrl_cfg

const uint8_t bl702l_sflash_ctrl_cfg[]
static
Initial value:
= {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0xe1, 0xfd, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
0x00, 0x00, 0x01, 0x21,
}

Definition at line 316 of file bl602.c.

Referenced by bl602_flash_init().