File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
Expand file tree Collapse file tree 2 files changed +10
-5
lines changed 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 @@ -865,27 +865,32 @@ static void kick_probe_task(struct probe_pdata *_probe)
865865}
866866
867867#if CONFIG_LOG_BACKEND_SOF_PROBE
868- static void probe_logging_hook (uint8_t * buffer , size_t length )
868+ static int probe_logging_hook (uint8_t * buffer , size_t length )
869869{
870870 struct probe_pdata * _probe = probe_get ();
871+ uint32_t max_len ;
871872 uint64_t checksum ;
872873 int ret ;
873874
875+ max_len = _probe -> ext_dma .dmapb .avail - sizeof (struct probe_data_packet ) - sizeof (checksum );
876+ length = MIN (max_len , (uint32_t )length );
877+
874878 ret = probe_gen_header (PROBE_LOGGING_BUFFER_ID , length , 0 , & checksum );
875879 if (ret < 0 )
876- return ;
880+ return ret ;
877881
878882 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
879883 buffer , length );
880884 if (ret < 0 )
881- return ;
885+ return ret ;
882886
883887 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
884888 & checksum , sizeof (checksum ));
885889 if (ret < 0 )
886- return ;
890+ return ret ;
887891
888892 kick_probe_task (_probe );
893+ return length ;
889894}
890895#endif
891896
You can’t perform that action at this time.
0 commit comments