FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2007 Threads] Pointer to a semaphore handle?Posted by Scott Nortman on January 19, 2007 Will the following work:
/*------- start of c file ----------*/
static xSemaphoreHandle *localSemPtr;
void init_peripheral( xSemaphoreHandle *semPtr ){
____localSemPtr = semPtr;
____vSemaphoreCreateBinary( *localSemPtr );
}
ISR( INT0_vect ){
____xSemaphoreGiveFromISR( *localSemPtr );
}
RE: Pointer to a semaphore handle?Posted by Richard on January 20, 2007 If I can interpret what it is you are trying to do.
You have a peripheral that uses a semaphore, presumably for synchronisation. The semaphore is created externally from the peripheral driver and a reference to it is passed into the peripheral driver.
I think this should work, but you can pass semaphore handles by copy. You don't need to pass them by pointer.
static xSemaphoreHandle xLocalSem;
void init_peripheral( xSemaphoreHandle xSem ) { ____xLocalSem = xSem; }
ISR( INT0_vect ) { ____xSemaphoreGiveFromISR( xLocalSem ); }
This is because the semaphore handle is only a reference to the semaphore. It is not the entire semaphore structure.
Take a look at the files serial.c and serialISR.c in the FreeRTOS\Demo\ARM7_STR75x_GCC\serial\serial.c file for an example that uses queue handles (same thing really). The function vConfigureQueues() is used to pass the handles to queues created in the serial.c file into the serialISR.c file. The latter file contains the ISR function in which the queues are used.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|