Commit 596e49ed authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Un-inline jade_irq.c

Same thing which just happened to hscx_irq.c - Use the struct
bc_hw_ops instead of macros and inlining.
parent 7700b02a
......@@ -78,71 +78,69 @@ writefifo(unsigned int ale, unsigned long adr, u8 off, u8 * data, int size)
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return (readreg(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, offset));
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
ReadJADE(struct IsdnCardState *cs, int jade, u8 offset)
jade_read(struct IsdnCardState *cs, int jade, u8 offset)
{
return (readreg(cs->hw.ax.jade_ale, cs->hw.ax.jade_adr, offset + (jade == -1 ? 0 : (jade ? 0xC0 : 0x80))));
return readreg(cs->hw.ax.jade_ale, cs->hw.ax.jade_adr, offset + (jade == -1 ? 0 : (jade ? 0xC0 : 0x80)));
}
static void
WriteJADE(struct IsdnCardState *cs, int jade, u8 offset, u8 value)
jade_write(struct IsdnCardState *cs, int jade, u8 offset, u8 value)
{
writereg(cs->hw.ax.jade_ale, cs->hw.ax.jade_adr, offset + (jade == -1 ? 0 : (jade ? 0xC0 : 0x80)), value);
}
static struct bc_hw_ops jade_ops = {
.read_reg = ReadJADE,
.write_reg = WriteJADE,
};
/*
* fast interrupt JADE stuff goes here
*/
#define READJADE(cs, nr, reg) readreg(cs->hw.ax.jade_ale,\
cs->hw.ax.jade_adr, reg + (nr == -1 ? 0 : (nr ? 0xC0 : 0x80)))
#define WRITEJADE(cs, nr, reg, data) writereg(cs->hw.ax.jade_ale,\
cs->hw.ax.jade_adr, reg + (nr == -1 ? 0 : (nr ? 0xC0 : 0x80)), data)
static void
jade_read_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size)
{
readfifo(cs->hw.ax.jade_ale, cs->hw.ax.jade_adr,
(hscx == -1 ? 0 : (hscx ? 0xc0 : 0x80)), data, size);
}
#define READJADEFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.ax.jade_ale,\
cs->hw.ax.jade_adr, (nr == -1 ? 0 : (nr ? 0xC0 : 0x80)), ptr, cnt)
#define WRITEJADEFIFO(cs, nr, ptr, cnt) writefifo( cs->hw.ax.jade_ale,\
cs->hw.ax.jade_adr, (nr == -1 ? 0 : (nr ? 0xC0 : 0x80)), ptr, cnt)
static void
jade_write_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size)
{
writefifo(cs->hw.ax.jade_ale, cs->hw.ax.jade_adr,
(hscx == -1 ? 0 : (hscx ? 0xc0 : 0x80)), data, size);
}
#include "jade_irq.c"
static struct bc_hw_ops jade_ops = {
.read_reg = jade_read,
.write_reg = jade_write,
.read_fifo = jade_read_fifo,
.write_fifo = jade_write_fifo,
};
static void
bkm_interrupt(int intno, void *dev_id, struct pt_regs *regs)
......
......@@ -32,6 +32,24 @@ jade_write_reg(struct IsdnCardState *cs, int jade, u8 addr, u8 val)
cs->bc_hw_ops->write_reg(cs, jade, addr, val);
}
static inline void
jade_read_fifo(struct BCState *bcs, u8 *p, int len)
{
struct IsdnCardState *cs = bcs->cs;
u8 hscx = bcs->hw.hscx.hscx;
cs->bc_hw_ops->read_fifo(cs, hscx, p, len);
}
static inline void
jade_write_fifo(struct BCState *bcs, u8 *p, int len)
{
struct IsdnCardState *cs = bcs->cs;
u8 hscx = bcs->hw.hscx.hscx;
cs->bc_hw_ops->write_fifo(cs, hscx, p, len);
}
int __init
JadeVersion(struct IsdnCardState *cs, char *s)
{
......@@ -296,3 +314,4 @@ initjade(struct IsdnCardState *cs)
modejade(cs->bcs + 1, 0, 0);
}
#include "jade_irq.c"
......@@ -131,5 +131,8 @@ extern int JadeVersion(struct IsdnCardState *cs, char *s);
extern void jade_sched_event(struct BCState *bcs, int event);
extern void modejade(struct BCState *bcs, int mode, int bc);
extern void initjade(struct IsdnCardState *cs);
extern void jade_int_main(struct IsdnCardState *cs, u_char val, int jade);
extern void jade_fill_fifo(struct BCState *bcs);
#endif /* __JADE_H__ */
......@@ -16,7 +16,7 @@ waitforCEC(struct IsdnCardState *cs, int jade, int reg)
{
int to = 50;
int mask = (reg == jade_HDLC_XCMD ? jadeSTAR_XCEC : jadeSTAR_RCEC);
while ((READJADE(cs, jade, jade_HDLC_STAR) & mask) && to) {
while ((jade_read_reg(cs, jade, jade_HDLC_STAR) & mask) && to) {
udelay(1);
to--;
}
......@@ -38,7 +38,7 @@ WriteJADECMDR(struct IsdnCardState *cs, int jade, int reg, u8 data)
spin_lock_irqsave(&jade_irq_lock, flags);
waitforCEC(cs, jade, reg);
WRITEJADE(cs, jade, reg, data);
jade_write_reg(cs, jade, reg, data);
spin_unlock_irqrestore(&jade_irq_lock, flags);
}
......@@ -62,7 +62,7 @@ jade_empty_fifo(struct BCState *bcs, int count)
}
ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx;
bcs->hw.hscx.rcvidx += count;
READJADEFIFO(cs, bcs->hw.hscx.hscx, ptr, count);
jade_read_fifo(bcs, ptr, count);
WriteJADECMDR(cs, bcs->hw.hscx.hscx, jade_HDLC_RCMD, jadeRCMD_RMC);
if (cs->debug & L1_DEB_HSCX_FIFO) {
char *t = bcs->blog;
......@@ -74,7 +74,7 @@ jade_empty_fifo(struct BCState *bcs, int count)
}
}
static void
void
jade_fill_fifo(struct BCState *bcs)
{
struct IsdnCardState *cs = bcs->cs;
......@@ -88,7 +88,7 @@ jade_fill_fifo(struct BCState *bcs)
return;
waitforXFW(cs, hscx);
WRITEJADEFIFO(cs, hscx, p, count);
jade_write_fifo(bcs, p, count);
WriteJADECMDR(cs, hscx, jade_HDLC_XCMD,
more ? jadeXCMD_XF : (jadeXCMD_XF|jadeXCMD_XME));
}
......@@ -108,7 +108,7 @@ jade_interrupt(struct IsdnCardState *cs, u8 val, u8 jade)
return;
if (val & 0x80) { /* RME */
r = READJADE(cs, i_jade, jade_HDLC_RSTA);
r = jade_read_reg(cs, i_jade, jade_HDLC_RSTA);
if ((r & 0xf0) != 0xa0) {
if (!(r & 0x80))
if (cs->debug & L1_DEB_WARN)
......@@ -121,7 +121,7 @@ jade_interrupt(struct IsdnCardState *cs, u8 val, u8 jade)
debugl1(cs, "JADE %c CRC error", 'A'+jade);
WriteJADECMDR(cs, jade, jade_HDLC_RCMD, jadeRCMD_RMC);
} else {
count = READJADE(cs, i_jade, jade_HDLC_RBCL) & 0x1F;
count = jade_read_reg(cs, i_jade, jade_HDLC_RBCL) & 0x1F;
if (count == 0)
count = fifo_size;
jade_empty_fifo(bcs, count);
......@@ -164,7 +164,7 @@ reset_xmit(struct BCState *bcs)
WriteJADECMDR(bcs->cs, bcs->hw.hscx.hscx, jade_HDLC_XCMD, jadeXCMD_XRES);
}
static inline void
void
jade_int_main(struct IsdnCardState *cs, u8 val, int jade)
{
struct BCState *bcs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment