⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 avmcard.h

📁 讲述linux的初始化过程
💻 H
📖 第 1 页 / 共 2 页
字号:
	b1_put_byte(base, val & 0xff);	b1_put_byte(base, (val >> 8) & 0xff);	b1_put_byte(base, (val >> 16) & 0xff);	b1_put_byte(base, (val >> 24) & 0xff);}static inline unsigned int b1_get_slice(unsigned int base,					unsigned char *dp){	unsigned int len, i;	len = i = b1_get_word(base);	while (i-- > 0) *dp++ = b1_get_byte(base);	return len;}static inline void b1_put_slice(unsigned int base,				unsigned char *dp, unsigned int len){	unsigned i = len;	b1_put_word(base, i);	while (i-- > 0)		b1_put_byte(base, *dp++);}static void b1_wr_reg(unsigned int base,                      unsigned int reg,		      unsigned int value){	b1_put_byte(base, WRITE_REGISTER);        b1_put_word(base, reg);        b1_put_word(base, value);}static inline unsigned int b1_rd_reg(unsigned int base,                                     unsigned int reg){	b1_put_byte(base, READ_REGISTER);        b1_put_word(base, reg);        return b1_get_word(base);	}static inline void b1_reset(unsigned int base){	b1outp(base, B1_RESET, 0);	mdelay(55 * 2);	/* 2 TIC's */	b1outp(base, B1_RESET, 1);	mdelay(55 * 2);	/* 2 TIC's */	b1outp(base, B1_RESET, 0);	mdelay(55 * 2);	/* 2 TIC's */}static inline unsigned char b1_disable_irq(unsigned int base){	return b1outp(base, B1_INSTAT, 0x00);}/* ---------------------------------------------------------------- */static inline void b1_set_test_bit(unsigned int base,				   enum avmcardtype cardtype,				   int onoff){    b1_wr_reg(base, B1_STAT0(cardtype), onoff ? 0x21 : 0x20);}static inline int b1_get_test_bit(unsigned int base,                                  enum avmcardtype cardtype){    return (b1_rd_reg(base, B1_STAT0(cardtype)) & 0x01) != 0;}/* ---------------------------------------------------------------- */#define T1_FASTLINK		0x00#define T1_SLOWLINK		0x08#define T1_READ			B1_READ#define T1_WRITE		B1_WRITE#define T1_INSTAT		B1_INSTAT#define T1_OUTSTAT		B1_OUTSTAT#define T1_IRQENABLE		0x05#define T1_FIFOSTAT		0x06#define T1_RESETLINK		0x10#define T1_ANALYSE		0x11#define T1_IRQMASTER		0x12#define T1_IDENT		0x17#define T1_RESETBOARD		0x1f#define	T1F_IREADY		0x01#define	T1F_IHALF		0x02#define	T1F_IFULL		0x04#define	T1F_IEMPTY		0x08#define	T1F_IFLAGS		0xF0#define	T1F_OREADY		0x10#define	T1F_OHALF		0x20#define	T1F_OEMPTY		0x40#define	T1F_OFULL		0x80#define	T1F_OFLAGS		0xF0/* there are HEMA cards with 1k and 4k FIFO out */#define FIFO_OUTBSIZE		256#define FIFO_INPBSIZE		512#define HEMA_VERSION_ID		0#define HEMA_PAL_ID		0static inline void t1outp(unsigned int base,			  unsigned short offset,			  unsigned char value){	outb(value, base + offset);}static inline unsigned char t1inp(unsigned int base,			          unsigned short offset){	return inb(base + offset);}static inline int t1_isfastlink(unsigned int base){	return (inb(base + T1_IDENT) & ~0x82) == 1;}static inline unsigned char t1_fifostatus(unsigned int base){	return inb(base + T1_FIFOSTAT);}static inline unsigned int t1_get_slice(unsigned int base,					unsigned char *dp){	unsigned int len, i;#ifdef FASTLINK_DEBUG	unsigned wcnt = 0, bcnt = 0;#endif	len = i = b1_get_word(base);        if (t1_isfastlink(base)) {		int status;		while (i > 0) {			status = t1_fifostatus(base) & (T1F_IREADY|T1F_IHALF);			if (i >= FIFO_INPBSIZE) status |= T1F_IFULL;			switch (status) {				case T1F_IREADY|T1F_IHALF|T1F_IFULL:					insb(base+B1_READ, dp, FIFO_INPBSIZE);					dp += FIFO_INPBSIZE;					i -= FIFO_INPBSIZE;#ifdef FASTLINK_DEBUG					wcnt += FIFO_INPBSIZE;#endif					break;				case T1F_IREADY|T1F_IHALF: 					insb(base+B1_READ,dp, i);#ifdef FASTLINK_DEBUG					wcnt += i;#endif					dp += i;					i = 0;					if (i == 0)						break;					/* fall through */				default:					*dp++ = b1_get_byte(base);					i--;#ifdef FASTLINK_DEBUG					bcnt++;#endif					break;			}	    }#ifdef FASTLINK_DEBUG	    if (wcnt)	    printk(KERN_DEBUG "b1lli(0x%x): get_slice l=%d w=%d b=%d\n",				base, len, wcnt, bcnt);#endif	} else {		while (i-- > 0)			*dp++ = b1_get_byte(base);	}	return len;}static inline void t1_put_slice(unsigned int base,				unsigned char *dp, unsigned int len){	unsigned i = len;	b1_put_word(base, i);        if (t1_isfastlink(base)) {		int status;		while (i > 0) {			status = t1_fifostatus(base) & (T1F_OREADY|T1F_OHALF);			if (i >= FIFO_OUTBSIZE) status |= T1F_OEMPTY;			switch (status) {				case T1F_OREADY|T1F_OHALF|T1F_OEMPTY: 					outsb(base+B1_WRITE, dp, FIFO_OUTBSIZE);					dp += FIFO_OUTBSIZE;					i -= FIFO_OUTBSIZE;					break;				case T1F_OREADY|T1F_OHALF: 					outsb(base+B1_WRITE, dp, i);					dp += i;					i = 0;				        break;				default:					b1_put_byte(base, *dp++);					i--;					break;			}		}	} else {		while (i-- > 0)			b1_put_byte(base, *dp++);	}}static inline void t1_disable_irq(unsigned int base){      t1outp(base, T1_IRQMASTER, 0x00);}static inline void t1_reset(unsigned int base){        /* reset T1 Controller */        b1_reset(base);        /* disable irq on HEMA */        t1outp(base, B1_INSTAT, 0x00);        t1outp(base, B1_OUTSTAT, 0x00);        t1outp(base, T1_IRQMASTER, 0x00);        /* reset HEMA board configuration */	t1outp(base, T1_RESETBOARD, 0xf);}static inline void b1_setinterrupt(unsigned int base, unsigned irq,				   enum avmcardtype cardtype){	switch (cardtype) {	   case avm_t1isa:              t1outp(base, B1_INSTAT, 0x00);              t1outp(base, B1_INSTAT, 0x02);	      t1outp(base, T1_IRQMASTER, 0x08);	      break;	   case avm_b1isa:	      b1outp(base, B1_INSTAT, 0x00);	      b1outp(base, B1_RESET, b1_irq_table[irq]);	      b1outp(base, B1_INSTAT, 0x02);	      break;	   default:	   case avm_m1:	   case avm_m2:	   case avm_b1pci:	      b1outp(base, B1_INSTAT, 0x00);	      b1outp(base, B1_RESET, 0xf0);	      b1outp(base, B1_INSTAT, 0x02);	      break;	   case avm_c4:	   case avm_t1pci:	      b1outp(base, B1_RESET, 0xf0);	      break;	 }}/* b1.c */int b1_detect(unsigned int base, enum avmcardtype cardtype);void b1_getrevision(avmcard *card);int b1_load_t4file(avmcard *card, capiloaddatapart * t4file);int b1_load_config(avmcard *card, capiloaddatapart * config);int b1_loaded(avmcard *card);int b1_load_firmware(struct capi_ctr *ctrl, capiloaddata *data);void b1_reset_ctr(struct capi_ctr *ctrl);void b1_register_appl(struct capi_ctr *ctrl, __u16 appl,				capi_register_params *rp);void b1_release_appl(struct capi_ctr *ctrl, __u16 appl);void b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);void b1_parse_version(avmctrl_info *card);void b1_handle_interrupt(avmcard * card);int b1ctl_read_proc(char *page, char **start, off_t off,        		int count, int *eof, struct capi_ctr *ctrl);/* b1dma.c */int b1pciv4_detect(avmcard *card);int t1pci_detect(avmcard *card);void b1dma_reset(avmcard *card);void b1dma_interrupt(int interrupt, void *devptr, struct pt_regs *regs);int b1dma_load_firmware(struct capi_ctr *ctrl, capiloaddata *data);void b1dma_reset_ctr(struct capi_ctr *ctrl);void b1dma_remove_ctr(struct capi_ctr *ctrl);void b1dma_register_appl(struct capi_ctr *ctrl,				__u16 appl,				capi_register_params *rp);void b1dma_release_appl(struct capi_ctr *ctrl, __u16 appl);void b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);int b1dmactl_read_proc(char *page, char **start, off_t off,        		int count, int *eof, struct capi_ctr *ctrl);#endif /* _AVMCARD_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -