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

Go to the source code of this file.

Data Structures

struct  w600_flash_bank
 
struct  w600_flash_param
 

Macros

#define QFLASH_ADDR(addr)   (((addr) & 0xFFFFF) << 8)
 
#define QFLASH_BUFFER   (QFLASH_REGBASE + 0X200)
 
#define QFLASH_CMD_ADDR   (1ul << 31)
 
#define QFLASH_CMD_DATA   (1ul << 15)
 
#define QFLASH_CMD_DATALEN(len)   (((len) & 0x3FF) << 16)
 
#define QFLASH_CMD_INFO   (QFLASH_REGBASE + 0)
 
#define QFLASH_CMD_PP   (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 12) | 0x02)
 
#define QFLASH_CMD_RDID   (QFLASH_CMD_READ | 0x9F)
 
#define QFLASH_CMD_READ   (1ul << 14)
 
#define QFLASH_CMD_SE   (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 11) | 0x20)
 
#define QFLASH_CMD_START   (QFLASH_REGBASE + 4)
 
#define QFLASH_CMD_WRDI   (QFLASH_CMD_WRITE | 0x04)
 
#define QFLASH_CMD_WREN   (QFLASH_CMD_WRITE | 0x06)
 
#define QFLASH_CMD_WRITE   0
 
#define QFLASH_CRM(crm)   (((crm) & 0xFF) << 0)
 
#define QFLASH_REGBASE   0X40002000
 
#define QFLASH_START   (1ul << 28)
 
#define W600_FLASH_BASE   0x08000000
 
#define W600_FLASH_PAGESIZE   0x100
 
#define W600_FLASH_PROTECT_SIZE   0x2000
 
#define W600_FLASH_SECSIZE   0x1000
 

Functions

 FLASH_BANK_COMMAND_HANDLER (w600_flash_bank_command)
 
static int get_w600_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int w600_auto_probe (struct flash_bank *bank)
 
static int w600_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int w600_get_delay (struct flash_bank *bank, uint32_t cmd)
 
static int w600_get_flash_id (struct flash_bank *bank, uint32_t *flash_id)
 
static int w600_probe (struct flash_bank *bank)
 
static int w600_start (struct flash_bank *bank, uint32_t cmd, uint32_t addr, uint32_t len)
 
static int w600_start_do (struct flash_bank *bank, uint32_t cmd, uint32_t addr, uint32_t len, int timeout)
 
static int w600_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int w600_write_disable (struct flash_bank *bank)
 
static int w600_write_enable (struct flash_bank *bank)
 

Variables

const struct flash_driver w600_flash
 
static const struct w600_flash_param w600_param []
 

Macro Definition Documentation

◆ QFLASH_ADDR

#define QFLASH_ADDR (   addr)    (((addr) & 0xFFFFF) << 8)

Definition at line 42 of file w600.c.

◆ QFLASH_BUFFER

#define QFLASH_BUFFER   (QFLASH_REGBASE + 0X200)

Definition at line 27 of file w600.c.

◆ QFLASH_CMD_ADDR

#define QFLASH_CMD_ADDR   (1ul << 31)

Definition at line 31 of file w600.c.

◆ QFLASH_CMD_DATA

#define QFLASH_CMD_DATA   (1ul << 15)

Definition at line 32 of file w600.c.

◆ QFLASH_CMD_DATALEN

#define QFLASH_CMD_DATALEN (   len)    (((len) & 0x3FF) << 16)

Definition at line 33 of file w600.c.

◆ QFLASH_CMD_INFO

#define QFLASH_CMD_INFO   (QFLASH_REGBASE + 0)

Definition at line 25 of file w600.c.

◆ QFLASH_CMD_PP

#define QFLASH_CMD_PP   (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 12) | 0x02)

Definition at line 39 of file w600.c.

◆ QFLASH_CMD_RDID

#define QFLASH_CMD_RDID   (QFLASH_CMD_READ | 0x9F)

Definition at line 35 of file w600.c.

◆ QFLASH_CMD_READ

#define QFLASH_CMD_READ   (1ul << 14)

Definition at line 29 of file w600.c.

◆ QFLASH_CMD_SE

#define QFLASH_CMD_SE   (QFLASH_CMD_WRITE | QFLASH_CMD_ADDR | (1ul << 11) | 0x20)

Definition at line 38 of file w600.c.

◆ QFLASH_CMD_START

#define QFLASH_CMD_START   (QFLASH_REGBASE + 4)

Definition at line 26 of file w600.c.

◆ QFLASH_CMD_WRDI

#define QFLASH_CMD_WRDI   (QFLASH_CMD_WRITE | 0x04)

Definition at line 37 of file w600.c.

◆ QFLASH_CMD_WREN

#define QFLASH_CMD_WREN   (QFLASH_CMD_WRITE | 0x06)

Definition at line 36 of file w600.c.

◆ QFLASH_CMD_WRITE

#define QFLASH_CMD_WRITE   0

Definition at line 30 of file w600.c.

◆ QFLASH_CRM

#define QFLASH_CRM (   crm)    (((crm) & 0xFF) << 0)

Definition at line 43 of file w600.c.

◆ QFLASH_REGBASE

#define QFLASH_REGBASE   0X40002000

Definition at line 24 of file w600.c.

◆ QFLASH_START

#define QFLASH_START   (1ul << 28)

Definition at line 41 of file w600.c.

◆ W600_FLASH_BASE

#define W600_FLASH_BASE   0x08000000

Definition at line 19 of file w600.c.

◆ W600_FLASH_PAGESIZE

#define W600_FLASH_PAGESIZE   0x100

Definition at line 18 of file w600.c.

◆ W600_FLASH_PROTECT_SIZE

#define W600_FLASH_PROTECT_SIZE   0x2000

Definition at line 20 of file w600.c.

◆ W600_FLASH_SECSIZE

#define W600_FLASH_SECSIZE   0x1000

Definition at line 17 of file w600.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( w600_flash_bank_command  )

◆ get_w600_info()

static int get_w600_info ( struct flash_bank bank,
struct command_invocation cmd 
)
static

Definition at line 354 of file w600.c.

References bank, cmd, command_print_sameline(), ERROR_OK, and w600_get_flash_id().

◆ w600_auto_probe()

static int w600_auto_probe ( struct flash_bank bank)
static

Definition at line 346 of file w600.c.

References bank, ERROR_OK, w600_flash_bank::probed, and w600_probe().

◆ w600_erase()

static int w600_erase ( struct flash_bank bank,
unsigned int  first,
unsigned int  last 
)
static

◆ w600_get_delay()

static int w600_get_delay ( struct flash_bank bank,
uint32_t  cmd 
)
static

◆ w600_get_flash_id()

static int w600_get_flash_id ( struct flash_bank bank,
uint32_t *  flash_id 
)
static

Definition at line 261 of file w600.c.

References bank, ERROR_OK, QFLASH_BUFFER, QFLASH_CMD_RDID, target_read_u32(), and w600_start().

Referenced by get_w600_info(), and w600_probe().

◆ w600_probe()

◆ w600_start()

static int w600_start ( struct flash_bank bank,
uint32_t  cmd,
uint32_t  addr,
uint32_t  len 
)
static

◆ w600_start_do()

static int w600_start_do ( struct flash_bank bank,
uint32_t  cmd,
uint32_t  addr,
uint32_t  len,
int  timeout 
)
static

◆ w600_write()

static int w600_write ( struct flash_bank bank,
const uint8_t *  buffer,
uint32_t  offset,
uint32_t  count 
)
static

◆ w600_write_disable()

static int w600_write_disable ( struct flash_bank bank)
static

Definition at line 173 of file w600.c.

References bank, QFLASH_CMD_WRDI, and w600_start_do().

Referenced by w600_start().

◆ w600_write_enable()

static int w600_write_enable ( struct flash_bank bank)
static

Definition at line 168 of file w600.c.

References bank, QFLASH_CMD_WREN, and w600_start_do().

Referenced by w600_start().

Variable Documentation

◆ w600_flash

const struct flash_driver w600_flash
Initial value:
= {
.name = "w600",
.flash_bank_command = w600_flash_bank_command,
.erase = w600_erase,
.write = w600_write,
.probe = w600_probe,
.auto_probe = w600_auto_probe,
.erase_check = default_flash_blank_check,
.info = get_w600_info,
.free_driver_priv = default_flash_free_driver_priv,
}
int default_flash_blank_check(struct flash_bank *bank)
Provides default erased-bank check handling.
int default_flash_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Provides default read implementation for flash memory.
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.
static int w600_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: w600.c:220
static int w600_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: w600.c:196
static int w600_probe(struct flash_bank *bank)
Definition: w600.c:272
static int w600_auto_probe(struct flash_bank *bank)
Definition: w600.c:346
static int get_w600_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: w600.c:354

Definition at line 354 of file w600.c.

◆ w600_param

const struct w600_flash_param w600_param[]
static
Initial value:
= {
{
.id = 0x85,
.se_delay = 8,
.pp_delay = 2,
},
{
.id = 0x1C,
.se_delay = 50,
.pp_delay = 1,
},
{
.id = 0xC8,
.se_delay = 45,
.pp_delay = 1,
},
{
.id = 0x0B,
.se_delay = 60,
.pp_delay = 1,
},
{
.id = 0x68,
.se_delay = 50,
.pp_delay = 1,
},
}

Definition at line 1 of file w600.c.

Referenced by w600_probe().