Mistake on this page?
Report an issue in GitHub or email us
rda_sys_wrapper.h
1 /* Copyright (c) 2019 Unisoc Communications Inc.
2  * SPDX-License-Identifier: Apache-2.0
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if 1
18 #ifndef _RDA_SYS_WRAPPER_H_
19 #define _RDA_SYS_WRAPPER_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /* Alarm */
26 /**
27  * @brief : get current time in units of micro second
28  * @param[in] :
29  * @param[out]:
30  * @return : return time value with uint32 type
31  */
32 extern unsigned long rda_get_cur_time_ms(void);
33 
34 /**
35  * @brief : create an alarm with given function, return timer handle
36  * @param[in] : func(callback)/data(pass to func)/mode(once or periodic)
37  * @param[out]:
38  * @return : return timer handle, a pointer to the timer structure, non-zero is valid
39  */
40 extern void * rda_alarm_create_v2(void *func, unsigned int data, unsigned int mode);
41 extern void * rda_alarm_create(void *func, unsigned int data);
42 
43 /**
44  * @brief : delete an alarm with given handle, then reset the handle
45  * @param[in] : *handle(pointer to the timer structure)
46  * @param[out]: **handle(address of the handle variable)
47  * @return :
48  */
49 extern int rda_alarm_delete(void **handle);
50 
51 /**
52  * @brief : start an alarm, raise a function call after given timeout delay
53  * @param[in] : handle(pointer to the timer structure)/timeout(micro second)
54  * @param[out]:
55  * @return :
56  */
57 extern int rda_alarm_start(void *handle, unsigned int timeout_ms);
58 
59 /**
60  * @brief : stop an alarm, will not raise a function call any more
61  * @param[in] : handle(pointer to the timer structure)
62  * @param[out]:
63  * @return :
64  */
65 extern int rda_alarm_stop(void *handle);
66 
67 
68 /* Semaphore */
69 /**
70  * @brief : create a semaphore
71  * @param[in] : name and initial valve of semaphore
72  * @param[out]:
73  * @return : return ERR or NO_ERR
74  */
75 extern void* rda_sem_create(unsigned int count);
76 
77 /**
78  * @brief : wait a semaphore
79  * @param[in] : name of semaphore
80  * @param[out]:
81  * @return : return ERR or NO_ERR
82  */
83 extern int rda_sem_wait(void *sem, unsigned int millisec);
84 
85 /**
86  * @brief : release a semaphore
87  * @param[in] : name of semaphore
88  * @param[out]:
89  * @return : return ERR or NO_ERR
90  */
91 extern int rda_sem_release(void *sem);
92 
93 /**
94  * @brief : delete a semaphore
95  * @param[in] : name of semaphore
96  * @param[out]:
97  * @return : return ERR or NO_ERR
98  */
99 extern int rda_sem_delete(void *sem);
100 
101 
102 /* Queue */
103 /**
104  * @brief : create a message queue
105  * @param[in] : size of message queue
106  * @param[out]:
107  * @return : return message queue id or NULL if error
108  */
109 extern void* rda_msgQ_create(unsigned int queuesz);
110 
111 /**
112  * @brief : put a message to queue
113  * @param[in] : message queue id, message value and wait time
114  * @param[out]:
115  * @return : return ERR or NO_ERR
116  */
117 extern int rda_msg_put(void *msgQId, unsigned int msg, unsigned int millisec);
118 
119 /**
120  * @brief : get a message from queue
121  * @param[in] : message queue id, message value and wait time
122  * @param[out]:
123  * @return : return ERR or NO_ERR
124  */
125 extern int rda_msg_get(void *msgQId, unsigned int *value, unsigned int millisec);
126 
127 /* Mail */
128 /**
129  * @brief : create a mail
130  * @param[in] : mail count/size
131  * @param[out]:
132  * @return : return mail handle
133  */
134 void* rda_mail_create(unsigned int msgcnt, unsigned int msgsize);
135 
136 /**
137  * @brief : get a msg from mail
138  * @param[in] : handler name of mail/mail/wait time
139  * @param[out]:
140  * @return : return ERR or NO_ERR
141  */
142 int rda_mail_get(void *rdahandle, void *evt, unsigned int wait);
143 
144 /**
145  * @brief : put a msg to mail
146  * @param[in] : handler of mail/mail/wait time
147  * @param[out]:
148  * @return : return ERR or NO_ERR
149  */
150 
151 int rda_mail_put(void *rdahandle, void *evt, unsigned int wait);
152 
153 /* Mutex */
154 /**
155  * @brief : create a mutex
156  * @param[in] :
157  * @param[out]:
158  * @return : return ERR or NO_ERR
159  */
160 extern void* rda_mutex_create(void);
161 
162 /**
163  * @brief : wait a mutex
164  * @param[in] : id of mutex and wait time
165  * @param[out]:
166  * @return : return ERR or NO_ERR
167  */
168 extern int rda_mutex_wait(void *rdamutex, unsigned int millisec);
169 
170 /**
171  * @brief : release a mutex
172  * @param[in] : id of mutex
173  * @param[out]:
174  * @return : return ERR or NO_ERR
175  */
176 extern int rda_mutex_realease(void *rdamutex);
177 
178 /**
179  * @brief : delete a mutex
180  * @param[in] : id of mutex
181  * @param[out]:
182  * @return : return ERR or NO_ERR
183  */
184 extern int rda_mutex_delete(void *rdamutex);
185 
186 /* Thread */
187 /**
188  * @brief : creat a thread
189  * @param[in] : thread name/thread function/thread fuction argument/stacksize/thread priority
190  * @param[out]:
191  * @return : return thread id
192  */
193 void* rda_thread_new(const char *pcName, void (*thread)(void *arg), void *arg, int stacksize, int priority);
194 
195 /**
196  * @brief : delete a thread
197  * @param[in] : thread id
198  * @param[out]:
199  * @return : return ERR or NO_ERR
200  */
201 int rda_thread_delete(void* id);
202 
203 /**
204  * @brief : get current thread id
205  * @param[in] :
206  * @param[out]:
207  * @return : return thread id
208  */
209 void* rda_thread_get_id(void);
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif /* _RDA_SYS_WRAPPER_H_ */
216 #endif
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.