OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /riscv_vhdl/trunk/debugger/src/common/coreservices
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

/icpu_hc08.h
0,0 → 1,86
/**
* @file
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
* @author Sergey Khabarov - sergeykhbr@gmail.com
* @brief CPU HC08 specific interface.
*/
 
#ifndef __DEBUGGER_COMMON_CORESERVICES_ICPU_HC08_H__
#define __DEBUGGER_COMMON_CORESERVICES_ICPU_HC08_H__
 
#include <inttypes.h>
#include <iface.h>
 
namespace debugger {
 
static const char *const IFACE_CPU_HC08 = "ICpuHC08";
 
enum ERegNames {
Reg_A, // 0
Reg_HX, // 1
Reg_SP, // 2
Reg_CCR, // 3
Reg_PPAGE, // 4
Reg_ClkHz, // 5
Reg_rsrv6, // 6
Reg_rsrv7,
Reg_rsrv8,
Reg_rsrv9,
Reg_rsrv10,
Reg_rsrv11,
Reg_rsrv12,
Reg_rsrv13,
Reg_rsrv14,
Reg_rsrv15,
Reg_rsrv16,
Reg_rsrv17,
Reg_rsrv18,
Reg_rsrv19,
Reg_rsrv20,
Reg_rsrv21,
Reg_rsrv22,
Reg_rsrv23,
Reg_rsrv24,
Reg_rsrv25,
Reg_rsrv26,
Reg_rsrv27,
Reg_rsrv28,
Reg_rsrv29,
Reg_rsrv30,
Reg_rsrv31,
Reg_Total
};
 
/** Signal types */
enum EResetType {
RESET_Unused0,
RESET_LVI, // Low-voltage inhibit Reset Bit
RESET_Unused2,
RESET_ILAD, // Illegal Address Reset Bit
RESET_ILOP, // Illegal Opcode Reset Bit
RESET_COP, // Compute Operating Properly Reset Bit
RESET_PIN, // External Reset Bit (nRST)
RESET_PON, // POWER-on Reset Bit
};
 
class ICpuHC08 : public IFace {
public:
ICpuHC08() : IFace(IFACE_CPU_HC08) {}
 
/** Fast access to memory mapped registers */
virtual Reg64Type *getpRegs() = 0;
 
/** External IRQ line status (need for BIH, BIL instructions) */
virtual bool getIRQ() = 0;
 
/** Update COP watchdog settings */
virtual void updateCOP() = 0;
 
/** Reset sequence has ben writen */
virtual void resetCOP() = 0;
virtual void vectorUpdated() = 0;
};
 
} // namespace debugger
 
#endif // __DEBUGGER_COMMON_CORESERVICES_ICPU_HC08_H__
icpu_hc08.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: icpuarm.h =================================================================== --- icpuarm.h (nonexistent) +++ icpuarm.h (revision 5) @@ -0,0 +1,75 @@ +/* + * Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __DEBUGGER_SRC_COMMON_CORESERVICES_ICPUARM_H__ +#define __DEBUGGER_SRC_COMMON_CORESERVICES_ICPUARM_H__ + +#include "iface.h" +#include + +namespace debugger { + +static const char *const IFACE_CPU_ARM = "ICpuArm"; + +/** Signal types */ +//static const int CPU_SIGNAL_RESET = 0; +//static const int CPU_SIGNAL_EXT_IRQ = 1; + +enum EInstructionModes { + ARM_mode, + THUMB_mode, + Jazelle_mode, + InstrModes_Total = 4 +}; + +enum ECoreModes { + User_mode = 0x10, + FIQ_mode = 0x11, + IRQ_mode = 0x12, + Supervisor_mode = 0x13, + Abort_mode = 0x17, + Undefined_mode = 0x1B, + System_mode = 0x1F, + CoreModes_Total = 32 +}; + +class ICpuArm : public IFace { + public: + ICpuArm() : IFace(IFACE_CPU_ARM) {} + + virtual void setInstrMode(EInstructionModes mode) {} + virtual EInstructionModes getInstrMode() { return ARM_mode; } + + /** Zero flag */ + virtual uint32_t getZ() = 0; + virtual void setZ(uint32_t z) = 0; + + /** Unsigned higer or same (carry flag) */ + virtual uint32_t getC() = 0; + virtual void setC(uint32_t c) = 0; + + /** Negative flag */ + virtual uint32_t getN() = 0; + virtual void setN(uint32_t n) = 0; + + /** Overflow flag */ + virtual uint32_t getV() = 0; + virtual void setV(uint32_t v) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_SRC_COMMON_CORESERVICES_ICPUARM_H__
icpuarm.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: icpufunctional.h =================================================================== --- icpufunctional.h (nonexistent) +++ icpufunctional.h (revision 5) @@ -0,0 +1,79 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Functional CPU model interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_ICPUFUNCTIONAL_H__ +#define __DEBUGGER_COMMON_CORESERVICES_ICPUFUNCTIONAL_H__ + +#include +#include +#include +#include "coreservices/imemop.h" + +namespace debugger { + +static const char *const IFACE_INSTRUCTION = "IInstruction"; + +class IInstruction : public IFace { + public: + IInstruction() : IFace(IFACE_INSTRUCTION) {} + + virtual const char *name() = 0; + /** Return instruction size */ + virtual int exec(Reg64Type *payload) = 0; +}; + +class GenericInstruction : public IInstruction { + public: + GenericInstruction() : IInstruction() {} +}; + +enum EEndianessType { + LittleEndian, + BigEndian, +}; + +static const char *const IFACE_CPU_FUNCTIONAL = "ICpuFunctional"; + +class ICpuFunctional : public IFace { + public: + ICpuFunctional() : IFace(IFACE_CPU_FUNCTIONAL) {} + + virtual void raiseSoftwareIrq() = 0; + virtual uint64_t getPC() = 0; + virtual void setBranch(uint64_t npc) = 0; + virtual void pushStackTrace() = 0; + virtual void popStackTrace() = 0; + virtual uint64_t getPrvLevel() = 0; + virtual void setPrvLevel(uint64_t lvl) = 0; + virtual void dma_memop(Axi4TransactionType *tr) = 0; + virtual bool isOn() = 0; + virtual bool isHalt() = 0; + virtual bool isSwBreakpoint() = 0; + virtual bool isHwBreakpoint() = 0; + virtual void go() = 0; + virtual void halt(const char *descr) = 0; + virtual void step() = 0; + virtual void addHwBreakpoint(uint64_t addr) = 0; + virtual void removeHwBreakpoint(uint64_t addr) = 0; + virtual void skipBreakpoint() = 0; + + protected: + virtual uint64_t getResetAddress() = 0; + virtual uint64_t getIrqAddress(int idx) = 0; + virtual EEndianessType endianess() = 0; + virtual GenericInstruction *decodeInstruction(Reg64Type *cache) = 0; + virtual void generateIllegalOpcode() = 0; + virtual void handleTrap() = 0; + /** Tack Registers changes during execution */ + virtual void trackContextStart() = 0; + /** Stop tracking and write trace file */ + virtual void trackContextEnd() = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_ICPUFUNCTIONAL_H__
icpufunctional.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: icpugen.h =================================================================== --- icpugen.h (nonexistent) +++ icpugen.h (revision 5) @@ -0,0 +1,50 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Generic CPU simulating interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_ICPUGEN_H__ +#define __DEBUGGER_COMMON_CORESERVICES_ICPUGEN_H__ + +#include +#include +#include "coreservices/imemop.h" + +namespace debugger { + +static const char *const IFACE_CPU_GENERIC = "ICpuGeneric"; +static const uint64_t REG_INVALID = ~0; + +struct DebugPortTransactionType { + bool write; + uint8_t region; + uint16_t addr; + uint32_t bytes; + uint64_t wdata; + uint64_t rdata; +}; + +static const char *const IFACE_DBG_NB_RESPONSE = "IDbgNbResponse"; + +class IDbgNbResponse : public IFace { + public: + IDbgNbResponse() : IFace(IFACE_DBG_NB_RESPONSE) {} + + virtual void nb_response_debug_port(DebugPortTransactionType *trans) = 0; +}; + +class ICpuGeneric : public IFace { + public: + ICpuGeneric() : IFace(IFACE_CPU_GENERIC) {} + + virtual void raiseSignal(int idx) = 0; + virtual void lowerSignal(int idx) = 0; + virtual void nb_transport_debug_port(DebugPortTransactionType *trans, + IDbgNbResponse *cb) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_ICPUGEN_H__
icpugen.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: idisplay.h =================================================================== --- idisplay.h (nonexistent) +++ idisplay.h (revision 5) @@ -0,0 +1,40 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Dismplay Simulation interface. + */ + +#ifndef __DEBUGGER_PLUGIN_IDISPLAY_H__ +#define __DEBUGGER_PLUGIN_IDISPLAY_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_DISPLAY = "IDisplay"; + +class IDisplay : public IFace { + public: + IDisplay() : IFace(IFACE_DISPLAY) {} + + virtual void initFrame() = 0; + virtual void setFramePixel(int x, int y, uint32_t rgb) = 0; + virtual void updateFrame() = 0; +}; + +static const char *const IFACE_LED_CONTROLLER = "ILedController"; + +class ILedController : public IFace { + public: + ILedController() : IFace(IFACE_LED_CONTROLLER) {} + + virtual void getResolution(int *width, int *height) = 0; + virtual void registerDisplay(IDisplay *led) = 0; + virtual void unregisterDisplay(IDisplay *led) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_PLUGIN_IDISPLAY_H__
idisplay.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: idsugen.h =================================================================== --- idsugen.h (nonexistent) +++ idsugen.h (revision 5) @@ -0,0 +1,29 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Generic Debug Support Unit simulating interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IDSUGEN_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IDSUGEN_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_DSU_GENERIC = "IDsuGeneric"; + +class IDsuGeneric : public IFace { + public: + IDsuGeneric() : IFace(IFACE_DSU_GENERIC) {} + + /** Bus utilization statistic methods */ + virtual void incrementRdAccess(int mst_id) = 0; + virtual void incrementWrAccess(int mst_id) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_ICPUGEN_H__
idsugen.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: iencoder.h =================================================================== --- iencoder.h (nonexistent) +++ iencoder.h (revision 5) @@ -0,0 +1,31 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Optical Encoder interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IENCODER_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IENCODER_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_ENCODER = "IEncoder"; + +class IEncoder : public IFace { + public: + IEncoder() : IFace(IFACE_ENCODER) {} + + virtual void rotateOn(int steps) = 0; + virtual uint8_t getEncoderState() = 0; + virtual double getAngleDegrees() = 0; + virtual double getHoles() = 0; + virtual double getPeriods() = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_IENCODER_H__
iencoder.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: ii2c.h =================================================================== --- ii2c.h (nonexistent) +++ ii2c.h (revision 5) @@ -0,0 +1,46 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief I2C interface description. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_II2C_H__ +#define __DEBUGGER_COMMON_CORESERVICES_II2C_H__ + +#include +#include + +namespace debugger { + +enum EStatusI2C { + I2C_ACK = 0, + I2C_NACK = 1 +}; + +static const char *const IFACE_I2C_MASTER = "IMasterI2C"; + +class IMasterI2C : public IFace { + public: + IMasterI2C() : IFace(IFACE_I2C_MASTER) {} + + virtual void registerI2CListener(IFace *iface) = 0; + virtual void unregisterI2CListener(IFace *iface) = 0; +}; + +static const char *const IFACE_I2C_SLAVE = "ISlaveI2C"; + +class ISlaveI2C : public IFace { + public: + ISlaveI2C() : IFace(IFACE_I2C_SLAVE) {} + + virtual uint8_t getPhysAddress() = 0; + virtual uint8_t getAddressLen() = 0; + virtual void setAddress(uint32_t addr) = 0; + virtual EStatusI2C writeNext(uint8_t byte) = 0; + virtual EStatusI2C readNext(uint8_t *byte) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_II2C_H__
ii2c.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: iioport.h =================================================================== --- iioport.h (nonexistent) +++ iioport.h (revision 5) @@ -0,0 +1,38 @@ +/** + * @file + * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief IO-port interface declaration. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IIOPORT_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IIOPORT_H__ + +#include + +namespace debugger { + +static const char *IFACE_IOPORT = "IIOPort"; + +class IIOPort : public IFace { + public: + IIOPort() : IFace(IFACE_IOPORT) {} + + virtual void registerPortListener(IFace *listener) = 0; + virtual void unregisterPortListener(IFace *listener) = 0; +}; + +static const char *IFACE_IOPORT_LISTENER = "IIOPortListener"; + +class IIOPortListener : public IFace { + public: + IIOPortListener() : IFace(IFACE_IOPORT_LISTENER) {} + + virtual void readData(uint8_t *val, uint8_t mask) = 0; + virtual void writeData(uint8_t val, uint8_t mask) = 0; + virtual void latch() = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_IIOPORT_H__
iioport.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: ikeyboard.h =================================================================== --- ikeyboard.h (nonexistent) +++ ikeyboard.h (revision 5) @@ -0,0 +1,28 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Keyboard interface declaration. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IKEYBOARD_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IKEYBOARD_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_KEYBOARD = "IKeyboard"; + +class IKeyboard : public IFace { + public: + IKeyboard() : IFace(IFACE_KEYBOARD) {} + + virtual void keyPress(const char *keyname) = 0; + virtual void keyRelease(const char *keyname) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_IKEYBOARD_H__
ikeyboard.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: ilink.h =================================================================== --- ilink.h (nonexistent) +++ ilink.h (revision 5) @@ -0,0 +1,38 @@ +/** + * @file + * @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Link interface declaration. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_ILINK_H__ +#define __DEBUGGER_COMMON_CORESERVICES_ILINK_H__ + +#include +#include +#include "irawlistener.h" + +namespace debugger { + +static const char *const IFACE_LINK = "ILink"; + +class ILink : public IFace { + public: + ILink() : IFace(IFACE_LINK) {} + + /** Get opened socket connection settings. */ + virtual void getConnectionSettings(AttributeType *settings) = 0; + + /** Setup remote host settings */ + virtual void setConnectionSettings(const AttributeType *target) = 0; + + /** Send datagram buffer. */ + virtual int sendData(const uint8_t *msg, int len) = 0; + + /** Read datagram buffer. */ + virtual int readData(const uint8_t *buf, int maxlen) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_ILINK_H__
ilink.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: immu.h =================================================================== --- immu.h (nonexistent) +++ immu.h (revision 5) @@ -0,0 +1,28 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief HC08 MMU interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IMMU_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IMMU_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_MMU = "IMMU"; + +class IMMU : public IFace { + public: + IMMU() : IFace(IFACE_MMU) {} + + virtual uint32_t get_ppage() = 0; + virtual void set_ppage(uint8_t v) = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_IMMU_H__
immu.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: imotor.h =================================================================== --- imotor.h (nonexistent) +++ imotor.h (revision 5) @@ -0,0 +1,40 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Motor with sensors interface. + */ + +#ifndef __DEBUGGER_PLUGIN_IMOTOR_H__ +#define __DEBUGGER_PLUGIN_IMOTOR_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_MOTOR = "IMotor"; + +class IMotor : public IFace { + public: + IMotor() : IFace(IFACE_MOTOR) {} + + /** 0 = motor is stopped; 1.0 = maximum rpm and enabled Breaks */ + virtual double getPowerConsumption() = 0; + + /** Backward pressure: 1.0 = 100% oclusion; 0 = no backward pressure */ + virtual double getForceResistance() = 0; + virtual void changeForceResistance(double v) = 0; + + /** value in a range 0 to length mm */ + virtual double getActuatorPos() = 0; + virtual double getActuatorMax() = 0; + + // Debug methods: + virtual double getVelocity() = 0; + virtual double getCurrent() = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_PLUGIN_IMOTOR_H__
imotor.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: ipll.h =================================================================== --- ipll.h (nonexistent) +++ ipll.h (revision 5) @@ -0,0 +1,27 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief PLL interface. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_IPLL_H__ +#define __DEBUGGER_COMMON_CORESERVICES_IPLL_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_PLL = "IPLL"; + +class IPLL : public IFace { + public: + IPLL() : IFace(IFACE_PLL) {} + + virtual uint64_t getBusClockHz() = 0; +}; + +} // namespace debugger + +#endif // __DEBUGGER_PLUGIN_IPLL_H__
ipll.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: ireset.h =================================================================== --- ireset.h (nonexistent) +++ ireset.h (revision 5) @@ -0,0 +1,66 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Generic reset interface. + */ + +#ifndef __DEBUGGER_PLUGIN_IRESET_H__ +#define __DEBUGGER_PLUGIN_IRESET_H__ + +#include +#include +#include + +namespace debugger { + +static const char *IFACE_RESET_LISTENER = "IResetListener"; + +class IResetListener : public IFace { + public: + IResetListener() : IFace(IFACE_RESET_LISTENER) {} + + virtual void reset(bool active) = 0; +}; + +static const char *const IFACE_RESET = "IReset"; + +class IReset : public IFace { + public: + IReset() : IFace(IFACE_RESET) { + resetListeners_.make_list(0); + } + + virtual void registerResetListener(IFace *listener) { + AttributeType item; + item.make_iface(listener); + resetListeners_.add_to_list(&item); + } + + virtual void unregisterResetListener(IFace *listener) { + for (unsigned i = 0; i < resetListeners_.size(); i++) { + if (listener == resetListeners_[i].to_iface()) { + resetListeners_.remove_from_list(i); + return; + } + } + } + + void reset(bool active) { + IResetListener *l; + for (unsigned i = 0; i < resetListeners_.size(); i++) { + l = static_cast(resetListeners_[i].to_iface()); + l->reset(active); + } + } + + virtual void powerOnPressed() = 0; + virtual void powerOnReleased() = 0; + + protected: + AttributeType resetListeners_; +}; + +} // namespace debugger + +#endif // __DEBUGGER_PLUGIN_IRESET_H__
ireset.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: isensor.h =================================================================== --- isensor.h (nonexistent) +++ isensor.h (revision 5) @@ -0,0 +1,31 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Sensor's interface. + */ + +#ifndef __DEBUGGER_PLUGIN_ISENSOR_H__ +#define __DEBUGGER_PLUGIN_ISENSOR_H__ + +#include +#include + +namespace debugger { + +static const char *const IFACE_SENSOR = "ISensor"; + +class ISensor : public IFace { + public: + ISensor() : IFace(IFACE_SENSOR) {} + + virtual void changeSensorValue(double rate) = 0; + virtual double getSensorValue() = 0; + virtual double getPhysicalValue() { + return getSensorValue(); + } +}; + +} // namespace debugger + +#endif // __DEBUGGER_PLUGIN_ISENSOR_H__
isensor.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property Index: isound.h =================================================================== --- isound.h (nonexistent) +++ isound.h (revision 5) @@ -0,0 +1,55 @@ +/** + * @file + * @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. + * @author Sergey Khabarov - sergeykhbr@gmail.com + * @brief Sound source interface with wav-format suppport. + */ + +#ifndef __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__ +#define __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__ + +#include +#include +#include + +namespace debugger { + +static const char *const IFACE_SOUND = "ISound"; + +static const int SOUND_CHANNELS_MAX = 2; + +struct SoundSampleType { + int chan[SOUND_CHANNELS_MAX]; +}; + +class ISound : public IFace { + public: + ISound() : IFace(IFACE_SOUND) { + soundListeners_.make_list(0); + } + + /** Update listeners with configurable bit rate 44.1 kHz for an example */ + virtual void registerSoundListener(IFace *listener) { + AttributeType item; + item.make_iface(listener); + soundListeners_.add_to_list(&item); + } + + virtual void unregisterSoundListener(IFace *listener) { + for (unsigned i = 0; i < soundListeners_.size(); i++) { + if (listener == soundListeners_[i].to_iface()) { + soundListeners_.remove_from_list(i); + return; + } + } + } + + virtual double getFreqDetectedHz() = 0; + + protected: + AttributeType soundListeners_; +}; + +} // namespace debugger + +#endif // __DEBUGGER_COMMON_CORESERVICES_ISOUND_H__
isound.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Author Date Id Rev URL \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.