예제 #1
0
파일: main.c 프로젝트: Etienne13/pok
void main ()
{
   uint8_t tid;
   int ret;

  pok_thread_attr_t tattr;

  tattr.priority = 42;
  tattr.entry = pingme_job;

  ret = pok_thread_create (&tid,&tattr);

  pok_thread_sleep (100000);
}
예제 #2
0
파일: process.c 프로젝트: pok-kernel/pok
void CREATE_PROCESS (PROCESS_ATTRIBUTE_TYPE  *attributes,
										 PROCESS_ID_TYPE         *process_id,
										 RETURN_CODE_TYPE        *return_code )
{
	 pok_thread_attr_t core_attr;
	 pok_ret_t         core_ret;
	 uint32_t          core_process_id;

	 if (process_name_exist(&attributes->NAME))
		 {
			 *return_code = NO_ACTION;
			 return;
		 }
	 if (attributes->BASE_PRIORITY > MAX_PRIORITY_VALUE || attributes->BASE_PRIORITY < MIN_PRIORITY_VALUE)
		 {
			 *return_code = INVALID_PARAM;
			 return;
		 }
	 core_attr.priority        = (uint8_t) attributes->BASE_PRIORITY;
	 core_attr.entry           = attributes->ENTRY_POINT;
	 core_attr.period          = attributes->PERIOD;
	 core_attr.deadline        = attributes->DEADLINE;
	 core_attr.time_capacity   = attributes->TIME_CAPACITY;
	 core_attr.stack_size      = attributes->STACK_SIZE;

	 core_ret = pok_thread_create (&core_process_id, &core_attr);
	 *return_code = core_ret;
	 if(core_ret==POK_ERRNO_OK) {
	   pok_arinc653_processes_nb++;
	   pok_arinc653_processes[pok_arinc653_processes_nb] = core_process_id;
	   arinc_process_attribute[pok_arinc653_processes_nb].BASE_PRIORITY = attributes->BASE_PRIORITY;
	   strcpy(arinc_process_attribute[pok_arinc653_processes_nb].NAME, attributes->NAME);
	   *process_id = pok_arinc653_processes_nb;
	 }
	 else
	   return;

   // ARINC specifies that threads shall be created in the DORMANT state
   core_ret = pok_thread_suspend_target(core_process_id);
   *return_code = core_ret;
}
예제 #3
0
파일: process.c 프로젝트: juli1/ospat
/********************************************************************
* SERVICE  CREATE_PROCESS
********************************************************************/
void CREATE_PROCESS
		(const PROCESS_ATTRIBUTE_TYPE * const /* Big */	/* in */ATTRIBUTE, 
		PROCESS_ID_TYPE * const	/* out */		 				PROCESS_ID, 
		RETURN_CODE_TYPE * const  /* out */		 				RETURN_CODE)
{
	pok_thread_attr_t	core_attr;
	pok_ret_t			core_ret;
	uint32_t			core_process_id = 0;

	core_attr.priority		= (uint8_t) ATTRIBUTE->BASE_PRIORITY;
	core_attr.entry			= ATTRIBUTE->ENTRY_POINT;
	core_attr.period		= ATTRIBUTE->PERIOD; 

	if ((core_attr.period) != INFINITE_SYSTEM_TIME_VALUE){
		core_attr.period	= ATTRIBUTE->PERIOD / 10; // expressed in 100 us, converted ms
	}

	core_attr.deadline = ATTRIBUTE->DEADLINE; 
	if ((core_attr.deadline) > 0){
		core_attr.deadline		  = ATTRIBUTE->DEADLINE / 10; 
	}

	core_attr.time_capacity	= ATTRIBUTE->TIME_CAPACITY;// expressed in 100 us, converted ms
	
	if ((core_attr.time_capacity) > 0){
		core_attr.time_capacity = ATTRIBUTE->TIME_CAPACITY / 10;
	}
	core_attr.stack_size		= ATTRIBUTE->STACK_SIZE;

	core_ret = pok_thread_create (&core_process_id, &core_attr);

	*(pok_arinc653_threads_names[core_process_id]) = '\0';

	strcpy(&(pok_arinc653_threads_names[core_process_id]),&(ATTRIBUTE->NAME));

	*PROCESS_ID = core_process_id;

	*RETURN_CODE = core_ret;
}