File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333*/
3434#define EXTRACT_BIT (byte , bit_index ) ((byte >> (bit_index)) & 0x01)
3535
36+ /**
37+ * Macro for returning the min of two numbers
38+ * @param a first number
39+ * @param b second number
40+ */
41+ #define min (a , b ) \
42+ ({ \
43+ __typeof__(a) _a = (a); \
44+ __typeof__(b) _b = (b); \
45+ _a < _b ? _a : _b; \
46+ })
47+
3648void endian_swap (void * ptr , int size );
3749
3850/// @brief Reverses the bit order of a byte
Original file line number Diff line number Diff line change 1+ #ifndef __U_MUTEX_H
2+ #define __U_MUTEX_H
3+
4+ #include "tx_api.h"
5+ #include "u_general.h"
6+ #include "u_debug.h"
7+ #include <stdint.h>
8+ #include <stdbool.h>
9+
10+ #define MUTEX_WAIT_TIME TX_WAIT_FOREVER
11+
12+ typedef struct {
13+ /* PUBLIC: Mutex Configuration Settings */
14+ /* Set these when defining an instance of this struct. */
15+ const CHAR * name ; /* Name of Mutex */
16+ const UINT priority_inherit ; /* Specifies if the mutex supports priority inheritance. See page 55 of the "Azure RTOS ThreadX User Guide". */
17+
18+ /* PRIVATE: Internal implementation - DO NOT ACCESS DIRECTLY */
19+ /* (should only be accessed by functions in u_mutexes.c) */
20+ TX_MUTEX _TX_MUTEX ;
21+ } mutex_t ;
22+
23+ /* API */
24+ uint8_t mutexes_init (); // Initializes all mutexes set up in u_mutexes.c
25+ uint8_t mutex_get (mutex_t * mutex ); // Gets a mutex.
26+ uint8_t mutex_put (mutex_t * mutex ); // Puts a mutex.
27+
28+ #endif /* u_mutex.h */
You can’t perform that action at this time.
0 commit comments