Subversion Repositories HelenOS

Rev

Rev 3577 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3577 Rev 3646
Line 56... Line 56...
56
#define RBR_REG     0   /** Receiver Buffer Register. */
56
#define RBR_REG     0   /** Receiver Buffer Register. */
57
#define IER_REG     1   /** Interrupt Enable Register. */
57
#define IER_REG     1   /** Interrupt Enable Register. */
58
#define IIR_REG     2   /** Interrupt Ident Register (read). */
58
#define IIR_REG     2   /** Interrupt Ident Register (read). */
59
#define FCR_REG     2   /** FIFO control register (write). */
59
#define FCR_REG     2   /** FIFO control register (write). */
60
#define LCR_REG     3   /** Line Control register. */
60
#define LCR_REG     3   /** Line Control register. */
-
 
61
#define MCR_REG     4   /** Modem Control Register. */
61
#define LSR_REG     5   /** Line Status Register. */
62
#define LSR_REG     5   /** Line Status Register. */
62
 
63
 
63
#define IER_ERBFI   0x01    /** Enable Receive Buffer Full Interrupt. */
64
#define IER_ERBFI   0x01    /** Enable Receive Buffer Full Interrupt. */
64
 
65
 
65
#define LCR_DLAB    0x80    /** Divisor Latch Access bit. */
66
#define LCR_DLAB    0x80    /** Divisor Latch Access bit. */
66
 
67
 
-
 
68
#define MCR_OUT2    0x08    /** OUT2. */
-
 
69
 
67
/** Structure representing the ns16550 device. */
70
/** Structure representing the ns16550 device. */
68
typedef struct {
71
typedef struct {
69
    devno_t devno;
72
    devno_t devno;
70
    volatile ioport_t io_port;  /** Memory mapped registers of the ns16550. */
73
    /** Memory mapped registers of the ns16550. */
-
 
74
    volatile ioport_t io_port;
71
} ns16550_t;
75
} ns16550_t;
72
 
76
 
73
static inline uint8_t ns16550_rbr_read(ns16550_t *dev)
77
static inline uint8_t ns16550_rbr_read(ns16550_t *dev)
74
{
78
{
75
    return inb(dev->io_port+RBR_REG);
79
    return inb(dev->io_port + RBR_REG);
76
}
80
}
77
static inline void ns16550_rbr_write(ns16550_t *dev, uint8_t v)
81
static inline void ns16550_rbr_write(ns16550_t *dev, uint8_t v)
78
{
82
{
79
    outb(dev->io_port+RBR_REG,v);
83
    outb(dev->io_port + RBR_REG, v);
80
}
84
}
81
 
85
 
82
static inline uint8_t ns16550_ier_read(ns16550_t *dev)
86
static inline uint8_t ns16550_ier_read(ns16550_t *dev)
83
{
87
{
84
    return inb(dev->io_port+IER_REG);
88
    return inb(dev->io_port + IER_REG);
85
}
89
}
86
 
90
 
87
static inline void ns16550_ier_write(ns16550_t *dev, uint8_t v)
91
static inline void ns16550_ier_write(ns16550_t *dev, uint8_t v)
88
{
92
{
89
    outb(dev->io_port+IER_REG,v);
93
    outb(dev->io_port + IER_REG, v);
90
}
94
}
91
 
95
 
92
static inline uint8_t ns16550_iir_read(ns16550_t *dev)
96
static inline uint8_t ns16550_iir_read(ns16550_t *dev)
93
{
97
{
94
    return inb(dev->io_port+IIR_REG);
98
    return inb(dev->io_port + IIR_REG);
95
}
99
}
96
 
100
 
97
static inline void ns16550_fcr_write(ns16550_t *dev, uint8_t v)
101
static inline void ns16550_fcr_write(ns16550_t *dev, uint8_t v)
98
{
102
{
99
    outb(dev->io_port+FCR_REG,v);
103
    outb(dev->io_port + FCR_REG, v);
100
}
104
}
101
 
105
 
102
static inline uint8_t ns16550_lcr_read(ns16550_t *dev)
106
static inline uint8_t ns16550_lcr_read(ns16550_t *dev)
103
{
107
{
104
    return inb(dev->io_port+LCR_REG);
108
    return inb(dev->io_port + LCR_REG);
105
}
109
}
106
 
110
 
107
static inline void ns16550_lcr_write(ns16550_t *dev, uint8_t v)
111
static inline void ns16550_lcr_write(ns16550_t *dev, uint8_t v)
108
{
112
{
109
    outb(dev->io_port+LCR_REG,v);
113
    outb(dev->io_port + LCR_REG, v);
110
}
114
}
111
 
115
 
112
static inline uint8_t ns16550_lsr_read(ns16550_t *dev)
116
static inline uint8_t ns16550_lsr_read(ns16550_t *dev)
113
{
117
{
114
    return inb(dev->io_port+LSR_REG);
118
    return inb(dev->io_port + LSR_REG);
115
}
119
}
116
 
120
 
-
 
121
static inline uint8_t ns16550_mcr_read(ns16550_t *dev)
-
 
122
{
-
 
123
    return inb(dev->io_port + MCR_REG);
-
 
124
}
117
 
125
 
-
 
126
static inline void ns16550_mcr_write(ns16550_t *dev, uint8_t v)
-
 
127
{
-
 
128
    outb(dev->io_port + MCR_REG, v);
-
 
129
}
118
 
130
 
119
#endif
131
#endif
120
 
132
 
121
/** @}
133
/** @}
122
 */
134
 */