lkml.org 
[lkml]   [2000]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectoff topic a bit but i realy need help c++ and kernel
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt>hi i am writing a video kernel driver for linux lexos and have got
stuck</tt><tt></tt>
<p><tt>this is how NVIDIA do their regs</tt><tt></tt>
<p><tt>#define NV_PFIFO_RAMHT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00002210 /* RW-4R */</tt>
<br><tt>#define NV_PFIFO_RAMHT_BASE_ADDRESS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
8:4 /* RWIUF */</tt>
<br><tt>#define NV_PFIFO_RAMHT_BASE_ADDRESS_10000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00000010 /* RWI-V */</tt>
<br><tt>#define NV_PFIFO_RAMHT_SIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
25:24 /* RWIUF */</tt>
<br><tt>#define NV_PFIFO_RAMHT_SEARCH_16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00000000 /* RWI-V */</tt>
<br><tt>#define NV_PFIFO_RAMHT_SEARCH_32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00000001 /* RW--V */</tt>
<br><tt>#define NV_PFIFO_RAMHT_SEARCH_64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00000002 /* RW--V */</tt>
<br><tt>#define NV_PFIFO_RAMHT_SEARCH_128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0x00000003 /* RW--V */</tt><tt></tt>
<p><tt>this can be used like setreg( NV_PFIFO_RAMHT , htbase &lt;&lt; (
0 ? NV_PFIFO_RAMHT_BASE_ADDRESS)) ;</tt>
<br><tt>but i wont to make it better so i tried it this way</tt><tt></tt>
<p><tt>#define NV_PFIFO_RAMHT_BASE_ADDRESS 0x00002210:8:4:3 /* address
: high bit : low bit : mode 3 = rw</tt>
<br><tt>this seemed much better all on one line so you can do setreg(NV_PFIFO_RAMHT_BASE_ADDRESS
, htbase) ;</tt>
<br><tt>but ( 2 ? 1:2:3 ) dose not work</tt>
<br><tt>and NV_PFIFO_RAMHT_BASE_ADDRESS 0x00002210,8,4,3 dose not work
as setreg(a,h,l,m) thinks this is</tt>
<br><tt>all one agr</tt>
<br><tt>the other would be to have it as a big struct</tt><tt></tt>
<p><tt>but then compiler can not optimize it ( i think )</tt>
<br><tt>if i can use #define 's the it quicker and setreg can be an inline
asm marco</tt><tt></tt>
<p><tt>how would it work if i used 64 bit like this</tt><tt></tt>
<p><tt>bits 32 - 63 reg address</tt>
<br><tt>bits 24 - 31 high bit</tt>
<br><tt>bits 16 - 23 low&nbsp; bit</tt>
<br><tt>bits 0&nbsp; - 7&nbsp; mode</tt><tt></tt>
<p><tt>#define NV_PFIFO_RAMHT_BASE_ADDRESS&nbsp; 0x0000221008040003</tt><tt></tt>
<p><tt>so if i sent this to the setreg(unsigned long long , data) asm macro
it would be in EAX:EDX (64 bit)</tt>
<br><tt>can the kernel use (long long) and (unsigned long long)&nbsp; (
64 bit ints)</tt><tt></tt>
<p><tt>that 64 bit way look good but is it ?</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
( opps i wold need an extr 32 bits for value but can have 64:32 i think
)</tt><tt></tt>
<p><tt>has anyone got any help they can give me on this !please email me
thank you!</tt>
<br><tt>as i am stuck</tt>
<br><tt>also is there a down loadable book on c++ as i am just learning
from others ppl code and really</tt>
<br><tt>need a book to do it right</tt><tt></tt>
<p><tt>thank you david rundle &lt;sector2@ihug.co.nz></tt>
<br><tt>&nbsp;</tt>
<br><tt></tt>&nbsp;
<br><tt></tt>&nbsp;
<br><tt></tt>&nbsp;
<br><tt></tt>&nbsp;
<br><tt></tt>&nbsp;
<br><tt></tt>&nbsp;</html>
\
 
 \ /
  Last update: 2005-03-22 12:45    [W:0.048 / U:1.880 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site