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