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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [common/] [async_tqueue.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Asynchronous queue with time markers.
6
 */
7
 
8
#ifndef __DEBUGGER_ASYNC_TQUEUE_H__
9
#define __DEBUGGER_ASYNC_TQUEUE_H__
10
 
11
#include "api_types.h"
12
#include "iface.h"
13
#include "attribute.h"
14
 
15
namespace debugger {
16
 
17
class AsyncTQueueType {
18
public:
19
    AsyncTQueueType();
20
    ~AsyncTQueueType();
21
 
22
    /** Thread safe method of the calbacks registration */
23
    void put(uint64_t time, IFace *cb);
24
 
25
    /** push registered to the main queue */
26
    void pushPreQueued();
27
 
28
    /** Reset proccessed counter at the begining of each iteration */
29
    void initProc();
30
 
31
    /**
32
     * Get next registered interface with counter less or equal to 'step_cnt'
33
     */
34
    IFace *getNext(uint64_t step_cnt);
35
 
36
private:
37
    enum QueueItemNames {
38
        Queue_Time,
39
        Queue_IFace,
40
        Queue_Total
41
    };
42
    AttributeType item_;
43
    AttributeType stepQueue_;
44
    AttributeType stepPreQueued_;
45
    unsigned curIdx_;
46
    unsigned preLen_;
47
    unsigned curLen_;    // to avoid reallocation
48
    mutex_def mutex_;
49
};
50
 
51
}  // namespace debugger
52
 
53
#endif  // __DEBUGGER_ASYNC_TQUEUE_H__

powered by: WebSVN 2.1.0

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