Emulation of LocalFileSystem with virtual COM.
Dependents: KL46Z-lpc81isp lpcterm2
#include "USBLocalFileSystem.h" int main() { USBLocalFileSystem* usb_local = new USBLocalFileSystem(); // RamDisk(64KB) while(1) { usb_local->lock(true); usb_local->remount(); char filename[32]; if (usb_local->find(filename, sizeof(filename), "*.TXT")) { FILE* fp = fopen(filename, "r"); if (fp) { int c; while((c = fgetc(fp)) != EOF) { usb_local->putc(c); } fclose(fp); } } usb_local->lock(false); wait_ms(1000*5); } }
Sample application:
Import programKL46Z-lpc81isp
ISP example program.
Import programlpcterm2
semihost server example program
src/StorageInterface.h@6:528036abfb02, 2014-06-21 (annotated)
- Committer:
- va009039
- Date:
- Sat Jun 21 22:39:59 2014 +0000
- Revision:
- 6:528036abfb02
- Parent:
- 2:97c314eae8b8
add LPC11U68
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:39eb4d5b97df | 1 | #pragma once |
va009039 | 0:39eb4d5b97df | 2 | |
va009039 | 0:39eb4d5b97df | 3 | class StorageInterface { |
va009039 | 0:39eb4d5b97df | 4 | public: |
va009039 | 0:39eb4d5b97df | 5 | StorageInterface() { |
va009039 |
2:97c314eae8b8 | 6 | report_read_count = 0; |
va009039 |
2:97c314eae8b8 | 7 | report_write_count = 0; |
va009039 |
2:97c314eae8b8 | 8 | report_sectors_count = 0; |
va009039 |
2:97c314eae8b8 | 9 | report_size_count = 0; |
va009039 | 0:39eb4d5b97df | 10 | } |
va009039 | 0:39eb4d5b97df | 11 | virtual int storage_read(uint8_t* data, uint32_t block) = 0; |
va009039 | 0:39eb4d5b97df | 12 | virtual int storage_write(const uint8_t* data, uint32_t block) = 0; |
va009039 | 0:39eb4d5b97df | 13 | virtual uint32_t storage_sectors() = 0; |
va009039 | 0:39eb4d5b97df | 14 | virtual uint32_t storage_size() = 0; |
va009039 | 0:39eb4d5b97df | 15 | |
va009039 |
2:97c314eae8b8 | 16 | __IO int report_read_count; |
va009039 |
2:97c314eae8b8 | 17 | __IO int report_write_count; |
va009039 |
2:97c314eae8b8 | 18 | __IO int report_sectors_count; |
va009039 |
2:97c314eae8b8 | 19 | __IO int report_size_count; |
va009039 | 0:39eb4d5b97df | 20 | }; |