0

could someone explain this typedef is use is for declaring interrupt service routines.

#pragma language=extended
typedef void (__interrupt *__fp)();

void OSTickISR (void);
void OSCtxSw   (void);
void AdcIsr    (void);
artless noise
  • 21,212
  • 6
  • 68
  • 105
  • 5
    As it stands, the question is unanswerable. The `__interrupt` notation is not standard C; it is therefore platform-specific but we have no information about which platform. The code shown does not use the `typedef` (the name introduced is `__fp`, probably). The `typedef` is sloppy C; it says that the function pointers of type `__fp` return `void` (nothing) and take an indeterminate argument list (but not a variadic argument list — that is, one with ellipsis, `...`). To say the function takes no parameters in C, you must write `typedef void (__interrupt *__fp)(void);`. – Jonathan Leffler May 17 '14 at 20:25
  • The functions declared might be compatible with the `typedef`; they are not declared with `__interrupt` which might, or might not, matter. – Jonathan Leffler May 17 '14 at 20:26
  • Perhaps I have found the full code here: https://github.com/vnd/scuba-computer/blob/master/interrupts.c The file is pretty much a 'do nothing' due to the big fate '#if 0' that excludes the most all the code following what is in the question. – Mahonri Moriancumer May 17 '14 at 21:11
  • This looks like [ucos](http://en.wikipedia.org/wiki/MicroC/OS-II) (as per the [scuba-computer about](https://github.com/vnd/scuba-computer) page). You need to be more specific about what you don't understand and give more details of the system. Is this for an AVR, an ARM, etc and with which compiler. The `#pragma` seems to indicate something non-standard. As well, there are different versions of [tag:ucos]. – artless noise May 20 '14 at 21:54

0 Answers0