OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [cpp/] [fcpprotocol.hpp] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 peteralieb
// fcpprotocol.hpp
2
 
3
#ifndef FCPPROTOCOL_HPP
4
#define FCPPROTOCOL_HPP
5
 
6
#include "rawethernet.hpp"
7
 
8
typedef unsigned char byte;
9
 
10
// FCP Commands
11
#define FCP_DATA_SND            0
12
#define FCP_ACK                 1
13
#define FCP_CONNECT             2
14
#define FCP_CON_ACK             3
15
#define FCP_DATA_REQ            4
16
#define FCP_DATA_ACK            5
17
 
18
class FCPProtocol
19
{
20
private:
21
        int snd_cur;
22
        int last_ack;
23
        RawEthernet *enet;
24
        byte ip[4];
25
        void wrapFCPUDPIP(byte *buffer, byte *data);
26
        static const byte packet_con[];
27
        static const byte ip_header[];
28
        static const byte udp_header[];
29
        byte buffer[1500];
30
        byte sendbuf[1500];
31
        void insertIPChecksum();
32
        bool receiveFcpUdpIp(int len, byte *data);
33
 
34
public:
35
        FCPProtocol ();
36
        ~FCPProtocol ();
37
        bool connect(byte mac[], byte ip[]);
38
        void disconnect(void);
39
        bool sendData(int channel, byte data[], int len);
40
        bool requestData(int channel, int len, byte *data);
41
        bool connected();
42
        void wrapFcpUdpIp(byte command, int channel, byte *data, int len);
43
};
44
 
45
#endif

powered by: WebSVN 2.1.0

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