1 | /* |
---|
2 | * The license and distribution terms for this file may be |
---|
3 | * found in the file LICENSE in this distribution or at |
---|
4 | * http://www.OARcorp.com/rtems/license.html. |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #include <itron.h> |
---|
10 | |
---|
11 | #include <rtems/score/thread.h> |
---|
12 | #include <rtems/score/userext.h> |
---|
13 | #include <rtems/score/wkspace.h> |
---|
14 | #include <rtems/score/apiext.h> |
---|
15 | #include <rtems/score/sysstate.h> |
---|
16 | |
---|
17 | #include <rtems/itron/task.h> |
---|
18 | |
---|
19 | |
---|
20 | /* |
---|
21 | * sta_tsk - Start Task |
---|
22 | */ |
---|
23 | |
---|
24 | /* |
---|
25 | * XXX - How Do I know when these happen ??? |
---|
26 | E_NOEXS Object does not exist (the task specified by tskid does not exist) |
---|
27 | E_OACV Object access violation (A tskid less than -4 was specified from |
---|
28 | a user task. This is implementation dependent.) |
---|
29 | E_OBJ Invalid object state (the target task is not in DORMANT state) |
---|
30 | EN_OBJNO An object number which could not be accessed on the target node |
---|
31 | is specified. XXX Should never get on a single processor?? |
---|
32 | EN_CTXID Specified an object on another node when the system call was |
---|
33 | issued from a task in dispatch disabled state or from a task- |
---|
34 | independent portionXXX Should never get on a single processor?? |
---|
35 | EN_PAR A value outside the range supported by the target node and/or |
---|
36 | transmission packet format was specified as a parameter (a value |
---|
37 | outside supported range was specified for stacd) |
---|
38 | XXX- What does _ITRON_Task_Get return on an invalid id and how do you know |
---|
39 | if it is E_ID, E_NOEXS, E_OACV |
---|
40 | */ |
---|
41 | |
---|
42 | ER sta_tsk( |
---|
43 | ID tskid, |
---|
44 | INT stacd |
---|
45 | ) |
---|
46 | { |
---|
47 | register Thread_Control *the_thread; |
---|
48 | Objects_Locations location; |
---|
49 | boolean status; |
---|
50 | |
---|
51 | the_thread = _ITRON_Task_Get( tskid, &location ); |
---|
52 | switch ( location ) { |
---|
53 | case OBJECTS_REMOTE: |
---|
54 | case OBJECTS_ERROR: |
---|
55 | return E_ID; /* XXX */ |
---|
56 | |
---|
57 | case OBJECTS_LOCAL: |
---|
58 | status = _Thread_Start( |
---|
59 | the_thread, |
---|
60 | THREAD_START_NUMERIC, /* XXX should be able to say we have no arg */ |
---|
61 | the_thread->Start.entry_point, |
---|
62 | 0, /* XXX supercore forces us to have an arg */ |
---|
63 | 0 /* unused */ |
---|
64 | ); |
---|
65 | |
---|
66 | /* |
---|
67 | * Wrong state XXX |
---|
68 | */ |
---|
69 | |
---|
70 | if ( !status ) { |
---|
71 | _Thread_Enable_dispatch(); |
---|
72 | return E_OBJ; |
---|
73 | } |
---|
74 | |
---|
75 | _Thread_Enable_dispatch(); |
---|
76 | return E_OK; |
---|
77 | } |
---|
78 | |
---|
79 | return E_OBJ; /* unreached - only to remove warnings */ |
---|
80 | } |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|