Author Topic: Everdrive SDK / SD card IO  (Read 2236 times)

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Everdrive SDK / SD card IO
« Reply #45 on: March 09, 2014, 09:58:05 PM »
Haven't done much for the past two weeks - since the last update I've been working on file position seeking - ie, read all the sectors in a cluster for a file, lookup the next cluster from the FAT table. Things are still moving, albeit slowly, due to my simultaneous work on the Cyber Knight translation and, as Lochlan said, my wife and I have just sold our house, so virtually all of my electronics and games are now packed up or in storage. I can still develop on my laptop of course, but it will be difficult to test anything on real hardware for the next month or so.

Don't worry, it's my intention to get at least full file read support working. You can of course use it to read file data from the SD card now, even with the functions that are already there. Just seeking (and thus FAT traversal) needs to be finished for full read support via fread().

pceslayer

  • Full Member
  • ***
  • Posts: 205
Re: Everdrive SDK / SD card IO
« Reply #46 on: March 14, 2014, 04:53:10 AM »
any progress?

If you looked in the Cyber Knight thread (next to this one), where megatron is also active, you'll note that he is busy with a move.

And IDK if he feels this way, but IMO it's pretty rude to ask for status updates like this unless it's been like several months.  You'll get your free software when you get it.  I definitely understand the anticipation, though, I'm looking forward to this release as well!

I stumbled across Mooz original thread on a different forum and saw megatron-uk had picked it up and ran with it on here.

So I asked... Didn't mean to be rude... sorry

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #47 on: March 17, 2014, 02:53:26 AM »
Hello there!

I'll resume working on write operation anytime soon. I got busy with demo stuffs...

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Everdrive SDK / SD card IO
« Reply #48 on: March 17, 2014, 06:02:52 AM »
Hey!

Long time no see  :D

I've not done much for a good few weeks now either - got sidetracked by Cyber Knight translation and the fact that all my toys are packed up and in storage in anticipation of moving now!

Hope to get some more work done on the API side of things for HuC when things calm down a bit!  :lol:

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #49 on: March 19, 2014, 08:06:16 AM »
First things first...HuC complained about some text in the comments. In the end it was a newline issue. I had to add the byte flag to fopen calls in io.c. I can post a patch for the curious ones.

Anyway! It seems that something is missing. pceas complains about an undefined routine called _mem.
Maybe you forgot to add some file? It's called in fat-files-extras.h.
By the way, it feels that something have been eaten from line 432.

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Everdrive SDK / SD card IO
« Reply #50 on: March 19, 2014, 11:03:54 AM »
I'm afraid the get next sector code isn't implemented yet.

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #51 on: March 19, 2014, 11:57:14 AM »
Good news!
I managed to make disk_write_single_sector work. But there's something weird.
Right after sending the 512 bytes, you write the 2 bytes CRC and read some kind of status. If you do a bitwise and with $1f and get 5, the write is supposed to be ok. Then you wait for the end of the transfer (which is something like while(spi_reg != 0xff) { nop; }).
But in my case, I'm getting $ff when I'm reading the write status...

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #52 on: March 24, 2014, 09:29:10 AM »
Long live to Microchip engineers! Thanks to their PIC code, I managed to fix Single Sector write.
Next is Multiple Sector writes.

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Everdrive SDK / SD card IO
« Reply #53 on: March 24, 2014, 10:06:22 AM »
That sounds as though it was a hardware bug with write support? Is that the case?

If so, then bloody well done for figuring that out!  :clap:

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #54 on: March 25, 2014, 02:01:19 AM »
It's not a hardware bug. It's just that sd cards are a little bit picky about writing.

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #55 on: January 01, 2015, 08:09:14 AM »
Multiple sector writes are finally working! I still need to add the C "export".
By the way, I tried to compile with the "new" HuC and it's complaining about long lines and some other weird stuffs (why were the underscore removed from _si, _cl and co?).

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: Everdrive SDK / SD card IO
« Reply #56 on: January 01, 2015, 08:47:39 AM »
Heya Moozy.

'fraid I don't see Megatron posting much anymore, might want to PM him. He went from most prolific updater to MIA.
« Last Edit: January 01, 2015, 10:50:44 AM by NightWolve »

MooZ

  • Newbie
  • *
  • Posts: 34
Re: Everdrive SDK / SD card IO
« Reply #57 on: January 01, 2015, 09:00:31 AM »
Blame kids and xmas :)

megatron-uk

  • Full Member
  • ***
  • Posts: 219
Re: Everdrive SDK / SD card IO
« Reply #58 on: September 15, 2015, 01:00:22 AM »
Hey all,

I've just spent a few hours working on the Everdrive-fat libraries over the past couple of days (where has the time gone???).

I've refactored a few things as well as added some missing 32bit math functions I needed (subtraction, for one). It should be easier to follow now.

I too had a problem using the later versions of huc and pceas, so I've gone back to the 3.21 release. A shame, as the new version with struct support would have made things a lot more compact (all the free fat drivers out there are ansi-c and use structs extensively).

Anyway, I'm now working on the get-next-cluster and get-next-sector code, so reading the entirety of a file from the SD card should not be far off.

Everything is on github, as usual: https://github.com/megatron-uk/everdrive-fat

trapexit

  • Newbie
  • *
  • Posts: 19
Re: Everdrive SDK / SD card IO
« Reply #59 on: September 15, 2015, 02:54:15 AM »
Quote
I too had a problem using the later versions of huc and pceas

What problems? Best to try and get them addressed.