00001 // DSWifi Project - Arm7 Library Header file (dswifi7.h) 00002 // Copyright (C) 2005-2006 Stephen Stair - sgstair@akkit.org - http://www.akkit.org 00003 /****************************************************************************** 00004 DSWifi Lib and test materials are licenced under the MIT open source licence: 00005 Copyright (c) 2005-2006 Stephen Stair 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a copy of 00008 this software and associated documentation files (the "Software"), to deal in 00009 the Software without restriction, including without limitation the rights to 00010 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 00011 of the Software, and to permit persons to whom the Software is furnished to do 00012 so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in all 00015 copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00020 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00022 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00023 SOFTWARE. 00024 ******************************************************************************/ 00025 00026 #ifndef DSWIFI7_H 00027 #define DSWIFI7_H 00028 00029 #include "dswifi_version.h" 00030 00031 // Wifi Sync Handler function: Callback function that is called when the arm9 needs to be told to synchronize with new fifo data. 00032 // 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. 00033 typedef void (*WifiSyncHandler)(); 00034 00035 00036 #ifdef __cplusplus 00037 extern "C" { 00038 #endif 00039 00040 // Read_Flash: Reads an arbitrary amount of data from the firmware flash chip 00041 // int address: Offset to start reading from in the flash chip 00042 // char * destination: Pointer to a memory buffer to hold incoming data 00043 // int length: The number of bytes to read 00044 extern void Read_Flash(int address, char * destination, int length); 00045 00046 // PowerChip_ReadWrite: Reads or writes a value to the DS's power chip 00047 // int cmp: The byte-long command to send to the chip (top bit 1=read, 0=write - other bits = register ID to read/write) 00048 // int data: The data to write to the chip (if sending a read command, this should be zero) 00049 // Returns: The data read returned by the serial connection; only really useful when reading. 00050 extern int PowerChip_ReadWrite(int cmd, int data); 00051 00052 // Wifi_Interrupt: Handler for the arm7 wifi interrupt. Should be called by the 00053 // interrupt handler on arm7, and should *not* have multiple interrupts enabled. 00054 extern void Wifi_Interrupt(); 00055 00056 // Wifi_Update: Sync function to ensure data continues to flow between the two 00057 // CPUs smoothly. Should be called at a periodic interval, such as in vblank. 00058 extern void Wifi_Update(); 00059 00060 // Wifi_Init: Requires the data returned by the arm9 wifi init call. The arm9 00061 // init call's returned data must be passed to the arm7 and then given to this 00062 // function. (or else very bad things happen) 00063 // This function also enables power to the wifi system, which will shorten 00064 // battery life. 00065 // unsigned long WifiData: You must pass the 32bit value returned by the call to 00066 // Wifi_Init on the ARM9. 00067 extern void Wifi_Init(unsigned long WifiData); 00068 00069 // Wifi_Deinit: In the case that it is necessary, this function cuts power to 00070 // the wifi system. After this the wifi will be unusable until Wifi_Init is 00071 // called again. 00072 extern void Wifi_Deinit(); 00073 00074 // Wifi_Sync: Call this function when requested to sync by the arm9 side of the 00075 // wifi lib 00076 extern void Wifi_Sync(); 00077 00078 // Wifi_SetSyncHandler: Call this function to request notification of when the 00079 // ARM9-side Wifi_Sync function should be called. 00080 // WifiSyncHandler sh: Pointer to the function to be called for notification. 00081 extern void Wifi_SetSyncHandler(WifiSyncHandler sh); 00082 00083 extern void installWifiFIFO(); 00084 00085 #ifdef __cplusplus 00086 }; 00087 #endif 00088 00089 00090 #endif // DSWIFI7_H