Userspace Resource Manager
Loading...
Searching...
No Matches
Resource.h
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef RESOURCE_TUNER_RESOURCE_H
5#define RESOURCE_TUNER_RESOURCE_H
6
7#include <cstdint>
8#include <vector>
9
10#include "DLManager.h"
11
12typedef enum : uint8_t {
13 RES_FORWARD,
14 RES_SKIP
15} ResAction;
16
21class Resource {
22private:
29 uint32_t mResCode;
30
37 uint32_t mResInfo;
38 int32_t mOptionalInfo;
43 int32_t mNumValues;
44
45 union {
46 int32_t values[2];
47 int32_t* valueArr;
49
50 uint8_t mResAction;
51
52public:
53 Resource() : mResCode(0), mResInfo(0), mOptionalInfo(0), mNumValues(0), mResAction(RES_FORWARD) {
54 mResValue.valueArr = nullptr;
55 }
56
57 // Copy Constructor
58 Resource(const Resource& resource);
59
60 ~Resource();
61
62 int32_t getCoreValue() const;
63 int32_t getClusterValue() const;
64 int32_t getResInfo() const;
65 int32_t getOptionalInfo() const;
66 uint32_t getResCode() const;
67 int32_t getValuesCount() const;
68 int32_t getValueAt(int32_t index) const;
69 uint8_t getResAction() const;
70
71 void setCoreValue(int32_t core);
72 void setClusterValue(int32_t cluster);
73 void setResCode(uint32_t resCode);
74 void setResInfo(int32_t resInfo);
75 void setOptionalInfo(int32_t optionalInfo);
76 void setNumValues(int32_t numValues);
77 ErrCode setValueAt(int32_t index, int32_t value);
78 void setResAction(uint8_t action);
79};
80
81typedef ExtIterable1<Resource*> ResIterable;
82
83#endif
ErrCode
Custom Error Codes used by Resource Tuner APIs and Internal Functions.
Definition ErrCodes.h:19
Used to store information regarding Resources / Tunables which need to be Provisioned as part of the ...
Definition Resource.h:21
int32_t mOptionalInfo
Field to hold optional information for Request Processing.
Definition Resource.h:38
int32_t * valueArr
Dynamically Allocated Array, for >= 3 values.
Definition Resource.h:47
uint32_t mResCode
A uniqued 32-bit (unsigned) identifier for the Resource.
Definition Resource.h:29
union Resource::@352035307326121106035316056372125316233110240140 mResValue
The value to be Configured for this Resource Node.
uint32_t mResInfo
Holds Logical Core and Cluster Information:
Definition Resource.h:37
int32_t mNumValues
Number of values to be configured for the Resource, both single-valued and multi-valued Resources are...
Definition Resource.h:43
int32_t values[2]
Use this field for storing upto 2 Values.
Definition Resource.h:46