text stringlengths 4 6.14k |
|---|
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// 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.
//-----------------------------------------------------------------------------
static const Point3F BoxNormals[] =
{
Point3F( 1, 0, 0),
Point3F(-1, 0, 0),
Point3F( 0, 1, 0),
Point3F( 0,-1, 0),
Point3F( 0, 0, 1),
Point3F( 0, 0,-1)
};
static U32 BoxVerts[][4] = {
{7,6,4,5}, // +x
{0,2,3,1}, // -x
{7,3,2,6}, // +y
{0,1,5,4}, // -y
{7,5,1,3}, // +z
{0,4,6,2} // -z
};
static U32 BoxSharedEdgeMask[][6] = {
{0, 0, 1, 4, 8, 2},
{0, 0, 2, 8, 4, 1},
{8, 2, 0, 0, 1, 4},
{4, 1, 0, 0, 2, 8},
{1, 4, 8, 2, 0, 0},
{2, 8, 4, 1, 0, 0}
};
static Point3F BoxPnts[] = {
Point3F(0,0,0),
Point3F(0,0,1),
Point3F(0,1,0),
Point3F(0,1,1),
Point3F(1,0,0),
Point3F(1,0,1),
Point3F(1,1,0),
Point3F(1,1,1)
};
extern SceneLighting *gLighting;
extern F32 gParellelVectorThresh;
extern F32 gPlaneNormThresh;
extern F32 gPlaneDistThresh;
|
/* File - trieFA.h
*
* This file contains code to be included in the scanner file using a
* generated trie-based FA.
*/
typedef struct { /* An entry in the FA state table */
short def; /* If this state is an accepting state then*/
/* this is the definition, otherwise -1. */
short trans_base; /* The base index into the transition table.*/
long mask; /* The transition mask. */
}TrieState ;
typedef struct { /* An entry in the FA transition table. */
short c; /* The transition character (lowercase).*/
short next_state; /* The next state. */
}TrieTrans ;
#ifdef UNDERLINE
static long CharMask[28] = {
0x0000001, 0x0000000, 0x0000004, 0x0000008,
0x0000010, 0x0000020, 0x0000040, 0x0000080,
0x0000100, 0x0000200, 0x0000400, 0x0000800,
0x0001000, 0x0002000, 0x0004000, 0x0008000,
0x0010000, 0x0020000, 0x0040000, 0x0080000,
0x0100000, 0x0200000, 0x0400000, 0x0800000,
0x1000000, 0x2000000, 0x4000000, 0x8000000,
};
#define IN_MASK_RANGE(C) (islower(C) || ((C) == '_'))
#define MASK_INDEX(C) ((C) - '_')
#else
static long CharMask[26] = {
0x0000001, 0x0000002, 0x0000004, 0x0000008,
0x0000010, 0x0000020, 0x0000040, 0x0000080,
0x0000100, 0x0000200, 0x0000400, 0x0000800,
0x0001000, 0x0002000, 0x0004000, 0x0008000,
0x0010000, 0x0020000, 0x0040000, 0x0080000,
0x0100000, 0x0200000, 0x0400000, 0x0800000,
0x1000000, 0x2000000
};
#define IN_MASK_RANGE(C) islower(C)
#define MASK_INDEX(C) ((C) - 'a')
#endif
static short TFA_State;
/* TFA_Init:
*
* Initialize the trie FA.
*/
#define TFA_Init() TFA_State = 0
/* TFA_Advance:
*
* Advance to the next state (or -1) on the lowercase letter c.
*/
#define TFA_Advance(C) { \
char c = C; \
if (TFA_State >= 0) { \
if (isupper(c)) \
c = tolower(c); \
else if (! IN_MASK_RANGE(c)) { \
TFA_State = -1; \
goto TFA_done; \
} \
if (TrieStateTbl[TFA_State].mask & CharMask[MASK_INDEX(c)]) { \
short i = TrieStateTbl[TFA_State].trans_base; \
while (TrieTransTbl[i].c != c) \
i++; \
TFA_State = TrieTransTbl[i].next_state; \
} \
else \
TFA_State = -1; \
} \
TFA_done:; \
} /* end of TFA_Advance. */
/* TFA_Definition:
*
* Return the definition (if any) associated with the current state.
*/
#define TFA_Definition() \
((TFA_State < 0) ? -1 : TrieStateTbl[TFA_State].def)
|
// SPDX-License-Identifier: GPL-2.0+
/*
* net/dsa/tag_trailer.c - Trailer tag format handling
* Copyright (c) 2008-2009 Marvell Semiconductor
*/
#include <linux/etherdevice.h>
#include <linux/list.h>
#include <linux/slab.h>
#include "dsa_priv.h"
static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct dsa_port *dp = dsa_slave_to_port(dev);
struct sk_buff *nskb;
int padlen;
u8 *trailer;
/*
* We have to make sure that the trailer ends up as the very
* last 4 bytes of the packet. This means that we have to pad
* the packet to the minimum ethernet frame size, if necessary,
* before adding the trailer.
*/
padlen = 0;
if (skb->len < 60)
padlen = 60 - skb->len;
nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 4, GFP_ATOMIC);
if (!nskb)
return NULL;
skb_reserve(nskb, NET_IP_ALIGN);
skb_reset_mac_header(nskb);
skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
consume_skb(skb);
if (padlen) {
skb_put_zero(nskb, padlen);
}
trailer = skb_put(nskb, 4);
trailer[0] = 0x80;
trailer[1] = 1 << dp->index;
trailer[2] = 0x10;
trailer[3] = 0x00;
return nskb;
}
static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt)
{
u8 *trailer;
int source_port;
if (skb_linearize(skb))
return NULL;
trailer = skb_tail_pointer(skb) - 4;
if (trailer[0] != 0x80 || (trailer[1] & 0xf8) != 0x00 ||
(trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
return NULL;
source_port = trailer[1] & 7;
skb->dev = dsa_master_find_slave(dev, 0, source_port);
if (!skb->dev)
return NULL;
if (pskb_trim_rcsum(skb, skb->len - 4))
return NULL;
return skb;
}
static const struct dsa_device_ops trailer_netdev_ops = {
.name = "trailer",
.proto = DSA_TAG_PROTO_TRAILER,
.xmit = trailer_xmit,
.rcv = trailer_rcv,
.overhead = 4,
.tail_tag = true,
};
MODULE_LICENSE("GPL");
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_TRAILER);
module_dsa_tag_driver(trailer_netdev_ops);
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <time.h>
struct theme{
int size;
char **line;
};
static struct theme notRunTheme;
static struct theme titleTheme;
static struct theme mp3Theme;
static struct theme oggTheme;
void themeInit(){
//if (DEBUG==1) putlog("init theme");
/*mp3Theme.size=0;oggTheme.size=0;cueTheme.size=0;streamTheme.size=0;etcTheme.size=0;
stopTheme.size=0;pauseTheme.size=0;*/
notRunTheme.size=0;titleTheme.size=0;
srand((unsigned int)time((time_t *)NULL));
//if (DEBUG==1) putlog("theme init done");
}
void printTheme(struct theme data){
int i;
for (i=0;i<data.size;i++) hexchat_printf(ph,"line[%i]=%s\n",i,data.line[i]);
}
void printThemes(){
hexchat_printf(ph,"\nNotRun-Theme:\n");printTheme(notRunTheme);
hexchat_printf(ph,"\nMP3-Theme:\n");printTheme(mp3Theme);
hexchat_printf(ph,"\nOGG-Theme:\n");printTheme(oggTheme);
hexchat_printf(ph,"\nTitle-Theme:\n");printTheme(titleTheme);
}
void cbFix(char *line)
{
size_t i;
for (i = 0; i < strlen(line); i++)
{
size_t j;
if (line[i] == '%')
{
if ((line[i + 1] == 'C') || (line[i + 1] == 'B') || (line[i + 1] == 'U') || (line[i + 1] == 'O') || (line[i + 1] == 'R'))
{
if (line[i + 1] == 'C') line[i] = 3;
if (line[i + 1] == 'B') line[i] = 2;
if (line[i + 1] == 'U') line[i] = 37;
if (line[i + 1] == 'O') line[i] = 17;
if (line[i + 1] == 'R') line[i] = 26;
for (j = i + 1; j < strlen(line) - 1; j++)
{
line[j] = line[j + 1];
}
line[strlen(line) - 1] = 0;
}
}
}
}
struct theme themeAdd(struct theme data, char *info){
//if (DEBUG==1) putlog("adding theme");
struct theme ret;
char **newLine=(char **)calloc(data.size+1,sizeof(char*));
int i;
for (i=0;i<data.size;i++) newLine[i]=data.line[i];
cbFix(info);
newLine[data.size]=info;
ret.line=newLine;ret.size=data.size+1;
//if (DEBUG==1) putlog("theme added");
return ret;
}
void loadThemes(){
char *hDir, *hFile, *line, *val;
FILE *f;
hexchat_print(ph,"loading themes\n");
hDir=(char*)calloc(1024,sizeof(char));
strcpy(hDir,hexchat_get_info(ph,"configdir"));
hFile=str3cat(hDir,"\\","mpcInfo.theme.txt");
f = fopen(hFile,"r");
if(f==NULL)
{
hexchat_print(ph,"no theme in homedir, checking global theme");
f=fopen("mpcInfo.theme.txt","r");
}
//hexchat_printf(ph,"file_desc: %p\n",f);
if (f==NULL) hexchat_print(ph, "no theme found, using hardcoded\n");
else {
if (f > 0)
{
line=" ";
} else
{
line="\0";
}
while (line[0]!=0)
{
line=readLine(f);
val=split(line,'=');
printf("line: %s\n",line);
printf("val: %s\n",val);
if (strcmp(toUpper(line),"OFF_LINE")==0) notRunTheme=themeAdd(notRunTheme,val);
if (strcmp(toUpper(line),"TITLE_LINE")==0) titleTheme=themeAdd(titleTheme,val);
if (strcmp(toUpper(line),"MP3_LINE")==0) mp3Theme=themeAdd(mp3Theme,val);
if (strcmp(toUpper(line),"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val);
}
fclose(f);
hexchat_print(ph, "theme loaded successfull\n");
}
if (notRunTheme.size==0) notRunTheme=themeAdd(notRunTheme,"Media Player Classic not running");
if (titleTheme.size==0) titleTheme=themeAdd(titleTheme,"say Playing %title in Media Player Classic");
if (mp3Theme.size==0) mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%mode] in Media Player Classic ");
if (oggTheme.size==0) oggTheme=themeAdd(oggTheme,"me listens to %art with %tit from %alb [%gen|%br kbps|%frq kHz|%chan channels] in Media Player Classic ");
//mp3Theme=themeAdd(mp3Theme,"me listens to %art with %tit from %alb [%time|%length|%perc%|%br kbps|%frq kHz|%mode] in Media Player Classic ");
}
int rnd(int max){
return rand()%max;
}
char *randomLine(struct theme data){
return data.line[rnd(data.size)];
}
|
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2006, 2007 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SPRING_MOBILITY_HELPER_H
#define SPRING_MOBILITY_HELPER_H
#include "ns3/topology-reader.h"
namespace ns3 {
/**
* \ingroup mobility
*
* \brief
*/
class SpringMobilityHelper
{
public:
static void
InstallSprings (Ptr<Node> node1, Ptr<Node> node2);
static void
InstallSprings (TopologyReader::ConstLinksIterator first,
TopologyReader::ConstLinksIterator end);
};
} // namespace ns3
#endif // SPRING_MOBILITY_HELPER_H
|
/***
This file is part of systemd.
Copyright 2010 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 <errno.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdlib.h>
#include "util.h"
#include "virt.h"
static bool arg_quiet = false;
static enum {
ANY_VIRTUALIZATION,
ONLY_VM,
ONLY_CONTAINER,
ONLY_CHROOT,
} arg_mode = ANY_VIRTUALIZATION;
static void help(void) {
printf("%s [OPTIONS...]\n\n"
"Detect execution in a virtualized environment.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -c --container Only detect whether we are run in a container\n"
" -v --vm Only detect whether we are run in a VM\n"
" -r --chroot Detect whether we are run in a chroot() environment\n"
" -q --quiet Don't output anything, just set return value\n"
, program_invocation_short_name);
}
static int parse_argv(int argc, char *argv[]) {
enum {
ARG_VERSION = 0x100
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "container", no_argument, NULL, 'c' },
{ "vm", no_argument, NULL, 'v' },
{ "chroot", no_argument, NULL, 'r' },
{ "quiet", no_argument, NULL, 'q' },
{}
};
int c;
assert(argc >= 0);
assert(argv);
while ((c = getopt_long(argc, argv, "hqcvr", options, NULL)) >= 0)
switch (c) {
case 'h':
help();
return 0;
case ARG_VERSION:
return version();
case 'q':
arg_quiet = true;
break;
case 'c':
arg_mode = ONLY_CONTAINER;
break;
case 'v':
arg_mode = ONLY_VM;
break;
case 'r':
arg_mode = ONLY_CHROOT;
break;
case '?':
return -EINVAL;
default:
assert_not_reached("Unhandled option");
}
if (optind < argc) {
log_error("%s takes no arguments.", program_invocation_short_name);
return -EINVAL;
}
return 1;
}
int main(int argc, char *argv[]) {
int r;
/* This is mostly intended to be used for scripts which want
* to detect whether we are being run in a virtualized
* environment or not */
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
switch (arg_mode) {
case ONLY_VM:
r = detect_vm();
if (r < 0) {
log_error_errno(r, "Failed to check for VM: %m");
return EXIT_FAILURE;
}
break;
case ONLY_CONTAINER:
r = detect_container();
if (r < 0) {
log_error_errno(r, "Failed to check for container: %m");
return EXIT_FAILURE;
}
break;
case ONLY_CHROOT:
r = running_in_chroot();
if (r < 0) {
log_error_errno(r, "Failed to check for chroot() environment: %m");
return EXIT_FAILURE;
}
return r ? EXIT_SUCCESS : EXIT_FAILURE;
case ANY_VIRTUALIZATION:
default:
r = detect_virtualization();
if (r < 0) {
log_error_errno(r, "Failed to check for virtualization: %m");
return EXIT_FAILURE;
}
break;
}
if (!arg_quiet)
puts(virtualization_to_string(r));
return r != VIRTUALIZATION_NONE ? EXIT_SUCCESS : EXIT_FAILURE;
}
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "main-func.h"
#include "strv.h"
/*
* This binary is intended to be run as an ExecCondition= in units generated
* by the xdg-autostart-generator. It does the appropriate checks against
* XDG_CURRENT_DESKTOP that are too advanced for simple ConditionEnvironment=
* matches.
*/
static int run(int argc, char *argv[]) {
_cleanup_strv_free_ char **only_show_in = NULL, **not_show_in = NULL, **desktops = NULL;
const char *xdg_current_desktop;
char **d;
if (argc != 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Wrong argument count. Expected the OnlyShowIn= and NotShowIn= sets, each colon separated.");
xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP");
if (xdg_current_desktop) {
desktops = strv_split(xdg_current_desktop, ":");
if (!desktops)
return log_oom();
}
only_show_in = strv_split(argv[1], ":");
not_show_in = strv_split(argv[2], ":");
if (!only_show_in || !not_show_in)
return log_oom();
/* Each desktop in XDG_CURRENT_DESKTOP needs to be matched in order. */
STRV_FOREACH(d, desktops) {
if (strv_contains(only_show_in, *d))
return 0;
if (strv_contains(not_show_in, *d))
return 1;
}
/* non-zero exit code when only_show_in has a proper value */
return !strv_isempty(only_show_in);
}
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-bus.h"
#include "user-record.h"
int user_record_quality_check_password(UserRecord *hr, UserRecord *secret, sd_bus_error *error);
|
/*****************************************************************************
Copyright (c) 2011, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native high-level C interface to LAPACK function ssbgv
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_ssbgv( int matrix_order, char jobz, char uplo, lapack_int n,
lapack_int ka, lapack_int kb, float* ab,
lapack_int ldab, float* bb, lapack_int ldbb, float* w,
float* z, lapack_int ldz )
{
lapack_int info = 0;
float* work = NULL;
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_ssbgv", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_ssb_nancheck( matrix_order, uplo, n, ka, ab, ldab ) ) {
return -7;
}
if( LAPACKE_ssb_nancheck( matrix_order, uplo, n, kb, bb, ldbb ) ) {
return -9;
}
#endif
/* Allocate memory for working array(s) */
work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,3*n) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
/* Call middle-level interface */
info = LAPACKE_ssbgv_work( matrix_order, jobz, uplo, n, ka, kb, ab, ldab,
bb, ldbb, w, z, ldz, work );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ssbgv", info );
}
return info;
}
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef COMMON_H
#define COMMON_H
typedef signed char TT_int8_t;
typedef unsigned char TT_uint8_t;
typedef signed short TT_int16_t;
typedef unsigned short TT_uint16_t;
typedef FX_INT32 TT_int32_t;
typedef FX_DWORD TT_uint32_t;
typedef FX_INT64 TT_int64_t;
typedef FX_UINT64 TT_uint64_t;
#endif
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* Test Name: getsockname01
*
* Test Description:
* Verify that getsockname() returns the proper errno for various failure cases
*
* Usage: <for command-line>
* getsockname01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -e : Turn on errno logging.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS:
* None.
*/
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/signal.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include "test.h"
char *TCID = "getsockname01";
int testno;
int s; /* socket descriptor */
struct sockaddr_in sin0, fsin1;
socklen_t sinlen;
void setup(void), setup0(void), setup1(void),
cleanup(void), cleanup0(void), cleanup1(void);
struct test_case_t { /* test case structure */
int domain; /* PF_INET, PF_UNIX, ... */
int type; /* SOCK_STREAM, SOCK_DGRAM ... */
int proto; /* protocol number (usually 0 = default) */
struct sockaddr *sockaddr; /* socket address buffer */
socklen_t *salen; /* getsockname's 3rd argument */
int retval; /* syscall return value */
int experrno; /* expected errno */
void (*setup) (void);
void (*cleanup) (void);
char *desc;
} tdat[] = {
{
PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
&sinlen, -1, EBADF, setup0, cleanup0,
"bad file descriptor"}, {
PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
&sinlen, -1, ENOTSOCK, setup0, cleanup0,
"bad file descriptor"},
#ifndef UCLINUX
/* Skip since uClinux does not implement memory protection */
{
PF_INET, SOCK_STREAM, 0, NULL,
&sinlen, -1, EFAULT, setup1, cleanup1,
"invalid socket buffer"}, {
/* invalid salen test for aligned input */
PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
NULL, -1, EFAULT, setup1, cleanup1,
"invalid aligned salen"}, {
/* invalid salen test for unaligned input */
PF_INET, SOCK_STREAM, 0, (struct sockaddr *)&fsin1,
(socklen_t *) 1, -1, EFAULT, setup1, cleanup1,
"invalid unaligned salen"},
#endif
};
int TST_TOTAL = sizeof(tdat) / sizeof(tdat[0]);
int main(int argc, char *argv[])
{
int lc;
tst_parse_opts(argc, argv, NULL, NULL);
setup();
for (lc = 0; TEST_LOOPING(lc); ++lc) {
tst_count = 0;
for (testno = 0; testno < TST_TOTAL; ++testno) {
tdat[testno].setup();
TEST(getsockname(s, tdat[testno].sockaddr,
tdat[testno].salen));
if (TEST_RETURN != tdat[testno].retval ||
(TEST_RETURN < 0 &&
TEST_ERRNO != tdat[testno].experrno)) {
tst_resm(TFAIL, "%s ; returned"
" %ld (expected %d), errno %d (expected"
" %d)", tdat[testno].desc,
TEST_RETURN, tdat[testno].retval,
TEST_ERRNO, tdat[testno].experrno);
} else {
tst_resm(TPASS, "%s successful",
tdat[testno].desc);
}
tdat[testno].cleanup();
}
}
cleanup();
tst_exit();
}
void setup(void)
{
TEST_PAUSE;
/* initialize local sockaddr */
sin0.sin_family = AF_INET;
sin0.sin_port = 0;
sin0.sin_addr.s_addr = INADDR_ANY;
}
void cleanup(void)
{
}
void setup0(void)
{
if (tdat[testno].experrno == EBADF)
s = 400; /* anything not an open file */
else if ((s = open("/dev/null", O_WRONLY)) == -1)
tst_brkm(TBROK, cleanup, "error opening /dev/null - "
"errno: %s", strerror(errno));
}
void cleanup0(void)
{
s = -1;
}
void setup1(void)
{
s = socket(tdat[testno].domain, tdat[testno].type, tdat[testno].proto);
if (s < 0) {
tst_brkm(TBROK, cleanup, "socket setup failed for getsockname "
"test %d: %s", testno, strerror(errno));
}
if (bind(s, (struct sockaddr *)&sin0, sizeof(sin0)) < 0) {
tst_brkm(TBROK, cleanup, "socket bind failed for getsockname "
"test %d: %s", testno, strerror(errno));
}
sinlen = sizeof(fsin1);
}
void cleanup1(void)
{
(void)close(s);
s = -1;
}
|
/* touch_sic_abt_spi.h
*
* Copyright (C) 2015 LGE.
*
*
* 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 TOUCH_SIC_ABT_H
#define TOUCH_SIC_ABT_H
#if USE_ABT_MONITOR_APP
#include <linux/socket.h>
#include <linux/in.h>
/* for abt monitor app. header */
#define CMD_ABT_LOC_X_START_READ (0x8BE4)
#define CMD_ABT_LOC_X_END_READ (0x8BE5)
#define CMD_ABT_LOC_Y_START_READ (0x8BE6)
#define CMD_ABT_LOC_Y_END_READ (0x8BE7)
/* debug data report mode setting */
#define CMD_RAW_DATA_REPORT_MODE_WRITE (0xC226)
#define CMD_RAW_DATA_COMPRESS_WRITE (0xC227)
#define CMD_RAW_DATA_REPORT_MODE_READ (0x8BE8)
#define REPORT_RNORG 1
#define REPORT_RAW 2
#define REPORT_BASELINE 3
#define REPORT_SEG1 4
#define REPORT_SEG2 5
#define REPORT_GLASS 6
#define REPORT_DEBUG_ONLY 7
#define REPORT_OFF 20
#define ACTIVE_SCREEN_CNT_X 18
#define ACTIVE_SCREEN_CNT_Y 34
#define HEAD_LOAD 10
#define DEF_RNDCPY_EVERY_Nth_FRAME (4)
#define DEFAULT_PORT 8095
#define SEND_PORT 8090
#define OMK_BUF 1000
#define MODULE_NAME "ABT_SOCKET"
/* must 4 multiple */
#define I2C_PACKET_SIZE 128
enum E_DATA_TYPE {
DATA_TYPE_RAW = 0,
DATA_TYPE_BASELINE,
DATA_TYPE_RN_ORG = 10,
DATA_TYPE_SEG1 = 20,
DATA_TYPE_SEG2,
DATA_TYPE_MAX
};
enum DEBUG_TYPE {
DEBUG_DATA = 0,
DEBUG_MODE = 1,
DEBUG_DATA_RW_MODE = 2,
DEBUG_DATA_CAPTURE_MODE = 3,
DEBUG_DATA_CMD_MODE = 4
};
enum RW_TYPE {
READ_TYPE = 55,
WRITE_TYPE = 66
};
enum DEBUG_REPORT_CMD {
DEBUG_REPORT_POINT = 0x100,
DEBUG_REPORT_OCD,
};
enum ABT_CONNECT_TOOL {
NOTHING = 0,
ABT_STUDIO = 1,
ABT_PCTOOL = 2
};
/* UDP */
#pragma pack(push, 1)
struct send_data_t {
u8 type;
u8 mode;
u8 flag;
u8 touchCnt;
u32 timestamp;
u32 frame_num;
u8 data[3000];
};
#pragma pack(pop)
#pragma pack(push, 1)
struct debug_report_header {
u8 key_frame;
u8 type;
u16 data_size;
};
#pragma pack(pop)
/* TCP */
struct s_comm_packet {
u8 cmd;
u8 report_type;
union {
u8 rw;
u8 data_type;
} flag;
u8 status;
u16 addr;
u16 data_size;
u32 frame_num;
u8 data[4];
u32 crc;
};
struct sock_comm_t {
struct spi_device *client;
struct task_struct *thread;
struct socket *sock;
struct sockaddr_in addr;
/*TCP*/
struct sockaddr_in client_addr;
struct socket *client_sock;
/*TCP*/
uint32_t (*sock_listener)(uint8_t *buf, uint32_t len);
struct socket *sock_send;
struct sockaddr_in addr_send;
struct send_data_t data_send;
struct s_comm_packet *recv_packet;
struct s_comm_packet send_packet;
int send_connected;
char send_ip[20];
u8 running;
};
struct T_ABTLog_FileHead {
/* 4 byte => 4B */
/* 2B : x축 해상도 */
unsigned short resolution_x;
/* 2B : y축 해상도 */
unsigned short resolution_y;
/* 4 byte => 8B */
/* 1B : real node 개수 (x축) */
unsigned char node_cnt_x;
/* 1B : real node 개수 (y축) */
unsigned char node_cnt_y;
/* 1B : additional node 개수 (touch button 등등으로 인해..) */
unsigned char additional_node_cnt;
unsigned char dummy1;
/* 4 byte => 12B */
/* 2B : RN MIN value */
unsigned short rn_min;
/* 2B : RN MAX value */
unsigned short rn_max;
/* 4 byte => 16B */
/* 1B : RAW Size (1B or 2B) */
unsigned char raw_data_size;
/* 1B : RN Size (1B or 2B) */
unsigned char rn_data_size;
/* 1B : frame buf 에 쌓인 data 의 type -> E_DATA_TYPE number */
unsigned char frame_data_type;
/* 1B : frame buf 에 쌓인 data 의 unit size (1B or 2B) */
unsigned char frame_data_size;
/* 4 byte => 20B */
/* 4B : x_node start/end 의 location(screen resolution) */
unsigned short loc_x[2];
/* 4 byte => 24B */
/* 4B : y_node start/end 의 location(screen resolution) */
unsigned short loc_y[2];
/* 104 byte => 128B */
/* total 128B 중 나머지.. */
unsigned char dummy[104];
} __packed;
extern struct sock_comm_t abt_comm;
extern struct mutex abt_socket_lock;
extern struct mutex abt_i2c_comm_lock;
extern int abt_socket_mutex_flag;
extern u8 abt_report_point;
extern u8 abt_report_ocd;
extern u32 CMD_GET_ABT_DEBUG_REPORT;
extern u16 abt_ocd[2][ACTIVE_SCREEN_CNT_X*ACTIVE_SCREEN_CNT_Y];
extern u8 abt_ocd_read;
extern u8 abt_reportP[256];
extern char abt_head[128];
extern u32 abt_compress_flag;
extern int abt_show_mode;
extern int abt_ocd_on;
extern int abt_report_mode;
extern int32_t abt_ksocket_raw_data_send(uint8_t *buf, uint32_t len);
extern ssize_t show_abtApp(struct spi_device *client, char *buf);
extern ssize_t store_abtApp(struct spi_device *client,
const char *buf, size_t count);
extern ssize_t show_abtTool(struct spi_device *client, char *buf);
extern ssize_t store_abtTool(struct spi_device *client,
const char *buf, size_t count);
extern int abt_force_set_report_mode(struct spi_device *client, u32 mode);
#endif
#endif
|
/* snefru.h */
#ifndef SNEFRU_H
#define SNEFRU_H
#include "stdint.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Snefru-128 processses message by blocks of 48 bytes, */
/* and Snefru-256 uses blocks of 32 bytes */
/* here we declare the maximal block size */
#define snefru_block_size 48
#define snefru128_hash_length 16
#define snefru256_hash_length 32
/* algorithm context */
typedef struct snefru_ctx
{
unsigned hash[8]; /* algorithm 512-bit hashing state */
unsigned char buffer[48]; /* 384-bit message block */
uint64_t length; /* processed message length */
unsigned index; /* index in the buffer of the last byte stored */
unsigned digest_length; /* length of the algorithm digest in bytes */
} snefru_ctx;
/* hash functions */
void snefru128_init(snefru_ctx *ctx);
void snefru256_init(snefru_ctx *ctx);
void snefru_update(snefru_ctx *ctx, const unsigned char *data, size_t size);
void snefru_final(snefru_ctx *ctx, unsigned char* result);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* SNEFRU_H */
|
// AsmJit - Machine code generation for C++
//
// * Official AsmJit Home Page: https://asmjit.com
// * Official Github Repository: https://github.com/asmjit/asmjit
//
// Copyright (c) 2008-2020 The AsmJit Authors
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
#ifndef ASMJIT_CORE_EMITTERUTILS_P_H_INCLUDED
#define ASMJIT_CORE_EMITTERUTILS_P_H_INCLUDED
#include "../core/emitter.h"
#include "../core/operand.h"
ASMJIT_BEGIN_NAMESPACE
class BaseAssembler;
//! \cond INTERNAL
//! \addtogroup asmjit_core
//! \{
// ============================================================================
// [asmjit::EmitterUtils]
// ============================================================================
namespace EmitterUtils {
static const Operand_ noExt[3] {};
enum kOpIndex {
kOp3 = 0,
kOp4 = 1,
kOp5 = 2
};
static ASMJIT_INLINE uint32_t opCountFromEmitArgs(const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_* opExt) noexcept {
uint32_t opCount = 0;
if (opExt[kOp3].isNone()) {
if (!o0.isNone()) opCount = 1;
if (!o1.isNone()) opCount = 2;
if (!o2.isNone()) opCount = 3;
}
else {
opCount = 4;
if (!opExt[kOp4].isNone()) {
opCount = 5 + uint32_t(!opExt[kOp5].isNone());
}
}
return opCount;
}
static ASMJIT_INLINE void opArrayFromEmitArgs(Operand_ dst[Globals::kMaxOpCount], const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_* opExt) noexcept {
dst[0].copyFrom(o0);
dst[1].copyFrom(o1);
dst[2].copyFrom(o2);
dst[3].copyFrom(opExt[kOp3]);
dst[4].copyFrom(opExt[kOp4]);
dst[5].copyFrom(opExt[kOp5]);
}
#ifndef ASMJIT_NO_LOGGING
enum : uint32_t {
// Has to be big to be able to hold all metadata compiler can assign to a
// single instruction.
kMaxInstLineSize = 44,
kMaxBinarySize = 26
};
Error formatLine(String& sb, const uint8_t* binData, size_t binSize, size_t dispSize, size_t immSize, const char* comment) noexcept;
void logLabelBound(BaseAssembler* self, const Label& label) noexcept;
void logInstructionEmitted(
BaseAssembler* self,
uint32_t instId, uint32_t options, const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_* opExt,
uint32_t relSize, uint32_t immSize, uint8_t* afterCursor);
Error logInstructionFailed(
BaseAssembler* self,
Error err, uint32_t instId, uint32_t options, const Operand_& o0, const Operand_& o1, const Operand_& o2, const Operand_* opExt);
#endif
}
//! \}
//! \endcond
ASMJIT_END_NAMESPACE
#endif // ASMJIT_CORE_EMITTERUTILS_P_H_INCLUDED
|
//
// UIImage+Color.h
// FlatUI
//
// Created by Jack Flintermann on 5/3/13.
// Copyright (c) 2013 Jack Flintermann. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (FlatUI)
+ (UIImage *)imageWithColor:(UIColor *)color
cornerRadius:(CGFloat)cornerRadius;
+ (UIImage *) buttonImageWithColor:(UIColor *)color
cornerRadius:(CGFloat)cornerRadius
shadowColor:(UIColor *)shadowColor
shadowInsets:(UIEdgeInsets)shadowInsets;
+ (UIImage *) circularImageWithColor:(UIColor *)color
size:(CGSize)size;
- (UIImage *) imageWithMinimumSize:(CGSize)size;
+ (UIImage *) stepperPlusImageWithColor:(UIColor *)color;
+ (UIImage *) stepperMinusImageWithColor:(UIColor *)color;
+ (UIImage *) backButtonImageWithColor:(UIColor *)color
barMetrics:(UIBarMetrics) metrics
cornerRadius:(CGFloat)cornerRadius;
@end
|
/*
* Copyright (c) 2007 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, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <va/va_x11.h>
#include "assert.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#define ASSERT assert
int main(int argc, const char* argv[])
{
Display *dpy;
VADisplay va_dpy;
VAStatus va_status;
int major_version, minor_version;
dpy = XOpenDisplay(NULL);
ASSERT( dpy );
printf("XOpenDisplay: dpy = %08x\n", dpy);
va_dpy = vaGetDisplay(dpy);
ASSERT( va_dpy );
printf("vaGetDisplay: va_dpy = %08x\n", va_dpy);
va_status = vaInitialize(va_dpy, &major_version, &minor_version);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaInitialize: major = %d minor = %d\n", major_version, minor_version);
{
VASurfaceID surfaces[21];
int i;
surfaces[20] = -1;
va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT( -1 == surfaces[20] ); /* bounds check */
for(i = 0; i < 20; i++)
{
printf("Surface %d surface_id = %08x\n", i, surfaces[i]);
}
Window win = XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0, 720, 480, 0, 0, WhitePixel(dpy, 0));
printf("Window = %08x\n", win);
XMapWindow(dpy, win);
XSync(dpy, False);
vaPutSurface(va_dpy, surfaces[0], win, 0, 0, 720, 480, 0, 0, 720, 480, 0);
sleep(10);
va_status = vaDestroySurface(va_dpy, surfaces, 20);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
{
int num_profiles;
int i;
VAProfile *profiles = malloc(vaMaxNumProfiles(va_dpy) * sizeof(VAProfile));
ASSERT(profiles);
printf("vaMaxNumProfiles = %d\n", vaMaxNumProfiles(va_dpy));
va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
for(i = 0; i < num_profiles; i++)
{
printf("Profile %d\n", profiles[i]);
}
}
{
VASurfaceID surfaces[20];
VAContextID context;
VAConfigAttrib attrib;
VAConfigID config_id;
int i;
attrib.type = VAConfigAttribRTFormat;
va_status = vaGetConfigAttributes(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD,
&attrib, 1);
ASSERT( VA_STATUS_SUCCESS == va_status );
ASSERT(attrib.value & VA_RT_FORMAT_YUV420);
/* Found desired RT format, keep going */
va_status = vaCreateConfig(va_dpy, VAProfileMPEG2Main, VAEntrypointVLD, &attrib, 1,
&config_id);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateSurfaces(va_dpy, 720, 480, VA_RT_FORMAT_YUV420, 20, surfaces);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateContext(va_dpy, config_id, 720, 480, 0 /* flag */, surfaces, 20, &context);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyContext(va_dpy, context);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroySurface(va_dpy, surfaces, 20);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
{
VABufferID picture_buf[3];
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[0]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[1]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaCreateBuffer(va_dpy, VAPictureParameterBufferType, &picture_buf[2]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[0]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[2]);
ASSERT( VA_STATUS_SUCCESS == va_status );
va_status = vaDestroyBuffer(va_dpy, picture_buf[1]);
ASSERT( VA_STATUS_SUCCESS == va_status );
}
va_status = vaTerminate(va_dpy);
ASSERT( VA_STATUS_SUCCESS == va_status );
printf("vaTerminate\n");
XCloseDisplay(dpy);
return 0;
}
|
//
// ModelCompany.h
//
// $Id$
//
// DO NOT EDIT. This file is machine-generated and constantly overwritten.
// Make changes to ModelCompany.h instead.
//
#import <Foundation/Foundation.h>
#import "ModelObject.h"
@class ModelAssistant;
@class ModelDepartment;
@class ModelEmployee;
@protocol _ModelCompany
@end
@interface _ModelCompany : ModelObject
{
NSString *name;
NSNumber *yearFounded;
NSArray *assistants;
NSArray *departments;
NSArray *employees;
}
@property (nonatomic, retain, readwrite) NSString *name;
@property (nonatomic, retain, readwrite) NSNumber *yearFounded;
@property (nonatomic, assign, readwrite) int yearFoundedValue;
@property (nonatomic, retain, readonly) NSArray *assistants;
@property (nonatomic, retain, readonly) NSArray *departments;
@property (nonatomic, retain, readonly) NSArray *employees;
- (void)addAssistantsObject:(ModelAssistant*)value_;
- (void)removeAssistantsObjects;
- (void)removeAssistantsObject:(ModelAssistant*)value_;
- (void)addDepartmentsObject:(ModelDepartment*)value_;
- (void)removeDepartmentsObjects;
- (void)removeDepartmentsObject:(ModelDepartment*)value_;
- (void)addEmployeesObject:(ModelEmployee*)value_;
- (void)removeEmployeesObjects;
- (void)removeEmployeesObject:(ModelEmployee*)value_;
@end
|
/* O_*, F_*, FD_* bit values for the AArch64 Linux ABI.
Copyright (C) 2011-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef _FCNTL_H
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
#endif
#define __O_DIRECTORY 040000
#define __O_NOFOLLOW 0100000
#define __O_DIRECT 0200000
#define __O_LARGEFILE 0
# define F_GETLK64 5
# define F_SETLK64 6
# define F_SETLKW64 7
struct flock
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off_t l_start; /* Offset where the lock begins. */
__off_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
#ifdef __USE_LARGEFILE64
struct flock64
{
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
__off64_t l_start; /* Offset where the lock begins. */
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
__pid_t l_pid; /* Process holding the lock. */
};
#endif
/* Include generic Linux declarations. */
#include <bits/fcntl-linux.h>
|
/*
Unix SMB/CIFS implementation.
async socket operations
Copyright (C) Volker Lendecke 2008
** NOTE! The following LGPL license applies to the async_sock
** library. This does NOT imply that all of Samba is released
** under the LGPL
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 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASYNC_SOCK_H__
#define __ASYNC_SOCK_H__
#include <talloc.h>
#include <tevent.h>
struct tevent_req *sendto_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
int fd, const void *buf, size_t len, int flags,
const struct sockaddr_storage *addr);
ssize_t sendto_recv(struct tevent_req *req, int *perrno);
struct tevent_req *recvfrom_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int fd, void *buf, size_t len, int flags,
struct sockaddr_storage *addr,
socklen_t *addr_len);
ssize_t recvfrom_recv(struct tevent_req *req, int *perrno);
struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int fd, const struct sockaddr *address,
socklen_t address_len);
int async_connect_recv(struct tevent_req *req, int *perrno);
struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct tevent_queue *queue, int fd,
bool err_on_readability,
struct iovec *iov, int count);
ssize_t writev_recv(struct tevent_req *req, int *perrno);
struct tevent_req *read_packet_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
int fd, size_t initial,
ssize_t (*more)(uint8_t *buf,
size_t buflen,
void *private_data),
void *private_data);
ssize_t read_packet_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
uint8_t **pbuf, int *perrno);
#endif
|
#pragma once
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#ifndef REFKNOWNFOLDERID
#define REFKNOWNFOLDERID REFGUID
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef BOOL (STDAPICALLTYPE *PFN_SHELLEXECUTEEXW)(
__inout LPSHELLEXECUTEINFOW lpExecInfo
);
void DAPI ShelFunctionOverride(
__in_opt PFN_SHELLEXECUTEEXW pfnShellExecuteExW
);
HRESULT DAPI ShelExec(
__in_z LPCWSTR wzTargetPath,
__in_opt LPCWSTR wzParameters,
__in_opt LPCWSTR wzVerb,
__in_opt LPCWSTR wzWorkingDirectory,
__in int nShowCmd,
__in_opt HWND hwndParent,
__out_opt HANDLE* phProcess
);
HRESULT DAPI ShelExecUnelevated(
__in_z LPCWSTR wzTargetPath,
__in_z_opt LPCWSTR wzParameters,
__in_z_opt LPCWSTR wzVerb,
__in_z_opt LPCWSTR wzWorkingDirectory,
__in int nShowCmd
);
HRESULT DAPI ShelGetFolder(
__out_z LPWSTR* psczFolderPath,
__in int csidlFolder
);
HRESULT DAPI ShelGetKnownFolder(
__out_z LPWSTR* psczFolderPath,
__in REFKNOWNFOLDERID rfidFolder
);
#ifdef __cplusplus
}
#endif
|
// Copyright 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 CC_TEST_FAKE_PICTURE_LAYER_H_
#define CC_TEST_FAKE_PICTURE_LAYER_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "cc/layers/picture_layer.h"
namespace cc {
class FakePictureLayer : public PictureLayer {
public:
static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) {
return make_scoped_refptr(new FakePictureLayer(client));
}
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
OVERRIDE;
size_t update_count() const { return update_count_; }
void reset_update_count() { update_count_ = 0; }
size_t push_properties_count() const { return push_properties_count_; }
void reset_push_properties_count() { push_properties_count_ = 0; }
void set_always_update_resources(bool always_update_resources) {
always_update_resources_ = always_update_resources;
}
virtual bool Update(ResourceUpdateQueue* queue,
const OcclusionTracker<Layer>* occlusion) OVERRIDE;
virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
private:
explicit FakePictureLayer(ContentLayerClient* client);
virtual ~FakePictureLayer();
size_t update_count_;
size_t push_properties_count_;
bool always_update_resources_;
};
} // namespace cc
#endif // CC_TEST_FAKE_PICTURE_LAYER_H_
|
/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
Used by <stdlib.h> and <math.h> functions for overflow.
SH version.
Copyright (C) 1992-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _MATH_H
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
#endif
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
#if __GNUC_PREREQ(3,3)
# define HUGE_VAL (__builtin_huge_val())
#elif __GNUC_PREREQ(2,96)
# define HUGE_VAL (__extension__ 0x1.0p2047)
#elif defined __GNUC__
# define HUGE_VAL \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
{ __l: 0x000000007ff00000ULL }).__d)
#else /* not GCC */
# include <endian.h>
typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
# if __BYTE_ORDER == __BIG_ENDIAN
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
# endif
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define __HUGE_VAL_bytes { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
# endif
static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
# define HUGE_VAL (__huge_val.__d)
#endif /* GCC. */
|
/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#undef rand
/* Return a random integer between 0 and RAND_MAX. */
int
rand (void)
{
return (int) __random ();
}
|
/**
* @file
*
* mfodthermal.c
*
* On Dimm thermal management.
*
* @xrefitem bom "File Content Label" "Release Content"
* @e project: AGESA
* @e sub-project: (Mem/Feat)
* @e \$Revision: 6314 $ @e \$Date: 2008-06-10 06:43:56 -0500 (Tue, 10 Jun 2008) $
*
**/
/*****************************************************************************
*
* Copyright (c) 2011, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Advanced Micro Devices, Inc. nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***************************************************************************
*
*/
/*
*----------------------------------------------------------------------------
* MODULES USED
*
*----------------------------------------------------------------------------
*/
#include "AGESA.h"
#include "mm.h"
#include "mn.h"
#include "mt.h"
#include "Ids.h"
#include "mfodthermal.h"
#include "Filecode.h"
#define FILECODE PROC_MEM_FEAT_ODTHERMAL_MFODTHERMAL_FILECODE
/*----------------------------------------------------------------------------
* DEFINITIONS AND MACROS
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* TYPEDEFS AND STRUCTURES
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* PROTOTYPES OF LOCAL FUNCTIONS
*
*----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* EXPORTED FUNCTIONS
*
*----------------------------------------------------------------------------
*/
/*-----------------------------------------------------------------------------*/
/**
*
* This function does On-Dimm thermal management.
*
* @param[in, out] *NBPtr - Pointer to the MEM_NB_BLOCK.
*
* @return TRUE - This feature is enabled.
* @return FALSE - This feature is not enabled.
*/
BOOLEAN
MemFOnDimmThermal (
IN OUT MEM_NB_BLOCK *NBPtr
)
{
UINT8 i;
UINT8 Dct;
CH_DEF_STRUCT *ChannelPtr;
MEM_DATA_STRUCT *MemPtr;
UINT8 *SpdBufferPtr;
UINT8 ThermalOp;
BOOLEAN ODTSEn;
BOOLEAN ExtendTmp;
ODTSEn = FALSE;
ExtendTmp = FALSE;
ASSERT (NBPtr != NULL);
MemPtr = NBPtr->MemPtr;
AGESA_TESTPOINT (TpProcMemOnDimmThermal, &MemPtr->StdHeader);
if (NBPtr->MCTPtr->NodeMemSize != 0) {
for (Dct = 0; Dct < NBPtr->DctCount; Dct++) {
NBPtr->SwitchDCT (NBPtr, Dct);
// Only go through the DCT if it is not disabled.
if (NBPtr->GetBitField (NBPtr, BFDisDramInterface) == 0) {
ChannelPtr = NBPtr->ChannelPtr;
// If Ganged mode is enabled, need to go through all dram devices on both DCTs.
if (!NBPtr->Ganged || (NBPtr->Dct != 1)) {
ODTSEn = TRUE;
ExtendTmp = TRUE;
}
for (i = 0; i < MAX_DIMMS_PER_CHANNEL; i ++) {
if (NBPtr->TechPtr->GetDimmSpdBuffer (NBPtr->TechPtr, &SpdBufferPtr, i)) {
// Check byte 31: thermal and refresh option.
ThermalOp = SpdBufferPtr[THERMAL_OPT];
// Bit 3: ODTS readout
if (!((ThermalOp >> 3) & 1)) {
ODTSEn = FALSE;
}
// Bit 0: Extended Temperature Range.
if (!(ThermalOp & 1)) {
ExtendTmp = FALSE;
}
}
}
if (!NBPtr->Ganged || (NBPtr->Dct == 1)) {
// If in ganged mode, need to switch back to DCT0 to set the registers.
if (NBPtr->Ganged) {
NBPtr->SwitchDCT (NBPtr, 0);
ChannelPtr = NBPtr->ChannelPtr;
}
// If all dram devices on a DCT support ODTS
if (ODTSEn) {
NBPtr->SetBitField (NBPtr, BFODTSEn, 1);
}
ChannelPtr->ExtendTmp = ExtendTmp;
}
}
}
}
return TRUE;
}
/*----------------------------------------------------------------------------
* LOCAL FUNCTIONS
*
*----------------------------------------------------------------------------
*/
|
/*
* Apple Filing Protocol Support - by David Maciejak @ GMAIL dot com
*
* tested with afpfs-ng 0.8.1
* AFPFS-NG: http://alexthepuffin.googlepages.com/home
*
*/
#include "hydra-mod.h"
#ifndef LIBAFP
void dummy_afp() {
printf("\n");
}
#else
#define FREE(x) \
if (x != NULL) { \
free(x); \
x = NULL; \
}
#include <stdio.h>
#include <afpfs-ng/afp.h>
#include <afpfs-ng/libafpclient.h>
extern char *HYDRA_EXIT;
void stdout_fct(void *priv, enum loglevels loglevel, int logtype, const char *message) {
//fprintf(stderr, "[ERROR] Caught unknown error %s\n", message);
}
static struct libafpclient afpclient = {
.unmount_volume = NULL,
.log_for_client = stdout_fct,
.forced_ending_hook = NULL,
.scan_extra_fds = NULL,
.loop_started = NULL,
};
static int server_subconnect(struct afp_url url) {
struct afp_connection_request *conn_req;
struct afp_server *server = NULL;
conn_req = malloc(sizeof(struct afp_connection_request));
// server = malloc(sizeof(struct afp_server));
memset(conn_req, 0, sizeof(struct afp_connection_request));
conn_req->url = url;
conn_req->url.requested_version = 31;
//fprintf(stderr, "AFP connection - username: %s password: %s server: %s\n", url.username, url.password, url.servername);
if (strlen(url.uamname) > 0) {
if ((conn_req->uam_mask = find_uam_by_name(url.uamname)) == 0) {
fprintf(stderr, "[ERROR] Unknown UAM: %s", url.uamname);
FREE(conn_req);
FREE(server);
return -1;
}
} else {
conn_req->uam_mask = default_uams_mask();
}
//fprintf(stderr, "Initiating connection attempt.\n");
if ((server = afp_server_full_connect(NULL, conn_req)) == NULL) {
FREE(conn_req);
// FREE(server);
return -1;
}
//fprintf(stderr, "Connected to server: %s via UAM: %s\n", server->server_name_printable, uam_bitmap_to_string(server->using_uam));
FREE(conn_req);
FREE(server);
return 0;
}
int start_afp(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp) {
char *empty = "";
char *login, *pass, mlogin[AFP_MAX_USERNAME_LEN], mpass[AFP_MAX_PASSWORD_LEN];
struct afp_url tmpurl;
/* Build AFP authentication request */
libafpclient_register(&afpclient);
afp_main_quick_startup(NULL);
init_uams();
afp_default_url(&tmpurl);
if (strlen(login = hydra_get_next_login()) == 0)
login = empty;
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
strncpy(tmpurl.servername, hydra_address2string(ip), AFP_SERVER_NAME_LEN - 1);
tmpurl.servername[AFP_SERVER_NAME_LEN] = 0;
strncpy(mlogin, login, AFP_MAX_USERNAME_LEN - 1);
mlogin[AFP_MAX_USERNAME_LEN - 1] = 0;
strncpy(mpass, pass, AFP_MAX_PASSWORD_LEN - 1);
mpass[AFP_MAX_PASSWORD_LEN - 1] = 0;
memcpy(&tmpurl.username, mlogin, AFP_MAX_USERNAME_LEN);
memcpy(&tmpurl.password, mpass, AFP_MAX_PASSWORD_LEN);
if (server_subconnect(tmpurl) == 0) {
hydra_report_found_host(port, ip, "afp", fp);
hydra_completed_pair_found();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 2;
} else {
hydra_completed_pair();
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 2;
}
return 1;
}
void service_afp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port) {
int run = 1, next_run = 1, sock = -1;
int myport = PORT_AFP;
hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return;
while (1) {
switch (run) {
case 1: /* connect and service init function */
if (sock >= 0)
sock = hydra_disconnect(sock);
if ((options & OPTION_SSL) == 0) {
if (port != 0)
myport = port;
sock = hydra_connect_tcp(ip, myport);
port = myport;
}
if (sock < 0) {
if (quiet != 1) fprintf(stderr, "[ERROR] Child with pid %d terminating, can not connect\n", (int) getpid());
hydra_child_exit(1);
}
next_run = 2;
break;
case 2:
/*
* Here we start the password cracking process
*/
next_run = start_afp(sock, ip, port, options, miscptr, fp);
break;
case 3:
if (sock >= 0)
sock = hydra_disconnect(sock);
hydra_child_exit(0);
return;
default:
fprintf(stderr, "[ERROR] Caught unknown return code, exiting!\n");
hydra_child_exit(0);
}
run = next_run;
}
}
#endif
int service_afp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port) {
// called before the childrens are forked off, so this is the function
// which should be filled if initial connections and service setup has to be
// performed once only.
//
// fill if needed.
//
// return codes:
// 0 all OK
// -1 error, hydra will exit, so print a good error message here
return 0;
}
|
/* ===-- umodti3.c - Implement __umodti3 -----------------------------------===
*
* The LLVM Compiler Infrastructure
*
* This file is dual licensed under the MIT and the University of Illinois Open
* Source Licenses. See LICENSE.TXT for details.
*
* ===----------------------------------------------------------------------===
*
* This file implements __umodti3 for the compiler_rt library.
*
* ===----------------------------------------------------------------------===
*/
#include "int_lib.h"
#ifdef CRT_HAS_128BIT
/* Returns: a % b */
COMPILER_RT_ABI tu_int
__umodti3(tu_int a, tu_int b)
{
tu_int r;
__udivmodti4(a, b, &r);
return r;
}
#endif /* CRT_HAS_128BIT */
|
/* Implementation of the dtime intrinsic.
Copyright (C) 2004, 2005, 2006, 2007, 2009, 2011 Free Software
Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran 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.
Libgfortran 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/>. */
#include "libgfortran.h"
#include "time_1.h"
#include <gthr.h>
#ifdef __GTHREAD_MUTEX_INIT
static __gthread_mutex_t dtime_update_lock = __GTHREAD_MUTEX_INIT;
#else
static __gthread_mutex_t dtime_update_lock;
#endif
extern void dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result);
iexport_proto(dtime_sub);
void
dtime_sub (gfc_array_r4 *t, GFC_REAL_4 *result)
{
GFC_REAL_4 *tp;
long user_sec, user_usec, system_sec, system_usec;
static long us = 0, uu = 0, ss = 0 , su = 0;
GFC_REAL_4 tu, ts, tt;
if (((GFC_DESCRIPTOR_EXTENT(t,0))) < 2)
runtime_error ("Insufficient number of elements in TARRAY.");
__gthread_mutex_lock (&dtime_update_lock);
if (gf_cputime (&user_sec, &user_usec, &system_sec, &system_usec) == 0)
{
tu = (GFC_REAL_4) ((user_sec - us) + 1.e-6 * (user_usec - uu));
ts = (GFC_REAL_4) ((system_sec - ss) + 1.e-6 * (system_usec - su));
tt = tu + ts;
us = user_sec;
uu = user_usec;
ss = system_sec;
su = system_usec;
}
else
{
tu = -1;
ts = -1;
tt = -1;
}
tp = t->data;
*tp = tu;
tp += GFC_DESCRIPTOR_STRIDE(t,0);
*tp = ts;
*result = tt;
__gthread_mutex_unlock (&dtime_update_lock);
}
iexport(dtime_sub);
extern GFC_REAL_4 dtime (gfc_array_r4 *t);
export_proto(dtime);
GFC_REAL_4
dtime (gfc_array_r4 *t)
{
GFC_REAL_4 val;
dtime_sub (t, &val);
return val;
}
|
/*
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#import <string>
#import <UIKit/UIKit.h>
BOOL CKSubclassOverridesSelector(Class superclass, Class subclass, SEL selector);
std::string CKStringFromPointer(const void *ptr);
CGFloat CKScreenScale();
CGFloat CKFloorPixelValue(CGFloat f);
CGFloat CKCeilPixelValue(CGFloat f);
CGFloat CKRoundPixelValue(CGFloat f);
|
/* Copyright (C) 2009-2013 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Transactional Memory Library (libitm).
Libitm 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.
Libitm 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/>. */
#ifndef GTM_RWLOCK_H
#define GTM_RWLOCK_H
#include <pthread.h>
#include "local_atomic"
namespace GTM HIDDEN {
struct gtm_thread;
// This datastructure is the blocking, mutex-based side of the Dekker-style
// reader-writer lock used to provide mutual exclusion between active and
// serial transactions. It has similarities to POSIX pthread_rwlock_t except
// that we also provide for upgrading a reader->writer lock, with a
// positive indication of failure (another writer acquired the lock
// before we were able to acquire). While the writer flag (a_writer below) is
// global and protected by the mutex, there are per-transaction reader flags,
// which are stored in a transaction's shared state.
// See libitm's documentation for further details.
//
// In this implementation, writers are given highest priority access but
// read-to-write upgrades do not have a higher priority than writers.
class gtm_rwlock
{
pthread_mutex_t mutex; // Held if manipulating any field.
pthread_cond_t c_readers; // Readers wait here
pthread_cond_t c_writers; // Writers wait here for writers
pthread_cond_t c_confirmed_writers; // Writers wait here for readers
static const unsigned a_writer = 1; // An active writer.
static const unsigned w_writer = 2; // The w_writers field != 0
static const unsigned w_reader = 4; // The w_readers field != 0
std::atomic<unsigned int> summary; // Bitmask of the above.
unsigned int a_readers; // Nr active readers as observed by a writer
unsigned int w_readers; // Nr waiting readers
unsigned int w_writers; // Nr waiting writers
public:
gtm_rwlock();
~gtm_rwlock();
void read_lock (gtm_thread *tx);
void read_unlock (gtm_thread *tx);
void write_lock ();
void write_unlock ();
bool write_upgrade (gtm_thread *tx);
void write_upgrade_finish (gtm_thread *tx);
// Returns true iff there is a concurrent active or waiting writer.
// This is primarily useful for simple HyTM approaches, and the value being
// checked is loaded with memory_order_relaxed.
bool is_write_locked()
{
return summary.load (memory_order_relaxed) & (a_writer | w_writer);
}
protected:
bool write_lock_generic (gtm_thread *tx);
};
} // namespace GTM
#endif // GTM_RWLOCK_H
|
#include "input/input_state.h"
#include "math/geom2d.h"
// Mainly for detecting (multi-)touch gestures but also useable for left button mouse dragging etc.
// Currently only supports simple scroll-drags with inertia.
// TODO: Two-finger zoom/rotate etc.
enum Gesture {
GESTURE_DRAG_VERTICAL = 1,
GESTURE_DRAG_HORIZONTAL = 2,
GESTURE_TWO_FINGER_ZOOM = 4,
GESTURE_TWO_FINGER_ZOOM_ROTATE = 8,
};
// May track multiple gestures at the same time. You simply call GetGestureInfo
// with the gesture you are interested in.
class GestureDetector {
public:
GestureDetector();
TouchInput Update(const TouchInput &touch, const Bounds &bounds);
void UpdateFrame();
bool IsGestureActive(Gesture gesture) const;
bool GetGestureInfo(Gesture gesture, float info[4]) const;
private:
// jazzhands!
enum Locals {
MAX_PTRS = 10,
};
struct Pointer {
bool down;
double downTime;
float lastX;
float lastY;
float downX;
float downY;
float deltaX;
float deltaY;
float distanceX;
float distanceY;
};
Pointer pointers[MAX_PTRS];
uint32_t active_;
// For inertia estimation
float estimatedInertiaX_;
float estimatedInertiaY_;
};
|
/***********************************************************
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL 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.
******************************************************************/
#ifndef DIXSTRUCT_H
#define DIXSTRUCT_H
#include "dix.h"
#include "resource.h"
#include "cursor.h"
#include "gc.h"
#include "pixmap.h"
#include "privates.h"
#include <X11/Xmd.h>
/*
* direct-mapped hash table, used by resource manager to store
* translation from client ids to server addresses.
*/
extern _X_EXPORT CallbackListPtr ClientStateCallback;
typedef struct {
ClientPtr client;
xConnSetupPrefix *prefix;
xConnSetup *setup;
} NewClientInfoRec;
typedef void (*ReplySwapPtr) (
ClientPtr /* pClient */,
int /* size */,
void * /* pbuf */);
extern _X_EXPORT void ReplyNotSwappd (
ClientPtr /* pClient */,
int /* size */,
void * /* pbuf */) _X_NORETURN;
typedef enum {ClientStateInitial,
ClientStateAuthenticating,
ClientStateRunning,
ClientStateRetained,
ClientStateGone,
ClientStateCheckingSecurity,
ClientStateCheckedSecurity} ClientState;
#ifdef XFIXES
typedef struct _saveSet {
struct _Window *windowPtr;
Bool toRoot;
Bool map;
} SaveSetElt;
#define SaveSetWindow(ss) ((ss).windowPtr)
#define SaveSetToRoot(ss) ((ss).toRoot)
#define SaveSetShouldMap(ss) ((ss).map)
#define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w))
#define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr))
#define SaveSetAssignMap(ss,m) ((ss).map = (m))
#else
typedef struct _Window *SaveSetElt;
#define SaveSetWindow(ss) (ss)
#define SaveSetToRoot(ss) FALSE
#define SaveSetShouldMap(ss) TRUE
#define SaveSetAssignWindow(ss,w) ((ss) = (w))
#define SaveSetAssignToRoot(ss,tr)
#define SaveSetAssignMap(ss,m)
#endif
typedef struct _Client {
int index;
Mask clientAsMask;
pointer requestBuffer;
pointer osPrivate; /* for OS layer, including scheduler */
Bool swapped;
ReplySwapPtr pSwapReplyFunc;
XID errorValue;
int sequence;
int closeDownMode;
int clientGone;
int noClientException; /* this client died or needs to be
* killed */
int ignoreCount; /* count for Attend/IgnoreClient */
SaveSetElt *saveSet;
int numSaved;
int (**requestVector) (
ClientPtr /* pClient */);
CARD32 req_len; /* length of current request */
Bool big_requests; /* supports large requests */
int priority;
ClientState clientState;
PrivateRec *devPrivates;
unsigned short xkbClientFlags;
unsigned short mapNotifyMask;
unsigned short newKeyboardNotifyMask;
unsigned short vMajor,vMinor;
KeyCode minKC,maxKC;
unsigned long replyBytesRemaining;
int smart_priority;
long smart_start_tick;
long smart_stop_tick;
long smart_check_tick;
DeviceIntPtr clientPtr;
} ClientRec;
/*
* Scheduling interface
*/
extern _X_EXPORT long SmartScheduleTime;
extern _X_EXPORT long SmartScheduleInterval;
extern _X_EXPORT long SmartScheduleSlice;
extern _X_EXPORT long SmartScheduleMaxSlice;
extern _X_EXPORT Bool SmartScheduleDisable;
extern _X_EXPORT void SmartScheduleStartTimer(void);
extern _X_EXPORT void SmartScheduleStopTimer(void);
#define SMART_MAX_PRIORITY (20)
#define SMART_MIN_PRIORITY (-20)
extern _X_EXPORT void SmartScheduleInit(void);
/* This prototype is used pervasively in Xext, dix */
#define DISPATCH_PROC(func) int func(ClientPtr /* client */)
typedef struct _WorkQueue {
struct _WorkQueue *next;
Bool (*function) (
ClientPtr /* pClient */,
pointer /* closure */
);
ClientPtr client;
pointer closure;
} WorkQueueRec;
extern _X_EXPORT TimeStamp currentTime;
extern _X_EXPORT TimeStamp lastDeviceEventTime;
extern _X_EXPORT int CompareTimeStamps(
TimeStamp /*a*/,
TimeStamp /*b*/);
extern _X_EXPORT TimeStamp ClientTimeToServerTime(CARD32 /*c*/);
typedef struct _CallbackRec {
CallbackProcPtr proc;
pointer data;
Bool deleted;
struct _CallbackRec *next;
} CallbackRec, *CallbackPtr;
typedef struct _CallbackList {
int inCallback;
Bool deleted;
int numDeleted;
CallbackPtr list;
} CallbackListRec;
/* proc vectors */
extern _X_EXPORT int (* InitialVector[3]) (ClientPtr /*client*/);
extern _X_EXPORT int (* ProcVector[256]) (ClientPtr /*client*/);
extern _X_EXPORT int (* SwappedProcVector[256]) (ClientPtr /*client*/);
extern _X_EXPORT ReplySwapPtr ReplySwapVector[256];
extern _X_EXPORT int ProcBadRequest(ClientPtr /*client*/);
#endif /* DIXSTRUCT_H */
|
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkANGLEGLContext_DEFINED
#define SkANGLEGLContext_DEFINED
#if SK_ANGLE
#include "SkGLContext.h"
#include <GLES2/gl2.h>
#include <EGL/egl.h>
class SkANGLEGLContext : public SkGLContext {
public:
SkANGLEGLContext();
virtual ~SkANGLEGLContext();
virtual void makeCurrent() const SK_OVERRIDE;
class AutoContextRestore {
public:
AutoContextRestore();
~AutoContextRestore();
private:
EGLContext fOldEGLContext;
EGLDisplay fOldDisplay;
EGLSurface fOldSurface;
};
protected:
virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
virtual void destroyGLContext() SK_OVERRIDE;
private:
EGLContext fContext;
EGLDisplay fDisplay;
EGLSurface fSurface;
};
#endif
#endif
|
#ifndef _SYSDEP_TLS_H
#define _SYSDEP_TLS_H
# ifndef __KERNEL__
/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
* may be named user_desc (but in 2.4 and in header matching its API was named
* modify_ldt_ldt_s). */
typedef struct um_dup_user_desc {
unsigned int entry_number;
unsigned int base_addr;
unsigned int limit;
unsigned int seg_32bit:1;
unsigned int contents:2;
unsigned int read_exec_only:1;
unsigned int limit_in_pages:1;
unsigned int seg_not_present:1;
unsigned int useable:1;
#ifdef __x86_64__
unsigned int lm:1;
#endif
} user_desc_t;
# else /* __KERNEL__ */
typedef struct user_desc user_desc_t;
# endif /* __KERNEL__ */
extern int os_set_thread_area(user_desc_t *info, int pid);
extern int os_get_thread_area(user_desc_t *info, int pid);
#ifdef __i386__
#define GDT_ENTRY_TLS_MIN_I386 6
#define GDT_ENTRY_TLS_MIN_X86_64 12
#endif
#endif /* _SYSDEP_TLS_H */
|
/*
* Author: Landon Fuller <landonf@plausiblelabs.com>
*
* Copyright (c) 2008-2010 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "PLCrashReport.h"
/**
* A crash report formatter accepts a PLCrashReport instance, formats it according to implementation-specified rules,
* (such as implementing text output support), and returns the result.
*/
@protocol PLCrashReportFormatter
/**
* Format the provided @a report.
*
* @param report Report to be formatted.
* @param outError A pointer to an NSError object variable. If an error occurs, this pointer will contain an error
* object indicating why the pending crash report could not be formatted. If no error occurs, this parameter will
* be left unmodified. You may specify nil for this parameter, and no error information will be provided.
*
* @return Returns the formatted report data on success, or nil on failure.
*/
- (NSData *) formatReport: (PLCrashReport *) report error: (NSError **) outError;
@end
|
/*
* Copyright (c) 2012 Samsung Electronics Co., Ltd.
* http://www.samsung.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/init.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <plat/iic.h>
#include <plat/devs.h>
#include <plat/gpio-cfg.h>
#include <linux/delay.h>
#include <mach/gpio.h>
#include <linux/input.h>
#include <linux/gpio.h>
#include <linux/err.h>
#include <linux/pwm.h>
#include <linux/i2c-gpio.h>
#include <linux/isa1400_vibrator.h>
#define MOTOR_PWM_PERIOD 485
#define MOTOR_MAX_TIMEOUT 10000
struct pwm_device *motor_pwm;
static u8 motor_pwm_id;
extern unsigned int system_rev;
static u8 isa1400_init[] = {
ISA1400_REG_INIT, 0,
ISA1400_REG_AMPGAIN1, 0x57,
ISA1400_REG_AMPGAIN2, 0x57,
ISA1400_REG_OVDRTYP, 0xca,
ISA1400_REG_AMPSWTCH, 0x1a,
ISA1400_REG_SYSCLK, 0x21,
ISA1400_REG_GAIN, 0x00,
ISA1400_REG_GAIN2, 0x00,
ISA1400_REG_GAIN3, 0x00,
ISA1400_REG_GAIN4, 0x00,
ISA1400_REG_FREQ1M, 0x0c,
ISA1400_REG_FREQ1L, 0xd6,
ISA1400_REG_FREQ2M, 0x0c,
ISA1400_REG_FREQ2L, 0xd6,
ISA1400_REG_FREQ3M, 0x0c,
ISA1400_REG_FREQ3L, 0xd6,
ISA1400_REG_FREQ4M, 0x0c,
ISA1400_REG_FREQ4L, 0xd6,
ISA1400_REG_HPTEN, 0x0f,
ISA1400_REG_CHMODE, 0x00,
ISA1400_REG_WAVESEL, 0x00,
};
static u8 isa1400_start[] = {
ISA1400_REG_START, 0,
ISA1400_REG_GAIN, 0x7f,
ISA1400_REG_GAIN2, 0x7f,
ISA1400_REG_GAIN3, 0x7f,
ISA1400_REG_GAIN4, 0x7f,
};
static u8 isa1400_stop[] = {
ISA1400_REG_STOP, 0,
ISA1400_REG_GAIN, 0x00,
ISA1400_REG_GAIN2, 0x00,
ISA1400_REG_GAIN3, 0x00,
ISA1400_REG_GAIN4, 0x00,
ISA1400_REG_HPTEN, 0x00,
};
static const u8 *isa1400_reg_data[] = {
isa1400_init,
isa1400_start,
isa1400_stop,
};
static int isa1400_vdd_en(bool en)
{
int ret = 0;
pr_info("[VIB] %s %s\n",
__func__, en ? "on" : "off");
ret = gpio_direction_output(GPIO_MOTOR_EN, en);
if (en)
msleep(20);
return ret;
}
static int isa1400_clk_en(bool en)
{
if (!motor_pwm) {
motor_pwm =
pwm_request(motor_pwm_id, "vibrator");
if (IS_ERR(motor_pwm))
pr_err("[VIB] Failed to request pwm.\n");
else
pwm_config(motor_pwm,
MOTOR_PWM_PERIOD / 2,
MOTOR_PWM_PERIOD);
}
if (en)
return pwm_enable(motor_pwm);
else
pwm_disable(motor_pwm);
return 0;
}
static struct i2c_gpio_platform_data gpio_i2c_data20 = {
.sda_pin = GPIO_MOTOR_SDA,
.scl_pin = GPIO_MOTOR_SCL,
};
struct platform_device s3c_device_i2c20 = {
.name = "i2c-gpio",
.id = 20,
.dev.platform_data = &gpio_i2c_data20,
};
const u8 actuators[] = {CH1, CH3,};
static struct isa1400_vibrator_platform_data isa1400_vibrator_pdata = {
.gpio_en = isa1400_vdd_en,
.clk_en = isa1400_clk_en,
.max_timeout = MOTOR_MAX_TIMEOUT,
.reg_data = isa1400_reg_data,
.actuator = actuators,
.actuactor_num = ARRAY_SIZE(actuators),
};
static struct i2c_board_info i2c_devs20_emul[] __initdata = {
{
I2C_BOARD_INFO("isa1400_vibrator", (0x90 >> 1)),
.platform_data = &isa1400_vibrator_pdata,
},
};
void vienna_motor_init(void)
{
u32 gpio, gpio_motor_pwm;
pr_info("[VIB] system_rev %d\n", system_rev);
gpio = GPIO_MOTOR_EN;
gpio_request(gpio, "MOTOR_EN");
gpio_direction_output(gpio, 1);
gpio_export(gpio, 0);
if (system_rev >= 0x3) {
motor_pwm_id = 1;
gpio_motor_pwm = EXYNOS5410_GPB2(1);
gpio_i2c_data20.sda_pin = EXYNOS5410_GPB0(0);
gpio_i2c_data20.scl_pin = EXYNOS5410_GPB0(1);
} else {
motor_pwm_id = 0;
gpio_motor_pwm = EXYNOS5410_GPB2(0);
}
gpio_request(gpio_motor_pwm, "motor_pwm");
s3c_gpio_cfgpin(gpio_motor_pwm, S3C_GPIO_SFN(0x2));
platform_device_register(&s3c_device_timer[motor_pwm_id]);
isa1400_init[1] = sizeof(isa1400_init);
isa1400_start[1] = sizeof(isa1400_start);
isa1400_stop[1] = sizeof(isa1400_stop);
i2c_register_board_info(20, i2c_devs20_emul,
ARRAY_SIZE(i2c_devs20_emul));
platform_device_register(&s3c_device_i2c20);
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
#define COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
#include <map>
#include <string>
#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer/timer.h"
#include "components/metrics/daily_event.h"
class PrefRegistrySimple;
class PrefService;
namespace net {
class URLRequestContextGetter;
}
namespace rappor {
class LogUploader;
class RapporMetric;
class RapporReports;
struct RapporParameters;
// The type of data stored in a metric.
enum RapporType {
// For sampling the eTLD+1 of a URL.
ETLD_PLUS_ONE_RAPPOR_TYPE = 0,
NUM_RAPPOR_TYPES
};
// This class provides an interface for recording samples for rappor metrics,
// and periodically generates and uploads reports based on the collected data.
class RapporService {
public:
// Constructs a RapporService.
// Calling code is responsible for ensuring that the lifetime of
// |pref_service| is longer than the lifetime of RapporService.
explicit RapporService(PrefService* pref_service);
virtual ~RapporService();
// Add an observer for collecting daily metrics.
void AddDailyObserver(scoped_ptr<metrics::DailyEvent::Observer> observer);
// Starts the periodic generation of reports and upload attempts.
void Start(net::URLRequestContextGetter* context,
bool metrics_enabled);
// Records a sample of the rappor metric specified by |metric_name|.
// Creates and initializes the metric, if it doesn't yet exist.
void RecordSample(const std::string& metric_name,
RapporType type,
const std::string& sample);
// Sets the cohort value. For use by tests only.
void SetCohortForTesting(uint32_t cohort) { cohort_ = cohort; }
// Sets the secret value. For use by tests only.
void SetSecretForTesting(const std::string& secret) { secret_ = secret; }
// Registers the names of all of the preferences used by RapporService in the
// provided PrefRegistry. This should be called before calling Start().
static void RegisterPrefs(PrefRegistrySimple* registry);
protected:
// Retrieves the cohort number this client was assigned to, generating it if
// doesn't already exist. The cohort should be persistent.
void LoadCohort();
// Retrieves the value for secret_ from preferences, generating it if doesn't
// already exist. The secret should be persistent, so that additional bits
// from the client do not get exposed over time.
void LoadSecret();
// Logs all of the collected metrics to the reports proto message and clears
// the internal map. Exposed for tests. Returns true if any metrics were
// recorded.
bool ExportMetrics(RapporReports* reports);
// Records a sample of the rappor metric specified by |parameters|.
// Creates and initializes the metric, if it doesn't yet exist.
// Exposed for tests.
void RecordSampleInternal(const std::string& metric_name,
const RapporParameters& parameters,
const std::string& sample);
private:
// Check if the service has been started successfully.
bool IsInitialized() const;
// Called whenever the logging interval elapses to generate a new log of
// reports and pass it to the uploader.
void OnLogInterval();
// Finds a metric in the metrics_map_, creating it if it doesn't already
// exist.
RapporMetric* LookUpMetric(const std::string& metric_name,
const RapporParameters& parameters);
// A weak pointer to the PrefService used to read and write preferences.
PrefService* pref_service_;
// Client-side secret used to generate fake bits.
std::string secret_;
// The cohort this client is assigned to. -1 is uninitialized.
int32_t cohort_;
// Timer which schedules calls to OnLogInterval().
base::OneShotTimer<RapporService> log_rotation_timer_;
// A daily event for collecting metrics once a day.
metrics::DailyEvent daily_event_;
// A private LogUploader instance for sending reports to the server.
scoped_ptr<LogUploader> uploader_;
// We keep all registered metrics in a map, from name to metric.
// The map owns the metrics it contains.
std::map<std::string, RapporMetric*> metrics_map_;
DISALLOW_COPY_AND_ASSIGN(RapporService);
};
} // namespace rappor
#endif // COMPONENTS_RAPPOR_RAPPOR_SERVICE_H_
|
//
// GTMCalculatedRange.h
//
// This is a collection that allows you to calculate a value based on
// defined stops in a range.
//
// Copyright 2006-2008 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.
//
#import <Foundation/Foundation.h>
#import "GTMDefines.h"
/// Allows you to calculate a value based on defined stops in a range.
//
/// For example if you have a range from 0.0 to 1.0 where the stop
/// located at 0.0 is red and the stop located at 1.0 is blue,
/// the value based on the position 0.5 would come out as purple assuming
/// that the valueAtPosition function calculates a purely linear mapping between
/// the stops at 0.0 and 1.0. Stops have indices and are sorted from lowest to
/// highest. The example above would have 2 stops. Stop 0 would be red and stop
/// 1 would be blue.
///
/// Subclasses of GTMCalculatedRange are expected to override the valueAtPosition:
/// method to return a value based on the position passed in, and the stops
/// that are currently set in the range. Stops do not necessarily have to
/// be the same type as the values that are calculated, but normally they are.
@interface GTMCalculatedRange : NSObject {
NSMutableArray *storage_;
}
// Adds a stop to the range at |position|. If there is already a stop
// at position |position| it is replaced.
//
// Args:
// item: the object to place at |position|.
// position: the position in the range to put |item|.
//
- (void)insertStop:(id)item atPosition:(CGFloat)position;
// Removes a stop from the range at |position|.
//
// Args:
// position: the position in the range to remove |item|.
//
// Returns:
// YES if there is a stop at |position| that has been removed
// NO if there is not a stop at the |position|
- (BOOL)removeStopAtPosition:(CGFloat)position;
// Removes stop |index| from the range. Stops are ordered
// based on position where index of x < index of y if position
// of x < position of y.
//
// Args:
// item: the object to place at |position|.
// position: the position in the range to put |item|.
//
- (void)removeStopAtIndex:(NSUInteger)index;
// Returns the number of stops in the range.
//
// Returns:
// number of stops
- (NSUInteger)stopCount;
// Returns the value at position |position|.
// This function should be overridden by subclasses to calculate a
// value for any given range.
// The default implementation returns a value if there happens to be
// a stop for the given position. Otherwise it returns nil.
//
// Args:
// position: the position to calculate a value for.
//
// Returns:
// value for position
- (id)valueAtPosition:(CGFloat)position;
// Returns the |index|'th stop and position in the set.
// Throws an exception if out of range.
//
// Args:
// index: the index of the stop
// outPosition: a pointer to a value to be filled in with a position.
// this can be NULL, in which case no position is returned.
//
// Returns:
// the stop at the index.
- (id)stopAtIndex:(NSUInteger)index position:(CGFloat*)outPosition;
@end
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_TEXT_PATCHING_H
#define _ASM_X86_TEXT_PATCHING_H
#include <linux/types.h>
#include <linux/stddef.h>
#include <asm/ptrace.h>
struct paravirt_patch_site;
#ifdef CONFIG_PARAVIRT
void apply_paravirt(struct paravirt_patch_site *start,
struct paravirt_patch_site *end);
#else
static inline void apply_paravirt(struct paravirt_patch_site *start,
struct paravirt_patch_site *end)
{}
#define __parainstructions NULL
#define __parainstructions_end NULL
#endif
/*
* Currently, the max observed size in the kernel code is
* JUMP_LABEL_NOP_SIZE/RELATIVEJUMP_SIZE, which are 5.
* Raise it if needed.
*/
#define POKE_MAX_OPCODE_SIZE 5
struct text_poke_loc {
void *detour;
void *addr;
size_t len;
const char opcode[POKE_MAX_OPCODE_SIZE];
};
extern void text_poke_early(void *addr, const void *opcode, size_t len);
/*
* Clear and restore the kernel write-protection flag on the local CPU.
* Allows the kernel to edit read-only pages.
* Side-effect: any interrupt handler running between save and restore will have
* the ability to write to read-only pages.
*
* Warning:
* Code patching in the UP case is safe if NMIs and MCE handlers are stopped and
* no thread can be preempted in the instructions being modified (no iret to an
* invalid instruction possible) or if the instructions are changed from a
* consistent state to another consistent state atomically.
* On the local CPU you need to be protected against NMI or MCE handlers seeing
* an inconsistent instruction while you patch.
*/
extern void *text_poke(void *addr, const void *opcode, size_t len);
extern void *text_poke_kgdb(void *addr, const void *opcode, size_t len);
extern int poke_int3_handler(struct pt_regs *regs);
extern void text_poke_bp(void *addr, const void *opcode, size_t len, void *handler);
extern void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_entries);
extern int after_bootmem;
extern __ro_after_init struct mm_struct *poking_mm;
extern __ro_after_init unsigned long poking_addr;
#ifndef CONFIG_UML_X86
static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip)
{
regs->ip = ip;
}
#define INT3_INSN_SIZE 1
#define CALL_INSN_SIZE 5
static inline void int3_emulate_push(struct pt_regs *regs, unsigned long val)
{
/*
* The int3 handler in entry_64.S adds a gap between the
* stack where the break point happened, and the saving of
* pt_regs. We can extend the original stack because of
* this gap. See the idtentry macro's create_gap option.
*/
regs->sp -= sizeof(unsigned long);
*(unsigned long *)regs->sp = val;
}
static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func)
{
int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE);
int3_emulate_jmp(regs, func);
}
#endif /* !CONFIG_UML_X86 */
#endif /* _ASM_X86_TEXT_PATCHING_H */
|
/*
* Copyright (c) 2011 - 2012 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Register definition file for Samsung G-Scaler driver
*
* 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.
*/
#ifndef REGS_GSC_H_
#define REGS_GSC_H_
/* G-Scaler enable */
#define GSC_ENABLE 0x00
#define GSC_ENABLE_OP_STATUS (1 << 2)
#define GSC_ENABLE_SFR_UPDATE (1 << 1)
#define GSC_ENABLE_ON (1 << 0)
/* G-Scaler S/W reset */
#define GSC_SW_RESET 0x04
#define GSC_SW_RESET_SRESET (1 << 0)
/* G-Scaler IRQ */
#define GSC_IRQ 0x08
#define GSC_IRQ_STATUS_OR_IRQ (1 << 17)
#define GSC_IRQ_STATUS_FRM_DONE_IRQ (1 << 16)
#define GSC_IRQ_FRMDONE_MASK (1 << 1)
#define GSC_IRQ_ENABLE (1 << 0)
/* G-Scaler input control */
#define GSC_IN_CON 0x10
#define GSC_IN_ROT_MASK (7 << 16)
#define GSC_IN_ROT_270 (7 << 16)
#define GSC_IN_ROT_90_YFLIP (6 << 16)
#define GSC_IN_ROT_90_XFLIP (5 << 16)
#define GSC_IN_ROT_90 (4 << 16)
#define GSC_IN_ROT_180 (3 << 16)
#define GSC_IN_ROT_YFLIP (2 << 16)
#define GSC_IN_ROT_XFLIP (1 << 16)
#define GSC_IN_RGB_TYPE_MASK (3 << 14)
#define GSC_IN_RGB_HD_WIDE (3 << 14)
#define GSC_IN_RGB_HD_NARROW (2 << 14)
#define GSC_IN_RGB_SD_WIDE (1 << 14)
#define GSC_IN_RGB_SD_NARROW (0 << 14)
#define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13)
#define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13)
#define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13)
#define GSC_IN_CHROMA_ORDER_MASK (1 << 12)
#define GSC_IN_CHROMA_ORDER_CBCR (0 << 12)
#define GSC_IN_CHROMA_ORDER_CRCB (1 << 12)
#define GSC_IN_FORMAT_MASK (7 << 8)
#define GSC_IN_XRGB8888 (0 << 8)
#define GSC_IN_RGB565 (1 << 8)
#define GSC_IN_YUV420_2P (2 << 8)
#define GSC_IN_YUV420_3P (3 << 8)
#define GSC_IN_YUV422_1P (4 << 8)
#define GSC_IN_YUV422_2P (5 << 8)
#define GSC_IN_YUV422_3P (6 << 8)
#define GSC_IN_TILE_TYPE_MASK (1 << 4)
#define GSC_IN_TILE_C_16x8 (0 << 4)
#define GSC_IN_TILE_MODE (1 << 3)
#define GSC_IN_LOCAL_SEL_MASK (3 << 1)
#define GSC_IN_PATH_MASK (1 << 0)
#define GSC_IN_PATH_MEMORY (0 << 0)
/* G-Scaler source image size */
#define GSC_SRCIMG_SIZE 0x14
#define GSC_SRCIMG_HEIGHT(x) ((x) << 16)
#define GSC_SRCIMG_WIDTH(x) ((x) << 0)
/* G-Scaler source image offset */
#define GSC_SRCIMG_OFFSET 0x18
#define GSC_SRCIMG_OFFSET_Y(x) ((x) << 16)
#define GSC_SRCIMG_OFFSET_X(x) ((x) << 0)
/* G-Scaler cropped source image size */
#define GSC_CROPPED_SIZE 0x1c
#define GSC_CROPPED_HEIGHT(x) ((x) << 16)
#define GSC_CROPPED_WIDTH(x) ((x) << 0)
/* G-Scaler output control */
#define GSC_OUT_CON 0x20
#define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24)
#define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24)
#define GSC_OUT_RGB_TYPE_MASK (3 << 10)
#define GSC_OUT_RGB_HD_NARROW (3 << 10)
#define GSC_OUT_RGB_HD_WIDE (2 << 10)
#define GSC_OUT_RGB_SD_NARROW (1 << 10)
#define GSC_OUT_RGB_SD_WIDE (0 << 10)
#define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9)
#define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9)
#define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9)
#define GSC_OUT_CHROMA_ORDER_MASK (1 << 8)
#define GSC_OUT_CHROMA_ORDER_CBCR (0 << 8)
#define GSC_OUT_CHROMA_ORDER_CRCB (1 << 8)
#define GSC_OUT_FORMAT_MASK (7 << 4)
#define GSC_OUT_XRGB8888 (0 << 4)
#define GSC_OUT_RGB565 (1 << 4)
#define GSC_OUT_YUV420_2P (2 << 4)
#define GSC_OUT_YUV420_3P (3 << 4)
#define GSC_OUT_YUV422_1P (4 << 4)
#define GSC_OUT_YUV422_2P (5 << 4)
#define GSC_OUT_YUV444 (7 << 4)
#define GSC_OUT_TILE_TYPE_MASK (1 << 2)
#define GSC_OUT_TILE_C_16x8 (0 << 2)
#define GSC_OUT_TILE_MODE (1 << 1)
#define GSC_OUT_PATH_MASK (1 << 0)
#define GSC_OUT_PATH_LOCAL (1 << 0)
#define GSC_OUT_PATH_MEMORY (0 << 0)
/* G-Scaler scaled destination image size */
#define GSC_SCALED_SIZE 0x24
#define GSC_SCALED_HEIGHT(x) ((x) << 16)
#define GSC_SCALED_WIDTH(x) ((x) << 0)
/* G-Scaler pre scale ratio */
#define GSC_PRE_SCALE_RATIO 0x28
#define GSC_PRESC_SHFACTOR(x) ((x) << 28)
#define GSC_PRESC_V_RATIO(x) ((x) << 16)
#define GSC_PRESC_H_RATIO(x) ((x) << 0)
/* G-Scaler main scale horizontal ratio */
#define GSC_MAIN_H_RATIO 0x2c
#define GSC_MAIN_H_RATIO_VALUE(x) ((x) << 0)
/* G-Scaler main scale vertical ratio */
#define GSC_MAIN_V_RATIO 0x30
#define GSC_MAIN_V_RATIO_VALUE(x) ((x) << 0)
/* G-Scaler destination image size */
#define GSC_DSTIMG_SIZE 0x40
#define GSC_DSTIMG_HEIGHT(x) ((x) << 16)
#define GSC_DSTIMG_WIDTH(x) ((x) << 0)
/* G-Scaler destination image offset */
#define GSC_DSTIMG_OFFSET 0x44
#define GSC_DSTIMG_OFFSET_Y(x) ((x) << 16)
#define GSC_DSTIMG_OFFSET_X(x) ((x) << 0)
/* G-Scaler input y address mask */
#define GSC_IN_BASE_ADDR_Y_MASK 0x4c
/* G-Scaler input y base address */
#define GSC_IN_BASE_ADDR_Y(n) (0x50 + (n) * 0x4)
/* G-Scaler input cb address mask */
#define GSC_IN_BASE_ADDR_CB_MASK 0x7c
/* G-Scaler input cb base address */
#define GSC_IN_BASE_ADDR_CB(n) (0x80 + (n) * 0x4)
/* G-Scaler input cr address mask */
#define GSC_IN_BASE_ADDR_CR_MASK 0xac
/* G-Scaler input cr base address */
#define GSC_IN_BASE_ADDR_CR(n) (0xb0 + (n) * 0x4)
/* G-Scaler output y address mask */
#define GSC_OUT_BASE_ADDR_Y_MASK 0x10c
/* G-Scaler output y base address */
#define GSC_OUT_BASE_ADDR_Y(n) (0x110 + (n) * 0x4)
/* G-Scaler output cb address mask */
#define GSC_OUT_BASE_ADDR_CB_MASK 0x15c
/* G-Scaler output cb base address */
#define GSC_OUT_BASE_ADDR_CB(n) (0x160 + (n) * 0x4)
/* G-Scaler output cr address mask */
#define GSC_OUT_BASE_ADDR_CR_MASK 0x1ac
/* G-Scaler output cr base address */
#define GSC_OUT_BASE_ADDR_CR(n) (0x1b0 + (n) * 0x4)
#endif /* REGS_GSC_H_ */
|
// Copyright 2013 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/sync_file_system/drive_backend/sync_task.h"
#include "google_apis/drive/gdata_errorcode.h"
namespace drive {
class DriveServiceInterface;
}
namespace google_apis {
class ChangeList;
class ChangeResource;
}
namespace sync_file_system {
namespace drive_backend {
class MetadataDatabase;
class SyncEngineContext;
class ListChangesTask : public SyncTask {
public:
explicit ListChangesTask(SyncEngineContext* sync_context);
virtual ~ListChangesTask();
virtual void RunPreflight(scoped_ptr<SyncTaskToken> token) OVERRIDE;
private:
void StartListing(scoped_ptr<SyncTaskToken> token);
void DidListChanges(scoped_ptr<SyncTaskToken> token,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::ChangeList> change_list);
void CheckInChangeList(int64 largest_change_id,
scoped_ptr<SyncTaskToken> token);
bool IsContextReady();
MetadataDatabase* metadata_database();
drive::DriveServiceInterface* drive_service();
SyncEngineContext* sync_context_;
ScopedVector<google_apis::ChangeResource> change_list_;
std::vector<std::string> file_ids_;
base::WeakPtrFactory<ListChangesTask> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ListChangesTask);
};
} // namespace drive_backend
} // namespace sync_file_system
#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_LIST_CHANGES_TASK_H_
|
/****************************************************************************
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2011 Zynga Inc.
CopyRight (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_ANIMATION_CACHE_H__
#define __CC_ANIMATION_CACHE_H__
#include "CCRef.h"
#include "CCMap.h"
#include "CCValue.h"
#include <string>
NS_CC_BEGIN
class Animation;
/**
* @addtogroup sprite_nodes
* @{
*/
/** Singleton that manages the Animations.
It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
Before v0.99.5, the recommend way was to save them on the Sprite. Since v0.99.5, you should use this class instead.
@since v0.99.5
*/
class CC_DLL AnimationCache : public Ref
{
public:
/**
* @js ctor
*/
AnimationCache();
/**
* @js NA
* @lua NA
*/
~AnimationCache();
/** Returns the shared instance of the Animation cache */
static AnimationCache* getInstance();
/** Purges the cache. It releases all the Animation objects and the shared instance.
*/
static void destroyInstance();
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static AnimationCache* sharedAnimationCache() { return AnimationCache::getInstance(); }
/** @deprecated Use destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache() { return AnimationCache::destroyInstance(); }
bool init(void);
/** Adds a Animation with a name.
*/
void addAnimation(Animation *animation, const std::string& name);
/** Deletes a Animation from the cache.
*/
void removeAnimation(const std::string& name);
/** @deprecated. Use removeAnimation() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE void removeAnimationByName(const std::string& name){ removeAnimation(name);}
/** Returns a Animation that was previously added.
If the name is not found it will return nil.
You should retain the returned copy if you are going to use it.
*/
Animation* getAnimation(const std::string& name);
/**
@deprecated. Use getAnimation() instead
* @js NA
* @lua NA
*/
CC_DEPRECATED_ATTRIBUTE Animation* animationByName(const std::string& name){ return getAnimation(name); }
/** Adds an animation from an NSDictionary
Make sure that the frames were previously loaded in the SpriteFrameCache.
@param plist The path of the relative file,it use to find the plist path for load SpriteFrames.
@since v1.1
*/
void addAnimationsWithDictionary(const ValueMap& dictionary,const std::string& plist);
/** Adds an animation from a plist file.
Make sure that the frames were previously loaded in the SpriteFrameCache.
@since v1.1
* @js addAnimations
* @lua addAnimations
*/
void addAnimationsWithFile(const std::string& plist);
private:
void parseVersion1(const ValueMap& animations);
void parseVersion2(const ValueMap& animations);
private:
Map<std::string, Animation*> _animations;
static AnimationCache* s_sharedAnimationCache;
};
// end of sprite_nodes group
/// @}
NS_CC_END
#endif // __CC_ANIMATION_CACHE_H__
|
/*
* This code was written by Rich Felker in 2010; no copyright is claimed.
* This code is in the public domain. Attribution is appreciated but
* unnecessary.
*/
#include <wchar.h>
size_t mbsnrtowcs(wchar_t *restrict wcs, const char **restrict src, size_t n, size_t wn, mbstate_t *restrict st)
{
size_t l, cnt=0, n2;
wchar_t *ws, wbuf[256];
const char *s = *src;
if (!wcs) ws = wbuf, wn = sizeof wbuf / sizeof *wbuf;
else ws = wcs;
/* making sure output buffer size is at most n/4 will ensure
* that mbsrtowcs never reads more than n input bytes. thus
* we can use mbsrtowcs as long as it's practical.. */
while ( s && wn && ( (n2=n/4)>=wn || n2>32 ) ) {
if (n2>=wn) n2=wn;
n -= n2;
l = mbsrtowcs(ws, &s, n2, st);
if (!(l+1)) {
cnt = l;
wn = 0;
break;
}
if (ws != wbuf) {
ws += l;
wn -= l;
}
cnt += l;
}
if (s) while (wn && n) {
l = mbrtowc(ws, s, n, st);
if (l+2<=2) {
if (!(l+1)) {
cnt = l;
break;
}
if (!l) {
s = 0;
break;
}
/* have to roll back partial character */
*(unsigned *)st = 0;
break;
}
s += l; n -= l;
/* safe - this loop runs fewer than sizeof(wbuf)/8 times */
ws++; wn--;
cnt++;
}
if (wcs) *src = s;
return cnt;
}
|
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/**************************************************************************
*
* Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
* Keith Packard.
*/
#define pr_fmt(fmt) "[TTM] " fmt
#include <drm/ttm/ttm_module.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h>
#include <drm/ttm/ttm_placement.h>
#include <linux/agp_backend.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <asm/agp.h>
struct ttm_agp_backend {
struct ttm_tt ttm;
struct agp_memory *mem;
struct agp_bridge_data *bridge;
};
int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_resource *bo_mem)
{
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
struct page *dummy_read_page = ttm_bo_glob.dummy_read_page;
struct drm_mm_node *node = bo_mem->mm_node;
struct agp_memory *mem;
int ret, cached = (bo_mem->placement & TTM_PL_FLAG_CACHED);
unsigned i;
if (agp_be->mem)
return 0;
mem = agp_allocate_memory(agp_be->bridge, ttm->num_pages, AGP_USER_MEMORY);
if (unlikely(mem == NULL))
return -ENOMEM;
mem->page_count = 0;
for (i = 0; i < ttm->num_pages; i++) {
struct page *page = ttm->pages[i];
if (!page)
page = dummy_read_page;
mem->pages[mem->page_count++] = page;
}
agp_be->mem = mem;
mem->is_flushed = 1;
mem->type = (cached) ? AGP_USER_CACHED_MEMORY : AGP_USER_MEMORY;
ret = agp_bind_memory(mem, node->start);
if (ret)
pr_err("AGP Bind memory failed\n");
return ret;
}
EXPORT_SYMBOL(ttm_agp_bind);
void ttm_agp_unbind(struct ttm_tt *ttm)
{
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
if (agp_be->mem) {
if (agp_be->mem->is_bound) {
agp_unbind_memory(agp_be->mem);
return;
}
agp_free_memory(agp_be->mem);
agp_be->mem = NULL;
}
}
EXPORT_SYMBOL(ttm_agp_unbind);
bool ttm_agp_is_bound(struct ttm_tt *ttm)
{
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
if (!ttm)
return false;
return (agp_be->mem != NULL);
}
EXPORT_SYMBOL(ttm_agp_is_bound);
void ttm_agp_destroy(struct ttm_tt *ttm)
{
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
if (agp_be->mem)
ttm_agp_unbind(ttm);
ttm_tt_fini(ttm);
kfree(agp_be);
}
EXPORT_SYMBOL(ttm_agp_destroy);
struct ttm_tt *ttm_agp_tt_create(struct ttm_buffer_object *bo,
struct agp_bridge_data *bridge,
uint32_t page_flags)
{
struct ttm_agp_backend *agp_be;
agp_be = kmalloc(sizeof(*agp_be), GFP_KERNEL);
if (!agp_be)
return NULL;
agp_be->mem = NULL;
agp_be->bridge = bridge;
if (ttm_tt_init(&agp_be->ttm, bo, page_flags)) {
kfree(agp_be);
return NULL;
}
return &agp_be->ttm;
}
EXPORT_SYMBOL(ttm_agp_tt_create);
|
/*
* arch/arm/mach-msm/lge/lge_block_monitor.c
*
* Copyright (C) 2012 LGE, Inc
*
* 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.
*/
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <asm/current.h>
#include <mach/lge/lge_blocking_monitor.h>
#define MAX_BLOCKING_MONITOR_NUMBER 4
struct blocking_monitor {
int id;
const char *name;
struct timer_list timer;
struct task_struct *task;
};
static struct blocking_monitor *bl_monitor[MAX_BLOCKING_MONITOR_NUMBER];
static void dump_blocking_callstack(unsigned long nr)
{
struct blocking_monitor *bl_monitor = (struct blocking_monitor *)nr;
pr_err("Start blocking callstack dump\n");
pr_err("Blocking callstack name is %s\n", bl_monitor->name);
show_stack(bl_monitor->task, NULL);
pr_err("End blocking callstack dump\n");
}
int start_monitor_blocking(int id, unsigned long expires)
{
if (id < 0 || MAX_BLOCKING_MONITOR_NUMBER <= id)
return -EINVAL;
if (bl_monitor[id] == 0)
return -EINVAL;
bl_monitor[id]->timer.expires = expires;
bl_monitor[id]->task = (struct task_struct *)current;
bl_monitor[id]->timer.data = (unsigned long)bl_monitor[id];
add_timer(&bl_monitor[id]->timer);
return 0;
}
int end_monitor_blocking(int id)
{
if (id < 0 || MAX_BLOCKING_MONITOR_NUMBER <= id)
return -EINVAL;
if (bl_monitor[id] == 0)
return -EINVAL;
del_timer(&bl_monitor[id]->timer);
return 0;
}
int create_blocking_monitor(const char *name)
{
int i;
for (i = 0; i < MAX_BLOCKING_MONITOR_NUMBER; ++i) {
if (bl_monitor[i] == 0)
break;
}
if (i == MAX_BLOCKING_MONITOR_NUMBER)
return -EINVAL;
bl_monitor[i] = kmalloc(sizeof(struct blocking_monitor), GFP_KERNEL);
bl_monitor[i]->id = i;
bl_monitor[i]->name = name;
bl_monitor[i]->timer.function = dump_blocking_callstack;
init_timer(&bl_monitor[i]->timer);
return bl_monitor[i]->id;
}
int remove_blocking_monitor(int id)
{
if (id < 0 || MAX_BLOCKING_MONITOR_NUMBER <= id)
return -EINVAL;
if (bl_monitor[id] == 0)
return -EINVAL;
del_timer(&bl_monitor[id]->timer);
kfree(bl_monitor[id]);
bl_monitor[id] = 0;
return 0;
}
|
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <functional>
#include <string>
#include "Common/Analytics.h"
namespace Common
{
void AndroidSetReportHandler(std::function<void(std::string, std::string)> function);
class AndroidAnalyticsBackend : public AnalyticsReportingBackend
{
public:
explicit AndroidAnalyticsBackend(const std::string endpoint);
~AndroidAnalyticsBackend() override;
void Send(std::string report) override;
private:
std::string m_endpoint;
};
} // namespace Common
|
// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/filter.h>
#include <linux/seccomp.h>
#include <sys/prctl.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include <sys/resource.h>
#include "trace_helpers.h"
#ifdef __mips__
#define MAX_ENTRIES 6000 /* MIPS n64 syscalls start at 5000 */
#else
#define MAX_ENTRIES 1024
#endif
/* install fake seccomp program to enable seccomp code path inside the kernel,
* so that our kprobe attached to seccomp_phase1() can be triggered
*/
static void install_accept_all_seccomp(void)
{
struct sock_filter filter[] = {
BPF_STMT(BPF_RET+BPF_K, SECCOMP_RET_ALLOW),
};
struct sock_fprog prog = {
.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
.filter = filter,
};
if (prctl(PR_SET_SECCOMP, 2, &prog))
perror("prctl");
}
int main(int ac, char **argv)
{
struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
struct bpf_link *link = NULL;
struct bpf_program *prog;
struct bpf_object *obj;
int key, fd, progs_fd;
const char *section;
char filename[256];
FILE *f;
setrlimit(RLIMIT_MEMLOCK, &r);
snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
obj = bpf_object__open_file(filename, NULL);
if (libbpf_get_error(obj)) {
fprintf(stderr, "ERROR: opening BPF object file failed\n");
return 0;
}
prog = bpf_object__find_program_by_name(obj, "bpf_prog1");
if (!prog) {
printf("finding a prog in obj file failed\n");
goto cleanup;
}
/* load BPF program */
if (bpf_object__load(obj)) {
fprintf(stderr, "ERROR: loading BPF object file failed\n");
goto cleanup;
}
link = bpf_program__attach(prog);
if (libbpf_get_error(link)) {
fprintf(stderr, "ERROR: bpf_program__attach failed\n");
link = NULL;
goto cleanup;
}
progs_fd = bpf_object__find_map_fd_by_name(obj, "progs");
if (progs_fd < 0) {
fprintf(stderr, "ERROR: finding a map in obj file failed\n");
goto cleanup;
}
bpf_object__for_each_program(prog, obj) {
section = bpf_program__section_name(prog);
/* register only syscalls to PROG_ARRAY */
if (sscanf(section, "kprobe/%d", &key) != 1)
continue;
fd = bpf_program__fd(prog);
bpf_map_update_elem(progs_fd, &key, &fd, BPF_ANY);
}
install_accept_all_seccomp();
f = popen("dd if=/dev/zero of=/dev/null count=5", "r");
(void) f;
read_trace_pipe();
cleanup:
bpf_link__destroy(link);
bpf_object__close(obj);
return 0;
}
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2008-2016. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
/*
* Module: safe_string.h
*
* This is an interface to a bunch of generic string operation
* that are safe regarding buffer overflow.
*
* All string functions terminate the process with an error message
* on buffer overflow.
*/
#include <stdio.h>
#include <stdarg.h>
/* Like vsnprintf()
*/
int vsn_printf(char* dst, size_t size, const char* format, va_list args);
/* Like snprintf()
*/
int sn_printf(char* dst, size_t size, const char* format, ...);
/* Like strncpy()
* Returns length of copied string.
*/
int strn_cpy(char* dst, size_t size, const char* src);
/* Almost like strncat()
* size is sizeof entire dst buffer.
* Returns length of resulting string.
*/
int strn_cat(char* dst, size_t size, const char* src);
/* Combination of strncat() and snprintf()
* size is sizeof entire dst buffer.
* Returns length of resulting string.
*/
int strn_catf(char* dst, size_t size, const char* format, ...);
/* Simular to strstr() but search size bytes of haystack
* without regard to '\0' characters.
*/
char* find_str(const char* haystack, int size, const char* needle);
#ifndef HAVE_MEMMOVE
void* memmove(void *dest, const void *src, size_t n);
#endif
|
/*
* Compute the Adler-32 checksum of a data stream.
* This is a modified version based on adler32.c from the zlib library.
*
* Copyright (C) 1995 Mark Adler
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "config.h"
#include "adler32.h"
#define BASE 65521L /* largest prime smaller than 65536 */
#define DO1(buf) { s1 += *buf++; s2 += s1; }
#define DO4(buf) DO1(buf); DO1(buf); DO1(buf); DO1(buf);
#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
unsigned int len)
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = adler >> 16;
while (len > 0) {
#if CONFIG_SMALL
while (len > 4 && s2 < (1U << 31)) {
DO4(buf);
len -= 4;
}
#else
while (len > 16 && s2 < (1U << 31)) {
DO16(buf);
len -= 16;
}
#endif
DO1(buf); len--;
s1 %= BASE;
s2 %= BASE;
}
return (s2 << 16) | s1;
}
#ifdef TEST
// LCOV_EXCL_START
#include <string.h>
#include "log.h"
#include "timer.h"
#define LEN 7001
static volatile int checksum;
int main(int argc, char **argv)
{
int i;
char data[LEN];
av_log_set_level(AV_LOG_DEBUG);
for (i = 0; i < LEN; i++)
data[i] = ((i * i) >> 3) + 123 * i;
if (argc > 1 && !strcmp(argv[1], "-t")) {
for (i = 0; i < 1000; i++) {
START_TIMER;
checksum = av_adler32_update(1, data, LEN);
STOP_TIMER("adler");
}
} else {
checksum = av_adler32_update(1, data, LEN);
}
av_log(NULL, AV_LOG_DEBUG, "%X (expected 50E6E508)\n", checksum);
return checksum == 0x50e6e508 ? 0 : 1;
}
// LCOV_EXCL_STOP
#endif
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2013 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import "TiBase.h"
#import "TiUIViewProxy.h"
#ifdef USE_TI_UIIOSADVIEW
@interface TiUIiOSAdViewProxy : TiUIViewProxy {
}
// Need these for sanity checking and constants, so they
// must be class-available rather than instance-available
+(NSString*)portraitSize;
+(NSString*)landscapeSize;
#pragma mark internal
-(void)fireLoad:(id)unused;
@end
#endif
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_FACTORY_H_
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
namespace extensions {
class ExtensionPrefs;
class ExtensionPrefsFactory : public BrowserContextKeyedServiceFactory {
public:
static ExtensionPrefs* GetForProfile(Profile* profile);
static ExtensionPrefsFactory* GetInstance();
void SetInstanceForTesting(
content::BrowserContext* context, ExtensionPrefs* prefs);
private:
friend struct DefaultSingletonTraits<ExtensionPrefsFactory>;
ExtensionPrefsFactory();
virtual ~ExtensionPrefsFactory();
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
content::BrowserContext* profile) const OVERRIDE;
virtual content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const OVERRIDE;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_FACTORY_H_
|
/*
* libjingle
* Copyright 2004--2005, Google Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 TALK_P2P_CLIENT_SESSIONSENDTASK_H_
#define TALK_P2P_CLIENT_SESSIONSENDTASK_H_
#include "talk/base/common.h"
#include "talk/xmpp/constants.h"
#include "talk/xmpp/xmppclient.h"
#include "talk/xmpp/xmppengine.h"
#include "talk/xmpp/xmpptask.h"
#include "talk/p2p/base/sessionmanager.h"
namespace cricket {
// The job of this task is to send an IQ stanza out (after stamping it with
// an ID attribute) and then wait for a response. If not response happens
// within 5 seconds, it will signal failure on a SessionManager. If an error
// happens it will also signal failure. If, however, the send succeeds this
// task will quietly go away.
class SessionSendTask : public buzz::XmppTask {
public:
SessionSendTask(buzz::XmppTaskParentInterface* parent,
SessionManager* session_manager)
: buzz::XmppTask(parent, buzz::XmppEngine::HL_SINGLE),
session_manager_(session_manager) {
set_timeout_seconds(15);
session_manager_->SignalDestroyed.connect(
this, &SessionSendTask::OnSessionManagerDestroyed);
}
virtual ~SessionSendTask() {
SignalDone(this);
}
void Send(const buzz::XmlElement* stanza) {
ASSERT(stanza_.get() == NULL);
// This should be an IQ of type set, result, or error. In the first case,
// we supply an ID. In the others, it should be present.
ASSERT(stanza->Name() == buzz::QN_IQ);
ASSERT(stanza->HasAttr(buzz::QN_TYPE));
if (stanza->Attr(buzz::QN_TYPE) == "set") {
ASSERT(!stanza->HasAttr(buzz::QN_ID));
} else {
ASSERT((stanza->Attr(buzz::QN_TYPE) == "result") ||
(stanza->Attr(buzz::QN_TYPE) == "error"));
ASSERT(stanza->HasAttr(buzz::QN_ID));
}
stanza_.reset(new buzz::XmlElement(*stanza));
if (stanza_->HasAttr(buzz::QN_ID)) {
set_task_id(stanza_->Attr(buzz::QN_ID));
} else {
stanza_->SetAttr(buzz::QN_ID, task_id());
}
}
void OnSessionManagerDestroyed() {
// If the session manager doesn't exist anymore, we should still try to
// send the message, but avoid calling back into the SessionManager.
session_manager_ = NULL;
}
sigslot::signal1<SessionSendTask *> SignalDone;
protected:
virtual int OnTimeout() {
if (session_manager_ != NULL) {
session_manager_->OnFailedSend(stanza_.get(), NULL);
}
return XmppTask::OnTimeout();
}
virtual int ProcessStart() {
SendStanza(stanza_.get());
if (stanza_->Attr(buzz::QN_TYPE) == buzz::STR_SET) {
return STATE_RESPONSE;
} else {
return STATE_DONE;
}
}
virtual int ProcessResponse() {
const buzz::XmlElement* next = NextStanza();
if (next == NULL)
return STATE_BLOCKED;
if (session_manager_ != NULL) {
if (next->Attr(buzz::QN_TYPE) == buzz::STR_RESULT) {
session_manager_->OnIncomingResponse(stanza_.get(), next);
} else {
session_manager_->OnFailedSend(stanza_.get(), next);
}
}
return STATE_DONE;
}
virtual bool HandleStanza(const buzz::XmlElement *stanza) {
if (!MatchResponseIq(stanza,
buzz::Jid(stanza_->Attr(buzz::QN_TO)), task_id()))
return false;
if (stanza->Attr(buzz::QN_TYPE) == buzz::STR_RESULT ||
stanza->Attr(buzz::QN_TYPE) == buzz::STR_ERROR) {
QueueStanza(stanza);
return true;
}
return false;
}
private:
SessionManager *session_manager_;
talk_base::scoped_ptr<buzz::XmlElement> stanza_;
};
}
#endif // TALK_P2P_CLIENT_SESSIONSENDTASK_H_
|
// RUN: touch %t.o
//
// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
// RUN: -Wl,-plugin-opt=foo -O3 \
// RUN: -ffunction-sections -fdata-sections \
// RUN: | FileCheck %s
// CHECK: "-plugin-opt=-function-sections"
// CHECK: "-plugin-opt=-data-sections"
|
/*
* Copyright (C) 2011 Google, Inc.
*
* 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 __LINUX_PERSISTENT_RAM_H__
#define __LINUX_PERSISTENT_RAM_H__
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/types.h>
struct persistent_ram_buffer;
struct persistent_ram_descriptor {
const char *name;
phys_addr_t size;
};
struct persistent_ram {
phys_addr_t start;
phys_addr_t size;
int ecc_block_size;
int ecc_size;
int ecc_symsize;
int ecc_poly;
int num_descs;
struct persistent_ram_descriptor *descs;
struct list_head node;
};
struct persistent_ram_zone {
struct list_head node;
void *vaddr;
struct persistent_ram_buffer *buffer;
size_t buffer_size;
/* ECC correction */
bool ecc;
char *par_buffer;
char *par_header;
struct rs_control *rs_decoder;
int corrected_bytes;
int bad_blocks;
int ecc_block_size;
int ecc_size;
int ecc_symsize;
int ecc_poly;
char *old_log;
size_t old_log_size;
size_t old_log_footer_size;
bool early;
};
int persistent_ram_early_init(struct persistent_ram *ram);
struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
bool ecc);
int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
unsigned int count);
size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
void *persistent_ram_old(struct persistent_ram_zone *prz);
void persistent_ram_free_old(struct persistent_ram_zone *prz);
ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
char *str, size_t len);
#endif
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_LIST_BOX_H_INCLUDED__
#define __C_GUI_LIST_BOX_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIListBox.h"
#include "irrArray.h"
namespace irr
{
namespace gui
{
class IGUIFont;
class IGUIScrollBar;
class CGUIListBox : public IGUIListBox
{
public:
//! constructor
CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle, bool clip=true,
bool drawBack=false, bool moveOverSelect=false);
//! destructor
virtual ~CGUIListBox();
//! returns amount of list items
virtual u32 getItemCount() const;
//! returns string of a list item. the id may be a value from 0 to itemCount-1
virtual const wchar_t* getListItem(u32 id) const;
//! adds an list item, returns id of item
virtual u32 addItem(const wchar_t* text);
//! clears the list
virtual void clear();
//! returns id of selected item. returns -1 if no item is selected.
virtual s32 getSelected() const;
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(s32 id);
//! sets the selected item. Set this to -1 if no item should be selected
virtual void setSelected(const wchar_t *item);
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);
//! draws the element and its children
virtual void draw();
//! adds an list item with an icon
//! \param text Text of list entry
//! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
//! \return
//! returns the id of the new created item
virtual u32 addItem(const wchar_t* text, s32 icon);
//! Returns the icon of an item
virtual s32 getIcon(u32 id) const;
//! removes an item from the list
virtual void removeItem(u32 id);
//! get the the id of the item at the given absolute coordinates
virtual s32 getItemAt(s32 xpos, s32 ypos) const;
//! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
//! the built-in-font by default. A sprite can be displayed in front of every list item.
//! An icon is an index within the icon sprite bank. Several default icons are available in the
//! skin through getIcon
virtual void setSpriteBank(IGUISpriteBank* bank);
//! set whether the listbox should scroll to newly selected items
virtual void setAutoScrollEnabled(bool scroll);
//! returns true if automatic scrolling is enabled, false if not.
virtual bool isAutoScrollEnabled() const;
//! Update the position and size of the listbox, and update the scrollbar
virtual void updateAbsolutePosition();
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
//! set all item colors at given index to color
virtual void setItemOverrideColor(u32 index, video::SColor color);
//! set all item colors of specified type at given index to color
virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color);
//! clear all item colors at index
virtual void clearItemOverrideColor(u32 index);
//! clear item color at index for given colortype
virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType);
//! has the item at index its color overwritten?
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the overwrite color at given item index.
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
//! return the default color which is used for the given colorType
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const;
//! set the item at the given index
virtual void setItem(u32 index, const wchar_t* text, s32 icon);
//! Insert the item at the given index
//! Return the index on success or -1 on failure.
virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon);
//! Swap the items at the given indices
virtual void swapItems(u32 index1, u32 index2);
//! set global itemHeight
virtual void setItemHeight( s32 height );
//! Sets whether to draw the background
virtual void setDrawBackground(bool draw);
private:
struct ListItem
{
ListItem() : icon(-1)
{}
core::stringw text;
s32 icon;
// A multicolor extension
struct ListItemOverrideColor
{
ListItemOverrideColor() : Use(false) {}
bool Use;
video::SColor Color;
};
ListItemOverrideColor OverrideColors[EGUI_LBC_COUNT];
};
void recalculateItemHeight();
void selectNew(s32 ypos, bool onlyHover=false);
void recalculateScrollPos();
// extracted that function to avoid copy&paste code
void recalculateItemWidth(s32 icon);
// get labels used for serialization
bool getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::stringc & useColorLabel, core::stringc & colorLabel) const;
core::array< ListItem > Items;
s32 Selected;
s32 ItemHeight;
s32 ItemHeightOverride;
s32 TotalItemHeight;
s32 ItemsIconWidth;
gui::IGUIFont* Font;
gui::IGUISpriteBank* IconBank;
gui::IGUIScrollBar* ScrollBar;
u32 selectTime;
u32 LastKeyTime;
core::stringw KeyBuffer;
bool Selecting;
bool DrawBack;
bool MoveOverSelect;
bool AutoScroll;
bool HighlightWhenNotFocused;
};
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif
|
/*
* public header file of the frontend drivers for mobile DVB-T demodulators
* DiBcom 3000M-B and DiBcom 3000P/M-C (http://www.dibcom.fr/)
*
* Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
*
* based on GPL code from DibCom, which has
*
* Copyright (C) 2004 Amaury Demol for DiBcom (ademol@dibcom.fr)
*
* 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.
*
* Acknowledgements
*
* Amaury Demol (ademol@dibcom.fr) from DiBcom for providing specs and driver
* sources, on which this driver (and the dvb-dibusb) are based.
*
* see Documentation/dvb/README.dvb-usb for more information
*
*/
#ifndef DIB3000_H
#define DIB3000_H
#include <linux/dvb/frontend.h>
struct dib3000_config
{
/* the demodulator's i2c address */
u8 demod_address;
};
struct dib_fe_xfer_ops
{
/* pid and transfer handling is done in the demodulator */
int (*pid_parse)(struct dvb_frontend *fe, int onoff);
int (*fifo_ctrl)(struct dvb_frontend *fe, int onoff);
int (*pid_ctrl)(struct dvb_frontend *fe, int index, int pid, int onoff);
int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl);
};
#if IS_ENABLED(CPTCFG_DVB_DIB3000MB)
extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops);
#else
static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
{
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL;
}
#endif // CPTCFG_DVB_DIB3000MB
#endif // DIB3000_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 REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_
#define REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_
#include "base/callback.h"
#include "ppapi/cpp/audio.h"
#include "ppapi/cpp/instance.h"
#include "remoting/client/audio_player.h"
#include "remoting/proto/audio.pb.h"
namespace remoting {
class PepperAudioPlayer : public AudioPlayer {
public:
explicit PepperAudioPlayer(pp::Instance* instance);
~PepperAudioPlayer() override;
uint32 GetSamplesPerFrame() override;
bool ResetAudioPlayer(AudioPacket::SamplingRate sampling_rate) override;
private:
pp::Instance* instance_;
pp::Audio audio_;
// The count of sample frames per channel in an audio buffer.
uint32 samples_per_frame_;
DISALLOW_COPY_AND_ASSIGN(PepperAudioPlayer);
};
} // namespace remoting
#endif // REMOTING_CLIENT_PLUGIN_PEPPER_AUDIO_PLAYER_H_
|
/* Copyright (c) 2009, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of The Linux Foundation 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, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <reg.h>
#define EBI1_SIZE1 0x0CB00000 //203MB for 256 RAM
#define EBI1_ADDR1 0x00200000
unsigned* target_atag_mem(unsigned* ptr)
{
/* ATAG_MEM */
*ptr++ = 4;
*ptr++ = 0x54410002;
*ptr++ = EBI1_SIZE1;
*ptr++ = EBI1_ADDR1;
return ptr;
}
|
/* arch/arm/mach-s5p6450/include/mach/vmalloc.h
*
* Copyright 2010 Ben Dooks <ben-linux@fluff.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.
*
* S3C6400 vmalloc definition
*/
#ifndef __ASM_ARCH_VMALLOC_H
#define __ASM_ARCH_VMALLOC_H
#define VMALLOC_END (0xE0000000)
#endif /* __ASM_ARCH_VMALLOC_H */
|
/*
* driver/dma/coh901318_lli.c
*
* Copyright (C) 2007-2009 ST-Ericsson
* License terms: GNU General Public License (GPL) version 2
* Support functions for handling lli for dma
* Author: Per Friden <per.friden@stericsson.com>
*/
#include <linux/spinlock.h>
#include <linux/memory.h>
#include <linux/gfp.h>
#include <linux/dmapool.h>
#include <mach/coh901318.h>
#include "coh901318_lli.h"
#if (defined(CONFIG_DEBUG_FS) && defined(CONFIG_U300_DEBUG))
#define DEBUGFS_POOL_COUNTER_RESET(pool) (pool->debugfs_pool_counter = 0)
#define DEBUGFS_POOL_COUNTER_ADD(pool, add) (pool->debugfs_pool_counter += add)
#else
#define DEBUGFS_POOL_COUNTER_RESET(pool)
#define DEBUGFS_POOL_COUNTER_ADD(pool, add)
#endif
static struct coh901318_lli *
coh901318_lli_next(struct coh901318_lli *data)
{
if (data == NULL || data->link_addr == 0)
return NULL;
return (struct coh901318_lli *) data->virt_link_addr;
}
int coh901318_pool_create(struct coh901318_pool *pool,
struct device *dev,
size_t size, size_t align)
{
spin_lock_init(&pool->lock);
pool->dev = dev;
pool->dmapool = dma_pool_create("lli_pool", dev, size, align, 0);
DEBUGFS_POOL_COUNTER_RESET(pool);
return 0;
}
int coh901318_pool_destroy(struct coh901318_pool *pool)
{
dma_pool_destroy(pool->dmapool);
return 0;
}
struct coh901318_lli *
coh901318_lli_alloc(struct coh901318_pool *pool, unsigned int len)
{
int i;
struct coh901318_lli *head;
struct coh901318_lli *lli;
struct coh901318_lli *lli_prev;
dma_addr_t phy;
if (len == 0)
goto err;
spin_lock(&pool->lock);
head = dma_pool_alloc(pool->dmapool, GFP_NOWAIT, &phy);
if (head == NULL)
goto err;
DEBUGFS_POOL_COUNTER_ADD(pool, 1);
lli = head;
lli->phy_this = phy;
lli->link_addr = 0x00000000;
lli->virt_link_addr = 0x00000000U;
for (i = 1; i < len; i++) {
lli_prev = lli;
lli = dma_pool_alloc(pool->dmapool, GFP_NOWAIT, &phy);
if (lli == NULL)
goto err_clean_up;
DEBUGFS_POOL_COUNTER_ADD(pool, 1);
lli->phy_this = phy;
lli->link_addr = 0x00000000;
lli->virt_link_addr = 0x00000000U;
lli_prev->link_addr = phy;
lli_prev->virt_link_addr = lli;
}
spin_unlock(&pool->lock);
return head;
err:
spin_unlock(&pool->lock);
return NULL;
err_clean_up:
lli_prev->link_addr = 0x00000000U;
spin_unlock(&pool->lock);
coh901318_lli_free(pool, &head);
return NULL;
}
void coh901318_lli_free(struct coh901318_pool *pool,
struct coh901318_lli **lli)
{
struct coh901318_lli *l;
struct coh901318_lli *next;
if (lli == NULL)
return;
l = *lli;
if (l == NULL)
return;
spin_lock(&pool->lock);
while (l->link_addr) {
next = l->virt_link_addr;
dma_pool_free(pool->dmapool, l, l->phy_this);
DEBUGFS_POOL_COUNTER_ADD(pool, -1);
l = next;
}
dma_pool_free(pool->dmapool, l, l->phy_this);
DEBUGFS_POOL_COUNTER_ADD(pool, -1);
spin_unlock(&pool->lock);
*lli = NULL;
}
int
coh901318_lli_fill_memcpy(struct coh901318_pool *pool,
struct coh901318_lli *lli,
dma_addr_t source, unsigned int size,
dma_addr_t destination, u32 ctrl_chained,
u32 ctrl_eom)
{
int s = size;
dma_addr_t src = source;
dma_addr_t dst = destination;
lli->src_addr = src;
lli->dst_addr = dst;
while (lli->link_addr) {
lli->control = ctrl_chained | MAX_DMA_PACKET_SIZE;
lli->src_addr = src;
lli->dst_addr = dst;
s -= MAX_DMA_PACKET_SIZE;
lli = coh901318_lli_next(lli);
src += MAX_DMA_PACKET_SIZE;
dst += MAX_DMA_PACKET_SIZE;
}
lli->control = ctrl_eom | s;
lli->src_addr = src;
lli->dst_addr = dst;
return 0;
}
int
coh901318_lli_fill_single(struct coh901318_pool *pool,
struct coh901318_lli *lli,
dma_addr_t buf, unsigned int size,
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl_eom,
enum dma_transfer_direction dir)
{
int s = size;
dma_addr_t src;
dma_addr_t dst;
if (dir == DMA_MEM_TO_DEV) {
src = buf;
dst = dev_addr;
} else if (dir == DMA_DEV_TO_MEM) {
src = dev_addr;
dst = buf;
} else {
return -EINVAL;
}
while (lli->link_addr) {
size_t block_size = MAX_DMA_PACKET_SIZE;
lli->control = ctrl_chained | MAX_DMA_PACKET_SIZE;
if (s < (MAX_DMA_PACKET_SIZE + MAX_DMA_PACKET_SIZE/2))
block_size = MAX_DMA_PACKET_SIZE/2;
s -= block_size;
lli->src_addr = src;
lli->dst_addr = dst;
lli = coh901318_lli_next(lli);
if (dir == DMA_MEM_TO_DEV)
src += block_size;
else if (dir == DMA_DEV_TO_MEM)
dst += block_size;
}
lli->control = ctrl_eom | s;
lli->src_addr = src;
lli->dst_addr = dst;
return 0;
}
int
coh901318_lli_fill_sg(struct coh901318_pool *pool,
struct coh901318_lli *lli,
struct scatterlist *sgl, unsigned int nents,
dma_addr_t dev_addr, u32 ctrl_chained, u32 ctrl,
u32 ctrl_last,
enum dma_transfer_direction dir, u32 ctrl_irq_mask)
{
int i;
struct scatterlist *sg;
u32 ctrl_sg;
dma_addr_t src = 0;
dma_addr_t dst = 0;
u32 bytes_to_transfer;
u32 elem_size;
if (lli == NULL)
goto err;
spin_lock(&pool->lock);
if (dir == DMA_MEM_TO_DEV)
dst = dev_addr;
else if (dir == DMA_DEV_TO_MEM)
src = dev_addr;
else
goto err;
for_each_sg(sgl, sg, nents, i) {
if (sg_is_chain(sg)) {
ctrl_sg = ctrl_chained;
} else if (i == nents - 1)
ctrl_sg = ctrl_last;
else
ctrl_sg = ctrl ? ctrl : ctrl_last;
if (dir == DMA_MEM_TO_DEV)
src = sg_phys(sg);
else
dst = sg_phys(sg);
bytes_to_transfer = sg_dma_len(sg);
while (bytes_to_transfer) {
u32 val;
if (bytes_to_transfer > MAX_DMA_PACKET_SIZE) {
elem_size = MAX_DMA_PACKET_SIZE;
val = ctrl_chained;
} else {
elem_size = bytes_to_transfer;
val = ctrl_sg;
}
lli->control = val | elem_size;
lli->src_addr = src;
lli->dst_addr = dst;
if (dir == DMA_DEV_TO_MEM)
dst += elem_size;
else
src += elem_size;
BUG_ON(lli->link_addr & 3);
bytes_to_transfer -= elem_size;
lli = coh901318_lli_next(lli);
}
}
spin_unlock(&pool->lock);
return 0;
err:
spin_unlock(&pool->lock);
return -EINVAL;
}
|
#ifndef __ARCH_PARISC_IOCTLS_H__
#define __ARCH_PARISC_IOCTLS_H__
#include <asm/ioctl.h>
#define TCGETS _IOR('T', 16, struct termios)
#define TCSETS _IOW('T', 17, struct termios)
#define TCSETSW _IOW('T', 18, struct termios)
#define TCSETSF _IOW('T', 19, struct termios)
#define TCGETA _IOR('T', 1, struct termio)
#define TCSETA _IOW('T', 2, struct termio)
#define TCSETAW _IOW('T', 3, struct termio)
#define TCSETAF _IOW('T', 4, struct termio)
#define TCSBRK _IO('T', 5)
#define TCXONC _IO('T', 6)
#define TCFLSH _IO('T', 7)
#define TIOCEXCL 0x540C
#define TIOCNXCL 0x540D
#define TIOCSCTTY 0x540E
#define TIOCGPGRP _IOR('T', 30, int)
#define TIOCSPGRP _IOW('T', 29, int)
#define TIOCOUTQ 0x5411
#define TIOCSTI 0x5412
#define TIOCGWINSZ 0x5413
#define TIOCSWINSZ 0x5414
#define TIOCMGET 0x5415
#define TIOCMBIS 0x5416
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
#define TIOCGSOFTCAR 0x5419
#define TIOCSSOFTCAR 0x541A
#define FIONREAD 0x541B
#define TIOCINQ FIONREAD
#define TIOCLINUX 0x541C
#define TIOCCONS 0x541D
#define TIOCGSERIAL 0x541E
#define TIOCSSERIAL 0x541F
#define TIOCPKT 0x5420
#define FIONBIO 0x5421
#define TIOCNOTTY 0x5422
#define TIOCSETD 0x5423
#define TIOCGETD 0x5424
#define TCSBRKP 0x5425
#define TIOCSBRK 0x5427
#define TIOCCBRK 0x5428
#define TIOCGSID _IOR('T', 20, int)
#define TCGETS2 _IOR('T',0x2A, struct termios2)
#define TCSETS2 _IOW('T',0x2B, struct termios2)
#define TCSETSW2 _IOW('T',0x2C, struct termios2)
#define TCSETSF2 _IOW('T',0x2D, struct termios2)
#define TIOCGPTN _IOR('T',0x30, unsigned int)
#define TIOCSPTLCK _IOW('T',0x31, int)
#define TIOCGDEV _IOR('T',0x32, int)
#define TIOCSIG _IOW('T',0x36, int)
#define TIOCVHANGUP 0x5437
#define FIONCLEX 0x5450
#define FIOCLEX 0x5451
#define FIOASYNC 0x5452
#define TIOCSERCONFIG 0x5453
#define TIOCSERGWILD 0x5454
#define TIOCSERSWILD 0x5455
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT 0x5458
#define TIOCSERGETLSR 0x5459
#define TIOCSERGETMULTI 0x545A
#define TIOCSERSETMULTI 0x545B
#define TIOCMIWAIT 0x545C
#define TIOCGICOUNT 0x545D
#define FIOQSIZE 0x5460
#define TIOCSTART 0x5461
#define TIOCSTOP 0x5462
#define TIOCSLTC 0x5462
#define TIOCPKT_DATA 0
#define TIOCPKT_FLUSHREAD 1
#define TIOCPKT_FLUSHWRITE 2
#define TIOCPKT_STOP 4
#define TIOCPKT_START 8
#define TIOCPKT_NOSTOP 16
#define TIOCPKT_DOSTOP 32
#define TIOCPKT_IOCTL 64
#define TIOCSER_TEMT 0x01
#endif
|
/* RxRPC key type
*
* 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 License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _KEYS_RXRPC_TYPE_H
#define _KEYS_RXRPC_TYPE_H
#include <linux/key.h>
extern struct key_type key_type_rxrpc;
extern struct key *rxrpc_get_null_key(const char *);
struct rxkad_key {
u32 vice_id;
u32 start;
u32 expiry;
u32 kvno;
u8 primary_flag;
u16 ticket_len;
u8 session_key[8];
u8 ticket[0];
};
struct krb5_principal {
u8 n_name_parts;
char **name_parts;
char *realm;
};
struct krb5_tagged_data {
s32 tag;
u32 data_len;
u8 *data;
};
struct rxk5_key {
u64 authtime;
u64 starttime;
u64 endtime;
u64 renew_till;
s32 is_skey;
s32 flags;
struct krb5_principal client;
struct krb5_principal server;
u16 ticket_len;
u16 ticket2_len;
u8 n_authdata;
u8 n_addresses;
struct krb5_tagged_data session;
struct krb5_tagged_data *addresses;
u8 *ticket;
u8 *ticket2;
struct krb5_tagged_data *authdata;
};
struct rxrpc_key_token {
u16 security_index;
struct rxrpc_key_token *next;
union {
struct rxkad_key *kad;
struct rxk5_key *k5;
};
};
struct rxrpc_key_data_v1 {
u16 security_index;
u16 ticket_length;
u32 expiry;
u32 kvno;
u8 session_key[8];
u8 ticket[0];
};
#define AFSTOKEN_LENGTH_MAX 16384
#define AFSTOKEN_STRING_MAX 256
#define AFSTOKEN_DATA_MAX 64
#define AFSTOKEN_CELL_MAX 64
#define AFSTOKEN_MAX 8
#define AFSTOKEN_BDATALN_MAX 16384
#define AFSTOKEN_RK_TIX_MAX 12000
#define AFSTOKEN_GK_KEY_MAX 64
#define AFSTOKEN_GK_TOKEN_MAX 16384
#define AFSTOKEN_K5_COMPONENTS_MAX 16
#define AFSTOKEN_K5_NAME_MAX 128
#define AFSTOKEN_K5_REALM_MAX 64
#define AFSTOKEN_K5_TIX_MAX 16384
#define AFSTOKEN_K5_ADDRESSES_MAX 16
#define AFSTOKEN_K5_AUTHDATA_MAX 16
#endif
|
#ifndef __ASM_SH64_IOCTLS_H
#define __ASM_SH64_IOCTLS_H
/*
* 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.
*
* include/asm-sh64/ioctls.h
*
* Copyright (C) 2000, 2001 Paolo Alberelli
*
*/
#include <asm/ioctl.h>
#define FIOCLEX _IO('f', 1)
#define FIONCLEX _IO('f', 2)
#define FIOASYNC _IOW('f', 125, int)
#define FIONBIO _IOW('f', 126, int)
#define FIONREAD _IOR('f', 127, int)
#define TIOCINQ FIONREAD
#define FIOQSIZE _IOR('f', 128, loff_t)
#define TCGETS 0x5401
#define TCSETS 0x5402
#define TCSETSW 0x5403
#define TCSETSF 0x5404
#define TCGETA _IOR('t', 23, struct termio)
#define TCSETA _IOW('t', 24, struct termio)
#define TCSETAW _IOW('t', 25, struct termio)
#define TCSETAF _IOW('t', 28, struct termio)
#define TCSBRK _IO('t', 29)
#define TCXONC _IO('t', 30)
#define TCFLSH _IO('t', 31)
#define TIOCSWINSZ _IOW('t', 103, struct winsize)
#define TIOCGWINSZ _IOR('t', 104, struct winsize)
#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
#define TIOCSPGRP _IOW('t', 118, int)
#define TIOCGPGRP _IOR('t', 119, int)
#define TIOCEXCL _IO('T', 12) /* 0x540C */
#define TIOCNXCL _IO('T', 13) /* 0x540D */
#define TIOCSCTTY _IO('T', 14) /* 0x540E */
#define TIOCSTI _IOW('T', 18, char) /* 0x5412 */
#define TIOCMGET _IOR('T', 21, unsigned int) /* 0x5415 */
#define TIOCMBIS _IOW('T', 22, unsigned int) /* 0x5416 */
#define TIOCMBIC _IOW('T', 23, unsigned int) /* 0x5417 */
#define TIOCMSET _IOW('T', 24, unsigned int) /* 0x5418 */
# define TIOCM_LE 0x001
# define TIOCM_DTR 0x002
# define TIOCM_RTS 0x004
# define TIOCM_ST 0x008
# define TIOCM_SR 0x010
# define TIOCM_CTS 0x020
# define TIOCM_CAR 0x040
# define TIOCM_RNG 0x080
# define TIOCM_DSR 0x100
# define TIOCM_CD TIOCM_CAR
# define TIOCM_RI TIOCM_RNG
#define TIOCGSOFTCAR _IOR('T', 25, unsigned int) /* 0x5419 */
#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */
#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */
#define TIOCCONS _IO('T', 29) /* 0x541D */
#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */
#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */
#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */
# define TIOCPKT_DATA 0
# define TIOCPKT_FLUSHREAD 1
# define TIOCPKT_FLUSHWRITE 2
# define TIOCPKT_STOP 4
# define TIOCPKT_START 8
# define TIOCPKT_NOSTOP 16
# define TIOCPKT_DOSTOP 32
#define TIOCNOTTY _IO('T', 34) /* 0x5422 */
#define TIOCSETD _IOW('T', 35, int) /* 0x5423 */
#define TIOCGETD _IOR('T', 36, int) /* 0x5424 */
#define TCSBRKP _IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */
#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */
#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */
#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */
#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
#define TIOCGLCKTRMIOS 0x5456
#define TIOCSLCKTRMIOS 0x5457
#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */
#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */
#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */
#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* 0x545D */ /* read serial port inline interrupt counts */
#endif /* __ASM_SH64_IOCTLS_H */
|
/*
* procpriv.h
*
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
*
* Global PROC constants and types, shared by PROC, MGR and DSP API.
*
* Copyright (C) 2005-2006 Texas Instruments, Inc.
*
* This package 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 PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef PROCPRIV_
#define PROCPRIV_
struct proc_object;
#endif
|
/*
* Copyright (C) 2018 Acutam Automation, LLC
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup sys_cb_mux Callback multiplexer
* @ingroup sys
* @brief cb_mux provides utilities for storing, retrieving, and managing
* callback information in a singly linked list.
*
* If an API provides the ability to call multiple callbacks, cb_mux can
* simplify handling of an arbitrary number of callbacks by requiring memory
* for a cb_mux entry to be passed along with other arguments. The cb_mux entry
* is then attached to a list using cb_mux_add. The code implementing that API
* can manage the list using the various utility functions that cb_mux provides.
*
* @{
*
* @file
* @brief cb_mux interface definitions
*
* @author Matthew Blue <matthew.blue.neuro@gmail.com>
*/
#ifndef CB_MUX_H
#define CB_MUX_H
#include <stdint.h>
/* For alternate cb_mux_cbid_t */
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef HAVE_CB_MUX_CBID_T
/**
* @brief cb_mux identifier type
*/
typedef unsigned int cb_mux_cbid_t;
#endif
/**
* @brief cb_mux callback type
*/
typedef void (*cb_mux_cb_t)(void *);
/**
* @brief cb_mux list entry structure
*/
typedef struct cb_mux {
struct cb_mux *next; /**< next entry in the cb_mux list */
cb_mux_cbid_t cbid; /**< identifier for this callback */
void *info; /**< optional extra information */
cb_mux_cb_t cb; /**< callback function */
void *arg; /**< argument for callback function */
} cb_mux_t;
/**
* @brief cb_mux iterate function callback type for cb_mux_iter
*/
typedef void (*cb_mux_iter_t)(cb_mux_t *, void *);
/**
* @brief Add a new entry to the end of a cb_mux list
*
* @param[in] head double pointer to first list entry
* @param[in] entry entry to add
*/
void cb_mux_add(cb_mux_t **head, cb_mux_t *entry);
/**
* @brief Remove a entry from a cb_mux list
*
* @param[in] head double pointer to first list entry
* @param[in] entry entry to remove
*/
void cb_mux_del(cb_mux_t **head, cb_mux_t *entry);
/**
* @brief Find an entry in the list by ID
*
* @param[in] head pointer to first list entry
* @param[in] cbid_val ID to find
*
* @return pointer to the list entry
*/
cb_mux_t *cb_mux_find_cbid(cb_mux_t *head, cb_mux_cbid_t cbid_val);
/**
* @brief Find the entry with the lowest ID
*
* If there are multiple hits, this returns the oldest.
*
* @param[in] head pointer to first list entry
*
* @return pointer to the list entry
*/
cb_mux_t *cb_mux_find_low(cb_mux_t *head);
/**
* @brief Find the entry with the highest ID
*
* If there are multiple hits, this returns the oldest.
*
* @param[in] head pointer to first list entry
*
* @return pointer to the list entry
*/
cb_mux_t *cb_mux_find_high(cb_mux_t *head);
/**
* @brief Find the lowest unused ID
*
* Returns highest possible ID on failure
*
* @param[in] head pointer to first list entry
*
* @return lowest unused ID
*/
cb_mux_cbid_t cb_mux_find_free_id(cb_mux_t *head);
/**
* @brief Run a function on every item in the cb_mux list
*
* @param[in] head pointer to first list entry
* @param[in] func function to run on each entry
* @param[in] arg argument for the function
*/
void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* CB_MUX_H */
|
/*
* include/asm-m68k/processor.h
*
* Copyright (C) 1995 Hamish Macdonald
*/
#ifndef __ASM_M68K_PROCESSOR_H
#define __ASM_M68K_PROCESSOR_H
/*
* Default implementation of macro that returns current
* instruction pointer ("program counter").
*/
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/thread_info.h>
#include <asm/segment.h>
#include <asm/fpu.h>
#include <asm/ptrace.h>
static inline unsigned long rdusp(void)
{
#ifdef CONFIG_COLDFIRE_SW_A7
extern unsigned int sw_usp;
return sw_usp;
#else
register unsigned long usp __asm__("a0");
/* move %usp,%a0 */
__asm__ __volatile__(".word 0x4e68" : "=a" (usp));
return usp;
#endif
}
static inline void wrusp(unsigned long usp)
{
#ifdef CONFIG_COLDFIRE_SW_A7
extern unsigned int sw_usp;
sw_usp = usp;
#else
register unsigned long a0 __asm__("a0") = usp;
/* move %a0,%usp */
__asm__ __volatile__(".word 0x4e60" : : "a" (a0) );
#endif
}
/*
* User space process size: 3.75GB. This is hardcoded into a few places,
* so don't change it unless you know what you are doing.
*/
#ifdef CONFIG_MMU
#ifndef CONFIG_SUN3
#define TASK_SIZE (0xF0000000UL)
#else
#define TASK_SIZE (0x0E000000UL)
#endif
#else
#define TASK_SIZE (0xFFFFFFFFUL)
#endif
#ifdef __KERNEL__
#define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX STACK_TOP
#endif
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
#ifdef CONFIG_MMU
#ifndef CONFIG_SUN3
#define TASK_UNMAPPED_BASE 0xC0000000UL
#else
#define TASK_UNMAPPED_BASE 0x0A000000UL
#endif
#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
#else
#define TASK_UNMAPPED_BASE 0
#endif
struct thread_struct {
unsigned long ksp; /* kernel stack pointer */
unsigned long usp; /* user stack pointer */
unsigned short sr; /* saved status register */
unsigned short fs; /* saved fs (sfc, dfc) */
unsigned long crp[2]; /* cpu root pointer */
unsigned long esp0; /* points to SR of stack frame */
unsigned long faddr; /* info about last fault */
int signo, code;
unsigned long fp[8*3];
unsigned long fpcntl[3]; /* fp control regs */
unsigned char fpstate[FPSTATESIZE]; /* floating point state */
struct thread_info info;
};
#define INIT_THREAD { \
.ksp = sizeof(init_stack) + (unsigned long) init_stack, \
.sr = PS_S, \
.fs = __KERNEL_DS, \
.info = INIT_THREAD_INFO(init_task), \
}
#ifdef CONFIG_MMU
/*
* Do necessary setup to start up a newly executed thread.
*/
static inline void start_thread(struct pt_regs * regs, unsigned long pc,
unsigned long usp)
{
/* reads from user space */
set_fs(USER_DS);
regs->pc = pc;
regs->sr &= ~0x2000;
wrusp(usp);
}
extern int handle_kernel_fault(struct pt_regs *regs);
#else
/*
* Coldfire stacks need to be re-aligned on trap exit, conventional
* 68k can handle this case cleanly.
*/
#ifdef CONFIG_COLDFIRE
#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
#else
#define reformat(_regs) do { } while (0)
#endif
#define start_thread(_regs, _pc, _usp) \
do { \
set_fs(USER_DS); /* reads from user space */ \
(_regs)->pc = (_pc); \
((struct switch_stack *)(_regs))[-1].a6 = 0; \
reformat(_regs); \
if (current->mm) \
(_regs)->d5 = current->mm->start_data; \
(_regs)->sr &= ~0x2000; \
wrusp(_usp); \
} while(0)
#endif
/* Forward declaration, a strange C thing */
struct task_struct;
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
}
/* Prepare to copy thread state - unlazy all lazy status */
#define prepare_to_copy(tsk) do { } while (0)
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
/*
* Free current thread data structures etc..
*/
static inline void exit_thread(void)
{
}
extern unsigned long thread_saved_pc(struct task_struct *tsk);
unsigned long get_wchan(struct task_struct *p);
#define KSTK_EIP(tsk) \
({ \
unsigned long eip = 0; \
if ((tsk)->thread.esp0 > PAGE_SIZE && \
(virt_addr_valid((tsk)->thread.esp0))) \
eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
eip; })
#define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
#define task_pt_regs(tsk) ((struct pt_regs *) ((tsk)->thread.esp0))
#define cpu_relax() barrier()
#endif
|
/*
* Copyright 2011 Wolfram Sang <w.sang@pengutronix.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*/
#ifndef __ASM_ARCH_IMX_ESDHC_H
#define __ASM_ARCH_IMX_ESDHC_H
enum cd_types {
ESDHC_CD_NONE, /* no CD, neither controller nor gpio */
ESDHC_CD_CONTROLLER, /* mmc controller internal CD */
ESDHC_CD_GPIO, /* external gpio pin for CD */
ESDHC_CD_PERMANENT, /* no CD, card permanently wired to host */
};
/**
* struct esdhc_platform_data - optional platform data for esdhc on i.MX
*
* strongly recommended for i.MX25/35, not needed for other variants
*
* @wp_gpio: gpio for write_protect (-EINVAL if unused)
* @cd_gpio: gpio for card_detect interrupt (-EINVAL if unused)
*/
struct esdhc_platform_data {
unsigned int wp_gpio;
unsigned int cd_gpio;
enum cd_types cd_type;
unsigned int always_present;
unsigned int support_18v;
unsigned int support_8bit;
unsigned int keep_power_at_suspend;
unsigned int delay_line;
int (*platform_pad_change)(unsigned int index, int clock);
};
#endif /* __ASM_ARCH_IMX_ESDHC_H */
|
// Copyright 2015 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include <QFont>
#include <QString>
/// Returns a QFont object appropriate to use as a monospace font for debugging widgets, etc.
QFont GetMonospaceFont();
/// Convert a size in bytes into a readable format (KiB, MiB, etc.)
QString ReadableByteSize(qulonglong size);
|
/* Functions shipped in the ppc64 and x86_64 version of libgcc_s.1.dylib
in older Mac OS X versions, preserved for backwards compatibility.
Copyright (C) 2006-2014 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#if defined (__ppc64__) || defined (__x86_64__)
/* Many of these functions have probably never been used by anyone
anywhere on these targets, but it's hard to prove this, so they're defined
here. None are actually necessary, as demonstrated below by defining
each function using the operation it implements. */
typedef long DI;
typedef unsigned long uDI;
typedef int SI;
typedef unsigned int uSI;
typedef int word_type __attribute__ ((mode (__word__)));
DI __ashldi3 (DI x, word_type c);
DI __ashrdi3 (DI x, word_type c);
int __clzsi2 (uSI x);
word_type __cmpdi2 (DI x, DI y);
int __ctzsi2 (uSI x);
DI __divdi3 (DI x, DI y);
uDI __lshrdi3 (uDI x, word_type c);
DI __moddi3 (DI x, DI y);
DI __muldi3 (DI x, DI y);
DI __negdi2 (DI x);
int __paritysi2 (uSI x);
int __popcountsi2 (uSI x);
word_type __ucmpdi2 (uDI x, uDI y);
uDI __udivdi3 (uDI x, uDI y);
uDI __udivmoddi4 (uDI x, uDI y, uDI *r);
uDI __umoddi3 (uDI x, uDI y);
DI __ashldi3 (DI x, word_type c) { return x << c; }
DI __ashrdi3 (DI x, word_type c) { return x >> c; }
int __clzsi2 (uSI x) { return __builtin_clz (x); }
word_type __cmpdi2 (DI x, DI y) { return x < y ? 0 : x == y ? 1 : 2; }
int __ctzsi2 (uSI x) { return __builtin_ctz (x); }
DI __divdi3 (DI x, DI y) { return x / y; }
uDI __lshrdi3 (uDI x, word_type c) { return x >> c; }
DI __moddi3 (DI x, DI y) { return x % y; }
DI __muldi3 (DI x, DI y) { return x * y; }
DI __negdi2 (DI x) { return -x; }
int __paritysi2 (uSI x) { return __builtin_parity (x); }
int __popcountsi2 (uSI x) { return __builtin_popcount (x); }
word_type __ucmpdi2 (uDI x, uDI y) { return x < y ? 0 : x == y ? 1 : 2; }
uDI __udivdi3 (uDI x, uDI y) { return x / y; }
uDI __udivmoddi4 (uDI x, uDI y, uDI *r) { *r = x % y; return x / y; }
uDI __umoddi3 (uDI x, uDI y) { return x % y; }
#endif /* __ppc64__ || __x86_64__ */
|
/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_ARCH_MIPS_ASM_SUPPORT_MIPS_H_
#define ART_RUNTIME_ARCH_MIPS_ASM_SUPPORT_MIPS_H_
#include "asm_support.h"
// Register holding suspend check count down.
#define rSUSPEND $s0
// Register holding Thread::Current().
#define rSELF $s1
// Offset of field Thread::suspend_count_ verified in InitCpu
#define THREAD_FLAGS_OFFSET 0
// Offset of field Thread::exception_ verified in InitCpu
#define THREAD_EXCEPTION_OFFSET 12
#endif // ART_RUNTIME_ARCH_MIPS_ASM_SUPPORT_MIPS_H_
|
// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors
// Licensed under the MIT License:
//
// 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.
/*
* Compatibility layer for stdlib iostream
*/
#ifndef KJ_STD_IOSTREAM_H_
#define KJ_STD_IOSTREAM_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "../io.h"
#include <iostream>
namespace kj {
namespace std {
class StdOutputStream: public kj::OutputStream {
public:
explicit StdOutputStream(::std::ostream& stream) : stream_(stream) {}
~StdOutputStream() noexcept(false) {}
virtual void write(const void* src, size_t size) override {
// Always writes the full size.
stream_.write((char*)src, size);
}
virtual void write(ArrayPtr<const ArrayPtr<const byte>> pieces) override {
// Equivalent to write()ing each byte array in sequence, which is what the
// default implementation does. Override if you can do something better,
// e.g. use writev() to do the write in a single syscall.
for (auto piece : pieces) {
write(piece.begin(), piece.size());
}
}
private:
::std::ostream& stream_;
};
class StdInputStream: public kj::InputStream {
public:
explicit StdInputStream(::std::istream& stream) : stream_(stream) {}
~StdInputStream() noexcept(false) {}
virtual size_t tryRead(
void* buffer, size_t minBytes, size_t maxBytes) override {
// Like read(), but may return fewer than minBytes on EOF.
stream_.read((char*)buffer, maxBytes);
return stream_.gcount();
}
private:
::std::istream& stream_;
};
} // namespace std
} // namespace kj
#endif // KJ_STD_IOSTREAM_H_
|
/* { dg-do compile } */
/* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
/* { dg-add-options bind_pic_locally } */
#include <stdio.h>
int g (int b, int c)
{
printf ("%d %d\n", b, c);
}
int f (int a)
{
/* a is modified. */
if (a++ > 0)
g (a, 3);
}
int main ()
{
int i;
for (i = 0; i < 100; i++)
f (7);
return 0;
}
/* { dg-final { scan-ipa-dump "Creating a specialized node of f" "cp" } } */
/* { dg-final { scan-ipa-dump "replacing param a with const 7" "cp" } } */
/* { dg-final { cleanup-ipa-dump "cp" } } */
|
/*
* Copyright (C) 2003 David Brownell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/string.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/usb_ch9.h>
#include <linux/usb_gadget.h>
#include <asm/unaligned.h>
static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len)
{
int count = 0;
u8 c;
u16 uchar;
/* this insists on correct encodings, though not minimal ones.
* BUT it currently rejects legit 4-byte UTF-8 code points,
* which need surrogate pairs. (Unicode 3.1 can use them.)
*/
while (len != 0 && (c = (u8) *s++) != 0) {
if (unlikely(c & 0x80)) {
// 2-byte sequence:
// 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx
if ((c & 0xe0) == 0xc0) {
uchar = (c & 0x1f) << 6;
c = (u8) *s++;
if ((c & 0xc0) != 0xc0)
goto fail;
c &= 0x3f;
uchar |= c;
// 3-byte sequence (most CJKV characters):
// zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx
} else if ((c & 0xf0) == 0xe0) {
uchar = (c & 0x0f) << 12;
c = (u8) *s++;
if ((c & 0xc0) != 0xc0)
goto fail;
c &= 0x3f;
uchar |= c << 6;
c = (u8) *s++;
if ((c & 0xc0) != 0xc0)
goto fail;
c &= 0x3f;
uchar |= c;
/* no bogus surrogates */
if (0xd800 <= uchar && uchar <= 0xdfff)
goto fail;
// 4-byte sequence (surrogate pairs, currently rare):
// 11101110wwwwzzzzyy + 110111yyyyxxxxxx
// = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
// (uuuuu = wwww + 1)
// FIXME accept the surrogate code points (only)
} else
goto fail;
} else
uchar = c;
put_unaligned (cpu_to_le16 (uchar), cp++);
count++;
len--;
}
return count;
fail:
return -1;
}
/**
* usb_gadget_get_string - fill out a string descriptor
* @table: of c strings encoded using UTF-8
* @id: string id, from low byte of wValue in get string descriptor
* @buf: at least 256 bytes
*
* Finds the UTF-8 string matching the ID, and converts it into a
* string descriptor in utf16-le.
* Returns length of descriptor (always even) or negative errno
*
* If your driver needs stings in multiple languages, you'll probably
* "switch (wIndex) { ... }" in your ep0 string descriptor logic,
* using this routine after choosing which set of UTF-8 strings to use.
* Note that US-ASCII is a strict subset of UTF-8; any string bytes with
* the eighth bit set will be multibyte UTF-8 characters, not ISO-8859/1
* characters (which are also widely used in C strings).
*/
int
usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf)
{
struct usb_string *s;
int len;
/* descriptor 0 has the language id */
if (id == 0) {
buf [0] = 4;
buf [1] = USB_DT_STRING;
buf [2] = (u8) table->language;
buf [3] = (u8) (table->language >> 8);
return 4;
}
for (s = table->strings; s && s->s; s++)
if (s->id == id)
break;
/* unrecognized: stall. */
if (!s || !s->s)
return -EINVAL;
/* string descriptors have length, tag, then UTF16-LE text */
len = min ((size_t) 126, strlen (s->s));
memset (buf + 2, 0, 2 * len); /* zero all the bytes */
len = utf8_to_utf16le(s->s, (__le16 *)&buf[2], len);
if (len < 0)
return -EINVAL;
buf [0] = (len + 1) * 2;
buf [1] = USB_DT_STRING;
return buf [0];
}
|
/*
* drivers/media/video/samsung/mfc40/s3c_mfc_logmsg.h
*
* Header file for Samsung MFC (Multi Function Codec - FIMV) driver
*
* PyoungJae Jung, Jiun Yu, Copyright (c) 2009 Samsung Electronics
* http://www.samsungsemi.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.
*/
#ifndef _S3C_MFC_LOGMSG_H_
#define _S3C_MFC_LOGMSG_H_
/* debug macros */
#define MFC_DEBUG(fmt, ...) \
do { \
printk(KERN_DEBUG \
"%s: " fmt, __func__, ##__VA_ARGS__); \
} while(0)
#define MFC_ERROR(fmt, ...) \
do { \
printk(KERN_ERR \
"%s: " fmt, __func__, ##__VA_ARGS__); \
} while (0)
#define MFC_NOTICE(fmt, ...) \
do { \
printk(KERN_NOTICE \
fmt, ##__VA_ARGS__); \
} while (0)
#define MFC_INFO(fmt, ...) \
do { \
printk(KERN_INFO \
fmt, ##__VA_ARGS__); \
} while (0)
#define MFC_WARN(fmt, ...) \
do { \
printk(KERN_WARNING \
fmt, ##__VA_ARGS__); \
} while (0)
#ifdef CONFIG_VIDEO_MFC40_DEBUG
#define mfc_debug(fmt, ...) MFC_DEBUG(fmt, ##__VA_ARGS__)
#else
#define mfc_debug(fmt, ...)
#endif
#define mfc_err(fmt, ...) MFC_ERROR(fmt, ##__VA_ARGS__)
#define mfc_notice(fmt, ...) MFC_NOTICE(fmt, ##__VA_ARGS__)
#define mfc_info(fmt, ...) MFC_INFO(fmt, ##__VA_ARGS__)
#define mfc_warn(fmt, ...) MFC_WARN(fmt, ##__VA_ARGS__)
#endif /* _S3C_MFC_LOGMSG_H_ */
|
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <wchar.h>
const char write_chars[] = "ABC"; /* Characters on testfile. */
const wint_t unget_wchar = L'A'; /* Ungotten wide character. */
char *fname;
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
static int
do_test (void)
{
wint_t wc;
FILE *fp;
int fd;
fname = (char *) malloc (strlen (test_dir) + sizeof "/bug-ungetwc1.XXXXXX");
if (fname == NULL)
{
puts ("no memory");
return 1;
}
strcpy (stpcpy (fname, test_dir), "/bug-ungetwc1.XXXXXX");
fd = mkstemp (fname);
if (fd == -1)
{
printf ("cannot open temporary file: %m\n");
return 1;
}
add_temp_file (fname);
setlocale(LC_ALL, "");
/* Output to the file. */
if ((fp = fdopen (fd, "w")) == NULL)
{
fprintf (stderr, "Cannot make `%s' file\n", fname);
exit (EXIT_FAILURE);
}
fprintf (fp, "%s", write_chars);
fclose (fp);
/* Read from the file. */
fp = fopen (fname, "r");
size_t i = 0;
while (!feof (fp))
{
wc = getwc (fp);
if (i >= sizeof (write_chars))
{
printf ("Did not get end-of-file when expected.\n");
return 1;
}
else if (wc != (write_chars[i] ? write_chars[i] : WEOF))
{
printf ("Unexpected %lu from getwc.\n", (unsigned long int) wc);
return 1;
}
i++;
}
printf ("\nThe end-of-file indicator is set.\n");
/* Unget a wide character. */
ungetwc (unget_wchar, fp);
printf ("< `%lc' is ungotten.\n", unget_wchar);
/* Check the end-of-file indicator. */
if (feof (fp))
{
printf ("The end-of-file indicator is still set.\n");
return 1;
}
else
printf ("The end-of-file flag is cleared.\n");
fflush (stdout);
fclose (fp);
return 0;
}
|
/* slow_protocol_subtypes.h
* Defines subtypes for 802.3 "slow protocols"
*
* Copyright 2002 Steve Housley <steve_housley@3com.com>
* Copyright 2005 Dominique Bastien <dbastien@accedian.com>
* Copyright 2009 Artem Tamazov <artem.tamazov@telllabs.com>
* Copyright 2010 Roberto Morro <roberto.morro[AT]tilab.com>
* Copyright 2014 Philip Rosenberg-Watt <p.rosenberg-watt[at]cablelabs.com.>
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __SLOW_PROTOCOL_SUBTYPES_H__
#define __SLOW_PROTOCOL_SUBTYPES_H__
#define LACP_SUBTYPE 0x1
#define MARKER_SUBTYPE 0x2
#define OAM_SUBTYPE 0x3
#define OSSP_SUBTYPE 0xa /* IEEE 802.3 Annex 57A*/
#endif /* __SLOW_PROTOCOL_SUBTYPES_H__ */
|
/*
* Copyright (C) 2015-2016 Intel Corporation. All rights reserved.
*
* This file 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 file 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 <inttypes.h>
#include <AP_HAL/HAL.h>
#include <AP_HAL/I2CDevice.h>
#include <AP_HAL/utility/OwnPtr.h>
#include <AP_HAL_Empty/AP_HAL_Empty.h>
#include <AP_HAL_Empty/AP_HAL_Empty_Private.h>
#include "I2CWrapper.h"
namespace VRBRAIN {
class I2CDevice : public AP_HAL::I2CDevice {
public:
static I2CDevice *from(AP_HAL::I2CDevice *dev)
{
return static_cast<I2CDevice*>(dev);
}
I2CDevice(uint8_t bus, uint8_t address);
~I2CDevice();
/* See AP_HAL::I2CDevice::set_address() */
void set_address(uint8_t address) override { _address = address; }
/* See AP_HAL::I2CDevice::set_retries() */
void set_retries(uint8_t retries) override { _retries = retries; }
/* See AP_HAL::Device::set_speed(): Empty implementation, not supported. */
bool set_speed(enum Device::Speed speed) override { return true; }
/* See AP_HAL::Device::transfer() */
bool transfer(const uint8_t *send, uint32_t send_len,
uint8_t *recv, uint32_t recv_len) override;
bool read_registers_multiple(uint8_t first_reg, uint8_t *recv,
uint32_t recv_len, uint8_t times) override;
/* See AP_HAL::Device::register_periodic_callback() */
AP_HAL::Device::PeriodicHandle register_periodic_callback(
uint32_t period_usec, AP_HAL::Device::PeriodicCb) override
{
/* Not implemented yet */
return nullptr;
}
/* See AP_HAL::Device::adjust_periodic_callback() */
bool adjust_periodic_callback(AP_HAL::Device::PeriodicHandle h, uint32_t period_usec) override
{
/* Not implemented yet */
return false;
}
AP_HAL::Semaphore* get_semaphore() override { return &semaphore; }
private:
// we use an empty semaphore as the underlying I2C class already has a semaphore
Empty::Semaphore semaphore;
VRBRAIN_I2C _bus;
uint8_t _address;
uint8_t _retries = 0;
};
class I2CDeviceManager : public AP_HAL::I2CDeviceManager {
public:
friend class I2CDevice;
static I2CDeviceManager *from(AP_HAL::I2CDeviceManager *i2c_mgr)
{
return static_cast<I2CDeviceManager*>(i2c_mgr);
}
AP_HAL::OwnPtr<AP_HAL::I2CDevice> get_device(uint8_t bus, uint8_t address) override;
};
}
|
/*
Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Sony Computer Entertainment Inc nor the names
of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _VECTORMATH_VECIDX_AOS_H
#define _VECTORMATH_VECIDX_AOS_H
#include "floatInVec.h"
namespace Vectormath {
namespace Aos {
//-----------------------------------------------------------------------------
// VecIdx
// Used in setting elements of Vector3, Vector4, Point3, or Quat with the
// subscripting operator.
//
VM_ATTRIBUTE_ALIGNED_CLASS16 (class) VecIdx
{
private:
__m128 &ref;
int i;
public:
inline VecIdx( __m128& vec, int idx ): ref(vec) { i = idx; }
// implicitly casts to float unless _VECTORMATH_NO_SCALAR_CAST defined
// in which case, implicitly casts to floatInVec, and one must call
// getAsFloat to convert to float.
//
#ifdef _VECTORMATH_NO_SCALAR_CAST
inline operator floatInVec() const;
inline float getAsFloat() const;
#else
inline operator float() const;
#endif
inline float operator =( float scalar );
inline floatInVec operator =( const floatInVec &scalar );
inline floatInVec operator =( const VecIdx& scalar );
inline floatInVec operator *=( float scalar );
inline floatInVec operator *=( const floatInVec &scalar );
inline floatInVec operator /=( float scalar );
inline floatInVec operator /=( const floatInVec &scalar );
inline floatInVec operator +=( float scalar );
inline floatInVec operator +=( const floatInVec &scalar );
inline floatInVec operator -=( float scalar );
inline floatInVec operator -=( const floatInVec &scalar );
};
} // namespace Aos
} // namespace Vectormath
#endif
|
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER GON
#define PRODUCT NerD
#define DESCRIPTION QMK port for the GON Nerd PCB
/* key matrix size */
#define MATRIX_ROWS 10
#define MATRIX_COLS 9
/* backlight */
#define BACKLIGHT_PIN B7
#define BACKLIGHT_LEVELS 3
/* matrix pins */
#define MATRIX_ROW_PINS { B4, E2, F4, F7, F1, F6, C6, F5, D7, C7 }
#define MATRIX_COL_PINS { E6, B0, B1, B2, B3, F0, D0, D5, D1 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
#endif
|
#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __LITTLE_ENDIAN_BITFIELD
#define __LITTLE_ENDIAN_BITFIELD
#endif
#include <linux/types.h>
#include <linux/byteorder/swab.h>
#define __constant_htonl(x) ( (__be32)___constant_swab32((x)))
#define __constant_ntohl(x) ___constant_swab32( (__be32)(x))
#define __constant_htons(x) ( (__be16)___constant_swab16((x)))
#define __constant_ntohs(x) ___constant_swab16( (__be16)(x))
#define __constant_cpu_to_le64(x) ( (__le64)(__u64)(x))
#define __constant_le64_to_cpu(x) ( (__u64)(__le64)(x))
#define __constant_cpu_to_le32(x) ( (__le32)(__u32)(x))
#define __constant_le32_to_cpu(x) ( (__u32)(__le32)(x))
#define __constant_cpu_to_le16(x) ( (__le16)(__u16)(x))
#define __constant_le16_to_cpu(x) ( (__u16)(__le16)(x))
#define __constant_cpu_to_be64(x) ( (__be64)___constant_swab64((x)))
#define __constant_be64_to_cpu(x) ___constant_swab64( (__u64)(__be64)(x))
#define __constant_cpu_to_be32(x) ( (__be32)___constant_swab32((x)))
#define __constant_be32_to_cpu(x) ___constant_swab32( (__u32)(__be32)(x))
#define __constant_cpu_to_be16(x) ( (__be16)___constant_swab16((x)))
#define __constant_be16_to_cpu(x) ___constant_swab16( (__u16)(__be16)(x))
#define __cpu_to_le64(x) ( (__le64)(__u64)(x))
#define __le64_to_cpu(x) ( (__u64)(__le64)(x))
#define __cpu_to_le32(x) ( (__le32)(__u32)(x))
#define __le32_to_cpu(x) ( (__u32)(__le32)(x))
#define __cpu_to_le16(x) ( (__le16)(__u16)(x))
#define __le16_to_cpu(x) ( (__u16)(__le16)(x))
#define __cpu_to_be64(x) ( (__be64)__swab64((x)))
#define __be64_to_cpu(x) __swab64( (__u64)(__be64)(x))
#define __cpu_to_be32(x) ( (__be32)__swab32((x)))
#define __be32_to_cpu(x) __swab32( (__u32)(__be32)(x))
#define __cpu_to_be16(x) ( (__be16)__swab16((x)))
#define __be16_to_cpu(x) __swab16( (__u16)(__be16)(x))
static __inline__ __le64 __cpu_to_le64p(const __u64 *p)
{
return (__le64)*p;
}
static __inline__ __u64 __le64_to_cpup(const __le64 *p)
{
return (__u64)*p;
}
static __inline__ __le32 __cpu_to_le32p(const __u32 *p)
{
return (__le32)*p;
}
static __inline__ __u32 __le32_to_cpup(const __le32 *p)
{
return (__u32)*p;
}
static __inline__ __le16 __cpu_to_le16p(const __u16 *p)
{
return (__le16)*p;
}
static __inline__ __u16 __le16_to_cpup(const __le16 *p)
{
return (__u16)*p;
}
static __inline__ __be64 __cpu_to_be64p(const __u64 *p)
{
return (__be64)__swab64p(p);
}
static __inline__ __u64 __be64_to_cpup(const __be64 *p)
{
return __swab64p((__u64 *)p);
}
static __inline__ __be32 __cpu_to_be32p(const __u32 *p)
{
return (__be32)__swab32p(p);
}
static __inline__ __u32 __be32_to_cpup(const __be32 *p)
{
return __swab32p((__u32 *)p);
}
static __inline__ __be16 __cpu_to_be16p(const __u16 *p)
{
return (__be16)__swab16p(p);
}
static __inline__ __u16 __be16_to_cpup(const __be16 *p)
{
return __swab16p((__u16 *)p);
}
#define __cpu_to_le64s(x) do {} while (0)
#define __le64_to_cpus(x) do {} while (0)
#define __cpu_to_le32s(x) do {} while (0)
#define __le32_to_cpus(x) do {} while (0)
#define __cpu_to_le16s(x) do {} while (0)
#define __le16_to_cpus(x) do {} while (0)
#define __cpu_to_be64s(x) __swab64s((x))
#define __be64_to_cpus(x) __swab64s((x))
#define __cpu_to_be32s(x) __swab32s((x))
#define __be32_to_cpus(x) __swab32s((x))
#define __cpu_to_be16s(x) __swab16s((x))
#define __be16_to_cpus(x) __swab16s((x))
#include <linux/byteorder/generic.h>
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
|
/************************************************************************
filename: FalStaticImage.h
created: Tue Jul 5 2005
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/*************************************************************************
Crazy Eddie's GUI System (http://www.cegui.org.uk)
Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************/
#ifndef _FalStaticImage_h_
#define _FalStaticImage_h_
#include "FalModule.h"
#include "CEGUIWindowFactory.h"
#include "elements/CEGUIStaticImage.h"
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
StaticImage class for the FalagardBase module.
This class requires LookNFeel to be assigned. The LookNFeel should provide the following:
States:
- Enabled - basic rendering for enabled state.
- Disabled - basic rendering for disabled state.
- EnabledFrame - frame rendering for enabled state
- DisabledFrame - frame rendering for disabled state.
- EnabledBackground - backdrop rendering for enabled state
- DisabledBackground - backdrop rendering for disabled state
Named Areas:
- WithFrameImageRenderArea - Area to render image into when the frame is enabled.
- NoFrameImageRenderArea - Area to render image into when the frame is disabled.
*/
class FALAGARDBASE_API FalagardStaticImage : public StaticImage
{
public:
static const utf8 WidgetTypeName[]; //!< type name for this widget.
/*!
\brief
Constructor
*/
FalagardStaticImage(const String& type, const String& name);
/*!
\brief
Destructor
*/
~FalagardStaticImage();
// overridden from StaticImage base class.
Rect getUnclippedInnerRect(void) const;
protected:
// overridden from StaticImage base class.
void populateRenderCache();
};
/*!
\brief
WindowFactory for FalagardStaticImage type Window objects.
*/
class FALAGARDBASE_API FalagardStaticImageFactory : public WindowFactory
{
public:
FalagardStaticImageFactory(void) : WindowFactory(FalagardStaticImage::WidgetTypeName) { }
~FalagardStaticImageFactory(void){}
Window* createWindow(const String& name);
void destroyWindow(Window* window);
};
} // End of CEGUI namespace section
#endif // end of guard _FalStaticImage_h_
|
/*
* $Id$
*
* Copyright (c) 1996-2002, Darren Hiebert
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* Program definitions
*/
#ifndef _CTAGS_H
#define _CTAGS_H
/*
* MACROS
*/
#ifndef PROGRAM_VERSION
# define PROGRAM_VERSION "Development"
#endif
#define PROGRAM_NAME "Exuberant Ctags"
#define PROGRAM_URL "http://ctags.sourceforge.net"
#define PROGRAM_COPYRIGHT "Copyright (C) 1996-2009"
#define AUTHOR_NAME "Darren Hiebert"
#define AUTHOR_EMAIL "dhiebert@users.sourceforge.net"
#endif /* _CTAGS_H */
/* vi:set tabstop=4 shiftwidth=4: */
|
/*
* PNM image format
* Copyright (c) 2002, 2003 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "pnm.h"
static inline int pnm_space(int c)
{
return c == ' ' || c == '\n' || c == '\r' || c == '\t';
}
static void pnm_get(PNMContext *sc, char *str, int buf_size)
{
char *s;
int c;
/* skip spaces and comments */
for (;;) {
c = *sc->bytestream++;
if (c == '#') {
do {
c = *sc->bytestream++;
} while (c != '\n' && sc->bytestream < sc->bytestream_end);
} else if (!pnm_space(c)) {
break;
}
}
s = str;
while (sc->bytestream < sc->bytestream_end && !pnm_space(c)) {
if ((s - str) < buf_size - 1)
*s++ = c;
c = *sc->bytestream++;
}
*s = '\0';
}
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
{
char buf1[32], tuple_type[32];
int h, w, depth, maxval;
pnm_get(s, buf1, sizeof(buf1));
s->type= buf1[1]-'0';
if(buf1[0] != 'P')
return -1;
if (s->type==1 || s->type==4) {
avctx->pix_fmt = PIX_FMT_MONOWHITE;
} else if (s->type==2 || s->type==5) {
if (avctx->codec_id == CODEC_ID_PGMYUV)
avctx->pix_fmt = PIX_FMT_YUV420P;
else
avctx->pix_fmt = PIX_FMT_GRAY8;
} else if (s->type==3 || s->type==6) {
avctx->pix_fmt = PIX_FMT_RGB24;
} else if (s->type==7) {
w = -1;
h = -1;
maxval = -1;
depth = -1;
tuple_type[0] = '\0';
for (;;) {
pnm_get(s, buf1, sizeof(buf1));
if (!strcmp(buf1, "WIDTH")) {
pnm_get(s, buf1, sizeof(buf1));
w = strtol(buf1, NULL, 10);
} else if (!strcmp(buf1, "HEIGHT")) {
pnm_get(s, buf1, sizeof(buf1));
h = strtol(buf1, NULL, 10);
} else if (!strcmp(buf1, "DEPTH")) {
pnm_get(s, buf1, sizeof(buf1));
depth = strtol(buf1, NULL, 10);
} else if (!strcmp(buf1, "MAXVAL")) {
pnm_get(s, buf1, sizeof(buf1));
maxval = strtol(buf1, NULL, 10);
} else if (!strcmp(buf1, "TUPLETYPE")) {
pnm_get(s, tuple_type, sizeof(tuple_type));
} else if (!strcmp(buf1, "ENDHDR")) {
break;
} else {
return -1;
}
}
/* check that all tags are present */
if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || av_image_check_size(w, h, 0, avctx))
return -1;
avctx->width = w;
avctx->height = h;
if (depth == 1) {
if (maxval == 1)
avctx->pix_fmt = PIX_FMT_MONOWHITE;
else
avctx->pix_fmt = PIX_FMT_GRAY8;
} else if (depth == 3) {
if (maxval < 256) {
avctx->pix_fmt = PIX_FMT_RGB24;
} else {
av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
avctx->pix_fmt = PIX_FMT_NONE;
return -1;
}
} else if (depth == 4) {
avctx->pix_fmt = PIX_FMT_RGB32;
} else {
return -1;
}
return 0;
} else {
return -1;
}
pnm_get(s, buf1, sizeof(buf1));
avctx->width = atoi(buf1);
if (avctx->width <= 0)
return -1;
pnm_get(s, buf1, sizeof(buf1));
avctx->height = atoi(buf1);
if(avctx->height <= 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx))
return -1;
if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
pnm_get(s, buf1, sizeof(buf1));
s->maxval = atoi(buf1);
if (s->maxval <= 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval);
s->maxval = 255;
}
if (s->maxval >= 256) {
if (avctx->pix_fmt == PIX_FMT_GRAY8) {
avctx->pix_fmt = PIX_FMT_GRAY16BE;
if (s->maxval != 65535)
avctx->pix_fmt = PIX_FMT_GRAY16;
} else if (avctx->pix_fmt == PIX_FMT_RGB24) {
if (s->maxval > 255)
avctx->pix_fmt = PIX_FMT_RGB48BE;
} else {
av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
avctx->pix_fmt = PIX_FMT_NONE;
return -1;
}
}
}else
s->maxval=1;
/* more check if YUV420 */
if (avctx->pix_fmt == PIX_FMT_YUV420P) {
if ((avctx->width & 1) != 0)
return -1;
h = (avctx->height * 2);
if ((h % 3) != 0)
return -1;
h /= 3;
avctx->height = h;
}
return 0;
}
av_cold int ff_pnm_end(AVCodecContext *avctx)
{
PNMContext *s = avctx->priv_data;
if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
av_cold int ff_pnm_init(AVCodecContext *avctx)
{
PNMContext *s = avctx->priv_data;
avcodec_get_frame_defaults((AVFrame*)&s->picture);
avctx->coded_frame = (AVFrame*)&s->picture;
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_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
#define CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/window_controller_list_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#if defined(TOOLKIT_VIEWS)
#include "ui/views/focus/widget_focus_manager.h"
#endif
class Profile;
namespace base {
class ListValue;
}
namespace extensions {
// The WindowsEventRouter sends chrome.windows.* events to listeners
// inside extension process renderers. The router listens to *all* events,
// but will only route eventes within a profile to extension processes in the
// same profile.
class WindowsEventRouter : public WindowControllerListObserver,
#if defined(TOOLKIT_VIEWS)
public views::WidgetFocusChangeListener,
#endif
public content::NotificationObserver {
public:
explicit WindowsEventRouter(Profile* profile);
virtual ~WindowsEventRouter();
// WindowControllerListObserver methods:
virtual void OnWindowControllerAdded(
WindowController* window_controller) OVERRIDE;
virtual void OnWindowControllerRemoved(
WindowController* window) OVERRIDE;
#if defined(TOOLKIT_VIEWS)
virtual void OnNativeFocusChange(gfx::NativeView focused_before,
gfx::NativeView focused_now) OVERRIDE;
#endif
// content::NotificationObserver.
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// |window_controller| is NULL to indicate a focused window has lost focus.
void OnActiveWindowChanged(WindowController* window_controller);
private:
void DispatchEvent(const std::string& event_name,
Profile* profile,
scoped_ptr<base::ListValue> args);
content::NotificationRegistrar registrar_;
// The main profile that owns this event router.
Profile* profile_;
// The profile the currently focused window belongs to; either the main or
// incognito profile or NULL (none of the above). We remember this in order
// to correctly handle focus changes between non-OTR and OTR windows.
Profile* focused_profile_;
// The currently focused window. We keep this so as to avoid sending multiple
// windows.onFocusChanged events with the same windowId.
int focused_window_id_;
DISALLOW_COPY_AND_ASSIGN(WindowsEventRouter);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_WINDOWS_EVENT_ROUTER_H_
|
/* Area: ffi_call, closure_call
Purpose: Check structure passing with different structure size.
Contains structs as parameter of the struct itself.
Sample taken from Alan Modras patch to src/prep_cif.c.
Limitations: none.
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
unsigned long long a;
unsigned char b;
} A;
typedef struct B {
struct A x;
unsigned char y;
} B;
static B B_fn(struct A b2, struct B b3)
{
struct B result;
result.x.a = b2.a + b3.x.a;
result.x.b = b2.b + b3.x.b + b3.y;
result.y = b2.b + b3.x.b;
printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b,
(int)b3.x.a, b3.x.b, b3.y,
(int)result.x.a, result.x.b, result.y);
return result;
}
static void
B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
void* userdata __UNUSED__)
{
struct A b0;
struct B b1;
b0 = *(struct A*)(args[0]);
b1 = *(struct B*)(args[1]);
*(B*)resp = B_fn(b0, b1);
}
int main (void)
{
ffi_cif cif;
#ifndef USING_MMAP
static ffi_closure cl;
#endif
ffi_closure *pcl;
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
#ifdef USING_MMAP
pcl = allocate_mmap (sizeof(ffi_closure));
#else
pcl = &cl;
#endif
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
cls_struct_type1.size = 0;
cls_struct_type1.alignment = 0;
cls_struct_type1.type = FFI_TYPE_STRUCT;
cls_struct_type1.elements = cls_struct_fields1;
struct A e_dbl = { 1LL, 7};
struct B f_dbl = {{12.0 , 127}, 99};
struct B res_dbl;
cls_struct_fields[0] = &ffi_type_uint64;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
cls_struct_fields1[0] = &cls_struct_type;
cls_struct_fields1[1] = &ffi_type_uchar;
cls_struct_fields1[2] = NULL;
dbl_arg_types[0] = &cls_struct_type;
dbl_arg_types[1] = &cls_struct_type1;
dbl_arg_types[2] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1,
dbl_arg_types) == FFI_OK);
args_dbl[0] = &e_dbl;
args_dbl[1] = &f_dbl;
args_dbl[2] = NULL;
ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl);
/* { dg-output "1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
exit(0);
}
|
//------------------------------------------------------------------------
// Name: DiaWrapper.h
// Author: jjuiddong
// Date: 1/10/2013
//
// Dia SDK Wrapper class
//------------------------------------------------------------------------
#pragma once
#include <cvconst.h>
struct IDiaDataSource;
struct IDiaSession;
struct IDiaSymbol;
namespace dia
{
bool Init(const std::string &pdbFileName);
void Cleanup();
IDiaSymbol* FindType(const std::string &typeName);
IDiaSymbol* FindChildSymbol( const std::string &symbolName, IDiaSymbol *pSymbol,
OUT LONG *pOffset=NULL );
enum SymbolState { NEW_SYMBOL, PARAM_SYMBOL };
IDiaSymbol* GetBaseTypeSymbol( IDiaSymbol *pSymbol, DWORD option, OUT SymbolState &result );
std::string GetSymbolName(IDiaSymbol *pSymbol);
LONG GetSymbolLocation(IDiaSymbol *pSymbol, OUT LocationType *pLocType=NULL);
ULONGLONG GetSymbolLength(IDiaSymbol *pSymbol);
std::string GetSymbolTypeName(IDiaSymbol *pSymbol, bool addOptionName=true);
std::string GetBasicTypeName(BasicType btype, ULONGLONG length);
_variant_t GetValueFromAddress(void *srcPtr, const BasicType btype, const ULONGLONG length );
_variant_t GetValueFromSymbol(void *srcPtr, IDiaSymbol *pSymbol);
_variant_t GetValue(void *srctPtr, VARTYPE varType);
void SetValue(void *destPtr, _variant_t value);
}
|
#define MY_MACRO 1
#undef MY_MACRO
|
/*
* Copyright (C) ST-Ericsson SA 2010. All rights reserved.
* This code is ST-Ericsson proprietary and confidential.
* Any use of the code for whatever purpose is subject to
* specific written permission of ST-Ericsson SA.
*/
#ifndef __INC_SHARE_INITIALIZER
#define __INC_SHARE_INITIALIZER
#define NMF_CONSTRUCT_INDEX 0
#define NMF_START_INDEX 1
#define NMF_STOP_INDEX 2
#define NMF_DESTROY_INDEX 3
#define NMF_UPDATE_STACK 4
#define NMF_LOCK_CACHE 5
#define NMF_UNLOCK_CACHE 6
#define NMF_ULP_FORCEWAKEUP 7
#define NMF_ULP_ALLOWSLEEP 8
#define NMF_CONSTRUCT_SYNC_INDEX 9
#define NMF_START_SYNC_INDEX 10
#define NMF_STOP_SYNC_INDEX 11
/*
* Index of datas in command parameter format
*/
#define INIT_COMPONENT_CMD_HANDLE_INDEX 0
#define INIT_COMPONENT_CMD_THIS_INDEX 2
#define INIT_COMPONENT_CMD_METHOD_INDEX 4
#define INIT_COMPONENT_CMD_SIZE 6
/*
* Index of datas in acknowledge parameter format
*/
#define INIT_COMPONENT_ACK_HANDLE_INDEX 0
#define INIT_COMPONENT_ACK_SIZE 2
#endif /* __INC_SHARE_INITIALIZER */
|
/**************************************** CPP definitions ***************/
/* CPP magic: Concatenate two strings or macros that resolve to strings.
* Use CONCAT(), not _CONCAT() */
#define _CONCAT(a,b) a ## b
#define CONCAT(a,b) _CONCAT(a,b)
/* CPP magic: Surround a string or a macro that resolves to a string with
* double quotes. */
#define _STRINGIFY(a) # a
#define STRINGIFY(a) _STRINGIFY(a)
|
// 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 MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
#define MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
namespace mojo {
namespace js {
class HandleCloseObserver {
public:
virtual void OnWillCloseHandle() = 0;
protected:
virtual ~HandleCloseObserver() {}
};
} // namespace js
} // namespace mojo
#endif // MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
|
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_UTIME_H_
#define _SYS_UTIME_H_
#include <linux/utime.h>
#endif /* _SYS_UTIME_H_ */
|
/***************************************************************************
* Copyright (C) 2008 by Spencer Oliver *
* spen@spen-soft.co.uk *
* *
* Copyright (C) 2008 by David T.L. Wong *
* *
* Copyright (C) 2011 by Drasko DRASKOVIC *
* drasko.draskovic@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, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
***************************************************************************/
#ifndef MIPS32_PRACC_H
#define MIPS32_PRACC_H
#include <target/mips32.h>
#include <target/mips_ejtag.h>
#define MIPS32_PRACC_FASTDATA_AREA 0xFF200000
#define MIPS32_PRACC_FASTDATA_SIZE 16
#define MIPS32_PRACC_BASE_ADDR 0xFF200000
#define MIPS32_PRACC_TEXT 0xFF200200
#define MIPS32_PRACC_PARAM_OUT 0xFF202000
#define PRACC_UPPER_BASE_ADDR (MIPS32_PRACC_BASE_ADDR >> 16)
#define PRACC_OUT_OFFSET (MIPS32_PRACC_PARAM_OUT - MIPS32_PRACC_BASE_ADDR)
#define MIPS32_FASTDATA_HANDLER_SIZE 0x80
#define UPPER16(uint32_t) (uint32_t >> 16)
#define LOWER16(uint32_t) (uint32_t & 0xFFFF)
#define NEG16(v) (((~(v)) + 1) & 0xFFFF)
/*#define NEG18(v) (((~(v)) + 1) & 0x3FFFF)*/
struct pracc_queue_info {
int retval;
const int max_code;
int code_count;
int store_count;
uint32_t *pracc_list; /* Code and store addresses */
};
void pracc_queue_init(struct pracc_queue_info *ctx);
void pracc_add(struct pracc_queue_info *ctx, uint32_t addr, uint32_t instr);
void pracc_queue_free(struct pracc_queue_info *ctx);
int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info,
struct pracc_queue_info *ctx, uint32_t *buf);
int mips32_pracc_read_mem(struct mips_ejtag *ejtag_info,
uint32_t addr, int size, int count, void *buf);
int mips32_pracc_write_mem(struct mips_ejtag *ejtag_info,
uint32_t addr, int size, int count, const void *buf);
int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_area *source,
int write_t, uint32_t addr, int count, uint32_t *buf);
int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs);
int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs);
int mips32_pracc_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_info *ctx, uint32_t *param_out);
/**
* \b mips32_cp0_read
*
* Simulates mfc0 ASM instruction (Move From C0),
* i.e. implements copro C0 Register read.
*
* @param[in] ejtag_info
* @param[in] val Storage to hold read value
* @param[in] cp0_reg Number of copro C0 register we want to read
* @param[in] cp0_sel Select for the given C0 register
*
* @return ERROR_OK on Sucess, ERROR_FAIL otherwise
*/
int mips32_cp0_read(struct mips_ejtag *ejtag_info,
uint32_t *val, uint32_t cp0_reg, uint32_t cp0_sel);
/**
* \b mips32_cp0_write
*
* Simulates mtc0 ASM instruction (Move To C0),
* i.e. implements copro C0 Register read.
*
* @param[in] ejtag_info
* @param[in] val Value to be written
* @param[in] cp0_reg Number of copro C0 register we want to write to
* @param[in] cp0_sel Select for the given C0 register
*
* @return ERROR_OK on Sucess, ERROR_FAIL otherwise
*/
int mips32_cp0_write(struct mips_ejtag *ejtag_info,
uint32_t val, uint32_t cp0_reg, uint32_t cp0_sel);
#endif
|
/****************************************************************************
Copyright (c) 2012 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 __CCCONTROL_EXTENSIONS_H__
#define __CCCONTROL_EXTENSIONS_H__
#include "CCScale9Sprite.h"
#include "CCControl.h"
#include "CCControlButton.h"
#include "CCControlColourPicker.h"
#include "CCControlPotentiometer.h"
#include "CCControlSlider.h"
#include "CCControlStepper.h"
#include "CCControlSwitch.h"
#endif
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* mach/sram.h - DaVinci simple SRAM allocator
*
* Copyright (C) 2009 David Brownell
*/
#ifndef __MACH_SRAM_H
#define __MACH_SRAM_H
/* ARBITRARY: SRAM allocations are multiples of this 2^N size */
#define SRAM_GRANULARITY 512
/*
* SRAM allocations return a CPU virtual address, or NULL on error.
* If a DMA address is requested and the SRAM supports DMA, its
* mapped address is also returned.
*
* Errors include SRAM memory not being available, and requesting
* DMA mapped SRAM on systems which don't allow that.
*/
extern void *sram_alloc(size_t len, dma_addr_t *dma);
extern void sram_free(void *addr, size_t len);
/* Get the struct gen_pool * for use in platform data */
extern struct gen_pool *sram_get_gen_pool(void);
#endif /* __MACH_SRAM_H */
|
///#begin zh-cn
//
// Created by ShareSDK.cn on 13-1-14.
// 官网地址:http://www.ShareSDK.cn
// 技术支持邮箱:support@sharesdk.cn
// 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
// 商务QQ:4006852216
// Copyright (c) 2013年 ShareSDK.cn. All rights reserved.
//
///#end
///#begin en
//
// Created by ShareSDK.cn on 13-1-14.
// Website:http://www.ShareSDK.cn
// Support E-mail:support@sharesdk.cn
// WeChat ID:ShareSDK (If publish a new version, we will be push the updates content of version to you. If you have any questions about the ShareSDK, you can get in touch through the WeChat with us, we will respond within 24 hours)
// Business QQ:4006852216
// Copyright (c) 2013年 ShareSDK.cn. All rights reserved.
//
///#end
#import <Foundation/Foundation.h>
///#begin zh-cn
/**
* @brief HTTP上传文件信息
*/
///#end
///#begin en
/**
* @brief HTTP Posted File.
*/
///#end
@interface CMHTTPPostedFile : NSObject
{
@private
NSString *_fileName;
NSString *_contentType;
NSString *_transferEncoding;
NSData *_fileData;
}
///#begin zh-cn
/**
* @brief 文件名称
*/
///#end
///#begin en
/**
* @brief File name.
*/
///#end
@property (nonatomic,readonly) NSString *fileName;
///#begin zh-cn
/**
* @brief 内容类型
*/
///#end
///#begin en
/**
* @brief Content type.
*/
///#end
@property (nonatomic,readonly) NSString *contentType;
///#begin zh-cn
/**
* @brief 文件数据
*/
///#end
///#begin en
/**
* @brief File data.
*/
///#end
@property (nonatomic,readonly) NSData *fileData;
///#begin zh-cn
/**
* @brief 内容传输编码
*/
///#end
///#begin en
/**
* @brief Transfer encoding.
*/
///#end
@property (nonatomic,readonly) NSString *transferEncoding;
///#begin zh-cn
/**
* @brief 初始化上传文件
*
* @param fileName 文件名称
* @param data 文件数据
* @param contentType 内容类型
*
* @return 上传文件信息
*/
///#end
///#begin en
/**
* @brief Initialize posted file.
*
* @param fileName File name.
* @param data File data.
* @param contentType Content type.
*
* @return Posted file object.
*/
///#end
- (id)initWithFileName:(NSString *)fileName data:(NSData *)data contentType:(NSString *)contentType;
///#begin zh-cn
/**
* @brief 初始化上传文件
*
* @param fileName 文件名称
* @param data 文件数据
* @param contentType 内容类型
* @param transferEncoding 传输编码
*
* @return 上传文件信息
*/
///#end
///#begin en
/**
* @brief Initialize posted file.
*
* @param fileName File name.
* @param data File data.
* @param contentType Content type.
* @param transferEncoding Transfer encoding.
*
* @return Posted file object.
*/
///#end
- (id)initWithFileName:(NSString *)fileName
data:(NSData *)data
contentType:(NSString *)contentType
transferEncoding:(NSString *)transferEncoding;
///#begin zh-cn
/**
* @brief 初始化上传文件
*
* @param path 文件路径
* @param contentType 内容类型
*
* @return 上传文件信息
*/
///#end
///#begin en
/**
* @brief Initialize posted file.
*
* @param path File path.
* @param contentType Content type.
*
* @return Posted file object.
*/
///#end
- (id)initWithFilePath:(NSString *)path contentType:(NSString *)contentType;
@end
|
/*
* Copyright (C) 2011-2014 MediaTek Inc.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/sched.h>
#include <linux/wait.h>
#include "ddp_reg.h"
#include "ddp_drv.h"
#include "ddp_color.h"
#include "ddp_bls.h"
static DECLARE_WAIT_QUEUE_HEAD(g_disp_hist_alarm);
static unsigned int g_Alarm = 0;
int g_AAL_NewFrameUpdate = 0;
/*
*g_AAL_Param is protected by disp_set_needupdate
*/
static DISP_AAL_PARAM g_AAL_Param =
{
.lumaCurve = { 0, 32, 64, 96, 128, 160, 192, 224, 256,
288, 320, 352, 384, 416, 448, 480, 511},
.pwmDuty = 0,
.setting = 0,
.maxClrLimit = 0,
.maxClrDistThd = 0,
.preDistLimit = 0,
.preDistThd = 0,
};
static int g_Configured = 0;
static int g_ColorIntFlag = 0;
static unsigned long g_PrevPWMDuty = 0;
unsigned long long g_PrevTime = 0;
unsigned long long g_CurrTime = 0;
extern unsigned char aal_debug_flag;
int disp_wait_hist_update(unsigned long u4TimeOut_ms)
{
int ret;
ret = wait_event_interruptible(g_disp_hist_alarm , (1 == g_ColorIntFlag));
g_ColorIntFlag = 0;
return 0;
}
void disp_set_aal_alarm(unsigned int u4En)
{
g_Alarm = u4En;
}
//Executed in ISR content
int disp_needWakeUp(void)
{
if (aal_debug_flag == 1)
return 0;
else
return (g_AAL_NewFrameUpdate || g_Alarm) ? 1 : 0;
}
//Executed in ISR content
void on_disp_aal_alarm_set(void)
{
if(disp_needWakeUp())
{
// enable interrupt
//DISP_REG_SET((DISPSYS_COLOR_BASE + 0xf04), 0x00000007);
DISP_REG_SET(DISP_REG_BLS_INTEN, 0x0000000F);
g_AAL_NewFrameUpdate = 0;
}
else
{
// disable interrupt
//DISP_REG_SET((DISPSYS_COLOR_BASE + 0xf04), 0x00000000);
if (g_PrevPWMDuty == DISP_REG_GET(DISP_REG_BLS_PWM_DUTY))
DISP_REG_SET(DISP_REG_BLS_INTEN, 0x00000000);
else
g_PrevPWMDuty = DISP_REG_GET(DISP_REG_BLS_PWM_DUTY);
}
}
unsigned int is_disp_aal_alarm_on(void)
{
return g_Alarm;
}
//Executed in ISR content
void disp_wakeup_aal(void)
{
unsigned long long u8Delta = 0;
g_CurrTime = sched_clock();
u8Delta = (g_CurrTime > g_PrevTime ? (g_CurrTime - g_PrevTime) : g_CurrTime);
// if( 28000000 < u8Delta )
{
mb();
g_ColorIntFlag = 1;
wake_up_interruptible(&g_disp_hist_alarm);
g_PrevTime = g_CurrTime;
}
}
void disp_aal_reset()
{
g_Configured = 0;
g_Alarm = 0;
g_PrevPWMDuty = 0;
g_PrevTime = 0;
g_CurrTime = 0;
}
DISP_AAL_PARAM * get_aal_config()
{
g_Configured = 1;
return &g_AAL_Param;
}
int disp_is_aal_config()
{
return g_Configured;
}
void disp_onConfig_aal(int i4FrameUpdate)
{
if (i4FrameUpdate)
g_AAL_NewFrameUpdate = 1;
if(0 == g_Configured)
{
return;
}
disp_onConfig_luma(g_AAL_Param.lumaCurve);
disp_onConfig_bls(&g_AAL_Param);
}
|
/*
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_RANDOMMOTIONGENERATOR_H
#define TRINITY_RANDOMMOTIONGENERATOR_H
#include "MovementGenerator.h"
template<class T>
class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
{
public:
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) { }
void _setRandomLocation(T*);
void DoInitialize(T*);
void DoFinalize(T*);
void DoReset(T*);
bool DoUpdate(T*, const uint32);
bool GetResetPos(T*, float& x, float& y, float& z);
MovementGeneratorType GetMovementGeneratorType() { return RANDOM_MOTION_TYPE; }
private:
TimeTrackerSmall i_nextMoveTime;
float wander_distance;
};
#endif
|
/*
* Copyright (C) 2012 Samsung Electronics
*
* Author: Donghwa Lee <dh09.lee@samsung.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef _EXYNOS_EDP_LOWLEVEL_H
#define _EXYNOS_EDP_LOWLEVEL_H
void exynos_dp_enable_video_bist(unsigned int enable);
void exynos_dp_enable_video_mute(unsigned int enable);
void exynos_dp_reset(void);
void exynos_dp_enable_sw_func(unsigned int enable);
unsigned int exynos_dp_set_analog_power_down(unsigned int block, u32 enable);
unsigned int exynos_dp_get_pll_lock_status(void);
int exynos_dp_init_analog_func(void);
void exynos_dp_init_hpd(void);
void exynos_dp_init_aux(void);
void exynos_dp_config_interrupt(void);
unsigned int exynos_dp_get_plug_in_status(void);
unsigned int exynos_dp_detect_hpd(void);
unsigned int exynos_dp_start_aux_transaction(void);
unsigned int exynos_dp_write_byte_to_dpcd(unsigned int reg_addr,
unsigned char data);
unsigned int exynos_dp_read_byte_from_dpcd(unsigned int reg_addr,
unsigned char *data);
unsigned int exynos_dp_write_bytes_to_dpcd(unsigned int reg_addr,
unsigned int count,
unsigned char data[]);
unsigned int exynos_dp_read_bytes_from_dpcd( unsigned int reg_addr,
unsigned int count,
unsigned char data[]);
int exynos_dp_select_i2c_device( unsigned int device_addr,
unsigned int reg_addr);
int exynos_dp_read_byte_from_i2c(unsigned int device_addr,
unsigned int reg_addr, unsigned int *data);
int exynos_dp_read_bytes_from_i2c(unsigned int device_addr,
unsigned int reg_addr, unsigned int count,
unsigned char edid[]);
void exynos_dp_reset_macro(void);
void exynos_dp_set_link_bandwidth(unsigned char bwtype);
unsigned char exynos_dp_get_link_bandwidth(void);
void exynos_dp_set_lane_count(unsigned char count);
unsigned int exynos_dp_get_lane_count(void);
unsigned char exynos_dp_get_lanex_pre_emphasis(unsigned char lanecnt);
void exynos_dp_set_lane_pre_emphasis(unsigned int level,
unsigned char lanecnt);
void exynos_dp_set_lanex_pre_emphasis(unsigned char request_val,
unsigned char lanecnt);
void exynos_dp_set_training_pattern(unsigned int pattern);
void exynos_dp_enable_enhanced_mode(unsigned char enable);
void exynos_dp_enable_scrambling(unsigned int enable);
int exynos_dp_init_video(void);
void exynos_dp_config_video_slave_mode(struct edp_video_info *video_info);
void exynos_dp_set_video_color_format(struct edp_video_info *video_info);
int exynos_dp_config_video_bist(struct edp_device_info *edp_info);
unsigned int exynos_dp_is_slave_video_stream_clock_on(void);
void exynos_dp_set_video_cr_mn(unsigned int type, unsigned int m_value,
unsigned int n_value);
void exynos_dp_set_video_timing_mode(unsigned int type);
void exynos_dp_enable_video_master(unsigned int enable);
void exynos_dp_start_video(void);
unsigned int exynos_dp_is_video_stream_on(void);
#endif /* _EXYNOS_DP_LOWLEVEL_H */
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
*/
#ifndef __QCOM_CLK_REGMAP_MUX_H__
#define __QCOM_CLK_REGMAP_MUX_H__
#include <linux/clk-provider.h>
#include "clk-regmap.h"
#include "common.h"
struct clk_regmap_mux {
u32 reg;
u32 shift;
u32 width;
const struct parent_map *parent_map;
struct clk_regmap clkr;
};
extern const struct clk_ops clk_regmap_mux_closest_ops;
#endif
|
/**
* \file
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SAM3XA_TRNG_INSTANCE_
#define _SAM3XA_TRNG_INSTANCE_
/* ========== Register definition for TRNG peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_TRNG_CR (0x400BC000U) /**< \brief (TRNG) Control Register */
#define REG_TRNG_IER (0x400BC010U) /**< \brief (TRNG) Interrupt Enable Register */
#define REG_TRNG_IDR (0x400BC014U) /**< \brief (TRNG) Interrupt Disable Register */
#define REG_TRNG_IMR (0x400BC018U) /**< \brief (TRNG) Interrupt Mask Register */
#define REG_TRNG_ISR (0x400BC01CU) /**< \brief (TRNG) Interrupt Status Register */
#define REG_TRNG_ODATA (0x400BC050U) /**< \brief (TRNG) Output Data Register */
#else
#define REG_TRNG_CR (*(WoReg*)0x400BC000U) /**< \brief (TRNG) Control Register */
#define REG_TRNG_IER (*(WoReg*)0x400BC010U) /**< \brief (TRNG) Interrupt Enable Register */
#define REG_TRNG_IDR (*(WoReg*)0x400BC014U) /**< \brief (TRNG) Interrupt Disable Register */
#define REG_TRNG_IMR (*(RoReg*)0x400BC018U) /**< \brief (TRNG) Interrupt Mask Register */
#define REG_TRNG_ISR (*(RoReg*)0x400BC01CU) /**< \brief (TRNG) Interrupt Status Register */
#define REG_TRNG_ODATA (*(RoReg*)0x400BC050U) /**< \brief (TRNG) Output Data Register */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* _SAM3XA_TRNG_INSTANCE_ */
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_
#define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "chrome/browser/drive/drive_service_interface.h"
namespace sync_file_system {
namespace drive_backend {
// This class wraps a part of DriveServiceInterface class to support weak
// pointer. Each method wraps corresponding name method of
// DriveServiceInterface. See comments in drive_service_interface.h
// for details.
class DriveServiceWrapper : public base::SupportsWeakPtr<DriveServiceWrapper> {
public:
explicit DriveServiceWrapper(drive::DriveServiceInterface* drive_service);
void AddNewDirectory(
const std::string& parent_resource_id,
const std::string& directory_title,
const drive::DriveServiceInterface::AddNewDirectoryOptions& options,
const google_apis::FileResourceCallback& callback);
void DeleteResource(
const std::string& resource_id,
const std::string& etag,
const google_apis::EntryActionCallback& callback);
void DownloadFile(
const base::FilePath& local_cache_path,
const std::string& resource_id,
const google_apis::DownloadActionCallback& download_action_callback,
const google_apis::GetContentCallback& get_content_callback,
const google_apis::ProgressCallback& progress_callback);
void GetAboutResource(
const google_apis::AboutResourceCallback& callback);
void GetChangeList(
int64 start_changestamp,
const google_apis::ChangeListCallback& callback);
void GetRemainingChangeList(
const GURL& next_link,
const google_apis::ChangeListCallback& callback);
void GetRemainingFileList(
const GURL& next_link,
const google_apis::FileListCallback& callback);
void GetFileResource(
const std::string& resource_id,
const google_apis::FileResourceCallback& callback);
void GetFileListInDirectory(
const std::string& directory_resource_id,
const google_apis::FileListCallback& callback);
void RemoveResourceFromDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
const google_apis::EntryActionCallback& callback);
void SearchByTitle(
const std::string& title,
const std::string& directory_resource_id,
const google_apis::FileListCallback& callback);
private:
drive::DriveServiceInterface* drive_service_;
base::SequenceChecker sequece_checker_;
DISALLOW_COPY_AND_ASSIGN(DriveServiceWrapper);
};
} // namespace drive_backend
} // namespace sync_file_system
#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_DRIVE_SERVICE_WRAPPER_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.