/*1* Copyright 2008-2012 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/313233/****************************************************************34*35* File: mm.h36*37*38* Description:39* MM (Memory Management) object definitions.40* It also includes definitions of the Free Block, Busy Block41* and Memory Block structures used by the MM object.42*43****************************************************************/4445#ifndef __MM_H46#define __MM_H474849#include "mm_ext.h"5051#define __ERR_MODULE__ MODULE_MM525354#define MAKE_ALIGNED(addr, align) \55(((uint64_t)(addr) + ((align) - 1)) & (~(((uint64_t)align) - 1)))565758/* t_MemBlock data structure defines parameters of the Memory Block */59typedef struct t_MemBlock60{61struct t_MemBlock *p_Next; /* Pointer to the next memory block */6263uint64_t base; /* Base address of the memory block */64uint64_t end; /* End address of the memory block */65} t_MemBlock;666768/* t_FreeBlock data structure defines parameters of the Free Block */69typedef struct t_FreeBlock70{71struct t_FreeBlock *p_Next; /* Pointer to the next free block */7273uint64_t base; /* Base address of the block */74uint64_t end; /* End address of the block */75} t_FreeBlock;767778/* t_BusyBlock data structure defines parameters of the Busy Block */79typedef struct t_BusyBlock80{81struct t_BusyBlock *p_Next; /* Pointer to the next free block */8283uint64_t base; /* Base address of the block */84uint64_t end; /* End address of the block */85char name[MM_MAX_NAME_LEN]; /* That block of memory was allocated for86something specified by the Name */87} t_BusyBlock;888990/* t_MM data structure defines parameters of the MM object */91typedef struct t_MM92{93t_Handle h_Spinlock;9495t_MemBlock *memBlocks; /* List of memory blocks (Memory list) */96t_BusyBlock *busyBlocks; /* List of busy blocks (Busy list) */97t_FreeBlock *freeBlocks[MM_MAX_ALIGNMENT + 1];98/* Alignment lists of free blocks (Free lists) */99100uint64_t freeMemSize; /* Total size of free memory (in bytes) */101} t_MM;102103104#endif /* __MM_H */105106107