// ************************************************************************************************ // (C) Automotive Lighting Reutlingen GmbH // Tuebinger Strasse 123, 72762 Reutlingen, Germany // ************************************************************************************************ /////////////////////////////////////////////////////////////////////////////////////////////////// /// \file CddStpDynBuf.c /// /// \author Ott, Peter ALRT/EEG-PM2 /// /// \brief Step buffer handling /// /// \descr This file provides the interface functions to fill and read the step buffer that /// is used by CddStp88XX /// #include #include //-- STATIC_AL #include #include #ifndef UNIT_TEST // NOT Unit-Tests = 'regular' #include #include #include #else // Unit-Tests! #define CFA_CNT_STP_88XX (4u) #define CFA_CNT_STP_ONBRD (4u) //#include <../../Cust/Bw/Bw16/App/Bsw/Cdd/CddStp/CddStpPrj.h> #include #include #endif #include <8899/CddStp8899Cfg.h> #include <88XX/CddStp88XX_HalStp.h> #include <8899/CddStp8899Com.h> #if(CFA_CNT_STP_ONBRD != 0) #include // --------------------------------------------------------------------------- // defines // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // global variables (accessable for inline functions placed in header) // --------------------------------------------------------------------------- // prqa .... uint32 CddStpDynBuf_ulAccStepTime; uint32 CddStpDynBuf_ulBufIx; tHsInfo* CddStpDynBuf_pHsBuf; tHsInfo CddStpDynBuf_HsEntry; /////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief Read last buffer entry /// /// \descr Get buffer contents of the last halfstep that will be handled by HalStp. /// This is needed to continue a previous movement using the same dynamic table entry. /// /// \param /// /// \return /// void CddStpDynBuf_ReadLastEntry(void) { // get buffer entry (n-1) for history data, put it into temporary storage CddStpDynBuf_HsEntry = CddStpDynBuf_pHsBuf[(CddStpDynBuf_ulBufIx - 1u) & CDDSTP_HsInfoBufMask]; } /////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief Read actual buffer entry /// /// \descr Get buffer entry of the halfstep that should be processed next. /// /// \param /// /// \return /// void CddStpDynBuf_ReadActualEntry(void) { // get actual buffer entry, put it into temporary storage CddStpDynBuf_HsEntry = CddStpDynBuf_pHsBuf[CddStpDynBuf_ulBufIx]; } /////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief Write to buffer /// /// \descr Copy temporary storage into buffer, increment index and wrap around using buffer size /// /// \param /// /// \return /// void CddStpDynBuf_WriteToBuffer(void) { CddStpDynBuf_HsEntry.Bit.biSet = 1; // validate buffer entry CddStpDynBuf_pHsBuf[CddStpDynBuf_ulBufIx] = CddStpDynBuf_HsEntry; // copy temporary storage to buffer CddStpDynBuf_ulBufIx++; CddStpDynBuf_ulBufIx &= CDDSTP_HsInfoBufMask; // buffer index wrap around } /////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief Increment buffer index /// /// \descr Increment index and wrap around using buffer size /// /// \param /// /// \return /// void CddStpDynBuf_IncBufIx(void) { CddStpDynBuf_ulBufIx++; CddStpDynBuf_ulBufIx &= CDDSTP_HsInfoBufMask; // buffer index wrap around } #endif // (CFA_CNT_STP_ONBRD != 0) //EOF