LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dfuutil_programming_iflash_algorithm.c File Reference
#include "board.h"
#include "dfuutil_programming_api.h"
#include "stdio.h"
#include "string.h"

Go to the source code of this file.

Data Structures

struct  SECTOR_INFO_T
 

Macros

#define IAP_INIT   49
 
#define IAP_PREP_SECS   50
 
#define IAP_RAM_TO_FLASH   51
 
#define IAP_ERASE_SECS   52
 
#define IAP_BLANK_CHECK_SECS   53
 
#define IAP_READ_PART_ID   54
 
#define IAP_READ_BOOT_CODE_VER   55
 
#define IAP_READ_DEV_SERIAL_NUM   58
 
#define IAP_COMPARE   56
 
#define IAP_REINVOKE_ISP   57
 
#define IAP_ERASE_PAGE   59
 
#define IAP_SET_ACTIVE_FLASH_BANK   60
 
#define IAP_COMMAND_SUCCESS   0x00
 
#define IAP_INVALID_COMMAND   0x01
 
#define IAP_SRC_ADDR_ERROR   0x02
 
#define IAP_DST_ADDR_ERROR   0x03
 
#define IAP_SRC_ADDR_NOT_MAPPED   0x04
 
#define IAP_DST_ADDR_NOT_MAPPED   0x05
 
#define IAP_COUNT_ERROR   0x06
 
#define IAP_INVALID_SECTOR   0x - 7
 
#define IAP_SECTOR_NOT_BLANK   0x08
 
#define IAP_SECTOR_NOT_PREPARED   0x09
 
#define IAP_COMPARE_ERROR   0x0A
 
#define IAP_BUSY   0x0B
 
#define IAP_PARAM_ERROR   0x0C
 
#define IAP_ADDR_ERROR   0x0D
 
#define IAP_ADDR_NOT_MAPPED   0x0E
 
#define IAP_CMD_LOCKED   0x0F
 
#define IAP_INVALID_CODE   0x10
 
#define IAP_INVALID_BAUD_RATE   0x11
 
#define IAP_INVALID_STOP_BIT   0x12
 
#define IAP_CRP_ENABLED   0x13
 
#define IAP_INVALID_FLASH_UNIT   0x14
 
#define IAP_USER_CODE_CHECKSUM   0x15
 
#define IAP_ERROR_SETTING_ACTIVE_PART   0x16
 
#define FLASHMAXSIZE   (512 * 1024)
 
#define CPUCLOCKFRQINKHZ   90000
 
#define PAGE_SIZE   512
 
#define IAP_LOCATION   *((uint32_t *) 0x10400100);
 
#define DFU_BUFF_PROG_SIZE   PAGE_SIZE
 
#define PROGRAM_REGIONS   2
 

Typedefs

typedef void(* IAP )(uint32_t *, uint32_t *)
 

Functions

int32_t progalgo_iflash_erase (uint32_t start, uint32_t size)
 
int32_t progalgo_iflash_erase_all (void)
 
int32_t progalgo_iflash_write (void *buff, uint32_t start, uint32_t size)
 
int32_t progalgo_iflash_read (void *buff, uint32_t start, uint32_t size)
 
static int progalgo_iflash_findbank (uint32_t addr)
 
static int progalgo_iflash_progaddrvalid (uint32_t addr, uint32_t size)
 
static int progalgo_iflash_find_sectorrange (uint32_t addr, uint32_t size, int *bank, uint32_t *secstart, uint32_t *secend, int *aligned)
 
static int progalgo_iflash_prepwrite (uint32_t bank, uint32_t secstart, uint32_t secend)
 
static int progalgo_iflash_erasesectors (uint32_t bank, uint32_t secstart, uint32_t secend)
 
static uint32_t progalgo_iflash_getsize (int bank, uint32_t part_id2)
 
DFUPROG_REGION_Talgo_flash_init (void)
 Initializes device programming capability.
 

Variables

static const SECTOR_INFO_T sectorinfo []
 
static IAP iap_entry
 
static uint32_t command [6]
 
static uint32_t result [5]
 
static const PROGALGOS_T palgos
 
static DFUPROG_REGZONE_T pregions [PROGRAM_REGIONS]
 
static DFUPROG_REGION_T dfuregion
 
static char tempSTR [128]