1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2022 Intel Corporation. All rights reserved. 4 */ 5 6 #ifndef __IPC_PROBE_DMA_FRAME_H__ 7 #define __IPC_PROBE_DMA_FRAME_H__ 8 9 #include <rtos/bit.h> 10 11 /** 12 * Header for data packets sent via compressed PCM from extraction probes 13 */ 14 struct probe_data_packet { 15 uint32_t sync_word; /**< PROBE_EXTRACT_SYNC_WORD */ 16 uint32_t buffer_id; /**< Buffer ID from which data was extracted */ 17 uint32_t format; /**< Encoded data format */ 18 uint32_t timestamp_low; /**< Low 32 bits of timestamp in us */ 19 uint32_t timestamp_high; /**< High 32 bits of timestamp in us */ 20 uint32_t data_size_bytes; /**< Size of following audio data */ 21 uint8_t data[]; /**< Audio data extracted from buffer */ 22 } __attribute__((packed, aligned(4))); 23 24 #define PROBE_EXTRACT_SYNC_WORD 0xBABEBEBA 25 26 /** 27 * \brief Definitions of shifts and masks for format encoding in probe 28 * extraction stream 29 * 30 * Audio format from extraction probes is encoded as 32 bit value. Following 31 * graphic explains encoding. 32 * 33 * A|BBBB|CCCC|DDDD|EEEEE|FF|GG|H|I|J|XXXXXXX 34 * A - 1 bit - Specifies Type Encoding - 1 for Standard encoding 35 * B - 4 bits - Specify Standard Type - 0 for Audio 36 * C - 4 bits - Specify Audio format - 0 for PCM 37 * D - 4 bits - Specify Sample Rate - value enumerating standard sample rates: 38 * 8000 Hz = 0x0 39 * 11025 Hz = 0x1 40 * 12000 Hz = 0x2 41 * 16000 Hz = 0x3 42 * 22050 Hz = 0x4 43 * 24000 Hz = 0x5 44 * 32000 Hz = 0x6 45 * 44100 Hz = 0x7 46 * 48000 Hz = 0x8 47 * 64000 Hz = 0x9 48 * 88200 Hz = 0xA 49 * 96000 Hz = 0xB 50 * 128000 Hz = 0xC 51 * 176400 Hz = 0xD 52 * 192000 Hz = 0xE 53 * none of the above = 0xF 54 * E - 5 bits - Specify Number of Channels minus 1 55 * F - 2 bits - Specify Sample Size, number of valid sample bytes minus 1 56 * G - 2 bits - Specify Container Size, number of container bytes minus 1 57 * H - 1 bit - Specifies Sample Format - 0 for Integer, 1 for Floating point 58 * I - 1 bit - Specifies Sample Endianness - 0 for LE 59 * J - 1 bit - Specifies Interleaving - 1 for Sample Interleaving 60 */ 61 #define PROBE_SHIFT_FMT_TYPE 31 62 #define PROBE_SHIFT_STANDARD_TYPE 27 63 #define PROBE_SHIFT_AUDIO_FMT 23 64 #define PROBE_SHIFT_SAMPLE_RATE 19 65 #define PROBE_SHIFT_NB_CHANNELS 14 66 #define PROBE_SHIFT_SAMPLE_SIZE 12 67 #define PROBE_SHIFT_CONTAINER_SIZE 10 68 #define PROBE_SHIFT_SAMPLE_FMT 9 69 #define PROBE_SHIFT_SAMPLE_END 8 70 #define PROBE_SHIFT_INTERLEAVING_ST 7 71 72 #define PROBE_MASK_FMT_TYPE MASK(31, 31) 73 #define PROBE_MASK_STANDARD_TYPE MASK(30, 27) 74 #define PROBE_MASK_AUDIO_FMT MASK(26, 23) 75 #define PROBE_MASK_SAMPLE_RATE MASK(22, 19) 76 #define PROBE_MASK_NB_CHANNELS MASK(18, 14) 77 #define PROBE_MASK_SAMPLE_SIZE MASK(13, 12) 78 #define PROBE_MASK_CONTAINER_SIZE MASK(11, 10) 79 #define PROBE_MASK_SAMPLE_FMT MASK(9, 9) 80 #define PROBE_MASK_SAMPLE_END MASK(8, 8) 81 #define PROBE_MASK_INTERLEAVING_ST MASK(7, 7) 82 83 #endif 84