ISP example program.

Dependencies:   SLCD mbed USBLocalFileSystem

/media/uploads/va009039/lpc81isp-360x240.jpg

FRDM-KL46ZLPC810
UART RXDPTE23p2(P0_4)
UART TXDPTE22p8(P0_0)
nRESETD6p1(P0_5)
nISPD8p5(P0_1)
GNDGNDp7
3.3VP3V3p6

Copy binary image to the disk called LPC81ISP.
Push sw1 or sw3, start write to LPC810 flash.

Committer:
va009039
Date:
Sun Feb 16 12:56:12 2014 +0000
Revision:
1:cccfc461c61f
Parent:
0:ad2b1fc04955
add virtual COM.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:ad2b1fc04955 1 //-----------------------------------------------------------------------
va009039 0:ad2b1fc04955 2 // Low level disk interface modlue include file
va009039 0:ad2b1fc04955 3 //-----------------------------------------------------------------------
va009039 0:ad2b1fc04955 4
va009039 0:ad2b1fc04955 5 #ifndef _DISKIO
va009039 0:ad2b1fc04955 6
va009039 0:ad2b1fc04955 7 #define _READONLY 0 // 1: Remove write functions
va009039 0:ad2b1fc04955 8 #define _USE_IOCTL 1 // 1: Use disk_ioctl fucntion
va009039 0:ad2b1fc04955 9
va009039 0:ad2b1fc04955 10 #include "integer.h"
va009039 0:ad2b1fc04955 11
va009039 0:ad2b1fc04955 12
va009039 0:ad2b1fc04955 13 // Status of Disk Functions
va009039 0:ad2b1fc04955 14 typedef BYTE DSTATUS;
va009039 0:ad2b1fc04955 15
va009039 0:ad2b1fc04955 16 // Results of Disk Functions
va009039 0:ad2b1fc04955 17 typedef enum {
va009039 0:ad2b1fc04955 18 RES_OK = 0, // 0: Successful
va009039 0:ad2b1fc04955 19 RES_ERROR, // 1: R/W Error
va009039 0:ad2b1fc04955 20 RES_WRPRT, // 2: Write Protected
va009039 0:ad2b1fc04955 21 RES_NOTRDY, // 3: Not Ready
va009039 0:ad2b1fc04955 22 RES_PARERR // 4: Invalid Parameter
va009039 0:ad2b1fc04955 23 } DRESULT;
va009039 0:ad2b1fc04955 24
va009039 0:ad2b1fc04955 25
va009039 0:ad2b1fc04955 26 // Prototypes for disk control functions
va009039 0:ad2b1fc04955 27
va009039 0:ad2b1fc04955 28 int assign_drives (int, int);
va009039 0:ad2b1fc04955 29 DSTATUS disk_initialize (BYTE);
va009039 0:ad2b1fc04955 30 DSTATUS disk_status (BYTE);
va009039 0:ad2b1fc04955 31 DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
va009039 0:ad2b1fc04955 32 #if _READONLY == 0
va009039 0:ad2b1fc04955 33 DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
va009039 0:ad2b1fc04955 34 #endif
va009039 0:ad2b1fc04955 35 DRESULT disk_ioctl (BYTE, BYTE, void*);
va009039 0:ad2b1fc04955 36
va009039 0:ad2b1fc04955 37
va009039 0:ad2b1fc04955 38
va009039 0:ad2b1fc04955 39 // Disk Status Bits (DSTATUS)
va009039 0:ad2b1fc04955 40 #define STA_NOINIT 0x01 // Drive not initialized
va009039 0:ad2b1fc04955 41 #define STA_NODISK 0x02 // No medium in the drive
va009039 0:ad2b1fc04955 42 #define STA_PROTECT 0x04 // Write protected
va009039 0:ad2b1fc04955 43
va009039 0:ad2b1fc04955 44
va009039 0:ad2b1fc04955 45 // Command code for disk_ioctrl fucntion
va009039 0:ad2b1fc04955 46
va009039 0:ad2b1fc04955 47 // Generic command (defined for FatFs)
va009039 0:ad2b1fc04955 48 #define CTRL_SYNC 0 // Flush disk cache (for write functions)
va009039 0:ad2b1fc04955 49 #define GET_SECTOR_COUNT 1 // Get media size (for only f_mkfs())
va009039 0:ad2b1fc04955 50 #define GET_SECTOR_SIZE 2 // Get sector size (for multiple sector size (_MAX_SS >= 1024))
va009039 0:ad2b1fc04955 51 #define GET_BLOCK_SIZE 3 // Get erase block size (for only f_mkfs())
va009039 0:ad2b1fc04955 52 #define CTRL_ERASE_SECTOR 4 // Force erased a block of sectors (for only _USE_ERASE)
va009039 0:ad2b1fc04955 53
va009039 0:ad2b1fc04955 54 // Generic command
va009039 0:ad2b1fc04955 55 #define CTRL_POWER 5 // Get/Set power status
va009039 0:ad2b1fc04955 56 #define CTRL_LOCK 6 // Lock/Unlock media removal
va009039 0:ad2b1fc04955 57 #define CTRL_EJECT 7 // Eject media
va009039 0:ad2b1fc04955 58
va009039 0:ad2b1fc04955 59 // MMC/SDC specific ioctl command
va009039 0:ad2b1fc04955 60 #define MMC_GET_TYPE 10 // Get card type
va009039 0:ad2b1fc04955 61 #define MMC_GET_CSD 11 // Get CSD
va009039 0:ad2b1fc04955 62 #define MMC_GET_CID 12 // Get CID
va009039 0:ad2b1fc04955 63 #define MMC_GET_OCR 13 // Get OCR
va009039 0:ad2b1fc04955 64 #define MMC_GET_SDSTAT 14 // Get SD status
va009039 0:ad2b1fc04955 65
va009039 0:ad2b1fc04955 66 // ATA/CF specific ioctl command
va009039 0:ad2b1fc04955 67 #define ATA_GET_REV 20 // Get F/W revision
va009039 0:ad2b1fc04955 68 #define ATA_GET_MODEL 21 // Get model name
va009039 0:ad2b1fc04955 69 #define ATA_GET_SN 22 // Get serial number
va009039 0:ad2b1fc04955 70
va009039 0:ad2b1fc04955 71 // NAND specific ioctl command
va009039 0:ad2b1fc04955 72 #define NAND_FORMAT 30 // Create physical format
va009039 0:ad2b1fc04955 73
va009039 0:ad2b1fc04955 74
va009039 0:ad2b1fc04955 75 #define _DISKIO
va009039 0:ad2b1fc04955 76 #endif