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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [io/] [serial/] [v2_0/] [src/] [common/] [haldiag.c] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      io/serial/common/haldiag.c
4
//
5
//      Serial I/O interface module using HAL I/O routines
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 Red Hat, 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 version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):   gthomas
44
// Contributors:  gthomas
45
// Date:        1999-02-04
46
// Purpose:     HAL/diag serial driver
47
// Description: 
48
//
49
//####DESCRIPTIONEND####
50
//
51
//==========================================================================
52
 
53
#include <pkgconf/io.h>
54
#include <pkgconf/io_serial.h>
55
#ifdef CYGPKG_IO_SERIAL_HALDIAG
56
#include <cyg/io/io.h>
57
#include <cyg/io/devtab.h>
58
#include <cyg/io/serial.h>
59
#include <cyg/infra/diag.h>
60
#include <cyg/hal/hal_diag.h>
61
 
62
static bool haldiag_init(struct cyg_devtab_entry *tab);
63
static bool haldiag_putc(serial_channel *chan, unsigned char c);
64
static unsigned char haldiag_getc(serial_channel *chan);
65
static Cyg_ErrNo haldiag_set_config(serial_channel *chan, cyg_uint32 key,
66
                                    const void *xbuf, cyg_uint32 *len);
67
 
68
static SERIAL_FUNS(haldiag_funs,
69
                   haldiag_putc,
70
                   haldiag_getc,
71
                   haldiag_set_config,
72
                   0,                      // start xmit - not used
73
 
74
    );
75
 
76
static int _no_data;
77
static SERIAL_CHANNEL(haldiag_channel0,
78
               haldiag_funs,
79
               _no_data,
80
               CYG_SERIAL_BAUD_DEFAULT,
81
               CYG_SERIAL_STOP_DEFAULT,
82
               CYG_SERIAL_PARITY_DEFAULT,
83
               CYG_SERIAL_WORD_LENGTH_DEFAULT,
84
               CYG_SERIAL_FLAGS_DEFAULT
85
    );
86
DEVTAB_ENTRY(haldiag_io0,
87
             "/dev/haldiag",
88
             0,                     // Does not depend on a lower level interface
89
             &cyg_io_serial_devio,
90
             haldiag_init,
91
             0,                     // No initialization/lookup needed
92
             &haldiag_channel0);
93
 
94
static void
95
haldiag_config_port(serial_channel *chan)
96
{
97
}
98
 
99
static bool
100
haldiag_init(struct cyg_devtab_entry *tab)
101
{
102
    serial_channel *chan = (serial_channel *)tab->priv;
103
#ifdef CYGDBG_IO_INIT
104
    diag_printf("HAL/diag SERIAL init\n");
105
#endif
106
    haldiag_config_port(chan);
107
    return true;
108
}
109
 
110
// Return 'true' if character is sent to device
111
static bool
112
haldiag_putc(serial_channel *chan, unsigned char c)
113
{
114
    HAL_DIAG_WRITE_CHAR(c);
115
    return true;
116
}
117
 
118
static unsigned char
119
haldiag_getc(serial_channel *chan)
120
{
121
    unsigned char c;
122
    HAL_DIAG_READ_CHAR(c);
123
    return c;
124
}
125
 
126
static Cyg_ErrNo
127
haldiag_set_config(serial_channel *chan, cyg_uint32 key, const void *xbuf,
128
                   cyg_uint32 *len)
129
{
130
    switch (key) {
131
    case CYG_IO_SET_CONFIG_SERIAL_INFO:
132
        diag_printf("%s\n", __FUNCTION__);
133
        return ENOERR;
134
    default:
135
        return -EINVAL;
136
    }
137
}
138
#endif // CYGPKG_IO_SERIAL_HALDIAG

powered by: WebSVN 2.1.0

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