Mercurial > ecos-v3_0-branch
annotate packages/hal/arm/xscale/iop310/current/src/hal_diag.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 | de449c532876 |
| children |
| rev | line source |
|---|---|
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
1 /*============================================================================= |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
2 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
3 // hal_diag.c |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
4 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
5 // HAL diagnostic output code |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
6 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
7 //============================================================================= |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
diff
changeset
|
8 // ####ECOSGPLCOPYRIGHTBEGIN#### |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
diff
changeset
|
9 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
12 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
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:
411
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:
411
diff
changeset
|
16 // version. |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
17 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
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:
411
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:
411
diff
changeset
|
21 // for more details. |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
22 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
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:
411
diff
changeset
|
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
26 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
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:
411
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:
411
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:
411
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:
411
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:
411
diff
changeset
|
33 // General Public License v2. |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
34 // |
|
2729
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
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:
411
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:
411
diff
changeset
|
37 // ------------------------------------------- |
|
74dbf4c3f2e1
Update all copyright banners to reflect FSF ownership; fix and improve licence text.
jlarmour
parents:
411
diff
changeset
|
38 // ####ECOSGPLCOPYRIGHTEND#### |
|
411
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
39 //============================================================================= |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
40 //#####DESCRIPTIONBEGIN#### |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
41 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
42 // Author(s): msalter |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
43 // Contributors:msalter, gthomas |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
44 // Date: 2000-10-10 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
45 // Purpose: HAL diagnostic output |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
46 // Description: Implementations of HAL diagnostic output support. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
47 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
48 //####DESCRIPTIONEND#### |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
49 // |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
50 //===========================================================================*/ |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
51 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
52 #include <pkgconf/hal.h> |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
53 #include <pkgconf/system.h> |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
54 #include CYGBLD_HAL_PLATFORM_H |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
55 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
56 #include <cyg/infra/cyg_type.h> // base types |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
57 #include <cyg/infra/cyg_trac.h> // tracing macros |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
58 #include <cyg/infra/cyg_ass.h> // assertion macros |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
59 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
60 #include <cyg/hal/hal_arch.h> // basic machine info |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
61 #include <cyg/hal/hal_intr.h> // interrupt macros |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
62 #include <cyg/hal/hal_io.h> // IO macros |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
63 #include <cyg/hal/hal_if.h> // calling interface API |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
64 #include <cyg/hal/hal_misc.h> // helper functions |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
65 #include <cyg/hal/hal_diag.h> |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
66 #include <cyg/hal/hal_iop310.h> // Hardware definitions |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
67 #include <cyg/hal/drv_api.h> // cyg_drv_interrupt_acknowledge |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
68 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
69 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
70 static void cyg_hal_plf_serial_init(void); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
71 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
72 void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
73 cyg_hal_plf_comms_init(void) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
74 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
75 static int initialized = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
76 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
77 if (initialized) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
78 return; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
79 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
80 initialized = 1; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
81 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
82 cyg_hal_plf_serial_init(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
83 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
84 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
85 //============================================================================= |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
86 // Serial driver |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
87 //============================================================================= |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
88 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
89 //----------------------------------------------------------------------------- |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
90 // Based on 3.6864 MHz xtal |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
91 struct baud_config { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
92 cyg_int32 baud_rate; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
93 cyg_uint8 msb; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
94 cyg_uint8 lsb; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
95 }; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
96 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
97 struct baud_config baud_conf[] = { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
98 {9600, 0x00, 0x0c}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
99 {19200, 0x00, 0x06}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
100 {38400, 0x00, 0x03}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
101 {57600, 0x00, 0x02}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
102 {115200, 0x00, 0x01}}; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
103 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
104 //----------------------------------------------------------------------------- |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
105 // Define the serial registers. The Cogent board is equipped with a 16552 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
106 // serial chip. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
107 #define CYG_DEV_SERIAL_RBR 0x00 // receiver buffer register, read, dlab = 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
108 #define CYG_DEV_SERIAL_THR 0x00 // transmitter holding register, write, dlab = 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
109 #define CYG_DEV_SERIAL_DLL 0x00 // divisor latch (LS), read/write, dlab = 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
110 #define CYG_DEV_SERIAL_IER 0x01 // interrupt enable register, read/write, dlab = 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
111 #define CYG_DEV_SERIAL_DLM 0x01 // divisor latch (MS), read/write, dlab = 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
112 #define CYG_DEV_SERIAL_IIR 0x02 // interrupt identification register, read, dlab = 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
113 #define CYG_DEV_SERIAL_FCR 0x02 // fifo control register, write, dlab = 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
114 #define CYG_DEV_SERIAL_LCR 0x03 // line control register, write |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
115 #define CYG_DEV_SERIAL_MCR 0x04 // modem control register, write |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
116 #define CYG_DEV_SERIAL_LSR 0x05 // line status register, read |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
117 #define CYG_DEV_SERIAL_MSR 0x06 // modem status register, read |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
118 #define CYG_DEV_SERIAL_SCR 0x07 // scratch pad register |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
119 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
120 // The interrupt enable register bits. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
121 #define SIO_IER_ERDAI 0x01 // enable received data available irq |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
122 #define SIO_IER_ETHREI 0x02 // enable THR empty interrupt |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
123 #define SIO_IER_ELSI 0x04 // enable receiver line status irq |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
124 #define SIO_IER_EMSI 0x08 // enable modem status interrupt |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
125 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
126 // The interrupt identification register bits. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
127 #define SIO_IIR_IP 0x01 // 0 if interrupt pending |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
128 #define SIO_IIR_ID_MASK 0x0e // mask for interrupt ID bits |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
129 #define ISR_Tx 0x02 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
130 #define ISR_Rx 0x04 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
131 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
132 // The line status register bits. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
133 #define SIO_LSR_DR 0x01 // data ready |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
134 #define SIO_LSR_OE 0x02 // overrun error |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
135 #define SIO_LSR_PE 0x04 // parity error |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
136 #define SIO_LSR_FE 0x08 // framing error |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
137 #define SIO_LSR_BI 0x10 // break interrupt |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
138 #define SIO_LSR_THRE 0x20 // transmitter holding register empty |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
139 #define SIO_LSR_TEMT 0x40 // transmitter register empty |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
140 #define SIO_LSR_ERR 0x80 // any error condition |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
141 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
142 // The modem status register bits. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
143 #define SIO_MSR_DCTS 0x01 // delta clear to send |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
144 #define SIO_MSR_DDSR 0x02 // delta data set ready |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
145 #define SIO_MSR_TERI 0x04 // trailing edge ring indicator |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
146 #define SIO_MSR_DDCD 0x08 // delta data carrier detect |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
147 #define SIO_MSR_CTS 0x10 // clear to send |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
148 #define SIO_MSR_DSR 0x20 // data set ready |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
149 #define SIO_MSR_RI 0x40 // ring indicator |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
150 #define SIO_MSR_DCD 0x80 // data carrier detect |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
151 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
152 // The line control register bits. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
153 #define SIO_LCR_WLS0 0x01 // word length select bit 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
154 #define SIO_LCR_WLS1 0x02 // word length select bit 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
155 #define SIO_LCR_STB 0x04 // number of stop bits |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
156 #define SIO_LCR_PEN 0x08 // parity enable |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
157 #define SIO_LCR_EPS 0x10 // even parity select |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
158 #define SIO_LCR_SP 0x20 // stick parity |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
159 #define SIO_LCR_SB 0x40 // set break |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
160 #define SIO_LCR_DLAB 0x80 // divisor latch access bit |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
161 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
162 // The FIFO control register |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
163 #define SIO_FCR_FCR0 0x01 // enable xmit and rcvr fifos |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
164 #define SIO_FCR_FCR1 0x02 // clear RCVR FIFO |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
165 #define SIO_FCR_FCR2 0x04 // clear XMIT FIFO |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
166 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
167 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
168 //----------------------------------------------------------------------------- |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
169 typedef struct { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
170 cyg_uint8* base; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
171 cyg_int32 msec_timeout; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
172 int isr_vector; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
173 cyg_int32 baud_rate; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
174 } channel_data_t; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
175 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
176 //----------------------------------------------------------------------------- |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
177 static int |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
178 set_baud( channel_data_t *chan ) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
179 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
180 cyg_uint8* base = chan->base; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
181 cyg_uint8 i; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
182 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
183 for (i=0; i<(sizeof(baud_conf)/sizeof(baud_conf[0])); i++) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
184 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
185 if (chan->baud_rate == baud_conf[i].baud_rate) { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
186 cyg_uint8 lcr; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
187 HAL_READ_UINT8(base+CYG_DEV_SERIAL_LCR, lcr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
188 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_LCR, lcr|SIO_LCR_DLAB); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
189 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_DLL, baud_conf[i].lsb); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
190 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_DLM, baud_conf[i].msb); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
191 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_LCR, lcr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
192 return 1; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
193 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
194 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
195 return -1; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
196 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
197 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
198 static void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
199 init_serial_channel(channel_data_t* __ch_data) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
200 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
201 cyg_uint8* base = __ch_data->base; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
202 channel_data_t* chan = (channel_data_t*)__ch_data; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
203 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
204 // 8-1-no parity. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
205 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_LCR, SIO_LCR_WLS0 | SIO_LCR_WLS1); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
206 chan->baud_rate = CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
207 set_baud( chan ); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
208 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_FCR, 0x07); // Enable & clear FIFO |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
209 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
210 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
211 static cyg_bool |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
212 cyg_hal_plf_serial_getc_nonblock(void* __ch_data, cyg_uint8* ch) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
213 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
214 cyg_uint8* base = ((channel_data_t*)__ch_data)->base; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
215 cyg_uint8 lsr; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
216 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
217 HAL_READ_UINT8(base+CYG_DEV_SERIAL_LSR, lsr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
218 if ((lsr & SIO_LSR_DR) == 0) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
219 return false; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
220 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
221 HAL_READ_UINT8(base+CYG_DEV_SERIAL_RBR, *ch); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
222 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
223 return true; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
224 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
225 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
226 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
227 cyg_uint8 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
228 cyg_hal_plf_serial_getc(void* __ch_data) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
229 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
230 cyg_uint8 ch; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
231 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
232 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
233 while(!cyg_hal_plf_serial_getc_nonblock(__ch_data, &ch)); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
234 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
235 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
236 return ch; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
237 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
238 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
239 void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
240 cyg_hal_plf_serial_putc(void* __ch_data, cyg_uint8 c) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
241 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
242 cyg_uint8* base = ((channel_data_t*)__ch_data)->base; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
243 cyg_uint8 lsr; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
244 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
245 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
246 do { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
247 HAL_READ_UINT8(base+CYG_DEV_SERIAL_LSR, lsr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
248 } while ((lsr & SIO_LSR_THRE) == 0); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
249 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
250 HAL_WRITE_UINT8(base+CYG_DEV_SERIAL_THR, c); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
251 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
252 // Hang around until the character has been safely sent. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
253 do { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
254 HAL_READ_UINT8(base+CYG_DEV_SERIAL_LSR, lsr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
255 } while ((lsr & SIO_LSR_THRE) == 0); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
256 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
257 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
258 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
259 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
260 static channel_data_t channels[2] = { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
261 #if CYGHWR_HAL_ARM_IOP310_SERIAL_PORTA != 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
262 { (cyg_uint8*)IOP310_SERIAL_PORT_A, 1000, CYGNUM_HAL_INTERRUPT_SERIAL_A}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
263 #endif |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
264 #if CYGHWR_HAL_ARM_IOP310_SERIAL_PORTB != 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
265 { (cyg_uint8*)IOP310_SERIAL_PORT_B, 1000, CYGNUM_HAL_INTERRUPT_SERIAL_B}, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
266 #endif |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
267 }; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
268 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
269 static void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
270 cyg_hal_plf_serial_write(void* __ch_data, const cyg_uint8* __buf, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
271 cyg_uint32 __len) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
272 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
273 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
274 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
275 while(__len-- > 0) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
276 cyg_hal_plf_serial_putc(__ch_data, *__buf++); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
277 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
278 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
279 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
280 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
281 static void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
282 cyg_hal_plf_serial_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
283 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
284 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
285 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
286 while(__len-- > 0) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
287 *__buf++ = cyg_hal_plf_serial_getc(__ch_data); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
288 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
289 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
290 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
291 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
292 cyg_bool |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
293 cyg_hal_plf_serial_getc_timeout(void* __ch_data, cyg_uint8* ch) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
294 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
295 int delay_count; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
296 channel_data_t* chan = (channel_data_t*)__ch_data; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
297 cyg_bool res; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
298 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
299 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
300 delay_count = chan->msec_timeout * 10; // delay in .1 ms steps |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
301 for(;;) { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
302 res = cyg_hal_plf_serial_getc_nonblock(__ch_data, ch); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
303 if (res || 0 == delay_count--) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
304 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
305 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
306 CYGACC_CALL_IF_DELAY_US(100); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
307 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
308 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
309 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
310 return res; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
311 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
312 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
313 static int |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
314 cyg_hal_plf_serial_control(void *__ch_data, __comm_control_cmd_t __func, ...) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
315 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
316 static int irq_state = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
317 channel_data_t* chan = (channel_data_t*)__ch_data; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
318 cyg_uint8 ier; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
319 int ret = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
320 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
321 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
322 switch (__func) { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
323 case __COMMCTL_IRQ_ENABLE: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
324 HAL_INTERRUPT_UNMASK(chan->isr_vector); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
325 HAL_INTERRUPT_SET_LEVEL(chan->isr_vector, 1); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
326 HAL_READ_UINT8(chan->base+CYG_DEV_SERIAL_IER, ier); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
327 ier |= SIO_IER_ERDAI; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
328 HAL_WRITE_UINT8(chan->base+CYG_DEV_SERIAL_IER, ier); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
329 irq_state = 1; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
330 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
331 case __COMMCTL_IRQ_DISABLE: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
332 ret = irq_state; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
333 irq_state = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
334 HAL_INTERRUPT_MASK(chan->isr_vector); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
335 HAL_READ_UINT8(chan->base+CYG_DEV_SERIAL_IER, ier); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
336 ier &= ~SIO_IER_ERDAI; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
337 HAL_WRITE_UINT8(chan->base+CYG_DEV_SERIAL_IER, ier); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
338 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
339 case __COMMCTL_DBG_ISR_VECTOR: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
340 ret = chan->isr_vector; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
341 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
342 case __COMMCTL_SET_TIMEOUT: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
343 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
344 va_list ap; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
345 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
346 va_start(ap, __func); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
347 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
348 ret = chan->msec_timeout; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
349 chan->msec_timeout = va_arg(ap, cyg_uint32); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
350 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
351 va_end(ap); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
352 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
353 case __COMMCTL_GETBAUD: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
354 ret = chan->baud_rate; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
355 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
356 case __COMMCTL_SETBAUD: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
357 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
358 va_list ap; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
359 va_start(ap, __func); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
360 chan->baud_rate = va_arg(ap, cyg_int32); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
361 va_end(ap); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
362 ret = set_baud(chan); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
363 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
364 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
365 default: |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
366 break; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
367 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
368 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
369 return ret; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
370 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
371 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
372 static int |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
373 cyg_hal_plf_serial_isr(void *__ch_data, int* __ctrlc, |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
374 CYG_ADDRWORD __vector, CYG_ADDRWORD __data) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
375 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
376 channel_data_t* chan = (channel_data_t*)__ch_data; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
377 cyg_uint8 _iir; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
378 int res = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
379 CYGARC_HAL_SAVE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
380 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
381 HAL_READ_UINT8(chan->base+CYG_DEV_SERIAL_IIR, _iir); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
382 _iir &= SIO_IIR_ID_MASK; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
383 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
384 *__ctrlc = 0; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
385 if ( ISR_Rx == _iir ) { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
386 cyg_uint8 c, lsr; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
387 HAL_READ_UINT8(chan->base+CYG_DEV_SERIAL_LSR, lsr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
388 if (lsr & SIO_LSR_DR) { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
389 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
390 HAL_READ_UINT8(chan->base+CYG_DEV_SERIAL_RBR, c); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
391 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
392 if( cyg_hal_is_break( &c , 1 ) ) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
393 *__ctrlc = 1; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
394 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
395 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
396 // Acknowledge the interrupt |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
397 HAL_INTERRUPT_ACKNOWLEDGE(chan->isr_vector); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
398 res = CYG_ISR_HANDLED; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
399 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
400 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
401 CYGARC_HAL_RESTORE_GP(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
402 return res; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
403 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
404 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
405 static void |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
406 cyg_hal_plf_serial_init(void) |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
407 { |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
408 hal_virtual_comm_table_t* comm; |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
409 int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
410 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
411 // Disable interrupts. |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
412 HAL_INTERRUPT_MASK(channels[0].isr_vector); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
413 #if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
414 HAL_INTERRUPT_MASK(channels[1].isr_vector); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
415 #endif |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
416 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
417 // Init channels |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
418 init_serial_channel(&channels[0]); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
419 #if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
420 init_serial_channel(&channels[1]); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
421 #endif |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
422 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
423 // Setup procs in the vector table |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
424 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
425 // Set channel 0 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
426 CYGACC_CALL_IF_SET_CONSOLE_COMM(0); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
427 comm = CYGACC_CALL_IF_CONSOLE_PROCS(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
428 CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[0]); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
429 CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
430 CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
431 CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
432 CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
433 CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
434 CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
435 CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
436 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
437 #if CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS > 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
438 // Set channel 1 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
439 CYGACC_CALL_IF_SET_CONSOLE_COMM(1); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
440 comm = CYGACC_CALL_IF_CONSOLE_PROCS(); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
441 CYGACC_COMM_IF_CH_DATA_SET(*comm, &channels[1]); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
442 CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_serial_write); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
443 CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_serial_read); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
444 CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_serial_putc); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
445 CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_serial_getc); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
446 CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_serial_control); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
447 CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_serial_isr); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
448 CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_serial_getc_timeout); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
449 #endif |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
450 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
451 // Restore original console |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
452 CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
453 } |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
454 |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
455 /*---------------------------------------------------------------------------*/ |
|
de449c532876
Add NPWR Linux Engine, update Xscale IOP310 based platforms
gthomas
parents:
diff
changeset
|
456 /* End of hal_diag.c */ |
