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.5 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 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, ...)
2013-05-15 17:45:43 +02:00
#define _XOPEN_SOURCE
#elif defined(__linux__)
#define __USE_GNU
2013-05-15 17:45:43 +02:00
#endif
2013-03-06 01:08:15 +01:00
#include <ucontext.h>
#ifdef BSD
2013-05-15 17:45:43 +02:00
#undef _XOPEN_SOURCE
#elif defined(__linux__)
#undef __USE_GNU
2013-05-15 17:45:43 +02:00
#endif
2013-03-06 01:08:15 +01:00
#include "kernel_intern.h"
#include "sched.h"
#include "debug.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
*/
2013-03-06 01:08:15 +01:00
int register_interrupt(int sig, void *handler);
/**
* 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);
extern void _native_sig_leave_tramp(void);
extern ucontext_t *_native_cur_ctx, *_native_isr_ctx;
extern unsigned int _native_saved_eip;
extern int _native_in_isr;
extern int _native_in_syscall;
extern int _native_sigpend;
/** @} */
2013-03-06 01:08:15 +01:00
#endif //_CPU_H