morning_enr6U 发表于 2019-11-28 09:33:27

RTX5的动态内存管理模块使用问题

使用MDK建立的RTX5工程,#include "rtx_lib.h"这个头文件是不是只有RTX5的OS组件才用的到,用户代码不需要使用这个头文件呢?
我在测试407工程中外部SRAM的动态内存分配时,用到:osRtxMemoryInit 函数,但是需要包含 "rtx_lib.h" 头文件,MDK工程报错说
找不到这个头文件,但是工程里面RTX5的组件都有包含这个头文件,他们却不报错,奇怪了!

eric2013 发表于 2019-11-28 15:49:06

供用户调用的是这些:


morning_enr6U 发表于 2019-11-28 16:43:28

原来这些都在 cmsis_os2.h header file 里面。

/// Allocate a memory block from a Memory Pool.
/// \param   mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
/// \param   timeout       \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
/// \return address of the allocated memory block or NULL in case of no memory is available.
void *osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);

/// Return an allocated memory block back to a Memory Pool.
/// \param   mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
/// \param   block         address of the allocated memory block to be returned to the memory pool.
/// \return status code that indicates the execution status of the function.
osStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);

/// Get maximum number of memory blocks in a Memory Pool.
/// \param   mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
/// \return maximum number of memory blocks.
uint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id);

/// Get memory block size in a Memory Pool.
/// \param   mp_id         memory pool ID obtained by \ref osMemoryPoolNew.
/// \return memory block size in bytes.
uint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id);

================================================
* ----------------------------------------------------------------------
*
* $Date:      18. June 2018
* $Revision:    V2.1.3
*
* Project:      CMSIS-RTOS2 API
* Title:      cmsis_os2.h header file
*
* Version 2.1.3
*    Additional functions allowed to be called from Interrupt Service Routines:
*    - osThreadGetId
* Version 2.1.2
*    Additional functions allowed to be called from Interrupt Service Routines:
*    - osKernelGetInfo, osKernelGetState
* Version 2.1.1
*    Additional functions allowed to be called from Interrupt Service Routines:
*    - osKernelGetTickCount, osKernelGetTickFreq
*    Changed Kernel Tick type to uint32_t:
*    - updated: osKernelGetTickCount, osDelayUntil
* Version 2.1.0
*    Support for critical and uncritical sections (nesting safe):
*    - updated: osKernelLock, osKernelUnlock
*    - added: osKernelRestoreLock
*    Updated Thread and Event Flags:
*    - changed flags parameter and return type from int32_t to uint32_t
* Version 2.0.0
*    Initial Release
*---------------------------------------------------------------------------*/

页: [1]
查看完整版本: RTX5的动态内存管理模块使用问题