SlideShare a Scribd company logo
Introduction to FreeRTOS V6.0.5
About SwiftACT A Technology services startup company Under establishment Areas of specialties: Mobile telecommunication services development Embedded systems development Types of services: Consultation Managed services Sourcing Training Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
About Me Graduated 2004 ECE, ASU: 5 yrs distinction 6+ years in embedded systems development SDLC, Apps, MW, DD, Porting, ... 4+ years in SW engineering PSP, CMMI, Systematic reuse, ...  4+ years in SW testing IBM certified, ISTQB certified, ... Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
Copyright Materials in this course is the property of Amr Ali Abdel-Naby. Reproduction or transmission of the materials outside  [Customer Name]  in any manner without the copyright owner permission is a law violation. [Customer Name]  is free to use this material as is within its head quarters for noncommercial uses. Snapshots or trademarks used are retained to their original owners. Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
Course Objectives After completing this course, you will: Understand what is FreeRTOS Experience different FreeRTOS services and APIs Understand the porting process of FreeRTOS Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
Course Notes I assume you are familiar with RTOS concepts. I assume you know C. I assume you know 80x86 architecture and assembly. Ask any time. Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
Course References http://www.freertos.org Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3:  Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3:  Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Binary Semaphore Used for mutual exclusion and synchronization Critical Section  Initial count = 1 wait_sem to enter critical section signal_sem to leave critical section Synchronization Initial count = 0 wait_sem to wait signal_sem to signal Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5 HW Device 1 ISR 1 SW Task
Counting Semaphore Used for resource limit and credit tracking Resource limit  Initial count = # of equivalent resources wait_sem to gain access to a resource signal_sem to release a resource Credit tracking Initial count = 0 signal_sem to increment (Credit) wait_sem to consume (Debit) Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Mutex A special type of binary semaphore Preferred over binary semaphore for mutual exclusion Mutex vs. Semaphore Mutex ownership Recursive locking Minimize priority inversion using inheritance protocol Can’t be used from ISRs Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
More About Semaphore/Mutex Same queues’ implementation APIs are used to implement semaphores/mutexes. Their APIs are macros that point to queues’ implementation APIs. Queues and semaphores/mutexes APIs are inter-operable. You should be careful if your are going to do this. Binary semaphore/Mutex  = A queue that can hold 1 item of data size 0 Either full or empty    Binary Counting semaphore = A queue that can hold n items each of data size 0 You can extend their APIs by defining new macros to the queue’s implementation APIs. Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Semaphore/Mutex Management APIs They fall under 4 categories: Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5 Creation vSemaphoreCreateBinary xSemaphoreCreateCounting xSemaphoreCreateMutex xSemaphoreCreateRecursiveMutex Fully Featured xSemaphoreTake xSemaphoreTakeRecursive xSemaphoreGive xSemaphoreGiveRecursive Light Weight xSemaphoreGiveFromISR Alternative xSemaphoreAltTake xSemaphoreAltGive
Creating a Binary Semaphore, vSemaphoreCreateBinary  vSemaphoreCreateBinary(xSemaphoreHandle xSemaphore) xSemaphore: Handle to the created semaphore !NULL if created NULL if failed Note the initial binary semaphore value is 1 Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Creating a Counting Semaphore, xSemaphoreCreateCounting xSemaphoreHandle xSemaphoreCreateCounting(unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount ) uxMaxCount: The maximum count value that can be reached uxInitialCount: The count value assigned to the semaphore when it is created Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Creating a Mutex, xSemaphoreCreateMutex xSemaphoreHandle xSemaphoreCreateMutex(void) Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Creating a Recursive Mutex, xSemaphoreCreateRecursiveMutex  xSemaphoreHandle xSemaphoreCreateRecursiveMutex(void) Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Obtaining a Semaphore/Mutex, xSemaphoreTake xSemaphoreTake(xSemaphoreHandle xSemaphore,  portTickType xBlockTime) xSemaphore: A handle to the semaphore/mutex to be obtained Created with vSemaphoreCreateBinary, xSemaphoreCreateMutex or xSemaphoreCreateCounting xBlockTime: The time in ticks to wait for the semaphore/mutex to become available Return value: pdTRUE if the semaphore/mutex was obtained Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Obtaining a Recursive Mutex, xSemaphoreTakeRecursive xSemaphoreTake(RecursivexSemaphoreHandle xSemaphore,  portTickType xBlockTime) xSemaphore: A handle to the mutex to be obtained Created with xSemaphoreCreaterecursiveMutex xBlockTime: The time in ticks to wait for the mutex to become available Return value: pdTRUE if the mutex was obtained Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Releasing a Semaphore/Mutex, xSemaphoreGive xSemaphoreGive(xSemaphoreHandle xSemaphore) xSemaphore: A handle to the semaphore/mutex to be released Created with vSemaphoreCreateBinary, xSemaphoreCreateMutex or xSemaphoreCreateCounting Return value: pdTRUE if the semaphore/mutex was released Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Releasing a Recursive Mutex, xSemaphoreGiveRecursive xSemaphoreGiveRecursive(xSemaphoreHandle xMutex) xSemaphore: A handle to the mutex to be released Created with xSemaphoreCreaterecursiveMutex Return value: pdTRUE if the mutex was released Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Releasing a Semaphore From ISR, xSemaphoreGiveFromISR xSemaphoreGiveFromISR(xSemaphoreHandle xSemaphore,  signed portBASE_TYPE * pxHigherPriorityTaskWoken) = xSemaphoreGive but used within ISRs  pxTaskWoken : Is set to pdTRUE if releasing caused a higher priority task to unblock A context switch is needed after ISR exits. Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Alternative Obtaining a Semaphore/Mutex, xSemaphoreAltTake xSemaphoreAltTake(xSemaphoreHandle xSemaphore,  portTickType xBlockTime) = xSemaphoreTake but with alternative implementation Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Alternative Releasing a Semaphore/Mutex, xSemaphoreAltGive xSemaphoreAltGive(xSemaphoreHandle xSemaphore) = xSemaphoreGive but with alternative implementation Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
More About Semaphore/Mutex Revisited Always remember that you can extend semaphores/mutexes with queues’ implementation APIs. There is no deletion API!!! Possible candidates that can be used are vQueueDelete and vPortFree. Before using any, you have to check: Configuration for the queue registry functions Port memory management functions Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3:  Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
Lab4: Semaphore/Mutex Management Please follow the instructions in the lab handout Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5

More Related Content

PPTX
FreeRTOS basics (Real time Operating System)
PPT
Free FreeRTOS Course-Task Management
PPTX
FreeRTOS
PDF
Automative basics v3
PPTX
Universal flash storage
PDF
Introduction to FreeRTOS
 
PPTX
AUTOSAR Memory Stcak (MemStack).
PDF
Diagnostic in Adaptive AUTOSAR
FreeRTOS basics (Real time Operating System)
Free FreeRTOS Course-Task Management
FreeRTOS
Automative basics v3
Universal flash storage
Introduction to FreeRTOS
 
AUTOSAR Memory Stcak (MemStack).
Diagnostic in Adaptive AUTOSAR

What's hot (20)

PPTX
Autosar software component
PDF
RTOS - Real Time Operating Systems
PPT
RTOS Basic Concepts
PDF
Autosar Basics hand book_v1
PDF
(C#,멀티쓰레드강좌)쓰레드, STA, MTA개요, 간단한 멀티쓰레드 예제_닷넷,C#,WPF,자마린실무강좌
PPTX
kernels
PPTX
Real time operating systems (rtos) concepts 9
PPTX
Scheduling (sjf, fcfs and round robin
PPTX
Communication model of parallel platforms
PPTX
What is AUTOSAR Development Partnership
PDF
RTOS for Embedded System Design
PDF
Q4.11: Next Gen Mobile Storage – UFS
PPTX
Priority driven scheduling of periodic tasks
PPT
U Boot or Universal Bootloader
PPTX
What is AUTOSAR Communiation Stack
PDF
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
PDF
Virtualization Support in ARMv8+
ODP
Linux Internals - Kernel/Core
PPT
Memory management in linux
PDF
Unit 4 Real Time Operating System
Autosar software component
RTOS - Real Time Operating Systems
RTOS Basic Concepts
Autosar Basics hand book_v1
(C#,멀티쓰레드강좌)쓰레드, STA, MTA개요, 간단한 멀티쓰레드 예제_닷넷,C#,WPF,자마린실무강좌
kernels
Real time operating systems (rtos) concepts 9
Scheduling (sjf, fcfs and round robin
Communication model of parallel platforms
What is AUTOSAR Development Partnership
RTOS for Embedded System Design
Q4.11: Next Gen Mobile Storage – UFS
Priority driven scheduling of periodic tasks
U Boot or Universal Bootloader
What is AUTOSAR Communiation Stack
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
Virtualization Support in ARMv8+
Linux Internals - Kernel/Core
Memory management in linux
Unit 4 Real Time Operating System
Ad

Viewers also liked (20)

PPT
FreeRTOS Course - Queue Management
PDF
Introduction to Embedded Systems a Practical Approach
PPT
PPTX
PPT
Introduction to embedded systems
PPTX
PPT
PPTX
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
PPTX
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
PDF
Introduction to Software Test Automation
PPTX
ISTQB Advanced Test Manager Training 2012 - Testing Process
PPTX
Process synchronization in Operating Systems
PPT
How a Compiler Works ?
PDF
Simulation of SPWM based Z-Source Inverter
PPTX
Arm architecture
PPT
Windows kernel
FreeRTOS Course - Queue Management
Introduction to Embedded Systems a Practical Approach
Introduction to embedded systems
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
Introduction to Software Test Automation
ISTQB Advanced Test Manager Training 2012 - Testing Process
Process synchronization in Operating Systems
How a Compiler Works ?
Simulation of SPWM based Z-Source Inverter
Arm architecture
Windows kernel
Ad

Similar to FreeRTOS Course - Semaphore/Mutex Management (20)

PDF
freertos-proj.pdf
PDF
The Free RTOS kernel By Khaled AMIRAT
PPTX
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PDF
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PDF
Concurrent programming with RTOS
PPTX
PDF
Intro To RTOS by Silicon labs covering fundamentals
PPTX
FreeRTOS introduction
PPTX
RTOS.pptx
PPT
1230 Rtf Final
PDF
Free rtos workshop4@nuu
PPTX
REAL TIME OPERATING SYSTEM
PPTX
Real Time Operating Systems
PPTX
RTOS _Timer , Event, Memory, Device, File & IO Systems Management_10-07-25.pptx
PDF
S emb t13-freertos
PDF
seminarembedded-150504150805-conversion-gate02.pdf
PPT
Embedded systems
PPTX
UNIT -5 EMBEDDED DRIVERS AND APPLICATION PORTING.pptx
PDF
PDF
Lab6 rtos
freertos-proj.pdf
The Free RTOS kernel By Khaled AMIRAT
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
Concurrent programming with RTOS
Intro To RTOS by Silicon labs covering fundamentals
FreeRTOS introduction
RTOS.pptx
1230 Rtf Final
Free rtos workshop4@nuu
REAL TIME OPERATING SYSTEM
Real Time Operating Systems
RTOS _Timer , Event, Memory, Device, File & IO Systems Management_10-07-25.pptx
S emb t13-freertos
seminarembedded-150504150805-conversion-gate02.pdf
Embedded systems
UNIT -5 EMBEDDED DRIVERS AND APPLICATION PORTING.pptx
Lab6 rtos

More from Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation) (6)

PDF
Introduction to state machines in Embedded Software Design
PDF
Embedded linux network device driver development
PPTX
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
Introduction to state machines in Embedded Software Design
Embedded linux network device driver development
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing

FreeRTOS Course - Semaphore/Mutex Management

  • 2. About SwiftACT A Technology services startup company Under establishment Areas of specialties: Mobile telecommunication services development Embedded systems development Types of services: Consultation Managed services Sourcing Training Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 3. About Me Graduated 2004 ECE, ASU: 5 yrs distinction 6+ years in embedded systems development SDLC, Apps, MW, DD, Porting, ... 4+ years in SW engineering PSP, CMMI, Systematic reuse, ... 4+ years in SW testing IBM certified, ISTQB certified, ... Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 4. Copyright Materials in this course is the property of Amr Ali Abdel-Naby. Reproduction or transmission of the materials outside [Customer Name] in any manner without the copyright owner permission is a law violation. [Customer Name] is free to use this material as is within its head quarters for noncommercial uses. Snapshots or trademarks used are retained to their original owners. Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 5. Course Objectives After completing this course, you will: Understand what is FreeRTOS Experience different FreeRTOS services and APIs Understand the porting process of FreeRTOS Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 6. Course Notes I assume you are familiar with RTOS concepts. I assume you know C. I assume you know 80x86 architecture and assembly. Ask any time. Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 7. Course References http://www.freertos.org Introduction to FreeRTOS V6.0.5 Amr Ali Abdel-Naby@2010
  • 8. Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3: Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 9. Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3: Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 10. Binary Semaphore Used for mutual exclusion and synchronization Critical Section Initial count = 1 wait_sem to enter critical section signal_sem to leave critical section Synchronization Initial count = 0 wait_sem to wait signal_sem to signal Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5 HW Device 1 ISR 1 SW Task
  • 11. Counting Semaphore Used for resource limit and credit tracking Resource limit Initial count = # of equivalent resources wait_sem to gain access to a resource signal_sem to release a resource Credit tracking Initial count = 0 signal_sem to increment (Credit) wait_sem to consume (Debit) Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 12. Mutex A special type of binary semaphore Preferred over binary semaphore for mutual exclusion Mutex vs. Semaphore Mutex ownership Recursive locking Minimize priority inversion using inheritance protocol Can’t be used from ISRs Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 13. More About Semaphore/Mutex Same queues’ implementation APIs are used to implement semaphores/mutexes. Their APIs are macros that point to queues’ implementation APIs. Queues and semaphores/mutexes APIs are inter-operable. You should be careful if your are going to do this. Binary semaphore/Mutex = A queue that can hold 1 item of data size 0 Either full or empty  Binary Counting semaphore = A queue that can hold n items each of data size 0 You can extend their APIs by defining new macros to the queue’s implementation APIs. Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 14. Semaphore/Mutex Management APIs They fall under 4 categories: Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5 Creation vSemaphoreCreateBinary xSemaphoreCreateCounting xSemaphoreCreateMutex xSemaphoreCreateRecursiveMutex Fully Featured xSemaphoreTake xSemaphoreTakeRecursive xSemaphoreGive xSemaphoreGiveRecursive Light Weight xSemaphoreGiveFromISR Alternative xSemaphoreAltTake xSemaphoreAltGive
  • 15. Creating a Binary Semaphore, vSemaphoreCreateBinary vSemaphoreCreateBinary(xSemaphoreHandle xSemaphore) xSemaphore: Handle to the created semaphore !NULL if created NULL if failed Note the initial binary semaphore value is 1 Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 16. Creating a Counting Semaphore, xSemaphoreCreateCounting xSemaphoreHandle xSemaphoreCreateCounting(unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount ) uxMaxCount: The maximum count value that can be reached uxInitialCount: The count value assigned to the semaphore when it is created Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 17. Creating a Mutex, xSemaphoreCreateMutex xSemaphoreHandle xSemaphoreCreateMutex(void) Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 18. Creating a Recursive Mutex, xSemaphoreCreateRecursiveMutex xSemaphoreHandle xSemaphoreCreateRecursiveMutex(void) Return value: !NULL if created NULL if failed Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 19. Obtaining a Semaphore/Mutex, xSemaphoreTake xSemaphoreTake(xSemaphoreHandle xSemaphore, portTickType xBlockTime) xSemaphore: A handle to the semaphore/mutex to be obtained Created with vSemaphoreCreateBinary, xSemaphoreCreateMutex or xSemaphoreCreateCounting xBlockTime: The time in ticks to wait for the semaphore/mutex to become available Return value: pdTRUE if the semaphore/mutex was obtained Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 20. Obtaining a Recursive Mutex, xSemaphoreTakeRecursive xSemaphoreTake(RecursivexSemaphoreHandle xSemaphore, portTickType xBlockTime) xSemaphore: A handle to the mutex to be obtained Created with xSemaphoreCreaterecursiveMutex xBlockTime: The time in ticks to wait for the mutex to become available Return value: pdTRUE if the mutex was obtained Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 21. Releasing a Semaphore/Mutex, xSemaphoreGive xSemaphoreGive(xSemaphoreHandle xSemaphore) xSemaphore: A handle to the semaphore/mutex to be released Created with vSemaphoreCreateBinary, xSemaphoreCreateMutex or xSemaphoreCreateCounting Return value: pdTRUE if the semaphore/mutex was released Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 22. Releasing a Recursive Mutex, xSemaphoreGiveRecursive xSemaphoreGiveRecursive(xSemaphoreHandle xMutex) xSemaphore: A handle to the mutex to be released Created with xSemaphoreCreaterecursiveMutex Return value: pdTRUE if the mutex was released Otherwise pdFALSE Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 23. Releasing a Semaphore From ISR, xSemaphoreGiveFromISR xSemaphoreGiveFromISR(xSemaphoreHandle xSemaphore, signed portBASE_TYPE * pxHigherPriorityTaskWoken) = xSemaphoreGive but used within ISRs pxTaskWoken : Is set to pdTRUE if releasing caused a higher priority task to unblock A context switch is needed after ISR exits. Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 24. Alternative Obtaining a Semaphore/Mutex, xSemaphoreAltTake xSemaphoreAltTake(xSemaphoreHandle xSemaphore, portTickType xBlockTime) = xSemaphoreTake but with alternative implementation Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 25. Alternative Releasing a Semaphore/Mutex, xSemaphoreAltGive xSemaphoreAltGive(xSemaphoreHandle xSemaphore) = xSemaphoreGive but with alternative implementation Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 26. More About Semaphore/Mutex Revisited Always remember that you can extend semaphores/mutexes with queues’ implementation APIs. There is no deletion API!!! Possible candidates that can be used are vQueueDelete and vPortFree. Before using any, you have to check: Configuration for the queue registry functions Port memory management functions Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 27. Outline Introduction to FreeRTOS Lab 0: Getting Started Kernel Structure Lab 1: Kernel Structure Task Management Lab 2: Task Management Queue Management Lab 3: Queue Management Semaphore/Mutex Management Lab 4: Semaphore/Mutex Management Co-routine Management Lab 5: Co-routine Management Advanced Features Lab 6: Advanced Features Porting FreeRTOS Lab 7: Porting FreeRTOS Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5
  • 28. Lab4: Semaphore/Mutex Management Please follow the instructions in the lab handout Amr Ali Abdel-Naby@2010 Introduction to FreeRTOS V6.0.5

Editor's Notes

  • #2: * 07/16/96 * ##
  • #14: Queues macros are in semphr.h while queues implementation is in queue.c. * 07/16/96 * ##
  • #15: Note that there is no deletion API * 07/16/96 * ##
  • #19: Note that xSemaphoreCreateMutex and xSemaphoreCreateRecursiveMutex are implemented as the same!! * 07/16/96 * ##