1 | // DS Wifi interface code |
---|
2 | // Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org |
---|
3 | // wifi_arm7.h - arm7 wifi interface header |
---|
4 | /****************************************************************************** |
---|
5 | DSWifi Lib and test materials are licenced under the MIT open source licence: |
---|
6 | Copyright (c) 2005-2006 Stephen Stair |
---|
7 | |
---|
8 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
---|
9 | this software and associated documentation files (the "Software"), to deal in |
---|
10 | the Software without restriction, including without limitation the rights to |
---|
11 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
---|
12 | of the Software, and to permit persons to whom the Software is furnished to do |
---|
13 | so, subject to the following conditions: |
---|
14 | |
---|
15 | The above copyright notice and this permission notice shall be included in all |
---|
16 | copies or substantial portions of the Software. |
---|
17 | |
---|
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
---|
24 | SOFTWARE. |
---|
25 | ******************************************************************************/ |
---|
26 | |
---|
27 | #ifndef WIFI_ARM7_H |
---|
28 | #define WIFI_ARM7_H |
---|
29 | |
---|
30 | #ifndef ARM7 |
---|
31 | #error Wifi is only accessible from the ARM7 |
---|
32 | #endif |
---|
33 | |
---|
34 | |
---|
35 | // keepalive updated in the update handler, which should be called in vblank |
---|
36 | // keepalive set for 2 minutes. |
---|
37 | #define WIFI_KEEPALIVE_COUNT (60*60*2) |
---|
38 | |
---|
39 | |
---|
40 | #define WIFI_REG(ofs) (*((volatile u16 *)(0x04800000+(ofs)))) |
---|
41 | // Wifi regs |
---|
42 | #define W_WEPKEY0 (((volatile u16 *)(0x04805F80))) |
---|
43 | #define W_WEPKEY1 (((volatile u16 *)(0x04805FA0))) |
---|
44 | #define W_WEPKEY2 (((volatile u16 *)(0x04805FC0))) |
---|
45 | #define W_WEPKEY3 (((volatile u16 *)(0x04805FE0))) |
---|
46 | |
---|
47 | #define W_MODE_RST (*((volatile u16 *)(0x04800004))) |
---|
48 | #define W_MODE_WEP (*((volatile u16 *)(0x04800006))) |
---|
49 | #define W_IF (*((volatile u16 *)(0x04800010))) |
---|
50 | #define W_IE (*((volatile u16 *)(0x04800012))) |
---|
51 | #define W_MACADDR (((volatile u16 *)(0x04800018))) |
---|
52 | #define W_BSSID (((volatile u16 *)(0x04800020))) |
---|
53 | #define W_AIDS (*((volatile u16 *)(0x04800028))) |
---|
54 | #define W_RETRLIMIT (*((volatile u16 *)(0x0480002C))) |
---|
55 | #define W_POWERSTATE (*((volatile u16 *)(0x0480003C))) |
---|
56 | #define W_RANDOM (*((volatile u16 *)(0x04800044))) |
---|
57 | |
---|
58 | #define W_BBSIOCNT (*((volatile u16 *)(0x04800158))) |
---|
59 | #define W_BBSIOWRITE (*((volatile u16 *)(0x0480015A))) |
---|
60 | #define W_BBSIOREAD (*((volatile u16 *)(0x0480015C))) |
---|
61 | #define W_BBSIOBUSY (*((volatile u16 *)(0x0480015E))) |
---|
62 | #define W_RFSIODATA2 (*((volatile u16 *)(0x0480017C))) |
---|
63 | #define W_RFSIODATA1 (*((volatile u16 *)(0x0480017E))) |
---|
64 | #define W_RFSIOBUSY (*((volatile u16 *)(0x04800180))) |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | #include "wifi_shared.h" |
---|
72 | |
---|
73 | extern volatile Wifi_MainStruct * WifiData; |
---|
74 | |
---|
75 | // Wifi Sync Handler function: Callback function that is called when the arm9 needs to be told to synchronize with new fifo data. |
---|
76 | // If this callback is used (see Wifi_SetSyncHandler()), it should send a message via the fifo to the arm9, which will call Wifi_Sync() on arm9. |
---|
77 | typedef void (*WifiSyncHandler)(void); |
---|
78 | |
---|
79 | |
---|
80 | #ifdef __cplusplus |
---|
81 | extern "C" { |
---|
82 | #endif |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | extern void Read_Flash(int address, char * destination, int length); |
---|
87 | extern void InitFlashData(void); |
---|
88 | extern int ReadFlashByte(int address); |
---|
89 | extern int ReadFlashHWord(int address); |
---|
90 | extern int ReadFlashBytes(int address, int numbytes); |
---|
91 | |
---|
92 | extern int Wifi_BBRead(int a); |
---|
93 | extern int Wifi_BBWrite(int a, int b); |
---|
94 | extern void Wifi_RFWrite(int writedata); |
---|
95 | |
---|
96 | extern void Wifi_RFInit(void); |
---|
97 | extern void Wifi_BBInit(void); |
---|
98 | extern void Wifi_WakeUp(void); |
---|
99 | extern void Wifi_Shutdown(void); |
---|
100 | extern void Wifi_MacInit(void); |
---|
101 | extern void Wifi_Interrupt(void); |
---|
102 | extern void Wifi_Update(void); |
---|
103 | |
---|
104 | extern void Wifi_CopyMacAddr(volatile void * dest, volatile void * src); |
---|
105 | extern int Wifi_CmpMacAddr(volatile void * mac1, volatile void * mac2); |
---|
106 | |
---|
107 | extern void Wifi_Init(u32 WifiData); |
---|
108 | extern void Wifi_Deinit(void); |
---|
109 | extern void Wifi_Start(void); |
---|
110 | extern void Wifi_Stop(void); |
---|
111 | extern void Wifi_SetChannel(int channel); |
---|
112 | extern void Wifi_SetWepKey(void * wepkey); |
---|
113 | extern void Wifi_SetWepMode(int wepmode); |
---|
114 | extern void Wifi_SetBeaconPeriod(int beacon_period); |
---|
115 | extern void Wifi_SetMode(int wifimode); |
---|
116 | extern void Wifi_SetPreambleType(int preamble_type); |
---|
117 | extern void Wifi_TxSetup(void); |
---|
118 | extern void Wifi_RxSetup(void); |
---|
119 | extern void Wifi_DisableTempPowerSave(void); |
---|
120 | |
---|
121 | extern int Wifi_SendOpenSystemAuthPacket(void); |
---|
122 | extern int Wifi_SendAssocPacket(void); |
---|
123 | extern int Wifi_SendNullFrame(void); |
---|
124 | extern int Wifi_SendPSPollFrame(void); |
---|
125 | extern int Wifi_ProcessReceivedFrame(int macbase, int framelen); |
---|
126 | |
---|
127 | extern void Wifi_Sync(void); |
---|
128 | extern void Wifi_SetSyncHandler(WifiSyncHandler sh); |
---|
129 | |
---|
130 | |
---|
131 | #ifdef __cplusplus |
---|
132 | }; |
---|
133 | #endif |
---|
134 | |
---|
135 | |
---|
136 | #endif |
---|