Changeset 90144 in vbox
- Timestamp:
- Jul 9, 2021 11:24:35 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145646
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp ¶
r90143 r90144 800 800 #define STAC9220WIDGET(a_Type) do { \ 801 801 AssertCompile(RT_ELEMENTS(g_abStac9220##a_Type##s) <= RT_ELEMENTS(pThis->ab##a_Type##s)); \ 802 memcpy((void *)&pThis->ab##a_Type##s[0], &g_abStac9220##a_Type##s[0], \ 803 sizeof(uint8_t) * RT_ELEMENTS(g_abStac9220##a_Type##s)); \ 802 uint8_t *pbDst = (uint8_t *)&pThis->ab##a_Type##s[0]; \ 803 uintptr_t i; \ 804 for (i = 0; i < RT_ELEMENTS(g_abStac9220##a_Type##s); i++) \ 805 { \ 806 uint8_t const idNode = g_abStac9220##a_Type##s[i]; \ 807 if (idNode != 0) \ 808 { \ 809 AssertReturn(idNode < RT_ELEMENTS(pThis->aNodes), VERR_INTERNAL_ERROR_3); \ 810 pThis->afNodeClassifications[idNode] |= RT_CONCAT(CODEC_NODE_CLS_,a_Type); \ 811 } \ 812 pbDst[i] = idNode; \ 813 } \ 814 for (; i < RT_ELEMENTS(pThis->ab##a_Type##s); i++) \ 815 pbDst[i] = 0; \ 804 816 } while (0) 805 817 STAC9220WIDGET(Port); … … 855 867 * Some generic predicate functions. 856 868 */ 857 /** @todo r=bird: we could use memchr here if we knew the array always ended with zeros858 * What would be even quicker would be an array of 16-bit flag masks for each node,859 * compiled by STAC9220WIDGET at construction time. */860 869 #define HDA_CODEC_IS_NODE_OF_TYPE_FUNC(a_Type) \ 861 870 DECLINLINE(bool) hdaCodecIs##a_Type##Node(PHDACODECR3 pThis, uint8_t idNode) \ 862 871 { \ 863 Assert(pThis->ab##a_Type##s); \ 864 for (uintptr_t i = 0; i < RT_ELEMENTS(pThis->ab##a_Type##s) && pThis->ab##a_Type##s[i] != 0; i++) \ 865 if (pThis->ab##a_Type##s[i] == idNode) \ 866 return true; \ 867 return false; \ 872 Assert(idNode < RT_ELEMENTS(pThis->afNodeClassifications)); \ 873 Assert( (memchr(&pThis->RT_CONCAT3(ab,a_Type,s)[0], idNode, sizeof(pThis->RT_CONCAT3(ab,a_Type,s))) != NULL) \ 874 == RT_BOOL(pThis->afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type))); \ 875 return RT_BOOL(pThis->afNodeClassifications[idNode] & RT_CONCAT(CODEC_NODE_CLS_,a_Type)); \ 868 876 } 869 877 /* hdaCodecIsPortNode */ -
TabularUnified trunk/src/VBox/Devices/Audio/DevHdaCodec.h ¶
r90143 r90144 790 790 #define CODEC_NODES_MAX 32 791 791 792 /** @name CODEC_NODE_CLS_XXX - node classification flags. 793 * @{ */ 794 #define CODEC_NODE_CLS_Port UINT16_C(0x0001) 795 #define CODEC_NODE_CLS_Dac UINT16_C(0x0002) 796 #define CODEC_NODE_CLS_AdcVol UINT16_C(0x0004) 797 #define CODEC_NODE_CLS_Adc UINT16_C(0x0008) 798 #define CODEC_NODE_CLS_AdcMux UINT16_C(0x0010) 799 #define CODEC_NODE_CLS_Pcbeep UINT16_C(0x0020) 800 #define CODEC_NODE_CLS_SpdifIn UINT16_C(0x0040) 801 #define CODEC_NODE_CLS_SpdifOut UINT16_C(0x0080) 802 #define CODEC_NODE_CLS_DigInPin UINT16_C(0x0100) 803 #define CODEC_NODE_CLS_DigOutPin UINT16_C(0x0200) 804 #define CODEC_NODE_CLS_Cd UINT16_C(0x0400) 805 #define CODEC_NODE_CLS_VolKnob UINT16_C(0x0800) 806 #define CODEC_NODE_CLS_Reserved UINT16_C(0x1000) 807 /** @} */ 808 809 792 810 /** 793 811 * HDA codec state (ring-3, no shared state). … … 836 854 /** @} */ 837 855 838 /** Safty zero padding before the nodes start. */839 uint 8_t const abSaftyPadding2[CODEC_NODES_MAX * 2];856 /** The CODEC_NODE_CLS_XXX flags for each node. */ 857 uint16_t afNodeClassifications[CODEC_NODES_MAX]; 840 858 841 859 CODECNODE aNodes[CODEC_NODES_MAX];
Note:
See TracChangeset
for help on using the changeset viewer.