1 | /*-------------------------------------*/ |
---|
2 | /* sctns.c */ |
---|
3 | /* Last change : 10.10.94 */ |
---|
4 | /*-------------------------------------*/ |
---|
5 | /* |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #include "sctns.h" |
---|
10 | #include "pmc901_memmap.h" |
---|
11 | /*#include "led.h"*/ |
---|
12 | /*-------------------------------------*/ |
---|
13 | |
---|
14 | /* Temporary nullation of WRITE LED */ |
---|
15 | #define WRITE_LED(x) errval = x; |
---|
16 | void ledcyc() |
---|
17 | { |
---|
18 | register int i,t; |
---|
19 | extern unsigned char * led_array; |
---|
20 | register unsigned char * la; |
---|
21 | volatile register int k,m; |
---|
22 | la = led_array; |
---|
23 | i = 1; |
---|
24 | loop: |
---|
25 | if (i > 9 ) |
---|
26 | i = 1; |
---|
27 | *(unsigned char *) LED_REG = la[i]; |
---|
28 | for(t=1; t < 0x10000; t++) |
---|
29 | k = m + 33; |
---|
30 | i++; |
---|
31 | goto loop; |
---|
32 | } |
---|
33 | |
---|
34 | void copyCodeToRom(void) |
---|
35 | { |
---|
36 | register int errval = 0; |
---|
37 | unsigned int * s; |
---|
38 | volatile unsigned int * d; |
---|
39 | unsigned int t, i; |
---|
40 | volatile unsigned char * z; |
---|
41 | extern unsigned char * led_array; |
---|
42 | |
---|
43 | WRITE_LED(0x1); |
---|
44 | d = codeRamStart; |
---|
45 | *d = 0; |
---|
46 | if( *d != 0) |
---|
47 | goto error; |
---|
48 | WRITE_LED(0x2); |
---|
49 | *d = 0xffffffff; |
---|
50 | if( *d != 0xffffffff) |
---|
51 | goto error; |
---|
52 | WRITE_LED(0x3); |
---|
53 | t = 1; |
---|
54 | for( i=0; i < 31; i++){ |
---|
55 | *d = t; |
---|
56 | if(*d != t) |
---|
57 | goto error; |
---|
58 | t <<= 1; |
---|
59 | } |
---|
60 | z = (unsigned char *)codeRamStart; |
---|
61 | *z = 0; |
---|
62 | if( *z != 0) |
---|
63 | goto error; |
---|
64 | *z = 0xf; |
---|
65 | if( *z != 0xf) |
---|
66 | goto error; |
---|
67 | WRITE_LED(0x4); |
---|
68 | for (s = codeRomStart, d = codeRamStart; d < codeRamEnd; s ++, d ++) { |
---|
69 | * d = * s; |
---|
70 | } |
---|
71 | WRITE_LED(0x5); |
---|
72 | for (s = codeRomStart, d = codeRamStart; d < codeRamEnd; s ++, d ++) { |
---|
73 | if( * d != * s ) |
---|
74 | goto error; |
---|
75 | } |
---|
76 | WRITE_LED(0x6); |
---|
77 | return; |
---|
78 | |
---|
79 | error: |
---|
80 | while(1){ |
---|
81 | for(t=1; t < 0x100000; t++) |
---|
82 | *(unsigned char *) LED_REG = errval; |
---|
83 | for(t=1; t < 0x100000; t++) |
---|
84 | *(unsigned char *) LED_REG = led_array[0]; |
---|
85 | } |
---|
86 | |
---|
87 | } |
---|
88 | void zeroBss(void) |
---|
89 | { |
---|
90 | unsigned int * p; |
---|
91 | |
---|
92 | extern unsigned int bssStart_1[], bssEnd_1[]; |
---|
93 | |
---|
94 | for (p = bssStart; p < bssEnd; p ++) { |
---|
95 | * p = 0; |
---|
96 | } |
---|
97 | for (p = bssStart_1; p < bssEnd_1; p ++) { |
---|
98 | * p = 0; |
---|
99 | } |
---|
100 | } |
---|
101 | /*-------------*/ |
---|
102 | /* End of file */ |
---|
103 | /*-------------*/ |
---|