File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313/**
1414 * A buffer of logging data is available for processing.
1515 */
16- typedef void (* probe_logging_hook_t )(uint8_t * buffer , size_t length );
16+ typedef int (* probe_logging_hook_t )(uint8_t * buffer , size_t length );
1717
1818#if CONFIG_LOG_BACKEND_SOF_PROBE
1919const struct log_backend * log_backend_probe_get (void );
Original file line number Diff line number Diff line change @@ -842,27 +842,32 @@ static void kick_probe_task(struct probe_pdata *_probe)
842842}
843843
844844#if CONFIG_LOG_BACKEND_SOF_PROBE
845- static void probe_logging_hook (uint8_t * buffer , size_t length )
845+ static int probe_logging_hook (uint8_t * buffer , size_t length )
846846{
847847 struct probe_pdata * _probe = probe_get ();
848+ uint32_t max_len ;
848849 uint64_t checksum ;
849850 int ret ;
850851
852+ max_len = _probe -> ext_dma .dmapb .avail - sizeof (struct probe_data_packet ) - sizeof (checksum );
853+ length = MIN (max_len , (uint32_t ) length );
854+
851855 ret = probe_gen_header (PROBE_LOGGING_BUFFER_ID , length , 0 , & checksum );
852856 if (ret < 0 )
853- return ;
857+ return ret ;
854858
855859 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
856860 buffer , length );
857861 if (ret < 0 )
858- return ;
862+ return ret ;
859863
860864 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
861865 & checksum , sizeof (checksum ));
862866 if (ret < 0 )
863- return ;
867+ return ret ;
864868
865869 kick_probe_task (_probe );
870+ return length ;
866871}
867872#endif
868873
You can’t perform that action at this time.
0 commit comments