A bit more meaningful constant names.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24183 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-02-29 19:09:59 +00:00
parent abf12dd83f
commit 438500b022
3 changed files with 64 additions and 60 deletions
@@ -36,7 +36,7 @@ static const char* kJackColor[] = {
static status_t static status_t
hda_widget_get_pm_support(hda_codec* codec, uint32 nodeID, uint32* pm) hda_widget_get_pm_support(hda_codec* codec, uint32 nodeID, uint32* pm)
{ {
corb_t verb = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAM, corb_t verb = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER,
PID_POWERSTATE_SUPPORT); PID_POWERSTATE_SUPPORT);
status_t rc; status_t rc;
uint32 resp; uint32 resp;
@@ -63,8 +63,10 @@ hda_widget_get_stream_support(hda_codec* codec, uint32 nodeID, uint32* formats,
uint32 resp[2]; uint32 resp[2];
status_t status; status_t status;
verbs[0] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAM, PID_STREAM_SUPPORT); verbs[0] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER,
verbs[1] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAM, PID_PCM_SUPPORT); PID_STREAM_SUPPORT);
verbs[1] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER,
PID_PCM_SUPPORT);
status = hda_send_verbs(codec, verbs, resp, 2); status = hda_send_verbs(codec, verbs, resp, 2);
if (status != B_OK) if (status != B_OK)
@@ -126,7 +128,7 @@ hda_widget_get_amplifier_capabilities(hda_codec* codec, uint32 nodeID)
corb_t verb; corb_t verb;
uint32 resp; uint32 resp;
verb = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAM, PID_OUTPUT_AMP_CAP); verb = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER, PID_OUTPUT_AMP_CAP);
rc = hda_send_verbs(codec, &verb, &resp, 1); rc = hda_send_verbs(codec, &verb, &resp, 1);
if (rc == B_OK && resp != 0) { if (rc == B_OK && resp != 0) {
dprintf("\tAMP: Mute: %s, step size: %ld, # steps: %ld, offset: %ld\n", dprintf("\tAMP: Mute: %s, step size: %ld, # steps: %ld, offset: %ld\n",
@@ -153,11 +155,11 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
&audioGroup->supported_pm); &audioGroup->supported_pm);
verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id,
VID_GET_PARAM, PID_AUDIO_FG_CAP); VID_GET_PARAMETER, PID_AUDIO_GROUP_CAP);
verbs[1] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, verbs[1] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id,
VID_GET_PARAM, PID_GPIO_COUNT); VID_GET_PARAMETER, PID_GPIO_COUNT);
verbs[2] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, verbs[2] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id,
VID_GET_PARAM, PID_SUBORD_NODE_COUNT); VID_GET_PARAMETER, PID_SUBORD_NODE_COUNT);
if (hda_send_verbs(audioGroup->codec, verbs, resp, 3) != B_OK) if (hda_send_verbs(audioGroup->codec, verbs, resp, 3) != B_OK)
return B_ERROR; return B_ERROR;
@@ -187,10 +189,10 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
char buf[256]; char buf[256];
int off; int off;
verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAM, verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAMETER,
PID_AUDIO_WIDGET_CAP); PID_AUDIO_WIDGET_CAP);
verbs[1] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAM, verbs[1] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAMETER,
PID_CONNLIST_LEN); PID_CONNECTION_LIST_LENGTH);
hda_send_verbs(audioGroup->codec, verbs, resp, 2); hda_send_verbs(audioGroup->codec, verbs, resp, 2);
audioGroup->widgets[widx].type = (hda_widget_type)(resp[0] >> 20); audioGroup->widgets[widx].type = (hda_widget_type)(resp[0] >> 20);
@@ -208,7 +210,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
/* We support power; switch us on! */ /* We support power; switch us on! */
verb = MAKE_VERB(audioGroup->codec->addr, wid, verb = MAKE_VERB(audioGroup->codec->addr, wid,
VID_SET_POWERSTATE, 0); VID_SET_POWER_STATE, 0);
hda_send_verbs(audioGroup->codec, &verb, &resp, 1); hda_send_verbs(audioGroup->codec, &verb, &resp, 1);
} }
@@ -256,7 +258,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
break; break;
case WT_PIN_COMPLEX: case WT_PIN_COMPLEX:
dprintf("%ld:\tPin Complex\n", wid); dprintf("%ld:\tPin Complex\n", wid);
verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAM, verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, VID_GET_PARAMETER,
PID_PIN_CAP); PID_PIN_CAP);
if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) { if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) {
audioGroup->widgets[widx].d.pin.input = resp[0] & (1 << 5); audioGroup->widgets[widx].d.pin.input = resp[0] & (1 << 5);
@@ -270,7 +272,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
} }
verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid,
VID_GET_CFGDEFAULT, 0); VID_GET_CONFIGURATION_DEFAULT, 0);
if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) { if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) {
audioGroup->widgets[widx].d.pin.device = (pin_dev_type) audioGroup->widgets[widx].d.pin.device = (pin_dev_type)
((resp[0] >> 20) & 0xf); ((resp[0] >> 20) & 0xf);
@@ -307,7 +309,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
if (audioGroup->widgets[widx].num_inputs) { if (audioGroup->widgets[widx].num_inputs) {
if (audioGroup->widgets[widx].num_inputs > 1) { if (audioGroup->widgets[widx].num_inputs > 1) {
verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid,
VID_GET_CONNSEL, 0); VID_GET_CONNECTION_SELECT, 0);
if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK)
audioGroup->widgets[widx].active_input = resp[0] & 0xFF; audioGroup->widgets[widx].active_input = resp[0] & 0xFF;
else else
@@ -320,7 +322,7 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup)
for (uint32 i = 0; i < audioGroup->widgets[widx].num_inputs; i++) { for (uint32 i = 0; i < audioGroup->widgets[widx].num_inputs; i++) {
if (!(i % 4)) { if (!(i % 4)) {
verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid, verbs[0] = MAKE_VERB(audioGroup->codec->addr, wid,
VID_GET_CONNLENTRY, i); VID_GET_CONNECTION_LIST_ENTRY, i);
if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) != B_OK) { if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) != B_OK) {
dprintf("%s: Error parsing inputs for widget %ld!\n", dprintf("%s: Error parsing inputs for widget %ld!\n",
__func__, wid); __func__, wid);
@@ -440,7 +442,7 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID)
if (audioGroup->playback_stream == NULL if (audioGroup->playback_stream == NULL
&& audioGroup->widgets[i].type == WT_PIN_COMPLEX && audioGroup->widgets[i].type == WT_PIN_COMPLEX
&& audioGroup->widgets[i].d.pin.output) { && audioGroup->widgets[i].d.pin.output) {
if (audioGroup->widgets[i].d.pin.device == PIN_DEV_HP_OUT if (audioGroup->widgets[i].d.pin.device == PIN_DEV_HEAD_PHONE_OUT
|| audioGroup->widgets[i].d.pin.device == PIN_DEV_SPEAKER || audioGroup->widgets[i].d.pin.device == PIN_DEV_SPEAKER
|| audioGroup->widgets[i].d.pin.device == PIN_DEV_LINE_OUT) { || audioGroup->widgets[i].d.pin.device == PIN_DEV_LINE_OUT) {
int32 inputIndex = audioGroup->widgets[i].active_input; int32 inputIndex = audioGroup->widgets[i].active_input;
@@ -456,8 +458,8 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID)
WT_AUDIO_OUTPUT, 0); WT_AUDIO_OUTPUT, 0);
if (outputWidget) { if (outputWidget) {
corb_t verb = MAKE_VERB(codec->addr, corb_t verb = MAKE_VERB(codec->addr,
i + audioGroup->widget_start, VID_SET_CONNSEL, i + audioGroup->widget_start,
inputIndex); VID_SET_CONNECTION_SELECT, inputIndex);
if (hda_send_verbs(codec, &verb, NULL, 1) != B_OK) if (hda_send_verbs(codec, &verb, NULL, 1) != B_OK)
dprintf("%s: Setting output selector failed!\n", __func__); dprintf("%s: Setting output selector failed!\n", __func__);
break; break;
@@ -482,11 +484,11 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID)
/* FIXME: Force Pin Widget to unmute; enable hp/output */ /* FIXME: Force Pin Widget to unmute; enable hp/output */
verb[0] = MAKE_VERB(codec->addr, verb[0] = MAKE_VERB(codec->addr,
audioGroup->playback_stream->pin_widget, audioGroup->playback_stream->pin_widget,
VID_SET_AMPGAINMUTE, VID_SET_AMPLIFIER_GAIN_MUTE,
(1 << 15) | (1 << 13) | (1 << 12)); (1 << 15) | (1 << 13) | (1 << 12));
verb[1] = MAKE_VERB(codec->addr, verb[1] = MAKE_VERB(codec->addr,
audioGroup->playback_stream->pin_widget, audioGroup->playback_stream->pin_widget,
VID_SET_PINWCTRL, VID_SET_PIN_WIDGET_CONTROL,
(1 << 7) | (1 << 6)); (1 << 7) | (1 << 6));
hda_send_verbs(codec, verb, NULL, 2); hda_send_verbs(codec, verb, NULL, 2);
@@ -512,8 +514,8 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID)
WT_PIN_COMPLEX, 0); WT_PIN_COMPLEX, 0);
if (inputWidget) { if (inputWidget) {
corb_t verb = MAKE_VERB(codec->addr, corb_t verb = MAKE_VERB(codec->addr,
i + audioGroup->widget_start, VID_SET_CONNSEL, i + audioGroup->widget_start,
inputIndex); VID_SET_CONNECTION_SELECT, inputIndex);
if (hda_send_verbs(codec, &verb, NULL, 1) != B_OK) { if (hda_send_verbs(codec, &verb, NULL, 1) != B_OK) {
dprintf("%s: Setting input selector failed!\n", dprintf("%s: Setting input selector failed!\n",
__func__); __func__);
@@ -538,7 +540,8 @@ hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID)
/* FIXME: Force Pin Widget to unmute */ /* FIXME: Force Pin Widget to unmute */
verb = MAKE_VERB(codec->addr, verb = MAKE_VERB(codec->addr,
audioGroup->record_stream->pin_widget, audioGroup->record_stream->pin_widget,
VID_SET_AMPGAINMUTE, (1 << 15) | (1 << 13) | (1 << 12)); VID_SET_AMPLIFIER_GAIN_MUTE,
(1 << 15) | (1 << 13) | (1 << 12));
hda_send_verbs(codec, &verb, NULL, 1); hda_send_verbs(codec, &verb, NULL, 1);
} }
@@ -599,9 +602,9 @@ hda_codec_new(hda_controller* controller, uint32 cad)
codec->response_sem = create_sem(0, "hda_codec_response_sem"); codec->response_sem = create_sem(0, "hda_codec_response_sem");
controller->codecs[cad] = codec; controller->codecs[cad] = codec;
verbs[0] = MAKE_VERB(cad, 0, VID_GET_PARAM, PID_VENDORID); verbs[0] = MAKE_VERB(cad, 0, VID_GET_PARAMETER, PID_VENDOR_ID);
verbs[1] = MAKE_VERB(cad, 0, VID_GET_PARAM, PID_REVISIONID); verbs[1] = MAKE_VERB(cad, 0, VID_GET_PARAMETER, PID_REVISION_ID);
verbs[2] = MAKE_VERB(cad, 0, VID_GET_PARAM, PID_SUBORD_NODE_COUNT); verbs[2] = MAKE_VERB(cad, 0, VID_GET_PARAMETER, PID_SUBORD_NODE_COUNT);
if (hda_send_verbs(codec, verbs, responses, 3) != B_OK) if (hda_send_verbs(codec, verbs, responses, 3) != B_OK)
goto cmd_failed; goto cmd_failed;
@@ -612,7 +615,8 @@ hda_codec_new(hda_controller* controller, uint32 cad)
for (nodeID = responses[2] >> 16; for (nodeID = responses[2] >> 16;
nodeID < (responses[2] >> 16) + (responses[2] & 0xff); nodeID++) { nodeID < (responses[2] >> 16) + (responses[2] & 0xff); nodeID++) {
uint32 resp; uint32 resp;
verbs[0] = MAKE_VERB(cad, nodeID, VID_GET_PARAM, PID_FUNCGRP_TYPE); verbs[0] = MAKE_VERB(cad, nodeID, VID_GET_PARAMETER,
PID_FUNCTION_GROUP_TYPE);
if (hda_send_verbs(codec, verbs, &resp, 1) != B_OK) if (hda_send_verbs(codec, verbs, &resp, 1) != B_OK)
goto cmd_failed; goto cmd_failed;
@@ -24,7 +24,7 @@ enum hda_widget_type {
enum pin_dev_type { enum pin_dev_type {
PIN_DEV_LINE_OUT = 0, PIN_DEV_LINE_OUT = 0,
PIN_DEV_SPEAKER, PIN_DEV_SPEAKER,
PIN_DEV_HP_OUT, PIN_DEV_HEAD_PHONE_OUT,
PIN_DEV_CD, PIN_DEV_CD,
PIN_DEV_SPDIF_OUT, PIN_DEV_SPDIF_OUT,
PIN_DEV_DIGITAL_OTHER_OUT, PIN_DEV_DIGITAL_OTHER_OUT,
@@ -46,31 +46,31 @@ enum pin_dev_type {
(((cad) << 28) | ((nid) << 20) | (vid) | (payload)) (((cad) << 28) | ((nid) << 20) | (vid) | (payload))
/* Verb IDs */ /* Verb IDs */
#define VID_GET_PARAM 0xF0000 #define VID_GET_PARAMETER 0xf0000
#define VID_GET_CONNSEL 0xF0100 #define VID_GET_CONNECTION_SELECT 0xf0100
#define VID_SET_CONNSEL 0x70100 #define VID_SET_CONNECTION_SELECT 0x70100
#define VID_GET_CONNLENTRY 0xF0200 #define VID_GET_CONNECTION_LIST_ENTRY 0xf0200
#define VID_GET_PROCSTATE 0xF0300 #define VID_GET_PROCESSING_STATE 0xf0300
#define VID_SET_PROCSTATE 0x70300 #define VID_SET_PROCESSING_STATE 0x70300
#define VID_GET_COEFFIDX 0xD0000 #define VID_GET_COEFFICIENT_INDEX 0xd0000
#define VID_SET_COEFFIDX 0x50000 #define VID_SET_COEFFICIENT_INDEX 0x50000
#define VID_GET_PROCCOEFF 0xC0000 #define VID_GET_PROCESSING_COEFFICIENT 0xc0000
#define VID_SET_PROCCOEFF 0x40000 #define VID_SET_PROCESSING_COEFFICIENT 0x40000
#define VID_GET_AMPGAINMUTE 0xB0000 #define VID_GET_AMPLIFIER_GAIN_MUTE 0xb0000
#define VID_SET_AMPGAINMUTE 0x30000 #define VID_SET_AMPLIFIER_GAIN_MUTE 0x30000
#define VID_GET_CONVERTER_FORMAT 0xa0000 #define VID_GET_CONVERTER_FORMAT 0xa0000
#define VID_SET_CONVERTER_FORMAT 0x20000 #define VID_SET_CONVERTER_FORMAT 0x20000
#define VID_GET_CONVERTER_STREAM_CHANNEL 0xf0600 #define VID_GET_CONVERTER_STREAM_CHANNEL 0xf0600
#define VID_SET_CONVERTER_STREAM_CHANNEL 0x70600 #define VID_SET_CONVERTER_STREAM_CHANNEL 0x70600
#define VID_GET_DIGCVTCTRL 0xF0D00 #define VID_GET_DIGITAL_CONVERTER_CONTROL 0xf0d00
#define VID_SET_DIGCVTCTRL1 0x70D00 #define VID_SET_DIGITAL_CONVERTER_CONTROL1 0x70d00
#define VID_SET_DIGCVTCTRL2 0x70E00 #define VID_SET_DIGITAL_CONVERTER_CONTROL2 0x70e00
#define VID_GET_POWERSTATE 0xF0500 #define VID_GET_POWER_STATE 0xf0500
#define VID_SET_POWERSTATE 0x70500 #define VID_SET_POWER_STATE 0x70500
#define VID_GET_SDISELECT 0xF0400 #define VID_GET_SDI_SELECT 0xf0400
#define VID_SET_SDISELECT 0x70400 #define VID_SET_SDI_SELECT 0x70400
#define VID_GET_PINWCTRL 0xF0700 #define VID_GET_PIN_WIDGET_CONTROL 0xf0700
#define VID_SET_PINWCTRL 0x70700 #define VID_SET_PIN_WIDGET_CONTROL 0x70700
#define VID_GET_UNSOLRESP 0xF0800 #define VID_GET_UNSOLRESP 0xF0800
#define VID_SET_UNSOLRESP 0x70800 #define VID_SET_UNSOLRESP 0x70800
#define VID_GET_PINSENSE 0xF0900 #define VID_GET_PINSENSE 0xF0900
@@ -108,27 +108,27 @@ enum pin_dev_type {
#define VID_SET_SUBSYSTEMID2 0x72100 #define VID_SET_SUBSYSTEMID2 0x72100
#define VID_SET_SUBSYSTEMID3 0x72200 #define VID_SET_SUBSYSTEMID3 0x72200
#define VID_SET_SUBSYSTEMID4 0x72300 #define VID_SET_SUBSYSTEMID4 0x72300
#define VID_GET_CFGDEFAULT 0xF1C00 #define VID_GET_CONFIGURATION_DEFAULT 0xf1c00
#define VID_SET_CFGDEFAULT1 0x71C00 #define VID_SET_CONFIGURATION_DEFAULT1 0x71c00
#define VID_SET_CFGDEFAULT2 0x71D00 #define VID_SET_CONFIGURATION_DEFAULT2 0x71d00
#define VID_SET_CFGDEFAULT3 0x71E00 #define VID_SET_CONFIGURATION_DEFAULT3 0x71e00
#define VID_SET_CFGDEFAULT4 0x71F00 #define VID_SET_CONFIGURATION_DEFAULT4 0x71f00
#define VID_GET_STRIPECTRL 0xF2400 #define VID_GET_STRIPECTRL 0xF2400
#define VID_SET_STRIPECTRL 0x72000 #define VID_SET_STRIPECTRL 0x72000
#define VID_FUNCTION_RESET 0x7FF00 #define VID_FUNCTION_RESET 0x7FF00
/* Parameter IDs */ /* Parameter IDs */
#define PID_VENDORID 0x00 #define PID_VENDOR_ID 0x00
#define PID_REVISIONID 0x02 #define PID_REVISION_ID 0x02
#define PID_SUBORD_NODE_COUNT 0x04 #define PID_SUBORD_NODE_COUNT 0x04
#define PID_FUNCGRP_TYPE 0x05 #define PID_FUNCTION_GROUP_TYPE 0x05
#define PID_AUDIO_FG_CAP 0x08 #define PID_AUDIO_GROUP_CAP 0x08
#define PID_AUDIO_WIDGET_CAP 0x09 #define PID_AUDIO_WIDGET_CAP 0x09
#define PID_PCM_SUPPORT 0x0A #define PID_PCM_SUPPORT 0x0A
#define PID_STREAM_SUPPORT 0x0B #define PID_STREAM_SUPPORT 0x0B
#define PID_PIN_CAP 0x0C #define PID_PIN_CAP 0x0C
#define PID_INPUT_AMP_CAP 0x0D #define PID_INPUT_AMP_CAP 0x0D
#define PID_CONNLIST_LEN 0x0E #define PID_CONNECTION_LIST_LENGTH 0x0E
#define PID_POWERSTATE_SUPPORT 0x0F #define PID_POWERSTATE_SUPPORT 0x0F
#define PID_PROCESSING_CAP 0x10 #define PID_PROCESSING_CAP 0x10
#define PID_GPIO_COUNT 0x11 #define PID_GPIO_COUNT 0x11
@@ -171,7 +171,7 @@ hda_interrupt_handler(hda_controller* controller)
controller->streams[index]); controller->streams[index]);
} else { } else {
dprintf("hda: Stream interrupt for unconfigured stream " dprintf("hda: Stream interrupt for unconfigured stream "
"%d!\n", index); "%ld!\n", index);
} }
} }
} }