void FMSTR_SendResponse(FMSTR_BPTR pResponse, FMSTR_SIZE8 nLength) { FMSTR_UNUSED(pResponse); FMSTR_UNUSED(nLength); /* Frame is ready to send */ pcm_bdm_pCommBuffer.bdmState = FMSTR_PDBDM_FRAME_TO_SEND; }
void FMSTR_SetUpRecBuff(FMSTR_ADDR pBuffer, FMSTR_SIZE nBuffSize) { #if FMSTR_REC_OWNBUFF pcm_nRecBuffAddr = pBuffer; pcm_wRecBuffSize = nBuffSize; #else FMSTR_UNUSED(pBuffer); FMSTR_UNUSED(nBuffSize); #endif }
FMSTR_BOOL FMSTR_RegisterAppCmdCall(FMSTR_APPCMD_CODE nAppCmdCode, FMSTR_PAPPCMDFUNC pCallbackFunc) { #if FMSTR_MAX_APPCMD_CALLS > 0 FMSTR_INDEX nIndex; /* keep "void" ID as reserved */ if(nAppCmdCode == FMSTR_APPCMDRESULT_NOCMD) { return FMSTR_FALSE; } /* get index of app.cmd ID (if already set) */ nIndex = FMSTR_FindAppCmdCallIndex(nAppCmdCode); /* when not found, get a free slot (only if registerring new callback) */ if(nIndex < 0 && pCallbackFunc != NULL) { nIndex = FMSTR_FindAppCmdCallIndex(FMSTR_APPCMDRESULT_NOCMD); } /* failed? */ if(nIndex < 0) { return FMSTR_FALSE; } /* register handler */ pcm_pAppCmdCallFunc[nIndex] = pCallbackFunc; pcm_pAppCmdCallId[nIndex] = (FMSTR_APPCMD_CODE) (pCallbackFunc ? nAppCmdCode : FMSTR_APPCMDRESULT_NOCMD); return FMSTR_TRUE; #else FMSTR_UNUSED(pCallbackFunc); FMSTR_UNUSED(nAppCmdCode); /* app.cmd callback not implemented */ return FMSTR_FALSE; #endif }
void FMSTR_SetCanRespID(FMSTR_U32 canID) { #if FMSTR_CAN_RESPID_DYNAMIC pcm_respIdr[0] = FMSTR_CAN_MAKEIDR0(canID); pcm_respIdr[1] = FMSTR_CAN_MAKEIDR1(canID); pcm_respIdr[2] = FMSTR_CAN_MAKEIDR2(canID); pcm_respIdr[3] = FMSTR_CAN_MAKEIDR3(canID); #else FMSTR_UNUSED(canID); #endif }
void FMSTR_SetCanCmdID(FMSTR_U32 canID) { #if FMSTR_CAN_CMDID_DYNAMIC pcm_cmdIdr[0] = FMSTR_CAN_MAKEIDR0(canID); pcm_cmdIdr[1] = FMSTR_CAN_MAKEIDR1(canID); pcm_cmdIdr[2] = FMSTR_CAN_MAKEIDR2(canID); pcm_cmdIdr[3] = FMSTR_CAN_MAKEIDR3(canID); #else FMSTR_UNUSED(canID); #endif }
static FMSTR_INDEX FMSTR_FindAppCmdCallIndex(FMSTR_APPCMD_CODE nAppcmdCode) { #if FMSTR_MAX_APPCMD_CALLS > 0 FMSTR_INDEX i; for(i=0; i<FMSTR_MAX_APPCMD_CALLS; i++) { if(pcm_pAppCmdCallId[i] == nAppcmdCode) { return i; } } #else /*lint -esym(528, FMSTR_FindAppCmdCallIndex) this function is not referenced when APPCMD_CALLS are not used */ FMSTR_UNUSED(nAppcmdCode); #endif return -1; }
FMSTR_BPTR FMSTR_GetBoardInfo(FMSTR_BPTR pMessageIO) { FMSTR_BPTR pResponse = pMessageIO; FMSTR_U16 wTmp; FMSTR_U8 *pStr; pResponse = FMSTR_ConstToBuffer8(pResponse, FMSTR_STS_OK); pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_PROT_VER)); /* protVer */ pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_CFG_FLAGS)); /* cfgFlags */ pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_CFG_BUS_WIDTH)); /* dataBusWdt */ pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_GLOB_VERSION_MAJOR)); /* globVerMajor */ pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_GLOB_VERSION_MINOR)); /* globVerMinor */ pResponse = FMSTR_ConstToBuffer8(pResponse, (FMSTR_U8)(FMSTR_COMM_BUFFER_SIZE)); /* cmdBuffSize */ /* that is all for brief info */ #if FMSTR_USE_BRIEFINFO FMSTR_UNUSED(pStr); FMSTR_UNUSED(wTmp); #else /* FMSTR_USE_BRIEFINFO */ #if FMSTR_USE_RECORDER /* recorder buffer size is always mesured in bytes */ wTmp = FMSTR_GetRecBuffSize(); wTmp *= FMSTR_CFG_BUS_WIDTH; /* send size and timebase */ pResponse = FMSTR_ValueToBuffer16(pResponse, wTmp); pResponse = FMSTR_ConstToBuffer16(pResponse, (FMSTR_U16) FMSTR_REC_TIMEBASE); #else /* FMSTR_USE_RECORDER */ FMSTR_UNUSED(wTmp); /* recorder info zeroed */ pResponse = FMSTR_ConstToBuffer16(pResponse, 0); pResponse = FMSTR_ConstToBuffer16(pResponse, 0); #endif /* FMSTR_USE_RECORDER */ #if FMSTR_LIGHT_VERSION FMSTR_UNUSED(pStr); pResponse = FMSTR_SkipInBuffer(pResponse, (FMSTR_U8)FMSTR_DESCR_SIZE); #else /* description string */ pStr = (FMSTR_U8*) FMSTR_IDT_STRING; for(wTmp = 0U; wTmp < (FMSTR_U8)(FMSTR_DESCR_SIZE); wTmp++) { pResponse = FMSTR_ValueToBuffer8(pResponse, *pStr); /* terminating zero used to clear the remainder of the buffer */ if(*pStr) { pStr ++; } } #endif /* SEND_IDT_STRING */ #endif /* FMSTR_USE_BRIEFINFO */ return pResponse; }
void FMSTR_SetUpRecBuff(FMSTR_ADDR pBuffer, FMSTR_SIZE wBuffSize) { FMSTR_UNUSED(pBuffer); FMSTR_UNUSED(wBuffSize); }