This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F Task 的优先级问题

Hi Ti JRs:

   请教个关于 Task 优先级的问题,我用的是 SimpleBroadcaster 例程。

   我看代码里有 GAPROLE_TASK_PRIORITY、SBB_TASK_PRIORITY 这些 优先级值,还有在 main() 函数里下面几行注释;

   请问下:

1. 是不是数值越少,等级越高吗?

2. 一共有多少个优先等级?

3. 这些优先等级是控制什么的?

4. 如果我自己想加个 Task,应该定义成哪个等级?

谢谢

/* Start tasks of external images - Priority 5 */

/* Kick off profile - Priority 3 */

/* Kick off application - Priority 1 */

  • 1.数值越大,优先级越高
    2.最多可以达到32级
    3.任务调度的先后顺序
    4.要看你的具体应用
    需要先学习下tirtos:C:/ti/simplelink_cc2640r2_sdk_4_20_00_04/docs/ble5stack/ble_user_guide/html/ble-stack-5.x-guide/tirtos-index.html

  • TI RTOS里数值越高,优先级越高。优先级分级及其他TI RTOS的内容请参考:dev.ti.com/.../tasks.html
    dev.ti.com/.../tirtos-index.html
  • Hi Kevin:

    谢谢~~

    再请问下,我可以在一个 Task 里再创建另一个 Task 吗?

    如果可以,有什么需要注意的吗?

    谢谢
  • Hi ViKi:

    谢谢~~

    再请问下,我可以在一个 Task 里再创建另一个 Task 吗?

    如果可以,有什么需要注意的吗?

    谢谢
  • Hi Kevin:

    谢谢~~

    再请问下,我可以在一个 Task 里再创建另一个 Task 吗?

    如果可以,有什么需要注意的吗?

    谢谢
  • 嵌套子任务我在手册中没有找到,应该是不行
  • Hi Kevin:

    好的,和我猜的结果一样。

    我之所这么问(在一个 Task 里再创建另一个 Task),是因为我发现如下的函数里 osal_snv_write 执行不成功。

    这两个函数的调用方式是这样的:
    1. fih_uart_createTask 函数是在 main 函数的最后面、BIOS_start() 的前面调用的;
    2. osal_snv_write 执行出错,搞不懂为什么这里调用 osal_snv_write 函数会执行出错?
    3. osal_snv_write 函数如果放在 SimpleBroadcaster_createTask() ----> SimpleBroadcaster_taskFxn ----> SimpleBroadcaster_init() 下面就能执行成功。


    所以,请问下,为什么 这里调用 osal_snv_write 函数会执行出错?

    谢谢


    void fih_uart_taskFxn(UArg arg0, UArg arg1)
    {
    uint8 status = SUCCESS;
    uint8 read_buf[BUF_LEN ] = {0, 0, 0, 0};
    uint8 write_buf[BUF_LEN] = {1, 2, 3, 4};

    status = osal_snv_write(BLE_NVID_CUST_START, BUF_LEN, (uint8 *)write_buf);

    fih_led_gpio_init();

    if(status != SUCCESS)
    {
    //UART_write(uart, "NV Write Fail\r\n", sizeof("NV Write Fail\r\n"));
    }

    status = osal_snv_read(BLE_NVID_CUST_START, BUF_LEN, (uint8 *)read_buf);

    if(status != SUCCESS)
    {
    //UART_write(uart, "NV Read Fail\r\n", sizeof("NV Read Fail\r\n"));
    }
    }


    void fih_uart_createTask(void)
    {
    Task_Params taskParams;

    // Configure task
    Task_Params_init(&taskParams);
    taskParams.stack = fihUARTTaskStack;
    taskParams.stackSize = FIH_UART_TASK_STACK_SIZE;
    taskParams.priority = FIH_UART_TASK_PRIORITY;

    Task_construct(&fihUARTTask, fih_uart_taskFxn, &taskParams, NULL);
    }
  • SNV按这里例子使用:/ti/simplelink_cc2640r2_sdk_4_20_00_04/docs/ble5stack/ble_user_guide/html/ble-stack-common/flash_memory-cc2640.html?highlight=snv#undefined