xref: /freebsd/sys/contrib/ncsw/inc/Peripherals/fm_muram_ext.h (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /**************************************************************************//**
34  @File          fm_muram_ext.h
35 
36  @Description   FM MURAM Application Programming Interface.
37 *//***************************************************************************/
38 #ifndef __FM_MURAM_EXT
39 #define __FM_MURAM_EXT
40 
41 #include "error_ext.h"
42 #include "std_ext.h"
43 
44 
45 /**************************************************************************//**
46 
47  @Group         FM_grp Frame Manager API
48 
49  @Description   FM API functions, definitions and enums
50 
51  @{
52 *//***************************************************************************/
53 
54 /**************************************************************************//**
55  @Group         FM_muram_grp FM MURAM
56 
57  @Description   FM MURAM API functions, definitions and enums
58 
59  @{
60 *//***************************************************************************/
61 
62 /**************************************************************************//**
63  @Group         FM_muram_init_grp FM MURAM Initialization
64 
65  @Description   FM MURAM initialization API functions, definitions and enums
66 
67  @{
68 *//***************************************************************************/
69 
70 /**************************************************************************//**
71  @Function      FM_MURAM_ConfigAndInit
72 
73  @Description   Creates partition in the MURAM.
74 
75                 The routine returns a handle (descriptor) to the MURAM partition.
76                 This descriptor must be passed as first parameter to all other
77                 FM-MURAM function calls.
78 
79                 No actual initialization or configuration of FM_MURAM hardware is
80                 done by this routine.
81 
82  @Param[in]     baseAddress - Pointer to base of memory mapped FM-MURAM.
83  @Param[in]     size        - Size of the FM-MURAM partition.
84 
85  @Return        Handle to FM-MURAM object, or NULL for Failure.
86 *//***************************************************************************/
87 t_Handle FM_MURAM_ConfigAndInit(uintptr_t baseAddress, uint32_t size);
88 
89 /**************************************************************************//**
90  @Function      FM_MURAM_Free
91 
92  @Description   Frees all resources that were assigned to FM-MURAM module.
93 
94                 Calling this routine invalidates the descriptor.
95 
96  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
97 
98  @Return        E_OK on success; Error code otherwise.
99 *//***************************************************************************/
100 t_Error  FM_MURAM_Free(t_Handle h_FmMuram);
101 
102 /** @} */ /* end of FM_muram_init_grp group */
103 
104 
105 /**************************************************************************//**
106  @Group         FM_muram_ctrl_grp FM MURAM Control
107 
108  @Description   FM MURAM control API functions, definitions and enums
109 
110  @{
111 *//***************************************************************************/
112 
113 /**************************************************************************//**
114  @Function      FM_MURAM_AllocMem
115 
116  @Description   Allocate some memory from FM-MURAM partition.
117 
118  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
119  @Param[in]     size      - size of the memory to be allocated.
120  @Param[in]     align     - Alignment of the memory.
121 
122  @Return        address of the allocated memory; NULL otherwise.
123 *//***************************************************************************/
124 void  * FM_MURAM_AllocMem(t_Handle h_FmMuram, uint32_t size, uint32_t align);
125 
126 /**************************************************************************//**
127  @Function      FM_MURAM_AllocMemForce
128 
129  @Description   Allocate some specific memory from FM-MURAM partition (according
130                 to base).
131 
132  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
133  @Param[in]     base      - the desired base-address to be allocated.
134  @Param[in]     size      - size of the memory to be allocated.
135 
136  @Return        address of the allocated memory; NULL otherwise.
137 *//***************************************************************************/
138 void  * FM_MURAM_AllocMemForce(t_Handle h_FmMuram, uint64_t base, uint32_t size);
139 
140 /**************************************************************************//**
141  @Function      FM_MURAM_FreeMem
142 
143  @Description   Free an allocated memory from FM-MURAM partition.
144 
145  @Param[in]     h_FmMuram - FM-MURAM module descriptor.
146  @Param[in]     ptr       - A pointer to an allocated memory.
147 
148  @Return        E_OK on success; Error code otherwise.
149 *//***************************************************************************/
150 t_Error FM_MURAM_FreeMem(t_Handle h_FmMuram, void *ptr);
151 
152 /** @} */ /* end of FM_muram_ctrl_grp group */
153 /** @} */ /* end of FM_muram_grp group */
154 /** @} */ /* end of FM_grp group */
155 
156 
157 
158 #endif /* __FM_MURAM_EXT */
159