.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 1 | /* |
---|
3 | 2 | * OS Abstraction Layer Extension - the APIs defined by the "extension" API |
---|
4 | 3 | * are only supported by a subset of all operating systems. |
---|
5 | 4 | * |
---|
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 | + * |
---|
8 | 9 | * Unless you and Broadcom execute a separate written software license |
---|
9 | 10 | * agreement governing use of this software, this software is licensed to you |
---|
10 | 11 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
---|
11 | 12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
---|
12 | 13 | * following added to such license: |
---|
13 | | - * |
---|
| 14 | + * |
---|
14 | 15 | * As a special exception, the copyright holders of this software give you |
---|
15 | 16 | * permission to link this software with independent modules, and to copy and |
---|
16 | 17 | * distribute the resulting executable under terms of your choice, provided that |
---|
.. | .. |
---|
18 | 19 | * the license of that module. An independent module is a module which is not |
---|
19 | 20 | * derived from this software. The special exception does not apply to any |
---|
20 | 21 | * modifications of the software. |
---|
21 | | - * |
---|
| 22 | + * |
---|
22 | 23 | * Notwithstanding the above, under no circumstances may you combine this |
---|
23 | 24 | * software in any way with any other Broadcom software provided under a license |
---|
24 | 25 | * other than the GPL, without Broadcom's express prior written consent. |
---|
.. | .. |
---|
26 | 27 | * |
---|
27 | 28 | * <<Broadcom-WL-IPTag/Open:>> |
---|
28 | 29 | * |
---|
29 | | - * $Id: osl_ext.h 514727 2014-11-12 03:02:48Z $ |
---|
| 30 | + * $Id: osl_ext.h 627993 2016-03-29 10:07:29Z $ |
---|
30 | 31 | */ |
---|
31 | 32 | |
---|
32 | 33 | #ifndef _osl_ext_h_ |
---|
33 | 34 | #define _osl_ext_h_ |
---|
34 | | - |
---|
35 | 35 | |
---|
36 | 36 | /* ---- Include Files ---------------------------------------------------- */ |
---|
37 | 37 | |
---|
.. | .. |
---|
42 | 42 | #include <threadx_osl_ext.h> |
---|
43 | 43 | #else |
---|
44 | 44 | #define OSL_EXT_DISABLED |
---|
45 | | -#endif |
---|
| 45 | +#endif // endif |
---|
46 | 46 | |
---|
47 | 47 | /* Include base operating system abstraction. */ |
---|
48 | 48 | #include <osl.h> |
---|
49 | 49 | |
---|
50 | 50 | #ifdef __cplusplus |
---|
51 | 51 | extern "C" { |
---|
52 | | -#endif |
---|
| 52 | +#endif // endif |
---|
53 | 53 | |
---|
54 | 54 | /* ---- Constants and Types ---------------------------------------------- */ |
---|
55 | 55 | |
---|
.. | .. |
---|
67 | 67 | |
---|
68 | 68 | #define OSL_EXT_TIME_FOREVER ((osl_ext_time_ms_t)(-1)) |
---|
69 | 69 | typedef unsigned int osl_ext_time_ms_t; |
---|
| 70 | +typedef unsigned int osl_ext_time_us_t; |
---|
70 | 71 | |
---|
71 | 72 | typedef unsigned int osl_ext_event_bits_t; |
---|
72 | 73 | |
---|
.. | .. |
---|
88 | 89 | /* User registered callback and parameter to invoke when timer expires. */ |
---|
89 | 90 | typedef void* osl_ext_timer_arg_t; |
---|
90 | 91 | typedef void (*osl_ext_timer_callback)(osl_ext_timer_arg_t arg); |
---|
91 | | - |
---|
92 | 92 | |
---|
93 | 93 | /* ----------------------------------------------------------------------- |
---|
94 | 94 | * Tasks. |
---|
.. | .. |
---|
115 | 115 | OSL_EXT_TASK_NUM_PRIORITES |
---|
116 | 116 | } osl_ext_task_priority_t; |
---|
117 | 117 | |
---|
118 | | - |
---|
119 | 118 | #ifndef OSL_EXT_DISABLED |
---|
120 | 119 | |
---|
121 | 120 | /* ---- Variable Externs ------------------------------------------------- */ |
---|
122 | 121 | /* ---- Function Prototypes ---------------------------------------------- */ |
---|
123 | | - |
---|
124 | 122 | |
---|
125 | 123 | /* -------------------------------------------------------------------------- |
---|
126 | 124 | ** Semaphore |
---|
.. | .. |
---|
189 | 187 | */ |
---|
190 | 188 | osl_ext_status_t osl_ext_sem_take(osl_ext_sem_t *sem, osl_ext_time_ms_t timeout_msec); |
---|
191 | 189 | |
---|
192 | | - |
---|
193 | 190 | /* -------------------------------------------------------------------------- |
---|
194 | 191 | ** Mutex |
---|
195 | 192 | */ |
---|
.. | .. |
---|
252 | 249 | */ |
---|
253 | 250 | osl_ext_status_t osl_ext_mutex_release(osl_ext_mutex_t *mutex); |
---|
254 | 251 | |
---|
255 | | - |
---|
256 | 252 | /* -------------------------------------------------------------------------- |
---|
257 | 253 | ** Timers |
---|
258 | 254 | */ |
---|
.. | .. |
---|
311 | 307 | osl_ext_time_ms_t timeout_msec, osl_ext_timer_mode_t mode); |
---|
312 | 308 | |
---|
313 | 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 | +/**************************************************************************** |
---|
314 | 327 | * Function: osl_ext_timer_stop |
---|
315 | 328 | * |
---|
316 | 329 | * Purpose: Stop a previously created timer object. |
---|
.. | .. |
---|
360 | 373 | |
---|
361 | 374 | #define osl_ext_task_create(name, stack, stack_size, priority, func, arg, task) \ |
---|
362 | 375 | 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 | +*/ |
---|
364 | 396 | |
---|
365 | 397 | osl_ext_status_t osl_ext_task_create_ex(char* name, |
---|
366 | 398 | void *stack, unsigned int stack_size, osl_ext_task_priority_t priority, |
---|
367 | 399 | 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); |
---|
369 | 401 | |
---|
370 | 402 | /**************************************************************************** |
---|
371 | 403 | * Function: osl_ext_task_delete |
---|
.. | .. |
---|
380 | 412 | */ |
---|
381 | 413 | osl_ext_status_t osl_ext_task_delete(osl_ext_task_t *task); |
---|
382 | 414 | |
---|
383 | | - |
---|
384 | 415 | /**************************************************************************** |
---|
385 | 416 | * Function: osl_ext_task_is_running |
---|
386 | 417 | * |
---|
.. | .. |
---|
392 | 423 | ***************************************************************************** |
---|
393 | 424 | */ |
---|
394 | 425 | osl_ext_task_t *osl_ext_task_current(void); |
---|
395 | | - |
---|
396 | 426 | |
---|
397 | 427 | /**************************************************************************** |
---|
398 | 428 | * Function: osl_ext_task_yield |
---|
.. | .. |
---|
407 | 437 | */ |
---|
408 | 438 | osl_ext_status_t osl_ext_task_yield(void); |
---|
409 | 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); |
---|
410 | 478 | |
---|
411 | 479 | /**************************************************************************** |
---|
412 | 480 | * Function: osl_ext_task_enable_stack_check |
---|
.. | .. |
---|
419 | 487 | ***************************************************************************** |
---|
420 | 488 | */ |
---|
421 | 489 | osl_ext_status_t osl_ext_task_enable_stack_check(void); |
---|
422 | | - |
---|
423 | 490 | |
---|
424 | 491 | /* -------------------------------------------------------------------------- |
---|
425 | 492 | ** Queue |
---|
.. | .. |
---|
519 | 586 | */ |
---|
520 | 587 | osl_ext_status_t osl_ext_queue_count(osl_ext_queue_t *queue, int *count); |
---|
521 | 588 | |
---|
522 | | - |
---|
523 | 589 | /* -------------------------------------------------------------------------- |
---|
524 | 590 | ** Event |
---|
525 | 591 | */ |
---|
.. | .. |
---|
585 | 651 | osl_ext_status_t osl_ext_event_set(osl_ext_event_t *event, |
---|
586 | 652 | osl_ext_event_bits_t event_bits); |
---|
587 | 653 | |
---|
588 | | - |
---|
589 | 654 | /* -------------------------------------------------------------------------- |
---|
590 | 655 | ** Interrupt |
---|
591 | 656 | */ |
---|
.. | .. |
---|
601 | 666 | ***************************************************************************** |
---|
602 | 667 | */ |
---|
603 | 668 | osl_ext_interrupt_state_t osl_ext_interrupt_disable(void); |
---|
604 | | - |
---|
605 | 669 | |
---|
606 | 670 | /**************************************************************************** |
---|
607 | 671 | * Function: osl_ext_interrupt_restore |
---|
.. | .. |
---|
619 | 683 | #else |
---|
620 | 684 | |
---|
621 | 685 | /* ---- Constants and Types ---------------------------------------------- */ |
---|
| 686 | + |
---|
| 687 | +/* Interrupt control */ |
---|
| 688 | +#define OSL_INTERRUPT_SAVE_AREA |
---|
| 689 | +#define OSL_DISABLE |
---|
| 690 | +#define OSL_RESTORE |
---|
622 | 691 | |
---|
623 | 692 | /* Semaphore. */ |
---|
624 | 693 | #define osl_ext_sem_t |
---|
.. | .. |
---|
693 | 762 | |
---|
694 | 763 | #ifdef __cplusplus |
---|
695 | 764 | } |
---|
696 | | -#endif |
---|
| 765 | +#endif // endif |
---|
697 | 766 | |
---|
698 | 767 | #endif /* _osl_ext_h_ */ |
---|