Mercurial > flash_v2
annotate packages/compat/uitron/current/src/uit_func.cxx @ 64:c38311975d4f ecos-sw-2000-01-28
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
| author | jlarmour |
|---|---|
| date | Fri, 28 Jan 2000 04:59:39 +0000 |
| parents | 443894e2e912 |
| children | bf00f99aec69 |
| rev | line source |
|---|---|
| 0 | 1 //=========================================================================== |
| 2 // | |
| 2 | 3 // uit_func.cxx |
| 0 | 4 // |
| 2 | 5 // uITRON compatibility functions |
| 0 | 6 // |
| 7 //=========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
12 // Version 1.0 (the "License"); you may not use this file except in |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
14 // http://sourceware.cygnus.com/ecos |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
15 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
16 // Software distributed under the License is distributed on an |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // |
| 0 | 30 //####COPYRIGHTEND#### |
| 31 //=========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 2 | 34 // Author(s): hmt |
| 35 // Contributors: hmt | |
| 36 // Date: 1998-03-13 | |
| 37 // Purpose: uITRON compatibility functions | |
| 38 // Description: | |
| 0 | 39 // |
| 40 //####DESCRIPTIONEND#### | |
| 41 // | |
| 42 //=========================================================================== | |
| 43 | |
| 44 #include <pkgconf/uitron.h> // uITRON setup CYGNUM_UITRON_SEMAS | |
| 45 // CYGPKG_UITRON et al | |
| 46 | |
| 47 #ifdef CYGPKG_UITRON | |
| 48 | |
| 49 // invoke the inline function definition to create static C linkage | |
| 50 // functions here: | |
| 51 #define CYGPRI_UITRON_FUNCS_HERE_AND_NOW | |
| 52 #include <cyg/compat/uitron/uit_func.h> | |
| 53 | |
| 2 | 54 cyg_uint32 cyg_uitron_dis_dsp_old_priority = 0; |
| 55 | |
| 0 | 56 // ------------------------------------------------------------------------ |
| 57 // STARTUP | |
| 58 // this routine is outside the uITRON specification; call it from | |
| 59 // cyg_start(), cyg_package_start(), cyg_prestart() or cyg_user_start() | |
| 60 // to start the uITRON tasks and scheduler. | |
| 61 | |
| 62 #if CYGNUM_UITRON_START_TASKS < 0 | |
| 63 #error CYGNUM_UITRON_START_TASKS should be >= 0 | |
| 64 #endif | |
| 65 | |
| 66 #if CYGNUM_UITRON_START_TASKS == 0 | |
| 67 #define START_TASKS CYGNUM_UITRON_TASKS | |
| 68 #else | |
| 69 #define START_TASKS CYGNUM_UITRON_START_TASKS | |
| 70 #endif | |
| 71 | |
| 72 #ifdef CYGPKG_UITRON_TASKS_CREATE_DELETE | |
| 73 #if START_TASKS > CYGNUM_UITRON_TASKS_INITIALLY | |
| 74 #undef START_TASKS | |
| 75 #define START_TASKS CYGNUM_UITRON_TASKS_INITIALLY | |
| 76 #endif | |
| 77 #endif | |
| 78 | |
| 79 #if START_TASKS > CYGNUM_UITRON_TASKS | |
| 80 #undef START_TASKS | |
| 81 #define START_TASKS CYGNUM_UITRON_TASKS | |
| 82 #endif | |
| 83 | |
| 84 #if START_TASKS <= 0 | |
| 85 #error Number of uITRON tasks to start initially must be >= 0 | |
| 86 #endif | |
| 87 | |
| 88 | |
| 2 | 89 #define SET_UP_PTRS( _which_ ) CYG_MACRO_START \ |
| 0 | 90 for ( i = 0; \ |
| 91 (i < CYGNUM_UITRON_ ## _which_ ## _INITIALLY) && \ | |
| 92 (i < CYGNUM_UITRON_ ## _which_ ) ; \ | |
| 93 i++ ) { \ | |
| 94 CYG_UITRON_PTRS( _which_ )[ i ] = CYG_UITRON_OBJS( _which_ ) + i; \ | |
| 95 } \ | |
| 2 | 96 if ( (CYGNUM_UITRON_ ## _which_ ## _INITIALLY) \ |
| 97 < (CYGNUM_UITRON_ ## _which_) ) \ | |
| 98 for ( /* i as is */; i < CYGNUM_UITRON_ ## _which_ ; i++ ) { \ | |
| 99 CYG_UITRON_PTRS( _which_ )[ i ] = NULL; \ | |
| 100 } \ | |
| 0 | 101 CYG_MACRO_END |
| 102 | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
103 #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
104 #ifdef CYGSEM_UITRON_TIME_IS_MILLISECONDS |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
105 Cyg_Clock::converter uit_clock_to_system; |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
106 Cyg_Clock::converter uit_clock_from_system; |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
107 #endif |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
108 #endif |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
109 |
| 0 | 110 void cyg_uitron_start( void ) |
| 111 { | |
| 112 cyg_int32 i; | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
113 |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
114 #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
115 #ifdef CYGSEM_UITRON_TIME_IS_MILLISECONDS |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
116 // initialize the clock converters |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
117 Cyg_Clock::real_time_clock-> |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
118 get_other_to_clock_converter( 1000000, &uit_clock_to_system ); |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
119 Cyg_Clock::real_time_clock-> |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
120 get_clock_to_other_converter( 1000000, &uit_clock_from_system ); |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
121 #endif |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
122 #endif |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
123 |
| 0 | 124 for ( i = 0; i < START_TASKS; i++ ) { |
| 125 #ifdef CYGIMP_THREAD_PRIORITY | |
| 126 // save the initial priority in our private array | |
| 127 cyg_uitron_task_initial_priorities[ i ] = | |
| 128 cyg_uitron_TASKS[ i ].get_priority(); | |
| 129 #endif | |
| 130 // and awaken the task: | |
| 131 cyg_uitron_TASKS[ i ].resume(); | |
| 132 } | |
| 133 for ( /* i as is */; i < CYGNUM_UITRON_TASKS; i++ ) { | |
| 134 #ifdef CYGIMP_THREAD_PRIORITY | |
| 135 // save the initial priority in our private array | |
| 136 cyg_uitron_task_initial_priorities[ i ] = | |
| 137 cyg_uitron_TASKS[ i ].get_priority(); | |
| 138 #endif | |
| 139 // but ensure the task state is dormant. | |
| 140 cyg_uitron_TASKS[ i ].kill(); | |
| 141 } | |
| 142 | |
| 143 #ifdef CYGPKG_UITRON_TASKS_CREATE_DELETE | |
| 144 SET_UP_PTRS( TASKS ); | |
| 145 #endif | |
| 146 #ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE | |
| 147 SET_UP_PTRS( SEMAS ); | |
| 148 #endif | |
| 149 #ifdef CYGPKG_UITRON_MBOXES_CREATE_DELETE | |
| 150 SET_UP_PTRS( MBOXES ); | |
| 151 #endif | |
| 152 #ifdef CYGPKG_UITRON_FLAGS_CREATE_DELETE | |
| 153 SET_UP_PTRS( FLAGS ); | |
| 154 #endif | |
| 155 #ifdef CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE | |
| 156 SET_UP_PTRS( MEMPOOLFIXED ); | |
| 157 #endif | |
| 158 #ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE | |
| 159 SET_UP_PTRS( MEMPOOLVAR ); | |
| 160 #endif | |
| 161 } | |
| 162 | |
| 163 // These allow programs to link when cyg_uitron_start() is called | |
| 164 // (often because of CYGSEM_START_UITRON_COMPATIBILITY from infra, | |
| 165 // though we define these regardless just in case) | |
| 166 // even when there is no interest in uITRON and so the tasks are | |
| 167 // not externally defined; the reference to cyg_uitron_start() | |
| 168 // ensures the tasks array et al are still included... | |
| 169 extern "C" { | |
| 170 void task1( unsigned int arg ) CYGBLD_ATTRIB_WEAK; | |
| 171 void task2( unsigned int arg ) CYGBLD_ATTRIB_WEAK; | |
| 172 void task3( unsigned int arg ) CYGBLD_ATTRIB_WEAK; | |
| 173 void task4( unsigned int arg ) CYGBLD_ATTRIB_WEAK; | |
| 174 } | |
| 175 | |
| 176 void task1( unsigned int arg ) {} | |
| 177 void task2( unsigned int arg ) {} | |
| 178 void task3( unsigned int arg ) {} | |
| 179 void task4( unsigned int arg ) {} | |
| 180 | |
| 181 #endif // CYGPKG_UITRON | |
| 182 | |
| 183 // EOF uit_func.cxx |
