Initial firmware implementation of buffer objects and raw sram allocation
complete. should be able to allocate buffers from host, but haven't got to testing it yet. Compiling on firmware though.. Currently have 256 bytes of raw_buffer, and 8 buffer objects/structs each with ~16 bytes per object. So could trim things down, but still have decent amount of SRAM left. Could have another 256 byte buffer at this rate.. but might not leave enough SRAM for temporary routines. Possible that raw buffer space could be dynamically allocated as either buffer space or temporary routine space... AVR Memory Usage ---------------- Device: atmega164a Program: 4094 bytes (25.0% Full) (.text + .data + .bootloader) Data: 573 bytes (56.0% Full) (.data + .bss + .noinit)
This commit is contained in:
parent
931222cf17
commit
c36313135e
|
|
@ -1,215 +1,258 @@
|
|||
:100000000C94E8000C9468050C9405010C9405010F
|
||||
:100010000C9405010C9405010C9405010C94050148
|
||||
:100020000C9405010C9405010C9405010C94050138
|
||||
:100030000C9405010C9405010C9405010C94050128
|
||||
:100040000C9405010C9405010C9405010C94050118
|
||||
:100050000C9405010C9405010C9405010C94050108
|
||||
:100060000C9405010C9405010C9405010C940501F8
|
||||
:100070000C9405010C9405010C9405011102130266
|
||||
:10008000160218021B021D0220022202250227026C
|
||||
:1000900029022C022E0230023202340236023802C9
|
||||
:1000A0003A02AD02AD02AD02AD023C023E02400298
|
||||
:1000B0004202AD02AD02AD02AD0244024602480268
|
||||
:1000C0004A024C024E025002520254025602580298
|
||||
:1000D0005A025C025E0260026202AD02AD02AD0233
|
||||
:1000E000AD0264026602AB0268026A026E0271022D
|
||||
:1000F000750278027E027B0277027A027D0280021C
|
||||
:1001000082028402860288028A028C028E02900297
|
||||
:1001100092029402960298029A029C029E02A00207
|
||||
:10012000A202AD02AD02AD02AD02A702A402A60278
|
||||
:10013000AA02BA02BE02BC02C002C602CD02CF02AF
|
||||
:10014000D102D302DD02E0023403360338033A035E
|
||||
:100150003C033E03400342034403460348034C036D
|
||||
:10016000090212000101008096090400000000004D
|
||||
:10017000000012011001FF000008C016DC0500029B
|
||||
:10018000010200011E0349004E004C0020005200F5
|
||||
:100190006500740072006F002D00500072006F0047
|
||||
:1001A00067002A0349006E00660069006E0069005E
|
||||
:1001B000740065004E00650073004C006900760015
|
||||
:1001C000650073002E0063006F006D0004030904D6
|
||||
:1001D00011241FBECFEFD4E0DEBFCDBF11E0A0E001
|
||||
:1001E000B1E0EAE4FDE002C005900D92A230B10753
|
||||
:1001F000D9F711E0A2E0B1E001C01D92A533B1072B
|
||||
:10020000E1F70E947C060C94A3060C94000011B840
|
||||
:100210008FEF82B914B885B917B888B98AB18471DB
|
||||
:100220008AB98BB18B6E8BB9509858985198599A5E
|
||||
:1002300008950E940701399A419A389A40983A9A4B
|
||||
:10024000429A3C9A449A3D9A459A3F9A479A4798CF
|
||||
:100250008FEF84B915B8479A479814B812B881B986
|
||||
:1002600014B885B95998519A08950E940701399A8E
|
||||
:10027000419A3C9A449A3D9A459A509A589A3F9A84
|
||||
:10028000479A4798579A5F9A5F988FEF84B915B845
|
||||
:10029000479A479814B884B915B85F9A5F9814B80C
|
||||
:1002A00012B881B914B885B95998519A0895813016
|
||||
:1002B00049F028F0823051F40E94350105C00E94B7
|
||||
:1002C000070102C00E94190180E0089586E908959F
|
||||
:1002D0009FEF94B985B9479A479862B945B958983C
|
||||
:1002E000509A5098589A14B8089550985898409831
|
||||
:1002F000419A429A62B99FEF94B985B9479A479853
|
||||
:1003000014B800000000409A87FD419800000000EA
|
||||
:10031000000000000000000083B14098419A089559
|
||||
:1003200062B99FEF94B985B9479A479814B8409A33
|
||||
:1003300087FD4198000000000000000083B1409854
|
||||
:10034000419A08955898509A9FEF94B962B985B927
|
||||
:10035000479A4798429845B9409A87FD41980000CE
|
||||
:1003600000004098419A429A14B8089562B98032C8
|
||||
:1003700020F48FEF84B915B803C09FEF94B985B905
|
||||
:10038000479A479814B84498000000000000000005
|
||||
:1003900083B1449A0895CF93DF93982F862F642FCB
|
||||
:1003A000E901913839F0923851F0903859F40E94AF
|
||||
:1003B000750102C00E949001888380E004C00E9401
|
||||
:1003C000B601FACF81EADF91CF9108959FEF94B9FA
|
||||
:1003D00062B9803210F415B801C085B9479A4798C0
|
||||
:1003E00045B945980000459A14B80895982F862F6E
|
||||
:1003F000642F422F992329F0913039F40E94E601AD
|
||||
:1004000002C00E94680180E0089580EA089590E0AB
|
||||
:100410008B35910508F0A1C0FC01E25CFF4F0C9404
|
||||
:100420009D0611B895C08FEF81B992C012B890C0E7
|
||||
:100430008FEF82B98DC014B88BC08FEF84B988C09C
|
||||
:1004400015B886C08FEF85B983C017B881C018B8BA
|
||||
:100450007FC08FEF88B97CC038987AC0389A78C04E
|
||||
:10046000409876C0409A74C0399872C0399A70C06A
|
||||
:1004700041986EC0419A6CC03A986AC03A9A68C076
|
||||
:10048000429866C0429A64C03B9862C03B9A60C082
|
||||
:1004900043985EC0439A5CC03C985AC03C9A58C08E
|
||||
:1004A000449856C0449A54C03D9852C03D9A50C09A
|
||||
:1004B00045984EC0459A4CC03E984AC03E9A48C0A6
|
||||
:1004C000469846C0469A44C03F9842C03F9A40C0B2
|
||||
:1004D000479A3EC08AB184718AB93AC08BB184719F
|
||||
:1004E00002C08BB18B6E8BB933C0509831C0589815
|
||||
:1004F000509A2EC05098589A2BC05098589828C09F
|
||||
:10050000519826C0519A24C0599822C0599A20C0A7
|
||||
:1005100053981EC0539A1CC05B981AC05B9A18C0AF
|
||||
:10052000559816C0559A14C05D9812C05D9A10C0B7
|
||||
:1005300056980EC0569A0CC05E980AC05E9A08C0C3
|
||||
:10054000579806C0579A04C05F9A02C05F9A5F9896
|
||||
:1005500080E00895479A4798FBCF8CE8089590E093
|
||||
:10056000FC01E058F109EB30F105A0F5E756FF4F2B
|
||||
:100570000C949D0662B922C08FEF84B965B91EC084
|
||||
:100580008FEF84B965B9479A479805C08FEF84B952
|
||||
:1005900065B95F9A5F9814B811C061B90FC064B9AA
|
||||
:1005A0000DC067B90BC09AB1862F846189238AB9BF
|
||||
:1005B0008AB16B7E682B6AB901C068B980E0089582
|
||||
:1005C0009BB1862F846189238BB98BB16B7E682B9D
|
||||
:1005D0006BB9F4CF8DE80895813A61F0823AB9F0B1
|
||||
:1005E000803A11F58FEF84B965B9479A479814B8E6
|
||||
:1005F00042B916C08FEF84B965B9479A479814B8C5
|
||||
:1006000042B967FF02C041980BC0419A09C042B984
|
||||
:100610008FEF84B9603230F415B8479A479814B810
|
||||
:1006200080E0089565B9F9CF8EE80895803B61F4C4
|
||||
:1006300022B98FEF84B945B9479A479865B95F9A4F
|
||||
:100640005F9814B880E008958FE80895CF93DF9302
|
||||
:10065000EB0190E0805C91098C309105F8F48C55A9
|
||||
:100660009F4FFC010C949D0680B113C083B111C053
|
||||
:1006700086B10FC089B10DC082B10BC085B109C070
|
||||
:1006800088B107C08BB105C081B103C084B101C07E
|
||||
:1006900087B1888380E003C08AB1FBCF80E9DF9116
|
||||
:1006A000CF9108950F93811102C0589A01C05898B4
|
||||
:1006B0008FEF84B922B945B9479A479805B96111B6
|
||||
:1006C00001C04198459800000000459A419A14B82D
|
||||
:1006D00058980F9108950F93022F813061F030F0F8
|
||||
:1006E000823089F4242F462F6FEF08C0242F462F25
|
||||
:1006F00060E081E004C0242F462F60E080E00E948B
|
||||
:10070000520380E001C08AEA0F9108950F9381118E
|
||||
:1007100002C0589A01C058988FEF84B902B925B920
|
||||
:10072000479A479845B95F9A5F9814B8611101C01C
|
||||
:1007300041984498000000000000000083B1449AF2
|
||||
:10074000419A58980F9108950F931F93CF93DF9379
|
||||
:10075000E801813851F0823891F08038A9F4022FF5
|
||||
:10076000242F462F60E081E005C0022F242F462F62
|
||||
:1007700060E080E00E948603888380E006C0022F4C
|
||||
:10078000242F462F6FEFF5CF8BEADF91CF911F918A
|
||||
:100790000F9108950F931F93CF93FC01C081CC1F3D
|
||||
:1007A000CC27CC1F8181823049F118F4813031F09F
|
||||
:1007B00056C0833039F18430A9F151C08281803B29
|
||||
:1007C00038F4803A88F4803858F40E94070248C010
|
||||
:1007D000803C78F42481458163810E94160340C0E7
|
||||
:1007E00064810E94AF023CC0448165810E94EC029A
|
||||
:1007F00037C063E071E00E9426032DC082810E9411
|
||||
:1008000057012EC08281803830F423814481658174
|
||||
:100810000E94F60125C023E031E0448165810E94F9
|
||||
:10082000CB0119C02281638144817581822F90E0C0
|
||||
:10083000203840F4262F30E050E0672F70E00E940F
|
||||
:100840006B030EC0242F30E0472F50E070E003E030
|
||||
:1008500011E00E94A40380930201CF5F03C080E8EF
|
||||
:100860008093020182E091E090931A018093190134
|
||||
:100870008C2FCF911F910F91089581E00895CF9310
|
||||
:10088000DF9360911B01635067FDA4C08091180144
|
||||
:10089000CCE0D0E0C81BD109C15EDE4F80911701CA
|
||||
:1008A0008D3209F085C0683009F092C083EC8093E6
|
||||
:1008B0000B018AE58093010110920A0188818076FC
|
||||
:1008C00021F0CE010E94CA0360C08A8110921401F7
|
||||
:1008D0009981911106C01092150124E131E082E066
|
||||
:1008E00050C0953019F480931C013DC09630A9F595
|
||||
:1008F0009B81913019F482E791E004C0923041F479
|
||||
:1009000080E691E090931A018093190182E121C061
|
||||
:100910009330F1F4811108C08CEC91E090931A01AE
|
||||
:100920008093190184E015C0813041F482EA91E09E
|
||||
:1009300090931A01809319018AE20BC0823041F42E
|
||||
:1009400084E891E090931A01809319018EE101C02F
|
||||
:1009500080E090E490930A0118C0983079F09930C3
|
||||
:1009600031F480931E0124E131E080E00AC081E08F
|
||||
:100970009A3009F080E024E131E003C02EE131E05B
|
||||
:1009800081E030931A01209319018F3F39F4988147
|
||||
:1009900097FD8E8190E890930A0107C09F81911185
|
||||
:1009A00004C09E81981708F4892F8093000110C01D
|
||||
:1009B00080910A0187FF0CC0CE010E943D048F3F49
|
||||
:1009C00021F48EE18093010103C081111092000196
|
||||
:1009D00010921B018091010184FF4DC080910001A4
|
||||
:1009E0008F3F09F448C0C82F893008F0C8E08C1B3D
|
||||
:1009F0008093000180910B0198E8892780930B0177
|
||||
:100A0000CC2361F18091190190911A0120910A0182
|
||||
:100A100026FF12C0ACE0B1E02BE031E0209530952C
|
||||
:100A2000280F391F4C2F4A0FF901EA0FFB1FE491E1
|
||||
:100A3000ED934A13F9CF09C0ECE0F1E0DC012C2F73
|
||||
:100A40002E0F3D9131932E13FCCF01962FEF2C0FDB
|
||||
:100A5000820F911D90931A01809319016C2F8CE0E5
|
||||
:100A600091E00E946405CC5FCC3019F08FEF809349
|
||||
:100A70000001C093010184E199B1947131F4815076
|
||||
:100A8000D9F710921C0110921601DF91CF910895B1
|
||||
:100A9000E9E6F0E0808182608083E89A0895A82FDB
|
||||
:100AA000B92F80E090E041E050EA609530E009C065
|
||||
:100AB0002D9182279795879510F084279527305E92
|
||||
:100AC000C8F36F5FA8F30895EADF8D939D930895AF
|
||||
:100AD000CF93CFB7CF93DF93C3954C9BE9F74C9B54
|
||||
:100AE0000BC04C9B09C04C9B07C04C9B05C04C9B4A
|
||||
:100AF00003C04C9B01C089C06F93C0911801DD27D2
|
||||
:100B0000C15EDE4F2F9365E54C9B03C02F916F9123
|
||||
:100B1000E6CF0F931F934F9320E040E15F9309B11D
|
||||
:100B2000047104FB27F93F9350E03BE039C0147196
|
||||
:100B300040642F77012F5F5F1EC0406819B11471A8
|
||||
:100B40002F7752501FC0406409B12F770471D1F143
|
||||
:100B50005F5F00C023C0406219B12F77147191F11B
|
||||
:100B60005F5F00C025C004711027515012F45D5F13
|
||||
:100B70000000115027952C3F19B1C8F614710127B8
|
||||
:100B8000015027952C3FC8F64227499309B10471BB
|
||||
:100B900010274F73115027952C3FA8F64695469580
|
||||
:100BA00019B1147179F00127015027952C3F98F65F
|
||||
:100BB0006B5A60F3315009B1B0F600C011E01CBBB4
|
||||
:100BC000002717C03B503195C31BD04011E01CBB20
|
||||
:100BD0000881033CF9F00B34E9F0209116011981EA
|
||||
:100BE000110F1213EDCF093651F10D3211F0013E04
|
||||
:100BF00039F700931D013F915F914F911F910F9124
|
||||
:100C00002F916F91CCB3C0FD67CFDF91CF91CFBF54
|
||||
:100C1000CF91189520911D01222369F310911B019A
|
||||
:100C2000112339F534303AF130931B012093170129
|
||||
:100C3000109118013BE0311B309318011CC000914A
|
||||
:100C40001B010130B4F40AE53091010134FD14C0F8
|
||||
:100C500000930101CBE0D1E013C0052710E000C0F4
|
||||
:100C600000000BB91AC0052710E0221F1DC010E0BC
|
||||
:100C700021C04AE502C032ED432FC4E1D0E032E0AA
|
||||
:100C80001AB114615C9A0BB11AB954E120E865E31A
|
||||
:100C900020FF05270BB9279517951C3FF0F66695A1
|
||||
:100CA000B8F7B1F720FF05270BB9279517951C3F1B
|
||||
:100CB000D0F62795179517FF052700001C3F0BB9A5
|
||||
:100CC000B0F629913A9519F70B7E10911C01110F7E
|
||||
:100CD000C651D0400BB911F01093160111E01CBBA6
|
||||
:100CE00000611AB11B7E402F4B7E54E05A95F1F7FC
|
||||
:100CF0000BB91AB94BB97FCF2EE088E190E00FB65F
|
||||
:100D0000F894A895809360000FBE209360000E9425
|
||||
:100D10004805549A80E0815041F0A895EFE9FFE042
|
||||
:100D20003197F1F700C00000F6CF54980E940701F8
|
||||
:100D30007894A8950E943F04FCCFEE0FFF1F05900A
|
||||
:0A0D4000F491E02D0994F894FFCF20
|
||||
:020D4A00FF5A4E
|
||||
:100000000C94D1000C94E8060C94EE000C94EE00D5
|
||||
:100010000C94EE000C94EE000C94EE000C94EE00A8
|
||||
:100020000C94EE000C94EE000C94EE000C94EE0098
|
||||
:100030000C94EE000C94EE000C94EE000C94EE0088
|
||||
:100040000C94EE000C94EE000C94EE000C94EE0078
|
||||
:100050000C94EE000C94EE000C94EE000C94EE0068
|
||||
:100060000C94EE000C94EE000C94EE000C94EE0058
|
||||
:100070000C94EE000C94EE000C94EE00DB02DD021A
|
||||
:10008000E002E202E502E702EA02EC02EF02F1021C
|
||||
:10009000F302F602F802FA02FC02FE020003020377
|
||||
:1000A0000403D902D902D902D902060308030A03BC
|
||||
:1000B0000C03D902D902D902D9020E03100312038C
|
||||
:1000C0001403160318031A031C031E032003220340
|
||||
:1000D0002403260328032A032C03D902D902D902B8
|
||||
:1000E000D9022E0330033203340336033A033D03AF
|
||||
:1000F000410344034A0347034303460349034C03B4
|
||||
:100100004E03500352035403560358035A035C032F
|
||||
:100110005E03600362036403660368036A036C039F
|
||||
:100120006E03D902D902D902D90273037003720394
|
||||
:100130007603040309042A0349006E00660069007F
|
||||
:100140006E006900740065004E00650073004C008D
|
||||
:1001500069007600650073002E0063006F006D007B
|
||||
:100160001E0349004E004C00200052006500740040
|
||||
:1001700072006F002D00500072006F0067001201C6
|
||||
:100180001001FF000008C016DC050002010200019A
|
||||
:10019000090212000101008096090400000000001D
|
||||
:1001A000000011241FBECFEFD4E0DEBFCDBF11E0B1
|
||||
:1001B000A0E0B1E0ECEFFFE002C005900D92A230AC
|
||||
:1001C000B107D9F713E0A2E0B1E001C01D92AD3351
|
||||
:1001D000B107E1F70E9403020C94FC070C940000A5
|
||||
:1001E000E2E8F2E08FEF819392E0EA38F907D9F77D
|
||||
:1001F000809305018093150180932501809335013B
|
||||
:10020000809345018093550180936501809375012A
|
||||
:10021000809308018093180180932801809338010E
|
||||
:1002200080934801809358018093680180937801FE
|
||||
:100230000895CF93DF93DC01522FE42FF0E0CF013C
|
||||
:10024000820F911D099714F08EEB32C013968C919A
|
||||
:1002500013978F3F11F08FEB2BC016968C9116974A
|
||||
:100260008F3F11F080EC24C0EE57FD4FEF0190E07E
|
||||
:1002700006C089918F3F11F081EC1AC09F5F9517DE
|
||||
:10028000C0F316966C93169713961C921397242F0F
|
||||
:1002900030E0C9018E579E4F8D939C93250F311DE1
|
||||
:1002A0002E573D4F01C06193E217F307E1F780E05D
|
||||
:1002B000DF91CF9108950F93382F882329F030587C
|
||||
:1002C000383028F084EB0AC00E94F00006C0CB0151
|
||||
:1002D000642F422F202F0E94190180E00F91089572
|
||||
:1002E00011B88FEF82B914B885B917B888B98AB137
|
||||
:1002F00084718AB98BB18B6E8BB95098589851988C
|
||||
:10030000599A08950E947001399A419A389A4098F2
|
||||
:100310003A9A429A3C9A449A3D9A459A3F9A479A09
|
||||
:1003200047988FEF84B915B8479A479814B812B810
|
||||
:1003300081B914B885B95998519A08950E947001ED
|
||||
:10034000399A419A3C9A449A3D9A459A509A589AB9
|
||||
:100350003F9A479A4798579A5F9A5F988FEF84B968
|
||||
:1003600015B8479A479814B884B915B85F9A5F983A
|
||||
:1003700014B812B881B914B885B95998519A08952A
|
||||
:10038000813049F0813020F0823049F086E90895CB
|
||||
:100390000E94700102C00E94820180E008950E94C4
|
||||
:1003A0009E0180E00895FC0181E080835898509A76
|
||||
:1003B000000089B1818350985898908189238917CA
|
||||
:1003C00041F48AEA86838483828385E585838383F7
|
||||
:1003D00008955098589A89B1818389B1828389B1EF
|
||||
:1003E000838389B1848389B1858389B18683509859
|
||||
:1003F00058980895803811F087E90895CB010E943C
|
||||
:10040000D30180E008952EE088E190E00FB6F894E3
|
||||
:10041000A895809360000FBE209360000E94C305E2
|
||||
:10042000549A20E040EA5FE004C0A895CA01019711
|
||||
:10043000F1F72150D1F754980E9470017894A89553
|
||||
:100440000E94CA05FCCF9FEF94B985B9479A479897
|
||||
:1004500062B945B95898509A5098589A14B8089566
|
||||
:10046000509858984098419A429A62B99FEF94B92F
|
||||
:1004700085B9479A479814B80000000087FF03C069
|
||||
:10048000409A419801C0409A00000000000000001E
|
||||
:100490000000000083B14098419A089562B99FEF2F
|
||||
:1004A00094B985B9479A479814B8409A87FD4198FE
|
||||
:1004B000000000000000000083B14098419A0895B8
|
||||
:1004C0005898509A9FEF94B962B985B9479A47985E
|
||||
:1004D000429845B9409A87FD419800000000409835
|
||||
:1004E000419A429A14B80895982F62B9803220F444
|
||||
:1004F0008FEF84B9907802C08FEF84B995B9479A8D
|
||||
:10050000479814B84498000000000000000083B130
|
||||
:10051000449A0895CF93DF93E901813859F08238E6
|
||||
:1005200071F0803811F081EA10C0862F642F0E948C
|
||||
:10053000300209C0862F642F0E944E0204C0862F0D
|
||||
:10054000642F0E947402888380E0DF91CF91089528
|
||||
:10055000982F8FEF84B962B9903208F4907895B9EA
|
||||
:10056000479A479845B945980000459A14B80895A8
|
||||
:10057000882321F0813049F080EA0895862F642F86
|
||||
:10058000422F0E94230280E00895862F642F422F7D
|
||||
:100590000E94A80280E00895E82FF0E0EB35F10515
|
||||
:1005A00040F4E25CFF4FEE0FFF1F0590F491E02D49
|
||||
:1005B00009948CE8089511B897C08FEF81B994C061
|
||||
:1005C00012B892C08FEF82B98FC014B88DC08FEF70
|
||||
:1005D00084B98AC015B888C08FEF85B985C017B8AF
|
||||
:1005E00083C018B881C08FEF88B97EC038987CC0AE
|
||||
:1005F000389A7AC0409878C0409A76C0399874C0CA
|
||||
:10060000399A72C0419870C0419A6EC03A986CC0D5
|
||||
:100610003A9A6AC0429868C0429A66C03B9864C0E1
|
||||
:100620003B9A62C0439860C0439A5EC03C985CC0ED
|
||||
:100630003C9A5AC0449858C0449A56C03D9854C0F9
|
||||
:100640003D9A52C0459850C0459A4EC03E984CC005
|
||||
:100650003E9A4AC0469848C0469A46C03F9844C011
|
||||
:100660003F9A42C0479840C0479A3EC08AB18471C1
|
||||
:100670008AB93AC08BB1847102C08BB18B6E8BB9D1
|
||||
:1006800033C0509831C05898509A2EC05098589AFC
|
||||
:100690002BC05098589828C0519826C0519A24C011
|
||||
:1006A000599822C0599A20C053981EC0539A1CC012
|
||||
:1006B0005B981AC05B9A18C0559816C0559A14C01A
|
||||
:1006C0005D9812C05D9A10C056980EC0569A0CC024
|
||||
:1006D0005E980AC05E9A08C0579806C0579A04C030
|
||||
:1006E0005F9A02C05F9A5F9880E00895479A4798A2
|
||||
:1006F00080E00895853891F1863870F48238E9F009
|
||||
:10070000833828F48038B9F0813899F418C08338D8
|
||||
:10071000C1F0843871F41BC0883831F1893828F46D
|
||||
:100720008638F1F0873829F41DC0893839F18A38C4
|
||||
:1007300041F18DE8089562B922C08FEF84B965B99F
|
||||
:100740001EC08FEF84B965B9479A479805C08FEFEF
|
||||
:1007500084B965B95F9A5F9814B811C061B90FC0C8
|
||||
:1007600064B90DC067B90BC08AB1962F9461982304
|
||||
:100770009AB98AB16B7E862B8AB901C068B980E0CC
|
||||
:1007800008958BB1962F946198239BB98BB16B7EA2
|
||||
:10079000862B8BB980E00895813A71F0823AC9F0D6
|
||||
:1007A000803A11F08EE808958FEF84B965B9479AC1
|
||||
:1007B000479814B842B917C08FEF84B965B9479A02
|
||||
:1007C000479814B842B967FF02C041980CC0419ADB
|
||||
:1007D0000AC042B9603248F48FEF84B9607865B9D5
|
||||
:1007E000479A479814B880E008958FEF84B965B9A7
|
||||
:1007F000479A479814B880E00895803B11F08FE83D
|
||||
:10080000089522B98FEF84B945B9479A479865B9D9
|
||||
:100810005F9A5F9814B880E00895FB01853C59F118
|
||||
:10082000863C70F4823C09F1833C28F4803CC9F09A
|
||||
:10083000813CA9F418C0833CD1F0843C81F419C0F8
|
||||
:10084000883CF9F0893C28F4863CB9F0873C39F4BF
|
||||
:1008500016C08A3CD1F08A3CB0F08B3CD1F080E9E4
|
||||
:10086000089580B113C083B111C086B10FC089B1A2
|
||||
:100870000DC082B10BC085B109C088B107C08BB172
|
||||
:1008800005C081B103C084B101C087B1808380E01D
|
||||
:1008900008958AB1808380E008950F93882311F42E
|
||||
:1008A000589A01C058988FEF84B922B945B9479A30
|
||||
:1008B000479805B9662309F441984598000000005F
|
||||
:1008C000459A419A14B858980F9108950F93962F0E
|
||||
:1008D000342F022F813041F0813020F0823039F006
|
||||
:1008E0008AEA0CC081E001C080E060E002C080E0E4
|
||||
:1008F0006FEF492F232F0E944D0480E00F91089540
|
||||
:100900000F93882311F4589A01C058988FEF84B937
|
||||
:1009100002B925B9479A479845B95F9A5F9814B8C4
|
||||
:10092000662309F44198449800000000000000008C
|
||||
:1009300083B1449A419A58980F9108950F931F9349
|
||||
:10094000CF93DF93962F342F522FE801813841F057
|
||||
:10095000823849F0803811F08BEA0EC081E001C086
|
||||
:1009600080E060E002C080E06FEF492F232F052F69
|
||||
:100970000E948004888380E0DF91CF911F910F91C6
|
||||
:10098000089581E00895FF920F931F93CF93DF9313
|
||||
:10099000EC01FF24888187FF02C0FF24F394898142
|
||||
:1009A000833009F440C0843030F4813059F0823013
|
||||
:1009B00009F0D9C029C0843009F445C0853009F058
|
||||
:1009C000D2C055C08A81803B28F4803A68F48038D0
|
||||
:1009D00020F006C0803C68F012C00E94CC02C4C067
|
||||
:1009E0006C810E947A03C0C06D814C810E94CC034F
|
||||
:1009F000BBC06B814D812C810E94FD03B5C06BE8AB
|
||||
:100A000072E00E940D042FC08A81803818F40E9481
|
||||
:100A1000C001AAC06BE872E00E94FA0180938A02CA
|
||||
:100A200088E0F82EA3C08A81803830F46D814C8133
|
||||
:100A30002B810E94B80298C06D814C812BE832E076
|
||||
:100A40000E948A0210C08A81803830F46D814C8106
|
||||
:100A50002B810E94660488C06B814D812C810BE83C
|
||||
:100A600012E00E949E0480938A02F3947FC08A81E0
|
||||
:100A7000803840F460E070E04D812C810B810E9451
|
||||
:100A80005B0172C0282F30E02770307023303105B1
|
||||
:100A9000C1F1243031054CF421303105F1F0223020
|
||||
:100AA00031052CF5232B81F05CC025303105E9F1AF
|
||||
:100AB0002530310584F12630310509F440C0273056
|
||||
:100AC000310509F04EC045C062E972E04D812C81CC
|
||||
:100AD0000B810E945B0180938A028A8162EA72E044
|
||||
:100AE0004D812C810B810E945B0180938A028A8157
|
||||
:100AF00062EB72E04D812C810B810E945B0180933F
|
||||
:100B00008A028A8162EC72E04D812C810B810E9405
|
||||
:100B10005B0180938A028A8162ED72E04D812C81B3
|
||||
:100B20000B810E945B0180938A028A8162EE72E0EF
|
||||
:100B30004D812C810B810E945B0180938A028A8106
|
||||
:100B400062EF72E04D812C810B810E945B018093EA
|
||||
:100B50008A028A8162E073E04D812C810B810E94C0
|
||||
:100B60005B0185E801C080E880938A028AE892E010
|
||||
:100B700090932203809321038F2DDF91CF911F91BA
|
||||
:100B80000F91FF900895E9E6F0E080818260808314
|
||||
:100B9000E89A08951F93CF93DF93609123036350E6
|
||||
:100BA00067FDA5C080912003CCE0D0E0C81BD1092F
|
||||
:100BB000C95DDC4F80911F038D3209F085C068301C
|
||||
:100BC00009F093C083EC809313038AE580930001BE
|
||||
:100BD000109212038881807641F0CE010E94C304F6
|
||||
:100BE000282F8F3F09F45FC065C09A8110921C03C3
|
||||
:100BF0008981882321F410921D0322E04DC08530A5
|
||||
:100C000019F49093240347C08630B1F58B8181306D
|
||||
:100C100019F48EE791E004C0823041F480E991E05C
|
||||
:100C2000909322038093210322E122C08330F9F4C0
|
||||
:100C30008A81882341F482E391E090932203809398
|
||||
:100C4000210324E015C0813041F486E391E09093C4
|
||||
:100C50002203809321032AE20BC0823041F480E614
|
||||
:100C600091E090932203809321032EE101C020E0C4
|
||||
:100C700080E4809312031EC0883021F421E086E2D4
|
||||
:100C800093E00CC0893019F49093260304C08A3095
|
||||
:100C900011F421E001C020E08CE193E09093220365
|
||||
:100CA0008093210307C0888187FD2E8180E880938F
|
||||
:100CB000120306C08F81882319F48E81821708F0F1
|
||||
:100CC000822F8093010111C08091120387FF0DC014
|
||||
:100CD000CE010E94C1048F3F21F48EE18093000178
|
||||
:100CE00004C0882311F01092010110922303809117
|
||||
:100CF000000184FF46C0809101018F3F09F441C08B
|
||||
:100D0000182F893008F018E0811B80930101809131
|
||||
:100D1000130398E8892780931303112321F120916D
|
||||
:100D20002103309122038091120386FF0AC0912F84
|
||||
:100D3000F901A4E1B3E084918D9331969150D9F7F4
|
||||
:100D400008C0912FD901E4E1F3E08D918193915096
|
||||
:100D5000E1F7C90101961150810F911D1F5F90931A
|
||||
:100D600022038093210384E193E0612F0E94E40633
|
||||
:100D7000612F6C5F6C3019F08FEF809301016093ED
|
||||
:100D8000000194E189B1847131F49150D9F7109246
|
||||
:100D9000240310921E03DF91CF911F910895A82F75
|
||||
:100DA000B92F80E090E041E050EA609530E009C062
|
||||
:100DB0002D9182279795879510F084279527305E8F
|
||||
:100DC000C8F36F5FA8F30895EADF8D939D930895AC
|
||||
:100DD000CF93CFB7CF93DF93C3954C9BE9F74C9B51
|
||||
:100DE0000BC04C9B09C04C9B07C04C9B05C04C9B47
|
||||
:100DF00003C04C9B01C089C06F93C0912003DD27C5
|
||||
:100E0000C95DDC4F2F9365E54C9B03C02F916F911B
|
||||
:100E1000E6CF0F931F934F9320E040E15F9309B11A
|
||||
:100E2000047104FB27F93F9350E03BE039C0147193
|
||||
:100E300040642F77012F5F5F1EC0406819B11471A5
|
||||
:100E40002F7752501FC0406409B12F770471D1F140
|
||||
:100E50005F5F00C023C0406219B12F77147191F118
|
||||
:100E60005F5F00C025C004711027515012F45D5F10
|
||||
:100E70000000115027952C3F19B1C8F614710127B5
|
||||
:100E8000015027952C3FC8F64227499309B10471B8
|
||||
:100E900010274F73115027952C3FA8F6469546957D
|
||||
:100EA00019B1147179F00127015027952C3F98F65C
|
||||
:100EB0006B5A60F3315009B1B0F600C011E01CBBB1
|
||||
:100EC000002717C03B503195C31BD04011E01CBB1D
|
||||
:100ED0000881033CF9F00B34E9F020911E031981DD
|
||||
:100EE000110F1213EDCF093651F10D3211F0013E01
|
||||
:100EF00039F7009325033F915F914F911F910F9117
|
||||
:100F00002F916F91CCB3C0FD67CFDF91CF91CFBF51
|
||||
:100F1000CF91189520912503222369F31091230383
|
||||
:100F2000112339F534303AF13093230320931F0312
|
||||
:100F3000109120033BE0311B309320031CC0009133
|
||||
:100F400023030130B4F40AE53091000134FD14C0EC
|
||||
:100F500000930001C3E1D3E013C0052710E000C0F7
|
||||
:100F600000000BB91AC0052710E0221F1DC010E0B9
|
||||
:100F700021C04AE502C032ED432FC4E1D0E032E0A7
|
||||
:100F80001AB114615C9A0BB11AB954E120E865E317
|
||||
:100F900020FF05270BB9279517951C3FF0F666959E
|
||||
:100FA000B8F7B1F720FF05270BB9279517951C3F18
|
||||
:100FB000D0F62795179517FF052700001C3F0BB9A2
|
||||
:100FC000B0F629913A9519F70B7E10912403110F71
|
||||
:100FD000C651D0400BB911F010931E0311E01CBB99
|
||||
:100FE00000611AB11B7E402F4B7E54E05A95F1F7F9
|
||||
:0C0FF0000BB91AB94BB97FCFF894FFCFB2
|
||||
:020FFC005AFF9A
|
||||
:00000001FF
|
||||
|
|
|
|||
|
|
@ -1,103 +1,168 @@
|
|||
#include "buffer.h"
|
||||
|
||||
//buffer struct
|
||||
//designed to have multiple buffers instantiated at a time
|
||||
//buffers are effectively objects who get instructed by host
|
||||
//commands include things like reading from cartridge rom/ram
|
||||
//getting filled by usb writes, programming 'themselves' to
|
||||
//where they belong on the cartridge. They know how to get
|
||||
//on/off the cart and have a current status that the host can
|
||||
//query. Host then decides when to refill/dump data from
|
||||
//buffer over usb. Host also can query buffer to get error
|
||||
//codes back and and attempt to resolve issues. Buffers can
|
||||
//also be instructed to verify themselves with a checksum
|
||||
//They can verify themselves against cart rom/ram as well.
|
||||
//typedef struct buffer{
|
||||
// uint8_t *data; //pointer to base buffer's allocated sram
|
||||
// uint8_t size; //size of buffer in bytes (max 256 bytes)
|
||||
// uint8_t status; //current status of buffer USB load/unload, flashing, waiting, erase
|
||||
// uint8_t cur_byte; //byte currently being loaded/unloaded/flashed/read
|
||||
// uint8_t reload; //add this number to page_num for next loading
|
||||
// uint8_t buff_num; //address bits between buffer size and page number
|
||||
// //ie need 2x128 byte buffers making buff_num = A7
|
||||
// //ie need 4x64 byte buffers making buff_num = A7:6
|
||||
// //ie need 8x32 byte buffers making buff_num = A7:5
|
||||
// uint16_t page_num; //address bits beyond buffer's size and buff_num A23-A8
|
||||
// //MSB A23-16, LSB A15-8
|
||||
// uint8_t mem_type; //SNES ROM, SNES RAM, PRG ROM, PRG RAM, CHR ROM, CHR RAM, CPLD, SPI
|
||||
// uint8_t part_num; //used to define unlock commands, sector erase, etc
|
||||
// uint8_t multiple; //number of times to program this page
|
||||
// uint8_t add_mult; //add this number to page_num for multiple programs
|
||||
// //CHR shift LSb to A13 (max 2MByte)
|
||||
// //PRG shift LSb to A14 (max 4MByte)
|
||||
// //SNES add to MSB of page_num (max 16MByte)
|
||||
// uint8_t mapper; //mapper number of board
|
||||
// uint8_t mapvar; //mapper variant
|
||||
// uint8_t function; //function "pointer" for flash/dump operation control
|
||||
//}buffer;
|
||||
|
||||
//atmega164 has 1KByte of SRAM
|
||||
//VUSB has max of 254 + wValue/wIndex = max 256 bytes without long transfers
|
||||
//Expecting two 128 byte buffers will be faster than a single 256byte buffer
|
||||
//That way one buffer could be flashing onto the cart while the other is
|
||||
//getting filled 8bytes at a time from USB. this would proide some double
|
||||
//buffering speed ups, but not sure how fast that'll be. Having buffers
|
||||
//as small as 32bytes might be faster for 4-8MB flash memories as they
|
||||
//have ability to flash 32Bytes at once. Could perhaps fill multiple
|
||||
//32B buffers with one larger 128/256B transfer. Increasing transfer size
|
||||
//does speed up overall due to fewer setup and status USB packets.
|
||||
//max raw buffer size is 256 bytes must create multiple raw buffers for more
|
||||
//or handle 16bit values for page size
|
||||
|
||||
//USB control transfer:
|
||||
// SETUP/DATA STAGES:
|
||||
// Token packet- sync, pid, addr, enp, crc5, eop = 35bits
|
||||
// Data/setup packet
|
||||
// sync, pid, crc16, eop = 67bits
|
||||
// setup/payload packet data = 64bits
|
||||
// handsk (sync, pid, eop) = 19bit
|
||||
// total = 185bits with 64bit payload = 34.6% data utilization per data packet
|
||||
// STATUS STAGE:
|
||||
// same as above, but zero lenght data packet.
|
||||
// total 121bits
|
||||
//raw buffer memory to which smaller buffers will be created from
|
||||
//set pointers and lengths to prevent buffer conflicts
|
||||
//static uint8_t raw_buffer[NUM_RAW_BANKS * RAW_BANK_SIZE]; //8 banks of 32bytes each 256Bytes total
|
||||
static uint8_t raw_buffer[256]; //8 banks of 32bytes each 256Bytes total
|
||||
|
||||
//buffer status stores allocation status of each raw buffer 32Byte bank
|
||||
//static uint8_t raw_bank_status[NUM_RAW_BANKS];
|
||||
static uint8_t raw_bank_status[8];
|
||||
|
||||
|
||||
/* Desc:Function takes an opcode which was transmitted via USB
|
||||
* then decodes it to call designated function.
|
||||
* shared_dict_buffer.h is used in both host and fw to ensure opcodes/names align
|
||||
* Pre: Macros must be defined in firmware pinport.h
|
||||
* opcode must be defined in shared_dict_buffer.h
|
||||
* Post:function call complete.
|
||||
* Rtn: SUCCESS if opcode found, ERR_UNKN_BUFF_OPCODE_NRV if opcode not present.
|
||||
*/
|
||||
uint8_t buffer_opcode_no_return( uint8_t opcode, buffer *buff, uint8_t oper1, uint8_t oper2, uint8_t oper3 )
|
||||
{
|
||||
switch (opcode) {
|
||||
case RAW_BUFFER_RESET:
|
||||
raw_buffer_reset();
|
||||
break;
|
||||
case ALLOCATE_BUFFER0 ... ALLOCATE_BUFFER7:
|
||||
allocate_buffer( &(*buff), oper1, oper2, oper3 );
|
||||
break;
|
||||
default:
|
||||
//opcode doesn't exist
|
||||
return ERR_UNKN_BUFF_OPCODE_NRV;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* Desc:Blindly resets all buffer allocation and values
|
||||
* Host instructs this to be called.
|
||||
* Pre: static instantitions of raw_buffer, raw_bank_status, and buff0-7 above
|
||||
* Post:all raw buffer ram unallocated
|
||||
* buffer status updated to UNALLOC
|
||||
* Rtn: None
|
||||
*/
|
||||
void raw_buffer_reset( )
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
//unallocate raw buffer space
|
||||
for( i=0; i<NUM_RAW_BANKS; i++) {
|
||||
raw_bank_status[i] = UNALLOC;
|
||||
}
|
||||
|
||||
//unallocate all buffer objects
|
||||
buff0.status = UNALLOC;
|
||||
buff1.status = UNALLOC;
|
||||
buff2.status = UNALLOC;
|
||||
buff3.status = UNALLOC;
|
||||
buff4.status = UNALLOC;
|
||||
buff5.status = UNALLOC;
|
||||
buff6.status = UNALLOC;
|
||||
buff7.status = UNALLOC;
|
||||
//set buffer id to UNALLOC
|
||||
buff0.id = UNALLOC;
|
||||
buff1.id = UNALLOC;
|
||||
buff2.id = UNALLOC;
|
||||
buff3.id = UNALLOC;
|
||||
buff4.id = UNALLOC;
|
||||
buff5.id = UNALLOC;
|
||||
buff6.id = UNALLOC;
|
||||
buff7.id = UNALLOC;
|
||||
|
||||
}
|
||||
|
||||
/* Desc:Embeded subtitute for malloc of a buffer object
|
||||
* Host instructs this to be called so the host
|
||||
* is in charge of what buffers are for what
|
||||
* and how things are used. This function does
|
||||
* keep track of each bank of the raw buffer.
|
||||
* It will not allocate buffer space and return error
|
||||
* if host is trying to allocate buffer on top of
|
||||
* another buffer or bank already allocated.
|
||||
* pass in pointer to buffer object to be allocated
|
||||
* pass base bank number and number of banks in buffer
|
||||
* Pre: static instantitions of raw_buffer raw_bank_status,
|
||||
* and buff0-7 above.
|
||||
* Buffer must be unallocated.
|
||||
* new id cannot be 0xFF/255 "UNALLOC"
|
||||
* bank allocation request can't go beyond raw ram space
|
||||
* Post:section of raw buffer allocated for host use
|
||||
* status of raw buffer updated to prevent future collisions
|
||||
* bank status byte contains buffer's id
|
||||
* buffer status updated from UNALLOC to EMPTY
|
||||
* all other buffer values cleared to zero
|
||||
* Rtn: SUCCESS or ERROR code if unable to allocate
|
||||
*/
|
||||
//uint8_t allocate_buffer( struct buffer *buff, uint8_t new_id, uint8_t base_bank, uint8_t num_banks )
|
||||
uint8_t allocate_buffer( buffer *buff, uint8_t new_id, uint8_t base_bank, uint8_t num_banks )
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
//check incoming args
|
||||
if ( (base_bank+num_banks) > NUM_RAW_BANKS ) {
|
||||
//trying to allocate SRAM past end of raw_buffer
|
||||
return ERR_BUFF_ALLOC_RANGE;
|
||||
}
|
||||
|
||||
//check that buffer isn't already allocated
|
||||
if ( buff->status != UNALLOC) {
|
||||
return ERR_BUFF_STATUS_ALREADY_ALLOC;
|
||||
}
|
||||
if ( buff->id != UNALLOC) {
|
||||
return ERR_BUFF_ID_ALREADY_ALLOC;
|
||||
}
|
||||
|
||||
//check that raw banks aren't allocated
|
||||
for ( i=0; i<num_banks; i++) {
|
||||
if ( raw_bank_status[base_bank+i] != UNALLOC ) {
|
||||
return ERR_BUFF_RAW_ALREADY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
//seems that buffer and raw are free allocate them as requested
|
||||
buff->id = new_id;
|
||||
buff->status = EMPTY;
|
||||
buff->data = &raw_buffer[base_bank];
|
||||
|
||||
//set bank status to bank's id
|
||||
for ( i=0; i<num_banks; i++) {
|
||||
raw_bank_status[base_bank+i] = new_id;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
// 8byte total payload
|
||||
// 185 setup + 185 data + 121 status = 491 bits transferred for 64bit payload = 13.03% bus utilization
|
||||
|
||||
// 32byte total payload
|
||||
// 185 setup + 4*185 data + 121 status = 1046 bits xfrd for 4*64=256 payld = 24.47% bus util
|
||||
|
||||
// 64byte total payload
|
||||
// 185 setup + 8*185 data + 121 status = 1786 bits xfrd for 8*64=512 payld = 28.67% bus util
|
||||
|
||||
// 128byte total payload
|
||||
// 185 setup + 16*185 data + 121 status = 3266 bits xfrd for 16*64=1024 payld = 31.35% bus util
|
||||
|
||||
// 254byte total payload
|
||||
// 185 setup + 32*185-16 data + 121 status = 6210 bits xfrd for 31.8*64=2032 payld = 32.72% bus util
|
||||
// 4.4% speedup than 128
|
||||
|
||||
// 256bytes in 254byte xfr
|
||||
// 185 setup + 32*185-16 data + 121 status = 6210 bits xfrd for 32*64=2048 payld = 32.98% bus util
|
||||
// 0.79% speedup than 254 in 254
|
||||
|
||||
// 256byte total payload
|
||||
// 185 setup + 32*185 data + 121 status = 6226 bits xfrd for 32*64=2048 payld = 32.89% bus util
|
||||
|
||||
// 512byte total payload
|
||||
// 185 setup + 64*185 data + 121 status = 12146 bits xfrd for 64*64=4096 payld = 33.72% bus util
|
||||
// 1% greater bus util compared to 254byte xfr
|
||||
// 2.2% speedup compared to 256 in 254
|
||||
|
||||
|
||||
// Probably decent overall speedup by eliminating multiple status packets. Not sure how many
|
||||
// NAK's the old firmware was sending while the device programmed the entire 256byte buffer.
|
||||
// but one NAK is more than should be necessary.
|
||||
//
|
||||
// Plan is to support max of 254 byte transfers with 2 bytes stuffed in setup packet
|
||||
// Want to compare to 512B long transfers for speed comparison
|
||||
//
|
||||
// Either way, I can setup the buffers in smaller sizes than the transfers. Then a buffer could
|
||||
// start programming mid usb transfer once it's full. Want to make effor to hide flash programming
|
||||
// wait time behind usb transfer time.
|
||||
|
||||
//~16 bytes per buffer...
|
||||
typedef struct buffer{
|
||||
uint8_t *data; //pointer to base buffer's allocated sram
|
||||
uint8_t size; //size of buffer in bytes (max 256 bytes)
|
||||
uint8_t status; //current status of buffer USB load/unload, flashing, waiting, erase
|
||||
uint8_t cur_byte; //byte currently being loaded/unloaded/flashed/read
|
||||
uint8_t reload; //add this number to page_num for next loading
|
||||
uint8_t buff_num; //address bits between buffer size and page number
|
||||
//ie need 2x128 byte buffers making buff_num = A7
|
||||
//ie need 4x64 byte buffers making buff_num = A7:6
|
||||
//ie need 8x32 byte buffers making buff_num = A7:5
|
||||
uint16_t page_num; //address bits beyond buffer's size and buff_num A23-A8
|
||||
//MSB A23-16, LSB A15-8
|
||||
uint8_t mem_type; //SNES ROM, SNES RAM, PRG ROM, PRG RAM, CHR ROM, CHR RAM, CPLD, SPI
|
||||
uint8_t part_num; //used to define unlock commands, sector erase, etc
|
||||
uint8_t multiple; //number of times to program this page
|
||||
uint8_t add_mult; //add this number to page_num for multiple programs
|
||||
//CHR shift LSb to A13 (max 2MByte)
|
||||
//PRG shift LSb to A14 (max 4MByte)
|
||||
//SNES add to MSB of page_num (max 16MByte)
|
||||
uint8_t mapper; //mapper number of board
|
||||
uint8_t mapvar; //mapper variant
|
||||
uint8_t function; //function "pointer" for flash/dump operation control
|
||||
}buffer;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,49 @@
|
|||
|
||||
#include <avr/io.h>
|
||||
|
||||
#include "usbdrv.h"
|
||||
|
||||
//~16 bytes per buffer...
|
||||
typedef struct buffer {
|
||||
uint8_t *data; //pointer to base buffer's allocated sram
|
||||
uint8_t size; //size of buffer in bytes (max 256 bytes)
|
||||
uint8_t status; //current status of buffer USB load/unload, flashing, waiting, erase
|
||||
uint8_t cur_byte; //byte currently being loaded/unloaded/flashed/read
|
||||
uint8_t reload; //add this number to page_num for next loading
|
||||
uint8_t id; //address bits between buffer size and page number
|
||||
//ie need 2x128 byte buffers making buff_num = A7
|
||||
//ie need 4x64 byte buffers making buff_num = A7:6
|
||||
//ie need 8x32 byte buffers making buff_num = A7:5
|
||||
uint16_t page_num; //address bits beyond buffer's size and buff_num A23-A8
|
||||
//MSB A23-16, LSB A15-8
|
||||
uint8_t mem_type; //SNES ROM, SNES RAM, PRG ROM, PRG RAM, CHR ROM, CHR RAM, CPLD, SPI
|
||||
uint8_t part_num; //used to define unlock commands, sector erase, etc
|
||||
uint8_t multiple; //number of times to program this page
|
||||
uint8_t add_mult; //add this number to page_num for multiple programs
|
||||
//CHR shift LSb to A13 (max 2MByte)
|
||||
//PRG shift LSb to A14 (max 4MByte)
|
||||
//SNES add to MSB of page_num (max 16MByte)
|
||||
uint8_t mapper; //mapper number of board
|
||||
uint8_t mapvar; //mapper variant
|
||||
uint8_t function; //function "pointer" for flash/dump operation control
|
||||
}buffer;
|
||||
|
||||
static buffer buff0;
|
||||
static buffer buff1;
|
||||
static buffer buff2;
|
||||
static buffer buff3;
|
||||
static buffer buff4;
|
||||
static buffer buff5;
|
||||
static buffer buff6;
|
||||
static buffer buff7;
|
||||
|
||||
#include "logic.h"
|
||||
#include "shared_dictionaries.h"
|
||||
#include "shared_errors.h"
|
||||
#include "pinport.h"
|
||||
#include "io.h"
|
||||
#include "nes.h"
|
||||
#include "snes.h"
|
||||
|
||||
uint8_t buffer_opcode_no_return( uint8_t opcode, buffer *buff, uint8_t oper1, uint8_t oper2, uint8_t oper3 );
|
||||
void raw_buffer_reset( );
|
||||
uint8_t allocate_buffer( buffer *buff, uint8_t new_id, uint8_t base_bank, uint8_t num_banks );
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _logic_h
|
||||
#define _logic_h
|
||||
|
||||
#define NULL 0x00
|
||||
#define LO 0x00
|
||||
#define HI 0xFF
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,47 @@ USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]) {
|
|||
}
|
||||
break; //end of SNES
|
||||
|
||||
case BUFFER:
|
||||
switch (spacket->opcode) {
|
||||
case BUFF_OPCODE_NRV_MIN ... BUFF_OPCODE_NRV_MAX:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, NULL,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
break;
|
||||
case BUFF_OPCODE_BUFn_NRV_MIN ... BUFF_OPCODE_BUFn_NRV_MAX:
|
||||
switch ( (spacket->opcode) & 0x07) {
|
||||
case 0:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff0,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 1:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff1,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 2:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff2,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 3:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff3,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 4:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff4,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 5:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff5,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 6:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff6,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
case 7:
|
||||
rv[0] = buffer_opcode_no_return( spacket->opcode, &buff7,
|
||||
spacket->operandMSB, spacket->operandLSB, spacket->miscdata );
|
||||
default: //nes opcode min/max definition error
|
||||
rv[0] = ERR_BAD_BUFF_OP_MINMAX;
|
||||
}
|
||||
break;
|
||||
default: //nes opcode min/max definition error
|
||||
rv[0] = ERR_BAD_BUFF_OP_MINMAX;
|
||||
}
|
||||
break; //end of BUFFER
|
||||
|
||||
default:
|
||||
//request (aka dictionary) is unknown
|
||||
rv[0] = ERR_UNKN_DICTIONARY;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "io.h"
|
||||
#include "nes.h"
|
||||
#include "snes.h"
|
||||
#include "buffer.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,185 @@
|
|||
#ifndef _shared_dict_buffer_h
|
||||
#define _shared_dict_buffer_h
|
||||
|
||||
//define dictionary's reference number in the shared_dictionaries.h file
|
||||
//then include this dictionary file in shared_dictionaries.h
|
||||
//The dictionary number is literally used as usb transfer request field
|
||||
//the opcodes and operands in this dictionary are fed directly into usb setup packet's wValue wIndex fields
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
// BUFFER DICTIONARY
|
||||
//
|
||||
// opcodes contained in this dictionary must be implemented in firmware/source/buffer.c
|
||||
//
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
//raw buffer banks & size
|
||||
#define NUM_RAW_BANKS 8
|
||||
#define RAW_BANK_SIZE 32 //in bytes
|
||||
|
||||
//defined here so identical to host and firmware
|
||||
//status values
|
||||
#define EMPTY 0x00
|
||||
//#define ERROR 0x10
|
||||
//#define USB_UNLOADING 0x80
|
||||
//#define USB_LOADING 0x90
|
||||
//#define CHECKING 0xC0
|
||||
//#define DUMPING 0xD0
|
||||
//#define ERASING 0xE0
|
||||
//#define FLASHING 0xF0
|
||||
//#define FLASH_WAIT 0xF8
|
||||
#define UNALLOC 0xFF
|
||||
|
||||
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// OPCODES with up to 24bit operand and no return value besides SUCCESS/ERROR_CODE
|
||||
//=============================================================================================
|
||||
// Detect this opcode/operand setup with opcode between the following defines:
|
||||
#define BUFF_OPCODE_NRV_MIN 0x00
|
||||
#define BUFF_OPCODE_NRV_MAX 0x7F
|
||||
//
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
|
||||
//blindly clear all allocation of raw buffer space
|
||||
//reset all buffers to unallocated
|
||||
#define RAW_BUFFER_RESET 0x00
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
// OPCODES with up to 24bit operand and no return value besides SUCCESS/ERROR_CODE
|
||||
// BUFFER NUMBER denoted in lower nibble of opcode
|
||||
//=============================================================================================
|
||||
// Detect this opcode/operand setup with opcode between the following defines:
|
||||
#define BUFF_OPCODE_BUFn_NRV_MIN 0x80
|
||||
#define BUFF_OPCODE_BUFn_NRV_MAX 0xFF
|
||||
//
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
//allocate firmware sram to a buffer
|
||||
//send a buffer number
|
||||
//buffer size
|
||||
//base address 0-255 (in 32byte chunks)
|
||||
//returns SUCCESS if able to allocate
|
||||
//returns error code if unable to allocate
|
||||
#define ALLOCATE_BUFFER0 0x80
|
||||
#define ALLOCATE_BUFFER1 0x81
|
||||
#define ALLOCATE_BUFFER2 0x82
|
||||
#define ALLOCATE_BUFFER3 0x83
|
||||
#define ALLOCATE_BUFFER4 0x84
|
||||
#define ALLOCATE_BUFFER5 0x85
|
||||
#define ALLOCATE_BUFFER6 0x86
|
||||
#define ALLOCATE_BUFFER7 0x87
|
||||
|
||||
|
||||
|
||||
//~16 bytes per buffer...
|
||||
//as initially defined in firmware
|
||||
//typedef struct buffer{
|
||||
// uint8_t *data; //pointer to base buffer's allocated sram
|
||||
// uint8_t size; //size of buffer in bytes (max 256 bytes)
|
||||
// uint8_t status; //current status of buffer USB load/unload, flashing, waiting, erase
|
||||
// uint8_t cur_byte; //byte currently being loaded/unloaded/flashed/read
|
||||
// uint8_t reload; //add this number to page_num for next loading
|
||||
// uint8_t id; //address bits between buffer size and page number
|
||||
// //ie need 2x128 byte buffers making buff_num = A7
|
||||
// //ie need 4x64 byte buffers making buff_num = A7:6
|
||||
// //ie need 8x32 byte buffers making buff_num = A7:5
|
||||
// //CANNOT BE 0xFF "UNALLOC"
|
||||
// uint16_t page_num; //address bits beyond buffer's size and buff_num A23-A8
|
||||
// //MSB A23-16, LSB A15-8
|
||||
// uint8_t mem_type; //SNES ROM, SNES RAM, PRG ROM, PRG RAM, CHR ROM, CHR RAM, CPLD, SPI
|
||||
// uint8_t part_num; //used to define unlock commands, sector erase, etc
|
||||
// uint8_t multiple; //number of times to program this page
|
||||
// uint8_t add_mult; //add this number to page_num for multiple programs
|
||||
// //CHR shift LSb to A13 (max 2MByte)
|
||||
// //PRG shift LSb to A14 (max 4MByte)
|
||||
// //SNES add to MSB of page_num (max 16MByte)
|
||||
// uint8_t mapper; //mapper number of board
|
||||
// uint8_t mapvar; //mapper variant
|
||||
// uint8_t function; //function "pointer" for flash/dump operation control
|
||||
//}buffer;
|
||||
|
||||
//buffer struct
|
||||
//designed to have multiple buffers instantiated at a time
|
||||
//buffers are effectively objects who get instructed by host
|
||||
//commands include things like reading from cartridge rom/ram
|
||||
//getting filled by usb writes, programming 'themselves' to
|
||||
//where they belong on the cartridge. They know how to get
|
||||
//on/off the cart and have a current status that the host can
|
||||
//query. Host then decides when to refill/dump data from
|
||||
//buffer over usb. Host also can query buffer to get error
|
||||
//codes back and and attempt to resolve issues. Buffers can
|
||||
//also be instructed to verify themselves with a checksum
|
||||
//They can verify themselves against cart rom/ram as well.
|
||||
|
||||
//atmega164 has 1KByte of SRAM
|
||||
//VUSB has max of 254 + wValue/wIndex = max 256 bytes without long transfers
|
||||
//Expecting two 128 byte buffers will be faster than a single 256byte buffer
|
||||
//That way one buffer could be flashing onto the cart while the other is
|
||||
//getting filled 8bytes at a time from USB. this would proide some double
|
||||
//buffering speed ups, but not sure how fast that'll be. Having buffers
|
||||
//as small as 32bytes might be faster for 4-8MB flash memories as they
|
||||
//have ability to flash 32Bytes at once. Could perhaps fill multiple
|
||||
//32B buffers with one larger 128/256B transfer. Increasing transfer size
|
||||
//does speed up overall due to fewer setup and status USB packets.
|
||||
|
||||
//USB control transfer:
|
||||
// SETUP/DATA STAGES:
|
||||
// Token packet- sync, pid, addr, enp, crc5, eop = 35bits
|
||||
// Data/setup packet
|
||||
// sync, pid, crc16, eop = 67bits
|
||||
// setup/payload packet data = 64bits
|
||||
// handsk (sync, pid, eop) = 19bit
|
||||
// total = 185bits with 64bit payload = 34.6% data utilization per data packet
|
||||
// STATUS STAGE:
|
||||
// same as above, but zero lenght data packet.
|
||||
// total 121bits
|
||||
|
||||
// 8byte total payload
|
||||
// 185 setup + 185 data + 121 status = 491 bits transferred for 64bit payload = 13.03% bus utilization
|
||||
|
||||
// 32byte total payload
|
||||
// 185 setup + 4*185 data + 121 status = 1046 bits xfrd for 4*64=256 payld = 24.47% bus util
|
||||
|
||||
// 64byte total payload
|
||||
// 185 setup + 8*185 data + 121 status = 1786 bits xfrd for 8*64=512 payld = 28.67% bus util
|
||||
|
||||
// 128byte total payload
|
||||
// 185 setup + 16*185 data + 121 status = 3266 bits xfrd for 16*64=1024 payld = 31.35% bus util
|
||||
|
||||
// 254byte total payload
|
||||
// 185 setup + 32*185-16 data + 121 status = 6210 bits xfrd for 31.8*64=2032 payld = 32.72% bus util
|
||||
// 4.4% speedup than 128
|
||||
|
||||
// 256bytes in 254byte xfr
|
||||
// 185 setup + 32*185-16 data + 121 status = 6210 bits xfrd for 32*64=2048 payld = 32.98% bus util
|
||||
// 0.79% speedup than 254 in 254
|
||||
|
||||
// 256byte total payload
|
||||
// 185 setup + 32*185 data + 121 status = 6226 bits xfrd for 32*64=2048 payld = 32.89% bus util
|
||||
|
||||
// 512byte total payload
|
||||
// 185 setup + 64*185 data + 121 status = 12146 bits xfrd for 64*64=4096 payld = 33.72% bus util
|
||||
// 1% greater bus util compared to 254byte xfr
|
||||
// 2.2% speedup compared to 256 in 254
|
||||
|
||||
|
||||
// Probably decent overall speedup by eliminating multiple status packets. Not sure how many
|
||||
// NAK's the old firmware was sending while the device programmed the entire 256byte buffer.
|
||||
// but one NAK is more than should be necessary.
|
||||
//
|
||||
// Plan is to support max of 254 byte transfers with 2 bytes stuffed in setup packet
|
||||
// Want to compare to 512B long transfers for speed comparison
|
||||
//
|
||||
// Either way, I can setup the buffers in smaller sizes than the transfers. Then a buffer could
|
||||
// start programming mid usb transfer once it's full. Want to make effor to hide flash programming
|
||||
// wait time behind usb transfer time.
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -107,4 +107,16 @@
|
|||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
#define BUFFER 5
|
||||
#include "shared_dict_buffer.h"
|
||||
//mcu buffer dictionary commands
|
||||
//This library is intended to contain all buffer related opcodes/commands
|
||||
//also contains defines for both host and firmware such as buffer status numbers
|
||||
//=============================================================================================
|
||||
//=============================================================================================
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#define ERR_BAD_IO_OP_MINMAX 130
|
||||
#define ERR_BAD_NES_OP_MINMAX 131
|
||||
#define ERR_BAD_SNES_OP_MINMAX 132
|
||||
#define ERR_BAD_BUFF_OP_MINMAX 133
|
||||
|
||||
|
||||
#define ERR_UNKN_PP_OPCODE_ONLY 140
|
||||
|
|
@ -26,4 +27,13 @@
|
|||
#define ERR_UNKN_SNES_OPCODE_24BOP 170
|
||||
#define ERR_UNKN_SNES_OPCODE_24BOP_8BRV 171
|
||||
|
||||
#define ERR_UNKN_BUFF_OPCODE_NRV 180
|
||||
|
||||
#define ERR_BUFF_ALLOC_RANGE 190
|
||||
#define ERR_BUFF_STATUS_ALREADY_ALLOC 191
|
||||
#define ERR_BUFF_ID_ALREADY_ALLOC 192
|
||||
#define ERR_BUFF_RAW_ALREADY_ALLOC 193
|
||||
|
||||
//max error number 255
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue