Linux Audio

Check our new training course

Embedded Linux training

Mar 31-Apr 8, 2025
Register
Loading...
Note: File does not exist in v5.4.
 1// SPDX-License-Identifier: GPL-2.0
 2#include <stdint.h>
 3#include <time.h>
 4
 5/*
 6 * '18446744073709551615\0'
 7 */
 8#define BUFF_U64_STR_SIZE	24
 9#define MAX_PATH		1024
10
11#define container_of(ptr, type, member)({			\
12	const typeof(((type *)0)->member) *__mptr = (ptr);	\
13	(type *)((char *)__mptr - offsetof(type, member)) ; })
14
15extern int config_debug;
16void debug_msg(const char *fmt, ...);
17void err_msg(const char *fmt, ...);
18
19long parse_seconds_duration(char *val);
20void get_duration(time_t start_time, char *output, int output_size);
21
22int parse_cpu_list(char *cpu_list, char **monitored_cpus);
23long long get_llong_from_str(char *start);
24
25static inline void
26update_min(unsigned long long *a, unsigned long long *b)
27{
28	if (*a > *b)
29		*a = *b;
30}
31
32static inline void
33update_max(unsigned long long *a, unsigned long long *b)
34{
35	if (*a < *b)
36		*a = *b;
37}
38
39static inline void
40update_sum(unsigned long long *a, unsigned long long *b)
41{
42	*a += *b;
43}
44
45struct sched_attr {
46	uint32_t size;
47	uint32_t sched_policy;
48	uint64_t sched_flags;
49	int32_t sched_nice;
50	uint32_t sched_priority;
51	uint64_t sched_runtime;
52	uint64_t sched_deadline;
53	uint64_t sched_period;
54};
55
56int parse_prio(char *arg, struct sched_attr *sched_param);
57int set_comm_sched_attr(const char *comm_prefix, struct sched_attr *attr);
58int set_cpu_dma_latency(int32_t latency);