developing drivers for custom boards

More
08 Aug 2011 21:21 #12306 by btvpimill
Peter, thank you very much for taking the time to try and explain this to me. I fully understand the snippit posted, I think. Let me make sure:

dbyte := port[ourport+$402];
dbyte := dbyte and $5F;
dbyte := dbyte or $80;
port[ourport+$402] := dbyte;

This grabs the value at port address + 402(hex) - so if 378 is the base, I assume this is 77A?
Then clears bits 5,6,and 7
or's that value with 80, this causes b7=1 b6=0,b5=0,4-0 are left as they were.
then this is written back to 77A

This all sets the port to EPP mode

Next:

DataPort := ourport; { base port address }
ContPort := ourport + ContOfs; {2}
StatPort := ourport + StatOfs; {1}
EPPDataPort := ourport + EPPDataOfs; {4}
EPPAddressPort := ourport + EPPAddressOfs; {3}

I think this all just sets up some constants based on {base port address} *************** How was this value passed to here?

These next 2 are a little trickier:

port[ContPort] := EPPIdleControl; {$04}
port[StatPort] := EPPTimeout; {$01}


I assume from the naming, the first one will initilize the EPP port, or set the Idle to high.
the next line turns on EPP timeout? maybe??

So the million dollar question, where would I run this?

I am sorry for being so dense with this, but this is the whole point for me. So far, I almost know how to add stuff to my comp file, and I almost get how to use HALRUN to do a little peeking and poking (maybe). I have a very limited py ability. No C at all really.

Please Log in or Create an account to join the conversation.

More
08 Aug 2011 23:30 #12309 by btvpimill
Ok, I have been reading the drivers Andy listed on the first page of this thread. This is what I think I understand. If I want to run initlize code, I can place that in my comp and it will be run once. If for some reason I wanted to run it all the time, I would add it to a thread over in HAL. Of course I wouldn't want to, but just trying to get the gist of this.

I am not at all sure what to do with the timeout bit yet, but I will get there.

Now if I want to read the register to see what mode I am in, and display this, is there a way to do this on demand? Like maybe from terminal try:

HALRUN
loadrt constant ioaddr=0x378
start
val=inb(0x378+0x402)
print val

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 01:20 #12314 by PCW
The funny thing about EPP mode is you can still change the handshaking line signals in the normal parallel port control register
so you need to set these in an idle state that makes sense for EPP. That's what the 4 written to the standard parallel port control register does
the 1 written to the status port is to clear any EPP timeout errors which may exist (Depending on chipset a EPP timeout may prevent any EPP
operations)

You are likely to get timeouts if your handshaking is not working so its good to monitor them when testing

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 01:35 #12316 by btvpimill
Well that makes sense. Tomorrow's fun will be to see IF I can query base+$402 to first see with my eyes if BIOS does in fact have the port in EPP mode. Then I shall see if I can first manually set the AS/DS high by writing 4 to control reg. At that point, at least before I try to talk to my card I will be able to verify the lines are correct.

Then I shall try again to talk to the board. I have full hope that all will go well once the setup is done correctly.

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 10:03 #12327 by andypugh
btvpimill wrote:

HALRUN
loadrt constant ioaddr=0x378
start
val=inb(0x378+0x402)
print val

I don't think you can use inb() or outb() at the halcmd prompt.
However, you _can_ use it at the normal (bash?) terminal prompt
linux.about.com/library/cmd/blcmdl2_inb.htm
If you are as unfamiliar with the command line as me:
www.freeos.com/guides/lsst/

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 17:06 - 09 Aug 2011 17:08 #12345 by btvpimill
Well I am back to square 1. I tried to add a function to my comp file, but it wouldn't compile. So I deleted my changes, and now the original won't compile. I think I must need to take a short break from this and try to figure out what I am doing - cuz clearly I don't know. So tonight I am going to study the first 2 listed in this thread. My goal is to understand everything that is going on in them. Maybe then I will be able to create a driver that sets up the port, and talks to my card.

I think this is so frustrating because I Know what must be done, I know why it must be done, but I seem to not have any idea how to convey my desires to the puter.
Last edit: 09 Aug 2011 17:08 by btvpimill.

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 18:03 #12346 by andypugh
btvpimill wrote:

Well I am back to square 1. I tried to add a function to my comp file, but it wouldn't compile.


There is normally some clue as to why it won't compile. What do the error messages say?

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 18:28 #12347 by btvpimill
warnings:
"hal_init" [/tmp/tmpXQaY5h/constant.ko] undifined!
"hal_exit"
hal_export_funct
hal_malloc
hal_pin_bit_newf
rtapi_snprintf
hal_ready
hal_pin_u32_newf
tpapi_print

All the above have the same warning as the first one.

I am trying like this:
sudo comp --install constant.comp

So I am not sure from here. I will add that it does generate the C file using
comp constant.comp

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 18:40 #12348 by btvpimill
just got the same errors trying with Johns simple comp on page 5. Maybe I have screwed up something system wise?

BTW, I know you say I can ignore the warnings, but if I try to loadrt the file, it fails

Please Log in or Create an account to join the conversation.

More
09 Aug 2011 18:59 #12350 by andypugh
This probably isn't the problem, but "constant" is a bad choice of name, as that is a pre-existing hal module.

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.093 seconds
Powered by Kunena Forum