OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [uIP_Demo_IAR_ARM7/] [resource/] [SAM7.mac] - Blame information for rev 587

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 583 jeremybenn
// ---------------------------------------------------------
2
//               Microcontroller Software Support  -  ROUSSET  -
3
// ---------------------------------------------------------
4
// The software is delivered "AS IS" without warranty or
5
// condition of any  kind, either express, implied or
6
// statutory. This includes without limitation any warranty
7
// or condition with respect to merchantability or fitness
8
// for any particular purpose, or against the infringements of
9
// intellectual property rights of others.
10
// ---------------------------------------------------------
11
//  File: SAM7.mac
12
//
13
//  1.0 08/Mar/04 JPP    : Creation
14
//  1.1 23/Mar/05 JPP    : Change Variable name
15
//
16
//  $Revision: 2 $
17
//
18
// ---------------------------------------------------------
19
 
20
__var __mac_i;
21
__var __mac_pt;
22
 
23
execUserReset()
24
{
25
   AIC();
26
//*  Watchdog Disable
27
   Watchdog();
28
}
29
 
30
execUserPreload()
31
{
32
//*  Set the RAM memory at 0x0020 0000 for code AT 0 flash area
33
     CheckRemap();
34
//*  Get the Chip ID (AT91C_DBGU_C1R & AT91C_DBGU_C2R
35
    __mac_i =__readMemory32(0xFFFFF240,"Memory");
36
    __message " ---------------------------------------- Chip ID   0x",__mac_i:%X;
37
    __mac_i =__readMemory32(0xFFFFF244,"Memory");
38
    __message " ---------------------------------------- Extention 0x",__mac_i:%X;
39
//* Get the chip status
40
 
41
//* Init AIC
42
   AIC();
43
//*  Watchdog Disable
44
   Watchdog();
45
 
46
}
47
 
48
 
49
//-----------------------------------------------------------------------------
50
// Watchdog
51
//-------------------------------
52
// Normally, the Watchdog is enable at the reset for load it's preferable to
53
// Disable.
54
//-----------------------------------------------------------------------------
55
Watchdog()
56
{
57
//* Watchdog Disable
58
//      AT91C_BASE_WDTC->WDTC_WDMR= AT91C_WDTC_WDDIS;
59
   __writeMemory32(0x00008000,0xFFFFFD44,"Memory");
60
   __message "------------------------------- Watchdog Disable ----------------------------------------";
61
}
62
 
63
 
64
//-----------------------------------------------------------------------------
65
// Check Remap
66
//-------------
67
//-----------------------------------------------------------------------------
68
CheckRemap()
69
{
70
//* Read the value at 0x0
71
    __mac_i =__readMemory32(0x00000000,"Memory");
72
    __mac_i =__mac_i+1;
73
    __writeMemory32(__mac_i,0x00,"Memory");
74
    __mac_pt =__readMemory32(0x00000000,"Memory");
75
 
76
 if (__mac_i == __mac_pt)
77
 {
78
   __message "------------------------------- The Remap is done ----------------------------------------";
79
//*   Toggel RESET The remap
80
    __writeMemory32(0x00000001,0xFFFFFF00,"Memory");
81
 
82
 } else {
83
   __message "------------------------------- The Remap is NOT -----------------------------------------";
84
 }
85
 
86
}
87
 
88
 
89
execUserSetup()
90
{
91
 ini();
92
     __message "-------------------------------Set PC ----------------------------------------";
93
     __writeMemory32(0x00000000,0xB4,"Register");
94
}
95
 
96
//-----------------------------------------------------------------------------
97
// Reset the Interrupt Controller
98
//-------------------------------
99
// Normally, the code is executed only if a reset has been actually performed.
100
// So, the AIC initialization resumes at setting up the default vectors.
101
//-----------------------------------------------------------------------------
102
AIC()
103
{
104
// Mask All interrupt pAic->AIC_IDCR = 0xFFFFFFFF;
105
    __writeMemory32(0xffffffff,0xFFFFF124,"Memory");
106
    __writeMemory32(0xffffffff,0xFFFFF128,"Memory");
107
// disable peripheral clock  Peripheral Clock Disable Register
108
    __writeMemory32(0xffffffff,0xFFFFFC14,"Memory");
109
 
110
// #define AT91C_TC0_SR    ((AT91_REG *)        0xFFFA0020) // (TC0) Status Register
111
// #define AT91C_TC1_SR    ((AT91_REG *)        0xFFFA0060) // (TC1) Status Register
112
// #define AT91C_TC2_SR    ((AT91_REG *)        0xFFFA00A0) // (TC2) Status Register
113
    __readMemory32(0xFFFA0020,"Memory");
114
    __readMemory32(0xFFFA0060,"Memory");
115
    __readMemory32(0xFFFA00A0,"Memory");
116
 
117
    for (__mac_i=0;__mac_i < 8; __mac_i++)
118
    {
119
      // AT91C_BASE_AIC->AIC_EOICR
120
      __mac_pt  =  __readMemory32(0xFFFFF130,"Memory");
121
 
122
    }
123
   __message "------------------------------- AIC 2 INIT ---------------------------------------------";
124
}
125
 
126
ini()
127
{
128
__writeMemory32(0x0,0x00,"Register");
129
__writeMemory32(0x0,0x04,"Register");
130
__writeMemory32(0x0,0x08,"Register");
131
__writeMemory32(0x0,0x0C,"Register");
132
__writeMemory32(0x0,0x10,"Register");
133
__writeMemory32(0x0,0x14,"Register");
134
__writeMemory32(0x0,0x18,"Register");
135
__writeMemory32(0x0,0x1C,"Register");
136
__writeMemory32(0x0,0x20,"Register");
137
__writeMemory32(0x0,0x24,"Register");
138
__writeMemory32(0x0,0x28,"Register");
139
__writeMemory32(0x0,0x2C,"Register");
140
__writeMemory32(0x0,0x30,"Register");
141
__writeMemory32(0x0,0x34,"Register");
142
__writeMemory32(0x0,0x38,"Register");
143
 
144
// Set CPSR
145
__writeMemory32(0x0D3,0x98,"Register");
146
 
147
 
148
}
149
 
150
RG()
151
{
152
 
153
__mac_i =__readMemory32(0x00,"Register");   __message "R00 0x",__mac_i:%X;
154
__mac_i =__readMemory32(0x04,"Register");   __message "R01 0x",__mac_i:%X;
155
__mac_i =__readMemory32(0x08,"Register");   __message "R02 0x",__mac_i:%X;
156
__mac_i =__readMemory32(0x0C,"Register");   __message "R03 0x",__mac_i:%X;
157
__mac_i =__readMemory32(0x10,"Register");   __message "R04 0x",__mac_i:%X;
158
__mac_i =__readMemory32(0x14,"Register");   __message "R05 0x",__mac_i:%X;
159
__mac_i =__readMemory32(0x18,"Register");   __message "R06 0x",__mac_i:%X;
160
__mac_i =__readMemory32(0x1C,"Register");   __message "R07 0x",__mac_i:%X;
161
__mac_i =__readMemory32(0x20,"Register");   __message "R08 0x",__mac_i:%X;
162
__mac_i =__readMemory32(0x24,"Register");   __message "R09 0x",__mac_i:%X;
163
__mac_i =__readMemory32(0x28,"Register");   __message "R10 0x",__mac_i:%X;
164
__mac_i =__readMemory32(0x2C,"Register");   __message "R11 0x",__mac_i:%X;
165
__mac_i =__readMemory32(0x30,"Register");   __message "R12 0x",__mac_i:%X;
166
__mac_i =__readMemory32(0x34,"Register");   __message "R13 0x",__mac_i:%X;
167
__mac_i =__readMemory32(0x38,"Register");   __message "R14 0x",__mac_i:%X;
168
__mac_i =__readMemory32(0x3C,"Register");   __message "R13 SVC 0x",__mac_i:%X;
169
__mac_i =__readMemory32(0x40,"Register");   __message "R14 SVC 0x",__mac_i:%X;
170
__mac_i =__readMemory32(0x44,"Register");   __message "R13 ABT 0x",__mac_i:%X;
171
__mac_i =__readMemory32(0x48,"Register");   __message "R14 ABT 0x",__mac_i:%X;
172
__mac_i =__readMemory32(0x4C,"Register");   __message "R13 UND 0x",__mac_i:%X;
173
__mac_i =__readMemory32(0x50,"Register");   __message "R14 UND 0x",__mac_i:%X;
174
__mac_i =__readMemory32(0x54,"Register");   __message "R13 IRQ 0x",__mac_i:%X;
175
__mac_i =__readMemory32(0x58,"Register");   __message "R14 IRQ 0x",__mac_i:%X;
176
__mac_i =__readMemory32(0x5C,"Register");   __message "R08 FIQ 0x",__mac_i:%X;
177
__mac_i =__readMemory32(0x60,"Register");   __message "R09 FIQ 0x",__mac_i:%X;
178
__mac_i =__readMemory32(0x64,"Register");   __message "R10 FIQ 0x",__mac_i:%X;
179
__mac_i =__readMemory32(0x68,"Register");   __message "R11 FIQ 0x",__mac_i:%X;
180
__mac_i =__readMemory32(0x6C,"Register");   __message "R12 FIQ 0x",__mac_i:%X;
181
__mac_i =__readMemory32(0x70,"Register");   __message "R13 FIQ 0x",__mac_i:%X;
182
__mac_i =__readMemory32(0x74,"Register");   __message "R14 FIQ0x",__mac_i:%X;
183
__mac_i =__readMemory32(0x98,"Register");   __message "CPSR     ",__mac_i:%X;
184
__mac_i =__readMemory32(0x94,"Register");   __message "SPSR     ",__mac_i:%X;
185
__mac_i =__readMemory32(0x9C,"Register");   __message "SPSR ABT ",__mac_i:%X;
186
__mac_i =__readMemory32(0xA0,"Register");   __message "SPSR ABT ",__mac_i:%X;
187
__mac_i =__readMemory32(0xA4,"Register");   __message "SPSR UND ",__mac_i:%X;
188
__mac_i =__readMemory32(0xA8,"Register");   __message "SPSR IRQ ",__mac_i:%X;
189
__mac_i =__readMemory32(0xAC,"Register");   __message "SPSR FIQ ",__mac_i:%X;
190
 
191
__mac_i =__readMemory32(0xB4,"Register");   __message "PC 0x",__mac_i:%X;
192
 
193
}
194
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.