• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * OS Abstraction Layer Extension - the APIs defined by the "extension" API
4  * are only supported by a subset of all operating systems.
5  *
6  * Copyright (C) 1999-2019, Broadcom.
7  *
8  *      Unless you and Broadcom execute a separate written software license
9  * agreement governing use of this software, this software is licensed to you
10  * under the terms of the GNU General Public License version 2 (the "GPL"),
11  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12  * following added to such license:
13  *
14  *      As a special exception, the copyright holders of this software give you
15  * permission to link this software with independent modules, and to copy and
16  * distribute the resulting executable under terms of your choice, provided that
17  * you also meet, for each linked independent module, the terms and conditions of
18  * the license of that module.  An independent module is a module which is not
19  * derived from this software.  The special exception does not apply to any
20  * modifications of the software.
21  *
22  *      Notwithstanding the above, under no circumstances may you combine this
23  * software in any way with any other Broadcom software provided under a license
24  * other than the GPL, without Broadcom's express prior written consent.
25  *
26  *
27  * <<Broadcom-WL-IPTag/Open:>>
28  *
29  * $Id: osl_ext.h 759145 2018-04-24 05:09:37Z $
30  */
31 
32 #ifndef _osl_ext_h_
33 #define _osl_ext_h_
34 
35 /* ---- Include Files ---------------------------------------------------- */
36 
37 #if defined(TARGETOS_symbian)
38 	#include <e32def.h>
39 	#include <symbian_osl_ext.h>
40 #elif defined(THREADX)
41 	#include <threadx_osl_ext.h>
42 #else
43 	#define OSL_EXT_DISABLED
44 #endif // endif
45 
46 /* Include base operating system abstraction. */
47 #include <osl.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif // endif
52 
53 /* ---- Constants and Types ---------------------------------------------- */
54 
55 /* -----------------------------------------------------------------------
56  * Generic OS types.
57  */
58 typedef enum osl_ext_status_t
59 {
60 	OSL_EXT_SUCCESS,
61 	OSL_EXT_ERROR,
62 	OSL_EXT_TIMEOUT
63 
64 } osl_ext_status_t;
65 #define OSL_EXT_STATUS_DECL(status)	osl_ext_status_t status;
66 
67 #define OSL_EXT_TIME_FOREVER ((osl_ext_time_ms_t)(-1))
68 typedef unsigned int osl_ext_time_ms_t;
69 typedef unsigned int osl_ext_time_us_t;
70 
71 typedef unsigned int osl_ext_event_bits_t;
72 
73 typedef unsigned int osl_ext_interrupt_state_t;
74 
75 /* -----------------------------------------------------------------------
76  * Timers.
77  */
78 typedef enum
79 {
80 	/* One-shot timer. */
81 	OSL_EXT_TIMER_MODE_ONCE,
82 
83 	/* Periodic timer. */
84 	OSL_EXT_TIMER_MODE_REPEAT
85 
86 } osl_ext_timer_mode_t;
87 
88 /* User registered callback and parameter to invoke when timer expires. */
89 typedef void* osl_ext_timer_arg_t;
90 typedef void (*osl_ext_timer_callback)(osl_ext_timer_arg_t arg);
91 
92 /* -----------------------------------------------------------------------
93  * Tasks.
94  */
95 
96 /* Task entry argument. */
97 typedef void* osl_ext_task_arg_t;
98 
99 /* Task entry function. */
100 typedef void (*osl_ext_task_entry)(osl_ext_task_arg_t arg);
101 
102 /* Abstract task priority levels. */
103 typedef enum
104 {
105 	OSL_EXT_TASK_IDLE_PRIORITY,
106 	OSL_EXT_TASK_LOW_PRIORITY,
107 	OSL_EXT_TASK_LOW_NORMAL_PRIORITY,
108 	OSL_EXT_TASK_NORMAL_PRIORITY,
109 	OSL_EXT_TASK_HIGH_NORMAL_PRIORITY,
110 	OSL_EXT_TASK_HIGHEST_PRIORITY,
111 	OSL_EXT_TASK_TIME_CRITICAL_PRIORITY,
112 
113 	/* This must be last. */
114 	OSL_EXT_TASK_NUM_PRIORITES
115 } osl_ext_task_priority_t;
116 
117 #ifndef OSL_EXT_DISABLED
118 
119 /* ---- Variable Externs ------------------------------------------------- */
120 /* ---- Function Prototypes ---------------------------------------------- */
121 
122 /* --------------------------------------------------------------------------
123 ** Semaphore
124 */
125 
126 /****************************************************************************
127 * Function:   osl_ext_sem_create
128 *
129 * Purpose:    Creates a counting semaphore object, which can subsequently be
130 *             used for thread notification.
131 *
132 * Parameters: name     (in)  Name to assign to the semaphore (must be unique).
133 *             init_cnt (in)  Initial count that the semaphore should have.
134 *             sem      (out) Newly created semaphore.
135 *
136 * Returns:    OSL_EXT_SUCCESS if the semaphore was created successfully, or an
137 *             error code if the semaphore could not be created.
138 *****************************************************************************
139 */
140 osl_ext_status_t osl_ext_sem_create(char *name, int init_cnt, osl_ext_sem_t *sem);
141 
142 /****************************************************************************
143 * Function:   osl_ext_sem_delete
144 *
145 * Purpose:    Destroys a previously created semaphore object.
146 *
147 * Parameters: sem (mod) Semaphore object to destroy.
148 *
149 * Returns:    OSL_EXT_SUCCESS if the semaphore was deleted successfully, or an
150 *             error code if the semaphore could not be created.
151 *****************************************************************************
152 */
153 osl_ext_status_t osl_ext_sem_delete(osl_ext_sem_t *sem);
154 
155 /****************************************************************************
156 * Function:   osl_ext_sem_give
157 *
158 * Purpose:    Increments the count associated with the semaphore. This will
159 *             cause one thread blocked on a take to wake up.
160 *
161 * Parameters: sem (mod) Semaphore object to give.
162 *
163 * Returns:    OSL_EXT_SUCCESS if the semaphore was given successfully, or an
164 *             error code if the semaphore could not be created.
165 *****************************************************************************
166 */
167 osl_ext_status_t osl_ext_sem_give(osl_ext_sem_t *sem);
168 
169 /****************************************************************************
170 * Function:   osl_ext_sem_take
171 *
172 * Purpose:    Decrements the count associated with the semaphore. If the count
173 *             is less than zero, then the calling task will become blocked until
174 *             another thread does a give on the semaphore. This function will only
175 *             block the calling thread for timeout_msec milliseconds, before
176 *             returning with OSL_EXT_TIMEOUT.
177 *
178 * Parameters: sem          (mod) Semaphore object to take.
179 *             timeout_msec (in)  Number of milliseconds to wait for the
180 *                                semaphore to enter a state where it can be
181 *                                taken.
182 *
183 * Returns:    OSL_EXT_SUCCESS if the semaphore was taken successfully, or an
184 *             error code if the semaphore could not be created.
185 *****************************************************************************
186 */
187 osl_ext_status_t osl_ext_sem_take(osl_ext_sem_t *sem, osl_ext_time_ms_t timeout_msec);
188 
189 /* --------------------------------------------------------------------------
190 ** Mutex
191 */
192 
193 /****************************************************************************
194 * Function:   osl_ext_mutex_create
195 *
196 * Purpose:    Creates a mutex object, which can subsequently be used to control
197 *             mutually exclusion of resources.
198 *
199 * Parameters: name  (in)  Name to assign to the mutex (must be unique).
200 *             mutex (out) Mutex object to initialize.
201 *
202 * Returns:    OSL_EXT_SUCCESS if the mutex was created successfully, or an
203 *             error code if the mutex could not be created.
204 *****************************************************************************
205 */
206 osl_ext_status_t osl_ext_mutex_create(char *name, osl_ext_mutex_t *mutex);
207 
208 /****************************************************************************
209 * Function:   osl_ext_mutex_delete
210 *
211 * Purpose:    Destroys a previously created mutex object.
212 *
213 * Parameters: mutex (mod) Mutex object to destroy.
214 *
215 * Returns:    OSL_EXT_SUCCESS if the mutex was deleted successfully, or an
216 *             error code if the mutex could not be created.
217 *****************************************************************************
218 */
219 osl_ext_status_t osl_ext_mutex_delete(osl_ext_mutex_t *mutex);
220 
221 /****************************************************************************
222 * Function:   osl_ext_mutex_acquire
223 *
224 * Purpose:    Acquires the indicated mutual exclusion object. If the object is
225 *             currently acquired by another task, then this function will wait
226 *             for timeout_msec milli-seconds before returning with OSL_EXT_TIMEOUT.
227 *
228 * Parameters: mutex        (mod) Mutex object to acquire.
229 *             timeout_msec (in)  Number of milliseconds to wait for the mutex.
230 *
231 * Returns:    OSL_EXT_SUCCESS if the mutex was acquired successfully, or an
232 *             error code if the mutex could not be created.
233 *****************************************************************************
234 */
235 osl_ext_status_t osl_ext_mutex_acquire(osl_ext_mutex_t *mutex, osl_ext_time_ms_t timeout_msec);
236 
237 /****************************************************************************
238 * Function:   osl_ext_mutex_release
239 *
240 * Purpose:    Releases the indicated mutual exclusion object. This makes it
241 *             available for another task to acquire.
242 *
243 * Parameters: mutex (mod) Mutex object to release.
244 *
245 * Returns:    OSL_EXT_SUCCESS if the mutex was released successfully, or an
246 *             error code if the mutex could not be created.
247 *****************************************************************************
248 */
249 osl_ext_status_t osl_ext_mutex_release(osl_ext_mutex_t *mutex);
250 
251 /* --------------------------------------------------------------------------
252 ** Timers
253 */
254 
255 /****************************************************************************
256 * Function:   osl_ext_timer_create
257 *
258 * Purpose:    Creates a timer object.
259 *
260 * Parameters: name (in)         Name of timer.
261 *             timeout_msec (in) Invoke callback after this number of milliseconds.
262 *             mode (in)         One-shot or periodic timer.
263 *             func (in)         Callback function to invoke on timer expiry.
264 *             arg (in)          Argument to callback function.
265 *             timer (out)       Timer object to create.
266 *
267 * Note: The function callback occurs in interrupt context. The application is
268 *       required to provide context switch for the callback if required.
269 *
270 * Returns:    OSL_EXT_SUCCESS if the timer was created successfully, or an
271 *             error code if the timer could not be created.
272 *****************************************************************************
273 */
274 osl_ext_status_t
275 osl_ext_timer_create(char *name, osl_ext_time_ms_t timeout_msec, osl_ext_timer_mode_t mode,
276                  osl_ext_timer_callback func, osl_ext_timer_arg_t arg, osl_ext_timer_t *timer);
277 
278 /****************************************************************************
279 * Function:   osl_ext_timer_delete
280 *
281 * Purpose:    Destroys a previously created timer object.
282 *
283 * Parameters: timer (mod) Timer object to destroy.
284 *
285 * Returns:    OSL_EXT_SUCCESS if the timer was created successfully, or an
286 *             error code if the timer could not be created.
287 *****************************************************************************
288 */
289 osl_ext_status_t osl_ext_timer_delete(osl_ext_timer_t *timer);
290 
291 /****************************************************************************
292 * Function:   osl_ext_timer_start
293 *
294 * Purpose:    Start a previously created timer object.
295 *
296 * Parameters: timer (in)        Timer object.
297 *             timeout_msec (in) Invoke callback after this number of milliseconds.
298 *             mode (in)         One-shot or periodic timer.
299 *
300 * Returns:    OSL_EXT_SUCCESS if the timer was created successfully, or an
301 *             error code if the timer could not be created.
302 *****************************************************************************
303 */
304 osl_ext_status_t
305 osl_ext_timer_start(osl_ext_timer_t *timer,
306 	osl_ext_time_ms_t timeout_msec, osl_ext_timer_mode_t mode);
307 
308 /****************************************************************************
309 * Function:   osl_ext_timer_start
310 *
311 * Purpose:    Start a previously created timer object.
312 *
313 * Parameters: timer (in)        Timer object.
314 *             timeout_usec (in) Invoke callback after this number of micro-seconds.
315 *             mode (in)         One-shot or periodic timer.
316 *
317 * Returns:    OSL_EXT_SUCCESS if the timer was created successfully, or an
318 *             error code if the timer could not be created.
319 *****************************************************************************
320 */
321 osl_ext_status_t
322 osl_ext_timer_start_us(osl_ext_timer_t *timer,
323 	osl_ext_time_us_t timeout_usec, osl_ext_timer_mode_t mode);
324 
325 /****************************************************************************
326 * Function:   osl_ext_timer_stop
327 *
328 * Purpose:    Stop a previously created timer object.
329 *
330 * Parameters: timer (in)        Timer object.
331 *
332 * Returns:    OSL_EXT_SUCCESS if the timer was created successfully, or an
333 *             error code if the timer could not be created.
334 *****************************************************************************
335 */
336 osl_ext_status_t
337 osl_ext_timer_stop(osl_ext_timer_t *timer);
338 
339 /****************************************************************************
340 * Function:   osl_ext_time_get
341 *
342 * Purpose:    Returns incrementing time counter.
343 *
344 * Parameters: None.
345 *
346 * Returns:    Returns incrementing time counter in msec.
347 *****************************************************************************
348 */
349 osl_ext_time_ms_t osl_ext_time_get(void);
350 
351 /* --------------------------------------------------------------------------
352 ** Tasks
353 */
354 
355 /****************************************************************************
356 * Function:   osl_ext_task_create
357 *
358 * Purpose:    Create a task.
359 *
360 * Parameters: name       (in)  Pointer to task string descriptor.
361 *             stack      (in)  Pointer to stack. NULL to allocate.
362 *             stack_size (in)  Stack size - in bytes.
363 *             priority   (in)  Abstract task priority.
364 *             func       (in)  A pointer to the task entry point function.
365 *             arg        (in)  Value passed into task entry point function.
366 *             task       (out) Task to create.
367 *
368 * Returns:    OSL_EXT_SUCCESS if the task was created successfully, or an
369 *             error code if the task could not be created.
370 *****************************************************************************
371 */
372 
373 #define osl_ext_task_create(name, stack, stack_size, priority, func, arg, task) \
374 	   osl_ext_task_create_ex((name), (stack), (stack_size), (priority), 0, (func), \
375 	   (arg), TRUE, (task))
376 
377 /****************************************************************************
378 * Function:   osl_ext_task_create_ex
379 *
380 * Purpose:    Create a task with autostart option.
381 *
382 * Parameters: name       (in)  Pointer to task string descriptor.
383 *             stack      (in)  Pointer to stack. NULL to allocate.
384 *             stack_size (in)  Stack size - in bytes.
385 *             priority   (in)  Abstract task priority.
386 *             func       (in)  A pointer to the task entry point function.
387 *             arg        (in)  Value passed into task entry point function.
388 *             autostart  (in)  TRUE to start task after creation.
389 *             task       (out) Task to create.
390 *
391 * Returns:    OSL_EXT_SUCCESS if the task was created successfully, or an
392 *             error code if the task could not be created.
393 *****************************************************************************
394 */
395 
396 osl_ext_status_t osl_ext_task_create_ex(char* name,
397 	void *stack, unsigned int stack_size, osl_ext_task_priority_t priority,
398 	osl_ext_time_ms_t timslice_msec, osl_ext_task_entry func, osl_ext_task_arg_t arg,
399 	bool autostart, osl_ext_task_t *task);
400 
401 /****************************************************************************
402 * Function:   osl_ext_task_delete
403 *
404 * Purpose:    Destroy a task.
405 *
406 * Parameters: task (mod) Task to destroy.
407 *
408 * Returns:    OSL_EXT_SUCCESS if the task was created successfully, or an
409 *             error code if the task could not be created.
410 *****************************************************************************
411 */
412 osl_ext_status_t osl_ext_task_delete(osl_ext_task_t *task);
413 
414 /****************************************************************************
415 * Function:   osl_ext_task_is_running
416 *
417 * Purpose:    Returns current running task.
418 *
419 * Parameters: None.
420 *
421 * Returns:    osl_ext_task_t of current running task.
422 *****************************************************************************
423 */
424 osl_ext_task_t *osl_ext_task_current(void);
425 
426 /****************************************************************************
427 * Function:   osl_ext_task_yield
428 *
429 * Purpose:    Yield the CPU to other tasks of the same priority that are
430 *             ready-to-run.
431 *
432 * Parameters: None.
433 *
434 * Returns:    OSL_EXT_SUCCESS if successful, else error code.
435 *****************************************************************************
436 */
437 osl_ext_status_t osl_ext_task_yield(void);
438 
439 /****************************************************************************
440 * Function:   osl_ext_task_yield
441 *
442 * Purpose:    Yield the CPU to other tasks of the same priority that are
443 *             ready-to-run.
444 *
445 * Parameters: None.
446 *
447 * Returns:    OSL_EXT_SUCCESS if successful, else error code.
448 *****************************************************************************
449 */
450 osl_ext_status_t osl_ext_task_yield(void);
451 
452 /****************************************************************************
453 * Function:   osl_ext_task_suspend
454 *
455 * Purpose:    Suspend a task.
456 *
457 * Parameters: task (mod) Task to suspend.
458 *
459 * Returns:    OSL_EXT_SUCCESS if the task was suspended successfully, or an
460 *             error code if the task could not be suspended.
461 *****************************************************************************
462 */
463 osl_ext_status_t osl_ext_task_suspend(osl_ext_task_t *task);
464 
465 /****************************************************************************
466 * Function:   osl_ext_task_resume
467 *
468 * Purpose:    Resume a task.
469 *
470 * Parameters: task (mod) Task to resume.
471 *
472 * Returns:    OSL_EXT_SUCCESS if the task was resumed successfully, or an
473 *             error code if the task could not be resumed.
474 *****************************************************************************
475 */
476 osl_ext_status_t osl_ext_task_resume(osl_ext_task_t *task);
477 
478 /****************************************************************************
479 * Function:   osl_ext_task_enable_stack_check
480 *
481 * Purpose:    Enable task stack checking.
482 *
483 * Parameters: None.
484 *
485 * Returns:    OSL_EXT_SUCCESS if successful, else error code.
486 *****************************************************************************
487 */
488 osl_ext_status_t osl_ext_task_enable_stack_check(void);
489 
490 /* --------------------------------------------------------------------------
491 ** Queue
492 */
493 
494 /****************************************************************************
495 * Function:   osl_ext_queue_create
496 *
497 * Purpose:    Create a queue.
498 *
499 * Parameters: name     (in)  Name to assign to the queue (must be unique).
500 *             buffer   (in)  Queue buffer. NULL to allocate.
501 *             size     (in)  Size of the queue.
502 *             queue    (out) Newly created queue.
503 *
504 * Returns:    OSL_EXT_SUCCESS if the queue was created successfully, or an
505 *             error code if the queue could not be created.
506 *****************************************************************************
507 */
508 osl_ext_status_t osl_ext_queue_create(char *name,
509 	void *queue_buffer, unsigned int queue_size,
510 	osl_ext_queue_t *queue);
511 
512 /****************************************************************************
513 * Function:   osl_ext_queue_delete
514 *
515 * Purpose:    Destroys a previously created queue object.
516 *
517 * Parameters: queue    (mod) Queue object to destroy.
518 *
519 * Returns:    OSL_EXT_SUCCESS if the queue was deleted successfully, or an
520 *             error code if the queue could not be deleteed.
521 *****************************************************************************
522 */
523 osl_ext_status_t osl_ext_queue_delete(osl_ext_queue_t *queue);
524 
525 /****************************************************************************
526 * Function:   osl_ext_queue_send
527 *
528 * Purpose:    Send/add data to the queue. This function will not block the
529 *             calling thread if the queue is full.
530 *
531 * Parameters: queue    (mod) Queue object.
532 *             data     (in)  Data pointer to be queued.
533 *
534 * Returns:    OSL_EXT_SUCCESS if the data was queued successfully, or an
535 *             error code if the data could not be queued.
536 *****************************************************************************
537 */
538 osl_ext_status_t osl_ext_queue_send(osl_ext_queue_t *queue, void *data);
539 
540 /****************************************************************************
541 * Function:   osl_ext_queue_send_synchronous
542 *
543 * Purpose:    Send/add data to the queue. This function will block the
544 *             calling thread until the data is dequeued.
545 *
546 * Parameters: queue    (mod) Queue object.
547 *             data     (in)  Data pointer to be queued.
548 *
549 * Returns:    OSL_EXT_SUCCESS if the data was queued successfully, or an
550 *             error code if the data could not be queued.
551 *****************************************************************************
552 */
553 osl_ext_status_t osl_ext_queue_send_synchronous(osl_ext_queue_t *queue, void *data);
554 
555 /****************************************************************************
556 * Function:   osl_ext_queue_receive
557 *
558 * Purpose:    Receive/remove data from the queue. This function will only
559 *             block the calling thread for timeout_msec milliseconds, before
560 *             returning with OSL_EXT_TIMEOUT.
561 *
562 * Parameters: queue        (mod) Queue object.
563 *             timeout_msec (in)  Number of milliseconds to wait for the
564 *                                data from the queue.
565 *             data         (out) Data pointer received/removed from the queue.
566 *
567 * Returns:    OSL_EXT_SUCCESS if the data was dequeued successfully, or an
568 *             error code if the data could not be dequeued.
569 *****************************************************************************
570 */
571 osl_ext_status_t osl_ext_queue_receive(osl_ext_queue_t *queue,
572                  osl_ext_time_ms_t timeout_msec, void **data);
573 
574 /****************************************************************************
575 * Function:   osl_ext_queue_count
576 *
577 * Purpose:    Returns the number of items in the queue.
578 *
579 * Parameters: queue        (mod) Queue object.
580 *             count        (out) Data pointer received/removed from the queue.
581 *
582 * Returns:    OSL_EXT_SUCCESS if the count was returned successfully, or an
583 *             error code if the count is invalid.
584 *****************************************************************************
585 */
586 osl_ext_status_t osl_ext_queue_count(osl_ext_queue_t *queue, int *count);
587 
588 /* --------------------------------------------------------------------------
589 ** Event
590 */
591 
592 /****************************************************************************
593 * Function:   osl_ext_event_create
594 *
595 * Purpose:    Creates a event object, which can subsequently be used to
596 *             notify and trigger tasks.
597 *
598 * Parameters: name  (in)  Name to assign to the event (must be unique).
599 *             event (out) Event object to initialize.
600 *
601 * Returns:    OSL_EXT_SUCCESS if the event was created successfully, or an
602 *             error code if the event could not be created.
603 *****************************************************************************
604 */
605 osl_ext_status_t osl_ext_event_create(char *name, osl_ext_event_t *event);
606 
607 /****************************************************************************
608 * Function:   osl_ext_event_delete
609 *
610 * Purpose:    Destroys a previously created event object.
611 *
612 * Parameters: event (mod) Event object to destroy.
613 *
614 * Returns:    OSL_EXT_SUCCESS if the event was created successfully, or an
615 *             error code if the event could not be created.
616 *****************************************************************************
617 */
618 osl_ext_status_t osl_ext_event_delete(osl_ext_event_t *event);
619 
620 /****************************************************************************
621 * Function:   osl_ext_event_get
622 *
623 * Purpose:    Get event from specified event object.
624 *
625 * Parameters: event        (mod) Event object to get.
626 *             requested    (in)  Requested event to get.
627 *             timeout_msec (in)  Number of milliseconds to wait for the event.
628 *             event_bits   (out) Event bits retrieved.
629 *
630 * Returns:    OSL_EXT_SUCCESS if the event was created successfully, or an
631 *             error code if the event could not be created.
632 *****************************************************************************
633 */
634 osl_ext_status_t osl_ext_event_get(osl_ext_event_t *event,
635 	osl_ext_event_bits_t requested,	osl_ext_time_ms_t timeout_msec,
636 	osl_ext_event_bits_t *event_bits);
637 
638 /****************************************************************************
639 * Function:   osl_ext_event_set
640 *
641 * Purpose:    Set event of specified event object.
642 *
643 * Parameters: event      (mod) Event object to set.
644 *             event_bits (in)  Event bits to set.
645 *
646 * Returns:    OSL_EXT_SUCCESS if the event was created successfully, or an
647 *             error code if the event could not be created.
648 *****************************************************************************
649 */
650 osl_ext_status_t osl_ext_event_set(osl_ext_event_t *event,
651 	osl_ext_event_bits_t event_bits);
652 
653 /* --------------------------------------------------------------------------
654 ** Interrupt
655 */
656 
657 /****************************************************************************
658 * Function:   osl_ext_interrupt_disable
659 *
660 * Purpose:    Disable CPU interrupt.
661 *
662 * Parameters: None.
663 *
664 * Returns:    The interrupt state before disable for restoring interrupt.
665 *****************************************************************************
666 */
667 osl_ext_interrupt_state_t osl_ext_interrupt_disable(void);
668 
669 /****************************************************************************
670 * Function:   osl_ext_interrupt_restore
671 *
672 * Purpose:    Restore CPU interrupt state.
673 *
674 * Parameters: state (in)  Interrupt state to restore returned from
675 *                         osl_ext_interrupt_disable().
676 *
677 * Returns:   None.
678 *****************************************************************************
679 */
680 void osl_ext_interrupt_restore(osl_ext_interrupt_state_t state);
681 
682 #else
683 
684 /* ---- Constants and Types ---------------------------------------------- */
685 
686 /* Interrupt control */
687 #define OSL_INTERRUPT_SAVE_AREA
688 #define OSL_DISABLE
689 #define OSL_RESTORE
690 
691 /* Semaphore. */
692 #define osl_ext_sem_t
693 #define OSL_EXT_SEM_DECL(sem)
694 
695 /* Mutex. */
696 #define osl_ext_mutex_t
697 #define OSL_EXT_MUTEX_DECL(mutex)
698 
699 /* Timer. */
700 #define osl_ext_timer_t
701 #define OSL_EXT_TIMER_DECL(timer)
702 
703 /* Task. */
704 #define osl_ext_task_t void
705 #define OSL_EXT_TASK_DECL(task)
706 
707 /* Queue. */
708 #define osl_ext_queue_t
709 #define OSL_EXT_QUEUE_DECL(queue)
710 
711 /* Event. */
712 #define osl_ext_event_t
713 #define OSL_EXT_EVENT_DECL(event)
714 
715 /* ---- Variable Externs ------------------------------------------------- */
716 /* ---- Function Prototypes ---------------------------------------------- */
717 
718 #define osl_ext_sem_create(name, init_cnt, sem)		(OSL_EXT_SUCCESS)
719 #define osl_ext_sem_delete(sem)				(OSL_EXT_SUCCESS)
720 #define osl_ext_sem_give(sem)				(OSL_EXT_SUCCESS)
721 #define osl_ext_sem_take(sem, timeout_msec)		(OSL_EXT_SUCCESS)
722 
723 #define osl_ext_mutex_create(name, mutex)		(OSL_EXT_SUCCESS)
724 #define osl_ext_mutex_delete(mutex)			(OSL_EXT_SUCCESS)
725 #define osl_ext_mutex_acquire(mutex, timeout_msec)	(OSL_EXT_SUCCESS)
726 #define osl_ext_mutex_release(mutex)			(OSL_EXT_SUCCESS)
727 
728 #define osl_ext_timer_create(name, timeout_msec, mode, func, arg, timer) \
729 	(OSL_EXT_SUCCESS)
730 #define osl_ext_timer_delete(timer)			(OSL_EXT_SUCCESS)
731 #define osl_ext_timer_start(timer, timeout_msec, mode)	(OSL_EXT_SUCCESS)
732 #define osl_ext_timer_stop(timer)			(OSL_EXT_SUCCESS)
733 #define osl_ext_time_get()				(0)
734 
735 #define osl_ext_task_create(name, stack, stack_size, priority, func, arg, task) \
736 	(OSL_EXT_SUCCESS)
737 #define osl_ext_task_delete(task)			(OSL_EXT_SUCCESS)
738 #define osl_ext_task_current()				(NULL)
739 #define osl_ext_task_yield()				(OSL_EXT_SUCCESS)
740 #define osl_ext_task_enable_stack_check()		(OSL_EXT_SUCCESS)
741 
742 #define osl_ext_queue_create(name, queue_buffer, queue_size, queue) \
743 	(OSL_EXT_SUCCESS)
744 #define osl_ext_queue_delete(queue)			(OSL_EXT_SUCCESS)
745 #define osl_ext_queue_send(queue, data)			(OSL_EXT_SUCCESS)
746 #define osl_ext_queue_send_synchronous(queue, data)	(OSL_EXT_SUCCESS)
747 #define osl_ext_queue_receive(queue, timeout_msec, data) \
748 	(OSL_EXT_SUCCESS)
749 #define osl_ext_queue_count(queue, count)		(OSL_EXT_SUCCESS)
750 
751 #define osl_ext_event_create(name, event)		(OSL_EXT_SUCCESS)
752 #define osl_ext_event_delete(event)			(OSL_EXT_SUCCESS)
753 #define osl_ext_event_get(event, requested, timeout_msec, event_bits) \
754 	(OSL_EXT_SUCCESS)
755 #define osl_ext_event_set(event, event_bits)		(OSL_EXT_SUCCESS)
756 
757 #define osl_ext_interrupt_disable(void)
758 #define osl_ext_interrupt_restore(state)
759 
760 #endif	/* OSL_EXT_DISABLED */
761 
762 #ifdef __cplusplus
763 }
764 #endif // endif
765 
766 #endif	/* _osl_ext_h_ */
767