source: rtems/cpukit/rtems/src/taskstart.c @ 9c1c574b

4.104.114.84.95
Last change on this file since 9c1c574b was 9c1c574b, checked in by Joel Sherrill <joel.sherrill@…>, on 08/30/00 at 07:55:39

2000-08-30 Joel Sherrill <joel.sherrill@…>

  • taskstart.c: Removed 1st cut at rtems_task_start_main_style. Only committed this so it could be easily revisited as we discussing moving main() to user space from BSP space.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 *  RTEMS Task Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/rtems/status.h>
17#include <rtems/rtems/support.h>
18#include <rtems/rtems/modes.h>
19#include <rtems/score/object.h>
20#include <rtems/score/stack.h>
21#include <rtems/score/states.h>
22#include <rtems/rtems/tasks.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/threadq.h>
25#include <rtems/score/tod.h>
26#include <rtems/score/userext.h>
27#include <rtems/score/wkspace.h>
28#include <rtems/score/apiext.h>
29#include <rtems/score/sysstate.h>
30
31/*PAGE
32 *
33 *  rtems_task_start
34 *
35 *  This directive readies the thread identified by the "id"
36 *  based on its current priorty, to await execution.  A thread
37 *  can be started only from the dormant state.
38 *
39 *  Input parameters:
40 *    id          - thread id
41 *    entry_point - start execution address of thread
42 *    argument    - thread argument
43 *
44 *  Output parameters:
45 *    RTEMS_SUCCESSFUL - if successful
46 *    error code        - if unsuccessful
47 */
48
49rtems_status_code rtems_task_start(
50  rtems_id         id,
51  rtems_task_entry entry_point,
52  unsigned32       argument
53)
54{
55  register Thread_Control *the_thread;
56  Objects_Locations        location;
57
58  if ( entry_point == NULL )
59    return RTEMS_INVALID_ADDRESS;
60
61  the_thread = _Thread_Get( id, &location );
62  switch ( location ) {
63
64    case OBJECTS_REMOTE:
65#if defined(RTEMS_MULTIPROCESSING)
66      _Thread_Dispatch();
67      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
68#endif
69
70    case OBJECTS_ERROR:
71      return RTEMS_INVALID_ID;
72
73    case OBJECTS_LOCAL:
74      if ( _Thread_Start(
75             the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) {
76        _Thread_Enable_dispatch();
77        return RTEMS_SUCCESSFUL;
78      }
79      _Thread_Enable_dispatch();
80      return RTEMS_INCORRECT_STATE;
81  }
82
83  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
84}
Note: See TracBrowser for help on using the repository browser.