Skip to content

Commit

Permalink
fix cc1100/tap buffer constants
Browse files Browse the repository at this point in the history
  • Loading branch information
LudwigKnuepfer committed Jul 27, 2013
1 parent d46f36f commit 047c503
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cpu/native/cc110x_ng/cc1100-sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void do_write_patable(uint8_t c)
void do_write_tx(uint8_t c)
{
DEBUG("write TX\n");
if (status_registers[CC1100_TXBYTES - 0x30] == BUFFER_LENGTH) {
if (status_registers[CC1100_TXBYTES - 0x30] == CC1100_FIFO_LENGTH) {
errx(EXIT_FAILURE, "do_write_tx: buffer too small");
}
tx_fifo[tx_fifo_idx++] = c;
Expand Down
2 changes: 0 additions & 2 deletions cpu/native/cc110x_ng/cc110x_ng_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@


static int _native_cc110x_enabled;
//static char rx_buffer[BUFFER_LENGTH], tx_buffer[BUFFER_LENGTH];
//static int rx_bi, rx_bc, tx_bi, tx_bc;

/* arch */

Expand Down
2 changes: 2 additions & 0 deletions cpu/native/include/cc1100sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ uint8_t read_single(uint8_t c);
#define STATE_WRITE_S 0x05

void _native_cc1100_handle_packet(char *buf, int size);

#define CC1100_FIFO_LENGTH 64
2 changes: 0 additions & 2 deletions cpu/native/include/tap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <net/ethernet.h>

#define BUFFER_LENGTH 255

/**
* create and/or open tap device "name"
*
Expand Down
8 changes: 5 additions & 3 deletions cpu/native/tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@
#include "cc1100sim.h"
#include "cc110x-internal.h" /* CC1100 constants */

#define TAP_BUFFER_LENGTH (CC1100_FIFO_LENGTH + ETHER_HDR_LEN + 1)

int _native_tap_fd;
char _native_tap_mac[ETHER_ADDR_LEN];

void _native_handle_cc110xng_input(void)
{
int nread;
char buf[BUFFER_LENGTH];
char buf[TAP_BUFFER_LENGTH];
union eth_frame *f;

DEBUG("_native_handle_cc110xng_input\n");
Expand All @@ -43,7 +45,7 @@ void _native_handle_cc110xng_input(void)
TODO: refactor this into general io-signal multiplexer */

_native_in_syscall = 1;
nread = read(_native_tap_fd, buf, BUFFER_LENGTH);
nread = read(_native_tap_fd, buf, TAP_BUFFER_LENGTH);
_native_in_syscall = 0;
DEBUG("_native_handle_cc110xng_input - read %d bytes\n", nread);
if (nread > 0) {
Expand Down Expand Up @@ -72,7 +74,7 @@ void _native_handle_cc110xng_input(void)

int send_buf(void)
{
uint8_t buf[BUFFER_LENGTH];
uint8_t buf[TAP_BUFFER_LENGTH];
int nsent;
uint8_t to_send;

Expand Down

0 comments on commit 047c503

Please sign in to comment.