Changeset eb02f47 in rtems


Ignore:
Timestamp:
Nov 10, 1999, 1:48:27 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
442d0478
Parents:
dcc1f6b6
Message:

Committed modifications from ITRON Task and Task Dependendent Synchronization
Working Group. Included are tests.

Files:
6 added
1 deleted
60 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/itron/include/itronsys/types.h

    rdcc1f6b6 reb02f47  
    2020 */
    2121
    22 #if 0
    2322typedef signed8      B;       /* signed 8-bit integer */
    2423typedef signed16     H;       /* signed 16-bit integer */
     
    2726typedef unsigned16   UH;      /* unsigned 16-bit integer */
    2827typedef unsigned32   UW;      /* unsigned 32-bit integer */
    29 #endif
    3028
    3129typedef unsigned32   VW;      /* unpredictable data type (32-bit size) */
  • c/src/exec/itron/include/rtems/itron/object.h

    rdcc1f6b6 reb02f47  
    8181  (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \
    8282  ((_id) <= 0) ? E_ID :    /* bogus index of 0 - -3 */ \
    83   ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \
     83  ((_id) <= (_the_information)->maximum) ? E_NOEXS : /* does not exist */ \
    8484   E_ID)  /* simply a bad id */
    8585
  • c/src/exec/itron/include/rtems/itron/task.h

    rdcc1f6b6 reb02f47  
    7878);
    7979
     80/* XXX remove the need for this.  Enable dispatch should not be hidden */
     81
     82#define _ITRON_return_errorno( _errno )                \
     83do {                                                   \
     84  _Thread_Enable_dispatch();                           \
     85  return _errno;                                       \
     86} while (0);
     87
     88
     89#ifndef __RTEMS_APPLICATION__
    8090#include <rtems/itron/task.inl>
     91#endif
    8192
    8293#ifdef __cplusplus
  • c/src/exec/itron/inline/rtems/itron/task.inl

    rdcc1f6b6 reb02f47  
    110110  Objects_Locations *location
    111111)
    112 {
     112{
     113  if ( id == 0 ) {
     114    _Thread_Disable_dispatch();
     115    *location = OBJECTS_LOCAL;
     116    return _Thread_Executing;
     117  }
     118
    113119  return (Thread_Control *)
    114120    _ITRON_Objects_Get( &_ITRON_Task_Information, id, location );
     
    145151 */
    146152 
    147 RTEMS_INLINE_ROUTINE Priority_Control _ITRON_Task_Priority_to_Core(
    148   PRI   _priority
     153RTEMS_INLINE_ROUTINE _ITRON_Task_Priority_to_Core(
     154  PRI   ITRON_priority
    149155)
    150156
    151   return ((Priority_Control) (_priority));
     157  return (Priority_Control) ITRON_priority;
    152158}
     159
     160/*PAGE
     161 *
     162 *  _ITRON_tasks_Core_to_Priority
     163 */
     164 
     165RTEMS_INLINE_ROUTINE _ITRON_Task_Core_to_Priority(
     166  Priority_Control  core_priority
     167)
     168
     169  return (PRI) core_priority;
     170}
     171
    153172
    154173#ifdef __cplusplus
     
    158177#endif
    159178/* end of include file */
    160 
  • c/src/exec/itron/src/can_wup.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32  if (!the_thread)
     33    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     34
     35  switch ( location ) {
     36    case OBJECTS_REMOTE:
     37    case OBJECTS_ERROR:
     38    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     39
     40    case OBJECTS_LOCAL:
     41      /*
     42       * XXX - FILL ME IN.
     43       */
     44      return E_OK;
     45  }
     46
     47  return E_OBJ;           /* XXX - Should never get here */
    2948}
    3049
  • c/src/exec/itron/src/chg_pri.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30  Priority_Control         new_priority; 
     31
     32  the_thread = _ITRON_Task_Get( tskid, &location );
     33  if (!the_thread)
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     35
     36  if (_States_Is_dormant( the_thread->current_state ))
     37    return -1;
     38
     39  if (( tskpri <= 0 ) || ( tskpri >= 256 ))
     40    _ITRON_return_errorno( E_PAR );
     41
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ));
     46
     47    case OBJECTS_LOCAL:
     48      new_priority = _ITRON_Task_Priority_to_Core( tskpri );
     49      the_thread->real_priority = new_priority;
     50
     51      /*
     52       * XXX This is from the rtems side and I'm not sure what this is for.
     53       * XXX Is this check right or should change priority be called
     54       *     regardless?
     55       */
     56
     57      if ( the_thread->resource_count == 0 ||
     58           the_thread->current_priority > new_priority )
     59        _Thread_Change_priority( the_thread, new_priority, FALSE );
     60
     61      _Thread_Enable_dispatch();
     62      return E_OK;
     63  }
     64
     65  return E_OBJ;  /* XXX - Should never get here */
    2966}
    3067
     68
  • c/src/exec/itron/src/cre_tsk.c

    rdcc1f6b6 reb02f47  
    2222 */
    2323
    24 /*
    25  * XXX - How do I return these errors ???  Do I have to validate the ID
    26          prior to calling the ID routine ??
    27   E_NOMEM   Insufficient memory (Memory for control block and/or user stack
    28             cannot be allocated)
    29   E_ID      Invalid ID Number (tskid was invalid or could not be used)
    30   E_RSATR   Reserved attribute (tskatr was invalid or could not be used)
    31   E_OBJ     Invalid object state (a task of the same ID already exists)
    32   E_OACV    Object access violation (A tskid less than -4 was specified from
    33             a user task.  This is implementation dependent.)
    34   E_PAR     Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid)
    35   EN_OBJNO  An object number which could not be accessed on the target node
    36             is specified.
    37   EN_CTXID  Specified an object on another node when the system call was
    38             issued from a task in dispatch disabled state or from a task-
    39             independent portion
    40   EN_PAR    A value outside the range supported by the target node and/or
    41             transmission packet format was specified as a parameter (a value
    42             outside supported range was specified for exinf, tskatr, task,
    43             itskpri and/or stksz)
    44  */
    45 
    4624ER cre_tsk(
    4725  ID      tskid,
     
    6139
    6240  /*
     41   * Validate Parameters.
     42   */
     43 
     44 if ( pk_ctsk == NULL )
     45    _ITRON_return_errorno( E_PAR );
     46
     47  if ((pk_ctsk->tskatr != TA_ASM ) &&
     48      (pk_ctsk->tskatr != TA_HLNG) &&
     49      (pk_ctsk->tskatr != TA_COP0) &&
     50      (pk_ctsk->tskatr != TA_COP1) &&
     51      (pk_ctsk->tskatr != TA_COP2) &&
     52      (pk_ctsk->tskatr != TA_COP3) &&
     53      (pk_ctsk->tskatr != TA_COP4) &&
     54      (pk_ctsk->tskatr != TA_COP5) &&
     55      (pk_ctsk->tskatr != TA_COP6) &&
     56      (pk_ctsk->tskatr != TA_COP7))
     57    _ITRON_return_errorno( E_RSATR );
     58
     59  if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
     60  if ( pk_ctsk->itskpri <= 0 )
     61    _ITRON_return_errorno( E_PAR );
     62  if ( pk_ctsk->task == NULL )
     63    _ITRON_return_errorno( E_PAR );
     64  if ( pk_ctsk->stksz < 0 )
     65    _ITRON_return_errorno( E_PAR );
     66 
     67  /*
    6368   * allocate the thread.
    6469   */
    6570
    6671  the_thread = _ITRON_Task_Allocate( tskid );
    67   if ( !the_thread ) {
    68     ena_dsp();
    69     return _ITRON_Task_Clarify_allocation_id_error( tskid );
    70   }
    71 
    72   /*
    73    * XXX - FIX THE VARIABLES TO THE CORRECT VALUES!!!
    74    */
     72  if ( !the_thread )
     73    _ITRON_return_errorno( _ITRON_Task_Clarify_allocation_id_error( tskid ) );
    7574
    7675  /*
     
    8483    NULL,
    8584    pk_ctsk->stksz,
    86     TRUE,          /* XXX - All tasks FP ??? */
     85    TRUE,          /* XXX - All tasks FP for now */
    8786    core_priority,
    8887    TRUE,
     
    9594  if ( !status ) {
    9695    _ITRON_Task_Free( the_thread );
    97     _Thread_Enable_dispatch();
    98     return -1;
    99 #if (0)
    100 /* XXX */
    101 #endif
     96    _ITRON_return_errorno( E_NOMEM );
    10297  }
    103 
    104 #if (0)  /* XXX We have any thing else to set per API structure? */
    105   api = the_thread->API_Extensions[ THREAD_API_ITRON ];
    106   asr = &api->Signal;
    107  
    108   asr->is_enabled = FALSE;
    109 
    110   *id = the_thread->Object.id;
    111 #endif
    11298
    11399  /*
     
    126112}
    127113
     114
     115
     116
  • c/src/exec/itron/src/del_tsk.c

    rdcc1f6b6 reb02f47  
    3030  ER                       result;
    3131
    32   /* XXX - Fix Documentation and error checking for this error on self */
     32  the_thread = _ITRON_Task_Get( tskid, &location );
    3333
    34   the_thread = _ITRON_Task_Get( tskid, &location );
    35   _Thread_Disable_dispatch();
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if ( the_thread == _Thread_Executing )
     38    _ITRON_return_errorno( E_OBJ );
     39
     40  if ( !_States_Is_dormant( the_thread->current_state ) )
     41    _ITRON_return_errorno( E_OBJ );
    3642
    3743  switch ( location ) {
    3844    case OBJECTS_REMOTE:
    3945    case OBJECTS_ERROR:
    40       _Thread_Enable_dispatch(); 
    41       return _ITRON_Task_Clarify_get_id_error( tskid );
     46      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
    4247
    4348    case OBJECTS_LOCAL:
  • c/src/exec/itron/src/exd_tsk.c

    rdcc1f6b6 reb02f47  
    2626  Objects_Information     *the_information;
    2727
     28  _Thread_Disable_dispatch();
     29
    2830  the_information = _Objects_Get_information( _Thread_Executing->Object.id );
    2931
    3032  /* This should never happen if _Thread_Get() works right */
    3133  assert( the_information );
    32 
    33   _Thread_Disable_dispatch();
    3434
    3535  _Thread_Set_state( _Thread_Executing, STATES_DORMANT );
  • c/src/exec/itron/src/ext_tsk.c

    rdcc1f6b6 reb02f47  
    2424void ext_tsk( void )
    2525{
     26  _Thread_Disable_dispatch();
     27
     28  _Thread_Restart( _Thread_Executing, NULL, 0 );
    2629  _Thread_Set_state( _Thread_Executing, STATES_DORMANT );
     30
     31  _Thread_Enable_dispatch(); 
    2732}
  • c/src/exec/itron/src/frsm_tsk.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32  if (!the_thread)
     33    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     34
     35  if ( the_thread == _Thread_Executing )
     36    _ITRON_return_errorno( E_OBJ );
     37
     38  if (_States_Is_dormant( the_thread->current_state ))
     39    _ITRON_return_errorno( E_OBJ );
     40   
     41  switch ( location ) {
     42    case OBJECTS_REMOTE:
     43    case OBJECTS_ERROR:
     44      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     45
     46    case OBJECTS_LOCAL:
     47      _Thread_Resume( the_thread, TRUE );
     48      _Thread_Enable_dispatch();
     49      return E_OK;
     50  }
     51
     52  return E_OBJ;           /* XXX - Should never get here */
     53
    2954}
    3055
  • c/src/exec/itron/src/get_tid.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
     27  /*
     28   *  This does not support multiprocessing.  The id handling will have
     29   *  to be enhanced to support multiprocessing.
     30   */
     31   
     32  *p_tskid = _Objects_Get_index( _Thread_Executing->Object.id );
    2733  return E_OK;
    2834}
  • c/src/exec/itron/src/ref_tsk.c

    rdcc1f6b6 reb02f47  
    2727)
    2828{
    29   return E_OK;
     29  register Thread_Control *the_thread;
     30  Objects_Locations        location;
     31  Priority_Control         core_priority; 
     32
     33  the_thread = _ITRON_Task_Get( tskid, &location );
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if (!pk_rtsk)
     38    _ITRON_return_errorno( E_PAR );
     39
     40  /*
     41   * The following are extended functions [level X ].
     42   * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
     43   */
     44
     45  pk_rtsk->tskwait = 0;
     46  pk_rtsk->wid     = 0;
     47  pk_rtsk->wupcnt  = 0;
     48  pk_rtsk->suscnt  = the_thread->suspend_count;
     49  pk_rtsk->tskatr  = 0;
     50  pk_rtsk->task    = the_thread->Start.entry_point;
     51  core_priority    = the_thread->Start.initial_priority;
     52  pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
     53  pk_rtsk->stksz   = the_thread->Start.Initial_stack.size;
     54
     55  /*
     56   * The following are required.
     57   */
     58
     59  pk_rtsk->exinf   = NULL;   /* extended information */
     60  pk_rtsk->tskpri  = _ITRON_Task_Core_to_Priority(the_thread->current_priority);
     61  pk_rtsk->tskstat = 0;
     62
     63  /*
     64   * Mask in the tskstat information
     65   * Convert the task state XXX double check this
     66   */
     67
     68  if ( the_thread == _Thread_Executing )
     69    pk_rtsk->tskstat |= TTS_RUN;
     70  if ((the_thread->current_state & STATES_READY)   != 0)
     71    pk_rtsk->tskstat = TTS_RDY; 
     72  if (_States_Is_dormant( the_thread->current_state ))
     73    pk_rtsk->tskstat = TTS_DMT;
     74  if ((the_thread->current_state & STATES_SUSPENDED) != 0)
     75    pk_rtsk->tskstat = TTS_SUS;
     76  if ((the_thread->current_state & STATES_BLOCKED) != 0)
     77    pk_rtsk->tskstat = TTS_WAI;
     78
     79  return E_OK;           /* XXX - Should never get here */
    3080}
    3181
     82
     83
     84
  • c/src/exec/itron/src/rel_wai.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
    27   return E_OK;
     27  register Thread_Control *the_thread;
     28  Objects_Locations        location;
     29
     30  the_thread = _ITRON_Task_Get( tskid, &location );
     31  if (!the_thread)
     32    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     33
     34  _Thread_Disable_dispatch();
     35
     36  switch ( location ) {
     37    case OBJECTS_REMOTE:
     38    case OBJECTS_ERROR:
     39      _Thread_Enable_dispatch(); 
     40      return _ITRON_Task_Clarify_get_id_error( tskid );
     41
     42    case OBJECTS_LOCAL:
     43      /*
     44       * XXX - FILL ME IN.
     45       */
     46      return E_OK;
     47  }
     48
     49  return E_OBJ;           /* XXX - Should never get here */
    2850}
    2951
    3052
     53
  • c/src/exec/itron/src/rot_rdq.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
     27  PRI priority;
     28 
     29
     30  _Thread_Disable_dispatch();
     31
     32  /*
     33   * Yield of processor will rotate the queue for this processor.
     34   */
     35
     36  if (( tskpri <= 0 ) || ( tskpri >= 256 ))
     37    _ITRON_return_errorno( E_PAR );
     38
     39  priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority);
     40  if ( priority == tskpri )
     41    _Thread_Yield_processor();
     42  else {
     43    _Thread_Rotate_Ready_Queue( _ITRON_Task_Core_to_Priority( tskpri ) );
     44  }
     45  _Thread_Enable_dispatch();
     46 
    2747  return E_OK;
    2848}
  • c/src/exec/itron/src/rsm_tsk.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32
     33  if (!the_thread)
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid )  );
     35
     36  if ( the_thread == _Thread_Executing )
     37    _ITRON_return_errorno( E_OBJ );
     38
     39  if (_States_Is_dormant( the_thread->current_state ))
     40    _ITRON_return_errorno( E_OBJ );
     41   
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45     _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     46
     47    case OBJECTS_LOCAL:
     48      _Thread_Resume( the_thread, FALSE );
     49      _Thread_Enable_dispatch();
     50      return E_OK;
     51  }
     52
     53  return E_OBJ;           /* XXX - Should never get here */
    2954}
    3055
  • c/src/exec/itron/src/slp_tsk.c

    rdcc1f6b6 reb02f47  
    2020
    2121/*
    22  *  slp_tsk - Sleep Task Sleep Task with Timeout
     22 *  slp_tsk - Sleep Task
    2323 */
    2424
  • c/src/exec/itron/src/sta_tsk.c

    rdcc1f6b6 reb02f47  
    2222 */
    2323
    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 
    4224ER sta_tsk(
    4325  ID   tskid,
     
    5032
    5133  the_thread = _ITRON_Task_Get( tskid, &location );
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if ( !_States_Is_dormant( the_thread->current_state ) )
     38    _ITRON_return_errorno( E_OBJ );
     39
    5240  switch ( location ) {
    5341    case OBJECTS_REMOTE:
    5442    case OBJECTS_ERROR:
    55       return E_ID;  /* XXX */
     43      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
    5644
    5745    case OBJECTS_LOCAL:
     
    6452      );
    6553
    66       /*
    67        *  Wrong state  XXX
    68        */
    69 
    70       if ( !status ) {
    71         _Thread_Enable_dispatch();
    72         return E_OBJ;
    73       }
     54      if ( !status )
     55        _ITRON_return_errorno(  E_OBJ );
    7456
    7557      _Thread_Enable_dispatch();
  • c/src/exec/itron/src/sus_tsk.c

    rdcc1f6b6 reb02f47  
    3030)
    3131{
    32   return E_OK;
     32  register Thread_Control *the_thread;
     33  Objects_Locations        location;
     34
     35  the_thread = _ITRON_Task_Get( tskid, &location );
     36  if (!the_thread)
     37    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     38
     39  if ( the_thread == _Thread_Executing )
     40    _ITRON_return_errorno( E_OBJ );
     41
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     46
     47    case OBJECTS_LOCAL:
     48      _Thread_Suspend( the_thread );
     49      _Thread_Enable_dispatch();
     50      return E_OK;
     51  }
     52
     53  return E_OBJ;           /* XXX - Should never get here */
    3354}
    3455
     56
     57
     58
     59
     60
     61
  • c/src/exec/itron/src/task.c

    rdcc1f6b6 reb02f47  
    118118
    119119  the_information = _Objects_Get_information( the_thread->Object.id );
    120 
    121120  if ( !the_information ) {
    122     return -1;                  /* XXX */
    123         /* This should never happen if _Thread_Get() works right */
     121    return E_OBJ;             /* XXX - should never happen */
    124122  }
    125123
  • c/src/exec/itron/src/ter_tsk.c

    rdcc1f6b6 reb02f47  
    1919
    2020/*
    21  *  ter_tsk - Terminate Other Task
     21 *  ter_tsk - Terminate Other Task - Set State to DORMANT
    2222 */
    2323
     
    2626)
    2727{
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32
     33  if ( !the_thread )
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     35
     36  if ( the_thread == _Thread_Executing )
     37    _ITRON_return_errorno( E_OBJ );
     38 
     39  if ( _States_Is_dormant( the_thread->current_state ) )
     40    _ITRON_return_errorno( E_OBJ );
     41
     42  _Thread_Restart( the_thread, NULL, 0 );
     43  _Thread_Set_state( the_thread, STATES_DORMANT );
     44
     45  _Thread_Enable_dispatch();
    2846  return E_OK;
    2947}
    3048
     49
     50
     51
     52
     53
     54
  • c/src/exec/rtems/src/taskresume.c

    rdcc1f6b6 reb02f47  
    7171    case OBJECTS_LOCAL:
    7272      if ( _States_Is_suspended( the_thread->current_state ) ) {
    73         _Thread_Resume( the_thread );
     73        _Thread_Resume( the_thread, TRUE );
    7474        _Thread_Enable_dispatch();
    7575        return RTEMS_SUCCESSFUL;
  • c/src/exec/rtems/src/tasksuspend.c

    rdcc1f6b6 reb02f47  
    7272    case OBJECTS_LOCAL:
    7373      if ( !_States_Is_suspended( the_thread->current_state ) ) {
    74         _Thread_Set_state( the_thread, STATES_SUSPENDED );
     74        _Thread_Suspend( the_thread );
    7575        _Thread_Enable_dispatch();
    7676        return RTEMS_SUCCESSFUL;
  • c/src/exec/score/include/rtems/score/Makefile.in

    rdcc1f6b6 reb02f47  
    1111RTEMS_ROOT = @RTEMS_ROOT@
    1212PROJECT_ROOT = @PROJECT_ROOT@
     13
     14HAS_ITRON_API = @HAS_ITRON_API@
    1315
    1416VPATH = @srcdir@
     
    9496        echo "#define RTEMS_POSIX_API 1"        >>$@; \
    9597        fi
    96         echo "SHOULD BE HAS_ITRON_API not RTEMS_HAS_ITRON_API XXX "
    97         @if test "$(RTEMS_HAS_ITRON_API)" = "yes"; then \
     98        @if test "$(HAS_ITRON_API)" = "yes"; then \
    9899        echo "#define RTEMS_ITRON_API 1"        >>$@; \
    99100        fi
  • c/src/exec/score/include/rtems/score/thread.h

    rdcc1f6b6 reb02f47  
    186186#endif
    187187     /****************** end of common block ********************/
     188  unsigned32                            suspend_count;
    188189  boolean                               is_global;
    189190  boolean                               do_post_task_switch_extension;
     
    553554void _Thread_Yield_processor( void );
    554555
     556/* 
     557 *  _Thread_Rotate_Ready_Queue
     558 * 
     559 *  DESCRIPTION:
     560 * 
     561 *  This routine is invoked to rotate the ready queue for the
     562 *  given priority.  It can be used to yeild the processor
     563 *  by rotating the executing threads ready queue.
     564 */
     565
     566void _Thread_Rotate_Ready_Queue(
     567  Priority_Control  priority
     568);
     569
    555570/*
    556571 *  _Thread_Load_environment
     
    625640
    626641/*
     642 *  _Thread_Suspend
     643 *
     644 *  DESCRIPTION:
     645 *
     646 *  This routine updates the related suspend fields in the_thread
     647 *  control block to indicate the current nested level.
     648 */
     649
     650void _Thread_Suspend(
     651  Thread_Control   *the_thread
     652);
     653
     654/*
     655 *  _Thread_Resume
     656 *
     657 *  DESCRIPTION:
     658 *
     659 *  This routine updates the related suspend fields in the_thread
     660 *  control block to indicate the current nested level.  A force
     661 *  parameter of TRUE will force a resume and clear the suspend count.
     662 */
     663
     664void _Thread_Resume(
     665  Thread_Control   *the_thread,
     666  boolean           force
     667);
     668
     669/*
    627670 *  _Thread_Evaluate_mode
    628671 *
    629672 *  DESCRIPTION:
    630673 *
    631  *  This routine XXX
     674 *  This routine evaluates the current scheduling information for the
     675 *  system and determines if a context switch is required.  This
     676 *  is usually called after changing an execution mode such as preemptability
     677 *  for a thread.
    632678 */
    633679
  • c/src/exec/score/inline/rtems/score/thread.inl

    rdcc1f6b6 reb02f47  
    8181{
    8282  return ( _Thread_Executing == _Thread_Heir );
    83 }
    84 
    85 /*PAGE
    86  *
    87  *  _Thread_Resume
    88  *
    89  *  DESCRIPTION:
    90  *
    91  *  This routine clears the SUSPENDED state for the_thread.  It performs
    92  *  any necessary scheduling operations including the selection of
    93  *  a new heir thread.
    94  */
    95 
    96 RTEMS_INLINE_ROUTINE void _Thread_Resume (
    97   Thread_Control *the_thread
    98 )
    99 {
    100   _Thread_Clear_state( the_thread, STATES_SUSPENDED );
    10183}
    10284
  • c/src/exec/score/macros/rtems/score/thread.inl

    rdcc1f6b6 reb02f47  
    5353#define _Thread_Is_executing_also_the_heir() \
    5454        ( _Thread_Executing == _Thread_Heir )
    55 
    56 /*PAGE
    57  *
    58  *  _Thread_Resume
    59  *
    60  */
    61 
    62 #define _Thread_Resume( _the_thread ) \
    63         _Thread_Clear_state( (_the_thread), STATES_SUSPENDED )
    6455
    6556/*PAGE
  • c/src/exec/score/src/Makefile.in

    rdcc1f6b6 reb02f47  
    4343    threadcreateidle threaddelayended threaddispatch threadevaluatemode \
    4444    threadget threadhandler threadidlebody threadinitialize threadloadenv \
    45     threadready threadresettimeslice threadrestart threadsetpriority \
    46     threadsetstate threadsettransient threadstackallocate threadstackfree \
    47     threadstart threadstartmultitasking threadtickletimeslice \
    48     threadyieldprocessor
     45    threadready threadresettimeslice threadrestart threadresume \
     46    threadrotatequeue threadsetpriority threadsetstate threadsettransient \
     47    threadstackallocate threadstackfree threadstart threadstartmultitasking \
     48    threadsuspend threadtickletimeslice threadyieldprocessor
    4949
    5050THREADQ_C_PIECES= threadq threadqdequeue threadqdequeuefifo \
  • c/src/exec/score/src/threadinitialize.c

    rdcc1f6b6 reb02f47  
    154154  the_thread->current_state          = STATES_DORMANT;
    155155  the_thread->resource_count         = 0;
     156  the_thread->suspend_count          = 0;
    156157  the_thread->real_priority          = priority;
    157158  the_thread->Start.initial_priority = priority;
  • c/src/exec/score/src/threadrestart.c

    rdcc1f6b6 reb02f47  
    4545 
    4646    _Thread_Set_transient( the_thread );
    47     the_thread->resource_count = 0;
     47    the_thread->resource_count   = 0;
     48    the_thread->suspend_count    = 0;
    4849    the_thread->is_preemptible   = the_thread->Start.is_preemptible;
    4950    the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
  • c/src/tests/itrontests/itrontask03/Makefile.in

    rdcc1f6b6 reb02f47  
    2020
    2121# C source names, if any, go here -- minus the .c
    22 C_PIECES = init preempt spinit task1 task2 task3
     22C_PIECES = init preempt task1 task2 task3
    2323C_FILES = $(C_PIECES:%=%.c)
    2424C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
  • configure.in

    rdcc1f6b6 reb02f47  
    3232RTEMS_CANONICAL_HOST
    3333
     34RTEMS_CHECK_POSIX_API(RTEMS_BSP)
     35RTEMS_CHECK_ITRON_API(RTEMS_BSP)
     36RTEMS_CHECK_NETWORKING(RTEMS_BSP)
     37RTEMS_CHECK_RDBG
     38
    3439AC_CONFIG_SUBDIRS(tools/build)
    3540AC_CONFIG_SUBDIRS(tools/update)
  • cpukit/itron/include/itronsys/types.h

    rdcc1f6b6 reb02f47  
    2020 */
    2121
    22 #if 0
    2322typedef signed8      B;       /* signed 8-bit integer */
    2423typedef signed16     H;       /* signed 16-bit integer */
     
    2726typedef unsigned16   UH;      /* unsigned 16-bit integer */
    2827typedef unsigned32   UW;      /* unsigned 32-bit integer */
    29 #endif
    3028
    3129typedef unsigned32   VW;      /* unpredictable data type (32-bit size) */
  • cpukit/itron/include/rtems/itron/object.h

    rdcc1f6b6 reb02f47  
    8181  (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \
    8282  ((_id) <= 0) ? E_ID :    /* bogus index of 0 - -3 */ \
    83   ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \
     83  ((_id) <= (_the_information)->maximum) ? E_NOEXS : /* does not exist */ \
    8484   E_ID)  /* simply a bad id */
    8585
  • cpukit/itron/include/rtems/itron/task.h

    rdcc1f6b6 reb02f47  
    7878);
    7979
     80/* XXX remove the need for this.  Enable dispatch should not be hidden */
     81
     82#define _ITRON_return_errorno( _errno )                \
     83do {                                                   \
     84  _Thread_Enable_dispatch();                           \
     85  return _errno;                                       \
     86} while (0);
     87
     88
     89#ifndef __RTEMS_APPLICATION__
    8090#include <rtems/itron/task.inl>
     91#endif
    8192
    8293#ifdef __cplusplus
  • cpukit/itron/inline/rtems/itron/task.inl

    rdcc1f6b6 reb02f47  
    110110  Objects_Locations *location
    111111)
    112 {
     112{
     113  if ( id == 0 ) {
     114    _Thread_Disable_dispatch();
     115    *location = OBJECTS_LOCAL;
     116    return _Thread_Executing;
     117  }
     118
    113119  return (Thread_Control *)
    114120    _ITRON_Objects_Get( &_ITRON_Task_Information, id, location );
     
    145151 */
    146152 
    147 RTEMS_INLINE_ROUTINE Priority_Control _ITRON_Task_Priority_to_Core(
    148   PRI   _priority
     153RTEMS_INLINE_ROUTINE _ITRON_Task_Priority_to_Core(
     154  PRI   ITRON_priority
    149155)
    150156
    151   return ((Priority_Control) (_priority));
     157  return (Priority_Control) ITRON_priority;
    152158}
     159
     160/*PAGE
     161 *
     162 *  _ITRON_tasks_Core_to_Priority
     163 */
     164 
     165RTEMS_INLINE_ROUTINE _ITRON_Task_Core_to_Priority(
     166  Priority_Control  core_priority
     167)
     168
     169  return (PRI) core_priority;
     170}
     171
    153172
    154173#ifdef __cplusplus
     
    158177#endif
    159178/* end of include file */
    160 
  • cpukit/itron/src/can_wup.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32  if (!the_thread)
     33    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     34
     35  switch ( location ) {
     36    case OBJECTS_REMOTE:
     37    case OBJECTS_ERROR:
     38    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     39
     40    case OBJECTS_LOCAL:
     41      /*
     42       * XXX - FILL ME IN.
     43       */
     44      return E_OK;
     45  }
     46
     47  return E_OBJ;           /* XXX - Should never get here */
    2948}
    3049
  • cpukit/itron/src/chg_pri.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30  Priority_Control         new_priority; 
     31
     32  the_thread = _ITRON_Task_Get( tskid, &location );
     33  if (!the_thread)
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     35
     36  if (_States_Is_dormant( the_thread->current_state ))
     37    return -1;
     38
     39  if (( tskpri <= 0 ) || ( tskpri >= 256 ))
     40    _ITRON_return_errorno( E_PAR );
     41
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ));
     46
     47    case OBJECTS_LOCAL:
     48      new_priority = _ITRON_Task_Priority_to_Core( tskpri );
     49      the_thread->real_priority = new_priority;
     50
     51      /*
     52       * XXX This is from the rtems side and I'm not sure what this is for.
     53       * XXX Is this check right or should change priority be called
     54       *     regardless?
     55       */
     56
     57      if ( the_thread->resource_count == 0 ||
     58           the_thread->current_priority > new_priority )
     59        _Thread_Change_priority( the_thread, new_priority, FALSE );
     60
     61      _Thread_Enable_dispatch();
     62      return E_OK;
     63  }
     64
     65  return E_OBJ;  /* XXX - Should never get here */
    2966}
    3067
     68
  • cpukit/itron/src/cre_tsk.c

    rdcc1f6b6 reb02f47  
    2222 */
    2323
    24 /*
    25  * XXX - How do I return these errors ???  Do I have to validate the ID
    26          prior to calling the ID routine ??
    27   E_NOMEM   Insufficient memory (Memory for control block and/or user stack
    28             cannot be allocated)
    29   E_ID      Invalid ID Number (tskid was invalid or could not be used)
    30   E_RSATR   Reserved attribute (tskatr was invalid or could not be used)
    31   E_OBJ     Invalid object state (a task of the same ID already exists)
    32   E_OACV    Object access violation (A tskid less than -4 was specified from
    33             a user task.  This is implementation dependent.)
    34   E_PAR     Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid)
    35   EN_OBJNO  An object number which could not be accessed on the target node
    36             is specified.
    37   EN_CTXID  Specified an object on another node when the system call was
    38             issued from a task in dispatch disabled state or from a task-
    39             independent portion
    40   EN_PAR    A value outside the range supported by the target node and/or
    41             transmission packet format was specified as a parameter (a value
    42             outside supported range was specified for exinf, tskatr, task,
    43             itskpri and/or stksz)
    44  */
    45 
    4624ER cre_tsk(
    4725  ID      tskid,
     
    6139
    6240  /*
     41   * Validate Parameters.
     42   */
     43 
     44 if ( pk_ctsk == NULL )
     45    _ITRON_return_errorno( E_PAR );
     46
     47  if ((pk_ctsk->tskatr != TA_ASM ) &&
     48      (pk_ctsk->tskatr != TA_HLNG) &&
     49      (pk_ctsk->tskatr != TA_COP0) &&
     50      (pk_ctsk->tskatr != TA_COP1) &&
     51      (pk_ctsk->tskatr != TA_COP2) &&
     52      (pk_ctsk->tskatr != TA_COP3) &&
     53      (pk_ctsk->tskatr != TA_COP4) &&
     54      (pk_ctsk->tskatr != TA_COP5) &&
     55      (pk_ctsk->tskatr != TA_COP6) &&
     56      (pk_ctsk->tskatr != TA_COP7))
     57    _ITRON_return_errorno( E_RSATR );
     58
     59  if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
     60  if ( pk_ctsk->itskpri <= 0 )
     61    _ITRON_return_errorno( E_PAR );
     62  if ( pk_ctsk->task == NULL )
     63    _ITRON_return_errorno( E_PAR );
     64  if ( pk_ctsk->stksz < 0 )
     65    _ITRON_return_errorno( E_PAR );
     66 
     67  /*
    6368   * allocate the thread.
    6469   */
    6570
    6671  the_thread = _ITRON_Task_Allocate( tskid );
    67   if ( !the_thread ) {
    68     ena_dsp();
    69     return _ITRON_Task_Clarify_allocation_id_error( tskid );
    70   }
    71 
    72   /*
    73    * XXX - FIX THE VARIABLES TO THE CORRECT VALUES!!!
    74    */
     72  if ( !the_thread )
     73    _ITRON_return_errorno( _ITRON_Task_Clarify_allocation_id_error( tskid ) );
    7574
    7675  /*
     
    8483    NULL,
    8584    pk_ctsk->stksz,
    86     TRUE,          /* XXX - All tasks FP ??? */
     85    TRUE,          /* XXX - All tasks FP for now */
    8786    core_priority,
    8887    TRUE,
     
    9594  if ( !status ) {
    9695    _ITRON_Task_Free( the_thread );
    97     _Thread_Enable_dispatch();
    98     return -1;
    99 #if (0)
    100 /* XXX */
    101 #endif
     96    _ITRON_return_errorno( E_NOMEM );
    10297  }
    103 
    104 #if (0)  /* XXX We have any thing else to set per API structure? */
    105   api = the_thread->API_Extensions[ THREAD_API_ITRON ];
    106   asr = &api->Signal;
    107  
    108   asr->is_enabled = FALSE;
    109 
    110   *id = the_thread->Object.id;
    111 #endif
    11298
    11399  /*
     
    126112}
    127113
     114
     115
     116
  • cpukit/itron/src/del_tsk.c

    rdcc1f6b6 reb02f47  
    3030  ER                       result;
    3131
    32   /* XXX - Fix Documentation and error checking for this error on self */
     32  the_thread = _ITRON_Task_Get( tskid, &location );
    3333
    34   the_thread = _ITRON_Task_Get( tskid, &location );
    35   _Thread_Disable_dispatch();
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if ( the_thread == _Thread_Executing )
     38    _ITRON_return_errorno( E_OBJ );
     39
     40  if ( !_States_Is_dormant( the_thread->current_state ) )
     41    _ITRON_return_errorno( E_OBJ );
    3642
    3743  switch ( location ) {
    3844    case OBJECTS_REMOTE:
    3945    case OBJECTS_ERROR:
    40       _Thread_Enable_dispatch(); 
    41       return _ITRON_Task_Clarify_get_id_error( tskid );
     46      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
    4247
    4348    case OBJECTS_LOCAL:
  • cpukit/itron/src/exd_tsk.c

    rdcc1f6b6 reb02f47  
    2626  Objects_Information     *the_information;
    2727
     28  _Thread_Disable_dispatch();
     29
    2830  the_information = _Objects_Get_information( _Thread_Executing->Object.id );
    2931
    3032  /* This should never happen if _Thread_Get() works right */
    3133  assert( the_information );
    32 
    33   _Thread_Disable_dispatch();
    3434
    3535  _Thread_Set_state( _Thread_Executing, STATES_DORMANT );
  • cpukit/itron/src/ext_tsk.c

    rdcc1f6b6 reb02f47  
    2424void ext_tsk( void )
    2525{
     26  _Thread_Disable_dispatch();
     27
     28  _Thread_Restart( _Thread_Executing, NULL, 0 );
    2629  _Thread_Set_state( _Thread_Executing, STATES_DORMANT );
     30
     31  _Thread_Enable_dispatch(); 
    2732}
  • cpukit/itron/src/frsm_tsk.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32  if (!the_thread)
     33    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     34
     35  if ( the_thread == _Thread_Executing )
     36    _ITRON_return_errorno( E_OBJ );
     37
     38  if (_States_Is_dormant( the_thread->current_state ))
     39    _ITRON_return_errorno( E_OBJ );
     40   
     41  switch ( location ) {
     42    case OBJECTS_REMOTE:
     43    case OBJECTS_ERROR:
     44      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     45
     46    case OBJECTS_LOCAL:
     47      _Thread_Resume( the_thread, TRUE );
     48      _Thread_Enable_dispatch();
     49      return E_OK;
     50  }
     51
     52  return E_OBJ;           /* XXX - Should never get here */
     53
    2954}
    3055
  • cpukit/itron/src/get_tid.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
     27  /*
     28   *  This does not support multiprocessing.  The id handling will have
     29   *  to be enhanced to support multiprocessing.
     30   */
     31   
     32  *p_tskid = _Objects_Get_index( _Thread_Executing->Object.id );
    2733  return E_OK;
    2834}
  • cpukit/itron/src/ref_tsk.c

    rdcc1f6b6 reb02f47  
    2727)
    2828{
    29   return E_OK;
     29  register Thread_Control *the_thread;
     30  Objects_Locations        location;
     31  Priority_Control         core_priority; 
     32
     33  the_thread = _ITRON_Task_Get( tskid, &location );
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if (!pk_rtsk)
     38    _ITRON_return_errorno( E_PAR );
     39
     40  /*
     41   * The following are extended functions [level X ].
     42   * XXX - tskwait, wid, wupcnt, and tskatr are presently not implemented.
     43   */
     44
     45  pk_rtsk->tskwait = 0;
     46  pk_rtsk->wid     = 0;
     47  pk_rtsk->wupcnt  = 0;
     48  pk_rtsk->suscnt  = the_thread->suspend_count;
     49  pk_rtsk->tskatr  = 0;
     50  pk_rtsk->task    = the_thread->Start.entry_point;
     51  core_priority    = the_thread->Start.initial_priority;
     52  pk_rtsk->itskpri = _ITRON_Task_Core_to_Priority( core_priority );
     53  pk_rtsk->stksz   = the_thread->Start.Initial_stack.size;
     54
     55  /*
     56   * The following are required.
     57   */
     58
     59  pk_rtsk->exinf   = NULL;   /* extended information */
     60  pk_rtsk->tskpri  = _ITRON_Task_Core_to_Priority(the_thread->current_priority);
     61  pk_rtsk->tskstat = 0;
     62
     63  /*
     64   * Mask in the tskstat information
     65   * Convert the task state XXX double check this
     66   */
     67
     68  if ( the_thread == _Thread_Executing )
     69    pk_rtsk->tskstat |= TTS_RUN;
     70  if ((the_thread->current_state & STATES_READY)   != 0)
     71    pk_rtsk->tskstat = TTS_RDY; 
     72  if (_States_Is_dormant( the_thread->current_state ))
     73    pk_rtsk->tskstat = TTS_DMT;
     74  if ((the_thread->current_state & STATES_SUSPENDED) != 0)
     75    pk_rtsk->tskstat = TTS_SUS;
     76  if ((the_thread->current_state & STATES_BLOCKED) != 0)
     77    pk_rtsk->tskstat = TTS_WAI;
     78
     79  return E_OK;           /* XXX - Should never get here */
    3080}
    3181
     82
     83
     84
  • cpukit/itron/src/rel_wai.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
    27   return E_OK;
     27  register Thread_Control *the_thread;
     28  Objects_Locations        location;
     29
     30  the_thread = _ITRON_Task_Get( tskid, &location );
     31  if (!the_thread)
     32    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     33
     34  _Thread_Disable_dispatch();
     35
     36  switch ( location ) {
     37    case OBJECTS_REMOTE:
     38    case OBJECTS_ERROR:
     39      _Thread_Enable_dispatch(); 
     40      return _ITRON_Task_Clarify_get_id_error( tskid );
     41
     42    case OBJECTS_LOCAL:
     43      /*
     44       * XXX - FILL ME IN.
     45       */
     46      return E_OK;
     47  }
     48
     49  return E_OBJ;           /* XXX - Should never get here */
    2850}
    2951
    3052
     53
  • cpukit/itron/src/rot_rdq.c

    rdcc1f6b6 reb02f47  
    2525)
    2626{
     27  PRI priority;
     28 
     29
     30  _Thread_Disable_dispatch();
     31
     32  /*
     33   * Yield of processor will rotate the queue for this processor.
     34   */
     35
     36  if (( tskpri <= 0 ) || ( tskpri >= 256 ))
     37    _ITRON_return_errorno( E_PAR );
     38
     39  priority = _ITRON_Task_Core_to_Priority(_Thread_Executing->current_priority);
     40  if ( priority == tskpri )
     41    _Thread_Yield_processor();
     42  else {
     43    _Thread_Rotate_Ready_Queue( _ITRON_Task_Core_to_Priority( tskpri ) );
     44  }
     45  _Thread_Enable_dispatch();
     46 
    2747  return E_OK;
    2848}
  • cpukit/itron/src/rsm_tsk.c

    rdcc1f6b6 reb02f47  
    2626)
    2727{
    28   return E_OK;
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32
     33  if (!the_thread)
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid )  );
     35
     36  if ( the_thread == _Thread_Executing )
     37    _ITRON_return_errorno( E_OBJ );
     38
     39  if (_States_Is_dormant( the_thread->current_state ))
     40    _ITRON_return_errorno( E_OBJ );
     41   
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45     _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     46
     47    case OBJECTS_LOCAL:
     48      _Thread_Resume( the_thread, FALSE );
     49      _Thread_Enable_dispatch();
     50      return E_OK;
     51  }
     52
     53  return E_OBJ;           /* XXX - Should never get here */
    2954}
    3055
  • cpukit/itron/src/slp_tsk.c

    rdcc1f6b6 reb02f47  
    2020
    2121/*
    22  *  slp_tsk - Sleep Task Sleep Task with Timeout
     22 *  slp_tsk - Sleep Task
    2323 */
    2424
  • cpukit/itron/src/sta_tsk.c

    rdcc1f6b6 reb02f47  
    2222 */
    2323
    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 
    4224ER sta_tsk(
    4325  ID   tskid,
     
    5032
    5133  the_thread = _ITRON_Task_Get( tskid, &location );
     34  if (!the_thread)
     35    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     36
     37  if ( !_States_Is_dormant( the_thread->current_state ) )
     38    _ITRON_return_errorno( E_OBJ );
     39
    5240  switch ( location ) {
    5341    case OBJECTS_REMOTE:
    5442    case OBJECTS_ERROR:
    55       return E_ID;  /* XXX */
     43      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
    5644
    5745    case OBJECTS_LOCAL:
     
    6452      );
    6553
    66       /*
    67        *  Wrong state  XXX
    68        */
    69 
    70       if ( !status ) {
    71         _Thread_Enable_dispatch();
    72         return E_OBJ;
    73       }
     54      if ( !status )
     55        _ITRON_return_errorno(  E_OBJ );
    7456
    7557      _Thread_Enable_dispatch();
  • cpukit/itron/src/sus_tsk.c

    rdcc1f6b6 reb02f47  
    3030)
    3131{
    32   return E_OK;
     32  register Thread_Control *the_thread;
     33  Objects_Locations        location;
     34
     35  the_thread = _ITRON_Task_Get( tskid, &location );
     36  if (!the_thread)
     37    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     38
     39  if ( the_thread == _Thread_Executing )
     40    _ITRON_return_errorno( E_OBJ );
     41
     42  switch ( location ) {
     43    case OBJECTS_REMOTE:
     44    case OBJECTS_ERROR:
     45      _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     46
     47    case OBJECTS_LOCAL:
     48      _Thread_Suspend( the_thread );
     49      _Thread_Enable_dispatch();
     50      return E_OK;
     51  }
     52
     53  return E_OBJ;           /* XXX - Should never get here */
    3354}
    3455
     56
     57
     58
     59
     60
     61
  • cpukit/itron/src/task.c

    rdcc1f6b6 reb02f47  
    118118
    119119  the_information = _Objects_Get_information( the_thread->Object.id );
    120 
    121120  if ( !the_information ) {
    122     return -1;                  /* XXX */
    123         /* This should never happen if _Thread_Get() works right */
     121    return E_OBJ;             /* XXX - should never happen */
    124122  }
    125123
  • cpukit/itron/src/ter_tsk.c

    rdcc1f6b6 reb02f47  
    1919
    2020/*
    21  *  ter_tsk - Terminate Other Task
     21 *  ter_tsk - Terminate Other Task - Set State to DORMANT
    2222 */
    2323
     
    2626)
    2727{
     28  register Thread_Control *the_thread;
     29  Objects_Locations        location;
     30
     31  the_thread = _ITRON_Task_Get( tskid, &location );
     32
     33  if ( !the_thread )
     34    _ITRON_return_errorno( _ITRON_Task_Clarify_get_id_error( tskid ) );
     35
     36  if ( the_thread == _Thread_Executing )
     37    _ITRON_return_errorno( E_OBJ );
     38 
     39  if ( _States_Is_dormant( the_thread->current_state ) )
     40    _ITRON_return_errorno( E_OBJ );
     41
     42  _Thread_Restart( the_thread, NULL, 0 );
     43  _Thread_Set_state( the_thread, STATES_DORMANT );
     44
     45  _Thread_Enable_dispatch();
    2846  return E_OK;
    2947}
    3048
     49
     50
     51
     52
     53
     54
  • cpukit/rtems/src/taskresume.c

    rdcc1f6b6 reb02f47  
    7171    case OBJECTS_LOCAL:
    7272      if ( _States_Is_suspended( the_thread->current_state ) ) {
    73         _Thread_Resume( the_thread );
     73        _Thread_Resume( the_thread, TRUE );
    7474        _Thread_Enable_dispatch();
    7575        return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/tasksuspend.c

    rdcc1f6b6 reb02f47  
    7272    case OBJECTS_LOCAL:
    7373      if ( !_States_Is_suspended( the_thread->current_state ) ) {
    74         _Thread_Set_state( the_thread, STATES_SUSPENDED );
     74        _Thread_Suspend( the_thread );
    7575        _Thread_Enable_dispatch();
    7676        return RTEMS_SUCCESSFUL;
  • cpukit/score/include/rtems/score/thread.h

    rdcc1f6b6 reb02f47  
    186186#endif
    187187     /****************** end of common block ********************/
     188  unsigned32                            suspend_count;
    188189  boolean                               is_global;
    189190  boolean                               do_post_task_switch_extension;
     
    553554void _Thread_Yield_processor( void );
    554555
     556/* 
     557 *  _Thread_Rotate_Ready_Queue
     558 * 
     559 *  DESCRIPTION:
     560 * 
     561 *  This routine is invoked to rotate the ready queue for the
     562 *  given priority.  It can be used to yeild the processor
     563 *  by rotating the executing threads ready queue.
     564 */
     565
     566void _Thread_Rotate_Ready_Queue(
     567  Priority_Control  priority
     568);
     569
    555570/*
    556571 *  _Thread_Load_environment
     
    625640
    626641/*
     642 *  _Thread_Suspend
     643 *
     644 *  DESCRIPTION:
     645 *
     646 *  This routine updates the related suspend fields in the_thread
     647 *  control block to indicate the current nested level.
     648 */
     649
     650void _Thread_Suspend(
     651  Thread_Control   *the_thread
     652);
     653
     654/*
     655 *  _Thread_Resume
     656 *
     657 *  DESCRIPTION:
     658 *
     659 *  This routine updates the related suspend fields in the_thread
     660 *  control block to indicate the current nested level.  A force
     661 *  parameter of TRUE will force a resume and clear the suspend count.
     662 */
     663
     664void _Thread_Resume(
     665  Thread_Control   *the_thread,
     666  boolean           force
     667);
     668
     669/*
    627670 *  _Thread_Evaluate_mode
    628671 *
    629672 *  DESCRIPTION:
    630673 *
    631  *  This routine XXX
     674 *  This routine evaluates the current scheduling information for the
     675 *  system and determines if a context switch is required.  This
     676 *  is usually called after changing an execution mode such as preemptability
     677 *  for a thread.
    632678 */
    633679
  • cpukit/score/inline/rtems/score/thread.inl

    rdcc1f6b6 reb02f47  
    8181{
    8282  return ( _Thread_Executing == _Thread_Heir );
    83 }
    84 
    85 /*PAGE
    86  *
    87  *  _Thread_Resume
    88  *
    89  *  DESCRIPTION:
    90  *
    91  *  This routine clears the SUSPENDED state for the_thread.  It performs
    92  *  any necessary scheduling operations including the selection of
    93  *  a new heir thread.
    94  */
    95 
    96 RTEMS_INLINE_ROUTINE void _Thread_Resume (
    97   Thread_Control *the_thread
    98 )
    99 {
    100   _Thread_Clear_state( the_thread, STATES_SUSPENDED );
    10183}
    10284
  • cpukit/score/macros/rtems/score/thread.inl

    rdcc1f6b6 reb02f47  
    5353#define _Thread_Is_executing_also_the_heir() \
    5454        ( _Thread_Executing == _Thread_Heir )
    55 
    56 /*PAGE
    57  *
    58  *  _Thread_Resume
    59  *
    60  */
    61 
    62 #define _Thread_Resume( _the_thread ) \
    63         _Thread_Clear_state( (_the_thread), STATES_SUSPENDED )
    6455
    6556/*PAGE
  • cpukit/score/src/threadinitialize.c

    rdcc1f6b6 reb02f47  
    154154  the_thread->current_state          = STATES_DORMANT;
    155155  the_thread->resource_count         = 0;
     156  the_thread->suspend_count          = 0;
    156157  the_thread->real_priority          = priority;
    157158  the_thread->Start.initial_priority = priority;
  • cpukit/score/src/threadrestart.c

    rdcc1f6b6 reb02f47  
    4545 
    4646    _Thread_Set_transient( the_thread );
    47     the_thread->resource_count = 0;
     47    the_thread->resource_count   = 0;
     48    the_thread->suspend_count    = 0;
    4849    the_thread->is_preemptible   = the_thread->Start.is_preemptible;
    4950    the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
Note: See TracChangeset for help on using the changeset viewer.