code update
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1521 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
e74ca7fc9f
commit
4fbb2e6d21
|
@ -299,7 +299,7 @@ static rt_err_t zget_file_info(char *name,struct zfile *zf)
|
||||||
zf->fname = full_path;
|
zf->fname = full_path;
|
||||||
p = strlen(name)+name+1;
|
p = strlen(name)+name+1;
|
||||||
sscanf((const char *)p, "%ld%lo%o", &zf->bytes_total,&zf->ctime,&zf->mode);
|
sscanf((const char *)p, "%ld%lo%o", &zf->bytes_total,&zf->ctime,&zf->mode);
|
||||||
#ifdef DFS_USING_WORKDIR
|
#ifdef defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
|
||||||
dfs_statfs(working_directory,&buf);
|
dfs_statfs(working_directory,&buf);
|
||||||
if (zf->bytes_total > (buf.f_blocks * buf.f_bfree))
|
if (zf->bytes_total > (buf.f_blocks * buf.f_bfree))
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,11 +277,10 @@ static rt_int16_t zrec_data16(rt_uint8_t *buf,rt_uint16_t len)
|
||||||
rt_uint16_t crc;
|
rt_uint16_t crc;
|
||||||
rt_err_t res = -RT_ERROR;
|
rt_err_t res = -RT_ERROR;
|
||||||
rt_uint8_t *p,flag = 0;
|
rt_uint8_t *p,flag = 0;
|
||||||
rt_uint8_t i =0, debug[20];
|
|
||||||
p = buf;
|
p = buf;
|
||||||
crc = 0L;
|
crc_cnt = 0; crc = 0L;
|
||||||
Rxcount = 0;
|
Rxcount = 0;
|
||||||
debug[0] = debug[4] = 0;
|
|
||||||
while(buf <= p+len)
|
while(buf <= p+len)
|
||||||
{
|
{
|
||||||
if ((res = zread_byte()) & ~0377)
|
if ((res = zread_byte()) & ~0377)
|
||||||
|
@ -290,8 +289,6 @@ static rt_int16_t zrec_data16(rt_uint8_t *buf,rt_uint16_t len)
|
||||||
res == GOTCRCQ || res == GOTCRCW)
|
res == GOTCRCQ || res == GOTCRCW)
|
||||||
{
|
{
|
||||||
c = res;
|
c = res;
|
||||||
debug[i++] = res;
|
|
||||||
c = debug[0];
|
|
||||||
c = res;
|
c = res;
|
||||||
crc = updcrc16(res&0377, crc);
|
crc = updcrc16(res&0377, crc);
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
@ -308,7 +305,6 @@ static rt_int16_t zrec_data16(rt_uint8_t *buf,rt_uint16_t len)
|
||||||
{
|
{
|
||||||
crc = updcrc16(res, crc);
|
crc = updcrc16(res, crc);
|
||||||
crc_cnt++;
|
crc_cnt++;
|
||||||
debug[i++] = res;
|
|
||||||
if (crc_cnt < 2) continue;
|
if (crc_cnt < 2) continue;
|
||||||
if ((crc & 0xffff))
|
if ((crc & 0xffff))
|
||||||
{
|
{
|
||||||
|
@ -334,12 +330,12 @@ static rt_int16_t zrec_data16(rt_uint8_t *buf,rt_uint16_t len)
|
||||||
/* receive data,with 32bits CRC check */
|
/* receive data,with 32bits CRC check */
|
||||||
static rt_int16_t zrec_data32(rt_uint8_t *buf, rt_int16_t len)
|
static rt_int16_t zrec_data32(rt_uint8_t *buf, rt_int16_t len)
|
||||||
{
|
{
|
||||||
rt_int16_t c,crc_cnt = 0;
|
rt_int16_t c,crc_cnt;
|
||||||
rt_uint32_t crc;
|
rt_uint32_t crc;
|
||||||
rt_err_t res = -RT_ERROR;
|
rt_err_t res = -RT_ERROR;
|
||||||
rt_uint8_t *p,flag = 0;
|
rt_uint8_t *p,flag = 0;
|
||||||
|
|
||||||
crc = 0xffffffffL;
|
crc_cnt = 0; crc = 0xffffffffL;
|
||||||
Rxcount = 0;
|
Rxcount = 0;
|
||||||
while (buf <= p+len)
|
while (buf <= p+len)
|
||||||
{
|
{
|
||||||
|
@ -388,12 +384,12 @@ static rt_int16_t zrec_data32(rt_uint8_t *buf,rt_int16_t len)
|
||||||
/* receive data,with RLE encoded,32bits CRC check */
|
/* receive data,with RLE encoded,32bits CRC check */
|
||||||
static rt_int16_t zrec_data32r(rt_uint8_t *buf, rt_int16_t len)
|
static rt_int16_t zrec_data32r(rt_uint8_t *buf, rt_int16_t len)
|
||||||
{
|
{
|
||||||
rt_int16_t c,crc_cnt = 0;
|
rt_int16_t c,crc_cnt;
|
||||||
rt_uint32_t crc;
|
rt_uint32_t crc;
|
||||||
rt_err_t res = -RT_ERROR;
|
rt_err_t res = -RT_ERROR;
|
||||||
rt_uint8_t *p,flag = 0;
|
rt_uint8_t *p,flag = 0;
|
||||||
|
|
||||||
crc = 0xffffffffL;
|
crc_cnt = 0; crc = 0xffffffffL;
|
||||||
Rxcount = 0;
|
Rxcount = 0;
|
||||||
p = buf;
|
p = buf;
|
||||||
while (buf <= p+len)
|
while (buf <= p+len)
|
||||||
|
@ -640,7 +636,8 @@ static rt_int16_t zget_bin_fcs(rt_uint8_t *hdr)
|
||||||
if ((res = zread_byte()) & ~0377)
|
if ((res = zread_byte()) & ~0377)
|
||||||
return res;
|
return res;
|
||||||
header_type = res;
|
header_type = res;
|
||||||
crc = 0xFFFFFFFFL; crc = updcrc32(res, crc);
|
crc = 0xFFFFFFFFL;
|
||||||
|
crc = updcrc32(res, crc);
|
||||||
|
|
||||||
for (i=0;i<4;i++) /* 4headers */
|
for (i=0;i<4;i++) /* 4headers */
|
||||||
{
|
{
|
||||||
|
@ -860,7 +857,7 @@ rt_int16_t zxor_read(void)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put file posistion into the header*/
|
/* put file posistion into the header*/
|
||||||
|
|
Loading…
Reference in New Issue