| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
||
| 3 | <title>Procyon AVRlib: net/prism2.c Source File</title> |
||
| 4 | <link href="dox.css" rel="stylesheet" type="text/css"> |
||
| 5 | </head><body> |
||
| 6 | <!-- Generated by Doxygen 1.4.2 --> |
||
| 7 | <div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> |
||
| 8 | <div class="nav"> |
||
| 9 | <a class="el" href="dir_000001.html">net</a></div> |
||
| 10 | <h1>prism2.c</h1><a href="prism2_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file prism2.c \brief Prism2 802.11b Wireless-LAN Interface Driver. */</span> |
||
| 11 | 00002 <span class="comment">//*****************************************************************************</span> |
||
| 12 | 00003 <span class="comment">//</span> |
||
| 13 | 00004 <span class="comment">// File Name : 'prism2.c'</span> |
||
| 14 | 00005 <span class="comment">// Title : Prism2 802.11b Wireless-LAN Interface Driver</span> |
||
| 15 | 00006 <span class="comment">// Author : Pascal Stang</span> |
||
| 16 | 00007 <span class="comment">// Created : 12/27/2004</span> |
||
| 17 | 00008 <span class="comment">// Revised : 1/7/2005</span> |
||
| 18 | 00009 <span class="comment">// Version : 0.1</span> |
||
| 19 | 00010 <span class="comment">// Target MCU : Atmel AVR series</span> |
||
| 20 | 00011 <span class="comment">// Editor Tabs : 4</span> |
||
| 21 | 00012 <span class="comment">//</span> |
||
| 22 | 00013 <span class="comment">// Description : This driver provides initialization and transmit/receive</span> |
||
| 23 | 00014 <span class="comment">// functions for the Prism2 802.11b Wireless-LAN Controller.</span> |
||
| 24 | 00015 <span class="comment">//</span> |
||
| 25 | 00016 <span class="comment">//*****************************************************************************</span> |
||
| 26 | 00017 |
||
| 27 | 00018 <span class="preprocessor">#include <avr/io.h></span> |
||
| 28 | 00019 <span class="preprocessor">#include <avr/interrupt.h></span> |
||
| 29 | 00020 <span class="preprocessor">#include <string.h></span> |
||
| 30 | 00021 |
||
| 31 | 00022 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span> |
||
| 32 | 00023 <span class="preprocessor">#include "<a class="code" href="timer_8h.html">timer.h</a>"</span> |
||
| 33 | 00024 <span class="preprocessor">#include "<a class="code" href="rprintf_8h.html">rprintf.h</a>"</span> |
||
| 34 | 00025 <span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span> |
||
| 35 | 00026 |
||
| 36 | 00027 <span class="preprocessor">#include "<a class="code" href="net_8h.html">net.h</a>"</span> |
||
| 37 | 00028 <span class="preprocessor">#include "<a class="code" href="prism2_8h.html">prism2.h</a>"</span> |
||
| 38 | 00029 |
||
| 39 | 00030 <span class="comment">// include configuration</span> |
||
| 40 | 00031 <span class="preprocessor">#include "<a class="code" href="prism2conf_8h.html">prism2conf.h</a>"</span> |
||
| 41 | 00032 |
||
| 42 | 00033 u16 TxHeader[34]; |
||
| 43 | 00034 |
||
| 44 | <a name="l00035"></a><a class="code" href="group__nic.html#ga0">00035</a> <span class="keywordtype">void</span> <a class="code" href="group__nic.html#ga0">nicInit</a>(<span class="keywordtype">void</span>) |
||
| 45 | 00036 { |
||
| 46 | 00037 prism2Init(); |
||
| 47 | 00038 } |
||
| 48 | 00039 |
||
| 49 | <a name="l00040"></a><a class="code" href="group__nic.html#ga1">00040</a> <span class="keywordtype">void</span> <a class="code" href="group__nic.html#ga1">nicSend</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* packet) |
||
| 50 | 00041 { |
||
| 51 | 00042 u16 i; |
||
| 52 | 00043 u16 txfid; |
||
| 53 | 00044 u08 stat; |
||
| 54 | 00045 <span class="comment">// request free buffer space to store outgoing frame</span> |
||
| 55 | 00046 prism2Command(PRISM2_CMD_ALLOC, len+44+14+6); |
||
| 56 | 00047 <span class="comment">// wait for buffer to be allocated</span> |
||
| 57 | 00048 <span class="keywordflow">while</span>( !(prism2Read16(PRISM2_REG_EVSTAT) & PRISM2_EVENT_ALLOC) ); |
||
| 58 | 00049 <span class="comment">// get the buffer FID</span> |
||
| 59 | 00050 txfid = prism2Read16(PRISM2_REG_ALLOCFID); |
||
| 60 | 00051 <span class="comment">// ACK the alloc event</span> |
||
| 61 | 00052 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_ALLOC); |
||
| 62 | 00053 |
||
| 63 | 00054 <span class="comment">// rprintf("PRISM2: TxFID=0x");</span> |
||
| 64 | 00055 <span class="comment">// rprintfu16(txfid);</span> |
||
| 65 | 00056 <span class="comment">// rprintfCRLF();</span> |
||
| 66 | 00057 |
||
| 67 | 00058 <span class="comment">// adjust packet length because MAC addresses and type</span> |
||
| 68 | 00059 <span class="comment">// will be written seperately from packet payload</span> |
||
| 69 | 00060 len-=14; |
||
| 70 | 00061 |
||
| 71 | 00062 <span class="comment">// write the outgoing frame to BAP</span> |
||
| 72 | 00063 <span class="comment">// begin with control structure</span> |
||
| 73 | 00064 prism2SetupTxHeader(TxHeader); |
||
| 74 | 00065 |
||
| 75 | 00066 <span class="comment">// write dest and src MAC addresses</span> |
||
| 76 | 00067 <span class="keywordflow">for</span>(i=0;i<6;++i) |
||
| 77 | 00068 TxHeader[23+i] = packet[i*2+1]<<8 | packet[i*2]; |
||
| 78 | 00069 <span class="comment">// write length</span> |
||
| 79 | 00070 TxHeader[29] = <a class="code" href="group__net.html#ga2">htons</a>(len+8); |
||
| 80 | 00071 <span class="comment">// write type</span> |
||
| 81 | 00072 TxHeader[33] = packet[13]<<8 | packet[12]; |
||
| 82 | 00073 |
||
| 83 | 00074 <span class="comment">// debugPrintHexTable(34*2, (u08*)TxHeader);</span> |
||
| 84 | 00075 <span class="comment">// rprintfCRLF();</span> |
||
| 85 | 00076 <span class="comment">// debugPrintHexTable(len, &packet[14]);</span> |
||
| 86 | 00077 |
||
| 87 | 00078 <span class="comment">// write Tx header out to BAP</span> |
||
| 88 | 00079 prism2WriteBAP0(txfid, 0, TxHeader, 34); |
||
| 89 | 00080 <span class="comment">// write packet out to BAP</span> |
||
| 90 | 00081 prism2WriteBAP0(txfid, 68, (u16*)&packet[14], (len+1)>>1); |
||
| 91 | 00082 <span class="comment">// issue transmit command </span> |
||
| 92 | 00083 stat = prism2Command(PRISM2_CMD_TX, txfid); |
||
| 93 | 00084 <span class="keywordflow">if</span>(stat) |
||
| 94 | 00085 rprintf(<span class="stringliteral">"Transmit failed: 0x%x\r\n"</span>, stat); |
||
| 95 | 00086 <span class="comment">// do cleanup</span> |
||
| 96 | 00087 prism2EventCheck(); |
||
| 97 | 00088 } |
||
| 98 | 00089 |
||
| 99 | 00090 <span class="keywordtype">void</span> nicGetMacAddress(u08* macaddr) |
||
| 100 | 00091 { |
||
| 101 | 00092 prism2GetMacAddress(macaddr); |
||
| 102 | 00093 } |
||
| 103 | 00094 |
||
| 104 | 00095 <span class="keywordtype">void</span> nicSetMacAddress(u08* macaddr) |
||
| 105 | 00096 { |
||
| 106 | 00097 <span class="comment">// not yet supported</span> |
||
| 107 | 00098 } |
||
| 108 | 00099 |
||
| 109 | <a name="l00100"></a><a class="code" href="group__nic.html#ga5">00100</a> <span class="keywordtype">void</span> <a class="code" href="group__nic.html#ga5">nicRegDump</a>(<span class="keywordtype">void</span>) |
||
| 110 | 00101 { |
||
| 111 | 00102 prism2CardRegDump(); |
||
| 112 | 00103 prism2RegDump(); |
||
| 113 | 00104 } |
||
| 114 | 00105 |
||
| 115 | 00106 <span class="keywordtype">void</span> prism2SetupTxHeader(u16* header) |
||
| 116 | 00107 { |
||
| 117 | 00108 u16 i; |
||
| 118 | 00109 |
||
| 119 | 00110 <span class="comment">// clear out header</span> |
||
| 120 | 00111 <span class="keywordflow">for</span>(i=0;i<22;i++) |
||
| 121 | 00112 header[i] = 0x00; |
||
| 122 | 00113 |
||
| 123 | 00114 <span class="comment">// set TxRate and retry count</span> |
||
| 124 | 00115 header[5] = (0<<8) | 0; |
||
| 125 | 00116 <span class="comment">// 0x00 = automatic selection</span> |
||
| 126 | 00117 <span class="comment">// 0x0A = 10 = 1.0Mbit/s</span> |
||
| 127 | 00118 <span class="comment">// 0x14 = 20 = 2.0Mbit/s</span> |
||
| 128 | 00119 <span class="comment">// 0x37 = 55 = 5.5Mbit/s</span> |
||
| 129 | 00120 <span class="comment">// 0x6E = 110 = 11 Mbit/s</span> |
||
| 130 | 00121 |
||
| 131 | 00122 <span class="comment">// set TxControl</span> |
||
| 132 | 00123 header[6] = 0x0004; |
||
| 133 | 00124 |
||
| 134 | 00125 <span class="comment">// write length</span> |
||
| 135 | 00126 <span class="comment">// (not really needed since card will pull info from 802.3 header)</span> |
||
| 136 | 00127 <span class="comment">//TxHeader[22] = len+8;</span> |
||
| 137 | 00128 |
||
| 138 | 00129 <span class="comment">// fill in 802.3 header fields</span> |
||
| 139 | 00130 TxHeader[30] = 0xAAAA; |
||
| 140 | 00131 TxHeader[31] = 0x0003; |
||
| 141 | 00132 TxHeader[32] = 0x0000; |
||
| 142 | 00133 |
||
| 143 | 00134 <span class="comment">// src mac address @ byte offset 52</span> |
||
| 144 | 00135 } |
||
| 145 | 00136 |
||
| 146 | 00137 <span class="keywordtype">void</span> prism2EventCheck(<span class="keywordtype">void</span>) |
||
| 147 | 00138 { |
||
| 148 | 00139 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> evstat_data; |
||
| 149 | 00140 |
||
| 150 | 00141 evstat_data = prism2Read16(PRISM2_REG_EVSTAT); |
||
| 151 | 00142 |
||
| 152 | 00143 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_TX) |
||
| 153 | 00144 { |
||
| 154 | 00145 prism2Write16(PRISM2_REG_EVACK,PRISM2_EVENT_TX); |
||
| 155 | 00146 } |
||
| 156 | 00147 |
||
| 157 | 00148 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_TXEXEC) |
||
| 158 | 00149 { |
||
| 159 | 00150 prism2Write16(PRISM2_REG_EVACK,PRISM2_EVENT_TXEXEC); |
||
| 160 | 00151 } |
||
| 161 | 00152 |
||
| 162 | 00153 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_ALLOC) |
||
| 163 | 00154 { |
||
| 164 | 00155 prism2Write16(PRISM2_REG_EVACK, 0x0002); |
||
| 165 | 00156 } |
||
| 166 | 00157 |
||
| 167 | 00158 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_CMD) |
||
| 168 | 00159 { |
||
| 169 | 00160 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_CMD); |
||
| 170 | 00161 } |
||
| 171 | 00162 |
||
| 172 | 00163 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_INFO) |
||
| 173 | 00164 { |
||
| 174 | 00165 prism2Read16(PRISM2_REG_INFOFID); |
||
| 175 | 00166 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_INFO); |
||
| 176 | 00167 } |
||
| 177 | 00168 |
||
| 178 | 00169 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_INFDROP) |
||
| 179 | 00170 { |
||
| 180 | 00171 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_INFDROP); |
||
| 181 | 00172 } |
||
| 182 | 00173 |
||
| 183 | 00174 <span class="keywordflow">if</span>(evstat_data & PRISM2_EVENT_WTERR) |
||
| 184 | 00175 { |
||
| 185 | 00176 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_WTERR); |
||
| 186 | 00177 } |
||
| 187 | 00178 } |
||
| 188 | 00179 |
||
| 189 | 00180 |
||
| 190 | <a name="l00181"></a><a class="code" href="group__nic.html#ga2">00181</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="group__nic.html#ga2">nicPoll</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxlen, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* packet) |
||
| 191 | 00182 { |
||
| 192 | 00183 u16 rxfid=0; |
||
| 193 | 00184 u16 packetLength=0; |
||
| 194 | 00185 |
||
| 195 | 00186 <span class="comment">// check if packets have been received</span> |
||
| 196 | 00187 <span class="keywordflow">if</span>(prism2Read16(PRISM2_REG_EVSTAT) & PRISM2_EVENT_RX) |
||
| 197 | 00188 { |
||
| 198 | 00189 <span class="comment">// we have a receive event</span> |
||
| 199 | 00190 <span class="comment">// get RxFID</span> |
||
| 200 | 00191 rxfid = prism2Read16(PRISM2_REG_RXFID); |
||
| 201 | 00192 <span class="comment">// read the packet length</span> |
||
| 202 | 00193 prism2ReadBAP0(rxfid, 44, &packetLength, 1); |
||
| 203 | 00194 } |
||
| 204 | 00195 |
||
| 205 | 00196 <span class="comment">// if there's no packet or an error - exit</span> |
||
| 206 | 00197 <span class="keywordflow">if</span>( !packetLength ) |
||
| 207 | 00198 <span class="keywordflow">return</span> 0; |
||
| 208 | 00199 |
||
| 209 | 00200 <span class="comment">// drop anything too big for the buffer</span> |
||
| 210 | 00201 <span class="keywordflow">if</span>( packetLength > maxlen ) |
||
| 211 | 00202 { |
||
| 212 | 00203 <span class="comment">// ACK the receive event to finish up</span> |
||
| 213 | 00204 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_RX); |
||
| 214 | 00205 <span class="keywordflow">return</span> 0; |
||
| 215 | 00206 } |
||
| 216 | 00207 |
||
| 217 | 00208 <span class="comment">// packet is available, retrieve data</span> |
||
| 218 | 00209 <span class="comment">// this is a hack: while reading in data,</span> |
||
| 219 | 00210 <span class="comment">// convert 802.2/3 header to ethernet header</span> |
||
| 220 | 00211 <span class="comment">// first get dest and src MAC addresses</span> |
||
| 221 | 00212 prism2ReadBAP0(rxfid, 46, (u16*)&packet[0], 6); |
||
| 222 | 00213 <span class="comment">// skip length, snap, and ctrl fields</span> |
||
| 223 | 00214 <span class="comment">// begin data copy again at type field</span> |
||
| 224 | 00215 prism2ReadBAP0(rxfid, 46+12+8, (u16*)&packet[12], packetLength-6); |
||
| 225 | 00216 <span class="comment">// ACK the receive event to finish up</span> |
||
| 226 | 00217 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_RX); |
||
| 227 | 00218 |
||
| 228 | 00219 <span class="keywordflow">return</span> packetLength; |
||
| 229 | 00220 } |
||
| 230 | 00221 |
||
| 231 | 00222 <span class="keywordtype">void</span> prism2InitPorts(<span class="keywordtype">void</span>) |
||
| 232 | 00223 { |
||
| 233 | 00224 <span class="preprocessor">#if NIC_CONNECTION == MEMORY_MAPPED</span> |
||
| 234 | 00225 <span class="preprocessor"></span> <span class="comment">// enable external SRAM interface - no wait states</span> |
||
| 235 | 00226 sbi(MCUSR, SRE); |
||
| 236 | 00227 <span class="preprocessor">#else</span> |
||
| 237 | 00228 <span class="preprocessor"></span> <span class="comment">// set address port to output</span> |
||
| 238 | 00229 outb(PRISM2_ADDRESS_DDR, PRISM2_ADDRESS_MASK); |
||
| 239 | 00230 outb(PRISM2_HADDRESS_DDR, PRISM2_HADDRESS_MASK); |
||
| 240 | 00231 |
||
| 241 | 00232 <span class="comment">// set data port to input with pull-ups</span> |
||
| 242 | 00233 outb(PRISM2_DATA_DDR, 0x00); |
||
| 243 | 00234 outb(PRISM2_DATA_PORT, 0xFF); |
||
| 244 | 00235 |
||
| 245 | 00236 <span class="comment">// initialize the control port read and write pins to de-asserted</span> |
||
| 246 | 00237 sbi( PRISM2_CONTROL_PORT, PRISM2_CONTROL_IORD ); |
||
| 247 | 00238 sbi( PRISM2_CONTROL_PORT, PRISM2_CONTROL_IOWR ); |
||
| 248 | 00239 sbi( PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMRD ); |
||
| 249 | 00240 sbi( PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMWR ); |
||
| 250 | 00241 <span class="comment">// set the read and write pins to output</span> |
||
| 251 | 00242 sbi( PRISM2_CONTROL_DDR, PRISM2_CONTROL_IORD ); |
||
| 252 | 00243 sbi( PRISM2_CONTROL_DDR, PRISM2_CONTROL_IOWR ); |
||
| 253 | 00244 sbi( PRISM2_CONTROL_DDR, PRISM2_CONTROL_MEMRD ); |
||
| 254 | 00245 sbi( PRISM2_CONTROL_DDR, PRISM2_CONTROL_MEMWR ); |
||
| 255 | 00246 <span class="preprocessor">#endif</span> |
||
| 256 | 00247 <span class="preprocessor"></span> <span class="comment">// set reset pin to output</span> |
||
| 257 | 00248 sbi( PRISM2_RESET_DDR, PRISM2_RESET_PIN ); |
||
| 258 | 00249 |
||
| 259 | 00250 <span class="comment">// clear -REG pin</span> |
||
| 260 | 00251 sbi(DDRB, 6); |
||
| 261 | 00252 cbi(PORTB, 6); |
||
| 262 | 00253 <span class="comment">// setup IREQ pin</span> |
||
| 263 | 00254 cbi(DDRB, 7); |
||
| 264 | 00255 sbi(PORTB, 7); |
||
| 265 | 00256 } |
||
| 266 | 00257 |
||
| 267 | 00258 <span class="keywordtype">void</span> prism2Init(<span class="keywordtype">void</span>) |
||
| 268 | 00259 { |
||
| 269 | 00260 u08 result; |
||
| 270 | 00261 u16 buffer[20]; |
||
| 271 | 00262 |
||
| 272 | 00263 <span class="comment">// rprintf("Init ports\r\n");</span> |
||
| 273 | 00264 prism2InitPorts(); |
||
| 274 | 00265 |
||
| 275 | 00266 <span class="comment">// assert hardware reset</span> |
||
| 276 | 00267 sbi( PRISM2_RESET_PORT, PRISM2_RESET_PIN ); |
||
| 277 | 00268 <span class="comment">// wait</span> |
||
| 278 | 00269 delay_ms(10); |
||
| 279 | 00270 <span class="comment">// release hardware reset</span> |
||
| 280 | 00271 cbi( PRISM2_RESET_PORT, PRISM2_RESET_PIN ); |
||
| 281 | 00272 delay_ms(100); |
||
| 282 | 00273 |
||
| 283 | 00274 <span class="comment">/*</span> |
||
| 284 | 00275 <span class="comment"> // soft-reset card</span> |
||
| 285 | 00276 <span class="comment"> prism2WriteMem(0x3E0+PCMCIA_ATTR_COR, 0x80);</span> |
||
| 286 | 00277 <span class="comment"> delay_ms(10);</span> |
||
| 287 | 00278 <span class="comment"> prism2WriteMem(0x3E0+PCMCIA_ATTR_COR, 0x00);</span> |
||
| 288 | 00279 <span class="comment"> // wait until soft-reset is done</span> |
||
| 289 | 00280 <span class="comment"> delay_ms(500);</span> |
||
| 290 | 00281 <span class="comment"></span> |
||
| 291 | 00282 <span class="comment"> // set 8-bit PCMCIA I/O mode</span> |
||
| 292 | 00283 <span class="comment"> prism2WriteMem(0x3E0+PCMCIA_ATTR_CSR, 0x20);</span> |
||
| 293 | 00284 <span class="comment"></span> |
||
| 294 | 00285 <span class="comment"> prism2WriteMem(0x3E0+PCMCIA_ATTR_CSR, 0x04);</span> |
||
| 295 | 00286 <span class="comment"> timerPause(1000);</span> |
||
| 296 | 00287 <span class="comment"> prism2WriteMem(0x3E0+PCMCIA_ATTR_CSR, 0x00);</span> |
||
| 297 | 00288 <span class="comment">*/</span> |
||
| 298 | 00289 <span class="comment">// enable PCMCIA I/O mode</span> |
||
| 299 | 00290 prism2WriteMem(0x3E0+PCMCIA_ATTR_COR, prism2ReadMem(0x3E0+PCMCIA_ATTR_COR) | 0x01); |
||
| 300 | 00291 <span class="comment">// prism2CardRegDump();</span> |
||
| 301 | 00292 |
||
| 302 | 00293 rprintf(<span class="stringliteral">"Prism2 Initializing...\r\n"</span>); |
||
| 303 | 00294 <span class="keywordflow">if</span>( (result = prism2Command(PRISM2_CMD_INIT,0)) ) |
||
| 304 | 00295 { |
||
| 305 | 00296 rprintf(<span class="stringliteral">"Prism2 Initialization Failure\r\n"</span>); |
||
| 306 | 00297 rprintf(<span class="stringliteral">"Result Code = %x\r\n"</span>,result); |
||
| 307 | 00298 } |
||
| 308 | 00299 |
||
| 309 | 00300 rprintf(<span class="stringliteral">"Prism2 Initialized\r\n"</span>); |
||
| 310 | 00301 |
||
| 311 | 00302 <span class="comment">// set SSID</span> |
||
| 312 | 00303 prism2SetSSID(<span class="stringliteral">"airdrop"</span>); |
||
| 313 | 00304 |
||
| 314 | 00305 <span class="comment">// set max packet size</span> |
||
| 315 | 00306 buffer[0] = 0x0002; |
||
| 316 | 00307 buffer[1] = PRISM2_RID_CNFMAXDATALEN; |
||
| 317 | 00308 buffer[2] = 0x05DC; |
||
| 318 | 00309 prism2WriteRID(PRISM2_RID_CNFMAXDATALEN, 0, buffer, 3); |
||
| 319 | 00310 |
||
| 320 | 00311 <span class="comment">// set operating mode / port type</span> |
||
| 321 | 00312 buffer[0] = 0x0002; |
||
| 322 | 00313 buffer[1] = PRISM2_RID_CNFPORTTYPE; |
||
| 323 | 00314 <span class="comment">//buffer[2] = 0x0000; // IBSS</span> |
||
| 324 | 00315 buffer[2] = 0x0001; <span class="comment">// BSS</span> |
||
| 325 | 00316 prism2WriteRID(PRISM2_RID_CNFPORTTYPE, 0, buffer, 3); |
||
| 326 | 00317 |
||
| 327 | 00318 <span class="comment">// set channel</span> |
||
| 328 | 00319 <span class="comment">// buffer[0] = 0x0002;</span> |
||
| 329 | 00320 <span class="comment">// buffer[1] = 0xFC03;</span> |
||
| 330 | 00321 <span class="comment">// buffer[2] = 0x0001;</span> |
||
| 331 | 00322 <span class="comment">// prism2WriteRID(0xFC00, 0, buffer, 3);</span> |
||
| 332 | 00323 |
||
| 333 | 00324 <span class="comment">// enable the interface</span> |
||
| 334 | 00325 prism2Command(PRISM2_CMD_ENABLE_MAC0,0); |
||
| 335 | 00326 } |
||
| 336 | 00327 |
||
| 337 | 00328 <span class="keywordtype">void</span> prism2Off(<span class="keywordtype">void</span>) |
||
| 338 | 00329 { |
||
| 339 | 00330 <span class="comment">// turn off communication</span> |
||
| 340 | 00331 prism2Command(PRISM2_CMD_DISABLE_MAC0,0); |
||
| 341 | 00332 <span class="comment">// wait for all events to complete</span> |
||
| 342 | 00333 delay_ms(100); |
||
| 343 | 00334 <span class="comment">// reset card</span> |
||
| 344 | 00335 prism2Command(PRISM2_CMD_INIT,0); |
||
| 345 | 00336 } |
||
| 346 | 00337 |
||
| 347 | 00338 <span class="keywordtype">void</span> prism2GetMacAddress(u08* macaddr) |
||
| 348 | 00339 { |
||
| 349 | 00340 u16 buffer[5]; |
||
| 350 | 00341 |
||
| 351 | 00342 <span class="comment">// read MAC address register</span> |
||
| 352 | 00343 prism2ReadRID(PRISM2_RID_CNFOWNMACADDR, 0, buffer, 5); |
||
| 353 | 00344 |
||
| 354 | 00345 *macaddr++ = buffer[2]; |
||
| 355 | 00346 *macaddr++ = buffer[2]>>8; |
||
| 356 | 00347 *macaddr++ = buffer[3]; |
||
| 357 | 00348 *macaddr++ = buffer[3]>>8; |
||
| 358 | 00349 *macaddr++ = buffer[4]; |
||
| 359 | 00350 *macaddr++ = buffer[4]>>8; |
||
| 360 | 00351 } |
||
| 361 | 00352 |
||
| 362 | 00353 <span class="keywordtype">void</span> prism2SetSSID(u08* ssid) |
||
| 363 | 00354 { |
||
| 364 | 00355 u16 buffer[12]; |
||
| 365 | 00356 |
||
| 366 | 00357 <span class="comment">// prepare buffer for SSID write</span> |
||
| 367 | 00358 buffer[0] = 0x0012; |
||
| 368 | 00359 buffer[1] = PRISM2_RID_CNFDESIREDSSID; |
||
| 369 | 00360 buffer[2] = strlen(ssid); |
||
| 370 | 00361 <span class="comment">// copy ssid string to buffer</span> |
||
| 371 | 00362 strcpy((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&buffer[3], ssid); |
||
| 372 | 00363 <span class="comment">// write SSID</span> |
||
| 373 | 00364 prism2WriteRID(PRISM2_RID_CNFDESIREDSSID, 0, buffer, buffer[0]); |
||
| 374 | 00365 } |
||
| 375 | 00366 |
||
| 376 | 00367 <span class="keywordtype">void</span> prism2SetWEPKey(u08* wepkey) |
||
| 377 | 00368 { |
||
| 378 | 00369 u16 buffer[9]; |
||
| 379 | 00370 |
||
| 380 | 00371 <span class="comment">// prepare buffer for SSID write</span> |
||
| 381 | 00372 buffer[0] = 0x0008; |
||
| 382 | 00373 buffer[1] = PRISM2_RID_CNFWEPDEFAULTKEY0; |
||
| 383 | 00374 <span class="comment">// copy ssid string to buffer</span> |
||
| 384 | 00375 strncpy((<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>*)&buffer[2], wepkey, 13); |
||
| 385 | 00376 buffer[8] &= 0x00FF; |
||
| 386 | 00377 <span class="comment">// write SSID</span> |
||
| 387 | 00378 prism2WriteRID(PRISM2_RID_CNFWEPDEFAULTKEY0, 0, buffer, buffer[0]); |
||
| 388 | 00379 |
||
| 389 | 00380 <span class="comment">// set WEP active</span> |
||
| 390 | 00381 buffer[0] = 0x0002; |
||
| 391 | 00382 buffer[1] = PRISM2_RID_CNFWEPFLAGS; |
||
| 392 | 00383 buffer[2] = 0x0001; |
||
| 393 | 00384 prism2WriteRID(PRISM2_RID_CNFWEPFLAGS, 0, buffer, buffer[0]); |
||
| 394 | 00385 <span class="comment">// set WEP active</span> |
||
| 395 | 00386 buffer[0] = 0x0002; |
||
| 396 | 00387 buffer[1] = 0xfc2a; |
||
| 397 | 00388 buffer[2] = 0x0001; |
||
| 398 | 00389 prism2WriteRID(0xfc2a, 0, buffer, buffer[0]); |
||
| 399 | 00390 <span class="comment">// set WEP active</span> |
||
| 400 | 00391 buffer[0] = 0x0002; |
||
| 401 | 00392 buffer[1] = 0xfc23; |
||
| 402 | 00393 buffer[2] = 0x0000; |
||
| 403 | 00394 prism2WriteRID(0xfc23, 0, buffer, buffer[0]); |
||
| 404 | 00395 |
||
| 405 | 00396 } |
||
| 406 | 00397 |
||
| 407 | 00398 u08 prism2Command(u16 cmd, u16 param0) |
||
| 408 | 00399 { |
||
| 409 | 00400 u16 result; |
||
| 410 | 00401 |
||
| 411 | 00402 <span class="comment">// wait until card not busy</span> |
||
| 412 | 00403 <span class="comment">// rprintf("PRISM_CMD: Wait until card ready\r\n");</span> |
||
| 413 | 00404 <span class="keywordflow">while</span>(prism2Read16(PRISM2_REG_CMD) & PRISM2_CMD_BUSY); |
||
| 414 | 00405 |
||
| 415 | 00406 <span class="comment">// rprintf("PRISM_CMD: Issue Command = 0x%x\r\n", cmd);</span> |
||
| 416 | 00407 prism2Write16(PRISM2_REG_PARAM0, param0); |
||
| 417 | 00408 prism2Write16(PRISM2_REG_CMD, cmd); |
||
| 418 | 00409 |
||
| 419 | 00410 <span class="comment">// wait until card not busy</span> |
||
| 420 | 00411 <span class="comment">// rprintf("PRISM_CMD: Wait until card ready\r\n");</span> |
||
| 421 | 00412 <span class="keywordflow">while</span>(prism2Read16(PRISM2_REG_CMD) & PRISM2_CMD_BUSY); |
||
| 422 | 00413 |
||
| 423 | 00414 <span class="comment">// read event register - wait for command to complete</span> |
||
| 424 | 00415 <span class="comment">// rprintf("PRISM_CMD: Wait for command to complete\r\n");</span> |
||
| 425 | 00416 <span class="keywordflow">while</span>(!(prism2Read16(PRISM2_REG_EVSTAT) & PRISM2_EVENT_CMD)); |
||
| 426 | 00417 |
||
| 427 | 00418 <span class="comment">// read status register</span> |
||
| 428 | 00419 result = prism2Read16(PRISM2_REG_STATUS)>>8; |
||
| 429 | 00420 <span class="comment">// rprintf("PRISM_CMD: Result = 0x%x\r\n", result>>8);</span> |
||
| 430 | 00421 <span class="comment">// rprintf("PRISM_CMD: CmdCode = 0x%x\r\n", result);</span> |
||
| 431 | 00422 |
||
| 432 | 00423 <span class="comment">// acknowledge event</span> |
||
| 433 | 00424 <span class="comment">// rprintf("PRISM_CMD: Ack command event\r\n");</span> |
||
| 434 | 00425 prism2Write16(PRISM2_REG_EVACK, PRISM2_EVENT_CMD); |
||
| 435 | 00426 |
||
| 436 | 00427 <span class="comment">// return command result</span> |
||
| 437 | 00428 <span class="keywordflow">return</span> result; |
||
| 438 | 00429 } |
||
| 439 | 00430 |
||
| 440 | 00431 u08 prism2ReadRID(u16 <span class="keywordtype">id</span>, u16 offset, u16* data, u16 len) |
||
| 441 | 00432 { |
||
| 442 | 00433 prism2Command(PRISM2_CMD_ACCESS_RD, <span class="keywordtype">id</span>); |
||
| 443 | 00434 <span class="keywordflow">return</span> prism2ReadBAP0(<span class="keywordtype">id</span>, offset, data, len); |
||
| 444 | 00435 } |
||
| 445 | 00436 |
||
| 446 | 00437 u08 prism2WriteRID(u16 <span class="keywordtype">id</span>, u16 offset, u16* data, u16 len) |
||
| 447 | 00438 { |
||
| 448 | 00439 u08 result; |
||
| 449 | 00440 result = prism2WriteBAP0(<span class="keywordtype">id</span>, offset, data, len); |
||
| 450 | 00441 prism2Command(PRISM2_CMD_ACCESS_WR, <span class="keywordtype">id</span>); |
||
| 451 | 00442 <span class="keywordflow">return</span> result; |
||
| 452 | 00443 } |
||
| 453 | 00444 |
||
| 454 | 00445 u08 prism2ReadBAP0(u16 <span class="keywordtype">id</span>, u16 offset, u16* data, u16 len) |
||
| 455 | 00446 { |
||
| 456 | 00447 <span class="comment">// wait for BAP to be ready</span> |
||
| 457 | 00448 <span class="comment">//rprintf("PRISM_BAP: Wait1\r\n");</span> |
||
| 458 | 00449 <span class="keywordflow">while</span>( prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_BUSY); |
||
| 459 | 00450 <span class="comment">// set ID</span> |
||
| 460 | 00451 prism2Write16(PRISM2_REG_BAP0SEL, <span class="keywordtype">id</span>); |
||
| 461 | 00452 <span class="comment">// set offset</span> |
||
| 462 | 00453 prism2Write16(PRISM2_REG_BAP0OFFSET, offset); |
||
| 463 | 00454 <span class="comment">// wait for BAP to be ready</span> |
||
| 464 | 00455 <span class="comment">//rprintf("PRISM_BAP: Wait2\r\n");</span> |
||
| 465 | 00456 <span class="keywordflow">while</span>( prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_BUSY); |
||
| 466 | 00457 <span class="comment">// check for error</span> |
||
| 467 | 00458 <span class="keywordflow">if</span>(prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_ERROR) |
||
| 468 | 00459 <span class="keywordflow">return</span> -1; |
||
| 469 | 00460 <span class="comment">// read data</span> |
||
| 470 | 00461 <span class="comment">//rprintf("PRISM_BAP: Read\r\n");</span> |
||
| 471 | 00462 <span class="keywordflow">while</span>(len--) |
||
| 472 | 00463 *data++ = prism2Read16(PRISM2_REG_BAP0DATA); |
||
| 473 | 00464 <span class="comment">// return success</span> |
||
| 474 | 00465 <span class="keywordflow">return</span> 0; |
||
| 475 | 00466 } |
||
| 476 | 00467 |
||
| 477 | 00468 u08 prism2WriteBAP0(u16 <span class="keywordtype">id</span>, u16 offset, u16* data, u16 len) |
||
| 478 | 00469 { |
||
| 479 | 00470 <span class="comment">// wait for BAP to be ready</span> |
||
| 480 | 00471 <span class="comment">//rprintf("PRISM_BAP: Wait1\r\n");</span> |
||
| 481 | 00472 <span class="keywordflow">while</span>( prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_BUSY); |
||
| 482 | 00473 <span class="comment">// set ID</span> |
||
| 483 | 00474 prism2Write16(PRISM2_REG_BAP0SEL, <span class="keywordtype">id</span>); |
||
| 484 | 00475 <span class="comment">// set offset</span> |
||
| 485 | 00476 prism2Write16(PRISM2_REG_BAP0OFFSET, offset); |
||
| 486 | 00477 <span class="comment">// wait for BAP to be ready</span> |
||
| 487 | 00478 <span class="comment">//rprintf("PRISM_BAP: Wait2\r\n");</span> |
||
| 488 | 00479 <span class="keywordflow">while</span>( prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_BUSY); |
||
| 489 | 00480 <span class="comment">// check for error</span> |
||
| 490 | 00481 <span class="keywordflow">if</span>(prism2Read16(PRISM2_REG_BAP0OFFSET) & PRISM2_BAPOFFSET_ERROR) |
||
| 491 | 00482 <span class="keywordflow">return</span> -1; |
||
| 492 | 00483 <span class="comment">// write data</span> |
||
| 493 | 00484 <span class="comment">//rprintf("PRISM_BAP: Write\r\n");</span> |
||
| 494 | 00485 <span class="keywordflow">while</span>(len--) |
||
| 495 | 00486 prism2Write16(PRISM2_REG_BAP0DATA, *data++); |
||
| 496 | 00487 <span class="comment">// return success</span> |
||
| 497 | 00488 <span class="keywordflow">return</span> 0; |
||
| 498 | 00489 } |
||
| 499 | 00490 |
||
| 500 | 00491 <span class="keywordtype">void</span> prism2Write(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address, <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data) |
||
| 501 | 00492 { |
||
| 502 | 00493 cli(); |
||
| 503 | 00494 <span class="comment">// assert the address</span> |
||
| 504 | 00495 outb(PRISM2_HADDRESS_PORT, (address>>8) | (inb(PRISM2_HADDRESS_PORT)&~PRISM2_HADDRESS_MASK)); |
||
| 505 | 00496 outb(PRISM2_ADDRESS_PORT, address | (inb(PRISM2_ADDRESS_PORT)&~PRISM2_ADDRESS_MASK)); |
||
| 506 | 00497 <span class="comment">// set data bus as output</span> |
||
| 507 | 00498 outb(PRISM2_DATA_DDR, 0xFF); |
||
| 508 | 00499 <span class="comment">// place data on bus</span> |
||
| 509 | 00500 outb(PRISM2_DATA_PORT, data); |
||
| 510 | 00501 <span class="comment">// assert write</span> |
||
| 511 | 00502 cbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_IOWR); |
||
| 512 | 00503 <span class="comment">// delay</span> |
||
| 513 | 00504 PRISM2_IO_ACCESS_DELAY; |
||
| 514 | 00505 <span class="comment">// negate write</span> |
||
| 515 | 00506 sbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_IOWR); |
||
| 516 | 00507 <span class="comment">// set data bus back to input with pullups enabled</span> |
||
| 517 | 00508 outb(PRISM2_DATA_DDR, 0x00); |
||
| 518 | 00509 outb(PRISM2_DATA_PORT, 0xFF); |
||
| 519 | 00510 sei(); |
||
| 520 | 00511 } |
||
| 521 | 00512 |
||
| 522 | 00513 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> prism2Read(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address) |
||
| 523 | 00514 { |
||
| 524 | 00515 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data; |
||
| 525 | 00516 cli(); |
||
| 526 | 00517 <span class="comment">// assert the address</span> |
||
| 527 | 00518 outb(PRISM2_HADDRESS_PORT, (address>>8) | (inb(PRISM2_HADDRESS_PORT)&~PRISM2_HADDRESS_MASK)); |
||
| 528 | 00519 outb(PRISM2_ADDRESS_PORT, address | (inb(PRISM2_ADDRESS_PORT)&~PRISM2_ADDRESS_MASK)); |
||
| 529 | 00520 <span class="comment">// set data bus to input with pullups enabled</span> |
||
| 530 | 00521 outb(PRISM2_DATA_DDR, 0x00); |
||
| 531 | 00522 outb(PRISM2_DATA_PORT, 0xFF); |
||
| 532 | 00523 <span class="comment">// assert read</span> |
||
| 533 | 00524 cbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_IORD); |
||
| 534 | 00525 <span class="comment">// delay</span> |
||
| 535 | 00526 PRISM2_IO_ACCESS_DELAY; |
||
| 536 | 00527 <span class="comment">// read in the data</span> |
||
| 537 | 00528 data = inb( PRISM2_DATA_PIN ); |
||
| 538 | 00529 <span class="comment">// negate read</span> |
||
| 539 | 00530 sbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_IORD); |
||
| 540 | 00531 <span class="comment">// return data</span> |
||
| 541 | 00532 sei(); |
||
| 542 | 00533 <span class="keywordflow">return</span> data; |
||
| 543 | 00534 } |
||
| 544 | 00535 |
||
| 545 | 00536 <span class="keywordtype">void</span> prism2Write16(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> data) |
||
| 546 | 00537 { |
||
| 547 | 00538 prism2Write(address, data); |
||
| 548 | 00539 prism2Write(address+1, data>>8); |
||
| 549 | 00540 } |
||
| 550 | 00541 |
||
| 551 | 00542 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> prism2Read16(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address) |
||
| 552 | 00543 { |
||
| 553 | 00544 <span class="keywordflow">return</span> prism2Read(address) | (prism2Read(address+1)<<8); |
||
| 554 | 00545 } |
||
| 555 | 00546 |
||
| 556 | 00547 <span class="keywordtype">void</span> prism2WriteMem(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> data) |
||
| 557 | 00548 { |
||
| 558 | 00549 cli(); |
||
| 559 | 00550 <span class="comment">// assert the address</span> |
||
| 560 | 00551 outb(PRISM2_HADDRESS_PORT, (address>>8) | (inb(PRISM2_HADDRESS_PORT)&~PRISM2_HADDRESS_MASK)); |
||
| 561 | 00552 outb(PRISM2_ADDRESS_PORT, address | (inb(PRISM2_ADDRESS_PORT)&~PRISM2_ADDRESS_MASK)); |
||
| 562 | 00553 <span class="comment">// set data bus as output</span> |
||
| 563 | 00554 outb(PRISM2_DATA_DDR, 0xFF); |
||
| 564 | 00555 <span class="comment">// place data on bus</span> |
||
| 565 | 00556 outb(PRISM2_DATA_PORT, data); |
||
| 566 | 00557 <span class="comment">// assert write</span> |
||
| 567 | 00558 cbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMWR); |
||
| 568 | 00559 <span class="comment">// delay</span> |
||
| 569 | 00560 PRISM2_MEM_ACCESS_DELAY; |
||
| 570 | 00561 <span class="comment">// negate write</span> |
||
| 571 | 00562 sbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMWR); |
||
| 572 | 00563 <span class="comment">// set data bus back to input with pullups enabled</span> |
||
| 573 | 00564 outb(PRISM2_DATA_DDR, 0x00); |
||
| 574 | 00565 outb(PRISM2_DATA_PORT, 0xFF); |
||
| 575 | 00566 sei(); |
||
| 576 | 00567 } |
||
| 577 | 00568 |
||
| 578 | 00569 <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> prism2ReadMem(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> address) |
||
| 579 | 00570 { |
||
| 580 | 00571 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> data; |
||
| 581 | 00572 cli(); |
||
| 582 | 00573 <span class="comment">// assert the address</span> |
||
| 583 | 00574 outb(PRISM2_HADDRESS_PORT, (address>>8) | (inb(PRISM2_HADDRESS_PORT)&~PRISM2_HADDRESS_MASK)); |
||
| 584 | 00575 outb(PRISM2_ADDRESS_PORT, address | (inb(PRISM2_ADDRESS_PORT)&~PRISM2_ADDRESS_MASK)); |
||
| 585 | 00576 <span class="comment">// set data bus to input with pullups enabled</span> |
||
| 586 | 00577 outb(PRISM2_DATA_DDR, 0x00); |
||
| 587 | 00578 outb(PRISM2_DATA_PORT, 0xFF); |
||
| 588 | 00579 <span class="comment">// assert read</span> |
||
| 589 | 00580 cbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMRD); |
||
| 590 | 00581 <span class="comment">// delay</span> |
||
| 591 | 00582 PRISM2_MEM_ACCESS_DELAY; |
||
| 592 | 00583 <span class="comment">// read in the data</span> |
||
| 593 | 00584 data = inb( PRISM2_DATA_PIN ); |
||
| 594 | 00585 <span class="comment">// negate read</span> |
||
| 595 | 00586 sbi(PRISM2_CONTROL_PORT, PRISM2_CONTROL_MEMRD); |
||
| 596 | 00587 sei(); |
||
| 597 | 00588 <span class="comment">// return data</span> |
||
| 598 | 00589 <span class="keywordflow">return</span> data; |
||
| 599 | 00590 } |
||
| 600 | 00591 |
||
| 601 | 00592 <span class="keywordtype">void</span> prism2CardRegDump(<span class="keywordtype">void</span>) |
||
| 602 | 00593 { |
||
| 603 | 00594 u16 i; |
||
| 604 | 00595 u08 buffer[0x100]; |
||
| 605 | 00596 |
||
| 606 | 00597 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"Card Config Registers\r\n"</span>); |
||
| 607 | 00598 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"-------------------------------\r\n"</span>); |
||
| 608 | 00599 <span class="comment">// read card CIS (16 bytes)</span> |
||
| 609 | 00600 rprintf(<span class="stringliteral">"CIS : \r\n"</span>); |
||
| 610 | 00601 <span class="keywordflow">for</span>(i=0; i<0x100; i++) |
||
| 611 | 00602 buffer[i] = prism2ReadMem(i<<1); |
||
| 612 | 00603 <a class="code" href="debug_8c.html#a0">debugPrintHexTable</a>(0x100, buffer); |
||
| 613 | 00604 |
||
| 614 | 00605 <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 615 | 00606 |
||
| 616 | 00607 rprintf(<span class="stringliteral">"COR : "</span>); <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(prism2ReadMem(0x3E0+PCMCIA_ATTR_COR)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 617 | 00608 rprintf(<span class="stringliteral">"CSR : "</span>); <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(prism2ReadMem(0x3E0+PCMCIA_ATTR_CSR)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 618 | 00609 rprintf(<span class="stringliteral">"PRR : "</span>); <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(prism2ReadMem(0x3E0+PCMCIA_ATTR_PRR)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 619 | 00610 rprintf(<span class="stringliteral">"SCR : "</span>); <a class="code" href="group__rprintf.html#ga7">rprintfu08</a>(prism2ReadMem(0x3E0+PCMCIA_ATTR_SCR)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 620 | 00611 } |
||
| 621 | 00612 |
||
| 622 | 00613 <span class="keywordtype">void</span> prism2RegDump(<span class="keywordtype">void</span>) |
||
| 623 | 00614 { |
||
| 624 | 00615 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"Prism2 Registers\r\n"</span>); |
||
| 625 | 00616 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"CMD : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_CMD)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 626 | 00617 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"PARAM0 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_PARAM0)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 627 | 00618 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"PARAM1 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_PARAM1)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 628 | 00619 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"PARAM2 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_PARAM2)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 629 | 00620 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"STATUS : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_STATUS)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 630 | 00621 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"RESP0 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_RESP0)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 631 | 00622 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"RESP1 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_RESP1)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 632 | 00623 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"RESP2 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_RESP2)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 633 | 00624 |
||
| 634 | 00625 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"INFOFID : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_INFOFID)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 635 | 00626 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"RXFID : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_RXFID)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 636 | 00627 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"ALLOCFID: "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_ALLOCFID)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 637 | 00628 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"TXFID : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_TXFID)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 638 | 00629 |
||
| 639 | 00630 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP0SEL : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP0SEL)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 640 | 00631 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP0OFFS: "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP0OFFSET)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 641 | 00632 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP0DATA: "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP0DATA)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 642 | 00633 |
||
| 643 | 00634 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP1SEL : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP1SEL)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 644 | 00635 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP1OFFS: "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP1OFFSET)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 645 | 00636 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"BAP1DATA: "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_BAP1DATA)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 646 | 00637 |
||
| 647 | 00638 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"EVSTAT : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_EVSTAT)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 648 | 00639 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"INTEN : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_INTEN)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 649 | 00640 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"EVACK : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_EVACK)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 650 | 00641 |
||
| 651 | 00642 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"SWSUP0 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_SWSUP0)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 652 | 00643 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"SWSUP0 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_SWSUP1)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 653 | 00644 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"SWSUP0 : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_SWSUP2)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 654 | 00645 |
||
| 655 | 00646 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"AUXPAGE : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_AUXPAGE)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 656 | 00647 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"AUXOFFS : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_AUXOFFSET)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 657 | 00648 <a class="code" href="group__rprintf.html#ga15">rprintfProgStrM</a>(<span class="stringliteral">"AUXDATA : "</span>); <a class="code" href="group__rprintf.html#ga8">rprintfu16</a>(prism2Read16(PRISM2_REG_AUXDATA)); <a class="code" href="group__rprintf.html#ga5">rprintfCRLF</a>(); |
||
| 658 | 00649 |
||
| 659 | 00650 delay_ms(25); |
||
| 660 | 00651 } |
||
| 661 | </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by |
||
| 662 | <a href="http://www.doxygen.org/index.html"> |
||
| 663 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address> |
||
| 664 | </body> |
||
| 665 | </html> |
Powered by WebSVN v2.8.3