|
2 | 2 | #include <stddef.h> |
3 | 3 | #include <stdio.h> |
4 | 4 | #include "espnet.h" |
| 5 | +#include "freertos/FreeRTOS.h" |
| 6 | +#include "freertos/semphr.h" |
5 | 7 |
|
6 | 8 | // Stub functions, to know which functions need to be implemented for OS |
7 | 9 | // functionality. |
@@ -70,27 +72,17 @@ static void *_mutex_create(void) { |
70 | 72 | return NULL; |
71 | 73 | } |
72 | 74 |
|
73 | | -// simplified mutex to continue with call stack |
74 | | -unsigned int mutx = 0; |
75 | | - |
76 | 75 | static void *_recursive_mutex_create(void) { |
77 | | - printf("called: _recursive_mutex_create. ret=%p\n", &mutx); |
78 | | - return &mutx; |
| 76 | + return xSemaphoreCreateRecursiveMutex(); |
79 | 77 | } |
80 | 78 | static void _mutex_delete(void *mutex) { |
81 | | - printf("called: _mutex_delete: %p\n", mutex); |
| 79 | + return vSemaphoreDelete(mutex); |
82 | 80 | } |
83 | 81 | static int32_t _mutex_lock(void *mutex) { |
84 | | - printf("called: _mutex_lock: %p (%d)\n", mutex, *(unsigned int*)mutex); |
85 | | - // simplified mutex to continue with call stack |
86 | | - *(unsigned int*)mutex = 1; |
87 | | - return 0; |
| 82 | + return (int32_t)xSemaphoreTakeRecursive(mutex, portMAX_DELAY); |
88 | 83 | } |
89 | 84 | static int32_t _mutex_unlock(void *mutex) { |
90 | | - printf("called: _mutex_unlock: %p (%d)\n", mutex, *(unsigned int*)mutex); |
91 | | - // simplified mutex to continue with call stack |
92 | | - *(unsigned int*)mutex = 0; |
93 | | - return 0; |
| 85 | + return (int32_t)xSemaphoreGiveRecursive(mutex); |
94 | 86 | } |
95 | 87 | static void * _queue_create(uint32_t queue_len, uint32_t item_size) { |
96 | 88 | printf("called: _queue_create\n"); |
|
0 commit comments