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