We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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); }