@@ -27,6 +27,10 @@ LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);
2727
2828/* Systic variables, one set per core */
2929static int telemetry_systick_counter [CONFIG_MAX_CORE_COUNT ];
30+ #ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
31+ static struct telemetry_wnd_data * wnd_data ;
32+ #endif
33+
3034#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
3135static int telemetry_prev_ccount [CONFIG_MAX_CORE_COUNT ];
3236static int telemetry_perf_period_sum [CONFIG_MAX_CORE_COUNT ];
@@ -68,19 +72,45 @@ static size_t telemetry_perf_queue_avg(struct telemetry_perf_queue *q)
6872}
6973#endif
7074
75+ #ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
76+ struct system_tick_info * telemetry_get_systick_info_ptr (void )
77+ {
78+ if (!wnd_data )
79+ return NULL ;
80+
81+ return (struct system_tick_info * )wnd_data -> system_tick_info ;
82+ }
83+ #endif
84+
7185int telemetry_init (void )
7286{
7387 /* systick_init */
88+ #ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
89+ struct adsp_dw_desc slot_desc = { .type = ADSP_DW_SLOT_TELEMETRY , };
90+ struct system_tick_info * systick_info ;
91+
92+ if (wnd_data )
93+ return 0 ;
94+
95+ wnd_data = (struct telemetry_wnd_data * )adsp_dw_request_slot (& slot_desc ,
96+ NULL );
97+ if (!wnd_data )
98+ return - ENOMEM ;
99+
100+ systick_info = (struct system_tick_info * )wnd_data -> system_tick_info ;
101+ #else
74102 uint8_t slot_num = SOF_DW_TELEMETRY_SLOT ;
75103 volatile struct adsp_debug_window * window = ADSP_DW ;
76104 struct telemetry_wnd_data * wnd_data = (struct telemetry_wnd_data * )ADSP_DW -> slots [slot_num ];
77105 struct system_tick_info * systick_info =
78106 (struct system_tick_info * )wnd_data -> system_tick_info ;
79107
80- tr_info (& ipc_tr , "Telemetry enabled. May affect performance" );
81-
82108 window -> descs [slot_num ].type = ADSP_DW_SLOT_TELEMETRY ;
83109 window -> descs [slot_num ].resource_id = 0 ;
110+ #endif
111+
112+ tr_info (& ipc_tr , "Telemetry enabled. May affect performance" );
113+
84114 wnd_data -> separator_1 = 0x0000C0DE ;
85115
86116 /* Zero values per core */
@@ -101,13 +131,19 @@ int telemetry_init(void)
101131void telemetry_update (uint32_t begin_stamp , uint32_t current_stamp )
102132{
103133 int prid = cpu_get_id ();
134+ #ifdef CONFIG_INTEL_ADSP_DEBUG_SLOT_MANAGER
135+ struct system_tick_info * systick_info = telemetry_get_systick_info_ptr ();
104136
105- ++ telemetry_systick_counter [prid ];
106-
137+ if (!systick_info )
138+ return ;
139+ #else
107140 struct telemetry_wnd_data * wnd_data =
108141 (struct telemetry_wnd_data * )ADSP_DW -> slots [SOF_DW_TELEMETRY_SLOT ];
109142 struct system_tick_info * systick_info =
110143 (struct system_tick_info * )wnd_data -> system_tick_info ;
144+ #endif
145+
146+ ++ telemetry_systick_counter [prid ];
111147
112148 systick_info [prid ].count = telemetry_systick_counter [prid ];
113149 systick_info [prid ].last_time_elapsed = current_stamp - begin_stamp ;
0 commit comments