STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
freertos_mpool.h
Go to the documentation of this file.
1
/* --------------------------------------------------------------------------
2
* Copyright (c) 2013-2020 Arm Limited. All rights reserved.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*
6
* Licensed under the Apache License, Version 2.0 (the License); you may
7
* not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
14
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*
18
* Name: freertos_mpool.h
19
* Purpose: CMSIS RTOS2 wrapper for FreeRTOS
20
*
21
*---------------------------------------------------------------------------*/
22
23
#ifndef FREERTOS_MPOOL_H_
24
#define FREERTOS_MPOOL_H_
25
26
#include <stdint.h>
27
#include "
FreeRTOS.h
"
28
#include "
semphr.h
"
29
30
/* Memory Pool implementation definitions */
31
#define MPOOL_STATUS 0x5EED0000U
32
33
/* Memory Block header */
34
typedef
struct
{
35
void
*
next
;
/* Pointer to next block */
36
}
MemPoolBlock_t
;
37
38
/* Memory Pool control block */
39
typedef
struct
MemPoolDef_t
{
40
MemPoolBlock_t
*
head
;
/* Pointer to head block */
41
SemaphoreHandle_t
sem
;
/* Pool semaphore handle */
42
uint8_t *
mem_arr
;
/* Pool memory array */
43
uint32_t
mem_sz
;
/* Pool memory array size */
44
const
char
*
name
;
/* Pointer to name string */
45
uint32_t
bl_sz
;
/* Size of a single block */
46
uint32_t
bl_cnt
;
/* Number of blocks */
47
uint32_t
n
;
/* Block allocation index */
48
volatile
uint32_t
status
;
/* Object status flags */
49
#if (configSUPPORT_STATIC_ALLOCATION == 1)
50
StaticSemaphore_t
mem_sem;
/* Semaphore object memory */
51
#endif
52
}
MemPool_t
;
53
54
/* No need to hide static object type, just align to coding style */
55
#define StaticMemPool_t MemPool_t
56
57
/* Define memory pool control block size */
58
#define MEMPOOL_CB_SIZE (sizeof(StaticMemPool_t))
59
60
/* Define size of the byte array required to create count of blocks of given size */
61
#define MEMPOOL_ARR_SIZE(bl_count, bl_size) (((((bl_size) + (4 - 1)) / 4) * 4)*(bl_count))
62
63
#endif
/* FREERTOS_MPOOL_H_ */
FreeRTOS.h
StaticSemaphore_t
StaticQueue_t StaticSemaphore_t
Definition
FreeRTOS.h:1367
MemPool_t
struct MemPoolDef_t MemPool_t
semphr.h
SemaphoreHandle_t
QueueHandle_t SemaphoreHandle_t
Definition
semphr.h:38
MemPoolBlock_t
Definition
freertos_mpool.h:34
MemPoolBlock_t::next
void * next
Definition
freertos_mpool.h:35
MemPoolDef_t
Definition
freertos_mpool.h:39
MemPoolDef_t::n
uint32_t n
Definition
freertos_mpool.h:47
MemPoolDef_t::mem_arr
uint8_t * mem_arr
Definition
freertos_mpool.h:42
MemPoolDef_t::bl_sz
uint32_t bl_sz
Definition
freertos_mpool.h:45
MemPoolDef_t::sem
SemaphoreHandle_t sem
Definition
freertos_mpool.h:41
MemPoolDef_t::bl_cnt
uint32_t bl_cnt
Definition
freertos_mpool.h:46
MemPoolDef_t::mem_sz
uint32_t mem_sz
Definition
freertos_mpool.h:43
MemPoolDef_t::head
MemPoolBlock_t * head
Definition
freertos_mpool.h:40
MemPoolDef_t::status
volatile uint32_t status
Definition
freertos_mpool.h:48
MemPoolDef_t::name
const char * name
Definition
freertos_mpool.h:44
firmware
Flight_Computer
Middlewares
Third_Party
FreeRTOS
Source
CMSIS_RTOS_V2
freertos_mpool.h
Generated by
1.15.0