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

Go to the source code of this file.

Data Structures

struct  npcx_flash_bank
 
struct  npcx_flash_info
 

Macros

#define NPCX_FLASH_TIMEOUT_MS   8000
 

Enumerations

enum  npcx_flash_device_index { NPCX_FLASH_256KB = 0 , NPCX_FLASH_512KB = 1 , NPCX_FLASH_1MB = 2 , NPCX_FLASH_UNKNOWN }
 

Functions

 FLASH_BANK_COMMAND_HANDLER (npcx_flash_bank_command)
 
static int npcx_auto_probe (struct flash_bank *bank)
 
static int npcx_chip_erase (struct flash_bank *bank)
 
static int npcx_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int npcx_get_flash (uint32_t flash_id)
 
static enum npcx_flash_device_index npcx_get_flash_id (struct flash_bank *bank, uint32_t *flash_id)
 
static int npcx_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int npcx_init (struct flash_bank *bank)
 
static int npcx_probe (struct flash_bank *bank)
 
static int npcx_quit (struct flash_bank *bank)
 
static int npcx_wait_algo_done (struct flash_bank *bank, uint32_t params_addr)
 
static int npcx_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

static const struct npcx_flash_info flash_info []
 
static const uint8_t npcx_algo []
 
const struct flash_driver npcx_flash
 

Macro Definition Documentation

◆ NPCX_FLASH_TIMEOUT_MS

#define NPCX_FLASH_TIMEOUT_MS   8000

Definition at line 25 of file npcx.c.

Enumeration Type Documentation

◆ npcx_flash_device_index

Enumerator
NPCX_FLASH_256KB 
NPCX_FLASH_512KB 
NPCX_FLASH_1MB 
NPCX_FLASH_UNKNOWN 

Definition at line 28 of file npcx.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( npcx_flash_bank_command  )

◆ npcx_auto_probe()

static int npcx_auto_probe ( struct flash_bank bank)
static

Definition at line 284 of file npcx.c.

References bank, ERROR_OK, npcx_probe(), and npcx_flash_bank::probed.

Referenced by npcx_chip_erase(), npcx_erase(), and npcx_write().

◆ npcx_chip_erase()

◆ npcx_erase()

◆ npcx_get_flash()

static int npcx_get_flash ( uint32_t  flash_id)
static

Definition at line 224 of file npcx.c.

References ARRAY_SIZE, flash_info, and NPCX_FLASH_UNKNOWN.

Referenced by npcx_probe().

◆ npcx_get_flash_id()

static enum npcx_flash_device_index npcx_get_flash_id ( struct flash_bank bank,
uint32_t *  flash_id 
)
static

◆ npcx_info()

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

Definition at line 518 of file npcx.c.

◆ npcx_init()

◆ npcx_probe()

◆ npcx_quit()

◆ npcx_wait_algo_done()

static int npcx_wait_algo_done ( struct flash_bank bank,
uint32_t  params_addr 
)
static

Definition at line 152 of file npcx.c.

Referenced by npcx_chip_erase(), npcx_erase(), and npcx_write().

◆ npcx_write()

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

Variable Documentation

◆ flash_info

const struct npcx_flash_info flash_info[]
static
Initial value:
= {
.name = "256KB Flash",
.id = 0xEF4012,
.size = 256 * 1024,
},
.name = "512KB Flash",
.id = 0xEF4013,
.size = 512 * 1024,
},
.name = "1MB Flash",
.id = 0xEF4014,
.size = 1024 * 1024,
},
.name = "Unknown Flash",
.size = 0xFFFFFFFF,
},
}
@ NPCX_FLASH_256KB
Definition: npcx.c:29
@ NPCX_FLASH_UNKNOWN
Definition: npcx.c:32
@ NPCX_FLASH_512KB
Definition: npcx.c:30
@ NPCX_FLASH_1MB
Definition: npcx.c:31

Definition at line 21 of file npcx.c.

Referenced by npcx_get_flash(), and npcx_probe().

◆ npcx_algo

const uint8_t npcx_algo[]
static
Initial value:
= {
}

Definition at line 21 of file npcx.c.

Referenced by npcx_probe().

◆ npcx_flash

const struct flash_driver npcx_flash
Initial value:
= {
.name = "npcx",
.flash_bank_command = npcx_flash_bank_command,
.erase = npcx_erase,
.write = npcx_write,
.probe = npcx_probe,
.auto_probe = npcx_auto_probe,
.erase_check = default_flash_blank_check,
.info = npcx_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 npcx_auto_probe(struct flash_bank *bank)
Definition: npcx.c:284
static int npcx_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: npcx.c:518
static int npcx_probe(struct flash_bank *bank)
Definition: npcx.c:234
static int npcx_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: npcx.c:445
static int npcx_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: npcx.c:386

Definition at line 518 of file npcx.c.