FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/gdd_dio/gdd_sys.h @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GSM-F&D (8411) | |
4 | Modul : gdd_sys.h | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2005 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : API for limited system functionality offered to application | |
18 | domain libraries. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef GDD_SYS_H | |
23 #define GDD_SYS_H | |
24 | |
25 /*==== DEFINITIONS ==========================================================*/ | |
26 | |
27 typedef int T_GDD_SEM; | |
28 | |
29 | |
30 /*==== DYNAMIC MEMORY FUNCTIONS =============================================*/ | |
31 | |
32 | |
33 /* | |
34 +------------------------------------------------------------------------------ | |
35 | Function : gdd_sys_mem_malloc | |
36 +------------------------------------------------------------------------------ | |
37 | Description : Allocate memory. | |
38 | | |
39 | Parameters : size - Size of memory required. | |
40 | | |
41 | Return : Pointer to first byte of allocated memory. | |
42 | 0 if allocation failed. | |
43 +------------------------------------------------------------------------------ | |
44 */ | |
45 void * gdd_sys_mem_malloc(int size); | |
46 | |
47 | |
48 /* | |
49 +------------------------------------------------------------------------------ | |
50 | Function : gdd_sys_mem_free | |
51 +------------------------------------------------------------------------------ | |
52 | Description : Release memory which was previously allocated. | |
53 | | |
54 | Parameters : p - Pointer to memory to be deallocated | |
55 +------------------------------------------------------------------------------ | |
56 */ | |
57 void gdd_sys_mem_free(void * p); | |
58 | |
59 | |
60 /*==== SEMAPHORE FUNCTIONS ==================================================*/ | |
61 | |
62 | |
63 /* | |
64 +------------------------------------------------------------------------------ | |
65 | Function : gdd_sys_sem_open | |
66 +------------------------------------------------------------------------------ | |
67 | Description : Opens a (counting) semaphore specified by its name. If the | |
68 | semaphore does not exist, it will be created with the initial | |
69 | count given. If the semaphore already exists the parameter count | |
70 | will be ignored. | |
71 | | |
72 | Parameters : name - Some name to identify the semaphore | |
73 | count - initial count (e.g. 1 for a binary sem.) | |
74 | | |
75 | Return : Returns handle to created semaphore, or -1 if an error occured. | |
76 +------------------------------------------------------------------------------ | |
77 */ | |
78 T_GDD_SEM gdd_sys_sem_open(char * name, unsigned short count); | |
79 | |
80 | |
81 /* | |
82 +------------------------------------------------------------------------------ | |
83 | Function : gdd_sys_sem_close | |
84 +------------------------------------------------------------------------------ | |
85 | Description : Closes a semaphore | |
86 | | |
87 | Parameters : sem - handle of semaphore | |
88 | | |
89 | Return : 0 = succees | |
90 | 1 = error | |
91 +------------------------------------------------------------------------------ | |
92 */ | |
93 int gdd_sys_sem_close(T_GDD_SEM sem); | |
94 | |
95 | |
96 /* | |
97 +------------------------------------------------------------------------------ | |
98 | Function : gdd_sys_sem_down | |
99 +------------------------------------------------------------------------------ | |
100 | Description : This functions obtains the specified semaphore, i.e. | |
101 | the counter is decremented, if it is greater than zero. | |
102 | If the counter is equal to zero, than the calling task is | |
103 | suspended until the counter is incremented by another task. | |
104 | If the caller is a non-task thread the function returns | |
105 | immediately regardless if the request can be satisfied or not. | |
106 | In this case, -1 is returned if the counter was already zero. | |
107 | | |
108 | Parameters : sem - handle of semaphore | |
109 | | |
110 | Return : 0 = succees | |
111 | 1 = error | |
112 +------------------------------------------------------------------------------ | |
113 */ | |
114 int gdd_sys_sem_down(T_GDD_SEM sem); | |
115 | |
116 | |
117 /* | |
118 +------------------------------------------------------------------------------ | |
119 | Function : gdd_sys_sem_down | |
120 +------------------------------------------------------------------------------ | |
121 | Description : Releases a semaphore, i.e. counter is incremented. | |
122 | | |
123 | Parameters : sem - handle of semaphore | |
124 | | |
125 | Return : 0 = succees | |
126 | 1 = error | |
127 +------------------------------------------------------------------------------ | |
128 */ | |
129 int gdd_sys_sem_up(T_GDD_SEM sem); | |
130 | |
131 | |
132 /* | |
133 +------------------------------------------------------------------------------ | |
134 | Function : gdd_sys_sem_status | |
135 +------------------------------------------------------------------------------ | |
136 | Description : Query (obtain) the counter of a semaphore. | |
137 | | |
138 | Parameters : sem - handle of semaphore | |
139 | count - output variable to pass back the counter | |
140 | | |
141 | Return : 0 = succees | |
142 | 1 = error | |
143 +------------------------------------------------------------------------------ | |
144 */ | |
145 int gdd_sys_sem_status(T_GDD_SEM sem, /*out*/ unsigned short * count); | |
146 | |
147 | |
148 #endif /* GDD_SYS_H */ |