猿问

求助最后那个 return(FnCmdInRam(0x40)); 等于多少?

typedef byte (*pCmdInRam)(byte cmd);
typedef struct {
unsigned char code[100];
} CmdInRam_t;
CmdInRam_t CmdInRam;
pCmdInRam FnCmdInRam; // FnCmdInRam 函数的指针
byte result;
byte Flash_Cmd(byte Cmd)
{
FCMD = Cmd;

FSTAT = 0x80; // launch command

if(FSTAT&0x30)
{
return 0xFF;
}

while(!FSTAT_FCCF){}

return 0x01;

}
// sector erase (1k bytes)
byte Flash_Erase(dword addr)
{
FnCmdInRam = (void*)((dword)&CmdInRam);
CmdInRam = *(CmdInRam_t *)(Flash_Cmd);
FSTAT = 0x30;

*(dword *)addr = 0x55;

return(FnCmdInRam(0x40));

}


慕无忌1623718
浏览 102回答 1
1回答

富国沪深

pCmdInRam是一个函数指针类型定义了一个指向函数的指针就是FnCmdInRamFnCmdInRam = (void*)((dword)&CmdInRam); 这句里面FnCmdInRam指向了CmdInRam这个函数所以最后的return(FnCmdInRam(0x40));其实就是return(Flash_Cmd(0x40));这样的
随时随地看视频慕课网APP
我要回答