Added more values to the default firmware (mostly Wifi settings)

This commit is contained in:
luigi__ 2008-12-19 15:33:06 +00:00
parent 6b49906cf5
commit aef05f28ed
3 changed files with 64 additions and 20 deletions

View File

@ -784,19 +784,57 @@ int NDS_CreateDummyFirmware( struct NDS_fw_config_data *user_settings)
fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FE00], 0);
fill_user_data_area( user_settings, &MMU.fw.data[ 0x3FF00], 1);
#ifdef EXPERIMENTAL_WIFI
memcpy(MMU.fw.data+0x36,FW_Mac,sizeof(FW_Mac)) ;
memcpy(MMU.fw.data+0x44,FW_WIFIInit,sizeof(FW_WIFIInit)) ;
MMU.fw.data[0x41] = 18 ; /* bits per RF value */
MMU.fw.data[0x42] = 12 ; /* # of RF values to init */
memcpy(MMU.fw.data+0x64,FW_BBInit,sizeof(FW_BBInit)) ;
memcpy(MMU.fw.data+0xCE,FW_RFInit,sizeof(FW_RFInit)) ;
memcpy(MMU.fw.data+0xF2,FW_RFChannel,sizeof(FW_RFChannel)) ;
memcpy(MMU.fw.data+0x146,FW_BBChannel,sizeof(FW_BBChannel)) ;
/* Config length */
MMU.fw.data[0x2C] = 0x38;
MMU.fw.data[0x2D] = 0x01;
MMU.fw.data[0x2E] = 0x00;
/* Wifi version */
MMU.fw.data[0x2F] = 0x00;
/* MAC address */
memcpy((MMU.fw.data + 0x36), FW_Mac, sizeof(FW_Mac));
/* Enabled channels */
MMU.fw.data[0x3C] = 0xFE;
MMU.fw.data[0x3D] = 0x3F;
MMU.fw.data[0x3E] = 0xFF;
MMU.fw.data[0x3F] = 0xFF;
/* RF related */
MMU.fw.data[0x40] = 0x02;
MMU.fw.data[0x41] = 0x18;
MMU.fw.data[0x42] = 0x0C;
MMU.fw.data[0x43] = 0x01;
/* Wifi I/O init values */
memcpy((MMU.fw.data + 0x44), FW_WIFIInit, sizeof(FW_WIFIInit));
/* Wifi BB init values */
memcpy((MMU.fw.data + 0x64), FW_BBInit, sizeof(FW_BBInit));
/* Wifi RF init values */
memcpy((MMU.fw.data + 0xCE), FW_RFInit, sizeof(FW_RFInit));
/* Wifi channel-related init values */
memcpy((MMU.fw.data + 0xF2), FW_RFChannel, sizeof(FW_RFChannel));
memcpy((MMU.fw.data + 0x146), FW_BBChannel, sizeof(FW_BBChannel));
memset((MMU.fw.data + 0x154), 0x10, 0xE);
/* WFC profile */
memcpy((MMU.fw.data + 0x3FA40), FW_WFCProfile, sizeof(FW_WFCProfile));
MMU.fw.data[0x162] = 0x19;
memset((MMU.fw.data + 0x163), 0xFF, 0x9D);
/* Wifi settings CRC16 */
u16 wifi_crc16 = calc_CRC16(0, (MMU.fw.data + 0x2C), 0x138);
MMU.fw.data[0x2A] = (wifi_crc16 & 0xFF);
MMU.fw.data[0x2B] = (wifi_crc16 >> 8);
memcpy(MMU.fw.data+0x03FA40,FW_WFCProfile,sizeof(FW_WFCProfile)) ;
#endif
return TRUE ;
}

View File

@ -18,11 +18,13 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef EXPERIMENTAL_WIFI
#include "wifi.h"
#include "armcpu.h"
#ifdef EXPERIMENTAL_WIFI
wifimac_t wifiMac ;
socket_t WIFI_Host_OpenChannel(u8 num) ;
@ -32,6 +34,8 @@ u16 WIFI_Host_RecvData(socket_t sock, u8 *data, u16 maxLength) ;
BOOL WIFI_Host_InitSystem(void) ;
void WIFI_Host_ShutdownSystem(void) ;
#endif
/*******************************************************************************
Firmware info needed for wifi, if no firmware image is available
@ -41,7 +45,7 @@ void WIFI_Host_ShutdownSystem(void) ;
*******************************************************************************/
u8 FW_Mac[6] = { 'D','S','E',0x00,0x00,0x00 } ;
u8 FW_Mac[6] = { 0x00, 0x09, 0xBF, 0x12, 0x34, 0x56 } ;
u8 FW_WIFIInit[32] = { 0x02,0x00, 0x17,0x00, 0x26,0x00, 0x18,0x18,
0x48,0x00, 0x40,0x48, 0x58,0x00, 0x42,0x00,
0x40,0x01, 0x64,0x80, 0xE0,0xE0, 0x43,0x24,
@ -144,6 +148,8 @@ u8 FW_WFCProfile[0xC0] = { 'D','e','S','m','u','m','E',' ','S','o','f','t','A',
0,0 /* CRC */
} ;
#ifdef EXPERIMENTAL_WIFI
/*******************************************************************************
RF-Chip

View File

@ -17,11 +17,13 @@
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef EXPERIMENTAL_WIFI
#ifndef WIFI_H
#define WIFI_H
#include "types.h"
#ifdef EXPERIMENTAL_WIFI
/* standardize socket interface for linux and windows */
#ifdef WIN32
#include <winsock2.h>
@ -38,8 +40,6 @@
#define BASEPORT 7000 /* channel 1: 7000 ... channel 13: 7012 */
/* FIXME: make it configureable */
#include "types.h"
#define REG_WIFI_MODE 0x004
#define REG_WIFI_WEP 0x006
#define REG_WIFI_IF 0x010
@ -446,6 +446,8 @@ u16 WIFI_read16(wifimac_t *wifi,u32 address) ;
/* wifimac timing */
void WIFI_usTrigger(wifimac_t *wifi) ;
#endif
/* wifi data to be stored in firmware, when no firmware image was loaded */
extern u8 FW_Mac[6];
extern u8 FW_WIFIInit[32] ;
@ -456,5 +458,3 @@ extern u8 FW_BBChannel[14] ;
extern u8 FW_WFCProfile[0xC0] ;
#endif
#endif /* #ifdef EXPERIMENTAL_WIFI */