Merged another patch to the C++ wrapper.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5036 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
aaa126da62
commit
739e24c329
|
@ -23,7 +23,7 @@
|
|||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value>-j</value>
|
||||
<value>-j1</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Initializes an empty memory pool.
|
||||
* @note The size is internally aligned to be a multiple of the
|
||||
* @p stkalign_t type size.
|
||||
*
|
||||
* @param[out] mp pointer to a @p MemoryPool structure
|
||||
* @param[in] size the size of the objects contained in this memory pool,
|
||||
|
|
|
@ -47,6 +47,16 @@ namespace chibios_rt {
|
|||
chSysUnlock();
|
||||
}
|
||||
|
||||
void System::lockFromIsr(void) {
|
||||
|
||||
chSysLockFromIsr();
|
||||
}
|
||||
|
||||
void System::unlockFromIsr(void) {
|
||||
|
||||
chSysUnlockFromIsr();
|
||||
}
|
||||
|
||||
systime_t System::getTime(void) {
|
||||
|
||||
return chTimeNow();
|
||||
|
@ -813,6 +823,13 @@ namespace chibios_rt {
|
|||
chPoolInit(&pool, size, provider);
|
||||
}
|
||||
|
||||
MemoryPool::MemoryPool(size_t size, memgetfunc_t provider, void* p, size_t n) {
|
||||
|
||||
chPoolInit(&pool, size, provider);
|
||||
chPoolLoadArray(&pool, p, n);
|
||||
}
|
||||
|
||||
|
||||
void MemoryPool::loadArray(void *p, size_t n) {
|
||||
|
||||
chPoolLoadArray(&pool, p, n);
|
||||
|
@ -820,12 +837,12 @@ namespace chibios_rt {
|
|||
|
||||
void *MemoryPool::allocI(void) {
|
||||
|
||||
return chPoolAlloc(&pool);
|
||||
return chPoolAllocI(&pool);
|
||||
}
|
||||
|
||||
void *MemoryPool::alloc(void) {
|
||||
|
||||
return chPoolAllocI(&pool);
|
||||
return chPoolAlloc(&pool);
|
||||
}
|
||||
|
||||
void MemoryPool::free(void *objp) {
|
||||
|
|
|
@ -72,6 +72,36 @@ namespace chibios_rt {
|
|||
*/
|
||||
static void unlock(void);
|
||||
|
||||
/**
|
||||
* @brief Enters the kernel lock mode from within an interrupt handler.
|
||||
* @note This API may do nothing on some architectures, it is required
|
||||
* because on ports that support preemptable interrupt handlers
|
||||
* it is required to raise the interrupt mask to the same level of
|
||||
* the system mutual exclusion zone.<br>
|
||||
* It is good practice to invoke this API before invoking any I-class
|
||||
* syscall from an interrupt handler.
|
||||
* @note This API must be invoked exclusively from interrupt handlers.
|
||||
*
|
||||
* @special
|
||||
*/
|
||||
static void lockFromIsr(void);
|
||||
|
||||
/**
|
||||
* @brief Leaves the kernel lock mode from within an interrupt handler.
|
||||
*
|
||||
* @note This API may do nothing on some architectures, it is required
|
||||
* because on ports that support preemptable interrupt handlers
|
||||
* it is required to raise the interrupt mask to the same level of
|
||||
* the system mutual exclusion zone.<br>
|
||||
* It is good practice to invoke this API after invoking any I-class
|
||||
* syscall from an interrupt handler.
|
||||
* @note This API must be invoked exclusively from interrupt handlers.
|
||||
*
|
||||
* @special
|
||||
*/
|
||||
static void unlockFromIsr(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Returns the system time as system ticks.
|
||||
* @note The system tick time interval is implementation dependent.
|
||||
|
@ -2004,10 +2034,33 @@ namespace chibios_rt {
|
|||
/**
|
||||
* @brief MemoryPool constructor.
|
||||
*
|
||||
* @param[in] size the size of the objects contained in this memory pool,
|
||||
* the minimum accepted size is the size of a pointer to
|
||||
* void.
|
||||
* @param[in] provider memory provider function for the memory pool or
|
||||
* @p NULL if the pool is not allowed to grow
|
||||
* automatically
|
||||
*
|
||||
* @init
|
||||
*/
|
||||
MemoryPool(size_t size, memgetfunc_t provider);
|
||||
|
||||
/**
|
||||
* @brief MemoryPool constructor.
|
||||
*
|
||||
* @param[in] size the size of the objects contained in this memory pool,
|
||||
* the minimum accepted size is the size of a pointer to
|
||||
* void.
|
||||
* @param[in] provider memory provider function for the memory pool or
|
||||
* @p NULL if the pool is not allowed to grow
|
||||
* automatically
|
||||
* @param[in] p pointer to the array first element
|
||||
* @param[in] n number of elements in the array
|
||||
*
|
||||
* @init
|
||||
*/
|
||||
MemoryPool(size_t size, memgetfunc_t provider, void* p, size_t n);
|
||||
|
||||
/**
|
||||
* @brief Loads a memory pool with an array of static objects.
|
||||
* @pre The memory pool must be already been initialized.
|
||||
|
|
Loading…
Reference in New Issue