Tutorial for the HPS_IO module

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

SKuRGe911
Atarian
Atarian
Posts: 7
Joined: Wed Oct 11, 2017 4:43 am

Tutorial for the HPS_IO module

Postby SKuRGe911 » Sat Jun 01, 2019 4:24 am

Hi everyone. I am coding a personal project for fpga which will be like a computer that never existed. I'm having some trouble with the sdcard io.
Using the code from the original MiST project doesn't seem to work for accessing an sd card.
Could someone please explain how to use the interface properly to read sd card files if possible a tutorial like the original MiST project had.
I am using the petite fat file system in the software side of things. is this alright because i'm thinking that the actual sdcard is formatted for linux.
Any help would be excellent.
Thanks. :o

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 147
Joined: Sat Nov 25, 2017 4:34 pm

Re: Tutorial for the HPS_IO module

Postby alanswx » Sat Jun 01, 2019 2:26 pm

SKuRGe911 wrote:Hi everyone. I am coding a personal project for fpga which will be like a computer that never existed. I'm having some trouble with the sdcard io.
Using the code from the original MiST project doesn't seem to work for accessing an sd card.
Could someone please explain how to use the interface properly to read sd card files if possible a tutorial like the original MiST project had.
I am using the petite fat file system in the software side of things. is this alright because i'm thinking that the actual sdcard is formatted for linux.
Any help would be excellent.
Thanks. :o


There are three major ways to handle the files. You can use the F and when someone chooses a file from the unix side of the MiSTer it will present it on the ioctl_addr and ioctl_data with ioctl_download set. it will also use the index to tell you which F if you have multiple it is for. The rom will also appear on these with a different index.

You can also mount a file using S - this can be a virtual disk, or a virtual filesystem image. I am not as familiar with the S - but you can look at the Scsi interface in the Mac, or some of the other cores. I think is uses sd_rd, etc.

Finally, there is a MiST compatible SD card reader interface. This should be the last resort, since it requires the SD card to be plugged into the I/O card. I feel like it will probably go away. Take a look at the Atari5200 for some sample code.

SKuRGe911
Atarian
Atarian
Posts: 7
Joined: Wed Oct 11, 2017 4:43 am

Re: Tutorial for the HPS_IO module

Postby SKuRGe911 » Tue Jun 04, 2019 12:45 am

Thanks for the reply.
Ive got the rom download working with ioctl lines. that works fine but when it comes to mounting the virtual disk image i'm not too sure how that works.
Ive loaded an image but i'm not sure of how to format it to work with petite fat code. i was thinking i could mount the image and use some code in the rom to format the image but am unsure of how to do that.
what kind of format does the mounted image have to be in. because i have tried a few ways and they all fail.

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 147
Joined: Sat Nov 25, 2017 4:34 pm

Re: Tutorial for the HPS_IO module

Postby alanswx » Tue Jun 04, 2019 1:37 am

SKuRGe911 wrote:Thanks for the reply.
Ive got the rom download working with ioctl lines. that works fine but when it comes to mounting the virtual disk image i'm not too sure how that works.
Ive loaded an image but i'm not sure of how to format it to work with petite fat code. i was thinking i could mount the image and use some code in the rom to format the image but am unsure of how to do that.
what kind of format does the mounted image have to be in. because i have tried a few ways and they all fail.

Do you need a disk image or can you just load file by file?

SKuRGe911
Atarian
Atarian
Posts: 7
Joined: Wed Oct 11, 2017 4:43 am

Re: Tutorial for the HPS_IO module

Postby SKuRGe911 » Tue Jun 04, 2019 1:42 am

what i really need is a disk image with my files on it to load as needed. so i'm using petite fat for the software side of things. just gota figure out how i will format the disk image i need to mount.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5393
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Tutorial for the HPS_IO module

Postby Sorgelig » Tue Jun 04, 2019 6:48 am

SKuRGe911 wrote:what i really need is a disk image with my files on it to load as needed. so i'm using petite fat for the software side of things. just gota figure out how i will format the disk image i need to mount.

What you are asking is beyond the MiSTer scope.
HPS side provides the way to mount and access the image by 512byte blocks through sd_* signals. You write the core emulating your system and accessing the image through these sd_* signals. Everything related to formatting or loading the files from mounted image is completely up to emulated system - it's black box for MiSTer. MiSTer doesn't know what's inside the image.

brouhaha
Atarian
Atarian
Posts: 1
Joined: Tue Jun 04, 2019 6:59 am

Re: Tutorial for the HPS_IO module

Postby brouhaha » Tue Jun 04, 2019 7:04 am

I'm working on my first new core and trying to use SD files. Things are working OK for me with a single SD file, but not so well when I try to use more than one (by using sd_rd[1], img_mounted[1], etc.). I think it would help me understand things to look at the code for the "other side" of HPS_IO. Where is that implemented? I expected it would be in C++ code in the Main_MiSTer repo, but so far I haven't found it.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5393
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Tutorial for the HPS_IO module

Postby Sorgelig » Tue Jun 04, 2019 7:18 am

brouhaha wrote:I expected it would be in C++ code in the Main_MiSTer repo, but so far I haven't found it.

yes, it's there: user_io.cpp: sd_image


Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 10 guests