当前位置: 代码迷 >> VxWorks >> Tornado2.2.1开发环境中生成bootrom时出现的有关问题
  详细解决方案

Tornado2.2.1开发环境中生成bootrom时出现的有关问题

热度:10162   发布时间:2013-02-26 00:00:00.0
Tornado2.2.1开发环境中生成bootrom时出现的问题
struct IoInput /*解析、保存每次通道配置关系中输入通道信息*/

int a1;
int size_input[0];
};
 
  struct IoOutput /*解析、保存每次通道配置关系中输出通道信息*/
{
int b1;
  int size_output[0];
};
 
struct mystruct
{
char output[40];  
char input[40];  
  int IoIndex;  
int AdIndex;  
int Io_Delaytime;  
int chan;  
int An_Delaytime;  
  struct IoInput *Ioinput;
  struct IoOutput *Iooutput;
}mystruct1[2];


STATUS IOReadAll(int num , char *pbuf)
{
FILE *fp;

  int i = 0; /*记录配置关系数*/
int j = 0; /* 记录每一次配置的具体信息行数*/

  int m = 0;  
  int n = 0;
  int k = 0;

  int a = 0; /*记录输出通道整型数组的下标*/
  int b = 0; /*记录输出通道整型数组的下标*/
  int c = 0;

  int i1;
  int i2;
  int j1;
  int j2;

   
  float *pdata;
  char *tokenPtr_input;
  char *tokenPtr_output;

  UINT32 IniState = 0;  
  UINT32 Rdback1 = 0;  
  UINT32 Rdback2 = 0;  
  UINT32 NewState = 0;  
  UINT32 Out = 0;
  UINT32 In = 0;

  UINT32 Input_a = 0;
  UINT32 Input_b = 0;
  UINT32 Input_c = 0;
  UINT32 Input_d = 0;
   
  char ch[40]; /* 保存每一行配置信息*/
memset( ch, 0, sizeof(ch) ); /* Initial the array */

  /* struct mystruct mystruct1[2];*/
  /*struct IoInput *Ioinput;
  struct IoOutput *Iooutput;*/

if((fp=fopen("f:\\Pei_Zhi.txt","r")) == NULL)  
{
printf("File cannot be opened\n"); 
return ERROR;
}

while(fgets(ch,40,fp)) /* read the string from the file*/
{
j += 1;
i = (j - 1)/8;
if( 1 == (j%8))
{
continue; /*跳过每次配置的标记行*/
}
else
{
switch(j%8)
{
case 2:
mystruct1[i].IoIndex = atoi(ch); /* 保存配置信息板号 */
continue;
case 3:
strcpy(mystruct1[i].output,ch);
continue;
case 4:
mystruct1[i].Io_Delaytime = atoi(ch);
continue;
case 5:
  strcpy(mystruct1[i].input,ch);
continue;
case 6:
mystruct1[i].An_Delaytime = atoi(ch);
  continue;
case 7:
  mystruct1[i].AdIndex = atoi(ch);
continue;
case 0:
mystruct1[i].chan = atoi(ch);
continue;
}
}
}

fclose(fp);

for( i1 = 0; i1 < 2; i1++)
{
  for( j1 = 0; j1 < 40; j1++)
  {
  if((mystruct1[i1].output[j1] != '\0') && ( mystruct1[i1].output[j1] == ':'))
  {
  m++;
  }
  } 

  for( j2 = 0; j2 < 40 ; j2++)
  {
  if((mystruct1[i1].input[j2] != '\0') && ( mystruct1[i1].input[j2] == ':'))  
  {
  n++;