split serial

This commit is contained in:
phcoder 2009-10-10 20:59:18 +02:00
parent 86564c267a
commit f651d13a18
6 changed files with 11 additions and 9 deletions

View file

@ -187,7 +187,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS) halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod. # For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -156,7 +156,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS) halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod. # For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -260,7 +260,7 @@ halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS) halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod. # For serial.mod.
serial_mod_SOURCES = term/i386/pc/serial.c serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -21,6 +21,8 @@
#ifndef GRUB_IO_H #ifndef GRUB_IO_H
#define GRUB_IO_H 1 #define GRUB_IO_H 1
typedef unsigned short int grub_port_t;
static __inline unsigned char static __inline unsigned char
grub_inb (unsigned short int port) grub_inb (unsigned short int port)
{ {

View file

@ -17,8 +17,8 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef GRUB_SERIAL_MACHINE_HEADER #ifndef GRUB_SERIAL_HEADER
#define GRUB_SERIAL_MACHINE_HEADER 1 #define GRUB_SERIAL_HEADER 1
/* Macros. */ /* Macros. */

View file

@ -54,7 +54,7 @@ static const struct grub_arg_option options[] =
/* Serial port settings. */ /* Serial port settings. */
struct serial_port struct serial_port
{ {
unsigned short port; grub_port_t port;
unsigned short divisor; unsigned short divisor;
unsigned short word_len; unsigned short word_len;
unsigned int parity; unsigned int parity;
@ -68,12 +68,12 @@ static struct serial_port serial_settings;
static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR; static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR;
#define GRUB_SERIAL_PORT_NUM 4 #define GRUB_SERIAL_PORT_NUM 4
#else #else
static const unsigned short serial_hw_io_addr[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; static const grub_port_t serial_hw_io_addr[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
#define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr)) #define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr))
#endif #endif
/* Return the port number for the UNITth serial device. */ /* Return the port number for the UNITth serial device. */
static inline unsigned short static inline grub_port_t
serial_hw_get_port (const unsigned int unit) serial_hw_get_port (const unsigned int unit)
{ {
if (unit < GRUB_SERIAL_PORT_NUM) if (unit < GRUB_SERIAL_PORT_NUM)
@ -503,7 +503,7 @@ grub_cmd_serial (grub_extcmd_t cmd,
} }
if (state[1].set) if (state[1].set)
serial_settings.port = (unsigned short) grub_strtoul (state[1].arg, 0, 0); serial_settings.port = (grub_port_t) grub_strtoul (state[1].arg, 0, 0);
if (state[2].set) if (state[2].set)
{ {