コード例 #1
0
ファイル: cmsis_os.c プロジェクト: geliang201201/RTL_Ameba
/// Create a thread and add it to Active Threads and set it to state READY.
/// \param[in]     thread_def    thread definition referenced with \ref osThread.
/// \param[in]     argument      pointer that is passed to the thread function as start argument.
/// \return thread ID for reference by other functions or NULL in case of error.
/// \note MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)
{
//    (void) argument;
    xTaskHandle handle;
    BaseType_t  result;

    result = xTaskCreate((pdTASK_CODE)thread_def->pthread,
                (const portCHAR *)thread_def->name,
                (thread_def->stacksize/4),
                argument,
                makeFreeRtosPriority(thread_def->tpriority),
                &handle);
    if (pdPASS == result) {
#if configSignalManagementSupport
        EventGroupHandle_t signals;
        
        signals = xEventGroupCreate();
        if (signals == NULL) {
            /* The event group was not created because there was insufficient
               FreeRTOS heap available. */            
            CMSIS_OS_ERR("Create a EventGroup for a new thread failed\n");
        }
        else
        {
            add_thread_signal_map(handle, signals);
        }
#endif        
    }
    else
    {
        CMSIS_OS_ERR("Create a new thread(%s) failed\r\n", thread_def->name);
    }

    return handle;
}
コード例 #2
0
ファイル: cmsis_os.c プロジェクト: Casa2011/devices
/**
* @brief   Change priority of an active thread.
* @param   thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
* @param   priority      new priority value for the thread function.
* @retval  status code that indicates the execution status of the function.
* @note   MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
*/
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)
{
#if (INCLUDE_vTaskPrioritySet == 1)
  vTaskPrioritySet(thread_id, makeFreeRtosPriority(priority));
  return osOK;
#else
  return osErrorOS;
#endif
}
コード例 #3
0
ファイル: cmsis_os.c プロジェクト: Casa2011/devices
/**
* @brief  Create a thread and add it to Active Threads and set it to state READY.
* @param  thread_def    thread definition referenced with \ref osThread.
* @param  argument      pointer that is passed to the thread function as start argument.
* @retval thread ID for reference by other functions or NULL in case of error.
* @note   MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
*/
osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)
{
  TaskHandle_t handle;
  
  
  if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
              thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
              &handle) != pdPASS)  {
    return NULL;
  }
  
  return handle;
}
コード例 #4
0
/**
* @brief  Create a thread and add it to Active Threads and set it to state READY.
* @param  thread_def    thread definition referenced with \ref osThread.
* @param  argument      pointer that is passed to the thread function as start argument.
* @retval thread ID for reference by other functions or NULL in case of error.
* @note   MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
*/
osThreadId osThreadCreate (osThreadDef_t *thread_def, void *argument)
{
  xTaskHandle handle;
  
  
  xTaskCreate((pdTASK_CODE)thread_def->pthread,
              (const signed portCHAR *)thread_def->name,
              thread_def->stacksize,
              argument,
              makeFreeRtosPriority(thread_def->tpriority),
              &handle);
  
  return handle;
}
コード例 #5
0
ファイル: cmsis_os.c プロジェクト: timurey/oryx_stm32f205
/**
* @brief  Create a thread and add it to Active Threads and set it to state READY.
* @param  thread_def    thread definition referenced with \ref osThread.
* @param  argument      pointer that is passed to the thread function as start argument.
* @retval thread ID for reference by other functions or NULL in case of error.
* @note   MUST REMAIN UNCHANGED: \b osThreadCreate shall be consistent in every CMSIS-RTOS.
*/
osThreadId osThreadCreate (osThreadDef_t *thread_def, void *argument)
{
  xTaskHandle handle;
//  BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode,
//		  	  	  	  	  	  	  const char * const pcName,
//		  	  	  	  	  	  	  const uint16_t usStackDepth,
//		  	  	  	  	  	  	  void * const pvParameters,
//		  	  	  	  	  	  	  UBaseType_t uxPriority,
//		  	  	  	  	  	  	  TaskHandle_t * const pxCreatedTask,
//		  	  	  	  	  	  	  StackType_t * const puxStackBuffer,
//		  	  	  	  	  	  	  const MemoryRegion_t * const xRegions ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */

  
  xTaskCreate((TaskFunction_t)thread_def->pthread,
              (const portCHAR *)thread_def->name,
              thread_def->stacksize,
              argument,
              makeFreeRtosPriority(thread_def->tpriority),
              &handle);
  
  return handle;
}
コード例 #6
0
ファイル: cmsis_os.c プロジェクト: timurey/oryx_stm32f205
/**
* @brief   Change priority of an active thread.
* @param   thread_id     thread ID obtained by \ref osThreadCreate or \ref osThreadGetId.
* @param   priority      new priority value for the thread function.
* @retval  status code that indicates the execution status of the function.
* @note   MUST REMAIN UNCHANGED: \b osThreadSetPriority shall be consistent in every CMSIS-RTOS.
*/
osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)
{
  vTaskPrioritySet(thread_id, makeFreeRtosPriority(priority));
  
  return osOK;
}