Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of fsl_phy_mcr20a by
MemManager.h File Reference
Go to the source code of this file.
Data Structures | |
struct | poolStat_tag |
Typedefs | |
typedef struct poolStat_tag | poolStat_t |
Enumerations | |
enum | memStatus_t |
Functions | |
memStatus_t | MEM_Init (void) |
This function initializes the message module private variables. Must be called at boot time, or if device is reset. | |
uint32_t | MEM_GetAvailableBlocks (uint32_t size) |
This function returns the number of available blocks greater or equal to the given size. | |
memStatus_t | MEM_BufferFree (void *buffer) |
Deallocate a memory block by putting it in the corresponding pool of free blocks. | |
void * | MEM_BufferAlloc (uint32_t numBytes) |
Allocate a block from the memory pools. The function uses the numBytes argument to look up a pool with adequate block sizes. | |
uint16_t | MEM_BufferGetSize (void *buffer) |
Determines the size of a memory block. | |
uint32_t | MEM_WriteReadTest (void) |
Performs a write-read-verify test for every byte in all memory pools. | |
uint8_t | MEM_Track (listHeader_t *block, memTrackingStatus_t alloc, uint32_t address, uint16_t requestedSize) |
This function updates the tracking array element corresponding to the given block. | |
uint8_t | MEM_BufferCheck (uint8_t *p, uint32_t size) |
This function checks for buffer overflow when copying multiple bytes. |
Detailed Description
Copyright (c) 2015, Freescale Semiconductor, Inc. All rights reserved.
This is the header file for the Memory Manager interface.
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 MemManager.h.
Typedef Documentation
typedef struct poolStat_tag poolStat_t |
*********************************************************************************
Private type definitions
Enumeration Type Documentation
enum memStatus_t |
*********************************************************************************
Private type definitions
Definition at line 67 of file MemManager.h.
Function Documentation
void* MEM_BufferAlloc | ( | uint32_t | numBytes ) |
Allocate a block from the memory pools. The function uses the numBytes argument to look up a pool with adequate block sizes.
*********************************************************************************
- Parameters:
-
[in] numBytes - Size of buffer to allocate.
- Returns:
- Pointer to the allocated buffer, NULL if failed.
- Precondition:
- Memory manager must be previously initialized.
Definition at line 246 of file MemManager.c.
uint8_t MEM_BufferCheck | ( | uint8_t * | p, |
uint32_t | size | ||
) |
This function checks for buffer overflow when copying multiple bytes.
*********************************************************************************
- Parameters:
-
[in] p - pointer to destination. [in] size - number of bytes to copy
- Returns:
- 1 if overflow detected, else 0
Definition at line 512 of file MemManager.c.
memStatus_t MEM_BufferFree | ( | void * | buffer ) |
Deallocate a memory block by putting it in the corresponding pool of free blocks.
*********************************************************************************
- Parameters:
-
[in] buffer - Pointer to buffer to deallocate.
- Returns:
- MEM_SUCCESS_c if deallocation was successful, MEM_FREE_ERROR_c if not.
- Precondition:
- Memory manager must be previously initialized.
- Remarks:
- Never deallocate the same buffer twice.
Definition at line 337 of file MemManager.c.
uint16_t MEM_BufferGetSize | ( | void * | buffer ) |
Determines the size of a memory block.
*********************************************************************************
- Parameters:
-
[in] buffer - Pointer to buffer.
- Returns:
- size of memory block
- Precondition:
- Memory manager must be previously initialized.
Definition at line 419 of file MemManager.c.
uint32_t MEM_GetAvailableBlocks | ( | uint32_t | size ) |
This function returns the number of available blocks greater or equal to the given size.
*********************************************************************************
- Parameters:
-
[in] size - Size of blocks to check for availability.
- Returns:
- Number of available blocks greater or equal to the given size.
- Precondition:
- Memory manager must be previously initialized.
Definition at line 210 of file MemManager.c.
memStatus_t MEM_Init | ( | void | ) |
This function initializes the message module private variables. Must be called at boot time, or if device is reset.
*********************************************************************************
Public prototypes
*********************************************************************************
Public functions
*********************************************************************************
- Parameters:
-
[in] none
- Returns:
- MEM_SUCCESS_c if initialization is successful. (It's always successful).
Definition at line 130 of file MemManager.c.
uint8_t MEM_Track | ( | listHeader_t * | block, |
memTrackingStatus_t | alloc, | ||
uint32_t | address, | ||
uint16_t | requestedSize | ||
) |
This function updates the tracking array element corresponding to the given block.
*********************************************************************************
Private prototypes
*********************************************************************************
Private functions
*********************************************************************************
- Parameters:
-
[in] block - Pointer to the block. [in] alloc - Indicates whether an allocation or free operation was performed [in] address - Address where MEM_BufferAlloc or MEM_BufferFree was called [in] requestedSize - Indicates the requested buffer size passed to MEM_BufferAlloc. Has no use if a free operation was performed.
- Returns:
- Returns TRUE if correct allocation or dealocation was performed, FALSE if a buffer was allocated or freed twice.
Definition at line 451 of file MemManager.c.
uint32_t MEM_WriteReadTest | ( | void | ) |
Performs a write-read-verify test for every byte in all memory pools.
*********************************************************************************
- Returns:
- Returns MEM_SUCCESS_c if test was successful, MEM_ALLOC_ERROR_c if a buffer was not allocated successufuly, MEM_FREE_ERROR_c if a buffer was not freed successufuly or MEM_UNKNOWN_ERROR_c if a verify error, heap overflow or data corruption occurred.
Definition at line 548 of file MemManager.c.
Generated on Fri Jul 15 2022 21:41:18 by
