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