/**********************************************************************************************************
** Function name: FileBrowserCallBack
** Descriptions: 文件浏览对话框回调函数
** input parameters: WM_MESSAGE *pMsg:消息
** output parameters: 无
** Returned value: 无
**********************************************************************************************************/
static void FileBrowserCallBack(WM_MESSAGE *pMsg)
{
int Id,NCode;
char buf[30],i,*DIRinf;
u16 file_num = 0;
LISTBOX_Handle hFileBrowseListBox;
WM_HWIN hWin = pMsg->hWin;
hFileBrowseListBox = WM_GetDialogItem(hWin,GUI_ID_LISTBOX0);
switch(pMsg -> MsgId) {
case WM_INIT_DIALOG:
MenuDisnable++;
LISTBOX_SetAutoScrollV (hFileBrowseListBox, 1);
// FRAMEWIN_AddCloseButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT,0);
FRAMEWIN_AddMaxButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0);
FRAMEWIN_AddMinButton(pMsg->hWin, FRAMEWIN_BUTTON_RIGHT, 0);
WINDOW_SetDefaultBkColor(GUI_GREEN);
if(device == SPIFlash)
{
FRAMEWIN_SetText(pMsg->hWin,"SPIFlash存储设备");
strcpy(FilePath,"1:");
FatFs_Open("1:");
}
else if(device == SDCard)
{
FRAMEWIN_SetText(pMsg->hWin,"SDCard存储设备");
strcpy(FilePath,"0:");
FatFs_Open("0:");//打开SD卡,获取根目录列表
}
for(Id = 0;Id < filecount;Id++){
LISTBOX_AddString(hFileBrowseListBox, (char*)FileList[Id]);
}
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg ->hWinSrc);
NCode = pMsg ->Data.v;
switch(NCode) {
case WM_NOTIFICATION_RELEASED:
if(Id == Button_ID6){
file_num = LISTBOX_GetSel(hFileBrowseListBox);//返回值即为选中项所在的行数
LISTBOX_GetItemText(hFileBrowseListBox,file_num,buf,30);
FilePath_process(FilePath,buf);
DIRinf = mymalloc(SRAMEX,30);
sprintf(DIRinf,"文件夹的大小是%dBytes",exf_fdsize(FilePath));
MESSAGEBOX_Create("sdfa","dsef",0); -------------------------------------------------》》》执行到这一步会死机进入硬件错误,怎么回事呀,硬件错误寄存器信息如下:
myfree(SRAMEX,DIRinf);
}
else if (Id == Button_ID7) {
FileOpen(hFileBrowseListBox,".."); //返回上一级
FRAMEWIN_SetText(pMsg->hWin, (const char*)FilePath);
} else if (Id == Button_ID8) {
file_num = LISTBOX_GetSel(hFileBrowseListBox);//返回值即为选中项所在的行数
LISTBOX_GetItemText(hFileBrowseListBox,file_num,buf,30);
FileOpen(hFileBrowseListBox,buf);
FRAMEWIN_SetText(pMsg->hWin, (const char*)FilePath);
} else if(Id == Button_ID9) {
ClearPath(FilePath);
GUI_EndDialog(pMsg->hWin, 1);
MenuDisnable--;
}
break;
default:
break;
}
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
硬件错误寄存器信息:
CFSR: 40000
HFSR:40000000
DFSR: 1
AFSR: 0
怎么解决,什么原因引起的 |