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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mips/] [malta/] [current/] [src/] [smsc37m81x.c] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//=============================================================================
2
//
3
//      smsc37m81x.c
4
//
5
//      Init code for SMSC 37m81x super IO controller
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):   jskov
43
// Contributors:jskov
44
// Date:        2001-04-02
45
// Description: Init code for SMSC 37m81x super IO controller
46
//
47
//####DESCRIPTIONEND####
48
//
49
//=============================================================================
50
 
51
#include <pkgconf/hal.h>
52
#include CYGBLD_HAL_PLATFORM_H
53
 
54
#include <cyg/hal/hal_arch.h>           // SAVE/RESTORE GP macros
55
#include <cyg/hal/hal_io.h>             // IO macros
56
#include <cyg/hal/hal_intr.h>           // interrupt vectors
57
 
58
 
59
// From page 137+ in SMSC-37m81x.pdf
60
#define SMSC_CONFIG             0xb80003f0
61
#define SMSC_CONFIG_DATA        0xb80003f1
62
 
63
#define SMSC_CONFIG_DEV         0x07
64
#define SMSC_CONFIG_ACTIVATE    0x30
65
#define SMSC_CONFIG_ENTER       0x55
66
#define SMSC_CONFIG_BASE_HIGH   0x60
67
#define SMSC_CONFIG_BASE_LOW    0x61
68
#define SMSC_CONFIG_IRQ         0x70
69
#define SMSC_CONFIG_EXIT        0xaa
70
#define SMSC_CONFIG_MODE        0xf0
71
 
72
#define SMSC_CONFIG_DEV_COM1    0x04
73
#define SMSC_CONFIG_DEV_COM2    0x05
74
 
75
#define SMSC_CONFIG_MODE_HIGH   0x02
76
 
77
#define SMSC_CONFIG_ACTIVATE_ENABLE 0x01
78
 
79
 
80
void
81
cyg_hal_init_superIO(void)
82
{
83
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ENTER);
84
 
85
    // Configure and enable COM1
86
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV);
87
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM1);
88
 
89
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH);
90
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0x03);
91
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW);
92
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8);
93
 
94
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ);
95
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA,
96
                    (CYGNUM_HAL_INTERRUPT_TTY0-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE));
97
 
98
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE);
99
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH);
100
 
101
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE);
102
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE);
103
 
104
    // Configure and enable COM2
105
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_DEV);
106
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_DEV_COM2);
107
 
108
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_HIGH);
109
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0x02);
110
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_BASE_LOW);
111
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, 0xf8);
112
 
113
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_IRQ);
114
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA,
115
                    (CYGNUM_HAL_INTERRUPT_TTY1-CYGNUM_HAL_INTERRUPT_EXTERNAL_BASE));
116
 
117
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_MODE);
118
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_MODE_HIGH);
119
 
120
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_ACTIVATE);
121
    HAL_WRITE_UINT8(SMSC_CONFIG_DATA, SMSC_CONFIG_ACTIVATE_ENABLE);
122
 
123
    HAL_WRITE_UINT8(SMSC_CONFIG, SMSC_CONFIG_EXIT);
124
 
125
}
126
 
127
//-----------------------------------------------------------------------------
128
// end of smsc37m81x.c
129
 

powered by: WebSVN 2.1.0

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