|
本帖最后由 godjohsn 于 2020-7-1 16:49 编辑
需求是需要用网口接收数据处理,
我在调试“..\Tronlong\TMS320C6748\1\Demo\SYSBIOS\Application”中TCP_Client这个例程时,
在TCP.c文件的void TcpTest(void)函数下加了一个自己写的函数 DATA_CMP :
#include "fundefine.h"
#include "vars.h"
void TcpTest(void)
{
......
struct Time_Data Time_word[8];
struct Sat1_Data Date_word[8];
unsigned char DataInput[4];
unsigned char *pDataTemp = DataInput;
......
//-------------test------------//
DataInput[0] = 0x11;
DataInput[1] = 0x22;
DataInput[2] = 0x33;
DataInput[3] = 0x44;
//////////////////////////////////
......
DATA_CMP(pDataTemp, &(Time_word[0]), &(Date_word[0]));
......
}
编译时出错:
"../TCP.c", line 212: error #169: argument of type "struct Time_Data *" is incompatible with parameter of type "struct Time_Data *"
"../TCP.c", line 212: error #169: argument of type "struct Date_Data *" is incompatible with parameter of type "struct Date_Data *"
函数定义在文件“function.c”中:
#include "vars.h"
......
void DATA_CMP(unsigned char *pBuf, struct Time_Data *pTime, struct Date_Data *pDate)
{
pTime->tword1 = (pBuf[0]>>3);
pTime->tword2 = ((pBuf[0] & 0x07)<<13) + (pBuf[1]<<5) + (pBuf[4]>>3);
pDate->dword1 = (pBuf[2]>>3) + 5;
pDate->dword2 = (pBuf[3]>>3);
}
......
结构体变量定义文件"vars.h"如下:
#ifndef VARS_H_
#define VARS_H_
struct Time_Data{
unsigned char tword1;
unsigned int tword2;
unsigned int tword3;
......
};
struct Date_Data{
unsigned char >dword1
unsigned char >dword2
......
};
......
#endif
函数声明文件在"fundefine.h"中:
#ifndef FUNDEFINE_H_
#define FUNDEFINE_H_
......
void DATA_CMP(unsigned char *pBuf, struct Time_Data *pTime, struct Date_Data *pDate);
......
#endif
编译时出错:
../TCP.c", line 212: error #169: argument of type "struct Time_Data *" is incompatible with parameter of type "struct Time_Data *"
../TCP.c", line 212: error #169: argument of type "struct Date_Data *" is incompatible with parameter of type "struct Date_Data *"
前后引号里的名字、内容、类型都一样居然还 “incompatible” ?
按理说函数在使用时调用的2个参数:&(Time_word[0]), &(Date_word[0]) 取结构体数组首个地址也没问题
而且,这段函数及相关定义我单独拎出来另写一个工程测试的时候编译是没问题的(反复确认过,在TCP工程中没有对函数DATA_CMP及用到的变量做其他操作),这是什么原因?
是不是跟SYSBIOS有关?该如何解决?
ps:
我用printf语句将两个出问题的首地址输出来:
printf("%x\n", &(Time_word[0]));
printf("%x\n", &(Date_word[0]));
在TCP.c程序中的输出是:
c004e2a8
c004e348
在单独的工程中输出是:
80006730
800067d0
请高人给指点一下什么原因?谢谢!
|
|