Beispiel #1
0
void task_yield_1_entry(void *arg)
{
#if (RHINO_CONFIG_SCHED_RR > 0)
    krhino_sched_policy_set(krhino_cur_task_get(), KSCHED_FIFO);
#endif

    while (1) {
        krhino_task_yield();
        krhino_task_dyn_del(krhino_cur_task_get());
    }

}
Beispiel #2
0
static void task_buf_queue_trigger_entry(void *arg)
{
    *(uint8_t *)buf_queue_send = 0x5a;

    krhino_buf_queue_send(&test_buf_queue, (void *)buf_queue_send, 1);
    krhino_task_dyn_del(krhino_cur_task_get());
}
Beispiel #3
0
static void task_mutex_opr_entry(void *arg)
{
    kstat_t ret;

    krhino_mutex_lock(test_mutex, RHINO_WAIT_FOREVER);

    while (notify_flag != 0x5a) {
        krhino_task_sleep(5);
    }

    ret = krhino_mutex_unlock(test_mutex);
    if (ret == RHINO_SUCCESS) {
        test_case_success++;
        PRINT_RESULT(MODULE_NAME, PASS);
    } else {
        test_case_fail++;
        PRINT_RESULT(MODULE_NAME, FAIL);
    }

    next_test_case_notify();
    ret = krhino_mutex_dyn_del(test_mutex);
    if (ret != RHINO_SUCCESS) {
        test_case_fail++;
        PRINT_RESULT(MODULE_NAME, FAIL);
    }

    krhino_task_dyn_del(krhino_cur_task_get());
}
Beispiel #4
0
void *aos_task_getspecific(aos_task_key_t key)
{
    void *vp = NULL;

    krhino_task_info_get(krhino_cur_task_get(), key, &vp);

    return vp;
}
Beispiel #5
0
void OS_test(void *arg)
{
    kstat_t ret;

    WaitForNew_tick();
    krhino_sem_dyn_create(&SYNhandle, "syn_sem", 0);
    krhino_sem_dyn_create(&SYNmainhandle, "synmain_sem", 0);
    show_times_hdr();

#if 1
    ret = krhino_task_dyn_create(&test_task, "test_task", 0, TASK_TEST_PRI,
                                 0, TASK_TEST_STACK_SIZE, IntRealtimetest, 1);
    krhino_sem_take(SYNhandle, RHINO_WAIT_FOREVER);
    krhino_task_dyn_del(test_task);

    krhino_task_sleep(50);
#endif

#if 1
    krhino_task_dyn_create(&test_task, "test_task", 0, TASK_TEST_PRI,
                           0, TASK_TEST_STACK_SIZE, TaskYIELDtimeTest, 1);
    krhino_sem_take(SYNhandle, RHINO_WAIT_FOREVER);
    krhino_task_dyn_del(test_task);
    krhino_task_sleep(50);
#endif

#if 1
    krhino_task_dyn_create(&test_task, "test_task", 0, TASK_TEST_PRI,
                           0, TASK_TEST_STACK_SIZE, PreemptionTimetest, 1);
    krhino_sem_take(SYNhandle, RHINO_WAIT_FOREVER);
    krhino_task_dyn_del(test_task);

    krhino_task_sleep(50);
#endif

#if 1
    krhino_task_dyn_create(&test_task, "test_task", 0, TASK_TEST_PRI,
                           0, TASK_TEST_STACK_SIZE, MutexShufTimetest, 1);

    krhino_sem_take(SYNhandle, RHINO_WAIT_FOREVER);
    krhino_task_dyn_del(test_task);

    krhino_task_sleep(50);
#endif

#if 1
    krhino_task_dyn_create(&test_task, "test_task", 0, TASK_TEST_PRI,
                           0, TASK_TEST_STACK_SIZE, BinaryShufTimetest, 1);

    krhino_sem_take(SYNhandle, RHINO_WAIT_FOREVER);
    krhino_task_dyn_del(test_task);

    krhino_task_sleep(50);
#endif

    krhino_task_dyn_del(krhino_cur_task_get());

}
Beispiel #6
0
void mico_rtos_suspend_thread(mico_thread_t* thread)
{
    if (thread == NULL) {
        krhino_task_suspend(krhino_cur_task_get());        
    }
    else {
        krhino_task_suspend(*((ktask_t **)thread));
    }
}
Beispiel #7
0
void task_yield_2_entry(void *arg)
{
    while (1) {
        test_case_success++;
        PRINT_RESULT("task_yield", PASS);
        next_test_case_notify();
        krhino_task_dyn_del(krhino_cur_task_get());
    }
}
Beispiel #8
0
struct _reent* __getreent()
{
    ktask_t *task = krhino_cur_task_get();
    if (task == NULL) {
        return _GLOBAL_REENT;
    }
    else {
        return _GLOBAL_REENT;;
    }
}
Beispiel #9
0
int aos_task_setspecific(aos_task_key_t key, void *vp)
{
    int ret;
    ret = krhino_task_info_set(krhino_cur_task_get(), key, vp);
    if (ret == RHINO_SUCCESS) {
        return 0;
    }

    ERRNO_MAPPING(ret);
}
Beispiel #10
0
bool mico_rtos_is_current_thread( mico_thread_t* thread )
{
    ktask_t *t;

    t = *((ktask_t **)thread);

    if (t == krhino_cur_task_get()) {
        return true;
    }

    return false;
}
Beispiel #11
0
static void task_buf_queue_entry(void *arg)
{
    kstat_t ret;
    size_t  size;

    ret = krhino_buf_queue_recv(&test_buf_queue, RHINO_WAIT_FOREVER,
                                (void *)buf_queue_recv, &size);
    if ((ret == RHINO_SUCCESS) && (*(uint8_t *)buf_queue_recv == 0x5a)) {
        notify_flag = 0x5a;
        krhino_buf_queue_del(&test_buf_queue);
        krhino_task_dyn_del(krhino_cur_task_get());
    }
}
Beispiel #12
0
struct _reent* __getreent()
{
    void *info;

    ktask_t *task = krhino_cur_task_get();
    if (task == NULL) {
        return _GLOBAL_REENT;
    }
    else {
        krhino_task_info_get(task, 2, &info);
        return info;
    }
}
Beispiel #13
0
void task_workqueue_entry(void *arg)
{
    test_func_t *runner;
    uint8_t      caseidx;
    char         name[64];
    uint8_t      casenum;

    runner  = (test_func_t *)module_runner;
    casenum = module_casenum;
    caseidx = 0;

    while (1) {
        if (*runner == NULL) {
            break;
        }

        if (casenum > 2) {
            caseidx++;
            sprintf(name, "%s_%d", module_name, caseidx);
        } else {
            sprintf(name, "%s", module_name);
        }

        if ((*runner)() == 0) {
            test_case_success++;
            PRINT_RESULT(name, PASS);
        } else {
            test_case_fail++;
            PRINT_RESULT(name, FAIL);
        }
        runner++;
    }

    next_test_case_notify();
    krhino_task_dyn_del(krhino_cur_task_get());
}
Beispiel #14
0
/**
 * @brief get current task handle
 */
espos_task_t espos_task_get_current(void)
{
    return (espos_task_t)krhino_cur_task_get();
}
Beispiel #15
0
const char *aos_task_name(void)
{
    return krhino_cur_task_get()->task_name;
}