diff --git a/include/avm/avm.dox b/include/avm/avm.dox index af4481349..d20a31078 100644 --- a/include/avm/avm.dox +++ b/include/avm/avm.dox @@ -1,5 +1,5 @@ /** * \defgroup avm avm * - * AVM + * Audio/Video Manager */ diff --git a/include/avm/config.h b/include/avm/config.h new file mode 100644 index 000000000..1922734df --- /dev/null +++ b/include/avm/config.h @@ -0,0 +1,132 @@ +#pragma once +#include +#include +#include "tv.h" + +/** + * \defgroup avm_config AVM System Config + * \ingroup avm + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Reads the TV aspect ratio. + * + * \param outAspectRatio + * Pointer to write the aspect ratio to. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMReadSystemAspectRatioConfig(AVMTvAspectRatio *outAspectRatio); + +/** + * Reads the TV port. + * + * \param outPort + * Pointer to write the port to. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMReadSystemPortConfig(TVEPort *outPort); + +/** + * Reads the TV under scan. + * + * \param outUnderScan + * Pointer to write the under scan to. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMReadSystemTVUnderScanConfig(uint32_t *outUnderScan); + +/** + * Reads the TV resolution. + * + * \param outResolution + * Pointer to write the resolution to. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMReadSystemVideoResConfig(AVMTvResolution *outResolution); + +/** + * Writes the TV aspect ratio. + * + * \param aspectRatio + * Must be one of #AVMTvAspectRatio. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMWriteSystemAspectRatioConfig(AVMTvAspectRatio aspectRatio); + +/** + * Writes the TV under scan. + * + * \param underScan + * Must be less than \c 0x15 . + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMWriteSystemTVUnderScanConfig(uint32_t underScan); + +/** + * Writes the TV port and resolution. + * + * \param port + * Must be one of #TVEPort. + * + * \param resolution + * Must be one of: + * - #AVM_TV_RESOLUTION_576I + * - #AVM_TV_RESOLUTION_480I + * - #AVM_TV_RESOLUTION_480P + * - #AVM_TV_RESOLUTION_720P + * - #AVM_TV_RESOLUTION_1080I + * - #AVM_TV_RESOLUTION_1080P + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMWriteSystemVideoOutConfig(TVEPort port, + AVMTvResolution resolution); + +/** + * Writes the TV resolution. + * + * \param resolution + * Must be one of: + * - #AVM_TV_RESOLUTION_576I + * - #AVM_TV_RESOLUTION_480I + * - #AVM_TV_RESOLUTION_480P + * - #AVM_TV_RESOLUTION_720P + * - #AVM_TV_RESOLUTION_1080I + * - #AVM_TV_RESOLUTION_1080P + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMWriteSystemVideoResConfig(AVMTvResolution resolution); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/include/avm/tv.h b/include/avm/tv.h new file mode 100644 index 000000000..f6e42ca2a --- /dev/null +++ b/include/avm/tv.h @@ -0,0 +1,264 @@ +#pragma once +#include +#include + +/** + * \defgroup avm_tv TV + * \ingroup avm + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum AVMTvAspectRatio +{ + //! 4:3 + AVM_TV_ASPECT_RATIO_4_3, + //! 16:9 + AVM_TV_ASPECT_RATIO_16_9, +} AVMTvAspectRatio; + +typedef enum AVMTvResolution +{ + AVM_TV_RESOLUTION_576I = 1, + AVM_TV_RESOLUTION_480I = 2, + AVM_TV_RESOLUTION_480P = 3, + AVM_TV_RESOLUTION_720P = 4, + AVM_TV_RESOLUTION_720P_3D = 5, + AVM_TV_RESOLUTION_1080I = 6, + AVM_TV_RESOLUTION_1080P = 7, + AVM_TV_RESOLUTION_480I_PAL60 = 10, + AVM_TV_RESOLUTION_576P = 11, + AVM_TV_RESOLUTION_720P_50HZ = 12, + AVM_TV_RESOLUTION_1080I_50HZ = 13, + AVM_TV_RESOLUTION_1080P_50HZ = 14, +} AVMTvResolution; + +typedef enum AVMTvVideoRegion +{ + AVM_TV_VIDEO_REGION_NTSC = 1, + AVM_TV_VIDEO_REGION_PAL, +} AVMTvVideoRegion; + +/** + * Gets the TV video region. + * + * \return + * \c TRUE if the region is set to \link AVM_TV_VIDEO_REGION_NTSC NTSC \endlink. + * \c FALSE if the region is set to \link AVM_TV_VIDEO_REGION_PAL PAL \endlink. + */ +BOOL +AVMDebugIsNTSC(void); + +/** + * Gets the TV port. + * + * \param outPort + * Pointer to write the port to. + * + * \return + * Always returns \c TRUE . + * + * \sa + * - TVEGetCurrentPort() + */ +BOOL +AVMGetCurrentPort(TVEPort *outPort); + +/** + * Gets the HDMI state. + * + * \param outState + * Pointer to write the state to. + * + * \sa + * - TVEGetHDMIErrorStat() + */ +void +AVMGetHDMIState(TVEHdmiState *outState); + +/** + * Gets the TV aspect ratio. + * + * \param outAspectRatio + * Pointer to write the aspect ratio to. + * + * \return + * Always returns \c TRUE . + */ +BOOL +AVMGetTVAspectRatio(AVMTvAspectRatio *outAspectRatio); + +/** + * Gets the TV resolution. + * + * \warning + * If the resolution is set to #AVM_TV_RESOLUTION_480I_PAL60, this function + * will instead output #AVM_TV_RESOLUTION_480I. + * If the resolution is set to either #AVM_TV_RESOLUTION_720P_50HZ, + * #AVM_TV_RESOLUTION_1080I_50HZ, or #AVM_TV_RESOLUTION_1080P_50HZ, then + * \e nothing will be stored to \a outResolution . + * + * \param outResolution + * Pointer to write the resolution to. + * + * \return + * Always returns \c TRUE . + */ +BOOL +AVMGetTVScanMode(AVMTvResolution *outResolution); + +/** + * Gets the TV under scan. + * + * \param outUnderScan + * Pointer to write the under scan to. + * + * \return + * \c 0 on success or \c -1 on failure. + */ +int32_t +AVMGetTVUnderScan(uint32_t *outUnderScan); + +/** + * Determines whether a TV is currently connected and displaying the Wii U source. + * + * Internally checks that either the #TVEHdmiState is #TVE_HDMI_STATE_DONE or + * the analog state is \c 1 , depending on whether the \link TVEPort port \endlink is + * set to \link TVE_PORT_HDMI HDMI \endlink or not. + * + * \return + * \c TRUE if a TV is connected, \c FALSE otherwise. + * + * \sa + * - AVMGetHDMIState() + * - TVEGetHDMIErrorStat() + * - TVEGetAnalogStat() + */ +BOOL +AVMIsAVOutReady(void); + +/** + * Sets the TV aspect ratio. + * + * \param aspectRatio + * Must be one of #AVMTvAspectRatio. + * + * \return + * \c TRUE on success or \c FALSE on failure. + */ +BOOL +AVMSetTVAspectRatio(AVMTvAspectRatio aspectRatio); + +/** + * Sets whether to show or hide the TV video out. + * + * \param enable + * If \c FALSE then a black image is output. + * + * \return + * \c TRUE on success or \c FALSE on failure. + */ +BOOL +AVMSetTVEnable(BOOL enable); + +/** + * Sets the TV port. + * + * \param port + * Must be one of #TVEPort. + * + * \param resolution + * Must be one of #AVMTvResolution. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMSetTVOutPort(TVEPort port, + AVMTvResolution resolution); + +/** + * Sets the TV resolution and port. + * + * \param resolution + * Must be one of #AVMTvResolution. + * + * \param port + * Must be one of #TVEPort. + * + * \return + * \c 1 on success. + */ +int32_t +AVMSetTVScanMode(AVMTvResolution resolution, + uint32_t unknown, + TVEPort port); + +/** + * Sets the TV resolution. + * + * \param resolution + * Must be one of #AVMTvResolution. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMSetTVScanResolution(AVMTvResolution resolution); + +/** + * Sets the TV under scan. + * + * \param underScan + * Must be less than \c 0x15 . + * + * \return + * \c 0 on success or a negative value on error. + * + * \sa + * - AVMSetTVUnderScanParam() + */ +int32_t +AVMSetTVUnderScan(uint32_t underScan); + +/** + * \param underScan + * Must be less than \c 0x15 . + * + * \return + * \c 0 on success or \c -1 on failure. + * + * \sa + * - AVMSetTVUnderScan() + */ +int32_t +AVMSetTVUnderScanParam(uint32_t underScan); + +/** + * Sets the TV video region. + * + * \param videoRegion + * Must be one of #AVMTvVideoRegion. + * + * \param port + * Must be one of #TVEPort. + * + * \param resolution + * Must be one of #AVMTvResolution. + * + * \return + * \c 0 on success or a negative value on error. + */ +int32_t +AVMSetTVVideoRegion(AVMTvVideoRegion videoRegion, + TVEPort port, + AVMTvResolution resolution); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/include/tve/tve.dox b/include/tve/tve.dox new file mode 100644 index 000000000..509e9c4fa --- /dev/null +++ b/include/tve/tve.dox @@ -0,0 +1,5 @@ +/** + * \defgroup tve tve + * + * TV Encoder + */ diff --git a/include/tve/tve.h b/include/tve/tve.h new file mode 100644 index 000000000..4b3c69592 --- /dev/null +++ b/include/tve/tve.h @@ -0,0 +1,84 @@ +#pragma once +#include + +/** + * \defgroup tve_tve TVE + * \ingroup tve + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum TVEPort +{ + TVE_PORT_HDMI, + TVE_PORT_COMPONENT, + TVE_PORT_COMPOSITE, + TVE_PORT_SCART, +} TVEPort; + +typedef enum TVEHdmiState +{ + TVE_HDMI_STATE_NONE, + TVE_HDMI_STATE_HTPG_OFF, + TVE_HDMI_STATE_RXWAIT, + TVE_HDMI_STATE_EDID_COMP, + TVE_HDMI_STATE_DUMMY_TMDS, + TVE_HDMI_STATE_W4WK, + TVE_HDMI_STATE_1STA, + TVE_HDMI_STATE_2NDA, + TVE_HDMI_STATE_3RDA, + TVE_HDMI_STATE_STAV_OFF, + TVE_HDMI_STATE_DONE, + TVE_HDMI_STATE_OTHER, + TVE_HDMI_STATE_TMDSDOWN, + TVE_HDMI_STATE_SHUTDOWN, + TVE_HDMI_STATE_WII, + TVE_HDMI_STATE_ERR_NRESET, + TVE_HDMI_STATE_ERR_INT_LINE, + TVE_HDMI_STATE_ERR_KEY_LOAD, + TVE_HDMI_STATE_ERR_EDID_READ, + TVE_HDMI_STATE_ERR_HOTPLUG, + TVE_HDMI_STATE_ERR_VSYNC, + TVE_HDMI_STATE_ERR_HDCP, + TVE_HDMI_STATE_ERR_SYS, + TVE_HDMI_STATE_ERR_CEC, + TVE_HDMI_STATE_ERR_W41A, + TVE_HDMI_STATE_ERR_W4ED, + TVE_HDMI_STATE_UNKNOWN_1A, +} TVEHdmiState; + +/** + * Gets the analog state. + * + * \param outState + * Pointer to write the state to. + */ +void +TVEGetAnalogStat(uint32_t *outState); + +/** + * Gets the TV port. + * + * \return + * One of #TVEPort. + */ +TVEPort +TVEGetCurrentPort(void); + +/** + * Gets the HDMI state. + * + * \param outState + * Pointer to write the state to. + */ +void +TVEGetHDMIErrorStat(TVEHdmiState *outState); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index 3fdc5b25c..272df873d 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -1,4 +1,6 @@ +#include #include +#include #include #include #include @@ -151,6 +153,7 @@ #include #include #include +#include #include #include #include