text
stringlengths
4
6.14k
/* * Copyright © 2016 Intel Corporation * * 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 "mock_gtt.h" static void mock_insert_page(struct i915_address_space *vm, dma_addr_t addr, u64 offset, enum i915_cache_level level, u32 flags) { } static void mock_insert_entries(struct i915_address_space *vm, struct i915_vma *vma, enum i915_cache_level level, u32 flags) { } static int mock_bind_ppgtt(struct i915_vma *vma, enum i915_cache_level cache_level, u32 flags) { GEM_BUG_ON(flags & I915_VMA_GLOBAL_BIND); vma->pages = vma->obj->mm.pages; vma->flags |= I915_VMA_LOCAL_BIND; return 0; } static void mock_unbind_ppgtt(struct i915_vma *vma) { } static void mock_cleanup(struct i915_address_space *vm) { } struct i915_hw_ppgtt * mock_ppgtt(struct drm_i915_private *i915, const char *name) { struct i915_hw_ppgtt *ppgtt; ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); if (!ppgtt) return NULL; kref_init(&ppgtt->ref); ppgtt->base.i915 = i915; ppgtt->base.total = round_down(U64_MAX, PAGE_SIZE); ppgtt->base.file = ERR_PTR(-ENODEV); INIT_LIST_HEAD(&ppgtt->base.active_list); INIT_LIST_HEAD(&ppgtt->base.inactive_list); INIT_LIST_HEAD(&ppgtt->base.unbound_list); INIT_LIST_HEAD(&ppgtt->base.global_link); drm_mm_init(&ppgtt->base.mm, 0, ppgtt->base.total); i915_gem_timeline_init(i915, &ppgtt->base.timeline, name); ppgtt->base.clear_range = nop_clear_range; ppgtt->base.insert_page = mock_insert_page; ppgtt->base.insert_entries = mock_insert_entries; ppgtt->base.bind_vma = mock_bind_ppgtt; ppgtt->base.unbind_vma = mock_unbind_ppgtt; ppgtt->base.cleanup = mock_cleanup; return ppgtt; } static int mock_bind_ggtt(struct i915_vma *vma, enum i915_cache_level cache_level, u32 flags) { int err; err = i915_get_ggtt_vma_pages(vma); if (err) return err; vma->flags |= I915_VMA_GLOBAL_BIND | I915_VMA_LOCAL_BIND; return 0; } static void mock_unbind_ggtt(struct i915_vma *vma) { } void mock_init_ggtt(struct drm_i915_private *i915) { struct i915_ggtt *ggtt = &i915->ggtt; INIT_LIST_HEAD(&i915->vm_list); ggtt->base.i915 = i915; ggtt->mappable_base = 0; ggtt->mappable_end = 2048 * PAGE_SIZE; ggtt->base.total = 4096 * PAGE_SIZE; ggtt->base.clear_range = nop_clear_range; ggtt->base.insert_page = mock_insert_page; ggtt->base.insert_entries = mock_insert_entries; ggtt->base.bind_vma = mock_bind_ggtt; ggtt->base.unbind_vma = mock_unbind_ggtt; ggtt->base.cleanup = mock_cleanup; i915_address_space_init(&ggtt->base, i915, "global"); } void mock_fini_ggtt(struct drm_i915_private *i915) { struct i915_ggtt *ggtt = &i915->ggtt; i915_address_space_fini(&ggtt->base); }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ #define COMPONENTS_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ #include <string> #include "base/basictypes.h" #include "base/callback.h" #include "components/feedback/feedback_uploader.h" #include "net/url_request/url_fetcher_delegate.h" namespace feedback { // FeedbackUploaderDelegate is a simple http uploader for a feedback report. On // succes or failure, it deletes itself, but on failure it also notifies the // error callback specified when constructing the class instance. class FeedbackUploaderDelegate : public net::URLFetcherDelegate { public: FeedbackUploaderDelegate(const std::string& post_body, const base::Closure& success_callback, const ReportDataCallback& error_callback); virtual ~FeedbackUploaderDelegate(); private: // Overridden from net::URLFetcherDelegate. virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; std::string post_body_; base::Closure success_callback_; ReportDataCallback error_callback_; DISALLOW_COPY_AND_ASSIGN(FeedbackUploaderDelegate); }; } // namespace feedback #endif // COMPONENTS_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_
/* SPDX-License-Identifier: GPL-2.0 */ #undef TRACE_SYSTEM_VAR #ifdef CONFIG_BPF_EVENTS #undef __entry #define __entry entry #undef __get_dynamic_array #define __get_dynamic_array(field) \ ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) #undef __get_dynamic_array_len #define __get_dynamic_array_len(field) \ ((__entry->__data_loc_##field >> 16) & 0xffff) #undef __get_str #define __get_str(field) ((char *)__get_dynamic_array(field)) #undef __get_bitmask #define __get_bitmask(field) (char *)__get_dynamic_array(field) #undef __perf_count #define __perf_count(c) (c) #undef __perf_task #define __perf_task(t) (t) /* cast any integer, pointer, or small struct to u64 */ #define UINTTYPE(size) \ __typeof__(__builtin_choose_expr(size == 1, (u8)1, \ __builtin_choose_expr(size == 2, (u16)2, \ __builtin_choose_expr(size == 4, (u32)3, \ __builtin_choose_expr(size == 8, (u64)4, \ (void)5))))) #define __CAST_TO_U64(x) ({ \ typeof(x) __src = (x); \ UINTTYPE(sizeof(x)) __dst; \ memcpy(&__dst, &__src, sizeof(__dst)); \ (u64)__dst; }) #define __CAST1(a,...) __CAST_TO_U64(a) #define __CAST2(a,...) __CAST_TO_U64(a), __CAST1(__VA_ARGS__) #define __CAST3(a,...) __CAST_TO_U64(a), __CAST2(__VA_ARGS__) #define __CAST4(a,...) __CAST_TO_U64(a), __CAST3(__VA_ARGS__) #define __CAST5(a,...) __CAST_TO_U64(a), __CAST4(__VA_ARGS__) #define __CAST6(a,...) __CAST_TO_U64(a), __CAST5(__VA_ARGS__) #define __CAST7(a,...) __CAST_TO_U64(a), __CAST6(__VA_ARGS__) #define __CAST8(a,...) __CAST_TO_U64(a), __CAST7(__VA_ARGS__) #define __CAST9(a,...) __CAST_TO_U64(a), __CAST8(__VA_ARGS__) #define __CAST10(a,...) __CAST_TO_U64(a), __CAST9(__VA_ARGS__) #define __CAST11(a,...) __CAST_TO_U64(a), __CAST10(__VA_ARGS__) #define __CAST12(a,...) __CAST_TO_U64(a), __CAST11(__VA_ARGS__) /* tracepoints with more than 12 arguments will hit build error */ #define CAST_TO_U64(...) CONCATENATE(__CAST, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__) #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ static notrace void \ __bpf_trace_##call(void *__data, proto) \ { \ struct bpf_prog *prog = __data; \ CONCATENATE(bpf_trace_run, COUNT_ARGS(args))(prog, CAST_TO_U64(args)); \ } /* * This part is compiled out, it is only here as a build time check * to make sure that if the tracepoint handling changes, the * bpf probe will fail to compile unless it too is updated. */ #define __DEFINE_EVENT(template, call, proto, args, size) \ static inline void bpf_test_probe_##call(void) \ { \ check_trace_callback_type_##call(__bpf_trace_##template); \ } \ typedef void (*btf_trace_##call)(void *__data, proto); \ static union { \ struct bpf_raw_event_map event; \ btf_trace_##call handler; \ } __bpf_trace_tp_map_##call __used \ __section("__bpf_raw_tp_map") = { \ .event = { \ .tp = &__tracepoint_##call, \ .bpf_func = __bpf_trace_##template, \ .num_args = COUNT_ARGS(args), \ .writable_size = size, \ }, \ }; #define FIRST(x, ...) x #undef DEFINE_EVENT_WRITABLE #define DEFINE_EVENT_WRITABLE(template, call, proto, args, size) \ static inline void bpf_test_buffer_##call(void) \ { \ /* BUILD_BUG_ON() is ignored if the code is completely eliminated, but \ * BUILD_BUG_ON_ZERO() uses a different mechanism that is not \ * dead-code-eliminated. \ */ \ FIRST(proto); \ (void)BUILD_BUG_ON_ZERO(size != sizeof(*FIRST(args))); \ } \ __DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), size) #undef DEFINE_EVENT #define DEFINE_EVENT(template, call, proto, args) \ __DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args), 0) #undef DEFINE_EVENT_PRINT #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args)) #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) #undef DEFINE_EVENT_WRITABLE #undef __DEFINE_EVENT #undef FIRST #endif /* CONFIG_BPF_EVENTS */
#include <arm_neon.h> /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ int32x4x4_t f_vld4q_lane_s32 (int32_t * p, int32x4x4_t v) { int32x4x4_t res; /* { dg-error "lane 4 out of range 0 - 3" "" { target *-*-* } 0 } */ res = vld4q_lane_s32 (p, v, 4); /* { dg-error "lane -1 out of range 0 - 3" "" { target *-*-* } 0 } */ res = vld4q_lane_s32 (p, v, -1); return res; }
/* * Common time prototypes and such for all ppc machines. * * Written by Cort Dougan (cort@cs.nmt.edu) to merge * Paul Mackerras' version and mine for PReP and Pmac. * * 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 __POWERPC_TIME_H #define __POWERPC_TIME_H #ifdef __KERNEL__ #include <linux/types.h> #include <linux/percpu.h> #include <asm/processor.h> /* time.c */ extern unsigned long tb_ticks_per_jiffy; extern unsigned long tb_ticks_per_usec; extern unsigned long tb_ticks_per_sec; extern struct clock_event_device decrementer_clockevent; struct rtc_time; extern void to_tm(int tim, struct rtc_time * tm); extern void tick_broadcast_ipi_handler(void); extern void generic_calibrate_decr(void); extern void set_dec_cpu6(unsigned int val); /* Some sane defaults: 125 MHz timebase, 1GHz processor */ extern unsigned long ppc_proc_freq; #define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) extern unsigned long ppc_tb_freq; #define DEFAULT_TB_FREQ 125000000UL struct div_result { u64 result_high; u64 result_low; }; /* Accessor functions for the timebase (RTC on 601) registers. */ /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ #ifdef CONFIG_6xx #define __USE_RTC() (!cpu_has_feature(CPU_FTR_USE_TB)) #else #define __USE_RTC() 0 #endif #ifdef CONFIG_PPC64 /* For compatibility, get_tbl() is defined as get_tb() on ppc64 */ #define get_tbl get_tb #else static inline unsigned long get_tbl(void) { #if defined(CONFIG_403GCX) unsigned long tbl; asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); return tbl; #else return mftbl(); #endif } static inline unsigned int get_tbu(void) { #ifdef CONFIG_403GCX unsigned int tbu; asm volatile("mfspr %0, 0x3dc" : "=r" (tbu)); return tbu; #else return mftbu(); #endif } #endif /* !CONFIG_PPC64 */ static inline unsigned int get_rtcl(void) { unsigned int rtcl; asm volatile("mfrtcl %0" : "=r" (rtcl)); return rtcl; } static inline u64 get_rtc(void) { unsigned int hi, lo, hi2; do { asm volatile("mfrtcu %0; mfrtcl %1; mfrtcu %2" : "=r" (hi), "=r" (lo), "=r" (hi2)); } while (hi2 != hi); return (u64)hi * 1000000000 + lo; } static inline u64 get_vtb(void) { #ifdef CONFIG_PPC_BOOK3S_64 if (cpu_has_feature(CPU_FTR_ARCH_207S)) return mfvtb(); #endif return 0; } #ifdef CONFIG_PPC64 static inline u64 get_tb(void) { return mftb(); } #else /* CONFIG_PPC64 */ static inline u64 get_tb(void) { unsigned int tbhi, tblo, tbhi2; do { tbhi = get_tbu(); tblo = get_tbl(); tbhi2 = get_tbu(); } while (tbhi != tbhi2); return ((u64)tbhi << 32) | tblo; } #endif /* !CONFIG_PPC64 */ static inline u64 get_tb_or_rtc(void) { return __USE_RTC() ? get_rtc() : get_tb(); } static inline void set_tb(unsigned int upper, unsigned int lower) { mtspr(SPRN_TBWL, 0); mtspr(SPRN_TBWU, upper); mtspr(SPRN_TBWL, lower); } /* Accessor functions for the decrementer register. * The 4xx doesn't even have a decrementer. I tried to use the * generic timer interrupt code, which seems OK, with the 4xx PIT * in auto-reload mode. The problem is PIT stops counting when it * hits zero. If it would wrap, we could use it just like a decrementer. */ static inline unsigned int get_dec(void) { #if defined(CONFIG_40x) return (mfspr(SPRN_PIT)); #else return (mfspr(SPRN_DEC)); #endif } /* * Note: Book E and 4xx processors differ from other PowerPC processors * in when the decrementer generates its interrupt: on the 1 to 0 * transition for Book E/4xx, but on the 0 to -1 transition for others. */ static inline void set_dec(int val) { #if defined(CONFIG_40x) mtspr(SPRN_PIT, val); #elif defined(CONFIG_8xx_CPU6) set_dec_cpu6(val - 1); #else #ifndef CONFIG_BOOKE --val; #endif mtspr(SPRN_DEC, val); #endif /* not 40x or 8xx_CPU6 */ } static inline unsigned long tb_ticks_since(unsigned long tstamp) { if (__USE_RTC()) { int delta = get_rtcl() - (unsigned int) tstamp; return delta < 0 ? delta + 1000000000 : delta; } return get_tbl() - tstamp; } #define mulhwu(x,y) \ ({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) #ifdef CONFIG_PPC64 #define mulhdu(x,y) \ ({unsigned long z; asm ("mulhdu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) #else extern u64 mulhdu(u64, u64); #endif extern void div128_by_32(u64 dividend_high, u64 dividend_low, unsigned divisor, struct div_result *dr); /* Used to store Processor Utilization register (purr) values */ struct cpu_usage { u64 current_tb; /* Holds the current purr register values */ }; DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); extern void secondary_cpu_time_init(void); DECLARE_PER_CPU(u64, decrementers_next_tb); /* Convert timebase ticks to nanoseconds */ unsigned long long tb_to_ns(unsigned long long tb_ticks); #endif /* __KERNEL__ */ #endif /* __POWERPC_TIME_H */
/******************************************************************************* * Copyright 2016 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * \file mkl_elementwise-inl.h * \brief * \author lingyan.guo@intel.com * zhenlin.luo@intel.com * *******************************************************************************/ #ifndef MXNET_OPERATOR_MKL_MKL_ELEMENTWISE_SUM_INL_H_ #define MXNET_OPERATOR_MKL_MKL_ELEMENTWISE_SUM_INL_H_ #include <dmlc/logging.h> #include <dmlc/parameter.h> #include <mxnet/operator.h> #include <cstring> #include <map> #include <string> #include <vector> #include <utility> #include "../operator_common.h" #include "../mshadow_op.h" #include "./mkl_util-inl.h" namespace mxnet { namespace op { template<typename xpu, typename DType> static void LayerSetUp(const std::vector<mshadow::Tensor<xpu, 1, DType> > &data, size_t data_shape_size, std::shared_ptr<MKLData<DType> > fwd_top_data) { // Whether to use an asymptotically slower (for >2 inputs) but stabler method // of computing the gradient for the PROD operation. (No effect for SUM op.) // stable_prod_grad_ = 1; size_t dim_src = data_shape_size; size_t *sizes_src = new size_t[dim_src]; size_t *strides_src = new size_t[dim_src]; for (size_t d = 0; d < dim_src; ++d) { sizes_src[d] = data[0].shape_[dim_src - d - 1]; strides_src[d] = (d == 0) ? 1 : strides_src[d - 1] * sizes_src[d - 1]; } fwd_top_data->create_user_layout(dim_src, sizes_src, strides_src); delete[] sizes_src; delete[] strides_src; } template<typename xpu, typename DType> void MKLElementWiseSumCompute_(const nnvm::NodeAttrs& attrs, const OpContext& ctx, const std::vector<TBlob>& in_data, const std::vector<OpReqType>& req, const std::vector<TBlob>& out_data) { using namespace mshadow; using namespace mshadow::expr; if (req[0] == kNullOp) return; size_t size = in_data.size(); Stream<xpu> *s = ctx.get_stream<xpu>(); std::vector<Tensor<xpu, 1, DType> > data(size); Tensor<xpu, 1, DType> out = out_data[0].FlatTo1D<xpu, DType>(s); bool in_place_flag = false; int in_place_idx = 0; for (size_t i = 0; i < size; ++i) { data[i] = in_data[i].FlatTo1D<xpu, DType>(s); if (data[i].dptr_ == out.dptr_) { in_place_idx = i; in_place_flag = true; } } std::shared_ptr<MKLData<DType> > fwd_top_data = MKLData<DType>::create(); std::vector<DType> coeffs_ = std::vector<DType>(data.size(), 1); LayerSetUp(data, 1, fwd_top_data); dnnError_t e; void *eltwise_res[dnnResourceNumber]; dnnPrimitive_t sumPrimitive = NULL; e = dnnSumCreate<DType>(&sumPrimitive, NULL, size, fwd_top_data->layout_usr, &coeffs_[0]); CHECK_EQ(e, E_SUCCESS); eltwise_res[dnnResourceDst] = reinterpret_cast<void*>(const_cast<DType*>(out.dptr_)); eltwise_res[dnnResourceMultipleSrc] = reinterpret_cast<void *>(reinterpret_cast<void *>(in_data[in_place_idx].dptr_)); for (size_t i = 1; i < size; ++i) { if (i == in_place_idx) continue; eltwise_res[dnnResourceMultipleSrc + i] = reinterpret_cast<void *>(reinterpret_cast<void *>(in_data[i].dptr_)); } e = dnnExecute<DType>(sumPrimitive, eltwise_res); CHECK_EQ(e, E_SUCCESS); if (sumPrimitive != NULL) { dnnDelete<DType>(sumPrimitive); sumPrimitive = NULL; } } } // namespace op } // namespace mxnet #endif // MXNET_OPERATOR_MKL_MKL_ELEMENTWISE_SUM_INL_H_
/* * Copyright (c) 2010 Broadcom Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __BCMSDH_SDMMC_H__ #define __BCMSDH_SDMMC_H__ #ifdef BCMDBG #define sd_err(x) \ do { \ if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \ printk x; \ } while (0) #define sd_trace(x) \ do { \ if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \ printk x; \ } while (0) #define sd_info(x) \ do { \ if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \ printk x; \ } while (0) #define sd_debug(x) \ do { \ if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \ printk x; \ } while (0) #define sd_data(x) \ do { \ if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \ printk x; \ } while (0) #define sd_ctrl(x) \ do { \ if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \ printk x; \ } while (0) #else #define sd_err(x) #define sd_trace(x) #define sd_info(x) #define sd_debug(x) #define sd_data(x) #define sd_ctrl(x) #endif /* Allocate/init/free per-OS private data */ extern int sdioh_sdmmc_osinit(sdioh_info_t *sd); extern void sdioh_sdmmc_osfree(sdioh_info_t *sd); #define BLOCK_SIZE_64 64 #define BLOCK_SIZE_512 512 #define BLOCK_SIZE_4318 64 #define BLOCK_SIZE_4328 512 /* internal return code */ #define SUCCESS 0 #define ERROR 1 /* private bus modes */ #define SDIOH_MODE_SD4 2 #define CLIENT_INTR 0x100 /* Get rid of this! */ struct sdioh_info { struct osl_info *osh; /* osh handler */ bool client_intr_enabled; /* interrupt connnected flag */ bool intr_handler_valid; /* client driver interrupt handler valid */ sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ void *intr_handler_arg; /* argument to call interrupt handler */ u16 intmask; /* Current active interrupts */ void *sdos_info; /* Pointer to per-OS private data */ uint irq; /* Client irq */ int intrcount; /* Client interrupts */ bool sd_use_dma; /* DMA on CMD53 */ bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */ /* Must be on for sd_multiblock to be effective */ bool use_client_ints; /* If this is false, make sure to restore */ int sd_mode; /* SD1/SD4/SPI */ int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ u8 num_funcs; /* Supported funcs on client */ u32 com_cis_ptr; u32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; uint max_dma_len; uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */ /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */ }; /************************************************************ * Internal interfaces: per-port references into bcmsdh_sdmmc.c */ /* Global message bits */ extern uint sd_msglevel; /* OS-independent interrupt handler */ extern bool check_client_intr(sdioh_info_t *sd); /* Core interrupt enable/disable of device interrupts */ extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); /************************************************************** * Internal interfaces: bcmsdh_sdmmc.c references to per-port code */ /* Register mapping routines */ extern u32 *sdioh_sdmmc_reg_map(s32 addr, int size); extern void sdioh_sdmmc_reg_unmap(s32 addr, int size); /* Interrupt (de)registration routines */ extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd); typedef struct _BCMSDH_SDMMC_INSTANCE { sdioh_info_t *sd; struct sdio_func *func[SDIOD_MAX_IOFUNCS]; u32 host_claimed; } BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE; #endif /* __BCMSDH_SDMMC_H__ */
/* * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. * Copyright (C) 2010 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 TextControlInnerElements_h #define TextControlInnerElements_h #include "HTMLDivElement.h" #include "SpeechInputListener.h" #include "Timer.h" #include <wtf/Forward.h> namespace WebCore { class SpeechInput; class TextControlInnerElement : public HTMLDivElement { public: static PassRefPtr<TextControlInnerElement> create(HTMLElement* shadowParent); virtual void detach(); void attachInnerElement(Node*, PassRefPtr<RenderStyle>, RenderArena*); protected: TextControlInnerElement(Document*, HTMLElement* shadowParent = 0); private: virtual bool isMouseFocusable() const { return false; } }; class TextControlInnerTextElement : public TextControlInnerElement { public: static PassRefPtr<TextControlInnerTextElement> create(Document*, HTMLElement* shadowParent); virtual void defaultEventHandler(Event*); private: TextControlInnerTextElement(Document*, HTMLElement* shadowParent); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; class SearchFieldResultsButtonElement : public TextControlInnerElement { public: static PassRefPtr<SearchFieldResultsButtonElement> create(Document*); virtual void defaultEventHandler(Event*); private: SearchFieldResultsButtonElement(Document*); }; class SearchFieldCancelButtonElement : public TextControlInnerElement { public: static PassRefPtr<SearchFieldCancelButtonElement> create(Document*); virtual void defaultEventHandler(Event*); private: SearchFieldCancelButtonElement(Document*); virtual void detach(); bool m_capturing; }; class SpinButtonElement : public TextControlInnerElement { public: enum UpDownState { Indeterminate, // Hovered, but the event is not handled. Down, Up, }; static PassRefPtr<SpinButtonElement> create(HTMLElement*); UpDownState upDownState() const { return m_upDownState; } private: SpinButtonElement(HTMLElement*); virtual void detach(); virtual bool isSpinButtonElement() const { return true; } // FIXME: shadowAncestorNode() should be const. virtual bool isEnabledFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isEnabledFormControl(); } virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); } virtual void defaultEventHandler(Event*); void startRepeatingTimer(); void stopRepeatingTimer(); void repeatingTimerFired(Timer<SpinButtonElement>*); virtual void setHovered(bool = true); bool m_capturing; UpDownState m_upDownState; UpDownState m_pressStartingState; Timer<SpinButtonElement> m_repeatingTimer; }; #if ENABLE(INPUT_SPEECH) class InputFieldSpeechButtonElement : public TextControlInnerElement, public SpeechInputListener { public: enum SpeechInputState { Idle, Recording, Recognizing, }; static PassRefPtr<InputFieldSpeechButtonElement> create(HTMLElement*); virtual ~InputFieldSpeechButtonElement(); virtual void detach(); virtual void defaultEventHandler(Event*); virtual bool isInputFieldSpeechButtonElement() const { return true; } SpeechInputState state() const { return m_state; } // SpeechInputListener methods. void didCompleteRecording(int); void didCompleteRecognition(int); void setRecognitionResult(int, const SpeechInputResultArray&); private: InputFieldSpeechButtonElement(HTMLElement*); SpeechInput* speechInput(); void setState(SpeechInputState state); bool m_capturing; SpeechInputState m_state; int m_listenerId; SpeechInputResultArray m_results; }; inline InputFieldSpeechButtonElement* toInputFieldSpeechButtonElement(Element* element) { ASSERT(!element || element->isInputFieldSpeechButtonElement()); return static_cast<InputFieldSpeechButtonElement*>(element); } #endif // ENABLE(INPUT_SPEECH) } // namespace #endif
// // MIT License // // Copyright (c) 2014 Bob McCune http://bobmccune.com/ // Copyright (c) 2014 TapHarmonic, LLC http://tapharmonic.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 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. // #import "THTimelineViewController.h" @interface THTimelineDataSource : NSObject <UICollectionViewDataSource, UICollectionViewDelegateTimelineLayout> + (id)dataSourceWithController:(THTimelineViewController *)controller; - (void)resetTimeline; - (void)clearTimeline; @property (strong, nonatomic) NSMutableArray *timelineItems; @end
/* aries-watchdog.c * * Copyright (C) 2010 Google, Inc. * * 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. * */ #include <plat/regs-watchdog.h> #include <mach/map.h> #include <linux/module.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/pm.h> #include <linux/cpufreq.h> #include <linux/err.h> #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/io.h> /* reset timeout in PCLK/256/128 (~2048:1s) */ static unsigned watchdog_reset = (30 * 2048); /* pet timeout in jiffies */ static unsigned watchdog_pet = (10 * HZ); static struct workqueue_struct *watchdog_wq; static void watchdog_workfunc(struct work_struct *work); static DECLARE_DELAYED_WORK(watchdog_work, watchdog_workfunc); static void watchdog_workfunc(struct work_struct *work) { writel(watchdog_reset, S3C2410_WTCNT); queue_delayed_work(watchdog_wq, &watchdog_work, watchdog_pet); } static void watchdog_start(void) { unsigned int val; /* set to PCLK / 256 / 128 */ val = S3C2410_WTCON_DIV128; val |= S3C2410_WTCON_PRESCALE(255); writel(val, S3C2410_WTCON); /* program initial count */ writel(watchdog_reset, S3C2410_WTCNT); writel(watchdog_reset, S3C2410_WTDAT); /* start timer */ val |= S3C2410_WTCON_RSTEN | S3C2410_WTCON_ENABLE; writel(val, S3C2410_WTCON); /* make sure we're ready to pet the dog */ queue_delayed_work(watchdog_wq, &watchdog_work, watchdog_pet); } static void watchdog_stop(void) { writel(0, S3C2410_WTCON); } static int watchdog_probe(struct platform_device *pdev) { watchdog_wq = create_rt_workqueue("pet_watchdog"); watchdog_start(); return 0; } static int watchdog_suspend(struct device *dev) { watchdog_stop(); return 0; } static int watchdog_resume(struct device *dev) { watchdog_start(); return 0; } static struct dev_pm_ops watchdog_pm_ops = { .suspend_noirq = watchdog_suspend, .resume_noirq = watchdog_resume, }; static struct platform_driver watchdog_driver = { .probe = watchdog_probe, .driver = { .owner = THIS_MODULE, .name = "watchdog", .pm = &watchdog_pm_ops, }, }; static int __init watchdog_init(void) { return platform_driver_register(&watchdog_driver); } module_init(watchdog_init);
/* Copyright 2020 AAClawson (AlisGraveNil) * * 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, see <http://www.gnu.org/licenses/>. */ #pragma once #include "quantum.h" #define LAYOUT( \ K00, K01, K02, K03, K04, K05, K06, \ K10, K11, K12, K13, K14, K15, K16, \ K23, K24, K25, \ K31, K33, K34, K35, K36, \ K40, K41, K42, K43, K45 \ ) { \ { K00, K01, K02, K03, K04, K05, K06 }, \ { K10, K11, K12, K13, K14, K15, K16 }, \ { KC_NO, KC_NO, KC_NO, K23, K24, K25, KC_NO }, \ { KC_NO, K31, KC_NO, K33, K34, K35, K36 }, \ { K40, K41, K42, K43, KC_NO, K45, KC_NO }, \ }
/* arch/arm/mach-s5p6442/include/mach/vmalloc.h * * Copyright 2010 Ben Dooks <ben-linux@fluff.org> * * 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. * * S5P6442 vmalloc definition */ #ifndef __ASM_ARCH_VMALLOC_H #define __ASM_ARCH_VMALLOC_H #define VMALLOC_END 0xF6000000UL #endif /* __ASM_ARCH_VMALLOC_H */
// SPDX-License-Identifier: GPL-2.0-only /* * ARC700 mmap * * (started from arm version - for VIPT alias handling) * * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) */ #include <linux/fs.h> #include <linux/mm.h> #include <linux/mman.h> #include <linux/sched/mm.h> #include <asm/cacheflush.h> #define COLOUR_ALIGN(addr, pgoff) \ ((((addr) + SHMLBA - 1) & ~(SHMLBA - 1)) + \ (((pgoff) << PAGE_SHIFT) & (SHMLBA - 1))) /* * Ensure that shared mappings are correctly aligned to * avoid aliasing issues with VIPT caches. * We need to ensure that * a specific page of an object is always mapped at a multiple of * SHMLBA bytes. */ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; int do_align = 0; int aliasing = cache_is_vipt_aliasing(); struct vm_unmapped_area_info info; /* * We only need to do colour alignment if D cache aliases. */ if (aliasing) do_align = filp || (flags & MAP_SHARED); /* * We enforce the MAP_FIXED case. */ if (flags & MAP_FIXED) { if (aliasing && flags & MAP_SHARED && (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)) return -EINVAL; return addr; } if (len > TASK_SIZE) return -ENOMEM; if (addr) { if (do_align) addr = COLOUR_ALIGN(addr, pgoff); else addr = PAGE_ALIGN(addr); vma = find_vma(mm, addr); if (TASK_SIZE - len >= addr && (!vma || addr + len <= vm_start_gap(vma))) return addr; } info.flags = 0; info.length = len; info.low_limit = mm->mmap_base; info.high_limit = TASK_SIZE; info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0; info.align_offset = pgoff << PAGE_SHIFT; return vm_unmapped_area(&info); }
#include "p18.h"
/* * Byte order utilities * * Copyright (C) 1999-2010, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * * $Id: bcmendian.h,v 1.31.302.1.16.1 2009-02-03 18:34:31 Exp $ * * This file by default provides proper behavior on little-endian architectures. * On big-endian architectures, IL_BIGENDIAN should be defined. */ #ifndef _BCMENDIAN_H_ #define _BCMENDIAN_H_ #include <typedefs.h> #define BCMSWAP16(val) \ ((uint16)((((uint16)(val) & (uint16)0x00ffU) << 8) | \ (((uint16)(val) & (uint16)0xff00U) >> 8))) #define BCMSWAP32(val) \ ((uint32)((((uint32)(val) & (uint32)0x000000ffU) << 24) | \ (((uint32)(val) & (uint32)0x0000ff00U) << 8) | \ (((uint32)(val) & (uint32)0x00ff0000U) >> 8) | \ (((uint32)(val) & (uint32)0xff000000U) >> 24))) #define BCMSWAP32BY16(val) \ ((uint32)((((uint32)(val) & (uint32)0x0000ffffU) << 16) | \ (((uint32)(val) & (uint32)0xffff0000U) >> 16))) static INLINE uint16 bcmswap16(uint16 val) { return BCMSWAP16(val); } static INLINE uint32 bcmswap32(uint32 val) { return BCMSWAP32(val); } static INLINE uint32 bcmswap32by16(uint32 val) { return BCMSWAP32BY16(val); } static INLINE void bcmswap16_buf(uint16 *buf, uint len) { len = len / 2; while (len--) { *buf = bcmswap16(*buf); buf++; } } #ifndef hton16 #ifndef IL_BIGENDIAN #define HTON16(i) BCMSWAP16(i) #define HTON32(i) BCMSWAP32(i) #define hton16(i) bcmswap16(i) #define hton32(i) bcmswap32(i) #define ntoh16(i) bcmswap16(i) #define ntoh32(i) bcmswap32(i) #define HTOL16(i) (i) #define HTOL32(i) (i) #define ltoh16(i) (i) #define ltoh32(i) (i) #define htol16(i) (i) #define htol32(i) (i) #else #define HTON16(i) (i) #define HTON32(i) (i) #define hton16(i) (i) #define hton32(i) (i) #define ntoh16(i) (i) #define ntoh32(i) (i) #define HTOL16(i) BCMSWAP16(i) #define HTOL32(i) BCMSWAP32(i) #define ltoh16(i) bcmswap16(i) #define ltoh32(i) bcmswap32(i) #define htol16(i) bcmswap16(i) #define htol32(i) bcmswap32(i) #endif #endif #ifndef IL_BIGENDIAN #define ltoh16_buf(buf, i) #define htol16_buf(buf, i) #else #define ltoh16_buf(buf, i) bcmswap16_buf((uint16 *)buf, i) #define htol16_buf(buf, i) bcmswap16_buf((uint16 *)buf, i) #endif static INLINE void htol16_ua_store(uint16 val, uint8 *bytes) { bytes[0] = val & 0xff; bytes[1] = val >> 8; } static INLINE void htol32_ua_store(uint32 val, uint8 *bytes) { bytes[0] = val & 0xff; bytes[1] = (val >> 8) & 0xff; bytes[2] = (val >> 16) & 0xff; bytes[3] = val >> 24; } static INLINE void hton16_ua_store(uint16 val, uint8 *bytes) { bytes[0] = val >> 8; bytes[1] = val & 0xff; } static INLINE void hton32_ua_store(uint32 val, uint8 *bytes) { bytes[0] = val >> 24; bytes[1] = (val >> 16) & 0xff; bytes[2] = (val >> 8) & 0xff; bytes[3] = val & 0xff; } #define _LTOH16_UA(cp) ((cp)[0] | ((cp)[1] << 8)) #define _LTOH32_UA(cp) ((cp)[0] | ((cp)[1] << 8) | ((cp)[2] << 16) | ((cp)[3] << 24)) #define _NTOH16_UA(cp) (((cp)[0] << 8) | (cp)[1]) #define _NTOH32_UA(cp) (((cp)[0] << 24) | ((cp)[1] << 16) | ((cp)[2] << 8) | (cp)[3]) static INLINE uint16 ltoh16_ua(const void *bytes) { return _LTOH16_UA((const uint8 *)bytes); } static INLINE uint32 ltoh32_ua(const void *bytes) { return _LTOH32_UA((const uint8 *)bytes); } static INLINE uint16 ntoh16_ua(const void *bytes) { return _NTOH16_UA((const uint8 *)bytes); } static INLINE uint32 ntoh32_ua(const void *bytes) { return _NTOH32_UA((const uint8 *)bytes); } #define ltoh_ua(ptr) \ (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)ptr : \ sizeof(*(ptr)) == sizeof(uint16) ? _LTOH16_UA((const uint8 *)ptr) : \ sizeof(*(ptr)) == sizeof(uint32) ? _LTOH32_UA((const uint8 *)ptr) : \ 0xfeedf00d) #define ntoh_ua(ptr) \ (sizeof(*(ptr)) == sizeof(uint8) ? *(const uint8 *)ptr : \ sizeof(*(ptr)) == sizeof(uint16) ? _NTOH16_UA((const uint8 *)ptr) : \ sizeof(*(ptr)) == sizeof(uint32) ? _NTOH32_UA((const uint8 *)ptr) : \ 0xfeedf00d) #endif
/* * Copyright (C) 2017-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "cores/GameSettings.h" #include "utils/Observer.h" #include <string> class CGameSettings : public Observable { public: CGameSettings() { Reset(); } CGameSettings(const CGameSettings &other) { *this = other; } CGameSettings &operator=(const CGameSettings &rhs); // Restore game settings to default void Reset(); bool operator==(const CGameSettings &rhs) const; bool operator!=(const CGameSettings &rhs) const { return !(*this == rhs); } const std::string &VideoFilter() const { return m_videoFilter; } void SetVideoFilter(const std::string &videoFilter); KODI::RETRO::STRETCHMODE StretchMode() const { return m_stretchMode; } void SetStretchMode(KODI::RETRO::STRETCHMODE stretchMode); unsigned int RotationDegCCW() const { return m_rotationDegCCW; } void SetRotationDegCCW(unsigned int rotation); private: // Video settings std::string m_videoFilter; KODI::RETRO::STRETCHMODE m_stretchMode; unsigned int m_rotationDegCCW; };
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_ #define ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_ #include "base/debug/trace_event.h" namespace android_webview { namespace devtools_instrumentation { namespace internal { const char kCategory[] = "Java,devtools,disabled-by-default-devtools.timeline"; const char kEmbedderCallback[] = "EmbedderCallback"; const char kCallbackNameArgument[] = "callbackName"; } // namespace internal class ScopedEmbedderCallbackTask { public: ScopedEmbedderCallbackTask(const char* callback_name) { TRACE_EVENT_BEGIN1(internal::kCategory, internal::kEmbedderCallback, internal::kCallbackNameArgument, callback_name); } ~ScopedEmbedderCallbackTask() { TRACE_EVENT_END0(internal::kCategory, internal::kEmbedderCallback); } private: DISALLOW_COPY_AND_ASSIGN(ScopedEmbedderCallbackTask); }; } // namespace devtools_instrumentation } // namespace android_webview #endif // ANDROID_WEBVIEW_COMMON_DEVTOOLS_INSTRUMENTATION_H_
#include "cache.h" /* * Do not use this for inspecting *tracked* content. When path is a * symlink to a directory, we do not want to say it is a directory when * dealing with tracked content in the working tree. */ static int is_directory(const char *path) { struct stat st; return (!stat(path, &st) && S_ISDIR(st.st_mode)); } /* We allow "recursive" symbolic links. Only within reason, though. */ #define MAXDEPTH 5 const char *make_absolute_path(const char *path) { static char bufs[2][PATH_MAX + 1], *buf = bufs[0], *next_buf = bufs[1]; char cwd[1024] = ""; int buf_index = 1, len; int depth = MAXDEPTH; char *last_elem = NULL; struct stat st; if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) die ("Too long path: %.*s", 60, path); while (depth--) { if (!is_directory(buf)) { char *last_slash = strrchr(buf, '/'); if (last_slash) { *last_slash = '\0'; last_elem = xstrdup(last_slash + 1); } else { last_elem = xstrdup(buf); *buf = '\0'; } } if (*buf) { if (!*cwd && !getcwd(cwd, sizeof(cwd))) die ("Could not get current working directory"); if (chdir(buf)) die ("Could not switch to '%s'", buf); } if (!getcwd(buf, PATH_MAX)) die ("Could not get current working directory"); if (last_elem) { len = strlen(buf); if (len + strlen(last_elem) + 2 > PATH_MAX) die ("Too long path name: '%s/%s'", buf, last_elem); buf[len] = '/'; strcpy(buf + len + 1, last_elem); free(last_elem); last_elem = NULL; } if (!lstat(buf, &st) && S_ISLNK(st.st_mode)) { len = readlink(buf, next_buf, PATH_MAX); if (len < 0) die ("Invalid symlink: %s", buf); if (PATH_MAX <= len) die("symbolic link too long: %s", buf); next_buf[len] = '\0'; buf = next_buf; buf_index = 1 - buf_index; next_buf = bufs[buf_index]; } else break; } if (*cwd && chdir(cwd)) die ("Could not change back to '%s'", cwd); return buf; } static const char *get_pwd_cwd(void) { static char cwd[PATH_MAX + 1]; char *pwd; struct stat cwd_stat, pwd_stat; if (getcwd(cwd, PATH_MAX) == NULL) return NULL; pwd = getenv("PWD"); if (pwd && strcmp(pwd, cwd)) { stat(cwd, &cwd_stat); if (!stat(pwd, &pwd_stat) && pwd_stat.st_dev == cwd_stat.st_dev && pwd_stat.st_ino == cwd_stat.st_ino) { strlcpy(cwd, pwd, PATH_MAX); } } return cwd; } const char *make_nonrelative_path(const char *path) { static char buf[PATH_MAX + 1]; if (is_absolute_path(path)) { if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) die("Too long path: %.*s", 60, path); } else { const char *cwd = get_pwd_cwd(); if (!cwd) die("Cannot determine the current working directory"); if (snprintf(buf, PATH_MAX, "%s/%s", cwd, path) >= PATH_MAX) die("Too long path: %.*s", 60, path); } return buf; }
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Machine check exception header file. * * Copyright 2013 IBM Corporation * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> */ #ifndef __ASM_PPC64_MCE_H__ #define __ASM_PPC64_MCE_H__ #include <linux/bitops.h> enum MCE_Version { MCE_V1 = 1, }; enum MCE_Severity { MCE_SEV_NO_ERROR = 0, MCE_SEV_WARNING = 1, MCE_SEV_SEVERE = 2, MCE_SEV_FATAL = 3, }; enum MCE_Disposition { MCE_DISPOSITION_RECOVERED = 0, MCE_DISPOSITION_NOT_RECOVERED = 1, }; enum MCE_Initiator { MCE_INITIATOR_UNKNOWN = 0, MCE_INITIATOR_CPU = 1, MCE_INITIATOR_PCI = 2, MCE_INITIATOR_ISA = 3, MCE_INITIATOR_MEMORY= 4, MCE_INITIATOR_POWERMGM = 5, }; enum MCE_ErrorType { MCE_ERROR_TYPE_UNKNOWN = 0, MCE_ERROR_TYPE_UE = 1, MCE_ERROR_TYPE_SLB = 2, MCE_ERROR_TYPE_ERAT = 3, MCE_ERROR_TYPE_TLB = 4, MCE_ERROR_TYPE_USER = 5, MCE_ERROR_TYPE_RA = 6, MCE_ERROR_TYPE_LINK = 7, MCE_ERROR_TYPE_DCACHE = 8, MCE_ERROR_TYPE_ICACHE = 9, }; enum MCE_ErrorClass { MCE_ECLASS_UNKNOWN = 0, MCE_ECLASS_HARDWARE, MCE_ECLASS_HARD_INDETERMINATE, MCE_ECLASS_SOFTWARE, MCE_ECLASS_SOFT_INDETERMINATE, }; enum MCE_UeErrorType { MCE_UE_ERROR_INDETERMINATE = 0, MCE_UE_ERROR_IFETCH = 1, MCE_UE_ERROR_PAGE_TABLE_WALK_IFETCH = 2, MCE_UE_ERROR_LOAD_STORE = 3, MCE_UE_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 4, }; enum MCE_SlbErrorType { MCE_SLB_ERROR_INDETERMINATE = 0, MCE_SLB_ERROR_PARITY = 1, MCE_SLB_ERROR_MULTIHIT = 2, }; enum MCE_EratErrorType { MCE_ERAT_ERROR_INDETERMINATE = 0, MCE_ERAT_ERROR_PARITY = 1, MCE_ERAT_ERROR_MULTIHIT = 2, }; enum MCE_TlbErrorType { MCE_TLB_ERROR_INDETERMINATE = 0, MCE_TLB_ERROR_PARITY = 1, MCE_TLB_ERROR_MULTIHIT = 2, }; enum MCE_UserErrorType { MCE_USER_ERROR_INDETERMINATE = 0, MCE_USER_ERROR_TLBIE = 1, }; enum MCE_RaErrorType { MCE_RA_ERROR_INDETERMINATE = 0, MCE_RA_ERROR_IFETCH = 1, MCE_RA_ERROR_IFETCH_FOREIGN = 2, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH = 3, MCE_RA_ERROR_PAGE_TABLE_WALK_IFETCH_FOREIGN = 4, MCE_RA_ERROR_LOAD = 5, MCE_RA_ERROR_STORE = 6, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE = 7, MCE_RA_ERROR_PAGE_TABLE_WALK_LOAD_STORE_FOREIGN = 8, MCE_RA_ERROR_LOAD_STORE_FOREIGN = 9, }; enum MCE_LinkErrorType { MCE_LINK_ERROR_INDETERMINATE = 0, MCE_LINK_ERROR_IFETCH_TIMEOUT = 1, MCE_LINK_ERROR_PAGE_TABLE_WALK_IFETCH_TIMEOUT = 2, MCE_LINK_ERROR_LOAD_TIMEOUT = 3, MCE_LINK_ERROR_STORE_TIMEOUT = 4, MCE_LINK_ERROR_PAGE_TABLE_WALK_LOAD_STORE_TIMEOUT = 5, }; struct machine_check_event { enum MCE_Version version:8; u8 in_use; enum MCE_Severity severity:8; enum MCE_Initiator initiator:8; enum MCE_ErrorType error_type:8; enum MCE_ErrorClass error_class:8; enum MCE_Disposition disposition:8; bool sync_error; u16 cpu; u64 gpr3; u64 srr0; u64 srr1; union { struct { enum MCE_UeErrorType ue_error_type:8; u8 effective_address_provided; u8 physical_address_provided; u8 ignore_event; u8 reserved_1[4]; u64 effective_address; u64 physical_address; u8 reserved_2[8]; } ue_error; struct { enum MCE_SlbErrorType slb_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } slb_error; struct { enum MCE_EratErrorType erat_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } erat_error; struct { enum MCE_TlbErrorType tlb_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } tlb_error; struct { enum MCE_UserErrorType user_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } user_error; struct { enum MCE_RaErrorType ra_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } ra_error; struct { enum MCE_LinkErrorType link_error_type:8; u8 effective_address_provided; u8 reserved_1[6]; u64 effective_address; u8 reserved_2[16]; } link_error; } u; }; struct mce_error_info { enum MCE_ErrorType error_type:8; union { enum MCE_UeErrorType ue_error_type:8; enum MCE_SlbErrorType slb_error_type:8; enum MCE_EratErrorType erat_error_type:8; enum MCE_TlbErrorType tlb_error_type:8; enum MCE_UserErrorType user_error_type:8; enum MCE_RaErrorType ra_error_type:8; enum MCE_LinkErrorType link_error_type:8; } u; enum MCE_Severity severity:8; enum MCE_Initiator initiator:8; enum MCE_ErrorClass error_class:8; bool sync_error; bool ignore_event; }; #define MAX_MC_EVT 100 /* Release flags for get_mce_event() */ #define MCE_EVENT_RELEASE true #define MCE_EVENT_DONTRELEASE false extern void save_mce_event(struct pt_regs *regs, long handled, struct mce_error_info *mce_err, uint64_t nip, uint64_t addr, uint64_t phys_addr); extern int get_mce_event(struct machine_check_event *mce, bool release); extern void release_mce_event(void); extern void machine_check_queue_event(void); extern void machine_check_print_event_info(struct machine_check_event *evt, bool user_mode, bool in_guest); unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr); #ifdef CONFIG_PPC_BOOK3S_64 void flush_and_reload_slb(void); #endif /* CONFIG_PPC_BOOK3S_64 */ #endif /* __ASM_PPC64_MCE_H__ */
/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * 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 Sandia Corporation 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 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. * */ /***************************************************************************** * * exgev - ex_get_varid_var * * entry conditions - * input parameters: * int exoid exodus file id * int time_step time step number * int varid id of variable on exodus database * int num_entity number of entities for this variable * * * exit conditions - * float* var_vals array of variable values * * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * reads the values of a single variable at one time step in the * database; assume the first time index is 1. Access based on the * passed in 'varid' * * NOTE: If used for nodal variables, it must be an ex_large_model == 1 */ int ex_get_varid_var(int exoid, int time_step, int varid, int num_entity, void *var_vals) { int status; size_t start[2], count[2]; char errmsg[MAX_ERR_LENGTH]; exerrval = 0; /* clear error code */ /* read values of variable */ start[0] = --time_step; start[1] = 0; count[0] = 1; count[1] = num_entity; if (ex_comp_ws(exoid) == 4) { status = nc_get_vara_float(exoid, varid, start, count, var_vals); } else { status = nc_get_vara_double(exoid, varid, start, count, var_vals); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable with variable id %d in file id %d", varid,exoid);/*this msg needs to be improved*/ ex_err("ex_get_varid_var",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); }
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Tracks information about an FEC group, including the packets // that have been seen, and the running parity. Provided the ability // to revive a dropped packet. #ifndef NET_QUIC_QUIC_FEC_GROUP_H_ #define NET_QUIC_QUIC_FEC_GROUP_H_ #include "base/strings/string_piece.h" #include "net/quic/quic_protocol.h" namespace net { class NET_EXPORT_PRIVATE QuicFecGroup { public: QuicFecGroup(); ~QuicFecGroup(); // Updates the FEC group based on the delivery of a data packet decrypted at // |encryption_level|. Returns false if this packet has already been seen, // true otherwise. bool Update(EncryptionLevel encryption_level, const QuicPacketHeader& header, base::StringPiece decrypted_payload); // Updates the FEC group based on the delivery of an FEC packet decrypted at // |encryption_level|. Returns false if this packet has already been seen or // if it does not claim to protect all the packets previously seen in this // group. bool UpdateFec(EncryptionLevel encryption_level, QuicPacketSequenceNumber fec_packet_sequence_number, const QuicFecData& fec); // Returns true if a packet can be revived from this FEC group. bool CanRevive() const; // Returns true if all packets (FEC and data) from this FEC group have been // seen or revived bool IsFinished() const; // Revives the missing packet from this FEC group. This may return a packet // that is null padded to a greater length than the original packet, but // the framer will handle it correctly. Returns the length of the data // written to |decrypted_payload|, or 0 if the packet could not be revived. size_t Revive(QuicPacketHeader* header, char* decrypted_payload, size_t decrypted_payload_len); // Returns true of this FEC group protects any packets with sequence // numbers less than |num|. bool ProtectsPacketsBefore(QuicPacketSequenceNumber num) const; const base::StringPiece payload_parity() const { return base::StringPiece(payload_parity_, payload_parity_len_); } QuicPacketSequenceNumber min_protected_packet() const { return min_protected_packet_; } size_t NumReceivedPackets() const { return received_packets_.size(); } // Returns the effective encryption level of the FEC group. EncryptionLevel effective_encryption_level() const { return effective_encryption_level_; } private: bool UpdateParity(base::StringPiece payload); // Returns the number of missing packets, or size_t max if the number // of missing packets is not known. size_t NumMissingPackets() const; // Set of packets that we have recevied. SequenceNumberSet received_packets_; // Sequence number of the first protected packet in this group (the one // with the lowest packet sequence number). Will only be set once the FEC // packet has been seen. QuicPacketSequenceNumber min_protected_packet_; // Sequence number of the last protected packet in this group (the one // with the highest packet sequence number). Will only be set once the FEC // packet has been seen. QuicPacketSequenceNumber max_protected_packet_; // The cumulative parity calculation of all received packets. char payload_parity_[kMaxPacketSize]; size_t payload_parity_len_; // The effective encryption level, which is the lowest encryption level of // the data and FEC in the group. EncryptionLevel effective_encryption_level_; DISALLOW_COPY_AND_ASSIGN(QuicFecGroup); }; } // namespace net #endif // NET_QUIC_QUIC_FEC_GROUP_H_
/* * linux/arch/arm/mach-integrator/integrator_cp.c * * Copyright (C) 2003 Deep Blue Solutions Ltd * * 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. */ #include <linux/kernel.h> #include <linux/amba/mmci.h> #include <linux/io.h> #include <linux/irqchip.h> #include <linux/of_irq.h> #include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/sched_clock.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include "hardware.h" #include "cm.h" #include "common.h" /* Base address to the core module header */ static struct regmap *cm_map; /* Base address to the CP controller */ static void __iomem *intcp_con_base; #define CM_COUNTER_OFFSET 0x28 /* * Logical Physical * f1400000 14000000 Interrupt controller * f1600000 16000000 UART 0 * fca00000 ca000000 SIC */ static struct map_desc intcp_io_desc[] __initdata __maybe_unused = { { .virtual = IO_ADDRESS(INTEGRATOR_IC_BASE), .pfn = __phys_to_pfn(INTEGRATOR_IC_BASE), .length = SZ_4K, .type = MT_DEVICE }, { .virtual = IO_ADDRESS(INTEGRATOR_UART0_BASE), .pfn = __phys_to_pfn(INTEGRATOR_UART0_BASE), .length = SZ_4K, .type = MT_DEVICE }, { .virtual = IO_ADDRESS(INTEGRATOR_CP_SIC_BASE), .pfn = __phys_to_pfn(INTEGRATOR_CP_SIC_BASE), .length = SZ_4K, .type = MT_DEVICE } }; static void __init intcp_map_io(void) { iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc)); } /* * It seems that the card insertion interrupt remains active after * we've acknowledged it. We therefore ignore the interrupt, and * rely on reading it from the SIC. This also means that we must * clear the latched interrupt. */ static unsigned int mmc_status(struct device *dev) { unsigned int status = readl(__io_address(0xca000000 + 4)); writel(8, intcp_con_base + 8); return status & 8; } static struct mmci_platform_data mmc_data = { .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .status = mmc_status, }; static u64 notrace intcp_read_sched_clock(void) { unsigned int val; /* MMIO so discard return code */ regmap_read(cm_map, CM_COUNTER_OFFSET, &val); return val; } static void __init intcp_init_early(void) { cm_map = syscon_regmap_lookup_by_compatible("arm,core-module-integrator"); if (IS_ERR(cm_map)) return; sched_clock_register(intcp_read_sched_clock, 32, 24000000); } static void __init intcp_init_irq_of(void) { cm_init(); irqchip_init(); } /* * For the Device Tree, add in the UART, MMC and CLCD specifics as AUXDATA * and enforce the bus names since these are used for clock lookups. */ static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_CP_MMC_BASE, "mmci", &mmc_data), { /* sentinel */ }, }; static const struct of_device_id intcp_syscon_match[] = { { .compatible = "arm,integrator-cp-syscon"}, { }, }; static void __init intcp_init_of(void) { struct device_node *cpcon; cpcon = of_find_matching_node(NULL, intcp_syscon_match); if (!cpcon) return; intcp_con_base = of_iomap(cpcon, 0); if (!intcp_con_base) return; of_platform_default_populate(NULL, intcp_auxdata_lookup, NULL); } static const char * intcp_dt_board_compat[] = { "arm,integrator-cp", NULL, }; DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)") .reserve = integrator_reserve, .map_io = intcp_map_io, .init_early = intcp_init_early, .init_irq = intcp_init_irq_of, .init_machine = intcp_init_of, .dt_compat = intcp_dt_board_compat, MACHINE_END
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // // // //////////////////////////////////////////////////////////////////////////////// // This header file defines the list of dangerous APIs and // is used by InvokeUtil::IsDangerousMethod. // Dangerous APIs are the APIs that make security decisions based on the result // of a stack walk. When these APIs are invoked through reflection or delegate // the stack walker can be easily confused, resulting in security holes. //////////////////////////////////////////////////////////////////////////////// #ifndef API_NAMES #define API_NAMES(...) __VA_ARGS__ #endif // !API_NAMES // ToString is never dangerous but we include it on the Runtime*Info types because of a JScript.Net compat issue. // JScript.Net tries to invoke these ToString APIs when a Runtime*Info object is compared to another object of a different type (e.g. a string). // This used to cause a SecurityException in partial trust (which JScript catches) because the API was considered dangerous. // Now this causes a MethodAccessException in partial trust because the API is inaccessible. So we add them back to the "dangerous" API // list to maintain compatibility. See Devdiv bug 419443 for details. DEFINE_DANGEROUS_API(APP_DOMAIN, API_NAMES("CreateInstance", "CreateComInstanceFrom", "CreateInstanceAndUnwrap", "CreateInstanceFrom", "CreateInstanceFromAndUnwrap ", "DefineDynamicAssembly", "Load")) DEFINE_DANGEROUS_API(ASSEMBLYBASE, API_NAMES("CreateInstance", "Load")) DEFINE_DANGEROUS_API(ASSEMBLY, API_NAMES("CreateInstance", "Load")) DEFINE_DANGEROUS_API(ASSEMBLY_BUILDER, API_NAMES("CreateInstance", "DefineDynamicAssembly", "DefineDynamicModule")) DEFINE_DANGEROUS_API(INTERNAL_ASSEMBLY_BUILDER, API_NAMES("CreateInstance")) DEFINE_DANGEROUS_API(METHOD_BASE, API_NAMES("Invoke")) DEFINE_DANGEROUS_API(CONSTRUCTOR_INFO, API_NAMES("Invoke", \ "System.Runtime.InteropServices._ConstructorInfo.Invoke_2", \ "System.Runtime.InteropServices._ConstructorInfo.Invoke_3", \ "System.Runtime.InteropServices._ConstructorInfo.Invoke_4", \ "System.Runtime.InteropServices._ConstructorInfo.Invoke_5")) DEFINE_DANGEROUS_API(CONSTRUCTOR, API_NAMES("Invoke", "ToString")) DEFINE_DANGEROUS_API(METHOD_INFO, API_NAMES("CreateDelegate", "Invoke")) DEFINE_DANGEROUS_API(METHOD, API_NAMES("CreateDelegate", "Invoke", "ToString")) DEFINE_DANGEROUS_API(DYNAMICMETHOD, API_NAMES("CreateDelegate", "Invoke", ".ctor")) DEFINE_DANGEROUS_API(TYPE, API_NAMES("InvokeMember")) DEFINE_DANGEROUS_API(CLASS, API_NAMES("InvokeMember", "ToString")) DEFINE_DANGEROUS_API(TYPE_DELEGATOR, API_NAMES("InvokeMember")) DEFINE_DANGEROUS_API(RT_FIELD_INFO, API_NAMES("GetValue", "SetValue", "ToString")) DEFINE_DANGEROUS_API(FIELD_INFO, API_NAMES("GetValue", "SetValue")) DEFINE_DANGEROUS_API(FIELD, API_NAMES("GetValue", "SetValue", "ToString")) DEFINE_DANGEROUS_API(PROPERTY_INFO, API_NAMES("GetValue", "SetValue")) DEFINE_DANGEROUS_API(PROPERTY, API_NAMES("GetValue", "SetValue", "ToString")) DEFINE_DANGEROUS_API(EVENT_INFO, API_NAMES("AddEventHandler", "RemoveEventHandler")) DEFINE_DANGEROUS_API(EVENT, API_NAMES("AddEventHandler", "RemoveEventHandler", "ToString")) DEFINE_DANGEROUS_API(RESOURCE_MANAGER, API_NAMES("GetResourceSet", "InternalGetResourceSet", ".ctor")) #if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR) // The COM interfaces implemented by the reflection types. // The IDispatch Invoke methods are not included here because they are not implemented in mscorlib. DEFINE_DANGEROUS_API(ITYPE, API_NAMES("InvokeMember")) DEFINE_DANGEROUS_API(IASSEMBLY, API_NAMES("CreateInstance")) DEFINE_DANGEROUS_API(IMETHODBASE, API_NAMES("Invoke")) DEFINE_DANGEROUS_API(IMETHODINFO, API_NAMES("Invoke")) DEFINE_DANGEROUS_API(ICONSTRUCTORINFO, API_NAMES("Invoke", "Invoke_2", "Invoke_3", "Invoke_4", "Invoke_5")) DEFINE_DANGEROUS_API(IFIELDINFO, API_NAMES("GetValue", "SetValue")) DEFINE_DANGEROUS_API(IPROPERTYINFO, API_NAMES("GetValue", "SetValue")) DEFINE_DANGEROUS_API(IEVENTINFO, API_NAMES("AddEventHandler", "RemoveEventHandler")) DEFINE_DANGEROUS_API(IAPPDOMAIN, API_NAMES("CreateInstance", "CreateInstanceFrom", "DefineDynamicAssembly", "Load")) DEFINE_DANGEROUS_API(IREFLECT, API_NAMES("InvokeMember")) #endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
/* * Copyright 2004-2010 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #ifndef _BFIN_IO_H #define _BFIN_IO_H #include <linux/compiler.h> #include <linux/types.h> #include <asm/byteorder.h> #define __raw_readb bfin_read8 #define __raw_readw bfin_read16 #define __raw_readl bfin_read32 #define __raw_writeb(val, addr) bfin_write8(addr, val) #define __raw_writew(val, addr) bfin_write16(addr, val) #define __raw_writel(val, addr) bfin_write32(addr, val) extern void outsb(unsigned long port, const void *addr, unsigned long count); extern void outsw(unsigned long port, const void *addr, unsigned long count); extern void outsw_8(unsigned long port, const void *addr, unsigned long count); extern void outsl(unsigned long port, const void *addr, unsigned long count); #define outsb outsb #define outsw outsw #define outsl outsl extern void insb(unsigned long port, void *addr, unsigned long count); extern void insw(unsigned long port, void *addr, unsigned long count); extern void insw_8(unsigned long port, void *addr, unsigned long count); extern void insl(unsigned long port, void *addr, unsigned long count); extern void insl_16(unsigned long port, void *addr, unsigned long count); #define insb insb #define insw insw #define insl insl /** * I/O write barrier * * Ensure ordering of I/O space writes. This will make sure that writes * following the barrier will arrive after all previous writes. */ #define mmiowb() do { SSYNC(); wmb(); } while (0) #include <asm-generic/io.h> #endif
#ifndef _UAPI_ASM_SOCKET_H #define _UAPI_ASM_SOCKET_H #include <asm/sockios.h> /* For setsockopt(2) */ #define SOL_SOCKET 0xffff #define SO_DEBUG 0x0001 #define SO_REUSEADDR 0x0004 #define SO_KEEPALIVE 0x0008 #define SO_DONTROUTE 0x0010 #define SO_BROADCAST 0x0020 #define SO_LINGER 0x0080 #define SO_OOBINLINE 0x0100 #define SO_REUSEPORT 0x0200 #define SO_SNDBUF 0x1001 #define SO_RCVBUF 0x1002 #define SO_SNDBUFFORCE 0x100a #define SO_RCVBUFFORCE 0x100b #define SO_SNDLOWAT 0x1003 #define SO_RCVLOWAT 0x1004 #define SO_SNDTIMEO 0x1005 #define SO_RCVTIMEO 0x1006 #define SO_ERROR 0x1007 #define SO_TYPE 0x1008 #define SO_PROTOCOL 0x1028 #define SO_DOMAIN 0x1029 #define SO_PEERNAME 0x2000 #define SO_NO_CHECK 0x400b #define SO_PRIORITY 0x400c #define SO_BSDCOMPAT 0x400e #define SO_PASSCRED 0x4010 #define SO_PEERCRED 0x4011 #define SO_TIMESTAMP 0x4012 #define SCM_TIMESTAMP SO_TIMESTAMP #define SO_TIMESTAMPNS 0x4013 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS /* Security levels - as per NRL IPv6 - don't actually do anything */ #define SO_SECURITY_AUTHENTICATION 0x4016 #define SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017 #define SO_SECURITY_ENCRYPTION_NETWORK 0x4018 #define SO_BINDTODEVICE 0x4019 /* Socket filtering */ #define SO_ATTACH_FILTER 0x401a #define SO_DETACH_FILTER 0x401b #define SO_GET_FILTER SO_ATTACH_FILTER #define SO_ACCEPTCONN 0x401c #define SO_PEERSEC 0x401d #define SO_PASSSEC 0x401e #define SO_MARK 0x401f #define SO_TIMESTAMPING 0x4020 #define SCM_TIMESTAMPING SO_TIMESTAMPING #define SO_RXQ_OVFL 0x4021 #define SO_WIFI_STATUS 0x4022 #define SCM_WIFI_STATUS SO_WIFI_STATUS #define SO_PEEK_OFF 0x4023 /* Instruct lower device to use last 4-bytes of skb data as FCS */ #define SO_NOFCS 0x4024 #define SO_LOCK_FILTER 0x4025 #define SO_SELECT_ERR_QUEUE 0x4026 #define SO_BUSY_POLL 0x4027 #define SO_MAX_PACING_RATE 0x4028 #define SO_BPF_EXTENSIONS 0x4029 #define SO_INCOMING_CPU 0x402A #define SO_ATTACH_BPF 0x402B #define SO_DETACH_BPF SO_DETACH_FILTER #define SO_ATTACH_REUSEPORT_CBPF 0x402C #define SO_ATTACH_REUSEPORT_EBPF 0x402D #define SO_CNX_ADVICE 0x402E #define SCM_TIMESTAMPING_OPT_STATS 0x402F #endif /* _UAPI_ASM_SOCKET_H */
// Copyright 2011 Google Inc. All Rights Reserved. // // This code is licensed under the same terms as WebM: // Software License Agreement: http://www.webmproject.org/license/software/ // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ // ----------------------------------------------------------------------------- // // Author: Jyrki Alakuijala (jyrki@google.com) // // Entropy encoding (Huffman) for webp lossless #ifndef WEBP_UTILS_HUFFMAN_ENCODE_H_ #define WEBP_UTILS_HUFFMAN_ENCODE_H_ #include "../webp/types.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif // Struct for holding the tree header in coded form. typedef struct { uint8_t code; // value (0..15) or escape code (16,17,18) uint8_t extra_bits; // extra bits for escape codes } HuffmanTreeToken; // Struct to represent the tree codes (depth and bits array). typedef struct { int num_symbols; // Number of symbols. uint8_t* code_lengths; // Code lengths of the symbols. uint16_t* codes; // Symbol Codes. } HuffmanTreeCode; // Turn the Huffman tree into a token sequence. // Returns the number of tokens used. int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree, HuffmanTreeToken* tokens, int max_tokens); // Create an optimized tree, and tokenize it. int VP8LCreateHuffmanTree(int* const histogram, int tree_depth_limit, HuffmanTreeCode* const tree); #if defined(__cplusplus) || defined(c_plusplus) } #endif #endif // WEBP_UTILS_HUFFMAN_ENCODE_H_
/* * Linux cfg80211 driver - Android related functions * * Copyright (C) 1999-2014, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * * $Id: wl_android.h 440870 2013-12-04 05:23:45Z $ */ #include <linux/module.h> #include <linux/netdevice.h> #include <wldev_common.h> /* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL * automatically */ #ifdef WL_GENL #include <net/genetlink.h> #endif /** * Android platform dependent functions, feel free to add Android specific functions here * (save the macros in dhd). Please do NOT declare functions that are NOT exposed to dhd * or cfg, define them as static in wl_android.c */ /** * wl_android_init will be called from module init function (dhd_module_init now), similarly * wl_android_exit will be called from module exit function (dhd_module_cleanup now) */ int wl_android_init(void); int wl_android_exit(void); void wl_android_post_init(void); int wl_android_wifi_on(struct net_device *dev); int wl_android_wifi_off(struct net_device *dev); int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd); #ifdef WL_GENL typedef struct bcm_event_hdr { u16 event_type; u16 len; } bcm_event_hdr_t; /* attributes (variables): the index in this enum is used as a reference for the type, * userspace application has to indicate the corresponding type * the policy is used for security considerations */ enum { BCM_GENL_ATTR_UNSPEC, BCM_GENL_ATTR_STRING, BCM_GENL_ATTR_MSG, __BCM_GENL_ATTR_MAX }; #define BCM_GENL_ATTR_MAX (__BCM_GENL_ATTR_MAX - 1) /* commands: enumeration of all commands (functions), * used by userspace application to identify command to be ececuted */ enum { BCM_GENL_CMD_UNSPEC, BCM_GENL_CMD_MSG, __BCM_GENL_CMD_MAX }; #define BCM_GENL_CMD_MAX (__BCM_GENL_CMD_MAX - 1) /* Enum values used by the BCM supplicant to identify the events */ enum { BCM_E_UNSPEC, BCM_E_SVC_FOUND, BCM_E_DEV_FOUND, BCM_E_DEV_LOST, BCM_E_MAX }; s32 wl_genl_send_msg(struct net_device *ndev, u32 event_type, u8 *string, u16 len, u8 *hdr, u16 hdrlen); #endif /* WL_GENL */ #ifdef WLAIBSS s32 wl_netlink_send_msg(int pid, int seq, void *data, int size); #endif /* WLAIBSS */
/* Unix SMB/CIFS implementation. Winbind domain child functions Copyright (C) Stefan Metzmacher 2007 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 3 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, see <http://www.gnu.org/licenses/>. */ #include "includes.h" #include "winbindd.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND static const struct winbindd_child_dispatch_table domain_dispatch_table[] = { { .name = "PING", .struct_cmd = WINBINDD_PING, .struct_fn = winbindd_dual_ping, },{ .name = "LIST_TRUSTDOM", .struct_cmd = WINBINDD_LIST_TRUSTDOM, .struct_fn = winbindd_dual_list_trusted_domains, },{ .name = "INIT_CONNECTION", .struct_cmd = WINBINDD_INIT_CONNECTION, .struct_fn = winbindd_dual_init_connection, },{ .name = "PAM_AUTH", .struct_cmd = WINBINDD_PAM_AUTH, .struct_fn = winbindd_dual_pam_auth, },{ .name = "AUTH_CRAP", .struct_cmd = WINBINDD_PAM_AUTH_CRAP, .struct_fn = winbindd_dual_pam_auth_crap, },{ .name = "PAM_LOGOFF", .struct_cmd = WINBINDD_PAM_LOGOFF, .struct_fn = winbindd_dual_pam_logoff, },{ .name = "CHNG_PSWD_AUTH_CRAP", .struct_cmd = WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP, .struct_fn = winbindd_dual_pam_chng_pswd_auth_crap, },{ .name = "PAM_CHAUTHTOK", .struct_cmd = WINBINDD_PAM_CHAUTHTOK, .struct_fn = winbindd_dual_pam_chauthtok, },{ .name = "NDRCMD", .struct_cmd = WINBINDD_DUAL_NDRCMD, .struct_fn = winbindd_dual_ndrcmd, },{ .name = NULL, } }; void setup_domain_child(struct winbindd_domain *domain) { int i; for (i=0; i<lp_winbind_max_domain_connections(); i++) { setup_child(domain, &domain->children[i], domain_dispatch_table, "log.wb", domain->name); domain->children[i].domain = domain; } }
#pragma once #include "quantum.h" #define LAYOUT( \ L00, L01, L02, L03, L04, L05, L06, L07, L08, L09, \ L10, L11, L12, L13, L14, L15, L16, L17, L18, L19, \ L20, L21, L22, L23, L24, L25, L26, L27, L28, L29, \ L30, L32, L33, L34, L35, L36, L37 \ ) { \ {L00, L01, L02, L03, L04, L05, L06, L07, L08, L09}, \ {L10, L11, L12, L13, L14, L15, L16, L17, L18, L19}, \ {L20, L21, L22, L23, L24, L25, L26, L27, L28, L29}, \ {L30, KC_NO, L32, L33, L34, L35, L36, L37, KC_NO, KC_NO} \ }
// // KnowledgeContentViewController.h // OrganicQuest // // Created by Connor on 1/26/14. // Copyright (c) 2014 Connor. All rights reserved. // #import <UIKit/UIKit.h> @interface KnowledgeContentViewController : UIViewController @property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView; @property NSUInteger pageIndex; @property NSString *imageFile; @end
/* * drivers/staging/android/ion/compat_ion.c * * Copyright (C) 2013 Google, Inc. * * 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. * */ #include <linux/compat.h> #include <linux/fs.h> #include <linux/uaccess.h> #include "ion.h" #include "compat_ion.h" /* See drivers/staging/android/uapi/ion.h for the definition of these structs */ struct compat_ion_allocation_data { compat_size_t len; compat_size_t align; compat_uint_t heap_id_mask; compat_uint_t flags; compat_int_t handle; }; struct compat_ion_custom_data { compat_uint_t cmd; compat_ulong_t arg; }; struct compat_ion_handle_data { compat_int_t handle; }; struct compat_ion_fd_partial_data { compat_int_t handle; compat_int_t fd; compat_off_t offset; compat_size_t len; }; #define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ struct compat_ion_allocation_data) #define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, \ struct compat_ion_handle_data) #define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ struct compat_ion_custom_data) #define COMPAT_ION_IOC_SYNC_PARTIAL _IOWR(ION_IOC_MAGIC, 9, \ struct compat_ion_fd_partial_data) static int compat_get_ion_allocation_data( struct compat_ion_allocation_data __user *data32, struct ion_allocation_data __user *data) { compat_size_t s; compat_uint_t u; compat_int_t i; int err; err = get_user(s, &data32->len); err |= put_user(s, &data->len); err |= get_user(s, &data32->align); err |= put_user(s, &data->align); err |= get_user(u, &data32->heap_id_mask); err |= put_user(u, &data->heap_id_mask); err |= get_user(u, &data32->flags); err |= put_user(u, &data->flags); err |= get_user(i, &data32->handle); err |= put_user(i, &data->handle); return err; } static int compat_get_ion_handle_data( struct compat_ion_handle_data __user *data32, struct ion_handle_data __user *data) { compat_int_t i; int err; err = get_user(i, &data32->handle); err |= put_user(i, &data->handle); return err; } static int compat_put_ion_allocation_data( struct compat_ion_allocation_data __user *data32, struct ion_allocation_data __user *data) { compat_size_t s; compat_uint_t u; compat_int_t i; int err; err = get_user(s, &data->len); err |= put_user(s, &data32->len); err |= get_user(s, &data->align); err |= put_user(s, &data32->align); err |= get_user(u, &data->heap_id_mask); err |= put_user(u, &data32->heap_id_mask); err |= get_user(u, &data->flags); err |= put_user(u, &data32->flags); err |= get_user(i, &data->handle); err |= put_user(i, &data32->handle); return err; } static int compat_get_ion_custom_data( struct compat_ion_custom_data __user *data32, struct ion_custom_data __user *data) { compat_uint_t cmd; compat_ulong_t arg; int err; err = get_user(cmd, &data32->cmd); err |= put_user(cmd, &data->cmd); err |= get_user(arg, &data32->arg); err |= put_user(arg, &data->arg); return err; }; static int compat_get_ion_fd_partial_data( struct compat_ion_fd_partial_data __user *data32, struct ion_fd_partial_data __user *data) { compat_int_t handle; compat_int_t fd; compat_off_t offset; compat_size_t len; int err; err = get_user(handle, &data32->handle); err |= put_user(handle, &data->handle); err |= get_user(fd, &data32->fd); err |= put_user(fd, &data->fd); err |= get_user(offset, &data32->offset); err |= put_user(offset, &data->offset); err |= get_user(len, &data32->len); err |= put_user(len, &data->len); return err; } long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { long ret; if (!filp->f_op || !filp->f_op->unlocked_ioctl) return -ENOTTY; switch (cmd) { case COMPAT_ION_IOC_ALLOC: { struct compat_ion_allocation_data __user *data32; struct ion_allocation_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_allocation_data(data32, data); if (err) return err; ret = filp->f_op->unlocked_ioctl(filp, ION_IOC_ALLOC, (unsigned long)data); err = compat_put_ion_allocation_data(data32, data); return ret ? ret : err; } case COMPAT_ION_IOC_FREE: { struct compat_ion_handle_data __user *data32; struct ion_handle_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_handle_data(data32, data); if (err) return err; return filp->f_op->unlocked_ioctl(filp, ION_IOC_FREE, (unsigned long)data); } case COMPAT_ION_IOC_CUSTOM: { struct compat_ion_custom_data __user *data32; struct ion_custom_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_custom_data(data32, data); if (err) return err; return filp->f_op->unlocked_ioctl(filp, ION_IOC_CUSTOM, (unsigned long)data); } case COMPAT_ION_IOC_SYNC_PARTIAL: { struct compat_ion_fd_partial_data __user *data32; struct ion_fd_partial_data __user *data; int err; data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) return -EFAULT; err = compat_get_ion_fd_partial_data(data32, data); if (err) return err; return filp->f_op->unlocked_ioctl(filp, ION_IOC_SYNC_PARTIAL, (unsigned long)data); } case ION_IOC_SHARE: case ION_IOC_MAP: case ION_IOC_IMPORT: case ION_IOC_SYNC: return filp->f_op->unlocked_ioctl(filp, cmd, (unsigned long)compat_ptr(arg)); default: return -ENOIOCTLCMD; } }
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_MAIN_H_ #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_MAIN_H_ #pragma once class CommandLine; // Entry point for the diagnostics mode. Most of the initialization that you // can see in ChromeMain() will be repeated here or will be done differently. int DiagnosticsMain(const CommandLine& command_line); #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_MAIN_H_
#ifndef _NF_NAT_RULE_H #define _NF_NAT_RULE_H #include <net/netfilter/nf_conntrack.h> #include <net/netfilter/nf_nat.h> #include <linux/netfilter_ipv4/ip_tables.h> extern int nf_nat_rule_init(void) __init; extern void nf_nat_rule_cleanup(void); extern int nf_nat_rule_find(struct sk_buff *skb, unsigned int hooknum, const struct net_device *in, const struct net_device *out, struct nf_conn *ct); extern unsigned int alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); #endif /* _NF_NAT_RULE_H */
/* * Copyright (c) 2011-2012, Code Aurora Forum. 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 __ARCH_ARM_MACH_MSM_RPM_REGULATOR_INT_H #define __ARCH_ARM_MACH_MSM_RPM_REGULATOR_INT_H #include <linux/regulator/driver.h> #include <mach/rpm.h> #include <mach/rpm-regulator.h> enum rpm_regulator_type { RPM_REGULATOR_TYPE_LDO, RPM_REGULATOR_TYPE_SMPS, RPM_REGULATOR_TYPE_VS, RPM_REGULATOR_TYPE_NCP, RPM_REGULATOR_TYPE_CORNER, RPM_REGULATOR_TYPE_MAX = RPM_REGULATOR_TYPE_CORNER, }; struct request_member { int word; unsigned int mask; int shift; }; struct rpm_vreg_parts { struct request_member mV; struct request_member uV; struct request_member ip; struct request_member pd; struct request_member ia; struct request_member fm; struct request_member pm; struct request_member pc; struct request_member pf; struct request_member enable_state; struct request_member comp_mode; struct request_member freq; struct request_member freq_clk_src; struct request_member hpm; int request_len; }; struct vreg_range { int min_uV; int max_uV; int step_uV; unsigned n_voltages; }; struct vreg_set_points { struct vreg_range *range; int count; unsigned n_voltages; }; struct vreg { struct msm_rpm_iv_pair req[2]; struct msm_rpm_iv_pair prev_active_req[2]; struct msm_rpm_iv_pair prev_sleep_req[2]; struct rpm_regulator_init_data pdata; struct regulator_desc rdesc; struct regulator_desc rdesc_pc; struct regulator_dev *rdev; struct regulator_dev *rdev_pc; struct vreg_set_points *set_points; struct rpm_vreg_parts *part; int type; int id; bool requires_cxo; struct mutex pc_lock; int save_uV; int mode; bool is_enabled; bool is_enabled_pc; const int hpm_min_load; int active_min_uV_vote[RPM_VREG_VOTER_COUNT]; int sleep_min_uV_vote[RPM_VREG_VOTER_COUNT]; }; struct vreg_config { struct vreg *vregs; int vregs_len; int vreg_id_min; int vreg_id_max; int pin_func_none; int pin_func_sleep_b; unsigned int mode_lpm; unsigned int mode_hpm; struct vreg_set_points **set_points; int set_points_len; const char **label_pin_ctrl; int label_pin_ctrl_len; const char **label_pin_func; int label_pin_func_len; const char **label_force_mode; int label_force_mode_len; const char **label_power_mode; int label_power_mode_len; int (*is_real_id) (int vreg_id); int (*pc_id_to_real_id) (int vreg_id); int use_legacy_optimum_mode; int ia_follows_ip; }; #define REQUEST_MEMBER(_word, _mask, _shift) \ { \ .word = _word, \ .mask = _mask, \ .shift = _shift, \ } #define VOLTAGE_RANGE(_min_uV, _max_uV, _step_uV) \ { \ .min_uV = _min_uV, \ .max_uV = _max_uV, \ .step_uV = _step_uV, \ } #define SET_POINTS(_ranges) \ { \ .range = _ranges, \ .count = ARRAY_SIZE(_ranges), \ }; #define MICRO_TO_MILLI(uV) ((uV) / 1000) #define MILLI_TO_MICRO(mV) ((mV) * 1000) #if defined(CONFIG_MSM_RPM_REGULATOR) && defined(CONFIG_ARCH_MSM8X60) struct vreg_config *get_config_8660(void); #else static inline struct vreg_config *get_config_8660(void) { return NULL; } #endif #if defined(CONFIG_MSM_RPM_REGULATOR) && \ (defined(CONFIG_ARCH_MSM8960) || defined(CONFIG_ARCH_APQ8064)) struct vreg_config *get_config_8960(void); #else static inline struct vreg_config *get_config_8960(void) { return NULL; } #endif #if defined(CONFIG_MSM_RPM_REGULATOR) && defined(CONFIG_ARCH_MSM9615) struct vreg_config *get_config_9615(void); #else static inline struct vreg_config *get_config_9615(void) { return NULL; } #endif #if defined(CONFIG_MSM_RPM_REGULATOR) && defined(CONFIG_ARCH_MSM8930) struct vreg_config *get_config_8930(void); #else static inline struct vreg_config *get_config_8930(void) { return NULL; } #endif #endif
#ifndef __ASM_SH_SYSTEM_64_H #define __ASM_SH_SYSTEM_64_H /* * include/asm-sh/system_64.h * * Copyright (C) 2000, 2001 Paolo Alberelli * Copyright (C) 2003 Paul Mundt * Copyright (C) 2004 Richard Curnow * * 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 <cpu/registers.h> #include <asm/processor.h> /* * switch_to() should switch tasks to task nr n, first */ struct thread_struct; struct task_struct *sh64_switch_to(struct task_struct *prev, struct thread_struct *prev_thread, struct task_struct *next, struct thread_struct *next_thread); #define switch_to(prev,next,last) \ do { \ if (last_task_used_math != next) { \ struct pt_regs *regs = next->thread.uregs; \ if (regs) regs->sr |= SR_FD; \ } \ last = sh64_switch_to(prev, &prev->thread, next, \ &next->thread); \ } while (0) #define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) #define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) #define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) #define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr)) static inline reg_size_t register_align(void *val) { return (unsigned long long)(signed long long)(signed long)val; } extern void phys_stext(void); static inline void trigger_address_error(void) { phys_stext(); } #define SR_BL_LL 0x0000000010000000LL static inline void set_bl_bit(void) { unsigned long long __dummy0, __dummy1 = SR_BL_LL; __asm__ __volatile__("getcon " __SR ", %0\n\t" "or %0, %1, %0\n\t" "putcon %0, " __SR "\n\t" : "=&r" (__dummy0) : "r" (__dummy1)); } static inline void clear_bl_bit(void) { unsigned long long __dummy0, __dummy1 = ~SR_BL_LL; __asm__ __volatile__("getcon " __SR ", %0\n\t" "and %0, %1, %0\n\t" "putcon %0, " __SR "\n\t" : "=&r" (__dummy0) : "r" (__dummy1)); } #endif /* __ASM_SH_SYSTEM_64_H */
/* vi: set sw=4 ts=4: */ /* * Generic non-forking server infrastructure. * Intended to make writing telnetd-type servers easier. * * Copyright (C) 2007 Denys Vlasenko * * Licensed under GPLv2, see file LICENSE in this source tree. */ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN /* opaque structure */ struct isrv_state_t; typedef struct isrv_state_t isrv_state_t; /* callbacks */ void isrv_want_rd(isrv_state_t *state, int fd); void isrv_want_wr(isrv_state_t *state, int fd); void isrv_dont_want_rd(isrv_state_t *state, int fd); void isrv_dont_want_wr(isrv_state_t *state, int fd); int isrv_register_fd(isrv_state_t *state, int peer, int fd); void isrv_close_fd(isrv_state_t *state, int fd); int isrv_register_peer(isrv_state_t *state, void *param); /* Driver: * * Select on listen_fd for <linger_timeout> (or forever if 0). * * If we time out and we have no peers, exit. * If we have peers, call do_timeout(peer_param), * if it returns !0, peer is removed. * * If listen_fd is active, accept new connection ("peer"), * call new_peer() on it, and if it returns 0, * add it to fds to select on. * Now, select will wait for <timeout>, not <linger_timeout> * (as long as we have more than zero peers). * * If a peer's fd is active, we call do_rd() on it if read * bit was set, and then do_wr() if write bit was also set. * If either returns !0, peer is removed. * Reaching this place also resets timeout counter for this peer. * * Note that peer must indicate that he wants to be selected * for read and/or write using isrv_want_rd()/isrv_want_wr() * [can be called in new_peer() or in do_rd()/do_wr()]. * If it never wants to be selected for write, do_wr() * will never be called (can be NULL). */ void isrv_run( int listen_fd, int (*new_peer)(isrv_state_t *state, int fd), int (*do_rd)(int fd, void **), int (*do_wr)(int fd, void **), int (*do_timeout)(void **), int timeout, int linger_timeout ); POP_SAVED_FUNCTION_VISIBILITY
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __NVKM_FIFO_PRIV_H__ #define __NVKM_FIFO_PRIV_H__ #define nvkm_fifo(p) container_of((p), struct nvkm_fifo, engine) #include <engine/fifo.h> int nvkm_fifo_ctor(const struct nvkm_fifo_func *, struct nvkm_device *, int index, int nr, struct nvkm_fifo *); void nvkm_fifo_uevent(struct nvkm_fifo *); void nvkm_fifo_cevent(struct nvkm_fifo *); void nvkm_fifo_kevent(struct nvkm_fifo *, int chid); void nvkm_fifo_recover_chan(struct nvkm_fifo *, int chid); struct nvkm_fifo_chan * nvkm_fifo_chan_inst_locked(struct nvkm_fifo *, u64 inst); struct nvkm_fifo_chan_oclass; struct nvkm_fifo_func { void *(*dtor)(struct nvkm_fifo *); int (*oneinit)(struct nvkm_fifo *); void (*init)(struct nvkm_fifo *); void (*fini)(struct nvkm_fifo *); void (*intr)(struct nvkm_fifo *); void (*pause)(struct nvkm_fifo *, unsigned long *); void (*start)(struct nvkm_fifo *, unsigned long *); void (*uevent_init)(struct nvkm_fifo *); void (*uevent_fini)(struct nvkm_fifo *); void (*recover_chan)(struct nvkm_fifo *, int chid); int (*class_get)(struct nvkm_fifo *, int index, const struct nvkm_fifo_chan_oclass **); const struct nvkm_fifo_chan_oclass *chan[]; }; void nv04_fifo_intr(struct nvkm_fifo *); void nv04_fifo_pause(struct nvkm_fifo *, unsigned long *); void nv04_fifo_start(struct nvkm_fifo *, unsigned long *); #endif
/* * $Id: sample.h,v 1.6 2006/09/18 06:23:39 nathanst Exp $ * * sample.h * hog * * Created by Nathan Sturtevant on 5/31/05. * Copyright 2005 Nathan Sturtevant, University of Alberta. All rights reserved. * * This file is part of HOG. * * HOG 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. * * HOG 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 HOG; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ void MyWindowHandler(unsigned long windowID, tWindowEventType eType); void MyFrameHandler(unsigned long windowID, unsigned int viewport, void *data); void MyDisplayHandler(unsigned long windowID, tKeyboardModifier, char key); void MyPathfindingKeyHandler(unsigned long windowID, tKeyboardModifier, char key); void MyRandomUnitKeyHandler(unsigned long windowID, tKeyboardModifier, char key); int MyCLHandler(char *argument[], int maxNumArgs); bool MyClickHandler(unsigned long windowID, int x, int y, point3d loc, tButtonType, tMouseEventType); void InstallHandlers();
/** * \file drm_memory.c * Memory management wrappers for DRM * * \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Gareth Hughes <gareth@valinux.com> */ /* * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * 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 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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/highmem.h> #include <linux/export.h> #include "drmP.h" #if __OS_HAS_AGP static void *agp_remap(unsigned long offset, unsigned long size, struct drm_device * dev) { unsigned long i, num_pages = PAGE_ALIGN(size) / PAGE_SIZE; struct drm_agp_mem *agpmem; struct page **page_map; struct page **phys_page_map; void *addr; size = PAGE_ALIGN(size); #ifdef __alpha__ offset -= dev->hose->mem_space->start; #endif list_for_each_entry(agpmem, &dev->agp->memory, head) if (agpmem->bound <= offset && (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >= (offset + size)) break; if (&agpmem->head == &dev->agp->memory) return NULL; /* * OK, we're mapping AGP space on a chipset/platform on which memory accesses by * the CPU do not get remapped by the GART. We fix this by using the kernel's * page-table instead (that's probably faster anyhow...). */ /* note: use vmalloc() because num_pages could be large... */ page_map = vmalloc(num_pages * sizeof(struct page *)); if (!page_map) return NULL; phys_page_map = (agpmem->memory->pages + (offset - agpmem->bound) / PAGE_SIZE); for (i = 0; i < num_pages; ++i) page_map[i] = phys_page_map[i]; addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP); vfree(page_map); return addr; } /** Wrapper around agp_free_memory() */ void drm_free_agp(DRM_AGP_MEM * handle, int pages) { agp_free_memory(handle); } EXPORT_SYMBOL(drm_free_agp); /** Wrapper around agp_bind_memory() */ int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) { return agp_bind_memory(handle, start); } /** Wrapper around agp_unbind_memory() */ int drm_unbind_agp(DRM_AGP_MEM * handle) { return agp_unbind_memory(handle); } EXPORT_SYMBOL(drm_unbind_agp); #else /* __OS_HAS_AGP */ static inline void *agp_remap(unsigned long offset, unsigned long size, struct drm_device * dev) { return NULL; } #endif /* agp */ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev) { if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) map->handle = agp_remap(map->offset, map->size, dev); else map->handle = ioremap(map->offset, map->size); } EXPORT_SYMBOL(drm_core_ioremap); void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev) { if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) map->handle = agp_remap(map->offset, map->size, dev); else map->handle = ioremap_wc(map->offset, map->size); } EXPORT_SYMBOL(drm_core_ioremap_wc); void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev) { if (!map->handle || !map->size) return; if (drm_core_has_AGP(dev) && dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) vunmap(map->handle); else iounmap(map->handle); } EXPORT_SYMBOL(drm_core_ioremapfree);
#include <linux/device.h> #include <linux/err.h> #include <linux/export.h> struct class *sec_class; EXPORT_SYMBOL(sec_class); static int __init midas_class_create(void) { sec_class = class_create(THIS_MODULE, "sec"); if (IS_ERR(sec_class)) { pr_err("Failed to create class(sec)!\n"); return PTR_ERR(sec_class); } return 0; } subsys_initcall(midas_class_create);
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef OTS_VMTX_H_ #define OTS_VMTX_H_ #include "metrics.h" #include "ots.h" namespace ots { struct OpenTypeVMTX { OpenTypeMetricsTable metrics; }; } // namespace ots #endif // OTS_VMTX_H_
/* * Copyright (c) 2013 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef VP9_VP9_IFACE_COMMON_H_ #define VP9_VP9_IFACE_COMMON_H_ #include "vpx_ports/mem.h" static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, void *user_priv) { /** vpx_img_wrap() doesn't allow specifying independent strides for * the Y, U, and V planes, nor other alignment adjustments that * might be representable by a YV12_BUFFER_CONFIG, so we just * initialize all the fields.*/ int bps; if (!yv12->subsampling_y) { if (!yv12->subsampling_x) { img->fmt = VPX_IMG_FMT_I444; bps = 24; } else { img->fmt = VPX_IMG_FMT_I422; bps = 16; } } else { if (!yv12->subsampling_x) { img->fmt = VPX_IMG_FMT_I440; bps = 16; } else { img->fmt = VPX_IMG_FMT_I420; bps = 12; } } img->cs = yv12->color_space; img->range = yv12->color_range; img->bit_depth = 8; img->w = yv12->y_stride; img->h = ALIGN_POWER_OF_TWO(yv12->y_height + 2 * VP9_ENC_BORDER_IN_PIXELS, 3); img->d_w = yv12->y_crop_width; img->d_h = yv12->y_crop_height; img->r_w = yv12->render_width; img->r_h = yv12->render_height; img->x_chroma_shift = yv12->subsampling_x; img->y_chroma_shift = yv12->subsampling_y; img->planes[VPX_PLANE_Y] = yv12->y_buffer; img->planes[VPX_PLANE_U] = yv12->u_buffer; img->planes[VPX_PLANE_V] = yv12->v_buffer; img->planes[VPX_PLANE_ALPHA] = NULL; img->stride[VPX_PLANE_Y] = yv12->y_stride; img->stride[VPX_PLANE_U] = yv12->uv_stride; img->stride[VPX_PLANE_V] = yv12->uv_stride; img->stride[VPX_PLANE_ALPHA] = yv12->y_stride; #if CONFIG_VP9_HIGHBITDEPTH if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) { // vpx_image_t uses byte strides and a pointer to the first byte // of the image. img->fmt = (vpx_img_fmt_t)(img->fmt | VPX_IMG_FMT_HIGHBITDEPTH); img->bit_depth = yv12->bit_depth; img->planes[VPX_PLANE_Y] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->y_buffer); img->planes[VPX_PLANE_U] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->u_buffer); img->planes[VPX_PLANE_V] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->v_buffer); img->planes[VPX_PLANE_ALPHA] = NULL; img->stride[VPX_PLANE_Y] = 2 * yv12->y_stride; img->stride[VPX_PLANE_U] = 2 * yv12->uv_stride; img->stride[VPX_PLANE_V] = 2 * yv12->uv_stride; img->stride[VPX_PLANE_ALPHA] = 2 * yv12->y_stride; } #endif // CONFIG_VP9_HIGHBITDEPTH img->bps = bps; img->user_priv = user_priv; img->img_data = yv12->buffer_alloc; img->img_data_owner = 0; img->self_allocd = 0; } static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img, YV12_BUFFER_CONFIG *yv12) { yv12->y_buffer = img->planes[VPX_PLANE_Y]; yv12->u_buffer = img->planes[VPX_PLANE_U]; yv12->v_buffer = img->planes[VPX_PLANE_V]; yv12->y_crop_width = img->d_w; yv12->y_crop_height = img->d_h; yv12->render_width = img->r_w; yv12->render_height = img->r_h; yv12->y_width = img->d_w; yv12->y_height = img->d_h; yv12->uv_width = img->x_chroma_shift == 1 ? (1 + yv12->y_width) / 2 : yv12->y_width; yv12->uv_height = img->y_chroma_shift == 1 ? (1 + yv12->y_height) / 2 : yv12->y_height; yv12->uv_crop_width = yv12->uv_width; yv12->uv_crop_height = yv12->uv_height; yv12->y_stride = img->stride[VPX_PLANE_Y]; yv12->uv_stride = img->stride[VPX_PLANE_U]; yv12->color_space = img->cs; yv12->color_range = img->range; #if CONFIG_VP9_HIGHBITDEPTH if (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) { // In vpx_image_t // planes point to uint8 address of start of data // stride counts uint8s to reach next row // In YV12_BUFFER_CONFIG // y_buffer, u_buffer, v_buffer point to uint16 address of data // stride and border counts in uint16s // This means that all the address calculations in the main body of code // should work correctly. // However, before we do any pixel operations we need to cast the address // to a uint16 ponter and double its value. yv12->y_buffer = CONVERT_TO_BYTEPTR(yv12->y_buffer); yv12->u_buffer = CONVERT_TO_BYTEPTR(yv12->u_buffer); yv12->v_buffer = CONVERT_TO_BYTEPTR(yv12->v_buffer); yv12->y_stride >>= 1; yv12->uv_stride >>= 1; yv12->flags = YV12_FLAG_HIGHBITDEPTH; } else { yv12->flags = 0; } yv12->border = (yv12->y_stride - img->w) / 2; #else yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2; #endif // CONFIG_VP9_HIGHBITDEPTH yv12->subsampling_x = img->x_chroma_shift; yv12->subsampling_y = img->y_chroma_shift; return VPX_CODEC_OK; } #endif // VP9_VP9_IFACE_COMMON_H_
/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_ #define WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_ #define ANAL_BLOCKL_MAX 256 /* Max analysis block length */ #define HALF_ANAL_BLOCKL 129 /* Half max analysis block length + 1 */ #define SIMULT 3 #define END_STARTUP_LONG 200 #define END_STARTUP_SHORT 50 #define FACTOR_Q16 2621440 /* 40 in Q16 */ #define FACTOR_Q7 5120 /* 40 in Q7 */ #define FACTOR_Q7_STARTUP 1024 /* 8 in Q7 */ #define WIDTH_Q8 3 /* 0.01 in Q8 (or 25 ) */ /* PARAMETERS FOR NEW METHOD */ #define DD_PR_SNR_Q11 2007 /* ~= Q11(0.98) DD update of prior SNR */ #define ONE_MINUS_DD_PR_SNR_Q11 41 /* DD update of prior SNR */ #define SPECT_FLAT_TAVG_Q14 4915 /* (0.30) tavg parameter for spectral flatness measure */ #define SPECT_DIFF_TAVG_Q8 77 /* (0.30) tavg parameter for spectral flatness measure */ #define PRIOR_UPDATE_Q14 1638 /* Q14(0.1) Update parameter of prior model */ #define NOISE_UPDATE_Q8 26 /* 26 ~= Q8(0.1) Update parameter for noise */ /* Probability threshold for noise state in speech/noise likelihood. */ #define ONE_MINUS_PROB_RANGE_Q8 205 /* 205 ~= Q8(0.8) */ #define HIST_PAR_EST 1000 /* Histogram size for estimation of parameters */ /* FEATURE EXTRACTION CONFIG */ /* Bin size of histogram */ #define BIN_SIZE_LRT 10 /* Scale parameters: multiply dominant peaks of the histograms by scale factor to obtain. */ /* Thresholds for prior model */ #define FACTOR_1_LRT_DIFF 6 /* For LRT and spectral difference (5 times bigger) */ /* For spectral_flatness: used when noise is flatter than speech (10 times bigger). */ #define FACTOR_2_FLAT_Q10 922 /* Peak limit for spectral flatness (varies between 0 and 1) */ #define THRES_PEAK_FLAT 24 /* * 2 * BIN_SIZE_FLAT_FX */ /* Limit on spacing of two highest peaks in histogram: spacing determined by bin size. */ #define LIM_PEAK_SPACE_FLAT_DIFF 4 /* * 2 * BIN_SIZE_DIFF_FX */ /* Limit on relevance of second peak */ #define LIM_PEAK_WEIGHT_FLAT_DIFF 2 #define THRES_FLUCT_LRT 10240 /* = 20 * inst->modelUpdate; fluctuation limit of LRT feat. */ /* Limit on the max and min values for the feature thresholds */ #define MAX_FLAT_Q10 38912 /* * 2 * BIN_SIZE_FLAT_FX */ #define MIN_FLAT_Q10 4096 /* * 2 * BIN_SIZE_FLAT_FX */ #define MAX_DIFF 100 /* * 2 * BIN_SIZE_DIFF_FX */ #define MIN_DIFF 16 /* * 2 * BIN_SIZE_DIFF_FX */ /* Criteria of weight of histogram peak to accept/reject feature */ #define THRES_WEIGHT_FLAT_DIFF 154 /*(int)(0.3*(inst->modelUpdate)) for flatness and difference */ #define STAT_UPDATES 9 /* Update every 512 = 1 << 9 block */ #define ONE_MINUS_GAMMA_PAUSE_Q8 13 /* ~= Q8(0.05) Update for conservative noise estimate */ #define GAMMA_NOISE_TRANS_AND_SPEECH_Q8 3 /* ~= Q8(0.01) Update for transition and noise region */ #endif /* WEBRTC_MODULES_AUDIO_PROCESSING_NS_MAIN_SOURCE_NSX_DEFINES_H_ */
/* PR c/60156 */ /* { dg-do compile } */ /* { dg-options "-Wpedantic" } */ int main (int argc, char *argv[], ...) /* { dg-warning "declared as variadic function" } */ { return 0; }
/* * PCI bus setup for Marvell mv64360/mv64460 host bridges (Discovery) * * Author: Dale Farnsworth <dale@farnsworth.org> * * 2007 (c) MontaVista, Software, Inc. 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. */ #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/stat.h> #include <linux/pci.h> #include <asm/prom.h> #include <asm/pci-bridge.h> #define PCI_HEADER_TYPE_INVALID 0x7f /* Invalid PCI header type */ #ifdef CONFIG_SYSFS /* 32-bit hex or dec stringified number + '\n' */ #define MV64X60_VAL_LEN_MAX 11 #define MV64X60_PCICFG_CPCI_HOTSWAP 0x68 static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { struct pci_dev *phb; u32 v; if (off > 0) return 0; if (count < MV64X60_VAL_LEN_MAX) return -EINVAL; phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); if (!phb) return -ENODEV; pci_read_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, &v); pci_dev_put(phb); return sprintf(buf, "0x%08x\n", v); } static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { struct pci_dev *phb; u32 v; if (off > 0) return 0; if (count <= 0) return -EINVAL; if (sscanf(buf, "%i", &v) != 1) return -EINVAL; phb = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); if (!phb) return -ENODEV; pci_write_config_dword(phb, MV64X60_PCICFG_CPCI_HOTSWAP, v); pci_dev_put(phb); return count; } static struct bin_attribute mv64x60_hs_reg_attr = { /* Hotswap register */ .attr = { .name = "hs_reg", .mode = S_IRUGO | S_IWUSR, }, .size = MV64X60_VAL_LEN_MAX, .read = mv64x60_hs_reg_read, .write = mv64x60_hs_reg_write, }; static int __init mv64x60_sysfs_init(void) { struct device_node *np; struct platform_device *pdev; const unsigned int *prop; np = of_find_compatible_node(NULL, NULL, "marvell,mv64360"); if (!np) return 0; prop = of_get_property(np, "hs_reg_valid", NULL); of_node_put(np); pdev = platform_device_register_simple("marvell,mv64360", 0, NULL, 0); if (IS_ERR(pdev)) return PTR_ERR(pdev); return sysfs_create_bin_file(&pdev->dev.kobj, &mv64x60_hs_reg_attr); } subsys_initcall(mv64x60_sysfs_init); #endif /* CONFIG_SYSFS */ static void __init mv64x60_pci_fixup_early(struct pci_dev *dev) { /* * Set the host bridge hdr_type to an invalid value so that * pci_setup_device() will ignore the host bridge. */ dev->hdr_type = PCI_HEADER_TYPE_INVALID; } DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_MV64360, mv64x60_pci_fixup_early); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_MV64460, mv64x60_pci_fixup_early); static int __init mv64x60_add_bridge(struct device_node *dev) { int len; struct pci_controller *hose; struct resource rsrc; const int *bus_range; int primary; memset(&rsrc, 0, sizeof(rsrc)); /* Fetch host bridge registers address */ if (of_address_to_resource(dev, 0, &rsrc)) { printk(KERN_ERR "No PCI reg property in device tree\n"); return -ENODEV; } /* Get bus range if any */ bus_range = of_get_property(dev, "bus-range", &len); if (bus_range == NULL || len < 2 * sizeof(int)) printk(KERN_WARNING "Can't get bus-range for %s, assume" " bus 0\n", dev->full_name); hose = pcibios_alloc_controller(dev); if (!hose) return -ENOMEM; hose->first_busno = bus_range ? bus_range[0] : 0; hose->last_busno = bus_range ? bus_range[1] : 0xff; setup_indirect_pci(hose, rsrc.start, rsrc.start + 4, 0); hose->self_busno = hose->first_busno; printk(KERN_INFO "Found MV64x60 PCI host bridge at 0x%016llx. " "Firmware bus number: %d->%d\n", (unsigned long long)rsrc.start, hose->first_busno, hose->last_busno); /* Interpret the "ranges" property */ /* This also maps the I/O region and sets isa_io/mem_base */ primary = (hose->first_busno == 0); pci_process_bridge_OF_ranges(hose, dev, primary); return 0; } void __init mv64x60_pci_init(void) { struct device_node *np; for_each_compatible_node(np, "pci", "marvell,mv64360-pci") mv64x60_add_bridge(np); }
/***************************************************************************/ /* */ /* svpostnm.h */ /* */ /* The FreeType PostScript name services (specification). */ /* */ /* Copyright 2003-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef __SVPOSTNM_H__ #define __SVPOSTNM_H__ #include FT_INTERNAL_SERVICE_H FT_BEGIN_HEADER /* * A trivial service used to retrieve the PostScript name of a given * font when available. The `get_name' field should never be NULL. * * The corresponding function can return NULL to indicate that the * PostScript name is not available. * * The name is owned by the face and will be destroyed with it. */ #define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name" typedef const char* (*FT_PsName_GetFunc)( FT_Face face ); FT_DEFINE_SERVICE( PsFontName ) { FT_PsName_GetFunc get_ps_font_name; }; #ifndef FT_CONFIG_OPTION_PIC #define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ static const FT_Service_PsFontNameRec class_ = \ { \ get_ps_font_name_ \ }; #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ void \ FT_Init_Class_ ## class_( FT_Library library, \ FT_Service_PsFontNameRec* clazz ) \ { \ FT_UNUSED( library ); \ \ clazz->get_ps_font_name = get_ps_font_name_; \ } #endif /* FT_CONFIG_OPTION_PIC */ /* */ FT_END_HEADER #endif /* __SVPOSTNM_H__ */ /* END */
/* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-pre-stats" } */ struct X { int i; }; int foo (int x) { struct X a; struct X b; struct X *p; a.i = 1; b.i = 2; if (x) p = &a; else p = &b; return p->i; } /* We should eliminate the load from p for a PHI node with values 1 and 2. */ /* { dg-final { scan-tree-dump "Eliminated: 1" "pre" } } */ /* { dg-final { cleanup-tree-dump "pre" } } */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_HISTORY_ANDROID_URLS_SQL_HANDLER_H_ #define CHROME_BROWSER_HISTORY_ANDROID_URLS_SQL_HANDLER_H_ #include "chrome/browser/history/android/sql_handler.h" namespace history { class HistoryDatabase; // This class is the SQLHandler implementation for urls table. class UrlsSQLHandler : public SQLHandler { public: explicit UrlsSQLHandler(HistoryDatabase* history_db); virtual ~UrlsSQLHandler(); // Overriden from SQLHandler. virtual bool Insert(HistoryAndBookmarkRow* row) OVERRIDE; virtual bool Update(const HistoryAndBookmarkRow& row, const TableIDRows& ids_set) OVERRIDE; virtual bool Delete(const TableIDRows& ids_set) OVERRIDE; private: HistoryDatabase* history_db_; DISALLOW_COPY_AND_ASSIGN(UrlsSQLHandler); }; } // namespace history. #endif // CHROME_BROWSER_HISTORY_ANDROID_URLS_SQL_HANDLER_H_
/* * Copyright (C) 2007 Google, Inc. * Copyright (c) 2008-2011, The Linux Foundation. All rights reserved. * Author: Brian Swetland <swetland@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. * * * The MSM peripherals are spread all over across 768MB of physical * space, which makes just having a simple IO_ADDRESS macro to slide * them into the right virtual location rough. Instead, we will * provide a master phys->virt mapping for peripherals here. * */ #ifndef __ASM_ARCH_MSM_IOMAP_8960_H #define __ASM_ARCH_MSM_IOMAP_8960_H /* Physical base address and size of peripherals. * Ordered by the virtual base addresses they will be mapped at. * * If you add or remove entries here, you'll want to edit the * msm_io_desc array in arch/arm/mach-msm/io.c to reflect your * changes. * */ #define MSM8960_TMR_PHYS 0x0200A000 #define MSM8960_TMR_SIZE SZ_4K #define MSM8960_TMR0_PHYS 0x0208A000 #define MSM8960_TMR0_SIZE SZ_4K #define MSM8960_RPM_PHYS 0x00108000 #define MSM8960_RPM_SIZE SZ_4K #define MSM8960_RPM_MPM_PHYS 0x00200000 #define MSM8960_RPM_MPM_SIZE SZ_4K #define MSM8960_TCSR_PHYS 0x1A400000 #define MSM8960_TCSR_SIZE SZ_4K #define MSM8960_APCS_GCC_PHYS 0x02011000 #define MSM8960_APCS_GCC_SIZE SZ_4K #define MSM8960_SAW_L2_PHYS 0x02012000 #define MSM8960_SAW_L2_SIZE SZ_4K #define MSM8960_SAW0_PHYS 0x02089000 #define MSM8960_SAW0_SIZE SZ_4K #define MSM8960_SAW1_PHYS 0x02099000 #define MSM8960_SAW1_SIZE SZ_4K #define MSM8960_IMEM_PHYS 0x2A03F000 #define MSM8960_IMEM_SIZE SZ_4K #define MSM8960_ACC0_PHYS 0x02088000 #define MSM8960_ACC0_SIZE SZ_4K #define MSM8960_ACC1_PHYS 0x02098000 #define MSM8960_ACC1_SIZE SZ_4K #define MSM8960_QGIC_DIST_PHYS 0x02000000 #define MSM8960_QGIC_DIST_SIZE SZ_4K #define MSM8960_QGIC_CPU_PHYS 0x02002000 #define MSM8960_QGIC_CPU_SIZE SZ_4K #define MSM8960_CLK_CTL_PHYS 0x00900000 #define MSM8960_CLK_CTL_SIZE SZ_16K #define MSM8960_MMSS_CLK_CTL_PHYS 0x04000000 #define MSM8960_MMSS_CLK_CTL_SIZE SZ_4K #define MSM8960_LPASS_CLK_CTL_PHYS 0x28000000 #define MSM8960_LPASS_CLK_CTL_SIZE SZ_4K #define MSM8960_HFPLL_PHYS 0x00903000 #define MSM8960_HFPLL_SIZE SZ_4K #define MSM8960_TLMM_PHYS 0x00800000 #define MSM8960_TLMM_SIZE SZ_16K #define MSM8960_SIC_NON_SECURE_PHYS 0x12100000 #define MSM8960_SIC_NON_SECURE_SIZE SZ_64K #define MSM_GPT_BASE (MSM_TMR_BASE + 0x4) #define MSM_DGT_BASE (MSM_TMR_BASE + 0x24) #define MSM8960_HDMI_PHYS 0x04A00000 #define MSM8960_HDMI_SIZE SZ_4K #ifdef CONFIG_DEBUG_MSM8960_UART #define MSM_DEBUG_UART_BASE IOMEM(0xFA740000) #define MSM_DEBUG_UART_PHYS 0x16440000 #endif #define MSM8960_QFPROM_PHYS 0x00700000 #define MSM8960_QFPROM_SIZE SZ_4K #ifndef __ASSEMBLY__ extern void msm_map_msm8960_io(void); #endif #endif
/* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #ifndef WebNotificationPresenter_h #define WebNotificationPresenter_h #include "qwebkitplatformplugin.h" #include <QBitmap> #include <QEvent> #include <QGridLayout> #include <QLabel> #include <QPainter> #include <QWidget> class WebNotificationWidget : public QWidget { Q_OBJECT public: WebNotificationWidget(); virtual ~WebNotificationWidget(); void showNotification(const QWebNotificationData*); bool event(QEvent*); Q_SIGNALS: void notificationClosed(); void notificationClicked(); }; class WebNotificationPresenter : public QWebNotificationPresenter { Q_OBJECT public: WebNotificationPresenter() : QWebNotificationPresenter() { m_widget = new WebNotificationWidget(); connect(m_widget, SIGNAL(notificationClosed()), this, SIGNAL(notificationClosed())); connect(m_widget, SIGNAL(notificationClicked()), this, SIGNAL(notificationClicked())); } virtual ~WebNotificationPresenter() { m_widget->close(); delete m_widget; } void showNotification(const QWebNotificationData* data) { m_widget->showNotification(data); } private: WebNotificationWidget* m_widget; }; #endif // WebNotificationsUi_h
/* The zlib/libpng License Copyright (c) 2006 Chris Snyder This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef OIS_MacHelpers_H #define OIS_MacHelpers_H #include "mac/MacPrereqs.h" #include "OISEvents.h" #include "OISKeyboard.h" #include "OISMouse.h" #include <Carbon/Carbon.h> // This is a hack needed to get the event handler working. // The carbon lib expects a "OSStatus (*)(EventHandlerCallRef, EventRef, void*)", // so I cannot give it a class member function (unless it is static which is pointless) // Instead, I just pass the class* through the last paramter that gets passed to the // callback every time an event occurs. Then I dereference it and call the member function. OSStatus KeyDownWrapper( EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass ); OSStatus KeyUpWrapper( EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass ); OSStatus KeyModWrapper( EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass ); OSStatus MouseWrapper( EventHandlerCallRef nextHandler, EventRef theEvent, void* callClass ); // This is needed for keeping an event stack for keyboard and mouse namespace OIS { // used in the eventStack to store the type enum Mac_EventType { MAC_KEYUP = 0, MAC_KEYDOWN = 1, MAC_KEYREPEAT, MAC_MOUSEDOWN, MAC_MOUSEUP, MAC_MOUSEMOVED, MAC_MOUSESCROLL}; typedef enum Mac_EventType MacEventType; // only used by MacKeyboard typedef class Mac_KeyStackEvent { friend class MacKeyboard; private: Mac_KeyStackEvent( KeyEvent event, MacEventType type ) : Event(event), Type(type) {} MacEventType Type; KeyEvent Event; } MacKeyStackEvent; } #endif
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CONSTANTS_H_ #define CONSTANTS_H_ const uint32_t SIZE_OF_PARTITION_LENGTH = sizeof(uint32_t); const uint32_t SIZE_OF_KEY_LENGTH = sizeof(uint32_t); const uint32_t SIZE_OF_VALUE_LENGTH = sizeof(uint32_t); const uint32_t SIZE_OF_KV_LENGTH = SIZE_OF_KEY_LENGTH + SIZE_OF_VALUE_LENGTH; #endif //CONSTANTS_H_
/* * OMAP2xxx sys_clk-specific clock code * * Copyright (C) 2005-2008 Texas Instruments, Inc. * Copyright (C) 2004-2010 Nokia Corporation * * Contacts: * Richard Woodruff <r-woodruff2@ti.com> * Paul Walmsley * * Based on earlier work by Tuukka Tikkanen, Tony Lindgren, * Gordon McNutt and RidgeRun, Inc. * * 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. */ #undef DEBUG #include <linux/kernel.h> #include <linux/errno.h> #include <linux/clk.h> #include <linux/io.h> #include <plat/clock.h> #include "clock.h" #include "clock2xxx.h" #include "prm.h" #include "prm-regbits-24xx.h" void __iomem *prcm_clksrc_ctrl; u32 omap2xxx_get_sysclkdiv(void) { u32 div; div = __raw_readl(prcm_clksrc_ctrl); div &= OMAP_SYSCLKDIV_MASK; div >>= OMAP_SYSCLKDIV_SHIFT; return div; } unsigned long omap2xxx_sys_clk_recalc(struct clk *clk) { return clk->parent->rate / omap2xxx_get_sysclkdiv(); }
/* Hopper VP-3028 driver Copyright (C) Manu Abraham (abraham.manu@gmail.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. 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/signal.h> #include <linux/sched.h> #include <linux/interrupt.h> #include <media/dmxdev.h> #include <media/dvbdev.h> #include <media/dvb_demux.h> #include <media/dvb_frontend.h> #include <media/dvb_net.h> #include "zl10353.h" #include "mantis_common.h" #include "mantis_ioc.h" #include "mantis_dvb.h" #include "hopper_vp3028.h" static struct zl10353_config hopper_vp3028_config = { .demod_address = 0x0f, }; #define MANTIS_MODEL_NAME "VP-3028" #define MANTIS_DEV_TYPE "DVB-T" static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) { struct i2c_adapter *adapter = &mantis->adapter; struct mantis_hwconfig *config = mantis->hwconfig; int err = 0; mantis_gpio_set_bits(mantis, config->reset, 0); msleep(100); err = mantis_frontend_power(mantis, POWER_ON); msleep(100); mantis_gpio_set_bits(mantis, config->reset, 1); err = mantis_frontend_power(mantis, POWER_ON); if (err == 0) { msleep(250); dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); fe = dvb_attach(zl10353_attach, &hopper_vp3028_config, adapter); if (!fe) return -1; } else { dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", adapter->name, err); return -EIO; } dprintk(MANTIS_ERROR, 1, "Done!"); return 0; } struct mantis_hwconfig vp3028_config = { .model_name = MANTIS_MODEL_NAME, .dev_type = MANTIS_DEV_TYPE, .ts_size = MANTIS_TS_188, .baud_rate = MANTIS_BAUD_9600, .parity = MANTIS_PARITY_NONE, .bytes = 0, .frontend_init = vp3028_frontend_init, .power = GPIF_A00, .reset = GPIF_A03, };
/* * Copyright (C) ST-Ericsson SA 2011-2013 * * License Terms: GNU General Public License v2 * * Author: Mathieu Poirier <mathieu.poirier@linaro.org> for ST-Ericsson * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> #include <linux/kernel.h> #include <linux/moduleparam.h> #include <linux/err.h> #include <linux/uaccess.h> #include <linux/watchdog.h> #include <linux/platform_device.h> #include <linux/platform_data/ux500_wdt.h> #include <linux/mfd/dbx500-prcmu.h> #define WATCHDOG_TIMEOUT 600 /* 10 minutes */ #define WATCHDOG_MIN 0 #define WATCHDOG_MAX28 268435 /* 28 bit resolution in ms == 268435.455 s */ #define WATCHDOG_MAX32 4294967 /* 32 bit resolution in ms == 4294967.295 s */ static unsigned int timeout = WATCHDOG_TIMEOUT; module_param(timeout, uint, 0); MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, bool, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); static int ux500_wdt_start(struct watchdog_device *wdd) { return prcmu_enable_a9wdog(PRCMU_WDOG_ALL); } static int ux500_wdt_stop(struct watchdog_device *wdd) { return prcmu_disable_a9wdog(PRCMU_WDOG_ALL); } static int ux500_wdt_keepalive(struct watchdog_device *wdd) { return prcmu_kick_a9wdog(PRCMU_WDOG_ALL); } static int ux500_wdt_set_timeout(struct watchdog_device *wdd, unsigned int timeout) { ux500_wdt_stop(wdd); prcmu_load_a9wdog(PRCMU_WDOG_ALL, timeout * 1000); ux500_wdt_start(wdd); return 0; } static const struct watchdog_info ux500_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, .identity = "Ux500 WDT", .firmware_version = 1, }; static const struct watchdog_ops ux500_wdt_ops = { .owner = THIS_MODULE, .start = ux500_wdt_start, .stop = ux500_wdt_stop, .ping = ux500_wdt_keepalive, .set_timeout = ux500_wdt_set_timeout, }; static struct watchdog_device ux500_wdt = { .info = &ux500_wdt_info, .ops = &ux500_wdt_ops, .min_timeout = WATCHDOG_MIN, .max_timeout = WATCHDOG_MAX32, }; static int ux500_wdt_probe(struct platform_device *pdev) { int ret; struct ux500_wdt_data *pdata = dev_get_platdata(&pdev->dev); if (pdata) { if (pdata->timeout > 0) timeout = pdata->timeout; if (pdata->has_28_bits_resolution) ux500_wdt.max_timeout = WATCHDOG_MAX28; } watchdog_set_nowayout(&ux500_wdt, nowayout); /* disable auto off on sleep */ prcmu_config_a9wdog(PRCMU_WDOG_CPU1, false); /* set HW initial value */ prcmu_load_a9wdog(PRCMU_WDOG_ALL, timeout * 1000); ret = watchdog_register_device(&ux500_wdt); if (ret) return ret; dev_info(&pdev->dev, "initialized\n"); return 0; } static int ux500_wdt_remove(struct platform_device *dev) { watchdog_unregister_device(&ux500_wdt); return 0; } #ifdef CONFIG_PM static int ux500_wdt_suspend(struct platform_device *pdev, pm_message_t state) { if (watchdog_active(&ux500_wdt)) { ux500_wdt_stop(&ux500_wdt); prcmu_config_a9wdog(PRCMU_WDOG_CPU1, true); prcmu_load_a9wdog(PRCMU_WDOG_ALL, timeout * 1000); ux500_wdt_start(&ux500_wdt); } return 0; } static int ux500_wdt_resume(struct platform_device *pdev) { if (watchdog_active(&ux500_wdt)) { ux500_wdt_stop(&ux500_wdt); prcmu_config_a9wdog(PRCMU_WDOG_CPU1, false); prcmu_load_a9wdog(PRCMU_WDOG_ALL, timeout * 1000); ux500_wdt_start(&ux500_wdt); } return 0; } #else #define ux500_wdt_suspend NULL #define ux500_wdt_resume NULL #endif static struct platform_driver ux500_wdt_driver = { .probe = ux500_wdt_probe, .remove = ux500_wdt_remove, .suspend = ux500_wdt_suspend, .resume = ux500_wdt_resume, .driver = { .name = "ux500_wdt", }, }; module_platform_driver(ux500_wdt_driver); MODULE_AUTHOR("Jonas Aaberg <jonas.aberg@stericsson.com>"); MODULE_DESCRIPTION("Ux500 Watchdog Driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:ux500_wdt");
/***************************************************************************/ /* */ /* ttpic.h */ /* */ /* The FreeType position independent code services for truetype module. */ /* */ /* Copyright 2009 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #ifndef __TTPIC_H__ #define __TTPIC_H__ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC #define FT_TT_SERVICES_GET tt_services #define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters #define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf #else /* FT_CONFIG_OPTION_PIC */ #include FT_MULTIPLE_MASTERS_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_TRUETYPE_GLYF_H typedef struct TTModulePIC_ { FT_ServiceDescRec* tt_services; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Service_MultiMastersRec tt_service_gx_multi_masters; #endif FT_Service_TTGlyfRec tt_service_truetype_glyf; } TTModulePIC; #define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype)) #define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services) #define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters) #define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf) #endif /* FT_CONFIG_OPTION_PIC */ /* */ FT_END_HEADER #endif /* __TTPIC_H__ */ /* END */
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_xml_dom_DomProcessingInstruction__ #define __gnu_xml_dom_DomProcessingInstruction__ #pragma interface #include <gnu/xml/dom/DomNode.h> extern "Java" { namespace gnu { namespace xml { namespace dom { class DomDocument; class DomProcessingInstruction; } } } } class gnu::xml::dom::DomProcessingInstruction : public ::gnu::xml::dom::DomNode { public: // actually protected DomProcessingInstruction(::gnu::xml::dom::DomDocument *, ::java::lang::String *, ::java::lang::String *); public: virtual ::java::lang::String * getTarget(); virtual ::java::lang::String * getNodeName(); virtual ::java::lang::String * getData(); virtual ::java::lang::String * getNodeValue(); virtual void setData(::java::lang::String *); virtual void setNodeValue(::java::lang::String *); private: ::java::lang::String * __attribute__((aligned(__alignof__( ::gnu::xml::dom::DomNode)))) target; ::java::lang::String * data; public: static ::java::lang::Class class$; }; #endif // __gnu_xml_dom_DomProcessingInstruction__
#pragma once /* * Copyright (C) 2014 Team XBMC * http://xbmc.org * * 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, 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 XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "filesystem/IFile.h" #include <string> typedef void* HANDLE; // forward declaration namespace XFILE { class CWin32File : public IFile { public: CWin32File(); virtual ~CWin32File(); virtual bool Open(const CURL& url); virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false); virtual void Close(); virtual ssize_t Read(void* lpBuf, size_t uiBufSize); virtual ssize_t Write(const void* lpBuf, size_t uiBufSize); virtual int64_t Seek(int64_t iFilePosition, int iWhence = SEEK_SET); virtual int Truncate(int64_t toSize); virtual int64_t GetPosition(); virtual int64_t GetLength(); virtual void Flush(); virtual bool Delete(const CURL& url); virtual bool Rename(const CURL& urlCurrentName, const CURL& urlNewName); virtual bool SetHidden(const CURL& url, bool hidden); virtual bool Exists(const CURL& url); virtual int Stat(const CURL& url, struct __stat64* statData); virtual int Stat(struct __stat64* statData); protected: CWin32File(bool asSmbFile); HANDLE m_hFile; int64_t m_filePos; bool m_allowWrite; // file path and name in win32 long form "\\?\D:\path\to\file.ext" std::wstring m_filepathnameW; const bool m_smbFile; // true for SMB file, false for local file unsigned long m_lastSMBFileErr; // used for SMB file operations }; }
/* { dg-do run } */ /* { dg-options "-O2 -fpredictive-commoning -msse2 -std=c99" } */ /* { dg-require-effective-target sse2 } */ #include <x86intrin.h> #include "isa-check.h" #include "sse-os-support.h" int main() { const float mem[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; unsigned int indexes[8]; for (unsigned int i = 0; i < 8; ++i) indexes[i] = i; check_isa (); if (!sse_os_support ()) exit (0); __m128 x = _mm_setr_ps(0, 1, 2, 3); for (unsigned int i = 0; i + 4 < 6; ++i) { const unsigned int *ii = &indexes[i]; const __m128 tmp = _mm_setr_ps(mem[ii[0]], mem[ii[1]], mem[ii[2]], mem[ii[3]]); if (0xf != _mm_movemask_ps(_mm_cmpeq_ps(tmp, x))) { __builtin_abort(); } x = _mm_add_ps(x, _mm_set1_ps(1)); } return 0; }
/********************************************************************** * Author: Cavium, Inc. * * Contact: support@cavium.com * Please include "LiquidIO" in the subject. * * Copyright (c) 2003-2015 Cavium, Inc. * * This file 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. * * This file is distributed in the hope that it will be useful, but * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or * NONINFRINGEMENT. See the GNU General Public License for more * details. * * This file may also be available under a different license from Cavium. * Contact Cavium, Inc. for more information **********************************************************************/ /*! \file octeon_network.h * \brief Host NIC Driver: Structure and Macro definitions used by NIC Module. */ #ifndef __OCTEON_NETWORK_H__ #define __OCTEON_NETWORK_H__ #include <linux/version.h> #include <linux/dma-mapping.h> #include <linux/ptp_clock_kernel.h> /** LiquidIO per-interface network private data */ struct lio { /** State of the interface. Rx/Tx happens only in the RUNNING state. */ atomic_t ifstate; /** Octeon Interface index number. This device will be represented as * oct<ifidx> in the system. */ int ifidx; /** Octeon Input queue to use to transmit for this network interface. */ int txq; /** Octeon Output queue from which pkts arrive * for this network interface. */ int rxq; /** Guards the glist */ spinlock_t lock; /** Linked list of gather components */ struct list_head glist; /** Pointer to the NIC properties for the Octeon device this network * interface is associated with. */ struct octdev_props *octprops; /** Pointer to the octeon device structure. */ struct octeon_device *oct_dev; struct net_device *netdev; /** Link information sent by the core application for this interface. */ struct oct_link_info linfo; /** Size of Tx queue for this octeon device. */ u32 tx_qsize; /** Size of Rx queue for this octeon device. */ u32 rx_qsize; /** Size of MTU this octeon device. */ u32 mtu; /** msg level flag per interface. */ u32 msg_enable; /** Copy of Interface capabilities: TSO, TSO6, LRO, Chescksums . */ u64 dev_capability; /** Copy of beacaon reg in phy */ u32 phy_beacon_val; /** Copy of ctrl reg in phy */ u32 led_ctrl_val; /* PTP clock information */ struct ptp_clock_info ptp_info; struct ptp_clock *ptp_clock; s64 ptp_adjust; /* for atomic access to Octeon PTP reg and data struct */ spinlock_t ptp_lock; /* Interface info */ u32 intf_open; /* work queue for txq status */ struct cavium_wq txq_status_wq; }; #define LIO_SIZE (sizeof(struct lio)) #define GET_LIO(netdev) ((struct lio *)netdev_priv(netdev)) /** * \brief Enable or disable feature * @param netdev pointer to network device * @param cmd Command that just requires acknowledgment */ int liquidio_set_feature(struct net_device *netdev, int cmd); /** * \brief Link control command completion callback * @param nctrl_ptr pointer to control packet structure * * This routine is called by the callback function when a ctrl pkt sent to * core app completes. The nctrl_ptr contains a copy of the command type * and data sent to the core app. This routine is only called if the ctrl * pkt was sent successfully to the core app. */ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr); /** * \brief Register ethtool operations * @param netdev pointer to network device */ void liquidio_set_ethtool_ops(struct net_device *netdev); static inline void *recv_buffer_alloc(struct octeon_device *oct __attribute__((unused)), u32 q_no __attribute__((unused)), u32 size) { #define SKB_ADJ_MASK 0x3F #define SKB_ADJ (SKB_ADJ_MASK + 1) struct sk_buff *skb = dev_alloc_skb(size + SKB_ADJ); if ((unsigned long)skb->data & SKB_ADJ_MASK) { u32 r = SKB_ADJ - ((unsigned long)skb->data & SKB_ADJ_MASK); skb_reserve(skb, r); } return (void *)skb; } static inline void recv_buffer_free(void *buffer) { dev_kfree_skb_any((struct sk_buff *)buffer); } #define lio_dma_alloc(oct, size, dma_addr) \ dma_alloc_coherent(&oct->pci_dev->dev, size, dma_addr, GFP_KERNEL) #define lio_dma_free(oct, size, virt_addr, dma_addr) \ dma_free_coherent(&oct->pci_dev->dev, size, virt_addr, dma_addr) #define get_rbd(ptr) (((struct sk_buff *)(ptr))->data) static inline u64 lio_map_ring_info(struct octeon_droq *droq, u32 i) { dma_addr_t dma_addr; struct octeon_device *oct = droq->oct_dev; dma_addr = dma_map_single(&oct->pci_dev->dev, &droq->info_list[i], OCT_DROQ_INFO_SIZE, DMA_FROM_DEVICE); BUG_ON(dma_mapping_error(&oct->pci_dev->dev, dma_addr)); return (u64)dma_addr; } static inline void lio_unmap_ring_info(struct pci_dev *pci_dev, u64 info_ptr, u32 size) { dma_unmap_single(&pci_dev->dev, info_ptr, size, DMA_FROM_DEVICE); } static inline u64 lio_map_ring(struct pci_dev *pci_dev, void *buf, u32 size) { dma_addr_t dma_addr; dma_addr = dma_map_single(&pci_dev->dev, get_rbd(buf), size, DMA_FROM_DEVICE); BUG_ON(dma_mapping_error(&pci_dev->dev, dma_addr)); return (u64)dma_addr; } static inline void lio_unmap_ring(struct pci_dev *pci_dev, u64 buf_ptr, u32 size) { dma_unmap_single(&pci_dev->dev, buf_ptr, size, DMA_FROM_DEVICE); } static inline void *octeon_fast_packet_alloc(struct octeon_device *oct, struct octeon_droq *droq, u32 q_no, u32 size) { return recv_buffer_alloc(oct, q_no, size); } static inline void octeon_fast_packet_next(struct octeon_droq *droq, struct sk_buff *nicbuf, int copy_len, int idx) { memcpy(skb_put(nicbuf, copy_len), get_rbd(droq->recv_buf_list[idx].buffer), copy_len); } #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __javax_swing_plaf_InternalFrameUI__ #define __javax_swing_plaf_InternalFrameUI__ #pragma interface #include <javax/swing/plaf/ComponentUI.h> extern "Java" { namespace javax { namespace swing { namespace plaf { class InternalFrameUI; } } } } class javax::swing::plaf::InternalFrameUI : public ::javax::swing::plaf::ComponentUI { public: InternalFrameUI(); static ::java::lang::Class class$; }; #endif // __javax_swing_plaf_InternalFrameUI__
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * 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 version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * * GPL HEADER END */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * * lnet/selftest/timer.c * * Author: Isaac Huang <isaac@clusterfs.com> */ #define DEBUG_SUBSYSTEM S_LNET #include "selftest.h" /* * Timers are implemented as a sorted queue of expiry times. The queue * is slotted, with each slot holding timers which expire in a * 2**STTIMER_MINPOLL (8) second period. The timers in each slot are * sorted by increasing expiry time. The number of slots is 2**7 (128), * to cover a time period of 1024 seconds into the future before wrapping. */ #define STTIMER_MINPOLL 3 /* log2 min poll interval (8 s) */ #define STTIMER_SLOTTIME (1 << STTIMER_MINPOLL) #define STTIMER_SLOTTIMEMASK (~(STTIMER_SLOTTIME - 1)) #define STTIMER_NSLOTS (1 << 7) #define STTIMER_SLOT(t) (&stt_data.stt_hash[(((t) >> STTIMER_MINPOLL) & \ (STTIMER_NSLOTS - 1))]) struct st_timer_data { spinlock_t stt_lock; /* start time of the slot processed previously */ unsigned long stt_prev_slot; struct list_head stt_hash[STTIMER_NSLOTS]; int stt_shuttingdown; wait_queue_head_t stt_waitq; int stt_nthreads; } stt_data; void stt_add_timer(stt_timer_t *timer) { struct list_head *pos; spin_lock(&stt_data.stt_lock); LASSERT(stt_data.stt_nthreads > 0); LASSERT(!stt_data.stt_shuttingdown); LASSERT(timer->stt_func != NULL); LASSERT(list_empty(&timer->stt_list)); LASSERT(cfs_time_after(timer->stt_expires, get_seconds())); /* a simple insertion sort */ list_for_each_prev(pos, STTIMER_SLOT(timer->stt_expires)) { stt_timer_t *old = list_entry(pos, stt_timer_t, stt_list); if (cfs_time_aftereq(timer->stt_expires, old->stt_expires)) break; } list_add(&timer->stt_list, pos); spin_unlock(&stt_data.stt_lock); } /* * The function returns whether it has deactivated a pending timer or not. * (ie. del_timer() of an inactive timer returns 0, del_timer() of an * active timer returns 1.) * * CAVEAT EMPTOR: * When 0 is returned, it is possible that timer->stt_func _is_ running on * another CPU. */ int stt_del_timer(stt_timer_t *timer) { int ret = 0; spin_lock(&stt_data.stt_lock); LASSERT(stt_data.stt_nthreads > 0); LASSERT(!stt_data.stt_shuttingdown); if (!list_empty(&timer->stt_list)) { ret = 1; list_del_init(&timer->stt_list); } spin_unlock(&stt_data.stt_lock); return ret; } /* called with stt_data.stt_lock held */ int stt_expire_list(struct list_head *slot, unsigned long now) { int expired = 0; stt_timer_t *timer; while (!list_empty(slot)) { timer = list_entry(slot->next, stt_timer_t, stt_list); if (cfs_time_after(timer->stt_expires, now)) break; list_del_init(&timer->stt_list); spin_unlock(&stt_data.stt_lock); expired++; (*timer->stt_func) (timer->stt_data); spin_lock(&stt_data.stt_lock); } return expired; } int stt_check_timers(unsigned long *last) { int expired = 0; unsigned long now; unsigned long this_slot; now = get_seconds(); this_slot = now & STTIMER_SLOTTIMEMASK; spin_lock(&stt_data.stt_lock); while (cfs_time_aftereq(this_slot, *last)) { expired += stt_expire_list(STTIMER_SLOT(this_slot), now); this_slot = cfs_time_sub(this_slot, STTIMER_SLOTTIME); } *last = now & STTIMER_SLOTTIMEMASK; spin_unlock(&stt_data.stt_lock); return expired; } int stt_timer_main(void *arg) { cfs_block_allsigs(); while (!stt_data.stt_shuttingdown) { stt_check_timers(&stt_data.stt_prev_slot); wait_event_timeout(stt_data.stt_waitq, stt_data.stt_shuttingdown, cfs_time_seconds(STTIMER_SLOTTIME)); } spin_lock(&stt_data.stt_lock); stt_data.stt_nthreads--; spin_unlock(&stt_data.stt_lock); return 0; } int stt_start_timer_thread(void) { struct task_struct *task; LASSERT(!stt_data.stt_shuttingdown); task = kthread_run(stt_timer_main, NULL, "st_timer"); if (IS_ERR(task)) return PTR_ERR(task); spin_lock(&stt_data.stt_lock); stt_data.stt_nthreads++; spin_unlock(&stt_data.stt_lock); return 0; } int stt_startup(void) { int rc = 0; int i; stt_data.stt_shuttingdown = 0; stt_data.stt_prev_slot = get_seconds() & STTIMER_SLOTTIMEMASK; spin_lock_init(&stt_data.stt_lock); for (i = 0; i < STTIMER_NSLOTS; i++) INIT_LIST_HEAD(&stt_data.stt_hash[i]); stt_data.stt_nthreads = 0; init_waitqueue_head(&stt_data.stt_waitq); rc = stt_start_timer_thread(); if (rc != 0) CERROR("Can't spawn timer thread: %d\n", rc); return rc; } void stt_shutdown(void) { int i; spin_lock(&stt_data.stt_lock); for (i = 0; i < STTIMER_NSLOTS; i++) LASSERT(list_empty(&stt_data.stt_hash[i])); stt_data.stt_shuttingdown = 1; wake_up(&stt_data.stt_waitq); lst_wait_until(stt_data.stt_nthreads == 0, stt_data.stt_lock, "waiting for %d threads to terminate\n", stt_data.stt_nthreads); spin_unlock(&stt_data.stt_lock); }
/* sound/soc/samsung/s3c2412-i2s.c * * ALSA Soc Audio Layer - S3C2412 I2S driver * * Copyright (c) 2006 Wolfson Microelectronics PLC. * Graeme Gregory graeme.gregory@wolfsonmicro.com * linux@wolfsonmicro.com * * Copyright (c) 2007, 2004-2005 Simtec Electronics * http://armlinux.simtec.co.uk/ * Ben Dooks <ben@simtec.co.uk> * * 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. */ #include <linux/delay.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h> #include <linux/module.h> #include <sound/soc.h> #include <sound/pcm_params.h> #include <mach/dma.h> #include "dma.h" #include "regs-i2s-v2.h" #include "s3c2412-i2s.h" static struct s3c2410_dma_client s3c2412_dma_client_out = { .name = "I2S PCM Stereo out" }; static struct s3c2410_dma_client s3c2412_dma_client_in = { .name = "I2S PCM Stereo in" }; static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = { .client = &s3c2412_dma_client_out, .channel = DMACH_I2S_OUT, .dma_addr = S3C2410_PA_IIS + S3C2412_IISTXD, .dma_size = 4, }; static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { .client = &s3c2412_dma_client_in, .channel = DMACH_I2S_IN, .dma_addr = S3C2410_PA_IIS + S3C2412_IISRXD, .dma_size = 4, }; static struct s3c_i2sv2_info s3c2412_i2s; static int s3c2412_i2s_probe(struct snd_soc_dai *dai) { int ret; pr_debug("Entered %s\n", __func__); ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); if (ret) return ret; s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk"); if (IS_ERR(s3c2412_i2s.iis_cclk)) { pr_err("failed to get i2sclk clock\n"); iounmap(s3c2412_i2s.regs); return PTR_ERR(s3c2412_i2s.iis_cclk); } /* Set MPLL as the source for IIS CLK */ clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll")); clk_enable(s3c2412_i2s.iis_cclk); s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk; /* Configure the I2S pins (GPE0...GPE4) in correct mode */ s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE); return 0; } static int s3c2412_i2s_remove(struct snd_soc_dai *dai) { clk_disable(s3c2412_i2s.iis_cclk); clk_put(s3c2412_i2s.iis_cclk); iounmap(s3c2412_i2s.regs); return 0; } static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *cpu_dai) { struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); struct s3c_dma_params *dma_data; u32 iismod; pr_debug("Entered %s\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) dma_data = i2s->dma_playback; else dma_data = i2s->dma_capture; snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); iismod = readl(i2s->regs + S3C2412_IISMOD); pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); switch (params_format(params)) { case SNDRV_PCM_FORMAT_S8: iismod |= S3C2412_IISMOD_8BIT; break; case SNDRV_PCM_FORMAT_S16_LE: iismod &= ~S3C2412_IISMOD_8BIT; break; } writel(iismod, i2s->regs + S3C2412_IISMOD); pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); return 0; } #define S3C2412_I2S_RATES \ (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) static const struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { .hw_params = s3c2412_i2s_hw_params, }; static struct snd_soc_dai_driver s3c2412_i2s_dai = { .probe = s3c2412_i2s_probe, .remove = s3c2412_i2s_remove, .playback = { .channels_min = 2, .channels_max = 2, .rates = S3C2412_I2S_RATES, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .channels_min = 2, .channels_max = 2, .rates = S3C2412_I2S_RATES, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &s3c2412_i2s_dai_ops, }; static const struct snd_soc_component_driver s3c2412_i2s_component = { .name = "s3c2412-i2s", }; static int s3c2412_iis_dev_probe(struct platform_device *pdev) { int ret = 0; ret = s3c_i2sv2_register_component(&pdev->dev, -1, &s3c2412_i2s_component, &s3c2412_i2s_dai); if (ret) { pr_err("failed to register the dai\n"); return ret; } ret = samsung_asoc_dma_platform_register(&pdev->dev); if (ret) { pr_err("failed to register the DMA: %d\n", ret); goto err; } return 0; err: snd_soc_unregister_component(&pdev->dev); return ret; } static int s3c2412_iis_dev_remove(struct platform_device *pdev) { samsung_asoc_dma_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); return 0; } static struct platform_driver s3c2412_iis_driver = { .probe = s3c2412_iis_dev_probe, .remove = s3c2412_iis_dev_remove, .driver = { .name = "s3c2412-iis", .owner = THIS_MODULE, }, }; module_platform_driver(s3c2412_iis_driver); /* Module information */ MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:s3c2412-iis");
#define _CRT_SECURE_NO_DEPRECATE #include "wilc_strutils.h" /*! * @author syounan * @date 18 Aug 2010 * @version 1.0 */ s32 WILC_memcmp(const void *pvArg1, const void *pvArg2, u32 u32Count) { return memcmp(pvArg1, pvArg2, u32Count); } /*! * @author syounan * @date 18 Aug 2010 * @version 1.0 */ void WILC_memcpy_INTERNAL(void *pvTarget, const void *pvSource, u32 u32Count) { memcpy(pvTarget, pvSource, u32Count); } /*! * @author syounan * @date 18 Aug 2010 * @version 1.0 */ void *WILC_memset(void *pvTarget, u8 u8SetValue, u32 u32Count) { return memset(pvTarget, u8SetValue, u32Count); } /*! * @author syounan * @date 18 Aug 2010 * @version 1.0 */ char *WILC_strncpy(char *pcTarget, const char *pcSource, u32 u32Count) { return strncpy(pcTarget, pcSource, u32Count); } s32 WILC_strncmp(const char *pcStr1, const char *pcStr2, u32 u32Count) { s32 s32Result; if (pcStr1 == NULL && pcStr2 == NULL) { s32Result = 0; } else if (pcStr1 == NULL) { s32Result = -1; } else if (pcStr2 == NULL) { s32Result = 1; } else { s32Result = strncmp(pcStr1, pcStr2, u32Count); if (s32Result < 0) { s32Result = -1; } else if (s32Result > 0) { s32Result = 1; } } return s32Result; } /*! * @author syounan * @date 18 Aug 2010 * @version 1.0 */ u32 WILC_strlen(const char *pcStr) { return (u32)strlen(pcStr); }
/* * OMAP SRAM detection and management * * Copyright (C) 2005 Nokia Corporation * Written by Tony Lindgren <tony@atomide.com> * * 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. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/io.h> #include <asm/fncpy.h> #include <asm/tlb.h> #include <asm/cacheflush.h> #include <asm/mach/map.h> #include "soc.h" #include "sram.h" #define OMAP1_SRAM_PA 0x20000000 #define SRAM_BOOTLOADER_SZ 0x80 /* * The amount of SRAM depends on the core type. * Note that we cannot try to test for SRAM here because writes * to secure SRAM will hang the system. Also the SRAM is not * yet mapped at this point. */ static void __init omap_detect_and_map_sram(void) { unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ; unsigned long omap_sram_start = OMAP1_SRAM_PA; unsigned long omap_sram_size; if (cpu_is_omap7xx()) omap_sram_size = 0x32000; /* 200K */ else if (cpu_is_omap15xx()) omap_sram_size = 0x30000; /* 192K */ else if (cpu_is_omap1610() || cpu_is_omap1611() || cpu_is_omap1621() || cpu_is_omap1710()) omap_sram_size = 0x4000; /* 16K */ else { pr_err("Could not detect SRAM size\n"); omap_sram_size = 0x4000; } omap_map_sram(omap_sram_start, omap_sram_size, omap_sram_skip, 1); } static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl); void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl) { BUG_ON(!_omap_sram_reprogram_clock); /* On 730, bit 13 must always be 1 */ if (cpu_is_omap7xx()) ckctl |= 0x2000; _omap_sram_reprogram_clock(dpllctl, ckctl); } int __init omap_sram_init(void) { omap_detect_and_map_sram(); _omap_sram_reprogram_clock = omap_sram_push(omap1_sram_reprogram_clock, omap1_sram_reprogram_clock_sz); return 0; }
/* * Driver for Digigram VXpocket soundcards * * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> * * 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 */ #ifndef __VXPOCKET_H #define __VXPOCKET_H #include <sound/vx_core.h> #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> struct snd_vxpocket { struct vx_core core; unsigned long port; int mic_level; /* analog mic level (or boost) */ unsigned int regCDSP; /* current CDSP register */ unsigned int regDIALOG; /* current DIALOG register */ int index; /* card index */ /* pcmcia stuff */ struct pcmcia_device *p_dev; dev_node_t node; }; extern struct snd_vx_ops snd_vxpocket_ops; void vx_set_mic_boost(struct vx_core *chip, int boost); void vx_set_mic_level(struct vx_core *chip, int level); int vxp_add_mic_controls(struct vx_core *chip); /* Constants used to access the CDSP register (0x08). */ #define CDSP_MAGIC 0xA7 /* magic value (for read) */ /* for write */ #define VXP_CDSP_CLOCKIN_SEL_MASK 0x80 /* 0 (internal), 1 (AES/EBU) */ #define VXP_CDSP_DATAIN_SEL_MASK 0x40 /* 0 (analog), 1 (UER) */ #define VXP_CDSP_SMPTE_SEL_MASK 0x20 #define VXP_CDSP_RESERVED_MASK 0x10 #define VXP_CDSP_MIC_SEL_MASK 0x08 #define VXP_CDSP_VALID_IRQ_MASK 0x04 #define VXP_CDSP_CODEC_RESET_MASK 0x02 #define VXP_CDSP_DSP_RESET_MASK 0x01 /* VXPOCKET 240/440 */ #define P24_CDSP_MICS_SEL_MASK 0x18 #define P24_CDSP_MIC20_SEL_MASK 0x10 #define P24_CDSP_MIC38_SEL_MASK 0x08 /* Constants used to access the MEMIRQ register (0x0C). */ #define P44_MEMIRQ_MASTER_SLAVE_SEL_MASK 0x08 #define P44_MEMIRQ_SYNCED_ALONE_SEL_MASK 0x04 #define P44_MEMIRQ_WCLK_OUT_IN_SEL_MASK 0x02 /* Not used */ #define P44_MEMIRQ_WCLK_UER_SEL_MASK 0x01 /* Not used */ /* Micro levels (0x0C) */ /* Constants used to access the DIALOG register (0x0D). */ #define VXP_DLG_XILINX_REPROG_MASK 0x80 /* W */ #define VXP_DLG_DATA_XICOR_MASK 0x80 /* R */ #define VXP_DLG_RESERVED4_0_MASK 0x40 #define VXP_DLG_RESERVED2_0_MASK 0x20 #define VXP_DLG_RESERVED1_0_MASK 0x10 #define VXP_DLG_DMAWRITE_SEL_MASK 0x08 /* W */ #define VXP_DLG_DMAREAD_SEL_MASK 0x04 /* W */ #define VXP_DLG_MEMIRQ_MASK 0x02 /* R */ #define VXP_DLG_DMA16_SEL_MASK 0x02 /* W */ #define VXP_DLG_ACK_MEMIRQ_MASK 0x01 /* R/W */ #endif /* __VXPOCKET_H */
/* * linux/arch/arm/mach-pxa/leds-lubbock.c * * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu> * * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com> * * Original (leds-footbridge.c) by Russell King * * Major surgery on April 2004 by Nicolas Pitre for less global * namespace collision. Mostly adapted the Mainstone version. */ #include <linux/init.h> #include <mach/hardware.h> #include <asm/leds.h> #include <asm/system.h> #include <mach/pxa-regs.h> #include <mach/lubbock.h> #include "leds.h" /* * 8 discrete leds available for general use: * * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays * so be sure to not monkey with them here. */ #define D28 (1 << 0) #define D27 (1 << 1) #define D26 (1 << 2) #define D25 (1 << 3) #define D24 (1 << 4) #define D23 (1 << 5) #define D22 (1 << 6) #define D21 (1 << 7) #define LED_STATE_ENABLED 1 #define LED_STATE_CLAIMED 2 static unsigned int led_state; static unsigned int hw_led_state; void lubbock_leds_event(led_event_t evt) { unsigned long flags; local_irq_save(flags); switch (evt) { case led_start: hw_led_state = 0; led_state = LED_STATE_ENABLED; break; case led_stop: led_state &= ~LED_STATE_ENABLED; break; case led_claim: led_state |= LED_STATE_CLAIMED; hw_led_state = 0; break; case led_release: led_state &= ~LED_STATE_CLAIMED; hw_led_state = 0; break; #ifdef CONFIG_LEDS_TIMER case led_timer: hw_led_state ^= D26; break; #endif #ifdef CONFIG_LEDS_CPU case led_idle_start: hw_led_state &= ~D27; break; case led_idle_end: hw_led_state |= D27; break; #endif case led_halted: break; case led_green_on: hw_led_state |= D21; break; case led_green_off: hw_led_state &= ~D21; break; case led_amber_on: hw_led_state |= D22; break; case led_amber_off: hw_led_state &= ~D22; break; case led_red_on: hw_led_state |= D23; break; case led_red_off: hw_led_state &= ~D23; break; default: break; } if (led_state & LED_STATE_ENABLED) LUB_DISC_BLNK_LED = (LUB_DISC_BLNK_LED | 0xff) & ~hw_led_state; else LUB_DISC_BLNK_LED |= 0xff; local_irq_restore(flags); }
/* * Generic GPIO card-detect helper header * * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de> * * 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 MMC_CD_GPIO_H #define MMC_CD_GPIO_H struct mmc_host; int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio); void mmc_cd_gpio_free(struct mmc_host *host); int mmc_cd_get_status(struct mmc_host *host); #endif
/* { dg-do run } */ #include <stdarg.h> #include "dfp-dbg.h" void f (int a, ...) { va_list ap; if (a != 0) FAILURE va_start (ap, a); if (va_arg (ap, _Decimal128) != 1.2DL) FAILURE if (va_arg (ap, _Decimal128) != 2.34DL) FAILURE if (va_arg (ap, _Decimal128) != 3.456DL) FAILURE if (va_arg (ap, _Decimal128) != 4.567DL) FAILURE if (va_arg (ap, double) != 5.125) FAILURE va_end (ap); } int main (void) { f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125); FINISH }
/* * arch/sh/drivers/pci/ops-titan.c * * Ported to new API by Paul Mundt <lethal@linux-sh.org> * * Modified from ops-snapgear.c written by David McCullough * Highly leveraged from pci-bigsur.c, written by Dustin McIntire. * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. * * PCI initialization for the Titan boards */ #include <linux/kernel.h> #include <linux/types.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/io.h> #include <mach/titan.h> #include "pci-sh4.h" static char titan_irq_tab[] __initdata = { TITAN_IRQ_WAN, TITAN_IRQ_LAN, TITAN_IRQ_MPCIA, TITAN_IRQ_MPCIB, TITAN_IRQ_USB, }; int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) { int irq = titan_irq_tab[slot]; printk("PCI: Mapping TITAN IRQ for slot %d, pin %c to irq %d\n", slot, pin - 1 + 'A', irq); return irq; } static struct resource sh7751_io_resource = { .name = "SH7751_IO", .start = SH7751_PCI_IO_BASE, .end = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1, .flags = IORESOURCE_IO }; static struct resource sh7751_mem_resource = { .name = "SH7751_mem", .start = SH7751_PCI_MEMORY_BASE, .end = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1, .flags = IORESOURCE_MEM }; struct pci_channel board_pci_channels[] = { { &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, { NULL, NULL, NULL, 0, 0 }, }; EXPORT_SYMBOL(board_pci_channels); static struct sh4_pci_address_map sh7751_pci_map = { .window0 = { .base = SH7751_CS2_BASE_ADDR, .size = SH7751_MEM_REGION_SIZE*2, /* cs2 and cs3 */ }, .window1 = { .base = SH7751_CS2_BASE_ADDR, .size = SH7751_MEM_REGION_SIZE*2, }, .flags = SH4_PCIC_NO_RESET, }; int __init pcibios_init_platform(void) { return sh7751_pcic_init(&sh7751_pci_map); }
/* * Copyright (C) 2008 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de> * * Copyright (C) 2005-2007 Freescale Semiconductor, Inc. * * 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 _IPU_H_ #define _IPU_H_ #include <linux/types.h> #include <linux/dmaengine.h> /* IPU DMA Controller channel definitions. */ enum ipu_channel { IDMAC_IC_0 = 0, /* IC (encoding task) to memory */ IDMAC_IC_1 = 1, /* IC (viewfinder task) to memory */ IDMAC_ADC_0 = 1, IDMAC_IC_2 = 2, IDMAC_ADC_1 = 2, IDMAC_IC_3 = 3, IDMAC_IC_4 = 4, IDMAC_IC_5 = 5, IDMAC_IC_6 = 6, IDMAC_IC_7 = 7, /* IC (sensor data) to memory */ IDMAC_IC_8 = 8, IDMAC_IC_9 = 9, IDMAC_IC_10 = 10, IDMAC_IC_11 = 11, IDMAC_IC_12 = 12, IDMAC_IC_13 = 13, IDMAC_SDC_0 = 14, /* Background synchronous display data */ IDMAC_SDC_1 = 15, /* Foreground data (overlay) */ IDMAC_SDC_2 = 16, IDMAC_SDC_3 = 17, IDMAC_ADC_2 = 18, IDMAC_ADC_3 = 19, IDMAC_ADC_4 = 20, IDMAC_ADC_5 = 21, IDMAC_ADC_6 = 22, IDMAC_ADC_7 = 23, IDMAC_PF_0 = 24, IDMAC_PF_1 = 25, IDMAC_PF_2 = 26, IDMAC_PF_3 = 27, IDMAC_PF_4 = 28, IDMAC_PF_5 = 29, IDMAC_PF_6 = 30, IDMAC_PF_7 = 31, }; /* Order significant! */ enum ipu_channel_status { IPU_CHANNEL_FREE, IPU_CHANNEL_INITIALIZED, IPU_CHANNEL_READY, IPU_CHANNEL_ENABLED, }; #define IPU_CHANNELS_NUM 32 enum pixel_fmt { /* 1 byte */ IPU_PIX_FMT_GENERIC, IPU_PIX_FMT_RGB332, IPU_PIX_FMT_YUV420P, IPU_PIX_FMT_YUV422P, IPU_PIX_FMT_YUV420P2, IPU_PIX_FMT_YVU422P, /* 2 bytes */ IPU_PIX_FMT_RGB565, IPU_PIX_FMT_RGB666, IPU_PIX_FMT_BGR666, IPU_PIX_FMT_YUYV, IPU_PIX_FMT_UYVY, /* 3 bytes */ IPU_PIX_FMT_RGB24, IPU_PIX_FMT_BGR24, /* 4 bytes */ IPU_PIX_FMT_GENERIC_32, IPU_PIX_FMT_RGB32, IPU_PIX_FMT_BGR32, IPU_PIX_FMT_ABGR32, IPU_PIX_FMT_BGRA32, IPU_PIX_FMT_RGBA32, }; enum ipu_color_space { IPU_COLORSPACE_RGB, IPU_COLORSPACE_YCBCR, IPU_COLORSPACE_YUV }; /* * Enumeration of IPU rotation modes */ enum ipu_rotate_mode { /* Note the enum values correspond to BAM value */ IPU_ROTATE_NONE = 0, IPU_ROTATE_VERT_FLIP = 1, IPU_ROTATE_HORIZ_FLIP = 2, IPU_ROTATE_180 = 3, IPU_ROTATE_90_RIGHT = 4, IPU_ROTATE_90_RIGHT_VFLIP = 5, IPU_ROTATE_90_RIGHT_HFLIP = 6, IPU_ROTATE_90_LEFT = 7, }; struct ipu_platform_data { unsigned int irq_base; }; /* * Enumeration of DI ports for ADC. */ enum display_port { DISP0, DISP1, DISP2, DISP3 }; struct idmac_video_param { unsigned short in_width; unsigned short in_height; uint32_t in_pixel_fmt; unsigned short out_width; unsigned short out_height; uint32_t out_pixel_fmt; unsigned short out_stride; bool graphics_combine_en; bool global_alpha_en; bool key_color_en; enum display_port disp; unsigned short out_left; unsigned short out_top; }; /* * Union of initialization parameters for a logical channel. So far only video * parameters are used. */ union ipu_channel_param { struct idmac_video_param video; }; struct idmac_tx_desc { struct dma_async_tx_descriptor txd; struct scatterlist *sg; /* scatterlist for this */ unsigned int sg_len; /* tx-descriptor. */ struct list_head list; }; struct idmac_channel { struct dma_chan dma_chan; dma_cookie_t completed; /* last completed cookie */ union ipu_channel_param params; enum ipu_channel link; /* input channel, linked to the output */ enum ipu_channel_status status; void *client; /* Only one client per channel */ unsigned int n_tx_desc; struct idmac_tx_desc *desc; /* allocated tx-descriptors */ struct scatterlist *sg[2]; /* scatterlist elements in buffer-0 and -1 */ struct list_head free_list; /* free tx-descriptors */ struct list_head queue; /* queued tx-descriptors */ spinlock_t lock; /* protects sg[0,1], queue */ struct mutex chan_mutex; /* protects status, cookie, free_list */ bool sec_chan_en; int active_buffer; unsigned int eof_irq; char eof_name[16]; /* EOF IRQ name for request_irq() */ }; #define to_tx_desc(tx) container_of(tx, struct idmac_tx_desc, txd) #define to_idmac_chan(c) container_of(c, struct idmac_channel, dma_chan) #endif
/* * STMicroelectronics magnetometers driver * * Copyright 2012-2013 STMicroelectronics Inc. * * Denis Ciocca <denis.ciocca@st.com> * * Licensed under the GPL-2. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h> #include <linux/stat.h> #include <linux/interrupt.h> #include <linux/i2c.h> #include <linux/delay.h> #include <linux/iio/iio.h> #include <linux/iio/buffer.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> #include <linux/iio/common/st_sensors.h> #include "st_magn.h" int st_magn_trig_set_state(struct iio_trigger *trig, bool state) { struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); return st_sensors_set_dataready_irq(indio_dev, state); } static int st_magn_buffer_preenable(struct iio_dev *indio_dev) { return st_sensors_set_enable(indio_dev, true); } static int st_magn_buffer_postenable(struct iio_dev *indio_dev) { int err; struct st_sensor_data *mdata = iio_priv(indio_dev); mdata->buffer_data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (mdata->buffer_data == NULL) { err = -ENOMEM; goto allocate_memory_error; } err = iio_triggered_buffer_postenable(indio_dev); if (err < 0) goto st_magn_buffer_postenable_error; return err; st_magn_buffer_postenable_error: kfree(mdata->buffer_data); allocate_memory_error: return err; } static int st_magn_buffer_predisable(struct iio_dev *indio_dev) { int err; struct st_sensor_data *mdata = iio_priv(indio_dev); err = iio_triggered_buffer_predisable(indio_dev); if (err < 0) goto st_magn_buffer_predisable_error; err = st_sensors_set_enable(indio_dev, false); st_magn_buffer_predisable_error: kfree(mdata->buffer_data); return err; } static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = { .preenable = &st_magn_buffer_preenable, .postenable = &st_magn_buffer_postenable, .predisable = &st_magn_buffer_predisable, }; int st_magn_allocate_ring(struct iio_dev *indio_dev) { return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, &st_sensors_trigger_handler, &st_magn_buffer_setup_ops); } void st_magn_deallocate_ring(struct iio_dev *indio_dev) { iio_triggered_buffer_cleanup(indio_dev); } MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); MODULE_DESCRIPTION("STMicroelectronics magnetometers buffer"); MODULE_LICENSE("GPL v2");
#ifndef __SOUND_HDSPM_H #define __SOUND_HDSPM_H /* * Copyright (C) 2003 Winfried Ritsch (IEM) * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) * * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ #define HDSPM_MAX_CHANNELS 64 /* -------------------- IOCTL Peak/RMS Meters -------------------- */ /* peam rms level structure like we get from hardware maybe in future we can memory map it so I just copy it to user on ioctl call now an dont change anything rms are made out of low and high values where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24) (i asume so from the code) */ struct hdspm_peak_rms { unsigned int level_offset[1024]; unsigned int input_peak[64]; unsigned int playback_peak[64]; unsigned int output_peak[64]; unsigned int xxx_peak[64]; /* not used */ unsigned int reserved[256]; /* not used */ unsigned int input_rms_l[64]; unsigned int playback_rms_l[64]; unsigned int output_rms_l[64]; unsigned int xxx_rms_l[64]; /* not used */ unsigned int input_rms_h[64]; unsigned int playback_rms_h[64]; unsigned int output_rms_h[64]; unsigned int xxx_rms_h[64]; /* not used */ }; struct hdspm_peak_rms_ioctl { struct hdspm_peak_rms *peak; }; /* use indirect access due to the limit of ioctl bit size */ #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ _IOR('H', 0x40, struct hdspm_peak_rms_ioctl) /* ------------ CONFIG block IOCTL ---------------------- */ struct hdspm_config_info { unsigned char pref_sync_ref; unsigned char wordclock_sync_check; unsigned char madi_sync_check; unsigned int system_sample_rate; unsigned int autosync_sample_rate; unsigned char system_clock_mode; unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; unsigned int passthru; unsigned int analog_out; }; #define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \ _IOR('H', 0x41, struct hdspm_config_info) /* get Soundcard Version */ struct hdspm_version { unsigned short firmware_rev; }; #define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version) /* ------------- get Matrix Mixer IOCTL --------------- */ /* MADI mixer: 64inputs+64playback in 64outputs = 8192 => *4Byte = * 32768 Bytes */ /* organisation is 64 channelfader in a continous memory block */ /* equivalent to hardware definition, maybe for future feature of mmap of * them */ /* each of 64 outputs has 64 infader and 64 outfader: Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS struct hdspm_channelfader { unsigned int in[HDSPM_MIXER_CHANNELS]; unsigned int pb[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer { struct hdspm_channelfader ch[HDSPM_MIXER_CHANNELS]; }; struct hdspm_mixer_ioctl { struct hdspm_mixer *mixer; }; /* use indirect access due to the limit of ioctl bit size */ #define SNDRV_HDSPM_IOCTL_GET_MIXER _IOR('H', 0x44, struct hdspm_mixer_ioctl) /* typedefs for compatibility to user-space */ typedef struct hdspm_peak_rms hdspm_peak_rms_t; typedef struct hdspm_config_info hdspm_config_info_t; typedef struct hdspm_version hdspm_version_t; typedef struct hdspm_channelfader snd_hdspm_channelfader_t; typedef struct hdspm_mixer hdspm_mixer_t; #endif /* __SOUND_HDSPM_H */
/* minibz2 libbz2.dll test program. by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) This file is Public Domain. Welcome any email to me. usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename] */ #define BZ_IMPORT #include <stdio.h> #include <stdlib.h> #include "bzlib.h" #ifdef _WIN32 #include <io.h> #endif #ifdef _WIN32 #define BZ2_LIBNAME "libbz2-1.0.2.DLL" #include <windows.h> static int BZ2DLLLoaded = 0; static HINSTANCE BZ2DLLhLib; int BZ2DLLLoadLibrary(void) { HINSTANCE hLib; if(BZ2DLLLoaded==1){return 0;} hLib=LoadLibrary(BZ2_LIBNAME); if(hLib == NULL){ fprintf(stderr,"Can't load %s\n",BZ2_LIBNAME); return -1; } BZ2_bzlibVersion=GetProcAddress(hLib,"BZ2_bzlibVersion"); BZ2_bzopen=GetProcAddress(hLib,"BZ2_bzopen"); BZ2_bzdopen=GetProcAddress(hLib,"BZ2_bzdopen"); BZ2_bzread=GetProcAddress(hLib,"BZ2_bzread"); BZ2_bzwrite=GetProcAddress(hLib,"BZ2_bzwrite"); BZ2_bzflush=GetProcAddress(hLib,"BZ2_bzflush"); BZ2_bzclose=GetProcAddress(hLib,"BZ2_bzclose"); BZ2_bzerror=GetProcAddress(hLib,"BZ2_bzerror"); if (!BZ2_bzlibVersion || !BZ2_bzopen || !BZ2_bzdopen || !BZ2_bzread || !BZ2_bzwrite || !BZ2_bzflush || !BZ2_bzclose || !BZ2_bzerror) { fprintf(stderr,"GetProcAddress failed.\n"); return -1; } BZ2DLLLoaded=1; BZ2DLLhLib=hLib; return 0; } int BZ2DLLFreeLibrary(void) { if(BZ2DLLLoaded==0){return 0;} FreeLibrary(BZ2DLLhLib); BZ2DLLLoaded=0; } #endif /* WIN32 */ void usage(void) { puts("usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]"); } int main(int argc,char *argv[]) { int decompress = 0; int level = 9; char *fn_r = NULL; char *fn_w = NULL; #ifdef _WIN32 if(BZ2DLLLoadLibrary()<0){ fprintf(stderr,"Loading of %s failed. Giving up.\n", BZ2_LIBNAME); exit(1); } printf("Loading of %s succeeded. Library version is %s.\n", BZ2_LIBNAME, BZ2_bzlibVersion() ); #endif while(++argv,--argc){ if(**argv =='-' || **argv=='/'){ char *p; for(p=*argv+1;*p;p++){ if(*p=='d'){ decompress = 1; }else if('1'<=*p && *p<='9'){ level = *p - '0'; }else{ usage(); exit(1); } } }else{ break; } } if(argc>=1){ fn_r = *argv; argc--;argv++; }else{ fn_r = NULL; } if(argc>=1){ fn_w = *argv; argc--;argv++; }else{ fn_w = NULL; } { int len; char buff[0x1000]; char mode[10]; if(decompress){ BZFILE *BZ2fp_r = NULL; FILE *fp_w = NULL; if(fn_w){ if((fp_w = fopen(fn_w,"wb"))==NULL){ printf("can't open [%s]\n",fn_w); perror("reason:"); exit(1); } }else{ fp_w = stdout; } if((fn_r == NULL && (BZ2fp_r = BZ2_bzdopen(fileno(stdin),"rb"))==NULL) || (fn_r != NULL && (BZ2fp_r = BZ2_bzopen(fn_r,"rb"))==NULL)){ printf("can't bz2openstream\n"); exit(1); } while((len=BZ2_bzread(BZ2fp_r,buff,0x1000))>0){ fwrite(buff,1,len,fp_w); } BZ2_bzclose(BZ2fp_r); if(fp_w != stdout) fclose(fp_w); }else{ BZFILE *BZ2fp_w = NULL; FILE *fp_r = NULL; if(fn_r){ if((fp_r = fopen(fn_r,"rb"))==NULL){ printf("can't open [%s]\n",fn_r); perror("reason:"); exit(1); } }else{ fp_r = stdin; } mode[0]='w'; mode[1] = '0' + level; mode[2] = '\0'; if((fn_w == NULL && (BZ2fp_w = BZ2_bzdopen(fileno(stdout),mode))==NULL) || (fn_w !=NULL && (BZ2fp_w = BZ2_bzopen(fn_w,mode))==NULL)){ printf("can't bz2openstream\n"); exit(1); } while((len=fread(buff,1,0x1000,fp_r))>0){ BZ2_bzwrite(BZ2fp_w,buff,len); } BZ2_bzclose(BZ2fp_w); if(fp_r!=stdin)fclose(fp_r); } } #ifdef _WIN32 BZ2DLLFreeLibrary(); #endif return 0; }
#define DRIVERVERSION "v4.0.2_9000.20130911"
/* * stmp37xx: PWM 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_PWM_BASE (STMP3XXX_REGS_BASE + 0x64000) #define HW_PWM_CTRL 0x0 #define BM_PWM_CTRL_PWM2_ENABLE 0x00000004 #define BM_PWM_CTRL_PWM2_ANA_CTRL_ENABLE 0x00000020 #define HW_PWM_ACTIVE0 (0x10 + 0 * 0x20) #define HW_PWM_ACTIVE1 (0x10 + 1 * 0x20) #define HW_PWM_ACTIVE2 (0x10 + 2 * 0x20) #define HW_PWM_ACTIVE3 (0x10 + 3 * 0x20) #define HW_PWM_ACTIVEn 0x10 #define BM_PWM_ACTIVEn_ACTIVE 0x0000FFFF #define BP_PWM_ACTIVEn_ACTIVE 0 #define BM_PWM_ACTIVEn_INACTIVE 0xFFFF0000 #define BP_PWM_ACTIVEn_INACTIVE 16 #define HW_PWM_PERIOD0 (0x20 + 0 * 0x20) #define HW_PWM_PERIOD1 (0x20 + 1 * 0x20) #define HW_PWM_PERIOD2 (0x20 + 2 * 0x20) #define HW_PWM_PERIOD3 (0x20 + 3 * 0x20) #define HW_PWM_PERIODn 0x20 #define BM_PWM_PERIODn_PERIOD 0x0000FFFF #define BP_PWM_PERIODn_PERIOD 0 #define BM_PWM_PERIODn_ACTIVE_STATE 0x00030000 #define BP_PWM_PERIODn_ACTIVE_STATE 16 #define BM_PWM_PERIODn_INACTIVE_STATE 0x000C0000 #define BP_PWM_PERIODn_INACTIVE_STATE 18 #define BM_PWM_PERIODn_CDIV 0x00700000 #define BP_PWM_PERIODn_CDIV 20
/* ISC license. */ #include <unistd.h> #include <errno.h> #include <skalibs/gccattributes.h> #include <skalibs/uint.h> #include <skalibs/strerr2.h> #include <skalibs/sgetopt.h> #include <skalibs/cdb.h> #include <skalibs/env.h> #include <skalibs/djbunix.h> #include <skalibs/webipc.h> #include <execline/config.h> #include <s6/accessrules.h> #define USAGE "s6-ipcserver-access [ -v verbosity ] [ -e | -E ] [ -l localname ] [ -i rulesdir | -x rulesfile ] prog..." static unsigned int verbosity = 1 ; /* Utility functions */ static inline void dieusage (void) gccattr_noreturn ; static inline void dieusage () { strerr_dieusage(100, USAGE) ; } static inline void dienomem (void) gccattr_noreturn ; static inline void dienomem () { strerr_diefu1sys(111, "update environment") ; } static inline void X (void) gccattr_noreturn ; static inline void X () { strerr_dief1x(101, "internal inconsistency. Please submit a bug-report.") ; } /* Logging */ static void logit (unsigned int pid, unsigned int uid, unsigned int gid, int h) { char fmtpid[UINT_FMT] ; char fmtuid[UINT_FMT] ; char fmtgid[UINT_FMT] ; fmtpid[uint_fmt(fmtpid, pid)] = 0 ; fmtuid[uint_fmt(fmtuid, uid)] = 0 ; fmtgid[uint_fmt(fmtgid, gid)] = 0 ; if (h) strerr_warni7x("allow", " pid ", fmtpid, " uid ", fmtuid, " gid ", fmtgid) ; else strerr_warni7sys("deny", " pid ", fmtpid, " uid ", fmtuid, " gid ", fmtgid) ; } static inline void log_accept (unsigned int pid, unsigned int uid, unsigned int gid) { logit(pid, uid, gid, 1) ; } static inline void log_deny (unsigned int pid, unsigned int uid, unsigned int gid) { logit(pid, uid, gid, 0) ; } /* Checking */ static s6_accessrules_result_t check_cdb (unsigned int uid, unsigned int gid, char const *file, s6_accessrules_params_t *params) { struct cdb c = CDB_ZERO ; int fd = open_readb(file) ; register s6_accessrules_result_t r ; if (fd < 0) return -1 ; if (cdb_init(&c, fd) < 0) strerr_diefu2sys(111, "cdb_init ", file) ; r = s6_accessrules_uidgid_cdb(uid, gid, &c, params) ; cdb_free(&c) ; fd_close(fd) ; return r ; } static inline int check (s6_accessrules_params_t *params, char const *rules, unsigned int rulestype, unsigned int uid, unsigned int gid) { char const *x = "" ; s6_accessrules_result_t r ; switch (rulestype) { case 0 : if (verbosity >= 2) strerr_warnw1x("invoked without a ruleset!") ; return 1 ; case 1 : r = s6_accessrules_uidgid_fs(uid, gid, rules, params) ; x = "fs" ; break ; case 2 : r = check_cdb(uid, gid, rules, params) ; x = "cdb" ; break ; default : X() ; } switch (r) { case S6_ACCESSRULES_ERROR : strerr_diefu4sys(111, "check ", x, " ruleset in ", rules) ; case S6_ACCESSRULES_ALLOW : return 1 ; case S6_ACCESSRULES_DENY : return (errno = EACCES, 0) ; case S6_ACCESSRULES_NOTFOUND : return (errno = ENOENT, 0) ; default : X() ; } } int main (int argc, char const *const *argv, char const *const *envp) { s6_accessrules_params_t params = S6_ACCESSRULES_PARAMS_ZERO ; char const *rules = 0 ; char const *localname = 0 ; char const *proto ; unsigned int protolen ; unsigned int uid = 0, gid = 0 ; unsigned int rulestype = 0 ; int doenv = 1 ; PROG = "s6-ipcserver-access" ; { subgetopt_t l = SUBGETOPT_ZERO ; for (;;) { register int opt = subgetopt_r(argc, argv, "v:Eel:i:x:", &l) ; if (opt == -1) break ; switch (opt) { case 'v' : if (!uint0_scan(l.arg, &verbosity)) dieusage() ; break ; case 'E' : doenv = 0 ; break ; case 'e' : doenv = 1 ; break ; case 'l' : localname = l.arg ; break ; case 'i' : rules = l.arg ; rulestype = 1 ; break ; case 'x' : rules = l.arg ; rulestype = 2 ; break ; default : dieusage() ; } } argc -= l.ind ; argv += l.ind ; } if (!argc) dieusage() ; if (!*argv[0]) dieusage() ; proto = env_get2(envp, "PROTO") ; if (!proto) strerr_dienotset(100, "PROTO") ; protolen = str_len(proto) ; { char const *x ; char tmp[protolen + 11] ; byte_copy(tmp, protolen, proto) ; byte_copy(tmp + protolen, 11, "REMOTEEUID") ; x = env_get2(envp, tmp) ; if (!x) strerr_dienotset(100, tmp) ; if (!uint0_scan(x, &uid)) strerr_dieinvalid(100, tmp) ; tmp[protolen + 7] = 'G' ; x = env_get2(envp, tmp) ; if (!x) strerr_dienotset(100, tmp) ; if (!uint0_scan(x, &gid)) strerr_dieinvalid(100, tmp) ; } if (!check(&params, rules, rulestype, uid, gid)) { if (verbosity >= 2) log_deny(getpid(), uid, gid) ; return 1 ; } if (verbosity) log_accept(getpid(), uid, gid) ; if (doenv) { char tmp[protolen + 10] ; byte_copy(tmp, protolen, proto) ; byte_copy(tmp + protolen, 10, "LOCALPATH") ; if (localname) { if (!env_addmodif(&params.env, tmp, localname)) dienomem() ; } else { char curname[IPCPATH_MAX+1] ; int dummy ; if (ipc_local(0, curname, IPCPATH_MAX+1, &dummy) < 0) strerr_diefu1sys(111, "ipc_local") ; if (!env_addmodif(&params.env, tmp, curname)) dienomem() ; } } else { char tmp[protolen + 11] ; byte_copy(tmp, protolen, proto) ; byte_copy(tmp + protolen, 11, "REMOTEEUID") ; if (!env_addmodif(&params.env, "PROTO", 0)) dienomem() ; if (!env_addmodif(&params.env, tmp, 0)) dienomem() ; tmp[protolen + 7] = 'G' ; if (!env_addmodif(&params.env, tmp, 0)) dienomem() ; byte_copy(tmp + protolen + 6, 5, "PATH") ; if (!env_addmodif(&params.env, tmp, 0)) dienomem() ; byte_copy(tmp + protolen, 10, "LOCALPATH") ; if (!env_addmodif(&params.env, tmp, 0)) dienomem() ; } if (params.exec.len) { char *specialargv[4] = { EXECLINE_EXTBINPREFIX "execlineb", "-c", params.exec.s, 0 } ; pathexec_r((char const *const *)specialargv, envp, env_len(envp), params.env.s, params.env.len) ; strerr_dieexec(111, specialargv[0]) ; } pathexec_r(argv, envp, env_len(envp), params.env.s, params.env.len) ; strerr_dieexec(111, argv[0]) ; }
#ifndef GARBAGEALLOCATOR_H_3WE55TYZ #define GARBAGEALLOCATOR_H_3WE55TYZ #include "MemoryManager.h" #include "GarbageHeaps.h" #include "runtime/Handle.h" #include "gc/IGarbage.h" #include <unordered_map> #include <vector> namespace snow { struct GarbageHeader; class GarbageAllocator : public IAllocator { public: typedef GarbageHeader Header; private: IAllocator::Statistics m_Statistics; volatile bool m_IsCollecting; NurseryHeap m_NurseryHeap; AdultHeap m_AdultHeap; int m_AdultHeapBucketsThreshold; int m_MinorCollectionsSinceLastMajorCollection; std::vector<Ptr<IGarbage>> m_ExternalRoots; std::unordered_map<void*, void*> m_MovedPointers; Header* find_header(void* ptr); bool is_blob(void* ptr); void update_moved(void*& ptr); void mark_reachable(void*& ptr); void unmark_heap(IGarbageHeap& heap); void unmark_all(); void update_all_moved(); void mark_all_reachable(); void inspect_moved_pointers(); void with_each_root(GCOperation, bool update_stack_frames = false); void operation(GCOperation, void*& root); void perform_operation(GCOperation, IGarbage* object); public: GarbageAllocator(); void* allocate(size_t sz, AllocationType type); size_t size_of(void* ptr); const IAllocator::Statistics& statistics() const { return m_Statistics; } bool contains(void* ptr) const; void collect(); // all a callback for each type of pointer void root_callback(GCOperation, Value&); template <typename T> void root_callback(GCOperation, Ptr<T>&); template <typename T> void root_callback(GCOperation, DataPtr<T>&); template <typename T> void root_callback(GCOperation, T*&); void register_root(const Ptr<IGarbage>& ptr); void unregister_root(const Ptr<IGarbage>& ptr); void destruct(GarbageHeader&, void*); void pointer_moved(void* from, void* to, size_t size); }; template <typename T> inline void GarbageAllocator::root_callback(GCOperation op, Ptr<T>& root) { if (root) { operation(op, root.gc_root()); // TODO: Get rid of the casting. Ptr<IGarbage> iroot = root; if (iroot->gc_try_lock()) { iroot->_gc_roots(*this, op); iroot->gc_unlock(); } } } template <typename T> inline void GarbageAllocator::root_callback(GCOperation op, DataPtr<T>& root) { operation(op, root.gc_root()); } template <typename T> inline void GarbageAllocator::root_callback(GCOperation op, T*& root) { typedef typename SelectSmartPointerType<T, std::is_pod<T>::value || !(std::is_base_of<IGarbage, T>::value)>::PointerType PointerType; PointerType& ptr = reinterpret_cast<PointerType&>(root); root_callback(op, ptr); } } #endif /* end of include guard: GARBAGEALLOCATOR_H_3WE55TYZ */
// Copyright (C) 2013 Nick Johnson <nickbjohnson4224 at gmail.com> // // Permission to use, copy, modify, and distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. // // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "../include/pinion.h" #include "../internal.h"
/* $OpenBSD: armv7_machdep.h,v 1.5 2015/07/15 21:09:40 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __PLATFORMVAR_H__ #define __PLATFORMVAR_H__ void platform_init(void); void platform_powerdown(void); void platform_watchdog_reset(void); void platform_init_cons(void); void platform_disable_l2_if_needed(void); const char *platform_boot_name(void); const char *platform_board_name(void); struct board_dev *platform_board_devs(); struct armv7_platform { const char *boot_name; const char *(*board_name)(void); struct board_dev *devs; void (*board_init)(void); void (*smc_write)(bus_space_tag_t, bus_space_handle_t, bus_size_t, uint32_t, uint32_t); void (*init_cons)(void); void (*watchdog_reset)(void); void (*powerdown)(void); void (*disable_l2_if_needed)(void); }; #endif /* __PLATFORMVAR_H__ */
#ifndef CRYPTOPP_PCH_H #define CRYPTOPP_PCH_H #ifdef CRYPTOPP_GENERATE_X64_MASM #include "cpu.h" #else #include "config.h" #ifdef USE_PRECOMPILED_HEADERS #include "simple.h" #include "secblock.h" #include "misc.h" #include "smartptr.h" #endif #endif #endif
#ifndef VER_PRODUCTNAME_STR #if defined(CSC_INVOKED) #if defined(PPTARGET_VB) #define VER_PRODUCTNAME_STR ("Microsoft" + Microsoft.VisualBasic.ChrW(174) + " .NET Framework") #elif defined(PPTARGET_CS) || defined(PPTARGET_JS) || defined(FEATURE_PAL) #define VER_PRODUCTNAME_STR "Microsoft\u00AE .NET Framework" #else #error Unknown language when defining VER_PRODUCTNAME_STR! #endif #elif defined(PLIST_INVOKED) #define VER_PRODUCTNAME Microsoft® .NET Framework #else #define VER_PRODUCTNAME_STR L"Microsoft\256 .NET Framework" #endif #endif // The following copyright is intended for display in the Windows Explorer property box for a DLL or EXE // See \\lca\pdm\TMGUIDE\Copyright\Crt_Tmk_Notices.xls for copyright guidelines // #ifndef VER_LEGALCOPYRIGHT_STR #if defined(CSC_INVOKED) #if defined(PPTARGET_VB) #define VER_LEGALCOPYRIGHT_STR Microsoft.VisualBasic.ChrW(169) + " Microsoft Corporation. All rights reserved." #elif defined(PPTARGET_CS) || defined(PPTARGET_JS) || defined(FEATURE_PAL) #define VER_LEGALCOPYRIGHT_STR "\u00A9 Microsoft Corporation. All rights reserved." #else #error Unknown language when defining VER_LEGALCOPYRIGHT_STR! #endif #elif defined(PLIST_INVOKED) // EMPTY is to force multiple spaces when the preprocessor would combine them otherwise. // It gets editted out post-processing. #define VER_LEGALCOPYRIGHT © Microsoft Corporation. EMPTY All rights reserved. #else #define VER_LEGALCOPYRIGHT_STR "\251 Microsoft Corporation. All rights reserved." #define VER_LEGALCOPYRIGHT_STR_L L"\251 Microsoft Corporation. All rights reserved." #endif #endif // VSWhidbey #495749 // Note: The following legal copyright is intended for situations where the copyright symbol doesn't display // properly. For example, the following copyright should be displayed as part of the logo for DOS command-line // applications. If you change the format or wording of the following copyright, you should apply the same // change to fxresstrings.txt (for managed applications). #ifndef VER_LEGALCOPYRIGHT_LOGO_STR #define VER_LEGALCOPYRIGHT_LOGO_STR "Copyright (c) Microsoft Corporation. All rights reserved." #define VER_LEGALCOPYRIGHT_LOGO_STR_L L"Copyright (c) Microsoft Corporation. All rights reserved." #endif
// // Longest Substring with At Most K Distinct Characters.h // leetcodeInXcode // // Created by Kaiqi on 5/31/15. // Copyright (c) 2015 edu.self. All rights reserved. // class Solution { public: /** * @param s : A string * @return : The length of the longest substring * that contains at most k distinct characters. */ int lengthOfLongestSubstringKDistinct(string s, int k) { // write your code here vector<int> last(ALPHABET, -1); int start = 0; int best = 0; for (int i = 0; i < s.size(); i++) { int index = s[i]; if (last[index] < start) { if (k > 0) { k--; } else { start = firstOut(last, start) + 1; } } best = max(best, i - start + 1); last[index] = i; } return best; } // O(ALPHABET) complexity int firstOut(const vector<int> &last, int start) { int best = INT_MAX; for (int i = 0; i < ALPHABET; i++) { if (last[i] >= start) best = min(best, last[i]); } return best; } static const int ALPHABET = 256; };
#ifndef NekocoinFIELD_H #define NekocoinFIELD_H #include "bignum.h" // for mpq #include <QWidget> QT_BEGIN_NAMESPACE class QDoubleSpinBox; class QValueComboBox; QT_END_NAMESPACE /** Widget for entering Nekocoin amounts. */ class NekocoinAmountField: public QWidget { Q_OBJECT Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY textChanged USER true) public: explicit NekocoinAmountField(QWidget *parent = 0); qint64 value(bool *valid=0) const; void setValue(qint64 value); mpq valueAsMpq(bool *value=0) const; void setValue(const mpq& value); /** Mark current value as invalid in UI. */ void setValid(bool valid); /** Perform input validation, mark field as invalid if entered value is not valid. */ bool validate(); /** Change unit used to display amount. */ void setDisplayUnit(int unit); /** Make field empty and ready for new input. */ void clear(); /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907), in these cases we have to set it up manually. */ QWidget *setupTabChain(QWidget *prev); signals: void textChanged(); protected: /** Intercept focus-in event and ',' key presses */ bool eventFilter(QObject *object, QEvent *event); private: QDoubleSpinBox *amount; QValueComboBox *unit; int currentUnit; void setText(const QString &text); QString text() const; private slots: void unitChanged(int idx); }; #endif // NekocoinFIELD_H
#pragma once #include "function.h" namespace nano { /// /// \brief Schumer-Steiglitz No. 02 function: f(x) = sum(x_i^4, i=1,D) /// class function_schumer_steiglitz_t final : public function_t { public: explicit function_schumer_steiglitz_t(const tensor_size_t dims) : function_t("Schumer-Steiglitz", dims, convexity::yes) { } scalar_t vgrad(const vector_t& x, vector_t* gx) const override { if (gx) { *gx = 4 * x.array().cube(); } return x.array().square().square().sum(); } }; }
#pragma once #include <Engine/IFont.h> #include <Engine/RendererStructs.h> #include <../es/shaders/Constants.h> #include <Engine/Object.h> #include <Engine/TextTags.h> namespace fastbird { class ITexture; class IVertexBuffer; class IShader; class IInputLayout; struct SCharDescr { SCharDescr() : srcX(0), srcY(0), srcW(0), srcH(0), xOff(0), yOff(0), xAdv(0), page(0) {} short srcX; short srcY; short srcW; short srcH; short xOff; short yOff; short xAdv; short page; unsigned int chnl; std::vector<int> kerningPairs; }; typedef DEFAULT_INPUTS::V_PCTB FontVertex; //------------------------------------------------------------------------ class Font : public IFont { public: Font(); virtual ~Font(); //-------------------------------------------------------------------- // IFont //-------------------------------------------------------------------- virtual int Init(const char *fontFile); virtual void SetTextEncoding(EFontTextEncoding encoding); virtual void PreRender(){} virtual void Render(){} virtual void PostRender(){} virtual void Write(float x, float y, float z, unsigned int color, const char *text, int count, FONT_ALIGN mode); virtual void SetHeight(float h); virtual float GetHeight() const; virtual float GetBaseHeight() const; virtual void SetBackToOrigHeight(); virtual float GetTextWidth(const char *text, int count = -1, float *minY = 0, float *maxY = 0); virtual std::wstring InsertLineFeed(const char *text, int count, unsigned wrapAt, float* outWidth, unsigned* outLines); virtual void PrepareRenderResources(); virtual void SetRenderStates(bool depthEnable = false, bool scissorEnable = false); float GetBottomOffset(); float GetTopOffset(); virtual void SetRenderTargetSize(const Vec2I& rtSize); virtual void RestoreRenderTargetSize(); std::wstring StripTags(const wchar_t* text); protected: friend class FontLoader; static const unsigned int MAX_BATCH; bool ApplyTag(const char* text, int start, int end, float& x, float& y); TextTags::Enum GetTagType(const char* tagStart, int length, char* buf = 0) const; void InternalWrite(float x, float y, float z, const char *text, int count, float spacing = 0); void Flush(int page, const FontVertex* pVertices, unsigned int vertexCount); float AdjustForKerningPairs(int first, int second); SCharDescr *GetChar(int id); int GetTextLength(const char *text); int SkipTags(const char* text, TextTags::Enum* tag = 0); int GetTextChar(const char *text, int pos, int *nextPos = 0); int FindTextChar(const char *text, int start, int length, int ch); short mFontHeight; // total height of the font short mScaledFontSize; short mBase; // y of base line short mScaleW; short mScaleH; SCharDescr mDefChar; bool mHasOutline; float mScale; EFontTextEncoding mEncoding; unsigned int mColor; std::stack<unsigned int> mColorBackup; std::map<int, SCharDescr*> mChars; std::vector<SmartPtr<ITexture>> mPages; SmartPtr<IVertexBuffer> mVertexBuffer; unsigned int mVertexLocation; SmartPtr<IShader> mShader; SmartPtr<IInputLayout> mInputLayout; SmartPtr<IMaterial> mTextureMaterial; bool mInitialized; OBJECT_CONSTANTS mObjectConstants; Vec2I mRenderTargetSize; }; }
/* This software is subject to the license described in the License.txt file included with this software distribution. You may not use this file except in compliance with this license. Copyright (c) Dynastream Innovations Inc. 2014 All rights reserved. */ /**@file * @defgroup leds * @{ * @ingroup ant_auto_shared_channel * * @brief Header file containing platform specific LED functions */ #ifndef ANT_SHARED_MASTER_TO_MASTER_LEDS_H__ #define ANT_SHARED_MASTER_TO_MASTER_LEDS_H__ #if defined(BOARD_N5DK1) #include "n5sk_led.h" #else #include "nrf_gpio.h" #include "boards.h" #endif #ifdef __cplusplus extern "C" { #endif #define LED_INVALID 0xFF static __INLINE void led_on(uint8_t led_num) { if (led_num == LED_INVALID) return; #if defined(BOARD_N5DK1) n5_io_turn_on_led(led_num); #else nrf_gpio_pin_clear(led_num); #endif } static __INLINE void led_off(uint8_t led_num) { if (led_num == LED_INVALID) return; #if defined(BOARD_N5DK1) n5_io_turn_off_led(led_num); #else nrf_gpio_pin_set(led_num); #endif } static __INLINE void led_toggle(uint8_t led_num) { if (led_num == LED_INVALID) return; #if defined(BOARD_N5DK1) n5_io_toggle_led(led_num); #else nrf_gpio_pin_toggle(led_num); #endif } static __INLINE void led_clear(void) { #if defined(BOARD_N5DK1) n5_io_clear_leds(); #else nrf_gpio_pin_set(BSP_LED_0); nrf_gpio_pin_set(BSP_LED_1); #endif } static __INLINE void led_init(void) { #if defined(BOARD_N5DK1) n5_io_init_leds(); #else nrf_gpio_range_cfg_output(BSP_LED_0, BSP_LED_1); led_clear(); #endif } #ifdef __cplusplus } #endif #endif // ANT_SHARED_MASTER_TO_MASTER_LEDS_H__
#ifndef ossimEquTokenizer_HEADER #define ossimEquTokenizer_HEADER #define yyFlexLexer ossimEquTokenizerFlexLexer #include <ossim/base/ossimEquTokenDefines.h> #include <ossim/base/ossimFlexLexer.h> typedef ossimEquTokenizerFlexLexer ossimEquTokenizer; #endif
/* * Copyright (c) 2008-2012 the MansOS team. 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. * 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 HOLDER OR CONTRIBUTORS 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. */ //------------------------------------------- // TimingTest application. // Calls getTimeMs periodically, displays value on serial //------------------------------------------- #include "stdmansos.h" #include <hil/atomic.h> void appMainD(void); void appMainS(void); void appMainLong(void); void appMainTimesave(void); void appMain(void) { // XXX: if alarms are not used, this must be done manually! // ALARM_TIMER_START(); appMainD(); } // // Simple time accounting, no tricks // void appMainD(void) { for (;;) { uint32_t t = getTimeMs(); PRINTF("real time = %lu\n", t); mdelay(1000); } } // // Simple time accounting with sleeping // void appMainS(void) { for (;;) { uint32_t t = getTimeMs(); PRINTF("real time = %lu\n", t); msleep(1000); } } // // Demo that time accounting works after 32-bit value wraparound // (specify USE_LONG_LIFETIME=y in config file) // void appMainLong(void) { extern volatile ticks_t jiffies; jiffies = ULONG_MAX - 2000; for (;;) { ticks_t time = getTimeMs(); uint8_t *t = (uint8_t *)&time; PRINTF("real time = 0x%02x%02x%02x%02x%02x%02x%02x%02x\n", t[7], t[6], t[5], t[4], t[3], t[2], t[1], t[0]); mdelay(1000); } } // // Demo that time accounting works even when interrupts are disabled // void appMainTimesave(void) { for (;;) { uint32_t t = getTimeMs(); PRINTF("real time = %lu\n", t); Handle_t handle; ATOMIC_START_TIMESAVE(handle); mdelay(1000); ATOMIC_END_TIMESAVE(handle); } }
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_WALLETDB_H #define BITCOIN_WALLETDB_H #include "db.h" #include "base58.h" class CKeyPool; class CAccount; class CAccountingEntry; /** Error statuses for the wallet database */ enum DBErrors { DB_LOAD_OK, DB_CORRUPT, DB_NONCRITICAL_ERROR, DB_TOO_NEW, DB_LOAD_FAIL, DB_NEED_REWRITE }; /** Access to the wallet database (wallet.dat) */ class CWalletDB : public CDB { public: CWalletDB(std::string strFilename, const char* pszMode="r+") : CDB(strFilename.c_str(), pszMode) { } private: CWalletDB(const CWalletDB&); void operator=(const CWalletDB&); public: bool WriteName(const std::string& strAddress, const std::string& strName); bool EraseName(const std::string& strAddress); bool WriteAliasFirstUpdate(const std::vector<unsigned char>& vchName, const uint256& hex, const uint64& rand, const std::vector<unsigned char>& vchData, const CWalletTx &wtx); bool WriteOfferFirstUpdate(const std::vector<unsigned char>& vchName, const uint256& hex, const uint64& rand, const std::vector<unsigned char>& vchData, const CWalletTx &wtx); bool WriteCertFirstUpdate(const std::vector<unsigned char>& vchName, const uint256& hex, const uint64& rand, const std::vector<unsigned char>& vchData, const CWalletTx &wtx); bool EraseAliasFirstUpdate(const std::vector<unsigned char>& vchName); bool EraseOfferFirstUpdate(const std::vector<unsigned char>& vchName); bool EraseCertFirstUpdate(const std::vector<unsigned char>& vchName); bool WriteTx(uint256 hash, const CWalletTx& wtx) { nWalletDBUpdated++; return Write(std::make_pair(std::string("tx"), hash), wtx); } bool EraseTx(uint256 hash) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("tx"), hash)); } bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey) { nWalletDBUpdated++; return Write(std::make_pair(std::string("key"), vchPubKey), vchPrivKey, false); } bool WriteCryptedKey(const CPubKey& vchPubKey, const std::vector<unsigned char>& vchCryptedSecret, bool fEraseUnencryptedKey = true) { nWalletDBUpdated++; if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) return false; if (fEraseUnencryptedKey) { Erase(std::make_pair(std::string("key"), vchPubKey)); Erase(std::make_pair(std::string("wkey"), vchPubKey)); } return true; } bool WriteMasterKey(unsigned int nID, const CMasterKey& kMasterKey) { nWalletDBUpdated++; return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true); } bool WriteCScript(const uint160& hash, const CScript& redeemScript) { nWalletDBUpdated++; return Write(std::make_pair(std::string("cscript"), hash), redeemScript, false); } bool WriteBestBlock(const CBlockLocator& locator) { nWalletDBUpdated++; return Write(std::string("bestblock"), locator); } bool ReadBestBlock(CBlockLocator& locator) { return Read(std::string("bestblock"), locator); } bool WriteOrderPosNext(int64 nOrderPosNext) { nWalletDBUpdated++; return Write(std::string("orderposnext"), nOrderPosNext); } bool WriteDefaultKey(const CPubKey& vchPubKey) { nWalletDBUpdated++; return Write(std::string("defaultkey"), vchPubKey); } bool ReadPool(int64 nPool, CKeyPool& keypool) { return Read(std::make_pair(std::string("pool"), nPool), keypool); } bool WritePool(int64 nPool, const CKeyPool& keypool) { nWalletDBUpdated++; return Write(std::make_pair(std::string("pool"), nPool), keypool); } bool ErasePool(int64 nPool) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("pool"), nPool)); } // Settings are no longer stored in wallet.dat; these are // used only for backwards compatibility: template<typename T> bool ReadSetting(const std::string& strKey, T& value) { return Read(std::make_pair(std::string("setting"), strKey), value); } template<typename T> bool WriteSetting(const std::string& strKey, const T& value) { nWalletDBUpdated++; return Write(std::make_pair(std::string("setting"), strKey), value); } bool EraseSetting(const std::string& strKey) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("setting"), strKey)); } bool WriteMinVersion(int nVersion) { return Write(std::string("minversion"), nVersion); } bool ReadAccount(const std::string& strAccount, CAccount& account); bool WriteAccount(const std::string& strAccount, const CAccount& account); private: bool WriteAccountingEntry(const uint64 nAccEntryNum, const CAccountingEntry& acentry); public: bool WriteAccountingEntry(const CAccountingEntry& acentry); int64 GetAccountCreditDebit(const std::string& strAccount); void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& acentries); DBErrors ReorderTransactions(CWallet*); DBErrors LoadWallet(CWallet* pwallet); static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys); static bool Recover(CDBEnv& dbenv, std::string filename); }; #endif // BITCOIN_WALLETDB_H
// // BSHLRViewController.h // BeepSendApplication // // Created by Vladica Pesic on 7/23/14. // Copyright (c) 2014 BeepSend. All rights reserved. // #import <UIKit/UIKit.h> @interface BSHLRViewController : UIViewController - (BSHLRViewController *)initWithConnection:(BSConnection *)connection; @end
#ifndef GUIUTIL_H #define GUIUTIL_H #include <QString> #include <QObject> #include <QMessageBox> QT_BEGIN_NAMESPACE class QFont; class QLineEdit; class QWidget; class QDateTime; class QUrl; class QAbstractItemView; QT_END_NAMESPACE class SendCoinsRecipient; /** Utility functions used by the Bitcoin Qt UI. */ namespace GUIUtil { // Create human-readable string from date QString dateTimeStr(const QDateTime &datetime); QString dateTimeStr(qint64 nTime); // Render Bitcoin addresses in monospace font QFont bitcoinAddressFont(); // Set up widgets for address and amounts void setupAddressWidget(QLineEdit *widget, QWidget *parent); void setupAmountWidget(QLineEdit *widget, QWidget *parent); // Parse "brightcoin:" URI into recipient object, return true on successful parsing // See Bitcoin URI definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out); bool parseBitcoinURI(QString uri, SendCoinsRecipient *out); // HTML escaping for rich text controls QString HtmlEscape(const QString& str, bool fMultiLine=false); QString HtmlEscape(const std::string& str, bool fMultiLine=false); /** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing is selected. @param[in] column Data column to extract from the model @param[in] role Data role to extract from the model @see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress */ void copyEntryData(QAbstractItemView *view, int column, int role=Qt::EditRole); /** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when no suffix is provided by the user. @param[in] parent Parent window (or 0) @param[in] caption Window caption (or empty, for default) @param[in] dir Starting directory (or empty, to default to documents directory) @param[in] filter Filter specification such as "Comma Separated Files (*.csv)" @param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0). Can be useful when choosing the save file format based on suffix. */ QString getSaveFileName(QWidget *parent=0, const QString &caption=QString(), const QString &dir=QString(), const QString &filter=QString(), QString *selectedSuffixOut=0); /** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking. @returns If called from the GUI thread, return a Qt::DirectConnection. If called from another thread, return a Qt::BlockingQueuedConnection. */ Qt::ConnectionType blockingGUIThreadConnection(); // Determine whether a widget is hidden behind other windows bool isObscured(QWidget *w); // Open debug.log void openDebugLogfile(); /** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text representation if needed. This assures that Qt can word-wrap long tooltip messages. Tooltips longer than the provided size threshold (in characters) are wrapped. */ class ToolTipToRichTextFilter : public QObject { Q_OBJECT public: explicit ToolTipToRichTextFilter(int size_threshold, QObject *parent = 0); protected: bool eventFilter(QObject *obj, QEvent *evt); private: int size_threshold; }; bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); /** Help message for Bitcoin-Qt, shown with --help. */ class HelpMessageBox : public QMessageBox { Q_OBJECT public: HelpMessageBox(QWidget *parent = 0); /** Show message box or print help message to standard output, based on operating system. */ void showOrPrint(); /** Print help message to console */ void printToConsole(); private: QString header; QString coreOptions; QString uiOptions; }; } // namespace GUIUtil #endif // GUIUTIL_H
extern zend_class_entry *zendframework_crypt_key_derivation_exception_invalidargumentexception_ce; ZEPHIR_INIT_CLASS(ZendFramework_Crypt_Key_Derivation_Exception_InvalidArgumentException);
#ifndef BENCHMARK_ARRAY_PREPARE #define BENCHMARK_ARRAY_PREPARE #include "pipeline_data.h" void prepare_array(pipeline_data& data); #endif
///////////////////////////////////////////////////////////////////////////// // Name: tooltip.h // Purpose: wxToolTip class // Author: Robert Roebling // Id: $Id: tooltip.h,v 1.11 2005/08/02 22:57:59 MW Exp $ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __GTKTOOLTIPH__ #define __GTKTOOLTIPH__ #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface #endif #include "wx/defs.h" #include "wx/string.h" #include "wx/object.h" //----------------------------------------------------------------------------- // forward declarations //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxToolTip; class WXDLLIMPEXP_CORE wxWindow; //----------------------------------------------------------------------------- // wxToolTip //----------------------------------------------------------------------------- class WXDLLIMPEXP_CORE wxToolTip : public wxObject { public: // globally change the tooltip parameters static void Enable( bool flag ); static void SetDelay( long msecs ); wxToolTip( const wxString &tip ); // get/set the tooltip text void SetTip( const wxString &tip ); wxString GetTip() const { return m_text; } wxWindow *GetWindow() const { return m_window; } bool IsOk() const { return m_window != NULL; } // implementation void Apply( wxWindow *win ); private: wxString m_text; wxWindow *m_window; DECLARE_ABSTRACT_CLASS(wxToolTip) }; #endif // __GTKTOOLTIPH__
/** * @file * @brief HMC5883L command handlers. * @copyright 2016 [DeviceHive](http://devicehive.com) * @author Nikolay Khabarov */ #include "commands/hmc5883l_cmd.h" #include "commands/i2c_cmd.h" #include "devices/hmc5883l.h" #include "DH/i2c.h" #include "DH/adc.h" #include "snprintf.h" #include "dhcommand_parser.h" #include <user_interface.h> #if defined(DH_COMMANDS_HMC5883L) && defined(DH_DEVICE_HMC5883L) /* * dh_handle_devices_hmc5883l_read() implementation. */ void ICACHE_FLASH_ATTR dh_handle_devices_hmc5883l_read(COMMAND_RESULT *cmd_res, const char *command, const char *params, unsigned int params_len) { gpio_command_params info; ALLOWED_FIELDS fields = 0; if (params_len) { const char *err_msg = parse_params_pins_set(params, params_len, &info, DH_ADC_SUITABLE_PINS, 0, AF_SDA | AF_SCL | AF_ADDRESS, &fields); if (err_msg != 0) { dh_command_fail(cmd_res, err_msg); return; // FAILED } if (fields & AF_ADDRESS) hmc5883l_set_address(info.address); } fields |= AF_ADDRESS; if (dh_i2c_init_helper(cmd_res, fields, &info)) return; // FAILED HMC5883L_XYZ compass; const int status = hmc5883l_read(DH_I2C_NO_PIN, DH_I2C_NO_PIN, &compass); const char *err_msg = dh_i2c_error_string(status); if (err_msg != 0) { dh_command_fail(cmd_res, err_msg); return; // FAILED } // TODO: support for NaN in snprintf! char floatbufx[10] = "NaN"; char floatbufy[10] = "NaN"; char floatbufz[10] = "NaN"; if (compass.X != HMC5883l_OVERFLOWED) snprintf(floatbufx, sizeof(floatbufx), "%f", compass.X); if (compass.Y != HMC5883l_OVERFLOWED) snprintf(floatbufy, sizeof(floatbufy), "%f", compass.Y); if (compass.Z != HMC5883l_OVERFLOWED) snprintf(floatbufz, sizeof(floatbufz), "%f", compass.Z); cmd_res->callback(cmd_res->data, DHSTATUS_OK, RDT_FORMAT_JSON, "{\"magnetometer\":{\"X\":%s, \"Y\":%s, \"Z\":%s}}", floatbufx, floatbufy, floatbufz); } #endif /* DH_COMMANDS_HMC5883L && DH_DEVICE_HMC5883L */
// // UITapGestureRecognizer+CCExtension.h // CCLocalLibrary // // Created by 冯明庆 on 2017/4/16. // Copyright © 2017年 冯明庆. All rights reserved. // #import <UIKit/UIKit.h> @interface UITapGestureRecognizer (CCExtension) - (instancetype) initByAction : (dispatch_block_t) blockClick ; - (instancetype) initByTaps : (NSInteger) integerTaps action : (dispatch_block_t) blockClick; @end
#ifndef HB_COLOR_h #define HB_COLOR_h namespace hb { struct Color { float r; //!< Red component of the color float g; //!< Green component of the color float b; //!< Blue component of the color float a; //!< Alpha component of the color (its opacity) /*! \brief Default constructor. Initializes to color black. */ Color() { this->r = 0.0f; this->g = 0.0f; this->b = 0.0f; this->a = 1.0f; } /*! \brief Floats contructor. \param r Red component of the color \param g Green component of the color \param b Blue component of the color \param a (optional) Alpha component of the color (its opacity). */ Color(float r, float g, float b, float a = 1.0f) { this->r = r; this->g = g; this->b = b; this->a = a; } /*! \brief Int contructor. \param r Red component of the color \param g Green component of the color \param b Blue component of the color \param a (optional) Alpha component of the color (its opacity). Values should be between 0 and 255. They will be divided by 255.0f. */ Color(int r, int g, int b, int a = 255) { this->r = (float)r/255.0f; this->g = (float)g/255.0f; this->b = (float)b/255.0f; this->a = (float)a/255.0f; } }; } #endif /** * \struct hb::Color * \ingroup core * * \brief A color represented in the RGBA format. * * The values of its components should be between 0.0 and 1.0. */
#ifndef CRANKSHAPE2POLYGON_H #define CRANKSHAPE2POLYGON_H /* Copyright (C) 2015, WSID */ /* 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 _CRANKSHAPE_INSIDE #error crankshape2polygon.h cannot be included directly. #endif #include <glib.h> #include <glib-object.h> #include "crankbase.h" #include "cranktrans.h" #include "crankshapemisc.h" #include "crankshape2.h" #include "crankshape2finite.h" #include "crankshape2vertexed.h" G_BEGIN_DECLS //////// Type declaration ////////////////////////////////////////////////////// #define CRANK_TYPE_SHAPE2_POLYGON crank_shape2_polygon_get_type () G_DECLARE_DERIVABLE_TYPE (CrankShape2Polygon, crank_shape2_polygon, CRANK, SHAPE2_POLYGON, CrankShape2Vertexed) /** * CrankShape2Polygon: * * Structure represents a polygon shape */ /** * CrankShape2PolygonClass: * @get_winding: Slot for crank_shape2_polygon_get_winding() * @get_edge_normal: Slot for crank_shape2_polygon_get_edge_normal() * @get_normal_edge: Slot for crank_shape2_polygon_get_normal_edge() * * A Virtual function table for the interface. */ struct _CrankShape2PolygonClass { /*< private >*/ CrankShape2VertexedClass _parent; /*< public >*/ CrankWinding (*get_winding) (CrankShape2Polygon *shape); void (*get_edge_normal) (CrankShape2Polygon *shape, guint index, CrankVecFloat2 *normal); guint (*get_normal_edge) (CrankShape2Polygon *shape, CrankVecFloat2 *normal); }; //////// Polygon Properties //////////////////////////////////////////////////// CrankWinding crank_shape2_polygon_get_winding (CrankShape2Polygon *shape); //////// Edge Properties /////////////////////////////////////////////////////// void crank_shape2_polygon_get_edge_normal (CrankShape2Polygon *shape, guint index, CrankVecFloat2 *normal); guint crank_shape2_polygon_get_normal_edge (CrankShape2Polygon *shape, CrankVecFloat2 *normal); #endif
/***************************************************************** * Copyright (c) 2015 Leif Erkenbrach * Distributed under the terms of the MIT License. * (See accompanying file LICENSE or copy at * http://opensource.org/licenses/MIT) *****************************************************************/ /** * Heavily based on the Rendering Hardware Interface pattern in UE4 by Epic Games * I'm using this since I want to eventually go and build out the backend for DX11 and GL4/ES3, and it has very little overhead for abstracting the command list building * Uses CRTP for static polymorphism to reduce overhead * 06/25/15 - Going to leave this until I am more familiar with DX12 and have an implementation using that. * Looked at the full UE4 implementation and it will take a while to put in commands/states for all of DX12 */ #pragma once #include <stdint.h> #include "Math/Vector4.h" namespace novus { class RHIResource; class RHITexture; class RHITexture2D; class RHIPipelineState; } namespace novus { enum class ClearFlags : uint8_t { Depth = 1, Stencil = 1 << 1, }; class RHICommandListBase { public: //virtual ~RHICommandList() {} //virtual void ClearState(RHIPipelineState* state); //virtual void Close(); //virtual void ClearDepthStencil(RHITexture2D* depthStencil, ClearFlags clearFlags, float clearDepth, uint8_t clearStencil) = 0; //virtual void ClearRenderTarget(RHITexture* renderTarget, const Vector4& clearColor); //virtual void ClearUnorderedAccessView(RHIResource* resource, const Vector4& value); //virtual void ClearUnorderedAccessView(RHIResource* resource, const Vector4u& value); //virtual void CopyBufferRegion(RHIResource* dstBuffer, uint64_t dstOffset, RHIResource* srcBuffer, uint64_t srcOffset, uint64_t byteCount); private: }; struct RHICommandBase { RHICommandBase* Next; void(*ExecuteAndDestructPtr)(RHICommandListBase& commandList, RHICommandBase* command); inline RHICommandBase(void(*executeAndDestructPtr)(RHICommandListBase& commandList, RHICommandBase* command)) :Next(nullptr), ExecuteAndDestructPtr(executeAndDestructPtr) {} inline void CallExecuteAndDestruct(RHICommandListBase& commandList) { ExecuteAndDestructPtr(commandList, this); } }; template <typename TCmd> struct RHICommand : public RHICommandBase { inline RHICommand() :RHICommandBase(&ExecuteAndDestruct) {} static inline void ExecuteAndDestruct(RHICommandListBase& commandList, RHICommandBase* command) { TCmd *thisCmd = static_cast<TCmd*>(command); thisCmd->Execute(commandList); thisCmd->~TCmd(); } }; }