text
stringlengths 4
6.14k
|
|---|
#ifndef QGCMAVLINKMESSAGESENDER_H
#define QGCMAVLINKMESSAGESENDER_H
#include <QWidget>
#include <QTreeWidgetItem>
#include <QMap>
#include <QTimer>
#include "MAVLinkProtocol.h"
namespace Ui {
class QGCMAVLinkMessageSender;
}
class QGCMAVLinkMessageSender : public QWidget
{
Q_OBJECT
friend class QTimer;
public:
explicit QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent = 0);
~QGCMAVLinkMessageSender();
public slots:
/** @brief Send message currently selected in ui, taking values from tree view */
bool sendMessage();
protected:
mavlink_message_info_t messageInfo[256]; ///< Meta information about all messages
MAVLinkProtocol* protocol; ///< MAVLink protocol
QMap<int, float> messagesHz; ///< Used to store update rate in Hz
QTimer refreshTimer;
QMap<unsigned int, QTimer*> sendTimers;
QMap<unsigned int, QTreeWidgetItem*> managementItems;
QMap<unsigned int, QTreeWidgetItem*> treeWidgetItems; ///< Messages
/** @brief Create the tree view of all messages */
void createTreeView();
/** @brief Create one field of one message in the tree view of all messages */
void createField(int msgid, int fieldid, QTreeWidgetItem* item);
/** @brief Send message with values taken from tree view */
bool sendMessage(unsigned int id);
protected slots:
/** @brief Read / display values in UI */
void refresh();
private:
Ui::QGCMAVLinkMessageSender *ui;
};
#endif // QGCMAVLINKMESSAGESENDER_H
|
/* FTP extension for TCP NAT alteration. */
/* (C) 1999-2001 Paul `Rusty' Russell
* (C) 2002-2006 Netfilter Core Team <coreteam@netfilter.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/netfilter_ipv4.h>
#include <net/netfilter/nf_nat.h>
#include <net/netfilter/nf_nat_helper.h>
#include <net/netfilter/nf_nat_rule.h>
#include <net/netfilter/nf_conntrack_helper.h>
#include <net/netfilter/nf_conntrack_expect.h>
#include <linux/netfilter/nf_conntrack_ftp.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
MODULE_DESCRIPTION("ftp NAT helper");
MODULE_ALIAS("ip_nat_ftp");
/* FIXME: Time out? --RR */
static int
mangle_rfc959_packet(struct sk_buff *skb,
__be32 newip,
u_int16_t port,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("nnn,nnn,nnn,nnn,nnn,nnn")];
sprintf(buffer, "%u,%u,%u,%u,%u,%u",
NIPQUAD(newip), port>>8, port&0xFF);
pr_debug("calling nf_nat_mangle_tcp_packet\n");
return nf_nat_mangle_tcp_packet(skb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}
/* |1|132.235.1.2|6275| */
static int
mangle_eprt_packet(struct sk_buff *skb,
__be32 newip,
u_int16_t port,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("|1|255.255.255.255|65535|")];
sprintf(buffer, "|1|%u.%u.%u.%u|%u|", NIPQUAD(newip), port);
pr_debug("calling nf_nat_mangle_tcp_packet\n");
return nf_nat_mangle_tcp_packet(skb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}
/* |1|132.235.1.2|6275| */
static int
mangle_epsv_packet(struct sk_buff *skb,
__be32 newip,
u_int16_t port,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conn *ct,
enum ip_conntrack_info ctinfo)
{
char buffer[sizeof("|||65535|")];
sprintf(buffer, "|||%u|", port);
pr_debug("calling nf_nat_mangle_tcp_packet\n");
return nf_nat_mangle_tcp_packet(skb, ct, ctinfo, matchoff,
matchlen, buffer, strlen(buffer));
}
static int (*mangle[])(struct sk_buff *, __be32, u_int16_t,
unsigned int, unsigned int, struct nf_conn *,
enum ip_conntrack_info)
= {
[NF_CT_FTP_PORT] = mangle_rfc959_packet,
[NF_CT_FTP_PASV] = mangle_rfc959_packet,
[NF_CT_FTP_EPRT] = mangle_eprt_packet,
[NF_CT_FTP_EPSV] = mangle_epsv_packet
};
/* So, this packet has hit the connection tracking matching code.
Mangle it, and change the expectation to match the new version. */
static unsigned int nf_nat_ftp(struct sk_buff *skb,
enum ip_conntrack_info ctinfo,
enum nf_ct_ftp_type type,
unsigned int matchoff,
unsigned int matchlen,
struct nf_conntrack_expect *exp)
{
__be32 newip;
u_int16_t port;
int dir = CTINFO2DIR(ctinfo);
struct nf_conn *ct = exp->master;
pr_debug("FTP_NAT: type %i, off %u len %u\n", type, matchoff, matchlen);
/* Connection will come from wherever this packet goes, hence !dir */
newip = ct->tuplehash[!dir].tuple.dst.u3.ip;
exp->saved_proto.tcp.port = exp->tuple.dst.u.tcp.port;
exp->dir = !dir;
/* When you see the packet, we need to NAT it the same as the
* this one. */
exp->expectfn = nf_nat_follow_master;
/* Try to get same port: if not, try to change it. */
for (port = ntohs(exp->saved_proto.tcp.port); port != 0; port++) {
exp->tuple.dst.u.tcp.port = htons(port);
if (nf_ct_expect_related(exp) == 0)
break;
}
if (port == 0)
return NF_DROP;
if (!mangle[type](skb, newip, port, matchoff, matchlen, ct, ctinfo)) {
nf_ct_unexpect_related(exp);
return NF_DROP;
}
return NF_ACCEPT;
}
static void __exit nf_nat_ftp_fini(void)
{
rcu_assign_pointer(nf_nat_ftp_hook, NULL);
synchronize_rcu();
}
static int __init nf_nat_ftp_init(void)
{
BUG_ON(nf_nat_ftp_hook != NULL);
rcu_assign_pointer(nf_nat_ftp_hook, nf_nat_ftp);
return 0;
}
/* Prior to 2.6.11, we had a ports param. No longer, but don't break users. */
static int warn_set(const char *val, struct kernel_param *kp)
{
printk(KERN_INFO KBUILD_MODNAME
": kernel >= 2.6.10 only uses 'ports' for conntrack modules\n");
return 0;
}
module_param_call(ports, warn_set, NULL, NULL, 0);
module_init(nf_nat_ftp_init);
module_exit(nf_nat_ftp_fini);
|
/*
* U-boot - setup.h
*
* Copyright (c) 2005-2007 Analog Devices Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _SHARED_RESOURCES_H_
#define _SHARED_RESOURCES_H_
void swap_to(int device_id);
#define FLASH 0
#define ETHERNET 1
#endif /* _SHARED_RESOURCES_H_ */
|
/*
* AU1X00 UART support
*
* Hardcoded to UART 0 for now
* Speed and options also hardcoded to 115200 8N1
*
* Copyright (c) 2003 Thomas.Lange@corelatus.se
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
#include <common.h>
#include <asm/au1x00.h>
#include <serial.h>
#include <linux/compiler.h>
/******************************************************************************
*
* serial_init - initialize a channel
*
* This routine initializes the number of data bits, parity
* and set the selected baud rate. Interrupts are disabled.
* Set the modem control signals if the option is selected.
*
* RETURNS: N/A
*/
static int au1x00_serial_init(void)
{
volatile u32 *uart_fifoctl = (volatile u32*)(UART0_ADDR+UART_FCR);
volatile u32 *uart_enable = (volatile u32*)(UART0_ADDR+UART_ENABLE);
/* Enable clocks first */
*uart_enable = UART_EN_CE;
/* Then release reset */
/* Must release reset before setting other regs */
*uart_enable = UART_EN_CE|UART_EN_E;
/* Activate fifos, reset tx and rx */
/* Set tx trigger level to 12 */
*uart_fifoctl = UART_FCR_ENABLE_FIFO|UART_FCR_CLEAR_RCVR|
UART_FCR_CLEAR_XMIT|UART_FCR_T_TRIGGER_12;
serial_setbrg();
return 0;
}
static void au1x00_serial_setbrg(void)
{
volatile u32 *uart_clk = (volatile u32*)(UART0_ADDR+UART_CLK);
volatile u32 *uart_lcr = (volatile u32*)(UART0_ADDR+UART_LCR);
volatile u32 *sys_powerctrl = (u32 *)SYS_POWERCTRL;
int sd;
int divisorx2;
/* sd is system clock divisor */
/* see section 10.4.5 in au1550 datasheet */
sd = (*sys_powerctrl & 0x03) + 2;
/* calulate 2x baudrate and round */
divisorx2 = ((CONFIG_SYS_MIPS_TIMER_FREQ/(sd * 16 * CONFIG_BAUDRATE)));
if (divisorx2 & 0x01)
divisorx2 = divisorx2 + 1;
*uart_clk = divisorx2 / 2;
/* Set parity, stop bits and word length to 8N1 */
*uart_lcr = UART_LCR_WLEN8;
}
static void au1x00_serial_putc(const char c)
{
volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX);
if (c == '\n')
au1x00_serial_putc('\r');
/* Wait for fifo to shift out some bytes */
while((*uart_lsr&UART_LSR_THRE)==0);
*uart_tx = (u32)c;
}
static int au1x00_serial_getc(void)
{
volatile u32 *uart_rx = (volatile u32*)(UART0_ADDR+UART_RX);
char c;
while (!serial_tstc());
c = (*uart_rx&0xFF);
return c;
}
static int au1x00_serial_tstc(void)
{
volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
if(*uart_lsr&UART_LSR_DR){
/* Data in rfifo */
return(1);
}
return 0;
}
static struct serial_device au1x00_serial_drv = {
.name = "au1x00_serial",
.start = au1x00_serial_init,
.stop = NULL,
.setbrg = au1x00_serial_setbrg,
.putc = au1x00_serial_putc,
.puts = default_serial_puts,
.getc = au1x00_serial_getc,
.tstc = au1x00_serial_tstc,
};
void au1x00_serial_initialize(void)
{
serial_register(&au1x00_serial_drv);
}
__weak struct serial_device *default_serial_console(void)
{
return &au1x00_serial_drv;
}
|
/*
* AVID Meridien decoder
*
* Copyright (c) 2012 Carl Eugen Hoyos
*
* 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 "avcodec.h"
#include "internal.h"
#include "libavutil/intreadwrite.h"
static av_cold int avui_decode_init(AVCodecContext *avctx)
{
avctx->pix_fmt = AV_PIX_FMT_YUVA422P;
return 0;
}
static int avui_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
int ret;
AVFrame *pic = data;
const uint8_t *src = avpkt->data, *extradata = avctx->extradata;
const uint8_t *srca;
uint8_t *y, *u, *v, *a;
int transparent, interlaced = 1, skip, opaque_length, i, j, k;
uint32_t extradata_size = avctx->extradata_size;
while (extradata_size >= 24) {
uint32_t atom_size = AV_RB32(extradata);
if (!memcmp(&extradata[4], "APRGAPRG0001", 12)) {
interlaced = extradata[19] != 1;
break;
}
if (atom_size && atom_size <= extradata_size) {
extradata += atom_size;
extradata_size -= atom_size;
} else {
break;
}
}
if (avctx->height == 486) {
skip = 10;
} else {
skip = 16;
}
opaque_length = 2 * avctx->width * (avctx->height + skip) + 4 * interlaced;
if (avpkt->size < opaque_length) {
av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
return AVERROR(EINVAL);
}
transparent = avctx->bits_per_coded_sample == 32 &&
avpkt->size >= opaque_length * 2 + 4;
srca = src + opaque_length + 5;
if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
return ret;
pic->key_frame = 1;
pic->pict_type = AV_PICTURE_TYPE_I;
if (!interlaced) {
src += avctx->width * skip;
srca += avctx->width * skip;
}
for (i = 0; i < interlaced + 1; i++) {
src += avctx->width * skip;
srca += avctx->width * skip;
if (interlaced && avctx->height == 486) {
y = pic->data[0] + (1 - i) * pic->linesize[0];
u = pic->data[1] + (1 - i) * pic->linesize[1];
v = pic->data[2] + (1 - i) * pic->linesize[2];
a = pic->data[3] + (1 - i) * pic->linesize[3];
} else {
y = pic->data[0] + i * pic->linesize[0];
u = pic->data[1] + i * pic->linesize[1];
v = pic->data[2] + i * pic->linesize[2];
a = pic->data[3] + i * pic->linesize[3];
}
for (j = 0; j < avctx->height >> interlaced; j++) {
for (k = 0; k < avctx->width >> 1; k++) {
u[ k ] = *src++;
y[2 * k ] = *src++;
a[2 * k ] = 0xFF - (transparent ? *srca++ : 0);
srca++;
v[ k ] = *src++;
y[2 * k + 1] = *src++;
a[2 * k + 1] = 0xFF - (transparent ? *srca++ : 0);
srca++;
}
y += (interlaced + 1) * pic->linesize[0];
u += (interlaced + 1) * pic->linesize[1];
v += (interlaced + 1) * pic->linesize[2];
a += (interlaced + 1) * pic->linesize[3];
}
src += 4;
srca += 4;
}
*got_frame = 1;
return avpkt->size;
}
AVCodec ff_avui_decoder = {
.name = "avui",
.long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_AVUI,
.init = avui_decode_init,
.decode = avui_decode_frame,
.capabilities = AV_CODEC_CAP_DR1,
};
|
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation.
Verify that built-in math function constant folding of constant
arguments is correctly performed by the compiler.
Written by Roger Sayle, 16th August 2002. */
/* { dg-do link } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
extern double atan (double);
extern float atanf (float);
extern long double atanl (long double);
extern double cbrt (double);
extern float cbrtf (float);
extern long double cbrtl (long double);
extern double cos (double);
extern float cosf (float);
extern long double cosl (long double);
extern double exp (double);
extern float expf (float);
extern long double expl (long double);
extern double log (double);
extern float logf (float);
extern long double logl (long double);
extern double pow (double, double);
extern float powf (float, float);
extern long double powl (long double, long double);
extern double sin (double);
extern float sinf (float);
extern long double sinl (long double);
extern double sqrt (double);
extern float sqrtf (float);
extern long double sqrtl (long double);
extern double tan (double);
extern float tanf (float);
extern long double tanl (long double);
/* All references to link_error should go away at compile-time. */
extern void link_error(void);
void test (float f, double d, long double ld)
{
if (sqrt (0.0) != 0.0)
link_error ();
if (sqrt (1.0) != 1.0)
link_error ();
if (cbrt (0.0) != 0.0)
link_error ();
if (cbrt (1.0) != 1.0)
link_error ();
if (cbrt (-1.0) != -1.0)
link_error ();
if (exp (0.0) != 1.0)
link_error ();
if (exp (1.0) <= 2.71 || exp (1.0) >= 2.72)
link_error ();
if (log (1.0) != 0.0)
link_error ();
if (sin (0.0) != 0.0)
link_error ();
if (cos (0.0) != 1.0)
link_error ();
if (tan (0.0) != 0.0)
link_error ();
if (atan (0.0) != 0.0)
link_error ();
if (4.0*atan (1.0) <= 3.14 || 4.0*atan (1.0) >= 3.15)
link_error ();
if (pow (d, 0.0) != 1.0)
link_error ();
if (pow (1.0, d) != 1.0)
link_error ();
if (sqrtf (0.0F) != 0.0F)
link_error ();
if (sqrtf (1.0F) != 1.0F)
link_error ();
if (cbrtf (0.0F) != 0.0F)
link_error ();
if (cbrtf (1.0F) != 1.0F)
link_error ();
if (cbrtf (-1.0F) != -1.0F)
link_error ();
if (expf (0.0F) != 1.0F)
link_error ();
if (expf (1.0F) <= 2.71F || expf (1.0F) >= 2.72F)
link_error ();
if (logf (1.0F) != 0.0F)
link_error ();
if (sinf (0.0F) != 0.0F)
link_error ();
if (cosf (0.0F) != 1.0F)
link_error ();
if (tanf (0.0F) != 0.0F)
link_error ();
if (atanf (0.0F) != 0.0F)
link_error ();
if (4.0F*atanf (1.0F) <= 3.14F || 4.0F*atanf (1.0F) >= 3.15F)
link_error ();
if (powf (f, 0.0F) != 1.0F)
link_error ();
if (powf (1.0F, f) != 1.0F)
link_error ();
if (sqrtl (0.0L) != 0.0L)
link_error ();
if (sqrtl (1.0L) != 1.0L)
link_error ();
if (cbrtl (0.0L) != 0.0L)
link_error ();
if (cbrtl (1.0L) != 1.0L)
link_error ();
if (cbrtl (-1.0L) != -1.0L)
link_error ();
if (expl (0.0L) != 1.0L)
link_error ();
if (expl (1.0L) <= 2.71L || expl (1.0L) >= 2.72L)
link_error ();
if (logl (1.0L) != 0.0L)
link_error ();
if (sinl (0.0L) != 0.0L)
link_error ();
if (cosl (0.0L) != 1.0L)
link_error ();
if (tanl (0.0L) != 0.0L)
link_error ();
if (atanl (0.0) != 0.0L)
link_error ();
if (4.0L*atanl (1.0L) <= 3.14L || 4.0L*atanl (1.0L) >= 3.15L)
link_error ();
if (powl (ld, 0.0L) != 1.0L)
link_error ();
if (powl (1.0L, ld) != 1.0L)
link_error ();
}
int main()
{
test (3.0, 3.0F, 3.0L);
return 0;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include "pal_compiler.h"
#include "pal_locale.h"
DLLEXPORT void GlobalizationNative_ChangeCase(const UChar* lpSrc,
int32_t cwSrcLength,
UChar* lpDst,
int32_t cwDstLength,
int32_t bToUpper);
DLLEXPORT void GlobalizationNative_ChangeCaseInvariant(const UChar* lpSrc,
int32_t cwSrcLength,
UChar* lpDst,
int32_t cwDstLength,
int32_t bToUpper);
DLLEXPORT void GlobalizationNative_ChangeCaseTurkish(const UChar* lpSrc,
int32_t cwSrcLength,
UChar* lpDst,
int32_t cwDstLength,
int32_t bToUpper);
|
/* linux/arch/arm/mach-msm/board-shooter-wifi.h
*
* Copyright (C) 2008 HTC Corporation.
*
* 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.
*/
extern unsigned char *get_wifi_nvs_ram(void);
|
/*
Unix SMB/CIFS implementation.
Copyright (C) Stefan Metzmacher 2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
this is the change notify database. It implements mechanisms for
storing current change notify waiters in a tdb, and checking if a
given event matches any of the stored notify waiiters.
*/
#include "includes.h"
#include "ntvfs/sysdep/sys_notify.h"
NTSTATUS ntvfs_common_init(void);
NTSTATUS ntvfs_common_init(void)
{
return sys_notify_init();
}
|
/** @file reg_pinmux.h
* @brief PINMUX Register Layer Header File
* @date 29.May.2013
* @version 03.05.02
*
* This file contains:
* - Definitions
* - Types
* - Interface Prototypes
* .
* which are relevant for the PINMUX driver.
*/
/* (c) Texas Instruments 2009-2013, All rights reserved. */
#ifndef __REG_PINMUX_H__
#define __REG_PINMUX_H__
#include "sys_common.h"
/* USER CODE BEGIN (0) */
/* USER CODE END */
/* IOMM Revision and Boot Register */
#define REVISION_REG (*(volatile uint32 *)0xFFFFEA00U)
#define ENDIAN_REG (*(volatile uint32 *)0xFFFFEA20U)
/* IOMM Error and Fault Registers */
/** @struct iommErrFault
* @brief IOMM Error and Fault Register Definition
*
* This structure is used to access the IOMM Error and Fault registers.
*/
typedef volatile struct iommErrFault
{
uint32 ERR_RAW_STATUS_REG; /* Error Raw Status / Set Register */
uint32 ERR_ENABLED_STATUS_REG; /* Error Enabled Status / Clear Register */
uint32 ERR_ENABLE_REG; /* Error Signaling Enable Register */
uint32 ERR_ENABLE_CLR_REG; /* Error Signaling Enable Clear Register */
uint32 rsvd; /* Reserved */
uint32 FAULT_ADDRESS_REG; /* Fault Address Register */
uint32 FAULT_STATUS_REG; /* Fault Status Register */
uint32 FAULT_CLEAR_REG; /* Fault Clear Register */
} iommErrFault_t;
/* Pinmux Register Frame Definition */
/** @struct pinMuxKicker
* @brief Pin Muxing Kicker Register Definition
*
* This structure is used to access the Pin Muxing Kicker registers.
*/
typedef volatile struct pinMuxKicker
{
uint32 KICKER0; /* kicker 0 register */
uint32 KICKER1; /* kicker 1 register */
} pinMuxKICKER_t;
/** @struct pinMuxBase
* @brief PINMUX Register Definition
*
* This structure is used to access the PINMUX module registers.
*/
/** @typedef pinMuxBASE_t
* @brief PINMUX Register Frame Type Definition
*
* This type is used to access the PINMUX Registers.
*/
typedef volatile struct pinMuxBase
{
uint32 PINMMR0; /**< 0xEB10 Pin Mux 0 register*/
uint32 PINMMR1; /**< 0xEB14 Pin Mux 1 register*/
uint32 PINMMR2; /**< 0xEB18 Pin Mux 2 register*/
uint32 PINMMR3; /**< 0xEB1C Pin Mux 3 register*/
uint32 PINMMR4; /**< 0xEB20 Pin Mux 4 register*/
uint32 PINMMR5; /**< 0xEB24 Pin Mux 5 register*/
uint32 PINMMR6; /**< 0xEB28 Pin Mux 6 register*/
uint32 PINMMR7; /**< 0xEB2C Pin Mux 7 register*/
uint32 PINMMR8; /**< 0xEB30 Pin Mux 8 register*/
uint32 PINMMR9; /**< 0xEB34 Pin Mux 9 register*/
uint32 PINMMR10; /**< 0xEB38 Pin Mux 10 register*/
uint32 PINMMR11; /**< 0xEB3C Pin Mux 11 register*/
uint32 PINMMR12; /**< 0xEB40 Pin Mux 12 register*/
uint32 PINMMR13; /**< 0xEB44 Pin Mux 13 register*/
uint32 PINMMR14; /**< 0xEB48 Pin Mux 14 register*/
uint32 PINMMR15; /**< 0xEB4C Pin Mux 15 register*/
uint32 PINMMR16; /**< 0xEB50 Pin Mux 16 register*/
uint32 PINMMR17; /**< 0xEB54 Pin Mux 17 register*/
uint32 PINMMR18; /**< 0xEB58 Pin Mux 18 register*/
uint32 PINMMR19; /**< 0xEB5C Pin Mux 19 register*/
uint32 PINMMR20; /**< 0xEB60 Pin Mux 20 register*/
uint32 PINMMR21; /**< 0xEB64 Pin Mux 21 register*/
uint32 PINMMR22; /**< 0xEB68 Pin Mux 22 register*/
uint32 PINMMR23; /**< 0xEB6C Pin Mux 23 register*/
uint32 PINMMR24; /**< 0xEB70 Pin Mux 24 register*/
uint32 PINMMR25; /**< 0xEB74 Pin Mux 25 register*/
uint32 PINMMR26; /**< 0xEB78 Pin Mux 26 register*/
uint32 PINMMR27; /**< 0xEB7C Pin Mux 27 register*/
uint32 PINMMR28; /**< 0xEB80 Pin Mux 28 register*/
uint32 PINMMR29; /**< 0xEB84 Pin Mux 29 register*/
uint32 PINMMR30; /**< 0xEB88 Pin Mux 30 register*/
}pinMuxBASE_t;
/** @def iommErrFaultReg
* @brief IOMM Error Fault Register Frame Pointer
*
* This pointer is used to control IOMM Error and Fault across the device.
*/
#define iommErrFaultReg ((iommErrFault_t *) 0xFFFFEAEOU)
/** @def kickerReg
* @brief Pin Muxing Kicker Register Frame Pointer
*
* This pointer is used to enable and disable muxing accross the device.
*/
#define kickerReg ((pinMuxKICKER_t *) 0xFFFFEA38U)
/** @def pinMuxReg
* @brief Pin Muxing Control Register Frame Pointer
*
* This pointer is used to set the muxing registers accross the device.
*/
#define pinMuxReg ((pinMuxBASE_t *) 0xFFFFEB10U)
/* USER CODE BEGIN (1) */
/* USER CODE END */
#endif
|
/*
* Copyright (C) by Basler Vision Technologies AG
* Author: Thomas Koeller <thomas.koeller@baslereb.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel_stat.h>
#include <linux/module.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <asm/bitops.h>
#include <asm/bootinfo.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/irq_cpu.h>
#include <asm/mipsregs.h>
#include <asm/system.h>
#include <asm/rm9k-ocd.h>
#include <excite.h>
extern asmlinkage void excite_handle_int(void);
/*
* Initialize the interrupt handler
*/
void __init arch_init_irq(void)
{
mips_cpu_irq_init();
rm7k_cpu_irq_init();
rm9k_cpu_irq_init();
#ifdef CONFIG_KGDB
excite_kgdb_init();
#endif
}
asmlinkage void plat_irq_dispatch(void)
{
const u32
interrupts = read_c0_cause() >> 8,
mask = ((read_c0_status() >> 8) & 0x000000ff) |
(read_c0_intcontrol() & 0x0000ff00),
pending = interrupts & mask;
u32 msgintflags, msgintmask, msgint;
/* process timer interrupt */
if (pending & (1 << TIMER_IRQ)) {
do_IRQ(TIMER_IRQ);
return;
}
/* Process PCI interrupts */
#if USB_IRQ < 10
msgintflags = ocd_readl(INTP0Status0 + (USB_MSGINT / 0x20 * 0x10));
msgintmask = ocd_readl(INTP0Mask0 + (USB_MSGINT / 0x20 * 0x10));
msgint = msgintflags & msgintmask & (0x1 << (USB_MSGINT % 0x20));
if ((pending & (1 << USB_IRQ)) && msgint) {
#else
if (pending & (1 << USB_IRQ)) {
#endif
do_IRQ(USB_IRQ);
return;
}
/* Process TITAN interrupts */
msgintflags = ocd_readl(INTP0Status0 + (TITAN_MSGINT / 0x20 * 0x10));
msgintmask = ocd_readl(INTP0Mask0 + (TITAN_MSGINT / 0x20 * 0x10));
msgint = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
if ((pending & (1 << TITAN_IRQ)) && msgint) {
ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
#if defined(CONFIG_KGDB)
excite_kgdb_inthdl();
#endif
do_IRQ(TITAN_IRQ);
return;
}
/* Process FPGA line #0 interrupts */
msgintflags = ocd_readl(INTP0Status0 + (FPGA0_MSGINT / 0x20 * 0x10));
msgintmask = ocd_readl(INTP0Mask0 + (FPGA0_MSGINT / 0x20 * 0x10));
msgint = msgintflags & msgintmask & (0x1 << (FPGA0_MSGINT % 0x20));
if ((pending & (1 << FPGA0_IRQ)) && msgint) {
do_IRQ(FPGA0_IRQ);
return;
}
/* Process FPGA line #1 interrupts */
msgintflags = ocd_readl(INTP0Status0 + (FPGA1_MSGINT / 0x20 * 0x10));
msgintmask = ocd_readl(INTP0Mask0 + (FPGA1_MSGINT / 0x20 * 0x10));
msgint = msgintflags & msgintmask & (0x1 << (FPGA1_MSGINT % 0x20));
if ((pending & (1 << FPGA1_IRQ)) && msgint) {
do_IRQ(FPGA1_IRQ);
return;
}
/* Process PHY interrupts */
msgintflags = ocd_readl(INTP0Status0 + (PHY_MSGINT / 0x20 * 0x10));
msgintmask = ocd_readl(INTP0Mask0 + (PHY_MSGINT / 0x20 * 0x10));
msgint = msgintflags & msgintmask & (0x1 << (PHY_MSGINT % 0x20));
if ((pending & (1 << PHY_IRQ)) && msgint) {
do_IRQ(PHY_IRQ);
return;
}
/* Process spurious interrupts */
spurious_interrupt();
}
|
/*
Unix SMB/CIFS implementation.
An implementation of arc4.
Copyright (C) Jeremy Allison 2005.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "includes.h"
/*****************************************************************
Initialize state for an arc4 crypt/decrpyt.
arc4 state is 258 bytes - last 2 bytes are the index bytes.
*****************************************************************/
void smb_arc4_init(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen)
{
size_t ind;
unsigned char j = 0;
for (ind = 0; ind < 256; ind++) {
arc4_state_out[ind] = (unsigned char)ind;
}
for( ind = 0; ind < 256; ind++) {
unsigned char tc;
j += (arc4_state_out[ind] + key[ind%keylen]);
tc = arc4_state_out[ind];
arc4_state_out[ind] = arc4_state_out[j];
arc4_state_out[j] = tc;
}
arc4_state_out[256] = 0;
arc4_state_out[257] = 0;
}
/*****************************************************************
Do the arc4 crypt/decrpyt.
arc4 state is 258 bytes - last 2 bytes are the index bytes.
*****************************************************************/
void smb_arc4_crypt(unsigned char arc4_state_inout[258], unsigned char *data, size_t len)
{
unsigned char index_i = arc4_state_inout[256];
unsigned char index_j = arc4_state_inout[257];
size_t ind;
for( ind = 0; ind < len; ind++) {
unsigned char tc;
unsigned char t;
index_i++;
index_j += arc4_state_inout[index_i];
tc = arc4_state_inout[index_i];
arc4_state_inout[index_i] = arc4_state_inout[index_j];
arc4_state_inout[index_j] = tc;
t = arc4_state_inout[index_i] + arc4_state_inout[index_j];
data[ind] = data[ind] ^ arc4_state_inout[t];
}
arc4_state_inout[256] = index_i;
arc4_state_inout[257] = index_j;
}
|
/* vi: set sw=4 ts=4: */
/*
* Mini rmmod implementation for busybox
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
//applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP))
//usage:#if !ENABLE_MODPROBE_SMALL
//usage:#define rmmod_trivial_usage
//usage: "[-wfa] [MODULE]..."
//usage:#define rmmod_full_usage "\n\n"
//usage: "Unload kernel modules\n"
//usage: "\n -w Wait until the module is no longer used"
//usage: "\n -f Force unload"
//usage: "\n -a Remove all unused modules (recursively)"
//usage:#define rmmod_example_usage
//usage: "$ rmmod tulip\n"
//usage:#endif
#include "libbb.h"
#include "modutils.h"
int rmmod_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int rmmod_main(int argc UNUSED_PARAM, char **argv)
{
int n;
unsigned flags = O_NONBLOCK | O_EXCL;
/* Parse command line. */
n = getopt32(argv, "wfas"); // -s ignored
argv += optind;
if (n & 1) // --wait
flags &= ~O_NONBLOCK;
if (n & 2) // --force
flags |= O_TRUNC;
if (n & 4) {
/* Unload _all_ unused modules via NULL delete_module() call */
if (bb_delete_module(NULL, flags) != 0 && errno != EFAULT)
bb_perror_msg_and_die("rmmod");
return EXIT_SUCCESS;
}
if (!*argv)
bb_show_usage();
n = ENABLE_FEATURE_2_4_MODULES && get_linux_version_code() < KERNEL_VERSION(2,6,0);
while (*argv) {
char modname[MODULE_NAME_LEN];
const char *bname;
bname = bb_basename(*argv++);
if (n)
safe_strncpy(modname, bname, MODULE_NAME_LEN);
else
filename2modname(bname, modname);
if (bb_delete_module(modname, flags))
bb_error_msg_and_die("can't unload '%s': %s",
modname, moderror(errno));
}
return EXIT_SUCCESS;
}
|
/*
* Copyright (C) 2016-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include <string>
/*!
* Responsible for safely unpacking/copying/removing addon files from/to the addon folder.
*/
class CFilesystemInstaller
{
public:
CFilesystemInstaller();
/*!
* @param archive Absolute path to zip file to install.
* @param addonId
* @return true on success, otherwise false.
*/
bool InstallToFilesystem(const std::string& archive, const std::string& addonId);
bool UnInstallFromFilesystem(const std::string& addonPath);
private:
static bool UnpackArchive(std::string path, const std::string& dest);
std::string m_addonFolder;
std::string m_tempFolder;
};
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Definitions and platform data for Analog Devices
* Backlight drivers ADP8860
*
* Copyright 2009-2010 Analog Devices Inc.
*/
#ifndef __LINUX_I2C_ADP8860_H
#define __LINUX_I2C_ADP8860_H
#include <linux/leds.h>
#include <linux/types.h>
#define ID_ADP8860 8860
#define ADP8860_MAX_BRIGHTNESS 0x7F
#define FLAG_OFFT_SHIFT 8
/*
* LEDs subdevice platform data
*/
#define ADP8860_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
#define ADP8860_LED_ONT_200ms 0
#define ADP8860_LED_ONT_600ms 1
#define ADP8860_LED_ONT_800ms 2
#define ADP8860_LED_ONT_1200ms 3
#define ADP8860_LED_D7 (7)
#define ADP8860_LED_D6 (6)
#define ADP8860_LED_D5 (5)
#define ADP8860_LED_D4 (4)
#define ADP8860_LED_D3 (3)
#define ADP8860_LED_D2 (2)
#define ADP8860_LED_D1 (1)
/*
* Backlight subdevice platform data
*/
#define ADP8860_BL_D7 (1 << 6)
#define ADP8860_BL_D6 (1 << 5)
#define ADP8860_BL_D5 (1 << 4)
#define ADP8860_BL_D4 (1 << 3)
#define ADP8860_BL_D3 (1 << 2)
#define ADP8860_BL_D2 (1 << 1)
#define ADP8860_BL_D1 (1 << 0)
#define ADP8860_FADE_T_DIS 0 /* Fade Timer Disabled */
#define ADP8860_FADE_T_300ms 1 /* 0.3 Sec */
#define ADP8860_FADE_T_600ms 2
#define ADP8860_FADE_T_900ms 3
#define ADP8860_FADE_T_1200ms 4
#define ADP8860_FADE_T_1500ms 5
#define ADP8860_FADE_T_1800ms 6
#define ADP8860_FADE_T_2100ms 7
#define ADP8860_FADE_T_2400ms 8
#define ADP8860_FADE_T_2700ms 9
#define ADP8860_FADE_T_3000ms 10
#define ADP8860_FADE_T_3500ms 11
#define ADP8860_FADE_T_4000ms 12
#define ADP8860_FADE_T_4500ms 13
#define ADP8860_FADE_T_5000ms 14
#define ADP8860_FADE_T_5500ms 15 /* 5.5 Sec */
#define ADP8860_FADE_LAW_LINEAR 0
#define ADP8860_FADE_LAW_SQUARE 1
#define ADP8860_FADE_LAW_CUBIC1 2
#define ADP8860_FADE_LAW_CUBIC2 3
#define ADP8860_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
#define ADP8860_BL_AMBL_FILT_160ms 1
#define ADP8860_BL_AMBL_FILT_320ms 2
#define ADP8860_BL_AMBL_FILT_640ms 3
#define ADP8860_BL_AMBL_FILT_1280ms 4
#define ADP8860_BL_AMBL_FILT_2560ms 5
#define ADP8860_BL_AMBL_FILT_5120ms 6
#define ADP8860_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
/*
* Blacklight current 0..30mA
*/
#define ADP8860_BL_CUR_mA(I) ((I * 127) / 30)
/*
* L2 comparator current 0..1106uA
*/
#define ADP8860_L2_COMP_CURR_uA(I) ((I * 255) / 1106)
/*
* L3 comparator current 0..138uA
*/
#define ADP8860_L3_COMP_CURR_uA(I) ((I * 255) / 138)
struct adp8860_backlight_platform_data {
u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */
u8 bl_fade_in; /* Backlight Fade-In Timer */
u8 bl_fade_out; /* Backlight Fade-Out Timer */
u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */
u8 en_ambl_sens; /* 1 = enable ambient light sensor */
u8 abml_filt; /* Light sensor filter time */
u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
/**
* Independent Current Sinks / LEDS
* Sinks not assigned to the Backlight can be exposed to
* user space using the LEDS CLASS interface
*/
int num_leds;
struct led_info *leds;
u8 led_fade_in; /* LED Fade-In Timer */
u8 led_fade_out; /* LED Fade-Out Timer */
u8 led_fade_law; /* fade-on/fade-off transfer characteristic */
u8 led_on_time;
/**
* Gain down disable. Setting this option does not allow the
* charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
* 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
* The charge pump switches up in gain as needed. This feature is
* useful if the ADP8863 charge pump is used to drive an external load.
* This feature must be used when utilizing small fly capacitors
* (0402 or smaller).
* 0 = the charge pump automatically switches up and down in gain.
* This provides optimal efficiency, but is not suitable for driving
* loads that are not connected through the ADP8863 diode drivers.
* Additionally, the charge pump fly capacitors should be low ESR
* and sized 0603 or greater.
*/
u8 gdwn_dis;
};
#endif /* __LINUX_I2C_ADP8860_H */
|
/*
* Copyright (c) 2007-2012 Niels Provos, Nick Mathewson
* Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. 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 EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
#define evbuffercb bufferevent_data_cb
#define everrorcb bufferevent_event_cb
/**
Create a new bufferevent for an fd.
This function is deprecated. Use bufferevent_socket_new and
bufferevent_set_callbacks instead.
Libevent provides an abstraction on top of the regular event callbacks.
This abstraction is called a buffered event. A buffered event provides
input and output buffers that get filled and drained automatically. The
user of a buffered event no longer deals directly with the I/O, but
instead is reading from input and writing to output buffers.
Once initialized, the bufferevent structure can be used repeatedly with
bufferevent_enable() and bufferevent_disable().
When read enabled the bufferevent will try to read from the file descriptor
and call the read callback. The write callback is executed whenever the
output buffer is drained below the write low watermark, which is 0 by
default.
If multiple bases are in use, bufferevent_base_set() must be called before
enabling the bufferevent for the first time.
@deprecated This function is deprecated because it uses the current
event base, and as such can be error prone for multithreaded programs.
Use bufferevent_socket_new() instead.
@param fd the file descriptor from which data is read and written to.
This file descriptor is not allowed to be a pipe(2).
@param readcb callback to invoke when there is data to be read, or NULL if
no callback is desired
@param writecb callback to invoke when the file descriptor is ready for
writing, or NULL if no callback is desired
@param errorcb callback to invoke when there is an error on the file
descriptor
@param cbarg an argument that will be supplied to each of the callbacks
(readcb, writecb, and errorcb)
@return a pointer to a newly allocated bufferevent struct, or NULL if an
error occurred
@see bufferevent_base_set(), bufferevent_free()
*/
struct bufferevent *bufferevent_new(evutil_socket_t fd,
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
/**
Set the read and write timeout for a buffered event.
@param bufev the bufferevent to be modified
@param timeout_read the read timeout
@param timeout_write the write timeout
*/
void bufferevent_settimeout(struct bufferevent *bufev,
int timeout_read, int timeout_write);
#define EVBUFFER_READ BEV_EVENT_READING
#define EVBUFFER_WRITE BEV_EVENT_WRITING
#define EVBUFFER_EOF BEV_EVENT_EOF
#define EVBUFFER_ERROR BEV_EVENT_ERROR
#define EVBUFFER_TIMEOUT BEV_EVENT_TIMEOUT
/** macro for getting access to the input buffer of a bufferevent */
#define EVBUFFER_INPUT(x) bufferevent_get_input(x)
/** macro for getting access to the output buffer of a bufferevent */
#define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
#endif
|
//
// MAOverlay.h
// MAMapKit
//
// Created by AutoNavi.
// Copyright (c) 2013年 AutoNavi. All rights reserved.
//
#import "MAAnnotation.h"
#import "MAGeometry.h"
/*!
@brief 该类是地图覆盖物的基类,所有地图的覆盖物需要继承自此类
*/
@protocol MAOverlay <MAAnnotation>
@required
/*!
@brief 返回区域中心坐标.
*/
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
/*!
@brief 区域外接矩形
*/
@property (nonatomic, readonly) MAMapRect boundingMapRect;
@optional
/*!
@brief 判断boundingMapRect和给定的mapRect是否相交,可以用MAMapRectIntersectsRect([overlay boundingMapRect], mapRect)替代
@param mapRect 指定的map rect
@return 两个矩形是否相交
*/
- (BOOL)intersectsMapRect:(MAMapRect)mapRect;
@end
|
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BlobRegistry_h
#define BlobRegistry_h
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
class BlobData;
class BlobRegistry;
class KURL;
class ResourceError;
class ResourceHandle;
class ResourceHandleClient;
class ResourceRequest;
class ResourceResponse;
// Returns a single instance of BlobRegistry.
BlobRegistry& blobRegistry();
// BlobRegistry is not thread-safe. It should only be called from main thread.
class BlobRegistry {
public:
// Registers a blob URL referring to the specified blob data.
virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0;
// Registers a blob URL referring to the blob data identified by the specified srcURL.
virtual void registerBlobURL(const KURL&, const KURL& srcURL) = 0;
virtual void unregisterBlobURL(const KURL&) = 0;
virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) = 0;
virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) = 0;
protected:
virtual ~BlobRegistry() { }
};
} // namespace WebCore
#endif // BlobRegistry_h
|
/*
* QLogic iSCSI Offload Driver
* Copyright (c) 2016 Cavium Inc.
*
* This software is available under the terms of the GNU General Public License
* (GPL) Version 2, available from the file COPYING in the main directory of
* this source tree.
*/
#ifndef _QEDI_ISCSI_H_
#define _QEDI_ISCSI_H_
#include <linux/socket.h>
#include <linux/completion.h>
#include "qedi.h"
#define ISCSI_MAX_SESS_PER_HBA 4096
#define DEF_KA_TIMEOUT 7200000
#define DEF_KA_INTERVAL 10000
#define DEF_KA_MAX_PROBE_COUNT 10
#define DEF_TOS 0
#define DEF_TTL 0xfe
#define DEF_SND_SEQ_SCALE 0
#define DEF_RCV_BUF 0xffff
#define DEF_SND_BUF 0xffff
#define DEF_SEED 0
#define DEF_MAX_RT_TIME 8000
#define DEF_MAX_DA_COUNT 2
#define DEF_SWS_TIMER 1000
#define DEF_MAX_CWND 2
#define DEF_PATH_MTU 1500
#define DEF_MSS 1460
#define DEF_LL2_MTU 1560
#define JUMBO_MTU 9000
#define MIN_MTU 576 /* rfc 793 */
#define IPV4_HDR_LEN 20
#define IPV6_HDR_LEN 40
#define TCP_HDR_LEN 20
#define TCP_OPTION_LEN 12
#define VLAN_LEN 4
enum {
EP_STATE_IDLE = 0x0,
EP_STATE_ACQRCONN_START = 0x1,
EP_STATE_ACQRCONN_COMPL = 0x2,
EP_STATE_OFLDCONN_START = 0x4,
EP_STATE_OFLDCONN_COMPL = 0x8,
EP_STATE_DISCONN_START = 0x10,
EP_STATE_DISCONN_COMPL = 0x20,
EP_STATE_CLEANUP_START = 0x40,
EP_STATE_CLEANUP_CMPL = 0x80,
EP_STATE_TCP_FIN_RCVD = 0x100,
EP_STATE_TCP_RST_RCVD = 0x200,
EP_STATE_LOGOUT_SENT = 0x400,
EP_STATE_LOGOUT_RESP_RCVD = 0x800,
EP_STATE_CLEANUP_FAILED = 0x1000,
EP_STATE_OFLDCONN_FAILED = 0x2000,
EP_STATE_CONNECT_FAILED = 0x4000,
EP_STATE_DISCONN_TIMEDOUT = 0x8000,
};
struct qedi_conn;
struct qedi_endpoint {
struct qedi_ctx *qedi;
u32 dst_addr[4];
u32 src_addr[4];
u16 src_port;
u16 dst_port;
u16 vlan_id;
u16 pmtu;
u8 src_mac[ETH_ALEN];
u8 dst_mac[ETH_ALEN];
u8 ip_type;
int state;
wait_queue_head_t ofld_wait;
wait_queue_head_t tcp_ofld_wait;
u32 iscsi_cid;
/* identifier of the connection from qed */
u32 handle;
u32 fw_cid;
void __iomem *p_doorbell;
/* Send queue management */
struct iscsi_wqe *sq;
dma_addr_t sq_dma;
u16 sq_prod_idx;
u16 fw_sq_prod_idx;
u16 sq_con_idx;
u32 sq_mem_size;
void *sq_pbl;
dma_addr_t sq_pbl_dma;
u32 sq_pbl_size;
struct qedi_conn *conn;
struct work_struct offload_work;
};
#define QEDI_SQ_WQES_MIN 16
struct qedi_io_bdt {
struct scsi_sge *sge_tbl;
dma_addr_t sge_tbl_dma;
u16 sge_valid;
};
/**
* struct generic_pdu_resc - login pdu resource structure
*
* @req_buf: driver buffer used to stage payload associated with
* the login request
* @req_dma_addr: dma address for iscsi login request payload buffer
* @req_buf_size: actual login request payload length
* @req_wr_ptr: pointer into login request buffer when next data is
* to be written
* @resp_hdr: iscsi header where iscsi login response header is to
* be recreated
* @resp_buf: buffer to stage login response payload
* @resp_dma_addr: login response payload buffer dma address
* @resp_buf_size: login response paylod length
* @resp_wr_ptr: pointer into login response buffer when next data is
* to be written
* @req_bd_tbl: iscsi login request payload BD table
* @req_bd_dma: login request BD table dma address
* @resp_bd_tbl: iscsi login response payload BD table
* @resp_bd_dma: login request BD table dma address
*
* following structure defines buffer info for generic pdus such as iSCSI Login,
* Logout and NOP
*/
struct generic_pdu_resc {
char *req_buf;
dma_addr_t req_dma_addr;
u32 req_buf_size;
char *req_wr_ptr;
struct iscsi_hdr resp_hdr;
char *resp_buf;
dma_addr_t resp_dma_addr;
u32 resp_buf_size;
char *resp_wr_ptr;
char *req_bd_tbl;
dma_addr_t req_bd_dma;
char *resp_bd_tbl;
dma_addr_t resp_bd_dma;
};
struct qedi_conn {
struct iscsi_cls_conn *cls_conn;
struct qedi_ctx *qedi;
struct qedi_endpoint *ep;
struct list_head active_cmd_list;
spinlock_t list_lock; /* internal conn lock */
u32 active_cmd_count;
u32 cmd_cleanup_req;
u32 cmd_cleanup_cmpl;
u32 iscsi_conn_id;
int itt;
int abrt_conn;
#define QEDI_CID_RESERVED 0x5AFF
u32 fw_cid;
/*
* Buffer for login negotiation process
*/
struct generic_pdu_resc gen_pdu;
struct list_head tmf_work_list;
wait_queue_head_t wait_queue;
spinlock_t tmf_work_lock; /* tmf work lock */
unsigned long flags;
#define QEDI_CONN_FW_CLEANUP 1
};
struct qedi_cmd {
struct list_head io_cmd;
bool io_cmd_in_list;
struct iscsi_hdr hdr;
struct qedi_conn *conn;
struct scsi_cmnd *scsi_cmd;
struct scatterlist *sg;
struct qedi_io_bdt io_tbl;
struct e4_iscsi_task_context request;
unsigned char *sense_buffer;
dma_addr_t sense_buffer_dma;
u16 task_id;
/* field populated for tmf work queue */
struct iscsi_task *task;
struct work_struct tmf_work;
int state;
#define CLEANUP_WAIT 1
#define CLEANUP_RECV 2
#define CLEANUP_WAIT_FAILED 3
#define CLEANUP_NOT_REQUIRED 4
#define LUN_RESET_RESPONSE_RECEIVED 5
#define RESPONSE_RECEIVED 6
int type;
#define TYPEIO 1
#define TYPERESET 2
struct qedi_work_map *list_tmf_work;
/* slowpath management */
bool use_slowpath;
struct iscsi_tm_rsp *tmf_resp_buf;
struct qedi_work cqe_work;
};
struct qedi_work_map {
struct list_head list;
struct qedi_cmd *qedi_cmd;
int rtid;
int state;
#define QEDI_WORK_QUEUED 1
#define QEDI_WORK_SCHEDULED 2
#define QEDI_WORK_EXIT 3
struct work_struct *ptr_tmf_work;
};
struct qedi_boot_target {
char ip_addr[64];
char iscsi_name[255];
u32 ipv6_en;
};
#define qedi_set_itt(task_id, itt) ((u32)(((task_id) & 0xffff) | ((itt) << 16)))
#define qedi_get_itt(cqe) (cqe.iscsi_hdr.cmd.itt >> 16)
#define QEDI_OFLD_WAIT_STATE(q) ((q)->state == EP_STATE_OFLDCONN_FAILED || \
(q)->state == EP_STATE_OFLDCONN_COMPL)
#endif /* _QEDI_ISCSI_H_ */
|
// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2008 Simtec Electronics
// Ben Dooks <ben@simtec.co.uk>
// http://armlinux.simtec.co.uk/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/io.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <mach/irqs.h>
#include <mach/hardware.h>
#include <mach/map.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <linux/platform_data/i2c-s3c2410.h>
#include <mach/gpio-samsung.h>
#include <plat/samsung-time.h>
#include "common.h"
#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
static struct s3c2410_uartcfg smdk6400_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
};
static struct map_desc smdk6400_iodesc[] = {};
static void __init smdk6400_map_io(void)
{
s3c64xx_init_io(smdk6400_iodesc, ARRAY_SIZE(smdk6400_iodesc));
s3c64xx_set_xtal_freq(12000000);
s3c24xx_init_uarts(smdk6400_uartcfgs, ARRAY_SIZE(smdk6400_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
}
static struct platform_device *smdk6400_devices[] __initdata = {
&s3c_device_hsmmc1,
&s3c_device_i2c0,
};
static struct i2c_board_info i2c_devs[] __initdata = {
{ I2C_BOARD_INFO("wm8753", 0x1A), },
{ I2C_BOARD_INFO("24c08", 0x50), },
};
static void __init smdk6400_machine_init(void)
{
i2c_register_board_info(0, i2c_devs, ARRAY_SIZE(i2c_devs));
platform_add_devices(smdk6400_devices, ARRAY_SIZE(smdk6400_devices));
}
MACHINE_START(SMDK6400, "SMDK6400")
/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
.atag_offset = 0x100,
.nr_irqs = S3C64XX_NR_IRQS,
.init_irq = s3c6400_init_irq,
.map_io = smdk6400_map_io,
.init_machine = smdk6400_machine_init,
.init_time = samsung_timer_init,
.restart = s3c64xx_restart,
MACHINE_END
|
#ifndef EVIL80_H
#define EVIL80_H
#include "quantum.h"
#define LAYOUT( \
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K015, \
K500, K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115, \
K501, K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, K215, \
K502, K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \
K503, K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, K414, \
K504, K505, K506, K507, K509, K510, K511, K512, K513, K514, K515 \
) \
{ \
{ K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, K015 }, \
{ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, K115 }, \
{ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, K214, K215 }, \
{ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, KC_NO, KC_NO, KC_NO }, \
{ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, K412, KC_NO, K414, KC_NO }, \
{ K500, K501, K502, K503, K504, K505, K506, K507, KC_NO, K509, K510, K511, K512, K513, K514, K515 } \
}
#endif
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PPAPI_PROXY_INTERFACE_PROXY_H_
#define PPAPI_PROXY_INTERFACE_PROXY_H_
#include "base/basictypes.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/api_id.h"
namespace ppapi {
namespace proxy {
class Dispatcher;
class InterfaceProxy : public IPC::Listener, public IPC::Sender {
public:
// Factory function type for interfaces. Ownership of the returned pointer
// is transferred to the caller.
typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher);
// DEPRECATED: New classes should be registered directly in the interface
// list. This is kept around until we convert all the existing code.
//
// Information about the interface. Each interface has a static function to
// return its info, which allows either construction on the target side, and
// getting the proxied interface on the source side (see dispatcher.h for
// terminology).
struct Info {
const void* interface_ptr;
const char* name;
ApiID id;
bool is_trusted;
InterfaceProxy::Factory create_proxy;
};
virtual ~InterfaceProxy();
Dispatcher* dispatcher() const { return dispatcher_; }
// IPC::Sender implementation.
virtual bool Send(IPC::Message* msg);
// Sub-classes must implement IPC::Listener which contains this:
//virtual bool OnMessageReceived(const IPC::Message& msg);
protected:
// Creates the given interface associated with the given dispatcher. The
// dispatcher manages our lifetime.
InterfaceProxy(Dispatcher* dispatcher);
private:
Dispatcher* dispatcher_;
};
} // namespace proxy
} // namespace ppapi
#endif // PPAPI_PROXY_INTERFACE_PROXY_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 CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CHANGE_PROCESSOR_H_
#define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CHANGE_PROCESSOR_H_
#include "base/callback_forward.h"
#include "chrome/browser/sync_file_system/sync_callbacks.h"
namespace fileapi {
class FileSystemURL;
}
namespace sync_file_system {
class FileChange;
// Represents an interface to process one local change and applies
// it to the remote server.
// This interface is to be implemented/backed by RemoteSyncFileService.
class LocalChangeProcessor {
public:
LocalChangeProcessor() {}
virtual ~LocalChangeProcessor() {}
// This is called to apply the local |change|. If the change type is
// ADD_OR_UPDATE for a file, |local_file_path| points to a local file
// path that contains the latest file image whose file metadata is
// |local_file_metadata|.
// When SYNC_STATUS_HAS_CONFLICT is returned the implementation should
// notify the backing RemoteFileSyncService of the existence of conflict
// (as the remote service is supposed to maintain a list of conflict files).
virtual void ApplyLocalChange(
const FileChange& change,
const base::FilePath& local_file_path,
const SyncFileMetadata& local_file_metadata,
const fileapi::FileSystemURL& url,
const SyncStatusCallback& callback) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(LocalChangeProcessor);
};
} // namespace sync_file_system
#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CHANGE_PROCESSOR_H_
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_
#include <assert.h>
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
// Forward declarations.
class BackgroundNoise;
class RandomVector;
class SyncBuffer;
// This class handles extrapolation of audio data from the sync_buffer to
// produce packet-loss concealment.
// TODO(hlundin): Refactor this class to divide the long methods into shorter
// ones.
class Expand {
public:
Expand(BackgroundNoise* background_noise,
SyncBuffer* sync_buffer,
RandomVector* random_vector,
int fs,
size_t num_channels)
: random_vector_(random_vector),
sync_buffer_(sync_buffer),
first_expand_(true),
fs_hz_(fs),
num_channels_(num_channels),
consecutive_expands_(0),
background_noise_(background_noise),
overlap_length_(5 * fs / 8000),
lag_index_direction_(0),
current_lag_index_(0),
stop_muting_(false),
channel_parameters_(new ChannelParameters[num_channels_]) {
assert(fs == 8000 || fs == 16000 || fs == 32000 || fs == 48000);
assert(fs <= kMaxSampleRate); // Should not be possible.
assert(num_channels_ > 0);
memset(expand_lags_, 0, sizeof(expand_lags_));
Reset();
}
virtual ~Expand() {}
// Resets the object.
virtual void Reset();
// The main method to produce concealment data. The data is appended to the
// end of |output|.
virtual int Process(AudioMultiVector* output);
// Prepare the object to do extra expansion during normal operation following
// a period of expands.
virtual void SetParametersForNormalAfterExpand();
// Prepare the object to do extra expansion during merge operation following
// a period of expands.
virtual void SetParametersForMergeAfterExpand();
// Sets the mute factor for |channel| to |value|.
void SetMuteFactor(int16_t value, size_t channel) {
assert(channel < num_channels_);
channel_parameters_[channel].mute_factor = value;
}
// Returns the mute factor for |channel|.
int16_t MuteFactor(size_t channel) {
assert(channel < num_channels_);
return channel_parameters_[channel].mute_factor;
}
// Accessors and mutators.
virtual size_t overlap_length() const { return overlap_length_; }
int16_t max_lag() const { return max_lag_; }
protected:
static const int kMaxConsecutiveExpands = 200;
void GenerateRandomVector(int seed_increment,
size_t length,
int16_t* random_vector);
void GenerateBackgroundNoise(int16_t* random_vector,
size_t channel,
int16_t mute_slope,
bool too_many_expands,
size_t num_noise_samples,
int16_t* buffer);
// Initializes member variables at the beginning of an expand period.
void InitializeForAnExpandPeriod();
bool TooManyExpands();
// Analyzes the signal history in |sync_buffer_|, and set up all parameters
// necessary to produce concealment data.
void AnalyzeSignal(int16_t* random_vector);
RandomVector* random_vector_;
SyncBuffer* sync_buffer_;
bool first_expand_;
const int fs_hz_;
const size_t num_channels_;
int consecutive_expands_;
private:
static const int kUnvoicedLpcOrder = 6;
static const int kNumCorrelationCandidates = 3;
static const int kDistortionLength = 20;
static const int kLpcAnalysisLength = 160;
static const int kMaxSampleRate = 48000;
static const int kNumLags = 3;
struct ChannelParameters {
// Constructor.
ChannelParameters()
: mute_factor(16384),
ar_gain(0),
ar_gain_scale(0),
voice_mix_factor(0),
current_voice_mix_factor(0),
onset(false),
mute_slope(0) {
memset(ar_filter, 0, sizeof(ar_filter));
memset(ar_filter_state, 0, sizeof(ar_filter_state));
}
int16_t mute_factor;
int16_t ar_filter[kUnvoicedLpcOrder + 1];
int16_t ar_filter_state[kUnvoicedLpcOrder];
int16_t ar_gain;
int16_t ar_gain_scale;
int16_t voice_mix_factor; /* Q14 */
int16_t current_voice_mix_factor; /* Q14 */
AudioVector expand_vector0;
AudioVector expand_vector1;
bool onset;
int16_t mute_slope; /* Q20 */
};
// Calculate the auto-correlation of |input|, with length |input_length|
// samples. The correlation is calculated from a downsampled version of
// |input|, and is written to |output|. The scale factor is written to
// |output_scale|. Returns the length of the correlation vector.
int16_t Correlation(const int16_t* input, size_t input_length,
int16_t* output, int16_t* output_scale) const;
void UpdateLagIndex();
BackgroundNoise* background_noise_;
const size_t overlap_length_;
int16_t max_lag_;
size_t expand_lags_[kNumLags];
int lag_index_direction_;
int current_lag_index_;
bool stop_muting_;
scoped_ptr<ChannelParameters[]> channel_parameters_;
DISALLOW_COPY_AND_ASSIGN(Expand);
};
struct ExpandFactory {
ExpandFactory() {}
virtual ~ExpandFactory() {}
virtual Expand* Create(BackgroundNoise* background_noise,
SyncBuffer* sync_buffer,
RandomVector* random_vector,
int fs,
size_t num_channels) const;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
typedef int type[2];
int foo(type *a, int argc)
{
int d, e;
/* Should be able to eliminate the second load of *a along the main path. */
d = (*a)[0];
if (argc)
a++;
e = (*a)[0];
return d + e;
}
/* { dg-final { scan-tree-dump-times "Eliminated: 1" 1 "pre"} } */
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fab1" } */
typedef struct { int i; } FILE;
FILE *fp;
extern int fprintf (FILE *, const char *, ...);
volatile int vi0, vi1, vi2, vi3, vi4, vi5, vi6, vi7, vi8, vi9;
void test (void)
{
vi0 = 0;
fprintf (fp, "hello");
vi1 = 0;
fprintf (fp, "hello\n");
vi2 = 0;
fprintf (fp, "a");
vi3 = 0;
fprintf (fp, "");
vi4 = 0;
fprintf (fp, "%s", "hello");
vi5 = 0;
fprintf (fp, "%s", "hello\n");
vi6 = 0;
fprintf (fp, "%s", "a");
vi7 = 0;
fprintf (fp, "%c", 'x');
vi8 = 0;
fprintf (fp, "%d%d", vi0, vi1);
vi9 = 0;
}
/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab1"} } */
/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab1"} } */
/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab1"} } */
/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab1"} } */
/* { dg-final { scan-tree-dump "vi4.*fwrite.*\"hello\".*1, 5, fp.*vi5" "fab1"} } */
/* { dg-final { scan-tree-dump "vi5.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi6" "fab1"} } */
/* { dg-final { scan-tree-dump "vi6.*fputc.*fp.*vi7" "fab1"} } */
/* { dg-final { scan-tree-dump "vi7.*fputc.*fp.*vi8" "fab1"} } */
/* { dg-final { scan-tree-dump "vi8.*fprintf.*fp.*\"%d%d\".*vi9" "fab1"} } */
|
/* Test the `vextu64' ARM Neon intrinsic. */
/* { dg-options "-save-temps -O3 -fno-inline" } */
/* { dg-add-options arm_neon } */
#include "arm_neon.h"
extern void abort (void);
int
main (int argc, char **argv)
{
uint64_t arr1[] = {0};
uint64x1_t in1 = vld1_u64 (arr1);
uint64_t arr2[] = {1};
uint64x1_t in2 = vld1_u64 (arr2);
uint64x1_t actual = vext_u64 (in1, in2, 0);
if (actual != in1)
abort ();
return 0;
}
/* Don't scan assembler for vext - it can be optimized into a move from r0. */
|
/*
* (C) Copyright 2004, Psyent Corporation <www.psyent.com>
* Scott McNutt <smcnutt@psyent.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <watchdog.h>
#include <asm/io.h>
#include <nios2-io.h>
#include <linux/compiler.h>
#include <serial.h>
DECLARE_GLOBAL_DATA_PTR;
/*------------------------------------------------------------------
* JTAG acts as the serial port
*-----------------------------------------------------------------*/
static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
static void altera_jtag_serial_setbrg(void)
{
}
static int altera_jtag_serial_init(void)
{
return 0;
}
static void altera_jtag_serial_putc(char c)
{
while (1) {
unsigned st = readl(&jtag->control);
if (NIOS_JTAG_WSPACE(st))
break;
#ifdef CONFIG_ALTERA_JTAG_UART_BYPASS
if (!(st & NIOS_JTAG_AC)) /* no connection */
return;
#endif
WATCHDOG_RESET();
}
writel ((unsigned char)c, &jtag->data);
}
static int altera_jtag_serial_tstc(void)
{
return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
}
static int altera_jtag_serial_getc(void)
{
int c;
unsigned val;
while (1) {
WATCHDOG_RESET ();
val = readl (&jtag->data);
if (val & NIOS_JTAG_RVALID)
break;
}
c = val & 0x0ff;
return (c);
}
static struct serial_device altera_jtag_serial_drv = {
.name = "altera_jtag_uart",
.start = altera_jtag_serial_init,
.stop = NULL,
.setbrg = altera_jtag_serial_setbrg,
.putc = altera_jtag_serial_putc,
.puts = default_serial_puts,
.getc = altera_jtag_serial_getc,
.tstc = altera_jtag_serial_tstc,
};
void altera_jtag_serial_initialize(void)
{
serial_register(&altera_jtag_serial_drv);
}
__weak struct serial_device *default_serial_console(void)
{
return &altera_jtag_serial_drv;
}
|
#include <platform.h>
#include <microhttpd.h>
#define PORT 8888
#define POSTBUFFERSIZE 512
#define MAXCLIENTS 2
#define GET 0
#define POST 1
static unsigned char nr_of_uploading_clients = 0;
struct connection_info_struct
{
int connectiontype;
struct MHD_PostProcessor *postprocessor;
FILE *fp;
const char *answerstring;
int answercode;
};
const char *askpage = "<html><body>\n\
Upload a file, please!<br>\n\
There are %d clients uploading at the moment.<br>\n\
<form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\
<input name=\"file\" type=\"file\">\n\
<input type=\"submit\" value=\" Send \"></form>\n\
</body></html>";
const char *busypage =
"<html><body>This server is busy, please try again later.</body></html>";
const char *completepage =
"<html><body>The upload has been completed.</body></html>";
const char *errorpage =
"<html><body>This doesn't seem to be right.</body></html>";
const char *servererrorpage =
"<html><body>An internal server error has occured.</body></html>";
const char *fileexistspage =
"<html><body>This file already exists.</body></html>";
int
send_page (struct MHD_Connection *connection, const char *page,
int status_code)
{
int ret;
struct MHD_Response *response;
response =
MHD_create_response_from_data (strlen (page), (void *) page, MHD_NO,
MHD_YES);
if (!response)
return MHD_NO;
ret = MHD_queue_response (connection, status_code, response);
MHD_destroy_response (response);
return ret;
}
int
iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
const char *filename, const char *content_type,
const char *transfer_encoding, const char *data, uint64_t off,
size_t size)
{
FILE *fp;
struct connection_info_struct *con_info =
(struct connection_info_struct *) coninfo_cls;
con_info->answerstring = servererrorpage;
con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
if (0 != strcmp (key, "file"))
return MHD_NO;
if (!con_info->fp)
{
if (NULL != (fp = fopen (filename, "rb")))
{
fclose (fp);
con_info->answerstring = fileexistspage;
con_info->answercode = MHD_HTTP_FORBIDDEN;
return MHD_NO;
}
con_info->fp = fopen (filename, "ab");
if (!con_info->fp)
return MHD_NO;
}
if (size > 0)
{
if (!fwrite (data, size, sizeof (char), con_info->fp))
return MHD_NO;
}
con_info->answerstring = completepage;
con_info->answercode = MHD_HTTP_OK;
return MHD_YES;
}
void
request_completed (void *cls, struct MHD_Connection *connection,
void **con_cls, enum MHD_RequestTerminationCode toe)
{
struct connection_info_struct *con_info =
(struct connection_info_struct *) *con_cls;
if (NULL == con_info)
return;
if (con_info->connectiontype == POST)
{
if (NULL != con_info->postprocessor)
{
MHD_destroy_post_processor (con_info->postprocessor);
nr_of_uploading_clients--;
}
if (con_info->fp)
fclose (con_info->fp);
}
free (con_info);
*con_cls = NULL;
}
int
answer_to_connection (void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls)
{
if (NULL == *con_cls)
{
struct connection_info_struct *con_info;
if (nr_of_uploading_clients >= MAXCLIENTS)
return send_page (connection, busypage, MHD_HTTP_SERVICE_UNAVAILABLE);
con_info = malloc (sizeof (struct connection_info_struct));
if (NULL == con_info)
return MHD_NO;
con_info->fp = NULL;
if (0 == strcmp (method, "POST"))
{
con_info->postprocessor =
MHD_create_post_processor (connection, POSTBUFFERSIZE,
iterate_post, (void *) con_info);
if (NULL == con_info->postprocessor)
{
free (con_info);
return MHD_NO;
}
nr_of_uploading_clients++;
con_info->connectiontype = POST;
con_info->answercode = MHD_HTTP_OK;
con_info->answerstring = completepage;
}
else
con_info->connectiontype = GET;
*con_cls = (void *) con_info;
return MHD_YES;
}
if (0 == strcmp (method, "GET"))
{
int ret;
char buffer[1024] = { 0 };
sprintf (buffer, askpage, nr_of_uploading_clients);
return send_page (connection, buffer, MHD_HTTP_OK);
}
if (0 == strcmp (method, "POST"))
{
struct connection_info_struct *con_info = *con_cls;
if (0 != *upload_data_size)
{
MHD_post_process (con_info->postprocessor, upload_data,
*upload_data_size);
*upload_data_size = 0;
return MHD_YES;
}
else
return send_page (connection, con_info->answerstring,
con_info->answercode);
}
return send_page (connection, errorpage, MHD_HTTP_BAD_REQUEST);
}
int
main ()
{
struct MHD_Daemon *daemon;
daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL,
&answer_to_connection, NULL,
MHD_OPTION_NOTIFY_COMPLETED, request_completed,
NULL, MHD_OPTION_END);
if (NULL == daemon)
return 1;
getchar ();
MHD_stop_daemon (daemon);
return 0;
}
|
/*
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGAnimatedBoolean_h
#define SVGAnimatedBoolean_h
#if ENABLE(SVG)
#include "SVGAnimatedStaticPropertyTearOff.h"
namespace WebCore {
typedef SVGAnimatedStaticPropertyTearOff<bool> SVGAnimatedBoolean;
// Helper macros to declare/define a SVGAnimatedBoolean object
#define DECLARE_ANIMATED_BOOLEAN(UpperProperty, LowerProperty) \
DECLARE_ANIMATED_PROPERTY(SVGAnimatedBoolean, bool, UpperProperty, LowerProperty)
#define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedBoolean, bool, UpperProperty, LowerProperty)
} // namespace WebCore
#endif // ENABLE(SVG)
#endif
|
/*
* Copyright (c) 1995 X Consortium
* Copyright 2004 Red Hat Inc., Durham, North Carolina.
*
* 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 on 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
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT, THE X CONSORTIUM,
* AND/OR THEIR 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.
*
* Except as contained in this notice, the name of the X Consortium
* shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written
* authorization from the X Consortium.
*/
/*
* Derived from hw/xnest/Xnest.h by Rickard E. (Rik) Faith <faith@redhat.com>
*/
/** \file
* This file includes all client-side include files with proper wrapping.
*/
#ifndef _DMXCLIENT_H_
#define _DMXCLIENT_H_
#define GC XlibGC
#ifdef _XSERVER64
#define DMX64
#undef _XSERVER64
typedef unsigned long XID64;
typedef unsigned long Mask64;
typedef unsigned long Atom64;
typedef unsigned long VisualID64;
typedef unsigned long Time64;
#define XID XID64
#define Mask Mask64
#define Atom Atom64
#define VisualID VisualID64
#define Time Time64
typedef XID Window64;
typedef XID Drawable64;
typedef XID Font64;
typedef XID Pixmap64;
typedef XID Cursor64;
typedef XID Colormap64;
typedef XID GContext64;
typedef XID KeySym64;
#define Window Window64
#define Drawable Drawable64
#define Font Font64
#define Pixmap Pixmap64
#define Cursor Cursor64
#define Colormap Colormap64
#define GContext GContext64
#define KeySym KeySym64
#endif
#include <X11/Xlib.h>
#include <X11/Xlibint.h> /* For _XExtension */
#include <X11/X.h> /* from glxserver.h */
#include <X11/Xmd.h> /* from glxserver.h */
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/Xmu/SysUtil.h> /* For XmuSnprintf */
#include <X11/extensions/shape.h>
#include <X11/extensions/Xrender.h>
#undef PictFormatType
#include <X11/extensions/XKB.h>
#include "xkbstr.h"
#include <X11/extensions/XI.h>
/* Always include these, since we query them even if we don't export XINPUT. */
#include <X11/extensions/XInput.h> /* For XDevice */
#include <X11/extensions/Xext.h>
#undef GC
#ifdef DMX64
#define _XSERVER64
#undef XID
#undef Mask
#undef Atom
#undef VisualID
#undef Time
#undef Window
#undef Drawable
#undef Font
#undef Pixmap
#undef Cursor
#undef Colormap
#undef GContext
#undef KeySym
#endif
/* These are in exglobals.h, but that conflicts with xkbsrv.h */
extern int ProximityIn;
extern int ProximityOut;
extern int DeviceValuator;
extern int DeviceMotionNotify;
extern int DeviceFocusIn;
extern int DeviceFocusOut;
extern int DeviceStateNotify;
extern int DeviceMappingNotify;
extern int ChangeDeviceNotify;
/* Some protocol gets included last, after undefines. */
#include <X11/XKBlib.h>
#include <X11/extensions/XKBproto.h>
#include "xkbstr.h"
#undef XPointer
#include <X11/extensions/XIproto.h>
#endif
|
/*
Unix SMB/CIFS implementation.
SMB parameters and setup
Copyright (C) Andrew Tridgell 1992-1997
Copyright (C) Luke Kenneth Casson Leighton 1996-1997
Copyright (C) Paul Ashton 1997
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _DCE_RPC_H /* _DCE_RPC_H */
#define _DCE_RPC_H
/* Maximum size of the signing data in a fragment. */
#define RPC_MAX_SIGN_SIZE 0x38 /* 56 */
/* Maximum PDU fragment size. */
/* #define MAX_PDU_FRAG_LEN 0x1630 this is what wnt sets */
#define RPC_MAX_PDU_FRAG_LEN 0x10b8 /* this is what w2k sets */
#define RPC_HEADER_LEN 16
#define RPC_BIG_ENDIAN 1
#define RPC_LITTLE_ENDIAN 0
#endif /* _DCE_RPC_H */
|
/* SPDX-License-Identifier: GPL-2.0-only */
/****************************************************************************
* Driver for Solarflare network controllers and boards
* Copyright 2007-2013 Solarflare Communications Inc.
*/
#ifndef EFX_ENUM_H
#define EFX_ENUM_H
/**
* enum efx_loopback_mode - loopback modes
* @LOOPBACK_NONE: no loopback
* @LOOPBACK_DATA: data path loopback
* @LOOPBACK_GMAC: loopback within GMAC
* @LOOPBACK_XGMII: loopback after XMAC
* @LOOPBACK_XGXS: loopback within BPX after XGXS
* @LOOPBACK_XAUI: loopback within BPX before XAUI serdes
* @LOOPBACK_GMII: loopback within BPX after GMAC
* @LOOPBACK_SGMII: loopback within BPX within SGMII
* @LOOPBACK_XGBR: loopback within BPX within XGBR
* @LOOPBACK_XFI: loopback within BPX before XFI serdes
* @LOOPBACK_XAUI_FAR: loopback within BPX after XAUI serdes
* @LOOPBACK_GMII_FAR: loopback within BPX before SGMII
* @LOOPBACK_SGMII_FAR: loopback within BPX after SGMII
* @LOOPBACK_XFI_FAR: loopback after XFI serdes
* @LOOPBACK_GPHY: loopback within 1G PHY at unspecified level
* @LOOPBACK_PHYXS: loopback within 10G PHY at PHYXS level
* @LOOPBACK_PCS: loopback within 10G PHY at PCS level
* @LOOPBACK_PMAPMD: loopback within 10G PHY at PMAPMD level
* @LOOPBACK_XPORT: cross port loopback
* @LOOPBACK_XGMII_WS: wireside loopback excluding XMAC
* @LOOPBACK_XAUI_WS: wireside loopback within BPX within XAUI serdes
* @LOOPBACK_XAUI_WS_FAR: wireside loopback within BPX including XAUI serdes
* @LOOPBACK_XAUI_WS_NEAR: wireside loopback within BPX excluding XAUI serdes
* @LOOPBACK_GMII_WS: wireside loopback excluding GMAC
* @LOOPBACK_XFI_WS: wireside loopback excluding XFI serdes
* @LOOPBACK_XFI_WS_FAR: wireside loopback including XFI serdes
* @LOOPBACK_PHYXS_WS: wireside loopback within 10G PHY at PHYXS level
*/
/* Please keep up-to-date w.r.t the following two #defines */
enum efx_loopback_mode {
LOOPBACK_NONE = 0,
LOOPBACK_DATA = 1,
LOOPBACK_GMAC = 2,
LOOPBACK_XGMII = 3,
LOOPBACK_XGXS = 4,
LOOPBACK_XAUI = 5,
LOOPBACK_GMII = 6,
LOOPBACK_SGMII = 7,
LOOPBACK_XGBR = 8,
LOOPBACK_XFI = 9,
LOOPBACK_XAUI_FAR = 10,
LOOPBACK_GMII_FAR = 11,
LOOPBACK_SGMII_FAR = 12,
LOOPBACK_XFI_FAR = 13,
LOOPBACK_GPHY = 14,
LOOPBACK_PHYXS = 15,
LOOPBACK_PCS = 16,
LOOPBACK_PMAPMD = 17,
LOOPBACK_XPORT = 18,
LOOPBACK_XGMII_WS = 19,
LOOPBACK_XAUI_WS = 20,
LOOPBACK_XAUI_WS_FAR = 21,
LOOPBACK_XAUI_WS_NEAR = 22,
LOOPBACK_GMII_WS = 23,
LOOPBACK_XFI_WS = 24,
LOOPBACK_XFI_WS_FAR = 25,
LOOPBACK_PHYXS_WS = 26,
LOOPBACK_MAX
};
#define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
/* These loopbacks occur within the controller */
#define LOOPBACKS_INTERNAL ((1 << LOOPBACK_DATA) | \
(1 << LOOPBACK_GMAC) | \
(1 << LOOPBACK_XGMII)| \
(1 << LOOPBACK_XGXS) | \
(1 << LOOPBACK_XAUI) | \
(1 << LOOPBACK_GMII) | \
(1 << LOOPBACK_SGMII) | \
(1 << LOOPBACK_XGBR) | \
(1 << LOOPBACK_XFI) | \
(1 << LOOPBACK_XAUI_FAR) | \
(1 << LOOPBACK_GMII_FAR) | \
(1 << LOOPBACK_SGMII_FAR) | \
(1 << LOOPBACK_XFI_FAR) | \
(1 << LOOPBACK_XGMII_WS) | \
(1 << LOOPBACK_XAUI_WS) | \
(1 << LOOPBACK_XAUI_WS_FAR) | \
(1 << LOOPBACK_XAUI_WS_NEAR) | \
(1 << LOOPBACK_GMII_WS) | \
(1 << LOOPBACK_XFI_WS) | \
(1 << LOOPBACK_XFI_WS_FAR))
#define LOOPBACKS_WS ((1 << LOOPBACK_XGMII_WS) | \
(1 << LOOPBACK_XAUI_WS) | \
(1 << LOOPBACK_XAUI_WS_FAR) | \
(1 << LOOPBACK_XAUI_WS_NEAR) | \
(1 << LOOPBACK_GMII_WS) | \
(1 << LOOPBACK_XFI_WS) | \
(1 << LOOPBACK_XFI_WS_FAR) | \
(1 << LOOPBACK_PHYXS_WS))
#define LOOPBACKS_EXTERNAL(_efx) \
((_efx)->loopback_modes & ~LOOPBACKS_INTERNAL & \
~(1 << LOOPBACK_NONE))
#define LOOPBACK_MASK(_efx) \
(1 << (_efx)->loopback_mode)
#define LOOPBACK_INTERNAL(_efx) \
(!!(LOOPBACKS_INTERNAL & LOOPBACK_MASK(_efx)))
#define LOOPBACK_EXTERNAL(_efx) \
(!!(LOOPBACK_MASK(_efx) & LOOPBACKS_EXTERNAL(_efx)))
#define LOOPBACK_CHANGED(_from, _to, _mask) \
(!!((LOOPBACK_MASK(_from) ^ LOOPBACK_MASK(_to)) & (_mask)))
#define LOOPBACK_OUT_OF(_from, _to, _mask) \
((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask)))
/*****************************************************************************/
/**
* enum reset_type - reset types
*
* %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and
* %RESET_TYPE_DISABLE specify the method/scope of the reset. The
* other valuesspecify reasons, which efx_schedule_reset() will choose
* a method for.
*
* Reset methods are numbered in order of increasing scope.
*
* @RESET_TYPE_INVISIBLE: Reset datapath and MAC (Falcon only)
* @RESET_TYPE_RECOVER_OR_ALL: Try to recover. Apply RESET_TYPE_ALL
* if unsuccessful.
* @RESET_TYPE_ALL: Reset datapath, MAC and PHY
* @RESET_TYPE_WORLD: Reset as much as possible
* @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if
* unsuccessful.
* @RESET_TYPE_DATAPATH: Reset datapath only.
* @RESET_TYPE_MC_BIST: MC entering BIST mode.
* @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled
* @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
* @RESET_TYPE_INT_ERROR: reset due to internal error
* @RESET_TYPE_DMA_ERROR: DMA error
* @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
* @RESET_TYPE_MC_FAILURE: MC reboot/assertion
* @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout.
*/
enum reset_type {
RESET_TYPE_INVISIBLE,
RESET_TYPE_RECOVER_OR_ALL,
RESET_TYPE_ALL,
RESET_TYPE_WORLD,
RESET_TYPE_RECOVER_OR_DISABLE,
RESET_TYPE_DATAPATH,
RESET_TYPE_MC_BIST,
RESET_TYPE_DISABLE,
RESET_TYPE_MAX_METHOD,
RESET_TYPE_TX_WATCHDOG,
RESET_TYPE_INT_ERROR,
RESET_TYPE_DMA_ERROR,
RESET_TYPE_TX_SKIP,
RESET_TYPE_MC_FAILURE,
/* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but
* it doesn't fit the scope hierarchy (not well-ordered by inclusion).
* We encode this by having its enum value be greater than
* RESET_TYPE_MAX_METHOD.
*/
RESET_TYPE_MCDI_TIMEOUT,
RESET_TYPE_MAX,
};
#endif /* EFX_ENUM_H */
|
/*
* Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corporation
*
* Provide default implementations of the DMA mapping callbacks for
* directly mapped busses.
*/
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dma-debug.h>
#include <linux/gfp.h>
#include <linux/memblock.h>
#include <asm/bug.h>
#include <asm/abs_addr.h>
/*
* Generic direct DMA implementation
*
* This implementation supports a per-device offset that can be applied if
* the address at which memory is visible to devices is not 0. Platform code
* can set archdata.dma_data to an unsigned long holding the offset. By
* default the offset is PCI_DRAM_OFFSET.
*/
void *dma_direct_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
void *ret;
#ifdef CONFIG_NOT_COHERENT_CACHE
ret = __dma_alloc_coherent(dev, size, dma_handle, flag);
if (ret == NULL)
return NULL;
*dma_handle += get_dma_offset(dev);
return ret;
#else
struct page *page;
int node = dev_to_node(dev);
/* ignore region specifiers */
flag &= ~(__GFP_HIGHMEM);
page = alloc_pages_node(node, flag, get_order(size));
if (page == NULL)
return NULL;
ret = page_address(page);
memset(ret, 0, size);
*dma_handle = virt_to_abs(ret) + get_dma_offset(dev);
return ret;
#endif
}
void dma_direct_free_coherent(struct device *dev, size_t size,
void *vaddr, dma_addr_t dma_handle)
{
#ifdef CONFIG_NOT_COHERENT_CACHE
__dma_free_coherent(size, vaddr);
#else
free_pages((unsigned long)vaddr, get_order(size));
#endif
}
static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
int nents, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
struct scatterlist *sg;
int i;
for_each_sg(sgl, sg, nents, i) {
sg->dma_address = sg_phys(sg) + get_dma_offset(dev);
sg->dma_length = sg->length;
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}
return nents;
}
static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
}
static int dma_direct_dma_supported(struct device *dev, u64 mask)
{
#ifdef CONFIG_PPC64
/* Could be improved so platforms can set the limit in case
* they have limited DMA windows
*/
return mask >= (memblock_end_of_DRAM() - 1);
#else
return 1;
#endif
}
static inline dma_addr_t dma_direct_map_page(struct device *dev,
struct page *page,
unsigned long offset,
size_t size,
enum dma_data_direction dir,
struct dma_attrs *attrs)
{
BUG_ON(dir == DMA_NONE);
__dma_sync_page(page, offset, size, dir);
return page_to_phys(page) + offset + get_dma_offset(dev);
}
static inline void dma_direct_unmap_page(struct device *dev,
dma_addr_t dma_address,
size_t size,
enum dma_data_direction direction,
struct dma_attrs *attrs)
{
}
#ifdef CONFIG_NOT_COHERENT_CACHE
static inline void dma_direct_sync_sg(struct device *dev,
struct scatterlist *sgl, int nents,
enum dma_data_direction direction)
{
struct scatterlist *sg;
int i;
for_each_sg(sgl, sg, nents, i)
__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}
static inline void dma_direct_sync_single(struct device *dev,
dma_addr_t dma_handle, size_t size,
enum dma_data_direction direction)
{
__dma_sync(bus_to_virt(dma_handle), size, direction);
}
#endif
struct dma_map_ops dma_direct_ops = {
.alloc_coherent = dma_direct_alloc_coherent,
.free_coherent = dma_direct_free_coherent,
.map_sg = dma_direct_map_sg,
.unmap_sg = dma_direct_unmap_sg,
.dma_supported = dma_direct_dma_supported,
.map_page = dma_direct_map_page,
.unmap_page = dma_direct_unmap_page,
#ifdef CONFIG_NOT_COHERENT_CACHE
.sync_single_for_cpu = dma_direct_sync_single,
.sync_single_for_device = dma_direct_sync_single,
.sync_sg_for_cpu = dma_direct_sync_sg,
.sync_sg_for_device = dma_direct_sync_sg,
#endif
};
EXPORT_SYMBOL(dma_direct_ops);
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
static int __init dma_init(void)
{
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
return 0;
}
fs_initcall(dma_init);
|
#include QMK_KEYBOARD_H
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
#define _BL 0
#define _FL 1
#define _CL 2
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: Base Layer (Default Layer)
*/
[_BL] = LAYOUT(
KC_GESC,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_GRV, KC_BSPC, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_PGDN,
KC_CAPS,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_NUHS,KC_ENT,
KC_LSFT,KC_NUBS,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RO, KC_RSFT, KC_UP,
KC_LCTL,KC_LGUI,KC_LALT,KC_MHEN, KC_SPC, KC_SPC, KC_HENK,KC_RALT,MO(_FL),KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT),
/* Keymap _FL: Function Layer
*/
[_FL] = LAYOUT(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______,KC_DEL, KC_VOLU,
_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_MUTE, KC_VOLD,
_______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_PGUP,
_______,_______,_______,_______, _______,_______, _______,_______,MO(_FL),_______,KC_HOME,KC_PGDN,KC_END),
/* Keymap _CL: Control layer
*/
[_CL] = LAYOUT(
BL_STEP,RGB_M_P,RGB_M_B,RGB_M_R,RGB_M_SW,RGB_M_SN,RGB_M_K,RGB_M_X,RGB_M_G,_______,_______,_______,_______,_______,RGB_TOG, RGB_VAI,
_______,_______,_______,_______,RESET, _______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_VAD,
_______,_______,MO(_CL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
MO(_FL),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RGB_SAI,
_______,_______,_______,_______, RGB_MOD, RGB_MOD, _______,_______,MO(_FL),_______,RGB_HUD,RGB_SAD,RGB_HUI),
};
|
#ifndef __ARCH_PARISC_POSIX_TYPES_H
#define __ARCH_PARISC_POSIX_TYPES_H
/*
* This file is generally used by user-level software, so you need to
* be a little careful about namespace pollution etc. Also, we cannot
* assume GCC is being used.
*/
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
typedef long __kernel_off_t;
typedef int __kernel_pid_t;
typedef unsigned short __kernel_ipc_pid_t;
typedef unsigned int __kernel_uid_t;
typedef unsigned int __kernel_gid_t;
typedef int __kernel_suseconds_t;
typedef long __kernel_clock_t;
typedef int __kernel_timer_t;
typedef int __kernel_clockid_t;
typedef int __kernel_daddr_t;
/* Note these change from narrow to wide kernels */
#ifdef CONFIG_64BIT
typedef unsigned long __kernel_size_t;
typedef long __kernel_ssize_t;
typedef long __kernel_ptrdiff_t;
typedef long __kernel_time_t;
#else
typedef unsigned int __kernel_size_t;
typedef int __kernel_ssize_t;
typedef int __kernel_ptrdiff_t;
typedef long __kernel_time_t;
#endif
typedef char * __kernel_caddr_t;
typedef unsigned short __kernel_uid16_t;
typedef unsigned short __kernel_gid16_t;
typedef unsigned int __kernel_uid32_t;
typedef unsigned int __kernel_gid32_t;
#ifdef __GNUC__
typedef long long __kernel_loff_t;
typedef long long __kernel_off64_t;
typedef unsigned long long __kernel_ino64_t;
#endif
typedef unsigned int __kernel_old_dev_t;
typedef struct {
#if defined(__KERNEL__) || defined(__USE_ALL)
int val[2];
#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
int __val[2];
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
} __kernel_fsid_t;
/* compatibility stuff */
typedef __kernel_uid_t __kernel_old_uid_t;
typedef __kernel_gid_t __kernel_old_gid_t;
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
#undef __FD_SET
static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
{
unsigned long __tmp = __fd / __NFDBITS;
unsigned long __rem = __fd % __NFDBITS;
__fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
}
#undef __FD_CLR
static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
{
unsigned long __tmp = __fd / __NFDBITS;
unsigned long __rem = __fd % __NFDBITS;
__fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
}
#undef __FD_ISSET
static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
{
unsigned long __tmp = __fd / __NFDBITS;
unsigned long __rem = __fd % __NFDBITS;
return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
}
/*
* This will unroll the loop for the normal constant case (8 ints,
* for a 256-bit fd_set)
*/
#undef __FD_ZERO
static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
{
unsigned long *__tmp = __p->fds_bits;
int __i;
if (__builtin_constant_p(__FDSET_LONGS)) {
switch (__FDSET_LONGS) {
case 16:
__tmp[ 0] = 0; __tmp[ 1] = 0;
__tmp[ 2] = 0; __tmp[ 3] = 0;
__tmp[ 4] = 0; __tmp[ 5] = 0;
__tmp[ 6] = 0; __tmp[ 7] = 0;
__tmp[ 8] = 0; __tmp[ 9] = 0;
__tmp[10] = 0; __tmp[11] = 0;
__tmp[12] = 0; __tmp[13] = 0;
__tmp[14] = 0; __tmp[15] = 0;
return;
case 8:
__tmp[ 0] = 0; __tmp[ 1] = 0;
__tmp[ 2] = 0; __tmp[ 3] = 0;
__tmp[ 4] = 0; __tmp[ 5] = 0;
__tmp[ 6] = 0; __tmp[ 7] = 0;
return;
case 4:
__tmp[ 0] = 0; __tmp[ 1] = 0;
__tmp[ 2] = 0; __tmp[ 3] = 0;
return;
}
}
__i = __FDSET_LONGS;
while (__i) {
__i--;
*__tmp = 0;
__tmp++;
}
}
#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
#endif
|
/* Check calling convention in the vector ABI. */
/* { dg-do compile { target { s390*-*-* } } } */
/* { dg-options "-O3 -mzarch -march=z13" } */
/* Make sure the last argument is fetched from the argument overflow area. */
/* { dg-final { scan-assembler "vl\t%v\[0-9\]*,160\\(%r15\\)" { target lp64 } } } */
/* { dg-final { scan-assembler "vl\t%v\[0-9\]*,96\\(%r15\\)" { target ilp32 } } } */
/* { dg-final { scan-assembler "gnu_attribute 8, 2" } } */
typedef double v2df __attribute__((vector_size(16)));
v2df
add (v2df a, v2df b, v2df c, v2df d,
v2df e, v2df f, v2df g, v2df h, v2df i)
{
return a + b + c + d + e + f + g + h + i;
}
|
#ifndef EXTERN_H
#define EXTERN_H
/* -*-C-*-
********************************************************************************
*
* File: extern.h (Formerly extern.h)
* Description: External definitions for C or C++
* Author: Mark Seaman, OCR Technology
* Created: Tue Mar 20 14:01:22 1990
* Modified: Tue Mar 20 14:02:09 1990 (Mark Seaman) marks@hpgrlt
* Language: C
* Package: N/A
* Status: Experimental (Do Not Distribute)
*
* (c) Copyright 1990, Hewlett-Packard Company.
** 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.
*
********************************************************************************
*/
#define EXTERN extern
#endif
|
/* tls_test_c.c -- test TLS common symbol
Copyright 2008 Free Software Foundation, Inc.
Written by Ian Lance Taylor <iant@google.com>
This file is part of gold.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* The only way I know to get gcc to generate a TLS common symbol is
to use a C file and an OpenMP directive. */
#include "config.h"
#include <stdio.h>
#define CHECK_EQ_OR_RETURN(var, expected) \
do \
{ \
if ((var) != (expected)) \
{ \
printf(#var ": expected %d, found %d\n", expected, var); \
return 0; \
} \
} \
while (0)
#ifdef HAVE_OMP_SUPPORT
int v7;
#pragma omp threadprivate (v7)
#endif
int t11(void);
int t11_last(void);
int
t11(void)
{
#ifdef HAVE_OMP_SUPPORT
CHECK_EQ_OR_RETURN(v7, 0);
v7 = 70;
#endif
return 1;
}
int
t11_last(void)
{
#ifdef HAVE_OMP_SUPPORT
CHECK_EQ_OR_RETURN(v7, 70);
#endif
return 1;
}
|
/*
* Copyright (C) 2012 - Virtual Open Systems and Columbia University
* Author: Christoffer Dall <c.dall@virtualopensystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __ARM_KVM_EMULATE_H__
#define __ARM_KVM_EMULATE_H__
#include <linux/kvm_host.h>
#include <asm/kvm_asm.h>
#include <asm/kvm_mmio.h>
#include <asm/kvm_arm.h>
unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num);
unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu);
bool kvm_condition_valid(struct kvm_vcpu *vcpu);
void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr);
void kvm_inject_undefined(struct kvm_vcpu *vcpu);
void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
static inline bool vcpu_mode_is_32bit(struct kvm_vcpu *vcpu)
{
return 1;
}
static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
{
return &vcpu->arch.regs.usr_regs.ARM_pc;
}
static inline unsigned long *vcpu_cpsr(struct kvm_vcpu *vcpu)
{
return &vcpu->arch.regs.usr_regs.ARM_cpsr;
}
static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
{
*vcpu_cpsr(vcpu) |= PSR_T_BIT;
}
static inline bool mode_has_spsr(struct kvm_vcpu *vcpu)
{
unsigned long cpsr_mode = vcpu->arch.regs.usr_regs.ARM_cpsr & MODE_MASK;
return (cpsr_mode > USR_MODE && cpsr_mode < SYSTEM_MODE);
}
static inline bool vcpu_mode_priv(struct kvm_vcpu *vcpu)
{
unsigned long cpsr_mode = vcpu->arch.regs.usr_regs.ARM_cpsr & MODE_MASK;
return cpsr_mode > USR_MODE;;
}
static inline u32 kvm_vcpu_get_hsr(struct kvm_vcpu *vcpu)
{
return vcpu->arch.fault.hsr;
}
static inline unsigned long kvm_vcpu_get_hfar(struct kvm_vcpu *vcpu)
{
return vcpu->arch.fault.hxfar;
}
static inline phys_addr_t kvm_vcpu_get_fault_ipa(struct kvm_vcpu *vcpu)
{
return ((phys_addr_t)vcpu->arch.fault.hpfar & HPFAR_MASK) << 8;
}
static inline unsigned long kvm_vcpu_get_hyp_pc(struct kvm_vcpu *vcpu)
{
return vcpu->arch.fault.hyp_pc;
}
static inline bool kvm_vcpu_dabt_isvalid(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_ISV;
}
static inline bool kvm_vcpu_dabt_iswrite(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_WNR;
}
static inline bool kvm_vcpu_dabt_issext(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_SSE;
}
static inline int kvm_vcpu_dabt_get_rd(struct kvm_vcpu *vcpu)
{
return (kvm_vcpu_get_hsr(vcpu) & HSR_SRT_MASK) >> HSR_SRT_SHIFT;
}
static inline bool kvm_vcpu_dabt_isextabt(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_EA;
}
static inline bool kvm_vcpu_dabt_iss1tw(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_DABT_S1PTW;
}
/* Get Access Size from a data abort */
static inline int kvm_vcpu_dabt_get_as(struct kvm_vcpu *vcpu)
{
switch ((kvm_vcpu_get_hsr(vcpu) >> 22) & 0x3) {
case 0:
return 1;
case 1:
return 2;
case 2:
return 4;
default:
kvm_err("Hardware is weird: SAS 0b11 is reserved\n");
return -EFAULT;
}
}
/* This one is not specific to Data Abort */
static inline bool kvm_vcpu_trap_il_is32bit(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_IL;
}
static inline u8 kvm_vcpu_trap_get_class(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) >> HSR_EC_SHIFT;
}
static inline bool kvm_vcpu_trap_is_iabt(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_trap_get_class(vcpu) == HSR_EC_IABT;
}
static inline u8 kvm_vcpu_trap_get_fault(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_FSC_TYPE;
}
static inline u32 kvm_vcpu_hvc_get_imm(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK;
}
static inline unsigned long kvm_vcpu_get_mpidr(struct kvm_vcpu *vcpu)
{
return vcpu->arch.cp15[c0_MPIDR];
}
static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu)
{
*vcpu_cpsr(vcpu) |= PSR_E_BIT;
}
static inline bool kvm_vcpu_is_be(struct kvm_vcpu *vcpu)
{
return !!(*vcpu_cpsr(vcpu) & PSR_E_BIT);
}
static inline unsigned long vcpu_data_guest_to_host(struct kvm_vcpu *vcpu,
unsigned long data,
unsigned int len)
{
if (kvm_vcpu_is_be(vcpu)) {
switch (len) {
case 1:
return data & 0xff;
case 2:
return be16_to_cpu(data & 0xffff);
default:
return be32_to_cpu(data);
}
} else {
switch (len) {
case 1:
return data & 0xff;
case 2:
return le16_to_cpu(data & 0xffff);
default:
return le32_to_cpu(data);
}
}
}
static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu,
unsigned long data,
unsigned int len)
{
if (kvm_vcpu_is_be(vcpu)) {
switch (len) {
case 1:
return data & 0xff;
case 2:
return cpu_to_be16(data & 0xffff);
default:
return cpu_to_be32(data);
}
} else {
switch (len) {
case 1:
return data & 0xff;
case 2:
return cpu_to_le16(data & 0xffff);
default:
return cpu_to_le32(data);
}
}
}
#endif /* __ARM_KVM_EMULATE_H__ */
|
/* rtc-max6916.c
*
* Driver for MAXIM max6916 Low Current, SPI Compatible
* Real Time Clock
*
* Author : Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/rtc.h>
#include <linux/spi/spi.h>
#include <linux/bcd.h>
/* Registers in max6916 rtc */
#define MAX6916_SECONDS_REG 0x01
#define MAX6916_MINUTES_REG 0x02
#define MAX6916_HOURS_REG 0x03
#define MAX6916_DATE_REG 0x04
#define MAX6916_MONTH_REG 0x05
#define MAX6916_DAY_REG 0x06
#define MAX6916_YEAR_REG 0x07
#define MAX6916_CONTROL_REG 0x08
#define MAX6916_STATUS_REG 0x0C
#define MAX6916_CLOCK_BURST 0x3F
static int max6916_read_reg(struct device *dev, unsigned char address,
unsigned char *data)
{
struct spi_device *spi = to_spi_device(dev);
*data = address | 0x80;
return spi_write_then_read(spi, data, 1, data, 1);
}
static int max6916_write_reg(struct device *dev, unsigned char address,
unsigned char data)
{
struct spi_device *spi = to_spi_device(dev);
unsigned char buf[2];
buf[0] = address & 0x7F;
buf[1] = data;
return spi_write_then_read(spi, buf, 2, NULL, 0);
}
static int max6916_read_time(struct device *dev, struct rtc_time *dt)
{
struct spi_device *spi = to_spi_device(dev);
int err;
unsigned char buf[8];
buf[0] = MAX6916_CLOCK_BURST | 0x80;
err = spi_write_then_read(spi, buf, 1, buf, 8);
if (err)
return err;
dt->tm_sec = bcd2bin(buf[0]);
dt->tm_min = bcd2bin(buf[1]);
dt->tm_hour = bcd2bin(buf[2] & 0x3F);
dt->tm_mday = bcd2bin(buf[3]);
dt->tm_mon = bcd2bin(buf[4]) - 1;
dt->tm_wday = bcd2bin(buf[5]) - 1;
dt->tm_year = bcd2bin(buf[6]) + 100;
return 0;
}
static int max6916_set_time(struct device *dev, struct rtc_time *dt)
{
struct spi_device *spi = to_spi_device(dev);
unsigned char buf[9];
if (dt->tm_year < 100 || dt->tm_year > 199) {
dev_err(&spi->dev, "Year must be between 2000 and 2099. It's %d.\n",
dt->tm_year + 1900);
return -EINVAL;
}
buf[0] = MAX6916_CLOCK_BURST & 0x7F;
buf[1] = bin2bcd(dt->tm_sec);
buf[2] = bin2bcd(dt->tm_min);
buf[3] = (bin2bcd(dt->tm_hour) & 0X3F);
buf[4] = bin2bcd(dt->tm_mday);
buf[5] = bin2bcd(dt->tm_mon + 1);
buf[6] = bin2bcd(dt->tm_wday + 1);
buf[7] = bin2bcd(dt->tm_year % 100);
buf[8] = bin2bcd(0x00);
/* write the rtc settings */
return spi_write_then_read(spi, buf, 9, NULL, 0);
}
static const struct rtc_class_ops max6916_rtc_ops = {
.read_time = max6916_read_time,
.set_time = max6916_set_time,
};
static int max6916_probe(struct spi_device *spi)
{
struct rtc_device *rtc;
unsigned char data;
int res;
/* spi setup with max6916 in mode 3 and bits per word as 8 */
spi->mode = SPI_MODE_3;
spi->bits_per_word = 8;
spi_setup(spi);
/* RTC Settings */
res = max6916_read_reg(&spi->dev, MAX6916_SECONDS_REG, &data);
if (res)
return res;
/* Disable the write protect of rtc */
max6916_read_reg(&spi->dev, MAX6916_CONTROL_REG, &data);
data = data & ~(1 << 7);
max6916_write_reg(&spi->dev, MAX6916_CONTROL_REG, data);
/*Enable oscillator,disable oscillator stop flag, glitch filter*/
max6916_read_reg(&spi->dev, MAX6916_STATUS_REG, &data);
data = data & 0x1B;
max6916_write_reg(&spi->dev, MAX6916_STATUS_REG, data);
/* display the settings */
max6916_read_reg(&spi->dev, MAX6916_CONTROL_REG, &data);
dev_info(&spi->dev, "MAX6916 RTC CTRL Reg = 0x%02x\n", data);
max6916_read_reg(&spi->dev, MAX6916_STATUS_REG, &data);
dev_info(&spi->dev, "MAX6916 RTC Status Reg = 0x%02x\n", data);
rtc = devm_rtc_device_register(&spi->dev, "max6916",
&max6916_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc))
return PTR_ERR(rtc);
spi_set_drvdata(spi, rtc);
return 0;
}
static struct spi_driver max6916_driver = {
.driver = {
.name = "max6916",
},
.probe = max6916_probe,
};
module_spi_driver(max6916_driver);
MODULE_DESCRIPTION("MAX6916 SPI RTC DRIVER");
MODULE_AUTHOR("Venkat Prashanth B U <venkat.prashanth2498@gmail.com>");
MODULE_LICENSE("GPL v2");
|
//
// DDReceiveGroupAddMemberAPI.h
// Duoduo
//
// Created by 独嘉 on 14-5-8.
// Copyright (c) 2015年 MoguIM All rights reserved.
//
#import "DDUnrequestSuperAPI.h"
@interface DDReceiveGroupAddMemberAPI : DDUnrequestSuperAPI
@end
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
*/
#ifndef _ASM_PTRACE_H
#define _ASM_PTRACE_H
#include <linux/compiler.h>
#include <linux/linkage.h>
#include <linux/types.h>
#include <asm/isadep.h>
#include <asm/page.h>
#include <asm/thread_info.h>
#include <uapi/asm/ptrace.h>
/*
* This struct defines the way the registers are stored on the stack during a
* system call/exception. As usual the registers k0/k1 aren't being saved.
*
* If you add a register here, also add it to regoffset_table[] in
* arch/mips/kernel/ptrace.c.
*/
struct pt_regs {
#ifdef CONFIG_32BIT
/* Pad bytes for argument save space on the stack. */
unsigned long pad0[8];
#endif
/* Saved main processor registers. */
unsigned long regs[32];
/* Saved special registers. */
unsigned long cp0_status;
unsigned long hi;
unsigned long lo;
#ifdef CONFIG_CPU_HAS_SMARTMIPS
unsigned long acx;
#endif
unsigned long cp0_badvaddr;
unsigned long cp0_cause;
unsigned long cp0_epc;
#ifdef CONFIG_CPU_CAVIUM_OCTEON
unsigned long long mpl[6]; /* MTM{0-5} */
unsigned long long mtp[6]; /* MTP{0-5} */
#endif
unsigned long __last[0];
} __aligned(8);
static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
{
return regs->regs[29];
}
static inline void instruction_pointer_set(struct pt_regs *regs,
unsigned long val)
{
regs->cp0_epc = val;
}
/* Query offset/name of register from its name/offset */
extern int regs_query_register_offset(const char *name);
#define MAX_REG_OFFSET (offsetof(struct pt_regs, __last))
/**
* regs_get_register() - get register value from its offset
* @regs: pt_regs from which register value is gotten.
* @offset: offset number of the register.
*
* regs_get_register returns the value of a register. The @offset is the
* offset of the register in struct pt_regs address which specified by @regs.
* If @offset is bigger than MAX_REG_OFFSET, this returns 0.
*/
static inline unsigned long regs_get_register(struct pt_regs *regs,
unsigned int offset)
{
if (unlikely(offset > MAX_REG_OFFSET))
return 0;
return *(unsigned long *)((unsigned long)regs + offset);
}
/**
* regs_within_kernel_stack() - check the address in the stack
* @regs: pt_regs which contains kernel stack pointer.
* @addr: address which is checked.
*
* regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
* If @addr is within the kernel stack, it returns true. If not, returns false.
*/
static inline int regs_within_kernel_stack(struct pt_regs *regs,
unsigned long addr)
{
return ((addr & ~(THREAD_SIZE - 1)) ==
(kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
}
/**
* regs_get_kernel_stack_nth() - get Nth entry of the stack
* @regs: pt_regs which contains kernel stack pointer.
* @n: stack entry number.
*
* regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
* is specified by @regs. If the @n th entry is NOT in the kernel stack,
* this returns 0.
*/
static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
unsigned int n)
{
unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
addr += n;
if (regs_within_kernel_stack(regs, (unsigned long)addr))
return *addr;
else
return 0;
}
struct task_struct;
extern int ptrace_getregs(struct task_struct *child,
struct user_pt_regs __user *data);
extern int ptrace_setregs(struct task_struct *child,
struct user_pt_regs __user *data);
extern int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
extern int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
extern int ptrace_get_watch_regs(struct task_struct *child,
struct pt_watch_regs __user *addr);
extern int ptrace_set_watch_regs(struct task_struct *child,
struct pt_watch_regs __user *addr);
/*
* Does the process account for user or for system time?
*/
#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
static inline int is_syscall_success(struct pt_regs *regs)
{
return !regs->regs[7];
}
static inline long regs_return_value(struct pt_regs *regs)
{
if (is_syscall_success(regs) || !user_mode(regs))
return regs->regs[2];
else
return -regs->regs[2];
}
#define instruction_pointer(regs) ((regs)->cp0_epc)
#define profile_pc(regs) instruction_pointer(regs)
extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall);
extern asmlinkage void syscall_trace_leave(struct pt_regs *regs);
extern void die(const char *, struct pt_regs *) __noreturn;
static inline void die_if_kernel(const char *str, struct pt_regs *regs)
{
if (unlikely(!user_mode(regs)))
die(str, regs);
}
#define current_pt_regs() \
({ \
unsigned long sp = (unsigned long)__builtin_frame_address(0); \
(struct pt_regs *)((sp | (THREAD_SIZE - 1)) + 1 - 32) - 1; \
})
/* Helpers for working with the user stack pointer */
static inline unsigned long user_stack_pointer(struct pt_regs *regs)
{
return regs->regs[29];
}
static inline void user_stack_pointer_set(struct pt_regs *regs,
unsigned long val)
{
regs->regs[29] = val;
}
#endif /* _ASM_PTRACE_H */
|
/*
* IEEE 802.2 User Interface SAPs for Linux, data structures and indicators.
*
* Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>
*
* This program can be redistributed or modified under the terms of the
* GNU General Public License as published by the Free Software Foundation.
* This program is distributed without any warranty or implied warranty
* of merchantability or fitness for a particular purpose.
*
* See the GNU General Public License for more details.
*/
#ifndef _UAPI__LINUX_LLC_H
#define _UAPI__LINUX_LLC_H
#include <linux/socket.h>
#include <linux/if.h> /* For IFHWADDRLEN. */
#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */
struct sockaddr_llc {
__kernel_sa_family_t sllc_family; /* AF_LLC */
__kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */
unsigned char sllc_test;
unsigned char sllc_xid;
unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */
unsigned char sllc_sap;
unsigned char sllc_mac[IFHWADDRLEN];
unsigned char __pad[__LLC_SOCK_SIZE__ -
sizeof(__kernel_sa_family_t) * 2 -
sizeof(unsigned char) * 4 - IFHWADDRLEN];
};
/* sockopt definitions. */
enum llc_sockopts {
LLC_OPT_UNKNOWN = 0,
LLC_OPT_RETRY, /* max retrans attempts. */
LLC_OPT_SIZE, /* max PDU size (octets). */
LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */
LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */
LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */
LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */
LLC_OPT_TX_WIN, /* tx window size. */
LLC_OPT_RX_WIN, /* rx window size. */
LLC_OPT_PKTINFO, /* ancillary packet information. */
LLC_OPT_MAX
};
#define LLC_OPT_MAX_RETRY 100
#define LLC_OPT_MAX_SIZE 4196
#define LLC_OPT_MAX_WIN 127
#define LLC_OPT_MAX_ACK_TMR_EXP 60
#define LLC_OPT_MAX_P_TMR_EXP 60
#define LLC_OPT_MAX_REJ_TMR_EXP 60
#define LLC_OPT_MAX_BUSY_TMR_EXP 60
/* LLC SAP types. */
#define LLC_SAP_NULL 0x00 /* NULL SAP. */
#define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */
#define LLC_SAP_SNA 0x04 /* SNA Path Control. */
#define LLC_SAP_PNM 0x0E /* Proway Network Management. */
#define LLC_SAP_IP 0x06 /* TCP/IP. */
#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */
#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */
#define LLC_SAP_8208 0x7E /* ISO 8208 */
#define LLC_SAP_3COM 0x80 /* 3COM. */
#define LLC_SAP_PRO 0x8E /* Proway Active Station List */
#define LLC_SAP_SNAP 0xAA /* SNAP. */
#define LLC_SAP_BANYAN 0xBC /* Banyan. */
#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */
#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */
#define LLC_SAP_LANMGR 0xF4 /* LanManager. */
#define LLC_SAP_IMPL 0xF8 /* IMPL */
#define LLC_SAP_DISC 0xFC /* Discovery */
#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */
#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */
#define LLC_SAP_RM 0xD4 /* Resource Management */
#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */
struct llc_pktinfo {
int lpi_ifindex;
unsigned char lpi_sap;
unsigned char lpi_mac[IFHWADDRLEN];
};
#endif /* _UAPI__LINUX_LLC_H */
|
/*
* arch/arm/mach-kirkwood/addr-map.c
*
* Address map functions for Marvell Kirkwood SoCs
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/mbus.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <plat/addr-map.h>
#include "common.h"
/*
* Generic Address Decode Windows bit settings
*/
#define TARGET_DEV_BUS 1
#define TARGET_SRAM 3
#define TARGET_PCIE 4
#define ATTR_DEV_SPI_ROM 0x1e
#define ATTR_DEV_BOOT 0x1d
#define ATTR_DEV_NAND 0x2f
#define ATTR_DEV_CS3 0x37
#define ATTR_DEV_CS2 0x3b
#define ATTR_DEV_CS1 0x3d
#define ATTR_DEV_CS0 0x3e
#define ATTR_PCIE_IO 0xe0
#define ATTR_PCIE_MEM 0xe8
#define ATTR_PCIE1_IO 0xd0
#define ATTR_PCIE1_MEM 0xd8
#define ATTR_SRAM 0x01
/*
* Description of the windows needed by the platform code
*/
static struct __initdata orion_addr_map_cfg addr_map_cfg = {
.num_wins = 8,
.remappable_wins = 4,
.bridge_virt_base = BRIDGE_VIRT_BASE,
};
static const struct __initdata orion_addr_map_info addr_map_info[] = {
/*
* Windows for PCIe IO+MEM space.
*/
{ 0, KIRKWOOD_PCIE_IO_PHYS_BASE, KIRKWOOD_PCIE_IO_SIZE,
TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE
},
{ 1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE,
TARGET_PCIE, ATTR_PCIE_MEM, KIRKWOOD_PCIE_MEM_BUS_BASE
},
{ 2, KIRKWOOD_PCIE1_IO_PHYS_BASE, KIRKWOOD_PCIE1_IO_SIZE,
TARGET_PCIE, ATTR_PCIE1_IO, KIRKWOOD_PCIE1_IO_BUS_BASE
},
{ 3, KIRKWOOD_PCIE1_MEM_PHYS_BASE, KIRKWOOD_PCIE1_MEM_SIZE,
TARGET_PCIE, ATTR_PCIE1_MEM, KIRKWOOD_PCIE1_MEM_BUS_BASE
},
/*
* Window for NAND controller.
*/
{ 4, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE,
TARGET_DEV_BUS, ATTR_DEV_NAND, -1
},
/*
* Window for SRAM.
*/
{ 5, KIRKWOOD_SRAM_PHYS_BASE, KIRKWOOD_SRAM_SIZE,
TARGET_SRAM, ATTR_SRAM, -1
},
/* End marker */
{ -1, 0, 0, 0, 0, 0 }
};
void __init kirkwood_setup_cpu_mbus(void)
{
/*
* Disable, clear and configure windows.
*/
orion_config_wins(&addr_map_cfg, addr_map_info);
/*
* Setup MBUS dram target info.
*/
orion_setup_cpu_mbus_target(&addr_map_cfg, DDR_WINDOW_CPU_BASE);
}
|
/*
* clk-h32mx.c
*
* Copyright (C) 2014 Atmel
*
* Alexandre Belloni <alexandre.belloni@free-electrons.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/clk/at91_pmc.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include "pmc.h"
#define H32MX_MAX_FREQ 90000000
struct clk_sama5d4_h32mx {
struct clk_hw hw;
struct regmap *regmap;
};
#define to_clk_sama5d4_h32mx(hw) container_of(hw, struct clk_sama5d4_h32mx, hw)
static unsigned long clk_sama5d4_h32mx_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw);
unsigned int mckr;
regmap_read(h32mxclk->regmap, AT91_PMC_MCKR, &mckr);
if (mckr & AT91_PMC_H32MXDIV)
return parent_rate / 2;
if (parent_rate > H32MX_MAX_FREQ)
pr_warn("H32MX clock is too fast\n");
return parent_rate;
}
static long clk_sama5d4_h32mx_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
unsigned long div;
if (rate > *parent_rate)
return *parent_rate;
div = *parent_rate / 2;
if (rate < div)
return div;
if (rate - div < *parent_rate - rate)
return div;
return *parent_rate;
}
static int clk_sama5d4_h32mx_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_sama5d4_h32mx *h32mxclk = to_clk_sama5d4_h32mx(hw);
u32 mckr = 0;
if (parent_rate != rate && (parent_rate / 2) != rate)
return -EINVAL;
if ((parent_rate / 2) == rate)
mckr = AT91_PMC_H32MXDIV;
regmap_update_bits(h32mxclk->regmap, AT91_PMC_MCKR,
AT91_PMC_H32MXDIV, mckr);
return 0;
}
static const struct clk_ops h32mx_ops = {
.recalc_rate = clk_sama5d4_h32mx_recalc_rate,
.round_rate = clk_sama5d4_h32mx_round_rate,
.set_rate = clk_sama5d4_h32mx_set_rate,
};
static void __init of_sama5d4_clk_h32mx_setup(struct device_node *np)
{
struct clk_sama5d4_h32mx *h32mxclk;
struct clk_init_data init;
const char *parent_name;
struct regmap *regmap;
struct clk *clk;
regmap = syscon_node_to_regmap(of_get_parent(np));
if (IS_ERR(regmap))
return;
h32mxclk = kzalloc(sizeof(*h32mxclk), GFP_KERNEL);
if (!h32mxclk)
return;
parent_name = of_clk_get_parent_name(np, 0);
init.name = np->name;
init.ops = &h32mx_ops;
init.parent_names = parent_name ? &parent_name : NULL;
init.num_parents = parent_name ? 1 : 0;
init.flags = CLK_SET_RATE_GATE;
h32mxclk->hw.init = &init;
h32mxclk->regmap = regmap;
clk = clk_register(NULL, &h32mxclk->hw);
if (IS_ERR(clk)) {
kfree(h32mxclk);
return;
}
of_clk_add_provider(np, of_clk_src_simple_get, clk);
}
CLK_OF_DECLARE(of_sama5d4_clk_h32mx_setup, "atmel,sama5d4-clk-h32mx",
of_sama5d4_clk_h32mx_setup);
|
/* Linux epoll(2) based ae.c module
*
* Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/epoll.h>
typedef struct aeApiState {
int epfd;
struct epoll_event *events;
} aeApiState;
static int aeApiCreate(aeEventLoop *eventLoop) {
aeApiState *state = zmalloc(sizeof(aeApiState));
if (!state) return -1;
state->events = zmalloc(sizeof(struct epoll_event)*eventLoop->setsize);
if (!state->events) {
zfree(state);
return -1;
}
state->epfd = epoll_create(1024); /* 1024 is just a hint for the kernel */
if (state->epfd == -1) {
zfree(state->events);
zfree(state);
return -1;
}
eventLoop->apidata = state;
return 0;
}
static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
aeApiState *state = eventLoop->apidata;
state->events = zrealloc(state->events, sizeof(struct epoll_event)*setsize);
return 0;
}
static void aeApiFree(aeEventLoop *eventLoop) {
aeApiState *state = eventLoop->apidata;
close(state->epfd);
zfree(state->events);
zfree(state);
}
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
aeApiState *state = eventLoop->apidata;
struct epoll_event ee = {0}; /* avoid valgrind warning */
/* If the fd was already monitored for some event, we need a MOD
* operation. Otherwise we need an ADD operation. */
int op = eventLoop->events[fd].mask == AE_NONE ?
EPOLL_CTL_ADD : EPOLL_CTL_MOD;
ee.events = 0;
mask |= eventLoop->events[fd].mask; /* Merge old events */
if (mask & AE_READABLE) ee.events |= EPOLLIN;
if (mask & AE_WRITABLE) ee.events |= EPOLLOUT;
ee.data.fd = fd;
if (epoll_ctl(state->epfd,op,fd,&ee) == -1) return -1;
return 0;
}
static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int delmask) {
aeApiState *state = eventLoop->apidata;
struct epoll_event ee = {0}; /* avoid valgrind warning */
int mask = eventLoop->events[fd].mask & (~delmask);
ee.events = 0;
if (mask & AE_READABLE) ee.events |= EPOLLIN;
if (mask & AE_WRITABLE) ee.events |= EPOLLOUT;
ee.data.fd = fd;
if (mask != AE_NONE) {
epoll_ctl(state->epfd,EPOLL_CTL_MOD,fd,&ee);
} else {
/* Note, Kernel < 2.6.9 requires a non null event pointer even for
* EPOLL_CTL_DEL. */
epoll_ctl(state->epfd,EPOLL_CTL_DEL,fd,&ee);
}
}
static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
aeApiState *state = eventLoop->apidata;
int retval, numevents = 0;
retval = epoll_wait(state->epfd,state->events,eventLoop->setsize,
tvp ? (tvp->tv_sec*1000 + tvp->tv_usec/1000) : -1);
if (retval > 0) {
int j;
numevents = retval;
for (j = 0; j < numevents; j++) {
int mask = 0;
struct epoll_event *e = state->events+j;
if (e->events & EPOLLIN) mask |= AE_READABLE;
if (e->events & EPOLLOUT) mask |= AE_WRITABLE;
if (e->events & EPOLLERR) mask |= AE_WRITABLE;
if (e->events & EPOLLHUP) mask |= AE_WRITABLE;
eventLoop->fired[j].fd = e->data.fd;
eventLoop->fired[j].mask = mask;
}
}
return numevents;
}
static char *aeApiName(void) {
return "epoll";
}
|
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "config_common.h"
#ifdef AUDIO_ENABLE
#define STARTUP_SONG SONG(PLANCK_SOUND)
// #define STARTUP_SONG SONG(NO_SOUND)
#define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
SONG(COLEMAK_SOUND), \
SONG(DVORAK_SOUND) \
}
#endif
#define MUSIC_MASK (keycode != KC_NO)
/*
* MIDI options
*/
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
#define MIDI_BASIC
/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 2
#endif
|
/* -mlong-double-64 compatibility mode for <wchar.h> functions.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _WCHAR_H
# error "Never include <bits/wchar-ldbl.h> directly; use <wchar.h> instead."
#endif
#if defined __USE_ISOC95 || defined __USE_UNIX98
__BEGIN_NAMESPACE_C99
__LDBL_REDIR_DECL (fwprintf);
__LDBL_REDIR_DECL (wprintf);
__LDBL_REDIR_DECL (swprintf);
__LDBL_REDIR_DECL (vfwprintf);
__LDBL_REDIR_DECL (vwprintf);
__LDBL_REDIR_DECL (vswprintf);
# if defined __USE_ISOC99 && !defined __USE_GNU \
&& !defined __REDIRECT \
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
__LDBL_REDIR1_DECL (fwscanf, __nldbl___isoc99_fwscanf)
__LDBL_REDIR1_DECL (wscanf, __nldbl___isoc99_wscanf)
__LDBL_REDIR1_DECL (swscanf, __nldbl___isoc99_swscanf)
# else
__LDBL_REDIR_DECL (fwscanf);
__LDBL_REDIR_DECL (wscanf);
__LDBL_REDIR_DECL (swscanf);
# endif
__END_NAMESPACE_C99
#endif
#ifdef __USE_ISOC99
__BEGIN_NAMESPACE_C99
__LDBL_REDIR1_DECL (wcstold, wcstod);
# if !defined __USE_GNU && !defined __REDIRECT \
&& (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
__LDBL_REDIR1_DECL (vfwscanf, __nldbl___isoc99_vfwscanf)
__LDBL_REDIR1_DECL (vwscanf, __nldbl___isoc99_vwscanf)
__LDBL_REDIR1_DECL (vswscanf, __nldbl___isoc99_vswscanf)
# else
__LDBL_REDIR_DECL (vfwscanf);
__LDBL_REDIR_DECL (vwscanf);
__LDBL_REDIR_DECL (vswscanf);
# endif
__END_NAMESPACE_C99
#endif
#ifdef __USE_GNU
__LDBL_REDIR1_DECL (wcstold_l, wcstod_l);
#endif
#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
__LDBL_REDIR_DECL (__swprintf_chk)
__LDBL_REDIR_DECL (__vswprintf_chk)
# if __USE_FORTIFY_LEVEL > 1
__LDBL_REDIR_DECL (__fwprintf_chk)
__LDBL_REDIR_DECL (__wprintf_chk)
__LDBL_REDIR_DECL (__vfwprintf_chk)
__LDBL_REDIR_DECL (__vwprintf_chk)
# endif
#endif
|
/****************************************************************************
Copyright (c) 2010 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 __CCGL_H__
#define __CCGL_H__
#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
#include "GL/glew.h"
#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
#endif // __CCGL_H__
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef _SDL_dummyaudio_h
#define _SDL_dummyaudio_h
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData
{
/* The file descriptor for the audio device */
Uint8 *mixbuf;
Uint32 mixlen;
Uint32 write_delay;
Uint32 initial_calls;
};
#endif /* _SDL_dummyaudio_h */
/* vi: set ts=4 sw=4 expandtab: */
|
/* exynos_drm_crtc.c
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Authors:
* Inki Dae <inki.dae@samsung.com>
* Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@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.
*/
#include <drm/drmP.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include "exynos_drm_crtc.h"
#include "exynos_drm_drv.h"
#include "exynos_drm_plane.h"
static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
if (exynos_crtc->ops->enable)
exynos_crtc->ops->enable(exynos_crtc);
drm_crtc_vblank_on(crtc);
}
static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
drm_crtc_vblank_off(crtc);
if (exynos_crtc->ops->disable)
exynos_crtc->ops->disable(exynos_crtc);
}
static void
exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
if (exynos_crtc->ops->commit)
exynos_crtc->ops->commit(exynos_crtc);
}
static int exynos_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
if (!state->enable)
return 0;
if (exynos_crtc->ops->atomic_check)
return exynos_crtc->ops->atomic_check(exynos_crtc, state);
return 0;
}
static void exynos_crtc_atomic_begin(struct drm_crtc *crtc,
struct drm_crtc_state *old_crtc_state)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
if (exynos_crtc->ops->atomic_begin)
exynos_crtc->ops->atomic_begin(exynos_crtc);
}
static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
struct drm_crtc_state *old_crtc_state)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct drm_pending_vblank_event *event;
unsigned long flags;
if (exynos_crtc->ops->atomic_flush)
exynos_crtc->ops->atomic_flush(exynos_crtc);
event = crtc->state->event;
if (event) {
crtc->state->event = NULL;
spin_lock_irqsave(&crtc->dev->event_lock, flags);
if (drm_crtc_vblank_get(crtc) == 0)
drm_crtc_arm_vblank_event(crtc, event);
else
drm_crtc_send_vblank_event(crtc, event);
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
}
}
static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
.enable = exynos_drm_crtc_enable,
.disable = exynos_drm_crtc_disable,
.mode_set_nofb = exynos_drm_crtc_mode_set_nofb,
.atomic_check = exynos_crtc_atomic_check,
.atomic_begin = exynos_crtc_atomic_begin,
.atomic_flush = exynos_crtc_atomic_flush,
};
static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct exynos_drm_private *private = crtc->dev->dev_private;
private->crtc[exynos_crtc->pipe] = NULL;
drm_crtc_cleanup(crtc);
kfree(exynos_crtc);
}
static const struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip,
.destroy = exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
};
struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
struct drm_plane *plane,
int pipe,
enum exynos_drm_output_type type,
const struct exynos_drm_crtc_ops *ops,
void *ctx)
{
struct exynos_drm_crtc *exynos_crtc;
struct exynos_drm_private *private = drm_dev->dev_private;
struct drm_crtc *crtc;
int ret;
exynos_crtc = kzalloc(sizeof(*exynos_crtc), GFP_KERNEL);
if (!exynos_crtc)
return ERR_PTR(-ENOMEM);
exynos_crtc->pipe = pipe;
exynos_crtc->type = type;
exynos_crtc->ops = ops;
exynos_crtc->ctx = ctx;
crtc = &exynos_crtc->base;
private->crtc[pipe] = crtc;
ret = drm_crtc_init_with_planes(drm_dev, crtc, plane, NULL,
&exynos_crtc_funcs, NULL);
if (ret < 0)
goto err_crtc;
drm_crtc_helper_add(crtc, &exynos_crtc_helper_funcs);
return exynos_crtc;
err_crtc:
plane->funcs->destroy(plane);
kfree(exynos_crtc);
return ERR_PTR(ret);
}
int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev,
pipe);
if (exynos_crtc->ops->enable_vblank)
return exynos_crtc->ops->enable_vblank(exynos_crtc);
return 0;
}
void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev,
pipe);
if (exynos_crtc->ops->disable_vblank)
exynos_crtc->ops->disable_vblank(exynos_crtc);
}
int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev,
enum exynos_drm_output_type out_type)
{
struct drm_crtc *crtc;
list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) {
struct exynos_drm_crtc *exynos_crtc;
exynos_crtc = to_exynos_crtc(crtc);
if (exynos_crtc->type == out_type)
return exynos_crtc->pipe;
}
return -EPERM;
}
void exynos_drm_crtc_te_handler(struct drm_crtc *crtc)
{
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
if (exynos_crtc->ops->te_handler)
exynos_crtc->ops->te_handler(exynos_crtc);
}
void exynos_drm_crtc_cancel_page_flip(struct drm_crtc *crtc,
struct drm_file *file)
{
struct drm_pending_vblank_event *e;
unsigned long flags;
spin_lock_irqsave(&crtc->dev->event_lock, flags);
e = crtc->state->event;
if (e && e->base.file_priv == file)
crtc->state->event = NULL;
else
e = NULL;
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
if (e)
drm_event_cancel_free(crtc->dev, &e->base);
}
|
/* { dg-do compile} */
/* { dg-options "-fsanitize=shift -w" } */
/* { dg-shouldfail "ubsan" } */
int x;
int
main (void)
{
/* None of the following should pass. */
int A[1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
int B[-1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
int D[1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
int E[-1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
int F[-1 >> 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
int G[1 << 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
return 0;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// We would like to allow "util" collection classes to be usable both
// from the VM and from the JIT. The latter case presents a
// difficulty, because in the (x86, soon to be cross-platform) JIT
// compiler, we require allocation to be done using a "no-release"
// (aka, arena-style) allocator that is provided as methods of the
// JIT's Compiler type.
// To allow utilcode collection classes to deal with this, they may be
// written to do allocation and freeing via an instance of the
// "IAllocator" class defined in this file.
//
#ifndef _IALLOCATOR_DEFINED_
#define _IALLOCATOR_DEFINED_
#include "contract.h"
#include "safemath.h"
class IAllocator
{
public:
virtual void* Alloc(size_t sz) = 0;
// Allocate space for an array of "elems" elements, each of size "elemSize".
virtual void* ArrayAlloc(size_t elems, size_t elemSize) = 0;
virtual void Free(void* p) = 0;
};
// This class wraps an allocator that does not allow zero-length allocations,
// producing one that does (every zero-length allocation produces a pointer to the same
// statically-allocated memory, and freeing that pointer is a no-op).
class AllowZeroAllocator: public IAllocator
{
int m_zeroLenAllocTarg;
IAllocator* m_alloc;
public:
AllowZeroAllocator(IAllocator* alloc) : m_alloc(alloc) {}
void* Alloc(size_t sz)
{
if (sz == 0)
{
return (void*)(&m_zeroLenAllocTarg);
}
else
{
return m_alloc->Alloc(sz);
}
}
void* ArrayAlloc(size_t elemSize, size_t numElems)
{
if (elemSize == 0 || numElems == 0)
{
return (void*)(&m_zeroLenAllocTarg);
}
else
{
return m_alloc->ArrayAlloc(elemSize, numElems);
}
}
virtual void Free(void * p)
{
if (p != (void*)(&m_zeroLenAllocTarg))
{
m_alloc->Free(p);
}
}
};
#endif // _IALLOCATOR_DEFINED_
|
/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __MFD_TABLA_PDATA_H__
#define __MFD_TABLA_PDATA_H__
#include <linux/slimbus/slimbus.h>
#define MICBIAS_EXT_BYP_CAP 0x00
#define MICBIAS_NO_EXT_BYP_CAP 0x01
#define SITAR_LDOH_1P95_V 0x0
#define SITAR_LDOH_2P35_V 0x1
#define SITAR_LDOH_2P75_V 0x2
#define SITAR_LDOH_2P85_V 0x3
#define SITAR_CFILT1_SEL 0x0
#define SITAR_CFILT2_SEL 0x1
#define SITAR_CFILT3_SEL 0x2
#define TABLA_LDOH_1P95_V 0x0
#define TABLA_LDOH_2P35_V 0x1
#define TABLA_LDOH_2P75_V 0x2
#define TABLA_LDOH_2P85_V 0x3
#define TABLA_CFILT1_SEL 0x0
#define TABLA_CFILT2_SEL 0x1
#define TABLA_CFILT3_SEL 0x2
#define TAIKO_CFILT1_SEL 0x0
#define TAIKO_CFILT2_SEL 0x1
#define TAIKO_CFILT3_SEL 0x2
#define TAIKO_LDOH_1P95_V 0x0
#define TAIKO_LDOH_2P35_V 0x1
#define TAIKO_LDOH_2P75_V 0x2
#define TAIKO_LDOH_2P85_V 0x3
#define MAX_AMIC_CHANNEL 7
#define TABLA_OCP_300_MA 0x0
#define TABLA_OCP_350_MA 0x2
#define TABLA_OCP_365_MA 0x3
#define TABLA_OCP_150_MA 0x4
#define TABLA_OCP_190_MA 0x6
#define TABLA_OCP_220_MA 0x7
#define TABLA_DCYCLE_255 0x0
#define TABLA_DCYCLE_511 0x1
#define TABLA_DCYCLE_767 0x2
#define TABLA_DCYCLE_1023 0x3
#define TABLA_DCYCLE_1279 0x4
#define TABLA_DCYCLE_1535 0x5
#define TABLA_DCYCLE_1791 0x6
#define TABLA_DCYCLE_2047 0x7
#define TABLA_DCYCLE_2303 0x8
#define TABLA_DCYCLE_2559 0x9
#define TABLA_DCYCLE_2815 0xA
#define TABLA_DCYCLE_3071 0xB
#define TABLA_DCYCLE_3327 0xC
#define TABLA_DCYCLE_3583 0xD
#define TABLA_DCYCLE_3839 0xE
#define TABLA_DCYCLE_4095 0xF
struct wcd9xxx_amic {
/*legacy mode, txfe_enable and txfe_buff take 7 input
* each bit represent the channel / TXFE number
* and numbered as below
* bit 0 = channel 1 / TXFE1_ENABLE / TXFE1_BUFF
* bit 1 = channel 2 / TXFE2_ENABLE / TXFE2_BUFF
* ...
* bit 7 = channel 7 / TXFE7_ENABLE / TXFE7_BUFF
*/
u8 legacy_mode:MAX_AMIC_CHANNEL;
u8 txfe_enable:MAX_AMIC_CHANNEL;
u8 txfe_buff:MAX_AMIC_CHANNEL;
u8 use_pdata:MAX_AMIC_CHANNEL;
};
/* Each micbias can be assigned to one of three cfilters
* Vbatt_min >= .15V + ldoh_v
* ldoh_v >= .15v + cfiltx_mv
* If ldoh_v = 1.95 160 mv < cfiltx_mv < 1800 mv
* If ldoh_v = 2.35 200 mv < cfiltx_mv < 2200 mv
* If ldoh_v = 2.75 240 mv < cfiltx_mv < 2600 mv
* If ldoh_v = 2.85 250 mv < cfiltx_mv < 2700 mv
*/
struct wcd9xxx_micbias_setting {
u8 ldoh_v;
u32 cfilt1_mv; /* in mv */
u32 cfilt2_mv; /* in mv */
u32 cfilt3_mv; /* in mv */
/* Different WCD9xxx series codecs may not
* have 4 mic biases. If a codec has fewer
* mic biases, some of these properties will
* not be used.
*/
u8 bias1_cfilt_sel;
u8 bias2_cfilt_sel;
u8 bias3_cfilt_sel;
u8 bias4_cfilt_sel;
u8 bias1_cap_mode;
u8 bias2_cap_mode;
u8 bias3_cap_mode;
u8 bias4_cap_mode;
};
struct wcd9xxx_ocp_setting {
unsigned int use_pdata:1; /* 0 - use sys default as recommended */
unsigned int num_attempts:4; /* up to 15 attempts */
unsigned int run_time:4; /* in duty cycle */
unsigned int wait_time:4; /* in duty cycle */
unsigned int hph_ocp_limit:3; /* Headphone OCP current limit */
};
#define MAX_REGULATOR 7
/*
* format : TABLA_<POWER_SUPPLY_PIN_NAME>_CUR_MAX
*
* <POWER_SUPPLY_PIN_NAME> from Tabla objective spec
*/
#define WCD9XXX_CDC_VDDA_CP_CUR_MAX 500000
#define WCD9XXX_CDC_VDDA_RX_CUR_MAX 20000
#define WCD9XXX_CDC_VDDA_TX_CUR_MAX 20000
#define WCD9XXX_VDDIO_CDC_CUR_MAX 5000
#define WCD9XXX_VDDD_CDC_D_CUR_MAX 5000
#define WCD9XXX_VDDD_CDC_A_CUR_MAX 5000
struct wcd9xxx_regulator {
const char *name;
int min_uV;
int max_uV;
int optimum_uA;
struct regulator *regulator;
};
struct wcd9xxx_pdata {
int irq;
int irq_base;
int num_irqs;
int reset_gpio;
struct wcd9xxx_amic amic_settings;
struct slim_device slimbus_slave_device;
struct wcd9xxx_micbias_setting micbias;
struct wcd9xxx_ocp_setting ocp;
struct wcd9xxx_regulator regulator[MAX_REGULATOR];
};
#endif
|
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DFGRegisterSet_h
#define DFGRegisterSet_h
#include <wtf/Platform.h>
#if ENABLE(DFG_JIT)
#include "DFGFPRInfo.h"
#include "DFGGPRInfo.h"
#include <wtf/Bitmap.h>
namespace JSC { namespace DFG {
static const unsigned totalNumberOfRegisters =
GPRInfo::numberOfRegisters + FPRInfo::numberOfRegisters;
static const unsigned numberOfBytesInRegisterSet =
(totalNumberOfRegisters + 7) >> 3;
typedef uint8_t RegisterSetPOD[numberOfBytesInRegisterSet];
class RegisterSet {
public:
RegisterSet()
{
for (unsigned i = numberOfBytesInRegisterSet; i--;)
m_set[i] = 0;
}
RegisterSet(const RegisterSetPOD& other)
{
for (unsigned i = numberOfBytesInRegisterSet; i--;)
m_set[i] = other[i];
}
const RegisterSetPOD& asPOD() const { return m_set; }
void copyInfo(RegisterSetPOD& other) const
{
for (unsigned i = numberOfBytesInRegisterSet; i--;)
other[i] = m_set[i];
}
void set(GPRReg reg)
{
setBit(GPRInfo::toIndex(reg));
}
void setGPRByIndex(unsigned index)
{
ASSERT(index < GPRInfo::numberOfRegisters);
setBit(index);
}
void clear(GPRReg reg)
{
clearBit(GPRInfo::toIndex(reg));
}
bool get(GPRReg reg) const
{
return getBit(GPRInfo::toIndex(reg));
}
bool getGPRByIndex(unsigned index) const
{
ASSERT(index < GPRInfo::numberOfRegisters);
return getBit(index);
}
// Return the index'th free GPR.
GPRReg getFreeGPR(unsigned index = 0) const
{
for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
if (!getGPRByIndex(i) && !index--)
return GPRInfo::toRegister(i);
}
return InvalidGPRReg;
}
void set(FPRReg reg)
{
setBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
}
void setFPRByIndex(unsigned index)
{
ASSERT(index < FPRInfo::numberOfRegisters);
setBit(GPRInfo::numberOfRegisters + index);
}
void clear(FPRReg reg)
{
clearBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
}
bool get(FPRReg reg) const
{
return getBit(GPRInfo::numberOfRegisters + FPRInfo::toIndex(reg));
}
bool getFPRByIndex(unsigned index) const
{
ASSERT(index < FPRInfo::numberOfRegisters);
return getBit(GPRInfo::numberOfRegisters + index);
}
template<typename BankInfo>
void setByIndex(unsigned index)
{
set(BankInfo::toRegister(index));
}
template<typename BankInfo>
bool getByIndex(unsigned index)
{
return get(BankInfo::toRegister(index));
}
unsigned numberOfSetGPRs() const
{
unsigned result = 0;
for (unsigned i = GPRInfo::numberOfRegisters; i--;) {
if (!getBit(i))
continue;
result++;
}
return result;
}
unsigned numberOfSetFPRs() const
{
unsigned result = 0;
for (unsigned i = FPRInfo::numberOfRegisters; i--;) {
if (!getBit(GPRInfo::numberOfRegisters + i))
continue;
result++;
}
return result;
}
unsigned numberOfSetRegisters() const
{
unsigned result = 0;
for (unsigned i = totalNumberOfRegisters; i--;) {
if (!getBit(i))
continue;
result++;
}
return result;
}
private:
void setBit(unsigned i)
{
ASSERT(i < totalNumberOfRegisters);
m_set[i >> 3] |= (1 << (i & 7));
}
void clearBit(unsigned i)
{
ASSERT(i < totalNumberOfRegisters);
m_set[i >> 3] &= ~(1 << (i & 7));
}
bool getBit(unsigned i) const
{
ASSERT(i < totalNumberOfRegisters);
return !!(m_set[i >> 3] & (1 << (i & 7)));
}
RegisterSetPOD m_set;
};
} } // namespace JSC::DFG
#else // ENABLE(DFG_JIT) -> so if DFG is disabled
namespace JSC { namespace DFG {
// Define RegisterSetPOD to something that is a POD, but is otherwise useless,
// to make it easier to refer to this type in code that may be compiled when
// the DFG is disabled.
struct RegisterSetPOD { };
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
#endif // DFGRegisterSet_h
|
/*
* linux/arch/arm/mach-pxa/clock-pxa3xx.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/syscore_ops.h>
#include <mach/smemc.h>
#include <mach/pxa3xx-regs.h>
#include "clock.h"
/* Crystal clock: 13MHz */
#define BASE_CLK 13000000
/* Ring Oscillator Clock: 60MHz */
#define RO_CLK 60000000
#define ACCR_D0CS (1 << 26)
#define ACCR_PCCE (1 << 11)
/* crystal frequency to HSIO bus frequency multiplier (HSS) */
static unsigned char hss_mult[4] = { 8, 12, 16, 24 };
/*
* Get the clock frequency as reflected by CCSR and the turbo flag.
* We assume these values have been applied via a fcs.
* If info is not 0 we also display the current settings.
*/
unsigned int pxa3xx_get_clk_frequency_khz(int info)
{
unsigned long acsr, xclkcfg;
unsigned int t, xl, xn, hss, ro, XL, XN, CLK, HSS;
/* Read XCLKCFG register turbo bit */
__asm__ __volatile__("mrc\tp14, 0, %0, c6, c0, 0" : "=r"(xclkcfg));
t = xclkcfg & 0x1;
acsr = ACSR;
xl = acsr & 0x1f;
xn = (acsr >> 8) & 0x7;
hss = (acsr >> 14) & 0x3;
XL = xl * BASE_CLK;
XN = xn * XL;
ro = acsr & ACCR_D0CS;
CLK = (ro) ? RO_CLK : ((t) ? XN : XL);
HSS = (ro) ? RO_CLK : hss_mult[hss] * BASE_CLK;
if (info) {
pr_info("RO Mode clock: %d.%02dMHz (%sactive)\n",
RO_CLK / 1000000, (RO_CLK % 1000000) / 10000,
(ro) ? "" : "in");
pr_info("Run Mode clock: %d.%02dMHz (*%d)\n",
XL / 1000000, (XL % 1000000) / 10000, xl);
pr_info("Turbo Mode clock: %d.%02dMHz (*%d, %sactive)\n",
XN / 1000000, (XN % 1000000) / 10000, xn,
(t) ? "" : "in");
pr_info("HSIO bus clock: %d.%02dMHz\n",
HSS / 1000000, (HSS % 1000000) / 10000);
}
return CLK / 1000;
}
/*
* Return the current AC97 clock frequency.
*/
static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk)
{
unsigned long rate = 312000000;
unsigned long ac97_div;
ac97_div = AC97_DIV;
/* This may loose precision for some rates but won't for the
* standard 24.576MHz.
*/
rate /= (ac97_div >> 12) & 0x7fff;
rate *= (ac97_div & 0xfff);
return rate;
}
/*
* Return the current HSIO bus clock frequency
*/
static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
{
unsigned long acsr;
unsigned int hss, hsio_clk;
acsr = ACSR;
hss = (acsr >> 14) & 0x3;
hsio_clk = (acsr & ACCR_D0CS) ? RO_CLK : hss_mult[hss] * BASE_CLK;
return hsio_clk;
}
/* crystal frequency to static memory controller multiplier (SMCFS) */
static unsigned int smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
static unsigned int df_clkdiv[4] = { 1, 2, 4, 1 };
static unsigned long clk_pxa3xx_smemc_getrate(struct clk *clk)
{
unsigned long acsr = ACSR;
unsigned long memclkcfg = __raw_readl(MEMCLKCFG);
return BASE_CLK * smcfs_mult[(acsr >> 23) & 0x7] /
df_clkdiv[(memclkcfg >> 16) & 0x3];
}
void clk_pxa3xx_cken_enable(struct clk *clk)
{
unsigned long mask = 1ul << (clk->cken & 0x1f);
if (clk->cken < 32)
CKENA |= mask;
else if (clk->cken < 64)
CKENB |= mask;
else
CKENC |= mask;
}
void clk_pxa3xx_cken_disable(struct clk *clk)
{
unsigned long mask = 1ul << (clk->cken & 0x1f);
if (clk->cken < 32)
CKENA &= ~mask;
else if (clk->cken < 64)
CKENB &= ~mask;
else
CKENC &= ~mask;
}
const struct clkops clk_pxa3xx_cken_ops = {
.enable = clk_pxa3xx_cken_enable,
.disable = clk_pxa3xx_cken_disable,
};
const struct clkops clk_pxa3xx_hsio_ops = {
.enable = clk_pxa3xx_cken_enable,
.disable = clk_pxa3xx_cken_disable,
.getrate = clk_pxa3xx_hsio_getrate,
};
const struct clkops clk_pxa3xx_ac97_ops = {
.enable = clk_pxa3xx_cken_enable,
.disable = clk_pxa3xx_cken_disable,
.getrate = clk_pxa3xx_ac97_getrate,
};
const struct clkops clk_pxa3xx_smemc_ops = {
.enable = clk_pxa3xx_cken_enable,
.disable = clk_pxa3xx_cken_disable,
.getrate = clk_pxa3xx_smemc_getrate,
};
static void clk_pout_enable(struct clk *clk)
{
OSCC |= OSCC_PEN;
}
static void clk_pout_disable(struct clk *clk)
{
OSCC &= ~OSCC_PEN;
}
const struct clkops clk_pxa3xx_pout_ops = {
.enable = clk_pout_enable,
.disable = clk_pout_disable,
};
#ifdef CONFIG_PM
static uint32_t cken[2];
static uint32_t accr;
static int pxa3xx_clock_suspend(void)
{
cken[0] = CKENA;
cken[1] = CKENB;
accr = ACCR;
return 0;
}
static void pxa3xx_clock_resume(void)
{
ACCR = accr;
CKENA = cken[0];
CKENB = cken[1];
}
#else
#define pxa3xx_clock_suspend NULL
#define pxa3xx_clock_resume NULL
#endif
struct syscore_ops pxa3xx_clock_syscore_ops = {
.suspend = pxa3xx_clock_suspend,
.resume = pxa3xx_clock_resume,
};
|
/*
* Copyright 2020 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DC_HWSS_DCN30_H__
#define __DC_HWSS_DCN30_H__
#include "hw_sequencer_private.h"
struct dc;
void dcn30_init_hw(struct dc *dc);
void dcn30_program_all_writeback_pipes_in_tree(
struct dc *dc,
const struct dc_stream_state *stream,
struct dc_state *context);
void dcn30_update_writeback(
struct dc *dc,
struct dc_writeback_info *wb_info,
struct dc_state *context);
void dcn30_enable_writeback(
struct dc *dc,
struct dc_writeback_info *wb_info,
struct dc_state *context);
void dcn30_disable_writeback(
struct dc *dc,
unsigned int dwb_pipe_inst);
bool dcn30_mmhubbub_warmup(
struct dc *dc,
unsigned int num_dwb,
struct dc_writeback_info *wb_info);
bool dcn30_set_blend_lut(struct pipe_ctx *pipe_ctx,
const struct dc_plane_state *plane_state);
bool dcn30_set_input_transfer_func(struct dc *dc,
struct pipe_ctx *pipe_ctx,
const struct dc_plane_state *plane_state);
bool dcn30_set_output_transfer_func(struct dc *dc,
struct pipe_ctx *pipe_ctx,
const struct dc_stream_state *stream);
void dcn30_set_avmute(struct pipe_ctx *pipe_ctx, bool enable);
void dcn30_update_info_frame(struct pipe_ctx *pipe_ctx);
void dcn30_program_dmdata_engine(struct pipe_ctx *pipe_ctx);
bool dcn30_does_plane_fit_in_mall(struct dc *dc, struct dc_plane_state *plane,
struct dc_cursor_attributes *cursor_attr);
bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable);
void dcn30_hardware_release(struct dc *dc);
void dcn30_set_disp_pattern_generator(const struct dc *dc,
struct pipe_ctx *pipe_ctx,
enum controller_dp_test_pattern test_pattern,
enum controller_dp_color_space color_space,
enum dc_color_depth color_depth,
const struct tg_color *solid_color,
int width, int height, int offset);
#endif /* __DC_HWSS_DCN30_H__ */
|
#ifndef __ASM_ARM_SWAB_H
#define __ASM_ARM_SWAB_H
#include <linux/compiler.h>
#include <linux/types.h>
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
# define __SWAB_64_THRU_32__
#endif
#if defined(__KERNEL__)
#if __LINUX_ARM_ARCH__ >= 6
static inline __attribute_const__ __u32 __arch_swahb32(__u32 x)
{
__asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
return x;
}
#define __arch_swahb32 __arch_swahb32
#define __arch_swab16(x) ((__u16)__arch_swahb32(x))
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
{
__asm__ ("rev %0, %1" : "=r" (x) : "r" (x));
return x;
}
#define __arch_swab32 __arch_swab32
#endif
#endif
#if !defined(__KERNEL__) || __LINUX_ARM_ARCH__ < 6
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
{
__u32 t;
#ifndef __thumb__
if (!__builtin_constant_p(x)) {
asm ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
} else
#endif
t = x ^ ((x << 16) | (x >> 16));
x = (x << 24) | (x >> 8);
t &= ~0x00FF0000;
x ^= (t >> 8);
return x;
}
#define __arch_swab32 __arch_swab32
#endif
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FINALIZE_AFTER_DISPATCH_H_
#define FINALIZE_AFTER_DISPATCH_H_
#include "heap/stubs.h"
namespace blink {
class NeedsFinalize : public GarbageCollectedFinalized<NeedsFinalize> {
public:
void trace(Visitor*);
void traceAfterDispatch(Visitor*);
// Needs a finalizeGarbageCollectedObject method.
};
class NeedsDispatch : public GarbageCollectedFinalized<NeedsDispatch> {
public:
void trace(Visitor*);
// Needs a traceAfterDispatch method.
void finalizeGarbageCollectedObject() { };
};
class NeedsFinalizedBase : public GarbageCollected<NeedsFinalizedBase> {
public:
void trace(Visitor*) { };
void traceAfterDispatch(Visitor*) { };
void finalizeGarbageCollectedObject() { };
};
class A : GarbageCollectedFinalized<A> {
public:
void trace(Visitor*);
void traceAfterDispatch(Visitor*);
void finalizeGarbageCollectedObject();
protected:
enum Type { TB, TC, TD };
A(Type type) : m_type(type) { }
private:
Type m_type;
};
class B : public A {
public:
B() : A(TB) { }
~B() { }
void traceAfterDispatch(Visitor*);
private:
Member<A> m_a;
};
class C : public A {
public:
C() : A(TC) { }
void traceAfterDispatch(Visitor*);
private:
Member<A> m_a;
};
// This class is considered abstract does not need to be dispatched to.
class Abstract : public A {
protected:
Abstract(Type type) : A(type) { }
};
class D : public Abstract {
public:
D() : Abstract(TD) { }
void traceAfterDispatch(Visitor*);
private:
Member<A> m_a;
};
}
#endif
|
/*
* Copyright (C) 2008-2013 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_MOVEMENTGENERATOR_IMPL_H
#define TRINITY_MOVEMENTGENERATOR_IMPL_H
#include "MovementGenerator.h"
template<class MOVEMENT_GEN>
inline MovementGenerator*
MovementGeneratorFactory<MOVEMENT_GEN>::Create(void * /*data*/) const
{
return (new MOVEMENT_GEN());
}
#endif
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015, Daniel Thompson
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/hw_random.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/slab.h>
#define RNG_CR 0x00
#define RNG_CR_RNGEN BIT(2)
#define RNG_CR_CED BIT(5)
#define RNG_SR 0x04
#define RNG_SR_SEIS BIT(6)
#define RNG_SR_CEIS BIT(5)
#define RNG_SR_DRDY BIT(0)
#define RNG_DR 0x08
struct stm32_rng_private {
struct hwrng rng;
void __iomem *base;
struct clk *clk;
struct reset_control *rst;
bool ced;
};
static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait)
{
struct stm32_rng_private *priv =
container_of(rng, struct stm32_rng_private, rng);
u32 sr;
int retval = 0;
pm_runtime_get_sync((struct device *) priv->rng.priv);
while (max > sizeof(u32)) {
sr = readl_relaxed(priv->base + RNG_SR);
/* Manage timeout which is based on timer and take */
/* care of initial delay time when enabling rng */
if (!sr && wait) {
retval = readl_relaxed_poll_timeout_atomic(priv->base
+ RNG_SR,
sr, sr,
10, 50000);
if (retval)
dev_err((struct device *)priv->rng.priv,
"%s: timeout %x!\n", __func__, sr);
}
/* If error detected or data not ready... */
if (sr != RNG_SR_DRDY) {
if (WARN_ONCE(sr & (RNG_SR_SEIS | RNG_SR_CEIS),
"bad RNG status - %x\n", sr))
writel_relaxed(0, priv->base + RNG_SR);
break;
}
*(u32 *)data = readl_relaxed(priv->base + RNG_DR);
retval += sizeof(u32);
data += sizeof(u32);
max -= sizeof(u32);
}
pm_runtime_mark_last_busy((struct device *) priv->rng.priv);
pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);
return retval || !wait ? retval : -EIO;
}
static int stm32_rng_init(struct hwrng *rng)
{
struct stm32_rng_private *priv =
container_of(rng, struct stm32_rng_private, rng);
int err;
err = clk_prepare_enable(priv->clk);
if (err)
return err;
if (priv->ced)
writel_relaxed(RNG_CR_RNGEN, priv->base + RNG_CR);
else
writel_relaxed(RNG_CR_RNGEN | RNG_CR_CED,
priv->base + RNG_CR);
/* clear error indicators */
writel_relaxed(0, priv->base + RNG_SR);
return 0;
}
static void stm32_rng_cleanup(struct hwrng *rng)
{
struct stm32_rng_private *priv =
container_of(rng, struct stm32_rng_private, rng);
writel_relaxed(0, priv->base + RNG_CR);
clk_disable_unprepare(priv->clk);
}
static int stm32_rng_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
struct stm32_rng_private *priv;
struct resource res;
int err;
priv = devm_kzalloc(dev, sizeof(struct stm32_rng_private), GFP_KERNEL);
if (!priv)
return -ENOMEM;
err = of_address_to_resource(np, 0, &res);
if (err)
return err;
priv->base = devm_ioremap_resource(dev, &res);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
priv->clk = devm_clk_get(&ofdev->dev, NULL);
if (IS_ERR(priv->clk))
return PTR_ERR(priv->clk);
priv->rst = devm_reset_control_get(&ofdev->dev, NULL);
if (!IS_ERR(priv->rst)) {
reset_control_assert(priv->rst);
udelay(2);
reset_control_deassert(priv->rst);
}
priv->ced = of_property_read_bool(np, "clock-error-detect");
dev_set_drvdata(dev, priv);
priv->rng.name = dev_driver_string(dev);
#ifndef CONFIG_PM
priv->rng.init = stm32_rng_init;
priv->rng.cleanup = stm32_rng_cleanup;
#endif
priv->rng.read = stm32_rng_read;
priv->rng.priv = (unsigned long) dev;
priv->rng.quality = 900;
pm_runtime_set_autosuspend_delay(dev, 100);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev);
return devm_hwrng_register(dev, &priv->rng);
}
static int stm32_rng_remove(struct platform_device *ofdev)
{
pm_runtime_disable(&ofdev->dev);
return 0;
}
#ifdef CONFIG_PM
static int stm32_rng_runtime_suspend(struct device *dev)
{
struct stm32_rng_private *priv = dev_get_drvdata(dev);
stm32_rng_cleanup(&priv->rng);
return 0;
}
static int stm32_rng_runtime_resume(struct device *dev)
{
struct stm32_rng_private *priv = dev_get_drvdata(dev);
return stm32_rng_init(&priv->rng);
}
#endif
static const struct dev_pm_ops stm32_rng_pm_ops = {
SET_RUNTIME_PM_OPS(stm32_rng_runtime_suspend,
stm32_rng_runtime_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume)
};
static const struct of_device_id stm32_rng_match[] = {
{
.compatible = "st,stm32-rng",
},
{},
};
MODULE_DEVICE_TABLE(of, stm32_rng_match);
static struct platform_driver stm32_rng_driver = {
.driver = {
.name = "stm32-rng",
.pm = &stm32_rng_pm_ops,
.of_match_table = stm32_rng_match,
},
.probe = stm32_rng_probe,
.remove = stm32_rng_remove,
};
module_platform_driver(stm32_rng_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Daniel Thompson <daniel.thompson@linaro.org>");
MODULE_DESCRIPTION("STMicroelectronics STM32 RNG device driver");
|
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2001, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
*
* File CESTST.H
*
* Modification History:
* Name Description
* Madhu Katragadda Converted to C
*********************************************************************************/
/**
* CollationSpanishTest is a third level test class. This tests the locale
* specific primary, secondary and tertiary rules. For example, the ignorable
* character '-' in string "black-bird". The en_US locale uses the default
* collation rules as its sorting sequence.
*/
#ifndef _CESCOLLTST
#define _CESCOLLTST
#include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "cintltst.h"
#define MAX_TOKEN_LEN 16
/* perform test with strength SECONDARY */
static void TestPrimary(void);
/* perform test with strength TERTIARY */
static void TestTertiary(void);
#endif /* #if !UCONFIG_NO_COLLATION */
#endif
|
/*
* Copyright (C) 2012 Invensense, 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 _INV_MPU_DTS_H_
#define _INV_MPU_DTS_H_
#include <linux/i2c.h>
#include <linux/mpu.h>
int inv_mpu_power_on(struct mpu_platform_data *pdata);
int inv_mpu_power_off(struct mpu_platform_data *pdata);
int inv_parse_orientation_matrix(struct device *dev, s8 *orient);
int inv_parse_secondary_orientation_matrix(struct device *dev,
s8 *orient);
int inv_parse_secondary(struct device *dev, struct mpu_platform_data *pdata);
int inv_parse_aux(struct device *dev, struct mpu_platform_data *pdata);
int invensense_mpu_parse_dt(struct device *dev,
struct mpu_platform_data *pdata);
#endif /* #ifndef _INV_MPU_DTS_H_ */
|
/*
* Pistachio IRQ setup
*
* Copyright (C) 2014 Google, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*/
#ifndef __ASM_MACH_PISTACHIO_GPIO_H
#define __ASM_MACH_PISTACHIO_GPIO_H
#include <asm-generic/gpio.h>
#define gpio_get_value __gpio_get_value
#define gpio_set_value __gpio_set_value
#define gpio_cansleep __gpio_cansleep
#define gpio_to_irq __gpio_to_irq
#endif /* __ASM_MACH_PISTACHIO_GPIO_H */
|
#ifndef __NV04_DISPLAY_H__
#define __NV04_DISPLAY_H__
#include <subdev/bios/pll.h>
#include "nouveau_display.h"
enum nv04_fp_display_regs {
FP_DISPLAY_END,
FP_TOTAL,
FP_CRTC,
FP_SYNC_START,
FP_SYNC_END,
FP_VALID_START,
FP_VALID_END
};
struct nv04_crtc_reg {
unsigned char MiscOutReg;
uint8_t CRTC[0xa0];
uint8_t CR58[0x10];
uint8_t Sequencer[5];
uint8_t Graphics[9];
uint8_t Attribute[21];
unsigned char DAC[768];
/* PCRTC regs */
uint32_t fb_start;
uint32_t crtc_cfg;
uint32_t cursor_cfg;
uint32_t gpio_ext;
uint32_t crtc_830;
uint32_t crtc_834;
uint32_t crtc_850;
uint32_t crtc_eng_ctrl;
/* PRAMDAC regs */
uint32_t nv10_cursync;
struct nouveau_pll_vals pllvals;
uint32_t ramdac_gen_ctrl;
uint32_t ramdac_630;
uint32_t ramdac_634;
uint32_t tv_setup;
uint32_t tv_vtotal;
uint32_t tv_vskew;
uint32_t tv_vsync_delay;
uint32_t tv_htotal;
uint32_t tv_hskew;
uint32_t tv_hsync_delay;
uint32_t tv_hsync_delay2;
uint32_t fp_horiz_regs[7];
uint32_t fp_vert_regs[7];
uint32_t dither;
uint32_t fp_control;
uint32_t dither_regs[6];
uint32_t fp_debug_0;
uint32_t fp_debug_1;
uint32_t fp_debug_2;
uint32_t fp_margin_color;
uint32_t ramdac_8c0;
uint32_t ramdac_a20;
uint32_t ramdac_a24;
uint32_t ramdac_a34;
uint32_t ctv_regs[38];
};
struct nv04_output_reg {
uint32_t output;
int head;
};
struct nv04_mode_state {
struct nv04_crtc_reg crtc_reg[2];
uint32_t pllsel;
uint32_t sel_clk;
};
struct nv04_display {
struct nv04_mode_state mode_reg;
struct nv04_mode_state saved_reg;
uint32_t saved_vga_font[4][16384];
uint32_t dac_users[4];
};
static inline struct nv04_display *
nv04_display(struct drm_device *dev)
{
return nouveau_display(dev)->priv;
}
/* nv04_display.c */
int nv04_display_early_init(struct drm_device *);
void nv04_display_late_takedown(struct drm_device *);
int nv04_display_create(struct drm_device *);
void nv04_display_destroy(struct drm_device *);
int nv04_display_init(struct drm_device *);
void nv04_display_fini(struct drm_device *);
/* nv04_crtc.c */
int nv04_crtc_create(struct drm_device *, int index);
/* nv04_dac.c */
int nv04_dac_create(struct drm_connector *, struct dcb_output *);
uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
int nv04_dac_output_offset(struct drm_encoder *encoder);
void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
bool nv04_dac_in_use(struct drm_encoder *encoder);
/* nv04_dfp.c */
int nv04_dfp_create(struct drm_connector *, struct dcb_output *);
int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_output *dcbent);
void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_output *dcbent,
int head, bool dl);
void nv04_dfp_disable(struct drm_device *dev, int head);
void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode);
/* nv04_tv.c */
int nv04_tv_identify(struct drm_device *dev, int i2c_index);
int nv04_tv_create(struct drm_connector *, struct dcb_output *);
/* nv17_tv.c */
int nv17_tv_create(struct drm_connector *, struct dcb_output *);
static inline bool
nv_two_heads(struct drm_device *dev)
{
struct nouveau_drm *drm = nouveau_drm(dev);
const int impl = dev->pci_device & 0x0ff0;
if (nv_device(drm->device)->card_type >= NV_10 && impl != 0x0100 &&
impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
return true;
return false;
}
static inline bool
nv_gf4_disp_arch(struct drm_device *dev)
{
return nv_two_heads(dev) && (dev->pci_device & 0x0ff0) != 0x0110;
}
static inline bool
nv_two_reg_pll(struct drm_device *dev)
{
struct nouveau_drm *drm = nouveau_drm(dev);
const int impl = dev->pci_device & 0x0ff0;
if (impl == 0x0310 || impl == 0x0340 || nv_device(drm->device)->card_type >= NV_40)
return true;
return false;
}
static inline bool
nv_match_device(struct drm_device *dev, unsigned device,
unsigned sub_vendor, unsigned sub_device)
{
return dev->pdev->device == device &&
dev->pdev->subsystem_vendor == sub_vendor &&
dev->pdev->subsystem_device == sub_device;
}
#include <subdev/bios.h>
#include <subdev/bios/init.h>
static inline void
nouveau_bios_run_init_table(struct drm_device *dev, u16 table,
struct dcb_output *outp, int crtc)
{
struct nouveau_device *device = nouveau_dev(dev);
struct nouveau_bios *bios = nouveau_bios(device);
struct nvbios_init init = {
.subdev = nv_subdev(bios),
.bios = bios,
.offset = table,
.outp = outp,
.crtc = crtc,
.execute = 1,
};
nvbios_exec(&init);
}
#endif
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __org_omg_Dynamic_Parameter__
#define __org_omg_Dynamic_Parameter__
#pragma interface
#include <java/lang/Object.h>
extern "Java"
{
namespace org
{
namespace omg
{
namespace CORBA
{
class Any;
class ParameterMode;
}
namespace Dynamic
{
class Parameter;
}
}
}
}
class org::omg::Dynamic::Parameter : public ::java::lang::Object
{
public:
Parameter();
Parameter(::org::omg::CORBA::Any *, ::org::omg::CORBA::ParameterMode *);
private:
static const jlong serialVersionUID = 892191606993734699LL;
public:
::org::omg::CORBA::Any * __attribute__((aligned(__alignof__( ::java::lang::Object)))) argument;
::org::omg::CORBA::ParameterMode * mode;
static ::java::lang::Class class$;
};
#endif // __org_omg_Dynamic_Parameter__
|
/*
* PL-2301/2302 USB host-to-host link cables
* Copyright (C) 2000-2005 by David Brownell
*
* 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
*/
// #define DEBUG // error path messages, extra info
// #define VERBOSE // more; success messages
#include <linux/module.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/workqueue.h>
#include <linux/mii.h>
#include <linux/usb.h>
#include <linux/usb/usbnet.h>
/*
* Prolific PL-2301/PL-2302 driver ... http://www.prolific.com.tw/
*
* The protocol and handshaking used here should be bug-compatible
* with the Linux 2.2 "plusb" driver, by Deti Fliegl.
*
* HEADS UP: this handshaking isn't all that robust. This driver
* gets confused easily if you unplug one end of the cable then
* try to connect it again; you'll need to restart both ends. The
* "naplink" software (used by some PlayStation/2 deveopers) does
* the handshaking much better! Also, sometimes this hardware
* seems to get wedged under load. Prolific docs are weak, and
* don't identify differences between PL2301 and PL2302, much less
* anything to explain the different PL2302 versions observed.
*/
/*
* Bits 0-4 can be used for software handshaking; they're set from
* one end, cleared from the other, "read" with the interrupt byte.
*/
#define PL_S_EN (1<<7) /* (feature only) suspend enable */
/* reserved bit -- rx ready (6) ? */
#define PL_TX_READY (1<<5) /* (interrupt only) transmit ready */
#define PL_RESET_OUT (1<<4) /* reset output pipe */
#define PL_RESET_IN (1<<3) /* reset input pipe */
#define PL_TX_C (1<<2) /* transmission complete */
#define PL_TX_REQ (1<<1) /* transmission received */
#define PL_PEER_E (1<<0) /* peer exists */
static inline int
pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
{
return usb_control_msg(dev->udev,
usb_rcvctrlpipe(dev->udev, 0),
req,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
val, index,
NULL, 0,
USB_CTRL_GET_TIMEOUT);
}
static inline int
pl_clear_QuickLink_features(struct usbnet *dev, int val)
{
return pl_vendor_req(dev, 1, (u8) val, 0);
}
static inline int
pl_set_QuickLink_features(struct usbnet *dev, int val)
{
return pl_vendor_req(dev, 3, (u8) val, 0);
}
static int pl_reset(struct usbnet *dev)
{
/* some units seem to need this reset, others reject it utterly.
* FIXME be more like "naplink" or windows drivers.
*/
(void) pl_set_QuickLink_features(dev,
PL_S_EN|PL_RESET_OUT|PL_RESET_IN|PL_PEER_E);
return 0;
}
static const struct driver_info prolific_info = {
.description = "Prolific PL-2301/PL-2302",
.flags = FLAG_NO_SETINT,
/* some PL-2302 versions seem to fail usb_set_interface() */
.reset = pl_reset,
};
/*-------------------------------------------------------------------------*/
/*
* Proilific's name won't normally be on the cables, and
* may not be on the device.
*/
static const struct usb_device_id products [] = {
{
USB_DEVICE(0x067b, 0x0000), // PL-2301
.driver_info = (unsigned long) &prolific_info,
}, {
USB_DEVICE(0x067b, 0x0001), // PL-2302
.driver_info = (unsigned long) &prolific_info,
},
{ }, // END
};
MODULE_DEVICE_TABLE(usb, products);
static struct usb_driver plusb_driver = {
.name = "plusb",
.id_table = products,
.probe = usbnet_probe,
.disconnect = usbnet_disconnect,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
};
static int __init plusb_init(void)
{
return usb_register(&plusb_driver);
}
module_init(plusb_init);
static void __exit plusb_exit(void)
{
usb_deregister(&plusb_driver);
}
module_exit(plusb_exit);
MODULE_AUTHOR("David Brownell");
MODULE_DESCRIPTION("Prolific PL-2301/2302 USB Host to Host Link Driver");
MODULE_LICENSE("GPL");
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IPC_STRUCT_DESTRUCTOR_MACROS_H_
#define IPC_STRUCT_DESTRUCTOR_MACROS_H_
// Null out all the macros that need nulling.
#include "ipc/ipc_message_null_macros.h"
// Set up so next include will generate destructors.
#undef IPC_STRUCT_BEGIN_WITH_PARENT
#define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
struct_name::~struct_name() {}
#endif // IPC_STRUCT_DESTRUCTOR_MACROS_H_
|
#pragma once
/*
* Copyright (C) 2011-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "windowing/WinEventsSDL.h"
class CWinEventsOSX : public CWinEventsSDL
{
public:
CWinEventsOSX();
~CWinEventsOSX();
};
|
/*
* ARC PGU DRM driver.
*
* Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <drm/drm_crtc.h>
#include <drm/drm_encoder_slave.h>
#include "arcpgu.h"
static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np)
{
struct drm_encoder *encoder;
struct drm_bridge *bridge;
int ret = 0;
encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL);
if (encoder == NULL)
return -ENOMEM;
/* Locate drm bridge from the hdmi encoder DT node */
bridge = of_drm_find_bridge(np);
if (!bridge)
return -EPROBE_DEFER;
encoder->possible_crtcs = 1;
encoder->possible_clones = 0;
ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs,
DRM_MODE_ENCODER_TMDS, NULL);
if (ret)
return ret;
/* Link drm_bridge to encoder */
ret = drm_bridge_attach(encoder, bridge, NULL);
if (ret)
drm_encoder_cleanup(encoder);
return ret;
}
|
#ifndef _ASM_S390_FTRACE_H
#define _ASM_S390_FTRACE_H
#define ARCH_SUPPORTS_FTRACE_OPS 1
#ifdef CC_USING_HOTPATCH
#define MCOUNT_INSN_SIZE 6
#else
#define MCOUNT_INSN_SIZE 24
#define MCOUNT_RETURN_FIXUP 18
#endif
#ifndef __ASSEMBLY__
#define ftrace_return_address(n) __builtin_return_address(n)
void _mcount(void);
void ftrace_caller(void);
extern char ftrace_graph_caller_end;
extern unsigned long ftrace_plt;
struct dyn_arch_ftrace { };
#define MCOUNT_ADDR ((unsigned long)_mcount)
#define FTRACE_ADDR ((unsigned long)ftrace_caller)
#define KPROBE_ON_FTRACE_NOP 0
#define KPROBE_ON_FTRACE_CALL 1
static inline unsigned long ftrace_call_adjust(unsigned long addr)
{
return addr;
}
struct ftrace_insn {
u16 opc;
s32 disp;
} __packed;
static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn)
{
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CC_USING_HOTPATCH
/* brcl 0,0 */
insn->opc = 0xc004;
insn->disp = 0;
#else
/* jg .+24 */
insn->opc = 0xc0f4;
insn->disp = MCOUNT_INSN_SIZE / 2;
#endif
#endif
}
static inline int is_ftrace_nop(struct ftrace_insn *insn)
{
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CC_USING_HOTPATCH
if (insn->disp == 0)
return 1;
#else
if (insn->disp == MCOUNT_INSN_SIZE / 2)
return 1;
#endif
#endif
return 0;
}
static inline void ftrace_generate_call_insn(struct ftrace_insn *insn,
unsigned long ip)
{
#ifdef CONFIG_FUNCTION_TRACER
unsigned long target;
/* brasl r0,ftrace_caller */
target = is_module_addr((void *) ip) ? ftrace_plt : FTRACE_ADDR;
insn->opc = 0xc005;
insn->disp = (target - ip) / 2;
#endif
}
#endif /* __ASSEMBLY__ */
#endif /* _ASM_S390_FTRACE_H */
|
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O3 -msse4.1 -mno-avx2" } */
#ifndef CHECK_H
#define CHECK_H "sse4_1-check.h"
#endif
#ifndef TEST
#define TEST sse4_1_test
#endif
#include CHECK_H
extern void abort (void);
#define N 1024
short a[N], c, e;
unsigned short b[N], d, f;
__attribute__((noinline)) short
vecsmax (void)
{
int i;
short r = -32768;
for (i = 0; i < N; ++i)
if (r < a[i]) r = a[i];
return r;
}
__attribute__((noinline)) unsigned short
vecumax (void)
{
int i;
unsigned short r = 0;
for (i = 0; i < N; ++i)
if (r < b[i]) r = b[i];
return r;
}
__attribute__((noinline)) short
vecsmin (void)
{
int i;
short r = 32767;
for (i = 0; i < N; ++i)
if (r > a[i]) r = a[i];
return r;
}
__attribute__((noinline)) unsigned short
vecumin (void)
{
int i;
unsigned short r = 65535;
for (i = 0; i < N; ++i)
if (r > b[i]) r = b[i];
return r;
}
static void
TEST (void)
{
int i;
for (i = 0; i < N; ++i)
{
a[i] = i - N / 2;
b[i] = i + 32768 - N / 2;
}
a[N / 3] = N;
a[2 * N / 3] = -N;
b[N / 5] = 32768 + N;
b[4 * N / 5] = 32768 - N;
if (vecsmax () != N || vecsmin () != -N)
abort ();
if (vecumax () != 32768 + N || vecumin () != 32768 - N)
abort ();
}
|
/* PR middle-end/44843 */
/* Verify that we don't use the alignment of struct S for inner accesses. */
struct S
{
double for_alignment;
struct { int x, y, z; } a[16];
};
void f(struct S *s) __attribute__((noinline));
void f(struct S *s)
{
unsigned int i;
for (i = 0; i < 16; ++i)
{
s->a[i].x = 0;
s->a[i].y = 0;
s->a[i].z = 0;
}
}
int main (void)
{
struct S s;
f (&s);
return 0;
}
|
/*
* Device Tree support for Allwinner A1X SoCs
*
* Copyright (C) 2012 Maxime Ripard
*
* Maxime Ripard <maxime.ripard@free-electrons.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/clk-provider.h>
#include <linux/clocksource.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <asm/mach/arch.h>
static void __init sunxi_dt_cpufreq_init(void)
{
platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
}
static const char * const sunxi_board_dt_compat[] = {
"allwinner,sun4i-a10",
"allwinner,sun5i-a10s",
"allwinner,sun5i-a13",
"allwinner,sun5i-r8",
NULL,
};
DT_MACHINE_START(SUNXI_DT, "Allwinner sun4i/sun5i Families")
.dt_compat = sunxi_board_dt_compat,
.init_late = sunxi_dt_cpufreq_init,
MACHINE_END
static const char * const sun6i_board_dt_compat[] = {
"allwinner,sun6i-a31",
"allwinner,sun6i-a31s",
NULL,
};
extern void __init sun6i_reset_init(void);
static void __init sun6i_timer_init(void)
{
of_clk_init(NULL);
if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
sun6i_reset_init();
clocksource_probe();
}
DT_MACHINE_START(SUN6I_DT, "Allwinner sun6i (A31) Family")
.init_time = sun6i_timer_init,
.dt_compat = sun6i_board_dt_compat,
.init_late = sunxi_dt_cpufreq_init,
MACHINE_END
static const char * const sun7i_board_dt_compat[] = {
"allwinner,sun7i-a20",
NULL,
};
DT_MACHINE_START(SUN7I_DT, "Allwinner sun7i (A20) Family")
.dt_compat = sun7i_board_dt_compat,
.init_late = sunxi_dt_cpufreq_init,
MACHINE_END
static const char * const sun8i_board_dt_compat[] = {
"allwinner,sun8i-a23",
"allwinner,sun8i-a33",
"allwinner,sun8i-h3",
NULL,
};
DT_MACHINE_START(SUN8I_DT, "Allwinner sun8i Family")
.init_time = sun6i_timer_init,
.dt_compat = sun8i_board_dt_compat,
.init_late = sunxi_dt_cpufreq_init,
MACHINE_END
static const char * const sun9i_board_dt_compat[] = {
"allwinner,sun9i-a80",
NULL,
};
DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
.dt_compat = sun9i_board_dt_compat,
MACHINE_END
|
/*
* MTD partitioning layer definitions
*
* (C) 2000 Nicolas Pitre <nico@fluxnic.net>
*
* This code is GPL
*/
#ifndef MTD_PARTITIONS_H
#define MTD_PARTITIONS_H
#include <linux/types.h>
/*
* Partition definition structure:
*
* An array of struct partition is passed along with a MTD object to
* mtd_device_register() to create them.
*
* For each partition, these fields are available:
* name: string that will be used to label the partition's MTD device.
* types: some partitions can be containers using specific format to describe
* embedded subpartitions / volumes. E.g. many home routers use "firmware"
* partition that contains at least kernel and rootfs. In such case an
* extra parser is needed that will detect these dynamic partitions and
* report them to the MTD subsystem. If set this property stores an array
* of parser names to use when looking for subpartitions.
* size: the partition size; if defined as MTDPART_SIZ_FULL, the partition
* will extend to the end of the master MTD device.
* offset: absolute starting position within the master MTD device; if
* defined as MTDPART_OFS_APPEND, the partition will start where the
* previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block;
* if MTDPART_OFS_RETAIN, consume as much as possible, leaving size
* after the end of partition.
* mask_flags: contains flags that have to be masked (removed) from the
* master MTD flag set for the corresponding MTD partition.
* For example, to force a read-only partition, simply adding
* MTD_WRITEABLE to the mask_flags will do the trick.
* add_flags: contains flags to add to the parent flags
*
* Note: writeable partitions require their size and offset be
* erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
*/
struct mtd_partition {
const char *name; /* identifier string */
const char *const *types; /* names of parsers to use if any */
uint64_t size; /* partition size */
uint64_t offset; /* offset within the master MTD space */
uint32_t mask_flags; /* master MTD flags to mask out for this partition */
uint32_t add_flags; /* flags to add to the partition */
struct device_node *of_node;
};
#define MTDPART_OFS_RETAIN (-3)
#define MTDPART_OFS_NXTBLK (-2)
#define MTDPART_OFS_APPEND (-1)
#define MTDPART_SIZ_FULL (0)
struct mtd_info;
struct device_node;
/**
* struct mtd_part_parser_data - used to pass data to MTD partition parsers.
* @origin: for RedBoot, start address of MTD device
*/
struct mtd_part_parser_data {
unsigned long origin;
};
/*
* Functions dealing with the various ways of partitioning the space
*/
struct mtd_part_parser {
struct list_head list;
struct module *owner;
const char *name;
const struct of_device_id *of_match_table;
int (*parse_fn)(struct mtd_info *, const struct mtd_partition **,
struct mtd_part_parser_data *);
void (*cleanup)(const struct mtd_partition *pparts, int nr_parts);
};
/* Container for passing around a set of parsed partitions */
struct mtd_partitions {
const struct mtd_partition *parts;
int nr_parts;
const struct mtd_part_parser *parser;
};
extern int __register_mtd_parser(struct mtd_part_parser *parser,
struct module *owner);
#define register_mtd_parser(parser) __register_mtd_parser(parser, THIS_MODULE)
extern void deregister_mtd_parser(struct mtd_part_parser *parser);
/*
* module_mtd_part_parser() - Helper macro for MTD partition parsers that don't
* do anything special in module init/exit. Each driver may only use this macro
* once, and calling it replaces module_init() and module_exit().
*/
#define module_mtd_part_parser(__mtd_part_parser) \
module_driver(__mtd_part_parser, register_mtd_parser, \
deregister_mtd_parser)
int mtd_add_partition(struct mtd_info *master, const char *name,
long long offset, long long length);
int mtd_del_partition(struct mtd_info *master, int partno);
uint64_t mtd_get_device_size(const struct mtd_info *mtd);
#endif
|
/*
** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/pwr_mgt.h#1 $
*/
/*! \file "pwr_mgt.h"
\brief In this file we define the STATE and EVENT for Power Management FSM.
The SCAN FSM is responsible for performing SCAN behavior when the Arbiter enter
ARB_STATE_SCAN. The STATE and EVENT for SCAN FSM are defined here with detail
description.
*/
/*
** $Log: pwr_mgt.h $
*
* 07 09 2010 george.huang
*
* [WPD00001556] Migrate PM variables from FW to driver: for composing QoS Info
*
* 07 08 2010 cp.wu
*
* [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
*
* 06 06 2010 kevin.huang
* [WPD00003832][MT6620 5931] Create driver base
* [MT6620 5931] Create driver base
*
* 04 20 2010 cp.wu
* [WPD00001943]Create WiFi test driver framework on WinXP
* don't need SPIN_LOCK_PWR_CTRL anymore, it will raise IRQL
* and cause SdBusSubmitRequest running at DISPATCH_LEVEL as well.
*
* 03 25 2010 cp.wu
* [WPD00001943]Create WiFi test driver framework on WinXP
* firmware download load adress & start address are now configured from config.h
* * * due to the different configurations on FPGA and ASIC
** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-12-10 16:39:10 GMT mtk02752
** disable PM macros temporally
** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-10-29 19:48:37 GMT mtk01084
** temp remove power management macro
** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-08 16:51:11 GMT mtk01084
** update for power management control macro
** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-04-03 14:59:58 GMT mtk01426
** Add #if CFG_HIF_LOOPBACK_PRETEST
** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-23 16:53:10 GMT mtk01084
** modify ACQUIRE_POWER_CONTROL_FROM_PM() and RECLAIM_POWER_CONTROL_TO_PM() macro
** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-19 18:32:47 GMT mtk01084
** update for basic power management functions
** \main\maintrunk.MT6620WiFiDriver_Prj\1 2009-03-19 15:05:20 GMT mtk01084
** Initial version
**
*/
#ifndef _PWR_MGT_H
#define _PWR_MGT_H
/*******************************************************************************
* C O M P I L E R F L A G S
********************************************************************************
*/
/*******************************************************************************
* E X T E R N A L R E F E R E N C E S
********************************************************************************
*/
/*******************************************************************************
* C O N S T A N T S
********************************************************************************
*/
#define PM_UAPSD_AC0 (BIT(0))
#define PM_UAPSD_AC1 (BIT(1))
#define PM_UAPSD_AC2 (BIT(2))
#define PM_UAPSD_AC3 (BIT(3))
#define PM_UAPSD_ALL (PM_UAPSD_AC0 | PM_UAPSD_AC1 | PM_UAPSD_AC2 | PM_UAPSD_AC3)
#define PM_UAPSD_NONE 0
/*******************************************************************************
* D A T A T Y P E S
********************************************************************************
*/
typedef struct _PM_PROFILE_SETUP_INFO_T {
/* Profile setup */
UINT_8 ucBmpDeliveryAC; /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */
UINT_8 ucBmpTriggerAC; /* 0: AC_BE, 1: AC_BK, 2: AC_VI, 3: AC_VO */
UINT_8 ucUapsdSp; /* Number of triggered packets in UAPSD */
} PM_PROFILE_SETUP_INFO_T, *P_PM_PROFILE_SETUP_INFO_T;
/*******************************************************************************
* P U B L I C D A T A
********************************************************************************
*/
/*******************************************************************************
* P R I V A T E D A T A
********************************************************************************
*/
/*******************************************************************************
* M A C R O S
********************************************************************************
*/
#if !CFG_ENABLE_FULL_PM
#define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter)
#define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST)
#else
#define ACQUIRE_POWER_CONTROL_FROM_PM(_prAdapter) \
{ \
if (_prAdapter->fgIsFwOwn) { \
nicpmSetDriverOwn(_prAdapter); \
} \
/* Increase Block to Enter Low Power Semaphore count */ \
GLUE_INC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \
}
#define RECLAIM_POWER_CONTROL_TO_PM(_prAdapter, _fgEnableGINT_in_IST) \
{ \
ASSERT(_prAdapter->u4PwrCtrlBlockCnt != 0); \
/* Decrease Block to Enter Low Power Semaphore count */ \
GLUE_DEC_REF_CNT(_prAdapter->u4PwrCtrlBlockCnt); \
if (_prAdapter->fgWiFiInSleepyState && (_prAdapter->u4PwrCtrlBlockCnt == 0)) { \
nicpmSetFWOwn(_prAdapter, _fgEnableGINT_in_IST); \
} \
}
#endif
/*******************************************************************************
* F U N C T I O N D E C L A R A T I O N S
********************************************************************************
*/
/*******************************************************************************
* F U N C T I O N S
********************************************************************************
*/
#endif /* _PWR_MGT_H */
|
/*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License version 2.
*/
#ifndef __GLOPS_DOT_H__
#define __GLOPS_DOT_H__
#include "incore.h"
extern const struct gfs2_glock_operations gfs2_meta_glops;
extern const struct gfs2_glock_operations gfs2_inode_glops;
extern const struct gfs2_glock_operations gfs2_rgrp_glops;
extern const struct gfs2_glock_operations gfs2_trans_glops;
extern const struct gfs2_glock_operations gfs2_iopen_glops;
extern const struct gfs2_glock_operations gfs2_flock_glops;
extern const struct gfs2_glock_operations gfs2_nondisk_glops;
extern const struct gfs2_glock_operations gfs2_quota_glops;
extern const struct gfs2_glock_operations gfs2_journal_glops;
extern const struct gfs2_glock_operations *gfs2_glops_list[];
extern void gfs2_ail_flush(struct gfs2_glock *gl);
#endif /* __GLOPS_DOT_H__ */
|
/* Distilled from try_pre_increment in flow.c. If-conversion inserted
new instructions at the wrong place on ppc. */
int foo(int a)
{
int x;
x = 0;
if (a > 0) x = 1;
if (a < 0) x = 1;
return x;
}
int main()
{
if (foo(1) != 1)
abort();
return 0;
}
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2016 Allwinnertech Co., Ltd.
* Copyright (C) 2017-2018 Bootlin
*
* Maxime Ripard <maxime.ripard@bootlin.com>
*/
#ifndef _SUN6I_MIPI_DSI_H_
#define _SUN6I_MIPI_DSI_H_
#include <drm/drm_connector.h>
#include <drm/drm_encoder.h>
#include <drm/drm_mipi_dsi.h>
#define SUN6I_DSI_TCON_DIV 4
struct sun6i_dsi {
struct drm_connector connector;
struct drm_encoder encoder;
struct mipi_dsi_host host;
struct clk *bus_clk;
struct clk *mod_clk;
struct regmap *regs;
struct regulator *regulator;
struct reset_control *reset;
struct phy *dphy;
struct device *dev;
struct mipi_dsi_device *device;
struct drm_device *drm;
struct drm_panel *panel;
};
static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host)
{
return container_of(host, struct sun6i_dsi, host);
};
static inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector)
{
return container_of(connector, struct sun6i_dsi, connector);
};
static inline struct sun6i_dsi *encoder_to_sun6i_dsi(const struct drm_encoder *encoder)
{
return container_of(encoder, struct sun6i_dsi, encoder);
};
#endif /* _SUN6I_MIPI_DSI_H_ */
|
/*
* IPMMU/IPMMUI
* Copyright (C) 2012 Hideki EIRAKU
*
* 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.
*/
#include <linux/err.h>
#include <linux/export.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/platform_data/sh_ipmmu.h>
#include "shmobile-ipmmu.h"
#define IMCTR1 0x000
#define IMCTR2 0x004
#define IMASID 0x010
#define IMTTBR 0x014
#define IMTTBCR 0x018
#define IMCTR1_TLBEN (1 << 0)
#define IMCTR1_FLUSH (1 << 1)
static void ipmmu_reg_write(struct shmobile_ipmmu *ipmmu, unsigned long reg_off,
unsigned long data)
{
iowrite32(data, ipmmu->ipmmu_base + reg_off);
}
void ipmmu_tlb_flush(struct shmobile_ipmmu *ipmmu)
{
if (!ipmmu)
return;
spin_lock(&ipmmu->flush_lock);
if (ipmmu->tlb_enabled)
ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH | IMCTR1_TLBEN);
else
ipmmu_reg_write(ipmmu, IMCTR1, IMCTR1_FLUSH);
spin_unlock(&ipmmu->flush_lock);
}
void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
int asid)
{
if (!ipmmu)
return;
spin_lock(&ipmmu->flush_lock);
switch (size) {
default:
ipmmu->tlb_enabled = 0;
break;
case 0x2000:
ipmmu_reg_write(ipmmu, IMTTBCR, 1);
ipmmu->tlb_enabled = 1;
break;
case 0x1000:
ipmmu_reg_write(ipmmu, IMTTBCR, 2);
ipmmu->tlb_enabled = 1;
break;
case 0x800:
ipmmu_reg_write(ipmmu, IMTTBCR, 3);
ipmmu->tlb_enabled = 1;
break;
case 0x400:
ipmmu_reg_write(ipmmu, IMTTBCR, 4);
ipmmu->tlb_enabled = 1;
break;
case 0x200:
ipmmu_reg_write(ipmmu, IMTTBCR, 5);
ipmmu->tlb_enabled = 1;
break;
case 0x100:
ipmmu_reg_write(ipmmu, IMTTBCR, 6);
ipmmu->tlb_enabled = 1;
break;
case 0x80:
ipmmu_reg_write(ipmmu, IMTTBCR, 7);
ipmmu->tlb_enabled = 1;
break;
}
ipmmu_reg_write(ipmmu, IMTTBR, phys);
ipmmu_reg_write(ipmmu, IMASID, asid);
spin_unlock(&ipmmu->flush_lock);
}
static int ipmmu_probe(struct platform_device *pdev)
{
struct shmobile_ipmmu *ipmmu;
struct resource *res;
struct shmobile_ipmmu_platform_data *pdata = pdev->dev.platform_data;
ipmmu = devm_kzalloc(&pdev->dev, sizeof(*ipmmu), GFP_KERNEL);
if (!ipmmu) {
dev_err(&pdev->dev, "cannot allocate device data\n");
return -ENOMEM;
}
spin_lock_init(&ipmmu->flush_lock);
ipmmu->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ipmmu->ipmmu_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ipmmu->ipmmu_base))
return PTR_ERR(ipmmu->ipmmu_base);
ipmmu->dev_names = pdata->dev_names;
ipmmu->num_dev_names = pdata->num_dev_names;
platform_set_drvdata(pdev, ipmmu);
ipmmu_reg_write(ipmmu, IMCTR1, 0x0); /* disable TLB */
ipmmu_reg_write(ipmmu, IMCTR2, 0x0); /* disable PMB */
return ipmmu_iommu_init(ipmmu);
}
static struct platform_driver ipmmu_driver = {
.probe = ipmmu_probe,
.driver = {
.owner = THIS_MODULE,
.name = "ipmmu",
},
};
static int __init ipmmu_init(void)
{
return platform_driver_register(&ipmmu_driver);
}
subsys_initcall(ipmmu_init);
|
/**
* debug.h - DesignWare USB3 DRD Controller Debug Header
*
* Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
*
* Authors: Felipe Balbi <balbi@ti.com>,
* Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __DWC3_DEBUG_H
#define __DWC3_DEBUG_H
#include "core.h"
/**
* dwc3_gadget_ep_cmd_string - returns endpoint command string
* @cmd: command code
*/
static inline const char *
dwc3_gadget_ep_cmd_string(u8 cmd)
{
switch (cmd) {
case DWC3_DEPCMD_DEPSTARTCFG:
return "Start New Configuration";
case DWC3_DEPCMD_ENDTRANSFER:
return "End Transfer";
case DWC3_DEPCMD_UPDATETRANSFER:
return "Update Transfer";
case DWC3_DEPCMD_STARTTRANSFER:
return "Start Transfer";
case DWC3_DEPCMD_CLEARSTALL:
return "Clear Stall";
case DWC3_DEPCMD_SETSTALL:
return "Set Stall";
case DWC3_DEPCMD_GETEPSTATE:
return "Get Endpoint State";
case DWC3_DEPCMD_SETTRANSFRESOURCE:
return "Set Endpoint Transfer Resource";
case DWC3_DEPCMD_SETEPCONFIG:
return "Set Endpoint Configuration";
default:
return "UNKNOWN command";
}
}
/**
* dwc3_gadget_generic_cmd_string - returns generic command string
* @cmd: command code
*/
static inline const char *
dwc3_gadget_generic_cmd_string(u8 cmd)
{
switch (cmd) {
case DWC3_DGCMD_SET_LMP:
return "Set LMP";
case DWC3_DGCMD_SET_PERIODIC_PAR:
return "Set Periodic Parameters";
case DWC3_DGCMD_XMIT_FUNCTION:
return "Transmit Function Wake Device Notification";
case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO:
return "Set Scratchpad Buffer Array Address Lo";
case DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI:
return "Set Scratchpad Buffer Array Address Hi";
case DWC3_DGCMD_SELECTED_FIFO_FLUSH:
return "Selected FIFO Flush";
case DWC3_DGCMD_ALL_FIFO_FLUSH:
return "All FIFO Flush";
case DWC3_DGCMD_SET_ENDPOINT_NRDY:
return "Set Endpoint NRDY";
case DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK:
return "Run SoC Bus Loopback Test";
default:
return "UNKNOWN";
}
}
/**
* dwc3_gadget_link_string - returns link name
* @link_state: link state code
*/
static inline const char *
dwc3_gadget_link_string(enum dwc3_link_state link_state)
{
switch (link_state) {
case DWC3_LINK_STATE_U0:
return "U0";
case DWC3_LINK_STATE_U1:
return "U1";
case DWC3_LINK_STATE_U2:
return "U2";
case DWC3_LINK_STATE_U3:
return "U3";
case DWC3_LINK_STATE_SS_DIS:
return "SS.Disabled";
case DWC3_LINK_STATE_RX_DET:
return "RX.Detect";
case DWC3_LINK_STATE_SS_INACT:
return "SS.Inactive";
case DWC3_LINK_STATE_POLL:
return "Polling";
case DWC3_LINK_STATE_RECOV:
return "Recovery";
case DWC3_LINK_STATE_HRESET:
return "Hot Reset";
case DWC3_LINK_STATE_CMPLY:
return "Compliance";
case DWC3_LINK_STATE_LPBK:
return "Loopback";
case DWC3_LINK_STATE_RESET:
return "Reset";
case DWC3_LINK_STATE_RESUME:
return "Resume";
default:
return "UNKNOWN link state\n";
}
}
/**
* dwc3_gadget_event_string - returns event name
* @event: the event code
*/
static inline const char *dwc3_gadget_event_string(u8 event)
{
switch (event) {
case DWC3_DEVICE_EVENT_DISCONNECT:
return "Disconnect";
case DWC3_DEVICE_EVENT_RESET:
return "Reset";
case DWC3_DEVICE_EVENT_CONNECT_DONE:
return "Connection Done";
case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE:
return "Link Status Change";
case DWC3_DEVICE_EVENT_WAKEUP:
return "WakeUp";
case DWC3_DEVICE_EVENT_EOPF:
return "End-Of-Frame";
case DWC3_DEVICE_EVENT_SOF:
return "Start-Of-Frame";
case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
return "Erratic Error";
case DWC3_DEVICE_EVENT_CMD_CMPL:
return "Command Complete";
case DWC3_DEVICE_EVENT_OVERFLOW:
return "Overflow";
}
return "UNKNOWN";
}
/**
* dwc3_ep_event_string - returns event name
* @event: then event code
*/
static inline const char *dwc3_ep_event_string(u8 event)
{
switch (event) {
case DWC3_DEPEVT_XFERCOMPLETE:
return "Transfer Complete";
case DWC3_DEPEVT_XFERINPROGRESS:
return "Transfer In-Progress";
case DWC3_DEPEVT_XFERNOTREADY:
return "Transfer Not Ready";
case DWC3_DEPEVT_RXTXFIFOEVT:
return "FIFO";
case DWC3_DEPEVT_STREAMEVT:
return "Stream";
case DWC3_DEPEVT_EPCMDCMPLT:
return "Endpoint Command Complete";
}
return "UNKNOWN";
}
/**
* dwc3_gadget_event_type_string - return event name
* @event: the event code
*/
static inline const char *dwc3_gadget_event_type_string(u8 event)
{
switch (event) {
case DWC3_DEVICE_EVENT_DISCONNECT:
return "Disconnect";
case DWC3_DEVICE_EVENT_RESET:
return "Reset";
case DWC3_DEVICE_EVENT_CONNECT_DONE:
return "Connect Done";
case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE:
return "Link Status Change";
case DWC3_DEVICE_EVENT_WAKEUP:
return "Wake-Up";
case DWC3_DEVICE_EVENT_HIBER_REQ:
return "Hibernation";
case DWC3_DEVICE_EVENT_EOPF:
return "End of Periodic Frame";
case DWC3_DEVICE_EVENT_SOF:
return "Start of Frame";
case DWC3_DEVICE_EVENT_ERRATIC_ERROR:
return "Erratic Error";
case DWC3_DEVICE_EVENT_CMD_CMPL:
return "Command Complete";
case DWC3_DEVICE_EVENT_OVERFLOW:
return "Overflow";
default:
return "UNKNOWN";
}
}
void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...);
#ifdef CONFIG_DEBUG_FS
extern int dwc3_debugfs_init(struct dwc3 *);
extern void dwc3_debugfs_exit(struct dwc3 *);
#else
static inline int dwc3_debugfs_init(struct dwc3 *d)
{ return 0; }
static inline void dwc3_debugfs_exit(struct dwc3 *d)
{ }
#endif
#endif /* __DWC3_DEBUG_H */
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _IPT_AH_H
#define _IPT_AH_H
#include <linux/types.h>
struct ipt_ah {
__u32 spis[2]; /* Security Parameter Index */
__u8 invflags; /* Inverse flags */
};
/* Values for "invflags" field in struct ipt_ah. */
#define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */
#define IPT_AH_INV_MASK 0x01 /* All possible flags. */
#endif /*_IPT_AH_H*/
|
// SPDX-License-Identifier: GPL-2.0
#include <linux/init.h>
#include <linux/types.h>
#include <linux/audit.h>
#include <asm/unistd.h>
#include "audit.h"
static unsigned dir_class[] = {
#include <asm-generic/audit_dir_write.h>
~0U
};
static unsigned read_class[] = {
#include <asm-generic/audit_read.h>
~0U
};
static unsigned write_class[] = {
#include <asm-generic/audit_write.h>
~0U
};
static unsigned chattr_class[] = {
#include <asm-generic/audit_change_attr.h>
~0U
};
static unsigned signal_class[] = {
#include <asm-generic/audit_signal.h>
~0U
};
int audit_classify_arch(int arch)
{
#ifdef CONFIG_COMPAT
if (arch == AUDIT_ARCH_S390)
return 1;
#endif
return 0;
}
int audit_classify_syscall(int abi, unsigned syscall)
{
#ifdef CONFIG_COMPAT
if (abi == AUDIT_ARCH_S390)
return s390_classify_syscall(syscall);
#endif
switch(syscall) {
case __NR_open:
return AUDITSC_OPEN;
case __NR_openat:
return AUDITSC_OPENAT;
case __NR_socketcall:
return AUDITSC_SOCKETCALL;
case __NR_execve:
return AUDITSC_EXECVE;
case __NR_openat2:
return AUDITSC_OPENAT2;
default:
return AUDITSC_NATIVE;
}
}
static int __init audit_classes_init(void)
{
#ifdef CONFIG_COMPAT
audit_register_class(AUDIT_CLASS_WRITE_32, s390_write_class);
audit_register_class(AUDIT_CLASS_READ_32, s390_read_class);
audit_register_class(AUDIT_CLASS_DIR_WRITE_32, s390_dir_class);
audit_register_class(AUDIT_CLASS_CHATTR_32, s390_chattr_class);
audit_register_class(AUDIT_CLASS_SIGNAL_32, s390_signal_class);
#endif
audit_register_class(AUDIT_CLASS_WRITE, write_class);
audit_register_class(AUDIT_CLASS_READ, read_class);
audit_register_class(AUDIT_CLASS_DIR_WRITE, dir_class);
audit_register_class(AUDIT_CLASS_CHATTR, chattr_class);
audit_register_class(AUDIT_CLASS_SIGNAL, signal_class);
return 0;
}
__initcall(audit_classes_init);
|
/* ISC license. */
#include <skalibs/env.h>
size_t env_mergn (char const **v, size_t vmax, char const *const *envp, char const *modifs, size_t modiflen, size_t modifn)
{
return env_mergen(v, vmax, envp, env_len(envp), modifs, modiflen, modifn) ;
}
|
/* Simple example use of libwdog API for the watchdogd process monitor
*
* Copyright (c) 2015-2020 Joachim Wiberg <troglobit@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "wdog.h"
extern char *__progname;
extern int __wdog_testmode;
#define DEBUG(fmt, args...) if (dbg) printf("%s: " fmt "\n", __progname, ##args);
#define PERROR(fmt, args...) if (dbg) fprintf(stderr, "%s: " fmt ": %s\n", __progname, ##args, strerror(errno));
int main(int argc, char *argv[])
{
int id, i, dbg = 0;
unsigned int ack;
if (argc >= 2 && !strncmp(argv[1], "-V", 2))
dbg = 1;
DEBUG("=> Checking connectivity with watchdogd ...");
if (wdog_ping()) {
PERROR("Failed connectivity check");
return 1;
}
DEBUG("=> OK!");
id = wdog_subscribe(NULL, 3000, &ack);
if (id < 0) {
perror("Failed connecting to wdog");
return 1;
}
for (i = 0; i < 20; i++) {
int enabled = 0;
if (wdog_status(&enabled))
PERROR("Failed reading wdog status");
DEBUG("=> Kicking ack:%d ... (%sABLED)", ack, enabled ? "EN" : "DIS");
if (wdog_kick2(id, &ack))
PERROR("Failed kicking");
sleep(2);
/* Apx. halfway through, disable wdog ... */
if (i == 8) {
DEBUG("=> Verify that wdog can be disabled at runtime.");
wdog_enable(0);
/* Miss deadline */
sleep(3);
}
/* Let program kick "in the air" for a few iterations, must work! */
/* Later on ... re-enable */
if (i == 14) {
DEBUG("=> Re-enabling wdog ...");
wdog_enable(1);
}
}
DEBUG("=> Exiting ...");
if (wdog_unsubscribe(id, ack)) {
PERROR("Failed unsubscribe");
return 1;
}
return 0;
}
/**
* Local Variables:
* indent-tabs-mode: t
* c-file-style: "linux"
* End:
*/
|
/* Copyright (c) 2008-2011, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
#ifndef STREAM_H
#define STREAM_H
#include "common.h"
namespace vm {
class Stream {
public:
class Client {
public:
virtual void handleError() = 0;
};
Stream(Client* client, const uint8_t* data, unsigned size):
client(client), data(data), size(size), position_(0)
{ }
unsigned position() {
return position_;
}
void setPosition(unsigned p) {
position_ = p;
}
void skip(unsigned size) {
if (size > this->size - position_) {
client->handleError();
} else {
position_ += size;
}
}
void read(uint8_t* data, unsigned size) {
if (size > this->size - position_) {
memset(data, 0, size);
client->handleError();
} else {
memcpy(data, this->data + position_, size);
position_ += size;
}
}
uint8_t read1() {
uint8_t v;
read(&v, 1);
return v;
}
uint16_t read2() {
uint16_t a = read1();
uint16_t b = read1();
return (a << 8) | b;
}
uint32_t read4() {
uint32_t a = read2();
uint32_t b = read2();
return (a << 16) | b;
}
uint64_t read8() {
uint64_t a = read4();
uint64_t b = read4();
return (a << 32) | b;
}
uint32_t readFloat() {
return read4();
}
uint64_t readDouble() {
return read8();
}
private:
Client* client;
const uint8_t* data;
unsigned size;
unsigned position_;
};
} // namespace vm
#endif//STREAM_H
|
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard.
*/
#import "_ADBannerContentSizeIdentifierLandscape.h"
#import "IMConfigManagerDelegate-Protocol.h"
#import "IMConfigValidator-Protocol.h"
@class IMAPIMetricManager, IMCommonsNetworkReachability, IMConfigManager, NSMutableDictionary, NSMutableSet;
@interface IMCommonManager : _ADBannerContentSizeIdentifierLandscape <IMConfigManagerDelegate, IMConfigValidator>
{
BOOL _connectedToNetwork;
NSMutableDictionary *_allConfigManagers;
NSMutableDictionary *_allMetricManagers;
IMAPIMetricManager *_apiMetricManager;
NSMutableSet *_allProducts;
IMConfigManager *_rootConfigManager;
IMCommonsNetworkReachability *_networkReachability;
}
+ (id)manager;
- (void)setNetworkReachability:(id)fp8;
- (id)networkReachability;
- (void)setRootConfigManager:(id)fp8;
- (void)setConnectedToNetwork:(BOOL)fp8;
- (BOOL)connectedToNetwork;
- (void)setAllProducts:(id)fp8;
- (id)allProducts;
- (void)setApiMetricManager:(id)fp8;
- (id)apiMetricManager;
- (void)setAllMetricManagers:(id)fp8;
- (id)allMetricManagers;
- (void)setAllConfigManagers:(id)fp8;
- (id)allConfigManagers;
- (void).cxx_destruct;
- (void)expireCachedConfigsForProduct:(id)fp8;
- (void)forceUpdateRootConfigsFromURL:(id)fp8;
- (void)reportMetricData:(id)fp8 forProduct:(id)fp12 productIndex:(int)fp16;
- (void)reportMetricAPIIndex:(int)fp8;
- (void)registerMetricConfigs:(id)fp8 forProduct:(id)fp12;
- (id)getMetricManagerForProduct:(id)fp8 createIfNeeded:(BOOL)fp12;
- (void)deregisterConfigValidatorForProduct:(id)fp8;
- (id)getCachedConfigsForProduct:(id)fp8 validator:(id)fp12;
- (id)getConfigManagerForProduct:(id)fp8 createIfNeeded:(BOOL)fp12;
- (void)configUpdateTimestamp:(id)fp8;
- (void)configUpdateFailed:(id)fp8;
- (void)configUpdateSuccess:(id)fp8;
- (BOOL)validateNewConfigs:(id)fp8 timestamp:(id)fp12 product:(id)fp16;
- (BOOL)validateConfigControlParamsIn:(id)fp8 product:(id)fp12;
- (void)checkConfigUpdatesForProduct:(id)fp8;
- (void)checkConfigUpdatesForAllProducts;
- (void)checkConfigUpdates:(id)fp8;
- (void)checkNetworkStatus:(id)fp8;
- (int)getRegisteredDeviceIDMaskForProduct:(id)fp8;
- (void)registerDeviceIDMask:(int)fp8 forProduct:(id)fp12;
- (id)rootConfigManager;
- (id)init;
@end
|
/**
* Copyright © 2012-2013 Sergio Arroutbi Braojos <sarroutbi@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software
* for any purpose with or without fee is hereby granted, provided that
* the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef __HTML_PARSER_H__
#define __HTML_PARSER_H__
#include <stdint.h>
#include <stdlib.h>
#include "Bike.h"
const uint32_t MAX_HTML_PIECE = 1000000;
const uint32_t MAX_HTML_PIECE_LINE = 65535;
class HtmlParser
{
public:
HtmlParser ();
HtmlParser (const char* file);
~HtmlParser ();
void setFile (const char* file);
uint8_t parse ();
uint8_t parse (const char* file);
void logList ();
const BikeList & getList ();
uint8_t dummyBikeFill (Bike* bike);
private:
uint8_t parseABike (const char* htmlPiece, uint32_t htmlPieceSize,
Bike* bike);
uint16_t getHtmlPiece (FILE* f, char* htmlPiece, const uint16_t htmlMax);
uint8_t dissertUrl (const char* url, char* urlFull,
const uint16_t urlMax, char* urlText,
const uint16_t urlTextMax);
char _file[FILENAME_MAX];
BikeList _bikeList;
};
#endif // __HTML_PARSER_H__
|
#include "stack.h"
void run(V, Stack*);
|
/* keyboard.h - Minimal set of key bindings.
*
* Copyright (c) 2004-2015 Joachim Nilsson <troglobit@gmail.com>
* Copyright (c) 1998-2000 Joachim Nilsson, Jakob Eriksson, Anders Bornäs
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef KEYBOARD_H_
#define KEYBOARD_H_
#include "config.h"
#include "editor.h"
/* Another keyboard plugin (keybinding scheme)
* must implement this interface.
*
* See wordstar.c for an example.
*/
int keyboard_loop(buffer_t *currentBuffer);
#endif /* KEYBOARD_H_ */
|
//
// TCCore.h
// TCCore
//
// Created by Xin Zeng on 10/5/21.
//
#import <Foundation/Foundation.h>
//! Project version number for TCCore.
FOUNDATION_EXPORT double TCCoreVersionNumber;
//! Project version string for TCCore.
FOUNDATION_EXPORT const unsigned char TCCoreVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TCCore/PublicHeader.h>
#import "TCCoreWrapper.h"
|
//
// Created by Dmitry Mozgin on 21/04/2017.
//
#pragma once
#include "YieldInstruction.h"
namespace vd {
class WaitForSeconds : public IYieldInstruction {
public:
WaitForSeconds(double seconds);
//region Implementation of IYieldInstruction.
void Update() override;
bool IsDone() const override;
//endregion
private:
const double _seconds;
bool _done;
double _endTime;
};
}
|
/**
* stm32tpl -- STM32 C++ Template Peripheral Library
* Visit https://github.com/antongus/stm32tpl for new versions
*
* Copyright (c) 2011-2020 Anton B. Gusev aka AHTOXA
*
* 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.
*
*
* file : ioregister.h
* description : I/O register templates, bit-band template.
* created on : 14.01.2011
*
*/
#ifndef STM32TPL_IOREGISTER_H_INCLUDED
#define STM32TPL_IOREGISTER_H_INCLUDED
#include <cstdint>
/**
* IO (read/write accessible) register
* @param addr address of register
* @param type register type
*/
template<uint32_t addr, typename type = uint32_t>
struct IORegister
{
type operator=(type value) { *(volatile type*)addr = value; return value; }
const IORegister& operator|=(type value) { *(volatile type*)addr |= value; return *this; }
const IORegister& operator&=(type value) { *(volatile type*)addr &= value; return *this; }
const IORegister& operator^=(type value) { *(volatile type*)addr ^= value; return *this; }
const IORegister& operator+=(type value) { *(volatile type*)addr += value; return *this; }
const IORegister& operator-=(type value) { *(volatile type*)addr -= value; return *this; }
operator type() { return *(volatile type*)addr; }
};
/**
* Read-only register
* @param addr address of register
* @param type register type
*/
template<uint32_t addr, typename type = uint32_t>
struct IRegister
{
operator type() { return *(volatile type*)addr; }
};
/**
* IO structure.
* @param addr address of register
* @param T structure type
*/
template<uint32_t addr, class T>
struct IOStruct
{
volatile T* operator->() { return (volatile T*)addr; }
};
/**
* Peripheral bit - bit-band accessed bit.
* @param addr memory/peripheral address
* @param bit bit number
*/
template <uint32_t addr, uint32_t bit> struct PeriphBit
{
enum
{
pPERIPH_BASE = 0x40000000UL, // Peripheral base address
pPERIPH_BB_BASE = 0x42000000UL, // Peripheral base address in the bit-band region
pSRAM1_BB_BASE = 0x22000000UL, // SRAM1(112 KB) base address in the bit-band region
pSRAM2_BB_BASE = 0x2201C000UL // SRAM2(16 KB) base address in the bit-band region
};
enum { BB_ADDR = pPERIPH_BB_BASE + (addr - pPERIPH_BASE) * 32 + bit * 4 };
uint32_t operator=(uint32_t value) { *(volatile uint32_t*)BB_ADDR = (bool)value; return value; }
operator uint32_t() { return *(volatile uint32_t*)addr; }
};
#endif // STM32TPL_IOREGISTER_H_INCLUDED
|
/**********************************
* SCAENA FRAMEWORK
* Author: Marco Andrés Lotto
* License: MIT - 2016
**********************************/
#pragma once
#include "Cubo.h"
class GLSLProgram;
class SistemaIluminacion;
typedef glm::vec3 vec3;
typedef glm::mat4 mat4;
class Marcador{
private:
vec3 posicion;
Cubo marcador;
bool visible;
static float texturaData[];
mat4 modelMat;
vec3 scale;
public:
Marcador(float x, float y, float z, vec3 scale);
void isVisible(bool value);
void cambiarPosicion(float x, float y, float z);
void aumentarX(float incremento);
void aumentarY(float incremento);
void aumentarZ(float incremento);
vec3 getPosicion();
void setPosicion(vec3 posicion);
void cargar(const char* filename);
void render(GLSLProgram* shaderProgram, mat4 view, mat4 persp);
void setMaterial(float Ka, float Kd, float Ks, float brillo);
};
|
#pragma once
#include <string>
#include <vector>
#include "Color.h"
class Theme
{
public:
enum ElementType
{
PatternEditor,
SequenceEditor,
MacroEditor,
Oscilloscope,
SongName,
MacroName,
MacroNumber,
SequencePosition,
SequenceLength,
PatternLength,
OctaveNumber,
TouchRegion,
SynthGrid,
AutomationEditor,
AutomationTrack,
SynthGridName,
Unknown
};
struct Element
{
ElementType type;
int parameters[10];
char strParameters[10][50];
};
enum ColorType
{
CurrentRow,
BlockMarker,
EditCursor,
NonEditCursor,
RowCounter,
SelectedRow,
ModalBackground,
ModalBorder,
ModalTitleBackground,
ModalTitleText,
NormalText,
CommandShortcut,
CommandShortcutBackground,
ScrollBar,
PlayHead,
TextCursor,
TextBackground,
TextFocus,
OscilloscopeColor,
MutedOscilloscopeColor,
AutomationVerticalLine,
AutomationSpline,
AutomationSplineCurrent,
AutomationPlayHead,
AutomationEditPos,
AutomationNode,
AutomationNodeSelected,
NumColors
};
static const int numColors = ColorType::NumColors;
private:
std::string mName;
std::string mPath, mBackgroundPath, mFontPath, mBasePath;
int mWidth, mHeight, mFontWidth, mFontHeight;
std::vector<Element> mElement;
Color mColors[numColors];
bool loadDefinition(const std::string& path);
public:
Theme();
bool load(const std::string& path);
const std::string& getName() const;
const std::string& getPath() const;
const std::string& getFontPath() const;
const std::string& getBackgroundPath() const;
int getFontWidth() const;
int getFontHeight() const;
int getWidth() const;
int getHeight() const;
const Element& getElement(int index) const;
int getElementCount() const;
const Color& getColor(ColorType type) const;
};
|
/*
Contains the InputBox dialogs
Copyright (C) 2015 Marius Messerschmidt
*/
#ifndef _HAVE_MIXED_FORM
#define _HAVE_MIXED_FORM
#include <stdlib.h>
#include <stdbool.h>
#include <gtk/gtk.h>
#include "util.h"
//creates an yesno dialog totalargs values where is the --yesno
short create_mixed_form_dialog(int argc, char **argv, int start);
#endif
|
#pragma once
#include "http_parser.h"
#include <string>
#include "unordered.h"
#include <assert.h>
#include "nocopy.h"
#include <memory>
#include "utils.h"
struct http_connection_t;
/* http_request_t informs the server handler what the client is asking for */
struct http_request_t : static_count<http_request_t>
{
friend struct http_connection_t;
NOCOPY(http_request_t);
http_request_t(http_method method, const std::string &target_uri);
http_method method;
unordered_map<std::string, std::string> query_params;
std::string uri_path() const;
const std::string &body() const { assert(method == HTTP_POST); return _body; }
bool keep_alive() const;
private:
http_parser parser;
std::string target_uri;
http_parser_url parsed_url;
std::string _body;
};
typedef std::shared_ptr<http_request_t> http_request_ptr_t;
|
//
// Tomato Music Codec
// Media Foundation 媒体源操作
//
// 作者:SunnyCase
// 创建时间:2015-03-17
#pragma once
#include <Tomato.Media/Tomato.Media.h>
DEFINE_NS_MEDIA_CODEC
// 媒体源操作类型
enum class MediaSourceOperationKind
{
// 无
None,
// 开始
Start,
// 暂停
Pause,
// 停止
Stop,
// 设置速率
SetRate,
// 请求数据
RequestData,
// 到达结尾
EndOfStream
};
// 媒体源操作
class MediaSourceOperation
{
public:
MediaSourceOperation(MediaSourceOperationKind kind) noexcept
: kind(kind)
{
}
virtual ~MediaSourceOperation()
{
}
MediaSourceOperation() noexcept
: MediaSourceOperation(MediaSourceOperationKind::None)
{
}
// 获取类型
MediaSourceOperationKind GetKind() const noexcept { return kind; }
private:
MediaSourceOperationKind kind;
};
class MediaSourceStartOperation : public MediaSourceOperation
{
public:
MediaSourceStartOperation(IMFPresentationDescriptor* pd, MFTIME position) noexcept
: MediaSourceOperation(MediaSourceOperationKind::Start),
pd(pd), position(position)
{
}
IMFPresentationDescriptor* GetPresentationDescriptor() const noexcept
{
return pd.Get();
}
MFTIME GetPosition() const noexcept
{
return position;
}
private:
WRL::ComPtr<IMFPresentationDescriptor> pd;
MFTIME position;
};
class MediaStreamRequestDataOperation : public MediaSourceOperation
{
public:
MediaStreamRequestDataOperation(IMFMediaStream* mediaStream)
:MediaSourceOperation(MediaSourceOperationKind::RequestData), mediaStream(mediaStream)
{
}
IMFMediaStream* GetMediaStream() const noexcept
{
return mediaStream.Get();
}
private:
WRL::ComPtr<IMFMediaStream> mediaStream;
};
END_NS_MEDIA_CODEC
|
/*===============================================================================
Copyright (c) 2015-2016 PTC Inc. All Rights Reserved.
Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved.
Vuforia is a trademark of PTC Inc., registered in the United States and other
countries.
@file
MultiTargetResult.h
@brief
Header file for MultiTargetResult class.
===============================================================================*/
#ifndef _VUFORIA_MULTITARGETRESULT_H_
#define _VUFORIA_MULTITARGETRESULT_H_
// Include files
#include "ObjectTargetResult.h"
#include "MultiTarget.h"
namespace Vuforia
{
/// Result for a MultiTarget.
class VUFORIA_API MultiTargetResult : public ObjectTargetResult
{
public:
/// Returns the TrackableResult class' type
static Type getClassType();
/// Returns the corresponding Trackable that this result represents
virtual const MultiTarget& getTrackable() const = 0;
/// Returns the number of Trackables that form this MultiTarget
virtual int getNumPartResults() const = 0;
// Provides access to the TrackableResult for a specific part
virtual const TrackableResult* getPartResult(int idx) const = 0;
// Provides access to the TrackableResult for a specific part
virtual const TrackableResult* getPartResult(const char* name) const = 0;
};
} // namespace Vuforia
#endif //_VUFORIA_MULTITARGETRESULT_H_
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.