blob: 911aeae9465b0542b253f3325526f418b4407aba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* Copyright 2022 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
#include "console.h"
/* IRQ counters */
int irq_count[CONFIG_NUM_IRQS];
void sys_trace_isr_enter_user(int nested_interrupts)
{
ARG_UNUSED(nested_interrupts);
/* read the exception number */
uint32_t irq = __get_IPSR() - 16;
__ASSERT(irq < CONFIG_NUM_IRQS, "Invalid IRQ number");
irq_count[irq]++;
}
static int command_irq(int argc, char **argv)
{
ARG_UNUSED(argc);
ARG_UNUSED(argv);
for (int i = 0; i < CONFIG_NUM_IRQS; i++) {
if (irq_count[i])
ccprintf(" IRQ %d: %d\n", i, irq_count[i]);
}
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(irq, command_irq, "", "List irq counters");
|