1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _RTOS_OHOS_AL_H 16 #define _RTOS_OHOS_AL_H 17 18 /* 19 * INCLUDE FILES 20 **************************************************************************************** 21 */ 22 #include "rtos_ohos_def.h" 23 #include <stdbool.h> 24 #include "ll.h" 25 #include "dbg_assert.h" 26 27 /** 28 * RTOS task identifier 29 */ 30 enum rtos_task_id { 31 IDLE_TASK = 0, 32 TMR_DAEMON_TASK = 1, 33 CONSOLE_TASK = 2, 34 TEST_TASK = 3, 35 BT_TASK = 4, 36 INTERSYS_TASK = 5, 37 ASIO_TASK = 6, 38 AUDIO_TASK = 7, 39 WIFI_TASK = 8, 40 CONTROL_TASK = 9, 41 SUPPLICANT_TASK = 10, 42 IP_TASK = 11, 43 APPLICATION_TASK = 12, 44 TG_SEND_TASK = 13, 45 PING_SEND_TASK = 14, 46 IPERF_TASK = 15, 47 SMARTCONF_TASK = 16, 48 IPC_CNTRL_TASK = 17, 49 TCPUDP_FIRST_TASK = 18, 50 TCPUDP_LAST_TASK = 21, 51 RTP_TASK = 22, 52 USBH_TASK = 23, 53 MDNS_TASK = 24, 54 RTCP_TASK = 25, 55 CO_TASK = 26, 56 BLE_TASK = 27, 57 DSP_TASK = 28, 58 WIFI_USER_TASK = 29, 59 APP_HOSTIF_TASK = 30, 60 APP_FHOST_TX_TASK = 31, 61 USB_BT_TASK = 32, 62 MAX_TASK, 63 UNDEF_TASK = 255, 64 }; 65 66 // /* 67 // * FUNCTIONS 68 // **************************************************************************************** 69 // */ 70 // /** 71 // **************************************************************************************** 72 // * @brief Get the current RTOS time, in ms. 73 // * 74 // * @param[in] isr Indicate if this is called from ISR. 75 // * 76 // * @return The current RTOS time 77 // **************************************************************************************** 78 // */ 79 uint32_t rtos_now(bool isr); 80 81 // /** 82 // **************************************************************************************** 83 // * @brief Allocate memory. 84 // * 85 // * @param[in] size Size, in bytes, to allocate. 86 // * 87 // * @return Address of allocated memory on success and NULL if error occurred. 88 // **************************************************************************************** 89 // */ 90 void *rtos_malloc(uint32_t size); 91 92 // /** 93 // **************************************************************************************** 94 // * @brief Allocate memory and initialize it to 0. 95 // * 96 // * @param[in] nb_elt Number of element to allocate. 97 // * @param[in] size Size, in bytes, of each element allocate. 98 // * 99 // * @return Address of allocated and initialized memory on success and NULL if error occurred. 100 // **************************************************************************************** 101 // */ 102 void *rtos_calloc(uint32_t nb_elt, uint32_t size); 103 104 // /** 105 // **************************************************************************************** 106 // * @brief Free memory. 107 // * 108 // * @param[in] ptr Memory buffer to free. MUST have been allocated with @ref rtos_malloc 109 // **************************************************************************************** 110 // */ 111 void rtos_free(void *ptr); 112 113 // /** 114 // **************************************************************************************** 115 // * @brief Get HEAP Memory information. (For debug purpose only) 116 // * 117 // * @param[out] total_size Updated with HEAP memory size. 118 // * @param[out] free_size Updated with the currently available memory. 119 // * @param[out] min_free_size Updated with the lowest level of free memory reached. 120 // **************************************************************************************** 121 // */ 122 void rtos_heap_info(int *total_size, int *free_size, int *min_free_size); 123 124 // /** 125 // **************************************************************************************** 126 // * @brief Create a RTOS task. 127 // * 128 // * @param[in] func Pointer to the task function 129 // * @param[in] name Name of the task 130 // * @param[in] task_id ID of the task 131 // * @param[in] stack_depth Required stack depth for the task 132 // * @param[in] params Pointer to private parameters of the task function, if any 133 // * @param[in] prio Priority of the task 134 // * @param[out] task_handle Handle of the task, that might be used in subsequent RTOS 135 // * function calls 136 // * 137 // * @return 0 on success and != 0 if error occurred. 138 // **************************************************************************************** 139 // */ 140 int rtos_task_create(rtos_task_fct func, 141 const char * const name, 142 enum rtos_task_id task_id, 143 const uint16_t stack_depth, 144 void * const params, 145 rtos_prio prio, 146 rtos_task_handle * const task_handle); 147 // /** 148 // **************************************************************************************** 149 // * @brief Delete a RTOS task. 150 // * 151 // * @param[in] task_handle Handle of the task to delete. 152 // **************************************************************************************** 153 // */ 154 void rtos_task_delete(rtos_task_handle task_handle); 155 156 // /** 157 // **************************************************************************************** 158 // * @brief RTOS task suspends itself for a specific duration. 159 // * 160 // * @param[in] duration Duration in ms. 161 // **************************************************************************************** 162 // */ 163 void rtos_task_suspend(int duration); 164 165 // /** 166 // **************************************************************************************** 167 // * @brief Initialize notification for a FHOST task. 168 // * 169 // * If notification are natively supported by the target RTOS, then this function will 170 // * probably do nothing. If this is not the case this function allows the RTOS_AL 171 // * implementation to initialize its own notification system for the task (e.g. allocating 172 // * a binary semaphore for the task). 173 // * 174 // * To ensure the maximum compatibility, this function must be called before 175 // * @ref rtos_task_wait_notification or @ref rtos_task_notify can be used on a task. 176 // * 177 // * @param[in] task Task handle 178 // * @return 0 on success and != 0 if error occurred. 179 // **************************************************************************************** 180 // */ 181 int rtos_task_init_notification(rtos_task_handle task); 182 183 // /** 184 // **************************************************************************************** 185 // * @brief Task suspend itself until it is notified (or timeout expires) 186 // * 187 // * The task will be resumed when another task call @ref rtos_task_notify. It another task 188 // * already call @ref rtos_task_notify then the function will return immediately. 189 // * On return it clears all pending notification. 190 // * @ref rtos_task_init_notification must be called first before calling this function. 191 // * 192 // * @param[in] timeout Maximum duration to wait, in ms, if no notification is pending. 193 // * 0 means do not wait and -1 means wait indefinitely. 194 // * 195 // * @return The number of pending notification (0 if timeout was reached) 196 // **************************************************************************************** 197 // */ 198 uint32_t rtos_task_wait_notification(int timeout); 199 200 // /** 201 // **************************************************************************************** 202 // * @brief Send notification to a task 203 // * 204 // * If the task is suspended, after calling @ref rtos_task_wait_notification, it will 205 // * resume it. Otherwise the notification will be pending for the task. 206 // * 207 // * @param[in] task_handle Handle of the task to notify. 208 // * @param[in] value Value to notify. 209 // * @param[in] isr Indicate if this is called from ISR. 210 // * 211 // **************************************************************************************** 212 // */ 213 void rtos_task_notify(rtos_task_handle task_handle, uint32_t value, bool isr); 214 215 // /** 216 // **************************************************************************************** 217 // * @brief Send notification to a task, actual notification value is bitwise ORed with 218 // * param value 219 // * 220 // * If the task is suspended, after calling @ref rtos_task_wait_notification, it will 221 // * resume it. Otherwise the notification will be pending for the task. 222 // * 223 // * @param[in] task_handle Handle of the task to notify. 224 // * @param[in] value Value to OR with actual notification value. 225 // * @param[in] isr Indicate if this is called from ISR. 226 // * 227 // **************************************************************************************** 228 // */ 229 // void rtos_task_notify_setbits(rtos_task_handle task_handle, uint32_t value, bool isr); 230 231 // /** 232 // **************************************************************************************** 233 // * @brief Get priority of a task 234 // * 235 // * @param[in] task_handle Handle of the task to get priority. 236 // * 237 // * @return The priority of the task 238 // **************************************************************************************** 239 // */ 240 // uint32_t rtos_task_get_priority(rtos_task_handle task_handle); 241 242 // /** 243 // **************************************************************************************** 244 // * @brief Set priority of a task 245 // * 246 // * If new priority is higher than (configMAX_PRIORITIES - 1), then new priority will be 247 // * set to (configMAX_PRIORITIES - 1). 248 // * 249 // * @param[in] task_handle Handle of the task to set priority. 250 // * @param[in] priority New priority. 251 // * 252 // **************************************************************************************** 253 // */ 254 void rtos_task_set_priority(rtos_task_handle task_handle, uint32_t priority); 255 256 // /** 257 // **************************************************************************************** 258 // * @brief Create a RTOS message queue. 259 // * 260 // * @param[in] elt_size Size, in bytes, of one queue element 261 // * @param[in] nb_elt Number of element to allocate for the queue 262 // * @param[out] queue Update with queue handle on success 263 // * 264 // * @return 0 on success and != 0 if error occurred. 265 // **************************************************************************************** 266 // */ 267 int rtos_queue_create(int elt_size, int nb_elt, rtos_queue *queue); 268 269 // /** 270 // **************************************************************************************** 271 // * @brief Delete a queue previously created by @ref rtos_queue_create. 272 // * This function does not verify if the queue is empty or not before deleting it. 273 // * 274 // * @param[in] queue Queue handle 275 // **************************************************************************************** 276 // */ 277 void rtos_queue_delete(rtos_queue queue); 278 279 // /** 280 // **************************************************************************************** 281 // * @brief Check if a RTOS message queue is empty or not. 282 // * This function can be called both from an ISR and a task. 283 // * 284 // * @param[in] queue Queue handle 285 // * 286 // * @return true if queue is empty, false otherwise. 287 // **************************************************************************************** 288 // */ 289 // bool rtos_queue_is_empty(rtos_queue queue); 290 291 // /** 292 // **************************************************************************************** 293 // * @brief Check if a RTOS message queue is full or not. 294 // * This function can be called both from an ISR and a task. 295 // * 296 // * @param[in] queue Queue handle 297 // * 298 // * @return true if queue is full, false otherwise. 299 // **************************************************************************************** 300 // */ 301 // bool rtos_queue_is_full(rtos_queue queue); 302 303 // /** 304 // **************************************************************************************** 305 // * @brief Get the number of messages pending a queue. 306 // * This function can be called both from an ISR and a task. 307 // * 308 // * @param[in] queue Queue handle 309 // * 310 // * @return The number of messages pending in the queue. 311 // **************************************************************************************** 312 // */ 313 int rtos_queue_cnt(rtos_queue queue); 314 315 // /** 316 // **************************************************************************************** 317 // * @brief Write a message at the end of a RTOS message queue. 318 // * 319 // * @param[in] queue Queue handle 320 // * @param[in] msg Message to copy in the queue. (It is assume that buffer is of the 321 // * size specified in @ref rtos_queue_create) 322 // * @param[in] timeout Maximum duration to wait, in ms, if queue is full. 0 means do not 323 // * wait and -1 means wait indefinitely. 324 // * @param[in] isr Indicate if this is called from ISR. If set, @p timeout parameter 325 // * is ignored. 326 // * 327 // * @return 0 on success and != 0 if error occurred (i.e queue was full and maximum 328 // * duration has been reached). 329 // **************************************************************************************** 330 // */ 331 int rtos_queue_write(rtos_queue queue, void *msg, int timeout, bool isr); 332 333 // /** 334 // **************************************************************************************** 335 // * @brief Read a message from a RTOS message queue. 336 // * 337 // * @param[in] queue Queue handle 338 // * @param[in] msg Buffer to copy into. (It is assume that buffer is of the 339 // * size specified in @ref rtos_queue_create) 340 // * @param[in] timeout Maximum duration to wait, in ms, if queue is empty. 0 means do not 341 // * wait and -1 means wait indefinitely. 342 // * @param[in] isr Indicate if this is called from ISR. If set, @p timeout parameter 343 // * is ignored. 344 // * 345 // * @return 0 on success and != 0 if error occurred (i.e queue was empty and maximum 346 // * duration has been reached). 347 // **************************************************************************************** 348 // */ 349 int rtos_queue_read(rtos_queue queue, void *msg, int timeout, bool isr); 350 351 // /** 352 // **************************************************************************************** 353 // * @brief Peek a message from a RTOS message queue. 354 // * 355 // * @param[in] queue Queue handle 356 // * @param[in] msg Buffer to copy into. (It is assume that buffer is of the 357 // * size specified in @ref rtos_queue_create) 358 // * @param[in] timeout Maximum duration to wait, in ms, if queue is empty. 0 means do not 359 // * wait and -1 means wait indefinitely. 360 // * @param[in] isr Indicate if this is called from ISR. If set, @p timeout parameter 361 // * is ignored. 362 // * 363 // * @return 0 on success and != 0 if error occurred (i.e queue was empty and maximum 364 // * duration has been reached). 365 // **************************************************************************************** 366 // */ 367 // int rtos_queue_peek(rtos_queue queue, void *msg, int timeout, bool isr); 368 369 // /** 370 // **************************************************************************************** 371 // * @brief Resets a RTOS message queue to its original empty state. 372 // * Any data contained in the queue at the time it is reset is discarded. 373 // * 374 // * @return 1 375 // **************************************************************************************** 376 // */ 377 378 // int rtos_queue_reset(rtos_queue queue); 379 380 // /** 381 // **************************************************************************************** 382 // * @brief Creates and returns a new semaphore. 383 // * 384 // * @param[out] semaphore Semaphore handle returned by the function 385 // * @param[in] max_count The maximum count value that can be reached by the semaphore. 386 // * When the semaphore reaches this value it can no longer be 'given'. 387 // * @param[in] init_count The count value assigned to the semaphore when it is created. 388 // * 389 // * @return 0 on success and != 0 otherwise. 390 // **************************************************************************************** 391 // */ 392 int rtos_semaphore_create(rtos_semaphore *semaphore, int max_count, int init_count); 393 394 // /** 395 // **************************************************************************************** 396 // * @brief Return a semaphore count. 397 // * 398 // * @param[in] semaphore Semaphore handle 399 // * 400 // * @return Semaphore count. 401 // **************************************************************************************** 402 // */ 403 int rtos_semaphore_get_count(rtos_semaphore semaphore); 404 405 // /** 406 // **************************************************************************************** 407 // * @brief Delete a semaphore previously created by @ref rtos_semaphore_create. 408 // * 409 // * @param[in] semaphore Semaphore handle 410 // **************************************************************************************** 411 // */ 412 void rtos_semaphore_delete(rtos_semaphore semaphore); 413 414 // /** 415 // **************************************************************************************** 416 // * @brief Wait for a semaphore to be available. 417 // * 418 // * @param[in] semaphore Semaphore handle 419 // * @param[in] timeout Maximum duration to wait, in ms. 0 means do not wait and -1 means 420 // * wait indefinitely. 421 // * 422 // * @return 0 on success and != 0 if timeout occurred. 423 // **************************************************************************************** 424 // */ 425 int rtos_semaphore_wait(rtos_semaphore semaphore, int timeout); 426 427 // /** 428 // **************************************************************************************** 429 // * @brief Signal the semaphore the handle of which is passed as parameter. 430 // * 431 // * @param[in] semaphore Semaphore handle 432 // * @param[in] isr Indicate if this is called from ISR 433 // * 434 // * @return 0 on success and != 0 otherwise. 435 // **************************************************************************************** 436 // */ 437 int rtos_semaphore_signal(rtos_semaphore semaphore, bool isr); 438 439 // /** 440 // **************************************************************************************** 441 // * @brief * Creates a new software timer instance, and returns a handle by which the 442 // * created software timer can be referenced. 443 // * 444 // * @param[out] see xTimerCreate described. 445 // * 446 // * @return 0 on success and != 0 otherwise. 447 // **************************************************************************************** 448 // */ 449 TimerHandle_t rtos_timer_create( const char * const pcTimerName, 450 const TickType_t xTimerPeriodInTicks, 451 const UBaseType_t uxAutoReload, 452 void * const pvTimerID, 453 TimerCallbackFunction_t pxCallbackFunction ); 454 455 // /** 456 // **************************************************************************************** 457 // * @brief * start timer 458 // * 459 // * @param[out] see xTimerStart described. 460 // * 461 // * @return 0 on success and != 0 otherwise. 462 // **************************************************************************************** 463 // */ 464 int rtos_timer_start(TimerHandle_t xTimer,TickType_t xTicksToWait, bool isr); 465 466 // /** 467 // **************************************************************************************** 468 // * @brief * suspend timer 469 // * 470 // * @param[out] see xTimerStop described. 471 // * 472 // * @return 0 on success and != 0 otherwise. 473 // **************************************************************************************** 474 // */ 475 int rtos_timer_stop(TimerHandle_t xTimer,TickType_t xTicksToWait); 476 477 // /** 478 // **************************************************************************************** 479 // * @brief * suspend timer 480 // * 481 // * @param[out] see xTimerStopFromISR described. 482 // * 483 // * @return 0 on success and != 0 otherwise. 484 // **************************************************************************************** 485 // */ 486 // int rtos_timer_stop_isr(TimerHandle_t xTimer); 487 488 // /** 489 // **************************************************************************************** 490 // * @brief * Delete timer 491 // * 492 // * @param[out] see xTimerDelete described. 493 // * 494 // * @return 0 on success and != 0 otherwise. 495 // **************************************************************************************** 496 // */ 497 int rtos_timer_delete(TimerHandle_t xTimer,TickType_t xTicksToWait); 498 499 // /** 500 // **************************************************************************************** 501 // * @brief * change timer period and reset timer 502 // * 503 // * @param[out] see xTimerChangePeriod described. 504 // * 505 // * @return 0 on success and != 0 otherwise. 506 // **************************************************************************************** 507 // */ 508 int rtos_timer_change_period(TimerHandle_t xTimer, TickType_t xNewPeriod, TickType_t xTicksToWait); 509 510 // /** 511 // **************************************************************************************** 512 // * @brief * change timer period and reset timer, called in isr 513 // * 514 // * @param[out] see xTimerChangePeriodFromISR described. 515 // * 516 // * @return 0 on success and != 0 otherwise. 517 // **************************************************************************************** 518 // */ 519 // int rtos_timer_change_period_isr(TimerHandle_t xTimer, TickType_t xNewPeriod); 520 521 // /** 522 // **************************************************************************************** 523 // * @brief * restart timer 524 // * 525 // * @param[out] see xTimerReset described. 526 // * 527 // * @return 0 on success and != 0 otherwise. 528 // **************************************************************************************** 529 // */ 530 int rtos_timer_restart(TimerHandle_t xTimer,TickType_t xTicksToWait, bool isr); 531 532 // /** 533 // **************************************************************************************** 534 // * @brief * Returns the ID assigned to the timer. 535 // * 536 // * @param[out] see pvTimerGetTimerID described. 537 // * 538 // * @return The ID assigned to the timer being queried. 539 // **************************************************************************************** 540 // */ 541 // void *rtos_timer_get_pvTimerID( TimerHandle_t xTimer ); 542 543 // /** 544 // **************************************************************************************** 545 // * @brief Creates and returns a new recursive mutex. 546 // * 547 // * @param[out] mutex Mutex handle returned by the function 548 // * 549 // * @return 0 on success and != 0 otherwise. 550 // **************************************************************************************** 551 // */ 552 553 int rtos_mutex_recursive_create(rtos_mutex *mutex); 554 555 // /** 556 // **************************************************************************************** 557 // * @brief Lock a recursive mutex. 558 // * 559 // * @param[in] mutex Mutex handle 560 // * @param[in] timeout Maximum duration to wait, in ms. 0 means do not wait and -1 means 561 // * wait indefinitely. 562 563 // * @return 0 on success and != 0 if timeout occurred. 564 // **************************************************************************************** 565 // */ 566 int rtos_mutex_recursive_lock(rtos_mutex mutex); 567 568 // /** 569 // **************************************************************************************** 570 // * @brief Unlock a recursive mutex. 571 // * 572 // * @param[in] mutex Mutex handle 573 // * 574 // * @return 0 on success and != 0 if timeout occurred. 575 // **************************************************************************************** 576 // */ 577 int rtos_mutex_recursive_unlock(rtos_mutex mutex); 578 579 // /** 580 // **************************************************************************************** 581 // * @brief Creates and returns a new mutex. 582 // * 583 // * @param[out] mutex Mutex handle returned by the function 584 // * 585 // * @return 0 on success and != 0 otherwise. 586 // **************************************************************************************** 587 // */ 588 int rtos_mutex_create(rtos_mutex *mutex); 589 590 // /** 591 // **************************************************************************************** 592 // * @brief Delete a mutex previously created by @ref rtos_mutex_create. 593 // * 594 // * @param[in] mutex Mutex handle 595 // **************************************************************************************** 596 // */ 597 void rtos_mutex_delete(rtos_mutex mutex); 598 599 // /** 600 // **************************************************************************************** 601 // * @brief Lock a mutex. 602 // * 603 // * @param[in] mutex Mutex handle 604 // * @param[in] timeout Maximum duration to wait, in ms. 0 means do not wait and -1 means 605 // * wait indefinitely. 606 607 // * @return 0 on success and != 0 if timeout occurred. 608 // **************************************************************************************** 609 // */ 610 int rtos_mutex_lock(rtos_mutex mutex, int timeout); 611 612 // /** 613 // **************************************************************************************** 614 // * @brief Unlock a mutex. 615 // * 616 // * @param[in] mutex Mutex handle 617 // * 618 // * @return 0 on success and != 0 if timeout occurred. 619 // **************************************************************************************** 620 // */ 621 int rtos_mutex_unlock(rtos_mutex mutex); 622 623 // /** 624 // **************************************************************************************** 625 // * @brief Create and returns a new event group. 626 // * 627 // * @param[out] event_group Event Group handle returned by the function 628 // * 629 // * @return 0 on success and != 0 otherwise. 630 // **************************************************************************************** 631 // */ 632 // int rtos_event_group_create(rtos_event_group *event_group); 633 634 // /** 635 // **************************************************************************************** 636 // * @brief Delete a event group previously created by @ref rtos_event_group_create. 637 // * 638 // * @param[in] mutex Event Group handle 639 // **************************************************************************************** 640 // */ 641 // void rtos_event_group_delete(rtos_event_group event_group); 642 643 // /** 644 // **************************************************************************************** 645 // * @brief Get the value of the event bits in the event group. 646 // * 647 // * @param[in] event_group Event Group handle 648 // * @param[in] isr Indicate if this is called from ISR 649 // * 650 // * @return The value of the event bits in the event group when the function was called 651 // **************************************************************************************** 652 // */ 653 // uint32_t rtos_event_group_get_bits(rtos_event_group event_group, bool isr); 654 655 // /** 656 // **************************************************************************************** 657 // * @brief Wait for the event bits in the event group to be available. 658 // * 659 // * @param[in] event_group Event Group handle 660 // * @param[in] val The val of the event bits to wait for 661 // * @param[in] clear_on_exit Set true to clear value in the event bits on exit 662 // * @param[in] wait_all_bits If set true, then function only return when all bits in the value 663 // * were set(or timeout), otherwise function will return when any bit in the value was 664 // * set(or timeout). 665 // * @param[in] timeout Maximum duration to wait, in ms. 0 means do not wait and -1 means 666 // * wait indefinitely. 667 // * 668 // * @return The value of the event bits in the event group 669 // **************************************************************************************** 670 // */ 671 // uint32_t rtos_event_group_wait_bits(rtos_event_group event_group, const uint32_t val, 672 // const bool clear_on_exit, const bool wait_all_bits, int timeout); 673 674 // /** 675 // **************************************************************************************** 676 // * @brief Clear the value of the event bits in the event group. 677 // * 678 // * @param[in] event_group Event Group handle 679 // * @param[in] value The val of the event bits to clear 680 // * @param[in] isr Indicate if this is called from ISR 681 // * 682 // * @return The value of the event bits in the event group before any bits were cleared 683 // **************************************************************************************** 684 // */ 685 // uint32_t rtos_event_group_clear_bits(rtos_event_group event_group, const uint32_t val, bool isr); 686 687 // /** 688 // **************************************************************************************** 689 // * @brief Set the value of the event bits in the event group. 690 // * 691 // * @param[in] event_group Event Group handle 692 // * @param[in] value The val of the event bits to set 693 // * @param[in] isr Indicate if this is called from ISR 694 // * 695 // * @return The value of the event bits in the event group when the function return 696 // **************************************************************************************** 697 // */ 698 // uint32_t rtos_event_group_set_bits(rtos_event_group event_group, const uint32_t val, bool isr); 699 700 // /** 701 // **************************************************************************************** 702 // * @brief Enter a critical section. 703 // * This function returns the previous protection level that is then used in the 704 // * @ref rtos_unprotect function call in order to put back the correct protection level 705 // * when exiting the critical section. This allows nesting the critical sections. 706 // * 707 // * @return The previous protection level 708 // **************************************************************************************** 709 // */ 710 uint32_t rtos_protect(void); 711 712 // /** 713 // **************************************************************************************** 714 // * @brief Exit a critical section. 715 // * This function restores the previous protection level. 716 // * 717 // * @param[in] protect The protection level to restore. 718 // **************************************************************************************** 719 // */ 720 void rtos_unprotect(uint32_t protect); 721 722 // /** 723 // **************************************************************************************** 724 // * @brief Launch the RTOS scheduler. 725 // * This function is supposed not to return as RTOS will switch the context to the highest 726 // * priority task inside this function. 727 // **************************************************************************************** 728 // */ 729 // void rtos_start_scheduler(void); 730 731 // /** 732 // **************************************************************************************** 733 // * @brief Init RTOS 734 // * 735 // * Initialize RTOS layers before start. 736 // * 737 // * @return 0 on success and != 0 if error occurred 738 // **************************************************************************************** 739 // */ 740 // int rtos_init(void); 741 742 // /** 743 // **************************************************************************************** 744 // * @brief Change the priority of a task 745 // * This function cannot be called from an ISR. 746 // * 747 // * @param[in] handle Task handle 748 // * @param[in] priority New priority to set to the task 749 // * 750 // **************************************************************************************** 751 // */ 752 // void rtos_priority_set(rtos_task_handle handle, rtos_prio priority); 753 754 // /** 755 // **************************************************************************************** 756 // * @brief Return RTOS task handle 757 // * 758 // * @return current task handle 759 // **************************************************************************************** 760 // */ 761 rtos_task_handle rtos_get_task_handle(void); 762 763 rtos_task_handle rtos_get_idle_task_handle(void); 764 765 // /** 766 // **************************************************************************************** 767 // * @brief Return RTOS scheduler state 768 // * 769 // **************************************************************************************** 770 // */ 771 // rtos_sched_state rtos_get_scheduler_state(void); 772 773 // PRIVATE_HOST_EXT_STATEMENT(TickType_t, xTickCount); 774 775 // void rtos_data_save(void); 776 777 #endif // _RTOS_OHOS_AL_H 778