X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fisicom.h;h=f9974634b833fb1f323d75689caa05094e99da32;hb=a9fdee76789476a10f923f9fb3c84993042da3ac;hp=7c6eae7f6ed73cacc5ab81268684020bd768bac1;hpb=8d40237c730b8be87c1b80a5d96b9c603fefa829;p=linux-2.6.git diff --git a/include/linux/isicom.h b/include/linux/isicom.h index 7c6eae7f6..f9974634b 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h @@ -125,6 +125,179 @@ typedef struct { #define ISI_TXOK 0x0001 +struct isi_board { + unsigned short base; + unsigned char irq; + unsigned char port_count; + unsigned short status; + unsigned short port_status; /* each bit represents a single port */ + unsigned short shift_count; + struct isi_port * ports; + signed char count; + unsigned char isa; +}; + +struct isi_port { + unsigned short magic; + unsigned int flags; + int count; + int blocked_open; + int close_delay; + unsigned short channel; + unsigned short status; + unsigned short closing_wait; + struct isi_board * card; + struct tty_struct * tty; + wait_queue_head_t close_wait; + wait_queue_head_t open_wait; + struct work_struct hangup_tq; + struct work_struct bh_tqueue; + unsigned char * xmit_buf; + int xmit_head; + int xmit_tail; + int xmit_cnt; +}; + + +/* + * ISI Card specific ops ... + */ + +static inline void raise_dtr(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_dtr.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0504, base); + InterruptTheCard(base); + port->status |= ISI_DTR; +} + +static inline void drop_dtr(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_dtr.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0404, base); + InterruptTheCard(base); + port->status &= ~ISI_DTR; +} +static inline void raise_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0a04, base); + InterruptTheCard(base); + port->status |= ISI_RTS; +} +static inline void drop_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0804, base); + InterruptTheCard(base); + port->status &= ~ISI_RTS; +} +static inline void raise_dtr_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0f04, base); + InterruptTheCard(base); + port->status |= (ISI_DTR | ISI_RTS); +} +static inline void drop_dtr_rts(struct isi_port * port) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n"); + return; + } +#ifdef ISICOM_DEBUG_DTR_RTS + printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n"); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw(0x0c04, base); + InterruptTheCard(base); + port->status &= ~(ISI_RTS | ISI_DTR); +} + +static inline void kill_queue(struct isi_port * port, short queue) +{ + struct isi_board * card = port->card; + unsigned short base = card->base; + unsigned char channel = port->channel; + short wait=400; + while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); + if (wait <= 0) { + printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n"); + return; + } +#ifdef ISICOM_DEBUG + printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue); +#endif + outw(0x8000 | (channel << card->shift_count) | 0x02 , base); + outw((queue << 8) | 0x06, base); + InterruptTheCard(base); +} + #endif /* __KERNEL__ */ #endif /* ISICOM_H */