Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
ef22570a
提交
ef22570a
authored
1月 12, 2013
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
T.38 now gets reset as a T.31 call starts
上级
29bfcb16
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
55 行增加
和
52 行删除
+55
-52
t31.h
libs/spandsp/src/spandsp/private/t31.h
+5
-5
t31.c
libs/spandsp/src/t31.c
+50
-47
没有找到文件。
libs/spandsp/src/spandsp/private/t31.h
浏览文件 @
ef22570a
...
@@ -116,11 +116,11 @@ typedef struct
...
@@ -116,11 +116,11 @@ typedef struct
int
octets_per_data_packet
;
int
octets_per_data_packet
;
/*! \brief An HDLC context used when sending HDLC messages to the terminal port
/*! \brief An HDLC context used when sending HDLC messages to the terminal port
(ECM mode support). */
as if it were non-ECM data
(ECM mode support). */
hdlc_tx_state_t
hdlc_tx_
ter
m
;
hdlc_tx_state_t
hdlc_tx_
non_ec
m
;
/*! \brief An HDLC context used when receiving HDLC messages from the terminal port.
/*! \brief An HDLC context used when receiving HDLC messages from the terminal port.
(ECM mode support). */
as if it were non-ECM data
(ECM mode support). */
hdlc_rx_state_t
hdlc_rx_
ter
m
;
hdlc_rx_state_t
hdlc_rx_
non_ec
m
;
struct
struct
{
{
...
@@ -196,7 +196,7 @@ struct t31_state_s
...
@@ -196,7 +196,7 @@ struct t31_state_s
struct
struct
{
{
/*! \brief The transmit buffer. */
/*! \brief The transmit buffer. */
uint8_t
data
[
T31_TX_BUF_LEN
];
uint8_t
buf
[
T31_TX_BUF_LEN
];
/*! \brief The number of bytes stored in the transmit buffer. */
/*! \brief The number of bytes stored in the transmit buffer. */
int
in_bytes
;
int
in_bytes
;
/*! \brief The number of bytes sent from the transmit buffer. */
/*! \brief The number of bytes sent from the transmit buffer. */
...
...
libs/spandsp/src/t31.c
浏览文件 @
ef22570a
...
@@ -184,8 +184,8 @@ enum
...
@@ -184,8 +184,8 @@ enum
static
int
restart_modem
(
t31_state_t
*
s
,
int
new_modem
);
static
int
restart_modem
(
t31_state_t
*
s
,
int
new_modem
);
static
void
hdlc_accept_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
void
hdlc_accept_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
void
hdlc_accept_
frame2
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
void
hdlc_accept_
t38_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
void
hdlc_accept_
frame3
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
void
hdlc_accept_
non_ecm_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
);
static
int
silence_rx
(
void
*
user_data
,
const
int16_t
amp
[],
int
len
);
static
int
silence_rx
(
void
*
user_data
,
const
int16_t
amp
[],
int
len
);
static
int
cng_rx
(
void
*
user_data
,
const
int16_t
amp
[],
int
len
);
static
int
cng_rx
(
void
*
user_data
,
const
int16_t
amp
[],
int
len
);
static
void
non_ecm_put_bit
(
void
*
user_data
,
int
bit
);
static
void
non_ecm_put_bit
(
void
*
user_data
,
int
bit
);
...
@@ -501,7 +501,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
...
@@ -501,7 +501,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
}
}
else
else
{
{
hdlc_accept_
frame2
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
!
fe
->
rx_data_missing
);
hdlc_accept_
t38_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
!
fe
->
rx_data_missing
);
}
}
/*endif*/
/*endif*/
}
}
...
@@ -527,7 +527,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
...
@@ -527,7 +527,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if
(
data_type
==
T38_DATA_V21
)
if
(
data_type
==
T38_DATA_V21
)
hdlc_accept_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
hdlc_accept_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
else
else
hdlc_accept_
frame2
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
hdlc_accept_
t38_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
/*endif*/
/*endif*/
}
}
/*endif*/
/*endif*/
...
@@ -572,7 +572,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
...
@@ -572,7 +572,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
}
}
else
else
{
{
hdlc_accept_
frame2
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
!
fe
->
rx_data_missing
);
hdlc_accept_
t38_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
!
fe
->
rx_data_missing
);
non_ecm_rx_status
(
s
,
SIG_STATUS_CARRIER_DOWN
);
non_ecm_rx_status
(
s
,
SIG_STATUS_CARRIER_DOWN
);
}
}
/*endif*/
/*endif*/
...
@@ -603,7 +603,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
...
@@ -603,7 +603,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
}
}
else
else
{
{
hdlc_accept_
frame2
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
hdlc_accept_
t38_frame
(
s
,
fe
->
hdlc_rx
.
buf
,
fe
->
hdlc_rx
.
len
,
FALSE
);
non_ecm_rx_status
(
s
,
SIG_STATUS_CARRIER_DOWN
);
non_ecm_rx_status
(
s
,
SIG_STATUS_CARRIER_DOWN
);
}
}
/*endif*/
/*endif*/
...
@@ -1340,9 +1340,11 @@ static int t31_modem_control_handler(at_state_t *s, void *user_data, int op, con
...
@@ -1340,9 +1340,11 @@ static int t31_modem_control_handler(at_state_t *s, void *user_data, int op, con
{
{
case
AT_MODEM_CONTROL_CALL
:
case
AT_MODEM_CONTROL_CALL
:
t
->
call_samples
=
0
;
t
->
call_samples
=
0
;
t38_core_restart
(
&
t
->
t38_fe
.
t38
);
break
;
break
;
case
AT_MODEM_CONTROL_ANSWER
:
case
AT_MODEM_CONTROL_ANSWER
:
t
->
call_samples
=
0
;
t
->
call_samples
=
0
;
t38_core_restart
(
&
t
->
t38_fe
.
t38
);
break
;
break
;
case
AT_MODEM_CONTROL_ONHOOK
:
case
AT_MODEM_CONTROL_ONHOOK
:
if
(
t
->
non_ecm_tx
.
holding
)
if
(
t
->
non_ecm_tx
.
holding
)
...
@@ -1511,7 +1513,7 @@ static int non_ecm_get_bit(void *user_data)
...
@@ -1511,7 +1513,7 @@ static int non_ecm_get_bit(void *user_data)
if
(
s
->
non_ecm_tx
.
out_bytes
!=
s
->
non_ecm_tx
.
in_bytes
)
if
(
s
->
non_ecm_tx
.
out_bytes
!=
s
->
non_ecm_tx
.
in_bytes
)
{
{
/* There is real data available to send */
/* There is real data available to send */
s
->
audio
.
current_byte
=
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
out_bytes
++
];
s
->
audio
.
current_byte
=
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
out_bytes
++
];
if
(
s
->
non_ecm_tx
.
out_bytes
>
T31_TX_BUF_LEN
-
1
)
if
(
s
->
non_ecm_tx
.
out_bytes
>
T31_TX_BUF_LEN
-
1
)
{
{
s
->
non_ecm_tx
.
out_bytes
=
T31_TX_BUF_LEN
-
1
;
s
->
non_ecm_tx
.
out_bytes
=
T31_TX_BUF_LEN
-
1
;
...
@@ -1569,7 +1571,7 @@ static int non_ecm_get(void *user_data, uint8_t buf[], int len)
...
@@ -1569,7 +1571,7 @@ static int non_ecm_get(void *user_data, uint8_t buf[], int len)
if
(
s
->
non_ecm_tx
.
out_bytes
!=
s
->
non_ecm_tx
.
in_bytes
)
if
(
s
->
non_ecm_tx
.
out_bytes
!=
s
->
non_ecm_tx
.
in_bytes
)
{
{
/* There is real data available to send */
/* There is real data available to send */
buf
[
i
]
=
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
out_bytes
++
];
buf
[
i
]
=
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
out_bytes
++
];
if
(
s
->
non_ecm_tx
.
out_bytes
>
T31_TX_BUF_LEN
-
1
)
if
(
s
->
non_ecm_tx
.
out_bytes
>
T31_TX_BUF_LEN
-
1
)
{
{
s
->
non_ecm_tx
.
out_bytes
=
T31_TX_BUF_LEN
-
1
;
s
->
non_ecm_tx
.
out_bytes
=
T31_TX_BUF_LEN
-
1
;
...
@@ -1865,7 +1867,7 @@ static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int
...
@@ -1865,7 +1867,7 @@ static void hdlc_accept_frame(void *user_data, const uint8_t *msg, int len, int
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
static
void
hdlc_accept_
frame2
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
)
static
void
hdlc_accept_
t38_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
)
{
{
t31_state_t
*
s
;
t31_state_t
*
s
;
int
i
;
int
i
;
...
@@ -1880,7 +1882,8 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
...
@@ -1880,7 +1882,8 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
uint8_t
buf2
[
2
*
len
+
20
];
uint8_t
buf2
[
2
*
len
+
20
];
#endif
#endif
/* Accept an ECM image mode HDLC frame received as T.38 */
/* Accept an ECM image mode HDLC frame, received as T.38, and convert to an HDLC
bit stream to be fed to the FAX software. */
if
(
len
<
0
)
if
(
len
<
0
)
return
;
return
;
/*endif*/
/*endif*/
...
@@ -1892,33 +1895,33 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
...
@@ -1892,33 +1895,33 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
crc
^=
0xFFFF
;
crc
^=
0xFFFF
;
/*endif*/
/*endif*/
ptr
=
0
;
ptr
=
0
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
ter
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
ter
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
idle_octet
;
for
(
pos
=
0
;
pos
<
len
;
pos
++
)
for
(
pos
=
0
;
pos
<
len
;
pos
++
)
{
{
byte_in_progress
=
msg
[
pos
];
byte_in_progress
=
msg
[
pos
];
i
=
bottom_bit
(
byte_in_progress
|
0x100
);
i
=
bottom_bit
(
byte_in_progress
|
0x100
);
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
<<=
i
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
<<=
i
;
byte_in_progress
>>=
i
;
byte_in_progress
>>=
i
;
for
(
;
i
<
8
;
i
++
)
for
(
;
i
<
8
;
i
++
)
{
{
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
=
(
s
->
t38_fe
.
hdlc_tx_ter
m
.
octets_in_progress
<<
1
)
|
(
byte_in_progress
&
0x01
);
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
=
(
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
octets_in_progress
<<
1
)
|
(
byte_in_progress
&
0x01
);
byte_in_progress
>>=
1
;
byte_in_progress
>>=
1
;
if
((
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
&
0x1F
)
==
0x1F
)
if
((
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
&
0x1F
)
==
0x1F
)
{
{
/* There are 5 ones - stuff */
/* There are 5 ones - stuff */
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
<<=
1
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
<<=
1
;
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
++
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
++
;
}
}
/*endif*/
/*endif*/
}
}
/*endfor*/
/*endfor*/
/* An input byte will generate between 8 and 10 output bits */
/* An input byte will generate between 8 and 10 output bits */
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
)
&
0xFF
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
)
&
0xFF
;
if
(
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
>=
8
)
if
(
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
>=
8
)
{
{
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
-=
8
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
-=
8
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
)
&
0xFF
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
)
&
0xFF
;
}
}
/*endif*/
/*endif*/
}
}
...
@@ -1929,27 +1932,27 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
...
@@ -1929,27 +1932,27 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
byte_in_progress
=
crc
&
0xFF
;
byte_in_progress
=
crc
&
0xFF
;
crc
>>=
8
;
crc
>>=
8
;
i
=
bottom_bit
(
byte_in_progress
|
0x100
);
i
=
bottom_bit
(
byte_in_progress
|
0x100
);
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
<<=
i
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
<<=
i
;
byte_in_progress
>>=
i
;
byte_in_progress
>>=
i
;
for
(
;
i
<
8
;
i
++
)
for
(
;
i
<
8
;
i
++
)
{
{
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
=
(
s
->
t38_fe
.
hdlc_tx_ter
m
.
octets_in_progress
<<
1
)
|
(
byte_in_progress
&
0x01
);
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
=
(
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
octets_in_progress
<<
1
)
|
(
byte_in_progress
&
0x01
);
byte_in_progress
>>=
1
;
byte_in_progress
>>=
1
;
if
((
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
&
0x1F
)
==
0x1F
)
if
((
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
&
0x1F
)
==
0x1F
)
{
{
/* There are 5 ones - stuff */
/* There are 5 ones - stuff */
s
->
t38_fe
.
hdlc_tx_
ter
m
.
octets_in_progress
<<=
1
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
octets_in_progress
<<=
1
;
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
++
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
++
;
}
}
/*endif*/
/*endif*/
}
}
/*endfor*/
/*endfor*/
/* An input byte will generate between 8 and 10 output bits */
/* An input byte will generate between 8 and 10 output bits */
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
)
&
0xFF
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
)
&
0xFF
;
if
(
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
>=
8
)
if
(
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
>=
8
)
{
{
s
->
t38_fe
.
hdlc_tx_
ter
m
.
num_bits
-=
8
;
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
num_bits
-=
8
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
)
&
0xFF
;
buf2
[
ptr
++
]
=
(
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
)
&
0xFF
;
}
}
/*endif*/
/*endif*/
}
}
...
@@ -1958,21 +1961,21 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
...
@@ -1958,21 +1961,21 @@ static void hdlc_accept_frame2(void *user_data, const uint8_t *msg, int len, int
/* Finish off the current byte with some flag bits. If we are at the
/* Finish off the current byte with some flag bits. If we are at the
start of a byte we need a at least one whole byte of flag to ensure
start of a byte we need a at least one whole byte of flag to ensure
we cannot end up with back to back frames, and no flag octet at all */
we cannot end up with back to back frames, and no flag octet at all */
txbyte
=
(
uint8_t
)
((
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
<<
(
8
-
s
->
t38_fe
.
hdlc_tx_term
.
num_bits
))
|
(
0x7E
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
));
txbyte
=
(
uint8_t
)
((
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
<<
(
8
-
s
->
t38_fe
.
hdlc_tx_non_ecm
.
num_bits
))
|
(
0x7E
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
));
/* Create a rotated octet of flag for idling... */
/* Create a rotated octet of flag for idling... */
s
->
t38_fe
.
hdlc_tx_
term
.
idle_octet
=
(
0x7E7E
>>
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
)
&
0xFF
;
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
idle_octet
=
(
0x7E7E
>>
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
)
&
0xFF
;
/* ...and the partial flag octet needed to start off the next message. */
/* ...and the partial flag octet needed to start off the next message. */
s
->
t38_fe
.
hdlc_tx_
term
.
octets_in_progress
=
s
->
t38_fe
.
hdlc_tx_term
.
idle_octet
>>
(
8
-
s
->
t38_fe
.
hdlc_tx_ter
m
.
num_bits
);
s
->
t38_fe
.
hdlc_tx_
non_ecm
.
octets_in_progress
=
s
->
t38_fe
.
hdlc_tx_non_ecm
.
idle_octet
>>
(
8
-
s
->
t38_fe
.
hdlc_tx_non_ec
m
.
num_bits
);
buf2
[
ptr
++
]
=
txbyte
;
buf2
[
ptr
++
]
=
txbyte
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
ter
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
ter
m
.
idle_octet
;
buf2
[
ptr
++
]
=
s
->
t38_fe
.
hdlc_tx_
non_ec
m
.
idle_octet
;
bit_reverse
(
buf2
,
buf2
,
ptr
);
bit_reverse
(
buf2
,
buf2
,
ptr
);
non_ecm_put
(
s
,
buf2
,
ptr
);
non_ecm_put
(
s
,
buf2
,
ptr
);
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
static
void
hdlc_accept_
frame3
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
)
static
void
hdlc_accept_
non_ecm_frame
(
void
*
user_data
,
const
uint8_t
*
msg
,
int
len
,
int
ok
)
{
{
t31_state_t
*
s
;
t31_state_t
*
s
;
...
@@ -2337,12 +2340,12 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
...
@@ -2337,12 +2340,12 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
}
}
else
if
(
s
->
at_state
.
p
.
double_escape
&&
stuffed
[
i
]
==
SUB
)
else
if
(
s
->
at_state
.
p
.
double_escape
&&
stuffed
[
i
]
==
SUB
)
{
{
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
ter
m
,
bit_reverse8
(
DLE
));
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
non_ec
m
,
bit_reverse8
(
DLE
));
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
ter
m
,
bit_reverse8
(
DLE
));
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
non_ec
m
,
bit_reverse8
(
DLE
));
}
}
else
else
{
{
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
ter
m
,
bit_reverse8
(
stuffed
[
i
]));
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
non_ec
m
,
bit_reverse8
(
stuffed
[
i
]));
}
}
/*endif*/
/*endif*/
}
}
...
@@ -2351,7 +2354,7 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
...
@@ -2351,7 +2354,7 @@ static __inline__ void dle_unstuff_fake_hdlc(t31_state_t *s, const char *stuffed
if
(
stuffed
[
i
]
==
DLE
)
if
(
stuffed
[
i
]
==
DLE
)
s
->
dled
=
TRUE
;
s
->
dled
=
TRUE
;
else
else
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
ter
m
,
bit_reverse8
(
stuffed
[
i
]));
hdlc_rx_put_byte
(
&
s
->
t38_fe
.
hdlc_rx_
non_ec
m
,
bit_reverse8
(
stuffed
[
i
]));
/*endif*/
/*endif*/
}
}
/*endif*/
/*endif*/
...
@@ -2378,12 +2381,12 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
...
@@ -2378,12 +2381,12 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
/*endif*/
/*endif*/
if
(
s
->
at_state
.
p
.
double_escape
&&
stuffed
[
i
]
==
SUB
)
if
(
s
->
at_state
.
p
.
double_escape
&&
stuffed
[
i
]
==
SUB
)
{
{
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
DLE
;
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
DLE
;
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
DLE
;
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
DLE
;
}
}
else
else
{
{
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
stuffed
[
i
];
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
stuffed
[
i
];
}
}
/*endif*/
/*endif*/
}
}
...
@@ -2392,7 +2395,7 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
...
@@ -2392,7 +2395,7 @@ static __inline__ void dle_unstuff(t31_state_t *s, const char *stuffed, int len)
if
(
stuffed
[
i
]
==
DLE
)
if
(
stuffed
[
i
]
==
DLE
)
s
->
dled
=
TRUE
;
s
->
dled
=
TRUE
;
else
else
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
stuffed
[
i
];
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
in_bytes
++
]
=
stuffed
[
i
];
/*endif*/
/*endif*/
}
}
/*endif*/
/*endif*/
...
@@ -2703,7 +2706,7 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
...
@@ -2703,7 +2706,7 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len)
{
{
/* Make room for new data in existing data buffer. */
/* Make room for new data in existing data buffer. */
s
->
non_ecm_tx
.
in_bytes
-=
s
->
non_ecm_tx
.
out_bytes
;
s
->
non_ecm_tx
.
in_bytes
-=
s
->
non_ecm_tx
.
out_bytes
;
memmove
(
&
s
->
non_ecm_tx
.
data
[
0
],
&
s
->
non_ecm_tx
.
data
[
s
->
non_ecm_tx
.
out_bytes
],
s
->
non_ecm_tx
.
in_bytes
);
memmove
(
&
s
->
non_ecm_tx
.
buf
[
0
],
&
s
->
non_ecm_tx
.
buf
[
s
->
non_ecm_tx
.
out_bytes
],
s
->
non_ecm_tx
.
in_bytes
);
s
->
non_ecm_tx
.
out_bytes
=
0
;
s
->
non_ecm_tx
.
out_bytes
=
0
;
}
}
/*endif*/
/*endif*/
...
@@ -2975,8 +2978,8 @@ static int t31_t38_fe_init(t31_state_t *t,
...
@@ -2975,8 +2978,8 @@ static int t31_t38_fe_init(t31_state_t *t,
t
->
hdlc_tx
.
ptr
=
0
;
t
->
hdlc_tx
.
ptr
=
0
;
hdlc_tx_init
(
&
s
->
hdlc_tx_
ter
m
,
FALSE
,
1
,
FALSE
,
hdlc_tx_underflow2
,
s
);
hdlc_tx_init
(
&
s
->
hdlc_tx_
non_ec
m
,
FALSE
,
1
,
FALSE
,
hdlc_tx_underflow2
,
s
);
hdlc_rx_init
(
&
s
->
hdlc_rx_
term
,
FALSE
,
TRUE
,
2
,
hdlc_accept_frame3
,
t
);
hdlc_rx_init
(
&
s
->
hdlc_rx_
non_ecm
,
FALSE
,
TRUE
,
2
,
hdlc_accept_non_ecm_frame
,
t
);
return
0
;
return
0
;
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论