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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [rm7000/] [ocelot/] [v2_0/] [src/] [ns16552.c] - Blame information for rev 329

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//=============================================================================
2
//
3
//      ns16552.c
4
//
5
//      Simple driver for the NS16652 serial 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 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):   nickg, gthomas
44
// Contributors:nickg, gthomas, jskov
45
// Date:        1998-03-02
46
// Description: Simple HAL driver for the NS16552 serial controller
47
// Note:        To drop into a new HAL, you should only have to change the
48
//              few parameters here at the top.
49
//####DESCRIPTIONEND####
50
//
51
//=============================================================================
52
 
53
#include <pkgconf/hal.h>
54
#include <cyg/infra/cyg_type.h>         // base types
55
 
56
#include <cyg/infra/cyg_trac.h>         // tracing macros
57
#include <cyg/infra/cyg_ass.h>          // assertion macros
58
 
59
#include <cyg/hal/hal_arch.h>           // basic machine info
60
#include <cyg/hal/hal_intr.h>           // interrupt macros
61
#include <cyg/hal/hal_io.h>             // IO macros
62
#include <cyg/hal/hal_diag.h>
63
#include <cyg/hal/drv_api.h>
64
#include <cyg/hal/hal_if.h>             // interface API
65
#include <cyg/hal/hal_misc.h>           // Helper functions
66
 
67
//-----------------------------------------------------------------------------
68
// Make changes here
69
#include <pkgconf/hal_mips_rm7000_ocelot.h>  // board specifics
70
 
71
#define NS_SERIAL_A_BASE 0xbd000020
72
#define NS_SERIAL_A_IRQ  CYGNUM_HAL_INTERRUPT_UART1
73
#define NS_SERIAL_B_BASE 0xbd000000
74
#define NS_SERIAL_B_IRQ  CYGNUM_HAL_INTERRUPT_UART2
75
 
76
#define NS_CLOCK 20000000
77
 
78
// Fill in extra code as required
79
#define NS_EXTRA_INIT()                         \
80
    CYG_MACRO_START                             \
81
    CYG_MACRO_END
82
 
83
//-----------------------------------------------------------------------------
84
 
85
 
86
#define CYG_DEVICE_SERIAL_BAUD_MSB (((NS_CLOCK / (16*(CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD))) >> 8) & 0xff)
87
#define CYG_DEVICE_SERIAL_BAUD_LSB  ((NS_CLOCK / (16*(CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD))) & 0xff)
88
 
89
// Define the serial registers.
90
#define CYG_DEV_RBR 0x00   // receiver buffer register, read, dlab = 0
91
#define CYG_DEV_THR 0x00   // transmitter holding register, write, dlab = 0
92
#define CYG_DEV_DLL 0x00   // divisor latch (LS), read/write, dlab = 1
93
#define CYG_DEV_IER 0x04   // interrupt enable register, read/write, dlab = 0
94
#define CYG_DEV_DLM 0x04   // divisor latch (MS), read/write, dlab = 1
95
#define CYG_DEV_IIR 0x08   // interrupt identification register, read, dlab = 0
96
#define CYG_DEV_FCR 0x08   // fifo control register, write, dlab = 0
97
#define CYG_DEV_LCR 0x0C   // line control register, read/write
98
#define CYG_DEV_MCR 0x10   // modem control register, read/write
99
#define CYG_DEV_LSR 0x14   // line status register, read
100
#define CYG_DEV_MSR 0x18   // modem status register, read
101
 
102
// Interrupt Enable Register
103
#define SIO_IER_RCV 0x01
104
#define SIO_IER_XMT 0x02
105
#define SIO_IER_LS  0x04
106
#define SIO_IER_MS  0x08
107
 
108
// The line status register bits.
109
#define SIO_LSR_DR      0x01            // data ready
110
#define SIO_LSR_OE      0x02            // overrun error
111
#define SIO_LSR_PE      0x04            // parity error
112
#define SIO_LSR_FE      0x08            // framing error
113
#define SIO_LSR_BI      0x10            // break interrupt
114
#define SIO_LSR_THRE    0x20            // transmitter holding register empty
115
#define SIO_LSR_TEMT    0x40            // transmitter register empty
116
#define SIO_LSR_ERR     0x80            // any error condition
117
 
118
// The modem status register bits.
119
#define SIO_MSR_DCTS  0x01              // delta clear to send
120
#define SIO_MSR_DDSR  0x02              // delta data set ready
121
#define SIO_MSR_TERI  0x04              // trailing edge ring indicator
122
#define SIO_MSR_DDCD  0x08              // delta data carrier detect
123
#define SIO_MSR_CTS   0x10              // clear to send
124
#define SIO_MSR_DSR   0x20              // data set ready
125
#define SIO_MSR_RI    0x40              // ring indicator
126
#define SIO_MSR_DCD   0x80              // data carrier detect
127
 
128
// The line control register bits.
129
#define SIO_LCR_WLS0   0x01             // word length select bit 0
130
#define SIO_LCR_WLS1   0x02             // word length select bit 1
131
#define SIO_LCR_STB    0x04             // number of stop bits
132
#define SIO_LCR_PEN    0x08             // parity enable
133
#define SIO_LCR_EPS    0x10             // even parity select
134
#define SIO_LCR_SP     0x20             // stick parity
135
#define SIO_LCR_SB     0x40             // set break
136
#define SIO_LCR_DLAB   0x80             // divisor latch access bit
137
 
138
// Modem Control Register
139
#define SIO_MCR_DTR 0x01
140
#define SIO_MCR_RTS 0x02
141
#define SIO_MCR_INT 0x08   // Enable interrupts
142
 
143
//-----------------------------------------------------------------------------
144
typedef struct {
145
    cyg_uint8* base;
146
    cyg_int32 msec_timeout;
147
    int isr_vector;
148
} channel_data_t;
149
 
150
//-----------------------------------------------------------------------------
151
 
152
static void
153
cyg_hal_plf_serial_init_channel(void* __ch_data)
154
{
155
    cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
156
    cyg_uint8 lcr;
157
 
158
    // 8-1-no parity.
159
    HAL_WRITE_UINT8(base+CYG_DEV_LCR, SIO_LCR_WLS0 | SIO_LCR_WLS1);
160
 
161
    HAL_READ_UINT8(base+CYG_DEV_LCR, lcr);
162
    lcr |= SIO_LCR_DLAB;
163
    HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr);
164
    HAL_WRITE_UINT8(base+CYG_DEV_DLL, CYG_DEVICE_SERIAL_BAUD_LSB);
165
    HAL_WRITE_UINT8(base+CYG_DEV_DLM, CYG_DEVICE_SERIAL_BAUD_MSB);
166
    lcr &= ~SIO_LCR_DLAB;
167
    HAL_WRITE_UINT8(base+CYG_DEV_LCR, lcr);
168
    HAL_WRITE_UINT8(base+CYG_DEV_FCR, 0x07);  // Enable & clear FIFO
169
 
170
    NS_EXTRA_INIT();
171
}
172
 
173
void
174
cyg_hal_plf_serial_putc(void *__ch_data, char c)
175
{
176
    cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
177
    cyg_uint8 lsr;
178
    CYGARC_HAL_SAVE_GP();
179
 
180
    do {
181
        HAL_READ_UINT8(base+CYG_DEV_LSR, lsr);
182
    } while ((lsr & SIO_LSR_THRE) == 0);
183
 
184
    HAL_WRITE_UINT8(base+CYG_DEV_THR, c);
185
 
186
    CYGARC_HAL_RESTORE_GP();
187
}
188
 
189
static cyg_bool
190
cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch)
191
{
192
    cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
193
    cyg_uint8 lsr;
194
 
195
    HAL_READ_UINT8(base+CYG_DEV_LSR, lsr);
196
    if ((lsr & SIO_LSR_DR) == 0)
197
        return false;
198
 
199
    HAL_READ_UINT8(base+CYG_DEV_RBR, *ch);
200
 
201
    return true;
202
}
203
 
204
cyg_uint8
205
cyg_hal_plf_serial_getc(void* __ch_data)
206
{
207
    cyg_uint8 ch;
208
    CYGARC_HAL_SAVE_GP();
209
 
210
    while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch));
211
 
212
    CYGARC_HAL_RESTORE_GP();
213
    return ch;
214
}
215
 
216
static channel_data_t ns_ser_channels[2] = {
217
    { (cyg_uint8*)NS_SERIAL_A_BASE, 1000, NS_SERIAL_A_IRQ },
218
    { (cyg_uint8*)NS_SERIAL_B_BASE, 1000, NS_SERIAL_B_IRQ }
219
};
220
 
221
static void
222
cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf,
223
                         cyg_uint32 __len)
224
{
225
    CYGARC_HAL_SAVE_GP();
226
 
227
    while(__len-- > 0)
228
        cyg_hal_plf_serial_putc(__ch_data, *__buf++);
229
 
230
    CYGARC_HAL_RESTORE_GP();
231
}
232
 
233
static void
234
cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len)
235
{
236
    CYGARC_HAL_SAVE_GP();
237
 
238
    while(__len-- > 0)
239
        *__buf++ = cyg_hal_plf_serial_getc(__ch_data);
240
 
241
    CYGARC_HAL_RESTORE_GP();
242
}
243
 
244
cyg_bool
245
cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch)
246
{
247
    int delay_count;
248
    channel_data_t* chan = (channel_data_t*)__ch_data;
249
    cyg_bool res;
250
    CYGARC_HAL_SAVE_GP();
251
 
252
    delay_count = chan->msec_timeout * 10; // delay in .1 ms steps
253
 
254
    for(;;) {
255
        res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch);
256
        if (res || 0 == delay_count--)
257
            break;
258
 
259
        CYGACC_CALL_IF_DELAY_US(100);
260
    }
261
 
262
    CYGARC_HAL_RESTORE_GP();
263
    return res;
264
}
265
 
266
static int
267
cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...)
268
{
269
    static int irq_state = 0;
270
    channel_data_t* chan = (channel_data_t*)__ch_data;
271
    int ret = 0;
272
    CYGARC_HAL_SAVE_GP();
273
 
274
    switch (__func) {
275
    case __COMMCTL_IRQ_ENABLE:
276
        irq_state = 1;
277
 
278
        HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, SIO_IER_RCV);
279
        HAL_WRITE_UINT8(chan->base+CYG_DEV_MCR, SIO_MCR_INT|SIO_MCR_DTR|SIO_MCR_RTS);
280
 
281
        HAL_INTERRUPT_UNMASK(chan->isr_vector);
282
        break;
283
    case __COMMCTL_IRQ_DISABLE:
284
        ret = irq_state;
285
        irq_state = 0;
286
 
287
        HAL_WRITE_UINT8(chan->base+CYG_DEV_IER, 0);
288
 
289
        HAL_INTERRUPT_MASK(chan->isr_vector);
290
        break;
291
    case __COMMCTL_DBG_ISR_VECTOR:
292
        ret = chan->isr_vector;
293
        break;
294
    case __COMMCTL_SET_TIMEOUT:
295
    {
296
        va_list ap;
297
 
298
        va_start(ap, __func);
299
 
300
        ret = chan->msec_timeout;
301
        chan->msec_timeout = va_arg(ap, cyg_uint32);
302
 
303
        va_end(ap);
304
    }
305
    default:
306
        break;
307
    }
308
    CYGARC_HAL_RESTORE_GP();
309
    return ret;
310
}
311
 
312
static int
313
cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc,
314
                       CYG_ADDRWORD __vector, CYG_ADDRWORD __data)
315
{
316
    int res = 0;
317
    channel_data_t* chan = (channel_data_t*)__ch_data;
318
    char c;
319
    cyg_uint8 lsr;
320
    CYGARC_HAL_SAVE_GP();
321
 
322
    cyg_drv_interrupt_acknowledge(chan->isr_vector);
323
 
324
    *__ctrlc = 0;
325
    HAL_READ_UINT8(chan->base+CYG_DEV_LSR, lsr);
326
    if ( (lsr & SIO_LSR_DR) != 0 ) {
327
 
328
        HAL_READ_UINT8(chan->base+CYG_DEV_RBR, c);
329
        if( cyg_hal_is_break( &c , 1 ) )
330
            *__ctrlc = 1;
331
 
332
        res = CYG_ISR_HANDLED;
333
    }
334
 
335
    CYGARC_HAL_RESTORE_GP();
336
    return res;
337
}
338
 
339
static void
340
cyg_hal_plf_serial_init(void)
341
{
342
    hal_virtual_comm_table_t* comm;
343
    int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
344
 
345
    // Disable interrupts.
346
    HAL_INTERRUPT_MASK(ns_ser_channels[0].isr_vector);
347
    HAL_INTERRUPT_MASK(ns_ser_channels[1].isr_vector);
348
 
349
    // Init channels
350
    cyg_hal_plf_serial_init_channel(&ns_ser_channels[0]);
351
    cyg_hal_plf_serial_init_channel(&ns_ser_channels[1]);
352
 
353
    // Setup procs in the vector table
354
 
355
    // Set channel 0
356
    CYGACC_CALL_IF_SET_CONSOLE_COMM(0);
357
    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
358
    CYGACC_COMM_IF_CH_DATA_SET(*comm, &ns_ser_channels[0]);
359
    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
360
    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
361
    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
362
    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
363
    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
364
    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
365
    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
366
 
367
    // Set channel 1
368
    CYGACC_CALL_IF_SET_CONSOLE_COMM(1);
369
    comm = CYGACC_CALL_IF_CONSOLE_PROCS();
370
    CYGACC_COMM_IF_CH_DATA_SET(*comm, &ns_ser_channels[1]);
371
    CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write);
372
    CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read);
373
    CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc);
374
    CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc);
375
    CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control);
376
    CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr);
377
    CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout);
378
 
379
    // Restore original console
380
    CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
381
}
382
 
383
void
384
cyg_hal_plf_comms_init(void)
385
{
386
    static int initialized = 0;
387
 
388
    if (initialized)
389
        return;
390
 
391
    initialized = 1;
392
 
393
    cyg_hal_plf_serial_init();
394
}
395
 
396
//-----------------------------------------------------------------------------
397
 
398
//=============================================================================
399
// Compatibility with older stubs
400
//=============================================================================
401
 
402
#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
403
 
404
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
405
#include <cyg/hal/hal_stub.h>           // cyg_hal_gdb_interrupt
406
#endif
407
 
408
#if CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL==0
409
// This is the base address of the A-channel
410
#define CYG_DEV_SERIAL_BASE      0x1d000020
411
#define CYG_DEVICE_SERIAL_INT    CYGNUM_HAL_INTERRUPT_SERIALA
412
#else
413
// This is the base address of the B-channel
414
#define CYG_DEV_SERIAL_BASE      0x1d000000
415
#define CYG_DEVICE_SERIAL_INT    CYGNUM_HAL_INTERRUPT_SERIALB
416
#endif
417
 
418
static channel_data_t ns_ser_channel = {
419
    (cyg_uint8*)CYG_DEV_SERIAL_BASE, 0, 0
420
};
421
 
422
// Assumption: all diagnostic output must be GDB packetized unless this is a ROM (i.e.
423
// totally stand-alone) system.
424
 
425
#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN)
426
#define HAL_DIAG_USES_HARDWARE
427
#endif
428
 
429
#ifndef HAL_DIAG_USES_HARDWARE
430
#if (CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL != CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL)
431
#define HAL_DIAG_USES_HARDWARE
432
#endif
433
#endif
434
 
435
#ifdef HAL_DIAG_USES_HARDWARE
436
 
437
void hal_diag_init(void)
438
{
439
    static int init = 0;
440
    char *msg = "\n\rARM eCos\n\r";
441
 
442
    if (init++) return;
443
 
444
    cyg_hal_plf_serial_init_channel(&ns_ser_channel);
445
 
446
    while (*msg) cyg_hal_plf_serial_putc(&ns_ser_channel, *msg++);
447
}
448
 
449
#ifdef DEBUG_DIAG
450
#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
451
#define DIAG_BUFSIZE 32
452
#else
453
#define DIAG_BUFSIZE 2048
454
#endif
455
static char diag_buffer[DIAG_BUFSIZE];
456
static int diag_bp = 0;
457
#endif
458
 
459
void hal_diag_write_char(char c)
460
{
461
    hal_diag_init();
462
 
463
    cyg_hal_plf_serial_putc(&ns_ser_channel, c);
464
 
465
#ifdef DEBUG_DIAG
466
    diag_buffer[diag_bp++] = c;
467
    if (diag_bp == DIAG_BUFSIZE) diag_bp = 0;
468
#endif
469
}
470
 
471
void hal_diag_read_char(char *c)
472
{
473
    *c = cyg_hal_plf_serial_getc(&ns_ser_channel);
474
}
475
 
476
#else // HAL_DIAG relies on GDB
477
 
478
// Initialize diag port - assume GDB channel is already set up
479
void hal_diag_init(void)
480
{
481
    if (0) cyg_hal_plf_serial_init_channel(&ns_ser_channel); // avoid warning
482
}
483
 
484
// Actually send character down the wire
485
static void
486
hal_diag_write_char_serial(char c)
487
{
488
    hal_diag_init();
489
 
490
    cyg_hal_plf_serial_putc(&ns_ser_channel, c);
491
}
492
 
493
static bool
494
hal_diag_read_serial(char *c)
495
{
496
    long timeout = 1000000000;  // A long time...
497
    while (!cyg_hal_plf_serial_getc_nonblock(&ns_ser_channel, c))
498
        if (0 == --timeout) return false;
499
 
500
    return true;
501
}
502
 
503
void
504
hal_diag_read_char(char *c)
505
{
506
    while (!hal_diag_read_serial(c)) ;
507
}
508
 
509
void
510
hal_diag_write_char(char c)
511
{
512
    static char line[100];
513
    static int pos = 0;
514
 
515
    // No need to send CRs
516
    if( c == '\r' ) return;
517
 
518
    line[pos++] = c;
519
 
520
    if( c == '\n' || pos == sizeof(line) )
521
    {
522
        CYG_INTERRUPT_STATE old;
523
 
524
        // Disable interrupts. This prevents GDB trying to interrupt us
525
        // while we are in the middle of sending a packet. The serial
526
        // receive interrupt will be seen when we re-enable interrupts
527
        // later.
528
 
529
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
530
        CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old);
531
#else
532
        HAL_DISABLE_INTERRUPTS(old);
533
#endif
534
 
535
        while(1)
536
        {
537
            static char hex[] = "0123456789ABCDEF";
538
            cyg_uint8 csum = 0;
539
            int i;
540
            char c1;
541
 
542
            hal_diag_write_char_serial('$');
543
            hal_diag_write_char_serial('O');
544
            csum += 'O';
545
            for( i = 0; i < pos; i++ )
546
            {
547
                char ch = line[i];
548
                char h = hex[(ch>>4)&0xF];
549
                char l = hex[ch&0xF];
550
                hal_diag_write_char_serial(h);
551
                hal_diag_write_char_serial(l);
552
                csum += h;
553
                csum += l;
554
            }
555
            hal_diag_write_char_serial('#');
556
            hal_diag_write_char_serial(hex[(csum>>4)&0xF]);
557
            hal_diag_write_char_serial(hex[csum&0xF]);
558
 
559
            // Wait for the ACK character '+' from GDB here and handle
560
            // receiving a ^C instead.  This is the reason for this clause
561
            // being a loop.
562
            if (!hal_diag_read_serial(&c1))
563
                continue;   // No response - try sending packet again
564
 
565
            if( c1 == '+' )
566
                break;              // a good acknowledge
567
 
568
#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
569
            cyg_drv_interrupt_acknowledge(CYG_DEVICE_SERIAL_INT);
570
            if( c1 == 3 ) {
571
                // Ctrl-C: breakpoint.
572
                cyg_hal_gdb_interrupt ((target_register_t)__builtin_return_address(0));
573
                break;
574
            }
575
#endif
576
            // otherwise, loop round again
577
        }
578
 
579
        pos = 0;
580
 
581
        // And re-enable interrupts
582
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
583
        CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old);
584
#else
585
        HAL_RESTORE_INTERRUPTS(old);
586
#endif
587
 
588
    }
589
}
590
#endif
591
 
592
#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
593
 
594
//-----------------------------------------------------------------------------
595
// End of ns16552.c

powered by: WebSVN 2.1.0

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