text
stringlengths 4
6.14k
|
|---|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
* Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
*/
#ifndef __PVRUSB2_CX2584X_V4L_H
#define __PVRUSB2_CX2584X_V4L_H
/*
This module connects the pvrusb2 driver to the I2C chip level
driver which handles combined device audio & video processing.
This interface is used internally by the driver; higher level code
should only interact through the interface provided by
pvrusb2-hdw.h.
*/
#include "pvrusb2-hdw-internal.h"
void pvr2_cx25840_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *sd);
#endif /* __PVRUSB2_CX2584X_V4L_H */
|
/*
* sys_parisc32.c: Conversion between 32bit and 64bit native syscalls.
*
* Copyright (C) 2000-2001 Hewlett Packard Company
* Copyright (C) 2000 John Marvin
* Copyright (C) 2001 Matthew Wilcox
*
* These routines maintain argument size conversion between 32bit and 64bit
* environment. Based heavily on sys_ia32.c and sys_sparc32.c.
*/
#include <linux/compat.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/file.h>
#include <linux/signal.h>
#include <linux/resource.h>
#include <linux/times.h>
#include <linux/time.h>
#include <linux/smp.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/slab.h>
#include <linux/uio.h>
#include <linux/ncp_fs.h>
#include <linux/poll.h>
#include <linux/personality.h>
#include <linux/stat.h>
#include <linux/highmem.h>
#include <linux/highuid.h>
#include <linux/mman.h>
#include <linux/binfmts.h>
#include <linux/namei.h>
#include <linux/vfs.h>
#include <linux/ptrace.h>
#include <linux/swap.h>
#include <linux/syscalls.h>
#include <asm/types.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include "sys32.h"
#undef DEBUG
#ifdef DEBUG
#define DBG(x) printk x
#else
#define DBG(x)
#endif
/*
* sys32_execve() executes a new program.
*/
asmlinkage int sys32_execve(struct pt_regs *regs)
{
int error;
struct filename *filename;
DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26]));
filename = getname((const char __user *) regs->gr[26]);
error = PTR_ERR(filename);
if (IS_ERR(filename))
goto out;
error = compat_do_execve(filename->name, compat_ptr(regs->gr[25]),
compat_ptr(regs->gr[24]), regs);
putname(filename);
out:
return error;
}
asmlinkage long sys32_unimplemented(int r26, int r25, int r24, int r23,
int r22, int r21, int r20)
{
printk(KERN_ERR "%s(%d): Unimplemented 32 on 64 syscall #%d!\n",
current->comm, current->pid, r20);
return -ENOSYS;
}
asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
struct compat_timespec __user *interval)
{
struct timespec t;
int ret;
KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, (struct timespec __user *)&t);
if (put_compat_timespec(&t, interval))
return -EFAULT;
return ret;
}
struct msgbuf32 {
int mtype;
char mtext[1];
};
asmlinkage long sys32_msgsnd(int msqid,
struct msgbuf32 __user *umsgp32,
size_t msgsz, int msgflg)
{
struct msgbuf *mb;
struct msgbuf32 mb32;
int err;
if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
return -ENOMEM;
err = get_user(mb32.mtype, &umsgp32->mtype);
mb->mtype = mb32.mtype;
err |= copy_from_user(mb->mtext, &umsgp32->mtext, msgsz);
if (err)
err = -EFAULT;
else
KERNEL_SYSCALL(err, sys_msgsnd, msqid, (struct msgbuf __user *)mb, msgsz, msgflg);
kfree(mb);
return err;
}
asmlinkage long sys32_msgrcv(int msqid,
struct msgbuf32 __user *umsgp32,
size_t msgsz, long msgtyp, int msgflg)
{
struct msgbuf *mb;
struct msgbuf32 mb32;
int err, len;
if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
return -ENOMEM;
KERNEL_SYSCALL(err, sys_msgrcv, msqid, (struct msgbuf __user *)mb, msgsz, msgtyp, msgflg);
if (err >= 0) {
len = err;
mb32.mtype = mb->mtype;
err = put_user(mb32.mtype, &umsgp32->mtype);
err |= copy_to_user(&umsgp32->mtext, mb->mtext, len);
if (err)
err = -EFAULT;
else
err = len;
}
kfree(mb);
return err;
}
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
off_t of;
if (offset && get_user(of, offset))
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
set_fs(old_fs);
if (offset && put_user(of, offset))
return -EFAULT;
return ret;
}
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
loff_t lof;
if (offset && get_user(lof, offset))
return -EFAULT;
set_fs(KERNEL_DS);
ret = sys_sendfile64(out_fd, in_fd, offset ? (loff_t __user *)&lof : NULL, count);
set_fs(old_fs);
if (offset && put_user(lof, offset))
return -EFAULT;
return ret;
}
/* lseek() needs a wrapper because 'offset' can be negative, but the top
* half of the argument has been zeroed by syscall.S.
*/
asmlinkage int sys32_lseek(unsigned int fd, int offset, unsigned int origin)
{
return sys_lseek(fd, offset, origin);
}
asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
{
union semun u;
if (cmd == SETVAL) {
/* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
* The int should be in the first 4, but our argument
* frobbing has left it in the last 4.
*/
u.val = *((int *)&arg + 1);
return sys_semctl (semid, semnum, cmd, u);
}
return sys_semctl (semid, semnum, cmd, arg);
}
long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
size_t len)
{
return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
buf, len);
}
asmlinkage long compat_sys_fallocate(int fd, int mode, u32 offhi, u32 offlo,
u32 lenhi, u32 lenlo)
{
return sys_fallocate(fd, mode, ((loff_t)offhi << 32) | offlo,
((loff_t)lenhi << 32) | lenlo);
}
asmlinkage long compat_sys_fanotify_mark(int fan_fd, int flags, u32 mask_hi,
u32 mask_lo, int fd,
const char __user *pathname)
{
return sys_fanotify_mark(fan_fd, flags, ((u64)mask_hi << 32) | mask_lo,
fd, pathname);
}
|
/* Copyright (c) 2010-2011 Code Aurora Forum. 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 Code Aurora Forum, 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 "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __ARCH_ARM_MACH_MSM_SPM_H
#define __ARCH_ARM_MACH_MSM_SPM_H
enum {
MSM_SPM_MODE_DISABLED,
MSM_SPM_MODE_CLOCK_GATING,
MSM_SPM_MODE_POWER_RETENTION,
MSM_SPM_MODE_POWER_COLLAPSE,
MSM_SPM_MODE_NR
};
enum {
MSM_SPM_L2_MODE_DISABLED = MSM_SPM_MODE_DISABLED,
MSM_SPM_L2_MODE_RETENTION,
MSM_SPM_L2_MODE_GDHS,
MSM_SPM_L2_MODE_POWER_COLLAPSE,
};
#if defined(CONFIG_MSM_SPM_V1)
enum {
MSM_SPM_REG_SAW_AVS_CTL,
MSM_SPM_REG_SAW_CFG,
MSM_SPM_REG_SAW_SPM_CTL,
MSM_SPM_REG_SAW_SPM_SLP_TMR_DLY,
MSM_SPM_REG_SAW_SPM_WAKE_TMR_DLY,
MSM_SPM_REG_SAW_SLP_CLK_EN,
MSM_SPM_REG_SAW_SLP_HSFS_PRECLMP_EN,
MSM_SPM_REG_SAW_SLP_HSFS_POSTCLMP_EN,
MSM_SPM_REG_SAW_SLP_CLMP_EN,
MSM_SPM_REG_SAW_SLP_RST_EN,
MSM_SPM_REG_SAW_SPM_MPM_CFG,
MSM_SPM_REG_NR_INITIALIZE,
MSM_SPM_REG_SAW_VCTL = MSM_SPM_REG_NR_INITIALIZE,
MSM_SPM_REG_SAW_STS,
MSM_SPM_REG_SAW_SPM_PMIC_CTL,
MSM_SPM_REG_NR
};
struct msm_spm_platform_data {
void __iomem *reg_base_addr;
uint32_t reg_init_values[MSM_SPM_REG_NR_INITIALIZE];
uint8_t awake_vlevel;
uint8_t retention_vlevel;
uint8_t collapse_vlevel;
uint8_t retention_mid_vlevel;
uint8_t collapse_mid_vlevel;
uint32_t vctl_timeout_us;
};
#elif defined(CONFIG_MSM_SPM_V2)
enum {
MSM_SPM_REG_SAW2_SECURE,
MSM_SPM_REG_SAW2_ID,
MSM_SPM_REG_SAW2_CFG,
MSM_SPM_REG_SAW2_STS0,
MSM_SPM_REG_SAW2_STS1,
MSM_SPM_REG_SAW2_VCTL,
MSM_SPM_REG_SAW2_AVS_CTL,
MSM_SPM_REG_SAW2_AVS_HYSTERESIS,
MSM_SPM_REG_SAW2_SPM_CTL,
MSM_SPM_REG_SAW2_PMIC_DLY,
MSM_SPM_REG_SAW2_PMIC_DATA_0,
MSM_SPM_REG_SAW2_PMIC_DATA_1,
MSM_SPM_REG_SAW2_RST,
MSM_SPM_REG_NR_INITIALIZE,
MSM_SPM_REG_SAW2_SEQ_ENTRY = MSM_SPM_REG_NR_INITIALIZE,
MSM_SPM_REG_NR
};
struct msm_spm_seq_entry {
uint32_t mode;
uint8_t *cmd;
bool notify_rpm;
};
struct msm_spm_platform_data {
void __iomem *reg_base_addr;
uint32_t reg_init_values[MSM_SPM_REG_NR_INITIALIZE];
uint8_t awake_vlevel;
uint32_t vctl_timeout_us;
uint32_t num_modes;
struct msm_spm_seq_entry *modes;
};
#endif
#if defined(CONFIG_MSM_SPM_V1) || defined(CONFIG_MSM_SPM_V2)
int msm_spm_set_low_power_mode(unsigned int mode, bool notify_rpm);
int msm_spm_set_vdd(unsigned int cpu, unsigned int vlevel);
void msm_spm_reinit(void);
void msm_spm_allow_x_cpu_set_vdd(bool allowed);
int msm_spm_init(struct msm_spm_platform_data *data, int nr_devs);
#if defined(CONFIG_MSM_L2_SPM)
int msm_spm_l2_set_low_power_mode(unsigned int mode, bool notify_rpm);
int msm_spm_l2_init(struct msm_spm_platform_data *data);
#else
static inline int msm_spm_l2_set_low_power_mode(unsigned int mode,
bool notify_rpm)
{
return -ENOSYS;
}
static inline int msm_spm_l2_init(struct msm_spm_platform_data *data)
{
return -ENOSYS;
}
#endif /* defined(CONFIG_MSM_L2_SPM) */
#else /* defined(CONFIG_MSM_SPM_V1) || defined(CONFIG_MSM_SPM_V2) */
static inline int msm_spm_set_low_power_mode(unsigned int mode, bool notify_rpm)
{
return -ENOSYS;
}
static inline int msm_spm_set_vdd(unsigned int cpu, unsigned int vlevel)
{
return -ENOSYS;
}
static inline void msm_spm_reinit(void)
{
/* empty */
}
static inline void msm_spm_allow_x_cpu_set_vdd(bool allowed)
{
/* empty */
}
#endif /*defined(CONFIG_MSM_SPM_V1) || defined (CONFIG_MSM_SPM_V2) */
#endif /* __ARCH_ARM_MACH_MSM_SPM_H */
|
/*
* CAPI encode/decode prototypes and defines
*
* Copyright (C) 1996 Universidade de Lisboa
*
* Written by Pedro Roque Marques (roque@di.fc.ul.pt)
*
* This software may be used and distributed according to the terms of
* the GNU General Public License, incorporated herein by reference.
*/
#ifndef CAPI_H
#define CAPI_H
#define REQ_CAUSE 0x01
#define REQ_DISPLAY 0x04
#define REQ_USER_TO_USER 0x08
#define AppInfoMask REQ_CAUSE|REQ_DISPLAY|REQ_USER_TO_USER
/* Connection Setup */
extern int capi_conn_req(const char * calledPN, struct sk_buff **buf,
int proto);
extern int capi_decode_conn_conf(struct pcbit_chan * chan, struct sk_buff *skb,
int *complete);
extern int capi_decode_conn_ind(struct pcbit_chan * chan, struct sk_buff *skb,
struct callb_data *info);
extern int capi_conn_resp(struct pcbit_chan* chan, struct sk_buff **skb);
extern int capi_conn_active_req(struct pcbit_chan* chan, struct sk_buff **skb);
extern int capi_decode_conn_actv_conf(struct pcbit_chan * chan,
struct sk_buff *skb);
extern int capi_decode_conn_actv_ind(struct pcbit_chan * chan,
struct sk_buff *skb);
extern int capi_conn_active_resp(struct pcbit_chan* chan,
struct sk_buff **skb);
/* Data */
extern int capi_select_proto_req(struct pcbit_chan *chan, struct sk_buff **skb,
int outgoing);
extern int capi_decode_sel_proto_conf(struct pcbit_chan *chan,
struct sk_buff *skb);
extern int capi_activate_transp_req(struct pcbit_chan *chan,
struct sk_buff **skb);
extern int capi_decode_actv_trans_conf(struct pcbit_chan *chan,
struct sk_buff *skb);
extern int capi_tdata_req(struct pcbit_chan* chan, struct sk_buff *skb);
extern int capi_tdata_resp(struct pcbit_chan *chan, struct sk_buff ** skb);
/* Connection Termination */
extern int capi_disc_req(ushort callref, struct sk_buff **skb, u_char cause);
extern int capi_decode_disc_conf(struct pcbit_chan *chan, struct sk_buff *skb);
extern int capi_decode_disc_ind(struct pcbit_chan *chan, struct sk_buff *skb);
extern int capi_disc_resp(struct pcbit_chan *chan, struct sk_buff **skb);
#ifdef DEBUG
extern int capi_decode_debug_188(u_char *hdr, ushort hdrlen);
#endif
static inline struct pcbit_chan *
capi_channel(struct pcbit_dev *dev, struct sk_buff *skb)
{
ushort callref;
callref = *((ushort*) skb->data);
skb_pull(skb, 2);
if (dev->b1->callref == callref)
return dev->b1;
else if (dev->b2->callref == callref)
return dev->b2;
return NULL;
}
#endif
|
/*
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
*
* Airgo Networks, Inc proprietary. All rights reserved.
* This file limIbssPeerMgmt.h contains prototypes for
* the utility functions LIM uses to maintain peers in IBSS.
* Author: Chandra Modumudi
* Date: 03/12/04
* History:-
* Date Modified by Modification Information
* --------------------------------------------------------------------
*/
#include "sirCommon.h"
#include "limUtils.h"
void limIbssInit(tpAniSirGlobal);
void limIbssDelete(tpAniSirGlobal,tpPESession psessionEntry);
tSirRetStatus limIbssCoalesce(tpAniSirGlobal, tpSirMacMgmtHdr, tpSchBeaconStruct, tANI_U8*,tANI_U32, tANI_U16,tpPESession);
tSirRetStatus limIbssStaAdd(tpAniSirGlobal, void *,tpPESession);
tSirRetStatus limIbssAddStaRsp( tpAniSirGlobal, void *,tpPESession);
void limIbssDelBssRsp( tpAniSirGlobal, void *,tpPESession);
void limIbssDelBssRspWhenCoalescing(tpAniSirGlobal, void *,tpPESession);
void limIbssAddBssRspWhenCoalescing(tpAniSirGlobal pMac, void * msg, tpPESession pSessionEntry);
void limIbssDecideProtectionOnDelete(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams,tpPESession pSessionEntry);
void limIbssHeartBeatHandle(tpAniSirGlobal pMac,tpPESession psessionEntry);
void limProcessIbssPeerInactivity(tpAniSirGlobal pMac, void *buf);
|
#include <JavaScriptCore/ASCIICType.h>
|
/*-------------------------------------------------------------------------
*
* generic-acc.h
* Atomic operations support when using HPs acc on HPUX
*
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* NOTES:
*
* Documentation:
* * inline assembly for Itanium-based HP-UX:
* http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/inline_assem_ERS.pdf
* * Implementing Spinlocks on the Intel (R) Itanium (R) Architecture and PA-RISC
* http://h21007.www2.hp.com/portal/download/files/unprot/itanium/spinlocks.pdf
*
* Itanium only supports a small set of numbers (6, -8, -4, -1, 1, 4, 8, 16)
* for atomic add/sub, so we just implement everything but compare_exchange
* via the compare_exchange fallbacks in atomics/generic.h.
*
* src/include/port/atomics/generic-acc.h
*
* -------------------------------------------------------------------------
*/
#include <machine/sys/inline.h>
#define pg_compiler_barrier_impl() _Asm_sched_fence()
#if defined(HAVE_ATOMICS)
/* IA64 always has 32/64 bit atomics */
#define PG_HAVE_ATOMIC_U32_SUPPORT
typedef struct pg_atomic_uint32
{
volatile uint32 value;
} pg_atomic_uint32;
#define PG_HAVE_ATOMIC_U64_SUPPORT
typedef struct pg_atomic_uint64
{
/*
* Alignment is guaranteed to be 64bit. Search for "Well-behaved
* application restrictions" => "Data alignment and data sharing" on HP's
* website. Unfortunately the URL doesn't seem to stable enough to
* include.
*/
volatile uint64 value;
} pg_atomic_uint64;
#endif /* defined(HAVE_ATOMICS) */
#if defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS)
#if defined(HAVE_ATOMICS)
#define MINOR_FENCE (_Asm_fence) (_UP_CALL_FENCE | _UP_SYS_FENCE | \
_DOWN_CALL_FENCE | _DOWN_SYS_FENCE )
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
STATIC_IF_INLINE bool
pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr,
uint32 *expected, uint32 newval)
{
bool ret;
uint32 current;
_Asm_mov_to_ar(_AREG_CCV, *expected, MINOR_FENCE);
/*
* We want a barrier, not just release/acquire semantics.
*/
_Asm_mf();
/*
* Notes:
* DOWN_MEM_FENCE | _UP_MEM_FENCE prevents reordering by the compiler
*/
current = _Asm_cmpxchg(_SZ_W, /* word */
_SEM_REL,
&ptr->value,
newval, _LDHINT_NONE,
_DOWN_MEM_FENCE | _UP_MEM_FENCE);
ret = current == *expected;
*expected = current;
return ret;
}
#define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
STATIC_IF_INLINE bool
pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr,
uint64 *expected, uint64 newval)
{
bool ret;
uint64 current;
_Asm_mov_to_ar(_AREG_CCV, *expected, MINOR_FENCE);
_Asm_mf();
current = _Asm_cmpxchg(_SZ_D, /* doubleword */
_SEM_REL,
&ptr->value,
newval, _LDHINT_NONE,
_DOWN_MEM_FENCE | _UP_MEM_FENCE);
ret = current == *expected;
*expected = current;
return ret;
}
#undef MINOR_FENCE
#endif /* defined(HAVE_ATOMICS) */
#endif /* defined(PG_USE_INLINE) || defined(ATOMICS_INCLUDE_DEFINITIONS) */
|
/*
* Copyright (c) 2008-2009 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef ANI_H
#define ANI_H
#define HAL_PROCESS_ANI 0x00000001
#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI))
#define BEACON_RSSI(ahp) (ahp->stats.avgbrssi)
#define ATH9K_ANI_OFDM_TRIG_HIGH 500
#define ATH9K_ANI_OFDM_TRIG_LOW 200
#define ATH9K_ANI_CCK_TRIG_HIGH 200
#define ATH9K_ANI_CCK_TRIG_LOW 100
#define ATH9K_ANI_NOISE_IMMUNE_LVL 4
#define ATH9K_ANI_USE_OFDM_WEAK_SIG true
#define ATH9K_ANI_CCK_WEAK_SIG_THR false
#define ATH9K_ANI_SPUR_IMMUNE_LVL 7
#define ATH9K_ANI_FIRSTEP_LVL 0
#define ATH9K_ANI_RSSI_THR_HIGH 40
#define ATH9K_ANI_RSSI_THR_LOW 7
#define ATH9K_ANI_PERIOD 100
#define HAL_NOISE_IMMUNE_MAX 4
#define HAL_SPUR_IMMUNE_MAX 7
#define HAL_FIRST_STEP_MAX 2
enum ath9k_ani_cmd {
ATH9K_ANI_PRESENT = 0x1,
ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
ATH9K_ANI_MODE = 0x40,
ATH9K_ANI_PHYERR_RESET = 0x80,
ATH9K_ANI_ALL = 0xff
};
struct ath9k_mib_stats {
u32 ackrcv_bad;
u32 rts_bad;
u32 rts_good;
u32 fcs_bad;
u32 beacons;
};
struct ar5416AniState {
struct ath9k_channel *c;
u8 noiseImmunityLevel;
u8 spurImmunityLevel;
u8 firstepLevel;
u8 ofdmWeakSigDetectOff;
u8 cckWeakSigThreshold;
u32 listenTime;
u32 ofdmTrigHigh;
u32 ofdmTrigLow;
int32_t cckTrigHigh;
int32_t cckTrigLow;
int32_t rssiThrLow;
int32_t rssiThrHigh;
u32 noiseFloor;
u32 txFrameCount;
u32 rxFrameCount;
u32 cycleCount;
u32 ofdmPhyErrCount;
u32 cckPhyErrCount;
u32 ofdmPhyErrBase;
u32 cckPhyErrBase;
int16_t pktRssi[2];
int16_t ofdmErrRssi[2];
int16_t cckErrRssi[2];
};
struct ar5416Stats {
u32 ast_ani_niup;
u32 ast_ani_nidown;
u32 ast_ani_spurup;
u32 ast_ani_spurdown;
u32 ast_ani_ofdmon;
u32 ast_ani_ofdmoff;
u32 ast_ani_cckhigh;
u32 ast_ani_ccklow;
u32 ast_ani_stepup;
u32 ast_ani_stepdown;
u32 ast_ani_ofdmerrs;
u32 ast_ani_cckerrs;
u32 ast_ani_reset;
u32 ast_ani_lzero;
u32 ast_ani_lneg;
u32 avgbrssi;
struct ath9k_mib_stats ast_mibstats;
};
#define ah_mibStats stats.ast_mibstats
void ath9k_ani_reset(struct ath_hw *ah);
void ath9k_hw_ani_monitor(struct ath_hw *ah,
struct ath9k_channel *chan);
void ath9k_enable_mib_counters(struct ath_hw *ah);
void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
u32 *rxf_pcnt, u32 *txf_pcnt);
void ath9k_hw_procmibevent(struct ath_hw *ah);
void ath9k_hw_ani_setup(struct ath_hw *ah);
void ath9k_hw_ani_init(struct ath_hw *ah);
void ath9k_hw_ani_disable(struct ath_hw *ah);
#endif /* ANI_H */
|
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __UM_PROCESSOR_I386_H
#define __UM_PROCESSOR_I386_H
#include <linux/string.h>
#include <asm/segment.h>
#include <asm/ldt.h>
extern int host_has_cmov;
struct uml_tls_struct {
struct user_desc tls;
unsigned flushed:1;
unsigned present:1;
};
struct arch_thread {
struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];
unsigned long debugregs[8];
int debugregs_seq;
struct faultinfo faultinfo;
};
#define INIT_ARCH_THREAD { \
.tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \
{ .present = 0, .flushed = 0 } }, \
.debugregs = { [ 0 ... 7 ] = 0 }, \
.debugregs_seq = 0, \
.faultinfo = { 0, 0, 0 } \
}
#define STACKSLOTS_PER_LINE 8
static inline void arch_flush_thread(struct arch_thread *thread)
{
/* Clear any TLS still hanging */
memset(&thread->tls_array, 0, sizeof(thread->tls_array));
}
static inline void arch_copy_thread(struct arch_thread *from,
struct arch_thread *to)
{
memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
}
/*
* Default implementation of macro that returns current
* instruction pointer ("program counter"). Stolen
* from asm-i386/processor.h
*/
#define current_text_addr() \
({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
#define current_sp() ({ void *sp; __asm__("movl %%esp, %0" : "=r" (sp) : ); sp; })
#define current_bp() ({ unsigned long bp; __asm__("movl %%ebp, %0" : "=r" (bp) : ); bp; })
#endif
|
/* ====================================================================
* Copyright (c) 1999-2000 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED 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 APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group and was originally based
* on public domain software written at the National Center for
* Supercomputing Applications, University of Illinois, Urbana-Champaign.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*/
/*
**
** ap_mm.h -- wrapper code for MM shared memory library
**
*/
#ifdef EAPI
#ifndef AP_MM_H
#define AP_MM_H 1
#ifndef FALSE
#define FALSE 0
#define TRUE !FALSE
#endif
API_EXPORT(int) ap_mm_useable(void);
typedef void AP_MM;
typedef enum { AP_MM_LOCK_RD, AP_MM_LOCK_RW } ap_mm_lock_mode;
/* Global Malloc-Replacement API */
API_EXPORT(int) ap_MM_create(size_t size, char *file);
API_EXPORT(int) ap_MM_permission(mode_t mode, uid_t owner, gid_t group);
API_EXPORT(void) ap_MM_destroy(void);
API_EXPORT(int) ap_MM_lock(ap_mm_lock_mode mode);
API_EXPORT(int) ap_MM_unlock(void);
API_EXPORT(void *) ap_MM_malloc(size_t size);
API_EXPORT(void *) ap_MM_realloc(void *ptr, size_t size);
API_EXPORT(void) ap_MM_free(void *ptr);
API_EXPORT(void *) ap_MM_calloc(size_t number, size_t size);
API_EXPORT(char *) ap_MM_strdup(const char *str);
API_EXPORT(size_t) ap_MM_sizeof(void *ptr);
API_EXPORT(size_t) ap_MM_maxsize(void);
API_EXPORT(size_t) ap_MM_available(void);
API_EXPORT(char *) ap_MM_error(void);
/* Standard Malloc-Style API */
API_EXPORT(AP_MM *) ap_mm_create(size_t size, char *file);
API_EXPORT(int) ap_mm_permission(AP_MM *mm, mode_t mode, uid_t owner, gid_t group);
API_EXPORT(void) ap_mm_destroy(AP_MM *mm);
API_EXPORT(int) ap_mm_lock(AP_MM *mm, ap_mm_lock_mode mode);
API_EXPORT(int) ap_mm_unlock(AP_MM *mm);
API_EXPORT(void *) ap_mm_malloc(AP_MM *mm, size_t size);
API_EXPORT(void *) ap_mm_realloc(AP_MM *mm, void *ptr, size_t size);
API_EXPORT(void) ap_mm_free(AP_MM *mm, void *ptr);
API_EXPORT(void *) ap_mm_calloc(AP_MM *mm, size_t number, size_t size);
API_EXPORT(char *) ap_mm_strdup(AP_MM *mm, const char *str);
API_EXPORT(size_t) ap_mm_sizeof(AP_MM *mm, void *ptr);
API_EXPORT(size_t) ap_mm_maxsize(void);
API_EXPORT(size_t) ap_mm_available(AP_MM *mm);
API_EXPORT(char *) ap_mm_error(void);
API_EXPORT(void) ap_mm_display_info(AP_MM *mm);
/* Low-Level Shared Memory API */
API_EXPORT(void *) ap_mm_core_create(size_t size, char *file);
API_EXPORT(int) ap_mm_core_permission(void *core, mode_t mode, uid_t owner, gid_t group);
API_EXPORT(void) ap_mm_core_delete(void *core);
API_EXPORT(size_t) ap_mm_core_size(void *core);
API_EXPORT(int) ap_mm_core_lock(void *core, ap_mm_lock_mode mode);
API_EXPORT(int) ap_mm_core_unlock(void *core);
API_EXPORT(size_t) ap_mm_core_maxsegsize(void);
API_EXPORT(size_t) ap_mm_core_align2page(size_t size);
API_EXPORT(size_t) ap_mm_core_align2word(size_t size);
/* Internal Library API */
API_EXPORT(void) ap_mm_lib_error_set(unsigned int, const char *str);
API_EXPORT(char *) ap_mm_lib_error_get(void);
API_EXPORT(int) ap_mm_lib_version(void);
#endif /* AP_MM_H */
#endif /* EAPI */
|
/*
* Copyright (C) 2010, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VectorMath_h
#define VectorMath_h
// Defines the interface for several vector math functions whose implementation will ideally be optimized.
namespace WebCore {
namespace VectorMath {
void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess);
void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess);
} // namespace VectorMath
} // namespace WebCore
#endif // VectorMath_h
|
/* Not prefetching when the step is loop variant. */
/* { dg-do compile } */
/* { dg-options "-O3 -msse2 -fprefetch-loop-arrays -fdump-tree-aprefetch-details --param min-insn-to-prefetch-ratio=3 --param simultaneous-prefetches=10 -fdump-tree-aprefetch-details" } */
double data[16384];
void donot_prefetch_when_non_constant_step_is_variant(int step, int n)
{
int a;
int b;
for (a = 1; a < step; a++,step*=2) {
for (b = 0; b < n; b += 2 * step) {
int i = 2*(b + a);
int j = 2*(b + a + step);
data[j] = data[i];
data[j+1] = data[i+1];
}
}
}
/* { dg-final { scan-tree-dump "Not prefetching" "aprefetch" } } */
/* { dg-final { scan-tree-dump "loop variant step" "aprefetch" } } */
|
#ifndef _XT_SET_H
#define _XT_SET_H
#include <linux/types.h>
#include <linux/netfilter/ipset/ip_set.h>
/* Revision 0 interface: backward compatible with netfilter/iptables */
/*
* Option flags for kernel operations (xt_set_info_v0)
*/
#define IPSET_SRC 0x01 /* Source match/add */
#define IPSET_DST 0x02 /* Destination match/add */
#define IPSET_MATCH_INV 0x04 /* Inverse matching */
struct xt_set_info_v0 {
ip_set_id_t index;
union {
__u32 flags[IPSET_DIM_MAX + 1];
struct {
__u32 __flags[IPSET_DIM_MAX];
__u8 dim;
__u8 flags;
} compat;
} u;
};
/* match and target infos */
struct xt_set_info_match_v0 {
struct xt_set_info_v0 match_set;
};
struct xt_set_info_target_v0 {
struct xt_set_info_v0 add_set;
struct xt_set_info_v0 del_set;
};
/* Revision 1: current interface to netfilter/iptables */
struct xt_set_info {
ip_set_id_t index;
__u8 dim;
__u8 flags;
};
/* match and target infos */
struct xt_set_info_match {
struct xt_set_info match_set;
};
struct xt_set_info_target {
struct xt_set_info add_set;
struct xt_set_info del_set;
};
#endif /*_XT_SET_H*/
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Nimble_SnapshotsVersionNumber;
FOUNDATION_EXPORT const unsigned char Nimble_SnapshotsVersionString[];
|
/******************************************************************************
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2007 - 2010 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* 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,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Linux Wireless <ilw@linux.intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
* BSD LICENSE
*
* Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
/*
* Please use this file (iwl-5000-hw.h) only for hardware-related definitions.
* Use iwl-commands.h for uCode API definitions.
*/
#ifndef __iwl_5000_hw_h__
#define __iwl_5000_hw_h__
/* 5150 only */
#define IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF (-5)
static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
{
u16 temperature, voltage;
__le16 *temp_calib =
(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE);
temperature = le16_to_cpu(temp_calib[0]);
voltage = le16_to_cpu(temp_calib[1]);
/* offset = temp - volt / coeff */
return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF);
}
#endif /* __iwl_5000_hw_h__ */
|
/*
* Mixer Interface - HDA simple abstact module
* Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <math.h>
#include "asoundlib.h"
#include "mixer_abst.h"
#include "sbase.h"
static struct sm_elem_ops simple_hda_ops;
struct melem_sids sids[] = {
{
.sid = SID_FRONT,
.sname = "Front",
.sindex = 0,
.weight = 1,
.chanmap = { 3, 0 },
.sops = &simple_hda_ops,
}
};
#define SELECTORS (sizeof(selectors)/sizeof(selectors[0]))
struct helem_selector selectors[] = {
{
.iface = SND_CTL_ELEM_IFACE_MIXER,
.name = "Front Playback Volume",
.index = 0,
.sid = SID_FRONT,
.purpose = PURPOSE_VOLUME,
.caps = SM_CAP_PVOLUME,
},
{
.iface = SND_CTL_ELEM_IFACE_MIXER,
.name = "Front Playback Switch",
.index = 0,
.sid = SID_FRONT,
.purpose = PURPOSE_SWITCH,
.caps = SM_CAP_PSWITCH,
}
};
int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
{
struct bclass_private *priv = snd_mixer_sbasic_get_private(class);
return priv->ops.event(class, mask, helem, melem);
}
int alsa_mixer_simple_init(snd_mixer_class_t *class)
{
struct bclass_base_ops *ops;
int err;
err = mixer_simple_basic_dlopen(class, &ops);
if (err < 0)
return 0;
err = ops->selreg(class, selectors, SELECTORS);
if (err < 0)
return err;
err = ops->sidreg(class, sids, SELECTORS);
if (err < 0)
return err;
return 0;
}
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Greybus bundles
*
* Copyright 2014 Google Inc.
* Copyright 2014 Linaro Ltd.
*/
#ifndef __BUNDLE_H
#define __BUNDLE_H
#include <linux/list.h>
#define BUNDLE_ID_NONE U8_MAX
/* Greybus "public" definitions" */
struct gb_bundle {
struct device dev;
struct gb_interface *intf;
u8 id;
u8 class;
u8 class_major;
u8 class_minor;
size_t num_cports;
struct greybus_descriptor_cport *cport_desc;
struct list_head connections;
u8 *state;
struct list_head links; /* interface->bundles */
};
#define to_gb_bundle(d) container_of(d, struct gb_bundle, dev)
/* Greybus "private" definitions" */
struct gb_bundle *gb_bundle_create(struct gb_interface *intf, u8 bundle_id,
u8 class);
int gb_bundle_add(struct gb_bundle *bundle);
void gb_bundle_destroy(struct gb_bundle *bundle);
/* Bundle Runtime PM wrappers */
#ifdef CONFIG_PM
static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
{
int retval;
retval = pm_runtime_get_sync(&bundle->dev);
if (retval < 0) {
dev_err(&bundle->dev,
"pm_runtime_get_sync failed: %d\n", retval);
pm_runtime_put_noidle(&bundle->dev);
return retval;
}
return 0;
}
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
{
int retval;
pm_runtime_mark_last_busy(&bundle->dev);
retval = pm_runtime_put_autosuspend(&bundle->dev);
return retval;
}
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle)
{
pm_runtime_get_noresume(&bundle->dev);
}
static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle)
{
pm_runtime_put_noidle(&bundle->dev);
}
#else
static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
{ return 0; }
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
{ return 0; }
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle) {}
static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle) {}
#endif
#endif /* __BUNDLE_H */
|
/* Copyright (c) 2009, Code Aurora Forum. 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 Code Aurora nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __MACH_QDSP5_V2_SNDDEV_ECODEC_H
#define __MACH_QDSP5_V2_SNDDEV_ECODEC_H
#include <mach/qdsp5v2_1x/audio_def.h>
struct snddev_ecodec_data {
u32 capability; /* RX or TX */
const char *name;
u32 copp_id; /* audpp routing */
u32 acdb_id; /* Audio Cal purpose */
u8 channel_mode;
u32 conf_pcm_ctl_val;
u32 conf_aux_codec_intf;
u32 conf_data_format_padding_val;
u32 vol_idx;
};
struct q5v2audio_ecodec_ops {
void (*bt_sco_enable)(int en);
};
void htc_7x30_register_ecodec_ops(struct q5v2audio_ecodec_ops *ops);
#endif
|
#ifndef __COMPAT_H__
#define __COMPAT_H__
#define HIGH 1
#define LOW 0
/* Forward declarations to avoid broken auto-prototyper (coughs on '::'?) */
static void run_cli(AP_HAL::UARTDriver *port);
#endif // __COMPAT_H__
|
/*
* INETPEER - A storage for permanent information about peers
*
* Authors: Andrey V. Savochkin <saw@msu.ru>
*/
#ifndef _NET_INETPEER_H
#define _NET_INETPEER_H
#include <linux/types.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/spinlock.h>
#include <linux/rtnetlink.h>
#include <net/ipv6.h>
#include <linux/atomic.h>
struct inetpeer_addr_base {
union {
__be32 a4;
__be32 a6[4];
};
};
struct inetpeer_addr {
struct inetpeer_addr_base addr;
__u16 family;
};
struct inet_peer {
/* group together avl_left,avl_right,v4daddr to speedup lookups */
struct inet_peer __rcu *avl_left, *avl_right;
struct inetpeer_addr daddr;
__u32 avl_height;
u32 metrics[RTAX_MAX];
u32 rate_tokens; /* rate limiting for ICMP */
unsigned long rate_last;
unsigned long pmtu_expires;
u32 pmtu_orig;
u32 pmtu_learned;
struct inetpeer_addr_base redirect_learned;
union {
struct list_head gc_list;
struct rcu_head gc_rcu;
};
/*
* Once inet_peer is queued for deletion (refcnt == -1), following fields
* are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
* We can share memory with rcu_head to help keep inet_peer small.
*/
union {
struct {
atomic_t rid; /* Frag reception counter */
atomic_t ip_id_count; /* IP ID for the next packet */
__u32 tcp_ts;
__u32 tcp_ts_stamp;
};
struct rcu_head rcu;
struct inet_peer *gc_next;
};
/* following fields might be frequently dirtied */
__u32 dtime; /* the time of last use of not referenced entries */
atomic_t refcnt;
};
void inet_initpeers(void) __init;
#define INETPEER_METRICS_NEW (~(u32) 0)
static inline bool inet_metrics_new(const struct inet_peer *p)
{
return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW;
}
/* can be called with or without local BH being disabled */
struct inet_peer *inet_getpeer(const struct inetpeer_addr *daddr, int create);
static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
{
struct inetpeer_addr daddr;
daddr.addr.a4 = v4daddr;
daddr.family = AF_INET;
return inet_getpeer(&daddr, create);
}
static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create)
{
struct inetpeer_addr daddr;
*(struct in6_addr *)daddr.addr.a6 = *v6daddr;
daddr.family = AF_INET6;
return inet_getpeer(&daddr, create);
}
/* can be called from BH context or outside */
extern void inet_putpeer(struct inet_peer *p);
extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
extern void inetpeer_invalidate_tree(int family);
/*
* temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
* tcp_ts_stamp if no refcount is taken on inet_peer
*/
static inline void inet_peer_refcheck(const struct inet_peer *p)
{
WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
}
/* can be called with or without local BH being disabled */
static inline int inet_getid(struct inet_peer *p, int more)
{
more++;
inet_peer_refcheck(p);
return atomic_add_return(more, &p->ip_id_count) - more;
}
#endif /* _NET_INETPEER_H */
|
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef XLIBUTILS_H
#define XLIBUTILS_H
#ifdef XCB_USE_XLIB
#include <xcb/xcb_keysyms.h>
#include <QByteArray>
QT_BEGIN_NAMESPACE
xcb_keysym_t q_XLookupString(void *display, xcb_window_t window, xcb_window_t root, uint state, xcb_keycode_t code, int type, QByteArray *chars);
QT_END_NAMESPACE
#endif // XCB_USE_XLIB
#endif
|
/* Precomp.h -- StdAfx
2013-11-12 : Igor Pavlov : Public domain */
#ifndef __7Z_PRECOMP_H
#define __7Z_PRECOMP_H
#include "Compiler.h"
/* #include "7zTypes.h" */
#endif
|
/*
* include/asm-arm/arch-at91/at91_pio.h
*
* Copyright (C) 2005 Ivan Kokshaysky
* Copyright (C) SAN People
*
* Parallel I/O Controller (PIO) - System peripherals registers.
* Based on AT91RM9200 datasheet revision E.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef AT91_PIO_H
#define AT91_PIO_H
#define PIO_PER 0x00 /* Enable Register */
#define PIO_PDR 0x04 /* Disable Register */
#define PIO_PSR 0x08 /* Status Register */
#define PIO_OER 0x10 /* Output Enable Register */
#define PIO_ODR 0x14 /* Output Disable Register */
#define PIO_OSR 0x18 /* Output Status Register */
#define PIO_IFER 0x20 /* Glitch Input Filter Enable */
#define PIO_IFDR 0x24 /* Glitch Input Filter Disable */
#define PIO_IFSR 0x28 /* Glitch Input Filter Status */
#define PIO_SODR 0x30 /* Set Output Data Register */
#define PIO_CODR 0x34 /* Clear Output Data Register */
#define PIO_ODSR 0x38 /* Output Data Status Register */
#define PIO_PDSR 0x3c /* Pin Data Status Register */
#define PIO_IER 0x40 /* Interrupt Enable Register */
#define PIO_IDR 0x44 /* Interrupt Disable Register */
#define PIO_IMR 0x48 /* Interrupt Mask Register */
#define PIO_ISR 0x4c /* Interrupt Status Register */
#define PIO_MDER 0x50 /* Multi-driver Enable Register */
#define PIO_MDDR 0x54 /* Multi-driver Disable Register */
#define PIO_MDSR 0x58 /* Multi-driver Status Register */
#define PIO_PUDR 0x60 /* Pull-up Disable Register */
#define PIO_PUER 0x64 /* Pull-up Enable Register */
#define PIO_PUSR 0x68 /* Pull-up Status Register */
#define PIO_ASR 0x70 /* Peripheral A Select Register */
#define PIO_BSR 0x74 /* Peripheral B Select Register */
#define PIO_ABSR 0x78 /* AB Status Register */
#define PIO_OWER 0xa0 /* Output Write Enable Register */
#define PIO_OWDR 0xa4 /* Output Write Disable Register */
#define PIO_OWSR 0xa8 /* Output Write Status Register */
#endif
|
#define KERNEL_ELFCLASS ELFCLASS32
#define KERNEL_ELFDATA ELFDATA2LSB
#define HOST_ELFCLASS ELFCLASS32
#define HOST_ELFDATA ELFDATA2LSB
|
#pragma once
/*
* Copyright (C) 2012-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 <string>
#include <vector>
#include "AEAudioFormat.h"
#include "cores/AudioEngine/Utils/AEChannelInfo.h"
typedef std::vector<unsigned int > AESampleRateList;
typedef std::vector<enum AEDataFormat> AEDataFormatList;
enum AEDeviceType {
AE_DEVTYPE_PCM,
AE_DEVTYPE_IEC958,
AE_DEVTYPE_HDMI,
AE_DEVTYPE_DP
};
/**
* This classt provides the details of what the audio output hardware is capable of
*/
class CAEDeviceInfo
{
public:
std::string m_deviceName; /* the driver device name */
std::string m_displayName; /* the friendly display name */
std::string m_displayNameExtra; /* additional display name info, ie, monitor name from ELD */
enum AEDeviceType m_deviceType; /* the device type, PCM, IEC958 or HDMI */
CAEChannelInfo m_channels; /* the channels the device is capable of rendering */
AESampleRateList m_sampleRates; /* the samplerates the device is capable of rendering */
AEDataFormatList m_dataFormats; /* the dataformats the device is capable of rendering */
operator std::string();
static std::string DeviceTypeToString(enum AEDeviceType deviceType);
};
typedef std::vector<CAEDeviceInfo> AEDeviceInfoList;
|
/* PR tree-optimization/65215 */
__attribute__((noinline, noclone)) unsigned int
foo (unsigned char *p)
{
return ((unsigned int) p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
__attribute__((noinline, noclone)) unsigned int
bar (unsigned char *p)
{
return ((unsigned int) p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
}
struct S { unsigned int a; unsigned char b[5]; };
int
main ()
{
struct S s = { 1, { 2, 3, 4, 5, 6 } };
if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4)
return 0;
if (foo (&s.b[1]) != 0x03040506U
|| bar (&s.b[1]) != 0x06050403U)
__builtin_abort ();
return 0;
}
|
/*
* Copyright (C) 2014 Linaro Ltd.
* Author: Rob Herring <robh@kernel.org>
*
* Based on 8250 earlycon:
* (c) Copyright 2004 Hewlett-Packard Development Company, L.P.
* Bjorn Helgaas <bjorn.helgaas@hp.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.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/console.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/serial_core.h>
#include <linux/sizes.h>
#include <linux/mod_devicetable.h>
#ifdef CONFIG_FIX_EARLYCON_MEM
#include <asm/fixmap.h>
#endif
#include <asm/serial.h>
static struct console early_con = {
.name = "uart", /* 8250 console switch requires this name */
.flags = CON_PRINTBUFFER | CON_BOOT,
.index = -1,
};
static struct earlycon_device early_console_dev = {
.con = &early_con,
};
extern struct earlycon_id __earlycon_table[];
static const struct earlycon_id __earlycon_table_sentinel
__used __section(__earlycon_table_end);
static const struct of_device_id __earlycon_of_table_sentinel
__used __section(__earlycon_of_table_end);
static void __iomem * __init earlycon_map(unsigned long paddr, size_t size)
{
void __iomem *base;
#ifdef CONFIG_FIX_EARLYCON_MEM
set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr & PAGE_MASK);
base = (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
base += paddr & ~PAGE_MASK;
#else
base = ioremap(paddr, size);
#endif
if (!base)
pr_err("%s: Couldn't map 0x%llx\n", __func__,
(unsigned long long)paddr);
return base;
}
static int __init parse_options(struct earlycon_device *device, char *options)
{
struct uart_port *port = &device->port;
int length;
unsigned long addr;
if (uart_parse_earlycon(options, &port->iotype, &addr, &options))
return -EINVAL;
switch (port->iotype) {
case UPIO_MEM32:
case UPIO_MEM32BE:
port->regshift = 2; /* fall-through */
case UPIO_MEM:
port->mapbase = addr;
break;
case UPIO_PORT:
port->iobase = addr;
break;
default:
return -EINVAL;
}
if (options) {
device->baud = simple_strtoul(options, NULL, 0);
length = min(strcspn(options, " ") + 1,
(size_t)(sizeof(device->options)));
strlcpy(device->options, options, length);
}
if (port->iotype == UPIO_MEM || port->iotype == UPIO_MEM32 ||
port->iotype == UPIO_MEM32BE)
pr_info("Early serial console at MMIO%s 0x%llx (options '%s')\n",
(port->iotype == UPIO_MEM) ? "" :
(port->iotype == UPIO_MEM32) ? "32" : "32be",
(unsigned long long)port->mapbase,
device->options);
else
pr_info("Early serial console at I/O port 0x%lx (options '%s')\n",
port->iobase,
device->options);
return 0;
}
static int __init register_earlycon(char *buf, const struct earlycon_id *match)
{
int err;
struct uart_port *port = &early_console_dev.port;
/* On parsing error, pass the options buf to the setup function */
if (buf && !parse_options(&early_console_dev, buf))
buf = NULL;
spin_lock_init(&port->lock);
port->uartclk = BASE_BAUD * 16;
if (port->mapbase)
port->membase = earlycon_map(port->mapbase, 64);
early_console_dev.con->data = &early_console_dev;
err = match->setup(&early_console_dev, buf);
if (err < 0)
return err;
if (!early_console_dev.con->write)
return -ENODEV;
register_console(early_console_dev.con);
return 0;
}
/**
* setup_earlycon - match and register earlycon console
* @buf: earlycon param string
*
* Registers the earlycon console matching the earlycon specified
* in the param string @buf. Acceptable param strings are of the form
* <name>,io|mmio|mmio32|mmio32be,<addr>,<options>
* <name>,0x<addr>,<options>
* <name>,<options>
* <name>
*
* Only for the third form does the earlycon setup() method receive the
* <options> string in the 'options' parameter; all other forms set
* the parameter to NULL.
*
* Returns 0 if an attempt to register the earlycon was made,
* otherwise negative error code
*/
int __init setup_earlycon(char *buf)
{
const struct earlycon_id *match;
if (!buf || !buf[0])
return -EINVAL;
if (early_con.flags & CON_ENABLED)
return -EALREADY;
for (match = __earlycon_table; match->name[0]; match++) {
size_t len = strlen(match->name);
if (strncmp(buf, match->name, len))
continue;
if (buf[len]) {
if (buf[len] != ',')
continue;
buf += len + 1;
} else
buf = NULL;
return register_earlycon(buf, match);
}
return -ENOENT;
}
/* early_param wrapper for setup_earlycon() */
static int __init param_setup_earlycon(char *buf)
{
int err;
/*
* Just 'earlycon' is a valid param for devicetree earlycons;
* don't generate a warning from parse_early_params() in that case
*/
if (!buf || !buf[0])
return 0;
err = setup_earlycon(buf);
if (err == -ENOENT || err == -EALREADY)
return 0;
return err;
}
early_param("earlycon", param_setup_earlycon);
int __init of_setup_earlycon(unsigned long addr,
int (*setup)(struct earlycon_device *, const char *))
{
int err;
struct uart_port *port = &early_console_dev.port;
spin_lock_init(&port->lock);
port->iotype = UPIO_MEM;
port->mapbase = addr;
port->uartclk = BASE_BAUD * 16;
port->membase = earlycon_map(addr, SZ_4K);
early_console_dev.con->data = &early_console_dev;
err = setup(&early_console_dev, NULL);
if (err < 0)
return err;
if (!early_console_dev.con->write)
return -ENODEV;
register_console(early_console_dev.con);
return 0;
}
|
/*
* Copyright (C) 2006-2009 B.A.T.M.A.N. contributors:
*
* Simon Wunderlich, Marek Lindner
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* 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
*
*/
/* you should choose something big, if you don't want to waste cpu */
#define TYPE_OF_WORD unsigned long
#define WORD_BIT_SIZE (sizeof(TYPE_OF_WORD) * 8)
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno */
uint8_t get_bit_status(TYPE_OF_WORD *seq_bits, uint16_t last_seqno,
uint16_t curr_seqno);
/* turn corresponding bit on, so we can remember that we got the packet */
void bit_mark(TYPE_OF_WORD *seq_bits, int32_t n);
/* shift the packet array by n places. */
void bit_shift(TYPE_OF_WORD *seq_bits, int32_t n);
/* receive and process one packet, returns 1 if received seq_num is considered
* new, 0 if old */
char bit_get_packet(TYPE_OF_WORD *seq_bits, int16_t seq_num_diff,
int8_t set_mark);
/* count the hamming weight, how many good packets did we receive? */
int bit_packet_count(TYPE_OF_WORD *seq_bits);
|
#include <SDL/SDL.h>
void sdl_pixel_doubler (Surface *src, SDL_Surface *dest);
|
/*
* Access vector cache interface for object managers.
*
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
*/
#ifndef _SELINUX_AVC_H_
#define _SELINUX_AVC_H_
#include <linux/stddef.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/kdev_t.h>
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/audit.h>
#include <linux/lsm_audit.h>
#include <linux/in6.h>
#include "flask.h"
#include "av_permissions.h"
#include "security.h"
#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
extern int selinux_enforcing;
#else
#define selinux_enforcing 1
#endif
/*
* An entry in the AVC.
*/
struct avc_entry;
struct task_struct;
struct inode;
struct sock;
struct sk_buff;
/*
* AVC statistics
*/
struct avc_cache_stats {
unsigned int lookups;
unsigned int misses;
unsigned int allocations;
unsigned int reclaims;
unsigned int frees;
};
/*
* We only need this data after we have decided to send an audit message.
*/
struct selinux_audit_data {
u32 ssid;
u32 tsid;
u16 tclass;
u32 requested;
u32 audited;
u32 denied;
int result;
};
/*
* AVC operations
*/
void __init avc_init(void);
static inline u32 avc_audit_required(u32 requested,
struct av_decision *avd,
int result,
u32 auditdeny,
u32 *deniedp)
{
u32 denied, audited;
denied = requested & ~avd->allowed;
if (unlikely(denied)) {
audited = denied & avd->auditdeny;
/*
* auditdeny is TRICKY! Setting a bit in
* this field means that ANY denials should NOT be audited if
* the policy contains an explicit dontaudit rule for that
* permission. Take notice that this is unrelated to the
* actual permissions that were denied. As an example lets
* assume:
*
* denied == READ
* avd.auditdeny & ACCESS == 0 (not set means explicit rule)
* auditdeny & ACCESS == 1
*
* We will NOT audit the denial even though the denied
* permission was READ and the auditdeny checks were for
* ACCESS
*/
if (auditdeny && !(auditdeny & avd->auditdeny))
audited = 0;
} else if (result)
audited = denied = requested;
else
audited = requested & avd->auditallow;
*deniedp = denied;
return audited;
}
int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass,
u32 requested, u32 audited, u32 denied, int result,
struct common_audit_data *a,
unsigned flags);
/**
* avc_audit - Audit the granting or denial of permissions.
* @ssid: source security identifier
* @tsid: target security identifier
* @tclass: target security class
* @requested: requested permissions
* @avd: access vector decisions
* @result: result from avc_has_perm_noaudit
* @a: auxiliary audit data
* @flags: VFS walk flags
*
* Audit the granting or denial of permissions in accordance
* with the policy. This function is typically called by
* avc_has_perm() after a permission check, but can also be
* called directly by callers who use avc_has_perm_noaudit()
* in order to separate the permission check from the auditing.
* For example, this separation is useful when the permission check must
* be performed under a lock, to allow the lock to be released
* before calling the auditing code.
*/
static inline int avc_audit(u32 ssid, u32 tsid,
u16 tclass, u32 requested,
struct av_decision *avd,
int result,
struct common_audit_data *a, unsigned flags)
{
u32 audited, denied;
audited = avc_audit_required(requested, avd, result, 0, &denied);
if (likely(!audited))
return 0;
return slow_avc_audit(ssid, tsid, tclass,
requested, audited, denied, result,
a, flags);
}
#define AVC_STRICT 1 /* Ignore permissive mode. */
#define AVC_OPERATION_CMD 2 /* ignore command when updating operations */
int avc_has_perm_noaudit(u32 ssid, u32 tsid,
u16 tclass, u32 requested,
unsigned flags,
struct av_decision *avd);
int avc_has_operation(u32 ssid, u32 tsid, u16 tclass, u32 requested,
u16 cmd, struct common_audit_data *ad);
int avc_has_perm_flags(u32 ssid, u32 tsid,
u16 tclass, u32 requested,
struct common_audit_data *auditdata,
unsigned);
static inline int avc_has_perm(u32 ssid, u32 tsid,
u16 tclass, u32 requested,
struct common_audit_data *auditdata)
{
return avc_has_perm_flags(ssid, tsid, tclass, requested, auditdata, 0);
}
u32 avc_policy_seqno(void);
#define AVC_CALLBACK_GRANT 1
#define AVC_CALLBACK_TRY_REVOKE 2
#define AVC_CALLBACK_REVOKE 4
#define AVC_CALLBACK_RESET 8
#define AVC_CALLBACK_AUDITALLOW_ENABLE 16
#define AVC_CALLBACK_AUDITALLOW_DISABLE 32
#define AVC_CALLBACK_AUDITDENY_ENABLE 64
#define AVC_CALLBACK_AUDITDENY_DISABLE 128
#define AVC_CALLBACK_ADD_OPERATION 256
int avc_add_callback(int (*callback)(u32 event), u32 events);
/* Exported to selinuxfs */
int avc_get_hash_stats(char *page);
extern unsigned int avc_cache_threshold;
/* Attempt to free avc node cache */
void avc_disable(void);
#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats);
#endif
#endif /* _SELINUX_AVC_H_ */
|
#ifndef __MT6620_FM_CMD_H__
#define __MT6620_FM_CMD_H__
#include <linux/types.h>
#include "fm_typedef.h"
/* FM basic-operation's opcode */
#define FM_BOP_BASE (0x80)
enum {
FM_WRITE_BASIC_OP = (FM_BOP_BASE + 0x00),
FM_UDELAY_BASIC_OP = (FM_BOP_BASE + 0x01),
FM_RD_UNTIL_BASIC_OP = (FM_BOP_BASE + 0x02),
FM_MODIFY_BASIC_OP = (FM_BOP_BASE + 0x03),
FM_MSLEEP_BASIC_OP = (FM_BOP_BASE + 0x04),
FM_MAX_BASIC_OP = (FM_BOP_BASE + 0x05)
};
/* FM BOP's size */
#define FM_WRITE_BASIC_OP_SIZE (3)
#define FM_UDELAY_BASIC_OP_SIZE (4)
#define FM_RD_UNTIL_BASIC_OP_SIZE (5)
#define FM_MODIFY_BASIC_OP_SIZE (5)
#define FM_MSLEEP_BASIC_OP_SIZE (4)
fm_s32 mt6620_off_2_longANA_1(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_off_2_longANA_2(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_pwrup_digital_init_1(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_pwrup_digital_init_2(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_pwrup_digital_init_3(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_pwrdown(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_rampdown(fm_u8 *buf, fm_s32 buf_size);
fm_s32 mt6620_tune_1(fm_u8 *buf, fm_s32 buf_size, fm_u16 freq);
fm_s32 mt6620_tune_2(fm_u8 *buf, fm_s32 buf_size, fm_u16 freq);
fm_s32 mt6620_tune_3(fm_u8 *buf, fm_s32 buf_size, fm_u16 freq);
fm_s32 mt6620_fast_tune(fm_u8 *tx_buf, fm_s32 tx_buf_size, fm_u16 freq);
fm_s32 mt6620_full_cqi_req(fm_u8 *buf, fm_s32 buf_size, fm_u16 freq, fm_s32 cnt, fm_s32 type);
fm_s32 mt6620_seek_1(fm_u8 *buf, fm_s32 buf_size, fm_u16 seekdir, fm_u16 space, fm_u16 max_freq,
fm_u16 min_freq);
fm_s32 mt6620_seek_2(fm_u8 *buf, fm_s32 buf_size, fm_u16 seekdir, fm_u16 space, fm_u16 max_freq,
fm_u16 min_freq);
fm_s32 mt6620_scan_1(fm_u8 *buf, fm_s32 buf_size, fm_u16 scandir, fm_u16 space, fm_u16 max_freq,
fm_u16 min_freq);
fm_s32 mt6620_scan_2(fm_u8 *buf, fm_s32 buf_size, fm_u16 scandir, fm_u16 space, fm_u16 max_freq,
fm_u16 min_freq);
fm_s32 mt6620_get_reg(fm_u8 *buf, fm_s32 buf_size, fm_u8 addr);
fm_s32 mt6620_set_reg(fm_u8 *buf, fm_s32 buf_size, fm_u8 addr, fm_u16 value);
fm_s32 mt6620_rampdown_tx(unsigned char *tx_buf, int tx_buf_size);
fm_s32 mt6620_tune_txscan(unsigned char *tx_buf, int tx_buf_size, uint16_t freq);
fm_s32 mt6620_tune_tx(unsigned char *tx_buf, int tx_buf_size, uint16_t freq);
fm_s32 mt6620_rds_rx_enable(unsigned char *tx_buf, int tx_buf_size);
fm_s32 mt6620_rds_rx_disable(unsigned char *tx_buf, int tx_buf_size);
fm_s32 mt6620_rds_tx(unsigned char *tx_buf, int tx_buf_size, uint16_t pi, uint16_t *ps,
uint16_t *other_rds, uint8_t other_rds_cnt);
fm_s32 mt6620_off_2_tx_shortANA(fm_u8 *tx_buf, fm_s32 tx_buf_size);
fm_s32 mt6620_dig_init(fm_u8 *tx_buf, fm_s32 tx_buf_size);
extern fm_s32 fm_get_channel_space(int freq);
#endif
|
struct B {
virtual int foo();
};
int B::foo()
{
return 2;
}
|
/*
* Task I/O accounting operations
*/
#ifndef __TASK_IO_ACCOUNTING_OPS_INCLUDED
#define __TASK_IO_ACCOUNTING_OPS_INCLUDED
#include <linux/sched.h>
#ifdef CONFIG_TASK_IO_ACCOUNTING
static inline void task_io_account_read(size_t bytes)
{
current->ioac.read_bytes += bytes;
}
/*
* We approximate number of blocks, because we account bytes only.
* A 'block' is 512 bytes
*/
static inline unsigned long task_io_get_inblock(const struct task_struct *p)
{
return p->ioac.read_bytes >> 9;
}
static inline void task_io_account_write(size_t bytes)
{
current->ioac.write_bytes += bytes;
}
/*
* We approximate number of blocks, because we account bytes only.
* A 'block' is 512 bytes
*/
static inline unsigned long task_io_get_oublock(const struct task_struct *p)
{
return p->ioac.write_bytes >> 9;
}
static inline void task_io_account_cancelled_write(size_t bytes)
{
current->ioac.cancelled_write_bytes += bytes;
}
static inline void task_io_accounting_init(struct task_io_accounting *ioac)
{
memset(ioac, 0, sizeof(*ioac));
}
static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
struct task_io_accounting *src)
{
dst->read_bytes += src->read_bytes;
dst->write_bytes += src->write_bytes;
dst->cancelled_write_bytes += src->cancelled_write_bytes;
}
#else
static inline void task_io_account_read(size_t bytes)
{
}
static inline unsigned long task_io_get_inblock(const struct task_struct *p)
{
return 0;
}
static inline void task_io_account_write(size_t bytes)
{
}
static inline unsigned long task_io_get_oublock(const struct task_struct *p)
{
return 0;
}
static inline void task_io_account_cancelled_write(size_t bytes)
{
}
static inline void task_io_accounting_init(struct task_io_accounting *ioac)
{
}
static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
struct task_io_accounting *src)
{
}
#endif /* CONFIG_TASK_IO_ACCOUNTING */
#ifdef CONFIG_TASK_XACCT
static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
struct task_io_accounting *src)
{
dst->rchar += src->rchar;
dst->wchar += src->wchar;
dst->syscr += src->syscr;
dst->syscw += src->syscw;
}
#else
static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
struct task_io_accounting *src)
{
}
#endif /* CONFIG_TASK_XACCT */
static inline void task_io_accounting_add(struct task_io_accounting *dst,
struct task_io_accounting *src)
{
task_chr_io_accounting_add(dst, src);
task_blk_io_accounting_add(dst, src);
}
#endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */
|
/* IP tables module for matching the value of the IPv4/IPv6 DSCP field
*
* (C) 2002 by Harald Welte <laforge@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.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <net/dsfield.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter/xt_dscp.h>
MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
MODULE_DESCRIPTION("Xtables: DSCP/TOS field match");
MODULE_LICENSE("GPL");
MODULE_ALIAS("ipt_dscp");
MODULE_ALIAS("ip6t_dscp");
MODULE_ALIAS("ipt_tos");
MODULE_ALIAS("ip6t_tos");
static bool
dscp_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_dscp_info *info = par->matchinfo;
u_int8_t dscp = ipv4_get_dsfield(ip_hdr(skb)) >> XT_DSCP_SHIFT;
return (dscp == info->dscp) ^ !!info->invert;
}
static bool
dscp_mt6(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_dscp_info *info = par->matchinfo;
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
return (dscp == info->dscp) ^ !!info->invert;
}
static int dscp_mt_check(const struct xt_mtchk_param *par)
{
const struct xt_dscp_info *info = par->matchinfo;
if (info->dscp > XT_DSCP_MAX) {
pr_info("dscp %x out of range\n", info->dscp);
return -EDOM;
}
return 0;
}
static bool tos_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_tos_match_info *info = par->matchinfo;
if (par->family == NFPROTO_IPV4)
return ((ip_hdr(skb)->tos & info->tos_mask) ==
info->tos_value) ^ !!info->invert;
else
return ((ipv6_get_dsfield(ipv6_hdr(skb)) & info->tos_mask) ==
info->tos_value) ^ !!info->invert;
}
static struct xt_match dscp_mt_reg[] __read_mostly = {
{
.name = "dscp",
.family = NFPROTO_IPV4,
.checkentry = dscp_mt_check,
.match = dscp_mt,
.matchsize = sizeof(struct xt_dscp_info),
.me = THIS_MODULE,
},
{
.name = "dscp",
.family = NFPROTO_IPV6,
.checkentry = dscp_mt_check,
.match = dscp_mt6,
.matchsize = sizeof(struct xt_dscp_info),
.me = THIS_MODULE,
},
{
.name = "tos",
.revision = 1,
.family = NFPROTO_IPV4,
.match = tos_mt,
.matchsize = sizeof(struct xt_tos_match_info),
.me = THIS_MODULE,
},
{
.name = "tos",
.revision = 1,
.family = NFPROTO_IPV6,
.match = tos_mt,
.matchsize = sizeof(struct xt_tos_match_info),
.me = THIS_MODULE,
},
};
static int __init dscp_mt_init(void)
{
return xt_register_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
}
static void __exit dscp_mt_exit(void)
{
xt_unregister_matches(dscp_mt_reg, ARRAY_SIZE(dscp_mt_reg));
}
module_init(dscp_mt_init);
module_exit(dscp_mt_exit);
|
/*
* Driver for OMAP-UART controller.
* Based on drivers/serial/8250.c
*
* Copyright (C) 2010 Texas Instruments.
*
* Authors:
* Govindraj R <govindraj.raja@ti.com>
* Thara Gopinath <thara@ti.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __OMAP_SERIAL_H__
#define __OMAP_SERIAL_H__
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <plat/mux.h>
#define DRIVER_NAME "omap_uart"
/*
* Use tty device name as ttyO, [O -> OMAP]
* in bootargs we specify as console=ttyO0 if uart1
* is used as console uart.
*/
#define OMAP_SERIAL_NAME "ttyO"
#define OMAP_MODE13X_SPEED 230400
/* WER = 0x7F
* Enable module level wakeup in WER reg
*/
#define OMAP2_UART_WER_MOD_WKUP 0X7F
#define OMAP4_UART_WER_MOD_WKUP 0XFF
/* Enable XON/XOFF flow control on output */
#define OMAP_UART_SW_TX 0x8
/* Enable XON/XOFF flow control on input */
#define OMAP_UART_SW_RX 0x2
#define OMAP_UART_SYSC_RESET 0X07
#define OMAP_UART_TCR_TRIG 0X0F
#define OMAP_UART_SW_CLR 0XF0
#define OMAP_UART_FIFO_CLR 0X06
#define OMAP_UART_DMA_CH_FREE -1
#define RX_TIMEOUT (3 * HZ) /* RX DMA timeout (jiffies) */
#define DEFAULT_RXDMA_TIMEOUT (3 * HZ) /* RX DMA timeout (jiffies) */
#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */
#define DEFAULT_RXDMA_BUFSIZE 4096 /* RX DMA buffer size */
#define DEFAULT_AUTOSUSPEND_DELAY 3000 /* Runtime autosuspend (msecs)*/
/*
* (Errata i659) - From OMAP4430 ES 2.0 onwards set
* tx_threshold while using UART in DMA Mode
* and ensure tx_threshold + tx_trigger <= 63
*/
#define UART_MDR3 0x20
#define UART_TX_DMA_THRESHOLD 0x21
#define SET_DMA_TX_THRESHOLD BIT(2)
/* Setting TX Threshold Level to 62 */
#define TX_FIFO_THR_LVL 0x3E
#define OMAP_MAX_HSUART_PORTS 4
#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
#define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
#define OMAP4_UART_ERRATA_i659_TX_THR BIT(1)
struct omap_uart_port_info {
int dma_rx_buf_size;/* DMA Rx Buffer Size */
int dma_rx_timeout; /* DMA RX timeout */
unsigned int idle_timeout; /* Omap Uart Idle Time out */
int use_dma; /* DMA Enable / Disable */
unsigned int uartclk; /* UART clock rate */
upf_t flags; /* UPF_* flags */
unsigned int errata;
unsigned int console_uart;
u16 wer; /* Module Wakeup register */
unsigned int dma_rx_poll_rate; /* DMA RX poll_rate */
unsigned int auto_sus_timeout; /* Auto_suspend timeout */
unsigned rts_mux_driver_control:1;
void (*enable_wakeup)(struct platform_device *, bool);
bool (*chk_wakeup)(struct platform_device *);
void (*wake_peer)(struct uart_port *);
void __iomem *wk_st;
void __iomem *wk_en;
u32 wk_mask;
};
struct uart_omap_dma {
u8 uart_dma_tx;
u8 uart_dma_rx;
int rx_dma_channel;
int tx_dma_channel;
dma_addr_t rx_buf_dma_phys;
dma_addr_t tx_buf_dma_phys;
unsigned int uart_base;
/*
* Buffer for rx dma.It is not required for tx because the buffer
* comes from port structure.
*/
unsigned char *rx_buf;
unsigned int prev_rx_dma_pos;
int tx_buf_size;
int tx_dma_used;
int rx_dma_used;
spinlock_t tx_lock;
spinlock_t rx_lock;
/* timer to poll activity on rx dma */
struct timer_list rx_timer;
unsigned int rx_buf_size;
unsigned int rx_poll_rate;
unsigned int rx_timeout;
};
struct uart_omap_port {
struct uart_port port;
struct uart_omap_dma uart_dma;
struct platform_device *pdev;
unsigned char ier;
unsigned char lcr;
unsigned char mcr;
unsigned char fcr;
unsigned char efr;
unsigned char dll;
unsigned char dlh;
unsigned char mdr1;
unsigned char wer;
int use_dma;
bool suspended;
/*
* Some bits in registers are cleared on a read, so they must
* be saved whenever the register is read but the bits will not
* be immediately processed.
*/
unsigned int lsr_break_flag;
unsigned char msr_saved_flags;
char name[20];
unsigned int console_lock;
unsigned long port_activity;
int context_loss_cnt;
/* RTS control via driver */
unsigned rts_mux_driver_control:1;
unsigned rts_pullup_in_suspend:1;
unsigned int errata;
void (*enable_wakeup)(struct platform_device *, bool);
bool (*chk_wakeup)(struct platform_device *);
void (*wake_peer)(struct uart_port *);
};
#endif /* __OMAP_SERIAL_H__ */
|
/**
* @file cc.h
* @author Ambroz Bizjak <ambrop7@gmail.com>
*
* @section LICENSE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LWIP_CUSTOM_CC_H
#define LWIP_CUSTOM_CC_H
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#include <misc/debug.h>
#include <misc/byteorder.h>
#include <misc/packed.h>
#include <misc/print_macros.h>
#include <misc/byteorder.h>
#include <base/BLog.h>
#define u8_t uint8_t
#define s8_t int8_t
#define u16_t uint16_t
#define s16_t int16_t
#define u32_t uint32_t
#define s32_t int32_t
#define mem_ptr_t uintptr_t
#define PACK_STRUCT_BEGIN B_START_PACKED
#define PACK_STRUCT_END B_END_PACKED
#define PACK_STRUCT_STRUCT B_PACKED
#define LWIP_PLATFORM_DIAG(x) { if (BLog_WouldLog(BLOG_CHANNEL_lwip, BLOG_INFO)) { BLog_Begin(); BLog_Append x; BLog_Finish(BLOG_CHANNEL_lwip, BLOG_INFO); } }
#define LWIP_PLATFORM_ASSERT(x) { fprintf(stderr, "%s: lwip assertion failure: %s\n", __FUNCTION__, (x)); abort(); }
#define U16_F PRIu16
#define S16_F PRId16
#define X16_F PRIx16
#define U32_F PRIu32
#define S32_F PRId32
#define X32_F PRIx32
#define SZT_F "zu"
#define LWIP_PLATFORM_BYTESWAP 1
#define LWIP_PLATFORM_HTONS(x) hton16(x)
#define LWIP_PLATFORM_HTONL(x) hton32(x)
#define LWIP_RAND() ( \
(((uint32_t)(rand() & 0xFF)) << 24) | \
(((uint32_t)(rand() & 0xFF)) << 16) | \
(((uint32_t)(rand() & 0xFF)) << 8) | \
(((uint32_t)(rand() & 0xFF)) << 0) \
)
// for BYTE_ORDER
#if defined(BADVPN_USE_WINAPI) && !defined(_MSC_VER)
#include <sys/param.h>
#elif defined(BADVPN_LINUX)
#include <endian.h>
#elif defined(BADVPN_FREEBSD)
#include <machine/endian.h>
#else
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#if defined(BADVPN_LITTLE_ENDIAN)
#define BYTE_ORDER LITTLE_ENDIAN
#else
#define BYTE_ORDER BIG_ENDIAN
#endif
#endif
#endif
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* include/asm-xtensa/signal.h
*
* Swiped from SH.
*
* 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) 2001 - 2005 Tensilica Inc.
*/
#ifndef _UAPI_XTENSA_SIGNAL_H
#define _UAPI_XTENSA_SIGNAL_H
#define _NSIG 64
#define _NSIG_BPW 32
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
#ifndef __ASSEMBLY__
#include <linux/types.h>
/* Avoid too many header ordering problems. */
struct siginfo;
typedef unsigned long old_sigset_t; /* at least 32 bits */
typedef struct {
unsigned long sig[_NSIG_WORDS];
} sigset_t;
#endif
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL SIGIO
/* #define SIGLOST 29 */
#define SIGPWR 30
#define SIGSYS 31
#define SIGUNUSED 31
/* These should not be considered constants from userland. */
#define SIGRTMIN 32
#define SIGRTMAX (_NSIG-1)
#define SA_RESTORER 0x04000000
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#ifndef __ASSEMBLY__
#include <asm-generic/signal-defs.h>
#ifndef __KERNEL__
/* Here we must cater to libcs that poke about in kernel headers. */
struct sigaction {
union {
__sighandler_t _sa_handler;
void (*_sa_sigaction)(int, struct siginfo *, void *);
} _u;
sigset_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
#endif /* __KERNEL__ */
typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
size_t ss_size;
} stack_t;
#endif /* __ASSEMBLY__ */
#endif /* _UAPI_XTENSA_SIGNAL_H */
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2011, 2012 Cavium, Inc.
*/
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/of_mdio.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/phy.h>
#include <linux/mdio-mux.h>
#include <linux/of_gpio.h>
#define DRV_VERSION "1.0"
#define DRV_DESCRIPTION "GPIO controlled MDIO bus multiplexer driver"
#define MDIO_MUX_GPIO_MAX_BITS 8
struct mdio_mux_gpio_state {
int gpio[MDIO_MUX_GPIO_MAX_BITS];
unsigned int num_gpios;
void *mux_handle;
};
static int mdio_mux_gpio_switch_fn(int current_child, int desired_child,
void *data)
{
int change;
unsigned int n;
struct mdio_mux_gpio_state *s = data;
if (current_child == desired_child)
return 0;
change = current_child == -1 ? -1 : current_child ^ desired_child;
for (n = 0; n < s->num_gpios; n++) {
if (change & 1)
gpio_set_value_cansleep(s->gpio[n],
(desired_child & 1) != 0);
change >>= 1;
desired_child >>= 1;
}
return 0;
}
static int __devinit mdio_mux_gpio_probe(struct platform_device *pdev)
{
enum of_gpio_flags f;
struct mdio_mux_gpio_state *s;
unsigned int num_gpios;
unsigned int n;
int r;
if (!pdev->dev.of_node)
return -ENODEV;
num_gpios = of_gpio_count(pdev->dev.of_node);
if (num_gpios == 0 || num_gpios > MDIO_MUX_GPIO_MAX_BITS)
return -ENODEV;
s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL);
if (!s)
return -ENOMEM;
s->num_gpios = num_gpios;
for (n = 0; n < num_gpios; ) {
int gpio = of_get_gpio_flags(pdev->dev.of_node, n, &f);
if (gpio < 0) {
r = (gpio == -ENODEV) ? -EPROBE_DEFER : gpio;
goto err;
}
s->gpio[n] = gpio;
n++;
r = gpio_request(gpio, "mdio_mux_gpio");
if (r)
goto err;
r = gpio_direction_output(gpio, 0);
if (r)
goto err;
}
r = mdio_mux_init(&pdev->dev,
mdio_mux_gpio_switch_fn, &s->mux_handle, s);
if (r == 0) {
pdev->dev.platform_data = s;
return 0;
}
err:
while (n) {
n--;
gpio_free(s->gpio[n]);
}
return r;
}
static int __devexit mdio_mux_gpio_remove(struct platform_device *pdev)
{
struct mdio_mux_gpio_state *s = pdev->dev.platform_data;
mdio_mux_uninit(s->mux_handle);
return 0;
}
static struct of_device_id mdio_mux_gpio_match[] = {
{
.compatible = "mdio-mux-gpio",
},
{
/* Legacy compatible property. */
.compatible = "cavium,mdio-mux-sn74cbtlv3253",
},
{},
};
MODULE_DEVICE_TABLE(of, mdio_mux_gpio_match);
static struct platform_driver mdio_mux_gpio_driver = {
.driver = {
.name = "mdio-mux-gpio",
.owner = THIS_MODULE,
.of_match_table = mdio_mux_gpio_match,
},
.probe = mdio_mux_gpio_probe,
.remove = __devexit_p(mdio_mux_gpio_remove),
};
module_platform_driver(mdio_mux_gpio_driver);
MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_VERSION(DRV_VERSION);
MODULE_AUTHOR("David Daney");
MODULE_LICENSE("GPL");
|
#ifndef __PERF_THREAD_H
#define __PERF_THREAD_H
#include <linux/atomic.h>
#include <linux/rbtree.h>
#include <linux/list.h>
#include <unistd.h>
#include <sys/types.h>
#include "symbol.h"
#include <strlist.h>
#include <intlist.h>
struct thread_stack;
struct thread {
union {
struct rb_node rb_node;
struct list_head node;
};
struct map_groups *mg;
pid_t pid_; /* Not all tools update this */
pid_t tid;
pid_t ppid;
int cpu;
atomic_t refcnt;
char shortname[3];
bool comm_set;
int comm_len;
bool dead; /* if set thread has exited */
struct list_head comm_list;
u64 db_id;
void *priv;
struct thread_stack *ts;
};
struct machine;
struct comm;
struct thread *thread__new(pid_t pid, pid_t tid);
int thread__init_map_groups(struct thread *thread, struct machine *machine);
void thread__delete(struct thread *thread);
struct thread *thread__get(struct thread *thread);
void thread__put(struct thread *thread);
static inline void __thread__zput(struct thread **thread)
{
thread__put(*thread);
*thread = NULL;
}
#define thread__zput(thread) __thread__zput(&thread)
static inline void thread__exited(struct thread *thread)
{
thread->dead = true;
}
int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp,
bool exec);
static inline int thread__set_comm(struct thread *thread, const char *comm,
u64 timestamp)
{
return __thread__set_comm(thread, comm, timestamp, false);
}
int thread__comm_len(struct thread *thread);
struct comm *thread__comm(const struct thread *thread);
struct comm *thread__exec_comm(const struct thread *thread);
const char *thread__comm_str(const struct thread *thread);
void thread__insert_map(struct thread *thread, struct map *map);
int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp);
size_t thread__fprintf(struct thread *thread, FILE *fp);
void thread__find_addr_map(struct thread *thread,
u8 cpumode, enum map_type type, u64 addr,
struct addr_location *al);
void thread__find_addr_location(struct thread *thread,
u8 cpumode, enum map_type type, u64 addr,
struct addr_location *al);
void thread__find_cpumode_addr_location(struct thread *thread,
enum map_type type, u64 addr,
struct addr_location *al);
static inline void *thread__priv(struct thread *thread)
{
return thread->priv;
}
static inline void thread__set_priv(struct thread *thread, void *p)
{
thread->priv = p;
}
static inline bool thread__is_filtered(struct thread *thread)
{
if (symbol_conf.comm_list &&
!strlist__has_entry(symbol_conf.comm_list, thread__comm_str(thread))) {
return true;
}
if (symbol_conf.pid_list &&
!intlist__has_entry(symbol_conf.pid_list, thread->pid_)) {
return true;
}
if (symbol_conf.tid_list &&
!intlist__has_entry(symbol_conf.tid_list, thread->tid)) {
return true;
}
return false;
}
#endif /* __PERF_THREAD_H */
|
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/memory.h>
#include <asm/hardware/gic.h>
#include <asm/mach/map.h>
#include <asm/mach/arch.h>
#include <mach/board.h>
#include <mach/gpiomux.h>
#include <mach/msm_iomap.h>
#include <mach/msm_memtypes.h>
#include <mach/msm_smd.h>
#include <mach/rpm-smd.h>
#include <mach/restart.h>
#include <mach/socinfo.h>
#include <mach/clk-provider.h>
#include <mach/msm_smem.h>
#include "board-dt.h"
#include "clock.h"
#include "devices.h"
#include "modem_notifier.h"
static struct of_dev_auxdata msmkrypton_auxdata_lookup[] __initdata = {
{}
};
/*
* Used to satisfy dependencies for devices that need to be
* run early or in a particular order. Most likely your device doesn't fall
* into this category, and thus the driver should not be added here. The
* EPROBE_DEFER can satisfy most dependency problems.
*/
void __init msmkrypton_add_drivers(void)
{
msm_smem_init();
msm_init_modem_notifier_list();
msm_smd_init();
msm_rpm_driver_init();
msm_clock_init(&msmkrypton_clock_init_data);
}
void __init msmkrypton_reserve(void)
{
of_scan_flat_dt(dt_scan_for_memory_reserve, NULL);
}
static void __init msmkrypton_early_memory(void)
{
of_scan_flat_dt(dt_scan_for_memory_hole, NULL);
}
static void __init msmkrypton_map_io(void)
{
msm_map_msmkrypton_io();
}
void __init msmkrypton_init(void)
{
if (socinfo_init() < 0)
pr_err("%s: socinfo_init() failed\n", __func__);
msmkrypton_init_gpiomux();
board_dt_populate(msmkrypton_auxdata_lookup);
msmkrypton_add_drivers();
}
static const char *msmkrypton_dt_match[] __initconst = {
"qcom,msmkrypton",
NULL
};
DT_MACHINE_START(MSMKRYPTON_DT, "Qualcomm MSM Krypton (Flattened Device Tree)")
.map_io = msmkrypton_map_io,
.init_irq = msm_dt_init_irq,
.init_machine = msmkrypton_init,
.handle_irq = gic_handle_irq,
.timer = &msm_dt_timer,
.dt_compat = msmkrypton_dt_match,
.init_very_early = msmkrypton_early_memory,
.restart = msm_restart,
MACHINE_END
|
/*
* Copyright (C) 2008 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 ApplicationCacheResource_h
#define ApplicationCacheResource_h
#include "SubstituteResource.h"
namespace WebCore {
class ApplicationCacheResource : public SubstituteResource {
public:
enum Type {
Master = 1 << 0,
Manifest = 1 << 1,
Explicit = 1 << 2,
Foreign = 1 << 3,
Fallback = 1 << 4
};
static PassRefPtr<ApplicationCacheResource> create(const KURL& url, const ResourceResponse& response, unsigned type, PassRefPtr<SharedBuffer> buffer = SharedBuffer::create(), const String& path = String())
{
ASSERT(!url.hasFragmentIdentifier());
return adoptRef(new ApplicationCacheResource(url, response, type, buffer, path));
}
unsigned type() const { return m_type; }
void addType(unsigned type);
void setStorageID(unsigned storageID) { m_storageID = storageID; }
unsigned storageID() const { return m_storageID; }
void clearStorageID() { m_storageID = 0; }
int64_t estimatedSizeInStorage();
const String& path() const { return m_path; }
void setPath(const String& path) { m_path = path; }
#ifndef NDEBUG
static void dumpType(unsigned type);
#endif
private:
ApplicationCacheResource(const KURL&, const ResourceResponse&, unsigned type, PassRefPtr<SharedBuffer>, const String& path);
unsigned m_type;
unsigned m_storageID;
int64_t m_estimatedSizeInStorage;
String m_path;
};
} // namespace WebCore
#endif // ApplicationCacheResource_h
|
/*
* KQEMU header
*
* Copyright (c) 2004-2008 Fabrice Bellard
*
* 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 KQEMU_H
#define KQEMU_H
#if defined(__i386__)
#define KQEMU_PAD32(x) x
#else
#define KQEMU_PAD32(x)
#endif
#define KQEMU_VERSION 0x010400
struct kqemu_segment_cache {
uint16_t selector;
uint16_t padding1;
uint32_t flags;
uint64_t base;
uint32_t limit;
uint32_t padding2;
};
struct kqemu_cpu_state {
uint64_t regs[16];
uint64_t eip;
uint64_t eflags;
struct kqemu_segment_cache segs[6]; /* selector values */
struct kqemu_segment_cache ldt;
struct kqemu_segment_cache tr;
struct kqemu_segment_cache gdt; /* only base and limit are used */
struct kqemu_segment_cache idt; /* only base and limit are used */
uint64_t cr0;
uint64_t cr2;
uint64_t cr3;
uint64_t cr4;
uint64_t a20_mask;
/* sysenter registers */
uint64_t sysenter_cs;
uint64_t sysenter_esp;
uint64_t sysenter_eip;
uint64_t efer;
uint64_t star;
uint64_t lstar;
uint64_t cstar;
uint64_t fmask;
uint64_t kernelgsbase;
uint64_t tsc_offset;
uint64_t dr0;
uint64_t dr1;
uint64_t dr2;
uint64_t dr3;
uint64_t dr6;
uint64_t dr7;
uint8_t cpl;
uint8_t user_only;
uint16_t padding1;
uint32_t error_code; /* error_code when exiting with an exception */
uint64_t next_eip; /* next eip value when exiting with an interrupt */
uint32_t nb_pages_to_flush; /* number of pages to flush,
KQEMU_FLUSH_ALL means full flush */
#define KQEMU_MAX_PAGES_TO_FLUSH 512
#define KQEMU_FLUSH_ALL (KQEMU_MAX_PAGES_TO_FLUSH + 1)
int32_t retval;
/* number of ram_dirty entries to update */
uint32_t nb_ram_pages_to_update;
#define KQEMU_MAX_RAM_PAGES_TO_UPDATE 512
#define KQEMU_RAM_PAGES_UPDATE_ALL (KQEMU_MAX_RAM_PAGES_TO_UPDATE + 1)
#define KQEMU_MAX_MODIFIED_RAM_PAGES 512
uint32_t nb_modified_ram_pages;
};
struct kqemu_init {
uint8_t *ram_base; /* must be page aligned */
KQEMU_PAD32(uint32_t padding1;)
uint64_t ram_size; /* must be multiple of 4 KB */
uint8_t *ram_dirty; /* must be page aligned */
KQEMU_PAD32(uint32_t padding2;)
uint64_t *pages_to_flush; /* must be page aligned */
KQEMU_PAD32(uint32_t padding4;)
uint64_t *ram_pages_to_update; /* must be page aligned */
KQEMU_PAD32(uint32_t padding5;)
uint64_t *modified_ram_pages; /* must be page aligned */
KQEMU_PAD32(uint32_t padding6;)
};
#define KQEMU_IO_MEM_RAM 0
#define KQEMU_IO_MEM_ROM 1
#define KQEMU_IO_MEM_COMM 2 /* kqemu communication page */
#define KQEMU_IO_MEM_UNASSIGNED 3 /* any device: return to application */
struct kqemu_phys_mem {
uint64_t phys_addr; /* physical address range: phys_addr,
phys_addr + size */
uint64_t size;
uint64_t ram_addr; /* corresponding ram address */
uint32_t io_index; /* memory type: see KQEMU_IO_MEM_xxx */
uint32_t padding1;
};
#define KQEMU_RET_ABORT (-1)
#define KQEMU_RET_EXCEPTION 0x0000 /* 8 low order bit are the exception */
#define KQEMU_RET_INT 0x0100 /* 8 low order bit are the interrupt */
#define KQEMU_RET_SOFTMMU 0x0200 /* emulation needed (I/O or
unsupported INSN) */
#define KQEMU_RET_INTR 0x0201 /* interrupted by a signal */
#define KQEMU_RET_SYSCALL 0x0300 /* syscall insn */
#ifdef _WIN32
#define KQEMU_EXEC CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define KQEMU_INIT CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define KQEMU_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_READ_ACCESS)
#define KQEMU_MODIFY_RAM_PAGES CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define KQEMU_SET_PHYS_MEM CTL_CODE(FILE_DEVICE_UNKNOWN, 5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#else
#define KQEMU_EXEC _IOWR('q', 1, struct kqemu_cpu_state)
#define KQEMU_INIT _IOW('q', 2, struct kqemu_init)
#define KQEMU_GET_VERSION _IOR('q', 3, int)
#define KQEMU_MODIFY_RAM_PAGES _IOW('q', 4, int)
#define KQEMU_SET_PHYS_MEM _IOW('q', 5, struct kqemu_phys_mem)
#endif
#endif /* KQEMU_H */
|
/*
* Copyright (c) 2004-2014 Erik Doernenburg and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use these files except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#import <OCMock/OCMock.h>
@interface OCMExpectationRecorder : OCMStubRecorder
- (id)never;
@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) 2006 Ralf Baechle <ralf@linux-mips.org>
*
*/
#ifndef __ASM_MACH_IP32_DMA_COHERENCE_H
#define __ASM_MACH_IP32_DMA_COHERENCE_H
#include <asm/ip32/crime.h>
struct device;
/*
* Few notes.
* 1. CPU sees memory as two chunks: 0-256M@0x0, and the rest @0x40000000+256M
* 2. PCI sees memory as one big chunk @0x0 (or we could use 0x40000000 for
* native-endian)
* 3. All other devices see memory as one big chunk at 0x40000000
* 4. Non-PCI devices will pass NULL as struct device*
*
* Thus we translate differently, depending on device.
*/
#define RAM_OFFSET_MASK 0x3fffffffUL
static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
size_t size)
{
dma_addr_t pa = virt_to_phys(addr) & RAM_OFFSET_MASK;
if (dev == NULL)
pa += CRIME_HI_MEM_BASE;
return pa;
}
static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
{
dma_addr_t pa;
pa = page_to_phys(page) & RAM_OFFSET_MASK;
if (dev == NULL)
pa += CRIME_HI_MEM_BASE;
return pa;
}
/* This is almost certainly wrong but it's what dma-ip32.c used to use */
static unsigned long plat_dma_addr_to_phys(dma_addr_t dma_addr)
{
unsigned long addr = dma_addr & RAM_OFFSET_MASK;
if (dma_addr >= 256*1024*1024)
addr += CRIME_HI_MEM_BASE;
return addr;
}
static inline void plat_unmap_dma_mem(dma_addr_t dma_addr)
{
}
static inline int plat_device_is_coherent(struct device *dev)
{
return 0; /* IP32 is non-cohernet */
}
#endif /* __ASM_MACH_IP32_DMA_COHERENCE_H */
|
//
// GTMCALayer+UnitTesting.h
//
// Code for making unit testing of graphics/UI easier. Generally you
// will only want to look at the macros:
// GTMAssertDrawingEqualToFile
// GTMAssertViewRepEqualToFile
// and the protocol GTMUnitTestCALayerDrawer. When using these routines
// make sure you are using device colors and not calibrated/generic colors
// or else your test graphics WILL NOT match across devices/graphics cards.
//
// Copyright 2006-2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
//
#import <QuartzCore/QuartzCore.h>
#import "GTMNSObject+UnitTesting.h"
// Category for making unit testing of graphics/UI easier.
// Allows you to take a state of a view. Supports both image and state.
// See GTMNSObject+UnitTesting.h for details.
@interface CALayer (GTMUnitTestingAdditions) <GTMUnitTestingImaging>
// Returns whether gtm_unitTestEncodeState should recurse into sublayers
//
// Returns:
// should gtm_unitTestEncodeState pick up sublayer state.
- (BOOL)gtm_shouldEncodeStateForSublayers;
@end
@interface NSObject (GTMCALayerUnitTestingDelegateMethods)
// Delegate method that allows a delegate for a layer to
// decide whether we should recurse
- (BOOL)gtm_shouldEncodeStateForSublayersOfLayer:(CALayer*)layer;
@end
|
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2009, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
*
* File NUCNVTST.H
*
* Modification History:
* Name Description
* Madhu Katragadda creation
*********************************************************************************
*/
#ifndef _NUCNVTST
#define _NUCNVTST
/* C API TEST FOR CODESET CONVERSION COMPONENT */
#include "cintltst.h"
#include "unicode/utypes.h"
void addTestNewConvert(TestNode** root);
#endif
|
/*
* Definitions used by low-level trap handlers
*
* Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
* Copyright (C) 2007-2009 PetaLogix
* Copyright (C) 2007 John Williams <john.williams@petalogix.com>
*
* 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.
*/
#ifndef _ASM_MICROBLAZE_ENTRY_H
#define _ASM_MICROBLAZE_ENTRY_H
#include <asm/percpu.h>
#include <asm/ptrace.h>
/*
* These are per-cpu variables required in entry.S, among other
* places
*/
#define PER_CPU(var) var
# ifndef __ASSEMBLY__
DECLARE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
DECLARE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
DECLARE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
DECLARE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
DECLARE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
extern asmlinkage void do_notify_resume(struct pt_regs *regs, int in_syscall);
# endif /* __ASSEMBLY__ */
#endif /* _ASM_MICROBLAZE_ENTRY_H */
|
// SPDX-License-Identifier: GPL-2.0
/*
* u_gether.h
*
* Utility definitions for the subset function
*
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
*/
#ifndef U_GETHER_H
#define U_GETHER_H
#include <linux/usb/composite.h>
struct f_gether_opts {
struct usb_function_instance func_inst;
struct net_device *net;
bool bound;
/*
* Read/write access to configfs attributes is handled by configfs.
*
* This is to protect the data from concurrent access by read/write
* and create symlink/remove symlink.
*/
struct mutex lock;
int refcnt;
};
#endif /* U_GETHER_H */
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* This file contains the system call numbers.
*/
#ifndef _ASM_POWERPC_UNISTD_H_
#define _ASM_POWERPC_UNISTD_H_
#include <uapi/asm/unistd.h>
#define NR_syscalls __NR_syscalls
#define __NR__exit __NR_exit
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/compiler.h>
#include <linux/linkage.h>
#define __ARCH_WANT_NEW_STAT
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_STAT64
#define __ARCH_WANT_SYS_ALARM
#define __ARCH_WANT_SYS_GETHOSTNAME
#define __ARCH_WANT_SYS_IPC
#define __ARCH_WANT_SYS_PAUSE
#define __ARCH_WANT_SYS_SIGNAL
#define __ARCH_WANT_SYS_TIME32
#define __ARCH_WANT_SYS_UTIME32
#define __ARCH_WANT_SYS_WAITPID
#define __ARCH_WANT_SYS_SOCKETCALL
#define __ARCH_WANT_SYS_FADVISE64
#define __ARCH_WANT_SYS_GETPGRP
#define __ARCH_WANT_SYS_LLSEEK
#define __ARCH_WANT_SYS_NICE
#define __ARCH_WANT_SYS_OLD_GETRLIMIT
#define __ARCH_WANT_SYS_OLD_UNAME
#define __ARCH_WANT_SYS_OLDUMOUNT
#define __ARCH_WANT_SYS_SIGPENDING
#define __ARCH_WANT_SYS_SIGPROCMASK
#ifdef CONFIG_PPC32
#define __ARCH_WANT_OLD_STAT
#endif
#ifdef CONFIG_PPC64
#define __ARCH_WANT_SYS_TIME
#define __ARCH_WANT_SYS_UTIME
#define __ARCH_WANT_SYS_NEWFSTATAT
#define __ARCH_WANT_COMPAT_SYS_SENDFILE
#endif
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_VFORK
#define __ARCH_WANT_SYS_CLONE
#define __ARCH_WANT_SYS_CLONE3
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_UNISTD_H_ */
|
/*
* Marvell Armada 370 SoC clocks
*
* Copyright (C) 2012 Marvell
*
* Gregory CLEMENT <gregory.clement@free-electrons.com>
* Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
* Andrew Lunn <andrew@lunn.ch>
*
* 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/clk-provider.h>
#include <linux/io.h>
#include <linux/of.h>
#include "common.h"
/*
* Core Clocks
*/
#define SARL 0 /* Low part [0:31] */
#define SARL_A370_PCLK_FREQ_OPT 11
#define SARL_A370_PCLK_FREQ_OPT_MASK 0xF
#define SARL_A370_FAB_FREQ_OPT 15
#define SARL_A370_FAB_FREQ_OPT_MASK 0x1F
#define SARL_A370_TCLK_FREQ_OPT 20
#define SARL_A370_TCLK_FREQ_OPT_MASK 0x1
enum { A370_CPU_TO_NBCLK, A370_CPU_TO_HCLK, A370_CPU_TO_DRAMCLK };
static const struct coreclk_ratio a370_coreclk_ratios[] __initconst = {
{ .id = A370_CPU_TO_NBCLK, .name = "nbclk" },
{ .id = A370_CPU_TO_HCLK, .name = "hclk" },
{ .id = A370_CPU_TO_DRAMCLK, .name = "dramclk" },
};
static const u32 a370_tclk_freqs[] __initconst = {
166000000,
200000000,
};
static u32 __init a370_get_tclk_freq(void __iomem *sar)
{
u8 tclk_freq_select = 0;
tclk_freq_select = ((readl(sar) >> SARL_A370_TCLK_FREQ_OPT) &
SARL_A370_TCLK_FREQ_OPT_MASK);
return a370_tclk_freqs[tclk_freq_select];
}
static const u32 a370_cpu_freqs[] __initconst = {
400000000,
533000000,
667000000,
800000000,
1000000000,
1067000000,
1200000000,
};
static u32 __init a370_get_cpu_freq(void __iomem *sar)
{
u32 cpu_freq;
u8 cpu_freq_select = 0;
cpu_freq_select = ((readl(sar) >> SARL_A370_PCLK_FREQ_OPT) &
SARL_A370_PCLK_FREQ_OPT_MASK);
if (cpu_freq_select >= ARRAY_SIZE(a370_cpu_freqs)) {
pr_err("CPU freq select unsupported %d\n", cpu_freq_select);
cpu_freq = 0;
} else
cpu_freq = a370_cpu_freqs[cpu_freq_select];
return cpu_freq;
}
static const int a370_nbclk_ratios[32][2] __initconst = {
{0, 1}, {1, 2}, {2, 2}, {2, 2},
{1, 2}, {1, 2}, {1, 1}, {2, 3},
{0, 1}, {1, 2}, {2, 4}, {0, 1},
{1, 2}, {0, 1}, {0, 1}, {2, 2},
{0, 1}, {0, 1}, {0, 1}, {1, 1},
{2, 3}, {0, 1}, {0, 1}, {0, 1},
{0, 1}, {0, 1}, {0, 1}, {1, 1},
{0, 1}, {0, 1}, {0, 1}, {0, 1},
};
static const int a370_hclk_ratios[32][2] __initconst = {
{0, 1}, {1, 2}, {2, 6}, {2, 3},
{1, 3}, {1, 4}, {1, 2}, {2, 6},
{0, 1}, {1, 6}, {2, 10}, {0, 1},
{1, 4}, {0, 1}, {0, 1}, {2, 5},
{0, 1}, {0, 1}, {0, 1}, {1, 2},
{2, 6}, {0, 1}, {0, 1}, {0, 1},
{0, 1}, {0, 1}, {0, 1}, {1, 1},
{0, 1}, {0, 1}, {0, 1}, {0, 1},
};
static const int a370_dramclk_ratios[32][2] __initconst = {
{0, 1}, {1, 2}, {2, 3}, {2, 3},
{1, 3}, {1, 2}, {1, 2}, {2, 6},
{0, 1}, {1, 3}, {2, 5}, {0, 1},
{1, 4}, {0, 1}, {0, 1}, {2, 5},
{0, 1}, {0, 1}, {0, 1}, {1, 1},
{2, 3}, {0, 1}, {0, 1}, {0, 1},
{0, 1}, {0, 1}, {0, 1}, {1, 1},
{0, 1}, {0, 1}, {0, 1}, {0, 1},
};
static void __init a370_get_clk_ratio(
void __iomem *sar, int id, int *mult, int *div)
{
u32 opt = ((readl(sar) >> SARL_A370_FAB_FREQ_OPT) &
SARL_A370_FAB_FREQ_OPT_MASK);
switch (id) {
case A370_CPU_TO_NBCLK:
*mult = a370_nbclk_ratios[opt][0];
*div = a370_nbclk_ratios[opt][1];
break;
case A370_CPU_TO_HCLK:
*mult = a370_hclk_ratios[opt][0];
*div = a370_hclk_ratios[opt][1];
break;
case A370_CPU_TO_DRAMCLK:
*mult = a370_dramclk_ratios[opt][0];
*div = a370_dramclk_ratios[opt][1];
break;
}
}
static const struct coreclk_soc_desc a370_coreclks = {
.get_tclk_freq = a370_get_tclk_freq,
.get_cpu_freq = a370_get_cpu_freq,
.get_clk_ratio = a370_get_clk_ratio,
.ratios = a370_coreclk_ratios,
.num_ratios = ARRAY_SIZE(a370_coreclk_ratios),
};
/*
* Clock Gating Control
*/
static const struct clk_gating_soc_desc a370_gating_desc[] __initconst = {
{ "audio", NULL, 0, 0 },
{ "pex0_en", NULL, 1, 0 },
{ "pex1_en", NULL, 2, 0 },
{ "ge1", NULL, 3, 0 },
{ "ge0", NULL, 4, 0 },
{ "pex0", "pex0_en", 5, 0 },
{ "pex1", "pex1_en", 9, 0 },
{ "sata0", NULL, 15, 0 },
{ "sdio", NULL, 17, 0 },
{ "tdm", NULL, 25, 0 },
{ "ddr", NULL, 28, CLK_IGNORE_UNUSED },
{ "sata1", NULL, 30, 0 },
{ }
};
static void __init a370_clk_init(struct device_node *np)
{
struct device_node *cgnp =
of_find_compatible_node(NULL, NULL, "marvell,armada-370-gating-clock");
mvebu_coreclk_setup(np, &a370_coreclks);
if (cgnp)
mvebu_clk_gating_setup(cgnp, a370_gating_desc);
}
CLK_OF_DECLARE(a370_clk, "marvell,armada-370-core-clock", a370_clk_init);
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __javax_swing_JSeparator__
#define __javax_swing_JSeparator__
#pragma interface
#include <javax/swing/JComponent.h>
extern "Java"
{
namespace javax
{
namespace accessibility
{
class AccessibleContext;
}
namespace swing
{
class JSeparator;
namespace plaf
{
class SeparatorUI;
}
}
}
}
class javax::swing::JSeparator : public ::javax::swing::JComponent
{
public:
JSeparator();
JSeparator(jint);
virtual ::javax::swing::plaf::SeparatorUI * getUI();
virtual void setUI(::javax::swing::plaf::SeparatorUI *);
virtual void updateUI();
virtual ::java::lang::String * getUIClassID();
virtual jint getOrientation();
virtual void setOrientation(jint);
public: // actually protected
virtual ::java::lang::String * paramString();
public:
virtual ::javax::accessibility::AccessibleContext * getAccessibleContext();
private:
static const jlong serialVersionUID = 125301223445282357LL;
jint __attribute__((aligned(__alignof__( ::javax::swing::JComponent)))) orientation;
public:
static ::java::lang::Class class$;
};
#endif // __javax_swing_JSeparator__
|
/*
* Support for Intel Camera Imaging ISP subsystem.
* Copyright (c) 2015, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#ifndef __IA_CSS_BNR2_2_PARAM_H
#define __IA_CSS_BNR2_2_PARAM_H
#include "type_support.h"
/* BNR (Bayer Noise Reduction) ISP parameters */
struct sh_css_isp_bnr2_2_params {
int32_t d_var_gain_r;
int32_t d_var_gain_g;
int32_t d_var_gain_b;
int32_t d_var_gain_slope_r;
int32_t d_var_gain_slope_g;
int32_t d_var_gain_slope_b;
int32_t n_var_gain_r;
int32_t n_var_gain_g;
int32_t n_var_gain_b;
int32_t n_var_gain_slope_r;
int32_t n_var_gain_slope_g;
int32_t n_var_gain_slope_b;
int32_t dir_thres;
int32_t dir_thres_w;
int32_t var_offset_coef;
int32_t dir_gain;
int32_t detail_gain;
int32_t detail_gain_divisor;
int32_t detail_level_offset;
int32_t d_var_th_min;
int32_t d_var_th_max;
int32_t n_var_th_min;
int32_t n_var_th_max;
};
#endif /* __IA_CSS_BNR2_2_PARAM_H */
|
/* vi: set sw=4 ts=4: */
/*
* Mini watch implementation for busybox
*
* Copyright (C) 2001 by Michael Habermann <mhabermann@gmx.de>
* Copyrigjt (C) Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
/* BB_AUDIT SUSv3 N/A */
/* BB_AUDIT GNU defects -- only option -n is supported. */
//usage:#define watch_trivial_usage
//usage: "[-n SEC] [-t] PROG ARGS"
//usage:#define watch_full_usage "\n\n"
//usage: "Run PROG periodically\n"
//usage: "\n -n Loop period in seconds (default 2)"
//usage: "\n -t Don't print header"
//usage:
//usage:#define watch_example_usage
//usage: "$ watch date\n"
//usage: "Mon Dec 17 10:31:40 GMT 2000\n"
//usage: "Mon Dec 17 10:31:42 GMT 2000\n"
//usage: "Mon Dec 17 10:31:44 GMT 2000"
#include "libbb.h"
// procps 2.0.18:
// watch [-d] [-n seconds]
// [--differences[=cumulative]] [--interval=seconds] command
//
// procps-3.2.3:
// watch [-dt] [-n seconds]
// [--differences[=cumulative]] [--interval=seconds] [--no-title] command
//
// (procps 3.x and procps 2.x are forks, not newer/older versions of the same)
int watch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int watch_main(int argc UNUSED_PARAM, char **argv)
{
unsigned opt;
unsigned period = 2;
unsigned width, new_width;
char *header;
char *cmd;
#if 0 // maybe ENABLE_DESKTOP?
// procps3 compat - "echo TEST | watch cat" doesn't show TEST:
close(STDIN_FILENO);
xopen("/dev/null", O_RDONLY);
#endif
opt_complementary = "-1:n+"; // at least one param; -n NUM
// "+": stop at first non-option (procps 3.x only)
opt = getopt32(argv, "+dtn:", &period);
argv += optind;
// watch from both procps 2.x and 3.x does concatenation. Example:
// watch ls -l "a /tmp" "2>&1" - ls won't see "a /tmp" as one param
cmd = *argv;
while (*++argv)
cmd = xasprintf("%s %s", cmd, *argv); // leaks cmd
width = (unsigned)-1; // make sure first time new_width != width
header = NULL;
while (1) {
/* home; clear to the end of screen */
printf("\033[H""\033[J");
if (!(opt & 0x2)) { // no -t
const unsigned time_len = sizeof("1234-67-90 23:56:89");
// STDERR_FILENO is procps3 compat:
// "watch ls 2>/dev/null" does not detect tty size
get_terminal_width_height(STDERR_FILENO, &new_width, NULL);
if (new_width != width) {
width = new_width;
free(header);
header = xasprintf("Every %us: %-*s", period, (int)width, cmd);
}
if (time_len < width) {
strftime_YYYYMMDDHHMMSS(
header + width - time_len,
time_len,
/*time_t*:*/ NULL
);
}
// compat: empty line between header and cmd output
printf("%s\n\n", header);
}
fflush_all();
// TODO: 'real' watch pipes cmd's output to itself
// and does not allow it to overflow the screen
// (taking into account linewrap!)
system(cmd);
sleep(period);
}
return 0; // gcc thinks we can reach this :)
}
|
/*
* Copyright (C) 1999 ARM Limited
* Copyright (C) 2000 Deep Blue Solutions Ltd
* Copyright 2006-2007,2010 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright 2008 Juergen Beisert, kernel@pengutronix.de
* Copyright 2009 Ilya Yanok, Emcraft Systems Ltd, yanok@emcraft.com
* Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
*
* 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/io.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/stmp_device.h>
#define STMP_MODULE_CLKGATE (1 << 30)
#define STMP_MODULE_SFTRST (1 << 31)
/*
* Clear the bit and poll it cleared. This is usually called with
* a reset address and mask being either SFTRST(bit 31) or CLKGATE
* (bit 30).
*/
static int stmp_clear_poll_bit(void __iomem *addr, u32 mask)
{
int timeout = 0x400;
writel(mask, addr + STMP_OFFSET_REG_CLR);
udelay(1);
while ((readl(addr) & mask) && --timeout)
/* nothing */;
return !timeout;
}
int stmp_reset_block(void __iomem *reset_addr)
{
int ret;
int timeout = 0x400;
/* clear and poll SFTRST */
ret = stmp_clear_poll_bit(reset_addr, STMP_MODULE_SFTRST);
if (unlikely(ret))
goto error;
/* clear CLKGATE */
writel(STMP_MODULE_CLKGATE, reset_addr + STMP_OFFSET_REG_CLR);
/* set SFTRST to reset the block */
writel(STMP_MODULE_SFTRST, reset_addr + STMP_OFFSET_REG_SET);
udelay(1);
/* poll CLKGATE becoming set */
while ((!(readl(reset_addr) & STMP_MODULE_CLKGATE)) && --timeout)
/* nothing */;
if (unlikely(!timeout))
goto error;
/* clear and poll SFTRST */
ret = stmp_clear_poll_bit(reset_addr, STMP_MODULE_SFTRST);
if (unlikely(ret))
goto error;
/* clear and poll CLKGATE */
ret = stmp_clear_poll_bit(reset_addr, STMP_MODULE_CLKGATE);
if (unlikely(ret))
goto error;
return 0;
error:
pr_err("%s(%p): module reset timeout\n", __func__, reset_addr);
return -ETIMEDOUT;
}
EXPORT_SYMBOL(stmp_reset_block);
|
#ifndef _ADE7759_H
#define _ADE7759_H
#define ADE7759_WAVEFORM 0x01
#define ADE7759_AENERGY 0x02
#define ADE7759_RSTENERGY 0x03
#define ADE7759_STATUS 0x04
#define ADE7759_RSTSTATUS 0x05
#define ADE7759_MODE 0x06
#define ADE7759_CFDEN 0x07
#define ADE7759_CH1OS 0x08
#define ADE7759_CH2OS 0x09
#define ADE7759_GAIN 0x0A
#define ADE7759_APGAIN 0x0B
#define ADE7759_PHCAL 0x0C
#define ADE7759_APOS 0x0D
#define ADE7759_ZXTOUT 0x0E
#define ADE7759_SAGCYC 0x0F
#define ADE7759_IRQEN 0x10
#define ADE7759_SAGLVL 0x11
#define ADE7759_TEMP 0x12
#define ADE7759_LINECYC 0x13
#define ADE7759_LENERGY 0x14
#define ADE7759_CFNUM 0x15
#define ADE7759_CHKSUM 0x1E
#define ADE7759_DIEREV 0x1F
#define ADE7759_READ_REG(a) a
#define ADE7759_WRITE_REG(a) ((a) | 0x80)
#define ADE7759_MAX_TX 6
#define ADE7759_MAX_RX 6
#define ADE7759_STARTUP_DELAY 1
#define ADE7759_SPI_SLOW (u32)(300 * 1000)
#define ADE7759_SPI_BURST (u32)(1000 * 1000)
#define ADE7759_SPI_FAST (u32)(2000 * 1000)
/**
* struct ade7759_state - device instance specific data
* @us: actual spi_device
* @buf_lock: mutex to protect tx and rx
* @tx: transmit buffer
* @rx: receive buffer
**/
struct ade7759_state {
struct spi_device *us;
struct mutex buf_lock;
u8 tx[ADE7759_MAX_TX] ____cacheline_aligned;
u8 rx[ADE7759_MAX_RX];
};
#endif
|
//
// MJRefreshBackGifFooter.h
// MJRefreshExample
//
// Created by MJ Lee on 15/4/24.
// Copyright (c) 2015年 小码哥. All rights reserved.
//
#import "MJRefreshBackStateFooter.h"
@interface MJRefreshBackGifFooter : MJRefreshBackStateFooter
/** 设置state状态下的动画图片images 动画持续时间duration*/
- (void)setImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(MJRefreshState)state;
- (void)setImages:(NSArray *)images forState:(MJRefreshState)state;
@end
|
/* SPDX-License-Identifier: MIT */
#ifndef __NV04_DEVINIT_H__
#define __NV04_DEVINIT_H__
#define nv04_devinit(p) container_of((p), struct nv04_devinit, base)
#include "priv.h"
struct nvkm_pll_vals;
struct nv04_devinit {
struct nvkm_devinit base;
int owner;
};
int nv04_devinit_new_(const struct nvkm_devinit_func *, struct nvkm_device *,
int, struct nvkm_devinit **);
void *nv04_devinit_dtor(struct nvkm_devinit *);
void nv04_devinit_preinit(struct nvkm_devinit *);
void nv04_devinit_fini(struct nvkm_devinit *);
int nv04_devinit_pll_set(struct nvkm_devinit *, u32, u32);
void setPLL_single(struct nvkm_devinit *, u32, struct nvkm_pll_vals *);
void setPLL_double_highregs(struct nvkm_devinit *, u32, struct nvkm_pll_vals *);
void setPLL_double_lowregs(struct nvkm_devinit *, u32, struct nvkm_pll_vals *);
#endif
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2012 Regents of the University of California
*/
#include <linux/init.h>
#include <linux/seq_file.h>
#include <linux/of.h>
#include <asm/smp.h>
/*
* Returns the hart ID of the given device tree node, or -ENODEV if the node
* isn't an enabled and valid RISC-V hart node.
*/
int riscv_of_processor_hartid(struct device_node *node)
{
const char *isa;
u32 hart;
if (!of_device_is_compatible(node, "riscv")) {
pr_warn("Found incompatible CPU\n");
return -ENODEV;
}
if (of_property_read_u32(node, "reg", &hart)) {
pr_warn("Found CPU without hart ID\n");
return -ENODEV;
}
if (!of_device_is_available(node)) {
pr_info("CPU with hartid=%d is not available\n", hart);
return -ENODEV;
}
if (of_property_read_string(node, "riscv,isa", &isa)) {
pr_warn("CPU with hartid=%d has no \"riscv,isa\" property\n", hart);
return -ENODEV;
}
if (isa[0] != 'r' || isa[1] != 'v') {
pr_warn("CPU with hartid=%d has an invalid ISA of \"%s\"\n", hart, isa);
return -ENODEV;
}
return hart;
}
/*
* Find hart ID of the CPU DT node under which given DT node falls.
*
* To achieve this, we walk up the DT tree until we find an active
* RISC-V core (HART) node and extract the cpuid from it.
*/
int riscv_of_parent_hartid(struct device_node *node)
{
for (; node; node = node->parent) {
if (of_device_is_compatible(node, "riscv"))
return riscv_of_processor_hartid(node);
}
return -1;
}
#ifdef CONFIG_PROC_FS
static void print_isa(struct seq_file *f, const char *isa)
{
/* Print the entire ISA as it is */
seq_puts(f, "isa\t\t: ");
seq_write(f, isa, strlen(isa));
seq_puts(f, "\n");
}
static void print_mmu(struct seq_file *f, const char *mmu_type)
{
#if defined(CONFIG_32BIT)
if (strcmp(mmu_type, "riscv,sv32") != 0)
return;
#elif defined(CONFIG_64BIT)
if (strcmp(mmu_type, "riscv,sv39") != 0 &&
strcmp(mmu_type, "riscv,sv48") != 0)
return;
#endif
seq_printf(f, "mmu\t\t: %s\n", mmu_type+6);
}
static void *c_start(struct seq_file *m, loff_t *pos)
{
*pos = cpumask_next(*pos - 1, cpu_online_mask);
if ((*pos) < nr_cpu_ids)
return (void *)(uintptr_t)(1 + *pos);
return NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
(*pos)++;
return c_start(m, pos);
}
static void c_stop(struct seq_file *m, void *v)
{
}
static int c_show(struct seq_file *m, void *v)
{
unsigned long cpu_id = (unsigned long)v - 1;
struct device_node *node = of_get_cpu_node(cpu_id, NULL);
const char *compat, *isa, *mmu;
seq_printf(m, "processor\t: %lu\n", cpu_id);
seq_printf(m, "hart\t\t: %lu\n", cpuid_to_hartid_map(cpu_id));
if (!of_property_read_string(node, "riscv,isa", &isa))
print_isa(m, isa);
if (!of_property_read_string(node, "mmu-type", &mmu))
print_mmu(m, mmu);
if (!of_property_read_string(node, "compatible", &compat)
&& strcmp(compat, "riscv"))
seq_printf(m, "uarch\t\t: %s\n", compat);
seq_puts(m, "\n");
of_node_put(node);
return 0;
}
const struct seq_operations cpuinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_show
};
#endif /* CONFIG_PROC_FS */
|
#include <linux/sched.h>
#include <linux/ftrace.h>
#include <asm/ptrace.h>
#include <asm/bitops.h>
#include <asm/stacktrace.h>
#include <asm/unwind.h>
unsigned long unwind_get_return_address(struct unwind_state *state)
{
unsigned long addr;
if (unwind_done(state))
return 0;
addr = READ_ONCE_NOCHECK(*state->sp);
return ftrace_graph_ret_addr(state->task, &state->graph_idx,
addr, state->sp);
}
EXPORT_SYMBOL_GPL(unwind_get_return_address);
unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
{
return NULL;
}
bool unwind_next_frame(struct unwind_state *state)
{
struct stack_info *info = &state->stack_info;
if (unwind_done(state))
return false;
do {
for (state->sp++; state->sp < info->end; state->sp++) {
unsigned long addr = READ_ONCE_NOCHECK(*state->sp);
if (__kernel_text_address(addr))
return true;
}
state->sp = PTR_ALIGN(info->next_sp, sizeof(long));
} while (!get_stack_info(state->sp, state->task, info,
&state->stack_mask));
return false;
}
EXPORT_SYMBOL_GPL(unwind_next_frame);
void __unwind_start(struct unwind_state *state, struct task_struct *task,
struct pt_regs *regs, unsigned long *first_frame)
{
memset(state, 0, sizeof(*state));
state->task = task;
state->sp = PTR_ALIGN(first_frame, sizeof(long));
get_stack_info(first_frame, state->task, &state->stack_info,
&state->stack_mask);
/*
* The caller can provide the address of the first frame directly
* (first_frame) or indirectly (regs->sp) to indicate which stack frame
* to start unwinding at. Skip ahead until we reach it.
*/
if (!unwind_done(state) &&
(!on_stack(&state->stack_info, first_frame, sizeof(long)) ||
!__kernel_text_address(*first_frame)))
unwind_next_frame(state);
}
EXPORT_SYMBOL_GPL(__unwind_start);
|
/* sound/soc/samsung/s3c24xx_simtec_hermes.c
*
* Copyright 2009 Simtec Electronics
*
* 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 <sound/soc.h>
#include "s3c24xx_simtec.h"
static const struct snd_soc_dapm_widget dapm_widgets[] = {
SND_SOC_DAPM_LINE("GSM Out", NULL),
SND_SOC_DAPM_LINE("GSM In", NULL),
SND_SOC_DAPM_LINE("Line In", NULL),
SND_SOC_DAPM_LINE("Line Out", NULL),
SND_SOC_DAPM_LINE("ZV", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_HP("Headphone Jack", NULL),
};
static const struct snd_soc_dapm_route base_map[] = {
/* Headphone connected to HP{L,R}OUT and HP{L,R}COM */
{ "Headphone Jack", NULL, "HPLOUT" },
{ "Headphone Jack", NULL, "HPLCOM" },
{ "Headphone Jack", NULL, "HPROUT" },
{ "Headphone Jack", NULL, "HPRCOM" },
/* ZV connected to Line1 */
{ "LINE1L", NULL, "ZV" },
{ "LINE1R", NULL, "ZV" },
/* Line In connected to Line2 */
{ "LINE2L", NULL, "Line In" },
{ "LINE2R", NULL, "Line In" },
/* Microphone connected to MIC3R and MIC_BIAS */
{ "MIC3L", NULL, "Mic Jack" },
/* GSM connected to MONO_LOUT and MIC3L (in) */
{ "GSM Out", NULL, "MONO_LOUT" },
{ "MIC3L", NULL, "GSM In" },
/* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are
* not using the DAPM to power it up and down as there it makes
* a click when powering up. */
};
/**
* simtec_hermes_init - initialise and add controls
* @codec; The codec instance to attach to.
*
* Attach our controls and configure the necessary codec
* mappings for our sound card instance.
*/
static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin(dapm, "Line In");
snd_soc_dapm_enable_pin(dapm, "Line Out");
snd_soc_dapm_enable_pin(dapm, "Mic Jack");
simtec_audio_init(rtd);
return 0;
}
static struct snd_soc_dai_link simtec_dai_aic33 = {
.name = "tlv320aic33",
.stream_name = "TLV320AIC33",
.codec_name = "tlv320aic3x-codec.0-001a",
.cpu_dai_name = "s3c24xx-iis",
.codec_dai_name = "tlv320aic3x-hifi",
.platform_name = "samsung-audio",
.init = simtec_hermes_init,
};
/* simtec audio machine driver */
static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
.name = "Simtec-Hermes",
.owner = THIS_MODULE,
.dai_link = &simtec_dai_aic33,
.num_links = 1,
.dapm_widgets = dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(dapm_widgets),
.dapm_routes = base_map,
.num_dapm_routes = ARRAY_SIZE(base_map),
};
static int __devinit simtec_audio_hermes_probe(struct platform_device *pd)
{
dev_info(&pd->dev, "probing....\n");
return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
}
static struct platform_driver simtec_audio_hermes_platdrv = {
.driver = {
.owner = THIS_MODULE,
.name = "s3c24xx-simtec-hermes-snd",
.pm = simtec_audio_pm,
},
.probe = simtec_audio_hermes_probe,
.remove = __devexit_p(simtec_audio_remove),
};
module_platform_driver(simtec_audio_hermes_platdrv);
MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
MODULE_LICENSE("GPL");
|
#ifndef _M68K_IRQFLAGS_H
#define _M68K_IRQFLAGS_H
#include <linux/types.h>
#ifdef CONFIG_MMU
#include <linux/preempt_mask.h>
#endif
#include <linux/preempt.h>
#include <asm/thread_info.h>
#include <asm/entry.h>
static inline unsigned long arch_local_save_flags(void)
{
unsigned long flags;
asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory");
return flags;
}
static inline void arch_local_irq_disable(void)
{
#ifdef CONFIG_COLDFIRE
asm volatile (
"move %/sr,%%d0 \n\t"
"ori.l #0x0700,%%d0 \n\t"
"move %%d0,%/sr \n"
: /* no outputs */
:
: "cc", "%d0", "memory");
#else
asm volatile ("oriw #0x0700,%%sr" : : : "memory");
#endif
}
static inline void arch_local_irq_enable(void)
{
#if defined(CONFIG_COLDFIRE)
asm volatile (
"move %/sr,%%d0 \n\t"
"andi.l #0xf8ff,%%d0 \n\t"
"move %%d0,%/sr \n"
: /* no outputs */
:
: "cc", "%d0", "memory");
#else
# if defined(CONFIG_MMU)
if (MACH_IS_Q40 || !hardirq_count())
# endif
asm volatile (
"andiw %0,%%sr"
:
: "i" (ALLOWINT)
: "memory");
#endif
}
static inline unsigned long arch_local_irq_save(void)
{
unsigned long flags = arch_local_save_flags();
arch_local_irq_disable();
return flags;
}
static inline void arch_local_irq_restore(unsigned long flags)
{
asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory");
}
static inline bool arch_irqs_disabled_flags(unsigned long flags)
{
if (MACH_IS_ATARI) {
/* Ignore HSYNC = ipl 2 on Atari */
return (flags & ~(ALLOWINT | 0x200)) != 0;
}
return (flags & ~ALLOWINT) != 0;
}
static inline bool arch_irqs_disabled(void)
{
return arch_irqs_disabled_flags(arch_local_save_flags());
}
#endif /* _M68K_IRQFLAGS_H */
|
/*
* iteration_check.c: test races having to do with radix tree iteration
* Copyright (c) 2016 Intel Corporation
* Author: Ross Zwisler <ross.zwisler@linux.intel.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <linux/radix-tree.h>
#include <pthread.h>
#include "test.h"
#define NUM_THREADS 5
#define MAX_IDX 100
#define TAG 0
#define NEW_TAG 1
static pthread_mutex_t tree_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t threads[NUM_THREADS];
static unsigned int seeds[3];
static RADIX_TREE(tree, GFP_KERNEL);
static bool test_complete;
static int max_order;
/* relentlessly fill the tree with tagged entries */
static void *add_entries_fn(void *arg)
{
rcu_register_thread();
while (!test_complete) {
unsigned long pgoff;
int order;
for (pgoff = 0; pgoff < MAX_IDX; pgoff++) {
pthread_mutex_lock(&tree_lock);
for (order = max_order; order >= 0; order--) {
if (item_insert_order(&tree, pgoff, order)
== 0) {
item_tag_set(&tree, pgoff, TAG);
break;
}
}
pthread_mutex_unlock(&tree_lock);
}
}
rcu_unregister_thread();
return NULL;
}
/*
* Iterate over the tagged entries, doing a radix_tree_iter_retry() as we find
* things that have been removed and randomly resetting our iteration to the
* next chunk with radix_tree_iter_resume(). Both radix_tree_iter_retry() and
* radix_tree_iter_resume() cause radix_tree_next_slot() to be called with a
* NULL 'slot' variable.
*/
static void *tagged_iteration_fn(void *arg)
{
struct radix_tree_iter iter;
void **slot;
rcu_register_thread();
while (!test_complete) {
rcu_read_lock();
radix_tree_for_each_tagged(slot, &tree, &iter, 0, TAG) {
void *entry = radix_tree_deref_slot(slot);
if (unlikely(!entry))
continue;
if (radix_tree_deref_retry(entry)) {
slot = radix_tree_iter_retry(&iter);
continue;
}
if (rand_r(&seeds[0]) % 50 == 0) {
slot = radix_tree_iter_resume(slot, &iter);
rcu_read_unlock();
rcu_barrier();
rcu_read_lock();
}
}
rcu_read_unlock();
}
rcu_unregister_thread();
return NULL;
}
/*
* Iterate over the entries, doing a radix_tree_iter_retry() as we find things
* that have been removed and randomly resetting our iteration to the next
* chunk with radix_tree_iter_resume(). Both radix_tree_iter_retry() and
* radix_tree_iter_resume() cause radix_tree_next_slot() to be called with a
* NULL 'slot' variable.
*/
static void *untagged_iteration_fn(void *arg)
{
struct radix_tree_iter iter;
void **slot;
rcu_register_thread();
while (!test_complete) {
rcu_read_lock();
radix_tree_for_each_slot(slot, &tree, &iter, 0) {
void *entry = radix_tree_deref_slot(slot);
if (unlikely(!entry))
continue;
if (radix_tree_deref_retry(entry)) {
slot = radix_tree_iter_retry(&iter);
continue;
}
if (rand_r(&seeds[1]) % 50 == 0) {
slot = radix_tree_iter_resume(slot, &iter);
rcu_read_unlock();
rcu_barrier();
rcu_read_lock();
}
}
rcu_read_unlock();
}
rcu_unregister_thread();
return NULL;
}
/*
* Randomly remove entries to help induce radix_tree_iter_retry() calls in the
* two iteration functions.
*/
static void *remove_entries_fn(void *arg)
{
rcu_register_thread();
while (!test_complete) {
int pgoff;
pgoff = rand_r(&seeds[2]) % MAX_IDX;
pthread_mutex_lock(&tree_lock);
item_delete(&tree, pgoff);
pthread_mutex_unlock(&tree_lock);
}
rcu_unregister_thread();
return NULL;
}
static void *tag_entries_fn(void *arg)
{
rcu_register_thread();
while (!test_complete) {
tag_tagged_items(&tree, &tree_lock, 0, MAX_IDX, 10, TAG,
NEW_TAG);
}
rcu_unregister_thread();
return NULL;
}
/* This is a unit test for a bug found by the syzkaller tester */
void iteration_test(unsigned order, unsigned test_duration)
{
int i;
printv(1, "Running %siteration tests for %d seconds\n",
order > 0 ? "multiorder " : "", test_duration);
max_order = order;
test_complete = false;
for (i = 0; i < 3; i++)
seeds[i] = rand();
if (pthread_create(&threads[0], NULL, tagged_iteration_fn, NULL)) {
perror("create tagged iteration thread");
exit(1);
}
if (pthread_create(&threads[1], NULL, untagged_iteration_fn, NULL)) {
perror("create untagged iteration thread");
exit(1);
}
if (pthread_create(&threads[2], NULL, add_entries_fn, NULL)) {
perror("create add entry thread");
exit(1);
}
if (pthread_create(&threads[3], NULL, remove_entries_fn, NULL)) {
perror("create remove entry thread");
exit(1);
}
if (pthread_create(&threads[4], NULL, tag_entries_fn, NULL)) {
perror("create tag entry thread");
exit(1);
}
sleep(test_duration);
test_complete = true;
for (i = 0; i < NUM_THREADS; i++) {
if (pthread_join(threads[i], NULL)) {
perror("pthread_join");
exit(1);
}
}
item_kill_tree(&tree);
}
|
/* Driver for Realtek RTS51xx USB card reader
* Header file
*
* Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, 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/>.
*
* Author:
* wwang (wei_wang@realsil.com.cn)
* No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
* Maintainer:
* Edwin Rong (edwin_rong@realsil.com.cn)
* No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
*/
#ifndef __RTS51X_XD_H
#define __RTS51X_XD_H
/* Error Codes */
#define XD_NO_ERROR 0x00
#define XD_NO_MEMORY 0x80
#define XD_PRG_ERROR 0x40
#define XD_NO_CARD 0x20
#define XD_READ_FAIL 0x10
#define XD_ERASE_FAIL 0x08
#define XD_WRITE_FAIL 0x04
#define XD_ECC_ERROR 0x02
#define XD_TO_ERROR 0x01
/* XD Commands */
#define READ1_1 0x00
#define READ1_2 0x01
#define READ2 0x50
#define READ_ID 0x90
#define RESET 0xff
#define PAGE_PRG_1 0x80
#define PAGE_PRG_2 0x10
#define BLK_ERASE_1 0x60
#define BLK_ERASE_2 0xD0
#define READ_STS 0x70
#define READ_xD_ID 0x9A
#define COPY_BACK_512 0x8A
#define COPY_BACK_2K 0x85
#define READ1_1_2 0x30
#define READ1_1_3 0x35
#define CHG_DAT_OUT_1 0x05
#define RDM_DAT_OUT_1 0x05
#define CHG_DAT_OUT_2 0xE0
#define RDM_DAT_OUT_2 0xE0
#define CHG_DAT_OUT_2 0xE0
#define CHG_DAT_IN_1 0x85
#define CACHE_PRG 0x15
/* Redundant Area Related */
#define XD_EXTRA_SIZE 0x10
#define XD_2K_EXTRA_SIZE 0x40
/* Define for XD Status */
#define NOT_WRITE_PROTECTED 0x80
#define READY_STATE 0x40
#define PROGRAM_ERROR 0x01
#define PROGRAM_ERROR_N_1 0x02
#define INTERNAL_READY 0x20
#define READY_FLAG 0x5F
/* Define for device code */
#define XD_8M_X8_512 0xE6
#define XD_16M_X8_512 0x73
#define XD_32M_X8_512 0x75
#define XD_64M_X8_512 0x76
#define XD_128M_X8_512 0x79
#define XD_256M_X8_512 0x71
#define XD_128M_X8_2048 0xF1
#define XD_256M_X8_2048 0xDA
#define XD_512M_X8 0xDC
#define XD_128M_X16_2048 0xC1
#define XD_4M_X8_512_1 0xE3
#define XD_4M_X8_512_2 0xE5
#define xD_1G_X8_512 0xD3
#define xD_2G_X8_512 0xD5
#define XD_ID_CODE 0xB5
#define VENDOR_BLOCK 0xEFFF
#define CIS_BLOCK 0xDFFF
#define BLK_NOT_FOUND 0xFFFFFFFF
#define NO_NEW_BLK 0xFFFFFFFF
#define PAGE_CORRECTABLE 0x0
#define PAGE_NOTCORRECTABLE 0x1
#define NO_OFFSET 0x0
#define WITH_OFFSET 0x1
#define Sect_Per_Page 4
#define XD_ADDR_MODE_2C XD_ADDR_MODE_2A
#define ZONE0_BAD_BLOCK 23
#define NOT_ZONE0_BAD_BLOCK 24
/* Assign address mode */
#define XD_RW_ADDR 0x01
#define XD_ERASE_ADDR 0x02
/* Macro Definition */
#define XD_PAGE_512(xd_card) \
do { \
(xd_card)->block_shift = 5; \
(xd_card)->page_off = 0x1F; \
} while (0)
#define XD_SET_BAD_NEWBLK(xd_card) ((xd_card)->multi_flag |= 0x01)
#define XD_CLR_BAD_NEWBLK(xd_card) ((xd_card)->multi_flag &= ~0x01)
#define XD_CHK_BAD_NEWBLK(xd_card) ((xd_card)->multi_flag & 0x01)
#define XD_SET_BAD_OLDBLK(xd_card) ((xd_card)->multi_flag |= 0x02)
#define XD_CLR_BAD_OLDBLK(xd_card) ((xd_card)->multi_flag &= ~0x02)
#define XD_CHK_BAD_OLDBLK(xd_card) ((xd_card)->multi_flag & 0x02)
#define XD_SET_MBR_FAIL(xd_card) ((xd_card)->multi_flag |= 0x04)
#define XD_CLR_MBR_FAIL(xd_card) ((xd_card)->multi_flag &= ~0x04)
#define XD_CHK_MBR_FAIL(xd_card) ((xd_card)->multi_flag & 0x04)
#define XD_SET_ECC_FLD_ERR(xd_card) ((xd_card)->multi_flag |= 0x08)
#define XD_CLR_ECC_FLD_ERR(xd_card) ((xd_card)->multi_flag &= ~0x08)
#define XD_CHK_ECC_FLD_ERR(xd_card) ((xd_card)->multi_flag & 0x08)
#define XD_SET_4MB(xd_card) ((xd_card)->multi_flag |= 0x10)
#define XD_CLR_4MB(xd_card) ((xd_card)->multi_flag &= ~0x10)
#define XD_CHK_4MB(xd_card) ((xd_card)->multi_flag & 0x10)
#define XD_SET_ECC_ERR(xd_card) ((xd_card)->multi_flag |= 0x40)
#define XD_CLR_ECC_ERR(xd_card) ((xd_card)->multi_flag &= ~0x40)
#define XD_CHK_ECC_ERR(xd_card) ((xd_card)->multi_flag & 0x40)
/* Offset in xD redundant buffer */
#define PAGE_STATUS 0
#define BLOCK_STATUS 1
#define BLOCK_ADDR1_L 2
#define BLOCK_ADDR1_H 3
#define BLOCK_ADDR2_L 4
#define BLOCK_ADDR2_H 5
#define RESERVED0 6
#define RESERVED1 7
#define RESERVED2 8
#define RESERVED3 9
#define PARITY 10
/* For CIS block */
#define CIS0_0 0
#define CIS0_1 1
#define CIS0_2 2
#define CIS0_3 3
#define CIS0_4 4
#define CIS0_5 5
#define CIS0_6 6
#define CIS0_7 7
#define CIS0_8 8
#define CIS0_9 9
#define CIS1_0 256
#define CIS1_1 (256 + 1)
#define CIS1_2 (256 + 2)
#define CIS1_3 (256 + 3)
#define CIS1_4 (256 + 4)
#define CIS1_5 (256 + 5)
#define CIS1_6 (256 + 6)
#define CIS1_7 (256 + 7)
#define CIS1_8 (256 + 8)
#define CIS1_9 (256 + 9)
int rts51x_reset_xd_card(struct rts51x_chip *chip);
int rts51x_xd_rw(struct scsi_cmnd *srb, struct rts51x_chip *chip, u32 start_sector,
u16 sector_cnt);
void rts51x_xd_free_l2p_tbl(struct rts51x_chip *chip);
void rts51x_xd_cleanup_work(struct rts51x_chip *chip);
int rts51x_release_xd_card(struct rts51x_chip *chip);
#endif /* __RTS51X_XD_H */
|
// SPDX-License-Identifier: MIT
/*
* Copyright © 2020 Intel Corporation
*/
#include <drm/drm_print.h>
#include "gt/intel_gt_debugfs.h"
#include "intel_huc.h"
#include "intel_huc_debugfs.h"
static int huc_info_show(struct seq_file *m, void *data)
{
struct intel_huc *huc = m->private;
struct drm_printer p = drm_seq_file_printer(m);
if (!intel_huc_is_supported(huc))
return -ENODEV;
intel_huc_load_status(huc, &p);
return 0;
}
DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(huc_info);
void intel_huc_debugfs_register(struct intel_huc *huc, struct dentry *root)
{
static const struct intel_gt_debugfs_file files[] = {
{ "huc_info", &huc_info_fops, NULL },
};
if (!intel_huc_is_supported(huc))
return;
intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), huc);
}
|
/*
* S390 version
*
* Derived from "include/asm-i386/statfs.h"
*/
#ifndef _S390_STATFS_H
#define _S390_STATFS_H
/*
* We can't use <asm-generic/statfs.h> because in 64-bit mode
* we mix ints of different sizes in our struct statfs.
*/
#ifndef __KERNEL_STRICT_NAMES
#include <linux/types.h>
typedef __kernel_fsid_t fsid_t;
#endif
struct statfs {
unsigned int f_type;
unsigned int f_bsize;
unsigned long f_blocks;
unsigned long f_bfree;
unsigned long f_bavail;
unsigned long f_files;
unsigned long f_ffree;
__kernel_fsid_t f_fsid;
unsigned int f_namelen;
unsigned int f_frsize;
unsigned int f_flags;
unsigned int f_spare[4];
};
struct statfs64 {
unsigned int f_type;
unsigned int f_bsize;
unsigned long f_blocks;
unsigned long f_bfree;
unsigned long f_bavail;
unsigned long f_files;
unsigned long f_ffree;
__kernel_fsid_t f_fsid;
unsigned int f_namelen;
unsigned int f_frsize;
unsigned int f_flags;
unsigned int f_spare[4];
};
#endif
|
/*
* Copyright (c) 2015-2017 Contributors as noted in the AUTHORS file
*
* This file is part of ukvm, a unikernel monitor.
*
* 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.
*/
/*
* ukvm_hv_openbsd.c: Architecture-independent part of OpenBSD vmm(4) backend
* implementation.
*/
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define _WITH_DPRINTF
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <machine/vmmvar.h>
#include <sys/param.h>
#include "ukvm.h"
#include "ukvm_hv_openbsd.h"
/*
* TODO: To ensure that the VM is correctly destroyed on shutdown (normal or
* not) we currently install an atexit() handler. The top-level API will need
* to be changed to accomodate this, e.g. by introducing a ukvm_hv_shutdown(),
* however this is incompatible with the current "fail fast" approach to
* internal error handling.
*/
static struct ukvm_hv *cleanup_hv;
static void cleanup_vmd_fd(void)
{
if (cleanup_hv != NULL && cleanup_hv->b->vmd_fd != -1)
close(cleanup_hv->b->vmd_fd);
}
static void cleanup_vm(void)
{
if (cleanup_hv != NULL && cleanup_hv->b->vcp_id != -1) {
struct vm_terminate_params vtp = { .vtp_vm_id = cleanup_hv->b->vcp_id };
if (ioctl(cleanup_hv->b->vmd_fd, VMM_IOC_TERM, &vtp) < 0)
err(1, "terminate vmm ioctl failed - still exiting");
}
}
struct ukvm_hv *ukvm_hv_init(size_t mem_size)
{
struct ukvm_hv *hv;
struct ukvm_hvb *hvb;
struct vm_create_params *vcp;
struct vm_mem_range *vmr;
void *p;
if(geteuid() != 0) {
errno = EPERM;
err(1, "need root privileges");
}
hv = calloc(1, sizeof (struct ukvm_hv));
if (hv == NULL)
err(1, "calloc hv");
hvb = calloc(1, sizeof (struct ukvm_hvb));
if (hvb == NULL)
err(1, "calloc");
hv->b = hvb;
hvb->vmd_fd = -1;
hvb->vmd_fd = open(VMM_NODE, O_RDWR);
if (hvb->vmd_fd == -1)
err(1, "VMM_NODE");
cleanup_hv = hv;
atexit(cleanup_vmd_fd);
vcp = calloc(1, sizeof (struct vm_create_params));
if (vcp == NULL)
err(1, "calloc");
vcp->vcp_ncpus = 1; // vmm only supports 1 cpu for now.
int size = snprintf(vcp->vcp_name, VMM_MAX_NAME_LEN, "ukvm%d", getpid());
if (size == -1)
err(1, "snprintf");
vcp->vcp_nmemranges = 1;
vcp->vcp_memranges[0].vmr_gpa = 0x0;
vcp->vcp_memranges[0].vmr_size = mem_size;
vmr = &vcp->vcp_memranges[0];
p = mmap(NULL, vmr->vmr_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
if (p == MAP_FAILED)
err(1, "mmap");
vmr->vmr_va = (vaddr_t)p;
hv->mem = p;
hv->mem_size = mem_size;
if (ioctl(hvb->vmd_fd, VMM_IOC_CREATE, vcp) < 0)
err(1, "create vmm ioctl failed - exiting");
hvb->vcp_id = vcp->vcp_id;
hvb->vcpu_id = 0; // the first and only cpu is at 0
atexit(cleanup_vm);
return hv;
}
|
/*
* Copyright (c) 2014, Thorben Hasenpusch <t.hasenpusch@icloud.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.
*/
#pragma once
namespace Uefi {
struct MemoryMap;
}
namespace Paging {
constexpr unsigned PAGE_SIZE = 0x1000; // 4 KiB
// Identity maps the whole memory region
void setup(const Uefi::MemoryMap &map);
} // end namespace Paging
|
/*
* %ISC_START_LICENSE%
* ---------------------------------------------------------------------
* Copyright 2006-2018, Pittsburgh Supercomputing Center
* All rights reserved.
*
* Permission to use, copy, modify, and 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.
* --------------------------------------------------------------------
* %END_LICENSE%
*/
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "pfl/list.h"
#include "pfl/lock.h"
#include "pfl/log.h"
#include "pfl/meter.h"
struct psc_lockedlist pfl_meters =
PLL_INIT(&pfl_meters, struct pfl_meter, pm_lentry);
void
pfl_meter_init(struct pfl_meter *pm, uint64_t max, const char *fmt, ...)
{
va_list ap;
int rc;
memset(pm, 0, sizeof(*pm));
INIT_PSC_LISTENTRY(&pm->pm_lentry);
pm->pm_max = max;
pm->pm_maxp = &pm->pm_max;
va_start(ap, fmt);
rc = vsnprintf(pm->pm_name, sizeof(pm->pm_name), fmt, ap);
va_end(ap);
if (rc == -1)
psc_fatal("vsnprintf");
pll_addtail(&pfl_meters, pm);
}
void
pfl_meter_destroy(struct pfl_meter *pm)
{
pll_remove(&pfl_meters, pm);
}
|
/*
Copyright (c) 2005-2008, Simon Howard
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 LIBCALG_H
#define LIBCALG_H
#include <calg/compare-int.h>
#include <calg/compare-pointer.h>
#include <calg/compare-string.h>
#include <calg/hash-int.h>
#include <calg/hash-pointer.h>
#include <calg/hash-string.h>
#include <calg/arraylist.h>
#include <calg/avl-tree.h>
#include <calg/binary-heap.h>
#include <calg/binomial-heap.h>
#include <calg/bloom-filter.h>
#include <calg/hash-table.h>
#include <calg/list.h>
#include <calg/queue.h>
#include <calg/rb-tree.h>
#include <calg/set.h>
#include <calg/slist.h>
#include <calg/trie.h>
#endif /* #ifndef LIBCALG_H */
|
/*
* Copyright (c) 2013 James Molloy, Jörg Pfähler, Matthew Iselin
*
* Permission to use, copy, modify, and 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 POINTERS_H
#define POINTERS_H
#include <processor/types.h>
#include <Log.h>
/** Provides a wrapper around a single-use pointer. The copy constructor
* will invalidate the reference in the object being copied from.
*/
template <class T>
class UniquePointer
{
public:
UniquePointer(T *p) : m_Pointer(p)
{
}
virtual ~UniquePointer()
{
if(m_Pointer)
{
delete m_Pointer;
m_Pointer = 0;
}
}
UniquePointer(UniquePointer<T> &p)
{
m_Pointer = p.m_Pointer;
p.m_Pointer = 0;
}
UniquePointer<T> &operator = (UniquePointer<T> &p)
{
m_Pointer = p.m_Pointer;
p.m_Pointer = 0;
return *this;
}
T * operator * ()
{
return m_Pointer;
}
private:
T *m_Pointer;
};
#endif
|
#include "jbot.h"
static uint8_t ZLX_CALL test
(
zlx_elal_t * ZLX_RESTRICT ea,
void * * etab,
size_t alloc_count,
size_t free_count
)
{
size_t i, n;
if (!etab) E(1, "error: no mem for elal-test\n");
for (i = 0; i < alloc_count; ++i)
{
etab[i] = zlx_elal_alloc(ea, "elem");
if (!etab[i]) E(2, "error: elal alloc failed after $z elements\n", i);
}
for (i = 0; i < free_count; ++i)
{
zlx_elal_free(ea, etab[i]);
if (ea->chain_len != (i + 1 > ea->max_chain_len ? ea->max_chain_len : i + 1))
E(3, "error: unexpected chain len of $z "
"after freeing element #$z\n",
ea->chain_len, i);
}
n = ea->chain_len;
for (i = 0; i < free_count; ++i)
{
if ((i <= n && ea->chain_len != n - i)
|| (i > n && ea->chain_len != 0))
E(4, "error: unexpected chain len when reallocating item #$z\n", i);
etab[i] = zlx_elal_alloc(ea, "elem2");
if (!etab[i]) E(2, "error: elal alloc failed after $z elements\n", i);
}
if ((i <= n && ea->chain_len != n - i)
|| (i > n && ea->chain_len != 0))
E(4, "error: unexpected chain len when reallocating item #$z\n", i);
for (i = 0; i < alloc_count; ++i)
{
zlx_elal_free(ea, etab[i]);
if (ea->chain_len != (i + 1 > ea->max_chain_len ? ea->max_chain_len : i + 1))
E(3, "error: unexpected chain len of $z "
"after freeing element #$z\n",
ea->chain_len, i);
}
return 0;
}
uint8_t ZLX_CALL elal_test
(
size_t elem_size,
uint32_t max_chain_len,
size_t alloc_count,
size_t free_count
)
{
zlx_elal_t ea;
unsigned int s;
void * * etab;
if (free_count > alloc_count) free_count = alloc_count;
s = zlx_elal_init(&ea, hbs_ma, NULL, NULL, elem_size, max_chain_len);
if (s) E(1, "elal-test: failed to init elal mutex\n");
etab = hbs_alloc(sizeof(void *) * alloc_count, "etab");
s = test(&ea, etab, alloc_count, free_count);
zlx_elal_finish(&ea);
if (etab) hbs_free(etab, sizeof(void *) * alloc_count);
return s;
}
|
// SimpleTimeoutTemplate class for creating simple timeouts and delays
// MIT License
//
// Copyright (c) 2017 Robert Black
//
// 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.
// Typical Usage:
// SimpleTimeout timeout(ms); // Timeout length in milliseconds
//
// for (i = 0; i < count; i++) {
// while (!timeout.expired() && !finished) {
// ... // Do something
// }
// timeout.restart();
// }
// The ms parameter is signed. However, negative values result
// in undefined behavior.
//
// If ms is set to FOREVER (or LONG_MAX) the timeout will only expire
// when cancelled.
//
// Note that the SimpleTimeout implementation on the Arduino uses millis()
#ifndef SIMPLETIMEOUTTEMPLATE_H
#define SIMPLETIMEOUTTEMPLATE_H
#include <Arduino.h>
#include <limits.h>
template <unsigned long(*T_TICKS)(void)>
class SimpleTimeoutTemplate {
public:
static constexpr long FOREVER = LONG_MAX;
// Create an object with a timeout starting now and expiring in durationTicks
// clock ticks. The SimpleTimeout instance works in milliseconds, but
// SimpleTimeoutMicros() gives you a timeout in microseconds.
//
// Durations of zero or negative numbers result in a timeout that has already
// expired. SimpleTimeout::FOREVER is a duration (equal to LONG_MAX) that
// will never expire.
SimpleTimeoutTemplate(long durationTicks = 0) {
start = T_TICKS();
duration = durationTicks;
}
// Start the timeout again.
void restart(void) {
restart(getDuration());
}
// Start the timeout again with a different duration.
void restart(long newDurationTicks) {
duration = newDurationTicks;
start = T_TICKS();
}
// Has the timer expired yet?
//
// This deals with clock wraps as long as the
// clock doesn't cycle all the way back to the timeout start time before you
// call expired(). Once the timeout has been detected by expired() it
// will be reported as expired forever.
bool expired(void) {
if (isForever()) {
return false;
}
if (isDisabled()) {
return true;
}
unsigned long now = T_TICKS();
unsigned long end = getEnd();
// Deal with timeout overflow without a clock overflow
if (end < start && now >= start) {
return false;
}
// hasExpired = true for clock overflow without a timeout overflow
bool hasExpired = (end >= start && now < start);
if (!hasExpired) { // Both overflowed or neither
hasExpired = now >= end;
}
if (hasExpired) {
// Once we have expired, cancel the timer to prevent clock-wrap
// from making it un-expire at some point in the future.
cancel();
}
return hasExpired;
}
inline unsigned long getStart(void) const {
return start;
}
inline unsigned long getEnd(void) const {
if (isDisabled() || isForever()) {
return start;
}
return start + duration;
}
inline long getDuration(void) const {
if (isDisabled()) {
return getInvertedDuration();
}
return duration;
}
inline bool isForever(void) const {
return duration == FOREVER;
}
// Has the timeout been cancelled or detected as expired?
inline bool isDisabled(void) const {
return duration < 0;
}
// Set the timeout to expired.
inline void cancel(void) {
if (!isDisabled()) {
duration = getInvertedDuration();
}
}
protected:
// The current implementation uses the sign bit to indicate that that the
// timeout has been cancelled or expired. Since the bit storage of
// negative numbers is implementation-defined and we want to be able to
// flag a timeout of zero, we are using an arithmetic of one's complement.
inline long getInvertedDuration() const {
return -1 - duration;
}
private:
unsigned long start;
long duration;
}; // class SimpleTimeoutTemplate
#endif // SIMPLETIMEOUTTEMPLATE_H
|
#pragma once
#include "gecommon.h"
#include "gerenderer.h"
#include "gl_core_3_2.h"
#include <glm/glm.hpp>
class RenderState;
class Texture2D;
class Quad : public Renderable
{
public:
Quad();
~Quad();
void construct(int size);
void construct(int width, int height);
void construct(int width, int height, const glm::vec3 &color);
void construct(int width, int height, Texture2D *texture);
void construct(int width, int height,
const glm::vec3 &topLeftColor, const glm::vec3 &topRightColor,
const glm::vec3 &bottomLeftColor, const glm::vec3 &bottomRightColor);
void destruct();
virtual PrimitiveType primitiveType() const { return kPrimitiveTypeTriangles; }
virtual int numVertices() const override { return 6; }
virtual void bind(RenderState *renderState) override;
virtual void unbind(RenderState *renderState) override;
private:
Quad(const Quad &other);
Quad &operator=(const Quad &rhs);
GLuint vertexArrayObject;
GLuint vertexBufferObject;
Texture2D *textureObject = nullptr;
};
|
//
// WCFoldMarker.h
// WabbitStudio
//
// Created by William Towe on 1/24/12.
// Copyright (c) 2012 Revolution Software.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <Foundation/NSObject.h>
typedef enum _WCFoldMarkerType {
WCFoldMarkerTypeMacroStart = 1,
WCFoldMarkerTypeMacroEnd,
WCFoldMarkerTypeIfStart,
WCFoldMarkerTypeIfEnd,
WCFoldMarkerTypeCommentStart,
WCFoldMarkerTypeCommentEnd
} WCFoldMarkerType;
@interface WCFoldMarker : NSObject {
WCFoldMarkerType _type;
NSRange _range;
}
@property (readonly,nonatomic) WCFoldMarkerType type;
@property (readonly,nonatomic) NSRange range;
+ (id)foldMarkerOfType:(WCFoldMarkerType)type range:(NSRange)range;
- (id)initWithType:(WCFoldMarkerType)type range:(NSRange)range;
@end
|
#ifndef QGAME_SHADER_PROGRAM_ASSET_H
#define QGAME_SHADER_PROGRAM_ASSET_H
#include <mruby.h>
void qgame_shader_program_asset_init(mrb_state* mrb, struct RClass* mrb_qgame_class);
#endif /* QGAME_SHADER_PROGRAM_ASSET_H */
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <json.h>
#include "client.h"
#include "log.h"
#define BUFFER_SIZE 1024
static void config_log(json_object *json)
{
const char *filename = NULL;
int level = LOG_ERROR;
json_object_object_foreach(json, key, val) {
if (strcmp(key, "file") == 0) {
filename = json_object_get_string(val);
}
if (strcmp(key, "level") == 0) {
level = json_object_get_int(val);
}
}
if (!filename) {
fprintf(stderr, "which log file do you want to write to?\n");
exit(2);
}
init_logger(filename, level);
}
static int config_master(struct mysql_server *server, json_object *json)
{
enum json_type item_type;
const char *tmp_char;
char *buffer;
json_object_object_foreach(json, key, val) {
item_type = json_object_get_type(val);
if (item_type == json_type_string) {
tmp_char = json_object_get_string(val);
buffer = malloc(strlen(tmp_char) + 1);
strcpy(buffer, tmp_char);
}
if (strcmp(key, "host") == 0) {
server->host = buffer;
continue;
}
if (strcmp(key, "port") == 0) {
server->port = (short)json_object_get_int(val);
continue;
}
if (strcmp(key, "user") == 0) {
server->user = buffer;
continue;
}
if (strcmp(key, "password") == 0) {
server->password = buffer;
continue;
}
if (strcmp(key, "database") == 0) {
server->database = buffer;
continue;
}
if (strcmp(key, "binlog") == 0) {
server->binlog = buffer;
continue;
}
if (strcmp(key, "position") == 0) {
server->position = json_object_get_int(val);
continue;
}
if (strcmp(key, "debug") == 0) {
server->debug = (short int)json_object_get_boolean(val);
continue;
}
}
return 0;
}
int read_config(server_info *config)
{
FILE *fp;
char *buffer;
int cursor = 0;
json_object *json;
enum json_tokener_error jerr;
buffer = malloc(sizeof(char) * BUFFER_SIZE);
fp = fopen("fake-slave.json", "r");
while ((fread(buffer + cursor, 1, BUFFER_SIZE, fp) == BUFFER_SIZE)) {
cursor += BUFFER_SIZE;
// read more
buffer = realloc(buffer, cursor + BUFFER_SIZE);
}
json = json_tokener_parse_verbose(buffer, &jerr);
if (!json) {
// error occured
printf("json parse filed: %s\n", json_tokener_error_desc(jerr));
printf("%s\n", buffer);
exit(5);
}
json_object_object_foreach(json, key, val) {
// master configure
if (strcmp(key, "master") == 0) {
if (strcmp(key, "master") == 0) {
config_master(&config->master, val);
}
continue;
}
// log config
if (strcmp(key, "log") == 0) {
config_log(val);
}
}
// free memory
json_object_put(json);
free(buffer);
logger(LOG_INFO, "read config from file completed.\n");
return 0;
}
static void usage(char *name)
{
fprintf(stderr, "%s\n", name);
fprintf(stderr,
"-P <num> database port\n"
"-D <database> database name\n"
"-h <host> database host\n"
"-u <user> database username\n"
"-p <password> database password\n"
"-d enable debug output\n"
);
}
// command line configure
void parse_command_pareters(int argc, char *argv[], server_info *info)
{
char opt;
// command line parameters
while ((opt = getopt(argc, argv, "dh:u:p:D:P:")) != -1) {
switch (opt) {
case 'd':
info->master.debug = 1;
break;
case 'h':
info->master.host = optarg;
break;
case 'u':
info->master.user = optarg;
break;
case 'p':
info->master.password = optarg;
break;
case 'P':
info->master.port = atoi(optarg);
break;
case 'D':
info->master.database = optarg;
break;
default:
usage(argv[0]);
exit(EXIT_FAILURE);
}
}
logger(LOG_INFO, "read parameters from command line completed.\n");
}
|
// ======================================================================
/*!
* \file NFmiDataModifierAdd.h
* \brief Interface of class NFmiDataModifierAdd
*/
// ======================================================================
#pragma once
#include "NFmiDataModifier.h"
class NFmiDataModifierAdd : public NFmiDataModifier
{
public:
NFmiDataModifierAdd(float theAddValue = 0);
virtual float FloatOperation(float theValue);
private:
float itsAddValue;
}; // class NFmiDataModifierAdd
// ======================================================================
|
/**
* \file 68K/Libraries/Telephony/HsPhoneLibrary.h
*
* Header File for Phone Library API ---- LIBRARY CATEGORY
*
* All implementations of the Handspring Phone Library support a common API.
* This API is broken up into various categories for easier management. This file
* defines the LIBRARY category. These API calls are used for basic Palm Library
* operation.
*
* \license
*
* Copyright (c) 2003 Handspring Inc., All Rights Reserved
*
* \author Arun Mathias
*
* $Id:$
*
**************************************************************/
#ifndef HS_PHONELIBRARY_H
#define HS_PHONELIBRARY_H
#include <PalmOS.h>
#include <PalmTypes.h>
#ifndef __CORE_COMPATIBILITY_H__
#include <PalmCompatibility.h>
// workaround for differing header files in sdk-3.5 and sdk-internal
#ifndef __CORE_COMPATIBILITY_H__
#define __CORE_COMPATIBILITY_H__
#endif
#endif
#include <Common/Libraries/Telephony/HsPhoneTraps.h> // trap table definition for phone library calls
#include <Common/Libraries/Telephony/HsPhoneErrors.h> // error codes returned by phone library functions
#include <Common/Libraries/Telephony/HsPhoneTypes.h>
// Open and initialize the phone library.
extern Err PhnLibOpen (UInt16 refNum)
SYS_TRAP (sysLibTrapOpen);
// Closes the phone library.
extern Err PhnLibClose (UInt16 refNum)
SYS_TRAP (sysLibTrapClose);
// Puts phone library to sleep
extern Err PhnLibSleep (UInt16 refNum)
SYS_TRAP (sysLibTrapSleep);
// Wake phone library
extern Err PhnLibWake (UInt16 refNum)
SYS_TRAP (sysLibTrapWake);
extern Err PhnLibGetLibAPIVersion (UInt16 refNum, UInt32* dwVerP)
PHN_LIB_TRAP (PhnLibTrapGetLibAPIVersion);
// We should probably return "Not supported" on this function
extern void PhnLibUninstall (UInt16 refNum)
PHN_LIB_TRAP (PhnLibTrapUninstall);
extern Err PhnLibRegister (UInt16 refNum, DWord creator, UInt16 services)
PHN_LIB_TRAP (PhnLibTrapRegister);
#endif
|
//
// MenuCell.h
// ByrdFeed
//
// Created by Eddie Freeman on 6/29/14.
// Copyright (c) 2014 NinjaSudo Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MenuCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *menuIcon;
@property (weak, nonatomic) IBOutlet UILabel *menuTitleLabel;
@end
|
//
// CHRecordHandler.h
// CHChatKit
//
// Created by Chausson on 16/9/14.
// Copyright © 2016年 Chausson. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void (^CHRecordBlock)(NSString *path,NSInteger duration);
@interface CHRecordHandler : NSObject
@property (readonly , nonatomic) CGFloat recordSecs;
@property (readonly , nonatomic) NSString *recordFile;
/** 录音文件地址 */
@property (readonly , nonatomic) NSURL *recordFileUrl;
+ (instancetype)new __unavailable;
- (instancetype)init __unavailable;
+ (instancetype)standardDefault;
/** 开始录音 */
- (void)startRecording;
/** 停止录音,返回录制的Path * */
- (NSString *)stopRecording;
/** 播放录音文件 */
- (void)playRecordWithPath:(NSString *)filePath;
- (void)playRecordWithPath:(NSString *)filePath
finsh:(CHRecordBlock )compeltion;
/** 停止播放录音文件 */
- (void)stopPlaying;
/** 销毁当前录音文件 */
- (void)destory;
/** 清除所有录音文件 */
- (void)clear;
/** 加密 */
//- (NSString *)md5:(NSString *)inPutText;
/** 根据录音路径删除文件 */
- (void)deleteWithPath:(NSString *)filePath;
@end
|
#ifndef OPCODE
#define OPCODE
#define type_client_master 777
#define type_client_manager 666
#define type_client_slave 420
#define type_server 999
#define opcode_sent 0
#define open_call 1
#define close_call 2
#define read_call 3
#define write_call 4
#define seek_call 5
#define exec_call 6
// Commands
#define command_sent 20
#define c_claim 21
#define c_release 22
#define c_list_slaves 23
#define c_masterlist 24
#define c_master_release 25
#define c_master_set_dbglvl 26
#define c_master_kill_client 99
// Debug Levels
#define dbg_none 0
#define dbg_warnings 1
#define dbg_basic 2
#define dbg_verbose 3
#include <sys/stat.h>
#include <sys/socket.h>
// MetaData for read call
typedef struct md_open{
int flags;
mode_t mode;
int str_len; // Length of the path string following the OpCode Header
}md_open;
// MetaData for close call
typedef struct md_close{
int close_fd;
}md_close;
// MetaData for close call
typedef struct md_read{
int read_fd;
void* buffer;
size_t count; // Note that size_t on one machine might not match on another. Stick to 32 bits to be safe
}md_read;
// MetaData for write call
typedef struct md_write{
int write_fd;
const void* buffer;
size_t count;
}md_write;
// MetaData for lseek call
typedef struct md_seek{
int seek_fd;
off_t offset;
int whence;
}md_seek;
// MetaData for exec call
typedef struct md_exec{
int str_len; // Length of the string following the header
}md_exec;
// General Op Code Header
typedef struct OpHeader{
int opcode;
// MetaData for each specific call
union{
md_open open_c;
md_close close_c;
md_read read_c;
md_write write_c;
md_seek seek_c;
md_exec exec_c;
};
}OpHeader;
#endif
|
#ifndef ARDUINO_H
#define ARDUINO_H
#include "ardno_constant.h"
#include "ardno_digital_io.h"
#include "ardno_error.h"
#include "ardno_interrupt.h"
#include "ardno_time.h"
#endif
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void print_bit(int bit, int count) {
fprintf(stderr, "Printing bit %d. Count = %d.\n", bit, count);
if(bit == 1)
printf("0 ");
else
printf("00 ");
for(int i = 0; i < count; i++) {
printf("0");
}
}
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
int main()
{
char MESSAGE[101];
fgets(MESSAGE, 101, stdin);
char* bits = (char*) malloc(9);
// Write an action using printf(). DON'T FORGET THE TRAILING \n
// To debug: fprintf(stderr, "Debug messages...\n");
int current_bit = 0;
int current_count = 0;
int i = 0;
while(MESSAGE[i] != '\n') {
fprintf(stderr, "MESSAGE[%d] = %c\n", i, MESSAGE[i]);
for(int j = 6; j >= 0; j--) {
int bit = MESSAGE[i] >> j & 1;
fprintf(stderr, "%d = %d\n", i, bit);
if(current_bit == bit) {
current_count++;
}
else if(current_count != 0){
print_bit(current_bit, current_count);
printf(" ");
current_bit = bit;
current_count = 1;
}
else {
current_bit = bit;
current_count = 1;
}
}
i++;
}
print_bit(current_bit, current_count);
return 0;
}
|
/*
File: CompositeSubviewBasedApplicationCell.h
Abstract: The subclass of ApplicationCell that uses a single view to draw the content.
Version: 1.5
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2011 Apple Inc. All Rights Reserved.
*/
#import <Foundation/Foundation.h>
#import "ApplicationCell.h"
@interface CompositeSubviewBasedApplicationCell : ApplicationCell
{
UIView *cellContentView;
}
@end
|
// Copyright (c) 2018 Doyub Kim
//
// I am making my contributions/submissions to this project solely in my
// personal capacity and am not conveying any rights to any intellectual
// property of any third parties.
#ifndef SRC_PYTHON_SCALAR_GRID_H_
#define SRC_PYTHON_SCALAR_GRID_H_
#include <pybind11/functional.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
void addScalarGrid2(pybind11::module& m);
void addScalarGrid3(pybind11::module& m);
#endif // SRC_PYTHON_SCALAR_GRID_H_
|
// 代码地址: https://github.com/CoderMJLee/MJRefresh
// 代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000
#import "UIScrollView+MJRefresh.h"
#import "UIScrollView+MJExtension.h"
#import "UIView+MJExtension.h"
#import "MJRefreshNormalHeader.h"
#import "MJRefreshGifHeader.h"
#import "MJRefreshBackNormalFooter.h"
#import "MJRefreshBackGifFooter.h"
#import "MJRefreshAutoNormalFooter.h"
#import "MJRefreshAutoGifFooter.h"// 版权属于原作者
// http://code4app.com (cn) http://code4app.net (en)
// 发布代码于最专业的源码分享网站: Code4App.com
|
/*
* Copyright (C) 2012 Marcelina Kościelnicka <mwk@0x04.net>
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "bios.h"
int envy_bios_parse_conn (struct envy_bios *bios) {
struct envy_bios_conn *conn = &bios->conn;
if (!conn->offset)
return 0;
int err = 0;
err |= bios_u8(bios, conn->offset, &conn->version);
err |= bios_u8(bios, conn->offset+1, &conn->hlen);
err |= bios_u8(bios, conn->offset+2, &conn->entriesnum);
err |= bios_u8(bios, conn->offset+3, &conn->rlen);
if (err)
return -EFAULT;
envy_bios_block(bios, conn->offset, conn->hlen + conn->rlen * conn->entriesnum, "CONN", -1);
int wanthlen = 5;
int wantrlen = 4;
if (conn->rlen < 4)
wantrlen = 2;
switch (conn->version) {
case 0x30:
case 0x40:
break;
default:
ENVY_BIOS_ERR("Unknown CONN table version %d.%d\n", conn->version >> 4, conn->version & 0xf);
return -EINVAL;
}
if (conn->hlen < wanthlen) {
ENVY_BIOS_ERR("CONN table header too short [%d < %d]\n", conn->hlen, wanthlen);
return -EINVAL;
}
if (conn->rlen < wantrlen) {
ENVY_BIOS_ERR("CONN table record too short [%d < %d]\n", conn->rlen, wantrlen);
return -EINVAL;
}
if (conn->hlen > wanthlen) {
ENVY_BIOS_WARN("CONN table header longer than expected [%d > %d]\n", conn->hlen, wanthlen);
}
if (conn->rlen > wantrlen) {
ENVY_BIOS_WARN("CONN table record longer than expected [%d > %d]\n", conn->rlen, wantrlen);
}
conn->entries = calloc(conn->entriesnum, sizeof *conn->entries);
if (!conn->entries)
return -ENOMEM;
int i;
for (i = 0; i < conn->entriesnum; i++) {
struct envy_bios_conn_entry *entry = &conn->entries[i];
entry->offset = conn->offset + conn->hlen + conn->rlen * i;
uint8_t bytes[4] = { 0 };
uint32_t val = 0;
int j;
static const int hpds[7] = { 12, 13, 16, 17, 24, 25, 26 };
entry->hpd = -1;
entry->dp_ext = -1;
for (j = 0; j < 4 && j < conn->rlen; j++) {
err |= bios_u8(bios, entry->offset+j, &bytes[j]);
if (err)
return -EFAULT;
val |= bytes[j] << j * 8;
}
entry->type = bytes[0];
entry->tag = bytes[1] & 0xf;
for (j = 0; j < 7; j++) {
if (val & 1 << hpds[j]) {
if (entry->hpd == -1)
entry->hpd = j;
else
ENVY_BIOS_ERR("CONN %d: duplicate HPD bits\n", i);
}
}
for (j = 0; j < 2; j++) {
if (val & 1 << (j+14)) {
if (entry->dp_ext == -1)
entry->dp_ext = j;
else
ENVY_BIOS_ERR("CONN %d: duplicate DP_AUX bits\n", i);
}
}
entry->unk02_2 = bytes[2] >> 2 & 3;
entry->unk02_4 = bytes[2] >> 4 & 7;
entry->unk02_7 = bytes[2] >> 7 & 1;
entry->unk03_3 = bytes[3] >> 3 & 0x1f;
}
conn->valid = 1;
return 0;
}
static struct enum_val conn_types[] = {
{ ENVY_BIOS_CONN_VGA, "VGA" },
{ ENVY_BIOS_CONN_COMPOSITE, "COMPOSITE" },
{ ENVY_BIOS_CONN_S_VIDEO, "S_VIDEO" },
{ ENVY_BIOS_CONN_S_VIDEO_COMPOSITE, "S_VIDEO_COMPOSITE" },
{ ENVY_BIOS_CONN_RGB, "RGB" },
{ ENVY_BIOS_CONN_DVI_I, "DVI_I" },
{ ENVY_BIOS_CONN_DVI_I_TV_S_VIDEO, "DVI_I_TV_S_VIDEO" },
{ ENVY_BIOS_CONN_DVI_D, "DVI_D" },
{ ENVY_BIOS_CONN_DMS59_0, "DMS59_0" },
{ ENVY_BIOS_CONN_DMS59_1, "DMS59_1" },
{ ENVY_BIOS_CONN_LVDS, "LVDS" },
{ ENVY_BIOS_CONN_LVDS_SPWG, "LVDS_SPWG" },
{ ENVY_BIOS_CONN_DP, "DP" },
{ ENVY_BIOS_CONN_EDP, "EDP" },
{ ENVY_BIOS_CONN_STEREO, "STEREO" },
{ ENVY_BIOS_CONN_HDMI, "HDMI" },
{ ENVY_BIOS_CONN_HDMI_C, "HDMI_C" },
{ ENVY_BIOS_CONN_DMS59_DP0, "DMS59_DP0" },
{ ENVY_BIOS_CONN_DMS59_DP1, "DMS59_DP1" },
{ ENVY_BIOS_CONN_WFD, "WFD" },
{ ENVY_BIOS_CONN_USB_C, "USB_C" },
{ ENVY_BIOS_CONN_UNUSED, "UNUSED" },
{ 0 },
};
void envy_bios_print_conn (struct envy_bios *bios, FILE *out, unsigned mask) {
struct envy_bios_conn *conn = &bios->conn;
if (!conn->offset || !(mask & ENVY_BIOS_PRINT_CONN))
return;
if (!conn->valid) {
fprintf(out, "Failed to parse CONN table at 0x%04x version %d.%d\n\n", conn->offset, conn->version >> 4, conn->version & 0xf);
return;
}
fprintf(out, "CONN table at 0x%04x version %d.%d\n", conn->offset, conn->version >> 4, conn->version & 0xf);
envy_bios_dump_hex(bios, out, conn->offset, conn->hlen, mask);
int i;
for (i = 0; i < conn->entriesnum; i++) {
struct envy_bios_conn_entry *entry = &conn->entries[i];
if (entry->type != ENVY_BIOS_CONN_UNUSED || mask & ENVY_BIOS_PRINT_UNUSED) {
const char *typename = find_enum(conn_types, entry->type);
fprintf(out, "CONN %d:", i);
fprintf(out, " type 0x%02x [%s] tag %d", entry->type, typename, entry->tag);
if (entry->hpd != -1)
fprintf(out, " HPD_%d", entry->hpd);
if (entry->dp_ext != -1)
fprintf(out, " DP_EXT_%d", entry->dp_ext);
if (entry->unk02_2)
fprintf(out, " unk02_2 0x%02x", entry->unk02_2);
if (entry->unk02_4)
fprintf(out, " unk02_4 0x%02x", entry->unk02_4);
if (entry->unk02_7)
fprintf(out, " unk02_7 0x%02x", entry->unk02_7);
if (entry->unk03_3)
fprintf(out, " unk03_3 0x%02x", entry->unk03_3);
fprintf(out, "\n");
}
envy_bios_dump_hex(bios, out, entry->offset, conn->rlen, mask);
}
fprintf(out, "\n");
}
|
//
// ViewController.h
// 13-SQLitePersistence
//
// Created by 林涛 on 16/3/2.
// Copyright © 2016年 limaofuyuanzhang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
#ifndef COMMON_H
#include "../../../common/common.h"
#endif
#include "users.h"
#define FILENAME_LEN (sizeof(TEMP_PATH)+sizeof("XXXXXX"))
short users_exited = false;
char old_users_filename[FILENAME_LEN];
char new_users_filename[FILENAME_LEN];
char added_command[sizeof(ADDED_DIFF_EXEC)+1+FILENAME_LEN+1+FILENAME_LEN+sizeof(USR_DIFF_EXEC_SUFFIX)];
char removed_command[sizeof(REMOVED_DIFF_EXEC)+1+FILENAME_LEN+1+FILENAME_LEN+sizeof(USR_DIFF_EXEC_SUFFIX)];
char buffer[MODULE_BUFFER_SIZE];
void users_update_to_fd(int target_fd);
void users_prepare_filename(char filename[FILENAME_LEN]);
void users_init() {
users_prepare_filename(old_users_filename);
int fd = -1;
if((fd = mkstemp(old_users_filename)) < 0) {
printf(ANSI_COLOR_RED);
printf("Could not open temporary file for users storage.\n");
printf("\t%s\n", strerror(errno));
printf(ANSI_COLOR_RESET);
exit(EXIT_FAILURE);
}
if(VERBOSE) {
printf(ANSI_COLOR_GREEN);
printf("users guard created temp file: '%s'.\n", old_users_filename);
printf(ANSI_COLOR_RESET);
}
users_update_to_fd(fd);
close(fd);
}
void users_prepare_filename(char filename[FILENAME_LEN]) {
strcpy(filename, TEMP_PATH);
strcat(filename, "XXXXXX");
}
void users_prepare_commands() {
strcpy(added_command, ADDED_DIFF_EXEC);
strcat(added_command, " ");
strcat(added_command, old_users_filename);
strcat(added_command, " ");
strcat(added_command, new_users_filename);
strcat(added_command, USR_DIFF_EXEC_SUFFIX);
strcpy(removed_command, REMOVED_DIFF_EXEC);
strcat(removed_command, " ");
strcat(removed_command, old_users_filename);
strcat(removed_command, " ");
strcat(removed_command, new_users_filename);
strcat(removed_command, USR_DIFF_EXEC_SUFFIX);
}
void users_update_to_fd(int target_fd) {
FILE *file = popen(USERS_EXEC, "r");
int read_bytes = 0;
while((read_bytes = fread(buffer, sizeof(char), MODULE_BUFFER_SIZE, file)) > 0) {
if(write(target_fd, buffer, read_bytes) < read_bytes) {
printf(ANSI_COLOR_RED);
printf("Could not write whole buffer to users storage.\n");
printf("\t%s\n", strerror(errno));
printf(ANSI_COLOR_RESET);
}
}
fclose(file);
}
void diff_with(char *message, char *command, int fd) {
// if(VERBOSE) {
// printf(ANSI_COLOR_GREEN);
// printf("Running: '%s'.\n", command);
// printf(ANSI_COLOR_RESET);
// }
FILE *diff;
diff = NULL;
if((diff = popen(command, "r")) == NULL) {
printf(ANSI_COLOR_RED);
printf("Could not popen diff.\n");
printf("\t%s\n", strerror(errno));
printf(ANSI_COLOR_RESET);
exit(EXIT_FAILURE);
}
int read_bytes = 0;
short printed_message = false;
while((read_bytes = fread(buffer, sizeof(char), MODULE_BUFFER_SIZE, diff)) > 0) {
if(printed_message == false) {
write(fd, message, strlen(message));
printed_message = true;
}
write(fd, buffer, read_bytes);
}
fclose(diff);
}
void users_refresh(int fd) {
int new_fd = -1;
users_prepare_filename(new_users_filename);
if((new_fd = mkstemp(new_users_filename)) < 0) {
printf(ANSI_COLOR_RED);
printf("Could not open temporary file for users update.\n");
printf("\t%s\n", strerror(errno));
printf(ANSI_COLOR_RESET);
exit(EXIT_FAILURE);
}
users_update_to_fd(new_fd);
close(new_fd);
users_prepare_commands();
diff_with(ADDED_MESSAGE, added_command, fd);
diff_with(REMOVED_MESSAGE, removed_command, fd);
unlink(old_users_filename);
strcpy(old_users_filename, new_users_filename);
}
void users_exit() {
if(users_exited == true) { return; }
if(VERBOSE) {
printf(ANSI_COLOR_CYAN);
printf("Removing old users guard file: '%s'.\n", old_users_filename);
printf(ANSI_COLOR_RESET);
}
users_exited = true;
unlink(old_users_filename);
}
|
//
// UAEC2UnassignPrivateIPAddressesRequest.h
// AWS iOS SDK
//
// Copyright © Unsigned Apps 2014. See License file.
// Created by Rob Amos.
//
#import "UAEC2Request.h"
@class UAEC2UnassignPrivateIPAddressesResponse;
typedef void(^UAEC2UnassignPrivateIPAddressesRequestCompletionBlock)(UAEC2UnassignPrivateIPAddressesResponse *response, NSError *error);
typedef BOOL(^UAEC2UnassignPrivateIPAddressesRequestShouldContinueWaitingBlock)(UAEC2UnassignPrivateIPAddressesResponse *response, NSError *error);
@interface UAEC2UnassignPrivateIPAddressesRequest : UAEC2Request
@property (nonatomic, copy) NSString *networkInterfaceID;
@property (nonatomic, strong) NSMutableArray *privateIPAddresses;
// @property (nonatomic, copy) UAEC2UnassignPrivateIPAddressesRequestCompletionBlock UA_RequestCompletionBlock;
// @property (nonatomic, copy) UAEC2UnassignPrivateIPAddressesRequestShouldContinueWaitingBlock UA_ShouldContinueWaiting;
/**
* Retrieves the NSString at the specified index.
**/
- (NSString *)privateIPAddressAtIndex:(NSUInteger)index;
/**
* Adds a PrivateIPAddress to the privateIPAddresses property.
*
* This will initialise privateIPAddresses with an empty mutable array if necessary.
**/
- (void)addPrivateIPAddress:(NSString *)privateIPAddress;
#pragma mark - Invocation
/**
* Invokes the request on the default queue.
*
* @param owner The owner of this request. Used when you need to cancel all requests for an owner.
* @param completionBlock Block to be called with two parameters upon completion of the request: the response object for the request,
* or an NSError object if something went wrong.
**/
- (void)invokeWithOwner:(id)owner completionBlock:(UAEC2UnassignPrivateIPAddressesRequestCompletionBlock)completionBlock;
/**
* Invokes the request on the default queue and keeps retrying the request until the conditions are met.
*
* @param owner The owner of this request. Used when you need to cancel all requests for an owner.
* @param shouldContinueWaitingBlock Block to be called with the results of the request (see completionBlock). This block
* should return YES if you want the request to continue waiting, NO if it should complete and call the completionBlock.
* @param completionBlock Block to be called with two parameters upon completion of the request: the response object for the request,
* or an NSError object if something went wrong.
**/
- (void)waitWithOwner:(id)owner shouldContinueWaitingBlock:(UAEC2UnassignPrivateIPAddressesRequestShouldContinueWaitingBlock)shouldContinueWaitingBlock completionBlock:(UAEC2UnassignPrivateIPAddressesRequestCompletionBlock)completionBlock;
/**
* Invokes the request on the default queue and keeps retrying the request until the conditions are met.
*
* This will find the value at the specified KeyPath and check against the supplied array. The request will stop waiting when the value is found in the array.
*
* @param owner The owner of this request. Used when you need to cancel all requests for an owner.
* @param keyPath A keyPath to execute on the results.
* @param array An array of values that, if found, would cause the request to end.
* @param completionBlock Block to be called with two parameters upon completion of the request: the response object for the request,
* or an NSError object if something went wrong.
**/
- (void)waitWithOwner:(id)owner untilValueAtKeyPath:(NSString *)keyPath isInArray:(NSArray *)array completionBlock:(UAEC2UnassignPrivateIPAddressesRequestCompletionBlock)completionBlock;
@end
|
#include "kr_param_class_table.h"
#include "krutils/kr_utils.h"
char *kr_param_table_serialize(T_KRParamTable *ptParamTable)
{
cJSON *table = cJSON_CreateObject();
cJSON_AddNumberToObject(table, "id", ptParamTable->lTableId);
cJSON_AddStringToObject(table, "name", ptParamTable->caTableName);
cJSON_AddStringToObject(table, "desc", ptParamTable->caTableDesc);
cJSON_AddStringToObject(table, "keep_mode", ptParamTable->caKeepMode);
cJSON_AddNumberToObject(table, "keep_value", ptParamTable->lKeepValue);
char *str = cJSON_Print(table);
cJSON_Delete(table);
return str;
}
void kr_param_table_serialize_free(char *ptParamTableString)
{
if (ptParamTableString) {
kr_free(ptParamTableString);
}
}
T_KRParamTable *kr_param_table_deserialize(char *ptParamTableString)
{
T_KRParamTable *ptParamTable = kr_calloc(sizeof(*ptParamTable));
cJSON *table=cJSON_Parse(ptParamTableString);
ptParamTable->lTableId = cJSON_GetNumber(table, "id");
strcpy(ptParamTable->caTableName, cJSON_GetString(table, "name"));
strcpy(ptParamTable->caTableDesc, cJSON_GetString(table, "desc"));
strcpy(ptParamTable->caKeepMode, cJSON_GetString(table, "keep_mode"));
ptParamTable->lKeepValue = cJSON_GetNumber(table, "keep_value");
return ptParamTable;
}
void kr_param_table_deserialize_free(T_KRParamTable *ptParamTable)
{
if (ptParamTable) {
kr_free(ptParamTable);
}
}
|
//
// OptionsViewController.h
// FriendlyPic
//
// Created by Carmelo I. Uria on 8/29/12.
// Copyright (c) 2012 Carmelo Uria Corporation. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
void displayErrorOnMainQueue(NSError *error, NSString *message);
@interface OptionsViewController : UIViewController <SKProductsRequestDelegate, SKPaymentTransactionObserver>
@property (weak, nonatomic) IBOutlet UIButton *blueButton;
@property (weak, nonatomic) IBOutlet UIButton *yellowButton;
@property (weak, nonatomic) IBOutlet UIButton *facebookButton;
@property (weak, nonatomic) IBOutlet UIButton *greenButton;
@property (weak, nonatomic) IBOutlet UIButton *redButton;
@property (weak, nonatomic) IBOutlet UIButton *twitterButton;
- (IBAction) blueLineSelected:(id) sender;
- (IBAction) greenLineSelected:(id) sender;
- (IBAction) yellowLineSelected:(id) sender;
- (IBAction) redLineSelected:(id) sender;
- (IBAction) facebookSelected:(id) sender;
- (IBAction) twitterSelected:(id) sender;
- (IBAction) saveAction:(id) sender;
- (IBAction) purchaseAction:(id) sender;
- (IBAction) mailAction:(id)sender;
@end
|
#include <math.h>
#define END_VALUE 600
int main ()
{
int Counter=0 ;
double X;
double Y;
double Angle ;
FILE *Output;
/* open output file */
if ((Output = fopen("flyby.path", "w")) == NULL)
{
fprintf(stderr, "Cannot open file\n");
}
while (Counter <END_VALUE)
{
X=0 ;
Y=(Counter*0.4) ;
Angle=0 ;
fprintf(Output, "position = %f,%f,%f\n",X,Y,Angle);
Counter++ ;
}
fclose (Output) ;
}
|
//
// NSPredicate+OSReflectionKit.h
// OSReflectionKit+CoreData
//
// Created by Alexandre on 03/02/14.
// Copyright (c) 2014 iAOS Software. All rights reserved.
//
/*
Copyright (c) 2013 iAOS Software. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
If you happen to meet one of the copyright holders in a bar you are obligated
to buy them one pint of beer.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#import <Foundation/Foundation.h>
@interface NSPredicate (OSReflectionKit)
/**
Creates a predicate with the attributes in the dictionary.
@param attributes The given attributes dictionary.
@return The created predicate.
*/
+ (instancetype) predicateWithAttributes:(NSDictionary *) attributes;
/**
Creates a predicate with the unique attributes for the class in the dictionary.
@param klazz The class to find unique attributes.
@param dictionary The given attributes dictionary.
@return The created predicate.
*/
+ (instancetype) predicateForUniqueness:(Class) klazz withDictionary:(NSDictionary *) dictionary;
@end
|
#pragma once
#include <string>
/**
* \brief Checks for gl errors and writes error description to string.
*/
bool hasGLError(std::string& errorText);
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "saferead.h"
int main(int argc, char *argv[]){
FILE *f;
char c;
char * buf;
int x=0;
if(argc<2)
f = stdin;
else{
f = fopen(argv[1], "r");
if(f==NULL){
fprintf(stderr, "Could not read %s\n", argv[1]);
exit(EXIT_FAILURE);
}
}
buf = saferead(f);
if(argc<3)
f = stdout;
else f = fopen(argv[2], "w");
while((c=buf[x])!=0){
if(!(c=='\n'||c==' '||c=='\t'))
fputc((int)c, f);
x++;
}
fclose(f);
free(buf);
return 0;
}
|
//
// YQZCycleScrollView.h
//
// Created by mahailin on 13-7-19.
// Copyright (c) 2013年 mahailin. All rights reserved.
//
#import <UIKit/UIKit.h>
@class YQZCycleScrollView;
/*!
@brief CycleScrollView的回调协议
*/
@protocol YQZCycleScrollViewDelegate <NSObject>
@optional
/*!
@brief 点击某张图片的回调方法
@param cycleScrollView CycleScrollView类的实例
@param index 所点图片的下标
@return void
*/
- (void)cycleScrollViewDidClick:(YQZCycleScrollView *)cycleScrollView withIndex:(int)index;
@end
/*!
@brief 可以循环滚动图片的scrollView
*/
@interface YQZCycleScrollView : UIView
/*!
@brief delegate
*/
@property (nonatomic, assign) id<YQZCycleScrollViewDelegate> cycleScrollViewDelegate;
/*!
@brief 类的实例化方法
@param frame 视图的frame
@param imageArray 图片URL地址数组
@return 返回该类的实例
*/
- (id)initWithFrame:(CGRect)frame withImageArray:(NSMutableArray *)imageArray;
/*!
@brief 刷新界面
@param imageArray 图片URL地址数组
@return void
*/
- (void)reloadCycleScrollView:(NSMutableArray *)imageArray;
/*!
@brief 初始化定时器
*/
- (void)startTimer;
/*!
@brief 停止定时器
*/
- (void)stopTimer;
@end
|
#pragma once
namespace graphic
{
class cSkinnedMesh : public cMesh
{
public:
cSkinnedMesh(const int id, vector<Matrix44> *palette, const sRawMesh &raw);
virtual ~cSkinnedMesh();
virtual void Render(const Matrix44 &parentTm) override;
void SetPalette(vector<Matrix44> *palette);
protected:
virtual void RenderShader( cShader &shader, const Matrix44 &parentTm );
virtual void RenderShadow(cShader &shader, const Matrix44 &parentTm);
void ApplyPalette();
void ApplyPaletteShader(cShader &shader);
private:
const sRawMesh &m_rawMesh;
vector<Matrix44> *m_palette; // reference
cMeshBuffer *m_skinnMeshBuffer;
};
inline void cSkinnedMesh::SetPalette(vector<Matrix44> *palette) { m_palette = palette; }
}
|
#pragma once
#include "Game.h"
#include "GameComponent.h"
#include "FountainEffect.h"
#define NUM_FOUNTAINS 20
#define FOUNTAIN_RADIUS 40.0f
#define FOUNTAIN_HEIGHT 10.0f
using namespace std;
namespace BGE
{
class Lab4 :
public Game
{
public:
Lab4(void);
shared_ptr<GameComponent> ship1;
shared_ptr<GameComponent> ship2;
float elapsed;
bool Initialise();
void Update(float timeDelta);
vector<shared_ptr<FountainEffect>> fountains;
float fountainTheta;
};
}
|
/*
* This file is part of the gk project (https://github.com/recp/gk)
* Copyright (c) Recep Aslantas.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "../common.h"
#include "../../include/gk/prims/cube.h"
#include "../default/def_prog.h"
#include <limits.h>
GLfloat gk__verts_cube[] = {
-0.5f, -0.5f, -0.5f,
0.5f, -0.5f, -0.5f,
0.5f, 0.5f, -0.5f,
-0.5f, 0.5f, -0.5f,
-0.5f, -0.5f, 0.5f,
0.5f, -0.5f, 0.5f,
0.5f, 0.5f, 0.5f,
-0.5f, 0.5f, 0.5f,
};
GLushort gk__verts_cube_ind[] = {
0, 1, 2, 3,
4, 5, 6, 7,
0, 4, 1, 5,
2, 6, 3, 7
};
GLuint gk__cube_vao = UINT_MAX;
GLuint gk__cube_vbo[2];
void
gkInitCube() {
uint32_t vPOSITION;
vPOSITION = 0;
glGenVertexArrays(1, &gk__cube_vao);
glGenBuffers(2, gk__cube_vbo);
glBindVertexArray(gk__cube_vao);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1, 0);
glBindBuffer(GL_ARRAY_BUFFER, gk__cube_vbo[0]);
glEnableVertexAttribArray(vPOSITION);
glVertexAttribPointer(vPOSITION, 3, GL_FLOAT, GL_FALSE, 0, NULL);
glBufferData(GL_ARRAY_BUFFER,
sizeof(gk__verts_cube),
gk__verts_cube,
GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, gk__cube_vbo[1]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,
sizeof(gk__verts_cube_ind),
gk__verts_cube_ind,
GL_STATIC_DRAW);
}
void
gkDrawBBox(GkScene * __restrict scene,
GkBBox bbox,
mat4 world) {
GkPipeline *prog;
vec3 size, center;
mat4 tran = GLM_MAT4_IDENTITY_INIT;
GLuint currentProg;
prog = gk_prog_cube();
currentProg = gkCurrentProgram();
glUseProgram(prog->progId);
if (gk__cube_vao == UINT_MAX)
gkInitCube();
else
glBindVertexArray(gk__cube_vao);
glm_vec3_sub(bbox[1], bbox[0], size);
glm_vec3_center(bbox[1], bbox[0], center);
glm_translate(tran, center);
glm_scale(tran, size);
/* glm_mat4_mul(world, tran, tran); */
glm_mat4_mul(scene->camera->viewProj, tran, tran);
gkUniformMat4(prog->mvpi, tran);
glDrawElements(GL_LINE_LOOP,
4,
GL_UNSIGNED_SHORT,
NULL);
glDrawElements(GL_LINE_LOOP,
4,
GL_UNSIGNED_SHORT,
(GLvoid *)(4 * sizeof(GLushort)));
glDrawElements(GL_LINES,
8,
GL_UNSIGNED_SHORT,
(GLvoid *)(8 * sizeof(GLushort)));
glUseProgram(currentProg);
}
void
gkReleaseCube() {
if (gk__cube_vao == UINT_MAX)
return;
glDeleteBuffers(2, gk__cube_vbo);
glDeleteVertexArrays(1, &gk__cube_vao);
gk__cube_vao = UINT_MAX;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.