VirtualBox

Changeset 90143 in vbox


Ignore:
Timestamp:
Jul 9, 2021 10:57:47 PM (4 years ago)
Author:
vboxsync
Message:

DevHdaCodec: The node classification lists can be const. bugref:9890

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.cpp

    r90142 r90143  
    132132*   Global Variables                                                                                                             *
    133133*********************************************************************************************************************************/
    134 /** @name STAC9220 Values
    135  * @note Referenced through STAC9220WIDGET in the constructor below
     134/** @name STAC9220 Node Classifications.
     135 * @note Referenced through STAC9220WIDGET in the constructor below.
    136136 * @{ */
    137137static uint8_t const g_abStac9220Ports[]      = { STAC9220_NID_PIN_HEADPHONE0, STAC9220_NID_PIN_B, STAC9220_NID_PIN_C, STAC9220_NID_PIN_HEADPHONE1, STAC9220_NID_PIN_E, STAC9220_NID_PIN_F, 0 };
     
    800800#define STAC9220WIDGET(a_Type) do { \
    801801            AssertCompile(RT_ELEMENTS(g_abStac9220##a_Type##s) <= RT_ELEMENTS(pThis->ab##a_Type##s)); \
    802             memcpy(&pThis->ab##a_Type##s, &g_abStac9220##a_Type##s, sizeof(uint8_t) * RT_ELEMENTS(g_abStac9220##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)); \
    803804        } while (0)
    804805    STAC9220WIDGET(Port);
     
    854855 * Some generic predicate functions.
    855856 */
    856 /** @todo r=bird: we could use memchr here if we knew the array always ended with zeros */
     857/** @todo r=bird: we could use memchr here if we knew the array always ended with zeros
     858 * What would be even quicker would be an array of 16-bit flag masks for each node,
     859 * compiled by STAC9220WIDGET at construction time. */
    857860#define HDA_CODEC_IS_NODE_OF_TYPE_FUNC(a_Type) \
    858861    DECLINLINE(bool) hdaCodecIs##a_Type##Node(PHDACODECR3 pThis, uint8_t idNode) \
  • trunk/src/VBox/Devices/Audio/DevHdaCodec.h

    r90142 r90143  
    796796{
    797797    /** Codec implementation type. */
    798     CODECTYPE   enmType;
     798    CODECTYPE       enmType;
    799799    /** Codec ID. */
    800     uint16_t    id;
    801     uint16_t    idVendor;
    802     uint16_t    idDevice;
    803     uint8_t     bBSKU;
    804     uint8_t     idAssembly;
    805 
    806     bool        fInReset;
    807 
    808     uint8_t     cTotalNodes;
    809     uint8_t     u8AdcVolsLineIn;
    810     uint8_t     u8DacLineOut;
    811 
    812     uint32_t    cNodes;
     800    uint16_t        id;
     801    uint16_t        idVendor;
     802    uint16_t        idDevice;
     803    uint8_t         bBSKU;
     804    uint8_t         idAssembly;
     805
     806    bool            fInReset;
     807
     808    uint8_t         cTotalNodes;
     809    uint8_t         u8AdcVolsLineIn;
     810    uint8_t         u8DacLineOut;
     811
     812    uint32_t        cNodes;
    813813
    814814    /** Align the lists below so they don't cross cache lines (assumes
    815815     *  CODEC_NODES_MAX is 32). */
    816     uint8_t     abPadding1[CODEC_NODES_MAX - 20];
    817 
    818     uint8_t     abPorts[CODEC_NODES_MAX];
    819     uint8_t     abDacs[CODEC_NODES_MAX];
    820     uint8_t     abAdcVols[CODEC_NODES_MAX];
    821     uint8_t     abAdcs[CODEC_NODES_MAX];
    822     uint8_t     abAdcMuxs[CODEC_NODES_MAX];
    823     uint8_t     abPcbeeps[CODEC_NODES_MAX];
    824     uint8_t     abSpdifIns[CODEC_NODES_MAX];
    825     uint8_t     abSpdifOuts[CODEC_NODES_MAX];
    826     uint8_t     abDigInPins[CODEC_NODES_MAX];
    827     uint8_t     abDigOutPins[CODEC_NODES_MAX];
    828     uint8_t     abCds[CODEC_NODES_MAX];
    829     uint8_t     abVolKnobs[CODEC_NODES_MAX];
    830     uint8_t     abReserveds[CODEC_NODES_MAX];
     816    uint8_t const   abPadding1[CODEC_NODES_MAX - 20];
     817
     818    /** @name Node classifications.
     819     * @note These are copies of the g_abStac9220Xxxx arrays in DevHdaCodec.cpp.
     820     *       They are used both for classifying a node and for processing a class of
     821     *       nodes.
     822     * @{ */
     823    uint8_t const   abPorts[CODEC_NODES_MAX];
     824    uint8_t const   abDacs[CODEC_NODES_MAX];
     825    uint8_t const   abAdcVols[CODEC_NODES_MAX];
     826    uint8_t const   abAdcs[CODEC_NODES_MAX];
     827    uint8_t const   abAdcMuxs[CODEC_NODES_MAX];
     828    uint8_t const   abPcbeeps[CODEC_NODES_MAX];
     829    uint8_t const   abSpdifIns[CODEC_NODES_MAX];
     830    uint8_t const   abSpdifOuts[CODEC_NODES_MAX];
     831    uint8_t const   abDigInPins[CODEC_NODES_MAX];
     832    uint8_t const   abDigOutPins[CODEC_NODES_MAX];
     833    uint8_t const   abCds[CODEC_NODES_MAX];
     834    uint8_t const   abVolKnobs[CODEC_NODES_MAX];
     835    uint8_t const   abReserveds[CODEC_NODES_MAX];
     836    /** @} */
    831837
    832838    /** Safty zero padding before the nodes start. */
    833     uint8_t     abSaftyPadding2[CODEC_NODES_MAX * 2];
    834 
    835     CODECNODE   aNodes[CODEC_NODES_MAX];
    836 
    837     STAMCOUNTER StatLookupsR3;
    838     uint64_t    au64Padding3[7];
     839    uint8_t const   abSaftyPadding2[CODEC_NODES_MAX * 2];
     840
     841    CODECNODE       aNodes[CODEC_NODES_MAX];
     842
     843    STAMCOUNTER     StatLookupsR3;
     844    uint64_t const  au64Padding3[7];
    839845} HDACODECR3;
    840846AssertCompile(RT_IS_POWER_OF_TWO(CODEC_NODES_MAX));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette