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 all, I have difficulty of compiling viclowlevel.c and viclowlevel.h . when I compile that it shows the error below,
..\sdfat1\SingleFAT\viclowlevel.c(5): error: #77-D: this declaration has no storage class or type specifier ..\sdfat1\SingleFAT\viclowlevel.c(5): error: #65: expected a ";"
the .c and .h file are as shown below:
#define IRQ_MASK 0x00000080
#include "viclowlevel.h"
inline unsigned asm_get_cpsr(void) { unsigned long retval; asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ ); return retval; }
inline void asm_set_cpsr(unsigned val) { asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) ); }
unsigned enableIRQ(void) { unsigned _cpsr;
_cpsr = asm_get_cpsr(); asm_set_cpsr(_cpsr & ~IRQ_MASK); return _cpsr; }
unsigned disableIRQ(void) { unsigned _cpsr;
_cpsr = asm_get_cpsr(); asm_set_cpsr(_cpsr | IRQ_MASK); return _cpsr; }
unsigned restoreIRQ(unsigned oldCPSR) { unsigned _cpsr;
_cpsr = asm_get_cpsr(); asm_set_cpsr((_cpsr & ~IRQ_MASK) | (oldCPSR & IRQ_MASK)); return _cpsr; }
#ifndef _viclowlevel_ #define _viclowlevel_
unsigned enableIRQ(void); unsigned disableIRQ(void); unsigned restoreIRQ(unsigned oldCPSR); inline unsigned asm_get_cpsr(void); inline void asm_set_cpsr(unsigned val);
#endif //_viclowlevel_
I know there are some problems of getting inline after I have added "__" in front of the word inline
it still say that :
..\sdfat1\SingleFAT\viclowlevel.c(8): error: #20: identifier "asm" is undefined ..\sdfat1\SingleFAT\viclowlevel.c(8): error: #65: expected a ";" ..\sdfat1\SingleFAT\viclowlevel.c(14): error: #20: identifier "asm" is undefined ..\sdfat1\SingleFAT\viclowlevel.c(14): error: #65: expected a ";"
please help ~~
Next time you rip some code off a random internet page and plug it into your program, you might want to check first if it's intended for the same compiler you're using.
Or at least, if you do, don't come here wondering why it didn't work.