mikroSDK Reference Manual
rndis_driver.h
Go to the documentation of this file.
1
31#ifndef _RNDIS_DRIVER_H
32#define _RNDIS_DRIVER_H
33
34//Dependencies
35#include "core/nic.h"
36
37//Number of TX buffers
38#ifndef RNDIS_TX_BUFFER_COUNT
39 #define RNDIS_TX_BUFFER_COUNT 2
40#elif (RNDIS_TX_BUFFER_COUNT < 1)
41 #error RNDIS_TX_BUFFER_COUNT parameter is not valid
42#endif
43
44//TX buffer size
45#ifndef RNDIS_TX_BUFFER_SIZE
46 #define RNDIS_TX_BUFFER_SIZE 2048
47#elif (RNDIS_TX_BUFFER_SIZE != 2048)
48 #error RNDIS_TX_BUFFER_SIZE parameter is not valid
49#endif
50
51//Number of RX buffers
52#ifndef RNDIS_RX_BUFFER_COUNT
53 #define RNDIS_RX_BUFFER_COUNT 1
54#elif (RNDIS_RX_BUFFER_COUNT < 1)
55 #error RNDIS_RX_BUFFER_COUNT parameter is not valid
56#endif
57
58//RX buffer size
59#ifndef RNDIS_RX_BUFFER_SIZE
60 #define RNDIS_RX_BUFFER_SIZE 2048
61#elif (RNDIS_RX_BUFFER_SIZE != 2048)
62 #error RNDIS_RX_BUFFER_SIZE parameter is not valid
63#endif
64
65
70typedef struct
71{
72 bool_t ready;
73 size_t length;
74 uint8_t data[RNDIS_TX_BUFFER_SIZE];
76
77
82typedef struct
83{
84 bool_t ready;
85 size_t length;
86 uint8_t data[RNDIS_RX_BUFFER_SIZE];
88
89
90//RNDIS driver
91extern const NicDriver rndisDriver;
92//Underlying network interface
93extern NetInterface *rndisDriverInterface;
94
95//TX and RX buffers
96extern RndisTxBufferDesc rndisTxBuffer[RNDIS_TX_BUFFER_COUNT];
97extern RndisRxBufferDesc rndisRxBuffer[RNDIS_RX_BUFFER_COUNT];
98
99//Buffer indexes
100extern uint_t rndisTxWriteIndex;
101extern uint_t rndisTxReadIndex;
102extern uint_t rndisRxWriteIndex;
103extern uint_t rndisRxReadIndex;
104
105//RNDIS driver related functions
106error_t rndisDriverInit(NetInterface *interface);
107
108void rndisDriverTick(NetInterface *interface);
109
110void rndisDriverEnableIrq(NetInterface *interface);
111void rndisDriverDisableIrq(NetInterface *interface);
112void rndisDriverEventHandler(NetInterface *interface);
113
114error_t rndisDriverSendPacket(NetInterface *interface,
115 const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary);
116
117error_t rndisDriverReceivePacket(NetInterface *interface,
118 uint8_t *buffer, size_t size, size_t *length);
119
120error_t rndisDriverSetMulticastFilter(NetInterface *interface);
121
122#endif
error_t
Error codes.
Definition error.h:43
Network interface controller abstraction layer.
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
NIC driver.
Definition nic.h:283
RX buffer descriptor.
Definition rndis_driver.h:83
TX buffer descriptor.
Definition rndis_driver.h:71