Last change
on this file since 30 was
1,
checked in by buchmann, 17 years ago
|
Initial import from CVS repository
|
File size:
1.1 KB
|
Line | |
---|
1 | int waitInt; |
---|
2 | char s[10]; |
---|
3 | |
---|
4 | void itoa(int v,char *s) |
---|
5 | { |
---|
6 | int i; |
---|
7 | int t=10000000; |
---|
8 | int ratio,c; |
---|
9 | int cpt=0; |
---|
10 | int b=1; |
---|
11 | |
---|
12 | for (i=0;i<8;i++) |
---|
13 | s[i]=0; |
---|
14 | |
---|
15 | while (t>0) |
---|
16 | { |
---|
17 | ratio=v/t; |
---|
18 | s[cpt++]=(char)ratio+'0'; |
---|
19 | v=v-ratio*t; |
---|
20 | t=t/10; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | void |
---|
25 | test (int i) |
---|
26 | { |
---|
27 | char s[2]; |
---|
28 | s[0] = procnum () + '0'; |
---|
29 | s[1] = '\0'; |
---|
30 | uputs (s,i); |
---|
31 | } |
---|
32 | |
---|
33 | void |
---|
34 | configure_timer (int proc) |
---|
35 | { |
---|
36 | int *timer=(int*)0xB0000000; |
---|
37 | enum{ // REGISTER OFFSET |
---|
38 | VALUE_ADDRESS = 0, |
---|
39 | MODE_ADDRESS = 1, |
---|
40 | PERIOD_ADDRESS = 2, |
---|
41 | RESETIRQ_ADDRESS = 3 |
---|
42 | }; |
---|
43 | // specific CPU MASK |
---|
44 | int CPU = proc << 2; |
---|
45 | // set timer |
---|
46 | timer[PERIOD_ADDRESS | CPU] = 0x00001000; // lancement du timer |
---|
47 | timer[MODE_ADDRESS | CPU ] = 0x00000003; |
---|
48 | // run timer |
---|
49 | } |
---|
50 | |
---|
51 | int main0(void) |
---|
52 | { |
---|
53 | uputs("Hello from processor 0",procnum()); |
---|
54 | configure_timer (0); |
---|
55 | while (1) ; |
---|
56 | } |
---|
57 | |
---|
58 | int main1(void) |
---|
59 | { |
---|
60 | uputs("Hello from processor 1",procnum()); |
---|
61 | configure_timer (1); |
---|
62 | while (1); |
---|
63 | return 0; |
---|
64 | } |
---|
65 | |
---|
66 | int main2(void) |
---|
67 | { |
---|
68 | uputs("Hello from processor 2",procnum()); |
---|
69 | configure_timer (2); |
---|
70 | while (1); |
---|
71 | return 0; |
---|
72 | } |
---|
73 | |
---|
74 | int main3(void) |
---|
75 | { |
---|
76 | uputs("Hello from processor 3",procnum()); |
---|
77 | configure_timer (3); |
---|
78 | while (1); |
---|
79 | return 0; |
---|
80 | } |
---|
81 | |
---|
Note: See
TracBrowser
for help on using the repository browser.