mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 02:18:54 +00:00
138 lines
5.3 KiB
C
138 lines
5.3 KiB
C
/*
|
|
* FreeRTOS Kernel V10.4.6
|
|
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
* this software and associated documentation files (the "Software"), to deal in
|
|
* the Software without restriction, including without limitation the rights to
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
* subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
* copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* https://www.FreeRTOS.org
|
|
* https://github.com/FreeRTOS
|
|
*
|
|
*/
|
|
|
|
/*-----------------------------------------------------------
|
|
* Portable layer API. Each function must be defined for each port.
|
|
*----------------------------------------------------------*/
|
|
|
|
#ifndef PORTABLE_H
|
|
#define PORTABLE_H
|
|
|
|
#ifdef ESP_PLATFORM
|
|
#include "freertos/portmacro.h"
|
|
#else
|
|
#include "portmacro.h"
|
|
#endif
|
|
|
|
#if portBYTE_ALIGNMENT == 32
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x001f )
|
|
#elif portBYTE_ALIGNMENT == 16
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x000f )
|
|
#elif portBYTE_ALIGNMENT == 8
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
|
#elif portBYTE_ALIGNMENT == 4
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
|
|
#elif portBYTE_ALIGNMENT == 2
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
|
|
#elif portBYTE_ALIGNMENT == 1
|
|
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
|
|
#else /* if portBYTE_ALIGNMENT == 32 */
|
|
#error "Invalid portBYTE_ALIGNMENT definition"
|
|
#endif /* if portBYTE_ALIGNMENT == 32 */
|
|
|
|
/* *INDENT-OFF* */
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/* *INDENT-ON* */
|
|
|
|
#ifdef configUSE_FREERTOS_PROVIDED_HEAP
|
|
|
|
/* Used by heap_5.c to define the start address and size of each memory region
|
|
* that together comprise the total FreeRTOS heap space. */
|
|
typedef struct HeapRegion
|
|
{
|
|
uint8_t * pucStartAddress;
|
|
size_t xSizeInBytes;
|
|
} HeapRegion_t;
|
|
|
|
/* Used to pass information about the heap out of vPortGetHeapStats(). */
|
|
typedef struct xHeapStats
|
|
{
|
|
size_t xAvailableHeapSpaceInBytes; /* The total heap size currently available - this is the sum of all the free blocks, not the largest block that can be allocated. */
|
|
size_t xSizeOfLargestFreeBlockInBytes; /* The maximum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
|
size_t xSizeOfSmallestFreeBlockInBytes; /* The minimum size, in bytes, of all the free blocks within the heap at the time vPortGetHeapStats() is called. */
|
|
size_t xNumberOfFreeBlocks; /* The number of free memory blocks within the heap at the time vPortGetHeapStats() is called. */
|
|
size_t xMinimumEverFreeBytesRemaining; /* The minimum amount of total free memory (sum of all free blocks) there has been in the heap since the system booted. */
|
|
size_t xNumberOfSuccessfulAllocations; /* The number of calls to pvPortMalloc() that have returned a valid memory block. */
|
|
size_t xNumberOfSuccessfulFrees; /* The number of calls to vPortFree() that has successfully freed a block of memory. */
|
|
} HeapStats_t;
|
|
|
|
/*
|
|
* Used to define multiple heap regions for use by heap_5.c. This function
|
|
* must be called before any calls to pvPortMalloc() - not creating a task,
|
|
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
|
* pvPortMalloc being called.
|
|
*
|
|
* pxHeapRegions passes in an array of HeapRegion_t structures - each of which
|
|
* defines a region of memory that can be used as the heap. The array is
|
|
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
|
* with the lowest start address must appear first in the array.
|
|
*/
|
|
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
|
|
|
|
/*
|
|
* Returns a HeapStats_t structure filled with information about the current
|
|
* heap state.
|
|
*/
|
|
void vPortGetHeapStats( HeapStats_t * pxHeapStats );
|
|
|
|
/*
|
|
* Map to the memory management routines required for the port.
|
|
*/
|
|
void * pvPortMalloc( size_t xSize );
|
|
void vPortFree( void * pv );
|
|
void vPortInitialiseBlocks( void );
|
|
size_t xPortGetFreeHeapSize( void );
|
|
size_t xPortGetMinimumEverFreeHeapSize( void );
|
|
|
|
#else // configUSE_FREERTOS_PROVIDED_HEAP
|
|
|
|
/*
|
|
* Map to the memory management routines required for the port.
|
|
*
|
|
* Note that libc standard malloc/free are also available for
|
|
* non-FreeRTOS-specific code, and behave the same as
|
|
* pvPortMalloc()/vPortFree().
|
|
*/
|
|
#define pvPortMalloc malloc
|
|
#define vPortFree free
|
|
#define xPortGetFreeHeapSize esp_get_free_heap_size
|
|
#define xPortGetMinimumEverFreeHeapSize esp_get_minimum_free_heap_size
|
|
|
|
#endif
|
|
void vPortEndScheduler( void );
|
|
|
|
/* *INDENT-OFF* */
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
/* *INDENT-ON* */
|
|
|
|
#endif /* PORTABLE_H */
|