/**
|
/**
|
* @file
|
* @file
|
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
* @brief General Purpose Timers model.
|
* @brief General Purpose Timers model.
|
*/
|
*/
|
|
|
#ifndef __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
#ifndef __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
#define __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
#define __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
|
|
#include "iclass.h"
|
#include "iclass.h"
|
#include "iservice.h"
|
#include "iservice.h"
|
#include "coreservices/imemop.h"
|
#include "coreservices/imemop.h"
|
#include "coreservices/iclklistener.h"
|
#include "coreservices/iclklistener.h"
|
#include "coreservices/iclock.h"
|
#include "coreservices/iclock.h"
|
#include "coreservices/iwire.h"
|
#include "coreservices/iwire.h"
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
class GPTimers : public IService,
|
class GPTimers : public IService,
|
public IMemoryOperation,
|
public IMemoryOperation,
|
public IClockListener {
|
public IClockListener {
|
public:
|
public:
|
GPTimers(const char *name);
|
GPTimers(const char *name);
|
~GPTimers();
|
~GPTimers();
|
|
|
/** IService interface */
|
/** IService interface */
|
virtual void postinitService();
|
virtual void postinitService();
|
|
|
/** IMemoryOperation */
|
/** IMemoryOperation */
|
virtual void b_transport(Axi4TransactionType *trans);
|
virtual ETransStatus b_transport(Axi4TransactionType *trans);
|
|
|
virtual uint64_t getBaseAddress() {
|
|
return baseAddress_.to_uint64();
|
|
}
|
|
virtual uint64_t getLength() {
|
|
return length_.to_uint64();
|
|
}
|
|
|
|
/** IClockListener */
|
/** IClockListener */
|
virtual void stepCallback(uint64_t t);
|
virtual void stepCallback(uint64_t t);
|
|
|
private:
|
private:
|
AttributeType baseAddress_;
|
|
AttributeType length_;
|
|
AttributeType irqLine_;
|
|
AttributeType irqctrl_;
|
AttributeType irqctrl_;
|
AttributeType clksrc_;
|
AttributeType clksrc_;
|
IWire *iwire_;
|
IWire *iwire_;
|
IClock *iclk_;
|
IClock *iclk_;
|
|
|
static const uint32_t TIMER_CONTROL_ENA = 1<<0;
|
static const uint32_t TIMER_CONTROL_ENA = 1<<0;
|
struct gptimers_map {
|
struct gptimers_map {
|
uint64_t highcnt;
|
uint64_t highcnt;
|
uint32_t pending;
|
uint32_t pending;
|
uint32_t rsvr[13];
|
uint32_t rsvr[13];
|
typedef struct gptimer_type {
|
typedef struct gptimer_type {
|
volatile uint32_t control;
|
volatile uint32_t control;
|
volatile uint32_t rsv1;
|
volatile uint32_t rsv1;
|
volatile uint64_t cur_value;
|
volatile uint64_t cur_value;
|
volatile uint64_t init_value;
|
volatile uint64_t init_value;
|
} gptimer_type;
|
} gptimer_type;
|
gptimer_type timer[2];
|
gptimer_type timer[2];
|
} regs_;
|
} regs_;
|
|
|
|
int dbg_irq_cnt_;
|
};
|
};
|
|
|
DECLARE_CLASS(GPTimers)
|
DECLARE_CLASS(GPTimers)
|
|
|
} // namespace debugger
|
} // namespace debugger
|
|
|
#endif // __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
#endif // __DEBUGGER_SOCSIM_PLUGIN_GPTIMERS_H__
|
|
|