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 /* mbed Microcontroller Library
va009039 0:ad2b1fc04955 2 * Copyright (c) 2006-2012 ARM Limited
va009039 0:ad2b1fc04955 3 *
va009039 0:ad2b1fc04955 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
va009039 0:ad2b1fc04955 5 * of this software and associated documentation files (the "Software"), to deal
va009039 0:ad2b1fc04955 6 * in the Software without restriction, including without limitation the rights
va009039 0:ad2b1fc04955 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
va009039 0:ad2b1fc04955 8 * copies of the Software, and to permit persons to whom the Software is
va009039 0:ad2b1fc04955 9 * furnished to do so, subject to the following conditions:
va009039 0:ad2b1fc04955 10 *
va009039 0:ad2b1fc04955 11 * The above copyright notice and this permission notice shall be included in
va009039 0:ad2b1fc04955 12 * all copies or substantial portions of the Software.
va009039 0:ad2b1fc04955 13 *
va009039 0:ad2b1fc04955 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
va009039 0:ad2b1fc04955 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
va009039 0:ad2b1fc04955 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
va009039 0:ad2b1fc04955 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
va009039 0:ad2b1fc04955 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
va009039 0:ad2b1fc04955 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
va009039 0:ad2b1fc04955 20 * SOFTWARE.
va009039 0:ad2b1fc04955 21 */
va009039 0:ad2b1fc04955 22 #include <string.h>
va009039 0:ad2b1fc04955 23 #include "ff.h"
va009039 0:ad2b1fc04955 24 #include "FATDirHandle.h"
va009039 0:ad2b1fc04955 25
va009039 0:ad2b1fc04955 26 using namespace mbed;
va009039 0:ad2b1fc04955 27
va009039 0:ad2b1fc04955 28 FATDirHandle::FATDirHandle(const FATFS_DIR &the_dir) {
va009039 0:ad2b1fc04955 29 dir = the_dir;
va009039 0:ad2b1fc04955 30 }
va009039 0:ad2b1fc04955 31
va009039 0:ad2b1fc04955 32 int FATDirHandle::closedir() {
va009039 0:ad2b1fc04955 33 delete this;
va009039 0:ad2b1fc04955 34 return 0;
va009039 0:ad2b1fc04955 35 }
va009039 0:ad2b1fc04955 36 FILINFO FATDirHandle_finfo;
va009039 0:ad2b1fc04955 37
va009039 0:ad2b1fc04955 38 struct dirent *FATDirHandle::readdir() {
va009039 0:ad2b1fc04955 39 FILINFO finfo;
va009039 0:ad2b1fc04955 40
va009039 0:ad2b1fc04955 41 #if _USE_LFN
va009039 0:ad2b1fc04955 42 finfo.lfname = cur_entry.d_name;
va009039 0:ad2b1fc04955 43 finfo.lfsize = sizeof(cur_entry.d_name);
va009039 0:ad2b1fc04955 44 #endif // _USE_LFN
va009039 0:ad2b1fc04955 45
va009039 0:ad2b1fc04955 46 FRESULT res = f_readdir(&dir, &finfo);
va009039 0:ad2b1fc04955 47 FATDirHandle_finfo = finfo;
va009039 0:ad2b1fc04955 48
va009039 0:ad2b1fc04955 49 #if _USE_LFN
va009039 0:ad2b1fc04955 50 if(res != 0 || finfo.fname[0]==0) {
va009039 0:ad2b1fc04955 51 return NULL;
va009039 0:ad2b1fc04955 52 } else {
va009039 0:ad2b1fc04955 53 if(cur_entry.d_name[0]==0) {
va009039 0:ad2b1fc04955 54 // No long filename so use short filename.
va009039 0:ad2b1fc04955 55 memcpy(cur_entry.d_name, finfo.fname, sizeof(finfo.fname));
va009039 0:ad2b1fc04955 56 }
va009039 0:ad2b1fc04955 57 return &cur_entry;
va009039 0:ad2b1fc04955 58 }
va009039 0:ad2b1fc04955 59 #else
va009039 0:ad2b1fc04955 60 if(res != 0 || finfo.fname[0]==0) {
va009039 0:ad2b1fc04955 61 return NULL;
va009039 0:ad2b1fc04955 62 } else {
va009039 0:ad2b1fc04955 63 memcpy(cur_entry.d_name, finfo.fname, sizeof(finfo.fname));
va009039 0:ad2b1fc04955 64 return &cur_entry;
va009039 0:ad2b1fc04955 65 }
va009039 0:ad2b1fc04955 66 #endif /* _USE_LFN */
va009039 0:ad2b1fc04955 67 }
va009039 0:ad2b1fc04955 68
va009039 0:ad2b1fc04955 69 void FATDirHandle::rewinddir() {
va009039 0:ad2b1fc04955 70 dir.index = 0;
va009039 0:ad2b1fc04955 71 }
va009039 0:ad2b1fc04955 72
va009039 0:ad2b1fc04955 73 off_t FATDirHandle::telldir() {
va009039 0:ad2b1fc04955 74 return dir.index;
va009039 0:ad2b1fc04955 75 }
va009039 0:ad2b1fc04955 76
va009039 0:ad2b1fc04955 77 void FATDirHandle::seekdir(off_t location) {
va009039 0:ad2b1fc04955 78 dir.index = location;
va009039 0:ad2b1fc04955 79 }
va009039 0:ad2b1fc04955 80