1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native/include/cpu.h

73 lines
1.4 KiB
C
Raw Normal View History

2013-03-06 10:29:49 +01:00
/**
* Native CPU interface
*
* The native CPU uses system calls to simulate hardware access.
*
2013-03-06 10:29:49 +01:00
* Copyright (C) 2013 Ludwig Ortmann
*
* This file subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*/
/**
2013-03-06 10:29:49 +01:00
* @ingroup arch
* @defgroup native_cpu Native CPU
2013-03-06 10:29:49 +01:00
* @{
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
*/
2013-03-06 01:08:15 +01:00
#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
2013-05-15 17:45:43 +02:00
#define _XOPEN_SOURCE
2013-03-06 01:08:15 +01:00
#include <ucontext.h>
2013-05-15 17:45:43 +02:00
#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>
2013-05-15 17:45:43 +02:00
#endif
#endif // BSD/Linux
2013-03-06 01:08:15 +01:00
#include "kernel_internal.h"
2013-03-06 01:08:15 +01:00
#include "sched.h"
#include "cpu-conf.h"
/* TODO: choose better value? */
#define F_CPU 1000000
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
*/
2013-03-06 01:08:15 +01:00
int unregister_interrupt(int sig);
/* this should be defined elsewhere */
2013-03-06 01:08:15 +01:00
void thread_yield(void);
/** @} */
2013-03-06 01:08:15 +01:00
#endif //_CPU_H