text
stringlengths
4
6.14k
/***************************************************************************** * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved. * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2, available at * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a * license other than the GPL, without Broadcom's express prior written * consent. *****************************************************************************/ #ifndef CSP_REG_H #define CSP_REG_H #include <csp/stdint.h> #define __REG32(x) (*((volatile uint32_t *)(x))) #define __REG16(x) (*((volatile uint16_t *)(x))) #define __REG8(x) (*((volatile uint8_t *) (x))) #define REG8_RSVD(start, end) uint8_t rsvd_##start[(end - start) / sizeof(uint8_t)] #define REG16_RSVD(start, end) uint16_t rsvd_##start[(end - start) / sizeof(uint16_t)] #define REG32_RSVD(start, end) uint32_t rsvd_##start[(end - start) / sizeof(uint32_t)] #if defined(__KERNEL__) && !defined(STANDALONE) #include <mach/hardware.h> #include <linux/interrupt.h> #define REG_LOCAL_IRQ_SAVE HW_DECLARE_SPINLOCK(reg32) \ unsigned long flags; HW_IRQ_SAVE(reg32, flags) #define REG_LOCAL_IRQ_RESTORE HW_IRQ_RESTORE(reg32, flags) #else #define REG_LOCAL_IRQ_SAVE #define REG_LOCAL_IRQ_RESTORE #endif static inline void reg32_modify_and(volatile uint32_t *reg, uint32_t value) { REG_LOCAL_IRQ_SAVE; *reg &= value; REG_LOCAL_IRQ_RESTORE; } static inline void reg32_modify_or(volatile uint32_t *reg, uint32_t value) { REG_LOCAL_IRQ_SAVE; *reg |= value; REG_LOCAL_IRQ_RESTORE; } static inline void reg32_modify_mask(volatile uint32_t *reg, uint32_t mask, uint32_t value) { REG_LOCAL_IRQ_SAVE; *reg = (*reg & mask) | value; REG_LOCAL_IRQ_RESTORE; } static inline void reg32_write(volatile uint32_t *reg, uint32_t value) { *reg = value; } #endif
/* * Copyright 2015 Freescale Semiconductor, Inc. * * Freescale DCU drm device driver * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef __FSL_DCU_DRM_DRV_H__ #define __FSL_DCU_DRM_DRV_H__ #include "fsl_dcu_drm_crtc.h" #include "fsl_dcu_drm_output.h" #include "fsl_dcu_drm_plane.h" #define DCU_DCU_MODE 0x0010 #define DCU_MODE_BLEND_ITER(x) ((x) << 20) #define DCU_MODE_RASTER_EN BIT(14) #define DCU_MODE_DCU_MODE(x) (x) #define DCU_MODE_DCU_MODE_MASK 0x03 #define DCU_MODE_OFF 0 #define DCU_MODE_NORMAL 1 #define DCU_MODE_TEST 2 #define DCU_MODE_COLORBAR 3 #define DCU_BGND 0x0014 #define DCU_BGND_R(x) ((x) << 16) #define DCU_BGND_G(x) ((x) << 8) #define DCU_BGND_B(x) (x) #define DCU_DISP_SIZE 0x0018 #define DCU_DISP_SIZE_DELTA_Y(x) ((x) << 16) /*Regisiter value 1/16 of horizontal resolution*/ #define DCU_DISP_SIZE_DELTA_X(x) ((x) >> 4) #define DCU_HSYN_PARA 0x001c #define DCU_HSYN_PARA_BP(x) ((x) << 22) #define DCU_HSYN_PARA_PW(x) ((x) << 11) #define DCU_HSYN_PARA_FP(x) (x) #define DCU_VSYN_PARA 0x0020 #define DCU_VSYN_PARA_BP(x) ((x) << 22) #define DCU_VSYN_PARA_PW(x) ((x) << 11) #define DCU_VSYN_PARA_FP(x) (x) #define DCU_SYN_POL 0x0024 #define DCU_SYN_POL_INV_PXCK_FALL (0 << 6) #define DCU_SYN_POL_NEG_REMAIN (0 << 5) #define DCU_SYN_POL_INV_VS_LOW BIT(1) #define DCU_SYN_POL_INV_HS_LOW BIT(0) #define DCU_THRESHOLD 0x0028 #define DCU_THRESHOLD_LS_BF_VS(x) ((x) << 16) #define DCU_THRESHOLD_OUT_BUF_HIGH(x) ((x) << 8) #define DCU_THRESHOLD_OUT_BUF_LOW(x) (x) #define BF_VS_VAL 0x03 #define BUF_MAX_VAL 0x78 #define BUF_MIN_VAL 0x0a #define DCU_INT_STATUS 0x002C #define DCU_INT_STATUS_VSYNC BIT(0) #define DCU_INT_STATUS_UNDRUN BIT(1) #define DCU_INT_STATUS_LSBFVS BIT(2) #define DCU_INT_STATUS_VBLANK BIT(3) #define DCU_INT_STATUS_CRCREADY BIT(4) #define DCU_INT_STATUS_CRCOVERFLOW BIT(5) #define DCU_INT_STATUS_P1FIFOLO BIT(6) #define DCU_INT_STATUS_P1FIFOHI BIT(7) #define DCU_INT_STATUS_P2FIFOLO BIT(8) #define DCU_INT_STATUS_P2FIFOHI BIT(9) #define DCU_INT_STATUS_PROGEND BIT(10) #define DCU_INT_STATUS_IPMERROR BIT(11) #define DCU_INT_STATUS_LYRTRANS BIT(12) #define DCU_INT_STATUS_DMATRANS BIT(14) #define DCU_INT_STATUS_P3FIFOLO BIT(16) #define DCU_INT_STATUS_P3FIFOHI BIT(17) #define DCU_INT_STATUS_P4FIFOLO BIT(18) #define DCU_INT_STATUS_P4FIFOHI BIT(19) #define DCU_INT_STATUS_P1EMPTY BIT(26) #define DCU_INT_STATUS_P2EMPTY BIT(27) #define DCU_INT_STATUS_P3EMPTY BIT(28) #define DCU_INT_STATUS_P4EMPTY BIT(29) #define DCU_INT_MASK 0x0030 #define DCU_INT_MASK_VSYNC BIT(0) #define DCU_INT_MASK_UNDRUN BIT(1) #define DCU_INT_MASK_LSBFVS BIT(2) #define DCU_INT_MASK_VBLANK BIT(3) #define DCU_INT_MASK_CRCREADY BIT(4) #define DCU_INT_MASK_CRCOVERFLOW BIT(5) #define DCU_INT_MASK_P1FIFOLO BIT(6) #define DCU_INT_MASK_P1FIFOHI BIT(7) #define DCU_INT_MASK_P2FIFOLO BIT(8) #define DCU_INT_MASK_P2FIFOHI BIT(9) #define DCU_INT_MASK_PROGEND BIT(10) #define DCU_INT_MASK_IPMERROR BIT(11) #define DCU_INT_MASK_LYRTRANS BIT(12) #define DCU_INT_MASK_DMATRANS BIT(14) #define DCU_INT_MASK_P3FIFOLO BIT(16) #define DCU_INT_MASK_P3FIFOHI BIT(17) #define DCU_INT_MASK_P4FIFOLO BIT(18) #define DCU_INT_MASK_P4FIFOHI BIT(19) #define DCU_INT_MASK_P1EMPTY BIT(26) #define DCU_INT_MASK_P2EMPTY BIT(27) #define DCU_INT_MASK_P3EMPTY BIT(28) #define DCU_INT_MASK_P4EMPTY BIT(29) #define DCU_DIV_RATIO 0x0054 #define DCU_UPDATE_MODE 0x00cc #define DCU_UPDATE_MODE_MODE BIT(31) #define DCU_UPDATE_MODE_READREG BIT(30) #define DCU_DCFB_MAX 0x300 #define DCU_CTRLDESCLN(layer, reg) (0x200 + (reg - 1) * 4 + (layer) * 0x40) #define DCU_LAYER_HEIGHT(x) ((x) << 16) #define DCU_LAYER_WIDTH(x) (x) #define DCU_LAYER_POSY(x) ((x) << 16) #define DCU_LAYER_POSX(x) (x) #define DCU_LAYER_EN BIT(31) #define DCU_LAYER_TILE_EN BIT(30) #define DCU_LAYER_DATA_SEL_CLUT BIT(29) #define DCU_LAYER_SAFETY_EN BIT(28) #define DCU_LAYER_TRANS(x) ((x) << 20) #define DCU_LAYER_BPP(x) ((x) << 16) #define DCU_LAYER_RLE_EN BIT(15) #define DCU_LAYER_LUOFFS(x) ((x) << 4) #define DCU_LAYER_BB_ON BIT(2) #define DCU_LAYER_AB_NONE 0 #define DCU_LAYER_AB_CHROMA_KEYING 1 #define DCU_LAYER_AB_WHOLE_FRAME 2 #define DCU_LAYER_CKMAX_R(x) ((x) << 16) #define DCU_LAYER_CKMAX_G(x) ((x) << 8) #define DCU_LAYER_CKMAX_B(x) (x) #define DCU_LAYER_CKMIN_R(x) ((x) << 16) #define DCU_LAYER_CKMIN_G(x) ((x) << 8) #define DCU_LAYER_CKMIN_B(x) (x) #define DCU_LAYER_TILE_VER(x) ((x) << 16) #define DCU_LAYER_TILE_HOR(x) (x) #define DCU_LAYER_FG_FCOLOR(x) (x) #define DCU_LAYER_BG_BCOLOR(x) (x) #define DCU_LAYER_POST_SKIP(x) ((x) << 16) #define DCU_LAYER_PRE_SKIP(x) (x) #define FSL_DCU_RGB565 4 #define FSL_DCU_RGB888 5 #define FSL_DCU_ARGB8888 6 #define FSL_DCU_ARGB1555 11 #define FSL_DCU_ARGB4444 12 #define FSL_DCU_YUV422 14 #define VF610_LAYER_REG_NUM 9 #define LS1021A_LAYER_REG_NUM 10 struct clk; struct device; struct drm_device; struct fsl_dcu_soc_data { const char *name; /*total layer number*/ unsigned int total_layer; /*max layer number DCU supported*/ unsigned int max_layer; }; struct fsl_dcu_drm_device { struct device *dev; struct device_node *np; struct regmap *regmap; int irq; struct clk *clk; /*protects hardware register*/ spinlock_t irq_lock; struct drm_device *drm; struct drm_fbdev_cma *fbdev; struct drm_crtc crtc; struct drm_encoder encoder; struct fsl_dcu_drm_connector connector; const struct fsl_dcu_soc_data *soc; }; void fsl_dcu_fbdev_init(struct drm_device *dev); int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev); #endif /* __FSL_DCU_DRM_DRV_H__ */
/* Minimal main program -- everything is loaded from the library */ #include "Python.h" #include <locale.h> #ifdef __FreeBSD__ #include <floatingpoint.h> #endif #ifdef MS_WINDOWS int wmain(int argc, wchar_t **argv) { return Py_Main(argc, argv); } #else int main(int argc, char **argv) { wchar_t **argv_copy; /* We need a second copy, as Python might modify the first one. */ wchar_t **argv_copy2; int i, res; char *oldloc; #ifdef __FreeBSD__ fp_except_t m; #endif argv_copy = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1)); argv_copy2 = (wchar_t **)PyMem_RawMalloc(sizeof(wchar_t*) * (argc+1)); if (!argv_copy || !argv_copy2) { fprintf(stderr, "out of memory\n"); return 1; } /* 754 requires that FP exceptions run in "no stop" mode by default, * and until C vendors implement C99's ways to control FP exceptions, * Python requires non-stop mode. Alas, some platforms enable FP * exceptions by default. Here we disable them. */ #ifdef __FreeBSD__ m = fpgetmask(); fpsetmask(m & ~FP_X_OFL); #endif oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL)); if (!oldloc) { fprintf(stderr, "out of memory\n"); return 1; } setlocale(LC_ALL, ""); for (i = 0; i < argc; i++) { argv_copy[i] = _Py_char2wchar(argv[i], NULL); if (!argv_copy[i]) { PyMem_RawFree(oldloc); fprintf(stderr, "Fatal Python error: " "unable to decode the command line argument #%i\n", i + 1); return 1; } argv_copy2[i] = argv_copy[i]; } argv_copy2[argc] = argv_copy[argc] = NULL; setlocale(LC_ALL, oldloc); PyMem_RawFree(oldloc); res = Py_Main(argc, argv_copy); for (i = 0; i < argc; i++) { PyMem_RawFree(argv_copy2[i]); } PyMem_RawFree(argv_copy); PyMem_RawFree(argv_copy2); return res; } #endif
/* $NoKeywords:$ */ /** * @file * * Fch SATA AHCI controller Library * * SATA AHCI Library * * @xrefitem bom "File Content Label" "Release Content" * @e project: AGESA * @e sub-project: FCH * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ * */ /* ***************************************************************************** * * Copyright (c) 2008 - 2013, 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 "FchPlatform.h" #include "Filecode.h" #define FILECODE PROC_FCH_SATA_AHCILIB_FILECODE /** * sataAhciSetDeviceNumMsi - Program AHCI controller support * device number cap & MSI cap * * * * @param[in] FchDataPtr Fch configuration structure pointer. * */ VOID SataAhciSetDeviceNumMsi ( IN VOID *FchDataPtr ) { FCH_INTERFACE *LocalCfgPtr; LocalCfgPtr = (FCH_INTERFACE *)FchDataPtr; SataSetDeviceNumMsi (LocalCfgPtr); }
/* Macros to swap the order of bytes in 16-bit integer values. Copyright (C) 2012-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/>. */ #ifndef _BITS_BYTESWAP_H # error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead." #endif #ifdef __GNUC__ # define __bswap_16(x) \ (__extension__ \ ({ unsigned short int __bsx = (unsigned short int) (x); \ __bswap_constant_16 (__bsx); })) #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) { return __bswap_constant_16 (__bsx); } #endif
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <Foundation/Foundation.h> @class RCTBridge; typedef NS_ENUM(NSUInteger, RCTFunctionType) { RCTFunctionTypeNormal, RCTFunctionTypePromise, RCTFunctionTypeSync, }; static inline const char *RCTFunctionDescriptorFromType(RCTFunctionType type) { switch (type) { case RCTFunctionTypeNormal: return "async"; case RCTFunctionTypePromise: return "promise"; case RCTFunctionTypeSync: return "sync"; } }; @protocol RCTBridgeMethod <NSObject> @property (nonatomic, copy, readonly) NSString *JSMethodName; @property (nonatomic, readonly) RCTFunctionType functionType; - (id)invokeWithBridge:(RCTBridge *)bridge module:(id)module arguments:(NSArray *)arguments; @end
#include <gio/gio.h> static gchar *opt_name = NULL; static gboolean opt_system_bus = FALSE; static gboolean opt_auto_start = FALSE; static GOptionEntry opt_entries[] = { { "name", 'n', 0, G_OPTION_ARG_STRING, &opt_name, "Name to watch", NULL }, { "system-bus", 's', 0, G_OPTION_ARG_NONE, &opt_system_bus, "Use the system-bus instead of the session-bus", NULL }, { "auto-start", 'a', 0, G_OPTION_ARG_NONE, &opt_auto_start, "Instruct the bus to launch an owner for the name", NULL}, { NULL} }; static void on_name_appeared (GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer user_data) { g_print ("Name %s on %s is owned by %s\n", name, opt_system_bus ? "the system bus" : "the session bus", name_owner); } static void on_name_vanished (GDBusConnection *connection, const gchar *name, gpointer user_data) { g_print ("Name %s does not exist on %s\n", name, opt_system_bus ? "the system bus" : "the session bus"); } int main (int argc, char *argv[]) { guint watcher_id; GMainLoop *loop; GOptionContext *opt_context; GError *error; GBusNameWatcherFlags flags; error = NULL; opt_context = g_option_context_new ("g_bus_watch_name() example"); g_option_context_set_summary (opt_context, "Example: to watch the power manager on the session bus, use:\n" "\n" " ./example-watch-name -n org.gnome.PowerManager"); g_option_context_add_main_entries (opt_context, opt_entries, NULL); if (!g_option_context_parse (opt_context, &argc, &argv, &error)) { g_printerr ("Error parsing options: %s", error->message); goto out; } if (opt_name == NULL) { g_printerr ("Incorrect usage, try --help.\n"); goto out; } flags = G_BUS_NAME_WATCHER_FLAGS_NONE; if (opt_auto_start) flags |= G_BUS_NAME_WATCHER_FLAGS_AUTO_START; watcher_id = g_bus_watch_name (opt_system_bus ? G_BUS_TYPE_SYSTEM : G_BUS_TYPE_SESSION, opt_name, flags, on_name_appeared, on_name_vanished, NULL, NULL); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unwatch_name (watcher_id); out: g_option_context_free (opt_context); g_free (opt_name); return 0; }
/* ========================================================================= */ /* === AMD_valid =========================================================== */ /* ========================================================================= */ /* ------------------------------------------------------------------------- */ /* AMD, Copyright (c) Timothy A. Davis, */ /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ /* email: davis at cise.ufl.edu CISE Department, Univ. of Florida. */ /* web: http://www.cise.ufl.edu/research/sparse/amd */ /* ------------------------------------------------------------------------- */ /* Check if a column-form matrix is valid or not. The matrix A is * n_row-by-n_col. The row indices of entries in column j are in * Ai [Ap [j] ... Ap [j+1]-1]. Required conditions are: * * n_row >= 0 * n_col >= 0 * nz = Ap [n_col] >= 0 number of entries in the matrix * Ap [0] == 0 * Ap [j] <= Ap [j+1] for all j in the range 0 to n_col. * Ai [0 ... nz-1] must be in the range 0 to n_row-1. * * If any of the above conditions hold, AMD_INVALID is returned. If the * following condition holds, AMD_OK_BUT_JUMBLED is returned (a warning, * not an error): * * row indices in Ai [Ap [j] ... Ap [j+1]-1] are not sorted in ascending * order, and/or duplicate entries exist. * * Otherwise, AMD_OK is returned. * * In v1.2 and earlier, this function returned TRUE if the matrix was valid * (now returns AMD_OK), or FALSE otherwise (now returns AMD_INVALID or * AMD_OK_BUT_JUMBLED). */ #include "amd_internal.h" GLOBAL Int AMD_valid ( /* inputs, not modified on output: */ Int n_row, /* A is n_row-by-n_col */ Int n_col, const Int Ap [ ], /* column pointers of A, of size n_col+1 */ const Int Ai [ ] /* row indices of A, of size nz = Ap [n_col] */ ) { Int nz, j, p1, p2, ilast, i, p, result = AMD_OK ; if (n_row < 0 || n_col < 0 || Ap == NULL || Ai == NULL) { return (AMD_INVALID) ; } nz = Ap [n_col] ; if (Ap [0] != 0 || nz < 0) { /* column pointers must start at Ap [0] = 0, and Ap [n] must be >= 0 */ AMD_DEBUG0 (("column 0 pointer bad or nz < 0\n")) ; return (AMD_INVALID) ; } for (j = 0 ; j < n_col ; j++) { p1 = Ap [j] ; p2 = Ap [j+1] ; AMD_DEBUG2 (("\nColumn: "ID" p1: "ID" p2: "ID"\n", j, p1, p2)) ; if (p1 > p2) { /* column pointers must be ascending */ AMD_DEBUG0 (("column "ID" pointer bad\n", j)) ; return (AMD_INVALID) ; } ilast = EMPTY ; for (p = p1 ; p < p2 ; p++) { i = Ai [p] ; AMD_DEBUG3 (("row: "ID"\n", i)) ; if (i < 0 || i >= n_row) { /* row index out of range */ AMD_DEBUG0 (("index out of range, col "ID" row "ID"\n", j, i)); return (AMD_INVALID) ; } if (i <= ilast) { /* row index unsorted, or duplicate entry present */ AMD_DEBUG1 (("index unsorted/dupl col "ID" row "ID"\n", j, i)); result = AMD_OK_BUT_JUMBLED ; } ilast = i ; } } return (result) ; }
/** * OMAP1 Dual-Mode Timers - platform device registration * * Contains first level initialization routines which internally * generates timer device information and registers with linux * device model. It also has low level function to chnage the timer * input clock source. * * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ * Tarun Kanti DebBarma <tarun.kanti@ti.com> * Thara Gopinath <thara@ti.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed "as is" WITHOUT ANY WARRANTY of any * kind, whether express or implied; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <linux/clk.h> #include <linux/io.h> #include <linux/err.h> #include <linux/slab.h> #include <linux/platform_device.h> #include <mach/irqs.h> #include <plat/dmtimer.h> #define OMAP1610_GPTIMER1_BASE 0xfffb1400 #define OMAP1610_GPTIMER2_BASE 0xfffb1c00 #define OMAP1610_GPTIMER3_BASE 0xfffb2400 #define OMAP1610_GPTIMER4_BASE 0xfffb2c00 #define OMAP1610_GPTIMER5_BASE 0xfffb3400 #define OMAP1610_GPTIMER6_BASE 0xfffb3c00 #define OMAP1610_GPTIMER7_BASE 0xfffb7400 #define OMAP1610_GPTIMER8_BASE 0xfffbd400 #define OMAP1_DM_TIMER_COUNT 8 #define OMAP_TIMER_OCP_CFG_REG 0x10 #define OMAP_TIMER_SYS_STAT_REG 0x14 #define OMAP_TIMER_IF_CTRL_REG 0x40 static int omap1_dm_timer_set_src(struct platform_device *pdev, int source) { int n = (pdev->id - 1) << 1; u32 l; l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); l |= source << n; omap_writel(l, MOD_CONF_CTRL_1); return 0; } int __init omap1_dm_timer_init(void) { int i; int ret; struct dmtimer_platform_data *pdata; struct platform_device *pdev; if (!cpu_is_omap16xx()) return 0; for (i = 1; i <= OMAP1_DM_TIMER_COUNT; i++) { struct resource res[2]; u32 base, irq; switch (i) { case 1: base = OMAP1610_GPTIMER1_BASE; irq = INT_1610_GPTIMER1; break; case 2: base = OMAP1610_GPTIMER2_BASE; irq = INT_1610_GPTIMER2; break; case 3: base = OMAP1610_GPTIMER3_BASE; irq = INT_1610_GPTIMER3; break; case 4: base = OMAP1610_GPTIMER4_BASE; irq = INT_1610_GPTIMER4; break; case 5: base = OMAP1610_GPTIMER5_BASE; irq = INT_1610_GPTIMER5; break; case 6: base = OMAP1610_GPTIMER6_BASE; irq = INT_1610_GPTIMER6; break; case 7: base = OMAP1610_GPTIMER7_BASE; irq = INT_1610_GPTIMER7; break; case 8: base = OMAP1610_GPTIMER8_BASE; irq = INT_1610_GPTIMER8; break; default: /* * not supposed to reach here. * this is to remove warning. */ return -EINVAL; } pdev = platform_device_alloc("omap_timer", i); if (!pdev) { pr_err("%s: Failed to device alloc for dmtimer%d\n", __func__, i); return -ENOMEM; } memset(res, 0, 2 * sizeof(struct resource)); res[0].start = base; res[0].end = base + 0x46; res[0].flags = IORESOURCE_MEM; res[1].start = irq; res[1].end = irq; res[1].flags = IORESOURCE_IRQ; ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res)); if (ret) { dev_err(&pdev->dev, "%s: Failed to add resources.\n", __func__); goto err_free_pdev; } pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); if (!pdata) { dev_err(&pdev->dev, "%s: Failed to allocate pdata.\n", __func__); ret = -ENOMEM; goto err_free_pdata; } pdata->set_timer_src = omap1_dm_timer_set_src; pdata->is_early_init = 0; pdata->timer_ip_type = OMAP_TIMER_IP_VERSION_1; pdata->needs_manual_reset = 1; ret = platform_device_add_data(pdev, pdata, sizeof(*pdata)); if (ret) { dev_err(&pdev->dev, "%s: Failed to add platform data.\n", __func__); goto err_free_pdata; } ret = platform_device_add(pdev); if (ret) { dev_err(&pdev->dev, "%s: Failed to add platform device.\n", __func__); goto err_free_pdata; } dev_dbg(&pdev->dev, " Registered.\n"); } return 0; err_free_pdata: kfree(pdata); err_free_pdev: platform_device_unregister(pdev); return ret; } arch_initcall(omap1_dm_timer_init);
/* * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology * Author: Fuxin Zhang, zhangfx@lemote.com * * Copyright (C) 2009 Lemote Inc. * Author: Wu Zhangjin, wuzhangjin@gmail.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <asm/mc146818-time.h> #include <asm/time.h> #include <loongson.h> #include <cs5536/cs5536_mfgpt.h> void __init plat_time_init(void) { /* setup mips r4k timer */ mips_hpt_frequency = cpu_clock_freq / 2; setup_mfgpt0_timer(); } void read_persistent_clock(struct timespec *ts) { ts->tv_sec = mc146818_get_cmos_time(); ts->tv_nsec = 0; }
/* Copyright 2019 Evy Dekkers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "quantum.h" #define XXX KC_NO /* This a shortcut to help you visually see your layout. * * The first section contains all of the arguments representing the physical * layout of the board and position of the keys. * * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ #define LAYOUT_all( \ k00, k10, k01, k11, k02, k12, k03, k13, k04, k14, k05, k15, k06, k16, k07, k87, k17, k08, k18, k09, k19, \ k20, k30, k21, k31, k22, k32, k23, k33, k24, k34, k25, k35, k26, k36, k27, k37, k28, k38, k29, k39, \ k40, k50, k41, k51, k42, k52, k43, k53, k44, k54, k45, k55, k46, k56, k47, k57, k48, k58, k49, k59, \ k60, k70, k61, k71, k62, k72, k63, k73, k64, k74, k65, k75, k66, k76, k67, k77, k68, k78, k69, \ k80, k90, k81, k82, k94, k96, k97, k88, k98, k89, k99 \ ) \ { \ { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09 }, \ { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19 }, \ { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29 }, \ { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39 }, \ { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49 }, \ { k50, k51, k52, k53, k54, k55, k56, k57, k58, k59 }, \ { k60, k61, k62, k63, k64, k65, k66, k67, k68, k69 }, \ { k70, k71, k72, k73, k74, k75, k76, k77, k78, XXX }, \ { k80, k81, k82, XXX, XXX, XXX, XXX, k87, k88, k89 }, \ { k90, XXX, XXX, XXX, k94, XXX, k96, k97, k98, k99 } \ }
/** * JSONSyntaxHighlight.h * JSONSyntaxHighlight * * Syntax highlight JSON * * Created by Dave Eddy on 8/3/13. * Copyright (c) 2013 Dave Eddy. All rights reserved. * * The MIT License (MIT) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #import <Foundation/Foundation.h> #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) #import <UIKit/UIKit.h> #else #import <AppKit/AppKit.h> #endif @interface JSONSyntaxHighlight : NSObject // Create the object by giving a JSON object, nil will be returned // if the object can't be serialized - (JSONSyntaxHighlight *)init; - (JSONSyntaxHighlight *)initWithJSON:(id)JSON; // Return an NSAttributedString with the highlighted JSON in a pretty format - (NSAttributedString *)highlightJSON; // Return an NSAttributedString with the highlighted JSON optionally pretty formatted - (NSAttributedString *)highlightJSONWithPrettyPrint:(BOOL)prettyPrint; // Fire a callback for every key item found in the parsed JSON, each callback // is fired with the NSRange the substring appears in `self.parsedJSON`, as well // as the NSString at that location. - (void)enumerateMatchesWithIndentBlock:(void(^)(NSRange, NSString*))indentBlock keyBlock:(void(^)(NSRange, NSString*))keyBlock valueBlock:(void(^)(NSRange, NSString*))valueBlock endBlock:(void(^)(NSRange, NSString*))endBlock; // The JSON object, unmodified @property (readonly, nonatomic, strong) id JSON; // The serialized JSON string @property (readonly, nonatomic, strong) NSString *parsedJSON; // The attributes for Attributed Text @property (nonatomic, strong) NSDictionary *keyAttributes; @property (nonatomic, strong) NSDictionary *stringAttributes; @property (nonatomic, strong) NSDictionary *nonStringAttributes; // Platform dependent helper functions #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) + (UIColor *)colorWithRGB:(NSInteger)rgbValue; + (UIColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha; #else + (NSColor *)colorWithRGB:(NSInteger)rgbValue; + (NSColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha; #endif @end
/* Python interface to inferior exit events. Copyright (C) 2009-2014 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "defs.h" #include "py-event.h" static PyTypeObject exited_event_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object"); static PyObject * create_exited_event_object (const LONGEST *exit_code, struct inferior *inf) { PyObject *exited_event; PyObject *inf_obj = NULL; exited_event = create_event_object (&exited_event_object_type); if (!exited_event) goto fail; if (exit_code) { PyObject *exit_code_obj = PyLong_FromLongLong (*exit_code); int failed; if (exit_code_obj == NULL) goto fail; failed = evpy_add_attribute (exited_event, "exit_code", exit_code_obj) < 0; Py_DECREF (exit_code_obj); if (failed) goto fail; } inf_obj = inferior_to_inferior_object (inf); if (!inf_obj || evpy_add_attribute (exited_event, "inferior", inf_obj) < 0) goto fail; Py_DECREF (inf_obj); return exited_event; fail: Py_XDECREF (inf_obj); Py_XDECREF (exited_event); return NULL; } /* Callback that is used when an exit event occurs. This function will create a new Python exited event object. */ int emit_exited_event (const LONGEST *exit_code, struct inferior *inf) { PyObject *event; if (evregpy_no_listeners_p (gdb_py_events.exited)) return 0; event = create_exited_event_object (exit_code, inf); if (event) return evpy_emit_event (event, gdb_py_events.exited); return -1; } GDBPY_NEW_EVENT_TYPE (exited, "gdb.ExitedEvent", "ExitedEvent", "GDB exited event object", event_object_type, static);
/* * Copyright (C) 2010-2011 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** * @file mali_osk_time.c * Implementation of the OS abstraction layer for the kernel device driver */ #include "mali_osk.h" #include <linux/jiffies.h> #include <linux/time.h> #include <asm/delay.h> int _mali_osk_time_after( u32 ticka, u32 tickb ) { return time_after((unsigned long)ticka, (unsigned long)tickb); } u32 _mali_osk_time_mstoticks( u32 ms ) { return msecs_to_jiffies(ms); } u32 _mali_osk_time_tickstoms( u32 ticks ) { return jiffies_to_msecs(ticks); } u32 _mali_osk_time_tickcount( void ) { return jiffies; } void _mali_osk_time_ubusydelay( u32 usecs ) { udelay(usecs); } u64 _mali_osk_time_get_ns( void ) { struct timespec tsval; getnstimeofday(&tsval); return (u64)timespec_to_ns(&tsval); }
#ifndef _ASM_POWERPC_CODE_PATCHING_H #define _ASM_POWERPC_CODE_PATCHING_H /* * Copyright 2008, Michael Ellerman, 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. */ #include <asm/types.h> #include <asm/ppc-opcode.h> #include <linux/string.h> #include <linux/kallsyms.h> #include <asm/asm-compat.h> /* Flags for create_branch: * "b" == create_branch(addr, target, 0); * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE); * "bl" == create_branch(addr, target, BRANCH_SET_LINK); * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK); */ #define BRANCH_SET_LINK 0x1 #define BRANCH_ABSOLUTE 0x2 bool is_offset_in_branch_range(long offset); unsigned int create_branch(const unsigned int *addr, unsigned long target, int flags); unsigned int create_cond_branch(const unsigned int *addr, unsigned long target, int flags); int patch_branch(unsigned int *addr, unsigned long target, int flags); int patch_instruction(unsigned int *addr, unsigned int instr); int raw_patch_instruction(unsigned int *addr, unsigned int instr); static inline unsigned long patch_site_addr(s32 *site) { return (unsigned long)site + *site; } static inline int patch_instruction_site(s32 *site, unsigned int instr) { return patch_instruction((unsigned int *)patch_site_addr(site), instr); } static inline int patch_branch_site(s32 *site, unsigned long target, int flags) { return patch_branch((unsigned int *)patch_site_addr(site), target, flags); } static inline int modify_instruction(unsigned int *addr, unsigned int clr, unsigned int set) { return patch_instruction(addr, (*addr & ~clr) | set); } static inline int modify_instruction_site(s32 *site, unsigned int clr, unsigned int set) { return modify_instruction((unsigned int *)patch_site_addr(site), clr, set); } int instr_is_relative_branch(unsigned int instr); int instr_is_relative_link_branch(unsigned int instr); int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr); unsigned long branch_target(const unsigned int *instr); unsigned int translate_branch(const unsigned int *dest, const unsigned int *src); extern bool is_conditional_branch(unsigned int instr); #ifdef CONFIG_PPC_BOOK3E_64 void __patch_exception(int exc, unsigned long addr); #define patch_exception(exc, name) do { \ extern unsigned int name; \ __patch_exception((exc), (unsigned long)&name); \ } while (0) #endif #define OP_RT_RA_MASK 0xffff0000UL #define LIS_R2 0x3c020000UL #define ADDIS_R2_R12 0x3c4c0000UL #define ADDI_R2_R2 0x38420000UL static inline unsigned long ppc_function_entry(void *func) { #ifdef PPC64_ELF_ABI_v2 u32 *insn = func; /* * A PPC64 ABIv2 function may have a local and a global entry * point. We need to use the local entry point when patching * functions, so identify and step over the global entry point * sequence. * * The global entry point sequence is always of the form: * * addis r2,r12,XXXX * addi r2,r2,XXXX * * A linker optimisation may convert the addis to lis: * * lis r2,XXXX * addi r2,r2,XXXX */ if ((((*insn & OP_RT_RA_MASK) == ADDIS_R2_R12) || ((*insn & OP_RT_RA_MASK) == LIS_R2)) && ((*(insn+1) & OP_RT_RA_MASK) == ADDI_R2_R2)) return (unsigned long)(insn + 2); else return (unsigned long)func; #elif defined(PPC64_ELF_ABI_v1) /* * On PPC64 ABIv1 the function pointer actually points to the * function's descriptor. The first entry in the descriptor is the * address of the function text. */ return ((func_descr_t *)func)->entry; #else return (unsigned long)func; #endif } static inline unsigned long ppc_global_function_entry(void *func) { #ifdef PPC64_ELF_ABI_v2 /* PPC64 ABIv2 the global entry point is at the address */ return (unsigned long)func; #else /* All other cases there is no change vs ppc_function_entry() */ return ppc_function_entry(func); #endif } /* * Wrapper around kallsyms_lookup() to return function entry address: * - For ABIv1, we lookup the dot variant. * - For ABIv2, we return the local entry point. */ static inline unsigned long ppc_kallsyms_lookup_name(const char *name) { unsigned long addr; #ifdef PPC64_ELF_ABI_v1 /* check for dot variant */ char dot_name[1 + KSYM_NAME_LEN]; bool dot_appended = false; if (strnlen(name, KSYM_NAME_LEN) >= KSYM_NAME_LEN) return 0; if (name[0] != '.') { dot_name[0] = '.'; dot_name[1] = '\0'; strlcat(dot_name, name, sizeof(dot_name)); dot_appended = true; } else { dot_name[0] = '\0'; strlcat(dot_name, name, sizeof(dot_name)); } addr = kallsyms_lookup_name(dot_name); if (!addr && dot_appended) /* Let's try the original non-dot symbol lookup */ addr = kallsyms_lookup_name(name); #elif defined(PPC64_ELF_ABI_v2) addr = kallsyms_lookup_name(name); if (addr) addr = ppc_function_entry((void *)addr); #else addr = kallsyms_lookup_name(name); #endif return addr; } #ifdef CONFIG_PPC64 /* * Some instruction encodings commonly used in dynamic ftracing * and function live patching. */ /* This must match the definition of STK_GOT in <asm/ppc_asm.h> */ #ifdef PPC64_ELF_ABI_v2 #define R2_STACK_OFFSET 24 #else #define R2_STACK_OFFSET 40 #endif #define PPC_INST_LD_TOC (PPC_INST_LD | ___PPC_RT(__REG_R2) | \ ___PPC_RA(__REG_R1) | R2_STACK_OFFSET) /* usually preceded by a mflr r0 */ #define PPC_INST_STD_LR (PPC_INST_STD | ___PPC_RS(__REG_R0) | \ ___PPC_RA(__REG_R1) | PPC_LR_STKOFF) #endif /* CONFIG_PPC64 */ #endif /* _ASM_POWERPC_CODE_PATCHING_H */
/* Software floating-point emulation. Return 0 iff a == b, 1 iff a > b, 2 iff a ? b, -1 iff a < b Copyright (C) 1997,1999,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson (rth@cygnus.com) and Jakub Jelinek (jj@ultra.linux.cz). 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. In addition to the permissions in the GNU Lesser General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The Lesser General Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into a combine executable.) 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 "soft-fp.h" #include "double.h" CMPtype __ledf2(DFtype a, DFtype b) { FP_DECL_EX; FP_DECL_D(A); FP_DECL_D(B); CMPtype r; FP_UNPACK_RAW_D(A, a); FP_UNPACK_RAW_D(B, b); FP_CMP_D(r, A, B, 2); if (r == 2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B))) FP_SET_EXCEPTION(FP_EX_INVALID); FP_HANDLE_EXCEPTIONS; return r; } strong_alias(__ledf2, __ltdf2);
// SPDX-License-Identifier: GPL-2.0-only #include <linux/kernel.h> #include <linux/mm.h> #include <linux/smp.h> #include <linux/spinlock.h> #include <linux/stop_machine.h> #include <linux/uaccess.h> #include <asm/cacheflush.h> #include <asm/fixmap.h> #include <asm/insn.h> #include <asm/kprobes.h> #include <asm/patching.h> #include <asm/sections.h> static DEFINE_RAW_SPINLOCK(patch_lock); static bool is_exit_text(unsigned long addr) { /* discarded with init text/data */ return system_state < SYSTEM_RUNNING && addr >= (unsigned long)__exittext_begin && addr < (unsigned long)__exittext_end; } static bool is_image_text(unsigned long addr) { return core_kernel_text(addr) || is_exit_text(addr); } static void __kprobes *patch_map(void *addr, int fixmap) { unsigned long uintaddr = (uintptr_t) addr; bool image = is_image_text(uintaddr); struct page *page; if (image) page = phys_to_page(__pa_symbol(addr)); else if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) page = vmalloc_to_page(addr); else return addr; BUG_ON(!page); return (void *)set_fixmap_offset(fixmap, page_to_phys(page) + (uintaddr & ~PAGE_MASK)); } static void __kprobes patch_unmap(int fixmap) { clear_fixmap(fixmap); } /* * In ARMv8-A, A64 instructions have a fixed length of 32 bits and are always * little-endian. */ int __kprobes aarch64_insn_read(void *addr, u32 *insnp) { int ret; __le32 val; ret = copy_from_kernel_nofault(&val, addr, AARCH64_INSN_SIZE); if (!ret) *insnp = le32_to_cpu(val); return ret; } static int __kprobes __aarch64_insn_write(void *addr, __le32 insn) { void *waddr = addr; unsigned long flags = 0; int ret; raw_spin_lock_irqsave(&patch_lock, flags); waddr = patch_map(addr, FIX_TEXT_POKE0); ret = copy_to_kernel_nofault(waddr, &insn, AARCH64_INSN_SIZE); patch_unmap(FIX_TEXT_POKE0); raw_spin_unlock_irqrestore(&patch_lock, flags); return ret; } int __kprobes aarch64_insn_write(void *addr, u32 insn) { return __aarch64_insn_write(addr, cpu_to_le32(insn)); } int __kprobes aarch64_insn_patch_text_nosync(void *addr, u32 insn) { u32 *tp = addr; int ret; /* A64 instructions must be word aligned */ if ((uintptr_t)tp & 0x3) return -EINVAL; ret = aarch64_insn_write(tp, insn); if (ret == 0) caches_clean_inval_pou((uintptr_t)tp, (uintptr_t)tp + AARCH64_INSN_SIZE); return ret; } struct aarch64_insn_patch { void **text_addrs; u32 *new_insns; int insn_cnt; atomic_t cpu_count; }; static int __kprobes aarch64_insn_patch_text_cb(void *arg) { int i, ret = 0; struct aarch64_insn_patch *pp = arg; /* The first CPU becomes master */ if (atomic_inc_return(&pp->cpu_count) == 1) { for (i = 0; ret == 0 && i < pp->insn_cnt; i++) ret = aarch64_insn_patch_text_nosync(pp->text_addrs[i], pp->new_insns[i]); /* Notify other processors with an additional increment. */ atomic_inc(&pp->cpu_count); } else { while (atomic_read(&pp->cpu_count) <= num_online_cpus()) cpu_relax(); isb(); } return ret; } int __kprobes aarch64_insn_patch_text(void *addrs[], u32 insns[], int cnt) { struct aarch64_insn_patch patch = { .text_addrs = addrs, .new_insns = insns, .insn_cnt = cnt, .cpu_count = ATOMIC_INIT(0), }; if (cnt <= 0) return -EINVAL; return stop_machine_cpuslocked(aarch64_insn_patch_text_cb, &patch, cpu_online_mask); }
#include <arm_neon.h> /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ int16x8x4_t f_vld4q_lane_s16 (int16_t * p, int16x8x4_t v) { int16x8x4_t res; /* { dg-error "lane 8 out of range 0 - 7" "" { target *-*-* } 0 } */ res = vld4q_lane_s16 (p, v, 8); /* { dg-error "lane -1 out of range 0 - 7" "" { target *-*-* } 0 } */ res = vld4q_lane_s16 (p, v, -1); return res; }
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2010,2015 Broadcom * Copyright (C) 2013-2014 Lubomir Rintel * Copyright (C) 2013 Craig McGeachie * * Parts of the driver are based on: * - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was * obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/ * linux.git * - drivers/mailbox/bcm2835-ipc.c by Lubomir Rintel at * https://github.com/hackerspace/rpi-linux/blob/lr-raspberry-pi/drivers/ * mailbox/bcm2835-ipc.c * - documentation available on the following web site: * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */ #include <linux/device.h> #include <linux/dma-mapping.h> #include <linux/err.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/kernel.h> #include <linux/mailbox_controller.h> #include <linux/module.h> #include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/platform_device.h> #include <linux/spinlock.h> /* Mailboxes */ #define ARM_0_MAIL0 0x00 #define ARM_0_MAIL1 0x20 /* * Mailbox registers. We basically only support mailbox 0 & 1. We * deliver to the VC in mailbox 1, it delivers to us in mailbox 0. See * BCM2835-ARM-Peripherals.pdf section 1.3 for an explanation about * the placement of memory barriers. */ #define MAIL0_RD (ARM_0_MAIL0 + 0x00) #define MAIL0_POL (ARM_0_MAIL0 + 0x10) #define MAIL0_STA (ARM_0_MAIL0 + 0x18) #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) #define MAIL1_STA (ARM_0_MAIL1 + 0x18) /* Status register: FIFO state. */ #define ARM_MS_FULL BIT(31) #define ARM_MS_EMPTY BIT(30) /* Configuration register: Enable interrupts. */ #define ARM_MC_IHAVEDATAIRQEN BIT(0) struct bcm2835_mbox { void __iomem *regs; spinlock_t lock; struct mbox_controller controller; }; static struct bcm2835_mbox *bcm2835_link_mbox(struct mbox_chan *link) { return container_of(link->mbox, struct bcm2835_mbox, controller); } static irqreturn_t bcm2835_mbox_irq(int irq, void *dev_id) { struct bcm2835_mbox *mbox = dev_id; struct device *dev = mbox->controller.dev; struct mbox_chan *link = &mbox->controller.chans[0]; while (!(readl(mbox->regs + MAIL0_STA) & ARM_MS_EMPTY)) { u32 msg = readl(mbox->regs + MAIL0_RD); dev_dbg(dev, "Reply 0x%08X\n", msg); mbox_chan_received_data(link, &msg); } return IRQ_HANDLED; } static int bcm2835_send_data(struct mbox_chan *link, void *data) { struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); u32 msg = *(u32 *)data; spin_lock(&mbox->lock); writel(msg, mbox->regs + MAIL1_WRT); dev_dbg(mbox->controller.dev, "Request 0x%08X\n", msg); spin_unlock(&mbox->lock); return 0; } static int bcm2835_startup(struct mbox_chan *link) { struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); /* Enable the interrupt on data reception */ writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); return 0; } static void bcm2835_shutdown(struct mbox_chan *link) { struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); writel(0, mbox->regs + MAIL0_CNF); } static bool bcm2835_last_tx_done(struct mbox_chan *link) { struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); bool ret; spin_lock(&mbox->lock); ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); spin_unlock(&mbox->lock); return ret; } static const struct mbox_chan_ops bcm2835_mbox_chan_ops = { .send_data = bcm2835_send_data, .startup = bcm2835_startup, .shutdown = bcm2835_shutdown, .last_tx_done = bcm2835_last_tx_done }; static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox, const struct of_phandle_args *sp) { if (sp->args_count != 0) return ERR_PTR(-EINVAL); return &mbox->chans[0]; } static int bcm2835_mbox_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; int ret = 0; struct resource *iomem; struct bcm2835_mbox *mbox; mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); if (mbox == NULL) return -ENOMEM; spin_lock_init(&mbox->lock); ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), bcm2835_mbox_irq, 0, dev_name(dev), mbox); if (ret) { dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ret); return -ENODEV; } iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); if (IS_ERR(mbox->regs)) { ret = PTR_ERR(mbox->regs); return ret; } mbox->controller.txdone_poll = true; mbox->controller.txpoll_period = 5; mbox->controller.ops = &bcm2835_mbox_chan_ops; mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; mbox->controller.dev = dev; mbox->controller.num_chans = 1; mbox->controller.chans = devm_kzalloc(dev, sizeof(*mbox->controller.chans), GFP_KERNEL); if (!mbox->controller.chans) return -ENOMEM; ret = devm_mbox_controller_register(dev, &mbox->controller); if (ret) return ret; platform_set_drvdata(pdev, mbox); dev_info(dev, "mailbox enabled\n"); return ret; } static const struct of_device_id bcm2835_mbox_of_match[] = { { .compatible = "brcm,bcm2835-mbox", }, {}, }; MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); static struct platform_driver bcm2835_mbox_driver = { .driver = { .name = "bcm2835-mbox", .of_match_table = bcm2835_mbox_of_match, }, .probe = bcm2835_mbox_probe, }; module_platform_driver(bcm2835_mbox_driver); MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>"); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); MODULE_LICENSE("GPL v2");
/* This testcase is part of GDB, the GNU debugger. Copyright 2014-2015 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <pthread.h> #include <signal.h> pthread_barrier_t barrier; sig_atomic_t got_sigusr1; sig_atomic_t got_sigusr2; void handler_sigusr1 (int sig) { got_sigusr1 = 1; } void handler_sigusr2 (int sig) { got_sigusr2 = 1; } void * thread_function (void *arg) { volatile unsigned int count = 1; pthread_barrier_wait (&barrier); while (count++ != 0) { if (got_sigusr1 && got_sigusr2) break; usleep (1); } } void all_threads_started (void) { } void all_threads_signalled (void) { } void end (void) { } int main (void) { pthread_t child_thread[2]; int i; signal (SIGUSR1, handler_sigusr1); signal (SIGUSR2, handler_sigusr2); for (i = 0; i < 2; i++) { pthread_barrier_init (&barrier, NULL, 2); pthread_create (&child_thread[i], NULL, thread_function, NULL); pthread_barrier_wait (&barrier); pthread_barrier_destroy (&barrier); } all_threads_started (); pthread_kill (child_thread[0], SIGUSR1); pthread_kill (child_thread[1], SIGUSR2); all_threads_signalled (); for (i = 0; i < 2; i++) pthread_join (child_thread[i], NULL); end (); return 0; }
/* Declarations for host.c Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GNU Wget. GNU Wget 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. GNU Wget 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 Wget. If not, see <http://www.gnu.org/licenses/>. Additional permission under GNU GPL version 3 section 7 If you modify this program, or any covered work, by linking or combining it with the OpenSSL project's OpenSSL library (or a modified version of that library), containing parts covered by the terms of the OpenSSL or SSLeay licenses, the Free Software Foundation grants you additional permission to convey the resulting work. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of OpenSSL used as well as that of the covered work. */ #ifndef HOST_H #define HOST_H #ifdef WINDOWS # include <winsock2.h> #else # ifdef __VMS # include "vms_ip.h" # else /* def __VMS */ # include <netdb.h> # endif /* def __VMS [else] */ # include <sys/socket.h> # include <netinet/in.h> #ifndef __BEOS__ # include <arpa/inet.h> #endif #endif struct url; struct address_list; /* This struct defines an IP address, tagged with family type. */ typedef struct { /* Address family, one of AF_INET or AF_INET6. */ int family; /* The actual data, in the form of struct in_addr or in6_addr: */ union { struct in_addr d4; /* IPv4 address */ #ifdef ENABLE_IPV6 struct in6_addr d6; /* IPv6 address */ #endif } data; /* Under IPv6 getaddrinfo also returns scope_id. Since it's IPv6-specific it strictly belongs in the above union, but we put it here for simplicity. */ #if defined ENABLE_IPV6 && defined HAVE_SOCKADDR_IN6_SCOPE_ID int ipv6_scope; #endif } ip_address; /* IP_INADDR_DATA macro returns a void pointer that can be interpreted as a pointer to struct in_addr in IPv4 context or a pointer to struct in6_addr in IPv4 context. This pointer can be passed to functions that work on either, such as inet_ntop. */ #define IP_INADDR_DATA(x) ((void *) &(x)->data) enum { LH_SILENT = 1, LH_BIND = 2, LH_REFRESH = 4 }; struct address_list *lookup_host (const char *, int); void address_list_get_bounds (const struct address_list *, int *, int *); const ip_address *address_list_address_at (const struct address_list *, int); bool address_list_contains (const struct address_list *, const ip_address *); void address_list_set_faulty (struct address_list *, int); void address_list_set_connected (struct address_list *); bool address_list_connected_p (const struct address_list *); void address_list_release (struct address_list *); const char *print_address (const ip_address *); #ifdef ENABLE_IPV6 bool is_valid_ipv6_address (const char *, const char *); #endif bool is_valid_ip_address (const char *name); bool accept_domain (struct url *); bool sufmatch (const char **, const char *); void host_cleanup (void); #endif /* HOST_H */
/* * Mesa 3-D graphics library * Version: 7.3 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice 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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _M_XFORM_H #define _M_XFORM_H #include "main/compiler.h" #include "main/glheader.h" #include "math/m_matrix.h" #include "math/m_vector.h" #ifdef USE_X86_ASM #define _XFORMAPI _ASMAPI #define _XFORMAPIP _ASMAPIP #else #define _XFORMAPI #define _XFORMAPIP * #endif extern void _math_init_transformation(void); extern void init_c_cliptest(void); /* KW: Clip functions now do projective divide as well. The projected * coordinates are very useful to us because they let us cull * backfaces and eliminate vertices from lighting, fogging, etc * calculations. Despite the fact that this divide could be done one * day in hardware, we would still have a reason to want to do it here * as long as those other calculations remain in software. * * Clipping is a convenient place to do the divide on x86 as it should be * possible to overlap with integer outcode calculations. * * There are two cases where we wouldn't want to do the divide in cliptest: * - When we aren't clipping. We still might want to cull backfaces * so the divide should be done elsewhere. This currently never * happens. * * - When culling isn't likely to help us, such as when the GL culling * is disabled and we not lighting or are only lighting * one-sided. In this situation, backface determination provides * us with no useful information. A tricky case to detect is when * all input data is already culled, although hopefully the * application wouldn't turn on culling in such cases. * * We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which * are the result of the projection. This is only used in the * 4-vector case - in other cases, we just use the clip coordinates * as the projected coordinates - they are identical. * * This is doubly convenient because it means the Win[] array is now * of the same stride as all the others, so I can now turn map_vertices * into a straight-forward matrix transformation, with asm acceleration * automatically available. */ /* Vertex buffer clipping flags */ #define CLIP_RIGHT_SHIFT 0 #define CLIP_LEFT_SHIFT 1 #define CLIP_TOP_SHIFT 2 #define CLIP_BOTTOM_SHIFT 3 #define CLIP_NEAR_SHIFT 4 #define CLIP_FAR_SHIFT 5 #define CLIP_RIGHT_BIT 0x01 #define CLIP_LEFT_BIT 0x02 #define CLIP_TOP_BIT 0x04 #define CLIP_BOTTOM_BIT 0x08 #define CLIP_NEAR_BIT 0x10 #define CLIP_FAR_BIT 0x20 #define CLIP_USER_BIT 0x40 #define CLIP_CULL_BIT 0x80 #define CLIP_FRUSTUM_BITS 0x3f typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, GLvector4f *vProj, GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask, GLboolean viewport_z_clip ); typedef void (*dotprod_func)( GLfloat *out, GLuint out_stride, CONST GLvector4f *coord_vec, CONST GLfloat plane[4] ); typedef void (*vec_copy_func)( GLvector4f *to, CONST GLvector4f *from ); /* * Functions for transformation of normals in the VB. */ typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, GLfloat scale, CONST GLvector4f *in, CONST GLfloat lengths[], GLvector4f *dest ); /* Flags for selecting a normal transformation function. */ #define NORM_RESCALE 0x1 /* apply the scale factor */ #define NORM_NORMALIZE 0x2 /* normalize */ #define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ #define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ /* KW: New versions of the transform function allow a mask array * specifying that individual vector transform should be skipped * when the mask byte is zero. This is always present as a * parameter, to allow a unified interface. */ typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, CONST GLfloat m[16], CONST GLvector4f *from_vec ); extern dotprod_func _mesa_dotprod_tab[5]; extern vec_copy_func _mesa_copy_tab[0x10]; extern vec_copy_func _mesa_copy_clean_tab[5]; extern clip_func _mesa_clip_tab[5]; extern clip_func _mesa_clip_np_tab[5]; extern normal_func _mesa_normal_tab[0xf]; /* Use of 2 layers of linked 1-dimensional arrays to reduce * cost of lookup. */ extern transform_func *_mesa_transform_tab[5]; #define TransformRaw( to, mat, from ) \ ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ (to) ) #endif
/* e_hypotf.c -- float version of e_hypot.c. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #include <math.h> #include <math_private.h> float __ieee754_hypotf(float x, float y) { double d_x, d_y; int32_t ha, hb; GET_FLOAT_WORD(ha,x); ha &= 0x7fffffff; GET_FLOAT_WORD(hb,y); hb &= 0x7fffffff; if (ha == 0x7f800000) { if (x == y) return fabsf(y); return fabsf(x); } else if (hb == 0x7f800000) { if (x == y) return fabsf(x); return fabsf(y); } else if (ha > 0x7f800000 || hb > 0x7f800000) return fabsf(x) * fabsf(y); else if (ha == 0) return fabsf(y); else if (hb == 0) return fabsf(x); d_x = (double) x; d_y = (double) y; return (float) __ieee754_sqrt(d_x * d_x + d_y * d_y); } strong_alias (__ieee754_hypotf, __hypotf_finite)
/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c * * Copyright (c) 2004-2008 Simtec Electronics * http://armlinux.simtec.co.uk/ * Ben Dooks <ben@simtec.co.uk> * * S3C2440/S3C2442 Common clock support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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/module.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/errno.h> #include <linux/err.h> #include <linux/device.h> #include <linux/sysdev.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/clk.h> #include <linux/io.h> #include <mach/hardware.h> #include <asm/atomic.h> #include <asm/irq.h> #include <mach/regs-clock.h> #include <plat/clock.h> #include <plat/cpu.h> static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent) { unsigned long camdivn; unsigned long dvs; if (parent == &clk_f) dvs = 0; else if (parent == &clk_h) dvs = S3C2440_CAMDIVN_DVSEN; else return -EINVAL; clk->parent = parent; camdivn = __raw_readl(S3C2440_CAMDIVN); camdivn &= ~S3C2440_CAMDIVN_DVSEN; camdivn |= dvs; __raw_writel(camdivn, S3C2440_CAMDIVN); return 0; } static struct clk clk_arm = { .name = "armclk", .id = -1, .set_parent = s3c2440_setparent_armclk, }; static int s3c244x_clk_add(struct sys_device *sysdev) { unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); unsigned long clkdivn; struct clk *clock_upll; int ret; printk("S3C244X: Clock Support, DVS %s\n", (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off"); clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f; ret = s3c24xx_register_clock(&clk_arm); if (ret < 0) { printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret); return ret; } clock_upll = clk_get(NULL, "upll"); if (IS_ERR(clock_upll)) { printk(KERN_ERR "S3C244X: Failed to get upll clock\n"); return -ENOENT; } /* check rate of UPLL, and if it is near 96MHz, then change * to using half the UPLL rate for the system */ if (clk_get_rate(clock_upll) > (94 * MHZ)) { clk_usb_bus.rate = clk_get_rate(clock_upll) / 2; spin_lock(&clocks_lock); clkdivn = __raw_readl(S3C2410_CLKDIVN); clkdivn |= S3C2440_CLKDIVN_UCLK; __raw_writel(clkdivn, S3C2410_CLKDIVN); spin_unlock(&clocks_lock); } return 0; } static struct sysdev_driver s3c2440_clk_driver = { .add = s3c244x_clk_add, }; static int s3c2440_clk_init(void) { return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver); } arch_initcall(s3c2440_clk_init); static struct sysdev_driver s3c2442_clk_driver = { .add = s3c244x_clk_add, }; static int s3c2442_clk_init(void) { return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver); } arch_initcall(s3c2442_clk_init);
#include "locking-selftest-spin.h" #include "locking-selftest-hardirq.h"
/**************************************************************************** Copyright (c) 2015 Chukong Technologies Inc. http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #ifndef __CCNAV_MESH_TOOL_H__ #define __CCNAV_MESH_TOOL_H__ #include "base/ccConfig.h" #if CC_USE_NAVMESH #include "platform/CCPlatformMacros.h" #include "math/CCMath.h" #include "recast/Detour/DetourCommon.h" #include "recast/Detour/DetourNavMesh.h" #include "recast/Detour/DetourNavMeshQuery.h" #include "recast/DetourTileCache/DetourTileCache.h" #include "recast/DetourTileCache/DetourTileCacheBuilder.h" NS_CC_BEGIN /** * @addtogroup 3d * @{ */ struct LinearAllocator : public dtTileCacheAlloc { unsigned char* buffer; int capacity; int top; int high; LinearAllocator(const int cap); ~LinearAllocator(); void resize(const int cap); virtual void reset(); virtual void* alloc(const int size); virtual void free(void* /*ptr*/); }; struct FastLZCompressor : public dtTileCacheCompressor { virtual int maxCompressedSize(const int bufferSize); virtual dtStatus compress(const unsigned char* buffer, const int bufferSize, unsigned char* compressed, const int /*maxCompressedSize*/, int* compressedSize); virtual dtStatus decompress(const unsigned char* compressed, const int compressedSize, unsigned char* buffer, const int maxBufferSize, int* bufferSize); }; struct GeomData { static const int MAX_OFFMESH_CONNECTIONS = 256; float offMeshConVerts[MAX_OFFMESH_CONNECTIONS * 3 * 2]; float offMeshConRads[MAX_OFFMESH_CONNECTIONS]; unsigned char offMeshConDirs[MAX_OFFMESH_CONNECTIONS]; unsigned char offMeshConAreas[MAX_OFFMESH_CONNECTIONS]; unsigned short offMeshConFlags[MAX_OFFMESH_CONNECTIONS]; unsigned int offMeshConId[MAX_OFFMESH_CONNECTIONS]; int offMeshConCount; }; struct MeshProcess : public dtTileCacheMeshProcess { const GeomData *data; MeshProcess(const GeomData *geom); virtual ~MeshProcess(); //void init(InputGeom* geom) //{ // m_geom = geom; //} virtual void process(struct dtNavMeshCreateParams* params, unsigned char* polyAreas, unsigned short* polyFlags) override; }; bool inRange(const float* v1, const float* v2, const float r, const float h); int fixupCorridor(dtPolyRef* path, const int npath, const int maxPath, const dtPolyRef* visited, const int nvisited); // This function checks if the path has a small U-turn, that is, // a polygon further in the path is adjacent to the first polygon // in the path. If that happens, a shortcut is taken. // This can happen if the target (T) location is at tile boundary, // and we're (S) approaching it parallel to the tile edge. // The choice at the vertex can be arbitrary, // +---+---+ // |:::|:::| // +-S-+-T-+ // |:::| | <-- the step can end up in here, resulting U-turn path. // +---+---+ int fixupShortcuts(dtPolyRef* path, int npath, dtNavMeshQuery* navQuery); bool getSteerTarget(dtNavMeshQuery* navQuery, const float* startPos, const float* endPos, const float minTargetDist, const dtPolyRef* path, const int pathSize, float* steerPos, unsigned char& steerPosFlag, dtPolyRef& steerPosRef, float* outPoints = 0, int* outPointCount = 0); /** @} */ NS_CC_END #endif //CC_USE_NAVMESH #endif // __CCNAV_MESH_H__
/* * Copyright (c) 2000-2006 Silicon Graphics, Inc. * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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 the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef __XFS_VFS_H__ #define __XFS_VFS_H__ #include <linux/vfs.h> #include "xfs_fs.h" struct inode; struct fid; struct cred; struct seq_file; struct super_block; struct xfs_inode; struct xfs_mount; struct xfs_mount_args; typedef struct kstatfs bhv_statvfs_t; typedef struct bhv_vfs_sync_work { struct list_head w_list; struct xfs_mount *w_mount; void *w_data; /* syncer routine argument */ void (*w_syncer)(struct xfs_mount *, void *); } bhv_vfs_sync_work_t; #define SYNC_ATTR 0x0001 /* sync attributes */ #define SYNC_CLOSE 0x0002 /* close file system down */ #define SYNC_DELWRI 0x0004 /* look at delayed writes */ #define SYNC_WAIT 0x0008 /* wait for i/o to complete */ #define SYNC_BDFLUSH 0x0010 /* BDFLUSH is calling -- don't block */ #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ #define SYNC_IOWAIT 0x0100 /* wait for all I/O to complete */ /* * When remounting a filesystem read-only or freezing the filesystem, * we have two phases to execute. This first phase is syncing the data * before we quiesce the fielsystem, and the second is flushing all the * inodes out after we've waited for all the transactions created by * the first phase to complete. The second phase uses SYNC_INODE_QUIESCE * to ensure that the inodes are written to their location on disk * rather than just existing in transactions in the log. This means * after a quiesce there is no log replay required to write the inodes * to disk (this is the main difference between a sync and a quiesce). */ #define SYNC_DATA_QUIESCE (SYNC_DELWRI|SYNC_FSDATA|SYNC_WAIT|SYNC_IOWAIT) #define SYNC_INODE_QUIESCE (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT) #define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */ #define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */ #define SHUTDOWN_FORCE_UMOUNT 0x0004 /* shutdown from a forced unmount */ #define SHUTDOWN_CORRUPT_INCORE 0x0008 /* corrupt in-memory data structures */ #define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */ #define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */ #define xfs_test_for_freeze(mp) ((mp)->m_super->s_frozen) #define xfs_wait_for_freeze(mp,l) vfs_check_frozen((mp)->m_super, (l)) #endif /* __XFS_VFS_H__ */
/**************************************************************************** * Copyright (c) 1998-2006,2009 Free Software Foundation, 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, distribute with modifications, 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 ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /* * This is an example written by Alexander V. Lukyanov <lav@yars.free.net>, * to demonstrate an inconsistency between ncurses and SVr4 curses. * * $Id: testaddch.c,v 1.7 2009/08/29 19:02:25 tom Exp $ */ #include <test.priv.h> static void attr_addstr(const char *s, chtype a) { while (*s) addch(((unsigned char) (*s++)) | a); } int main( int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { unsigned i; chtype back, set, attr; setlocale(LC_ALL, ""); initscr(); start_color(); init_pair(1, COLOR_WHITE, COLOR_BLUE); init_pair(2, COLOR_WHITE, COLOR_RED); init_pair(3, COLOR_BLACK, COLOR_MAGENTA); init_pair(4, COLOR_BLACK, COLOR_GREEN); init_pair(5, COLOR_BLACK, COLOR_CYAN); init_pair(6, COLOR_BLACK, COLOR_YELLOW); init_pair(7, COLOR_BLACK, COLOR_WHITE); for (i = 0; i < 8; i++) { back = (i & 1) ? A_BOLD | 'B' : ' '; set = (i & 2) ? A_REVERSE : 0; attr = (i & 4) ? COLOR_PAIR(4) : 0; bkgdset(back); (void) attrset(set); attr_addstr("Test string with spaces -> <-\n", attr); } addch('\n'); for (i = 0; i < 8; i++) { back = (i & 1) ? A_BOLD | 'B' | COLOR_PAIR(1) : ' '; set = (i & 2) ? A_REVERSE | COLOR_PAIR(2) : 0; attr = (i & 4) ? COLOR_PAIR(4) : 0; bkgdset(back); (void) attrset(set); attr_addstr("Test string with spaces -> <-\n", attr); } getch(); endwin(); ExitProgram(EXIT_SUCCESS); }
/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __TDA8290_H__ #define __TDA8290_H__ #include <linux/i2c.h> #include "dvb_frontend.h" struct tda829x_config { unsigned int lna_cfg; unsigned int probe_tuner:1; #define TDA829X_PROBE_TUNER 0 #define TDA829X_DONT_PROBE 1 }; #if defined(CONFIG_MEDIA_TUNER_TDA8290) || (defined(CONFIG_MEDIA_TUNER_TDA8290_MODULE) && defined(MODULE)) extern int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr); extern struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap, u8 i2c_addr, struct tda829x_config *cfg); #else static inline int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); return -EINVAL; } static inline struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c_adap, u8 i2c_addr, struct tda829x_config *cfg) { printk(KERN_INFO "%s: not probed - driver disabled by Kconfig\n", __func__); return NULL; } #endif #endif /* __TDA8290_H__ */
#ifndef VENC_DRV_IF_DEP_H #define VENC_DRV_IF_DEP_H /*============================================================================= * Include Files *===========================================================================*/ #include "val_types_private.h" #include "vcodec_if_v2.h" #ifdef __cplusplus extern "C" { #endif /*============================================================================= * Type definition *===========================================================================*/ /** * @par Structure * mhalVdoDrv_t * @par Description * This is a structure which store common video enc driver information */ typedef struct mhalVdoDrv_s { VAL_VOID_T *prCodecHandle; VAL_UINT32_T u4EncodedFrameCount; VCODEC_ENC_CALLBACK_T rCodecCb; VIDEO_ENC_API_T *prCodecAPI; VENC_BS_T pBSBUF; VCODEC_ENC_BUFFER_INFO_T EncoderInputParamNC; VENC_DRV_PARAM_BS_BUF_T BSout; VENC_HYBRID_ENCSETTING rVencSetting; VAL_UINT8_T *ptr; } mhalVdoDrv_t; typedef struct __VENC_HANDLE_T { VAL_HANDLE_T hHalHandle; ///< HAL data. VAL_HANDLE_T vdriver_Handle; ///< for MMSYS power on/off VAL_MEMORY_T rHandleMem; ///< Save handle memory information to be used in release. VAL_BOOL_T bFirstDecoded; /// < already pass first video data to codec VAL_BOOL_T bHeaderPassed; /// < already pass video header to codec VAL_BOOL_T bFlushAll; VAL_MEMORY_T HeaderBuf; VAL_HANDLE_T hCodec; // DRIVER_HANDLER_T hDrv; VAL_UINT32_T CustomSetting; VCODEC_MEMORY_TYPE_T rVideoDecMemType; VAL_UINT32_T nYUVBufferIndex; VCODEC_OPEN_SETTING_T codecOpenSetting; mhalVdoDrv_t rMhalVdoDrv; VAL_MEMORY_T bs_driver_workingmem; // Morris Yang 20110411 [ VENC_DRV_VIDEO_FORMAT_T CodecFormat; VAL_VOID_T *prExtraData; ///< Driver private data pointer. VAL_MEMORY_T rExtraDataMem; ///< Save extra data memory information to be used in release. // ] VAL_UINT32_T nOmxTids; #if 1 //defined(MT6572) //VCODEC_MULTI_THREAD // Jackal Chen [ VAL_VOID_T *pDrvModule; ///< used for dlopen and dlclose // ] #endif VIDEO_ENC_WRAP_HANDLE_T hWrapper; } VENC_HANDLE_T; #ifdef __cplusplus } #endif #endif /* VENC_DRV_IF_DEP_H */
/* * fsi-da7210.c * * Copyright (C) 2009 Renesas Solutions Corp. * Kuninori Morimoto <morimoto.kuninori@renesas.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. */ #include <linux/platform_device.h> #include <sound/sh_fsi.h> static int fsi_da7210_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai = rtd->codec_dai; return snd_soc_dai_set_fmt(dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); } static struct snd_soc_dai_link fsi_da7210_dai = { .name = "DA7210", .stream_name = "DA7210", .cpu_dai_name = "fsib-dai", /* FSI B */ .codec_dai_name = "da7210-hifi", .platform_name = "fsi-pcm-audio", .codec_name = "da7210-codec.0-0x1a", .init = fsi_da7210_init, }; static struct snd_soc_card fsi_soc_card = { .name = "FSI", .dai_link = &fsi_da7210_dai, .num_links = 1, }; static struct platform_device *fsi_da7210_snd_device; static int __init fsi_da7210_sound_init(void) { int ret; fsi_da7210_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); if (!fsi_da7210_snd_device) return -ENOMEM; platform_set_drvdata(fsi_da7210_snd_device, &fsi_soc_card); ret = platform_device_add(fsi_da7210_snd_device); if (ret) platform_device_put(fsi_da7210_snd_device); return ret; } static void __exit fsi_da7210_sound_exit(void) { platform_device_unregister(fsi_da7210_snd_device); } module_init(fsi_da7210_sound_init); module_exit(fsi_da7210_sound_exit); /* Module information */ MODULE_DESCRIPTION("ALSA SoC FSI DA2710"); MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); MODULE_LICENSE("GPL");
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_ICOSPHERE_H #define EIGEN_ICOSPHERE_H #include <Eigen/Core> #include <vector> class IcoSphere { public: IcoSphere(unsigned int levels=1); const std::vector<Eigen::Vector3f>& vertices() const { return mVertices; } const std::vector<int>& indices(int level) const; void draw(int level); protected: void _subdivide(); std::vector<Eigen::Vector3f> mVertices; std::vector<std::vector<int>*> mIndices; std::vector<int> mListIds; }; #endif // EIGEN_ICOSPHERE_H
/* * ECDH helper functions - KPP wrappings * * Copyright (C) 2017 Intel Corporation * * 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; * * 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 OF THIRD PARTY RIGHTS. * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY * CLAIM, OR ANY SPECIAL 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. * * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS * SOFTWARE IS DISCLAIMED. */ #include "ecdh_helper.h" #include <linux/scatterlist.h> #include <crypto/ecdh.h> struct ecdh_completion { struct completion completion; int err; }; static void ecdh_complete(struct crypto_async_request *req, int err) { struct ecdh_completion *res = req->data; if (err == -EINPROGRESS) return; res->err = err; complete(&res->completion); } static inline void swap_digits(u64 *in, u64 *out, unsigned int ndigits) { int i; for (i = 0; i < ndigits; i++) out[i] = __swab64(in[ndigits - 1 - i]); } /* compute_ecdh_secret() - function assumes that the private key was * already set. * @tfm: KPP tfm handle allocated with crypto_alloc_kpp(). * @public_key: pair's ecc public key. * secret: memory where the ecdh computed shared secret will be saved. * * Return: zero on success; error code in case of error. */ int compute_ecdh_secret(struct crypto_kpp *tfm, const u8 public_key[64], u8 secret[32]) { struct kpp_request *req; u8 *tmp; struct ecdh_completion result; struct scatterlist src, dst; int err; tmp = kmalloc(64, GFP_KERNEL); if (!tmp) return -ENOMEM; req = kpp_request_alloc(tfm, GFP_KERNEL); if (!req) { err = -ENOMEM; goto free_tmp; } init_completion(&result.completion); swap_digits((u64 *)public_key, (u64 *)tmp, 4); /* x */ swap_digits((u64 *)&public_key[32], (u64 *)&tmp[32], 4); /* y */ sg_init_one(&src, tmp, 64); sg_init_one(&dst, secret, 32); kpp_request_set_input(req, &src, 64); kpp_request_set_output(req, &dst, 32); kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, ecdh_complete, &result); err = crypto_kpp_compute_shared_secret(req); if (err == -EINPROGRESS) { wait_for_completion(&result.completion); err = result.err; } if (err < 0) { pr_err("alg: ecdh: compute shared secret failed. err %d\n", err); goto free_all; } swap_digits((u64 *)secret, (u64 *)tmp, 4); memcpy(secret, tmp, 32); free_all: kpp_request_free(req); free_tmp: kzfree(tmp); return err; } /* set_ecdh_privkey() - set or generate ecc private key. * * Function generates an ecc private key in the crypto subsystem when receiving * a NULL private key or sets the received key when not NULL. * * @tfm: KPP tfm handle allocated with crypto_alloc_kpp(). * @private_key: user's ecc private key. When not NULL, the key is expected * in little endian format. * * Return: zero on success; error code in case of error. */ int set_ecdh_privkey(struct crypto_kpp *tfm, const u8 private_key[32]) { u8 *buf, *tmp = NULL; unsigned int buf_len; int err; struct ecdh p = {0}; p.curve_id = ECC_CURVE_NIST_P256; if (private_key) { tmp = kmalloc(32, GFP_KERNEL); if (!tmp) return -ENOMEM; swap_digits((u64 *)private_key, (u64 *)tmp, 4); p.key = tmp; p.key_size = 32; } buf_len = crypto_ecdh_key_len(&p); buf = kmalloc(buf_len, GFP_KERNEL); if (!buf) { err = -ENOMEM; goto free_tmp; } err = crypto_ecdh_encode_key(buf, buf_len, &p); if (err) goto free_all; err = crypto_kpp_set_secret(tfm, buf, buf_len); /* fall through */ free_all: kzfree(buf); free_tmp: kzfree(tmp); return err; } /* generate_ecdh_public_key() - function assumes that the private key was * already set. * * @tfm: KPP tfm handle allocated with crypto_alloc_kpp(). * @public_key: memory where the computed ecc public key will be saved. * * Return: zero on success; error code in case of error. */ int generate_ecdh_public_key(struct crypto_kpp *tfm, u8 public_key[64]) { struct kpp_request *req; u8 *tmp; struct ecdh_completion result; struct scatterlist dst; int err; tmp = kmalloc(64, GFP_KERNEL); if (!tmp) return -ENOMEM; req = kpp_request_alloc(tfm, GFP_KERNEL); if (!req) { err = -ENOMEM; goto free_tmp; } init_completion(&result.completion); sg_init_one(&dst, tmp, 64); kpp_request_set_input(req, NULL, 0); kpp_request_set_output(req, &dst, 64); kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, ecdh_complete, &result); err = crypto_kpp_generate_public_key(req); if (err == -EINPROGRESS) { wait_for_completion(&result.completion); err = result.err; } if (err < 0) goto free_all; /* The public key is handed back in little endian as expected by * the Security Manager Protocol. */ swap_digits((u64 *)tmp, (u64 *)public_key, 4); /* x */ swap_digits((u64 *)&tmp[32], (u64 *)&public_key[32], 4); /* y */ free_all: kpp_request_free(req); free_tmp: kfree(tmp); return err; } /* generate_ecdh_keys() - generate ecc key pair. * * @tfm: KPP tfm handle allocated with crypto_alloc_kpp(). * @public_key: memory where the computed ecc public key will be saved. * * Return: zero on success; error code in case of error. */ int generate_ecdh_keys(struct crypto_kpp *tfm, u8 public_key[64]) { int err; err = set_ecdh_privkey(tfm, NULL); if (err) return err; return generate_ecdh_public_key(tfm, public_key); }
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * Maintained at www.Open-FCoE.org */ /* * Frame allocation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/gfp.h> #include <scsi/fc_frame.h> /* * Check the CRC in a frame. */ u32 fc_frame_crc_check(struct fc_frame *fp) { u32 crc; u32 error; const u8 *bp; unsigned int len; WARN_ON(!fc_frame_is_linear(fp)); fr_flags(fp) &= ~FCPHF_CRC_UNCHECKED; len = (fr_len(fp) + 3) & ~3; /* round up length to include fill */ bp = (const u8 *) fr_hdr(fp); crc = ~crc32(~0, bp, len); error = crc ^ fr_crc(fp); return error; } EXPORT_SYMBOL(fc_frame_crc_check); /* * Allocate a frame intended to be sent. * Get an sk_buff for the frame and set the length. */ struct fc_frame *_fc_frame_alloc(size_t len) { struct fc_frame *fp; struct sk_buff *skb; WARN_ON((len % sizeof(u32)) != 0); len += sizeof(struct fc_frame_header); skb = alloc_skb_fclone(len + FC_FRAME_HEADROOM + FC_FRAME_TAILROOM + NET_SKB_PAD, GFP_ATOMIC); if (!skb) return NULL; skb_reserve(skb, NET_SKB_PAD + FC_FRAME_HEADROOM); fp = (struct fc_frame *) skb; fc_frame_init(fp); skb_put(skb, len); return fp; } EXPORT_SYMBOL(_fc_frame_alloc); struct fc_frame *fc_frame_alloc_fill(struct fc_lport *lp, size_t payload_len) { struct fc_frame *fp; size_t fill; fill = payload_len % 4; if (fill != 0) fill = 4 - fill; fp = _fc_frame_alloc(payload_len + fill); if (fp) { memset((char *) fr_hdr(fp) + payload_len, 0, fill); /* trim is OK, we just allocated it so there are no fragments */ skb_trim(fp_skb(fp), payload_len + sizeof(struct fc_frame_header)); } return fp; } EXPORT_SYMBOL(fc_frame_alloc_fill);
/* * linux/arch/arm/mach-at91/generic.h * * Copyright (C) 2005 David Brownell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/clkdev.h> /* Map io */ extern void __init at91_map_io(void); extern void __init at91_init_sram(int bank, unsigned long base, unsigned int length); /* Processors */ extern void __init at91rm9200_set_type(int type); extern void __init at91_initialize(unsigned long main_clock); extern void __init at91x40_initialize(unsigned long main_clock); /* Interrupts */ extern void __init at91_init_irq_default(void); extern void __init at91_init_interrupts(unsigned int priority[]); extern void __init at91x40_init_interrupts(unsigned int priority[]); extern void __init at91_aic_init(unsigned int priority[]); /* Timer */ struct sys_timer; extern struct sys_timer at91rm9200_timer; extern void at91sam926x_ioremap_pit(u32 addr); extern struct sys_timer at91sam926x_timer; extern struct sys_timer at91x40_timer; /* Clocks */ /* * function to specify the clock of the default console. As we do not * use the device/driver bus, the dev_name is not intialize. So we need * to link the clock to a specific con_id only "usart" */ extern void __init at91rm9200_set_console_clock(int id); extern void __init at91sam9260_set_console_clock(int id); extern void __init at91sam9261_set_console_clock(int id); extern void __init at91sam9263_set_console_clock(int id); extern void __init at91sam9rl_set_console_clock(int id); extern void __init at91sam9g45_set_console_clock(int id); extern void __init at91cap9_set_console_clock(int id); #ifdef CONFIG_AT91_PMC_UNIT extern int __init at91_clock_init(unsigned long main_clock); #else static int inline at91_clock_init(unsigned long main_clock) { return 0; } #endif struct device; /* Power Management */ extern void at91_irq_suspend(void); extern void at91_irq_resume(void); /* reset */ extern void at91_ioremap_rstc(u32 base_addr); extern void at91sam9_alt_restart(char, const char *); extern void at91sam9g45_restart(char, const char *); /* shutdown */ extern void at91_ioremap_shdwc(u32 base_addr); /* GPIO */ #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ #define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ struct at91_gpio_bank { unsigned short id; /* peripheral ID */ unsigned long regbase; /* offset from system peripheral base */ }; extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks); extern void __init at91_gpio_irq_setup(void); extern int at91_extern_irq;
/* { dg-do compile } */ /* { dg-options "-O2" } */ #include <stddef.h> void *a; int *b; struct c {void * a;} c; struct d {short * a;} d; int *ip= (int *)(size_t)2; int **ipp = &ip; int main() { float **ptr; void **uptr; int* const* cipp = (int* const*)ipp; /* as an extension we consider void * universal. Writes to it should alias. */ asm ("":"=r"(ptr):"0"(&a)); a=NULL; *ptr=(float*)(size_t)1; if (!a) __builtin_abort (); a=NULL; if (*ptr) __builtin_abort (); asm ("":"=r"(uptr):"0"(&b)); b=NULL; *uptr=(void*)(size_t)1; if (!b) __builtin_abort (); b=NULL; if (*uptr) __builtin_abort (); /* Check that we disambiguate int * and char *. */ asm ("":"=r"(ptr):"0"(&b)); b=NULL; *ptr=(float*)(size_t)1; if (b) __builtin_abort (); /* Again we should make void * in the structure conflict with any pointer. */ asm ("":"=r"(ptr):"0"(&c)); c.a=NULL; *ptr=(float*)(size_t)1; if (!c.a) __builtin_abort (); c.a=NULL; if (*ptr) __builtin_abort (); asm ("":"=r"(uptr):"0"(&d)); d.a=NULL; *uptr=(void*)(size_t)1; if (!d.a) __builtin_abort (); d.a=NULL; if (*uptr) __builtin_abort (); if ((void *)*cipp != (void*)(size_t)2) __builtin_abort (); *ipp = NULL; if (*cipp) __builtin_abort (); return 0; }
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * * GPL HEADER END */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * * cl code shared between vvp and liblustre (and other Lustre clients in the * future). * */ #include <obd_class.h> #include <obd_support.h> #include <obd.h> #include <cl_object.h> #include <lclient.h> #include <lustre_lite.h> /* Initialize the default and maximum LOV EA and cookie sizes. This allows * us to make MDS RPCs with large enough reply buffers to hold the * maximum-sized (= maximum striped) EA and cookie without having to * calculate this (via a call into the LOV + OSCs) each time we make an RPC. */ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp) { struct lov_stripe_md lsm = { .lsm_magic = LOV_MAGIC_V3 }; __u32 valsize = sizeof(struct lov_desc); int rc, easize, def_easize, cookiesize; struct lov_desc desc; __u16 stripes, def_stripes; rc = obd_get_info(NULL, dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC, &valsize, &desc, NULL); if (rc) return rc; stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT); lsm.lsm_stripe_count = stripes; easize = obd_size_diskmd(dt_exp, &lsm); def_stripes = min_t(__u32, desc.ld_default_stripe_count, LOV_MAX_STRIPE_COUNT); lsm.lsm_stripe_count = def_stripes; def_easize = obd_size_diskmd(dt_exp, &lsm); cookiesize = stripes * sizeof(struct llog_cookie); /* default cookiesize is 0 because from 2.4 server doesn't send * llog cookies to client. */ CDEBUG(D_HA, "updating def/max_easize: %d/%d def/max_cookiesize: 0/%d\n", def_easize, easize, cookiesize); rc = md_init_ea_size(md_exp, easize, def_easize, cookiesize, 0); return rc; } /** * This function is used as an upcall-callback hooked by liblustre and llite * clients into obd_notify() listeners chain to handle notifications about * change of import connect_flags. See llu_fsswop_mount() and * lustre_common_fill_super(). */ int cl_ocd_update(struct obd_device *host, struct obd_device *watched, enum obd_notify_event ev, void *owner, void *data) { struct lustre_client_ocd *lco; struct client_obd *cli; __u64 flags; int result; if (!strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME)) { cli = &watched->u.cli; lco = owner; flags = cli->cl_import->imp_connect_data.ocd_connect_flags; CDEBUG(D_SUPER, "Changing connect_flags: "LPX64" -> "LPX64"\n", lco->lco_flags, flags); mutex_lock(&lco->lco_lock); lco->lco_flags &= flags; /* for each osc event update ea size */ if (lco->lco_dt_exp) cl_init_ea_size(lco->lco_md_exp, lco->lco_dt_exp); mutex_unlock(&lco->lco_lock); result = 0; } else { CERROR("unexpected notification from %s %s!\n", watched->obd_type->typ_name, watched->obd_name); result = -EINVAL; } return result; } #define GROUPLOCK_SCOPE "grouplock" int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, struct ccc_grouplock *cg) { struct lu_env *env; struct cl_io *io; struct cl_lock *lock; struct cl_lock_descr *descr; __u32 enqflags; int refcheck; int rc; env = cl_env_get(&refcheck); if (IS_ERR(env)) return PTR_ERR(env); io = ccc_env_thread_io(env); io->ci_obj = obj; io->ci_ignore_layout = 1; rc = cl_io_init(env, io, CIT_MISC, io->ci_obj); if (rc) { /* Does not make sense to take GL for released layout */ if (rc > 0) rc = -ENOTSUPP; cl_env_put(env, &refcheck); return rc; } descr = &ccc_env_info(env)->cti_descr; descr->cld_obj = obj; descr->cld_start = 0; descr->cld_end = CL_PAGE_EOF; descr->cld_gid = gid; descr->cld_mode = CLM_GROUP; enqflags = CEF_MUST | (nonblock ? CEF_NONBLOCK : 0); descr->cld_enq_flags = enqflags; lock = cl_lock_request(env, io, descr, GROUPLOCK_SCOPE, current); if (IS_ERR(lock)) { cl_io_fini(env, io); cl_env_put(env, &refcheck); return PTR_ERR(lock); } cg->cg_env = cl_env_get(&refcheck); cg->cg_io = io; cg->cg_lock = lock; cg->cg_gid = gid; LASSERT(cg->cg_env == env); cl_env_unplant(env, &refcheck); return 0; } void cl_put_grouplock(struct ccc_grouplock *cg) { struct lu_env *env = cg->cg_env; struct cl_io *io = cg->cg_io; struct cl_lock *lock = cg->cg_lock; int refcheck; LASSERT(cg->cg_env); LASSERT(cg->cg_gid); cl_env_implant(env, &refcheck); cl_env_put(env, &refcheck); cl_unuse(env, lock); cl_lock_release(env, lock, GROUPLOCK_SCOPE, current); cl_io_fini(env, io); cl_env_put(env, NULL); }
// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) ST-Ericsson AB 2010 * Author: Sjur Brendeland */ #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__ #include <linux/kernel.h> #include <linux/types.h> #include <linux/slab.h> #include <linux/errno.h> #include <net/caif/caif_layer.h> #include <net/caif/cfsrvl.h> #include <net/caif/cfpkt.h> #define container_obj(layr) ((struct cfsrvl *) layr) #define UTIL_PAYLOAD 0x00 #define UTIL_CMD_BIT 0x80 #define UTIL_REMOTE_SHUTDOWN 0x82 #define UTIL_FLOW_OFF 0x81 #define UTIL_FLOW_ON 0x80 static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt); static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt); struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info) { struct cfsrvl *util = kzalloc(sizeof(struct cfsrvl), GFP_ATOMIC); if (!util) return NULL; caif_assert(offsetof(struct cfsrvl, layer) == 0); cfsrvl_init(util, channel_id, dev_info, true); util->layer.receive = cfutill_receive; util->layer.transmit = cfutill_transmit; snprintf(util->layer.name, CAIF_LAYER_NAME_SZ, "util1"); return &util->layer; } static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt) { u8 cmd = -1; struct cfsrvl *service = container_obj(layr); caif_assert(layr != NULL); caif_assert(layr->up != NULL); caif_assert(layr->up->receive != NULL); caif_assert(layr->up->ctrlcmd != NULL); if (cfpkt_extr_head(pkt, &cmd, 1) < 0) { pr_err("Packet is erroneous!\n"); cfpkt_destroy(pkt); return -EPROTO; } switch (cmd) { case UTIL_PAYLOAD: return layr->up->receive(layr->up, pkt); case UTIL_FLOW_OFF: layr->ctrlcmd(layr, CAIF_CTRLCMD_FLOW_OFF_IND, 0); cfpkt_destroy(pkt); return 0; case UTIL_FLOW_ON: layr->ctrlcmd(layr, CAIF_CTRLCMD_FLOW_ON_IND, 0); cfpkt_destroy(pkt); return 0; case UTIL_REMOTE_SHUTDOWN: /* Remote Shutdown Request */ pr_err("REMOTE SHUTDOWN REQUEST RECEIVED\n"); layr->ctrlcmd(layr, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, 0); service->open = false; cfpkt_destroy(pkt); return 0; default: cfpkt_destroy(pkt); pr_warn("Unknown service control %d (0x%x)\n", cmd, cmd); return -EPROTO; } } static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt) { u8 zero = 0; struct caif_payload_info *info; int ret; struct cfsrvl *service = container_obj(layr); caif_assert(layr != NULL); caif_assert(layr->dn != NULL); caif_assert(layr->dn->transmit != NULL); if (!cfsrvl_ready(service, &ret)) { cfpkt_destroy(pkt); return ret; } cfpkt_add_head(pkt, &zero, 1); /* Add info for MUX-layer to route the packet out. */ info = cfpkt_info(pkt); info->channel_id = service->layer.id; /* * To optimize alignment, we add up the size of CAIF header before * payload. */ info->hdr_len = 1; info->dev_info = &service->dev_info; return layr->dn->transmit(layr->dn, pkt); }
/* libsecret - GLib wrapper for Secret Service * * Copyright 2012 Stef Walter * * 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 licence or (at * your option) any later version. * * See the included COPYING file for more information. * * Author: Stef Walter <stefw@gnome.org> */ #if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION) #error "Only <libsecret/secret.h> can be included directly." #endif #ifndef __SECRET_SCHEMAS_H__ #define __SECRET_SCHEMAS_H__ #include <glib.h> #include "secret-schema.h" G_BEGIN_DECLS /* * A note or password stored manually by the user. */ extern const SecretSchema * SECRET_SCHEMA_NOTE; /* * This schema is here for compatibility with libgnome-keyring's network * password functions. */ extern const SecretSchema * SECRET_SCHEMA_COMPAT_NETWORK; G_END_DECLS #endif /* __SECRET_SCHEMAS_H___ */
#import <Foundation/Foundation.h> #import <memory> #import <vector> #import "InvocationMatcher.h" #import "Argument.h" #import "ReturnValue.h" namespace Cedar { namespace Doubles { class StubbedMethod : private InvocationMatcher { private: typedef void (^invocation_block_t)(NSInvocation *); typedef id implementation_block_t; private: StubbedMethod & operator=(const StubbedMethod &); public: StubbedMethod(SEL); StubbedMethod(const char *); StubbedMethod(const StubbedMethod &); virtual ~StubbedMethod(); template<typename T> StubbedMethod & and_return(const T &); StubbedMethod & and_do_block(implementation_block_t block); StubbedMethod & and_do(invocation_block_t); StubbedMethod & with(const Argument::shared_ptr_t argument); StubbedMethod & and_with(const Argument::shared_ptr_t argument); StubbedMethod & again(); template<typename T, typename... ArgumentPack> StubbedMethod & with(const T &, ArgumentPack... pack); template<typename T> StubbedMethod & with(const T &); template<typename T> StubbedMethod & and_with(const T &); inline StubbedMethod & with(const char *argument); StubbedMethod & and_raise_exception(); StubbedMethod & and_raise_exception(NSObject * exception); ReturnValue & return_value() const { return *return_value_; }; bool is_override() const { return is_override_; }; struct SelCompare { bool operator() (const SEL& lhs, const SEL& rhs) const { return strcmp(sel_getName(lhs), sel_getName(rhs)) < 0; } }; typedef std::shared_ptr<StubbedMethod> shared_ptr_t; typedef std::vector<shared_ptr_t> stubbed_method_vector_t; typedef std::map<SEL, stubbed_method_vector_t, SelCompare> selector_map_t; const SEL selector() const; bool matches_arguments(const StubbedMethod &) const; bool arguments_equal(const StubbedMethod &) const; bool matches(NSInvocation * const invocation) const; bool invoke(NSInvocation * invocation) const; void validate_against_instance(id instance) const; NSString *arguments_string() const; unsigned int arguments_specificity_ranking() const; private: bool has_return_value() const { return return_value_.get(); }; bool has_invocation_block() const { return invocation_block_; } bool has_implementation_block() const { return implementation_block_; } void verify_return_value_type(id instance) const; void verify_implementation_block_return_type(id instance) const; void verify_implementation_block_arguments(id instance) const; void raise_for_multiple_return_values() const; void raise_for_multiple_blocks() const; private: ReturnValue::shared_ptr_t return_value_; bool is_override_; invocation_block_t invocation_block_; implementation_block_t implementation_block_; NSObject * exception_to_raise_; }; template<typename T> StubbedMethod & StubbedMethod::and_return(const T & return_value) { if (this->has_invocation_block()) { this->raise_for_multiple_return_values(); } else if (this->has_implementation_block()) { this->raise_for_multiple_return_values(); } return_value_ = ReturnValue::shared_ptr_t(new TypedReturnValue<T>(return_value)); return *this; } template<typename T> StubbedMethod & StubbedMethod::with(const T & argument) { return with(Argument::shared_ptr_t(new ValueArgument<T>(argument))); } StubbedMethod & StubbedMethod::with(const char *argument) { return with(Argument::shared_ptr_t(new CharValueArgument(argument))); } template<typename T> StubbedMethod & StubbedMethod::and_with(const T & argument) { return with(argument); } template<typename T, typename... ArgumentPack> StubbedMethod & StubbedMethod::with(const T & value, ArgumentPack... pack) { this->with(value); this->with(pack...); return *this; } }}
/* cbrt.c * * Cube root * * * * SYNOPSIS: * * double x, y, cbrt(); * * y = cbrt( x ); * * * * DESCRIPTION: * * Returns the cube root of the argument, which may be negative. * * Range reduction involves determining the power of 2 of * the argument. A polynomial of degree 2 applied to the * mantissa, and multiplication by the cube root of 1, 2, or 4 * approximates the root to within about 0.1%. Then Newton's * iteration is used three times to converge to an accurate * result. * * * * ACCURACY: * * Relative error: * arithmetic domain # trials peak rms * DEC -10,10 200000 1.8e-17 6.2e-18 * IEEE 0,1e308 30000 1.5e-16 5.0e-17 * */ /* cbrt.c */ /* Cephes Math Library Release 2.8: June, 2000 Copyright 1984, 1991, 2000 by Stephen L. Moshier */ #include "mconf.h" const static double CBRT2 = 1.2599210498948731647672; const static double CBRT4 = 1.5874010519681994747517; const static double CBRT2I = 0.79370052598409973737585; const static double CBRT4I = 0.62996052494743658238361; #ifdef ANSIPROT extern double frexp ( double, int * ); extern double ldexp ( double, int ); extern int isnan ( double ); extern int isfinite ( double ); #else double frexp(), ldexp(); int isnan(), isfinite(); #endif double cbrt(x) double x; { int e, rem, sign; double z; #ifdef NANS if( isnan(x) ) return x; #endif #ifdef INFINITIES if( !isfinite(x) ) return x; #endif if( x == 0 ) return( x ); if( x > 0 ) sign = 1; else { sign = -1; x = -x; } z = x; /* extract power of 2, leaving * mantissa between 0.5 and 1 */ x = frexp( x, &e ); /* Approximate cube root of number between .5 and 1, * peak relative error = 9.2e-6 */ x = (((-1.3466110473359520655053e-1 * x + 5.4664601366395524503440e-1) * x - 9.5438224771509446525043e-1) * x + 1.1399983354717293273738e0 ) * x + 4.0238979564544752126924e-1; /* exponent divided by 3 */ if( e >= 0 ) { rem = e; e /= 3; rem -= 3*e; if( rem == 1 ) x *= CBRT2; else if( rem == 2 ) x *= CBRT4; } /* argument less than 1 */ else { e = -e; rem = e; e /= 3; rem -= 3*e; if( rem == 1 ) x *= CBRT2I; else if( rem == 2 ) x *= CBRT4I; e = -e; } /* multiply by power of 2 */ x = ldexp( x, e ); /* Newton iteration */ x -= ( x - (z/(x*x)) )*0.33333333333333333333; #ifdef DEC x -= ( x - (z/(x*x)) )/3.0; #else x -= ( x - (z/(x*x)) )*0.33333333333333333333; #endif if( sign < 0 ) x = -x; return(x); }
/* * linux/arch/arm/plat-omap/mux.c * * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h * * Copyright (C) 2003 - 2005 Nokia Corporation * * Written by Tony Lindgren <tony.lindgren@nokia.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 * */ #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <asm/system.h> #include <asm/io.h> #include <linux/spinlock.h> #include <asm/arch/mux.h> #ifdef CONFIG_OMAP_MUX #define OMAP24XX_L4_BASE 0x48000000 #define OMAP24XX_PULL_ENA (1 << 3) #define OMAP24XX_PULL_UP (1 << 4) static struct pin_config * pin_table; static unsigned long pin_table_sz; extern struct pin_config * omap730_pins; extern struct pin_config * omap1xxx_pins; extern struct pin_config * omap24xx_pins; int __init omap_mux_register(struct pin_config * pins, unsigned long size) { pin_table = pins; pin_table_sz = size; return 0; } /* * Sets the Omap MUX and PULL_DWN registers based on the table */ int __init_or_module omap_cfg_reg(const unsigned long index) { static DEFINE_SPINLOCK(mux_spin_lock); unsigned long flags; struct pin_config *cfg; unsigned int reg_orig = 0, reg = 0, pu_pd_orig = 0, pu_pd = 0, pull_orig = 0, pull = 0; unsigned int mask, warn = 0; if (!pin_table) BUG(); if (index >= pin_table_sz) { printk(KERN_ERR "Invalid pin mux index: %lu (%lu)\n", index, pin_table_sz); dump_stack(); return -ENODEV; } cfg = (struct pin_config *)&pin_table[index]; if (cpu_is_omap24xx()) { u8 reg = 0; reg |= cfg->mask & 0x7; if (cfg->pull_val) reg |= OMAP24XX_PULL_ENA; if(cfg->pu_pd_val) reg |= OMAP24XX_PULL_UP; #if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS) { u8 orig = omap_readb(OMAP24XX_L4_BASE + cfg->mux_reg); u8 debug = 0; #ifdef CONFIG_OMAP_MUX_DEBUG debug = cfg->debug; #endif warn = (orig != reg); if (debug || warn) printk("MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n", cfg->name, OMAP24XX_L4_BASE + cfg->mux_reg, orig, reg); } #endif omap_writeb(reg, OMAP24XX_L4_BASE + cfg->mux_reg); return 0; } /* Check the mux register in question */ if (cfg->mux_reg) { unsigned tmp1, tmp2; spin_lock_irqsave(&mux_spin_lock, flags); reg_orig = omap_readl(cfg->mux_reg); /* The mux registers always seem to be 3 bits long */ mask = (0x7 << cfg->mask_offset); tmp1 = reg_orig & mask; reg = reg_orig & ~mask; tmp2 = (cfg->mask << cfg->mask_offset); reg |= tmp2; if (tmp1 != tmp2) warn = 1; omap_writel(reg, cfg->mux_reg); spin_unlock_irqrestore(&mux_spin_lock, flags); } /* Check for pull up or pull down selection on 1610 */ if (!cpu_is_omap15xx()) { if (cfg->pu_pd_reg && cfg->pull_val) { spin_lock_irqsave(&mux_spin_lock, flags); pu_pd_orig = omap_readl(cfg->pu_pd_reg); mask = 1 << cfg->pull_bit; if (cfg->pu_pd_val) { if (!(pu_pd_orig & mask)) warn = 1; /* Use pull up */ pu_pd = pu_pd_orig | mask; } else { if (pu_pd_orig & mask) warn = 1; /* Use pull down */ pu_pd = pu_pd_orig & ~mask; } omap_writel(pu_pd, cfg->pu_pd_reg); spin_unlock_irqrestore(&mux_spin_lock, flags); } } /* Check for an associated pull down register */ if (cfg->pull_reg) { spin_lock_irqsave(&mux_spin_lock, flags); pull_orig = omap_readl(cfg->pull_reg); mask = 1 << cfg->pull_bit; if (cfg->pull_val) { if (pull_orig & mask) warn = 1; /* Low bit = pull enabled */ pull = pull_orig & ~mask; } else { if (!(pull_orig & mask)) warn = 1; /* High bit = pull disabled */ pull = pull_orig | mask; } omap_writel(pull, cfg->pull_reg); spin_unlock_irqrestore(&mux_spin_lock, flags); } if (warn) { #ifdef CONFIG_OMAP_MUX_WARNINGS printk(KERN_WARNING "MUX: initialized %s\n", cfg->name); #endif } #ifdef CONFIG_OMAP_MUX_DEBUG if (cfg->debug || warn) { printk("MUX: Setting register %s\n", cfg->name); printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n", cfg->mux_reg_name, cfg->mux_reg, reg_orig, reg); if (!cpu_is_omap15xx()) { if (cfg->pu_pd_reg && cfg->pull_val) { printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n", cfg->pu_pd_name, cfg->pu_pd_reg, pu_pd_orig, pu_pd); } } if (cfg->pull_reg) printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n", cfg->pull_name, cfg->pull_reg, pull_orig, pull); } #endif #ifdef CONFIG_OMAP_MUX_ERRORS return warn ? -ETXTBSY : 0; #else return 0; #endif } EXPORT_SYMBOL(omap_cfg_reg); #else #define omap_mux_init() do {} while(0) #define omap_cfg_reg(x) do {} while(0) #endif /* CONFIG_OMAP_MUX */
/* Verify diagnostics for extended identifiers refer to UCNs (in the C locale). Miscellaneous diagnostics. */ /* { dg-do compile } */ /* { dg-options "-std=gnu99 -fextended-identifiers -Wpacked" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ int a __attribute__((\u00c0)); /* { dg-warning "'\\\\U000000c0' attribute directive ignored" } */ extern void \u00c1 (void) __attribute__((deprecated)); void g (void) { \u00c1 (); } /* { dg-warning "'\\\\U000000c1' is deprecated" } */ struct \u00c2 { char c; } __attribute__((packed)); /* { dg-warning "'\\\\U000000c2'" } */ void h (void) { asm ("%[\u00c3]" : : ); } /* { dg-error "undefined named operand '\\\\U000000c3'" } */
#include "meta.h" #include "../util.h" /* SL3 (from Test Drive Unlimited, Transformers) */ VGMSTREAM * init_vgmstream_sl3(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; char filename[260]; off_t start_offset; int loop_flag = 0; int channel_count; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("sl3",filename_extension(filename))) goto fail; /* check header */ if (read_32bitBE(0x00,streamFile) != 0x534C3300) /* "SL3\0" */ goto fail; loop_flag = 0; channel_count = read_32bitLE(0x14,streamFile); /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; /* fill in the vital statistics */ start_offset = 0x8000; vgmstream->channels = channel_count; vgmstream->sample_rate = read_32bitLE(0x18,streamFile); vgmstream->coding_type = coding_PSX; vgmstream->num_samples = (get_streamfile_size(streamFile)-0x8000)*28/16/channel_count; if (loop_flag) { vgmstream->loop_start_sample = 0; vgmstream->loop_end_sample = read_32bitLE(0x1C,streamFile); } vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = read_32bitLE(0x20,streamFile); vgmstream->meta_type = meta_SL3; /* open the file for reading */ { int i; STREAMFILE * file; file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE); if (!file) goto fail; for (i=0;i<channel_count;i++) { vgmstream->ch[i].streamfile = file; vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=start_offset+ vgmstream->interleave_block_size*i; } } return vgmstream; /* clean up anything we may have opened */ fail: if (vgmstream) close_vgmstream(vgmstream); return NULL; }
/* Copyright 2019 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "quantum.h" #define ___ KC_NO #ifdef KEYBOARD_maxipad_promicro #include "promicro.h" #elif KEYBOARD_maxipad_teensy2 #include "teensy2.h" #endif /* This a shortcut to help you visually see your layout. * * The first section contains all of the arguments representing the physical * layout of the board and position of the keys. * * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ #define LAYOUT_grid( \ k00, k01, k02, k03, k04, k05, \ k10, k11, k12, k13, k14, k15, \ k20, k21, k22, k23, k24, k25, \ k30, k31, k32, k33, k34, k35, \ k40, k41, k42, k43, k44, k45 \ ) \ { \ { k00, k01, k02, k03, k04, k05 }, \ { k10, k11, k12, k13, k14, k15 }, \ { k20, k21, k22, k23, k24, k25 }, \ { k30, k31, k32, k33, k34, k35 }, \ { k40, k41, k42, k43, k44, k45 } \ } #define LAYOUT_1x2uC( \ k00, k01, k02, k03, k04, k05, \ k10, k11, k12, k13, k14, k15, \ k20, k21, k22, k23, k24, k25, \ k30, k31, k32, k33, k34, k35, \ k40, k41, k42, k43, k44 \ ) \ { \ { k00, k01, k02, k03, k04, k05 }, \ { k10, k11, k12, k13, k14, k15 }, \ { k20, k21, k22, k23, k24, k25 }, \ { k30, k31, k32, k33, k34, k35 }, \ { k40, k41, k42, k43, ___, k44 } \ } #define LAYOUT LAYOUT_grid #define LAYOUT_ortho_5x6 LAYOUT_grid
#define _FP_W_TYPE_SIZE 32 #define _FP_W_TYPE unsigned long #define _FP_WS_TYPE signed long #define _FP_I_TYPE long /* The type of the result of a floating point comparison. This must match `__libgcc_cmp_return__' in GCC for the target. */ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__))); #define CMPtype __gcc_CMPtype #define _FP_MUL_MEAT_S(R,X,Y) \ _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_D(R,X,Y) \ _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) #define _FP_MUL_MEAT_Q(R,X,Y) \ _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y) #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 #define _FP_NANSIGN_S 0 #define _FP_NANSIGN_D 0 #define _FP_NANSIGN_Q 0 #define _FP_KEEPNANFRACP 1 /* Someone please check this. */ #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ do { \ if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ { \ R##_s = Y##_s; \ _FP_FRAC_COPY_##wc(R,Y); \ } \ else \ { \ R##_s = X##_s; \ _FP_FRAC_COPY_##wc(R,X); \ } \ R##_c = FP_CLS_NAN; \ } while (0) #define __LITTLE_ENDIAN 1234 #define __BIG_ENDIAN 4321 #if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN # error "Both BIG_ENDIAN and LITTLE_ENDIAN defined!" # endif # define __BYTE_ORDER __BIG_ENDIAN #else # if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN # define __BYTE_ORDER __LITTLE_ENDIAN # else # error "Cannot determine current byte order" # endif #endif /* Define ALIASNAME as a strong alias for NAME. */ # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
/* SPDX-License-Identifier: GPL-2.0 */ /* * MCS lock defines * * This file contains the main data structure and API definitions of MCS lock. * * The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spin-lock * with the desirable properties of being fair, and with each cpu trying * to acquire the lock spinning on a local variable. * It avoids expensive cache bounces that common test-and-set spin-lock * implementations incur. */ #ifndef __LINUX_MCS_SPINLOCK_H #define __LINUX_MCS_SPINLOCK_H #include <asm/mcs_spinlock.h> struct mcs_spinlock { struct mcs_spinlock *next; int locked; /* 1 if lock acquired */ int count; /* nesting count, see qspinlock.c */ }; #ifndef arch_mcs_spin_lock_contended /* * Using smp_cond_load_acquire() provides the acquire semantics * required so that subsequent operations happen after the * lock is acquired. Additionally, some architectures such as * ARM64 would like to do spin-waiting instead of purely * spinning, and smp_cond_load_acquire() provides that behavior. */ #define arch_mcs_spin_lock_contended(l) \ do { \ smp_cond_load_acquire(l, VAL); \ } while (0) #endif #ifndef arch_mcs_spin_unlock_contended /* * smp_store_release() provides a memory barrier to ensure all * operations in the critical section has been completed before * unlocking. */ #define arch_mcs_spin_unlock_contended(l) \ smp_store_release((l), 1) #endif /* * Note: the smp_load_acquire/smp_store_release pair is not * sufficient to form a full memory barrier across * cpus for many architectures (except x86) for mcs_unlock and mcs_lock. * For applications that need a full barrier across multiple cpus * with mcs_unlock and mcs_lock pair, smp_mb__after_unlock_lock() should be * used after mcs_lock. */ /* * In order to acquire the lock, the caller should declare a local node and * pass a reference of the node to this function in addition to the lock. * If the lock has already been acquired, then this will proceed to spin * on this node->locked until the previous lock holder sets the node->locked * in mcs_spin_unlock(). */ static inline void mcs_spin_lock(struct mcs_spinlock **lock, struct mcs_spinlock *node) { struct mcs_spinlock *prev; /* Init node */ node->locked = 0; node->next = NULL; /* * We rely on the full barrier with global transitivity implied by the * below xchg() to order the initialization stores above against any * observation of @node. And to provide the ACQUIRE ordering associated * with a LOCK primitive. */ prev = xchg(lock, node); if (likely(prev == NULL)) { /* * Lock acquired, don't need to set node->locked to 1. Threads * only spin on its own node->locked value for lock acquisition. * However, since this thread can immediately acquire the lock * and does not proceed to spin on its own node->locked, this * value won't be used. If a debug mode is needed to * audit lock status, then set node->locked value here. */ return; } WRITE_ONCE(prev->next, node); /* Wait until the lock holder passes the lock down. */ arch_mcs_spin_lock_contended(&node->locked); } /* * Releases the lock. The caller should pass in the corresponding node that * was used to acquire the lock. */ static inline void mcs_spin_unlock(struct mcs_spinlock **lock, struct mcs_spinlock *node) { struct mcs_spinlock *next = READ_ONCE(node->next); if (likely(!next)) { /* * Release the lock by setting it to NULL */ if (likely(cmpxchg_release(lock, node, NULL) == node)) return; /* Wait until the next pointer is set */ while (!(next = READ_ONCE(node->next))) cpu_relax(); } /* Pass lock to next waiter. */ arch_mcs_spin_unlock_contended(&next->locked); } #endif /* __LINUX_MCS_SPINLOCK_H */
void f0(int); void f1(int, float); void f2(); void f3(void); void f4(int, int); int f5(int) __attribute__((const));
#ifndef _KERNEL_TIME_TIMEKEEPING_H #define _KERNEL_TIME_TIMEKEEPING_H /* * Internal interfaces for kernel/time/ */ extern ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real, ktime_t *offs_boot, ktime_t *offs_tai); extern int timekeeping_valid_for_hres(void); extern u64 timekeeping_max_deferment(void); extern int timekeeping_inject_offset(struct timespec *ts); extern s32 timekeeping_get_tai_offset(void); extern void timekeeping_set_tai_offset(s32 tai_offset); extern int timekeeping_suspend(void); extern void timekeeping_resume(void); extern void do_timer(unsigned long ticks); extern void update_wall_time(void); extern seqlock_t jiffies_lock; #define CS_NAME_LEN 32 #endif
/* SPDX-License-Identifier: GPL-2.0 */ /* Copyright (c) 2018, Intel Corporation. */ #ifndef _ICE_SCHED_H_ #define _ICE_SCHED_H_ #include "ice_common.h" #define ICE_QGRP_LAYER_OFFSET 2 #define ICE_VSI_LAYER_OFFSET 4 #define ICE_SCHED_INVAL_LAYER_NUM 0xFF /* Burst size is a 12 bits register that is configured while creating the RL * profile(s). MSB is a granularity bit and tells the granularity type * 0 - LSB bits are in 64 bytes granularity * 1 - LSB bits are in 1K bytes granularity */ #define ICE_64_BYTE_GRANULARITY 0 #define ICE_KBYTE_GRANULARITY BIT(11) #define ICE_MIN_BURST_SIZE_ALLOWED 64 /* In Bytes */ #define ICE_MAX_BURST_SIZE_ALLOWED \ ((BIT(11) - 1) * 1024) /* In Bytes */ #define ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY \ ((BIT(11) - 1) * 64) /* In Bytes */ #define ICE_MAX_BURST_SIZE_KBYTE_GRANULARITY ICE_MAX_BURST_SIZE_ALLOWED #define ICE_RL_PROF_FREQUENCY 446000000 #define ICE_RL_PROF_ACCURACY_BYTES 128 #define ICE_RL_PROF_MULTIPLIER 10000 #define ICE_RL_PROF_TS_MULTIPLIER 32 #define ICE_RL_PROF_FRACTION 512 /* BW rate limit profile parameters list entry along * with bandwidth maintained per layer in port info */ struct ice_aqc_rl_profile_info { struct ice_aqc_rl_profile_elem profile; struct list_head list_entry; u32 bw; /* requested */ u16 prof_id_ref; /* profile ID to node association ref count */ }; struct ice_sched_agg_vsi_info { struct list_head list_entry; DECLARE_BITMAP(tc_bitmap, ICE_MAX_TRAFFIC_CLASS); u16 vsi_handle; }; struct ice_sched_agg_info { struct list_head agg_vsi_list; struct list_head list_entry; DECLARE_BITMAP(tc_bitmap, ICE_MAX_TRAFFIC_CLASS); u32 agg_id; enum ice_agg_type agg_type; }; /* FW AQ command calls */ enum ice_status ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req, struct ice_aqc_get_elem *buf, u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd); enum ice_status ice_sched_init_port(struct ice_port_info *pi); enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw); void ice_sched_clear_port(struct ice_port_info *pi); void ice_sched_cleanup_all(struct ice_hw *hw); void ice_sched_clear_agg(struct ice_hw *hw); struct ice_sched_node * ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid); enum ice_status ice_sched_add_node(struct ice_port_info *pi, u8 layer, struct ice_aqc_txsched_elem_data *info); void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node); struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc); struct ice_sched_node * ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 owner); enum ice_status ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs, u8 owner, bool enable); enum ice_status ice_rm_vsi_lan_cfg(struct ice_port_info *pi, u16 vsi_handle); enum ice_status ice_cfg_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, enum ice_rl_type rl_type, u32 bw); enum ice_status ice_cfg_q_bw_dflt_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, enum ice_rl_type rl_type); enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes); enum ice_status ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx); #endif /* _ICE_SCHED_H_ */
/* * Copyright (C) 2013 Red Hat * Author: Rob Clark <robdclark@gmail.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #include "msm_ringbuffer.h" #include "msm_gpu.h" struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int size) { struct msm_ringbuffer *ring; int ret; if (WARN_ON(!is_power_of_2(size))) return ERR_PTR(-EINVAL); ring = kzalloc(sizeof(*ring), GFP_KERNEL); if (!ring) { ret = -ENOMEM; goto fail; } ring->gpu = gpu; ring->bo = msm_gem_new(gpu->dev, size, MSM_BO_WC); if (IS_ERR(ring->bo)) { ret = PTR_ERR(ring->bo); ring->bo = NULL; goto fail; } ring->start = msm_gem_get_vaddr_locked(ring->bo); if (IS_ERR(ring->start)) { ret = PTR_ERR(ring->start); goto fail; } ring->end = ring->start + (size / 4); ring->cur = ring->start; ring->size = size; return ring; fail: if (ring) msm_ringbuffer_destroy(ring); return ERR_PTR(ret); } void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) { if (ring->bo) { msm_gem_put_vaddr(ring->bo); drm_gem_object_unreference_unlocked(ring->bo); } kfree(ring); }
#ifndef PACK_REVINDEX_H #define PACK_REVINDEX_H struct revindex_entry { off_t offset; unsigned int nr; }; struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs); void discard_revindex(void); #endif
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QSLIDER_H #define QSLIDER_H #include <QtWidgets/qabstractslider.h> QT_BEGIN_NAMESPACE #ifndef QT_NO_SLIDER class QSliderPrivate; class QStyleOptionSlider; class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider { Q_OBJECT Q_ENUMS(TickPosition) Q_PROPERTY(TickPosition tickPosition READ tickPosition WRITE setTickPosition) Q_PROPERTY(int tickInterval READ tickInterval WRITE setTickInterval) public: enum TickPosition { NoTicks = 0, TicksAbove = 1, TicksLeft = TicksAbove, TicksBelow = 2, TicksRight = TicksBelow, TicksBothSides = 3 }; explicit QSlider(QWidget *parent = 0); explicit QSlider(Qt::Orientation orientation, QWidget *parent = 0); ~QSlider(); QSize sizeHint() const; QSize minimumSizeHint() const; void setTickPosition(TickPosition position); TickPosition tickPosition() const; void setTickInterval(int ti); int tickInterval() const; bool event(QEvent *event); protected: void paintEvent(QPaintEvent *ev); void mousePressEvent(QMouseEvent *ev); void mouseReleaseEvent(QMouseEvent *ev); void mouseMoveEvent(QMouseEvent *ev); void initStyleOption(QStyleOptionSlider *option) const; private: friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider); Q_DISABLE_COPY(QSlider) Q_DECLARE_PRIVATE(QSlider) }; #endif // QT_NO_SLIDER QT_END_NAMESPACE #endif // QSLIDER_H
/* * Copyright (C) 2008 IBM Corporation * * Authors: * Mimi Zohar <zohar@us.ibm.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2 of the * License. * * File: integrity_iint.c * - implements the integrity hooks: integrity_inode_alloc, * integrity_inode_free * - cache integrity information associated with an inode * using a rbtree tree. */ #include <linux/slab.h> #include <linux/module.h> #include <linux/spinlock.h> #include <linux/rbtree.h> #include "integrity.h" static struct rb_root integrity_iint_tree = RB_ROOT; static DEFINE_SPINLOCK(integrity_iint_lock); static struct kmem_cache *iint_cache __read_mostly; int iint_initialized; /* * __integrity_iint_find - return the iint associated with an inode */ static struct integrity_iint_cache *__integrity_iint_find(struct inode *inode) { struct integrity_iint_cache *iint; struct rb_node *n = integrity_iint_tree.rb_node; assert_spin_locked(&integrity_iint_lock); while (n) { iint = rb_entry(n, struct integrity_iint_cache, rb_node); if (inode < iint->inode) n = n->rb_left; else if (inode > iint->inode) n = n->rb_right; else break; } if (!n) return NULL; return iint; } /* * integrity_iint_find - return the iint associated with an inode */ struct integrity_iint_cache *integrity_iint_find(struct inode *inode) { struct integrity_iint_cache *iint; if (!IS_IMA(inode)) return NULL; spin_lock(&integrity_iint_lock); iint = __integrity_iint_find(inode); spin_unlock(&integrity_iint_lock); return iint; } static void iint_free(struct integrity_iint_cache *iint) { iint->version = 0; iint->flags = 0UL; iint->evm_status = INTEGRITY_UNKNOWN; kmem_cache_free(iint_cache, iint); } /** * integrity_inode_alloc - allocate an iint associated with an inode * @inode: pointer to the inode */ int integrity_inode_alloc(struct inode *inode) { struct rb_node **p; struct rb_node *new_node, *parent = NULL; struct integrity_iint_cache *new_iint, *test_iint; int rc; new_iint = kmem_cache_alloc(iint_cache, GFP_NOFS); if (!new_iint) return -ENOMEM; new_iint->inode = inode; new_node = &new_iint->rb_node; mutex_lock(&inode->i_mutex); /* i_flags */ spin_lock(&integrity_iint_lock); p = &integrity_iint_tree.rb_node; while (*p) { parent = *p; test_iint = rb_entry(parent, struct integrity_iint_cache, rb_node); rc = -EEXIST; if (inode < test_iint->inode) p = &(*p)->rb_left; else if (inode > test_iint->inode) p = &(*p)->rb_right; else goto out_err; } inode->i_flags |= S_IMA; rb_link_node(new_node, parent, p); rb_insert_color(new_node, &integrity_iint_tree); spin_unlock(&integrity_iint_lock); mutex_unlock(&inode->i_mutex); /* i_flags */ return 0; out_err: spin_unlock(&integrity_iint_lock); mutex_unlock(&inode->i_mutex); /* i_flags */ iint_free(new_iint); return rc; } /** * integrity_inode_free - called on security_inode_free * @inode: pointer to the inode * * Free the integrity information(iint) associated with an inode. */ void integrity_inode_free(struct inode *inode) { struct integrity_iint_cache *iint; if (!IS_IMA(inode)) return; spin_lock(&integrity_iint_lock); iint = __integrity_iint_find(inode); rb_erase(&iint->rb_node, &integrity_iint_tree); spin_unlock(&integrity_iint_lock); iint_free(iint); } static void init_once(void *foo) { struct integrity_iint_cache *iint = foo; memset(iint, 0, sizeof *iint); iint->version = 0; iint->flags = 0UL; mutex_init(&iint->mutex); iint->evm_status = INTEGRITY_UNKNOWN; } static int __init integrity_iintcache_init(void) { iint_cache = kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache), 0, SLAB_PANIC, init_once); iint_initialized = 1; return 0; } security_initcall(integrity_iintcache_init);
#ifndef _POWERPC_XMON_DIS_ASM_H #define _POWERPC_XMON_DIS_ASM_H /* * Copyright (C) 2006 Michael Ellerman, 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. */ extern void print_address (unsigned long memaddr); #ifdef CONFIG_XMON_DISASSEMBLY extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); extern int print_insn_spu(unsigned long insn, unsigned long memaddr); #else static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return 0; } static inline int print_insn_spu(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return 0; } #endif #endif /* _POWERPC_XMON_DIS_ASM_H */
void foo(int n) { typedef struct { int value; } myint; struct S { int i[n]; unsigned int b:1; myint mi; } __attribute__ ((packed)) __attribute__ ((aligned (4))); struct S s[2]; int k; for (k = 0; k < 2; k ++) s[k].mi.value = 0; } int main () { foo (2); return 0; }
#pragma once #define STRICT #define NTDDI_VERSION NTDDI_WIN2K #define _WIN32_WINNT 0x0500 #define WINVER 0x0500 #define _WIN32_IE 0x0600 #define WIN32_LEAN_AND_MEAN #define NOCOMM #define NOKANJI #define NOHELP #define NOMCX #define NOCLIPBOARD #define NOCOLOR #define NONLS #define NOMEMMGR #define NOMETAFILE #define NOOPENFILE #define NOSERVICE #define NOSOUND #define NOTEXTMETRIC #define _CRT_SECURE_NO_WARNINGS #define _CRT_NONSTDC_NO_WARNINGS #include <io.h> #include <Windows.h> #include <WinSock2.h> #include <In6addr.h> #include <Ws2tcpip.h> #include <Mswsock.h> #include <MMSystem.h>
/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */ /* Configuration defines for installed libtiff. This file maintained for backward compatibility. Do not use definitions from this file in your programs. */ #ifndef _TIFFCONF_ #define _TIFFCONF_ /* Signed 16-bit type */ #define TIFF_INT16_T signed short /* Signed 32-bit type */ #define TIFF_INT32_T signed int /* Signed 64-bit type */ #define TIFF_INT64_T signed long long /* Signed 8-bit type */ #define TIFF_INT8_T signed char /* Unsigned 16-bit type */ #define TIFF_UINT16_T unsigned short /* Unsigned 32-bit type */ #define TIFF_UINT32_T unsigned int /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned long long /* Unsigned 8-bit type */ #define TIFF_UINT8_T unsigned char /* Signed size type */ #define TIFF_SSIZE_T signed long /* Pointer difference type */ #define TIFF_PTRDIFF_T ptrdiff_t /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Compatibility stuff. */ /* Define as 0 or 1 according to the floating point format suported by the machine */ #define HAVE_IEEEFP 1 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ #define JPEG_SUPPORT 1 /* Support JBIG compression (requires JBIG-KIT library) */ /* #undef JBIG_SUPPORT */ /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ #define OJPEG_SUPPORT 1 /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support MS MDI magic number files as TIFF */ #define MDI_SUPPORT 1 /* * Feature support definitions. * XXX: These macros are obsoleted. Don't use them in your apps! * Macros stays here for backward compatibility and should be always defined. */ #define COLORIMETRY_SUPPORT #define YCBCR_SUPPORT #define CMYK_SUPPORT #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT #endif /* _TIFFCONF_ */
/* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _DT_BINDINGS_CLK_MSM_MMCC_8960_H #define _DT_BINDINGS_CLK_MSM_MMCC_8960_H #define MMSS_AHB_SRC 0 #define FAB_AHB_CLK 1 #define APU_AHB_CLK 2 #define TV_ENC_AHB_CLK 3 #define AMP_AHB_CLK 4 #define DSI2_S_AHB_CLK 5 #define JPEGD_AHB_CLK 6 #define GFX2D0_AHB_CLK 7 #define DSI_S_AHB_CLK 8 #define DSI2_M_AHB_CLK 9 #define VPE_AHB_CLK 10 #define SMMU_AHB_CLK 11 #define HDMI_M_AHB_CLK 12 #define VFE_AHB_CLK 13 #define ROT_AHB_CLK 14 #define VCODEC_AHB_CLK 15 #define MDP_AHB_CLK 16 #define DSI_M_AHB_CLK 17 #define CSI_AHB_CLK 18 #define MMSS_IMEM_AHB_CLK 19 #define IJPEG_AHB_CLK 20 #define HDMI_S_AHB_CLK 21 #define GFX3D_AHB_CLK 22 #define GFX2D1_AHB_CLK 23 #define MMSS_FPB_CLK 24 #define MMSS_AXI_SRC 25 #define MMSS_FAB_CORE 26 #define FAB_MSP_AXI_CLK 27 #define JPEGD_AXI_CLK 28 #define GMEM_AXI_CLK 29 #define MDP_AXI_CLK 30 #define MMSS_IMEM_AXI_CLK 31 #define IJPEG_AXI_CLK 32 #define GFX3D_AXI_CLK 33 #define VCODEC_AXI_CLK 34 #define VFE_AXI_CLK 35 #define VPE_AXI_CLK 36 #define ROT_AXI_CLK 37 #define VCODEC_AXI_A_CLK 38 #define VCODEC_AXI_B_CLK 39 #define MM_AXI_S3_FCLK 40 #define MM_AXI_S2_FCLK 41 #define MM_AXI_S1_FCLK 42 #define MM_AXI_S0_FCLK 43 #define MM_AXI_S2_CLK 44 #define MM_AXI_S1_CLK 45 #define MM_AXI_S0_CLK 46 #define CSI0_SRC 47 #define CSI0_CLK 48 #define CSI0_PHY_CLK 49 #define CSI1_SRC 50 #define CSI1_CLK 51 #define CSI1_PHY_CLK 52 #define CSI2_SRC 53 #define CSI2_CLK 54 #define CSI2_PHY_CLK 55 #define DSI_SRC 56 #define DSI_CLK 57 #define CSI_PIX_CLK 58 #define CSI_RDI_CLK 59 #define MDP_VSYNC_CLK 60 #define HDMI_DIV_CLK 61 #define HDMI_APP_CLK 62 #define CSI_PIX1_CLK 63 #define CSI_RDI2_CLK 64 #define CSI_RDI1_CLK 65 #define GFX2D0_SRC 66 #define GFX2D0_CLK 67 #define GFX2D1_SRC 68 #define GFX2D1_CLK 69 #define GFX3D_SRC 70 #define GFX3D_CLK 71 #define IJPEG_SRC 72 #define IJPEG_CLK 73 #define JPEGD_SRC 74 #define JPEGD_CLK 75 #define MDP_SRC 76 #define MDP_CLK 77 #define MDP_LUT_CLK 78 #define DSI2_PIXEL_SRC 79 #define DSI2_PIXEL_CLK 80 #define DSI2_SRC 81 #define DSI2_CLK 82 #define DSI1_BYTE_SRC 83 #define DSI1_BYTE_CLK 84 #define DSI2_BYTE_SRC 85 #define DSI2_BYTE_CLK 86 #define DSI1_ESC_SRC 87 #define DSI1_ESC_CLK 88 #define DSI2_ESC_SRC 89 #define DSI2_ESC_CLK 90 #define ROT_SRC 91 #define ROT_CLK 92 #define TV_ENC_CLK 93 #define TV_DAC_CLK 94 #define HDMI_TV_CLK 95 #define MDP_TV_CLK 96 #define TV_SRC 97 #define VCODEC_SRC 98 #define VCODEC_CLK 99 #define VFE_SRC 100 #define VFE_CLK 101 #define VFE_CSI_CLK 102 #define VPE_SRC 103 #define VPE_CLK 104 #define DSI_PIXEL_SRC 105 #define DSI_PIXEL_CLK 106 #define CAMCLK0_SRC 107 #define CAMCLK0_CLK 108 #define CAMCLK1_SRC 109 #define CAMCLK1_CLK 110 #define CAMCLK2_SRC 111 #define CAMCLK2_CLK 112 #define CSIPHYTIMER_SRC 113 #define CSIPHY2_TIMER_CLK 114 #define CSIPHY1_TIMER_CLK 115 #define CSIPHY0_TIMER_CLK 116 #define PLL1 117 #define PLL2 118 #endif
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ //BEGIN_INCLUDE(all) #include <jni.h> #include <errno.h> #include <dlfcn.h> #include <stdlib.h> #include <android/log.h> #include <android_native_app_glue.h> #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "servo-wrapper", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "servo-wrapper", __VA_ARGS__)) /** * This is the main entry point of a native application that is using * android_native_app_glue. It runs in its own thread, with its own * event loop for receiving input events and doing other things. */ void android_main(struct android_app* state) { LOGI("in android_main"); void* libservo = dlopen("libservo.so", RTLD_NOW); if (libservo == NULL) { LOGI("failed to load servo lib: %s", dlerror()); return; } LOGI("loaded libservo.so"); void (*android_main)(struct android_app*); *(void**)(&android_main) = dlsym(libservo, "android_main"); if (android_main) { LOGI("go into android_main()"); (*android_main)(state); return; } } //END_INCLUDE(all) int main(int argc, char* argv[]) { LOGI("WAT"); return 0; }
/* * 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 file contains NUMA specific variables and functions which can * be split away from DISCONTIGMEM and are used on NUMA machines with * contiguous memory. * * 2002/08/07 Erich Focht <efocht@ess.nec.de> */ #include <linux/cpu.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/node.h> #include <linux/init.h> #include <linux/bootmem.h> #include <linux/module.h> #include <asm/mmzone.h> #include <asm/numa.h> /* * The following structures are usually initialized by ACPI or * similar mechanisms and describe the NUMA characteristics of the machine. */ int num_node_memblks; struct node_memblk_s node_memblk[NR_NODE_MEMBLKS]; struct node_cpuid_s node_cpuid[NR_CPUS] = { [0 ... NR_CPUS-1] = { .phys_id = 0, .nid = NUMA_NO_NODE } }; /* * This is a matrix with "distances" between nodes, they should be * proportional to the memory access latency ratios. */ u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES]; /* Identify which cnode a physical address resides on */ int paddr_to_nid(unsigned long paddr) { int i; for (i = 0; i < num_node_memblks; i++) if (paddr >= node_memblk[i].start_paddr && paddr < node_memblk[i].start_paddr + node_memblk[i].size) break; return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0); } #if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA) /* * Because of holes evaluate on section limits. * If the section of memory exists, then return the node where the section * resides. Otherwise return node 0 as the default. This is used by * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where * the section resides. */ int __meminit __early_pfn_to_nid(unsigned long pfn) { int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec; /* * NOTE: The following SMP-unsafe globals are only used early in boot * when the kernel is running single-threaded. */ static int __meminitdata last_ssec, last_esec; static int __meminitdata last_nid; if (section >= last_ssec && section < last_esec) return last_nid; for (i = 0; i < num_node_memblks; i++) { ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT; esec = (node_memblk[i].start_paddr + node_memblk[i].size + ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT; if (section >= ssec && section < esec) { last_ssec = ssec; last_esec = esec; last_nid = node_memblk[i].nid; return node_memblk[i].nid; } } return -1; } void __cpuinit numa_clear_node(int cpu) { unmap_cpu_from_node(cpu, NUMA_NO_NODE); } #ifdef CONFIG_MEMORY_HOTPLUG /* * SRAT information is stored in node_memblk[], then we can use SRAT * information at memory-hot-add if necessary. */ int memory_add_physaddr_to_nid(u64 addr) { int nid = paddr_to_nid(addr); if (nid < 0) return 0; return nid; } EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); #endif #endif
/* * Copyright 2014 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. * */ #ifndef __GFX_V7_0_H__ #define __GFX_V7_0_H__ extern const struct amdgpu_ip_block_version gfx_v7_1_ip_block; extern const struct amdgpu_ip_block_version gfx_v7_2_ip_block; extern const struct amdgpu_ip_block_version gfx_v7_3_ip_block; struct amdgpu_device; struct cik_mqd; int gfx_v7_0_mqd_commit(struct amdgpu_device *adev, struct cik_mqd *mqd); #endif
/* * arch/ubicom32/mach-common/usb_tio.h * Definitions for usb_tio.c * * (C) Copyright 2009, Ubicom, Inc. * * This file is part of the Ubicom32 Linux Kernel Port. * * The Ubicom32 Linux Kernel Port 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. * * The Ubicom32 Linux Kernel Port 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 the Ubicom32 Linux Kernel Port. If not, * see <http://www.gnu.org/licenses/>. * * Ubicom32 implementation derived from (with many thanks): * arch/m68knommu * arch/blackfin * arch/parisc */ #include <linux/version.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/errno.h> #include <linux/err.h> #include <asm/devtree.h> #include <asm/ip5000.h> #ifndef _USB_TIO_H #define _USB_TIO_H #undef USB_TIO_DEBUG #define USB_TIO_REQUEST_MAGIC1 0x2307 #define USB_TIO_REQUEST_MAGIC2 0x0789 #if defined(USB_TIO_DEBUG) #define USB_TIO_REQUEST_VERIFY_MAGIC(req) usb_tio_request_verify_magic(req) #define USB_TIO_REQUEST_SET_MAGIC(req) usb_tio_request_set_magic(req) #define USB_TIO_REQUEST_CLEAR_MAGIC(req) usb_tio_request_clear_magic(req) #else #define USB_TIO_REQUEST_VERIFY_MAGIC(req) #define USB_TIO_REQUEST_SET_MAGIC(req) usb_tio_request_set_magic(req) #define USB_TIO_REQUEST_CLEAR_MAGIC(req) #endif enum USB_TIO_status { USB_TIO_OK, USB_TIO_ERROR, USB_TIO_ERROR_COMMIT, }; enum USB_TIO_cmds { USB_TIO_READ16_SYNC, USB_TIO_READ8_SYNC, USB_TIO_READ_FIFO_SYNC, USB_TIO_WRITE16_ASYNC, USB_TIO_WRITE8_ASYNC, USB_TIO_WRITE_FIFO_ASYNC, USB_TIO_WRITE16_SYNC, USB_TIO_WRITE8_SYNC, USB_TIO_WRITE_FIFO_SYNC, }; enum USB_TIO_state { USB_TIO_NORMAL, USB_TIO_DMA_SETUP, }; struct usb_tio_request { volatile u32_t address; union { volatile u32_t data; volatile u32_t buffer; }; volatile u16_t cmd; const volatile u16_t status; volatile u32_t transfer_length; volatile u32_t thread_mask; volatile u16_t magic; }; struct usbtio_node { struct devtree_node dn; volatile struct usb_tio_request * volatile pdesc; struct usb_tio_request request; volatile u32_t usb_vp_config; volatile u32_t usb_vp_control; const volatile u32_t usb_vp_status; volatile u16_t usb_vp_hw_int_tx; volatile u16_t usb_vp_hw_int_rx; volatile u8_t usb_vp_hw_int_usb; volatile u8_t usb_vp_hw_int_mask_usb; volatile u16_t usb_vp_hw_int_mask_tx; volatile u16_t usb_vp_hw_int_mask_rx; }; extern struct usbtio_node *usb_node; extern void ubi32_usb_init(void); #endif
/* * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ #ifndef WLAN_QCT_MSG_MAP_H #define WLAN_QCT_MSG_MAP_H /*=========================================================================== W L A N DEVICE ADAPTATION L A Y E R MSG MAPPING DESCRIPTION This file contains the external API exposed by the wlan adaptation layer Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved. Qualcomm Confidential and Proprietary ===========================================================================*/ /*=========================================================================== EDIT HISTORY FOR FILE This section contains comments describing changes made to the module. Notice that changes are listed in reverse chronological order. $Header:$ $DateTime: $ $Author: $ when who what, where, why -------- --- ---------------------------------------------- 25/08/2010 adwivedi MAP WDA messages on Legacy HAL messages =========================================================================== */ /* Add Include */ #include "wlan_qct_pack_align.h" #define WDA_CONFIG_PARAM_UPDATE_REQ SIR_CFG_PARAM_UPDATE_IND #define ALIGNED_WORD_SIZE 4 /* Config format required by HAL for each CFG item*/ WPT_PACK_START typedef WPT_PACK_PRE struct { /* Cfg Id. The Id required by HAL is exported by HAL * in shared header file between UMAC and HAL.*/ tANI_U16 type; /* Length of the Cfg. This parameter is used to go to next cfg * in the TLV format.*/ tANI_U16 length; /* Padding bytes for unaligned address's */ tANI_U16 padBytes; /* Reserve bytes for making cfgVal to align address */ tANI_U16 reserved; /* Following the uCfgLen field there should be a 'uCfgLen' bytes * containing the uCfgValue ; tANI_U8 uCfgValue[uCfgLen] */ }WPT_PACK_POST tHalCfg, *tpHalCfg; WPT_PACK_END /////#define WDA_UT #ifdef WDA_UT #define WDA_WDI_EVENT_MSG 0x00FF void WDI_processEvent(void *wdiEventData, void *pUserData); #endif #endif
/* * Copyright (C) 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WKRenderObject_h #define WKRenderObject_h #include <WebKit2/WKBase.h> #include <WebKit2/WKGeometry.h> #ifdef __cplusplus extern "C" { #endif WK_EXPORT WKTypeID WKRenderObjectGetTypeID(); WK_EXPORT WKStringRef WKRenderObjectCopyName(WKRenderObjectRef renderObject); WK_EXPORT WKStringRef WKRenderObjectCopyElementTagName(WKRenderObjectRef renderObject); WK_EXPORT WKStringRef WKRenderObjectCopyElementID(WKRenderObjectRef renderObject); WK_EXPORT WKArrayRef WKRenderObjectGetElementClassNames(WKRenderObjectRef renderObject); WK_EXPORT WKPoint WKRenderObjectGetAbsolutePosition(WKRenderObjectRef renderObject); WK_EXPORT WKRect WKRenderObjectGetFrameRect(WKRenderObjectRef renderObject); WK_EXPORT WKArrayRef WKRenderObjectGetChildren(WKRenderObjectRef renderObject); #ifdef __cplusplus } #endif #endif // WKRenderObject_h
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef OPT_EXPLAIN_FORMAT_JSON_INCLUDED #define OPT_EXPLAIN_FORMAT_JSON_INCLUDED #include "opt_explain_format.h" namespace opt_explain_json_namespace { class context; } /** Formatter class for EXPLAIN FORMAT=JSON output */ class Explain_format_JSON : public Explain_format { private: opt_explain_json_namespace::context *current_context; ///< current tree node select_result *output; public: Explain_format_JSON() : current_context(NULL), output(NULL) {} virtual bool is_hierarchical() const { return true; } virtual bool send_headers(select_result *result); virtual bool begin_context(Explain_context_enum context, SELECT_LEX_UNIT *subquery, const Explain_format_flags *flags); virtual bool end_context(Explain_context_enum context); virtual bool flush_entry() { return false; } virtual qep_row *entry(); }; #endif//OPT_EXPLAIN_FORMAT_JSON_INCLUDED
/////////////////////////////////////////////////////////////////////////////// // Name: wx/textwrapper.h // Purpose: declaration of wxTextWrapper class // Author: Vadim Zeitlin // Created: 2009-05-31 (extracted from dlgcmn.cpp via wx/private/stattext.h) // Copyright: (c) 1999, 2009 Vadim Zeitlin <vadim@wxwidgets.org> // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifndef _WX_TEXTWRAPPER_H_ #define _WX_TEXTWRAPPER_H_ #include "wx/window.h" // ---------------------------------------------------------------------------- // wxTextWrapper // ---------------------------------------------------------------------------- // this class is used to wrap the text on word boundary: wrapping is done by // calling OnStartLine() and OnOutputLine() functions class WXDLLIMPEXP_CORE wxTextWrapper { public: wxTextWrapper() { m_eol = false; } // win is used for getting the font, text is the text to wrap, width is the // max line width or -1 to disable wrapping void Wrap(wxWindow *win, const wxString& text, int widthMax); // we don't need it, but just to avoid compiler warnings virtual ~wxTextWrapper() { } protected: // line may be empty virtual void OnOutputLine(const wxString& line) = 0; // called at the start of every new line (except the very first one) virtual void OnNewLine() { } private: // call OnOutputLine() and set m_eol to true void DoOutputLine(const wxString& line) { OnOutputLine(line); m_eol = true; } // this function is a destructive inspector: when it returns true it also // resets the flag to false so calling it again wouldn't return true any // more bool IsStartOfNewLine() { if ( !m_eol ) return false; m_eol = false; return true; } bool m_eol; wxDECLARE_NO_COPY_CLASS(wxTextWrapper); }; #if wxUSE_STATTEXT #include "wx/sizer.h" #include "wx/stattext.h" // A class creating a sizer with one static text per line of text. Creation of // the controls used for each line can be customized by overriding // OnCreateLine() function. // // This class is currently private to wxWidgets and used only by wxDialog // itself. We may make it public later if there is sufficient interest. class wxTextSizerWrapper : public wxTextWrapper { public: wxTextSizerWrapper(wxWindow *win) { m_win = win; m_hLine = 0; } wxSizer *CreateSizer(const wxString& text, int widthMax) { m_sizer = new wxBoxSizer(wxVERTICAL); Wrap(m_win, text, widthMax); return m_sizer; } wxWindow *GetParent() const { return m_win; } protected: virtual wxWindow *OnCreateLine(const wxString& line) { return new wxStaticText(m_win, wxID_ANY, wxControl::EscapeMnemonics(line)); } virtual void OnOutputLine(const wxString& line) { if ( !line.empty() ) { m_sizer->Add(OnCreateLine(line)); } else // empty line, no need to create a control for it { if ( !m_hLine ) m_hLine = m_win->GetCharHeight(); m_sizer->Add(5, m_hLine); } } private: wxWindow *m_win; wxSizer *m_sizer; int m_hLine; }; #endif // wxUSE_STATTEXT #endif // _WX_TEXTWRAPPER_H_
/* * Copyright (C) 2010, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef AudioBasicProcessorNode_h #define AudioBasicProcessorNode_h #include "AudioNode.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/Threading.h> namespace WebCore { class AudioBus; class AudioNodeInput; class AudioProcessor; // AudioBasicProcessorNode is an AudioNode with one input and one output where the input and output have the same number of channels. class AudioBasicProcessorNode : public AudioNode { public: AudioBasicProcessorNode(AudioContext*, float sampleRate); // AudioNode virtual void process(size_t framesToProcess); virtual void pullInputs(size_t framesToProcess); virtual void reset(); virtual void initialize(); virtual void uninitialize(); // Called in the main thread when the number of channels for the input may have changed. virtual void checkNumberOfChannelsForInput(AudioNodeInput*); // Returns the number of channels for both the input and the output. unsigned numberOfChannels(); protected: virtual double tailTime() const OVERRIDE; virtual double latencyTime() const OVERRIDE; AudioProcessor* processor() { return m_processor.get(); } OwnPtr<AudioProcessor> m_processor; }; } // namespace WebCore #endif // AudioBasicProcessorNode_h
/* * Copyright (C) 2011 Instituto Nokia de Tecnologia * * Authors: * Lauro Ramos Venancio <lauro.venancio@openbossa.org> * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the * Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LOCAL_NFC_H #define __LOCAL_NFC_H #include <net/nfc/nfc.h> #include <net/sock.h> struct nfc_protocol { int id; struct proto *proto; struct module *owner; int (*create)(struct net *net, struct socket *sock, const struct nfc_protocol *nfc_proto); }; struct nfc_rawsock { struct sock sk; struct nfc_dev *dev; u32 target_idx; struct work_struct tx_work; bool tx_work_scheduled; }; #define nfc_rawsock(sk) ((struct nfc_rawsock *) sk) #define to_rawsock_sk(_tx_work) \ ((struct sock *) container_of(_tx_work, struct nfc_rawsock, tx_work)) #ifdef CONFIG_NFC_LLCP void nfc_llcp_mac_is_down(struct nfc_dev *dev); void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, u8 comm_mode, u8 rf_mode); int nfc_llcp_register_device(struct nfc_dev *dev); void nfc_llcp_unregister_device(struct nfc_dev *dev); int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len); u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *general_bytes_len); int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb); int __init nfc_llcp_init(void); void nfc_llcp_exit(void); #else static inline void nfc_llcp_mac_is_down(struct nfc_dev *dev) { } static inline void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, u8 comm_mode, u8 rf_mode) { } static inline int nfc_llcp_register_device(struct nfc_dev *dev) { return 0; } static inline void nfc_llcp_unregister_device(struct nfc_dev *dev) { } static inline int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) { return 0; } static inline u8 *nfc_llcp_general_bytes(struct nfc_dev *dev, size_t *gb_len) { *gb_len = 0; return NULL; } static inline int nfc_llcp_data_received(struct nfc_dev *dev, struct sk_buff *skb) { return 0; } static inline int nfc_llcp_init(void) { return 0; } static inline void nfc_llcp_exit(void) { } #endif int __init rawsock_init(void); void rawsock_exit(void); int __init af_nfc_init(void); void af_nfc_exit(void); int nfc_proto_register(const struct nfc_protocol *nfc_proto); void nfc_proto_unregister(const struct nfc_protocol *nfc_proto); extern int nfc_devlist_generation; extern struct mutex nfc_devlist_mutex; int __init nfc_genl_init(void); void nfc_genl_exit(void); void nfc_genl_data_init(struct nfc_genl_data *genl_data); void nfc_genl_data_exit(struct nfc_genl_data *genl_data); int nfc_genl_targets_found(struct nfc_dev *dev); int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx); int nfc_genl_device_added(struct nfc_dev *dev); int nfc_genl_device_removed(struct nfc_dev *dev); int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx, u8 comm_mode, u8 rf_mode); int nfc_genl_dep_link_down_event(struct nfc_dev *dev); int nfc_genl_tm_activated(struct nfc_dev *dev, u32 protocol); int nfc_genl_tm_deactivated(struct nfc_dev *dev); struct nfc_dev *nfc_get_device(unsigned int idx); static inline void nfc_put_device(struct nfc_dev *dev) { put_device(&dev->dev); } static inline void nfc_device_iter_init(struct class_dev_iter *iter) { class_dev_iter_init(iter, &nfc_class, NULL, NULL); } static inline struct nfc_dev *nfc_device_iter_next(struct class_dev_iter *iter) { struct device *d = class_dev_iter_next(iter); if (!d) return NULL; return to_nfc_dev(d); } static inline void nfc_device_iter_exit(struct class_dev_iter *iter) { class_dev_iter_exit(iter); } int nfc_dev_up(struct nfc_dev *dev); int nfc_dev_down(struct nfc_dev *dev); int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols); int nfc_stop_poll(struct nfc_dev *dev); int nfc_dep_link_up(struct nfc_dev *dev, int target_idx, u8 comm_mode); int nfc_dep_link_down(struct nfc_dev *dev); int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol); int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx); int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb, data_exchange_cb_t cb, void *cb_context); #endif /* __LOCAL_NFC_H */
/* * I2S MEMS microphone driver for InvenSense ICS-43432 * * - Non configurable. * - I2S interface, 64 BCLs per frame, 32 bits per channel, 24 bit data * * Copyright (c) 2015 Axis Communications AB * * Licensed under GPL v2. */ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <sound/initval.h> #include <sound/tlv.h> #define ICS43432_RATE_MIN 7190 /* Hz, from data sheet */ #define ICS43432_RATE_MAX 52800 /* Hz, from data sheet */ #define ICS43432_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32) static struct snd_soc_dai_driver ics43432_dai = { .name = "ics43432-hifi", .capture = { .stream_name = "Capture", .channels_min = 1, .channels_max = 2, .rate_min = ICS43432_RATE_MIN, .rate_max = ICS43432_RATE_MAX, .rates = SNDRV_PCM_RATE_CONTINUOUS, .formats = ICS43432_FORMATS, }, }; static const struct snd_soc_component_driver ics43432_component_driver = { .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static int ics43432_probe(struct platform_device *pdev) { return devm_snd_soc_register_component(&pdev->dev, &ics43432_component_driver, &ics43432_dai, 1); } #ifdef CONFIG_OF static const struct of_device_id ics43432_ids[] = { { .compatible = "invensense,ics43432", }, { } }; MODULE_DEVICE_TABLE(of, ics43432_ids); #endif static struct platform_driver ics43432_driver = { .driver = { .name = "ics43432", .of_match_table = of_match_ptr(ics43432_ids), }, .probe = ics43432_probe, }; module_platform_driver(ics43432_driver); MODULE_DESCRIPTION("ASoC ICS43432 driver"); MODULE_AUTHOR("Ricard Wanderlof <ricardw@axis.com>"); MODULE_LICENSE("GPL v2");
/* mbed Microcontroller Library * Copyright (c) 2006-2013 ARM Limited * * 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 MBED_PERIPHERALNAMES_H #define MBED_PERIPHERALNAMES_H #include "cmsis.h" #ifdef __cplusplus extern "C" { #endif typedef enum { ADC0_0 = 0, ADC0_1, ADC0_2, ADC0_3, ADC0_4, ADC0_5, ADC0_6, ADC0_7, ADC0_8, ADC0_9, ADC0_10, ADC0_11, ADC1_0, ADC1_1, ADC1_2, ADC1_3, ADC1_4, ADC1_5, ADC1_6, ADC1_7, ADC1_8, ADC1_9, ADC1_10, ADC1_11, } ADCName; typedef enum { DAC0_0 = 0, } DACName; #ifdef __cplusplus } #endif #endif
/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __DEVICE_EVENT_H #define __DEVICE_EVENT_H #define QC_AUDIO_EXTERNAL_SPK_1_EVENT "qc_ext_spk_1" #define QC_AUDIO_EXTERNAL_SPK_2_EVENT "qc_ext_spk_2" #define QC_AUDIO_EXTERNAL_MIC_EVENT "qc_ext_mic" #endif /* __DEVICE_EVENT_H */
#include <stdio.h> #include <assert.h> #include <linux/bpf.h> #include "libbpf.h" #include "bpf_load.h" #include <unistd.h> #include <arpa/inet.h> #include <sys/resource.h> struct pair { __u64 packets; __u64 bytes; }; int main(int ac, char **argv) { struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; char filename[256]; FILE *f; int i, sock; snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]); setrlimit(RLIMIT_MEMLOCK, &r); if (load_bpf_file(filename)) { printf("%s", bpf_log_buf); return 1; } sock = open_raw_sock("lo"); assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, sizeof(prog_fd[0])) == 0); f = popen("ping -c5 localhost", "r"); (void) f; for (i = 0; i < 5; i++) { int key = 0, next_key; struct pair value; while (bpf_get_next_key(map_fd[0], &key, &next_key) == 0) { bpf_lookup_elem(map_fd[0], &next_key, &value); printf("ip %s bytes %lld packets %lld\n", inet_ntoa((struct in_addr){htonl(next_key)}), value.bytes, value.packets); key = next_key; } sleep(1); } return 0; }
/* * module/8255.h * Header file for 8255 * * COMEDI - Linux Control and Measurement Device Interface * Copyright (C) 1998 David A. Schleef <ds@schleef.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef _8255_H #define _8255_H #define I8255_SIZE 0x04 #define I8255_DATA_A_REG 0x00 #define I8255_DATA_B_REG 0x01 #define I8255_DATA_C_REG 0x02 #define I8255_CTRL_REG 0x03 #define I8255_CTRL_C_LO_IO (1 << 0) #define I8255_CTRL_B_IO (1 << 1) #define I8255_CTRL_B_MODE (1 << 2) #define I8255_CTRL_C_HI_IO (1 << 3) #define I8255_CTRL_A_IO (1 << 4) #define I8255_CTRL_A_MODE(x) ((x) << 5) #define I8255_CTRL_CW (1 << 7) struct comedi_device; struct comedi_subdevice; int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase); int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase); unsigned long subdev_8255_regbase(struct comedi_subdevice *s); #endif
#ifndef _ASM_X86_GENAPIC_64_H #define _ASM_X86_GENAPIC_64_H #include <linux/cpumask.h> /* * Copyright 2004 James Cleverdon, IBM. * Subject to the GNU Public License, v.2 * * Generic APIC sub-arch data struct. * * Hacked for x86-64 by James Cleverdon from i386 architecture code by * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and * James Cleverdon. */ struct genapic { char *name; int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); u32 int_delivery_mode; u32 int_dest_mode; int (*apic_id_registered)(void); const struct cpumask *(*target_cpus)(void); void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); void (*init_apic_ldr)(void); /* ipi */ void (*send_IPI_mask)(const struct cpumask *mask, int vector); void (*send_IPI_mask_allbutself)(const struct cpumask *mask, int vector); void (*send_IPI_allbutself)(int vector); void (*send_IPI_all)(int vector); void (*send_IPI_self)(int vector); /* */ unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask); unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask, const struct cpumask *andmask); unsigned int (*phys_pkg_id)(int index_msb); unsigned int (*get_apic_id)(unsigned long x); unsigned long (*set_apic_id)(unsigned int id); unsigned long apic_id_mask; /* wakeup_secondary_cpu */ int (*wakeup_cpu)(int apicid, unsigned long start_eip); }; extern struct genapic *genapic; extern struct genapic apic_flat; extern struct genapic apic_physflat; extern struct genapic apic_x2apic_cluster; extern struct genapic apic_x2apic_phys; extern int acpi_madt_oem_check(char *, char *); extern void apic_send_IPI_self(int vector); enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; extern enum uv_system_type get_uv_system_type(void); extern int is_uv_system(void); extern struct genapic apic_x2apic_uv_x; DECLARE_PER_CPU(int, x2apic_extra_bits); extern void uv_cpu_init(void); extern void uv_system_init(void); extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); extern void setup_apic_routing(void); #endif /* _ASM_X86_GENAPIC_64_H */
#ifndef COMPONENT_H #define COMPONENT_H #include <linux/stddef.h> struct device; struct component_ops { int (*bind)(struct device *comp, struct device *master, void *master_data); void (*unbind)(struct device *comp, struct device *master, void *master_data); }; int component_add(struct device *, const struct component_ops *); void component_del(struct device *, const struct component_ops *); int component_bind_all(struct device *master, void *master_data); void component_unbind_all(struct device *master, void *master_data); struct master; struct component_master_ops { int (*bind)(struct device *master); void (*unbind)(struct device *master); }; void component_master_del(struct device *, const struct component_master_ops *); struct component_match; int component_master_add_with_match(struct device *, const struct component_master_ops *, struct component_match *); void component_match_add_release(struct device *master, struct component_match **matchptr, void (*release)(struct device *, void *), int (*compare)(struct device *, void *), void *compare_data); static inline void component_match_add(struct device *master, struct component_match **matchptr, int (*compare)(struct device *, void *), void *compare_data) { component_match_add_release(master, matchptr, NULL, compare, compare_data); } #endif
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr> // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. /* All the parameters defined in this file can be specialized in the * architecture specific files, and/or by the user. * More to come... */ #ifndef EIGEN_DEFAULT_SETTINGS_H #define EIGEN_DEFAULT_SETTINGS_H /** Defines the maximal loop size to enable meta unrolling of loops. * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", * it does not correspond to the number of iterations or the number of instructions */ #ifndef EIGEN_UNROLLING_LIMIT #define EIGEN_UNROLLING_LIMIT 100 #endif /** Defines the threshold between a "small" and a "large" matrix. * This threshold is mainly used to select the proper product implementation. */ #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 #endif /** Defines the maximal width of the blocks used in the triangular product and solver * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. */ #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 #endif /** Defines the default number of registers available for that architecture. * Currently it must be 8 or 16. Other values will fail. */ #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 #endif #endif // EIGEN_DEFAULT_SETTINGS_H
/* * 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. * * Copyright (C) 2004 Liu Peng Infineon IFAP DC COM CPE * Copyright (C) 2010 John Crispin <blogic@openwrt.org> */ #include <linux/err.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/io.h> #include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> #include <linux/mtd/cfi.h> #include <linux/platform_device.h> #include <linux/mtd/physmap.h> #include <linux/of.h> #include <lantiq_soc.h> /* * The NOR flash is connected to the same external bus unit (EBU) as PCI. * To make PCI work we need to enable the endianness swapping for the address * written to the EBU. This endianness swapping works for PCI correctly but * fails for attached NOR devices. To workaround this we need to use a complex * map. The workaround involves swapping all addresses whilst probing the chip. * Once probing is complete we stop swapping the addresses but swizzle the * unlock addresses to ensure that access to the NOR device works correctly. */ enum { LTQ_NOR_PROBING, LTQ_NOR_NORMAL }; struct ltq_mtd { struct resource *res; struct mtd_info *mtd; struct map_info *map; }; static const char ltq_map_name[] = "ltq_nor"; static map_word ltq_read16(struct map_info *map, unsigned long adr) { unsigned long flags; map_word temp; if (map->map_priv_1 == LTQ_NOR_PROBING) adr ^= 2; spin_lock_irqsave(&ebu_lock, flags); temp.x[0] = *(u16 *)(map->virt + adr); spin_unlock_irqrestore(&ebu_lock, flags); return temp; } static void ltq_write16(struct map_info *map, map_word d, unsigned long adr) { unsigned long flags; if (map->map_priv_1 == LTQ_NOR_PROBING) adr ^= 2; spin_lock_irqsave(&ebu_lock, flags); *(u16 *)(map->virt + adr) = d.x[0]; spin_unlock_irqrestore(&ebu_lock, flags); } /* * The following 2 functions copy data between iomem and a cached memory * section. As memcpy() makes use of pre-fetching we cannot use it here. * The normal alternative of using memcpy_{to,from}io also makes use of * memcpy() on MIPS so it is not applicable either. We are therefore stuck * with having to use our own loop. */ static void ltq_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { unsigned char *f = (unsigned char *)map->virt + from; unsigned char *t = (unsigned char *)to; unsigned long flags; spin_lock_irqsave(&ebu_lock, flags); while (len--) *t++ = *f++; spin_unlock_irqrestore(&ebu_lock, flags); } static void ltq_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) { unsigned char *f = (unsigned char *)from; unsigned char *t = (unsigned char *)map->virt + to; unsigned long flags; spin_lock_irqsave(&ebu_lock, flags); while (len--) *t++ = *f++; spin_unlock_irqrestore(&ebu_lock, flags); } static int ltq_mtd_probe(struct platform_device *pdev) { struct mtd_part_parser_data ppdata; struct ltq_mtd *ltq_mtd; struct cfi_private *cfi; int err; if (of_machine_is_compatible("lantiq,falcon") && (ltq_boot_select() != BS_FLASH)) { dev_err(&pdev->dev, "invalid bootstrap options\n"); return -ENODEV; } ltq_mtd = devm_kzalloc(&pdev->dev, sizeof(struct ltq_mtd), GFP_KERNEL); if (!ltq_mtd) return -ENOMEM; platform_set_drvdata(pdev, ltq_mtd); ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!ltq_mtd->res) { dev_err(&pdev->dev, "failed to get memory resource\n"); return -ENOENT; } ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info), GFP_KERNEL); if (!ltq_mtd->map) return -ENOMEM; ltq_mtd->map->phys = ltq_mtd->res->start; ltq_mtd->map->size = resource_size(ltq_mtd->res); ltq_mtd->map->virt = devm_ioremap_resource(&pdev->dev, ltq_mtd->res); if (IS_ERR(ltq_mtd->map->virt)) return PTR_ERR(ltq_mtd->map->virt); ltq_mtd->map->name = ltq_map_name; ltq_mtd->map->bankwidth = 2; ltq_mtd->map->read = ltq_read16; ltq_mtd->map->write = ltq_write16; ltq_mtd->map->copy_from = ltq_copy_from; ltq_mtd->map->copy_to = ltq_copy_to; ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING; ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map); ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL; if (!ltq_mtd->mtd) { dev_err(&pdev->dev, "probing failed\n"); return -ENXIO; } ltq_mtd->mtd->dev.parent = &pdev->dev; cfi = ltq_mtd->map->fldrv_priv; cfi->addr_unlock1 ^= 1; cfi->addr_unlock2 ^= 1; ppdata.of_node = pdev->dev.of_node; err = mtd_device_parse_register(ltq_mtd->mtd, NULL, &ppdata, NULL, 0); if (err) { dev_err(&pdev->dev, "failed to add partitions\n"); goto err_destroy; } return 0; err_destroy: map_destroy(ltq_mtd->mtd); return err; } static int ltq_mtd_remove(struct platform_device *pdev) { struct ltq_mtd *ltq_mtd = platform_get_drvdata(pdev); if (ltq_mtd && ltq_mtd->mtd) { mtd_device_unregister(ltq_mtd->mtd); map_destroy(ltq_mtd->mtd); } return 0; } static const struct of_device_id ltq_mtd_match[] = { { .compatible = "lantiq,nor" }, {}, }; MODULE_DEVICE_TABLE(of, ltq_mtd_match); static struct platform_driver ltq_mtd_driver = { .probe = ltq_mtd_probe, .remove = ltq_mtd_remove, .driver = { .name = "ltq-nor", .of_match_table = ltq_mtd_match, }, }; module_platform_driver(ltq_mtd_driver); MODULE_LICENSE("GPL"); MODULE_AUTHOR("John Crispin <blogic@openwrt.org>"); MODULE_DESCRIPTION("Lantiq SoC NOR");
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * ******************************************************************************/ #ifndef __RTW_LED_H_ #define __RTW_LED_H_ #include <osdep_service.h> #include <drv_types.h> #define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000 #define LED_BLINK_LINK_INTERVAL_ALPHA 500 /* 500 */ #define LED_BLINK_SCAN_INTERVAL_ALPHA 180 /* 150 */ #define LED_BLINK_FASTER_INTERVAL_ALPHA 50 #define LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA 5000 enum LED_CTL_MODE { LED_CTL_POWER_ON, LED_CTL_LINK, LED_CTL_NO_LINK, LED_CTL_TX, LED_CTL_RX, LED_CTL_SITE_SURVEY, LED_CTL_POWER_OFF, LED_CTL_START_TO_LINK, LED_CTL_START_WPS, LED_CTL_STOP_WPS, LED_CTL_START_WPS_BOTTON, LED_CTL_STOP_WPS_FAIL }; enum LED_STATE_871x { LED_UNKNOWN, RTW_LED_ON, RTW_LED_OFF, LED_BLINK_NORMAL, LED_BLINK_SLOWLY, LED_BLINK_POWER_ON, LED_BLINK_SCAN, LED_BLINK_TXRX, LED_BLINK_WPS, LED_BLINK_WPS_STOP }; struct LED_871x { struct adapter *padapter; enum LED_STATE_871x CurrLedState; /* Current LED state. */ enum LED_STATE_871x BlinkingLedState; /* Next state for blinking, * either RTW_LED_ON or RTW_LED_OFF are. */ u8 bLedOn; /* true if LED is ON, false if LED is OFF. */ u8 bLedBlinkInProgress; /* true if it is blinking, false o.w.. */ u8 bLedWPSBlinkInProgress; u32 BlinkTimes; /* Number of times to toggle led state for blinking. */ struct timer_list BlinkTimer; /* Timer object for led blinking. */ /* ALPHA, added by chiyoko, 20090106 */ u8 bLedNoLinkBlinkInProgress; u8 bLedLinkBlinkInProgress; u8 bLedScanBlinkInProgress; struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to * manipulate H/W to blink LED. */ }; #define IS_LED_WPS_BLINKING(_LED_871x) \ (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS || \ ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP || \ ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress) void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction); struct led_priv { /* add for led control */ struct LED_871x SwLed0; /* add for led control */ }; void BlinkTimerCallback(unsigned long data); void BlinkWorkItemCallback(struct work_struct *work); void ResetLedStatus(struct LED_871x *pLed); void InitLed871x(struct adapter *padapter, struct LED_871x *pLed); void DeInitLed871x(struct LED_871x *pLed); /* hal... */ void BlinkHandler(struct LED_871x *pLed); void SwLedOn(struct adapter *padapter, struct LED_871x *pLed); void SwLedOff(struct adapter *padapter, struct LED_871x *pLed); #endif /* __RTW_LED_H_ */
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_CORBA_Unexpected__ #define __gnu_CORBA_Unexpected__ #pragma interface #include <java/lang/InternalError.h> extern "Java" { namespace gnu { namespace CORBA { class Unexpected; } } } class gnu::CORBA::Unexpected : public ::java::lang::InternalError { public: Unexpected(::java::lang::String *, ::java::lang::Exception *); Unexpected(::java::lang::Exception *); Unexpected(); static void error(::java::lang::String *, ::java::lang::Exception *); static void error(::java::lang::Exception *); static void error(); private: static const jlong serialVersionUID = 1LL; public: static ::java::lang::String * SHARED_MESSAGE; static ::java::lang::Class class$; }; #endif // __gnu_CORBA_Unexpected__
/************************************************************************** * * Copyright (c) 2007-2010 VMware, Inc., Palo Alto, CA., USA * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ /* * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> */ #include <drm/ttm/ttm_module.h> #include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_placement.h> #include <drm/drm_mm.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/module.h> /** * Currently we use a spinlock for the lock, but a mutex *may* be * more appropriate to reduce scheduling latency if the range manager * ends up with very fragmented allocation patterns. */ struct ttm_range_manager { struct drm_mm mm; spinlock_t lock; }; static int ttm_bo_man_get_node(struct ttm_mem_type_manager *man, struct ttm_buffer_object *bo, struct ttm_placement *placement, struct ttm_mem_reg *mem) { struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; struct drm_mm *mm = &rman->mm; struct drm_mm_node *node = NULL; unsigned long lpfn; int ret; lpfn = placement->lpfn; if (!lpfn) lpfn = man->size; node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) return -ENOMEM; spin_lock(&rman->lock); ret = drm_mm_insert_node_in_range(mm, node, mem->num_pages, mem->page_alignment, placement->fpfn, lpfn, DRM_MM_SEARCH_BEST); spin_unlock(&rman->lock); if (unlikely(ret)) { kfree(node); } else { mem->mm_node = node; mem->start = node->start; } return 0; } static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man, struct ttm_mem_reg *mem) { struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; if (mem->mm_node) { spin_lock(&rman->lock); drm_mm_remove_node(mem->mm_node); spin_unlock(&rman->lock); kfree(mem->mm_node); mem->mm_node = NULL; } } static int ttm_bo_man_init(struct ttm_mem_type_manager *man, unsigned long p_size) { struct ttm_range_manager *rman; rman = kzalloc(sizeof(*rman), GFP_KERNEL); if (!rman) return -ENOMEM; drm_mm_init(&rman->mm, 0, p_size); spin_lock_init(&rman->lock); man->priv = rman; return 0; } static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man) { struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; struct drm_mm *mm = &rman->mm; spin_lock(&rman->lock); if (drm_mm_clean(mm)) { drm_mm_takedown(mm); spin_unlock(&rman->lock); kfree(rman); man->priv = NULL; return 0; } spin_unlock(&rman->lock); return -EBUSY; } static void ttm_bo_man_debug(struct ttm_mem_type_manager *man, const char *prefix) { struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv; spin_lock(&rman->lock); drm_mm_debug_table(&rman->mm, prefix); spin_unlock(&rman->lock); } const struct ttm_mem_type_manager_func ttm_bo_manager_func = { ttm_bo_man_init, ttm_bo_man_takedown, ttm_bo_man_get_node, ttm_bo_man_put_node, ttm_bo_man_debug }; EXPORT_SYMBOL(ttm_bo_manager_func);
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_javax_swing_text_html_parser_support_low_pattern__ #define __gnu_javax_swing_text_html_parser_support_low_pattern__ #pragma interface #include <java/lang/Object.h> #include <gcj/array.h> extern "Java" { namespace gnu { namespace javax { namespace swing { namespace text { namespace html { namespace parser { namespace support { namespace low { class ReaderTokenizer; class node; class pattern; } } } } } } } } } class gnu::javax::swing::text::html::parser::support::low::pattern : public ::java::lang::Object { public: pattern(JArray< ::gnu::javax::swing::text::html::parser::support::low::node * > *); virtual jboolean matches(::gnu::javax::swing::text::html::parser::support::low::ReaderTokenizer *); JArray< ::gnu::javax::swing::text::html::parser::support::low::node * > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) nodes; static ::java::lang::Class class$; }; #endif // __gnu_javax_swing_text_html_parser_support_low_pattern__
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __gnu_javax_crypto_kwa_IKeyWrappingAlgorithm__ #define __gnu_javax_crypto_kwa_IKeyWrappingAlgorithm__ #pragma interface #include <java/lang/Object.h> #include <gcj/array.h> extern "Java" { namespace gnu { namespace javax { namespace crypto { namespace kwa { class IKeyWrappingAlgorithm; } } } } } class gnu::javax::crypto::kwa::IKeyWrappingAlgorithm : public ::java::lang::Object { public: virtual ::java::lang::String * name() = 0; virtual void init(::java::util::Map *) = 0; virtual jint wrap(JArray< jbyte > *, jint, jint, JArray< jbyte > *, jint) = 0; virtual JArray< jbyte > * wrap(JArray< jbyte > *, jint, jint) = 0; virtual jint unwrap(JArray< jbyte > *, jint, jint, JArray< jbyte > *, jint) = 0; virtual JArray< jbyte > * unwrap(JArray< jbyte > *, jint, jint) = 0; static ::java::lang::String * KEY_ENCRYPTION_KEY_MATERIAL; static ::java::lang::String * INITIAL_VALUE; static ::java::lang::String * SOURCE_OF_RANDOMNESS; static ::java::lang::Class class$; } __attribute__ ((java_interface)); #endif // __gnu_javax_crypto_kwa_IKeyWrappingAlgorithm__
// 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. // // This file declares a helper function that will check to see if a given folder // is "identical" to another (for some value of identical, see below). // #ifndef CHROME_INSTALLER_UTIL_DUPLICATE_TREE_DETECTOR_H_ #define CHROME_INSTALLER_UTIL_DUPLICATE_TREE_DETECTOR_H_ namespace base { class FilePath; } namespace installer { // Returns true if |dest_path| contains all the files from |src_path| in the // same directory structure and each of those files is of the same length. // src_path_ and |dest_path| must either both be files or both be directories. // Note that THIS IS A WEAK DEFINITION OF IDENTICAL and is intended only to // catch cases of missing files or obvious modifications. // It notably DOES NOT CHECKSUM the files. bool IsIdenticalFileHierarchy(const base::FilePath& src_path, const base::FilePath& dest_path); } // namespace installer #endif // CHROME_INSTALLER_UTIL_DUPLICATE_TREE_DETECTOR_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 CONTENT_BROWSER_HISTOGRAM_SUBSCRIBER_H_ #define CONTENT_BROWSER_HISTOGRAM_SUBSCRIBER_H_ #include <string> #include <vector> namespace content { // Objects interested in receiving histograms derive from HistogramSubscriber. class HistogramSubscriber { public: virtual ~HistogramSubscriber() {} // Send number of pending processes to subscriber. |end| is set to true if it // is the last time. This is called on the UI thread. virtual void OnPendingProcesses(int sequence_number, int pending_processes, bool end) = 0; // Send |histogram| back to subscriber. // This is called on the UI thread. virtual void OnHistogramDataCollected( int sequence_number, const std::vector<std::string>& pickled_histograms) = 0; }; } // namespace content #endif // CONTENT_BROWSER_HISTOGRAM_SUBSCRIBER_H_
// // MPOAuthCredentialStore.h // MPOAuthConnection // // Created by Karl Adam on 08.12.06. // Copyright 2008 matrixPointer. All rights reserved. // extern NSString *kMPOAuthCredentialConsumerKey; extern NSString *kMPOAuthCredentialConsumerSecret; extern NSString *kMPOAuthCredentialUsername; extern NSString *kMPOAuthCredentialPassword; extern NSString *kMPOAuthCredentialRequestToken; extern NSString *kMPOAuthCredentialRequestTokenSecret; extern NSString *kMPOAuthCredentialAccessToken; extern NSString *kMPOAuthCredentialAccessTokenSecret; extern NSString *kMPOAuthCredentialSessionHandle; extern NSString *kMPOAuthCredentialRealm; @protocol MPOAuthCredentialStore <NSObject> @property (nonatomic, readonly) NSString *consumerKey; @property (nonatomic, readonly) NSString *consumerSecret; @property (nonatomic, readonly) NSString *username; @property (nonatomic, readonly) NSString *password; @property (nonatomic, readonly, retain) NSString *requestToken; @property (nonatomic, readonly, retain) NSString *requestTokenSecret; @property (nonatomic, readonly, retain) NSString *accessToken; @property (nonatomic, readonly, retain) NSString *accessTokenSecret; - (NSString *)credentialNamed:(NSString *)inCredentialName; - (void)discardOAuthCredentials; @end
/* * linux/drivers/input/serio/ambakmi.c * * Copyright (C) 2000-2003 Deep Blue Solutions Ltd. * Copyright (C) 2002 Russell King. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include <linux/module.h> #include <linux/init.h> #include <linux/serio.h> #include <linux/errno.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/device.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/err.h> #include <linux/amba/bus.h> #include <linux/amba/kmi.h> #include <linux/clk.h> #include <asm/io.h> #include <asm/irq.h> #define KMI_BASE (kmi->base) struct amba_kmi_port { struct serio *io; struct clk *clk; void __iomem *base; unsigned int irq; unsigned int divisor; unsigned int open; }; static irqreturn_t amba_kmi_int(int irq, void *dev_id) { struct amba_kmi_port *kmi = dev_id; unsigned int status = readb(KMIIR); int handled = IRQ_NONE; while (status & KMIIR_RXINTR) { serio_interrupt(kmi->io, readb(KMIDATA), 0); status = readb(KMIIR); handled = IRQ_HANDLED; } return handled; } static int amba_kmi_write(struct serio *io, unsigned char val) { struct amba_kmi_port *kmi = io->port_data; unsigned int timeleft = 10000; /* timeout in 100ms */ while ((readb(KMISTAT) & KMISTAT_TXEMPTY) == 0 && --timeleft) udelay(10); if (timeleft) writeb(val, KMIDATA); return timeleft ? 0 : SERIO_TIMEOUT; } static int amba_kmi_open(struct serio *io) { struct amba_kmi_port *kmi = io->port_data; unsigned int divisor; int ret; ret = clk_prepare_enable(kmi->clk); if (ret) goto out; divisor = clk_get_rate(kmi->clk) / 8000000 - 1; writeb(divisor, KMICLKDIV); writeb(KMICR_EN, KMICR); ret = request_irq(kmi->irq, amba_kmi_int, 0, "kmi-pl050", kmi); if (ret) { printk(KERN_ERR "kmi: failed to claim IRQ%d\n", kmi->irq); writeb(0, KMICR); goto clk_disable; } writeb(KMICR_EN | KMICR_RXINTREN, KMICR); return 0; clk_disable: clk_disable_unprepare(kmi->clk); out: return ret; } static void amba_kmi_close(struct serio *io) { struct amba_kmi_port *kmi = io->port_data; writeb(0, KMICR); free_irq(kmi->irq, kmi); clk_disable_unprepare(kmi->clk); } static int amba_kmi_probe(struct amba_device *dev, const struct amba_id *id) { struct amba_kmi_port *kmi; struct serio *io; int ret; ret = amba_request_regions(dev, NULL); if (ret) return ret; kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); io = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!kmi || !io) { ret = -ENOMEM; goto out; } io->id.type = SERIO_8042; io->write = amba_kmi_write; io->open = amba_kmi_open; io->close = amba_kmi_close; strlcpy(io->name, dev_name(&dev->dev), sizeof(io->name)); strlcpy(io->phys, dev_name(&dev->dev), sizeof(io->phys)); io->port_data = kmi; io->dev.parent = &dev->dev; kmi->io = io; kmi->base = ioremap(dev->res.start, resource_size(&dev->res)); if (!kmi->base) { ret = -ENOMEM; goto out; } kmi->clk = clk_get(&dev->dev, "KMIREFCLK"); if (IS_ERR(kmi->clk)) { ret = PTR_ERR(kmi->clk); goto unmap; } kmi->irq = dev->irq[0]; amba_set_drvdata(dev, kmi); serio_register_port(kmi->io); return 0; unmap: iounmap(kmi->base); out: kfree(kmi); kfree(io); amba_release_regions(dev); return ret; } static int amba_kmi_remove(struct amba_device *dev) { struct amba_kmi_port *kmi = amba_get_drvdata(dev); amba_set_drvdata(dev, NULL); serio_unregister_port(kmi->io); clk_put(kmi->clk); iounmap(kmi->base); kfree(kmi); amba_release_regions(dev); return 0; } static int amba_kmi_resume(struct amba_device *dev) { struct amba_kmi_port *kmi = amba_get_drvdata(dev); /* kick the serio layer to rescan this port */ serio_reconnect(kmi->io); return 0; } static struct amba_id amba_kmi_idtable[] = { { .id = 0x00041050, .mask = 0x000fffff, }, { 0, 0 } }; MODULE_DEVICE_TABLE(amba, amba_kmi_idtable); static struct amba_driver ambakmi_driver = { .drv = { .name = "kmi-pl050", .owner = THIS_MODULE, }, .id_table = amba_kmi_idtable, .probe = amba_kmi_probe, .remove = amba_kmi_remove, .resume = amba_kmi_resume, }; module_amba_driver(ambakmi_driver); MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); MODULE_DESCRIPTION("AMBA KMI controller driver"); MODULE_LICENSE("GPL");
#ifndef __ASM_SPINLOCK_H #define __ASM_SPINLOCK_H #if __LINUX_ARM_ARCH__ < 6 #error SMP not supported on pre-ARMv6 CPUs #endif /* * ARMv6 Spin-locking. * * We exclusively read the old value. If it is zero, we may have * won the lock, so we try exclusively storing it. A memory barrier * is required after we get a lock, and before we release it, because * V6 CPUs are assumed to have weakly ordered memory. * * Unlocked value: 0 * Locked value: 1 */ #define __raw_spin_is_locked(x) ((x)->lock != 0) #define __raw_spin_unlock_wait(lock) \ do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) #define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) static inline void __raw_spin_lock(raw_spinlock_t *lock) { unsigned long tmp; __asm__ __volatile__( "1: ldrex %0, [%1]\n" " teq %0, #0\n" #ifdef CONFIG_CPU_32v6K " wfene\n" #endif " strexeq %0, %2, [%1]\n" " teqeq %0, #0\n" " bne 1b" : "=&r" (tmp) : "r" (&lock->lock), "r" (1) : "cc"); smp_mb(); } static inline int __raw_spin_trylock(raw_spinlock_t *lock) { unsigned long tmp; __asm__ __volatile__( " ldrex %0, [%1]\n" " teq %0, #0\n" " strexeq %0, %2, [%1]" : "=&r" (tmp) : "r" (&lock->lock), "r" (1) : "cc"); if (tmp == 0) { smp_mb(); return 1; } else { return 0; } } static inline void __raw_spin_unlock(raw_spinlock_t *lock) { smp_mb(); __asm__ __volatile__( " str %1, [%0]\n" #ifdef CONFIG_CPU_32v6K " mcr p15, 0, %1, c7, c10, 4\n" /* DSB */ " sev" #endif : : "r" (&lock->lock), "r" (0) : "cc"); } /* * RWLOCKS * * * Write locks are easy - we just set bit 31. When unlocking, we can * just write zero since the lock is exclusively held. */ static inline void __raw_write_lock(raw_rwlock_t *rw) { unsigned long tmp; __asm__ __volatile__( "1: ldrex %0, [%1]\n" " teq %0, #0\n" #ifdef CONFIG_CPU_32v6K " wfene\n" #endif " strexeq %0, %2, [%1]\n" " teq %0, #0\n" " bne 1b" : "=&r" (tmp) : "r" (&rw->lock), "r" (0x80000000) : "cc"); smp_mb(); } static inline int __raw_write_trylock(raw_rwlock_t *rw) { unsigned long tmp; __asm__ __volatile__( "1: ldrex %0, [%1]\n" " teq %0, #0\n" " strexeq %0, %2, [%1]" : "=&r" (tmp) : "r" (&rw->lock), "r" (0x80000000) : "cc"); if (tmp == 0) { smp_mb(); return 1; } else { return 0; } } static inline void __raw_write_unlock(raw_rwlock_t *rw) { smp_mb(); __asm__ __volatile__( "str %1, [%0]\n" #ifdef CONFIG_CPU_32v6K " mcr p15, 0, %1, c7, c10, 4\n" /* DSB */ " sev\n" #endif : : "r" (&rw->lock), "r" (0) : "cc"); } /* write_can_lock - would write_trylock() succeed? */ #define __raw_write_can_lock(x) ((x)->lock == 0) /* * Read locks are a bit more hairy: * - Exclusively load the lock value. * - Increment it. * - Store new lock value if positive, and we still own this location. * If the value is negative, we've already failed. * - If we failed to store the value, we want a negative result. * - If we failed, try again. * Unlocking is similarly hairy. We may have multiple read locks * currently active. However, we know we won't have any write * locks. */ static inline void __raw_read_lock(raw_rwlock_t *rw) { unsigned long tmp, tmp2; __asm__ __volatile__( "1: ldrex %0, [%2]\n" " adds %0, %0, #1\n" " strexpl %1, %0, [%2]\n" #ifdef CONFIG_CPU_32v6K " wfemi\n" #endif " rsbpls %0, %1, #0\n" " bmi 1b" : "=&r" (tmp), "=&r" (tmp2) : "r" (&rw->lock) : "cc"); smp_mb(); } static inline void __raw_read_unlock(raw_rwlock_t *rw) { unsigned long tmp, tmp2; smp_mb(); __asm__ __volatile__( "1: ldrex %0, [%2]\n" " sub %0, %0, #1\n" " strex %1, %0, [%2]\n" " teq %1, #0\n" " bne 1b" #ifdef CONFIG_CPU_32v6K "\n cmp %0, #0\n" " mcreq p15, 0, %0, c7, c10, 4\n" " seveq" #endif : "=&r" (tmp), "=&r" (tmp2) : "r" (&rw->lock) : "cc"); } static inline int __raw_read_trylock(raw_rwlock_t *rw) { unsigned long tmp, tmp2 = 1; __asm__ __volatile__( "1: ldrex %0, [%2]\n" " adds %0, %0, #1\n" " strexpl %1, %0, [%2]\n" : "=&r" (tmp), "+r" (tmp2) : "r" (&rw->lock) : "cc"); smp_mb(); return tmp2 == 0; } /* read_can_lock - would read_trylock() succeed? */ #define __raw_read_can_lock(x) ((x)->lock < 0x80000000) #define _raw_spin_relax(lock) cpu_relax() #define _raw_read_relax(lock) cpu_relax() #define _raw_write_relax(lock) cpu_relax() #endif /* __ASM_SPINLOCK_H */
/* * machine_kexec.c - handle transition of Linux booting another kernel */ #include <linux/mm.h> #include <linux/kexec.h> #include <linux/delay.h> #include <linux/reboot.h> #include <linux/io.h> #include <linux/irq.h> #include <linux/memblock.h> #include <asm/pgtable.h> #include <linux/of_fdt.h> #include <asm/pgalloc.h> #include <asm/mmu_context.h> #include <asm/cacheflush.h> #include <asm/mach-types.h> #include <asm/system_misc.h> extern const unsigned char relocate_new_kernel[]; extern const unsigned int relocate_new_kernel_size; extern unsigned long kexec_start_address; extern unsigned long kexec_indirection_page; extern unsigned long kexec_mach_type; extern unsigned long kexec_boot_atags; static atomic_t waiting_for_crash_ipi; /* * Provide a dummy crash_notes definition while crash dump arrives to arm. * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. */ int machine_kexec_prepare(struct kimage *image) { struct kexec_segment *current_segment; __be32 header; int i, err; /* * No segment at default ATAGs address. try to locate * a dtb using magic. */ for (i = 0; i < image->nr_segments; i++) { current_segment = &image->segment[i]; if (!memblock_is_region_memory(current_segment->mem, current_segment->memsz)) return -EINVAL; err = get_user(header, (__be32*)current_segment->buf); if (err) return err; if (be32_to_cpu(header) == OF_DT_HEADER) kexec_boot_atags = current_segment->mem; } return 0; } void machine_kexec_cleanup(struct kimage *image) { } void machine_crash_nonpanic_core(void *unused) { struct pt_regs regs; crash_setup_regs(&regs, NULL); printk(KERN_DEBUG "CPU %u will stop doing anything useful since another CPU has crashed\n", smp_processor_id()); crash_save_cpu(&regs, smp_processor_id()); flush_cache_all(); set_cpu_online(smp_processor_id(), false); atomic_dec(&waiting_for_crash_ipi); while (1) cpu_relax(); } static void machine_kexec_mask_interrupts(void) { unsigned int i; struct irq_desc *desc; for_each_irq_desc(i, desc) { struct irq_chip *chip; chip = irq_desc_get_chip(desc); if (!chip) continue; if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data)) chip->irq_eoi(&desc->irq_data); if (chip->irq_mask) chip->irq_mask(&desc->irq_data); if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data)) chip->irq_disable(&desc->irq_data); } } void machine_crash_shutdown(struct pt_regs *regs) { unsigned long msecs; local_irq_disable(); atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); smp_call_function(machine_crash_nonpanic_core, NULL, false); msecs = 1000; /* Wait at most a second for the other cpus to stop */ while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { mdelay(1); msecs--; } if (atomic_read(&waiting_for_crash_ipi) > 0) printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n"); crash_save_cpu(regs, smp_processor_id()); machine_kexec_mask_interrupts(); printk(KERN_INFO "Loading crashdump kernel...\n"); } /* * Function pointer to optional machine-specific reinitialization */ void (*kexec_reinit)(void); void machine_kexec(struct kimage *image) { unsigned long page_list; unsigned long reboot_code_buffer_phys; void *reboot_code_buffer; if (num_online_cpus() > 1) { pr_err("kexec: error: multiple CPUs still online\n"); return; } page_list = image->head & PAGE_MASK; /* we need both effective and real address here */ reboot_code_buffer_phys = page_to_pfn(image->control_code_page) << PAGE_SHIFT; reboot_code_buffer = page_address(image->control_code_page); /* Prepare parameters for reboot_code_buffer*/ kexec_start_address = image->start; kexec_indirection_page = page_list; kexec_mach_type = machine_arch_type; if (!kexec_boot_atags) kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; /* copy our kernel relocation code to the control code page */ memcpy(reboot_code_buffer, relocate_new_kernel, relocate_new_kernel_size); flush_icache_range((unsigned long) reboot_code_buffer, (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); printk(KERN_INFO "Bye!\n"); if (kexec_reinit) kexec_reinit(); soft_restart(reboot_code_buffer_phys); } void arch_crash_save_vmcoreinfo(void) { #ifdef CONFIG_ARM_LPAE VMCOREINFO_CONFIG(ARM_LPAE); #endif }
/******************************************************************************* This is the driver for the MAC 10/100 on-chip Ethernet controller currently tested on all the ST boards based on STb7109 and stx7200 SoCs. DWC Ether MAC 10/100 Universal version 4.0 has been used for developing this code. This contains the functions to handle the dma. Copyright (C) 2007-2009 STMicroelectronics Ltd This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. The full GNU General Public License is included in this distribution in the file called "COPYING". Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> *******************************************************************************/ #include <asm/io.h> #include "dwmac100.h" #include "dwmac_dma.h" static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb, int burst_len, u32 dma_tx, u32 dma_rx, int atds) { u32 value = readl(ioaddr + DMA_BUS_MODE); int limit; /* DMA SW reset */ value |= DMA_BUS_MODE_SFT_RESET; writel(value, ioaddr + DMA_BUS_MODE); limit = 10; while (limit--) { if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET)) break; mdelay(10); } if (limit < 0) return -EBUSY; /* Enable Application Access by writing to DMA CSR0 */ writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT), ioaddr + DMA_BUS_MODE); /* Mask interrupts by writing to CSR7 */ writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); /* RX/TX descriptor base addr lists must be written into * DMA CSR3 and CSR4, respectively */ writel(dma_tx, ioaddr + DMA_TX_BASE_ADDR); writel(dma_rx, ioaddr + DMA_RCV_BASE_ADDR); return 0; } /* Store and Forward capability is not used at all. * * The transmit threshold can be programmed by setting the TTC bits in the DMA * control register. */ static void dwmac100_dma_operation_mode(void __iomem *ioaddr, int txmode, int rxmode) { u32 csr6 = readl(ioaddr + DMA_CONTROL); if (txmode <= 32) csr6 |= DMA_CONTROL_TTC_32; else if (txmode <= 64) csr6 |= DMA_CONTROL_TTC_64; else csr6 |= DMA_CONTROL_TTC_128; writel(csr6, ioaddr + DMA_CONTROL); } static void dwmac100_dump_dma_regs(void __iomem *ioaddr) { int i; pr_debug("DWMAC 100 DMA CSR\n"); for (i = 0; i < 9; i++) pr_debug("\t CSR%d (offset 0x%x): 0x%08x\n", i, (DMA_BUS_MODE + i * 4), readl(ioaddr + DMA_BUS_MODE + i * 4)); pr_debug("\tCSR20 (0x%x): 0x%08x, CSR21 (0x%x): 0x%08x\n", DMA_CUR_TX_BUF_ADDR, readl(ioaddr + DMA_CUR_TX_BUF_ADDR), DMA_CUR_RX_BUF_ADDR, readl(ioaddr + DMA_CUR_RX_BUF_ADDR)); } /* DMA controller has two counters to track the number of the missed frames. */ static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, void __iomem *ioaddr) { struct net_device_stats *stats = (struct net_device_stats *)data; u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR); if (unlikely(csr8)) { if (csr8 & DMA_MISSED_FRAME_OVE) { stats->rx_over_errors += 0x800; x->rx_overflow_cntr += 0x800; } else { unsigned int ove_cntr; ove_cntr = ((csr8 & DMA_MISSED_FRAME_OVE_CNTR) >> 17); stats->rx_over_errors += ove_cntr; x->rx_overflow_cntr += ove_cntr; } if (csr8 & DMA_MISSED_FRAME_OVE_M) { stats->rx_missed_errors += 0xffff; x->rx_missed_cntr += 0xffff; } else { unsigned int miss_f = (csr8 & DMA_MISSED_FRAME_M_CNTR); stats->rx_missed_errors += miss_f; x->rx_missed_cntr += miss_f; } } } const struct stmmac_dma_ops dwmac100_dma_ops = { .init = dwmac100_dma_init, .dump_regs = dwmac100_dump_dma_regs, .dma_mode = dwmac100_dma_operation_mode, .dma_diagnostic_fr = dwmac100_dma_diagnostic_fr, .enable_dma_transmission = dwmac_enable_dma_transmission, .enable_dma_irq = dwmac_enable_dma_irq, .disable_dma_irq = dwmac_disable_dma_irq, .start_tx = dwmac_dma_start_tx, .stop_tx = dwmac_dma_stop_tx, .start_rx = dwmac_dma_start_rx, .stop_rx = dwmac_dma_stop_rx, .dma_interrupt = dwmac_dma_interrupt, };
/* * Copyright 2004-2011 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #ifndef __ARCH_BLACKFIN_ATOMIC__ #define __ARCH_BLACKFIN_ATOMIC__ #include <asm/cmpxchg.h> #ifdef CONFIG_SMP #include <linux/linkage.h> asmlinkage int __raw_uncached_fetch_asm(const volatile int *ptr); asmlinkage int __raw_atomic_update_asm(volatile int *ptr, int value); asmlinkage int __raw_atomic_clear_asm(volatile int *ptr, int value); asmlinkage int __raw_atomic_set_asm(volatile int *ptr, int value); asmlinkage int __raw_atomic_xor_asm(volatile int *ptr, int value); asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value); #define atomic_read(v) __raw_uncached_fetch_asm(&(v)->counter) #define atomic_add_return(i, v) __raw_atomic_update_asm(&(v)->counter, i) #define atomic_sub_return(i, v) __raw_atomic_update_asm(&(v)->counter, -(i)) #define atomic_clear_mask(m, v) __raw_atomic_clear_asm(&(v)->counter, m) #define atomic_set_mask(m, v) __raw_atomic_set_asm(&(v)->counter, m) #endif #include <asm-generic/atomic.h> #endif
// // UIAlertView+BlocksKit.h // BlocksKit // #import <UIKit/UIKit.h> /** UIAlertView without delegates! This set of extensions and convenience classes allows for an instance of UIAlertView without the implementation of a delegate. Any time you instantiate a UIAlertView using the methods here, you must add buttons using addButtonWithTitle:handler:otherwise nothing will happen. A typical invocation will go like this: UIAlertView *testView = [UIAlertView alertViewWithTitle:@"Application Alert" message:@"This app will explode in 42 seconds."]; [testView setCancelButtonWithTitle:@"Oh No!" handler:^{ NSLog(@"Boom!"); }]; [testView show]; A more traditional, and more useful, modal dialog looks like so: UIAlertView *testView = [UIAlertView alertViewWithTitle:@"Very important!" message:@"Do you like chocolate?"]; [testView addButtonWithTitle:@"Yes" handler:^{ NSLog(@"Yay!"); }]; [testView addButtonWithTitle:@"No" handler:^{ NSLog(@"We hate you."); }]; [testView show]; Includes code by the following: - [Landon Fuller](http://landonf.bikemonkey.org), "Using Blocks". - [Peter Steinberger](https://github.com/steipete) - [Zach Waldowski](https://github.com/zwaldowski) @warning UIAlertView is only available on a platform with UIKit. */ @interface UIAlertView (BlocksKit) ///----------------------------------- /// @name Creating alert views ///----------------------------------- /** Creates and shows a new alert view with only a title, message, and cancel button. @param title The title of the alert view. @param message The message content of the alert. @param cancelButtonTitle The title of the cancel button. If both cancelButtonTitle and otherButtonTitles are empty or nil, defaults to a @param otherButtonTitles Titles of additional buttons to add to the receiver. @param block A block of code to be fired on the dismissal of the alert view. @return The UIAlertView. */ + (UIAlertView*)bk_showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles handler:(void (^)(UIAlertView *alertView, NSInteger buttonIndex))block; /** Creates and returns a new alert view with only a title and cancel button. @param title The title of the alert view. @return A newly created alert view. */ + (id)bk_alertViewWithTitle:(NSString *)title; /** Creates and returns a new alert view with only a title, message, and cancel button. @param title The title of the alert view. @param message The message content of the alert. @return A newly created alert view. */ + (id)bk_alertViewWithTitle:(NSString *)title message:(NSString *)message; /** Returns a configured alert view with only a title, message, and cancel button. @param title The title of the alert view. @param message The message content of the alert. @return An instantiated alert view. */ - (id)bk_initWithTitle:(NSString *)title message:(NSString *)message NS_REPLACES_RECEIVER; ///----------------------------------- /// @name Adding buttons ///----------------------------------- /** Add a new button with an associated code block. @param title The text of the button. @param block A block of code. */ - (NSInteger)bk_addButtonWithTitle:(NSString *)title handler:(void (^)(void))block; /** Set the title and trigger of the cancel button. @param title The text of the button. @param block A block of code. */ - (NSInteger)bk_setCancelButtonWithTitle:(NSString *)title handler:(void (^)(void))block; ///----------------------------------- /// @name Altering actions ///----------------------------------- /** Sets the block that is to be fired when a button is pressed. @param block A code block, or nil to set no response. @param index The index of a button already added to the action sheet. */ - (void)bk_setHandler:(void (^)(void))block forButtonAtIndex:(NSInteger)index; /** The block that is to be fired when a button is pressed. @param index The index of the button already added to the alert view. @return A code block, or nil if no block yet assigned. */ - (void (^)(void))bk_handlerForButtonAtIndex:(NSInteger)index; /** The block to be fired when the action sheet is dismissed with the cancel button. Contrary to setCancelButtonWithTitle:handler:, you can set this property multiple times but multiple cancel buttons will not be generated. */ @property (nonatomic, copy, setter = bk_setCancelBlock:) void (^bk_cancelBlock)(void); /** The block to be fired before the alert view will show. */ @property (nonatomic, copy, setter = bk_setWillShowBlock:) void (^bk_willShowBlock)(UIAlertView *alertView); /** The block to be fired when the alert view shows. */ @property (nonatomic, copy, setter = bk_setDidShowBlock:) void (^bk_didShowBlock)(UIAlertView *alertView); /** The block to be fired before the alert view will dismiss. */ @property (nonatomic, copy, setter = bk_setWillDismissBlock:) void (^bk_willDismissBlock)(UIAlertView *alertView, NSInteger buttonIndex); /** The block to be fired after the alert view dismisses. */ @property (nonatomic, copy, setter = bk_setDidDismissBlock:) void (^bk_didDismissBlock)(UIAlertView *alertView, NSInteger buttonIndex); /** The block to be fired to determine whether the first non-cancel should be enabled */ @property (nonatomic, copy, setter = bk_SetShouldEnableFirstOtherButtonBlock:) BOOL (^bk_shouldEnableFirstOtherButtonBlock)(UIAlertView *alertView) NS_AVAILABLE_IOS(5_0); @end
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_LINUX_KCMP_H #define _UAPI_LINUX_KCMP_H #include <linux/types.h> /* Comparison type */ enum kcmp_type { KCMP_FILE, KCMP_VM, KCMP_FILES, KCMP_FS, KCMP_SIGHAND, KCMP_IO, KCMP_SYSVSEM, KCMP_EPOLL_TFD, KCMP_TYPES, }; /* Slot for KCMP_EPOLL_TFD */ struct kcmp_epoll_slot { __u32 efd; /* epoll file descriptor */ __u32 tfd; /* target file number */ __u32 toff; /* target offset within same numbered sequence */ }; #endif /* _UAPI_LINUX_KCMP_H */
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_QSPINLOCK_PARAVIRT_H #define __ASM_QSPINLOCK_PARAVIRT_H /* * For x86-64, PV_CALLEE_SAVE_REGS_THUNK() saves and restores 8 64-bit * registers. For i386, however, only 1 32-bit register needs to be saved * and restored. So an optimized version of __pv_queued_spin_unlock() is * hand-coded for 64-bit, but it isn't worthwhile to do it for 32-bit. */ #ifdef CONFIG_64BIT PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath); #define __pv_queued_spin_unlock __pv_queued_spin_unlock #define PV_UNLOCK "__raw_callee_save___pv_queued_spin_unlock" #define PV_UNLOCK_SLOWPATH "__raw_callee_save___pv_queued_spin_unlock_slowpath" /* * Optimized assembly version of __raw_callee_save___pv_queued_spin_unlock * which combines the registers saving trunk and the body of the following * C code: * * void __pv_queued_spin_unlock(struct qspinlock *lock) * { * u8 lockval = cmpxchg(&lock->locked, _Q_LOCKED_VAL, 0); * * if (likely(lockval == _Q_LOCKED_VAL)) * return; * pv_queued_spin_unlock_slowpath(lock, lockval); * } * * For x86-64, * rdi = lock (first argument) * rsi = lockval (second argument) * rdx = internal variable (set to 0) */ asm (".pushsection .text;" ".globl " PV_UNLOCK ";" ".type " PV_UNLOCK ", @function;" ".align 4,0x90;" PV_UNLOCK ": " FRAME_BEGIN "push %rdx;" "mov $0x1,%eax;" "xor %edx,%edx;" LOCK_PREFIX "cmpxchg %dl,(%rdi);" "cmp $0x1,%al;" "jne .slowpath;" "pop %rdx;" FRAME_END "ret;" ".slowpath: " "push %rsi;" "movzbl %al,%esi;" "call " PV_UNLOCK_SLOWPATH ";" "pop %rsi;" "pop %rdx;" FRAME_END "ret;" ".size " PV_UNLOCK ", .-" PV_UNLOCK ";" ".popsection"); #else /* CONFIG_64BIT */ extern void __pv_queued_spin_unlock(struct qspinlock *lock); PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock); #endif /* CONFIG_64BIT */ #endif
/* * Map for flash chips on Wind River PowerQUICC II SBC82xx board. * * Copyright (C) 2004 Red Hat, Inc. * * Author: David Woodhouse <dwmw2@infradead.org> * */ #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/slab.h> #include <asm/io.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> #include <asm/immap_cpm2.h> static struct mtd_info *sbcmtd[3]; static struct mtd_partition *sbcmtd_parts[3]; struct map_info sbc82xx_flash_map[3] = { {.name = "Boot flash"}, {.name = "Alternate boot flash"}, {.name = "User flash"} }; static struct mtd_partition smallflash_parts[] = { { .name = "space", .size = 0x100000, .offset = 0, }, { .name = "bootloader", .size = MTDPART_SIZ_FULL, .offset = MTDPART_OFS_APPEND, } }; static struct mtd_partition bigflash_parts[] = { { .name = "bootloader", .size = 0x00100000, .offset = 0, }, { .name = "file system", .size = 0x01f00000, .offset = MTDPART_OFS_APPEND, }, { .name = "boot config", .size = 0x00100000, .offset = MTDPART_OFS_APPEND, }, { .name = "space", .size = 0x01f00000, .offset = MTDPART_OFS_APPEND, } }; static const char *part_probes[] __initdata = {"cmdlinepart", "RedBoot", NULL}; #define init_sbc82xx_one_flash(map, br, or) \ do { \ (map).phys = (br & 1) ? (br & 0xffff8000) : 0; \ (map).size = (br & 1) ? (~(or & 0xffff8000) + 1) : 0; \ switch (br & 0x00001800) { \ case 0x00000000: \ case 0x00000800: (map).bankwidth = 1; break; \ case 0x00001000: (map).bankwidth = 2; break; \ case 0x00001800: (map).bankwidth = 4; break; \ } \ } while (0); static int __init init_sbc82xx_flash(void) { volatile memctl_cpm2_t *mc = &cpm2_immr->im_memctl; int bigflash; int i; #ifdef CONFIG_SBC8560 mc = ioremap(0xff700000 + 0x5000, sizeof(memctl_cpm2_t)); #else mc = &cpm2_immr->im_memctl; #endif bigflash = 1; if ((mc->memc_br0 & 0x00001800) == 0x00001800) bigflash = 0; init_sbc82xx_one_flash(sbc82xx_flash_map[0], mc->memc_br0, mc->memc_or0); init_sbc82xx_one_flash(sbc82xx_flash_map[1], mc->memc_br6, mc->memc_or6); init_sbc82xx_one_flash(sbc82xx_flash_map[2], mc->memc_br1, mc->memc_or1); #ifdef CONFIG_SBC8560 iounmap((void *) mc); #endif for (i=0; i<3; i++) { int8_t flashcs[3] = { 0, 6, 1 }; int nr_parts; printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d", sbc82xx_flash_map[i].name, (sbc82xx_flash_map[i].size >> 20), flashcs[i]); if (!sbc82xx_flash_map[i].phys) { /* We know it can't be at zero. */ printk("): disabled by bootloader.\n"); continue; } printk(" at %08lx)\n", sbc82xx_flash_map[i].phys); sbc82xx_flash_map[i].virt = ioremap(sbc82xx_flash_map[i].phys, sbc82xx_flash_map[i].size); if (!sbc82xx_flash_map[i].virt) { printk("Failed to ioremap\n"); continue; } simple_map_init(&sbc82xx_flash_map[i]); sbcmtd[i] = do_map_probe("cfi_probe", &sbc82xx_flash_map[i]); if (!sbcmtd[i]) continue; sbcmtd[i]->owner = THIS_MODULE; nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes, &sbcmtd_parts[i], 0); if (nr_parts > 0) { add_mtd_partitions (sbcmtd[i], sbcmtd_parts[i], nr_parts); continue; } /* No partitioning detected. Use default */ if (i == 2) { add_mtd_device(sbcmtd[i]); } else if (i == bigflash) { add_mtd_partitions (sbcmtd[i], bigflash_parts, ARRAY_SIZE(bigflash_parts)); } else { add_mtd_partitions (sbcmtd[i], smallflash_parts, ARRAY_SIZE(smallflash_parts)); } } return 0; } static void __exit cleanup_sbc82xx_flash(void) { int i; for (i=0; i<3; i++) { if (!sbcmtd[i]) continue; if (i<2 || sbcmtd_parts[i]) del_mtd_partitions(sbcmtd[i]); else del_mtd_device(sbcmtd[i]); kfree(sbcmtd_parts[i]); map_destroy(sbcmtd[i]); iounmap((void *)sbc82xx_flash_map[i].virt); sbc82xx_flash_map[i].virt = 0; } } module_init(init_sbc82xx_flash); module_exit(cleanup_sbc82xx_flash); MODULE_LICENSE("GPL"); MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>"); MODULE_DESCRIPTION("Flash map driver for WindRiver PowerQUICC II");
/** * Copyright (c) 2015-present, Parse, LLC. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <Foundation/Foundation.h> // REST Key magic strings extern NSString *const PFObjectCompleteRESTKey; extern NSString *const PFObjectOperationsRESTKey; extern NSString *const PFObjectTypeRESTKey; extern NSString *const PFObjectObjectIdRESTKey; extern NSString *const PFObjectUpdatedAtRESTKey; extern NSString *const PFObjectCreatedAtRESTKey; extern NSString *const PFObjectIsDeletingEventuallyRESTKey; extern NSString *const PFObjectClassNameRESTKey; extern NSString *const PFObjectACLRESTKey; extern NSString *const PFObjectDefaultPin;
// SPDX-License-Identifier: GPL-2.0 /* * Device driver for s390 storage class memory. * * Copyright IBM Corp. 2012 * Author(s): Sebastian Ott <sebott@linux.vnet.ibm.com> */ #define KMSG_COMPONENT "scm_block" #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt #include <linux/module.h> #include <linux/slab.h> #include <asm/eadm.h> #include "scm_blk.h" static void scm_notify(struct scm_device *scmdev, enum scm_event event) { struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); switch (event) { case SCM_CHANGE: pr_info("%lx: The capabilities of the SCM increment changed\n", (unsigned long) scmdev->address); SCM_LOG(2, "State changed"); SCM_LOG_STATE(2, scmdev); break; case SCM_AVAIL: SCM_LOG(2, "Increment available"); SCM_LOG_STATE(2, scmdev); scm_blk_set_available(bdev); break; } } static int scm_probe(struct scm_device *scmdev) { struct scm_blk_dev *bdev; int ret; SCM_LOG(2, "probe"); SCM_LOG_STATE(2, scmdev); if (scmdev->attrs.oper_state != OP_STATE_GOOD) return -EINVAL; bdev = kzalloc(sizeof(*bdev), GFP_KERNEL); if (!bdev) return -ENOMEM; dev_set_drvdata(&scmdev->dev, bdev); ret = scm_blk_dev_setup(bdev, scmdev); if (ret) { dev_set_drvdata(&scmdev->dev, NULL); kfree(bdev); goto out; } out: return ret; } static int scm_remove(struct scm_device *scmdev) { struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev); scm_blk_dev_cleanup(bdev); dev_set_drvdata(&scmdev->dev, NULL); kfree(bdev); return 0; } static struct scm_driver scm_drv = { .drv = { .name = "scm_block", .owner = THIS_MODULE, }, .notify = scm_notify, .probe = scm_probe, .remove = scm_remove, .handler = scm_blk_irq, }; int __init scm_drv_init(void) { return scm_driver_register(&scm_drv); } void scm_drv_cleanup(void) { scm_driver_unregister(&scm_drv); }
/* * Copyright (C) 2011 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained from Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MALI_KERNEL_SYSFS_H__ #define __MALI_KERNEL_SYSFS_H__ #ifdef __cplusplus extern "C" { #endif #define MALI_PROC_DIR "driver/mali" int mali_sysfs_register(struct mali_dev *mali_class, dev_t dev, const char *mali_dev_name); int mali_sysfs_unregister(struct mali_dev *mali_class, dev_t dev, const char *mali_dev_name); #ifdef __cplusplus } #endif #endif /* __MALI_KERNEL_LINUX_H__ */
/* SPDX-License-Identifier: GPL-2.0 OR MIT */ /* Copyright 2017-2019 Qiang Yu <yuq825@gmail.com> */ #ifndef __LIMA_GEM_H__ #define __LIMA_GEM_H__ #include <drm/drm_gem_shmem_helper.h> struct lima_submit; struct lima_vm; struct lima_bo { struct drm_gem_shmem_object base; struct mutex lock; struct list_head va; size_t heap_size; }; static inline struct lima_bo * to_lima_bo(struct drm_gem_object *obj) { return container_of(to_drm_gem_shmem_obj(obj), struct lima_bo, base); } static inline size_t lima_bo_size(struct lima_bo *bo) { return bo->base.base.size; } static inline struct dma_resv *lima_bo_resv(struct lima_bo *bo) { return bo->base.base.resv; } int lima_heap_alloc(struct lima_bo *bo, struct lima_vm *vm); struct drm_gem_object *lima_gem_create_object(struct drm_device *dev, size_t size); int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file, u32 size, u32 flags, u32 *handle); int lima_gem_get_info(struct drm_file *file, u32 handle, u32 *va, u64 *offset); int lima_gem_submit(struct drm_file *file, struct lima_submit *submit); int lima_gem_wait(struct drm_file *file, u32 handle, u32 op, s64 timeout_ns); void lima_set_vma_flags(struct vm_area_struct *vma); #endif
/* * Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include "../ssp.h" #define VENDOR "AMS" #define CHIP_ID "TMG399X" /*************************************************************************/ /* factory Sysfs */ /*************************************************************************/ static ssize_t light_vendor_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%s\n", VENDOR); } static ssize_t light_name_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%s\n", CHIP_ID); } static ssize_t light_lux_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ssp_data *data = dev_get_drvdata(dev); return sprintf(buf, "%u,%u,%u,%u,%u,%u\n", data->buf[LIGHT_SENSOR].r, data->buf[LIGHT_SENSOR].g, data->buf[LIGHT_SENSOR].b, data->buf[LIGHT_SENSOR].w, data->buf[LIGHT_SENSOR].a_time, data->buf[LIGHT_SENSOR].a_gain); } static ssize_t light_data_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ssp_data *data = dev_get_drvdata(dev); return sprintf(buf, "%u,%u,%u,%u,%u,%u\n", data->buf[LIGHT_SENSOR].r, data->buf[LIGHT_SENSOR].g, data->buf[LIGHT_SENSOR].b, data->buf[LIGHT_SENSOR].w, data->buf[LIGHT_SENSOR].a_time, data->buf[LIGHT_SENSOR].a_gain); } static DEVICE_ATTR(vendor, S_IRUGO, light_vendor_show, NULL); static DEVICE_ATTR(name, S_IRUGO, light_name_show, NULL); static DEVICE_ATTR(lux, S_IRUGO, light_lux_show, NULL); static DEVICE_ATTR(raw_data, S_IRUGO, light_data_show, NULL); static struct device_attribute *light_attrs[] = { &dev_attr_vendor, &dev_attr_name, &dev_attr_lux, &dev_attr_raw_data, NULL, }; void initialize_light_factorytest(struct ssp_data *data) { sensors_register(data->light_device, data, light_attrs, "light_sensor"); } void remove_light_factorytest(struct ssp_data *data) { sensors_unregister(data->light_device, light_attrs); }