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