用JTAG仿真追踪,发现程序执行过 pUser_Standard_Requests = &User_Standard_Requests;就会在串口上打印“User_Standard_Requests ”
但是执行过 pProperty->Init();却不打印东西。于是我就执行进pProperty->Init();里面
[mw_shl_code=c,true] pInformation->ControlState = 2;
pProperty = &Device_Property;
pUser_Standard_Requests = &User_Standard_Requests;
printf("User_Standard_Requests ");
/* Initialize devices one by one */
pProperty->Init();
printf("Init ");[/mw_shl_code]
在里面,  owerOn();之后,程序就执行不下去了,
[mw_shl_code=c,true]void MASS_init()
{
/* Update the serial number string descriptor with the data from the unique
ID*/
Get_SerialNum();
pInformation->Current_Configuration = 0;
/* Connect the device */
PowerOn();
/* Perform basic device initialization operations */
USB_SIL_Init();
bDeviceState = UNCONNECTED;
printf("MASS_init ");
}[/mw_shl_code]
然后我就进入  owerOn();里面
[mw_shl_code=c,true]RESULT PowerOn(void)
{
uint16_t wRegVal;
/*** cable plugged-in ? ***/
USB_Cable_Config(ENABLE);
/*** CNTR_PWDN = 0 ***/
wRegVal = CNTR_FRES;
_SetCNTR(wRegVal);
/*** CNTR_FRES = 0 ***/
wInterrupt_Mask = 0;
_SetCNTR(wInterrupt_Mask);
/*** Clear pending interrupts ***/
_SetISTR(0);
/*** Set interrupt mask ***/
wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
_SetCNTR(wInterrupt_Mask);
return USB_SUCCESS;
}[/mw_shl_code]
可是PowerOn();里每句话都执行得下去呀,执行完这里之后跳出去,回到了上面,就执行PowerOn();下面的函数USB_SIL_Init();最后执行完MASS_init函数,跳出去后执行了串口打印“Init”以及主函数里我早设定好的“USB_Init”。但事实上,整个程序仿真的时候,不进去函数里面,是打印不出“USB_Init”
怎么会这样呢?如果是PowerOn();函数有问题,那么进去里面每个都可以执行得下去,每句函数都检查过,已经定义了的,那问题是出在哪里呢?
请大神帮帮我,我调试了很久,不知道问题出在哪里
|