1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

make native includes RIOT posix compatible

This commit is contained in:
Ludwig Ortmann 2013-12-22 23:26:54 +01:00
parent de3b85ffc3
commit cf87e647c0
5 changed files with 45 additions and 40 deletions

View File

@ -11,6 +11,8 @@ DEP = $(SRC:%.c=$(BINDIR)%.d)
INCLUDES += -I$(RIOTBOARD)/native/include/
EXCLUDES := -I$(RIOTBASE)/sys/posix/%
$(BINDIR)native_drivers.a: $(OBJ)
@$(AR) rcs $(BINDIR)${ARCH} $(OBJ)
@ -19,7 +21,7 @@ $(BINDIR)native_drivers.a: $(OBJ)
# compile and generate dependency info
$(BINDIR)%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
$(CC) $(CFLAGS) $(filter-out $(EXCLUDES),$(INCLUDES)) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o $(BINDIR)$*.o
@$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > $(BINDIR)$*.d
@printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d

View File

@ -15,7 +15,6 @@
*/
#ifndef CPUCONF_H_
#define CPUCONF_H_
#include <signal.h>
/* TODO: tighten stack sizes */
#ifdef __MACH__ /* OSX */

View File

@ -22,50 +22,14 @@
#ifndef _CPU_H
#define _CPU_H
#include <sys/param.h>
/* enable signal handler register access on different platforms
* check here for more:
* http://sourceforge.net/p/predef/wiki/OperatingSystems/
*/
#ifdef BSD // BSD = (FreeBSD, Darwin, ...)
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#include <ucontext.h>
#undef _XOPEN_SOURCE
#else
#include <ucontext.h>
#endif
#elif defined(__linux__)
#ifndef _GNU_SOURCE
#define GNU_SOURCE
#include <ucontext.h>
#undef GNU_SOURCE
#else
#include <ucontext.h>
#endif
#endif // BSD/Linux
#include "kernel_internal.h"
#include "sched.h"
#include "cpu-conf.h"
/* TODO: choose better value? */
#define F_CPU 1000000
/* TODO: remove once these have been removed from RIOT: */
void dINT(void);
void eINT(void);
/**
* register interrupt handler handler for interrupt sig
*/
int register_interrupt(int sig, void (*handler)(void));
/**
* unregister interrupt handler for interrupt sig
*/
int unregister_interrupt(int sig);
/** @} */
#endif //_CPU_H

View File

@ -12,7 +12,7 @@
#ifndef _NATIVE_INTERNAL_H
#define _NATIVE_INTERNAL_H
//#include <signal.h>
#include <signal.h>
/**
* internal functions
@ -56,5 +56,44 @@ extern const char *_progname;
extern fd_set _native_rfds;
#endif
/**
* register interrupt handler handler for interrupt sig
*/
int register_interrupt(int sig, void (*handler)(void));
/**
* unregister interrupt handler for interrupt sig
*/
int unregister_interrupt(int sig);
//#include <sys/param.h>
/* enable signal handler register access on different platforms
* check here for more:
* http://sourceforge.net/p/predef/wiki/OperatingSystems/
*/
#ifdef BSD // BSD = (FreeBSD, Darwin, ...)
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE
#include <ucontext.h>
#undef _XOPEN_SOURCE
#else
#include <ucontext.h>
#endif
#elif defined(__linux__)
#ifndef _GNU_SOURCE
#define GNU_SOURCE
#include <ucontext.h>
#undef GNU_SOURCE
#else
#include <ucontext.h>
#endif
#endif // BSD/Linux
#include "kernel_internal.h"
#include "sched.h"
/** @} */
#endif /* _NATIVE_INTERNAL_H */

View File

@ -27,6 +27,7 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
#include "transceiver.h"
#include "msg.h"
#include "tap.h"
#include "nativenet.h"