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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [socsim_plugin/] [uart.h] - Diff between revs 2 and 4

Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 1... Line 1...
/**
/*
 * @file
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
 *
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * @brief      UART functional model.
 *  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_SOCSIM_PLUGIN_UART_H__
#ifndef __DEBUGGER_SOCSIM_PLUGIN_UART_H__
#define __DEBUGGER_SOCSIM_PLUGIN_UART_H__
#define __DEBUGGER_SOCSIM_PLUGIN_UART_H__
 
 
Line 12... Line 21...
#include "iservice.h"
#include "iservice.h"
#include "coreservices/imemop.h"
#include "coreservices/imemop.h"
#include "coreservices/iserial.h"
#include "coreservices/iserial.h"
#include "coreservices/iwire.h"
#include "coreservices/iwire.h"
#include "coreservices/irawlistener.h"
#include "coreservices/irawlistener.h"
 
#include "coreservices/iclock.h"
#include <string>
#include <string>
 
 
namespace debugger {
namespace debugger {
 
 
class UART : public IService,
class UART : public IService,
Line 27... Line 37...
 
 
    /** 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();
 
    }
 
 
 
    /** ISerial */
    /** ISerial */
    virtual int writeData(const char *buf, int sz);
    virtual int writeData(const char *buf, int sz);
    virtual void registerRawListener(IFace *listener);
    virtual void registerRawListener(IFace *listener);
    virtual void unregisterRawListener(IFace *listener);
    virtual void unregisterRawListener(IFace *listener);
 
    virtual void getListOfPorts(AttributeType *list);
 
    virtual int openPort(const char *port, AttributeType settings);
 
    virtual void closePort();
 
 
private:
private:
    AttributeType baseAddress_;
 
    AttributeType length_;
 
    AttributeType irqLine_;
 
    AttributeType irqctrl_;
    AttributeType irqctrl_;
    AttributeType listeners_;  // non-registering attribute
    AttributeType listeners_;  // non-registering attribute
 
    AttributeType autoTestEna_;
 
    AttributeType testCases_;
    IWire *iwire_;
    IWire *iwire_;
 
 
    std::string input_;
    std::string input_;
    static const int RX_FIFO_SIZE = 16;
    static const int RX_FIFO_SIZE = 16;
    char rxfifo_[RX_FIFO_SIZE];
    char rxfifo_[RX_FIFO_SIZE];
Line 63... Line 68...
        volatile uint32_t status;
        volatile uint32_t status;
        volatile uint32_t scaler;
        volatile uint32_t scaler;
        uint32_t rsrv[2];
        uint32_t rsrv[2];
        volatile uint32_t data;
        volatile uint32_t data;
    } regs_;
    } regs_;
 
 
 
  private:
 
    class AutoTest : public IClockListener {
 
     public:
 
        AutoTest(ISerial *parent, AttributeType *tests);
 
 
 
        /** IClockListener */
 
        virtual void stepCallback(uint64_t t);
 
     private:
 
        ISerial *parent_;
 
        AttributeType tests_;
 
        unsigned testcnt_;
 
    };
 
    AutoTest *pautotest_;
};
};
 
 
DECLARE_CLASS(UART)
DECLARE_CLASS(UART)
 
 
}  // namespace debugger
}  // namespace debugger

powered by: WebSVN 2.1.0

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