cint.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * cint.h -- C interface for TriCore trap and interrupt handlers.
  3. *
  4. * Copyright (C) 1998 HighTec EDV-Systeme GmbH.
  5. *
  6. */
  7. #ifndef __cint_h
  8. #define __cint_h
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define MAX_TRAPS 8
  13. #define MAX_INTRS 256
  14. /* The following two functions install the vector tables and initialize
  15. chained interrupt handlers, respectively. There is usually no need
  16. to call these functions, as they are declared as "constructors" so
  17. that they will be automatically called by __main (), which in turn
  18. is automatically called as part of the function prologue of main (). */
  19. extern void _init_vectab (void);
  20. extern void _init_hnd_chain (void);
  21. /* Install an interrupt handler for interrupt number intno. If this
  22. interrupt occurs, the handler will be called with the given argument.
  23. A non-zero return value indicates success, zero indicates an error
  24. occurred and the handler couldn't be installed successfully. */
  25. extern int _install_int_handler (int intno, void (*handler) (int), int arg);
  26. /* Install a chained handler for interrupt number intno. If this
  27. interrupt occurs, all handlers registered for it will be called
  28. with their given argument. The return value for the function below
  29. is a handle that can be used to remove the handler at a later time.
  30. A return value of NULL indicates an error. */
  31. extern void *_install_chained_int_handler (int intno, void (*handler) (int),
  32. int arg);
  33. /* Remove a chained handler for interrupt number intno. Ptr is the
  34. handle returned by _install_chained_int_handler. A return value
  35. of zero indicates success, non-zero indicates an error occurred. */
  36. extern int _remove_chained_int_handler (int intno, void *ptr);
  37. /* Install a trap handler for trap number trapno. If this trap occurs,
  38. the handler is called with the TIN (trap identification number) as
  39. its only argument. */
  40. extern int _install_trap_handler (int trapno, void (*handler) (int));
  41. /* Definitions for compatibility with previous versions of this interface. */
  42. #define TrapInit _init_vectab
  43. #define cintsetup _init_vectab
  44. #define cinthandler _install_int_handler
  45. #define ccintsetup _init_hnd_chain
  46. #define ccinthandler _install_chained_int_handler
  47. #define freechain_hnd _remove_chained_int_handler
  48. #define ctraphandler _install_trap_handler
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif /* __cint_h */