summaryrefslogtreecommitdiffstats
path: root/c/src/exec/posix/include/intr.h
blob: f07d1f95528bc97b91e000e79bb73c69c82304ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* intr.h
 *
 *  XXX: It is unclear if the type "intr_t" should be defined when
 *       _POSIX_INTERRUPT_CONTROL is not.
 *
 *  $Id$
 */

#ifndef __POSIX_INTERRUPTS_h
#define __POSIX_INTERRUPTS_h

#include <rtems/posix/features.h>
#include <sys/types.h>
#include <sys/time.h>

#if defined(_POSIX_INTERRUPT_CONTROL)

/*
 *  22.2 Concepts, P1003.4b/D8, p. 73
 */

typedef int intr_t;

/*
 *  22.3.1 Associate a User-Written ISR with an Interrupt, P1003.4b/D8, p. 74
 */

/*
 *  Return codes from an interrupt handler
 */

#define INTR_HANDLED_NOTIFY         0 /* ISR handled this interrupt, notify */
                                      /*   the thread that registered the */
                                      /*   ISR that the interrupt occurred. */
#define INTR_HANDLED_DO_NOT_NOTIFY  1 /* ISR handled this interrupt, but */
                                      /*   do NOT perform notification. */
#define INTR_NOT_HANDLED            2 /* ISR did not handle this interrupt, */
                                      /*   let the next handler try. */

int intr_capture(
  intr_t          intr,
  int           (*intr_handler)( void *area ),
  volatile void   *area,
  size_t           areasize
);

int intr_release(
  intr_t    intr,
  int     (*intr_handler)( void *area )
);

int intr_lock(
  intr_t  intr
);
  
int intr_unlock(
  intr_t  intr
);
  
/*
 *  22.3.2 Await Interrupt Notification, P1003.4b/D8, p. 76
 */

int intr_timed_wait(
  int                     flags,
  const struct timespec  *timeout
);

#endif

#endif
/* end of include file */