libctru  v2.4.1
cdcchk.h
Go to the documentation of this file.
1 /**
2  * @file cdcchk.h
3  * @brief CODEC Hardware Check service.
4  */
5 #pragma once
6 
7 #include <3ds/types.h>
8 
9 /// I2S line enumeration
10 typedef enum {
11  CODEC_I2S_LINE_1, ///< Primary I2S line, used by DSP/Mic (configurable)/GBA sound controller.
12  CODEC_I2S_LINE_2, ///< Secondary I2S line, used by CSND hardware.
13 } CodecI2sLine;
14 
15 /// Initializes CDCCHK.
17 
18 /// Exits CDCCHK.
19 void cdcChkExit(void);
20 
21 /**
22  * @brief Gets a pointer to the current cdc:CHK session handle.
23  * @return A pointer to the current cdc:CHK session handle.
24  */
26 
27 /**
28  * @brief Reads multiple registers from the CODEC, using the old
29  * SPI hardware interface and a 4MHz baudrate.
30  * @param pageId CODEC Page ID.
31  * @param initialRegAddr Address of the CODEC register to start with.
32  * @param[out] outData Where to write the read data to.
33  * @param size Number of registers to read (bytes to read, max. 64).
34  */
35 Result CDCCHK_ReadRegisters1(u8 pageId, u8 initialRegAddr, void *outData, size_t size);
36 
37 /**
38  * @brief Reads multiple registers from the CODEC, using the new
39  * SPI hardware interface and a 16MHz baudrate.
40  * @param pageId CODEC Page ID.
41  * @param initialRegAddr Address of the CODEC register to start with.
42  * @param[out] outData Where to read the data to.
43  * @param size Number of registers to read (bytes to read, max. 64).
44  */
45 Result CDCCHK_ReadRegisters2(u8 pageId, u8 initialRegAddr, void *outData, size_t size);
46 
47 /**
48  * @brief Writes multiple registers to the CODEC, using the old
49  * SPI hardware interface and a 4MHz baudrate.
50  * @param pageId CODEC Page ID.
51  * @param initialRegAddr Address of the CODEC register to start with.
52  * @param data Where to read the data to write from.
53  * @param size Number of registers to write (bytes to read, max. 64).
54  */
55 Result CDCCHK_WriteRegisters1(u8 pageId, u8 initialRegAddr, const void *data, size_t size);
56 
57 /**
58  * @brief Writes multiple registers to the CODEC, using the new
59  * SPI hardware interface and a 16MHz baudrate.
60  * @param pageId CODEC Page ID.
61  * @param initialRegAddr Address of the CODEC register to start with.
62  * @param data Where to read the data to write from.
63  * @param size Number of registers to write (bytes to read, max. 64).
64  */
65 Result CDCCHK_WriteRegisters2(u8 pageId, u8 initialRegAddr, const void *data, size_t size);
66 
67 /**
68  * @brief Reads a single register from the NTR PMIC.
69  * @param[out] outData Where to read the data to (1 byte).
70  * @param regAddr Register address.
71  * @note The NTR PMIC is emulated by the CODEC hardware and sends
72  * IRQs to the MCU when relevant.
73  */
75 
76 /**
77  * @brief Writes a single register from the NTR PMIC.
78  * @param regAddr Register address.
79  * @param data Data to write (1 byte).
80  * @note The NTR PMIC is emulated by the CODEC hardware and sends
81  * IRQs to the MCU when relevant.
82  */
84 
85 /**
86  * @brief Sets the DAC volume level for the specified I2S line.
87  * @param i2sLine I2S line to set the volume for.
88  * @param volume Volume level (-128 to 0).
89 */
Result CDCCHK_ReadNtrPmicRegister(u8 *outData, u8 regAddr)
Reads a single register from the NTR PMIC.
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.
void cdcChkExit(void)
Exits CDCCHK.
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.
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.
Handle * cdcChkGetSessionHandle(void)
Gets a pointer to the current cdc:CHK session handle.
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.
Result CDCCHK_SetI2sVolume(CodecI2sLine i2sLine, s8 volume)
Sets the DAC volume level for the specified I2S line.
Result cdcChkInit(void)
Initializes CDCCHK.
Result CDCCHK_WriteNtrPmicRegister(u8 regAddr, u8 data)
Writes a single register from the NTR PMIC.
CodecI2sLine
I2S line enumeration.
Definition: cdcchk.h:10
@ CODEC_I2S_LINE_1
Primary I2S line, used by DSP/Mic (configurable)/GBA sound controller.
Definition: cdcchk.h:11
@ CODEC_I2S_LINE_2
Secondary I2S line, used by CSND hardware.
Definition: cdcchk.h:12
Various system types.
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
int8_t s8
8-bit signed integer
Definition: types.h:26
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42