Fixed bug #1141.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14022 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
483f99db86
commit
89717aa637
|
@ -135,7 +135,8 @@ static dyn_element_t *dyn_list_unlink(dyn_element_t *element,
|
||||||
#if CH_FACTORY_REQUIRES_HEAP || defined(__DOXYGEN__)
|
#if CH_FACTORY_REQUIRES_HEAP || defined(__DOXYGEN__)
|
||||||
static dyn_element_t *dyn_create_object_heap(const char *name,
|
static dyn_element_t *dyn_create_object_heap(const char *name,
|
||||||
dyn_list_t *dlp,
|
dyn_list_t *dlp,
|
||||||
size_t size) {
|
size_t size,
|
||||||
|
unsigned align) {
|
||||||
dyn_element_t *dep;
|
dyn_element_t *dep;
|
||||||
|
|
||||||
chDbgCheck(name != NULL);
|
chDbgCheck(name != NULL);
|
||||||
|
@ -147,7 +148,7 @@ static dyn_element_t *dyn_create_object_heap(const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocating space for the new buffer object.*/
|
/* Allocating space for the new buffer object.*/
|
||||||
dep = (dyn_element_t *)chHeapAlloc(NULL, size);
|
dep = (dyn_element_t *)chHeapAllocAligned(NULL, size, align);
|
||||||
if (dep == NULL) {
|
if (dep == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +422,8 @@ dyn_buffer_t *chFactoryCreateBuffer(const char *name, size_t size) {
|
||||||
|
|
||||||
dbp = (dyn_buffer_t *)dyn_create_object_heap(name,
|
dbp = (dyn_buffer_t *)dyn_create_object_heap(name,
|
||||||
&ch_factory.buf_list,
|
&ch_factory.buf_list,
|
||||||
size);
|
size,
|
||||||
|
CH_HEAP_ALIGNMENT);
|
||||||
if (dbp != NULL) {
|
if (dbp != NULL) {
|
||||||
/* Initializing buffer object data.*/
|
/* Initializing buffer object data.*/
|
||||||
memset((void *)(dbp + 1), 0, size);
|
memset((void *)(dbp + 1), 0, size);
|
||||||
|
@ -582,7 +584,8 @@ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n) {
|
||||||
dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
|
dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
|
||||||
&ch_factory.mbx_list,
|
&ch_factory.mbx_list,
|
||||||
sizeof (dyn_mailbox_t) +
|
sizeof (dyn_mailbox_t) +
|
||||||
(n * sizeof (msg_t)));
|
(n * sizeof (msg_t)),
|
||||||
|
CH_HEAP_ALIGNMENT);
|
||||||
if (dmp != NULL) {
|
if (dmp != NULL) {
|
||||||
/* Initializing mailbox object data.*/
|
/* Initializing mailbox object data.*/
|
||||||
chMBObjectInit(&dmp->mbx, (msg_t *)(dmp + 1), n);
|
chMBObjectInit(&dmp->mbx, (msg_t *)(dmp + 1), n);
|
||||||
|
@ -662,21 +665,29 @@ dyn_objects_fifo_t *chFactoryCreateObjectsFIFO(const char *name,
|
||||||
size_t objsize,
|
size_t objsize,
|
||||||
size_t objn,
|
size_t objn,
|
||||||
unsigned objalign) {
|
unsigned objalign) {
|
||||||
|
size_t size1, size2;
|
||||||
dyn_objects_fifo_t *dofp;
|
dyn_objects_fifo_t *dofp;
|
||||||
|
|
||||||
F_LOCK();
|
F_LOCK();
|
||||||
|
|
||||||
|
/* Enforcing alignment for the objects array.*/
|
||||||
|
objsize = MEM_ALIGN_NEXT(objsize, objalign);
|
||||||
|
size1 = MEM_ALIGN_NEXT(sizeof (dyn_objects_fifo_t) + (objn * sizeof (msg_t)),
|
||||||
|
objalign);
|
||||||
|
size2 = objn * objsize;
|
||||||
|
|
||||||
|
/* Allocating the FIFO object with messages buffer and objects buffer.*/
|
||||||
dofp = (dyn_objects_fifo_t *)dyn_create_object_heap(name,
|
dofp = (dyn_objects_fifo_t *)dyn_create_object_heap(name,
|
||||||
&ch_factory.fifo_list,
|
&ch_factory.fifo_list,
|
||||||
sizeof (dyn_objects_fifo_t) +
|
size1 + size2,
|
||||||
(objn * sizeof (msg_t)) +
|
objalign);
|
||||||
(objn * objsize));
|
|
||||||
if (dofp != NULL) {
|
if (dofp != NULL) {
|
||||||
msg_t *msgbuf = (msg_t *)(dofp + 1);
|
msg_t *msgbuf = (msg_t *)(dofp + 1);
|
||||||
|
uint8_t *objbuf = (uint8_t *)dofp + size1;
|
||||||
|
|
||||||
/* Initializing mailbox object data.*/
|
/* Initializing mailbox object data.*/
|
||||||
chFifoObjectInitAligned(&dofp->fifo, objsize, objn, objalign,
|
chFifoObjectInitAligned(&dofp->fifo, objsize, objn, objalign,
|
||||||
(void *)&msgbuf[objn], msgbuf);
|
(void *)objbuf, msgbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
F_UNLOCK();
|
F_UNLOCK();
|
||||||
|
@ -755,7 +766,8 @@ dyn_pipe_t *chFactoryCreatePipe(const char *name, size_t size) {
|
||||||
|
|
||||||
dpp = (dyn_pipe_t *)dyn_create_object_heap(name,
|
dpp = (dyn_pipe_t *)dyn_create_object_heap(name,
|
||||||
&ch_factory.pipe_list,
|
&ch_factory.pipe_list,
|
||||||
sizeof (dyn_pipe_t) + size);
|
sizeof (dyn_pipe_t) + size,
|
||||||
|
CH_HEAP_ALIGNMENT);
|
||||||
if (dpp != NULL) {
|
if (dpp != NULL) {
|
||||||
/* Initializing mailbox object data.*/
|
/* Initializing mailbox object data.*/
|
||||||
chPipeObjectInit(&dpp->pipe, (uint8_t *)(dpp + 1), size);
|
chPipeObjectInit(&dpp->pipe, (uint8_t *)(dpp + 1), size);
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** Next ***
|
*** Next ***
|
||||||
- FIX: Fixed chsnprintf() sign mode/filler mode conflict (bug #1140)
|
|
||||||
- NEW: Added time conversion macros and functions for monotonic time stamps
|
- NEW: Added time conversion macros and functions for monotonic time stamps
|
||||||
- NEW: Added support for STM32WB55.
|
- NEW: Added support for STM32WB55.
|
||||||
- NEW: Added chscanf() and buffered streams, contributed by Alex Lewontin.
|
- NEW: Added chscanf() and buffered streams, contributed by Alex Lewontin.
|
||||||
|
@ -129,6 +128,10 @@
|
||||||
MEMS Accelerometers.
|
MEMS Accelerometers.
|
||||||
- NEW: Safer messages mechanism for sandboxes (to be backported to 20.3.1).
|
- NEW: Safer messages mechanism for sandboxes (to be backported to 20.3.1).
|
||||||
- NEW: Added latency measurement test application.
|
- NEW: Added latency measurement test application.
|
||||||
|
- FIX: Fixed Heap allocation of aligned FIFO objects in chFactory (bug #1141)
|
||||||
|
(backported to 20.3.3)(backported to 19.1.5).
|
||||||
|
- FIX: Fixed chsnprintf() sign mode/filler mode conflict (bug #1140)
|
||||||
|
(backported to 20.3.3).
|
||||||
- FIX: Fixed GCC 10 causes warning in factory module (bug #1139)
|
- FIX: Fixed GCC 10 causes warning in factory module (bug #1139)
|
||||||
(backported to 20.3.3)(backported to 19.1.5).
|
(backported to 20.3.3)(backported to 19.1.5).
|
||||||
- FIX: Fixed STM32H7xx Missing CRC RCC macros (bug #1137)
|
- FIX: Fixed STM32H7xx Missing CRC RCC macros (bug #1137)
|
||||||
|
|
Loading…
Reference in New Issue