![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
USB composite device example program, drag-and-drop flash writer.
Dependencies: SWD USBDevice mbed BaseDAP
Diff: RomDisk.cpp
- Revision:
- 1:ea8e179320d7
- Parent:
- 0:2385683c867a
--- a/RomDisk.cpp Tue Sep 17 04:33:44 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -// RomDisk.cpp 2013/9/17 -#include "mbed.h" -#include "RomDisk.h" - -RomDisk::RomDisk() -{ - _sectors = 128; // 64KB(512*128) -} - -int RomDisk::read(uint8_t * data, uint32_t block) -{ - SectorIndex* p = const_cast<SectorIndex*>(sector_index); - while(p->data) { - if (p->block == block) { - memcpy(data, p->data, 512); - return 0; - } - p++; - } - memset(data, 0x00, 512); - return 0; -} - -int RomDisk::write(const uint8_t * data, uint32_t block) -{ - return 0; -} - -uint32_t RomDisk::sectors() -{ - return _sectors; -} - -bool RomDisk::is_data(uint32_t block) -{ - return block >= 40; -}