@@ -36,15 +36,53 @@ DECLARE_TR_CTX(dolby_dax_audio_processing_tr, SOF_UUID(dolby_dax_audio_processin
3636#define DAX_ENUM_PROFILE_CONTROL_ID 0
3737#define DAX_ENUM_DEVICE_CONTROL_ID 1
3838
39+ static int itostr (int num , char * str )
40+ {
41+ int index = 0 , digit_count = 0 ;
42+ int temp ;
43+
44+ if (num < 0 ) {
45+ str [0 ] = '-' ;
46+ index = 1 ;
47+ num = - num ;
48+ }
49+
50+ if (num == 0 ) {
51+ str [index ] = '0' ;
52+ str [index + 1 ] = '\0' ;
53+ return index + 1 ;
54+ }
55+
56+ temp = num ;
57+ while (temp > 0 ) {
58+ temp /= 10 ;
59+ digit_count ++ ;
60+ }
61+
62+ temp = index + digit_count - 1 ;
63+ while (num > 0 ) {
64+ str [temp ] = (num % 10 ) + '0' ;
65+ num /= 10 ;
66+ temp -- ;
67+ }
68+
69+ str [index + digit_count ] = '\0' ;
70+ return index + digit_count ;
71+ }
72+
3973static const char * get_params_str (const void * val , uint32_t val_sz )
4074{
4175 static char params_str [MAX_PARAMS_STR_BUFFER_SIZE + 16 ];
4276 const int32_t * param_val = (const int32_t * )val ;
4377 const uint32_t param_sz = val_sz >> 2 ;
4478 uint32_t offset = 0 ;
4579
46- for (uint32_t i = 0 ; i < param_sz && offset < MAX_PARAMS_STR_BUFFER_SIZE ; i ++ )
47- offset += sprintf (params_str + offset , "%d," , param_val [i ]);
80+ for (uint32_t i = 0 ; i < param_sz && offset < MAX_PARAMS_STR_BUFFER_SIZE ; i ++ ) {
81+ offset += itostr (param_val [i ], params_str + offset );
82+ params_str [offset ] = ',' ;
83+ offset ++ ;
84+ params_str [offset ] = '\0' ;
85+ }
4886 return & params_str [0 ];
4987}
5088
@@ -126,9 +164,14 @@ static int dax_buffer_alloc(struct processing_module *mod,
126164/* After reading from buffer */
127165static void dax_buffer_consume (struct dax_buffer * dax_buff , uint32_t bytes )
128166{
167+ uint8_t * buf = (uint8_t * )dax_buff -> addr ;
168+ uint32_t copy_bytes ;
169+
129170 bytes = MIN (bytes , dax_buff -> avail );
130- memmove (dax_buff -> addr , (uint8_t * )dax_buff -> addr + bytes , dax_buff -> avail - bytes );
131- dax_buff -> avail = dax_buff -> avail - bytes ;
171+ copy_bytes = dax_buff -> avail - bytes ;
172+ for (int i = 0 ; i < copy_bytes ; i ++ )
173+ buf [i ] = buf [bytes + i ];
174+ dax_buff -> avail = copy_bytes ;
132175 dax_buff -> free = dax_buff -> size - dax_buff -> avail ;
133176}
134177
0 commit comments