Updated to not rely on uIP
This commit is contained in:
parent
d9109e9e83
commit
5e98ede3a3
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tr1001-gcr.c,v 1.2 2006/10/06 07:57:14 adamdunkels Exp $
|
* @(#)$Id: tr1001-gcr.c,v 1.3 2006/10/09 11:56:13 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup esb
|
* \addtogroup esb
|
||||||
|
@ -109,8 +109,6 @@ struct tr1001_hdr {
|
||||||
*/
|
*/
|
||||||
#define TR1001_HDRLEN sizeof(struct tr1001_hdr)
|
#define TR1001_HDRLEN sizeof(struct tr1001_hdr)
|
||||||
|
|
||||||
#define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
|
|
||||||
|
|
||||||
#define OFF 0
|
#define OFF 0
|
||||||
#define ON 1
|
#define ON 1
|
||||||
static u8_t onoroff = ON;
|
static u8_t onoroff = ON;
|
||||||
|
@ -659,7 +657,7 @@ tr1001_send(u8_t *packet, u16_t len)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
unsigned short
|
unsigned short
|
||||||
tr1001_poll(void)
|
tr1001_poll(u8_t *buf, u16_t bufsize)
|
||||||
{
|
{
|
||||||
unsigned short tmplen;
|
unsigned short tmplen;
|
||||||
|
|
||||||
|
@ -669,12 +667,14 @@ tr1001_poll(void)
|
||||||
|
|
||||||
tmplen = tr1001_rxlen;
|
tmplen = tr1001_rxlen;
|
||||||
|
|
||||||
if(tmplen > UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN)) {
|
/* if(tmplen > UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN)) {
|
||||||
tmplen = UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN);
|
tmplen = UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN);
|
||||||
|
}*/
|
||||||
|
if(tmplen > bufsize - TR1001_HDRLEN) {
|
||||||
|
tmplen = bufsize - TR1001_HDRLEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&uip_buf[UIP_LLH_LEN], &tr1001_rxbuf[TR1001_HDRLEN],
|
memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen);
|
||||||
tmplen);
|
|
||||||
|
|
||||||
/* header + content + CRC */
|
/* header + content + CRC */
|
||||||
sstrength = (tmp_sstrength / (TR1001_HDRLEN + tr1001_rxlen + 2)) << 1;
|
sstrength = (tmp_sstrength / (TR1001_HDRLEN + tr1001_rxlen + 2)) << 1;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tr1001.c,v 1.3 2006/10/06 07:57:14 adamdunkels Exp $
|
* @(#)$Id: tr1001.c,v 1.4 2006/10/09 11:56:13 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* \addtogroup esb
|
* \addtogroup esb
|
||||||
|
@ -632,12 +632,14 @@ tr1001_poll(void)
|
||||||
|
|
||||||
tmplen = tr1001_rxlen;
|
tmplen = tr1001_rxlen;
|
||||||
|
|
||||||
if(tmplen > UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN)) {
|
/* if(tmplen > UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN)) {
|
||||||
tmplen = UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN);
|
tmplen = UIP_BUFSIZE - (UIP_LLH_LEN - TR1001_HDRLEN);
|
||||||
|
}*/
|
||||||
|
if(tmplen > bufsize - TR1001_HDRLEN) {
|
||||||
|
tmplen = bufsize - TR1001_HDRLEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&uip_buf[UIP_LLH_LEN], &tr1001_rxbuf[TR1001_HDRLEN],
|
memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen);
|
||||||
tmplen);
|
|
||||||
|
|
||||||
/* header + content + CRC */
|
/* header + content + CRC */
|
||||||
sstrength = (tmp_sstrength / (TR1001_HDRLEN + tr1001_rxlen + 2)) << 1;
|
sstrength = (tmp_sstrength / (TR1001_HDRLEN + tr1001_rxlen + 2)) << 1;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tr1001.h,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
|
* @(#)$Id: tr1001.h,v 1.2 2006/10/09 11:56:13 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef __TR1001_H__
|
#ifndef __TR1001_H__
|
||||||
#define __TR1001_H__
|
#define __TR1001_H__
|
||||||
|
@ -121,7 +121,7 @@ u8_t tr1001_send(u8_t *packet, u16_t len);
|
||||||
* \return The length of the received packet, or 0 if no packet has
|
* \return The length of the received packet, or 0 if no packet has
|
||||||
* been received.
|
* been received.
|
||||||
*/
|
*/
|
||||||
unsigned short tr1001_poll(void);
|
unsigned short tr1001_poll(u8_t *buf, u16_t bufsize);
|
||||||
|
|
||||||
extern unsigned char tr1001_rxbuf[];
|
extern unsigned char tr1001_rxbuf[];
|
||||||
extern volatile unsigned char tr1001_rxstate;
|
extern volatile unsigned char tr1001_rxstate;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* @(#)$Id: tr1001-drv.c,v 1.1 2006/06/18 08:19:10 adamdunkels Exp $
|
* @(#)$Id: tr1001-drv.c,v 1.2 2006/10/09 11:56:13 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-esb.h"
|
#include "contiki-esb.h"
|
||||||
|
@ -52,10 +52,10 @@ PROCESS_THREAD(tr1001_drv_process, ev, data)
|
||||||
|
|
||||||
PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_POLL);
|
PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_POLL);
|
||||||
|
|
||||||
uip_len = tr1001_poll();
|
uip_len = tr1001_poll(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN);
|
||||||
|
|
||||||
if(uip_len > 0) {
|
if(uip_len > 0) {
|
||||||
uip_len = hc_inflate();
|
uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,8 @@ tr1001_drv_request_poll(void)
|
||||||
u8_t
|
u8_t
|
||||||
tr1001_drv_send(void)
|
tr1001_drv_send(void)
|
||||||
{
|
{
|
||||||
int len;
|
uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
|
return tr1001_send(&uip_buf[UIP_LLH_LEN], uip_len);
|
||||||
len = hc_compress();
|
|
||||||
return tr1001_send(&uip_buf[UIP_LLH_LEN], len);
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue