Commit Graph

21 Commits

Author SHA1 Message Date
Virgil Dupras b745f49186 Rename blockdev's API routines to GetB/PutB
The goal is to avoid mixing those routines with "character devices"
(acia, vpd, kbd) which aren't block devices and have routines that
have different expectations.

This is a first step to fixing #64.
2019-10-30 16:59:35 -04:00
Virgil Dupras 69fc2e3bf2 sdc: make sdcReadBlk return error on max retries
It previously returned success!
2019-06-19 13:22:07 -04:00
Virgil Dupras 66fbd20e21 sdc: tidy up 2019-06-19 09:24:16 -04:00
Virgil Dupras d9ae82c81e sdc: enable CRC checks on blk write 2019-06-19 09:00:50 -04:00
Virgil Dupras 2ac16d4750 sdc: check CRC during sdcReadBlk
When there's a mismatch, retry up to a certain number of times.

This makes random problem related to assembling big kernels go away! But
it also make SD card reading much slower...
2019-06-18 22:03:48 -04:00
Virgil Dupras cac9acca67 sdc: make some space in memory for buffer CRC 2019-06-18 15:21:58 -04:00
Virgil Dupras 34db493496 sdc: implement CRC7 computation on cmds
For now, this achieves nothing else than wasting cycles, but this is the
first step in enabling CRC verifications (CMD59).

I think that this is where my random problems with assembling large
kernels from SDC come from: bad data that isn't detected. If that
happens when PGM loads programs in memory, then anything can happen.

`sdct`, when ran often enough, will error out or corrupt away (go
crazy)...
2019-06-18 14:45:55 -04:00
Virgil Dupras 914c6d5abc Update comments 2019-06-17 13:42:53 -04:00
Virgil Dupras 3e7d181d3c zasm: properly raise error on bas ioPutC calls 2019-06-15 20:01:17 -04:00
Virgil Dupras 92a04f4627 sdc: support 24-bit addressing
Needed if we want to compile the kernel and zasm from within a SD card.
I didn't go straight for 32-bit because it was significantly more
complex and 24-bit give us 16M. Enough to go on for a while...
2019-06-15 13:41:20 -04:00
Virgil Dupras 145b48efb7 Add apps/sdct
A new app to stress test the SD card driver. Also, accompanying this
commit, changes solidifying the SD card driver so that stress tests
actually pass :)
2019-06-10 15:54:15 -04:00
Virgil Dupras 495d69c1cb sdc: make writing more solid
By not waiting until the SD card wan't busy any more after a write, we
exposed ourselves to errors if another operation was attempted right
after it.
2019-06-07 14:59:53 -04:00
Virgil Dupras e046081900 sdc: add second buffer 2019-06-06 22:16:57 -04:00
Virgil Dupras db24e21276 sdc: add layer of indirection to buffer system
Also, lay out the plan for adding a second buffer.
2019-06-06 15:57:32 -04:00
Virgil Dupras ae028e3a86 blockdev: make implementors "random access"
This huge refactoring remove the Seek and Tell routine from blockdev
implementation requirements and change GetC and PutC's API so that they
take an address to read and write (through HL/DE) at each call.

The "PTR" approach in blockdev implementation was very redundant from
device to device and it made more sense to generalize. It's possible
that future device aren't "random access", but we'll be able to add more
device types later.

Another important change in this commit is that the "blockdev handle" is
now opaque. Previously, consumers of the API would happily call routines
directly from one of the 4 offsets. We can't do that any more. This
makes the API more solid for future improvements.

This change forced me to change a lot of things in fs, but overall,
things are now simpler. No more `FS_PTR`: the "device handle" now holds
the active pointer.

Lots, lots of changes, but it also feels a lot cleaner and solid.
2019-06-04 15:36:20 -04:00
Virgil Dupras 5e5c7e6592 sdc: add sdcPutC
Wriiiiiite!
2019-06-01 19:53:42 -04:00
Virgil Dupras 3bc7cec03a sdc: allow the read of 0xff
That took an embarrasingly large amount of time to debug for something,
in the end, so obvious...
2019-05-31 21:33:42 -04:00
Virgil Dupras a641a94853 sdc: make sector swapping more robust
It would previously only work when GetC-ing our way into a new sector.
Seeking into one would not work. Now it's much more robust and this
paves the way for write support.
2019-05-30 14:55:38 -04:00
Virgil Dupras 312e95479e sdc: fix bug preventing us from reading beyond first sector 2019-05-28 13:12:08 -04:00
Virgil Dupras 8cfe834edb recipes/rc2014/sdcard: use "sdci" and blockdev rather than user prog 2019-05-28 11:01:17 -04:00
Virgil Dupras 7fad3b0c90 Move /parts/z80 to /kernel
Let go of that "meta os" thing. it's not as meta as I made it sound
like. It's a kernel.
2019-05-19 11:19:41 -04:00