text
stringlengths
4
6.14k
/* ************************************************************************** qgsrastershader.h - description ------------------- begin : Fri Dec 28 2007 copyright : (C) 2007 by Peter J. Ersts email : ersts@amnh.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. * * * ***************************************************************************/ #ifndef QGSRASTERSHADER_H #define QGSRASTERSHADER_H #include "qgis_core.h" #include "qgis_sip.h" #include "qgsreadwritecontext.h" class QDomDocument; class QDomElement; class QgsRasterShaderFunction; /** * \ingroup core * \brief Interface for all raster shaders. */ class CORE_EXPORT QgsRasterShader { public: QgsRasterShader( double minimumValue = 0.0, double maximumValue = 255.0 ); //! QgsRasterShader cannot be copied QgsRasterShader( const QgsRasterShader &rh ) = delete; //! QgsRasterShader cannot be copied QgsRasterShader &operator=( const QgsRasterShader &rh ) = delete; /* * * Non-Static Inline methods * */ /** * Returns the maximum value for the raster shader. * \see setMaximumValue() * \see minimumValue() */ double maximumValue() const { return mMaximumValue; } /** * Returns the minimum value for the raster shader. * \see setMinimumValue() * \see maximumValue() */ double minimumValue() const { return mMinimumValue; } QgsRasterShaderFunction *rasterShaderFunction() { return mRasterShaderFunction.get(); } const QgsRasterShaderFunction *rasterShaderFunction() const { return mRasterShaderFunction.get(); } SIP_SKIP /* * * Non-Static methods * */ /** * Generates a new RGBA value based on one input \a value. * * \param value The original value to base a new RGBA value on * \param returnRedValue The red component of the new RGBA value * \param returnGreenValue The green component of the new RGBA value * \param returnBlueValue The blue component of the new RGBA value * \param returnAlpha The alpha component of the new RGBA value * \return TRUE if the return values are valid otherwise FALSE */ bool shade( double value, int *returnRedValue SIP_OUT, int *returnGreenValue SIP_OUT, int *returnBlueValue SIP_OUT, int *returnAlpha SIP_OUT ); /** * Generates a new RGBA value based on an original RGBA value. * \param redValue The red component of the original value to base a new RGBA value on * \param greenValue The green component of the original value to base a new RGBA value on * \param blueValue The blue component of the original value to base a new RGBA value on * \param alphaValue The alpha component of the original value to base a new RGBA value on * \param returnRedValue The red component of the new RGBA value * \param returnGreenValue The green component of the new RGBA value * \param returnBlueValue The blue component of the new RGBA value * \param returnAlpha The alpha component of the new RGBA value * \return TRUE if the return values are valid otherwise FALSE */ bool shade( double redValue, double greenValue, double blueValue, double alphaValue, int *returnRedValue SIP_OUT, int *returnGreenValue SIP_OUT, int *returnBlueValue SIP_OUT, int *returnAlpha SIP_OUT ); /** * \brief A public method that allows the user to set their own shader \a function. * \note Raster shader takes ownership of the shader function instance */ void setRasterShaderFunction( QgsRasterShaderFunction *function SIP_TRANSFER ); /** * Sets the maximum \a value for the raster shader. * \see setMinimumValue() * \see maximumValue() */ void setMaximumValue( double value ); /** * Sets the minimum \a value for the raster shader. * \see setMaximumValue() * \see minimumValue() */ void setMinimumValue( double value ); /** * Writes shader state to an XML element. */ void writeXml( QDomDocument &doc, QDomElement &parent, const QgsReadWriteContext &context = QgsReadWriteContext() ) const; /** * Reads shader state from an XML element. */ void readXml( const QDomElement &elem, const QgsReadWriteContext &context = QgsReadWriteContext() ); private: #ifdef SIP_RUN QgsRasterShader( const QgsRasterShader &rh ); #endif //! \brief User defineable minimum value for the raster shader double mMinimumValue; //! \brief user defineable maximum value for the raster shader double mMaximumValue; //! \brief Pointer to the shader function std::unique_ptr< QgsRasterShaderFunction > mRasterShaderFunction; }; #endif
/* cpu.c: Dinky routines to look for the kind of Sparc cpu * we are on. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/smp.h> #include <linux/threads.h> #include <asm/oplib.h> #include <asm/page.h> #include <asm/head.h> #include <asm/psr.h> #include <asm/mbus.h> #include <asm/cpudata.h> DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 }; struct cpu_iu_info { int psr_impl; int psr_vers; char* cpu_name; /* should be enough I hope... */ }; struct cpu_fp_info { int psr_impl; int fp_vers; char* fp_name; }; /* In order to get the fpu type correct, you need to take the IDPROM's * machine type value into consideration too. I will fix this. */ static struct cpu_fp_info linux_sparc_fpu[] = { { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"}, { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5 or LSI L64831"}, { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"}, /* SparcStation SLC, SparcStation1 */ { 0, 3, "Weitek WTL3170/2"}, /* SPARCstation-5 */ { 0, 4, "Lsi Logic/Meiko L64804 or compatible"}, { 0, 5, "reserved"}, { 0, 6, "reserved"}, { 0, 7, "No FPU"}, { 1, 0, "ROSS HyperSparc combined IU/FPU"}, { 1, 1, "Lsi Logic L64814"}, { 1, 2, "Texas Instruments TMS390-C602A"}, { 1, 3, "Cypress CY7C602 FPU"}, { 1, 4, "reserved"}, { 1, 5, "reserved"}, { 1, 6, "reserved"}, { 1, 7, "No FPU"}, { 2, 0, "BIT B5010 or B5110/20 or B5210"}, { 2, 1, "reserved"}, { 2, 2, "reserved"}, { 2, 3, "reserved"}, { 2, 4, "reserved"}, { 2, 5, "reserved"}, { 2, 6, "reserved"}, { 2, 7, "No FPU"}, /* SuperSparc 50 module */ { 4, 0, "SuperSparc on-chip FPU"}, /* SparcClassic */ { 4, 4, "TI MicroSparc on chip FPU"}, { 5, 0, "Matsushita MN10501"}, { 5, 1, "reserved"}, { 5, 2, "reserved"}, { 5, 3, "reserved"}, { 5, 4, "reserved"}, { 5, 5, "reserved"}, { 5, 6, "reserved"}, { 5, 7, "No FPU"}, { 9, 3, "Fujitsu or Weitek on-chip FPU"}, }; #define NSPARCFPU ARRAY_SIZE(linux_sparc_fpu) static struct cpu_iu_info linux_sparc_chips[] = { /* Sun4/100, 4/200, SLC */ { 0, 0, "Fujitsu MB86900/1A or LSI L64831 SparcKIT-40"}, /* borned STP1012PGA */ { 0, 4, "Fujitsu MB86904"}, { 0, 5, "Fujitsu TurboSparc MB86907"}, /* SparcStation2, SparcServer 490 & 690 */ { 1, 0, "LSI Logic Corporation - L64811"}, /* SparcStation2 */ { 1, 1, "Cypress/ROSS CY7C601"}, /* Embedded controller */ { 1, 3, "Cypress/ROSS CY7C611"}, /* Ross Technologies HyperSparc */ { 1, 0xf, "ROSS HyperSparc RT620"}, { 1, 0xe, "ROSS HyperSparc RT625 or RT626"}, /* ECL Implementation, CRAY S-MP Supercomputer... AIEEE! */ /* Someone please write the code to support this beast! ;) */ { 2, 0, "Bipolar Integrated Technology - B5010"}, { 3, 0, "LSI Logic Corporation - unknown-type"}, { 4, 0, "Texas Instruments, Inc. - SuperSparc-(II)"}, /* SparcClassic -- borned STP1010TAB-50*/ { 4, 1, "Texas Instruments, Inc. - MicroSparc"}, { 4, 2, "Texas Instruments, Inc. - MicroSparc II"}, { 4, 3, "Texas Instruments, Inc. - SuperSparc 51"}, { 4, 4, "Texas Instruments, Inc. - SuperSparc 61"}, { 4, 5, "Texas Instruments, Inc. - unknown"}, { 5, 0, "Matsushita - MN10501"}, { 6, 0, "Philips Corporation - unknown"}, { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"}, /* Gallium arsenide 200MHz, BOOOOGOOOOMIPS!!! */ { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"}, { 9, 0, "Fujitsu or Weitek Power-UP"}, { 9, 1, "Fujitsu or Weitek Power-UP"}, { 9, 2, "Fujitsu or Weitek Power-UP"}, { 9, 3, "Fujitsu or Weitek Power-UP"}, { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"}, { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"}, }; #define NSPARCCHIPS ARRAY_SIZE(linux_sparc_chips) char *sparc_cpu_type; char *sparc_fpu_type; unsigned int fsr_storage; void __cpuinit cpu_probe(void) { int psr_impl, psr_vers, fpu_vers; int i, psr; psr_impl = ((get_psr()>>28)&0xf); psr_vers = ((get_psr()>>24)&0xf); psr = get_psr(); put_psr(psr | PSR_EF); fpu_vers = ((get_fsr()>>17)&0x7); put_psr(psr); for(i = 0; i<NSPARCCHIPS; i++) { if(linux_sparc_chips[i].psr_impl == psr_impl) if(linux_sparc_chips[i].psr_vers == psr_vers) { sparc_cpu_type = linux_sparc_chips[i].cpu_name; break; } } if(i==NSPARCCHIPS) printk("DEBUG: psr.impl = 0x%x psr.vers = 0x%x\n", psr_impl, psr_vers); for(i = 0; i<NSPARCFPU; i++) { if(linux_sparc_fpu[i].psr_impl == psr_impl) if(linux_sparc_fpu[i].fp_vers == fpu_vers) { sparc_fpu_type = linux_sparc_fpu[i].fp_name; break; } } if(i == NSPARCFPU) { printk("DEBUG: psr.impl = 0x%x fsr.vers = 0x%x\n", psr_impl, fpu_vers); sparc_fpu_type = linux_sparc_fpu[31].fp_name; } }
// 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 LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ #define LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ #include <pthread.h> #include "nacl_io/mount.h" #include "nacl_io/pepper_interface.h" #include "nacl_io/typed_mount_factory.h" #include "sdk_util/simple_lock.h" namespace nacl_io { class MountNode; class MountHtml5Fs : public Mount { public: virtual Error Access(const Path& path, int a_mode); virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node); virtual Error Unlink(const Path& path); virtual Error Mkdir(const Path& path, int permissions); virtual Error Rmdir(const Path& path); virtual Error Remove(const Path& path); PP_Resource filesystem_resource() { return filesystem_resource_; } protected: MountHtml5Fs(); virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); virtual void Destroy(); Error BlockUntilFilesystemOpen(); private: static void FilesystemOpenCallbackThunk(void* user_data, int32_t result); void FilesystemOpenCallback(int32_t result); PP_Resource filesystem_resource_; bool filesystem_open_has_result_; // protected by lock_. Error filesystem_open_error_; // protected by lock_. pthread_cond_t filesystem_open_cond_; sdk_util::SimpleLock filesysem_open_lock_; friend class TypedMountFactory<MountHtml5Fs>; }; } // namespace nacl_io #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_
/*============================================================================= Library: CTK Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics 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 CTKOBJECTCLASSDEFINITION_H #define CTKOBJECTCLASSDEFINITION_H #include "ctkAttributeDefinition.h" /** * \ingroup Metatype * * Description for the data type information of an objectclass. */ struct ctkObjectClassDefinition { enum Filter { /** * Argument for <code>getAttributeDefinitions()</code>. * <p> * <code>REQUIRED</code> indicates that only the required definitions are * returned. */ REQUIRED, /** * Argument for <code>getAttributeDefinitions()</code>. * <p> * <code>OPTIONAL</code> indicates that only the optional definitions are * returned. */ OPTIONAL, /** * Argument for <code>getAttributeDefinitions()</code>. * <p> * <code>ALL</code> indicates that all the definitions are returned. */ ALL }; virtual ~ctkObjectClassDefinition() {} /** * Return the name of this object class. * * The name may be localized. * * @return The name of this object class. */ virtual QString getName() const = 0; /** * Return the id of this object class. * * <p> * <code>ctkObjectClassDefintion</code> objects share a global namespace in the * registry. They share this aspect with LDAP/X.500 attributes. In these * standards the OSI Object Identifier (OID) is used to uniquely identify * object classes. If such an OID exists, (which can be requested at several * standard organisations and many companies already have a node in the * tree) it can be returned here. Otherwise, a unique id should be returned * which can be a class name combined with a reverse domain name, or generated with a * GUID algorithm. Note that all LDAP defined object classes already have an * OID associated. It is strongly advised to define the object classes from * existing LDAP schemes which will give the OID for free. Many such schemes * exist ranging from postal addresses to DHCP parameters. * * @return The id of this object class. */ virtual QString getID() const = 0; /** * Return a description of this object class. * * The description may be localized. * * @return The description of this object class. */ virtual QString getDescription() const = 0; /** * Return the attribute definitions for this object class. * * <p> * Return a set of attributes. The filter parameter can distinguish between * <code>ALL</code>,<code>REQUIRED</code> or the <code>OPTIONAL</code> * attributes. * * @param filter <code>ALL</code>,<code>REQUIRED</code>,<code>OPTIONAL</code> * @return A list of attribute definitions, which is empty if no * attributes are selected */ virtual QList<ctkAttributeDefinitionPtr> getAttributeDefinitions(Filter filter) = 0; /** * Return a QByteArray object that can be used to create an * icon from. * * <p> * Indicate the size and return a QByteAray object containing * an icon. The returned icon maybe larger or smaller than the indicated * size. * * <p> * The icon may depend on the localization. * * @param size Requested size of an icon, e.g. a 16x16 pixels icon then size = * 16 * @return A QByteArray holding an icon or an empty QByteArray. */ virtual QByteArray getIcon(int size) const = 0; }; /** * \ingroup Metatype */ typedef QSharedPointer<ctkObjectClassDefinition> ctkObjectClassDefinitionPtr; #endif // CTKOBJECTCLASSDEFINITION_H
/* Video Core Copyright (c) 2014 James G. Hurley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __videocore__AudioMixer__ #define __videocore__AudioMixer__ #include <iostream> #include <videocore/mixers/GenericAudioMixer.h> #include <AudioToolbox/AudioToolbox.h> #include <unordered_map> namespace videocore { namespace Apple { /* * Takes raw LPCM buffers from a variety of sources, resamples, and mixes them and ouputs a single LPCM buffer. * Differs from GenericAudioMixer because it uses CoreAudio to resample. * */ class AudioMixer : public GenericAudioMixer { public: /*! * Constructor. * * \param outChannelCount number of channels to output. * \param outFrequencyInHz sampling rate to output. * \param outBitsPerChannel number of bits per channel to output * \param frameDuration The duration of a single frame of audio. For example, AAC uses 1024 samples per frame * and therefore the duration is 1024 / sampling rate */ AudioMixer(int outChannelCount, int outFrequencyInHz, int outBitsPerChannel, double frameDuration); /*! Destructor */ ~AudioMixer(); protected: /*! * Called to resample a buffer of audio samples. You can change the quality of the resampling method * by changing s_samplingRateConverterComplexity and s_samplingRateConverterQuality in Apple/AudioMixer.cpp. * * \param buffer The input samples * \param size The buffer size in bytes * \param metadata The associated AudioBufferMetadata that specifies the properties of this buffer. * * \return An audio buffer that has been resampled to match the output properties of the mixer. */ std::shared_ptr<Buffer> resample(const uint8_t* const buffer, size_t size, AudioBufferMetadata& metadata); private: /*! Used by AudioConverterFillComplexBuffer. Do not call manually. */ static OSStatus ioProc(AudioConverterRef audioConverter, UInt32 *ioNumDataPackets, AudioBufferList* ioData, AudioStreamPacketDescription** ioPacketDesc, void* inUserData ); private: using ConverterInst = struct { AudioStreamBasicDescription asbdIn, asbdOut; AudioConverterRef converter; }; std::unordered_map<uint64_t, ConverterInst> m_converters; }; } } #endif /* defined(__videocore__AudioMixer__) */
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #include "VideoBackends/OGL/GLExtensions/gl_common.h" extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB; extern PFNGLDEBUGMESSAGECONTROLARBPROC glDebugMessageControlARB; extern PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsertARB; extern PFNGLGETDEBUGMESSAGELOGARBPROC glGetDebugMessageLogARB;
/* { dg-do compile } */ /* { dg-options "-mavx512bw -O2" } */ /* { dg-final { scan-assembler-times "korq\[ \\t\]+\[^\{\n\]*%k\[0-7\](?:\n|\[ \\t\]+#)" 1 } } */ #include <immintrin.h> void avx512bw_test () { __mmask64 k1, k2, k3; volatile __m512i x = _mm512_setzero_si512 (); __asm__( "kmovq %1, %0" : "=k" (k1) : "r" (1) ); __asm__( "kmovq %1, %0" : "=k" (k2) : "r" (2) ); k3 = _kor_mask64 (k1, k2); x = _mm512_mask_add_epi8 (x, k3, x, x); }
/* Copyright (C) 2000 MySQL AB 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Wait a given number of microseconds */ #include "mysys_priv.h" #include <m_string.h> void my_sleep(ulong m_seconds) { #ifdef __NETWARE__ delay(m_seconds/1000+1); #elif defined(__WIN__) Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ #elif defined(HAVE_SELECT) struct timeval t; t.tv_sec= m_seconds / 1000000L; t.tv_usec= m_seconds % 1000000L; select(0,0,0,0,&t); /* sleep */ #else uint sec= (uint) (m_seconds / 1000000L); ulong start= (ulong) time((time_t*) 0); while ((ulong) time((time_t*) 0) < start+sec); #endif }
/* Copyright 2020 Nick Brassel (tzarc) * * 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 <https://www.gnu.org/licenses/>. */ #pragma once #include_next "mcuconf.h" #undef STM32_I2C_USE_I2C1 #define STM32_I2C_USE_I2C1 TRUE #undef STM32_PWM_USE_TIM5 #define STM32_PWM_USE_TIM5 TRUE
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: salwan.searty REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test that the sigwaitinfo() function shall return the selected signal number. Steps: 1. Register signal SIGTOTEST with the handler myhandler 2. Block SIGTOTEST from the process 3. Raise the signal, causing it to be pending 4. Call sigwaitinfo() and verify that it returns the signal SIGTOTEST. */ #define _XOPEN_SOURCE 600 #define _XOPEN_REALTIME 1 #define SIGTOTEST SIGUSR1 #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include "posixtest.h" void myhandler(int signo) { printf("Inside handler\n"); } int main(void) { struct sigaction act; sigset_t pendingset, selectset; act.sa_flags = 0; act.sa_handler = myhandler; sigemptyset(&pendingset); sigemptyset(&selectset); sigaddset(&selectset, SIGTOTEST); sigemptyset(&act.sa_mask); sigaction(SIGTOTEST, &act, 0); sighold(SIGTOTEST); raise(SIGTOTEST); sigpending(&pendingset); if (sigismember(&pendingset, SIGTOTEST) != 1) { perror("SIGTOTEST is not pending\n"); return PTS_UNRESOLVED; } if (sigwaitinfo(&selectset, NULL) != SIGTOTEST) { perror("Call to sigwaitinfo() failed\n"); return PTS_FAIL; } printf("Test PASSED\n"); return PTS_PASS; }
#ifndef _CUST_LEDS_H #define _CUST_LEDS_H #include <mach/mt_typedefs.h> enum mt65xx_led_type { MT65XX_LED_TYPE_RED = 0, MT65XX_LED_TYPE_GREEN, MT65XX_LED_TYPE_BLUE, MT65XX_LED_TYPE_JOGBALL, MT65XX_LED_TYPE_KEYBOARD, MT65XX_LED_TYPE_BUTTON, MT65XX_LED_TYPE_LCD, MT65XX_LED_TYPE_TOTAL, }; enum mt65xx_led_mode { MT65XX_LED_MODE_NONE, MT65XX_LED_MODE_PWM, MT65XX_LED_MODE_GPIO, MT65XX_LED_MODE_PMIC, MT65XX_LED_MODE_CUST, MT65XX_LED_MODE_CUST_LCM, MT65XX_LED_MODE_CUST_BLS_PWM }; enum mt65xx_led_pmic { MT65XX_LED_PMIC_BUTTON=0, MT65XX_LED_PMIC_LCD, MT65XX_LED_PMIC_LCD_ISINK, MT65XX_LED_PMIC_LCD_BOOST, MT65XX_LED_PMIC_NLED_ISINK4, MT65XX_LED_PMIC_NLED_ISINK5, MT65XX_LED_PMIC_NLED_ISINK0, MT65XX_LED_PMIC_NLED_ISINK1, MT65XX_LED_PMIC_NLED_ISINK2, MT65XX_LED_PMIC_NLED_ISINK01 }; struct PWM_config { int clock_source; int div; int low_duration; int High_duration; BOOL pmic_pad; }; typedef int (*cust_brightness_set)(int level, int div); typedef int (*cust_set_brightness)(int level); /* * name : must the same as lights HAL * mode : control mode * data : * PWM: pwm number * GPIO: gpio id * PMIC: enum mt65xx_led_pmic * CUST: custom set brightness function pointer */ struct cust_mt65xx_led { char *name; enum mt65xx_led_mode mode; int data; struct PWM_config config_data; }; extern struct cust_mt65xx_led *get_cust_led_list(void); #endif
/* { dg-do compile } */ int gi, dg; void fe (void) { int ka = gi; for (;;) { if (ka != 0) { if (dg != 0) gi = 0; ++ka; } ++dg; } }
/**************************************************************************** Copyright (c) 2013 cocos2d-x.org http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCTIMELINE_H__ #define __CCTIMELINE_H__ #include "CCFrame.h" #include "CCTimelineMacro.h" #include "cocostudio/CocosStudioExport.h" NS_TIMELINE_BEGIN class ActionTimeline; class CC_STUDIO_DLL Timeline : public cocos2d::Ref { public: static Timeline* create(); Timeline(); virtual ~Timeline(); virtual void gotoFrame(int frameIndex); virtual void stepToFrame(int frameIndex); virtual const cocos2d::Vector<Frame*>& getFrames() const { return _frames; } virtual void addFrame(Frame* frame); virtual void insertFrame(Frame* frame, int index); virtual void removeFrame(Frame* frame); virtual void setActionTag(int tag) { _actionTag = tag; } virtual int getActionTag() const { return _actionTag; } virtual void setNode(cocos2d::Node* node); virtual cocos2d::Node* getNode() const; virtual void setActionTimeline(ActionTimeline* action) { _ActionTimeline = action; } virtual ActionTimeline* getActionTimeline() const { return _ActionTimeline; } virtual Timeline* clone(); protected: virtual void apply(unsigned int frameIndex); virtual void binarySearchKeyFrame (unsigned int frameIndex); virtual void updateCurrentKeyFrame(unsigned int frameIndex); cocos2d::Vector<Frame*> _frames; Frame* _currentKeyFrame; unsigned int _currentKeyFrameIndex; unsigned int _fromIndex; unsigned int _toIndex; unsigned int _betweenDuration; unsigned int _actionTag; ActionTimeline* _ActionTimeline; cocos2d::Node* _node; }; NS_TIMELINE_END #endif /*__CCTIMELINE_H__*/
// // UIApplication+MemoryLeak.h // MLeaksFinder // // Created by 佘泽坡 on 5/11/16. // Copyright © 2016 zeposhe. All rights reserved. // #import <UIKit/UIKit.h> #import "MLeaksFinder.h" #if _INTERNAL_MLF_ENABLED @interface UIApplication (MemoryLeak) @end #endif
/* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. */ /* * Test that if the access mode is O_WRONLY, the message queue can * send messages but not receive. * * Test for a message queue opened twice in two different processes. * * 3/13/03 - Added fix from Gregoire Pichon for specifying an attr * with a mq_maxmsg >= BUFFER. */ #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> #include <mqueue.h> #include <signal.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include "posixtest.h" #define NAMESIZE 50 #define MSGSTR "0123456789" #define BUFFER 40 #define CHILDPASS 1 #define CHILDFAIL 0 void handler(int signo) { (void) signo; return; } int main(void) { char qname[NAMESIZE]; const char *msgptr = MSGSTR; int pid; sprintf(qname, "/mq_open_8-2_%d", getpid()); pid = fork(); if (pid == 0) { mqd_t woqueue; sigset_t mask; struct mq_attr attr; struct sigaction act; char msgrcd[BUFFER]; int sig; unsigned pri; /* child here */ /* Set up handler for SIGUSR1 */ act.sa_handler = handler; act.sa_flags = 0; sigaction(SIGUSR1, &act, NULL); /* wait for parent to finish mq_send */ sigemptyset(&mask); sigaddset(&mask, SIGUSR1); sigprocmask(SIG_BLOCK, &mask, NULL); sigwait(&mask, &sig); /* once parent has finished mq_send, open new queue */ attr.mq_msgsize = BUFFER; attr.mq_maxmsg = BUFFER; woqueue = mq_open(qname, O_WRONLY, S_IRUSR | S_IWUSR, &attr); if (woqueue == (mqd_t) - 1) { perror("mq_open() read only failed in child"); return CHILDFAIL; } #ifdef DEBUG printf("write-only message queue opened in child\n"); #endif if (mq_receive(woqueue, msgrcd, BUFFER, &pri) != -1) { printf("mq_receive() ret success w write-only queue\n"); mq_close(woqueue); return CHILDFAIL; } #ifdef DEBUG printf("Receiving message failed in child, as expected\n"); #endif if (mq_send(woqueue, msgptr, strlen(msgptr), 1) == -1) { perror("mq_send() failed on a write-only queue"); mq_close(woqueue); return CHILDFAIL; } #ifdef DEBUG printf("Message %s sent in child\n", msgptr); #endif mq_close(woqueue); return CHILDPASS; } else { /* parent here */ mqd_t woqueue; char msgrcd[BUFFER]; struct mq_attr attr; int i; unsigned pri; attr.mq_msgsize = BUFFER; attr.mq_maxmsg = BUFFER; woqueue = mq_open(qname, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR, &attr); if (woqueue == (mqd_t) - 1) { perror("mq_open() did not return success"); printf("Test UNRESOLVED\n"); /* kill child and exit */ kill(pid, SIGABRT); return PTS_UNRESOLVED; } #ifdef DEBUG printf("write-only message queue opened in parent\n"); #endif if (mq_send(woqueue, msgptr, strlen(msgptr), 1) != 0) { perror("mq_send() did not return success"); printf("Test FAILED\n"); /* kill child, close queue and exit */ kill(pid, SIGABRT); mq_close(woqueue); mq_unlink(qname); return PTS_FAIL; } #ifdef DEBUG printf("Message %s sent\n", msgptr); #endif if (mq_receive(woqueue, msgrcd, BUFFER, &pri) != -1) { printf("mq_receive() ret success w write only queue\n"); printf("Test FAILED\n"); /* kill child, close queue and exit */ kill(pid, SIGABRT); mq_close(woqueue); mq_unlink(qname); return PTS_FAIL; } #ifdef DEBUG printf("Message receive failed, as expected\n"); #endif sleep(1); kill(pid, SIGUSR1); if (wait(&i) == -1) { perror("Error waiting for child to exit"); printf("Test UNRESOLVED\n"); /* close queue and exit */ mq_close(woqueue); mq_unlink(qname); return PTS_UNRESOLVED; } #ifdef DEBUG printf("Child finished\n"); #endif mq_close(woqueue); mq_unlink(qname); if (!WIFEXITED(i) || !WEXITSTATUS(i)) { printf("Test FAILED\n"); return PTS_FAIL; } printf("Test PASSED\n"); return PTS_PASS; } return PTS_UNRESOLVED; }
/* * Copyright (c) 2005 Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Governement * retains certain rights in this software. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Sandia Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** * * expssd - ex_put_set_dist_fact * * entry conditions - * input parameters: * int exoid exodus file id * int set_type set type * int set_id set id * void* set_dist_fact array of dist factors for set * exit conditions - * * revision history - * * *****************************************************************************/ #include "exodusII.h" #include "exodusII_int.h" /*! * writes the distribution factors for a single set * \param exoid exodus file id * \param set_type set type * \param set_id set id * \param *set_dist_fact array of dist factors for set */ int ex_put_set_dist_fact (int exoid, ex_entity_type set_type, ex_entity_id set_id, const void *set_dist_fact) { int status; int dimid, set_id_ndx; int dist_id; char errmsg[MAX_ERR_LENGTH]; char* factptr = NULL; exerrval = 0; /* clear error code */ /* first check if any sets are specified */ if ((status = nc_inq_dimid(exoid, ex_dim_num_objects(set_type), &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: no %ss specified in file id %d", ex_name_of_object(set_type), exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } /* Lookup index of set id in VAR_*S_IDS array */ set_id_ndx = ex_id_lkup(exoid,set_type,set_id); if (exerrval != 0) { if (exerrval == EX_NULLENTITY) { sprintf(errmsg, "Warning: no data allowed for NULL %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_fact",errmsg,EX_MSG); return (EX_WARN); } else { sprintf(errmsg, "Error: failed to locate %s id %"PRId64" in VAR_*S_IDS array in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* setup more pointers based on set_type */ if (set_type == EX_NODE_SET) { /* note we are using DIM_NUM_NODE_NS instead of DIM_NUM_DF_NS */ factptr = VAR_FACT_NS(set_id_ndx); } else if (set_type == EX_EDGE_SET) { factptr = VAR_FACT_ES(set_id_ndx); } else if (set_type == EX_FACE_SET) { factptr = VAR_FACT_FS(set_id_ndx); } else if (set_type == EX_SIDE_SET) { factptr = VAR_FACT_SS(set_id_ndx); } if (set_type == EX_ELEM_SET) { factptr = VAR_FACT_ELS(set_id_ndx); } /* find id of distribution factors variable */ if ((status = nc_inq_varid(exoid, factptr, &dist_id)) != NC_NOERR) { /* this test is only needed for node set because we're using DIM_NUM_NOD_NS instead of DIM_NUM_DF_NS*/ if (status == NC_ENOTVAR) { exerrval = EX_BADPARAM; sprintf(errmsg, "Warning: no dist factors defined for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id, exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_WARN); } else { exerrval = status; sprintf(errmsg, "Error: failed to locate dist factors list for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } } /* write out the distribution factors array */ if (ex_comp_ws(exoid) == 4) { status = nc_put_var_float(exoid, dist_id, set_dist_fact); } else { status = nc_put_var_double(exoid, dist_id, set_dist_fact); } if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to store dist factors for %s %"PRId64" in file id %d", ex_name_of_object(set_type), set_id,exoid); ex_err("ex_put_set_dist_fact",errmsg,exerrval); return (EX_FATAL); } return (EX_NOERR); }
#ifndef __JSMN_H_ #define __JSMN_H_ /** * JSON type identifier. Basic types are: * o Object * o Array * o String * o Other primitive: number, boolean (true/false) or null */ typedef enum { JSMN_PRIMITIVE = 0, JSMN_OBJECT = 1, JSMN_ARRAY = 2, JSMN_STRING = 3 } jsmntype_t; typedef enum { /* Not enough tokens were provided */ JSMN_ERROR_NOMEM = -1, /* Invalid character inside JSON string */ JSMN_ERROR_INVAL = -2, /* The string is not a full JSON packet, more bytes expected */ JSMN_ERROR_PART = -3, /* Everything was fine */ JSMN_SUCCESS = 0 } jsmnerr_t; /** * JSON token description. * @param type type (object, array, string etc.) * @param start start position in JSON data string * @param end end position in JSON data string */ typedef struct { jsmntype_t type; int start; int end; int size; #ifdef JSMN_PARENT_LINKS int parent; #endif } jsmntok_t; /** * JSON parser. Contains an array of token blocks available. Also stores * the string being parsed now and current position in that string */ typedef struct { unsigned int pos; /* offset in the JSON string */ int toknext; /* next token to allocate */ int toksuper; /* superior token node, e.g parent object or array */ } jsmn_parser; /** * Create JSON parser over an array of tokens */ void jsmn_init(jsmn_parser *parser); /** * Run JSON parser. It parses a JSON data string into and array of tokens, each describing * a single JSON object. */ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, jsmntok_t *tokens, unsigned int num_tokens); #endif /* __JSMN_H_ */
/* ScummVM - Graphic Adventure Engine * * ScummVM 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. * */ #ifndef SCUMM_PLAYERS_PLAYER_V2CMS_H #define SCUMM_PLAYERS_PLAYER_V2CMS_H #include "scumm/players/player_v2base.h" // for channel_data class CMSEmulator; namespace Scumm { /** * Scumm V2 CMS/Gameblaster MIDI driver. */ class Player_V2CMS : public Player_V2Base { public: Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer); virtual ~Player_V2CMS(); // MusicEngine API virtual void setMusicVolume(int vol); virtual void startSound(int sound); virtual void stopSound(int sound); virtual void stopAllSounds(); virtual int getMusicTimer(); virtual int getSoundStatus(int sound) const; // AudioStream API virtual int readBuffer(int16 *buffer, const int numSamples); virtual bool isStereo() const { return true; } private: struct Voice { byte attack; byte decay; byte sustain; byte release; byte octadd; int16 vibrato; int16 vibrato2; int16 noise; }; struct Voice2 { byte *amplitudeOutput; byte *freqOutput; byte *octaveOutput; uint8 channel; int8 sustainLevel; uint8 attackRate; uint8 maxAmpl; uint8 decayRate; uint8 sustainRate; uint8 releaseRate; uint8 releaseTime; int8 vibratoRate; int8 vibratoDepth; int8 curVibratoRate; int8 curVibratoUnk; int8 unkVibratoRate; int8 unkVibratoDepth; int8 unkRate; int8 unkCount; enum EnvelopeState { kEnvelopeAttack, kEnvelopeDecay, kEnvelopeSustain, kEnvelopeRelease }; EnvelopeState nextProcessState; uint8 curVolume; uint8 curOctave; uint8 curFreq; int8 octaveAdd; int8 playingNote; Voice2 *nextVoice; byte chanNumber; }; struct MusicChip { byte ampl[4]; byte freq[4]; byte octave[2]; }; Voice _cmsVoicesBase[16]; Voice2 _cmsVoices[8]; MusicChip _cmsChips[2]; uint8 _tempo; uint8 _tempoSum; byte _looping; byte _octaveMask; int16 _midiDelay; Voice2 *_midiChannel[16]; byte _midiChannelUse[16]; byte *_midiData; byte *_midiSongBegin; int _loadedMidiSong; byte _sfxFreq[4], _sfxAmpl[4], _sfxOctave[2]; byte _lastMidiCommand; uint _outputTableReady; byte _voiceTimer; int _musicTimer, _musicTimerTicks; void loadMidiData(byte *data, int sound); void play(); void processChannel(Voice2 *channel); void processRelease(Voice2 *channel); void processAttack(Voice2 *channel); void processDecay(Voice2 *channel); void processSustain(Voice2 *channel); void processVibrato(Voice2 *channel); void playMusicChips(const MusicChip *table); void playNote(byte *&data); void clearNote(byte *&data); void offAllChannels(); void playVoice(); void processMidiData(); Voice2 *getFreeVoice(); Voice2 *getPlayVoice(byte param); struct MidiNote { byte frequency; byte baseOctave; }; static const MidiNote _midiNotes[132]; static const byte _attackRate[16]; static const byte _decayRate[16]; static const byte _sustainRate[16]; static const byte _releaseRate[16]; static const byte _volumeTable[16]; static const byte _cmsInitData[26]; CMSEmulator *_cmsEmu; }; } // End of namespace Scumm #endif
#import "XADUnarchiver.h" #import "CSHandle.h" @interface XADPlatform:NSObject {} // Archive entry extraction. +(XADError)extractResourceForkEntryWithDictionary:(NSDictionary *)dict unarchiver:(XADUnarchiver *)unarchiver toPath:(NSString *)destpath; +(XADError)updateFileAttributesAtPath:(NSString *)path forEntryWithDictionary:(NSDictionary *)dict parser:(XADArchiveParser *)parser preservePermissions:(BOOL)preservepermissions; +(XADError)createLinkAtPath:(NSString *)path withDestinationPath:(NSString *)link; // Archive post-processing. +(id)readCloneableMetadataFromPath:(NSString *)path; +(void)writeCloneableMetadata:(id)metadata toPath:(NSString *)path; +(BOOL)copyDateFromPath:(NSString *)src toPath:(NSString *)dest; +(BOOL)resetDateAtPath:(NSString *)path; // Path functions. +(BOOL)fileExistsAtPath:(NSString *)path; +(BOOL)fileExistsAtPath:(NSString *)path isDirectory:(BOOL *)isdirptr; +(NSString *)uniqueDirectoryPathWithParentDirectory:(NSString *)parent; +(NSString *)sanitizedPathComponent:(NSString *)component; +(NSArray *)contentsOfDirectoryAtPath:(NSString *)path; +(BOOL)moveItemAtPath:(NSString *)src toPath:(NSString *)dest; +(BOOL)removeItemAtPath:(NSString *)path; // Resource forks +(CSHandle *)handleForReadingResourceForkAtPath:(NSString *)path; // Time functions. +(double)currentTimeInSeconds; @end
/* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.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. ** ** Any non-GPL usage of this software or parts of this software is strictly ** forbidden. ** ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** ** $Id: pns.h,v 1.2 2009-02-11 21:19:30 dave Exp $ **/ #ifndef __PNS_H__ #define __PNS_H__ #ifdef __cplusplus extern "C" { #endif #include "syntax.h" #define NOISE_OFFSET 90 void pns_decode(ic_stream *ics_left, ic_stream *ics_right, real_t *spec_left, real_t *spec_right, uint16_t frame_len, uint8_t channel_pair, uint8_t object_type); static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb) { if (ics->sfb_cb[group][sfb] == NOISE_HCB) return 1; return 0; } #ifdef __cplusplus } #endif #endif
#ifndef _ASM_CACHE_H #define _ASM_CACHE_H #include <arch/cache.h> #endif /* _ASM_CACHE_H */
/* Copyright 2013 Google Inc. All Rights Reserved. Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ /* Class to model the static dictionary. */ #ifndef BROTLI_ENC_STATIC_DICT_H_ #define BROTLI_ENC_STATIC_DICT_H_ #include "../common/dictionary.h" #include <brotli/types.h> #include "./port.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif #define BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN 37 static const uint32_t kInvalidMatch = 0xfffffff; /* Matches data against static dictionary words, and for each length l, for which a match is found, updates matches[l] to be the minimum possible (distance << 5) + len_code. Returns 1 if matches have been found, otherwise 0. Prerequisites: matches array is at least BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN + 1 long all elements are initialized to kInvalidMatch */ BROTLI_INTERNAL BROTLI_BOOL BrotliFindAllStaticDictionaryMatches( const BrotliDictionary* dictionary, const uint8_t* data, size_t min_length, size_t max_length, uint32_t* matches); #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */ #endif #endif /* BROTLI_ENC_STATIC_DICT_H_ */
/* ScummVM - Graphic Adventure Engine * * ScummVM 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. * */ #ifndef SCUMM_HE_MOONBASE_AI_TYPES_H #define SCUMM_HE_MOONBASE_AI_TYPES_H namespace Scumm { enum { AGI = 1, AONE = 2, BRUTAKAS = 3, CYBALL = 4, EL_GATO = 5, NEEP = 6, ORBNU_LUNATEK = 7, PIXELAHT = 8, SPANDO = 9, WARCUPINE = 10 }; enum { CRAWLER_CHUCKER = 11, ENERGY_HOG = 12, RANGER = 13 }; enum { AI_VAR_NONE = -1, AI_VAR_SMALL = 0, AI_VAR_MEDIUM = 1, AI_VAR_LARGE = 2, AI_VAR_HUGE = 5 }; enum { AI_VAR_BASE_BEHAVIOR = 10, AI_VAR_BASE_TARGET = 10, AI_VAR_BASE_ANGLE = 2, AI_VAR_BASE_POWER = 5 }; class AIEntity { private: int _id; char *_nameString; int _behaviorVariation; int _targetVariation; int _angleVariation; int _powerVariation; public: AIEntity(int id); ~AIEntity() { if (_nameString) { delete[] _nameString; _nameString = 0; } } int getID() const { return _id; } char *getNameString() const { return _nameString; } int getBehaviorVariation() const { return _behaviorVariation; } int getTargetVariation() const { return _targetVariation; } int getAngleVariation() const { return _angleVariation; } int getPowerVariation() const { return _powerVariation; } void setID(int id) { _id = id; } void setNameString(char *nameString) { _nameString = nameString; } void setBehaviorVariation(int behaviorVariation) { _behaviorVariation = behaviorVariation; } void setTargetVariation(int targetVariation) { _targetVariation = targetVariation; } void setAngleVariation(int angleVariation) { _angleVariation = angleVariation; } void setPowerVariation(int powerVariation) { _powerVariation = powerVariation; } }; } // End of namespace Scumm #endif
// 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_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ #include <map> #include <string> #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" #include "net/cookies/canonical_cookie.h" // Mock for BrowsingDataCookieHelper. class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { public: explicit MockBrowsingDataCookieHelper( net::URLRequestContextGetter* request_context_getter); // BrowsingDataCookieHelper methods. void StartFetching( const net::CookieMonster::GetCookieListCallback& callback) override; void DeleteCookie(const net::CanonicalCookie& cookie) override; // Adds some cookie samples. void AddCookieSamples(const GURL& url, const std::string& cookie_line); // Notifies the callback. void Notify(); // Marks all cookies as existing. void Reset(); // Returns true if all cookies since the last Reset() invocation were // deleted. bool AllDeleted(); private: ~MockBrowsingDataCookieHelper() override; net::CookieMonster::GetCookieListCallback callback_; net::CookieList cookie_list_; // Stores which cookies exist. std::map<const std::string, bool> cookies_; DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCookieHelper); }; #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_
/* * Freescale SPI/eSPI controller driver library. * * Maintainer: Kumar Gala * * Copyright 2010 Freescale Semiconductor, Inc. * Copyright (C) 2006 Polycom, Inc. * * CPM SPI and QE buffer descriptors mode support: * Copyright (c) 2009 MontaVista Software, Inc. * Author: Anton Vorontsov <avorontsov@ru.mvista.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #ifndef __SPI_FSL_LIB_H__ #define __SPI_FSL_LIB_H__ #include <asm/io.h> struct mpc8xxx_spi { struct device *dev; void *reg_base; const void *tx; void *rx; #ifdef CONFIG_SPI_FSL_ESPI int len; #endif int subblock; struct spi_pram __iomem *pram; struct cpm_buf_desc __iomem *tx_bd; struct cpm_buf_desc __iomem *rx_bd; struct spi_transfer *xfer_in_progress; dma_addr_t tx_dma; dma_addr_t rx_dma; bool map_tx_dma; bool map_rx_dma; dma_addr_t dma_dummy_tx; dma_addr_t dma_dummy_rx; void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); u32(*get_tx) (struct mpc8xxx_spi *); void (*spi_do_one_msg) (struct spi_message *m); void (*spi_remove) (struct mpc8xxx_spi *mspi); unsigned int count; unsigned int irq; unsigned nsecs; u32 spibrg; u32 rx_shift; u32 tx_shift; unsigned int flags; struct workqueue_struct *workqueue; struct work_struct work; struct list_head queue; spinlock_t lock; struct completion done; }; struct spi_mpc8xxx_cs { void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); u32 (*get_tx) (struct mpc8xxx_spi *); u32 rx_shift; u32 tx_shift; u32 hw_mode; }; static inline void mpc8xxx_spi_write_reg(__be32 __iomem *reg, u32 val) { out_be32(reg, val); } static inline u32 mpc8xxx_spi_read_reg(__be32 __iomem *reg) { return in_be32(reg); } struct mpc8xxx_spi_probe_info { struct fsl_spi_platform_data pdata; int *gpios; bool *alow_flags; }; extern u32 mpc8xxx_spi_tx_buf_u8(struct mpc8xxx_spi *mpc8xxx_spi); extern u32 mpc8xxx_spi_tx_buf_u16(struct mpc8xxx_spi *mpc8xxx_spi); extern u32 mpc8xxx_spi_tx_buf_u32(struct mpc8xxx_spi *mpc8xxx_spi); extern void mpc8xxx_spi_rx_buf_u8(u32 data, struct mpc8xxx_spi *mpc8xxx_spi); extern void mpc8xxx_spi_rx_buf_u16(u32 data, struct mpc8xxx_spi *mpc8xxx_spi); extern void mpc8xxx_spi_rx_buf_u32(u32 data, struct mpc8xxx_spi *mpc8xxx_spi); extern struct mpc8xxx_spi_probe_info *to_of_pinfo( struct fsl_spi_platform_data *pdata); extern int mpc8xxx_spi_bufs(struct mpc8xxx_spi *mspi, struct spi_transfer *t, unsigned int len); extern int mpc8xxx_spi_transfer(struct spi_device *spi, struct spi_message *m); extern void mpc8xxx_spi_cleanup(struct spi_device *spi); extern const char *mpc8xxx_spi_strmode(unsigned int flags); extern int mpc8xxx_spi_probe(struct device *dev, struct resource *mem, unsigned int irq); extern int mpc8xxx_spi_remove(struct device *dev); extern int of_mpc8xxx_spi_probe(struct platform_device *ofdev); #endif
/* This testcase is part of GDB, the GNU debugger. Copyright 2009-2013 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 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <assert.h> int init_stub (int arg) { return 0; } int final (int arg) { return arg + 1; } /* Make differentiation of how the gnu_ifunc call resolves before and after calling gnu_ifunc_pre. This ensures the resolved function address is not being cached anywhere for the debugging purposes. */ volatile int gnu_ifunc_initialized; static void gnu_ifunc_pre (void) { assert (!gnu_ifunc_initialized); gnu_ifunc_initialized = 1; } extern int gnu_ifunc (int arg); int main (void) { int i; gnu_ifunc_pre (); i = gnu_ifunc (1); /* break-at-call */ assert (i == 2); gnu_ifunc (2); /* break-at-nextcall */ return 0; /* break-at-exit */ }
#ifndef _ASM_X86_KGDB_H #define _ASM_X86_KGDB_H /* * Copyright (C) 2001-2004 Amit S. Kale * Copyright (C) 2008 Wind River Systems, Inc. */ #define BUFMAX 1024 #ifdef CONFIG_X86_32 enum regnames { GDB_AX, GDB_CX, GDB_DX, GDB_BX, GDB_SP, GDB_BP, GDB_SI, GDB_DI, GDB_PC, GDB_PS, GDB_CS, GDB_SS, GDB_DS, GDB_ES, GDB_FS, GDB_GS, }; #define GDB_ORIG_AX 41 #define DBG_MAX_REG_NUM 16 #define NUMREGBYTES ((GDB_GS+1)*4) #else enum regnames { GDB_AX, GDB_BX, GDB_CX, GDB_DX, GDB_SI, GDB_DI, GDB_BP, GDB_SP, GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15, GDB_PC, GDB_PS, GDB_CS, GDB_SS, GDB_DS, GDB_ES, GDB_FS, GDB_GS, }; #define GDB_ORIG_AX 57 #define DBG_MAX_REG_NUM 24 #define NUMREGBYTES ((17 * 8) + (5 * 4)) #endif static inline void arch_kgdb_breakpoint(void) { asm(" int $3"); } #define BREAK_INSTR_SIZE 1 #define CACHE_FLUSH_IS_SAFE 1 #define GDB_ADJUSTS_BREAK_OFFSET extern int kgdb_ll_trap(int cmd, const char *str, struct pt_regs *regs, long err, int trap, int sig); #endif
/* * ioctl.h * * Function prototypes * * Copyright (C) 2006 Herbert Poetzl * */ #ifndef OCFS2_IOCTL_PROTO_H #define OCFS2_IOCTL_PROTO_H long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); long ocfs2_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg); #endif
/********************************************************************* * * Filename: timer.h * Version: * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Aug 16 00:59:29 1997 * Modified at: Thu Oct 7 12:25:24 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>, * All Rights Reserved. * Copyright (c) 2000-2002 Jean Tourrilhes <jt@hpl.hp.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. * * Neither Dag Brattli nor University of Tromsø admit liability nor * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ #ifndef TIMER_H #define TIMER_H #include <linux/timer.h> #include <linux/jiffies.h> #include <asm/param.h> #include <net/irda/irda.h> struct irlmp_cb; struct irlap_cb; struct lsap_cb; struct lap_cb; #define POLL_TIMEOUT (450*HZ/1000) #define FINAL_TIMEOUT (500*HZ/1000) #define WD_TIMEOUT (POLL_TIMEOUT*2) #define MEDIABUSY_TIMEOUT (500*HZ/1000) #define SMALLBUSY_TIMEOUT (100*HZ/1000) #define SLOT_TIMEOUT (90*HZ/1000) #define XIDEXTRA_TIMEOUT (34*HZ/1000) #define WATCHDOG_TIMEOUT (20*HZ) typedef void (*TIMER_CALLBACK)(void *); static inline void irda_start_timer(struct timer_list *ptimer, int timeout, void* data, TIMER_CALLBACK callback) { ptimer->function = (void (*)(unsigned long)) callback; ptimer->data = (unsigned long) data; mod_timer(ptimer, jiffies + timeout); } void irlap_start_slot_timer(struct irlap_cb *self, int timeout); void irlap_start_query_timer(struct irlap_cb *self, int S, int s); void irlap_start_final_timer(struct irlap_cb *self, int timeout); void irlap_start_wd_timer(struct irlap_cb *self, int timeout); void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout); void irlap_stop_mbusy_timer(struct irlap_cb *); void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); void irlmp_start_idle_timer(struct lap_cb *, int timeout); void irlmp_stop_idle_timer(struct lap_cb *self); #endif
/* * linux/arch/unicore32/kernel/puv3-core.c * * Code specific to PKUnity SoC and UniCore ISA * * Maintained by GUAN Xue-tao <gxt@mprc.pku.edu.cn> * Copyright (C) 2001-2010 Guan Xuetao * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/init.h> #include <linux/device.h> #include <linux/amba/bus.h> #include <linux/platform_device.h> #include <linux/io.h> #include <linux/cnt32_to_63.h> #include <linux/usb/musb.h> #include <asm/irq.h> #include <mach/hardware.h> #include <mach/pm.h> unsigned long long sched_clock(void) { unsigned long long v = cnt32_to_63(readl(OST_OSCR)); v = ((v & 0x7fffffffffffffffULL) * 2235) >> 5; return v; } static struct resource puv3_usb_resources[] = { { .start = io_v2p(PKUNITY_USB_BASE), .end = io_v2p(PKUNITY_USB_BASE) + 0x3ff, .flags = IORESOURCE_MEM, }, { .start = IRQ_USB, .flags = IORESOURCE_IRQ, }, { .start = IRQ_USB, .flags = IORESOURCE_IRQ, }, }; static struct musb_hdrc_config puv3_usb_config[] = { { .num_eps = 16, .multipoint = 1, #ifdef CONFIG_USB_INVENTRA_DMA .dma = 1, .dma_channels = 8, #endif }, }; static struct musb_hdrc_platform_data puv3_usb_plat = { .mode = MUSB_HOST, .min_power = 100, .clock = 0, .config = puv3_usb_config, }; static struct resource puv3_mmc_resources[] = { [0] = { .start = io_v2p(PKUNITY_SDC_BASE), .end = io_v2p(PKUNITY_SDC_BASE) + 0xfff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_SDC, .end = IRQ_SDC, .flags = IORESOURCE_IRQ, }, }; static struct resource puv3_unigfx_resources[] = { [0] = { .start = io_v2p(PKUNITY_UNIGFX_BASE), .end = io_v2p(PKUNITY_UNIGFX_BASE) + 0xfff, .flags = IORESOURCE_MEM, }, }; static struct resource puv3_rtc_resources[] = { [0] = { .start = io_v2p(PKUNITY_RTC_BASE), .end = io_v2p(PKUNITY_RTC_BASE) + 0xff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_RTCAlarm, .end = IRQ_RTCAlarm, .flags = IORESOURCE_IRQ, }, [2] = { .start = IRQ_RTC, .end = IRQ_RTC, .flags = IORESOURCE_IRQ } }; static struct resource puv3_pwm_resources[] = { [0] = { .start = io_v2p(PKUNITY_OST_BASE) + 0x80, .end = io_v2p(PKUNITY_OST_BASE) + 0xff, .flags = IORESOURCE_MEM, }, }; static struct resource puv3_uart0_resources[] = { [0] = { .start = io_v2p(PKUNITY_UART0_BASE), .end = io_v2p(PKUNITY_UART0_BASE) + 0xff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_UART0, .end = IRQ_UART0, .flags = IORESOURCE_IRQ } }; static struct resource puv3_uart1_resources[] = { [0] = { .start = io_v2p(PKUNITY_UART1_BASE), .end = io_v2p(PKUNITY_UART1_BASE) + 0xff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_UART1, .end = IRQ_UART1, .flags = IORESOURCE_IRQ } }; static struct resource puv3_umal_resources[] = { [0] = { .start = io_v2p(PKUNITY_UMAL_BASE), .end = io_v2p(PKUNITY_UMAL_BASE) + 0x1fff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_UMAL, .end = IRQ_UMAL, .flags = IORESOURCE_IRQ } }; #ifdef CONFIG_PUV3_PM #define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x #define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] enum { SLEEP_SAVE_PM_PLLDDRCFG, SLEEP_SAVE_COUNT }; static void puv3_cpu_pm_save(unsigned long *sleep_save) { } static void puv3_cpu_pm_restore(unsigned long *sleep_save) { } static int puv3_cpu_pm_prepare(void) { writel(virt_to_phys(puv3_cpu_resume), PM_DIVCFG); return 0; } static void puv3_cpu_pm_enter(suspend_state_t state) { writel(RESETC_RSSR_HWR | RESETC_RSSR_WDR | RESETC_RSSR_SMR | RESETC_RSSR_SWR, RESETC_RSSR); switch (state) { case PM_SUSPEND_MEM: puv3_cpu_pm_prepare(); puv3_cpu_suspend(PM_PMCR_SFB); break; } } static int puv3_cpu_pm_valid(suspend_state_t state) { return state == PM_SUSPEND_MEM; } static void puv3_cpu_pm_finish(void) { } static struct puv3_cpu_pm_fns puv3_cpu_pm_fnss = { .save_count = SLEEP_SAVE_COUNT, .valid = puv3_cpu_pm_valid, .save = puv3_cpu_pm_save, .restore = puv3_cpu_pm_restore, .enter = puv3_cpu_pm_enter, .prepare = puv3_cpu_pm_prepare, .finish = puv3_cpu_pm_finish, }; static void __init puv3_init_pm(void) { puv3_cpu_pm_fns = &puv3_cpu_pm_fnss; } #else static inline void puv3_init_pm(void) {} #endif void puv3_ps2_init(void) { struct clk *bclk32; bclk32 = clk_get(NULL, "BUS32_CLK"); writel(clk_get_rate(bclk32) / 200000, PS2_CNT); } void __init puv3_core_init(void) { puv3_init_pm(); puv3_ps2_init(); platform_device_register_simple("PKUnity-v3-RTC", -1, puv3_rtc_resources, ARRAY_SIZE(puv3_rtc_resources)); platform_device_register_simple("PKUnity-v3-UMAL", -1, puv3_umal_resources, ARRAY_SIZE(puv3_umal_resources)); platform_device_register_simple("PKUnity-v3-MMC", -1, puv3_mmc_resources, ARRAY_SIZE(puv3_mmc_resources)); platform_device_register_simple("PKUnity-v3-UNIGFX", -1, puv3_unigfx_resources, ARRAY_SIZE(puv3_unigfx_resources)); platform_device_register_simple("PKUnity-v3-PWM", -1, puv3_pwm_resources, ARRAY_SIZE(puv3_pwm_resources)); platform_device_register_simple("PKUnity-v3-UART", 0, puv3_uart0_resources, ARRAY_SIZE(puv3_uart0_resources)); platform_device_register_simple("PKUnity-v3-UART", 1, puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources)); platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0); platform_device_register_resndata(&platform_bus, "musb_hdrc", -1, puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources), &puv3_usb_plat, sizeof(puv3_usb_plat)); }
/* * Copyright (c) 2005 Network Appliance, Inc. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * 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. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef IW_CM_H #define IW_CM_H #include <linux/in.h> #include <rdma/ib_cm.h> struct iw_cm_id; enum iw_cm_event_type { IW_CM_EVENT_CONNECT_REQUEST = 1, IW_CM_EVENT_CONNECT_REPLY, IW_CM_EVENT_ESTABLISHED, IW_CM_EVENT_DISCONNECT, IW_CM_EVENT_CLOSE }; struct iw_cm_event { enum iw_cm_event_type event; int status; struct sockaddr_in local_addr; struct sockaddr_in remote_addr; void *private_data; void *provider_data; u8 private_data_len; u8 ord; u8 ird; }; typedef int (*iw_cm_handler)(struct iw_cm_id *cm_id, struct iw_cm_event *event); typedef int (*iw_event_handler)(struct iw_cm_id *cm_id, struct iw_cm_event *event); struct iw_cm_id { iw_cm_handler cm_handler; void *context; struct ib_device *device; struct sockaddr_in local_addr; struct sockaddr_in remote_addr; void *provider_data; iw_event_handler event_handler; void (*add_ref)(struct iw_cm_id *); void (*rem_ref)(struct iw_cm_id *); }; struct iw_cm_conn_param { const void *private_data; u16 private_data_len; u32 ord; u32 ird; u32 qpn; }; struct iw_cm_verbs { void (*add_ref)(struct ib_qp *qp); void (*rem_ref)(struct ib_qp *qp); struct ib_qp * (*get_qp)(struct ib_device *device, int qpn); int (*connect)(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); int (*accept)(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param); int (*reject)(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len); int (*create_listen)(struct iw_cm_id *cm_id, int backlog); int (*destroy_listen)(struct iw_cm_id *cm_id); }; struct iw_cm_id *iw_create_cm_id(struct ib_device *device, iw_cm_handler cm_handler, void *context); void iw_destroy_cm_id(struct iw_cm_id *cm_id); void iw_cm_unbind_qp(struct iw_cm_id *cm_id, struct ib_qp *qp); struct ib_qp *iw_cm_get_qp(struct ib_device *device, int qpn); int iw_cm_listen(struct iw_cm_id *cm_id, int backlog); int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data, u8 private_data_len); int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param); int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt); int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, int *qp_attr_mask); #endif
#ifndef _ASM_X86_USER_H #define _ASM_X86_USER_H #ifdef CONFIG_X86_32 # include "user_32.h" #else # include "user_64.h" #endif #include <asm/types.h> struct user_ymmh_regs { __u32 ymmh_space[64]; }; struct user_xsave_hdr { __u64 xstate_bv; __u64 reserved1[2]; __u64 reserved2[5]; }; #define USER_XSTATE_FX_SW_WORDS 6 #define USER_XSTATE_XCR0_WORD 0 struct user_xstateregs { struct { __u64 fpx_space[58]; __u64 xstate_fx_sw[USER_XSTATE_FX_SW_WORDS]; } i387; struct user_xsave_hdr xsave_hdr; struct user_ymmh_regs ymmh; }; #endif
/* More subroutines needed by GCC output code on some machines. */ /* Compile this one with gcc. */ /* Copyright (C) 1989-2014 Free Software Foundation, Inc. This file is part of GCC. GCC 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. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ /* The libgcc2.c implementation gets confused by our type setup and creates a directly recursive call, so we do our own implementation. For the H8/300, that's in lib1funcs.S, for H8/300H and H8S, it's here. */ #ifndef __H8300__ long __fixunssfsi (float a); long __fixunssfsi (float a) { if (a >= (float) 32768L) return (long) (a - 32768L) + 32768L; return (long) a; } #endif
#ifndef __MACH_CPU_AXI_H #define __MACH_CPU_AXI_H #include <plat/cpu_axi.h> #define CPU_AXI_BUS_BASE RK2928_CPU_AXI_BUS_BASE #define CPU_AXI_CPU0_QOS_BASE (CPU_AXI_BUS_BASE + 0x2000) #define CPU_AXI_CPU1W_QOS_BASE (CPU_AXI_BUS_BASE + 0x2080) #define CPU_AXI_CPU1R_QOS_BASE (CPU_AXI_BUS_BASE + 0x2100) #define CPU_AXI_PERI_QOS_BASE (CPU_AXI_BUS_BASE + 0x4000) #define CPU_AXI_GPU_QOS_BASE (CPU_AXI_BUS_BASE + 0x5000) #define CPU_AXI_VPU_QOS_BASE (CPU_AXI_BUS_BASE + 0x6000) #define CPU_AXI_LCDC1_QOS_BASE (CPU_AXI_BUS_BASE + 0x7000) #define CPU_AXI_EBC_QOS_BASE (CPU_AXI_BUS_BASE + 0x7080) #define CPU_AXI_IEP_QOS_BASE (CPU_AXI_BUS_BASE + 0x7100) #define CPU_AXI_LCDC0_QOS_BASE (CPU_AXI_BUS_BASE + 0x7180) #define CPU_AXI_CIF0_QOS_BASE (CPU_AXI_BUS_BASE + 0x7200) #define CPU_AXI_RGA_QOS_BASE (CPU_AXI_BUS_BASE + 0x7280) #endif
/* * Definitions etc. for regexp(3) routines. * * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], * not the System V one. */ #define NSUBEXP 10 typedef struct regexp { char *startp[NSUBEXP]; char *endp[NSUBEXP]; char regstart; /* Internal use only. */ char reganch; /* Internal use only. */ char *regmust; /* Internal use only. */ int regmlen; /* Internal use only. */ char program[1]; /* Unwarranted chumminess with compiler. */ } regexp; extern regexp *regcomp(); extern int regexec(); extern void regsub(); extern void regerror();
#ifndef __TPM_EVENTLOG_H__ #define __TPM_EVENTLOG_H__ #define TCG_EVENT_NAME_LEN_MAX 255 #define MAX_TEXT_EVENT 1000 /* Max event string length */ #define ACPI_TCPA_SIG "TCPA" /* 0x41504354 /'TCPA' */ #ifdef CONFIG_PPC64 #define do_endian_conversion(x) be32_to_cpu(x) #else #define do_endian_conversion(x) x #endif enum bios_platform_class { BIOS_CLIENT = 0x00, BIOS_SERVER = 0x01, }; struct tpm_bios_log { void *bios_event_log; void *bios_event_log_end; }; struct tcpa_event { u32 pcr_index; u32 event_type; u8 pcr_value[20]; /* SHA1 */ u32 event_size; u8 event_data[0]; }; enum tcpa_event_types { PREBOOT = 0, POST_CODE, UNUSED, NO_ACTION, SEPARATOR, ACTION, EVENT_TAG, SCRTM_CONTENTS, SCRTM_VERSION, CPU_MICROCODE, PLATFORM_CONFIG_FLAGS, TABLE_OF_DEVICES, COMPACT_HASH, IPL, IPL_PARTITION_DATA, NONHOST_CODE, NONHOST_CONFIG, NONHOST_INFO, }; struct tcpa_pc_event { u32 event_id; u32 event_size; u8 event_data[0]; }; enum tcpa_pc_event_ids { SMBIOS = 1, BIS_CERT, POST_BIOS_ROM, ESCD, CMOS, NVRAM, OPTION_ROM_EXEC, OPTION_ROM_CONFIG, OPTION_ROM_MICROCODE = 10, S_CRTM_VERSION, S_CRTM_CONTENTS, POST_CONTENTS, HOST_TABLE_OF_DEVICES, }; #if defined(CONFIG_ACPI) int tpm_read_log_acpi(struct tpm_chip *chip); #else static inline int tpm_read_log_acpi(struct tpm_chip *chip) { return -ENODEV; } #endif #if defined(CONFIG_OF) int tpm_read_log_of(struct tpm_chip *chip); #else static inline int tpm_read_log_of(struct tpm_chip *chip) { return -ENODEV; } #endif int tpm_bios_log_setup(struct tpm_chip *chip); void tpm_bios_log_teardown(struct tpm_chip *chip); #endif
/* Perform an inferior function call, for GDB, the GNU debugger. Copyright (C) 2003-2014 Free Software Foundation, Inc. This file is part of GDB. 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 INFCALL_H #define INFCALL_H struct value; struct type; extern CORE_ADDR find_function_addr (struct value *function, struct type **retval_type); /* Perform a function call in the inferior. ARGS is a vector of values of arguments (NARGS of them). FUNCTION is a value, the function to be called. Returns a value representing what the function returned. May fail to return, if a breakpoint or signal is hit during the execution of the function. ARGS is modified to contain coerced values. */ extern struct value *call_function_by_hand (struct value *function, int nargs, struct value **args); #endif
/* mbc code */ /* Copyright 1989 Carnegie Mellon University */ typedef struct pitch_struct { int ppitch; int pbend; } pitch_table; /* end */
/* * linux/arch/arm/kernel/irq.c * * Copyright (C) 1992 Linus Torvalds * Modifications for ARM processor Copyright (C) 1995-2000 Russell King. * * Support for Dynamic Tick Timer Copyright (C) 2004-2005 Nokia Corporation. * Dynamic Tick Timer written by Tony Lindgren <tony@atomide.com> and * Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This file contains the code used by various IRQ handling routines: * asking for different IRQ's should be done through these routines * instead of just grabbing them. Thus setups with different IRQ numbers * shouldn't result in any weird surprises, and installing new handlers * should be easier. * * IRQ's are in fact implemented a bit like signal handlers for the kernel. * Naturally it's not a 1:1 relation, but there are similarities. */ #include <linux/kernel_stat.h> #include <linux/signal.h> #include <linux/ioport.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/random.h> #include <linux/smp.h> #include <linux/init.h> #include <linux/seq_file.h> #include <linux/errno.h> #include <linux/list.h> #include <linux/kallsyms.h> #include <linux/proc_fs.h> #include <linux/export.h> #include <asm/exception.h> #include <asm/mach/arch.h> #include <asm/mach/irq.h> #include <asm/mach/time.h> #include <linux/mt_sched_mon.h> unsigned long irq_err_count; int arch_show_interrupts(struct seq_file *p, int prec) { #ifdef CONFIG_FIQ show_fiq_list(p, prec); #endif #ifdef CONFIG_SMP show_ipi_list(p, prec); #endif seq_printf(p, "%*s: %10lu\n", prec, "Err", irq_err_count); return 0; } /* * handle_IRQ handles all hardware IRQ's. Decoded IRQs should * not come via this function. Instead, they should provide their * own 'handler'. Used by platform code implementing C-based 1st * level decoding. */ void handle_IRQ(unsigned int irq, struct pt_regs *regs) { struct pt_regs *old_regs = set_irq_regs(regs); mt_trace_ISR_start(irq); irq_enter(); /* * Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ if (unlikely(irq >= nr_irqs)) { if (printk_ratelimit()) printk(KERN_WARNING "Bad IRQ%u\n", irq); ack_bad_irq(irq); } else { generic_handle_irq(irq); } mt_trace_ISR_end(irq); irq_exit(); set_irq_regs(old_regs); } /* * asm_do_IRQ is the interface to be used from assembly code. */ asmlinkage void __exception_irq_entry asm_do_IRQ(unsigned int irq, struct pt_regs *regs) { handle_IRQ(irq, regs); } void set_irq_flags(unsigned int irq, unsigned int iflags) { unsigned long clr = 0, set = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; if (irq >= nr_irqs) { printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq); return; } if (iflags & IRQF_VALID) clr |= IRQ_NOREQUEST; if (iflags & IRQF_PROBE) clr |= IRQ_NOPROBE; if (!(iflags & IRQF_NOAUTOEN)) clr |= IRQ_NOAUTOEN; /* Order is clear bits in "clr" then set bits in "set" */ irq_modify_status(irq, clr, set & ~clr); } EXPORT_SYMBOL_GPL(set_irq_flags); void __init init_IRQ(void) { if (IS_ENABLED(CONFIG_OF) && !machine_desc->init_irq) irqchip_init(); else machine_desc->init_irq(); } #ifdef CONFIG_MULTI_IRQ_HANDLER void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) { if (handle_arch_irq) return; handle_arch_irq = handle_irq; } #endif #ifdef CONFIG_SPARSE_IRQ int __init arch_probe_nr_irqs(void) { nr_irqs = machine_desc->nr_irqs ? machine_desc->nr_irqs : NR_IRQS; return nr_irqs; } #endif #ifdef CONFIG_HOTPLUG_CPU static bool migrate_one_irq(struct irq_desc *desc) { struct irq_data *d = irq_desc_get_irq_data(desc); const struct cpumask *affinity = d->affinity; struct irq_chip *c; bool ret = false; /* * If this is a per-CPU interrupt, or the affinity does not * include this CPU, then we have nothing to do. */ if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) return false; if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { affinity = cpu_online_mask; ret = true; } c = irq_data_get_irq_chip(d); if (!c->irq_set_affinity) pr_debug("IRQ%u: unable to set affinity\n", d->irq); else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) cpumask_copy(d->affinity, affinity); return ret; } /* * The current CPU has been marked offline. Migrate IRQs off this CPU. * If the affinity settings do not allow other CPUs, force them onto any * available CPU. * * Note: we must iterate over all IRQs, whether they have an attached * action structure or not, as we need to get chained interrupts too. */ void migrate_irqs(void) { unsigned int i; struct irq_desc *desc; unsigned long flags; local_irq_save(flags); for_each_irq_desc(i, desc) { bool affinity_broken; raw_spin_lock(&desc->lock); affinity_broken = migrate_one_irq(desc); raw_spin_unlock(&desc->lock); if (affinity_broken && printk_ratelimit()) pr_warning("IRQ%u no longer affine to CPU%u\n", i, smp_processor_id()); } local_irq_restore(flags); } #endif /* CONFIG_HOTPLUG_CPU */
/* * Copyright 2016 Red Hat 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include "gk104.h" #include "changk104.h" static const struct nvkm_fifo_func gk110_fifo = { .dtor = gk104_fifo_dtor, .oneinit = gk104_fifo_oneinit, .init = gk104_fifo_init, .fini = gk104_fifo_fini, .intr = gk104_fifo_intr, .uevent_init = gk104_fifo_uevent_init, .uevent_fini = gk104_fifo_uevent_fini, .chan = { &gk110_fifo_gpfifo_oclass, NULL }, }; int gk110_fifo_new(struct nvkm_device *device, int index, struct nvkm_fifo **pfifo) { return gk104_fifo_new_(&gk110_fifo, device, index, 4096, pfifo); }
/******************************************************************************* Copyright (c) 2011, 2012 Dmitry Matveev <me@dmitrymatveev.co.uk> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *******************************************************************************/ #ifndef __DEP_LIST_H__ #define __DEP_LIST_H__ #include <sys/types.h> /* ino_t */ typedef struct dep_list { struct dep_list *next; char *path; ino_t inode; } dep_list; typedef void (* no_entry_cb) (void *udata); typedef void (* single_entry_cb) (void *udata, const char *path, ino_t inode); typedef void (* dual_entry_cb) (void *udata, const char *from_path, ino_t from_inode, const char *to_path, ino_t to_inode); typedef void (* list_cb) (void *udata, const dep_list *list); typedef struct traverse_cbs { single_entry_cb added; single_entry_cb removed; dual_entry_cb replaced; single_entry_cb overwritten; dual_entry_cb moved; list_cb many_added; list_cb many_removed; no_entry_cb names_updated; } traverse_cbs; dep_list* dl_create (char *path, ino_t inode); void dl_print (const dep_list *dl); dep_list* dl_shallow_copy (const dep_list *dl); void dl_shallow_free (dep_list *dl); void dl_free (dep_list *dl); dep_list* dl_listing (const char *path); void dl_diff (dep_list **before, dep_list **after); void dl_calculate (dep_list *before, dep_list *after, const traverse_cbs *cbs, void *udata); #endif /* __DEP_LIST_H__ */
#ifndef _ALLOCA_H #define _ALLOCA_H #ifdef __cplusplus extern "C" { #endif #define __NEED_size_t #include <bits/alltypes.h> void *alloca(size_t); #ifdef __GNUC__ #define alloca __builtin_alloca #endif #ifdef __cplusplus } #endif #endif
/* * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ #include <errno.h> /* This routine is jumped to by all the syscall handlers, to stash an error number into errno. */ int attribute_hidden __syscall_error (void) { register int err_no __asm__("$0"); __set_errno (err_no); return -1; }
// 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_EXTENSIONS_EXTENSION_WEB_UI_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_H_ #include <string> #include "base/memory/scoped_ptr.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "components/favicon_base/favicon_callback.h" #include "content/public/browser/web_ui_controller.h" class Profile; namespace content { class BrowserContext; class WebContents; } namespace extensions { class BookmarkManagerPrivateDragEventRouter; } namespace user_prefs { class PrefRegistrySyncable; } // This class implements WebUI for extensions and allows extensions to put UI in // the main tab contents area. For example, each extension can specify an // "options_page", and that page is displayed in the tab contents area and is // hosted by this class. class ExtensionWebUI : public content::WebUIController { public: static const char kExtensionURLOverrides[]; ExtensionWebUI(content::WebUI* web_ui, const GURL& url); virtual ~ExtensionWebUI(); virtual extensions::BookmarkManagerPrivateDragEventRouter* bookmark_manager_private_drag_event_router(); // BrowserURLHandler static bool HandleChromeURLOverride(GURL* url, content::BrowserContext* browser_context); static bool HandleChromeURLOverrideReverse( GURL* url, content::BrowserContext* browser_context); // Register and unregister a dictionary of one or more overrides. // Page names are the keys, and chrome-extension: URLs are the values. // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" } static void RegisterChromeURLOverrides(Profile* profile, const extensions::URLOverrides::URLOverrideMap& overrides); static void UnregisterChromeURLOverrides(Profile* profile, const extensions::URLOverrides::URLOverrideMap& overrides); static void UnregisterChromeURLOverride(const std::string& page, Profile* profile, const base::Value* override); // Called from BrowserPrefs static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); // Get the favicon for the extension by getting an icon from the manifest. // Note. |callback| is always run asynchronously. static void GetFaviconForURL( Profile* profile, const GURL& page_url, const favicon_base::FaviconResultsCallback& callback); private: // Unregister the specified override, and if it's the currently active one, // ensure that something takes its place. static void UnregisterAndReplaceOverride(const std::string& page, Profile* profile, base::ListValue* list, const base::Value* override); // TODO(aa): This seems out of place. Why is it not with the event routers for // the other extension APIs? scoped_ptr<extensions::BookmarkManagerPrivateDragEventRouter> bookmark_manager_private_drag_event_router_; // The URL this WebUI was created for. GURL url_; }; #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_UI_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 IPC_IPC_CHANNEL_READER_H_ #define IPC_IPC_CHANNEL_READER_H_ #include "base/basictypes.h" #include "ipc/ipc_channel.h" namespace IPC { namespace internal { // This class provides common pipe reading functionality for the // platform-specific IPC channel implementations. // // It does the common input buffer management and message dispatch, while the // platform-specific parts provide the pipe management through a virtual // interface implemented on a per-platform basis. // // Note that there is no "writer" corresponding to this because the code for // writing to the channel is much simpler and has very little common // functionality that would benefit from being factored out. If we add // something like that in the future, it would be more appropriate to add it // here (and rename appropriately) rather than writing a different class. class ChannelReader { public: explicit ChannelReader(Listener* listener); virtual ~ChannelReader(); void set_listener(Listener* listener) { listener_ = listener; } // Call to process messages received from the IPC connection and dispatch // them. Returns false on channel error. True indicates that everything // succeeded, although there may not have been any messages processed. bool ProcessIncomingMessages(); // Handles asynchronously read data. // // Optionally call this after returning READ_PENDING from ReadData to // indicate that buffer was filled with the given number of bytes of // data. See ReadData for more. bool AsyncReadComplete(int bytes_read); // Returns true if the given message is the "hello" message sent on channel // set-up. bool IsHelloMessage(const Message& m) const; protected: enum ReadState { READ_SUCCEEDED, READ_FAILED, READ_PENDING }; Listener* listener() const { return listener_; } // Populates the given buffer with data from the pipe. // // Returns the state of the read. On READ_SUCCESS, the number of bytes // read will be placed into |*bytes_read| (which can be less than the // buffer size). On READ_FAILED, the channel will be closed. // // If the return value is READ_PENDING, it means that there was no data // ready for reading. The implementation is then responsible for either // calling AsyncReadComplete with the number of bytes read into the // buffer, or ProcessIncomingMessages to try the read again (depending // on whether the platform's async I/O is "try again" or "write // asynchronously into your buffer"). virtual ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) = 0; // Loads the required file desciptors into the given message. Returns true // on success. False means a fatal channel error. // // This will read from the input_fds_ and read more handles from the FD // pipe if necessary. virtual bool WillDispatchInputMessage(Message* msg) = 0; // Performs post-dispatch checks. Called when all input buffers are empty, // though there could be more data ready to be read from the OS. virtual bool DidEmptyInputBuffers() = 0; // Handles the first message sent over the pipe which contains setup info. virtual void HandleHelloMessage(const Message& msg) = 0; private: // Takes the given data received from the IPC channel and dispatches any // fully completed messages. // // Returns true on success. False means channel error. bool DispatchInputData(const char* input_data, int input_data_len); Listener* listener_; // We read from the pipe into this buffer. Managed by DispatchInputData, do // not access directly outside that function. char input_buf_[Channel::kReadBufferSize]; // Large messages that span multiple pipe buffers, get built-up using // this buffer. std::string input_overflow_buf_; DISALLOW_COPY_AND_ASSIGN(ChannelReader); }; } // namespace internal } // namespace IPC #endif // IPC_IPC_CHANNEL_READER_H_
/* arch/arm/mach-msm/include/mach/memory.h * * Copyright (C) 2007 Google, Inc. * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H #include <linux/types.h> /* physical offset of RAM */ #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) #if defined(CONFIG_KEXEC_HARDBOOT) #if defined(CONFIG_MACH_APQ8064_FLO) #define KEXEC_HB_PAGE_ADDR UL(0x88C00000) #elif defined(CONFIG_MACH_APQ8064_MAKO) #define KEXEC_HB_PAGE_ADDR UL(0x88600000) #elif defined(CONFIG_ARCH_MSM8226) #define KEXEC_HB_PAGE_ADDR UL(0x3e9e0000) /*#define KEXEC_HB_KERNEL_LOC UL(0x5000000)*/ #else #error "Adress for kexec hardboot page not defined" #endif #endif #define MAX_PHYSMEM_BITS 32 #define SECTION_SIZE_BITS 28 /* Maximum number of Memory Regions * The largest system can have 4 memory banks, each divided into 8 regions */ #define MAX_NR_REGIONS 32 /* The number of regions each memory bank is divided into */ #define NR_REGIONS_PER_BANK 8 /* Certain configurations of MSM7x30 have multiple memory banks. * One or more of these banks can contain holes in the memory map as well. * These macros define appropriate conversion routines between the physical * and virtual address domains for supporting these configurations using * SPARSEMEM and a 3G/1G VM split. */ #if defined(CONFIG_ARCH_MSM7X30) #define EBI0_PHYS_OFFSET PHYS_OFFSET #define EBI0_PAGE_OFFSET PAGE_OFFSET #define EBI0_SIZE 0x10000000 #ifndef __ASSEMBLY__ extern unsigned long ebi1_phys_offset; #define EBI1_PHYS_OFFSET (ebi1_phys_offset) #define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE) #if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G)) #define __phys_to_virt(phys) \ ((phys) >= EBI1_PHYS_OFFSET ? \ (phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \ (phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET) #define __virt_to_phys(virt) \ ((virt) >= EBI1_PAGE_OFFSET ? \ (virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \ (virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET) #endif #endif #endif #ifndef __ASSEMBLY__ void *allocate_contiguous_ebi(unsigned long, unsigned long, int); phys_addr_t allocate_contiguous_ebi_nomap(unsigned long, unsigned long); void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long); void clean_caches(unsigned long, unsigned long, unsigned long); void invalidate_caches(unsigned long, unsigned long, unsigned long); int msm_get_memory_type_from_name(const char *memtype_name); unsigned long get_ddr_size(void); #if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5) void write_to_strongly_ordered_memory(void); void map_page_strongly_ordered(void); #endif #ifdef CONFIG_CACHE_L2X0 extern void l2x0_cache_sync(void); #define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0) #endif #if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960) extern void store_ttbr0(void); #define finish_arch_switch(prev) do { store_ttbr0(); } while (0) #endif #define MAX_HOLE_ADDRESS (PHYS_OFFSET + 0x10000000) extern phys_addr_t memory_hole_offset; extern phys_addr_t memory_hole_start; extern phys_addr_t memory_hole_end; extern unsigned long memory_hole_align; extern unsigned long virtual_hole_start; extern unsigned long virtual_hole_end; #ifdef CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0 void find_memory_hole(void); #define MEM_HOLE_END_PHYS_OFFSET (memory_hole_end) #define MEM_HOLE_PAGE_OFFSET (PAGE_OFFSET + memory_hole_offset + \ memory_hole_align) #define __phys_to_virt(phys) \ ({ \ unsigned long __phys = (unsigned long)phys; \ ((MEM_HOLE_END_PHYS_OFFSET && \ ((__phys) >= MEM_HOLE_END_PHYS_OFFSET)) ? \ (__phys) - MEM_HOLE_END_PHYS_OFFSET + MEM_HOLE_PAGE_OFFSET : \ (__phys) - PHYS_OFFSET + PAGE_OFFSET); \ }) #define __virt_to_phys(virt) \ ({ \ unsigned long __virt = (unsigned long)virt; \ ((MEM_HOLE_END_PHYS_OFFSET && ((__virt) >= MEM_HOLE_PAGE_OFFSET)) ? \ (__virt) - MEM_HOLE_PAGE_OFFSET + MEM_HOLE_END_PHYS_OFFSET : \ (__virt) - PAGE_OFFSET + PHYS_OFFSET); \ }) #endif /* * Need a temporary unique variable that no one will ever see to * hold the compat string. Line number gives this easily. * Need another layer of indirection to get __LINE__ to expand * properly as opposed to appending and ending up with * __compat___LINE__ */ #define __CONCAT(a, b) ___CONCAT(a, b) #define ___CONCAT(a, b) a ## b #define EXPORT_COMPAT(com) \ static char *__CONCAT(__compat_, __LINE__) __used \ __attribute((__section__(".exportcompat.init"))) = com extern char *__compat_exports_start[]; extern char *__compat_exports_end[]; #endif #if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT #define arch_has_speculative_dfetch() 1 #endif #endif /* these correspond to values known by the modem */ #define MEMORY_DEEP_POWERDOWN 0 #define MEMORY_SELF_REFRESH 1 #define MEMORY_ACTIVE 2 #define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd" #ifndef CONFIG_ARCH_MSM7X27 #define CONSISTENT_DMA_SIZE (SZ_1M * 14) #endif
/* Functional tests for the "target" attribute and pragma. */ /* { dg-do compile } */ /* { dg-require-effective-target target_attribute } */ /* { dg-options "-mno-mvcle -march=z13 -O3" } */ #pragma GCC target("mvcle") void p1(char *b) { __builtin_memset (b, 0, 400); } #pragma GCC reset_options __attribute__ ((target("mvcle"))) void a1(char *b) { __builtin_memset (b, 0, 400); } /* { dg-final { scan-assembler-times "\tmvcle\t" 2 } } */
#ifndef _DIRENT_H_ #define _DIRENT_H_ #ifdef __cplusplus extern "C" { #endif #include <sys/cdefs.h> #include <sys/dirent.h> #if !defined(MAXNAMLEN) && __BSD_VISIBLE #define MAXNAMLEN 1024 #endif #ifdef __cplusplus } #endif #endif /*_DIRENT_H_*/
/* Copyright 2012-15 Advanced Micro Devices, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD * */ #ifndef __DC_DMCU_H__ #define __DC_DMCU_H__ #include "dm_services_types.h" enum dmcu_state { DMCU_NOT_INITIALIZED = 0, DMCU_RUNNING = 1 }; struct dmcu { struct dc_context *ctx; const struct dmcu_funcs *funcs; enum dmcu_state dmcu_state; struct dmcu_version dmcu_version; unsigned int cached_wait_loop_number; }; struct dmcu_funcs { bool (*dmcu_init)(struct dmcu *dmcu); bool (*load_iram)(struct dmcu *dmcu, unsigned int start_offset, const char *src, unsigned int bytes); void (*set_psr_enable)(struct dmcu *dmcu, bool enable, bool wait); bool (*setup_psr)(struct dmcu *dmcu, struct dc_link *link, struct psr_context *psr_context); void (*get_psr_state)(struct dmcu *dmcu, uint32_t *psr_state); void (*set_psr_wait_loop)(struct dmcu *dmcu, unsigned int wait_loop_number); void (*get_psr_wait_loop)(struct dmcu *dmcu, unsigned int *psr_wait_loop_number); bool (*is_dmcu_initialized)(struct dmcu *dmcu); }; #endif
/* * (C) Copyright 2007 Michal Simek * * Michal SIMEK <monstr@monstr.eu> * * See file CREDITS for list of people who contributed to this * project. * * 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 <common.h> #include <asm/microblaze_timer.h> #include <asm/microblaze_intc.h> volatile int timestamp = 0; void reset_timer (void) { timestamp = 0; } #ifdef CONFIG_SYS_TIMER_0 ulong get_timer (ulong base) { return (timestamp - base); } #else ulong get_timer (ulong base) { return (timestamp++ - base); } #endif void set_timer (ulong t) { timestamp = t; } #ifdef CONFIG_SYS_INTC_0 #ifdef CONFIG_SYS_TIMER_0 microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR); void timer_isr (void *arg) { timestamp++; tmr->control = tmr->control | TIMER_INTERRUPT; } void timer_init (void) { tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD; tmr->control = TIMER_INTERRUPT | TIMER_RESET; tmr->control = TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT; reset_timer (); install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void *)tmr); } #endif #endif
// Scintilla source code edit control /** @file KeyWords.h ** Colourise for particular languages. **/ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler); /** * A LexerModule is responsible for lexing and folding a particular language. * The class maintains a list of LexerModules which can be searched to find a * module appropriate to a particular language. */ class LexerModule { protected: const LexerModule *next; int language; LexerFunction fnLexer; LexerFunction fnFolder; const char * const * wordListDescriptions; int styleBits; static const LexerModule *base; static int nextLanguage; public: const char *languageName; LexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=0, LexerFunction fnFolder_=0, const char * const wordListDescriptions_[] = NULL, int styleBits_=5); virtual ~LexerModule() { } int GetLanguage() const { return language; } // -1 is returned if no WordList information is available int GetNumWordLists() const; const char *GetWordListDescription(int index) const; int GetStyleBitsNeeded() const; virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; static const LexerModule *Find(int language); static const LexerModule *Find(const char *languageName); }; /** * Check if a character is a space. * This is ASCII specific but is safe with chars >= 0x80. */ inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } inline bool iswordchar(char ch) { return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_'); } inline bool iswordstart(char ch) { return isascii(ch) && (isalnum(ch) || ch == '_'); } inline bool isoperator(char ch) { if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '(' || ch == ')' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ':' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '/' || ch == '?' || ch == '!' || ch == '.' || ch == '~') return true; return false; }
/* ScummVM - Graphic Adventure Engine * * ScummVM 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. * */ #ifndef GOB_SCRIPT_H #define GOB_SCRIPT_H #include "common/str.h" #include "common/stack.h" #include "gob/totfile.h" namespace Gob { class GobEngine; class Expression; class Script { public: Script(GobEngine *vm); ~Script(); /** Read data and move the pointer accordingly. */ uint32 read(byte *data, int32 size); /** Read data (from an optional offset) without moving the pointer. */ uint32 peek(byte *data, int32 size, int32 offset = 0) const; // Stream properties int32 pos() const; int32 getSize() const; // Stream seeking bool seek(int32 offset, int whence = SEEK_SET); bool skip(int32 offset); bool skipBlock(); // Reading data byte readByte (); char readChar (); uint8 readUint8 (); uint16 readUint16(); uint32 readUint32(); int8 readInt8 (); int16 readInt16 (); int32 readInt32 (); char *readString(int32 length = -1); // Peeking data byte peekByte (int32 offset = 0); char peekChar (int32 offset = 0); uint8 peekUint8 (int32 offset = 0); uint16 peekUint16(int32 offset = 0); uint32 peekUint32(int32 offset = 0); int8 peekInt8 (int32 offset = 0); int16 peekInt16 (int32 offset = 0); int32 peekInt32 (int32 offset = 0); char *peekString(int32 offset = 0); // Expression parsing functions int16 readVarIndex(uint16 *size = 0, uint16 *type = 0); int16 readValExpr(byte stopToken = 99); int16 readExpr(byte stopToken, byte *type); void skipExpr(char stopToken); // Higher-level expression parsing functions char evalExpr(int16 *pRes); bool evalBool(); int32 evalInt(); const char *evalString(); // Accessing the result of expressions int32 getResultInt() const; char *getResultStr() const; /** Returns the offset the specified pointer is within the script data. */ int32 getOffset(byte *ptr) const; /** Returns the data pointer to the offset. */ byte *getData(int32 offset) const; /** Returns the raw data pointer. */ byte *getData(); /** Load a script file. */ bool load(const Common::String &fileName); /** Unload the script. */ void unload(); /** Was a script loaded? */ bool isLoaded() const; /** Setting the 'finished' property. */ void setFinished(bool finished); /** Querying the 'finished' property. */ bool isFinished() const; // Call stack operations /** Push the current script position onto the call stack. */ void push(); /** Pop a script position from the call stack (and return there). */ void pop(bool ret = true); /** Push the current script position and branch to the specified offset. */ void call(uint32 offset); // Fixed properties uint8 getVersionMajor () const; uint8 getVersionMinor () const; uint32 getVariablesCount () const; uint32 getTextsOffset () const; uint32 getResourcesOffset() const; uint16 getAnimDataSize () const; uint8 getImFileNumber () const; uint8 getExFileNumber () const; uint8 getCommunHandling () const; uint16 getFunctionOffset (uint8 function) const; static uint32 getVariablesCount(const char *fileName, GobEngine *vm); private: struct CallEntry { byte *totPtr; bool finished; }; GobEngine *_vm; Expression *_expression; bool _finished; Common::String _totFile; byte *_totData; byte *_totPtr; uint32 _totSize; Common::SeekableReadStream *_lom; TOTFile::Properties _totProperties; Common::Stack<CallEntry> _callStack; /** Loading a TOT file. */ bool loadTOT(const Common::String &fileName); /** Loading a LOM file. */ bool loadLOM(const Common::String &fileName); /** Unloading a TOT file. */ void unloadTOT(); }; } // End of namespace Gob #endif // GOB_SCRIPT_H
/***************************************************************************/ /* * linux/arch/m68knommu/platform/523x/config.c * * Sub-architcture dependent initialization code for the Freescale * 523x CPUs. * * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com) * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com) */ /***************************************************************************/ #include <linux/kernel.h> #include <linux/param.h> #include <linux/init.h> #include <linux/io.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> #include <asm/mcfgpio.h> /***************************************************************************/ struct mcf_gpio_chip mcf_gpio_chips[] = { MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR), MCFGPF(ADDR, 13, 3), MCFGPF(DATAH, 16, 8), MCFGPF(DATAL, 24, 8), MCFGPF(BUSCTL, 32, 8), MCFGPF(BS, 40, 4), MCFGPF(CS, 49, 7), MCFGPF(SDRAM, 56, 6), MCFGPF(FECI2C, 64, 4), MCFGPF(UARTH, 72, 2), MCFGPF(UARTL, 80, 8), MCFGPF(QSPI, 88, 5), MCFGPF(TIMER, 96, 8), MCFGPF(ETPU, 104, 3), }; unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips); /***************************************************************************/ #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) static void __init m523x_qspi_init(void) { u16 par; /* setup QSPS pins for QSPI with gpio CS control */ writeb(0x1f, MCFGPIO_PAR_QSPI); /* and CS2 & CS3 as gpio */ par = readw(MCFGPIO_PAR_TIMER); par &= 0x3f3f; writew(par, MCFGPIO_PAR_TIMER); } #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ /***************************************************************************/ static void __init m523x_fec_init(void) { u16 par; u8 v; /* Set multi-function pins to ethernet use */ par = readw(MCF_IPSBAR + 0x100082); writew(par | 0xf00, MCF_IPSBAR + 0x100082); v = readb(MCF_IPSBAR + 0x100078); writeb(v | 0xc0, MCF_IPSBAR + 0x100078); } /***************************************************************************/ void __init config_BSP(char *commandp, int size) { mach_sched_init = hw_timer_init; m523x_fec_init(); #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) m523x_qspi_init(); #endif } /***************************************************************************/
/* * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. * All rights reserved * www.brocade.com * * Linux driver for Brocade Fibre Channel Host Bus Adapter. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License (GPL) Version 2 as * published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ #ifndef __BFA_PORT_PRIV_H__ #define __BFA_PORT_PRIV_H__ #include <defs/bfa_defs_pport.h> #include <bfi/bfi_pport.h> #include "bfa_intr_priv.h" /** * Link notification data structure */ struct bfa_fcport_ln_s { struct bfa_fcport_s *fcport; bfa_sm_t sm; struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */ enum bfa_pport_linkstate ln_event; /* ln event for callback */ }; /** * BFA FC port data structure */ struct bfa_fcport_s { struct bfa_s *bfa; /* parent BFA instance */ bfa_sm_t sm; /* port state machine */ wwn_t nwwn; /* node wwn of physical port */ wwn_t pwwn; /* port wwn of physical oprt */ enum bfa_pport_speed speed_sup; /* supported speeds */ enum bfa_pport_speed speed; /* current speed */ enum bfa_pport_topology topology; /* current topology */ u8 myalpa; /* my ALPA in LOOP topology */ u8 rsvd[3]; u32 mypid:24; u32 rsvd_b:8; struct bfa_pport_cfg_s cfg; /* current port configuration */ struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ struct bfa_reqq_wait_s svcreq_wait; /* to wait for room in reqq */ struct bfa_reqq_wait_s stats_reqq_wait; /* to wait for room in reqq (stats) */ void *event_cbarg; void (*event_cbfn) (void *cbarg, bfa_pport_event_t event); union { union bfi_fcport_i2h_msg_u i2hmsg; } event_arg; void *bfad; /* BFA driver handle */ struct bfa_fcport_ln_s ln; /* Link Notification */ struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ struct bfa_timer_s timer; /* timer */ u32 msgtag; /* fimrware msg tag for reply */ u8 *stats_kva; u64 stats_pa; union bfa_fcport_stats_u *stats; union bfa_fcport_stats_u *stats_ret; /* driver stats location */ bfa_status_t stats_status; /* stats/statsclr status */ bfa_boolean_t stats_busy; /* outstanding stats/statsclr */ bfa_boolean_t stats_qfull; bfa_cb_pport_t stats_cbfn; /* driver callback function */ void *stats_cbarg; /* *!< user callback arg */ bfa_boolean_t diag_busy; /* diag busy status */ bfa_boolean_t beacon; /* port beacon status */ bfa_boolean_t link_e2e_beacon; /* link beacon status */ }; #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) /* * public functions */ void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); #endif /* __BFA_PORT_PRIV_H__ */
/* SPDX-License-Identifier: GPL-2.0-only */ /* * PCM3008 ALSA SoC Layer * * Author: Hugo Villeneuve * Copyright (C) 2008 Lyrtech inc */ #ifndef __LINUX_SND_SOC_PCM3008_H #define __LINUX_SND_SOC_PCM3008_H struct pcm3008_setup_data { unsigned dem0_pin; unsigned dem1_pin; unsigned pdad_pin; unsigned pdda_pin; }; #endif
/****************************************************************************** * * Copyright(c) 2009-2012 Realtek Corporation. * * 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. * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: * wlanfae <wlanfae@realtek.com> * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, * Hsinchu 300, Taiwan. * * Larry Finger <Larry.Finger@lwfinger.net> * * Created on 2010/ 5/18, 1:41 *****************************************************************************/ #ifndef __RTL92DE_TABLE__H_ #define __RTL92DE_TABLE__H_ /*Created on 2011/ 1/14, 1:35*/ #define PHY_REG_2T_ARRAYLENGTH 380 extern u32 rtl8192de_phy_reg_2tarray[PHY_REG_2T_ARRAYLENGTH]; #define PHY_REG_ARRAY_PG_LENGTH 624 extern u32 rtl8192de_phy_reg_array_pg[PHY_REG_ARRAY_PG_LENGTH]; #define RADIOA_2T_ARRAYLENGTH 378 extern u32 rtl8192de_radioa_2tarray[RADIOA_2T_ARRAYLENGTH]; #define RADIOB_2T_ARRAYLENGTH 384 extern u32 rtl8192de_radiob_2tarray[RADIOB_2T_ARRAYLENGTH]; #define RADIOA_2T_INT_PA_ARRAYLENGTH 378 extern u32 rtl8192de_radioa_2t_int_paarray[RADIOA_2T_INT_PA_ARRAYLENGTH]; #define RADIOB_2T_INT_PA_ARRAYLENGTH 384 extern u32 rtl8192de_radiob_2t_int_paarray[RADIOB_2T_INT_PA_ARRAYLENGTH]; #define MAC_2T_ARRAYLENGTH 160 extern u32 rtl8192de_mac_2tarray[MAC_2T_ARRAYLENGTH]; #define AGCTAB_ARRAYLENGTH 386 extern u32 rtl8192de_agctab_array[AGCTAB_ARRAYLENGTH]; #define AGCTAB_5G_ARRAYLENGTH 194 extern u32 rtl8192de_agctab_5garray[AGCTAB_5G_ARRAYLENGTH]; #define AGCTAB_2G_ARRAYLENGTH 194 extern u32 rtl8192de_agctab_2garray[AGCTAB_2G_ARRAYLENGTH]; #endif
/* * 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 _MT_SYNC_WRITE_H #define _MT_SYNC_WRITE_H #if defined(__KERNEL__) #include <linux/io.h> #include <asm/cacheflush.h> #include <asm/system.h> /* * Define macros. */ #define mt65xx_reg_sync_writel(v, a) \ do { \ __raw_writel((v), IOMEM((a))); \ dsb(); \ } while (0) #define mt65xx_reg_sync_writew(v, a) \ do { \ __raw_writew((v), IOMEM((a))); \ dsb(); \ } while (0) #define mt65xx_reg_sync_writeb(v, a) \ do { \ __raw_writeb((v), IOMEM((a))); \ dsb(); \ } while (0) #define mt_reg_sync_writel(v, a) \ do { \ __raw_writel((v), IOMEM((a))); \ dsb(); \ } while (0) #define mt_reg_sync_writew(v, a) \ do { \ __raw_writew((v), IOMEM((a))); \ dsb(); \ } while (0) #define mt_reg_sync_writeb(v, a) \ do { \ __raw_writeb((v), IOMEM((a))); \ dsb(); \ } while (0) #else /* __KERNEL__ */ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #define dsb() \ do { \ __asm__ __volatile__ ("dsb" : : : "memory"); \ } while (0) #define mt65xx_reg_sync_writel(v, a) \ do { \ *(volatile unsigned int *)(a) = (v); \ dsb(); \ } while (0) #define mt65xx_reg_sync_writew(v, a) \ do { \ *(volatile unsigned short *)(a) = (v); \ dsb(); \ } while (0) #define mt65xx_reg_sync_writeb(v, a) \ do { \ *(volatile unsigned char *)(a) = (v); \ dsb(); \ } while (0) #define mt_reg_sync_writel(v, a) \ do { \ *(volatile unsigned int *)(a) = (v); \ dsb(); \ } while (0) #define mt_reg_sync_writew(v, a) \ do { \ *(volatile unsigned short *)(a) = (v); \ dsb(); \ } while (0) #define mt_reg_sync_writeb(v, a) \ do { \ *(volatile unsigned char *)(a) = (v); \ dsb(); \ } while (0) #endif /* __KERNEL__ */ #endif /* !_MT_SYNC_WRITE_H */
/* * This file is part of MPlayer. * * MPlayer 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. * * MPlayer 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 MPlayer; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef MPLAYER_FASTMEMCPY_H #define MPLAYER_FASTMEMCPY_H #include "config.h" #include <inttypes.h> #include <string.h> #include <stddef.h> void * fast_memcpy(void * to, const void * from, size_t len); void * mem2agpcpy(void * to, const void * from, size_t len); #if ! defined(CONFIG_FASTMEMCPY) || ! (HAVE_MMX || HAVE_MMX2 || HAVE_AMD3DNOW /* || HAVE_SSE || HAVE_SSE2 */) #define mem2agpcpy(a,b,c) memcpy(a,b,c) #define fast_memcpy(a,b,c) memcpy(a,b,c) #endif static inline void * mem2agpcpy_pic(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride) { int i; void *retval=dst; if(dstStride == srcStride) { if (srcStride < 0) { src = (const uint8_t*)src + (height-1)*srcStride; dst = (uint8_t*)dst + (height-1)*dstStride; srcStride = -srcStride; } mem2agpcpy(dst, src, srcStride*height); } else { for(i=0; i<height; i++) { mem2agpcpy(dst, src, bytesPerLine); src = (const uint8_t*)src + srcStride; dst = (uint8_t*)dst + dstStride; } } return retval; } #define memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 0) #define my_memcpy_pic(d, s, b, h, ds, ss) memcpy_pic2(d, s, b, h, ds, ss, 1) /** * \param limit2width always skip data between end of line and start of next * instead of copying the full block when strides are the same */ static inline void * memcpy_pic2(void * dst, const void * src, int bytesPerLine, int height, int dstStride, int srcStride, int limit2width) { int i; void *retval=dst; if(!limit2width && dstStride == srcStride) { if (srcStride < 0) { src = (const uint8_t*)src + (height-1)*srcStride; dst = (uint8_t*)dst + (height-1)*dstStride; srcStride = -srcStride; } fast_memcpy(dst, src, srcStride*height); } else { for(i=0; i<height; i++) { fast_memcpy(dst, src, bytesPerLine); src = (const uint8_t*)src + srcStride; dst = (uint8_t*)dst + dstStride; } } return retval; } #endif /* MPLAYER_FASTMEMCPY_H */
/* * Copyright (C) 2007 Eric Seidel <eric@webkit.org> * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> * Copyright (C) Research In Motion Limited 2010. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SVGFontElement_h #define SVGFontElement_h #if ENABLE(SVG_FONTS) #include "SVGAnimatedBoolean.h" #include "SVGExternalResourcesRequired.h" #include "SVGGlyphElement.h" #include "SVGGlyphMap.h" #include "SVGParserUtilities.h" #include "SVGStyledElement.h" namespace WebCore { // Describe an SVG <hkern>/<vkern> element struct SVGKerningPair { float kerning; UnicodeRanges unicodeRange1; UnicodeRanges unicodeRange2; HashSet<String> unicodeName1; HashSet<String> unicodeName2; HashSet<String> glyphName1; HashSet<String> glyphName2; SVGKerningPair() : kerning(0.0f) { } }; typedef Vector<SVGKerningPair> KerningPairVector; class SVGMissingGlyphElement; class SVGFontElement : public SVGStyledElement , public SVGExternalResourcesRequired { public: static PassRefPtr<SVGFontElement> create(const QualifiedName&, Document*); void invalidateGlyphCache(); void getGlyphIdentifiersForString(const String&, Vector<SVGGlyph>&) const; float horizontalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; float verticalKerningForPairOfStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2) const; SVGMissingGlyphElement* firstMissingGlyphElement() const; private: SVGFontElement(const QualifiedName&, Document*); virtual void synchronizeProperty(const QualifiedName&); virtual bool rendererIsNeeded(RenderStyle*) { return false; } virtual void fillAttributeToPropertyTypeMap(); virtual AttributeToPropertyTypeMap& attributeToPropertyTypeMap(); void ensureGlyphCache() const; // Animated property declarations // SVGExternalResourcesRequired DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) mutable KerningPairVector m_horizontalKerningPairs; mutable KerningPairVector m_verticalKerningPairs; mutable SVGGlyphMap m_glyphMap; mutable bool m_isGlyphCacheValid; }; } // namespace WebCore #endif // ENABLE(SVG_FONTS) #endif
/* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #ifndef RENDER_SYSTEM_GLES_H #define RENDER_SYSTEM_GLES_H #pragma once #include "system.h" #include "system_gl.h" #include "rendering/RenderSystem.h" #include "xbmc/guilib/GUIShader.h" enum ESHADERMETHOD { SM_DEFAULT, SM_TEXTURE, SM_MULTI, SM_FONTS, SM_TEXTURE_NOBLEND, SM_MULTI_BLENDCOLOR, SM_TEXTURE_RGBA, SM_TEXTURE_RGBA_OES, SM_TEXTURE_RGBA_BLENDCOLOR, SM_TEXTURE_RGBA_BOB, SM_TEXTURE_RGBA_BOB_OES, SM_ESHADERCOUNT }; class CRenderSystemGLES : public CRenderSystemBase { public: CRenderSystemGLES(); virtual ~CRenderSystemGLES(); bool InitRenderSystem() override; bool DestroyRenderSystem() override; bool ResetRenderSystem(int width, int height, bool fullScreen, float refreshRate) override; bool BeginRender() override; bool EndRender() override; void PresentRender(bool rendered, bool videoLayer) override; bool ClearBuffers(color_t color) override; bool IsExtSupported(const char* extension) override; void SetVSync(bool vsync); void ResetVSync() { m_bVsyncInit = false; } void SetViewPort(CRect& viewPort) override; void GetViewPort(CRect& viewPort) override; bool ScissorsCanEffectClipping() override; CRect ClipRectToScissorRect(const CRect &rect) override; void SetScissors(const CRect& rect) override; void ResetScissors() override; void CaptureStateBlock() override; void ApplyStateBlock() override; void SetCameraPosition(const CPoint &camera, int screenWidth, int screenHeight, float stereoFactor = 0.0f) override; void ApplyHardwareTransform(const TransformMatrix &matrix) override; void RestoreHardwareTransform() override; bool SupportsStereo(RENDER_STEREO_MODE mode) const override; bool TestRender() override; void Project(float &x, float &y, float &z) override; void InitialiseGUIShader(); void EnableGUIShader(ESHADERMETHOD method); void DisableGUIShader(); GLint GUIShaderGetPos(); GLint GUIShaderGetCol(); GLint GUIShaderGetCoord0(); GLint GUIShaderGetCoord1(); GLint GUIShaderGetUniCol(); GLint GUIShaderGetCoord0Matrix(); GLint GUIShaderGetField(); GLint GUIShaderGetStep(); GLint GUIShaderGetContrast(); GLint GUIShaderGetBrightness(); GLint GUIShaderGetModel(); protected: virtual void SetVSyncImpl(bool enable) = 0; virtual void PresentRenderImpl(bool rendered) = 0; void CalculateMaxTexturesize(); int m_iVSyncMode; int m_iVSyncErrors; bool m_bVsyncInit; int m_width; int m_height; std::string m_RenderExtensions; CGUIShader **m_pGUIshader = nullptr; // One GUI shader for each method ESHADERMETHOD m_method = SM_DEFAULT; // Current GUI Shader method GLint m_viewPort[4]; }; #endif // RENDER_SYSTEM_H
/* * TCP Vegas congestion control interface */ #ifndef __TCP_VEGAS_H #define __TCP_VEGAS_H 1 /* Vegas variables */ struct vegas { u32 beg_snd_nxt; /* right edge during last RTT */ u32 beg_snd_una; /* left edge during last RTT */ u32 beg_snd_cwnd; /* saves the size of the cwnd */ u8 doing_vegas_now;/* if true, do vegas for this RTT */ u16 cntRTT; /* # of RTTs measured within last RTT */ u32 minRTT; /* min of RTTs measured within last RTT (in usec) */ u32 baseRTT; /* the min of all Vegas RTT measurements seen (in usec) */ }; void tcp_vegas_init(struct sock *sk); void tcp_vegas_state(struct sock *sk, u8 ca_state); void tcp_vegas_pkts_acked(struct sock *sk, const struct ack_sample *sample); void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event); size_t tcp_vegas_get_info(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info); #endif /* __TCP_VEGAS_H */
/* * Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * 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 the Institute 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 INSTITUTE 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 INSTITUTE 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 "krb5_locl.h" void _krb5_evp_schedule(krb5_context context, struct _krb5_key_type *kt, struct _krb5_key_data *kd) { struct _krb5_evp_schedule *key = kd->schedule->data; const EVP_CIPHER *c = (*kt->evp)(); EVP_CIPHER_CTX_init(&key->ectx); EVP_CIPHER_CTX_init(&key->dctx); EVP_CipherInit_ex(&key->ectx, c, NULL, kd->key->keyvalue.data, NULL, 1); EVP_CipherInit_ex(&key->dctx, c, NULL, kd->key->keyvalue.data, NULL, 0); } void _krb5_evp_cleanup(krb5_context context, struct _krb5_key_data *kd) { struct _krb5_evp_schedule *key = kd->schedule->data; EVP_CIPHER_CTX_cleanup(&key->ectx); EVP_CIPHER_CTX_cleanup(&key->dctx); } krb5_error_code _krb5_evp_encrypt(krb5_context context, struct _krb5_key_data *key, void *data, size_t len, krb5_boolean encryptp, int usage, void *ivec) { struct _krb5_evp_schedule *ctx = key->schedule->data; EVP_CIPHER_CTX *c; c = encryptp ? &ctx->ectx : &ctx->dctx; if (ivec == NULL) { /* alloca ? */ size_t len2 = EVP_CIPHER_CTX_iv_length(c); void *loiv = malloc(len2); if (loiv == NULL) { krb5_clear_error_message(context); return ENOMEM; } memset(loiv, 0, len2); EVP_CipherInit_ex(c, NULL, NULL, NULL, loiv, -1); free(loiv); } else EVP_CipherInit_ex(c, NULL, NULL, NULL, ivec, -1); EVP_Cipher(c, data, data, len); return 0; } static const unsigned char zero_ivec[EVP_MAX_BLOCK_LENGTH] = { 0 }; krb5_error_code _krb5_evp_encrypt_cts(krb5_context context, struct _krb5_key_data *key, void *data, size_t len, krb5_boolean encryptp, int usage, void *ivec) { size_t i, blocksize; struct _krb5_evp_schedule *ctx = key->schedule->data; unsigned char tmp[EVP_MAX_BLOCK_LENGTH], ivec2[EVP_MAX_BLOCK_LENGTH]; EVP_CIPHER_CTX *c; unsigned char *p; c = encryptp ? &ctx->ectx : &ctx->dctx; blocksize = EVP_CIPHER_CTX_block_size(c); if (len < blocksize) { krb5_set_error_message(context, EINVAL, "message block too short"); return EINVAL; } else if (len == blocksize) { EVP_CipherInit_ex(c, NULL, NULL, NULL, zero_ivec, -1); EVP_Cipher(c, data, data, len); return 0; } if (ivec) EVP_CipherInit_ex(c, NULL, NULL, NULL, ivec, -1); else EVP_CipherInit_ex(c, NULL, NULL, NULL, zero_ivec, -1); if (encryptp) { p = data; i = ((len - 1) / blocksize) * blocksize; EVP_Cipher(c, p, p, i); p += i - blocksize; len -= i; memcpy(ivec2, p, blocksize); for (i = 0; i < len; i++) tmp[i] = p[i + blocksize] ^ ivec2[i]; for (; i < blocksize; i++) tmp[i] = 0 ^ ivec2[i]; EVP_CipherInit_ex(c, NULL, NULL, NULL, zero_ivec, -1); EVP_Cipher(c, p, tmp, blocksize); memcpy(p + blocksize, ivec2, len); if (ivec) memcpy(ivec, p, blocksize); } else { unsigned char tmp2[EVP_MAX_BLOCK_LENGTH], tmp3[EVP_MAX_BLOCK_LENGTH]; p = data; if (len > blocksize * 2) { /* remove last two blocks and round up, decrypt this with cbc, then do cts dance */ i = ((((len - blocksize * 2) + blocksize - 1) / blocksize) * blocksize); memcpy(ivec2, p + i - blocksize, blocksize); EVP_Cipher(c, p, p, i); p += i; len -= i + blocksize; } else { if (ivec) memcpy(ivec2, ivec, blocksize); else memcpy(ivec2, zero_ivec, blocksize); len -= blocksize; } memcpy(tmp, p, blocksize); EVP_CipherInit_ex(c, NULL, NULL, NULL, zero_ivec, -1); EVP_Cipher(c, tmp2, p, blocksize); memcpy(tmp3, p + blocksize, len); memcpy(tmp3 + len, tmp2 + len, blocksize - len); /* xor 0 */ for (i = 0; i < len; i++) p[i + blocksize] = tmp2[i] ^ tmp3[i]; EVP_CipherInit_ex(c, NULL, NULL, NULL, zero_ivec, -1); EVP_Cipher(c, p, tmp3, blocksize); for (i = 0; i < blocksize; i++) p[i] ^= ivec2[i]; if (ivec) memcpy(ivec, tmp, blocksize); } return 0; }
/****************************************************************************** ** ** FILE NAME : ifxmips_atm_ar9.c ** PROJECT : UEIP ** MODULES : ATM ** ** DATE : 7 Jul 2009 ** AUTHOR : Xu Liang ** DESCRIPTION : ATM driver common source file (core functions) ** COPYRIGHT : Copyright (c) 2006 ** Infineon Technologies AG ** Am Campeon 1-12, 85579 Neubiberg, Germany ** ** 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. ** ** HISTORY ** $Date $Author $Comment ** 07 JUL 2009 Xu Liang Init Version *******************************************************************************/ /* * #################################### * Head File * #################################### */ /* * Common Head File */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/version.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/proc_fs.h> #include <linux/init.h> #include <linux/ioctl.h> #include <asm/delay.h> /* * Chip Specific Head File */ #include "ifxmips_atm_core.h" #include "ifxmips_atm_fw_ar9.h" #include "ifxmips_atm_fw_regs_ar9.h" #include <lantiq_soc.h> /* * #################################### * Definition * #################################### */ /* * EMA Settings */ #define EMA_CMD_BUF_LEN 0x0040 #define EMA_CMD_BASE_ADDR (0x00003B80 << 2) #define EMA_DATA_BUF_LEN 0x0100 #define EMA_DATA_BASE_ADDR (0x00003C00 << 2) #define EMA_WRITE_BURST 0x2 #define EMA_READ_BURST 0x2 /* * #################################### * Declaration * #################################### */ /* * Hardware Init/Uninit Functions */ static inline void init_pmu(void); static inline void uninit_pmu(void); static inline void reset_ppe(void); static inline void init_ema(void); static inline void init_mailbox(void); static inline void clear_share_buffer(void); /* * #################################### * Local Variable * #################################### */ /* * #################################### * Local Function * #################################### */ #define IFX_PMU_MODULE_PPE_SLL01 BIT(19) #define IFX_PMU_MODULE_PPE_TC BIT(21) #define IFX_PMU_MODULE_PPE_EMA BIT(22) #define IFX_PMU_MODULE_PPE_QSB BIT(18) #define IFX_PMU_MODULE_TPE BIT(13) #define IFX_PMU_MODULE_DSL_DFE BIT(9) static inline void init_pmu(void) { ltq_pmu_enable(IFX_PMU_MODULE_PPE_SLL01 | IFX_PMU_MODULE_PPE_TC | IFX_PMU_MODULE_PPE_EMA | IFX_PMU_MODULE_PPE_QSB | IFX_PMU_MODULE_TPE | IFX_PMU_MODULE_DSL_DFE); } static inline void uninit_pmu(void) { } static inline void reset_ppe(void) { #ifdef MODULE // reset PPE // ifx_rcu_rst(IFX_RCU_DOMAIN_PPE, IFX_RCU_MODULE_ATM); #endif } static inline void init_ema(void) { IFX_REG_W32((EMA_CMD_BUF_LEN << 16) | (EMA_CMD_BASE_ADDR >> 2), EMA_CMDCFG); IFX_REG_W32((EMA_DATA_BUF_LEN << 16) | (EMA_DATA_BASE_ADDR >> 2), EMA_DATACFG); IFX_REG_W32(0x000000FF, EMA_IER); IFX_REG_W32(EMA_READ_BURST | (EMA_WRITE_BURST << 2), EMA_CFG); } static inline void init_mailbox(void) { IFX_REG_W32(0xFFFFFFFF, MBOX_IGU1_ISRC); IFX_REG_W32(0x00000000, MBOX_IGU1_IER); IFX_REG_W32(0xFFFFFFFF, MBOX_IGU3_ISRC); IFX_REG_W32(0x00000000, MBOX_IGU3_IER); } static inline void clear_share_buffer(void) { volatile u32 *p = SB_RAM0_ADDR(0); unsigned int i; for ( i = 0; i < SB_RAM0_DWLEN + SB_RAM1_DWLEN + SB_RAM2_DWLEN + SB_RAM3_DWLEN + SB_RAM4_DWLEN; i++ ) IFX_REG_W32(0, p++); } static inline int pp32_download_code(u32 *code_src, unsigned int code_dword_len, u32 *data_src, unsigned int data_dword_len) { volatile u32 *dest; if ( code_src == 0 || ((unsigned long)code_src & 0x03) != 0 || data_src == 0 || ((unsigned long)data_src & 0x03) != 0 ) return -1; if ( code_dword_len <= CDM_CODE_MEMORYn_DWLEN(0) ) IFX_REG_W32(0x00, CDM_CFG); else IFX_REG_W32(0x04, CDM_CFG); /* copy code */ dest = CDM_CODE_MEMORY(0, 0); while ( code_dword_len-- > 0 ) IFX_REG_W32(*code_src++, dest++); /* copy data */ dest = CDM_DATA_MEMORY(0, 0); while ( data_dword_len-- > 0 ) IFX_REG_W32(*data_src++, dest++); return 0; } void ar9_fw_ver(unsigned int *major, unsigned int *minor) { ASSERT(major != NULL, "pointer is NULL"); ASSERT(minor != NULL, "pointer is NULL"); *major = FW_VER_ID->major; *minor = FW_VER_ID->minor; } void ar9_init(void) { init_pmu(); reset_ppe(); init_ema(); init_mailbox(); clear_share_buffer(); } void ar9_shutdown(void) { ltq_pmu_disable(IFX_PMU_MODULE_PPE_SLL01 | IFX_PMU_MODULE_PPE_TC | IFX_PMU_MODULE_PPE_EMA | IFX_PMU_MODULE_PPE_QSB | IFX_PMU_MODULE_TPE | IFX_PMU_MODULE_DSL_DFE); } int ar9_start(int pp32) { int ret; ret = pp32_download_code(ar9_fw_bin, sizeof(ar9_fw_bin) / sizeof(*ar9_fw_bin), ar9_fw_data, sizeof(ar9_fw_data) / sizeof(*ar9_fw_data)); if ( ret != 0 ) return ret; IFX_REG_W32(DBG_CTRL_RESTART, PP32_DBG_CTRL(0)); udelay(10); return 0; } void ar9_stop(int pp32) { IFX_REG_W32(DBG_CTRL_STOP, PP32_DBG_CTRL(0)); } struct ltq_atm_ops ar9_ops = { .init = ar9_init, .shutdown = ar9_shutdown, .start = ar9_start, .stop = ar9_stop, .fw_ver = ar9_fw_ver, };
#ifndef _ASM_GENERIC_RWSEM_H #define _ASM_GENERIC_RWSEM_H #ifndef _LINUX_RWSEM_H #error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." #endif #ifdef __KERNEL__ /* * R/W semaphores originally for PPC using the stuff in lib/rwsem.c. * Adapted largely from include/asm-i386/rwsem.h * by Paul Mackerras <paulus@samba.org>. */ /* * the semaphore definition */ #ifdef CONFIG_64BIT # define RWSEM_ACTIVE_MASK 0xffffffffL #else # define RWSEM_ACTIVE_MASK 0x0000ffffL #endif #define RWSEM_UNLOCKED_VALUE 0x00000000L #define RWSEM_ACTIVE_BIAS 0x00000001L #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) /* * lock for reading */ static inline void __down_read(struct rw_semaphore *sem) { if (unlikely(atomic_long_inc_return((atomic_long_t *)&sem->count) <= 0)) rwsem_down_read_failed(sem); } static inline int __down_read_trylock(struct rw_semaphore *sem) { long tmp; while ((tmp = sem->count) >= 0) { if (tmp == cmpxchg(&sem->count, tmp, tmp + RWSEM_ACTIVE_READ_BIAS)) { return 1; } } return 0; } /* * lock for writing */ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) { long tmp; tmp = atomic_long_add_return(RWSEM_ACTIVE_WRITE_BIAS, (atomic_long_t *)&sem->count); if (unlikely(tmp != RWSEM_ACTIVE_WRITE_BIAS)) rwsem_down_write_failed(sem); } static inline void __down_write(struct rw_semaphore *sem) { __down_write_nested(sem, 0); } static inline int __down_write_trylock(struct rw_semaphore *sem) { long tmp; tmp = cmpxchg(&sem->count, RWSEM_UNLOCKED_VALUE, RWSEM_ACTIVE_WRITE_BIAS); return tmp == RWSEM_UNLOCKED_VALUE; } /* * unlock after reading */ static inline void __up_read(struct rw_semaphore *sem) { long tmp; tmp = atomic_long_dec_return((atomic_long_t *)&sem->count); if (unlikely(tmp < -1 && (tmp & RWSEM_ACTIVE_MASK) == 0)) rwsem_wake(sem); } /* * unlock after writing */ static inline void __up_write(struct rw_semaphore *sem) { if (unlikely(atomic_long_sub_return(RWSEM_ACTIVE_WRITE_BIAS, (atomic_long_t *)&sem->count) < 0)) rwsem_wake(sem); } /* * implement atomic add functionality */ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem) { atomic_long_add(delta, (atomic_long_t *)&sem->count); } /* * downgrade write lock to read lock */ static inline void __downgrade_write(struct rw_semaphore *sem) { long tmp; tmp = atomic_long_add_return(-RWSEM_WAITING_BIAS, (atomic_long_t *)&sem->count); if (tmp < 0) rwsem_downgrade_wake(sem); } /* * implement exchange and add functionality */ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) { return atomic_long_add_return(delta, (atomic_long_t *)&sem->count); } #endif /* __KERNEL__ */ #endif /* _ASM_GENERIC_RWSEM_H */
/* * GRUB -- GRand Unified Bootloader * Copyright (C) 2009 Free Software Foundation, Inc. * * GRUB 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. * * GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GRUB_MEMORY_MACHINE_HEADER #define GRUB_MEMORY_MACHINE_HEADER 1 #ifdef GRUB_CPU_MIPSEL #define GRUB_MACHINE_MEMORY_STACK_HIGH 0x806ffff0 #else #define GRUB_MACHINE_MEMORY_STACK_HIGH 0x881ffff0 #endif #ifndef ASM_FILE static inline grub_err_t grub_machine_mmap_register (grub_uint64_t start __attribute__ ((unused)), grub_uint64_t size __attribute__ ((unused)), int type __attribute__ ((unused)), int handle __attribute__ ((unused))) { return GRUB_ERR_NONE; } static inline grub_err_t grub_machine_mmap_unregister (int handle __attribute__ ((unused))) { return GRUB_ERR_NONE; } #endif #endif
/* { dg-do run { target { ia32 } } } */ /* { dg-options "-O0 -mtune=pentium" } */ #include "readeflags-1.c"
/**************************************************************************//** * @file efm32zg_romtable.h * @brief EFM32ZG_ROMTABLE register and bit field definitions * @version 5.1.2 ****************************************************************************** * @section License * <b>Copyright 2017 Silicon Laboratories, Inc. http://www.silabs.com</b> ****************************************************************************** * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software.@n * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software.@n * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc. * has no obligation to support this Software. Silicon Laboratories, Inc. is * providing the Software "AS IS", with no express or implied warranties of any * kind, including, but not limited to, any implied warranties of * merchantability or fitness for any particular purpose or warranties against * infringement of any proprietary rights of a third party. * * Silicon Laboratories, Inc. will not be liable for any consequential, * incidental, or special damages, or any other relief, or for any claim by * any third party, arising from your use of this Software. * *****************************************************************************/ /**************************************************************************//** * @addtogroup Parts * @{ ******************************************************************************/ /**************************************************************************//** * @defgroup EFM32ZG_ROMTABLE * @{ * @brief Chip Information, Revision numbers *****************************************************************************/ typedef struct { __IM uint32_t PID4; /**< JEP_106_BANK */ __IM uint32_t PID5; /**< Unused */ __IM uint32_t PID6; /**< Unused */ __IM uint32_t PID7; /**< Unused */ __IM uint32_t PID0; /**< Chip family LSB, chip major revision */ __IM uint32_t PID1; /**< JEP_106_NO, Chip family MSB */ __IM uint32_t PID2; /**< Chip minor rev MSB, JEP_106_PRESENT, JEP_106_NO */ __IM uint32_t PID3; /**< Chip minor rev LSB */ __IM uint32_t CID0; /**< Unused */ } ROMTABLE_TypeDef; /** @} */ /**************************************************************************//** * @defgroup EFM32ZG_ROMTABLE_BitFields * @{ *****************************************************************************/ /* Bit fields for EFM32ZG_ROMTABLE */ #define _ROMTABLE_PID0_FAMILYLSB_MASK 0x000000C0UL /**< Least Significant Bits [1:0] of CHIP FAMILY, mask */ #define _ROMTABLE_PID0_FAMILYLSB_SHIFT 6 /**< Least Significant Bits [1:0] of CHIP FAMILY, shift */ #define _ROMTABLE_PID0_REVMAJOR_MASK 0x0000003FUL /**< CHIP MAJOR Revison, mask */ #define _ROMTABLE_PID0_REVMAJOR_SHIFT 0 /**< CHIP MAJOR Revison, shift */ #define _ROMTABLE_PID1_FAMILYMSB_MASK 0x0000000FUL /**< Most Significant Bits [5:2] of CHIP FAMILY, mask */ #define _ROMTABLE_PID1_FAMILYMSB_SHIFT 0 /**< Most Significant Bits [5:2] of CHIP FAMILY, shift */ #define _ROMTABLE_PID2_REVMINORMSB_MASK 0x000000F0UL /**< Most Significant Bits [7:4] of CHIP MINOR revision, mask */ #define _ROMTABLE_PID2_REVMINORMSB_SHIFT 4 /**< Most Significant Bits [7:4] of CHIP MINOR revision, mask */ #define _ROMTABLE_PID3_REVMINORLSB_MASK 0x000000F0UL /**< Least Significant Bits [3:0] of CHIP MINOR revision, mask */ #define _ROMTABLE_PID3_REVMINORLSB_SHIFT 4 /**< Least Significant Bits [3:0] of CHIP MINOR revision, shift */ /** @} End of group EFM32ZG_ROMTABLE */ /** @} End of group Parts */
/* $Id: transport_loop_test.c 3553 2011-05-05 06:14:19Z nanang $ */ /* * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.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 */ #include "test.h" #include <pjsip.h> #include <pjlib.h> #define THIS_FILE "transport_loop_test.c" static int datagram_loop_test() { enum { LOOP = 8 }; pjsip_transport *loop; int i, pkt_lost; pj_sockaddr_in addr; pj_status_t status; long ref_cnt; int rtt[LOOP], min_rtt; PJ_LOG(3,(THIS_FILE, "testing datagram loop transport")); /* Test acquire transport. */ status = pjsip_endpt_acquire_transport( endpt, PJSIP_TRANSPORT_LOOP_DGRAM, &addr, sizeof(addr), NULL, &loop); if (status != PJ_SUCCESS) { app_perror(" error: loop transport is not configured", status); return -20; } /* Get initial reference counter */ ref_cnt = pj_atomic_get(loop->ref_cnt); /* Test basic transport attributes */ status = generic_transport_test(loop); if (status != PJ_SUCCESS) return status; /* Basic transport's send/receive loopback test. */ for (i=0; i<LOOP; ++i) { status = transport_send_recv_test(PJSIP_TRANSPORT_LOOP_DGRAM, loop, "sip:bob@130.0.0.1;transport=loop-dgram", &rtt[i]); if (status != 0) return status; } min_rtt = 0xFFFFFFF; for (i=0; i<LOOP; ++i) if (rtt[i] < min_rtt) min_rtt = rtt[i]; report_ival("loop-rtt-usec", min_rtt, "usec", "Best Loopback transport round trip time, in microseconds " "(time from sending request until response is received. " "Tests were performed on local machine only)"); /* Multi-threaded round-trip test. */ status = transport_rt_test(PJSIP_TRANSPORT_LOOP_DGRAM, loop, "sip:bob@130.0.0.1;transport=loop-dgram", &pkt_lost); if (status != 0) return status; if (pkt_lost != 0) { PJ_LOG(3,(THIS_FILE, " error: %d packet(s) was lost", pkt_lost)); return -40; } /* Put delay. */ PJ_LOG(3,(THIS_FILE," setting network delay to 10 ms")); pjsip_loop_set_delay(loop, 10); /* Multi-threaded round-trip test. */ status = transport_rt_test(PJSIP_TRANSPORT_LOOP_DGRAM, loop, "sip:bob@130.0.0.1;transport=loop-dgram", &pkt_lost); if (status != 0) return status; if (pkt_lost != 0) { PJ_LOG(3,(THIS_FILE, " error: %d packet(s) was lost", pkt_lost)); return -50; } /* Restore delay. */ pjsip_loop_set_delay(loop, 0); /* Check reference counter. */ if (pj_atomic_get(loop->ref_cnt) != ref_cnt) { PJ_LOG(3,(THIS_FILE, " error: ref counter is not %d (%d)", ref_cnt, pj_atomic_get(loop->ref_cnt))); return -51; } /* Decrement reference. */ pjsip_transport_dec_ref(loop); return 0; } int transport_loop_test(void) { int status; status = datagram_loop_test(); if (status != 0) return status; return 0; }
/* * timer.h * * Created on: 2012-4-25 * Author: Benn Huang (benn@allwinnertech.com) */ #ifndef TIMER_H_ #define TIMER_H_ /* * Timer */ #define AW_TMR_IRQ_EN_REG 0x0000 #define AW_TMR_IRQ_STA_REG 0x0004 #define AW_TMR0_CTRL_REG 0x0010 #define AW_TMR0_INTV_VALUE_REG 0x0014 #define AW_TMR0_CUR_VALUE_REG 0x0018 #define AW_AVS_CNT_CTL_REG 0x0080 #define AW_AVS_CNT0_REG 0x0084 #define AW_AVS_CNT1_REG 0x0088 #define AW_AVS_CNT_DIV_REG 0x008c #endif /* TIMER_H_ */
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2005 INRIA * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> */ #ifndef IPV4_END_POINT_DEMUX_H #define IPV4_END_POINT_DEMUX_H #include <stdint.h> #include <list> #include "ns3/ipv4-address.h" #include "ipv4-interface.h" namespace ns3 { class Ipv4EndPoint; /** * \brief Demultiplexes packets to various transport layer endpoints * * This class serves as a lookup table to match partial or full information * about a four-tuple to an ns3::Ipv4EndPoint. It internally contains a list * of endpoints, and has APIs to add and find endpoints in this demux. This * code is shared in common to TCP and UDP protocols in ns3. This demux * sits between ns3's layer four and the socket layer */ class Ipv4EndPointDemux { public: typedef std::list<Ipv4EndPoint *> EndPoints; typedef std::list<Ipv4EndPoint *>::iterator EndPointsI; Ipv4EndPointDemux (); ~Ipv4EndPointDemux (); EndPoints GetAllEndPoints (void); bool LookupPortLocal (uint16_t port); bool LookupLocal (Ipv4Address addr, uint16_t port); EndPoints Lookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport, Ptr<Ipv4Interface> incomingInterface); Ipv4EndPoint *SimpleLookup (Ipv4Address daddr, uint16_t dport, Ipv4Address saddr, uint16_t sport); Ipv4EndPoint *Allocate (void); Ipv4EndPoint *Allocate (Ipv4Address address); Ipv4EndPoint *Allocate (uint16_t port); Ipv4EndPoint *Allocate (Ipv4Address address, uint16_t port); Ipv4EndPoint *Allocate (Ipv4Address localAddress, uint16_t localPort, Ipv4Address peerAddress, uint16_t peerPort); void DeAllocate (Ipv4EndPoint *endPoint); private: uint16_t AllocateEphemeralPort (void); uint16_t m_ephemeral; uint16_t m_portLast; uint16_t m_portFirst; EndPoints m_endPoints; }; } // namespace ns3 #endif /* IPV4_END_POINTS_H */
// Copyright (c) 2010 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. // See net/disk_cache/disk_cache.h for the public interface. #ifndef NET_DISK_CACHE_STORAGE_BLOCK_H__ #define NET_DISK_CACHE_STORAGE_BLOCK_H__ #pragma once #include "net/disk_cache/addr.h" #include "net/disk_cache/mapped_file.h" namespace disk_cache { // This class encapsulates common behavior of a single "block" of data that is // stored on a block-file. It implements the FileBlock interface, so it can be // serialized directly to the backing file. // This object provides a memory buffer for the related data, and it can be used // to actually share that memory with another instance of the class. // // The following example shows how to share storage with another object: // StorageBlock<TypeA> a(file, address); // StorageBlock<TypeB> b(file, address); // a.Load(); // DoSomething(a.Data()); // b.SetData(a.Data()); // ModifySomething(b.Data()); // // Data modified on the previous call will be saved by b's destructor. // b.set_modified(); template<typename T> class StorageBlock : public FileBlock { public: StorageBlock(MappedFile* file, Addr address); virtual ~StorageBlock(); // FileBlock interface. virtual void* buffer() const; virtual size_t size() const; virtual int offset() const; // Allows the overide of dummy values passed on the constructor. bool LazyInit(MappedFile* file, Addr address); // Sets the internal storage to share the memory provided by other instance. void SetData(T* other); // Deletes the data, even if it was modified and not saved. This object must // own the memory buffer (it cannot be shared). void Discard(); // Stops sharing the data with another object. void StopSharingData(); // Sets the object to lazily save the in-memory data on destruction. void set_modified(); // Gets a pointer to the internal storage (allocates storage if needed). T* Data(); // Returns true if there is data associated with this object. bool HasData() const; // Returns true if this object owns the data buffer, false if it is shared. bool own_data() const; const Addr address() const; // Loads and store the data. bool Load(); bool Store(); private: void AllocateData(); void DeleteData(); T* data_; MappedFile* file_; Addr address_; bool modified_; bool own_data_; // Is data_ owned by this object or shared with someone else. bool extended_; // Used to store an entry of more than one block. DISALLOW_COPY_AND_ASSIGN(StorageBlock); }; typedef StorageBlock<EntryStore> CacheEntryBlock; typedef StorageBlock<RankingsNode> CacheRankingsBlock; } // namespace disk_cache #endif // NET_DISK_CACHE_STORAGE_BLOCK_H__
/* * tps65910.c -- TI TPS6591x * * Copyright 2010 Texas Instruments Inc. * * Author: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/platform_device.h> #include <linux/debugfs.h> #include <linux/gpio.h> #include <linux/mfd/tps65910.h> #define COMP 0 #define COMP1 1 #define COMP2 2 /* Comparator 1 voltage selection table in milivolts */ static const u16 COMP_VSEL_TABLE[] = { 0, 2500, 2500, 2500, 2500, 2550, 2600, 2650, 2700, 2750, 2800, 2850, 2900, 2950, 3000, 3050, 3100, 3150, 3200, 3250, 3300, 3350, 3400, 3450, 3500, }; struct comparator { const char *name; int reg; int uV_max; const u16 *vsel_table; }; static struct comparator tps_comparators[] = { { .name = "COMP1", .reg = TPS65911_VMBCH, .uV_max = 3500, .vsel_table = COMP_VSEL_TABLE, }, { .name = "COMP2", .reg = TPS65911_VMBCH2, .uV_max = 3500, .vsel_table = COMP_VSEL_TABLE, }, }; static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage) { struct comparator tps_comp = tps_comparators[id]; int curr_voltage = 0; int ret; u8 index = 0, val; if (id == COMP) return 0; while (curr_voltage < tps_comp.uV_max) { curr_voltage = tps_comp.vsel_table[index]; if (curr_voltage >= voltage) break; else if (curr_voltage < voltage) index ++; } if (curr_voltage > tps_comp.uV_max) return -EINVAL; val = index << 1; ret = tps65910->write(tps65910, tps_comp.reg, 1, &val); return ret; } static int comp_threshold_get(struct tps65910 *tps65910, int id) { struct comparator tps_comp = tps_comparators[id]; int ret; u8 val; if (id == COMP) return 0; ret = tps65910->read(tps65910, tps_comp.reg, 1, &val); if (ret < 0) return ret; val >>= 1; return tps_comp.vsel_table[val]; } static ssize_t comp_threshold_show(struct device *dev, struct device_attribute *attr, char *buf) { struct tps65910 *tps65910 = dev_get_drvdata(dev->parent); struct attribute comp_attr = attr->attr; int id, uVolt; if (!strcmp(comp_attr.name, "comp1_threshold")) id = COMP1; else if (!strcmp(comp_attr.name, "comp2_threshold")) id = COMP2; else return -EINVAL; uVolt = comp_threshold_get(tps65910, id); return sprintf(buf, "%d\n", uVolt); } static DEVICE_ATTR(comp1_threshold, S_IRUGO, comp_threshold_show, NULL); static DEVICE_ATTR(comp2_threshold, S_IRUGO, comp_threshold_show, NULL); static __devinit int tps65911_comparator_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); struct tps65910_board *pdata = dev_get_platdata(tps65910->dev); int ret; ret = comp_threshold_set(tps65910, COMP1, pdata->vmbch_threshold); if (ret < 0) { dev_err(&pdev->dev, "cannot set COMP1 threshold\n"); return ret; } ret = comp_threshold_set(tps65910, COMP2, pdata->vmbch2_threshold); if (ret < 0) { dev_err(&pdev->dev, "cannot set COMP2 theshold\n"); return ret; } /* Create sysfs entry */ ret = device_create_file(&pdev->dev, &dev_attr_comp1_threshold); if (ret < 0) dev_err(&pdev->dev, "failed to add COMP1 sysfs file\n"); ret = device_create_file(&pdev->dev, &dev_attr_comp2_threshold); if (ret < 0) dev_err(&pdev->dev, "failed to add COMP2 sysfs file\n"); return ret; } static __devexit int tps65911_comparator_remove(struct platform_device *pdev) { struct tps65910 *tps65910; tps65910 = dev_get_drvdata(pdev->dev.parent); device_remove_file(&pdev->dev, &dev_attr_comp2_threshold); device_remove_file(&pdev->dev, &dev_attr_comp1_threshold); return 0; } static struct platform_driver tps65911_comparator_driver = { .driver = { .name = "tps65911-comparator", .owner = THIS_MODULE, }, .probe = tps65911_comparator_probe, .remove = __devexit_p(tps65911_comparator_remove), }; static int __init tps65911_comparator_init(void) { return platform_driver_register(&tps65911_comparator_driver); } subsys_initcall(tps65911_comparator_init); static void __exit tps65911_comparator_exit(void) { platform_driver_unregister(&tps65911_comparator_driver); } module_exit(tps65911_comparator_exit); MODULE_AUTHOR("Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>"); MODULE_DESCRIPTION("TPS65911 comparator driver"); MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:tps65911-comparator");
/* ---------------------------------------------------------------------- * Copyright (C) 2010-2013 ARM Limited. All rights reserved. * * $Date: 17. January 2013 * $Revision: V1.4.1 * * Project: CMSIS DSP Library * Title: arm_add_q7.c * * Description: Q7 vector addition. * * 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" /** * @ingroup groupMath */ /** * @addtogroup BasicAdd * @{ */ /** * @brief Q7 vector addition. * @param[in] *pSrcA points to the first input vector * @param[in] *pSrcB points to the second input vector * @param[out] *pDst points to the output vector * @param[in] blockSize number of samples in each vector * @return none. * * <b>Scaling and Overflow Behavior:</b> * \par * The function uses saturating arithmetic. * Results outside of the allowable Q7 range [0x80 0x7F] will be saturated. */ void arm_add_q7( q7_t * pSrcA, q7_t * pSrcB, q7_t * pDst, uint32_t blockSize) { uint32_t blkCnt; /* loop counter */ #ifndef ARM_MATH_CM0_FAMILY /* Run the below code for Cortex-M4 and Cortex-M3 */ /*loop Unrolling */ blkCnt = blockSize >> 2u; /* First part of the processing with loop unrolling. Compute 4 outputs at a time. ** a second loop below computes the remaining 1 to 3 samples. */ while(blkCnt > 0u) { /* C = A + B */ /* Add and then store the results in the destination buffer. */ *__SIMD32(pDst)++ = __QADD8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++); /* Decrement the loop counter */ blkCnt--; } /* If the blockSize is not a multiple of 4, compute any remaining output samples here. ** No loop unrolling is used. */ blkCnt = blockSize % 0x4u; while(blkCnt > 0u) { /* C = A + B */ /* Add and then store the results in the destination buffer. */ *pDst++ = (q7_t) __SSAT(*pSrcA++ + *pSrcB++, 8); /* Decrement the loop counter */ blkCnt--; } #else /* Run the below code for Cortex-M0 */ /* Initialize blkCnt with number of samples */ blkCnt = blockSize; while(blkCnt > 0u) { /* C = A + B */ /* Add and then store the results in the destination buffer. */ *pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ + *pSrcB++, 8); /* Decrement the loop counter */ blkCnt--; } #endif /* #ifndef ARM_MATH_CM0_FAMILY */ } /** * @} end of BasicAdd group */
/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: 16kHz settings ********************************************************************/ #include "psych_16.h" #include "residue_16.h" static const int blocksize_16_short[3]={ 1024,512,512 }; static const int blocksize_16_long[3]={ 1024,1024,1024 }; static const int _floor_mapping_16a[]={ 9,3,3 }; static const int _floor_mapping_16b[]={ 9,9,9 }; static const int *_floor_mapping_16[]={ _floor_mapping_16a, _floor_mapping_16b }; static const double rate_mapping_16[4]={ 12000.,20000.,44000.,86000. }; static const double rate_mapping_16_uncoupled[4]={ 16000.,28000.,64000.,100000. }; static const double _global_mapping_16[4]={ 1., 2., 3., 4. }; static const double quality_mapping_16[4]={ -.1,.05,.5,1. }; static const double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.}; static const ve_setup_data_template ve_setup_16_stereo={ 3, rate_mapping_16, quality_mapping_16, 2, 15000, 19000, blocksize_16_short, blocksize_16_long, _psy_tone_masteratt_16, _psy_tone_0dB, _psy_tone_suppress, _vp_tonemask_adj_16, _vp_tonemask_adj_16, _vp_tonemask_adj_16, _psy_noiseguards_16, _psy_noisebias_16_impulse, _psy_noisebias_16_short, _psy_noisebias_16_short, _psy_noisebias_16, _psy_noise_suppress, _psy_compand_8, _psy_compand_16_mapping, _psy_compand_16_mapping, {_noise_start_16,_noise_start_16}, { _noise_part_16, _noise_part_16}, _noise_thresh_16, _psy_ath_floater_16, _psy_ath_abs_16, _psy_lowpass_16, _psy_global_44, _global_mapping_16, _psy_stereo_modes_16, _floor_books, _floor, 2, _floor_mapping_16, _mapres_template_16_stereo }; static const ve_setup_data_template ve_setup_16_uncoupled={ 3, rate_mapping_16_uncoupled, quality_mapping_16, -1, 15000, 19000, blocksize_16_short, blocksize_16_long, _psy_tone_masteratt_16, _psy_tone_0dB, _psy_tone_suppress, _vp_tonemask_adj_16, _vp_tonemask_adj_16, _vp_tonemask_adj_16, _psy_noiseguards_16, _psy_noisebias_16_impulse, _psy_noisebias_16_short, _psy_noisebias_16_short, _psy_noisebias_16, _psy_noise_suppress, _psy_compand_8, _psy_compand_16_mapping, _psy_compand_16_mapping, {_noise_start_16,_noise_start_16}, { _noise_part_16, _noise_part_16}, _noise_thresh_16, _psy_ath_floater_16, _psy_ath_abs_16, _psy_lowpass_16, _psy_global_44, _global_mapping_16, _psy_stereo_modes_16, _floor_books, _floor, 2, _floor_mapping_16, _mapres_template_16_uncoupled };
/* * pervasive backend for the cbe_cpufreq driver * * This driver makes use of the pervasive unit to * engage the desired frequency. * * (C) Copyright IBM Deutschland Entwicklung GmbH 2005-2007 * * Author: Christian Krafft <krafft@de.ibm.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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/io.h> #include <linux/kernel.h> #include <linux/time.h> #include <asm/machdep.h> #include <asm/hw_irq.h> #include <asm/cell-regs.h> #include "cbe_cpufreq.h" /* to write to MIC register */ static u64 MIC_Slow_Fast_Timer_table[] = { [0 ... 7] = 0x007fc00000000000ull, }; /* more values for the MIC */ static u64 MIC_Slow_Next_Timer_table[] = { 0x0000240000000000ull, 0x0000268000000000ull, 0x000029C000000000ull, 0x00002D0000000000ull, 0x0000300000000000ull, 0x0000334000000000ull, 0x000039C000000000ull, 0x00003FC000000000ull, }; int cbe_cpufreq_set_pmode(int cpu, unsigned int pmode) { struct cbe_pmd_regs __iomem *pmd_regs; struct cbe_mic_tm_regs __iomem *mic_tm_regs; u64 flags; u64 value; #ifdef DEBUG long time; #endif local_irq_save(flags); mic_tm_regs = cbe_get_cpu_mic_tm_regs(cpu); pmd_regs = cbe_get_cpu_pmd_regs(cpu); #ifdef DEBUG time = jiffies; #endif out_be64(&mic_tm_regs->slow_fast_timer_0, MIC_Slow_Fast_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_fast_timer_1, MIC_Slow_Fast_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_next_timer_0, MIC_Slow_Next_Timer_table[pmode]); out_be64(&mic_tm_regs->slow_next_timer_1, MIC_Slow_Next_Timer_table[pmode]); value = in_be64(&pmd_regs->pmcr); /* set bits to zero */ value &= 0xFFFFFFFFFFFFFFF8ull; /* set bits to next pmode */ value |= pmode; out_be64(&pmd_regs->pmcr, value); #ifdef DEBUG /* wait until new pmode appears in status register */ value = in_be64(&pmd_regs->pmsr) & 0x07; while (value != pmode) { cpu_relax(); value = in_be64(&pmd_regs->pmsr) & 0x07; } time = jiffies - time; time = jiffies_to_msecs(time); pr_debug("had to wait %lu ms for a transition using " \ "pervasive unit\n", time); #endif local_irq_restore(flags); return 0; } int cbe_cpufreq_get_pmode(int cpu) { int ret; struct cbe_pmd_regs __iomem *pmd_regs; pmd_regs = cbe_get_cpu_pmd_regs(cpu); ret = in_be64(&pmd_regs->pmsr) & 0x07; return ret; }
// SPDX-License-Identifier: GPL-2.0-only /* * Intel MIC Platform Software Stack (MPSS) * * Copyright(c) 2013 Intel Corporation. * * Disclaimer: The codes contained in these modules may be specific to * the Intel Software Development Platform codenamed: Knights Ferry, and * the Intel product codenamed: Knights Corner, and are not backward * compatible with other Intel products. Additionally, Intel will NOT * support the codes or instruction set in future products. * * Intel MIC Card driver. */ #include <linux/debugfs.h> #include <linux/delay.h> #include <linux/seq_file.h> #include <linux/interrupt.h> #include <linux/device.h> #include "../common/mic_dev.h" #include "mic_device.h" /* Debugfs parent dir */ static struct dentry *mic_dbg; /** * mic_intr_show - Send interrupts to host. */ static int mic_intr_show(struct seq_file *s, void *unused) { struct mic_driver *mdrv = s->private; struct mic_device *mdev = &mdrv->mdev; mic_send_intr(mdev, 0); msleep(1000); mic_send_intr(mdev, 1); msleep(1000); mic_send_intr(mdev, 2); msleep(1000); mic_send_intr(mdev, 3); msleep(1000); return 0; } DEFINE_SHOW_ATTRIBUTE(mic_intr); /** * mic_create_card_debug_dir - Initialize MIC debugfs entries. */ void __init mic_create_card_debug_dir(struct mic_driver *mdrv) { if (!mic_dbg) return; mdrv->dbg_dir = debugfs_create_dir(mdrv->name, mic_dbg); debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, mdrv, &mic_intr_fops); } /** * mic_delete_card_debug_dir - Uninitialize MIC debugfs entries. */ void mic_delete_card_debug_dir(struct mic_driver *mdrv) { debugfs_remove_recursive(mdrv->dbg_dir); } /** * mic_init_card_debugfs - Initialize global debugfs entry. */ void __init mic_init_card_debugfs(void) { mic_dbg = debugfs_create_dir(KBUILD_MODNAME, NULL); } /** * mic_exit_card_debugfs - Uninitialize global debugfs entry */ void mic_exit_card_debugfs(void) { debugfs_remove(mic_dbg); }
/* * Copyright (c) 2010 Nuvoton technology corporation. * * Wan ZongShun <mcuos.com@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation;version 2 of the License. * */ #ifndef _NUC900_AUDIO_H #define _NUC900_AUDIO_H #include <linux/io.h> /* Audio Control Registers */ #define ACTL_CON 0x00 #define ACTL_RESET 0x04 #define ACTL_RDSTB 0x08 #define ACTL_RDST_LENGTH 0x0C #define ACTL_RDSTC 0x10 #define ACTL_RSR 0x14 #define ACTL_PDSTB 0x18 #define ACTL_PDST_LENGTH 0x1C #define ACTL_PDSTC 0x20 #define ACTL_PSR 0x24 #define ACTL_IISCON 0x28 #define ACTL_ACCON 0x2C #define ACTL_ACOS0 0x30 #define ACTL_ACOS1 0x34 #define ACTL_ACOS2 0x38 #define ACTL_ACIS0 0x3C #define ACTL_ACIS1 0x40 #define ACTL_ACIS2 0x44 #define ACTL_COUNTER 0x48 /* bit definition of REG_ACTL_CON register */ #define R_DMA_IRQ 0x1000 #define T_DMA_IRQ 0x0800 #define IIS_AC_PIN_SEL 0x0100 #define FIFO_TH 0x0080 #define ADC_EN 0x0010 #define M80_EN 0x0008 #define ACLINK_EN 0x0004 #define IIS_EN 0x0002 /* bit definition of REG_ACTL_RESET register */ #define W5691_PLAY 0x20000 #define ACTL_RESET_BIT 0x10000 #define RECORD_RIGHT_CHNNEL 0x08000 #define RECORD_LEFT_CHNNEL 0x04000 #define PLAY_RIGHT_CHNNEL 0x02000 #define PLAY_LEFT_CHNNEL 0x01000 #define DAC_PLAY 0x00800 #define ADC_RECORD 0x00400 #define M80_PLAY 0x00200 #define AC_RECORD 0x00100 #define AC_PLAY 0x00080 #define IIS_RECORD 0x00040 #define IIS_PLAY 0x00020 #define DAC_RESET 0x00010 #define ADC_RESET 0x00008 #define M80_RESET 0x00004 #define AC_RESET 0x00002 #define IIS_RESET 0x00001 /* bit definition of REG_ACTL_ACCON register */ #define AC_BCLK_PU_EN 0x20 #define AC_R_FINISH 0x10 #define AC_W_FINISH 0x08 #define AC_W_RES 0x04 #define AC_C_RES 0x02 /* bit definition of ACTL_RSR register */ #define R_FIFO_EMPTY 0x04 #define R_DMA_END_IRQ 0x02 #define R_DMA_MIDDLE_IRQ 0x01 /* bit definition of ACTL_PSR register */ #define P_FIFO_EMPTY 0x04 #define P_DMA_END_IRQ 0x02 #define P_DMA_MIDDLE_IRQ 0x01 /* bit definition of ACTL_ACOS0 register */ #define SLOT1_VALID 0x01 #define SLOT2_VALID 0x02 #define SLOT3_VALID 0x04 #define SLOT4_VALID 0x08 #define VALID_FRAME 0x10 /* bit definition of ACTL_ACOS1 register */ #define R_WB 0x80 #define CODEC_READY 0x10 #define RESET_PRSR 0x00 #define AUDIO_WRITE(addr, val) __raw_writel(val, addr) #define AUDIO_READ(addr) __raw_readl(addr) struct nuc900_audio { void __iomem *mmio; spinlock_t lock; unsigned long irq_num; struct resource *res; struct clk *clk; struct device *dev; }; extern struct nuc900_audio *nuc900_ac97_data; #endif /*end _NUC900_AUDIO_H */
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_FRAME_TEST_WIN_EVENT_RECEIVER_H_ #define CHROME_FRAME_TEST_WIN_EVENT_RECEIVER_H_ #include <windows.h> #include <string> #include <vector> #include <utility> #include "base/memory/linked_ptr.h" #include "base/win/object_watcher.h" struct FunctionStub; // Listens to WinEvents from the WinEventReceiver. class WinEventListener { public: virtual ~WinEventListener() {} // Called when an event has been received. |hwnd| is the window that generated // the event, or null if no window is associated with the event. virtual void OnEventReceived(DWORD event, HWND hwnd, LONG object_id, LONG child_id) = 0; }; // Receives WinEvents and forwards them to its listener. The event types the // listener wants to receive can be specified. class WinEventReceiver { public: WinEventReceiver(); ~WinEventReceiver(); // Sets the sole listener of this receiver. The listener will receive all // WinEvents of the given event type. Any previous listener will be // replaced. |listener| should not be NULL. void SetListenerForEvent(WinEventListener* listener, DWORD event); // Same as above, but sets a range of events to listen for. void SetListenerForEvents(WinEventListener* listener, DWORD event_min, DWORD event_max); // Stops receiving events and forwarding them to the listener. It is // permitted to call this even if the receiver has already been stopped. void StopReceivingEvents(); private: bool InitializeHook(DWORD event_min, DWORD event_max); static void CALLBACK WinEventHook(WinEventReceiver* me, HWINEVENTHOOK hook, DWORD event, HWND hwnd, LONG object_id, LONG child_id, DWORD event_thread_id, DWORD event_time); WinEventListener* listener_; HWINEVENTHOOK hook_; FunctionStub* hook_stub_; }; // Receives notifications when a window is opened or closed. class WindowObserver { public: virtual ~WindowObserver() {} virtual void OnWindowOpen(HWND hwnd) = 0; virtual void OnWindowClose(HWND hwnd) = 0; }; // Notifies observers when windows whose captions match specified patterns // open or close. When a window opens, its caption is compared to the patterns // associated with each observer. Observers registered with matching patterns // are notified of the window's opening and will be notified when the same // window is closed (including if the owning process terminates without closing // the window). // // Changes to a window's caption while it is open do not affect the set of // observers to be notified when it closes. // // Observers are not notified of the closing of windows that were already open // when they were registered. // // Observers may call AddObserver and/or RemoveObserver during notifications. // // Each instance of this class must only be accessed from a single thread, and // that thread must be running a message loop. class WindowWatchdog : public WinEventListener { public: WindowWatchdog(); // Register |observer| to be notified when windows matching |caption_pattern| // and/or |class_name_pattern| are opened or closed. A single observer may be // registered multiple times. // If a single window caption and/or class name matches multiple // registrations of a single observer, the observer will be notified once per // matching registration. void AddObserver(WindowObserver* observer, const std::string& caption_pattern, const std::string& class_name_pattern); // Remove all registrations of |observer|. The |observer| will not be notified // during or after this call. void RemoveObserver(WindowObserver* observer); private: class ProcessExitObserver; // The Delegate object is actually a ProcessExitObserver, but declaring // it as such would require fully declaring the ProcessExitObserver class // here in order for linked_ptr to access its destructor. typedef std::pair<HWND, linked_ptr<base::win::ObjectWatcher::Delegate> > OpenWindowEntry; typedef std::vector<OpenWindowEntry> OpenWindowList; struct ObserverEntry { WindowObserver* observer; std::string caption_pattern; std::string class_name_pattern; OpenWindowList open_windows; }; typedef std::vector<ObserverEntry> ObserverEntryList; // WinEventListener implementation. virtual void OnEventReceived( DWORD event, HWND hwnd, LONG object_id, LONG child_id); static std::string GetWindowCaption(HWND hwnd); void HandleOnOpen(HWND hwnd); void HandleOnClose(HWND hwnd); void OnHwndProcessExited(HWND hwnd); // Returns true if the caption pattern and/or the class name pattern in the // observer entry structure matches the caption and/or class name passed in. bool MatchingWindow(const ObserverEntry& entry, const std::string& caption, const std::string& class_name); ObserverEntryList observers_; WinEventReceiver win_event_receiver_; DISALLOW_COPY_AND_ASSIGN(WindowWatchdog); }; #endif // CHROME_FRAME_TEST_WIN_EVENT_RECEIVER_H_
/* * Copyright (c) 2011 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. */ // This is a pure C wrapper of the DataLog class. The functions are directly // mapped here except for InsertCell as C does not support templates. // See data_log.h for a description of the functions. #ifndef SRC_SYSTEM_WRAPPERS_INTERFACE_DATA_LOG_C_H_ #define SRC_SYSTEM_WRAPPERS_INTERFACE_DATA_LOG_C_H_ #include <stddef.h> // size_t #include "webrtc/typedefs.h" #ifdef __cplusplus extern "C" { #endif // All char* parameters in this file are expected to be null-terminated // character sequences. int WebRtcDataLog_CreateLog(); void WebRtcDataLog_ReturnLog(); char* WebRtcDataLog_Combine(char* combined_name, size_t combined_len, const char* table_name, int table_id); int WebRtcDataLog_AddTable(const char* table_name); int WebRtcDataLog_AddColumn(const char* table_name, const char* column_name, int multi_value_length); int WebRtcDataLog_InsertCell_int(const char* table_name, const char* column_name, int value); int WebRtcDataLog_InsertArray_int(const char* table_name, const char* column_name, const int* values, int length); int WebRtcDataLog_InsertCell_float(const char* table_name, const char* column_name, float value); int WebRtcDataLog_InsertArray_float(const char* table_name, const char* column_name, const float* values, int length); int WebRtcDataLog_InsertCell_double(const char* table_name, const char* column_name, double value); int WebRtcDataLog_InsertArray_double(const char* table_name, const char* column_name, const double* values, int length); int WebRtcDataLog_InsertCell_int32(const char* table_name, const char* column_name, int32_t value); int WebRtcDataLog_InsertArray_int32(const char* table_name, const char* column_name, const int32_t* values, int length); int WebRtcDataLog_InsertCell_uint32(const char* table_name, const char* column_name, uint32_t value); int WebRtcDataLog_InsertArray_uint32(const char* table_name, const char* column_name, const uint32_t* values, int length); int WebRtcDataLog_InsertCell_int64(const char* table_name, const char* column_name, int64_t value); int WebRtcDataLog_InsertArray_int64(const char* table_name, const char* column_name, const int64_t* values, int length); int WebRtcDataLog_NextRow(const char* table_name); #ifdef __cplusplus } // end of extern "C" #endif #endif // SRC_SYSTEM_WRAPPERS_INTERFACE_DATA_LOG_C_H_ // NOLINT
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtNetwork 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 Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/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. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QTCPSERVER_H #define QTCPSERVER_H #include <QtCore/qobject.h> #include <QtNetwork/qabstractsocket.h> #include <QtNetwork/qhostaddress.h> QT_BEGIN_NAMESPACE class QTcpServerPrivate; #ifndef QT_NO_NETWORKPROXY class QNetworkProxy; #endif class QTcpSocket; class Q_NETWORK_EXPORT QTcpServer : public QObject { Q_OBJECT public: explicit QTcpServer(QObject *parent = 0); virtual ~QTcpServer(); bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0); void close(); bool isListening() const; void setMaxPendingConnections(int numConnections); int maxPendingConnections() const; quint16 serverPort() const; QHostAddress serverAddress() const; qintptr socketDescriptor() const; bool setSocketDescriptor(qintptr socketDescriptor); bool waitForNewConnection(int msec = 0, bool *timedOut = 0); virtual bool hasPendingConnections() const; virtual QTcpSocket *nextPendingConnection(); QAbstractSocket::SocketError serverError() const; QString errorString() const; void pauseAccepting(); void resumeAccepting(); #ifndef QT_NO_NETWORKPROXY void setProxy(const QNetworkProxy &networkProxy); QNetworkProxy proxy() const; #endif protected: virtual void incomingConnection(qintptr handle); void addPendingConnection(QTcpSocket* socket); Q_SIGNALS: void newConnection(); void acceptError(QAbstractSocket::SocketError socketError); private: Q_DISABLE_COPY(QTcpServer) Q_DECLARE_PRIVATE(QTcpServer) }; QT_END_NAMESPACE #endif // QTCPSERVER_H
/* { dg-do compile } */ /* { dg-options "-O3 -ffast-math -fdump-tree-optimized" } */ float baz (float x, float y) { return x * x * x * x * y * y * y * y; } /* { dg-final { scan-tree-dump-times " \\* " 3 "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */
/* * Copyright (C) 2011 The Android Open Source Project * * 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 __CUTILS_UEVENT_H #define __CUTILS_UEVENT_H #include <stdbool.h> #include <sys/socket.h> #ifdef __cplusplus extern "C" { #endif int uevent_open_socket(int buf_sz, bool passcred); ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length); ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *uid); #ifdef __cplusplus } #endif #endif /* __CUTILS_UEVENT_H */
#include <linux/smp.h> #include <linux/timex.h> #include <linux/string.h> #include <linux/seq_file.h> #include <linux/cpufreq.h> /* * Get CPU information for use by the procfs. */ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, unsigned int cpu) { #ifdef CONFIG_SMP if (c->x86_max_cores * smp_num_siblings > 1) { seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); seq_printf(m, "siblings\t: %d\n", cpumask_weight(cpu_core_mask(cpu))); seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); seq_printf(m, "apicid\t\t: %d\n", c->apicid); seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid); } #endif } #ifdef CONFIG_X86_32 static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c) { /* * We use exception 16 if we have hardware math and we've either seen * it or the CPU claims it is internal */ int fpu_exception = c->hard_math && (ignore_fpu_irq || cpu_has_fpu); seq_printf(m, "fdiv_bug\t: %s\n" "hlt_bug\t\t: %s\n" "f00f_bug\t: %s\n" "coma_bug\t: %s\n" "fpu\t\t: %s\n" "fpu_exception\t: %s\n" "cpuid level\t: %d\n" "wp\t\t: %s\n", c->fdiv_bug ? "yes" : "no", c->hlt_works_ok ? "no" : "yes", c->f00f_bug ? "yes" : "no", c->coma_bug ? "yes" : "no", c->hard_math ? "yes" : "no", fpu_exception ? "yes" : "no", c->cpuid_level, c->wp_works_ok ? "yes" : "no"); } #else static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c) { seq_printf(m, "fpu\t\t: yes\n" "fpu_exception\t: yes\n" "cpuid level\t: %d\n" "wp\t\t: yes\n", c->cpuid_level); } #endif static int show_cpuinfo(struct seq_file *m, void *v) { struct cpuinfo_x86 *c = v; unsigned int cpu; int i; cpu = c->cpu_index; seq_printf(m, "processor\t: %u\n" "vendor_id\t: %s\n" "cpu family\t: %d\n" "model\t\t: %u\n" "model name\t: %s\n", cpu, c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", c->x86, c->x86_model, c->x86_model_id[0] ? c->x86_model_id : "unknown"); if (c->x86_mask || c->cpuid_level >= 0) seq_printf(m, "stepping\t: %d\n", c->x86_mask); else seq_printf(m, "stepping\t: unknown\n"); if (c->microcode) seq_printf(m, "microcode\t: 0x%x\n", c->microcode); if (cpu_has(c, X86_FEATURE_TSC)) { unsigned int freq = cpufreq_quick_get(cpu); if (!freq) freq = cpu_khz; seq_printf(m, "cpu MHz\t\t: %u.%03u\n", freq / 1000, (freq % 1000)); } /* Cache size */ if (c->x86_cache_size >= 0) seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); show_cpuinfo_core(m, c, cpu); show_cpuinfo_misc(m, c); seq_printf(m, "flags\t\t:"); for (i = 0; i < 32*NCAPINTS; i++) if (cpu_has(c, i) && x86_cap_flags[i] != NULL) seq_printf(m, " %s", x86_cap_flags[i]); seq_printf(m, "\nbogomips\t: %lu.%02lu\n", c->loops_per_jiffy/(500000/HZ), (c->loops_per_jiffy/(5000/HZ)) % 100); #ifdef CONFIG_X86_64 if (c->x86_tlbsize > 0) seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize); #endif seq_printf(m, "clflush size\t: %u\n", c->x86_clflush_size); seq_printf(m, "cache_alignment\t: %d\n", c->x86_cache_alignment); seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", c->x86_phys_bits, c->x86_virt_bits); seq_printf(m, "power management:"); for (i = 0; i < 32; i++) { if (c->x86_power & (1 << i)) { if (i < ARRAY_SIZE(x86_power_flags) && x86_power_flags[i]) seq_printf(m, "%s%s", x86_power_flags[i][0] ? " " : "", x86_power_flags[i]); else seq_printf(m, " [%d]", i); } } seq_printf(m, "\n\n"); return 0; } static void *c_start(struct seq_file *m, loff_t *pos) { if (*pos == 0) /* just in case, cpu 0 is not the first */ *pos = cpumask_first(cpu_online_mask); else *pos = cpumask_next(*pos - 1, cpu_online_mask); if ((*pos) < nr_cpu_ids) return &cpu_data(*pos); return NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { (*pos)++; return c_start(m, pos); } static void c_stop(struct seq_file *m, void *v) { } const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo, };
/******************************************************************************* PTP 1588 clock using the STMMAC. Copyright (C) 2013 Vayavya Labs Pvt Ltd This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The full GNU General Public License is included in this distribution in the file called "COPYING". Author: Rayagond Kokatanur <rayagond@vayavyalabs.com> *******************************************************************************/ #include "stmmac.h" #include "stmmac_ptp.h" /** * stmmac_adjust_freq * * @ptp: pointer to ptp_clock_info structure * @ppb: desired period change in parts ber billion * * Description: this function will adjust the frequency of hardware clock. */ static int stmmac_adjust_freq(struct ptp_clock_info *ptp, s32 ppb) { struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops); unsigned long flags; u32 diff, addend; int neg_adj = 0; u64 adj; if (ppb < 0) { neg_adj = 1; ppb = -ppb; } addend = priv->default_addend; adj = addend; adj *= ppb; diff = div_u64(adj, 1000000000ULL); addend = neg_adj ? (addend - diff) : (addend + diff); spin_lock_irqsave(&priv->ptp_lock, flags); priv->hw->ptp->config_addend(priv->ptpaddr, addend); spin_unlock_irqrestore(&priv->ptp_lock, flags); return 0; } /** * stmmac_adjust_time * * @ptp: pointer to ptp_clock_info structure * @delta: desired change in nanoseconds * * Description: this function will shift/adjust the hardware clock time. */ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) { struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops); unsigned long flags; u32 sec, nsec; u32 quotient, reminder; int neg_adj = 0; if (delta < 0) { neg_adj = 1; delta = -delta; } quotient = div_u64_rem(delta, 1000000000ULL, &reminder); sec = quotient; nsec = reminder; spin_lock_irqsave(&priv->ptp_lock, flags); priv->hw->ptp->adjust_systime(priv->ptpaddr, sec, nsec, neg_adj, priv->plat->has_gmac4); spin_unlock_irqrestore(&priv->ptp_lock, flags); return 0; } /** * stmmac_get_time * * @ptp: pointer to ptp_clock_info structure * @ts: pointer to hold time/result * * Description: this function will read the current time from the * hardware clock and store it in @ts. */ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) { struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops); unsigned long flags; u64 ns; spin_lock_irqsave(&priv->ptp_lock, flags); ns = priv->hw->ptp->get_systime(priv->ptpaddr); spin_unlock_irqrestore(&priv->ptp_lock, flags); *ts = ns_to_timespec64(ns); return 0; } /** * stmmac_set_time * * @ptp: pointer to ptp_clock_info structure * @ts: time value to set * * Description: this function will set the current time on the * hardware clock. */ static int stmmac_set_time(struct ptp_clock_info *ptp, const struct timespec64 *ts) { struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops); unsigned long flags; spin_lock_irqsave(&priv->ptp_lock, flags); priv->hw->ptp->init_systime(priv->ptpaddr, ts->tv_sec, ts->tv_nsec); spin_unlock_irqrestore(&priv->ptp_lock, flags); return 0; } static int stmmac_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *rq, int on) { return -EOPNOTSUPP; } /* structure describing a PTP hardware clock */ static const struct ptp_clock_info stmmac_ptp_clock_ops = { .owner = THIS_MODULE, .name = "stmmac_ptp_clock", .max_adj = 62500000, .n_alarm = 0, .n_ext_ts = 0, .n_per_out = 0, .n_pins = 0, .pps = 0, .adjfreq = stmmac_adjust_freq, .adjtime = stmmac_adjust_time, .gettime64 = stmmac_get_time, .settime64 = stmmac_set_time, .enable = stmmac_enable, }; /** * stmmac_ptp_register * @priv: driver private structure * Description: this function will register the ptp clock driver * to kernel. It also does some house keeping work. */ void stmmac_ptp_register(struct stmmac_priv *priv) { spin_lock_init(&priv->ptp_lock); priv->ptp_clock_ops = stmmac_ptp_clock_ops; priv->ptp_clock = ptp_clock_register(&priv->ptp_clock_ops, priv->device); if (IS_ERR(priv->ptp_clock)) { netdev_err(priv->dev, "ptp_clock_register failed\n"); priv->ptp_clock = NULL; } else if (priv->ptp_clock) netdev_info(priv->dev, "registered PTP clock\n"); } /** * stmmac_ptp_unregister * @priv: driver private structure * Description: this function will remove/unregister the ptp clock driver * from the kernel. */ void stmmac_ptp_unregister(struct stmmac_priv *priv) { if (priv->ptp_clock) { ptp_clock_unregister(priv->ptp_clock); priv->ptp_clock = NULL; pr_debug("Removed PTP HW clock successfully on %s\n", priv->dev->name); } }
/* * Based on arch/arm/include/asm/memory.h * * Copyright (C) 2000-2002 Russell King * Copyright (C) 2012 ARM Ltd. * * 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/>. * * Note: this file should not be included by non-asm/.h files */ #ifndef __ASM_MEMORY_H #define __ASM_MEMORY_H #include <linux/compiler.h> #include <linux/const.h> #include <linux/types.h> #include <asm/sizes.h> /* * Allow for constants defined here to be used from assembly code * by prepending the UL suffix only with actual C code compilation. */ #define UL(x) _AC(x, UL) /* * PAGE_OFFSET - the virtual address of the start of the kernel image (top * (VA_BITS - 1)) * VA_BITS - the maximum number of bits for virtual addresses. * TASK_SIZE - the maximum size of a user space task. * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area. * The module space lives between the addresses given by TASK_SIZE * and PAGE_OFFSET - it must be within 128MB of the kernel text. */ #ifdef CONFIG_ARM64_64K_PAGES #define VA_BITS (42) #else #define VA_BITS (39) #endif #define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1)) #define MODULES_END (PAGE_OFFSET) #define MODULES_VADDR (MODULES_END - SZ_64M) #define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M) #define TASK_SIZE_64 (UL(1) << VA_BITS) #ifdef CONFIG_COMPAT #define TASK_SIZE_32 UL(0x100000000) #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64) #else #define TASK_SIZE TASK_SIZE_64 #endif /* CONFIG_COMPAT */ #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 4)) #if TASK_SIZE_64 > MODULES_VADDR #error Top of 64-bit user space clashes with start of module space #endif /* * Physical vs virtual RAM address space conversion. These are * private definitions which should NOT be used outside memory.h * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. */ #define __virt_to_phys(x) (((phys_addr_t)(x) - PAGE_OFFSET + PHYS_OFFSET)) #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET + PAGE_OFFSET)) /* * Convert a physical address to a Page Frame Number and back */ #define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT)) #define __pfn_to_phys(pfn) ((phys_addr_t)(pfn) << PAGE_SHIFT) /* * Convert a page to/from a physical address */ #define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) #define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) /* * Memory types available. */ #define MT_DEVICE_nGnRnE 0 #define MT_DEVICE_nGnRE 1 #define MT_DEVICE_GRE 2 #define MT_NORMAL_NC 3 #define MT_NORMAL 4 /* * Memory types for Stage-2 translation */ #define MT_S2_NORMAL 0xf #define MT_S2_DEVICE_nGnRE 0x1 #ifndef __ASSEMBLY__ extern phys_addr_t memstart_addr; /* PHYS_OFFSET - the physical address of the start of memory. */ #define PHYS_OFFSET ({ memstart_addr; }) /* * PFNs are used to describe any physical page; this means * PFN 0 == physical address 0. * * This is the PFN of the first RAM page in the kernel * direct-mapped view. We assume this is the first page * of RAM in the mem_map as well. */ #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT) /* * Note: Drivers should NOT use these. They are the wrong * translation for translating DMA addresses. Use the driver * DMA support - see dma-mapping.h. */ static inline phys_addr_t virt_to_phys(const volatile void *x) { return __virt_to_phys((unsigned long)(x)); } static inline void *phys_to_virt(phys_addr_t x) { return (void *)(__phys_to_virt(x)); } /* * Drivers should NOT use these either. */ #define __pa(x) __virt_to_phys((unsigned long)(x)) #define __va(x) ((void *)__phys_to_virt((phys_addr_t)(x))) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) /* * virt_to_page(k) convert a _valid_ virtual address to struct page * * virt_addr_valid(k) indicates whether a virtual address is valid */ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) #endif #include <asm-generic/memory_model.h> #endif
/* sound/soc/samsung/s3c2412-i2s.c * * ALSA Soc Audio Layer - S3C2412 I2S driver * * Copyright (c) 2006 Wolfson Microelectronics PLC. * Graeme Gregory graeme.gregory@wolfsonmicro.com * linux@wolfsonmicro.com * * Copyright (c) 2007, 2004-2005 Simtec Electronics * http://armlinux.simtec.co.uk/ * Ben Dooks <ben@simtec.co.uk> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/delay.h> #include <linux/gpio.h> #include <linux/clk.h> #include <linux/io.h> #include <linux/module.h> #include <sound/soc.h> #include <sound/pcm_params.h> #include <mach/dma.h> #include "dma.h" #include "regs-i2s-v2.h" #include "s3c2412-i2s.h" static struct s3c2410_dma_client s3c2412_dma_client_out = { .name = "I2S PCM Stereo out" }; static struct s3c2410_dma_client s3c2412_dma_client_in = { .name = "I2S PCM Stereo in" }; static struct s3c_dma_params s3c2412_i2s_pcm_stereo_out = { .client = &s3c2412_dma_client_out, .channel = DMACH_I2S_OUT, .dma_addr = S3C2410_PA_IIS + S3C2412_IISTXD, .dma_size = 4, }; static struct s3c_dma_params s3c2412_i2s_pcm_stereo_in = { .client = &s3c2412_dma_client_in, .channel = DMACH_I2S_IN, .dma_addr = S3C2410_PA_IIS + S3C2412_IISRXD, .dma_size = 4, }; static struct s3c_i2sv2_info s3c2412_i2s; static int s3c2412_i2s_probe(struct snd_soc_dai *dai) { int ret; pr_debug("Entered %s\n", __func__); ret = s3c_i2sv2_probe(dai, &s3c2412_i2s, S3C2410_PA_IIS); if (ret) return ret; s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in; s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out; s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk"); if (IS_ERR(s3c2412_i2s.iis_cclk)) { pr_err("failed to get i2sclk clock\n"); iounmap(s3c2412_i2s.regs); return PTR_ERR(s3c2412_i2s.iis_cclk); } /* Set MPLL as the source for IIS CLK */ clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll")); clk_enable(s3c2412_i2s.iis_cclk); s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk; /* Configure the I2S pins (GPE0...GPE4) in correct mode */ s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE); return 0; } static int s3c2412_i2s_remove(struct snd_soc_dai *dai) { clk_disable(s3c2412_i2s.iis_cclk); clk_put(s3c2412_i2s.iis_cclk); iounmap(s3c2412_i2s.regs); return 0; } static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *cpu_dai) { struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai); struct s3c_dma_params *dma_data; u32 iismod; pr_debug("Entered %s\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) dma_data = i2s->dma_playback; else dma_data = i2s->dma_capture; snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); iismod = readl(i2s->regs + S3C2412_IISMOD); pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); switch (params_format(params)) { case SNDRV_PCM_FORMAT_S8: iismod |= S3C2412_IISMOD_8BIT; break; case SNDRV_PCM_FORMAT_S16_LE: iismod &= ~S3C2412_IISMOD_8BIT; break; } writel(iismod, i2s->regs + S3C2412_IISMOD); pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); return 0; } #define S3C2412_I2S_RATES \ (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) static const struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { .hw_params = s3c2412_i2s_hw_params, }; static struct snd_soc_dai_driver s3c2412_i2s_dai = { .probe = s3c2412_i2s_probe, .remove = s3c2412_i2s_remove, .playback = { .channels_min = 2, .channels_max = 2, .rates = S3C2412_I2S_RATES, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .channels_min = 2, .channels_max = 2, .rates = S3C2412_I2S_RATES, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &s3c2412_i2s_dai_ops, }; static const struct snd_soc_component_driver s3c2412_i2s_component = { .name = "s3c2412-i2s", }; static int s3c2412_iis_dev_probe(struct platform_device *pdev) { int ret = 0; ret = s3c_i2sv2_register_component(&pdev->dev, -1, &s3c2412_i2s_component, &s3c2412_i2s_dai); if (ret) { pr_err("failed to register the dai\n"); return ret; } ret = asoc_dma_platform_register(&pdev->dev); if (ret) { pr_err("failed to register the DMA: %d\n", ret); goto err; } return 0; err: snd_soc_unregister_component(&pdev->dev); return ret; } static int s3c2412_iis_dev_remove(struct platform_device *pdev) { asoc_dma_platform_unregister(&pdev->dev); snd_soc_unregister_component(&pdev->dev); return 0; } static struct platform_driver s3c2412_iis_driver = { .probe = s3c2412_iis_dev_probe, .remove = s3c2412_iis_dev_remove, .driver = { .name = "s3c2412-iis", .owner = THIS_MODULE, }, }; module_platform_driver(s3c2412_iis_driver); /* Module information */ MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); MODULE_DESCRIPTION("S3C2412 I2S SoC Interface"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:s3c2412-iis");
//********************************************************* // // 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 // GameInfoOverlay: // This class maintains a D2D1 Bitmap surface to provide information to the player // on the state of the game when the game is not in active play. // This class has several different status modes: // GameLoading - this displays a title and a series of dots to show progress. // GameStats - this displays a title and the Max level achieved, the hit and shot counts. // GameOver - this displays a title and the game status. // Pause - this displays only a title - 'Paused'. // In addition to the status modes, there is a region at the bottom that displays what the // player is expected to do next. This can be one of four things: // None - the action is blank. This is usually set when the game does not currently have focus. // TapToContinue - the game is waiting for the player to provide input that they are ready to // proceed. // PleaseWait - the game is actively doing some background processing (like loading a level). // PlayAgain - the game has completed and is waiting for the player to indicate they are ready // to play another round of the game. #include "GameUIControl.h" ref class GameInfoOverlay : public Simple3DGameDX::IGameUIControl { internal: GameInfoOverlay(const std::shared_ptr<DX::DeviceResources>& deviceResources); void CreateDeviceDependentResources(); void CreateWindowSizeDependentResources(D2D_SIZE_F overlaySize); void ReleaseDeviceDependentResources(); bool Visible() { return m_visible; }; ID2D1Bitmap1* Bitmap(); public: // IGameUIControl interface virtual void SetGameLoading(uint32 dots); virtual void SetGameStats(int maxLevel, int hitCount, int shotCount); virtual void SetGameOver(bool win, int maxLevel, int hitCount, int shotCount, int highScore); virtual void SetLevelStart(int level, Platform::String^ objective, float timeLimit, float bonusTime); virtual void SetPause(int level, int hitCount, int shotCount, float timeRemaining); virtual void SetAction(Simple3DGameDX::GameInfoOverlayCommand action); virtual void HideGameInfoOverlay() { m_visible = false; }; virtual void ShowGameInfoOverlay() { m_visible = true; }; virtual void ShowTooSmall(); virtual void HideTooSmall(); private: // Cached pointer to device resources. std::shared_ptr<DX::DeviceResources> m_deviceResources; bool m_visible; bool m_tooSmallActive; D2D1_RECT_F m_titleRectangle; D2D1_RECT_F m_bodyRectangle; D2D1_RECT_F m_actionRectangle; Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_levelBitmap; Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_tooSmallBitmap; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormatTitle; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormatBody; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_textBrush; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_backgroundBrush; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_actionBrush; Platform::String^ m_titleString; Platform::String^ m_bodyString; Platform::String^ m_actionString; };
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_MSI_H #define _ASM_X86_MSI_H #include <asm/hw_irq.h> #include <asm/irqdomain.h> typedef struct irq_alloc_info msi_alloc_info_t; int pci_msi_prepare(struct irq_domain *domain, struct device *dev, int nvec, msi_alloc_info_t *arg); /* Structs and defines for the X86 specific MSI message format */ typedef struct x86_msi_data { u32 vector : 8, delivery_mode : 3, dest_mode_logical : 1, reserved : 2, active_low : 1, is_level : 1; u32 dmar_subhandle; } __attribute__ ((packed)) arch_msi_msg_data_t; #define arch_msi_msg_data x86_msi_data typedef struct x86_msi_addr_lo { union { struct { u32 reserved_0 : 2, dest_mode_logical : 1, redirect_hint : 1, reserved_1 : 1, virt_destid_8_14 : 7, destid_0_7 : 8, base_address : 12; }; struct { u32 dmar_reserved_0 : 2, dmar_index_15 : 1, dmar_subhandle_valid : 1, dmar_format : 1, dmar_index_0_14 : 15, dmar_base_address : 12; }; }; } __attribute__ ((packed)) arch_msi_msg_addr_lo_t; #define arch_msi_msg_addr_lo x86_msi_addr_lo #define X86_MSI_BASE_ADDRESS_LOW (0xfee00000 >> 20) typedef struct x86_msi_addr_hi { u32 reserved : 8, destid_8_31 : 24; } __attribute__ ((packed)) arch_msi_msg_addr_hi_t; #define arch_msi_msg_addr_hi x86_msi_addr_hi #define X86_MSI_BASE_ADDRESS_HIGH (0) struct msi_msg; u32 x86_msi_msg_get_destid(struct msi_msg *msg, bool extid); #endif /* _ASM_X86_MSI_H */
/* * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * 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 WTF_EnumClass_h #define WTF_EnumClass_h #include <wtf/Compiler.h> namespace WTF { // How to define a type safe enum list using the ENUM_CLASS macros? // =============================================================== // To get an enum list like this: // // enum class MyEnums { // Value1, // Value2, // ... // ValueN // }; // // ... write this: // // ENUM_CLASS(MyEnums) { // Value1, // Value2, // ... // ValueN // } ENUM_CLASS_END(MyEnums); // // The ENUM_CLASS macros will use C++11's enum class if the compiler supports it. // Otherwise, it will use the EnumClass template below. #if COMPILER_SUPPORTS(CXX_STRONG_ENUMS) #define ENUM_CLASS(__enumName) \ enum class __enumName #define ENUM_CLASS_END(__enumName) #else // !COMPILER_SUPPORTS(CXX_STRONG_ENUMS) // How to define a type safe enum list using the EnumClass template? // ================================================================ // Definition should be a struct that encapsulates an enum list. // The enum list should be names Enums. // // Here's an example of how to define a type safe enum named MyEnum using // the EnumClass template: // // struct MyEnumDefinition { // enum Enums { // ValueDefault, // Value1, // ... // ValueN // }; // }; // typedef EnumClass<MyEnumDefinition, MyEnumDefinition::ValueDefault> MyEnum; // // With that, you can now use MyEnum enum values as follow: // // MyEnum value1; // value1 is assigned MyEnum::ValueDefault by default. // MyEnum value2 = MyEnum::Value1; // value2 is assigned MyEnum::Value1; template <typename Definition> class EnumClass : public Definition { typedef enum Definition::Enums Value; public: ALWAYS_INLINE EnumClass() { } ALWAYS_INLINE EnumClass(Value value) : m_value(value) { } ALWAYS_INLINE Value value() const { return m_value; } ALWAYS_INLINE bool operator==(const EnumClass other) { return m_value == other.m_value; } ALWAYS_INLINE bool operator!=(const EnumClass other) { return m_value != other.m_value; } ALWAYS_INLINE bool operator<(const EnumClass other) { return m_value < other.m_value; } ALWAYS_INLINE bool operator<=(const EnumClass other) { return m_value <= other.m_value; } ALWAYS_INLINE bool operator>(const EnumClass other) { return m_value > other.m_value; } ALWAYS_INLINE bool operator>=(const EnumClass other) { return m_value >= other.m_value; } ALWAYS_INLINE bool operator==(const Value value) { return m_value == value; } ALWAYS_INLINE bool operator!=(const Value value) { return m_value != value; } ALWAYS_INLINE bool operator<(const Value value) { return m_value < value; } ALWAYS_INLINE bool operator<=(const Value value) { return m_value <= value; } ALWAYS_INLINE bool operator>(const Value value) { return m_value > value; } ALWAYS_INLINE bool operator>=(const Value value) { return m_value >= value; } ALWAYS_INLINE operator Value() { return m_value; } private: Value m_value; }; #define ENUM_CLASS(__enumName) \ struct __enumName ## Definition { \ enum Enums #define ENUM_CLASS_END(__enumName) \ ; \ }; \ typedef EnumClass< __enumName ## Definition > __enumName #endif // !COMPILER_SUPPORTS(CXX_STRONG_ENUMS) } // namespace WTF #if !COMPILER_SUPPORTS(CXX_STRONG_ENUMS) using WTF::EnumClass; #endif #endif // WTF_EnumClass_h
/* Copyright 2016 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 THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_ #define THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_ #include "tensorflow/core/platform/types.h" namespace tensorflow { struct FileStatistics { // The length of the file or -1 if finding file length is not supported. int64 length = -1; // The last modified time in nanoseconds. int64 mtime_nsec = 0; // True if the file is a directory, otherwise false. bool is_directory = false; FileStatistics() {} FileStatistics(int64 length, int64 mtime_nsec, bool is_directory) : length(length), mtime_nsec(mtime_nsec), is_directory(is_directory) {} ~FileStatistics() {} }; } // namespace tensorflow #endif // THIRD_PARTY_TENSORFLOW_CORE_PLATFORM_FILE_STATISTICS_H_
/* * Hauppauge HD PVR USB driver - video 4 linux 2 interface * * Copyright (C) 2008 Janne Grunau (j@jannau.net) * * 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. * */ #include <linux/kernel.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/usb.h> #include <linux/mutex.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> #include "hdpvr.h" int hdpvr_config_call(struct hdpvr_device *dev, uint value, u8 valbuf) { int ret; char request_type = 0x38, snd_request = 0x01; mutex_lock(&dev->usbc_mutex); dev->usbc_buf[0] = valbuf; ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), snd_request, 0x00 | request_type, value, CTRL_DEFAULT_INDEX, dev->usbc_buf, 1, 10000); mutex_unlock(&dev->usbc_mutex); v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "config call request for value 0x%x returned %d\n", value, ret); return ret < 0 ? ret : 0; } int get_video_info(struct hdpvr_device *dev, struct hdpvr_video_info *vidinf) { int ret; vidinf->valid = false; mutex_lock(&dev->usbc_mutex); ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 0x81, 0x80 | 0x38, 0x1400, 0x0003, dev->usbc_buf, 5, 1000); #ifdef HDPVR_DEBUG if (hdpvr_debug & MSG_INFO) v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "get video info returned: %d, %5ph\n", ret, dev->usbc_buf); #endif mutex_unlock(&dev->usbc_mutex); if (ret < 0) return ret; vidinf->width = dev->usbc_buf[1] << 8 | dev->usbc_buf[0]; vidinf->height = dev->usbc_buf[3] << 8 | dev->usbc_buf[2]; vidinf->fps = dev->usbc_buf[4]; vidinf->valid = vidinf->width && vidinf->height && vidinf->fps; return 0; } int get_input_lines_info(struct hdpvr_device *dev) { int ret, lines; mutex_lock(&dev->usbc_mutex); ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 0x81, 0x80 | 0x38, 0x1800, 0x0003, dev->usbc_buf, 3, 1000); #ifdef HDPVR_DEBUG if (hdpvr_debug & MSG_INFO) v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "get input lines info returned: %d, %3ph\n", ret, dev->usbc_buf); #else (void)ret; /* suppress compiler warning */ #endif lines = dev->usbc_buf[1] << 8 | dev->usbc_buf[0]; mutex_unlock(&dev->usbc_mutex); return lines; } int hdpvr_set_bitrate(struct hdpvr_device *dev) { int ret; mutex_lock(&dev->usbc_mutex); memset(dev->usbc_buf, 0, 4); dev->usbc_buf[0] = dev->options.bitrate; dev->usbc_buf[2] = dev->options.peak_bitrate; ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 0x01, 0x38, CTRL_BITRATE_VALUE, CTRL_DEFAULT_INDEX, dev->usbc_buf, 4, 1000); mutex_unlock(&dev->usbc_mutex); return ret; } int hdpvr_set_audio(struct hdpvr_device *dev, u8 input, enum v4l2_mpeg_audio_encoding codec) { int ret = 0; if (dev->flags & HDPVR_FLAG_AC3_CAP) { mutex_lock(&dev->usbc_mutex); memset(dev->usbc_buf, 0, 2); dev->usbc_buf[0] = input; if (codec == V4L2_MPEG_AUDIO_ENCODING_AAC) dev->usbc_buf[1] = 0; else if (codec == V4L2_MPEG_AUDIO_ENCODING_AC3) dev->usbc_buf[1] = 1; else { mutex_unlock(&dev->usbc_mutex); v4l2_err(&dev->v4l2_dev, "invalid audio codec %d\n", codec); ret = -EINVAL; goto error; } ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 0x01, 0x38, CTRL_AUDIO_INPUT_VALUE, CTRL_DEFAULT_INDEX, dev->usbc_buf, 2, 1000); mutex_unlock(&dev->usbc_mutex); if (ret == 2) ret = 0; } else ret = hdpvr_config_call(dev, CTRL_AUDIO_INPUT_VALUE, input); error: return ret; } int hdpvr_set_options(struct hdpvr_device *dev) { hdpvr_config_call(dev, CTRL_VIDEO_STD_TYPE, dev->options.video_std); hdpvr_config_call(dev, CTRL_VIDEO_INPUT_VALUE, dev->options.video_input+1); hdpvr_set_audio(dev, dev->options.audio_input+1, dev->options.audio_codec); hdpvr_set_bitrate(dev); hdpvr_config_call(dev, CTRL_BITRATE_MODE_VALUE, dev->options.bitrate_mode); hdpvr_config_call(dev, CTRL_GOP_MODE_VALUE, dev->options.gop_mode); hdpvr_config_call(dev, CTRL_BRIGHTNESS, dev->options.brightness); hdpvr_config_call(dev, CTRL_CONTRAST, dev->options.contrast); hdpvr_config_call(dev, CTRL_HUE, dev->options.hue); hdpvr_config_call(dev, CTRL_SATURATION, dev->options.saturation); hdpvr_config_call(dev, CTRL_SHARPNESS, dev->options.sharpness); return 0; }
/** * \file * * \brief Instance description for PAC1 * * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page 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. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /* * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #ifndef _SAMD21_PAC1_INSTANCE_ #define _SAMD21_PAC1_INSTANCE_ /* ========== Register definition for PAC1 peripheral ========== */ #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) #define REG_PAC1_WPCLR (0x41000000U) /**< \brief (PAC1) Write Protection Clear */ #define REG_PAC1_WPSET (0x41000004U) /**< \brief (PAC1) Write Protection Set */ #else #define REG_PAC1_WPCLR (*(RwReg *)0x41000000U) /**< \brief (PAC1) Write Protection Clear */ #define REG_PAC1_WPSET (*(RwReg *)0x41000004U) /**< \brief (PAC1) Write Protection Set */ #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ /* ========== Instance parameters for PAC1 peripheral ========== */ #define PAC1_WPROT_DEFAULT_VAL 0x00000002 // PAC protection mask at reset #endif /* _SAMD21_PAC1_INSTANCE_ */
/* * YAFFS: Yet another Flash File System . A NAND-flash specific file system. * * Copyright (C) 2002-2010 Aleph One Ltd. * for Toby Churchill Ltd and Brightstar Engineering * * Created by Charles Manning <charles@aleph1.co.uk> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 2.1 as * published by the Free Software Foundation. * * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ #ifndef __YAFFS_TAGS_VALIDITY_H__ #define __YAFFS_TAGS_VALIDITY_H__ #include "yaffs_guts.h" void yaffs_init_tags(yaffs_ext_tags *tags); int yaffs_validate_tags(yaffs_ext_tags *tags); #endif
/* This file is part of tgl-library 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 Copyright Ben Wiederhake 2015 */ #include "../config.h" #ifdef TGL_AVOID_OPENSSL /* Fail-fast when something becomes deprecated. */ #define GCRYPT_NO_DEPRECATED #include <assert.h> #include <gcrypt.h> #include "bn.h" #include "meta.h" // There is no "_ctx" equivalent in gcrypt. TGLC_WRAPPER_ASSOC(bn_ctx,int) TGLC_WRAPPER_ASSOC(bn,struct gcry_mpi) TGLC_bn_ctx *TGLC_bn_ctx_new (void) { /* Must not be the null pointer, but must never be dereferenced. Assume that "1" is an invalid address. */ return ((void *)1); } void TGLC_bn_ctx_free (TGLC_bn_ctx* ctx) { (void) ctx; } TGLC_bn *TGLC_bn_new (void) { // TODO: Determine how many bits should be pre-allocated. TGLC_bn *ret = wrap_bn (gcry_mpi_new (2048)); assert (ret); return ret; } void TGLC_bn_free (TGLC_bn *a) { gcry_mpi_release (unwrap_bn (a)); } void TGLC_bn_clear_free (TGLC_bn *a) { /* This only protects against accidental use-after-free. I don't see the point of clearing, since we're not operating in protected memory AND the most crucial fields are never cleared anyway. */ gcry_mpi_set_ui (unwrap_bn (a), 0); gcry_mpi_release (unwrap_bn (a)); } int TGLC_bn_cmp (const TGLC_bn *a, const TGLC_bn *b) { return gcry_mpi_cmp (unwrap_bn (a), unwrap_bn (b)); } int TGLC_bn_is_prime (const TGLC_bn *a, int checks, void (*callback) (int, int, void *), TGLC_bn_ctx *ctx, void *cb_arg) { assert (0 == checks); assert (NULL == callback); (void) ctx; assert (NULL == cb_arg); /* Second argument is ignored. * No really, here's what libgcrypt's source does: * (void)flags; */ gcry_error_t err = gcry_prime_check (unwrap_bn (a), 0); /* This is nasty. In essence, gcry returns a bool whether it is NOT a prime. */ return !err; } int TGLC_bn_bn2bin (const TGLC_bn *a, unsigned char *to) { const unsigned long num_bytes = TGLC_bn_num_bytes (a); gcry_error_t gcry_error = gcry_mpi_print (GCRYMPI_FMT_USG, to, num_bytes, NULL, unwrap_bn (a)); assert (!gcry_error); return num_bytes; } TGLC_bn *TGLC_bn_bin2bn(const unsigned char *s, int len, TGLC_bn *ret) { gcry_mpi_t ret_ptr = NULL; gcry_error_t gcry_error = gcry_mpi_scan (&ret_ptr, GCRYMPI_FMT_USG, s, len, NULL); assert (!gcry_error); assert (ret_ptr); if (!ret) { return wrap_bn (ret_ptr); } gcry_mpi_snatch (unwrap_bn (ret), ret_ptr); return ret; } int TGLC_bn_set_word (TGLC_bn *a, unsigned long w) { assert (a); gcry_mpi_set_ui (unwrap_bn (a), w); return 1; } unsigned long TGLC_bn_get_word (const TGLC_bn *a) { const unsigned long num_bytes = TGLC_bn_num_bytes (a); assert (sizeof (unsigned long) >= num_bytes); unsigned char tmp[sizeof (unsigned long)]; memset (tmp, 0, sizeof (unsigned long)); TGLC_bn_bn2bin (a, tmp + sizeof (unsigned long) - num_bytes); /* Inefficient, but runs a total of three times per connection. */ /* TODO: Optimize? */ unsigned long ret = 0; unsigned int i; for (i = 0; i < sizeof (unsigned long); ++i) { ret <<= 8; ret |= tmp[i]; } return ret; } int TGLC_bn_num_bits (const TGLC_bn *a) { return gcry_mpi_get_nbits (unwrap_bn (a)); } void TGLC_bn_sub (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *b) { gcry_mpi_sub (unwrap_bn (r), unwrap_bn (a), unwrap_bn (b)); } int TGLC_bn_div (TGLC_bn *dv, TGLC_bn *rem, const TGLC_bn *a, const TGLC_bn *d, TGLC_bn_ctx *ctx) { (void) ctx; gcry_mpi_div (unwrap_bn (dv), unwrap_bn (rem), unwrap_bn (a), unwrap_bn (d), 0); return 1; } int TGLC_bn_mod_exp (TGLC_bn *r, const TGLC_bn *a, const TGLC_bn *p, const TGLC_bn *m, TGLC_bn_ctx *ctx) { (void) ctx; gcry_mpi_powm (unwrap_bn (r), unwrap_bn (a), unwrap_bn (p), unwrap_bn (m)); return 1; } #endif
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_CORBA_DynAn_gnuDynStruct__ #define __gnu_CORBA_DynAn_gnuDynStruct__ #pragma interface #include <gnu/CORBA/DynAn/RecordAny.h> #include <gcj/array.h> extern "Java" { namespace gnu { namespace CORBA { namespace DynAn { class RecordAny; class gnuDynAnyFactory; class gnuDynStruct; } } } namespace org { namespace omg { namespace CORBA { class ORB; class TypeCode; } namespace DynamicAny { class NameDynAnyPair; class NameValuePair; } } } } class gnu::CORBA::DynAn::gnuDynStruct : public ::gnu::CORBA::DynAn::RecordAny { public: gnuDynStruct(::org::omg::CORBA::TypeCode *, ::org::omg::CORBA::TypeCode *, ::gnu::CORBA::DynAn::gnuDynAnyFactory *, ::org::omg::CORBA::ORB *); public: // actually protected virtual ::gnu::CORBA::DynAn::RecordAny * newInstance(::org::omg::CORBA::TypeCode *, ::org::omg::CORBA::TypeCode *, ::gnu::CORBA::DynAn::gnuDynAnyFactory *, ::org::omg::CORBA::ORB *); public: virtual JArray< ::org::omg::DynamicAny::NameDynAnyPair * > * get_members_as_dyn_any(); virtual JArray< ::org::omg::DynamicAny::NameValuePair * > * get_members(); private: static const jlong serialVersionUID = 1LL; public: static ::java::lang::Class class$; }; #endif // __gnu_CORBA_DynAn_gnuDynStruct__
#import <UIKit/UIKit.h> @class RootViewController; @interface AppController : NSObject <UIApplicationDelegate> { UIWindow *window; RootViewController *viewController; } @end
#define XSTORMY16_ASHLSI3 #include "lib2funcs.c"
/* * netup-init.c * * NetUP Dual DVB-S2 CI driver * * Copyright (C) 2009 NetUP Inc. * Copyright (C) 2009 Igor M. Liplianin <liplianin@netup.ru> * Copyright (C) 2009 Abylay Ospan <aospan@netup.ru> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "cx23885.h" static void i2c_av_write(struct i2c_adapter *i2c, u16 reg, u8 val) { int ret; u8 buf[3]; struct i2c_msg msg = { .addr = 0x88 >> 1, .flags = 0, .buf = buf, .len = 3 }; buf[0] = reg >> 8; buf[1] = reg & 0xff; buf[2] = val; ret = i2c_transfer(i2c, &msg, 1); if (ret != 1) printk(KERN_ERR "%s: i2c write error!\n", __func__); } static void i2c_av_write4(struct i2c_adapter *i2c, u16 reg, u32 val) { int ret; u8 buf[6]; struct i2c_msg msg = { .addr = 0x88 >> 1, .flags = 0, .buf = buf, .len = 6 }; buf[0] = reg >> 8; buf[1] = reg & 0xff; buf[2] = val & 0xff; buf[3] = (val >> 8) & 0xff; buf[4] = (val >> 16) & 0xff; buf[5] = val >> 24; ret = i2c_transfer(i2c, &msg, 1); if (ret != 1) printk(KERN_ERR "%s: i2c write error!\n", __func__); } static u8 i2c_av_read(struct i2c_adapter *i2c, u16 reg) { int ret; u8 buf[2]; struct i2c_msg msg = { .addr = 0x88 >> 1, .flags = 0, .buf = buf, .len = 2 }; buf[0] = reg >> 8; buf[1] = reg & 0xff; ret = i2c_transfer(i2c, &msg, 1); if (ret != 1) printk(KERN_ERR "%s: i2c write error!\n", __func__); msg.flags = I2C_M_RD; msg.len = 1; ret = i2c_transfer(i2c, &msg, 1); if (ret != 1) printk(KERN_ERR "%s: i2c read error!\n", __func__); return buf[0]; } static void i2c_av_and_or(struct i2c_adapter *i2c, u16 reg, unsigned and_mask, u8 or_value) { i2c_av_write(i2c, reg, (i2c_av_read(i2c, reg) & and_mask) | or_value); } /* set 27MHz on AUX_CLK */ void netup_initialize(struct cx23885_dev *dev) { struct cx23885_i2c *i2c_bus = &dev->i2c_bus[2]; struct i2c_adapter *i2c = &i2c_bus->i2c_adap; /* Stop microcontroller */ i2c_av_and_or(i2c, 0x803, ~0x10, 0x00); /* Aux PLL frac for 27 MHz */ i2c_av_write4(i2c, 0x114, 0xea0eb3); /* Aux PLL int for 27 MHz */ i2c_av_write4(i2c, 0x110, 0x090319); /* start microcontroller */ i2c_av_and_or(i2c, 0x803, ~0x10, 0x10); }
/* * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> * JZ4740 platform IRQ support * * 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include <linux/errno.h> #include <linux/init.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/irqchip/ingenic.h> #include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/timex.h> #include <linux/slab.h> #include <linux/delay.h> #include <asm/io.h> #include <asm/mach-jz4740/irq.h> #include "irqchip.h" struct ingenic_intc_data { void __iomem *base; unsigned num_chips; }; #define JZ_REG_INTC_STATUS 0x00 #define JZ_REG_INTC_MASK 0x04 #define JZ_REG_INTC_SET_MASK 0x08 #define JZ_REG_INTC_CLEAR_MASK 0x0c #define JZ_REG_INTC_PENDING 0x10 #define CHIP_SIZE 0x20 static irqreturn_t intc_cascade(int irq, void *data) { struct ingenic_intc_data *intc = irq_get_handler_data(irq); uint32_t irq_reg; unsigned i; for (i = 0; i < intc->num_chips; i++) { irq_reg = readl(intc->base + (i * CHIP_SIZE) + JZ_REG_INTC_PENDING); if (!irq_reg) continue; generic_handle_irq(__fls(irq_reg) + (i * 32) + JZ4740_IRQ_BASE); } return IRQ_HANDLED; } static void intc_irq_set_mask(struct irq_chip_generic *gc, uint32_t mask) { struct irq_chip_regs *regs = &gc->chip_types->regs; writel(mask, gc->reg_base + regs->enable); writel(~mask, gc->reg_base + regs->disable); } void ingenic_intc_irq_suspend(struct irq_data *data) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); intc_irq_set_mask(gc, gc->wake_active); } void ingenic_intc_irq_resume(struct irq_data *data) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); intc_irq_set_mask(gc, gc->mask_cache); } static struct irqaction intc_cascade_action = { .handler = intc_cascade, .name = "SoC intc cascade interrupt", }; static int __init ingenic_intc_of_init(struct device_node *node, unsigned num_chips) { struct ingenic_intc_data *intc; struct irq_chip_generic *gc; struct irq_chip_type *ct; struct irq_domain *domain; int parent_irq, err = 0; unsigned i; intc = kzalloc(sizeof(*intc), GFP_KERNEL); if (!intc) { err = -ENOMEM; goto out_err; } parent_irq = irq_of_parse_and_map(node, 0); if (!parent_irq) { err = -EINVAL; goto out_free; } err = irq_set_handler_data(parent_irq, intc); if (err) goto out_unmap_irq; intc->num_chips = num_chips; intc->base = of_iomap(node, 0); if (!intc->base) { err = -ENODEV; goto out_unmap_irq; } for (i = 0; i < num_chips; i++) { /* Mask all irqs */ writel(0xffffffff, intc->base + (i * CHIP_SIZE) + JZ_REG_INTC_SET_MASK); gc = irq_alloc_generic_chip("INTC", 1, JZ4740_IRQ_BASE + (i * 32), intc->base + (i * CHIP_SIZE), handle_level_irq); gc->wake_enabled = IRQ_MSK(32); ct = gc->chip_types; ct->regs.enable = JZ_REG_INTC_CLEAR_MASK; ct->regs.disable = JZ_REG_INTC_SET_MASK; ct->chip.irq_unmask = irq_gc_unmask_enable_reg; ct->chip.irq_mask = irq_gc_mask_disable_reg; ct->chip.irq_mask_ack = irq_gc_mask_disable_reg; ct->chip.irq_set_wake = irq_gc_set_wake; ct->chip.irq_suspend = ingenic_intc_irq_suspend; ct->chip.irq_resume = ingenic_intc_irq_resume; irq_setup_generic_chip(gc, IRQ_MSK(32), 0, 0, IRQ_NOPROBE | IRQ_LEVEL); } domain = irq_domain_add_legacy(node, num_chips * 32, JZ4740_IRQ_BASE, 0, &irq_domain_simple_ops, NULL); if (!domain) pr_warn("unable to register IRQ domain\n"); setup_irq(parent_irq, &intc_cascade_action); return 0; out_unmap_irq: irq_dispose_mapping(parent_irq); out_free: kfree(intc); out_err: return err; } static int __init intc_1chip_of_init(struct device_node *node, struct device_node *parent) { return ingenic_intc_of_init(node, 1); } IRQCHIP_DECLARE(jz4740_intc, "ingenic,jz4740-intc", intc_1chip_of_init); static int __init intc_2chip_of_init(struct device_node *node, struct device_node *parent) { return ingenic_intc_of_init(node, 2); } IRQCHIP_DECLARE(jz4770_intc, "ingenic,jz4770-intc", intc_2chip_of_init); IRQCHIP_DECLARE(jz4775_intc, "ingenic,jz4775-intc", intc_2chip_of_init); IRQCHIP_DECLARE(jz4780_intc, "ingenic,jz4780-intc", intc_2chip_of_init);
#ifndef _ASMPPC_SIGNAL_H #define _ASMPPC_SIGNAL_H #include <linux/types.h> /* Avoid too many header ordering problems. */ struct siginfo; /* Most things should be clean enough to redefine this at will, if care is taken to make libc match. */ #define _NSIG 64 #define _NSIG_BPW 32 #define _NSIG_WORDS (_NSIG / _NSIG_BPW) typedef unsigned long old_sigset_t; /* at least 32 bits */ typedef struct { unsigned long sig[_NSIG_WORDS]; } sigset_t; #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 #define SIGILL 4 #define SIGTRAP 5 #define SIGABRT 6 #define SIGIOT 6 #define SIGBUS 7 #define SIGFPE 8 #define SIGKILL 9 #define SIGUSR1 10 #define SIGSEGV 11 #define SIGUSR2 12 #define SIGPIPE 13 #define SIGALRM 14 #define SIGTERM 15 #define SIGSTKFLT 16 #define SIGCHLD 17 #define SIGCONT 18 #define SIGSTOP 19 #define SIGTSTP 20 #define SIGTTIN 21 #define SIGTTOU 22 #define SIGURG 23 #define SIGXCPU 24 #define SIGXFSZ 25 #define SIGVTALRM 26 #define SIGPROF 27 #define SIGWINCH 28 #define SIGIO 29 #define SIGPOLL SIGIO /* #define SIGLOST 29 */ #define SIGPWR 30 #define SIGSYS 31 #define SIGUNUSED 31 /* These should not be considered constants from userland. */ #define SIGRTMIN 32 #define SIGRTMAX (_NSIG-1) /* * SA_FLAGS values: * * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. * SA_RESETHAND clears the handler when the signal is delivered. * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. * SA_NODEFER prevents the current signal from being masked in the handler. * * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single * Unix names RESETHAND and NODEFER respectively. */ #define SA_NOCLDSTOP 0x00000001 #define SA_NOCLDWAIT 0x00000002 /* not supported yet */ #define SA_SIGINFO 0x00000004 #define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 #define SA_NODEFER 0x40000000 #define SA_RESETHAND 0x80000000 #define SA_NOMASK SA_NODEFER #define SA_ONESHOT SA_RESETHAND #define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ #define SA_RESTORER 0x04000000 /* * sigaltstack controls */ #define SS_ONSTACK 1 #define SS_DISABLE 2 #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 #ifdef __KERNEL__ /* * These values of sa_flags are used only by the kernel as part of the * irq handling routines. * * SA_INTERRUPT is also used by the irq handling routines. * SA_SHIRQ is for shared interrupt support on PCI and EISA. */ #define SA_PROBE SA_ONESHOT #define SA_SAMPLE_RANDOM SA_RESTART #define SA_SHIRQ 0x04000000 #endif #define SIG_BLOCK 0 /* for blocking signals */ #define SIG_UNBLOCK 1 /* for unblocking signals */ #define SIG_SETMASK 2 /* for setting the signal mask */ /* Type of a signal handler. */ typedef void (*__sighandler_t)(int); #define SIG_DFL ((__sighandler_t)0) /* default signal handling */ #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; void (*sa_restorer)(void); sigset_t sa_mask; /* mask last for extensibility */ }; struct k_sigaction { struct sigaction sa; }; typedef struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } stack_t; #ifdef __KERNEL__ #include <asm/sigcontext.h> #endif #endif