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

Go to the source code of this file.

Data Structures

struct  ath79_flash_bank
 
struct  ath79_spi_ctx
 
struct  ath79_target
 

Macros

#define ATH79_MAX_TIMEOUT   (3000)
 
#define ATH79_REG_CLOCK   4
 
#define ATH79_REG_DATA   12
 
#define ATH79_REG_FS   0
 
#define ATH79_REG_WRITE   8
 
#define ATH79_SPI_CE_HI   0x00100
 
#define ATH79_SPI_CS0_HI   0x10000
 
#define ATH79_SPI_CS1_HI   0x20000
 
#define ATH79_SPI_CS2_HI   0x40000
 
#define ATH79_SPI_CS_ALLHI   0x70000
 
#define ATH79_SPI_DO_HI   0x00001
 
#define ATH79_XFER_FINAL   0x00000001
 
#define ATH79_XFER_PARTIAL   0x00000000
 
#define BITS_PER_BYTE   8
 

Functions

static int ath79_auto_probe (struct flash_bank *bank)
 
static int ath79_erase (struct flash_bank *bank, unsigned int first, unsigned int last)
 
static int ath79_erase_sector (struct flash_bank *bank, int sector)
 
static int ath79_flash_blank_check (struct flash_bank *bank)
 
static void ath79_pracc_addn (struct pracc_queue_info *ctx, const uint32_t *instr, int n)
 
static int ath79_probe (struct flash_bank *bank)
 
static int ath79_protect (struct flash_bank *bank, int set, unsigned int first, unsigned int last)
 
static int ath79_protect_check (struct flash_bank *bank)
 
static int ath79_read (struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int ath79_read_buffer (struct flash_bank *bank, uint8_t *buffer, uint32_t address, uint32_t len)
 
static int ath79_spi_bitbang_bytes (struct flash_bank *bank, uint8_t *data, int len, uint32_t flags)
 
static int ath79_spi_bitbang_chunk (struct flash_bank *bank, uint8_t *data, int len, int *transferred)
 
static int ath79_spi_bitbang_codegen (struct ath79_flash_bank *ath79_info, struct pracc_queue_info *ctx, uint8_t *data, int len, int partial_xfer)
 
static void ath79_spi_bitbang_prepare (struct flash_bank *bank)
 
static int ath79_write (struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
 
static int ath79_write_buffer (struct flash_bank *bank, const uint8_t *buffer, uint32_t address, uint32_t len)
 
static int ath79_write_enable (struct flash_bank *bank)
 
static int ath79_write_page (struct flash_bank *bank, const uint8_t *buffer, uint32_t address, uint32_t len)
 
static int erase_command (struct flash_bank *bank, int sector)
 
 FLASH_BANK_COMMAND_HANDLER (ath79_flash_bank_command)
 
static int get_ath79_info (struct flash_bank *bank, struct command_invocation *cmd)
 
static int read_flash_id (struct flash_bank *bank, uint32_t *id)
 
static int read_status_reg (struct flash_bank *bank, uint32_t *status)
 
static int wait_till_ready (struct flash_bank *bank, int timeout)
 

Variables

static const uint32_t ath79_chipselects []
 
const struct flash_driver ath79_flash
 
static const struct ath79_target target_devices []
 

Macro Definition Documentation

◆ ATH79_MAX_TIMEOUT

#define ATH79_MAX_TIMEOUT   (3000)

Definition at line 71 of file ath79.c.

◆ ATH79_REG_CLOCK

#define ATH79_REG_CLOCK   4

Definition at line 56 of file ath79.c.

◆ ATH79_REG_DATA

#define ATH79_REG_DATA   12

Definition at line 58 of file ath79.c.

◆ ATH79_REG_FS

#define ATH79_REG_FS   0

Definition at line 55 of file ath79.c.

◆ ATH79_REG_WRITE

#define ATH79_REG_WRITE   8

Definition at line 57 of file ath79.c.

◆ ATH79_SPI_CE_HI

#define ATH79_SPI_CE_HI   0x00100

Definition at line 64 of file ath79.c.

◆ ATH79_SPI_CS0_HI

#define ATH79_SPI_CS0_HI   0x10000

Definition at line 61 of file ath79.c.

◆ ATH79_SPI_CS1_HI

#define ATH79_SPI_CS1_HI   0x20000

Definition at line 62 of file ath79.c.

◆ ATH79_SPI_CS2_HI

#define ATH79_SPI_CS2_HI   0x40000

Definition at line 63 of file ath79.c.

◆ ATH79_SPI_CS_ALLHI

#define ATH79_SPI_CS_ALLHI   0x70000

Definition at line 60 of file ath79.c.

◆ ATH79_SPI_DO_HI

#define ATH79_SPI_DO_HI   0x00001

Definition at line 65 of file ath79.c.

◆ ATH79_XFER_FINAL

#define ATH79_XFER_FINAL   0x00000001

Definition at line 67 of file ath79.c.

◆ ATH79_XFER_PARTIAL

#define ATH79_XFER_PARTIAL   0x00000000

Definition at line 68 of file ath79.c.

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   8

Definition at line 53 of file ath79.c.

Function Documentation

◆ ath79_auto_probe()

static int ath79_auto_probe ( struct flash_bank bank)
static

Definition at line 845 of file ath79.c.

References ath79_probe(), bank, ERROR_OK, and ath79_flash_bank::probed.

◆ ath79_erase()

◆ ath79_erase_sector()

static int ath79_erase_sector ( struct flash_bank bank,
int  sector 
)
static

Definition at line 473 of file ath79.c.

References ATH79_MAX_TIMEOUT, ath79_write_enable(), bank, erase_command(), ERROR_OK, and wait_till_ready().

Referenced by ath79_erase().

◆ ath79_flash_blank_check()

static int ath79_flash_blank_check ( struct flash_bank bank)
static

Definition at line 854 of file ath79.c.

References ERROR_OK.

◆ ath79_pracc_addn()

static void ath79_pracc_addn ( struct pracc_queue_info ctx,
const uint32_t *  instr,
int  n 
)
static

Definition at line 105 of file ath79.c.

References pracc_add().

Referenced by ath79_spi_bitbang_codegen().

◆ ath79_probe()

◆ ath79_protect()

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

Definition at line 533 of file ath79.c.

References bank, and ERROR_OK.

◆ ath79_protect_check()

static int ath79_protect_check ( struct flash_bank bank)
static

Definition at line 860 of file ath79.c.

References ERROR_OK.

◆ ath79_read()

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

◆ ath79_read_buffer()

static int ath79_read_buffer ( struct flash_bank bank,
uint8_t *  buffer,
uint32_t  address,
uint32_t  len 
)
static

◆ ath79_spi_bitbang_bytes()

static int ath79_spi_bitbang_bytes ( struct flash_bank bank,
uint8_t *  data,
int  len,
uint32_t  flags 
)
static

◆ ath79_spi_bitbang_chunk()

◆ ath79_spi_bitbang_codegen()

◆ ath79_spi_bitbang_prepare()

static void ath79_spi_bitbang_prepare ( struct flash_bank bank)
static

◆ ath79_write()

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

◆ ath79_write_buffer()

static int ath79_write_buffer ( struct flash_bank bank,
const uint8_t *  buffer,
uint32_t  address,
uint32_t  len 
)
static

◆ ath79_write_enable()

static int ath79_write_enable ( struct flash_bank bank)
static

◆ ath79_write_page()

static int ath79_write_page ( struct flash_bank bank,
const uint8_t *  buffer,
uint32_t  address,
uint32_t  len 
)
static

◆ erase_command()

static int erase_command ( struct flash_bank bank,
int  sector 
)
static

◆ FLASH_BANK_COMMAND_HANDLER()

FLASH_BANK_COMMAND_HANDLER ( ath79_flash_bank_command  )

◆ get_ath79_info()

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

Definition at line 866 of file ath79.c.

◆ read_flash_id()

static int read_flash_id ( struct flash_bank bank,
uint32_t *  id 
)
static

◆ read_status_reg()

static int read_status_reg ( struct flash_bank bank,
uint32_t *  status 
)
static

◆ wait_till_ready()

static int wait_till_ready ( struct flash_bank bank,
int  timeout 
)
static

Variable Documentation

◆ ath79_chipselects

const uint32_t ath79_chipselects[]
static
Initial value:
= {
}
#define ATH79_SPI_CS2_HI
Definition: ath79.c:63
#define ATH79_SPI_CS1_HI
Definition: ath79.c:62
#define ATH79_SPI_CS_ALLHI
Definition: ath79.c:60
#define ATH79_SPI_CS0_HI
Definition: ath79.c:61

Definition at line 99 of file ath79.c.

Referenced by ath79_spi_bitbang_codegen().

◆ ath79_flash

const struct flash_driver ath79_flash
Initial value:
= {
.name = "ath79",
.flash_bank_command = ath79_flash_bank_command,
.erase = ath79_erase,
.protect = ath79_protect,
.write = ath79_write,
.read = ath79_read,
.probe = ath79_probe,
.auto_probe = ath79_auto_probe,
.erase_check = ath79_flash_blank_check,
.protect_check = ath79_protect_check,
.info = get_ath79_info,
.free_driver_priv = default_flash_free_driver_priv,
}
static int ath79_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Definition: ath79.c:533
static int ath79_probe(struct flash_bank *bank)
Definition: ath79.c:754
static int ath79_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
Definition: ath79.c:489
static int get_ath79_info(struct flash_bank *bank, struct command_invocation *cmd)
Definition: ath79.c:866
static int ath79_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: ath79.c:702
static int ath79_flash_blank_check(struct flash_bank *bank)
Definition: ath79.c:854
static int ath79_protect_check(struct flash_bank *bank)
Definition: ath79.c:860
static int ath79_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Definition: ath79.c:633
static int ath79_auto_probe(struct flash_bank *bank)
Definition: ath79.c:845
void default_flash_free_driver_priv(struct flash_bank *bank)
Deallocates bank->driver_priv.

Definition at line 866 of file ath79.c.

◆ target_devices

const struct ath79_target target_devices[]
static
Initial value:
= {
{ "ATH79", 0x00000001, 0xbf000000 },
{ NULL, 0, 0 }
}
#define NULL
Definition: usb.h:16

Definition at line 1 of file ath79.c.

Referenced by ath79_probe().