text
stringlengths
4
6.14k
/** * @file * * Create outline and references for Memory Component mainpage documentation. * * Design guides, maintenance guides, and general documentation, are * collected using this file onto the documentation mainpage. * This file contains doxygen comment blocks, only. * * @xrefitem bom "File Content Label" "Release Content" * @e project: AGESA * @e sub-project: Documentation * @e \$Revision: 44323 $ @e \$Date: 2010-12-22 01:24:58 -0700 (Wed, 22 Dec 2010) $ * */ /* ****************************************************************************** * * Copyright (c) 2011, Advanced Micro Devices, 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: * * 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 Advanced Micro Devices, Inc. nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. 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. * ****************************************************************************** */ /** * @page memmain Memory Component Documentation * * Additional documentation for the Memory component consists of * * - Maintenance Guides: * - add here >>> * - Design Guides: * - add here >>> * */
#include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/types.h> #include <linux/wait.h> #include <linux/slab.h> #include <linux/fs.h> #include <linux/sched.h> #include <linux/poll.h> #include <linux/device.h> #include <linux/interrupt.h> #include <linux/delay.h> #include <linux/platform_device.h> #include <linux/cdev.h> #include <linux/errno.h> #include <linux/time.h> #include <asm/io.h> #include <asm/uaccess.h> #include "kd_camera_hw.h" #include <cust_gpio_usage.h> #include <linux/hrtimer.h> #include <linux/ktime.h> #include <linux/xlog.h> #include <linux/version.h> #ifdef CONFIG_COMPAT #include <linux/fs.h> #include <linux/compat.h> #endif #include "kd_flashlight.h" /****************************************************************************** * Debug configuration ******************************************************************************/ // availible parameter // ANDROID_LOG_ASSERT // ANDROID_LOG_ERROR // ANDROID_LOG_WARNING // ANDROID_LOG_INFO // ANDROID_LOG_DEBUG // ANDROID_LOG_VERBOSE #define TAG_NAME "leds_strobe.c" #define PK_DBG_NONE(fmt, arg...) do {} while (0) #define PK_DBG_FUNC(fmt, arg...) xlog_printk(ANDROID_LOG_DEBUG , TAG_NAME, KERN_INFO "%s: " fmt, __FUNCTION__ ,##arg) #define PK_WARN(fmt, arg...) xlog_printk(ANDROID_LOG_WARNING, TAG_NAME, KERN_WARNING "%s: " fmt, __FUNCTION__ ,##arg) #define PK_NOTICE(fmt, arg...) xlog_printk(ANDROID_LOG_DEBUG , TAG_NAME, KERN_NOTICE "%s: " fmt, __FUNCTION__ ,##arg) #define PK_INFO(fmt, arg...) xlog_printk(ANDROID_LOG_INFO , TAG_NAME, KERN_INFO "%s: " fmt, __FUNCTION__ ,##arg) #define PK_TRC_FUNC(f) xlog_printk(ANDROID_LOG_DEBUG , TAG_NAME, "<%s>\n", __FUNCTION__); #define PK_TRC_VERBOSE(fmt, arg...) xlog_printk(ANDROID_LOG_VERBOSE, TAG_NAME, fmt, ##arg) #define PK_ERROR(fmt, arg...) xlog_printk(ANDROID_LOG_ERROR , TAG_NAME, KERN_ERR "%s: " fmt, __FUNCTION__ ,##arg) #define DEBUG_LEDS_STROBE #ifdef DEBUG_LEDS_STROBE #define PK_DBG PK_DBG_FUNC #define PK_VER PK_TRC_VERBOSE #define PK_ERR PK_ERROR #else #define PK_DBG(a,...) #define PK_VER(a,...) #define PK_ERR(a,...) #endif static int strobe_ioctl(unsigned int cmd, unsigned long arg) { PK_DBG("sub dummy ioctl"); return 0; } static int strobe_open(void *pArg) { PK_DBG("sub dummy open"); return 0; } static int strobe_release(void *pArg) { PK_DBG("sub dummy release"); return 0; } static FLASHLIGHT_FUNCTION_STRUCT strobeFunc= { strobe_open, strobe_release, strobe_ioctl }; MUINT32 strobeInit_sub_sid1_part2(PFLASHLIGHT_FUNCTION_STRUCT *pfFunc) { if (pfFunc != NULL) { *pfFunc = &strobeFunc; } return 0; }
/* * Copyright (C) 2015 HAW Hamburg * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. */ /** * @ingroup cpu_atmega2560 * @{ * * @file * @brief CPU specific definitions for internal peripheral handling * * @author René Herthel <rene-herthel@outlook.de> */ #ifndef PERIPH_CPU_H_ #define PERIPH_CPU_H_ #include "periph/dev_enums.h" #include <avr/io.h> #ifdef __cplusplus extern "C" { #endif /** * @brief Define a CPU specific GPIO pin generator macro */ #define GPIO(x, y) ((x << 4) | y) /** * @brief Available ports on the ATmega2560 family */ enum { PORT_A = 0, /**< port A */ PORT_B = 1, /**< port B */ PORT_C = 2, /**< port C */ PORT_D = 3, /**< port D */ PORT_E = 4, /**< port E */ PORT_F = 5, /**< port F */ PORT_G = 6, /**< port G */ PORT_H = 7, /**< port H */ PORT_J = 8, /**< port J */ PORT_K = 9, /**< port K */ PORT_L = 10 /**< port L */ }; #ifdef __cplusplus } #endif #endif /* PERIPH_CPU_H_ */ /** @} */
/* OS/2 compatibility functions. Copyright (C) 2001-2002 Free Software Foundation, Inc. This program 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, 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define OS2_AWARE #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdlib.h> #include <string.h> #include <sys/param.h> /* A version of getenv() that works from DLLs */ extern unsigned long DosScanEnv (const unsigned char *pszName, unsigned char **ppszValue); char * _nl_getenv (const char *name) { unsigned char *value; if (DosScanEnv (name, &value)) return NULL; else return value; } /* A fixed size buffer. */ char _nl_default_dirname__[MAXPATHLEN+1]; char *_nlos2_libdir = NULL; char *_nlos2_localealiaspath = NULL; char *_nlos2_localedir = NULL; static __attribute__((constructor)) void nlos2_initialize () { char *root = getenv ("UNIXROOT"); char *gnulocaledir = getenv ("GNULOCALEDIR"); _nlos2_libdir = gnulocaledir; if (!_nlos2_libdir) { if (root) { size_t sl = strlen (root); _nlos2_libdir = (char *) malloc (sl + strlen (LIBDIR) + 1); memcpy (_nlos2_libdir, root, sl); memcpy (_nlos2_libdir + sl, LIBDIR, strlen (LIBDIR) + 1); } else _nlos2_libdir = LIBDIR; } _nlos2_localealiaspath = gnulocaledir; if (!_nlos2_localealiaspath) { if (root) { size_t sl = strlen (root); _nlos2_localealiaspath = (char *) malloc (sl + strlen (LOCALE_ALIAS_PATH) + 1); memcpy (_nlos2_localealiaspath, root, sl); memcpy (_nlos2_localealiaspath + sl, LOCALE_ALIAS_PATH, strlen (LOCALE_ALIAS_PATH) + 1); } else _nlos2_localealiaspath = LOCALE_ALIAS_PATH; } _nlos2_localedir = gnulocaledir; if (!_nlos2_localedir) { if (root) { size_t sl = strlen (root); _nlos2_localedir = (char *) malloc (sl + strlen (LOCALEDIR) + 1); memcpy (_nlos2_localedir, root, sl); memcpy (_nlos2_localedir + sl, LOCALEDIR, strlen (LOCALEDIR) + 1); } else _nlos2_localedir = LOCALEDIR; } if (strlen (_nlos2_localedir) <= MAXPATHLEN) strcpy (_nl_default_dirname__, _nlos2_localedir); }
/* * hi6421_pwrkey.c - Hisilicon Hi6421 PMIC ONKEY driver * * Copyright (C) 2013 Hisilicon Ltd. * Copyright (C) 2013 Linaro Ltd. * Author: Haojian Zhuang <haojian.zhuang@linaro.org> * * This file is subject to the terms and conditions of the GNU General * Public License. See the file "COPYING" in the main directory of this * archive for more details. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/of_irq.h> #include <linux/platform_device.h> #include <linux/input.h> #include <linux/interrupt.h> #include <linux/mfd/hi6421-pmic.h> struct hi6421_onkey_info { struct input_dev *idev; int irq[4]; }; static irqreturn_t hi6421_onkey_handler(int irq, void *data) { struct hi6421_onkey_info *info = (struct hi6421_onkey_info *)data; /* only handle power down & power up event at here */ if (irq == info->irq[0]) { input_report_key(info->idev, KEY_POWER, 1); input_sync(info->idev); } else if (irq == info->irq[1]) { input_report_key(info->idev, KEY_POWER, 0); input_sync(info->idev); } return IRQ_HANDLED; } static int hi6421_onkey_probe(struct platform_device *pdev) { struct hi6421_onkey_info *info; struct device *dev = &pdev->dev; int ret; info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; info->idev = input_allocate_device(); if (!info->idev) { dev_err(&pdev->dev, "Failed to allocate input device\n"); return -ENOMEM; } info->idev->name = "hi6421_on"; info->idev->phys = "hi6421_on/input0"; info->idev->dev.parent = &pdev->dev; info->idev->evbit[0] = BIT_MASK(EV_KEY); __set_bit(KEY_POWER, info->idev->keybit); info->irq[0] = platform_get_irq_byname(pdev, "down"); if (info->irq[0] < 0) { ret = -ENOENT; goto err_irq0; } ret = request_irq(info->irq[0], hi6421_onkey_handler, IRQF_DISABLED, "down", info); if (ret < 0) goto err_irq0; info->irq[1] = platform_get_irq_byname(pdev, "up"); if (info->irq[1] < 0) { ret = -ENOENT; goto err_irq1; } ret = request_irq(info->irq[1], hi6421_onkey_handler, IRQF_DISABLED, "up", info); if (ret < 0) goto err_irq1; info->irq[2] = platform_get_irq_byname(pdev, "hold 1s"); if (info->irq[2] < 0) { ret = -ENOENT; goto err_irq2; } ret = request_irq(info->irq[2], hi6421_onkey_handler, IRQF_DISABLED, "hold 1s", info); if (ret < 0) goto err_irq2; info->irq[3] = platform_get_irq_byname(pdev, "hold 10s"); if (info->irq[3] < 0) { ret = -ENOENT; goto err_irq3; } ret = request_irq(info->irq[3], hi6421_onkey_handler, IRQF_DISABLED, "hold 10s", info); if (ret < 0) goto err_irq3; ret = input_register_device(info->idev); if (ret) { dev_err(&pdev->dev, "Can't register input device: %d\n", ret); goto err_reg; } platform_set_drvdata(pdev, info); return ret; err_reg: free_irq(info->irq[3], info); err_irq3: free_irq(info->irq[2], info); err_irq2: free_irq(info->irq[1], info); err_irq1: free_irq(info->irq[0], info); err_irq0: input_free_device(info->idev); return ret; } static int hi6421_onkey_remove(struct platform_device *pdev) { return 0; } static struct of_device_id hi6421_onkey_of_match[] = { { .compatible = "hisilicon,hi6421-onkey", }, { }, }; MODULE_DEVICE_TABLE(of, hi6421_onkey_of_match); static struct platform_driver hi6421_onkey_driver = { .probe = hi6421_onkey_probe, .remove = hi6421_onkey_remove, .driver = { .owner = THIS_MODULE, .name = "hi6421-onkey", .of_match_table = hi6421_onkey_of_match, }, }; module_platform_driver(hi6421_onkey_driver); MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@linaro.org"); MODULE_DESCRIPTION("Hi6421 PMIC Power key driver"); MODULE_LICENSE("GPL v2");
/****************************************************************************** * * (c) Copyright 2012 Xilinx, Inc. All rights reserved. * * This file contains confidential and proprietary information of Xilinx, Inc. * and is protected under U.S. and international copyright and other * intellectual property laws. * * DISCLAIMER * This disclaimer is not a license and does not grant any rights to the * materials distributed herewith. Except as otherwise provided in a valid * license issued to you by Xilinx, and to the maximum extent permitted by * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; * and (2) Xilinx shall not be liable (whether in contract or tort, including * negligence, or under any other theory of liability) for any loss or damage * of any kind or nature related to, arising under or in connection with these * materials, including for any direct, or any indirect, special, incidental, * or consequential loss or damage (including loss of data, profits, goodwill, * or any type of loss or damage suffered as a result of any action brought by * a third party) even if such damage or loss was reasonably foreseeable or * Xilinx had been advised of the possibility of the same. * * CRITICAL APPLICATIONS * Xilinx products are not designed or intended to be fail-safe, or for use in * any application requiring fail-safe performance, such as life-support or * safety devices or systems, Class III medical devices, nuclear facilities, * applications related to the deployment of airbags, or any other applications * that could lead to death, personal injury, or severe property or * environmental damage (individually and collectively, "Critical * Applications"). Customer assumes the sole risk and liability of any use of * Xilinx products in Critical Applications, subject only to applicable laws * and regulations governing limitations on product liability. * * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE * AT ALL TIMES. ******************************************************************************/ /*****************************************************************************/ /** * @file xil_mmu.h * * * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ---- -------- --------------------------------------------------- * 1.00a sdm 01/12/12 Initial version * </pre> * * @note * * None. * ******************************************************************************/ #ifndef XIL_MMU_H #define XIL_MMU_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /***************************** Include Files *********************************/ /***************** Macros (Inline Functions) Definitions *********************/ /**************************** Type Definitions *******************************/ /************************** Constant Definitions *****************************/ /************************** Variable Definitions *****************************/ /************************** Function Prototypes ******************************/ void Xil_SetTlbAttributes(u32 addr, u32 attrib); void Xil_EnableMMU(void); void Xil_DisableMMU(void); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* XIL_MMU_H */
#ifndef VC_LINK_H #define VC_LINK_H extern unsigned short vc_width, vc_height; extern unsigned short vc_cursor_x, vc_cursor_y; extern char *vc_buf; int open_vcs(void); int read_vcdata(void); #endif
#ifndef _LINUX_IRQDESC_H #define _LINUX_IRQDESC_H /* * Core internal functions to deal with irq descriptors * * This include will move to kernel/irq once we cleaned up the tree. * For now it's included from <linux/irq.h> */ struct irq_affinity_notify; struct proc_dir_entry; struct timer_rand_state; struct module; struct irq_desc; /** * struct irq_desc - interrupt descriptor * @irq_data: per irq and chip data passed down to chip functions * @timer_rand_state: pointer to timer rand state struct * @kstat_irqs: irq stats per cpu * @handle_irq: highlevel irq-events handler * @preflow_handler: handler called before the flow handler (currently used by sparc) * @action: the irq action chain * @status: status information * @core_internal_state__do_not_mess_with_it: core internal status information * @depth: disable-depth, for nested irq_disable() calls * @wake_depth: enable depth, for multiple irq_set_irq_wake() callers * @irq_count: stats field to detect stalled irqs * @last_unhandled: aging timer for unhandled count * @irqs_unhandled: stats field for spurious unhandled interrupts * @threads_handled: stats field for deferred spurious detection of threaded handlers * @threads_handled_last: comparator field for deferred spurious detection of theraded handlers * @lock: locking for SMP * @affinity_hint: hint to user space for preferred irq affinity * @affinity_notify: context for notification of affinity changes * @pending_mask: pending rebalanced interrupts * @threads_oneshot: bitfield to handle shared oneshot threads * @threads_active: number of irqaction threads currently running * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers * @dir: /proc/irq/ procfs entry * @name: flow handler name for /proc/interrupts output */ struct irq_desc { struct irq_data irq_data; unsigned int __percpu *kstat_irqs; irq_flow_handler_t handle_irq; #ifdef CONFIG_IRQ_PREFLOW_FASTEOI irq_preflow_handler_t preflow_handler; #endif struct irqaction *action; /* IRQ action list */ unsigned int status_use_accessors; unsigned int core_internal_state__do_not_mess_with_it; unsigned int depth; /* nested irq disables */ unsigned int wake_depth; /* nested wake enables */ unsigned int irq_count; /* For detecting broken IRQs */ unsigned long last_unhandled; /* Aging timer for unhandled count */ unsigned int irqs_unhandled; atomic_t threads_handled; int threads_handled_last; raw_spinlock_t lock; struct cpumask *percpu_enabled; #ifdef CONFIG_SMP const struct cpumask *affinity_hint; struct irq_affinity_notify *affinity_notify; #ifdef CONFIG_GENERIC_PENDING_IRQ cpumask_var_t pending_mask; #endif #endif unsigned long threads_oneshot; atomic_t threads_active; wait_queue_head_t wait_for_threads; #ifdef CONFIG_PROC_FS struct proc_dir_entry *dir; #endif int parent_irq; struct module *owner; const char *name; } ____cacheline_internodealigned_in_smp; #ifndef CONFIG_SPARSE_IRQ extern struct irq_desc irq_desc[NR_IRQS]; #endif #ifdef CONFIG_GENERIC_HARDIRQS static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc) { return &desc->irq_data; } static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) { return desc->irq_data.chip; } static inline void *irq_desc_get_chip_data(struct irq_desc *desc) { return desc->irq_data.chip_data; } static inline void *irq_desc_get_handler_data(struct irq_desc *desc) { return desc->irq_data.handler_data; } static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) { return desc->irq_data.msi_desc; } /* * Architectures call this to let the generic IRQ layer * handle an interrupt. If the descriptor is attached to an * irqchip-style controller then we call the ->handle_irq() handler, * and it calls __do_IRQ() if it's attached to an irqtype-style controller. */ static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) { desc->handle_irq(irq, desc); } int generic_handle_irq(unsigned int irq); /* Test to see if a driver has successfully requested an irq */ static inline int irq_has_action(unsigned int irq) { struct irq_desc *desc = irq_to_desc(irq); return desc->action != NULL; } /* caller has locked the irq_desc and both params are valid */ static inline void __irq_set_handler_locked(unsigned int irq, irq_flow_handler_t handler) { struct irq_desc *desc; desc = irq_to_desc(irq); desc->handle_irq = handler; } /* caller has locked the irq_desc and both params are valid */ static inline void __irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip, irq_flow_handler_t handler, const char *name) { struct irq_desc *desc; desc = irq_to_desc(irq); irq_desc_get_irq_data(desc)->chip = chip; desc->handle_irq = handler; desc->name = name; } static inline int irq_balancing_disabled(unsigned int irq) { struct irq_desc *desc; desc = irq_to_desc(irq); return desc->status_use_accessors & IRQ_NO_BALANCING_MASK; } static inline int irq_is_per_cpu(unsigned int irq) { struct irq_desc *desc; desc = irq_to_desc(irq); return desc->status_use_accessors & IRQ_PER_CPU; } static inline void irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class) { struct irq_desc *desc = irq_to_desc(irq); if (desc) lockdep_set_class(&desc->lock, class); } #ifdef CONFIG_IRQ_PREFLOW_FASTEOI static inline void __irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler) { struct irq_desc *desc; desc = irq_to_desc(irq); desc->preflow_handler = handler; } #endif #endif #endif
#pragma once /* * Copyright (C) 2011-2012 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "IHTTPRequestHandler.h" #include "interfaces/json-rpc/IClient.h" class CHTTPJsonRpcHandler : public IHTTPRequestHandler { public: CHTTPJsonRpcHandler() { }; virtual IHTTPRequestHandler* GetInstance() { return new CHTTPJsonRpcHandler(); } virtual bool CheckHTTPRequest(const HTTPRequest &request); virtual int HandleHTTPRequest(const HTTPRequest &request); virtual void* GetHTTPResponseData() const { return (void *)m_response.c_str(); }; virtual size_t GetHTTPResonseDataLength() const { return m_response.size(); } virtual int GetPriority() const { return 2; } protected: #if (MHD_VERSION >= 0x00040001) virtual bool appendPostData(const char *data, size_t size); #else virtual bool appendPostData(const char *data, unsigned int size); #endif private: std::string m_request; std::string m_response; class CHTTPClient : public JSONRPC::IClient { public: virtual int GetPermissionFlags(); virtual int GetAnnouncementFlags(); virtual bool SetAnnouncementFlags(int flags); }; };
/** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * 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/>. * */ /** * Melzi with ATmega1284 (MaKr3d version) pin assignments */ #undef MOTHERBOARD #define MOTHERBOARD BOARD_MELZI #define SANGUINOLOLU_V_1_2 #if defined(__AVR_ATmega1284P__) #define LARGE_FLASH true #endif #include "pins_SANGUINOLOLU_11.h"
#pragma once #include "RC_parser.h" #include "RCInput.h" // helper class with PPM/SBUS parsers to localize all internal data class F4Light::PPM_parser : public F4Light::_parser { public: PPM_parser() : _ch(0) , last_pulse({0,0}) , _got_ppm(false) , _got_dsm(false) , _was_ppm(false) , _was_dsm(false) , _rc_mode(BOARD_RC_NONE) {} void init(uint8_t ch); struct SbusState { uint16_t bytes[25]; // including start bit, parity and stop bits uint16_t bit_ofs; BOARD_RC_MODE mode; }; protected: void parse_pulses(void); void start_ioc(void); private: void rxIntRC(uint16_t value0, uint16_t value1, bool state); bool _process_ppmsum_pulse(uint16_t value); void _process_dsm_pulse(uint16_t width_s0, uint16_t width_s1); void _process_sbus_pulse(uint16_t width_s0, uint16_t width_s1, struct PPM_parser::SbusState &state); void add_dsm_input(); // add some DSM input bytes, for RCInput over a PPMSUM line void add_sbus_input(); // add some SBUS input bytes, for RCInput over a PPMSUM line uint8_t _ch; Pulse last_pulse; uint8_t channel_ctr; bool _got_ppm; bool _got_dsm; bool _was_ppm; bool _was_dsm; // state of add_dsm_input struct DSM { uint8_t frame[16]; uint8_t partial_frame_count; uint64_t last_input_ms; } dsm; // state of add_sbus_input struct SBUS { uint8_t frame[26]; uint8_t partial_frame_count; uint32_t last_input_ms; } sbus; // state of SBUS bit decoder struct SbusState sbus_state[2]; // state of DSM bit decoder struct DSM_State { uint16_t bytes[16]; // including start bit and stop bit uint16_t bit_ofs; } dsm_state; enum BOARD_RC_MODE _rc_mode; uint8_t _ioc; };
#ifndef IVE_MULTITEXTYRECONTROL #define IVE_MULTITEXTYRECONTROL 1 #include <osgFX/MultiTextureControl> #include "ReadWrite.h" namespace ive{ class MultiTextureControl : public osgFX::MultiTextureControl { public: void write(DataOutputStream* out); void read(DataInputStream* in); }; } #endif
// Copyright 2013 The Flutter 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 FLUTTER_LIB_UI_PAINTING_RRECT_H_ #define FLUTTER_LIB_UI_PAINTING_RRECT_H_ #include "third_party/dart/runtime/include/dart_api.h" #include "third_party/skia/include/core/SkRRect.h" #include "third_party/tonic/converter/dart_converter.h" namespace flutter { class RRect { public: SkRRect sk_rrect; bool is_null; }; } // namespace flutter namespace tonic { template <> struct DartConverter<flutter::RRect> { static flutter::RRect FromDart(Dart_Handle handle); static flutter::RRect FromArguments(Dart_NativeArguments args, int index, Dart_Handle& exception); }; } // namespace tonic #endif // FLUTTER_LIB_UI_PAINTING_RRECT_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_BROWSER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ #define CHROME_BROWSER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_ #include <map> #include <vector> #include "base/basictypes.h" #include "base/memory/singleton.h" #include "chrome/browser/task_manager/resource_provider.h" #include "content/public/browser/browser_child_process_observer.h" #include "content/public/browser/worker_service_observer.h" class TaskManager; namespace task_manager { class SharedWorkerResource; class WorkerResourceProvider : public ResourceProvider, public content::BrowserChildProcessObserver, private content::WorkerServiceObserver { public: explicit WorkerResourceProvider(TaskManager* task_manager); private: class WorkerResourceListHolder; typedef std::vector<SharedWorkerResource*> WorkerResourceList; typedef scoped_ptr<SharedWorkerResource> WorkerResourceHolder; typedef std::map<int, WorkerResourceList> ProcessIdToWorkerResources; virtual ~WorkerResourceProvider(); // ResourceProvider implementation. virtual Resource* GetResource(int origin_pid, int child_id, int route_id) OVERRIDE; virtual void StartUpdating() OVERRIDE; virtual void StopUpdating() OVERRIDE; // content::BrowserChildProcessObserver implementation. virtual void BrowserChildProcessHostConnected( const content::ChildProcessData& data) OVERRIDE; virtual void BrowserChildProcessHostDisconnected( const content::ChildProcessData& data) OVERRIDE; // content::WorkerServiceObserver implementation. virtual void WorkerCreated(const GURL& url, const base::string16& name, int process_id, int route_id) OVERRIDE; virtual void WorkerDestroyed(int process_id, int route_id) OVERRIDE; void NotifyWorkerCreated(WorkerResourceHolder* resource_holder); void NotifyWorkerDestroyed(int process_id, int routing_id); void StartObservingWorkers(); void StopObservingWorkers(); void AddWorkerResourceList(WorkerResourceListHolder* resource_list_holder); void AddResource(SharedWorkerResource* resource); void DeleteAllResources(); bool updating_; TaskManager* task_manager_; WorkerResourceList resources_; // Map from worker process id to the list of its workers. This list contains // entries for worker processes which has not launched yet but for which we // have already received WorkerCreated event. We don't add such workers to // the task manager until the process is launched. ProcessIdToWorkerResources launching_workers_; DISALLOW_COPY_AND_ASSIGN(WorkerResourceProvider); }; } // namespace task_manager #endif // CHROME_BROWSER_TASK_MANAGER_WORKER_RESOURCE_PROVIDER_H_
/** * @file * * @brief Priority Scheduler Schedule Method * @ingroup ScoreScheduler */ /* * Copyright (C) 2010 Gedare Bloom. * Copyright (C) 2011 On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #if HAVE_CONFIG_H #include "config.h" #endif #include <rtems/score/schedulerpriorityimpl.h> void _Scheduler_priority_Schedule( const Scheduler_Control *scheduler, Thread_Control *the_thread ) { _Scheduler_priority_Schedule_body( scheduler, the_thread, false ); }
#ifndef _linux_POSIX_TIMERS_H #define _linux_POSIX_TIMERS_H #include <linux/spinlock.h> #include <linux/list.h> /* POSIX.1b interval timer structure. */ struct k_itimer { struct list_head list; /* free/ allocate list */ spinlock_t it_lock; clockid_t it_clock; /* which timer type */ timer_t it_id; /* timer id */ int it_overrun; /* overrun on pending signal */ int it_overrun_last; /* overrun on last delivered signal */ int it_requeue_pending; /* waiting to requeue this timer */ int it_sigev_notify; /* notify word of sigevent struct */ int it_sigev_signo; /* signo word of sigevent struct */ sigval_t it_sigev_value; /* value word of sigevent struct */ unsigned long it_incr; /* interval specified in jiffies */ struct task_struct *it_process; /* process to send signal to */ struct timer_list it_timer; struct sigqueue *sigq; /* signal queue entry. */ struct list_head abs_timer_entry; /* clock abs_timer_list */ struct timespec wall_to_prev; /* wall_to_monotonic used when set */ }; struct k_clock_abs { struct list_head list; spinlock_t lock; }; struct k_clock { int res; /* in nano seconds */ struct k_clock_abs *abs_struct; int (*clock_set) (struct timespec * tp); int (*clock_get) (struct timespec * tp); int (*timer_create) (struct k_itimer *timer); int (*nsleep) (int which_clock, int flags, struct timespec * t); int (*timer_set) (struct k_itimer * timr, int flags, struct itimerspec * new_setting, struct itimerspec * old_setting); int (*timer_del) (struct k_itimer * timr); void (*timer_get) (struct k_itimer * timr, struct itimerspec * cur_setting); }; void register_posix_clock(int clock_id, struct k_clock *new_clock); /* Error handlers for timer_create, nanosleep and settime */ int do_posix_clock_notimer_create(struct k_itimer *timer); int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec * t); int do_posix_clock_nosettime(struct timespec *tp); /* function to call to trigger timer event */ int posix_timer_event(struct k_itimer *timr, int si_private); struct now_struct { unsigned long jiffies; }; #define posix_get_now(now) (now)->jiffies = jiffies; #define posix_time_before(timer, now) \ time_before((timer)->expires, (now)->jiffies) #define posix_bump_timer(timr, now) \ do { \ long delta, orun; \ delta = now.jiffies - (timr)->it_timer.expires; \ if (delta >= 0) { \ orun = 1 + (delta / (timr)->it_incr); \ (timr)->it_timer.expires += orun * (timr)->it_incr; \ (timr)->it_overrun += orun; \ } \ }while (0) #endif
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the name Chromium Embedded // Framework 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. // // --------------------------------------------------------------------------- // // This file was generated by the CEF translator tool and should not edited // by hand. See the translator.README.txt file in the tools directory for // more information. // #ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_ #define CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_ #pragma once #ifdef __cplusplus extern "C" { #endif #include "include/capi/cef_base_capi.h" /// // Structure used to implement a custom resource bundle structure. The functions // of this structure may be called on multiple threads. /// typedef struct _cef_resource_bundle_handler_t { /// // Base structure. /// cef_base_t base; /// // Called to retrieve a localized translation for the string specified by // |message_id|. To provide the translation set |string| to the translation // string and return true (1). To use the default translation return false // (0). // // WARNING: Be cautious when implementing this function. ID values are auto- // generated when CEF is built and may change between versions. Existing ID // values can be discovered by searching for *_strings.h in the // "obj/global_intermediate" build output directory. /// int (CEF_CALLBACK *get_localized_string)( struct _cef_resource_bundle_handler_t* self, int message_id, cef_string_t* string); /// // Called to retrieve data for the resource specified by |resource_id|. To // provide the resource data set |data| and |data_size| to the data pointer // and size respectively and return true (1). To use the default resource data // return false (0). The resource data will not be copied and must remain // resident in memory. // // WARNING: Be cautious when implementing this function. ID values are auto- // generated when CEF is built and may change between versions. Existing ID // values can be discovered by searching for *_resources.h in the // "obj/global_intermediate" build output directory. /// int (CEF_CALLBACK *get_data_resource)( struct _cef_resource_bundle_handler_t* self, int resource_id, void** data, size_t* data_size); } cef_resource_bundle_handler_t; #ifdef __cplusplus } #endif #endif // CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_HANDLER_CAPI_H_
/* Copyright (c) 2015 Google Inc. * * 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. */ // // GTLAdExchangeSellerReport.h // // ---------------------------------------------------------------------------- // NOTE: This file is generated from Google APIs Discovery Service. // Service: // Ad Exchange Seller API (adexchangeseller/v2.0) // Description: // Gives Ad Exchange seller users access to their inventory and the ability to // generate reports // Documentation: // https://developers.google.com/ad-exchange/seller-rest/ // Classes: // GTLAdExchangeSellerReport (0 custom class methods, 7 custom properties) // GTLAdExchangeSellerReportHeadersItem (0 custom class methods, 3 custom properties) #if GTL_BUILT_AS_FRAMEWORK #import "GTL/GTLObject.h" #else #import "GTLObject.h" #endif @class GTLAdExchangeSellerReportHeadersItem; // ---------------------------------------------------------------------------- // // GTLAdExchangeSellerReport // @interface GTLAdExchangeSellerReport : GTLObject // The averages of the report. This is the same length as any other row in the // report; cells corresponding to dimension columns are empty. @property (nonatomic, retain) NSArray *averages; // of NSString // The header information of the columns requested in the report. This is a list // of headers; one for each dimension in the request, followed by one for each // metric in the request. @property (nonatomic, retain) NSArray *headers; // of GTLAdExchangeSellerReportHeadersItem // Kind this is, in this case adexchangeseller#report. @property (nonatomic, copy) NSString *kind; // The output rows of the report. Each row is a list of cells; one for each // dimension in the request, followed by one for each metric in the request. The // dimension cells contain strings, and the metric cells contain numbers. @property (nonatomic, retain) NSArray *rows; // of NSArray of NSString // The total number of rows matched by the report request. Fewer rows may be // returned in the response due to being limited by the row count requested or // the report row limit. @property (nonatomic, retain) NSNumber *totalMatchedRows; // longLongValue // The totals of the report. This is the same length as any other row in the // report; cells corresponding to dimension columns are empty. @property (nonatomic, retain) NSArray *totals; // of NSString // Any warnings associated with generation of the report. @property (nonatomic, retain) NSArray *warnings; // of NSString @end // ---------------------------------------------------------------------------- // // GTLAdExchangeSellerReportHeadersItem // @interface GTLAdExchangeSellerReportHeadersItem : GTLObject // The currency of this column. Only present if the header type is // METRIC_CURRENCY. @property (nonatomic, copy) NSString *currency; // The name of the header. @property (nonatomic, copy) NSString *name; // The type of the header; one of DIMENSION, METRIC_TALLY, METRIC_RATIO, or // METRIC_CURRENCY. @property (nonatomic, copy) NSString *type; @end
/* * This test file is used to verify that the header files associated with * invoking this function are correct. * * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.org/license/LICENSE. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <time.h> int test( void ); int test( void ) { char *buffer_pointer; char buffer[ 80 ]; time_t time; buffer_pointer = ctime_r( &time, buffer ); return (buffer_pointer != NULL); }
#include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> #include <asm/pgtable-hwdef.h> #include <asm/hardware/gic.h> #include <asm/mach/arch.h> #include <asm/hardware/cache-l2x0.h> #include <plat/sram.h> #include <mach/board.h> #include <mach/gpio.h> #include <mach/iomux.h> #include <mach/fiq.h> #include <mach/pmu.h> #include <mach/loader.h> #include <mach/ddr.h> static void __init rk30_cpu_axi_init(void) { writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0088); // cpu0 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0108); // dmac1 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0188); // cpu1r writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x0388); // cpu1w #ifdef CONFIG_RK29_VMAC writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x4008); // peri #else writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x4008); // peri #endif #if 0 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x5008); // gpu writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x6008); // vpu writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7008); // lcdc0 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7088); // cif0 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7108); // ipp writel_relaxed(0xa, RK30_CPU_AXI_BUS_BASE + 0x7188); // lcdc1 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7208); // cif1 writel_relaxed(0x0, RK30_CPU_AXI_BUS_BASE + 0x7288); // rga #endif writel_relaxed(0x3f, RK30_CPU_AXI_BUS_BASE + 0x0014); // memory scheduler read latency dsb(); } static void __init rk30_io_drive_strength_init(void) { #if defined(CONFIG_ARCH_RK3066B) writel_relaxed(0x11001100, RK30_GRF_BASE + GRF_IO_CON4); #endif } #define L2_LY_SP_OFF (0) #define L2_LY_SP_MSK (0x7) #define L2_LY_RD_OFF (4) #define L2_LY_RD_MSK (0x7) #define L2_LY_WR_OFF (8) #define L2_LY_WR_MSK (0x7) #define L2_LY_SET(ly,off) (((ly)-1)<<(off)) static void __init rk30_l2_cache_init(void) { #ifdef CONFIG_CACHE_L2X0 u32 aux_ctrl, aux_ctrl_mask; writel_relaxed(L2_LY_SET(1,L2_LY_SP_OFF) |L2_LY_SET(1,L2_LY_RD_OFF) |L2_LY_SET(1,L2_LY_WR_OFF), RK30_L2C_BASE + L2X0_TAG_LATENCY_CTRL); writel_relaxed(L2_LY_SET(4,L2_LY_SP_OFF) |L2_LY_SET(6,L2_LY_RD_OFF) |L2_LY_SET(1,L2_LY_WR_OFF), RK30_L2C_BASE + L2X0_DATA_LATENCY_CTRL); /* L2X0 Prefetch Control */ writel_relaxed(0x70000003, RK30_L2C_BASE + L2X0_PREFETCH_CTRL); /* L2X0 Power Control */ writel_relaxed(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN, RK30_L2C_BASE + L2X0_POWER_CTRL); aux_ctrl = ( (0x1 << 25) | // round-robin (0x1 << 0) | // Full Line of Zero Enable (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) | (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | (0x1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT) ); aux_ctrl_mask = ~( (0x1 << 25) | // round-robin (0x1 << 0) | // Full Line of Zero Enable (0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) | (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | (0x1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT) ); l2x0_init(RK30_L2C_BASE, aux_ctrl, aux_ctrl_mask); #endif } static int boot_mode; static void __init rk30_boot_mode_init(void) { u32 boot_flag = readl_relaxed(RK30_PMU_BASE + PMU_SYS_REG0); boot_mode = readl_relaxed(RK30_PMU_BASE + PMU_SYS_REG1); if (boot_flag == (SYS_KERNRL_REBOOT_FLAG | BOOT_RECOVER)) { boot_mode = BOOT_MODE_RECOVERY; } if (boot_mode || boot_flag) printk("Boot mode: %d flag: 0x%08x\n", boot_mode, boot_flag); } int board_boot_mode(void) { return boot_mode; } EXPORT_SYMBOL(board_boot_mode); void __init rk30_init_irq(void) { gic_init(0, IRQ_LOCALTIMER, RK30_GICD_BASE, RK30_GICC_BASE); #ifdef CONFIG_FIQ rk_fiq_init(); #endif rk30_gpio_init(); } int __init clk_disable_unused(void); void __init rk30_map_io(void) { rk30_map_common_io(); rk29_setup_early_printk(); rk30_cpu_axi_init(); rk30_io_drive_strength_init(); rk29_sram_init(); board_clock_init(); rk30_l2_cache_init(); ddr_init(DDR_TYPE, DDR_FREQ); clk_disable_unused(); rk30_iomux_init(); rk30_boot_mode_init(); } extern u32 ddr_get_cap(void); static __init u32 rk30_get_ddr_size(void) { u32 size; u32 v[3], a[3]; u32 pgtbl = PAGE_OFFSET + TEXT_OFFSET - 0x4000; u32 flag = PMD_TYPE_SECT | PMD_SECT_XN | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ; a[0] = pgtbl + (((u32)RK30_CPU_AXI_BUS_BASE >> 20) << 2); a[1] = pgtbl + (((u32)RK30_DDR_PUBL_BASE >> 20) << 2); a[2] = pgtbl + (((u32)RK30_GRF_BASE >> 20) << 2); v[0] = readl_relaxed(a[0]); v[1] = readl_relaxed(a[1]); v[2] = readl_relaxed(a[2]); writel_relaxed(flag | ((RK30_CPU_AXI_BUS_PHYS >> 20) << 20), a[0]); writel_relaxed(flag | ((RK30_DDR_PUBL_PHYS >> 20) << 20), a[1]); writel_relaxed(flag | ((RK30_GRF_PHYS >> 20) << 20), a[2]); size = ddr_get_cap(); writel_relaxed(v[0], a[0]); writel_relaxed(v[1], a[1]); writel_relaxed(v[2], a[2]); return size; } void __init rk30_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { mi->nr_banks = 1; mi->bank[0].start = PLAT_PHYS_OFFSET; mi->bank[0].size = rk30_get_ddr_size(); }
/** * @file fputc.c * @provides fputc. * * $Id: fputc.c 2020 2009-08-13 17:50:08Z mschul $ */ /* Embedded Xinu, Copyright (C) 2009. All rights reserved. */ extern int putc(int, char); #define SYSERR (-1) #define EOF (-2) /** * Write a character string to a device (file) * @param c string to write * @param dev device to write to * @return character written, EOF if error */ int fputc(int c, int dev) { if (SYSERR == (int)putc(dev, c)) { return EOF; } else { return c; } }
/* Copyright (C) 1995,1996,1997,2000,2002,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #ifndef _SYS_SHM_H # error "Never include <bits/shm.h> directly; use <sys/shm.h> instead." #endif #include <bits/types.h> /* Permission flag for shmget. */ #define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */ #define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */ /* Flags for `shmat'. */ #define SHM_RDONLY 010000 /* attach read-only else read-write */ #define SHM_RND 020000 /* round attach address to SHMLBA */ #define SHM_REMAP 040000 /* take-over region on attach */ /* Commands for `shmctl'. */ #define SHM_LOCK 11 /* lock segment (root only) */ #define SHM_UNLOCK 12 /* unlock segment (root only) */ __BEGIN_DECLS /* Segment low boundary address multiple. */ #define SHMLBA (__getpagesize ()) extern int __getpagesize (void) __THROW __attribute__ ((__const__)); /* Type to count number of attaches. */ typedef unsigned long int shmatt_t; /* Data structure describing a set of semaphores. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ size_t shm_segsz; /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ unsigned long int __unused1; __time_t shm_dtime; /* time of last shmdt() */ unsigned long int __unused2; __time_t shm_ctime; /* time of last change by shmctl() */ unsigned long int __unused3; __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ unsigned long int __unused4; unsigned long int __unused5; }; #ifdef __USE_MISC /* ipcs ctl commands */ # define SHM_STAT 13 # define SHM_INFO 14 /* shm_mode upper byte flags */ # define SHM_DEST 01000 /* segment will be destroyed on last detach */ # define SHM_LOCKED 02000 /* segment will not be swapped */ # define SHM_HUGETLB 04000 /* segment is mapped via hugetlb */ # define SHM_NORESERVE 010000 /* don't check for reservations */ struct shminfo { unsigned long int shmmax; unsigned long int shmmin; unsigned long int shmmni; unsigned long int shmseg; unsigned long int shmall; unsigned long int __unused1; unsigned long int __unused2; unsigned long int __unused3; unsigned long int __unused4; }; struct shm_info { int used_ids; unsigned long int shm_tot; /* total allocated shm */ unsigned long int shm_rss; /* total resident shm */ unsigned long int shm_swp; /* total swapped shm */ unsigned long int swap_attempts; unsigned long int swap_successes; }; #endif /* __USE_MISC */ __END_DECLS
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ #ifndef JUCE_DRAWABLEIMAGE_H_INCLUDED #define JUCE_DRAWABLEIMAGE_H_INCLUDED //============================================================================== /** A drawable object which is a bitmap image. @see Drawable */ class JUCE_API DrawableImage : public Drawable { public: //============================================================================== DrawableImage(); DrawableImage (const DrawableImage&); /** Destructor. */ ~DrawableImage(); //============================================================================== /** Sets the image that this drawable will render. */ void setImage (const Image& imageToUse); /** Returns the current image. */ const Image& getImage() const noexcept { return image; } /** Sets the opacity to use when drawing the image. */ void setOpacity (float newOpacity); /** Returns the image's opacity. */ float getOpacity() const noexcept { return opacity; } /** Sets a colour to draw over the image's alpha channel. By default this is transparent so isn't drawn, but if you set a non-transparent colour here, then it will be overlaid on the image, using the image's alpha channel as a mask. This is handy for doing things like darkening or lightening an image by overlaying it with semi-transparent black or white. */ void setOverlayColour (Colour newOverlayColour); /** Returns the overlay colour. */ Colour getOverlayColour() const noexcept { return overlayColour; } /** Sets the bounding box within which the image should be displayed. */ void setBoundingBox (const RelativeParallelogram& newBounds); /** Returns the position to which the image's top-left corner should be remapped in the target coordinate space when rendering this object. @see setTransform */ const RelativeParallelogram& getBoundingBox() const noexcept { return bounds; } //============================================================================== /** @internal */ void paint (Graphics&) override; /** @internal */ bool hitTest (int x, int y) override; /** @internal */ Drawable* createCopy() const override; /** @internal */ Rectangle<float> getDrawableBounds() const override; /** @internal */ void refreshFromValueTree (const ValueTree& tree, ComponentBuilder&); /** @internal */ ValueTree createValueTree (ComponentBuilder::ImageProvider*) const override; /** @internal */ static const Identifier valueTreeType; //============================================================================== /** Internally-used class for wrapping a DrawableImage's state into a ValueTree. */ class ValueTreeWrapper : public Drawable::ValueTreeWrapperBase { public: ValueTreeWrapper (const ValueTree& state); var getImageIdentifier() const; void setImageIdentifier (const var&, UndoManager*); Value getImageIdentifierValue (UndoManager*); float getOpacity() const; void setOpacity (float newOpacity, UndoManager*); Value getOpacityValue (UndoManager*); Colour getOverlayColour() const; void setOverlayColour (Colour newColour, UndoManager*); Value getOverlayColourValue (UndoManager*); RelativeParallelogram getBoundingBox() const; void setBoundingBox (const RelativeParallelogram&, UndoManager*); static const Identifier opacity, overlay, image, topLeft, topRight, bottomLeft; }; private: //============================================================================== Image image; float opacity; Colour overlayColour; RelativeParallelogram bounds; friend class Drawable::Positioner<DrawableImage>; bool registerCoordinates (RelativeCoordinatePositionerBase&); void recalculateCoordinates (Expression::Scope*); DrawableImage& operator= (const DrawableImage&); JUCE_LEAK_DETECTOR (DrawableImage) }; #endif // JUCE_DRAWABLEIMAGE_H_INCLUDED
/* Test ICE on defining function with a name previously declared as a nonfunction. Bug 28299 from Bernhard Fischer <aldot@gcc.gnu.org>. */ /* { dg-do compile } */ /* { dg-options "-Wmissing-prototypes" } */ extern __typeof(foo) foo __asm__(""); /* { dg-error "undeclared" } */ /* { dg-error "previous declaration" "previous declaration" { target *-*-* } 7 } */ void *foo (void) {} /* { dg-error "redeclared as different kind of symbol" } */ /* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 9 } */
// // VolumeViewController.h // Soundflowerbed // // Created by koji on 2013/06/01. // // #import <Cocoa/Cocoa.h> @interface VolumeViewController : NSViewController @end
/* -LICENSE-START- ** Copyright (c) 2020 Blackmagic Design ** ** Permission is hereby granted, free of charge, to any person or organization ** obtaining a copy of the software and accompanying documentation covered by ** this license (the "Software") to use, reproduce, display, distribute, ** execute, and transmit the Software, and to prepare derivative works of the ** Software, and to permit third-parties to whom the Software is furnished to ** do so, all subject to the following: ** ** The copyright notices in the Software and this entire statement, including ** the above license grant, this restriction and the following disclaimer, ** must be included in all copies of the Software, in whole or in part, and ** all derivative works of the Software, unless such copies or derivative ** works are solely in the form of machine-executable object code generated by ** a source language processor. ** ** 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ** DEALINGS IN THE SOFTWARE. ** -LICENSE-END- */ #ifndef BMD_DECKLINKAPITYPES_H #define BMD_DECKLINKAPITYPES_H #ifndef BMD_CONST #if defined(_MSC_VER) #define BMD_CONST __declspec(selectany) static const #else #define BMD_CONST static const #endif #endif #ifndef BMD_PUBLIC #define BMD_PUBLIC #endif // Type Declarations typedef int64_t BMDTimeValue; typedef int64_t BMDTimeScale; typedef uint32_t BMDTimecodeBCD; typedef uint32_t BMDTimecodeUserBits; // Interface ID Declarations BMD_CONST REFIID IID_IDeckLinkTimecode = /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ { 0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40 }; /* Enum BMDTimecodeFlags - Timecode flags */ typedef uint32_t BMDTimecodeFlags; enum _BMDTimecodeFlags { bmdTimecodeFlagDefault = 0, bmdTimecodeIsDropFrame = 1 << 0, bmdTimecodeFieldMark = 1 << 1, bmdTimecodeColorFrame = 1 << 2, bmdTimecodeEmbedRecordingTrigger = 1 << 3, // On SDI recording trigger utilises a user-bit. bmdTimecodeRecordingTriggered = 1 << 4 }; /* Enum BMDVideoConnection - Video connection types */ typedef uint32_t BMDVideoConnection; enum _BMDVideoConnection { bmdVideoConnectionUnspecified = 0, bmdVideoConnectionSDI = 1 << 0, bmdVideoConnectionHDMI = 1 << 1, bmdVideoConnectionOpticalSDI = 1 << 2, bmdVideoConnectionComponent = 1 << 3, bmdVideoConnectionComposite = 1 << 4, bmdVideoConnectionSVideo = 1 << 5 }; /* Enum BMDAudioConnection - Audio connection types */ typedef uint32_t BMDAudioConnection; enum _BMDAudioConnection { bmdAudioConnectionEmbedded = 1 << 0, bmdAudioConnectionAESEBU = 1 << 1, bmdAudioConnectionAnalog = 1 << 2, bmdAudioConnectionAnalogXLR = 1 << 3, bmdAudioConnectionAnalogRCA = 1 << 4, bmdAudioConnectionMicrophone = 1 << 5, bmdAudioConnectionHeadphones = 1 << 6 }; /* Enum BMDDeckControlConnection - Deck control connections */ typedef uint32_t BMDDeckControlConnection; enum _BMDDeckControlConnection { bmdDeckControlConnectionRS422Remote1 = 1 << 0, bmdDeckControlConnectionRS422Remote2 = 1 << 1 }; #if defined(__cplusplus) // Forward Declarations class IDeckLinkTimecode; /* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ class BMD_PUBLIC IDeckLinkTimecode : public IUnknown { public: virtual BMDTimecodeBCD GetBCD (void) = 0; virtual HRESULT GetComponents (/* out */ uint8_t* hours, /* out */ uint8_t* minutes, /* out */ uint8_t* seconds, /* out */ uint8_t* frames) = 0; virtual HRESULT GetString (/* out */ const char** timecode) = 0; virtual BMDTimecodeFlags GetFlags (void) = 0; virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits* userBits) = 0; protected: virtual ~IDeckLinkTimecode () {} // call Release method to drop reference count }; /* Functions */ extern "C" { } #endif /* defined(__cplusplus) */ #endif /* defined(BMD_DECKLINKAPITYPES_H) */
/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT 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 <sys/resource.h> extern int __getpriority(int, int); int getpriority(int which, int who) { int result = __getpriority(which, who); return ( result < 0 ) ? result : 20-result; }
/* * Copyright 2016 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_BIOS_TYPES_H #define DC_BIOS_TYPES_H /****************************************************************************** * Interface file for VBIOS implementations. * * The default implementation is inside DC. * Display Manager (which instantiates DC) has the option to supply it's own * (external to DC) implementation of VBIOS, which will be called by DC, using * this interface. * (The intended use is Diagnostics, but other uses may appear.) *****************************************************************************/ #include "include/bios_parser_types.h" struct dc_vbios_funcs { uint8_t (*get_connectors_number)(struct dc_bios *bios); struct graphics_object_id (*get_connector_id)( struct dc_bios *bios, uint8_t connector_index); enum bp_result (*get_src_obj)( struct dc_bios *bios, struct graphics_object_id object_id, uint32_t index, struct graphics_object_id *src_object_id); enum bp_result (*get_i2c_info)( struct dc_bios *dcb, struct graphics_object_id id, struct graphics_object_i2c_info *info); enum bp_result (*get_hpd_info)( struct dc_bios *bios, struct graphics_object_id id, struct graphics_object_hpd_info *info); enum bp_result (*get_device_tag)( struct dc_bios *bios, struct graphics_object_id connector_object_id, uint32_t device_tag_index, struct connector_device_tag_info *info); enum bp_result (*get_firmware_info)( struct dc_bios *bios, struct dc_firmware_info *info); enum bp_result (*get_spread_spectrum_info)( struct dc_bios *bios, enum as_signal_type signal, uint32_t index, struct spread_spectrum_info *ss_info); uint32_t (*get_ss_entry_number)( struct dc_bios *bios, enum as_signal_type signal); enum bp_result (*get_embedded_panel_info)( struct dc_bios *bios, struct embedded_panel_info *info); enum bp_result (*get_gpio_pin_info)( struct dc_bios *bios, uint32_t gpio_id, struct gpio_pin_info *info); enum bp_result (*get_encoder_cap_info)( struct dc_bios *bios, struct graphics_object_id object_id, struct bp_encoder_cap_info *info); bool (*is_accelerated_mode)( struct dc_bios *bios); void (*set_scratch_critical_state)( struct dc_bios *bios, bool state); bool (*is_device_id_supported)( struct dc_bios *bios, struct device_id id); /* COMMANDS */ enum bp_result (*encoder_control)( struct dc_bios *bios, struct bp_encoder_control *cntl); enum bp_result (*transmitter_control)( struct dc_bios *bios, struct bp_transmitter_control *cntl); enum bp_result (*enable_crtc)( struct dc_bios *bios, enum controller_id id, bool enable); enum bp_result (*adjust_pixel_clock)( struct dc_bios *bios, struct bp_adjust_pixel_clock_parameters *bp_params); enum bp_result (*set_pixel_clock)( struct dc_bios *bios, struct bp_pixel_clock_parameters *bp_params); enum bp_result (*set_dce_clock)( struct dc_bios *bios, struct bp_set_dce_clock_parameters *bp_params); enum bp_result (*enable_spread_spectrum_on_ppll)( struct dc_bios *bios, struct bp_spread_spectrum_parameters *bp_params, bool enable); enum bp_result (*program_crtc_timing)( struct dc_bios *bios, struct bp_hw_crtc_timing_parameters *bp_params); enum bp_result (*crtc_source_select)( struct dc_bios *bios, struct bp_crtc_source_select *bp_params); enum bp_result (*program_display_engine_pll)( struct dc_bios *bios, struct bp_pixel_clock_parameters *bp_params); enum bp_result (*enable_disp_power_gating)( struct dc_bios *bios, enum controller_id controller_id, enum bp_pipe_control_action action); void (*bios_parser_destroy)(struct dc_bios **dcb); enum bp_result (*get_board_layout_info)( struct dc_bios *dcb, struct board_layout_info *board_layout_info); }; struct bios_registers { uint32_t BIOS_SCRATCH_3; uint32_t BIOS_SCRATCH_6; }; struct dc_bios { const struct dc_vbios_funcs *funcs; uint8_t *bios; uint32_t bios_size; uint8_t *bios_local_image; struct dc_context *ctx; const struct bios_registers *regs; struct integrated_info *integrated_info; }; #endif /* DC_BIOS_TYPES_H */
/* * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Id: once.c,v 1.12 2007/06/18 23:47:49 tbox Exp $ */ /* Principal Authors: DCL */ #include <config.h> #include <windows.h> #include <isc/once.h> #include <isc/assertions.h> #include <isc/util.h> isc_result_t isc_once_do(isc_once_t *controller, void(*function)(void)) { REQUIRE(controller != NULL && function != NULL); if (controller->status == ISC_ONCE_INIT_NEEDED) { if (InterlockedDecrement(&controller->counter) == 0) { if (controller->status == ISC_ONCE_INIT_NEEDED) { function(); controller->status = ISC_ONCE_INIT_DONE; } } else { while (controller->status == ISC_ONCE_INIT_NEEDED) { /* * Sleep(0) indicates that this thread * should be suspended to allow other * waiting threads to execute. */ Sleep(0); } } } return (ISC_R_SUCCESS); }
/* Definitions of C specific functions for TILEPro. Copyright (C) 2011-2016 Free Software Foundation, Inc. Contributed by Walter Lee (walt@tilera.com) 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. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ #include "config.h" #include "system.h" #include "coretypes.h" #include "tm.h" #include "c-family/c-common.h" /* copy defines in c-cppbuiltin.c */ # define builtin_define(TXT) cpp_define (pfile, TXT) # define builtin_assert(TXT) cpp_assert (pfile, TXT) /* Implement TARGET_CPU_CPP_BUILTINS. */ void tilepro_cpu_cpp_builtins (struct cpp_reader *pfile) { builtin_define ("__tile__"); builtin_define ("__tilepro__"); builtin_assert ("cpu=tile"); builtin_assert ("machine=tile"); builtin_define ("__tile_chip__=1"); builtin_define ("__tile_chip_rev__=0"); builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); TILEPRO_CPU_CPP_ENDIAN_BUILTINS (); GNU_USER_TARGET_OS_CPP_BUILTINS (); }
/* * opencog/hypertable/AtomspaceHTabler.h * * Copyright (C) 2009-2011 OpenCog Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3 as * published by the Free Software Foundation and including the exceptions * at http://opencog.org/wiki/Licenses * * 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 Affero General Public License * along with this program; if not, write to: * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _OPENCOG_ATOMSPACE_HTABLER_H #define _OPENCOG_ATOMSPACE_HTABLER_H #include "Common/Compat.h" #include "Hypertable/Lib/Client.h" #include "opencog/atomspace/Handle.h" #include "opencog/atomspace/Node.h" #include "opencog/atomspace/Link.h" #include "opencog/atomspace/BackingStore.h" namespace opencog { /** \addtogroup grp_persist * @{ */ /** * Persistent Atom storage, backed by Hypertable. */ class AtomspaceHTabler : public BackingStore { private: ClientPtr c; TablePtr m_handle_table; TableMutatorPtr m_handle_mutator; TablePtr m_name_table; TableMutatorPtr m_name_mutator; TablePtr m_outset_table; TableMutatorPtr m_outset_mutator; KeySpec make_key(Handle); KeySpec make_key(Type, const std::vector<Handle>&); KeySpec make_key(Type, const char*); void initTables(); public: /** * Initializes the object, connects to Hypertable. * @throws NetworkException if the connection times out, * usually indicating that the Hypertable servers are not running. */ AtomspaceHTabler(void); virtual ~AtomspaceHTabler(){} /** * Erases everything stored in the Hypertable. */ void clearData(); /** * Return a pointer to a link of the indicated type and outset, * if it exists; else return NULL. */ virtual Link * getLink(Type, const std::vector<Handle>&) const; /** * Return a pointer to a node of the indicated type and name, * if it exists; else return NULL. */ virtual Node * getNode(Type, const char *) const; /** * Recursively store the atom and anything in its outgoing set. * If the atom is already in storage, this will update it's * truth value, etc. */ virtual void storeAtom(Handle); /** * Return a vector containing the handles of the entire incoming * set of the indicated handle. */ virtual std::vector<Handle> getIncomingSet(Handle) const; /** * Return a pointer to an Atom associated with the given * handle, if it exists; else return NULL. */ virtual Atom * getAtom(Handle) const; }; /** @}*/ } // namespace opencog #endif // _OPENCOG_ATOMSPACE_HTABLER_H
/*=================================================================== APM_PLANNER Open Source Ground Control Station (c) 2013 APM_PLANNER PROJECT <http://www.diydrones.com> This file is part of the APM_PLANNER project APM_PLANNER 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. APM_PLANNER 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 APM_PLANNER. If not, see <http://www.gnu.org/licenses/>. ======================================================================*/ /** * @file * @brief Firmware select and upload * * @author Michael Carpenter <malcom2073@gmail.com> */ #ifndef APMFIRMWARECONFIG_H #define APMFIRMWARECONFIG_H #include "AP2ConfigWidget.h" #include <QWidget> #include <QNetworkAccessManager> #include <QNetworkRequest> #include <QNetworkReply> #include <QTemporaryFile> #include <QXmlStreamReader> #include <QMessageBox> #include <QProcess> #include <QScrollBar> #include <QProgressDialog> #include <QTimer> #include "UASInterface.h" #include "UASManager.h" #include <QtSerialPort/qserialport.h> #include "SerialSettingsDialog.h" #include "ui_ApmFirmwareConfig.h" #include "PX4FirmwareUploader.h" #include "arduinoflash.h" #include <QFileDialog> class ApmFirmwareConfig : public AP2ConfigWidget { Q_OBJECT public: explicit ApmFirmwareConfig(QWidget *parent = 0); ~ApmFirmwareConfig(); void updateFirmwareButtons(); signals: void showBlankingScreen(); protected: void showEvent(QShowEvent *event); void hideEvent(QHideEvent *event); public slots: void checkForUpdates(const QString &versionString); void advancedModeChanged(bool state); private slots: void firmwareListFinished(); void firmwareListError(QNetworkReply::NetworkError error); void flashButtonClicked(); void betaFirmwareButtonClicked(); void stableFirmwareButtonClicked(); void downloadFinished(); void trunkFirmwareButtonClicked(); void firmwareDownloadProgress(qint64 received,qint64 total); void requestFirmwares(QString type, QString autopilot, bool notification); void setLink(int index); void activeUASSet(UASInterface *uas); void uasConnected(); void uasDisconnected(); void cancelButtonClicked(); void populateSerialPorts(); void requestDeviceReplug(); void devicePlugDetected(); void px4Error(QString error); void px4Warning(QString message); void px4Finished(); void px4Cleanup(); void px4StatusUpdate(QString update); void px4DebugUpdate(QString update); void px4UnplugTimerTick(); void arduinoError(QString error); void arduinoUploadStarted(); void arduinoFlashProgress(qint64 pos,qint64 total); void arduinoVerifyProgress(qint64 pos,qint64 total); void arduinoStatusUpdate(QString update); void arduinoDebugUpdate(QString update); void arduinoVerifyComplete(); void arduinoVerifyFailed(); void arduinoFlashComplete(); void arduinoFlashFailed(); void arduinoUploadComplete(); void flashCustomFirmware(); void flashFirmware(QString filename); void parameterChanged(int uas, int component, QString parameterName, QVariant value); private: void loadSettings(); void storeSettings(); QString processPortInfo(const QSerialPortInfo &info); bool compareVersionStrings(const QString& newVersion, const QString& currentVersion); void compareVersionsForNotification(const QString &apmPlatform, const QString &newFwVersion); void addButtonStyleSheet(QWidget *parent); void cleanUp(); bool versionIsGreaterThan(QString verstr,double version); private: bool m_throwPropSpinWarning; QProgressDialog *m_replugRequestMessageBox; QTimer *m_px4UnplugTimer; PX4FirmwareUploader *m_px4uploader; ArduinoFlash *m_arduinoUploader; QString m_firmwareType; QString m_autopilotType; int m_timeoutCounter; bool m_hasError; QPointer<UASInterface> m_uas; SerialSettings m_settings; QPointer<QSerialPort> m_port; void addBetaLabel(QWidget *parent); void hideBetaLabels(); void showBetaLabels(); //ApmFirmwareStatus *firmwareStatus; QString m_detectedComPort; QPointer<QTemporaryFile> m_tempFirmwareFile; QPointer<QNetworkAccessManager> m_networkManager; QList<QLabel*> m_betaButtonLabelList; bool stripVersionFromGitReply(QString url,QString reply,QString type,QString stable,QString *out); bool m_betaFirmwareChecked; bool m_trunkFirmwareChecked; QMap<QPushButton*,QString> m_buttonToUrlMap; QMap<QPushButton*,bool> m_buttonToWarning; Ui::ApmFirmwareConfig ui; class FirmwareDef { public: QString url; QString url2560; QString url25602; QString urlpx4; QString type; QString name; QString desc; int version; }; QList<FirmwareDef> m_firmwareList; QTimer m_timer; bool m_enableUpdateCheck; bool m_notificationOfUpdate; bool m_updateCheckInitiated; QString m_currentVersionString; QString m_lastVersionSkipped; bool m_isAdvancedMode; }; #endif // APMFIRMWARECONFIG_H
/* * Copyright 2014 Facebook, Inc. * * 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 _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_ #define _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_ 1 #include <thrift/lib/cpp/transport/TRpcTransport.h> #include <thrift/lib/cpp/transport/TTransportException.h> #include <memory> namespace apache { namespace thrift { namespace transport { /** * Server transport framework. A server needs to have some facility for * creating base transports to read/write from. * */ class TServerTransport { public: virtual ~TServerTransport() {} /** * Starts the server transport listening for new connections. Prior to this * call most transports will not return anything when accept is called. * * @throws TTransportException if we were unable to listen */ virtual void listen() {} /** * Gets a new dynamically allocated transport object and passes it to the * caller. Note that it is the explicit duty of the caller to free the * allocated object. The returned TRpcTransport object must always be in the * opened state. nullptr should never be returned, instead an Exception should * always be thrown. * * @return A new TRpcTransport object * @throws TTransportException if there is an error */ std::shared_ptr<TRpcTransport> accept() { std::shared_ptr<TRpcTransport> result = acceptImpl(); if (result == nullptr) { throw TTransportException("accept() may not return nullptr"); } return result; } /** * For "smart" TServerTransport implementations that work in a multi * threaded context this can be used to break out of an accept() call. * It is expected that the transport will throw a TTransportException * with the interrupted error code. */ virtual void interrupt() {} /** * Closes this transport such that future calls to accept will do nothing. */ virtual void close() = 0; /** * Get the address on which this transport is listening. * * Should only be called after calling listen(). May raise * TTransportException on error. * * @param address The server's address will be stored in the folly::SocketAddress * pointed to by this argument. */ virtual void getAddress(folly::SocketAddress* address) = 0; protected: TServerTransport() {} /** * Subclasses should implement this function for accept. * * @return A newly allocated TRpcTransport object * @throw TTransportException If an error occurs */ virtual std::shared_ptr<TRpcTransport> acceptImpl() = 0; }; }}} // apache::thrift::transport #endif // #ifndef _THRIFT_TRANSPORT_TSERVERTRANSPORT_H_
/* * Copyright © 2013 Canonical Limited * * 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, see <http://www.gnu.org/licenses/>. * * Authors: Ryan Lortie <desrt@desrt.ca> */ #ifndef __G_PROPERTY_ACTION_H__ #define __G_PROPERTY_ACTION_H__ #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) #error "Only <gio/gio.h> can be included directly." #endif #include <gio/giotypes.h> G_BEGIN_DECLS #define G_TYPE_PROPERTY_ACTION (g_property_action_get_type ()) #define G_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ G_TYPE_PROPERTY_ACTION, GPropertyAction)) #define G_IS_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ G_TYPE_PROPERTY_ACTION)) GLIB_AVAILABLE_IN_2_38 GType g_property_action_get_type (void) G_GNUC_CONST; GLIB_AVAILABLE_IN_2_38 GPropertyAction * g_property_action_new (const gchar *name, gpointer object, const gchar *property_name); G_END_DECLS #endif /* __G_PROPERTY_ACTION_H__ */
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #ifdef USE_TI_UIIPHONEROWANIMATIONSTYLE #import "TiProxy.h" @interface TiUIiPhoneRowAnimationStyleProxy : TiProxy { } @property(nonatomic,readonly) NSNumber *NONE; @property(nonatomic,readonly) NSNumber *LEFT; @property(nonatomic,readonly) NSNumber *RIGHT; @property(nonatomic,readonly) NSNumber *TOP; @property(nonatomic,readonly) NSNumber *BOTTOM; @property(nonatomic,readonly) NSNumber *FADE; @property(nonatomic,readonly) NSNumber *UP; // used in KS before 0.9 @property(nonatomic,readonly) NSNumber *DOWN; // used in KS before 0.9 @end #endif
//===--- Job.h - Commands to Execute ----------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef CLANG_DRIVER_JOB_H_ #define CLANG_DRIVER_JOB_H_ #include "clang/Basic/LLVM.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Option/Option.h" #include <memory> namespace llvm { class raw_ostream; } namespace clang { namespace driver { class Action; class Command; class Tool; // Re-export this as clang::driver::ArgStringList. using llvm::opt::ArgStringList; class Job { public: enum JobClass { CommandClass, FallbackCommandClass, JobListClass }; private: JobClass Kind; protected: Job(JobClass _Kind) : Kind(_Kind) {} public: virtual ~Job(); JobClass getKind() const { return Kind; } /// Print - Print this Job in -### format. /// /// \param OS - The stream to print on. /// \param Terminator - A string to print at the end of the line. /// \param Quote - Should separate arguments be quoted. /// \param CrashReport - Whether to print for inclusion in a crash report. virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, bool CrashReport = false) const = 0; }; /// Command - An executable path/name and argument vector to /// execute. class Command : public Job { /// Source - The action which caused the creation of this job. const Action &Source; /// Tool - The tool which caused the creation of this job. const Tool &Creator; /// The executable to run. const char *Executable; /// The list of program arguments (not including the implicit first /// argument, which will be the executable). llvm::opt::ArgStringList Arguments; public: Command(const Action &_Source, const Tool &_Creator, const char *_Executable, const llvm::opt::ArgStringList &_Arguments); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, bool CrashReport = false) const override; virtual int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const; /// getSource - Return the Action which caused the creation of this job. const Action &getSource() const { return Source; } /// getCreator - Return the Tool which caused the creation of this job. const Tool &getCreator() const { return Creator; } const char *getExecutable() const { return Executable; } const llvm::opt::ArgStringList &getArguments() const { return Arguments; } static bool classof(const Job *J) { return J->getKind() == CommandClass || J->getKind() == FallbackCommandClass; } }; /// Like Command, but with a fallback which is executed in case /// the primary command crashes. class FallbackCommand : public Command { public: FallbackCommand(const Action &Source_, const Tool &Creator_, const char *Executable_, const ArgStringList &Arguments_, Command *Fallback_); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, bool CrashReport = false) const override; int Execute(const StringRef **Redirects, std::string *ErrMsg, bool *ExecutionFailed) const override; static bool classof(const Job *J) { return J->getKind() == FallbackCommandClass; } private: std::unique_ptr<Command> Fallback; }; /// JobList - A sequence of jobs to perform. class JobList : public Job { public: typedef SmallVector<Job*, 4> list_type; typedef list_type::size_type size_type; typedef list_type::iterator iterator; typedef list_type::const_iterator const_iterator; private: list_type Jobs; public: JobList(); virtual ~JobList(); void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, bool CrashReport = false) const override; /// Add a job to the list (taking ownership). void addJob(Job *J) { Jobs.push_back(J); } /// Clear the job list. void clear(); const list_type &getJobs() const { return Jobs; } size_type size() const { return Jobs.size(); } iterator begin() { return Jobs.begin(); } const_iterator begin() const { return Jobs.begin(); } iterator end() { return Jobs.end(); } const_iterator end() const { return Jobs.end(); } static bool classof(const Job *J) { return J->getKind() == JobListClass; } }; } // end namespace driver } // end namespace clang #endif
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_ #define COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_ namespace gfx { class Point; class PointF; class Rect; } namespace mus { namespace ws { class ServerWindow; // Converts |point| from the coordinates of |from| to the coordinates of |to|. // |from| and |to| must be an ancestors or descendants of each other. gfx::Point ConvertPointBetweenWindows(const ServerWindow* from, const ServerWindow* to, const gfx::Point& point); gfx::PointF ConvertPointFBetweenWindows(const ServerWindow* from, const ServerWindow* to, const gfx::PointF& point); // Converts |rect| from the coordinates of |from| to the coordinates of |to|. // |from| and |to| must be an ancestors or descendants of each other. gfx::Rect ConvertRectBetweenWindows(const ServerWindow* from, const ServerWindow* to, const gfx::Rect& rect); } // namespace ws } // namespace mus #endif // COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_
/** ****************************************************************************** * @file usbd_otp_if.c * @author MCD Application Team * @version V1.0.0 * @date 22-July-2011 * @brief Specific media access Layer for OTP (One Time Programming) memory. ****************************************************************************** * @attention * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2> ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "usbd_otp_if.h" #include "usbd_dfu_mal.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ uint16_t OTP_If_Write (uint32_t Add, uint32_t Len); uint8_t *OTP_If_Read (uint32_t Add, uint32_t Len); uint16_t OTP_If_DeInit(void); uint16_t OTP_If_CheckAdd(uint32_t Add); /* Private variables ---------------------------------------------------------*/ DFU_MAL_Prop_TypeDef DFU_Otp_cb = { OTP_IF_STRING, NULL, /* Init not supported*/ NULL, /* DeInit not supported */ NULL, /* Erase not supported */ OTP_If_Write, OTP_If_Read, OTP_If_CheckAdd, 1, /* Erase Time in ms */ 10 /* Programming Time in ms */ }; /* Private functions ---------------------------------------------------------*/ /** * @brief OTP_If_Write * Memory write routine. * @param Add: Address to be written to. * @param Len: Number of data to be written (in bytes). * @retval MAL_OK if operation is successeful, MAL_FAIL else. */ uint16_t OTP_If_Write(uint32_t Add, uint32_t Len) { uint32_t idx = 0; if (Len & 0x3) /* Not an aligned data */ { for (idx = Len; idx < ((Len & 0xFFFC) + 4); idx++) { MAL_Buffer[idx] = 0xFF; } } /* Data received are Word multiple */ for (idx = 0; idx < Len; idx = idx + 4) { FLASH_ProgramWord(Add, *(uint32_t *)(MAL_Buffer + idx)); Add += 4; } return MAL_OK; } /** * @brief OTP_If_Read * Memory read routine. * @param Add: Address to be read from. * @param Len: Number of data to be read (in bytes). * @retval Pointer to the phyisical address where data should be read. */ uint8_t *OTP_If_Read (uint32_t Add, uint32_t Len) { #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED uint32_t idx = 0; for (idx = 0; idx < Len; idx += 4) { *(uint32_t*)(MAL_Buffer + idx) = *(uint32_t *)(Add + idx); } return (uint8_t*)(MAL_Buffer); #else return (uint8_t*)(Add); #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ } /** * @brief OTP_If_CheckAdd * Check if the address is an allowed address for this memory. * @param Add: Address to be checked. * @param Len: Number of data to be read (in bytes). * @retval MAL_OK if the address is allowed, MAL_FAIL else. */ uint16_t OTP_If_CheckAdd(uint32_t Add) { if ((Add >= OTP_START_ADD) && (Add < OTP_END_ADD)) { return MAL_OK; } else { return MAL_FAIL; } } /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
#include <lua.h> #include <lauxlib.h> #include <string.h> #include "shader.h" #include "screen.h" #include "texture.h" #include "array.h" #include "spritepack.h" #include "render.h" #include "material.h" #include "fault.h" static int lload(lua_State *L) { int prog = (int)luaL_checkinteger(L,1); const char *fs = luaL_checkstring(L, 2); const char *vs = luaL_checkstring(L, 3); if (lua_istable(L, 4)) { int texture_number = lua_rawlen(L, 4); ARRAY(const char *, name, texture_number); luaL_checkstack(L, texture_number + 1, NULL); int i; for (i=0;i<texture_number;i++) { lua_rawgeti(L, -1-i, i+1); name[i] = luaL_checkstring(L, -1); } shader_load(prog, fs, vs, texture_number, name); } else { shader_load(prog, fs, vs, 0, NULL); } return 0; } static int lunload(lua_State *L) { shader_unload(); return 0; } /* int texture table float[16] uint32_t color uint32_t additive */ static int ldraw(lua_State *L) { int tex = (int)luaL_checkinteger(L,1); int texid = texture_glid(tex); if (texid == 0) { lua_pushboolean(L,0); return 1; } luaL_checktype(L, 2, LUA_TTABLE); uint32_t color = 0xffffffff; if (!lua_isnoneornil(L,3)) { color = (uint32_t)lua_tointeger(L,3); } uint32_t additive = (uint32_t)luaL_optinteger(L,4,0); shader_program(PROGRAM_PICTURE, NULL); shader_texture(texid, 0); int n = lua_rawlen(L, 2); int point = n/4; if (point * 4 != n) { return luaL_error(L, "Invalid polygon"); } ARRAY(struct vertex_pack, vb, point); int i; for (i=0;i<point;i++) { lua_rawgeti(L, 2, i*2+1); lua_rawgeti(L, 2, i*2+2); lua_rawgeti(L, 2, point*2+i*2+1); lua_rawgeti(L, 2, point*2+i*2+2); float tx = lua_tonumber(L, -4); float ty = lua_tonumber(L, -3); float vx = lua_tonumber(L, -2); float vy = lua_tonumber(L, -1); uint16_t u,v; lua_pop(L,4); screen_trans(&vx,&vy); texture_coord(tex, tx, ty, &u, &v); vb[i].vx = vx + 1.0f; vb[i].vy = vy - 1.0f; vb[i].tx = u; vb[i].ty = v; } if (point == 4) { shader_draw(vb, color, additive); } else { shader_drawpolygon(point, vb, color, additive); } return 0; } static int lblend(lua_State *L) { if (lua_isnoneornil(L,1)) { shader_defaultblend(); } else { int m1 = (int)luaL_checkinteger(L,1); int m2 = (int)luaL_checkinteger(L,2); shader_blend(m1,m2); } return 0; } static int lversion(lua_State *L) { lua_pushinteger(L, shader_version()); return 1; } static int lclear(lua_State *L) { uint32_t c = luaL_optinteger(L, 1, 0xff000000); shader_clear(c); return 0; } static int luniform_bind(lua_State *L) { int prog = luaL_checkinteger(L, 1); luaL_checktype(L, 2, LUA_TTABLE); int n = lua_rawlen(L, 2); int i; for (i=0;i<n;i++) { lua_rawgeti(L, -1, i+1); lua_getfield(L, -1, "name"); const char *name = luaL_checkstring(L, -1); lua_getfield(L, -2, "type"); enum UNIFORM_FORMAT t = (enum UNIFORM_FORMAT)luaL_checkinteger(L, -1); int loc = shader_adduniform(prog, name, t); if (loc != i) { fault("!Warning : Invalid uniform location %s", name); } lua_pop(L, 3); } return 0; } static int luniform_set(lua_State *L) { int prog = luaL_checkinteger(L, 1); int index = luaL_checkinteger(L, 2); enum UNIFORM_FORMAT t = (enum UNIFORM_FORMAT)luaL_checkinteger(L, 3); float v[16]; // 16 is matrix 4x4 int n = shader_uniformsize(t); if (n == 0) { return luaL_error(L, "Invalid uniform format %d", t); } int top = lua_gettop(L); if (top != n + 3) { return luaL_error(L, "Need float %d, only %d passed", n, top - 3); } int i; for (i=0;i<n;i++) { v[i] = luaL_checknumber(L, 4+i); } shader_setuniform(prog, index, t, v); return 0; } static int lmaterial_setuniform(lua_State *L) { struct material * m = (struct material *)lua_touserdata(L, 1); int index = luaL_checkinteger(L, 2); float v[16]; // 16 is matrix 4x4 int top = lua_gettop(L); if (top > sizeof(v)/sizeof(v[0])+2) return luaL_error(L, "too many agrument"); int n = top-2; int i; for (i=0;i<n;i++) { v[i] = luaL_checknumber(L, 3+i); } if (material_setuniform(m, index, n, v)) { return luaL_error(L, "invalid argument number %d", n); } return 0; } static int lmaterial_settexture(lua_State *L) { struct material * m = (struct material *)lua_touserdata(L, 1); int id = luaL_checkinteger(L, 2); int channel = luaL_optinteger(L, 3, 0); if (material_settexture(m, channel, id)) { return luaL_error(L, "invalid argument texture channel %d", channel); } return 0; } static int lshader_texture(lua_State *L) { RID id = 0; if (!lua_isnoneornil(L, 1)) { int texid = luaL_checkinteger(L, 1); id = texture_glid(texid); } int channel = luaL_optinteger(L, 2, 0); shader_texture(id, channel); return 0; } int ejoy2d_shader(lua_State *L) { luaL_Reg l[] = { {"load", lload}, {"unload", lunload}, {"draw", ldraw}, {"blend", lblend}, {"clear", lclear}, {"version", lversion}, {"uniform_bind", luniform_bind }, {"uniform_set", luniform_set }, {"material_setuniform", lmaterial_setuniform }, {"material_settexture", lmaterial_settexture }, {"shader_texture", lshader_texture }, {NULL,NULL}, }; luaL_newlib(L,l); return 1; }
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file tpf/ebcdic.h * @brief EBCDIC/ASCII converson function declarations * * @addtogroup APACHE_OS_TPF * @{ */ #include <sys/types.h> extern const unsigned char os_toascii[256]; extern const unsigned char os_toebcdic[256]; void ebcdic2ascii(void *dest, const void *srce, size_t count); void ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count); void ascii2ebcdic(void *dest, const void *srce, size_t count); /** @} */
/* * Common helper functions for kprobes and uprobes * * Copyright IBM Corp. 2014 */ #include <linux/kprobes.h> #include <asm/dis.h> int probe_is_prohibited_opcode(u16 *insn) { if (!is_known_insn((unsigned char *)insn)) return -EINVAL; switch (insn[0] >> 8) { case 0x0c: /* bassm */ case 0x0b: /* bsm */ case 0x83: /* diag */ case 0x44: /* ex */ case 0xac: /* stnsm */ case 0xad: /* stosm */ return -EINVAL; case 0xc6: switch (insn[0] & 0x0f) { case 0x00: /* exrl */ return -EINVAL; } } switch (insn[0]) { case 0x0101: /* pr */ case 0xb25a: /* bsa */ case 0xb240: /* bakr */ case 0xb258: /* bsg */ case 0xb218: /* pc */ case 0xb228: /* pt */ case 0xb98d: /* epsw */ case 0xe560: /* tbegin */ case 0xe561: /* tbeginc */ case 0xb2f8: /* tend */ return -EINVAL; } return 0; } int probe_get_fixup_type(u16 *insn) { /* default fixup method */ int fixup = FIXUP_PSW_NORMAL; switch (insn[0] >> 8) { case 0x05: /* balr */ case 0x0d: /* basr */ fixup = FIXUP_RETURN_REGISTER; /* if r2 = 0, no branch will be taken */ if ((insn[0] & 0x0f) == 0) fixup |= FIXUP_BRANCH_NOT_TAKEN; break; case 0x06: /* bctr */ case 0x07: /* bcr */ fixup = FIXUP_BRANCH_NOT_TAKEN; break; case 0x45: /* bal */ case 0x4d: /* bas */ fixup = FIXUP_RETURN_REGISTER; break; case 0x47: /* bc */ case 0x46: /* bct */ case 0x86: /* bxh */ case 0x87: /* bxle */ fixup = FIXUP_BRANCH_NOT_TAKEN; break; case 0x82: /* lpsw */ fixup = FIXUP_NOT_REQUIRED; break; case 0xb2: /* lpswe */ if ((insn[0] & 0xff) == 0xb2) fixup = FIXUP_NOT_REQUIRED; break; case 0xa7: /* bras */ if ((insn[0] & 0x0f) == 0x05) fixup |= FIXUP_RETURN_REGISTER; break; case 0xc0: if ((insn[0] & 0x0f) == 0x05) /* brasl */ fixup |= FIXUP_RETURN_REGISTER; break; case 0xeb: switch (insn[2] & 0xff) { case 0x44: /* bxhg */ case 0x45: /* bxleg */ fixup = FIXUP_BRANCH_NOT_TAKEN; break; } break; case 0xe3: /* bctg */ if ((insn[2] & 0xff) == 0x46) fixup = FIXUP_BRANCH_NOT_TAKEN; break; case 0xec: switch (insn[2] & 0xff) { case 0xe5: /* clgrb */ case 0xe6: /* cgrb */ case 0xf6: /* crb */ case 0xf7: /* clrb */ case 0xfc: /* cgib */ case 0xfd: /* cglib */ case 0xfe: /* cib */ case 0xff: /* clib */ fixup = FIXUP_BRANCH_NOT_TAKEN; break; } break; } return fixup; } int probe_is_insn_relative_long(u16 *insn) { /* Check if we have a RIL-b or RIL-c format instruction which * we need to modify in order to avoid instruction emulation. */ switch (insn[0] >> 8) { case 0xc0: if ((insn[0] & 0x0f) == 0x00) /* larl */ return true; break; case 0xc4: switch (insn[0] & 0x0f) { case 0x02: /* llhrl */ case 0x04: /* lghrl */ case 0x05: /* lhrl */ case 0x06: /* llghrl */ case 0x07: /* sthrl */ case 0x08: /* lgrl */ case 0x0b: /* stgrl */ case 0x0c: /* lgfrl */ case 0x0d: /* lrl */ case 0x0e: /* llgfrl */ case 0x0f: /* strl */ return true; } break; case 0xc6: switch (insn[0] & 0x0f) { case 0x02: /* pfdrl */ case 0x04: /* cghrl */ case 0x05: /* chrl */ case 0x06: /* clghrl */ case 0x07: /* clhrl */ case 0x08: /* cgrl */ case 0x0a: /* clgrl */ case 0x0c: /* cgfrl */ case 0x0d: /* crl */ case 0x0e: /* clgfrl */ case 0x0f: /* clrl */ return true; } break; } return false; }
#pragma once #include <stdbool.h> // ///////////////////////////////////////////////////////////////// // Need Soft Serial defines in config.h // ///////////////////////////////////////////////////////////////// // ex. // #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6 // OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5 // // 1: about 137kbps (default) // // 2: about 75kbps // // 3: about 39kbps // // 4: about 26kbps // // 5: about 20kbps // // //// USE OLD API (compatible with let's split serial.c) // ex. // #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 // #define SERIAL_MASTER_BUFFER_LENGTH 1 // // //// USE NEW API // //// USE simple API (using signle-type transaction function) // #define SERIAL_USE_SINGLE_TRANSACTION // //// USE flexible API (using multi-type transaction function) // #define SERIAL_USE_MULTI_TRANSACTION // // ///////////////////////////////////////////////////////////////// //////////////// for backward compatibility //////////////////////////////// #if !defined(SERIAL_USE_SINGLE_TRANSACTION) && !defined(SERIAL_USE_MULTI_TRANSACTION) /* --- USE OLD API (compatible with let's split serial.c) */ #if SERIAL_SLAVE_BUFFER_LENGTH > 0 extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; #endif #if SERIAL_MASTER_BUFFER_LENGTH > 0 extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; #endif void serial_master_init(void); void serial_slave_init(void); int serial_update_buffers(void); #endif // end of USE OLD API //////////////////////////////////////////////////////////////////////////// // Soft Serial Transaction Descriptor typedef struct _SSTD_t { uint8_t *status; uint8_t initiator2target_buffer_size; uint8_t *initiator2target_buffer; uint8_t target2initiator_buffer_size; uint8_t *target2initiator_buffer; } SSTD_t; #define TID_LIMIT( table ) (sizeof(table) / sizeof(SSTD_t)) // initiator is transaction start side void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size); // target is interrupt accept side void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size); // initiator resullt #define TRANSACTION_END 0 #define TRANSACTION_NO_RESPONSE 0x1 #define TRANSACTION_DATA_ERROR 0x2 #define TRANSACTION_TYPE_ERROR 0x4 #ifndef SERIAL_USE_MULTI_TRANSACTION int soft_serial_transaction(void); #else int soft_serial_transaction(int sstd_index); #endif // target status // *SSTD_t.status has // initiator: // TRANSACTION_END // or TRANSACTION_NO_RESPONSE // or TRANSACTION_DATA_ERROR // target: // TRANSACTION_DATA_ERROR // or TRANSACTION_ACCEPTED #define TRANSACTION_ACCEPTED 0x8 #ifdef SERIAL_USE_MULTI_TRANSACTION int soft_serial_get_and_clean_status(int sstd_index); #endif
#ifndef HEADER_CURL_SELECT_H #define HEADER_CURL_SELECT_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ #include "curl_setup.h" #ifdef HAVE_POLL_H #include <poll.h> #elif defined(HAVE_SYS_POLL_H) #include <sys/poll.h> #endif /* * Definition of pollfd struct and constants for platforms lacking them. */ #if !defined(HAVE_STRUCT_POLLFD) && \ !defined(HAVE_SYS_POLL_H) && \ !defined(HAVE_POLL_H) && \ !defined(POLLIN) #define POLLIN 0x01 #define POLLPRI 0x02 #define POLLOUT 0x04 #define POLLERR 0x08 #define POLLHUP 0x10 #define POLLNVAL 0x20 struct pollfd { curl_socket_t fd; short events; short revents; }; #endif #ifndef POLLRDNORM #define POLLRDNORM POLLIN #endif #ifndef POLLWRNORM #define POLLWRNORM POLLOUT #endif #ifndef POLLRDBAND #define POLLRDBAND POLLPRI #endif /* there are three CSELECT defines that are defined in the public header that are exposed to users, but this *IN2 bit is only ever used internally and therefore defined here */ #define CURL_CSELECT_IN2 (CURL_CSELECT_ERR << 1) int Curl_socket_check(curl_socket_t readfd, curl_socket_t readfd2, curl_socket_t writefd, time_t timeout_ms); #define SOCKET_READABLE(x,z) \ Curl_socket_check(x, CURL_SOCKET_BAD, CURL_SOCKET_BAD, z) #define SOCKET_WRITABLE(x,z) \ Curl_socket_check(CURL_SOCKET_BAD, CURL_SOCKET_BAD, x, z) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); /* On non-DOS and non-Winsock platforms, when Curl_ack_eintr is set, * EINTR condition is honored and function might exit early without * awaiting full timeout. Otherwise EINTR will be ignored and full * timeout will elapse. */ extern int Curl_ack_eintr; int Curl_wait_ms(int timeout_ms); #ifdef TPF int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, fd_set* excepts, struct timeval* tv); #endif /* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1], which unfortunately makes it impossible for us to easily check if they're valid */ #if defined(USE_WINSOCK) || defined(TPF) #define VALID_SOCK(x) 1 #define VERIFY_SOCK(x) Curl_nop_stmt #else #define VALID_SOCK(s) (((s) >= 0) && ((s) < FD_SETSIZE)) #define VERIFY_SOCK(x) do { \ if(!VALID_SOCK(x)) { \ SET_SOCKERRNO(EINVAL); \ return -1; \ } \ } WHILE_FALSE #endif #endif /* HEADER_CURL_SELECT_H */
/* * libEtPan! -- a mail stuff library * * Copyright (C) 2001, 2002 - DINH Viet Hoa * 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 libEtPan! project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * $Id$ */ #ifndef __MMAP_STRING_H__ #define __MMAP_STRING_H__ #include <sys/types.h> #ifdef __cplusplus extern "C" { #endif /* #define TMPDIR "/tmp" */ typedef struct _MMAPString MMAPString; struct _MMAPString { char * str; size_t len; size_t allocated_len; int fd; size_t mmapped_size; /* char * old_non_mmapped_str; */ }; /* configure location of mmaped files */ void mmap_string_set_tmpdir(char * directory); /* Strings */ MMAPString * mmap_string_new (const char * init); MMAPString * mmap_string_new_len (const char * init, size_t len); MMAPString * mmap_string_sized_new (size_t dfl_size); void mmap_string_free (MMAPString * string); MMAPString * mmap_string_assign (MMAPString * string, const char * rval); MMAPString * mmap_string_truncate (MMAPString *string, size_t len); MMAPString * mmap_string_set_size (MMAPString * string, size_t len); MMAPString * mmap_string_insert_len (MMAPString * string, size_t pos, const char * val, size_t len); MMAPString * mmap_string_append (MMAPString * string, const char * val); MMAPString * mmap_string_append_len (MMAPString * string, const char * val, size_t len); MMAPString * mmap_string_append_c (MMAPString * string, char c); MMAPString * mmap_string_prepend (MMAPString * string, const char * val); MMAPString * mmap_string_prepend_c (MMAPString * string, char c); MMAPString * mmap_string_prepend_len (MMAPString * string, const char * val, size_t len); MMAPString * mmap_string_insert (MMAPString * string, size_t pos, const char * val); MMAPString * mmap_string_insert_c (MMAPString *string, size_t pos, char c); MMAPString * mmap_string_erase(MMAPString * string, size_t pos, size_t len); void mmap_string_set_ceil(size_t ceil); int mmap_string_ref(MMAPString * string); int mmap_string_unref(char * str); #ifdef __cplusplus } #endif #endif /* __MMAP_STRING_H__ */
/* * Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 LunarG, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and/or associated documentation files (the "Materials"), to * deal in the Materials without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Materials, and to permit persons to whom the Materials are * furnished to do so, subject to the following conditions: * * The above copyright notice(s) and this permission notice shall be included in * all copies or substantial portions of the Materials. * * THE MATERIALS ARE 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 MATERIALS OR THE * USE OR OTHER DEALINGS IN THE MATERIALS. * * Author: Cody Northrop <cody@lunarg.com> */ #ifndef ICD_SPV_H #define ICD_SPV_H #include <stdint.h> #define ICD_SPV_MAGIC 0x07230203 #define ICD_SPV_VERSION 99 struct icd_spv_header { uint32_t magic; uint32_t version; uint32_t gen_magic; // Generator's magic number }; #endif /* ICD_SPV_H */
/* Test for rejection of taking address of bit-fields. */ /* Origin: Joseph Myers <joseph@codesourcery.com> */ /* { dg-do compile } */ /* { dg-options "" } */ #include <stddef.h> struct s { int a : 1; } x, *y; int a = offsetof (struct s, a); /* { dg-error "error: attempt to take address of bit-field structure member 'a'" } */ void *b = &x.a; /* { dg-error "error: cannot take address of bit-field 'a'" } */ void *c = &y->a; /* { dg-error "error: cannot take address of bit-field 'a'" } */
#ifndef __LINUX_PERCPU_H #define __LINUX_PERCPU_H #include <linux/spinlock.h> /* For preempt_disable() */ #include <linux/slab.h> /* For kmalloc() */ #include <linux/smp.h> #include <linux/string.h> /* For memset() */ #include <linux/cpumask.h> #include <asm/percpu.h> /* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ #ifndef PERCPU_ENOUGH_ROOM #define PERCPU_ENOUGH_ROOM 32768 #endif /* * Must be an lvalue. Since @var must be a simple identifier, * we force a syntax error here if it isn't. */ #define get_cpu_var(var) (*({ \ extern int simple_identifier_##var(void); \ preempt_disable(); \ &__get_cpu_var(var); })) #define put_cpu_var(var) preempt_enable() #ifdef CONFIG_SMP struct percpu_data { void *ptrs[NR_CPUS]; }; #define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) /* * Use this to get to a cpu's version of the per-cpu object dynamically * allocated. Non-atomic access to the current CPU's version should * probably be combined with get_cpu()/put_cpu(). */ #define percpu_ptr(ptr, cpu) \ ({ \ struct percpu_data *__p = __percpu_disguise(ptr); \ (__typeof__(ptr))__p->ptrs[(cpu)]; \ }) extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu); extern void percpu_depopulate(void *__pdata, int cpu); extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, cpumask_t *mask); extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask); extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); extern void percpu_free(void *__pdata); #else /* CONFIG_SMP */ #define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) static inline void percpu_depopulate(void *__pdata, int cpu) { } static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) { } static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) { return percpu_ptr(__pdata, cpu); } static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, cpumask_t *mask) { return 0; } static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) { return kzalloc(size, gfp); } static inline void percpu_free(void *__pdata) { kfree(__pdata); } #endif /* CONFIG_SMP */ #define percpu_populate_mask(__pdata, size, gfp, mask) \ __percpu_populate_mask((__pdata), (size), (gfp), &(mask)) #define percpu_depopulate_mask(__pdata, mask) \ __percpu_depopulate_mask((__pdata), &(mask)) #define percpu_alloc_mask(size, gfp, mask) \ __percpu_alloc_mask((size), (gfp), &(mask)) #define percpu_alloc(size, gfp) percpu_alloc_mask((size), (gfp), cpu_online_map) /* (legacy) interface for use without CPU hotplug handling */ #define __alloc_percpu(size) percpu_alloc_mask((size), GFP_KERNEL, \ cpu_possible_map) #define alloc_percpu(type) (type *)__alloc_percpu(sizeof(type)) #define free_percpu(ptr) percpu_free((ptr)) #define per_cpu_ptr(ptr, cpu) percpu_ptr((ptr), (cpu)) #endif /* __LINUX_PERCPU_H */
/* * This file is part of Libav. * * Libav 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. * * Libav 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 Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_AVFFT_H #define AVCODEC_AVFFT_H /** * @file * @ingroup lavc_fft * FFT functions */ /** * @defgroup lavc_fft FFT functions * @ingroup lavc_misc * * @{ */ typedef float FFTSample; typedef struct FFTComplex { FFTSample re, im; } FFTComplex; typedef struct FFTContext FFTContext; /** * Set up a complex FFT. * @param nbits log2 of the length of the input array * @param inverse if 0 perform the forward transform, if 1 perform the inverse */ FFTContext *av_fft_init(int nbits, int inverse); /** * Do the permutation needed BEFORE calling ff_fft_calc(). */ void av_fft_permute(FFTContext *s, FFTComplex *z); /** * Do a complex FFT with the parameters defined in av_fft_init(). The * input data must be permuted before. No 1.0/sqrt(n) normalization is done. */ void av_fft_calc(FFTContext *s, FFTComplex *z); void av_fft_end(FFTContext *s); FFTContext *av_mdct_init(int nbits, int inverse, double scale); void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); void av_mdct_end(FFTContext *s); /* Real Discrete Fourier Transform */ enum RDFTransformType { DFT_R2C, IDFT_C2R, IDFT_R2C, DFT_C2R, }; typedef struct RDFTContext RDFTContext; /** * Set up a real FFT. * @param nbits log2 of the length of the input array * @param trans the type of transform */ RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); void av_rdft_calc(RDFTContext *s, FFTSample *data); void av_rdft_end(RDFTContext *s); /* Discrete Cosine Transform */ typedef struct DCTContext DCTContext; enum DCTTransformType { DCT_II = 0, DCT_III, DCT_I, DST_I, }; /** * Set up DCT. * @param nbits size of the input array: * (1 << nbits) for DCT-II, DCT-III and DST-I * (1 << nbits) + 1 for DCT-I * * @note the first element of the input of DST-I is ignored */ DCTContext *av_dct_init(int nbits, enum DCTTransformType type); void av_dct_calc(DCTContext *s, FFTSample *data); void av_dct_end (DCTContext *s); /** * @} */ #endif /* AVCODEC_AVFFT_H */
/* radare - LGPL - Copyright 2015 - pancake */ #include <r_anal.h> R_API void r_space_new(RSpaces *s, const char *name, void (*unset_for)(void*,int), int (*count_for)(void*,int), void (*rename_for)(void*,int,const char*,const char*), void *user) { int i; s->name = r_str_new (name); s->space_idx = -1; s->spacestack = r_list_new (); s->cb_printf = (PrintfCallback)printf; s->unset_for = unset_for; s->count_for = count_for; s->rename_for = rename_for; s->user = user; for (i = 0; i < R_SPACES_MAX; i++) { s->spaces[i] = NULL; } } R_API void r_space_free(RSpaces *s) { int i; for (i = 0; i < R_SPACES_MAX; i++) { R_FREE (s->spaces[i]); } r_list_free (s->spacestack); free (s->name); } R_API int r_space_get(RSpaces *s, const char *name) { int i; if (!name || *name == '*') { return -1; } for (i = 0; i < R_SPACES_MAX; i++) { if (s->spaces[i] && !strcmp (name, s->spaces[i])) { return i; } } return -1; } R_API const char *r_space_get_i(RSpaces *s, int idx) { if (idx==-1 || idx>=R_SPACES_MAX) { return ""; } return s->spaces[idx]; } R_API int r_space_add(RSpaces *s, const char *name) { int i; if (!name || *name == '*') { return -1; } for (i = 0; i < R_SPACES_MAX; i++) { if (s->spaces[i] && !strcmp (name, s->spaces[i])) { return i; } } // not found for (i = 0; i < R_SPACES_MAX; i++) { if (!s->spaces[i]) { s->spaces[i] = strdup (name); return i; } } return -1; } R_API bool r_space_push(RSpaces *s, const char *name) { int ret = false; if (name && *name) { if (s->space_idx >= 0 && s->spaces[s->space_idx]) { r_list_push (s->spacestack, s->spaces[s->space_idx]); } else { r_list_push (s->spacestack, "*"); } r_space_set (s, name); ret = true; } return ret; } R_API bool r_space_pop(RSpaces *s) { char *p = r_list_pop (s->spacestack); if (p) { if (*p) { r_space_set (s, p); } return true; } return false; } R_API int r_space_set(RSpaces *s, const char *name) { s->space_idx = r_space_add (s, name); return s->space_idx; } R_API int r_space_unset (RSpaces *s, const char *name) { int i, count = 0; if (!name) { r_space_set (s, NULL); } for (i = 0; i < R_SPACES_MAX; i++) { if (!s->spaces[i]) { continue; } if (!name || !strcmp (name, s->spaces[i])) { if (s->space_idx == i) { s->space_idx = -1; } R_FREE (s->spaces[i]); if (s->unset_for) { s->unset_for (s, i); } count++; } } return count; } static int r_space_count (RSpaces *s, int n) { if (s->count_for) { return s->count_for (s, n); } return 0; } R_API int r_space_list(RSpaces *s, int mode) { const char *defspace = NULL; int count, len, i, j = 0; if (mode == 'j') { s->cb_printf ("["); } for (i = 0; i < R_SPACES_MAX; i++) { if (!s->spaces[i]) { continue; } count = r_space_count (s, i); if (mode == 'j') { s->cb_printf ("%s{\"name\":\"%s\"%s,\"count\":%d}", j? ",": "", s->spaces[i], (i == s->space_idx)? ",\"selected\":true": "", count); } else if (mode == '*') { s->cb_printf ("%s %s\n", s->name, s->spaces[i]); if (i == s->space_idx) { defspace = s->spaces[i]; } } else { #define INDENT 5 char num0[64], num1[64], spaces[32]; snprintf (num0, sizeof (num0), "%d", i); snprintf (num1, sizeof (num1), "%d", count); memset (spaces, ' ', sizeof (spaces)); len = strlen (num0) + strlen (num1); if (len < INDENT) { spaces[INDENT-len] = 0; } else { spaces[0] = 0; } s->cb_printf ("%s%s %s %c %s\n", num0, spaces, num1, (i == s->space_idx)? '*': '.', s->spaces[i]); } j++; } if (defspace) { s->cb_printf ("%s %s # current\n", s->name, defspace); } if (mode == 'j') { s->cb_printf ("]\n"); } return j; } R_API bool r_space_rename (RSpaces *s, const char *oname, const char *nname) { int i; if (!oname) { if (s->space_idx == -1) { return false; } oname = s->spaces[s->space_idx]; } if (!nname) { return false; } while (*oname==' ') { oname++; } while (*nname==' ') { nname++; } if (r_space_get (s, nname) != -1) { eprintf ("error: dupplicated name\n"); return false; } for (i = 0; i < R_SPACES_MAX; i++) { if (s->spaces[i] && !strcmp (oname, s->spaces[i])) { if (s->rename_for) { s->rename_for (s, i, oname, nname); } free (s->spaces[i]); s->spaces[i] = strdup (nname); return true; } } return false; }
#pragma once #include <string> void EngineProcess(); void ClipboardPush(std::string text); std::string ClipboardPull(); int GetModifiers();
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef READER_READER_GROUP_H_ #define READER_READER_GROUP_H_ #include "block_reader.h" #include <memory> #include <vector> #include <mutex> namespace hdfs { /** * Provide a way of logically grouping ephemeral block readers * so that their status can be monitored or changed. * * Note: This does not attempt to extend the reader life * cycle. Readers are assumed to be owned by something else * using a shared_ptr. **/ class ReaderGroup { public: ReaderGroup() {}; void AddReader(std::shared_ptr<BlockReader> reader); /* find live readers, promote to shared_ptr */ std::vector<std::shared_ptr<BlockReader>> GetLiveReaders(); private: /* remove weak_ptrs that don't point to live object */ void ClearDeadReaders(); std::recursive_mutex state_lock_; std::vector<std::weak_ptr<BlockReader>> readers_; }; } // end namespace hdfs #endif
#ifndef ALIANALYSISTASKGENMCRIDGE_H #define ALIANALYSISTASKGENMCRIDGE_H using namespace std; class AliMultSelection; class AliVMultiplicity; class TClonesArray; class AliJJetTask; class AliDirList; class AliJetContainer; class AliParticleContainer; class AliClusterContainer; class AliEmcalTrackSelection; class AliAnalysisUtils; class AliCalorimeterUtils; class AliMultSelection; class TLorentzVector; #include "TFile.h" #include <TSystem.h> #include <TGrid.h> #include "THnSparse.h" #include "AliAnalysisTaskSE.h" #include "AliTriggerAnalysis.h" #include "AliESDtrackCuts.h" #include "AliESDEvent.h" #include "AliAODEvent.h" #include "AliPIDCombined.h" #include "THistManager.h" #include "AliAODMCParticle.h" #include <deque> #include <iostream> #include <fstream> #include "AliAnalysisUtils.h" #include <vector> #include <TVector.h> #include <TRandom.h> #include <TString.h> #include <TLorentzVector.h> #include "AliJJetTask.h" #include "AliAnalysisTaskEmcalJet.h" #include "AliJetContainer.h" #include "AliInputEventHandler.h" #include <TParticle.h> #include "AliJFJTask.h" class AliAnalysisTaskGenMCRidge : public AliAnalysisTaskEmcalJet { public: typedef std::vector<Bool_t> Bool_1d; typedef std::vector<Double_t> Double1D; typedef std::vector<int> Int1D; typedef std::vector<Double1D> Double2D; typedef std::vector<TLorentzVector> TLorentzVector1D; AliAnalysisTaskGenMCRidge(); AliAnalysisTaskGenMCRidge ( const char *name , const char *option ); AliAnalysisTaskGenMCRidge ( const AliAnalysisTaskGenMCRidge& ap ); AliAnalysisTaskGenMCRidge& operator = ( const AliAnalysisTaskGenMCRidge& ap ); ~AliAnalysisTaskGenMCRidge(); virtual void UserCreateOutputObjects(); virtual void Exec(Option_t *); virtual void FinishTaskOutput(); virtual void Terminate(Option_t *); void RhoSparse(AliJetContainer *ktContainer, AliJetContainer *aktContainer, Int_t numberofexcludingjets); Bool_t isOverlapping(AliEmcalJet* jet1, AliEmcalJet* jet2); double GetMultiplicity( AliStack* stack ); bool GetProperTracks( AliStack* stack ); void GetCorrelations(); void SetPtHardMin( double pthardmin ){fPtHardMin = pthardmin; }; void SetPtHardMax( double pthardmax ){fPtHardMax = pthardmax; }; void SetJFJTaskName(TString name){ fJFJTaskName=name; } void ESETagging(int iESE, double lpPT); TAxis AxisFix( TString name, int nbin, Double_t xmin, Double_t xmax); TAxis AxisVar( TString name, std::vector<Double_t> bin ); TAxis AxisLog( TString name, int nbin, Double_t xmin, Double_t xmax , Double_t xmin0); TAxis AxisStr( TString name, std::vector<TString> bin ); THnSparse * CreateTHnSparse(TString name, TString title , Int_t ndim, std::vector<TAxis> bins, Option_t * opt=""); THnSparse * CreateTHnSparse(TString name, TString title , TString templ, Option_t * opt=""); Long64_t FillTHnSparse( TString name, std::vector<Double_t> x, Double_t w=1.); Long64_t FillTHnSparse( THnSparse *h, std::vector<Double_t> x, Double_t w=1.); private: typedef std::vector < TParticle* > tracklist; typedef std::deque<tracklist> eventpool; typedef std::vector<vector<eventpool> > mixingpool; mixingpool fEMpool; //! TAxis binCent; //! TAxis binTPt; //! TAxis binAPt; //! TAxis binPhi; //! TAxis binEta; //! TAxis binLHPt; //! TAxis binJetPt; //! TAxis binNtrig; //! TAxis binZ; //! AliInputEventHandler* fMcHandler=nullptr; //! AliMCEvent* fMcEvent=nullptr; //! AliStack* fStack=nullptr; //! AliDirList* fOutput=nullptr; //! THistManager* fHistos=nullptr; //! TString fOption; std::vector < TParticle* > goodTracks; //! std::vector < Double_t > NTracksPerPtBin; //! Double_t RHO; Double_t fMult; Double_t fZ; Double_t fLHPt; Double_t fJetPt; Int_t fbookingsize = 7; double fPtHardMin; double fPtHardMax; Bool_t TagThisEvent[5]; AliJFJTask *fJFJTask; TString fJFJTaskName; ClassDef(AliAnalysisTaskGenMCRidge, 1); }; #endif
//===-- test_helpers.h ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file is a part of XRay, a function call tracing system. // //===----------------------------------------------------------------------===// #ifndef COMPILER_RT_LIB_XRAY_TESTS_TEST_HELPERS_H_ #define COMPILER_RT_LIB_XRAY_TESTS_TEST_HELPERS_H_ #include "xray_buffer_queue.h" #include "xray_segmented_array.h" #include "llvm/XRay/Trace.h" #include "llvm/XRay/XRayRecord.h" #include "gmock/gmock.h" // TODO: Move these to llvm/include/Testing/XRay/... namespace llvm { namespace xray { std::string RecordTypeAsString(RecordTypes T); void PrintTo(RecordTypes T, std::ostream *OS); void PrintTo(const XRayRecord &R, std::ostream *OS); void PrintTo(const Trace &T, std::ostream *OS); namespace testing { MATCHER_P(FuncId, F, "") { *result_listener << "where the function id is " << F; return arg.FuncId == F; } MATCHER_P(RecordType, T, "") { *result_listener << "where the record type is " << RecordTypeAsString(T); return arg.Type == T; } MATCHER_P(HasArg, A, "") { *result_listener << "where args contains " << A; return !arg.CallArgs.empty() && std::any_of(arg.CallArgs.begin(), arg.CallArgs.end(), [this](decltype(A) V) { return V == A; }); } MATCHER_P(TSCIs, M, std::string("TSC is ") + ::testing::PrintToString(M)) { return ::testing::Matcher<decltype(arg.TSC)>(M).MatchAndExplain( arg.TSC, result_listener); } } // namespace testing } // namespace xray } // namespace llvm namespace __xray { std::string serialize(BufferQueue &Buffers, int32_t Version); template <class T> void PrintTo(const Array<T> &A, std::ostream *OS) { *OS << "["; bool first = true; for (const auto &E : A) { if (!first) { *OS << ", "; } PrintTo(E, OS); first = false; } *OS << "]"; } } // namespace __xray #endif // COMPILER_RT_LIB_XRAY_TESTS_TEST_HELPERS_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 GLK_ALAN3_FNMATCH #define GLK_ALAN3_FNMATCH /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that 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. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 */ namespace Glk { namespace Alan3 { #define FNM_NOMATCH 1 /* Match failed. */ #define FNM_NOSYS 2 /* Function not supported (unused). */ #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ #define FNM_PERIOD 0x04 /* Period must be matched by period. */ #ifndef _POSIX_SOURCE #define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */ #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ #define FNM_IGNORECASE FNM_CASEFOLD #define FNM_FILE_NAME FNM_PATHNAME #endif extern int fnmatch(const char *pattern, const char *string, int flags); } // End of namespace Alan3 } // End of namespace Glk #endif
/* Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include "pthreadP.h" int pthread_spin_lock (lock) pthread_spinlock_t *lock; { int *p = (int *) lock; while (__builtin_expect (__sync_val_compare_and_swap (p, 0, 1), 0)) { /* Spin without using the atomic instruction. */ do __asm __volatile ("hint @pause" : : : "memory"); while (*p); } return 0; }
/* { dg-do run { target aarch64_sve_hw } } */ /* { dg-options "-O3" } */ #include "fcvtz_signed_1.c" #define ARRAY_SIZE 81 #define VAL1 ((i * 17) - 180) #define VAL2 ((i * 237.86) - (29 * 237.86)) #define VAL3 ((double) ((i * 0xf8dfef2f) - (11 * 0xf8dfef2f))) int __attribute__ ((optimize (1))) main (void) { static int16_t array_dest16[ARRAY_SIZE]; static int32_t array_dest32[ARRAY_SIZE]; static int64_t array_dest64[ARRAY_SIZE]; _Float16 array_source16[ARRAY_SIZE]; float array_source32[ARRAY_SIZE]; double array_source64[ARRAY_SIZE]; for (int i = 0; i < ARRAY_SIZE; i++) { array_source16[i] = VAL1; array_source32[i] = VAL2; array_source64[i] = VAL3; asm volatile ("" ::: "memory"); } vfcvtz_16 (array_dest16, array_source16, ARRAY_SIZE); for (int i = 0; i < ARRAY_SIZE; i++) if (array_dest16[i] != (int16_t) VAL1) __builtin_abort (); vfcvtz_32 (array_dest32, array_source32, ARRAY_SIZE); for (int i = 0; i < ARRAY_SIZE; i++) if (array_dest32[i] != (int32_t) VAL2) __builtin_abort (); vfcvtz_64 (array_dest64, array_source64, ARRAY_SIZE); for (int i = 0; i < ARRAY_SIZE; i++) if (array_dest64[i] != (int64_t) VAL3) __builtin_abort (); return 0; }
#ifndef _ASM_GENERIC_PGTABLE_H #define _ASM_GENERIC_PGTABLE_H #ifndef __HAVE_ARCH_PTEP_ESTABLISH /* * Establish a new mapping: * - flush the old one * - update the page tables * - inform the TLB about the new one * * We hold the mm semaphore for reading and vma->vm_mm->page_table_lock. * * Note: the old pte is known to not be writable, so we don't need to * worry about dirty bits etc getting lost. */ #ifndef __HAVE_ARCH_SET_PTE_ATOMIC #define ptep_establish(__vma, __address, __ptep, __entry) \ do { \ set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ flush_tlb_page(__vma, __address); \ } while (0) #else /* __HAVE_ARCH_SET_PTE_ATOMIC */ #define ptep_establish(__vma, __address, __ptep, __entry) \ do { \ set_pte_atomic(__ptep, __entry); \ flush_tlb_page(__vma, __address); \ } while (0) #endif /* __HAVE_ARCH_SET_PTE_ATOMIC */ #endif #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS /* * Largely same as above, but only sets the access flags (dirty, * accessed, and writable). Furthermore, we know it always gets set * to a "more permissive" setting, which allows most architectures * to optimize this. */ #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ do { \ set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ flush_tlb_page(__vma, __address); \ } while (0) #endif #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define ptep_test_and_clear_young(__vma, __address, __ptep) \ ({ \ pte_t __pte = *(__ptep); \ int r = 1; \ if (!pte_young(__pte)) \ r = 0; \ else \ set_pte_at((__vma)->vm_mm, (__address), \ (__ptep), pte_mkold(__pte)); \ r; \ }) #endif #ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH #define ptep_clear_flush_young(__vma, __address, __ptep) \ ({ \ int __young; \ __young = ptep_test_and_clear_young(__vma, __address, __ptep); \ if (__young) \ flush_tlb_page(__vma, __address); \ __young; \ }) #endif #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY #define ptep_test_and_clear_dirty(__vma, __address, __ptep) \ ({ \ pte_t __pte = *__ptep; \ int r = 1; \ if (!pte_dirty(__pte)) \ r = 0; \ else \ set_pte_at((__vma)->vm_mm, (__address), (__ptep), \ pte_mkclean(__pte)); \ r; \ }) #endif #ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH #define ptep_clear_flush_dirty(__vma, __address, __ptep) \ ({ \ int __dirty; \ __dirty = ptep_test_and_clear_dirty(__vma, __address, __ptep); \ if (__dirty) \ flush_tlb_page(__vma, __address); \ __dirty; \ }) #endif #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR #define ptep_get_and_clear(__mm, __address, __ptep) \ ({ \ pte_t __pte = *(__ptep); \ pte_clear((__mm), (__address), (__ptep)); \ __pte; \ }) #endif #ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH #define ptep_clear_flush(__vma, __address, __ptep) \ ({ \ pte_t __pte; \ __pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep); \ flush_tlb_page(__vma, __address); \ __pte; \ }) #endif #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep) { pte_t old_pte = *ptep; set_pte_at(mm, address, ptep, pte_wrprotect(old_pte)); } #endif #ifndef __HAVE_ARCH_PTE_SAME #define pte_same(A,B) (pte_val(A) == pte_val(B)) #endif #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY #define page_test_and_clear_dirty(page) (0) #define pte_maybe_dirty(pte) pte_dirty(pte) #else #define pte_maybe_dirty(pte) (1) #endif #ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG #define page_test_and_clear_young(page) (0) #endif #ifndef __HAVE_ARCH_PGD_OFFSET_GATE #define pgd_offset_gate(mm, addr) pgd_offset(mm, addr) #endif #ifndef __HAVE_ARCH_LAZY_MMU_PROT_UPDATE #define lazy_mmu_prot_update(pte) do { } while (0) #endif /* * When walking page tables, get the address of the next boundary, * or the end address of the range if that comes earlier. Although no * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout. */ #define pgd_addr_end(addr, end) \ ({ unsigned long __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \ (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) #ifndef pud_addr_end #define pud_addr_end(addr, end) \ ({ unsigned long __boundary = ((addr) + PUD_SIZE) & PUD_MASK; \ (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) #endif #ifndef pmd_addr_end #define pmd_addr_end(addr, end) \ ({ unsigned long __boundary = ((addr) + PMD_SIZE) & PMD_MASK; \ (__boundary - 1 < (end) - 1)? __boundary: (end); \ }) #endif #ifndef __ASSEMBLY__ /* * When walking page tables, we usually want to skip any p?d_none entries; * and any p?d_bad entries - reporting the error before resetting to none. * Do the tests inline, but report and clear the bad entry in mm/memory.c. */ void pgd_clear_bad(pgd_t *); void pud_clear_bad(pud_t *); void pmd_clear_bad(pmd_t *); static inline int pgd_none_or_clear_bad(pgd_t *pgd) { if (pgd_none(*pgd)) return 1; if (unlikely(pgd_bad(*pgd))) { pgd_clear_bad(pgd); return 1; } return 0; } static inline int pud_none_or_clear_bad(pud_t *pud) { if (pud_none(*pud)) return 1; if (unlikely(pud_bad(*pud))) { pud_clear_bad(pud); return 1; } return 0; } static inline int pmd_none_or_clear_bad(pmd_t *pmd) { if (pmd_none(*pmd)) return 1; if (unlikely(pmd_bad(*pmd))) { pmd_clear_bad(pmd); return 1; } return 0; } #endif /* !__ASSEMBLY__ */ #endif /* _ASM_GENERIC_PGTABLE_H */
#ifndef LOADER_H #define LOADER_H #include "qapi/qmp/qdict.h" #include "hw/nvram/fw_cfg.h" /* loader.c */ /** * get_image_size: retrieve size of an image file * @filename: Path to the image file * * Returns the size of the image file on success, -1 otherwise. * On error, errno is also set as appropriate. */ int get_image_size(const char *filename); int load_image(const char *filename, uint8_t *addr); /* deprecated */ ssize_t load_image_size(const char *filename, void *addr, size_t size); int load_image_targphys(const char *filename, hwaddr, uint64_t max_sz); int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz); #define ELF_LOAD_FAILED -1 #define ELF_LOAD_NOT_ELF -2 #define ELF_LOAD_WRONG_ARCH -3 #define ELF_LOAD_WRONG_ENDIAN -4 const char *load_elf_strerror(int error); int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t), void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr, int big_endian, int elf_machine, int clear_lsb); int load_aout(const char *filename, hwaddr addr, int max_sz, int bswap_needed, hwaddr target_page_size); int load_uimage(const char *filename, hwaddr *ep, hwaddr *loadaddr, int *is_linux); /** * load_ramdisk: * @filename: Path to the ramdisk image * @addr: Memory address to load the ramdisk to * @max_sz: Maximum allowed ramdisk size (for non-u-boot ramdisks) * * Load a ramdisk image with U-Boot header to the specified memory * address. * * Returns the size of the loaded image on success, -1 otherwise. */ int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz); ssize_t read_targphys(const char *name, int fd, hwaddr dst_addr, size_t nbytes); void pstrcpy_targphys(const char *name, hwaddr dest, int buf_size, const char *source); extern bool option_rom_has_mr; extern bool rom_file_has_mr; int rom_add_file(const char *file, const char *fw_dir, hwaddr addr, int32_t bootindex, bool option_rom); void *rom_add_blob(const char *name, const void *blob, size_t len, hwaddr addr, const char *fw_file_name, FWCfgReadCallback fw_callback, void *callback_opaque); int rom_add_elf_program(const char *name, void *data, size_t datasize, size_t romsize, hwaddr addr); int rom_load_all(void); void rom_load_done(void); void rom_set_fw(FWCfgState *f); int rom_copy(uint8_t *dest, hwaddr addr, size_t size); void *rom_ptr(hwaddr addr); void do_info_roms(Monitor *mon, const QDict *qdict); #define rom_add_file_fixed(_f, _a, _i) \ rom_add_file(_f, NULL, _a, _i, false) #define rom_add_blob_fixed(_f, _b, _l, _a) \ rom_add_blob(_f, _b, _l, _a, NULL, NULL, NULL) #define PC_ROM_MIN_VGA 0xc0000 #define PC_ROM_MIN_OPTION 0xc8000 #define PC_ROM_MAX 0xe0000 #define PC_ROM_ALIGN 0x800 #define PC_ROM_SIZE (PC_ROM_MAX - PC_ROM_MIN_VGA) int rom_add_vga(const char *file); int rom_add_option(const char *file, int32_t bootindex); #endif
/* * RxBuf.h * * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name Texas Instruments 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. */ /***************************************************************************/ /* */ /* MODULE: buf.h */ /* PURPOSE: manages the allocation/free and field access of the BUF */ /* */ /***************************************************************************/ #ifndef _BUF_H_ #define _BUF_H_ #include "tidef.h" #include "queue.h" #include "public_descriptors.h" #define WSPI_PAD_BYTES 16 /* Add padding before data buffer for WSPI overhead */ #define PAYLOAD_ALIGN_PAD_BYTES 4 /* Add an extra word for alignment the MAC payload in case of QoS MSDU */ /** * \brief Buffer for Tx/Rx packets */ typedef void BUF, *PBUF; /* Packet types */ /** * \def RX_BUF_DATA * \brief Macro which gets a pointer to BUF packet header and returns the pointer to the start address of the WLAN packet's data */ #define RX_BUF_DATA(pBuf) ((void*)((TI_UINT8 *)pBuf + sizeof(RxIfDescriptor_t))) /** * \def RX_BUF_LEN * \brief Macro which gets a pointer to BUF packet header and returns the buffer length (without Rx Descriptor) of the WLAN packet */ #define RX_BUF_LEN(pBuf) ( (((RxIfDescriptor_t *)(pBuf))->length << 2) - \ ((RxIfDescriptor_t *)(pBuf))->extraBytes - \ sizeof(RxIfDescriptor_t) ) /** * \def RX_ETH_PKT_DATA * \brief Macro which gets a pointer to BUF packet header and returns the pointer to the start address of the ETH packet's data */ #define RX_ETH_PKT_DATA(pBuf) *((void **)(((TI_UINT32)pBuf + sizeof(RxIfDescriptor_t) + 2) & ~3)) /** * \def RX_ETH_PKT_LEN * \brief Macro which gets a pointer to BUF packet header and returns the buffer length (without Rx Descriptor) of the ETH packet */ #define RX_ETH_PKT_LEN(pBuf) *((TI_UINT32 *)(((TI_UINT32)pBuf + sizeof(RxIfDescriptor_t) + 6) & ~3)) /** \brief BUF Allocation * * \param hOs - OS module object handle * \param len - Length of allocated WBUF * \param ePacketClassTag - The RX packet type (used only in EMP) * \return On success: Pointer to WBUF ; Otherwise: NULL * * \par Description * This function allocates BUF element for Tx/Rx packet * * \sa */ BUF* RxBufAlloc (TI_HANDLE hOs, TI_UINT32 len, PacketClassTag_e ePacketClassTag); /** \brief BUF Free * * \param hOs - OS module object handle * \param pWbuf - Pointer to WBUF which was previously created by user * \return void * * \par Description * This function frees the memory allocated for BUF element * * \sa */ void RxBufFree (TI_HANDLE hOs, void* pBuf); /** \brief BUF Free * * \param hOs - OS module object handle * \param pWbuf - Pointer to WBUF which was previously created by user * \return void * * \par Description * This function increment the start address of data held in BUF element in len. * * \sa */ void RxBufReserve (TI_HANDLE hOs, void* pBuf, TI_UINT32 len); #endif
/***************************************************************************/ /* */ /* afindic.c */ /* */ /* Auto-fitter hinting routines for Indic scripts (body). */ /* */ /* Copyright 2007, 2011-2013 by */ /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /***************************************************************************/ #include "aftypes.h" #include "aflatin.h" #ifdef AF_CONFIG_OPTION_INDIC #include "afindic.h" #include "aferrors.h" #include "afcjk.h" #ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif static FT_Error af_indic_metrics_init( AF_CJKMetrics metrics, FT_Face face ) { /* skip blue zone init in CJK routines */ FT_CharMap oldmap = face->charmap; metrics->units_per_em = face->units_per_EM; if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) face->charmap = NULL; else { af_cjk_metrics_init_widths( metrics, face ); #if 0 /* either need indic specific blue_chars[] or just skip blue zones */ af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars ); #endif af_cjk_metrics_check_digits( metrics, face ); } FT_Set_Charmap( face, oldmap ); return FT_Err_Ok; } static void af_indic_metrics_scale( AF_CJKMetrics metrics, AF_Scaler scaler ) { /* use CJK routines */ af_cjk_metrics_scale( metrics, scaler ); } static FT_Error af_indic_hints_init( AF_GlyphHints hints, AF_CJKMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_init( hints, metrics ); } static FT_Error af_indic_hints_apply( AF_GlyphHints hints, FT_Outline* outline, AF_CJKMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_apply( hints, outline, metrics ); } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** I N D I C S C R I P T C L A S S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ AF_DEFINE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class, AF_WRITING_SYSTEM_INDIC, sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) af_indic_metrics_init, (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, (AF_Script_DoneMetricsFunc) NULL, (AF_Script_InitHintsFunc) af_indic_hints_init, (AF_Script_ApplyHintsFunc) af_indic_hints_apply ) /* XXX: this should probably fine tuned to differentiate better between */ /* scripts... */ static const AF_Script_UniRangeRec af_deva_uniranges[] = { AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL ), /* Indic Range */ AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL ), /* Tibetan */ AF_UNIRANGE_REC( 0x1900UL, 0x194FUL ), /* Limbu */ AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL ), /* Sundanese */ AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL ), /* Meetei Mayak */ AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL ), /* Syloti Nagri */ AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL ), /* Sharada */ AF_UNIRANGE_REC( 0UL, 0UL ) }; #else /* !AF_CONFIG_OPTION_INDIC */ AF_DEFINE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class, AF_WRITING_SYSTEM_INDIC, sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, (AF_Script_DoneMetricsFunc) NULL, (AF_Script_InitHintsFunc) NULL, (AF_Script_ApplyHintsFunc) NULL ) static const AF_Script_UniRangeRec af_deva_uniranges[] = { AF_UNIRANGE_REC( 0UL, 0UL ) }; #endif /* !AF_CONFIG_OPTION_INDIC */ AF_DEFINE_SCRIPT_CLASS( af_deva_script_class, AF_SCRIPT_DEVA, (AF_Blue_Stringset)0, /* XXX */ AF_WRITING_SYSTEM_INDIC, af_deva_uniranges, 'o' /* XXX */ ) /* END */
/* Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <fcntl.h> #include <sysdep.h> int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise); int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); /* Advice the system about the expected behaviour of the application with respect to the file associated with FD. */ int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) { INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, __LONG_LONG_PAIR ((long) (offset >> 32), (long) offset), __LONG_LONG_PAIR ((long) (len >> 32), (long) len), advise); if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) return 0; return INTERNAL_SYSCALL_ERRNO (ret, err); } #include <shlib-compat.h> #if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) int attribute_compat_text_section __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise) { return __posix_fadvise64_l64 (fd, offset, len, advise); } versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3); compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2); #else strong_alias (__posix_fadvise64_l64, posix_fadvise64); #endif
// license:BSD-3-Clause // copyright-holders:Ernesto Corvi /****************************************************************************** Data East Side Pocket hardware ******************************************************************************/ #ifndef MAME_INCLUDES_SIDEPKT_H #define MAME_INCLUDES_SIDEPKT_H #pragma once #include "cpu/mcs51/mcs51.h" #include "machine/gen_latch.h" #include "emupal.h" #include "tilemap.h" class sidepckt_state : public driver_device { public: sidepckt_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch"), m_videoram(*this, "videoram"), m_colorram(*this, "colorram"), m_spriteram(*this, "spriteram") { } void sidepcktb(machine_config &config); void sidepckt(machine_config &config); void init_sidepckt(); protected: virtual void machine_reset() override; virtual void video_start() override; private: required_device<cpu_device> m_maincpu; optional_device<i8751_device> m_mcu; required_device<cpu_device> m_audiocpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; required_device<generic_latch_8_device> m_soundlatch; required_shared_ptr<uint8_t> m_videoram; required_shared_ptr<uint8_t> m_colorram; required_shared_ptr<uint8_t> m_spriteram; tilemap_t *m_bg_tilemap; uint8_t m_mcu_p1; uint8_t m_mcu_p2; uint8_t m_mcu_p3; uint8_t m_scroll_y; uint8_t mcu_r(); void mcu_w(uint8_t data); void mcu_p1_w(uint8_t data); uint8_t mcu_p2_r(); void mcu_p3_w(uint8_t data); void videoram_w(offs_t offset, uint8_t data); void colorram_w(offs_t offset, uint8_t data); uint8_t scroll_y_r(); void scroll_y_w(uint8_t data); TILE_GET_INFO_MEMBER(get_tile_info); void sidepckt_palette(palette_device &palette) const; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void sidepckt_map(address_map &map); void sidepcktb_map(address_map &map); void sound_map(address_map &map); }; #endif // MAME_INCLUDES_SIDEPKT_H
/* DirectMusic DLS Download Definitions * * Copyright (C) 2003-2004 Rok Mandeljc * * This program 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 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WINE_DMUSIC_DLS_H #define __WINE_DMUSIC_DLS_H #include <dls1.h> /***************************************************************************** * Typedef definitions */ typedef LONG GCENT; typedef LONG PCENT; typedef LONG PERCENT; typedef LONG TCENT; typedef LONGLONG REFERENCE_TIME, *LPREFERENCE_TIME; /***************************************************************************** * FOURCC definition */ #ifndef mmioFOURCC typedef DWORD FOURCC; #define mmioFOURCC(ch0,ch1,ch2,ch3) \ ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) #endif /***************************************************************************** * Flags */ #define DMUS_DEFAULT_SIZE_OFFSETTABLE 0x1 #define DMUS_DOWNLOADINFO_INSTRUMENT 0x1 #define DMUS_DOWNLOADINFO_WAVE 0x2 #define DMUS_DOWNLOADINFO_INSTRUMENT2 0x3 #define DMUS_DOWNLOADINFO_WAVEARTICULATION 0x4 #define DMUS_DOWNLOADINFO_STREAMINGWAVE 0x5 #define DMUS_DOWNLOADINFO_ONESHOTWAVE 0x6 #define DMUS_INSTRUMENT_GM_INSTRUMENT 0x1 #define DMUS_MIN_DATA_SIZE 0x4 /***************************************************************************** * Structures */ /* typedef definitions */ typedef struct _DMUS_DOWNLOADINFO DMUS_DOWNLOADINFO, *LPDMUS_DOWNLOADINFO; typedef struct _DMUS_OFFSETTABLE DMUS_OFFSETTABLE, *LPDMUS_OFFSETTABLE; typedef struct _DMUS_INSTRUMENT DMUS_INSTRUMENT, *LPDMUS_INSTRUMENT; typedef struct _DMUS_REGION DMUS_REGION, *LPDMUS_REGION; typedef struct _DMUS_LFOPARAMS DMUS_LFOPARAMS, *LPDMUS_LFOPARAMS; typedef struct _DMUS_VEGPARAMS DMUS_VEGPARAMS, *LPDMUS_VEGPARAMS; typedef struct _DMUS_PEGPARAMS DMUS_PEGPARAMS, *LPDMUS_PEGPARAMS; typedef struct _DMUS_MSCPARAMS DMUS_MSCPARAMS, *LPDMUS_MSCPARAMS; typedef struct _DMUS_ARTICPARAMS DMUS_ARTICPARAMS, *LPDMUS_ARTICPARAMS; typedef struct _DMUS_ARTICULATION DMUS_ARTICULATION, *LPDMUS_ARTICULATION; typedef struct _DMUS_ARTICULATION2 DMUS_ARTICULATION2, *LPDMUS_ARTICULATION2; typedef struct _DMUS_EXTENSIONCHUNK DMUS_EXTENSIONCHUNK, *LPDMUS_EXTENSIONCHUNK; typedef struct _DMUS_COPYRIGHT DMUS_COPYRIGHT, *LPDMUS_COPYRIGHT; typedef struct _DMUS_WAVEDATA DMUS_WAVEDATA, *LPDMUS_WAVEDATA; typedef struct _DMUS_WAVE DMUS_WAVE, *LPDMUS_WAVE; typedef struct _DMUS_NOTERANGE DMUS_NOTERANGE, *LPDMUS_NOTERANGE; typedef struct _DMUS_WAVEARTDL DMUS_WAVEARTDL, *LPDMUS_WAVEARTDL; typedef struct _DMUS_WAVEDL DMUS_WAVEDL, *LPDMUS_WAVEDL; /* actual structures */ struct _DMUS_DOWNLOADINFO { DWORD dwDLType; DWORD dwDLId; DWORD dwNumOffsetTableEntries; DWORD cbSize; }; struct _DMUS_OFFSETTABLE { ULONG ulOffsetTable[DMUS_DEFAULT_SIZE_OFFSETTABLE]; }; struct _DMUS_INSTRUMENT { ULONG ulPatch; ULONG ulFirstRegionIdx; ULONG ulGlobalArtIdx; ULONG ulFirstExtCkIdx; ULONG ulCopyrightIdx; ULONG ulFlags; }; struct _DMUS_REGION { RGNRANGE RangeKey; RGNRANGE RangeVelocity; USHORT fusOptions; USHORT usKeyGroup; ULONG ulRegionArtIdx; ULONG ulNextRegionIdx; ULONG ulFirstExtCkIdx; WAVELINK WaveLink; WSMPL WSMP; /* WLOOP is typedef'ed as struct _rloop in dls1.h. Changed type of * WLOOP[1] from WLOOP to struct _rloop for __cplusplus compat. */ struct _rloop WLOOP[1]; }; struct _DMUS_LFOPARAMS { PCENT pcFrequency; TCENT tcDelay; GCENT gcVolumeScale; PCENT pcPitchScale; GCENT gcMWToVolume; PCENT pcMWToPitch; }; struct _DMUS_VEGPARAMS { TCENT tcAttack; TCENT tcDecay; PERCENT ptSustain; TCENT tcRelease; TCENT tcVel2Attack; TCENT tcKey2Decay; }; struct _DMUS_PEGPARAMS { TCENT tcAttack; TCENT tcDecay; PERCENT ptSustain; TCENT tcRelease; TCENT tcVel2Attack; TCENT tcKey2Decay; PCENT pcRange; }; struct _DMUS_MSCPARAMS { PERCENT ptDefaultPan; }; struct _DMUS_ARTICPARAMS { DMUS_LFOPARAMS LFO; DMUS_VEGPARAMS VolEG; DMUS_PEGPARAMS PitchEG; DMUS_MSCPARAMS Misc; }; struct _DMUS_ARTICULATION { ULONG ulArt1Idx; ULONG ulFirstExtCkIdx; }; struct _DMUS_ARTICULATION2 { ULONG ulArtIdx; ULONG ulFirstExtCkIdx; ULONG ulNextArtIdx; }; struct _DMUS_EXTENSIONCHUNK { ULONG cbSize; ULONG ulNextExtCkIdx; FOURCC ExtCkID; BYTE byExtCk[DMUS_MIN_DATA_SIZE]; }; struct _DMUS_COPYRIGHT { ULONG cbSize; BYTE byCopyright[DMUS_MIN_DATA_SIZE]; }; struct _DMUS_WAVEDATA { ULONG cbSize; BYTE byData[DMUS_MIN_DATA_SIZE]; }; struct _DMUS_WAVE { ULONG ulFirstExtCkIdx; ULONG ulCopyrightIdx; ULONG ulWaveDataIdx; WAVEFORMATEX WaveformatEx; }; struct _DMUS_NOTERANGE { DWORD dwLowNote; DWORD dwHighNote; }; struct _DMUS_WAVEARTDL { ULONG ulDownloadIdIdx; ULONG ulBus; ULONG ulBuffers; ULONG ulMasterDLId; USHORT usOptions; }; struct _DMUS_WAVEDL { ULONG cbWaveData; }; #endif /* __WINE_DMUSIC_DLS_H */
// --------------------------------------------------------------------- // // Copyright (C) 2002 - 2015 by the deal.II authors // // This file is part of the deal.II library. // // The deal.II library is free software; you can use it, redistribute // it, and/or modify it under the terms of the GNU Lesser General // Public License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // The full text of the license can be found in the file LICENSE at // the top level of the deal.II distribution. // // --------------------------------------------------------------------- #ifndef dealii__block_sparse_matrix_ez_templates_h #define dealii__block_sparse_matrix_ez_templates_h #include <deal.II/base/config.h> #include <deal.II/base/memory_consumption.h> #include <deal.II/lac/block_sparse_matrix_ez.h> DEAL_II_NAMESPACE_OPEN template <typename number> BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ () {} template <typename number> BlockSparseMatrixEZ<number>:: BlockSparseMatrixEZ (const unsigned int rows, const unsigned int cols) : row_indices (rows, 0), column_indices (cols, 0) {} // template <typename number> // BlockSparseMatrixEZ<number>::~BlockSparseMatrixEZ () // { // // delete previous content of // // the subobjects array // clear (); // }; template <typename number> BlockSparseMatrixEZ<number> & BlockSparseMatrixEZ<number>:: operator = (const BlockSparseMatrixEZ<number> &m) { Assert (n_block_rows() == m.n_block_rows(), ExcDimensionMismatch(n_block_rows(), m.n_block_rows())); Assert (n_block_cols() == m.n_block_cols(), ExcDimensionMismatch(n_block_cols(), m.n_block_cols())); // this operator does not do // anything except than checking // whether the base objects want to // do something for (unsigned int r=0; r<n_block_rows(); ++r) for (unsigned int c=0; c<n_block_cols(); ++c) block(r,c) = m.block(r,c); return *this; } template <typename number> BlockSparseMatrixEZ<number> & BlockSparseMatrixEZ<number>::operator = (const double d) { (void)d; Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); for (unsigned int r=0; r<n_block_rows(); ++r) for (unsigned int c=0; c<n_block_cols(); ++c) block(r,c) = 0; return *this; } template <typename number> BlockSparseMatrixEZ<number>::BlockSparseMatrixEZ ( const BlockSparseMatrixEZ<number> &m) : Subscriptor (m), row_indices(m.row_indices), column_indices(m.column_indices), blocks(m.blocks) {} template <typename number> void BlockSparseMatrixEZ<number>::reinit (const unsigned int rows, const unsigned int cols) { row_indices.reinit(rows, 0); column_indices.reinit(cols, 0); blocks.reinit(rows, cols); } template <typename number> void BlockSparseMatrixEZ<number>::clear () { row_indices.reinit(0, 0); column_indices.reinit(0, 0); blocks.reinit(0, 0); } template <typename number> bool BlockSparseMatrixEZ<number>::empty () const { for (unsigned int r=0; r<n_block_rows(); ++r) for (unsigned int c=0; c<n_block_cols(); ++c) if (block(r,c).empty () == false) return false; return true; } template <typename number> void BlockSparseMatrixEZ<number>::collect_sizes () { const unsigned int rows = n_block_rows(); const unsigned int columns = n_block_cols(); std::vector<size_type> row_sizes (rows); std::vector<size_type> col_sizes (columns); // first find out the row sizes // from the first block column for (unsigned int r=0; r<rows; ++r) row_sizes[r] = blocks[r][0].m(); // then check that the following // block columns have the same // sizes for (unsigned int c=1; c<columns; ++c) for (unsigned int r=0; r<rows; ++r) Assert (row_sizes[r] == blocks[r][c].m(), ExcDimensionMismatch (row_sizes[r], blocks[r][c].m())); // finally initialize the row // indices with this array row_indices.reinit (row_sizes); // then do the same with the columns for (unsigned int c=0; c<columns; ++c) col_sizes[c] = blocks[0][c].n(); for (unsigned int r=1; r<rows; ++r) for (unsigned int c=0; c<columns; ++c) Assert (col_sizes[c] == blocks[r][c].n(), ExcDimensionMismatch (col_sizes[c], blocks[r][c].n())); // finally initialize the row // indices with this array column_indices.reinit (col_sizes); } DEAL_II_NAMESPACE_CLOSE #endif // ifdef block_sparse_matrix_templates_h
/* tsne.h -*- C++ -*- Jeremy Barnes, 16 January 2010 Copyright (c) 2010 Jeremy Barnes. All rights reserved. Implementation of the TSNE dimensionality reduction algorithm, particularly useful for visualization of data. See http://ict.ewi.tudelft.nl/~lvandermaaten/t-SNE.html L.J.P. van der Maaten and G.E. Hinton. Visualizing High-Dimensional Data Using t-SNE. Journal of Machine Learning Research 9(Nov):2579-2605, 2008. */ #ifndef __jml__tsne__tsne_h__ #define __jml__tsne__tsne_h__ #include "jml/stats/distribution.h" #include <boost/multi_array.hpp> #include <boost/function.hpp> namespace ML { std::pair<double, distribution<float> > perplexity_and_prob(const distribution<float> & D, double beta = 1.0, int i = -1); std::pair<double, distribution<double> > perplexity_and_prob(const distribution<double> & D, double beta = 1.0, int i = -1); /** Given a matrix that gives the a number of points in a vector space of dimension d (ie, a number of points with coordinates of d dimensions), convert to a matrix that gives the square of the distance between each of the points. 2 D = ||X - X || ij i j params: X a (n x d) matrix, where n is the number of points and d is the number of coordinates that each point has D a (n x n) matrix that will be filled in with the distance between any of the two points. Note that by definition the diagonal is zero and the matrix is symmetric; as a result only the lower diagonal needs to be filled in. fill_upper if set, the lower diagonal will be copied into the upper diagonal so that the entire matrix is filled in. */ void vectors_to_distances(const boost::multi_array<float, 2> & X, boost::multi_array<float, 2> & D, bool fill_upper = true); void vectors_to_distances(const boost::multi_array<double, 2> & X, boost::multi_array<double, 2> & D, bool fill_upper = true); inline boost::multi_array<float, 2> vectors_to_distances(boost::multi_array<float, 2> & X, bool fill_upper = true) { int n = X.shape()[0]; boost::multi_array<float, 2> result(boost::extents[n][n]); vectors_to_distances(X, result, fill_upper); return result; } inline boost::multi_array<double, 2> vectors_to_distances(boost::multi_array<double, 2> & X, bool fill_upper = true) { int n = X.shape()[0]; boost::multi_array<double, 2> result(boost::extents[n][n]); vectors_to_distances(X, result, fill_upper); return result; } boost::multi_array<float, 2> distances_to_probabilities(boost::multi_array<float, 2> & D, double tolerance = 1e-5, double perplexity = 30.0); /** Perform a principal component analysis. This routine will reduce a (n x d) matrix to a (n x e) matrix, where e < d (and is possibly far less). The num_dims parameter gives the preferred value of e; it is possible that the routine will return a smaller value of e than this (where the rank of X is lower than the requested e value). */ boost::multi_array<float, 2> pca(boost::multi_array<float, 2> & coords, int num_dims = 50); struct TSNE_Params { TSNE_Params() : max_iter(1000), initial_momentum(0.5), final_momentum(0.8), eta(500), min_gain(0.01), min_prob(1e-12) { } int max_iter; double initial_momentum; double final_momentum; double eta; double min_gain; double min_prob; }; // Function that will be used as a callback to provide progress to a calling // process. Arguments are: // - int: iteration number // - float: cost when last measured // - const char *: phase name (of this iteration) // - TSNE_Params &: parameters (may be modified) // The return should be true to keep going, or false to stop (the most recent // Y will then be returned). typedef boost::function<bool (int, float, const char *)> TSNE_Callback; boost::multi_array<float, 2> tsne(const boost::multi_array<float, 2> & probs, int num_dims = 2, const TSNE_Params & params = TSNE_Params(), const TSNE_Callback & callback = TSNE_Callback()); } // namespace ML #endif /* __jml__tsne__tsne_h__ */
// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s extern void foo_alias (void) __asm ("foo"); inline void foo (void) { return foo_alias (); } extern int abs_alias (int) __asm ("abs"); inline __attribute__ ((__always_inline__)) int abs (int x) { return abs_alias(x); } extern char *strrchr_foo (const char *__s, int __c) __asm ("strrchr"); extern inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) char * strrchr_foo (const char *__s, int __c) { return __builtin_strrchr (__s, __c); } extern inline void __attribute__((always_inline, __gnu_inline__)) prefetch(void) { __builtin_prefetch(0, 0, 1); } extern inline __attribute__((__always_inline__, __gnu_inline__)) void *memchr(void *__s, int __c, __SIZE_TYPE__ __n) { return __builtin_memchr(__s, __c, __n); } void f(void) { foo(); abs(0); strrchr_foo("", '.'); prefetch(); memchr("", '.', 0); } // CHECK-LABEL: define void @f() // CHECK: call void @foo() // CHECK: call i32 @abs(i32 0) // CHECK: call i8* @strrchr( // CHECK: call void @llvm.prefetch( // CHECK: call i8* @memchr( // CHECK: ret void // CHECK: declare void @foo() // CHECK: declare i32 @abs(i32 // CHECK: declare i8* @strrchr(i8*, i32) // CHECK: declare i8* @memchr( // CHECK: declare void @llvm.prefetch(
/* error-ssl.h * * Copyright (C) 2006-2015 wolfSSL Inc. * * This file is part of wolfSSL. (formerly known as CyaSSL) * * wolfSSL 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. * * wolfSSL 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 */ #include <wolfssl/error-ssl.h>
#include <linux/string.h> #include <linux/kernel.h> #include <linux/of.h> #include <linux/init.h> #include <linux/module.h> #include <linux/mod_devicetable.h> #include <linux/slab.h> #include <linux/of_device.h> #include <asm/errno.h> #include <asm/dcr.h> static void of_device_make_bus_id(struct of_device *dev) { static atomic_t bus_no_reg_magic; struct device_node *node = dev->node; char *name = dev->dev.bus_id; const u32 *reg; u64 addr; int magic; /* * If it's a DCR based device, use 'd' for native DCRs * and 'D' for MMIO DCRs. */ #ifdef CONFIG_PPC_DCR reg = of_get_property(node, "dcr-reg", NULL); if (reg) { #ifdef CONFIG_PPC_DCR_NATIVE snprintf(name, BUS_ID_SIZE, "d%x.%s", *reg, node->name); #else /* CONFIG_PPC_DCR_NATIVE */ addr = of_translate_dcr_address(node, *reg, NULL); if (addr != OF_BAD_ADDR) { snprintf(name, BUS_ID_SIZE, "D%llx.%s", (unsigned long long)addr, node->name); return; } #endif /* !CONFIG_PPC_DCR_NATIVE */ } #endif /* CONFIG_PPC_DCR */ /* * For MMIO, get the physical address */ reg = of_get_property(node, "reg", NULL); if (reg) { addr = of_translate_address(node, reg); if (addr != OF_BAD_ADDR) { snprintf(name, BUS_ID_SIZE, "%llx.%s", (unsigned long long)addr, node->name); return; } } /* * No BusID, use the node name and add a globally incremented * counter (and pray...) */ magic = atomic_add_return(1, &bus_no_reg_magic); snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1); } struct of_device *of_device_alloc(struct device_node *np, const char *bus_id, struct device *parent) { struct of_device *dev; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return NULL; dev->node = of_node_get(np); dev->dev.dma_mask = &dev->dma_mask; dev->dev.parent = parent; dev->dev.release = of_release_dev; dev->dev.archdata.of_node = np; if (bus_id) strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE); else of_device_make_bus_id(dev); return dev; } EXPORT_SYMBOL(of_device_alloc); int of_device_uevent(struct device *dev, struct kobj_uevent_env *env) { struct of_device *ofdev; const char *compat; int seen = 0, cplen, sl; if (!dev) return -ENODEV; ofdev = to_of_device(dev); if (add_uevent_var(env, "OF_NAME=%s", ofdev->node->name)) return -ENOMEM; if (add_uevent_var(env, "OF_TYPE=%s", ofdev->node->type)) return -ENOMEM; /* Since the compatible field can contain pretty much anything * it's not really legal to split it out with commas. We split it * up using a number of environment variables instead. */ compat = of_get_property(ofdev->node, "compatible", &cplen); while (compat && *compat && cplen > 0) { if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat)) return -ENOMEM; sl = strlen (compat) + 1; compat += sl; cplen -= sl; seen++; } if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen)) return -ENOMEM; /* modalias is trickier, we add it in 2 steps */ if (add_uevent_var(env, "MODALIAS=")) return -ENOMEM; sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1], sizeof(env->buf) - env->buflen); if (sl >= (sizeof(env->buf) - env->buflen)) return -ENOMEM; env->buflen += sl; return 0; } EXPORT_SYMBOL(of_device_uevent); EXPORT_SYMBOL(of_device_get_modalias);
/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ /* { dg-options "-O2 -fprefetch-loop-arrays -march=amdfam10 --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ #define K 1000000 int a[K]; void test() { unsigned i; /* Nontemporal store should be used for a. */ for (i = 0; i < K; i++) a[i] = 0; } /* { dg-final { scan-tree-dump-times "a nontemporal store" 1 "aprefetch" } } */ /* { dg-final { scan-tree-dump "=\\{nt\\}" "optimized" } } */ /* { dg-final { scan-tree-dump-times "__builtin_ia32_mfence" 1 "optimized" } } */
// Copyright(C) 2008-2017 National Technology & Engineering Solutions // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with // NTESS, the U.S. Government 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 NTESS 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. // #ifndef exodiff_h #define exodiff_h #include <string> std::string Version(); #endif
/* * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _AUTH_SARC4_H #define _AUTH_SARC4_H #include "Common.h" #include <openssl/evp.h> class SARC4 { public: SARC4(uint8 len); SARC4(uint8 *seed, uint8 len); ~SARC4(); void Init(uint8 *seed); void UpdateData(int len, uint8 *data); private: EVP_CIPHER_CTX m_ctx; }; #endif
#ifndef KITTEN_PAW_H #define KITTEN_PAW_H #include "quantum.h" #define CONFIG_LED_IO \ DDRB |= (1<<7); \ DDRC |= (1<<5) | (1<<6); #define USB_LED_CAPS_LOCK_ON PORTC &= ~(1<<6) #define USB_LED_CAPS_LOCK_OFF PORTC |= (1<<6) #define USB_LED_NUM_LOCK_ON PORTB &= ~(1<<7) #define USB_LED_NUM_LOCK_OFF PORTB |= (1<<7) #define USB_LED_SCROLL_LOCK_ON PORTC &= ~(1<<5) #define USB_LED_SCROLL_LOCK_OFF PORTC |= (1<<5) // This a shortcut to help you visually see your layout. // The first section contains all of the arguements // The second converts the arguments into a two-dimensional array /* Matrix col/row mapping ,----. ,-------------------. ,-------------------. ,-------------------. ,--------------. | J6 | | I4 | H4 | H2 | H6 | | A7 | E6 | D2 | D4 | | B4 | B7 | B6 | B0 | | C7 | C5 | A5 | `----' `-------------------' `-------------------' `-------------------' `--------------' ,-------------------------------------------------------------------------. ,--------------. ,-------------------. | J4 | J7 | I7 | H7 | G7 | G4 | F4 | F7 | E7 | D7 | R7 | R4 | E4 | B2 | | L4 | O4 | Q4 | | K1 | L1 | Q1 | Q0 | |-------------------------------------------------------------------------| |--------------| |-------------------| | J2 | J5 | I5 | H5 | G5 | G2 | F2 | F5 | E5 | D5 | R5 | R2 | E2 | B3 | | K4 | O7 | Q7 | | K5 | L5 | Q5 | O5 | |-------------------------------------------------------------------------| '--------------' |-------------- | | O5 | J3 | I3 | H3 | G3 | G6 | F6 | F3 | E3 | D3 | R3 | R6 | B1 | | K2 | L2 | Q2 | | |-------------------------------------------------------------------------| ,----. |-------------------| | N2 | J1 | I1 | H1 | G1 | G0 | F0 | F1 | E1 | D1 | R0 | N3 | | O6 | | K3 | L3 | Q3 | O3 | |-------------------------------------------------------------------------| ,--------------. |-------------- | | A4 | P2 | C6 | K6 | C0 | M3 | D0 | A1 | | O0 | K0 | L0 | | L6 | Q6 | | `-------------------------------------------------------------------------' `--------------' `-------------------' */ #define KEYMAP( \ KJ6, KI4, KH4, KH2, KH6, KA7, KE6, KD2, KD4, KB4, KB7, KB6, KB0, KC7, KC5, KA5, \ KJ4, KJ7, KI7, KH7, KG7, KG4, KF4, KF7, KE7, KD7, KR7, KR4, KE4, KB2, KL4, KO4, KQ4, KK1, KL1, KQ1, KQ0, \ KJ2, KJ5, KI5, KH5, KG5, KG2, KF2, KF5, KE5, KD5, KR5, KR2, KE2, KB3, KK4, KO7, KQ7, KK5, KL5, KQ5, KO5, \ KI2, KJ3, KI3, KH3, KG3, KG6, KF6, KF3, KE3, KD3, KR3, KR6, KB1, KK2, KL2, KQ2, \ KN2, KI6, KJ1, KI1, KH1, KG1, KG0, KF0, KF1, KE1, KD1, KR0, KN3, KO6, KK3, KL3, KQ3, KO3, \ KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \ ) \ { \ {KC_NO, KB0, KC0, KD0,KC_NO, KF0, KG0,KC_NO,KC_NO,KC_NO, KK0, KL0,KC_NO,KC_NO, KO0,KC_NO, KQ0, KR0}, \ { KA1, KB1,KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KK1, KL1,KC_NO,KC_NO,KC_NO,KC_NO, KQ1,KC_NO}, \ {KC_NO, KB2,KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KK2, KL2,KC_NO, KN2,KC_NO, KP2, KQ2, KR2}, \ {KC_NO, KB3,KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KK3, KL3, KM3, KN3, KO3,KC_NO, KQ3, KR3}, \ { KA4, KB4,KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4,KC_NO,KC_NO, KO4,KC_NO, KQ4, KR4}, \ { KA5,KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KK5, KL5,KC_NO,KC_NO, KO5,KC_NO, KQ5, KR5}, \ {KC_NO, KB6, KC6,KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6,KC_NO,KC_NO, KO6,KC_NO, KQ6, KR6}, \ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7,KC_NO,KC_NO,KC_NO,KC_NO, KO7,KC_NO, KQ7, KR7} \ } #endif
extern void abort (void); extern int inside_main; char * stpcpy (char *dst, const char *src) { #ifdef __OPTIMIZE__ if (inside_main) abort (); #endif while (*src != 0) *dst++ = *src++; *dst = 0; return dst; }
/* IR codes for Adafruit mini remote https://www.adafruit.com/product/389 Uses NEC protocol */ #define ADAF_MINI_VOLUME_DOWN 0xfd00ff #define ADAF_MINI_PLAY_PAUSE 0xfd807f #define ADAF_MINI_VOLUME_UP 0xfd40bf #define ADAF_MINI_SETUP 0xfd20df #define ADAF_MINI_UP_ARROW 0xfda05f #define ADAF_MINI_STOP_MODE 0xfd609f #define ADAF_MINI_LEFT_ARROW 0xfd10ef #define ADAF_MINI_ENTER_SAVE 0xfd906f #define ADAF_MINI_RIGHT_ARROW 0xfd50af #define ADAF_MINI_0_10_PLUS 0xfd30cf #define ADAF_MINI_DOWN_ARROW 0xfdb04f #define ADAF_MINI_REPEAT 0xfd708f #define ADAF_MINI_1 0xfd08f7 #define ADAF_MINI_2 0xfd8877 #define ADAF_MINI_3 0xfd48b7 #define ADAF_MINI_4 0xfd28d7 #define ADAF_MINI_5 0xfda857 #define ADAF_MINI_6 0xfd6897 #define ADAF_MINI_7 0xfd18e7 #define ADAF_MINI_8 0xfd9867 #define ADAF_MINI_9 0xfd58a7
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CORE_LIB_IO_PROTO_ENCODE_HELPER_H_ #define TENSORFLOW_CORE_LIB_IO_PROTO_ENCODE_HELPER_H_ #include "tensorflow/core/lib/core/coding.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/platform/protobuf.h" // A helper class for appending various kinds of values in protocol // buffer encoding format to a buffer. The client gives a pointer to // a buffer and a maximum size guarantee for the number of bytes they // will add to this buffer. namespace tensorflow { namespace io { class ProtoEncodeHelper { public: ProtoEncodeHelper(char* buf, int max_size) : base_(buf), p_(buf), limit_(base_ + max_size) {} ~ProtoEncodeHelper() { // Make sure callers didn't do operations that went over max_size promised DCHECK_LE(p_, limit_); } const char* data() const { return base_; } size_t size() const { return p_ - base_; } void WriteUint64(int tag, uint64 v) { Encode32(combine(tag, WIRETYPE_VARINT)); Encode64(v); } void WriteBool(int tag, bool v) { Encode32(combine(tag, WIRETYPE_VARINT)); EncodeBool(v); } void WriteString(int tag, StringPiece v) { Encode32(combine(tag, WIRETYPE_LENGTH_DELIMITED)); Encode32(v.size()); EncodeBytes(v.data(), v.size()); } void WriteVarlengthBeginning(int tag, uint32 len) { Encode32(combine(tag, WIRETYPE_LENGTH_DELIMITED)); Encode32(len); } void WriteRawBytes(StringPiece v) { EncodeBytes(v.data(), v.size()); } private: // Note: this module's behavior must match the protocol buffer wire encoding // format. enum { WIRETYPE_VARINT = 0, WIRETYPE_LENGTH_DELIMITED = 2, }; static uint32 combine(uint32 tag, uint32 type) { return ((tag << 3) | type); } inline void Encode32(uint32 v) { if (v < 128) { // Fast path for single-byte values. Many of the calls will use a // constant value for v, so the comparison will get optimized away // when Encode32 is inlined into the caller. *p_ = v; p_++; } else { p_ = core::EncodeVarint32(p_, v); } } void Encode64(uint64 v) { p_ = core::EncodeVarint64(p_, v); } void EncodeBool(bool v) { *p_ = (v ? 1 : 0); // Equal to varint32 encoding of 0 or 1 p_++; } void EncodeBytes(const char* bytes, int N) { memcpy(p_, bytes, N); p_ += N; } char* base_; char* p_; char* limit_; // Just for CHECKs }; } // namespace io } // namespace tensorflow #endif // TENSORFLOW_CORE_LIB_IO_PROTO_ENCODE_HELPER_H_
/* * * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * 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 Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H #define GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H #include <grpc/impl/codegen/sync.h> namespace grpc { template <class mutex> class lock_guard; class condition_variable; class mutex { public: mutex() { gpr_mu_init(&mu_); } ~mutex() { gpr_mu_destroy(&mu_); } private: ::gpr_mu mu_; template <class mutex> friend class lock_guard; friend class condition_variable; }; template <class mutex> class lock_guard { public: lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); } ~lock_guard() { unlock_internal(); } protected: void lock_internal() { if (!locked) gpr_mu_lock(&mu_.mu_); locked = true; } void unlock_internal() { if (locked) gpr_mu_unlock(&mu_.mu_); locked = false; } private: mutex &mu_; bool locked; friend class condition_variable; }; template <class mutex> class unique_lock : public lock_guard<mutex> { public: unique_lock(mutex &mu) : lock_guard<mutex>(mu) {} void lock() { this->lock_internal(); } void unlock() { this->unlock_internal(); } }; class condition_variable { public: condition_variable() { gpr_cv_init(&cv_); } ~condition_variable() { gpr_cv_destroy(&cv_); } void wait(lock_guard<mutex> &mu) { mu.locked = false; gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME)); mu.locked = true; } void notify_one() { gpr_cv_signal(&cv_); } void notify_all() { gpr_cv_broadcast(&cv_); } private: gpr_cv cv_; }; } // namespace grpc #endif // GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
/* * include/asm-s390/hardirq.h * * S390 version * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) * * Derived from "include/asm-i386/hardirq.h" */ #ifndef __ASM_HARDIRQ_H #define __ASM_HARDIRQ_H #include <asm/lowcore.h> #define local_softirq_pending() (S390_lowcore.softirq_pending) #define __ARCH_IRQ_STAT #define __ARCH_HAS_DO_SOFTIRQ #define HARDIRQ_BITS 8 #endif /* __ASM_HARDIRQ_H */
/* * OpenRISC Programmable Interrupt Controller support. * * Copyright (c) 2011-2012 Jia Liu <proljc@gmail.com> * Feng Gao <gf91597@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" #include "hw/hw.h" #include "cpu.h" /* OpenRISC pic handler */ static void openrisc_pic_cpu_handler(void *opaque, int irq, int level) { OpenRISCCPU *cpu = (OpenRISCCPU *)opaque; CPUState *cs = CPU(cpu); uint32_t irq_bit; if (irq > 31 || irq < 0) { return; } irq_bit = 1U << irq; if (level) { cpu->env.picsr |= irq_bit; } else { cpu->env.picsr &= ~irq_bit; } if (cpu->env.picsr & cpu->env.picmr) { cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu->env.picsr = 0; } } void cpu_openrisc_pic_init(OpenRISCCPU *cpu) { int i; qemu_irq *qi; qi = qemu_allocate_irqs(openrisc_pic_cpu_handler, cpu, NR_IRQS); for (i = 0; i < NR_IRQS; i++) { cpu->env.irq[i] = qi[i]; } }
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CONTRIB_LITE_JAVA_TENSOR_JNI_H_ #define TENSORFLOW_CONTRIB_LITE_JAVA_TENSOR_JNI_H_ #include <jni.h> #include "tensorflow/contrib/lite/context.h" #ifdef __cplusplus extern "C" { #endif // __cplusplus /* * Class: org_tensorflow_lite_TfLiteTensor * Method: * Signature: (J)I */ JNIEXPORT jint JNICALL Java_org_tensorflow_lite_Tensor_dtype(JNIEnv* env, jclass clazz, jlong handle); /* * Class: org_tensorflow_lite_TfLiteTensor * Method: * Signature: (J)[I */ JNIEXPORT jintArray JNICALL Java_org_tensorflow_lite_Tensor_shape(JNIEnv* env, jclass clazz, jlong handle); /* * Class: org_tensorflow_lite_TfLiteTensor * Method: * Signature: (JLjava/lang/Object;) */ JNIEXPORT void JNICALL Java_org_tensorflow_lite_Tensor_readMultiDimensionalArray(JNIEnv* env, jclass clazz, jlong handle, jobject value); /* * Finds the size of each data type. */ size_t elementByteSize(TfLiteType data_type); /* * Writes data of a ByteBuffer into dest. */ size_t writeByteBuffer(JNIEnv* env, jobject object, char** dst, int dst_size); /* * Writes a multi-dimensional array into dest. */ size_t writeMultiDimensionalArray(JNIEnv* env, jobject src, TfLiteType type, int dims_left, char** dst, int dst_size); #ifdef __cplusplus } // extern "C" #endif // __cplusplus #endif // TENSORFLOW_CONTRIB_LITE_JAVA_TENSOR_JNI_H_
#include <linux/init.h> #include <linux/mm.h> #include <asm/mtrr.h> #include <asm/msr.h> #include "mtrr.h" static void amd_get_mtrr(unsigned int reg, unsigned long *base, unsigned long *size, mtrr_type *type) { unsigned long low, high; rdmsr(MSR_K6_UWCCR, low, high); /* Upper dword is region 1, lower is region 0 */ if (reg == 1) low = high; /* The base masks off on the right alignment */ *base = (low & 0xFFFE0000) >> PAGE_SHIFT; *type = 0; if (low & 1) *type = MTRR_TYPE_UNCACHABLE; if (low & 2) *type = MTRR_TYPE_WRCOMB; if (!(low & 3)) { *size = 0; return; } /* * This needs a little explaining. The size is stored as an * inverted mask of bits of 128K granularity 15 bits long offset * 2 bits. * * So to get a size we do invert the mask and add 1 to the lowest * mask bit (4 as its 2 bits in). This gives us a size we then shift * to turn into 128K blocks. * * eg 111 1111 1111 1100 is 512K * * invert 000 0000 0000 0011 * +1 000 0000 0000 0100 * *128K ... */ low = (~low) & 0x1FFFC; *size = (low + 4) << (15 - PAGE_SHIFT); } /** * amd_set_mtrr - Set variable MTRR register on the local CPU. * * @reg The register to set. * @base The base address of the region. * @size The size of the region. If this is 0 the region is disabled. * @type The type of the region. * * Returns nothing. */ static void amd_set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type) { u32 regs[2]; /* * Low is MTRR0, High MTRR 1 */ rdmsr(MSR_K6_UWCCR, regs[0], regs[1]); /* * Blank to disable */ if (size == 0) { regs[reg] = 0; } else { /* * Set the register to the base, the type (off by one) and an * inverted bitmask of the size The size is the only odd * bit. We are fed say 512K We invert this and we get 111 1111 * 1111 1011 but if you subtract one and invert you get the * desired 111 1111 1111 1100 mask * * But ~(x - 1) == ~x + 1 == -x. Two's complement rocks! */ regs[reg] = (-size >> (15 - PAGE_SHIFT) & 0x0001FFFC) | (base << PAGE_SHIFT) | (type + 1); } /* * The writeback rule is quite specific. See the manual. Its * disable local interrupts, write back the cache, set the mtrr */ wbinvd(); wrmsr(MSR_K6_UWCCR, regs[0], regs[1]); } static int amd_validate_add_page(unsigned long base, unsigned long size, unsigned int type) { /* * Apply the K6 block alignment and size rules * In order * o Uncached or gathering only * o 128K or bigger block * o Power of 2 block * o base suitably aligned to the power */ if (type > MTRR_TYPE_WRCOMB || size < (1 << (17 - PAGE_SHIFT)) || (size & ~(size - 1)) - size || (base & (size - 1))) return -EINVAL; return 0; } static struct mtrr_ops amd_mtrr_ops = { .vendor = X86_VENDOR_AMD, .set = amd_set_mtrr, .get = amd_get_mtrr, .get_free_region = generic_get_free_region, .validate_add_page = amd_validate_add_page, .have_wrcomb = positive_have_wrcomb, }; int __init amd_init_mtrr(void) { set_mtrr_ops(&amd_mtrr_ops); return 0; }
/* Simple DirectMedia Layer Copyright (C) 1997-2015 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_blendmode.h * * Header file declaring the SDL_BlendMode enumeration */ #ifndef _SDL_blendmode_h #define _SDL_blendmode_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The blend mode used in SDL_RenderCopy() and drawing operations. */ typedef enum { SDL_BLENDMODE_NONE = 0x00000000, /**< no blending dstRGBA = srcRGBA */ SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = srcA + (dstA * (1-srcA)) */ SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA */ SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate dstRGB = srcRGB * dstRGB dstA = dstA */ } SDL_BlendMode; /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* _SDL_blendmode_h */ /* vi: set ts=4 sw=4 expandtab: */
/***************************************************************************/ /* * linux/arch/m68knommu/platform/528x/config.c * * Sub-architcture dependant initialization code for the Motorola * 5280 and 5282 CPUs. * * Copyright (C) 1999-2003, 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/interrupt.h> #include <linux/platform_device.h> #include <linux/spi/spi.h> #include <linux/spi/flash.h> #include <linux/io.h> #include <asm/machdep.h> #include <asm/coldfire.h> #include <asm/mcfsim.h> #include <asm/mcfuart.h> #ifdef CONFIG_MTD_PARTITIONS #include <linux/mtd/partitions.h> #endif /***************************************************************************/ void coldfire_reset(void); /***************************************************************************/ static struct mcf_platform_uart m528x_uart_platform[] = { { .mapbase = MCF_MBAR + MCFUART_BASE1, .irq = MCFINT_VECBASE + MCFINT_UART0, }, { .mapbase = MCF_MBAR + MCFUART_BASE2, .irq = MCFINT_VECBASE + MCFINT_UART0 + 1, }, { .mapbase = MCF_MBAR + MCFUART_BASE3, .irq = MCFINT_VECBASE + MCFINT_UART0 + 2, }, { }, }; static struct platform_device m528x_uart = { .name = "mcfuart", .id = 0, .dev.platform_data = m528x_uart_platform, }; static struct resource m528x_fec_resources[] = { { .start = MCF_MBAR + 0x1000, .end = MCF_MBAR + 0x1000 + 0x7ff, .flags = IORESOURCE_MEM, }, { .start = 64 + 23, .end = 64 + 23, .flags = IORESOURCE_IRQ, }, { .start = 64 + 27, .end = 64 + 27, .flags = IORESOURCE_IRQ, }, { .start = 64 + 29, .end = 64 + 29, .flags = IORESOURCE_IRQ, }, }; static struct platform_device m528x_fec = { .name = "fec", .id = 0, .num_resources = ARRAY_SIZE(m528x_fec_resources), .resource = m528x_fec_resources, }; static struct platform_device *m528x_devices[] __initdata = { &m528x_uart, &m528x_fec, }; /***************************************************************************/ #define INTC0 (MCF_MBAR + MCFICM_INTC0) static void __init m528x_uart_init_line(int line, int irq) { u8 port; u32 imr; if ((line < 0) || (line > 2)) return; /* level 6, line based priority */ writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line); imr = readl(INTC0 + MCFINTC_IMRL); imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1); writel(imr, INTC0 + MCFINTC_IMRL); /* make sure PUAPAR is set for UART0 and UART1 */ if (line < 2) { port = readb(MCF_MBAR + MCF5282_GPIO_PUAPAR); port |= (0x03 << (line * 2)); writeb(port, MCF_MBAR + MCF5282_GPIO_PUAPAR); } } static void __init m528x_uarts_init(void) { const int nrlines = ARRAY_SIZE(m528x_uart_platform); int line; for (line = 0; (line < nrlines); line++) m528x_uart_init_line(line, m528x_uart_platform[line].irq); } /***************************************************************************/ static void __init m528x_fec_init(void) { u32 imr; u16 v16; /* Unmask FEC interrupts at ColdFire interrupt controller */ writeb(0x28, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 23); writeb(0x27, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 27); writeb(0x26, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_ICR0 + 29); imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH); imr &= ~0xf; writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH); imr = readl(MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL); imr &= ~0xff800001; writel(imr, MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL); /* Set multi-function pins to ethernet mode for fec0 */ v16 = readw(MCF_IPSBAR + 0x100056); writew(v16 | 0xf00, MCF_IPSBAR + 0x100056); writeb(0xc0, MCF_IPSBAR + 0x100058); } /***************************************************************************/ void mcf_disableall(void) { *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRH)) = 0xffffffff; *((volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFINTC_IMRL)) = 0xffffffff; } /***************************************************************************/ void mcf_autovector(unsigned int vec) { /* Everything is auto-vectored on the 5272 */ } /***************************************************************************/ #ifdef CONFIG_WILDFIRE void wildfire_halt(void) { writeb(0, 0x30000007); writeb(0x2, 0x30000007); } #endif #ifdef CONFIG_WILDFIREMOD void wildfiremod_halt(void) { printk(KERN_INFO "WildFireMod hibernating...\n"); /* Set portE.5 to Digital IO */ MCF5282_GPIO_PEPAR &= ~(1 << (5 * 2)); /* Make portE.5 an output */ MCF5282_GPIO_DDRE |= (1 << 5); /* Now toggle portE.5 from low to high */ MCF5282_GPIO_PORTE &= ~(1 << 5); MCF5282_GPIO_PORTE |= (1 << 5); printk(KERN_EMERG "Failed to hibernate. Halting!\n"); } #endif void __init config_BSP(char *commandp, int size) { mcf_disableall(); #ifdef CONFIG_WILDFIRE mach_halt = wildfire_halt; #endif #ifdef CONFIG_WILDFIREMOD mach_halt = wildfiremod_halt; #endif } /***************************************************************************/ static int __init init_BSP(void) { m528x_uarts_init(); m528x_fec_init(); platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices)); return 0; } arch_initcall(init_BSP); /***************************************************************************/
/* * Copyright (C) 2000, 2001, 2002, 2003 Broadcom Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <linux/init.h> #include <linux/sched.h> #include <linux/smp.h> #include <asm/processor.h> #include "cfe_api.h" #include "cfe_error.h" /* * Use CFE to find out how many CPUs are available, setting up * phys_cpu_present_map and the logical/physical mappings. * XXXKW will the boot CPU ever not be physical 0? * * Common setup before any secondaries are started */ void __init prom_prepare_cpus(unsigned int max_cpus) { int i, num; cpus_clear(phys_cpu_present_map); cpu_set(0, phys_cpu_present_map); __cpu_number_map[0] = 0; __cpu_logical_map[0] = 0; for (i=1, num=0; i<NR_CPUS; i++) { if (cfe_cpu_stop(i) == 0) { cpu_set(i, phys_cpu_present_map); __cpu_number_map[i] = ++num; __cpu_logical_map[num] = i; } } printk("Detected %i available secondary CPU(s)\n", num); } /* * Setup the PC, SP, and GP of a secondary processor and start it * running! */ void prom_boot_secondary(int cpu, struct task_struct *idle) { int retval; retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, __KSTK_TOS(idle), (unsigned long)idle->thread_info, 0); if (retval != 0) printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); } /* * Code to run on secondary just after probing the CPU */ void prom_init_secondary(void) { extern void sb1250_smp_init(void); sb1250_smp_init(); } /* * Do any tidying up before marking online and running the idle * loop */ void prom_smp_finish(void) { extern void sb1250_smp_finish(void); sb1250_smp_finish(); } /* * Final cleanup after all secondaries booted */ void prom_cpus_done(void) { }
/***************************************************************************** Copyright (c) 2010, Intel Corp. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Intel 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. ****************************************************************************** * Contents: Native C interface to LAPACK utility function * Author: Intel Corporation * Created in February, 2010 *****************************************************************************/ #include "lapacke_utils.h" /* Converts input general matrix from row-major(C) to column-major(Fortran) * layout or vice versa. */ void LAPACKE_sge_trans( int matrix_order, lapack_int m, lapack_int n, const float* in, lapack_int ldin, float* out, lapack_int ldout ) { lapack_int i, j, x, y; if( in == NULL || out == NULL ) return; if( matrix_order == LAPACK_COL_MAJOR ) { x = n; y = m; } else if ( matrix_order == LAPACK_ROW_MAJOR ) { x = m; y = n; } else { /* Unknown input layout */ return; } /* In case of incorrect m, n, ldin or ldout the function does nothing */ for( i = 0; i < MIN( y, ldin ); i++ ) { for( j = 0; j < MIN( x, ldout ); j++ ) { out[ (size_t)i*ldout + j ] = in[ (size_t)j*ldin + i ]; } } }
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: bing.wei.liu 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 pthread_cond_timedwait() * shall block on a condition variable. It shall be called with mutex locked * by the calling thread or undefined behavior results. */ #define _XOPEN_SOURCE 600 #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/time.h> #include <errno.h> #include "posixtest.h" #define TIMEOUT 5 struct testdata { pthread_mutex_t mutex; pthread_cond_t cond; } td; int t1_start = 0; int signaled = 0; void *t1_func(void *arg) { int rc; struct timespec timeout; struct timeval curtime; (void) arg; if (pthread_mutex_lock(&td.mutex) != 0) { fprintf(stderr, "Thread1: Fail to acquire mutex\n"); exit(PTS_UNRESOLVED); } fprintf(stderr, "Thread1 started\n"); t1_start = 1; /* let main thread continue */ if (gettimeofday(&curtime, NULL) != 0) { fprintf(stderr, "Fail to get current time\n"); exit(PTS_UNRESOLVED); } timeout.tv_sec = curtime.tv_sec; timeout.tv_nsec = curtime.tv_usec * 1000; timeout.tv_sec += TIMEOUT; fprintf(stderr, "Thread1 is waiting for the cond\n"); rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout); if (rc != 0) { if (rc == ETIMEDOUT) { fprintf(stderr, "Thread1 stops waiting when time is out\n"); exit(PTS_UNRESOLVED); } else { fprintf(stderr, "pthread_cond_timedwait return %d\n", rc); exit(PTS_UNRESOLVED); } } fprintf(stderr, "Thread1 wakened up\n"); if (signaled == 0) { fprintf(stderr, "Thread1 did not block on the cond at all\n"); printf("Test FAILED\n"); exit(PTS_FAIL); } pthread_mutex_unlock(&td.mutex); return NULL; } int main(void) { pthread_t thread1; if (pthread_mutex_init(&td.mutex, NULL) != 0) { fprintf(stderr, "Fail to initialize mutex\n"); return PTS_UNRESOLVED; } if (pthread_cond_init(&td.cond, NULL) != 0) { fprintf(stderr, "Fail to initialize cond\n"); return PTS_UNRESOLVED; } if (pthread_create(&thread1, NULL, t1_func, NULL) != 0) { fprintf(stderr, "Fail to create thread 1\n"); return PTS_UNRESOLVED; } while (!t1_start) /* wait for thread1 started */ usleep(100); /* acquire the mutex released by pthread_cond_wait() within thread 1 */ if (pthread_mutex_lock(&td.mutex) != 0) { fprintf(stderr, "Main: Fail to acquire mutex\n"); return PTS_UNRESOLVED; } if (pthread_mutex_unlock(&td.mutex) != 0) { fprintf(stderr, "Main: Fail to release mutex\n"); return PTS_UNRESOLVED; } sleep(1); fprintf(stderr, "Time to wake up thread1 by signaling a condition\n"); signaled = 1; if (pthread_cond_signal(&td.cond) != 0) { fprintf(stderr, "Main: Fail to signal cond\n"); return PTS_UNRESOLVED; } pthread_join(thread1, NULL); printf("Test PASSED\n"); return PTS_PASS; }
/* * This file is part of Cockpit. * * Copyright (C) 2014 Red Hat, Inc. * * Cockpit 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. * * Cockpit 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 Cockpit; If not, see <http://www.gnu.org/licenses/>. */ #ifndef COCKPIT_FSREPLACE_H__ #define COCKPIT_FSREPLACE_H__ #include <gio/gio.h> #include "cockpitchannel.h" G_BEGIN_DECLS #define COCKPIT_TYPE_FSREPLACE (cockpit_fsreplace_get_type ()) GType cockpit_fsreplace_get_type (void) G_GNUC_CONST; CockpitChannel * cockpit_fsreplace_open (CockpitTransport *transport, const gchar *channel_id, const gchar *path, const gchar *tag); #endif /* COCKPIT_FSREPLACE_H__ */
/* * Copyright (c) 2012-2013, Freescale Semiconductor, 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: * * o Redistributions of source code must retain the above copyright notice, this list * of conditions and the following disclaimer. * * o 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. * * o Neither the name of Freescale Semiconductor, Inc. nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include "cpu_utility/cpu_utility.h" //////////////////////////////////////////////////////////////////////////////// // Prototypes //////////////////////////////////////////////////////////////////////////////// void cpu_get_cores_test(void); ////////////////////////////////////////////////////////////////////////////////////////// // Code ////////////////////////////////////////////////////////////////////////////////////////// //! @brief Display the number of cores to the debugging terminal //! void cpu_get_cores_test(void) { // Checks whether an invalid number of cores has been returned // and return error message. int num_cores = cpu_get_cores(); if(num_cores == GET_CORES_ERROR) { printf("There has been an error!\n"); } // Display the number of accessible cores. else { printf("\n There are %d accessible cores. \n", num_cores); } }
/* * mpq.h -- some default types and defines. * * Copyright (c) 2003-2008 Maik Broemme <mbroemme@plusserver.de> * * Some parts (the encryption and decryption stuff) were adapted from * the C++ version of StormLib.h and StormPort.h included in stormlib. * The C++ version belongs to the following authors: * * Ladislav Zezula <ladik@zezula.net> * Marko Friedemann <marko.friedemann@bmx-chemnitz.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _MPQ_H #define _MPQ_H #ifdef __cplusplus extern "C" { #endif /* generic includes. */ #include <stdint.h> #include <sys/types.h> #if defined(__GNUC__) && (__GNUC__ >= 4) # define LIBMPQ_API __attribute__((visibility("default"))) #else # define LIBMPQ_API #endif /* define errors. */ #define LIBMPQ_ERROR_OPEN -1 /* open error on file. */ #define LIBMPQ_ERROR_CLOSE -2 /* close error on file. */ #define LIBMPQ_ERROR_SEEK -3 /* lseek error on file. */ #define LIBMPQ_ERROR_READ -4 /* read error on file. */ #define LIBMPQ_ERROR_WRITE -5 /* write error on file. */ #define LIBMPQ_ERROR_MALLOC -6 /* memory allocation error. */ #define LIBMPQ_ERROR_FORMAT -7 /* format errror. */ #define LIBMPQ_ERROR_NOT_INITIALIZED -8 /* libmpq__init() wasn't called. */ #define LIBMPQ_ERROR_SIZE -9 /* buffer size is to small. */ #define LIBMPQ_ERROR_EXIST -10 /* file or block does not exist in archive. */ #define LIBMPQ_ERROR_DECRYPT -11 /* we don't know the decryption seed. */ #define LIBMPQ_ERROR_UNPACK -12 /* error on unpacking file. */ /* internal data structure. */ typedef struct mpq_archive mpq_archive_s; /* file offset data type for API*/ typedef int64_t libmpq__off_t; /* generic information about library. */ extern LIBMPQ_API const char *libmpq__version(void); /* string error message for a libmpq return code. */ extern LIBMPQ_API const char *libmpq__strerror(int32_t returncode); /* generic mpq archive information. */ extern LIBMPQ_API int32_t libmpq__archive_open(mpq_archive_s **mpq_archive, const char *mpq_filename, libmpq__off_t archive_offset); extern LIBMPQ_API int32_t libmpq__archive_close(mpq_archive_s *mpq_archive); extern LIBMPQ_API int32_t libmpq__archive_packed_size(mpq_archive_s *mpq_archive, libmpq__off_t *packed_size); extern LIBMPQ_API int32_t libmpq__archive_unpacked_size(mpq_archive_s *mpq_archive, libmpq__off_t *unpacked_size); extern LIBMPQ_API int32_t libmpq__archive_offset(mpq_archive_s *mpq_archive, libmpq__off_t *offset); extern LIBMPQ_API int32_t libmpq__archive_version(mpq_archive_s *mpq_archive, uint32_t *version); extern LIBMPQ_API int32_t libmpq__archive_files(mpq_archive_s *mpq_archive, uint32_t *files); /* generic file processing functions. */ extern LIBMPQ_API int32_t libmpq__file_packed_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *packed_size); extern LIBMPQ_API int32_t libmpq__file_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *unpacked_size); extern LIBMPQ_API int32_t libmpq__file_offset(mpq_archive_s *mpq_archive, uint32_t file_number, libmpq__off_t *offset); extern LIBMPQ_API int32_t libmpq__file_blocks(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *blocks); extern LIBMPQ_API int32_t libmpq__file_encrypted(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *encrypted); extern LIBMPQ_API int32_t libmpq__file_compressed(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *compressed); extern LIBMPQ_API int32_t libmpq__file_imploded(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t *imploded); extern LIBMPQ_API int32_t libmpq__file_number(mpq_archive_s *mpq_archive, const char *filename, uint32_t *number); extern LIBMPQ_API int32_t libmpq__file_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred); /* generic block processing functions. */ extern LIBMPQ_API int32_t libmpq__block_open_offset(mpq_archive_s *mpq_archive, uint32_t file_number); extern LIBMPQ_API int32_t libmpq__block_close_offset(mpq_archive_s *mpq_archive, uint32_t file_number); extern LIBMPQ_API int32_t libmpq__block_unpacked_size(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, libmpq__off_t *unpacked_size); extern LIBMPQ_API int32_t libmpq__block_read(mpq_archive_s *mpq_archive, uint32_t file_number, uint32_t block_number, uint8_t *out_buf, libmpq__off_t out_size, libmpq__off_t *transferred); #ifdef __cplusplus } #endif #endif /* _MPQ_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 SHERLOCK_UI_H #define SHERLOCK_UI_H #include "common/scummsys.h" #include "common/events.h" #include "sherlock/surface.h" #include "sherlock/objects.h" #include "sherlock/resources.h" #include "sherlock/fixed_text.h" namespace Sherlock { #define CONTROLS_Y 138 #define CONTROLS_Y1 151 enum MenuMode { STD_MODE = 0, LOOK_MODE = 1, MOVE_MODE = 2, TALK_MODE = 3, PICKUP_MODE = 4, OPEN_MODE = 5, CLOSE_MODE = 6, INV_MODE = 7, USE_MODE = 8, GIVE_MODE = 9, JOURNAL_MODE = 10, FILES_MODE = 11, SETUP_MODE = 12, // Rose Tattoo specific LAB_MODE = 20, MESSAGE_MODE = 21, VERB_MODE = 22, OPTION_MODE = 23, QUIT_MODE = 24, FOOLSCAP_MODE = 25, PASSWORD_MODE = 26 }; class UserInterface { protected: SherlockEngine *_vm; UserInterface(SherlockEngine *vm); public: MenuMode _menuMode; int _menuCounter; bool _infoFlag; bool _windowOpen; bool _endKeyActive; int _invLookFlag; bool _slideWindows; bool _helpStyle; Common::Rect _windowBounds; bool _lookScriptFlag; int _bgFound, _oldBgFound; int _exitZone; // TODO: Not so sure these should be in the base class. May want to refactor them to SherlockEngine, or refactor // various Scalpel dialogs to keep their own private state of key/selections signed char _key, _oldKey; int _selector, _oldSelector; int _temp, _oldTemp; int _temp1; int _lookHelp; public: static UserInterface *init(SherlockEngine *vm); virtual ~UserInterface() {} /** * Called for OPEN, CLOSE, and MOVE actions are being done */ void checkAction(ActionType &action, int objNum, FixedTextActionId fixedTextActionId = kFixedTextAction_Invalid); public: /** * Resets the user interface */ virtual void reset(); /** * Draw the user interface onto the screen's back buffers */ virtual void drawInterface(int bufferNum = 3) {} /** * Main input handler for the user interface */ virtual void handleInput() {} /** * Displays a passed window by gradually scrolling it vertically on-screen */ virtual void summonWindow(const Surface &bgSurface, bool slideUp = true) {} /** * Slide the window stored in the back buffer onto the screen */ virtual void summonWindow(bool slideUp = true, int height = CONTROLS_Y) {} /** * Close a currently open window * @param flag 0 = slide old window down, 1 = slide prior UI back up */ virtual void banishWindow(bool slideUp = true) {} /** * Clears the info line of the screen */ virtual void clearInfo() {} /** * Clear any active text window */ virtual void clearWindow() {} }; } // End of namespace Sherlock #endif
/* * Copyright 2011 The LibYuv Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef INCLUDE_LIBYUV_SCALE_H_ // NOLINT #define INCLUDE_LIBYUV_SCALE_H_ #include "libyuv/basic_types.h" #ifdef __cplusplus namespace libyuv { extern "C" { #endif // Supported filtering. enum FilterMode { kFilterNone = 0, // Point sample; Fastest. kFilterLinear = 1, // Filter horizontally only. kFilterBilinear = 2, // Faster than box, but lower quality scaling down. kFilterBox = 3 // Highest quality. }; // Scale a YUV plane. LIBYUV_API void ScalePlane(const uint8* src, int src_stride, int src_width, int src_height, uint8* dst, int dst_stride, int dst_width, int dst_height, enum FilterMode filtering); // Scales a YUV 4:2:0 image from the src width and height to the // dst width and height. // If filtering is kFilterNone, a simple nearest-neighbor algorithm is // used. This produces basic (blocky) quality at the fastest speed. // If filtering is kFilterBilinear, interpolation is used to produce a better // quality image, at the expense of speed. // If filtering is kFilterBox, averaging is used to produce ever better // quality image, at further expense of speed. // Returns 0 if successful. LIBYUV_API int I420Scale(const uint8* src_y, int src_stride_y, const uint8* src_u, int src_stride_u, const uint8* src_v, int src_stride_v, int src_width, int src_height, uint8* dst_y, int dst_stride_y, uint8* dst_u, int dst_stride_u, uint8* dst_v, int dst_stride_v, int dst_width, int dst_height, enum FilterMode filtering); #ifdef __cplusplus // Legacy API. Deprecated. LIBYUV_API int Scale(const uint8* src_y, const uint8* src_u, const uint8* src_v, int src_stride_y, int src_stride_u, int src_stride_v, int src_width, int src_height, uint8* dst_y, uint8* dst_u, uint8* dst_v, int dst_stride_y, int dst_stride_u, int dst_stride_v, int dst_width, int dst_height, bool interpolate); // Legacy API. Deprecated. LIBYUV_API int ScaleOffset(const uint8* src_i420, int src_width, int src_height, uint8* dst_i420, int dst_width, int dst_height, int dst_yoffset, bool interpolate); // For testing, allow disabling of specialized scalers. LIBYUV_API void SetUseReferenceImpl(bool use); #endif // __cplusplus #ifdef __cplusplus } // extern "C" } // namespace libyuv #endif #endif // INCLUDE_LIBYUV_SCALE_H_ NOLINT
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_ #define CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_ #include <string> #include "base/memory/scoped_ptr.h" #include "base/process/process.h" class TestLicenseServerConfig; // Class used to start a test license server. class TestLicenseServer { public: explicit TestLicenseServer(scoped_ptr<TestLicenseServerConfig> server_config); ~TestLicenseServer(); // Returns true if the server started successfully. False otherwise. bool Start(); // Returns true if the server was stopped successfully. False otherwise. bool Stop(); // Returns a string containing the URL and port the server is listening to. std::string GetServerURL(); private: // License server configuration class used to obtain server paths, etc. scoped_ptr<TestLicenseServerConfig> server_config_; // Process for the license server. base::Process license_server_process_; DISALLOW_COPY_AND_ASSIGN(TestLicenseServer); }; #endif // CHROME_BROWSER_MEDIA_TEST_LICENSE_SERVER_H_
//===- llvm/DebugInfo/Symbolize/DIPrinter.h ---------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file declares the DIPrinter class, which is responsible for printing // structures defined in DebugInfo/DIContext.h // //===----------------------------------------------------------------------===// #ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H #define LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H #include "llvm/Support/raw_ostream.h" namespace llvm { struct DILineInfo; class DIInliningInfo; struct DIGlobal; namespace symbolize { class DIPrinter { raw_ostream &OS; bool PrintFunctionNames; bool PrintPretty; int PrintSourceContext; bool Verbose; void print(const DILineInfo &Info, bool Inlined); void printContext(const std::string &FileName, int64_t Line); public: DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true, bool PrintPretty = false, int PrintSourceContext = 0, bool Verbose = false) : OS(OS), PrintFunctionNames(PrintFunctionNames), PrintPretty(PrintPretty), PrintSourceContext(PrintSourceContext), Verbose(Verbose) {} DIPrinter &operator<<(const DILineInfo &Info); DIPrinter &operator<<(const DIInliningInfo &Info); DIPrinter &operator<<(const DIGlobal &Global); }; } } #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 UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_ #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_H_ #include "base/basictypes.h" #include "base/callback.h" #include "ui/views/views_export.h" #include "ui/wm/public/dispatcher_client.h" namespace views { // TODO(erg): I won't lie to you; I have no idea what this is or what it does. class VIEWS_EXPORT DesktopDispatcherClient : public aura::client::DispatcherClient { public: DesktopDispatcherClient(); ~DesktopDispatcherClient() override; void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher, base::Closure* run_closure, base::Closure* quit_closure) override; private: DISALLOW_COPY_AND_ASSIGN(DesktopDispatcherClient); }; } // namespace views #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_DISPATCHER_CLIENT_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 UI_BASE_DEFAULT_THEME_PROVIDER_H_ #define UI_BASE_DEFAULT_THEME_PROVIDER_H_ #include <vector> #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/base/theme_provider.h" #include "ui/base/ui_base_export.h" namespace ui { class ResourceBundle; } namespace ui { class UI_BASE_EXPORT DefaultThemeProvider : public ThemeProvider { public: DefaultThemeProvider(); virtual ~DefaultThemeProvider(); // Overridden from ui::ThemeProvider: virtual bool UsingSystemTheme() const OVERRIDE; virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const OVERRIDE; virtual SkColor GetColor(int id) const OVERRIDE; virtual int GetDisplayProperty(int id) const OVERRIDE; virtual bool ShouldUseNativeFrame() const OVERRIDE; virtual bool HasCustomImage(int id) const OVERRIDE; virtual base::RefCountedMemory* GetRawData( int id, ui::ScaleFactor scale_factor) const OVERRIDE; #if defined(OS_MACOSX) virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; virtual NSColor* GetNSColor(int id) const OVERRIDE; virtual NSColor* GetNSColorTint(int id) const OVERRIDE; virtual NSGradient* GetNSGradient(int id) const OVERRIDE; #endif private: DISALLOW_COPY_AND_ASSIGN(DefaultThemeProvider); }; } // namespace ui #endif // UI_BASE_DEFAULT_THEME_PROVIDER_H_
#ifdef CONFIG_ARM64_MODULE_PLTS SECTIONS { .plt (NOLOAD) : { BYTE(0) } .init.plt (NOLOAD) : { BYTE(0) } .text.ftrace_trampoline (NOLOAD) : { BYTE(0) } } #endif
/* * ItExtVpdPanel.h * Copyright (C) 2002 Dave Boutcher IBM Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _ITEXTVPDPANEL_H #define _ITEXTVPDPANEL_H /* * * This struct maps the panel information * * Warning: * This data must match the architecture for the panel information * */ /*------------------------------------------------------------------- * Standard Includes *------------------------------------------------------------------- */ #include <asm/types.h> struct ItExtVpdPanel { // Definition of the Extended Vpd On Panel Data Area char systemSerial[8]; char mfgID[4]; char reserved1[24]; char machineType[4]; char systemID[6]; char somUniqueCnt[4]; char serialNumberCount; char reserved2[7]; u16 bbu3; u16 bbu2; u16 bbu1; char xLocationLabel[8]; u8 xRsvd1[6]; u16 xFrameId; u8 xRsvd2[48]; }; #endif /* _ITEXTVPDPANEL_H */
/* * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <sched.h> #include <limits.h> #include <sys/signal.h> #include <sys/wait.h> #include "user.h" #include "kern_util.h" #include "os.h" #include "um_malloc.h" #include "kern_constants.h" struct helper_data { void (*pre_exec)(void*); void *pre_data; char **argv; int fd; char *buf; }; static int helper_child(void *arg) { struct helper_data *data = arg; char **argv = data->argv; int errval; if (data->pre_exec != NULL) (*data->pre_exec)(data->pre_data); errval = execvp_noalloc(data->buf, argv[0], argv); printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0], -errval); write(data->fd, &errval, sizeof(errval)); kill(os_getpid(), SIGKILL); return 0; } /* Returns either the pid of the child process we run or -E* on failure. * XXX The alloc_stack here breaks if this is called in the tracing thread, so * we need to receive a preallocated stack (a local buffer is ok). */ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, unsigned long *stack_out) { struct helper_data data; unsigned long stack, sp; int pid, fds[2], ret, n; if ((stack_out != NULL) && (*stack_out != 0)) stack = *stack_out; else stack = alloc_stack(0, __cant_sleep()); if (stack == 0) return -ENOMEM; ret = os_pipe(fds, 1, 0); if (ret < 0) { printk("run_helper : pipe failed, ret = %d\n", -ret); goto out_free; } ret = os_set_exec_close(fds[1], 1); if (ret < 0) { printk("run_helper : setting FD_CLOEXEC failed, ret = %d\n", -ret); goto out_close; } sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *); data.pre_exec = pre_exec; data.pre_data = pre_data; data.argv = argv; data.fd = fds[1]; data.buf = __cant_sleep() ? um_kmalloc_atomic(PATH_MAX) : um_kmalloc(PATH_MAX); pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); if (pid < 0) { ret = -errno; printk("run_helper : clone failed, errno = %d\n", errno); goto out_free2; } close(fds[1]); fds[1] = -1; /* * Read the errno value from the child, if the exec failed, or get 0 if * the exec succeeded because the pipe fd was set as close-on-exec. */ n = read(fds[0], &ret, sizeof(ret)); if (n == 0) { ret = pid; } else { if (n < 0) { n = -errno; printk("run_helper : read on pipe failed, ret = %d\n", -n); ret = n; kill(pid, SIGKILL); } CATCH_EINTR(waitpid(pid, NULL, 0)); } out_free2: kfree(data.buf); out_close: if (fds[1] != -1) close(fds[1]); close(fds[0]); out_free: if ((stack_out == NULL) || (*stack_out == 0)) free_stack(stack, 0); return ret; } int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags, unsigned long *stack_out, int stack_order) { unsigned long stack, sp; int pid, status, err; stack = alloc_stack(stack_order, __cant_sleep()); if (stack == 0) return -ENOMEM; sp = stack + (UM_KERN_PAGE_SIZE << stack_order) - sizeof(void *); pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); if (pid < 0) { err = -errno; printk("run_helper_thread : clone failed, errno = %d\n", errno); return err; } if (stack_out == NULL) { CATCH_EINTR(pid = waitpid(pid, &status, 0)); if (pid < 0) { err = -errno; printk("run_helper_thread - wait failed, errno = %d\n", errno); pid = err; } if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) printk("run_helper_thread - thread returned status " "0x%x\n", status); free_stack(stack, stack_order); } else *stack_out = stack; return pid; } int helper_wait(int pid) { int ret; CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); if (ret < 0) { ret = -errno; printk("helper_wait : waitpid failed, errno = %d\n", errno); } return ret; }
/** * Copyright (c) 2011 Jonathan Cameron * * 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. * * Buffer handling elements of industrial I/O reference driver. * Uses the kfifo buffer. * * To test without hardware use the sysfs trigger. */ #include <linux/kernel.h> #include <linux/export.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/bitmap.h> #include <linux/iio/iio.h> #include <linux/iio/trigger_consumer.h> #include <linux/iio/buffer.h> #include <linux/iio/kfifo_buf.h> #include "iio_simple_dummy.h" /* Some fake data */ static const s16 fakedata[] = { [DUMMY_INDEX_VOLTAGE_0] = 7, [DUMMY_INDEX_DIFFVOLTAGE_1M2] = -33, [DUMMY_INDEX_DIFFVOLTAGE_3M4] = -2, [DUMMY_INDEX_ACCELX] = 344, }; /** * iio_simple_dummy_trigger_h() - the trigger handler function * @irq: the interrupt number * @p: private data - always a pointer to the poll func. * * This is the guts of buffered capture. On a trigger event occurring, * if the pollfunc is attached then this handler is called as a threaded * interrupt (and hence may sleep). It is responsible for grabbing data * from the device and pushing it into the associated buffer. */ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p) { struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; int len = 0; u16 *data; data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); if (!data) goto done; if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) { /* * Three common options here: * hardware scans: certain combinations of channels make * up a fast read. The capture will consist of all of them. * Hence we just call the grab data function and fill the * buffer without processing. * software scans: can be considered to be random access * so efficient reading is just a case of minimal bus * transactions. * software culled hardware scans: * occasionally a driver may process the nearest hardware * scan to avoid storing elements that are not desired. This * is the fiddliest option by far. * Here let's pretend we have random access. And the values are * in the constant table fakedata. */ int i, j; for (i = 0, j = 0; i < bitmap_weight(indio_dev->active_scan_mask, indio_dev->masklength); i++, j++) { j = find_next_bit(indio_dev->active_scan_mask, indio_dev->masklength, j); /* random access read from the 'device' */ data[i] = fakedata[j]; len += 2; } } iio_push_to_buffers_with_timestamp(indio_dev, data, iio_get_time_ns(indio_dev)); kfree(data); done: /* * Tell the core we are done with this trigger and ready for the * next one. */ iio_trigger_notify_done(indio_dev->trig); return IRQ_HANDLED; } static const struct iio_buffer_setup_ops iio_simple_dummy_buffer_setup_ops = { /* * iio_triggered_buffer_postenable: * Generic function that simply attaches the pollfunc to the trigger. * Replace this to mess with hardware state before we attach the * trigger. */ .postenable = &iio_triggered_buffer_postenable, /* * iio_triggered_buffer_predisable: * Generic function that simple detaches the pollfunc from the trigger. * Replace this to put hardware state back again after the trigger is * detached but before userspace knows we have disabled the ring. */ .predisable = &iio_triggered_buffer_predisable, }; int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev) { int ret; struct iio_buffer *buffer; /* Allocate a buffer to use - here a kfifo */ buffer = iio_kfifo_allocate(); if (!buffer) { ret = -ENOMEM; goto error_ret; } iio_device_attach_buffer(indio_dev, buffer); /* * Tell the core what device type specific functions should * be run on either side of buffer capture enable / disable. */ indio_dev->setup_ops = &iio_simple_dummy_buffer_setup_ops; /* * Configure a polling function. * When a trigger event with this polling function connected * occurs, this function is run. Typically this grabs data * from the device. * * NULL for the bottom half. This is normally implemented only if we * either want to ping a capture now pin (no sleeping) or grab * a timestamp as close as possible to a data ready trigger firing. * * IRQF_ONESHOT ensures irqs are masked such that only one instance * of the handler can run at a time. * * "iio_simple_dummy_consumer%d" formatting string for the irq 'name' * as seen under /proc/interrupts. Remaining parameters as per printk. */ indio_dev->pollfunc = iio_alloc_pollfunc(NULL, &iio_simple_dummy_trigger_h, IRQF_ONESHOT, indio_dev, "iio_simple_dummy_consumer%d", indio_dev->id); if (!indio_dev->pollfunc) { ret = -ENOMEM; goto error_free_buffer; } /* * Notify the core that this device is capable of buffered capture * driven by a trigger. */ indio_dev->modes |= INDIO_BUFFER_TRIGGERED; return 0; error_free_buffer: iio_kfifo_free(indio_dev->buffer); error_ret: return ret; } /** * iio_simple_dummy_unconfigure_buffer() - release buffer resources * @indo_dev: device instance state */ void iio_simple_dummy_unconfigure_buffer(struct iio_dev *indio_dev) { iio_dealloc_pollfunc(indio_dev->pollfunc); iio_kfifo_free(indio_dev->buffer); }
/***************************************************************************** * * Copyright (C) 2012 Advanced Micro Devices, 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: * * 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 Advanced Micro Devices, Inc. nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. 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 "Platform.h" UINT8 isEcPresent(){ UINT8 dbFlag; UINT16 dwVar0; //Read the EC configuration register base address from LPCCfg_A4[15:1] //Write 0x5A to the EC config index register to unlock the access //Write 0x20 to the EC config index register to select the device ID register //Read the value of device ID register from the EC config data register //If the value read is 0xB7, then EC is enabled. //Write 0xA5 to re-lock the EC config index register if EC is enabled. ReadPCI((LPC_BUS_DEV_FUN << 16) + SB_LPC_REGA4, AccWidthUint16 | S3_SAVE, &dwVar0); dwVar0 &= 0xFFFE; RWIO(dwVar0, AccWidthUint8, 0, 0x5A); RWIO(dwVar0, AccWidthUint8, 0, 0x20); ReadIO(dwVar0+1, AccWidthUint8, &dbFlag); RWIO(dwVar0, AccWidthUint8, 0, 0xA5); return ( dbFlag == 0xB7); } void getSbInformation ( SB_INFORMATION *sbInfo){ UINT16 dwDevId; UINT8 dbRev; ReadPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG02, AccWidthUint16 | S3_SAVE, &dwDevId); ReadPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG08, AccWidthUint8 | S3_SAVE, &dbRev); sbInfo->sbModelMask = SB_MODEL_UNKNOWN; if ( (dwDevId == SB7XX_DEVICE_ID) && (dbRev <= SB_Rev_Sb7xx_A14) ){ sbInfo->sbModelMask |= SB_MODEL_SB700; sbInfo->sbModelMask |= SB_MODEL_SR5690; sbInfo->sbRev = dbRev; ReadPCI((LPC_BUS_DEV_FUN << 16) + SB_LPC_REG9C, AccWidthUint8 | S3_SAVE, &dbRev); if (dbRev & 01) sbInfo->sbModelMask |= SB_MODEL_SB750; if (isEcPresent()) sbInfo->sbModelMask |= SB_MODEL_SB710; return; } } SB_CAPABILITY_SETTING getSbCapability ( SB_CAPABILITY_ITEM sbCapabilityItem ) { SB_CAPABILITY_SETTING sbCapSetting=SB_UNKNOWN; UINT32 ddTemp0; RWPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG43, AccWidthUint8 | S3_SAVE, ~(UINT32)BIT3, 00); ReadPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG10, AccWidthUint32, &ddTemp0); if (sbCapabilityItem < Sb_Unknown_Capability) sbCapSetting = ((ddTemp0 >> (sbCapabilityItem << 1) ) & 0x03); RWPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG43, AccWidthUint8 | S3_SAVE, 0xFF, BIT3); return sbCapSetting; } void setSbCapability ( SB_CAPABILITY_ITEM sbCapabilityItem, SB_CAPABILITY_SETTING sbCapSetting ) { UINT32 ddTemp0; RWPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG43, AccWidthUint8 | S3_SAVE, ~(UINT32)BIT3, 00); ReadPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG10, AccWidthUint32, &ddTemp0); if ( (sbCapabilityItem < Sb_Unknown_Capability) & (sbCapSetting < Sb_Cap_Setting_Unknown) ) ddTemp0 = (ddTemp0 & ~(0x03 << (sbCapabilityItem << 1))) | ( (sbCapSetting & 0x03) << (sbCapabilityItem << 1)); WritePCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG10, AccWidthUint32, &ddTemp0); RWPCI((SMBUS_BUS_DEV_FUN << 16) + SB_SMBUS_REG43, AccWidthUint8 | S3_SAVE, 0xFF, BIT3); }
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MIGRATOR_H_ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MIGRATOR_H_ #include <string> #include "base/macros.h" #include "chrome/browser/extensions/external_loader.h" class Profile; namespace extensions { // An ExternalLoader that provides the new extension for the following // scenarios: // - Existing profile that has the old. // - Existing profile that already has the new. // Note that the old extension is not removed. class ExtensionMigrator : public ExternalLoader { public: ExtensionMigrator(Profile* profile, const std::string& old_id, const std::string& new_id); protected: ~ExtensionMigrator() override; // ExternalLoader: void StartLoading() override; private: bool IsAppPresent(const std::string& app_id); Profile* profile_; const std::string old_id_; const std::string new_id_; DISALLOW_COPY_AND_ASSIGN(ExtensionMigrator); }; } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MIGRATOR_H_