2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 /*****************************************************************************
37 * @(#) n8_semaphore.h 1.10@(#)
38 *****************************************************************************/
40 /*****************************************************************************/
41 /** @file n8_semaphore.h
42 * @brief The include file for the n8 semaphore
45 * This file contains the prototypes for the semaphore implementation.
47 *****************************************************************************/
49 /*****************************************************************************
51 * 11/25/02 brr Added prototype for n8_delete_process_init_sem.
52 * 10/25/02 brr Clean up function prototypes & include files.
53 * 06/11/02 hml Deleted unused protos and added the processSem operations.
54 * 12/20/01 bac Added N8_SKS_SEM_BASE. Bug #436.
55 * 10/29/01 msz Added N8_BNC_SEM_BASE and N8_BM_SEM_BASE
56 * 10/08/01 msz Added N8_UPDATE_ALL_SEM_BASE.
57 * 08/16/01 bac Fixed a non-terminated comment.
58 * 08/15/01 brr Added VxWorks support.
59 * 08/08/01 msz Moved semun to n8_OS_intf.h
60 * 08/08/01 hml Completed the set of prototypes for version 1.1 and added
61 * some defines to be the base keys for semaphore creation.
62 * 08/02/01 hml Added prototypes for the process level, system level and PCI
64 * 06/13/01 hml Original version.
65 ****************************************************************************/
66 #ifndef _N8_SEMAPHORE_H
67 #define _N8_SEMAPHORE_H
69 #include "n8_pub_errors.h"
70 #include "n8_common.h"
71 #include "n8_OS_intf.h"
73 /*****************************************************************************
75 *****************************************************************************/
76 #define N8_CONTEXT_SEM_BASE 0xbabe1000
77 #define N8_QUEUE_SEM_BASE 0xbabe1200
78 #define N8_HARDWARE_SEM_BASE 0xbabe1300
79 #define N8_UPDATE_ALL_SEM_BASE 0xbabe1400
80 #define N8_BNC_SEM_BASE 0xbabe1500
81 #define N8_BM_SEM_BASE 0xbabe1600
82 #define N8_SKS_SEM_BASE 0xbabe1700
84 /* Note: the N8_QUEUE_SEM_BASE and N8_HARDWARE_SEM_BASE values make an */
85 /* assumption that there are at most 85 control sets (because */
86 /* N8_NUM_COMPONENTS = 3, and 256/3 = 85). And it is assumed that the */
87 /* each value will have x100 between them. */
89 /*****************************************************************************/
91 /*****************************************************************************
93 *****************************************************************************/
95 n8_create_process_init_sem(void);
98 n8_delete_process_init_sem(void);
101 n8_acquire_process_init_sem(void);
104 n8_release_process_init_sem(void);
107 n8_get_system_sem(N8_SemKey_t semKey
, int initValue
, N8_SystemSem_t
*handle_p
);
110 n8_acquire_system_sem(N8_SystemSem_t semID
);
113 n8_release_system_sem(N8_SystemSem_t semID
);
115 /* These are used in both kernel and user space for locking the allocation map.
116 In user space these will be pthread calls. In kernel space they resolve to
117 the Atomic lock calls. */
119 N8_initProcessSem(n8_Lock_t
*lock_p
);
122 N8_deleteProcessSem(n8_Lock_t
*lock_p
);
125 N8_acquireProcessSem(n8_Lock_t
*lock_p
);
128 N8_releaseProcessSem(n8_Lock_t
*lock_p
);