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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//=============================================================================
2
//
3
//      ser16c550c.c
4
//
5
//      Simple driver for the 16c550c serial controllers on the Malta board
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):   dmoseley
43
// Contributors:dmoseley, jskov
44
// Date:        2001-03-20
45
// Description: Simple driver for the 16c550c serial controller
46
//
47
//####DESCRIPTIONEND####
48
//
49
//=============================================================================
50
 
51
#include <pkgconf/hal.h>
52
#include <pkgconf/system.h>
53
#include CYGBLD_HAL_PLATFORM_H
54
 
55
#include <cyg/hal/hal_arch.h>           // SAVE/RESTORE GP macros
56
#include <cyg/hal/hal_io.h>             // IO macros
57
#include <cyg/hal/hal_if.h>             // interface API
58
#include <cyg/hal/hal_intr.h>           // HAL_ENABLE/MASK/UNMASK_INTERRUPTS
59
#include <cyg/hal/hal_misc.h>           // Helper functions
60
#include <cyg/hal/drv_api.h>            // CYG_ISR_HANDLED
61
 
62
//-----------------------------------------------------------------------------
63
// Define the serial registers. The Malta board is equipped with a 16550C
64
// serial chip.
65
#define MALTA_SER_CLOCK           1843200
66
#define MALTA_SER_16550_BASE_A    0xb80003f8
67
#define MALTA_SER_16550_BASE_B    0xb80002f8
68
#define SER_16550_RBR 0x00   // receiver buffer register, read, dlab = 0
69
#define SER_16550_THR 0x00   // transmitter holding register, write, dlab = 0
70
#define SER_16550_DLL 0x00   // divisor latch (LS), read/write, dlab = 1
71
#define SER_16550_IER 0x01   // interrupt enable register, read/write, dlab = 0
72
#define SER_16550_DLM 0x01   // divisor latch (MS), read/write, dlab = 1
73
#define SER_16550_IIR 0x02   // interrupt identification reg, read, dlab = 0
74
#define SER_16550_FCR 0x02   // fifo control register, write, dlab = 0
75
#define SER_16550_AFR 0x02   // alternate function reg, read/write, dlab = 1
76
#define SER_16550_LCR 0x03   // line control register, read/write
77
#define SER_16550_MCR 0x04   // modem control register, read/write
78
#define SER_16550_LSR 0x05   // line status register, read
79
#define SER_16550_MSR 0x06   // modem status register, read
80
#define SER_16550_SCR 0x07   // scratch pad register
81
 
82
// The interrupt enable register bits.
83
#define SIO_IER_ERDAI   0x01            // enable received data available irq
84
#define SIO_IER_ETHREI  0x02            // enable THR empty interrupt
85
#define SIO_IER_ELSI    0x04            // enable receiver line status irq
86
#define SIO_IER_EMSI    0x08            // enable modem status interrupt
87
 
88
// The interrupt identification register bits.
89
#define SIO_IIR_IP      0x01            // 0 if interrupt pending
90
#define SIO_IIR_ID_MASK 0x0e            // mask for interrupt ID bits
91
 
92
// The line status register bits.
93
#define SIO_LSR_DR      0x01            // data ready
94
#define SIO_LSR_OE      0x02            // overrun error
95
#define SIO_LSR_PE      0x04            // parity error
96
#define SIO_LSR_FE      0x08            // framing error
97
#define SIO_LSR_BI      0x10            // break interrupt
98
#define SIO_LSR_THRE    0x20            // transmitter holding register empty
99
#define SIO_LSR_TEMT    0x40            // transmitter register empty
100
#define SIO_LSR_ERR     0x80            // any error condition
101
 
102
// The modem status register bits.
103
#define SIO_MSR_DCTS  0x01              // delta clear to send
104
#define SIO_MSR_DDSR  0x02              // delta data set ready
105
#define SIO_MSR_TERI  0x04              // trailing edge ring indicator
106
#define SIO_MSR_DDCD  0x08              // delta data carrier detect
107
#define SIO_MSR_CTS   0x10              // clear to send
108
#define SIO_MSR_DSR   0x20              // data set ready
109
#define SIO_MSR_RI    0x40              // ring indicator
110
#define SIO_MSR_DCD   0x80              // data carrier detect
111
 
112
// The line control register bits.
113
#define SIO_LCR_WLS0   0x01             // word length select bit 0
114
#define SIO_LCR_WLS1   0x02             // word length select bit 1
115
#define SIO_LCR_STB    0x04             // number of stop bits
116
#define SIO_LCR_PEN    0x08             // parity enable
117
#define SIO_LCR_EPS    0x10             // even parity select
118
#define SIO_LCR_SP     0x20             // stick parity
119
#define SIO_LCR_SB     0x40             // set break
120
#define SIO_LCR_DLAB   0x80             // divisor latch access bit
121
 
122
// The FIFO control register
123
#define SIO_FCR_FCR0   0x01             // enable xmit and rcvr fifos
124
#define SIO_FCR_FCR1   0x02             // clear RCVR FIFO
125
#define SIO_FCR_FCR2   0x04             // clear XMIT FIFO
126
 
127
/////////////////////////////////////////
128
// Interrupt Enable Register
129
#define IER_RCV 0x01
130
#define IER_XMT 0x02
131
#define IER_LS  0x04
132
#define IER_MS  0x08
133
 
134
// Line Control Register
135
#define LCR_WL5 0x00    // Word length
136
#define LCR_WL6 0x01
137
#define LCR_WL7 0x02
138
#define LCR_WL8 0x03
139
#define LCR_SB1 0x00    // Number of stop bits
140
#define LCR_SB1_5 0x04  // 1.5 -> only valid with 5 bit words
141
#define LCR_SB2 0x04
142
#define LCR_PN  0x00    // Parity mode - none
143
#define LCR_PE  0x0C    // Parity mode - even
144
#define LCR_PO  0x08    // Parity mode - odd
145
#define LCR_PM  0x28    // Forced "mark" parity
146
#define LCR_PS  0x38    // Forced "space" parity
147
#define LCR_DL  0x80    // Enable baud rate latch
148
 
149
// Line Status Register
150
#define LSR_RSR 0x01
151
#define LSR_THE 0x20
152
 
153
// Modem Control Register
154
#define MCR_DTR 0x01
155
#define MCR_RTS 0x02
156
#define MCR_INT 0x08   // Enable interrupts
157
#define MCR_AFE 0x20
158
 
159
// Interrupt status register
160
#define ISR_None             0x01
161
#define ISR_Rx_Line_Status   0x06
162
#define ISR_Rx_Avail         0x04
163
#define ISR_Rx_Char_Timeout  0x0C
164
#define ISR_Tx_Empty         0x02
165
#define IRS_Modem_Status     0x00
166
 
167
// FIFO control register
168
#define FCR_ENABLE     0x01
169
#define FCR_CLEAR_RCVR 0x02
170
#define FCR_CLEAR_XMIT 0x04
171
 
172
#define CYG_DEV_SERIAL_BAUD_DIVISOR (MALTA_SER_CLOCK/16/CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD)
173
 
174
//-----------------------------------------------------------------------------
175
typedef struct {
176
    cyg_uint8* base;
177
    cyg_int32 msec_timeout;
178
    int isr_vector;
179
} channel_data_t;
180
 
181
static channel_data_t channels[2] = {
182
    { (cyg_uint8*)MALTA_SER_16550_BASE_A, 1000, CYGNUM_HAL_INTERRUPT_TTY0},
183
    { (cyg_uint8*)MALTA_SER_16550_BASE_B, 1000, CYGNUM_HAL_INTERRUPT_TTY1}
184
};
185
 
186
//-----------------------------------------------------------------------------
187
// Set the baud rate
188
 
189
static void
190
cyg_hal_plf_serial_set_baud(cyg_uint8* port, cyg_uint16 baud_divisor)
191
{
192
    cyg_uint8 _lcr;
193
 
194
    HAL_READ_UINT8(port+SER_16550_LCR, _lcr);
195
    _lcr |= LCR_DL;
196
    HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr);
197
 
198
    HAL_WRITE_UINT8(port+SER_16550_DLM, baud_divisor >> 8);
199
    HAL_WRITE_UINT8(port+SER_16550_DLL, baud_divisor & 0xff);
200
 
201
    _lcr &= ~LCR_DL;
202
    HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr);
203
}
204
 
205
//-----------------------------------------------------------------------------
206
// The minimal init, get and put functions. All by polling.
207
 
208
void
209
cyg_hal_plf_serial_init_channel(void* __ch_data)
210
{
211
    cyg_uint8* port;
212
    cyg_uint8 _lcr;
213
 
214
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
215
    // Go ahead and assume it is channels[0].
216
    if (__ch_data == 0)
217
      __ch_data = (void*)&channels[0];
218
 
219
    port = ((channel_data_t*)__ch_data)->base;
220
 
221
    // Disable port interrupts while changing hardware
222
    HAL_WRITE_UINT8(port+SER_16550_IER, 0);
223
 
224
    // Set databits, stopbits and parity.
225
    _lcr = LCR_WL8 | LCR_SB1 | LCR_PN;
226
    HAL_WRITE_UINT8(port+SER_16550_LCR, _lcr);
227
 
228
    // Set baud rate.
229
    cyg_hal_plf_serial_set_baud(port, CYG_DEV_SERIAL_BAUD_DIVISOR);
230
 
231
    // Enable and clear FIFO
232
    HAL_WRITE_UINT8(port+SER_16550_FCR, (FCR_ENABLE | FCR_CLEAR_RCVR | FCR_CLEAR_XMIT));
233
 
234
    // enable RTS to keep host side happy. Also allow interrupts
235
    HAL_WRITE_UINT8( port+SER_16550_MCR, MCR_DTR | MCR_RTS | MCR_INT);
236
 
237
    // Don't allow interrupts.
238
    HAL_WRITE_UINT8(port+SER_16550_IER, 0);
239
}
240
 
241
void
242
cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 __ch)
243
{
244
    cyg_uint8* port;
245
    cyg_uint8 _lsr;
246
 
247
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
248
    // Go ahead and assume it is channels[0].
249
    if (__ch_data == 0)
250
      __ch_data = (void*)&channels[0];
251
 
252
    port = ((channel_data_t*)__ch_data)->base;
253
 
254
    CYGARC_HAL_SAVE_GP();
255
 
256
    do {
257
        HAL_READ_UINT8(port+SER_16550_LSR, _lsr);
258
    } while ((_lsr & SIO_LSR_THRE) == 0);
259
 
260
    // Now, the transmit buffer is empty
261
    HAL_WRITE_UINT8(port+SER_16550_THR, __ch);
262
 
263
    // Hang around until the character has been safely sent.
264
    do {
265
        HAL_READ_UINT8(port+SER_16550_LSR, _lsr);
266
    } while ((_lsr & SIO_LSR_THRE) == 0);
267
 
268
    CYGARC_HAL_RESTORE_GP();
269
}
270
 
271
static cyg_bool
272
cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch)
273
{
274
    cyg_uint8* port;
275
    cyg_uint8 _lsr;
276
 
277
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
278
    // Go ahead and assume it is channels[0].
279
    if (__ch_data == 0)
280
      __ch_data = (void*)&channels[0];
281
 
282
    port = ((channel_data_t*)__ch_data)->base;
283
 
284
    HAL_READ_UINT8(port+SER_16550_LSR, _lsr);
285
    if ((_lsr & SIO_LSR_DR) == 0)
286
        return false;
287
 
288
    HAL_READ_UINT8(port+SER_16550_RBR, *ch);
289
 
290
    return true;
291
}
292
 
293
cyg_uint8
294
cyg_hal_plf_serial_getc(void* __ch_data)
295
{
296
    cyg_uint8 ch;
297
    CYGARC_HAL_SAVE_GP();
298
 
299
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
300
    // Go ahead and assume it is channels[0].
301
    if (__ch_data == 0)
302
      __ch_data = (void*)&channels[0];
303
 
304
    while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch));
305
 
306
    CYGARC_HAL_RESTORE_GP();
307
    return ch;
308
}
309
 
310
static void
311
cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf,
312
                         cyg_uint32 __len)
313
{
314
    CYGARC_HAL_SAVE_GP();
315
 
316
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
317
    // Go ahead and assume it is channels[0].
318
    if (__ch_data == 0)
319
      __ch_data = (void*)&channels[0];
320
 
321
    while(__len-- > 0)
322
        cyg_hal_plf_serial_putc(__ch_data, *__buf++);
323
 
324
    CYGARC_HAL_RESTORE_GP();
325
}
326
 
327
static void
328
cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len)
329
{
330
    CYGARC_HAL_SAVE_GP();
331
 
332
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
333
    // Go ahead and assume it is channels[0].
334
    if (__ch_data == 0)
335
      __ch_data = (void*)&channels[0];
336
 
337
    while(__len-- > 0)
338
        *__buf++ = cyg_hal_plf_serial_getc(__ch_data);
339
 
340
    CYGARC_HAL_RESTORE_GP();
341
}
342
 
343
 
344
cyg_bool
345
cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch)
346
{
347
    int delay_count;
348
    channel_data_t* chan;
349
    cyg_bool res;
350
    CYGARC_HAL_SAVE_GP();
351
 
352
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
353
    // Go ahead and assume it is channels[0].
354
    if (__ch_data == 0)
355
      __ch_data = (void*)&channels[0];
356
 
357
    chan = (channel_data_t*)__ch_data;
358
 
359
    delay_count = chan->msec_timeout * 10; // delay in .1 ms steps
360
 
361
    for(;;) {
362
        res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch);
363
        if (res || 0 == delay_count--)
364
            break;
365
        CYGACC_CALL_IF_DELAY_US(100);
366
    }
367
 
368
    CYGARC_HAL_RESTORE_GP();
369
    return res;
370
}
371
 
372
static int
373
cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...)
374
{
375
    static int irq_state = 0;
376
    channel_data_t* chan;
377
    cyg_uint8 ier;
378
    int ret = 0;
379
    CYGARC_HAL_SAVE_GP();
380
 
381
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
382
    // Go ahead and assume it is channels[0].
383
    if (__ch_data == 0)
384
      __ch_data = (void*)&channels[0];
385
 
386
    chan = (channel_data_t*)__ch_data;
387
 
388
    switch (__func) {
389
    case __COMMCTL_IRQ_ENABLE:
390
        irq_state = 1;
391
 
392
        HAL_READ_UINT8(chan->base + SER_16550_IER, ier);
393
        ier |= SIO_IER_ERDAI;
394
        HAL_WRITE_UINT8(chan->base + SER_16550_IER, ier);
395
 
396
        HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1);
397
        HAL_INTERRUPT_UNMASK(chan->isr_vector);
398
        break;
399
    case __COMMCTL_IRQ_DISABLE:
400
        ret = irq_state;
401
        irq_state = 0;
402
 
403
        HAL_READ_UINT8(chan->base + SER_16550_IER, ier);
404
        ier &= ~SIO_IER_ERDAI;
405
        HAL_WRITE_UINT8(chan->base + SER_16550_IER, ier);
406
 
407
        HAL_INTERRUPT_MASK(chan->isr_vector);
408
        break;
409
    case __COMMCTL_DBG_ISR_VECTOR:
410
        ret = chan->isr_vector;
411
        break;
412
    case __COMMCTL_SET_TIMEOUT:
413
    {
414
        va_list ap;
415
 
416
        va_start(ap, __func);
417
 
418
        ret = chan->msec_timeout;
419
        chan->msec_timeout = va_arg(ap, cyg_uint32);
420
 
421
        va_end(ap);
422
    }
423
    break;
424
    case __COMMCTL_SETBAUD:
425
    {
426
        cyg_uint32 baud_rate;
427
        cyg_uint16 baud_divisor;
428
        cyg_uint8* port = chan->base;
429
        va_list ap;
430
 
431
        va_start(ap, __func);
432
        baud_rate = va_arg(ap, cyg_uint32);
433
        va_end(ap);
434
 
435
        baud_divisor = (MALTA_SER_CLOCK / 16 / baud_rate);
436
 
437
        HAL_WRITE_UINT32(HAL_MALTA_BRKRES, 0);
438
#if 0
439
        //
440
        // We may need to increase the timeout before causing a break reset.
441
        // According to the Malta Users Manual (Document MD00005) The BRKRES
442
        // register will need to be programmed with a value larger that 0xA (the default)
443
        // if we are going to use a baud rate lower than 2400.
444
        //
445
        if (baud_rate <= 2400)
446
        {
447
            // For now, just disable the break reset entirely.
448
            HAL_WRITE_UINT32(HAL_MALTA_BRKRES, 0);
449
        } else {
450
            // Put the break reset state back to the default
451
            HAL_WRITE_UINT32(HAL_MALTA_BRKRES, HAL_MALTA_BRKRES_DEFAULT_VALUE);
452
        }
453
#endif
454
        // Disable port interrupts while changing hardware
455
        HAL_READ_UINT8(port+SER_16550_IER, ier);
456
        HAL_WRITE_UINT8(port+SER_16550_IER, 0);
457
 
458
        // Set baud rate.
459
        cyg_hal_plf_serial_set_baud(port, baud_divisor);
460
 
461
        // Reenable interrupts if necessary
462
        HAL_WRITE_UINT8(port+SER_16550_IER, ier);
463
    }
464
    break;
465
 
466
    case __COMMCTL_GETBAUD:
467
        break;
468
    default:
469
        break;
470
    }
471
    CYGARC_HAL_RESTORE_GP();
472
    return ret;
473
}
474
 
475
static int
476
cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc,
477
                       CYG_ADDRWORD __vector, CYG_ADDRWORD __data)
478
{
479
    int res = 0;
480
    cyg_uint8 _iir, c;
481
    channel_data_t* chan;
482
    CYGARC_HAL_SAVE_GP();
483
 
484
    // Some of the diagnostic print code calls through here with no idea what the ch_data is.
485
    // Go ahead and assume it is channels[0].
486
    if (__ch_data == 0)
487
      __ch_data = (void*)&channels[0];
488
 
489
    chan = (channel_data_t*)__ch_data;
490
 
491
    HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector);
492
 
493
    HAL_READ_UINT8(chan->base + SER_16550_IIR, _iir);
494
    _iir &= SIO_IIR_ID_MASK;
495
 
496
    *__ctrlc = 0;
497
    if ((_iir == ISR_Rx_Avail) || (_iir == ISR_Rx_Char_Timeout)) {
498
 
499
        HAL_READ_UINT8(chan->base + SER_16550_RBR, c);
500
 
501
        if( cyg_hal_is_break( &c , 1 ) )
502
            *__ctrlc = 1;
503
 
504
        res = CYG_ISR_HANDLED;
505
    }
506
 
507
    CYGARC_HAL_RESTORE_GP();
508
    return res;
509
}
510
 
511
static void
512
cyg_hal_plf_serial_init(void)
513
{
514
    hal_virtual_comm_table_t* comm;
515
    int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
516
 
517
    // Disable interrupts.
518
    HAL_INTERRUPT_MASK(channels[0].isr_vector);
519
    HAL_INTERRUPT_MASK(channels[1].isr_vector);
520
 
521
    // Init channels
522
    cyg_hal_plf_serial_init_channel((void*)&channels[0]);
523
    cyg_hal_plf_serial_init_channel((void*)&channels[1]);
524
 
525
    // Setup procs in the vector table
526
 
527
    // Set channel 0
528
    CYGACC_CALL_IF_SET_CONSOLE_COMM(0);
529
    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
530
    CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]);
531
    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
532
    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
533
    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
534
    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
535
    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
536
    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
537
    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
538
 
539
    // Set channel 1
540
    CYGACC_CALL_IF_SET_CONSOLE_COMM(1);
541
    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
542
    CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]);
543
    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
544
    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
545
    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
546
    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
547
    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
548
    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
549
    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
550
 
551
    // Restore original console
552
    CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
553
}
554
 
555
void
556
cyg_hal_plf_comms_init(void)
557
{
558
    static int initialized = 0;
559
 
560
    if (initialized)
561
        return;
562
 
563
    initialized = 1;
564
 
565
    cyg_hal_plf_serial_init();
566
}
567
 
568
//-----------------------------------------------------------------------------
569
// end of ser16c550c.c
570
 

powered by: WebSVN 2.1.0

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