From: rketcham <Ric...@gm...> - 2008-06-03 13:09:12
|
That's because I didn't write it in C++ and I'm sloppy... C will let you get away with more than C++. This should fix it: //**************************************************************************// //putmem - Write val to the register located at addr. //**************************************************************************// static void putmem(u32 addr, u32 val) { regaddr = reinterpret_cast<unsigned char*>(map) + (addr & MAP_MASK); *(u32*) regaddr = val; } //**************************************************************************// //getmem - Get the register address //**************************************************************************// static u32 getmem(u32 addr) { u32 val; regaddr = reinterpret_cast<unsigned char*>(map) + (addr & MAP_MASK); val = *(u32*) regaddr; return val; } -Rich bltpyro wrote: > > > > rketcham wrote: >> >> Hello, >> This program should work out of the box: >> >> http://docwiki.gumstix.org/Sample_code/C/SPI#Direct_Register_Access_SPI_C_Code_For_The_PXA270 >> > > hi i am trying to use this code but when i try to compile it it says : > 217: error: pointer of type 'void *' used in arithmetic > 228: error: pointer of type 'void *' used in arithmetic > > referring to the getmem and putmem where it does: > static void putmem(u32 addr, u32 val) > { > regaddr = map + (addr & MAP_MASK); > *(u32*) regaddr = val; > } > > and map is a null pointer. am i doing something wrong? im still learning > c++ and about gumstix, so i really have no idea what to do. thanks > > -- View this message in context: http://www.nabble.com/SPI-output-tp16208298p17623155.html Sent from the Gumstix mailing list archive at Nabble.com. |