OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [itron/] [src/] [chg_pri.c] - Blame information for rev 30

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  COPYRIGHT (c) 1989-1999.
3
 *  On-Line Applications Research Corporation (OAR).
4
 *
5
 *  The license and distribution terms for this file may be
6
 *  found in the file LICENSE in this distribution or at
7
 *  http://www.OARcorp.com/rtems/license.html.
8
 *
9
 *  $Id: chg_pri.c,v 1.2 2001-09-27 11:59:13 chris Exp $
10
 */
11
 
12
#include <itron.h>
13
 
14
#include <rtems/score/thread.h>
15
#include <rtems/score/userext.h>
16
#include <rtems/score/wkspace.h>
17
#include <rtems/score/apiext.h>
18
#include <rtems/score/sysstate.h>
19
 
20
#include <rtems/itron/task.h>
21
 
22
/*
23
 *  chg_pri - Change Task Priority
24
 */
25
 
26
ER chg_pri(
27
  ID  tskid,
28
  PRI tskpri
29
)
30
{
31
  register Thread_Control *the_thread;
32
  Objects_Locations        location;
33
  Priority_Control         new_priority;
34
 
35
  the_thread = _ITRON_Task_Get( tskid, &location );
36
  switch ( location ) {
37
    case OBJECTS_REMOTE:
38
    case OBJECTS_ERROR:
39
      return _ITRON_Task_Clarify_get_id_error( tskid );
40
 
41
    case OBJECTS_LOCAL:
42
      if (_States_Is_dormant( the_thread->current_state ))
43
        _ITRON_return_errorno( E_OBJ );
44
 
45
      if (( tskpri <= 0 ) || ( tskpri >= 256 ))
46
        _ITRON_return_errorno( E_PAR );
47
 
48
      new_priority = _ITRON_Task_Priority_to_Core( tskpri );
49
      the_thread->real_priority = new_priority;
50
 
51
      /*
52
       * The priority should not be changed until later if priority
53
       * inheratance has occured.
54
       */
55
 
56
      if ( the_thread->resource_count == 0 ||
57
           the_thread->current_priority > new_priority )
58
        _Thread_Change_priority( the_thread, new_priority, FALSE );
59
 
60
      break;
61
  }
62
 
63
  _ITRON_return_errorno( E_OK );
64
}
65
 
66
 

powered by: WebSVN 2.1.0

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