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.
I try to compile ucOSII in keil C51. But it tells me a error at
struct os_event { UBYTE OSEventGrp; /* Group corresponding to tasks waiting for event to occur */ UBYTE OSEventTbl[8]; /* List of tasks waiting for event to occur */ UWORD OSEventCnt; /* Count of used when event is a semaphore */ far void *OSEventPtr; /* };
You have an unclosed comment in the posted snippet. I assume that's a typo. Try writing it as "void far *OSEventPtr". The syntax for memory specifiers in Keil C is a little odd, and doesn't quite match the behavior of, say, the ANSI C "const" qualifer. Don't forget FVAR and FARRAY to create those far pointers from integer addresses. There's an extra offset to take into account.
"Can anyone tell me how to use far and near to define a pointer?" Read the Manual - does Keil C51 support 'far' and 'near' pointers? As I keep saying, This is why you should always encapsulate all your compiler dependencies in #defines!! http://www.keil.com/forum/docs/thread1675.asp http://www.keil.com/forum/docs/thread31.asp http://www.keil.com/forum/docs/thread3000.asp It may be beyond your control, but "UWORD" is a bad name for a type, since "Word" is ambiguous - it could mean 16 bits on a 16-bit machine, 24 bits on a 24-bit machine, 32 bits on a 32-bit machine, etc, etc,...