Hi
The following is a trivial routine. Function: Using the SSI controller, write a byte of data (dat) into the SSI (Synchronous Serial Interface)(Luminary LM3S9B96) Tx register(actually a FIFO) and flush the Rx register(also a FIFO) by reading it. Works fine no problem... but the compliler (correctley) says:
Fatfs\port\fm_mmc.c(65): warning: #550-D: variable "rcvdat" was set but never used.
Any ideas on how to keep the code tight (can't see how you can make it tighter... - using direct pointers to the registers) and - stop it complaining?
#define HWREGB(x) (*((volatile unsigned char *)(x))) #define HWREG(x) (*((volatile unsigned long *)(x))) #define SSI0_BASE 0x40008000 // SSI0 // etc void XmitSsi (unsigned char dat) { unsigned char rcvdat; // Write dat // Wait until there is space. while(!(HWREG(SSI0_BASE + SSI_O_SR) & SSI_SR_TNF)){} // Write to the SSI. HWREGB(SSI0_BASE + SSI_O_DR) = dat; // Flush Recieve FIFO // Wait until there is data to be read. while(!(HWREG(SSI0_BASE + SSI_O_SR) & SSI_SR_RNE)){} // Read data from SSI. rcvdat = HWREGB(SSI0_BASE + SSI_O_DR); }
Apolageez - Andrew - thank you as well - I am very much a rookie programmer, although I am a hardware engineer - so that helps (a lot). First time I have used a discussion forum... to answer those questions that are not in any of the reference/text books :) Will be back, if I may... got lots of questions:)