Index: firmware/FSC/src/w5100_spi_interface.c
===================================================================
--- firmware/FSC/src/w5100_spi_interface.c	(revision 17630)
+++ firmware/FSC/src/w5100_spi_interface.c	(revision 17631)
@@ -3,5 +3,5 @@
 #include "w5100_spi_interface.h"       
 #include "spi_master.h"    
-#include "usart.h"
+//#include "usart.h"
 volatile BOOL sock0_connection_established = false;
 volatile U08 eth_read_buffer[ETH_READ_BUFFER_SIZE];
@@ -173,11 +173,11 @@
 // getters of TX and RX registers
 // 		S0_TX_FSR
-U16 get_S0_TX_FSR()
-{
-U16 freesize;
-freesize=w5100_read(S0_TX_FSR0);		// datasheet: user should read upper byte first, and lower byte later
-freesize = freesize << 8;				// 				to get correct value
-freesize += w5100_read(S0_TX_FSR1);
-return freesize;
+// Contains Socket free size in bytes
+U16 get_S0_TX_FSR() {
+    U16 freesize;
+    freesize=w5100_read(S0_TX_FSR0);		// datasheet: user should read upper byte first, and lower byte later
+    freesize = freesize << 8;				// 				to get correct value
+    freesize += w5100_read(S0_TX_FSR1);
+    return freesize;
 }
 
@@ -280,13 +280,13 @@
 	U16 start_address =  S0_RX_BASE + offset;
 
-	usart_write_str((pU08)"lrp:");
-	usart_write_U16_hex(last_RX_read_pointer);
-	usart_write_crlf();
-	usart_write_str((pU08)"off:");
-	usart_write_U16_hex(offset);
-	usart_write_crlf();
-	usart_write_str((pU08)"sad:");
-	usart_write_U16_hex(start_address);
-	usart_write_crlf();
+	//usart_write_str((pU08)"lrp:");
+	//usart_write_U16_hex(last_RX_read_pointer);
+	//usart_write_crlf();
+	//usart_write_str((pU08)"off:");
+	//usart_write_U16_hex(offset);
+	//usart_write_crlf();
+	//usart_write_str((pU08)"sad:");
+	//usart_write_U16_hex(start_address);
+	//usart_write_crlf();
 	
 	
@@ -314,7 +314,7 @@
 	// inform W5100 about how much data was read out.
 	U16 new_read_pointer =  last_RX_read_pointer + NumBytes;
-	usart_write_str((pU08)"nrp:");
-	usart_write_U16_hex(new_read_pointer);
-	usart_write_crlf();
+	//usart_write_str((pU08)"nrp:");
+	//usart_write_U16_hex(new_read_pointer);
+	//usart_write_crlf();
 	
 	set_S0_RX_RD(new_read_pointer);
@@ -343,147 +343,67 @@
 }
 
-// returns number of words, transmitted into TX - buffer.
+// returns number of bytes, transmitted into TX - buffer.
 U16 w5100_set_TX(U08* string, U16 NumBytes) {
 
-	U08 repetitions;
-	U16 freesize;
-	U16 last_TX_write_pointer;
-	
-	//usart_write_str((pU08)"S0_IR:");
-	//usart_write_U08_hex( w5100_read(S0_IR) );
-	//usart_write_crlf();
-	
-	freesize = get_S0_TX_FSR();
-	for (repetitions=0 ; repetitions < 3;  ) // increase is *inside the loop* 
-	{
-		if ( freesize != get_S0_TX_FSR()) {
-			 freesize = get_S0_TX_FSR();
-		} else {
-			repetitions++;
-		}
-	}
-	
-	if (freesize == 0)
-	{
-		return 0;
-	}
-	
-	last_TX_write_pointer = get_S0_TX_WR();
-	for (repetitions=0 ; repetitions < 3;  ) // increase is *inside the loop* 
-	{
-		if ( last_TX_write_pointer != get_S0_TX_WR()) {
-			 last_TX_write_pointer = get_S0_TX_WR();
-		} else {
-			repetitions++;
-		}
-	}
-	
-	U16 offset = last_TX_write_pointer & S0_TX_MASK;
-	U16 start_address =  S0_TX_BASE + offset;
-
-	if (last_samurai != last_TX_write_pointer)
-			usart_write_str((pU08)"Hilfeeeeeeeeeeeeeee\n");
-	
-	//usart_write_crlf();
-	//usart_write_char('|');usart_write_U16_hex( last_TX_write_pointer );
-	//usart_write_char('|');usart_write_U16_hex( offset );
-	//usart_write_char('|');usart_write_U16_hex( start_address );
-	
-	
-	//usart_write_crlf();
-	//usart_write_crlf();
-	//usart_write_str((pU08)"lwp :");
-	//usart_write_U16_hex(last_TX_write_pointer);
-	//usart_write_crlf();
-	//
-	//usart_write_str((pU08)"off :");
-	//usart_write_U16_hex(offset);
-	//usart_write_crlf();
-	//
-	//usart_write_str((pU08)"stad:");
-	//usart_write_U16_hex(start_address);
-	//usart_write_crlf();
-	
-
-	U16 upper_size, lower_size;
-	/*
-	if (NumBytes > ETH_WRITE_BUFFER_SIZE)
-	{
-		NumBytes = ETH_WRITE_BUFFER_SIZE;
-	}
-	if (freesize == 0)
-	{
-		return 0;
-	}
-	else */
-	if ( freesize < NumBytes )
-	{
-		NumBytes = freesize;
-	}
-	//usart_write_char('|');usart_write_U16_hex( NumBytes );
-	
-	// now calculate the offset address
-	// calculated according to W5100 datasheet page: 44
-	if ((offset + NumBytes) > (S0_RX_MASK + 1) )  // if data is turned over in RX-mem
-	{
-		upper_size = (S0_RX_MASK + 1) - offset;
-		lower_size = NumBytes - upper_size;
-		for (U16 i = 0; i < upper_size; ++i)
-		{
-			w5100_write(start_address + i, string[i]);
-			//usart_write_str((pU08)"wr:");
-			//usart_write_U16_hex(start_address + i);
-			//usart_write_char(' ');
-			//usart_write_char(string[i]);
-			//usart_write_crlf();
-
-		}
-		for (U16 i = 0; i < lower_size; ++i)
-		{
-			w5100_write(S0_RX_BASE + i, string[upper_size+i]);
-			//usart_write_str((pU08)"wr:");
-			//usart_write_U16_hex(S0_RX_BASE + i);
-			//usart_write_char(' ');
-			//usart_write_char(string[upper_size+i]);
-			//usart_write_crlf();
-
-		}
-	}
-	else // if not data turn over in RX-mem
-	{
-		for (U16 i = 0; i < NumBytes; ++i)
-		{
-			w5100_write(start_address + i, string[i]);
-			//usart_write_str((pU08)"wr:");
-			//usart_write_U16_hex(start_address + i);
-			//usart_write_char(' ');
-			//usart_write_char(string[i]);
-			//usart_write_crlf();
-
-		}
-	}
-
-	// inform W5100 about how much data was written.
-	U16 new_write_pointer = last_TX_write_pointer + NumBytes;
-	last_samurai = new_write_pointer;
-	
-	
-	set_S0_TX_WR(new_write_pointer);
-	//usart_write_char('|');usart_write_U16_hex( new_write_pointer );
-	
-	//usart_write_char('|');
-	//usart_write_crlf();
-	
-		
-		//usart_write_str((pU08)"wrpt:");
-		//usart_write_U16_hex(last_TX_write_pointer + NumBytes);
-		//usart_write_crlf();
-
-	// tell it to send now the data away
-	w5100_write( S0_CR, CR_SEND);
-	
-	
-	
-	return NumBytes;
+    U08 repetitions;
+    U16 freesize;
+    U16 last_TX_write_pointer;
+
+    freesize = get_S0_TX_FSR();
+    for (repetitions=0 ; repetitions < 3;  ) { // increase is *inside the loop* 
+        if ( freesize != get_S0_TX_FSR()) {
+            freesize = get_S0_TX_FSR();
+        } 
+        else {
+            repetitions++;
+        }
+    }
+    if (freesize == 0) {
+        return 0;
+    }
+    
+    last_TX_write_pointer = get_S0_TX_WR();
+    for (repetitions=0 ; repetitions < 3;  ) { // increase is *inside the loop* 
+        if ( last_TX_write_pointer != get_S0_TX_WR()) {
+            last_TX_write_pointer = get_S0_TX_WR();
+        } 
+        else {
+            repetitions++;
+        }
+    }
+
+    U16 offset = last_TX_write_pointer & S0_TX_MASK;
+    U16 start_address =  S0_TX_BASE + offset;
+    U16 upper_size; 
+    U16 lower_size;
+    if ( freesize < NumBytes ) {
+        NumBytes = freesize;
+    }
+
+    // now calculate the offset address
+    // calculated according to W5100 datasheet page: 44
+    if ((offset + NumBytes) > (S0_RX_MASK + 1) ) { // if data is turned over in RX-mem
+        upper_size = (S0_RX_MASK + 1) - offset;
+        lower_size = NumBytes - upper_size;
+        for (U16 i = 0; i < upper_size; ++i) {
+            w5100_write(start_address + i, string[i]);
+        }
+        for (U16 i = 0; i < lower_size; ++i) {
+            w5100_write(S0_RX_BASE + i, string[upper_size+i]);
+        }
+    }
+    else { // if not data turn over in RX-mem
+        for (U16 i = 0; i < NumBytes; ++i) {
+            w5100_write(start_address + i, string[i]);
+        }
+    }
+
+    // inform W5100 about how much data was written.
+    U16 new_write_pointer = last_TX_write_pointer + NumBytes;
+    set_S0_TX_WR(new_write_pointer);
+
+    // tell it to send now the data away
+    w5100_write( S0_CR, CR_SEND);
+    return NumBytes;
 }
 
Index: firmware/FSC/src/w5100_spi_interface.h
===================================================================
--- firmware/FSC/src/w5100_spi_interface.h	(revision 17630)
+++ firmware/FSC/src/w5100_spi_interface.h	(revision 17631)
@@ -5,5 +5,5 @@
 #include "typedefs.h"
 #include "application.h"
-#include "num_conversion.h"
+//#include "num_conversion.h"
 
 extern volatile BOOL sock0_connection_established;
