2010-04-27 21:05:35 +00:00
|
|
|
#include <grub/net/ieee1275/interface.h>
|
2010-06-21 22:20:55 +00:00
|
|
|
#include <grub/net/netbuff.h>
|
|
|
|
#include <grub/ieee1275/ofnet.h>
|
2010-04-27 21:05:35 +00:00
|
|
|
|
|
|
|
static grub_ieee1275_ihandle_t handle;
|
|
|
|
int card_open (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
grub_ieee1275_open (grub_net->dev , &handle);
|
2010-06-21 22:20:55 +00:00
|
|
|
return 0;
|
2010-04-27 21:05:35 +00:00
|
|
|
|
|
|
|
}
|
2010-06-21 22:20:55 +00:00
|
|
|
|
2010-04-27 21:05:35 +00:00
|
|
|
int card_close (void)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (handle)
|
|
|
|
grub_ieee1275_close (handle);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-21 22:20:55 +00:00
|
|
|
int send_card_buffer (struct grub_net_buff *pack)
|
2010-04-27 21:05:35 +00:00
|
|
|
{
|
|
|
|
|
2010-06-21 22:20:55 +00:00
|
|
|
int actual;
|
|
|
|
grub_ieee1275_write (handle,pack->data,pack->tail - pack->data,&actual);
|
2010-04-27 21:05:35 +00:00
|
|
|
|
|
|
|
return actual;
|
|
|
|
}
|
|
|
|
|
2010-06-21 22:20:55 +00:00
|
|
|
int get_card_packet (struct grub_net_buff *pack __attribute__ ((unused)))
|
2010-04-27 21:05:35 +00:00
|
|
|
{
|
|
|
|
|
2010-07-29 19:36:17 +00:00
|
|
|
int actual, rc;
|
2010-06-21 22:20:55 +00:00
|
|
|
pack->data = pack->tail = pack->head;
|
|
|
|
do
|
|
|
|
{
|
2010-07-29 19:36:17 +00:00
|
|
|
rc = grub_ieee1275_read (handle,pack->data,1500,&actual);
|
2010-06-23 17:49:46 +00:00
|
|
|
|
2010-07-29 19:36:17 +00:00
|
|
|
}while (actual <= 0 || rc < 0);
|
|
|
|
grub_netbuff_put (pack, actual);
|
2010-06-23 17:49:46 +00:00
|
|
|
|
2010-06-21 22:20:55 +00:00
|
|
|
// grub_printf("packsize %d\n",pack->tail - pack->data);
|
|
|
|
return 0;// sizeof (eth) + iph.len;
|
2010-04-27 21:05:35 +00:00
|
|
|
}
|