text
stringlengths
4
6.14k
/* ---------------------------------------------------------------------- This is the โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ• โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ•‘ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘ โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ• โ•šโ•โ• โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•ยฎ DEM simulation engine, released by DCS Computing Gmbh, Linz, Austria http://www.dcs-computing.com, office@dcs-computing.com LIGGGHTSยฎ is part of CFDEMยฎproject: http://www.liggghts.com | http://www.cfdem.com Core developer and main author: Christoph Kloss, christoph.kloss@dcs-computing.com LIGGGHTSยฎ is open-source, distributed under the terms of the GNU Public License, version 2 or later. It 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. You should have received a copy of the GNU General Public License along with LIGGGHTSยฎ. If not, see http://www.gnu.org/licenses . See also top-level README and LICENSE files. LIGGGHTSยฎ and CFDEMยฎ are registered trade marks of DCS Computing GmbH, the producer of the LIGGGHTSยฎ software and the CFDEMยฎcoupling software See http://www.cfdem.com/terms-trademark-policy for details. ------------------------------------------------------------------------- Contributing author and copyright for this file: This file is from LAMMPS LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. ------------------------------------------------------------------------- */ #ifdef ATOM_CLASS AtomStyle(molecular,AtomVecMolecular) #else #ifndef LMP_ATOM_VEC_MOLECULAR_H #define LMP_ATOM_VEC_MOLECULAR_H #include "atom_vec.h" namespace LAMMPS_NS { class AtomVecMolecular : public AtomVec { public: AtomVecMolecular(class LAMMPS *); void grow(int); void grow_reset(); void copy(int, int, int); int pack_comm(int, int *, double *, int, int *); int pack_comm_vel(int, int *, double *, int, int *); void unpack_comm(int, int, double *); void unpack_comm_vel(int, int, double *); int pack_reverse(int, int, double *); void unpack_reverse(int, int *, double *); int pack_border(int, int *, double *, int, int *); int pack_border_vel(int, int *, double *, int, int *); int pack_border_hybrid(int, int *, double *); void unpack_border(int, int, double *); void unpack_border_vel(int, int, double *); int unpack_border_hybrid(int, int, double *); int pack_exchange(int, double *); int unpack_exchange(double *); int size_restart(); int pack_restart(int, double *); int unpack_restart(double *); void create_atom(int, double *); void data_atom(double *, tagint, char **); int data_atom_hybrid(int, char **); void pack_data(double **); int pack_data_hybrid(int, double *); void write_data(FILE *, int, double **); int write_data_hybrid(FILE *, double *); bigint memory_usage(); private: int *tag,*type,*mask; tagint *image; double **x,**v,**f; int *molecule; int **nspecial,**special; int *num_bond; int **bond_type,**bond_atom; int *num_angle; int **angle_type; int **angle_atom1,**angle_atom2,**angle_atom3; int *num_dihedral; int **dihedral_type; int **dihedral_atom1,**dihedral_atom2,**dihedral_atom3,**dihedral_atom4; int *num_improper; int **improper_type; int **improper_atom1,**improper_atom2,**improper_atom3,**improper_atom4; }; } #endif #endif /* ERROR/WARNING messages: E: Per-processor system is too big The number of owned atoms plus ghost atoms on a single processor must fit in 32-bit integer. E: Invalid atom ID in Atoms section of data file Atom IDs must be positive integers. E: Invalid atom type in Atoms section of data file Atom types must range from 1 to specified # of types. */
/* * synergy -- mouse and keyboard sharing utility * Copyright (C) 2012 Bolton Software Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file COPYING that should have accompanied this file. * * This package 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 "base/String.h" #include "base/EventTypes.h" #include "common/IInterface.h" //! Clipboard interface /*! This interface defines the methods common to all clipboards. */ class IClipboard : public IInterface { public: //! Timestamp type /*! Timestamp type. Timestamps are in milliseconds from some arbitrary starting time. Timestamps will wrap around to 0 after about 49 3/4 days. */ typedef UInt32 Time; //! Clipboard formats /*! The list of known clipboard formats. kNumFormats must be last and formats must be sequential starting from zero. Clipboard data set via add() and retrieved via get() must be in one of these formats. Platform dependent clipboard subclasses can and should present any suitable formats derivable from these formats. \c kText is a text format encoded in UTF-8. Newlines are LF (not CR or LF/CR). \c kBitmap is an image format. The data is a BMP file without the 14 byte header (i.e. starting at the INFOHEADER) and with the image data immediately following the 40 byte INFOHEADER. \c kHTML is a text format encoded in UTF-8 and containing a valid HTML fragment (but not necessarily a complete HTML document). Newlines are LF. */ enum EFormat { kText, //!< Text format, UTF-8, newline is LF kBitmap, //!< Bitmap format, BMP 24/32bpp, BI_RGB kHTML, //!< HTML format, HTML fragment, UTF-8, newline is LF kNumFormats //!< The number of clipboard formats }; //! @name manipulators //@{ //! Empty clipboard /*! Take ownership of the clipboard and clear all data from it. This must be called between a successful open() and close(). Return false if the clipboard ownership could not be taken; the clipboard should not be emptied in this case. */ virtual bool empty() = 0; //! Add data /*! Add data in the given format to the clipboard. May only be called after a successful empty(). */ virtual void add(EFormat, const CString& data) = 0; //@} //! @name accessors //@{ //! Open clipboard /*! Open the clipboard. Return true iff the clipboard could be opened. If open() returns true then the client must call close() at some later time; if it returns false then close() must not be called. \c time should be the current time or a time in the past when the open should effectively have taken place. */ virtual bool open(Time time) const = 0; //! Close clipboard /*! Close the clipboard. close() must match a preceding successful open(). This signals that the clipboard has been filled with all the necessary data or all data has been read. It does not mean the clipboard ownership should be released (if it was taken). */ virtual void close() const = 0; //! Get time /*! Return the timestamp passed to the last successful open(). */ virtual Time getTime() const = 0; //! Check for data /*! Return true iff the clipboard contains data in the given format. Must be called between a successful open() and close(). */ virtual bool has(EFormat) const = 0; //! Get data /*! Return the data in the given format. Returns the empty string if there is no data in that format. Must be called between a successful open() and close(). */ virtual CString get(EFormat) const = 0; //! Marshall clipboard data /*! Merge \p clipboard's data into a single buffer that can be later unmarshalled to restore the clipboard and return the buffer. */ static CString marshall(const IClipboard* clipboard); //! Unmarshall clipboard data /*! Extract marshalled clipboard data and store it in \p clipboard. Sets the clipboard time to \c time. */ static void unmarshall(IClipboard* clipboard, const CString& data, Time time); //! Copy clipboard /*! Transfers all the data in one clipboard to another. The clipboards can be of any concrete clipboard type (and they don't have to be the same type). This also sets the destination clipboard's timestamp to source clipboard's timestamp. Returns true iff the copy succeeded. */ static bool copy(IClipboard* dst, const IClipboard* src); //! Copy clipboard /*! Transfers all the data in one clipboard to another. The clipboards can be of any concrete clipboard type (and they don't have to be the same type). This also sets the timestamp to \c time. Returns true iff the copy succeeded. */ static bool copy(IClipboard* dst, const IClipboard* src, Time); //@} private: static UInt32 readUInt32(const char*); static void writeUInt32(CString*, UInt32); };
/* mpfr_signbit -- Signbit of a MPFR number Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by the AriC and Caramel projects, INRIA. This file is part of the GNU MPFR Library. The GNU MPFR Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The GNU MPFR Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mpfr-impl.h" #undef mpfr_signbit int mpfr_signbit (mpfr_srcptr x) { return MPFR_SIGN (x) < 0; }
/* * Copyright (c) 2016 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ /** @file sys_log.h * @brief Logging macros. */ #ifndef __SYS_LOG_H #define __SYS_LOG_H #ifdef __cplusplus extern "C" { #endif #define SYS_LOG_LEVEL_OFF 0 #define SYS_LOG_LEVEL_ERROR 1 #define SYS_LOG_LEVEL_WARNING 2 #define SYS_LOG_LEVEL_INFO 3 #define SYS_LOG_LEVEL_DEBUG 4 /* Determine this compile unit log level */ #if !defined(SYS_LOG_LEVEL) /* Use default */ #define SYS_LOG_LEVEL CONFIG_SYS_LOG_DEFAULT_LEVEL #elif (SYS_LOG_LEVEL < CONFIG_SYS_LOG_OVERRIDE_LEVEL) /* Use override */ #undef SYS_LOG_LEVEL #define SYS_LOG_LEVEL CONFIG_SYS_LOG_OVERRIDE_LEVEL #endif /** * @brief System Log * @defgroup system_log System Log * @{ */ #if defined(CONFIG_SYS_LOG) && (SYS_LOG_LEVEL > SYS_LOG_LEVEL_OFF) #define IS_SYS_LOG_ACTIVE 1 extern void (*syslog_hook)(const char *fmt, ...); void syslog_hook_install(void (*hook)(const char *, ...)); /* decide print func */ #if defined(CONFIG_SYS_LOG_EXT_HOOK) #define SYS_LOG_BACKEND_FN syslog_hook #else #include <misc/printk.h> #define SYS_LOG_BACKEND_FN printk #endif /* Should use color? */ #if defined(CONFIG_SYS_LOG_SHOW_COLOR) #define SYS_LOG_COLOR_OFF "\x1B[0m" #define SYS_LOG_COLOR_RED "\x1B[0;31m" #define SYS_LOG_COLOR_YELLOW "\x1B[0;33m" #else #define SYS_LOG_COLOR_OFF "" #define SYS_LOG_COLOR_RED "" #define SYS_LOG_COLOR_YELLOW "" #endif /* CONFIG_SYS_LOG_SHOW_COLOR */ /* Should use log lv tags? */ #if defined(CONFIG_SYS_LOG_SHOW_TAGS) #define SYS_LOG_TAG_ERR " [ERR]" #define SYS_LOG_TAG_WRN " [WRN]" #define SYS_LOG_TAG_INF " [INF]" #define SYS_LOG_TAG_DBG " [DBG]" #else #define SYS_LOG_TAG_ERR "" #define SYS_LOG_TAG_WRN "" #define SYS_LOG_TAG_INF "" #define SYS_LOG_TAG_DBG "" #endif /* CONFIG_SYS_LOG_SHOW_TAGS */ /* Log domain name */ #if !defined(SYS_LOG_DOMAIN) #define SYS_LOG_DOMAIN "general" #endif /* SYS_LOG_DOMAIN */ /** * @def SYS_LOG_NO_NEWLINE * * @brief Specifies whether SYS_LOG should add newline at the end of line * or not. * * @details User can define SYS_LOG_NO_NEWLINE no prevent the header file * from adding newline if the debug print already has a newline character. */ #if !defined(SYS_LOG_NO_NEWLINE) #define SYS_LOG_NL "\n" #else #define SYS_LOG_NL "" #endif /* [domain] [level] function: */ #define LOG_LAYOUT "[%s]%s %s: %s" #define LOG_BACKEND_CALL(log_lv, log_color, log_format, color_off, ...) \ SYS_LOG_BACKEND_FN(LOG_LAYOUT log_format "%s" SYS_LOG_NL, \ SYS_LOG_DOMAIN, log_lv, __func__, log_color, ##__VA_ARGS__, color_off) #define LOG_NO_COLOR(log_lv, log_format, ...) \ LOG_BACKEND_CALL(log_lv, "", log_format, "", ##__VA_ARGS__) #define LOG_COLOR(log_lv, log_color, log_format, ...) \ LOG_BACKEND_CALL(log_lv, log_color, log_format, \ SYS_LOG_COLOR_OFF, ##__VA_ARGS__) #define SYS_LOG_ERR(...) LOG_COLOR(SYS_LOG_TAG_ERR, SYS_LOG_COLOR_RED, \ ##__VA_ARGS__) #if (SYS_LOG_LEVEL >= SYS_LOG_LEVEL_WARNING) #define SYS_LOG_WRN(...) LOG_COLOR(SYS_LOG_TAG_WRN, \ SYS_LOG_COLOR_YELLOW, ##__VA_ARGS__) #endif #if (SYS_LOG_LEVEL >= SYS_LOG_LEVEL_INFO) #define SYS_LOG_INF(...) LOG_NO_COLOR(SYS_LOG_TAG_INF, ##__VA_ARGS__) #endif #if (SYS_LOG_LEVEL == SYS_LOG_LEVEL_DEBUG) #define SYS_LOG_DBG(...) LOG_NO_COLOR(SYS_LOG_TAG_DBG, ##__VA_ARGS__) #endif #else /** * @def IS_SYS_LOG_ACTIVE * * @brief Specifies whether SYS_LOG is in use or not. * * @details This macro expands to 1 if SYS_LOG was activated for current .c * file, 0 otherwise. */ #define IS_SYS_LOG_ACTIVE 0 /** * @def SYS_LOG_ERR * * @brief Writes an ERROR level message to the log. * * @details Lowest logging level, these messages are logged whenever sys log is * active. it's meant to report severe errors, such as those from which it's * not possible to recover. * * @param ... A string optionally containing printk valid conversion specifier, * followed by as many values as specifiers. */ #define SYS_LOG_ERR(...) { ; } #endif /* CONFIG_SYS_LOG */ /* create dummy macros */ #if !defined(SYS_LOG_WRN) /** * @def SYS_LOG_WRN * * @brief Writes a WARNING level message to the log. * * @details available if SYS_LOG_LEVEL is SYS_LOG_LEVEL_WARNING or higher. * It's meant to register messages related to unusual situations that are * not necessarily errors. * * @param ... A string optionally containing printk valid conversion specifier, * followed by as many values as specifiers. */ #define SYS_LOG_WRN(...) { ; } #endif #if !defined(SYS_LOG_INF) /** * @def SYS_LOG_INF * * @brief Writes an INFO level message to the log. * * @details available if SYS_LOG_LEVEL is SYS_LOG_LEVEL_INFO or higher. * It's meant to write generic user oriented messages. * * @param ... A string optionally containing printk valid conversion specifier, * followed by as many values as specifiers. */ #define SYS_LOG_INF(...) { ; } #endif #if !defined(SYS_LOG_DBG) /** * @def SYS_LOG_DBG * * @brief Writes a DEBUG level message to the log. * * @details highest logging level, available if SYS_LOG_LEVEL is * SYS_LOG_LEVEL_DEBUG. It's meant to write developer oriented information. * * @param ... A string optionally containing printk valid conversion specifier, * followed by as many values as specifiers. */ #define SYS_LOG_DBG(...) { ; } #endif /** * @} */ #ifdef __cplusplus } #endif #endif /* __SYS_LOG_H */
/* * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. * * SPDX-License-Identifier: BSD-3-Clause */ // ----------------------------------------------------- // NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO // SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES // ----------------------------------------------------- #ifndef _BOARDS_VGABOARD_H #define _BOARDS_VGABOARD_H #ifndef PICO_DEFAULT_UART #define PICO_DEFAULT_UART 1 #endif #ifndef PICO_DEFAULT_UART_TX_PIN #define PICO_DEFAULT_UART_TX_PIN 20 #endif #ifndef PICO_DEFAULT_UART_RX_PIN #define PICO_DEFAULT_UART_RX_PIN 21 #endif #ifndef PICO_DEFAULT_LED_PIN #define PICO_DEFAULT_LED_PIN 25 // same as Pico #endif // Audio pins. I2S BCK, LRCK are on the same pins as PWM L/R. // - When outputting I2S, PWM sees BCK and LRCK, which should sound silent as // they are constant duty cycle, and above the filter cutoff // - When outputting PWM, I2S DIN should be low, so I2S should remain silent. #define VGABOARD_I2S_DIN_PIN 26 #define VGABOARD_I2S_BCK_PIN 27 #define VGABOARD_I2S_LRCK_PIN 28 #define VGABOARD_PWM_L_PIN 28 #define VGABOARD_PWM_R_PIN 27 #define VGABOARD_VGA_COLOR_PIN_BASE 0 #define VGABOARD_VGA_SYNC_PIN_BASE 16 // Note DAT2/3 are shared with UART TX/RX (pull jumpers off header to access // UART pins and disconnect SD DAT2/3) #define VGABOARD_SD_CLK_PIN 5 #define VGABOARD_SD_CMD_PIN 18 #define VGABOARD_SD_DAT0_PIN 19 // Note buttons are shared with VGA colour LSBs -- if using VGA, you can float // the pin on VSYNC assertion and sample on VSYNC deassertion #define VGABOARD_BUTTON_A_PIN 0 #define VGABOARD_BUTTON_B_PIN 6 #define VGABOARD_BUTTON_C_PIN 11 #ifndef PICO_SCANVIDEO_COLOR_PIN_BASE #define PICO_SCANVIDEO_COLOR_PIN_BASE VGABOARD_VGA_COLOR_PIN_BASE #endif #ifndef PICO_SCANVIDEO_SYMC_PIN_BASE #define PICO_SCANVIDEO_SYNC_PIN_BASE VGABOARD_VGA_SYNC_PIN_BASE #endif #ifndef PICO_SD_CLK_PIN #define PICO_SD_CLK_PIN VGABOARD_SD_CLK_PIN #endif #ifndef PICO_SD_CMD_PIN #define PICO_SD_CMD_PIN VGABOARD_SD_CMD_PIN #endif #ifndef PICO_SD_DAT0_PIN #define PICO_SD_DAT0_PIN VGABOARD_SD_DAT0_PIN #endif #define PICO_AUDIO_I2S_DATA_PIN VGABOARD_I2S_DIN_PIN #define PICO_AUDIO_I2S_CLOCK_PIN_BASE VGABOARD_I2S_BCK_PIN #define PICO_AUDIO_PWM_L_PIN VGABOARD_PWM_L_PIN #define PICO_AUDIO_PWM_R_PIN VGABOARD_PWM_R_PIN #ifndef PICO_FLASH_SPI_CLKDIV #define PICO_FLASH_SPI_CLKDIV 2 #endif #ifndef PICO_FLASH_SIZE_BYTES #define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024) #endif // Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads) #define PICO_SMPS_MODE_PIN 23 #ifndef PICO_FLOAT_SUPPORT_ROM_V1 #define PICO_FLOAT_SUPPORT_ROM_V1 1 #endif #ifndef PICO_DOUBLE_SUPPORT_ROM_V1 #define PICO_DOUBLE_SUPPORT_ROM_V1 1 #endif #define PICO_VGA_BOARD #endif
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_XLA_CLIENT_LIB_PRNG_H_ #define TENSORFLOW_COMPILER_XLA_CLIENT_LIB_PRNG_H_ #include <array> #include "tensorflow/compiler/xla/client/xla_builder.h" #include "tensorflow/compiler/xla/xla_data.pb.h" namespace xla { // Records the bits and state generated by a random number generator. struct RngOutput { XlaOp value; XlaOp state; }; // A BitGenerator returns random bits and updated random bit generator state. // // key: is a value input to a random number generator that can affect the // sequence of number it will generate. A random number generator constructs // its seed using the key and the initial state. The tf2xla bridge passes the // seed operand of a tensorflow random operation as a key to the random bit // generator, for example. // initial_state: initial_state is the initial state of the current random // number generation. It could be 0 for a stateless random operation, and // the returned state from a previous execution for a stateful random // operation. // shape: the shape of the random bits. using BitGeneratorTy = std::function<RngOutput(XlaOp key, XlaOp initial_state, const xla::Shape& shape)>; // Implements the ThreeFry counter-based PRNG algorithm. // Salmon et al. SC 2011. Parallel random numbers: as easy as 1, 2, 3. // http://www.thesalmons.org/john/random123/papers/random123sc11.pdf RngOutput ThreeFryBitGenerator(XlaOp key, XlaOp initial_state, const xla::Shape& shape); // Implements the Philox algorithm to generate random numbers in parallel. // Salmon et al. SC 2011. Parallel random numbers: as easy as 1, 2, 3. // http://www.thesalmons.org/john/random123/papers/random123sc11.pdf // // The paper presents a few variants of the Philox algorithm, we picked the // 4x32_10 version of the algorithm for the following reasons: // . 4x32 uses 32-bit multiplication which is fast on GPUs. // . The authors recommend the 10-round variant, and TensorFlow also uses it. RngOutput PhiloxBitGenerator(XlaOp key, XlaOp initial_state, const Shape& shape); // Returns a scrambled pair of (state, key) from a single key. std::pair<XlaOp, XlaOp> ScramblePhiloxKey(XlaOp key); // Uses the given bit generator to generate random bits and then converts the // random bits to random numbers of uniform distribution in the given range. // Returns the random numbers and the state of the random number generator. // This function is for shape with floating point element types. RngOutput UniformFloatingPointDistribution(XlaOp key, XlaOp initial_state, BitGeneratorTy bit_generator, XlaOp minval, XlaOp maxval, const xla::Shape& shape); // Similar to UniformFloatingPointDistribution but for shape with integer // element types. RngOutput UniformIntDistribution(XlaOp key, XlaOp initial_state, BitGeneratorTy bit_generator, XlaOp minval, XlaOp maxval, const xla::Shape& shape); // Uses the given bit generator to generate random bits and then converts the // random bits to random numbers of normal distribution. // Returns the random numbers and the state of the random number generator. RngOutput NormalFloatingPointDistribution(XlaOp key, XlaOp initial_state, BitGeneratorTy bit_generator, const xla::Shape& shape); // Concatenates scalars into a vector. xla::XlaOp ConcatScalars(xla::XlaBuilder* builder, absl::Span<const xla::XlaOp> scalars); // Increases Philox counter (an uint128) by a delta (an uint64). xla::XlaOp PhiloxIncreaseCounter(xla::XlaOp counter, xla::XlaOp delta); } // namespace xla #endif // TENSORFLOW_COMPILER_XLA_CLIENT_LIB_PRNG_H_
// 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 CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ #define CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_ #include <string> #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_ui_controller.h" #include "content/public/common/service_registry.h" #include "mojo/public/cpp/system/core.h" class MojoWebUIHandler; namespace content { class WebUIDataSource; } class MojoWebUIControllerBase : public content::WebUIController { public: explicit MojoWebUIControllerBase(content::WebUI* contents); ~MojoWebUIControllerBase() override; // WebUIController overrides: void RenderViewCreated(content::RenderViewHost* render_view_host) override; protected: // Invoke to register mapping between binding file and resource id (IDR_...). void AddMojoResourcePath(const std::string& path, int resource_id); private: // Bindings files are registered here. content::WebUIDataSource* mojo_data_source_; DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase); }; // MojoWebUIController is intended for web ui pages that use mojo. It is // expected that subclasses will do two things: // . In the constructor invoke AddMojoResourcePath() to register the bindings // files, eg: // AddMojoResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom", // IDR_OMNIBOX_MOJO_JS); // . Override BindUIHandler() to create and bind the implementation of the // bindings. template <typename Interface> class MojoWebUIController : public MojoWebUIControllerBase { public: explicit MojoWebUIController(content::WebUI* contents) : MojoWebUIControllerBase(contents), weak_factory_(this) {} virtual ~MojoWebUIController() {} virtual void RenderViewCreated( content::RenderViewHost* render_view_host) override { MojoWebUIControllerBase::RenderViewCreated(render_view_host); render_view_host->GetMainFrame()->GetServiceRegistry()-> AddService<Interface>( base::Bind(&MojoWebUIController::BindUIHandler, weak_factory_.GetWeakPtr())); } protected: // Invoked to create the specific bindings implementation. virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0; private: base::WeakPtrFactory<MojoWebUIController> weak_factory_; DISALLOW_COPY_AND_ASSIGN(MojoWebUIController); }; #endif // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_
// 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_CHROME_BROWSER_MAIN_ANDROID_H_ #define CHROME_BROWSER_CHROME_BROWSER_MAIN_ANDROID_H_ #include "base/macros.h" #include "chrome/browser/chrome_browser_main.h" namespace breakpad { class CrashDumpManager; } class ChromeBrowserMainPartsAndroid : public ChromeBrowserMainParts { public: explicit ChromeBrowserMainPartsAndroid( const content::MainFunctionParams& parameters); ~ChromeBrowserMainPartsAndroid() override; // content::BrowserMainParts overrides. int PreCreateThreads() override; void PostProfileInit() override; void PreEarlyInitialization() override; void PreMainMessageLoopRun() override; // ChromeBrowserMainParts overrides. void PostBrowserStart() override; void ShowMissingLocaleMessageBox() override; private: scoped_ptr<base::MessageLoop> main_message_loop_; scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsAndroid); }; #endif // CHROME_BROWSER_CHROME_BROWSER_MAIN_ANDROID_H_
// 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 EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_ #define EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_ #include <string> #include "base/memory/ref_counted.h" #include "components/keyed_service/core/keyed_service.h" #include "extensions/common/extension.h" class ExtensionService; #if defined(OS_CHROMEOS) namespace chromeos { class DeviceLocalAccountManagementPolicyProvider; } #endif // defined(OS_CHROMEOS) namespace content { class BrowserContext; } namespace extensions { class Blacklist; class ContentVerifier; class ErrorConsole; class EventRouter; class Extension; class ExtensionSet; class ExtensionWarningService; class InfoMap; class InstallVerifier; class LazyBackgroundTaskQueue; class ManagementPolicy; class OneShotEvent; class ProcessManager; class QuotaService; class RuntimeData; class StateStore; class UserScriptMaster; // ExtensionSystem manages the lifetime of many of the services used by the // extensions and apps system, and it handles startup and shutdown as needed. // Eventually, we'd like to make more of these services into KeyedServices in // their own right. class ExtensionSystem : public KeyedService { public: ExtensionSystem(); virtual ~ExtensionSystem(); // Returns the instance for the given browser context, or NULL if none. static ExtensionSystem* Get(content::BrowserContext* context); // Initializes extensions machinery. // Component extensions are always enabled, external and user extensions are // controlled by |extensions_enabled|. virtual void InitForRegularProfile(bool extensions_enabled) = 0; // The ExtensionService is created at startup. virtual ExtensionService* extension_service() = 0; // Per-extension data that can change during the life of the process but // does not persist across restarts. Lives on UI thread. Created at startup. virtual RuntimeData* runtime_data() = 0; // The class controlling whether users are permitted to perform certain // actions on extensions (install, uninstall, disable, etc.). // The ManagementPolicy is created at startup. virtual ManagementPolicy* management_policy() = 0; // The UserScriptMaster is created at startup. virtual UserScriptMaster* user_script_master() = 0; // The ProcessManager is created at startup. virtual ProcessManager* process_manager() = 0; // The StateStore is created at startup. virtual StateStore* state_store() = 0; // The rules store is created at startup. virtual StateStore* rules_store() = 0; // Returns the IO-thread-accessible extension data. virtual InfoMap* info_map() = 0; // The LazyBackgroundTaskQueue is created at startup. virtual LazyBackgroundTaskQueue* lazy_background_task_queue() = 0; // The EventRouter is created at startup. virtual EventRouter* event_router() = 0; // The ExtensionWarningService is created at startup. virtual ExtensionWarningService* warning_service() = 0; // The blacklist is created at startup. virtual Blacklist* blacklist() = 0; // The ErrorConsole is created at startup. virtual ErrorConsole* error_console() = 0; // The InstallVerifier is created at startup. virtual InstallVerifier* install_verifier() = 0; // Returns the QuotaService that limits calls to certain extension functions. // Lives on the UI thread. Created at startup. virtual QuotaService* quota_service() = 0; // Called by the ExtensionService that lives in this system. Gives the // info map a chance to react to the load event before the EXTENSION_LOADED // notification has fired. The purpose for handling this event first is to // avoid race conditions by making sure URLRequestContexts learn about new // extensions before anything else needs them to know. virtual void RegisterExtensionWithRequestContexts( const Extension* extension) {} // Called by the ExtensionService that lives in this system. Lets the // info map clean up its RequestContexts once all the listeners to the // EXTENSION_UNLOADED notification have finished running. virtual void UnregisterExtensionWithRequestContexts( const std::string& extension_id, const UnloadedExtensionInfo::Reason reason) {} // Signaled when the extension system has completed its startup tasks. virtual const OneShotEvent& ready() const = 0; // Returns the content verifier, if any. virtual ContentVerifier* content_verifier() = 0; // Get a set of extensions that depend on the given extension. // TODO(elijahtaylor): Move SharedModuleService out of chrome/browser // so it can be retrieved from ExtensionSystem directly. virtual scoped_ptr<ExtensionSet> GetDependentExtensions( const Extension* extension) = 0; }; } // namespace extensions #endif // EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_
// Copyright 2016 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 BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_ #define BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_ #include "base/base_export.h" #include "base/task/task_traits.h" #include "base/time/time.h" namespace base { namespace internal { // An immutable but assignable representation of the priority of a Sequence. class BASE_EXPORT TaskSourceSortKey final { public: TaskSourceSortKey() = default; TaskSourceSortKey(TaskPriority priority, TimeTicks ready_time, uint8_t worker_count = 0); TaskPriority priority() const { return priority_; } uint8_t worker_count() const { return worker_count_; } TimeTicks ready_time() const { return ready_time_; } // Used for a max-heap. bool operator<(const TaskSourceSortKey& other) const; bool operator==(const TaskSourceSortKey& other) const { return priority_ == other.priority_ && worker_count_ == other.worker_count_ && ready_time_ == other.ready_time_; } bool operator!=(const TaskSourceSortKey& other) const { return !(other == *this); } private: // The private section allows this class to keep its immutable property while // being copy-assignable (i.e. instead of making its members const). // Highest task priority in the sequence at the time this sort key was // created. TaskPriority priority_; // Number of workers running the task source, used as secondary sort key // prioritizing task sources with fewer workers. uint8_t worker_count_; // Time since the task source has been ready to run upcoming work, used as // secondary sort key after |worker_count| prioritizing older task sources. TimeTicks ready_time_; }; } // namespace internal } // namespace base #endif // BASE_TASK_THREAD_POOL_TASK_SOURCE_SORT_KEY_H_
/********************************************************************** Audacity: A Digital Audio Editor DeviceManager.h Created by Michael Chinen (mchinen) on 2/12/11 Audacity(R) is copyright (c) 1999-2011 Audacity Team. License: GPL v2. See License.txt. ******************************************************************//** \class DeviceManager \brief A singleton that manages the audio devices known to Audacity *//*******************************************************************/ #ifndef __AUDACITY_DEVICEMANAGER__ #define __AUDACITY_DEVICEMANAGER__ #include <vector> #include "wx/wx.h" #if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER) #include "DeviceChange.h" #endif typedef struct DeviceSourceMap { int deviceIndex; int sourceIndex; int hostIndex; int totalSources; int numChannels; wxString sourceString; wxString deviceString; wxString hostString; } DeviceSourceMap; wxString MakeDeviceSourceString(const DeviceSourceMap *map); class DeviceManager #if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER) #if defined(HAVE_DEVICE_CHANGE) : public DeviceChangeHandler #endif #endif { public: /// Gets the singleton instance static DeviceManager* Instance(); /// Releases memory assosiated with the singleton static void Destroy(); /// Gets a new list of devices by terminating and restarting portaudio /// Assumes that DeviceManager is only used on the main thread. void Rescan(); DeviceSourceMap* GetDefaultOutputDevice(int hostIndex); DeviceSourceMap* GetDefaultInputDevice(int hostIndex); const std::vector<DeviceSourceMap> &GetInputDeviceMaps(); const std::vector<DeviceSourceMap> &GetOutputDeviceMaps(); #if defined(EXPERIMENTAL_DEVICE_CHANGE_HANDLER) #if defined(HAVE_DEVICE_CHANGE) // DeviceChangeHandler implementation void DeviceChangeNotification(); #endif #endif protected: //private constructor - Singleton. DeviceManager(); virtual ~DeviceManager(); /// Does an initial scan. /// Called by GetInputDeviceMaps and GetOutputDeviceMaps when needed. void Init(); DeviceSourceMap* GetDefaultDevice(int hostIndex, int isInput); bool m_inited; std::vector<DeviceSourceMap> mInputDeviceSourceMaps; std::vector<DeviceSourceMap> mOutputDeviceSourceMaps; static DeviceManager dm; }; #endif
/********************************************************************** * $Id: SimpleSnapRounder.h 3239 2011-02-23 14:37:29Z strk $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2006 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation. * See the COPYING file for more information. * ********************************************************************** * * Last port: noding/snapround/SimpleSnapRounder.java r320 (JTS-1.12) * **********************************************************************/ #ifndef GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H #define GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H #include <geos/export.h> #include <vector> #include <geos/inline.h> #include <geos/noding/Noder.h> // for inheritance #include <geos/algorithm/LineIntersector.h> // for composition #include <geos/geom/Coordinate.h> // for use in vector #include <geos/geom/PrecisionModel.h> // for inlines (should drop) // Forward declarations namespace geos { namespace geom { //class PrecisionModel; } namespace algorithm { class LineIntersector; } namespace noding { class SegmentString; class NodedSegmentString; namespace snapround { class HotPixel; } } } namespace geos { namespace noding { // geos::noding namespace snapround { // geos::noding::snapround /** \brief * Uses Snap Rounding to compute a rounded, * fully noded arrangement from a set of {@link SegmentString}s. * * Implements the Snap Rounding technique described in * Hobby, Guibas & Marimont, and Goodrich et al. * Snap Rounding assumes that all vertices lie on a uniform grid * (hence the precision model of the input must be fixed precision, * and all the input vertices must be rounded to that precision). * * This implementation uses simple iteration over the line segments. * * This is not the most efficient approach for large sets of segments. * * This implementation appears to be fully robust using an integer * precision model. * It will function with non-integer precision models, but the * results are not 100% guaranteed to be correctly noded. * */ class GEOS_DLL SimpleSnapRounder: public Noder { // implements NoderIface public: SimpleSnapRounder(const geom::PrecisionModel& newPm); std::vector<SegmentString*>* getNodedSubstrings() const; void computeNodes(std::vector<SegmentString*>* inputSegmentStrings); void add(const SegmentString* segStr); /** * Computes nodes introduced as a result of * snapping segments to vertices of other segments * * @param edges the list of segment strings to snap together. * Must be NodedSegmentString or an assertion will fail. */ void computeVertexSnaps(const std::vector<SegmentString*>& edges); private: const geom::PrecisionModel& pm; algorithm::LineIntersector li; double scaleFactor; std::vector<SegmentString*>* nodedSegStrings; void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings); void snapRound(std::vector<SegmentString*>* segStrings, algorithm::LineIntersector& li); /** * Computes all interior intersections in the vector * of SegmentString, and fill the given vector * with their Coordinates. * * Does NOT node the segStrings. * * @param segStrings a vector of const Coordinates for the intersections * @param li the algorithm::LineIntersector to use * @param ret the vector to push intersection Coordinates to */ void findInteriorIntersections(std::vector<SegmentString*>& segStrings, algorithm::LineIntersector& li, std::vector<geom::Coordinate>& ret); /** \brief * Computes nodes introduced as a result of snapping segments to * snap points (hot pixels) * @param li */ void computeSnaps(const std::vector<SegmentString*>& segStrings, std::vector<geom::Coordinate>& snapPts); void computeSnaps(NodedSegmentString* ss, std::vector<geom::Coordinate>& snapPts); /** \brief * Performs a brute-force comparison of every segment in each * {@link SegmentString}. * This has n^2 performance. */ void computeVertexSnaps(NodedSegmentString* e0, NodedSegmentString* e1); // Declare type as noncopyable SimpleSnapRounder(const SimpleSnapRounder& other); SimpleSnapRounder& operator=(const SimpleSnapRounder& rhs); }; } // namespace geos::noding::snapround } // namespace geos::noding } // namespace geos //#ifdef GEOS_INLINE //# include "geos/noding/snapround/SimpleSnapRounder.inl" //#endif #endif // GEOS_NODING_SNAPROUND_SIMPLESNAPROUNDER_H /********************************************************************** * $Log$ * Revision 1.3 2006/05/03 15:02:49 strk * moved some implementations from header to .cpp file (taken out of inline) * * Revision 1.2 2006/03/24 09:52:41 strk * USE_INLINE => GEOS_INLINE * * Revision 1.1 2006/03/14 12:55:56 strk * Headers split: geomgraphindex.h, nodingSnapround.h * **********************************************************************/
/* ResidualVM - A 3D game interpreter * * ResidualVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ /* * This file is based on WME. * http://dead-code.org/redir.php?target=wme * Copyright (c) 2003-2013 Jan Nedoma and contributors */ #ifndef WINTERMUTE_MESH_X_H #define WINTERMUTE_MESH_X_H #include "engines/wintermute/base/base_named_object.h" #include "engines/wintermute/base/gfx/x/modelx.h" #include "engines/wintermute/coll_templ.h" #include "math/matrix4.h" #include "math/vector3d.h" namespace Wintermute { class BaseSprite; class FrameNode; class Material; class ModelX; class ShadowVolume; class VideoTheoraPlayer; class XFileLexer; struct SkinWeights { Common::String _boneName; Math::Matrix4 _offsetMatrix; BaseArray<uint32> _vertexIndices; BaseArray<float> _vertexWeights; }; class MeshX : public BaseNamedObject { public: MeshX(BaseGame *inGame); virtual ~MeshX(); virtual bool loadFromX(const Common::String &filename, XFileLexer &lexer, Common::Array<MaterialReference> &materialReferences); bool findBones(FrameNode *rootFrame); virtual bool update(FrameNode *parentFrame); virtual bool render(ModelX *model) = 0; virtual bool renderFlatShadowModel() = 0; bool updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth); bool pickPoly(Math::Vector3d *pickRayOrig, Math::Vector3d *pickRayDir); Math::Vector3d _BBoxStart; Math::Vector3d _BBoxEnd; bool setMaterialSprite(const Common::String &matName, BaseSprite *sprite); bool setMaterialTheora(const Common::String &matName, VideoTheoraPlayer *theora); bool invalidateDeviceObjects(); bool restoreDeviceObjects(); protected: static const int kVertexComponentCount = 8; static const int kPositionOffset = 5; static const int kTextureCoordOffset = 0; static const int kNormalOffset = 2; // anything which does not fit into 16 bits would we fine static const uint32 kNullIndex = 0xFFFFFFFF; bool parsePositionCoords(XFileLexer &lexer); bool parseFaces(XFileLexer &lexer, int faceCount, Common::Array<int> &indexCountPerFace); bool parseTextureCoords(XFileLexer &lexer); bool parseNormalCoords(XFileLexer &lexer); bool parseMaterials(XFileLexer &lexer, int faceCount, const Common::String &filename, Common::Array<MaterialReference> &materialReferences, const Common::Array<int> &indexCountPerFace); bool parseSkinWeights(XFileLexer &lexer); bool parseVertexDeclaration(XFileLexer &lexer); void updateBoundingBox(); bool generateAdjacency(); bool adjacentEdge(uint16 index1, uint16 index2, uint16 index3, uint16 index4); float *_vertexData; float *_vertexPositionData; float *_vertexNormalData; uint32 _vertexCount; Common::Array<uint16> _indexData; BaseArray<Math::Matrix4 *> _boneMatrices; BaseArray<SkinWeights> skinWeightsList; Common::Array<uint32> _adjacency; BaseArray<Material *> _materials; BaseArray<int> _indexRanges; BaseArray<int> _materialIndices; uint32 _numAttrs; // Wintermute3D used the ID3DXSKININFO interface // we will only store, whether this mesh is skinned at all // and factor out the necessary computations into some functions bool _skinnedMesh; }; } // namespace Wintermute #endif
/* * This file is part of the coreboot project. * * Copyright (C) 2014 Rockchip Electronics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * 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 <usb/usb.h> #include "generic_hub.h" #include "dwc2_private.h" #include "dwc2.h" static int dwc2_rh_port_status_changed(usbdev_t *const dev, const int port) { hprt_t hprt; int changed; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); changed = hprt.prtconndet; /* Clear connect detect flag */ if (changed) { hprt.d32 &= HPRT_W1C_MASK; hprt.prtconndet = 1; writel(hprt.d32, dwc2->hprt0); } return changed; } static int dwc2_rh_port_connected(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); return hprt.prtconnsts; } static int dwc2_rh_port_in_reset(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); return hprt.prtrst; } static int dwc2_rh_port_enabled(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); return hprt.prtena; } static usb_speed dwc2_rh_port_speed(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); if (hprt.prtena) { switch (hprt.prtspd) { case PRTSPD_HIGH: return HIGH_SPEED; case PRTSPD_FULL: return FULL_SPEED; case PRTSPD_LOW: return LOW_SPEED; } } return -1; } static int dwc2_rh_reset_port(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); hprt.d32 &= HPRT_W1C_MASK; hprt.prtrst = 1; writel(hprt.d32, dwc2->hprt0); /* Wait a bit while reset is active. */ mdelay(50); /* Deassert reset. */ hprt.prtrst = 0; writel(hprt.d32, dwc2->hprt0); /* * If reset and speed enum success the DWC2 core will set enable bit * after port reset bit is deasserted */ mdelay(1); hprt.d32 = readl(dwc2->hprt0); usb_debug("%s reset port ok, hprt = 0x%08x\n", __func__, hprt.d32); if (!hprt.prtena) { usb_debug("%s enable port fail! hprt = 0x%08x\n", __func__, hprt.d32); return -1; } return 0; } static int dwc2_rh_enable_port(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); /* Power on the port */ hprt.d32 = readl(dwc2->hprt0); hprt.d32 &= HPRT_W1C_MASK; hprt.prtpwr = 1; writel(hprt.d32, dwc2->hprt0); return 0; } static int dwc2_rh_disable_port(usbdev_t *const dev, const int port) { hprt_t hprt; dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); hprt.d32 = readl(dwc2->hprt0); hprt.d32 &= HPRT_W1C_MASK; /* Disable the port*/ hprt.prtena = 1; /* Power off the port */ hprt.prtpwr = 0; writel(hprt.d32, dwc2->hprt0); return 0; } static const generic_hub_ops_t dwc2_rh_ops = { .hub_status_changed = NULL, .port_status_changed = dwc2_rh_port_status_changed, .port_connected = dwc2_rh_port_connected, .port_in_reset = dwc2_rh_port_in_reset, .port_enabled = dwc2_rh_port_enabled, .port_speed = dwc2_rh_port_speed, .enable_port = dwc2_rh_enable_port, .disable_port = dwc2_rh_disable_port, .start_port_reset = NULL, .reset_port = dwc2_rh_reset_port, }; void dwc2_rh_init(usbdev_t *dev) { dwc_ctrl_t *const dwc2 = DWC2_INST(dev->controller); /* we can set them here because a root hub _really_ shouldn't appear elsewhere */ dev->address = 0; dev->hub = -1; dev->port = -1; generic_hub_init(dev, 1, &dwc2_rh_ops); usb_debug("dwc2_rh_init HPRT 0x%08x p = %p\n ", readl(dwc2->hprt0), dwc2->hprt0); usb_debug("DWC2: root hub init done\n"); }
/* Copyright ยฉ 2014-2015 by The qTox Project This file is part of qTox, a Qt-based graphical interface for Tox. qTox is libre 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. qTox 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 qTox. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ADDFRIENDFORM_H #define ADDFRIENDFORM_H #include <QVBoxLayout> #include <QLabel> #include <QLineEdit> #include <QTextEdit> #include <QPushButton> class ContentLayout; class AddFriendForm : public QObject { Q_OBJECT public: AddFriendForm(); AddFriendForm(const AddFriendForm&) = delete; AddFriendForm& operator=(const AddFriendForm&) = delete; ~AddFriendForm(); bool isShown() const; void show(ContentLayout* contentLayout); QString getMessage() const; signals: void friendRequested(const QString& friendAddress, const QString& message); public slots: void onUsernameSet(const QString& userName); private slots: void onSendTriggered(); void onIdChanged(const QString &id); private: void retranslateUi(); private: void setIdFromClipboard(); QLabel headLabel, toxIdLabel, messageLabel; QPushButton sendButton; QLineEdit toxId; QTextEdit message; QVBoxLayout layout, headLayout; QWidget *head, *main; QString lastUsername; // Cached username so we can retranslate the invite message }; #endif // ADDFRIENDFORM_H
/*- * Copyright (c) 2004, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ /* * Application-level ASN.1 callbacks. */ #ifndef ASN_APPLICATION_H #define ASN_APPLICATION_H #include "asn_system.h" /* for platform-dependent types */ #include "asn_codecs.h" /* for ASN.1 codecs specifics */ #ifdef __cplusplus extern "C" { #endif /* * Generic type of an application-defined callback to return various * types of data to the application. * EXPECTED RETURN VALUES: * -1: Failed to consume bytes. Abort the mission. * Non-negative return values indicate success, and ignored. */ typedef int (asn_app_consume_bytes_f)(const void *buffer, size_t size, void *application_specific_key); /* * A callback of this type is called whenever constraint validation fails * on some ASN.1 type. See "constraints.h" for more details on constraint * validation. * This callback specifies a descriptor of the ASN.1 type which failed * the constraint check, as well as human readable message on what * particular constraint has failed. */ typedef void (asn_app_constraint_failed_f)(void *application_specific_key, struct asn_TYPE_descriptor_s *type_descriptor_which_failed, const void *structure_which_failed_ptr, const char *error_message_format, ...) GCC_PRINTFLIKE(4, 5); #ifdef __cplusplus } #endif #include "constr_TYPE.h" /* for asn_TYPE_descriptor_t */ #endif /* ASN_APPLICATION_H */
// Licensed to Pioneers in Engineering under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Pioneers in Engineering 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 NGL_MODULE_H_ #define NGL_MODULE_H_ #include <ngl_alloc.h> ngl_error *ngl_module_init(ngl_module *mod); ngl_module *ngl_module_new(); #endif // NGL_MODULE_H_
//---------------------------------------------------------- -*- Mode: C++ -*- // $Id$ // // Created 2006/03/23 // // Copyright 2008 Quantcast Corp. // Copyright 2006-2008 Kosmix Corp. // // This file is part of Kosmos File System (KFS). // // 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. // // //---------------------------------------------------------------------------- #ifndef _LIBIO_DISKCONNECTION_H #define _LIBIO_DISKCONNECTION_H #include <sys/types.h> #include <aio.h> #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> #include <deque> namespace KFS { // forward declaration class DiskManager; class DiskConnection; /// /// \typedef DiskConnectionPtr /// DiskConnection is encapsulated in a smart pointer, so that when the /// last reference is released, appropriate cleanup occurs. /// typedef boost::shared_ptr<DiskConnection> DiskConnectionPtr; } #include "FileHandle.h" #include "KfsCallbackObj.h" #include "IOBuffer.h" #include "DiskEvent.h" namespace KFS { /// /// \file DiskConnection.h /// \brief A disk connection is modeled after a network connection on /// which I/O can be done. /// /// A disk connection is owned by a KfsCallbackObj. Whenever the /// KfsCallbackObj needs to do disk I/O, it schedules the operation on /// the disk connection. The disk connection uses the disk manager /// (@see DiskManager) to schedule the I/O. The disk manager calls /// the connection back when the operation completes. The disk /// connection in turn calls back the KfsCallbackObj with the result. /// /// /// To allow pipelining of disk IO operations, particularly READ /// requests---where a client can break-down the read requests into /// multiple requests so that we can overlap disk/network /// transfer---have a structure that tracks the status of individual /// IO requests. A DiskConnection keeps a queue of such outstanding /// requests. /// struct DiskIORequest { DiskIORequest() : op(OP_NONE), offset(0), numBytes(0) { } DiskIORequest(DiskEventOp_t o, off_t f, size_t n) : op(o), offset(f), numBytes(n) { } DiskEventOp_t op; /// what is this request about off_t offset; /// offset from the chunk at which I/O should /// be done size_t numBytes; /// # of bytes in this request std::list<DiskEventPtr> diskEvents; /// disk events associated with /// this request. bool operator == (DiskIORequest &other) const { return ((offset == other.offset) && (numBytes == other.numBytes)); } }; /// /// Disk Connection encapsulates an fd and some disk IO requests. On /// a given disk connection, you can do either a READ or a WRITE, but not /// both. /// class DiskConnection : public boost::enable_shared_from_this<DiskConnection> { public: DiskConnection(FileHandlePtr &handle, KfsCallbackObj *callbackObj); ~DiskConnection(); /// Close the connection. This will cause the events scheduled on /// this connection to be cancelled. void Close(); FileHandlePtr &GetFileHandle() { return mHandle; } /// Schedule a read on this connection at the specified offset for numBytes. /// @param[in] numBytes # of bytes that need to be read. /// @param[in] offset offset in the file at which to start reading data from. /// @retval # of bytes for which read was successfully scheduled; /// -1 if there was an error. ssize_t Read(off_t offset, size_t numBytes); /// Completion handler for a read. int ReadDone(DiskEventPtr &doneEvent, int res); /// Schedule a write on this connection. /// @param[in] numBytes # of bytes that need to be written /// @param[in] offset offset in the file at which to start writing data. /// @param[in] buf IOBuffer which contains data that should be written /// out to disk. /// @retval # of bytes for which write was successfully scheduled; /// -1 if there was an error. ssize_t Write(off_t offset, size_t numBytes, IOBuffer *buf); /// Completion handler for a write. int WriteDone(DiskEventPtr &doneEvent, int res); /// Sync the previously written data to disk. /// @param[in] notifyDone if set, notify upstream objects that the /// sync operation has finished. int Sync(bool notifyDone); /// Completion handler for a sync. int SyncDone(DiskEventPtr &doneEvent, int res); /// Completion handler for a disk event. /// @param doneEvent Disk event that completed /// @param res Result of the event that completed /// int HandleDone(DiskEventPtr &doneEvent, int res) { if (doneEvent->op == OP_READ) return ReadDone(doneEvent, res); else if (doneEvent->op == OP_WRITE) return WriteDone(doneEvent, res); else return SyncDone(doneEvent, res); } // XXX: Need a way to build backpressure: if there are too many // I/O's outstanding, then throttle back... private: /// Owning KfsCallbackObj. KfsCallbackObj *mCallbackObj; FileHandlePtr mHandle; /// Queue of disk IO requests that have been scheduled on this /// connection. Whenever the I/O on the head of the queue is complete, the /// associated KfsCallbackObj is notified. std::deque<DiskIORequest> mDiskIO; }; } #endif // _LIBIO_DISKCONNECTION_H
/* * Copyright (C) 2018 Shanghai Eastsoft Microelectronics Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2019-03-22 wangyq the first version */ #ifndef DRV_RTC_H__ #define DRV_RTC_H__ int rt_hw_rtc_init(void); #endif
#include "kernel.h" /* * n >= 0 */ void itoa(char *s,int n, int max_length){ if (n == 0){ s[0] = '0'; s[1] = '\0'; } int pos = 0; int m = n; while(m != 0){ ++ pos; m /= 10; } if(pos >= max_length){ s[0] = '\0'; return; } s[pos] = '\0'; --pos; while( n != 0){ s[pos--] = '0' + ( n % 10); n /= 10; } return; } void char2hex(char *s,char c, int max_length){ s[0] = '0' + (int) ((c & 0xf0) >> 4 ); s[1] = '0' + (int) (c & 0x0f); if(s[0] > 57) s[0] += 7; if(s[1] > 57) s[1] += 7; s[2] = '\0'; return; }
// // NSAttributedString+HTML.h // CoreTextExtensions // // Created by Oliver Drobnik on 1/9/11. // Copyright 2011 Drobnik.com. All rights reserved. // @class NSAttributedString; @interface NSAttributedString (HTML) - (id)initWithHTML:(NSData *)data documentAttributes:(NSDictionary **)dict; - (id)initWithHTML:(NSData *)data baseURL:(NSURL *)base documentAttributes:(NSDictionary **)dict; - (id)initWithHTML:(NSData *)data options:(NSDictionary *)options documentAttributes:(NSDictionary **)dict; @end
/* Return codes: 1 - ok, 0 - ignore, other - error. */ static int arch_get_scno(struct tcb *tcp) { tcp->scno = metag_regs.dx[0][1]; /* syscall number in D1Re0 (D1.0) */ return 1; }
// Copyright 2013 Intel Corporation. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef OZONE_WAYLAND_SHELL_SHELL_SURFACE_H_ #define OZONE_WAYLAND_SHELL_SHELL_SURFACE_H_ #include <wayland-client.h> #include "base/basictypes.h" #include "ozone/wayland/window.h" namespace ozonewayland { class WaylandWindow; class WaylandShellSurface { public: WaylandShellSurface(); virtual ~WaylandShellSurface(); struct wl_surface* GetWLSurface() const; // The implementation should initialize the shell and set up all // necessary callbacks. virtual void InitializeShellSurface(WaylandWindow* window) = 0; virtual void UpdateShellSurface(WaylandWindow::ShellType type, WaylandShellSurface* shell_parent, unsigned x, unsigned y) = 0; virtual void SetWindowTitle(const base::string16& title) = 0; virtual void Maximize() = 0; virtual void Minimize() = 0; // static functions. static void PopupDone(); static void WindowResized(void *data, unsigned width, unsigned height); protected: void FlushDisplay() const; private: struct wl_surface* surface_; DISALLOW_COPY_AND_ASSIGN(WaylandShellSurface); }; } // namespace ozonewayland #endif // OZONE_WAYLAND_SHELL_SHELL_SURFACE_H_
// Copyright 2014 The Crashpad Authors. All rights reserved. // // 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. #ifndef CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ #define CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_ #include <mach/mach.h> namespace crashpad { //! \brief `MACH_PORT_NULL` with the correct type for a Mach port, //! `mach_port_t`. //! //! For situations where implicit conversions between signed and unsigned types //! are not performed, use kMachPortNull instead of an explicit `implicit_cast` //! of `MACH_PORT_NULL` to `mach_port_t`. This is useful for logging and testing //! assertions. constexpr mach_port_t kMachPortNull = MACH_PORT_NULL; //! \brief `MACH_EXCEPTION_CODES` with the correct type for a Mach exception //! behavior, `exception_behavior_t`. //! //! Signedness problems can occur when ORing `MACH_EXCEPTION_CODES` as a signed //! integer, because a signed integer overflow results. This constant can be //! used instead of `MACH_EXCEPTION_CODES` in such cases. constexpr exception_behavior_t kMachExceptionCodes = MACH_EXCEPTION_CODES; // Because exception_mask_t is an int and has one bit for each defined // exception_type_t, itโ€™s reasonable to assume that there cannot be any // officially-defined exception_type_t values higher than 31. // kMachExceptionSimulated uses a value well outside this range because it does // not require a corresponding mask value. Simulated exceptions are delivered to // the exception handler registered for EXC_CRASH exceptions using // EXC_MASK_CRASH. //! \brief An exception type to use for simulated exceptions. constexpr exception_type_t kMachExceptionSimulated = 'CPsx'; //! \brief A const version of `thread_state_t`. //! //! This is useful as the \a old_state parameter to exception handler functions. //! Normally, these parameters are of type `thread_state_t`, but this allows //! modification of the state, which is conceptually `const`. using ConstThreadState = const natural_t*; //! \brief Like `mach_thread_self()`, but without the obligation to release the //! send right. //! //! `mach_thread_self()` returns a send right to the current thread port, //! incrementing its reference count. This burdens the caller with maintaining //! this send right, and calling `mach_port_deallocate()` when it is no longer //! needed. This is burdensome, and is at odds with the normal operation of //! `mach_task_self()`, which does not increment the task portโ€™s reference count //! whose result must not be deallocated. //! //! Callers can use this function in preference to `mach_thread_self()`. This //! function returns an extant reference to the current threadโ€™s port without //! incrementing its reference count. //! //! \return The value of `mach_thread_self()` without incrementing its reference //! count. The returned port must not be deallocated by //! `mach_port_deallocate()`. The returned value is valid as long as the //! thread continues to exist as a `pthread_t`. thread_t MachThreadSelf(); //! \brief Creates a new Mach port in the current task. //! //! This function wraps the `mach_port_allocate()` providing a simpler //! interface. //! //! \param[in] right The type of right to create. //! //! \return The new Mach port. On failure, `MACH_PORT_NULL` with a message //! logged. mach_port_t NewMachPort(mach_port_right_t right); //! \brief The value for `EXC_MASK_ALL` appropriate for the operating system at //! run time. //! //! The SDKโ€™s definition of `EXC_MASK_ALL` has changed over time, with later //! versions containing more bits set than earlier versions. However, older //! kernels will reject exception masks that contain bits set that they donโ€™t //! recognize. Calling this function will return a value for `EXC_MASK_ALL` //! appropriate for the system at run time. //! //! \note `EXC_MASK_ALL` does not include the value of `EXC_MASK_CRASH` or //! `EXC_MASK_CORPSE_NOTIFY`. Consumers that want `EXC_MASK_ALL` along with //! `EXC_MASK_CRASH` may use ExcMaskAll() `| EXC_MASK_CRASH`. Consumers may //! use ExcMaskValid() for `EXC_MASK_ALL` along with `EXC_MASK_CRASH`, //! `EXC_MASK_CORPSE_NOTIFY`, and any values that come into existence in the //! future. exception_mask_t ExcMaskAll(); //! \brief An exception mask containing every possible exception understood by //! the operating system at run time. //! //! `EXC_MASK_ALL`, and thus ExcMaskAll(), never includes the value of //! `EXC_MASK_CRASH` or `EXC_MASK_CORPSE_NOTIFY`. For situations where an //! exception mask corresponding to every possible exception understood by the //! running kernel is desired, use this function instead. //! //! Should new exception types be introduced in the future, this function will //! be updated to include their bits in the returned mask value when run time //! support is present. exception_mask_t ExcMaskValid(); } // namespace crashpad #endif // CRASHPAD_UTIL_MACH_MACH_EXTENSIONS_H_
/* * Copyright (C) 2011-2014 MediaTek 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. * * 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/>. */ #ifndef _KD_CAMERA_FEATURE_ID_H_ #define _KD_CAMERA_FEATURE_ID_H_ #define ENUM_MISC_FIDS_SI(fids...)\ FID_PRE_BEGIN_MISC_SI = FID_PRE_BEGIN_SI, \ fids \ FID_OVER_LAST_MISC_SI #define ENUM_RAW_ONLY_FIDS_SI(fids...)\ FID_PRE_BEGIN_RAW_ONLY_SI = FID_OVER_LAST_MISC_SI - 1, \ fids \ FID_OVER_LAST_RAW_ONLY_SI #define ENUM_RAW_YUV_SHARED_FIDS_SI(fids...)\ FID_PRE_BEGIN_RAW_YUV_SI = FID_OVER_LAST_RAW_ONLY_SI - 1, \ fids \ FID_OVER_LAST_RAW_YUV_SI #define ENUM_YUV_ONLY_FIDS_SI(fids...)\ FID_PRE_BEGIN_YUV_ONLY_SI = FID_OVER_LAST_RAW_YUV_SI - 1, \ fids \ FID_OVER_LAST_YUV_ONLY_SI #define ENUM_MISC_FIDS_SD(fids...)\ FID_PRE_BEGIN_MISC_SD = FID_PRE_BEGIN_SD, \ fids \ FID_OVER_LAST_MISC_SD #define ENUM_RAW_ONLY_SD(fids...)\ FID_PRE_BEGIN_RAW_ONLY_SD = FID_OVER_LAST_MISC_SD - 1, \ fids \ FID_OVER_LAST_RAW_ONLY_SD #define ENUM_RAW_YUV_SHARED_FIDS_SD(fids...)\ FID_PRE_BEGIN_RAW_YUV_SD = FID_OVER_LAST_RAW_ONLY_SD - 1, \ fids \ FID_OVER_LAST_RAW_YUV_SD #define ENUM_YUV_ONLY_SD(fids...)\ FID_PRE_BEGIN_YUV_ONLY_SD = FID_OVER_LAST_RAW_YUV_SD - 1, \ fids \ FID_OVER_LAST_YUV_ONLY_SD //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Definition of Feature ID. // ps: FID = 0 is reserved. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ typedef enum { FID_PRE_BEGIN = 0, ////////////////////////////////////////////////////////////////////////////// // Scene-Independent (SI) feature id. FID_PRE_BEGIN_SI = FID_PRE_BEGIN, //---------------------------------------------------------------------------- //Misc. feature id. ENUM_MISC_FIDS_SI ( FID_ZOOM_FACTOR, // Legacy symbol (Remove if possible) FID_AE_STROBE, FID_EIS, FID_ZSD, FID_AWB2PASS, FID_AF_LAMP, FID_FAST_CONTINUOUS_SHOT, ), //RAW-only feature id. ENUM_RAW_ONLY_FIDS_SI ( ), //RAW-YUV-shared feature id. ENUM_RAW_YUV_SHARED_FIDS_SI ( FID_SCENE_MODE, FID_COLOR_EFFECT, FID_CAPTURE_MODE, FID_CAP_SIZE, FID_PREVIEW_SIZE, FID_VIDEO_PREVIEW_SIZE, FID_FRAME_RATE, FID_FRAME_RATE_RANGE, FID_AE_FLICKER, FID_FOCUS_DIST_NORMAL, FID_FOCUS_DIST_MACRO, FID_STEREO_3D_CAP_SIZE, FID_STEREO_3D_PREVIEW_SIZE, FID_STEREO_3D_TYPE, FID_STEREO_3D_MODE, FID_STEREO_3D_IMAGE_FORMAT, ), //YUV-only feature id. ENUM_YUV_ONLY_FIDS_SI ( ), //---------------------------------------------------------------------------- FID_OVER_LAST_SI = FID_OVER_LAST_YUV_ONLY_SI, ////////////////////////////////////////////////////////////////////////////// // Scene-Dependent (SD) feature id. FID_PRE_BEGIN_SD = FID_OVER_LAST_SI - 1, //---------------------------------------------------------------------------- //Misc. feature id. ENUM_MISC_FIDS_SD ( FID_FD_ON_OFF, ), //RAW-only feature id. ENUM_RAW_ONLY_SD ( ), //RAW-YUV-shared feature id. ENUM_RAW_YUV_SHARED_FIDS_SD ( FID_AE_SCENE_MODE, FID_AE_METERING, FID_AE_ISO, FID_AE_EV, FID_AF_MODE, FID_AF_METERING, FID_AWB_MODE, FID_ISP_EDGE, FID_ISP_HUE, FID_ISP_SAT, FID_ISP_BRIGHT, FID_ISP_CONTRAST, ), //YUV-only feature id. ENUM_YUV_ONLY_SD ( FID_YUV_AUTOTEST, ), //---------------------------------------------------------------------------- FID_OVER_LAST_SD = FID_OVER_LAST_YUV_ONLY_SD, ////////////////////////////////////////////////////////////////////////////// FID_OVER_LAST = FID_OVER_LAST_SD, //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } FEATURE_ID; #endif //_KD_CAMERA_FEATURE_ID_H_
/*- * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * a) Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * b) 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. * * c) Neither the name of Cisco Systems, Inc. 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. */ #ifdef __FreeBSD__ #include <sys/cdefs.h> __FBSDID("$FreeBSD: head/sys/netinet/sctp_input.h 240198 2012-09-07 13:36:42Z tuexen $"); #endif #ifndef _NETINET_SCTP_INPUT_H_ #define _NETINET_SCTP_INPUT_H_ #if defined(_KERNEL) || defined(__Userspace__) void sctp_common_input_processing(struct mbuf **, int, int, int, struct sockaddr *, struct sockaddr *, struct sctphdr *, struct sctp_chunkhdr *, #if !defined(SCTP_WITH_NO_CSUM) uint8_t, #endif uint8_t, #if defined(__FreeBSD__) uint8_t, uint32_t, #endif uint32_t, uint16_t); struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk); void sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list); int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked); #endif #endif
#ifndef __OpenViBE_AcquisitionServer_CConfigurationEmotivEPOC_H__ #define __OpenViBE_AcquisitionServer_CConfigurationEmotivEPOC_H__ #if defined TARGET_HAS_ThirdPartyEmotivAPI #include "../ovasCConfigurationBuilder.h" #include "../ovasIDriver.h" #include "../ovasCHeader.h" #include <gtk/gtk.h> #include <windows.h> namespace OpenViBEAcquisitionServer { /** * \class CConfigurationEmotivEPOC * \author Laurent Bonnet (INRIA) * \date 21 july 2010 * \erief The CConfigurationEmotivEPOC handles the configuration dialog specific to the Emotiv EPOC headset. * * \sa CDriverEmotivEPOC */ class CConfigurationEmotivEPOC : public OpenViBEAcquisitionServer::CConfigurationBuilder { public: CConfigurationEmotivEPOC(OpenViBEAcquisitionServer::IDriverContext& rDriverContext, const char* sGtkBuilderFileName, OpenViBE::boolean& rUseGyroscope,OpenViBE::CString& rPathToEmotivResearchSDK, OpenViBE::uint32& rUserID); virtual OpenViBE::boolean preConfigure(void); virtual OpenViBE::boolean postConfigure(void); protected: OpenViBEAcquisitionServer::IDriverContext& m_rDriverContext; OpenViBE::boolean& m_rUseGyroscope; OpenViBE::CString& m_rPathToEmotivResearchSDK; OpenViBE::uint32& m_rUserID; }; }; #endif // TARGET_HAS_ThirdPartyEmotivAPI #endif // __OpenViBE_AcquisitionServer_CConfigurationEmotivEPOC_H__
// @(#)root/mathcore:$Id$ // Authors: W. Brown, M. Fischler, L. Moneta 2005 /********************************************************************** * * * Copyright (c) 2005 , LCG ROOT MathLib Team * * * * * **********************************************************************/ // Header file Point2Dfwd // // Created by: Lorenzo Moneta at Mon Apr 16 2007 // #ifndef ROOT_Math_Point2Dfwd #define ROOT_Math_Point2Dfwd 1 // forward declareations of position vectors (Points) and type defs definitions namespace ROOT { namespace Math { template<class CoordSystem, class Tag> class PositionVector2D; template<typename T> class Cartesian2D; template<typename T> class Polar2D; class DefaultCoordinateSystemTag; /** 2D Point based on the cartesian coordinates x,y,z in double precision */ typedef PositionVector2D< Cartesian2D<double>, DefaultCoordinateSystemTag > XYPoint; typedef XYPoint XYPointD; /** 2D Point based on the cartesian corrdinates x,y,z in single precision */ typedef PositionVector2D< Cartesian2D<float>, DefaultCoordinateSystemTag > XYPointF; /** 2D Point based on the polar coordinates rho, theta, phi in double precision. */ typedef PositionVector2D< Polar2D<double>, DefaultCoordinateSystemTag > Polar2DPoint; typedef Polar2DPoint Polar2DPointD; /** 2D Point based on the polar coordinates rho, theta, phi in single precision. */ typedef PositionVector2D< Polar2D<float>, DefaultCoordinateSystemTag > Polar2DPointF; } // end namespace Math } // end namespace ROOT #endif /* ROOT_Math_Point2Dfwd */
/* * Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de> * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup cpu_lpc2387 * @{ * * @file * @brief CPU specific definitions for internal peripheral handling * * @author Kaspar Schleiser <kaspar@schleiser.de> */ #ifndef PERIPH_CPU_H #define PERIPH_CPU_H #include "cpu.h" #include "periph/dev_enums.h" #ifdef __cplusplus extern "C" { #endif #include <stdint.h> #include "cpu.h" /** * @brief LPC2387 MCU defines * @{ */ #define __IO volatile /** * @brief Fast GPIO register definition struct */ typedef struct { /** @brief Direction: Output if corresponding bit is set, otherwise input */ __IO uint32_t DIR; /** @brief 12 bytes of reseved memory we don't need to access */ uint32_t _reserved[3]; /** @brief Set bits to ignore corresponding bits when accessing `PIN`, `SET` * or `CLR` register of this port */ __IO uint32_t MASK; /** @brief The current state of each pin of this port is accessible here * (regardless of direction): If bit is set input is high */ __IO uint32_t PIN; /** @brief Output pins are set to high by setting the corresponding bit */ __IO uint32_t SET; /** @brief Output pins are set to low by setting the corresponding bit */ __IO uint32_t CLR; } FIO_PORT_t; #define FIO_PORTS ((FIO_PORT_t*)FIO_BASE_ADDR) #define PINSEL ((__IO uint32_t *)(PINSEL_BASE_ADDR)) #define PINMODE ((__IO uint32_t *)(PINSEL_BASE_ADDR + 0x40)) int gpio_init_mux(unsigned pin, unsigned mux); void gpio_init_states(void); #define GPIO_PIN(port, pin) (port<<5 | pin) #ifndef DOXYGEN #define HAVE_GPIO_FLANK_T typedef enum { GPIO_FALLING = 1, /**< emit interrupt on falling flank */ GPIO_RISING = 2, /**< emit interrupt on rising flank */ GPIO_BOTH = 3 /**< emit interrupt on both flanks */ } gpio_flank_t; #endif /* ndef DOXYGEN */ /** * @brief Number of available timer channels */ #define TIMER_CHAN_NUMOF (4U) /** * @brief Declare needed generic SPI functions * @{ */ #define PERIPH_SPI_NEEDS_INIT_CS #define PERIPH_SPI_NEEDS_TRANSFER_BYTE #define PERIPH_SPI_NEEDS_TRANSFER_REG #define PERIPH_SPI_NEEDS_TRANSFER_REGS /* @} */ /** * @brief Override SPI clock speed values * @{ */ #define HAVE_SPI_CLK_T typedef enum { SPI_CLK_100KHZ = 100, /**< drive the SPI bus with 100KHz */ SPI_CLK_400KHZ = 400, /**< drive the SPI bus with 400KHz */ SPI_CLK_1MHZ = 1000, /**< drive the SPI bus with 1MHz */ SPI_CLK_5MHZ = 5000, /**< drive the SPI bus with 5MHz */ SPI_CLK_10MHZ = 10000 /**< drive the SPI bus with 10MHz */ } spi_clk_t; /** @} */ /* @} */ #ifdef __cplusplus } #endif #endif /* PERIPH_CPU_H */ /** @} */
/*************************************************************************** * Copyright (c) Jรผrgen Riegel (juergen.riegel@web.de) 2002 * * * * This file is part of the FreeCAD CAx development system. * * * * 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., 59 Temple Place, * * Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************/ #ifndef APP_PROPERTY_H #define APP_PROPERTY_H // Std. configurations #include <Base/Persistence.h> #include <string> #include <bitset> namespace App { class PropertyContainer; /** Base class of all properties * This is the father of all properties. Properties are objects which are used * in the document tree to parametrize e.g. features and their graphical output. * They are also used to gain access from the scripting facility. * /par * This abstract base class defines all methods shared by all * possible properties. It is also possible to define user properties * and use them in the framework... */ class AppExport Property : public Base::Persistence { TYPESYSTEM_HEADER(); public: Property(); virtual ~Property(); /** This method is used to get the size of objects * It is not meant to have the exact size, it is more or less an estimation * which runs fast! Is it two bytes or a GB? * This method is defined in Base::Persistence * @see Base::Persistence */ virtual unsigned int getMemSize (void) const { // you have to implement this method in all property classes! return sizeof(father) + sizeof(StatusBits); } /// get the name of this property in the belonging container const char* getName(void) const; /// Get the class name of the associated property editor item virtual const char* getEditorName(void) const { return ""; } /// Get the type of the property in the container short getType(void) const; /// Get the group of this property const char* getGroup(void) const; /// Get the documentation of this property const char* getDocumentation(void) const; /// Is called by the framework to set the father (container) void setContainer(PropertyContainer *Father); /// Get a pointer to the PropertyContainer derived class the property belongs to PropertyContainer *getContainer(void) const {return father;} /// Set the property touched void touch(); /// Test if this property is touched bool isTouched(void) const {return StatusBits.test(0);} /// Reset this property touched void purgeTouched(void){StatusBits.reset(0);} /// Returns a new copy of the property (mainly for Undo/Redo and transactions) virtual Property *Copy(void) const = 0; /// Paste the value from the property (mainly for Undo/Redo and transactions) virtual void Paste(const Property &from) = 0; /// Encodes an attribute upon saving. static std::string encodeAttribute(const std::string&); friend class PropertyContainer; /** Status bits of the property * The first 8 bits are used for the base system the rest can be used in * descendent classes to to mark special stati on the objects. * The bits and their meaning are listed below: * 0 - object is marked as 'touched' * 1 - object is marked as 'immutable' * 2 - object is marked as 'read-ony' (for property editor) * 3 - object is marked as 'hidden' (for property editor) */ std::bitset<32> StatusBits; protected: /// Gets called by all setValue() methods after the value has changed void hasSetValue(void); /// Gets called by all setValue() methods before the value has changed void aboutToSetValue(void); private: // forbidden Property(const Property&); Property& operator = (const Property&); private: PropertyContainer *father; }; /** Base class of all property lists. * The PropertyLists class is the base class for properties which can contain * multiple values, not only a single value. * All property types which may contain more than one value inherits this class. */ class AppExport PropertyLists : public Property { TYPESYSTEM_HEADER(); public: virtual void setSize(int newSize)=0; virtual int getSize(void) const =0; }; } // namespace App #endif // APP_PROPERTY_H
/*========================================================================= Program: Visualization Toolkit Module: vtkDefaultPass.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkDefaultPass - Implement the basic render passes. // .SECTION Description // vtkDefaultPass implements the basic standard render passes of VTK. // Subclasses can easily be implemented by reusing some parts of the basic // implementation. // // It implements classic Render operations as well as versions with property // key checking. // // This pass expects an initialized depth buffer and color buffer. // Initialized buffers means they have been cleared with farest z-value and // background color/gradient/transparent color. // // .SECTION See Also // vtkRenderPass #ifndef vtkDefaultPass_h #define vtkDefaultPass_h #include "vtkRenderingOpenGLModule.h" // For export macro #include "vtkRenderPass.h" class vtkOpenGLRenderWindow; class vtkDefaultPassLayerList; // Pimpl class VTKRENDERINGOPENGL_EXPORT vtkDefaultPass : public vtkRenderPass { public: static vtkDefaultPass *New(); vtkTypeMacro(vtkDefaultPass,vtkRenderPass); void PrintSelf(ostream& os, vtkIndent indent); //BTX // Description: // Perform rendering according to a render state \p s. // Call RenderOpaqueGeometry(), RenderTranslucentPolygonalGeometry(), // RenderVolumetricGeometry(), RenderOverlay() // \pre s_exists: s!=0 virtual void Render(const vtkRenderState *s); //ETX protected: // Description: // Default constructor. vtkDefaultPass(); // Description: // Destructor. virtual ~vtkDefaultPass(); // Description: // Opaque pass without key checking. // \pre s_exists: s!=0 virtual void RenderOpaqueGeometry(const vtkRenderState *s); // Description: // Opaque pass with key checking. // \pre s_exists: s!=0 virtual void RenderFilteredOpaqueGeometry(const vtkRenderState *s); // Description: // Translucent pass without key checking. // \pre s_exists: s!=0 virtual void RenderTranslucentPolygonalGeometry(const vtkRenderState *s); // Description: // Translucent pass with key checking. // \pre s_exists: s!=0 virtual void RenderFilteredTranslucentPolygonalGeometry( const vtkRenderState *s); // Description: // Volume pass without key checking. // \pre s_exists: s!=0 virtual void RenderVolumetricGeometry(const vtkRenderState *s); // Description: // Translucent pass with key checking. // \pre s_exists: s!=0 virtual void RenderFilteredVolumetricGeometry(const vtkRenderState *s); // Description: // Overlay pass without key checking. // \pre s_exists: s!=0 virtual void RenderOverlay(const vtkRenderState *s); // Description: // Overlay pass with key checking. // \pre s_exists: s!=0 virtual void RenderFilteredOverlay(const vtkRenderState *s); private: vtkDefaultPass(const vtkDefaultPass&); // Not implemented. void operator=(const vtkDefaultPass&); // Not implemented. }; #endif
/* * Copyright (c) 2015 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 VPX_DSP_MIPS_TXFM_MACROS_MIPS_MSA_H_ #define VPX_DSP_MIPS_TXFM_MACROS_MIPS_MSA_H_ #include "vpx_dsp/mips/macros_msa.h" #define DOTP_CONST_PAIR(reg0, reg1, cnst0, cnst1, out0, out1) \ { \ v4i32 s0_m, s1_m, s2_m, s3_m, s4_m, s5_m; \ v8i16 k0_m, k1_m, k2_m, zero = { 0 }; \ \ k0_m = __msa_fill_h(cnst0); \ k1_m = __msa_fill_h(cnst1); \ k2_m = __msa_ilvev_h((v8i16)k1_m, k0_m); \ k0_m = __msa_ilvev_h((v8i16)zero, k0_m); \ k1_m = __msa_ilvev_h(k1_m, (v8i16)zero); \ \ ILVRL_H2_SW(reg1, reg0, s5_m, s4_m); \ ILVRL_H2_SW(reg0, reg1, s3_m, s2_m); \ DOTP_SH2_SW(s5_m, s4_m, k0_m, k0_m, s1_m, s0_m); \ s1_m = __msa_dpsub_s_w(s1_m, (v8i16)s5_m, k1_m); \ s0_m = __msa_dpsub_s_w(s0_m, (v8i16)s4_m, k1_m); \ SRARI_W2_SW(s1_m, s0_m, DCT_CONST_BITS); \ out0 = __msa_pckev_h((v8i16)s0_m, (v8i16)s1_m); \ \ DOTP_SH2_SW(s3_m, s2_m, k2_m, k2_m, s1_m, s0_m); \ SRARI_W2_SW(s1_m, s0_m, DCT_CONST_BITS); \ out1 = __msa_pckev_h((v8i16)s0_m, (v8i16)s1_m); \ } #define DOT_ADD_SUB_SRARI_PCK(in0, in1, in2, in3, in4, in5, in6, in7, dst0, \ dst1, dst2, dst3) \ { \ v4i32 tp0_m, tp1_m, tp2_m, tp3_m, tp4_m; \ v4i32 tp5_m, tp6_m, tp7_m, tp8_m, tp9_m; \ \ DOTP_SH4_SW(in0, in1, in0, in1, in4, in4, in5, in5, tp0_m, tp2_m, tp3_m, \ tp4_m); \ DOTP_SH4_SW(in2, in3, in2, in3, in6, in6, in7, in7, tp5_m, tp6_m, tp7_m, \ tp8_m); \ BUTTERFLY_4(tp0_m, tp3_m, tp7_m, tp5_m, tp1_m, tp9_m, tp7_m, tp5_m); \ BUTTERFLY_4(tp2_m, tp4_m, tp8_m, tp6_m, tp3_m, tp0_m, tp4_m, tp2_m); \ SRARI_W4_SW(tp1_m, tp9_m, tp7_m, tp5_m, DCT_CONST_BITS); \ SRARI_W4_SW(tp3_m, tp0_m, tp4_m, tp2_m, DCT_CONST_BITS); \ PCKEV_H4_SH(tp1_m, tp3_m, tp9_m, tp0_m, tp7_m, tp4_m, tp5_m, tp2_m, dst0, \ dst1, dst2, dst3); \ } #define DOT_SHIFT_RIGHT_PCK_H(in0, in1, in2) \ ({ \ v8i16 dst_m; \ v4i32 tp0_m, tp1_m; \ \ DOTP_SH2_SW(in0, in1, in2, in2, tp1_m, tp0_m); \ SRARI_W2_SW(tp1_m, tp0_m, DCT_CONST_BITS); \ dst_m = __msa_pckev_h((v8i16)tp1_m, (v8i16)tp0_m); \ \ dst_m; \ }) #define MADD_SHORT(m0, m1, c0, c1, res0, res1) \ { \ v4i32 madd0_m, madd1_m, madd2_m, madd3_m; \ v8i16 madd_s0_m, madd_s1_m; \ \ ILVRL_H2_SH(m1, m0, madd_s0_m, madd_s1_m); \ DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s0_m, madd_s1_m, c0, c0, c1, c1, \ madd0_m, madd1_m, madd2_m, madd3_m); \ SRARI_W4_SW(madd0_m, madd1_m, madd2_m, madd3_m, DCT_CONST_BITS); \ PCKEV_H2_SH(madd1_m, madd0_m, madd3_m, madd2_m, res0, res1); \ } #define MADD_BF(inp0, inp1, inp2, inp3, cst0, cst1, cst2, cst3, out0, out1, \ out2, out3) \ { \ v8i16 madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m; \ v4i32 tmp0_m, tmp1_m, tmp2_m, tmp3_m, m4_m, m5_m; \ \ ILVRL_H2_SH(inp1, inp0, madd_s0_m, madd_s1_m); \ ILVRL_H2_SH(inp3, inp2, madd_s2_m, madd_s3_m); \ DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m, cst0, cst0, cst2, \ cst2, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \ BUTTERFLY_4(tmp0_m, tmp1_m, tmp3_m, tmp2_m, m4_m, m5_m, tmp3_m, tmp2_m); \ SRARI_W4_SW(m4_m, m5_m, tmp2_m, tmp3_m, DCT_CONST_BITS); \ PCKEV_H2_SH(m5_m, m4_m, tmp3_m, tmp2_m, out0, out1); \ DOTP_SH4_SW(madd_s0_m, madd_s1_m, madd_s2_m, madd_s3_m, cst1, cst1, cst3, \ cst3, tmp0_m, tmp1_m, tmp2_m, tmp3_m); \ BUTTERFLY_4(tmp0_m, tmp1_m, tmp3_m, tmp2_m, m4_m, m5_m, tmp3_m, tmp2_m); \ SRARI_W4_SW(m4_m, m5_m, tmp2_m, tmp3_m, DCT_CONST_BITS); \ PCKEV_H2_SH(m5_m, m4_m, tmp3_m, tmp2_m, out2, out3); \ } #endif // VPX_DSP_MIPS_TXFM_MACROS_MIPS_MSA_H_
// Filename: dxfFile.h // Created by: drose (04May04) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef DXFFILE_H #define DXFFILE_H #include "pandatoolbase.h" #include "dxfLayer.h" #include "dxfLayerMap.h" #include "dxfVertex.h" #include "luse.h" #include "filename.h" static const int DXF_max_line = 256; static const int DXF_num_colors = 256; //////////////////////////////////////////////////////////////////// // Class : DXFFile // Description : A generic DXF-reading class. This class can read a // DXF file but doesn't actually do anything with the // data; it's intended to be inherited from and the // appropriate functions overridden (particularly // DoneEntity()). //////////////////////////////////////////////////////////////////// class DXFFile : public MemoryBase { public: DXFFile(); virtual ~DXFFile(); void process(Filename filename); void process(istream *in, bool owns_in); // These functions are called as the file is processed. These are // the main hooks for redefining how the class should dispense its // data. As each function is called, the state stored in the // DXFFile class reflects the data that was most recently read. virtual void begin_file(); virtual void begin_section(); virtual void done_vertex(); virtual void done_entity(); virtual void end_section(); virtual void end_file(); virtual void error(); // new_layer() is called whenever the DXFFile class encounters a new // Layer definition, and must allocate a DXFLayer instance. This // function is provided so that user code may force allocate of a // specialized DXFLayer instance instead. virtual DXFLayer *new_layer(const string &name) { return new DXFLayer(name); } enum State { ST_top, ST_section, ST_entity, ST_verts, ST_error, ST_done, }; enum Section { SE_unknown, SE_header, SE_tables, SE_blocks, SE_entities, SE_objects, }; enum Entity { EN_unknown, EN_3dface, EN_point, EN_insert, EN_vertex, EN_polyline, }; enum PolylineFlags { PF_closed = 0x01, PF_curve_fit = 0x02, PF_spline_fit = 0x04, PF_3d = 0x08, PF_3d_mesh = 0x10, PF_closed_n = 0x20, PF_polyface = 0x40, PF_continuous_linetype = 0x80, }; // This is a table of standard Autocad colors. DXF files can store // only a limited range of colors; specifically, the 255 colors // defined by Autocad. struct Color { double r, g, b; }; static Color _colors[DXF_num_colors]; // find_color() returns the index of the closest matching AutoCAD // color to the indicated r, g, b. static int find_color(double r, double g, double b); // get_color() returns the r,g,b of the current entity. It is valid // at the time done_entity() is called. const Color &get_color() const; // Some entities are defined in world coordinates, in 3-d space; // other entities are inherently 2-d in nature and are defined in // planar coordinates and must be converted to 3-d space. Call this // function from done_entity() to convert a 2-d entity to 3-d world // coordinates. void ocs_2_wcs(); // These members indicate the current state and describe properties // of the current thing being processed. They are valid at // done_entity(), and at other times. int _flags; Section _section; Entity _entity; LPoint3d _p, _q, _r, _s; LVector3d _z; int _color_index; DXFLayer *_layer; // _verts is the list of vertices associated with the current // entity. It is valid at the time done_entity() is called. DXFVertices _verts; // This is the set of layers encountered within the DXF file. DXFLayerMap _layers; protected: State _state; bool _vertices_follow; LMatrix4d _ocs2wcs; istream *_in; bool _owns_in; int _code; string _string; void compute_ocs(); bool get_group(); void change_state(State new_state); void change_section(Section new_section); void change_layer(const string &layer_name); void change_entity(Entity new_entity); void reset_entity(); void state_top(); void state_section(); void state_entity(); void state_verts(); }; ostream &operator << (ostream &out, const DXFFile::State &state); ostream &operator << (ostream &out, const DXFFile::Section &section); ostream &operator << (ostream &out, const DXFFile::Entity &entity); #endif
// // INKAction.h // InkCore // // Created by Liyan David Chang on 5/25/13. // Copyright (c) 2013 Ink. All rights reserved. // // A specific app-action pair to perform // #import <Foundation/Foundation.h> #import "INKBlob.h" #import "INKApp.h" @interface INKAction : NSObject <NSCopying> //Provided by the server, don't touch @property(nonatomic) NSString *uuid; //Name of the action @property(nonatomic) NSString *name; // Name of Action Type. Action types are categories of actions that can be performed by a number of different applications. They are specific to UTI. Ex: Sign, Annotate, Edit, Convert, Crop @property(nonatomic, strong) NSString *type; // List of supported UTI's for a given action, as UTType objects @property(nonatomic, strong) NSArray *supportedUTIs; //Parent app @property(nonatomic, strong) INKApp *app; + (id) actionWithUUID:(NSString *)uuid; + (id)action:(NSString *)name type:(NSString *)type __attribute__((deprecated("Use actionWithUUID instead. You can get the UUIDs for your actions from the developer portal. For older actions, don't be suprised that the UUID is the user displayed action name."))); + (id)action:(NSString *)name type:(NSString *)type app:(INKApp *)app __attribute__((deprecated("Use actionWithUUID instead. You can get the UUIDs for your actions from the developer portal. For older actions, don't be suprised that the UUID is the user displayed action name."))); - (BOOL) isReturnAction; - (BOOL) isErrorAction; @end
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: /Users/ex3ndr/Develop/actor-platform/actor-apps/core/src/main/java/im/actor/model/concurrency/Command.java // #ifndef _AMCommand_H_ #define _AMCommand_H_ #include "J2ObjC_header.h" @protocol AMCommandCallback; @protocol AMCommand < NSObject, JavaObject > - (void)startWithCallback:(id<AMCommandCallback>)callback; @end J2OBJC_EMPTY_STATIC_INIT(AMCommand) J2OBJC_TYPE_LITERAL_HEADER(AMCommand) #define ImActorModelConcurrencyCommand AMCommand #endif // _AMCommand_H_
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ #ifndef _RTL8188E_SRESET_H_ #define _RTL8188E_SRESET_H_ #include <drv_conf.h> #include <osdep_service.h> #include <drv_types.h> #include <rtw_sreset.h> #ifdef DBG_CONFIG_ERROR_DETECT extern void rtl8188e_silentreset_for_specific_platform(_adapter *padapter); extern void rtl8188e_sreset_xmit_status_check(_adapter *padapter); extern void rtl8188e_sreset_linked_status_check(_adapter *padapter); #endif #endif
/* * Copyright (c) 2014 Fujitsu Ltd. * Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU General Public License along * with this program. */ /* * DESCRIPTION * This test case will verify basic function of open(2) with the flags * O_APPEND, O_NOATIME, O_CLOEXEC and O_LARGEFILE. */ #define _GNU_SOURCE #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/mount.h> #include <unistd.h> #include <mntent.h> #include <errno.h> #include "test.h" #include "safe_macros.h" #include "lapi/fcntl.h" #include "lapi/mount.h" #define MNTPOINT "mntpoint" #define TEST_FILE MNTPOINT"/test_file" #define LARGE_FILE "large_file" #define DIR_MODE 0755 char *TCID = "open12"; static const char *device; static unsigned int mount_flag, skip_noatime; static void setup(void); static void cleanup(void); static void test_append(void); static void test_noatime(void); static void test_cloexec(void); static void test_largefile(void); static void (*test_func[])(void) = { test_append, test_noatime, test_cloexec, test_largefile }; int TST_TOTAL = ARRAY_SIZE(test_func); int main(int argc, char **argv) { int lc; int i; tst_parse_opts(argc, argv, NULL, NULL); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; for (i = 0; i < TST_TOTAL; i++) (*test_func[i])(); } cleanup(); tst_exit(); } static void setup(void) { const char *mount_flags[] = {"noatime", "relatime", NULL}; TEST_PAUSE; tst_sig(FORK, DEF_HANDLER, cleanup); tst_tmpdir(); SAFE_MKDIR(cleanup, MNTPOINT, DIR_MODE); if (tst_path_has_mnt_flags(cleanup, NULL, mount_flags)) { const char *fs_type; if ((tst_kvercmp(2, 6, 30)) < 0) { tst_resm(TCONF, "MS_STRICTATIME flags for mount(2) needs kernel 2.6.30 " "or higher"); skip_noatime = 1; return; } fs_type = tst_dev_fs_type(); device = tst_acquire_device(cleanup); if (!device) { tst_resm(TINFO, "Failed to obtain block device"); skip_noatime = 1; goto end; } tst_mkfs(cleanup, device, fs_type, NULL); SAFE_MOUNT(cleanup, device, MNTPOINT, fs_type, MS_STRICTATIME, NULL); mount_flag = 1; } end: SAFE_FILE_PRINTF(cleanup, TEST_FILE, TEST_FILE); } static void test_append(void) { off_t len1, len2; TEST(open(TEST_FILE, O_RDWR | O_APPEND, 0777)); if (TEST_RETURN == -1) { tst_resm(TFAIL | TTERRNO, "open failed"); return; } len1 = SAFE_LSEEK(cleanup, TEST_RETURN, 0, SEEK_CUR); SAFE_WRITE(cleanup, 1, TEST_RETURN, TEST_FILE, sizeof(TEST_FILE)); len2 = SAFE_LSEEK(cleanup, TEST_RETURN, 0, SEEK_CUR); SAFE_CLOSE(cleanup, TEST_RETURN); if (len2 > len1) tst_resm(TPASS, "test O_APPEND for open success"); else tst_resm(TFAIL, "test O_APPEND for open failed"); } static void test_noatime(void) { char read_buf; struct stat old_stat, new_stat; if ((tst_kvercmp(2, 6, 8)) < 0) { tst_resm(TCONF, "O_NOATIME flags test for open(2) needs kernel 2.6.8 " "or higher"); return; } if (skip_noatime) { tst_resm(TCONF, "test O_NOATIME flag for open needs filesystems which " "is mounted without noatime and relatime"); return; } SAFE_STAT(cleanup, TEST_FILE, &old_stat); sleep(1); TEST(open(TEST_FILE, O_RDONLY | O_NOATIME, 0777)); if (TEST_RETURN == -1) { tst_resm(TFAIL | TTERRNO, "open failed"); return; } SAFE_READ(cleanup, 1, TEST_RETURN, &read_buf, 1); SAFE_CLOSE(cleanup, TEST_RETURN); SAFE_STAT(cleanup, TEST_FILE, &new_stat); if (old_stat.st_atime == new_stat.st_atime) tst_resm(TPASS, "test O_NOATIME for open success"); else tst_resm(TFAIL, "test O_NOATIME for open failed"); } static void test_cloexec(void) { pid_t pid; int status; char buf[20]; if ((tst_kvercmp(2, 6, 23)) < 0) { tst_resm(TCONF, "O_CLOEXEC flags test for open(2) needs kernel 2.6.23 " "or higher"); return; } TEST(open(TEST_FILE, O_RDWR | O_APPEND | O_CLOEXEC, 0777)); if (TEST_RETURN == -1) { tst_resm(TFAIL | TTERRNO, "open failed"); return; } sprintf(buf, "%ld", TEST_RETURN); pid = tst_fork(); if (pid < 0) tst_brkm(TBROK | TERRNO, cleanup, "fork() failed"); if (pid == 0) { if (execlp("open12_child", "open12_child", buf, NULL)) exit(2); } SAFE_CLOSE(cleanup, TEST_RETURN); if (wait(&status) != pid) tst_brkm(TBROK | TERRNO, cleanup, "wait() failed"); if (WIFEXITED(status)) { switch ((int8_t)WEXITSTATUS(status)) { case 0: tst_resm(TPASS, "test O_CLOEXEC for open success"); break; case 1: tst_resm(TFAIL, "test O_CLOEXEC for open failed"); break; default: tst_brkm(TBROK, cleanup, "execlp() failed"); } } else { tst_brkm(TBROK, cleanup, "open12_child exits with unexpected error"); } } static void test_largefile(void) { int fd; off64_t offset; fd = SAFE_OPEN(cleanup, LARGE_FILE, O_LARGEFILE | O_RDWR | O_CREAT, 0777); offset = lseek64(fd, 4.1*1024*1024*1024, SEEK_SET); if (offset == -1) tst_brkm(TBROK | TERRNO, cleanup, "lseek64 failed"); SAFE_WRITE(cleanup, 1, fd, LARGE_FILE, sizeof(LARGE_FILE)); SAFE_CLOSE(cleanup, fd); TEST(open(LARGE_FILE, O_LARGEFILE | O_RDONLY, 0777)); if (TEST_RETURN == -1) { tst_resm(TFAIL, "test O_LARGEFILE for open failed"); } else { tst_resm(TPASS, "test O_LARGEFILE for open success"); SAFE_CLOSE(cleanup, TEST_RETURN); } } static void cleanup(void) { if (mount_flag && tst_umount(MNTPOINT) == -1) tst_brkm(TWARN | TERRNO, NULL, "umount(2) failed"); if (device) tst_release_device(NULL, device); tst_rmdir(); }
#ifndef __QEMU_BARRIER_H #define __QEMU_BARRIER_H 1 /* Compiler barrier */ #define barrier() asm volatile("" ::: "memory") #if defined(__i386__) #include "qemu/compiler.h" /* QEMU_GNUC_PREREQ */ /* * Because of the strongly ordered x86 storage model, wmb() and rmb() are nops * on x86(well, a compiler barrier only). Well, at least as long as * qemu doesn't do accesses to write-combining memory or non-temporal * load/stores from C code. */ #define smp_wmb() barrier() #define smp_rmb() barrier() /* * We use GCC builtin if it's available, as that can use * mfence on 32 bit as well, e.g. if built with -march=pentium-m. * However, on i386, there seem to be known bugs as recently as 4.3. * */ #if QEMU_GNUC_PREREQ(4, 4) #define smp_mb() __sync_synchronize() #else #define smp_mb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory") #endif #elif defined(__x86_64__) #define smp_wmb() barrier() #define smp_rmb() barrier() #define smp_mb() asm volatile("mfence" ::: "memory") #elif defined(_ARCH_PPC) /* * We use an eieio() for wmb() on powerpc. This assumes we don't * need to order cacheable and non-cacheable stores with respect to * each other */ #define smp_wmb() asm volatile("eieio" ::: "memory") #if defined(__powerpc64__) #define smp_rmb() asm volatile("lwsync" ::: "memory") #else #define smp_rmb() asm volatile("sync" ::: "memory") #endif #define smp_mb() asm volatile("sync" ::: "memory") #else /* * For (host) platforms we don't have explicit barrier definitions * for, we use the gcc __sync_synchronize() primitive to generate a * full barrier. This should be safe on all platforms, though it may * be overkill for wmb() and rmb(). */ #define smp_wmb() __sync_synchronize() #define smp_mb() __sync_synchronize() #define smp_rmb() __sync_synchronize() #endif #endif
// RUN: %clang -target arm -c -### %s -fforce-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-ALWAYS %s // RUN: %clang -target arm -c -### %s -fno-force-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s // RUN: %clang -target arm -c -### %s 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s // CHECK-ALWAYS: -fforce-dwarf-frame // CHECK-NO-ALWAYS-NOT: -fforce-dwarf-frame
//********************************************************* // // Copyright (c) Microsoft. All rights reserved. // This code is licensed under the MIT License (MIT). // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. // //********************************************************* #pragma once #include "DXSampleHelper.h" #include "Win32Application.h" class DXSample { public: DXSample(UINT width, UINT height, std::wstring name); virtual ~DXSample(); virtual void OnInit() = 0; virtual void OnUpdate() = 0; virtual void OnRender() = 0; virtual void OnSizeChanged(UINT width, UINT height, bool minimized) = 0; virtual void OnDestroy() = 0; // Samples override the event handlers to handle specific messages. virtual void OnKeyDown(UINT8 /*key*/) {} virtual void OnKeyUp(UINT8 /*key*/) {} // Accessors. UINT GetWidth() const { return m_width; } UINT GetHeight() const { return m_height; } const WCHAR* GetTitle() const { return m_title.c_str(); } bool GetTearingSupport() { return m_tearingSupport; } void ParseCommandLineArgs(_In_reads_(argc) WCHAR* argv[], int argc); void UpdateForSizeChange(UINT clientWidth, UINT clientHeight); protected: std::wstring GetAssetFullPath(LPCWSTR assetName); void GetHardwareAdapter(_In_ IDXGIFactory2* pFactory, _Outptr_result_maybenull_ IDXGIAdapter1** ppAdapter); void SetCustomWindowText(LPCWSTR text); void CheckTearingSupport(); // Viewport dimensions. UINT m_width; UINT m_height; float m_aspectRatio; // Whether or not tearing is available for fullscreen borderless windowed mode. bool m_tearingSupport; // Adapter info. bool m_useWarpDevice; private: // Root assets path. std::wstring m_assetsPath; // Window title. std::wstring m_title; };
/* * Copyright (c) 2012, Google 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. * * 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. */ #ifndef __SANDBOX_FS__ #define __SANDBOX_FS__ int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info); int sandbox_fs_read_at(const char *filename, loff_t pos, void *buffer, loff_t maxsize, loff_t *actread); int sandbox_fs_write_at(const char *filename, loff_t pos, void *buffer, loff_t maxsize, loff_t *actwrite); void sandbox_fs_close(void); int sandbox_fs_ls(const char *dirname); int sandbox_fs_exists(const char *filename); int sandbox_fs_size(const char *filename, loff_t *size); int fs_read_sandbox(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actread); int fs_write_sandbox(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actwrite); #endif
/*--------------------------------------------------------------------*/ /*--- Private exports of syswrap-main.c. priv_syswrap-main.h ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Valgrind, a dynamic binary instrumentation framework. Copyright (C) 2000-2010 Nicholas Nethercote njn@valgrind.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. The GNU General Public License is contained in the file COPYING. */ #ifndef __PRIV_SYSWRAP_MAIN_H #define __PRIV_SYSWRAP_MAIN_H /* Back up a thread so as to restart a system call. */ extern void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch ); #if defined(VGO_darwin) /* Longjmp to scheduler after client calls workq_ops(WQOPS_THREAD_RETURN)*/ extern void ML_(wqthread_continue_NORETURN)(ThreadId tid); #endif #endif // __PRIV_SYSWRAP_MAIN_H /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/
/* * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com> * * This file is part of paparazzi. * * paparazzi 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. * * paparazzi 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 paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** @file actuators_mkk_v2.c * Actuators driver for Mikrokopter motor controllers. */ #include "subsystems/actuators.h" #include "subsystems/actuators/actuators_mkk_v2.h" #include "mcu_periph/i2c.h" #include "mcu_periph/sys_time.h" PRINT_CONFIG_VAR(ACTUATORS_MKK_V2_I2C_DEV) struct actuators_mkk_v2_struct actuators_mkk_v2; void actuators_mkk_v2_init(void) { const uint8_t actuators_addr[ACTUATORS_MKK_V2_NB] = ACTUATORS_MKK_V2_ADDR; for (uint8_t i = 0; i < ACTUATORS_MKK_V2_NB; i++) { actuators_mkk_v2.trans[i].type = I2CTransTx; actuators_mkk_v2.trans[i].len_w = 2; actuators_mkk_v2.trans[i].slave_addr = actuators_addr[i]; actuators_mkk_v2.trans[i].status = I2CTransSuccess; actuators_mkk_v2.data[i].Version = 0; actuators_mkk_v2.data[i].Current = 0; actuators_mkk_v2.data[i].MaxPWM = 0; actuators_mkk_v2.data[i].Temperature = 0; } actuators_mkk_v2.read_number = 0; } static inline void actuators_mkk_v2_read(void) { actuators_mkk_v2.read_number++; if (actuators_mkk_v2.read_number >= ACTUATORS_MKK_V2_NB) { actuators_mkk_v2.read_number = 0; } actuators_mkk_v2.trans[actuators_mkk_v2.read_number].type = I2CTransTxRx; actuators_mkk_v2.trans[actuators_mkk_v2.read_number].len_r = 3; } void actuators_mkk_v2_set(void) { #if defined ACTUATORS_START_DELAY && ! defined SITL if (!actuators_delay_done) { if (SysTimeTimer(actuators_delay_time) < USEC_OF_SEC(ACTUATORS_START_DELAY)) { return; } else { actuators_delay_done = TRUE; } } #endif // Read result for (uint8_t i = 0; i < ACTUATORS_MKK_V2_NB; i++) { if (actuators_mkk_v2.trans[i].type != I2CTransTx) { actuators_mkk_v2.trans[i].type = I2CTransTx; actuators_mkk_v2.data[i].Current = actuators_mkk_v2.trans[i].buf[0]; actuators_mkk_v2.data[i].MaxPWM = actuators_mkk_v2.trans[i].buf[1]; actuators_mkk_v2.data[i].Temperature = actuators_mkk_v2.trans[i].buf[2]; } } RunOnceEvery(10, actuators_mkk_v2_read()); for (uint8_t i = 0; i < ACTUATORS_MKK_V2_NB; i++) { #ifdef KILL_MOTORS actuators_mkk_v2.trans[i].buf[0] = 0; actuators_mkk_v2.trans[i].buf[1] = 0; #else actuators_mkk_v2.trans[i].buf[0] = (actuators_mkk_v2.setpoint[i] >> 3); actuators_mkk_v2.trans[i].buf[1] = actuators_mkk_v2.setpoint[i] & 0x07; #endif i2c_submit(&ACTUATORS_MKK_V2_I2C_DEV, &actuators_mkk_v2.trans[i]); } }
/* * Synopsys DesignWare Multimedia Card Interface driver * * Copyright (C) 2009 NXP Semiconductors * Copyright (C) 2009, 2010 Imagination Technologies 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, or * (at your option) any later version. */ #include <linux/interrupt.h> #include <linux/module.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> #include <linux/mmc/dw_mmc.h> #include "dw_mmc.h" static int __init dw_mci_pltfm_probe(struct platform_device *pdev) { struct dw_mci *host; struct resource *regs; int ret; host = kzalloc(sizeof(struct dw_mci), GFP_KERNEL); if (!host) return -ENOMEM; regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) { ret = -ENXIO; goto err_free; } host->irq = platform_get_irq(pdev, 0); if (host->irq < 0) { ret = host->irq; goto err_free; } host->dev = pdev->dev; host->irq_flags = 0; host->pdata = pdev->dev.platform_data; ret = -ENOMEM; host->regs = ioremap(regs->start, resource_size(regs)); if (!host->regs) goto err_free; platform_set_drvdata(pdev, host); ret = dw_mci_probe(host); if (ret) goto err_out; return ret; err_out: iounmap(host->regs); err_free: kfree(host); return ret; } static int __exit dw_mci_pltfm_remove(struct platform_device *pdev) { struct dw_mci *host = platform_get_drvdata(pdev); platform_set_drvdata(pdev, NULL); dw_mci_remove(host); iounmap(host->regs); kfree(host); return 0; } #ifdef CONFIG_PM_SLEEP /* * TODO: we should probably disable the clock to the card in the suspend path. */ static int dw_mci_pltfm_suspend(struct device *dev) { int ret; struct dw_mci *host = dev_get_drvdata(dev); ret = dw_mci_suspend(host); if (ret) return ret; return 0; } static int dw_mci_pltfm_resume(struct device *dev) { int ret; struct dw_mci *host = dev_get_drvdata(dev); ret = dw_mci_resume(host); if (ret) return ret; return 0; } static void dw_mci_pltfm_shutdown(struct device *dev) { struct dw_mci *host = dev_get_drvdata(dev); if (host->pdata->cd_type == DW_MCI_CD_PERMANENT || host->pdata->cd_type == DW_MCI_CD_GPIO) dw_mci_shutdown(host); } #else #define dw_mci_pltfm_suspend NULL #define dw_mci_pltfm_resume NULL #define dw_mci_pltfm_shutdown NULL #endif /* CONFIG_PM_SLEEP */ static SIMPLE_DEV_PM_OPS(dw_mci_pltfm_pmops, dw_mci_pltfm_suspend, dw_mci_pltfm_resume); static struct platform_driver dw_mci_pltfm_driver = { .remove = __exit_p(dw_mci_pltfm_remove), .driver = { .name = "dw_mmc", .pm = &dw_mci_pltfm_pmops, .shutdown = dw_mci_pltfm_shutdown, }, }; static int __init dw_mci_init(void) { return platform_driver_probe(&dw_mci_pltfm_driver, dw_mci_pltfm_probe); } static void __exit dw_mci_exit(void) { platform_driver_unregister(&dw_mci_pltfm_driver); } module_init(dw_mci_init); module_exit(dw_mci_exit); MODULE_DESCRIPTION("DW Multimedia Card Interface driver"); MODULE_AUTHOR("NXP Semiconductor VietNam"); MODULE_AUTHOR("Imagination Technologies Ltd"); MODULE_LICENSE("GPL v2");
/* * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that: (1) source code distributions * retain the above copyright notice and this paragraph in its entirety, (2) * distributions including binary code include the above copyright notice and * this paragraph in its entirety in the documentation or other materials * provided with the distribution, and (3) all advertising materials mentioning * features or use of this software display the following acknowledgement: * ``This product includes software developed by the University of California, * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of * the University nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior * written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifndef lint static const char rcsid[] _U_ = "@(#) $Header: /tcpdump/master/tcpdump/print-vjc.c,v 1.15 2004/03/25 03:31:17 mcr Exp $ (LBL)"; #endif #include <tcpdump-stdinc.h> #include <pcap.h> #include <stdio.h> #include "interface.h" #include "addrtoname.h" #include "slcompress.h" #include "ppp.h" /* * XXX - for BSD/OS PPP, what packets get supplied with a PPP header type * of PPP_VJC and what packets get supplied with a PPP header type of * PPP_VJNC? PPP_VJNC is for "UNCOMPRESSED_TCP" packets, and PPP_VJC * is for COMPRESSED_TCP packets (PPP_IP is used for TYPE_IP packets). * * RFC 1144 implies that, on the wire, the packet type is *not* needed * for PPP, as different PPP protocol types can be used; it only needs * to be put on the wire for SLIP. * * It also indicates that, for compressed SLIP: * * If the COMPRESSED_TCP bit is set in the first byte, it's * a COMPRESSED_TCP packet; that byte is the change byte, and * the COMPRESSED_TCP bit, 0x80, isn't used in the change byte. * * If the upper 4 bits of the first byte are 7, it's an * UNCOMPRESSED_TCP packet; that byte is the first byte of * the UNCOMPRESSED_TCP modified IP header, with a connection * number in the protocol field, and with the version field * being 7, not 4. * * Otherwise, the packet is an IPv4 packet (where the upper 4 bits * of the packet are 4). * * So this routine looks as if it's sort-of intended to handle * compressed SLIP, although it doesn't handle UNCOMPRESSED_TCP * correctly for that (it doesn't fix the version number and doesn't * do anything to the protocol field), and doesn't check for COMPRESSED_TCP * packets correctly for that (you only check the first bit - see * B.1 in RFC 1144). * * But it's called for BSD/OS PPP, not SLIP - perhaps BSD/OS does weird * things with the headers? * * Without a BSD/OS VJC-compressed PPP trace, or knowledge of what the * BSD/OS VJC code does, we can't say what's the case. * * We therefore leave "proto" - which is the PPP protocol type - in place, * *not* marked as unused, for now, so that GCC warnings about the * unused argument remind us that we should fix this some day. */ int vjc_print(register const char *bp, u_short proto _U_) { int i; switch (bp[0] & 0xf0) { case TYPE_IP: if (eflag) printf("(vjc type=IP) "); return PPP_IP; case TYPE_UNCOMPRESSED_TCP: if (eflag) printf("(vjc type=raw TCP) "); return PPP_IP; case TYPE_COMPRESSED_TCP: if (eflag) printf("(vjc type=compressed TCP) "); for (i = 0; i < 8; i++) { if (bp[1] & (0x80 >> i)) printf("%c", "?CI?SAWU"[i]); } if (bp[1]) printf(" "); printf("C=0x%02x ", bp[2]); printf("sum=0x%04x ", *(u_short *)&bp[3]); return -1; case TYPE_ERROR: if (eflag) printf("(vjc type=error) "); return -1; default: if (eflag) printf("(vjc type=0x%02x) ", bp[0] & 0xf0); return -1; } }
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** As a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QSTYLEFACTORY_H #define QSTYLEFACTORY_H #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE class QStyle; class Q_WIDGETS_EXPORT QStyleFactory { public: static QStringList keys(); static QStyle *create(const QString&); }; QT_END_NAMESPACE #endif // QSTYLEFACTORY_H
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ #import <UIKit/UIKit.h> #import <React/RCTView.h> @interface UpdatePropertiesExampleView : RCTView @end
/* * Copyright (C) 2012-2013 Michael Niedermayer (michaelni@gmx.at) * * This file is part of libswresample * * libswresample is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * libswresample is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with libswresample; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/avassert.h" #include "swresample_internal.h" #include "noise_shaping_data.c" void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) { double scale = s->dither.noise_scale; #define TMP_EXTRA 2 double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double)); int i; for(i=0; i<len + TMP_EXTRA; i++){ double v; seed = seed* 1664525 + 1013904223; switch(s->dither.method){ case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break; default: av_assert0(s->dither.method < SWR_DITHER_NB); v = ((double)seed) / UINT_MAX; seed = seed*1664525 + 1013904223; v-= ((double)seed) / UINT_MAX; break; } tmp[i] = v; } for(i=0; i<len; i++){ double v; switch(s->dither.method){ default: av_assert0(s->dither.method < SWR_DITHER_NB); v = tmp[i]; break; case SWR_DITHER_TRIANGULAR_HIGHPASS : v = (- tmp[i] + 2*tmp[i+1] - tmp[i+2]) / sqrt(6); break; } v*= scale; switch(noise_fmt){ case AV_SAMPLE_FMT_S16P: ((int16_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_S32P: ((int32_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_FLTP: ((float *)dst)[i] = v; break; case AV_SAMPLE_FMT_DBLP: ((double *)dst)[i] = v; break; default: av_assert0(0); } } av_free(tmp); } av_cold int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt) { int i; double scale = 0; if (s->dither.method > SWR_DITHER_TRIANGULAR_HIGHPASS && s->dither.method <= SWR_DITHER_NS) return AVERROR(EINVAL); out_fmt = av_get_packed_sample_fmt(out_fmt); in_fmt = av_get_packed_sample_fmt( in_fmt); if(in_fmt == AV_SAMPLE_FMT_FLT || in_fmt == AV_SAMPLE_FMT_DBL){ if(out_fmt == AV_SAMPLE_FMT_S32) scale = 1.0/(1LL<<31); if(out_fmt == AV_SAMPLE_FMT_S16) scale = 1.0/(1LL<<15); if(out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1.0/(1LL<< 7); } if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S32 && (s->dither.output_sample_bits&31)) scale = 1; if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_S16) scale = 1<<16; if(in_fmt == AV_SAMPLE_FMT_S32 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<24; if(in_fmt == AV_SAMPLE_FMT_S16 && out_fmt == AV_SAMPLE_FMT_U8 ) scale = 1<<8; scale *= s->dither.scale; if (out_fmt == AV_SAMPLE_FMT_S32 && s->dither.output_sample_bits) scale *= 1<<(32-s->dither.output_sample_bits); s->dither.ns_pos = 0; s->dither.noise_scale= scale; s->dither.ns_scale = scale; s->dither.ns_scale_1 = scale ? 1/scale : 0; memset(s->dither.ns_errors, 0, sizeof(s->dither.ns_errors)); for (i=0; filters[i].coefs; i++) { const filter_t *f = &filters[i]; if (fabs(s->out_sample_rate - f->rate) / f->rate <= .05 && f->name == s->dither.method) { int j; s->dither.ns_taps = f->len; for (j=0; j<f->len; j++) s->dither.ns_coeffs[j] = f->coefs[j]; s->dither.ns_scale_1 *= 1 - exp(f->gain_cB * M_LN10 * 0.005) * 2 / (1<<(8*av_get_bytes_per_sample(out_fmt))); break; } } if (!filters[i].coefs && s->dither.method > SWR_DITHER_NS) { av_log(s, AV_LOG_WARNING, "Requested noise shaping dither not available at this sampling rate, using triangular hp dither\n"); s->dither.method = SWR_DITHER_TRIANGULAR_HIGHPASS; } av_assert0(!s->preout.count); s->dither.noise = s->preout; s->dither.temp = s->preout; if (s->dither.method > SWR_DITHER_NS) { s->dither.noise.bps = 4; s->dither.noise.fmt = AV_SAMPLE_FMT_FLTP; s->dither.noise_scale = 1; } return 0; } #define TEMPLATE_DITHER_S16 #include "dither_template.c" #undef TEMPLATE_DITHER_S16 #define TEMPLATE_DITHER_S32 #include "dither_template.c" #undef TEMPLATE_DITHER_S32 #define TEMPLATE_DITHER_FLT #include "dither_template.c" #undef TEMPLATE_DITHER_FLT #define TEMPLATE_DITHER_DBL #include "dither_template.c" #undef TEMPLATE_DITHER_DBL
// Copyright 2015 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 SKY_ENGINE_TONIC_DART_BUILTIN_H_ #define SKY_ENGINE_TONIC_DART_BUILTIN_H_ #include "base/macros.h" #include "dart/runtime/include/dart_api.h" namespace blink { class DartBuiltin { public: struct Natives { const char* name; Dart_NativeFunction function; int argument_count; }; DartBuiltin(const Natives* natives, size_t count); ~DartBuiltin(); Dart_NativeFunction Resolver(Dart_Handle name, int argument_count, bool* auto_setup_scope) const; const uint8_t* Symbolizer(Dart_NativeFunction native_function) const; // Helper around Dart_LookupLibrary. static Dart_Handle LookupLibrary(const char* name); private: const Natives* natives_; size_t count_; DISALLOW_COPY_AND_ASSIGN(DartBuiltin); }; } // namespace blink #endif // SKY_ENGINE_TONIC_DART_BUILTIN_H_
// PropID.h #ifndef __7ZIP_PROP_ID_H #define __7ZIP_PROP_ID_H #include "../Common/MyTypes.h" enum { kpidNoProperty = 0, kpidMainSubfile, kpidHandlerItemIndex, kpidPath, kpidName, kpidExtension, kpidIsDir, kpidSize, kpidPackSize, kpidAttrib, kpidCTime, kpidATime, kpidMTime, kpidSolid, kpidCommented, kpidEncrypted, kpidSplitBefore, kpidSplitAfter, kpidDictionarySize, kpidCRC, kpidType, kpidIsAnti, kpidMethod, kpidHostOS, kpidFileSystem, kpidUser, kpidGroup, kpidBlock, kpidComment, kpidPosition, kpidPrefix, kpidNumSubDirs, kpidNumSubFiles, kpidUnpackVer, kpidVolume, kpidIsVolume, kpidOffset, kpidLinks, kpidNumBlocks, kpidNumVolumes, kpidTimeType, kpidBit64, kpidBigEndian, kpidCpu, kpidPhySize, kpidHeadersSize, kpidChecksum, kpidCharacts, kpidVa, kpidId, kpidShortName, kpidCreatorApp, kpidSectorSize, kpidPosixAttrib, kpidSymLink, kpidError, kpidTotalSize, kpidFreeSpace, kpidClusterSize, kpidVolumeName, kpidLocalName, kpidProvider, kpidNtSecure, kpidIsAltStream, kpidIsAux, kpidIsDeleted, kpidIsTree, kpidSha1, kpidSha256, kpidErrorType, kpidNumErrors, kpidErrorFlags, kpidWarningFlags, kpidWarning, kpidNumStreams, kpidNumAltStreams, kpidAltStreamsSize, kpidVirtualSize, kpidUnpackSize, kpidTotalPhySize, kpidVolumeIndex, kpidSubType, kpidShortComment, kpidCodePage, kpidIsNotArcType, kpidPhySizeCantBeDetected, kpidZerosTailIsAllowed, kpidTailSize, kpidEmbeddedStubSize, kpidNtReparse, kpidHardLink, kpidINode, kpidStreamId, kpidReadOnly, kpidOutName, kpidCopyLink, kpid_NUM_DEFINED, kpidUserDefined = 0x10000 }; extern const Byte k7z_PROPID_To_VARTYPE[kpid_NUM_DEFINED]; // VARTYPE const UInt32 kpv_ErrorFlags_IsNotArc = 1 << 0; const UInt32 kpv_ErrorFlags_HeadersError = 1 << 1; const UInt32 kpv_ErrorFlags_EncryptedHeadersError = 1 << 2; const UInt32 kpv_ErrorFlags_UnavailableStart = 1 << 3; const UInt32 kpv_ErrorFlags_UnconfirmedStart = 1 << 4; const UInt32 kpv_ErrorFlags_UnexpectedEnd = 1 << 5; const UInt32 kpv_ErrorFlags_DataAfterEnd = 1 << 6; const UInt32 kpv_ErrorFlags_UnsupportedMethod = 1 << 7; const UInt32 kpv_ErrorFlags_UnsupportedFeature = 1 << 8; const UInt32 kpv_ErrorFlags_DataError = 1 << 9; const UInt32 kpv_ErrorFlags_CrcError = 1 << 10; // const UInt32 kpv_ErrorFlags_Unsupported = 1 << 11; #endif
//****************************************************************************** // // Copyright (c) 2016 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** #pragma once #import <UIKit/UIKitExport.h> #import <Foundation/NSObject.h> @class UIDocumentMenuViewController; @class UIDocumentPickerViewController; @protocol UIDocumentMenuDelegate <NSObject> - (void)documentMenu:(UIDocumentMenuViewController*)documentMenu didPickDocumentPicker:(UIDocumentPickerViewController*)documentPicker; @optional - (void)documentMenuWasCancelled:(UIDocumentMenuViewController*)documentMenu; @end
/* * (C) 2010-2011 by Holger Hans Peter Freyther <zecke@selfish.org> * (C) 2010-2011 by On-Waves * All Rights Reserved * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #ifndef mtp_pcap_h #define mtp_pcap_h #include <stdint.h> int mtp_pcap_write_header(int fd); int mtp_pcap_write_msu(int fd, const uint8_t *data, int length); #endif
/* * Copyright (C) 2011-2014 Project SkyFire <http://www.projectskyfire.org/> * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2005-2014 MaNGOS <http://getmangos.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 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/>. */ #ifndef TRINITY_DISABLEMGR_H #define TRINITY_DISABLEMGR_H #include "Define.h" class Unit; enum DisableType { DISABLE_TYPE_SPELL = 0, DISABLE_TYPE_QUEST = 1, DISABLE_TYPE_MAP = 2, DISABLE_TYPE_BATTLEGROUND = 3, DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4, DISABLE_TYPE_OUTDOORPVP = 5, DISABLE_TYPE_VMAP = 6, DISABLE_TYPE_MMAP = 7 }; enum SpellDisableTypes { SPELL_DISABLE_PLAYER = 0x1, SPELL_DISABLE_CREATURE = 0x2, SPELL_DISABLE_PET = 0x4, SPELL_DISABLE_DEPRECATED_SPELL = 0x8, SPELL_DISABLE_MAP = 0x10, SPELL_DISABLE_AREA = 0x20, SPELL_DISABLE_LOS = 0x40, MAX_SPELL_DISABLE_TYPE = ( SPELL_DISABLE_PLAYER | SPELL_DISABLE_CREATURE | SPELL_DISABLE_PET | SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA | SPELL_DISABLE_LOS) }; enum VmapDisableTypes { VMAP_DISABLE_AREAFLAG = 0x1, VMAP_DISABLE_HEIGHT = 0x2, VMAP_DISABLE_LOS = 0x4, VMAP_DISABLE_LIQUIDSTATUS = 0x8 }; enum MMapDisableTypes { MMAP_DISABLE_PATHFINDING = 0x0 }; namespace DisableMgr { void LoadDisables(); bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0); void CheckQuestDisables(); } #endif //TRINITY_DISABLEMGR_H
/* * kexec: Linux boots Linux * * modified from kexec-ppc.c * */ #define _GNU_SOURCE #include <stddef.h> #include <stdio.h> #include <errno.h> #include <stdint.h> #include <string.h> #include <getopt.h> #include "../../kexec.h" #include "../../kexec-syscall.h" #include "kexec-arm.h" #include <arch/options.h> #define MAX_MEMORY_RANGES 64 #define MAX_LINE 160 static struct memory_range memory_range[MAX_MEMORY_RANGES]; /* Return a sorted list of available memory ranges. */ int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long UNUSED(kexec_flags)) { const char *iomem = proc_iomem(); int memory_ranges = 0; char line[MAX_LINE]; FILE *fp; fp = fopen(iomem, "r"); if (!fp) { fprintf(stderr, "Cannot open %s: %s\n", iomem, strerror(errno)); return -1; } while(fgets(line, sizeof(line), fp) != 0) { unsigned long long start, end; char *str; int type; int consumed; int count; if (memory_ranges >= MAX_MEMORY_RANGES) break; count = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed); if (count != 2) continue; str = line + consumed; end = end + 1; if (memcmp(str, "System RAM\n", 11) == 0) { type = RANGE_RAM; } else if (memcmp(str, "reserved\n", 9) == 0) { type = RANGE_RESERVED; } else { continue; } memory_range[memory_ranges].start = start; memory_range[memory_ranges].end = end; memory_range[memory_ranges].type = type; memory_ranges++; } fclose(fp); *range = memory_range; *ranges = memory_ranges; return 0; } /* Supported file types and callbacks */ struct file_type file_type[] = { /* uImage is probed before zImage because the latter also accepts uncompressed images. */ {"uImage", uImage_arm_probe, uImage_arm_load, zImage_arm_usage}, {"zImage", zImage_arm_probe, zImage_arm_load, zImage_arm_usage}, }; int file_types = sizeof(file_type) / sizeof(file_type[0]); void arch_usage(void) { } int arch_process_options(int argc, char **argv) { return 0; } const struct arch_map_entry arches[] = { { "arm", KEXEC_ARCH_ARM }, { NULL, 0 }, }; int arch_compat_trampoline(struct kexec_info *UNUSED(info)) { return 0; } void arch_update_purgatory(struct kexec_info *UNUSED(info)) { }
/* SPDX-License-Identifier: GPL-2.0 */ /* * Cedrus VPU driver * * Copyright (C) 2016 Florent Revest <florent.revest@free-electrons.com> * Copyright (C) 2018 Paul Kocialkowski <paul.kocialkowski@bootlin.com> * Copyright (C) 2018 Bootlin * * Based on the vim2m driver, that is: * * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. * Pawel Osciak, <pawel@osciak.com> * Marek Szyprowski, <m.szyprowski@samsung.com> */ #ifndef _CEDRUS_H_ #define _CEDRUS_H_ #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> #include <media/v4l2-mem2mem.h> #include <media/videobuf2-v4l2.h> #include <media/videobuf2-dma-contig.h> #include <linux/platform_device.h> #define CEDRUS_NAME "cedrus" #define CEDRUS_CAPABILITY_UNTILED BIT(0) enum cedrus_codec { CEDRUS_CODEC_MPEG2, CEDRUS_CODEC_LAST, }; enum cedrus_irq_status { CEDRUS_IRQ_NONE, CEDRUS_IRQ_ERROR, CEDRUS_IRQ_OK, }; struct cedrus_control { u32 id; u32 elem_size; enum cedrus_codec codec; unsigned char required:1; }; struct cedrus_mpeg2_run { const struct v4l2_ctrl_mpeg2_slice_params *slice_params; const struct v4l2_ctrl_mpeg2_quantization *quantization; }; struct cedrus_run { struct vb2_v4l2_buffer *src; struct vb2_v4l2_buffer *dst; union { struct cedrus_mpeg2_run mpeg2; }; }; struct cedrus_buffer { struct v4l2_m2m_buffer m2m_buf; }; struct cedrus_ctx { struct v4l2_fh fh; struct cedrus_dev *dev; struct v4l2_pix_format src_fmt; struct v4l2_pix_format dst_fmt; enum cedrus_codec current_codec; struct v4l2_ctrl_handler hdl; struct v4l2_ctrl **ctrls; struct vb2_buffer *dst_bufs[VIDEO_MAX_FRAME]; }; struct cedrus_dec_ops { void (*irq_clear)(struct cedrus_ctx *ctx); void (*irq_disable)(struct cedrus_ctx *ctx); enum cedrus_irq_status (*irq_status)(struct cedrus_ctx *ctx); void (*setup)(struct cedrus_ctx *ctx, struct cedrus_run *run); int (*start)(struct cedrus_ctx *ctx); void (*stop)(struct cedrus_ctx *ctx); void (*trigger)(struct cedrus_ctx *ctx); }; struct cedrus_variant { unsigned int capabilities; }; struct cedrus_dev { struct v4l2_device v4l2_dev; struct video_device vfd; struct media_device mdev; struct media_pad pad[2]; struct platform_device *pdev; struct device *dev; struct v4l2_m2m_dev *m2m_dev; struct cedrus_dec_ops *dec_ops[CEDRUS_CODEC_LAST]; /* Device file mutex */ struct mutex dev_mutex; /* Interrupt spinlock */ spinlock_t irq_lock; void __iomem *base; struct clk *mod_clk; struct clk *ahb_clk; struct clk *ram_clk; struct reset_control *rstc; unsigned int capabilities; }; extern struct cedrus_dec_ops cedrus_dec_ops_mpeg2; static inline void cedrus_write(struct cedrus_dev *dev, u32 reg, u32 val) { writel(val, dev->base + reg); } static inline u32 cedrus_read(struct cedrus_dev *dev, u32 reg) { return readl(dev->base + reg); } static inline dma_addr_t cedrus_buf_addr(struct vb2_buffer *buf, struct v4l2_pix_format *pix_fmt, unsigned int plane) { dma_addr_t addr = vb2_dma_contig_plane_dma_addr(buf, 0); return addr + (pix_fmt ? (dma_addr_t)pix_fmt->bytesperline * pix_fmt->height * plane : 0); } static inline dma_addr_t cedrus_dst_buf_addr(struct cedrus_ctx *ctx, unsigned int index, unsigned int plane) { struct vb2_buffer *buf = ctx->dst_bufs[index]; return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0; } static inline struct cedrus_buffer * vb2_v4l2_to_cedrus_buffer(const struct vb2_v4l2_buffer *p) { return container_of(p, struct cedrus_buffer, m2m_buf.vb); } static inline struct cedrus_buffer * vb2_to_cedrus_buffer(const struct vb2_buffer *p) { return vb2_v4l2_to_cedrus_buffer(to_vb2_v4l2_buffer(p)); } void *cedrus_find_control_data(struct cedrus_ctx *ctx, u32 id); #endif
/* Detect write error on a stream. Copyright (C) 2003, 2005-2006 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* There are two approaches for detecting a write error on a stream opened for writing: (a) Test the return value of every fwrite() or fprintf() call, and react immediately. (b) Just before fclose(), test the error indicator in the stream and the return value of the final fclose() call. The benefit of (a) is that non file related errors (such that ENOMEM during fprintf) and temporary error conditions can be diagnosed accurately. A theoretical benefit of (a) is also that, on POSIX systems, in the case of an ENOSPC error, errno is set and can be used by error() to provide a more accurate error message. But in practice, this benefit is not big because users can easily figure out by themselves why a file cannot be written to, and furthermore the function fwriteerror() can provide errno as well. The big drawback of (a) is extensive error checking code: Every function which does stream output must return an error indicator. This file provides support for (b). */ #include <stdio.h> /* Write out the not yet written buffered contents of the stream FP, close the stream FP, and test whether some error occurred on the stream FP. FP must be a stream opened for writing. Return 0 if no error occurred and fclose (fp) succeeded. Return -1 and set errno if there was an error. The errno value will be 0 if the cause of the error cannot be determined. For any given stream FP other than stdout, fwriteerror (FP) may only be called once. */ extern int fwriteerror (FILE *fp); /* Likewise, but don't consider it an error if FP has an invalid file descriptor and no output was done to FP. */ extern int fwriteerror_no_ebadf (FILE *fp);
/* * eap_types.h Header file containing the interfaces for all EAP types. * * most contents moved from modules/rlm_eap/eap.h * * Version: $Id$ * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com> * Copyright 2003 Alan DeKok <aland@freeradius.org> * Copyright 2006 The FreeRADIUS server project */ #ifndef _EAP_TYPES_H #define _EAP_TYPES_H RCSIDH(eap_methods_h, "$Id$") #include <freeradius-devel/radiusd.h> #include <freeradius-devel/modules.h> /* Code (1) + Identifier (1) + Length (2) */ #define EAP_HEADER_LEN 4 typedef enum eap_code { PW_EAP_REQUEST = 1, PW_EAP_RESPONSE, PW_EAP_SUCCESS, PW_EAP_FAILURE, PW_EAP_MAX_CODES } eap_code_t; typedef enum eap_method { PW_EAP_INVALID = 0, /* 0 */ PW_EAP_IDENTITY, /* 1 */ PW_EAP_NOTIFICATION, /* 2 */ PW_EAP_NAK, /* 3 */ PW_EAP_MD5, /* 4 */ PW_EAP_OTP, /* 5 */ PW_EAP_GTC, /* 6 */ PW_EAP_7, /* 7 - unused */ PW_EAP_8, /* 8 - unused */ PW_EAP_RSA_PUBLIC_KEY, /* 9 */ PW_EAP_DSS_UNILATERAL, /* 10 */ PW_EAP_KEA, /* 11 */ PW_EAP_KEA_VALIDATE, /* 12 */ PW_EAP_TLS, /* 13 */ PW_EAP_DEFENDER_TOKEN, /* 14 */ PW_EAP_RSA_SECURID, /* 15 */ PW_EAP_ARCOT_SYSTEMS, /* 16 */ PW_EAP_LEAP, /* 17 */ PW_EAP_SIM, /* 18 */ PW_EAP_SRP_SHA1, /* 19 */ PW_EAP_20, /* 20 - unassigned */ PW_EAP_TTLS, /* 21 */ PW_EAP_REMOTE_ACCESS_SERVICE, /* 22 */ PW_EAP_AKA, /* 23 */ PW_EAP_3COM, /* 24 - should this be EAP-HP now? */ PW_EAP_PEAP, /* 25 */ PW_EAP_MSCHAPV2, /* 26 */ PW_EAP_MAKE, /* 27 */ PW_EAP_CRYPTOCARD, /* 28 */ PW_EAP_CISCO_MSCHAPV2, /* 29 */ PW_EAP_DYNAMID, /* 30 */ PW_EAP_ROB, /* 31 */ PW_EAP_POTP, /* 32 */ PW_EAP_MS_ATLV, /* 33 */ PW_EAP_SENTRINET, /* 34 */ PW_EAP_ACTIONTEC, /* 35 */ PW_EAP_COGENT_BIOMETRIC, /* 36 */ PW_EAP_AIRFORTRESS, /* 37 */ PW_EAP_TNC, /* 38 - fixme conflicts with HTTP DIGEST */ // PW_EAP_HTTP_DIGEST, /* 38 */ PW_EAP_SECURISUITE, /* 39 */ PW_EAP_DEVICECONNECT, /* 40 */ PW_EAP_SPEKE, /* 41 */ PW_EAP_MOBAC, /* 42 */ PW_EAP_FAST, /* 43 */ PW_EAP_ZONELABS, /* 44 */ PW_EAP_LINK, /* 45 */ PW_EAP_PAX, /* 46 */ PW_EAP_PSK, /* 47 */ PW_EAP_SAKE, /* 48 */ PW_EAP_IKEV2, /* 49 */ PW_EAP_AKA2, /* 50 */ PW_EAP_GPSK, /* 51 */ PW_EAP_PWD, /* 52 */ PW_EAP_EKE, /* 53 */ PW_EAP_MAX_TYPES /* 54 - for validation */ } eap_type_t; #define PW_EAP_EXPANDED_TYPE (254) typedef enum eap_rcode { EAP_NOTFOUND, //!< EAP handler data not found. EAP_FOUND, //!< EAP handler data found, continue. EAP_OK, //!< Ok, continue. EAP_FAIL, //!< Failed, don't reply. EAP_NOOP, //!< Succeeded without doing anything. EAP_INVALID, //!< Invalid, don't reply. EAP_VALID, //!< Valid, continue. EAP_MAX_RCODES } eap_rcode_t; extern const FR_NAME_NUMBER eap_rcode_table[]; /** EAP-Type specific data */ typedef struct eap_type_data { eap_type_t num; size_t length; uint8_t *data; } eap_type_data_t; /** Structure to hold EAP data * * length = code + id + length + type + type.data * = 1 + 1 + 2 + 1 + X */ typedef struct eap_packet { eap_code_t code; uint8_t id; size_t length; eap_type_data_t type; uint8_t *packet; } eap_packet_t; /** Structure to represent packet format of eap *on wire* */ typedef struct eap_packet_raw { uint8_t code; uint8_t id; uint8_t length[2]; uint8_t data[1]; } eap_packet_raw_t; /* * interfaces in eapcommon.c */ eap_type_t eap_name2type(char const *name); char const *eap_type2name(eap_type_t method); int eap_wireformat(eap_packet_t *reply); int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply); VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, eap_packet_raw_t const *reply); eap_packet_raw_t *eap_vp2packet(TALLOC_CTX *ctx, VALUE_PAIR *vps); void eap_add_reply(REQUEST *request, char const *name, uint8_t const *value, int len); #endif /* _EAP_TYPES_H */
#include "usb/UsbSpy.h" static int (*notify)(void *, int, void (*)(void *, int online), void *); int msm_register_usb_ext_notification(struct usb_ext_notification *info){ notify = info->notify; return 0; } int usb_spy_clean(void){ notify = NULL; } notify_def get_registerred_device_discovery_pointer(void) { return notify; }
/* * This file is part of mpv. * * mpv is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * mpv is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with mpv. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <android/native_window_jni.h> #include "common/common.h" struct vo; int vo_android_init(struct vo *vo); void vo_android_uninit(struct vo *vo); ANativeWindow *vo_android_native_window(struct vo *vo); bool vo_android_surface_size(struct vo *vo, int *w, int *h);
/* * SpriteBuilder: http://www.spritebuilder.org * * Copyright (c) 2012 Zynga Inc. * Copyright (c) 2013 Apportable Inc. * * 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 <Foundation/Foundation.h> #import "cocos2d.h" #import "CCAnimationManager.h" __attribute__ ((deprecated)) @interface CCBAnimationManager : CCAnimationManager { } @end
//***************************************************************************** // // uart.h - Defines and Macros for the UART. // // Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's Stellaris Family of microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. Any use in violation // of the foregoing restrictions may subject the user to criminal sanctions // under applicable laws, as well as to civil liability for the breach of the // terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 991 of the Stellaris Driver Library. // //***************************************************************************** #ifndef __UART_H__ #define __UART_H__ #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear // as the ulIntFlags parameter, and returned from UARTIntStatus. // //***************************************************************************** #define UART_INT_OE 0x400 // Overrun Error Interrupt Mask #define UART_INT_BE 0x200 // Break Error Interrupt Mask #define UART_INT_PE 0x100 // Parity Error Interrupt Mask #define UART_INT_FE 0x080 // Framing Error Interrupt Mask #define UART_INT_RT 0x040 // Receive Timeout Interrupt Mask #define UART_INT_TX 0x020 // Transmit Interrupt Mask #define UART_INT_RX 0x010 // Receive Interrupt Mask //***************************************************************************** // // Values that can be passed to UARTConfigSet as the ulConfig parameter and // returned by UARTConfigGet in the pulConfig parameter. Additionally, the // UART_CONFIG_PAR_* subset can be passed to UARTParityModeSet as the ulParity // parameter, and are returned by UARTParityModeGet. // //***************************************************************************** #define UART_CONFIG_WLEN_8 0x00000060 // 8 bit data #define UART_CONFIG_WLEN_7 0x00000040 // 7 bit data #define UART_CONFIG_WLEN_6 0x00000020 // 6 bit data #define UART_CONFIG_WLEN_5 0x00000000 // 5 bit data #define UART_CONFIG_STOP_ONE 0x00000000 // One stop bit #define UART_CONFIG_STOP_TWO 0x00000008 // Two stop bits #define UART_CONFIG_PAR_NONE 0x00000000 // No parity #define UART_CONFIG_PAR_EVEN 0x00000006 // Even parity #define UART_CONFIG_PAR_ODD 0x00000002 // Odd parity #define UART_CONFIG_PAR_ONE 0x00000086 // Parity bit is one #define UART_CONFIG_PAR_ZERO 0x00000082 // Parity bit is zero //***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity); extern unsigned long UARTParityModeGet(unsigned long ulBase); extern void UARTConfigSet(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig); extern void UARTConfigGet(unsigned long ulBase, unsigned long *pulBaud, unsigned long *pulConfig); extern void UARTEnable(unsigned long ulBase); extern void UARTDisable(unsigned long ulBase); extern tBoolean UARTCharsAvail(unsigned long ulBase); extern tBoolean UARTSpaceAvail(unsigned long ulBase); extern long UARTCharNonBlockingGet(unsigned long ulBase); extern long UARTCharGet(unsigned long ulBase); extern tBoolean UARTCharNonBlockingPut(unsigned long ulBase, unsigned char ucData); extern void UARTCharPut(unsigned long ulBase, unsigned char ucData); extern void UARTBreakCtl(unsigned long ulBase, tBoolean bBreakState); extern void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void)); extern void UARTIntUnregister(unsigned long ulBase); extern void UARTIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long UARTIntStatus(unsigned long ulBase, tBoolean bMasked); extern void UARTIntClear(unsigned long ulBase, unsigned long ulIntFlags); extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long ulBaud, unsigned long ulConfig); #ifdef __cplusplus } #endif #endif // __UART_H__
// Copyright (c) 2019 Google LLC // // 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. #ifndef SOURCE_FORCE_RENDER_RED_H_ #define SOURCE_FORCE_RENDER_RED_H_ #include <vector> #include "source/fuzz/protobufs/spirvfuzz_protobufs.h" #include "spirv-tools/libspirv.hpp" namespace spvtools { namespace fuzz { // Requires |binary_in| to be a valid SPIR-V module with Shader capability, // containing an entry point with the Fragment execution model, and a single // output variable of type vec4. // // Turns the body of this entry point into effectively: // // output_variable = vec4(1.0, 0.0, 0.0, 1.0); // if (false) { // original_body // } // // If suitable facts about values of uniforms are available, the 'false' will // instead become: 'u > v', where 'u' and 'v' are pieces of uniform data for // which it is known that 'u < v' holds. bool ForceRenderRed( const spv_target_env& target_env, const std::vector<uint32_t>& binary_in, const spvtools::fuzz::protobufs::FactSequence& initial_facts, std::vector<uint32_t>* binary_out); } // namespace fuzz } // namespace spvtools #endif // SOURCE_FORCE_RENDER_RED_H_
/* * Fadecandy DFU Bootloader * * Copyright (c) 2013 Micah Elizabeth Scott * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <stdbool.h> #include "usb_dev.h" #include "serial.h" #include "mk20dx128.h" extern uint32_t boot_token; static __attribute__ ((section(".appvectors"))) uint32_t appVectors[64]; const uint32_t led_bit = 1 << 5; static void led_init() { // Set the status LED on PC5, as an indication that we're in bootloading mode. PORTC_PCR5 = PORT_PCR_MUX(1) | PORT_PCR_DSE | PORT_PCR_SRE; GPIOC_PDDR = led_bit; GPIOC_PDOR = led_bit; } static void led_toggle() { GPIOC_PTOR = led_bit; } static bool test_boot_token() { /* * If we find a valid boot token in RAM, the application is asking us explicitly * to enter DFU mode. This is used to implement the DFU_DETACH command when the app * is running. */ return boot_token == 0x74624346; } static bool test_app_missing() { /* * If there doesn't seem to be a valid application installed, we always go to * bootloader mode. */ uint32_t entry = appVectors[1]; return entry < 0x00001000 || entry >= 128 * 1024; } static bool test_banner_echo() { /* * At startup we print this banner out to the serial port. * If we see it echo back to us, we enter bootloader mode no matter what. * This is intended to be a foolproof way to enter recovery mode, even if other * circuitry has been connected to the serial port. */ static char banner[] = "FC-Boot"; const unsigned bannerLength = sizeof banner - 1; unsigned matched = 0; // Write banner serial_begin(BAUD2DIV(9600)); serial_write(banner, sizeof banner - 1); // Newline is not technically part of the banner, so we can do the RX check // at a time when we're sure the other characters have arrived in the RX fifo. serial_putchar('\n'); serial_flush(); while (matched < bannerLength) { if (serial_available() && serial_getchar() == banner[matched]) { matched++; } else { break; } } serial_end(); return matched == bannerLength; } static void app_launch() { // Relocate IVT to application flash __disable_irq(); SCB_VTOR = (uint32_t) &appVectors[0]; // Refresh watchdog right before launching app watchdog_refresh(); // Clear the boot token, so we don't repeatedly enter DFU mode. boot_token = 0; asm volatile ( "mov lr, %0 \n\t" "mov sp, %1 \n\t" "bx %2 \n\t" : : "r" (0xFFFFFFFF), "r" (appVectors[0]), "r" (appVectors[1]) ); } int main() { if (test_banner_echo() || test_app_missing() || test_boot_token()) { unsigned i, j; // We're doing DFU mode! led_init(); dfu_init(); usb_init(); // Wait for firmware download while (dfu_getstate() != dfuMANIFEST) { watchdog_refresh(); } // Clear boot token, to enter the new application boot_token = 0; // Wait a little bit longer, while flashing the LED. for (i = 11; i; --i) { led_toggle(); for (j = 100000; j; --j) { watchdog_refresh(); } } // USB disconnect and reboot, using watchdog to time 10ms. watchdog_refresh(); __disable_irq(); USB0_CONTROL = 0; while (1); } app_launch(); return 0; }
/* --------------------------------------------------------------------------- Open Asset Import Library (assimp) --------------------------------------------------------------------------- Copyright (c) 2006-2019, assimp team All rights reserved. Redistribution and use of this software 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 the assimp team, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of the assimp team. 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. --------------------------------------------------------------------------- */ /** @file pbrmaterial.h * @brief Defines the material system of the library */ #pragma once #ifndef AI_PBRMATERIAL_H_INC #define AI_PBRMATERIAL_H_INC #ifdef __GNUC__ # pragma GCC system_header #endif #define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR "$mat.gltf.pbrMetallicRoughness.baseColorFactor", 0, 0 #define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR "$mat.gltf.pbrMetallicRoughness.metallicFactor", 0, 0 #define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR "$mat.gltf.pbrMetallicRoughness.roughnessFactor", 0, 0 #define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE aiTextureType_DIFFUSE, 1 #define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 0 #define AI_MATKEY_GLTF_ALPHAMODE "$mat.gltf.alphaMode", 0, 0 #define AI_MATKEY_GLTF_ALPHACUTOFF "$mat.gltf.alphaCutoff", 0, 0 #define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS "$mat.gltf.pbrSpecularGlossiness", 0, 0 #define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR "$mat.gltf.pbrMetallicRoughness.glossinessFactor", 0, 0 #define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0 #define _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE "$tex.file.texCoord" #define _AI_MATKEY_GLTF_MAPPINGNAME_BASE "$tex.mappingname" #define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid" #define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag" #define _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE "$tex.mappingfiltermin" #define _AI_MATKEY_GLTF_SCALE_BASE "$tex.scale" #define _AI_MATKEY_GLTF_STRENGTH_BASE "$tex.strength" #define AI_MATKEY_GLTF_TEXTURE_TEXCOORD(type, N) _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE, type, N #define AI_MATKEY_GLTF_MAPPINGNAME(type, N) _AI_MATKEY_GLTF_MAPPINGNAME_BASE, type, N #define AI_MATKEY_GLTF_MAPPINGID(type, N) _AI_MATKEY_GLTF_MAPPINGID_BASE, type, N #define AI_MATKEY_GLTF_MAPPINGFILTER_MAG(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE, type, N #define AI_MATKEY_GLTF_MAPPINGFILTER_MIN(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE, type, N #define AI_MATKEY_GLTF_TEXTURE_SCALE(type, N) _AI_MATKEY_GLTF_SCALE_BASE, type, N #define AI_MATKEY_GLTF_TEXTURE_STRENGTH(type, N) _AI_MATKEY_GLTF_STRENGTH_BASE, type, N #endif //!!AI_PBRMATERIAL_H_INC
/* ---------------------------------------------------------------------- * Copyright (C) 2010-2014 ARM Limited. All rights reserved. * * $Date: 12. March 2014 * $Revision: V1.4.4 * * Project: CMSIS DSP Library * Title: arm_sin_f32.c * * Description: Fast sine calculation for floating-point values. * * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 * * 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 ARM LIMITED 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. * -------------------------------------------------------------------- */ #include "arm_math.h" #include "arm_common_tables.h" /** * @ingroup groupFastMath */ /** * @defgroup sin Sine * * Computes the trigonometric sine function using a combination of table lookup * and cubic interpolation. There are separate functions for * Q15, Q31, and floating-point data types. * The input to the floating-point version is in radians while the * fixed-point Q15 and Q31 have a scaled input with the range * [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a * value of 2*pi wraps around to 0. * * The implementation is based on table lookup using 256 values together with cubic interpolation. * The steps used are: * -# Calculation of the nearest integer table index * -# Fetch the four table values a, b, c, and d * -# Compute the fractional portion (fract) of the table index. * -# Calculation of wa, wb, wc, wd * -# The final result equals <code>a*wa + b*wb + c*wc + d*wd</code> * * where * <pre> * a=Table[index-1]; * b=Table[index+0]; * c=Table[index+1]; * d=Table[index+2]; * </pre> * and * <pre> * wa=-(1/6)*fract.^3 + (1/2)*fract.^2 - (1/3)*fract; * wb=(1/2)*fract.^3 - fract.^2 - (1/2)*fract + 1; * wc=-(1/2)*fract.^3+(1/2)*fract.^2+fract; * wd=(1/6)*fract.^3 - (1/6)*fract; * </pre> */ /** * @addtogroup sin * @{ */ /** * @brief Fast approximation to the trigonometric sine function for floating-point data. * @param[in] x input value in radians. * @return sin(x). */ float32_t arm_sin_f32( float32_t x) { float32_t sinVal, fract, in; /* Temporary variables for input, output */ uint16_t index; /* Index variable */ float32_t a, b; /* Two nearest output values */ int32_t n; float32_t findex; /* input x is in radians */ /* Scale the input to [0 1] range from [0 2*PI] , divide input by 2*pi */ in = x * 0.159154943092f; /* Calculation of floor value of input */ n = (int32_t) in; /* Make negative values towards -infinity */ if(x < 0.0f) { n--; } /* Map input value to [0 1] */ in = in - (float32_t) n; /* Calculation of index of the table */ findex = (float32_t) FAST_MATH_TABLE_SIZE * in; index = ((uint16_t)findex) & 0x1ff; /* fractional value calculation */ fract = findex - (float32_t) index; /* Read two nearest values of input value from the sin table */ a = sinTable_f32[index]; b = sinTable_f32[index+1]; /* Linear interpolation process */ sinVal = (1.0f-fract)*a + fract*b; /* Return the output value */ return (sinVal); } /** * @} end of sin group */
/* * GStreamer * Copyright (C) 2012 andol li <<andol@andol.info>> * Copyright (c) 2013 Sreerenj Balachandran <sreerenj.balachandran@intel.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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. * * Alternatively, the contents of this file may be used under the * GNU Lesser General Public License Version 2.1 (the "LGPL"), in * which case the following provisions apply instead of the ones * mentioned above: * * 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; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __GST_HANDDETECT_H__ #define __GST_HANDDETECT_H__ #include <gst/gst.h> #include <gst/video/video.h> #include <gst/video/navigation.h> #include "gstopencvvideofilter.h" /* opencv */ #include <cv.h> #include <cxcore.h> #include <highgui.h> #if (CV_MAJOR_VERSION >= 2) && (CV_MINOR_VERSION >= 2) #include <opencv2/objdetect/objdetect.hpp> #endif G_BEGIN_DECLS /* #defines don't like whitespacey bits */ #define GST_TYPE_HANDDETECT \ (gst_handdetect_get_type()) #define GST_HANDDETECT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HANDDETECT,GstHanddetect)) #define GST_HANDDETECT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HANDDETECT,GstHanddetectClass)) #define GST_IS_HANDDETECT(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HANDDETECT)) #define GST_IS_HANDDETECT_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HANDDETECT)) typedef struct _GstHanddetect GstHanddetect; typedef struct _GstHanddetectClass GstHanddetectClass; struct _GstHanddetect { GstOpencvVideoFilter element; gboolean display; gchar *profile_fist; gchar *profile_palm; /* region of interest */ guint roi_x; guint roi_y; guint roi_width; guint roi_height; /* opencv * cvGray - image to gray colour */ IplImage *cvGray; CvHaarClassifierCascade *cvCascade_fist; CvHaarClassifierCascade *cvCascade_palm; CvMemStorage *cvStorage; CvMemStorage *cvStorage_palm; CvRect *prev_r; CvRect *best_r; }; struct _GstHanddetectClass { GstOpencvVideoFilterClass parent_class; }; GType gst_handdetect_get_type (void); gboolean gst_handdetect_plugin_init (GstPlugin * plugin); G_END_DECLS #endif /* __GST_HANDDETECT_H__ */
/* * * Copyright (c) International Business Machines Corp., 2001 * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* * NAME * semget02.c * * DESCRIPTION * semget02 - test for EACCES and EEXIST errors * * ALGORITHM * create a semaphore set without read or alter permissions * loop if that option was specified * call semget() using two different invalid cases * check the errno value * issue a PASS message if we get EACCES or EEXIST * otherwise, the tests fails * issue a FAIL message * call cleanup * * USAGE: <for command-line> * semget02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] * where, -c n : Run n copies concurrently. * -e : Turn on errno logging. * -i n : Execute test n times. * -I x : Execute test for x seconds. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * HISTORY * 03/2001 - Written by Wayne Boyer * * RESTRICTIONS * none */ #include <pwd.h> #include "../lib/ipcsem.h" char *TCID = "semget02"; int TST_TOTAL = 2; char nobody_uid[] = "nobody"; struct passwd *ltpuser; int sem_id_1 = -1; struct test_case_t { int flags; int error; } TC[] = { /* EACCES - the semaphore has no read or alter permissions */ { SEM_RA, EACCES}, /* EEXIST - the semaphore id exists and semget() was called with */ /* IPC_CREAT and IPC_EXCL */ { IPC_CREAT | IPC_EXCL, EEXIST} }; int main(int ac, char **av) { int lc; int i; tst_parse_opts(ac, av, NULL, NULL); setup(); /* global setup */ /* The following loop checks looping state if -i option given */ for (lc = 0; TEST_LOOPING(lc); lc++) { /* reset tst_count in case we are looping */ tst_count = 0; for (i = 0; i < TST_TOTAL; i++) { /* use the TEST macro to make the call */ TEST(semget(semkey, PSEMS, TC[i].flags)); if (TEST_RETURN != -1) { sem_id_1 = TEST_RETURN; tst_resm(TFAIL, "call succeeded"); continue; } if (TEST_ERRNO == TC[i].error) { tst_resm(TPASS, "expected failure - errno " "= %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); } else { tst_resm(TFAIL, "unexpected error - %d : %s", TEST_ERRNO, strerror(TEST_ERRNO)); } } } cleanup(); tst_exit(); } /* * setup() - performs all the ONE TIME setup for this test. */ void setup(void) { tst_require_root(); /* Switch to nobody user for correct error code collection */ ltpuser = getpwnam(nobody_uid); if (seteuid(ltpuser->pw_uid) == -1) { tst_resm(TINFO, "setreuid failed to " "to set the effective uid to %d", ltpuser->pw_uid); perror("setreuid"); } tst_sig(NOFORK, DEF_HANDLER, cleanup); TEST_PAUSE; /* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. * See ../lib/libipc.c for more information. */ tst_tmpdir(); /* get an IPC resource key */ semkey = getipckey(); /* create a semaphore set without read or alter permissions */ if ((sem_id_1 = semget(semkey, PSEMS, IPC_CREAT | IPC_EXCL)) == -1) { tst_brkm(TBROK, cleanup, "couldn't create semaphore in setup"); } } /* * cleanup() - performs all the ONE TIME cleanup for this test at completion * or premature exit. */ void cleanup(void) { /* if it exists, remove the semaphore resource */ rm_sema(sem_id_1); tst_rmdir(); }
/* A substitute <strings.h>. Copyright (C) 2007-2014 Free Software Foundation, Inc. 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, 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/>. */ #ifndef _@GUARD_PREFIX@_STRINGS_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ /* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>. But avoid namespace pollution on glibc systems. */ #if defined __minix && !defined __GLIBC__ # include <sys/types.h> #endif /* The include_next requires a split double-inclusion guard. */ #if @HAVE_STRINGS_H@ # @INCLUDE_NEXT@ @NEXT_STRINGS_H@ #endif #ifndef _@GUARD_PREFIX@_STRINGS_H #define _@GUARD_PREFIX@_STRINGS_H #if ! @HAVE_DECL_STRNCASECMP@ /* Get size_t. */ # include <stddef.h> #endif /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ /* The definition of _GL_WARN_ON_USE is copied here. */ #ifdef __cplusplus extern "C" { #endif /* Find the index of the least-significant set bit. */ #if @GNULIB_FFS@ # if !@HAVE_FFS@ _GL_FUNCDECL_SYS (ffs, int, (int i)); # endif _GL_CXXALIAS_SYS (ffs, int, (int i)); _GL_CXXALIASWARN (ffs); #elif defined GNULIB_POSIXCHECK # undef ffs # if HAVE_RAW_DECL_FFS _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module"); # endif #endif /* Compare strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function does not work in multibyte locales. */ #if ! @HAVE_STRCASECMP@ extern int strcasecmp (char const *s1, char const *s2) _GL_ARG_NONNULL ((1, 2)); #endif #if defined GNULIB_POSIXCHECK /* strcasecmp() does not work with multibyte strings: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strcasecmp # if HAVE_RAW_DECL_STRCASECMP _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character " "strings in multibyte locales - " "use mbscasecmp if you care about " "internationalization, or use c_strcasecmp , " "gnulib module c-strcase) if you want a locale " "independent function"); # endif #endif /* Compare no more than N bytes of strings S1 and S2, ignoring case, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. Note: This function cannot work correctly in multibyte locales. */ #if ! @HAVE_DECL_STRNCASECMP@ extern int strncasecmp (char const *s1, char const *s2, size_t n) _GL_ARG_NONNULL ((1, 2)); #endif #if defined GNULIB_POSIXCHECK /* strncasecmp() does not work with multibyte strings: POSIX says that it operates on "strings", and "string" in POSIX is defined as a sequence of bytes, not of characters. */ # undef strncasecmp # if HAVE_RAW_DECL_STRNCASECMP _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character " "strings in multibyte locales - " "use mbsncasecmp or mbspcasecmp if you care about " "internationalization, or use c_strncasecmp , " "gnulib module c-strcase) if you want a locale " "independent function"); # endif #endif #ifdef __cplusplus } #endif #endif /* _@GUARD_PREFIX@_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */
//* This file is part of the MOOSE framework //* https://www.mooseframework.org //* //* All rights reserved, see COPYRIGHT for full restrictions //* https://github.com/idaholab/moose/blob/master/COPYRIGHT //* //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html #pragma once // MOOSE includes #include "AddVariableAction.h" // Forward declarations class AddAuxVariableAction; template <> InputParameters validParams<AddAuxVariableAction>(); /** * Action for creating Auxiliary variables */ class AddAuxVariableAction : public AddVariableAction { public: /** * Class constructor */ static InputParameters validParams(); AddAuxVariableAction(InputParameters params); /** * Returns available families for AuxVariables * @return MooseEnum with the valid familes for AuxVariables */ static MooseEnum getAuxVariableFamilies(); /** * Returns available orders for AuxVariables * @return MooseEnum with valid orders */ static MooseEnum getAuxVariableOrders(); protected: void init() override; };
/* * OpenMAMA: The open middleware agnostic messaging API * Copyright (C) 2011 NYSE Technologies, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ #include "wombat/port.h" #include "wombat/wSemaphore.h" /** * Waiting on Win32 semaphore involves a system call and is very inefficient. When * we test to determine if the queue is empty with a Win32 semaphore * WaitForSingleObject consumes all the CPU!!!!. We can be much more efficient using * a critical section and not call WaitForSingleObject when there is nothing on the Queue. */ typedef struct { unsigned int mCount; HANDLE mEvent; CRITICAL_SECTION mCs; } sem_t; int wsem_init (wsem_t* result, int dummy, int count) { sem_t* sem = (sem_t*)malloc (sizeof (sem_t)); if (sem == NULL) { return 1; } *result = sem; sem->mCount = count; sem->mEvent = CreateEvent (NULL, TRUE, FALSE, NULL); if (sem->mEvent == INVALID_HANDLE_VALUE) { return 1; } InitializeCriticalSection (&sem->mCs); return 0; } int wsem_destroy (wsem_t* sem) { sem_t* impl = (sem_t*)(*sem); CloseHandle (impl->mEvent); DeleteCriticalSection (&impl->mCs); free (impl); return 0; } int wsem_post (wsem_t* sem) { sem_t* impl = (sem_t*)(*sem); EnterCriticalSection (&impl->mCs); impl->mCount++; /* MLS: we might be able to optimize here and only call SetEvent when the * count is 1; however, this would require extensive testing as a race * condition would stop dispatching altogether. I don't see any obvious * race conditions but I am a little concerned that there might be undefined * behavior when SetEvent and WaitForSingleObject race. MS does not * indicate this directly but the documentation for PulseEvent() mentions * some potential problems. We don't use pulse event for this reason. */ SetEvent (impl->mEvent); LeaveCriticalSection (&impl->mCs); return 0; } int wsem_wait (wsem_t* sem) { unsigned int t = INFINITE; return wsem_timedwait (sem, t); } int wsem_trywait (wsem_t* sem) { sem_t* impl = (sem_t*)(*sem); int wouldWait = 0; EnterCriticalSection (&impl->mCs); if (impl->mCount) { impl->mCount--; } else { wouldWait = 1; } LeaveCriticalSection (&impl->mCs); return wouldWait; } int wsem_getvalue (wsem_t* sem, int* items) { sem_t* impl = (sem_t*)(*sem); EnterCriticalSection (&impl->mCs); *items = impl->mCount; LeaveCriticalSection (&impl->mCs); return 0; } int wsem_timedwait (wsem_t* sem, unsigned int timeoutval) { DWORD ts = (DWORD) timeoutval; sem_t* impl = (sem_t*)(*sem); int wait = 0; do { EnterCriticalSection (&impl->mCs); if (impl->mCount <= 1) ResetEvent (impl->mEvent); if (impl->mCount) { impl->mCount--; LeaveCriticalSection (&impl->mCs); return 0; } LeaveCriticalSection (&impl->mCs); } while (WAIT_OBJECT_0 == WaitForSingleObject (impl->mEvent, ts)); /* Time out or worse */ return -1; }
#include <math.h> #if (__ARM_PCS_VFP || (__VFP_FP__ && !__SOFTFP__)) && !BROKEN_VFP_ASM float sqrtf(float x) { __asm__ ("vsqrt.f32 %0, %1" : "=t"(x) : "t"(x)); return x; } #else #include "../sqrtf.c" #endif
/* BLIS An object-based framework for developing high-performance BLAS-like libraries. Copyright (C) 2014, The University of Texas at Austin 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 The University of Texas at Austin 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 HOLDER 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. */ void bli_hemm_front ( side_t side, obj_t* alpha, obj_t* a, obj_t* b, obj_t* beta, obj_t* c, cntx_t* cntx, cntl_t* cntl );
// // Copyright (c) 1990-2011, Scientific Toolworks, Inc. // // The License.txt file describes the conditions under which this software may be distributed. // // Author: Jason Haslam // // Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware // Scintilla platform layer for Qt #ifndef PLATQT_H #define PLATQT_H #include "Platform.h" #include <QPaintDevice> #include <QPainter> #include <QHash> #ifdef SCI_NAMESPACE namespace Scintilla { #endif const char *CharacterSetID(int characterSet); inline QColor QColorFromCA(ColourDesired ca) { long c = ca.AsLong(); return QColor(c & 0xff, (c >> 8) & 0xff, (c >> 16) & 0xff); } inline QRect QRectFromPRect(PRectangle pr) { return QRect(pr.left, pr.top, pr.Width(), pr.Height()); } inline PRectangle PRectFromQRect(QRect qr) { return PRectangle(qr.x(), qr.y(), qr.x() + qr.width(), qr.y() + qr.height()); } inline Point PointFromQPoint(QPoint qp) { return Point(qp.x(), qp.y()); } class SurfaceImpl : public Surface { private: QPaintDevice *device; QPainter *painter; bool deviceOwned; bool painterOwned; float x, y; bool unicodeMode; int codePage; const char *codecName; QTextCodec *codec; public: SurfaceImpl(); virtual ~SurfaceImpl(); virtual void Init(WindowID wid); virtual void Init(SurfaceID sid, WindowID wid); virtual void InitPixMap(int width, int height, Surface *surface, WindowID wid); virtual void Release(); virtual bool Initialised(); virtual void PenColour(ColourDesired fore); virtual int LogPixelsY(); virtual int DeviceHeightFont(int points); virtual void MoveTo(int x, int y); virtual void LineTo(int x, int y); virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back); virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void FillRectangle(PRectangle rc, ColourDesired back); virtual void FillRectangle(PRectangle rc, Surface &surfacePattern); virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void AlphaRectangle(PRectangle rc, int corner, ColourDesired fill, int alphaFill, ColourDesired outline, int alphaOutline, int flags); virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource); virtual void DrawTextNoClip(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); virtual void DrawTextClipped(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); virtual void DrawTextTransparent(PRectangle rc, Font &font, XYPOSITION ybase, const char *s, int len, ColourDesired fore); virtual void MeasureWidths(Font &font, const char *s, int len, XYPOSITION *positions); virtual XYPOSITION WidthText(Font &font, const char *s, int len); virtual XYPOSITION WidthChar(Font &font, char ch); virtual XYPOSITION Ascent(Font &font); virtual XYPOSITION Descent(Font &font); virtual XYPOSITION InternalLeading(Font &font); virtual XYPOSITION ExternalLeading(Font &font); virtual XYPOSITION Height(Font &font); virtual XYPOSITION AverageCharWidth(Font &font); virtual void SetClip(PRectangle rc); virtual void FlushCachedState(); virtual void SetUnicodeMode(bool unicodeMode); virtual void SetDBCSMode(int codePage); void BrushColour(ColourDesired back); void SetCodec(Font &font); void SetFont(Font &font); QPaintDevice *GetPaintDevice(); void SetPainter(QPainter *painter); QPainter *GetPainter(); }; #ifdef SCI_NAMESPACE } #endif #endif
// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #pragma once #include "afxcontrolbarutil.h" #include "afxpanedivider.h" #ifdef _AFX_PACKING #pragma pack(push, _AFX_PACKING) #endif #ifdef _AFX_MINREBUILD #pragma component(minrebuild, off) #endif class CPane; class CPaneContainer; class CPaneContainerManager : public CObject { friend class CPaneContainer; friend class CMultiPaneFrameWnd; friend class CRecentPaneContainerInfo; DECLARE_DYNCREATE(CPaneContainerManager) public: CPaneContainerManager(); virtual ~CPaneContainerManager(); virtual BOOL Create(CWnd* pParentWnd, CPaneDivider* pDefaultSlider, CRuntimeClass* pContainerRTC = NULL); void SetPaneContainerRTC(CRuntimeClass* pContainerRTC) { m_pContainerRTC = pContainerRTC; } CRuntimeClass* GetPaneContainerRTC() const { return m_pContainerRTC; } virtual BOOL AddPaneContainerManager(CPaneContainerManager& srcManager, BOOL bOuterEdge); virtual BOOL AddPaneContainerManager(CDockablePane* pTargetControlBar, DWORD dwAlignment, CPaneContainerManager& srcManager, BOOL bCopy); virtual BOOL AddPaneContainerManagerToDockablePane(CDockablePane* pTargetControlBar, CPaneContainerManager& srcManager); virtual void AddPane(CDockablePane* pControlBarToAdd); virtual CDockablePane* AddPaneToRecentPaneContainer(CDockablePane* pBarToAdd, CPaneContainer* pRecentContainer); virtual BOOL InsertPane(CDockablePane* pControlBarToInsert, CDockablePane* pTargetControlBar, DWORD dwAlignment, LPCRECT lpRect = NULL, AFX_DOCK_METHOD dockMethod = DM_UNKNOWN); virtual int OnPaneDividerMove(CPaneDivider* pSlider, UINT uFlags, int nOffset, HDWP& hdwp); virtual void GetWindowRect(CRect& rect) const; virtual void GetAvailableSpace(CRect& rect) const; virtual BOOL RemovePaneFromPaneContainer(CDockablePane* pControlBar); virtual void ResizePaneContainers(UINT nSide, BOOL bExpand, int nOffset, HDWP& hdwp); virtual void ResizePaneContainers(CRect rect, HDWP& hdwp); virtual BOOL ReplacePane(CDockablePane* pBarOld, CDockablePane* pBarNew); virtual void GetMinMaxOffset(CPaneDivider* pSlider, int& nMinOffset, int& nMaxOffset, int& nStep); virtual BOOL OnShowPane(CDockablePane* pBar, BOOL bShow); virtual BOOL IsRootPaneContainerVisible() const; virtual void GetMinSize(CSize& size); virtual int GetVisiblePaneCount() const; virtual void EnableGrippers(BOOL bEnable); virtual void HideAll(); virtual BOOL DoesContainFloatingPane(); virtual BOOL DoesAllowDynInsertBefore() const; virtual CDockablePane* PaneFromPoint(CPoint point, int nSensitivity, BOOL bExactBar, BOOL& bIsTabArea, BOOL& bCaption); virtual BOOL CheckForMiniFrameAndCaption(CPoint point, CDockablePane** ppTargetControlBar); virtual CBasePane* GetFirstPane() const; virtual CWnd* GetDockSiteFrameWnd() { return m_pDockSite; } virtual CWnd* GetFirstVisiblePane() const; virtual BOOL CanBeAttached() const; CPaneDivider* GetDefaultPaneDivider() const {return m_pDefaultSlider;} void ReleaseEmptyPaneContainers(); void AddPaneToList(CDockablePane* pControlBarToAdd); BOOL IsEmpty() const; int GetTotalRefCount() const; int GetPaneCount() const { return(int)m_lstControlBars.GetCount(); } int GetNodeCount() const; virtual void SetResizeMode(BOOL bResize); virtual void RemovePaneDivider(CPaneDivider* pSlider); virtual void StoreRecentDockSiteInfo(CDockablePane* pBar); BOOL IsAutoHideMode() const { return (m_pDefaultSlider != NULL && m_pDefaultSlider->IsAutoHideMode()); } void SetDefaultPaneDividerForPanes(CPaneDivider* pSlider); void Serialize(CArchive& ar); CDockablePane* FindTabbedPane(UINT nID); virtual CPaneContainer* FindPaneContainer(CDockablePane* pBar, BOOL& bLeftBar); void AddPanesToList(CObList* plstControlBars, CObList* plstSliders); void RemoveAllPanesAndPaneDividers(); void CalcRects(CRect& rectOriginal, CRect& rectInserted, CRect& rectSlider, DWORD& dwSliderStyle, DWORD dwAlignment, CSize sizeMinOriginal, CSize sizeMinInserted); void NotifyPaneDivider(); void RemoveNonValidPanes(); BOOL CheckAndRemoveNonValidPane(CWnd* pWnd); protected: CPaneDivider* CreatePaneDivider(CRect rectSlider, DWORD dwSliderStyle, int nSliderID = -1); UINT FindPane(CPoint pt, CPane** ppBar, POSITION& posRet); UINT FindPane(CRect rect, CPane** ppBar, POSITION& posRet); BOOL AddPaneAndPaneDivider(CDockablePane* pBarOriginal, CDockablePane* pBarToInsert, POSITION posNearestBar, DWORD dwAlignment); BOOL AddPaneAndPaneContainer(CDockablePane* pBarOriginal, CPaneContainer* pContainerToInsert, DWORD dwAlignment); CObList m_lstControlBars; CObList m_lstSliders; CPaneContainer* m_pRootContainer; CRuntimeClass* m_pContainerRTC; CPaneDivider* m_pDefaultSlider; BOOL m_bDestroyRootContainer; CWnd* m_pDockSite; }; #ifdef _AFX_MINREBUILD #pragma component(minrebuild, on) #endif #ifdef _AFX_PACKING #pragma pack(pop) #endif
/* * fs/sdcardfs/mmap.c * * Copyright (c) 2013 Samsung Electronics Co. Ltd * Authors: Daeho Jeong, Woojoong Lee, Seunghwan Hyun, * Sunghwan Yun, Sungjong Seo * * This program has been developed as a stackable file system based on * the WrapFS which written by * * Copyright (c) 1998-2011 Erez Zadok * Copyright (c) 2009 Shrikar Archak * Copyright (c) 2003-2011 Stony Brook University * Copyright (c) 2003-2011 The Research Foundation of SUNY * * This file is dual licensed. It may be redistributed and/or modified * under the terms of the Apache 2.0 License OR version 2 of the GNU * General Public License. */ #include "sdcardfs.h" static int sdcardfs_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { int err; struct file *file, *lower_file; const struct vm_operations_struct *lower_vm_ops; struct vm_area_struct lower_vma; memcpy(&lower_vma, vma, sizeof(struct vm_area_struct)); file = lower_vma.vm_file; lower_vm_ops = SDCARDFS_F(file)->lower_vm_ops; BUG_ON(!lower_vm_ops); lower_file = sdcardfs_lower_file(file); /* * XXX: vm_ops->fault may be called in parallel. Because we have to * resort to temporarily changing the vma->vm_file to point to the * lower file, a concurrent invocation of sdcardfs_fault could see a * different value. In this workaround, we keep a different copy of * the vma structure in our stack, so we never expose a different * value of the vma->vm_file called to us, even temporarily. A * better fix would be to change the calling semantics of ->fault to * take an explicit file pointer. */ lower_vma.vm_file = lower_file; err = lower_vm_ops->fault(&lower_vma, vmf); return err; } /* XXX: to support direct I/O, a_ops->direct_IO shouldn't be null. */ static ssize_t sdcardfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs) { return -ENOTSUPP; } /* * XXX: the default address_space_ops for sdcardfs is empty. We cannot set * our inode->i_mapping->a_ops to NULL because too many code paths expect * the a_ops vector to be non-NULL. */ const struct address_space_operations sdcardfs_aops = { .direct_IO = sdcardfs_direct_IO, /* empty on purpose */ }; const struct vm_operations_struct sdcardfs_vm_ops = { .fault = sdcardfs_fault, };
/* sha1.c : Implementation of the Secure Hash Algorithm */ /* SHA: NIST's Secure Hash Algorithm */ /* This version written November 2000 by David Ireland of DI Management Services Pty Limited <code@di-mgt.com.au> Adapted from code in the Python Cryptography Toolkit, version 1.0.0 by A.M. Kuchling 1995. */ /* AM Kuchling's posting:- Based on SHA code originally posted to sci.crypt by Peter Gutmann in message <30ajo5$oe8@ccu2.auckland.ac.nz>. Modified to test for endianness on creation of SHA objects by AMK. Also, the original specification of SHA was found to have a weakness by NSA/NIST. This code implements the fixed version of SHA. */ /* Here's the first paragraph of Peter Gutmann's posting: The following is my SHA (FIPS 180) code updated to allow use of the "fixed" SHA, thanks to Jim Gillogly and an anonymous contributor for the information on what's changed in the new version. The fix is a simple change which involves adding a single rotate in the initial expansion function. It is unknown whether this is an optimal solution to the problem which was discovered in the SHA or whether it's simply a bandaid which fixes the problem with a minimum of effort (for example the reengineering of a great many Capstone chips). */ #include <stdio.h> #include <string.h> #include "tsk_os.h" #include "tsk_types.h" #include "global.h" #include "hash.h" #define SHA_HASH_LENGTH 20 #define SHA_BUFSIZ 1024 char * crunch(fp) FILE *fp; { unsigned char sum[SHA_HASH_LENGTH]; unsigned char buf[SHA_BUFSIZ]; static char result[2 * SHA_HASH_LENGTH + 1]; static char hex[] = "0123456789abcdef"; SHA_CTX sha; int i; int buflen; SHAInit(&sha); while ((buflen = fread(buf, 1, SHA_BUFSIZ, fp)) > 0) SHAUpdate(&sha, buf, buflen); SHAFinal(sum, &sha); for (i = 0; i < SHA_HASH_LENGTH; i++) { result[2 * i] = hex[(sum[i] >> 4) & 0xf]; result[2 * i + 1] = hex[sum[i] & 0xf]; } return (result); } int main(argc, argv) int argc; char **argv; { char *myname = argv[0]; char *crunch(); FILE *fp; if (argc < 2) { printf("%s\n", crunch(stdin)); } else { while (--argc && *++argv) { if ((fp = fopen(*argv, "r")) == 0) { fprintf(stderr, "%s: ", myname); perror(*argv); return (1); } printf("%s %s\n", crunch(fp), *argv); fclose(fp); } } return (0); }
/* * Makes a tree bootable image for IBM Evaluation boards. * Basically, just take a zImage, skip the ELF header, and stuff * a 32 byte header on the front. * * We use htonl, which is a network macro, to make sure we're doing * The Right Thing on an LE machine. It's non-obvious, but it should * work on anything BSD'ish. */ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> #include <netinet/in.h> #ifdef __sun__ #include <inttypes.h> #else #include <stdint.h> #endif /* This gets tacked on the front of the image. There are also a few * bytes allocated after the _start label used by the boot rom (see * head.S for details). */ typedef struct boot_block { uint32_t bb_magic; /* 0x0052504F */ uint32_t bb_dest; /* Target address of the image */ uint32_t bb_num_512blocks; /* Size, rounded-up, in 512 byte blks */ uint32_t bb_debug_flag; /* Run debugger or image after load */ uint32_t bb_entry_point; /* The image address to start */ uint32_t bb_checksum; /* 32 bit checksum including header */ uint32_t reserved[2]; } boot_block_t; #define IMGBLK 512 char tmpbuf[IMGBLK]; int main(int argc, char *argv[]) { int in_fd, out_fd; int nblks, i; uint cksum, *cp; struct stat st; boot_block_t bt; if (argc < 3) { fprintf(stderr, "usage: %s <zImage-file> <boot-image> [entry-point]\n",argv[0]); exit(1); } if (stat(argv[1], &st) < 0) { perror("stat"); exit(2); } nblks = (st.st_size + IMGBLK) / IMGBLK; bt.bb_magic = htonl(0x0052504F); /* If we have the optional entry point parameter, use it */ if (argc == 4) bt.bb_dest = bt.bb_entry_point = htonl(strtoul(argv[3], NULL, 0)); else bt.bb_dest = bt.bb_entry_point = htonl(0x500000); /* We know these from the linker command. * ...and then move it up into memory a little more so the * relocation can happen. */ bt.bb_num_512blocks = htonl(nblks); bt.bb_debug_flag = 0; bt.bb_checksum = 0; /* To be neat and tidy :-). */ bt.reserved[0] = 0; bt.reserved[1] = 0; if ((in_fd = open(argv[1], O_RDONLY)) < 0) { perror("zImage open"); exit(3); } if ((out_fd = open(argv[2], (O_RDWR | O_CREAT | O_TRUNC), 0666)) < 0) { perror("bootfile open"); exit(3); } cksum = 0; cp = (void *)&bt; for (i=0; i<sizeof(bt)/sizeof(uint); i++) cksum += *cp++; /* Assume zImage is an ELF file, and skip the 64K header. */ if (read(in_fd, tmpbuf, IMGBLK) != IMGBLK) { fprintf(stderr, "%s is too small to be an ELF image\n", argv[1]); exit(4); } if ((*(uint *)tmpbuf) != htonl(0x7f454c46)) { fprintf(stderr, "%s is not an ELF image\n", argv[1]); exit(4); } if (lseek(in_fd, (64 * 1024), SEEK_SET) < 0) { fprintf(stderr, "%s failed to seek in ELF image\n", argv[1]); exit(4); } nblks -= (64 * 1024) / IMGBLK; /* And away we go...... */ if (write(out_fd, &bt, sizeof(bt)) != sizeof(bt)) { perror("boot-image write"); exit(5); } while (nblks-- > 0) { if (read(in_fd, tmpbuf, IMGBLK) < 0) { perror("zImage read"); exit(5); } cp = (uint *)tmpbuf; for (i=0; i<sizeof(tmpbuf)/sizeof(uint); i++) cksum += *cp++; if (write(out_fd, tmpbuf, sizeof(tmpbuf)) != sizeof(tmpbuf)) { perror("boot-image write"); exit(5); } } /* rewrite the header with the computed checksum. */ bt.bb_checksum = htonl(cksum); if (lseek(out_fd, 0, SEEK_SET) < 0) { perror("rewrite seek"); exit(1); } if (write(out_fd, &bt, sizeof(bt)) != sizeof(bt)) { perror("boot-image rewrite"); exit(1); } exit(0); }
/* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once /*** Copyright ยฉ 2014 Intel Corporation. All rights reserved. ***/ #include "log.h" #include "time-util.h" #include "sd-ndisc.h" #define NDISC_ROUTER_SOLICITATION_INTERVAL (4U * USEC_PER_SEC) #define NDISC_MAX_ROUTER_SOLICITATION_INTERVAL (3600U * USEC_PER_SEC) #define NDISC_MAX_ROUTER_SOLICITATIONS 3U struct sd_ndisc { unsigned n_ref; int ifindex; int fd; sd_event *event; int event_priority; struct ether_addr mac_addr; uint8_t hop_limit; uint32_t mtu; sd_event_source *recv_event_source; sd_event_source *timeout_event_source; sd_event_source *timeout_no_ra; usec_t retransmit_time; sd_ndisc_callback_t callback; void *userdata; }; #define log_ndisc_errno(error, fmt, ...) log_internal(LOG_DEBUG, error, PROJECT_FILE, __LINE__, __func__, "NDISC: " fmt, ##__VA_ARGS__) #define log_ndisc(fmt, ...) log_ndisc_errno(0, fmt, ##__VA_ARGS__) const char* ndisc_event_to_string(sd_ndisc_event e) _const_; sd_ndisc_event ndisc_event_from_string(const char *s) _pure_;
/* { dg-do compile } */ /* { dg-options "-mavx512f -mno-avx512er -O2" } */ #include "pr82941-1.c" /* { dg-final { scan-assembler-times "vzeroupper" 1 } } */
/* * Copyright (C) 2005-2012 MaNGOS <http://getmangos.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTH_HMACSHA1_H #define _AUTH_HMACSHA1_H #include "Common.h" #include <openssl/hmac.h> #include <openssl/sha.h> class BigNumber; #define SEED_KEY_SIZE 16 class HMACSHA1 { public: HMACSHA1(uint32 len, uint8 *seed); ~HMACSHA1(); void UpdateBigNumber(BigNumber *bn); void UpdateData(const uint8 *data, int length); void UpdateData(const std::string &str); void Finalize(); uint8 *ComputeHash(BigNumber *bn); uint8 *GetDigest() { return (uint8*)m_digest; } int GetLength() { return SHA_DIGEST_LENGTH; } private: HMAC_CTX m_ctx; uint8 m_digest[SHA_DIGEST_LENGTH]; }; #endif
/** * Copyright (c) 2016 - 2017, Nordic Semiconductor ASA * * 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, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 MICRO_ECC_LIB_KEYS_H__ #define MICRO_ECC_LIB_KEYS_H__ /** @file * * @defgroup nrf_crypto_backend_micro_ecc_lib_ecc_keys micro-ecc backend ECC key types. * @{ * @ingroup nrf_crypto_backend_microecc * * @brief Provides types required for CC310 backend ECC keys. */ #include <stdint.h> #include "nrf_crypto_keys.h" #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif /**@} */ #endif // MICRO_ECC_LIB_KEYS_H__
// 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 EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ #define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_ #include <set> #include "base/memory/scoped_ptr.h" #include "base/scoped_observer.h" #include "extensions/common/host_id.h" namespace content { class BrowserContext; } namespace extensions { class UserScript; class UserScriptLoader; // Manages declarative user scripts for a single extension. Owns a // UserScriptLoader to which file loading and shared memory management // operations are delegated, and provides an interface for adding, removing, // and clearing scripts. class DeclarativeUserScriptMaster { public: DeclarativeUserScriptMaster(content::BrowserContext* browser_context, const HostID& host_id); ~DeclarativeUserScriptMaster(); // Adds script to shared memory region. This may not happen right away if a // script load is in progress. void AddScript(const UserScript& script); // Adds a set of scripts to shared meomory region. The fetch of the content // of the script on WebUI requires to start URL request to the associated // render specified by |render_process_id, render_view_id|. // This may not happen right away if a script load is in progress. void AddScripts(const std::set<UserScript>& scripts, int render_process_id, int render_view_id); // Removes script from shared memory region. This may not happen right away if // a script load is in progress. void RemoveScript(const UserScript& script); // Removes a set of scripts from shared memory region. This may not happen // right away if a script load is in progress. void RemoveScripts(const std::set<UserScript>& scripts); // Removes all scripts from shared memory region. This may not happen right // away if a script load is in progress. void ClearScripts(); const HostID& host_id() const { return host_id_; } UserScriptLoader* loader() { return loader_.get(); } private: // ID of host that owns scripts that this component manages. HostID host_id_; // Script loader that handles loading contents of scripts into shared memory // and notifying renderers of script updates. scoped_ptr<UserScriptLoader> loader_; DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster); }; } // namespace extensions #endif // EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
// Set up so TypeInt only defined during InconsistentHeader1.h include. #ifdef SYMBOL1 #define SYMBOL 1 #define FUNC_STYLE(a, b) a||b #endif #ifdef SYMBOL2 #define SYMBOL 2 #define FUNC_STYLE(a, b) a&&b #endif #if SYMBOL == 1 typedef int TypeInt; #endif int var = FUNC_STYLE(1, 0); #if defined(SYMBOL1) #endif
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Renesas SuperH DMA Engine support * * Copyright (C) 2009 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> * Copyright (C) 2009 Renesas Solutions, Inc. All rights reserved. * */ #ifndef __DMA_SHDMA_H #define __DMA_SHDMA_H #include <linux/sh_dma.h> #include <linux/shdma-base.h> #include <linux/dmaengine.h> #include <linux/interrupt.h> #include <linux/list.h> #define SH_DMAE_MAX_CHANNELS 20 #define SH_DMAE_TCR_MAX 0x00FFFFFF /* 16MB */ struct device; struct sh_dmae_chan { struct shdma_chan shdma_chan; const struct sh_dmae_slave_config *config; /* Slave DMA configuration */ int xmit_shift; /* log_2(bytes_per_xfer) */ void __iomem *base; char dev_id[16]; /* unique name per DMAC of channel */ int pm_error; dma_addr_t slave_addr; }; struct sh_dmae_device { struct shdma_dev shdma_dev; struct sh_dmae_chan *chan[SH_DMAE_MAX_CHANNELS]; const struct sh_dmae_pdata *pdata; struct list_head node; void __iomem *chan_reg; void __iomem *dmars; unsigned int chcr_offset; u32 chcr_ie_bit; }; struct sh_dmae_regs { u32 sar; /* SAR / source address */ u32 dar; /* DAR / destination address */ u32 tcr; /* TCR / transfer count */ }; struct sh_dmae_desc { struct sh_dmae_regs hw; struct shdma_desc shdma_desc; }; #define to_sh_chan(chan) container_of(chan, struct sh_dmae_chan, shdma_chan) #define to_sh_desc(lh) container_of(lh, struct sh_desc, node) #define tx_to_sh_desc(tx) container_of(tx, struct sh_desc, async_tx) #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\ struct sh_dmae_device, shdma_dev.dma_dev) #ifdef CONFIG_SH_DMAE_R8A73A4 extern const struct sh_dmae_pdata r8a73a4_dma_pdata; #define r8a73a4_shdma_devid (&r8a73a4_dma_pdata) #else #define r8a73a4_shdma_devid NULL #endif #endif /* __DMA_SHDMA_H */
#ifndef prtypes_h___ #define prtypes_h___ typedef bool PRBool; typedef uint8_t PRUint8; typedef int16_t PRInt16; typedef uint16_t PRUint16; typedef int32_t PRInt32; typedef uint32_t PRUint32; typedef int64_t PRInt64; typedef uint64_t PRUint64; typedef PRUint16 PRUnichar; #endif /* prtypes_h___ */
/* * Copyright (C) 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ArchiveResource_h #define ArchiveResource_h #include "SubstituteResource.h" #include "PlatformString.h" namespace WebCore { class ArchiveResource : public SubstituteResource { public: static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const ResourceResponse&); static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); static PassRefPtr<ArchiveResource> create(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); const String& mimeType() const { return m_mimeType; } const String& textEncoding() const { return m_textEncoding; } const String& frameName() const { return m_frameName; } void ignoreWhenUnarchiving() { m_shouldIgnoreWhenUnarchiving = true; } bool shouldIgnoreWhenUnarchiving() const { return m_shouldIgnoreWhenUnarchiving; } private: ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const ResourceResponse&); ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName); ArchiveResource(PassRefPtr<SharedBuffer>, const KURL&, const String& mimeType, const String& textEncoding, const String& frameName, const ResourceResponse&); String m_mimeType; String m_textEncoding; String m_frameName; bool m_shouldIgnoreWhenUnarchiving; }; } #endif // ArchiveResource_h
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _decimal_h #define _decimal_h typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode; typedef int32 decimal_digit_t; /** intg is the number of *decimal* digits (NOT number of decimal_digit_t's !) before the point frac is the number of decimal digits after the point len is the length of buf (length of allocated space) in decimal_digit_t's, not in bytes sign false means positive, true means negative buf is an array of decimal_digit_t's */ typedef struct st_decimal_t { int intg, frac, len; my_bool sign; decimal_digit_t *buf; } decimal_t; int internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed); int decimal2string(const decimal_t *from, char *to, int *to_len, int fixed_precision, int fixed_decimals, char filler); int decimal2ulonglong(decimal_t *from, ulonglong *to); int ulonglong2decimal(ulonglong from, decimal_t *to); int decimal2longlong(decimal_t *from, longlong *to); int longlong2decimal(longlong from, decimal_t *to); int decimal2double(const decimal_t *from, double *to); int double2decimal(double from, decimal_t *to); int decimal_actual_fraction(decimal_t *from); int decimal2bin(decimal_t *from, uchar *to, int precision, int scale); int bin2decimal(const uchar *from, decimal_t *to, int precision, int scale); /** Convert decimal to lldiv_t. The integer part is stored in to->quot. The fractional part is multiplied to 10^9 and stored to to->rem. @param from Decimal value @param to lldiv_t value @retval 0 on success @retval !0 in error */ int decimal2lldiv_t(const decimal_t *from, lldiv_t *to); /** Convert doube to lldiv_t. The integer part is stored in to->quot. The fractional part is multiplied to 10^9 and stored to to->rem. @param from Decimal value @param to lldiv_t value @retval 0 on success @retval !0 in error */ int double2lldiv_t(double from, lldiv_t *to); int decimal_size(int precision, int scale); int decimal_bin_size(int precision, int scale); int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param); int decimal_intg(const decimal_t *from); int decimal_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_cmp(const decimal_t *from1, const decimal_t *from2); int decimal_mul(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_div(const decimal_t *from1, const decimal_t *from2, decimal_t *to, int scale_incr); int decimal_mod(const decimal_t *from1, const decimal_t *from2, decimal_t *to); int decimal_round(const decimal_t *from, decimal_t *to, int new_scale, decimal_round_mode mode); int decimal_is_zero(const decimal_t *from); void max_decimal(int precision, int frac, decimal_t *to); #define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0) #define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1) /* set a decimal_t to zero */ #define decimal_make_zero(dec) do { \ (dec)->buf[0]=0; \ (dec)->intg=1; \ (dec)->frac=0; \ (dec)->sign=0; \ } while(0) /* returns the length of the buffer to hold string representation of the decimal (including decimal dot, possible sign and \0) */ #define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \ (dec)->frac + ((dec)->frac > 0) + 2) /* negate a decimal */ #define decimal_neg(dec) do { (dec)->sign^=1; } while(0) /* conventions: decimal_smth() == 0 -- everything's ok decimal_smth() <= 1 -- result is usable, but precision loss is possible decimal_smth() <= 2 -- result can be unusable, most significant digits could've been lost decimal_smth() > 2 -- no result was generated */ #define E_DEC_OK 0 #define E_DEC_TRUNCATED 1 #define E_DEC_OVERFLOW 2 #define E_DEC_DIV_ZERO 4 #define E_DEC_BAD_NUM 8 #define E_DEC_OOM 16 #define E_DEC_ERROR 31 #define E_DEC_FATAL_ERROR 30 #endif
//===----- CXXABI.h - Interface to C++ ABIs ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This provides an abstract class for C++ AST support. Concrete // subclasses of this implement AST support for specific C++ ABIs. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_AST_CXXABI_H #define LLVM_CLANG_LIB_AST_CXXABI_H #include "clang/AST/Type.h" namespace clang { class ASTContext; class MemberPointerType; class MangleNumberingContext; /// Implements C++ ABI-specific semantic analysis functions. class CXXABI { public: virtual ~CXXABI(); /// Returns the width and alignment of a member pointer in bits. virtual std::pair<uint64_t, unsigned> getMemberPointerWidthAndAlign(const MemberPointerType *MPT) const = 0; /// Returns the default calling convention for C++ methods. virtual CallingConv getDefaultMethodCallConv(bool isVariadic) const = 0; /// Returns whether the given class is nearly empty, with just virtual /// pointers and no data except possibly virtual bases. virtual bool isNearlyEmpty(const CXXRecordDecl *RD) const = 0; /// Returns a new mangling number context for this C++ ABI. virtual MangleNumberingContext *createMangleNumberingContext() const = 0; }; /// Creates an instance of a C++ ABI class. CXXABI *CreateItaniumCXXABI(ASTContext &Ctx); CXXABI *CreateMicrosoftCXXABI(ASTContext &Ctx); } #endif
/*************************************************************** * Name: [FILENAME_PREFIX]Main.h * Purpose: Defines Application Frame * Author: [AUTHOR_NAME] ([AUTHOR_EMAIL]) * Created: [NOW] * Copyright: [AUTHOR_NAME] ([AUTHOR_WWW]) * License: **************************************************************/ #ifndef [PROJECT_HDR]MAIN_H #define [PROJECT_HDR]MAIN_H [IF WXFRAME]//(*Headers([CLASS_PREFIX]Frame) //*) class [CLASS_PREFIX]Frame: public wxFrame { public: [CLASS_PREFIX]Frame(wxWindow* parent,wxWindowID id = -1); virtual ~[CLASS_PREFIX]Frame(); private: //(*Handlers([CLASS_PREFIX]Frame) void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); //*) //(*Identifiers([CLASS_PREFIX]Frame) //*) //(*Declarations([CLASS_PREFIX]Frame) //*) DECLARE_EVENT_TABLE() };[ENDIF WXFRAME][IF WXDIALOG]//(*Headers([CLASS_PREFIX]Dialog) //*) class [CLASS_PREFIX]Dialog: public wxDialog { public: [CLASS_PREFIX]Dialog(wxWindow* parent,wxWindowID id = -1); virtual ~[CLASS_PREFIX]Dialog(); private: //(*Handlers([CLASS_PREFIX]Dialog) void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); //*) //(*Identifiers([CLASS_PREFIX]Dialog) //*) //(*Declarations([CLASS_PREFIX]Dialog) //*) DECLARE_EVENT_TABLE() };[ENDIF WXDIALOG] #endif // [PROJECT_HDR]MAIN_H
/*! \file usbh_ctrl.h \brief header file for usbh_ctrl.c */ /* Copyright (C) 2017 GigaDevice 2017-02-10, V1.0.0, firmware for GD32F30x */ #ifndef USBH_CTRL_H #define USBH_CTRL_H #include "usbh_core.h" #include "usbh_usr.h" #define CTRL_HANDLE_TABLE_SIZE 13U /*!< the ctrl handle table size define */ extern state_table_struct ctrl_handle_table[CTRL_HANDLE_TABLE_SIZE]; extern uint8_t ctrl_polling_handle_flag; /* the enum of CTRL event */ typedef enum { CTRL_EVENT_IDLE = 0, /* the ctrl idle event */ CTRL_EVENT_SETUP, /* the ctrl setup event */ CTRL_EVENT_DATA, /* the ctrl data event */ CTRL_EVENT_STATUS, /* the ctrl status event */ CTRL_EVENT_COMPLETE, /* the ctrl complete event */ CTRL_EVENT_ERROR, /* the ctrl error event */ CTRL_EVENT_STALLED, /* the ctrl stalled event */ }ctrl_event_enum; /* function declarations */ /* the polling function of control transfer state handle */ usbh_status_enum ctrl_state_polling_fun (usb_core_handle_struct *pudev, usbh_host_struct *puhost, void *pustate); /* send datas from the host channel */ usbh_status_enum usbh_xfer (usb_core_handle_struct *pudev, uint8_t *buf, uint8_t hc_num, uint16_t len); /* send the setup packet to the device */ usbh_status_enum usbh_ctltx_setup (usb_core_handle_struct *pudev, uint8_t *buf, uint8_t hc_num); /* this function prepare a hc and start a transfer */ uint32_t hcd_submit_request (usb_core_handle_struct *pudev, uint8_t channel_num); #endif /* USBH_CTRL_H */
//================================================================================================= /*! // \file blaze/math/typetraits/IsVecScalarDivExpr.h // \brief Header file for the IsVecScalarDivExpr type trait class // // Copyright (C) 2013 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group 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 HOLDER 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 _BLAZE_MATH_TYPETRAITS_ISVECSCALARDIVEXPR_H_ #define _BLAZE_MATH_TYPETRAITS_ISVECSCALARDIVEXPR_H_ //************************************************************************************************* // Includes //************************************************************************************************* #include <boost/type_traits/is_base_of.hpp> #include <blaze/math/expressions/VecScalarDivExpr.h> #include <blaze/util/FalseType.h> #include <blaze/util/SelectType.h> #include <blaze/util/TrueType.h> namespace blaze { //================================================================================================= // // CLASS DEFINITION // //================================================================================================= //************************************************************************************************* /*! \cond BLAZE_INTERNAL */ /*!\brief Auxiliary helper struct for the IsVecScalarDivExpr type trait. // \ingroup math_type_traits */ template< typename T > struct IsVecScalarDivExprHelper { //********************************************************************************************** enum { value = boost::is_base_of<VecScalarDivExpr,T>::value && !boost::is_base_of<T,VecScalarDivExpr>::value }; typedef typename SelectType<value,TrueType,FalseType>::Type Type; //********************************************************************************************** }; /*! \endcond */ //************************************************************************************************* //************************************************************************************************* /*!\brief Compile time check whether the given type is a vector/scalar division expression // template. // \ingroup math_type_traits // // This type trait class tests whether or not the given type \a Type is a vector/scalar // division expression template. In order to qualify as a valid vector/scalar division // expression template, the given type has to derive (publicly or privately) from the // VecScalarDivExpr base class. In case the given type is a valid vector/scalar division // expression template, the \a value member enumeration is set to 1, the nested type // definition \a Type is \a TrueType, and the class derives from \a TrueType. Otherwise // \a value is set to 0, \a Type is \a FalseType, and the class derives from \a FalseType. */ template< typename T > struct IsVecScalarDivExpr : public IsVecScalarDivExprHelper<T>::Type { public: //********************************************************************************************** /*! \cond BLAZE_INTERNAL */ enum { value = IsVecScalarDivExprHelper<T>::value }; typedef typename IsVecScalarDivExprHelper<T>::Type Type; /*! \endcond */ //********************************************************************************************** }; //************************************************************************************************* } // namespace blaze #endif
/*--------------------------------------------------------------------*/ /*--- Callgrind ---*/ /*--- ct_costs.c ---*/ /*--------------------------------------------------------------------*/ /* This file is part of Callgrind, a Valgrind tool for call tracing. Copyright (C) 2002-2017, Josef Weidendorfer (Josef.Weidendorfer@gmx.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. The GNU General Public License is contained in the file COPYING. */ #include "global.h" #include "pub_tool_mallocfree.h" #define COSTCHUNK_SIZE 100000 UInt CLG_(costarray_entries) = 0; UInt CLG_(costarray_chunks) = 0; static CostChunk* cost_chunk_base = 0; static CostChunk* cost_chunk_current = 0; ULong* CLG_(get_costarray)(Int size) { ULong* ptr; if (!cost_chunk_current || (cost_chunk_current->size - cost_chunk_current->used < size)) { CostChunk* cc = (CostChunk*) CLG_MALLOC("cl.costs.gc.1", sizeof(CostChunk) + COSTCHUNK_SIZE * sizeof(ULong)); CLG_ASSERT(size < COSTCHUNK_SIZE); cc->size = COSTCHUNK_SIZE; cc->used = 0; cc->next = 0; if (cost_chunk_current) cost_chunk_current->next = cc; cost_chunk_current = cc; if (!cost_chunk_base) cost_chunk_base = cc; CLG_(costarray_chunks)++; } ptr = &(cost_chunk_current->data[cost_chunk_current->used]); cost_chunk_current->used += size; CLG_(costarray_entries) += size; return ptr; }
/* * Copyright 2004 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_BASE_JSON_H_ #define WEBRTC_BASE_JSON_H_ #include <string> #include <vector> #if !defined(WEBRTC_EXTERNAL_JSON) #include "json/json.h" #else #include "third_party/jsoncpp/json.h" #endif // TODO: Move to rtc namespace /////////////////////////////////////////////////////////////////////////////// // JSON Helpers /////////////////////////////////////////////////////////////////////////////// // Robust conversion operators, better than the ones in JsonCpp. bool GetIntFromJson(const Json::Value& in, int* out); bool GetUIntFromJson(const Json::Value& in, unsigned int* out); bool GetStringFromJson(const Json::Value& in, std::string* out); bool GetBoolFromJson(const Json::Value& in, bool* out); bool GetDoubleFromJson(const Json::Value& in, double* out); // Pull values out of a JSON array. bool GetValueFromJsonArray(const Json::Value& in, size_t n, Json::Value* out); bool GetIntFromJsonArray(const Json::Value& in, size_t n, int* out); bool GetUIntFromJsonArray(const Json::Value& in, size_t n, unsigned int* out); bool GetStringFromJsonArray(const Json::Value& in, size_t n, std::string* out); bool GetBoolFromJsonArray(const Json::Value& in, size_t n, bool* out); bool GetDoubleFromJsonArray(const Json::Value& in, size_t n, double* out); // Convert json arrays to std::vector bool JsonArrayToValueVector(const Json::Value& in, std::vector<Json::Value>* out); bool JsonArrayToIntVector(const Json::Value& in, std::vector<int>* out); bool JsonArrayToUIntVector(const Json::Value& in, std::vector<unsigned int>* out); bool JsonArrayToStringVector(const Json::Value& in, std::vector<std::string>* out); bool JsonArrayToBoolVector(const Json::Value& in, std::vector<bool>* out); bool JsonArrayToDoubleVector(const Json::Value& in, std::vector<double>* out); // Convert std::vector to json array Json::Value ValueVectorToJsonArray(const std::vector<Json::Value>& in); Json::Value IntVectorToJsonArray(const std::vector<int>& in); Json::Value UIntVectorToJsonArray(const std::vector<unsigned int>& in); Json::Value StringVectorToJsonArray(const std::vector<std::string>& in); Json::Value BoolVectorToJsonArray(const std::vector<bool>& in); Json::Value DoubleVectorToJsonArray(const std::vector<double>& in); // Pull values out of a JSON object. bool GetValueFromJsonObject(const Json::Value& in, const std::string& k, Json::Value* out); bool GetIntFromJsonObject(const Json::Value& in, const std::string& k, int* out); bool GetUIntFromJsonObject(const Json::Value& in, const std::string& k, unsigned int* out); bool GetStringFromJsonObject(const Json::Value& in, const std::string& k, std::string* out); bool GetBoolFromJsonObject(const Json::Value& in, const std::string& k, bool* out); bool GetDoubleFromJsonObject(const Json::Value& in, const std::string& k, double* out); // Writes out a Json value as a string. std::string JsonValueToString(const Json::Value& json); #endif // WEBRTC_BASE_JSON_H_
#define WIN32_LEAN_AND_MEAN #include "../git-compat-util.h" #include "win32.h" #include "../cache.h" /* to read configuration */ static inline void filetime_to_timespec(const FILETIME *ft, struct timespec *ts) { long long winTime = ((long long)ft->dwHighDateTime << 32) + ft->dwLowDateTime; winTime -= 116444736000000000LL; /* Windows to Unix Epoch conversion */ /* convert 100-nsecond interval to seconds and nanoseconds */ ts->tv_sec = (time_t)(winTime/10000000); ts->tv_nsec = (long)(winTime - ts->tv_sec*10000000LL) * 100; } #define size_to_blocks(s) (((s)+511)/512) /* do_stat is a common implementation for cygwin_lstat and cygwin_stat. * * To simplify its logic, in the case of cygwin symlinks, this implementation * falls back to the cygwin version of stat/lstat, which is provided as the * last argument. */ static int do_stat(const char *file_name, struct stat *buf, stat_fn_t cygstat) { WIN32_FILE_ATTRIBUTE_DATA fdata; if (file_name[0] == '/') return cygstat (file_name, buf); if (!(errno = get_file_attr(file_name, &fdata))) { /* * If the system attribute is set and it is not a directory then * it could be a symbol link created in the nowinsymlinks mode. * Normally, Cygwin works in the winsymlinks mode, so this situation * is very unlikely. For the sake of simplicity of our code, let's * Cygwin to handle it. */ if ((fdata.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) && !(fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) return cygstat(file_name, buf); /* fill out the stat structure */ buf->st_dev = buf->st_rdev = 0; /* not used by Git */ buf->st_ino = 0; buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); buf->st_nlink = 1; buf->st_uid = buf->st_gid = 0; #ifdef __CYGWIN_USE_BIG_TYPES__ buf->st_size = ((_off64_t)fdata.nFileSizeHigh << 32) + fdata.nFileSizeLow; #else buf->st_size = (off_t)fdata.nFileSizeLow; #endif buf->st_blocks = size_to_blocks(buf->st_size); filetime_to_timespec(&fdata.ftLastAccessTime, &buf->st_atim); filetime_to_timespec(&fdata.ftLastWriteTime, &buf->st_mtim); filetime_to_timespec(&fdata.ftCreationTime, &buf->st_ctim); return 0; } else if (errno == ENOENT) { /* * In the winsymlinks mode (which is the default), Cygwin * emulates symbol links using Windows shortcut files. These * files are formed by adding .lnk extension. So, if we have * not found the specified file name, it could be that it is * a symbol link. Let's Cygwin to deal with that. */ return cygstat(file_name, buf); } return -1; } /* We provide our own lstat/stat functions, since the provided Cygwin versions * of these functions are too slow. These stat functions are tailored for Git's * usage, and therefore they are not meant to be complete and correct emulation * of lstat/stat functionality. */ static int cygwin_lstat(const char *path, struct stat *buf) { return do_stat(path, buf, lstat); } static int cygwin_stat(const char *path, struct stat *buf) { return do_stat(path, buf, stat); } /* * At start up, we are trying to determine whether Win32 API or cygwin stat * functions should be used. The choice is determined by core.ignorecygwinfstricks. * Reading this option is not always possible immediately as git_dir may * not be set yet. So until it is set, use cygwin lstat/stat functions. * However, if core.filemode is set, we must use the Cygwin posix * stat/lstat as the Windows stat functions do not determine posix filemode. * * Note that git_cygwin_config() does NOT call git_default_config() and this * is deliberate. Many commands read from config to establish initial * values in variables and later tweak them from elsewhere (e.g. command line). * init_stat() is called lazily on demand, typically much late in the program, * and calling git_default_config() from here would break such variables. */ static int native_stat = 1; static int core_filemode; static int git_cygwin_config(const char *var, const char *value, void *cb) { if (!strcmp(var, "core.ignorecygwinfstricks")) native_stat = git_config_bool(var, value); else if (!strcmp(var, "core.filemode")) core_filemode = git_config_bool(var, value); return 0; } static int init_stat(void) { if (have_git_dir()) { git_config(git_cygwin_config, NULL); if (!core_filemode && native_stat) { cygwin_stat_fn = cygwin_stat; cygwin_lstat_fn = cygwin_lstat; } else { cygwin_stat_fn = stat; cygwin_lstat_fn = lstat; } return 0; } return 1; } static int cygwin_stat_stub(const char *file_name, struct stat *buf) { return (init_stat() ? stat : *cygwin_stat_fn)(file_name, buf); } static int cygwin_lstat_stub(const char *file_name, struct stat *buf) { return (init_stat() ? lstat : *cygwin_lstat_fn)(file_name, buf); } stat_fn_t cygwin_stat_fn = cygwin_stat_stub; stat_fn_t cygwin_lstat_fn = cygwin_lstat_stub;
/* Test program for rpmatch function. Copyright (C) 1998-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jochen Hein <jochen.hein@delphi.central.de>. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <locale.h> #include <stdio.h> #include <stdlib.h> int main (int argc, char* argv[]) { setlocale (LC_ALL, argv[1]); if (rpmatch (argv[2]) != atol (argv[3])) { fprintf (stderr,"Failed: Locale %s, String %s, Exp: %s, got %d\n", argv[1], argv[2], argv[3], rpmatch (argv[2])); exit (EXIT_FAILURE); } return EXIT_SUCCESS; }
/*********************************************************************** * * Copyright 2001 MontaVista Software Inc. * Author: jsun@mvista.com or jsun@junsun.net * * arch/mips/ddb5xxx/common/prom.c * prom.c file. * * 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/config.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/bootmem.h> #include <asm/addrspace.h> #include <asm/bootinfo.h> #include <asm/ddb5xxx/ddb5xxx.h> #include <asm/debug.h> char arcs_cmdline[CL_SIZE]; void ddb5477_runtime_detection(void); const char *get_system_type(void) { switch (mips_machtype) { case MACH_NEC_DDB5074: return "NEC DDB Vrc-5074"; case MACH_NEC_DDB5476: return "NEC DDB Vrc-5476"; case MACH_NEC_DDB5477: return "NEC DDB Vrc-5477"; case MACH_NEC_ROCKHOPPER: return "NEC Rockhopper"; case MACH_NEC_ROCKHOPPERII: return "NEC RockhopperII"; default: return "Unknown NEC board"; } } /* [jsun@junsun.net] PMON passes arguments in C main() style */ void __init prom_init(int argc, const char **arg) { int i; /* arg[0] is "g", the rest is boot parameters */ arcs_cmdline[0] = '\0'; for (i = 1; i < argc; i++) { if (strlen(arcs_cmdline) + strlen(arg[i] + 1) >= sizeof(arcs_cmdline)) break; strcat(arcs_cmdline, arg[i]); strcat(arcs_cmdline, " "); } /* by default all these boards use dhcp/nfs root fs */ strcat(arcs_cmdline, "ip=bootp"); mips_machgroup = MACH_GROUP_NEC_DDB; #if defined(CONFIG_DDB5074) mips_machtype = MACH_NEC_DDB5074; add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM); #elif defined(CONFIG_DDB5476) mips_machtype = MACH_NEC_DDB5476; add_memory_region(0, DDB_SDRAM_SIZE, BOOT_MEM_RAM); #elif defined(CONFIG_DDB5477) ddb5477_runtime_detection(); add_memory_region(0, board_ram_size, BOOT_MEM_RAM); #endif } void __init prom_free_prom_memory(void) { } #if defined(CONFIG_DDB5477) #define DEFAULT_LCS1_BASE 0x19000000 #define TESTVAL1 'K' #define TESTVAL2 'S' int board_ram_size; void ddb5477_runtime_detection(void) { volatile char *test_offset; char saved_test_byte; /* Determine if this is a DDB5477 board, or a BSB-VR0300 base board. We can tell by checking for the location of the NVRAM. It lives at the beginning of LCS1 on the DDB5477, and the beginning of LCS1 on the BSB-VR0300 is flash memory. The first 2K of the NVRAM are reserved, so don't we'll poke around just after that. */ /* We can only use the PCI bus to distinquish between the Rockhopper and RockhopperII backplanes and this must wait until ddb5477_board_init() in setup.c after the 5477 is initialized. So, until then handle both Rockhopper and RockhopperII backplanes as Rockhopper 1 */ test_offset = (char *)KSEG1ADDR(DEFAULT_LCS1_BASE + 0x800); saved_test_byte = *test_offset; *test_offset = TESTVAL1; if (*test_offset != TESTVAL1) { /* We couldn't set our test value, so it must not be NVRAM, so it's a BSB_VR0300 */ mips_machtype = MACH_NEC_ROCKHOPPER; } else { /* We may have gotten lucky, and the TESTVAL1 was already stored at the test location, so we must check a second test value */ *test_offset = TESTVAL2; if (*test_offset != TESTVAL2) { /* OK, we couldn't set this value either, so it must definately be a BSB_VR0300 */ mips_machtype = MACH_NEC_ROCKHOPPER; } else { /* We could change the value twice, so it must be NVRAM, so it's a DDB_VRC5477 */ mips_machtype = MACH_NEC_DDB5477; } } /* Restore the original byte */ *test_offset = saved_test_byte; /* before we know a better way, we will trust PMON for getting * RAM size */ board_ram_size = 1 << (36 - (ddb_in32(DDB_SDRAM0) & 0xf)); db_run(printk("DDB run-time detection : %s, %d MB RAM\n", mips_machtype == MACH_NEC_DDB5477 ? "DDB5477" : "Rockhopper", board_ram_size >> 20)); /* we can't handle ram size > 128 MB */ db_assert(board_ram_size <= (128 << 20)); } #endif
/* * Copyright (C) 2005 SAN People * Copyright (C) 2008 Atmel * * 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 */ #include <linux/types.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/spi/spi.h> #include <linux/spi/at73c213.h> #include <linux/clk.h> #include <mach/hardware.h> #include <asm/setup.h> #include <asm/mach-types.h> #include <asm/irq.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/irq.h> #include <mach/board.h> #include <mach/gpio.h> #include <mach/at91sam9_smc.h> #include "sam9_smc.h" #include "generic.h" static void __init ek_map_io(void) { /* Initialize processor: 18.432 MHz crystal */ at91sam9260_initialize(18432000); /* DGBU on ttyS0. (Rx & Tx only) */ at91_register_uart(0, 0, 0); /* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ at91_register_uart(AT91SAM9260_ID_US0, 1, ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD | ATMEL_UART_RI); /* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ at91_register_uart(AT91SAM9260_ID_US1, 2, ATMEL_UART_CTS | ATMEL_UART_RTS); /* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console(0); } static void __init ek_init_irq(void) { at91sam9260_init_interrupts(NULL); } /* * USB Host port */ static struct at91_usbh_data __initdata ek_usbh_data = { .ports = 2, }; /* * USB Device port */ static struct at91_udc_data __initdata ek_udc_data = { .vbus_pin = AT91_PIN_PC5, .pullup_pin = 0, /* pull-up driven by UDC */ }; /* * SPI devices. */ static struct spi_board_info ek_spi_devices[] = { #if !defined(CONFIG_MMC_AT91) { /* DataFlash chip */ .modalias = "mtd_dataflash", .chip_select = 1, .max_speed_hz = 15 * 1000 * 1000, .bus_num = 0, }, #if defined(CONFIG_MTD_AT91_DATAFLASH_CARD) { /* DataFlash card */ .modalias = "mtd_dataflash", .chip_select = 0, .max_speed_hz = 15 * 1000 * 1000, .bus_num = 0, }, #endif #endif }; /* * MACB Ethernet device */ static struct at91_eth_data __initdata ek_macb_data = { .phy_irq_pin = AT91_PIN_PA7, .is_rmii = 1, }; /* * NAND flash */ static struct mtd_partition __initdata ek_nand_partition[] = { { .name = "Bootstrap", .offset = 0, .size = 4 * SZ_1M, }, { .name = "Partition 1", .offset = MTDPART_OFS_NXTBLK, .size = 60 * SZ_1M, }, { .name = "Partition 2", .offset = MTDPART_OFS_NXTBLK, .size = MTDPART_SIZ_FULL, }, }; static struct mtd_partition * __init nand_partitions(int size, int *num_partitions) { *num_partitions = ARRAY_SIZE(ek_nand_partition); return ek_nand_partition; } /* det_pin is not connected */ static struct atmel_nand_data __initdata ek_nand_data = { .ale = 21, .cle = 22, .rdy_pin = AT91_PIN_PC13, .enable_pin = AT91_PIN_PC14, .partition_info = nand_partitions, #if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16) .bus_width_16 = 1, #else .bus_width_16 = 0, #endif }; static struct sam9_smc_config __initdata ek_nand_smc_config = { .ncs_read_setup = 0, .nrd_setup = 2, .ncs_write_setup = 0, .nwe_setup = 2, .ncs_read_pulse = 4, .nrd_pulse = 4, .ncs_write_pulse = 4, .nwe_pulse = 4, .read_cycle = 7, .write_cycle = 7, .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE, .tdf_cycles = 3, }; static void __init ek_add_device_nand(void) { /* setup bus-width (8 or 16) */ if (ek_nand_data.bus_width_16) ek_nand_smc_config.mode |= AT91_SMC_DBW_16; else ek_nand_smc_config.mode |= AT91_SMC_DBW_8; /* configure chip-select 3 (NAND) */ sam9_smc_configure(3, &ek_nand_smc_config); at91_add_device_nand(&ek_nand_data); } /* * MCI (SD/MMC) * det_pin, wp_pin and vcc_pin are not connected */ static struct at91_mmc_data __initdata ek_mmc_data = { .slot_b = 1, .wire4 = 1, }; /* * LEDs */ static struct gpio_led ek_leds[] = { { /* "bottom" led, green, userled1 to be defined */ .name = "ds5", .gpio = AT91_PIN_PA6, .active_low = 1, .default_trigger = "none", }, { /* "power" led, yellow */ .name = "ds1", .gpio = AT91_PIN_PA9, .default_trigger = "heartbeat", } }; static void __init ek_board_init(void) { /* Serial */ at91_add_device_serial(); /* USB Host */ at91_add_device_usbh(&ek_usbh_data); /* USB Device */ at91_add_device_udc(&ek_udc_data); /* SPI */ at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); /* NAND */ ek_add_device_nand(); /* Ethernet */ at91_add_device_eth(&ek_macb_data); /* MMC */ at91_add_device_mmc(0, &ek_mmc_data); /* I2C */ at91_add_device_i2c(NULL, 0); /* LEDs */ at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); /* PCK0 provides MCLK to the WM8731 */ at91_set_B_periph(AT91_PIN_PC1, 0); /* SSC (for WM8731) */ at91_add_device_ssc(AT91SAM9260_ID_SSC, ATMEL_SSC_TX); } MACHINE_START(AT91SAM9G20EK, "Atmel AT91SAM9G20-EK") /* Maintainer: Atmel */ .phys_io = AT91_BASE_SYS, .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc, .boot_params = AT91_SDRAM_BASE + 0x100, .timer = &at91sam926x_timer, .map_io = ek_map_io, .init_irq = ek_init_irq, .init_machine = ek_board_init, MACHINE_END
/* Copyright (C) 2002 FPMD group This file is distributed under the terms of the GNU General Public License. See the file `License' in the root directory of the present distribution, or http://www.gnu.org/copyleft/gpl.txt . */ #include <stdio.h> #include <stdlib.h> #include "c_defs.h" #define MAX_INDEX 32768 struct Index { unsigned char i[8]; } ; static struct Index * P_Index; static int * P_IndexIndex; static struct Index * LN; static int * IG; static int LN_SIZE; int IndexCmp( struct Index * A, struct Index * B) { int i; for(i = 7; i>=0 ; i--) { if(A->i[i] > B->i[i] ) { return +1; } else if(A->i[i] < B->i[i]) { return -1; } } return 0; } int index_comp(unsigned i,unsigned j) { int cmp; cmp = IndexCmp(P_Index + i, P_Index + j); if ( cmp > 0 ) return 1; else if ( cmp == 0 ) return 0; return -1; } int index_swap(unsigned i,unsigned j) { static struct Index tmp; static int itmp; tmp = P_Index[j] ; P_Index[j] = P_Index[i] ; P_Index[i] = tmp ; itmp = P_IndexIndex[j] ; P_IndexIndex[j] = P_IndexIndex[i] ; P_IndexIndex[i] = itmp ; return 1; } int IndexSort(struct Index * A, int * IndexIndex, int n) { void Qsort(unsigned n,int (*comp)(),int (*swap)()); P_Index = A; P_IndexIndex = IndexIndex; Qsort((unsigned)n,index_comp,index_swap); return 1; } int IndexSet( struct Index * A, int I1, int I2, int I3 ) { unsigned int himask = 0xFF00; unsigned int lomask = 0x00FF; if(abs(I1)>=MAX_INDEX || abs(I2)>=MAX_INDEX || abs(I3)>=MAX_INDEX ) { return -1; } if(I1<0) I1 += MAX_INDEX; if(I2<0) I2 += MAX_INDEX; if(I3<0) I3 += MAX_INDEX; A->i[7] = (unsigned char ) 0; A->i[6] = (unsigned char ) 0; A->i[5] = (unsigned char ) ((himask & (unsigned int) I1)>>8); A->i[4] = (unsigned char ) ( lomask & (unsigned int) I1); A->i[3] = (unsigned char ) ((himask & (unsigned int) I2)>>8); A->i[2] = (unsigned char ) ( lomask & (unsigned int) I2); A->i[1] = (unsigned char ) ((himask & (unsigned int) I3)>>8); A->i[0] = (unsigned char ) ( lomask & (unsigned int) I3); return 0; } int IndexShow(struct Index A) { int i; for(i=7;i>=0;i--) printf("%2x",A.i[i]); printf("\n"); return 0; } int IndexFind(struct Index * A, int n, struct Index * B) { int lb, ub, i, cmp; lb = 0; ub = n-1; i = lb; while(lb<(ub-1)) { i = lb + (ub - lb)/2; cmp = IndexCmp(B,&A[i]); if(cmp>0) { lb = i; } else if(cmp<0) { ub = i; } else { ub = lb = i; } } if(lb<ub) { cmp = IndexCmp(B,&A[lb]); if(cmp) { i = ub; } else { i = lb; } } if ( IndexCmp(B,&A[i]) ) return -1; return i; } void F77_FUNC_(ln_alloc,LN_ALLOC)(int * LN_DIM) { LN_SIZE = * LN_DIM; LN = ( struct Index *) malloc ( LN_SIZE * sizeof( struct Index )); IG = ( int *) malloc ( LN_SIZE * sizeof( int )); } void F77_FUNC_(ln_dealloc,LN_DEALLOC)(void ) { free((void *)LN); free((void *)IG); } void F77_FUNC_(ln_set,LN_SET)(int * IRI1, int * IRI2, int * IRI3, int * ig) { if( *ig<1 || *ig > LN_SIZE) { exit(*ig); } IndexSet( &LN[*ig-1], *IRI1, *IRI2, *IRI3 ); IG[*ig-1] = *ig; } int F77_FUNC_(ln_activate,LN_ACTIVATE)() { IndexSort(LN,IG,LN_SIZE); return 0; } int F77_FUNC_(ln_ind,LN_IND)(int * IRI1, int * IRI2, int * IRI3) { static struct Index B; static int ib; IndexSet(&B,*IRI1,*IRI2,*IRI3); ib = IndexFind(LN,LN_SIZE,&B); if(ib>=0) return IG[ib]; return -1; }
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 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. ==============================================================================*/ #ifndef TENSORFLOW_COMPILER_AOT_COMPILE_H_ #define TENSORFLOW_COMPILER_AOT_COMPILE_H_ #include <memory> #include <string> #include "tensorflow/compiler/aot/flags.h" #include "tensorflow/compiler/tf2xla/tf2xla.pb.h" #include "tensorflow/compiler/xla/service/cpu/cpu_compiler.h" #include "tensorflow/compiler/xla/xla_data.pb.h" #include "tensorflow/core/framework/graph.pb.h" namespace tensorflow { namespace tfcompile { // CompileResult describes the output of CompileGraph, where the object file // data and meta-information is available in aot. struct CompileResult { // Contains object file and meta-info. std::unique_ptr<xla::cpu::CpuAotCompilationResult> aot; xla::ProgramShapeProto program_shape; // Static shape of args and results. string entry_point; // Name of generated function. int pointer_size = 0; // Size of a pointer in bytes. }; // CompileGraph compiles the graph_def into an object file containing a function // that performs the graph operations. // // The XLA compilation options are specified in the flags. Status CompileGraph(GraphDef graph_def, const tf2xla::Config& config, const MainFlags& flags, CompileResult* compile_result); // The full compilation method, for reuse in a library setting. Status Main(const MainFlags& flags); } // namespace tfcompile } // namespace tensorflow #endif // TENSORFLOW_COMPILER_AOT_COMPILE_H_
/* * This file is part of Cleanflight and Betaflight. * * Cleanflight and Betaflight are free software. You can redistribute * this software and/or modify this software 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. * * Cleanflight and Betaflight are distributed in the hope that they * 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 software. * * If not, see <http://www.gnu.org/licenses/>. */ #include <stdbool.h> #include <stdint.h> #include "platform.h" #ifdef USE_HUFFMAN #include "huffman.h" int huffmanEncodeBuf(uint8_t *outBuf, int outBufLen, const uint8_t *inBuf, int inLen, const huffmanTable_t *huffmanTable) { int ret = 0; uint8_t *outByte = outBuf; *outByte = 0; uint8_t outBit = 0x80; for (int ii = 0; ii < inLen; ++ii) { const int huffCodeLen = huffmanTable[*inBuf].codeLen; const uint16_t huffCode = huffmanTable[*inBuf].code; ++inBuf; uint16_t testBit = 0x8000; for (int jj = 0; jj < huffCodeLen; ++jj) { if (huffCode & testBit) { *outByte |= outBit; } testBit >>= 1; outBit >>= 1; if (outBit == 0) { outBit = 0x80; ++outByte; *outByte = 0; ++ret; } if (ret >= outBufLen && ii < inLen - 1 && jj < huffCodeLen - 1) { return -1; } } } if (outBit != 0x80) { // ensure last character in output buffer is counted ++ret; } return ret; } int huffmanEncodeBufStreaming(huffmanState_t *state, const uint8_t *inBuf, int inLen, const huffmanTable_t *huffmanTable) { uint8_t *savedOutBytePtr = state->outByte; uint8_t savedOutByte = *savedOutBytePtr; for (const uint8_t *pos = inBuf, *end = inBuf + inLen; pos < end; ++pos) { const int huffCodeLen = huffmanTable[*pos].codeLen; const uint16_t huffCode = huffmanTable[*pos].code; uint16_t testBit = 0x8000; for (int jj = 0; jj < huffCodeLen; ++jj) { if (huffCode & testBit) { *state->outByte |= state->outBit; } testBit >>= 1; state->outBit >>= 1; if (state->outBit == 0) { state->outBit = 0x80; ++state->outByte; *state->outByte = 0; ++state->bytesWritten; } // if buffer is filled and we haven't finished compressing if (state->bytesWritten >= state->outBufLen && (pos < end - 1 || jj < huffCodeLen - 1)) { // restore savedOutByte *savedOutBytePtr = savedOutByte; return -1; } } } return 0; } #endif