diff options
author | Holger Waechtler <devnull@localhost> | 2003-11-25 15:34:16 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-11-25 15:34:16 +0000 |
commit | ea594f01cb39d739763ccc2f386f9831323ec116 (patch) | |
tree | ede2f79feba62c9c3976675c44a192a8f9d550ae /linux | |
parent | d7be13e1fd1e2fc42ae256b5a7d5843ebe8dc9e5 (diff) | |
download | mediapointer-dvb-s2-ea594f01cb39d739763ccc2f386f9831323ec116.tar.gz mediapointer-dvb-s2-ea594f01cb39d739763ccc2f386f9831323ec116.tar.bz2 |
linux kernel coding style policy enforcement contributed by Robert Ragusa
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/b2c2/skystar2.c | 885 |
1 files changed, 444 insertions, 441 deletions
diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index f489539c1..e7635e502 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -7,6 +7,9 @@ * FIX: DISEQC Tone Burst in flexcop_diseqc_ioctl() * Vincenzo Di Massa, hawk.it at tiscalinet.it * + * IMP: Converted to Linux coding style + * Roberto Ragusa, r.ragusa at libero.it + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 @@ -45,8 +48,8 @@ static int debug = 0; #define dprintk(x...) do { if (debug) printk(x); } while (0) -#define SizeOfBufDMA1 0x3AC00 -#define SizeOfBufDMA2 0x758 +#define SIZE_OF_BUF_DMA1 0x3AC00 +#define SIZE_OF_BUF_DMA2 0x758 struct dmaq { @@ -75,13 +78,13 @@ struct adapter { u8 card_revision; u32 b2c2_revision; - u32 PidFilterMax; - u32 MacFilterMax; + u32 pid_filter_max; + u32 mac_filter_max; u32 irq; unsigned long io_mem; unsigned long io_port; u8 mac_addr[8]; - u32 dwSramType; + u32 dw_sram_type; struct dvb_adapter *dvb_adapter; struct dvb_demux demux; @@ -107,14 +110,14 @@ struct adapter { u32 mac_filter; }; -#define WriteRegDW(adapter,reg,value) writel(value, adapter->io_mem + reg) -#define ReadRegDW(adapter,reg) readl(adapter->io_mem + reg) +#define write_reg_dw(adapter,reg,value) writel(value, adapter->io_mem + reg) +#define read_reg_dw(adapter,reg) readl(adapter->io_mem + reg) -static void WriteRegOp(struct adapter *adapter, u32 reg, u32 operation, u32 andvalue, u32 orvalue) +static void write_reg_op(struct adapter *adapter, u32 reg, u32 operation, u32 andvalue, u32 orvalue) { u32 tmp; - tmp = ReadRegDW(adapter, reg); + tmp = read_reg_dw(adapter, reg); if (operation == 1) tmp = tmp | orvalue; @@ -123,20 +126,20 @@ static void WriteRegOp(struct adapter *adapter, u32 reg, u32 operation, u32 andv if (operation == 3) tmp = (tmp & andvalue) | orvalue; - WriteRegDW(adapter, reg, tmp); + write_reg_dw(adapter, reg, tmp); } /* i2c functions */ -static int i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, u32 retries) +static int i2c_main_write_for_flex2(struct adapter * adapter, u32 command, u8 * buf, u32 retries) { u32 i; u32 value; - WriteRegDW(adapter, 0x100, 0); - WriteRegDW(adapter, 0x100, command); + write_reg_dw(adapter, 0x100, 0); + write_reg_dw(adapter, 0x100, command); for (i = 0; i < retries; i++) { - value = ReadRegDW(adapter, 0x100); + value = read_reg_dw(adapter, 0x100); if ((value & 0x40000000) == 0) { if ((value & 0x81000000) == 0x80000000) { @@ -147,8 +150,8 @@ static int i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, } } else { - WriteRegDW(adapter, 0x100, 0); - WriteRegDW(adapter, 0x100, command); + write_reg_dw(adapter, 0x100, 0); + write_reg_dw(adapter, 0x100, command); } } @@ -156,7 +159,7 @@ static int i2cMainWriteForFlex2(struct adapter * adapter, u32 command, u8 * buf, } /* device = 0x10000000 for tuner, 0x20000000 for eeprom */ -static void i2cMainSetup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u32 len, u32 *command) +static void i2c_main_setup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u32 len, u32 *command) { *command = device | ((len - 1) << 26) | (value << 16) | (addr << 8) | chip_addr; @@ -166,20 +169,20 @@ static void i2cMainSetup(u32 device, u32 chip_addr, u8 op, u8 addr, u32 value, u *command = *command | 0x01000000; } -static int FlexI2cRead4(struct adapter * adapter, u32 device, u32 chip_addr, u16 addr, u8 * buf, u8 len) +static int flex_i2c_read4(struct adapter * adapter, u32 device, u32 chip_addr, u16 addr, u8 * buf, u8 len) { u32 command; u32 value; int result, i; - i2cMainSetup(device, chip_addr, 1, addr, 0, len, &command); + i2c_main_setup(device, chip_addr, 1, addr, 0, len, &command); - result = i2cMainWriteForFlex2(adapter, command, buf, 100000); + result = i2c_main_write_for_flex2(adapter, command, buf, 100000); if ((result & 0xff) != 0) { if (len > 1) { - value = ReadRegDW(adapter, 0x104); + value = read_reg_dw(adapter, 0x104); for (i = 1; i < len; i++) { buf[i] = value & 0xff; @@ -191,7 +194,7 @@ static int FlexI2cRead4(struct adapter * adapter, u32 device, u32 chip_addr, u16 return result; } -static int FlexI2cWrite4(struct adapter * adapter, u32 device, u32 chip_addr, u32 addr, u8 * buf, u8 len) +static int flex_i2c_write4(struct adapter * adapter, u32 device, u32 chip_addr, u32 addr, u8 * buf, u8 len) { u32 command; u32 value; @@ -205,12 +208,12 @@ static int FlexI2cWrite4(struct adapter * adapter, u32 device, u32 chip_addr, u3 value = value | buf[i - 1]; } - WriteRegDW(adapter, 0x104, value); + write_reg_dw(adapter, 0x104, value); } - i2cMainSetup(device, chip_addr, 0, addr, buf[0], len, &command); + i2c_main_setup(device, chip_addr, 0, addr, buf[0], len, &command); - return i2cMainWriteForFlex2(adapter, command, 0, 100000); + return i2c_main_write_for_flex2(adapter, command, 0, 100000); } static void fixchipaddr(u32 device, u32 bus, u32 addr, u32 *ret) @@ -221,7 +224,7 @@ static void fixchipaddr(u32 device, u32 bus, u32 addr, u32 *ret) *ret = bus; } -static u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) +static u32 flex_i2c_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) { u32 chipaddr; u32 bytes_to_transfer; @@ -239,7 +242,7 @@ static u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, fixchipaddr(device, bus, addr, &chipaddr); - if (FlexI2cRead4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) + if (flex_i2c_read4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) return buf - start; buf = buf + bytes_to_transfer; @@ -250,7 +253,7 @@ static u32 FLEXI2C_read(struct adapter * adapter, u32 device, u32 bus, u32 addr, return buf - start; } -static u32 FLEXI2C_write(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) +static u32 flex_i2c_write(struct adapter * adapter, u32 device, u32 bus, u32 addr, u8 * buf, u32 len) { u32 chipaddr; u32 bytes_to_transfer; @@ -268,7 +271,7 @@ static u32 FLEXI2C_write(struct adapter * adapter, u32 device, u32 bus, u32 addr fixchipaddr(device, bus, addr, &chipaddr); - if (FlexI2cWrite4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) + if (flex_i2c_write4(adapter, device, chipaddr, addr, buf, bytes_to_transfer) == 0) return buf - start; buf = buf + bytes_to_transfer; @@ -307,7 +310,7 @@ static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg *msgs, int if ( (num == 2) && (msgs[0].flags == 0) && (msgs[1].flags == I2C_M_RD) && (msgs[0].buf != NULL) && (msgs[1].buf != NULL) ) { - ret = FLEXI2C_read(tmp, 0x10000000, msgs[0].addr, msgs[0].buf[0], msgs[1].buf, msgs[1].len); + ret = flex_i2c_read(tmp, 0x10000000, msgs[0].addr, msgs[0].buf[0], msgs[1].buf, msgs[1].len); up(&tmp->i2c_sem); @@ -329,7 +332,7 @@ static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg *msgs, int if ( (msgs[i].flags != 0) || (msgs[i].buf == NULL) || ( msgs[i].len < 2 ) ) return -EINVAL; - ret = FLEXI2C_write(tmp, 0x10000000, msgs[i].addr, msgs[i].buf[0], &msgs[i].buf[1], msgs[i].len - 1); + ret = flex_i2c_write(tmp, 0x10000000, msgs[i].addr, msgs[i].buf[0], &msgs[i].buf[1], msgs[i].len - 1); up(&tmp->i2c_sem); @@ -353,18 +356,18 @@ static int master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg *msgs, int /* SRAM (Skystar2 rev2.3 has one "ISSI IS61LV256" chip on board, but it seems that FlexCopII can work with more than one chip) */ -static void SRAMSetNetDest(struct adapter * adapter, u8 dest) +static void sram_set_net_dest(struct adapter * adapter, u8 dest) { u32 tmp; udelay(1000); - tmp = (ReadRegDW(adapter, 0x714) & 0xFFFFFFFC) | (dest & 3); + tmp = (read_reg_dw(adapter, 0x714) & 0xFFFFFFFC) | (dest & 3); udelay(1000); - WriteRegDW(adapter, 0x714, tmp); - WriteRegDW(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); udelay(1000); @@ -372,19 +375,19 @@ static void SRAMSetNetDest(struct adapter * adapter, u8 dest) /* return tmp; */ } -static void SRAMSetCaiDest(struct adapter * adapter, u8 dest) +static void sram_set_cai_dest(struct adapter * adapter, u8 dest) { u32 tmp; udelay(1000); - tmp = (ReadRegDW(adapter, 0x714) & 0xFFFFFFF3) | ((dest & 3) << 2); + tmp = (read_reg_dw(adapter, 0x714) & 0xFFFFFFF3) | ((dest & 3) << 2); udelay(1000); udelay(1000); - WriteRegDW(adapter, 0x714, tmp); - WriteRegDW(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); udelay(1000); @@ -392,19 +395,19 @@ static void SRAMSetCaiDest(struct adapter * adapter, u8 dest) /* return tmp; */ } -static void SRAMSetCaoDest(struct adapter * adapter, u8 dest) +static void sram_set_cao_dest(struct adapter * adapter, u8 dest) { u32 tmp; udelay(1000); - tmp = (ReadRegDW(adapter, 0x714) & 0xFFFFFFCF) | ((dest & 3) << 4); + tmp = (read_reg_dw(adapter, 0x714) & 0xFFFFFFCF) | ((dest & 3) << 4); udelay(1000); udelay(1000); - WriteRegDW(adapter, 0x714, tmp); - WriteRegDW(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); udelay(1000); @@ -412,19 +415,19 @@ static void SRAMSetCaoDest(struct adapter * adapter, u8 dest) /* return tmp; */ } -static void SRAMSetMediaDest(struct adapter * adapter, u8 dest) +static void sram_set_media_dest(struct adapter * adapter, u8 dest) { u32 tmp; udelay(1000); - tmp = (ReadRegDW(adapter, 0x714) & 0xFFFFFF3F) | ((dest & 3) << 6); + tmp = (read_reg_dw(adapter, 0x714) & 0xFFFFFF3F) | ((dest & 3) << 6); udelay(1000); udelay(1000); - WriteRegDW(adapter, 0x714, tmp); - WriteRegDW(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); + write_reg_dw(adapter, 0x714, tmp); udelay(1000); @@ -441,7 +444,7 @@ static void SRAMSetMediaDest(struct adapter * adapter, u8 dest) bits 28-29 : memory bank selector bit 31 : busy flag */ -static void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) +static void flex_sram_write(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) { u32 i, command, retries; @@ -450,7 +453,7 @@ static void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, retries = 2; - while (((ReadRegDW(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { + while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { mdelay(1); retries--; }; @@ -458,14 +461,14 @@ static void FlexSramWrite(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, if (retries == 0) printk("%s: SRAM timeout\n", __FUNCTION__); - WriteRegDW(adapter, 0x700, command); + write_reg_dw(adapter, 0x700, command); buf++; addr++; } } -static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) +static void flex_sram_read(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, u32 len) { u32 i, command, value, retries; @@ -474,7 +477,7 @@ static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, retries = 10000; - while (((ReadRegDW(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { + while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { mdelay(1); retries--; }; @@ -482,11 +485,11 @@ static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, if (retries == 0) printk("%s: SRAM timeout\n", __FUNCTION__); - WriteRegDW(adapter, 0x700, command); + write_reg_dw(adapter, 0x700, command); retries = 10000; - while (((ReadRegDW(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { + while (((read_reg_dw(adapter, 0x700) & 0x80000000) != 0) && (retries > 0)) { mdelay(1); retries--; }; @@ -494,7 +497,7 @@ static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, if (retries == 0) printk("%s: SRAM timeout\n", __FUNCTION__); - value = ReadRegDW(adapter, 0x700) >> 0x10; + value = read_reg_dw(adapter, 0x700) >> 0x10; *buf = (value & 0xff); @@ -503,47 +506,47 @@ static void FlexSramRead(struct adapter *adapter, u32 bank, u32 addr, u8 * buf, } } -static void SRAM_writeChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) +static void sram_writeChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) { u32 bank; bank = 0; - if (adapter->dwSramType == 0x20000) { + if (adapter->dw_sram_type == 0x20000) { bank = (addr & 0x18000) << 0x0D; } - if (adapter->dwSramType == 0x00000) { + if (adapter->dw_sram_type == 0x00000) { if ((addr >> 0x0F) == 0) bank = 0x20000000; else bank = 0x10000000; } - FlexSramWrite(adapter, bank, addr & 0x7FFF, buf, len); + flex_sram_write(adapter, bank, addr & 0x7FFF, buf, len); } -static void SRAM_readChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) +static void sram_readChunk(struct adapter *adapter, u32 addr, u8 * buf, u16 len) { u32 bank; bank = 0; - if (adapter->dwSramType == 0x20000) { + if (adapter->dw_sram_type == 0x20000) { bank = (addr & 0x18000) << 0x0D; } - if (adapter->dwSramType == 0x00000) { + if (adapter->dw_sram_type == 0x00000) { if ((addr >> 0x0F) == 0) bank = 0x20000000; else bank = 0x10000000; } - FlexSramRead(adapter, bank, addr & 0x7FFF, buf, len); + flex_sram_read(adapter, bank, addr & 0x7FFF, buf, len); } -static void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) +static void sram_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) { u32 length; @@ -557,7 +560,7 @@ static void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) length = (((addr >> 0x0F) + 1) << 0x0F) - addr; } - SRAM_readChunk(adapter, addr, buf, length); + sram_readChunk(adapter, addr, buf, length); addr = addr + length; buf = buf + length; @@ -565,7 +568,7 @@ static void SRAM_read(struct adapter *adapter, u32 addr, u8 * buf, u32 len) } } -static void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) +static void sram_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) { u32 length; @@ -579,7 +582,7 @@ static void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) length = (((addr >> 0x0F) + 1) << 0x0F) - addr; } - SRAM_writeChunk(adapter, addr, buf, length); + sram_writeChunk(adapter, addr, buf, length); addr = addr + length; buf = buf + length; @@ -587,58 +590,58 @@ static void SRAM_write(struct adapter *adapter, u32 addr, u8 * buf, u32 len) } } -static void SRAM_setSize(struct adapter *adapter, u32 mask) +static void sram_set_size(struct adapter *adapter, u32 mask) { - WriteRegDW(adapter, 0x71C, (mask | (~0x30000 & ReadRegDW(adapter, 0x71C)))); + write_reg_dw(adapter, 0x71C, (mask | (~0x30000 & read_reg_dw(adapter, 0x71C)))); } -static void SRAM_init(struct adapter *adapter) +static void sram_init(struct adapter *adapter) { u32 tmp; - tmp = ReadRegDW(adapter, 0x71C); + tmp = read_reg_dw(adapter, 0x71C); - WriteRegDW(adapter, 0x71C, 1); + write_reg_dw(adapter, 0x71C, 1); - if (ReadRegDW(adapter, 0x71C) != 0) { - WriteRegDW(adapter, 0x71C, tmp); + if (read_reg_dw(adapter, 0x71C) != 0) { + write_reg_dw(adapter, 0x71C, tmp); - adapter->dwSramType = tmp & 0x30000; + adapter->dw_sram_type = tmp & 0x30000; - dprintk("%s: dwSramType = %x\n", __FUNCTION__, adapter->dwSramType); + dprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); } else { - adapter->dwSramType = 0x10000; + adapter->dw_sram_type = 0x10000; - dprintk("%s: dwSramType = %x\n", __FUNCTION__, adapter->dwSramType); + dprintk("%s: dw_sram_type = %x\n", __FUNCTION__, adapter->dw_sram_type); } /* return value is never used? */ -/* return adapter->dwSramType; */ +/* return adapter->dw_sram_type; */ } -static int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) +static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) { u8 tmp1, tmp2; dprintk("%s: mask = %x, addr = %x\n", __FUNCTION__, mask, addr); - SRAM_setSize(adapter, mask); - SRAM_init(adapter); + sram_set_size(adapter, mask); + sram_init(adapter); tmp2 = 0xA5; tmp1 = 0x4F; - SRAM_write(adapter, addr, &tmp2, 1); - SRAM_write(adapter, addr + 4, &tmp1, 1); + sram_write(adapter, addr, &tmp2, 1); + sram_write(adapter, addr + 4, &tmp1, 1); tmp2 = 0; mdelay(20); - SRAM_read(adapter, addr, &tmp2, 1); - SRAM_read(adapter, addr, &tmp2, 1); + sram_read(adapter, addr, &tmp2, 1); + sram_read(adapter, addr, &tmp2, 1); dprintk("%s: wrote 0xA5, read 0x%2x\n", __FUNCTION__, tmp2); @@ -648,15 +651,15 @@ static int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) tmp2 = 0x5A; tmp1 = 0xF4; - SRAM_write(adapter, addr, &tmp2, 1); - SRAM_write(adapter, addr + 4, &tmp1, 1); + sram_write(adapter, addr, &tmp2, 1); + sram_write(adapter, addr + 4, &tmp1, 1); tmp2 = 0; mdelay(20); - SRAM_read(adapter, addr, &tmp2, 1); - SRAM_read(adapter, addr, &tmp2, 1); + sram_read(adapter, addr, &tmp2, 1); + sram_read(adapter, addr, &tmp2, 1); dprintk("%s: wrote 0x5A, read 0x%2x\n", __FUNCTION__, tmp2); @@ -666,13 +669,13 @@ static int SRAM_testLocation(struct adapter *adapter, u32 mask, u32 addr) return 1; } -static u32 SRAM_length(struct adapter * adapter) +static u32 sram_length(struct adapter * adapter) { - if (adapter->dwSramType == 0x10000) + if (adapter->dw_sram_type == 0x10000) return 32768; // 32K - if (adapter->dwSramType == 0x00000) + if (adapter->dw_sram_type == 0x00000) return 65536; // 64K - if (adapter->dwSramType == 0x20000) + if (adapter->dw_sram_type == 0x20000) return 131072; // 128K return 32768; // 32K @@ -691,96 +694,96 @@ static u32 SRAM_length(struct adapter * adapter) bank 2 covers addresses 0x10000-0x17FFF bank 3 covers addresses 0x18000-0x1FFFF */ -static int SramDetectForFlex2(struct adapter *adapter) +static int sram_detect_for_flex2(struct adapter *adapter) { u32 tmp, tmp2, tmp3; dprintk("%s:\n", __FUNCTION__); - tmp = ReadRegDW(adapter, 0x208); - WriteRegDW(adapter, 0x208, 0); + tmp = read_reg_dw(adapter, 0x208); + write_reg_dw(adapter, 0x208, 0); - tmp2 = ReadRegDW(adapter, 0x71C); + tmp2 = read_reg_dw(adapter, 0x71C); dprintk("%s: tmp2 = %x\n", __FUNCTION__, tmp2); - WriteRegDW(adapter, 0x71C, 1); + write_reg_dw(adapter, 0x71C, 1); - tmp3 = ReadRegDW(adapter, 0x71C); + tmp3 = read_reg_dw(adapter, 0x71C); dprintk("%s: tmp3 = %x\n", __FUNCTION__, tmp3); - WriteRegDW(adapter, 0x71C, tmp2); + write_reg_dw(adapter, 0x71C, tmp2); // check for internal SRAM ??? tmp3--; if (tmp3 != 0) { - SRAM_setSize(adapter, 0x10000); - SRAM_init(adapter); - WriteRegDW(adapter, 0x208, tmp); + sram_set_size(adapter, 0x10000); + sram_init(adapter); + write_reg_dw(adapter, 0x208, tmp); dprintk("%s: sram size = 32K\n", __FUNCTION__); return 32; } - if (SRAM_testLocation(adapter, 0x20000, 0x18000) != 0) { - SRAM_setSize(adapter, 0x20000); - SRAM_init(adapter); - WriteRegDW(adapter, 0x208, tmp); + if (sram_test_location(adapter, 0x20000, 0x18000) != 0) { + sram_set_size(adapter, 0x20000); + sram_init(adapter); + write_reg_dw(adapter, 0x208, tmp); dprintk("%s: sram size = 128K\n", __FUNCTION__); return 128; } - if (SRAM_testLocation(adapter, 0x00000, 0x10000) != 0) { - SRAM_setSize(adapter, 0x00000); - SRAM_init(adapter); - WriteRegDW(adapter, 0x208, tmp); + if (sram_test_location(adapter, 0x00000, 0x10000) != 0) { + sram_set_size(adapter, 0x00000); + sram_init(adapter); + write_reg_dw(adapter, 0x208, tmp); dprintk("%s: sram size = 64K\n", __FUNCTION__); return 64; } - if (SRAM_testLocation(adapter, 0x10000, 0x00000) != 0) { - SRAM_setSize(adapter, 0x10000); - SRAM_init(adapter); - WriteRegDW(adapter, 0x208, tmp); + if (sram_test_location(adapter, 0x10000, 0x00000) != 0) { + sram_set_size(adapter, 0x10000); + sram_init(adapter); + write_reg_dw(adapter, 0x208, tmp); dprintk("%s: sram size = 32K\n", __FUNCTION__); return 32; } - SRAM_setSize(adapter, 0x10000); - SRAM_init(adapter); - WriteRegDW(adapter, 0x208, tmp); + sram_set_size(adapter, 0x10000); + sram_init(adapter); + write_reg_dw(adapter, 0x208, tmp); dprintk("%s: SRAM detection failed. Set to 32K \n", __FUNCTION__); return 0; } -static void SLL_detectSramSize(struct adapter *adapter) +static void sll_detect_sram_size(struct adapter *adapter) { - SramDetectForFlex2(adapter); + sram_detect_for_flex2(adapter); } /* EEPROM (Skystar2 has one "24LC08B" chip on board) */ /* -static int EEPROM_write(struct adapter *adapter, u16 addr, u8 * buf, u16 len) +static int eeprom_write(struct adapter *adapter, u16 addr, u8 * buf, u16 len) { - return FLEXI2C_write(adapter, 0x20000000, 0x50, addr, buf, len); + return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len); } */ -static int EEPROM_read(struct adapter *adapter, u16 addr, u8 * buf, u16 len) +static int eeprom_read(struct adapter *adapter, u16 addr, u8 * buf, u16 len) { - return FLEXI2C_read(adapter, 0x20000000, 0x50, addr, buf, len); + return flex_i2c_read(adapter, 0x20000000, 0x50, addr, buf, len); } -u8 calc_LRC(u8 * buf, u32 len) +u8 calc_lrc(u8 * buf, u32 len) { u32 i; u8 sum; @@ -793,13 +796,13 @@ u8 calc_LRC(u8 * buf, u32 len) return sum; } -static int EEPROM_LRC_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, u32 retries) +static int eeprom_lrc_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, u32 retries) { int i; for (i = 0; i < retries; i++) { - if (EEPROM_read(adapter, addr, buf, len) == len) { - if (calc_LRC(buf, len - 1) == buf[len - 1]) + if (eeprom_read(adapter, addr, buf, len) == len) { + if (calc_lrc(buf, len - 1) == buf[len - 1]) return 1; } } @@ -808,13 +811,13 @@ static int EEPROM_LRC_read(struct adapter *adapter, u32 addr, u32 len, u8 * buf, } /* -static int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * rbuf, u32 retries) +static int eeprom_lrc_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbuf, u8 * rbuf, u32 retries) { int i; for (i = 0; i < retries; i++) { - if (EEPROM_write(adapter, addr, wbuf, len) == len) { - if (EEPROM_LRC_read(adapter, addr, len, rbuf, retries) == 1) + if (eeprom_write(adapter, addr, wbuf, len) == len) { + if (eeprom_lrc_read(adapter, addr, len, rbuf, retries) == 1) return 1; } } @@ -827,7 +830,7 @@ static int EEPROM_LRC_write(struct adapter *adapter, u32 addr, u32 len, u8 * wbu /* These functions could be used to unlock SkyStar2 cards. */ /* -static int EEPROM_writeKey(struct adapter *adapter, u8 * key, u32 len) +static int eeprom_writeKey(struct adapter *adapter, u8 * key, u32 len) { u8 rbuf[20]; u8 wbuf[20]; @@ -840,19 +843,19 @@ static int EEPROM_writeKey(struct adapter *adapter, u8 * key, u32 len) wbuf[16] = 0; wbuf[17] = 0; wbuf[18] = 0; - wbuf[19] = calc_LRC(wbuf, 19); + wbuf[19] = calc_lrc(wbuf, 19); - return EEPROM_LRC_write(adapter, 0x3E4, 20, wbuf, rbuf, 4); + return eeprom_lrc_write(adapter, 0x3E4, 20, wbuf, rbuf, 4); } -static int EEPROM_readKey(struct adapter *adapter, u8 * key, u32 len) +static int eeprom_readKey(struct adapter *adapter, u8 * key, u32 len) { u8 buf[20]; if (len != 16) return 0; - if (EEPROM_LRC_read(adapter, 0x3E4, 20, buf, 4) == 0) + if (eeprom_lrc_read(adapter, 0x3E4, 20, buf, 4) == 0) return 0; memcpy(key, buf, len); @@ -861,11 +864,11 @@ static int EEPROM_readKey(struct adapter *adapter, u8 * key, u32 len) } */ -static int EEPROM_getMacAddr(struct adapter *adapter, char type, u8 * mac) +static int eeprom_get_mac_addr(struct adapter *adapter, char type, u8 * mac) { u8 tmp[8]; - if (EEPROM_LRC_read(adapter, 0x3F8, 8, tmp, 4) != 0) { + if (eeprom_lrc_read(adapter, 0x3F8, 8, tmp, 4) != 0) { if (type != 0) { mac[0] = tmp[0]; mac[1] = tmp[1]; @@ -903,7 +906,7 @@ static int EEPROM_getMacAddr(struct adapter *adapter, char type, u8 * mac) } /* -static char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) +static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 * mac) { u8 tmp[8]; @@ -926,9 +929,9 @@ static char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) } tmp[6] = 0; - tmp[7] = calc_LRC(tmp, 7); + tmp[7] = calc_lrc(tmp, 7); - if (EEPROM_write(adapter, 0x3F8, tmp, 8) == 8) + if (eeprom_write(adapter, 0x3F8, tmp, 8) == 8) return 1; return 0; @@ -936,142 +939,142 @@ static char EEPROM_setMacAddr(struct adapter *adapter, char type, u8 * mac) */ /* PID filter */ -static void FilterEnableStream1Filter(struct adapter *adapter, u32 op) +static void filter_enable_stream1_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000001, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000001, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000001); + write_reg_op(adapter, 0x208, 1, 0, 0x00000001); } } -static void FilterEnableStream2Filter(struct adapter *adapter, u32 op) +static void filter_enable_stream2_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000002, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000002, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000002); + write_reg_op(adapter, 0x208, 1, 0, 0x00000002); } } -static void FilterEnablePcrFilter(struct adapter *adapter, u32 op) +static void filter_enable_pcr_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000004, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000004, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000004); + write_reg_op(adapter, 0x208, 1, 0, 0x00000004); } } -static void FilterEnablePmtFilter(struct adapter *adapter, u32 op) +static void filter_enable_pmt_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000008, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000008, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000008); + write_reg_op(adapter, 0x208, 1, 0, 0x00000008); } } -static void FilterEnableEmmFilter(struct adapter *adapter, u32 op) +static void filter_enable_emm_fFilter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000010, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000010, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000010); + write_reg_op(adapter, 0x208, 1, 0, 0x00000010); } } -static void FilterEnableEcmFilter(struct adapter *adapter, u32 op) +static void filter_enable_ecm_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000020, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000020, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000020); + write_reg_op(adapter, 0x208, 1, 0, 0x00000020); } } /* -static void FilterEnableNullFilter(struct adapter *adapter, u32 op) +static void filter_enable_null_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000040, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000040, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000040); + write_reg_op(adapter, 0x208, 1, 0, 0x00000040); } } */ -static void FilterEnableMaskFilter(struct adapter *adapter, u32 op) +static void filter_enable_mask_filter(struct adapter *adapter, u32 op) { dprintk("%s: op=%x\n", __FUNCTION__, op); if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000080, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000080, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000080); + write_reg_op(adapter, 0x208, 1, 0, 0x00000080); } } -static void CtrlEnableMAC(struct adapter *adapter, u32 op) +static void ctrl_enable_mac(struct adapter *adapter, u32 op) { if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00004000, 0); + write_reg_op(adapter, 0x208, 2, ~0x00004000, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00004000); + write_reg_op(adapter, 0x208, 1, 0, 0x00004000); } } -static int CASetMacDstAddrFilter(struct adapter *adapter, u8 * mac) +static int ca_set_mac_dst_addr_filter(struct adapter *adapter, u8 * mac) { u32 tmp1, tmp2; tmp1 = (mac[3] << 0x18) | (mac[2] << 0x10) | (mac[1] << 0x08) | mac[0]; tmp2 = (mac[5] << 0x08) | mac[4]; - WriteRegDW(adapter, 0x418, tmp1); - WriteRegDW(adapter, 0x41C, tmp2); + write_reg_dw(adapter, 0x418, tmp1); + write_reg_dw(adapter, 0x41C, tmp2); return 0; } /* -static void SetIgnoreMACFilter(struct adapter *adapter, u8 op) +static void set_ignore_mac_filter(struct adapter *adapter, u8 op) { if (op != 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00004000, 0); + write_reg_op(adapter, 0x208, 2, ~0x00004000, 0); adapter->mac_filter = 1; @@ -1080,21 +1083,21 @@ static void SetIgnoreMACFilter(struct adapter *adapter, u8 op) if (adapter->mac_filter != 0) { adapter->mac_filter = 0; - WriteRegOp(adapter, 0x208, 1, 0, 0x00004000); + write_reg_op(adapter, 0x208, 1, 0, 0x00004000); } } } */ /* -static void CheckNullFilterEnable(struct adapter *adapter) +static void check_null_filter_enable(struct adapter *adapter) { - FilterEnableNullFilter(adapter, 1); - FilterEnableMaskFilter(adapter, 1); + filter_enable_null_filter(adapter, 1); + filter_enable_mask_filter(adapter, 1); } */ -static void InitPIDsInfo(struct adapter *adapter) +static void init_pids_info(struct adapter *adapter) { int i; @@ -1102,7 +1105,7 @@ static void InitPIDsInfo(struct adapter *adapter) adapter->pids[i] = 0x1FFF; } -static int CheckPID(struct adapter *adapter, u16 pid) +static int check_pid(struct adapter *adapter, u16 pid) { u32 i; @@ -1117,246 +1120,246 @@ static int CheckPID(struct adapter *adapter, u16 pid) return 0; } -static void PidSetGroupPID(struct adapter * adapter, u32 pid) +static void pid_set_group_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = (pid & 0x3FFF) | (ReadRegDW(adapter, 0x30C) & 0xFFFF0000); + value = (pid & 0x3FFF) | (read_reg_dw(adapter, 0x30C) & 0xFFFF0000); - WriteRegDW(adapter, 0x30C, value); + write_reg_dw(adapter, 0x30C, value); /* return value is never used? */ /* return value; */ } -static void PidSetGroupMASK(struct adapter * adapter, u32 pid) +static void pid_set_group_mask(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = ((pid & 0x3FFF) << 0x10) | (ReadRegDW(adapter, 0x30C) & 0xFFFF); + value = ((pid & 0x3FFF) << 0x10) | (read_reg_dw(adapter, 0x30C) & 0xFFFF); - WriteRegDW(adapter, 0x30C, value); + write_reg_dw(adapter, 0x30C, value); /* return value is never used? */ /* return value; */ } -static void PidSetStream1PID(struct adapter * adapter, u32 pid) +static void pid_set_stream1_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = (pid & 0x3FFF) | (ReadRegDW(adapter, 0x300) & 0xFFFFC000); + value = (pid & 0x3FFF) | (read_reg_dw(adapter, 0x300) & 0xFFFFC000); - WriteRegDW(adapter, 0x300, value); + write_reg_dw(adapter, 0x300, value); /* return value is never used? */ /* return value; */ } -static void PidSetStream2PID(struct adapter * adapter, u32 pid) +static void pid_set_stream2_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = ((pid & 0x3FFF) << 0x10) | (ReadRegDW(adapter, 0x300) & 0xFFFF); + value = ((pid & 0x3FFF) << 0x10) | (read_reg_dw(adapter, 0x300) & 0xFFFF); - WriteRegDW(adapter, 0x300, value); + write_reg_dw(adapter, 0x300, value); /* return value is never used? */ /* return value; */ } -static void PidSetPcrPID(struct adapter * adapter, u32 pid) +static void pid_set_pcr_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = (pid & 0x3FFF) | (ReadRegDW(adapter, 0x304) & 0xFFFFC000); + value = (pid & 0x3FFF) | (read_reg_dw(adapter, 0x304) & 0xFFFFC000); - WriteRegDW(adapter, 0x304, value); + write_reg_dw(adapter, 0x304, value); /* return value is never used? */ /* return value; */ } -static void PidSetPmtPID(struct adapter * adapter, u32 pid) +static void pid_set_pmt_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = ((pid & 0x3FFF) << 0x10) | (ReadRegDW(adapter, 0x304) & 0x3FFF); + value = ((pid & 0x3FFF) << 0x10) | (read_reg_dw(adapter, 0x304) & 0x3FFF); - WriteRegDW(adapter, 0x304, value); + write_reg_dw(adapter, 0x304, value); /* return value is never used? */ /* return value; */ } -static void PidSetEmmPID(struct adapter * adapter, u32 pid) +static void pid_set_emm_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = (pid & 0xFFFF) | (ReadRegDW(adapter, 0x308) & 0xFFFF0000); + value = (pid & 0xFFFF) | (read_reg_dw(adapter, 0x308) & 0xFFFF0000); - WriteRegDW(adapter, 0x308, value); + write_reg_dw(adapter, 0x308, value); /* return value is never used? */ /* return value; */ } -static void PidSetEcmPID(struct adapter * adapter, u32 pid) +static void pid_set_ecm_pid(struct adapter * adapter, u32 pid) { u32 value; dprintk("%s: pid=%x\n", __FUNCTION__, pid); - value = (pid << 0x10) | (ReadRegDW(adapter, 0x308) & 0xFFFF); + value = (pid << 0x10) | (read_reg_dw(adapter, 0x308) & 0xFFFF); - WriteRegDW(adapter, 0x308, value); + write_reg_dw(adapter, 0x308, value); /* return value is never used? */ /* return value; */ } -static int PidGetStream1PID(struct adapter * adapter) +static int pid_get_stream1_pid(struct adapter * adapter) { - return ReadRegDW(adapter, 0x300) & 0x00001FFF; + return read_reg_dw(adapter, 0x300) & 0x00001FFF; } -static int PidGetStream2PID(struct adapter * adapter) +static int pid_get_stream2_pid(struct adapter * adapter) { - return (ReadRegDW(adapter, 0x300) >> 0x10)& 0x00001FFF; + return (read_reg_dw(adapter, 0x300) >> 0x10)& 0x00001FFF; } -static int PidGetPcrPID(struct adapter * adapter) +static int pid_get_pcr_pid(struct adapter * adapter) { - return ReadRegDW(adapter, 0x304) & 0x00001FFF; + return read_reg_dw(adapter, 0x304) & 0x00001FFF; } -static int PidGetPmtPID(struct adapter * adapter) +static int pid_get_pmt_pid(struct adapter * adapter) { - return (ReadRegDW(adapter, 0x304) >> 0x10)& 0x00001FFF; + return (read_reg_dw(adapter, 0x304) >> 0x10)& 0x00001FFF; } -static int PidGetEmmPID(struct adapter * adapter) +static int pid_get_emm_pid(struct adapter * adapter) { - return ReadRegDW(adapter, 0x308) & 0x00001FFF; + return read_reg_dw(adapter, 0x308) & 0x00001FFF; } -static int PidGetEcmPID(struct adapter * adapter) +static int pid_get_ecm_pid(struct adapter * adapter) { - return (ReadRegDW(adapter, 0x308) >> 0x10)& 0x00001FFF; + return (read_reg_dw(adapter, 0x308) >> 0x10)& 0x00001FFF; } -static int PidGetGroupPID(struct adapter * adapter) +static int pid_get_group_pid(struct adapter * adapter) { - return ReadRegDW(adapter, 0x30C) & 0x00001FFF; + return read_reg_dw(adapter, 0x30C) & 0x00001FFF; } -static int PidGetGroupMASK(struct adapter * adapter) +static int pid_get_group_mask(struct adapter * adapter) { - return (ReadRegDW(adapter, 0x30C) >> 0x10)& 0x00001FFF; + return (read_reg_dw(adapter, 0x30C) >> 0x10)& 0x00001FFF; } /* -static void ResetHardwarePIDFilter(struct adapter *adapter) +static void reset_hardware_pid_filter(struct adapter *adapter) { - PidSetStream1PID(adapter, 0x1FFF); + pid_set_stream1_pid(adapter, 0x1FFF); - PidSetStream2PID(adapter, 0x1FFF); - FilterEnableStream2Filter(adapter, 0); + pid_set_stream2_pid(adapter, 0x1FFF); + filter_enable_stream2_filter(adapter, 0); - PidSetPcrPID(adapter, 0x1FFF); - FilterEnablePcrFilter(adapter, 0); + pid_set_pcr_pid(adapter, 0x1FFF); + filter_enable_pcr_filter(adapter, 0); - PidSetPmtPID(adapter, 0x1FFF); - FilterEnablePmtFilter(adapter, 0); + pid_set_pmt_pid(adapter, 0x1FFF); + filter_enable_pmt_filter(adapter, 0); - PidSetEcmPID(adapter, 0x1FFF); - FilterEnableEcmFilter(adapter, 0); + pid_set_ecm_pid(adapter, 0x1FFF); + filter_enable_ecm_filter(adapter, 0); - PidSetEmmPID(adapter, 0x1FFF); - FilterEnableEmmFilter(adapter, 0); + pid_set_emm_pid(adapter, 0x1FFF); + filter_enable_emm_fFilter(adapter, 0); } */ -static void OpenWholeBandwidth(struct adapter *adapter) +static void open_whole_bandwidth(struct adapter *adapter) { dprintk("%s:\n", __FUNCTION__); - PidSetGroupPID(adapter, 0); + pid_set_group_pid(adapter, 0); - PidSetGroupMASK(adapter, 0); + pid_set_group_mask(adapter, 0); - FilterEnableMaskFilter(adapter, 1); + filter_enable_mask_filter(adapter, 1); } -static int AddHwPID(struct adapter *adapter, u32 pid) +static int add_hw_pid(struct adapter *adapter, u32 pid) { dprintk("%s: pid=%d\n", __FUNCTION__, pid); if (pid <= 0x1F) return 1; - if ((PidGetGroupMASK(adapter) == 0) && (PidGetGroupPID(adapter) == 0)) + if ((pid_get_group_mask(adapter) == 0) && (pid_get_group_pid(adapter) == 0)) return 0; - if (PidGetStream1PID(adapter) == 0x1FFF) { - PidSetStream1PID(adapter, pid & 0xFFFF); + if (pid_get_stream1_pid(adapter) == 0x1FFF) { + pid_set_stream1_pid(adapter, pid & 0xFFFF); - FilterEnableStream1Filter(adapter, 1); + filter_enable_stream1_filter(adapter, 1); return 1; } - if (PidGetStream2PID(adapter) == 0x1FFF) { - PidSetStream2PID(adapter, (pid & 0xFFFF)); + if (pid_get_stream2_pid(adapter) == 0x1FFF) { + pid_set_stream2_pid(adapter, (pid & 0xFFFF)); - FilterEnableStream2Filter(adapter, 1); + filter_enable_stream2_filter(adapter, 1); return 1; } - if (PidGetPcrPID(adapter) == 0x1FFF) { - PidSetPcrPID(adapter, (pid & 0xFFFF)); + if (pid_get_pcr_pid(adapter) == 0x1FFF) { + pid_set_pcr_pid(adapter, (pid & 0xFFFF)); - FilterEnablePcrFilter(adapter, 1); + filter_enable_pcr_filter(adapter, 1); return 1; } - if ((PidGetPmtPID(adapter) & 0x1FFF) == 0x1FFF) { - PidSetPmtPID(adapter, (pid & 0xFFFF)); + if ((pid_get_pmt_pid(adapter) & 0x1FFF) == 0x1FFF) { + pid_set_pmt_pid(adapter, (pid & 0xFFFF)); - FilterEnablePmtFilter(adapter, 1); + filter_enable_pmt_filter(adapter, 1); return 1; } - if ((PidGetEmmPID(adapter) & 0x1FFF) == 0x1FFF) { - PidSetEmmPID(adapter, (pid & 0xFFFF)); + if ((pid_get_emm_pid(adapter) & 0x1FFF) == 0x1FFF) { + pid_set_emm_pid(adapter, (pid & 0xFFFF)); - FilterEnableEmmFilter(adapter, 1); + filter_enable_emm_fFilter(adapter, 1); return 1; } - if ((PidGetEcmPID(adapter) & 0x1FFF) == 0x1FFF) { - PidSetEcmPID(adapter, (pid & 0xFFFF)); + if ((pid_get_ecm_pid(adapter) & 0x1FFF) == 0x1FFF) { + pid_set_ecm_pid(adapter, (pid & 0xFFFF)); - FilterEnableEcmFilter(adapter, 1); + filter_enable_ecm_filter(adapter, 1); return 1; } @@ -1364,55 +1367,55 @@ static int AddHwPID(struct adapter *adapter, u32 pid) return -1; } -static int RemoveHwPID(struct adapter *adapter, u32 pid) +static int remove_hw_pid(struct adapter *adapter, u32 pid) { dprintk("%s: pid=%d\n", __FUNCTION__, pid); if (pid <= 0x1F) return 1; - if (PidGetStream1PID(adapter) == pid) { - PidSetStream1PID(adapter, 0x1FFF); + if (pid_get_stream1_pid(adapter) == pid) { + pid_set_stream1_pid(adapter, 0x1FFF); return 1; } - if (PidGetStream2PID(adapter) == pid) { - PidSetStream2PID(adapter, 0x1FFF); + if (pid_get_stream2_pid(adapter) == pid) { + pid_set_stream2_pid(adapter, 0x1FFF); - FilterEnableStream2Filter(adapter, 0); + filter_enable_stream2_filter(adapter, 0); return 1; } - if (PidGetPcrPID(adapter) == pid) { - PidSetPcrPID(adapter, 0x1FFF); + if (pid_get_pcr_pid(adapter) == pid) { + pid_set_pcr_pid(adapter, 0x1FFF); - FilterEnablePcrFilter(adapter, 0); + filter_enable_pcr_filter(adapter, 0); return 1; } - if (PidGetPmtPID(adapter) == pid) { - PidSetPmtPID(adapter, 0x1FFF); + if (pid_get_pmt_pid(adapter) == pid) { + pid_set_pmt_pid(adapter, 0x1FFF); - FilterEnablePmtFilter(adapter, 0); + filter_enable_pmt_filter(adapter, 0); return 1; } - if (PidGetEmmPID(adapter) == pid) { - PidSetEmmPID(adapter, 0x1FFF); + if (pid_get_emm_pid(adapter) == pid) { + pid_set_emm_pid(adapter, 0x1FFF); - FilterEnableEmmFilter(adapter, 0); + filter_enable_emm_fFilter(adapter, 0); return 1; } - if (PidGetEcmPID(adapter) == pid) { - PidSetEcmPID(adapter, 0x1FFF); + if (pid_get_ecm_pid(adapter) == pid) { + pid_set_ecm_pid(adapter, 0x1FFF); - FilterEnableEcmFilter(adapter, 0); + filter_enable_ecm_filter(adapter, 0); return 1; } @@ -1420,7 +1423,7 @@ static int RemoveHwPID(struct adapter *adapter, u32 pid) return -1; } -static int AddPID(struct adapter *adapter, u32 pid) +static int add_pid(struct adapter *adapter, u32 pid) { int i; @@ -1429,7 +1432,7 @@ static int AddPID(struct adapter *adapter, u32 pid) if (pid > 0x1FFE && pid != 0x2000) return -1; - if (CheckPID(adapter, pid) == 1) + if (check_pid(adapter, pid) == 1) return 1; for (i = 0; i < 0x27; i++) { @@ -1437,8 +1440,8 @@ static int AddPID(struct adapter *adapter, u32 pid) { adapter->pids[i] = pid; - if (pid == 0x2000 || AddHwPID(adapter, pid) < 0) - OpenWholeBandwidth(adapter); + if (pid == 0x2000 || add_hw_pid(adapter, pid) < 0) + open_whole_bandwidth(adapter); return 1; } @@ -1447,7 +1450,7 @@ static int AddPID(struct adapter *adapter, u32 pid) return -1; } -static int RemovePID(struct adapter *adapter, u32 pid) +static int remove_pid(struct adapter *adapter, u32 pid) { u32 i; @@ -1460,7 +1463,7 @@ static int RemovePID(struct adapter *adapter, u32 pid) if (adapter->pids[i] == pid) { adapter->pids[i] = 0x1FFF; - RemoveHwPID(adapter, pid); + remove_hw_pid(adapter, pid); return 1; } @@ -1470,18 +1473,18 @@ static int RemovePID(struct adapter *adapter, u32 pid) } /* dma & irq */ -static void CtrlEnableSmc(struct adapter *adapter, u32 op) +static void ctrl_enable_smc(struct adapter *adapter, u32 op) { if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00000800, 0); + write_reg_op(adapter, 0x208, 2, ~0x00000800, 0); } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00000800); + write_reg_op(adapter, 0x208, 1, 0, 0x00000800); } } -static void DmaEnableDisableIrq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3) +static void dma_enable_disable_irq(struct adapter *adapter, u32 flag1, u32 flag2, u32 flag3) { adapter->dma_ctrl = adapter->dma_ctrl & 0x000F0000; @@ -1510,16 +1513,16 @@ static void DmaEnableDisableIrq(struct adapter *adapter, u32 flag1, u32 flag2, u } } -static void IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) +static void irq_dma_enable_disable_irq(struct adapter * adapter, u32 op) { u32 value; - value = ReadRegDW(adapter, 0x208) & 0xFFF0FFFF; + value = read_reg_dw(adapter, 0x208) & 0xFFF0FFFF; if (op != 0) value = value | (adapter->dma_ctrl & 0x000F0000); - WriteRegDW(adapter, 0x208, value); + write_reg_dw(adapter, 0x208, value); } /* FlexCopII has 2 dma channels. DMA1 is used to transfer TS data to @@ -1559,7 +1562,7 @@ static void IrqDmaEnableDisableIrq(struct adapter * adapter, u32 op) register 0x018 contains the address of the subbuffer that was filled with TS data, when FlexCopII generates an interrupt. */ -static int DmaInitDMA(struct adapter *adapter, u32 dma_channel) +static int dma_init_dma(struct adapter *adapter, u32 dma_channel) { u32 subbuffers, subbufsize, subbuf0, subbuf1; @@ -1576,31 +1579,31 @@ static int DmaInitDMA(struct adapter *adapter, u32 dma_channel) dprintk("%s: first subbuffer address = 0x%x\n", __FUNCTION__, subbuf0); udelay(1000); - WriteRegDW(adapter, 0x000, subbuf0); + write_reg_dw(adapter, 0x000, subbuf0); dprintk("%s: subbuffer size = 0x%x\n", __FUNCTION__, (subbufsize >> 8) * 4); udelay(1000); - WriteRegDW(adapter, 0x004, subbufsize); + write_reg_dw(adapter, 0x004, subbufsize); dprintk("%s: second subbuffer address = 0x%x\n", __FUNCTION__, subbuf1); udelay(1000); - WriteRegDW(adapter, 0x00C, subbuf1); + write_reg_dw(adapter, 0x00C, subbuf1); dprintk("%s: counter = 0x%x\n", __FUNCTION__, adapter->dmaq1.bus_addr & 0xFFFFFFFC); - WriteRegDW(adapter, 0x008, adapter->dmaq1.bus_addr & 0xFFFFFFFC); + write_reg_dw(adapter, 0x008, adapter->dmaq1.bus_addr & 0xFFFFFFFC); udelay(1000); if (subbuffers == 0) - DmaEnableDisableIrq(adapter, 0, 1, 0); + dma_enable_disable_irq(adapter, 0, 1, 0); else - DmaEnableDisableIrq(adapter, 0, 1, 1); + dma_enable_disable_irq(adapter, 0, 1, 1); - IrqDmaEnableDisableIrq(adapter, 1); + irq_dma_enable_disable_irq(adapter, 1); - SRAMSetMediaDest(adapter, 1); - SRAMSetNetDest(adapter, 1); - SRAMSetCaiDest(adapter, 2); - SRAMSetCaoDest(adapter, 2); + sram_set_media_dest(adapter, 1); + sram_set_net_dest(adapter, 1); + sram_set_cai_dest(adapter, 2); + sram_set_cao_dest(adapter, 2); } if (dma_channel == 1) { @@ -1616,32 +1619,32 @@ static int DmaInitDMA(struct adapter *adapter, u32 dma_channel) dprintk("%s: first subbuffer address = 0x%x\n", __FUNCTION__, subbuf0); udelay(1000); - WriteRegDW(adapter, 0x010, subbuf0); + write_reg_dw(adapter, 0x010, subbuf0); dprintk("%s: subbuffer size = 0x%x\n", __FUNCTION__, (subbufsize >> 8) * 4); udelay(1000); - WriteRegDW(adapter, 0x014, subbufsize); + write_reg_dw(adapter, 0x014, subbufsize); dprintk("%s: second buffer address = 0x%x\n", __FUNCTION__, subbuf1); udelay(1000); - WriteRegDW(adapter, 0x01C, subbuf1); + write_reg_dw(adapter, 0x01C, subbuf1); - SRAMSetCaiDest(adapter, 2); + sram_set_cai_dest(adapter, 2); } return 0; } -static void CtrlEnableReceiveData(struct adapter *adapter, u32 op) +static void ctrl_enable_receive_data(struct adapter *adapter, u32 op) { if (op == 0) { - WriteRegOp(adapter, 0x208, 2, ~0x00008000, 0); + write_reg_op(adapter, 0x208, 2, ~0x00008000, 0); adapter->dma_status = adapter->dma_status & ~0x00000004; } else { - WriteRegOp(adapter, 0x208, 1, 0, 0x00008000); + write_reg_op(adapter, 0x208, 1, 0, 0x00008000); adapter->dma_status = adapter->dma_status | 0x00000004; } @@ -1650,7 +1653,7 @@ static void CtrlEnableReceiveData(struct adapter *adapter, u32 op) /* bit 0 of dma_mask is set to 1 if dma1 channel has to be enabled/disabled bit 1 of dma_mask is set to 1 if dma2 channel has to be enabled/disabled */ -static void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_stop) +static void dma_start_stop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_stop) { u32 dma_enable, dma1_enable, dma2_enable; @@ -1673,34 +1676,34 @@ static void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_ } // enable dma1 and dma2 if ((dma1_enable == 1) && (dma2_enable == 1)) { - WriteRegDW(adapter, 0x000, adapter->dmaq1.bus_addr | 1); - WriteRegDW(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); - WriteRegDW(adapter, 0x010, adapter->dmaq2.bus_addr | 1); + write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr | 1); + write_reg_dw(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); + write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr | 1); - CtrlEnableReceiveData(adapter, 1); + ctrl_enable_receive_data(adapter, 1); return; } // enable dma1 if ((dma1_enable == 1) && (dma2_enable == 0)) { - WriteRegDW(adapter, 0x000, adapter->dmaq1.bus_addr | 1); - WriteRegDW(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); + write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr | 1); + write_reg_dw(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); - CtrlEnableReceiveData(adapter, 1); + ctrl_enable_receive_data(adapter, 1); return; } // enable dma2 if ((dma1_enable == 0) && (dma2_enable == 1)) { - WriteRegDW(adapter, 0x010, adapter->dmaq2.bus_addr | 1); + write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr | 1); - CtrlEnableReceiveData(adapter, 1); + ctrl_enable_receive_data(adapter, 1); return; } // start dma if ((dma1_enable == 0) && (dma2_enable == 0)) { - CtrlEnableReceiveData(adapter, 1); + ctrl_enable_receive_data(adapter, 1); return; } @@ -1720,36 +1723,36 @@ static void DmaStartStop0x2102(struct adapter *adapter, u32 dma_mask, u32 start_ } //stop dma if ((dma_enable == 0) && ((adapter->dma_status & 4) != 0)) { - CtrlEnableReceiveData(adapter, 0); + ctrl_enable_receive_data(adapter, 0); udelay(3000); } //disable dma1 if (((dma_mask & 1) != 0) && ((adapter->dma_status & 1) != 0) && (adapter->dmaq1.bus_addr != 0)) { - WriteRegDW(adapter, 0x000, adapter->dmaq1.bus_addr); - WriteRegDW(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); + write_reg_dw(adapter, 0x000, adapter->dmaq1.bus_addr); + write_reg_dw(adapter, 0x00C, (adapter->dmaq1.bus_addr + adapter->dmaq1.buffer_size / 2) | 1); adapter->dma_status = adapter->dma_status & ~0x00000001; } //disable dma2 if (((dma_mask & 2) != 0) && ((adapter->dma_status & 2) != 0) && (adapter->dmaq2.bus_addr != 0)) { - WriteRegDW(adapter, 0x010, adapter->dmaq2.bus_addr); + write_reg_dw(adapter, 0x010, adapter->dmaq2.bus_addr); adapter->dma_status = adapter->dma_status & ~0x00000002; } } } -static void OpenStream(struct adapter *adapter, u32 pid) +static void open_stream(struct adapter *adapter, u32 pid) { u32 dma_mask; if (adapter->capturing == 0) adapter->capturing = 1; - FilterEnableMaskFilter(adapter, 1); + filter_enable_mask_filter(adapter, 1); - AddPID(adapter, pid); + add_pid(adapter, pid); dprintk("%s: adapter->dma_status=%x\n", __FUNCTION__, adapter->dma_status); @@ -1773,14 +1776,14 @@ static void OpenStream(struct adapter *adapter, u32 pid) } if (dma_mask != 0) { - IrqDmaEnableDisableIrq(adapter, 1); + irq_dma_enable_disable_irq(adapter, 1); - DmaStartStop0x2102(adapter, dma_mask, 1); + dma_start_stop0x2102(adapter, dma_mask, 1); } } } -static void CloseStream(struct adapter *adapter, u32 pid) +static void close_stream(struct adapter *adapter, u32 pid) { u32 dma_mask; @@ -1797,63 +1800,63 @@ static void CloseStream(struct adapter *adapter, u32 pid) dma_mask = dma_mask | 0x00000002; if (dma_mask != 0) { - DmaStartStop0x2102(adapter, dma_mask, 0); + dma_start_stop0x2102(adapter, dma_mask, 0); } - RemovePID(adapter, pid); + remove_pid(adapter, pid); } -static void InterruptServiceDMA1(struct adapter *adapter) +static void interrupt_service_dma1(struct adapter *adapter) { struct dvb_demux *dvbdmx = &adapter->demux; struct packet_header packet_header; - int nCurDmaCounter; - u32 nNumBytesParsed; - u32 nNumNewBytesTransferred; - u32 dwDefaultPacketSize = 188; - u8 gbTmpBuffer[188]; - u8 *pbDMABufCurPos; + int n_cur_dma_counter; + u32 n_num_bytes_parsed; + u32 n_num_new_bytes_transferred; + u32 dw_default_packet_size = 188; + u8 gb_tmp_buffer[188]; + u8 *pb_dma_buf_cur_pos; - nCurDmaCounter = readl(adapter->io_mem + 0x008) - adapter->dmaq1.bus_addr; - nCurDmaCounter = (nCurDmaCounter / dwDefaultPacketSize) * dwDefaultPacketSize; + n_cur_dma_counter = readl(adapter->io_mem + 0x008) - adapter->dmaq1.bus_addr; + n_cur_dma_counter = (n_cur_dma_counter / dw_default_packet_size) * dw_default_packet_size; - if ((nCurDmaCounter < 0) || (nCurDmaCounter > adapter->dmaq1.buffer_size)) { + if ((n_cur_dma_counter < 0) || (n_cur_dma_counter > adapter->dmaq1.buffer_size)) { dprintk("%s: dma counter outside dma buffer\n", __FUNCTION__); return; } - adapter->dmaq1.head = nCurDmaCounter; + adapter->dmaq1.head = n_cur_dma_counter; - if (adapter->dmaq1.tail <= nCurDmaCounter) { - nNumNewBytesTransferred = nCurDmaCounter - adapter->dmaq1.tail; + if (adapter->dmaq1.tail <= n_cur_dma_counter) { + n_num_new_bytes_transferred = n_cur_dma_counter - adapter->dmaq1.tail; } else { - nNumNewBytesTransferred = (adapter->dmaq1.buffer_size - adapter->dmaq1.tail) + nCurDmaCounter; + n_num_new_bytes_transferred = (adapter->dmaq1.buffer_size - adapter->dmaq1.tail) + n_cur_dma_counter; } - dprintk("%s: nCurDmaCounter = %d\n" , __FUNCTION__, nCurDmaCounter); - dprintk("%s: dmaq1.tail = %d\n" , __FUNCTION__, adapter->dmaq1.tail); - dprintk("%s: BytesTransferred = %d\n" , __FUNCTION__, nNumNewBytesTransferred); + dprintk("%s: n_cur_dma_counter = %d\n" , __FUNCTION__, n_cur_dma_counter); + dprintk("%s: dmaq1.tail = %d\n" , __FUNCTION__, adapter->dmaq1.tail); + dprintk("%s: bytes_transferred = %d\n" , __FUNCTION__, n_num_new_bytes_transferred); - if (nNumNewBytesTransferred < dwDefaultPacketSize) + if (n_num_new_bytes_transferred < dw_default_packet_size) return; - nNumBytesParsed = 0; + n_num_bytes_parsed = 0; - while (nNumBytesParsed < nNumNewBytesTransferred) { - pbDMABufCurPos = adapter->dmaq1.buffer + adapter->dmaq1.tail; + while (n_num_bytes_parsed < n_num_new_bytes_transferred) { + pb_dma_buf_cur_pos = adapter->dmaq1.buffer + adapter->dmaq1.tail; if (adapter->dmaq1.buffer + adapter->dmaq1.buffer_size < adapter->dmaq1.buffer + adapter->dmaq1.tail + 188) { - memcpy(gbTmpBuffer, adapter->dmaq1.buffer + adapter->dmaq1.tail, adapter->dmaq1.buffer_size - adapter->dmaq1.tail); - memcpy(gbTmpBuffer + (adapter->dmaq1.buffer_size - adapter->dmaq1.tail), adapter->dmaq1.buffer, (188 - (adapter->dmaq1.buffer_size - adapter->dmaq1.tail))); + memcpy(gb_tmp_buffer, adapter->dmaq1.buffer + adapter->dmaq1.tail, adapter->dmaq1.buffer_size - adapter->dmaq1.tail); + memcpy(gb_tmp_buffer + (adapter->dmaq1.buffer_size - adapter->dmaq1.tail), adapter->dmaq1.buffer, (188 - (adapter->dmaq1.buffer_size - adapter->dmaq1.tail))); - pbDMABufCurPos = gbTmpBuffer; + pb_dma_buf_cur_pos = gb_tmp_buffer; } if (adapter->capturing != 0) { - u32 *dq = (u32 *) pbDMABufCurPos; + u32 *dq = (u32 *) pb_dma_buf_cur_pos; packet_header.sync_byte = *dq & 0x000000FF; packet_header.transport_error_indicator = *dq & 0x00008000; @@ -1865,9 +1868,9 @@ static void InterruptServiceDMA1(struct adapter *adapter) packet_header.continuity_counter = (*dq & 0x0F000000) >> 0x18; if ((packet_header.sync_byte == 0x47) && (packet_header.transport_error_indicator == 0) && (packet_header.pid != 0x1FFF)) { - if (CheckPID(adapter, packet_header.pid & 0x0000FFFF) != 0) + if (check_pid(adapter, packet_header.pid & 0x0000FFFF) != 0) { - dvb_dmx_swfilter_packets(dvbdmx, pbDMABufCurPos, dwDefaultPacketSize / 188); + dvb_dmx_swfilter_packets(dvbdmx, pb_dma_buf_cur_pos, dw_default_packet_size / 188); } else { @@ -1876,16 +1879,16 @@ static void InterruptServiceDMA1(struct adapter *adapter) } } - nNumBytesParsed = nNumBytesParsed + dwDefaultPacketSize; + n_num_bytes_parsed = n_num_bytes_parsed + dw_default_packet_size; - adapter->dmaq1.tail = adapter->dmaq1.tail + dwDefaultPacketSize; + adapter->dmaq1.tail = adapter->dmaq1.tail + dw_default_packet_size; if (adapter->dmaq1.tail >= adapter->dmaq1.buffer_size) adapter->dmaq1.tail = adapter->dmaq1.tail - adapter->dmaq1.buffer_size; }; } -static void InterruptServiceDMA2(struct adapter *adapter) +static void interrupt_service_dma2(struct adapter *adapter) { printk("%s:\n", __FUNCTION__); } @@ -1900,24 +1903,24 @@ static irqreturn_t isr(int irq, void *dev_id, struct pt_regs *regs) spin_lock_irq(&tmp->lock); - if (0 == ((value = ReadRegDW(tmp, 0x20C)) & 0x0F)) { + if (0 == ((value = read_reg_dw(tmp, 0x20C)) & 0x0F)) { spin_unlock_irq(&tmp->lock); return IRQ_NONE; } while (value != 0) { if ((value & 0x03) != 0) - InterruptServiceDMA1(tmp); + interrupt_service_dma1(tmp); if ((value & 0x0C) != 0) - InterruptServiceDMA2(tmp); - value = ReadRegDW(tmp, 0x20C) & 0x0F; + interrupt_service_dma2(tmp); + value = read_reg_dw(tmp, 0x20C) & 0x0F; } spin_unlock_irq(&tmp->lock); return IRQ_HANDLED; } -static void Initdmaqueue(struct adapter *adapter) +static void init_dma_queue(struct adapter *adapter) { dma_addr_t dma_addr; @@ -1928,19 +1931,19 @@ static void Initdmaqueue(struct adapter *adapter) adapter->dmaq1.tail = 0; adapter->dmaq1.buffer = 0; - adapter->dmaq1.buffer = pci_alloc_consistent(adapter->pdev, SizeOfBufDMA1 + 0x80, &dma_addr); + adapter->dmaq1.buffer = pci_alloc_consistent(adapter->pdev, SIZE_OF_BUF_DMA1 + 0x80, &dma_addr); if (adapter->dmaq1.buffer != 0) { - memset(adapter->dmaq1.buffer, 0, SizeOfBufDMA1); + memset(adapter->dmaq1.buffer, 0, SIZE_OF_BUF_DMA1); adapter->dmaq1.bus_addr = dma_addr; - adapter->dmaq1.buffer_size = SizeOfBufDMA1; + adapter->dmaq1.buffer_size = SIZE_OF_BUF_DMA1; - DmaInitDMA(adapter, 0); + dma_init_dma(adapter, 0); adapter->dma_status = adapter->dma_status | 0x10000000; - dprintk("%s: allocated dma buffer at 0x%p, length=%d\n", __FUNCTION__, adapter->dmaq1.buffer, SizeOfBufDMA1); + dprintk("%s: allocated dma buffer at 0x%p, length=%d\n", __FUNCTION__, adapter->dmaq1.buffer, SIZE_OF_BUF_DMA1); } else { @@ -1954,19 +1957,19 @@ static void Initdmaqueue(struct adapter *adapter) adapter->dmaq2.tail = 0; adapter->dmaq2.buffer = 0; - adapter->dmaq2.buffer = pci_alloc_consistent(adapter->pdev, SizeOfBufDMA2 + 0x80, &dma_addr); + adapter->dmaq2.buffer = pci_alloc_consistent(adapter->pdev, SIZE_OF_BUF_DMA2 + 0x80, &dma_addr); if (adapter->dmaq2.buffer != 0) { - memset(adapter->dmaq2.buffer, 0, SizeOfBufDMA2); + memset(adapter->dmaq2.buffer, 0, SIZE_OF_BUF_DMA2); adapter->dmaq2.bus_addr = dma_addr; - adapter->dmaq2.buffer_size = SizeOfBufDMA2; + adapter->dmaq2.buffer_size = SIZE_OF_BUF_DMA2; - DmaInitDMA(adapter, 1); + dma_init_dma(adapter, 1); adapter->dma_status = adapter->dma_status | 0x20000000; - dprintk("%s: allocated dma buffer at 0x%p, length=%d\n", __FUNCTION__, adapter->dmaq2.buffer, (int) SizeOfBufDMA2); + dprintk("%s: allocated dma buffer at 0x%p, length=%d\n", __FUNCTION__, adapter->dmaq2.buffer, (int) SIZE_OF_BUF_DMA2); } else { @@ -1974,10 +1977,10 @@ static void Initdmaqueue(struct adapter *adapter) } } -static void Freedmaqueue(struct adapter *adapter) +static void free_dma_queue(struct adapter *adapter) { if (adapter->dmaq1.buffer != 0) { - pci_free_consistent(adapter->pdev, SizeOfBufDMA1 + 0x80, adapter->dmaq1.buffer, adapter->dmaq1.bus_addr); + pci_free_consistent(adapter->pdev, SIZE_OF_BUF_DMA1 + 0x80, adapter->dmaq1.buffer, adapter->dmaq1.bus_addr); adapter->dmaq1.bus_addr = 0; adapter->dmaq1.head = 0; @@ -1987,7 +1990,7 @@ static void Freedmaqueue(struct adapter *adapter) } if (adapter->dmaq2.buffer != 0) { - pci_free_consistent(adapter->pdev, SizeOfBufDMA2 + 0x80, adapter->dmaq2.buffer, adapter->dmaq2.bus_addr); + pci_free_consistent(adapter->pdev, SIZE_OF_BUF_DMA2 + 0x80, adapter->dmaq2.buffer, adapter->dmaq2.bus_addr); adapter->dmaq2.bus_addr = 0; adapter->dmaq2.head = 0; @@ -1997,16 +2000,16 @@ static void Freedmaqueue(struct adapter *adapter) } } -static void FreeAdapterObject(struct adapter *adapter) +static void free_adapter_object(struct adapter *adapter) { dprintk("%s:\n", __FUNCTION__); - CloseStream(adapter, 0); + close_stream(adapter, 0); if (adapter->irq != 0) free_irq(adapter->irq, adapter); - Freedmaqueue(adapter); + free_dma_queue(adapter); if (adapter->io_mem != 0) iounmap((void *) adapter->io_mem); @@ -2017,7 +2020,7 @@ static void FreeAdapterObject(struct adapter *adapter) static struct pci_driver skystar2_pci_driver; -static int ClaimAdapter(struct adapter *adapter) +static int claim_adapter(struct adapter *adapter) { struct pci_dev *pdev = adapter->pdev; @@ -2057,16 +2060,16 @@ static int ClaimAdapter(struct adapter *adapter) } /* -static int SLL_reset_FlexCOP(struct adapter *adapter) +static int sll_reset_flexcop(struct adapter *adapter) { - WriteRegDW(adapter, 0x208, 0); - WriteRegDW(adapter, 0x210, 0xB2FF); + write_reg_dw(adapter, 0x208, 0); + write_reg_dw(adapter, 0x210, 0xB2FF); return 0; } */ -static int DriverInitialize(struct pci_dev * pdev) +static int driver_initialize(struct pci_dev * pdev) { struct adapter *adapter; u32 tmp; @@ -2084,91 +2087,91 @@ static int DriverInitialize(struct pci_dev * pdev) adapter->pdev = pdev; adapter->irq = pdev->irq; - if ((ClaimAdapter(adapter)) != 1) { - FreeAdapterObject(adapter); + if ((claim_adapter(adapter)) != 1) { + free_adapter_object(adapter); return -ENODEV; } - IrqDmaEnableDisableIrq(adapter, 0); + irq_dma_enable_disable_irq(adapter, 0); if (request_irq(pdev->irq, isr, 0x4000000, "Skystar2", adapter) != 0) { dprintk("%s: unable to allocate irq=%d !\n", __FUNCTION__, pdev->irq); - FreeAdapterObject(adapter); + free_adapter_object(adapter); return -ENODEV; } - ReadRegDW(adapter, 0x208); - WriteRegDW(adapter, 0x208, 0); - WriteRegDW(adapter, 0x210, 0xB2FF); - WriteRegDW(adapter, 0x208, 0x40); + read_reg_dw(adapter, 0x208); + write_reg_dw(adapter, 0x208, 0); + write_reg_dw(adapter, 0x210, 0xB2FF); + write_reg_dw(adapter, 0x208, 0x40); - InitPIDsInfo(adapter); + init_pids_info(adapter); - PidSetGroupPID(adapter, 0); - PidSetGroupMASK(adapter, 0x1FE0); - PidSetStream1PID(adapter, 0x1FFF); - PidSetStream2PID(adapter, 0x1FFF); - PidSetPmtPID(adapter, 0x1FFF); - PidSetPcrPID(adapter, 0x1FFF); - PidSetEcmPID(adapter, 0x1FFF); - PidSetEmmPID(adapter, 0x1FFF); + pid_set_group_pid(adapter, 0); + pid_set_group_mask(adapter, 0x1FE0); + pid_set_stream1_pid(adapter, 0x1FFF); + pid_set_stream2_pid(adapter, 0x1FFF); + pid_set_pmt_pid(adapter, 0x1FFF); + pid_set_pcr_pid(adapter, 0x1FFF); + pid_set_ecm_pid(adapter, 0x1FFF); + pid_set_emm_pid(adapter, 0x1FFF); - Initdmaqueue(adapter); + init_dma_queue(adapter); if ((adapter->dma_status & 0x30000000) == 0) { - FreeAdapterObject(adapter); + free_adapter_object(adapter); return -ENODEV; } - adapter->b2c2_revision = (ReadRegDW(adapter, 0x204) >> 0x18); + adapter->b2c2_revision = (read_reg_dw(adapter, 0x204) >> 0x18); if ((adapter->b2c2_revision != 0x82) && (adapter->b2c2_revision != 0xC3)) if (adapter->b2c2_revision != 0x82) { dprintk("%s: The revision of the FlexCopII chip on your card is - %d\n", __FUNCTION__, adapter->b2c2_revision); dprintk("%s: This driver works now only with FlexCopII(rev.130) and FlexCopIIB(rev.195).\n", __FUNCTION__); - FreeAdapterObject(adapter); + free_adapter_object(adapter); return -ENODEV; } - tmp = ReadRegDW(adapter, 0x204); + tmp = read_reg_dw(adapter, 0x204); - WriteRegDW(adapter, 0x204, 0); + write_reg_dw(adapter, 0x204, 0); mdelay(20); - WriteRegDW(adapter, 0x204, tmp); + write_reg_dw(adapter, 0x204, tmp); mdelay(10); - tmp = ReadRegDW(adapter, 0x308); - WriteRegDW(adapter, 0x308, 0x4000 | tmp); + tmp = read_reg_dw(adapter, 0x308); + write_reg_dw(adapter, 0x308, 0x4000 | tmp); - adapter->dwSramType = 0x10000; + adapter->dw_sram_type = 0x10000; - SLL_detectSramSize(adapter); + sll_detect_sram_size(adapter); - dprintk("%s sram length = %d, sram type= %x\n", __FUNCTION__, SRAM_length(adapter), adapter->dwSramType); + dprintk("%s sram length = %d, sram type= %x\n", __FUNCTION__, sram_length(adapter), adapter->dw_sram_type); - SRAMSetMediaDest(adapter, 1); - SRAMSetNetDest(adapter, 1); + sram_set_media_dest(adapter, 1); + sram_set_net_dest(adapter, 1); - CtrlEnableSmc(adapter, 0); + ctrl_enable_smc(adapter, 0); - SRAMSetCaiDest(adapter, 2); - SRAMSetCaoDest(adapter, 2); + sram_set_cai_dest(adapter, 2); + sram_set_cao_dest(adapter, 2); - DmaEnableDisableIrq(adapter, 1, 0, 0); + dma_enable_disable_irq(adapter, 1, 0, 0); - if (EEPROM_getMacAddr(adapter, 0, adapter->mac_addr) != 0) { + if (eeprom_get_mac_addr(adapter, 0, adapter->mac_addr) != 0) { printk("%s MAC address = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x \n", __FUNCTION__, adapter->mac_addr[0], adapter->mac_addr[1], adapter->mac_addr[2], adapter->mac_addr[3], adapter->mac_addr[4], adapter->mac_addr[5], adapter->mac_addr[6], adapter->mac_addr[7] ); - CASetMacDstAddrFilter(adapter, adapter->mac_addr); - CtrlEnableMAC(adapter, 1); + ca_set_mac_dst_addr_filter(adapter, adapter->mac_addr); + ctrl_enable_mac(adapter, 1); } adapter->lock = SPIN_LOCK_UNLOCKED; @@ -2176,17 +2179,17 @@ static int DriverInitialize(struct pci_dev * pdev) return 0; } -static void DriverHalt(struct pci_dev *pdev) +static void driver_halt(struct pci_dev *pdev) { struct adapter *adapter; adapter = pci_get_drvdata(pdev); - IrqDmaEnableDisableIrq(adapter, 0); + irq_dma_enable_disable_irq(adapter, 0); - CtrlEnableReceiveData(adapter, 0); + ctrl_enable_receive_data(adapter, 0); - FreeAdapterObject(adapter); + free_adapter_object(adapter); pci_set_drvdata(pdev, NULL); @@ -2202,7 +2205,7 @@ static int dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) dprintk("%s: PID=%d, type=%d\n", __FUNCTION__, dvbdmxfeed->pid, dvbdmxfeed->type); - OpenStream(adapter, dvbdmxfeed->pid); + open_stream(adapter, dvbdmxfeed->pid); return 0; } @@ -2214,7 +2217,7 @@ static int dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) dprintk("%s: PID=%d, type=%d\n", __FUNCTION__, dvbdmxfeed->pid, dvbdmxfeed->type); - CloseStream(adapter, dvbdmxfeed->pid); + close_stream(adapter, dvbdmxfeed->pid); return 0; } @@ -2222,23 +2225,23 @@ static int dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) /* lnb control */ static void set_tuner_tone(struct adapter *adapter, u8 tone) { - u16 wzHalfPeriodFor45MHz[] = { 0x01FF, 0x0154, 0x00FF, 0x00CC }; + u16 wz_half_period_for_45_mhz[] = { 0x01FF, 0x0154, 0x00FF, 0x00CC }; u16 ax; dprintk("%s: %u\n", __FUNCTION__, tone); switch (tone) { case 1: - ax = wzHalfPeriodFor45MHz[0]; + ax = wz_half_period_for_45_mhz[0]; break; case 2: - ax = wzHalfPeriodFor45MHz[1]; + ax = wz_half_period_for_45_mhz[1]; break; case 3: - ax = wzHalfPeriodFor45MHz[2]; + ax = wz_half_period_for_45_mhz[2]; break; case 4: - ax = wzHalfPeriodFor45MHz[3]; + ax = wz_half_period_for_45_mhz[3]; break; default: @@ -2246,11 +2249,11 @@ static void set_tuner_tone(struct adapter *adapter, u8 tone) } if (ax != 0) { - WriteRegDW(adapter, 0x200, ((ax << 0x0F) + (ax & 0x7FFF)) | 0x40000000); + write_reg_dw(adapter, 0x200, ((ax << 0x0F) + (ax & 0x7FFF)) | 0x40000000); } else { - WriteRegDW(adapter, 0x200, 0x40FF8000); + write_reg_dw(adapter, 0x200, 0x40FF8000); } } @@ -2260,7 +2263,7 @@ static void set_tuner_polarity(struct adapter *adapter, u8 polarity) dprintk("%s : polarity = %u \n", __FUNCTION__, polarity); - var = ReadRegDW(adapter, 0x204); + var = read_reg_dw(adapter, 0x204); if (polarity == 0) { dprintk("%s: LNB power off\n", __FUNCTION__); @@ -2277,7 +2280,7 @@ static void set_tuner_polarity(struct adapter *adapter, u8 polarity) var = var | 4; } - WriteRegDW(adapter, 0x204, var); + write_reg_dw(adapter, 0x204, var); } static int flexcop_diseqc_ioctl(struct dvb_frontend *fe, unsigned int cmd, void *arg) @@ -2433,7 +2436,7 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (pdev == NULL) return -ENODEV; - if (DriverInitialize(pdev) != 0) + if (driver_initialize(pdev) != 0) return -ENODEV; dvb_register_adapter(&dvb_adapter, skystar2_pci_driver.name); @@ -2441,7 +2444,7 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (dvb_adapter == NULL) { printk("%s: Error registering DVB adapter\n", __FUNCTION__); - DriverHalt(pdev); + driver_halt(pdev); return -ENODEV; } @@ -2526,7 +2529,7 @@ static void skystar2_remove(struct pci_dev *pdev) dvb_unregister_adapter(adapter->dvb_adapter); } - DriverHalt(pdev); + driver_halt(pdev); } } |