我看到程序中有如下变量定义,其中如Data_Trans_COM1_Protocol都是函数,void Data_Trans_COM1_Protocol(unsigned char Data , int port, struct POSITION pstPosition).
struct char_dev_struct char_dev[PROTOCOL_TYPE_NUM ][NR_CHAR_DEV +1 ]=
{
{ NULL,
Data_Trans_COM1_Protocol,
Data_Trans_COM2_Protocol,
Data_Trans_COM3_Protocol,
Data_Trans_Trusted_COM4_Protocol,
Data_Trans_COM5_Protocol,
Data_Trans_COM6_Protocol,
Data_Trans_Trusted_COM7_Protocol,
Data_Trans_COM4_Protocol
},
{
NULL,
Data_Trans_COM1_Protocol,
Data_Trans_COM2_Protocol,
Data_Trans_COM3_Protocol,
Data_Trans_Trusted_COM4_Protocol,
Data_Trans_COM5_Protocol,
Data_Trans_COM6_Protocol,
Data_Trans_Trusted_COM5_Protocol,
Data_Trans_Trusted_COM4_Protocol
}
};
调用时如下,但不知Data_Trans_Protocol_Fn是哪里来的.
char_dev[protocoltype][port].Data_Trans_Protocol_Fn(src, port, pstPosition);