//***************************************************************************** // //! Writes data to a ring buffer. //! //! \param psUSBRingBuf points to the ring buffer to be written to. //! \param pui8Data points to the data to be written. //! \param ui32Length is the number of bytes to be written. //! //! This function write a sequence of bytes into a ring buffer. //! //! \return None. // //***************************************************************************** void USBRingBufWrite(tUSBRingBufObject *psUSBRingBuf, const uint8_t *pui8Data, uint32_t ui32Length) { uint32_t ui32Temp; // // Check the arguments. // ASSERT(psUSBRingBuf != NULL); ASSERT(pui8Data != NULL); ASSERT(ui32Length != 0); // // Verify that space is available in the buffer. // ASSERT(ui32Length <= USBRingBufFree(psUSBRingBuf)); // // Write the data into the ring buffer. // for(ui32Temp = 0; ui32Temp < ui32Length; ui32Temp++) { USBRingBufWriteOne(psUSBRingBuf, pui8Data[ui32Temp]); } }
//***************************************************************************** // //! Writes data to a ring buffer. //! //! \param ptUSBRingBuf points to the ring buffer to be written to. //! \param pucData points to the data to be written. //! \param ulLength is the number of bytes to be written. //! //! This function write a sequence of bytes into a ring buffer. //! //! \return None. // //***************************************************************************** void USBRingBufWrite(tUSBRingBufObject *ptUSBRingBuf, const unsigned char *pucData, unsigned long ulLength) { unsigned long ulTemp; // // Check the arguments. // ASSERT(ptUSBRingBuf != NULL); ASSERT(pucData != NULL); ASSERT(ulLength != 0); // // Verify that space is available in the buffer. // ASSERT(ulLength <= USBRingBufFree(ptUSBRingBuf)); // // Write the data into the ring buffer. // for(ulTemp = 0; ulTemp < ulLength; ulTemp++) { USBRingBufWriteOne(ptUSBRingBuf, pucData[ulTemp]); } }