1 | /* $Id: DevHDACommon.h 64351 2016-10-21 11:29:03Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DevHDACommon.h - Shared defines / functions between HDA controller and codec.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2016 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef DEV_HDA_COMMON_H
|
---|
19 | #define DEV_HDA_COMMON_H
|
---|
20 |
|
---|
21 | #define HDA_SDFMT_NON_PCM_SHIFT 15
|
---|
22 | #define HDA_SDFMT_NON_PCM_MASK 0x1
|
---|
23 | #define HDA_SDFMT_BASE_RATE_SHIFT 14
|
---|
24 | #define HDA_SDFMT_BASE_RATE_MASK 0x1
|
---|
25 | #define HDA_SDFMT_MULT_SHIFT 11
|
---|
26 | #define HDA_SDFMT_MULT_MASK 0x7
|
---|
27 | #define HDA_SDFMT_DIV_SHIFT 8
|
---|
28 | #define HDA_SDFMT_DIV_MASK 0x7
|
---|
29 | #define HDA_SDFMT_BITS_SHIFT 4
|
---|
30 | #define HDA_SDFMT_BITS_MASK 0x7
|
---|
31 | #define HDA_SDFMT_CHANNELS_MASK 0xF
|
---|
32 |
|
---|
33 | #define HDA_SDFMT_TYPE RT_BIT(15)
|
---|
34 | #define HDA_SDFMT_TYPE_PCM (0)
|
---|
35 | #define HDA_SDFMT_TYPE_NON_PCM (1)
|
---|
36 |
|
---|
37 | #define HDA_SDFMT_BASE RT_BIT(14)
|
---|
38 | #define HDA_SDFMT_BASE_48KHZ (0)
|
---|
39 | #define HDA_SDFMT_BASE_44KHZ (1)
|
---|
40 |
|
---|
41 | #define HDA_SDFMT_MULT_1X (0)
|
---|
42 | #define HDA_SDFMT_MULT_2X (1)
|
---|
43 | #define HDA_SDFMT_MULT_3X (2)
|
---|
44 | #define HDA_SDFMT_MULT_4X (3)
|
---|
45 |
|
---|
46 | #define HDA_SDFMT_DIV_1X (0)
|
---|
47 | #define HDA_SDFMT_DIV_2X (1)
|
---|
48 | #define HDA_SDFMT_DIV_3X (2)
|
---|
49 | #define HDA_SDFMT_DIV_4X (3)
|
---|
50 | #define HDA_SDFMT_DIV_5X (4)
|
---|
51 | #define HDA_SDFMT_DIV_6X (5)
|
---|
52 | #define HDA_SDFMT_DIV_7X (6)
|
---|
53 | #define HDA_SDFMT_DIV_8X (7)
|
---|
54 |
|
---|
55 | #define HDA_SDFMT_8_BIT (0)
|
---|
56 | #define HDA_SDFMT_16_BIT (1)
|
---|
57 | #define HDA_SDFMT_20_BIT (2)
|
---|
58 | #define HDA_SDFMT_24_BIT (3)
|
---|
59 | #define HDA_SDFMT_32_BIT (4)
|
---|
60 |
|
---|
61 | #define HDA_SDFMT_CHAN_MONO (0)
|
---|
62 | #define HDA_SDFMT_CHAN_STEREO (1)
|
---|
63 |
|
---|
64 | /* Emits a SDnFMT register format. */
|
---|
65 | /* Also being used in the codec's converter format. */
|
---|
66 | #define HDA_SDFMT_MAKE(_afNonPCM, _aBaseRate, _aMult, _aDiv, _aBits, _aChan) \
|
---|
67 | ( (((_afNonPCM) & HDA_SDFMT_NON_PCM_MASK) << HDA_SDFMT_NON_PCM_SHIFT) \
|
---|
68 | | (((_aBaseRate) & HDA_SDFMT_BASE_RATE_MASK) << HDA_SDFMT_BASE_RATE_SHIFT) \
|
---|
69 | | (((_aMult) & HDA_SDFMT_MULT_MASK) << HDA_SDFMT_MULT_SHIFT) \
|
---|
70 | | (((_aDiv) & HDA_SDFMT_DIV_MASK) << HDA_SDFMT_DIV_SHIFT) \
|
---|
71 | | (((_aBits) & HDA_SDFMT_BITS_MASK) << HDA_SDFMT_BITS_SHIFT) \
|
---|
72 | | ( (_aChan) & HDA_SDFMT_CHANNELS_MASK))
|
---|
73 |
|
---|
74 | #endif /* DEV_HDA_COMMON_H */
|
---|
75 |
|
---|