USB_4_DEX hello all,
I'm working on creating a USB driver for DEX. I have a few issues at the moment, tough, that are quite hard to nail down.
1. I'm basically unfamiliar with the PCI bus. I'm using code from the FASM forum (ASHLEY4) to find the device, but beyond that I'm a bit lost. I only have to access 3-4 registers through PCI, anyway, and that's upon initialization. any help there would be greatly appreciated.
2. The UHCI 1.1 spec says the controller must be told where to map itself in the I/O space, that's right <in> and <out> ops to get to the USB registers. I have no problem with that, but I've only done low-level coding on my home made z80 machines, again unfamiliar with where the PC would put things in it's I/O region, and the controller defaults to 0000h. :evil:
Those are the two problems really bugging me at the moment. OS loading functions via USB will be done with the simplest possible instance of USB control, a single Queu Head followed by the full transfer worth of Transfer Descriptors, created by code which finds size of file. Not overly efficient, but very safe with a tighter code base and memory requirements than other methods. Every USB structure takes up at least 32 bytes, making this memory-expensive considering transfer per TD is max 64 bytes.
Well, other than probably the two most important things, I have the rest basically drawn out, trying to find specs on Mass Storage and HID, to determine what control packets they need.
Dex- 01-14-2005
My knowledge, on the PCI bus is also very basic. but i know some one who is a pro bios programmer, so is in a lot better position to help you.
I will PM his email address.
Here is some code from RDOS operating system, for pci, may help.
http://myfilebucket.com/u/ASHLEY40/pci.asm
bubach- 01-15-2005
just one question, did you ever compile and test RDOS? i thought it looked cool with that many sourcefiles on everything, but i couldn´t compile it for some reason (can´t remember why).
would be fun to test it if you know of any image-file.
/ Christoffer
Dex- 01-15-2005
I got a early ver working (may be about 2years ago), but got the same as you lately :cry:.
tonyMac- 01-19-2005
OK, this is an important question:
I'm writing PCI code to find USB controllers at boot time using the PCI BIOS (int 1ah). I've also put a table of values at the beggining of the kernel, like is_PCI, is_USB, is_whatever, MemSize. I'm wondering if that would be a good idea for something to keep, so that different drivers could access the table to determine if their hardware is present, speeding up loading after the switch to PMode, and keeping such data below 1 MB. I'm also working on a routine to find all PCI devices on the system, and put them in a table, too, that way all the <in> and <out> searching will be gone, and just register access of already known devices will exist. ASHLEY4 said something about the size of the kernel, well the data tables make it larger, but the more compact code could probably reduce it in the long run by cutting down on redundant code, like PCI scanning by every driver that accesses a PCI device.
Just a thought, and some possible structure for a driver interface,
tonyMac
Dex- 01-19-2005
Basically i agree with all your points tonyMac, what i want programmer to do is add what they think will make DEX a better OS, then post a demo, we will all test it, if we like it, it stays, if not, we will try another idea, i thing v2os 64a has somethink like you describe.
What i think will be good is if we come up with a interface for things like sound, graphic etc, these will be blank function that just print "Not implemented", so programmers can write to these functions to say use sound, if no sound driver is installed than, then there program can print " No Sound Found", but when we make sound drivers, they will replace these functions.
I think your are doing a great job with the USB module,but your job is made much harder by the fact that a lot of things, that you really need are not in place :cry: .
Remember DEX is not in its first release, untill then we can change anything.
I am not to bothered about size, we will cut the fat out later :wink: .
PS: I think we need to come up some driver interfaces, any ideas ?.
tonyMac- 01-20-2005
I'm tyring to come up with a standard request for USB services, so that there is some level of abstraction between the driver and the hardware code, so maybe if I get as far a EHCI, I won't be writing new higher-level drivers, just ading a few lines so they can tell the difference. I've decided that my job actually isnt' that hard, other than alligning everything in memory correctly because the controler steps through it itself. For instance, I think the overall size of the Frame list and complexity of the structures is due to the fact that multi-tasking can place several different requests on at the same time. Single-tasking doesn't have this issue, unless a program itself requests multiple things, and that's not difficult, as I'm sure no more than 3 things at once will be required at any given time, ok, maybe 4. (mouse, keyb, hdd, floppy)
Anyway, a request-based interface would probably be the best bet, with some sort of system address to the device, a read or write marker, and a pointer to the data. Of course, that's what Linux does, treating everything as a file, so I dunno. once I get the PCI ironed out, and find a suitable I/O space, I'll begin testing USB with some basic routines. So far I've been making lots of bugs. :shock: :lol:
I've got to figure out what value is passed back if there is no PCI device present, because I'm overrunning my buffer for number of devices because it's trying to put every space from the 16 bit descriptor in there. I've found a lot of real PCI data, but most is pay-to have it. :evil: Ugh, copyrights on open standards. Well, I'm back to the coding room, I've got to turn off this machine, it's my test subject. :lol:
Dex- 01-20-2005
Sounds like your doing a great job :) , i bean having some problems, not only do i have a cold :cry:, but i have a weird problem, when loaded from the floppy the pong demo works fine, but when loaded from the cd, the ball is missing, the paddles move, but no ball :? and it the same on all my test PC and on differant disk, so i have to track down the problem.
Have you seen this by Jeff, its not much, but may help? .
http://www.waste.org/~winkles/hardware/pci.htm I found the problem, it was my fault :roll: , i broke the golden rule, for loading files by the OS,
eg: make shore the register are in a known state, on startup of a program .
The loading from the cd, must of left a number in a reg, that changed, the way the ball worked.
Now all regs are set to 0 on startup of a program, other than the ds, es, etc.
tonyMac- 01-21-2005
That's the link he sent me, that's where I got the BIOS stuff to do the 16bit scan.
I can't seem to get to the Data, though, due to the fact my past programming was done in an environment with 64k total address range, so the whole segment thing is out of my scope. Why did Intel make such a stupid processor? It had a weak instruction set, too, compared even with some of the older 8 bit processors. Of course, look at the beauty behind the P4. They knocked efficiency to nothing so they could move clock speed through the roof, resulting in a really disappointing performance increase.
In any case, I'm struggling through the PCI world, so I can start on the USB one. PCI-SIG copyrighted all their documents and make you pay to download them, so I can't get the real specification without paying a lot. I'm doing some searching right now, as soon as I get my dialup back online (it just cut out, stupid thing).
So you'll have a CD version soon? good, I'm going to try to get a simplest case driver working, just a file loader, Once I'm sure where the Class Code info is on these controllers instead of searching for all of them by device ID. My head is spinning, so much info, but none of what I really need! :shock:
Well, I'll keep you posted
tonyMac- 01-21-2005
Hmmm... M$ may have the info I need.... :twisted:
It's good of Uncle Bill to be there for us.
http://www.microsoft.com/whdc/system/bus/default.mspx
These are in reference to windows, but one can't be picky. I see they include links to those wonderful people who want to sell their info on the "open system bus architecture". These companies/groups are unbelievable.
Dex- 01-21-2005
Watch your back, if M$ :twisted: is giving it away free theres got to be a catch :lol:
The CD support will be very basic at first no dirs, just load from the root dir (like the floppy does).
Dir will be added, but when we know the driver works OK.
Do you think we should add Hdd support in the up coming releases ?.
PS: look forward to your updates :) .
jas2o- 01-21-2005
Hdd support. Which do you mean? Boot from hdd or read from hdd?
If boot. How will it? Command line before the os starts? It is F5 that brings up a boot screen right?
It does sound good to me as long as I don't have to remove:Micro$oft Windoze XP WILL TAKE OVER YOUR BUSINESS EDITIONI XP just because it is something to keep my laptop alive.
If micro$oft teamed up with v2os. What would happen?
Jas2o
PS: I was in jaycar the other day (electronics shop in Australia) and a guy recommended that I learn 'visual basic' and 'c'. But I would prefer to learn asm.
Dex- 01-21-2005
Hi jas2o, not heard from you in a couple of days, i was meaning read from Hdd, the other (as in booting from the Hdd ) can be done now if you had a spare small hdd and a spare pc as bootprog can boot from a fat16 hdd.
But with out being able to read the hdd or add to it from the comand line, it would be pretty useless.
crc- 01-21-2005
Please add HDD support soon! I'll be able to test it more easily then :)
I've written an HDD driver already for my OS, if you want to see it, I'll post it here.
jas2o- 01-21-2005
I don't post because I don't program very much (so I can't answer programming questions) and I can't answer some questions (like interface i think it was).
I'm still here, I just don't post. I was looking through the messages before mine and I can't find my name. It goes like this: tonyMac , ASHLEY4 , bubach , ASHLEY4 , tonyMac , ASHLEY4 , tonyMac , ASHLEY4 , tonyMac , tonyMac , ASHLEY4 , jas2o , ASHLEY4 , crc
Read from hdd ok. If you boot from floppy would we soon be able to read from cd?
If you boot from cd could a ram drive be made (or something) so we can change the cd to a music cd (if you put cdpod in)?
I'll go back into the shadows now.
Jas2o
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.