Skip to content

Commit e7a3d6a

Browse files
committed
ipc4: more cleanup
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 4c7cee1 commit e7a3d6a

File tree

6 files changed

+147
-190
lines changed

6 files changed

+147
-190
lines changed

src/audio/copier.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ DECLARE_SOF_RT_UUID("copier", copier_comp_uuid, 0x9ba00c83, 0xca12, 0x4a83,
4141

4242
DECLARE_TR_CTX(copier_comp_tr, SOF_UUID(copier_comp_uuid), LOG_LEVEL_INFO);
4343

44-
static enum sof_ipc_frame convert_fmt(int format) {
44+
static enum sof_ipc_frame convert_fmt(int format)
45+
{
4546
enum sof_ipc_frame in;
4647

4748
switch (format) {
48-
case DEPTH_16BIT:
49+
case IPC4_DEPTH_16BIT:
4950
in = SOF_IPC_FRAME_S16_LE;
5051
break;
51-
case DEPTH_24BIT:
52+
case IPC4_DEPTH_24BIT:
5253
in = SOF_IPC_FRAME_S24_4LE;
5354
break;
54-
case DEPTH_32BIT:
55+
case IPC4_DEPTH_32BIT:
5556
in = SOF_IPC_FRAME_S32_LE;
5657
break;
5758
default:
@@ -63,7 +64,7 @@ static enum sof_ipc_frame convert_fmt(int format) {
6364
}
6465

6566
static struct comp_dev *create_host(struct comp_ipc_config *config,
66-
struct CopierModuleCfg *copier_cfg, int dir, struct pipeline *pipeline)
67+
struct ipc4_copier_module_cfg *copier_cfg, int dir, struct pipeline *pipeline)
6768
{
6869
struct sof_uuid host = {0x8b9d100c, 0x6d78, 0x418f, {0x90, 0xa3, 0xe0,
6970
0xe8, 0x05, 0xd0, 0x85, 0x2b}};
@@ -103,7 +104,7 @@ static void connect_comp_to_buffer(struct comp_dev *dev, struct comp_buffer *buf
103104
dcache_writeback_invalidate_region(buf, sizeof(*buf));
104105
}
105106

106-
static struct comp_buffer *create_buffer(struct comp_dev *dev, struct CopierModuleCfg *copier,
107+
static struct comp_buffer *create_buffer(struct comp_dev *dev, struct ipc4_copier_module_cfg *copier,
107108
int dir)
108109
{
109110
struct sof_ipc_buffer ipc_buf;
@@ -135,7 +136,7 @@ static struct comp_buffer *create_buffer(struct comp_dev *dev, struct CopierModu
135136
return buf;
136137
}
137138

138-
static struct comp_dev *create_dai(struct comp_ipc_config *config, struct CopierModuleCfg *copier,
139+
static struct comp_dev *create_dai(struct comp_ipc_config *config, struct ipc4_copier_module_cfg *copier,
139140
union ipc4_connector_node_id *node_id, struct pipeline *pipeline)
140141
{
141142
struct sof_uuid id = {0xc2b00d27, 0xffbc, 0x4150, {0xa5, 0x1a, 0x24,
@@ -208,7 +209,7 @@ static struct comp_dev *copier_new(const struct comp_driver *drv,
208209
struct comp_ipc_config *config,
209210
void *spec)
210211
{
211-
struct CopierModuleCfg *copier = spec;
212+
struct ipc4_copier_module_cfg *copier = spec;
212213
union ipc4_connector_node_id node_id;
213214
struct ipc *ipc = ipc_get();
214215
struct copier_data *cd;

src/include/ipc4/base-config.h

Lines changed: 66 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -27,64 +27,72 @@
2727
#include <stdint.h>
2828

2929
enum ipc4_sampling_frequency {
30-
FS_8000HZ = 8000,
31-
FS_11025HZ = 11025,
32-
FS_12000HZ = 12000, /**< Mp3, AAC, SRC only. */
33-
FS_16000HZ = 16000,
34-
FS_18900HZ = 18900, /**< SRC only for 44100 */
35-
FS_22050HZ = 22050,
36-
FS_24000HZ = 24000, /**< Mp3, AAC, SRC only. */
37-
FS_32000HZ = 32000,
38-
FS_37800HZ = 37800, /**< SRC only for 44100 */
39-
FS_44100HZ = 44100,
40-
FS_48000HZ = 48000, /**< Default. */
41-
FS_64000HZ = 64000, /**< AAC, SRC only. */
42-
FS_88200HZ = 88200, /**< AAC, SRC only. */
43-
FS_96000HZ = 96000, /**< AAC, SRC only. */
44-
FS_176400HZ = 176400, /**< SRC only. */
45-
FS_192000HZ = 192000, /**< SRC only. */
46-
FS_INVALID
30+
IPC4_FS_8000HZ = 8000,
31+
IPC4_FS_11025HZ = 11025,
32+
IPC4_FS_12000HZ = 12000, /**< Mp3, AAC, SRC only. */
33+
IPC4_FS_16000HZ = 16000,
34+
IPC4_FS_18900HZ = 18900, /**< SRC only for 44100 */
35+
IPC4_FS_22050HZ = 22050,
36+
IPC4_FS_24000HZ = 24000, /**< Mp3, AAC, SRC only. */
37+
IPC4_FS_32000HZ = 32000,
38+
IPC4_FS_37800HZ = 37800, /**< SRC only for 44100 */
39+
IPC4_FS_44100HZ = 44100,
40+
IPC4_FS_48000HZ = 48000, /**< Default. */
41+
IPC4_FS_64000HZ = 64000, /**< AAC, SRC only. */
42+
IPC4_FS_88200HZ = 88200, /**< AAC, SRC only. */
43+
IPC4_FS_96000HZ = 96000, /**< AAC, SRC only. */
44+
IPC4_FS_176400HZ = 176400, /**< SRC only. */
45+
IPC4_FS_192000HZ = 192000, /**< SRC only. */
46+
IPC4_FS_INVALID
4747
};
4848

4949
enum ipc4_bit_depth {
50-
DEPTH_8BIT = 8, /**< 8 bits depth */
51-
DEPTH_16BIT = 16, /**< 16 bits depth */
52-
DEPTH_24BIT = 24, /**< 24 bits depth - Default */
53-
DEPTH_32BIT = 32, /**< 32 bits depth */
54-
DEPTH_64BIT = 64, /**< 64 bits depth */
55-
DEPTH_INVALID
50+
IPC4_DEPTH_8BIT = 8, /**< 8 bits depth */
51+
IPC4_DEPTH_16BIT = 16, /**< 16 bits depth */
52+
IPC4_DEPTH_24BIT = 24, /**< 24 bits depth - Default */
53+
IPC4_DEPTH_32BIT = 32, /**< 32 bits depth */
54+
IPC4_DEPTH_64BIT = 64, /**< 64 bits depth */
55+
IPC4_DEPTH_INVALID
5656
};
5757

5858
enum ipc4_channel_config {
59-
CHANNEL_CONFIG_MONO = 0, /**< one channel only. */
60-
CHANNEL_CONFIG_STEREO = 1, /**< L & R. */
61-
CHANNEL_CONFIG_2_POINT_1 = 2, /**< L, R & LFE; PCM only. */
62-
CHANNEL_CONFIG_3_POINT_0 = 3, /**< L, C & R; MP3 & AAC only. */
63-
CHANNEL_CONFIG_3_POINT_1 = 4, /**< L, C, R & LFE; PCM only. */
64-
CHANNEL_CONFIG_QUATRO = 5, /**< L, R, Ls & Rs; PCM only. */
65-
CHANNEL_CONFIG_4_POINT_0 = 6, /**< L, C, R & Cs; MP3 & AAC only. */
66-
CHANNEL_CONFIG_5_POINT_0 = 7, /**< L, C, R, Ls & Rs. */
67-
CHANNEL_CONFIG_5_POINT_1 = 8, /**< L, C, R, Ls, Rs & LFE. */
68-
CHANNEL_CONFIG_DUAL_MONO = 9, /**< one channel replicated in two. */
59+
IPC4_CHANNEL_CONFIG_MONO = 0, /**< one channel only. */
60+
IPC4_CHANNEL_CONFIG_STEREO = 1, /**< L & R. */
61+
IPC4_CHANNEL_CONFIG_2_POINT_1 = 2, /**< L, R & LFE; PCM only. */
62+
IPC4_CHANNEL_CONFIG_3_POINT_0 = 3, /**< L, C & R; MP3 & AAC only. */
63+
IPC4_CHANNEL_CONFIG_3_POINT_1 = 4, /**< L, C, R & LFE; PCM only. */
64+
IPC4_CHANNEL_CONFIG_QUATRO = 5, /**< L, R, Ls & Rs; PCM only. */
65+
IPC4_CHANNEL_CONFIG_4_POINT_0 = 6, /**< L, C, R & Cs; MP3 & AAC only. */
66+
IPC4_CHANNEL_CONFIG_5_POINT_0 = 7, /**< L, C, R, Ls & Rs. */
67+
IPC4_CHANNEL_CONFIG_5_POINT_1 = 8, /**< L, C, R, Ls, Rs & LFE. */
68+
IPC4_CHANNEL_CONFIG_DUAL_MONO = 9, /**< one channel replicated in two. */
6969
/**< Stereo (L,R) in 4 slots, 1st stream: [ L, R, -, - ] */
70-
CHANNEL_CONFIG_I2S_DUAL_STEREO_0 = 10,
70+
IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_0 = 10,
7171
/**< Stereo (L,R) in 4 slots, 2nd stream: [ -, -, L, R ] */
72-
CHANNEL_CONFIG_I2S_DUAL_STEREO_1 = 11,
73-
CHANNEL_CONFIG_7_POINT_1 = 12, /**< L, C, R, Ls, Rs & LFE., LS, RS */
74-
CHANNEL_CONFIG_INVALID
72+
IPC4_CHANNEL_CONFIG_I2S_DUAL_STEREO_1 = 11,
73+
IPC4_CHANNEL_CONFIG_7_POINT_1 = 12, /**< L, C, R, Ls, Rs & LFE., LS, RS */
74+
IPC4_CHANNEL_CONFIG_INVALID
7575
};
7676

7777
enum ipc4_interleaved_style {
78-
CHANNELS_INTERLEAVED = 0,
79-
CHANNELS_NONINTERLEAVED = 1,
78+
IPC4_CHANNELS_INTERLEAVED = 0,
79+
IPC4_CHANNELS_NONINTERLEAVED = 1,
8080
};
8181

8282
enum ipc4_sample_type {
83-
MSB_INTEGER = 0, /**< integer with Most Significant Byte first */
84-
LSB_INTEGER = 1, /**< integer with Least Significant Byte first */
85-
SIGNED_INTEGER = 2, /**< signed integer */
86-
UNSIGNED_INTEGER = 3, /**< unsigned integer */
87-
FLOAT = 4 /**< unsigned integer */
83+
IPC4_TYPE_MSB_INTEGER = 0, /**< integer with Most Significant Byte first */
84+
IPC4_TYPE_LSB_INTEGER = 1, /**< integer with Least Significant Byte first */
85+
IPC4_TYPE_SIGNED_INTEGER = 2, /**< signed integer */
86+
IPC4_TYPE_UNSIGNED_INTEGER = 3, /**< unsigned integer */
87+
IPC4_TYPE_FLOAT = 4 /**< unsigned integer */
88+
};
89+
90+
enum ipc4_stream_type {
91+
IPC4_STREAM_PCM = 0, /*!< PCM stream */
92+
IPC4_STREAM_MP3, /*!< MP3 encoded stream */
93+
IPC4_STREAM_AAC, /*!< AAC encoded stream */
94+
IPC4_STREAM_MAX,
95+
IPC4_STREAM_INVALID = 0xFF
8896
};
8997

9098
struct ipc4_audio_format {
@@ -97,33 +105,26 @@ struct ipc4_audio_format {
97105
uint32_t valid_bit_depth : 8;
98106
enum ipc4_sample_type s_type : 8;
99107
uint32_t reserved : 8;
100-
};
108+
} __attribute__((packed, aligned(4)));
101109

102-
struct BaseModuleCfg {
103-
uint32_t cpc; /**< the max count of Cycles Per Chunk processing */
104-
uint32_t ibs; /**< input Buffer Size (in bytes) */
105-
uint32_t obs; /**< output Buffer Size (in bytes) */
110+
struct ipc4_base_module_cfg {
111+
uint32_t cpc; /**< the max count of Cycles Per Chunk processing */
112+
uint32_t ibs; /**< input Buffer Size (in bytes) */
113+
uint32_t obs; /**< output Buffer Size (in bytes) */
106114
uint32_t is_pages; /**< number of physical pages used */
107115
struct ipc4_audio_format audio_fmt;
108-
};
116+
} __attribute__((packed, aligned(4)));
109117

110118
struct ipc4_input_pin_format {
111-
uint32_t pin_index; /*!< \brief Index of the pin.*/
112-
uint32_t ibs; /*!< \brief Specifies input frame size (in bytes).*/
113-
struct ipc4_audio_format audio_fmt; /*!< \brief Format of the input data.*/
114-
};
119+
uint32_t pin_index; /*!< \brief Index of the pin.*/
120+
uint32_t ibs; /*!< \brief Specifies input frame size (in bytes).*/
121+
struct ipc4_audio_format audio_fmt; /*!< \brief Format of the input data.*/
122+
} __attribute__((packed, aligned(4)));
115123

116124
struct ipc4_output_pin_format {
117-
uint32_t pin_index; /*!< \brief Index of the pin.*/
118-
uint32_t obs; /*!< \brief Specifies output frame size (in bytes).*/
119-
struct ipc4_audio_format audio_fmt; /*!< \brief Format of the output data.*/
120-
};
125+
uint32_t pin_index; /*!< \brief Index of the pin.*/
126+
uint32_t obs; /*!< \brief Specifies output frame size (in bytes).*/
127+
struct ipc4_audio_format audio_fmt; /*!< \brief Format of the output data.*/
128+
} __attribute__((packed, aligned(4)));
121129

122-
enum ipc4_stream_type {
123-
ipc4_pcm = 0, ///< PCM stream
124-
ipc4_mp3, ///< MP3 encoded stream
125-
ipc4_aac, ///< AAC encoded stream
126-
ipc4_max,
127-
ipc4_invalid = 0xFF
128-
};
129130
#endif

0 commit comments

Comments
 (0)