aboutsummaryrefslogtreecommitdiff
path: root/bootloaders
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2011-09-08 09:12:30 -0400
committerZach Eveland <zeveland@blacklabel-development.com>2011-09-08 09:12:30 -0400
commit384f8e80fa55b1a704674a4ee19192328ec90abe (patch)
tree1a1d22f7df6f746e9700cee9ef97c66ee10d75b0 /bootloaders
parentd81084e8e91ec4abc24e4b3f6a9ecb9621a6c736 (diff)
removed all bootloader mass storage and MSC references
Diffstat (limited to 'bootloaders')
-rw-r--r--bootloaders/diskloader/DiskLoader.hex192
-rw-r--r--bootloaders/diskloader/src/DiskLoader.cpp12
-rw-r--r--bootloaders/diskloader/src/Platform.h10
-rw-r--r--bootloaders/diskloader/src/SCSI.cpp213
-rw-r--r--bootloaders/diskloader/src/ThinFAT.cpp130
-rw-r--r--bootloaders/diskloader/src/USBCore.cpp29
-rw-r--r--bootloaders/diskloader/src/USBCore.h15
-rw-r--r--bootloaders/diskloader/src/USBDesc.cpp21
-rw-r--r--bootloaders/diskloader/src/USBDesc.h30
9 files changed, 103 insertions, 549 deletions
diff --git a/bootloaders/diskloader/DiskLoader.hex b/bootloaders/diskloader/DiskLoader.hex
index ced02bd..ae27666 100644
--- a/bootloaders/diskloader/DiskLoader.hex
+++ b/bootloaders/diskloader/DiskLoader.hex
@@ -1,102 +1,100 @@
-:1078000011241FBECFEFDAE0DEBFCDBFD0C04101F3
+:1078000011241FBECFEFDAE0DEBFCDBFC3C0410100
:1078100042144505560455026403740300001E9586
:1078200087020110030000C18081C106C0FF0A0069
:107830000CA10185037508150026FF00954009017C
-:107840008102954009029102C0040309041A033021
-:1078500000300030003000300030003000300031A7
-:1078600000370030003100120100020200004041E8
-:1078700023200000010000010112010002000000AD
-:1078800040412320000001000001010902640003BF
-:1078900001008032080B000202020100090400000E
-:1078A0000102020000052400100105240101010469
-:1078B0002402020524060001070581031000400987
-:1078C000040100020A000000070502024000000750
-:1078D00005830240000009040200010300000009C2
-:1078E0002101010001221E00070584034000400021
-:1078F00020918A0130918B012F5F3F4F30938B0194
-:1079000020938A01832F9927982F87FD9095990FAF
-:10791000921710F447980895479A089581E080934C
-:10792000E0001092E200EE27FF27099408950F93DC
-:107930001F93CF93DF93982FEB01042F10E088E77C
-:107940006030780730F411E083E0FB01809357004A
-:10795000E895892F68E071E0402FE2D0112311F102
-:1079600007B600FCFDCF402F4695FE01A8E0B1E030
-:1079700020E031E009C08D919D910C0130935700BA
-:10798000E895112432962F5F2417A8F385E0FE01B5
-:1079900080935700E89507B600FCFDCF81E1809306
-:1079A0005700E895DF91CF911F910F910895769A36
-:1079B000289A47983F9A209A6E9A90E8909361008F
-:1079C0001092610081E885BF95BF91D084E18093DA
-:1079D000880180E180938901E0E0F0E08591949155
-:1079E0008F5F9F4F19F081E080938D01EE24FF247B
-:1079F000BB24B39421E0C22ED12CE1D1082F8EE01C
-:107A000098E7FC012491319602964491201711F0D9
-:107A10002223B9F710928F0110928E0182E068E064
-:107A200071E07ED0013479F46091080160586330D0
-:107A300028F0683111F064E001C063E0C62FD0E0A7
-:107A4000CF5DD7480EC0063571F4809108018033B0
-:107A500011F011E022C080910A01C82FD0E0C25E6F
-:107A6000D74811E022C0053721F413E0CEE1D8E772
-:107A70001CC0053539F4E0900801F0900901EE0CC6
-:107A8000FF1C0AC0043631F482E0B70140910901BD
-:107A90004EDF02C0043721F010E0C5E2D8E705C090
-:107AA00010910901E701E10EF11C89D18097B1F431
-:107AB00083E068E871E041E050E049D0112329F00B
-:107AC000412F50E083E8BE0142D083E469E871E0D1
-:107AD00041E050E03CD0013509F08FCFD0928F01CA
-:107AE000C0928E01B0928D01EE24FF2486CF1092B9
-:107AF0008F0110928E0110928C0110928D0181E005
-:107B00008093D70080EA8093D80082E189BD09B4D0
-:107B100000FEFDCF80E98093D8001092E000089528
-:107B2000FB018093E9009BE60FC08091E80085FF90
-:107B3000FCCF28988091F10081938091E80085FD29
-:107B400002C09093E8004150442379F70895982F9C
-:107B5000FB01282F207287708093E9003AE315C05B
-:107B60008091E80085FFFCCF97FF02C0849101C09F
-:107B700080813196211180E076988093F100809188
-:107B8000E80085FD02C03093E800415050408FEF7F
-:107B90004F3F580729F796FF03C08AE38093E80018
-:107BA000089580919101813281F4769820E030E04F
-:107BB00003C080818093F100F901E050FF4F2F5FF7
-:107BC0003F4F28303105A9F71FC08032B9F48091AA
-:107BD000E80082FFFCCF289820E030E003C08091CD
-:107BE000F1008083F901E050FF4F2F5F3F4F2830B5
-:107BF0003105A9F78BEF8093E80006C0823221F4AB
-:107C0000809192018093070181E008952091930172
-:107C1000223231F1213081F48091960190919701C7
-:107C2000089711F42093980180919801882309F016
-:107C30003BC0E9E7F8E73AC0223021F484E6EBE8FC
-:107C4000F8E711C0233071F580919201882319F46F
-:107C5000E9E4F8E72BC0813029F5EDE4F8E726C028
-:107C600081E0EBE2F8E790919601282F981708F44D
-:107C7000292F90E03EEF8091E8008570E1F380913C
-:107C8000E80082FD0FC09F5F849176988093F10099
-:107C9000892F8F7311F43093E8003196921758F3BF
-:107CA00081E0089580E00895E7E6F8E78491DBCF6E
-:107CB0001092E9008091E80083FF62C02898E0E913
-:107CC000F1E003C08091F100819381E0E839F80789
-:107CD000C9F782EF8093E8008091900187FF05C08B
-:107CE0008091E80080FFFCCF03C08EEF8093E80016
-:107CF00080919101853051F48091E80080FFFCCFA4
-:107D00008091920180688093E30033C08930E1F470
-:107D10008091920180938C01E7E2F8E791E031E0F5
-:107D200026E39093E9003093EB0084918093EC007C
-:107D30002093ED009F5F3196953099F78EE7809301
-:107D4000EA001092EA0015C0883031F480918C016D
-:107D500076988093F1000DC0882321F476981092D4
-:107D6000F10007C0863011F451DF01C01ADF88230B
-:107D700021F08EEF8093E800089581E28093EB007C
-:107D800008958091E1001092E100282F83FF0CC03C
-:107D90001092E90081E08093EB001092EC0082E306
-:107DA0008093ED0010928C0122FF08C080918D011C
-:107DB000882321F410928F0110928E0108951F9351
-:107DC00012E076DFDEDF1093E9008091E80085FFA6
-:107DD0000EC028989091F1008091E80085FD03C0C5
-:107DE0008BE68093E800892F90E01F91089584E648
-:107DF00000000000000000008150D1F7289A769A18
-:107E000080918E0190918F01019790938F018093C3
-:107E10008E0180918E0190918F01892B19F4769AB1
-:087E2000289A7CDD65DDCDCF61
-:087E280000E100000000000071
+:107840008102954009029102C0040309041201005B
+:10785000020200004041232000000100000101124B
+:10786000010002000000404123200000010000014F
+:1078700001090264000301008032080B00020202C9
+:1078800001000904000001020200000524001001AB
+:107890000524010101042402020524060001070554
+:1078A000810310004009040100020A0000000705DE
+:1078B00002024000000705830240000009040200A4
+:1078C0000103000000092101010001221E0007053B
+:1078D00084034000400020918A0130918B012F5F8A
+:1078E0003F4F30938B0120938A01832F9927982F44
+:1078F00087FD9095990F921710F447980895479A2D
+:10790000089581E08093E0001092E200EE27FF27C7
+:10791000099408950F931F93CF93DF93982FEB0152
+:10792000042F10E088E76030780730F411E083E03E
+:10793000FB0180935700E895892F68E071E0402FA4
+:10794000E2D0112311F107B600FCFDCF402F469580
+:10795000FE01A8E0B1E020E031E009C08D919D91E9
+:107960000C0130935700E895112432962F5F2417AD
+:10797000A8F385E0FE0180935700E89507B600FC68
+:10798000FDCF81E180935700E895DF91CF911F9162
+:107990000F910895769A289A47983F9A209A6E9A5E
+:1079A00090E8909361001092610081E885BF95BFD7
+:1079B00091D084E18093880180E180938901E0E0A7
+:1079C000F0E0859194918F5F9F4F19F081E0809353
+:1079D0008D01EE24FF24BB24B39421E0C22ED12CD0
+:1079E000DBD1082F8EE098E7FC01249131960296B6
+:1079F0004491201711F02223B9F710928F011092B1
+:107A00008E0182E068E071E07ED0013479F460910B
+:107A100008016058633028F0683111F064E001C05B
+:107A200063E0C62FD0E0CF5DD7480EC0063571F4B5
+:107A300080910801803311F011E022C080910A0189
+:107A4000C82FD0E0C25ED74811E022C0053721F42C
+:107A500013E0CEE1D8E71CC0053539F4E090080109
+:107A6000F0900901EE0CFF1C0AC0043631F482E0EC
+:107A7000B701409109014EDF02C0043721F010E048
+:107A8000C5E2D8E705C010910901E701E10EF11C3C
+:107A900083D18097B1F483E068E871E041E050E081
+:107AA00049D0112329F0412F50E083E8BE0142D094
+:107AB00083E469E871E041E050E03CD0013509F031
+:107AC0008FCFD0928F01C0928E01B0928D01EE24A3
+:107AD000FF2486CF10928F0110928E0110928C019C
+:107AE00010928D0181E08093D70080EA8093D800C6
+:107AF00082E189BD09B400FEFDCF80E98093D80002
+:107B00001092E0000895FB018093E9009BE60FC00E
+:107B10008091E80085FFFCCF28988091F100819347
+:107B20008091E80085FD02C09093E8004150442315
+:107B300079F70895982FFB01282F20728770809382
+:107B4000E9003AE315C08091E80085FFFCCF97FF7C
+:107B500002C0849101C080813196211180E0769825
+:107B60008093F1008091E80085FD02C03093E80029
+:107B7000415050408FEF4F3F580729F796FF03C001
+:107B80008AE38093E800089580919101813281F425
+:107B9000769820E030E003C080818093F100F90105
+:107BA000E050FF4F2F5F3F4F28303105A9F71FC02E
+:107BB0008032B9F48091E80082FFFCCF289820E061
+:107BC00030E003C08091F1008083F901E050FF4F65
+:107BD0002F5F3F4F28303105A9F78BEF8093E800E6
+:107BE00006C0823221F4809192018093070181E0E6
+:107BF000089520919301223201F1213079F480918E
+:107C0000960190919701089711F420939801809123
+:107C100098018823B1F5EFE5F8E735C0223021F46B
+:107C200084E6E1E7F8E70CC0233049F58091920142
+:107C3000882329F5E9E4F8E726C081E0EBE2F8E7DC
+:107C400090919601282F981708F4292F90E03EEF85
+:107C50008091E8008570E1F38091E80082FD0FC01B
+:107C60009F5F849176988093F100892F8F7311F430
+:107C70003093E8003196921758F381E0089580E040
+:107C80000895EDE4F8E78491DBCF1092E90080914C
+:107C9000E80083FF62C02898E0E9F1E003C080912A
+:107CA000F100819381E0E839F807C9F782EF80930A
+:107CB000E8008091900187FF05C08091E80080FF77
+:107CC000FCCF03C08EEF8093E80080919101853056
+:107CD00051F48091E80080FFFCCF80919201806890
+:107CE0008093E30033C08930E1F480919201809366
+:107CF0008C01E7E2F8E791E031E026E39093E900B8
+:107D00003093EB0084918093EC002093ED009F5F13
+:107D10003196953099F78EE78093EA001092EA0049
+:107D200015C0883031F480918C0176988093F100F1
+:107D30000DC0882321F476981092F10007C0863098
+:107D400011F457DF01C020DF882321F08EEF8093EC
+:107D5000E800089581E28093EB0008958091E100AE
+:107D60001092E100282F83FF0CC01092E90081E0FF
+:107D70008093EB001092EC0082E38093ED00109270
+:107D80008C0122FF08C080918D01882321F410927C
+:107D90008F0110928E0108951F9312E076DFDEDFCF
+:107DA0001093E9008091E80085FF0EC0289890911B
+:107DB000F1008091E80085FD03C08BE68093E80028
+:107DC000892F90E01F91089584E6000000000000D4
+:107DD00000008150D1F7289A769A80918E01909177
+:107DE0008F01019790938F0180938E0180918E0176
+:107DF00090918F01892B19F4769A289A82DD6BDD98
+:027E0000CDCFE4
+:087E020000E100000000000097
:040000030000780081
:00000001FF
diff --git a/bootloaders/diskloader/src/DiskLoader.cpp b/bootloaders/diskloader/src/DiskLoader.cpp
index 9ecbc4b..34a9c94 100644
--- a/bootloaders/diskloader/src/DiskLoader.cpp
+++ b/bootloaders/diskloader/src/DiskLoader.cpp
@@ -112,8 +112,6 @@ const u8 _consts[] =
void USBInit(void);
-extern u8 _sector3[512];
-
int main(void) __attribute__ ((naked));
// STK500v1 main loop, very similar to optiboot in protocol and implementation
@@ -125,16 +123,12 @@ int main()
BOARD_INIT();
USBInit();
-#ifdef WRITABLE_DIRECTORY
- _sector3[0] = 0;
-#endif
-
_inSync = STK_INSYNC;
_ok = STK_OK;
-#ifndef MSC_ENABLED
+
if (pgm_read_word(0) != -1)
_ejected = 1;
-#endif
+
for(;;)
{
u8* packet = _flashbuf;
@@ -153,9 +147,7 @@ int main()
if (c == cmd || c == 0)
break;
}
-#ifndef MSC_ENABLED
_timeout = 0;
-#endif
// Read params
Recv(CDC_RX,packet,len);
diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h
index 004933e..416d9c3 100644
--- a/bootloaders/diskloader/src/Platform.h
+++ b/bootloaders/diskloader/src/Platform.h
@@ -14,14 +14,6 @@ typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned long u32;
-//#define MICROTOUCH
-
-//#define WRITABLE_DIRECTORY // undef saved 56 + 512 RAM
-
-#define FAT_DISK_LABEL 'b','o','o','t','l','o','a','d','e','r',' ' // 11 chars (undef saves 12)
-#define FAT_FILE_NAME 'F','I','R','M','W','A','R','E','B','I','N' // 11 chars
-#define MSC_DISK_SERIAL '0','0','0','0','0','0','0','0','1','7','0','1' // 12 chars
-
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define DISABLE_JTAG() MCUCR = (1 << JTD) | (1 << IVCE) | (0 << PUD); MCUCR = (1 << JTD) | (0 << IVSEL) | (0 << IVCE) | (0 << PUD);
@@ -47,8 +39,6 @@ void Recv(u8 ep, u8* dst, u8 len);
void Program(u8 ep, u16 page, u8 count);
#define CDC_ENABLED
-//#define MSC_ENABLED
-//#define MSC_NO_MEDIA // MSC is enabled but not media inserted
#include "USBCore.h"
#include "USBDesc.h"
diff --git a/bootloaders/diskloader/src/SCSI.cpp b/bootloaders/diskloader/src/SCSI.cpp
deleted file mode 100644
index dbbf9cf..0000000
--- a/bootloaders/diskloader/src/SCSI.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-/* Copyright (c) 2010, Peter Barrett
-**
-** Permission to use, copy, modify, and/or distribute this software for
-** any purpose with or without fee is hereby granted, provided that the
-** above copyright notice and this permission notice appear in all copies.
-**
-** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
-** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-** SOFTWARE.
-*/
-
-#include "Platform.h"
-
-#ifdef MSC_ENABLED
-
-// SCSI Commands
-#define TEST_UNIT_READY 0x00
-#define REQUEST_SENSE 0x03
-#define FORMAT_UNIT 0x04
-#define INQUIRY 0x12
-#define MODE_SENSE 0x1A
-#define START_STOP_UNIT 0x1B
-#define MEDIA_REMOVAL 0x1E
-#define READ_FORMAT_CAPACITIES 0x23
-#define READ_CAPACITY 0x25
-#define READ10 0x28
-#define WRITE10 0x2A
-#define VERIFY10 0x2F
-
-
-// In FakeFAT
-void SendSector(u8 b);
-void RecvSector(u8 b);
-
-// In USBCore
-u8 RecvPacket(u8 ep, u8* dst, u8 len);
-u8 SendPacket(u8 ep, const u8* src, u8 len);
-void Reboot();
-
-#define MSC_TX MSC_ENDPOINT_IN
-#define MSC_RX MSC_ENDPOINT_OUT
-
-extern const u8 P_Inquiry[36] PROGMEM;
-extern const u8 P_RequestSense[18] PROGMEM;
-extern const u8 P_ReadCapacity[8-3] PROGMEM;
-extern const u8 P_ModeSense[4] PROGMEM;
-
-typedef struct
-{
- u8 signature[4];
- u8 tag[4];
- u32 transferLength;
- u8 flags;
- u8 lun;
- u8 cblength;
- u8 cb[16];
-} CBW;
-
-const u8 P_Inquiry[36] =
-{
- 0x00, // Direct Access Device
- 0x80, // Removable Medium
- 0x00, // Version
- 0x01,
-
- 36-4, // Additional Length
- 0x80, // Storage Controller Component
- 0x00,
- 0x00,
-
- 'r','o','s','s','u','m','u','r', // Vendor
-
- 'm','i','c','r','o','t','o','u', // Product
- 'c','h',' ',' ',' ',' ',' ',' ',
-
- '2','.','4',' ' // Revision
-};
-
-const u8 P_RequestSense[18] =
-{
- 0x70, // Response Code
- 0x00,
-// 0x02, // Sense Key
- 0x00,
- 0x00,
-
- 0x00,
- 0x00,
- 0x00,
- 0x0A, // Additional Length
-
- 0x00,
- 0x00,
- 0x00,
- 0x00,
-
- 0x30, // ASC
- 0x01, // ASCQ
-
- 0x00,
- 0x00,
- 0x00,
- 0x00
-};
-
-// Save 3 bytes if merging
-const u8 P_ReadCapacity[8-3] =
-{
-// 0x00,
-// 0x00,
-// 0x00, // Steal 3 zero bytes from end of P_RequestSense
- 64+4, // block count 64 + 4
- 0x00,
- 0x00,
- 0x02, // block size = 512
- 0x00
-};
-
-const u8 P_ModeSense[4] =
-{
- 0x03,
- 0x00,
- 0x00,
- 0x00
-};
-
-extern volatile u8 _ejected;
-
-void SCSI(CBW& cbw)
-{
- const u8* pgm = 0;
- u8 status = 0;
- u8 blen = 0;
-
- u8 cmd = cbw.cb[0];
- if (START_STOP_UNIT == cmd)
- {
- _ejected = 1; // Stopped; going away
- }
- else if (TEST_UNIT_READY == cmd || MEDIA_REMOVAL == cmd)
- {
-#ifdef MSC_NO_MEDIA
- status = 1;
-#else
- status = _ejected;
-#endif
- }
- else if (REQUEST_SENSE == cmd)
- {
- pgm = P_RequestSense;
- blen = sizeof(P_RequestSense);
- }
- else if (INQUIRY == cmd)
- {
- pgm = P_Inquiry;
- blen = sizeof(P_Inquiry);
- }
- else if (WRITE10 == cmd || READ10 == cmd)
- {
- // Write 10 byte form
- // Read 10 byte form
- {
- u8 lba = cbw.cb[5];
- u8 count = cbw.cb[8];
- u8 read = READ10 == cbw.cb[0];
- while (count--)
- {
- if (read)
- SendSector(lba);
- else
- RecvSector(lba);
- lba++;
- cbw.transferLength -= 512; // 24 bytes
- }
- }
- }
- else if (MODE_SENSE == cmd)
- {
- pgm = P_ModeSense;
- blen = 4;
- }
- else
- {
- pgm = P_ReadCapacity-3;
- blen = 8;
- if (READ_CAPACITY != cmd)
- status = 1; // Faking a data phase for unknown commands
- }
-
- if (pgm)
- Transfer(MSC_TX | TRANSFER_PGM | TRANSFER_RELEASE,pgm,blen);
-
- cbw.flags = status;
- cbw.transferLength -= blen;
- cbw.signature[3] = 'S';
- Transfer(MSC_TX | TRANSFER_RELEASE,(u8*)&cbw,13);
-}
-
-CBW cbw; // 38 byte savings by making this global
-void SCSITask()
-{
- Recv(MSC_RX,(u8*)&cbw,sizeof(CBW));
- SCSI(cbw);
-}
-
-#endif \ No newline at end of file
diff --git a/bootloaders/diskloader/src/ThinFAT.cpp b/bootloaders/diskloader/src/ThinFAT.cpp
deleted file mode 100644
index c238741..0000000
--- a/bootloaders/diskloader/src/ThinFAT.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-/* Copyright (c) 2011, Peter Barrett
-**
-** Permission to use, copy, modify, and/or distribute this software for
-** any purpose with or without fee is hereby granted, provided that the
-** above copyright notice and this permission notice appear in all copies.
-**
-** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
-** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-** SOFTWARE.
-*/
-
-#include "Platform.h"
-
-#ifdef MSC_ENABLED
-
-extern const u8 Sector_0[] PROGMEM;
-extern const u8 Sector_1[] PROGMEM;
-extern const u8 Sector_2[] PROGMEM;
-extern const u8 Sector_3[] PROGMEM;
-extern const u8 Sector_Size[] PROGMEM;
-
-
-const u8 Sector_0[27] =
-{
- 0xEB,0x3C,0x90,
- FAT_OEM_NAME,
- 0x00,0x02, // Bytes per sector 512
- 0x40, // Sectors per Cluster 32k per cluster
- 0x01,0x00, // Reserved sectors
- 0x02, // FATSs
- 0x10,0x00, // root entries
- 4+64,0x00, // number of sectors: 30k file
- 0xF8, // Media type fixed
- 0x01,0x00, // Sectors per FAT
- 0x01,0x00, // Sectors per head
- 0x01,//0x00, // Heads per cylinder
- //0x00,0x00,0x00,0x00, // Hidden
- //0x00,0x00,0x00,0x00, // long number of sectors
- //0x00,0x00, // Ext flags
- // 38 bytes
-};
-
-// FAT12 clusters for 32k file
-const u8 Sector_1[] =
-{
-#if 0
- 0xF8,0xFF,0xFF,
- 0xFF,0x0F//,0x00
-#endif
-};
-
-const u8 Sector_2[] =
-{
-};
-
-const u8 Sector_3[] =
-{
-#if 0
- FAT_FILE_NAME, 0x00,0x00,0x00,0x00,0x00, // Uppercase name please
- 0x43,0x3E,0x43,0x3E,0x00,0x00,0xAB,0x8C,0x40,0x3E,0x02,0x00,0x00,0x80,//0x00,0x00
- // 0x00,0x00,
-#endif
-
-#ifdef FAT_DISK_LABEL
- FAT_DISK_LABEL,0x28
-#endif
-};
-
-#if 0
-const u8 Sector_Size[] =
-{
- 0,
- sizeof(Sector_0),
- sizeof(Sector_0) + sizeof(Sector_1),
- sizeof(Sector_0) + sizeof(Sector_1) + sizeof(Sector_2),
- sizeof(Sector_0) + sizeof(Sector_1) + sizeof(Sector_2) + sizeof(Sector_3)
-};
-#endif
-
-const u8* LBAToROM(u8 b)
-{
- b -= 4;
- return (const u8*)(b << 9);
-}
-
-void SendSector(u8 b)
-{
- if (b == 0)
- {
- u8 n = sizeof(Sector_0);
- Transfer(MSC_TX | TRANSFER_PGM,Sector_0,n);
- Transfer(MSC_TX | TRANSFER_ZERO,0,512-n);
- return;
- }
-
- if ((b < 4) || (b >= 64))
- {
- Transfer(MSC_TX | TRANSFER_ZERO,0,512);
- return;
- }
-
- // Copy body of file from ROM
- Transfer(MSC_TX | TRANSFER_PGM,LBAToROM(b),512);
-}
-
-#define GENERATE_INVALID_ROM_ADDRESS 60
-
-void RecvSector(u8 lba)
-{
- if ((lba < 4) || (lba >= 64))
- lba = GENERATE_INVALID_ROM_ADDRESS; // Only care about the first 30k
-
- // Write sectors to flash
- u16 addr = (u16)LBAToROM(lba); // may generate out of range addresses, Program will fix
- u8 i = 4; // 4x128 is a sector
- while (i--)
- {
- Program(MSC_RX,addr,128);
- addr += 128;
- }
-}
-
-#endif \ No newline at end of file
diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp
index 8b071a1..142fc79 100644
--- a/bootloaders/diskloader/src/USBCore.cpp
+++ b/bootloaders/diskloader/src/USBCore.cpp
@@ -18,8 +18,6 @@
#include "Platform.h"
-#define MSC_TX MSC_ENDPOINT_IN
-#define MSC_RX MSC_ENDPOINT_OUT
#define CDC_TX CDC_ENDPOINT_IN
#define CDC_RX CDC_ENDPOINT_OUT
@@ -255,11 +253,6 @@ const u8 _initEndpoints[] =
#endif
EP_TYPE_INTERRUPT_IN, // HID_ENDPOINT_INT
-
-#ifdef MSC_ENABLED
- EP_TYPE_BULK_OUT, // MSC_ENDPOINT_OUT
- EP_TYPE_BULK_IN // MSC_ENDPOINT_IN
-#endif
};
static void InitEndpoints()
@@ -310,19 +303,6 @@ bool USBHook()
_usbLineInfo.lineState = setup.wValueL;
}
-#ifdef MSC_ENABLED
- // MSC Requests
- else if (MSC_GET_MAX_LUN == r)
- {
- Send8(0);
- }
- else if (MSC_RESET == r)
- {
- // MSC_Reset();
- } else
- return false; // unhandled
-#endif
-
return true;
}
@@ -385,8 +365,6 @@ bool SendDescriptor()
{
if (setup.wValueL == 0)
desc_addr = (const u8*)&STRING_LANGUAGE;
- else if (setup.wValueL == ISERIAL)
- desc_addr = (const u8*)&STRING_SERIAL;
else
return false;
} else
@@ -484,8 +462,6 @@ void USBGeneralInterrupt()
}
}
-void SCSITask();
-
void LEDPulse();
int USBGetChar()
{
@@ -494,11 +470,6 @@ int USBGetChar()
USBSetupInterrupt();
USBGeneralInterrupt();
-#ifdef MSC_ENABLED
- // Service disk
- if (HasData(MSC_RX))
- SCSITask();
-#endif
// Read a char
if (HasData(CDC_RX))
{
diff --git a/bootloaders/diskloader/src/USBCore.h b/bootloaders/diskloader/src/USBCore.h
index a37b9f2..537c0ec 100644
--- a/bootloaders/diskloader/src/USBCore.h
+++ b/bootloaders/diskloader/src/USBCore.h
@@ -43,10 +43,6 @@
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
-#define MSC_RESET 0xFF
-#define MSC_GET_MAX_LUN 0xFE
-
-
// Descriptors
#define USB_DEVICE_DESC_SIZE 18
@@ -98,10 +94,6 @@
#define CDC_CS_ENDPOINT 0x25
#define CDC_DATA_INTERFACE_CLASS 0x0A
-#define MSC_SUBCLASS_SCSI 0x06
-#define MSC_PROTOCOL_BULK_ONLY 0x50
-
-
// Device
typedef struct {
@@ -210,13 +202,6 @@ typedef struct
EndpointDescriptor out;
} CDCDescriptor;
-typedef struct
-{
- InterfaceDescriptor msc;
- EndpointDescriptor in;
- EndpointDescriptor out;
-} MSCDescriptor;
-
typedef struct
{
u8 len; // 9
diff --git a/bootloaders/diskloader/src/USBDesc.cpp b/bootloaders/diskloader/src/USBDesc.cpp
index dfde01d..ec7cf7d 100644
--- a/bootloaders/diskloader/src/USBDesc.cpp
+++ b/bootloaders/diskloader/src/USBDesc.cpp
@@ -27,18 +27,6 @@ const u16 STRING_LANGUAGE[2] = {
0x0409 // English
};
-#if 0
-const u16 STRING_PRODUCT[] = {
- (3<<8) | (2+2*10),
- 'M','i','c','r','o','t','o','u','c','h'
-};
-#endif
-
-const u16 STRING_SERIAL[13] = {
- (3<<8) | (2+2*12),
- MSC_DISK_SERIAL
-};
-
//#ifdef CDC_ENABLED
DeviceDescriptor USB_DeviceDescriptorA = D_DEVICE(0X02,0X00,0X00,64,USB_VID,USB_PID,0x100,0,IPRODUCT,ISERIAL,1);
@@ -74,15 +62,6 @@ Config USB_ConfigDescriptor =
D_INTERFACE(HID_INTERFACE,1,3,0,0),
D_HIDREPORT(30),
D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x40)
- },
-
-#ifdef MSC_ENABLED
- // Mass Storage
- {
- D_INTERFACE(MSC_INTERFACE,2,USB_DEVICE_CLASS_STORAGE,MSC_SUBCLASS_SCSI,MSC_PROTOCOL_BULK_ONLY),
- D_ENDPOINT(USB_ENDPOINT_OUT(MSC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,0x40,0),
- D_ENDPOINT(USB_ENDPOINT_IN (MSC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,0x40,0)
}
-#endif
};
diff --git a/bootloaders/diskloader/src/USBDesc.h b/bootloaders/diskloader/src/USBDesc.h
index a551d69..589dfa9 100644
--- a/bootloaders/diskloader/src/USBDesc.h
+++ b/bootloaders/diskloader/src/USBDesc.h
@@ -17,15 +17,7 @@
*/
-#ifndef CDC_ENABLED
-
-#define MSC_INTERFACE 0 // MSC Interface
-#define MSC_ENDPOINT_OUT 1
-#define MSC_ENDPOINT_IN 2
-
-#define INTERFACE_COUNT 1 // 1 for msc
-
-#else
+#ifdef CDC_ENABLED
#define CDC_ACM_INTERFACE 0 // CDC ACM
#define CDC_DATA_INTERFACE 1 // CDC Data
@@ -36,18 +28,14 @@
#define HID_INTERFACE 2 // HID Interface
#define HID_ENDPOINT_INT 4
-#ifdef MSC_ENABLED
-
-#define MSC_INTERFACE 3 // MSC Interface
-#define MSC_ENDPOINT_OUT 5
-#define MSC_ENDPOINT_IN 6
-#define INTERFACE_COUNT 4 // 2 for cdc + 1 for hid + 1 for msc
+#define INTERFACE_COUNT 3 // 2 for cdc + 1 for hid
-#else
+#else
-#define INTERFACE_COUNT 3 // 2 for cdc + 1 for hid
+#define HID_INTERFACE 2 // HID Interface
+#define HID_ENDPOINT_INT 4
-#endif
+#define INTERFACE_COUNT 1 // 1 for hid
#endif
@@ -58,9 +46,6 @@ typedef struct
CDCDescriptor cdc;
#endif
HIDDescriptor hid;
-#ifdef MSC_ENABLED
- MSCDescriptor msc;
-#endif
} Config;
extern Config USB_ConfigDescriptor PROGMEM;
@@ -74,8 +59,5 @@ extern const u16 STRING_SERIAL[13] PROGMEM;
#define IPRODUCT 0
#define ISERIAL 1 // Only need this for MSC
-
-#define MSC_TX MSC_ENDPOINT_IN
-#define MSC_RX MSC_ENDPOINT_OUT
#define CDC_TX CDC_ENDPOINT_IN
#define CDC_RX CDC_ENDPOINT_OUT \ No newline at end of file