FMSTR_BPTR FMSTR_GetRecBuff(FMSTR_BPTR pMessageIO) { FMSTR_ADDR a; /* must be configured */ if(!pcm_wRecFlags.flg.bIsConfigured) { return FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STC_NOTINIT); } /* must be stopped */ if(pcm_wRecFlags.flg.bIsRunning) { return FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STC_SERVBUSY); } /* fill the return info */ pMessageIO = FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STS_OK); /* word-pointer offset divided by number of (word-wide-only) variables */ pMessageIO = FMSTR_AddressToBuffer(pMessageIO, pcm_dwFastRecStartBuffPtr * 2); /* calculate index of the first sample */ a = (pcm_dwFastRecWritePtr - pcm_dwFastRecStartBuffPtr); /* word-pointer offset divided by number of (word-wide-only) variables */ return FMSTR_ValueToBuffer16(pMessageIO, (FMSTR_U16)(a / (FMSTR_U16)pcm_nRecVarCount)); }
FMSTR_BPTR FMSTR_GetRecBuff(FMSTR_BPTR pMessageIO) { volatile FMSTR_BPTR pResponse; /* must be configured */ if(!pcm_wRecFlags.flg.bIsConfigured) { return FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STC_NOTINIT); } /* must be stopped */ if(pcm_wRecFlags.flg.bIsRunning) { return FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STC_SERVBUSY); } /* fill the return info */ pResponse = FMSTR_ConstToBuffer8(pMessageIO, FMSTR_STS_OK); pResponse = FMSTR_AddressToBuffer(pResponse, pcm_nRecBuffAddr); return FMSTR_ValueToBuffer16(pResponse, pcm_wRecBuffStartIx); }
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; }