Changeset 82361 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Dec 3, 2019 10:58:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r82360 r82361 216 216 }; 217 217 218 /** Emits registers for a specific (Native Audio Bus Master BAR) NABMBAR. 219 * @todo This totally messes with grepping for identifiers and tagging. */ 220 #define AC97_NABMBAR_REGS(prefix, off) \ 221 enum { \ 222 prefix ## _BDBAR = off, /* Buffer Descriptor Base Address */ \ 223 prefix ## _CIV = off + 4, /* Current Index Value */ \ 224 prefix ## _LVI = off + 5, /* Last Valid Index */ \ 225 prefix ## _SR = off + 6, /* Status Register */ \ 226 prefix ## _PICB = off + 8, /* Position in Current Buffer */ \ 227 prefix ## _PIV = off + 10, /* Prefetched Index Value */ \ 228 prefix ## _CR = off + 11 /* Control Register */ \ 229 } 230 231 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 232 /** 233 * Enumeration of AC'97 source indices. 234 * 235 * @note The order of this indices is fixed (also applies for saved states) for 218 /** @name AC'97 source indices. 219 * @note The order of these indices is fixed (also applies for saved states) for 236 220 * the moment. So make sure you know what you're done when altering this! 237 */ 238 typedef enum 239 { 240 AC97SOUNDSOURCE_PI_INDEX = 0, /**< PCM in */ 241 AC97SOUNDSOURCE_PO_INDEX, /**< PCM out */ 242 AC97SOUNDSOURCE_MC_INDEX, /**< Mic in */ 243 AC97SOUNDSOURCE_END_INDEX 244 } AC97SOUNDSOURCE; 245 246 AC97_NABMBAR_REGS(PI, AC97SOUNDSOURCE_PI_INDEX * 16); 247 AC97_NABMBAR_REGS(PO, AC97SOUNDSOURCE_PO_INDEX * 16); 248 AC97_NABMBAR_REGS(MC, AC97SOUNDSOURCE_MC_INDEX * 16); 249 #endif 250 251 enum 252 { 253 /** NABMBAR: Global Control Register. */ 254 AC97_GLOB_CNT = 0x2c, 255 /** NABMBAR Global Status. */ 256 AC97_GLOB_STA = 0x30, 257 /** Codec Access Semaphore Register. */ 258 AC97_CAS = 0x34 259 }; 221 * @{ 222 */ 223 #define AC97SOUNDSOURCE_PI_INDEX 0 /**< PCM in */ 224 #define AC97SOUNDSOURCE_PO_INDEX 1 /**< PCM out */ 225 #define AC97SOUNDSOURCE_MC_INDEX 2 /**< Mic in */ 226 #define AC97SOUNDSOURCE_MAX 3 /**< Max sound sources. */ 227 /** @} */ 228 229 230 /** @name PCM in NABM BAR registers (0x00..0x0f). 231 * @{ */ 232 #define PI_BDBAR (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0x0) /**< PCM in: Buffer Descriptor Base Address */ 233 #define PI_CIV (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0x4) /**< PCM in: Current Index Value */ 234 #define PI_LVI (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0x5) /**< PCM in: Last Valid Index */ 235 #define PI_SR (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0x6) /**< PCM in: Status Register */ 236 #define PI_PICB (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0x8) /**< PCM in: Position in Current Buffer */ 237 #define PI_PIV (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0xa) /**< PCM in: Prefetched Index Value */ 238 #define PI_CR (AC97SOUNDSOURCE_PI_INDEX * 0x10 + 0xb) /**< PCM in: Control Register */ 239 /** @} */ 240 241 /** @name PCM out NABM BAR registers (0x10..0x1f). 242 * @{ */ 243 #define PO_BDBAR (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0x0) /**< PCM out: Buffer Descriptor Base Address */ 244 #define PO_CIV (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0x4) /**< PCM out: Current Index Value */ 245 #define PO_LVI (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0x5) /**< PCM out: Last Valid Index */ 246 #define PO_SR (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0x6) /**< PCM out: Status Register */ 247 #define PO_PICB (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0x8) /**< PCM out: Position in Current Buffer */ 248 #define PO_PIV (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0xa) /**< PCM out: Prefetched Index Value */ 249 #define PO_CR (AC97SOUNDSOURCE_PO_INDEX * 0x10 + 0xb) /**< PCM out: Control Register */ 250 /** @} */ 251 252 /** @name Mic in NABM BAR registers (0x20..0x2f). 253 * @{ */ 254 #define MC_BDBAR (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0x0) /**< PCM in: Buffer Descriptor Base Address */ 255 #define MC_CIV (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0x4) /**< PCM in: Current Index Value */ 256 #define MC_LVI (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0x5) /**< PCM in: Last Valid Index */ 257 #define MC_SR (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0x6) /**< PCM in: Status Register */ 258 #define MC_PICB (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0x8) /**< PCM in: Position in Current Buffer */ 259 #define MC_PIV (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0xa) /**< PCM in: Prefetched Index Value */ 260 #define MC_CR (AC97SOUNDSOURCE_MC_INDEX * 0x10 + 0xb) /**< PCM in: Control Register */ 261 /** @} */ 262 263 /** @name Misc NABM BAR registers. 264 * @{ */ 265 /** NABMBAR: Global Control Register. */ 266 #define AC97_GLOB_CNT 0x2c 267 /** NABMBAR: Global Status. */ 268 #define AC97_GLOB_STA 0x30 269 /** Codec Access Semaphore Register. */ 270 #define AC97_CAS 0x34 271 /** @} */ 260 272 261 273 #define AC97_PORT2IDX(a_idx) ( ((a_idx) >> 4) & 3 ) … … 3537 3549 pHlp->pfnSSMPutMem(pSSM, pThis->mixer_data, sizeof(pThis->mixer_data)); 3538 3550 3539 uint8_t active[AC97SOUNDSOURCE_ END_INDEX];3551 uint8_t active[AC97SOUNDSOURCE_MAX]; 3540 3552 3541 3553 active[AC97SOUNDSOURCE_PI_INDEX] = ichac97R3StreamIsEnabled(pThisCC, &pThis->aStreams[AC97SOUNDSOURCE_PI_INDEX]) ? 1 : 0; … … 3603 3615 3604 3616 /** @todo r=andy Stream IDs are hardcoded to certain streams. */ 3605 uint8_t uaStrmsActive[AC97SOUNDSOURCE_ END_INDEX];3617 uint8_t uaStrmsActive[AC97SOUNDSOURCE_MAX]; 3606 3618 int rc2 = pHlp->pfnSSMGetMem(pSSM, uaStrmsActive, sizeof(uaStrmsActive)); 3607 3619 AssertRCReturn(rc2, rc2);
Note:
See TracChangeset
for help on using the changeset viewer.