source: rtems/cpukit/itron/src/sta_tsk.c @ 352c9b2

4.104.114.84.95
Last change on this file since 352c9b2 was 352c9b2, checked in by Joel Sherrill <joel.sherrill@…>, on 11/09/99 at 22:07:23

This patch adds the basic framework for the ITRON 3.0 API implementation
for RTEMS.

  • Property mode set to 100644
File size: 2.3 KB
Line 
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)
38XXX- 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
42ER 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
Note: See TracBrowser for help on using the repository browser.