rt_Task.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*----------------------------------------------------------------------------
  2. * CMSIS-RTOS - RTX
  3. *----------------------------------------------------------------------------
  4. * Name: RT_TASK.H
  5. * Purpose: Task functions and system start up.
  6. * Rev.: V4.79
  7. *----------------------------------------------------------------------------
  8. *
  9. * Copyright (c) 1999-2009 KEIL, 2009-2017 ARM Germany GmbH. All rights reserved.
  10. *
  11. * SPDX-License-Identifier: Apache-2.0
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the License); you may
  14. * not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  21. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. *---------------------------------------------------------------------------*/
  25. /* Definitions */
  26. /* Values for 'state' */
  27. #define INACTIVE 0U
  28. #define READY 1U
  29. #define RUNNING 2U
  30. #define WAIT_DLY 3U
  31. #define WAIT_ITV 4U
  32. #define WAIT_OR 5U
  33. #define WAIT_AND 6U
  34. #define WAIT_SEM 7U
  35. #define WAIT_MBX 8U
  36. #define WAIT_MUT 9U
  37. /* Return codes */
  38. #define OS_R_TMO 0x01U
  39. #define OS_R_EVT 0x02U
  40. #define OS_R_SEM 0x03U
  41. #define OS_R_MBX 0x04U
  42. #define OS_R_MUT 0x05U
  43. #define OS_R_OK 0x00U
  44. #define OS_R_NOK 0xFFU
  45. /* Variables */
  46. extern struct OS_TSK os_tsk;
  47. extern struct OS_TCB os_idle_TCB;
  48. /* Functions */
  49. extern void rt_switch_req (P_TCB p_next);
  50. extern void rt_dispatch (P_TCB next_TCB);
  51. extern void rt_block (U16 timeout, U8 block_state);
  52. extern void rt_tsk_pass (void);
  53. extern OS_TID rt_tsk_self (void);
  54. extern OS_RESULT rt_tsk_prio (OS_TID task_id, U8 new_prio);
  55. extern OS_TID rt_tsk_create (FUNCP task, U32 prio_stksz, void *stk, void *argv);
  56. extern OS_RESULT rt_tsk_delete (OS_TID task_id);
  57. #ifdef __CMSIS_RTOS
  58. extern void rt_sys_init (void);
  59. extern void rt_sys_start (void);
  60. #else
  61. extern void rt_sys_init (FUNCP first_task, U32 prio_stksz, void *stk);
  62. #endif
  63. /*----------------------------------------------------------------------------
  64. * end of file
  65. *---------------------------------------------------------------------------*/