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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM9_AT91SAM9XE_IAR/] [ewp/] [at91sam9xe-ek-flash.mac] - Blame information for rev 613

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

Line No. Rev Author Line
1 577 jeremybenn
// ---------------------------------------------------------
2
//   ATMEL 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: SAM9XE_FLASH.mac
12
//  User setup file for CSPY debugger.
13
//  1.1 08/Aug/06 jpp    : Creation
14
//
15
//  $Revision: 2 $
16
//
17
// ---------------------------------------------------------
18
__var __mac_i;
19
__var __mac_pt;
20
 
21
/*********************************************************************
22
*
23
*       execUserReset() : JTAG set initially to Full Speed
24
*/
25
execUserReset()
26
{
27
    __message "------------------------------ execUserReset ---------------------------------";
28
    __writeMemory32(0x00000500, 0xFFFFFA00, "Memory"); // Set flash wait states
29
    __PllSetting();                        //* Init PLL
30
    __PllSetting100MHz();
31
    __message "-------------------------------Set PC Reset ----------------------------------";
32
}
33
 
34
/*********************************************************************
35
*
36
*       execUserPreload() : JTAG set initially to 32kHz
37
*/
38
execUserPreload()
39
{
40
    __message "------------------------------ execUserPreload ---------------------------------";
41
    __hwReset(0);                          //* Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz)
42
    __writeMemory32(0xD3,0x98,"Register"); //*  Set CPSR
43
    __writeMemory32(0x00000500, 0xFFFFFA00, "Memory"); // Set flash wait states
44
    __PllSetting();                        //* Init PLL
45
    __PllSetting100MHz();
46
    _InitRSTC();                           //* Enable User Reset to allow execUserReset() execution
47
}
48
 
49
 
50
 
51
/*********************************************************************
52
*
53
*       _InitRSTC()
54
*
55
* Function description
56
*   Initializes the RSTC (Reset controller).
57
*   This makes sense since the default is to not allow user resets, which makes it impossible to
58
*   apply a second RESET via J-Link
59
*/
60
_InitRSTC() {
61
    __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory");    // Allow user reset
62
}
63
 
64
 
65
 
66
/*********************************************************************
67
*
68
*       __PllSetting()
69
* Function description
70
*   Initializes the PMC.
71
*   1. Enable the Main Oscillator
72
*   2. Configure PLL
73
*   3. Switch Master
74
*/
75
__PllSetting()
76
{
77
     if ((__readMemory32(0xFFFFFC30,"Memory")&0x3) != 0 ) {
78
//* Disable all PMC interrupt ( $$ JPP)
79
//* AT91C_PMC_IDR   ((AT91_REG *) 0xFFFFFC64) //(PMC) Interrupt Disable Register
80
//*    pPmc->PMC_IDR = 0xFFFFFFFF;
81
    __writeMemory32(0xFFFFFFFF,0xFFFFFC64,"Memory");
82
//* AT91C_PMC_PCDR  ((AT91_REG *) 0xFFFFFC14) //(PMC) Peripheral Clock Disable Register
83
    __writeMemory32(0xFFFFFFFF,0xFFFFFC14,"Memory");
84
// Disable all clock only Processor clock is enabled.
85
    __writeMemory32(0xFFFFFFFE,0xFFFFFC04,"Memory");
86
 
87
// AT91C_PMC_MCKR  ((AT91_REG *)        0xFFFFFC30) // (PMC) Master Clock Register
88
    __writeMemory32(0x00000001,0xFFFFFC30,"Memory");
89
    __sleep(10000);
90
 
91
// write reset value to PLLA and PLLB
92
// AT91C_PMC_PLLAR ((AT91_REG *)        0xFFFFFC28) // (PMC) PLL A Register
93
    __writeMemory32(0x00003F00,0xFFFFFC28,"Memory");
94
 
95
// AT91C_PMC_PLLBR ((AT91_REG *)        0xFFFFFC2C) // (PMC) PLL B Register
96
    __writeMemory32(0x00003F00,0xFFFFFC2C,"Memory");
97
    __sleep(10000);
98
 
99
   __message "------------------------------- PLL  Enable -----------------------------------------";
100
   } else {
101
   __message " ********* Core in SLOW CLOCK mode ********* "; }
102
}
103
 
104
 
105
/*********************************************************************
106
*
107
*       __PllSetting100MHz()
108
* Function description
109
*   Set core at 200 MHz and MCK at 100 MHz
110
*/
111
__PllSetting100MHz()
112
{
113
 
114
   __message "------------------------------- PLL Set at 100 MHz ----------------------------------";
115
 
116
//* pPmc->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x40 <<8) | AT91C_CKGR_MOSCEN ));
117
    __writeMemory32(0x00004001,0xFFFFFC20,"Memory");
118
    __sleep(10000);
119
// AT91C_PMC_MCKR  ((AT91_REG *)        0xFFFFFC30) // (PMC) Master Clock Register
120
    __writeMemory32(0x00000001,0xFFFFFC30,"Memory");
121
    __sleep(10000);
122
//*   AT91C_BASE_CKGR->CKGR_PLLAR = (AT91C_CKGR_SRCA | ((96 << 16) & AT91C_CKGR_MULA) |
123
//    (AT91C_CKGR_PLLACOUNT | (AT91C_CKGR_OUTA_0 | (9);
124
    __writeMemory32(0x2060BF09,0xFFFFFC28,"Memory");
125
    __sleep(10000);
126
//*   AT91C_BASE_PMC->PMC_MCKR =  AT91C_PMC_CSS_PLLA_CLK | AT91C_PMC_PRES_CLK | AT91C_PMC_MDIV_2;;
127
    __writeMemory32(0x00000102,0xFFFFFC30,"Memory");
128
     __sleep(10000);
129
 
130
}
131
 

powered by: WebSVN 2.1.0

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