Fixed a name conflict with unistd.h.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15641 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
3565192a5d
commit
0bbb9100a9
|
@ -53,11 +53,11 @@
|
|||
* Defaults on the best synchronization mechanism available.
|
||||
*/
|
||||
#if (CH_CFG_USE_MUTEXES == TRUE) || defined(__DOXYGEN__)
|
||||
#define F_LOCK() chMtxLock(&ch_factory.mtx)
|
||||
#define F_UNLOCK() chMtxUnlock(&ch_factory.mtx)
|
||||
#define FACTORY_LOCK() chMtxLock(&ch_factory.mtx)
|
||||
#define FACTORY_UNLOCK() chMtxUnlock(&ch_factory.mtx)
|
||||
#else
|
||||
#define F_LOCK() (void) chSemWait(&ch_factory.sem)
|
||||
#define F_UNLOCK() chSemSignal(&ch_factory.sem)
|
||||
#define FACTORY_LOCK() (void) chSemWait(&ch_factory.sem)
|
||||
#define FACTORY_UNLOCK() chSemSignal(&ch_factory.sem)
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -301,7 +301,7 @@ registered_object_t *chFactoryRegisterObject(const char *name,
|
|||
void *objp) {
|
||||
registered_object_t *rop;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
rop = (registered_object_t *)dyn_create_object_pool(name,
|
||||
&ch_factory.obj_list,
|
||||
|
@ -311,7 +311,7 @@ registered_object_t *chFactoryRegisterObject(const char *name,
|
|||
rop->objp = objp;
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return rop;
|
||||
}
|
||||
|
@ -332,11 +332,11 @@ registered_object_t *chFactoryRegisterObject(const char *name,
|
|||
registered_object_t *chFactoryFindObject(const char *name) {
|
||||
registered_object_t *rop;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
rop = (registered_object_t *)dyn_find_object(name, &ch_factory.obj_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return rop;
|
||||
}
|
||||
|
@ -357,20 +357,20 @@ registered_object_t *chFactoryFindObject(const char *name) {
|
|||
registered_object_t *chFactoryFindObjectByPointer(void *objp) {
|
||||
registered_object_t *rop = (registered_object_t *)ch_factory.obj_list.next;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
while ((void *)rop != (void *)&ch_factory.obj_list) {
|
||||
if (rop->objp == objp) {
|
||||
rop->element.refs++;
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return rop;
|
||||
}
|
||||
rop = (registered_object_t *)rop->element.next;
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -389,13 +389,13 @@ registered_object_t *chFactoryFindObjectByPointer(void *objp) {
|
|||
*/
|
||||
void chFactoryReleaseObject(registered_object_t *rop) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_pool(&rop->element,
|
||||
&ch_factory.obj_list,
|
||||
&ch_factory.obj_pool);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_OBJECTS_REGISTRY == TRUE */
|
||||
|
||||
|
@ -418,7 +418,7 @@ void chFactoryReleaseObject(registered_object_t *rop) {
|
|||
dyn_buffer_t *chFactoryCreateBuffer(const char *name, size_t size) {
|
||||
dyn_buffer_t *dbp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dbp = (dyn_buffer_t *)dyn_create_object_heap(name,
|
||||
&ch_factory.buf_list,
|
||||
|
@ -429,7 +429,7 @@ dyn_buffer_t *chFactoryCreateBuffer(const char *name, size_t size) {
|
|||
memset((void *)(dbp + 1), 0, size);
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dbp;
|
||||
}
|
||||
|
@ -450,11 +450,11 @@ dyn_buffer_t *chFactoryCreateBuffer(const char *name, size_t size) {
|
|||
dyn_buffer_t *chFactoryFindBuffer(const char *name) {
|
||||
dyn_buffer_t *dbp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dbp = (dyn_buffer_t *)dyn_find_object(name, &ch_factory.buf_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dbp;
|
||||
}
|
||||
|
@ -471,11 +471,11 @@ dyn_buffer_t *chFactoryFindBuffer(const char *name) {
|
|||
*/
|
||||
void chFactoryReleaseBuffer(dyn_buffer_t *dbp) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_heap(&dbp->element, &ch_factory.buf_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_GENERIC_BUFFERS = TRUE */
|
||||
|
||||
|
@ -498,7 +498,7 @@ void chFactoryReleaseBuffer(dyn_buffer_t *dbp) {
|
|||
dyn_semaphore_t *chFactoryCreateSemaphore(const char *name, cnt_t n) {
|
||||
dyn_semaphore_t *dsp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dsp = (dyn_semaphore_t *)dyn_create_object_pool(name,
|
||||
&ch_factory.sem_list,
|
||||
|
@ -508,7 +508,7 @@ dyn_semaphore_t *chFactoryCreateSemaphore(const char *name, cnt_t n) {
|
|||
chSemObjectInit(&dsp->sem, n);
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dsp;
|
||||
}
|
||||
|
@ -529,11 +529,11 @@ dyn_semaphore_t *chFactoryCreateSemaphore(const char *name, cnt_t n) {
|
|||
dyn_semaphore_t *chFactoryFindSemaphore(const char *name) {
|
||||
dyn_semaphore_t *dsp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dsp = (dyn_semaphore_t *)dyn_find_object(name, &ch_factory.sem_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dsp;
|
||||
}
|
||||
|
@ -550,13 +550,13 @@ dyn_semaphore_t *chFactoryFindSemaphore(const char *name) {
|
|||
*/
|
||||
void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_pool(&dsp->element,
|
||||
&ch_factory.sem_list,
|
||||
&ch_factory.sem_pool);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_SEMAPHORES = TRUE */
|
||||
|
||||
|
@ -579,7 +579,7 @@ void chFactoryReleaseSemaphore(dyn_semaphore_t *dsp) {
|
|||
dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n) {
|
||||
dyn_mailbox_t *dmp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dmp = (dyn_mailbox_t *)dyn_create_object_heap(name,
|
||||
&ch_factory.mbx_list,
|
||||
|
@ -591,7 +591,7 @@ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n) {
|
|||
chMBObjectInit(&dmp->mbx, (msg_t *)(dmp + 1), n);
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dmp;
|
||||
}
|
||||
|
@ -612,11 +612,11 @@ dyn_mailbox_t *chFactoryCreateMailbox(const char *name, size_t n) {
|
|||
dyn_mailbox_t *chFactoryFindMailbox(const char *name) {
|
||||
dyn_mailbox_t *dmp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dmp = (dyn_mailbox_t *)dyn_find_object(name, &ch_factory.mbx_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dmp;
|
||||
}
|
||||
|
@ -633,11 +633,11 @@ dyn_mailbox_t *chFactoryFindMailbox(const char *name) {
|
|||
*/
|
||||
void chFactoryReleaseMailbox(dyn_mailbox_t *dmp) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_heap(&dmp->element, &ch_factory.mbx_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_MAILBOXES = TRUE */
|
||||
|
||||
|
@ -668,7 +668,7 @@ dyn_objects_fifo_t *chFactoryCreateObjectsFIFO(const char *name,
|
|||
size_t size1, size2;
|
||||
dyn_objects_fifo_t *dofp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
/* Enforcing alignment for the objects array.*/
|
||||
objsize = MEM_ALIGN_NEXT(objsize, objalign);
|
||||
|
@ -690,7 +690,7 @@ dyn_objects_fifo_t *chFactoryCreateObjectsFIFO(const char *name,
|
|||
(void *)objbuf, msgbuf);
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dofp;
|
||||
}
|
||||
|
@ -712,11 +712,11 @@ dyn_objects_fifo_t *chFactoryCreateObjectsFIFO(const char *name,
|
|||
dyn_objects_fifo_t *chFactoryFindObjectsFIFO(const char *name) {
|
||||
dyn_objects_fifo_t *dofp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dofp = (dyn_objects_fifo_t *)dyn_find_object(name, &ch_factory.fifo_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dofp;
|
||||
}
|
||||
|
@ -733,11 +733,11 @@ dyn_objects_fifo_t *chFactoryFindObjectsFIFO(const char *name) {
|
|||
*/
|
||||
void chFactoryReleaseObjectsFIFO(dyn_objects_fifo_t *dofp) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_heap(&dofp->element, &ch_factory.fifo_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_OBJ_FIFOS = TRUE */
|
||||
|
||||
|
@ -762,7 +762,7 @@ void chFactoryReleaseObjectsFIFO(dyn_objects_fifo_t *dofp) {
|
|||
dyn_pipe_t *chFactoryCreatePipe(const char *name, size_t size) {
|
||||
dyn_pipe_t *dpp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dpp = (dyn_pipe_t *)dyn_create_object_heap(name,
|
||||
&ch_factory.pipe_list,
|
||||
|
@ -773,7 +773,7 @@ dyn_pipe_t *chFactoryCreatePipe(const char *name, size_t size) {
|
|||
chPipeObjectInit(&dpp->pipe, (uint8_t *)(dpp + 1), size);
|
||||
}
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dpp;
|
||||
}
|
||||
|
@ -795,11 +795,11 @@ dyn_pipe_t *chFactoryCreatePipe(const char *name, size_t size) {
|
|||
dyn_pipe_t *chFactoryFindPipe(const char *name) {
|
||||
dyn_pipe_t *dpp;
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dpp = (dyn_pipe_t *)dyn_find_object(name, &ch_factory.pipe_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
|
||||
return dpp;
|
||||
}
|
||||
|
@ -816,11 +816,11 @@ dyn_pipe_t *chFactoryFindPipe(const char *name) {
|
|||
*/
|
||||
void chFactoryReleasePipe(dyn_pipe_t *dpp) {
|
||||
|
||||
F_LOCK();
|
||||
FACTORY_LOCK();
|
||||
|
||||
dyn_release_object_heap(&dpp->element, &ch_factory.pipe_list);
|
||||
|
||||
F_UNLOCK();
|
||||
FACTORY_UNLOCK();
|
||||
}
|
||||
#endif /* CH_CFG_FACTORY_PIPES = TRUE */
|
||||
|
||||
|
|
Loading…
Reference in New Issue