friendev EtherDune TCP/IP library
/home/jander/temp/etherdune/ENC28J60.h
Go to the documentation of this file.
1 // EtherDune ENC28J60 hardware driver
2 // Author: Javier Peletier <jm@friendev.com>
3 // Credits: Initially based off EtherCard's own enc28j60.cpp file, but heavily modified afterwards.
4 // Credits: Jean-Claude Wippler, Guido Socher and Pascal Stang
5 // Summary: Encapsulates access to the ENC28J60 hardware
6 //
7 // Copyright (c) 2015 All Rights Reserved, http://friendev.com
8 //
9 // This source is subject to the GPLv2 license.
10 // Please see the License.txt file for more information.
11 // All other rights reserved.
12 //
13 // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
14 // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
15 // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
16 // PARTICULAR PURPOSE.
17 
21 
22 #ifndef __EENC28J60__H_
23 #define __EENC28J60__H_
24 
25 #define __PROG_TYPES_COMPAT__
26 
27 #include <ACross.h>
28 
29 #include "inet.h"
30 #include "enc28j60constants.h"
31 #include "config.h"
32 
33 
34 class NetworkService;
35 class SharedBuffer;
36 
37 class ENC28J60
38 {
39  friend class SharedBuffer;
40 
41 protected:
42 
43  static void writeByte(byte b);
44  static void writeByte(uint16_t dst, byte b);
45  static void writeBuf(uint16_t dst, uint16_t len, const byte* data);
46  static void writeBuf(uint16_t len, const byte* data);
47  static uint16_t hardwareChecksum(uint16_t src, uint16_t len);
48  static uint16_t hardwareChecksumRxOffset(uint16_t offset, uint16_t len);
49  static void moveMem(uint16_t dest, uint16_t src, uint16_t len);
50  static void readBuf(uint16_t src, uint16_t len, byte* data);
51  static void readBuf(uint16_t len, byte* data);
52  static byte readByte(uint16_t src);
53  static void packetSend(uint16_t len);
54  static void packetSend(uint16_t len, const byte* data);
55  static void loadSample();
56  static void loadAll();
57  static void release();
58  static uint8_t begin(uint8_t cspin);
59  static void loop();
60  static void enableBroadcast();
61 
62 public:
63 
64  static bool isLinkUp();
65 
66 };
67 
68 #endif
static void moveMem(uint16_t dest, uint16_t src, uint16_t len)
Definition: ENC28J60.cpp:198
static void release()
Definition: ENC28J60.cpp:410
static byte readByte(uint16_t src)
Definition: ENC28J60.cpp:139
static uint8_t begin(uint8_t cspin)
Definition: ENC28J60.cpp:310
static void enableBroadcast()
Definition: ENC28J60.cpp:281
static void writeByte(byte b)
Definition: ENC28J60.cpp:130
static void packetSend(uint16_t len)
Definition: ENC28J60.cpp:256
static bool isLinkUp()
Determines whether the network link is ready
Definition: ENC28J60.cpp:306
Encapsulates access to the ENC28J60 hardware.
Definition: ENC28J60.h:37
Implements a "shared" circular buffer using spare ENC28J60 memory.
Definition: SharedBuffer.h:158
static uint16_t hardwareChecksumRxOffset(uint16_t offset, uint16_t len)
static void loop()
static uint16_t hardwareChecksum(uint16_t src, uint16_t len)
Base data structures for Internet communication.
static void readBuf(uint16_t src, uint16_t len, byte *data)
Definition: ENC28J60.cpp:109
static void loadAll()
Definition: ENC28J60.cpp:400
static void writeBuf(uint16_t dst, uint16_t len, const byte *data)
Definition: ENC28J60.cpp:123
Abstract base class for any network service running in EtherDune.
static void loadSample()
Definition: ENC28J60.cpp:367