1 | /* |
---|
2 | * Description: |
---|
3 | * HPPA fast spinlock semaphores based on LDCWX instruction. |
---|
4 | * These semaphores are not known to RTEMS. |
---|
5 | * |
---|
6 | * TODO: |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1994,95 by Division Incorporated |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _INCLUDE_HPPA1_1_SEMAPHORE_H |
---|
18 | #define _INCLUDE_HPPA1_1_SEMAPHORE_H |
---|
19 | |
---|
20 | #ifdef __cplusplus |
---|
21 | extern "C" { |
---|
22 | #endif |
---|
23 | |
---|
24 | /* |
---|
25 | * This structure has hardware requirements. |
---|
26 | * LDCWX opcode requires 16byte alignment for the lock |
---|
27 | * 'lock' must be first member of structure. |
---|
28 | */ |
---|
29 | |
---|
30 | #define SEM_ALIGN 16 |
---|
31 | |
---|
32 | typedef volatile struct { |
---|
33 | |
---|
34 | rtems_unsigned32 lock __attribute__ ((aligned (SEM_ALIGN))); |
---|
35 | |
---|
36 | rtems_unsigned32 flags; |
---|
37 | |
---|
38 | void *owner_tcb; /* for debug/commentary only */ |
---|
39 | |
---|
40 | rtems_unsigned32 user; /* for use by user */ |
---|
41 | |
---|
42 | } hppa_semaphore_t; |
---|
43 | |
---|
44 | /* |
---|
45 | * Values for flags |
---|
46 | */ |
---|
47 | |
---|
48 | #define HPPA_SEM_IN_USE 0x0001 /* semaphore owned by somebody */ |
---|
49 | #define HPPA_SEM_NO_SPIN 0x0002 /* don't spin if unavailable */ |
---|
50 | #define HPPA_SEM_INITIALLY_FREE 0x0004 /* init it to be free */ |
---|
51 | |
---|
52 | /* |
---|
53 | * Caller specifiable flags |
---|
54 | */ |
---|
55 | |
---|
56 | #define HPPA_SEM_CALLER_FLAGS (HPPA_SEM_NO_SPIN | HPPA_SEM_INITIALLY_FREE) |
---|
57 | |
---|
58 | void hppa_semaphore_pool_initialize(void *pool_base, int pool_size); |
---|
59 | |
---|
60 | rtems_unsigned32 hppa_semaphore_acquire(hppa_semaphore_t *sp, int flag); |
---|
61 | |
---|
62 | void hppa_semaphore_release(hppa_semaphore_t *sp); |
---|
63 | |
---|
64 | hppa_semaphore_t *hppa_semaphore_allocate(rtems_unsigned32 which, int flag); |
---|
65 | |
---|
66 | #ifdef __cplusplus |
---|
67 | } |
---|
68 | #endif |
---|
69 | |
---|
70 | #endif /* ! _INCLUDE_SEMAPHORE_H */ |
---|