updated picoTCP to 1.4.0, lowered build optimization levels to -O2, improved selftest

This commit is contained in:
Joseph Henry
2017-06-05 14:26:06 -07:00
parent 47a80e8954
commit 19839eeac9
367 changed files with 107850 additions and 3813 deletions

View File

@@ -0,0 +1,61 @@
/*********************************************************************
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
/*** MACHINE CONFIGURATION ***/
/* Temporary (POSIX) stuff. */
#include <string.h>
#include <unistd.h>
/* Temporary debugging stuff. */
#include <stdarg.h>
#include "halUart.h"
#include <stdio.h>
static void print_uart(char *str)
{
int i, len;
len = (int)strlen(str);
for (i = 0; i < len; i++) {
HAL_UartWriteByte(str[i]);
if (HAL_UartTxFull())
HAL_UartFlush();
}
}
static inline void sam_dbg(const char *format, ...)
{
char msg[128] = { 0 };
va_list args;
va_start(args, format);
vsnprintf(msg, 256, format, args);
va_end(args);
print_uart(msg);
}
//#define dbg sam_dbg
#define dbg(...) do { } while(0)
extern volatile uint32_t sam_tick;
#define pico_zalloc(x) calloc(x, 1)
#define pico_free(x) free(x)
static inline unsigned long PICO_TIME(void)
{
register uint32_t tick = sam_tick;
return tick / 1000;
}
static inline unsigned long PICO_TIME_MS(void)
{
return sam_tick;
}
static inline void PICO_IDLE(void)
{
unsigned long tick_now = sam_tick;
while(tick_now == sam_tick) ;
}