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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [powerpc/] [ts6/] [current/] [src/] [hal_aux.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//=============================================================================
2
//
3
//      hal_aux.c
4
//
5
//      HAL auxiliary objects and code; per platform
6
//
7
//=============================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//=============================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):   pfine
43
// Contributors:hmt
44
// Date:        2002-02-27
45
// Purpose:     HAL aux objects: startup tables.
46
// Description: Tables for per-platform initialization
47
//
48
//####DESCRIPTIONEND####
49
//
50
//=============================================================================
51
 
52
#include <pkgconf/hal.h>
53
#include <cyg/hal/hal_mem.h>            // HAL memory definitions
54
#include <cyg/infra/cyg_type.h>
55
#include <cyg/hal/hal_if.h>             // hal_if_init
56
#include <cyg/hal/hal_io.h>             // hal_if_init
57
#include <cyg/hal/hal_misc.h>           // cyg_hal_is_break
58
 
59
#include <cyg/hal/drv_api.h>            // CYG_ISR_HANDLED
60
#include <cyg/hal/hal_diag.h>
61
#include <cyg/hal/ppc_regs.h>
62
#include <cyg/hal/hal_intr.h>
63
#include <cyg/hal/mpc8260.h>            // Needed for IMMR structure
64
 
65
#ifdef CYG_HAL_STARTUP_ROM
66
#ifdef CYGPKG_REDBOOT
67
#include <pkgconf/redboot.h>
68
#include <redboot.h>
69
// Exported CLI function
70
RedBoot_cmd("sdram_test",
71
            "test the sdram",
72
            "",
73
            do_sdram_test
74
    );
75
 
76
void
77
do_sdram_test(int argc, char *argv[])
78
{
79
    unsigned long oldints;
80
 
81
    diag_printf("Starting test for SDRAM.\n");
82
    diag_printf("D18 will indicate PASS/FAIL (Green/Red).\n");
83
    diag_printf("Resetting board will be necessary after test completion.\n");
84
    HAL_DISABLE_INTERRUPTS(oldints);
85
    memory_test();
86
}
87
#endif
88
#endif
89
// For Baud Rate Calculation, see MPC8260 PowerQUICC II User's Manual
90
// 16.3 UART Baud Rate Examples, page 16-5.
91
#define UART_BIT_RATE(n) \
92
    (((int)(CYGHWR_HAL_POWERPC_BOARD_SPEED*1000000))/(n * 64))
93
#define UART_BAUD_RATE CYGNUM_HAL_TS6_DIAG_BAUD
94
 
95
// The memory map is weakly defined, allowing the application to redefine
96
// it if necessary. The regions defined below are the minimum requirements.
97
CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = {
98
    // Mapping for the Motorola MPC8260 development board
99
    CYGARC_MEMDESC_CACHE( 0x00000000, 0x04000000 ), // Main memory 60x SDRAM
100
    // Mapping for the FPGA and the MPC8260 Internal memory
101
    CYGARC_MEMDESC_NOCACHE( 0x04500000, 0x00400000 ),
102
    // Mapping for the Cluster Bus
103
    CYGARC_MEMDESC_NOCACHE( 0xE0000000, 0x10000000 ),
104
    // Mapping for the FLASH
105
    CYGARC_MEMDESC_NOCACHE( 0xff800000, 0x00800000 ), // ROM region
106
 
107
    CYGARC_MEMDESC_TABLE_END
108
};
109
 
110
 
111
/***********************/
112
/* Global Declarations */
113
/***********************/
114
//#define USE_SMC1
115
 
116
volatile t_PQ2IMM  *IMM;   /* IMM base pointer */
117
 
118
//--------------------------------------------------------------------------
119
// Platform init code.
120
void
121
hal_platform_init(void)
122
{
123
 
124
// Ports and Pins assigned for General Purpose I/O
125
// PORT  PIN(s) DIR (I/O)   Name      Init Value Comment
126
//-------------------------------------------------------------------
127
//  A    30-31     TBD                    TBD    Wires to RF Board
128
//  A      29       O     TS_RESET_L       0     Tiger Sharc Reset 
129
//  A      28       O     LP_ENB_L         1     Link Port Buffer Enable
130
//  A    26-27     TBD                    TBD    Wires to RF Board
131
//  A    18-23     TBD                    TBD    Wires to each Tiger Sharc
132
//  A    12-17      O     xxxxxxxxxx       0     Tiger Sharc Interrupt
133
//  B     4-7       O     xxxxxxxxxx      TBD    User controlled LEDs
134
//  C      8        I     xxxxxxxxxx      xxx    RF Board Interrupt
135
//  C      6        I     xxxxxxxxxx      xxx    FPGA Interrupt
136
//  C     0-5       I     xxxxxxxxxx      xxx    TSn Interrupt
137
//  D      20       ?     PPC_WAIT        TBD    Open Drain == High Z
138
//  D     7-9       O     CIMP 0-2        110    TS Impedance ctrl
139
//  D     4-6       O     DS 0-2          100    TS Drive Strength
140
 
141
 
142
// Ports and Pins assigned for Dedicated Pin Assignment
143
// PORT  PIN(s) DIR (I/O)   Name      Init Value Comment
144
//-------------------------------------------------------------------
145
//  D    16-19      x                     TBD    SPI to RF Board
146
//  D    14-15      x                     TBD    I2C
147
 
148
 
149
 
150
#define TS6_PPARA_INIT_MASK 0xFFF00000
151
#define TS6_PDIRA_INIT_MASK 0x3003F000
152
#define TS6_PDATA_INIT_MASK 0x1003F000
153
    IMM =  (t_PQ2IMM *)0x04700000;  /* MPC8260 internal register map  */
154
 
155
   /*-------------------------------------------*/
156
        /* Program the Port Pin Registers */
157
   /*-------------------------------------------*/
158
 
159
    IMM->io_regs[PORT_A].ppar &= 0xFFF00000;  /* Clear bits for GPIO */
160
    IMM->io_regs[PORT_A].pdir |= 0x000FC00C;  /* Set bits on outputs */
161
    IMM->io_regs[PORT_A].pdat |= 0x00000008;  /* Set high outputs bits */
162
    IMM->io_regs[PORT_A].pdat &= 0xFFF03FFB;  /* Clear low output bits */
163
 
164
// Initialize Port B Pins 4,5,6,7 general purpose IO
165
// Pin == 0 ==> LED on
166
// Pin 4 LED 18, Red
167
// Pin 5 LED 18, Green
168
// Pin 6 LED 17, Red
169
// Pin 7 LED 17, Green
170
    IMM->io_regs[PORT_B].ppar &= 0xF0FFFFFF;  /* Clear 4-7 */
171
    IMM->io_regs[PORT_B].pdir |= 0x0F000000;  /* Set  4-7 as outputs */
172
    IMM->io_regs[PORT_B].pdat |= 0x0F000000;  /* Clear LED's */
173
    IMM->io_regs[PORT_B].pdat &= 0xFDFFFFFF;  /* Set LED's 17 to green */
174
 
175
    IMM->io_regs[PORT_C].ppar &= 0x007FFFFF;  /* Clear 0 -8 */
176
    IMM->io_regs[PORT_C].pdir &= 0x007FFFFF;  /* Configure as inputs */
177
    //IMM->io_regs[PORT_C].podr &= 0xFF800000;  /* Configure as inputs */
178
 
179
    IMM->io_regs[PORT_D].ppar &= 0xF03FF7FF;
180
    IMM->io_regs[PORT_D].pdir |= 0x0FC00000;
181
    IMM->io_regs[PORT_D].podr |= 0x00000800;
182
    IMM->io_regs[PORT_D].pdat |= 0x09800000;
183
 
184
#ifdef USE_CPM_SPI_CONTROLLER
185
    // Dedicated Pin assignments for SPI
186
    IMM->io_regs[PORT_D].ppar |= 0x0000F000;
187
    IMM->io_regs[PORT_D].podr &= 0xFFFF0FFF;
188
    IMM->io_regs[PORT_D].pdir |= 0x0000F000;
189
#else
190
    // The ts6 board does not use the SPI controller provided by the CPM,
191
    // instead it is left up to the application to control the SPI.
192
    // Therefore, initialize the SPI specific pins as General Purpose I/O
193
    // and Bi-directional.
194
    IMM->io_regs[PORT_D].ppar &= 0xFFFF0FFF; /* General Purpose I/O */
195
    IMM->io_regs[PORT_D].pdir &= 0xFFFF0FFF; /* input or Bi-directional */
196
#endif
197
 
198
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
199
    hal_if_init();
200
#endif
201
 
202
}
203
// EOF hal_aux.c

powered by: WebSVN 2.1.0

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