FreeCalypso > hg > freecalypso-sw
comparison nuc-fw/nucleus/tcfe.c @ 79:947b1f473960
beginning of nuc-fw
| author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
|---|---|
| date | Sun, 11 Aug 2013 07:17:25 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 78:2c266d4339ff | 79:947b1f473960 |
|---|---|
| 1 /*************************************************************************/ | |
| 2 /* */ | |
| 3 /* Copyright Mentor Graphics Corporation 2002 */ | |
| 4 /* All Rights Reserved. */ | |
| 5 /* */ | |
| 6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */ | |
| 7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */ | |
| 8 /* SUBJECT TO LICENSE TERMS. */ | |
| 9 /* */ | |
| 10 /*************************************************************************/ | |
| 11 | |
| 12 /*************************************************************************/ | |
| 13 /* */ | |
| 14 /* FILE NAME VERSION */ | |
| 15 /* */ | |
| 16 /* tcfe.c Nucleus PLUS 1.14 */ | |
| 17 /* */ | |
| 18 /* COMPONENT */ | |
| 19 /* */ | |
| 20 /* TC - Thread Control */ | |
| 21 /* */ | |
| 22 /* DESCRIPTION */ | |
| 23 /* */ | |
| 24 /* This file contains routines that check parameters to the */ | |
| 25 /* routines that return information about a thread. */ | |
| 26 /* */ | |
| 27 /* DATA STRUCTURES */ | |
| 28 /* */ | |
| 29 /* None */ | |
| 30 /* */ | |
| 31 /* FUNCTIONS */ | |
| 32 /* */ | |
| 33 /* TCFE_Task_Information Retrieve task information */ | |
| 34 /* */ | |
| 35 /* DEPENDENCIES */ | |
| 36 /* */ | |
| 37 /* tc_extr.h Thread Control functions */ | |
| 38 /* */ | |
| 39 /* HISTORY */ | |
| 40 /* */ | |
| 41 /* DATE REMARKS */ | |
| 42 /* */ | |
| 43 /* 11-07-2002 Released version 1.14 */ | |
| 44 /* */ | |
| 45 /*************************************************************************/ | |
| 46 #define NU_SOURCE_FILE | |
| 47 | |
| 48 | |
| 49 #include "tc_extr.h" /* Thread control functions */ | |
| 50 | |
| 51 | |
| 52 /*************************************************************************/ | |
| 53 /* */ | |
| 54 /* FUNCTION */ | |
| 55 /* */ | |
| 56 /* TCFE_Task_Information */ | |
| 57 /* */ | |
| 58 /* DESCRIPTION */ | |
| 59 /* */ | |
| 60 /* This function performs error checking on the parameters supplied */ | |
| 61 /* to the function that returns information about a task. */ | |
| 62 /* */ | |
| 63 /* CALLED BY */ | |
| 64 /* */ | |
| 65 /* Application */ | |
| 66 /* */ | |
| 67 /* CALLS */ | |
| 68 /* */ | |
| 69 /* [TCT_Check_Stack] Stack checking function */ | |
| 70 /* TCT_System_Protect Protect scheduling info */ | |
| 71 /* TCT_Unprotect Release protection */ | |
| 72 /* TCF_Task_Information Returns task information */ | |
| 73 /* */ | |
| 74 /* INPUTS */ | |
| 75 /* */ | |
| 76 /* task_ptr Pointer to the task */ | |
| 77 /* name Destination for the name */ | |
| 78 /* status Destination for task status */ | |
| 79 /* scheduled_count Destination for scheduled */ | |
| 80 /* count of the task */ | |
| 81 /* priority Destination for task priority*/ | |
| 82 /* preempt Destination for preempt flag */ | |
| 83 /* time_slice Destination for time slice */ | |
| 84 /* stack_base Destination for pointer to */ | |
| 85 /* base of task's stack */ | |
| 86 /* stack_size Destination for stack size */ | |
| 87 /* minimum_stack Destination for the minimum */ | |
| 88 /* running size of the stack */ | |
| 89 /* */ | |
| 90 /* OUTPUTS */ | |
| 91 /* */ | |
| 92 /* NU_SUCCESS If a valid task pointer is */ | |
| 93 /* supplied */ | |
| 94 /* NU_INVALID_TASK If task pointer is invalid */ | |
| 95 /* */ | |
| 96 /* HISTORY */ | |
| 97 /* */ | |
| 98 /* DATE REMARKS */ | |
| 99 /* */ | |
| 100 /* 03-01-1993 Created initial version 1.0 */ | |
| 101 /* */ | |
| 102 /*************************************************************************/ | |
| 103 STATUS TCFE_Task_Information(NU_TASK *task_ptr, CHAR *name, | |
| 104 DATA_ELEMENT *status, UNSIGNED *scheduled_count, | |
| 105 DATA_ELEMENT *priority, OPTION *preempt, UNSIGNED *time_slice, | |
| 106 VOID **stack_base, UNSIGNED *stack_size, UNSIGNED *minimum_stack) | |
| 107 { | |
| 108 | |
| 109 STATUS completion; /* Completion status */ | |
| 110 NU_SUPERV_USER_VARIABLES | |
| 111 | |
| 112 /* Switch to supervisor mode */ | |
| 113 NU_SUPERVISOR_MODE(); | |
| 114 | |
| 115 #ifdef NU_ENABLE_STACK_CHECK | |
| 116 | |
| 117 /* Call stack checking function to check for an overflow condition. */ | |
| 118 TCT_Check_Stack(); | |
| 119 | |
| 120 #endif | |
| 121 | |
| 122 /* Check if parameters are valid. task is tested in TCF_Task_Inforation */ | |
| 123 if (name == NU_NULL) | |
| 124 completion = NU_INVALID_POINTER; | |
| 125 else if (preempt == NU_NULL) | |
| 126 completion = NU_INVALID_POINTER; | |
| 127 else if (status == NU_NULL) | |
| 128 completion = NU_INVALID_POINTER; | |
| 129 else if (scheduled_count == NU_NULL) | |
| 130 completion = NU_INVALID_POINTER; | |
| 131 else if (priority == NU_NULL) | |
| 132 completion = NU_INVALID_POINTER; | |
| 133 else if (time_slice == NU_NULL) | |
| 134 completion = NU_INVALID_POINTER; | |
| 135 else if (stack_base == NU_NULL) | |
| 136 completion = NU_INVALID_POINTER; | |
| 137 else if (stack_size == NU_NULL) | |
| 138 completion = NU_INVALID_POINTER; | |
| 139 else if (minimum_stack == NU_NULL) | |
| 140 completion = NU_INVALID_POINTER; | |
| 141 else | |
| 142 completion = TCF_Task_Information(task_ptr, name, status, scheduled_count, | |
| 143 priority, preempt, time_slice, stack_base, | |
| 144 stack_size, minimum_stack); | |
| 145 TCT_Unprotect(); | |
| 146 | |
| 147 /* Return to user mode */ | |
| 148 NU_USER_MODE(); | |
| 149 | |
| 150 return(completion); | |
| 151 } | |
| 152 | |
| 153 | |
| 154 | |
| 155 |
