rndis_driver.h
Go to the documentation of this file.
1 /**
2  * @file rndis_driver.h
3  * @brief RNDIS driver
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Pro.
10  *
11  * This software is provided under a commercial license. You may
12  * use this software under the conditions stated in the license
13  * terms. This source code cannot be redistributed.
14  *
15  * @author Oryx Embedded SARL (www.oryx-embedded.com)
16  * @version 1.9.0
17  **/
18 
19 #ifndef _RNDIS_DRIVER_H
20 #define _RNDIS_DRIVER_H
21 
22 //Dependencies
23 #include "core/nic.h"
24 
25 //Number of TX buffers
26 #ifndef RNDIS_TX_BUFFER_COUNT
27  #define RNDIS_TX_BUFFER_COUNT 2
28 #elif (RNDIS_TX_BUFFER_COUNT != 1)
29  #error RNDIS_TX_BUFFER_COUNT parameter is not valid
30 #endif
31 
32 //TX buffer size
33 #ifndef RNDIS_TX_BUFFER_SIZE
34  #define RNDIS_TX_BUFFER_SIZE 2048
35 #elif (RNDIS_TX_BUFFER_SIZE != 2048)
36  #error RNDIS_TX_BUFFER_SIZE parameter is not valid
37 #endif
38 
39 //Number of RX buffers
40 #ifndef RNDIS_RX_BUFFER_COUNT
41  #define RNDIS_RX_BUFFER_COUNT 1
42 #elif (RNDIS_RX_BUFFER_COUNT < 1)
43  #error RNDIS_RX_BUFFER_COUNT parameter is not valid
44 #endif
45 
46 //RX buffer size
47 #ifndef RNDIS_RX_BUFFER_SIZE
48  #define RNDIS_RX_BUFFER_SIZE 2048
49 #elif (RNDIS_RX_BUFFER_SIZE != 2048)
50  #error RNDIS_RX_BUFFER_SIZE parameter is not valid
51 #endif
52 
53 
54 /**
55  * @brief TX buffer descriptor
56  **/
57 
58 typedef struct
59 {
61  size_t length;
64 
65 
66 /**
67  * @brief RX buffer descriptor
68  **/
69 
70 typedef struct
71 {
73  size_t length;
76 
77 
78 //RNDIS driver
79 extern const NicDriver rndisDriver;
80 //Underlying network interface
82 
83 //TX and RX buffers
86 
87 //Buffer indexes
92 
93 //RNDIS driver related functions
95 
96 void rndisDriverTick(NetInterface *interface);
97 
98 void rndisDriverEnableIrq(NetInterface *interface);
99 void rndisDriverDisableIrq(NetInterface *interface);
100 void rndisDriverEventHandler(NetInterface *interface);
101 
103  const NetBuffer *buffer, size_t offset);
104 
106  uint8_t *buffer, size_t size, size_t *length);
107 
109 
110 #endif
RX buffer descriptor.
Definition: rndis_driver.h:70
RndisTxBufferDesc rndisTxBuffer[RNDIS_TX_BUFFER_COUNT]
Definition: rndis_driver.c:35
#define RNDIS_TX_BUFFER_SIZE
Definition: rndis_driver.h:34
void rndisDriverEnableIrq(NetInterface *interface)
Enable interrupts.
Definition: rndis_driver.c:127
TX buffer descriptor.
Definition: rndis_driver.h:58
error_t rndisDriverInit(NetInterface *interface)
RNDIS driver initialization.
Definition: rndis_driver.c:76
#define RNDIS_RX_BUFFER_SIZE
Definition: rndis_driver.h:48
NetInterface * rndisDriverInterface
Definition: rndis_driver.c:32
error_t rndisDriverReceivePacket(NetInterface *interface, uint8_t *buffer, size_t size, size_t *length)
Receive a packet.
Definition: rndis_driver.c:310
error_t rndisDriverSetMulticastFilter(NetInterface *interface)
Configure multicast MAC address filtering.
Definition: rndis_driver.c:394
uint_t rndisTxWriteIndex
Definition: rndis_driver.c:39
const NicDriver rndisDriver
RNDIS driver.
Definition: rndis_driver.c:49
NIC driver.
Definition: nic.h:161
error_t rndisDriverSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset)
Send a packet.
Definition: rndis_driver.c:208
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:86
#define RNDIS_TX_BUFFER_COUNT
Definition: rndis_driver.h:27
void rndisDriverEventHandler(NetInterface *interface)
RNDIS driver event handler.
Definition: rndis_driver.c:151
void rndisDriverDisableIrq(NetInterface *interface)
Disable interrupts.
Definition: rndis_driver.c:139
error_t
Error codes.
Definition: error.h:40
RndisRxBufferDesc rndisRxBuffer[RNDIS_RX_BUFFER_COUNT]
Definition: rndis_driver.c:36
unsigned int uint_t
Definition: compiler_port.h:43
uint8_t data[]
Definition: dtls_misc.h:167
void rndisDriverTick(NetInterface *interface)
RNDIS driver timer handler.
Definition: rndis_driver.c:116
#define NetInterface
Definition: net.h:34
#define RNDIS_RX_BUFFER_COUNT
Definition: rndis_driver.h:41
uint_t rndisRxWriteIndex
Definition: rndis_driver.c:41
uint_t rndisRxReadIndex
Definition: rndis_driver.c:42
uint8_t length
Definition: dtls_misc.h:140
uint_t rndisTxReadIndex
Definition: rndis_driver.c:40
int bool_t
Definition: compiler_port.h:47
Network interface controller abstraction layer.