CC26xx Driver Library
[aux_smph.h] AUX Semaphore

Functions

static void AUXSMPHAcquire (uint32_t ui32Semaphore)
 Acquire an AUX semaphore. More...
 
static bool AUXSMPHTryAcquire (uint32_t ui32Semaphore)
 Try to acquire an AUX semaphore. More...
 
static void AUXSMPHRelease (uint32_t ui32Semaphore)
 Release an AUX semaphore by System CPU master. More...
 

Detailed Description

Function Documentation

§ AUXSMPHAcquire()

static void AUXSMPHAcquire ( uint32_t  ui32Semaphore)
inlinestatic

Acquire an AUX semaphore.

This function acquires the given AUX semaphore, blocking the call until the semaphore is available.

Note
The semaphore can also be acquired by the dedicated Sensor Controller. The System CPU master can thus be competing for the shared resource, i.e. the specified semaphore.
Parameters
ui32Semaphoreis the semaphore number.
Returns
None
See also
AUXSMPHTryAcquire(), AUXSMPHRelease()
124 {
125  // Check the arguments.
126  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
127  (ui32Semaphore == AUX_SMPH_1) ||
128  (ui32Semaphore == AUX_SMPH_2) ||
129  (ui32Semaphore == AUX_SMPH_3) ||
130  (ui32Semaphore == AUX_SMPH_4) ||
131  (ui32Semaphore == AUX_SMPH_5) ||
132  (ui32Semaphore == AUX_SMPH_6) ||
133  (ui32Semaphore == AUX_SMPH_7));
134 
135  // Wait for semaphore to be released such that it can be claimed
136  // Semaphore register reads 1 when lock was acquired otherwise 0
137  // (i.e. AUX_SMPH_CLAIMED).
138  while(HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore) ==
140  {
141  }
142 }
#define AUX_SMPH_2
Definition: aux_smph.h:83
#define AUX_SMPH_3
Definition: aux_smph.h:84
#define AUX_SMPH_6
Definition: aux_smph.h:87
#define AUX_SMPH_1
Definition: aux_smph.h:82
#define AUX_SMPH_CLAIMED
Definition: aux_smph.h:73
#define AUX_SMPH_7
Definition: aux_smph.h:88
#define ASSERT(expr)
Definition: debug.h:71
#define AUX_SMPH_0
Definition: aux_smph.h:81
#define AUX_SMPH_4
Definition: aux_smph.h:85
#define AUX_SMPH_5
Definition: aux_smph.h:86

§ AUXSMPHRelease()

static void AUXSMPHRelease ( uint32_t  ui32Semaphore)
inlinestatic

Release an AUX semaphore by System CPU master.

This function releases the given AUX semaphore.

Note
It is up to the application to provide the convention for clearing semaphore.
The semaphore can also be acquired by the dedicated Sensor Controller. The System CPU master can thus be competing for the shared resource, i.e. the specified semaphore.
Parameters
ui32Semaphoreis the semaphore number.
Returns
None
See also
AUXSMPHAcquire(), AUXSMPHTryAcquire()
222 {
223  // Check the arguments.
224  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
225  (ui32Semaphore == AUX_SMPH_1) ||
226  (ui32Semaphore == AUX_SMPH_2) ||
227  (ui32Semaphore == AUX_SMPH_3) ||
228  (ui32Semaphore == AUX_SMPH_4) ||
229  (ui32Semaphore == AUX_SMPH_5) ||
230  (ui32Semaphore == AUX_SMPH_6) ||
231  (ui32Semaphore == AUX_SMPH_7));
232 
233  // No check before release. It is up to the application to provide the
234  // conventions for who and when a semaphore can be released.
235  HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore) =
237 }
#define AUX_SMPH_2
Definition: aux_smph.h:83
#define AUX_SMPH_3
Definition: aux_smph.h:84
#define AUX_SMPH_6
Definition: aux_smph.h:87
#define AUX_SMPH_1
Definition: aux_smph.h:82
#define AUX_SMPH_FREE
Definition: aux_smph.h:72
#define AUX_SMPH_7
Definition: aux_smph.h:88
#define ASSERT(expr)
Definition: debug.h:71
#define AUX_SMPH_0
Definition: aux_smph.h:81
#define AUX_SMPH_4
Definition: aux_smph.h:85
#define AUX_SMPH_5
Definition: aux_smph.h:86

§ AUXSMPHTryAcquire()

static bool AUXSMPHTryAcquire ( uint32_t  ui32Semaphore)
inlinestatic

Try to acquire an AUX semaphore.

This function tries to acquire the given AUX semaphore, if the semaphore could not be claimed the function returns false.

Note
The semaphore can also be acquired by the dedicated Sensor Controller. The System CPU master can thus be competing for the shared resource, i.e. the specified semaphore.
Parameters
ui32Semaphoreis the semaphore number.
Returns
Returns true if semaphore was acquired, false otherwise
See also
AUXSMPHAcquire(), AUXSMPHRelease()
172 {
173  uint32_t ui32SemaReg;
174 
175  // Check the arguments.
176  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
177  (ui32Semaphore == AUX_SMPH_1) ||
178  (ui32Semaphore == AUX_SMPH_2) ||
179  (ui32Semaphore == AUX_SMPH_3) ||
180  (ui32Semaphore == AUX_SMPH_4) ||
181  (ui32Semaphore == AUX_SMPH_5) ||
182  (ui32Semaphore == AUX_SMPH_6) ||
183  (ui32Semaphore == AUX_SMPH_7));
184 
185  // AUX Semaphore register reads 1 if lock was acquired
186  // (i.e. SMPH_FREE when read) but subsequent reads will read 0.
187  ui32SemaReg = HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore);
188 
189  return (ui32SemaReg == AUX_SMPH_FREE);
190 }
#define AUX_SMPH_2
Definition: aux_smph.h:83
#define AUX_SMPH_3
Definition: aux_smph.h:84
#define AUX_SMPH_6
Definition: aux_smph.h:87
#define AUX_SMPH_1
Definition: aux_smph.h:82
#define AUX_SMPH_FREE
Definition: aux_smph.h:72
#define AUX_SMPH_7
Definition: aux_smph.h:88
#define ASSERT(expr)
Definition: debug.h:71
#define AUX_SMPH_0
Definition: aux_smph.h:81
#define AUX_SMPH_4
Definition: aux_smph.h:85
#define AUX_SMPH_5
Definition: aux_smph.h:86

Macro Definition Documentation

§ AUX_SMPH_0

#define AUX_SMPH_0   0

§ AUX_SMPH_1

#define AUX_SMPH_1   1

§ AUX_SMPH_2

#define AUX_SMPH_2   2

§ AUX_SMPH_3

#define AUX_SMPH_3   3

§ AUX_SMPH_4

#define AUX_SMPH_4   4

§ AUX_SMPH_5

#define AUX_SMPH_5   5

§ AUX_SMPH_6

#define AUX_SMPH_6   6

§ AUX_SMPH_7

#define AUX_SMPH_7   7

§ AUX_SMPH_CLAIMED

#define AUX_SMPH_CLAIMED   0x00000000

Referenced by AUXSMPHAcquire().

§ AUX_SMPH_FREE

#define AUX_SMPH_FREE   0x00000001