1 // Copyright 2020 The Chromium OS Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 pub const JACK_INFO: u32 = 1; 5 pub const JACK_REMAP: u32 = 2; 6 7 pub const STREAM_INFO: u32 = 0x0100; 8 pub const STREAM_SET_PARAMS: u32 = 0x0100 + 1; 9 pub const STREAM_PREPARE: u32 = 0x0100 + 2; 10 pub const STREAM_RELEASE: u32 = 0x0100 + 3; 11 pub const STREAM_START: u32 = 0x0100 + 4; 12 pub const STREAM_STOP: u32 = 0x0100 + 5; 13 14 pub const CHANNEL_MAP_INFO: u32 = 0x0200; 15 16 pub const VIRTIO_SND_D_OUTPUT: u8 = 0; 17 pub const VIRTIO_SND_D_INPUT: u8 = 1; 18 19 /* supported PCM stream features */ 20 pub const VIRTIO_SND_PCM_F_SHMEM_HOST: u8 = 0; 21 pub const VIRTIO_SND_PCM_F_SHMEM_GUEST: u8 = 1; 22 pub const VIRTIO_SND_PCM_F_MSG_POLLING: u8 = 2; 23 pub const VIRTIO_SND_PCM_F_EVT_SHMEM_PERIODS: u8 = 3; 24 pub const VIRTIO_SND_PCM_F_EVT_XRUNS: u8 = 4; 25 26 /* supported PCM sample formats */ 27 pub const VIRTIO_SND_PCM_FMT_IMA_ADPCM: u8 = 0; 28 pub const VIRTIO_SND_PCM_FMT_MU_LAW: u8 = 1; 29 pub const VIRTIO_SND_PCM_FMT_A_LAW: u8 = 2; 30 pub const VIRTIO_SND_PCM_FMT_S8: u8 = 3; 31 pub const VIRTIO_SND_PCM_FMT_U8: u8 = 4; 32 pub const VIRTIO_SND_PCM_FMT_S16: u8 = 5; 33 pub const VIRTIO_SND_PCM_FMT_U16: u8 = 6; 34 pub const VIRTIO_SND_PCM_FMT_S18_3: u8 = 7; 35 pub const VIRTIO_SND_PCM_FMT_U18_3: u8 = 8; 36 pub const VIRTIO_SND_PCM_FMT_S20_3: u8 = 9; 37 pub const VIRTIO_SND_PCM_FMT_U20_3: u8 = 10; 38 pub const VIRTIO_SND_PCM_FMT_S24_3: u8 = 11; 39 pub const VIRTIO_SND_PCM_FMT_U24_3: u8 = 12; 40 pub const VIRTIO_SND_PCM_FMT_S20: u8 = 13; 41 pub const VIRTIO_SND_PCM_FMT_U20: u8 = 14; 42 pub const VIRTIO_SND_PCM_FMT_S24: u8 = 15; 43 pub const VIRTIO_SND_PCM_FMT_U24: u8 = 16; 44 pub const VIRTIO_SND_PCM_FMT_S32: u8 = 17; 45 pub const VIRTIO_SND_PCM_FMT_U32: u8 = 18; 46 pub const VIRTIO_SND_PCM_FMT_FLOAT: u8 = 19; 47 pub const VIRTIO_SND_PCM_FMT_FLOAT64: u8 = 20; 48 pub const VIRTIO_SND_PCM_FMT_DSD_U8: u8 = 21; 49 pub const VIRTIO_SND_PCM_FMT_DSD_U16: u8 = 22; 50 pub const VIRTIO_SND_PCM_FMT_DSD_U32: u8 = 23; 51 pub const VIRTIO_SND_PCM_FMT_IEC958_SUBFRAME: u8 = 24; 52 53 pub const VIRTIO_SND_PCM_RATE_5512: u8 = 0; 54 pub const VIRTIO_SND_PCM_RATE_8000: u8 = 1; 55 pub const VIRTIO_SND_PCM_RATE_11025: u8 = 2; 56 pub const VIRTIO_SND_PCM_RATE_16000: u8 = 3; 57 pub const VIRTIO_SND_PCM_RATE_22050: u8 = 4; 58 pub const VIRTIO_SND_PCM_RATE_32000: u8 = 5; 59 pub const VIRTIO_SND_PCM_RATE_44100: u8 = 6; 60 pub const VIRTIO_SND_PCM_RATE_48000: u8 = 7; 61 pub const VIRTIO_SND_PCM_RATE_64000: u8 = 8; 62 pub const VIRTIO_SND_PCM_RATE_88200: u8 = 9; 63 pub const VIRTIO_SND_PCM_RATE_96000: u8 = 10; 64 pub const VIRTIO_SND_PCM_RATE_176400: u8 = 11; 65 pub const VIRTIO_SND_PCM_RATE_192000: u8 = 12; 66 pub const VIRTIO_SND_PCM_RATE_384000: u8 = 13; 67 68 // From https://github.com/oasis-tcs/virtio-spec/blob/master/virtio-sound.tex 69 /* jack control request types */ 70 pub const VIRTIO_SND_R_JACK_INFO: u32 = 1; 71 pub const VIRTIO_SND_R_JACK_REMAP: u32 = 2; 72 73 /* PCM control request types */ 74 pub const VIRTIO_SND_R_PCM_INFO: u32 = 0x0100; 75 pub const VIRTIO_SND_R_PCM_SET_PARAMS: u32 = 0x0101; 76 pub const VIRTIO_SND_R_PCM_PREPARE: u32 = 0x0102; 77 pub const VIRTIO_SND_R_PCM_RELEASE: u32 = 0x0103; 78 pub const VIRTIO_SND_R_PCM_START: u32 = 0x0104; 79 pub const VIRTIO_SND_R_PCM_STOP: u32 = 0x0105; 80 81 /* channel map control request types */ 82 pub const VIRTIO_SND_R_CHMAP_INFO: u32 = 0x0200; 83 84 /* jack event types */ 85 pub const VIRTIO_SND_EVT_JACK_CONNECTED: u32 = 0x1000; 86 pub const VIRTIO_SND_EVT_JACK_DISCONNECTED: u32 = 0x1001; 87 88 /* PCM event types */ 89 pub const VIRTIO_SND_EVT_PCM_PERIOD_ELAPSED: u32 = 0x1100; 90 pub const VIRTIO_SND_EVT_PCM_XRUN: u32 = 0x1101; 91 92 /* common status codes */ 93 pub const VIRTIO_SND_S_OK: u32 = 0x8000; 94 pub const VIRTIO_SND_S_BAD_MSG: u32 = 0x8001; 95 pub const VIRTIO_SND_S_NOT_SUPP: u32 = 0x8002; 96 pub const VIRTIO_SND_S_IO_ERR: u32 = 0x8003; 97 98 pub const VIRTIO_SND_JACK_F_REMAP: u32 = 0; 99 100 /* standard channel position definition */ 101 pub const VIRTIO_SND_CHMAP_NONE: u32 = 0; /* undefined */ 102 pub const VIRTIO_SND_CHMAP_NA: u32 = 1; /* silent */ 103 pub const VIRTIO_SND_CHMAP_MONO: u32 = 2; /* mono stream */ 104 pub const VIRTIO_SND_CHMAP_FL: u32 = 3; /* front left */ 105 pub const VIRTIO_SND_CHMAP_FR: u32 = 4; /* front right */ 106 pub const VIRTIO_SND_CHMAP_RL: u32 = 5; /* rear left */ 107 pub const VIRTIO_SND_CHMAP_RR: u32 = 6; /* rear right */ 108 pub const VIRTIO_SND_CHMAP_FC: u32 = 7; /* front center */ 109 pub const VIRTIO_SND_CHMAP_LFE: u32 = 8; /* low frequency (LFE) */ 110 pub const VIRTIO_SND_CHMAP_SL: u32 = 9; /* side left */ 111 pub const VIRTIO_SND_CHMAP_SR: u32 = 10; /* side right */ 112 pub const VIRTIO_SND_CHMAP_RC: u32 = 11; /* rear center */ 113 pub const VIRTIO_SND_CHMAP_FLC: u32 = 12; /* front left center */ 114 pub const VIRTIO_SND_CHMAP_FRC: u32 = 13; /* front right center */ 115 pub const VIRTIO_SND_CHMAP_RLC: u32 = 14; /* rear left center */ 116 pub const VIRTIO_SND_CHMAP_RRC: u32 = 15; /* rear right center */ 117 pub const VIRTIO_SND_CHMAP_FLW: u32 = 16; /* front left wide */ 118 pub const VIRTIO_SND_CHMAP_FRW: u32 = 17; /* front right wide */ 119 pub const VIRTIO_SND_CHMAP_FLH: u32 = 18; /* front left high */ 120 pub const VIRTIO_SND_CHMAP_FCH: u32 = 19; /* front center high */ 121 pub const VIRTIO_SND_CHMAP_FRH: u32 = 20; /* front right high */ 122 pub const VIRTIO_SND_CHMAP_TC: u32 = 21; /* top center */ 123 pub const VIRTIO_SND_CHMAP_TFL: u32 = 22; /* top front left */ 124 pub const VIRTIO_SND_CHMAP_TFR: u32 = 23; /* top front right */ 125 pub const VIRTIO_SND_CHMAP_TFC: u32 = 24; /* top front center */ 126 pub const VIRTIO_SND_CHMAP_TRL: u32 = 25; /* top rear left */ 127 pub const VIRTIO_SND_CHMAP_TRR: u32 = 26; /* top rear right */ 128 pub const VIRTIO_SND_CHMAP_TRC: u32 = 27; /* top rear center */ 129 pub const VIRTIO_SND_CHMAP_TFLC: u32 = 28; /* top front left center */ 130 pub const VIRTIO_SND_CHMAP_TFRC: u32 = 29; /* top front right center */ 131 pub const VIRTIO_SND_CHMAP_TSL: u32 = 34; /* top side left */ 132 pub const VIRTIO_SND_CHMAP_TSR: u32 = 35; /* top side right */ 133 pub const VIRTIO_SND_CHMAP_LLFE: u32 = 36; /* left LFE */ 134 pub const VIRTIO_SND_CHMAP_RLFE: u32 = 37; /* right LFE */ 135 pub const VIRTIO_SND_CHMAP_BC: u32 = 38; /* bottom center */ 136 pub const VIRTIO_SND_CHMAP_BLC: u32 = 39; /* bottom left center */ 137 pub const VIRTIO_SND_CHMAP_BRC: u32 = 40; /* bottom right center */ 138 139 pub const VIRTIO_SND_CHMAP_MAX_SIZE: usize = 18; 140