2009-10-11 19:43:13 +00:00
|
|
|
/*
|
2010-02-21 07:24:53 +00:00
|
|
|
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio.
|
2009-10-11 19:43:13 +00:00
|
|
|
|
|
|
|
This file is part of ChibiOS/RT.
|
|
|
|
|
|
|
|
ChibiOS/RT is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
ChibiOS/RT is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2010-02-27 08:54:22 +00:00
|
|
|
* @file chmemcore.h
|
2010-02-06 12:31:09 +00:00
|
|
|
* @brief Core memory manager macros and structures.
|
|
|
|
*
|
2009-10-16 17:45:19 +00:00
|
|
|
* @addtogroup memcore
|
2009-10-11 19:43:13 +00:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2010-02-27 08:54:22 +00:00
|
|
|
#ifndef _CHMEMCORE_H_
|
|
|
|
#define _CHMEMCORE_H_
|
2009-10-11 19:43:13 +00:00
|
|
|
|
2009-10-16 17:45:19 +00:00
|
|
|
/**
|
2010-02-06 12:31:09 +00:00
|
|
|
* @brief Memory get function.
|
|
|
|
* @note This type must be assignment compatible with the @p chMemAlloc()
|
|
|
|
* function.
|
2009-10-16 17:45:19 +00:00
|
|
|
*/
|
|
|
|
typedef void *(*memgetfunc_t)(size_t size);
|
|
|
|
|
2009-10-11 19:43:13 +00:00
|
|
|
/**
|
2010-02-06 12:31:09 +00:00
|
|
|
* @brief Alignment mask constant.
|
2009-10-11 19:43:13 +00:00
|
|
|
*/
|
2010-02-16 19:21:42 +00:00
|
|
|
#define MEM_ALIGN_MASK (sizeof(stkalign_t) - 1)
|
2009-10-11 19:43:13 +00:00
|
|
|
|
|
|
|
/**
|
2010-02-06 12:31:09 +00:00
|
|
|
* @brief Alignment helper macro.
|
2009-10-11 19:43:13 +00:00
|
|
|
*/
|
2009-10-16 17:45:19 +00:00
|
|
|
#define MEM_ALIGN_SIZE(p) (((size_t)(p) + MEM_ALIGN_MASK) & ~MEM_ALIGN_MASK)
|
|
|
|
|
|
|
|
/**
|
2010-02-06 12:31:09 +00:00
|
|
|
* @brief Returns whatever a pointer or memory size is aligned to
|
|
|
|
* the type @p align_t.
|
2009-10-16 17:45:19 +00:00
|
|
|
*/
|
|
|
|
#define MEM_IS_ALIGNED(p) (((size_t)(p) & MEM_ALIGN_MASK) == 0)
|
2009-10-11 19:43:13 +00:00
|
|
|
|
2010-09-18 06:48:56 +00:00
|
|
|
#if CH_USE_MEMCORE || defined(__DOXYGEN__)
|
2009-10-17 09:21:59 +00:00
|
|
|
|
2009-10-11 19:43:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2009-10-16 17:45:19 +00:00
|
|
|
void core_init(void);
|
|
|
|
void *chCoreAlloc(size_t size);
|
|
|
|
void *chCoreAllocI(size_t size);
|
2010-05-04 12:31:05 +00:00
|
|
|
size_t chCoreStatus(void);
|
2009-10-11 19:43:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-16 17:45:19 +00:00
|
|
|
#endif /* CH_USE_MEMCORE */
|
2009-10-11 19:43:13 +00:00
|
|
|
|
2010-02-27 08:54:22 +00:00
|
|
|
#endif /* _CHMEMCORE_H_ */
|
2009-10-11 19:43:13 +00:00
|
|
|
|
|
|
|
/** @} */
|