/usr/include/xenomai/asm-arm/bits/bind.h is in libxenomai-dev 2.6.4+dfsg-0.2.
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /*
* Copyright (C) 2010-2013 Gilles Chanteperdrix <gch@xenomai.org>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef _XENO_ASM_ARM_BIND_H
#define _XENO_ASM_ARM_BIND_H
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <asm-generic/xenomai/bind.h>
#include <asm/xenomai/syscall.h>
struct __xn_full_tscinfo __xn_tscinfo = {
.kinfo = {
.type = -1,
},
};
static inline void xeno_arm_features_check(struct xnfeatinfo *finfo)
{
#ifdef CONFIG_XENO_ARM_TSC_TYPE
unsigned long phys_addr;
unsigned page_size;
int err, fd;
void *addr;
if (__xn_tscinfo.kinfo.type != -1)
return;
err = XENOMAI_SYSCALL2(__xn_sys_arch,
XENOMAI_SYSARCH_TSCINFO, &__xn_tscinfo);
if (err)
goto error;
fd = open("/dev/mem", O_RDONLY | O_SYNC);
if (fd == -1) {
perror("Xenomai init: open(/dev/mem)");
exit(EXIT_FAILURE);
}
page_size = sysconf(_SC_PAGESIZE);
switch(__xn_tscinfo.kinfo.type) {
#if CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_KUSER
default:
__xn_tscinfo.kuser_tsc_get =
(__xn_rdtsc_t *)(0xffff1004 -
((*(unsigned *)(0xffff0ffc) + 3) << 5));
goto domap;
#elif CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_FREERUNNING \
|| CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_FREERUNNING_COUNTDOWN \
|| CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_FREERUNNING_FAST_WRAP
case __XN_TSC_TYPE_FREERUNNING:
case __XN_TSC_TYPE_FREERUNNING_COUNTDOWN:
#if CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_FREERUNNING_FAST_WRAP
if (__xn_tscinfo.kinfo.mask >= ((1 << 28) - 1)) {
fprintf(stderr, "Hardware tsc is not a fast wrapping"
" one, select the correct platform, or fix\n"
"configure.in\n");
exit(EXIT_FAILURE);
}
#endif /* __XN_TSC_TYPE_FREERUNNING_FAST_WRAP */
goto domap;
default:
fprintf(stderr,
"Xenomai: kernel/user tsc emulation mismatch.\n");
exit(EXIT_FAILURE);
break;
#elif CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_DECREMENTER
case __XN_TSC_TYPE_DECREMENTER:
goto domap;
default:
fprintf(stderr,
"Xenomai: kernel/user tsc emulation mismatch.\n");
exit(EXIT_FAILURE);
break;
#endif /* CONFIG_XENO_ARM_TSC_TYPE == __XN_TSC_TYPE_DECREMENTER */
case __XN_TSC_TYPE_NONE:
error:
fprintf(stderr, "Xenomai: Your board/configuration does not"
" allow tsc emulation in user-space: %d\n", err);
exit(EXIT_FAILURE);
}
domap:
phys_addr = (unsigned long) __xn_tscinfo.kinfo.counter;
addr = mmap(NULL, page_size, PROT_READ, MAP_SHARED,
fd, phys_addr & ~(page_size - 1));
if (addr == MAP_FAILED) {
perror("Xenomai init: mmap(/dev/mem)");
exit(EXIT_FAILURE);
}
__xn_tscinfo.kinfo.counter =
((volatile unsigned *)
((char *) addr + (phys_addr & (page_size - 1))));
if (close(fd)) {
perror("Xenomai init: close(/dev/mem)");
exit(EXIT_FAILURE);
}
#endif /* CONFIG_XENO_ARM_TSC_TYPE */
}
#define xeno_arch_features_check(finfo) xeno_arm_features_check(finfo)
#endif /* _XENO_ASM_ARM_BIND_H */
|