[Sound-open-firmware] [PATCH] ipc: make sure all messages start at 1 instead of 0 to simplify debug
Messages starting at offset 1 remove any ambiguity over whether the message has been constructed correctly.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/include/uapi/ipc.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index 003b96e..c820118 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -70,9 +70,9 @@
/* topology */ -#define SOF_IPC_TPLG_COMP_NEW SOF_CMD_TYPE(0x000) -#define SOF_IPC_TPLG_COMP_FREE SOF_CMD_TYPE(0x001) -#define SOF_IPC_TPLG_COMP_CONNECT SOF_CMD_TYPE(0x002) +#define SOF_IPC_TPLG_COMP_NEW SOF_CMD_TYPE(0x001) +#define SOF_IPC_TPLG_COMP_FREE SOF_CMD_TYPE(0x002) +#define SOF_IPC_TPLG_COMP_CONNECT SOF_CMD_TYPE(0x003) #define SOF_IPC_TPLG_PIPE_NEW SOF_CMD_TYPE(0x010) #define SOF_IPC_TPLG_PIPE_FREE SOF_CMD_TYPE(0x011) #define SOF_IPC_TPLG_PIPE_CONNECT SOF_CMD_TYPE(0x012) @@ -81,22 +81,22 @@ #define SOF_IPC_TPLG_BUFFER_FREE SOF_CMD_TYPE(0x021)
/* PM */ -#define SOF_IPC_PM_CTX_SAVE SOF_CMD_TYPE(0x000) -#define SOF_IPC_PM_CTX_RESTORE SOF_CMD_TYPE(0x001) -#define SOF_IPC_PM_CTX_SIZE SOF_CMD_TYPE(0x002) -#define SOF_IPC_PM_CLK_SET SOF_CMD_TYPE(0x003) -#define SOF_IPC_PM_CLK_GET SOF_CMD_TYPE(0x004) -#define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x005) +#define SOF_IPC_PM_CTX_SAVE SOF_CMD_TYPE(0x001) +#define SOF_IPC_PM_CTX_RESTORE SOF_CMD_TYPE(0x002) +#define SOF_IPC_PM_CTX_SIZE SOF_CMD_TYPE(0x003) +#define SOF_IPC_PM_CLK_SET SOF_CMD_TYPE(0x004) +#define SOF_IPC_PM_CLK_GET SOF_CMD_TYPE(0x005) +#define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x006)
/* component - multiple different types */ -#define SOF_IPC_COMP_SET_VOLUME SOF_CMD_TYPE(0x000) -#define SOF_IPC_COMP_GET_VOLUME SOF_CMD_TYPE(0x001) -#define SOF_IPC_COMP_SET_MIXER SOF_CMD_TYPE(0x002) -#define SOF_IPC_COMP_GET_MIXER SOF_CMD_TYPE(0x003) -#define SOF_IPC_COMP_SET_MUX SOF_CMD_TYPE(0x004) -#define SOF_IPC_COMP_GET_MUX SOF_CMD_TYPE(0x005) -#define SOF_IPC_COMP_SET_SRC SOF_CMD_TYPE(0x006) -#define SOF_IPC_COMP_GET_SRC SOF_CMD_TYPE(0x007) +#define SOF_IPC_COMP_SET_VOLUME SOF_CMD_TYPE(0x001) +#define SOF_IPC_COMP_GET_VOLUME SOF_CMD_TYPE(0x002) +#define SOF_IPC_COMP_SET_MIXER SOF_CMD_TYPE(0x003) +#define SOF_IPC_COMP_GET_MIXER SOF_CMD_TYPE(0x004) +#define SOF_IPC_COMP_SET_MUX SOF_CMD_TYPE(0x005) +#define SOF_IPC_COMP_GET_MUX SOF_CMD_TYPE(0x006) +#define SOF_IPC_COMP_SET_SRC SOF_CMD_TYPE(0x007) +#define SOF_IPC_COMP_GET_SRC SOF_CMD_TYPE(0x008)
/* DAI messages */ #define SOF_IPC_DAI_CONFIG SOF_CMD_TYPE(0x001)
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/audio/volume.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/audio/volume.c b/src/audio/volume.c index 925a274..93a3839 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -548,10 +548,14 @@ static int volume_prepare(struct comp_dev *dev) /* validate */ if (cd->sink_period_bytes == 0) { trace_volume_error("vp1"); + trace_value(dev->frames); + trace_value(sinkb->sink->frame_bytes); return -EINVAL; } if (cd->source_period_bytes == 0) { trace_volume_error("vp2"); + trace_value(dev->frames); + trace_value(sourceb->source->frame_bytes); return -EINVAL; }
TODO: need to check all sources for params.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/audio/mixer.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/audio/mixer.c b/src/audio/mixer.c index 372d59f..60177af 100644 --- a/src/audio/mixer.c +++ b/src/audio/mixer.c @@ -127,8 +127,19 @@ static int mixer_params(struct comp_dev *dev)
trace_mixer("par");
+ /* calculate frame size based on config */ + dev->frame_bytes = comp_frame_bytes(dev); + if (dev->frame_bytes == 0) { + trace_mixer_error("mx1"); + return -EINVAL; + } + /* calculate period size based on config */ md->period_bytes = dev->frames * dev->frame_bytes; + if (md->period_bytes == 0) { + trace_mixer_error("mx2"); + return -EINVAL; + }
return 0; }
participants (1)
-
Liam Girdwood