Commit de40542e authored by Alessandro Rubini's avatar Alessandro Rubini

Preliminary changes to introduce host build (no effect)

These changes have no effect at this point, but are the initial steps
introducing host builds. Some changes are minor cleanups, some depend
on CONFIG_HOST_PROCESS which is not defined at this point.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 529b4a4a
# Tomasz Wlostowski for CERN, 2011,2012
-include $(CURDIR)/.config
CROSS_COMPILE ?= lm32-elf-
ifdef CONFIG_HOST_PROCESS
CROSS_COMPILE =
endif
export CROSS_COMPILE
CC = $(CROSS_COMPILE)gcc
......@@ -9,7 +15,6 @@ OBJDUMP = $(CROSS_COMPILE)objdump
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
-include $(CURDIR)/.config
AUTOCONF = $(CURDIR)/include/generated/autoconf.h
......
......@@ -96,7 +96,8 @@ static uint64_t pps_get_utc(void)
return out;
}
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds)
void __attribute__((weak)) shw_pps_gen_get_time(uint64_t * seconds,
uint32_t * nanoseconds)
{
uint32_t ns_cnt;
uint64_t sec1, sec2;
......
......@@ -15,6 +15,7 @@
#include "types.h"
#include "i2c.h"
#include "onewire.h"
#include "endpoint.h"
#include <sdb.h>
#define SDBFS_BIG_ENDIAN
......@@ -297,6 +298,12 @@ int get_persistent_mac(uint8_t portnum, uint8_t * mac)
int i, class;
uint64_t rom;
if (IS_HOST_PROCESS) {
/* we don't have sdb working, so get the real eth address */
get_mac_addr(mac);
return 0;
}
if (sdbfs_open_id(&wrc_sdb, SDB_VENDOR, SDB_DEV_MAC) < 0)
return -1;
......
......@@ -6,12 +6,17 @@
#ifndef __IRQ_H
#define __IRQ_H
#ifdef unix
static inline void clear_irq(void) {}
#else
static inline void clear_irq(void)
{
unsigned int val = 1;
asm volatile ("wcsr ip, %0"::"r" (val));
}
#endif
void disable_irq(void);
void enable_irq(void);
void _irq_entry(void);
......
......@@ -8,8 +8,14 @@
#include <stdlib.h>
#include <stdint.h>
#ifndef __IEEE_BIG_ENDIAN
#error "Not big endian, or unknown endianness"
#endif
#ifdef CONFIG_HOST_PROCESS
# include <arpa/inet.h>
#else
# ifndef __IEEE_BIG_ENDIAN
# error "Not big endian, or unknown endianness"
# endif
static inline uint16_t ntohs(uint16_t x) {return x;}
static inline uint16_t ntohs(uint16_t x) {return x;}
#endif
......@@ -34,7 +34,9 @@ static inline void timer_delay_ms(int ms)
/* usleep.c */
extern void usleep_init(void);
#ifndef unix
extern int usleep(useconds_t usec);
#endif
#ifdef CONFIG_WR_NODE
......
......@@ -38,4 +38,10 @@
({if (NET_IS_VERBOSE) __debug_printf(__VA_ARGS__);})
#ifdef CONFIG_HOST_PROCESS
#define IS_HOST_PROCESS 1
#else
#define IS_HOST_PROCESS 0
#endif
#endif /* __FREESTANDING_TRACE_H__ */
......@@ -9,6 +9,9 @@
#include <inttypes.h>
#include "ptpd_netif.h" /* for sockaddr in prototype */
#undef IP_TOS /* These two are defined by arpa/inet.h, and will conflict */
#undef IP_TTL /* when we build for the host */
#define IP_VERSION 0
#define IP_TOS (IP_VERSION+1)
#define IP_LEN (IP_TOS+1)
......
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