Commit 78c10874 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Cleaning up mc directory

parent 2c8a2613
/*.mc
/extctrl2014_lc.h
/extctrl2014_lc.c
/mc.globalize
/mc.globalize.c
......@@ -7,7 +7,8 @@ TARGETS=lth_fixes.mc \
hijacknet_test.mc \
extctrl2014_lc.mc
AUTO_GEN=extctrl2014_lc.c \
extctrl2014_lc.h
extctrl2014_lc.h \
mc.globalize.c
GLOBALIZE=netFuncs \
fei82557Int \
fei82557Send \
......
make
make globalize ROBOT=yoda.b
make commands ROBOT=yoda.b
#include <hijacknet.h>
#include <fppLib.h>
#include <stdio.h>
#include <string.h>
static int N;
static struct {
int length;
unsigned char data[1520];
} to_send;
static int hook(HIJACKNET_DRIVER *driver,
void *data, int length,
void *context)
{
FP_CONTEXT fp_context;
fppSave(&fp_context);
N++;
if (to_send.length == 0) {
to_send.length = min(length, sizeof(to_send.data));
memcpy(to_send.data, data, to_send.length);
}
fppRestore(&fp_context);
return length;
}
int hijacknet_test(char *device)
{
HIJACKNET_DRIVER *driver;
int result;
int i;
printf("%s %d\n", device, N);
driver = hijacknet_open(device);
if (!driver) {
goto out;
}
result = hijacknet_add_receive_hook(driver, HIJACK_ANY_ETHER_TYPE,
hook, NULL);
for (i = 0 ; i < 10000 ; i++) {
if (to_send.length) {
to_send.data[0] = 0xff;
hijacknet_send(driver, to_send.data, to_send.length);
to_send.length = 0;
}
taskDelay(1);
}
result = hijacknet_del_receive_hook(driver, HIJACK_ANY_ETHER_TYPE,
hook, NULL);
printf("%s %d\n", device, N);
hijacknet_close(driver);
out:
return 0;
}
#include <types.h>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment