Sound Open Firmware
Loading...
Searching...
No Matches
kpb.h File Reference
Include dependency graph for kpb.h:

Go to the source code of this file.

Data Structures

struct  kpb_event_data
struct  kpb_client
struct  history_buffer
struct  draining_data
struct  history_data
struct  kpb_micselector_config
struct  kpb_task_params
struct  fast_mode_task
struct  device_list
struct  kpb_fmt_dev_list

Macros

#define KPB_MAX_BUFF_TIME   2100
 Due to memory constraints on non-TGL platforms, the buffers are smaller.
#define HOST_WAKEUP_TIME   0 /* aprox. time of host DMA wakup from suspend [ms] */
#define KPB_MAX_DRAINING_REQ   (KPB_MAX_BUFF_TIME - HOST_WAKEUP_TIME)
#define KPB_MAX_SUPPORTED_CHANNELS   6
 number of supported channels
#define KPB_SAMPLES_PER_MS   (KPB_SAMPLNG_FREQUENCY / 1000)
#define KPB_SAMPLNG_FREQUENCY   16000
 supported sampling frequency in Hz
#define KPB_SAMPLE_CONTAINER_SIZE(sw)
#define KPB_MAX_BUFFER_SIZE(sw, channels_number)
#define KPB_MAX_NO_OF_CLIENTS   4
#define KPB_MAX_SINK_CNT   (1 + KPB_MAX_NO_OF_CLIENTS)
#define KPB_NO_OF_HISTORY_BUFFERS   2
 no of internal buffers
#define KPB_ALLOCATION_STEP   0x100
#define KPB_NO_OF_MEM_POOLS   5
#define KPB_BYTES_TO_FRAMES(bytes, sample_width, channels_number)
 Defines how much faster draining is in comparison to pipeline copy.
#define KPB_DRAIN_NUM_OF_PPL_PERIODS_AT_ONCE   2
 Host buffer shall be at least two times bigger than history buffer.
#define HOST_BUFFER_MIN_SIZE(hb, channels_number)
 Convert with right shift a bytes count to samples count.
#define KPB_BYTES_TO_S16_SAMPLES(s)
#define KPB_BYTES_TO_S32_SAMPLES(s)
#define KPB_COUNT_TO_BITMASK(cnt)
#define KPB_IS_BIT_SET(value, idx)
#define KPB_REFERENCE_SUPPORT_CHANNELS   2
#define KPB_MAX_MICSEL_CHANNELS   4
#define FAST_MODE_TASK_MAX_MODULES_COUNT   16
#define REALTIME_PIN_ID   0
#define FAST_MODE_TASK_MAX_LIST_COUNT   5
#define DEVICE_LIST_SIZE   (FAST_MODE_TASK_MAX_MODULES_COUNT + 1)

Enumerations

enum  kpb_state {
  KPB_STATE_DISABLED = 0 , KPB_STATE_RESET_FINISHING , KPB_STATE_CREATED , KPB_STATE_PREPARING ,
  KPB_STATE_RUN , KPB_STATE_BUFFERING , KPB_STATE_INIT_DRAINING , KPB_STATE_DRAINING ,
  KPB_STATE_HOST_COPY , KPB_STATE_RESETTING
}
 All states below as well as relations between them are documented in the sof-dosc in kpbm-state-diagram Therefore any addition of new states or modification of existing ones should have a corresponding update in the sof-docs. More...
enum  kpb_event {
  KPB_EVENT_REGISTER_CLIENT = 0 , KPB_EVENT_UPDATE_PARAMS , KPB_EVENT_BEGIN_DRAINING , KPB_EVENT_STOP_DRAINING ,
  KPB_EVENT_UNREGISTER_CLIENT
}
enum  kpb_client_state { KPB_CLIENT_UNREGISTERED = 0 , KPB_CLIENT_BUFFERING , KPB_CLIENT_DRAINNING , KPB_CLIENT_DRAINNING_OD }
enum  buffer_state { KPB_BUFFER_FREE = 0 , KPB_BUFFER_FULL , KPB_BUFFER_OFF }
enum  kpb_id { KPB_LP = 0 , KPB_HP }

Macro Definition Documentation

◆ DEVICE_LIST_SIZE

#define DEVICE_LIST_SIZE   (FAST_MODE_TASK_MAX_MODULES_COUNT + 1)

◆ FAST_MODE_TASK_MAX_LIST_COUNT

#define FAST_MODE_TASK_MAX_LIST_COUNT   5

◆ FAST_MODE_TASK_MAX_MODULES_COUNT

#define FAST_MODE_TASK_MAX_MODULES_COUNT   16

◆ HOST_BUFFER_MIN_SIZE

#define HOST_BUFFER_MIN_SIZE ( hb,
channels_number )
Value:
((hb) * (channels_number))

Convert with right shift a bytes count to samples count.

◆ HOST_WAKEUP_TIME

#define HOST_WAKEUP_TIME   0 /* aprox. time of host DMA wakup from suspend [ms] */

◆ KPB_ALLOCATION_STEP

#define KPB_ALLOCATION_STEP   0x100

◆ KPB_BYTES_TO_FRAMES

#define KPB_BYTES_TO_FRAMES ( bytes,
sample_width,
channels_number )
Value:
((bytes) / ((KPB_SAMPLE_CONTAINER_SIZE(sample_width) / 8) * \
(channels_number)))
#define KPB_SAMPLE_CONTAINER_SIZE(sw)
Definition kpb.h:41

Defines how much faster draining is in comparison to pipeline copy.

◆ KPB_BYTES_TO_S16_SAMPLES

#define KPB_BYTES_TO_S16_SAMPLES ( s)
Value:
((s) >> 1)

◆ KPB_BYTES_TO_S32_SAMPLES

#define KPB_BYTES_TO_S32_SAMPLES ( s)
Value:
((s) >> 2)

◆ KPB_COUNT_TO_BITMASK

#define KPB_COUNT_TO_BITMASK ( cnt)
Value:
(((0x1 << (cnt)) - 1))

◆ KPB_DRAIN_NUM_OF_PPL_PERIODS_AT_ONCE

#define KPB_DRAIN_NUM_OF_PPL_PERIODS_AT_ONCE   2

Host buffer shall be at least two times bigger than history buffer.

◆ KPB_IS_BIT_SET

#define KPB_IS_BIT_SET ( value,
idx )
Value:
((value) & (1 << (idx)))
char value[]
Definition tlv.h:2

◆ KPB_MAX_BUFF_TIME

#define KPB_MAX_BUFF_TIME   2100

Due to memory constraints on non-TGL platforms, the buffers are smaller.

time of buffering in miliseconds

◆ KPB_MAX_BUFFER_SIZE

#define KPB_MAX_BUFFER_SIZE ( sw,
channels_number )
Value:
((KPB_SAMPLNG_FREQUENCY / 1000) * \
(channels_number))
#define KPB_MAX_BUFF_TIME
Due to memory constraints on non-TGL platforms, the buffers are smaller.
Definition kpb.h:32
#define KPB_SAMPLNG_FREQUENCY
supported sampling frequency in Hz
Definition kpb.h:40

◆ KPB_MAX_DRAINING_REQ

#define KPB_MAX_DRAINING_REQ   (KPB_MAX_BUFF_TIME - HOST_WAKEUP_TIME)

◆ KPB_MAX_MICSEL_CHANNELS

#define KPB_MAX_MICSEL_CHANNELS   4

◆ KPB_MAX_NO_OF_CLIENTS

#define KPB_MAX_NO_OF_CLIENTS   4

◆ KPB_MAX_SINK_CNT

#define KPB_MAX_SINK_CNT   (1 + KPB_MAX_NO_OF_CLIENTS)

◆ KPB_MAX_SUPPORTED_CHANNELS

#define KPB_MAX_SUPPORTED_CHANNELS   6

number of supported channels

number of samples taken each milisecond

◆ KPB_NO_OF_HISTORY_BUFFERS

#define KPB_NO_OF_HISTORY_BUFFERS   2

no of internal buffers

◆ KPB_NO_OF_MEM_POOLS

#define KPB_NO_OF_MEM_POOLS   5

◆ KPB_REFERENCE_SUPPORT_CHANNELS

#define KPB_REFERENCE_SUPPORT_CHANNELS   2

◆ KPB_SAMPLE_CONTAINER_SIZE

#define KPB_SAMPLE_CONTAINER_SIZE ( sw)
Value:
((sw == 16) ? 16 : 32)

◆ KPB_SAMPLES_PER_MS

#define KPB_SAMPLES_PER_MS   (KPB_SAMPLNG_FREQUENCY / 1000)

◆ KPB_SAMPLNG_FREQUENCY

#define KPB_SAMPLNG_FREQUENCY   16000

supported sampling frequency in Hz

◆ REALTIME_PIN_ID

#define REALTIME_PIN_ID   0

Enumeration Type Documentation

◆ buffer_state

Enumerator
KPB_BUFFER_FREE 
KPB_BUFFER_FULL 
KPB_BUFFER_OFF 

◆ kpb_client_state

Enumerator
KPB_CLIENT_UNREGISTERED 
KPB_CLIENT_BUFFERING 
KPB_CLIENT_DRAINNING 
KPB_CLIENT_DRAINNING_OD 

draining on demand

◆ kpb_event

enum kpb_event
Enumerator
KPB_EVENT_REGISTER_CLIENT 
KPB_EVENT_UPDATE_PARAMS 
KPB_EVENT_BEGIN_DRAINING 
KPB_EVENT_STOP_DRAINING 
KPB_EVENT_UNREGISTER_CLIENT 

◆ kpb_id

enum kpb_id
Enumerator
KPB_LP 
KPB_HP 

◆ kpb_state

enum kpb_state

All states below as well as relations between them are documented in the sof-dosc in kpbm-state-diagram Therefore any addition of new states or modification of existing ones should have a corresponding update in the sof-docs.

Enumerator
KPB_STATE_DISABLED 
KPB_STATE_RESET_FINISHING 
KPB_STATE_CREATED 
KPB_STATE_PREPARING 
KPB_STATE_RUN 
KPB_STATE_BUFFERING 
KPB_STATE_INIT_DRAINING 
KPB_STATE_DRAINING 
KPB_STATE_HOST_COPY 
KPB_STATE_RESETTING