#168526 - hacker013 - Sat May 02, 2009 3:47 pm
hey,
I decided to switch to c++ and ported a basic wifi setup from c to c++ but now i'm getting some errors about pointers which point to functions.
Error message:
make -C arm7
make[1]: Entering directory `/c/UZProject/DSDEV/arm7'
wifi.cpp
arm-eabi-g++ -MMD -MP -MF /c/UZProject/DSDEV/arm7/build/wifi.d -g -Wall -O2 -mcp
u=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I
/c/UZProject/DSDEV/arm7/include -I/c/UZProject/DSDEV/arm7/build -I/c/UZProject/DSDEV/arm7/source -I/c/UZProject/DSDEV/arm7/../dsdev_engine -I/c/devkitPro/libnds/include -I/c/UZProject/DSDEV/arm7/build -DARM7 -fno-rtti -fno-exceptions -fno-rtti -c /c/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp -o wifi.o
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp: In constructor 'WIFI::WIFI()':
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp:38: error: argument of type 'void (WIFI::)()' does not match 'void (*)()'
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp: In member function 'void WIFI::arm7_fifo()':
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp:138: error: argument of type 'void (WIFI::)()' does not match 'void (*)()'
make[2]: *** [wifi.o] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/UZProject/DSDEV/arm7'
make: *** [arm7/DSDEV.elf] Error 2
wifi.cpp
What i'm doing wrong and how can I fix this?
_________________
Website / Blog
Let the nds be with you.
I decided to switch to c++ and ported a basic wifi setup from c to c++ but now i'm getting some errors about pointers which point to functions.
Error message:
make -C arm7
make[1]: Entering directory `/c/UZProject/DSDEV/arm7'
wifi.cpp
arm-eabi-g++ -MMD -MP -MF /c/UZProject/DSDEV/arm7/build/wifi.d -g -Wall -O2 -mcp
u=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -I
/c/UZProject/DSDEV/arm7/include -I/c/UZProject/DSDEV/arm7/build -I/c/UZProject/DSDEV/arm7/source -I/c/UZProject/DSDEV/arm7/../dsdev_engine -I/c/devkitPro/libnds/include -I/c/UZProject/DSDEV/arm7/build -DARM7 -fno-rtti -fno-exceptions -fno-rtti -c /c/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp -o wifi.o
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp: In constructor 'WIFI::WIFI()':
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp:38: error: argument of type 'void (WIFI::)()' does not match 'void (*)()'
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp: In member function 'void WIFI::arm7_fifo()':
c:/UZProject/DSDEV/arm7/../dsdev_engine/wifi.cpp:138: error: argument of type 'void (WIFI::)()' does not match 'void (*)()'
make[2]: *** [wifi.o] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/UZProject/DSDEV/arm7'
make: *** [arm7/DSDEV.elf] Error 2
wifi.cpp
Code: |
#include "wifi.h"
/* Basic WIFI Functions */ WIFI::WIFI() { #ifdef ARM9 if(Wifi_CheckInit()) return; REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR; // enable & clear FIFO u32 Wifi_pass = Wifi_Init( WIFIINIT_OPTION_USELED ); REG_IPC_FIFO_TX = 0x12345678; REG_IPC_FIFO_TX = Wifi_pass; *((volatile u16 *)0x0400010E) = 0; // disable timer3 irqSet( IRQ_TIMER3, wifi_timer_50ms ); // setup timer IRQ irqEnable( IRQ_TIMER3 ); irqSet( IRQ_FIFO_NOT_EMPTY, arm9_fifo ); // setup fifo IRQ irqEnable( IRQ_FIFO_NOT_EMPTY ); REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ; // enable FIFO IRQ Wifi_SetSyncHandler( arm9_synctoarm7 ); // tell wifi lib to use our handler to notify arm7 // set timer3 *((volatile u16 *)0x0400010C) = -6553; // 6553.1 * 256 cycles = ~50ms; *((volatile u16 *)0x0400010E) = 0x00C2; // enable, irq, 1/256 clock while( !Wifi_CheckInit() ) { // wait for arm7 to be initted successfully swiWaitForVBlank(); } #endif #ifdef ARM7 irqSet( IRQ_WIFI, Wifi_Interrupt ); irqEnable( IRQ_WIFI ); //set up FIFO for wifi init and whatnot irqSet( IRQ_FIFO_NOT_EMPTY, arm7_fifo ); irqEnable( IRQ_FIFO_NOT_EMPTY ); REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR | IPC_FIFO_RECV_IRQ; #endif }; WIFI::~WIFI() { #ifdef ARM9 if( Wifi_CheckInit() ) { Wifi_DisconnectAP(); Wifi_DisableWifi(); //just wait a while to give ARM7 a chance to finish off the wifi for( int j = 0; j < 30; ++j ) swiWaitForVBlank(); } #endif }; #ifdef ARM9 bool WIFI::auto_connect() { Wifi_AutoConnect(); while( true ) { int i = Wifi_AssocStatus(); if( i == ASSOCSTATUS_ASSOCIATED ) { return true; } if( i == ASSOCSTATUS_CANNOTCONNECT ) { return false; } } }; /* Socket Wrapper */ int WIFI::send( int socket, const char * data ) { return send( socket, data, strlen( data ), 0 ); } bool WIFI::socket_create( int * sock, char * host, int port, bool blocking ) { struct sockaddr_in servaddr; if( ( *sock = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ) { return false; } memset( &servaddr, 0, sizeof( servaddr ) ); servaddr.sin_family = AF_INET; servaddr.sin_port = htons( port ); if( !inet_aton( host, &servaddr.sin_addr ) ) { servaddr.sin_addr.s_addr = *(unsigned long *) gethostbyname( host )->h_addr_list[0]; } if( blocking ) { if( !connect( *sock, (struct sockaddr *) &servaddr, sizeof( servaddr ) ) ) { return true; } } else { if( !connect( *sock, (struct sockaddr *) &servaddr, sizeof( servaddr ) ) ) { int i = 1; ioctl( *sock, FIONBIO, &i ); return true; } } return false; } /* Intern WIFI Functions */ //wifi timer function, to update internals of sgIP void WIFI::wifi_timer_50ms() { Wifi_Timer( 50 ); } //notification function to send fifo message to arm7 void WIFI::arm9_synctoarm7() { REG_IPC_FIFO_TX=0x87654321; } //interrupt handler to receive fifo messages from arm7 void WIFI::arm9_fifo() { if( REG_IPC_FIFO_RX == 0x87654321 ) Wifi_Sync(); } #endif #ifdef ARM7 void WIFI::arm7_synctoarm9() { REG_IPC_FIFO_TX = 0x87654321; } //interrupt handler to allow incoming notifications from arm9, including wifi init request void WIFI::arm7_fifo() { u32 msg = REG_IPC_FIFO_RX; if( msg == 0x12345678 ) { irqDisable( IRQ_FIFO_NOT_EMPTY ); while( REG_IPC_FIFO_CR & IPC_FIFO_RECV_EMPTY ) { swiWaitForVBlank(); } Wifi_Init( REG_IPC_FIFO_RX ); Wifi_SetSyncHandler( arm7_synctoarm9 ); //allow wifi lib to notify arm9 irqEnable( IRQ_FIFO_NOT_EMPTY ); } else if( msg == 0x87654321 ) { Wifi_Sync(); } } #endif |
What i'm doing wrong and how can I fix this?
_________________
Website / Blog
Let the nds be with you.