LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   readw(port, int) (https://www.linuxquestions.org/questions/programming-9/readw-port-int-293720/)

rhoyerboat 02-23-2005 01:57 AM

readw(port, int)
 
Im working on my -old- sound card drivers. Its neomagic 256AV where a sound buffer is located in the video memory and it crashes X when the audio is played while the video memory is being
utilized.

the compiler tells me (Improver lvalue in assignment (var) variable in <expression>) on lines
of code which call readb, readw, or readl from pci/io.h .. what boggles me about it is the variable
which must be passed to these functions, the "offset" is declared as "int offset" in each
nm256_readx prototype. This unrestricted variable will assume the address of some crucial
video memory segment and crash a large portion, but not all, of the system. Ive isolated the bugger with a "if (&offset >= buffer_top); { printk("Doing it again!\n") }" line inserted before
the prototype returns, when i load the module it goes "doing it again!/ndoing it again!" a certain number of times before continuing, only four different addresses are returned if i make it print the offset where the overflow is occuring. on one boot it returns two addresses, two at A then two at B then two at A then two at B .. however many times im not sure yet. I cant remember how to make it print hex values but i dont think thats so important. I need to keep it from growing into that region of memory, but im not sure how to do that, (psuedocode) if buffer_top-&offset==
range->getting_smaller;{reset_buffer(buffer)} ?? *shrug*

when i run the sound card in X the printk runs too, but the XMMS program and the sound drivers crash. not that i care about X so much but i need to do something so this is what im doing.

and if anyone has a hint as to what the nm256_coefficients table is for it might prove to be enlightening for me.. anyway anything someone has to say will be appreciated greatly
appreciated.

pax
andrew


All times are GMT -5. The time now is 06:01 AM.