/usr/include/xenomai/asm-sh/bits/init.h is in libxenomai-dev 2.6.2.1-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /*
* Copyright (C) 2011 Philippe Gerum <rpm@xenomai.org>.
*
* Xenomai is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Xenomai is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Xenomai; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _XENO_ASM_SH_BITS_INIT_H
#define _XENO_ASM_SH_BITS_INIT_H
#ifndef __KERNEL__
#error "Pure kernel header included from user-space!"
#endif
#include <linux/init.h>
#include <asm/xenomai/calibration.h>
#include <asm-generic/xenomai/bits/timeconv.h>
int xnarch_escalation_virq;
int xnpod_trap_fault(xnarch_fltinfo_t *fltinfo);
void xnpod_schedule_handler(void);
static rthal_trap_handler_t xnarch_old_trap_handler;
static int xnarch_trap_fault(unsigned event, rthal_pipeline_stage_t *stage,
void *data)
{
xnarch_fltinfo_t fltinfo;
fltinfo.exception = event;
fltinfo.regs = data;
return xnpod_trap_fault(&fltinfo);
}
unsigned long xnarch_calibrate_timer(void)
{
/*
* Compute the time needed to program the dedicated hrtimer.
* The return value is expressed in hrclock counter unit.
*/
return xnarch_ns_to_tsc(rthal_timer_calibrate());
}
int xnarch_calibrate_sched(void)
{
nktimerlat = xnarch_calibrate_timer();
if (nktimerlat == 0)
return -ENODEV;
nklatency = xnarch_ns_to_tsc(xnarch_get_sched_latency()) + nktimerlat;
return 0;
}
static inline int xnarch_init(void)
{
int ret;
ret = rthal_init();
if (ret)
return ret;
xnarch_init_timeconv(RTHAL_CLOCK_FREQ);
ret = xnarch_calibrate_sched();
if (ret)
return ret;
xnarch_escalation_virq = rthal_alloc_virq();
if (xnarch_escalation_virq == 0)
return -ENOSYS;
rthal_virtualize_irq(&rthal_domain,
xnarch_escalation_virq,
(rthal_irq_handler_t) &xnpod_schedule_handler,
NULL, NULL, IPIPE_HANDLE_MASK | IPIPE_WIRED_MASK);
xnarch_old_trap_handler = rthal_trap_catch(&xnarch_trap_fault);
return 0;
}
static inline void xnarch_exit(void)
{
rthal_trap_catch(xnarch_old_trap_handler);
rthal_virtualize_irq(&rthal_domain,
xnarch_escalation_virq, NULL, NULL, NULL, 0);
rthal_free_virq(xnarch_escalation_virq);
rthal_exit();
}
#endif /* !_XENO_ASM_SH_BITS_INIT_H */
|