hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/net/wireless/rockchip_wlan/cywdhd/bcmdhd/include/osl_ext.h
....@@ -1,16 +1,17 @@
1
-/* SPDX-License-Identifier: GPL-2.0 */
21 /*
32 * OS Abstraction Layer Extension - the APIs defined by the "extension" API
43 * are only supported by a subset of all operating systems.
54 *
6
- * Copyright (C) 1999-2019, Broadcom Corporation
7
- *
5
+ * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation
6
+ *
7
+ * Copyright (C) 1999-2017, Broadcom Corporation
8
+ *
89 * Unless you and Broadcom execute a separate written software license
910 * agreement governing use of this software, this software is licensed to you
1011 * under the terms of the GNU General Public License version 2 (the "GPL"),
1112 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
1213 * following added to such license:
13
- *
14
+ *
1415 * As a special exception, the copyright holders of this software give you
1516 * permission to link this software with independent modules, and to copy and
1617 * distribute the resulting executable under terms of your choice, provided that
....@@ -18,7 +19,7 @@
1819 * the license of that module. An independent module is a module which is not
1920 * derived from this software. The special exception does not apply to any
2021 * modifications of the software.
21
- *
22
+ *
2223 * Notwithstanding the above, under no circumstances may you combine this
2324 * software in any way with any other Broadcom software provided under a license
2425 * other than the GPL, without Broadcom's express prior written consent.
....@@ -26,12 +27,11 @@
2627 *
2728 * <<Broadcom-WL-IPTag/Open:>>
2829 *
29
- * $Id: osl_ext.h 514727 2014-11-12 03:02:48Z $
30
+ * $Id: osl_ext.h 627993 2016-03-29 10:07:29Z $
3031 */
3132
3233 #ifndef _osl_ext_h_
3334 #define _osl_ext_h_
34
-
3535
3636 /* ---- Include Files ---------------------------------------------------- */
3737
....@@ -42,14 +42,14 @@
4242 #include <threadx_osl_ext.h>
4343 #else
4444 #define OSL_EXT_DISABLED
45
-#endif
45
+#endif // endif
4646
4747 /* Include base operating system abstraction. */
4848 #include <osl.h>
4949
5050 #ifdef __cplusplus
5151 extern "C" {
52
-#endif
52
+#endif // endif
5353
5454 /* ---- Constants and Types ---------------------------------------------- */
5555
....@@ -67,6 +67,7 @@
6767
6868 #define OSL_EXT_TIME_FOREVER ((osl_ext_time_ms_t)(-1))
6969 typedef unsigned int osl_ext_time_ms_t;
70
+typedef unsigned int osl_ext_time_us_t;
7071
7172 typedef unsigned int osl_ext_event_bits_t;
7273
....@@ -88,7 +89,6 @@
8889 /* User registered callback and parameter to invoke when timer expires. */
8990 typedef void* osl_ext_timer_arg_t;
9091 typedef void (*osl_ext_timer_callback)(osl_ext_timer_arg_t arg);
91
-
9292
9393 /* -----------------------------------------------------------------------
9494 * Tasks.
....@@ -115,12 +115,10 @@
115115 OSL_EXT_TASK_NUM_PRIORITES
116116 } osl_ext_task_priority_t;
117117
118
-
119118 #ifndef OSL_EXT_DISABLED
120119
121120 /* ---- Variable Externs ------------------------------------------------- */
122121 /* ---- Function Prototypes ---------------------------------------------- */
123
-
124122
125123 /* --------------------------------------------------------------------------
126124 ** Semaphore
....@@ -189,7 +187,6 @@
189187 */
190188 osl_ext_status_t osl_ext_sem_take(osl_ext_sem_t *sem, osl_ext_time_ms_t timeout_msec);
191189
192
-
193190 /* --------------------------------------------------------------------------
194191 ** Mutex
195192 */
....@@ -252,7 +249,6 @@
252249 */
253250 osl_ext_status_t osl_ext_mutex_release(osl_ext_mutex_t *mutex);
254251
255
-
256252 /* --------------------------------------------------------------------------
257253 ** Timers
258254 */
....@@ -311,6 +307,23 @@
311307 osl_ext_time_ms_t timeout_msec, osl_ext_timer_mode_t mode);
312308
313309 /****************************************************************************
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
+/****************************************************************************
314327 * Function: osl_ext_timer_stop
315328 *
316329 * Purpose: Stop a previously created timer object.
....@@ -360,12 +373,31 @@
360373
361374 #define osl_ext_task_create(name, stack, stack_size, priority, func, arg, task) \
362375 osl_ext_task_create_ex((name), (stack), (stack_size), (priority), 0, (func), \
363
- (arg), (task))
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
+*/
364396
365397 osl_ext_status_t osl_ext_task_create_ex(char* name,
366398 void *stack, unsigned int stack_size, osl_ext_task_priority_t priority,
367399 osl_ext_time_ms_t timslice_msec, osl_ext_task_entry func, osl_ext_task_arg_t arg,
368
- osl_ext_task_t *task);
400
+ bool autostart, osl_ext_task_t *task);
369401
370402 /****************************************************************************
371403 * Function: osl_ext_task_delete
....@@ -380,7 +412,6 @@
380412 */
381413 osl_ext_status_t osl_ext_task_delete(osl_ext_task_t *task);
382414
383
-
384415 /****************************************************************************
385416 * Function: osl_ext_task_is_running
386417 *
....@@ -392,7 +423,6 @@
392423 *****************************************************************************
393424 */
394425 osl_ext_task_t *osl_ext_task_current(void);
395
-
396426
397427 /****************************************************************************
398428 * Function: osl_ext_task_yield
....@@ -407,6 +437,44 @@
407437 */
408438 osl_ext_status_t osl_ext_task_yield(void);
409439
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);
410478
411479 /****************************************************************************
412480 * Function: osl_ext_task_enable_stack_check
....@@ -419,7 +487,6 @@
419487 *****************************************************************************
420488 */
421489 osl_ext_status_t osl_ext_task_enable_stack_check(void);
422
-
423490
424491 /* --------------------------------------------------------------------------
425492 ** Queue
....@@ -519,7 +586,6 @@
519586 */
520587 osl_ext_status_t osl_ext_queue_count(osl_ext_queue_t *queue, int *count);
521588
522
-
523589 /* --------------------------------------------------------------------------
524590 ** Event
525591 */
....@@ -585,7 +651,6 @@
585651 osl_ext_status_t osl_ext_event_set(osl_ext_event_t *event,
586652 osl_ext_event_bits_t event_bits);
587653
588
-
589654 /* --------------------------------------------------------------------------
590655 ** Interrupt
591656 */
....@@ -601,7 +666,6 @@
601666 *****************************************************************************
602667 */
603668 osl_ext_interrupt_state_t osl_ext_interrupt_disable(void);
604
-
605669
606670 /****************************************************************************
607671 * Function: osl_ext_interrupt_restore
....@@ -619,6 +683,11 @@
619683 #else
620684
621685 /* ---- Constants and Types ---------------------------------------------- */
686
+
687
+/* Interrupt control */
688
+#define OSL_INTERRUPT_SAVE_AREA
689
+#define OSL_DISABLE
690
+#define OSL_RESTORE
622691
623692 /* Semaphore. */
624693 #define osl_ext_sem_t
....@@ -693,6 +762,6 @@
693762
694763 #ifdef __cplusplus
695764 }
696
-#endif
765
+#endif // endif
697766
698767 #endif /* _osl_ext_h_ */