Mercurial > flash_v2
annotate packages/io/serial/current/src/common/haldiag.c @ 66:bf00f99aec69 ecos-sw-2000-02-02
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
| author | jlarmour |
|---|---|
| date | Wed, 02 Feb 2000 19:57:02 +0000 |
| parents | c38311975d4f |
| children | 6ed91473a1cd |
| rev | line source |
|---|---|
| 2 | 1 //========================================================================== |
| 2 // | |
| 3 // io/serial/common/haldiag.c | |
| 4 // | |
| 5 // Serial I/O interface module using HAL I/O routines | |
| 6 // | |
| 7 //========================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
12 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
14 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
15 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
62
diff
changeset
|
29 // |
| 2 | 30 //####COPYRIGHTEND#### |
| 31 //========================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): gthomas | |
| 35 // Contributors: gthomas | |
| 36 // Date: 1999-02-04 | |
| 37 // Purpose: HAL/diag serial driver | |
| 38 // Description: | |
| 39 // | |
| 40 //####DESCRIPTIONEND#### | |
| 41 // | |
| 42 //========================================================================== | |
| 43 | |
| 44 #include <pkgconf/io.h> | |
| 45 #include <pkgconf/io_serial.h> | |
| 46 #ifdef CYGPKG_IO_SERIAL_HALDIAG | |
| 47 #include <cyg/io/io.h> | |
| 48 #include <cyg/io/devtab.h> | |
| 49 #include <cyg/io/serial.h> | |
| 50 #include <cyg/infra/diag.h> | |
| 51 #include <cyg/hal/hal_diag.h> | |
| 52 | |
| 53 static bool haldiag_init(struct cyg_devtab_entry *tab); | |
| 54 static bool haldiag_putc(serial_channel *chan, unsigned char c); | |
| 55 static unsigned char haldiag_getc(serial_channel *chan); | |
| 56 static bool haldiag_set_config(serial_channel *chan, cyg_serial_info_t *config); | |
| 57 | |
| 58 static SERIAL_FUNS(haldiag_funs, | |
| 59 haldiag_putc, | |
| 60 haldiag_getc, | |
| 61 haldiag_set_config, | |
| 62 0, // start xmit - not used | |
| 63 0 // stop xmit - not used | |
| 64 ); | |
| 65 | |
| 66 static int _no_data; | |
|
62
7a6ac9edc838
Merge from eCos master repository on 2000-01-24-19:43:49-GMT
jlarmour
parents:
2
diff
changeset
|
67 static SERIAL_CHANNEL(haldiag_channel0, |
| 2 | 68 haldiag_funs, |
| 69 _no_data, | |
| 70 CYG_SERIAL_BAUD_DEFAULT, | |
| 71 CYG_SERIAL_STOP_DEFAULT, | |
| 72 CYG_SERIAL_PARITY_DEFAULT, | |
| 73 CYG_SERIAL_WORD_LENGTH_DEFAULT, | |
| 74 CYG_SERIAL_FLAGS_DEFAULT | |
| 75 ); | |
| 76 DEVTAB_ENTRY(haldiag_io0, | |
| 77 "/dev/haldiag", | |
| 78 0, // Does not depend on a lower level interface | |
|
62
7a6ac9edc838
Merge from eCos master repository on 2000-01-24-19:43:49-GMT
jlarmour
parents:
2
diff
changeset
|
79 &cyg_io_serial_devio, |
| 2 | 80 haldiag_init, |
| 81 0, // No initialization/lookup needed | |
| 82 &haldiag_channel0); | |
| 83 | |
| 84 static void | |
| 85 haldiag_config_port(serial_channel *chan) | |
| 86 { | |
| 87 } | |
| 88 | |
| 89 static bool | |
| 90 haldiag_init(struct cyg_devtab_entry *tab) | |
| 91 { | |
| 92 serial_channel *chan = (serial_channel *)tab->priv; | |
| 93 #ifdef CYGDBG_IO_INIT | |
| 94 diag_printf("HAL/diag SERIAL init\n"); | |
| 95 #endif | |
| 96 haldiag_config_port(chan); | |
| 97 return true; | |
| 98 } | |
| 99 | |
| 100 // Return 'true' if character is sent to device | |
| 101 static bool | |
| 102 haldiag_putc(serial_channel *chan, unsigned char c) | |
| 103 { | |
| 104 HAL_DIAG_WRITE_CHAR(c); | |
| 105 return true; | |
| 106 } | |
| 107 | |
| 108 static unsigned char | |
| 109 haldiag_getc(serial_channel *chan) | |
| 110 { | |
| 111 unsigned char c; | |
| 112 HAL_DIAG_READ_CHAR(c); | |
| 113 return c; | |
| 114 } | |
| 115 | |
| 116 static bool | |
| 117 haldiag_set_config(serial_channel *chan, cyg_serial_info_t *config) | |
| 118 { | |
| 119 diag_printf("%s\n", __FUNCTION__); | |
| 120 return true; | |
| 121 } | |
| 122 #endif // CYGPKG_IO_SERIAL_HALDIAG |
