287d8e3fe7ab00963833de0f79320ca40f03c1f1
[tpg/acess2.git] / UDI / drivers / net_ne2000 / ne2000_rx.c
1 /*
2  * UDI Ne2000 NIC Driver
3  * By John Hodge (thePowersGang)
4  *
5  * ne2000_rx.c
6  * - Receive Code
7  */
8 #include <udi.h>
9 #include <udi_nic.h>
10 #include "ne2000_common.h"
11
12 // === PROTOTYPES ===
13 udi_pio_trans_call_t    ne2k_rx__complete;
14
15 // === CODE ===
16 void ne2k_nd_rx_channel_event_ind(udi_channel_event_cb_t *cb)
17 {
18 }
19 void ne2k_nd_rx_rx_rdy(udi_nic_rx_cb_t *cb)
20 {
21         // TODO: Add cb(s) to avaliable list
22 }
23 void ne2k_intr__rx_ok(udi_cb_t *gcb)
24 {
25         ne2k_rdata_t    *rdata = gcb->context;
26         if( rdata->rx_next_cb )
27         {
28                 udi_nic_rx_cb_t *rx_cb = rdata->rx_next_cb;
29                 rdata->rx_next_cb = rx_cb->chain;
30                 rx_cb->chain = NULL;
31                 udi_pio_trans(ne2k_rx__complete, UDI_GCB(rx_cb),
32                         rdata->pio_handles[NE2K_PIO_RX], 0, NULL, &rdata->rx_next_page);
33         }
34         else
35         {
36                 // Drop packet due to no free cbs
37         }
38 }
39
40 void ne2k_rx__complete(udi_cb_t *gcb, udi_buf_t *new_buf, udi_status_t status, udi_ubit16_t result)
41 {
42         udi_nic_rx_cb_t *rx_cb = UDI_MCB(gcb, udi_nic_rx_cb_t);
43         // TODO: Check result
44         udi_nsr_rx_ind( rx_cb );
45 }
46
47

UCC git Repository :: git.ucc.asn.au