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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [libdbg64g/] [services/] [debug/] [serial_dbglink.h] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 sergeykhbr
/*
2
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
3
 *
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
 *  you may not use this file except in compliance with the License.
6
 *  You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *  Unless required by applicable law or agreed to in writing, software
11
 *  distributed under the License is distributed on an "AS IS" BASIS,
12
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *  See the License for the specific language governing permissions and
14
 *  limitations under the License.
15
 */
16
 
17
#ifndef __DEBUGGER_SERIAL_DBGLINK_SERVICE_H__
18
#define __DEBUGGER_SERIAL_DBGLINK_SERVICE_H__
19
 
20
#include "iclass.h"
21
#include "iservice.h"
22
#include "coreservices/itap.h"
23
#include "coreservices/iserial.h"
24
#include "coreservices/irawlistener.h"
25
 
26
namespace debugger {
27
 
28
#define MAGIC_ID 0x31
29
static const int UART_REQ_HEADER_SZ = 10;
30
static const int UART_MST_BURST_MAX = 64;
31
 
32
#pragma pack(1)
33
struct UartMstPacketType {
34
    uint8_t magic;
35
    uint8_t cmd;
36
    uint64_t addr;
37
    uint32_t data[UART_MST_BURST_MAX];
38
};
39
#pragma pack()
40
 
41
union PacketType {
42
    UartMstPacketType fields;
43
    char buf[1];
44
};
45
 
46
class SerialDbgService : public IService,
47
                         public ITap,
48
                         public IRawListener {
49
public:
50
    SerialDbgService(const char *name);
51
    ~SerialDbgService();
52
 
53
    /** IService interface */
54
    virtual void postinitService();
55
    virtual void predeleteService();
56
 
57
    /** ITap interface */
58
    virtual int read(uint64_t addr, int bytes, uint8_t *obuf);
59
    virtual int write(uint64_t addr, int bytes, uint8_t *ibuf);
60
 
61
    /** IRawListener interface */
62
    virtual void updateData(const char *buf, int buflen);
63
 
64
private:
65
    AttributeType timeout_;
66
    AttributeType port_;
67
 
68
    ISerial *iserial_;
69
    event_def event_block_;
70
    PacketType pkt_;
71
    int rd_count_;
72
    int req_count_;
73
    int wait_bytes_;
74
    Reg64Type rxbuf_[UART_MST_BURST_MAX];
75
};
76
 
77
DECLARE_CLASS(SerialDbgService)
78
 
79
}  // namespace debugger
80
 
81
#endif  // __DEBUGGER_SERIAL_DBGLINK_SERVICE_H__

powered by: WebSVN 2.1.0

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