Cannot find task id.
Ian Caddy
ianc at microsol.iinet.net.au
Thu Oct 24 03:52:49 UTC 2002
Hi Niclas,
Your application task does not stay in a loop, and hence will complete
straight away.
In this case, your Application task will complete after the printf and
then will be deleted.
Therefore if it is a higher priority task than your init task, it will
be deleted before your init task will to the last ident.
To fix this you will need to add (to your application task)
while(1)
{
rtems_task_wkafter(100);
}
Then it will not end.
I hope this helps,
Ian Caddy
Niclas Johansson wrote:
>>Niclas Johansson wrote:
>>
>>>Yes on both.
>>>
>>>This is the call:
>>>task_status = rtems_task_ident(rtems_build_name('L','O','G','1'),
>>> RTEMS_SEARCH_ALL_NODES, &taskid);
>>>
>>>I find it strange that it works fine before I start the task but not
>>>after.
>>
>>Sounds strange to me also. WOuld you mind putting together a
>>small yet complete test program so I can run it and see what's
>>happening. It sounds like it is only 4 calls -- create, ident,
>>start, and a failing ident -- so it shouldn't be that difficult
>>to get a cut-down.
>
>
> OK, here is the code:
>
> system.h:
> ==========================================================
> #include <tmacros.h>
> #include <rtems.h>
> #include <signal.h>
>
> #include <rtems/system.h>
> #include <rtems/rtems/status.h>
> #include <rtems/rtems/asr.h>
> #include <rtems/score/isr.h>
> #include <rtems/rtems/modes.h>
> #include <rtems/rtems/signal.h>
> #include <rtems/score/thread.h>
> #include <rtems/rtems/tasks.h>
>
> /* functions */
>
> rtems_task Init(
> rtems_task_argument argument
> );
>
> /* configuration information */
>
> #include <confdefs.h>
>
> /* global variables */
>
> TEST_EXTERN rtems_id Global_variable; /* example global variable */
>
> rtems_task Application_task(rtems_task_argument argument);
>
> /* end of include file */
>
> ==========================================================
> init.c
> ==========================================================
> #define TEST_INIT
> #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 50
> #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
> #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
> #define CONFIGURE_MAXIMUM_SEMAPHORES 20
> #define CONFIGURE_MAXIMUM_TASKS 25
> #define CONFIGURE_MICROSECONDS_PER_TICK 10000
> #define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)
> #define CONFIGURE_INIT_TASK_PRIORITY 120
> #define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
> RTEMS_NO_TIMESLICE | \
> RTEMS_NO_ASR | \
> RTEMS_INTERRUPT_LEVEL(0))
> #define CONFIGURE_INIT
> #include "system.h"
> #include <errno.h>
> #include <time.h>
> #include <confdefs.h>
> #include <stdio.h>
> #include <rtems/rtems_bsdnet.h>
> #include <rtems/error.h>
> #include <rpc/rpc.h>
> #include <netinet/in.h>
> #include <time.h>
> #include <arpa/inet.h>
> #include <sys/socket.h>
> /*#include "../networkconfig.h"*/
> #include <rtems_webserver.h>
> #include <rtems/monitor.h>
> #include <rtems.h>
> #define ARGUMENT 0
>
>
> rtems_task Init(rtems_task_argument argument)
> {
> rtems_status_code status;
> rtems_id tid, taskid;
>
> status =
> rtems_task_create(rtems_build_name('L','O','G','1'),1,RTEMS_MINIMUM_STACK_SIZE*2,RTEMS_PREEMPT
> | RTEMS_
> NO_TIMESLICE | RTEMS_NO_ASR |
>
> RTEMS_INTERRUPT_LEVEL(0),RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,&tid);
>
> status = rtems_task_ident(rtems_build_name('L','O','G','1'),
> RTEMS_SEARCH_ALL_NODES, &taskid);
>
> if(status != 0)printf("id1 error\n");
> printf("Log1Id in init.c:%i\n", taskid);
>
> status = rtems_task_start(tid,Application_task,0);
>
> taskid = 0;
>
> status = rtems_task_ident(rtems_build_name('L','O','G','1'),
> RTEMS_SEARCH_ALL_NODES, &taskid);
> if(status != 0)printf("id2 error \n");
> printf("Log1Id in init.c:%i\n", taskid);
>
> status = rtems_task_delete( RTEMS_SELF );
> }
> ==========================================================
> apptask.c
> ==========================================================
> #include <stdio.h>
> #include <rtems.h>
>
>
> rtems_task Application_task(rtems_task_argument argument){
>
>
> printf("task started\n");
>
> }
>
> ==========================================================
>
> Thanks for helping! It is appreciated by a newbie!
>
> /Nicke
>
>
>
>>Thanks.
>>
>>--joel
>>
>>
>>>/Nicke
>>>
>>>On Wed, 23 Oct 2002 Per-Olof.Wallin at esa.int wrote:
>>>
>>>>Per-Olof Wallin at ESA
>>>>10/23/2002 02:08 PM
>>>>
>>>>Are you using rtems_task_ident and if you are, did you use rtems_build_name
>>>>to create the name?
>>>>
>>>>/Per-Olof
>>>>
>>>>
>>>>
>>>>
>>>>|--------+----------------------->
>>>>| | Niclas |
>>>>| | Johansson |
>>>>| | <nicjoh-7 at sm.|
>>>>| | luth.se> |
>>>>| | |
>>>>| | 02-10-23 |
>>>>| | 13:00 |
>>>>| | |
>>>>|--------+----------------------->
>>>> >-------------------------------------------------------------------------|
>>>> | |
>>>> | To: rtems-users at oarcorp.com |
>>>> | cc: (bcc: Per-Olof Wallin/estec/ESA) |
>>>> | Subject: Cannot find task id. |
>>>> >-------------------------------------------------------------------------|
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>I am trying to find the id of a task from another task using
>>>>rtems_task_ident. When the task is created it works fine and I get the
>>>>id of the task, but when the task is started I get invalid
>>>>name as error response. Anybody have any ideas? Getting the id seems to me
>>>>like a straightforward operation but I cannot figure out what's wrong.
>>>>
>>>>/Nicke
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>--
>>Joel Sherrill, Ph.D. Director of Research & Development
>>joel at OARcorp.com On-Line Applications Research
>>Ask me about RTEMS: a free RTOS Huntsville AL 35805
>>Support Available (256) 722-9985
>>
>
>
>
More information about the users
mailing list