libctru  v2.4.1
Enumerations | Functions
cdcchk.h File Reference

CODEC Hardware Check service. More...

#include <3ds/types.h>

Go to the source code of this file.

Enumerations

enum  CodecI2sLine {
  CODEC_I2S_LINE_1 ,
  CODEC_I2S_LINE_2
}
 I2S line enumeration. More...
 

Functions

Result cdcChkInit (void)
 Initializes CDCCHK.
 
void cdcChkExit (void)
 Exits CDCCHK.
 
HandlecdcChkGetSessionHandle (void)
 Gets a pointer to the current cdc:CHK session handle. More...
 
Result CDCCHK_ReadRegisters1 (u8 pageId, u8 initialRegAddr, void *outData, size_t size)
 Reads multiple registers from the CODEC, using the old SPI hardware interface and a 4MHz baudrate. More...
 
Result CDCCHK_ReadRegisters2 (u8 pageId, u8 initialRegAddr, void *outData, size_t size)
 Reads multiple registers from the CODEC, using the new SPI hardware interface and a 16MHz baudrate. More...
 
Result CDCCHK_WriteRegisters1 (u8 pageId, u8 initialRegAddr, const void *data, size_t size)
 Writes multiple registers to the CODEC, using the old SPI hardware interface and a 4MHz baudrate. More...
 
Result CDCCHK_WriteRegisters2 (u8 pageId, u8 initialRegAddr, const void *data, size_t size)
 Writes multiple registers to the CODEC, using the new SPI hardware interface and a 16MHz baudrate. More...
 
Result CDCCHK_ReadNtrPmicRegister (u8 *outData, u8 regAddr)
 Reads a single register from the NTR PMIC. More...
 
Result CDCCHK_WriteNtrPmicRegister (u8 regAddr, u8 data)
 Writes a single register from the NTR PMIC. More...
 
Result CDCCHK_SetI2sVolume (CodecI2sLine i2sLine, s8 volume)
 Sets the DAC volume level for the specified I2S line. More...
 

Detailed Description

CODEC Hardware Check service.

Enumeration Type Documentation

◆ CodecI2sLine

I2S line enumeration.

Enumerator
CODEC_I2S_LINE_1 

Primary I2S line, used by DSP/Mic (configurable)/GBA sound controller.

CODEC_I2S_LINE_2 

Secondary I2S line, used by CSND hardware.

Function Documentation

◆ CDCCHK_ReadNtrPmicRegister()

Result CDCCHK_ReadNtrPmicRegister ( u8 outData,
u8  regAddr 
)

Reads a single register from the NTR PMIC.

Parameters
[out]outDataWhere to read the data to (1 byte).
regAddrRegister address.
Note
The NTR PMIC is emulated by the CODEC hardware and sends IRQs to the MCU when relevant.

◆ CDCCHK_ReadRegisters1()

Result CDCCHK_ReadRegisters1 ( u8  pageId,
u8  initialRegAddr,
void *  outData,
size_t  size 
)

Reads multiple registers from the CODEC, using the old SPI hardware interface and a 4MHz baudrate.

Parameters
pageIdCODEC Page ID.
initialRegAddrAddress of the CODEC register to start with.
[out]outDataWhere to write the read data to.
sizeNumber of registers to read (bytes to read, max. 64).

◆ CDCCHK_ReadRegisters2()

Result CDCCHK_ReadRegisters2 ( u8  pageId,
u8  initialRegAddr,
void *  outData,
size_t  size 
)

Reads multiple registers from the CODEC, using the new SPI hardware interface and a 16MHz baudrate.

Parameters
pageIdCODEC Page ID.
initialRegAddrAddress of the CODEC register to start with.
[out]outDataWhere to read the data to.
sizeNumber of registers to read (bytes to read, max. 64).

◆ CDCCHK_SetI2sVolume()

Result CDCCHK_SetI2sVolume ( CodecI2sLine  i2sLine,
s8  volume 
)

Sets the DAC volume level for the specified I2S line.

Parameters
i2sLineI2S line to set the volume for.
volumeVolume level (-128 to 0).

◆ CDCCHK_WriteNtrPmicRegister()

Result CDCCHK_WriteNtrPmicRegister ( u8  regAddr,
u8  data 
)

Writes a single register from the NTR PMIC.

Parameters
regAddrRegister address.
dataData to write (1 byte).
Note
The NTR PMIC is emulated by the CODEC hardware and sends IRQs to the MCU when relevant.

◆ CDCCHK_WriteRegisters1()

Result CDCCHK_WriteRegisters1 ( u8  pageId,
u8  initialRegAddr,
const void *  data,
size_t  size 
)

Writes multiple registers to the CODEC, using the old SPI hardware interface and a 4MHz baudrate.

Parameters
pageIdCODEC Page ID.
initialRegAddrAddress of the CODEC register to start with.
dataWhere to read the data to write from.
sizeNumber of registers to write (bytes to read, max. 64).

◆ CDCCHK_WriteRegisters2()

Result CDCCHK_WriteRegisters2 ( u8  pageId,
u8  initialRegAddr,
const void *  data,
size_t  size 
)

Writes multiple registers to the CODEC, using the new SPI hardware interface and a 16MHz baudrate.

Parameters
pageIdCODEC Page ID.
initialRegAddrAddress of the CODEC register to start with.
dataWhere to read the data to write from.
sizeNumber of registers to write (bytes to read, max. 64).

◆ cdcChkGetSessionHandle()

Handle* cdcChkGetSessionHandle ( void  )

Gets a pointer to the current cdc:CHK session handle.

Returns
A pointer to the current cdc:CHK session handle.