From 30130a581ab168e53170d1a934d46a9b789f30df Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Mon, 10 Feb 2020 12:51:24 +0100 Subject: [PATCH] kd-integration: add state diagram of keyphrase buffer manager This adds a state diagram for keyphrase buffer manager. Signed-off-by: Marcin Rajwa --- .../kd_integration/images/kd-state-diagram.pu | 44 +++++++++++++++++++ .../kd_integration/kd-integration.rst | 11 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 developer_guides/firmware/kd_integration/images/kd-state-diagram.pu diff --git a/developer_guides/firmware/kd_integration/images/kd-state-diagram.pu b/developer_guides/firmware/kd_integration/images/kd-state-diagram.pu new file mode 100644 index 00000000..ab0a9c74 --- /dev/null +++ b/developer_guides/firmware/kd_integration/images/kd-state-diagram.pu @@ -0,0 +1,44 @@ +@startuml +[*] --> KPB_DISABLED: Start \nor\n [IPC] free \nmessage \nfrom either state +KPB_DISABLED: Starting state of KPB - \nNo action has been taken yet +KPB_DISABLED--> KPB_CREATED: [IPC] \nnew component +KPB_DISABLED-[#0000FF]-> KPB_DISABLED: [IPC] \nreset + +KPB_CREATED : New KPB component has been created +KPB_CREATED --> KPB_PREPARING: [IPC] \npcm params +KPB_CREATED -[#0000FF]-> KPB_CREATED : [IPC] \nreset + +KPB_PREPARING: Prepare Key Phrase Buffer component. +KPB_PREPARING-> KPB_STATE_RUN: Success +KPB_PREPARING-> KPB_PREPARING: Failure +KPB_PREPARING-[#0000FF]-> KPB_PREPARING: [IPC] \nreset + +KPB_STATE_RUN: KPB is prepared and ready. +KPB_STATE_RUN-[#0000FF]-> KPB_PREPARING: [IPC] \nreset +KPB_STATE_RUN---> KPB_STATE_INIT_DRAINING: [EVENT] \nkey phrase detected +KPB_STATE_RUN-> KPB_STATE_BUFFERING: Start \nbuffering + +KPB_STATE_BUFFERING: Buffer incoming samples in the \ninternal history buffer +KPB_STATE_BUFFERING-> KPB_STATE_RUN: Done +KPB_STATE_BUFFERING-> KPB_STATE_INIT_DRAINING: Done +KPB_STATE_BUFFERING-> KPB_STATE_DRAINING: Done +KPB_STATE_BUFFERING-[#0000FF]-> KPB_STATE_RESETTING: [IPC] \nreset + +KPB_STATE_INIT_DRAINING: KPB received detection event +KPB_STATE_INIT_DRAINING-[#0000FF]-> KPB_PREPARING: [IPC] \nreset +KPB_STATE_INIT_DRAINING--> KPB_STATE_DRAINING: Draining task starts +KPB_STATE_INIT_DRAINING--> KPB_STATE_BUFFERING: Start \nbuffering + +KPB_STATE_DRAINING: KPB is draining internal history buffer \nto the client's buffer +KPB_STATE_DRAINING-->KPB_STATE_HOST_COPY: Draining done +KPB_STATE_DRAINING-[#0000FF]-> KPB_STATE_RESETTING: [IPC] \nreset +KPB_STATE_DRAINING--> KPB_STATE_BUFFERING: Start \nbuffering + +KPB_STATE_RESETTING: KPB is preparing itself for the reset +KPB_STATE_RESETTING-->KPB_STATE_RESET_FINISHING + +KPB_STATE_RESET_FINISHING: KPB is finishing reset sequence +KPB_STATE_RESET_FINISHING->KPB_PREPARING: Reset done + +KPB_STATE_HOST_COPY: KPB is copying real time \nstream into client's buffer +@enduml diff --git a/developer_guides/firmware/kd_integration/kd-integration.rst b/developer_guides/firmware/kd_integration/kd-integration.rst index da1b6791..f75365d0 100644 --- a/developer_guides/firmware/kd_integration/kd-integration.rst +++ b/developer_guides/firmware/kd_integration/kd-integration.rst @@ -114,4 +114,13 @@ keyphrase detection flows. The components are organized in pipelines: information if a keyphrase is detected. Note that the FW infrastructure can allow a FW event to be sent to the Keyphrase Buffer Manager component if keyphrase is detected. The component also sends a - notification to the audio driver and implements large parameters support. \ No newline at end of file + notification to the audio driver and implements large parameters support. + +KPBM state diagram +*********** + +The state diagram below presents all possible keyphrase buffer manager states +and valid relationships between them. + +.. uml:: images/kd-state-diagram.pu + :caption: Keyphrase buffer manager state diagram