summaryrefslogtreecommitdiffstats
path: root/cpukit/itron/macros/rtems/itron/task.inl
blob: ae4551181dfd8047358a09ecc6644fd77f1ac190 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
 * @file rtems/itron/task.inl
 */

/*
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#ifndef _RTEMS_ITRON_TASK_INL
#define _RTEMS_ITRON_TASK_INL

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  _ITRON_Task_Allocate
 */

#define _ITRON_Task_Allocate( _tskid ) \
  (Thread_Control *)_ITRON_Objects_Allocate_by_index( \
    &_ITRON_Task_Information, \
    (_tskid), \
    sizeof(Thread_Control) \
  )

/*
 *  _ITRON_Task_Clarify_allocation_id_error
 */

#define _ITRON_Task_Clarify_allocation_id_error( _id ) \
  _ITRON_Objects_Clarify_allocation_id_error( \
      &_ITRON_Task_Information, (_id) )

/*
 *  _ITRON_Task_Clarify_get_id_error
 */

#define _ITRON_Task_Clarify_get_id_error( _id ) \
 _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) )

/*
 *  _ITRON_Task_Free
 */

#define _ITRON_Task_Free( _the_task ) \
  _ITRON_Objects_Free( &_ITRON_Task_Information, &(_the_task)->Object )

/*PAGE
 *
 *  _ITRON_Task_Get
 */

/* XXX fix me */
static inline Thread_Control *_ITRON_Task_Get (
  ID                 id,
  Objects_Locations *location
)
{ 
  if ( id == 0 ) {
    _Thread_Disable_dispatch();
    *location = OBJECTS_LOCAL;
    return _Thread_Executing;
  }

  return (Thread_Control *)
    _ITRON_Objects_Get( &_ITRON_Task_Information, id, location );
}

/*PAGE
 *
 *  _ITRON_Task_Is_null
 */

#define _ITRON_Task_Is_null( _the_task ) \
  ( (_the_task) == NULL )

/*PAGE
 *
 *  _ITRON_tasks_Priority_to_Core
 */
 
#define _ITRON_Task_Priority_to_Core( _ITRON_priority ) \
  ((Priority_Control) (_ITRON_priority))

/*PAGE
 *
 *  _ITRON_tasks_Core_to_Priority
 */
 
#define _ITRON_Task_Core_to_Priority( _core_priority ) \
  ((PRI) (_core_priority))

#ifdef __cplusplus
}
#endif

#endif
/* end of include file */