developing drivers for custom boards
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
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.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
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.
- PCW
- Offline
- Moderator
- Posts: 17904
- Thank you received: 4774
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.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
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.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
I don't think you can use inb() or outb() at the halcmd prompt.HALRUN
loadrt constant ioaddr=0x378
start
val=inb(0x378+0x402)
print val
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.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
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.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
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.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
"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.
- btvpimill
- Offline
- Elite Member
- Posts: 229
- Thank you received: 3
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.
- andypugh
- Offline
- Moderator
- Posts: 23559
- Thank you received: 4858
Please Log in or Create an account to join the conversation.