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

Go to the source code of this file.

Data Structures

struct  lpc288x_flash_bank
 

Macros

#define DBGU_CIDR   0x8000507C
 
#define F_CLK_TIME
 
#define F_CTRL   0x80102000 /* Flash control register R/W 0x5 */
 
#define F_INT_CLR   0x80102FE8 /* Clear interrupt status bits WO */
 
#define F_INT_SET   0x80102FEC /* Set interrupt status bits WO - */
 
#define F_INT_STAT   0x80102FE0 /* Interrupt status bits RO 0 */
 
#define F_INTEN   0x80102FE4 /* Interrupt enable bits RO 0 */
 
#define F_INTEN_CLR   0x80102FD8 /* Clear interrupt enable bits WO - */
 
#define F_INTEN_SET   0x80102FDC /* Set interrupt enable bits WO - */
 
#define F_PROG_TIME   0x80102008 /* Flash program time register R/W 0 */
 
#define F_STAT   0x80102004 /* Flash status register RO 0x45 */
 
#define F_WAIT   0x80102010 /* Flash read wait state register R/W 0xC004 */
 
#define FC_CLR_BUF   0x4000
 
#define FC_CS   0x0001
 
#define FC_FUNC   0x0002
 
#define FC_LOAD_REQ   0x8000
 
#define FC_PROG_REQ   0x1000
 
#define FC_PROTECT   0x0080
 
#define FC_RD_LATCH   0x0020
 
#define FC_RSSL   0x0800
 
#define FC_SET_DATA   0x0400
 
#define FC_WEN   0x0004
 
#define FCT_CLK_DIV_MASK   0x0FFF
 
#define FLASH_INIT
 
#define FLASH_PAGE_SIZE   512
 
#define FLASH_PD
 
#define FPT_ENABLE   0x8000
 
#define FPT_TIME_MASK   0x7FFF
 
#define FS_DONE   0x0001
 
#define FS_ERR   0x0020
 
#define FS_PROGGNT   0x0002
 
#define FS_RDY   0x0004
 
#define FW_SET_MASK   0xC000
 
#define FW_WAIT_STATES_MASK   0x00FF
 
#define LOAD_TIMER_ERASE   0
 
#define LOAD_TIMER_WRITE   1
 

Functions

 FLASH_BANK_COMMAND_HANDLER (lpc288x_flash_bank_command)
 
static int lpc288x_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static void lpc288x_load_timer (int erase, struct target *target)
 
static int lpc288x_probe (struct flash_bank *bank)
 
static int lpc288x_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int lpc288x_protect_check (struct flash_bank *bank)
 
static int lpc288x_read_part_info (struct flash_bank *bank)
 
static void lpc288x_set_flash_clk (struct flash_bank *bank)
 
static uint32_t lpc288x_system_ready (struct flash_bank *bank)
 
static uint32_t lpc288x_wait_status_busy (struct flash_bank *bank, int timeout)
 
static int lpc288x_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 

Variables

const struct flash_driver lpc288x_flash
 

Macro Definition Documentation

◆ DBGU_CIDR

#define DBGU_CIDR   0x8000507C

Definition at line 30 of file lpc288x.c.

◆ F_CLK_TIME

#define F_CLK_TIME
Value:
0x8010201C /* Flash clock divider for 66 kHz generation R/W 0
**/

Definition at line 36 of file lpc288x.c.

◆ F_CTRL

#define F_CTRL   0x80102000 /* Flash control register R/W 0x5 */

Definition at line 32 of file lpc288x.c.

◆ F_INT_CLR

#define F_INT_CLR   0x80102FE8 /* Clear interrupt status bits WO */

Definition at line 41 of file lpc288x.c.

◆ F_INT_SET

#define F_INT_SET   0x80102FEC /* Set interrupt status bits WO - */

Definition at line 42 of file lpc288x.c.

◆ F_INT_STAT

#define F_INT_STAT   0x80102FE0 /* Interrupt status bits RO 0 */

Definition at line 39 of file lpc288x.c.

◆ F_INTEN

#define F_INTEN   0x80102FE4 /* Interrupt enable bits RO 0 */

Definition at line 40 of file lpc288x.c.

◆ F_INTEN_CLR

#define F_INTEN_CLR   0x80102FD8 /* Clear interrupt enable bits WO - */

Definition at line 37 of file lpc288x.c.

◆ F_INTEN_SET

#define F_INTEN_SET   0x80102FDC /* Set interrupt enable bits WO - */

Definition at line 38 of file lpc288x.c.

◆ F_PROG_TIME

#define F_PROG_TIME   0x80102008 /* Flash program time register R/W 0 */

Definition at line 34 of file lpc288x.c.

◆ F_STAT

#define F_STAT   0x80102004 /* Flash status register RO 0x45 */

Definition at line 33 of file lpc288x.c.

◆ F_WAIT

#define F_WAIT   0x80102010 /* Flash read wait state register R/W 0xC004 */

Definition at line 35 of file lpc288x.c.

◆ FC_CLR_BUF

#define FC_CLR_BUF   0x4000

Definition at line 55 of file lpc288x.c.

◆ FC_CS

#define FC_CS   0x0001

Definition at line 47 of file lpc288x.c.

◆ FC_FUNC

#define FC_FUNC   0x0002

Definition at line 48 of file lpc288x.c.

◆ FC_LOAD_REQ

#define FC_LOAD_REQ   0x8000

Definition at line 56 of file lpc288x.c.

◆ FC_PROG_REQ

#define FC_PROG_REQ   0x1000

Definition at line 54 of file lpc288x.c.

◆ FC_PROTECT

#define FC_PROTECT   0x0080

Definition at line 51 of file lpc288x.c.

◆ FC_RD_LATCH

#define FC_RD_LATCH   0x0020

Definition at line 50 of file lpc288x.c.

◆ FC_RSSL

#define FC_RSSL   0x0800

Definition at line 53 of file lpc288x.c.

◆ FC_SET_DATA

#define FC_SET_DATA   0x0400

Definition at line 52 of file lpc288x.c.

◆ FC_WEN

#define FC_WEN   0x0004

Definition at line 49 of file lpc288x.c.

◆ FCT_CLK_DIV_MASK

#define FCT_CLK_DIV_MASK   0x0FFF

Definition at line 71 of file lpc288x.c.

◆ FLASH_INIT

#define FLASH_INIT
Value:
0x80005034 /* Monitors Flash readiness, such as recovery from
*Power Down mode. R/W -*/

Definition at line 44 of file lpc288x.c.

◆ FLASH_PAGE_SIZE

#define FLASH_PAGE_SIZE   512

Definition at line 27 of file lpc288x.c.

◆ FLASH_PD

#define FLASH_PD
Value:
0x80005030 /* Allows turning off the Flash memory for power
*savings. R/W 1*/

Definition at line 43 of file lpc288x.c.

◆ FPT_ENABLE

#define FPT_ENABLE   0x8000

Definition at line 65 of file lpc288x.c.

◆ FPT_TIME_MASK

#define FPT_TIME_MASK   0x7FFF

Definition at line 63 of file lpc288x.c.

◆ FS_DONE

#define FS_DONE   0x0001

Definition at line 58 of file lpc288x.c.

◆ FS_ERR

#define FS_ERR   0x0020

Definition at line 61 of file lpc288x.c.

◆ FS_PROGGNT

#define FS_PROGGNT   0x0002

Definition at line 59 of file lpc288x.c.

◆ FS_RDY

#define FS_RDY   0x0004

Definition at line 60 of file lpc288x.c.

◆ FW_SET_MASK

#define FW_SET_MASK   0xC000

Definition at line 68 of file lpc288x.c.

◆ FW_WAIT_STATES_MASK

#define FW_WAIT_STATES_MASK   0x00FF

Definition at line 67 of file lpc288x.c.

◆ LOAD_TIMER_ERASE

#define LOAD_TIMER_ERASE   0

Definition at line 24 of file lpc288x.c.

◆ LOAD_TIMER_WRITE

#define LOAD_TIMER_WRITE   1

Definition at line 25 of file lpc288x.c.

Function Documentation

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( lpc288x_flash_bank_command  )

Definition at line 163 of file lpc288x.c.

◆ lpc288x_erase()

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

Definition at line 221 of file lpc288x.c.

◆ lpc288x_load_timer()

static void lpc288x_load_timer ( int  erase,
struct target target 
)
static

Definition at line 200 of file lpc288x.c.

References F_PROG_TIME, FPT_ENABLE, LOAD_TIMER_ERASE, and target_write_u32().

◆ lpc288x_probe()

static int lpc288x_probe ( struct flash_bank bank)
static

Definition at line 347 of file lpc288x.c.

◆ lpc288x_protect()

static int lpc288x_protect ( struct flash_bank bank,
int  set,
unsigned int  first,
unsigned int  last 
)
static

Definition at line 367 of file lpc288x.c.

◆ lpc288x_protect_check()

static int lpc288x_protect_check ( struct flash_bank bank)
static

Definition at line 157 of file lpc288x.c.

◆ lpc288x_read_part_info()

static int lpc288x_read_part_info ( struct flash_bank bank)
static

Definition at line 108 of file lpc288x.c.

◆ lpc288x_set_flash_clk()

static void lpc288x_set_flash_clk ( struct flash_bank bank)
static

Definition at line 185 of file lpc288x.c.

References bank, lpc288x_flash_bank::cclk, F_CLK_TIME, F_CTRL, FC_CS, FC_WEN, and target_write_u32().

◆ lpc288x_system_ready()

static uint32_t lpc288x_system_ready ( struct flash_bank bank)
static

Definition at line 208 of file lpc288x.c.

◆ lpc288x_wait_status_busy()

static uint32_t lpc288x_wait_status_busy ( struct flash_bank bank,
int  timeout 
)
static

Definition at line 90 of file lpc288x.c.

◆ lpc288x_write()

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

Definition at line 254 of file lpc288x.c.

Variable Documentation

◆ lpc288x_flash

const struct flash_driver lpc288x_flash
Initial value:
= {
.name = "lpc288x",
.flash_bank_command = lpc288x_flash_bank_command,
.erase = lpc288x_erase,
.protect = lpc288x_protect,
.write = lpc288x_write,
.probe = lpc288x_probe,
.auto_probe = lpc288x_probe,
.erase_check = default_flash_blank_check,
.protect_check = lpc288x_protect_check,
.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 lpc288x_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: lpc288x.c:221
static int lpc288x_protect_check(struct flash_bank *bank)
Definition: lpc288x.c:157
static int lpc288x_probe(struct flash_bank *bank)
Definition: lpc288x.c:347
static int lpc288x_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: lpc288x.c:254
static int lpc288x_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: lpc288x.c:367

Definition at line 367 of file lpc288x.c.