Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
b22267d3
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b22267d3
编写于
7月 01, 2008
作者:
K
Krzysztof Hałasa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WAN: Convert PC300 driver to use normal u8/u16/u32 types
Signed-off-by:
N
Krzysztof Hałasa
<
khc@pm.waw.pl
>
上级
c36936ce
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
150 addition
and
154 deletion
+150
-154
drivers/net/wan/pc300.h
drivers/net/wan/pc300.h
+90
-94
drivers/net/wan/pc300_drv.c
drivers/net/wan/pc300_drv.c
+60
-60
未找到文件。
drivers/net/wan/pc300.h
浏览文件 @
b22267d3
...
...
@@ -103,10 +103,6 @@
#include "hd64572.h"
#include "pc300-falc-lh.h"
typedef
__u32
uclong
;
/* 32 bits, unsigned */
typedef
__u16
ucshort
;
/* 16 bits, unsigned */
typedef
__u8
ucchar
;
/* 8 bits, unsigned */
#define PC300_PROTO_MLPPP 1
#define PC300_MAXCHAN 2
/* Number of channels per card */
...
...
@@ -147,9 +143,9 @@ typedef __u8 ucchar; /* 8 bits, unsigned */
* Memory access functions/macros *
* (required to support Alpha systems) *
***************************************/
#define cpc_writeb(port,val) {writeb((u
cchar
)(val),(port)); mb();}
#define cpc_writeb(port,val) {writeb((u
8
)(val),(port)); mb();}
#define cpc_writew(port,val) {writew((ushort)(val),(port)); mb();}
#define cpc_writel(port,val) {writel((u
clong
)(val),(port)); mb();}
#define cpc_writel(port,val) {writel((u
32
)(val),(port)); mb();}
#define cpc_readb(port) readb(port)
#define cpc_readw(port) readw(port)
...
...
@@ -163,15 +159,15 @@ typedef __u8 ucchar; /* 8 bits, unsigned */
* (memory mapped).
*/
struct
RUNTIME_9050
{
u
clong
loc_addr_range
[
4
];
/* 00-0Ch : Local Address Ranges */
u
clong
loc_rom_range
;
/* 10h : Local ROM Range */
u
clong
loc_addr_base
[
4
];
/* 14-20h : Local Address Base Addrs */
u
clong
loc_rom_base
;
/* 24h : Local ROM Base */
u
clong
loc_bus_descr
[
4
];
/* 28-34h : Local Bus Descriptors */
u
clong
rom_bus_descr
;
/* 38h : ROM Bus Descriptor */
u
clong
cs_base
[
4
];
/* 3C-48h : Chip Select Base Addrs */
u
clong
intr_ctrl_stat
;
/* 4Ch : Interrupt Control/Status */
u
clong
init_ctrl
;
/* 50h : EEPROM ctrl, Init Ctrl, etc */
u
32
loc_addr_range
[
4
];
/* 00-0Ch : Local Address Ranges */
u
32
loc_rom_range
;
/* 10h : Local ROM Range */
u
32
loc_addr_base
[
4
];
/* 14-20h : Local Address Base Addrs */
u
32
loc_rom_base
;
/* 24h : Local ROM Base */
u
32
loc_bus_descr
[
4
];
/* 28-34h : Local Bus Descriptors */
u
32
rom_bus_descr
;
/* 38h : ROM Bus Descriptor */
u
32
cs_base
[
4
];
/* 3C-48h : Chip Select Base Addrs */
u
32
intr_ctrl_stat
;
/* 4Ch : Interrupt Control/Status */
u
32
init_ctrl
;
/* 50h : EEPROM ctrl, Init Ctrl, etc */
};
#define PLX_9050_LINT1_ENABLE 0x01
...
...
@@ -215,66 +211,66 @@ struct RUNTIME_9050 {
#define PC300_FALC_MAXLOOP 0x0000ffff
/* for falc_issue_cmd() */
typedef
struct
falc
{
u
cchar
sync
;
/* If true FALC is synchronized */
u
cchar
active
;
/* if TRUE then already active */
u
cchar
loop_active
;
/* if TRUE a line loopback UP was received */
u
cchar
loop_gen
;
/* if TRUE a line loopback UP was issued */
u
8
sync
;
/* If true FALC is synchronized */
u
8
active
;
/* if TRUE then already active */
u
8
loop_active
;
/* if TRUE a line loopback UP was received */
u
8
loop_gen
;
/* if TRUE a line loopback UP was issued */
u
cchar
num_channels
;
u
cchar
offset
;
/* 1 for T1, 0 for E1 */
u
cchar
full_bandwidth
;
u
8
num_channels
;
u
8
offset
;
/* 1 for T1, 0 for E1 */
u
8
full_bandwidth
;
u
cchar
xmb_cause
;
u
cchar
multiframe_mode
;
u
8
xmb_cause
;
u
8
multiframe_mode
;
/* Statistics */
u
cshort
pden
;
/* Pulse Density violation count */
u
cshort
los
;
/* Loss of Signal count */
u
cshort
losr
;
/* Loss of Signal recovery count */
u
cshort
lfa
;
/* Loss of frame alignment count */
u
cshort
farec
;
/* Frame Alignment Recovery count */
u
cshort
lmfa
;
/* Loss of multiframe alignment count */
u
cshort
ais
;
/* Remote Alarm indication Signal count */
u
cshort
sec
;
/* One-second timer */
u
cshort
es
;
/* Errored second */
u
cshort
rai
;
/* remote alarm received */
u
cshort
bec
;
u
cshort
fec
;
u
cshort
cvc
;
u
cshort
cec
;
u
cshort
ebc
;
u
16
pden
;
/* Pulse Density violation count */
u
16
los
;
/* Loss of Signal count */
u
16
losr
;
/* Loss of Signal recovery count */
u
16
lfa
;
/* Loss of frame alignment count */
u
16
farec
;
/* Frame Alignment Recovery count */
u
16
lmfa
;
/* Loss of multiframe alignment count */
u
16
ais
;
/* Remote Alarm indication Signal count */
u
16
sec
;
/* One-second timer */
u
16
es
;
/* Errored second */
u
16
rai
;
/* remote alarm received */
u
16
bec
;
u
16
fec
;
u
16
cvc
;
u
16
cec
;
u
16
ebc
;
/* Status */
u
cchar
red_alarm
;
u
cchar
blue_alarm
;
u
cchar
loss_fa
;
u
cchar
yellow_alarm
;
u
cchar
loss_mfa
;
u
cchar
prbs
;
u
8
red_alarm
;
u
8
blue_alarm
;
u
8
loss_fa
;
u
8
yellow_alarm
;
u
8
loss_mfa
;
u
8
prbs
;
}
falc_t
;
typedef
struct
falc_status
{
u
cchar
sync
;
/* If true FALC is synchronized */
u
cchar
red_alarm
;
u
cchar
blue_alarm
;
u
cchar
loss_fa
;
u
cchar
yellow_alarm
;
u
cchar
loss_mfa
;
u
cchar
prbs
;
u
8
sync
;
/* If true FALC is synchronized */
u
8
red_alarm
;
u
8
blue_alarm
;
u
8
loss_fa
;
u
8
yellow_alarm
;
u
8
loss_mfa
;
u
8
prbs
;
}
falc_status_t
;
typedef
struct
rsv_x21_status
{
u
cchar
dcd
;
u
cchar
dsr
;
u
cchar
cts
;
u
cchar
rts
;
u
cchar
dtr
;
u
8
dcd
;
u
8
dsr
;
u
8
cts
;
u
8
rts
;
u
8
dtr
;
}
rsv_x21_status_t
;
typedef
struct
pc300stats
{
int
hw_type
;
u
clong
line_on
;
u
clong
line_off
;
u
32
line_on
;
u
32
line_off
;
struct
net_device_stats
gen_stats
;
falc_t
te_stats
;
}
pc300stats_t
;
...
...
@@ -292,14 +288,14 @@ typedef struct pc300loopback {
typedef
struct
pc300patterntst
{
char
patrntst_on
;
/* 0 - off; 1 - on; 2 - read num_errors */
u
cshort
num_errors
;
u
16
num_errors
;
}
pc300patterntst_t
;
typedef
struct
pc300dev
{
struct
pc300ch
*
chan
;
u
cchar
trace_on
;
u
clong
line_on
;
/* DCD(X.21, RSV) / sync(TE) change counters */
u
clong
line_off
;
u
8
trace_on
;
u
32
line_on
;
/* DCD(X.21, RSV) / sync(TE) change counters */
u
32
line_off
;
char
name
[
16
];
struct
net_device
*
dev
;
#ifdef CONFIG_PC300_MLPPP
...
...
@@ -312,42 +308,42 @@ typedef struct pc300hw {
int
bus
;
/* Bus (PCI, PMC, etc.) */
int
nchan
;
/* number of channels */
int
irq
;
/* interrupt request level */
u
clong
clock
;
/* Board clock */
u
cchar
cpld_id
;
/* CPLD ID (TE only) */
u
cshort
cpld_reg1
;
/* CPLD reg 1 (TE only) */
u
cshort
cpld_reg2
;
/* CPLD reg 2 (TE only) */
u
cshort
gpioc_reg
;
/* PLX GPIOC reg */
u
cshort
intctl_reg
;
/* PLX Int Ctrl/Status reg */
u
clong
iophys
;
/* PLX registers I/O base */
u
clong
iosize
;
/* PLX registers I/O size */
u
clong
plxphys
;
/* PLX registers MMIO base (physical) */
u
32
clock
;
/* Board clock */
u
8
cpld_id
;
/* CPLD ID (TE only) */
u
16
cpld_reg1
;
/* CPLD reg 1 (TE only) */
u
16
cpld_reg2
;
/* CPLD reg 2 (TE only) */
u
16
gpioc_reg
;
/* PLX GPIOC reg */
u
16
intctl_reg
;
/* PLX Int Ctrl/Status reg */
u
32
iophys
;
/* PLX registers I/O base */
u
32
iosize
;
/* PLX registers I/O size */
u
32
plxphys
;
/* PLX registers MMIO base (physical) */
void
__iomem
*
plxbase
;
/* PLX registers MMIO base (virtual) */
u
clong
plxsize
;
/* PLX registers MMIO size */
u
clong
scaphys
;
/* SCA registers MMIO base (physical) */
u
32
plxsize
;
/* PLX registers MMIO size */
u
32
scaphys
;
/* SCA registers MMIO base (physical) */
void
__iomem
*
scabase
;
/* SCA registers MMIO base (virtual) */
u
clong
scasize
;
/* SCA registers MMIO size */
u
clong
ramphys
;
/* On-board RAM MMIO base (physical) */
u
32
scasize
;
/* SCA registers MMIO size */
u
32
ramphys
;
/* On-board RAM MMIO base (physical) */
void
__iomem
*
rambase
;
/* On-board RAM MMIO base (virtual) */
u
clong
alloc_ramsize
;
/* RAM MMIO size allocated by the PCI bridge */
u
clong
ramsize
;
/* On-board RAM MMIO size */
u
clong
falcphys
;
/* FALC registers MMIO base (physical) */
u
32
alloc_ramsize
;
/* RAM MMIO size allocated by the PCI bridge */
u
32
ramsize
;
/* On-board RAM MMIO size */
u
32
falcphys
;
/* FALC registers MMIO base (physical) */
void
__iomem
*
falcbase
;
/* FALC registers MMIO base (virtual) */
u
clong
falcsize
;
/* FALC registers MMIO size */
u
32
falcsize
;
/* FALC registers MMIO size */
}
pc300hw_t
;
typedef
struct
pc300chconf
{
sync_serial_settings
phys_settings
;
/* Clock type/rate (in bps),
sync_serial_settings
phys_settings
;
/* Clock type/rate (in bps),
loopback mode */
raw_hdlc_proto
proto_settings
;
/* Encoding, parity (CRC) */
u
clong
media
;
/* HW media (RS232, V.35, etc.) */
u
clong
proto
;
/* Protocol (PPP, X.25, etc.) */
u
32
media
;
/* HW media (RS232, V.35, etc.) */
u
32
proto
;
/* Protocol (PPP, X.25, etc.) */
/* TE-specific parameters */
u
cchar
lcode
;
/* Line Code (AMI, B8ZS, etc.) */
u
cchar
fr_mode
;
/* Frame Mode (ESF, D4, etc.) */
u
cchar
lbo
;
/* Line Build Out */
u
cchar
rx_sens
;
/* Rx Sensitivity (long- or short-haul) */
u
clong
tslot_bitmap
;
/* bit[i]=1 => timeslot _i_ is active */
u
8
lcode
;
/* Line Code (AMI, B8ZS, etc.) */
u
8
fr_mode
;
/* Frame Mode (ESF, D4, etc.) */
u
8
lbo
;
/* Line Build Out */
u
8
rx_sens
;
/* Rx Sensitivity (long- or short-haul) */
u
32
tslot_bitmap
;
/* bit[i]=1 => timeslot _i_ is active */
}
pc300chconf_t
;
typedef
struct
pc300ch
{
...
...
@@ -355,12 +351,12 @@ typedef struct pc300ch {
int
channel
;
pc300dev_t
d
;
pc300chconf_t
conf
;
u
cchar
tx_first_bd
;
/* First TX DMA block descr. w/ data */
u
cchar
tx_next_bd
;
/* Next free TX DMA block descriptor */
u
cchar
rx_first_bd
;
/* First free RX DMA block descriptor */
u
cchar
rx_last_bd
;
/* Last free RX DMA block descriptor */
u
cchar
nfree_tx_bd
;
/* Number of free TX DMA block descriptors */
falc_t
falc
;
/* FALC structure (TE only) */
u
8
tx_first_bd
;
/* First TX DMA block descr. w/ data */
u
8
tx_next_bd
;
/* Next free TX DMA block descriptor */
u
8
rx_first_bd
;
/* First free RX DMA block descriptor */
u
8
rx_last_bd
;
/* Last free RX DMA block descriptor */
u
8
nfree_tx_bd
;
/* Number of free TX DMA block descriptors */
falc_t
falc
;
/* FALC structure (TE only) */
}
pc300ch_t
;
typedef
struct
pc300
{
...
...
drivers/net/wan/pc300_drv.c
浏览文件 @
b22267d3
...
...
@@ -283,8 +283,8 @@ static void rx_dma_buf_init(pc300_t *, int);
static
void
tx_dma_buf_check
(
pc300_t
*
,
int
);
static
void
rx_dma_buf_check
(
pc300_t
*
,
int
);
static
irqreturn_t
cpc_intr
(
int
,
void
*
);
static
int
clock_rate_calc
(
u
clong
,
uclong
,
int
*
);
static
u
clong
detect_ram
(
pc300_t
*
);
static
int
clock_rate_calc
(
u
32
,
u32
,
int
*
);
static
u
32
detect_ram
(
pc300_t
*
);
static
void
plx_init
(
pc300_t
*
);
static
void
cpc_trace
(
struct
net_device
*
,
struct
sk_buff
*
,
char
);
static
int
cpc_attach
(
struct
net_device
*
,
unsigned
short
,
unsigned
short
);
...
...
@@ -309,10 +309,10 @@ static void tx_dma_buf_pt_init(pc300_t * card, int ch)
+
DMA_TX_BD_BASE
+
ch_factor
*
sizeof
(
pcsca_bd_t
));
for
(
i
=
0
;
i
<
N_DMA_TX_BUF
;
i
++
,
ptdescr
++
)
{
cpc_writel
(
&
ptdescr
->
next
,
(
u
clong
)
(
DMA_TX_BD_BASE
+
cpc_writel
(
&
ptdescr
->
next
,
(
u
32
)
(
DMA_TX_BD_BASE
+
(
ch_factor
+
((
i
+
1
)
&
(
N_DMA_TX_BUF
-
1
)))
*
sizeof
(
pcsca_bd_t
)));
cpc_writel
(
&
ptdescr
->
ptbuf
,
(
uclong
)
(
DMA_TX_BASE
+
(
ch_factor
+
i
)
*
BD_DEF_LEN
));
cpc_writel
(
&
ptdescr
->
ptbuf
,
(
u32
)
(
DMA_TX_BASE
+
(
ch_factor
+
i
)
*
BD_DEF_LEN
));
}
}
...
...
@@ -339,10 +339,10 @@ static void rx_dma_buf_pt_init(pc300_t * card, int ch)
+
DMA_RX_BD_BASE
+
ch_factor
*
sizeof
(
pcsca_bd_t
));
for
(
i
=
0
;
i
<
N_DMA_RX_BUF
;
i
++
,
ptdescr
++
)
{
cpc_writel
(
&
ptdescr
->
next
,
(
u
clong
)
(
DMA_RX_BD_BASE
+
(
ch_factor
+
((
i
+
1
)
&
(
N_DMA_RX_BUF
-
1
)))
*
sizeof
(
pcsca_bd_t
)));
cpc_writel
(
&
ptdescr
->
next
,
(
u
32
)
(
DMA_RX_BD_BASE
+
(
ch_factor
+
((
i
+
1
)
&
(
N_DMA_RX_BUF
-
1
)))
*
sizeof
(
pcsca_bd_t
)));
cpc_writel
(
&
ptdescr
->
ptbuf
,
(
u
clong
)
(
DMA_RX_BASE
+
(
ch_factor
+
i
)
*
BD_DEF_LEN
));
(
u
32
)
(
DMA_RX_BASE
+
(
ch_factor
+
i
)
*
BD_DEF_LEN
));
}
}
...
...
@@ -365,8 +365,8 @@ static void tx_dma_buf_check(pc300_t * card, int ch)
{
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
int
i
;
u
cshort
first_bd
=
card
->
chan
[
ch
].
tx_first_bd
;
u
cshort
next_bd
=
card
->
chan
[
ch
].
tx_next_bd
;
u
16
first_bd
=
card
->
chan
[
ch
].
tx_first_bd
;
u
16
next_bd
=
card
->
chan
[
ch
].
tx_next_bd
;
printk
(
"#CH%d: f_bd = %d(0x%08zx), n_bd = %d(0x%08zx)
\n
"
,
ch
,
first_bd
,
TX_BD_ADDR
(
ch
,
first_bd
),
...
...
@@ -390,9 +390,9 @@ static void tx1_dma_buf_check(pc300_t * card, int ch)
{
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
int
i
;
u
cshort
first_bd
=
card
->
chan
[
ch
].
tx_first_bd
;
u
cshort
next_bd
=
card
->
chan
[
ch
].
tx_next_bd
;
u
clong
scabase
=
card
->
hw
.
scabase
;
u
16
first_bd
=
card
->
chan
[
ch
].
tx_first_bd
;
u
16
next_bd
=
card
->
chan
[
ch
].
tx_next_bd
;
u
32
scabase
=
card
->
hw
.
scabase
;
printk
(
"
\n
nfree_tx_bd = %d
\n
"
,
card
->
chan
[
ch
].
nfree_tx_bd
);
printk
(
"#CH%d: f_bd = %d(0x%08x), n_bd = %d(0x%08x)
\n
"
,
ch
,
...
...
@@ -411,13 +411,13 @@ static void tx1_dma_buf_check(pc300_t * card, int ch)
printk
(
"
\n
"
);
}
#endif
static
void
rx_dma_buf_check
(
pc300_t
*
card
,
int
ch
)
{
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
int
i
;
u
cshort
first_bd
=
card
->
chan
[
ch
].
rx_first_bd
;
u
cshort
last_bd
=
card
->
chan
[
ch
].
rx_last_bd
;
u
16
first_bd
=
card
->
chan
[
ch
].
rx_first_bd
;
u
16
last_bd
=
card
->
chan
[
ch
].
rx_last_bd
;
int
ch_factor
;
ch_factor
=
ch
*
N_DMA_RX_BUF
;
...
...
@@ -438,9 +438,9 @@ static void rx_dma_buf_check(pc300_t * card, int ch)
static
int
dma_get_rx_frame_size
(
pc300_t
*
card
,
int
ch
)
{
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
u
cshort
first_bd
=
card
->
chan
[
ch
].
rx_first_bd
;
u
16
first_bd
=
card
->
chan
[
ch
].
rx_first_bd
;
int
rcvd
=
0
;
volatile
u
cchar
status
;
volatile
u
8
status
;
ptdescr
=
(
card
->
hw
.
rambase
+
RX_BD_ADDR
(
ch
,
first_bd
));
while
((
status
=
cpc_readb
(
&
ptdescr
->
status
))
&
DST_OSB
)
{
...
...
@@ -460,12 +460,12 @@ static int dma_get_rx_frame_size(pc300_t * card, int ch)
* dma_buf_write: writes a frame to the Tx DMA buffers
* NOTE: this function writes one frame at a time.
*/
static
int
dma_buf_write
(
pc300_t
*
card
,
int
ch
,
ucchar
*
ptdata
,
int
len
)
static
int
dma_buf_write
(
pc300_t
*
card
,
int
ch
,
u8
*
ptdata
,
int
len
)
{
int
i
,
nchar
;
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
int
tosend
=
len
;
u
cchar
nbuf
=
((
len
-
1
)
/
BD_DEF_LEN
)
+
1
;
u
8
nbuf
=
((
len
-
1
)
/
BD_DEF_LEN
)
+
1
;
if
(
nbuf
>=
card
->
chan
[
ch
].
nfree_tx_bd
)
{
return
-
ENOMEM
;
...
...
@@ -507,7 +507,7 @@ static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
volatile
pcsca_bd_t
__iomem
*
ptdescr
;
int
rcvd
=
0
;
volatile
u
cchar
status
;
volatile
u
8
status
;
ptdescr
=
(
card
->
hw
.
rambase
+
RX_BD_ADDR
(
ch
,
chan
->
rx_first_bd
));
...
...
@@ -561,8 +561,8 @@ static int dma_buf_read(pc300_t * card, int ch, struct sk_buff *skb)
static
void
tx_dma_stop
(
pc300_t
*
card
,
int
ch
)
{
void
__iomem
*
scabase
=
card
->
hw
.
scabase
;
u
cchar
drr_ena_bit
=
1
<<
(
5
+
2
*
ch
);
u
cchar
drr_rst_bit
=
1
<<
(
1
+
2
*
ch
);
u
8
drr_ena_bit
=
1
<<
(
5
+
2
*
ch
);
u
8
drr_rst_bit
=
1
<<
(
1
+
2
*
ch
);
/* Disable DMA */
cpc_writeb
(
scabase
+
DRR
,
drr_ena_bit
);
...
...
@@ -572,8 +572,8 @@ static void tx_dma_stop(pc300_t * card, int ch)
static
void
rx_dma_stop
(
pc300_t
*
card
,
int
ch
)
{
void
__iomem
*
scabase
=
card
->
hw
.
scabase
;
u
cchar
drr_ena_bit
=
1
<<
(
4
+
2
*
ch
);
u
cchar
drr_rst_bit
=
1
<<
(
2
*
ch
);
u
8
drr_ena_bit
=
1
<<
(
4
+
2
*
ch
);
u
8
drr_rst_bit
=
1
<<
(
2
*
ch
);
/* Disable DMA */
cpc_writeb
(
scabase
+
DRR
,
drr_ena_bit
);
...
...
@@ -605,7 +605,7 @@ static void rx_dma_start(pc300_t * card, int ch)
/*************************/
/*** FALC Routines ***/
/*************************/
static
void
falc_issue_cmd
(
pc300_t
*
card
,
int
ch
,
ucchar
cmd
)
static
void
falc_issue_cmd
(
pc300_t
*
card
,
int
ch
,
u8
cmd
)
{
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
unsigned
long
i
=
0
;
...
...
@@ -673,7 +673,7 @@ static void falc_intr_enable(pc300_t * card, int ch)
static
void
falc_open_timeslot
(
pc300_t
*
card
,
int
ch
,
int
timeslot
)
{
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
tshf
=
card
->
chan
[
ch
].
falc
.
offset
;
u
8
tshf
=
card
->
chan
[
ch
].
falc
.
offset
;
cpc_writeb
(
falcbase
+
F_REG
((
ICB1
+
(
timeslot
-
tshf
)
/
8
),
ch
),
cpc_readb
(
falcbase
+
F_REG
((
ICB1
+
(
timeslot
-
tshf
)
/
8
),
ch
))
&
...
...
@@ -689,7 +689,7 @@ static void falc_open_timeslot(pc300_t * card, int ch, int timeslot)
static
void
falc_close_timeslot
(
pc300_t
*
card
,
int
ch
,
int
timeslot
)
{
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
tshf
=
card
->
chan
[
ch
].
falc
.
offset
;
u
8
tshf
=
card
->
chan
[
ch
].
falc
.
offset
;
cpc_writeb
(
falcbase
+
F_REG
((
ICB1
+
(
timeslot
-
tshf
)
/
8
),
ch
),
cpc_readb
(
falcbase
+
F_REG
((
ICB1
+
(
timeslot
-
tshf
)
/
8
),
ch
))
|
...
...
@@ -810,7 +810,7 @@ static void falc_init_t1(pc300_t * card, int ch)
pc300chconf_t
*
conf
=
(
pc300chconf_t
*
)
&
chan
->
conf
;
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
dja
=
(
ch
?
(
LIM2_DJA2
|
LIM2_DJA1
)
:
0
);
u
8
dja
=
(
ch
?
(
LIM2_DJA2
|
LIM2_DJA1
)
:
0
);
/* Switch to T1 mode (PCM 24) */
cpc_writeb
(
falcbase
+
F_REG
(
FMR1
,
ch
),
FMR1_PMOD
);
...
...
@@ -979,7 +979,7 @@ static void falc_init_e1(pc300_t * card, int ch)
pc300chconf_t
*
conf
=
(
pc300chconf_t
*
)
&
chan
->
conf
;
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
dja
=
(
ch
?
(
LIM2_DJA2
|
LIM2_DJA1
)
:
0
);
u
8
dja
=
(
ch
?
(
LIM2_DJA2
|
LIM2_DJA1
)
:
0
);
/* Switch to E1 mode (PCM 30) */
cpc_writeb
(
falcbase
+
F_REG
(
FMR1
,
ch
),
...
...
@@ -1185,7 +1185,7 @@ static void te_config(pc300_t * card, int ch)
pc300chconf_t
*
conf
=
(
pc300chconf_t
*
)
&
chan
->
conf
;
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
dummy
;
u
8
dummy
;
unsigned
long
flags
;
memset
(
pfalc
,
0
,
sizeof
(
falc_t
));
...
...
@@ -1401,7 +1401,7 @@ static void falc_update_stats(pc300_t * card, int ch)
pc300chconf_t
*
conf
=
(
pc300chconf_t
*
)
&
chan
->
conf
;
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cshort
counter
;
u
16
counter
;
counter
=
cpc_readb
(
falcbase
+
F_REG
(
FECL
,
ch
));
counter
|=
cpc_readb
(
falcbase
+
F_REG
(
FECH
,
ch
))
<<
8
;
...
...
@@ -1727,7 +1727,7 @@ static void falc_pattern_test(pc300_t * card, int ch, unsigned int activate)
* Description: This routine returns the bit error counter value
*----------------------------------------------------------------------------
*/
static
u
cshort
falc_pattern_test_error
(
pc300_t
*
card
,
int
ch
)
static
u
16
falc_pattern_test_error
(
pc300_t
*
card
,
int
ch
)
{
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
...
...
@@ -1774,7 +1774,7 @@ static void cpc_tx_timeout(struct net_device *dev)
pc300_t
*
card
=
(
pc300_t
*
)
chan
->
card
;
int
ch
=
chan
->
channel
;
unsigned
long
flags
;
u
cchar
ilar
;
u
8
ilar
;
dev
->
stats
.
tx_errors
++
;
dev
->
stats
.
tx_aborted_errors
++
;
...
...
@@ -1830,7 +1830,7 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev)
}
/* Write buffer to DMA buffers */
if
(
dma_buf_write
(
card
,
ch
,
(
u
cchar
*
)
skb
->
data
,
skb
->
len
)
!=
0
)
{
if
(
dma_buf_write
(
card
,
ch
,
(
u
8
*
)
skb
->
data
,
skb
->
len
)
!=
0
)
{
// printk("%s: write error. Dropping TX packet.\n", dev->name);
netif_stop_queue
(
dev
);
dev_kfree_skb
(
skb
);
...
...
@@ -1995,7 +1995,7 @@ static void sca_tx_intr(pc300dev_t *dev)
static
void
sca_intr
(
pc300_t
*
card
)
{
void
__iomem
*
scabase
=
card
->
hw
.
scabase
;
volatile
u
clong
status
;
volatile
u
32
status
;
int
ch
;
int
intr_count
=
0
;
unsigned
char
dsr_rx
;
...
...
@@ -2010,7 +2010,7 @@ static void sca_intr(pc300_t * card)
/**** Reception ****/
if
(
status
&
IR0_DRX
((
IR0_DMIA
|
IR0_DMIB
),
ch
))
{
u
cchar
drx_stat
=
cpc_readb
(
scabase
+
DSR_RX
(
ch
));
u
8
drx_stat
=
cpc_readb
(
scabase
+
DSR_RX
(
ch
));
/* Clear RX interrupts */
cpc_writeb
(
scabase
+
DSR_RX
(
ch
),
drx_stat
|
DSR_DWE
);
...
...
@@ -2084,7 +2084,7 @@ static void sca_intr(pc300_t * card)
/**** Transmission ****/
if
(
status
&
IR0_DTX
((
IR0_EFT
|
IR0_DMIA
|
IR0_DMIB
),
ch
))
{
u
cchar
dtx_stat
=
cpc_readb
(
scabase
+
DSR_TX
(
ch
));
u
8
dtx_stat
=
cpc_readb
(
scabase
+
DSR_TX
(
ch
));
/* Clear TX interrupts */
cpc_writeb
(
scabase
+
DSR_TX
(
ch
),
dtx_stat
|
DSR_DWE
);
...
...
@@ -2128,7 +2128,7 @@ static void sca_intr(pc300_t * card)
/**** MSCI ****/
if
(
status
&
IR0_M
(
IR0_RXINTA
,
ch
))
{
u
cchar
st1
=
cpc_readb
(
scabase
+
M_REG
(
ST1
,
ch
));
u
8
st1
=
cpc_readb
(
scabase
+
M_REG
(
ST1
,
ch
));
/* Clear MSCI interrupts */
cpc_writeb
(
scabase
+
M_REG
(
ST1
,
ch
),
st1
);
...
...
@@ -2170,7 +2170,7 @@ static void sca_intr(pc300_t * card)
}
}
static
void
falc_t1_loop_detection
(
pc300_t
*
card
,
int
ch
,
ucchar
frs1
)
static
void
falc_t1_loop_detection
(
pc300_t
*
card
,
int
ch
,
u8
frs1
)
{
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
...
...
@@ -2195,7 +2195,7 @@ static void falc_t1_loop_detection(pc300_t * card, int ch, ucchar frs1)
}
}
static
void
falc_e1_loop_detection
(
pc300_t
*
card
,
int
ch
,
ucchar
rsp
)
static
void
falc_e1_loop_detection
(
pc300_t
*
card
,
int
ch
,
u8
rsp
)
{
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
...
...
@@ -2225,8 +2225,8 @@ static void falc_t1_intr(pc300_t * card, int ch)
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
isr0
,
isr3
,
gis
;
u
cchar
dummy
;
u
8
isr0
,
isr3
,
gis
;
u
8
dummy
;
while
((
gis
=
cpc_readb
(
falcbase
+
F_REG
(
GIS
,
ch
)))
!=
0
)
{
if
(
gis
&
GIS_ISR0
)
{
...
...
@@ -2272,8 +2272,8 @@ static void falc_e1_intr(pc300_t * card, int ch)
pc300ch_t
*
chan
=
(
pc300ch_t
*
)
&
card
->
chan
[
ch
];
falc_t
*
pfalc
=
(
falc_t
*
)
&
chan
->
falc
;
void
__iomem
*
falcbase
=
card
->
hw
.
falcbase
;
u
cchar
isr1
,
isr2
,
isr3
,
gis
,
rsp
;
u
cchar
dummy
;
u
8
isr1
,
isr2
,
isr3
,
gis
,
rsp
;
u
8
dummy
;
while
((
gis
=
cpc_readb
(
falcbase
+
F_REG
(
GIS
,
ch
)))
!=
0
)
{
rsp
=
cpc_readb
(
falcbase
+
F_REG
(
RSP
,
ch
));
...
...
@@ -2355,7 +2355,7 @@ static void falc_intr(pc300_t * card)
static
irqreturn_t
cpc_intr
(
int
irq
,
void
*
dev_id
)
{
pc300_t
*
card
=
dev_id
;
volatile
u
cchar
plx_status
;
volatile
u
8
plx_status
;
if
(
!
card
)
{
#ifdef PC300_DEBUG_INTR
...
...
@@ -2394,7 +2394,7 @@ static irqreturn_t cpc_intr(int irq, void *dev_id)
static
void
cpc_sca_status
(
pc300_t
*
card
,
int
ch
)
{
u
cchar
ilar
;
u
8
ilar
;
void
__iomem
*
scabase
=
card
->
hw
.
scabase
;
unsigned
long
flags
;
...
...
@@ -2812,7 +2812,7 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
}
static
int
clock_rate_calc
(
u
clong
rate
,
uclong
clock
,
int
*
br_io
)
static
int
clock_rate_calc
(
u
32
rate
,
u32
clock
,
int
*
br_io
)
{
int
br
,
tc
;
int
br_pwr
,
error
;
...
...
@@ -2849,12 +2849,12 @@ static int ch_config(pc300dev_t * d)
void
__iomem
*
scabase
=
card
->
hw
.
scabase
;
void
__iomem
*
plxbase
=
card
->
hw
.
plxbase
;
int
ch
=
chan
->
channel
;
u
clong
clkrate
=
chan
->
conf
.
phys_settings
.
clock_rate
;
u
clong
clktype
=
chan
->
conf
.
phys_settings
.
clock_type
;
u
cshort
encoding
=
chan
->
conf
.
proto_settings
.
encoding
;
u
cshort
parity
=
chan
->
conf
.
proto_settings
.
parity
;
u
cchar
md0
,
md2
;
u
32
clkrate
=
chan
->
conf
.
phys_settings
.
clock_rate
;
u
32
clktype
=
chan
->
conf
.
phys_settings
.
clock_type
;
u
16
encoding
=
chan
->
conf
.
proto_settings
.
encoding
;
u
16
parity
=
chan
->
conf
.
proto_settings
.
parity
;
u
8
md0
,
md2
;
/* Reset the channel */
cpc_writeb
(
scabase
+
M_REG
(
CMD
,
ch
),
CMD_CH_RST
);
...
...
@@ -3193,16 +3193,16 @@ static int cpc_close(struct net_device *dev)
return
0
;
}
static
u
clong
detect_ram
(
pc300_t
*
card
)
static
u
32
detect_ram
(
pc300_t
*
card
)
{
u
clong
i
;
u
cchar
data
;
u
32
i
;
u
8
data
;
void
__iomem
*
rambase
=
card
->
hw
.
rambase
;
card
->
hw
.
ramsize
=
PC300_RAMSIZE
;
/* Let's find out how much RAM is present on this board */
for
(
i
=
0
;
i
<
card
->
hw
.
ramsize
;
i
++
)
{
data
=
(
u
cchar
)
(
i
&
0xff
);
data
=
(
u
8
)
(
i
&
0xff
);
cpc_writeb
(
rambase
+
i
,
data
);
if
(
cpc_readb
(
rambase
+
i
)
!=
data
)
{
break
;
...
...
@@ -3279,7 +3279,7 @@ static void cpc_init_card(pc300_t * card)
cpc_writeb
(
card
->
hw
.
scabase
+
DMER
,
0x80
);
if
(
card
->
hw
.
type
==
PC300_TE
)
{
u
cchar
reg1
;
u
8
reg1
;
/* Check CPLD version */
reg1
=
cpc_readb
(
card
->
hw
.
falcbase
+
CPLD_REG1
);
...
...
@@ -3413,7 +3413,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
static
int
first_time
=
1
;
int
err
,
eeprom_outdated
=
0
;
u
cshort
device_id
;
u
16
device_id
;
pc300_t
*
card
;
if
(
first_time
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录