blob: c6dcb4a63db563310e18c79a5b7e1d364d1a49e3 [file] [log] [blame]
David Wagnerb76c9d62014-02-05 18:30:24 +01001/*
2 * Copyright (c) 2011-2014, Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Patrick Benavoli68a91282011-08-31 11:23:23 +020029 */
30#pragma once
31
Frédéric Boisnard6bc17c02013-02-25 15:55:47 +010032#include <stdint.h>
Patrick Benavoli68a91282011-08-31 11:23:23 +020033#include "ErrorContext.h"
34
35class CParameterBlackboard;
36
37class CParameterAccessContext : public CErrorContext
38{
39public:
Frédéric Boisnard150407c2013-03-15 14:46:23 +010040 CParameterAccessContext(string& strError,
41 CParameterBlackboard* pParameterBlackboard,
42 bool bValueSpaceIsRaw,
43 bool bOutputRawFormatIsHex = false,
44 uint32_t uiOffsetBase = 0);
45 CParameterAccessContext(string& strError,
46 bool bBigEndianSubsystem,
47 CParameterBlackboard* pParameterBlackboard,
48 uint32_t uiOffsetBase = 0);
Patrick Benavoli68a91282011-08-31 11:23:23 +020049 CParameterAccessContext(string& strError);
50
51 // ParameterBlackboard
52 CParameterBlackboard* getParameterBlackboard();
53 void setParameterBlackboard(CParameterBlackboard* pBlackboard);
54
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020055 // Value interpretation as Real or Raw
Patrick Benavoli68a91282011-08-31 11:23:23 +020056 void setValueSpaceRaw(bool bIsRaw);
57 bool valueSpaceIsRaw() const;
58
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020059 // Output Raw Format for user get value interpretation
60 void setOutputRawFormat(bool bIsHex);
61 bool outputRawFormatIsHex();
62
Patrick Benavoli68a91282011-08-31 11:23:23 +020063 // Endianness
64 void setBigEndianSubsystem(bool bBigEndian);
65 bool isBigEndianSubsystem() const;
66
67 // Automatic synchronization to HW
68 void setAutoSync(bool bAutoSync);
69 bool getAutoSync() const;
70
Frédéric Boisnard6bc17c02013-02-25 15:55:47 +010071 // Base offset for blackboard access
72 void setBaseOffset(uint32_t uiBaseOffset);
73 uint32_t getBaseOffset() const;
74
Patrick Benavoli68a91282011-08-31 11:23:23 +020075private:
76 // Blackboard
77 CParameterBlackboard* _pParameterBlackboard;
78 // Value space
79 bool _bValueSpaceIsRaw;
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020080 // Output Raw Format
81 bool _bOutputRawFormatIsHex;
Patrick Benavoli68a91282011-08-31 11:23:23 +020082 // Subsystem Endianness
83 bool _bBigEndianSubsystem;
84 // Automatic synchronization to HW
85 bool _bAutoSync;
Frédéric Boisnard6bc17c02013-02-25 15:55:47 +010086 // Base offset where parameters are stored in configuration blackboards
87 uint32_t _uiBaseOffset;
Patrick Benavoli68a91282011-08-31 11:23:23 +020088};
89