annotate packages/hal/h8300/arch/current/src/sci.c @ 2729:74dbf4c3f2e1 after-copyright-change-20090129

Update all copyright banners to reflect FSF ownership; fix and improve licence text.
author jlarmour
date Thu, 29 Jan 2009 17:47:46 +0000
parents 10851723ceff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
1 //=============================================================================
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
2 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
3 // sci.c
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
4 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
5 // Simple driver for the H8/300 Serial Communication Interface (SCI)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
6 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
7 //=============================================================================
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
8 // ####ECOSGPLCOPYRIGHTBEGIN####
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
9 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
12 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
13 // eCos is free software; you can redistribute it and/or modify it under
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
14 // the terms of the GNU General Public License as published by the Free
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
15 // Software Foundation; either version 2 or (at your option) any later
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
16 // version.
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
17 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
18 // eCos is distributed in the hope that it will be useful, but WITHOUT
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
21 // for more details.
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
22 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
23 // You should have received a copy of the GNU General Public License
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
24 // along with eCos; if not, write to the Free Software Foundation, Inc.,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
26 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
27 // As a special exception, if other files instantiate templates or use
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
28 // macros or inline functions from this file, or you compile this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
29 // and link it with other works to produce a work based on this file,
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
30 // this file does not by itself cause the resulting work to be covered by
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
31 // the GNU General Public License. However the source code for this file
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
32 // must still be made available in accordance with section (3) of the GNU
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
33 // General Public License v2.
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
34 //
2729
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
35 // This exception does not invalidate any other reasons why a work based
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
36 // on this file might be covered by the GNU General Public License.
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
37 // -------------------------------------------
74dbf4c3f2e1 Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents: 1569
diff changeset
38 // ####ECOSGPLCOPYRIGHTEND####
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
39 //=============================================================================
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
40 //#####DESCRIPTIONBEGIN####
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
41 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
42 // Author(s): ysato
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
43 // Contributors:ysato
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
44 // Date: 2002-03-21
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
45 // Description: Simple driver for the H8/300 Serial Communication Interface
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
46 // Clients of this file can configure the behavior with:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
47 // CYGNUM_SCI_PORTS: number of SCI ports
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
48 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
49 //####DESCRIPTIONEND####
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
50 //
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
51 //=============================================================================
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
52
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
53 #include <pkgconf/hal.h>
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
54
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
55 #ifdef CYGNUM_HAL_H8300_SCI_PORTS
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
56
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
57 #include <cyg/hal/hal_io.h> // IO macros
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
58 #include <cyg/hal/drv_api.h> // CYG_ISR_HANDLED
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
59 #include <cyg/hal/hal_misc.h> // Helper functions
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
60 #include <cyg/hal/hal_intr.h> // HAL_ENABLE/MASK/UNMASK_INTERRUPTS
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
61 #include <cyg/hal/hal_arch.h> // SAVE/RESTORE GP
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
62 #include <cyg/hal/hal_if.h> // Calling-if API
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
63 #include <cyg/hal/mod_regs_sci.h> // serial register definitions
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
64
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
65 #include <cyg/hal/h8_sci.h> // our header
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
66
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
67 //--------------------------------------------------------------------------
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
68
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
69 void
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
70 cyg_hal_plf_sci_init_channel(void* chan)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
71 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
72 cyg_uint8 tmp;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
73 cyg_uint8* base = ((channel_data_t *)chan)->base;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
74
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
75 // Disable Tx/Rx interrupts, but enable Tx/Rx
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
76 HAL_WRITE_UINT8(base+_REG_SCSCR,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
77 CYGARC_REG_SCSCR_TE|CYGARC_REG_SCSCR_RE);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
78
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
79 // 8-1-no parity.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
80 HAL_WRITE_UINT8(base+_REG_SCSMR, 0);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
81
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
82 // Set speed to CYGNUM_HAL_H8300_SCI_DEFAULT_BAUD_RATE
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
83 HAL_READ_UINT8(base+_REG_SCSMR, tmp);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
84 tmp &= ~CYGARC_REG_SCSMR_CKSx_MASK;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
85 tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_H8300_SCI_BAUD_RATE);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
86 HAL_WRITE_UINT8(base+_REG_SCSMR, tmp);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
87 HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_H8300_SCI_BAUD_RATE));
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
88 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
89
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
90 static cyg_bool
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
91 cyg_hal_plf_sci_getc_nonblock(void* __ch_data, cyg_uint8* ch)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
92 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
93 cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
94 cyg_uint8 sr;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
95
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
96 HAL_READ_UINT8(base+_REG_SCSSR, sr);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
97 if (sr & CYGARC_REG_SCSSR_ORER) {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
98 // Serial RX overrun. Clear error and let caller try again.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
99 HAL_WRITE_UINT8(base+_REG_SCSSR,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
100 CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
101 return false;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
102 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
103
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
104 if ((sr & CYGARC_REG_SCSSR_RDRF) == 0)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
105 return false;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
106
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
107 HAL_READ_UINT8(base+_REG_SCRDR, *ch);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
108
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
109 // Clear buffer full flag.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
110 HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_RDRF);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
111 return true;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
112 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
113
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
114 cyg_uint8
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
115 cyg_hal_plf_sci_getc(void* __ch_data)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
116 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
117 cyg_uint8 ch;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
118 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
119
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
120 while(!cyg_hal_plf_sci_getc_nonblock(__ch_data, &ch));
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
121
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
122 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
123 return ch;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
124 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
125
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
126 void
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
127 cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
128 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
129 cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
130 cyg_uint8 sr;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
131 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
132
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
133 do {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
134 HAL_READ_UINT8(base+_REG_SCSSR, sr);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
135 } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
136
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
137 HAL_WRITE_UINT8(base+_REG_SCTDR, c);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
138
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
139 // Clear empty flag.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
140 HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_TDRE);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
141
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
142 // Hang around until the character has been safely sent.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
143 do {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
144 HAL_READ_UINT8(base+_REG_SCSSR, sr);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
145 } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
146
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
147 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
148 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
149
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
150
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
151 static channel_data_t channels[CYGNUM_HAL_H8300_SCI_PORTS];
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
152
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
153 static void
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
154 cyg_hal_plf_sci_write(void* __ch_data, const cyg_uint8* __buf,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
155 cyg_uint32 __len)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
156 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
157 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
158
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
159 while(__len-- > 0)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
160 cyg_hal_plf_sci_putc(__ch_data, *__buf++);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
161
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
162 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
163 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
164
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
165 static void
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
166 cyg_hal_plf_sci_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
167 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
168 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
169
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
170 while(__len-- > 0)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
171 *__buf++ = cyg_hal_plf_sci_getc(__ch_data);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
172
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
173 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
174 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
175
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
176 cyg_bool
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
177 cyg_hal_plf_sci_getc_timeout(void* __ch_data, cyg_uint8* ch)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
178 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
179 channel_data_t* chan = (channel_data_t*)__ch_data;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
180 int delay_count;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
181 cyg_bool res;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
182 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
183
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
184 delay_count = chan->msec_timeout * 20; // delay in .1 ms steps
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
185
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
186 for(;;) {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
187 res = cyg_hal_plf_sci_getc_nonblock(__ch_data, ch);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
188 if (res || 0 == delay_count--)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
189 break;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
190
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
191 CYGACC_CALL_IF_DELAY_US(50);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
192 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
193
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
194 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
195 return res;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
196 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
197
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
198 static int
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
199 cyg_hal_plf_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
200 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
201 static int irq_state = 0;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
202 channel_data_t* chan = (channel_data_t*)__ch_data;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
203 cyg_uint8 scr;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
204 int ret = 0;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
205 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
206
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
207 switch (__func) {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
208 case __COMMCTL_IRQ_ENABLE:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
209 irq_state = 1;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
210 HAL_INTERRUPT_UNMASK(chan->isr_vector);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
211 break;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
212 case __COMMCTL_IRQ_DISABLE:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
213 ret = irq_state;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
214 irq_state = 0;
1569
10851723ceff * src/context.S
asl
parents: 1281
diff changeset
215 HAL_INTERRUPT_MASK(chan->isr_vector);
1281
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
216 break;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
217 case __COMMCTL_DBG_ISR_VECTOR:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
218 ret = chan->isr_vector;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
219 break;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
220 case __COMMCTL_SET_TIMEOUT:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
221 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
222 va_list ap;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
223
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
224 va_start(ap, __func);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
225
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
226 ret = chan->msec_timeout;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
227 chan->msec_timeout = va_arg(ap, cyg_uint32);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
228
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
229 va_end(ap);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
230 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
231 default:
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
232 break;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
233 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
234 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
235 return ret;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
236 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
237
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
238 static int
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
239 cyg_hal_plf_sci_isr(void *__ch_data, int* __ctrlc,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
240 CYG_ADDRWORD __vector, CYG_ADDRWORD __data)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
241 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
242 cyg_uint8 c, sr;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
243 cyg_uint8* base = ((channel_data_t*)__ch_data)->base;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
244 int res = 0;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
245 CYGARC_HAL_SAVE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
246
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
247 *__ctrlc = 0;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
248 HAL_READ_UINT8(base+_REG_SCSSR, sr);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
249 if (sr & CYGARC_REG_SCSSR_ORER) {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
250 // Serial RX overrun. Clear error and hope protocol recovers.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
251 HAL_WRITE_UINT8(base+_REG_SCSSR,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
252 CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
253 res = CYG_ISR_HANDLED;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
254 } else if (sr & CYGARC_REG_SCSSR_RDRF) {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
255 // Received character
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
256 HAL_READ_UINT8(base+_REG_SCRDR, c);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
257
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
258 // Clear buffer full flag.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
259 HAL_WRITE_UINT8(base+_REG_SCSSR,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
260 CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
261
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
262 if( cyg_hal_is_break( &c , 1 ) )
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
263 *__ctrlc = 1;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
264
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
265 res = CYG_ISR_HANDLED;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
266 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
267
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
268 CYGARC_HAL_RESTORE_GP();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
269 return res;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
270 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
271
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
272 void
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
273 cyg_hal_plf_sci_init(int sci_index, int comm_index,
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
274 int rcv_vect, cyg_uint8* base)
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
275 {
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
276 channel_data_t* chan = &channels[sci_index];
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
277 hal_virtual_comm_table_t* comm;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
278 int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
279
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
280 // Initialize channel table
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
281 chan->base = base;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
282 chan->isr_vector = rcv_vect;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
283 chan->msec_timeout = 1000;
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
284
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
285 // Disable interrupts.
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
286 HAL_INTERRUPT_MASK(chan->isr_vector);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
287
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
288 // Init channel
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
289
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
290 cyg_hal_plf_sci_init_channel(chan);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
291
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
292 // Setup procs in the vector table
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
293
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
294 // Initialize channel procs
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
295 CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
296 comm = CYGACC_CALL_IF_CONSOLE_PROCS();
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
297 CYGACC_COMM_IF_CH_DATA_SET(*comm, chan);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
298 CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_sci_write);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
299 CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_sci_read);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
300 CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_sci_putc);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
301 CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_sci_getc);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
302 CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_sci_control);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
303 CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_sci_isr);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
304 CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_sci_getc_timeout);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
305
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
306 // Restore original console
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
307 CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
308 }
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
309
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
310 #endif // CYGNUM_HAL_H8300_SCI_PORTS
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
311
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
312 //-----------------------------------------------------------------------------
f58b62f3c85d Apply Yoshinori Sato's H8/300 patches plus a few of my own.
nickg
parents:
diff changeset
313 // end of sci.c