text stringlengths 4 6.14k |
|---|
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
//
// PedometerBackgroundTask.h
// Declaration of the PedometerBackgroundTask class
//
#pragma once
namespace Tasks
{
[Windows::Foundation::Metadata::WebHostHidden]
public ref class PedometerBackgroundTask sealed : public Windows::ApplicationModel::Background::IBackgroundTask
{
public:
PedometerBackgroundTask() {}
virtual void Run(Windows::ApplicationModel::Background::IBackgroundTaskInstance^ taskInstance);
void OnCanceled(Windows::ApplicationModel::Background::IBackgroundTaskInstance^ taskInstance, Windows::ApplicationModel::Background::BackgroundTaskCancellationReason reason);
private:
~PedometerBackgroundTask() {}
Windows::ApplicationModel::Background::IBackgroundTaskInstance^ TaskInstance;
};
} |
/*
* Copyright 2012-present Pixate, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// PXForceLoadStylingCategories.h
// Pixate
//
// Created by Paul Colton on 12/10/13.
// Copyright (c) 2013 Pixate, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PXForceLoadStylingCategories : NSObject
+(void)forceLoad;
@end
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_MATH64_H
#define _LINUX_MATH64_H
#include <linux/types.h>
#include <asm/div64.h>
#if BITS_PER_LONG == 64
#define div64_long(x, y) div64_s64((x), (y))
#define div64_ul(x, y) div64_u64((x), (y))
/**
* div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder
*
* This is commonly provided by 32bit archs to provide an optimized 64bit
* divide.
*/
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div_s64_rem - signed 64bit divide with 32bit divisor with remainder
*/
static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div64_u64_rem - unsigned 64bit divide with 64bit divisor and remainder
*/
static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder)
{
*remainder = dividend % divisor;
return dividend / divisor;
}
/**
* div64_u64 - unsigned 64bit divide with 64bit divisor
*/
static inline u64 div64_u64(u64 dividend, u64 divisor)
{
return dividend / divisor;
}
/**
* div64_s64 - signed 64bit divide with 64bit divisor
*/
static inline s64 div64_s64(s64 dividend, s64 divisor)
{
return dividend / divisor;
}
#elif BITS_PER_LONG == 32
#define div64_long(x, y) div_s64((x), (y))
#define div64_ul(x, y) div_u64((x), (y))
#ifndef div_u64_rem
static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)
{
*remainder = do_div(dividend, divisor);
return dividend;
}
#endif
#ifndef div_s64_rem
extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
#endif
#ifndef div64_u64_rem
extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder);
#endif
#ifndef div64_u64
extern u64 div64_u64(u64 dividend, u64 divisor);
#endif
#ifndef div64_s64
extern s64 div64_s64(s64 dividend, s64 divisor);
#endif
#endif /* BITS_PER_LONG */
/**
* div_u64 - unsigned 64bit divide with 32bit divisor
*
* This is the most common 64bit divide and should be used if possible,
* as many 32bit archs can optimize this variant better than a full 64bit
* divide.
*/
#ifndef div_u64
static inline u64 div_u64(u64 dividend, u32 divisor)
{
u32 remainder;
return div_u64_rem(dividend, divisor, &remainder);
}
#endif
/**
* div_s64 - signed 64bit divide with 32bit divisor
*/
#ifndef div_s64
static inline s64 div_s64(s64 dividend, s32 divisor)
{
s32 remainder;
return div_s64_rem(dividend, divisor, &remainder);
}
#endif
u32 iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder);
static __always_inline u32
__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder)
{
u32 ret = 0;
while (dividend >= divisor) {
/* The following asm() prevents the compiler from
optimising this loop into a modulo operation. */
asm("" : "+rm"(dividend));
dividend -= divisor;
ret++;
}
*remainder = dividend;
return ret;
}
#ifndef mul_u32_u32
/*
* Many a GCC version messes this up and generates a 64x64 mult :-(
*/
static inline u64 mul_u32_u32(u32 a, u32 b)
{
return (u64)a * b;
}
#endif
#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
#ifndef mul_u64_u32_shr
static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
{
return (u64)(((unsigned __int128)a * mul) >> shift);
}
#endif /* mul_u64_u32_shr */
#ifndef mul_u64_u64_shr
static inline u64 mul_u64_u64_shr(u64 a, u64 mul, unsigned int shift)
{
return (u64)(((unsigned __int128)a * mul) >> shift);
}
#endif /* mul_u64_u64_shr */
#else
#ifndef mul_u64_u32_shr
static inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int shift)
{
u32 ah, al;
u64 ret;
al = a;
ah = a >> 32;
ret = mul_u32_u32(al, mul) >> shift;
if (ah)
ret += mul_u32_u32(ah, mul) << (32 - shift);
return ret;
}
#endif /* mul_u64_u32_shr */
#ifndef mul_u64_u64_shr
static inline u64 mul_u64_u64_shr(u64 a, u64 b, unsigned int shift)
{
union {
u64 ll;
struct {
#ifdef __BIG_ENDIAN
u32 high, low;
#else
u32 low, high;
#endif
} l;
} rl, rm, rn, rh, a0, b0;
u64 c;
a0.ll = a;
b0.ll = b;
rl.ll = mul_u32_u32(a0.l.low, b0.l.low);
rm.ll = mul_u32_u32(a0.l.low, b0.l.high);
rn.ll = mul_u32_u32(a0.l.high, b0.l.low);
rh.ll = mul_u32_u32(a0.l.high, b0.l.high);
/*
* Each of these lines computes a 64-bit intermediate result into "c",
* starting at bits 32-95. The low 32-bits go into the result of the
* multiplication, the high 32-bits are carried into the next step.
*/
rl.l.high = c = (u64)rl.l.high + rm.l.low + rn.l.low;
rh.l.low = c = (c >> 32) + rm.l.high + rn.l.high + rh.l.low;
rh.l.high = (c >> 32) + rh.l.high;
/*
* The 128-bit result of the multiplication is in rl.ll and rh.ll,
* shift it right and throw away the high part of the result.
*/
if (shift == 0)
return rl.ll;
if (shift < 64)
return (rl.ll >> shift) | (rh.ll << (64 - shift));
return rh.ll >> (shift & 63);
}
#endif /* mul_u64_u64_shr */
#endif
#ifndef mul_u64_u32_div
static inline u64 mul_u64_u32_div(u64 a, u32 mul, u32 divisor)
{
union {
u64 ll;
struct {
#ifdef __BIG_ENDIAN
u32 high, low;
#else
u32 low, high;
#endif
} l;
} u, rl, rh;
u.ll = a;
rl.ll = mul_u32_u32(u.l.low, mul);
rh.ll = mul_u32_u32(u.l.high, mul) + rl.l.high;
/* Bits 32-63 of the result will be in rh.l.low. */
rl.l.high = do_div(rh.ll, divisor);
/* Bits 0-31 of the result will be in rl.l.low. */
do_div(rl.ll, divisor);
rl.l.high = rh.l.low;
return rl.ll;
}
#endif /* mul_u64_u32_div */
#endif /* _LINUX_MATH64_H */
|
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_UTIL_RESOLVE_HEADER
#define GRUB_UTIL_RESOLVE_HEADER 1
struct grub_util_path_list
{
const char *name;
struct grub_util_path_list *next;
};
/* Resolve the dependencies of the modules MODULES using the information
in the file DEP_LIST_FILE. The directory PREFIX is used to find files. */
struct grub_util_path_list *
grub_util_resolve_dependencies (const char *prefix,
const char *dep_list_file,
char *modules[]);
void grub_util_free_path_list (struct grub_util_path_list *path_list);
#endif /* ! GRUB_UTIL_RESOLVE_HEADER */
|
/*
* Copyright (C) 2000-2005, DENX Software Engineering
* Wolfgang Denk <wd@denx.de>
* Copyright (C) Procsys. All rights reserved.
* Mushtaq Khan <mushtaq_k@procsys.com>
* <mushtaqk_921@yahoo.co.in>
* Copyright (C) 2008 Freescale Semiconductor, Inc.
* Dave Liu <daveliu@freescale.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 <common.h>
#include <command.h>
#include <part.h>
#include <sata.h>
int curr_device = -1;
block_dev_desc_t sata_dev_desc[CFG_SATA_MAX_DEVICE];
int sata_initialize(void)
{
int rc;
int i;
for (i = 0; i < CFG_SATA_MAX_DEVICE; i++) {
memset(&sata_dev_desc[i], 0, sizeof(struct block_dev_desc));
sata_dev_desc[i].if_type = IF_TYPE_SATA;
sata_dev_desc[i].dev = i;
sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
sata_dev_desc[i].lba = 0;
sata_dev_desc[i].blksz = 512;
sata_dev_desc[i].block_read = sata_read;
sata_dev_desc[i].block_write = sata_write;
rc = init_sata(i);
rc = scan_sata(i);
if ((sata_dev_desc[i].lba > 0) && (sata_dev_desc[i].blksz > 0))
init_part(&sata_dev_desc[i]);
}
curr_device = 0;
return rc;
}
block_dev_desc_t *sata_get_dev(int dev)
{
return (dev < CFG_SATA_MAX_DEVICE) ? &sata_dev_desc[dev] : NULL;
}
int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rc = 0;
switch (argc) {
case 0:
case 1:
printf("Usage:\n%s\n", cmdtp->usage);
return 1;
case 2:
if (strncmp(argv[1],"inf", 3) == 0) {
int i;
putc('\n');
for (i = 0; i < CFG_SATA_MAX_DEVICE; ++i) {
if (sata_dev_desc[i].type == DEV_TYPE_UNKNOWN)
continue;
printf ("SATA device %d: ", i);
dev_print(&sata_dev_desc[i]);
}
return 0;
} else if (strncmp(argv[1],"dev", 3) == 0) {
if ((curr_device < 0) || (curr_device >= CFG_SATA_MAX_DEVICE)) {
puts("\nno SATA devices available\n");
return 1;
}
printf("\nSATA device %d: ", curr_device);
dev_print(&sata_dev_desc[curr_device]);
return 0;
} else if (strncmp(argv[1],"part",4) == 0) {
int dev, ok;
for (ok = 0, dev = 0; dev < CFG_SATA_MAX_DEVICE; ++dev) {
if (sata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
++ok;
if (dev)
putc ('\n');
print_part(&sata_dev_desc[dev]);
}
}
if (!ok) {
puts("\nno SATA devices available\n");
rc ++;
}
return rc;
}
printf("Usage:\n%s\n", cmdtp->usage);
return 1;
case 3:
if (strncmp(argv[1], "dev", 3) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
printf("\nSATA device %d: ", dev);
if (dev >= CFG_SATA_MAX_DEVICE) {
puts ("unknown device\n");
return 1;
}
dev_print(&sata_dev_desc[dev]);
if (sata_dev_desc[dev].type == DEV_TYPE_UNKNOWN)
return 1;
curr_device = dev;
puts("... is now current device\n");
return 0;
} else if (strncmp(argv[1], "part", 4) == 0) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
if (sata_dev_desc[dev].part_type != PART_TYPE_UNKNOWN) {
print_part(&sata_dev_desc[dev]);
} else {
printf("\nSATA device %d not available\n", dev);
rc = 1;
}
return rc;
}
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
default: /* at least 4 args */
if (strcmp(argv[1], "read") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
ulong n;
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
printf("\nSATA read: device %d block # %ld, count %ld ... ",
curr_device, blk, cnt);
n = sata_read(curr_device, blk, cnt, (u32 *)addr);
/* flush cache after read */
flush_cache(addr, cnt * sata_dev_desc[curr_device].blksz);
printf("%ld blocks read: %s\n",
n, (n==cnt) ? "OK" : "ERROR");
return (n == cnt) ? 0 : 1;
} else if (strcmp(argv[1], "write") == 0) {
ulong addr = simple_strtoul(argv[2], NULL, 16);
ulong cnt = simple_strtoul(argv[4], NULL, 16);
ulong n;
lbaint_t blk = simple_strtoul(argv[3], NULL, 16);
printf("\nSATA write: device %d block # %ld, count %ld ... ",
curr_device, blk, cnt);
n = sata_write(curr_device, blk, cnt, (u32 *)addr);
printf("%ld blocks written: %s\n",
n, (n == cnt) ? "OK" : "ERROR");
return (n == cnt) ? 0 : 1;
} else {
printf("Usage:\n%s\n", cmdtp->usage);
rc = 1;
}
return rc;
}
}
U_BOOT_CMD(
sata, 5, 1, do_sata,
"sata - SATA sub system\n",
"sata info - show available SATA devices\n"
"sata device [dev] - show or set current device\n"
"sata part [dev] - print partition table\n"
"sata read addr blk# cnt\n"
"sata write addr blk# cnt\n");
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SANDBOX_SRC_FILESYSTEM_DISPATCHER_H__
#define SANDBOX_SRC_FILESYSTEM_DISPATCHER_H__
#include <stdint.h>
#include "base/macros.h"
#include "base/strings/string16.h"
#include "sandbox/win/src/crosscall_server.h"
#include "sandbox/win/src/sandbox_policy_base.h"
namespace sandbox {
// This class handles file system-related IPC calls.
class FilesystemDispatcher : public Dispatcher {
public:
explicit FilesystemDispatcher(PolicyBase* policy_base);
~FilesystemDispatcher() override {}
// Dispatcher interface.
bool SetupService(InterceptionManager* manager, int service) override;
private:
// Processes IPC requests coming from calls to NtCreateFile in the target.
bool NtCreateFile(IPCInfo* ipc,
base::string16* name,
uint32_t attributes,
uint32_t desired_access,
uint32_t file_attributes,
uint32_t share_access,
uint32_t create_disposition,
uint32_t create_options);
// Processes IPC requests coming from calls to NtOpenFile in the target.
bool NtOpenFile(IPCInfo* ipc,
base::string16* name,
uint32_t attributes,
uint32_t desired_access,
uint32_t share_access,
uint32_t create_options);
// Processes IPC requests coming from calls to NtQueryAttributesFile in the
// target.
bool NtQueryAttributesFile(IPCInfo* ipc,
base::string16* name,
uint32_t attributes,
CountedBuffer* info);
// Processes IPC requests coming from calls to NtQueryFullAttributesFile in
// the target.
bool NtQueryFullAttributesFile(IPCInfo* ipc,
base::string16* name,
uint32_t attributes,
CountedBuffer* info);
// Processes IPC requests coming from calls to NtSetInformationFile with the
// rename information class.
bool NtSetInformationFile(IPCInfo* ipc,
HANDLE handle,
CountedBuffer* status,
CountedBuffer* info,
uint32_t length,
uint32_t info_class);
PolicyBase* policy_base_;
DISALLOW_COPY_AND_ASSIGN(FilesystemDispatcher);
};
} // namespace sandbox
#endif // SANDBOX_SRC_FILESYSTEM_DISPATCHER_H__
|
/* Subroutines used for macro/preprocessor support on SPARC.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "hash-set.h"
#include "machmode.h"
#include "vec.h"
#include "double-int.h"
#include "input.h"
#include "alias.h"
#include "symtab.h"
#include "wide-int.h"
#include "inchash.h"
#include "tree.h"
#include "tm_p.h"
#include "flags.h"
#include "c-family/c-common.h"
#include "c-family/c-pragma.h"
#include "cpplib.h"
void
sparc_target_macros (void)
{
builtin_define_std ("sparc");
if (TARGET_64BIT)
{
cpp_assert (parse_in, "cpu=sparc64");
cpp_assert (parse_in, "machine=sparc64");
}
else
{
cpp_assert (parse_in, "cpu=sparc");
cpp_assert (parse_in, "machine=sparc");
}
if (TARGET_VIS3)
{
cpp_define (parse_in, "__VIS__=0x300");
cpp_define (parse_in, "__VIS=0x300");
}
else if (TARGET_VIS2)
{
cpp_define (parse_in, "__VIS__=0x200");
cpp_define (parse_in, "__VIS=0x200");
}
else if (TARGET_VIS)
{
cpp_define (parse_in, "__VIS__=0x100");
cpp_define (parse_in, "__VIS=0x100");
}
}
|
/*
* Copyright (C) 2005 iptelorg GmbH
*
* This file is part of ser, a free SIP server.
*
* ser 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
*
* For a license to use the ser software under conditions
* other than those described here, or to purchase support for this
* software, please contact iptel.org by e-mail at the following addresses:
* info@iptel.org
*
* ser is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <presence/qsa.h>
#include <cds/logger.h>
#include <cds/cds.h>
#include <presence/domain_maintainer.h>
typedef struct {
int init_cnt;
domain_maintainer_t *dm;
} init_data_t;
static init_data_t *init = NULL;
int qsa_initialize()
{
int res = 0;
/* initialization should be called from one process/thread
* it is not synchronized because it is impossible ! */
if (!init) {
init = (init_data_t*)cds_malloc(sizeof(init_data_t));
if (!init) return -1;
init->init_cnt = 0;
}
if (init->init_cnt > 0) { /* already initialized */
init->init_cnt++;
return 0;
}
else {
DEBUG_LOG("init the content\n");
/* !!! put the real initialization here !!! */
init->dm = create_domain_maintainer();
if (!init->dm) {
ERROR_LOG("qsa_initialize error - can't initialize domain maintainer\n");
res = -1;
}
}
if (res == 0) init->init_cnt++;
return res;
}
void qsa_cleanup()
{
if (init) {
if (--init->init_cnt == 0) {
DEBUG_LOG("cleaning the content\n");
/* !!! put the real destruction here !!! */
if (init->dm) destroy_domain_maintainer(init->dm);
cds_free(init);
init = NULL;
}
}
}
notifier_domain_t *qsa_register_domain(const str_t *name)
{
notifier_domain_t *d = NULL;
if (!init) {
ERROR_LOG("qsa_initialize was not called - can't register domain\n");
return NULL;
}
if (init->dm) d = register_notifier_domain(init->dm, name);
return d;
}
notifier_domain_t *qsa_get_default_domain()
{
return qsa_register_domain(NULL);
}
void qsa_release_domain(notifier_domain_t *domain)
{
if (init)
if (init->dm) release_notifier_domain(init->dm, domain);
}
|
/* Test support of scalar_storage_order pragma */
/* { dg-do run } */
/* { dg-require-effective-target int32plus } */
#pragma scalar_storage_order /* { dg-warning "missing .big-endian.little-endian.default." } */
#pragma scalar_storage_order big-endian
struct S1
{
int i;
};
struct __attribute__((scalar_storage_order("little-endian"))) S2
{
int i;
};
#pragma scalar_storage_order little-endian
struct S3
{
int i;
};
struct __attribute__((scalar_storage_order("big-endian"))) S4
{
int i;
};
#pragma scalar_storage_order default
struct S5
{
int i;
};
#pragma scalar_storage_order other /* { dg-warning "expected .big-endian.little-endian.default." } */
struct S1 my_s1 = { 0x12345678 };
struct S2 my_s2 = { 0x12345678 };
struct S3 my_s3 = { 0x12345678 };
struct S4 my_s4 = { 0x12345678 };
struct S5 my_s5 = { 0x12345678 };
unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 };
unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 };
int main (void)
{
if (__builtin_memcmp (&my_s1, &big_endian_pattern, 4) != 0)
__builtin_abort ();
if (__builtin_memcmp (&my_s2, &little_endian_pattern, 4) != 0)
__builtin_abort ();
if (__builtin_memcmp (&my_s3, &little_endian_pattern, 4) != 0)
__builtin_abort ();
if (__builtin_memcmp (&my_s4, &big_endian_pattern, 4) != 0)
__builtin_abort ();
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
if (__builtin_memcmp (&my_s5, &little_endian_pattern, 4) != 0)
__builtin_abort ();
#else
if (__builtin_memcmp (&my_s5, &big_endian_pattern, 4) != 0)
__builtin_abort ();
#endif
return 0;
}
|
/*
Copyright 2018 listofoptions <listofoptions@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#if defined(__AVR__)
#include <avr/io.h>
#endif
#include <util/delay.h>
#include "wait.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "matrix.h"
#include "timer.h"
#include "LUFA/Drivers/Peripheral/SPI.h"
#include "config.h"
#ifndef DEBOUNCE
# define DEBOUNCE 5
#endif
#if ( DEBOUNCE > 0 )
static uint16_t debouncing_time ;
static bool debouncing = false ;
#endif
static uint8_t matrix [MATRIX_ROWS] = {0};
#if ( DEBOUNCE > 0 )
static uint8_t matrix_debounce_old [MATRIX_ROWS] = {0};
static uint8_t matrix_debounce_new [MATRIX_ROWS] = {0};
#endif
__attribute__ ((weak))
void matrix_init_quantum(void) {
matrix_init_kb();
}
__attribute__ ((weak))
void matrix_scan_quantum(void) {
matrix_scan_kb();
}
__attribute__ ((weak))
void matrix_init_kb(void) {
matrix_init_user();
}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
__attribute__ ((weak))
void matrix_init_user(void) {
}
__attribute__ ((weak))
void matrix_scan_user(void) {
}
// the keyboard's internal wiring is such that the inputs to the logic are
// a clock signal, and a reset line.
// the output is a single output pin. im bitbanging here, but the SPI controller
// would work normally
//
// the device functions, by using the clock signal to count 128 bits, the lower
// 3 bits of this 7 bit counter are tied to a 1-of-8 multiplexer, this forms
// the columns.
// the upper 4 bits form the rows, and are decoded using bcd to decimal
// decoders, so that 14 out of 16 of the outputs are wired to the rows of the
// matrix. each switch has a diode, such that the row signal feeds into the
// switch, and then into the diode, then into one of the columns into the
// matrix. the reset pin can be used to reset the entire counter.
#define RESET _BV(PB0)
#define SCLK _BV(PB1)
#define SDATA _BV(PB3)
#define LED _BV(PD6)
inline
static
void SCLK_increment(void) {
PORTB &= ~SCLK ;
_delay_us( 4 ) ; // make sure the line is stable
PORTB |= SCLK ;
_delay_us( 4 ) ;
return ;
}
inline
static
void Matrix_Reset(void) {
PORTB |= RESET ;
_delay_us( 4 ) ; // make sure the line is stable
PORTB &= ~RESET ;
return ;
}
inline
static
uint8_t Matrix_ReceiveByte (void) {
uint8_t received = 0 ;
uint8_t temp = 0 ;
for ( uint8_t bit = 0; bit < MATRIX_COLS; ++bit ) {
// toggle the clock
SCLK_increment();
temp = (PINB & SDATA) << 4 ;
received |= temp >> bit ;
}
return received ;
}
inline
static
void Matrix_ThrowByte(void) {
// we use MATRIX_COLS - 1 here because that would put us at 7 clocks
for ( uint8_t bit = 0; bit < MATRIX_COLS - 1; ++bit ) {
// toggle the clock
SCLK_increment();
}
return ;
}
void matrix_init () {
// debug_matrix = 1;
// PB0 (SS) and PB1 (SCLK) set to outputs
DDRB |= RESET | SCLK ;
// PB2, is unused, and PB3 is our serial input
DDRB &= ~SDATA ;
// SS is reset for this board, and is active High
// SCLK is the serial clock and is active High
PORTB &= ~RESET ;
PORTB |= SCLK ;
// led pin
DDRD |= LED ;
PORTD &= ~LED ;
matrix_init_quantum();
//toggle reset, to put the keyboard logic into a known state
Matrix_Reset() ;
}
uint8_t matrix_scan(void) {
// the first byte of the keyboard's output data can be ignored
Matrix_ThrowByte();
#if ( DEBOUNCE > 0 )
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
//transfer old debouncing values
matrix_debounce_old[row] = matrix_debounce_new[row] ;
// read new key-states in
matrix_debounce_new[row] = Matrix_ReceiveByte() ;
if ( matrix_debounce_new[row] != matrix_debounce_old[row] ) {
debouncing = true ;
debouncing_time = timer_read() ;
}
}
#else
// without debouncing we simply just read in the raw matrix
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
matrix[row] = Matrix_ReceiveByte ;
}
#endif
#if ( DEBOUNCE > 0 )
if ( debouncing && ( timer_elapsed( debouncing_time ) > DEBOUNCE ) ) {
for ( uint8_t row = 0 ; row < MATRIX_ROWS ; ++row ) {
matrix[row] = matrix_debounce_new[row] ;
}
debouncing = false ;
}
#endif
Matrix_Reset() ;
matrix_scan_quantum() ;
return 1;
}
inline
uint8_t matrix_get_row( uint8_t row ) {
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 01234567\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
phex(row); print(": ");
print_bin_reverse8(matrix_get_row(row));
print("\n");
}
}
inline
uint8_t matrix_rows(void) {
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void) {
return MATRIX_COLS;
}
// as an aside, I used the M0110 converter:
// tmk_core/common/keyboard.c, quantum/matrix.c, and the project layout of the planck
// the online ducmentation starting from :
// https://docs.qmk.fm/#/config_options
// https://docs.qmk.fm/#/understanding_qmk
// and probably a few i forgot.... |
/* Copyright (C) 1991, 1996, 1997 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, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <termios.h>
/* Flush pending data on FD. */
int
tcflush (fd, queue_selector)
int fd;
int queue_selector;
{
switch (queue_selector)
{
case TCIFLUSH:
case TCOFLUSH:
case TCIOFLUSH:
break;
default:
__set_errno (EINVAL);
return -1;
}
__set_errno (ENOSYS);
return -1;
}
stub_warning(tcflush);
#include <stub-tag.h>
|
/*
* Handling of different ABIs (personalities).
*
* We group personalities into execution domains which have their
* own handlers for kernel entry points, signal mapping, etc...
*
* 2001-05-06 Complete rewrite, Christoph Hellwig (hch@infradead.org)
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/module.h>
#include <linux/personality.h>
#include <linux/sched.h>
#include <linux/syscalls.h>
#include <linux/sysctl.h>
#include <linux/types.h>
static void default_handler(int, struct pt_regs *);
static struct exec_domain *exec_domains = &default_exec_domain;
static DEFINE_RWLOCK(exec_domains_lock);
static u_long ident_map[32] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31
};
struct exec_domain default_exec_domain = {
.name = "Linux", /* name */
.handler = default_handler, /* lcall7 causes a seg fault. */
.pers_low = 0, /* PER_LINUX personality. */
.pers_high = 0, /* PER_LINUX personality. */
.signal_map = ident_map, /* Identity map signals. */
.signal_invmap = ident_map, /* - both ways. */
};
static void
default_handler(int segment, struct pt_regs *regp)
{
set_personality(0);
if (current_thread_info()->exec_domain->handler != default_handler)
current_thread_info()->exec_domain->handler(segment, regp);
else
send_sig(SIGSEGV, current, 1);
}
static struct exec_domain *
lookup_exec_domain(u_long personality)
{
struct exec_domain * ep;
u_long pers = personality(personality);
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
if (try_module_get(ep->module))
goto out;
}
#ifdef CONFIG_KMOD
read_unlock(&exec_domains_lock);
request_module("personality-%ld", pers);
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
if (try_module_get(ep->module))
goto out;
}
#endif
ep = &default_exec_domain;
out:
read_unlock(&exec_domains_lock);
return (ep);
}
int
register_exec_domain(struct exec_domain *ep)
{
struct exec_domain *tmp;
int err = -EBUSY;
if (ep == NULL)
return -EINVAL;
if (ep->next != NULL)
return -EBUSY;
write_lock(&exec_domains_lock);
for (tmp = exec_domains; tmp; tmp = tmp->next) {
if (tmp == ep)
goto out;
}
ep->next = exec_domains;
exec_domains = ep;
err = 0;
out:
write_unlock(&exec_domains_lock);
return (err);
}
int
unregister_exec_domain(struct exec_domain *ep)
{
struct exec_domain **epp;
epp = &exec_domains;
write_lock(&exec_domains_lock);
for (epp = &exec_domains; *epp; epp = &(*epp)->next) {
if (ep == *epp)
goto unregister;
}
write_unlock(&exec_domains_lock);
return -EINVAL;
unregister:
*epp = ep->next;
ep->next = NULL;
write_unlock(&exec_domains_lock);
return 0;
}
int
__set_personality(u_long personality)
{
struct exec_domain *ep, *oep;
ep = lookup_exec_domain(personality);
if (ep == current_thread_info()->exec_domain) {
current->personality = personality;
module_put(ep->module);
return 0;
}
if (atomic_read(¤t->fs->count) != 1) {
struct fs_struct *fsp, *ofsp;
fsp = copy_fs_struct(current->fs);
if (fsp == NULL) {
module_put(ep->module);
return -ENOMEM;
}
task_lock(current);
ofsp = current->fs;
current->fs = fsp;
task_unlock(current);
put_fs_struct(ofsp);
}
/*
* At that point we are guaranteed to be the sole owner of
* current->fs.
*/
current->personality = personality;
oep = current_thread_info()->exec_domain;
current_thread_info()->exec_domain = ep;
set_fs_altroot();
module_put(oep->module);
return 0;
}
int
get_exec_domain_list(char *page)
{
struct exec_domain *ep;
int len = 0;
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep && len < PAGE_SIZE - 80; ep = ep->next)
len += sprintf(page + len, "%d-%d\t%-16s\t[%s]\n",
ep->pers_low, ep->pers_high, ep->name,
module_name(ep->module));
read_unlock(&exec_domains_lock);
return (len);
}
asmlinkage long
sys_personality(u_long personality)
{
u_long old = current->personality;
if (personality != 0xffffffff) {
set_personality(personality);
if (current->personality != personality)
return -EINVAL;
}
return (long)old;
}
EXPORT_SYMBOL(register_exec_domain);
EXPORT_SYMBOL(unregister_exec_domain);
EXPORT_SYMBOL(__set_personality);
|
/* Test mpz_cmp and mpz_cmpabs.
Copyright 2001 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MP 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 MP Library. If not, see http://www.gnu.org/licenses/. */
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
#include "gmp-impl.h"
#include "tests.h"
/* Nothing sophisticated here, just exercise some combinations of sizes and
signs. */
void
check_one (mpz_ptr x, mpz_ptr y, int want_cmp, int want_cmpabs)
{
int got;
got = mpz_cmp (x, y);
if (( got < 0) != (want_cmp < 0)
|| (got == 0) != (want_cmp == 0)
|| (got > 0) != (want_cmp > 0))
{
printf ("mpz_cmp got %d want %d\n", got, want_cmp);
mpz_trace ("x", x);
mpz_trace ("y", y);
abort ();
}
got = mpz_cmpabs (x, y);
if (( got < 0) != (want_cmpabs < 0)
|| (got == 0) != (want_cmpabs == 0)
|| (got > 0) != (want_cmpabs > 0))
{
printf ("mpz_cmpabs got %d want %d\n", got, want_cmpabs);
mpz_trace ("x", x);
mpz_trace ("y", y);
abort ();
}
}
void
check_all (mpz_ptr x, mpz_ptr y, int want_cmp, int want_cmpabs)
{
check_one (x, y, want_cmp, want_cmpabs);
check_one (y, x, -want_cmp, -want_cmpabs);
mpz_neg (x, x);
mpz_neg (y, y);
want_cmp = -want_cmp;
check_one (x, y, want_cmp, want_cmpabs);
check_one (y, x, -want_cmp, -want_cmpabs);
}
#define SET1(z,size, n) \
SIZ(z) = size; PTR(z)[0] = n
#define SET2(z,size, n1,n0) \
SIZ(z) = size; PTR(z)[1] = n1; PTR(z)[0] = n0
#define SET4(z,size, n3,n2,n1,n0) \
SIZ(z) = size; PTR(z)[3] = n3; PTR(z)[2] = n2; PTR(z)[1] = n1; PTR(z)[0] = n0
void
check_various (void)
{
mpz_t x, y;
mpz_init (x);
mpz_init (y);
mpz_realloc (x, (mp_size_t) 20);
mpz_realloc (y, (mp_size_t) 20);
/* 0 cmp 0, junk in low limbs */
SET1 (x,0, 123);
SET1 (y,0, 456);
check_all (x, y, 0, 0);
/* 123 cmp 0 */
SET1 (x,1, 123);
SET1 (y,0, 456);
check_all (x, y, 1, 1);
/* 123:456 cmp 0 */
SET2 (x,2, 456,123);
SET1 (y,0, 9999);
check_all (x, y, 1, 1);
/* 123 cmp 123 */
SET1(x,1, 123);
SET1(y,1, 123);
check_all (x, y, 0, 0);
/* -123 cmp 123 */
SET1(x,-1, 123);
SET1(y,1, 123);
check_all (x, y, -1, 0);
/* 123 cmp 456 */
SET1(x,1, 123);
SET1(y,1, 456);
check_all (x, y, -1, -1);
/* -123 cmp 456 */
SET1(x,-1, 123);
SET1(y,1, 456);
check_all (x, y, -1, -1);
/* 123 cmp -456 */
SET1(x,1, 123);
SET1(y,-1, 456);
check_all (x, y, 1, -1);
/* 1:0 cmp 1:0 */
SET2 (x,2, 1,0);
SET2 (y,2, 1,0);
check_all (x, y, 0, 0);
/* -1:0 cmp 1:0 */
SET2 (x,-2, 1,0);
SET2 (y,2, 1,0);
check_all (x, y, -1, 0);
/* 2:0 cmp 1:0 */
SET2 (x,2, 2,0);
SET2 (y,2, 1,0);
check_all (x, y, 1, 1);
/* 4:3:2:1 cmp 2:1 */
SET4 (x,4, 4,3,2,1);
SET2 (y,2, 2,1);
check_all (x, y, 1, 1);
/* -4:3:2:1 cmp 2:1 */
SET4 (x,-4, 4,3,2,1);
SET2 (y,2, 2,1);
check_all (x, y, -1, 1);
mpz_clear (x);
mpz_clear (y);
}
int
main (void)
{
tests_start ();
mp_trace_base = -16;
check_various ();
tests_end ();
exit (0);
}
|
/*
* arch/arm64/include/asm/hugetlb.h
*
* Copyright (C) 2013 Linaro Ltd.
*
* Based on arch/x86/include/asm/hugetlb.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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __ASM_HUGETLB_H
#define __ASM_HUGETLB_H
#include <asm-generic/hugetlb.h>
#include <asm/page.h>
static inline pte_t huge_ptep_get(pte_t *ptep)
{
return *ptep;
}
static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
unsigned long addr, unsigned long end,
unsigned long floor,
unsigned long ceiling)
{
free_pgd_range(tlb, addr, end, floor, ceiling);
}
static inline int is_hugepage_only_range(struct mm_struct *mm,
unsigned long addr, unsigned long len)
{
return 0;
}
static inline int prepare_hugepage_range(struct file *file,
unsigned long addr, unsigned long len)
{
struct hstate *h = hstate_file(file);
if (len & ~huge_page_mask(h))
return -EINVAL;
if (addr & ~huge_page_mask(h))
return -EINVAL;
return 0;
}
static inline int huge_pte_none(pte_t pte)
{
return pte_none(pte);
}
static inline pte_t huge_pte_wrprotect(pte_t pte)
{
return pte_wrprotect(pte);
}
static inline void arch_clear_hugepage_flags(struct page *page)
{
clear_bit(PG_dcache_clean, &page->flags);
}
extern pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
struct page *page, int writable);
#define arch_make_huge_pte arch_make_huge_pte
extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte);
extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep,
pte_t pte, int dirty);
extern pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
unsigned long addr, pte_t *ptep);
extern void huge_ptep_set_wrprotect(struct mm_struct *mm,
unsigned long addr, pte_t *ptep);
extern void huge_ptep_clear_flush(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep);
#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
static inline bool gigantic_page_supported(void) { return true; }
#endif
#endif /* __ASM_HUGETLB_H */
|
/*
* Copyright (C) 2012 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 WebPluginScrollbar_h
#define WebPluginScrollbar_h
#include "../platform/WebCanvas.h"
#include "../platform/WebScrollbar.h"
namespace blink {
class WebInputEvent;
class WebPluginContainer;
class WebPluginScrollbarClient;
struct WebRect;
class WebPluginScrollbar : public WebScrollbar {
public:
// Creates a WebPluginScrollbar for use by a plugin. The plugin container and
// client are guaranteed to outlive this object.
BLINK_EXPORT static WebPluginScrollbar* createForPlugin(WebScrollbar::Orientation,
WebPluginContainer*,
WebPluginScrollbarClient*);
virtual ~WebPluginScrollbar() { }
// Gets the thickness of the scrollbar in pixels.
BLINK_EXPORT static int defaultThickness();
// Sets the rectangle of the scrollbar.
virtual void setLocation(const WebRect&) = 0;
// Sets the size of the scrollable region in pixels, i.e. if a document is
// 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation
// for the vertical scrollbar would have passed in a rectangle like:
// (800 - defaultThickness(), 0) (defaultThickness() x 10000)
// and setDocumentSize(10000)
virtual void setDocumentSize(int) = 0;
// Sets the current value.
virtual void setValue(int position) = 0;
// Scroll back or forward with the given granularity.
virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0;
// Paint the given rectangle.
virtual void paint(WebCanvas*, const WebRect&) = 0;
// Returns true iff the given event was used.
virtual bool handleInputEvent(const WebInputEvent&) = 0;
};
} // namespace blink
#endif
|
#ifndef R2_BTREE_H
#define R2_BTREE_H
#include "r_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct btree_node {
void *data;
int hits; // profiling
struct btree_node *left;
struct btree_node *right;
};
#define BTREE_CMP(x) int (* x )(const void *, const void *)
#define BTREE_DEL(x) int (* x )(void *)
#define BTREE_TRV(x) void (* x )(const void *, const void *)
#ifdef R_API
R_API void btree_init(struct btree_node **T);
R_API struct btree_node *btree_remove(struct btree_node *p, BTREE_DEL(del));
R_API void *btree_search(struct btree_node *proot, void *x, BTREE_CMP(cmp), int parent);
R_API void btree_traverse(struct btree_node *proot, int reverse, void *context, BTREE_TRV(trv));
R_API int btree_del(struct btree_node *proot, void *x, BTREE_CMP(cmp), BTREE_DEL(del));
R_API void *btree_get(struct btree_node *proot, void *x, BTREE_CMP(cmp));
R_API void btree_insert(struct btree_node **T, struct btree_node *p, BTREE_CMP(cmp));
R_API void btree_add(struct btree_node **T, void *e, BTREE_CMP(cmp));
R_API void btree_cleartree(struct btree_node *proot, BTREE_DEL(del));
#endif
#ifdef __cplusplus
}
#endif
#endif
|
// Copyright 2018 The Abseil Authors.
//
// 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
//
// https://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.
//
// -----------------------------------------------------------------------------
// bad_any_cast.h
// -----------------------------------------------------------------------------
//
// This header file defines the `absl::bad_any_cast` type.
#ifndef ABSL_TYPES_BAD_ANY_CAST_H_
#define ABSL_TYPES_BAD_ANY_CAST_H_
#include <typeinfo>
#include "absl/base/config.h"
#ifdef ABSL_USES_STD_ANY
#include <any>
namespace absl {
ABSL_NAMESPACE_BEGIN
using std::bad_any_cast;
ABSL_NAMESPACE_END
} // namespace absl
#else // ABSL_USES_STD_ANY
namespace absl {
ABSL_NAMESPACE_BEGIN
// -----------------------------------------------------------------------------
// bad_any_cast
// -----------------------------------------------------------------------------
//
// An `absl::bad_any_cast` type is an exception type that is thrown when
// failing to successfully cast the return value of an `absl::any` object.
//
// Example:
//
// auto a = absl::any(65);
// absl::any_cast<int>(a); // 65
// try {
// absl::any_cast<char>(a);
// } catch(const absl::bad_any_cast& e) {
// std::cout << "Bad any cast: " << e.what() << '\n';
// }
class bad_any_cast : public std::bad_cast {
public:
~bad_any_cast() override;
const char* what() const noexcept override;
};
namespace any_internal {
[[noreturn]] void ThrowBadAnyCast();
} // namespace any_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_USES_STD_ANY
#endif // ABSL_TYPES_BAD_ANY_CAST_H_
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_POWERPC_NOHASH_TLBFLUSH_H
#define _ASM_POWERPC_NOHASH_TLBFLUSH_H
/*
* TLB flushing:
*
* - flush_tlb_mm(mm) flushes the specified mm context TLB's
* - flush_tlb_page(vma, vmaddr) flushes one page
* - local_flush_tlb_mm(mm, full) flushes the specified mm context on
* the local processor
* - local_flush_tlb_page(vma, vmaddr) flushes one page on the local processor
* - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
* - flush_tlb_range(vma, start, end) flushes a range of pages
* - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
*
*/
/*
* TLB flushing for software loaded TLB chips
*
* TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
* flush_tlb_kernel_range are best implemented as tlbia vs
* specific tlbie's
*/
struct vm_area_struct;
struct mm_struct;
#define MMU_NO_CONTEXT ((unsigned int)-1)
extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
unsigned long end);
extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
extern void local_flush_tlb_mm(struct mm_struct *mm);
extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
extern void __local_flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
int tsize, int ind);
#ifdef CONFIG_SMP
extern void flush_tlb_mm(struct mm_struct *mm);
extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
extern void __flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
int tsize, int ind);
#else
#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
#define flush_tlb_page(vma,addr) local_flush_tlb_page(vma,addr)
#define __flush_tlb_page(mm,addr,p,i) __local_flush_tlb_page(mm,addr,p,i)
#endif
#endif /* _ASM_POWERPC_NOHASH_TLBFLUSH_H */
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtLocation module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPLv3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or later as published by the Free
** Software Foundation and appearing in the file LICENSE.GPL included in
** the packaging of this file. Please review the following information to
** ensure the GNU General Public License version 2.0 requirements will be
** met: http://www.gnu.org/licenses/gpl-2.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QGEOMAPCONTROLLER_P_H
#define QGEOMAPCONTROLLER_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QObject>
#include "qgeocoordinate.h"
#include "qgeocameradata_p.h"
QT_BEGIN_NAMESPACE
class QGeoMap;
class Q_LOCATION_EXPORT QGeoMapController : public QObject
{
Q_OBJECT
Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
Q_PROPERTY(qreal bearing READ bearing WRITE setBearing NOTIFY bearingChanged)
Q_PROPERTY(qreal tilt READ tilt WRITE setTilt NOTIFY tiltChanged)
Q_PROPERTY(qreal roll READ roll WRITE setRoll NOTIFY rollChanged)
Q_PROPERTY(qreal zoom READ zoom WRITE setZoom NOTIFY zoomChanged)
public:
QGeoMapController(QGeoMap *map);
~QGeoMapController();
QGeoCoordinate center() const;
void setCenter(const QGeoCoordinate ¢er);
void setLatitude(qreal latitude);
void setLongitude(qreal longitude);
void setAltitude(qreal altitude);
qreal bearing() const;
void setBearing(qreal bearing);
qreal tilt() const;
void setTilt(qreal tilt);
qreal roll() const;
void setRoll(qreal roll);
qreal zoom() const;
void setZoom(qreal zoom);
void pan(qreal dx, qreal dy);
private Q_SLOTS:
void cameraDataChanged(const QGeoCameraData &cameraData);
Q_SIGNALS:
void centerChanged(const QGeoCoordinate ¢er);
void bearingChanged(qreal bearing);
void tiltChanged(qreal tilt);
void rollChanged(qreal roll);
void zoomChanged(qreal zoom);
private:
QGeoMap *map_;
QGeoCameraData oldCameraData_;
};
QT_END_NAMESPACE
#endif // QGEOMAPCONTROLLER_P_H
|
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_qmf.h,v 1.3 2006-06-14 13:39:13 Narflex Exp $
**/
#ifndef __SBR_QMF_H__
#define __SBR_QMF_H__
#ifdef __cplusplus
extern "C" {
#endif
qmfa_info *qmfa_init(uint8_t channels);
void qmfa_end(qmfa_info *qmfa);
qmfs_info *qmfs_init(uint8_t channels);
void qmfs_end(qmfs_info *qmfs);
void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#ifdef __cplusplus
}
#endif
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_
#define ASH_WM_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_
#include "ash/shell_observer.h"
#include "ui/wm/core/easy_resize_window_targeter.h"
namespace ash {
class PanelLayoutManager;
// A window targeter installed on a panel container to disallow touch
// hit-testing of attached panel edges that are adjacent to the shelf. This
// makes it significantly easier to correctly target shelf buttons with touch.
class AttachedPanelWindowTargeter : public ::wm::EasyResizeWindowTargeter,
public ShellObserver {
public:
AttachedPanelWindowTargeter(aura::Window* container,
const gfx::Insets& default_mouse_extend,
const gfx::Insets& default_touch_extend,
PanelLayoutManager* panel_layout_manager);
~AttachedPanelWindowTargeter() override;
// ShellObserver:
void OnShelfCreatedForRootWindow(aura::Window* root_window) override;
void OnShelfAlignmentChanged(aura::Window* root_window) override;
private:
void UpdateTouchExtend(aura::Window* root_window);
aura::Window* panel_container_;
PanelLayoutManager* panel_layout_manager_;
gfx::Insets default_touch_extend_;
DISALLOW_COPY_AND_ASSIGN(AttachedPanelWindowTargeter);
};
} // namespace ash
#endif // ASH_WM_PANELS_ATTACHED_PANEL_WINDOW_TARGETER_H_
|
/*
* fs/cifs/cifs_fs_sb.h
*
* Copyright (c) International Business Machines Corp., 2002,2004
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU Lesser General Public License for more details.
*
*/
#ifndef _CIFS_FS_SB_H
#define _CIFS_FS_SB_H
#include <linux/backing-dev.h>
#define CIFS_MOUNT_NO_PERM 1 /* do not do client vfs_perm check */
#define CIFS_MOUNT_SET_UID 2 /* set current's euid in create etc. */
#define CIFS_MOUNT_SERVER_INUM 4 /* inode numbers from uniqueid from server */
#define CIFS_MOUNT_DIRECT_IO 8 /* do not write nor read through page cache */
#define CIFS_MOUNT_NO_XATTR 0x10 /* if set - disable xattr support */
#define CIFS_MOUNT_MAP_SPECIAL_CHR 0x20 /* remap illegal chars in filenames */
#define CIFS_MOUNT_POSIX_PATHS 0x40 /* Negotiate posix pathnames if possible*/
#define CIFS_MOUNT_UNX_EMUL 0x80 /* Network compat with SFUnix emulation */
#define CIFS_MOUNT_NO_BRL 0x100 /* No sending byte range locks to srv */
#define CIFS_MOUNT_CIFS_ACL 0x200 /* send ACL requests to non-POSIX srv */
#define CIFS_MOUNT_OVERR_UID 0x400 /* override uid returned from server */
#define CIFS_MOUNT_OVERR_GID 0x800 /* override gid returned from server */
#define CIFS_MOUNT_DYNPERM 0x1000 /* allow in-memory only mode setting */
#define CIFS_MOUNT_NOPOSIXBRL 0x2000 /* mandatory not posix byte range lock */
#define CIFS_MOUNT_NOSSYNC 0x4000 /* don't do slow SMBflush on every sync*/
struct cifs_sb_info {
struct cifsTconInfo *tcon; /* primary mount */
struct list_head nested_tcon_q;
struct nls_table *local_nls;
unsigned int rsize;
unsigned int wsize;
uid_t mnt_uid;
gid_t mnt_gid;
mode_t mnt_file_mode;
mode_t mnt_dir_mode;
int mnt_cifs_flags;
int prepathlen;
char *prepath; /* relative path under the share to mount to */
#ifdef CONFIG_CIFS_DFS_UPCALL
char *mountdata; /* mount options received at mount time */
#endif
struct backing_dev_info bdi;
};
#endif /* _CIFS_FS_SB_H */
|
/*
* This control block defines the PACA which defines the processor
* specific data for each logical processor on the system.
* There are some pointers defined that are utilized by PLIC.
*
* C 2001 PPC 64 Team, IBM Corp
*
* 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 _ASM_POWERPC_PACA_H
#define _ASM_POWERPC_PACA_H
#ifdef __KERNEL__
#ifdef CONFIG_PPC64
#include <linux/init.h>
#include <asm/types.h>
#include <asm/lppaca.h>
#include <asm/mmu.h>
#include <asm/page.h>
#include <asm/exception-64e.h>
#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
#include <asm/kvm_book3s_asm.h>
#endif
register struct paca_struct *local_paca asm("r13");
#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP)
extern unsigned int debug_smp_processor_id(void);
#define get_paca() ((void) debug_smp_processor_id(), local_paca)
#else
#define get_paca() local_paca
#endif
#define get_lppaca() (get_paca()->lppaca_ptr)
#define get_slb_shadow() (get_paca()->slb_shadow_ptr)
struct task_struct;
struct opal_machine_check_event;
struct paca_struct {
#ifdef CONFIG_PPC_BOOK3S
struct lppaca *lppaca_ptr;
#endif
u16 lock_token;
u16 paca_index;
u64 kernel_toc;
u64 kernelbase;
u64 kernel_msr;
#ifdef CONFIG_PPC_STD_MMU_64
u64 stab_real;
u64 stab_addr;
#endif
void *emergency_sp;
u64 data_offset;
s16 hw_cpu_id;
u8 cpu_start;
u8 kexec_state;
#ifdef CONFIG_PPC_STD_MMU_64
struct slb_shadow *slb_shadow_ptr;
struct dtl_entry *dispatch_log;
struct dtl_entry *dispatch_log_end;
u64 exgen[11] __attribute__((aligned(0x80)));
u64 exmc[11];
u64 exslb[11];
u16 vmalloc_sllp;
u16 slb_cache_ptr;
u16 slb_cache[SLB_CACHE_ENTRIES];
#endif
#ifdef CONFIG_PPC_BOOK3E
u64 exgen[8] __attribute__((aligned(0x80)));
pgd_t *pgd __attribute__((aligned(0x80)));
pgd_t *kernel_pgd;
u64 extlb[3][EX_TLB_SIZE / sizeof(u64)];
u64 exmc[8];
u64 excrit[8];
u64 exdbg[8];
void *mc_kstack;
void *crit_kstack;
void *dbg_kstack;
#endif
mm_context_t context;
struct task_struct *__current;
u64 kstack;
u64 stab_rr;
u64 saved_r1;
u64 saved_msr;
u16 trap_save;
u8 soft_enabled;
u8 irq_happened;
u8 io_sync;
u8 irq_work_pending;
u8 nap_state_lost;
#ifdef CONFIG_PPC_POWERNV
struct opal_machine_check_event *opal_mc_evt;
#endif
u64 user_time;
u64 system_time;
u64 user_time_scaled;
u64 starttime;
u64 starttime_user;
u64 startspurr;
u64 utime_sspurr;
u64 stolen_time;
u64 dtl_ridx;
struct dtl_entry *dtl_curr;
#ifdef CONFIG_KVM_BOOK3S_HANDLER
#ifdef CONFIG_KVM_BOOK3S_PR
struct kvmppc_book3s_shadow_vcpu shadow_vcpu;
#endif
struct kvmppc_host_state kvm_hstate;
#endif
};
extern struct paca_struct *paca;
extern __initdata struct paca_struct boot_paca;
extern void initialise_paca(struct paca_struct *new_paca, int cpu);
extern void setup_paca(struct paca_struct *new_paca);
extern void allocate_pacas(void);
extern void free_unused_pacas(void);
#else
static inline void allocate_pacas(void) { };
static inline void free_unused_pacas(void) { };
#endif
#endif
#endif
|
/*
* linux/arch/arm/mach-clps711x/p720t.c
*
* Copyright (C) 2000-2001 Deep Blue Solutions Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, 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/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <asm/pgtable.h>
#include <asm/page.h>
#include <asm/setup.h>
#include <asm/sizes.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/syspld.h>
#include "common.h"
static struct map_desc p720t_io_desc[] __initdata = {
{
.virtual = SYSPLD_VIRT_BASE,
.pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
.length = SZ_1M,
.type = MT_DEVICE
}, {
.virtual = 0xfe400000,
.pfn = __phys_to_pfn(0x10400000),
.length = SZ_1M,
.type = MT_DEVICE
}
};
static void __init
fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
{
if (tag->hdr.tag != ATAG_CORE) {
tag->hdr.tag = ATAG_CORE;
tag->hdr.size = tag_size(tag_core);
tag->u.core.flags = 0;
tag->u.core.pagesize = PAGE_SIZE;
tag->u.core.rootdev = 0x0100;
tag = tag_next(tag);
tag->hdr.tag = ATAG_MEM;
tag->hdr.size = tag_size(tag_mem32);
tag->u.mem.size = 4096;
tag->u.mem.start = PHYS_OFFSET;
tag = tag_next(tag);
tag->hdr.tag = ATAG_NONE;
tag->hdr.size = 0;
}
}
static void __init p720t_map_io(void)
{
clps711x_map_io();
iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
}
MACHINE_START(P720T, "ARM-Prospector720T")
.atag_offset = 0x100,
.fixup = fixup_p720t,
.map_io = p720t_map_io,
.init_irq = clps711x_init_irq,
.timer = &clps711x_timer,
.restart = clps711x_restart,
MACHINE_END
static int p720t_hw_init(void)
{
PLD_LCDEN = 0;
PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
PLD_KBD = 0;
PLD_IO = 0;
PLD_IRDA = 0;
PLD_CODEC = 0;
PLD_TCH = 0;
PLD_SPI = 0;
#ifndef CONFIG_DEBUG_LL
PLD_COM2 = 0;
PLD_COM1 = 0;
#endif
return 0;
}
__initcall(p720t_hw_init);
|
#ifndef _ASMAXP_UCONTEXT_H
#define _ASMAXP_UCONTEXT_H
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
old_sigset_t uc_osf_sigmask;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask;
};
#endif
|
#include <linux/if_ether.h>
#include <linux/types.h>
struct rx_header {
ushort pad;
ushort rx_count;
ushort rx_status;
ushort cur_addr;
};
#define PAR_DATA 0
#define PAR_STATUS 1
#define PAR_CONTROL 2
enum chip_type { RTL8002, RTL8012 };
#define Ctrl_LNibRead 0x08
#define Ctrl_HNibRead 0
#define Ctrl_LNibWrite 0x08
#define Ctrl_HNibWrite 0
#define Ctrl_SelData 0x04
#define Ctrl_IRQEN 0x10
#define EOW 0xE0
#define EOC 0xE0
#define WrAddr 0x40
#define RdAddr 0xC0
#define HNib 0x10
enum page0_regs
{
PAR0 = 0, PAR1 = 1, PAR2 = 2, PAR3 = 3, PAR4 = 4, PAR5 = 5,
TxCNT0 = 6, TxCNT1 = 7,
TxSTAT = 8, RxSTAT = 9,
ISR = 10, IMR = 11,
CMR1 = 12,
CMR2 = 13,
MODSEL = 14,
MAR = 14,
CMR2_h = 0x1d, };
enum eepage_regs
{ PROM_CMD = 6, PROM_DATA = 7 };
#define ISR_TxOK 0x01
#define ISR_RxOK 0x04
#define ISR_TxErr 0x02
#define ISRh_RxErr 0x11
#define CMR1h_MUX 0x08
#define CMR1h_RESET 0x04
#define CMR1h_RxENABLE 0x02
#define CMR1h_TxENABLE 0x01
#define CMR1h_TxRxOFF 0x00
#define CMR1_ReXmit 0x08
#define CMR1_Xmit 0x04
#define CMR1_IRQ 0x02
#define CMR1_BufEnb 0x01
#define CMR1_NextPkt 0x01
#define CMR2_NULL 8
#define CMR2_IRQOUT 9
#define CMR2_RAMTEST 10
#define CMR2_EEPROM 12
#define CMR2h_OFF 0
#define CMR2h_Physical 1
#define CMR2h_Normal 2
#define CMR2h_PROMISC 3
static inline unsigned char inbyte(unsigned short port)
{
unsigned char _v;
__asm__ __volatile__ ("inb %w1,%b0" :"=a" (_v):"d" (port));
return _v;
}
static inline unsigned char read_nibble(short port, unsigned char offset)
{
unsigned char retval;
outb(EOC+offset, port + PAR_DATA);
outb(RdAddr+offset, port + PAR_DATA);
inbyte(port + PAR_STATUS);
retval = inbyte(port + PAR_STATUS);
outb(EOC+offset, port + PAR_DATA);
return retval;
}
static inline unsigned char read_byte_mode0(short ioaddr)
{
unsigned char low_nib;
outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS);
inbyte(ioaddr + PAR_STATUS);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
}
static inline unsigned char read_byte_mode2(short ioaddr)
{
unsigned char low_nib;
outb(Ctrl_LNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(Ctrl_HNibRead, ioaddr + PAR_CONTROL);
inbyte(ioaddr + PAR_STATUS);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
}
static inline unsigned char read_byte_mode4(short ioaddr)
{
unsigned char low_nib;
outb(RdAddr | MAR, ioaddr + PAR_DATA);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
}
static inline unsigned char read_byte_mode6(short ioaddr)
{
unsigned char low_nib;
outb(RdAddr | MAR, ioaddr + PAR_DATA);
inbyte(ioaddr + PAR_STATUS);
low_nib = (inbyte(ioaddr + PAR_STATUS) >> 3) & 0x0f;
outb(RdAddr | HNib | MAR, ioaddr + PAR_DATA);
inbyte(ioaddr + PAR_STATUS);
return low_nib | ((inbyte(ioaddr + PAR_STATUS) << 1) & 0xf0);
}
static inline void
write_reg(short port, unsigned char reg, unsigned char value)
{
unsigned char outval;
outb(EOC | reg, port + PAR_DATA);
outval = WrAddr | reg;
outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outval &= 0xf0;
outval |= value;
outb(outval, port + PAR_DATA);
outval &= 0x1f;
outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outb(EOC | outval, port + PAR_DATA);
}
static inline void
write_reg_high(short port, unsigned char reg, unsigned char value)
{
unsigned char outval = EOC | HNib | reg;
outb(outval, port + PAR_DATA);
outval &= WrAddr | HNib | 0x0f;
outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outval = WrAddr | HNib | value;
outb(outval, port + PAR_DATA);
outval &= HNib | 0x0f;
outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outb(EOC | HNib | outval, port + PAR_DATA);
}
/* Write a byte out using nibble mode. The low nibble is written first. */
static inline void
write_reg_byte(short port, unsigned char reg, unsigned char value)
{
unsigned char outval;
outb(EOC | reg, port + PAR_DATA);
outval = WrAddr | reg;
outb(outval, port + PAR_DATA);
outb(outval, port + PAR_DATA);
outb((outval & 0xf0) | (value & 0x0f), port + PAR_DATA);
outb(value & 0x0f, port + PAR_DATA);
value >>= 4;
outb(value, port + PAR_DATA);
outb(0x10 | value, port + PAR_DATA);
outb(0x10 | value, port + PAR_DATA);
outb(EOC | value, port + PAR_DATA);
}
static inline void write_byte_mode0(short ioaddr, unsigned char value)
{
outb(value & 0x0f, ioaddr + PAR_DATA);
outb((value>>4) | 0x10, ioaddr + PAR_DATA);
}
static inline void write_byte_mode1(short ioaddr, unsigned char value)
{
outb(value & 0x0f, ioaddr + PAR_DATA);
outb(Ctrl_IRQEN | Ctrl_LNibWrite, ioaddr + PAR_CONTROL);
outb((value>>4) | 0x10, ioaddr + PAR_DATA);
outb(Ctrl_IRQEN | Ctrl_HNibWrite, ioaddr + PAR_CONTROL);
}
static inline void write_word_mode0(short ioaddr, unsigned short value)
{
outb(value & 0x0f, ioaddr + PAR_DATA);
value >>= 4;
outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA);
value >>= 4;
outb(value & 0x0f, ioaddr + PAR_DATA);
value >>= 4;
outb((value & 0x0f) | 0x10, ioaddr + PAR_DATA);
}
#define EE_SHIFT_CLK 0x04
#define EE_CS 0x02
#define EE_CLK_HIGH 0x12
#define EE_CLK_LOW 0x16
#define EE_DATA_WRITE 0x01
#define EE_DATA_READ 0x08
#define eeprom_delay(ticks) \
do { int _i = 40; while (--_i > 0) { __SLOW_DOWN_IO; }} while (0)
#define EE_WRITE_CMD(offset) (((5 << 6) + (offset)) << 17)
#define EE_READ(offset) (((6 << 6) + (offset)) << 17)
#define EE_ERASE(offset) (((7 << 6) + (offset)) << 17)
#define EE_CMD_SIZE 27
|
/*
* Copyright (C) 2007 HTC Incorporated
* Author: Jay Tu (jay_tu@htc.com)
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _HTC_BATTERY_COMMON_H_
#define _HTC_BATTERY_COMMON_H_
enum charger_type_t {
CHARGER_UNKNOWN = -1,
CHARGER_BATTERY = 0,
CHARGER_USB,
CHARGER_AC,
CHARGER_9V_AC,
CHARGER_WIRELESS,
CHARGER_MHL_AC,
CHARGER_DETECTING,
CHARGER_UNKNOWN_USB,
};
enum power_supplies_type {
BATTERY_SUPPLY,
USB_SUPPLY,
AC_SUPPLY,
WIRELESS_SUPPLY
};
enum charger_control_flag {
STOP_CHARGER = 0,
ENABLE_CHARGER,
ENABLE_LIMIT_CHARGER,
DISABLE_LIMIT_CHARGER,
DISABLE_PWRSRC,
ENABLE_PWRSRC,
END_CHARGER
};
#define HTC_BATT_CHG_LIMIT_BIT_TALK (1)
#define HTC_BATT_CHG_LIMIT_BIT_NAVI (1<<1)
#define HTC_BATT_CHG_LIMIT_BIT_THRML (1<<2)
enum batt_context_event {
EVENT_TALK_START = 0,
EVENT_TALK_STOP,
EVENT_NETWORK_SEARCH_START,
EVENT_NETWORK_SEARCH_STOP,
EVENT_NAVIGATION_START,
EVENT_NAVIGATION_STOP
};
int htc_battery_charger_disable(void);
int htc_battery_pwrsrc_disable(void);
int htc_battery_get_zcharge_mode(void);
#endif
|
// -*- C++ -*- compatibility header.
// Copyright (C) 2002-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This 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 General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdio.h
* This is a Standard C++ Library header.
*/
#include <cstdio>
#ifndef _GLIBCXX_STDIO_H
#define _GLIBCXX_STDIO_H 1
#ifdef _GLIBCXX_NAMESPACE_C
using std::FILE;
using std::fpos_t;
using std::remove;
using std::rename;
using std::tmpfile;
using std::tmpnam;
using std::fclose;
using std::fflush;
using std::fopen;
using std::freopen;
using std::setbuf;
using std::setvbuf;
using std::fprintf;
using std::fscanf;
using std::printf;
using std::scanf;
using std::snprintf;
using std::sprintf;
using std::sscanf;
using std::vfprintf;
using std::vfscanf;
using std::vprintf;
using std::vscanf;
using std::vsnprintf;
using std::vsprintf;
using std::vsscanf;
using std::fgetc;
using std::fgets;
using std::fputc;
using std::fputs;
using std::getc;
using std::getchar;
using std::gets;
using std::putc;
using std::putchar;
using std::puts;
using std::ungetc;
using std::fread;
using std::fwrite;
using std::fgetpos;
using std::fseek;
using std::fsetpos;
using std::ftell;
using std::rewind;
using std::clearerr;
using std::feof;
using std::ferror;
using std::perror;
#endif
#endif
|
/**
******************************************************************************
* @file usbh_hcs.h
* @author MCD Application Team
* @version V2.1.0
* @date 19-March-2012
* @brief Header file for usbh_hcs.c
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2
*
* 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.
*
******************************************************************************
*/
/* Define to prevent recursive ----------------------------------------------*/
#ifndef __USBH_HCS_H
#define __USBH_HCS_H
/* Includes ------------------------------------------------------------------*/
#include "usbh_core.h"
/** @addtogroup USBH_LIB
* @{
*/
/** @addtogroup USBH_LIB_CORE
* @{
*/
/** @defgroup USBH_HCS
* @brief This file is the header file for usbh_hcs.c
* @{
*/
/** @defgroup USBH_HCS_Exported_Defines
* @{
*/
#define HC_MAX 8
#define HC_OK 0x0000
#define HC_USED 0x8000
#define HC_ERROR 0xFFFF
#define HC_USED_MASK 0x7FFF
/**
* @}
*/
/** @defgroup USBH_HCS_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup USBH_HCS_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup USBH_HCS_Exported_Variables
* @{
*/
/**
* @}
*/
/** @defgroup USBH_HCS_Exported_FunctionsPrototype
* @{
*/
uint8_t USBH_Alloc_Channel(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr);
uint8_t USBH_Free_Channel (USB_OTG_CORE_HANDLE *pdev, uint8_t idx);
uint8_t USBH_DeAllocate_AllChannel (USB_OTG_CORE_HANDLE *pdev);
uint8_t USBH_Open_Channel (USB_OTG_CORE_HANDLE *pdev,
uint8_t ch_num,
uint8_t dev_address,
uint8_t speed,
uint8_t ep_type,
uint16_t mps);
uint8_t USBH_Modify_Channel (USB_OTG_CORE_HANDLE *pdev,
uint8_t hc_num,
uint8_t dev_address,
uint8_t speed,
uint8_t ep_type,
uint16_t mps);
/**
* @}
*/
#endif /* __USBH_HCS_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* (C) Copyright 2013 Keymile AG
* Valentin Longchamp <valentin.longchamp@keymile.com>
*
* Copyright 2009-2011 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <i2c.h>
#include <hwconfig.h>
#include <asm/mmu.h>
#include <fsl_ddr_sdram.h>
#include <fsl_ddr_dimm_params.h>
void fsl_ddr_board_options(memctl_options_t *popts,
dimm_params_t *pdimm,
unsigned int ctrl_num)
{
if (ctrl_num) {
printf("Wrong parameter for controller number %d", ctrl_num);
return;
}
/* automatic calibration for nb of cycles between read and DQS pre */
popts->cpo_override = 0xFF;
/* 1/2 clk delay between wr command and data strobe */
popts->write_data_delay = 4;
/* clk lauched 1/2 applied cylcle after address command */
popts->clk_adjust = 4;
/* 1T timing: command/address held for only 1 cycle */
popts->twot_en = 0;
/* we have only one module, half str should be OK */
popts->half_strength_driver_enable = 1;
/* wrlvl values overriden as recommended by ddr init func */
popts->wrlvl_override = 1;
popts->wrlvl_sample = 0xf;
popts->wrlvl_start = 0x6;
/* Enable ZQ calibration */
popts->zq_en = 1;
/* DHC_EN =1, ODT = 75 Ohm */
popts->ddr_cdr1 = DDR_CDR1_DHC_EN | DDR_CDR_ODT_75ohm;
}
phys_size_t initdram(int board_type)
{
phys_size_t dram_size = 0;
puts("Initializing with SPD\n");
dram_size = fsl_ddr_sdram();
dram_size = setup_ddr_tlbs(dram_size / 0x100000);
dram_size *= 0x100000;
debug(" DDR: ");
return dram_size;
}
|
/* 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, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0e, k0f, k0g, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k0d, k1d, k1e, k1f, k1g, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f, k2g, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d, k4f, \
k50, k51, k52, k56, k5b, k5c, k5d, k5e, k5f, k5g \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, k0f, k0g }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f, k2g }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, XXX, XXX, XXX }, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d, XXX, k4f, XXX }, \
{ k50, k51, k52, XXX, XXX, XXX, k56, XXX, XXX, XXX, XXX, k5b, k5c, k5d, k5e, k5f, k5g } \
}
#define LAYOUT_ansi( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0e, k0f, k0g, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f, k2g, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3d, \
k40, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4f, \
k50, k51, k52, k56, k5b, k5c, k5d, k5e, k5f, k5g \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, XXX, k0e, k0f, k0g }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e, k2f, k2g }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, XXX, k3d, XXX, XXX, XXX }, \
{ k40, XXX, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, XXX, XXX, k4f, XXX }, \
{ k50, k51, k52, XXX, XXX, XXX, k56, XXX, XXX, XXX, XXX, k5b, k5c, k5d, k5e, k5f, k5g } \
}
#define LAYOUT_iso( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0e, k0f, k0g, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2e, k2f, k2g, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \
k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4f, \
k50, k51, k52, k56, k5b, k5c, k5d, k5e, k5f, k5g \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, XXX, k0e, k0f, k0g }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, k1f, k1g }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, XXX, k2e, k2f, k2g }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, XXX, XXX, XXX }, \
{ k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, XXX, XXX, k4f, XXX }, \
{ k50, k51, k52, XXX, XXX, XXX, k56, XXX, XXX, XXX, XXX, k5b, k5c, k5d, k5e, k5f, k5g } \
}
|
/*
ucg_pixel.c
Universal uC Color Graphics Library
Copyright (c) 2013, olikraus@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS 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 "ucg.h"
void ucg_SetColor(ucg_t *ucg, uint8_t idx, uint8_t r, uint8_t g, uint8_t b)
{
//ucg->arg.pixel.rgb.color[0] = r;
//ucg->arg.pixel.rgb.color[1] = g;
//ucg->arg.pixel.rgb.color[2] = b;
ucg->arg.rgb[idx].color[0] = r;
ucg->arg.rgb[idx].color[1] = g;
ucg->arg.rgb[idx].color[2] = b;
}
void ucg_DrawPixel(ucg_t *ucg, ucg_int_t x, ucg_int_t y)
{
ucg->arg.pixel.rgb.color[0] = ucg->arg.rgb[0].color[0];
ucg->arg.pixel.rgb.color[1] = ucg->arg.rgb[0].color[1];
ucg->arg.pixel.rgb.color[2] = ucg->arg.rgb[0].color[2];
ucg->arg.pixel.pos.x = x;
ucg->arg.pixel.pos.y = y;
ucg_DrawPixelWithArg(ucg);
}
|
/*************************************************************************/
/* broad_phase_2d_basic.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* 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 BROAD_PHASE_2D_BASIC_H
#define BROAD_PHASE_2D_BASIC_H
#include "space_2d_sw.h"
#include "map.h"
class BroadPhase2DBasic : public BroadPhase2DSW {
struct Element {
CollisionObject2DSW *owner;
bool _static;
Rect2 aabb;
int subindex;
};
Map<ID,Element> element_map;
ID current;
struct PairKey {
union {
struct {
ID a;
ID b;
};
uint64_t key;
};
_FORCE_INLINE_ bool operator<(const PairKey& p_key) const {
return key < p_key.key;
}
PairKey() { key=0; }
PairKey(ID p_a, ID p_b) { if (p_a>p_b) { a=p_b; b=p_a; } else { a=p_a; b=p_b; }}
};
Map<PairKey,void*> pair_map;
PairCallback pair_callback;
void *pair_userdata;
UnpairCallback unpair_callback;
void *unpair_userdata;
public:
// 0 is an invalid ID
virtual ID create(CollisionObject2DSW *p_object_, int p_subindex=0);
virtual void move(ID p_id, const Rect2& p_aabb);
virtual void set_static(ID p_id, bool p_static);
virtual void remove(ID p_id);
virtual CollisionObject2DSW *get_object(ID p_id) const;
virtual bool is_static(ID p_id) const;
virtual int get_subindex(ID p_id) const;
virtual int cull_segment(const Vector2& p_from, const Vector2& p_to,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices=NULL);
virtual int cull_aabb(const Rect2& p_aabb,CollisionObject2DSW** p_results,int p_max_results,int *p_result_indices=NULL);
virtual void set_pair_callback(PairCallback p_pair_callback,void *p_userdata);
virtual void set_unpair_callback(UnpairCallback p_unpair_callback,void *p_userdata);
virtual void update();
static BroadPhase2DSW *_create();
BroadPhase2DBasic();
};
#endif // BROAD_PHASE_2D_BASIC_H
|
/*
* Copyright 2016 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_DCN10_CM_COMMON_H__
#define __DAL_DCN10_CM_COMMON_H__
#define TF_HELPER_REG_FIELD_LIST(type) \
type exp_region0_lut_offset; \
type exp_region0_num_segments; \
type exp_region1_lut_offset; \
type exp_region1_num_segments;\
type field_region_end;\
type field_region_end_slope;\
type field_region_end_base;\
type exp_region_start;\
type exp_resion_start_segment;\
type field_region_linear_slope
#define TF_HELPER_REG_LIST \
uint32_t start_cntl_b; \
uint32_t start_cntl_g; \
uint32_t start_cntl_r; \
uint32_t start_slope_cntl_b; \
uint32_t start_slope_cntl_g; \
uint32_t start_slope_cntl_r; \
uint32_t start_end_cntl1_b; \
uint32_t start_end_cntl2_b; \
uint32_t start_end_cntl1_g; \
uint32_t start_end_cntl2_g; \
uint32_t start_end_cntl1_r; \
uint32_t start_end_cntl2_r; \
uint32_t region_start; \
uint32_t region_end
#define TF_CM_REG_FIELD_LIST(type) \
type csc_c11; \
type csc_c12
struct xfer_func_shift {
TF_HELPER_REG_FIELD_LIST(uint8_t);
};
struct xfer_func_mask {
TF_HELPER_REG_FIELD_LIST(uint32_t);
};
struct xfer_func_reg {
struct xfer_func_shift shifts;
struct xfer_func_mask masks;
TF_HELPER_REG_LIST;
};
struct cm_color_matrix_shift {
TF_CM_REG_FIELD_LIST(uint8_t);
};
struct cm_color_matrix_mask {
TF_CM_REG_FIELD_LIST(uint32_t);
};
struct color_matrices_reg{
struct cm_color_matrix_shift shifts;
struct cm_color_matrix_mask masks;
uint32_t csc_c11_c12;
uint32_t csc_c33_c34;
};
void cm_helper_program_color_matrices(
struct dc_context *ctx,
const uint16_t *regval,
const struct color_matrices_reg *reg);
void cm_helper_program_xfer_func(
struct dc_context *ctx,
const struct pwl_params *params,
const struct xfer_func_reg *reg);
bool cm_helper_convert_to_custom_float(
struct pwl_result_data *rgb_resulted,
struct curve_points3 *corner_points,
uint32_t hw_points_num,
bool fixpoint);
bool cm_helper_translate_curve_to_hw_format(
const struct dc_transfer_func *output_tf,
struct pwl_params *lut_params, bool fixpoint);
bool cm_helper_translate_curve_to_degamma_hw_format(
const struct dc_transfer_func *output_tf,
struct pwl_params *lut_params);
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_
#define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SINK_H_
#include "content/public/renderer/media_stream_video_sink.h"
#include "base/memory/weak_ptr.h"
#include "content/common/media/video_capture.h"
#include "media/base/video_frame.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace content {
class MockMediaStreamVideoSink : public MediaStreamVideoSink {
public:
MockMediaStreamVideoSink();
virtual ~MockMediaStreamVideoSink();
virtual void OnReadyStateChanged(
blink::WebMediaStreamSource::ReadyState state) OVERRIDE;
virtual void OnEnabledChanged(bool enabled) OVERRIDE;
// Triggered when OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame)
// is called.
MOCK_METHOD0(OnVideoFrame, void());
VideoCaptureDeliverFrameCB GetDeliverFrameCB();
int number_of_frames() const { return number_of_frames_; }
media::VideoFrame::Format format() const { return format_; }
gfx::Size frame_size() const { return frame_size_; }
scoped_refptr<media::VideoFrame> last_frame() const { return last_frame_; };
bool enabled() const { return enabled_; }
blink::WebMediaStreamSource::ReadyState state() const { return state_; }
private:
void DeliverVideoFrame(
const scoped_refptr<media::VideoFrame>& frame,
const media::VideoCaptureFormat& format,
const base::TimeTicks& estimated_capture_time);
int number_of_frames_;
bool enabled_;
media::VideoFrame::Format format_;
blink::WebMediaStreamSource::ReadyState state_;
gfx::Size frame_size_;
scoped_refptr<media::VideoFrame> last_frame_;
base::WeakPtrFactory<MockMediaStreamVideoSink> weak_factory_;
};
} // namespace content
#endif
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_BUILD_TIME_H_
#define BASE_BUILD_TIME_H_
#include "base/base_export.h"
#include "base/time/time.h"
namespace base {
// GetBuildTime returns the time at which the current binary was built,
// rounded down to 5:00:00am at the start of the day in UTC.
//
// This uses a generated file, which doesn't trigger a rebuild when the time
// changes. It will, however, be updated whenever //build/util/LASTCHANGE
// changes.
//
// This value should only be considered accurate to within a day.
// It will always be in the past.
//
// Note: If the build is not official (i.e. is_official_build = false)
// this time will be set to 5:00:00am on the most recent first Sunday
// of a month.
Time BASE_EXPORT GetBuildTime();
} // namespace base
#endif // BASE_BUILD_TIME_H_
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Users/ex3ndr/Develop/actor-proprietary/actor-apps/core/src/main/java/im/actor/model/api/rpc/RequestDisableInterests.java
//
#ifndef _APRequestDisableInterests_H_
#define _APRequestDisableInterests_H_
#include "J2ObjC_header.h"
#include "im/actor/model/network/parser/Request.h"
@class BSBserValues;
@class BSBserWriter;
@class IOSByteArray;
@protocol JavaUtilList;
#define APRequestDisableInterests_HEADER 158
@interface APRequestDisableInterests : APRequest
#pragma mark Public
- (instancetype)init;
- (instancetype)initWithJavaUtilList:(id<JavaUtilList>)interests;
+ (APRequestDisableInterests *)fromBytesWithByteArray:(IOSByteArray *)data;
- (jint)getHeaderKey;
- (id<JavaUtilList>)getInterests;
- (void)parseWithBSBserValues:(BSBserValues *)values;
- (void)serializeWithBSBserWriter:(BSBserWriter *)writer;
- (NSString *)description;
@end
J2OBJC_EMPTY_STATIC_INIT(APRequestDisableInterests)
J2OBJC_STATIC_FIELD_GETTER(APRequestDisableInterests, HEADER, jint)
FOUNDATION_EXPORT APRequestDisableInterests *APRequestDisableInterests_fromBytesWithByteArray_(IOSByteArray *data);
FOUNDATION_EXPORT void APRequestDisableInterests_initWithJavaUtilList_(APRequestDisableInterests *self, id<JavaUtilList> interests);
FOUNDATION_EXPORT APRequestDisableInterests *new_APRequestDisableInterests_initWithJavaUtilList_(id<JavaUtilList> interests) NS_RETURNS_RETAINED;
FOUNDATION_EXPORT void APRequestDisableInterests_init(APRequestDisableInterests *self);
FOUNDATION_EXPORT APRequestDisableInterests *new_APRequestDisableInterests_init() NS_RETURNS_RETAINED;
J2OBJC_TYPE_LITERAL_HEADER(APRequestDisableInterests)
typedef APRequestDisableInterests ImActorModelApiRpcRequestDisableInterests;
#endif // _APRequestDisableInterests_H_
|
/* Copyright 2020 Ross Montsinger
*
* 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"
/* This is 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( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \
K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, \
K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \
K40, K41, K43, K44, K45, K46, K47, K48, K4B, K4C, K4D \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, KC_NO }, \
{ K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D }, \
{ K40, K41, K41, K43, K44, K45, K46, K47, K48, K48, K48, K4B, K4C, K4D } \
}
|
/*
* MPC8360E-RDK board file.
*
* Copyright (c) 2006 Freescale Semicondutor, Inc.
* Copyright (c) 2007-2008 MontaVista Software, Inc.
*
* Author: Anton Vorontsov <avorontsov@ru.mvista.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/of_platform.h>
#include <linux/io.h>
#include <asm/prom.h>
#include <asm/time.h>
#include <asm/ipic.h>
#include <asm/udbg.h>
#include <asm/qe.h>
#include <asm/qe_ic.h>
#include <sysdev/fsl_soc.h>
#include <sysdev/fsl_pci.h>
#include "mpc83xx.h"
static struct of_device_id __initdata mpc836x_rdk_ids[] = {
{ .compatible = "simple-bus", },
{},
};
static int __init mpc836x_rdk_declare_of_platform_devices(void)
{
return of_platform_bus_probe(NULL, mpc836x_rdk_ids, NULL);
}
machine_device_initcall(mpc836x_rdk, mpc836x_rdk_declare_of_platform_devices);
static void __init mpc836x_rdk_setup_arch(void)
{
#ifdef CONFIG_PCI
struct device_node *np;
#endif
if (ppc_md.progress)
ppc_md.progress("mpc836x_rdk_setup_arch()", 0);
#ifdef CONFIG_PCI
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
qe_reset();
}
static void __init mpc836x_rdk_init_IRQ(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
if (!np)
return;
ipic_init(np, 0);
/*
* Initialize the default interrupt mapping priorities,
* in case the boot rom changed something on us.
*/
ipic_set_default_priority();
of_node_put(np);
np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
if (!np)
return;
qe_ic_init(np, 0, qe_ic_cascade_low_ipic, qe_ic_cascade_high_ipic);
of_node_put(np);
}
/*
* Called very early, MMU is off, device-tree isn't unflattened.
*/
static int __init mpc836x_rdk_probe(void)
{
unsigned long root = of_get_flat_dt_root();
return of_flat_dt_is_compatible(root, "fsl,mpc8360rdk");
}
define_machine(mpc836x_rdk) {
.name = "MPC836x RDK",
.probe = mpc836x_rdk_probe,
.setup_arch = mpc836x_rdk_setup_arch,
.init_IRQ = mpc836x_rdk_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
|
/*
LUFA Library
Copyright (C) Dean Camera, 2017.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
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, 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.
*/
/** \file
* \brief Board specific information header for the Atmel XMEGA A3BU Xplained.
* \copydetails Group_BoardInfo_A3BU_XPLAINED
*
* \note This file should not be included directly. It is automatically included as needed by the Board driver
* dispatch header located in LUFA/Drivers/Board/Board.h.
*/
/** \ingroup Group_BoardInfo
* \defgroup Group_BoardInfo_A3BU_XPLAINED A3BU_XPLAINED
* \brief Board specific information header for the Atmel XMEGA A3BU Xplained.
*
* Board specific information header for the Atmel XMEGA A3BU Xplained.
*
* @{
*/
#ifndef __BOARD_A3BU_XPLAINED_H__
#define __BOARD_A3BU_XPLAINED_H__
/* Includes: */
#include "../../../../Common/Common.h"
#include "../../Buttons.h"
#include "../../Dataflash.h"
#include "../../LEDs.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_BOARD_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Board.h instead.
#endif
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates the board has hardware Buttons mounted. */
#define BOARD_HAS_BUTTONS
/** Indicates the board has a hardware Dataflash mounted. */
#define BOARD_HAS_DATAFLASH
/** Indicates the board has hardware LEDs mounted. */
#define BOARD_HAS_LEDS
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
/** @} */
|
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// 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 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
void Register_sceSha256();
|
/*
* Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#define L___exit_handler
#include "_atexit.c"
|
/**
* \file mga_ioc32.c
*
* 32-bit ioctl compatibility routines for the MGA DRM.
*
* \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
*
*
* Copyright (C) Paul Mackerras 2005
* Copyright (C) Egbert Eich 2003,2004
* Copyright (C) Dave Airlie 2005
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <linux/compat.h>
#include <drm/drmP.h>
#include "nouveau_ioctl.h"
/**
* Called whenever a 32-bit process running under a 64-bit kernel
* performs an ioctl on /dev/dri/card<n>.
*
* \param filp file pointer.
* \param cmd command.
* \param arg user argument.
* \return zero on success or negative number on failure.
*/
long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{
unsigned int nr = DRM_IOCTL_NR(cmd);
drm_ioctl_compat_t *fn = NULL;
int ret;
if (nr < DRM_COMMAND_BASE)
return drm_compat_ioctl(filp, cmd, arg);
#if 0
if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(mga_compat_ioctls))
fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE];
#endif
if (fn != NULL)
ret = (*fn)(filp, cmd, arg);
else
ret = nouveau_drm_ioctl(filp, cmd, arg);
return ret;
}
|
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include "internal.h"
#include "mount.h"
static DEFINE_SPINLOCK(pin_lock);
void pin_remove(struct fs_pin *pin)
{
spin_lock(&pin_lock);
hlist_del_init(&pin->m_list);
hlist_del_init(&pin->s_list);
spin_unlock(&pin_lock);
spin_lock_irq(&pin->wait.lock);
pin->done = 1;
wake_up_locked(&pin->wait);
spin_unlock_irq(&pin->wait.lock);
}
void pin_insert_group(struct fs_pin *pin, struct vfsmount *m, struct hlist_head *p)
{
spin_lock(&pin_lock);
if (p)
hlist_add_head(&pin->s_list, p);
hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins);
spin_unlock(&pin_lock);
}
void pin_insert(struct fs_pin *pin, struct vfsmount *m)
{
pin_insert_group(pin, m, &m->mnt_sb->s_pins);
}
void pin_kill(struct fs_pin *p)
{
wait_queue_entry_t wait;
if (!p) {
rcu_read_unlock();
return;
}
init_wait(&wait);
spin_lock_irq(&p->wait.lock);
if (likely(!p->done)) {
p->done = -1;
spin_unlock_irq(&p->wait.lock);
rcu_read_unlock();
p->kill(p);
return;
}
if (p->done > 0) {
spin_unlock_irq(&p->wait.lock);
rcu_read_unlock();
return;
}
__add_wait_queue(&p->wait, &wait);
while (1) {
set_current_state(TASK_UNINTERRUPTIBLE);
spin_unlock_irq(&p->wait.lock);
rcu_read_unlock();
schedule();
rcu_read_lock();
if (likely(list_empty(&wait.entry)))
break;
/* OK, we know p couldn't have been freed yet */
spin_lock_irq(&p->wait.lock);
if (p->done > 0) {
spin_unlock_irq(&p->wait.lock);
break;
}
}
rcu_read_unlock();
}
void mnt_pin_kill(struct mount *m)
{
while (1) {
struct hlist_node *p;
rcu_read_lock();
p = ACCESS_ONCE(m->mnt_pins.first);
if (!p) {
rcu_read_unlock();
break;
}
pin_kill(hlist_entry(p, struct fs_pin, m_list));
}
}
void group_pin_kill(struct hlist_head *p)
{
while (1) {
struct hlist_node *q;
rcu_read_lock();
q = ACCESS_ONCE(p->first);
if (!q) {
rcu_read_unlock();
break;
}
pin_kill(hlist_entry(q, struct fs_pin, s_list));
}
}
|
#ifndef _ENGINE_AUDIO_TYPES_H_
#define _ENGINE_AUDIO_TYPES_H_
#include <functional>
#include <memory>
#include <vector>
#include <opusfile.h>
namespace openage {
namespace audio {
/**
* pcm_data_t is a vector consisting of signed 16 bit integer samples. It is
* used to represent one complete audio resource's buffer.
*/
using pcm_data_t = std::vector<int16_t>;
/**
* pcm_chunk_t is a vector consisting of signed 16 bit integer samples. It is
* used to represent a chunk of a audio resource's buffer with a fixed size.
*/
using pcm_chunk_t = std::vector<int16_t>;
/**
* opus_file_t is a OggOpusFile pointer that is stored inside a unique_ptr and
* uses a custom deleter.
*/
using opus_file_t = std::unique_ptr<OggOpusFile,std::function<void(OggOpusFile*)>>;
}
}
#endif
|
/* This testcase is part of GDB, the GNU debugger.
Copyright 2011-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 <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
volatile char *p = NULL;
extern long
bowler (void)
{
return *p;
}
extern void
keeper (int sig)
{
static int recurse = 0;
if (++recurse < 3)
bowler ();
_exit (0);
}
int
main (void)
{
struct sigaction act;
memset (&act, 0, sizeof act);
act.sa_handler = keeper;
act.sa_flags = SA_NODEFER;
sigaction (SIGSEGV, &act, NULL);
sigaction (SIGBUS, &act, NULL);
bowler ();
return 0;
}
|
/*
* SM5701_core.h
* SiliconMitus SM5701 Charger Header
*
* Copyright (C) 2014 SiliconMitus
*
*
* 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 _sm5701_SW_H_
#define _sm5701_SW_H_
#include <linux/i2c.h>
#if defined(CONFIG_CHARGER_SM5701)
#include <linux/battery/sec_charger.h>
#endif
#define MFD_DEV_NAME "sm5701"
/* Enable charger Operation Mode */
#define OP_MODE_CHG_ON 0x02
#define OP_MODE_CHG_ON_REV3 0x04
/* Disable charger Operation Mode */
#define OP_MODE_CHG_OFF 0x01
//FLEDCNTL1
#define SM5701_FLEDCNTL1_FLEDEN 0x03
#define SM5701_FLEDCNTL1_ABSTMR 0x0B
#define SM5701_FLEDCNTL1_ENABSTMR 0x10
//FLEDCNTL2
#define SM5701_FLEDCNTL2_ONETIMER 0x0F
#define SM5701_FLEDCNTL2_nONESHOT 0x10
#define SM5701_FLEDCNTL2_SAFET 0x60
#define SM5701_FLEDCNTL2_nENSAFET 0x80
//FLEDCNTL3
#define SM5701_FLEDCNTL3_IFLED 0x1F
//FLEDCNTL4
#define SM5701_FLEDCNTL4_IMLED 0x1F
//FLEDCNTL5
#define SM5701_FLEDCNTL5_LBDHYS 0x03
#define SM5701_FLEDCNTL5_LOWBATT 0x1B
#define SM5701_FLEDCNTL5_LBRSTIMER 0x60
#define SM5701_FLEDCNTL5_ENLOWBATT 0x80
//FLEDCNTL6
#define SM5701_FLEDCNTL6_BSTOUT 0x0F
#define SM5701_BSTOUT_4P5 0x05
#define SM5701_BSTOUT_5P0 0x0A
/**
* struct sm5701_dev
* @dev: master device of the chip (can be used to access platform data)
* @i2c: i2c client private data
* @iolock: mutex for serializing io access
* @irq_base: base IRQ number for sm5701, required for IRQs
* @irq: generic IRQ number for sm5701
*/
struct SM5701_dev {
struct device *dev;
struct i2c_client *i2c;
struct mutex i2c_lock;
struct mutex irqlock;
int type;
int irq;
int irq_base;
int irq_gpio;
int irqf_trigger;
bool wakeup;
};
struct SM5701_charger_data {
struct SM5701_dev *SM5701;
struct power_supply psy_chg;
struct delayed_work isr_work;
unsigned int is_charging;
unsigned int nchgen;
unsigned int charging_type;
unsigned int battery_state;
unsigned int battery_present;
unsigned int cable_type;
unsigned int charging_current_max;
unsigned int charging_current;
unsigned int input_current_limit;
unsigned int vbus_state;
bool is_fullcharged;
int aicl_on;
int slow_rate_on;
int status;
int siop_level;
int input_curr_limit_step;
int charging_curr_step;
int dev_id;
sec_battery_platform_data_t *pdata;
};
struct SM5701_platform_data {
unsigned int irq;
unsigned int chgen;
struct SM5701_charger_data *charger_data;
};
//CNTL
#define SM5701_OPERATIONMODE_SUSPEND 0x0 // 000 : Suspend (charger-OFF) MODE
#define SM5701_OPERATIONMODE_FLASH_ON 0x1 // 001 : Flash LED Driver=ON Ready in Charger & OTG OFF Mode
#define SM5701_OPERATIONMODE_OTG_ON 0x2 // 010 : OTG=ON in Charger & Flash OFF Mode
#define SM5701_OPERATIONMODE_OTG_ON_FLASH_ON 0x3 // 011 : OTG=ON & Flash LED Driver=ON Ready in charger OFF Mode
#define SM5701_OPERATIONMODE_CHARGER_ON 0x4 // 100 : Charger=ON in OTG & Flash OFF Mode. Same as 0x6(110)
#define SM5701_OPERATIONMODE_CHARGER_ON_FLASH_ON 0x5 // 101 : Charger=ON & Flash LED Driver=ON Ready in OTG OFF Mode. Same as 0x7(111)
enum led_state {
LED_DISABLE,
LED_MOVIE,
LED_FLASH,
};
enum sm5701_flash_mode {
NONE_MODE = 0,
MOVIE_MODE,
FLASH_MODE,
};
enum sm5701_flash_operation {
SM5701_FLEDEN_DISABLED = 0,
SM5701_FLEDEN_ON_MOVIE,
SM5701_FLEDEN_ON_FLASH,
SM5701_FLEDEN_EXTERNAL_CONTOL
};
//sm5701_core.c
extern int SM5701_reg_read(struct i2c_client *i2c, u8 reg, u8 *dest);
extern int SM5701_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
extern int SM5701_reg_write(struct i2c_client *i2c, u8 reg, u8 value);
extern int SM5701_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
extern int SM5701_reg_update(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
extern void SM5701_test_read(struct i2c_client *client );
extern void SM5701_set_operationmode(int operation_mode);
extern void sm5701_led_ready(int led_status);
extern int SM5701_operation_mode_function_control(void);
extern void SM5701_set_charger_data(void *p);
//leds-sm5701.c
extern void SM5701_set_enabstmr(int abstmr_enable);
extern void SM5701_set_abstmr(int abstmr_sec);
extern void SM5701_set_fleden(int fled_enable);
extern void SM5701_set_nensafet(int nensafet_enable);
extern void SM5701_set_safet(int safet_us);
extern void SM5701_set_noneshot(int noneshot_enable);
extern void SM5701_set_onetimer(int onetimer_ms);
extern void SM5701_set_ifled(int ifled_ma);
extern void SM5701_set_imled(int imled_ma);
extern void SM5701_set_enlowbatt(int enlowbatt_enable);
extern void SM5701_set_lbrstimer(int lbrstimer_us);
extern void SM5701_set_lowbatt(int lowbatt_v);
extern void SM5701_set_lbdhys(int lbdhys_mv);
extern void SM5701_set_bstout(int bstout_mv);
extern void sm5701_set_fleden(int fled_enable);
//sm5701_irq
extern int SM5701_irq_init(struct SM5701_dev *sm5701);
extern void SM5701_irq_exit(struct SM5701_dev *sm5701);
#endif /* __SM5701_CHARGER_H */
|
/* Definitions for rtems targeting a v850 using ELF.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Specify predefined symbols in preprocessor. */
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
builtin_define( "__rtems__" ); \
builtin_assert( "system=rtems" ); \
} \
while (0)
/* Map mv850e1 and mv850es to mv850e to match MULTILIB_MATCHES */
#undef ASM_SPEC
#define ASM_SPEC "%{mv850es:-mv850e} \
%{mv850e1:-mv850e} \
%{!mv850es:%{!mv850e1:%{mv*:-mv%*}} \
%{m8byte-align:-m8byte-align} \
%{mgcc-abi:-mgcc-abi}}"
|
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2015, Intel Corporation.
*
* 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.
*/
#ifndef __IA_CSS_DE2_TYPES_H
#define __IA_CSS_DE2_TYPES_H
/* @file
* CSS-API header file for Demosaicing parameters.
*/
/* Eigen Color Demosaicing configuration.
*
* ISP block: DE2
* (ISP1: DE1 is used.)
* ISP2: DE2 is used.
*/
struct ia_css_ecd_config {
uint16_t zip_strength; /** Strength of zipper reduction.
u0.13, [0,8191],
default 5489(0.67), ineffective 0 */
uint16_t fc_strength; /** Strength of false color reduction.
u0.13, [0,8191],
default 8191(almost 1.0), ineffective 0 */
uint16_t fc_debias; /** Prevent color change
on noise or Gr/Gb imbalance.
u0.13, [0,8191],
default 0, ineffective 0 */
};
#endif /* __IA_CSS_DE2_TYPES_H */
|
/*
* (C) Copyright 2000-2004
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Atapted for ppc4XX by Denis Peter
*/
#include <common.h>
#include <commproc.h>
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
void post_word_store (ulong a)
{
volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
*(volatile ulong *) save_addr = a;
}
ulong post_word_load (void)
{
volatile void *save_addr = (volatile void *)(CFG_OCM_DATA_ADDR + CFG_POST_WORD_ADDR);
return *(volatile ulong *) save_addr;
}
#endif /* CONFIG_POST || CONFIG_LOGBUFFER*/
#ifdef CONFIG_BOOTCOUNT_LIMIT
void bootcount_store (ulong a)
{
volatile ulong *save_addr =
(volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR);
save_addr[0] = a;
save_addr[1] = BOOTCOUNT_MAGIC;
}
ulong bootcount_load (void)
{
volatile ulong *save_addr =
(volatile ulong *)(CFG_OCM_DATA_ADDR + CFG_BOOTCOUNT_ADDR);
if (save_addr[1] != BOOTCOUNT_MAGIC)
return 0;
else
return save_addr[0];
}
#endif /* CONFIG_BOOTCOUNT_LIMIT */
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsAtomService_h
#define __nsAtomService_h
#include "nsIAtomService.h"
class nsAtomService : public nsIAtomService
{
public:
nsAtomService();
NS_DECL_ISUPPORTS
NS_DECL_NSIATOMSERVICE
private:
~nsAtomService() {}
};
#endif
|
/*
* Copyright (C) 2012,2013 - ARM Ltd
* Author: Marc Zyngier <marc.zyngier@arm.com>
*
* Derived from arch/arm/kvm/handle_exit.c:
* Copyright (C) 2012 - Virtual Open Systems and Columbia University
* Author: Christoffer Dall <c.dall@virtualopensystems.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 <linux/kvm.h>
#include <linux/kvm_host.h>
#include <asm/kvm_emulate.h>
#include <asm/kvm_coproc.h>
#include <asm/kvm_mmu.h>
#include <asm/kvm_psci.h>
typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
{
int ret;
ret = kvm_psci_call(vcpu);
if (ret < 0) {
kvm_inject_undefined(vcpu);
return 1;
}
return ret;
}
static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
{
kvm_inject_undefined(vcpu);
return 1;
}
/**
* kvm_handle_wfx - handle a wait-for-interrupts or wait-for-event
* instruction executed by a guest
*
* @vcpu: the vcpu pointer
*
* WFE: Yield the CPU and come back to this vcpu when the scheduler
* decides to.
* WFI: Simply call kvm_vcpu_block(), which will halt execution of
* world-switches and schedule other host processes until there is an
* incoming IRQ or FIQ to the VM.
*/
static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run)
{
if (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EC_WFI_ISS_WFE)
kvm_vcpu_on_spin(vcpu);
else
kvm_vcpu_block(vcpu);
return 1;
}
static exit_handle_fn arm_exit_handlers[] = {
[ESR_EL2_EC_WFI] = kvm_handle_wfx,
[ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32,
[ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64,
[ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_access,
[ESR_EL2_EC_CP14_LS] = kvm_handle_cp14_load_store,
[ESR_EL2_EC_CP14_64] = kvm_handle_cp14_access,
[ESR_EL2_EC_HVC32] = handle_hvc,
[ESR_EL2_EC_SMC32] = handle_smc,
[ESR_EL2_EC_HVC64] = handle_hvc,
[ESR_EL2_EC_SMC64] = handle_smc,
[ESR_EL2_EC_SYS64] = kvm_handle_sys_reg,
[ESR_EL2_EC_IABT] = kvm_handle_guest_abort,
[ESR_EL2_EC_DABT] = kvm_handle_guest_abort,
};
static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
{
u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
!arm_exit_handlers[hsr_ec]) {
kvm_err("Unknown exception class: hsr: %#08x\n",
(unsigned int)kvm_vcpu_get_hsr(vcpu));
BUG();
}
return arm_exit_handlers[hsr_ec];
}
/*
* Return > 0 to return to guest, < 0 on error, 0 (and set exit_reason) on
* proper exit to userspace.
*/
int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
int exception_index)
{
exit_handle_fn exit_handler;
switch (exception_index) {
case ARM_EXCEPTION_IRQ:
return 1;
case ARM_EXCEPTION_TRAP:
/*
* See ARM ARM B1.14.1: "Hyp traps on instructions
* that fail their condition code check"
*/
if (!kvm_condition_valid(vcpu)) {
kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
return 1;
}
exit_handler = kvm_get_exit_handler(vcpu);
return exit_handler(vcpu, run);
default:
kvm_pr_unimpl("Unsupported exception type: %d",
exception_index);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
return 0;
}
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_ANDROID_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_ANDROID_H_
#define CHROME_BROWSER_UI_ANDROID_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_ANDROID_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "content/public/browser/web_contents_view_delegate.h"
namespace content {
class WebContents;
}
// A Chrome specific class that extends WebContentsViewAndroid with features
// like context menus.
class ChromeWebContentsViewDelegateAndroid
: public content::WebContentsViewDelegate {
public:
explicit ChromeWebContentsViewDelegateAndroid(
content::WebContents* web_contents);
virtual ~ChromeWebContentsViewDelegateAndroid();
// WebContentsViewDelegate:
virtual void ShowContextMenu(
const content::ContextMenuParams& params) OVERRIDE;
// WebContentsViewDelegate:
virtual content::WebDragDestDelegate* GetDragDestDelegate() OVERRIDE;
private:
// The WebContents that owns the view and this delegate transitively.
content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(ChromeWebContentsViewDelegateAndroid);
};
#endif // CHROME_BROWSER_UI_ANDROID_TAB_CONTENTS_CHROME_WEB_CONTENTS_VIEW_DELEGATE_ANDROID_H_
|
/*
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sched.h>
#include <errno.h>
#include <sys/wait.h>
#include <signal.h>
#include "user_util.h"
#include "kern_util.h"
#include "user.h"
#include "ptrace_user.h"
#include "os.h"
void do_exec(int old_pid, int new_pid)
{
unsigned long regs[FRAME_SIZE];
int err;
if((ptrace(PTRACE_ATTACH, new_pid, 0, 0) < 0) ||
(ptrace(PTRACE_CONT, new_pid, 0, 0) < 0))
tracer_panic("do_exec failed to attach proc - errno = %d",
errno);
CATCH_EINTR(err = waitpid(new_pid, 0, WUNTRACED));
if (err < 0)
tracer_panic("do_exec failed to attach proc in waitpid - errno = %d",
errno);
if(ptrace_getregs(old_pid, regs) < 0)
tracer_panic("do_exec failed to get registers - errno = %d",
errno);
os_kill_ptraced_process(old_pid, 0);
if (ptrace(PTRACE_OLDSETOPTIONS, new_pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
tracer_panic("do_exec: PTRACE_SETOPTIONS failed, errno = %d", errno);
if(ptrace_setregs(new_pid, regs) < 0)
tracer_panic("do_exec failed to start new proc - errno = %d",
errno);
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
|
#define crypto_block_BYTES 16
#define crypto_block_KEYBYTES 32
extern int crypto_block(unsigned char *,const unsigned char *,const unsigned char *);
|
#ifndef _SEPOL_CONTEXT_H_
#define _SEPOL_CONTEXT_H_
#include <sepol/context_record.h>
#include <sepol/policydb.h>
#include <sepol/handle.h>
/* -- Deprecated -- */
extern int sepol_check_context(const char *context);
/* -- End deprecated -- */
extern int sepol_context_check(sepol_handle_t * handle,
const sepol_policydb_t * policydb,
const sepol_context_t * context);
extern int sepol_mls_contains(sepol_handle_t * handle,
const sepol_policydb_t * policydb,
const char *mls1,
const char *mls2, int *response);
extern int sepol_mls_check(sepol_handle_t * handle,
const sepol_policydb_t * policydb, const char *mls);
#endif
|
/*
* Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* 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.
*
* Authors:
* Eddie Dong <eddie.dong@intel.com>
* Dexuan Cui
* Jike Song <jike.song@intel.com>
*
* Contributors:
* Zhi Wang <zhi.a.wang@intel.com>
*
*/
#ifndef _GVT_HYPERCALL_H_
#define _GVT_HYPERCALL_H_
/*
* Specific GVT-g MPT modules function collections. Currently GVT-g supports
* both Xen and KVM by providing dedicated hypervisor-related MPT modules.
*/
struct intel_gvt_mpt {
int (*host_init)(struct device *dev, void *gvt, const void *ops);
void (*host_exit)(struct device *dev, void *gvt);
int (*attach_vgpu)(void *vgpu, unsigned long *handle);
void (*detach_vgpu)(unsigned long handle);
int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
unsigned long (*from_virt_to_mfn)(void *p);
int (*enable_page_track)(unsigned long handle, u64 gfn);
int (*disable_page_track)(unsigned long handle, u64 gfn);
int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
unsigned long len);
int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
unsigned long len);
unsigned long (*gfn_to_mfn)(unsigned long handle, unsigned long gfn);
int (*dma_map_guest_page)(unsigned long handle, unsigned long gfn,
unsigned long size, dma_addr_t *dma_addr);
void (*dma_unmap_guest_page)(unsigned long handle, dma_addr_t dma_addr);
int (*map_gfn_to_mfn)(unsigned long handle, unsigned long gfn,
unsigned long mfn, unsigned int nr, bool map);
int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
bool map);
int (*set_opregion)(void *vgpu);
int (*get_vfio_device)(void *vgpu);
void (*put_vfio_device)(void *vgpu);
bool (*is_valid_gfn)(unsigned long handle, unsigned long gfn);
};
extern struct intel_gvt_mpt xengt_mpt;
extern struct intel_gvt_mpt kvmgt_mpt;
#endif /* _GVT_HYPERCALL_H_ */
|
/*
* Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <mach/common.h>
extern int usbotg_init(struct platform_device *pdev);
extern void usbotg_uninit(struct fsl_usb2_platform_data *pdata);
extern struct platform_device *host_pdev_register(struct resource *res,
int n_res, struct fsl_usb2_platform_data *config);
extern int fsl_usb_host_init(struct platform_device *pdev);
extern void fsl_usb_host_uninit(struct fsl_usb2_platform_data *pdata);
extern int gpio_usbotg_utmi_active(void);
extern void gpio_usbotg_utmi_inactive(void);
extern bool usb_icbug_swfix_need(void);
extern void __init mx6_usb_h2_init(void);
extern void __init mx6_usb_h3_init(void);
typedef void (*driver_vbus_func)(bool);
extern void mx6_set_host3_vbus_func(driver_vbus_func);
extern void mx6_set_host2_vbus_func(driver_vbus_func);
extern void mx6_set_host1_vbus_func(driver_vbus_func);
extern void mx6_set_otghost_vbus_func(driver_vbus_func);
extern void mx6_get_otghost_vbus_func(driver_vbus_func *driver_vbus);
extern void mx6_get_host1_vbus_func(driver_vbus_func *driver_vbus);
extern struct platform_device anatop_thermal_device;
extern struct platform_device mxc_usbdr_otg_device;
extern struct platform_device mxc_usbdr_udc_device;
extern struct platform_device mxc_usbdr_host_device;
extern struct platform_device mxc_usbdr_wakeup_device;
extern struct platform_device mxc_usbh1_device;
extern struct platform_device mxc_usbh1_wakeup_device;
/*
* Used to set pdata->operating_mode before registering the platform_device.
* If OTG is configured, the controller operates in OTG mode,
* otherwise it's either host or device.
*/
#ifdef CONFIG_USB_OTG
#define DR_UDC_MODE FSL_USB2_DR_OTG
#define DR_HOST_MODE FSL_USB2_DR_OTG
#else
#define DR_UDC_MODE FSL_USB2_DR_DEVICE
#define DR_HOST_MODE FSL_USB2_DR_HOST
#endif
extern void __iomem *imx_otg_base;
#define imx_fsl_usb2_wakeup_data_entry_single(soc, _id, hs) \
{ \
.id = _id, \
.irq_phy = soc ## _INT_USB_PHY ## _id, \
.irq_core = soc ## _INT_USB_ ## hs, \
}
#define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
{ \
.id = _id, \
.iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \
.irq = soc ## _INT_USB_ ## hs, \
}
#define imx_fsl_usb2_otg_data_entry_single(soc) \
{ \
.iobase = soc ## _USB_OTG_BASE_ADDR, \
.irq = soc ## _INT_USB_OTG, \
}
#define imx_fsl_usb2_udc_data_entry_single(soc) \
{ \
.iobase = soc ## _USB_OTG_BASE_ADDR, \
.irq = soc ## _INT_USB_OTG, \
}
|
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef _ATSC_EQUALIZER_NOP_H_
#define _ATSC_EQUALIZER_NOP_H_
#include <gnuradio/atsc/api.h>
#include <gnuradio/atsc/equalizer_impl.h>
class ATSC_API atsci_equalizer_nop : public atsci_equalizer
{
private:
float scale (float input) { return input; }
float scale_and_train (float input);
public:
atsci_equalizer_nop ();
virtual ~atsci_equalizer_nop ();
virtual void reset ();
virtual int ntaps () const;
virtual int npretaps () const;
protected:
virtual void filter_normal (const float *input_samples,
float *output_samples,
int nsamples);
virtual void filter_data_seg_sync (const float *input_samples,
float *output_samples,
int nsamples,
int offset);
virtual void filter_field_sync (const float *input_samples,
float *output_samples,
int nsamples,
int offset,
int which_field);
};
#endif /* _ATSC_EQUALIZER_NOP_H_ */
|
/*
* Copyright (c) 2009 Atheros Communications Inc.
* Copyright (c) 2010 Bruno Randolf <br1@einfach.org>
*
* Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
* Original from Linux kernel 3.0.1
*
* 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.
*/
#include "ath.h"
#include "reg.h"
#define REG_READ (common->ops->read)
#define REG_WRITE(_ah, _reg, _val) (common->ops->write)(_ah, _val, _reg)
#define ENABLE_REGWRITE_BUFFER(_ah) \
if (common->ops->enable_write_buffer) \
common->ops->enable_write_buffer((_ah));
#define REGWRITE_BUFFER_FLUSH(_ah) \
if (common->ops->write_flush) \
common->ops->write_flush((_ah));
#define IEEE80211_WEP_NKID 4 /* number of key ids */
/************************/
/* Key Cache Management */
/************************/
int ath_hw_keyreset(struct ath_common *common, u16 entry)
{
u32 keyType;
void *ah = common->ah;
if (entry >= common->keymax) {
DBG("ath: keycache entry %d out of range\n", entry);
return 0;
}
keyType = REG_READ(ah, AR_KEYTABLE_TYPE(entry));
ENABLE_REGWRITE_BUFFER(ah);
REG_WRITE(ah, AR_KEYTABLE_KEY0(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY2(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY3(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY4(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), AR_KEYTABLE_TYPE_CLR);
REG_WRITE(ah, AR_KEYTABLE_MAC0(entry), 0);
REG_WRITE(ah, AR_KEYTABLE_MAC1(entry), 0);
if (keyType == AR_KEYTABLE_TYPE_TKIP) {
u16 micentry = entry + 64;
REG_WRITE(ah, AR_KEYTABLE_KEY0(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY1(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY2(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_KEY3(micentry), 0);
if (common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED) {
REG_WRITE(ah, AR_KEYTABLE_KEY4(micentry), 0);
REG_WRITE(ah, AR_KEYTABLE_TYPE(micentry),
AR_KEYTABLE_TYPE_CLR);
}
}
REGWRITE_BUFFER_FLUSH(ah);
return 1;
}
|
//===- llvm/Target/CodeGenCWrappers.h - CodeGen C Wrappers ------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines C bindings wrappers for enums in llvm/Support/CodeGen.h
// that need them. The wrappers are separated to avoid adding an indirect
// dependency on llvm/Config/Targets.def to CodeGen.h.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_CODEGENCWRAPPERS_H
#define LLVM_TARGET_CODEGENCWRAPPERS_H
#include "llvm-c/TargetMachine.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/ErrorHandling.h"
namespace llvm {
inline Optional<CodeModel::Model> unwrap(LLVMCodeModel Model, bool &JIT) {
JIT = false;
switch (Model) {
case LLVMCodeModelJITDefault:
JIT = true;
LLVM_FALLTHROUGH;
case LLVMCodeModelDefault:
return None;
case LLVMCodeModelTiny:
return CodeModel::Tiny;
case LLVMCodeModelSmall:
return CodeModel::Small;
case LLVMCodeModelKernel:
return CodeModel::Kernel;
case LLVMCodeModelMedium:
return CodeModel::Medium;
case LLVMCodeModelLarge:
return CodeModel::Large;
}
return CodeModel::Small;
}
inline LLVMCodeModel wrap(CodeModel::Model Model) {
switch (Model) {
case CodeModel::Tiny:
return LLVMCodeModelTiny;
case CodeModel::Small:
return LLVMCodeModelSmall;
case CodeModel::Kernel:
return LLVMCodeModelKernel;
case CodeModel::Medium:
return LLVMCodeModelMedium;
case CodeModel::Large:
return LLVMCodeModelLarge;
}
llvm_unreachable("Bad CodeModel!");
}
} // namespace llvm
#endif
|
/*
*
* University of Luxembourg
* Laboratory of Algorithmics, Cryptology and Security (LACS)
*
* FELICS - Fair Evaluation of Lightweight Cryptographic Systems
*
* Copyright (C) 2015 University of Luxembourg
*
* Written in 2015 by Daniel Dinu <dumitru-daniel.dinu@uni.lu>
*
* This file is part of FELICS.
*
* FELICS 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.
*
* FELICS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef SPECKEY_INVERSE_H
#define SPECKEY_INVERSE_H
void speckey_inverse(uint16_t *left, uint16_t *right);
#endif /* SPECKEY_INVERSE_H */
|
// SPDX-License-Identifier: GPL-2.0
/*
* STM32 Factory-programmed memory read access driver
*
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
* Author: Fabrice Gasnier <fabrice.gasnier@st.com> for STMicroelectronics.
*/
#include <linux/arm-smccc.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-provider.h>
#include <linux/of_device.h>
/* BSEC secure service access from non-secure */
#define STM32_SMC_BSEC 0x82001003
#define STM32_SMC_READ_SHADOW 0x01
#define STM32_SMC_PROG_OTP 0x02
#define STM32_SMC_WRITE_SHADOW 0x03
#define STM32_SMC_READ_OTP 0x04
/* shadow registers offest */
#define STM32MP15_BSEC_DATA0 0x200
/* 32 (x 32-bits) lower shadow registers */
#define STM32MP15_BSEC_NUM_LOWER 32
struct stm32_romem_cfg {
int size;
};
struct stm32_romem_priv {
void __iomem *base;
struct nvmem_config cfg;
};
static int stm32_romem_read(void *context, unsigned int offset, void *buf,
size_t bytes)
{
struct stm32_romem_priv *priv = context;
u8 *buf8 = buf;
int i;
for (i = offset; i < offset + bytes; i++)
*buf8++ = readb_relaxed(priv->base + i);
return 0;
}
static int stm32_bsec_smc(u8 op, u32 otp, u32 data, u32 *result)
{
#if IS_ENABLED(CONFIG_HAVE_ARM_SMCCC)
struct arm_smccc_res res;
arm_smccc_smc(STM32_SMC_BSEC, op, otp, data, 0, 0, 0, 0, &res);
if (res.a0)
return -EIO;
if (result)
*result = (u32)res.a1;
return 0;
#else
return -ENXIO;
#endif
}
static int stm32_bsec_read(void *context, unsigned int offset, void *buf,
size_t bytes)
{
struct stm32_romem_priv *priv = context;
struct device *dev = priv->cfg.dev;
u32 roffset, rbytes, val;
u8 *buf8 = buf, *val8 = (u8 *)&val;
int i, j = 0, ret, skip_bytes, size;
/* Round unaligned access to 32-bits */
roffset = rounddown(offset, 4);
skip_bytes = offset & 0x3;
rbytes = roundup(bytes + skip_bytes, 4);
if (roffset + rbytes > priv->cfg.size)
return -EINVAL;
for (i = roffset; (i < roffset + rbytes); i += 4) {
u32 otp = i >> 2;
if (otp < STM32MP15_BSEC_NUM_LOWER) {
/* read lower data from shadow registers */
val = readl_relaxed(
priv->base + STM32MP15_BSEC_DATA0 + i);
} else {
ret = stm32_bsec_smc(STM32_SMC_READ_SHADOW, otp, 0,
&val);
if (ret) {
dev_err(dev, "Can't read data%d (%d)\n", otp,
ret);
return ret;
}
}
/* skip first bytes in case of unaligned read */
if (skip_bytes)
size = min(bytes, (size_t)(4 - skip_bytes));
else
size = min(bytes, (size_t)4);
memcpy(&buf8[j], &val8[skip_bytes], size);
bytes -= size;
j += size;
skip_bytes = 0;
}
return 0;
}
static int stm32_bsec_write(void *context, unsigned int offset, void *buf,
size_t bytes)
{
struct stm32_romem_priv *priv = context;
struct device *dev = priv->cfg.dev;
u32 *buf32 = buf;
int ret, i;
/* Allow only writing complete 32-bits aligned words */
if ((bytes % 4) || (offset % 4))
return -EINVAL;
for (i = offset; i < offset + bytes; i += 4) {
ret = stm32_bsec_smc(STM32_SMC_PROG_OTP, i >> 2, *buf32++,
NULL);
if (ret) {
dev_err(dev, "Can't write data%d (%d)\n", i >> 2, ret);
return ret;
}
}
return 0;
}
static int stm32_romem_probe(struct platform_device *pdev)
{
const struct stm32_romem_cfg *cfg;
struct device *dev = &pdev->dev;
struct stm32_romem_priv *priv;
struct resource *res;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
priv->base = devm_ioremap_resource(dev, res);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
priv->cfg.name = "stm32-romem";
priv->cfg.word_size = 1;
priv->cfg.stride = 1;
priv->cfg.dev = dev;
priv->cfg.priv = priv;
priv->cfg.owner = THIS_MODULE;
cfg = (const struct stm32_romem_cfg *)
of_match_device(dev->driver->of_match_table, dev)->data;
if (!cfg) {
priv->cfg.read_only = true;
priv->cfg.size = resource_size(res);
priv->cfg.reg_read = stm32_romem_read;
} else {
priv->cfg.size = cfg->size;
priv->cfg.reg_read = stm32_bsec_read;
priv->cfg.reg_write = stm32_bsec_write;
}
return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &priv->cfg));
}
static const struct stm32_romem_cfg stm32mp15_bsec_cfg = {
.size = 384, /* 96 x 32-bits data words */
};
static const struct of_device_id stm32_romem_of_match[] = {
{ .compatible = "st,stm32f4-otp", }, {
.compatible = "st,stm32mp15-bsec",
.data = (void *)&stm32mp15_bsec_cfg,
}, {
},
};
MODULE_DEVICE_TABLE(of, stm32_romem_of_match);
static struct platform_driver stm32_romem_driver = {
.probe = stm32_romem_probe,
.driver = {
.name = "stm32-romem",
.of_match_table = of_match_ptr(stm32_romem_of_match),
},
};
module_platform_driver(stm32_romem_driver);
MODULE_AUTHOR("Fabrice Gasnier <fabrice.gasnier@st.com>");
MODULE_DESCRIPTION("STMicroelectronics STM32 RO-MEM");
MODULE_ALIAS("platform:nvmem-stm32-romem");
MODULE_LICENSE("GPL v2");
|
/*
* linux/fs/ext2/acl.c
*
* Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
*/
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include "ext2.h"
#include "xattr.h"
#include "acl.h"
/*
* Convert from filesystem to in-memory representation.
*/
static struct posix_acl *
ext2_acl_from_disk(const void *value, size_t size)
{
const char *end = (char *)value + size;
int n, count;
struct posix_acl *acl;
if (!value)
return NULL;
if (size < sizeof(ext2_acl_header))
return ERR_PTR(-EINVAL);
if (((ext2_acl_header *)value)->a_version !=
cpu_to_le32(EXT2_ACL_VERSION))
return ERR_PTR(-EINVAL);
value = (char *)value + sizeof(ext2_acl_header);
count = ext2_acl_count(size);
if (count < 0)
return ERR_PTR(-EINVAL);
if (count == 0)
return NULL;
acl = posix_acl_alloc(count, GFP_KERNEL);
if (!acl)
return ERR_PTR(-ENOMEM);
for (n=0; n < count; n++) {
ext2_acl_entry *entry =
(ext2_acl_entry *)value;
if ((char *)value + sizeof(ext2_acl_entry_short) > end)
goto fail;
acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
switch(acl->a_entries[n].e_tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
value = (char *)value +
sizeof(ext2_acl_entry_short);
break;
case ACL_USER:
value = (char *)value + sizeof(ext2_acl_entry);
if ((char *)value > end)
goto fail;
acl->a_entries[n].e_uid =
make_kuid(&init_user_ns,
le32_to_cpu(entry->e_id));
break;
case ACL_GROUP:
value = (char *)value + sizeof(ext2_acl_entry);
if ((char *)value > end)
goto fail;
acl->a_entries[n].e_gid =
make_kgid(&init_user_ns,
le32_to_cpu(entry->e_id));
break;
default:
goto fail;
}
}
if (value != end)
goto fail;
return acl;
fail:
posix_acl_release(acl);
return ERR_PTR(-EINVAL);
}
/*
* Convert from in-memory to filesystem representation.
*/
static void *
ext2_acl_to_disk(const struct posix_acl *acl, size_t *size)
{
ext2_acl_header *ext_acl;
char *e;
size_t n;
*size = ext2_acl_size(acl->a_count);
ext_acl = kmalloc(sizeof(ext2_acl_header) + acl->a_count *
sizeof(ext2_acl_entry), GFP_KERNEL);
if (!ext_acl)
return ERR_PTR(-ENOMEM);
ext_acl->a_version = cpu_to_le32(EXT2_ACL_VERSION);
e = (char *)ext_acl + sizeof(ext2_acl_header);
for (n=0; n < acl->a_count; n++) {
const struct posix_acl_entry *acl_e = &acl->a_entries[n];
ext2_acl_entry *entry = (ext2_acl_entry *)e;
entry->e_tag = cpu_to_le16(acl_e->e_tag);
entry->e_perm = cpu_to_le16(acl_e->e_perm);
switch(acl_e->e_tag) {
case ACL_USER:
entry->e_id = cpu_to_le32(
from_kuid(&init_user_ns, acl_e->e_uid));
e += sizeof(ext2_acl_entry);
break;
case ACL_GROUP:
entry->e_id = cpu_to_le32(
from_kgid(&init_user_ns, acl_e->e_gid));
e += sizeof(ext2_acl_entry);
break;
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_MASK:
case ACL_OTHER:
e += sizeof(ext2_acl_entry_short);
break;
default:
goto fail;
}
}
return (char *)ext_acl;
fail:
kfree(ext_acl);
return ERR_PTR(-EINVAL);
}
/*
* inode->i_mutex: don't care
*/
struct posix_acl *
ext2_get_acl(struct inode *inode, int type)
{
int name_index;
char *value = NULL;
struct posix_acl *acl;
int retval;
switch (type) {
case ACL_TYPE_ACCESS:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
break;
case ACL_TYPE_DEFAULT:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT;
break;
default:
BUG();
}
retval = ext2_xattr_get(inode, name_index, "", NULL, 0);
if (retval > 0) {
value = kmalloc(retval, GFP_KERNEL);
if (!value)
return ERR_PTR(-ENOMEM);
retval = ext2_xattr_get(inode, name_index, "", value, retval);
}
if (retval > 0)
acl = ext2_acl_from_disk(value, retval);
else if (retval == -ENODATA || retval == -ENOSYS)
acl = NULL;
else
acl = ERR_PTR(retval);
kfree(value);
if (!IS_ERR(acl))
set_cached_acl(inode, type, acl);
return acl;
}
/*
* inode->i_mutex: down
*/
int
ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
int name_index;
void *value = NULL;
size_t size = 0;
int error;
switch(type) {
case ACL_TYPE_ACCESS:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
if (error)
return error;
inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode);
}
break;
case ACL_TYPE_DEFAULT:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_DEFAULT;
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
break;
default:
return -EINVAL;
}
if (acl) {
value = ext2_acl_to_disk(acl, &size);
if (IS_ERR(value))
return (int)PTR_ERR(value);
}
error = ext2_xattr_set(inode, name_index, "", value, size, 0);
kfree(value);
if (!error)
set_cached_acl(inode, type, acl);
return error;
}
/*
* Initialize the ACLs of a new inode. Called from ext2_new_inode.
*
* dir->i_mutex: down
* inode->i_mutex: up (access to inode is still exclusive)
*/
int
ext2_init_acl(struct inode *inode, struct inode *dir)
{
struct posix_acl *default_acl, *acl;
int error;
error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
if (error)
return error;
if (default_acl) {
error = ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
posix_acl_release(default_acl);
}
if (acl) {
if (!error)
error = ext2_set_acl(inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl);
}
return error;
}
|
// Copyright 2007-2010 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
#ifndef OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
#define OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
#include "omaha/goopdate/resources/goopdate_dll/goopdate_dll.grh"
#include "omaha/goopdate/non_localized_resource.h"
#endif // OMAHA_GOOPDATE_ELEVATION_MONIKER_RESOURCE_H_
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_COMMON_MULTI_PROCESS_LOCK_H_
#define CHROME_COMMON_MULTI_PROCESS_LOCK_H_
#pragma once
#include <sys/types.h>
#include <string>
// Platform abstraction for a lock that can be shared between processes.
// The process that owns the lock will release it on exit even if
// the exit is due to a crash. Locks are not recursive.
class MultiProcessLock {
public:
// The length of a multi-process lock name is limited on Linux, so
// it is limited it on all platforms for consistency. This length does
// not include a terminator.
static const size_t MULTI_PROCESS_LOCK_NAME_MAX_LEN = 106;
// Factory method for creating a multi-process lock.
// |name| is the name of the lock. The name has special meaning on Windows
// where the prefix can determine the namespace of the lock.
// See http://msdn.microsoft.com/en-us/library/aa382954(v=VS.85).aspx for
// details.
static MultiProcessLock* Create(const std::string& name);
virtual ~MultiProcessLock() { }
// Try to grab ownership of the lock.
virtual bool TryLock() = 0;
// Release ownership of the lock.
virtual void Unlock() = 0;
};
#endif // CHROME_COMMON_MULTI_PROCESS_LOCK_H_
|
#ifndef __MDNIE_H__
#define __MDNIE_H__
#define END_SEQ 0xffff
#define MDNIE_LITE
#if defined(MDNIE_LITE)
typedef u8 mdnie_t;
#else
typedef u16 mdnie_t;
#endif
enum MODE {
DYNAMIC,
STANDARD,
NATURAL,
MOVIE,
AUTO,
MODE_MAX
};
enum SCENARIO {
UI_MODE,
VIDEO_NORMAL_MODE,
CAMERA_MODE = 4,
NAVI_MODE,
GALLERY_MODE,
VT_MODE,
BROWSER_MODE,
EBOOK_MODE,
EMAIL_MODE,
HMT_8_MODE,
HMT_16_MODE,
SCENARIO_MAX,
DMB_NORMAL_MODE = 20,
DMB_MODE_MAX,
};
enum BYPASS {
BYPASS_OFF,
BYPASS_ON,
BYPASS_MAX
};
enum ACCESSIBILITY {
ACCESSIBILITY_OFF,
NEGATIVE,
COLOR_BLIND,
SCREEN_CURTAIN,
ACCESSIBILITY_MAX
};
enum HBM {
HBM_OFF,
HBM_ON,
HBM_ON_TEXT,
HBM_MAX,
};
#ifdef CONFIG_LCD_HMT
enum hmt_mode {
HMT_MDNIE_OFF,
HMT_MDNIE_ON,
HMT_3000K = HMT_MDNIE_ON,
HMT_4000K,
HMT_6400K,
HMT_7500K,
HMT_MDNIE_MAX,
};
#endif
enum MDNIE_CMD {
#if defined(MDNIE_LITE)
LEVEL1_KEY_UNLOCK,
MDNIE_CMD1,
MDNIE_CMD2,
LEVEL1_KEY_LOCK,
MDNIE_CMD_MAX,
#else
MDNIE_CMD1,
MDNIE_CMD2 = MDNIE_CMD1,
MDNIE_CMD_MAX,
#endif
};
struct mdnie_command {
mdnie_t *sequence;
unsigned int size;
unsigned int sleep;
};
struct mdnie_table {
char *name;
struct mdnie_command tune[MDNIE_CMD_MAX];
};
#define MDNIE_SET(id) \
{ \
.name = #id, \
.tune = { \
{ .sequence = LEVEL1_UNLOCK, .size = ARRAY_SIZE(LEVEL1_UNLOCK), .sleep = 0,}, \
{ .sequence = id##_1, .size = ARRAY_SIZE(id##_1), .sleep = 0,}, \
{ .sequence = id##_2, .size = ARRAY_SIZE(id##_2), .sleep = 0,}, \
{ .sequence = LEVEL1_LOCK, .size = ARRAY_SIZE(LEVEL1_LOCK), .sleep = 0,}, \
} \
}
typedef int (*mdnie_w)(void *devdata, const u8 *seq, u32 len);
typedef int (*mdnie_r)(void *devdata, u8 addr, u8 *buf, u32 len);
struct mdnie_device;
struct mdnie_ops {
int (*write)(struct device *, const u8 *seq, u32 len);
int (*read)(struct device *, u8 addr, u8 *buf, u32 len);
/* Only for specific hardware */
int (*set_addr)(struct device *, int mdnie_addr);
};
struct mdnie_device {
/* This protects the 'ops' field. If 'ops' is NULL, the driver that
registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */
struct mutex ops_lock;
/* If this is NULL, the backing module is unloaded */
struct mdnie_ops *ops;
/* The framebuffer notifier block */
/* Serialise access to set_power method */
struct mutex update_lock;
struct notifier_block fb_notif;
struct device dev;
};
#define to_mdnie_device(obj) container_of(obj, struct mdnie_device, dev)
static inline void * mdnie_get_data(struct mdnie_device *md_dev)
{
return dev_get_drvdata(&md_dev->dev);
}
extern struct mdnie_device *mdnie_device_register(const char *name,
struct device *parent, struct mdnie_ops *ops);
extern void mdnie_device_unregister(struct mdnie_device *md);
struct platform_mdnie_data {
unsigned int display_type;
unsigned int support_pwm;
#if defined (CONFIG_S5P_MDNIE_PWM)
int pwm_out_no;
int pwm_out_func;
char *name;
int *br_table;
int dft_bl;
#endif
int (*trigger_set)(struct device *fimd);
struct device *fimd1_device;
struct lcd_platform_data *lcd_pd;
};
#ifdef CONFIG_FB_I80IF
extern int s3c_fb_enable_trigger_by_mdnie(struct device *fimd);
#endif
struct mdnie_info {
struct clk *bus_clk;
struct clk *clk;
struct device *dev;
struct mutex dev_lock;
struct mutex lock;
unsigned int enable;
enum SCENARIO scenario;
enum MODE mode;
enum BYPASS bypass;
enum HBM hbm;
#ifdef CONFIG_LCD_HMT
enum hmt_mode hmt_mode;
#endif
unsigned int tuning;
unsigned int accessibility;
unsigned int color_correction;
unsigned int auto_brightness;
char path[50];
void *data;
struct notifier_block fb_notif;
unsigned int white_r;
unsigned int white_g;
unsigned int white_b;
struct mdnie_table table_buffer;
mdnie_t sequence_buffer[256];
};
extern int mdnie_calibration(int *r);
extern int mdnie_open_file(const char *path, char **fp);
extern int mdnie_register(struct device *p, void *data, mdnie_w w, mdnie_r r);
#ifdef CONFIG_EXYNOS_DECON_DUAL_DISPLAY
extern int mdnie2_register(struct device *p, void *data, mdnie_w w, mdnie_r r);
#endif
extern struct mdnie_table *mdnie_request_table(char *path, struct mdnie_table *s);
#endif /* __MDNIE_H__ */
|
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef PCM_FUNCS_H
#define PCM_FUNCS_H
long pcm_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
void audpp_cmd_cfg_pcm_params(struct audio *audio);
#endif /* !PCM_FUNCS_H */
|
/*
* Copyright (C) 2013 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/byteorder/generic.h>
#include "mtdsplit.h"
#define SEAMA_MAGIC 0x5EA3A417
#define SEAMA_NR_PARTS 2
#define SEAMA_MIN_ROOTFS_OFFS 0x80000 /* 512KiB */
struct seama_header {
__be32 magic; /* should always be SEAMA_MAGIC. */
__be16 reserved; /* reserved for */
__be16 metasize; /* size of the META data */
__be32 size; /* size of the image */
};
static int mtdsplit_parse_seama(struct mtd_info *master,
struct mtd_partition **pparts,
struct mtd_part_parser_data *data)
{
struct seama_header hdr;
size_t hdr_len, retlen, kernel_size;
size_t rootfs_offset;
struct mtd_partition *parts;
int err;
hdr_len = sizeof(hdr);
err = mtd_read(master, 0, hdr_len, &retlen, (void *) &hdr);
if (err)
return err;
if (retlen != hdr_len)
return -EIO;
/* sanity checks */
if (be32_to_cpu(hdr.magic) != SEAMA_MAGIC)
return -EINVAL;
kernel_size = hdr_len + be32_to_cpu(hdr.size) +
be16_to_cpu(hdr.metasize);
if (kernel_size > master->size)
return -EINVAL;
/* Find the rootfs after the kernel. */
err = mtd_check_rootfs_magic(master, kernel_size);
if (!err) {
rootfs_offset = kernel_size;
} else {
/*
* The size in the header might cover the rootfs as well.
* Start the search from an arbitrary offset.
*/
err = mtd_find_rootfs_from(master, SEAMA_MIN_ROOTFS_OFFS,
master->size, &rootfs_offset);
if (err)
return err;
}
parts = kzalloc(SEAMA_NR_PARTS * sizeof(*parts), GFP_KERNEL);
if (!parts)
return -ENOMEM;
parts[0].name = KERNEL_PART_NAME;
parts[0].offset = 0;
parts[0].size = rootfs_offset;
parts[1].name = ROOTFS_PART_NAME;
parts[1].offset = rootfs_offset;
parts[1].size = master->size - rootfs_offset;
*pparts = parts;
return SEAMA_NR_PARTS;
}
static struct mtd_part_parser mtdsplit_seama_parser = {
.owner = THIS_MODULE,
.name = "seama-fw",
.parse_fn = mtdsplit_parse_seama,
.type = MTD_PARSER_TYPE_FIRMWARE,
};
static int __init mtdsplit_seama_init(void)
{
register_mtd_parser(&mtdsplit_seama_parser);
return 0;
}
subsys_initcall(mtdsplit_seama_init);
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* IBM System z Huge TLB Page Support for Kernel.
*
* Copyright IBM Corp. 2008
* Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
*/
#ifndef _ASM_S390_HUGETLB_H
#define _ASM_S390_HUGETLB_H
#include <asm/page.h>
#include <asm/pgtable.h>
#define is_hugepage_only_range(mm, addr, len) 0
#define hugetlb_free_pgd_range free_pgd_range
#define hugepages_supported() (MACHINE_HAS_EDAT1)
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, pte_t pte);
pte_t huge_ptep_get(pte_t *ptep);
pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
unsigned long addr, pte_t *ptep);
/*
* If the arch doesn't supply something else, assume that hugepage
* size aligned regions are ok without further preparation.
*/
static inline int prepare_hugepage_range(struct file *file,
unsigned long addr, unsigned long len)
{
if (len & ~HPAGE_MASK)
return -EINVAL;
if (addr & ~HPAGE_MASK)
return -EINVAL;
return 0;
}
static inline void arch_clear_hugepage_flags(struct page *page)
{
clear_bit(PG_arch_1, &page->flags);
}
static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
pte_t *ptep, unsigned long sz)
{
if ((pte_val(*ptep) & _REGION_ENTRY_TYPE_MASK) == _REGION_ENTRY_TYPE_R3)
pte_val(*ptep) = _REGION3_ENTRY_EMPTY;
else
pte_val(*ptep) = _SEGMENT_ENTRY_EMPTY;
}
static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
unsigned long address, pte_t *ptep)
{
huge_ptep_get_and_clear(vma->vm_mm, address, ptep);
}
static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep,
pte_t pte, int dirty)
{
int changed = !pte_same(huge_ptep_get(ptep), pte);
if (changed) {
huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
}
return changed;
}
static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
unsigned long addr, pte_t *ptep)
{
pte_t pte = huge_ptep_get_and_clear(mm, addr, ptep);
set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
}
static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
{
return mk_pte(page, pgprot);
}
static inline int huge_pte_none(pte_t pte)
{
return pte_none(pte);
}
static inline int huge_pte_write(pte_t pte)
{
return pte_write(pte);
}
static inline int huge_pte_dirty(pte_t pte)
{
return pte_dirty(pte);
}
static inline pte_t huge_pte_mkwrite(pte_t pte)
{
return pte_mkwrite(pte);
}
static inline pte_t huge_pte_mkdirty(pte_t pte)
{
return pte_mkdirty(pte);
}
static inline pte_t huge_pte_wrprotect(pte_t pte)
{
return pte_wrprotect(pte);
}
static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot)
{
return pte_modify(pte, newprot);
}
#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
static inline bool gigantic_page_supported(void) { return true; }
#endif
#endif /* _ASM_S390_HUGETLB_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 EXTENSIONS_BROWSER_WARNING_SET_H_
#define EXTENSIONS_BROWSER_WARNING_SET_H_
#include <set>
#include <string>
#include <vector>
#include "url/gurl.h"
namespace base {
class FilePath;
}
namespace extensions {
class ExtensionSet;
// This class is used by the WarningService to represent warnings if extensions
// misbehave. Note that the WarningService deals only with specific warnings
// that should trigger a badge on the Chrome menu button.
class Warning {
public:
enum WarningType {
// Don't use this, it is only intended for the default constructor and
// does not have localized warning messages for the UI.
kInvalid = 0,
// An extension caused excessive network delays.
kNetworkDelay,
// This extension failed to modify a network request because the
// modification conflicted with a modification of another extension.
kNetworkConflict,
// This extension failed to redirect a network request because another
// extension with higher precedence redirected to a different target.
kRedirectConflict,
// The extension repeatedly flushed WebKit's in-memory cache, which slows
// down the overall performance.
kRepeatedCacheFlushes,
// The extension failed to determine the filename of a download because
// another extension with higher precedence determined a different filename.
kDownloadFilenameConflict,
kReloadTooFrequent,
kMaxWarningType
};
// We allow copy&assign for passing containers of Warnings between threads.
Warning(const Warning& other);
~Warning();
Warning& operator=(const Warning& other);
// Factory methods for various warning types.
static Warning CreateNetworkDelayWarning(
const std::string& extension_id);
static Warning CreateNetworkConflictWarning(
const std::string& extension_id);
static Warning CreateRedirectConflictWarning(
const std::string& extension_id,
const std::string& winning_extension_id,
const GURL& attempted_redirect_url,
const GURL& winning_redirect_url);
static Warning CreateRequestHeaderConflictWarning(
const std::string& extension_id,
const std::string& winning_extension_id,
const std::string& conflicting_header);
static Warning CreateResponseHeaderConflictWarning(
const std::string& extension_id,
const std::string& winning_extension_id,
const std::string& conflicting_header);
static Warning CreateCredentialsConflictWarning(
const std::string& extension_id,
const std::string& winning_extension_id);
static Warning CreateRepeatedCacheFlushesWarning(
const std::string& extension_id);
static Warning CreateDownloadFilenameConflictWarning(
const std::string& losing_extension_id,
const std::string& winning_extension_id,
const base::FilePath& losing_filename,
const base::FilePath& winning_filename);
static Warning CreateReloadTooFrequentWarning(
const std::string& extension_id);
// Returns the specific warning type.
WarningType warning_type() const { return type_; }
// Returns the id of the extension for which this warning is valid.
const std::string& extension_id() const { return extension_id_; }
// Returns a localized warning message.
std::string GetLocalizedMessage(const ExtensionSet* extensions) const;
private:
// Constructs a warning of type |type| for extension |extension_id|. This
// could indicate for example the fact that an extension conflicted with
// others. The |message_id| refers to an IDS_ string ID. The
// |message_parameters| are filled into the message template.
Warning(WarningType type,
const std::string& extension_id,
int message_id,
const std::vector<std::string>& message_parameters);
WarningType type_;
std::string extension_id_;
// IDS_* resource ID.
int message_id_;
// Parameters to be filled into the string identified by |message_id_|.
std::vector<std::string> message_parameters_;
};
// Compare Warnings based on the tuple of (extension_id, type).
// The message associated with Warnings is purely informational
// and does not contribute to distinguishing extensions.
bool operator<(const Warning& a, const Warning& b);
typedef std::set<Warning> WarningSet;
} // namespace extensions
#endif // EXTENSIONS_BROWSER_WARNING_SET_H_
|
/* CacheFiles statistics
*
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licence
* as published by the Free Software Foundation; either version
* 2 of the Licence, or (at your option) any later version.
*/
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "internal.h"
atomic_t cachefiles_lookup_histogram[HZ];
atomic_t cachefiles_mkdir_histogram[HZ];
atomic_t cachefiles_create_histogram[HZ];
/*
* display the latency histogram
*/
static int cachefiles_histogram_show(struct seq_file *m, void *v)
{
unsigned long index;
unsigned x, y, z, t;
switch ((unsigned long) v) {
case 1:
seq_puts(m, "JIFS SECS LOOKUPS MKDIRS CREATES\n");
return 0;
case 2:
seq_puts(m, "===== ===== ========= ========= =========\n");
return 0;
default:
index = (unsigned long) v - 3;
x = atomic_read(&cachefiles_lookup_histogram[index]);
y = atomic_read(&cachefiles_mkdir_histogram[index]);
z = atomic_read(&cachefiles_create_histogram[index]);
if (x == 0 && y == 0 && z == 0)
return 0;
t = (index * 1000) / HZ;
seq_printf(m, "%4lu 0.%03u %9u %9u %9u\n", index, t, x, y, z);
return 0;
}
}
/*
* set up the iterator to start reading from the first line
*/
static void *cachefiles_histogram_start(struct seq_file *m, loff_t *_pos)
{
if ((unsigned long long)*_pos >= HZ + 2)
return NULL;
if (*_pos == 0)
*_pos = 1;
return (void *)(unsigned long) *_pos;
}
/*
* move to the next line
*/
static void *cachefiles_histogram_next(struct seq_file *m, void *v, loff_t *pos)
{
(*pos)++;
return (unsigned long long)*pos > HZ + 2 ?
NULL : (void *)(unsigned long) *pos;
}
/*
* clean up after reading
*/
static void cachefiles_histogram_stop(struct seq_file *m, void *v)
{
}
static const struct seq_operations cachefiles_histogram_ops = {
.start = cachefiles_histogram_start,
.stop = cachefiles_histogram_stop,
.next = cachefiles_histogram_next,
.show = cachefiles_histogram_show,
};
/*
* open "/proc/fs/cachefiles/XXX" which provide statistics summaries
*/
static int cachefiles_histogram_open(struct inode *inode, struct file *file)
{
return seq_open(file, &cachefiles_histogram_ops);
}
static const struct file_operations cachefiles_histogram_fops = {
.open = cachefiles_histogram_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*
* initialise the /proc/fs/cachefiles/ directory
*/
int __init cachefiles_proc_init(void)
{
_enter("");
if (!proc_mkdir("fs/cachefiles", NULL))
goto error_dir;
if (!proc_create("fs/cachefiles/histogram", S_IFREG | 0444, NULL,
&cachefiles_histogram_fops))
goto error_histogram;
_leave(" = 0");
return 0;
error_histogram:
remove_proc_entry("fs/cachefiles", NULL);
error_dir:
_leave(" = -ENOMEM");
return -ENOMEM;
}
/*
* clean up the /proc/fs/cachefiles/ directory
*/
void cachefiles_proc_cleanup(void)
{
remove_proc_entry("fs/cachefiles/histogram", NULL);
remove_proc_entry("fs/cachefiles", NULL);
}
|
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
/* { dg-options "-O2 -march=pentiumpro -minline-all-stringops -fno-common" } */
/* { dg-add-options bind_pic_locally } */
/* { dg-final { scan-assembler "rep" } } */
/* { dg-final { scan-assembler "movs" } } */
/* { dg-final { scan-assembler-not "test" } } */
/* { dg-final { scan-assembler "\.L?:" } } */
/* A and B are aligned, but we used to lose track of it.
Ensure that memcpy is inlined and alignment prologue is missing. */
char a[2048];
char b[2048];
void t(void)
{
__builtin_memcpy (a,b,2048);
}
|
/*
* Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or 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.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <ipxe/process.h>
#include <ipxe/console.h>
#include <ipxe/keys.h>
#include <ipxe/job.h>
#include <ipxe/monojob.h>
#include <ipxe/timer.h>
/** @file
*
* Single foreground job
*
*/
static int monojob_rc;
static void monojob_close ( struct interface *intf, int rc ) {
monojob_rc = rc;
intf_restart ( intf, rc );
}
static struct interface_operation monojob_intf_op[] = {
INTF_OP ( intf_close, struct interface *, monojob_close ),
};
static struct interface_descriptor monojob_intf_desc =
INTF_DESC_PURE ( monojob_intf_op );
struct interface monojob = INTF_INIT ( monojob_intf_desc );
/**
* Wait for single foreground job to complete
*
* @v string Job description to display
* @ret rc Job final status code
*/
int monojob_wait ( const char *string ) {
struct job_progress progress;
int key;
int rc;
unsigned long last_progress;
unsigned long elapsed;
unsigned long completed;
unsigned long total;
unsigned int percentage;
int shown_percentage = 0;
printf ( "%s...", string );
monojob_rc = -EINPROGRESS;
last_progress = currticks();
while ( monojob_rc == -EINPROGRESS ) {
step();
if ( iskey() ) {
key = getchar();
switch ( key ) {
case CTRL_C:
monojob_close ( &monojob, -ECANCELED );
break;
default:
break;
}
}
elapsed = ( currticks() - last_progress );
if ( elapsed >= TICKS_PER_SEC ) {
if ( shown_percentage )
printf ( "\b\b\b\b \b\b\b\b" );
job_progress ( &monojob, &progress );
/* Normalise progress figures to avoid overflow */
completed = ( progress.completed / 128 );
total = ( progress.total / 128 );
if ( total ) {
percentage = ( ( 100 * completed ) / total );
printf ( "%3d%%", percentage );
shown_percentage = 1;
} else {
printf ( "." );
shown_percentage = 0;
}
last_progress = currticks();
}
}
rc = monojob_rc;
if ( shown_percentage )
printf ( "\b\b\b\b \b\b\b\b" );
if ( rc ) {
printf ( " %s\n", strerror ( rc ) );
} else {
printf ( " ok\n" );
}
return rc;
}
|
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; 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/>.
*/
#ifndef DEF_THE_EYE_H
#define DEF_THE_EYE_H
#define DATA_ALAREVENT 1
#define DATA_ASTROMANCER 2
#define DATA_GRANDASTROMANCERCAPERNIAN 3
#define DATA_HIGHASTROMANCERSOLARIANEVENT 4
#define DATA_KAELTHAS 5
#define DATA_KAELTHASEVENT 6
#define DATA_LORDSANGUINAR 7
#define DATA_MASTERENGINEERTELONICUS 8
#define DATA_THALADREDTHEDARKENER 10
#define DATA_VOIDREAVEREVENT 11
#define DATA_ALAR 12
#endif
|
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Lennart Poettering
systemd 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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <unistd.h>
#include "ima-util.h"
static int use_ima_cached = -1;
bool use_ima(void) {
if (use_ima_cached < 0)
use_ima_cached = access("/sys/kernel/security/ima/", F_OK) >= 0;
return use_ima_cached;
}
|
// 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 RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
#define RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
#include "base/files/file_path.h"
#include "base/threading/non_thread_safe.h"
#include "base/values.h"
#include "rlz/lib/rlz_value_store.h"
namespace base {
class ListValue;
class SequencedTaskRunner;
class Value;
}
namespace rlz_lib {
// An implementation of RlzValueStore for ChromeOS.
class RlzValueStoreChromeOS : public RlzValueStore,
public base::NonThreadSafe {
public:
// // Sets the task runner that will be used by ImportantFileWriter for write
// // operations.
// static void SetFileTaskRunner(base::SequencedTaskRunner* file_task_runner);
// Creates new instance and synchronously reads data from file.
RlzValueStoreChromeOS(const base::FilePath& store_path);
virtual ~RlzValueStoreChromeOS();
// RlzValueStore overrides:
virtual bool HasAccess(AccessType type) OVERRIDE;
virtual bool WritePingTime(Product product, int64 time) OVERRIDE;
virtual bool ReadPingTime(Product product, int64* time) OVERRIDE;
virtual bool ClearPingTime(Product product) OVERRIDE;
virtual bool WriteAccessPointRlz(AccessPoint access_point,
const char* new_rlz) OVERRIDE;
virtual bool ReadAccessPointRlz(AccessPoint access_point,
char* rlz,
size_t rlz_size) OVERRIDE;
virtual bool ClearAccessPointRlz(AccessPoint access_point) OVERRIDE;
virtual bool AddProductEvent(Product product, const char* event_rlz) OVERRIDE;
virtual bool ReadProductEvents(Product product,
std::vector<std::string>* events) OVERRIDE;
virtual bool ClearProductEvent(Product product,
const char* event_rlz) OVERRIDE;
virtual bool ClearAllProductEvents(Product product) OVERRIDE;
virtual bool AddStatefulEvent(Product product,
const char* event_rlz) OVERRIDE;
virtual bool IsStatefulEvent(Product product,
const char* event_rlz) OVERRIDE;
virtual bool ClearAllStatefulEvents(Product product) OVERRIDE;
virtual void CollectGarbage() OVERRIDE;
private:
// Reads RLZ store from file.
void ReadStore();
// Writes RLZ store back to file.
void WriteStore();
// Adds |value| to list at |list_name| path in JSON store.
bool AddValueToList(std::string list_name, base::Value* value);
// Removes |value| from list at |list_name| path in JSON store.
bool RemoveValueFromList(std::string list_name, const base::Value& value);
// In-memory store with RLZ data.
scoped_ptr<base::DictionaryValue> rlz_store_;
base::FilePath store_path_;
bool read_only_;
DISALLOW_COPY_AND_ASSIGN(RlzValueStoreChromeOS);
};
} // namespace rlz_lib
#endif // RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
|
// SPDX-License-Identifier: GPL-2.0-only
/*
*
* Copyright (C) 2012 John Crispin <john@phrozen.org>
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/gpio/driver.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <lantiq_soc.h>
/*
* By attaching hardware latches to the EBU it is possible to create output
* only gpios. This driver configures a special memory address, which when
* written to outputs 16 bit to the latches.
*/
#define LTQ_EBU_BUSCON 0x1e7ff /* 16 bit access, slowest timing */
#define LTQ_EBU_WP 0x80000000 /* write protect bit */
struct ltq_mm {
struct of_mm_gpio_chip mmchip;
u16 shadow; /* shadow the latches state */
};
/**
* ltq_mm_apply() - write the shadow value to the ebu address.
* @chip: Pointer to our private data structure.
*
* Write the shadow value to the EBU to set the gpios. We need to set the
* global EBU lock to make sure that PCI/MTD dont break.
*/
static void ltq_mm_apply(struct ltq_mm *chip)
{
unsigned long flags;
spin_lock_irqsave(&ebu_lock, flags);
ltq_ebu_w32(LTQ_EBU_BUSCON, LTQ_EBU_BUSCON1);
__raw_writew(chip->shadow, chip->mmchip.regs);
ltq_ebu_w32(LTQ_EBU_BUSCON | LTQ_EBU_WP, LTQ_EBU_BUSCON1);
spin_unlock_irqrestore(&ebu_lock, flags);
}
/**
* ltq_mm_set() - gpio_chip->set - set gpios.
* @gc: Pointer to gpio_chip device structure.
* @gpio: GPIO signal number.
* @val: Value to be written to specified signal.
*
* Set the shadow value and call ltq_mm_apply.
*/
static void ltq_mm_set(struct gpio_chip *gc, unsigned offset, int value)
{
struct ltq_mm *chip = gpiochip_get_data(gc);
if (value)
chip->shadow |= (1 << offset);
else
chip->shadow &= ~(1 << offset);
ltq_mm_apply(chip);
}
/**
* ltq_mm_dir_out() - gpio_chip->dir_out - set gpio direction.
* @gc: Pointer to gpio_chip device structure.
* @gpio: GPIO signal number.
* @val: Value to be written to specified signal.
*
* Same as ltq_mm_set, always returns 0.
*/
static int ltq_mm_dir_out(struct gpio_chip *gc, unsigned offset, int value)
{
ltq_mm_set(gc, offset, value);
return 0;
}
/**
* ltq_mm_save_regs() - Set initial values of GPIO pins
* @mm_gc: pointer to memory mapped GPIO chip structure
*/
static void ltq_mm_save_regs(struct of_mm_gpio_chip *mm_gc)
{
struct ltq_mm *chip =
container_of(mm_gc, struct ltq_mm, mmchip);
/* tell the ebu controller which memory address we will be using */
ltq_ebu_w32(CPHYSADDR(chip->mmchip.regs) | 0x1, LTQ_EBU_ADDRSEL1);
ltq_mm_apply(chip);
}
static int ltq_mm_probe(struct platform_device *pdev)
{
struct ltq_mm *chip;
u32 shadow;
chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
platform_set_drvdata(pdev, chip);
chip->mmchip.gc.ngpio = 16;
chip->mmchip.gc.direction_output = ltq_mm_dir_out;
chip->mmchip.gc.set = ltq_mm_set;
chip->mmchip.save_regs = ltq_mm_save_regs;
/* store the shadow value if one was passed by the devicetree */
if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
chip->shadow = shadow;
return of_mm_gpiochip_add_data(pdev->dev.of_node, &chip->mmchip, chip);
}
static int ltq_mm_remove(struct platform_device *pdev)
{
struct ltq_mm *chip = platform_get_drvdata(pdev);
of_mm_gpiochip_remove(&chip->mmchip);
return 0;
}
static const struct of_device_id ltq_mm_match[] = {
{ .compatible = "lantiq,gpio-mm" },
{},
};
MODULE_DEVICE_TABLE(of, ltq_mm_match);
static struct platform_driver ltq_mm_driver = {
.probe = ltq_mm_probe,
.remove = ltq_mm_remove,
.driver = {
.name = "gpio-mm-ltq",
.of_match_table = ltq_mm_match,
},
};
static int __init ltq_mm_init(void)
{
return platform_driver_register(<q_mm_driver);
}
subsys_initcall(ltq_mm_init);
static void __exit ltq_mm_exit(void)
{
platform_driver_unregister(<q_mm_driver);
}
module_exit(ltq_mm_exit);
|
/*
* SpanDSP - a series of DSP components for telephony
*
* lpc10.h - LPC10 low bit rate speech codec.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: lpc10.h,v 1.22 2009/04/11 18:11:19 steveu Exp $
*/
#if !defined(_SPANDSP_LPC10_H_)
#define _SPANDSP_LPC10_H_
/*! \page lpc10_page LPC10 encoding and decoding
\section lpc10_page_sec_1 What does it do?
The LPC10 module implements the US Department of Defense LPC10
codec. This codec produces compressed data at 2400bps. At such
a low rate high fidelity cannot be expected. However, the speech
clarity is quite good, and this codec is unencumbered by patent
or other restrictions.
\section lpc10_page_sec_2 How does it work?
???.
*/
#define LPC10_SAMPLES_PER_FRAME 180
#define LPC10_BITS_IN_COMPRESSED_FRAME 54
/*!
LPC10 codec unpacked frame.
*/
typedef struct
{
/*! Pitch */
int32_t ipitch;
/*! Energy */
int32_t irms;
/*! Reflection coefficients */
int32_t irc[10];
} lpc10_frame_t;
/*!
LPC10 codec encoder state descriptor. This defines the state of
a single working instance of the LPC10 encoder.
*/
typedef struct lpc10_encode_state_s lpc10_encode_state_t;
/*!
LPC10 codec decoder state descriptor. This defines the state of
a single working instance of the LPC10 decoder.
*/
typedef struct lpc10_decode_state_s lpc10_decode_state_t;
#if defined(__cplusplus)
extern "C"
{
#endif
/*! Initialise an LPC10e encode context.
\param s The LPC10e context
\param error_correction ???
\return A pointer to the LPC10e context, or NULL for error. */
SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s, int error_correction);
SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s);
SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s);
/*! Encode a buffer of linear PCM data to LPC10e.
\param s The LPC10e context.
\param ima_data The LPC10e data produced.
\param amp The audio sample buffer.
\param len The number of samples in the buffer. This must be a multiple of 180, as
this is the number of samples on a frame.
\return The number of bytes of LPC10e data produced. */
SPAN_DECLARE(int) lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len);
/*! Initialise an LPC10e decode context.
\param s The LPC10e context
\param error_correction ???
\return A pointer to the LPC10e context, or NULL for error. */
SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *st, int error_correction);
SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s);
SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s);
/*! Decode a buffer of LPC10e data to linear PCM.
\param s The LPC10e context.
\param amp The audio sample buffer.
\param code The LPC10e data.
\param len The number of bytes of LPC10e data to be decoded. This must be a multiple of 7,
as each frame is packed into 7 bytes.
\return The number of samples returned. */
SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of include ---------------------------------------------------------*/
|
/**
* @file BRandom2.h
* @author Ambroz Bizjak <ambrop7@gmail.com>
*
* @section LICENSE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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 BADVPN_RANDOM2_H
#define BADVPN_RANDOM2_H
#include <stddef.h>
#include <misc/debug.h>
#include <base/DebugObject.h>
#define BRANDOM2_INIT_LAZY (1 << 0)
typedef struct {
int initialized;
int urandom_fd;
DebugObject d_obj;
} BRandom2;
int BRandom2_Init (BRandom2 *o, int flags) WARN_UNUSED;
void BRandom2_Free (BRandom2 *o);
int BRandom2_GenBytes (BRandom2 *o, void *out, size_t len) WARN_UNUSED;
#endif
|
/****************************************************************************
Copyright Echo Digital Audio Corporation (c) 1998 - 2004
All rights reserved
www.echoaudio.com
This file is part of Echo Digital Audio's generic driver library.
Echo Digital Audio's generic driver library 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 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.
*************************************************************************
Translation from C++ and adaptation for use in ALSA-Driver
were made by Giuliano Pochini <pochini@shiny.it>
****************************************************************************/
/* These functions are common for Gina24, Layla24 and Mona cards */
/* ASIC status check - some cards have one or two ASICs that need to be
loaded. Once that load is complete, this function is called to see if
the load was successful.
If this load fails, it does not necessarily mean that the hardware is
defective - the external box may be disconnected or turned off. */
static int check_asic_status(struct echoaudio *chip)
{
u32 asic_status;
send_vector(chip, DSP_VC_TEST_ASIC);
/* The DSP will return a value to indicate whether or not the
ASIC is currently loaded */
if (read_dsp(chip, &asic_status) < 0) {
dev_err(chip->card->dev,
"check_asic_status: failed on read_dsp\n");
chip->asic_loaded = FALSE;
return -EIO;
}
chip->asic_loaded = (asic_status == ASIC_ALREADY_LOADED);
return chip->asic_loaded ? 0 : -EIO;
}
/* Most configuration of Gina24, Layla24, or Mona is accomplished by writing
the control register. write_control_reg sends the new control register
value to the DSP. */
static int write_control_reg(struct echoaudio *chip, u32 value, char force)
{
/* Handle the digital input auto-mute */
if (chip->digital_in_automute)
value |= GML_DIGITAL_IN_AUTO_MUTE;
else
value &= ~GML_DIGITAL_IN_AUTO_MUTE;
dev_dbg(chip->card->dev, "write_control_reg: 0x%x\n", value);
/* Write the control register */
value = cpu_to_le32(value);
if (value != chip->comm_page->control_register || force) {
if (wait_handshake(chip))
return -EIO;
chip->comm_page->control_register = value;
clear_handshake(chip);
return send_vector(chip, DSP_VC_WRITE_CONTROL_REG);
}
return 0;
}
/* Gina24, Layla24, and Mona support digital input auto-mute. If the digital
input auto-mute is enabled, the DSP will only enable the digital inputs if
the card is syncing to a valid clock on the ADAT or S/PDIF inputs.
If the auto-mute is disabled, the digital inputs are enabled regardless of
what the input clock is set or what is connected. */
static int set_input_auto_mute(struct echoaudio *chip, int automute)
{
dev_dbg(chip->card->dev, "set_input_auto_mute %d\n", automute);
chip->digital_in_automute = automute;
/* Re-set the input clock to the current value - indirectly causes
the auto-mute flag to be sent to the DSP */
return set_input_clock(chip, chip->input_clock);
}
/* S/PDIF coax / S/PDIF optical / ADAT - switch */
static int set_digital_mode(struct echoaudio *chip, u8 mode)
{
u8 previous_mode;
int err, i, o;
if (chip->bad_board)
return -EIO;
/* All audio channels must be closed before changing the digital mode */
if (snd_BUG_ON(chip->pipe_alloc_mask))
return -EAGAIN;
if (snd_BUG_ON(!(chip->digital_modes & (1 << mode))))
return -EINVAL;
previous_mode = chip->digital_mode;
err = dsp_set_digital_mode(chip, mode);
/* If we successfully changed the digital mode from or to ADAT,
then make sure all output, input and monitor levels are
updated by the DSP comm object. */
if (err >= 0 && previous_mode != mode &&
(previous_mode == DIGITAL_MODE_ADAT || mode == DIGITAL_MODE_ADAT)) {
spin_lock_irq(&chip->lock);
for (o = 0; o < num_busses_out(chip); o++)
for (i = 0; i < num_busses_in(chip); i++)
set_monitor_gain(chip, o, i,
chip->monitor_gain[o][i]);
#ifdef ECHOCARD_HAS_INPUT_GAIN
for (i = 0; i < num_busses_in(chip); i++)
set_input_gain(chip, i, chip->input_gain[i]);
update_input_line_level(chip);
#endif
for (o = 0; o < num_busses_out(chip); o++)
set_output_gain(chip, o, chip->output_gain[o]);
update_output_line_level(chip);
spin_unlock_irq(&chip->lock);
}
return err;
}
/* Set the S/PDIF output format */
static int set_professional_spdif(struct echoaudio *chip, char prof)
{
u32 control_reg;
int err;
/* Clear the current S/PDIF flags */
control_reg = le32_to_cpu(chip->comm_page->control_register);
control_reg &= GML_SPDIF_FORMAT_CLEAR_MASK;
/* Set the new S/PDIF flags depending on the mode */
control_reg |= GML_SPDIF_TWO_CHANNEL | GML_SPDIF_24_BIT |
GML_SPDIF_COPY_PERMIT;
if (prof) {
/* Professional mode */
control_reg |= GML_SPDIF_PRO_MODE;
switch (chip->sample_rate) {
case 32000:
control_reg |= GML_SPDIF_SAMPLE_RATE0 |
GML_SPDIF_SAMPLE_RATE1;
break;
case 44100:
control_reg |= GML_SPDIF_SAMPLE_RATE0;
break;
case 48000:
control_reg |= GML_SPDIF_SAMPLE_RATE1;
break;
}
} else {
/* Consumer mode */
switch (chip->sample_rate) {
case 32000:
control_reg |= GML_SPDIF_SAMPLE_RATE0 |
GML_SPDIF_SAMPLE_RATE1;
break;
case 48000:
control_reg |= GML_SPDIF_SAMPLE_RATE1;
break;
}
}
if ((err = write_control_reg(chip, control_reg, FALSE)))
return err;
chip->professional_spdif = prof;
dev_dbg(chip->card->dev, "set_professional_spdif to %s\n",
prof ? "Professional" : "Consumer");
return 0;
}
|
/*
* Coldfire generic GPIO support
*
* (C) Copyright 2009, Steven King <sfking@fdwdc.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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
static struct mcf_gpio_chip mcf_gpio_chips[] = {
{
.gpio_chip = {
.label = "PIRQ",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value,
.ngpio = 8,
},
.pddr = (void __iomem *) MCFEPORT_EPDDR,
.podr = (void __iomem *) MCFEPORT_EPDR,
.ppdr = (void __iomem *) MCFEPORT_EPPDR,
},
{
.gpio_chip = {
.label = "CS",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 9,
.ngpio = 3,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_CS,
.podr = (void __iomem *) MCFGPIO_PODR_CS,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
.setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
.clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
},
{
.gpio_chip = {
.label = "FECI2C",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 16,
.ngpio = 4,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
.podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
},
{
.gpio_chip = {
.label = "QSPI",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 24,
.ngpio = 4,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
.podr = (void __iomem *) MCFGPIO_PODR_QSPI,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
.setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
.clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
},
{
.gpio_chip = {
.label = "TIMER",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 32,
.ngpio = 4,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
.podr = (void __iomem *) MCFGPIO_PODR_TIMER,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
.setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
.clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
},
{
.gpio_chip = {
.label = "UART",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 40,
.ngpio = 8,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_UART,
.podr = (void __iomem *) MCFGPIO_PODR_UART,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_UART,
.setr = (void __iomem *) MCFGPIO_PPDSDR_UART,
.clrr = (void __iomem *) MCFGPIO_PCLRR_UART,
},
{
.gpio_chip = {
.label = "FECH",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 48,
.ngpio = 8,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
.podr = (void __iomem *) MCFGPIO_PODR_FECH,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECH,
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECH,
},
{
.gpio_chip = {
.label = "FECL",
.request = mcf_gpio_request,
.free = mcf_gpio_free,
.direction_input = mcf_gpio_direction_input,
.direction_output = mcf_gpio_direction_output,
.get = mcf_gpio_get_value,
.set = mcf_gpio_set_value_fast,
.base = 56,
.ngpio = 8,
},
.pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
.podr = (void __iomem *) MCFGPIO_PODR_FECL,
.ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
.setr = (void __iomem *) MCFGPIO_PPDSDR_FECL,
.clrr = (void __iomem *) MCFGPIO_PCLRR_FECL,
},
};
static int __init mcf_gpio_init(void)
{
unsigned i = 0;
while (i < ARRAY_SIZE(mcf_gpio_chips))
(void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
return 0;
}
core_initcall(mcf_gpio_init);
|
/*
* OMAP3/OMAP4 smartreflex device file
*
* Author: Thara Gopinath <thara@ti.com>
*
* Based originally on code from smartreflex.c
* Copyright (C) 2010 Texas Instruments, Inc.
* Thara Gopinath <thara@ti.com>
*
* Copyright (C) 2008 Nokia Corporation
* Kalle Jokiniemi
*
* Copyright (C) 2007 Texas Instruments, Inc.
* Lesly A M <x0080970@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.
*/
#include <linux/power/smartreflex.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/io.h>
#include "soc.h"
#include "omap_device.h"
#include "voltage.h"
#include "control.h"
#include "pm.h"
static bool sr_enable_on_init;
/* Read EFUSE values from control registers for OMAP3430 */
static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
struct omap_sr_data *sr_data)
{
struct omap_sr_nvalue_table *nvalue_table;
int i, j, count = 0;
sr_data->nvalue_count = 0;
sr_data->nvalue_table = NULL;
while (volt_data[count].volt_nominal)
count++;
nvalue_table = kcalloc(count, sizeof(*nvalue_table), GFP_KERNEL);
if (!nvalue_table)
return;
for (i = 0, j = 0; i < count; i++) {
u32 v;
/*
* In OMAP4 the efuse registers are 24 bit aligned.
* A readl_relaxed will fail for non-32 bit aligned address
* and hence the 8-bit read and shift.
*/
if (cpu_is_omap44xx()) {
u16 offset = volt_data[i].sr_efuse_offs;
v = omap_ctrl_readb(offset) |
omap_ctrl_readb(offset + 1) << 8 |
omap_ctrl_readb(offset + 2) << 16;
} else {
v = omap_ctrl_readl(volt_data[i].sr_efuse_offs);
}
/*
* Many OMAP SoCs don't have the eFuse values set.
* For example, pretty much all OMAP3xxx before
* ES3.something.
*
* XXX There needs to be some way for board files or
* userspace to add these in.
*/
if (v == 0)
continue;
nvalue_table[j].nvalue = v;
nvalue_table[j].efuse_offs = volt_data[i].sr_efuse_offs;
nvalue_table[j].errminlimit = volt_data[i].sr_errminlimit;
nvalue_table[j].volt_nominal = volt_data[i].volt_nominal;
j++;
}
sr_data->nvalue_table = nvalue_table;
sr_data->nvalue_count = j;
}
extern struct omap_sr_data omap_sr_pdata[];
static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
{
struct omap_sr_data *sr_data = NULL;
struct omap_volt_data *volt_data;
struct omap_smartreflex_dev_attr *sr_dev_attr;
static int i;
if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) ||
!strncmp(oh->name, "smartreflex_mpu", 16))
sr_data = &omap_sr_pdata[OMAP_SR_MPU];
else if (!strncmp(oh->name, "smartreflex_core", 17))
sr_data = &omap_sr_pdata[OMAP_SR_CORE];
else if (!strncmp(oh->name, "smartreflex_iva", 16))
sr_data = &omap_sr_pdata[OMAP_SR_IVA];
if (!sr_data) {
pr_err("%s: Unknown instance %s\n", __func__, oh->name);
return -EINVAL;
}
sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;
if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
pr_err("%s: No voltage domain specified for %s. Cannot initialize\n",
__func__, oh->name);
goto exit;
}
sr_data->name = oh->name;
sr_data->ip_type = oh->class->rev;
sr_data->senn_mod = 0x1;
sr_data->senp_mod = 0x1;
if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
sr_data->err_weight = OMAP3430_SR_ERRWEIGHT;
sr_data->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
sr_data->accum_data = OMAP3430_SR_ACCUMDATA;
if (!(strcmp(sr_data->name, "smartreflex_mpu"))) {
sr_data->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT;
sr_data->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT;
} else {
sr_data->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT;
sr_data->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT;
}
}
sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
if (!sr_data->voltdm) {
pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
__func__, sr_dev_attr->sensor_voltdm_name);
goto exit;
}
omap_voltage_get_volttable(sr_data->voltdm, &volt_data);
if (!volt_data) {
pr_err("%s: No Voltage table registered for VDD%d\n",
__func__, i + 1);
goto exit;
}
sr_set_nvalues(volt_data, sr_data);
sr_data->enable_on_init = sr_enable_on_init;
exit:
i++;
return 0;
}
/*
* API to be called from board files to enable smartreflex
* autocompensation at init.
*/
void __init omap_enable_smartreflex_on_init(void)
{
sr_enable_on_init = true;
}
int __init omap_devinit_smartreflex(void)
{
return omap_hwmod_for_each_by_class("smartreflex", sr_dev_init, NULL);
}
|
/****************************************************************************
Copyright (c) 2014 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __EditBoxEVENT_H__
#define __EditBoxEVENT_H__
#include "InputEvent.h"
#include <agile.h>
namespace PhoneDirect3DXamlAppComponent
{
class EditBoxEvent : public cocos2d::InputEvent
{
public:
EditBoxEvent(Platform::Object^ sender, Platform::String^ arg, Windows::Foundation::EventHandler<Platform::String^>^ handle);
virtual void execute();
private:
Platform::Agile<Platform::Object^> m_sender;
Platform::Agile<Platform::String^> m_args;
Platform::Agile<Windows::Foundation::EventHandler<Platform::String^>^> m_handler;
};
}
#endif
|
// SPDX-License-Identifier: MIT
/*
* Copyright © 2019 Intel Corporation
*/
#include <linux/vga_switcheroo.h>
#include "i915_drv.h"
#include "i915_switcheroo.h"
static void i915_switcheroo_set_state(struct pci_dev *pdev,
enum vga_switcheroo_state state)
{
struct drm_i915_private *i915 = pdev_to_i915(pdev);
pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
if (!i915) {
dev_err(&pdev->dev, "DRM not initialized, aborting switch.\n");
return;
}
if (state == VGA_SWITCHEROO_ON) {
drm_info(&i915->drm, "switched on\n");
i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING;
/* i915 resume handler doesn't set to D0 */
pci_set_power_state(pdev, PCI_D0);
i915_resume_switcheroo(i915);
i915->drm.switch_power_state = DRM_SWITCH_POWER_ON;
} else {
drm_info(&i915->drm, "switched off\n");
i915->drm.switch_power_state = DRM_SWITCH_POWER_CHANGING;
i915_suspend_switcheroo(i915, pmm);
i915->drm.switch_power_state = DRM_SWITCH_POWER_OFF;
}
}
static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
{
struct drm_i915_private *i915 = pdev_to_i915(pdev);
/*
* FIXME: open_count is protected by drm_global_mutex but that would lead to
* locking inversion with the driver load path. And the access here is
* completely racy anyway. So don't bother with locking for now.
*/
return i915 && atomic_read(&i915->drm.open_count) == 0;
}
static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
.set_gpu_state = i915_switcheroo_set_state,
.reprobe = NULL,
.can_switch = i915_switcheroo_can_switch,
};
int i915_switcheroo_register(struct drm_i915_private *i915)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
return vga_switcheroo_register_client(pdev, &i915_switcheroo_ops, false);
}
void i915_switcheroo_unregister(struct drm_i915_private *i915)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
vga_switcheroo_unregister_client(pdev);
}
|
/*
* Ultra Wide Band
* Driver initialization, etc
*
* Copyright (C) 2005-2006 Intel Corporation
* Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*
* FIXME: docs
*
* Life cycle: FIXME: explain
*
* UWB radio controller:
*
* 1. alloc a uwb_rc, zero it
* 2. call uwb_rc_init() on it to set it up + ops (won't do any
* kind of allocation)
* 3. register (now it is owned by the UWB stack--deregister before
* freeing/destroying).
* 4. It lives on it's own now (UWB stack handles)--when it
* disconnects, call unregister()
* 5. free it.
*
* Make sure you have a reference to the uwb_rc before calling
* any of the UWB API functions.
*
* TODO:
*
* 1. Locking and life cycle management is crappy still. All entry
* points to the UWB HCD API assume you have a reference on the
* uwb_rc structure and that it won't go away. They mutex lock it
* before doing anything.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/kdev_t.h>
#include <linux/random.h>
#include "uwb-internal.h"
/* UWB stack attributes (or 'global' constants) */
/**
* If a beacon disappears for longer than this, then we consider the
* device who was represented by that beacon to be gone.
*
* ECMA-368[17.2.3, last para] establishes that a device must not
* consider a device to be its neighbour if he doesn't receive a beacon
* for more than mMaxLostBeacons. mMaxLostBeacons is defined in
* ECMA-368[17.16] as 3; because we can get only one beacon per
* superframe, that'd be 3 * 65ms = 195 ~ 200 ms. Let's give it time
* for jitter and stuff and make it 500 ms.
*/
unsigned long beacon_timeout_ms = 500;
static
ssize_t beacon_timeout_ms_show(struct class *class,
struct class_attribute *attr,
char *buf)
{
return scnprintf(buf, PAGE_SIZE, "%lu\n", beacon_timeout_ms);
}
static
ssize_t beacon_timeout_ms_store(struct class *class,
struct class_attribute *attr,
const char *buf, size_t size)
{
unsigned long bt;
ssize_t result;
result = sscanf(buf, "%lu", &bt);
if (result != 1)
return -EINVAL;
beacon_timeout_ms = bt;
return size;
}
static struct class_attribute uwb_class_attrs[] = {
__ATTR(beacon_timeout_ms, S_IWUSR | S_IRUGO,
beacon_timeout_ms_show, beacon_timeout_ms_store),
__ATTR_NULL,
};
/** Device model classes */
struct class uwb_rc_class = {
.name = "uwb_rc",
.class_attrs = uwb_class_attrs,
};
static int __init uwb_subsys_init(void)
{
int result = 0;
result = uwb_est_create();
if (result < 0) {
printk(KERN_ERR "uwb: Can't initialize EST subsystem\n");
goto error_est_init;
}
result = class_register(&uwb_rc_class);
if (result < 0)
goto error_uwb_rc_class_register;
/* Register the UWB bus */
result = bus_register(&uwb_bus_type);
if (result) {
pr_err("%s - registering bus driver failed\n", __func__);
goto exit_bus;
}
uwb_dbg_init();
return 0;
exit_bus:
class_unregister(&uwb_rc_class);
error_uwb_rc_class_register:
uwb_est_destroy();
error_est_init:
return result;
}
module_init(uwb_subsys_init);
static void __exit uwb_subsys_exit(void)
{
uwb_dbg_exit();
bus_unregister(&uwb_bus_type);
class_unregister(&uwb_rc_class);
uwb_est_destroy();
return;
}
module_exit(uwb_subsys_exit);
MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
MODULE_DESCRIPTION("Ultra Wide Band core");
MODULE_LICENSE("GPL");
|
// SPDX-License-Identifier: GPL-2.0
/*
* The struct perf_event_attr test support.
*
* This test is embedded inside into perf directly and is governed
* by the PERF_TEST_ATTR environment variable and hook inside
* sys_perf_event_open function.
*
* The general idea is to store 'struct perf_event_attr' details for
* each event created within single perf command. Each event details
* are stored into separate text file. Once perf command is finished
* these files can be checked for values we expect for command.
*
* Besides 'struct perf_event_attr' values we also store 'fd' and
* 'group_fd' values to allow checking for groups created.
*
* This all is triggered by setting PERF_TEST_ATTR environment variable.
* It must contain name of existing directory with access and write
* permissions. All the event text files are stored there.
*/
#include <debug.h>
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "../perf-sys.h"
#include <subcmd/exec-cmd.h>
#include "event.h"
#include "tests.h"
#define ENV "PERF_TEST_ATTR"
static char *dir;
static bool ready;
void test_attr__init(void)
{
dir = getenv(ENV);
test_attr__enabled = (dir != NULL);
}
#define BUFSIZE 1024
#define __WRITE_ASS(str, fmt, data) \
do { \
char buf[BUFSIZE]; \
size_t size; \
\
size = snprintf(buf, BUFSIZE, #str "=%"fmt "\n", data); \
if (1 != fwrite(buf, size, 1, file)) { \
perror("test attr - failed to write event file"); \
fclose(file); \
return -1; \
} \
\
} while (0)
#define WRITE_ASS(field, fmt) __WRITE_ASS(field, fmt, attr->field)
static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags)
{
FILE *file;
char path[PATH_MAX];
if (!ready)
return 0;
snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
attr->type, attr->config, fd);
file = fopen(path, "w+");
if (!file) {
perror("test attr - failed to open event file");
return -1;
}
if (fprintf(file, "[event-%d-%llu-%d]\n",
attr->type, attr->config, fd) < 0) {
perror("test attr - failed to write event file");
fclose(file);
return -1;
}
/* syscall arguments */
__WRITE_ASS(fd, "d", fd);
__WRITE_ASS(group_fd, "d", group_fd);
__WRITE_ASS(cpu, "d", cpu);
__WRITE_ASS(pid, "d", pid);
__WRITE_ASS(flags, "lu", flags);
/* struct perf_event_attr */
WRITE_ASS(type, PRIu32);
WRITE_ASS(size, PRIu32);
WRITE_ASS(config, "llu");
WRITE_ASS(sample_period, "llu");
WRITE_ASS(sample_type, "llu");
WRITE_ASS(read_format, "llu");
WRITE_ASS(disabled, "d");
WRITE_ASS(inherit, "d");
WRITE_ASS(pinned, "d");
WRITE_ASS(exclusive, "d");
WRITE_ASS(exclude_user, "d");
WRITE_ASS(exclude_kernel, "d");
WRITE_ASS(exclude_hv, "d");
WRITE_ASS(exclude_idle, "d");
WRITE_ASS(mmap, "d");
WRITE_ASS(comm, "d");
WRITE_ASS(freq, "d");
WRITE_ASS(inherit_stat, "d");
WRITE_ASS(enable_on_exec, "d");
WRITE_ASS(task, "d");
WRITE_ASS(watermark, "d");
WRITE_ASS(precise_ip, "d");
WRITE_ASS(mmap_data, "d");
WRITE_ASS(sample_id_all, "d");
WRITE_ASS(exclude_host, "d");
WRITE_ASS(exclude_guest, "d");
WRITE_ASS(exclude_callchain_kernel, "d");
WRITE_ASS(exclude_callchain_user, "d");
WRITE_ASS(mmap2, "d");
WRITE_ASS(comm_exec, "d");
WRITE_ASS(context_switch, "d");
WRITE_ASS(write_backward, "d");
WRITE_ASS(namespaces, "d");
WRITE_ASS(use_clockid, "d");
WRITE_ASS(wakeup_events, PRIu32);
WRITE_ASS(bp_type, PRIu32);
WRITE_ASS(config1, "llu");
WRITE_ASS(config2, "llu");
WRITE_ASS(branch_sample_type, "llu");
WRITE_ASS(sample_regs_user, "llu");
WRITE_ASS(sample_stack_user, PRIu32);
fclose(file);
return 0;
}
void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
int fd, int group_fd, unsigned long flags)
{
int errno_saved = errno;
if ((fd != -1) && store_event(attr, pid, cpu, fd, group_fd, flags)) {
pr_err("test attr FAILED");
exit(128);
}
errno = errno_saved;
}
void test_attr__ready(void)
{
if (unlikely(test_attr__enabled) && !ready)
ready = true;
}
static int run_dir(const char *d, const char *perf)
{
char v[] = "-vvvvv";
int vcnt = min(verbose, (int) sizeof(v) - 1);
char cmd[3*PATH_MAX];
if (verbose > 0)
vcnt++;
scnprintf(cmd, 3*PATH_MAX, PYTHON " %s/attr.py -d %s/attr/ -p %s %.*s",
d, d, perf, vcnt, v);
return system(cmd) ? TEST_FAIL : TEST_OK;
}
int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)
{
struct stat st;
char path_perf[PATH_MAX];
char path_dir[PATH_MAX];
/* First try development tree tests. */
if (!lstat("./tests", &st))
return run_dir("./tests", "./perf");
/* Then installed path. */
snprintf(path_dir, PATH_MAX, "%s/tests", get_argv_exec_path());
snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
if (!lstat(path_dir, &st) &&
!lstat(path_perf, &st))
return run_dir(path_dir, path_perf);
return TEST_SKIP;
}
|
/* $Id: sph_groestl.h 216 2010-06-08 09:46:57Z tp $ */
/**
* Groestl interface. This code implements Groestl with the recommended
* parameters for SHA-3, with outputs of 224, 256, 384 and 512 bits.
*
* ==========================(LICENSE BEGIN)============================
*
* Copyright (c) 2007-2010 Projet RNRT SAPHIR
*
* 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.
*
* ===========================(LICENSE END)=============================
*
* @file sph_groestl.h
* @author Thomas Pornin <thomas.pornin@cryptolog.com>
*/
#ifndef SPH_GROESTL_H__
#define SPH_GROESTL_H__
#include <stddef.h>
#include "sph_types.h"
/**
* Output size (in bits) for Groestl-224.
*/
#define SPH_SIZE_groestl224 224
/**
* Output size (in bits) for Groestl-256.
*/
#define SPH_SIZE_groestl256 256
/**
* Output size (in bits) for Groestl-384.
*/
#define SPH_SIZE_groestl384 384
/**
* Output size (in bits) for Groestl-512.
*/
#define SPH_SIZE_groestl512 512
/**
* This structure is a context for Groestl-224 and Groestl-256 computations:
* it contains the intermediate values and some data from the last
* entered block. Once a Groestl computation has been performed, the
* context can be reused for another computation.
*
* The contents of this structure are private. A running Groestl
* computation can be cloned by copying the context (e.g. with a simple
* <code>memcpy()</code>).
*/
typedef struct {
#ifndef DOXYGEN_IGNORE
size_t ptr;
union {
sph_u64 wide[8];
sph_u32 narrow[16];
} state;
sph_u64 count;
} sph_groestl_small_context;
/**
* This structure is a context for Groestl-384 and Groestl-512 computations:
* it contains the intermediate values and some data from the last
* entered block. Once a Groestl computation has been performed, the
* context can be reused for another computation.
*
* The contents of this structure are private. A running Groestl
* computation can be cloned by copying the context (e.g. with a simple
* <code>memcpy()</code>).
*/
typedef struct {
#ifndef DOXYGEN_IGNORE
unsigned char buf[128]; /* first field, for alignment */
size_t ptr;
union {
sph_u64 wide[16];
sph_u32 narrow[32];
} state;
sph_u64 count;
} sph_groestl_big_context;
/**
* This structure is a context for Groestl-512 computations. It is
* identical to the common <code>sph_groestl_small_context</code>.
*/
typedef sph_groestl_big_context sph_groestl512_context;
/**
* Initialize a Groestl-512 context. This process performs no memory allocation.
*
* @param cc the Groestl-512 context (pointer to a
* <code>sph_groestl512_context</code>)
*/
void sph_groestl512_init(void *cc);
/**
* Process some data bytes. It is acceptable that <code>len</code> is zero
* (in which case this function does nothing).
*
* @param cc the Groestl-512 context
* @param data the input data
* @param len the input data length (in bytes)
*/
void sph_groestl512(void *cc, const void *data, size_t len);
/**
* Terminate the current Groestl-512 computation and output the result into
* the provided buffer. The destination buffer must be wide enough to
* accomodate the result (64 bytes). The context is automatically
* reinitialized.
*
* @param cc the Groestl-512 context
* @param dst the destination buffer
*/
void sph_groestl512_close(void *cc, void *dst);
/**
* Add a few additional bits (0 to 7) to the current computation, then
* terminate it and output the result in the provided buffer, which must
* be wide enough to accomodate the result (64 bytes). If bit number i
* in <code>ub</code> has value 2^i, then the extra bits are those
* numbered 7 downto 8-n (this is the big-endian convention at the byte
* level). The context is automatically reinitialized.
*
* @param cc the Groestl-512 context
* @param ub the extra bits
* @param n the number of extra bits (0 to 7)
* @param dst the destination buffer
*/
void sph_groestl512_addbits_and_close(
void *cc, unsigned ub, unsigned n, void *dst);
#endif
|
/* crypto/bio/bio_cb.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "cryptlib.h"
#include <openssl/bio.h>
#include <openssl/err.h>
long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
int argi, long argl, long ret)
{
BIO *b;
MS_STATIC char buf[256];
char *p;
long r = 1;
int len;
size_t p_maxlen;
if (BIO_CB_RETURN & cmd)
r = ret;
len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio);
p = buf + len;
p_maxlen = sizeof(buf) - len;
switch (cmd) {
case BIO_CB_FREE:
BIO_snprintf(p, p_maxlen, "Free - %s\n", bio->method->name);
break;
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
BIO_snprintf(p, p_maxlen, "read(%d,%lu) - %s fd=%d\n",
bio->num, (unsigned long)argi,
bio->method->name, bio->num);
else
BIO_snprintf(p, p_maxlen, "read(%d,%lu) - %s\n",
bio->num, (unsigned long)argi, bio->method->name);
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
BIO_snprintf(p, p_maxlen, "write(%d,%lu) - %s fd=%d\n",
bio->num, (unsigned long)argi,
bio->method->name, bio->num);
else
BIO_snprintf(p, p_maxlen, "write(%d,%lu) - %s\n",
bio->num, (unsigned long)argi, bio->method->name);
break;
case BIO_CB_PUTS:
BIO_snprintf(p, p_maxlen, "puts() - %s\n", bio->method->name);
break;
case BIO_CB_GETS:
BIO_snprintf(p, p_maxlen, "gets(%lu) - %s\n", (unsigned long)argi,
bio->method->name);
break;
case BIO_CB_CTRL:
BIO_snprintf(p, p_maxlen, "ctrl(%lu) - %s\n", (unsigned long)argi,
bio->method->name);
break;
case BIO_CB_RETURN | BIO_CB_READ:
BIO_snprintf(p, p_maxlen, "read return %ld\n", ret);
break;
case BIO_CB_RETURN | BIO_CB_WRITE:
BIO_snprintf(p, p_maxlen, "write return %ld\n", ret);
break;
case BIO_CB_RETURN | BIO_CB_GETS:
BIO_snprintf(p, p_maxlen, "gets return %ld\n", ret);
break;
case BIO_CB_RETURN | BIO_CB_PUTS:
BIO_snprintf(p, p_maxlen, "puts return %ld\n", ret);
break;
case BIO_CB_RETURN | BIO_CB_CTRL:
BIO_snprintf(p, p_maxlen, "ctrl return %ld\n", ret);
break;
default:
BIO_snprintf(p, p_maxlen, "bio callback - unknown type (%d)\n", cmd);
break;
}
b = (BIO *)bio->cb_arg;
if (b != NULL)
BIO_write(b, buf, strlen(buf));
#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
else
fputs(buf, stderr);
#endif
return (r);
}
|
/*
* 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.
*
* Copyright (C) 2009 Wind River Systems,
* written by Ralf Baechle <ralf@linux-mips.org>
*/
#ifndef __ASM_COP2_H
#define __ASM_COP2_H
#include <linux/notifier.h>
#if defined(CONFIG_CPU_CAVIUM_OCTEON)
extern void octeon_cop2_save(struct octeon_cop2_state *);
extern void octeon_cop2_restore(struct octeon_cop2_state *);
#define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2)
#define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2)
#define cop2_present 1
#define cop2_lazy_restore 1
#elif defined(CONFIG_CPU_XLP)
extern void nlm_cop2_save(struct nlm_cop2_state *);
extern void nlm_cop2_restore(struct nlm_cop2_state *);
#define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2)
#define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2)
#define cop2_present 1
#define cop2_lazy_restore 0
#elif defined(CONFIG_CPU_LOONGSON3)
#define cop2_present 1
#define cop2_lazy_restore 1
#define cop2_save(r) do { (void)(r); } while (0)
#define cop2_restore(r) do { (void)(r); } while (0)
#else
#define cop2_present 0
#define cop2_lazy_restore 0
#define cop2_save(r) do { (void)(r); } while (0)
#define cop2_restore(r) do { (void)(r); } while (0)
#endif
enum cu2_ops {
CU2_EXCEPTION,
CU2_LWC2_OP,
CU2_LDC2_OP,
CU2_SWC2_OP,
CU2_SDC2_OP,
};
extern int register_cu2_notifier(struct notifier_block *nb);
extern int cu2_notifier_call_chain(unsigned long val, void *v);
#define cu2_notifier(fn, pri) \
({ \
static struct notifier_block fn##_nb = { \
.notifier_call = fn, \
.priority = pri \
}; \
\
register_cu2_notifier(&fn##_nb); \
})
#endif /* __ASM_COP2_H */
|
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2004, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
*
* File CRESTST.H
*
* Modification History:
* Name Description
* Madhu Katragadda Converted to C
*********************************************************************************
*/
#ifndef _CRESTST
#define _CRESTST
/* C API TEST FOR RESOURCEBUNDLE */
#include "cintltst.h"
void addTestResourceBundleTest(TestNode**);
/**
* Perform several extensive tests using the subtest routine testTag
*/
void TestResourceBundles(void);
/**
* Test construction of ResourceBundle accessing a custom test resource-file
*/
void TestConstruction1(void);
void TestConstruction2(void);
void TestAliasConflict(void);
static void TestGetSize(void);
static void TestGetLocaleByType(void);
/**
* extensive subtests called by TestResourceBundles
**/
UBool testTag(const char* frag, UBool in_Root, UBool in_te, UBool in_te_IN);
void record_pass(void);
void record_fail(void);
int32_t pass;
int32_t fail;
#endif
|
/* PR optimization/11741 */
/* { dg-do compile } */
/* { dg-options "-O2 -minline-all-stringops" } */
/* { dg-options "-O2 -minline-all-stringops -march=pentium4" { target ia32 } } */
extern void *memcpy (void *, const void *, __SIZE_TYPE__);
extern __SIZE_TYPE__ strlen (const char *);
void
foo (char *p)
{
for (;;)
{
memcpy (p, p + 1, strlen (p));
p++;
}
}
|
/*
* Copyright (c) 2014 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <arm_neon.h>
void vp8_dc_only_idct_add_neon(
int16_t input_dc,
unsigned char *pred_ptr,
int pred_stride,
unsigned char *dst_ptr,
int dst_stride) {
int i;
uint16_t a1 = ((input_dc + 4) >> 3);
uint32x2_t d2u32 = vdup_n_u32(0);
uint8x8_t d2u8;
uint16x8_t q1u16;
uint16x8_t qAdd;
qAdd = vdupq_n_u16(a1);
for (i = 0; i < 2; i++) {
d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 0);
pred_ptr += pred_stride;
d2u32 = vld1_lane_u32((const uint32_t *)pred_ptr, d2u32, 1);
pred_ptr += pred_stride;
q1u16 = vaddw_u8(qAdd, vreinterpret_u8_u32(d2u32));
d2u8 = vqmovun_s16(vreinterpretq_s16_u16(q1u16));
vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 0);
dst_ptr += dst_stride;
vst1_lane_u32((uint32_t *)dst_ptr, vreinterpret_u32_u8(d2u8), 1);
dst_ptr += dst_stride;
}
}
|
/*
FUNCTION
<<strncmp>>---character string compare
INDEX
strncmp
ANSI_SYNOPSIS
#include <string.h>
int strncmp(const char *<[a]>, const char * <[b]>, size_t <[length]>);
TRAD_SYNOPSIS
#include <string.h>
int strncmp(<[a]>, <[b]>, <[length]>)
char *<[a]>;
char *<[b]>;
size_t <[length]>
DESCRIPTION
<<strncmp>> compares up to <[length]> characters
from the string at <[a]> to the string at <[b]>.
RETURNS
If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>,
<<strncmp>> returns a number greater than zero. If the two
strings are equivalent, <<strncmp>> returns zero. If <<*<[a]>>>
sorts lexicographically before <<*<[b]>>>, <<strncmp>> returns a
number less than zero.
PORTABILITY
<<strncmp>> is ANSI C.
<<strncmp>> requires no supporting OS subroutines.
QUICKREF
strncmp ansi pure
*/
#include <string.h>
#include <limits.h>
/* Nonzero if either X or Y is not aligned on a "long" boundary. */
#define UNALIGNED(X, Y) \
(((long)X & (sizeof (long) - 1)) | ((long)Y & (sizeof (long) - 1)))
/* DETECTNULL returns nonzero if (long)X contains a NULL byte. */
#if LONG_MAX == 2147483647L
#define DETECTNULL(X) (((X) - 0x01010101) & ~(X) & 0x80808080)
#else
#if LONG_MAX == 9223372036854775807L
#define DETECTNULL(X) (((X) - 0x0101010101010101) & ~(X) & 0x8080808080808080)
#else
#error long int is not a 32bit or 64bit type.
#endif
#endif
#ifndef DETECTNULL
#error long int is not a 32bit or 64bit byte
#endif
int
_DEFUN (strncmp, (s1, s2, n),
_CONST char *s1 _AND
_CONST char *s2 _AND
size_t n)
{
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
if (n == 0)
return 0;
while (n-- != 0 && *s1 == *s2)
{
if (n == 0 || *s1 == '\0')
break;
s1++;
s2++;
}
return (*(unsigned char *) s1) - (*(unsigned char *) s2);
#else
unsigned long *a1;
unsigned long *a2;
if (n == 0)
return 0;
/* If s1 or s2 are unaligned, then compare bytes. */
if (!UNALIGNED (s1, s2))
{
/* If s1 and s2 are word-aligned, compare them a word at a time. */
a1 = (unsigned long*)s1;
a2 = (unsigned long*)s2;
while (n >= sizeof (long) && *a1 == *a2)
{
n -= sizeof (long);
/* If we've run out of bytes or hit a null, return zero
since we already know *a1 == *a2. */
if (n == 0 || DETECTNULL (*a1))
return 0;
a1++;
a2++;
}
/* A difference was detected in last few bytes of s1, so search bytewise */
s1 = (char*)a1;
s2 = (char*)a2;
}
while (n-- > 0 && *s1 == *s2)
{
/* If we've run out of bytes or hit a null, return zero
since we already know *s1 == *s2. */
if (n == 0 || *s1 == '\0')
return 0;
s1++;
s2++;
}
return (*(unsigned char *) s1) - (*(unsigned char *) s2);
#endif /* not PREFER_SIZE_OVER_SPEED */
}
|
/* { dg-do compile } */
/* { dg-options "-mfxsr -O2" } */
/* { dg-final { scan-assembler "fxrstor\[ \\t\]" } } */
#include <x86intrin.h>
void extern
fxsave_test (void)
{
char fxsave_region [512] __attribute__((aligned(16)));
_fxrstor (fxsave_region);
}
|
/*
* Copyright (c) 1999-2000 Image Power, Inc. and the University of
* British Columbia.
* Copyright (c) 2001-2002 Michael David Adams.
* All rights reserved.
*/
/* __START_OF_JASPER_LICENSE__
*
* JasPer License Version 2.0
*
* Copyright (c) 2001-2006 Michael David Adams
* Copyright (c) 1999-2000 Image Power, Inc.
* Copyright (c) 1999-2000 The University of British Columbia
*
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person (the
* "User") 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, 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:
*
* 1. The above copyright notices and this permission notice (which
* includes the disclaimer below) shall be included in all copies or
* substantial portions of the Software.
*
* 2. The name of a copyright holder shall not be used to endorse or
* promote products derived from the Software without specific prior
* written permission.
*
* THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
* LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
* THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* "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 HOLDERS 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. NO ASSURANCES ARE
* PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
* THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
* EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
* BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
* PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
* GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
* ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
* IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
* SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
* AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
* SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
* THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
* PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
* RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
* EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
*
* __END_OF_JASPER_LICENSE__
*/
/*
* Portable Pixmap/Graymap Format Support
*
* $Id$
*/
/******************************************************************************\
* Includes.
\******************************************************************************/
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include "jasper/jas_math.h"
#include "pnm_cod.h"
/******************************************************************************\
* Miscellaneous utilities.
\******************************************************************************/
/* Determine the PNM type (i.e., PGM or PPM) from the magic number. */
int pnm_type(uint_fast16_t magic)
{
int type;
switch (magic) {
case PNM_MAGIC_TXTPPM:
case PNM_MAGIC_BINPPM:
type = PNM_TYPE_PPM;
break;
case PNM_MAGIC_TXTPGM:
case PNM_MAGIC_BINPGM:
type = PNM_TYPE_PGM;
break;
case PNM_MAGIC_TXTPBM:
case PNM_MAGIC_BINPBM:
type = PNM_TYPE_PBM;
break;
default:
/* This should not happen. */
abort();
break;
}
return type;
}
/* Determine the PNM format (i.e., text or binary) from the magic number. */
int pnm_fmt(uint_fast16_t magic)
{
int fmt;
switch (magic) {
case PNM_MAGIC_TXTPBM:
case PNM_MAGIC_TXTPGM:
case PNM_MAGIC_TXTPPM:
fmt = PNM_FMT_TXT;
break;
case PNM_MAGIC_BINPBM:
case PNM_MAGIC_BINPGM:
case PNM_MAGIC_BINPPM:
fmt = PNM_FMT_BIN;
break;
default:
/* This should not happen. */
abort();
break;
}
return fmt;
}
/* Determine the depth (i.e., precision) from the maximum value. */
int pnm_maxvaltodepth(uint_fast32_t maxval)
{
int n;
n = 0;
while (maxval > 0) {
maxval >>= 1;
++n;
}
return n;
}
|
#include <linux/types.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include "soft-fp.h"
int
mffs(u32 *frD)
{
frD[1] = __FPU_FPSCR;
#ifdef DEBUG
printk("%s: frD %p: %08x.%08x\n", __FUNCTION__, frD, frD[0], frD[1]);
#endif
return 0;
}
|
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following condition is met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* ----------------------------------------------------------------------------
*/
#ifndef _SAM3U_TWI0_INSTANCE_
#define _SAM3U_TWI0_INSTANCE_
/* ========== Register definition for TWI0 peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_TWI0_CR (0x40084000U) /**< \brief (TWI0) Control Register */
#define REG_TWI0_MMR (0x40084004U) /**< \brief (TWI0) Master Mode Register */
#define REG_TWI0_SMR (0x40084008U) /**< \brief (TWI0) Slave Mode Register */
#define REG_TWI0_IADR (0x4008400CU) /**< \brief (TWI0) Internal Address Register */
#define REG_TWI0_CWGR (0x40084010U) /**< \brief (TWI0) Clock Waveform Generator Register */
#define REG_TWI0_SR (0x40084020U) /**< \brief (TWI0) Status Register */
#define REG_TWI0_IER (0x40084024U) /**< \brief (TWI0) Interrupt Enable Register */
#define REG_TWI0_IDR (0x40084028U) /**< \brief (TWI0) Interrupt Disable Register */
#define REG_TWI0_IMR (0x4008402CU) /**< \brief (TWI0) Interrupt Mask Register */
#define REG_TWI0_RHR (0x40084030U) /**< \brief (TWI0) Receive Holding Register */
#define REG_TWI0_THR (0x40084034U) /**< \brief (TWI0) Transmit Holding Register */
#define REG_TWI0_RPR (0x40084100U) /**< \brief (TWI0) Receive Pointer Register */
#define REG_TWI0_RCR (0x40084104U) /**< \brief (TWI0) Receive Counter Register */
#define REG_TWI0_TPR (0x40084108U) /**< \brief (TWI0) Transmit Pointer Register */
#define REG_TWI0_TCR (0x4008410CU) /**< \brief (TWI0) Transmit Counter Register */
#define REG_TWI0_RNPR (0x40084110U) /**< \brief (TWI0) Receive Next Pointer Register */
#define REG_TWI0_RNCR (0x40084114U) /**< \brief (TWI0) Receive Next Counter Register */
#define REG_TWI0_TNPR (0x40084118U) /**< \brief (TWI0) Transmit Next Pointer Register */
#define REG_TWI0_TNCR (0x4008411CU) /**< \brief (TWI0) Transmit Next Counter Register */
#define REG_TWI0_PTCR (0x40084120U) /**< \brief (TWI0) Transfer Control Register */
#define REG_TWI0_PTSR (0x40084124U) /**< \brief (TWI0) Transfer Status Register */
#else
#define REG_TWI0_CR (*(WoReg*)0x40084000U) /**< \brief (TWI0) Control Register */
#define REG_TWI0_MMR (*(RwReg*)0x40084004U) /**< \brief (TWI0) Master Mode Register */
#define REG_TWI0_SMR (*(RwReg*)0x40084008U) /**< \brief (TWI0) Slave Mode Register */
#define REG_TWI0_IADR (*(RwReg*)0x4008400CU) /**< \brief (TWI0) Internal Address Register */
#define REG_TWI0_CWGR (*(RwReg*)0x40084010U) /**< \brief (TWI0) Clock Waveform Generator Register */
#define REG_TWI0_SR (*(RoReg*)0x40084020U) /**< \brief (TWI0) Status Register */
#define REG_TWI0_IER (*(WoReg*)0x40084024U) /**< \brief (TWI0) Interrupt Enable Register */
#define REG_TWI0_IDR (*(WoReg*)0x40084028U) /**< \brief (TWI0) Interrupt Disable Register */
#define REG_TWI0_IMR (*(RoReg*)0x4008402CU) /**< \brief (TWI0) Interrupt Mask Register */
#define REG_TWI0_RHR (*(RoReg*)0x40084030U) /**< \brief (TWI0) Receive Holding Register */
#define REG_TWI0_THR (*(WoReg*)0x40084034U) /**< \brief (TWI0) Transmit Holding Register */
#define REG_TWI0_RPR (*(RwReg*)0x40084100U) /**< \brief (TWI0) Receive Pointer Register */
#define REG_TWI0_RCR (*(RwReg*)0x40084104U) /**< \brief (TWI0) Receive Counter Register */
#define REG_TWI0_TPR (*(RwReg*)0x40084108U) /**< \brief (TWI0) Transmit Pointer Register */
#define REG_TWI0_TCR (*(RwReg*)0x4008410CU) /**< \brief (TWI0) Transmit Counter Register */
#define REG_TWI0_RNPR (*(RwReg*)0x40084110U) /**< \brief (TWI0) Receive Next Pointer Register */
#define REG_TWI0_RNCR (*(RwReg*)0x40084114U) /**< \brief (TWI0) Receive Next Counter Register */
#define REG_TWI0_TNPR (*(RwReg*)0x40084118U) /**< \brief (TWI0) Transmit Next Pointer Register */
#define REG_TWI0_TNCR (*(RwReg*)0x4008411CU) /**< \brief (TWI0) Transmit Next Counter Register */
#define REG_TWI0_PTCR (*(WoReg*)0x40084120U) /**< \brief (TWI0) Transfer Control Register */
#define REG_TWI0_PTSR (*(RoReg*)0x40084124U) /**< \brief (TWI0) Transfer Status Register */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* _SAM3U_TWI0_INSTANCE_ */
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __java_util_FormatFlagsConversionMismatchException__
#define __java_util_FormatFlagsConversionMismatchException__
#pragma interface
#include <java/util/IllegalFormatException.h>
class java::util::FormatFlagsConversionMismatchException : public ::java::util::IllegalFormatException
{
public:
FormatFlagsConversionMismatchException(::java::lang::String *, jchar);
virtual jchar getConversion();
virtual ::java::lang::String * getFlags();
private:
static const jlong serialVersionUID = 19120414LL;
::java::lang::String * __attribute__((aligned(__alignof__( ::java::util::IllegalFormatException)))) f;
jchar c;
public:
static ::java::lang::Class class$;
};
#endif // __java_util_FormatFlagsConversionMismatchException__
|
// SPDX-License-Identifier: GPL-2.0
/*
* Purgatory code running between two kernels.
*
* Copyright IBM Corp. 2018
*
* Author(s): Philipp Rudo <prudo@linux.vnet.ibm.com>
*/
#include <linux/kexec.h>
#include <linux/string.h>
#include <crypto/sha.h>
#include <asm/purgatory.h>
int verify_sha256_digest(void)
{
struct kexec_sha_region *ptr, *end;
u8 digest[SHA256_DIGEST_SIZE];
struct sha256_state sctx;
sha256_init(&sctx);
end = purgatory_sha_regions + ARRAY_SIZE(purgatory_sha_regions);
for (ptr = purgatory_sha_regions; ptr < end; ptr++)
sha256_update(&sctx, (uint8_t *)(ptr->start), ptr->len);
sha256_final(&sctx, digest);
if (memcmp(digest, purgatory_sha256_digest, sizeof(digest)))
return 1;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.