xref: /freebsd/sys/contrib/ncsw/inc/Peripherals/fm_muram_ext.h (revision c2c014f24c10f90d85126ac5fbd4d8524de32b1c)
1*852ba100SJustin Hibbits /*
2*852ba100SJustin Hibbits  * Copyright 2008-2012 Freescale Semiconductor Inc.
30aeed3e9SJustin Hibbits  *
40aeed3e9SJustin Hibbits  * Redistribution and use in source and binary forms, with or without
50aeed3e9SJustin Hibbits  * modification, are permitted provided that the following conditions are met:
60aeed3e9SJustin Hibbits  *     * Redistributions of source code must retain the above copyright
70aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer.
80aeed3e9SJustin Hibbits  *     * Redistributions in binary form must reproduce the above copyright
90aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer in the
100aeed3e9SJustin Hibbits  *       documentation and/or other materials provided with the distribution.
110aeed3e9SJustin Hibbits  *     * Neither the name of Freescale Semiconductor nor the
120aeed3e9SJustin Hibbits  *       names of its contributors may be used to endorse or promote products
130aeed3e9SJustin Hibbits  *       derived from this software without specific prior written permission.
140aeed3e9SJustin Hibbits  *
150aeed3e9SJustin Hibbits  *
160aeed3e9SJustin Hibbits  * ALTERNATIVELY, this software may be distributed under the terms of the
170aeed3e9SJustin Hibbits  * GNU General Public License ("GPL") as published by the Free Software
180aeed3e9SJustin Hibbits  * Foundation, either version 2 of that License or (at your option) any
190aeed3e9SJustin Hibbits  * later version.
200aeed3e9SJustin Hibbits  *
210aeed3e9SJustin Hibbits  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
220aeed3e9SJustin Hibbits  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
230aeed3e9SJustin Hibbits  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
240aeed3e9SJustin Hibbits  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
250aeed3e9SJustin Hibbits  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
260aeed3e9SJustin Hibbits  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
270aeed3e9SJustin Hibbits  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
280aeed3e9SJustin Hibbits  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
290aeed3e9SJustin Hibbits  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
300aeed3e9SJustin Hibbits  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
310aeed3e9SJustin Hibbits  */
320aeed3e9SJustin Hibbits 
33*852ba100SJustin Hibbits 
340aeed3e9SJustin Hibbits /**************************************************************************//**
350aeed3e9SJustin Hibbits  @File          fm_muram_ext.h
360aeed3e9SJustin Hibbits 
370aeed3e9SJustin Hibbits  @Description   FM MURAM Application Programming Interface.
380aeed3e9SJustin Hibbits *//***************************************************************************/
390aeed3e9SJustin Hibbits #ifndef __FM_MURAM_EXT
400aeed3e9SJustin Hibbits #define __FM_MURAM_EXT
410aeed3e9SJustin Hibbits 
420aeed3e9SJustin Hibbits #include "error_ext.h"
430aeed3e9SJustin Hibbits #include "std_ext.h"
440aeed3e9SJustin Hibbits 
450aeed3e9SJustin Hibbits 
460aeed3e9SJustin Hibbits /**************************************************************************//**
470aeed3e9SJustin Hibbits 
480aeed3e9SJustin Hibbits  @Group         FM_grp Frame Manager API
490aeed3e9SJustin Hibbits 
500aeed3e9SJustin Hibbits  @Description   FM API functions, definitions and enums
510aeed3e9SJustin Hibbits 
520aeed3e9SJustin Hibbits  @{
530aeed3e9SJustin Hibbits *//***************************************************************************/
540aeed3e9SJustin Hibbits 
550aeed3e9SJustin Hibbits /**************************************************************************//**
560aeed3e9SJustin Hibbits  @Group         FM_muram_grp FM MURAM
570aeed3e9SJustin Hibbits 
580aeed3e9SJustin Hibbits  @Description   FM MURAM API functions, definitions and enums
590aeed3e9SJustin Hibbits 
600aeed3e9SJustin Hibbits  @{
610aeed3e9SJustin Hibbits *//***************************************************************************/
620aeed3e9SJustin Hibbits 
630aeed3e9SJustin Hibbits /**************************************************************************//**
64*852ba100SJustin Hibbits  @Group         FM_muram_init_grp FM MURAM Initialization Unit
650aeed3e9SJustin Hibbits 
660aeed3e9SJustin Hibbits  @Description   FM MURAM initialization API functions, definitions and enums
670aeed3e9SJustin Hibbits 
680aeed3e9SJustin Hibbits  @{
690aeed3e9SJustin Hibbits *//***************************************************************************/
700aeed3e9SJustin Hibbits 
710aeed3e9SJustin Hibbits /**************************************************************************//**
720aeed3e9SJustin Hibbits  @Function      FM_MURAM_ConfigAndInit
730aeed3e9SJustin Hibbits 
740aeed3e9SJustin Hibbits  @Description   Creates partition in the MURAM.
750aeed3e9SJustin Hibbits 
760aeed3e9SJustin Hibbits                 The routine returns a handle (descriptor) to the MURAM partition.
770aeed3e9SJustin Hibbits                 This descriptor must be passed as first parameter to all other
780aeed3e9SJustin Hibbits                 FM-MURAM function calls.
790aeed3e9SJustin Hibbits 
800aeed3e9SJustin Hibbits                 No actual initialization or configuration of FM_MURAM hardware is
810aeed3e9SJustin Hibbits                 done by this routine.
820aeed3e9SJustin Hibbits 
830aeed3e9SJustin Hibbits  @Param[in]     baseAddress - Pointer to base of memory mapped FM-MURAM.
840aeed3e9SJustin Hibbits  @Param[in]     size        - Size of the FM-MURAM partition.
850aeed3e9SJustin Hibbits 
860aeed3e9SJustin Hibbits  @Return        Handle to FM-MURAM object, or NULL for Failure.
870aeed3e9SJustin Hibbits *//***************************************************************************/
880aeed3e9SJustin Hibbits t_Handle FM_MURAM_ConfigAndInit(uintptr_t baseAddress, uint32_t size);
890aeed3e9SJustin Hibbits 
900aeed3e9SJustin Hibbits /**************************************************************************//**
910aeed3e9SJustin Hibbits  @Function      FM_MURAM_Free
920aeed3e9SJustin Hibbits 
930aeed3e9SJustin Hibbits  @Description   Frees all resources that were assigned to FM-MURAM module.
940aeed3e9SJustin Hibbits 
950aeed3e9SJustin Hibbits                 Calling this routine invalidates the descriptor.
960aeed3e9SJustin Hibbits 
970aeed3e9SJustin Hibbits  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
980aeed3e9SJustin Hibbits 
990aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
1000aeed3e9SJustin Hibbits *//***************************************************************************/
1010aeed3e9SJustin Hibbits t_Error  FM_MURAM_Free(t_Handle h_FmMuram);
1020aeed3e9SJustin Hibbits 
1030aeed3e9SJustin Hibbits /** @} */ /* end of FM_muram_init_grp group */
1040aeed3e9SJustin Hibbits 
1050aeed3e9SJustin Hibbits 
1060aeed3e9SJustin Hibbits /**************************************************************************//**
107*852ba100SJustin Hibbits  @Group         FM_muram_ctrl_grp FM MURAM Control Unit
1080aeed3e9SJustin Hibbits 
1090aeed3e9SJustin Hibbits  @Description   FM MURAM control API functions, definitions and enums
1100aeed3e9SJustin Hibbits 
1110aeed3e9SJustin Hibbits  @{
1120aeed3e9SJustin Hibbits *//***************************************************************************/
1130aeed3e9SJustin Hibbits 
1140aeed3e9SJustin Hibbits /**************************************************************************//**
1150aeed3e9SJustin Hibbits  @Function      FM_MURAM_AllocMem
1160aeed3e9SJustin Hibbits 
1170aeed3e9SJustin Hibbits  @Description   Allocate some memory from FM-MURAM partition.
1180aeed3e9SJustin Hibbits 
1190aeed3e9SJustin Hibbits  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
1200aeed3e9SJustin Hibbits  @Param[in]     size      - size of the memory to be allocated.
1210aeed3e9SJustin Hibbits  @Param[in]     align     - Alignment of the memory.
1220aeed3e9SJustin Hibbits 
1230aeed3e9SJustin Hibbits  @Return        address of the allocated memory; NULL otherwise.
1240aeed3e9SJustin Hibbits *//***************************************************************************/
1250aeed3e9SJustin Hibbits void  * FM_MURAM_AllocMem(t_Handle h_FmMuram, uint32_t size, uint32_t align);
1260aeed3e9SJustin Hibbits 
1270aeed3e9SJustin Hibbits /**************************************************************************//**
1280aeed3e9SJustin Hibbits  @Function      FM_MURAM_AllocMemForce
1290aeed3e9SJustin Hibbits 
1300aeed3e9SJustin Hibbits  @Description   Allocate some specific memory from FM-MURAM partition (according
1310aeed3e9SJustin Hibbits                 to base).
1320aeed3e9SJustin Hibbits 
1330aeed3e9SJustin Hibbits  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
1340aeed3e9SJustin Hibbits  @Param[in]     base      - the desired base-address to be allocated.
1350aeed3e9SJustin Hibbits  @Param[in]     size      - size of the memory to be allocated.
1360aeed3e9SJustin Hibbits 
1370aeed3e9SJustin Hibbits  @Return        address of the allocated memory; NULL otherwise.
1380aeed3e9SJustin Hibbits *//***************************************************************************/
1390aeed3e9SJustin Hibbits void  * FM_MURAM_AllocMemForce(t_Handle h_FmMuram, uint64_t base, uint32_t size);
1400aeed3e9SJustin Hibbits 
1410aeed3e9SJustin Hibbits /**************************************************************************//**
1420aeed3e9SJustin Hibbits  @Function      FM_MURAM_FreeMem
1430aeed3e9SJustin Hibbits 
1440aeed3e9SJustin Hibbits  @Description   Free an allocated memory from FM-MURAM partition.
1450aeed3e9SJustin Hibbits 
1460aeed3e9SJustin Hibbits  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
1470aeed3e9SJustin Hibbits  @Param[in]     ptr       - A pointer to an allocated memory.
1480aeed3e9SJustin Hibbits 
1490aeed3e9SJustin Hibbits  @Return        E_OK on success; Error code otherwise.
1500aeed3e9SJustin Hibbits *//***************************************************************************/
1510aeed3e9SJustin Hibbits t_Error FM_MURAM_FreeMem(t_Handle h_FmMuram, void *ptr);
1520aeed3e9SJustin Hibbits 
153*852ba100SJustin Hibbits /**************************************************************************//**
154*852ba100SJustin Hibbits  @Function      FM_MURAM_GetFreeMemSize
155*852ba100SJustin Hibbits 
156*852ba100SJustin Hibbits  @Description   Returns the size (in bytes) of free MURAM memory.
157*852ba100SJustin Hibbits 
158*852ba100SJustin Hibbits  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
159*852ba100SJustin Hibbits 
160*852ba100SJustin Hibbits  @Return        Free MURAM memory size in bytes.
161*852ba100SJustin Hibbits *//***************************************************************************/
162*852ba100SJustin Hibbits uint64_t FM_MURAM_GetFreeMemSize(t_Handle h_FmMuram);
163*852ba100SJustin Hibbits 
1640aeed3e9SJustin Hibbits /** @} */ /* end of FM_muram_ctrl_grp group */
1650aeed3e9SJustin Hibbits /** @} */ /* end of FM_muram_grp group */
1660aeed3e9SJustin Hibbits /** @} */ /* end of FM_grp group */
1670aeed3e9SJustin Hibbits 
1680aeed3e9SJustin Hibbits 
1690aeed3e9SJustin Hibbits 
1700aeed3e9SJustin Hibbits #endif /* __FM_MURAM_EXT */
171