NXP / fsl_phy_mcr20a

Fork of fsl_phy_mcr20a by Freescale

Embed: (wiki syntax)

« Back to documentation index

FunctionLib.h File Reference

FunctionLib.h File Reference

Go to the source code of this file.

Functions

void FLib_MemCpy (void *pDst, void *pSrc, uint32_t cBytes)
 Copy the content of one memory block to another. The amount of data to copy must be specified in number of bytes.
void FLib_MemCpyAligned32bit (void *to_ptr, void *from_ptr, register uint32_t number_of_bytes)
 This function copies the specified number of bytes from the source address to the destination address. No attempt is made to handle overlapping copies to prevent loss of data. The copying is optimized to avoid alignment problems, and attempts to copy 32bit numbers optimally.
void FLib_MemCpyDir (void *pBuf1, void *pBuf2, bool_t dir, uint32_t n)
 Copy bytes from one buffer to another. The buffers should not overlap. The function can copy in either direction. If 'dir' is TRUE, then the function works like FLib_MemCpy(). If FALSE, the function swaps the buffer pointers before copying.
void FLib_MemCpyReverseOrder (void *pDst, void *pSrc, uint32_t cBytes)
 Copy bytes. The byte at index i from the source buffer is copied to index ((n-1) - i) in the destination buffer (and vice versa).
bool_t FLib_MemCmp (void *pData1, void *pData2, uint32_t cBytes)
 Compare two memory blocks. The number of bytes to compare must be specified. If the blocks are equal byte by byte, the function returns TRUE, and FALSE otherwise.
void FLib_MemSet (void *pData, uint8_t value, uint32_t cBytes)
 Reset bytes in a memory block to a certain value. The value, and the number of bytes to be set, are supplied as arguments.
void FLib_MemInPlaceCpy (void *pDst, void *pSrc, uint32_t cBytes)
 Copy bytes, possibly into the same overlapping memory as it is taken from.
void FLib_MemCopy16Unaligned (void *pDst, uint16_t val16)
 Copies a 16bit value to an unaligned a memory block.
void FLib_MemCopy32Unaligned (void *pDst, uint32_t val32)
 Copies a 32bit value to an unaligned a memory block.
void FLib_MemCopy64Unaligned (void *pDst, uint64_t val64)
 Copies a 64bit value to an unaligned a memory block.
void FLib_AddOffsetToPointer (void **pPtr, uint32_t offset)
 Add an offset to a pointer.
uint32_t FLib_StrLen (char *str)
 This function returns the length of a NULL terminated string.

Detailed Description

Copyright (c) 2015, Freescale Semiconductor, Inc. All rights reserved.

This is the Function Lib module header file

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

o Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

o Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

o Neither the name of Freescale Semiconductor, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file FunctionLib.h.


Function Documentation

void FLib_AddOffsetToPointer ( void **  pPtr,
uint32_t  offset 
)

Add an offset to a pointer.

*********************************************************************************

Parameters:
[out]pPtrPointer to the pointer to be updated
[in]offsetThe offset(in bytes) to be added

Add an offset to a pointer.

*********************************************************************************

Parameters:
[in,out]pPtrPointer to the pointer to add the offset to
[in]offsetOffset to add to the specified pointer.
Postcondition:
Remarks:

Definition at line 466 of file FunctionLib.c.

bool_t FLib_MemCmp ( void *  pData1,
void *  pData2,
uint32_t  cBytes 
)

Compare two memory blocks. The number of bytes to compare must be specified. If the blocks are equal byte by byte, the function returns TRUE, and FALSE otherwise.

*********************************************************************************

Parameters:
[in]pData1First memory block to compare
[in]pData2Second memory block to compare
[in]cBytesNumber of bytes to compare
Returns:
TRUE if memory areas are equal. FALSE othwerwise.

Compare two memory blocks. The number of bytes to compare must be specified. If the blocks are equal byte by byte, the function returns TRUE, and FALSE otherwise.

*********************************************************************************

Parameters:
[in]pData1First buffer to compare.
[in]pData2Second buffer to compare.
[in]cBytesNumber of bytes to compare.
Returns:
This function return TRUE if the buffers are equal and FALSE otherwise.
Postcondition:
Remarks:

Definition at line 283 of file FunctionLib.c.

void FLib_MemCopy16Unaligned ( void *  pDst,
uint16_t  val16 
)

Copies a 16bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]val16The 16-bit value to be copied

Copies a 16bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination memory block.
[in]val16The value to be copied.

Definition at line 394 of file FunctionLib.c.

void FLib_MemCopy32Unaligned ( void *  pDst,
uint32_t  val32 
)

Copies a 32bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]val32The 32-bit value to be copied

Copies a 32bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination memory block.
[in]val32The value to be copied.

Definition at line 414 of file FunctionLib.c.

void FLib_MemCopy64Unaligned ( void *  pDst,
uint64_t  val64 
)

Copies a 64bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]val64The 64-bit value to be copied

Copies a 64bit value to an unaligned a memory block.

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination memory block.
[in]val64The value to be copied.

Definition at line 436 of file FunctionLib.c.

void FLib_MemCpy ( void *  pDst,
void *  pSrc,
uint32_t  cBytes 
)

Copy the content of one memory block to another. The amount of data to copy must be specified in number of bytes.

*********************************************************************************

Public prototypes

*********************************************************************************

Public type definitions

*********************************************************************************

Public memory declarations

*********************************************************************************

Public functions

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]pSrcPointer to source memory block
[in]cBytesNumber of bytes to copy

Copy the content of one memory block to another. The amount of data to copy must be specified in number of bytes.

*********************************************************************************

Private macros

*********************************************************************************

Private prototypes

*********************************************************************************

Private type definitions

*********************************************************************************

Public memory declarations

*********************************************************************************

Private memory declarations

*********************************************************************************

Public functions

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination buffer.
[in]pSrcPointer to the source buffer.
[in]cBytesNumber of bytes to copy.
Postcondition:
The source and destination buffers must not overlap.
Remarks:

Definition at line 91 of file FunctionLib.c.

void FLib_MemCpyAligned32bit ( void *  to_ptr,
void *  from_ptr,
register uint32_t  number_of_bytes 
)

This function copies the specified number of bytes from the source address to the destination address. No attempt is made to handle overlapping copies to prevent loss of data. The copying is optimized to avoid alignment problems, and attempts to copy 32bit numbers optimally.

*********************************************************************************

Parameters:
[in]from_ptrPointer to the source buffer.
[in,out]to_ptrPointer to the destination buffer.
[in]number_of_bytesNumber of bytes to copy (32 bit value).
Postcondition:
Remarks:

Definition at line 126 of file FunctionLib.c.

void FLib_MemCpyDir ( void *  pBuf1,
void *  pBuf2,
bool_t  dir,
uint32_t  n 
)

Copy bytes from one buffer to another. The buffers should not overlap. The function can copy in either direction. If 'dir' is TRUE, then the function works like FLib_MemCpy(). If FALSE, the function swaps the buffer pointers before copying.

*********************************************************************************

Parameters:
[in,out]pBuf1Pointer to the destination/source buffer.
[in,out]pBuf2Pointer to the source/destination buffer.
[in]dirDirection to copy: pBuf2->pBuf1 if TRUE, pBuf1->pBuf2 if FALSE
[in]nNumber of bytes to copy.
Postcondition:
The source and destination buffers must not overlap.
Remarks:

Definition at line 217 of file FunctionLib.c.

void FLib_MemCpyReverseOrder ( void *  pDst,
void *  pSrc,
uint32_t  cBytes 
)

Copy bytes. The byte at index i from the source buffer is copied to index ((n-1) - i) in the destination buffer (and vice versa).

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]pSrcPointer to source memory block
[in]cBytesNumber of bytes to copy

Copy bytes. The byte at index i from the source buffer is copied to index ((n-1) - i) in the destination buffer (and vice versa).

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination buffer.
[in]pSrcPointer to the source buffer.
[in]cBytesNumber of bytes to copy.
Postcondition:
Remarks:

Definition at line 248 of file FunctionLib.c.

void FLib_MemInPlaceCpy ( void *  pDst,
void *  pSrc,
uint32_t  cBytes 
)

Copy bytes, possibly into the same overlapping memory as it is taken from.

*********************************************************************************

Parameters:
[out]pDstPointer to destination memory block
[in]pSrcPointer to source memory block
[in]cBytesNumber of bytes to copy

Copy bytes, possibly into the same overlapping memory as it is taken from.

*********************************************************************************

Parameters:
[in,out]pDstPointer to the destination buffer.
[in]pSrcPointer to the source buffer.
[in]cBytesNumber of bytes to copy.
Postcondition:
Remarks:

Definition at line 352 of file FunctionLib.c.

void FLib_MemSet ( void *  pDst,
uint8_t  value,
uint32_t  cBytes 
)

Reset bytes in a memory block to a certain value. The value, and the number of bytes to be set, are supplied as arguments.

*********************************************************************************

Parameters:
[in]pDataPointer to memory block to reset
[in]valueValue that memory block will be set to
[in]cBytesNumber of bytes to set

Reset bytes in a memory block to a certain value. The value, and the number of bytes to be set, are supplied as arguments.

*********************************************************************************

Parameters:
[in,out]pDstAddress of the buffer to set.
[in]valueSet value.
[in]cBytesNumber of bytes to set in the buffer (maximum 255 bytes).
Postcondition:
Remarks:

Definition at line 322 of file FunctionLib.c.

uint32_t FLib_StrLen ( char *  str )

This function returns the length of a NULL terminated string.

*********************************************************************************

Parameters:
[in]strA NULL terminated string
Returns:
the size of string in bytes

Definition at line 481 of file FunctionLib.c.