Refactor function calls to use 24xx device instead of mem32 pointer

parent eb1d4f16
......@@ -4,7 +4,8 @@
* Written by MiaoLin<miaolin@openvox.cn>
* $Id: a24xx.c 185 2010-12-14 07:58:51Z yangshugang $
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd,
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd
* Copyright (C) 2022 Raptor Engineering, LLC
*
* All rights reserved.
*
......@@ -98,19 +99,19 @@ void __a24xx_setcard(void *wc_dev, int card)
{
struct a24xx_dev *dev = (struct a24xx_dev *)(wc_dev);
if (dev->curcard != card) {
__opvx_a24xx_setcard(dev->mem32, card);
__opvx_a24xx_setcard(dev, card);
dev->curcard = card;
}
}
inline void __a24xx_spi_setreg(struct a24xx_dev *wc_dev, int card, unsigned char reg, unsigned char value)
{
__opvx_a24xx_spi_setreg((void *)wc_dev, wc_dev->mem32, card, wc_dev->modtype[card], reg, value, __a24xx_setcard);
__opvx_a24xx_spi_setreg((void *)wc_dev, wc_dev, card, wc_dev->modtype[card], reg, value, __a24xx_setcard);
}
inline unsigned char __a24xx_spi_getreg(struct a24xx_dev *wc_dev, int card, unsigned char reg)
{
return __opvx_a24xx_spi_getreg((void *)wc_dev, wc_dev->mem32, card, wc_dev->modtype[card], reg, __a24xx_setcard);
return __opvx_a24xx_spi_getreg((void *)wc_dev, wc_dev, card, wc_dev->modtype[card], reg, __a24xx_setcard);
}
int __a24xx_malloc_chunk(struct a24xx_dev *wc_dev,unsigned int frq)
......@@ -211,9 +212,9 @@ void __a24xx_vpm_setpresent(struct a24xx_dev *wc_dev)
{
wc_dev->vpm = BIT_EC_PRESENT;
if ( (wc_dev->fwversion&0xffff) > 0x3)
__opvx_a24xx_vpm_setpresent_v2(wc_dev->mem32);
__opvx_a24xx_vpm_setpresent_v2(wc_dev);
else
__opvx_a24xx_vpm_setpresent(wc_dev->mem32);
__opvx_a24xx_vpm_setpresent(wc_dev);
printk("OpenVox VPM: Present and operational servicing %d span(s)\n", 1/*wc_dev->numspans*/);
}
......@@ -242,9 +243,9 @@ static inline unsigned int a24xx_oct_in(struct a24xx_dev *wc_dev, const unsigned
spin_lock_irqsave(&wc_dev->lock, flags);
if ( (wc_dev->fwversion&0xffff) > 0x3)
ret = __opvx_a24xx_oct_in_v2(wc_dev->mem32, addr);
ret = __opvx_a24xx_oct_in_v2(wc_dev, addr);
else
ret = __opvx_a24xx_oct_in(wc_dev->mem32, addr);
ret = __opvx_a24xx_oct_in(wc_dev, addr);
spin_unlock_irqrestore(&wc_dev->lock, flags);
return ret;
......@@ -256,9 +257,9 @@ static inline void a24xx_oct_out(struct a24xx_dev *wc_dev, const unsigned int ad
spin_lock_irqsave(&wc_dev->lock, flags);
if ( (wc_dev->fwversion&0xffff) > 0x3)
__opvx_a24xx_oct_out_v2(wc_dev->mem32, addr, value);
__opvx_a24xx_oct_out_v2(wc_dev, addr, value);
else
__opvx_a24xx_oct_out(wc_dev->mem32, addr, value);
__opvx_a24xx_oct_out(wc_dev, addr, value);
spin_unlock_irqrestore(&wc_dev->lock, flags);
}
......
This diff is collapsed.
......@@ -4,7 +4,8 @@
* Written by MiaoLin<miaolin@openvox.cn>
* $Id: base.h 360 2011-04-06 06:11:45Z yangshugang $
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd,
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd
* Copyright (C) 2022 Raptor Engineering, LLC
*
* All rights reserved.
*
......@@ -240,46 +241,46 @@ struct a24xx {
/*
* from bin
*/
extern void __opvx_a24xx_setcreg(unsigned long mem32, unsigned int offset, unsigned int reg, unsigned int val);
extern unsigned int __opvx_a24xx_getcreg(unsigned long mem32, unsigned int offset, unsigned char reg);
extern unsigned char __opvx_a24xx_read_8bits(unsigned long mem32);
extern void __opvx_a24xx_setcreg(struct a24xx_dev *wc, unsigned int offset, unsigned int reg, unsigned int val);
extern unsigned int __opvx_a24xx_getcreg(struct a24xx_dev *wc, unsigned int offset, unsigned char reg);
extern unsigned char __opvx_a24xx_read_8bits(struct a24xx_dev *wc);
extern void __opvx_a24xx_reset_modules(unsigned long mem32, void (*func)(int), int data);
extern void __opvx_a24xx_reset_modules_v2(unsigned long mem32, void (*func)(int), int data);
extern void __opvx_a24xx_setcard(unsigned long mem32, int card);
extern void __opvx_a24xx_reset_modules(struct a24xx_dev *wc, void (*func)(int), int data);
extern void __opvx_a24xx_reset_modules_v2(struct a24xx_dev *wc, void (*func)(int), int data);
extern void __opvx_a24xx_setcard(struct a24xx_dev *wc, int card);
extern void __opvx_a24xx_reset_spi(void *wc_dev, int card, void (*func)(void*, int));
extern void __opvx_a24xx_write_8bits(unsigned long mem32, unsigned char bits);
extern void __opvx_a24xx_set_master(unsigned long mem32,unsigned int master);
extern unsigned int __opvx_a24xx_get_master(unsigned long mem32);
extern void __opvx_a24xx_set_irq_frq(unsigned long mem32,unsigned int frq);
extern unsigned int __opvx_a24xx_get_version(unsigned long mem32);
extern unsigned int __opvx_a24xx_get_irqstatus(unsigned long mem32);
extern void __opvx_a24xx_set_irqstatus(unsigned long mem32, unsigned int value);
extern void __opvx_a24xx_clear_irqs(unsigned long mem32);
extern void __opvx_a24xx_enable_interrupts(unsigned long mem32);
extern void __opvx_a24xx_disable_interrupts(unsigned long mem32);
extern unsigned int __opvx_a24xx_get_irqcnt_lo(unsigned long mem32);
extern void __opvx_a24xx_restart_dma(unsigned long mem32);
extern void __opvx_a24xx_start_dma(unsigned long mem32, unsigned int data);
extern void __opvx_a24xx_stop_dma(unsigned long mem32);
extern void __opvx_a24xx_reset_tdm(unsigned long mem32);
extern void __opvx_a24xx_spi_setreg(void *wc_dev, unsigned long mem32, int card, int modtype, unsigned char reg, unsigned char value, void (*func)(void*, int));
extern unsigned char __opvx_a24xx_spi_getreg(void *wc_dev, unsigned long mem32, int card, int modtype, unsigned char reg, void (*func)(void*, int));
extern unsigned int __opvx_a24xx_oct_in(unsigned long mem32, unsigned int addr);
extern unsigned int __opvx_a24xx_oct_in_v2(unsigned long mem32, unsigned int addr);
extern void __opvx_a24xx_oct_out(unsigned long mem32, unsigned int addr, unsigned int value);
extern void __opvx_a24xx_oct_out_v2(unsigned long mem32, unsigned int addr, unsigned int value);
extern int __opvx_a24xx_check_vpm(unsigned long mem32);
extern int __opvx_a24xx_check_vpm_v2(unsigned long mem32);
extern void __opvx_a24xx_vpm_setpresent(unsigned long mem32);
extern void __opvx_a24xx_vpm_setpresent_v2(unsigned long mem32);
extern void __opvx_a24xx_transmit(unsigned long mem32, volatile unsigned char *writechunk, volatile unsigned char **txbuf,unsigned int irq_frq , unsigned int order);
extern void __opvx_a24xx_receive(unsigned long mem32, volatile unsigned char *readchunk, volatile unsigned char **rxbuf,unsigned int irq_frq , unsigned int order);
extern void __opvx_a24xx_write_8bits(struct a24xx_dev *wc, unsigned char bits);
extern void __opvx_a24xx_set_master(struct a24xx_dev *wc,unsigned int master);
extern unsigned int __opvx_a24xx_get_master(struct a24xx_dev *wc);
extern void __opvx_a24xx_set_irq_frq(struct a24xx_dev *wc,unsigned int frq);
extern unsigned int __opvx_a24xx_get_version(struct a24xx_dev *wc);
extern unsigned int __opvx_a24xx_get_irqstatus(struct a24xx_dev *wc);
extern void __opvx_a24xx_set_irqstatus(struct a24xx_dev *wc, unsigned int value);
extern void __opvx_a24xx_clear_irqs(struct a24xx_dev *wc);
extern void __opvx_a24xx_enable_interrupts(struct a24xx_dev *wc);
extern void __opvx_a24xx_disable_interrupts(struct a24xx_dev *wc);
extern unsigned int __opvx_a24xx_get_irqcnt_lo(struct a24xx_dev *wc);
extern void __opvx_a24xx_restart_dma(struct a24xx_dev *wc);
extern void __opvx_a24xx_start_dma(struct a24xx_dev *wc, unsigned int data);
extern void __opvx_a24xx_stop_dma(struct a24xx_dev *wc);
extern void __opvx_a24xx_reset_tdm(struct a24xx_dev *wc);
extern void __opvx_a24xx_spi_setreg(void *wc_dev, struct a24xx_dev *wc, int card, int modtype, unsigned char reg, unsigned char value, void (*func)(void*, int));
extern unsigned char __opvx_a24xx_spi_getreg(void *wc_dev, struct a24xx_dev *wc, int card, int modtype, unsigned char reg, void (*func)(void*, int));
extern unsigned int __opvx_a24xx_oct_in(struct a24xx_dev *wc, unsigned int addr);
extern unsigned int __opvx_a24xx_oct_in_v2(struct a24xx_dev *wc, unsigned int addr);
extern void __opvx_a24xx_oct_out(struct a24xx_dev *wc, unsigned int addr, unsigned int value);
extern void __opvx_a24xx_oct_out_v2(struct a24xx_dev *wc, unsigned int addr, unsigned int value);
extern int __opvx_a24xx_check_vpm(struct a24xx_dev *wc);
extern int __opvx_a24xx_check_vpm_v2(struct a24xx_dev *wc);
extern void __opvx_a24xx_vpm_setpresent(struct a24xx_dev *wc);
extern void __opvx_a24xx_vpm_setpresent_v2(struct a24xx_dev *wc);
extern void __opvx_a24xx_transmit(struct a24xx_dev *wc, volatile unsigned char *writechunk, volatile unsigned char **txbuf,unsigned int irq_frq , unsigned int order);
extern void __opvx_a24xx_receive(struct a24xx_dev *wc, volatile unsigned char *readchunk, volatile unsigned char **rxbuf,unsigned int irq_frq , unsigned int order);
extern void __opvx_a24xx_set_chunk(void *readchunk, void *writechunk,unsigned int frq);
......
This diff is collapsed.
......@@ -5,7 +5,8 @@
* Written by mark.liu<mark.liu@openvox.cn>
* $Id: si321x.c 482 2011-06-02 08:58:56Z liuyuan $
*
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd,
* Copyright (C) 2005-2010 OpenVox Communication Co. Ltd
* Copyright (C) 2022 Raptor Engineering, LLC
*
* All rights reserved.
*
......@@ -1132,8 +1133,8 @@ int si321x_init_proslic_all(struct a24xx_dev *wc_dev, int fxs_flag,int fast, int
if(flag & (1 << i)){
if((i%4) == 0){
__a24xx_setcard(wc_dev, i);
__opvx_a24xx_write_8bits(wc_dev->mem32, 0x00);
__opvx_a24xx_write_8bits(wc_dev->mem32, 0x80);
__opvx_a24xx_write_8bits(wc_dev, 0x00);
__opvx_a24xx_write_8bits(wc_dev, 0x80);
}
/* Sanity check the ProSLIC */
......
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