Developer World
Spresense SDK Library v3.3.0-375c679
gnssram.h
1/****************************************************************************
2 * arch/arm/include/cxd56xx/gnssram.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership. The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __ARCH_ARM_INCLUDE_CXD56XX_GNSSRAM_H
22#define __ARCH_ARM_INCLUDE_CXD56XX_GNSSRAM_H
23
24/****************************************************************************
25 * Included Files
26 ****************************************************************************/
27
28#include <nuttx/config.h>
29
30#include <nuttx/compiler.h>
31#include <sys/types.h>
32#include <stdint.h>
33
34#ifndef __ASSEMBLY__
35#ifdef __cplusplus
36#define EXTERN extern "C"
37extern "C"
38{
39#else
40#define EXTERN extern
41#endif
42
43/****************************************************************************
44 * Pre-processor Definitions
45 ****************************************************************************/
46
47#define SECTION_GNSSRAM_TEXT ".gnssram.text"
48#define SECTION_GNSSRAM_DATA ".gnssram.data"
49#define SECTION_GNSSRAM_BSS ".gnssram.bss"
50
51/* Locate code and data into GNSS RAM */
52
53#ifdef CONFIG_CXD56_GNSS_RAM
54# define GNSSRAM_CODE locate_code(SECTION_GNSSRAM_TEXT)
55# define GNSSRAM_DATA locate_data(SECTION_GNSSRAM_DATA)
56# define GNSSRAM_BSS locate_data(SECTION_GNSSRAM_BSS)
57#else
58# define GNSSRAM_CODE
59# define GNSSRAM_DATA
60# define GNSSRAM_BSS
61#endif
62
63/****************************************************************************
64 * Public Functions Prototypes
65 ****************************************************************************/
66
67/****************************************************************************
68 * Name: up_gnssram_initialize
69 *
70 * Description:
71 * Initialize the GNSS heap.
72 *
73 ****************************************************************************/
74
75void up_gnssram_initialize(void);
76
77/****************************************************************************
78 * Name: up_gnssram_uninitialize
79 *
80 * Description:
81 * Uninitialize the GNSS heap.
82 *
83 ****************************************************************************/
84
85void up_gnssram_uninitialize(void);
86
87/****************************************************************************
88 * Name: up_gnssram_malloc
89 *
90 * Description:
91 * Allocate memory from the GNSS heap.
92 *
93 ****************************************************************************/
94
95void *up_gnssram_malloc(size_t size);
96
97/****************************************************************************
98 * Name: up_gnssram_calloc
99 *
100 * Description:
101 * Calculates the size of the allocation and allocate memory from
102 * the GNSS heap.
103 *
104 ****************************************************************************/
105
106void *up_gnssram_calloc(size_t n, size_t elem_size);
107
108/****************************************************************************
109 * Name: up_gnssram_realloc
110 *
111 * Description:
112 * Reallocate memory from the GNSS heap.
113 *
114 ****************************************************************************/
115
116void *up_gnssram_realloc(void *ptr, size_t size);
117
118/****************************************************************************
119 * Name: up_gnssram_zalloc
120 *
121 * Description:
122 * Allocate and zero memory from the GNSS heap.
123 *
124 ****************************************************************************/
125
126void *up_gnssram_zalloc(size_t size);
127
128/****************************************************************************
129 * Name: up_gnssram_free
130 *
131 * Description:
132 * Free memory from the GNSS heap.
133 *
134 ****************************************************************************/
135
136void up_gnssram_free(void *mem);
137
138/****************************************************************************
139 * Name: up_gnssram_memalign
140 *
141 * Description:
142 * memalign requests more than enough space from malloc, finds a region
143 * within that chunk that meets the alignment request and then frees any
144 * leading or trailing space.
145 *
146 * The alignment argument must be a power of two (not checked). 8-byte
147 * alignment is guaranteed by normal malloc calls.
148 *
149 ****************************************************************************/
150
151void *up_gnssram_memalign(size_t alignment, size_t size);
152
153/****************************************************************************
154 * Name: up_gnssram_heapmember
155 *
156 * Description:
157 * Check if an address lies in the GNSS heap.
158 *
159 * Parameters:
160 * mem - The address to check
161 *
162 * Return Value:
163 * true if the address is a member of the GNSS heap. false if not
164 *
165 ****************************************************************************/
166
167bool up_gnssram_heapmember(void *mem);
168
169/****************************************************************************
170 * Name: up_gnssram_mallinfo
171 *
172 * Description:
173 * mallinfo returns a copy of updated current heap information for the
174 * GNSS heap.
175 *
176 ****************************************************************************/
177
178struct mallinfo up_gnssram_mallinfo(void);
179
180#undef EXTERN
181#if defined(__cplusplus)
182}
183#endif
184#endif /* __ASSEMBLY__ */
185
186#endif /* __ARCH_ARM_INCLUDE_CXD56XX_GNSSRAM_H */