1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_PLATFORM_SETUP_H
|
2 |
|
|
#define CYGONCE_HAL_PLATFORM_SETUP_H
|
3 |
|
|
|
4 |
|
|
/*=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// hal_platform_setup.h
|
7 |
|
|
//
|
8 |
|
|
// Platform specific support for HAL (assembly code)
|
9 |
|
|
//
|
10 |
|
|
//=============================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//=============================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): gthomas
|
46 |
|
|
// Contributors: gthomas
|
47 |
|
|
// Date: 1999-04-13
|
48 |
|
|
// Purpose: GPS4020 platform specific support routines
|
49 |
|
|
// Description:
|
50 |
|
|
// Usage: #include <cyg/hal/hal_platform_setup.h>
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//===========================================================================*/
|
55 |
|
|
|
56 |
|
|
#define CYGSEM_HAL_ROM_RESET_USES_JUMP
|
57 |
|
|
|
58 |
|
|
.equ MPC_BASE_ADDRESS, 0xE0008000
|
59 |
|
|
.equ MPC_AREA1_CONFIG, 0x00000000
|
60 |
|
|
.equ MPC_AREA2_CONFIG, 0x00000004
|
61 |
|
|
.equ MPC_AREA3_CONFIG, 0x00000008
|
62 |
|
|
.equ MPC_AREA4_CONFIG, 0x0000000C
|
63 |
|
|
|
64 |
|
|
.equ GPIO_BASE_ADDRESS, 0xE0005000
|
65 |
|
|
.equ GPIO_DIRECTION_REG_OFFSET,0x00000000
|
66 |
|
|
.equ GPIO_READ_REG_OFFSET, 0x00000004
|
67 |
|
|
.equ GPIO_WRITE_REG_OFFSET, 0x00000008
|
68 |
|
|
|
69 |
|
|
.equ SYSTEM_CONFIG, 0xE0002004
|
70 |
|
|
|
71 |
|
|
.macro gps4020_setup
|
72 |
|
|
|
73 |
|
|
// make GPIO[0..7] outputs - note: GPIO4 is used for Rx on UART1!
|
74 |
|
|
ldr r3,=GPIO_BASE_ADDRESS
|
75 |
|
|
ldr r0, [r3,#GPIO_DIRECTION_REG_OFFSET]
|
76 |
|
|
and r0, r0, #0b00010000 @ 0 = output, 1 = input
|
77 |
|
|
str r0, [r3,#GPIO_DIRECTION_REG_OFFSET]
|
78 |
|
|
mov r0,#0
|
79 |
|
|
str r0,[r3,#GPIO_WRITE_REG_OFFSET]
|
80 |
|
|
|
81 |
|
|
ldr r1,=MPC_BASE_ADDRESS
|
82 |
|
|
ldr r2,=0x4400002D // 0x6xxxxxxx, 16bit R/W RAM
|
83 |
|
|
str r2,[r1,#MPC_AREA1_CONFIG]
|
84 |
|
|
|
85 |
|
|
ldr r1,=MPC_BASE_ADDRESS
|
86 |
|
|
ldr r2,=0x00000069 // 0x2xxxxxxx, 16bit R/W RAM
|
87 |
|
|
str r2,[r1,#MPC_AREA2_CONFIG]
|
88 |
|
|
|
89 |
|
|
ldr r2,[r1,#MPC_AREA3_CONFIG]
|
90 |
|
|
ldr r2,=0x00000021 // 0x4xxxxxxx, 16bit peripheral
|
91 |
|
|
str r2,[r1,#MPC_AREA3_CONFIG]
|
92 |
|
|
|
93 |
|
|
ldr r2,[r1,#MPC_AREA4_CONFIG]
|
94 |
|
|
ldr r2,=0x0000006E // 0x0xxxxxxx, 32bit memory
|
95 |
|
|
str r2,[r1,#MPC_AREA4_CONFIG]
|
96 |
|
|
|
97 |
|
|
ldr r1,=SYSTEM_CONFIG // Swap memory regions 0x0XXXXXXX, 0x6XXXXXXX
|
98 |
|
|
ldr r2,[r1]
|
99 |
|
|
orr r2,r2,#1
|
100 |
|
|
mov r0,#1
|
101 |
|
|
str r0,[r3,#GPIO_WRITE_REG_OFFSET]
|
102 |
|
|
ldr r4,=10f // Change address space
|
103 |
|
|
str r2,[r1]
|
104 |
|
|
|
105 |
|
|
mov pc,r4
|
106 |
|
|
mov pc,r4
|
107 |
|
|
mov pc,r4
|
108 |
|
|
10:
|
109 |
|
|
mov r0,#2
|
110 |
|
|
str r0,[r3,#GPIO_WRITE_REG_OFFSET]
|
111 |
|
|
.endm
|
112 |
|
|
|
113 |
|
|
#ifdef CYG_HAL_STARTUP_ROM
|
114 |
|
|
#define PLATFORM_SETUP1 gps4020_setup
|
115 |
|
|
#else
|
116 |
|
|
#define PLATFORM_SETUP1
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
/*---------------------------------------------------------------------------*/
|
120 |
|
|
/* end of hal_platform_setup.h */
|
121 |
|
|
#endif /* CYGONCE_HAL_PLATFORM_SETUP_H */
|