CC13xx Driver Library
[adi.h] Analog to Digital Interface

Functions

static void ADI8RegWrite (uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
 Write an 8 bit value to a register in an ADI slave. More...
 
static void ADI16RegWrite (uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Val)
 Write a 16 bit value to 2 registers in the ADI slave. More...
 
static void ADI32RegWrite (uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Val)
 Write a 32 bit value to 4 registers in the ADI slave. More...
 
static uint32_t ADI8RegRead (uint32_t ui32Base, uint32_t ui32Reg)
 Read the value of an 8 bit register in the ADI slave. More...
 
static uint32_t ADI16RegRead (uint32_t ui32Base, uint32_t ui32Reg)
 Read the value in a 16 bit register. More...
 
static uint32_t ADI32RegRead (uint32_t ui32Base, uint32_t ui32Reg)
 Read the value in a 32 bit register. More...
 
static void ADI8BitsSet (uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
 Set specific bits in a single 8 bit ADI register. More...
 
static void ADI16BitsSet (uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Val)
 Set specific bits in 2 x 8 bit ADI slave registers. More...
 
static void ADI32BitsSet (uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Val)
 Set specific bits in 4 x 8 bit ADI slave registers. More...
 
static void ADI8BitsClear (uint32_t ui32Base, uint32_t ui32Reg, uint8_t ui8Val)
 Clear specific bits in an 8 bit ADI register. More...
 
static void ADI16BitsClear (uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Val)
 Clear specific bits in two 8 bit ADI register. More...
 
static void ADI32BitsClear (uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Val)
 Clear specific bits in four 8 bit ADI register. More...
 
static void ADI4SetValBit (uint32_t ui32Base, uint32_t ui32Reg, bool bWriteHigh, uint8_t ui8Mask, uint8_t ui8Val)
 Set a value on any 4 bits inside an 8 bit register in the ADI slave. More...
 
static void ADI8SetValBit (uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Mask, uint16_t ui16Val)
 Set a value on any bits inside an 8 bit register in the ADI slave. More...
 
static void ADI16SetValBit (uint32_t ui32Base, uint32_t ui32Reg, uint32_t ui32Mask, uint32_t ui32Val)
 Set a value on any bits inside an 2 x 8 bit register aligned on a half-word (byte) boundary in the ADI slave. More...
 
void SafeHapiVoid (FPTR_VOID_VOID_T fPtr)
 
void SafeHapiAuxAdiSelect (FPTR_VOID_UINT8_T fPtr, uint8_t ut8Signal)
 

Detailed Description

Introduction


API

The API functions can be grouped like this:

Write:

Read:

Function Documentation

static void ADI16BitsClear ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint16_t  ui16Val 
)
inlinestatic

Clear specific bits in two 8 bit ADI register.

This function will clear bits in 2 registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to clear bits in 2 consecutive 8 bit registers in the ADI slave. Only bits in the selected registers are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base registers to clear the bits in.
ui16Valis the 16 bit one-hot encoded value specifying which bits to clear in the registers.
Returns
None
See also
ADI8BitsClear(), ADI32BitsClear()
602 {
603  uint32_t ui32RegOffset;
604 
605  // Check the arguments.
606  ASSERT(ADIBaseValid(ui32Base));
607  ASSERT(ui32Reg < ADI_SLAVE_REGS);
608 
609  // Get the correct address of the first register used for setting bits
610  // in the ADI slave.
611  ui32RegOffset = ADI_O_CLR;
612 
613  // Set the selected bits.
614  if (ui32Base==AUX_ADI4_BASE) {
615  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + (ui32Reg & 0xFE), ui16Val, 2);
616  } else {
617  HWREGH(ui32Base + ui32RegOffset + (ui32Reg & 0xFE)) = ui16Val;
618  }
619 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI16BitsSet ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint16_t  ui16Val 
)
inlinestatic

Set specific bits in 2 x 8 bit ADI slave registers.

This function will set bits in 2 registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to set bits in 2 consecutive 8 bit registers in the ADI slave. Only bits in the selected registers are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base register to assert the bits in.
ui16Valis the 16 bit one-hot encoded value specifying which bits to set in the registers.
Returns
None
See also
ADI8BitsSet(), ADI32BitsSet()
449 {
450  uint32_t ui32RegOffset;
451 
452  // Check the arguments.
453  ASSERT(ADIBaseValid(ui32Base));
454  ASSERT(ui32Reg < ADI_SLAVE_REGS);
455 
456  // Get the correct address of the first register used for setting bits
457  // in the ADI slave.
458  ui32RegOffset = ADI_O_SET;
459 
460  // Set the selected bits.
461  if (ui32Base==AUX_ADI4_BASE) {
462  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + (ui32Reg & 0xFE), ui16Val, 2);
463  } else {
464  HWREGH(ui32Base + ui32RegOffset + (ui32Reg & 0xFE)) = ui16Val;
465  }
466 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static uint32_t ADI16RegRead ( uint32_t  ui32Base,
uint32_t  ui32Reg 
)
inlinestatic

Read the value in a 16 bit register.

This function will read 2 x 8 bit registers in the analog domain and return the value as the lower 16 bits of an uint32_t. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
The byte addressing bit will be ignored, to ensure 16 bit access to the ADI slave.
Parameters
ui32Baseis ADI base address.
ui32Regis the 16 bit register to read.
Returns
Returns the 16 bit value of the 2 analog register in the 2 least significant bytes of the uint32_t.
See also
ADI8RegRead(), ADI32RegRead()
316 {
317  // Check the arguments.
318  ASSERT(ADIBaseValid(ui32Base));
319  ASSERT(ui32Reg < ADI_SLAVE_REGS);
320 
321  // Read the registers and return the value.
322  if (ui32Base==AUX_ADI4_BASE) {
323  return AuxAdiDdiSafeRead(ui32Base + (ui32Reg & 0xFE), 2);
324  } else {
325  return(HWREGH(ui32Base + (ui32Reg & 0xFE)));
326  }
327 }
static uint32_t AuxAdiDdiSafeRead(uint32_t nAddr, uint32_t nSize)
Safely read from AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:169
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77

Here is the call graph for this function:

static void ADI16RegWrite ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint16_t  ui16Val 
)
inlinestatic

Write a 16 bit value to 2 registers in the ADI slave.

This function will write a value to 2 consecutive registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
The byte addressing bit will be ignored, to ensure 16 bit access to the ADI slave.
This operation is write only for the specified register. No previous value of the register will be kept (i.e. this is NOT read-modify-write on the register).
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the register to write.
ui16Valis the 16 bit value to write to the register.
Returns
None
See also
ADI8RegWrite(), ADI32RegWrite()
196 {
197  // Check the arguments.
198  ASSERT(ADIBaseValid(ui32Base));
199  ASSERT(ui32Reg < ADI_SLAVE_REGS);
200 
201  // Write the value to the register.
202  if (ui32Base==AUX_ADI4_BASE) {
203  AuxAdiDdiSafeWrite(ui32Base + (ui32Reg & 0xFE), ui16Val, 2);
204  } else {
205  HWREGH(ui32Base + (ui32Reg & 0xFE)) = ui16Val;
206  }
207 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI16SetValBit ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint32_t  ui32Mask,
uint32_t  ui32Val 
)
inlinestatic

Set a value on any bits inside an 2 x 8 bit register aligned on a half-word (byte) boundary in the ADI slave.

This function allows 2 byte (16 bit) access to the ADI slave registers.

Use this function to write any value in the range 0-15 bits aligned on a half-word (byte) boundary. Fx. for writing the value 0b101 to bits 1 and 3 the ui32Val = 0x000A and the ui32Mask = 0x000E. Bits 0 and 5-15 will not be affected by the operation, as the corresponding bits are not set in the ui32Mask.

Note
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis the base address of the ADI port.
ui32Regis the Least Significant Register in the ADI slave that will be affected by the write operation.
ui32Maskis the mask defining which of the 16 bit that should be overwritten. The mask must be defined in the lower half of the 32 bits.
ui32Valis the value to write. The value must be defined in the lower half of the 32 bits.
Returns
None
See also
ADI4SetValBit(), ADI8SetValBit()
813 {
814  uint32_t ui32RegOffset;
815 
816  // Check the arguments.
817  ASSERT(ADIBaseValid(ui32Base));
818  ASSERT(ui32Reg < ADI_SLAVE_REGS);
819  ASSERT(!(ui32Val & 0xFFFF0000));
820  ASSERT(!(ui32Mask & 0xFFFF0000));
821 
822  // Get the correct address of the first register used for setting bits
823  // in the ADI slave.
824  ui32RegOffset = ADI_O_MASK16B + ((ui32Reg << 1) & 0xFC);
825 
826  // Set the selected bits.
827  if (ui32Base==AUX_ADI4_BASE) {
828  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset, (ui32Mask << 16) | ui32Val, 4);
829  } else {
830  HWREG(ui32Base + ui32RegOffset) = (ui32Mask << 16) | ui32Val;
831  }
832 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI32BitsClear ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint32_t  ui32Val 
)
inlinestatic

Clear specific bits in four 8 bit ADI register.

This function will clear bits in 4 registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to clear bits in 4 consecutive 8 bit registers in the ADI slave. Only bits in the selected registers are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base registers to clear the bits in.
ui32Valis the 32 bit one-hot encoded value specifying which bits to clear in the registers.
Returns
None
See also
ADI8BitsClear(), ADI16BitsClear()
653 {
654  uint32_t ui32RegOffset;
655 
656  // Check the arguments.
657  ASSERT(ADIBaseValid(ui32Base));
658  ASSERT(ui32Reg < ADI_SLAVE_REGS);
659 
660  // Get the correct address of the first register used for setting bits
661  // in the ADI slave.
662  ui32RegOffset = ADI_O_CLR;
663 
664  // Set the selected bits.
665  if (ui32Base==AUX_ADI4_BASE) {
666  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + (ui32Reg & 0xFC), ui32Val, 4);
667  } else {
668  HWREG(ui32Base + ui32RegOffset + (ui32Reg & 0xFC)) = ui32Val;
669  }
670 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI32BitsSet ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint32_t  ui32Val 
)
inlinestatic

Set specific bits in 4 x 8 bit ADI slave registers.

This function will set bits in 4 registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to set bits in 4 consecutive 8 bit registers in the ADI slave. Only bits in the selected registers are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base register to assert the bits in.
ui32Valis the 32 bit one-hot encoded value specifying which bits to set in the registers.
Returns
None
See also
ADI8BitsSet(), ADI16BitsSet()
500 {
501  uint32_t ui32RegOffset;
502 
503  // Check the arguments.
504  ASSERT(ADIBaseValid(ui32Base));
505  ASSERT(ui32Reg < ADI_SLAVE_REGS);
506 
507  // Get the correct address of the first register used for setting bits
508  // in the ADI slave.
509  ui32RegOffset = ADI_O_SET;
510 
511  // Set the selected bits.
512  if (ui32Base==AUX_ADI4_BASE) {
513  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + (ui32Reg & 0xFC), ui32Val, 4);
514  } else {
515  HWREG(ui32Base + ui32RegOffset + (ui32Reg & 0xFC)) = ui32Val;
516  }
517 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static uint32_t ADI32RegRead ( uint32_t  ui32Base,
uint32_t  ui32Reg 
)
inlinestatic

Read the value in a 32 bit register.

This function will read 4 x 8 bit registers in the analog domain and return the value as an uint32_t. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
The byte and half word addressing bits will be ignored, to ensure 32 bit access to the ADI slave.
Parameters
ui32Baseis ADI base address.
ui32Regis the 32 bit register to read.
Returns
Returns the 32 bit value of the 4 analog registers.
See also
ADI8RegRead(), ADI16RegRead()
353 {
354  // Check the arguments.
355  ASSERT(ADIBaseValid(ui32Base));
356  ASSERT(ui32Reg < ADI_SLAVE_REGS);
357 
358  // Read the registers and return the value.
359  if (ui32Base==AUX_ADI4_BASE) {
360  return AuxAdiDdiSafeRead(ui32Base + (ui32Reg & 0xFC), 4);
361  } else {
362  return(HWREG(ui32Base + (ui32Reg & 0xFC)));
363  }
364 }
static uint32_t AuxAdiDdiSafeRead(uint32_t nAddr, uint32_t nSize)
Safely read from AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:169
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77

Here is the call graph for this function:

static void ADI32RegWrite ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint32_t  ui32Val 
)
inlinestatic

Write a 32 bit value to 4 registers in the ADI slave.

This function will write a value to 4 consecutive registers in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
The byte and half word addressing bits will be ignored, to ensure 32 bit access to the ADI slave.
This operation is write only for the specified register. No previous value of the register will be kept (i.e. this is NOT read-modify-write on the register).
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the register to write.
ui32Valis the 32 bit value to write to the register.
Returns
None
See also
ADI8RegWrite(), ADI16RegWrite()
241 {
242  // Check the arguments.
243  ASSERT(ADIBaseValid(ui32Base));
244  ASSERT(ui32Reg < ADI_SLAVE_REGS);
245 
246  // Write the value to the register.
247  if (ui32Base==AUX_ADI4_BASE) {
248  AuxAdiDdiSafeWrite(ui32Base + (ui32Reg & 0xFC), ui32Val, 4);
249  } else {
250  HWREG(ui32Base + (ui32Reg & 0xFC)) = ui32Val;
251  }
252 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI4SetValBit ( uint32_t  ui32Base,
uint32_t  ui32Reg,
bool  bWriteHigh,
uint8_t  ui8Mask,
uint8_t  ui8Val 
)
inlinestatic

Set a value on any 4 bits inside an 8 bit register in the ADI slave.

This function allows halfbyte (4 bit) access to the ADI slave registers. The parameter bWriteHigh determines whether to write to the lower or higher part of the 8 bit register.

Use this function to write any value in the range 0-3 bits aligned on a half byte boundary. Fx. for writing the value 0b101 to bits 1 to 3 the ui8Val = 0xA and the ui8Mask = 0xE. Bit 0 will not be affected by the operation, as the corresponding bit is not set in the ui8Mask.

Note
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis the base address of the ADI port.
ui32Regis the Least Significant Register in the ADI slave that will be affected by the write operation.
bWriteHighdefines which part of the register to write in.
  • true: Write upper half byte of register.
  • false: Write lower half byte of register.
ui8Maskis the mask defining which of the 4 bits that should be overwritten. The mask must be defined in the lower half of the 8 bits of the parameter.
ui8Valis the value to write. The value must be defined in the lower half of the 8 bits of the parameter.
Returns
None
See also
ADI8SetValBit(), ADI16SetValBit
708 {
709  uint32_t ui32RegOffset;
710 
711  // Check the arguments.
712  ASSERT(ADIBaseValid(ui32Base));
713  ASSERT(ui32Reg < ADI_SLAVE_REGS);
714  ASSERT(!(ui8Val & 0xF0));
715  ASSERT(!(ui8Mask & 0xF0));
716 
717  // Get the correct address of the first register used for setting bits
718  // in the ADI slave.
719  ui32RegOffset = ADI_O_MASK4B + (ui32Reg << 1) + (bWriteHigh ? 1 : 0);
720 
721  // Set the selected bits.
722  if (ui32Base==AUX_ADI4_BASE) {
723  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset, (ui8Mask << 4) | ui8Val, 1);
724  } else {
725  HWREGB(ui32Base + ui32RegOffset) = (ui8Mask << 4) | ui8Val;
726  }
727 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI8BitsClear ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint8_t  ui8Val 
)
inlinestatic

Clear specific bits in an 8 bit ADI register.

This function will clear bits in a register in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to clear bits in a specific 8 bit register in the ADI slave. Only bits in the selected register are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base registers to clear the bits in.
ui8Valis the 8 bit one-hot encoded value specifying which bits to clear in the register.
Returns
None
See also
ADI16BitsClear(), ADI32BitsClear()

Referenced by AUXADCDisable().

551 {
552  uint32_t ui32RegOffset;
553 
554  // Check the arguments.
555  ASSERT(ADIBaseValid(ui32Base));
556  ASSERT(ui32Reg < ADI_SLAVE_REGS);
557 
558  // Get the correct address of the first register used for setting bits
559  // in the ADI slave.
560  ui32RegOffset = ADI_O_CLR;
561 
562  // Set the selected bits.
563  if (ui32Base==AUX_ADI4_BASE) {
564  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + ui32Reg, ui8Val, 1);
565  } else {
566  HWREGB(ui32Base + ui32RegOffset + ui32Reg) = ui8Val;
567  }
568 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI8BitsSet ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint8_t  ui8Val 
)
inlinestatic

Set specific bits in a single 8 bit ADI register.

This function will set bits in a single register in the analog domain. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned, but arranged in chunks of 32 bits. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7 etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. This function is used to set bits in a specific 8 bit register in the ADI slave. Only bits in the selected register are affected by the operation.
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the base register to assert the bits in.
ui8Valis the 8 bit one-hot encoded value specifying which bits to set in the register.
Returns
None
See also
ADI16BitsSet(), ADI32BitsSet()

Referenced by AUXADCDisableInputScaling(), AUXADCEnableAsync(), and AUXADCEnableSync().

398 {
399  uint32_t ui32RegOffset;
400 
401  // Check the arguments.
402  ASSERT(ADIBaseValid(ui32Base));
403  ASSERT(ui32Reg < ADI_SLAVE_REGS);
404 
405  // Get the correct address of the first register used for setting bits
406  // in the ADI slave.
407  ui32RegOffset = ADI_O_SET;
408 
409  // Set the selected bits.
410  if (ui32Base==AUX_ADI4_BASE) {
411  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset + ui32Reg, ui8Val, 1);
412  } else {
413  HWREGB(ui32Base + ui32RegOffset + ui32Reg) = ui8Val;
414  }
415 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static uint32_t ADI8RegRead ( uint32_t  ui32Base,
uint32_t  ui32Reg 
)
inlinestatic

Read the value of an 8 bit register in the ADI slave.

This function will read an 8 bit register in the analog domain and return the value as the lower 8 bits of an uint32_t. The access to the registers in the analog domain is either 8, 16 or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Parameters
ui32Baseis ADI base address.
ui32Regis the 8 bit register to read.
Returns
Returns the 8 bit value of the analog register in the least significant byte of the uint32_t.
See also
ADI16RegRead(), ADI32RegRead()
277 {
278  // Check the arguments.
279  ASSERT(ADIBaseValid(ui32Base));
280  ASSERT(ui32Reg < ADI_SLAVE_REGS);
281 
282  // Read the register and return the value.
283  if (ui32Base==AUX_ADI4_BASE) {
284  return AuxAdiDdiSafeRead(ui32Base + ui32Reg, 1);
285  } else {
286  return(HWREGB(ui32Base + ui32Reg));
287  }
288 }
static uint32_t AuxAdiDdiSafeRead(uint32_t nAddr, uint32_t nSize)
Safely read from AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:169
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77

Here is the call graph for this function:

static void ADI8RegWrite ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint8_t  ui8Val 
)
inlinestatic

Write an 8 bit value to a register in an ADI slave.

This function will write a value to a single register in the analog domain. The access to the registers in the analog domain is either 8, 16, or 32 bit aligned. You can only do 16 bit access on registers 0-1 / 2-3, etc. Similarly 32 bit accesses are always performed on register 0-3 / 4-7, etc. Addresses for the registers and values being written to the registers will be truncated according to this access scheme.

Note
This operation is write only for the specified register. No previous value of the register will be kept (i.e. this is NOT read-modify-write on the register).
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis ADI base address.
ui32Regis the register to write.
ui8Valis the 8 bit value to write to the register.
Returns
None
See also
ADI16RegWrite(), ADI32RegWrite()
150 {
151  // Check the arguments.
152  ASSERT(ADIBaseValid(ui32Base));
153  ASSERT(ui32Reg < ADI_SLAVE_REGS);
154 
155  // Write the value to the register.
156  if (ui32Base==AUX_ADI4_BASE) {
157  AuxAdiDdiSafeWrite(ui32Base + ui32Reg, ui8Val, 1);
158  } else {
159  HWREGB(ui32Base + ui32Reg) = ui8Val;
160  }
161 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

static void ADI8SetValBit ( uint32_t  ui32Base,
uint32_t  ui32Reg,
uint16_t  ui16Mask,
uint16_t  ui16Val 
)
inlinestatic

Set a value on any bits inside an 8 bit register in the ADI slave.

This function allows byte (8 bit) access to the ADI slave registers.

Use this function to write any value in the range 0-7 bits aligned on a byte boundary. Fx. for writing the value 0b101 to bits 1 and 3 the ui16Val = 0x0A and the ui16Mask = 0x0E. Bits 0 and 5-7 will not be affected by the operation, as the corresponding bits are not set in the ui16Mask.

Note
AUX_ADI4_BASE : Both the AUX module and the clock for the AUX SMPH module must be enabled before calling this function.
Parameters
ui32Baseis the base address of the ADI port.
ui32Regis the Least Significant Register in the ADI slave that will be affected by the write operation.
ui16Maskis the mask defining which of the 8 bit that should be overwritten. The mask must be defined in the lower half of the 16 bits.
ui16Valis the value to write. The value must be defined in the lower half of the 16 bits.
Returns
None
See also
ADI4SetValBit(), ADI16SetValBit()
760 {
761  uint32_t ui32RegOffset;
762 
763  // Check the arguments.
764  ASSERT(ADIBaseValid(ui32Base));
765  ASSERT(ui32Reg < ADI_SLAVE_REGS);
766  ASSERT(!(ui16Val & 0xFF00));
767  ASSERT(!(ui16Mask & 0xFF00));
768 
769  // Get the correct address of the first register used for setting bits
770  // in the ADI slave.
771  ui32RegOffset = ADI_O_MASK8B + (ui32Reg << 1);
772 
773  // Set the selected bits.
774  if (ui32Base==AUX_ADI4_BASE) {
775  AuxAdiDdiSafeWrite(ui32Base + ui32RegOffset, (ui16Mask << 8) | ui16Val, 2);
776  } else {
777  HWREGH(ui32Base + ui32RegOffset) = (ui16Mask << 8) | ui16Val;
778  }
779 }
#define ASSERT(expr)
Definition: debug.h:73
#define ADI_SLAVE_REGS
Definition: adi.h:77
static void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize)
Safely write to AUX ADI/DDI interfaces using a semaphore.
Definition: ddi.h:137

Here is the call graph for this function:

void SafeHapiAuxAdiSelect ( FPTR_VOID_UINT8_T  fPtr,
uint8_t  ut8Signal 
)
65 {
66  bool bIrqEnabled = ( ! CPUcpsid() );
67  while ( ! HWREG( AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 ));
68  fPtr( ut8Signal );
69  HWREG( AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 ) = 1;
70  if ( bIrqEnabled ) {
71  CPUcpsie();
72  }
73 }
uint32_t CPUcpsid(void)
Disable all external interrupts.
Definition: cpu.c:68
uint32_t CPUcpsie(void)
Enable all external interrupts.
Definition: cpu.c:206
void SafeHapiVoid ( FPTR_VOID_VOID_T  fPtr)
54 {
55  bool bIrqEnabled = ( ! CPUcpsid() );
56  while ( ! HWREG( AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 ));
57  fPtr();
58  HWREG( AUX_SMPH_BASE + AUX_SMPH_O_SMPH0 ) = 1;
59  if ( bIrqEnabled ) {
60  CPUcpsie();
61  }
62 }
uint32_t CPUcpsid(void)
Disable all external interrupts.
Definition: cpu.c:68
uint32_t CPUcpsie(void)
Enable all external interrupts.
Definition: cpu.c:206

Macro Definition Documentation

#define ADI_ACK   0x00000001
#define ADI_PROTECT   0x00000080
#define ADI_SYNC   0x00000000