1 |
27 |
unneback |
#ifndef CYGONCE_HAL_PLF_Z8530_H
|
2 |
|
|
#define CYGONCE_HAL_PLF_Z8530_H
|
3 |
|
|
|
4 |
|
|
//=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// plf_z8530.h
|
7 |
|
|
//
|
8 |
|
|
// Platform header for Z8530 support.
|
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 Red Hat, 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 version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
//=============================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): nickg
|
47 |
|
|
// Contributors:nickg
|
48 |
|
|
// Date: 1999-05-21
|
49 |
|
|
// Purpose: Platform HAL Z8530 support.
|
50 |
|
|
// Usage: #include <cyg/hal/plf_z8530.h>
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//=============================================================================
|
55 |
|
|
|
56 |
|
|
#include <pkgconf/hal.h>
|
57 |
|
|
|
58 |
|
|
/*---------------------------------------------------------------------------*/
|
59 |
|
|
/* Zilog Z8530 access macros. */
|
60 |
|
|
|
61 |
|
|
#if defined(CYGPKG_HAL_MIPS_LSBFIRST)
|
62 |
|
|
# define DUART_BASE 0xc1000000
|
63 |
|
|
#elif defined(CYGPKG_HAL_MIPS_MSBFIRST)
|
64 |
|
|
# define DUART_BASE 0xc1000003
|
65 |
|
|
#else
|
66 |
|
|
#error MIPS endianness not defined by configuration
|
67 |
|
|
#endif
|
68 |
|
|
|
69 |
|
|
// Address offsets for DUART channels
|
70 |
|
|
#define DUART_A 4
|
71 |
|
|
#define DUART_B 0
|
72 |
|
|
|
73 |
|
|
/* Require Delay between Zilog chip (Z8530 and Z8536) register access */
|
74 |
|
|
|
75 |
|
|
//#define ZDEL 66 /* 66 Instructions for 66Mhz */
|
76 |
|
|
#define ZDEL 200 /* 200 Instructions for 133Mhz */
|
77 |
|
|
|
78 |
|
|
#define DELAY_ZACC\
|
79 |
|
|
{ register int N = ZDEL; while (--N > 0); }
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
#define HAL_DUART_READ_CR( _chan_, _reg_, _val_) \
|
83 |
|
|
CYG_MACRO_START \
|
84 |
|
|
if( (_reg_) != 0 ) \
|
85 |
|
|
{ \
|
86 |
|
|
DELAY_ZACC; \
|
87 |
|
|
HAL_WRITE_UINT8( DUART_BASE+(_chan_), _reg_); \
|
88 |
|
|
} \
|
89 |
|
|
DELAY_ZACC; \
|
90 |
|
|
HAL_READ_UINT8( DUART_BASE+(_chan_), _val_ ); \
|
91 |
|
|
CYG_MACRO_END
|
92 |
|
|
|
93 |
|
|
#define HAL_DUART_WRITE_CR( _chan_, _reg_, _val_ ) \
|
94 |
|
|
CYG_MACRO_START \
|
95 |
|
|
if( (_reg_) != 0 ) \
|
96 |
|
|
{ \
|
97 |
|
|
DELAY_ZACC; \
|
98 |
|
|
HAL_WRITE_UINT8( DUART_BASE+(_chan_), _reg_); \
|
99 |
|
|
} \
|
100 |
|
|
DELAY_ZACC; \
|
101 |
|
|
HAL_WRITE_UINT8( DUART_BASE+(_chan_), _val_ ); \
|
102 |
|
|
CYG_MACRO_END
|
103 |
|
|
|
104 |
|
|
#define HAL_DUART_WRITE_TR( _chan_, _val_ ) \
|
105 |
|
|
CYG_MACRO_START \
|
106 |
|
|
DELAY_ZACC; \
|
107 |
|
|
HAL_WRITE_UINT8( DUART_BASE+(_chan_)+8, _val_ ); \
|
108 |
|
|
CYG_MACRO_END
|
109 |
|
|
|
110 |
|
|
#define HAL_DUART_READ_RR( _chan_, _val_ ) \
|
111 |
|
|
CYG_MACRO_START \
|
112 |
|
|
DELAY_ZACC; \
|
113 |
|
|
HAL_READ_UINT8( DUART_BASE+(_chan_)+8, _val_ ); \
|
114 |
|
|
CYG_MACRO_END
|
115 |
|
|
|
116 |
|
|
//-----------------------------------------------------------------------------
|
117 |
|
|
#endif // CYGONCE_HAL_PLF_Z8530_H
|
118 |
|
|
// End of plf_z8530.h
|