00001 /*! \file include/kernel/serial.h 00002 * \brief Serial/RS232 port driver header. 00003 * \author Andrea Righi <drizzt@inwind.it> 00004 * \date Last update: 2003-11-08 00005 * \note Copyright (©) 2003 Andrea Righi 00006 */ 00007 00008 #ifndef SERIAL_H 00009 #define SERIAL_H 00010 00011 //! Serial port base address (for COM1). 00012 #define PORT1 0x3F8 00013 //! Serial port base address (for COM2). 00014 #define PORT2 0x2F8 00015 //! Serial port base address (for COM3). 00016 #define PORT3 0x3E8 00017 //! Serial port base address (for COM4). 00018 #define PORT4 0x2E8 00019 00020 //! COM1 port address. 00021 #define COM1 PORT1 00022 //! COM2 port address. 00023 #define COM2 PORT2 00024 //! COM3 port address. 00025 #define COM3 PORT3 00026 //! COM4 port address. 00027 #define COM4 PORT4 00028 00029 // --- Baud rates ----------------------------------------------------- // 00030 00031 #define BPS_115200 0x01 //!< 115,200 BPS. 00032 #define BPS_56700 0x02 //!< 56,700 BPS. 00033 #define BPS_38400 0x03 //!< 38,400 BPS. 00034 #define BPS_19200 0x06 //!< 19,200 BPS. 00035 #define BPS_9600 0x0C //!< 9,600 BPS. 00036 #define BPS_4800 0x18 //!< 4,800 BPS. 00037 #define BPS_2400 0x30 //!< 2,400 BPS. 00038 00039 //! RS232 buffer size. 00040 #define RS232_BUF_DIM 256 00041 00042 // --- Prototypes ----------------------------------------------------- // 00043 00044 void rs232_handler(word port); 00045 void init_rs232(word port, byte divisor); 00046 void close_rs232(word port); 00047 byte rs232_getchar(); 00048 void rs232_putchar(byte c); 00049 void rs232_chat(); 00050 00051 #endif