Sound Open Firmware
Loading...
Searching...
No Matches
agent.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2017 Intel Corporation. All rights reserved.
4 *
5 * Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
6 */
7
8#ifndef __SOF_LIB_AGENT_H__
9#define __SOF_LIB_AGENT_H__
10
11#include <rtos/atomic.h>
12#include <sof/lib/memory.h>
13#include <sof/lib/perf_cnt.h>
14#include <rtos/task.h>
15#include <rtos/sof.h>
16
17#include <stdbool.h>
18#include <stdint.h>
19
20struct sof;
21
22/* simple agent */
23struct sa {
24 uint64_t last_check; /* time of last activity checking */
25 uint64_t panic_timeout; /* threshold of panic */
26 uint64_t warn_timeout; /* threshold of warning */
27#if CONFIG_PERFORMANCE_COUNTERS
28 struct perf_cnt_data pcd;
29#endif
30 struct task work;
31 atomic_t panic_cnt;
33};
34
35#if CONFIG_HAVE_AGENT
36
41static inline void sa_set_panic_on_delay(bool enabled)
42{
43 struct sa *sa = sof_get()->sa;
44
45 if (enabled)
46 atomic_add(&sa->panic_cnt, 1);
47 else
48 atomic_sub(&sa->panic_cnt, 1);
49
50 /* enable panic only if no refs */
52
53}
54
60void sa_init(struct sof *sof, uint64_t timeout);
61
66void sa_exit(struct sof *sof);
67
68#else
69
75static inline void sa_init(struct sof *sof, uint64_t timeout) { }
76
81static inline void sa_exit(struct sof *sof) { }
82
87static inline void sa_set_panic_on_delay(bool enabled) { }
88
89#endif
90
91#endif /* __SOF_LIB_AGENT_H__ */
static void sa_exit(struct sof *sof)
Teardown the System Agent (no-op stub when CONFIG_HAVE_AGENT is disabled).
Definition agent.h:81
static void sa_set_panic_on_delay(bool enabled)
Configure delay panic behavior (no-op stub when CONFIG_HAVE_AGENT is disabled).
Definition agent.h:87
static void sa_init(struct sof *sof, uint64_t timeout)
Initialize the System Agent (no-op stub when CONFIG_HAVE_AGENT is disabled).
Definition agent.h:75
#define atomic_read(p)
Definition atomic.h:17
Memory attributes, cold/hot execution paths, and platform memory inclusions.
Simple performance counters.
Sound Open Firmware global runtime context.
struct sof * sof_get(void)
Get the global Sound Open Firmware runtime instance pointer.
Definition perf_cnt_data.h:21
Definition agent.h:23
struct task work
Definition agent.h:30
bool panic_on_delay
emits panic on delay if true
Definition agent.h:32
atomic_t panic_cnt
ref counter for panic_on_delay property
Definition agent.h:31
uint64_t last_check
Definition agent.h:24
uint64_t panic_timeout
Definition agent.h:25
uint64_t warn_timeout
Definition agent.h:26
General firmware context.
Definition sof.h:50
struct sa * sa
Definition sof.h:61
Core task structure managed by SOF schedulers.
Definition task.h:81
Core task descriptor, task operations, and task execution state machine.