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

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()
126 {
127  // Check the arguments.
128  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
129  (ui32Semaphore == AUX_SMPH_1) ||
130  (ui32Semaphore == AUX_SMPH_2) ||
131  (ui32Semaphore == AUX_SMPH_3) ||
132  (ui32Semaphore == AUX_SMPH_4) ||
133  (ui32Semaphore == AUX_SMPH_5) ||
134  (ui32Semaphore == AUX_SMPH_6) ||
135  (ui32Semaphore == AUX_SMPH_7));
136 
137  // Wait for semaphore to be released such that it can be claimed
138  // Semaphore register reads 1 when lock was acquired otherwise 0
139  // (i.e. AUX_SMPH_CLAIMED).
140  while(HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore) ==
142  {
143  }
144 }
#define AUX_SMPH_2
Definition: aux_smph.h:85
#define AUX_SMPH_3
Definition: aux_smph.h:86
#define AUX_SMPH_6
Definition: aux_smph.h:89
#define AUX_SMPH_1
Definition: aux_smph.h:84
#define AUX_SMPH_CLAIMED
Definition: aux_smph.h:75
#define AUX_SMPH_7
Definition: aux_smph.h:90
#define ASSERT(expr)
Definition: debug.h:73
#define AUX_SMPH_0
Definition: aux_smph.h:83
#define AUX_SMPH_4
Definition: aux_smph.h:87
#define AUX_SMPH_5
Definition: aux_smph.h:88
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()
224 {
225  // Check the arguments.
226  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
227  (ui32Semaphore == AUX_SMPH_1) ||
228  (ui32Semaphore == AUX_SMPH_2) ||
229  (ui32Semaphore == AUX_SMPH_3) ||
230  (ui32Semaphore == AUX_SMPH_4) ||
231  (ui32Semaphore == AUX_SMPH_5) ||
232  (ui32Semaphore == AUX_SMPH_6) ||
233  (ui32Semaphore == AUX_SMPH_7));
234 
235  // No check before release. It is up to the application to provide the
236  // conventions for who and when a semaphore can be released.
237  HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore) =
239 }
#define AUX_SMPH_2
Definition: aux_smph.h:85
#define AUX_SMPH_3
Definition: aux_smph.h:86
#define AUX_SMPH_6
Definition: aux_smph.h:89
#define AUX_SMPH_1
Definition: aux_smph.h:84
#define AUX_SMPH_FREE
Definition: aux_smph.h:74
#define AUX_SMPH_7
Definition: aux_smph.h:90
#define ASSERT(expr)
Definition: debug.h:73
#define AUX_SMPH_0
Definition: aux_smph.h:83
#define AUX_SMPH_4
Definition: aux_smph.h:87
#define AUX_SMPH_5
Definition: aux_smph.h:88
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()
174 {
175  uint32_t ui32SemaReg;
176 
177  // Check the arguments.
178  ASSERT((ui32Semaphore == AUX_SMPH_0) ||
179  (ui32Semaphore == AUX_SMPH_1) ||
180  (ui32Semaphore == AUX_SMPH_2) ||
181  (ui32Semaphore == AUX_SMPH_3) ||
182  (ui32Semaphore == AUX_SMPH_4) ||
183  (ui32Semaphore == AUX_SMPH_5) ||
184  (ui32Semaphore == AUX_SMPH_6) ||
185  (ui32Semaphore == AUX_SMPH_7));
186 
187  // AUX Semaphore register reads 1 if lock was acquired
188  // (i.e. SMPH_FREE when read) but subsequent reads will read 0.
189  ui32SemaReg = HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 + 4 * ui32Semaphore);
190 
191  return (ui32SemaReg == AUX_SMPH_FREE);
192 }
#define AUX_SMPH_2
Definition: aux_smph.h:85
#define AUX_SMPH_3
Definition: aux_smph.h:86
#define AUX_SMPH_6
Definition: aux_smph.h:89
#define AUX_SMPH_1
Definition: aux_smph.h:84
#define AUX_SMPH_FREE
Definition: aux_smph.h:74
#define AUX_SMPH_7
Definition: aux_smph.h:90
#define ASSERT(expr)
Definition: debug.h:73
#define AUX_SMPH_0
Definition: aux_smph.h:83
#define AUX_SMPH_4
Definition: aux_smph.h:87
#define AUX_SMPH_5
Definition: aux_smph.h:88

Macro Definition Documentation

#define AUX_SMPH_0   0
#define AUX_SMPH_1   1
#define AUX_SMPH_2   2
#define AUX_SMPH_3   3
#define AUX_SMPH_4   4
#define AUX_SMPH_5   5
#define AUX_SMPH_6   6
#define AUX_SMPH_7   7
#define AUX_SMPH_CLAIMED   0x00000000

Referenced by AUXSMPHAcquire().

#define AUX_SMPH_FREE   0x00000001