Ignore:
Timestamp:
2006-10-14T19:31:03Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3890b3f
Parents:
7dcf22a
Message:

Changes in ns16550 and z8530 drivers.
Add some stuff for IRQ notifications to irq_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/drivers/z8530.h

    r7dcf22a r63530c62  
    9292#define RR0_RCA         (0x1<<0)        /** Receive Character Available. */
    9393
    94 static inline void z8530_write(index_t chan, uint8_t reg, uint8_t val)
     94/** Structure representing the z8530 device. */
     95typedef struct {
     96        devno_t devno;
     97        volatile uint8_t *reg;          /** Memory mapped registers of the z8530. */
     98} z8530_t;
     99
     100static inline void z8530_write(z8530_t *dev, index_t chan, uint8_t reg, uint8_t val)
    95101{
    96102        /*
     
    98104         * command as their bit 3 is 1.
    99105         */
    100         kbd_virt_address[WR0+chan] = reg;       /* select register */
    101         kbd_virt_address[WR0+chan] = val;       /* write value */
     106        dev->reg[WR0+chan] = reg;       /* select register */
     107        dev->reg[WR0+chan] = val;       /* write value */
    102108}
    103109
    104 static inline void z8530_write_a(uint8_t reg, uint8_t val)
     110static inline void z8530_write_a(z8530_t *dev, uint8_t reg, uint8_t val)
    105111{
    106         z8530_write(Z8530_CHAN_A, reg, val);
     112        z8530_write(dev, Z8530_CHAN_A, reg, val);
    107113}
    108 static inline void z8530_write_b(uint8_t reg, uint8_t val)
     114static inline void z8530_write_b(z8530_t *dev, uint8_t reg, uint8_t val)
    109115{
    110         z8530_write(Z8530_CHAN_B, reg, val);
     116        z8530_write(dev, Z8530_CHAN_B, reg, val);
    111117}
    112118
    113 static inline uint8_t z8530_read(index_t chan, uint8_t reg)
     119static inline uint8_t z8530_read(z8530_t *dev, index_t chan, uint8_t reg)
    114120{
    115121        /*
     
    117123         * command as their bit 3 is 1.
    118124         */
    119         kbd_virt_address[WR0+chan] = reg;       /* select register */
    120         return kbd_virt_address[WR0+chan];
     125        dev->reg[WR0+chan] = reg;       /* select register */
     126        return dev->reg[WR0+chan];
    121127}
    122128
    123 static inline uint8_t z8530_read_a(uint8_t reg)
     129static inline uint8_t z8530_read_a(z8530_t *dev, uint8_t reg)
    124130{
    125         return z8530_read(Z8530_CHAN_A, reg);
     131        return z8530_read(dev, Z8530_CHAN_A, reg);
    126132}
    127 static inline uint8_t z8530_read_b(uint8_t reg)
     133static inline uint8_t z8530_read_b(z8530_t *dev, uint8_t reg)
    128134{
    129         return z8530_read(Z8530_CHAN_B, reg);
     135        return z8530_read(dev, Z8530_CHAN_B, reg);
    130136}
    131137
Note: See TracChangeset for help on using the changeset viewer.