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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_AT91SAM7S64_IAR/] [resource/] [at91sam7s-ek-flash.mac] - Blame information for rev 620

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
//  DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
5
//  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
6
//  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
7
//  DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
8
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
//  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
10
//  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
11
//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
12
//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
13
//  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
//  ----------------------------------------------------------------------------
15
//  File Name           : SAM7_FLASH.mac
16
//  Object              : Generic Macro File for IAR
17
//  1.0 17/Aug/05 FBr   : Creation
18
//  ----------------------------------------------------------------------------
19
 
20
/*********************************************************************
21
*
22
*       _InitRSTC()
23
*
24
* Function description
25
*   Initializes the RSTC (Reset controller).
26
*   This makes sense since the default is to not allow user resets, which makes it impossible to
27
*   apply a second RESET via J-Link
28
*/
29
_InitRSTC() {
30
    __writeMemory32(0xA5000001, 0xFFFFFD08,"Memory");    // Allow user reset
31
}
32
 
33
/*********************************************************************
34
*
35
*       _InitPLL()
36
* Function description
37
*   Initializes the PMC.
38
*   1. Enable the Main Oscillator
39
*   2. Configure PLL to 96MHz
40
*   3. Switch Master Clock (MCK) on PLL/2 = 48MHz
41
*/
42
_InitPLL() {
43
 
44
    __message "Enable Main Oscillator";
45
    __writeMemory32(0x00000601,0xFFFFFc20,"Memory");    // MOSC
46
    while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x1)  );
47
 
48
    __message "Set PLL to 96MHz";
49
    __writeMemory32(0x10191c05,0xFFFFFc2c,"Memory");    // LOCK
50
    while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x4)  );
51
 
52
    __message "Set Master Clock to 48MHz";
53
    __writeMemory32(0x00000004,0xFFFFFc30,"Memory");    // MCKRDY
54
    while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8)  );
55
    __writeMemory32(0x00000007,0xFFFFFc30,"Memory");    // MCKRDY
56
    while( !(__readMemory32(0xFFFFFc68,"Memory") & 0x8)  );
57
 
58
    // Set 1 WS for Flash accesses on each EFC
59
    __writeMemory32(0x00480100,0xFFFFFF60,"Memory");
60
    __writeMemory32(0x00480100,0xFFFFFF70,"Memory");
61
}
62
 
63
/*********************************************************************
64
*
65
*       execUserReset() : JTAG set initially to Full Speed
66
*/
67
execUserReset() {
68
    __message "execUserReset()";
69
    __hwReset(0);                       // Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz)
70
    _InitPLL();                         // Allow to debug at JTAG Full Speed
71
    _InitRSTC();                        // Enable User Reset to allow execUserReset() execution
72
}
73
 

powered by: WebSVN 2.1.0

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