Changeset fe6ef776 in rtems for c/src/lib/libbsp/i386
- Timestamp:
- 10/15/96 21:39:27 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 9e406d9
- Parents:
- 6c58b6f
- Location:
- c/src/lib/libbsp/i386/i386ex
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/i386ex/include/bsp.h
r6c58b6f rfe6ef776 22 22 #include <rtems.h> 23 23 #include <iosupp.h> 24 #include <console.h> 25 #include <clockdrv.h> 24 26 25 27 /* … … 89 91 #define Is_rx_ready( _status ) ( (_status) & 0x01 ) 90 92 91 /* Timer constants: WE DON'T use THESE */92 93 #define IERA 0x106 /* Interrupt Enable Register A */94 #define IMRA 0x112 /* Interrupt Mask Register A */95 #define TACR 0x118 /* Timer A Control Register */96 #define TADR 0x11e /* Timer A Data Register */97 98 #define IERB 0x108 /* Interrupt Enable Register B */99 #define TBCR 0x11a /* Timer B Control Register */100 #define TBDR 0x120 /* Timer B Data Register */101 102 93 /* Structures */ 103 94 -
c/src/lib/libbsp/i386/i386ex/startup/bspstart.c
r6c58b6f rfe6ef776 21 21 */ 22 22 23 #include <rtems.h>24 23 #include <bsp.h> 24 #include <rtems/libio.h> 25 25 26 #include <libcsupport.h> 26 27 #include <stackchk.h> 28 29 #include <stdio.h> 27 28 #include <fcntl.h> 29 30 #ifdef PRINTON 31 extern char inbyte(void); 30 32 extern void outbyte(char); 33 #endif 31 34 32 35 /* … … 40 43 rtems_cpu_table Cpu_table; 41 44 45 char *rtems_progname; 46 42 47 /* Initialize whatever libc we are using 43 48 * called from postdriver hook 44 49 */ 45 50 46 51 void bsp_libc_init() 47 52 { 48 53 extern int end; 49 54 rtems_unsigned32 heap_start; 50 55 51 56 heap_start = (rtems_unsigned32) &end; 52 57 if (heap_start & (CPU_ALIGNMENT-1)) 53 58 heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); 54 59 55 60 RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0); 56 61 62 /* 63 * Init the RTEMS libio facility to provide UNIX-like system 64 * calls for use by newlib (ie: provide __open, __close, etc) 65 * Uses malloc() to get area for the iops, so must be after malloc init 66 */ 67 68 rtems_libio_init(); 69 57 70 /* 58 71 * Set up for the libc handling. 59 72 */ 60 73 61 74 if (BSP_Configuration.ticks_per_timeslice > 0) 62 75 libc_init(1); /* reentrant if possible */ 63 76 else 64 77 libc_init(0); /* non-reentrant */ 65 78 } 79 80 /* 81 * Function: bsp_pretasking_hook 82 * Created: 95/03/10 83 * 84 * Description: 85 * BSP pretasking hook. Called just before drivers are initialized. 86 * Used to setup libc and install any BSP extensions. 87 * 88 * NOTES: 89 * Must not use libc (to do io) from here, since drivers are 90 * not yet initialized. 91 * 92 */ 93 94 void 95 bsp_pretasking_hook(void) 96 { 97 bsp_libc_init(); 98 99 #ifdef STACK_CHECKER_ON 66 100 /* 67 101 * Initialize the stack bounds checker 102 * We can either turn it on here or from the app. 68 103 */ 69 70 #ifdef STACK_CHECKER_ON 104 71 105 Stack_check_Initialize(); 72 106 #endif 73 74 } 75 extern char inbyte(void); 76 extern void outbyte(char); 77 78 int bsp_start( 107 108 #ifdef RTEMS_DEBUG 109 rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); 110 #endif 111 } 112 113 114 /* 115 * After drivers are setup, register some "filenames" 116 * and open stdin, stdout, stderr files 117 * 118 * Newlib will automatically associate the files with these 119 * (it hardcodes the numbers) 120 */ 121 122 void 123 bsp_postdriver_hook(void) 124 { 125 int stdin_fd, stdout_fd, stderr_fd; 126 int error_code; 127 128 error_code = 'S' << 24 | 'T' << 16; 129 130 if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1) 131 rtems_fatal_error_occurred( error_code | 'D' << 8 | '0' ); 132 133 if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1) 134 rtems_fatal_error_occurred( error_code | 'D' << 8 | '1' ); 135 136 if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1) 137 rtems_fatal_error_occurred( error_code | 'D' << 8 | '2' ); 138 139 if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) 140 rtems_fatal_error_occurred( error_code | 'I' << 8 | 'O' ); 141 } 142 143 144 int main( 79 145 int argc, 80 146 char **argv, … … 82 148 ) 83 149 { 150 84 151 #ifdef PRINTON 85 86 152 outbyte('a'); 87 153 outbyte('b'); 88 154 outbyte('c'); 89 155 outbyte ('S'); 90 91 #endif 156 #endif 157 158 if ((argc > 0) && argv && argv[0]) 159 rtems_progname = argv[0]; 160 else 161 rtems_progname = "RTEMS"; 92 162 93 163 /* … … 95 165 */ 96 166 97 Cpu_table.pretasking_hook = NULL;98 99 Cpu_table.predriver_hook = bsp_libc_init; /* RTEMS resources available */100 101 Cpu_table.postdriver_hook = NULL; /* Call our main() for constructors */102 167 Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ 168 169 Cpu_table.predriver_hook = NULL; 170 171 Cpu_table.postdriver_hook = bsp_postdriver_hook; 172 103 173 Cpu_table.idle_task = NULL; /* do not override system IDLE task */ 104 174 105 175 Cpu_table.do_zero_of_workspace = TRUE; 106 176 107 177 Cpu_table.interrupt_table_segment = get_ds(); 108 178 109 179 Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table; 110 180 111 181 Cpu_table.interrupt_stack_size = 4096; 112 113 Cpu_table.extra_ system_initialization_stack = 0;182 183 Cpu_table.extra_mpci_receive_server_stack = 0; 114 184 115 185 /* … … 122 192 RAM_END - BSP_Configuration.work_space_size; 123 193 124 125 194 126 195 #ifdef SPRINTON … … 136 205 */ 137 206 138 BSP_Configuration. maximum_regions++;207 BSP_Configuration.RTEMS_api_configuration->maximum_regions++; 139 208 140 209 /* … … 156 225 rtems_initialize_executive( &BSP_Configuration, &Cpu_table ); 157 226 /* does not return */ 158 /* no cleanup necessary for Force CPU-386*/227 /* no cleanup necessary for i386ex */ 159 228 for (;;); /* was return 0 to go to the debug monitor */ 160 229 }
Note: See TracChangeset
for help on using the changeset viewer.