text
stringlengths
4
6.14k
/*********************************************************************** Copyright (c) 2006-2011, Skype Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Internet Society, IETF or IETF Trust, nor the names of specific contributors, may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "SigProc_FIX.h" #include "SigProc_FLP.h" #include "define.h" /* compute inverse of LPC prediction gain, and */ /* test if LPC coefficients are stable (all poles within unit circle) */ /* this code is based on silk_a2k_FLP() */ silk_float silk_LPC_inverse_pred_gain_FLP( /* O return inverse prediction gain, energy domain */ const silk_float *A, /* I prediction coefficients [order] */ opus_int32 order /* I prediction order */ ) { opus_int k, n; double invGain, rc, rc_mult1, rc_mult2, tmp1, tmp2; silk_float Atmp[ SILK_MAX_ORDER_LPC ]; silk_memcpy( Atmp, A, order * sizeof(silk_float) ); invGain = 1.0; for( k = order - 1; k > 0; k-- ) { rc = -Atmp[ k ]; rc_mult1 = 1.0f - rc * rc; invGain *= rc_mult1; if( invGain * MAX_PREDICTION_POWER_GAIN < 1.0f ) { return 0.0f; } rc_mult2 = 1.0f / rc_mult1; for( n = 0; n < (k + 1) >> 1; n++ ) { tmp1 = Atmp[ n ]; tmp2 = Atmp[ k - n - 1 ]; Atmp[ n ] = (silk_float)( ( tmp1 - tmp2 * rc ) * rc_mult2 ); Atmp[ k - n - 1 ] = (silk_float)( ( tmp2 - tmp1 * rc ) * rc_mult2 ); } } rc = -Atmp[ 0 ]; rc_mult1 = 1.0f - rc * rc; invGain *= rc_mult1; if( invGain * MAX_PREDICTION_POWER_GAIN < 1.0f ) { return 0.0f; } return (silk_float)invGain; }
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2018 Xilinx, Inc. */ #ifndef _DT_BINDINGS_ZYNQMP_RESETS_H #define _DT_BINDINGS_ZYNQMP_RESETS_H #define ZYNQMP_RESET_PCIE_CFG 0 #define ZYNQMP_RESET_PCIE_BRIDGE 1 #define ZYNQMP_RESET_PCIE_CTRL 2 #define ZYNQMP_RESET_DP 3 #define ZYNQMP_RESET_SWDT_CRF 4 #define ZYNQMP_RESET_AFI_FM5 5 #define ZYNQMP_RESET_AFI_FM4 6 #define ZYNQMP_RESET_AFI_FM3 7 #define ZYNQMP_RESET_AFI_FM2 8 #define ZYNQMP_RESET_AFI_FM1 9 #define ZYNQMP_RESET_AFI_FM0 10 #define ZYNQMP_RESET_GDMA 11 #define ZYNQMP_RESET_GPU_PP1 12 #define ZYNQMP_RESET_GPU_PP0 13 #define ZYNQMP_RESET_GPU 14 #define ZYNQMP_RESET_GT 15 #define ZYNQMP_RESET_SATA 16 #define ZYNQMP_RESET_ACPU3_PWRON 17 #define ZYNQMP_RESET_ACPU2_PWRON 18 #define ZYNQMP_RESET_ACPU1_PWRON 19 #define ZYNQMP_RESET_ACPU0_PWRON 20 #define ZYNQMP_RESET_APU_L2 21 #define ZYNQMP_RESET_ACPU3 22 #define ZYNQMP_RESET_ACPU2 23 #define ZYNQMP_RESET_ACPU1 24 #define ZYNQMP_RESET_ACPU0 25 #define ZYNQMP_RESET_DDR 26 #define ZYNQMP_RESET_APM_FPD 27 #define ZYNQMP_RESET_SOFT 28 #define ZYNQMP_RESET_GEM0 29 #define ZYNQMP_RESET_GEM1 30 #define ZYNQMP_RESET_GEM2 31 #define ZYNQMP_RESET_GEM3 32 #define ZYNQMP_RESET_QSPI 33 #define ZYNQMP_RESET_UART0 34 #define ZYNQMP_RESET_UART1 35 #define ZYNQMP_RESET_SPI0 36 #define ZYNQMP_RESET_SPI1 37 #define ZYNQMP_RESET_SDIO0 38 #define ZYNQMP_RESET_SDIO1 39 #define ZYNQMP_RESET_CAN0 40 #define ZYNQMP_RESET_CAN1 41 #define ZYNQMP_RESET_I2C0 42 #define ZYNQMP_RESET_I2C1 43 #define ZYNQMP_RESET_TTC0 44 #define ZYNQMP_RESET_TTC1 45 #define ZYNQMP_RESET_TTC2 46 #define ZYNQMP_RESET_TTC3 47 #define ZYNQMP_RESET_SWDT_CRL 48 #define ZYNQMP_RESET_NAND 49 #define ZYNQMP_RESET_ADMA 50 #define ZYNQMP_RESET_GPIO 51 #define ZYNQMP_RESET_IOU_CC 52 #define ZYNQMP_RESET_TIMESTAMP 53 #define ZYNQMP_RESET_RPU_R50 54 #define ZYNQMP_RESET_RPU_R51 55 #define ZYNQMP_RESET_RPU_AMBA 56 #define ZYNQMP_RESET_OCM 57 #define ZYNQMP_RESET_RPU_PGE 58 #define ZYNQMP_RESET_USB0_CORERESET 59 #define ZYNQMP_RESET_USB1_CORERESET 60 #define ZYNQMP_RESET_USB0_HIBERRESET 61 #define ZYNQMP_RESET_USB1_HIBERRESET 62 #define ZYNQMP_RESET_USB0_APB 63 #define ZYNQMP_RESET_USB1_APB 64 #define ZYNQMP_RESET_IPI 65 #define ZYNQMP_RESET_APM_LPD 66 #define ZYNQMP_RESET_RTC 67 #define ZYNQMP_RESET_SYSMON 68 #define ZYNQMP_RESET_AFI_FM6 69 #define ZYNQMP_RESET_LPD_SWDT 70 #define ZYNQMP_RESET_FPD 71 #define ZYNQMP_RESET_RPU_DBG1 72 #define ZYNQMP_RESET_RPU_DBG0 73 #define ZYNQMP_RESET_DBG_LPD 74 #define ZYNQMP_RESET_DBG_FPD 75 #define ZYNQMP_RESET_APLL 76 #define ZYNQMP_RESET_DPLL 77 #define ZYNQMP_RESET_VPLL 78 #define ZYNQMP_RESET_IOPLL 79 #define ZYNQMP_RESET_RPLL 80 #define ZYNQMP_RESET_GPO3_PL_0 81 #define ZYNQMP_RESET_GPO3_PL_1 82 #define ZYNQMP_RESET_GPO3_PL_2 83 #define ZYNQMP_RESET_GPO3_PL_3 84 #define ZYNQMP_RESET_GPO3_PL_4 85 #define ZYNQMP_RESET_GPO3_PL_5 86 #define ZYNQMP_RESET_GPO3_PL_6 87 #define ZYNQMP_RESET_GPO3_PL_7 88 #define ZYNQMP_RESET_GPO3_PL_8 89 #define ZYNQMP_RESET_GPO3_PL_9 90 #define ZYNQMP_RESET_GPO3_PL_10 91 #define ZYNQMP_RESET_GPO3_PL_11 92 #define ZYNQMP_RESET_GPO3_PL_12 93 #define ZYNQMP_RESET_GPO3_PL_13 94 #define ZYNQMP_RESET_GPO3_PL_14 95 #define ZYNQMP_RESET_GPO3_PL_15 96 #define ZYNQMP_RESET_GPO3_PL_16 97 #define ZYNQMP_RESET_GPO3_PL_17 98 #define ZYNQMP_RESET_GPO3_PL_18 99 #define ZYNQMP_RESET_GPO3_PL_19 100 #define ZYNQMP_RESET_GPO3_PL_20 101 #define ZYNQMP_RESET_GPO3_PL_21 102 #define ZYNQMP_RESET_GPO3_PL_22 103 #define ZYNQMP_RESET_GPO3_PL_23 104 #define ZYNQMP_RESET_GPO3_PL_24 105 #define ZYNQMP_RESET_GPO3_PL_25 106 #define ZYNQMP_RESET_GPO3_PL_26 107 #define ZYNQMP_RESET_GPO3_PL_27 108 #define ZYNQMP_RESET_GPO3_PL_28 109 #define ZYNQMP_RESET_GPO3_PL_29 110 #define ZYNQMP_RESET_GPO3_PL_30 111 #define ZYNQMP_RESET_GPO3_PL_31 112 #define ZYNQMP_RESET_RPU_LS 113 #define ZYNQMP_RESET_PS_ONLY 114 #define ZYNQMP_RESET_PL 115 #define ZYNQMP_RESET_PS_PL0 116 #define ZYNQMP_RESET_PS_PL1 117 #define ZYNQMP_RESET_PS_PL2 118 #define ZYNQMP_RESET_PS_PL3 119 #endif
/* { dg-do run } */ /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O2" } } */ /* { dg-options "-fsanitize=float-cast-overflow -fno-sanitize-recover=float-cast-overflow" } */ /* FIXME: When _DecimalXX <-> {signed, unsigned} __int128 conversions are supported, -DBROKEN_DECIMAL_INT128 can be removed. */ /* { dg-additional-options "-DUSE_DFP -DBROKEN_DECIMAL_INT128" { target dfp } } */ #define USE_FLT_DBL_LDBL #ifdef __SIZEOF_INT128__ #define USE_INT128 #endif #ifdef __SIZEOF_FLOAT80__ #define USE_FLOAT80 #endif #ifdef __SIZEOF_FLOAT128__ #define USE_FLOAT128 #endif #include "float-cast-overflow-7.h" #define TEST(type1, type2) \ if (cvt_##type1##_##type2 (-0.5f) != 0) abort (); \ if (cvt_##type1##_##type2 (0.5f) != 0) abort (); \ if (cvt_##type1##_##type2 (-0.75f) != 0) abort (); \ if (cvt_##type1##_##type2 (0.75f) != 0) abort (); \ if (type1##_MIN) \ { \ /* For RADIX 2 type1##_MIN should be always */ \ /* exactly representable in type2. */ \ if (type2##_RADIX == 2 \ || type1##_MAX <= type2##_MAX) \ { \ if (cvt_##type1##_##type2 (type1##_MIN) \ != type1##_MIN) abort (); \ volatile type2 tem = ((type2) -0.75f) + type1##_MIN; \ volatile type2 tem2 = ((type2) -1.0f) + type1##_MIN; \ if (tem != tem2 \ && cvt_##type1##_##type2 ((type2) -0.75f \ + type1##_MIN) \ != type1##_MIN) abort (); \ } \ else \ { \ type2 min = type1##_MIN; \ /* tem could be below minimum here due to */ \ /* rounding. */ \ MAXT add = 1; \ while (add) \ { \ volatile type2 tem = type1##_MIN + (type1) add; \ if (tem != min) \ break; \ MAXT newadd = add * type2##_RADIX; \ if (newadd < add || newadd > type1##_MAX) \ add = 0; \ else \ add = newadd; \ } \ if (add) \ { \ MAXT newadd \ = (-(type1##_MIN + (type1) add)) % add; \ volatile type2 tem = type1##_MIN + (type1) newadd;\ volatile type2 tem2 = type1##_MIN + (type1) add; \ if (tem == tem2) \ add = newadd; \ else \ { \ newadd += add; \ if (newadd < add || newadd > type1##_MAX) \ add = 0; \ else \ { \ tem = type1##_MIN + (type1) newadd; \ if (tem == tem2) \ add = newadd; \ else \ add = 0; \ } \ } \ } \ if (add \ && cvt_##type1##_##type2 (type1##_MIN \ + (type1) add) \ != type1##_MIN + (type1) add) abort (); \ } \ } \ if (type1##_MAX <= type2##_MAX) \ { \ if (cvt_##type1##_##type2 (type1##_MAX) != type1##_MAX) \ abort (); \ volatile type2 tem = ((type2) 0.75f) + type1##_MAX; \ volatile type2 tem2 = ((type2) 1.0f) + type1##_MAX; \ if (tem < tem2 \ && cvt_##type1##_##type2 ((type2) 0.75f + type1##_MAX)\ != type1##_MAX) abort (); \ } \ else \ { \ type2 max = type1##_MAX; \ /* tem could be above maximum here due to rounding. */ \ MAXT sub = 1; \ while (sub) \ { \ volatile type2 tem = type1##_MAX - sub; \ if (tem != max) \ break; \ MAXT newsub = sub * type2##_RADIX; \ if (newsub < sub || newsub > type1##_MAX) \ sub = 0; \ else \ sub = newsub; \ } \ if (sub) \ { \ MAXT newsub = ((type1##_MAX - sub) % sub); \ volatile type2 tem = type1##_MAX - newsub; \ volatile type2 tem2 = type1##_MAX - sub; \ if (tem == tem2) \ sub = newsub; \ else \ { \ newsub += sub; \ if (newsub < sub || newsub > type1##_MAX) \ sub = 0; \ else \ { \ tem = type1##_MAX - newsub; \ if (tem == tem2) \ sub = newsub; \ else \ sub = 0; \ } \ } \ } \ if (sub \ && cvt_##type1##_##type2 (type1##_MAX - sub) \ != type1##_MAX - sub) abort (); \ } #ifdef si128_MAX # define TESTS128(type2) TEST (si128, type2) TEST (ui128, type2) #else # define TESTS128(type2) #endif #define TESTS(type2) \ TEST (sc, type2) TEST (c, type2) TEST (uc, type2) \ TEST (ss, type2) TEST (us, type2) \ TEST (si, type2) TEST (ui, type2) \ TEST (sl, type2) TEST (ul, type2) \ TEST (sll, type2) TEST (ull, type2) \ TESTS128 (type2) int main () { #ifdef f_MAX TESTS (f) #endif #ifdef d_MAX TESTS (d) #endif #ifdef ld_MAX TESTS (ld) #endif #ifdef f80_MAX TESTS (f80) #endif #ifdef f128_MAX TESTS (f128) #endif #ifdef BROKEN_DECIMAL_INT128 # undef TESTS128 # define TESTS128(type2) # undef TWO # undef M1U # undef MAXS # undef MAXT # define TWO 2ULL # define M1U -1ULL # define MAXS (__CHAR_BIT__ * __SIZEOF_LONG_LONG__) # define MAXT unsigned long long #endif #ifdef d32_MAX TESTS (d32) #endif #ifdef d64_MAX TESTS (d64) #endif #ifdef d128_MAX TESTS (d128) #endif return 0; }
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ /* vi: set expandtab shiftwidth=4 tabstop=4: */ /** * \file * <PRE> * High performance base64 encoder / decoder * Version 1.3 -- 17-Mar-2006 * * Copyright &copy; 2005, 2006, Nick Galbreath -- nickg [at] modp [dot] com * All rights reserved. * * http://modp.com/release/base64 * * Released under bsd license. See modp_b64.c for details. * </pre> * * The default implementation is the standard b64 encoding with padding. * It's easy to change this to use "URL safe" characters and to remove * padding. See the modp_b64.c source code for details. * */ #ifndef MODP_B64 #define MODP_B64 #ifdef __cplusplus extern "C" { #endif /** * Encode a raw binary string into base 64. * src contains the bytes * len contains the number of bytes in the src * dest should be allocated by the caller to contain * at least modp_b64_encode_len(len) bytes (see below) * This will contain the null-terminated b64 encoded result * returns length of the destination string plus the ending null byte * i.e. the result will be equal to strlen(dest) + 1 * * Example * * \code * char* src = ...; * int srclen = ...; //the length of number of bytes in src * char* dest = (char*) malloc(modp_b64_encode_len); * int len = modp_b64_encode(dest, src, sourcelen); * if (len == -1) { * printf("Error\n"); * } else { * printf("b64 = %s\n", dest); * } * \endcode * */ int modp_b64_encode(char* dest, const char* str, int len); /** * Decode a base64 encoded string * * src should contain exactly len bytes of b64 characters. * if src contains -any- non-base characters (such as white * space, -1 is returned. * * dest should be allocated by the caller to contain at least * len * 3 / 4 bytes. * * Returns the length (strlen) of the output, or -1 if unable to * decode * * \code * char* src = ...; * int srclen = ...; // or if you don't know use strlen(src) * char* dest = (char*) malloc(modp_b64_decode_len(srclen)); * int len = modp_b64_decode(dest, src, sourcelen); * if (len == -1) { error } * \endcode */ int modp_b64_decode(char* dest, const char* src, int len); /** * Given a source string of length len, this returns the amount of * memory the destination string should have. * * remember, this is integer math * 3 bytes turn into 4 chars * ceiling[len / 3] * 4 + 1 * * +1 is for any extra null. */ #define modp_b64_encode_len(A) ((A+2)/3 * 4 + 1) /** * Given a base64 string of length len, * this returns the amount of memory required for output string * It maybe be more than the actual number of bytes written. * NOTE: remember this is integer math * this allocates a bit more memory than traditional versions of b64 * decode 4 chars turn into 3 bytes * floor[len * 3/4] + 2 */ #define modp_b64_decode_len(A) (A / 4 * 3 + 2) /** * Will return the strlen of the output from encoding. * This may be less than the required number of bytes allocated. * * This allows you to 'deserialized' a struct * \code * char* b64encoded = "..."; * int len = strlen(b64encoded); * * struct datastuff foo; * if (modp_b64_encode_strlen(sizeof(struct datastuff)) != len) { * // wrong size * return false; * } else { * // safe to do; * if (modp_b64_decode((char*) &foo, b64encoded, len) == -1) { * // bad characters * return false; * } * } * // foo is filled out now * \endcode */ #define modp_b64_encode_strlen(A) ((A + 2)/ 3 * 4) #ifdef __cplusplus } #include <string> inline std::string& modp_b64_encode(std::string& s) { std::string x(modp_b64_encode_len(s.size()), '\0'); int d = modp_b64_encode(const_cast<char*>(x.data()), s.data(), s.size()); x.erase(d, std::string::npos); s.swap(x); return s; } /** * base 64 decode a string (self-modifing) * On failure, the string is empty. * * This function is for C++ only (duh) * * \param[in,out] s the string to be decoded * \return a reference to the input string */ inline std::string& modp_b64_decode(std::string& s) { std::string x(modp_b64_decode_len(s.size()), '\0'); int d = modp_b64_decode(const_cast<char*>(x.data()), s.data(), s.size()); if (d < 0) { x.clear(); } else { x.erase(d, std::string::npos); } s.swap(x); return s; } #endif /* __cplusplus */ #endif /* MODP_B64 */
#include <linux/mount.h> #include <linux/seq_file.h> #include <linux/poll.h> #include <linux/ns_common.h> #include <linux/fs_pin.h> struct mnt_namespace { atomic_t count; struct ns_common ns; struct mount * root; struct list_head list; struct user_namespace *user_ns; u64 seq; /* Sequence number to prevent loops */ wait_queue_head_t poll; u64 event; }; struct mnt_pcp { int mnt_count; int mnt_writers; }; struct mountpoint { struct hlist_node m_hash; struct dentry *m_dentry; struct hlist_head m_list; int m_count; }; struct mount { struct hlist_node mnt_hash; struct mount *mnt_parent; struct dentry *mnt_mountpoint; struct vfsmount mnt; union { struct rcu_head mnt_rcu; struct llist_node mnt_llist; }; #ifdef CONFIG_SMP struct mnt_pcp __percpu *mnt_pcp; #else int mnt_count; int mnt_writers; #endif struct list_head mnt_mounts; /* list of children, anchored here */ struct list_head mnt_child; /* and going through their mnt_child */ struct list_head mnt_instance; /* mount instance on sb->s_mounts */ const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; struct list_head mnt_expire; /* link in fs-specific expiry list */ struct list_head mnt_share; /* circular list of shared mounts */ struct list_head mnt_slave_list;/* list of slave mounts */ struct list_head mnt_slave; /* slave list entry */ struct mount *mnt_master; /* slave is on master->mnt_slave_list */ struct mnt_namespace *mnt_ns; /* containing namespace */ struct mountpoint *mnt_mp; /* where is it mounted */ struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */ #ifdef CONFIG_FSNOTIFY struct hlist_head mnt_fsnotify_marks; __u32 mnt_fsnotify_mask; #endif int mnt_id; /* mount identifier */ int mnt_group_id; /* peer group identifier */ int mnt_expiry_mark; /* true if marked for expiry */ struct hlist_head mnt_pins; struct fs_pin mnt_umount; struct dentry *mnt_ex_mountpoint; }; #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ static inline struct mount *real_mount(struct vfsmount *mnt) { return container_of(mnt, struct mount, mnt); } static inline int mnt_has_parent(struct mount *mnt) { return mnt != mnt->mnt_parent; } static inline int is_mounted(struct vfsmount *mnt) { /* neither detached nor internal? */ return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns); } extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); extern struct mount *__lookup_mnt_last(struct vfsmount *, struct dentry *); extern bool legitimize_mnt(struct vfsmount *, unsigned); extern void __detach_mounts(struct dentry *dentry); static inline void detach_mounts(struct dentry *dentry) { if (!d_mountpoint(dentry)) return; __detach_mounts(dentry); } static inline void get_mnt_ns(struct mnt_namespace *ns) { atomic_inc(&ns->count); } extern seqlock_t mount_lock; static inline void lock_mount_hash(void) { write_seqlock(&mount_lock); } static inline void unlock_mount_hash(void) { write_sequnlock(&mount_lock); } struct proc_mounts { struct seq_file m; struct mnt_namespace *ns; struct path root; int (*show)(struct seq_file *, struct vfsmount *); void *cached_mount; u64 cached_event; loff_t cached_index; }; #define proc_mounts(p) (container_of((p), struct proc_mounts, m)) extern const struct seq_operations mounts_op; extern bool __is_local_mountpoint(struct dentry *dentry); static inline bool is_local_mountpoint(struct dentry *dentry) { if (!d_mountpoint(dentry)) return false; return __is_local_mountpoint(dentry); }
/* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of libunwind. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "_UPT_internal.h" int _UPT_resume (unw_addr_space_t as, unw_cursor_t *c, void *arg) { struct UPT_info *ui = arg; #ifdef HAVE_TTRACE # warning No support for ttrace() yet. #elif HAVE_DECL_PTRACE_CONT return ptrace (PTRACE_CONT, ui->pid, 0, 0); #elif HAVE_DECL_PT_CONTINUE return ptrace(PT_CONTINUE, ui->pid, (caddr_t)1, 0); #endif }
/* types.h - some common typedefs * Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * * Libgcrypt 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.1 of * the License, or (at your option) any later version. * * Libgcrypt 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 program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef GCRYPT_TYPES_H #define GCRYPT_TYPES_H /* The AC_CHECK_SIZEOF() in configure fails for some machines. * we provide some fallback values here */ #if !SIZEOF_UNSIGNED_SHORT #undef SIZEOF_UNSIGNED_SHORT #define SIZEOF_UNSIGNED_SHORT 2 #endif #if !SIZEOF_UNSIGNED_INT #undef SIZEOF_UNSIGNED_INT #define SIZEOF_UNSIGNED_INT 4 #endif #if !SIZEOF_UNSIGNED_LONG #undef SIZEOF_UNSIGNED_LONG #define SIZEOF_UNSIGNED_LONG 4 #endif #include <sys/types.h> #ifndef HAVE_BYTE_TYPEDEF #undef byte /* maybe there is a macro with this name */ /* Windows typedefs byte in the rpc headers. Avoid warning about double definition. */ #if !(defined(_WIN32) && defined(cbNDRContext)) typedef unsigned char byte; #endif #define HAVE_BYTE_TYPEDEF #endif #ifndef HAVE_USHORT_TYPEDEF #undef ushort /* maybe there is a macro with this name */ typedef unsigned short ushort; #define HAVE_USHORT_TYPEDEF #endif #ifndef HAVE_ULONG_TYPEDEF #undef ulong /* maybe there is a macro with this name */ typedef unsigned long ulong; #define HAVE_ULONG_TYPEDEF #endif #ifndef HAVE_U16_TYPEDEF #undef u16 /* maybe there is a macro with this name */ #if SIZEOF_UNSIGNED_INT == 2 typedef unsigned int u16; #elif SIZEOF_UNSIGNED_SHORT == 2 typedef unsigned short u16; #else #error no typedef for u16 #endif #define HAVE_U16_TYPEDEF #endif #ifndef HAVE_U32_TYPEDEF #undef u32 /* maybe there is a macro with this name */ #if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int u32; #elif SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long u32; #else #error no typedef for u32 #endif #define HAVE_U32_TYPEDEF #endif /**************** * Warning: Some systems segfault when this u64 typedef and * the dummy code in cipher/md.c is not available. Examples are * Solaris and IRIX. */ #ifndef HAVE_U64_TYPEDEF #undef u64 /* maybe there is a macro with this name */ #if SIZEOF_UNSIGNED_INT == 8 typedef unsigned int u64; #define U64_C(c) (c ## U) #define HAVE_U64_TYPEDEF #elif SIZEOF_UNSIGNED_LONG == 8 typedef unsigned long u64; #define U64_C(c) (c ## UL) #define HAVE_U64_TYPEDEF #elif SIZEOF_UNSIGNED_LONG_LONG == 8 typedef unsigned long long u64; #define U64_C(c) (c ## ULL) #define HAVE_U64_TYPEDEF #elif SIZEOF_UINT64_T == 8 typedef uint64_t u64; #define U64_C(c) (UINT64_C(c)) #define HAVE_U64_TYPEDEF #endif #endif typedef union { int a; short b; char c[1]; long d; #ifdef HAVE_U64_TYPEDEF u64 e; #endif float f; double g; } PROPERLY_ALIGNED_TYPE; #endif /*GCRYPT_TYPES_H*/
/* Reentrant version of rename system call. */ #include <reent.h> #include <stdio.h> #include <unistd.h> #include <sys/stat.h> #include <_syslist.h> /* Some targets provides their own versions of these functions. Those targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ #ifdef _REENT_ONLY #ifndef REENTRANT_SYSCALLS_PROVIDED #define REENTRANT_SYSCALLS_PROVIDED #endif #endif #ifndef REENTRANT_SYSCALLS_PROVIDED /* We use the errno variable used by the system dependent layer. */ #undef errno extern int errno; /* FUNCTION <<_rename_r>>---Reentrant version of rename INDEX _rename_r ANSI_SYNOPSIS #include <reent.h> int _rename_r(struct _reent *<[ptr]>, const char *<[old]>, const char *<[new]>); TRAD_SYNOPSIS #include <reent.h> int _rename_r(<[ptr]>, <[old]>, <[new]>) struct _reent *<[ptr]>; char *<[old]>; char *<[new]>; DESCRIPTION This is a reentrant version of <<rename>>. It takes a pointer to the global data block, which holds <<errno>>. */ int _DEFUN (_rename_r, (ptr, old, new), struct _reent *ptr _AND _CONST char *old _AND _CONST char *new) { int ret = 0; #ifdef HAVE_RENAME errno = 0; if ((ret = _rename (old, new)) == -1 && errno != 0) ptr->_errno = errno; #else if (_link_r (ptr, old, new) == -1) return -1; if (_unlink_r (ptr, old) == -1) { /* ??? Should we unlink new? (rhetorical question) */ return -1; } #endif return ret; } #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
/* { dg-do compile } */ /* { dg-options "-O -fdump-tree-fre1-details" } */ typedef union { int* data; } SA; typedef struct { int reserved; char* array; }SB; typedef struct { int status; }SC; void foo(SA* pResult, SB* method, SC* self) { if (method->array[0] == 'L' && !self->status && pResult->data != 0) pResult->data = pResult->data; } /* { dg-final { scan-tree-dump "Deleted redundant store" "fre1" } } */ /* { dg-final { cleanup-tree-dump "fre1" } } */
#ifndef ASMNAMES_H #define ASMNAMES_H #define C2(X, Y) X ## Y #define C1(X, Y) C2(X, Y) #ifdef __USER_LABEL_PREFIX__ # define C(X) C1(__USER_LABEL_PREFIX__, X) #else # define C(X) X #endif #ifdef __APPLE__ # define L(X) C1(L, X) #else # define L(X) C1(.L, X) #endif #if defined(__ELF__) && defined(__PIC__) # define PLT(X) X@PLT #else # define PLT(X) X #endif #ifdef __ELF__ # define ENDF(X) .type X,@function; .size X, . - X #else # define ENDF(X) #endif #endif /* ASMNAMES_H */
#ifndef ethernetclient_h #define ethernetclient_h #include "Arduino.h" #include "Print.h" #include "Client.h" #include "IPAddress.h" class EthernetClient : public Client { public: EthernetClient(); EthernetClient(uint8_t sock); uint8_t status(); virtual int connect(IPAddress ip, uint16_t port); virtual int connect(const char *host, uint16_t port); virtual size_t write(uint8_t); virtual size_t write(const uint8_t *buf, size_t size); virtual int available(); virtual int read(); virtual int read(uint8_t *buf, size_t size); virtual int peek(); virtual void flush(); virtual void stop(); virtual uint8_t connected(); virtual operator bool(); friend class EthernetServer; using Print::write; private: static uint16_t _srcport; uint8_t _sock; }; #endif
/*************************************************************************/ /*! @File @Title Debugging and miscellaneous functions server implementation @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved @Description Kernel services functions for debugging and other miscellaneous functionality. @License Dual MIT/GPLv2 The contents of this file are subject to the MIT license as set out below. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 ("GPL") in which case the provisions of GPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of GPL, and not to allow others to use your version of this file under the terms of the MIT license, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by GPL as set out in the file called "GPL-COPYING" included in this distribution. If you do not delete the provisions above, a recipient may use your version of this file under the terms of either the MIT license or GPL. This License is also included in this distribution in the file called "MIT-COPYING". EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /**************************************************************************/ #include "pvrsrv.h" #include "pvr_debug.h" #include "debugmisc_server.h" #include "rgxfwutils.h" #include "rgxta3d.h" #include "pdump_km.h" #include "mmu_common.h" #include "devicemem_server.h" #include "osfunc.h" IMG_EXPORT PVRSRV_ERROR PVRSRVDebugMiscSLCSetBypassStateKM( PVRSRV_DEVICE_NODE *psDeviceNode, IMG_UINT32 uiFlags, IMG_BOOL bSetBypassed) { RGXFWIF_KCCB_CMD sSLCBPCtlCmd; PVRSRV_ERROR eError = PVRSRV_OK; sSLCBPCtlCmd.eCmdType = RGXFWIF_KCCB_CMD_SLCBPCTL; sSLCBPCtlCmd.uCmdData.sSLCBPCtlData.bSetBypassed = bSetBypassed; sSLCBPCtlCmd.uCmdData.sSLCBPCtlData.uiFlags = uiFlags; eError = RGXScheduleCommand(psDeviceNode->pvDevice, RGXFWIF_DM_GP, &sSLCBPCtlCmd, sizeof(sSLCBPCtlCmd), IMG_TRUE); if(eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR, "PVRSRVDebugMiscSLCSetEnableStateKM: RGXScheduleCommandfailed. Error:%u", eError)); } else { /* Wait for the SLC flush to complete */ eError = RGXWaitForFWOp(psDeviceNode->pvDevice, RGXFWIF_DM_GP, psDeviceNode->psSyncPrim, IMG_TRUE); if (eError != PVRSRV_OK) { PVR_DPF((PVR_DBG_ERROR,"PVRSRVDebugMiscSLCSetEnableStateKM: Waiting for value aborted with error (%u)", eError)); } } return PVRSRV_OK; } IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDebugMiscSetFWLogKM( PVRSRV_DEVICE_NODE *psDeviceNode, IMG_UINT32 ui32RGXFWLogType) { PVRSRV_RGXDEV_INFO* psDevInfo = psDeviceNode->pvDevice; /* check log type is valid */ if (ui32RGXFWLogType & ~RGXFWIF_LOG_TYPE_MASK) { return PVRSRV_ERROR_INVALID_PARAMS; } /* set the new log type */ psDevInfo->psRGXFWIfTraceBuf->ui32LogType = ui32RGXFWLogType; return PVRSRV_OK; } static IMG_BOOL _RGXDumpFreeListPageList(PDLLIST_NODE psNode, IMG_PVOID pvCallbackData) { RGX_FREELIST *psFreeList = IMG_CONTAINER_OF(psNode, RGX_FREELIST, sNode); RGXDumpFreeListPageList(psFreeList); return IMG_TRUE; } IMG_EXPORT PVRSRV_ERROR PVRSRVRGXDebugMiscDumpFreelistPageListKM( PVRSRV_DEVICE_NODE *psDeviceNode) { PVRSRV_RGXDEV_INFO* psDevInfo = psDeviceNode->pvDevice; if (dllist_is_empty(&psDevInfo->sFreeListHead)) { return PVRSRV_OK; } PVR_LOG(("---------------[ Begin Freelist Page List Dump ]------------------")); OSLockAcquire(psDevInfo->hLockFreeList); dllist_foreach_node(&psDevInfo->sFreeListHead, _RGXDumpFreeListPageList, IMG_NULL); OSLockRelease(psDevInfo->hLockFreeList); PVR_LOG(("----------------[ End Freelist Page List Dump ]-------------------")); return PVRSRV_OK; }
// SPDX-License-Identifier: GPL-2.0-or-later /* * HID driver for ELECOM devices: * - BM084 Bluetooth Mouse * - EX-G Trackballs (M-XT3DRBK, M-XT3URBK, M-XT4DRBK) * - DEFT Trackballs (M-DT1DRBK, M-DT1URBK, M-DT2DRBK, M-DT2URBK) * - HUGE Trackballs (M-HT1DRBK, M-HT1URBK) * * Copyright (c) 2010 Richard Nauber <Richard.Nauber@gmail.com> * Copyright (c) 2016 Yuxuan Shui <yshuiv7@gmail.com> * Copyright (c) 2017 Diego Elio Pettenò <flameeyes@flameeyes.eu> * Copyright (c) 2017 Alex Manoussakis <amanou@gnu.org> * Copyright (c) 2017 Tomasz Kramkowski <tk@the-tk.com> * Copyright (c) 2020 YOSHIOKA Takuma <lo48576@hard-wi.red> */ /* */ #include <linux/device.h> #include <linux/hid.h> #include <linux/module.h> #include "hid-ids.h" /* * Certain ELECOM mice misreport their button count meaning that they only work * correctly with the ELECOM mouse assistant software which is unavailable for * Linux. A four extra INPUT reports and a FEATURE report are described by the * report descriptor but it does not appear that these enable software to * control what the extra buttons map to. The only simple and straightforward * solution seems to involve fixing up the report descriptor. */ #define MOUSE_BUTTONS_MAX 8 static void mouse_button_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int rsize, unsigned int button_bit_count, unsigned int padding_bit, unsigned int button_report_size, unsigned int button_usage_maximum, int nbuttons) { if (rsize < 32 || rdesc[button_bit_count] != 0x95 || rdesc[button_report_size] != 0x75 || rdesc[button_report_size + 1] != 0x01 || rdesc[button_usage_maximum] != 0x29 || rdesc[padding_bit] != 0x75) return; hid_info(hdev, "Fixing up Elecom mouse button count\n"); nbuttons = clamp(nbuttons, 0, MOUSE_BUTTONS_MAX); rdesc[button_bit_count + 1] = nbuttons; rdesc[button_usage_maximum + 1] = nbuttons; rdesc[padding_bit + 1] = MOUSE_BUTTONS_MAX - nbuttons; } static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { switch (hdev->product) { case USB_DEVICE_ID_ELECOM_BM084: /* The BM084 Bluetooth mouse includes a non-existing horizontal * wheel in the HID descriptor. */ if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { hid_info(hdev, "Fixing up Elecom BM084 report descriptor\n"); rdesc[47] = 0x00; } break; case USB_DEVICE_ID_ELECOM_M_XGL20DLBK: /* * Report descriptor format: * 20: button bit count * 28: padding bit count * 22: button report size * 14: button usage maximum */ mouse_button_fixup(hdev, rdesc, *rsize, 20, 28, 22, 14, 8); break; case USB_DEVICE_ID_ELECOM_M_XT3URBK: case USB_DEVICE_ID_ELECOM_M_XT3DRBK: case USB_DEVICE_ID_ELECOM_M_XT4DRBK: /* * Report descriptor format: * 12: button bit count * 30: padding bit count * 14: button report size * 20: button usage maximum */ mouse_button_fixup(hdev, rdesc, *rsize, 12, 30, 14, 20, 6); break; case USB_DEVICE_ID_ELECOM_M_DT1URBK: case USB_DEVICE_ID_ELECOM_M_DT1DRBK: case USB_DEVICE_ID_ELECOM_M_HT1URBK: case USB_DEVICE_ID_ELECOM_M_HT1DRBK: /* * Report descriptor format: * 12: button bit count * 30: padding bit count * 14: button report size * 20: button usage maximum */ mouse_button_fixup(hdev, rdesc, *rsize, 12, 30, 14, 20, 8); break; } return rdesc; } static const struct hid_device_id elecom_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1URBK) }, { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1DRBK) }, { } }; MODULE_DEVICE_TABLE(hid, elecom_devices); static struct hid_driver elecom_driver = { .name = "elecom", .id_table = elecom_devices, .report_fixup = elecom_report_fixup }; module_hid_driver(elecom_driver); MODULE_LICENSE("GPL");
#ifndef CONFIG_USER_H #define CONFIG_USER_H #include "../../config.h" #define MUSIC_MASK (keycode != KC_NO) /* * MIDI options */ /* Prevent use of disabled MIDI features in the keymap */ //#define MIDI_ENABLE_STRICT 1 /* enable basic MIDI features: - MIDI notes can be sent when in Music mode is on */ #define MIDI_BASIC /* enable advanced MIDI features: - MIDI notes can be added to the keymap - Octave shift and transpose - Virtual sustain, portamento, and modulation wheel - etc. */ //#define MIDI_ADVANCED /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ //#define MIDI_TONE_KEYCODE_OCTAVES 2 #endif
/* * Copyright (C) 2009 Apple Inc. All Rights Reserved. * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef WorkerScriptLoader_h #define WorkerScriptLoader_h #if ENABLE(WORKERS) #include "KURL.h" #include "ResourceRequest.h" #include "ThreadableLoader.h" #include "ThreadableLoaderClient.h" #include <wtf/FastAllocBase.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/text/StringBuilder.h> namespace WebCore { class ResourceRequest; class ResourceResponse; class ScriptExecutionContext; class TextResourceDecoder; class WorkerScriptLoaderClient; class WorkerScriptLoader : public RefCounted<WorkerScriptLoader>, public ThreadableLoaderClient { WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<WorkerScriptLoader> create() { return adoptRef(new WorkerScriptLoader()); } void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy); void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*); void notifyError(); String script(); const KURL& url() const { return m_url; } const KURL& responseURL() const; bool failed() const { return m_failed; } unsigned long identifier() const { return m_identifier; } virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) OVERRIDE; virtual void didReceiveData(const char* data, int dataLength) OVERRIDE; virtual void didFinishLoading(unsigned long identifier, double) OVERRIDE; virtual void didFail(const ResourceError&) OVERRIDE; virtual void didFailRedirectCheck() OVERRIDE; #if PLATFORM(BLACKBERRY) void setTargetType(ResourceRequest::TargetType targetType) { m_targetType = targetType; } #endif private: friend class WTF::RefCounted<WorkerScriptLoader>; WorkerScriptLoader(); ~WorkerScriptLoader(); PassOwnPtr<ResourceRequest> createResourceRequest(); void notifyFinished(); WorkerScriptLoaderClient* m_client; RefPtr<ThreadableLoader> m_threadableLoader; String m_responseEncoding; RefPtr<TextResourceDecoder> m_decoder; StringBuilder m_script; KURL m_url; KURL m_responseURL; bool m_failed; unsigned long m_identifier; bool m_finishing; #if PLATFORM(BLACKBERRY) ResourceRequest::TargetType m_targetType; #endif }; } // namespace WebCore #endif // ENABLE(WORKERS) #endif // WorkerScriptLoader_h
/* * Test for pthread_join(). * * * -------------------------------------------------------------------------- * * Pthreads-win32 - POSIX Threads Library for Win32 * Copyright(C) 1998 John E. Bossom * Copyright(C) 1999,2005 Pthreads-win32 contributors * * Contact Email: rpj@callisto.canberra.edu.au * * The current list of contributors is contained * in the file CONTRIBUTORS included with the source * code distribution. The list can also be seen at the * following World Wide Web location: * http://sources.redhat.com/pthreads-win32/contributors.html * * 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 in the file COPYING.LIB; * if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * * -------------------------------------------------------------------------- * * Depends on API functions: pthread_create(), pthread_join(), pthread_exit(). */ #include "test.h" void * func(void * arg) { int i = (int)(size_t)arg; Sleep(i * 100); pthread_exit(arg); /* Never reached. */ exit(1); } int main(int argc, char * argv[]) { pthread_t id[4]; int i; void* result = (void*)-1; /* Create a few threads and then exit. */ for (i = 0; i < 4; i++) { assert(pthread_create(&id[i], NULL, func, (void *)(size_t)i) == 0); } /* Some threads will finish before they are joined, some after. */ Sleep(2 * 100 + 50); for (i = 0; i < 4; i++) { assert(pthread_join(id[i], &result) == 0); assert((int)(size_t)result == i); } /* Success. */ return 0; }
#ifndef QEMU_HID_H #define QEMU_HID_H #include "migration/vmstate.h" #include "ui/input.h" #define HID_MOUSE 1 #define HID_TABLET 2 #define HID_KEYBOARD 3 typedef struct HIDPointerEvent { int32_t xdx, ydy; /* relative iff it's a mouse, otherwise absolute */ int32_t dz, buttons_state; } HIDPointerEvent; #define QUEUE_LENGTH 16 /* should be enough for a triple-click */ #define QUEUE_MASK (QUEUE_LENGTH-1u) #define QUEUE_INCR(v) ((v)++, (v) &= QUEUE_MASK) typedef struct HIDState HIDState; typedef void (*HIDEventFunc)(HIDState *s); typedef struct HIDMouseState { HIDPointerEvent queue[QUEUE_LENGTH]; int mouse_grabbed; } HIDMouseState; typedef struct HIDKeyboardState { uint32_t keycodes[QUEUE_LENGTH]; uint16_t modifiers; uint8_t leds; uint8_t key[16]; int32_t keys; } HIDKeyboardState; struct HIDState { union { HIDMouseState ptr; HIDKeyboardState kbd; }; uint32_t head; /* index into circular queue */ uint32_t n; int kind; int32_t protocol; uint8_t idle; bool idle_pending; QEMUTimer *idle_timer; HIDEventFunc event; QemuInputHandlerState *s; }; void hid_init(HIDState *hs, int kind, HIDEventFunc event); void hid_reset(HIDState *hs); void hid_free(HIDState *hs); bool hid_has_events(HIDState *hs); void hid_set_next_idle(HIDState *hs); void hid_pointer_activate(HIDState *hs); int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len); int hid_keyboard_poll(HIDState *hs, uint8_t *buf, int len); int hid_keyboard_write(HIDState *hs, uint8_t *buf, int len); extern const VMStateDescription vmstate_hid_keyboard_device; #define VMSTATE_HID_KEYBOARD_DEVICE(_field, _state) { \ .name = (stringify(_field)), \ .size = sizeof(HIDState), \ .vmsd = &vmstate_hid_keyboard_device, \ .flags = VMS_STRUCT, \ .offset = vmstate_offset_value(_state, _field, HIDState), \ } extern const VMStateDescription vmstate_hid_ptr_device; #define VMSTATE_HID_POINTER_DEVICE(_field, _state) { \ .name = (stringify(_field)), \ .size = sizeof(HIDState), \ .vmsd = &vmstate_hid_ptr_device, \ .flags = VMS_STRUCT, \ .offset = vmstate_offset_value(_state, _field, HIDState), \ } #endif /* QEMU_HID_H */
/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CSSPropertyAnimation_h #define CSSPropertyAnimation_h #include "CSSPropertyNames.h" #include "RenderStyleConstants.h" #include <wtf/HashSet.h> namespace WebCore { class AnimationBase; class RenderStyle; class CSSPropertyAnimation { public: #if USE(ACCELERATED_COMPOSITING) static bool animationOfPropertyIsAccelerated(CSSPropertyID); #endif static bool propertiesEqual(CSSPropertyID, const RenderStyle* a, const RenderStyle* b); static CSSPropertyID getPropertyAtIndex(int, bool& isShorthand); static int getNumProperties(); static HashSet<CSSPropertyID> animatableShorthandsAffectingProperty(CSSPropertyID); // Return true if we need to start software animation timers static bool blendProperties(const AnimationBase*, CSSPropertyID, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress); private: static void ensurePropertyMap(); }; } // namespace WebCore #endif // CSSPropertyAnimation_h
#ifndef _M68KNOMMU_DMA_MAPPING_H #define _M68KNOMMU_DMA_MAPPING_H #ifdef CONFIG_PCI #include <asm-generic/dma-mapping.h> #else #include <asm-generic/dma-mapping-broken.h> #endif #endif /* _M68KNOMMU_DMA_MAPPING_H */
/* * Copyright (C) 2017 Linus Walleij <linus.walleij@linaro.org> * Parts of this file were based on sources as follows: * * Copyright (C) 2006-2008 Intel Corporation * Copyright (C) 2007 Amos Lee <amos_lee@storlinksemi.com> * Copyright (C) 2007 Dave Airlie <airlied@linux.ie> * Copyright (C) 2011 Texas Instruments * Copyright (C) 2017 Eric Anholt * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation, and any use by you of this program is subject to the terms of * such GNU licence. */ #ifndef _TVE200_DRM_H_ #define _TVE200_DRM_H_ /* Bits 2-31 are valid physical base addresses */ #define TVE200_Y_FRAME_BASE_ADDR 0x00 #define TVE200_U_FRAME_BASE_ADDR 0x04 #define TVE200_V_FRAME_BASE_ADDR 0x08 #define TVE200_INT_EN 0x0C #define TVE200_INT_CLR 0x10 #define TVE200_INT_STAT 0x14 #define TVE200_INT_BUS_ERR BIT(7) #define TVE200_INT_V_STATUS BIT(6) /* vertical blank */ #define TVE200_INT_V_NEXT_FRAME BIT(5) #define TVE200_INT_U_NEXT_FRAME BIT(4) #define TVE200_INT_Y_NEXT_FRAME BIT(3) #define TVE200_INT_V_FIFO_UNDERRUN BIT(2) #define TVE200_INT_U_FIFO_UNDERRUN BIT(1) #define TVE200_INT_Y_FIFO_UNDERRUN BIT(0) #define TVE200_FIFO_UNDERRUNS (TVE200_INT_V_FIFO_UNDERRUN | \ TVE200_INT_U_FIFO_UNDERRUN | \ TVE200_INT_Y_FIFO_UNDERRUN) #define TVE200_CTRL 0x18 #define TVE200_CTRL_YUV420 BIT(31) #define TVE200_CTRL_CSMODE BIT(30) #define TVE200_CTRL_NONINTERLACE BIT(28) /* 0 = non-interlace CCIR656 */ #define TVE200_CTRL_TVCLKP BIT(27) /* Inverted clock phase */ /* Bits 24..26 define the burst size after arbitration on the bus */ #define TVE200_CTRL_BURST_4_WORDS (0 << 24) #define TVE200_CTRL_BURST_8_WORDS (1 << 24) #define TVE200_CTRL_BURST_16_WORDS (2 << 24) #define TVE200_CTRL_BURST_32_WORDS (3 << 24) #define TVE200_CTRL_BURST_64_WORDS (4 << 24) #define TVE200_CTRL_BURST_128_WORDS (5 << 24) #define TVE200_CTRL_BURST_256_WORDS (6 << 24) #define TVE200_CTRL_BURST_0_WORDS (7 << 24) /* ? */ /* * Bits 16..23 is the retry count*16 before issueing a new AHB transfer * on the AHB bus. */ #define TVE200_CTRL_RETRYCNT_MASK GENMASK(23, 16) #define TVE200_CTRL_RETRYCNT_16 (1 << 16) #define TVE200_CTRL_BBBP BIT(15) /* 0 = little-endian */ /* Bits 12..14 define the YCbCr ordering */ #define TVE200_CTRL_YCBCRODR_CB0Y0CR0Y1 (0 << 12) #define TVE200_CTRL_YCBCRODR_Y0CB0Y1CR0 (1 << 12) #define TVE200_CTRL_YCBCRODR_CR0Y0CB0Y1 (2 << 12) #define TVE200_CTRL_YCBCRODR_Y1CB0Y0CR0 (3 << 12) #define TVE200_CTRL_YCBCRODR_CR0Y1CB0Y0 (4 << 12) #define TVE200_CTRL_YCBCRODR_Y1CR0Y0CB0 (5 << 12) #define TVE200_CTRL_YCBCRODR_CB0Y1CR0Y0 (6 << 12) #define TVE200_CTRL_YCBCRODR_Y0CR0Y1CB0 (7 << 12) /* Bits 10..11 define the input resolution (framebuffer size) */ #define TVE200_CTRL_IPRESOL_CIF (0 << 10) #define TVE200_CTRL_IPRESOL_VGA (1 << 10) #define TVE200_CTRL_IPRESOL_D1 (2 << 10) #define TVE200_CTRL_NTSC BIT(9) /* 0 = PAL, 1 = NTSC */ #define TVE200_CTRL_INTERLACE BIT(8) /* 1 = interlace, only for D1 */ #define TVE200_IPDMOD_RGB555 (0 << 6) /* TVE200_CTRL_YUV420 = 0 */ #define TVE200_IPDMOD_RGB565 (1 << 6) #define TVE200_IPDMOD_RGB888 (2 << 6) #define TVE200_IPDMOD_YUV420 (2 << 6) /* TVE200_CTRL_YUV420 = 1 */ #define TVE200_IPDMOD_YUV422 (3 << 6) /* Bits 4 & 5 define when to fire the vblank IRQ */ #define TVE200_VSTSTYPE_VSYNC (0 << 4) /* start of vsync */ #define TVE200_VSTSTYPE_VBP (1 << 4) /* start of v back porch */ #define TVE200_VSTSTYPE_VAI (2 << 4) /* start of v active image */ #define TVE200_VSTSTYPE_VFP (3 << 4) /* start of v front porch */ #define TVE200_VSTSTYPE_BITS (BIT(4) | BIT(5)) #define TVE200_BGR BIT(1) /* 0 = RGB, 1 = BGR */ #define TVE200_TVEEN BIT(0) /* Enable TVE block */ #define TVE200_CTRL_2 0x1c #define TVE200_CTRL_3 0x20 #define TVE200_CTRL_4 0x24 #define TVE200_CTRL_4_RESET BIT(0) /* triggers reset of TVE200 */ #include <drm/drm_gem.h> #include <drm/drm_simple_kms_helper.h> struct tve200_drm_dev_private { struct drm_device *drm; struct drm_connector *connector; struct drm_panel *panel; struct drm_bridge *bridge; struct drm_simple_display_pipe pipe; void *regs; struct clk *pclk; struct clk *clk; }; #define to_tve200_connector(x) \ container_of(x, struct tve200_drm_connector, connector) int tve200_display_init(struct drm_device *dev); irqreturn_t tve200_irq(int irq, void *data); int tve200_connector_init(struct drm_device *dev); int tve200_encoder_init(struct drm_device *dev); int tve200_dumb_create(struct drm_file *file_priv, struct drm_device *dev, struct drm_mode_create_dumb *args); #endif /* _TVE200_DRM_H_ */
/* * debug.h - ChipIdea USB driver debug interfaces * * Copyright (C) 2008 Chipidea - MIPS Technologies, Inc. All rights reserved. * * Author: David Lopo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __DRIVERS_USB_CHIPIDEA_DEBUG_H #define __DRIVERS_USB_CHIPIDEA_DEBUG_H #ifdef CONFIG_USB_CHIPIDEA_DEBUG int dbg_create_files(struct ci13xxx *ci); void dbg_remove_files(struct ci13xxx *ci); #else static inline int dbg_create_files(struct ci13xxx *ci) { return 0; } static inline void dbg_remove_files(struct ci13xxx *ci) { } #endif #endif /* __DRIVERS_USB_CHIPIDEA_DEBUG_H */
/* * Copyright (C) 2008 Google, Inc. * Copyright (C) 2010-2013, The Linux Foundation. All rights reserved. * Author: Nick Pelly <npelly@google.com> * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program 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. */ #ifndef __ASM_ARCH_MSM_SERIAL_HS_H #define __ASM_ARCH_MSM_SERIAL_HS_H #include<linux/serial_core.h> /** * struct msm_serial_hs_platform_data - platform device data * for msm hsuart device * @wakeup_irq : IRQ line to be configured as Wakeup source. * @inject_rx_on_wakeup : Set 1 if specific character to be inserted on wakeup * @rx_to_inject : Character to be inserted on wakeup * @gpio_config : Configure gpios that are used for uart communication * @userid : User-defined number to be used to enumerate device as tty<userid> * @uart_tx_gpio: GPIO number for UART Tx Line. * @uart_rx_gpio: GPIO number for UART Rx Line. * @uart_cts_gpio: GPIO number for UART CTS Line. * @uart_rfr_gpio: GPIO number for UART RFR Line. * @bam_tx_ep_pipe_index : BAM TX Endpoint Pipe Index for HSUART * @bam_tx_ep_pipe_index : BAM RX Endpoint Pipe Index for HSUART */ struct msm_serial_hs_platform_data { int wakeup_irq; /* wakeup irq */ unsigned char inject_rx_on_wakeup; char rx_to_inject; int (*gpio_config)(int); int userid; int uart_tx_gpio; int uart_rx_gpio; int uart_cts_gpio; int uart_rfr_gpio; unsigned bam_tx_ep_pipe_index; unsigned bam_rx_ep_pipe_index; }; unsigned int msm_hs_tx_empty(struct uart_port *uport); void msm_hs_request_clock_off(struct uart_port *uport); void msm_hs_request_clock_on(struct uart_port *uport); struct uart_port *msm_hs_get_uart_port(int port_index); void msm_hs_set_mctrl(struct uart_port *uport, unsigned int mctrl); #endif
/* * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> * Copyright (c) 2007 Intel Corporation * Jesse Barnes <jesse.barnes@intel.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #include <linux/i2c.h> #include <linux/fb.h> #include "drmP.h" #include "intel_drv.h" /** * intel_ddc_probe * */ bool intel_ddc_probe(struct intel_output *intel_output) { u8 out_buf[] = { 0x0, 0x0}; u8 buf[2]; int ret; struct i2c_msg msgs[] = { { .addr = 0x50, .flags = 0, .len = 1, .buf = out_buf, }, { .addr = 0x50, .flags = I2C_M_RD, .len = 1, .buf = buf, } }; ret = i2c_transfer(&intel_output->ddc_bus->adapter, msgs, 2); if (ret == 2) return true; return false; } /** * intel_ddc_get_modes - get modelist from monitor * @connector: DRM connector device to use * * Fetch the EDID information from @connector using the DDC bus. */ int intel_ddc_get_modes(struct intel_output *intel_output) { struct edid *edid; int ret = 0; edid = drm_get_edid(&intel_output->base, &intel_output->ddc_bus->adapter); if (edid) { drm_mode_connector_update_edid_property(&intel_output->base, edid); ret = drm_add_edid_modes(&intel_output->base, edid); kfree(edid); } return ret; }
// SPDX-License-Identifier: GPL-2.0 /* * bitops.c: atomic operations which got too long to be inlined all over * the place. * * Copyright 1999 Philipp Rumpf (prumpf@tux.org) * Copyright 2000 Grant Grundler (grundler@cup.hp.com) */ #include <linux/kernel.h> #include <linux/spinlock.h> #include <linux/atomic.h> #ifdef CONFIG_SMP arch_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned = { [0 ... (ATOMIC_HASH_SIZE-1)] = __ARCH_SPIN_LOCK_UNLOCKED }; #endif #ifdef CONFIG_64BIT unsigned long __xchg64(unsigned long x, volatile unsigned long *ptr) { unsigned long temp, flags; _atomic_spin_lock_irqsave(ptr, flags); temp = *ptr; *ptr = x; _atomic_spin_unlock_irqrestore(ptr, flags); return temp; } #endif unsigned long __xchg32(int x, volatile int *ptr) { unsigned long flags; long temp; _atomic_spin_lock_irqsave(ptr, flags); temp = (long) *ptr; /* XXX - sign extension wanted? */ *ptr = x; _atomic_spin_unlock_irqrestore(ptr, flags); return (unsigned long)temp; } unsigned long __xchg8(char x, volatile char *ptr) { unsigned long flags; long temp; _atomic_spin_lock_irqsave(ptr, flags); temp = (long) *ptr; /* XXX - sign extension wanted? */ *ptr = x; _atomic_spin_unlock_irqrestore(ptr, flags); return (unsigned long)temp; } u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new) { unsigned long flags; u64 prev; _atomic_spin_lock_irqsave(ptr, flags); if ((prev = *ptr) == old) *ptr = new; _atomic_spin_unlock_irqrestore(ptr, flags); return prev; } unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new) { unsigned long flags; unsigned int prev; _atomic_spin_lock_irqsave(ptr, flags); if ((prev = *ptr) == old) *ptr = new; _atomic_spin_unlock_irqrestore(ptr, flags); return (unsigned long)prev; } u8 __cmpxchg_u8(volatile u8 *ptr, u8 old, u8 new) { unsigned long flags; u8 prev; _atomic_spin_lock_irqsave(ptr, flags); if ((prev = *ptr) == old) *ptr = new; _atomic_spin_unlock_irqrestore(ptr, flags); return prev; }
/* * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WKBundleNodeHandle_h #define WKBundleNodeHandle_h #include <WebKit2/WKBase.h> #ifdef __cplusplus extern "C" { #endif WK_EXPORT WKTypeID WKBundleNodeHandleGetTypeID(); #ifdef __cplusplus } #endif #endif /* WKBundleNodeHandle_h */
extern int main(int argc, char **argv, char **envp); extern int brk (void *value); extern char bss_start; extern char end; char *__env[1] = {0}; char **environ = __env; #define ENABLE_TRACE_MASK 1 __inline static void enable_tracing (void) { register int mask = ENABLE_TRACE_MASK; __asm__ volatile ("modpc %0,%0,%0" : : "d" (mask)); } #define STACK_ALIGN 64 __inline static void set_stack (void* ptr) { ptr = (void *)(((int)ptr + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1)); /* SP must be 64 bytes larger than FP at start. */ __asm__ volatile ("mov %0,sp" : : "d" (ptr+STACK_ALIGN)); __asm__ volatile ("mov %0,fp" : : "d" (ptr)); } __inline static void init_Cregs (void) { /* set register values gcc like */ register unsigned int mask0=0x3b001000; register unsigned int mask1=0x00009107; __asm__ volatile ("mov %0,g14" : /* no output */ : "I" (0)); /* gnu structure pointer */ __asm__ volatile ("modac %1,%0,%0" : /* no output */ : "d" (mask0), "d" (mask1)); /* fpu control kb */ } void _start(void) { char *p; enable_tracing (); set_stack (&end); init_Cregs (); /* The stack grows upwards, so this makes the heap start after a 256K stack area. PlumHall known to fail with less than 73K of stack. */ brk (&end+0x40000); /* clear bss */ memset (&bss_start, 0, &end - &bss_start); main(0, 0, 0); exit(0); }
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __javax_security_auth_login_Configuration__ #define __javax_security_auth_login_Configuration__ #pragma interface #include <java/lang/Object.h> #include <gcj/array.h> extern "Java" { namespace javax { namespace security { namespace auth { namespace login { class AppConfigurationEntry; class Configuration; } } } } } class javax::security::auth::login::Configuration : public ::java::lang::Object { public: // actually protected Configuration(); public: static ::javax::security::auth::login::Configuration * getConfiguration(); static void setConfiguration(::javax::security::auth::login::Configuration *); virtual JArray< ::javax::security::auth::login::AppConfigurationEntry * > * getAppConfigurationEntry(::java::lang::String *) = 0; virtual void refresh() = 0; public: // actually package-private static ::javax::security::auth::login::Configuration * getConfig(); private: static ::javax::security::auth::login::Configuration * config; public: static ::java::lang::Class class$; }; #endif // __javax_security_auth_login_Configuration__
/****************************************************************************** * * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program 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 * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Modifications for inclusion into the Linux staging tree are * Copyright(c) 2010 Larry Finger. All rights reserved. * * Contact information: * WLAN FAE <wlanfae@realtek.com> * Larry Finger <Larry.Finger@lwfinger.net> * ******************************************************************************/ #ifndef __RTL8712_GP_BITDEF_H__ #define __RTL8712_GP_BITDEF_H__ /*GPIO_CTRL*/ #define _GPIO_MOD_MSK 0xFF000000 #define _GPIO_MOD_SHT 24 #define _GPIO_IO_SEL_MSK 0x00FF0000 #define _GPIO_IO_SEL_SHT 16 #define _GPIO_OUT_MSK 0x0000FF00 #define _GPIO_OUT_SHT 8 #define _GPIO_IN_MSK 0x000000FF #define _GPIO_IN_SHT 0 /*SYS_PINMUX_CFG*/ #define _GPIOSEL_MSK 0x0003 #define _GPIOSEL_SHT 0 /*LED_CFG*/ #define _LED1SV BIT(7) #define _LED1CM_MSK 0x0070 #define _LED1CM_SHT 4 #define _LED0SV BIT(3) #define _LED0CM_MSK 0x0007 #define _LED0CM_SHT 0 /*PHY_REG*/ #define _HST_RDRDY_SHT 0 #define _HST_RDRDY_MSK 0xFF #define _HST_RDRDY BIT(_HST_RDRDY_SHT) #define _CPU_WTBUSY_SHT 1 #define _CPU_WTBUSY_MSK 0xFF #define _CPU_WTBUSY BIT(_CPU_WTBUSY_SHT) /* 11. General Purpose Registers (Offset: 0x02E0 - 0x02FF)*/ /* 8192S GPIO Config Setting (offset 0x2F1, 1 byte)*/ /*----------------------------------------------------------------------------*/ #define GPIOMUX_EN BIT(3) /* When this bit is set to "1", * GPIO PINs will switch to MAC * GPIO Function*/ #define GPIOSEL_GPIO 0 /* UART or JTAG or pure GPIO*/ #define GPIOSEL_PHYDBG 1 /* PHYDBG*/ #define GPIOSEL_BT 2 /* BT_coex*/ #define GPIOSEL_WLANDBG 3 /* WLANDBG*/ #define GPIOSEL_GPIO_MASK (~(BIT(0)|BIT(1))) /* HW Radio OFF switch (GPIO BIT) */ #define HAL_8192S_HW_GPIO_OFF_BIT BIT(3) #define HAL_8192S_HW_GPIO_OFF_MASK 0xF7 #define HAL_8192S_HW_GPIO_WPS_BIT BIT(4) #endif /*__RTL8712_GP_BITDEF_H__*/
/* * The SH64 TLB miss. * * Original code from fault.c * Copyright (C) 2000, 2001 Paolo Alberelli * * Fast PTE->TLB refill path * Copyright (C) 2003 Richard.Curnow@superh.com * * IMPORTANT NOTES : * The do_fast_page_fault function is called from a context in entry.S * where very few registers have been saved. In particular, the code in * this file must be compiled not to use ANY caller-save registers that * are not part of the restricted save set. Also, it means that code in * this file must not make calls to functions elsewhere in the kernel, or * else the excepting context will see corruption in its caller-save * registers. Plus, the entry.S save area is non-reentrant, so this code * has to run with SR.BL==1, i.e. no interrupts taken inside it and panic * on any exception. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #include <linux/signal.h> #include <linux/sched.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/string.h> #include <linux/types.h> #include <linux/ptrace.h> #include <linux/mman.h> #include <linux/mm.h> #include <linux/smp.h> #include <linux/interrupt.h> #include <linux/kprobes.h> #include <asm/tlb.h> #include <asm/io.h> #include <linux/uaccess.h> #include <asm/pgalloc.h> #include <asm/mmu_context.h> static int handle_tlbmiss(unsigned long long protection_flags, unsigned long address) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *pte; pte_t entry; if (is_vmalloc_addr((void *)address)) { pgd = pgd_offset_k(address); } else { if (unlikely(address >= TASK_SIZE || !current->mm)) return 1; pgd = pgd_offset(current->mm, address); } pud = pud_offset(pgd, address); if (pud_none(*pud) || !pud_present(*pud)) return 1; pmd = pmd_offset(pud, address); if (pmd_none(*pmd) || !pmd_present(*pmd)) return 1; pte = pte_offset_kernel(pmd, address); entry = *pte; if (pte_none(entry) || !pte_present(entry)) return 1; /* * If the page doesn't have sufficient protection bits set to * service the kind of fault being handled, there's not much * point doing the TLB refill. Punt the fault to the general * handler. */ if ((pte_val(entry) & protection_flags) != protection_flags) return 1; update_mmu_cache(NULL, address, pte); return 0; } /* * Put all this information into one structure so that everything is just * arithmetic relative to a single base address. This reduces the number * of movi/shori pairs needed just to load addresses of static data. */ struct expevt_lookup { unsigned short protection_flags[8]; unsigned char is_text_access[8]; unsigned char is_write_access[8]; }; #define PRU (1<<9) #define PRW (1<<8) #define PRX (1<<7) #define PRR (1<<6) /* Sized as 8 rather than 4 to allow checking the PTE's PRU bit against whether the fault happened in user mode or privileged mode. */ static struct expevt_lookup expevt_lookup_table = { .protection_flags = {PRX, PRX, 0, 0, PRR, PRR, PRW, PRW}, .is_text_access = {1, 1, 0, 0, 0, 0, 0, 0} }; static inline unsigned int expevt_to_fault_code(unsigned long expevt) { if (expevt == 0xa40) return FAULT_CODE_ITLB; else if (expevt == 0x060) return FAULT_CODE_WRITE; return 0; } /* This routine handles page faults that can be serviced just by refilling a TLB entry from an existing page table entry. (This case represents a very large majority of page faults.) Return 1 if the fault was successfully handled. Return 0 if the fault could not be handled. (This leads into the general fault handling in fault.c which deals with mapping file-backed pages, stack growth, segmentation faults, swapping etc etc) */ asmlinkage int __kprobes do_fast_page_fault(unsigned long long ssr_md, unsigned long long expevt, unsigned long address) { unsigned long long protection_flags; unsigned long long index; unsigned long long expevt4; unsigned int fault_code; /* The next few lines implement a way of hashing EXPEVT into a * small array index which can be used to lookup parameters * specific to the type of TLBMISS being handled. * * Note: * ITLBMISS has EXPEVT==0xa40 * RTLBMISS has EXPEVT==0x040 * WTLBMISS has EXPEVT==0x060 */ expevt4 = (expevt >> 4); /* TODO : xor ssr_md into this expression too. Then we can check * that PRU is set when it needs to be. */ index = expevt4 ^ (expevt4 >> 5); index &= 7; fault_code = expevt_to_fault_code(expevt); protection_flags = expevt_lookup_table.protection_flags[index]; if (expevt_lookup_table.is_text_access[index]) fault_code |= FAULT_CODE_ITLB; if (!ssr_md) fault_code |= FAULT_CODE_USER; set_thread_fault_code(fault_code); return handle_tlbmiss(protection_flags, address); }
/* ****************************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * Date Name Description * 03/28/00 aliu Creation. ****************************************************************************** */ #ifndef HASH_H #define HASH_H #include "unicode/unistr.h" #include "unicode/uobject.h" #include "uhash.h" U_NAMESPACE_BEGIN /** * Hashtable is a thin C++ wrapper around UHashtable, a general-purpose void* * hashtable implemented in C. Hashtable is designed to be idiomatic and * easy-to-use in C++. * * Hashtable is an INTERNAL CLASS. */ class U_COMMON_API Hashtable : public UMemory { UHashtable* hash; UHashtable hashObj; inline void init(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); public: /** * Construct a hashtable * @param ignoreKeyCase If true, keys are case insensitive. * @param status Error code */ Hashtable(UBool ignoreKeyCase, UErrorCode& status); /** * Construct a hashtable * @param keyComp Comparator for comparing the keys * @param valueComp Comparator for comparing the values * @param status Error code */ Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status); /** * Construct a hashtable * @param status Error code */ Hashtable(UErrorCode& status); /** * Construct a hashtable, _disregarding any error_. Use this constructor * with caution. */ Hashtable(); /** * Non-virtual destructor; make this virtual if Hashtable is subclassed * in the future. */ ~Hashtable(); UObjectDeleter *setValueDeleter(UObjectDeleter *fn); int32_t count() const; void* put(const UnicodeString& key, void* value, UErrorCode& status); int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status); void* get(const UnicodeString& key) const; int32_t geti(const UnicodeString& key) const; void* remove(const UnicodeString& key); int32_t removei(const UnicodeString& key); void removeAll(void); const UHashElement* find(const UnicodeString& key) const; const UHashElement* nextElement(int32_t& pos) const; UKeyComparator* setKeyComparator(UKeyComparator*keyComp); UValueComparator* setValueComparator(UValueComparator* valueComp); UBool equals(const Hashtable& that) const; private: Hashtable(const Hashtable &other); // forbid copying of this class Hashtable &operator=(const Hashtable &other); // forbid copying of this class }; /********************************************************************* * Implementation ********************************************************************/ inline void Hashtable::init(UHashFunction *keyHash, UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status) { if (U_FAILURE(status)) { return; } uhash_init(&hashObj, keyHash, keyComp, valueComp, &status); if (U_SUCCESS(status)) { hash = &hashObj; uhash_setKeyDeleter(hash, uhash_deleteUnicodeString); } } inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp, UErrorCode& status) : hash(0) { init( uhash_hashUnicodeString, keyComp, valueComp, status); } inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status) : hash(0) { init(ignoreKeyCase ? uhash_hashCaselessUnicodeString : uhash_hashUnicodeString, ignoreKeyCase ? uhash_compareCaselessUnicodeString : uhash_compareUnicodeString, NULL, status); } inline Hashtable::Hashtable(UErrorCode& status) : hash(0) { init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status); } inline Hashtable::Hashtable() : hash(0) { UErrorCode status = U_ZERO_ERROR; init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status); } inline Hashtable::~Hashtable() { if (hash != NULL) { uhash_close(hash); } } inline UObjectDeleter *Hashtable::setValueDeleter(UObjectDeleter *fn) { return uhash_setValueDeleter(hash, fn); } inline int32_t Hashtable::count() const { return uhash_count(hash); } inline void* Hashtable::put(const UnicodeString& key, void* value, UErrorCode& status) { return uhash_put(hash, new UnicodeString(key), value, &status); } inline int32_t Hashtable::puti(const UnicodeString& key, int32_t value, UErrorCode& status) { return uhash_puti(hash, new UnicodeString(key), value, &status); } inline void* Hashtable::get(const UnicodeString& key) const { return uhash_get(hash, &key); } inline int32_t Hashtable::geti(const UnicodeString& key) const { return uhash_geti(hash, &key); } inline void* Hashtable::remove(const UnicodeString& key) { return uhash_remove(hash, &key); } inline int32_t Hashtable::removei(const UnicodeString& key) { return uhash_removei(hash, &key); } inline const UHashElement* Hashtable::find(const UnicodeString& key) const { return uhash_find(hash, &key); } inline const UHashElement* Hashtable::nextElement(int32_t& pos) const { return uhash_nextElement(hash, &pos); } inline void Hashtable::removeAll(void) { uhash_removeAll(hash); } inline UKeyComparator* Hashtable::setKeyComparator(UKeyComparator*keyComp){ return uhash_setKeyComparator(hash, keyComp); } inline UValueComparator* Hashtable::setValueComparator(UValueComparator* valueComp){ return uhash_setValueComparator(hash, valueComp); } inline UBool Hashtable::equals(const Hashtable& that)const{ return uhash_equals(hash, that.hash); } U_NAMESPACE_END #endif
/* * Copyright 2010 Tilera Corporation. All Rights Reserved. * * This program 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, version 2. * * This program 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, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for * more details. */ #ifndef _ASM_TILE_KMAP_TYPES_H #define _ASM_TILE_KMAP_TYPES_H /* * In 32-bit TILE Linux we have to balance the desire to have a lot of * nested atomic mappings with the fact that large page sizes and many * processors chew up address space quickly. In a typical * 64-processor, 64KB-page layout build, making KM_TYPE_NR one larger * adds 4MB of required address-space. For now we leave KM_TYPE_NR * set to depth 8. */ enum km_type { KM_TYPE_NR = 8 }; /* * We provide dummy definitions of all the stray values that used to be * required for kmap_atomic() and no longer are. */ enum { KM_BOUNCE_READ, KM_SKB_SUNRPC_DATA, KM_SKB_DATA_SOFTIRQ, KM_USER0, KM_USER1, KM_BIO_SRC_IRQ, KM_BIO_DST_IRQ, KM_PTE0, KM_PTE1, KM_IRQ0, KM_IRQ1, KM_SOFTIRQ0, KM_SOFTIRQ1, KM_SYNC_ICACHE, KM_SYNC_DCACHE, KM_UML_USERCOPY, KM_IRQ_PTE, KM_NMI, KM_NMI_PTE, KM_KDB }; #endif /* _ASM_TILE_KMAP_TYPES_H */
#ifndef LINUX_CRASH_DUMP_H #define LINUX_CRASH_DUMP_H #ifdef CONFIG_CRASH_DUMP #include <linux/kexec.h> #include <linux/proc_fs.h> #include <linux/elf.h> #include <asm/pgtable.h> /* for pgprot_t */ #define ELFCORE_ADDR_MAX (-1ULL) #define ELFCORE_ADDR_ERR (-2ULL) extern unsigned long long elfcorehdr_addr; extern unsigned long long elfcorehdr_size; extern int __weak elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size); extern void __weak elfcorehdr_free(unsigned long long addr); extern ssize_t __weak elfcorehdr_read(char *buf, size_t count, u64 *ppos); extern ssize_t __weak elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos); extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma, unsigned long from, unsigned long pfn, unsigned long size, pgprot_t prot); extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, unsigned long, int); void vmcore_cleanup(void); /* Architecture code defines this if there are other possible ELF * machine types, e.g. on bi-arch capable hardware. */ #ifndef vmcore_elf_check_arch_cross #define vmcore_elf_check_arch_cross(x) 0 #endif /* * Architecture code can redefine this if there are any special checks * needed for 64-bit ELF vmcores. In case of 32-bit only architecture, * this can be set to zero. */ #ifndef vmcore_elf64_check_arch #define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) #endif /* * is_kdump_kernel() checks whether this kernel is booting after a panic of * previous kernel or not. This is determined by checking if previous kernel * has passed the elf core header address on command line. * * This is not just a test if CONFIG_CRASH_DUMP is enabled or not. It will * return 1 if CONFIG_CRASH_DUMP=y and if kernel is booting after a panic of * previous kernel. */ static inline int is_kdump_kernel(void) { return (elfcorehdr_addr != ELFCORE_ADDR_MAX) ? 1 : 0; } /* is_vmcore_usable() checks if the kernel is booting after a panic and * the vmcore region is usable. * * This makes use of the fact that due to alignment -2ULL is not * a valid pointer, much in the vain of IS_ERR(), except * dealing directly with an unsigned long long rather than a pointer. */ static inline int is_vmcore_usable(void) { return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0; } /* vmcore_unusable() marks the vmcore as unusable, * without disturbing the logic of is_kdump_kernel() */ static inline void vmcore_unusable(void) { if (is_kdump_kernel()) elfcorehdr_addr = ELFCORE_ADDR_ERR; } #define HAVE_OLDMEM_PFN_IS_RAM 1 extern int register_oldmem_pfn_is_ram(int (*fn)(unsigned long pfn)); extern void unregister_oldmem_pfn_is_ram(void); #else /* !CONFIG_CRASH_DUMP */ static inline int is_kdump_kernel(void) { return 0; } #endif /* CONFIG_CRASH_DUMP */ extern unsigned long saved_max_pfn; #endif /* LINUX_CRASHDUMP_H */
#ifndef _PKEYS_HELPER_H #define _PKEYS_HELPER_H #define _GNU_SOURCE #include <string.h> #include <stdarg.h> #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <signal.h> #include <assert.h> #include <stdlib.h> #include <ucontext.h> #include <sys/mman.h> #define NR_PKEYS 16 #define PKRU_BITS_PER_PKEY 2 #ifndef DEBUG_LEVEL #define DEBUG_LEVEL 0 #endif #define DPRINT_IN_SIGNAL_BUF_SIZE 4096 extern int dprint_in_signal; extern char dprint_in_signal_buffer[DPRINT_IN_SIGNAL_BUF_SIZE]; static inline void sigsafe_printf(const char *format, ...) { va_list ap; va_start(ap, format); if (!dprint_in_signal) { vprintf(format, ap); } else { int len = vsnprintf(dprint_in_signal_buffer, DPRINT_IN_SIGNAL_BUF_SIZE, format, ap); /* * len is amount that would have been printed, * but actual write is truncated at BUF_SIZE. */ if (len > DPRINT_IN_SIGNAL_BUF_SIZE) len = DPRINT_IN_SIGNAL_BUF_SIZE; write(1, dprint_in_signal_buffer, len); } va_end(ap); } #define dprintf_level(level, args...) do { \ if (level <= DEBUG_LEVEL) \ sigsafe_printf(args); \ fflush(NULL); \ } while (0) #define dprintf0(args...) dprintf_level(0, args) #define dprintf1(args...) dprintf_level(1, args) #define dprintf2(args...) dprintf_level(2, args) #define dprintf3(args...) dprintf_level(3, args) #define dprintf4(args...) dprintf_level(4, args) extern unsigned int shadow_pkru; static inline unsigned int __rdpkru(void) { unsigned int eax, edx; unsigned int ecx = 0; unsigned int pkru; asm volatile(".byte 0x0f,0x01,0xee\n\t" : "=a" (eax), "=d" (edx) : "c" (ecx)); pkru = eax; return pkru; } static inline unsigned int _rdpkru(int line) { unsigned int pkru = __rdpkru(); dprintf4("rdpkru(line=%d) pkru: %x shadow: %x\n", line, pkru, shadow_pkru); assert(pkru == shadow_pkru); return pkru; } #define rdpkru() _rdpkru(__LINE__) static inline void __wrpkru(unsigned int pkru) { unsigned int eax = pkru; unsigned int ecx = 0; unsigned int edx = 0; dprintf4("%s() changing %08x to %08x\n", __func__, __rdpkru(), pkru); asm volatile(".byte 0x0f,0x01,0xef\n\t" : : "a" (eax), "c" (ecx), "d" (edx)); assert(pkru == __rdpkru()); } static inline void wrpkru(unsigned int pkru) { dprintf4("%s() changing %08x to %08x\n", __func__, __rdpkru(), pkru); /* will do the shadow check for us: */ rdpkru(); __wrpkru(pkru); shadow_pkru = pkru; dprintf4("%s(%08x) pkru: %08x\n", __func__, pkru, __rdpkru()); } /* * These are technically racy. since something could * change PKRU between the read and the write. */ static inline void __pkey_access_allow(int pkey, int do_allow) { unsigned int pkru = rdpkru(); int bit = pkey * 2; if (do_allow) pkru &= (1<<bit); else pkru |= (1<<bit); dprintf4("pkru now: %08x\n", rdpkru()); wrpkru(pkru); } static inline void __pkey_write_allow(int pkey, int do_allow_write) { long pkru = rdpkru(); int bit = pkey * 2 + 1; if (do_allow_write) pkru &= (1<<bit); else pkru |= (1<<bit); wrpkru(pkru); dprintf4("pkru now: %08x\n", rdpkru()); } #define PROT_PKEY0 0x10 /* protection key value (bit 0) */ #define PROT_PKEY1 0x20 /* protection key value (bit 1) */ #define PROT_PKEY2 0x40 /* protection key value (bit 2) */ #define PROT_PKEY3 0x80 /* protection key value (bit 3) */ #define PAGE_SIZE 4096 #define MB (1<<20) static inline void __cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { /* ecx is often an input as well as an output. */ asm volatile( "cpuid;" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (*eax), "2" (*ecx)); } /* Intel-defined CPU features, CPUID level 0x00000007:0 (ecx) */ #define X86_FEATURE_PKU (1<<3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (1<<4) /* OS Protection Keys Enable */ static inline int cpu_has_pku(void) { unsigned int eax; unsigned int ebx; unsigned int ecx; unsigned int edx; eax = 0x7; ecx = 0x0; __cpuid(&eax, &ebx, &ecx, &edx); if (!(ecx & X86_FEATURE_PKU)) { dprintf2("cpu does not have PKU\n"); return 0; } if (!(ecx & X86_FEATURE_OSPKE)) { dprintf2("cpu does not have OSPKE\n"); return 0; } return 1; } #define XSTATE_PKRU_BIT (9) #define XSTATE_PKRU 0x200 int pkru_xstate_offset(void) { unsigned int eax; unsigned int ebx; unsigned int ecx; unsigned int edx; int xstate_offset; int xstate_size; unsigned long XSTATE_CPUID = 0xd; int leaf; /* assume that XSTATE_PKRU is set in XCR0 */ leaf = XSTATE_PKRU_BIT; { eax = XSTATE_CPUID; ecx = leaf; __cpuid(&eax, &ebx, &ecx, &edx); if (leaf == XSTATE_PKRU_BIT) { xstate_offset = ebx; xstate_size = eax; } } if (xstate_size == 0) { printf("could not find size/offset of PKRU in xsave state\n"); return 0; } return xstate_offset; } #endif /* _PKEYS_HELPER_H */
// // Created by Jesse Squires // http://www.jessesquires.com // // // Documentation // http://cocoadocs.org/docsets/JSQMessagesViewController // // // GitHub // https://github.com/jessesquires/JSQMessagesViewController // // // License // Copyright (c) 2014 Jesse Squires // Released under an MIT license: http://opensource.org/licenses/MIT // #import <UIKit/UIKit.h> @interface UIView (JSQMessages) /** * Pins the subview of the receiver to the edge of its frame, as specified by the given attribute, by adding a layout constraint. * * @param subview The subview to which the receiver will be pinned. * @param attribute The layout constraint attribute specifying one of `NSLayoutAttributeBottom`, `NSLayoutAttributeTop`, `NSLayoutAttributeLeading`, `NSLayoutAttributeTrailing`. */ - (void)jsq_pinSubview:(UIView *)subview toEdge:(NSLayoutAttribute)attribute; /** * Pins all edges of the specified subview to the receiver. * * @param subview The subview to which the receiver will be pinned. */ - (void)jsq_pinAllEdgesOfSubview:(UIView *)subview; @end
/* * linux/fs/fifo.c * * written by Paul H. Hargrove * * Fixes: * 10-06-1999, AV: fixed OOM handling in fifo_open(), moved * initialization there, switched to external * allocation of pipe_inode_info. */ #include <linux/mm.h> #include <linux/fs.h> #include <linux/sched.h> #include <linux/pipe_fs_i.h> static int wait_for_partner(struct inode* inode, unsigned int *cnt) { int cur = *cnt; while (cur == *cnt) { pipe_wait(inode->i_pipe); if (signal_pending(current)) break; } return cur == *cnt ? -ERESTARTSYS : 0; } static void wake_up_partner(struct inode* inode) { wake_up_interruptible(&inode->i_pipe->wait); } static int fifo_open(struct inode *inode, struct file *filp) { struct pipe_inode_info *pipe; int ret; mutex_lock(&inode->i_mutex); pipe = inode->i_pipe; if (!pipe) { ret = -ENOMEM; pipe = alloc_pipe_info(inode); if (!pipe) goto err_nocleanup; inode->i_pipe = pipe; } filp->f_version = 0; /* We can only do regular read/write on fifos */ filp->f_mode &= (FMODE_READ | FMODE_WRITE); switch (filp->f_mode) { case FMODE_READ: /* * O_RDONLY * POSIX.1 says that O_NONBLOCK means return with the FIFO * opened, even when there is no process writing the FIFO. */ filp->f_op = &read_pipefifo_fops; pipe->r_counter++; if (pipe->readers++ == 0) wake_up_partner(inode); if (!pipe->writers) { if ((filp->f_flags & O_NONBLOCK)) { /* suppress POLLHUP until we have * seen a writer */ filp->f_version = pipe->w_counter; } else { if (wait_for_partner(inode, &pipe->w_counter)) goto err_rd; } } break; case FMODE_WRITE: /* * O_WRONLY * POSIX.1 says that O_NONBLOCK means return -1 with * errno=ENXIO when there is no process reading the FIFO. */ ret = -ENXIO; if ((filp->f_flags & O_NONBLOCK) && !pipe->readers) goto err; filp->f_op = &write_pipefifo_fops; pipe->w_counter++; if (!pipe->writers++) wake_up_partner(inode); if (!pipe->readers) { if (wait_for_partner(inode, &pipe->r_counter)) goto err_wr; } break; case FMODE_READ | FMODE_WRITE: /* * O_RDWR * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. * This implementation will NEVER block on a O_RDWR open, since * the process can at least talk to itself. */ filp->f_op = &rdwr_pipefifo_fops; pipe->readers++; pipe->writers++; pipe->r_counter++; pipe->w_counter++; if (pipe->readers == 1 || pipe->writers == 1) wake_up_partner(inode); break; default: ret = -EINVAL; goto err; } /* Ok! */ mutex_unlock(&inode->i_mutex); return 0; err_rd: if (!--pipe->readers) wake_up_interruptible(&pipe->wait); ret = -ERESTARTSYS; goto err; err_wr: if (!--pipe->writers) wake_up_interruptible(&pipe->wait); ret = -ERESTARTSYS; goto err; err: if (!pipe->readers && !pipe->writers) free_pipe_info(inode); err_nocleanup: mutex_unlock(&inode->i_mutex); return ret; } /* * Dummy default file-operations: the only thing this does * is contain the open that then fills in the correct operations * depending on the access mode of the file... */ const struct file_operations def_fifo_fops = { .open = fifo_open, /* will set read_ or write_pipefifo_fops */ .llseek = noop_llseek, };
/* * QFloat Module * * Copyright IBM, Corp. 2009 * * Authors: * Anthony Liguori <aliguori@us.ibm.com> * * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. * See the COPYING.LIB file in the top-level directory. * */ #ifndef QFLOAT_H #define QFLOAT_H #include <stdint.h> #include "qapi/qmp/qobject.h" typedef struct QFloat { QObject_HEAD; double value; } QFloat; QFloat *qfloat_from_double(double value); double qfloat_get_double(const QFloat *qi); QFloat *qobject_to_qfloat(const QObject *obj); #endif /* QFLOAT_H */
/* * Copyright (c) 2010-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program 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. */ #ifndef _CIPHER_H_ #define _CIPHER_H_ #include "common.h" #include "core.h" #define QCE_MAX_KEY_SIZE 64 struct qce_cipher_ctx { u8 enc_key[QCE_MAX_KEY_SIZE]; unsigned int enc_keylen; struct crypto_ablkcipher *fallback; }; /** * struct qce_cipher_reqctx - holds private cipher objects per request * @flags: operation flags * @iv: pointer to the IV * @ivsize: IV size * @src_nents: source entries * @dst_nents: destination entries * @src_chained: is source chained * @dst_chained: is destination chained * @result_sg: scatterlist used for result buffer * @dst_tbl: destination sg table * @dst_sg: destination sg pointer table beginning * @src_tbl: source sg table * @src_sg: source sg pointer table beginning; * @cryptlen: crypto length */ struct qce_cipher_reqctx { unsigned long flags; u8 *iv; unsigned int ivsize; int src_nents; int dst_nents; bool src_chained; bool dst_chained; struct scatterlist result_sg; struct sg_table dst_tbl; struct scatterlist *dst_sg; struct sg_table src_tbl; struct scatterlist *src_sg; unsigned int cryptlen; }; static inline struct qce_alg_template *to_cipher_tmpl(struct crypto_tfm *tfm) { struct crypto_alg *alg = tfm->__crt_alg; return container_of(alg, struct qce_alg_template, alg.crypto); } extern const struct qce_algo_ops ablkcipher_ops; #endif /* _CIPHER_H_ */
// SPDX-License-Identifier: GPL-2.0 /* * Shared Memory Communications over RDMA (SMC-R) and RoCE * * Generic netlink support functions to interact with SMC module * * Copyright IBM Corp. 2020 * * Author(s): Guvenc Gulce <guvenc@linux.ibm.com> */ #include <linux/module.h> #include <linux/list.h> #include <linux/ctype.h> #include <linux/mutex.h> #include <linux/if.h> #include <linux/smc.h> #include "smc_core.h" #include "smc_ism.h" #include "smc_ib.h" #include "smc_clc.h" #include "smc_stats.h" #include "smc_netlink.h" const struct nla_policy smc_gen_ueid_policy[SMC_NLA_EID_TABLE_MAX + 1] = { [SMC_NLA_EID_TABLE_UNSPEC] = { .type = NLA_UNSPEC }, [SMC_NLA_EID_TABLE_ENTRY] = { .type = NLA_STRING, .len = SMC_MAX_EID_LEN, }, }; #define SMC_CMD_MAX_ATTR 1 /* SMC_GENL generic netlink operation definition */ static const struct genl_ops smc_gen_nl_ops[] = { { .cmd = SMC_NETLINK_GET_SYS_INFO, /* can be retrieved by unprivileged users */ .dumpit = smc_nl_get_sys_info, }, { .cmd = SMC_NETLINK_GET_LGR_SMCR, /* can be retrieved by unprivileged users */ .dumpit = smcr_nl_get_lgr, }, { .cmd = SMC_NETLINK_GET_LINK_SMCR, /* can be retrieved by unprivileged users */ .dumpit = smcr_nl_get_link, }, { .cmd = SMC_NETLINK_GET_LGR_SMCD, /* can be retrieved by unprivileged users */ .dumpit = smcd_nl_get_lgr, }, { .cmd = SMC_NETLINK_GET_DEV_SMCD, /* can be retrieved by unprivileged users */ .dumpit = smcd_nl_get_device, }, { .cmd = SMC_NETLINK_GET_DEV_SMCR, /* can be retrieved by unprivileged users */ .dumpit = smcr_nl_get_device, }, { .cmd = SMC_NETLINK_GET_STATS, /* can be retrieved by unprivileged users */ .dumpit = smc_nl_get_stats, }, { .cmd = SMC_NETLINK_GET_FBACK_STATS, /* can be retrieved by unprivileged users */ .dumpit = smc_nl_get_fback_stats, }, { .cmd = SMC_NETLINK_DUMP_UEID, /* can be retrieved by unprivileged users */ .dumpit = smc_nl_dump_ueid, }, { .cmd = SMC_NETLINK_ADD_UEID, .flags = GENL_ADMIN_PERM, .doit = smc_nl_add_ueid, .policy = smc_gen_ueid_policy, }, { .cmd = SMC_NETLINK_REMOVE_UEID, .flags = GENL_ADMIN_PERM, .doit = smc_nl_remove_ueid, .policy = smc_gen_ueid_policy, }, { .cmd = SMC_NETLINK_FLUSH_UEID, .flags = GENL_ADMIN_PERM, .doit = smc_nl_flush_ueid, }, { .cmd = SMC_NETLINK_DUMP_SEID, /* can be retrieved by unprivileged users */ .dumpit = smc_nl_dump_seid, }, { .cmd = SMC_NETLINK_ENABLE_SEID, .flags = GENL_ADMIN_PERM, .doit = smc_nl_enable_seid, }, { .cmd = SMC_NETLINK_DISABLE_SEID, .flags = GENL_ADMIN_PERM, .doit = smc_nl_disable_seid, }, }; static const struct nla_policy smc_gen_nl_policy[2] = { [SMC_CMD_MAX_ATTR] = { .type = NLA_REJECT, }, }; /* SMC_GENL family definition */ struct genl_family smc_gen_nl_family __ro_after_init = { .hdrsize = 0, .name = SMC_GENL_FAMILY_NAME, .version = SMC_GENL_FAMILY_VERSION, .maxattr = SMC_CMD_MAX_ATTR, .policy = smc_gen_nl_policy, .netnsok = true, .module = THIS_MODULE, .ops = smc_gen_nl_ops, .n_ops = ARRAY_SIZE(smc_gen_nl_ops) }; int __init smc_nl_init(void) { return genl_register_family(&smc_gen_nl_family); } void smc_nl_exit(void) { genl_unregister_family(&smc_gen_nl_family); }
/* PCMCIA/Cardbus */ #include "qemu-common.h" typedef struct { qemu_irq irq; int attached; const char *slot_string; const char *card_string; } PCMCIASocket; void pcmcia_socket_register(PCMCIASocket *socket); void pcmcia_socket_unregister(PCMCIASocket *socket); void pcmcia_info(Monitor *mon); struct PCMCIACardState { void *state; PCMCIASocket *slot; int (*attach)(void *state); int (*detach)(void *state); const uint8_t *cis; int cis_len; /* Only valid if attached */ uint8_t (*attr_read)(void *state, uint32_t address); void (*attr_write)(void *state, uint32_t address, uint8_t value); uint16_t (*common_read)(void *state, uint32_t address); void (*common_write)(void *state, uint32_t address, uint16_t value); uint16_t (*io_read)(void *state, uint32_t address); void (*io_write)(void *state, uint32_t address, uint16_t value); }; #define CISTPL_DEVICE 0x01 /* 5V Device Information Tuple */ #define CISTPL_NO_LINK 0x14 /* No Link Tuple */ #define CISTPL_VERS_1 0x15 /* Level 1 Version Tuple */ #define CISTPL_JEDEC_C 0x18 /* JEDEC ID Tuple */ #define CISTPL_JEDEC_A 0x19 /* JEDEC ID Tuple */ #define CISTPL_CONFIG 0x1a /* Configuration Tuple */ #define CISTPL_CFTABLE_ENTRY 0x1b /* 16-bit PCCard Configuration */ #define CISTPL_DEVICE_OC 0x1c /* Additional Device Information */ #define CISTPL_DEVICE_OA 0x1d /* Additional Device Information */ #define CISTPL_DEVICE_GEO 0x1e /* Additional Device Information */ #define CISTPL_DEVICE_GEO_A 0x1f /* Additional Device Information */ #define CISTPL_MANFID 0x20 /* Manufacture ID Tuple */ #define CISTPL_FUNCID 0x21 /* Function ID Tuple */ #define CISTPL_FUNCE 0x22 /* Function Extension Tuple */ #define CISTPL_END 0xff /* Tuple End */ #define CISTPL_ENDMARK 0xff /* dscm1xxxx.c */ PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv);
/* * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program 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. * * * RMNET Data generic framework * */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/export.h> #include "rmnet_data_private.h" #include "rmnet_data_config.h" #include "rmnet_data_vnd.h" /* ***************** Trace Points ******************************************* */ #define CREATE_TRACE_POINTS #include "rmnet_data_trace.h" /* ***************** Module Parameters ************************************** */ unsigned int rmnet_data_log_level = RMNET_LOG_LVL_ERR | RMNET_LOG_LVL_HI; module_param(rmnet_data_log_level, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(log_level, "Logging level"); unsigned int rmnet_data_log_module_mask; module_param(rmnet_data_log_module_mask, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(rmnet_data_log_module_mask, "Logging module mask"); /* ***************** Startup/Shutdown *************************************** */ /** * rmnet_init() - Module initialization * * todo: check for (and init) startup errors */ static int __init rmnet_init(void) { rmnet_config_init(); rmnet_vnd_init(); LOGL("%s", "RMNET Data driver loaded successfully"); return 0; } static void __exit rmnet_exit(void) { rmnet_config_exit(); rmnet_vnd_exit(); } module_init(rmnet_init) module_exit(rmnet_exit) MODULE_LICENSE("GPL v2");
/* * Machine interface for the pinctrl subsystem. * * Copyright (C) 2011 ST-Ericsson SA * Written on behalf of Linaro for ST-Ericsson * Based on bits of regulator core, gpio core and clk core * * Author: Linus Walleij <linus.walleij@linaro.org> * * License terms: GNU General Public License (GPL) version 2 */ #ifndef __LINUX_PINCTRL_MACHINE_H #define __LINUX_PINCTRL_MACHINE_H #include <linux/bug.h> #include "pinctrl-state.h" enum pinctrl_map_type { PIN_MAP_TYPE_INVALID, PIN_MAP_TYPE_DUMMY_STATE, PIN_MAP_TYPE_MUX_GROUP, PIN_MAP_TYPE_CONFIGS_PIN, PIN_MAP_TYPE_CONFIGS_GROUP, }; /** * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP * @group: the name of the group whose mux function is to be configured. This * field may be left NULL, and the first applicable group for the function * will be used. * @function: the mux function to select for the group */ struct pinctrl_map_mux { const char *group; const char *function; }; /** * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_* * @group_or_pin: the name of the pin or group whose configuration parameters * are to be configured. * @configs: a pointer to an array of config parameters/values to program into * hardware. Each individual pin controller defines the format and meaning * of config parameters. * @num_configs: the number of entries in array @configs */ struct pinctrl_map_configs { const char *group_or_pin; unsigned long *configs; unsigned num_configs; }; /** * struct pinctrl_map - boards/machines shall provide this map for devices * @dev_name: the name of the device using this specific mapping, the name * must be the same as in your struct device*. If this name is set to the * same name as the pin controllers own dev_name(), the map entry will be * hogged by the driver itself upon registration * @name: the name of this specific map entry for the particular machine. * This is the parameter passed to pinmux_lookup_state() * @type: the type of mapping table entry * @ctrl_dev_name: the name of the device controlling this specific mapping, * the name must be the same as in your struct device*. This field is not * used for PIN_MAP_TYPE_DUMMY_STATE * @data: Data specific to the mapping type */ struct pinctrl_map { const char *dev_name; const char *name; enum pinctrl_map_type type; const char *ctrl_dev_name; union { struct pinctrl_map_mux mux; struct pinctrl_map_configs configs; } data; }; /* Convenience macros to create mapping table entries */ #define PIN_MAP_DUMMY_STATE(dev, state) \ { \ .dev_name = dev, \ .name = state, \ .type = PIN_MAP_TYPE_DUMMY_STATE, \ } #define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \ { \ .dev_name = dev, \ .name = state, \ .type = PIN_MAP_TYPE_MUX_GROUP, \ .ctrl_dev_name = pinctrl, \ .data.mux = { \ .group = grp, \ .function = func, \ }, \ } #define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \ PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func) #define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \ PIN_MAP_MUX_GROUP(dev, state, dev, grp, func) #define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \ PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func) #define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \ { \ .dev_name = dev, \ .name = state, \ .type = PIN_MAP_TYPE_CONFIGS_PIN, \ .ctrl_dev_name = pinctrl, \ .data.configs = { \ .group_or_pin = pin, \ .configs = cfgs, \ .num_configs = ARRAY_SIZE(cfgs), \ }, \ } #define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \ PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs) #define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \ PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs) #define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \ PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs) #define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \ { \ .dev_name = dev, \ .name = state, \ .type = PIN_MAP_TYPE_CONFIGS_GROUP, \ .ctrl_dev_name = pinctrl, \ .data.configs = { \ .group_or_pin = grp, \ .configs = cfgs, \ .num_configs = ARRAY_SIZE(cfgs), \ }, \ } #define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \ PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs) #define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \ PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs) #define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) #ifdef CONFIG_PINCTRL extern int pinctrl_register_mappings(struct pinctrl_map const *map, unsigned num_maps); extern void pinctrl_provide_dummies(void); #else static inline int pinctrl_register_mappings(struct pinctrl_map const *map, unsigned num_maps) { return 0; } static inline void pinctrl_provide_dummies(void) { } #endif /* !CONFIG_PINCTRL */ #endif
/* Copyright (c) 2011, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program 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. * */ #ifndef __ASM_ARCH_MSM_SERIAL_HS_LITE_H #define __ASM_ARCH_MSM_SERIAL_HS_LITE_H struct msm_serial_hslite_platform_data { unsigned config_gpio; unsigned uart_tx_gpio; unsigned uart_rx_gpio; int line; }; #endif
/* * include/linux/tegra_nvavp.h * * Copyright (C) 2011 NVIDIA Corp. * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */ #ifndef __LINUX_TEGRA_NVAVP_H #define __LINUX_TEGRA_NVAVP_H #include <linux/ioctl.h> #include <linux/types.h> #define NVAVP_MAX_RELOCATION_COUNT 64 /* avp submit flags */ #define NVAVP_FLAG_NONE 0x00000000 #define NVAVP_UCODE_EXT 0x00000001 /*use external ucode provided */ enum { NVAVP_MODULE_ID_AVP = 2, NVAVP_MODULE_ID_VCP = 3, NVAVP_MODULE_ID_BSEA = 27, NVAVP_MODULE_ID_VDE = 28, NVAVP_MODULE_ID_MPE = 29, NVAVP_MODULE_ID_EMC = 75, }; struct nvavp_cmdbuf { __u32 mem; __u32 offset; __u32 words; }; struct nvavp_reloc { __u32 cmdbuf_mem; __u32 cmdbuf_offset; __u32 target; __u32 target_offset; }; struct nvavp_syncpt { __u32 id; __u32 value; }; struct nvavp_pushbuffer_submit_hdr { struct nvavp_cmdbuf cmdbuf; struct nvavp_reloc *relocs; __u32 num_relocs; struct nvavp_syncpt *syncpt; __u32 flags; }; struct nvavp_set_nvmap_fd_args { __u32 fd; }; struct nvavp_clock_args { __u32 id; __u32 rate; }; enum nvavp_clock_stay_on_state { NVAVP_CLOCK_STAY_ON_DISABLED = 0, NVAVP_CLOCK_STAY_ON_ENABLED }; struct nvavp_clock_stay_on_state_args { enum nvavp_clock_stay_on_state state; }; #define NVAVP_IOCTL_MAGIC 'n' #define NVAVP_IOCTL_SET_NVMAP_FD _IOW(NVAVP_IOCTL_MAGIC, 0x60, \ struct nvavp_set_nvmap_fd_args) #define NVAVP_IOCTL_GET_SYNCPOINT_ID _IOR(NVAVP_IOCTL_MAGIC, 0x61, \ __u32) #define NVAVP_IOCTL_PUSH_BUFFER_SUBMIT _IOWR(NVAVP_IOCTL_MAGIC, 0x63, \ struct nvavp_pushbuffer_submit_hdr) #define NVAVP_IOCTL_SET_CLOCK _IOWR(NVAVP_IOCTL_MAGIC, 0x64, \ struct nvavp_clock_args) #define NVAVP_IOCTL_GET_CLOCK _IOR(NVAVP_IOCTL_MAGIC, 0x65, \ struct nvavp_clock_args) #define NVAVP_IOCTL_WAKE_AVP _IOR(NVAVP_IOCTL_MAGIC, 0x66, \ __u32) #define NVAVP_IOCTL_FORCE_CLOCK_STAY_ON _IOW(NVAVP_IOCTL_MAGIC, 0x67, \ struct nvavp_clock_stay_on_state_args) #define NVAVP_IOCTL_MIN_NR _IOC_NR(NVAVP_IOCTL_SET_NVMAP_FD) #define NVAVP_IOCTL_MAX_NR _IOC_NR(NVAVP_IOCTL_FORCE_CLOCK_STAY_ON) #endif /* __LINUX_TEGRA_NVAVP_H */
/* * stmp378x: USBCTRL register definitions * * Copyright (c) 2008 Freescale Semiconductor * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. * * This program 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. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define REGS_USBCTRL_BASE (STMP3XXX_REGS_BASE + 0x80000) #define REGS_USBCTRL_PHYS 0x80080000 #define REGS_USBCTRL_SIZE 0x2000 #define HW_USBCTRL_USBCMD 0x140 #define BM_USBCTRL_USBCMD_RS 0x00000001 #define BP_USBCTRL_USBCMD_RS 0 #define BM_USBCTRL_USBCMD_RST 0x00000002 #define HW_USBCTRL_USBINTR 0x148 #define BM_USBCTRL_USBINTR_UE 0x00000001 #define BP_USBCTRL_USBINTR_UE 0 #define HW_USBCTRL_PORTSC1 0x184 #define BM_USBCTRL_PORTSC1_PHCD 0x00800000 #define HW_USBCTRL_OTGSC 0x1A4 #define BM_USBCTRL_OTGSC_ID 0x00000100 #define BM_USBCTRL_OTGSC_IDIS 0x00010000 #define BM_USBCTRL_OTGSC_IDIE 0x01000000
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __RAS_DEBUGFS_H__ #define __RAS_DEBUGFS_H__ #include <linux/debugfs.h> extern struct dentry *ras_debugfs_dir; #endif /* __RAS_DEBUGFS_H__ */
/* Fallback per-CPU frame pointer holder * * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * * This program 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. */ #ifndef _ASM_GENERIC_IRQ_REGS_H #define _ASM_GENERIC_IRQ_REGS_H #include <linux/percpu.h> /* * Per-cpu current frame pointer - the location of the last exception frame on * the stack */ DECLARE_PER_CPU(struct pt_regs *, __irq_regs); static inline struct pt_regs *get_irq_regs(void) { return __this_cpu_read(__irq_regs); } static inline struct pt_regs *set_irq_regs(struct pt_regs *new_regs) { struct pt_regs *old_regs; old_regs = __this_cpu_read(__irq_regs); __this_cpu_write(__irq_regs, new_regs); return old_regs; } #endif /* _ASM_GENERIC_IRQ_REGS_H */
#ifndef __LINUX_SPINLOCK_API_SMP_H #define __LINUX_SPINLOCK_API_SMP_H #ifndef __LINUX_SPINLOCK_H # error "please don't include this file directly" #endif /* * include/linux/spinlock_api_smp.h * * spinlock API declarations on SMP (and debug) * (implemented in kernel/spinlock.c) * * portions Copyright 2005, Red Hat, Inc., Ingo Molnar * Released under the General Public License (GPL). */ int in_lock_functions(unsigned long addr); #define assert_raw_spin_locked(x) BUG_ON(!raw_spin_is_locked(x)) void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock); void __lockfunc _raw_spin_lock_nested(raw_spinlock_t *lock, int subclass) __acquires(lock); void __lockfunc _raw_spin_lock_nest_lock(raw_spinlock_t *lock, struct lockdep_map *map) __acquires(lock); void __lockfunc _raw_spin_lock_bh(raw_spinlock_t *lock) __acquires(lock); void __lockfunc _raw_spin_lock_irq(raw_spinlock_t *lock) __acquires(lock); unsigned long __lockfunc _raw_spin_lock_irqsave(raw_spinlock_t *lock) __acquires(lock); unsigned long __lockfunc _raw_spin_lock_irqsave_nested(raw_spinlock_t *lock, int subclass) __acquires(lock); int __lockfunc _raw_spin_trylock(raw_spinlock_t *lock); int __lockfunc _raw_spin_trylock_bh(raw_spinlock_t *lock); void __lockfunc _raw_spin_unlock(raw_spinlock_t *lock) __releases(lock); void __lockfunc _raw_spin_unlock_bh(raw_spinlock_t *lock) __releases(lock); void __lockfunc _raw_spin_unlock_irq(raw_spinlock_t *lock) __releases(lock); void __lockfunc _raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) __releases(lock); #ifdef CONFIG_INLINE_SPIN_LOCK #define _raw_spin_lock(lock) __raw_spin_lock(lock) #endif #ifdef CONFIG_INLINE_SPIN_LOCK_BH #define _raw_spin_lock_bh(lock) __raw_spin_lock_bh(lock) #endif #ifdef CONFIG_INLINE_SPIN_LOCK_IRQ #define _raw_spin_lock_irq(lock) __raw_spin_lock_irq(lock) #endif #ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE #define _raw_spin_lock_irqsave(lock) __raw_spin_lock_irqsave(lock) #endif #ifdef CONFIG_INLINE_SPIN_TRYLOCK #define _raw_spin_trylock(lock) __raw_spin_trylock(lock) #endif #ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH #define _raw_spin_trylock_bh(lock) __raw_spin_trylock_bh(lock) #endif #ifndef CONFIG_UNINLINE_SPIN_UNLOCK #define _raw_spin_unlock(lock) __raw_spin_unlock(lock) #endif #ifdef CONFIG_INLINE_SPIN_UNLOCK_BH #define _raw_spin_unlock_bh(lock) __raw_spin_unlock_bh(lock) #endif #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ #define _raw_spin_unlock_irq(lock) __raw_spin_unlock_irq(lock) #endif #ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE #define _raw_spin_unlock_irqrestore(lock, flags) __raw_spin_unlock_irqrestore(lock, flags) #endif static inline int __raw_spin_trylock(raw_spinlock_t *lock) { preempt_disable(); if (do_raw_spin_trylock(lock)) { spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); return 1; } preempt_enable(); return 0; } /* * If lockdep is enabled then we use the non-preemption spin-ops * even on CONFIG_PREEMPTION, because lockdep assumes that interrupts are * not re-enabled during lock-acquire (which the preempt-spin-ops do): */ #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) static inline unsigned long __raw_spin_lock_irqsave(raw_spinlock_t *lock) { unsigned long flags; local_irq_save(flags); preempt_disable(); spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); return flags; } static inline void __raw_spin_lock_irq(raw_spinlock_t *lock) { local_irq_disable(); preempt_disable(); spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); } static inline void __raw_spin_lock_bh(raw_spinlock_t *lock) { __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); } static inline void __raw_spin_lock(raw_spinlock_t *lock) { preempt_disable(); spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); } #endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */ static inline void __raw_spin_unlock(raw_spinlock_t *lock) { spin_release(&lock->dep_map, _RET_IP_); do_raw_spin_unlock(lock); preempt_enable(); } static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock, unsigned long flags) { spin_release(&lock->dep_map, _RET_IP_); do_raw_spin_unlock(lock); local_irq_restore(flags); preempt_enable(); } static inline void __raw_spin_unlock_irq(raw_spinlock_t *lock) { spin_release(&lock->dep_map, _RET_IP_); do_raw_spin_unlock(lock); local_irq_enable(); preempt_enable(); } static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock) { spin_release(&lock->dep_map, _RET_IP_); do_raw_spin_unlock(lock); __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); } static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock) { __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); if (do_raw_spin_trylock(lock)) { spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); return 1; } __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET); return 0; } /* PREEMPT_RT has its own rwlock implementation */ #ifndef CONFIG_PREEMPT_RT #include <linux/rwlock_api_smp.h> #endif #endif /* __LINUX_SPINLOCK_API_SMP_H */
#ifndef _ASM_X86_PVCLOCK_ABI_H #define _ASM_X86_PVCLOCK_ABI_H #ifndef __ASSEMBLY__ /* * These structs MUST NOT be changed. * They are the ABI between hypervisor and guest OS. * Both Xen and KVM are using this. * * pvclock_vcpu_time_info holds the system time and the tsc timestamp * of the last update. So the guest can use the tsc delta to get a * more precise system time. There is one per virtual cpu. * * pvclock_wall_clock references the point in time when the system * time was zero (usually boot time), thus the guest calculates the * current wall clock by adding the system time. * * Protocol for the "version" fields is: hypervisor raises it (making * it uneven) before it starts updating the fields and raises it again * (making it even) when it is done. Thus the guest can make sure the * time values it got are consistent by checking the version before * and after reading them. */ struct pvclock_vcpu_time_info { u32 version; u32 pad0; u64 tsc_timestamp; u64 system_time; u32 tsc_to_system_mul; s8 tsc_shift; u8 pad[3]; } __attribute__((__packed__)); /* 32 bytes */ struct pvclock_wall_clock { u32 version; u32 sec; u32 nsec; } __attribute__((__packed__)); #endif /* __ASSEMBLY__ */ #endif /* _ASM_X86_PVCLOCK_ABI_H */
struct lm_device { struct device dev; struct resource resource; unsigned int irq; unsigned int id; }; struct lm_driver { struct device_driver drv; int (*probe)(struct lm_device *); void (*remove)(struct lm_device *); int (*suspend)(struct lm_device *, pm_message_t); int (*resume)(struct lm_device *); }; int lm_driver_register(struct lm_driver *drv); void lm_driver_unregister(struct lm_driver *drv); int lm_device_register(struct lm_device *dev); #define lm_get_drvdata(lm) dev_get_drvdata(&(lm)->dev) #define lm_set_drvdata(lm,d) dev_set_drvdata(&(lm)->dev, d)
#ifndef InvDistWeight_H #define InvDistWeight_H #include <ionMath/ionMath.h> #include <map> class InvDistWeight { public: static float interpolate(std::map<vec3f, float> const &known, vec3f const &position, int power); static float weight(vec3f const &x, vec3f const &x_i, int power); }; #endif
#ifndef __FSELECT_H #define __FSELECT_H #include <memory> /*! * \brief fselectが所属するnamespace */ namespace wl { class fselect_private; /*! * \brief select(2)のwrapperクラス * * select(2)を呼び出すためのwrapperクラスです。 * * read_watch()/write_watch()/except_watch()で監視するfdを登録した後、 * select()で無限待ちに入ります。 * select()は、監視対象のfile descriptorが指定した状態になったときに戻ります。 * select()の終了後、read_isready()/write_isready()/except_isready() * の呼び出しにより、fdの状態を調べることができます。 * * select()の呼び出し中に中断したい場合は、別スレッドからstop()を呼び出します。 * このとき、select()の引数にstop()呼び出しによって中断したことが返ります。 * * select(2)と違い、select()の呼び出しによって監視対象は変化しません。 * このため、select()の完了後、再度select()を呼び出すと、同じ監視対象を * 再度監視します。 * 監視をやめる場合は、read_unwatch()/write_unwatch()/except_unwatch()を呼び出します。 * * 一般的な使い方は、IOスレッドによりselect()を呼び出し、UIスレッド等の * 別スレッドからstop()を呼び出すことを想定しています。 * * 以下の場合の動作は保証されません。 * * select()実行中にwatch/unwatchで監視対象を変更したとき * * select()を複数スレッドから同時に実行したとき * * 監視対象のfile descriptorをclose()したとき */ class fselect { public: /*! * \brief コンストラクタ */ fselect(); /*! * \brief デストラクタ */ virtual ~fselect(); /*! * \brief オブジェクトが有効かどうかを返す。 * @return 有効なときtrue */ bool is_valid() const; /*! * \brief select(2)を実行する。 * @param is_stop [OUT] stop()の呼び出しにより終了するときtrue * @return select(2)の返値 */ int select(bool &is_stop); /*! * \brief selectの実行を中断する。 */ void stop(); /*! * \brief read監視をやめる(FD_CLR相当) * @param fd 監視をやめるfile descriptor。省略すると全ての監視をやめる。 */ void read_unwatch(int fd = -1); /*! * \brief read監視しているかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return read監視対象のときtrue */ bool read_iswatch(int fd) const; /*! * \brief read可能になったかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return read可能なときtrue */ bool read_isready(int fd) const; /*! * \brief read可能になったかどうかを監視する(FD_SET相当) * @param fd 監視するfile descriptor */ void read_watch(int fd); /*! * \brief write監視をやめる(FD_CLR相当) * @param fd 監視をやめるfile descriptor。省略すると全ての監視をやめる。 */ void write_unwatch(int fd = -1); /*! * \brief write監視しているかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return write監視対象のときtrue */ bool write_iswatch(int fd) const; /*! * \brief write可能になったかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return write可能なときtrue */ bool write_isready(int fd) const; /*! * \brief write可能になったかどうかを監視する(FD_SET相当) * @param fd 監視するfile descriptor */ void write_watch(int fd); /*! * \brief except監視をやめる(FD_CLR相当) * @param fd 監視をやめるfile descriptor。省略すると全ての監視をやめる。 */ void except_unwatch(int fd = -1); /*! * \brief except監視しているかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return except監視対象のときtrue */ bool except_iswatch(int fd) const; /*! * \brief except が発生したかどうかを返す(FD_ISSET相当) * @param fd 調べるfile descriptor * @return exceptが発生したときtrue */ bool except_isready(int fd) const; /*! * \brief exceptが発生したかどうかを監視する(FD_SET相当) * @param fd 監視するfile descriptor */ void except_watch(int fd); private: std::unique_ptr<fselect_private> d; fselect(fselect const&) = delete; fselect& operator=(fselect const&) = delete; fselect(fselect &&) = delete; fselect& operator=(fselect &&) = delete; }; } #endif /* __FSELECT_H */
/* $OpenBSD: pcib.c,v 1.6 2013/05/30 16:15:01 deraadt Exp $ */ /* $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <machine/bus.h> #include <dev/isa/isavar.h> #include <dev/pci/pcivar.h> #include <dev/pci/pcireg.h> #include <dev/pci/pcidevs.h> #include "isa.h" int pcibmatch(struct device *, void *, void *); void pcibattach(struct device *, struct device *, void *); void pcib_callback(struct device *); int pcib_print(void *, const char *); struct cfattach pcib_ca = { sizeof(struct device), pcibmatch, pcibattach }; struct cfdriver pcib_cd = { NULL, "pcib", DV_DULL }; int pcibmatch(struct device *parent, void *match, void *aux) { struct pci_attach_args *pa = aux; switch (PCI_VENDOR(pa->pa_id)) { case PCI_VENDOR_INTEL: switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_INTEL_SIO: case PCI_PRODUCT_INTEL_82371MX: case PCI_PRODUCT_INTEL_82371AB_ISA: case PCI_PRODUCT_INTEL_82440MX_ISA: /* The above bridges mis-identify themselves */ return (1); } break; case PCI_VENDOR_SIS: switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_SIS_85C503: /* mis-identifies itself as a miscellaneous prehistoric */ return (1); } break; case PCI_VENDOR_VIATECH: switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_VIATECH_VT82C686A_SMB: /* mis-identifies itself as a ISA bridge */ return (0); } break; } if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE && PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_ISA) return (1); return (0); } void pcibattach(struct device *parent, struct device *self, void *aux) { /* * Cannot attach isa bus now; must postpone for various reasons */ printf("\n"); config_defer(self, pcib_callback); } void pcib_callback(struct device *self) { struct isabus_attach_args iba; /* * Attach the ISA bus behind this bridge. */ memset(&iba, 0, sizeof(iba)); iba.iba_busname = "isa"; iba.iba_iot = X86_BUS_SPACE_IO; iba.iba_memt = X86_BUS_SPACE_MEM; #if NISADMA > 0 iba.iba_dmat = &isa_bus_dma_tag; #endif config_found(self, &iba, pcib_print); } int pcib_print(void *aux, const char *pnp) { /* Only ISAs can attach to pcib's; easy. */ if (pnp) printf("isa at %s", pnp); return (UNCONF); }
/* See LICENSE file for copyright and license details. */ #include <errno.h> #include <dirent.h> #include <stdio.h> #include <string.h> #include "../util.h" const char * num_files(const char *dir) { struct dirent *dp; DIR *fd; int num = 0; if ((fd = opendir(dir)) == NULL) { fprintf(stderr, "opendir '%s': %s\n", dir, strerror(errno)); return NULL; } while ((dp = readdir(fd)) != NULL) { if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue; /* skip self and parent */ num++; } closedir(fd); return bprintf("%d", num); }
/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "quad.h" /* * Return remainder after dividing two unsigned quads. */ u_quad_t __umoddi3(u_quad_t a, u_quad_t b) { u_quad_t r; (void)__qdivrem(a, b, &r); return (r); }
#pragma once #include <iostream> #include <glm.hpp> #include <SDL.h> #include "Shader.h" /** @brief A class for the UI Objects. @author Jamie Slowgrove */ class UIObject { private: /**The VBO for the rectangle*/ GLuint obj; /**The dimensions for the rectangle*/ glm::vec2 dimensions; /**The position for the UIObject*/ glm::vec2 position; /**The Texture*/ GLuint textureID; /**A boolean for if the Model contains a texture*/ bool textureBool; /** Initialise the UIobject. */ void initialiseObject(); /** Initialise the UIobject. @param surface A pointer to the surface for the texture. */ void initialiseObject(SDL_Surface* surface); /** Initialise the texture. @param surface A pointer to the surface for the texture. */ void initialiseTexture(SDL_Surface* surfac); /** Converts the coordinates to work with OpenGL. It takes the coordinates and converts them to a number between 0 and 2. It then takes this and -1 from each, setting it to the bottom left position. It then flips the coordinate along the y axis to get the top left position. @param coordinates The coordinates to convert. @returns The converted coordinates. */ glm::vec2 convertToOpenGLCoordinate(glm::vec2 coordinates); public: /** Constructs the UIObject. @param x The x position (Top left of the object). @param y The y position (Top left of the object). @param width The width (Between 0 and 200). @param height The height (Between 0 and 200). */ UIObject(float x, float y, float width, float height); /** Constructs the UIObject. @param x The x position (Top left of the object). @param y The y position (Top left of the object). @param width The width (Between 0 and 200). @param height The height (Between 0 and 200). @param surface A pointer to the surface for the texture. */ UIObject(float x, float y, float width, float height, SDL_Surface* surface); /** Destructs the UIObject. */ ~UIObject(); /** A function to draw to the screen. @param shader A pointer to the Shader to use. */ void draw(Shader * shader); };
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import "NSObject.h" @class NSLock, SUScriptObject; @interface SUScriptNativeObject : NSObject { NSLock *_lock; id _nativeObject; SUScriptObject *_scriptObject; _Bool _weak; } + (id)objectWithNativeObject:(id)arg1; + (void)makeReferencesToObjectWeak:(id)arg1; + (void)clearWeakReferencesToObject:(id)arg1; - (void)_nativeObjectBecameWeakNotification:(id)arg1; - (void)unlock; - (void)setupNativeObject; @property SUScriptObject *scriptObject; @property(nonatomic) id object; - (void)lock; - (void)destroyNativeObject; - (void)dealloc; - (id)init; @end
// // UIButton+YCYImagePosition.h // // Created by ycy on 16/1/15. // Copyright © 2016年 NULLS. All rights reserved. // // 用button的titleEdgeInsets和 imageEdgeInsets属性来实现button文字图片上下或者左右排列的 #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger, YCYImagePosition) { YCYImagePositionLeft = 0, //图片在左,文字在右,默认 YCYImagePositionRight = 1, //图片在右,文字在左 YCYImagePositionTop = 2, //图片在上,文字在下 YCYImagePositionBottom = 3, //图片在下,文字在上 }; @interface UIButton (YCYImagePosition) /** * 利用UIButton的titleEdgeInsets和imageEdgeInsets来实现文字和图片的自由排列 * 注意:这个方法需要在设置图片和文字之后才可以调用,且button的大小要大于 图片大小+文字大小+spacing * * @param spacing 图片和文字的间隔 */ - (void)ycy_setImagePosition:(YCYImagePosition)postion spacing:(CGFloat)spacing; @end
#pragma once #ifndef TARGET_OPENGLES /* todo: add support for attachment of multiple shaders if a uniform or attribute isn't available, this will cause an error make sure to catch and report that error. */ #include "ofConstants.h" #include "ofBaseTypes.h" #include "ofTexture.h" #include <map> class ofShader { public: ofShader(); ~ofShader(); bool load(string shaderName); bool load(string vertName, string fragName, string geomName=""); // these are essential to call before linking the program with geometry shaders void setGeometryInputType(GLenum type); // type: GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_EXT, GL_TRIANGLES, GL_TRIANGLES_ADJACENCY_EXT void setGeometryOutputType(GLenum type); // type: GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP void setGeometryOutputCount(int count); // set number of output vertices int getGeometryMaxOutputCount(); // returns maximum number of supported vertices void unload(); void begin(); void end(); // set a texture reference void setUniformTexture(const char* name, ofBaseHasTexture& img, int textureLocation); void setUniformTexture(const char* name, ofTexture& img, int textureLocation); // set a single uniform value void setUniform1i(const char* name, int v1); void setUniform2i(const char* name, int v1, int v2); void setUniform3i(const char* name, int v1, int v2, int v3); void setUniform4i(const char* name, int v1, int v2, int v3, int v4); void setUniform1f(const char* name, float v1); void setUniform2f(const char* name, float v1, float v2); void setUniform3f(const char* name, float v1, float v2, float v3); void setUniform4f(const char* name, float v1, float v2, float v3, float v4); // set an array of uniform values void setUniform1iv(const char* name, int* v, int count = 1); void setUniform2iv(const char* name, int* v, int count = 1); void setUniform3iv(const char* name, int* v, int count = 1); void setUniform4iv(const char* name, int* v, int count = 1); void setUniform1fv(const char* name, float* v, int count = 1); void setUniform2fv(const char* name, float* v, int count = 1); void setUniform3fv(const char* name, float* v, int count = 1); void setUniform4fv(const char* name, float* v, int count = 1); // set attributes that vary per vertex (look up the location before glBegin) GLint getAttributeLocation(const char* name); void setAttribute1s(GLint location, short v1); void setAttribute2s(GLint location, short v1, short v2); void setAttribute3s(GLint location, short v1, short v2, short v3); void setAttribute4s(GLint location, short v1, short v2, short v3, short v4); void setAttribute1f(GLint location, float v1); void setAttribute2f(GLint location, float v1, float v2); void setAttribute3f(GLint location, float v1, float v2, float v3); void setAttribute4f(GLint location, float v1, float v2, float v3, float v4); void setAttribute1d(GLint location, double v1); void setAttribute2d(GLint location, double v1, double v2); void setAttribute3d(GLint location, double v1, double v2, double v3); void setAttribute4d(GLint location, double v1, double v2, double v3, double v4); void printActiveUniforms(); void printActiveAttributes(); // advanced use // these methods create and compile a shader from source or file // type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, GL_GEOMETRY_SHADER_EXT etc. bool setupShaderFromSource(GLenum type, string source); bool setupShaderFromFile(GLenum type, string filename); // links program with all compiled shaders bool linkProgram(); GLuint& getProgram(); GLuint& getShader(GLenum type); private: GLuint program; map<GLenum, GLuint> shaders; GLint getUniformLocation(const char* name); void checkProgramInfoLog(GLuint program); bool checkShaderLinkStatus(GLuint shader, GLenum type); void checkShaderInfoLog(GLuint shader, GLenum type); static string nameForType(GLenum type); void checkAndCreateProgram(); bool bLoaded; }; #endif
/* Header to define new/delete operators as they aren't provided by avr-gcc by default Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 */ #ifndef NEW_H #define NEW_H #include <stdlib.h> void * operator new(size_t size); void operator delete(void * ptr); void * operator new[](size_t size); void operator delete[](void * ptr); #if defined(__CC_ARM) typedef int __guard; #else __extension__ typedef int __guard __attribute__((mode (__DI__))); #endif extern "C" int __cxa_guard_acquire(__guard *); extern "C" void __cxa_guard_release (__guard *); extern "C" void __cxa_guard_abort (__guard *); extern "C" void __cxa_pure_virtual(void); #endif
/*!The Treasure Box Library * * TBox 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.1 of the License, or * (at your option) any later version. * * TBox 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 TBox; * If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> * * Copyright (C) 2009 - 2015, ruki All rights reserved. * * @author ruki * @file page.c * */ /* ////////////////////////////////////////////////////////////////////////////////////// * includes */ #include "prefix.h" #include "../platform.h" #include <unistd.h> /* ////////////////////////////////////////////////////////////////////////////////////// * globals */ // the page size static tb_size_t g_page_size = 0; /* ////////////////////////////////////////////////////////////////////////////////////// * implementation */ tb_bool_t tb_page_init() { // init page size if (!g_page_size) { #if _BSD_SOURCE || !(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) g_page_size = (tb_size_t)getpagesize(); #else g_page_size = (tb_size_t)sysconf(_SC_PAGESIZE); #endif } // ok? return g_page_size? tb_true : tb_false; } tb_void_t tb_page_exit() { } tb_size_t tb_page_size() { return g_page_size; }
#ifndef IRESOURCEMODEL_H #define IRESOURCEMODEL_H #include "engine_global.h" #include "multilanguagestring.h" #include <QObject> #include <QList> namespace BrowserAutomationStudioFramework { class ENGINESHARED_EXPORT IResourceModel : public QObject { Q_OBJECT public: explicit IResourceModel(QObject *parent = 0); signals: public slots: virtual QString GetTypeId() = 0; virtual QString GetName() = 0; virtual void SetName(const QString& Name) = 0; virtual MultiLanguageString GetDescription() = 0; virtual void SetDescription(const MultiLanguageString& Description) = 0; virtual bool GetVisibleByUser() = 0; virtual void SetVisibleByUser(bool visible) = 0; virtual bool GetEnabledByUser() = 0; virtual void SetEnabledByUser(bool enabled) = 0; virtual MultiLanguageString GetSectionName() = 0; virtual void SetSectionName(const MultiLanguageString& SectionName) = 0; virtual QString GetVisibilityConditionVariable() = 0; virtual void SetVisibilityConditionVariable(const QString& VisibilityConditionVariable) = 0; virtual QString GetVisibilityConditionValue() = 0; virtual void SetVisibilityConditionValue(const QString& VisibilityConditionValue) = 0; virtual QString GetAllowedTypes() = 0; virtual void SetAllowedTypes(const QString& Types) = 0; virtual QList<IResourceModel*> GetDefaults() = 0; virtual void SetDefaults(QList<IResourceModel*>& Defaults) = 0; virtual bool GetIsAdvanced() = 0; virtual void SetIsAdvanced(bool IsAdvanced) = 0; }; } #endif // IRESOURCEMODEL_H
#ifndef SPT_EXCEPTION_H #define SPT_EXCEPTION_H #include "stdafx.h" namespace SPTracer { class Exception : public std::runtime_error { public: explicit Exception(const char* msg) : std::runtime_error(msg) { }; explicit Exception(std::string msg) : std::runtime_error(msg.c_str()) { }; }; } #endif
#include "os.h" #include "http5.h" static int handleall(void **statep, Http5message *output, Http5message *input) { int state; state = *(int*)statep; switch(state){ case 0: if(input->state == HTTP5_DONE){ if(http5ok(output) == -1) return -1; if(http5putheader(output, "content-type", "text/plain") == -1) return -1; char *body = "hello world\n"; if(http5putbody(output, body, strlen(body)) == -1) return -1; http5clear(input); http5write(output); *statep = (void *)1; } break; case 1: if(output->state == HTTP5_DONE){ http5clear(output); *statep = (void *)0; } break; } return 0; } static int handleget(void **statep, Http5message *output, Http5message *input) { int state; state = *(int*)statep; switch(state){ case 0: fprintf(stderr, "handleget: instate: %d outstate: %d\n", input->state, output->state); if(output->state == HTTP5_READY){ Http5buf *outbuf = &output->buf; http5putline(output, "GET", "/", "HTTP/1.1"); if(http5putheader(output, "Host", "www.google.com") == -1) return -1; if(http5putbody(output, "", 0) == -1) return -1; http5write(output); http5read(input); fprintf(stderr, "request:%.*s--\n", (int)outbuf->len, outbuf->buf); *statep = (void *)1; } break; case 1: if(output->state == HTTP5_DONE && input->state == HTTP5_DONE){ Http5buf *inbuf = &input->buf; fprintf(stderr, "handleget: chunk size %zd\n", input->body.len); input->state = HTTP5_PARSE_CHUNK; if(input->body.len == 0){ http5close(output); } } break; } return 0; } int main(int argc, char *argv[]) { int port = 5555; #ifdef _WIN32 WSADATA wsadata; if(WSAStartup(MAKEWORD(2,2), &wsadata) != 0){ fprintf(stderr, "winsock initialization failed\n"); exit(1); } #endif if(argc > 1) port = strtol(argv[1], NULL, 10); http5connect("2607:f8b0:4005:806::200e", 80, 1<<16, 1<<16, handleget); return http5server(port, 8192, 8192, handleall); }
//############ OLED DEFINES: #################### #define OLED_RESET 33 #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 Adafruit_SSD1306 display(OLED_RESET); static const unsigned char PROGMEM logo16_glcd_bmp[] = { B00000000, B11000000, B00000001, B11000000, B00000001, B11000000, B00000011, B11100000, B11110011, B11100000, B11111110, B11111000, B01111110, B11111111, B00110011, B10011111, B00011111, B11111100, B00001101, B01110000, B00011011, B10100000, B00111111, B11100000, B00111111, B11110000, B01111100, B11110000, B01110000, B01110000, B00000000, B00110000 }; #if (SSD1306_LCDHEIGHT != 64) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif int linePosArray[6] = {11, 20, 29, 38, 46, 55}; void displayMainMenu(byte menuItem, byte subMenuItem){ // Menu 0 display.clearDisplay(); // Text: display.setTextSize(1); display.setTextColor(WHITE, BLACK); display.setCursor(0, 0); display.print(mainMenu.title); // LEFT MENU: for(int i = 0; i < leftMenuSize; i++){ if(i != menuItem){ display.setCursor(0, linePosArray[i]); display.print(mainMenu.leftMenu[i]); } else{ display.setCursor(0, linePosArray[i]); display.setTextColor(BLACK, WHITE); display.print(mainMenu.leftMenu[i]); display.setTextColor(WHITE, BLACK); } } // RIGHT MENU: for(int j = 0; j < rightMenuSize; j++){ if(j != subMenuItem){ display.setCursor(46, linePosArray[j]); display.print(mainMenu.rightMenu[menuItem][j]); } else{ display.setCursor(46, linePosArray[j]); display.setTextColor(BLACK, WHITE); display.print(mainMenu.rightMenu[menuItem][j]); display.setTextColor(WHITE, BLACK); } } display.drawLine(0, 8, 127, 8, WHITE); display.drawLine(44, 9, 44, 64, WHITE); display.display(); } void debugMPU9250(){ if(debugIMU == 1){ displayTimer = millis(); if(displayTimer - lastDisplay > 30){ // Serial.println(" Display"); // Serial.print("mx: "); // Serial.println(mx); // Serial.print("my: "); // Serial.println(my); // Serial.print("mz: "); // Serial.println(mz); display.clearDisplay(); display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(0,0); display.print(" YAW: "); display.println(yaw); display.println(""); display.print(" PITCH: "); display.println(pitch); display.println(""); display.print(" ROLL: "); display.println(roll); display.println(""); display.display(); lastDisplay = millis(); } } else if(debugIMU == 2){ displayTimer = millis(); Serial.print("DisplayTimer: "); Serial.println(displayTimer); if(displayTimer - lastDisplay > 30){ // Serial.println(" Display"); // Serial.print("mx: "); // Serial.println(mx); // Serial.print("my: "); // Serial.println(my); // Serial.print("mz: "); // Serial.println(mz); display.clearDisplay(); display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(0,0); display.print(" YAW: "); display.println(yawMIDI); display.println(""); display.print(" PITCH: "); display.println(pitchMIDI); display.println(""); display.print(" ROLL: "); display.println(rollMIDI); display.println(""); display.display(); lastDisplay = millis(); } } }
#ifndef BLOCKBUFFER_H #define BLOCKBUFFER_H #include "project_exceptions.h" using namespace fs_excetion; #include "filesystemblock.h" #include "constants.h" #include <memory> #include <list> #include <unordered_set> class BlockFileAccessor; class BlockBufferPool; enum class SyncType {None = 0, ReadOnly = 1, WriteOnly = 2, ReadWrite = 3}; /** * @brief The BlockBufferLocker class * Writes changes to file before destruct */ class BlockBufferLocker { BlockBufferLocker(BlockBufferLocker &other) = delete; const BlockBufferLocker &operator=(const BlockBufferLocker &other) const = delete; BlockBufferLocker operator=(const BlockBufferLocker &other) = delete; protected: BlockBufferLocker(BlockBufferPool *bufferPool, BlockFileAccessor *file, blockAddress_tp block, SyncType syncType); public: BlockBufferLocker(); ~BlockBufferLocker(); BlockBufferLocker(BlockBufferLocker &&other); BlockBufferLocker &operator =(BlockBufferLocker &&other); byte_tp *data() const; uint64_t length() const; bool isValid() const; SyncType syncType() const; void setSyncType(const SyncType &syncType); void flush(); template<typename T = FileSystemBlock> T *atBlock() const { static_assert(std::is_base_of<FileSystemBlock, T>::value, "T must be derived from FileSystemBlock"); return reinterpret_cast<T*>(data()); } private: void ensureValid() const; // mutable for lazy initialize mutable byte_tp *_blockBuffer = nullptr; BlockBufferPool *_bufferPool; blockAddress_tp _blockAddress; BlockFileAccessor *_fsFile; SyncType _type; bool _isValid = true; }; template<typename T> class TypedBufferLocker : public BlockBufferLocker { friend class BlockBufferPool; TypedBufferLocker(BlockBufferPool *pool, BlockFileAccessor *file, blockAddress_tp block, SyncType type) : BlockBufferLocker(pool, file, block, type) { static_assert(std::is_base_of<FileSystemBlock, T>::value, "T must be derived from FileSystemBlock"); } public: TypedBufferLocker() { } T &operator *() { return *block(); } T *operator &() { return block(); } T *operator ->() { return block(); } private: T *block() const { return atBlock<T>(); } }; class BlockBufferPool { public: void setDefaultBuffersSize(uint64_t size); uint64_t bufferSize() const; template<typename T> TypedBufferLocker<T> getLock(blockAddress_tp block, BlockFileAccessor *file, SyncType type) { return TypedBufferLocker<T>(this, file, block, type); } private: friend class BlockBufferLocker; byte_tp *getAnyFreeBuffer(); void unlockBuffer(byte_tp *buffer); byte_tp *lockFreeBuffer(); byte_tp *lockNewBuffer(); uint64_t _bufferSize = 0; mutable std::list<byte_tp *> _free; mutable std::unordered_set<byte_tp *> _occupied; // debug }; #endif // BLOCKBUFFER_H
#ifndef ASM_GENERIC_TYPES64_H_ #define ASM_GENERIC_TYPES64_H_ #define __WORDSIZE 64 #ifndef __ASSEMBLER__ typedef signed char __s8; typedef unsigned char __u8; typedef signed short __s16; typedef unsigned short __u16; typedef signed int __s32; typedef unsigned int __u32; typedef long long __s64; typedef unsigned long long __u64; typedef unsigned long int __size_t; typedef signed long int __ssize_t; typedef signed long int __ptrdiff_t; typedef unsigned long int __uintptr_t; typedef long int __intptr_t; typedef __s64 __s_fast; typedef __u64 __u_fast; #endif /* __ASSEMBLER__ */ #endif /* ASM_GENERIC_TYPES64_H_ */
#pragma once #include "CSceneNodeBoxyDecorator.h" #include "3d.h" #include "UnifiedCoord.h" #include "VectorTraits.h" #include <utility> #include <bitset> class CSceneNodeBoxyRepositioner: public CSceneNodeBoxyDecorator {//ÔÚÒ»¸öSceneNodeBoxyÀïÃæ·ÅÒ»¸öSceneNodeBoxyµÄÀà. public: virtual void SetAABB(const AABB &aabb); virtual const AABB GetAABB() const{ return m_aabb; } CSceneNodeBoxyRepositioner(ISceneNodeBoxy *pDecorated, const UnifiedCoord<vector3> &remapMin, const UnifiedCoord<vector3> &remapMax) :CSceneNodeBoxyDecorator(pDecorated),m_remapping(remapMin,remapMax),m_aabb(MinimumAABB()){} //remapMin,remapMax¶¼ÊÇUnifiedCoord,UnifiedCoord ºÍCEGUIÀïÃæµÄUnified coordinates²î²»¶à,Ö»²»¹ýÊÇÀ©Õ¹µ½ÁËÈýά enum Flags{ Enclosing,//ÊÇ·ñ»áÔÚÀïÃæµÄSceneNodeBoxyÒÆ³öÍâÃæµÄSceneNodeBoxyµÄʱºò×Ô¶¯µ¯»Ø NumFlags }; void Set(Flags flag); void Clear(Flags flag); void SetEnabled(Flags flag,bool enabled); bool Get(Flags flag); private: std::pair< UnifiedCoord<vector3>,UnifiedCoord<vector3> > m_remapping; AABB m_aabb; std::bitset<NumFlags> m_flags; };
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if defined( _WIN32 ) #pragma once #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #include <WinSock2.h> #include <MSWSOCK.h> #include <WS2tcpip.h> #include <windows.h> #include <winbase.h> #include <tchar.h> #include <dbghelp.h> #include <process.h> #endif #include <stdint.h> #include <iostream> #include <cassert> #include <cstring> #include <functional> #include <algorithm> #include <vector> #include <map> #include <string> #include <iterator> #include <ctime> #include <system_error> #include <common/define.hpp> #include <diagnostics/tcode_error_code.hpp>
#pragma once namespace Dolores { class Consciousness { public: Consciousness(); ~Consciousness(); }; }
#ifndef CG_PREDICATE_H #define CG_PREDICATE_H #include "Point.h" #include "Edge.h" int predicate_ahead(struct Point *p, struct Point *q, struct Point *r); double predicate_distSquared(struct Point *p, struct Point *q); int predicate_edgeIsPartOfRing(struct Edge *test, struct Edge *fromOrigin); int predicate_isPointInCircle(struct Point *test, struct Point *a, struct Point *b, struct Point *c); int predicate_leftOrAhead(struct Point *p, struct Point *q, struct Point *r); int predicate_onEdge(struct Point *p, struct Edge *e); int predicate_rightOf(struct Point *p, struct Edge *e); int predicate_rightOrAhead(struct Point *p, struct Point *q, struct Point *r); double predicate_triArea(struct Point *a, struct Point *b, struct Point *c); #endif /* CG_PREDICATE_H */
#ifndef __TERRAINHEIGHTMAP_H__ #define __TERRAINHEIGHTMAP_H__ #include <string> #include "types.h" /* Mostly downloaded and hacked to use SDL_image. Based on * http://www.ogre3d.org/wiki/index.php/Ogre_Compatible_HeightMap * Note that while the original was written for raw, that code has been * fiddled with too, but not tested. Beware! ;). */ /// Reads and stores heightmap information for TerrainSceneManager scenes. class TerrainHeightMap { public: /** * set width = 0 to autodetect. Only works with an image atm, not a raw file */ TerrainHeightMap(int width, float widthScale, float heightScale, const std::string& rawFilename, bool is16bit = true); ~TerrainHeightMap(); /** * Print the height map to standard output, useful for debugging */ void printHeightMap(); /** * This function is merely a modified form of the function * of the same name in TerrainRenderable. */ float getHeightAt(float x, float z); private: /** * Simple function for pulling out a value from the array */ inline float indexHeight(int x, int y); private: float* m_Vertices; int m_Width; float m_WidthScale; float m_HeightScale; }; #endif
/* Copyright (c) 2013 The Squash Authors * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Evan Nemerson <evan@nemerson.com> */ #ifndef SQUASH_INTERNAL_H #define SQUASH_INTERNAL_H #if !defined (SQUASH_COMPILATION) #error "This is internal API; you cannot use it." #endif #ifdef SQUASH_H #error "You must include internal.h before (or instead of) squash.h" #endif #ifdef __GNUC__ # define SQUASH_LIKELY(expr) (__builtin_expect ((expr), true)) # define SQUASH_UNLIKELY(expr) (__builtin_expect ((expr), false)) #else # define SQUASH_LIKELY(expr) (expr) # define SQUASH_UNLIKELY(expr) (expr) #endif #ifndef SQUASH_API #if defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ #define SQUASH_API __attribute__ ((dllexport)) #else #define SQUASH_API __declspec(dllexport) #endif #define SQUASH_INTERNAL #else #if __GNUC__ >= 4 #define SQUASH_API __attribute__ ((visibility ("default"))) #define SQUASH_INTERNAL __attribute__ ((visibility ("hidden"))) #else #define SQUASH_API #define SQUASH_INTERNAL #endif #endif #endif #include "squash.h" #include <squash/config.h> #include "tree-internal.h" #include "types-internal.h" #include "context-internal.h" #include "plugin-internal.h" #include "codec-internal.h" #include "slist-internal.h" #include "buffer-internal.h" #include "buffer-stream-internal.h" #include "ini-internal.h" #include "mtx-internal.h" #include "stream-internal.h" #endif /* SQUASH_INTERNAL_H */
#if !defined(__RSYS_VBL__) #define __RSYS_VBL__ namespace Executor { extern void C_ROMlib_vcatch( void ); } #endif /* !defined(__RSYS_VBL__) */
// Copyright (c) 2010-14 Bifrost Entertainment AS and Tommy Nguyen // Distributed under the MIT License. // (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT) #ifndef COMMON_TIMEDEVENT_H_ #define COMMON_TIMEDEVENT_H_ #include "Common/Debug.h" /// A ticker with a configurable time interval. template<typename T> class TimedEvent { public: /// Returns whether this ticker is running. bool is_stopped() const; /// Sets time till a tick. void set_timeout(const unsigned int timeout); /// Starts accumulating time. void start(); /// Stops accumulating time. void stop(); /// Accumulates time and calls \c tick() when time is up. void update(const unsigned long dt); protected: TimedEvent(const unsigned int timeout); ~TimedEvent() = default; private: unsigned int accumulated_; ///< Accumulated, monotonic time. unsigned int timeout_; ///< Time till a tick. bool stopped_; ///< Whether time is being accumulated. }; template<typename T> bool TimedEvent<T>::is_stopped() const { return stopped_; } template<typename T> void TimedEvent<T>::set_timeout(const unsigned int timeout) { timeout_ = timeout; accumulated_ = 0; } template<typename T> void TimedEvent<T>::start() { R_ASSERT(timeout_ > 0, "No time out set"); stopped_ = false; } template<typename T> void TimedEvent<T>::stop() { stopped_ = true; } template<typename T> void TimedEvent<T>::update(const unsigned long dt) { if (stopped_) return; accumulated_ += dt; while (accumulated_ >= timeout_) { static_cast<T*>(this)->tick(); accumulated_ -= timeout_; } } template<typename T> TimedEvent<T>::TimedEvent(const unsigned int timeout) : accumulated_(0), timeout_(timeout), stopped_(false) { } #endif
// // AppDelegate.h // RotationDemo // // Created by Michael D Zornek on 7/20/15. // Copyright (c) 2015 Big Nerd Ranch. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
// // NSObject+LTLNSObject.h // 音乐播放器 // // Created by LiTaiLiang on 16/12/13. // Copyright © 2016年 LiTaiLiang. All rights reserved. // #import <Foundation/Foundation.h> @interface NSObject (LTLNSObject) /* 获取对象的所有属性和属性内容 */ - (NSDictionary *)getAllPropertiesAndVaules; /* 获取对象的所有属性 */ - (NSArray *)getAllProperties; /* 获取对象的所有方法 */ -(void)getAllMethods; @end
// // XHViewController.h // XHImageViewer // // Created by 曾 宪华 on 14-2-17. // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. // #import <UIKit/UIKit.h> @interface XHViewController : UIViewController @end
// // Created by Tomas Linhart. // Copyright (c) 2014 Tomáš Linhart. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> typedef NS_ENUM(NSInteger, TLLinearLayoutViewOrientation) { TLLinearLayoutViewOrientationVertical, TLLinearLayoutViewOrientationHorizontal, }; @interface TLLinearLayoutView : UIView @property (nonatomic, assign) TLLinearLayoutViewOrientation orientation; - (instancetype)initWithOrientation:(TLLinearLayoutViewOrientation)orientation; @end
// // STKPostViewModel.h // Stack // // Created by Bradley Smith on 12/22/15. // Copyright © 2015 Brad Smith. All rights reserved. // @import Foundation; @protocol STKCollectionListTableViewDelegate; @class STKPost, ASTableView; @interface STKPostViewModel : NSObject - (instancetype)initWithPost:(STKPost *)post; - (void)setupCollectionListDataSourceWithTableView:(ASTableView *)tableView delegate:(id <STKCollectionListTableViewDelegate>)delegate; - (id)objectAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)indexPathForObject:(id)object; @property (strong, nonatomic, readonly) STKPost *post; @property (assign, nonatomic, readonly) BOOL downloading; @end
// // KSendMessageView.h // KSharedSDKDemo // // Created by kyle on 14-3-11. // Copyright (c) 2014年 kyle. All rights reserved. // #import <Foundation/Foundation.h> #import "KSharedMessage.h" @protocol KSendMessageViewDelegate <NSObject> - (void)sendWeiboMessage:(KSharedMessage *)m; @end @interface KSendMessageView : NSObject <UITextViewDelegate> @property (weak, nonatomic) id<KSendMessageViewDelegate> delegate; + (instancetype)Instance; - (void)setTitle:(NSString *)title; - (void)setContent:(NSString *)content; - (void)setImage:(UIImage *)image; - (void)show; - (void)showInNewWindow; @end
#pragma strict_types #include "../def.h" inherit MASTER_ROOM; inherit MOD_DOOR; void create_object(void); void reset(int arg); void init(void); void create_object(void) { set_short("Middle of the farm (e)"); set_long("A wide open space in the middle of the small farm. The grass " + "on the ground has been trampled by many different feet and " + "there are many tracks and footprints all around you. South " + "of here is a big grassy hill with several small round " + "windows in its side. On top of the hill grows a huge oak " + "tree casting a shadow over the yard. North of the yard is a " + "building that looks like a stable. The yard continues to the " + "west and there are some more buildings there. To the east " + "you see the gate leading out from the farm.\n"); set_new_light(5); add_item("space|open space|wide open space","It's what is normally " + "referred to as a yard"); add_item("yard","It is in the middle of the farm. The buildings are " + "built around it"); add_item("farm|cosy farm|small farm","A cosy little farm where " + "everything seems to be a bit smaller than normal"); add_item("grass","It has been trampled so much there's almost no grass " + "left here"); add_item("ground","There's almost no grass left. There seems to be a " + "lot of activity here"); add_item("feet|foot","They are at the end of your legs"); add_item("leg|legs","They are connected to your torso"); add_item("torso","It's part of your body"); add_item("body","Not bad, you're in pretty good shape"); add_item("track|tracks|footprint|footprints","Tracks and footprints " + "from all kinds of animals, going off in all directions from " + "here"); add_item("animal|animals|farm animal|farm animals","The usual kinds " + "of farm animal by the looks of the tracks"); add_item("hill|grassy hill|big grassy hill","There's a round door in " + "it and several windows next to the door. It looks like a " + "hobbit house"); add_item("house|houses|hobbit house","Hobbits often live in houses " + "dug out in a hill"); add_item("window|windows|round window|round windows|small window|" + "small windows|small round window|small round windows","Small " + "windows in the side of the hill. None of the curtains are " + "drawn, something that gives the house an inviting feeling"); add_item("curtain|curtains","The curtains in the windows are not drawn " + "so you can't see them from here"); add_item("tree|oak|huge oak|huge tree|oak tree|huge oak tree","It " + "towers above you and seems to be the only thing on the farm " + "that doesn't look a bit smaller than it should be"); add_item("shadow|long shadow","A long shadow cast by the oak tree"); add_item("building|stable|stone building","A stone building that has " + "the looks of a stable. It seems a bit small to you but it " + "would probably be of a more normal size to someone the size " + "of a hobbit"); add_item("buildings","A barn and a shed by the looks of them"); add_item("barn|two story building","It is a two story building on the " + "far side of the yard"); add_item("side|far side","There is a barn there"); add_item("shed","The shed is crammed in between the barn and the stable"); add_item("gate","The gate to the farm is east of here, you'd have to " + "go there to get a better look"); add_item("$|$sound|$sounds|$animal|$animals","You hear the sounds of " + "farm animals coming from all around you"); add_item("%|%smell|%animal|%animals","You feel the smell of farm " + "animals"); add_exit(ROOM + "farm_gate","east"); add_exit(ROOM + "farm_stable","north"); add_exit(ROOM + "farm_west","west"); (ROOM + "house_hallway")->load_doors(); reset(0); } void reset(int arg) { add_monster(MONSTER + "hobbit_farmer"); ::reset(arg); } void init(void) { SYS_ADMIN->visit(1115); ::init(); }
// // HBStationCell.h // HZBicycle // // Created by MADAO on 16/11/16. // Copyright © 2016年 MADAO. All rights reserved. // #import <UIKit/UIKit.h> @interface HBStationCell : UICollectionViewCell @property (nonatomic, weak) HBBicycleStationModel *station; @end
//////////////////////////////////////////////////////////////////////////////// // Name: autocomplete.h // Purpose: Declaration of class wex::autocomplete // Author: Anton van Wezenbeek // Copyright: (c) 2018 Anton van Wezenbeek //////////////////////////////////////////////////////////////////////////////// #pragma once #include <set> #include <string> #include <wex/ctags-entry.h> namespace wex { class stc; /// Offers a class for autocompletion on wex::stc. class autocomplete { public: /// Constructor. autocomplete(stc* stc); /// Activates the autocompleted text. /// This might setup a filter for next /// autocomplete list. bool activate(const std::string& text); /// Builds and shows autocomplete lists on the /// stc component. This can be a list /// according to CTags, previously inserted text, /// or keywords for current lexer. bool apply(char c); /// Clears filter. void reset(); /// Returns true if active. bool use() const; /// Sets autocomplete on or off. void use(bool on) {m_Use = on;}; private: void clear(); bool ShowCTags(bool show) const; bool ShowInserts(bool show) const; bool ShowKeywords(bool show) const; const size_t m_MinSize; bool m_Use {true}; std::string m_Text; std::set< std:: string > m_Inserts; ctags_entry m_Filter; stc* m_STC; }; };
// // ViewController.h // ViewController // // Created by Yun on 13-8-12. // Copyright (c) 2013年 伟平 周. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property (nonatomic,retain) UIButton *button; @end
#ifndef __REFRESH_H #define __REFRESH_H #include <vector> #include "channel_state.h" #include "common.h" #include "configuration.h" namespace dramsim3 { class Refresh { public: Refresh(const Config& config, ChannelState& channel_state); void ClockTick(); private: uint64_t clk_; int refresh_interval_; const Config& config_; ChannelState& channel_state_; RefreshPolicy refresh_policy_; int next_rank_, next_bg_, next_bank_; void InsertRefresh(); void IterateNext(); }; } // namespace dramsim3 #endif
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <PhotoBoothEffects/PBFilter.h> @interface PBXRayFilter : PBFilter { } - (id)ciFilterName; @end
#pragma once #include <glm/glm.hpp> struct LineSegment { glm::vec2 start; glm::vec2 end; LineSegment(float a_startX, float a_startY, float a_endX, float a_endY); LineSegment(const glm::vec2& a_start, const glm::vec2& a_end); LineSegment(const LineSegment& a_line); bool contains(const glm::vec2& a_point) const; bool contains(const LineSegment& a_line) const; bool intersects(const glm::vec2& a_point, glm::vec2* a_intersection = nullptr) const; bool intersects(const LineSegment& a_line, LineSegment* a_intersection = nullptr) const; }; struct Rectangle { enum EdgeIndex { RIGHT = 0, BOTTOM = 1, LEFT = 2, TOP = 3, EDGE_COUNT = 4 }; enum SharedEdgeFlags { NONE = 0, RIGHT_SHARED = 1 << RIGHT, BOTTOM_SHARED = 1 << BOTTOM, LEFT_SHARED = 1 << LEFT, TOP_SHARED = 1 << TOP, }; glm::vec2 topRight; glm::vec2 bottomLeft; glm::vec2 topLeft() const { return glm::vec2(bottomLeft.x, topRight.y); } glm::vec2 bottomRight() const { return glm::vec2(topRight.x, bottomLeft.y); } glm::vec2 center() const { return (topRight + bottomLeft) * 0.5f; } glm::vec2 size() const { return topRight - bottomLeft; } glm::vec2 extents() const { return size() * 0.5f; } LineSegment edge(EdgeIndex a_edge) const { switch (a_edge) { case RIGHT: return LineSegment(topRight, bottomRight()); break; case BOTTOM: return LineSegment(bottomRight(), bottomLeft); break; case LEFT: return LineSegment(bottomLeft, topLeft()); break; case TOP: return LineSegment(topLeft(), topRight); break; } return LineSegment(bottomLeft, topRight); } Rectangle(float a_centerX, float a_centerY, float a_sizeX, float a_sizeY); Rectangle(const glm::vec2& a_center, const glm::vec2& a_size); Rectangle(const Rectangle& a_rect); bool contains(const glm::vec2& a_point) const; bool contains(const LineSegment& a_line) const; bool contains(const Rectangle& a_rect) const; bool intersects(const glm::vec2& a_point, glm::vec2* a_intersection = nullptr) const; bool intersects(const LineSegment& a_line, LineSegment* a_intersection = nullptr) const; bool intersects(const Rectangle& a_rect, Rectangle* a_intersection = nullptr) const; // (result & 1 << 0) = this rectangle shares its right edge with the other // (result & 1 << 1) = this rectangle shares its bottom edge with the other // (result & 1 << 2) = this rectangle shares its left edge with the other // (result & 1 << 3) = this rectangle shares its top edge with the other // (result & 1 << 4) = other rectangle shares its right edge with this one // (result & 1 << 5) = other rectangle shares its bottom edge with this one // (result & 1 << 6) = other rectangle shares its left edge with this one // (result & 1 << 7) = other rectangle shares its top edge with this one SharedEdgeFlags sharedEdges(const Rectangle& a_rect) const; };
/** * \file * \brief Inline functions to allow manipulation of raw capability addresses * * This file is not part of the standard includes, because most user code should * treat #capref as an opaque value. */ /* * Copyright (c) 2007, 2008, 2009, 2010, 2012, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. */ #ifndef INCLUDEBARRELFISH_CADDR_H #define INCLUDEBARRELFISH_CADDR_H #include <stdbool.h> #include <sys/cdefs.h> #include <barrelfish_kpi/types.h> #include <stdint.h> #include <stdbool.h> __BEGIN_DECLS #include <stdbool.h> /** * \brief User-level representation of a CNode, its CSpace address and size */ struct cnoderef { capaddr_t address; ///< Base address of CNode in CSpace uint8_t address_bits; ///< Number of valid bits in base address uint8_t size_bits; ///< Number of slots in the CNode as a power of 2 uint8_t guard_size; ///< Guard size of the CNode } __attribute__((packed)); #define NULL_CNODE (struct cnoderef){ /*address*/ 0, /*address_bits*/ 0, \ /*size_bits*/ 0, /*guard_size*/ 0 } /** * \brief User-level representation of a capability and its CSpace address */ struct capref { struct cnoderef cnode; ///< CNode this cap resides in capaddr_t slot; ///< Slot number within CNode }; #define NULL_CAP (struct capref){ /*cnode*/ NULL_CNODE, /*slot*/ 0 } static inline bool capref_is_null(struct capref capref) { return capref.cnode.address == 0 && capref.cnode.address_bits == 0; } /* well-known cnodes */ extern struct cnoderef cnode_root, cnode_task, cnode_base, cnode_super, cnode_page, cnode_module; /* well-known capabilities */ extern struct capref cap_root, cap_monitorep, cap_irq, cap_io, cap_dispatcher, cap_selfep, cap_kernel, cap_initep, cap_perfmon, cap_dispframe, cap_sessionid, cap_ipi, cap_vroot; /** * \brief Returns the number of valid bits in the CSpace address of a cap */ static inline uint8_t get_cap_valid_bits(struct capref cap) { uint8_t sum = cap.cnode.address_bits + cap.cnode.guard_size + cap.cnode.size_bits; if (sum > CPTR_BITS) { return sum % CPTR_BITS; } else { return sum; } } /** * \brief Returns the CSpace address of a cap */ // XXX: workaround for an inlining bug in gcc 4.4.1 as shipped with ubuntu 9.10 // XXX: bug still present in 4.4.3 #if defined(__GNUC__) \ && __GNUC__ == 4 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ <= 3 static __attribute__((noinline)) capaddr_t get_cap_addr(struct capref cap) #else static inline capaddr_t get_cap_addr(struct capref cap) #endif { uint8_t vbits = get_cap_valid_bits(cap); if (cap.cnode.address_bits == CPTR_BITS) { // special case for root return cap.slot << (CPTR_BITS - vbits); } else { return cap.cnode.address | (cap.slot << (CPTR_BITS - vbits)); } } /** * \brief Returns the number of valid bits in the CSpace address of the CNode * containing the given cap */ static inline uint8_t get_cnode_valid_bits(struct capref cap) { return cap.cnode.address_bits; } /** * \brief Returns the CSpace address of the CNode containing the given cap * * Returns the valid bits of the address only, in the least significant bits * of the result. This is the format needed for CNode invocation parameters. */ static inline capaddr_t get_cnode_addr(struct capref cap) { return cap.cnode.address >> (CPTR_BITS - cap.cnode.address_bits); } /** * \brief Compare two cnoderefs * * Two cnoderefs are equal if they have the same base address, * same number of valid bits and the same guard_size. */ static inline bool cnodecmp(struct cnoderef c1, struct cnoderef c2) { return ((c1.address == c2.address) && (c1.address_bits == c2.address_bits) && (c1.guard_size == c2.guard_size)); } /** * \brief Compare two caprefs * * Two caprefs are equal if they have the same cnoderef and the same * slot. */ static inline bool capcmp(struct capref c1, struct capref c2) { return (c1.slot == c2.slot) && cnodecmp(c1.cnode, c2.cnode); } /** * \brief Creates a new #cnoderef struct, performing address calculations. */ static inline struct cnoderef build_cnoderef(struct capref cap, uint8_t size_bits) { struct cnoderef ret; ret.address = get_cap_addr(cap); ret.address_bits = (cap.cnode.address_bits + cap.cnode.guard_size + cap.cnode.size_bits) % CPTR_BITS; ret.size_bits = size_bits; ret.guard_size = 0; // XXX return ret; } __END_DECLS #endif
/* * context.h * * Created on: June 09, 2016 * Author: Hotak */ #ifndef CONTEXT_H_ #define CONTEXT_H_ #include <AL/al.h> #include <AL/alc.h> #include <AL/alext.h> #include "source.h" #include <vector> /* * The Context class places Listener and Source objects within the given 3D space room * and mixes audio sources that reflect their relative locations. */ #define MAXNUM 5 class Context { public: Context(); ~Context(); void Create(); void Destroy(); void SetListenerPos(float x, float y, float z); void Play(); void Stop(); void Push(Source* source); void Pop(Source* source); void ResetSource(); private: void convertVecToArr(ALuint* arr); private: ALCdevice * m_device; ALCcontext* m_context; std::vector<Source*> m_ImportSourceIdx; }; #endif /* CONTEXT_H_ */
// // AccelerometerActions.h // AccelActions // // Created by Antonio Cabezuelo Vivo on 23/11/08. // Copyright 2008 Taps and Swipes. All rights reserved. // #import <UIKit/UIKit.h> @class AccelerometerActionsValue; // Types of accions tha the library wil send to the delegate typedef enum { AccelerometerActionMoveToLeft, AccelerometerActionMoveToRight, AccelerometerActionMoveUp, AccelerometerActionMoveDown, AccelerometerActionRotateToLeft, AccelerometerActionRotateToRight, AccelerometerActionShake, } AccererometerAction; // This is the protocol tha the delegates must conform to @protocol AccelerometerActionsDelegate - (void) devicePerformedAccelerometerAction:(AccererometerAction)theAction; @end @interface AccelerometerActions : NSObject <UIAccelerometerDelegate> { id <AccelerometerActionsDelegate> delegate; UIAccelerationValue accelerations[3]; AccelerometerActionsValue *minmaxvalues[3][2]; BOOL detecting; NSTimeInterval waitingSince; } @property (nonatomic, assign) id <AccelerometerActionsDelegate> delegate; + (AccelerometerActions *) sharedAccelerometerActions; - (void) startSendingActions; - (void) stopSendingActions; @end
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSDictionary, NSString; @protocol EnterpriseSearchDataControllerDelegate <NSObject> @optional - (_Bool)shouldProcessRemoteSearchResp:(NSString *)arg1 range:(unsigned int)arg2; - (void)onRemoteSearchMoreCompleted:(NSString *)arg1 range:(unsigned int)arg2 result:(NSDictionary *)arg3; @end
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Copyright (c) 2011-2012 Litecoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef __cplusplus # error This header can only be compiled as C++. #endif #ifndef __INCLUDED_PROTOCOL_H__ #define __INCLUDED_PROTOCOL_H__ #include "serialize.h" #include "netbase.h" #include <string> #include "uint256.h" extern bool fTestNet; static inline unsigned short GetDefaultPort(const bool testnet = fTestNet) { return testnet ? 7999 : 8999; } extern unsigned char pchMessageStart[4]; /** Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */ class CMessageHeader { public: CMessageHeader(); CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn); std::string GetCommand() const; bool IsValid() const; IMPLEMENT_SERIALIZE ( READWRITE(FLATDATA(pchMessageStart)); READWRITE(FLATDATA(pchCommand)); READWRITE(nMessageSize); READWRITE(nChecksum); ) // TODO: make private (improves encapsulation) public: enum { MESSAGE_START_SIZE=sizeof(::pchMessageStart), COMMAND_SIZE=12, MESSAGE_SIZE_SIZE=sizeof(int), CHECKSUM_SIZE=sizeof(int), MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE, CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; unsigned int nMessageSize; unsigned int nChecksum; }; /** nServices flags */ enum { NODE_NETWORK = (1 << 0), }; /** A CService with information about it as peer */ class CAddress : public CService { public: CAddress(); explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK); void Init(); IMPLEMENT_SERIALIZE ( CAddress* pthis = const_cast<CAddress*>(this); CService* pip = (CService*)pthis; if (fRead) pthis->Init(); if (nType & SER_DISK) READWRITE(nVersion); if ((nType & SER_DISK) || (nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH))) READWRITE(nTime); READWRITE(nServices); READWRITE(*pip); ) void print() const; // TODO: make private (improves encapsulation) public: uint64 nServices; // disk and network only unsigned int nTime; // memory only int64 nLastTry; }; /** inv message data */ class CInv { public: CInv(); CInv(int typeIn, const uint256& hashIn); CInv(const std::string& strType, const uint256& hashIn); IMPLEMENT_SERIALIZE ( READWRITE(type); READWRITE(hash); ) friend bool operator<(const CInv& a, const CInv& b); bool IsKnownType() const; const char* GetCommand() const; std::string ToString() const; void print() const; // TODO: make private (improves encapsulation) public: int type; uint256 hash; }; #endif // __INCLUDED_PROTOCOL_H__
// // DConnectSDK.h // DConnectSDK // // Copyright (c) 2014 NTT DOCOMO,INC. // Released under the MIT license // http://opensource.org/licenses/mit-license.php // /*! @file @brief Device Connect SDK for iOS "umbrella" ヘッダ @author NTT DOCOMO */ /*! @mainpage <p> Device Connect SDK for iOS は Device Connect API に対応したiOS向けのデバイスプラグイン及び、UIアプリを開発するためのSDKである。<br/> 本SDKでは以下の機能を提供する。 </p> @li Device Connect Managerの設定、起動 @li Device Connect APIへのアクセス機能 @li デバイスプラグイン開発用クラスの提供 @li URI生成機能 @li イベント操作機能 @li メッセージ操作機能 <h2> Device Connect アーキテクチャ </h2> @image html ios_arch.png */ #import <Foundation/Foundation.h> #import <DConnectSDK/DConnectUtil.h> #import <DConnectSDK/DConnectProfileProvider.h> #import <DConnectSDK/DConnectProfile.h> #import <DConnectSDK/DConnectMessage.h> #import <DConnectSDK/DConnectRequestMessage.h> #import <DConnectSDK/DConnectResponseMessage.h> #import <DConnectSDK/DConnectManager.h> #import <DConnectSDK/DConnectDevicePlugin.h> #import <DConnectSDK/DConnectFileManager.h> #import <DConnectSDK/DConnectSettings.h> #import <DConnectSDK/DConnectCanvasProfile.h> #import <DConnectSDK/DConnectVibrationProfile.h> #import <DConnectSDK/DConnectSystemProfile.h> #import <DConnectSDK/DConnectSettingsProfile.h> #import <DConnectSDK/DConnectServiceInformationProfile.h> #import <DConnectSDK/DConnectProximityProfile.h> #import <DConnectSDK/DConnectPhoneProfile.h> #import <DConnectSDK/DConnectNotificationProfile.h> #import <DConnectSDK/DConnectServiceDiscoveryProfile.h> #import <DConnectSDK/DConnectMediaStreamRecordingProfile.h> #import <DConnectSDK/DConnectMediaPlayerProfile.h> #import <DConnectSDK/DConnectFileProfile.h> #import <DConnectSDK/DConnectFileDescriptorProfile.h> #import <DConnectSDK/DConnectDeviceOrientationProfile.h> #import <DConnectSDK/DConnectConnectProfile.h> #import <DConnectSDK/DConnectBatteryProfile.h> #import <DConnectSDK/DConnectAvailabilityProfile.h> #import <DConnectSDK/DConnectAuthorizationProfile.h> #import <DConnectSDK/DConnectTouchProfile.h> #import <DConnectSDK/DConnectKeyEventProfile.h> #import <DConnectSDK/DConnectEvent.h> #import <DConnectSDK/DConnectEventCacheController.h> #import <DConnectSDK/DConnectEventManager.h> #import <DConnectSDK/DConnectBaseCacheController.h> #import <DConnectSDK/DConnectDBCacheController.h> #import <DConnectSDK/DConnectMemoryCacheController.h> #import <DConnectSDK/DConnectFileCacheController.h> #import <DConnectSDK/DConnectURIBuilder.h> #import <DConnectSDK/DConnectMessageFactory.h> #import <DConnectSDK/DConnectEventHelper.h>
// // Copyright “Renga Software” LLC, 2016. All rights reserved. // // “Renga Software” LLC PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // “Renga Software” LLC DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // #pragma once #include <QtCore/QObject> #include <Renga/SelectionEventHandler.hpp> class ObjectSelectionHandler : public QObject, public Renga::SelectionEventHandler { Q_OBJECT public: ObjectSelectionHandler(Renga::ISelectionPtr pSelection); void OnModelSelectionChanged() override; signals: void objectSelected(const int&); private: Renga::ISelectionPtr m_pSelection; };
#pragma once namespace Rumia { template <typename Ty, typename... Rest> class Tuple : public Tuple<Rest...> { public: template <typename _Ty> Tuple( _Ty&& data, Rest... rest ) : Tuple<Rest...>( rest... ), m_data( std::forward<_Ty>( data ) ) { } public: Ty m_data; }; template <typename Ty> class Tuple<Ty> { public: template <typename _Ty> Tuple( _Ty&& data ) : m_data( std::forward<_Ty>( data ) ) { } public: Ty m_data; }; } namespace Rumia { template <typename Ty, typename... Rest> Rumia::Tuple<Ty, Rest...> MakeTuple( Ty&& data, Rest... rest ) { return Rumia::Tuple<Ty, Rest...>( std::forward<Ty>( data ), rest... ); } namespace _Impl { template <size_t index, typename Ty, typename... Rest> struct GetImpl { public: static decltype( auto ) value( const Tuple<Ty, Rest...>& tuple ) { return GetImpl< index - 1, Rest...>::value( tuple ); } }; template <typename Ty, typename... Rest> struct GetImpl<0, Ty, Rest...> { public: static Ty value( const Tuple<Ty, Rest...>& tuple ) { return tuple.m_data; } }; } template <size_t index, typename Ty, typename... Rest> decltype( auto ) Get( const Tuple<Ty, Rest...>& tuple ) { return _Impl::GetImpl<index, Ty, Rest...>::value( tuple ); } template <typename Tuple> struct TupleSize; template <typename... Types> struct TupleSize<Tuple<Types...>> { const static size_t value = sizeof...( Types ); }; }
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2014-2017 Luis B. Barrancos, The appleseedhq Organization // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #ifndef APPLESEED_RENDERER_MODELING_BSDF_ORENNAYARBRDF_H #define APPLESEED_RENDERER_MODELING_BSDF_ORENNAYARBRDF_H // appleseed.renderer headers. #include "renderer/global/globaltypes.h" #include "renderer/modeling/bsdf/ibsdffactory.h" #include "renderer/modeling/input/inputarray.h" // appleseed.foundation headers. #include "foundation/platform/compiler.h" #include "foundation/utility/autoreleaseptr.h" // appleseed.main headers. #include "main/dllsymbol.h" // Forward declarations. namespace foundation { class Dictionary; } namespace foundation { class DictionaryArray; } namespace renderer { class BSDF; } namespace renderer { class ParamArray; } namespace renderer { // // Oren-Nayar BRDF input values. // APPLESEED_DECLARE_INPUT_VALUES(OrenNayarBRDFInputValues) { Spectrum m_reflectance; // diffuse reflectance (albedo, technically) float m_reflectance_multiplier; float m_roughness; }; // // Oren-Nayar BRDF factory. // class APPLESEED_DLLSYMBOL OrenNayarBRDFFactory : public IBSDFFactory { public: // Return a string identifying this BSDF model. virtual const char* get_model() const APPLESEED_OVERRIDE; // Return metadata for this BSDF model. virtual foundation::Dictionary get_model_metadata() const APPLESEED_OVERRIDE; // Return metadata for the inputs of this BSDF model. virtual foundation::DictionaryArray get_input_metadata() const APPLESEED_OVERRIDE; // Create a new BSDF instance. virtual foundation::auto_release_ptr<BSDF> create( const char* name, const ParamArray& params) const APPLESEED_OVERRIDE; // Static variant of the create() method above. static foundation::auto_release_ptr<BSDF> static_create( const char* name, const ParamArray& params); }; } // namespace renderer #endif // !APPLESEED_RENDERER_MODELING_BSDF_ORENNAYARBRDF_H
/* Dwarf Therapist Copyright (c) 2009 Trey Stout (chmod) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UNIFORM_H #define UNIFORM_H #include <QObject> #include "global_enums.h" #include "utils.h" class DFInstance; class ItemDefUniform; class Item; class Uniform : public QObject { Q_OBJECT public: Uniform(DFInstance *df, QObject *parent = 0); virtual ~Uniform(); int get_missing_equip_count(ITEM_TYPE itype); QHash<ITEM_TYPE,QList<ItemDefUniform*> > get_uniform() {return m_uniform_items;} QHash<ITEM_TYPE,QList<ItemDefUniform*> > get_missing_items(){return m_missing_items;} float get_uniform_rating(ITEM_TYPE itype); void check_uniform(QString category_name, Item *item_inv); void add_equip_count(ITEM_TYPE itype, int count); void add_uniform_item(VIRTADDR ptr, ITEM_TYPE itype, int count=1); void add_uniform_item(ITEM_TYPE itype, short sub_type, short job_skill, int count=1); void add_uniform_item(ITEM_TYPE itype, short sub_type, QList<int> job_skills, int count=1); void add_uniform_item(ITEM_TYPE itype, ItemDefUniform *uItem, int count=1); bool has_items(){return m_uniform_items.count();} void clear(); protected: DFInstance *m_df; QHash<ITEM_TYPE,int> m_equip_counts; //the original equipment counts for the uniform, and group counts QHash<ITEM_TYPE,int> m_missing_counts; //same as equip counts but for missing items QHash<ITEM_TYPE,QList<ItemDefUniform*> > m_uniform_items; QHash<ITEM_TYPE,QList<ItemDefUniform*> > m_missing_items; bool m_first_check; int get_remaining_required(ITEM_TYPE itype); void load_missing_counts(); }; #endif // UNIFORM_H
// // sdmTableViewDataSource.h // CatFever // // Created by Peter JC Spencer on 19/05/2015. // Copyright (c) 2015 Spencer's digital media. All rights reserved. // #import "sdmDataSource.h" @interface sdmTableViewDataSource : sdmDataSource <UITableViewDataSource, UITableViewDelegate> // Property(s). @property(nonatomic, weak) UITableView *tableView; @end
// // ViewController.h // KRGpsTracker V1.4 // // Created by Kalvar on 13/6/23. // Copyright (c) 2013 - 2015年 Kuo-Ming Lin. All rights reserved. // #import <UIKit/UIKit.h> #import "KRGpsTracker.h" @interface ViewController : UIViewController { } @property (nonatomic, weak) IBOutlet MKMapView *outMapView; @property (nonatomic, weak) IBOutlet UIBarButtonItem *outTrackingItem; @property (nonatomic, weak) IBOutlet UILabel *outSpeedLabel; @property (nonatomic, weak) IBOutlet UILabel *outGpsSingalLabel; @property (nonatomic, strong) KRGpsTracker *krGpsTracker; -(void)resetGpsSingalStrength; -(IBAction)toggleTracking:(id)sender; -(IBAction)resetMap:(id)sender; -(IBAction)selectMapMode:(id)sender; -(IBAction)hasGpsSingal:(id)sender; @end
@interface _MSRulerData : MSModelObject { long long _base; // 8 = 0x8 MSArray *_guides; // 16 = 0x10 } @property(copy, nonatomic) MSArray *guides; // @synthesize guides=_guides; @property(nonatomic) long long base; // @synthesize base=_base; - (void).cxx_destruct; - (BOOL)isEqualForSync:(id)arg1; - (void)syncPropertiesMatchingReference:(id)arg1 withObject:(id)arg2; - (void)copyPropertiesToObjectCopy:(id)arg1; - (void)setAsParentOnChildren; - (void)decodePropertiesWithCoder:(id)arg1; - (void)encodePropertiesWithCoder:(id)arg1; - (void)fillInEmptyObjects; - (BOOL)hasDefaultValues; - (void)initEmptyObject; - (void)setPrimitiveGuides:(id)arg1; - (id)primitiveGuides; - (void)setPrimitiveBase:(long long)arg1; - (long long)primitiveBase; - (void)enumerateChildProperties:(CDUnknownBlockType)arg1; - (void)enumerateProperties:(CDUnknownBlockType)arg1; @end