| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
SPI FLASH programming algorithm for the DFU Utility
DFU USB programming algorithms

## Detailed Description

Example description
This programming algorithm allows upload and download of data to and from SPI FLASH storage on LPC18xx and LPC43xx devices.

More information on using the DFU Utility can be found at the following links:
DFU Utility information
DFU Utility production programming API

Special connection requirements
There are no special connection requirements for this example.

Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4

Supported boards and board setup:
Although this example includes a build target for only the Keil 1857 board, it should run on all 18xx or 43xx boards.
Keil 1857 evaluation boards

Submitting LPCOpen issues:
Community support for LPCOpen

## Macros
#define | PROGRAM_REGIONS 2
#define | DFU_BUFF_PROG_SIZE 2048

## Functions
int32_t | progalgo_spiflash_erase (uint32_t start, uint32_t size)
int32_t | progalgo_spiflash_erase_all (void)
int32_t | progalgo_spiflash_write (void *buff, uint32_t start, uint32_t size)
int32_t | progalgo_spiflash_read (void *buff, uint32_t start, uint32_t size)
static uint32_t | progalgo_spiflash_chk_alt (uint32_t addr)
static int | progalgo_spiflash_progaddrvalid (uint32_t addr, uint32_t size)
DFUPROG_REGION_T * | algo_flash_init (void)
| Initializes device programming capability.

## Variables
static const PROGALGOS_T | palgos
static DFUPROG_REGZONE_T | pregions [PROGRAM_REGIONS]
static DFUPROG_REGION_T | dfuregion
static SPIFIobj | spiobj
static SPIFIopers | spiopers
static int | SpiGood
static char | tempSTR [128]

## Macro Definition Documentation

#define DFU_BUFF_PROG_SIZE 2048

Definition at line 77 of file dfuutil_programming_spiflash_algorithm.c.

#define PROGRAM_REGIONS 2

Definition at line 74 of file dfuutil_programming_spiflash_algorithm.c.

## Function Documentation

DFUPROG_REGION_T* algo_flash_init | ( | void |  | ) |

Initializes device programming capability.

Returns
  A pointer to the programming info structure Initializes device programming capability. Returns a pointer to the programming buffer, the programming buffer size, and a pointer to the DFU programming region/API structure used by the DFU streamer.

Definition at line 283 of file dfuutil_programming_spiflash_algorithm.c.

static uint32_t progalgo_spiflash_chk_alt | ( | uint32_t | addr | ) |
| static

Definition at line 133 of file dfuutil_programming_spiflash_algorithm.c.

static int32_t progalgo_spiflash_erase | ( | uint32_t | start,
|  | uint32_t | size
| ) |  |

Definition at line 165 of file dfuutil_programming_spiflash_algorithm.c.

static int32_t progalgo_spiflash_erase_all | ( | void |  | ) |

Definition at line 190 of file dfuutil_programming_spiflash_algorithm.c.

static int progalgo_spiflash_progaddrvalid | ( | uint32_t | addr,
|  | uint32_t | size
| ) |  |
| static

Definition at line 144 of file dfuutil_programming_spiflash_algorithm.c.

static int32_t progalgo_spiflash_read | ( | void * | buff,
|  | uint32_t | start,
|  | uint32_t | size
| ) |  |

Definition at line 261 of file dfuutil_programming_spiflash_algorithm.c.

static int32_t progalgo_spiflash_write | ( | void * | buff,
|  | uint32_t | start,
|  | uint32_t | size
| ) |  |

Definition at line 213 of file dfuutil_programming_spiflash_algorithm.c.

## Variable Documentation

DFUPROG_REGION_T dfuregion
| static

Initial value:
= {
PROGRAM_REGIONS,
DFU_BUFF_PROG_SIZE,
&palgos,
pregions,
DFUPROG_VALIDVAL,
"SPIFLASH"
}

Definition at line 105 of file dfuutil_programming_spiflash_algorithm.c.

const PROGALGOS_T palgos
| static

Initial value:
= {
progalgo_spiflash_erase,
progalgo_spiflash_erase_all,
progalgo_spiflash_write,
progalgo_spiflash_read
}

Definition at line 89 of file dfuutil_programming_spiflash_algorithm.c.

DFUPROG_REGZONE_T pregions[PROGRAM_REGIONS]
| static

Initial value:
= {
{0x00000000, 0x00000000},
{0x00000000, 0x00000000}
}

Definition at line 98 of file dfuutil_programming_spiflash_algorithm.c.

int SpiGood
| static

Definition at line 119 of file dfuutil_programming_spiflash_algorithm.c.

SPIFIobj spiobj
| static

Definition at line 115 of file dfuutil_programming_spiflash_algorithm.c.

SPIFIopers spiopers
| static

Definition at line 116 of file dfuutil_programming_spiflash_algorithm.c.

char tempSTR[128]
| static

Definition at line 122 of file dfuutil_programming_spiflash_algorithm.c.