PKP
VS1000 P
ROGRAMMER
’
S
G
UIDE
VSMPG
The above method is most convenient for preprogrammed storage devices. If you need
write access to your own storage device, you need to write control code for it yourself,
e.g. for downloading a disk image over a serial port.
7.4.1
ReadDiskSector is for reading only
As the name suggests, the ReadDiskSector() hook is meant only for reading data. This
limits its usage to the “player” mode only (when the VS1000 is in player mode, it does
not write to the logical disk).
If you want to attach your own device to the USB bus as a mass storage device, you
need to write a mapper interface that has functions for reading and erasing 512-
byte sectors. Then you need to write a function that publishes the interface with name
map
, initializes the USB handler (probably by calling
InitUSB(USB_MASS_STORAGE)
) and
then calls
UsbHandler()
in a busy loop until the USB is detached.
The complete example code is below. It uses 253 words of program RAM out of the
1968 words available for plugins.
Rev. 0.20
2011-10-04
Page