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 @@ -867,27 +867,32 @@ static void kick_probe_task(struct probe_pdata *_probe)
867867}
868868
869869#if CONFIG_LOG_BACKEND_SOF_PROBE
870- static void probe_logging_hook (uint8_t * buffer , size_t length )
870+ static int probe_logging_hook (uint8_t * buffer , size_t length )
871871{
872872 struct probe_pdata * _probe = probe_get ();
873+ uint32_t max_len ;
873874 uint64_t checksum ;
874875 int ret ;
875876
877+ max_len = _probe -> ext_dma .dmapb .avail - sizeof (struct probe_data_packet ) - sizeof (checksum );
878+ length = MIN (max_len , (uint32_t )length );
879+
876880 ret = probe_gen_header (PROBE_LOGGING_BUFFER_ID , length , 0 , & checksum );
877881 if (ret < 0 )
878- return ;
882+ return ret ;
879883
880884 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
881885 buffer , length );
882886 if (ret < 0 )
883- return ;
887+ return ret ;
884888
885889 ret = copy_to_pbuffer (& _probe -> ext_dma .dmapb ,
886890 & checksum , sizeof (checksum ));
887891 if (ret < 0 )
888- return ;
892+ return ret ;
889893
890894 kick_probe_task (_probe );
895+ return length ;
891896}
892897#endif
893898
You can’t perform that action at this time.
0 commit comments