ParaNut SystemC Model
A SystemC Model of the ParaNut architecture
remote_bitbang.h
Go to the documentation of this file.
1 /*************************************************************************
2 
3  This file was copied and modified from the Spike ISA Simulator project:
4  https://github.com/riscv/riscv-isa-sim
5 
6 Copyright (c) 2010-2017, The Regents of the University of California
7 (Regents). All Rights Reserved.
8 
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
11 1. Redistributions of source code must retain the above copyright
12  notice, this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 3. Neither the name of the Regents nor the
17  names of its contributors may be used to endorse or promote products
18  derived from this software without specific prior written permission.
19 
20 IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
21 SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
22 OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
23 BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
28 HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
29 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
30 
31  *************************************************************************/
32 
33 #ifndef REMOTE_BITBANG_H
34 #define REMOTE_BITBANG_H
35 
36 #include <stdint.h>
37 
38 #include "jtag_dtm.h"
39 
41 {
42 public:
43  // Create a new server, listening for connections from localhost on the given
44  // port.
45  remote_bitbang_t(uint16_t port, jtag_dtm_t *tap);
46 
47  // Do a bit of work.
48  void tick();
49 
50 private:
51  jtag_dtm_t *tap;
52 
53  int socket_fd;
54  int client_fd;
55 
56  static const ssize_t buf_size = 64 * 1024;
57  char recv_buf[buf_size];
58  ssize_t recv_start, recv_end;
59 
60  // Check for a client connecting, and accept if there is one.
61  void accept();
62  // Execute any commands the client has for us.
63  void execute_commands();
64 };
65 
66 #endif
Definition: remote_bitbang.h:41
remote_bitbang_t(uint16_t port, jtag_dtm_t *tap)
Definition: remote_bitbang.cpp:62
void tick()
Definition: remote_bitbang.cpp:131