2013-03-06 10:29:49 +01:00
|
|
|
/**
|
|
|
|
* Native CPU interface
|
|
|
|
*
|
2013-03-13 21:56:56 +01:00
|
|
|
* 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-13 21:56:56 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-03-06 10:29:49 +01:00
|
|
|
* @ingroup arch
|
2013-03-13 21:56:56 +01:00
|
|
|
* @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 <ucontext.h>
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
2013-03-13 21:56:56 +01:00
|
|
|
/**
|
|
|
|
* register interrupt handler handler for interrupt sig
|
|
|
|
*/
|
2013-03-06 01:08:15 +01:00
|
|
|
int register_interrupt(int sig, void *handler);
|
2013-03-13 21:56:56 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* unregister interrupt handler for interrupt sig
|
|
|
|
*/
|
2013-03-06 01:08:15 +01:00
|
|
|
int unregister_interrupt(int sig);
|
2013-03-13 21:56:56 +01:00
|
|
|
|
|
|
|
/* this should be defined elsewhere */
|
2013-03-06 01:08:15 +01:00
|
|
|
void thread_yield(void);
|
|
|
|
|
2013-04-15 20:08:46 +02:00
|
|
|
extern volatile ucontext_t *interrupted_contexts[MAXTHREADS];
|
2013-03-13 21:56:56 +01:00
|
|
|
/** @} */
|
2013-03-06 01:08:15 +01:00
|
|
|
#endif //_CPU_H
|