1 | /* |
---|
2 | * This routine starts the application. It includes application, |
---|
3 | * board, and monitor specific initialization and configuration. |
---|
4 | * The generic CPU dependent initialization has been performed |
---|
5 | * before this routine is invoked. |
---|
6 | * |
---|
7 | * Called by RTEMS::RTEMS constructor in startup-ctor.cc |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #include <stdio.h> |
---|
20 | #include <stdlib.h> |
---|
21 | #include <unistd.h> |
---|
22 | |
---|
23 | #include <bsp.h> |
---|
24 | #include <rtems/libcsupport.h> |
---|
25 | |
---|
26 | /* |
---|
27 | * Amount to increment itimer by each pass |
---|
28 | * It is a variable instead of a #define to allow the 'looptest' |
---|
29 | * script to bump it without recompiling rtems |
---|
30 | */ |
---|
31 | |
---|
32 | uint32_t CPU_CLICKS_PER_TICK; |
---|
33 | |
---|
34 | /* |
---|
35 | * bsp_start |
---|
36 | * |
---|
37 | * This routine does the bulk of the system initialization. |
---|
38 | */ |
---|
39 | void bsp_start(void) |
---|
40 | { |
---|
41 | cpu_number = 0; |
---|
42 | |
---|
43 | #if defined(RTEMS_MULTIPROCESSING) |
---|
44 | /* |
---|
45 | * If the node number is -1 then the application better provide |
---|
46 | * it through environment variables RTEMS_NODE. |
---|
47 | * Ditto for RTEMS_MAXIMUM_NODES |
---|
48 | */ |
---|
49 | if (Configuration.User_multiprocessing_table) { |
---|
50 | char *p; |
---|
51 | |
---|
52 | if (Configuration.User_multiprocessing_table->node == -1) { |
---|
53 | p = getenv("RTEMS_NODE"); |
---|
54 | Configuration.User_multiprocessing_table->node = p ? atoi(p) : 1; |
---|
55 | } |
---|
56 | |
---|
57 | /* If needed provide maximum_nodes also */ |
---|
58 | if (Configuration.User_multiprocessing_table->maximum_nodes == -1) { |
---|
59 | p = getenv("RTEMS_MAXIMUM_NODES"); |
---|
60 | Configuration.User_multiprocessing_table->maximum_nodes = p ? atoi(p) : 1; |
---|
61 | } |
---|
62 | } |
---|
63 | |
---|
64 | /* |
---|
65 | * Set cpu_number to accurately reflect our cpu number |
---|
66 | */ |
---|
67 | if (Configuration.User_multiprocessing_table) |
---|
68 | cpu_number = Configuration.User_multiprocessing_table->node - 1; |
---|
69 | #endif |
---|
70 | |
---|
71 | CPU_CLICKS_PER_TICK = 1; |
---|
72 | } |
---|