File: css_power_state.c

package info (click to toggle)
crust-firmware 0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,900 kB
  • sloc: ansic: 19,341; yacc: 596; lex: 479; makefile: 334; asm: 215; sh: 136; python: 42
file content (40 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (2)
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
37
38
39
40
/*
 * Copyright © 2020-2022 The Crust Firmware Authors.
 * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
 */

#include <scpi_protocol.h>

#include "css.h"

#define CONCAT(a, b) a ## b

#define DEC_1        0
#define DEC_2        1
#define DEC_3        2
#define DEC_4        3
#define DEC(v)       CONCAT(DEC_, v)

#define REP_0(...)
#define REP_1(...)   __VA_ARGS__
#define REP_2(...)   REP_1(__VA_ARGS__), __VA_ARGS__
#define REP_3(...)   REP_2(__VA_ARGS__), __VA_ARGS__
#define REP_4(...)   REP_3(__VA_ARGS__), __VA_ARGS__
#define REP(n, ...)  CONCAT(REP_, n)(__VA_ARGS__)

struct power_state power_state = {
	.core = {
		{
			SCPI_CSS_ON,
			REP(DEC(MAX_CORES_PER_CLUSTER), SCPI_CSS_OFF)
		},
		REP(DEC(MAX_CLUSTERS), {
			REP(MAX_CORES_PER_CLUSTER, SCPI_CSS_OFF)
		})
	},
	.cluster = {
		SCPI_CSS_ON,
		REP(DEC(MAX_CLUSTERS), SCPI_CSS_OFF)
	},
	.css = SCPI_CSS_ON,
};