OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [rtems/] [src/] [taskstart.c] - Blame information for rev 1026

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  taskstart.c,v 1.4 2000/08/30 07:55:39 joel Exp
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
 
49
rtems_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.