text stringlengths 4 6.14k |
|---|
#ifndef _MAVLINK_CONVERSIONS_H_
#define _MAVLINK_CONVERSIONS_H_
/* enable math defines on Windows */
#ifdef _MSC_VER
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#endif
#include <math.h>
/**
* @file mavlink_conversions.h
*
* These conversion functions follow the NASA rotation standards definition file
* available online.
*
* Their intent is to lower the barrier for MAVLink adopters to use gimbal-lock free
* (both rotation matrices, sometimes called DCM, and quaternions are gimbal-lock free)
* rotation representations. Euler angles (roll, pitch, yaw) will be phased out of the
* protocol as widely as possible.
*
* @author James Goppert
*/
MAVLINK_HELPER void mavlink_quaternion_to_dcm(const float quaternion[4], float dcm[3][3])
{
double a = quaternion[0];
double b = quaternion[1];
double c = quaternion[2];
double d = quaternion[3];
double aSq = a * a;
double bSq = b * b;
double cSq = c * c;
double dSq = d * d;
dcm[0][0] = aSq + bSq - cSq - dSq;
dcm[0][1] = 2.0 * (b * c - a * d);
dcm[0][2] = 2.0 * (a * c + b * d);
dcm[1][0] = 2.0 * (b * c + a * d);
dcm[1][1] = aSq - bSq + cSq - dSq;
dcm[1][2] = 2.0 * (c * d - a * b);
dcm[2][0] = 2.0 * (b * d - a * c);
dcm[2][1] = 2.0 * (a * b + c * d);
dcm[2][2] = aSq - bSq - cSq + dSq;
}
MAVLINK_HELPER void mavlink_dcm_to_euler(const float dcm[3][3], float* roll, float* pitch, float* yaw)
{
float phi, theta, psi;
theta = asin(-dcm[2][0]);
if (fabs(theta - M_PI_2) < 1.0e-3f) {
phi = 0.0f;
psi = (atan2(dcm[1][2] - dcm[0][1],
dcm[0][2] + dcm[1][1]) + phi);
} else if (fabs(theta + M_PI_2) < 1.0e-3f) {
phi = 0.0f;
psi = atan2f(dcm[1][2] - dcm[0][1],
dcm[0][2] + dcm[1][1] - phi);
} else {
phi = atan2f(dcm[2][1], dcm[2][2]);
psi = atan2f(dcm[1][0], dcm[0][0]);
}
*roll = phi;
*pitch = theta;
*yaw = psi;
}
MAVLINK_HELPER void mavlink_quaternion_to_euler(const float quaternion[4], float* roll, float* pitch, float* yaw)
{
float dcm[3][3];
mavlink_quaternion_to_dcm(quaternion, dcm);
mavlink_dcm_to_euler(dcm, roll, pitch, yaw);
}
MAVLINK_HELPER void mavlink_euler_to_quaternion(float roll, float pitch, float yaw, float quaternion[4])
{
double cosPhi_2 = cos((double)roll / 2.0);
double sinPhi_2 = sin((double)roll / 2.0);
double cosTheta_2 = cos((double)pitch / 2.0);
double sinTheta_2 = sin((double)pitch / 2.0);
double cosPsi_2 = cos((double)yaw / 2.0);
double sinPsi_2 = sin((double)yaw / 2.0);
quaternion[0] = (cosPhi_2 * cosTheta_2 * cosPsi_2 +
sinPhi_2 * sinTheta_2 * sinPsi_2);
quaternion[1] = (sinPhi_2 * cosTheta_2 * cosPsi_2 -
cosPhi_2 * sinTheta_2 * sinPsi_2);
quaternion[2] = (cosPhi_2 * sinTheta_2 * cosPsi_2 +
sinPhi_2 * cosTheta_2 * sinPsi_2);
quaternion[3] = (cosPhi_2 * cosTheta_2 * sinPsi_2 -
sinPhi_2 * sinTheta_2 * cosPsi_2);
}
MAVLINK_HELPER void mavlink_dcm_to_quaternion(const float dcm[3][3], float quaternion[4])
{
quaternion[0] = (0.5 * sqrt(1.0 +
(double)(dcm[0][0] + dcm[1][1] + dcm[2][2])));
quaternion[1] = (0.5 * sqrt(1.0 +
(double)(dcm[0][0] - dcm[1][1] - dcm[2][2])));
quaternion[2] = (0.5 * sqrt(1.0 +
(double)(-dcm[0][0] + dcm[1][1] - dcm[2][2])));
quaternion[3] = (0.5 * sqrt(1.0 +
(double)(-dcm[0][0] - dcm[1][1] + dcm[2][2])));
}
MAVLINK_HELPER void mavlink_euler_to_dcm(float roll, float pitch, float yaw, float dcm[3][3])
{
double cosPhi = cos(roll);
double sinPhi = sin(roll);
double cosThe = cos(pitch);
double sinThe = sin(pitch);
double cosPsi = cos(yaw);
double sinPsi = sin(yaw);
dcm[0][0] = cosThe * cosPsi;
dcm[0][1] = -cosPhi * sinPsi + sinPhi * sinThe * cosPsi;
dcm[0][2] = sinPhi * sinPsi + cosPhi * sinThe * cosPsi;
dcm[1][0] = cosThe * sinPsi;
dcm[1][1] = cosPhi * cosPsi + sinPhi * sinThe * sinPsi;
dcm[1][2] = -sinPhi * cosPsi + cosPhi * sinThe * sinPsi;
dcm[2][0] = -sinThe;
dcm[2][1] = sinPhi * cosThe;
dcm[2][2] = cosPhi * cosThe;
}
#endif |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_
#define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/views/message_center/web_notification_tray.h"
#include "ui/base/animation/animation_delegate.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_tray.h"
#include "ui/message_center/message_center_tray_delegate.h"
#include "ui/message_center/views/message_center_view.h"
#include "ui/views/widget/widget_delegate.h"
#include "ui/views/widget/widget_observer.h"
namespace ui {
class SlideAnimation;
class AnimationDelegate;
}
namespace message_center {
enum Alignment {
ALIGNMENT_TOP = 1 << 0,
ALIGNMENT_LEFT = 1 << 1,
ALIGNMENT_BOTTOM = 1 << 2,
ALIGNMENT_RIGHT = 1 << 3,
ALIGNMENT_NONE = 1 << 4,
};
struct PositionInfo {
int max_height;
// Alignment of the message center relative to the center of the screen.
Alignment message_center_alignment;
// Alignment of the taskbar relative to the center of the screen.
Alignment taskbar_alignment;
// Point relative to which message center is positioned.
gfx::Point inital_anchor_point;
};
class WebNotificationTray;
class MessageCenterFrameView;
// MessageCenterWidgetDelegate is the message center's client view. It also
// creates the message center widget and sets the notifications.
//
////////////////////////////////////////////////////////////////////////////////
class MessageCenterWidgetDelegate : public views::WidgetDelegate,
public message_center::MessageCenterView,
public views::WidgetObserver {
public:
MessageCenterWidgetDelegate(WebNotificationTray* tray,
MessageCenterTray* mc_tray,
bool initially_settings_visible,
const PositionInfo& pos_info);
virtual ~MessageCenterWidgetDelegate();
// WidgetDelegate overrides:
virtual View* GetContentsView() OVERRIDE;
virtual views::NonClientFrameView* CreateNonClientFrameView(
views::Widget* widget) OVERRIDE;
virtual void DeleteDelegate() OVERRIDE;
virtual views::Widget* GetWidget() OVERRIDE;
virtual const views::Widget* GetWidget() const OVERRIDE;
// WidgetObserver overrides:
virtual void OnWidgetActivationChanged(views::Widget* widget,
bool active) OVERRIDE;
virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
// View overrides:
virtual void PreferredSizeChanged() OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual gfx::Size GetMaximumSize() OVERRIDE;
virtual int GetHeightForWidth(int width) OVERRIDE;
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
private:
// Creates and initializes the message center widget.
void InitWidget();
// Shifts the message center anchor point such that the mouse click point is
// along the middle 60% of the width of the message center if taskbar is
// horizontal aligned. If vertically aligned, ensures that mouse click point
// is along the height of the message center (at least at a corner).
gfx::Point GetCorrectedAnchor(gfx::Size calculated_size);
// Calculates the message center bounds using the position info and the
// corrected anchor.
gfx::Rect GetMessageCenterBounds();
// Insets of the message center border (set in MessageCenterFrameView).
gfx::Insets border_insets_;
// Info necessary to calculate the estimated position of the message center.
PositionInfo pos_info_;
WebNotificationTray* tray_;
};
} // namespace message_center
#endif // CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_MESSAGE_CENTER_WIDGET_DELEGATE_H_
|
/* Bounded-pointer syscall thunk support.
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Greg McGary <greg@mcgary.org>
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _bpthunks_h_
#define _bpthunks_h_
#ifndef __ASSEMBLER__
/* This header is included by the syscall BP thunks defined in
sysd-syscalls, as created by sysdeps/unix/make-syscalls.sh. It
includes all headers that contain prototype declarations for system
call functions. */
#include <libc-symbols.h>
#include <bp-sym.h>
#include <bp-checks.h>
/* Get `struct timeval' definition for select. */
#define __need_timeval
#include <bits/time.h>
#include <stddef.h>
#include <unistd.h>
#include <sched.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
#include <utime.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/klog.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/quota.h>
#include <sys/resource.h>
#include <sys/select.h>
#include <io/sys/sendfile.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#include <sys/swap.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/times.h>
#include <sys/timex.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#endif /* Not __ASSEMBLER__. */
#endif /* _bpthunks_h_ */
|
/*
* gpufreq_performance.c
*
* Author: Watson Wang <zswang@marvell.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. *
*/
#include "gpufreq.h"
#if MRVL_CONFIG_ENABLE_GPUFREQ
static int gpufreq_governor_performance(struct gpufreq_policy *policy,
unsigned int event);
static int gpufreq_gov_performance_init(void);
static void gpufreq_gov_performance_exit(void);
struct gpufreq_governor gpufreq_gov_performance = {
.name = "performance",
.init = gpufreq_gov_performance_init,
.exit = gpufreq_gov_performance_exit,
.governor = gpufreq_governor_performance,
.refs = 0,
// .owner = THIS_MODULE,
};
static int gpufreq_governor_performance(struct gpufreq_policy *policy,
unsigned int event)
{
switch (event) {
case GPUFREQ_GOV_EVENT_START:
case GPUFREQ_GOV_EVENT_LIMITS:
debug_log(GPUFREQ_LOG_DEBUG, "performance: freq %u, event %d", policy->max, event);
__gpufreq_driver_target(policy, policy->max, GPUFREQ_RELATION_H);
break;
default:
/* do nothing, no need to stop */
break;
}
return 0;
}
static int gpufreq_gov_performance_init(void)
{
return gpufreq_register_governor(&gpufreq_gov_performance);
}
static void gpufreq_gov_performance_exit(void)
{
gpufreq_unregister_governor(&gpufreq_gov_performance);
}
#endif /* End of MRVL_CONFIG_ENABLE_GPUFREQ */
|
/* { dg-do run } */
/* We do not want to treat int[3] as an object that cannot overlap
itself but treat it as arbitrary sub-array of a larger array object. */
int ar1(int (*p)[3], int (*q)[3])
{
(*p)[0] = 1;
(*q)[1] = 2;
return (*p)[0];
}
int main()
{
int a[4];
if (ar1 ((int (*)[3])&a[1], (int (*)[3])&a[0]) != 2)
__builtin_abort ();
return 0;
}
|
// license:BSD-3-Clause
// copyright-holders:Aaron Giles
/***************************************************************************
ppcfe.h
Front-end for PowerPC recompiler
***************************************************************************/
#ifndef MAME_CPU_POWERPC_PPCFE_H
#define MAME_CPU_POWERPC_PPCFE_H
#pragma once
#include "ppc.h"
#include "cpu/drcfe.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class ppc_device::frontend : public drc_frontend
{
public:
// register flags 0
static constexpr u32 REGFLAG_R(unsigned n) { return 1U << n; }
static constexpr u32 REGFLAG_RZ(unsigned n) { return !n ? 0U : REGFLAG_R(n); }
// register flags 1
static constexpr u32 REGFLAG_FR(unsigned n) { return 1U << n; }
// register flags 2
static constexpr u32 REGFLAG_CR(unsigned n) { return 0xf0000000U >> (4 * n); }
static constexpr u32 REGFLAG_CR_BIT(unsigned n) { return 0x80000000U >> n; }
// register flags 3
static constexpr u32 REGFLAG_XER_CA = 1U << 0;
static constexpr u32 REGFLAG_XER_OV = 1U << 1;
static constexpr u32 REGFLAG_XER_SO = 1U << 2;
static constexpr u32 REGFLAG_XER_COUNT = 1U << 3;
static constexpr u32 REGFLAG_CTR = 1U << 4;
static constexpr u32 REGFLAG_LR = 1U << 5;
static constexpr u32 REGFLAG_FPSCR(unsigned n) { return 1U << (6 + n); }
// construction/destruction
frontend(ppc_device &ppc, uint32_t window_start, uint32_t window_end, uint32_t max_sequence);
protected:
// required overrides
virtual bool describe(opcode_desc &desc, const opcode_desc *prev) override;
private:
// inlines
uint32_t compute_spr(uint32_t spr) const { return ((spr >> 5) | (spr << 5)) & 0x3ff; }
bool is_403_class() const { return (m_ppc.m_flavor == ppc_device::PPC_MODEL_403GA || m_ppc.m_flavor == ppc_device::PPC_MODEL_403GB || m_ppc.m_flavor == ppc_device::PPC_MODEL_403GC || m_ppc.m_flavor == ppc_device::PPC_MODEL_403GCX || m_ppc.m_flavor == ppc_device::PPC_MODEL_405GP); }
bool is_601_class() const { return (m_ppc.m_flavor == ppc_device::PPC_MODEL_601); }
bool is_602_class() const { return (m_ppc.m_flavor == ppc_device::PPC_MODEL_602); }
bool is_603_class() const { return (m_ppc.m_flavor == ppc_device::PPC_MODEL_603 || m_ppc.m_flavor == ppc_device::PPC_MODEL_603E || m_ppc.m_flavor == ppc_device::PPC_MODEL_603EV || m_ppc.m_flavor == ppc_device::PPC_MODEL_603R); }
// internal helpers
bool describe_13(uint32_t op, opcode_desc &desc, const opcode_desc *prev);
bool describe_1f(uint32_t op, opcode_desc &desc, const opcode_desc *prev);
bool describe_3b(uint32_t op, opcode_desc &desc, const opcode_desc *prev);
bool describe_3f(uint32_t op, opcode_desc &desc, const opcode_desc *prev);
// internal state
ppc_device &m_ppc;
};
#endif // MAME_CPU_POWERPC_PPCFE_H
|
/* Functional tests for the function hotpatching feature. */
/* { dg-do compile } */
/* { dg-options "-O3 -mzarch -mhotpatch=-1,0" } */
/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 0 } */
|
/*
* This file is part of MultiROM.
*
* MultiROM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MultiROM 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 MultiROM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROGRESSDOTS_H
#define PROGRESSDOTS_H
#include "framebuffer.h"
#define PROGDOTS_W (400*DPI_MUL)
#define PROGDOTS_H (10*DPI_MUL)
#define PROGDOTS_CNT 8
typedef struct
{
FB_ITEM_POS
fb_rect *rect;
} progdots;
progdots *progdots_create(int x, int y);
void progdots_destroy(progdots *p);
#endif
|
/*
*
* cblas_strmm.c
* This program is a C interface to strmm.
* Written by Keita Teranishi
* 4/6/1998
*
*/
#include "cblas.h"
#include "cblas_f77.h"
void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
const enum CBLAS_DIAG Diag, const int M, const int N,
const float alpha, const float *A, const int lda,
float *B, const int ldb)
{
char UL, TA, SD, DI;
#ifdef F77_CHAR
F77_CHAR F77_TA, F77_UL, F77_SD, F77_DI;
#else
#define F77_TA &TA
#define F77_UL &UL
#define F77_SD &SD
#define F77_DI &DI
#endif
#ifdef F77_INT
F77_INT F77_M=M, F77_N=N, F77_lda=lda, F77_ldb=ldb;
#else
#define F77_M M
#define F77_N N
#define F77_lda lda
#define F77_ldb ldb
#endif
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;
CBLAS_CallFromC = 1;
if( Order == CblasColMajor )
{
if( Side == CblasRight) SD='R';
else if ( Side == CblasLeft ) SD='L';
else
{
cblas_xerbla(2, "cblas_strmm","Illegal Side setting, %d\n", Side);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( Uplo == CblasUpper) UL='U';
else if ( Uplo == CblasLower ) UL='L';
else
{
cblas_xerbla(3, "cblas_strmm","Illegal Uplo setting, %d\n", Uplo);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( TransA == CblasTrans) TA ='T';
else if ( TransA == CblasConjTrans ) TA='C';
else if ( TransA == CblasNoTrans ) TA='N';
else
{
cblas_xerbla(4, "cblas_strmm","Illegal Trans setting, %d\n", TransA);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( Diag == CblasUnit ) DI='U';
else if ( Diag == CblasNonUnit ) DI='N';
else
{
cblas_xerbla(5, "cblas_strmm", "Illegal Diag setting, %d\n", Diag);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
#ifdef F77_CHAR
F77_UL = C2F_CHAR(&UL);
F77_TA = C2F_CHAR(&TA);
F77_SD = C2F_CHAR(&SD);
F77_DI = C2F_CHAR(&DI);
#endif
F77_strmm(F77_SD, F77_UL, F77_TA, F77_DI, &F77_M, &F77_N, &alpha, A, &F77_lda, B, &F77_ldb);
} else if (Order == CblasRowMajor)
{
RowMajorStrg = 1;
if( Side == CblasRight) SD='L';
else if ( Side == CblasLeft ) SD='R';
else
{
cblas_xerbla(2, "cblas_strmm","Illegal Side setting, %d\n", Side);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( Uplo == CblasUpper) UL='L';
else if ( Uplo == CblasLower ) UL='U';
else
{
cblas_xerbla(3, "cblas_strmm", "Illegal Uplo setting, %d\n", Uplo);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( TransA == CblasTrans) TA ='T';
else if ( TransA == CblasConjTrans ) TA='C';
else if ( TransA == CblasNoTrans ) TA='N';
else
{
cblas_xerbla(4, "cblas_strmm", "Illegal Trans setting, %d\n", TransA);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
if( Diag == CblasUnit ) DI='U';
else if ( Diag == CblasNonUnit ) DI='N';
else
{
cblas_xerbla(5, "cblas_strmm","Illegal Diag setting, %d\n", Diag);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
#ifdef F77_CHAR
F77_UL = C2F_CHAR(&UL);
F77_TA = C2F_CHAR(&TA);
F77_SD = C2F_CHAR(&SD);
F77_DI = C2F_CHAR(&DI);
#endif
F77_strmm(F77_SD, F77_UL, F77_TA, F77_DI, &F77_N, &F77_M, &alpha, A,
&F77_lda, B, &F77_ldb);
}
else cblas_xerbla(1, "cblas_strmm", "Illegal Order setting, %d\n", Order);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return;
}
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* ADXL345 3-Axis Digital Accelerometer I2C driver
*
* Copyright (c) 2017 Eva Rachel Retuya <eraretuya@gmail.com>
*
* 7-bit I2C slave address: 0x1D (ALT ADDRESS pin tied to VDDIO) or
* 0x53 (ALT ADDRESS pin grounded)
*/
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include "adxl345.h"
static const struct regmap_config adxl345_i2c_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int adxl345_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct regmap *regmap;
if (!id)
return -ENODEV;
regmap = devm_regmap_init_i2c(client, &adxl345_i2c_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&client->dev, "Error initializing i2c regmap: %ld\n",
PTR_ERR(regmap));
return PTR_ERR(regmap);
}
return adxl345_core_probe(&client->dev, regmap, id->driver_data,
id->name);
}
static const struct i2c_device_id adxl345_i2c_id[] = {
{ "adxl345", ADXL345 },
{ "adxl375", ADXL375 },
{ }
};
MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
static const struct of_device_id adxl345_of_match[] = {
{ .compatible = "adi,adxl345" },
{ .compatible = "adi,adxl375" },
{ },
};
MODULE_DEVICE_TABLE(of, adxl345_of_match);
static struct i2c_driver adxl345_i2c_driver = {
.driver = {
.name = "adxl345_i2c",
.of_match_table = adxl345_of_match,
},
.probe = adxl345_i2c_probe,
.id_table = adxl345_i2c_id,
};
module_i2c_driver(adxl345_i2c_driver);
MODULE_AUTHOR("Eva Rachel Retuya <eraretuya@gmail.com>");
MODULE_DESCRIPTION("ADXL345 3-Axis Digital Accelerometer I2C driver");
MODULE_LICENSE("GPL v2");
|
#import "CPTAxisLabel.h"
#import <Foundation/Foundation.h>
@interface CPTAxisTitle : CPTAxisLabel {
}
@end
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2008 Christian Igel, Tobias Glasmachers
* Copyright (C) 2008 Christian Igel, Tobias Glasmachers
*
* Shogun adjustments (W) 2008-2009,2013 Soeren Sonnenburg
* Copyright (C) 2008-2009 Fraunhofer Institute FIRST and Max-Planck-Society
* Copyright (C) 2013 Soeren Sonnenburg
*/
#ifndef _OLIGOSTRINGKERNEL_H_
#define _OLIGOSTRINGKERNEL_H_
#include <shogun/lib/config.h>
#include <shogun/kernel/string/StringKernel.h>
#include <vector>
#include <string>
namespace shogun
{
/**
* @brief This class offers access to the Oligo Kernel introduced
* by Meinicke et al. in 2004
*
* The class has functions to preprocess the data such that the kernel
* computation can be pursued faster. The kernel function is then
* kernelOligoFast or kernelOligo.
*
* Requires significant speedup, should be working but as is might be
* applicable only to academic small scale problems:
*
* - the kernel should only ever see encoded sequences, which however
* requires another OligoFeatures object (using CDenseFeatures of pairs)
*
* Uses CSqrtDiagKernelNormalizer, as the vanilla kernel seems to be very
* diagonally dominant.
*
*/
class COligoStringKernel : public CStringKernel<char>
{
public:
/** default constructor */
COligoStringKernel();
/** Constructor
* @param cache_size cache size for kernel
* @param k k-mer length
* @param width - equivalent to 2*sigma^2
*/
COligoStringKernel(int32_t cache_size, int32_t k, float64_t width);
/** Constructor
* @param l features of left-hand side
* @param r features of right-hand side
* @param k k-mer length
* @param width - equivalent to 2*sigma^2
*/
COligoStringKernel(
CStringFeatures<char>* l, CStringFeatures<char>* r,
int32_t k, float64_t width);
/** Destructor */
virtual ~COligoStringKernel();
/** initialize kernel
*
* @param l features of left-hand side
* @param r features of right-hand side
* @return if initializing was successful
*/
virtual bool init(CFeatures* l, CFeatures* r);
/** return what type of kernel we are
*
* @return kernel type OLIGO
*/
virtual EKernelType get_kernel_type() { return K_OLIGO; }
/** return the kernel's name
*
* @return name Oligo
*/
virtual const char* get_name() const { return "OligoStringKernel"; }
virtual float64_t compute(int32_t x, int32_t y);
/** clean up your kernel
*/
virtual void cleanup();
protected:
/**
* @brief encodes the signals of the sequence
*
* This function stores the oligo function signals in 'values'.
*
* The 'k_mer_length' and the 'allowed_characters' determine,
* which signals are used. Every pair contains the position of the
* signal and a numerical value reflecting the signal. The
* numerical value represents the k_mer to a base
* n = |allowed_characters|.
* Example: The value of k_mer CG for the allowed characters ACGT
* would be 1 * n^1 + 2 * n^0 = 6.
*/
static void encodeOligo(
const std::string& sequence, uint32_t k_mer_length,
const std::string& allowed_characters,
std::vector< std::pair<int32_t, float64_t> >& values);
/**
@brief encodes all sequences with the encodeOligo function and stores
them in 'encoded_sequences'
This function encodes the sequences of 'sequences' via the
function encodeOligo.
*/
static void getSequences(
const std::vector<std::string>& sequences,
uint32_t k_mer_length, const std::string& allowed_characters,
std::vector< std::vector< std::pair<int32_t, float64_t> > >& encoded_sequences);
/**
@brief returns the value of the oligo kernel for sequences 'x' and 'y'
This function computes the kernel value of the oligo kernel,
which was introduced by Meinicke et al. in 2004. 'x' and
'y' are encoded by encodeOligo and 'exp_cache' has to be
constructed by getExpFunctionCache.
'max_distance' can be used to speed up the computation
even further by restricting the maximum distance between a k_mer at
position i in sequence 'x' and a k_mer at position j
in sequence 'y'. If i - j > 'max_distance' the value is not
added to the kernel value. This approximation is switched
off by default (max_distance < 0).
*/
float64_t kernelOligoFast(
const std::vector< std::pair<int32_t, float64_t> >& x,
const std::vector< std::pair<int32_t, float64_t> >& y,
int32_t max_distance = -1);
/**
@brief returns the value of the oligo kernel for sequences 'x' and 'y'
This function computes the kernel value of the oligo kernel,
which was introduced by Meinicke et al. in 2004. 'x' and
'y' have to be encoded by encodeOligo.
*/
float64_t kernelOligo(
const std::vector< std::pair<int32_t, float64_t> >& x,
const std::vector< std::pair<int32_t, float64_t> >& y);
private:
/**
@brief prepares the exp function cache of the oligo kernel
The oligo kernel was introduced for sequences of fixed length.
Let n be the sequence length of sequences x and y. There can
only be n different distances between signals in sequence x
and sequence y (0, 1, ..., n-1). Therefore, we precompute
the corresponding values of the e-function. These values
can then be used in kernelOligoFast.
*/
void getExpFunctionCache(uint32_t sequence_length);
static inline bool cmpOligos_(std::pair<int32_t, float64_t> a,
std::pair<int32_t, float64_t> b )
{
return (a.second < b.second);
}
void init();
protected:
/** k-mer length */
int32_t k;
/** width of kernel */
float64_t width;
/** gauss table cache for exp (see getExpFunctionCache above) */
SGVector<float64_t> gauss_table;
};
}
#endif // _OLIGOSTRINGKERNEL_H_
|
/*
Copyright (c) 2003-2006 by Juliusz Chroboczek
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.
*/
extern int serverExpireTime, dontCacheRedirects;
typedef struct _HTTPServer {
char *name;
int port;
int addrindex;
int isProxy;
int version;
int persistent;
int pipeline;
int lies;
int rtt;
int rate;
time_t time;
int numslots;
int maxslots;
HTTPConnectionPtr *connection;
FdEventHandlerPtr *idleHandler;
HTTPRequestPtr request, request_last;
struct _HTTPServer *next;
} HTTPServerRec, *HTTPServerPtr;
extern AtomPtr parentHost;
extern int parentPort;
void preinitServer(void);
void initServer(void);
void httpServerAbortHandler(ObjectPtr object);
int httpMakeServerRequest(char *name, int port, ObjectPtr object,
int method, int from, int to,
HTTPRequestPtr requestor);
int httpServerQueueRequest(HTTPServerPtr server, HTTPRequestPtr request);
int httpServerTrigger(HTTPServerPtr server);
int httpServerSideRequest(HTTPServerPtr server);
int httpServerDoSide(HTTPConnectionPtr connection);
int httpServerSideHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest);
int httpServerSideHandler2(int status,
FdEventHandlerPtr event,
StreamRequestPtr srequest);
int httpServerConnectionDnsHandler(int status,
GethostbynameRequestPtr request);
int httpServerConnectionHandler(int status,
FdEventHandlerPtr event,
ConnectRequestPtr request);
int httpServerSocksHandler(int status, SocksRequestPtr request);
int httpServerConnectionHandlerCommon(int status,
HTTPConnectionPtr connection);
void httpServerFinish(HTTPConnectionPtr connection, int s, int offset);
void httpServerReply(HTTPConnectionPtr connection, int immediate);
void httpServerAbort(HTTPConnectionPtr connection, int, int, struct _Atom *);
void httpServerAbortRequest(HTTPRequestPtr request, int, int, struct _Atom *);
void httpServerClientReset(HTTPRequestPtr request);
void httpServerUnpipeline(HTTPRequestPtr request);
int
httpServerSendRequest(HTTPConnectionPtr connection);
int
httpServerHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int
httpServerReplyHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int
httpServerIndirectHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int
httpServerDirectHandler(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int
httpServerDirectHandler2(int status,
FdEventHandlerPtr event,
StreamRequestPtr request);
int httpServerRequest(ObjectPtr object, int method, int from, int to,
HTTPRequestPtr, void*);
int httpServerHandlerHeaders(int eof,
FdEventHandlerPtr event,
StreamRequestPtr request,
HTTPConnectionPtr connection);
int httpServerReadData(HTTPConnectionPtr, int);
int connectionAddData(HTTPConnectionPtr connection, int skip);
int
httpWriteRequest(HTTPConnectionPtr connection, HTTPRequestPtr request, int);
void listServers(FILE*);
|
/*
===========================================================================
Copyright (C) 1999 - 2005, Id Software, Inc.
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/
#pragma once
//#define CULL_BBOX
/*
This file does not reference any globals, and has these entry points:
void CM_ClearLevelPatches( void );
struct patchCollide_s *CM_GeneratePatchCollide( int width, int height, const vec3_t *points );
void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
qboolean CM_PositionTestInPatchCollide( traceWork_t *tw, const struct patchCollide_s *pc );
void CM_DrawDebugSurface( void (*drawPoly)(int color, int numPoints, flaot *points) );
Issues for collision against curved surfaces:
Surface edges need to be handled differently than surface planes
Plane expansion causes raw surfaces to expand past expanded bounding box
Position test of a volume against a surface is tricky.
Position test of a point against a surface is not well defined, because the surface has no volume.
Tracing leading edge points instead of volumes?
Position test by tracing corner to corner? (8*7 traces -- ouch)
coplanar edges
triangulated patches
degenerate patches
endcaps
degenerate
WARNING: this may misbehave with meshes that have rows or columns that only
degenerate a few triangles. Completely degenerate rows and columns are handled
properly.
*/
#define MAX_FACETS 1024
#define MAX_PATCH_PLANES 2048
typedef struct patchPlane_s {
float plane[4];
int signbits; // signx + (signy<<1) + (signz<<2), used as lookup during collision
} patchPlane_t;
typedef struct facet_s {
int surfacePlane;
int numBorders; // 3 or four + 6 axial bevels + 4 or 3 * 4 edge bevels
int borderPlanes[4+6+16];
int borderInward[4+6+16];
qboolean borderNoAdjust[4+6+16];
} facet_t;
typedef struct patchCollide_s {
vec3_t bounds[2];
int numPlanes; // surface planes plus edge planes
patchPlane_t *planes;
int numFacets;
facet_t *facets;
} patchCollide_t;
#define MAX_GRID_SIZE 129
typedef struct cGrid_s {
int width;
int height;
qboolean wrapWidth;
qboolean wrapHeight;
vec3_t points[MAX_GRID_SIZE][MAX_GRID_SIZE]; // [width][height]
} cGrid_t;
#define SUBDIVIDE_DISTANCE 16 //4 // never more than this units away from curve
#define PLANE_TRI_EPSILON 0.1
#define WRAP_POINT_EPSILON 0.1
struct patchCollide_s *CM_GeneratePatchCollide( int width, int height, vec3_t *points );
|
/* radare - LGPL - Copyright 2011-2015 pancake */
/* vala extension for libr (radare2) */
// TODO: add cache directory (~/.r2/cache)
#include "r_lib.h"
#include "r_core.h"
#include "r_lang.h"
static int lang_cpipe_file(RLang *lang, const char *file) {
char *a, *cc, *p, name[512], buf[512];
const char *libpath, *libname;
char* binfile;
if (strlen (file) > (sizeof (name)-10))
return false;
if (!strstr (file, ".c"))
sprintf (name, "%s.c", file);
else strcpy (name, file);
if (!r_file_exists (name)) {
eprintf ("file not found (%s)\n", name);
return false;
}
a = (char*)r_str_lchr (name, '/');
if (a) {
*a = 0;
libpath = name;
libname = a+1;
} else {
libpath = ".";
libname = name;
}
r_sys_setenv ("PKG_CONFIG_PATH", R2_LIBDIR"/pkgconfig");
p = strstr (name, ".c");
if (p) *p = 0;
cc = r_sys_getenv ("CC");
if (!cc || !*cc) {
free (cc);
cc = strdup ("gcc");
}
snprintf (buf, sizeof (buf), "%s %s -o %s/bin%s"
" $(pkg-config --cflags --libs r_socket)",
cc, file, libpath, libname);
free (cc);
if (r_sandbox_system (buf, 1) != 0) {
return false;
}
binfile = r_str_newf ("%s/bin%s", libpath, libname);
lang_pipe_run (lang, binfile, -1);
r_file_rm (binfile);
free (binfile);
return 0;
}
static int lang_cpipe_init(void *user) {
// TODO: check if "valac" is found in path
return true;
}
static int lang_cpipe_run(RLang *lang, const char *code, int len) {
FILE *fd = fopen (".tmp.c", "w");
if (fd) {
fputs ("#include <r_socket.h>\n\n"
"#define R2P(x,y...) r2p_cmdf(r2p,x,##y)\n"
"int main() {\n"
"R2Pipe *r2p = r2p_open(NULL);", fd);
fputs (code, fd);
fputs ("\n}\n", fd);
fclose (fd);
lang_cpipe_file (lang, ".tmp.c");
r_file_rm (".tmp.c");
} else eprintf ("Cannot open .tmp.c\n");
return true;
}
static struct r_lang_plugin_t r_lang_plugin_cpipe = {
.name = "cpipe",
.ext = "c2",
.desc = "C r2pipe scripting",
.license = "LGPL",
.run = lang_cpipe_run,
.init = (void*)lang_cpipe_init,
.fini = NULL,
.run_file = (void*)lang_cpipe_file,
};
|
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
Copyright (c) 1997-2007 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge 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.
-----------------------------------------------------------------------------
*/
/* This module contains the external function pcre_info(), which gives some
information about a compiled pattern. However, use of this function is now
deprecated, as it has been superseded by pcre_fullinfo(). */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "pcre_internal.h"
/*************************************************
* (Obsolete) Return info about compiled pattern *
*************************************************/
/* This is the original "info" function. It picks potentially useful data out
of the private structure, but its interface was too rigid. It remains for
backwards compatibility. The public options are passed back in an int - though
the re->options field has been expanded to a long int, all the public options
at the low end of it, and so even on 16-bit systems this will still be OK.
Therefore, I haven't changed the API for pcre_info().
Arguments:
argument_re points to compiled code
optptr where to pass back the options
first_byte where to pass back the first character,
or -1 if multiline and all branches start ^,
or -2 otherwise
Returns: number of capturing subpatterns
or negative values on error
*/
PCRE_EXP_DEFN int
pcre_info(const pcre *argument_re, int *optptr, int *first_byte)
{
real_pcre internal_re;
const real_pcre *re = (const real_pcre *)argument_re;
if (re == NULL) return PCRE_ERROR_NULL;
if (re->magic_number != MAGIC_NUMBER)
{
re = _pcre_try_flipped(re, &internal_re, NULL, NULL);
if (re == NULL) return PCRE_ERROR_BADMAGIC;
}
if (optptr != NULL) *optptr = (int)(re->options & PUBLIC_OPTIONS);
if (first_byte != NULL)
*first_byte = ((re->flags & PCRE_FIRSTSET) != 0)? re->first_byte :
((re->flags & PCRE_STARTLINE) != 0)? -1 : -2;
return re->top_bracket;
}
/* End of pcre_info.c */
|
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_SCENE_NODE_ANIMATOR_ROTATION_H_INCLUDED__
#define __C_SCENE_NODE_ANIMATOR_ROTATION_H_INCLUDED__
#include "ISceneNode.h"
namespace irr
{
namespace scene
{
class CSceneNodeAnimatorRotation : public ISceneNodeAnimator
{
public:
//! constructor
CSceneNodeAnimatorRotation(u32 time, const core::vector3df& rotation);
//! animates a scene node
virtual void animateNode(ISceneNode* node, u32 timeMs);
//! Writes attributes of the scene node animator.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
//! Reads attributes of the scene node animator.
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
//! Returns type of the scene node animator
virtual ESCENE_NODE_ANIMATOR_TYPE getType() const { return ESNAT_ROTATION; }
//! Creates a clone of this animator.
/** Please note that you will have to drop
(IReferenceCounted::drop()) the returned pointer after calling this. */
virtual ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0);
private:
core::vector3df Rotation;
u32 StartTime;
};
} // end namespace scene
} // end namespace irr
#endif
|
/*
*
* Copyright (C) 2006-2007 Peter Johnson
*
* 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 THE AUTHOR AND OTHER 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 OR OTHER CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libyasm/file.h"
#include "libyasm/coretype.h"
typedef struct Test_Entry {
/* combpath function to test */
char * (*combpath) (const char *from, const char *to);
/* input "from" path */
const char *from;
/* input "to" path */
const char *to;
/* correct path returned */
const char *out;
} Test_Entry;
static Test_Entry tests[] = {
/* UNIX */
{yasm__combpath_unix, "file1", "file2", "file2"},
{yasm__combpath_unix, "./file1.ext", "./file2.ext", "file2.ext"},
{yasm__combpath_unix, "/file1", "file2", "/file2"},
{yasm__combpath_unix, "file1", "/file2", "/file2"},
{yasm__combpath_unix, "/foo/file1", "../../file2", "/file2"},
{yasm__combpath_unix, "/foo//file1", "../../file2", "/file2"},
{yasm__combpath_unix, "foo/bar/file1", "../file2", "foo/file2"},
{yasm__combpath_unix, "foo/bar/file1", "../../../file2", "../file2"},
{yasm__combpath_unix, "foo/bar//file1", "../..//..//file2", "../file2"},
{yasm__combpath_unix, "foo/bar/", "file2", "foo/bar/file2"},
{yasm__combpath_unix, "../../file1", "../../file2", "../../../../file2"},
{yasm__combpath_unix, "../foo/bar/../file1", "../../file2", "../foo/bar/../../../file2"},
{yasm__combpath_unix, "/", "../file2", "/file2"},
{yasm__combpath_unix, "../foo/", "../file2", "../file2"},
{yasm__combpath_unix, "../foo/file1", "../../bar/file2", "../../bar/file2"},
/* Windows */
{yasm__combpath_win, "file1", "file2", "file2"},
{yasm__combpath_win, "./file1.ext", "./file2.ext", "file2.ext"},
{yasm__combpath_win, "./file1.ext", ".\\file2.ext", "file2.ext"},
{yasm__combpath_win, ".\\file1.ext", "./file2.ext", "file2.ext"},
{yasm__combpath_win, "/file1", "file2", "\\file2"},
{yasm__combpath_win, "\\file1", "file2", "\\file2"},
{yasm__combpath_win, "file1", "/file2", "\\file2"},
{yasm__combpath_win, "file1", "\\file2", "\\file2"},
{yasm__combpath_win, "/foo\\file1", "../../file2", "\\file2"},
{yasm__combpath_win, "\\foo\\\\file1", "..\\../file2", "\\file2"},
{yasm__combpath_win, "foo/bar/file1", "../file2", "foo\\file2"},
{yasm__combpath_win, "foo/bar/file1", "../..\\../file2", "..\\file2"},
{yasm__combpath_win, "foo/bar//file1", "../..\\\\..//file2", "..\\file2"},
{yasm__combpath_win, "foo/bar/", "file2", "foo\\bar\\file2"},
{yasm__combpath_win, "..\\../file1", "../..\\file2", "..\\..\\..\\..\\file2"},
{yasm__combpath_win, "../foo/bar\\\\../file1", "../..\\file2", "..\\foo\\bar\\..\\..\\..\\file2"},
{yasm__combpath_win, "/", "../file2", "\\file2"},
{yasm__combpath_win, "../foo/", "../file2", "..\\file2"},
{yasm__combpath_win, "../foo/file1", "../..\\bar\\file2", "..\\..\\bar\\file2"},
{yasm__combpath_win, "c:/file1.ext", "./file2.ext", "c:\\file2.ext"},
{yasm__combpath_win, "e:\\path\\to/file1.ext", ".\\file2.ext", "e:\\path\\to\\file2.ext"},
{yasm__combpath_win, ".\\file1.ext", "g:file2.ext", "g:file2.ext"},
};
static char failed[1000];
static char failmsg[100];
static int
run_test(Test_Entry *test)
{
char *out;
const char *funcname;
if (test->combpath == &yasm__combpath_unix)
funcname = "unix";
else
funcname = "win";
out = test->combpath(test->from, test->to);
if (strcmp(out, test->out) != 0) {
sprintf(failmsg,
"combpath_%s(\"%s\", \"%s\"): expected \"%s\", got \"%s\"!",
funcname, test->from, test->to, test->out, out);
yasm_xfree(out);
return 1;
}
yasm_xfree(out);
return 0;
}
int
main(void)
{
int nf = 0;
int numtests = sizeof(tests)/sizeof(Test_Entry);
int i;
failed[0] = '\0';
printf("Test combpath_test: ");
for (i=0; i<numtests; i++) {
int fail = run_test(&tests[i]);
printf("%c", fail>0 ? 'F':'.');
fflush(stdout);
if (fail)
sprintf(failed, "%s ** F: %s\n", failed, failmsg);
nf += fail;
}
printf(" +%d-%d/%d %d%%\n%s",
numtests-nf, nf, numtests, 100*(numtests-nf)/numtests, failed);
return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
|
/* $Id: upnperrors.c,v 1.8 2014/06/10 09:41:48 nanard Exp $ */
/* Project : miniupnp
* Author : Thomas BERNARD
* copyright (c) 2007 Thomas Bernard
* All Right reserved.
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* This software is subjet to the conditions detailed in the
* provided LICENCE file. */
#include <string.h>
#include "upnperrors.h"
#include "upnpcommands.h"
#include "miniupnpc.h"
const char * strupnperror(int err)
{
const char * s = NULL;
switch(err) {
case UPNPCOMMAND_SUCCESS:
s = "Success";
break;
case UPNPCOMMAND_UNKNOWN_ERROR:
s = "Miniupnpc Unknown Error";
break;
case UPNPCOMMAND_INVALID_ARGS:
s = "Miniupnpc Invalid Arguments";
break;
case UPNPCOMMAND_INVALID_RESPONSE:
s = "Miniupnpc Invalid response";
break;
case UPNPDISCOVER_SOCKET_ERROR:
s = "Miniupnpc Socket error";
break;
case UPNPDISCOVER_MEMORY_ERROR:
s = "Miniupnpc Memory allocation error";
break;
case 401:
s = "Invalid Action";
break;
case 402:
s = "Invalid Args";
break;
case 501:
s = "Action Failed";
break;
case 606:
s = "Action not authorized";
break;
case 701:
s = "PinholeSpaceExhausted";
break;
case 702:
s = "FirewallDisabled";
break;
case 703:
s = "InboundPinholeNotAllowed";
break;
case 704:
s = "NoSuchEntry";
break;
case 705:
s = "ProtocolNotSupported";
break;
case 706:
s = "InternalPortWildcardingNotAllowed";
break;
case 707:
s = "ProtocolWildcardingNotAllowed";
break;
case 708:
s = "WildcardNotPermittedInSrcIP";
break;
case 709:
s = "NoPacketSent";
break;
case 713:
s = "SpecifiedArrayIndexInvalid";
break;
case 714:
s = "NoSuchEntryInArray";
break;
case 715:
s = "WildCardNotPermittedInSrcIP";
break;
case 716:
s = "WildCardNotPermittedInExtPort";
break;
case 718:
s = "ConflictInMappingEntry";
break;
case 724:
s = "SamePortValuesRequired";
break;
case 725:
s = "OnlyPermanentLeasesSupported";
break;
case 726:
s = "RemoteHostOnlySupportsWildcard";
break;
case 727:
s = "ExternalPortOnlySupportsWildcard";
break;
default:
s = "UnknownError";
break;
}
return s;
}
|
#include <linux/init.h>
#include <linux/export.h>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
#include <linux/ioport.h>
#include <asm/mach-rc32434/rb.h>
#include <asm/mach-rc32434/pci.h>
struct pci_reg __iomem *pci_reg;
EXPORT_SYMBOL(pci_reg);
static struct resource pci0_res[] = {
{
.name = "pci_reg0",
.start = PCI0_BASE_ADDR,
.end = PCI0_BASE_ADDR + sizeof(struct pci_reg),
.flags = IORESOURCE_MEM,
}
};
static void rb_machine_restart(char *command)
{
writel(0x80000001, IDT434_REG_BASE + RST);
((void (*)(void)) KSEG1ADDR(0x1FC00000u))();
}
static void rb_machine_halt(void)
{
for (;;)
continue;
}
void __init plat_mem_setup(void)
{
u32 val;
_machine_restart = rb_machine_restart;
_machine_halt = rb_machine_halt;
pm_power_off = rb_machine_halt;
set_io_port_base(KSEG1);
pci_reg = ioremap_nocache(pci0_res[0].start,
pci0_res[0].end - pci0_res[0].start);
if (!pci_reg) {
printk(KERN_ERR "Could not remap PCI registers\n");
return;
}
val = __raw_readl(&pci_reg->pcic);
val &= 0xFFFFFF7;
__raw_writel(val, (void *)&pci_reg->pcic);
#ifdef CONFIG_PCI
*epld_mask = 0x0;
*(epld_mask + 1) = 0x0;
#endif
write_c0_wired(0);
}
const char *get_system_type(void)
{
switch (mips_machtype) {
case MACH_MIKROTIK_RB532A:
return "Mikrotik RB532A";
break;
default:
return "Mikrotik RB532";
break;
}
}
|
/* Definitions for use with Linux SOCK_PACKET sockets.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef __IF_PACKET_H
#define __IF_PACKET_H
#include <features.h>
#include <bits/sockaddr.h>
/* This is the SOCK_PACKET address structure as used in Linux 2.0.
From Linux 2.1 the AF_PACKET interface is preferred and you should
consider using it in place of this one. */
struct sockaddr_pkt
{
__SOCKADDR_COMMON (spkt_);
unsigned char spkt_device[14];
unsigned short spkt_protocol;
};
#endif
|
/*
* Port on Texas Instruments TMS320C6x architecture
*
* Copyright (C) 2004, 2009, 2011 Texas Instruments Incorporated
* Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ASM_C6X_TRAPS_H
#define _ASM_C6X_TRAPS_H
#define EXCEPT_TYPE_NXF 31
#define EXCEPT_TYPE_EXC 30
#define EXCEPT_TYPE_IXF 1
#define EXCEPT_TYPE_SXF 0
#define EXCEPT_CAUSE_LBX (1 << 7)
#define EXCEPT_CAUSE_PRX (1 << 6)
#define EXCEPT_CAUSE_RAX (1 << 5)
#define EXCEPT_CAUSE_RCX (1 << 4)
#define EXCEPT_CAUSE_OPX (1 << 3)
#define EXCEPT_CAUSE_EPX (1 << 2)
#define EXCEPT_CAUSE_FPX (1 << 1)
#define EXCEPT_CAUSE_IFX (1 << 0)
struct exception_info {
char *kernel_str;
int signo;
int code;
};
extern int (*c6x_nmi_handler)(struct pt_regs *regs);
#endif
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_BROWSER_TAB_STRIP_MODEL_DELEGATE_H_
#define CHROME_BROWSER_UI_BROWSER_TAB_STRIP_MODEL_DELEGATE_H_
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
class GURL;
namespace chrome {
class BrowserTabStripModelDelegate : public TabStripModelDelegate {
public:
explicit BrowserTabStripModelDelegate(Browser* browser);
virtual ~BrowserTabStripModelDelegate();
private:
// Overridden from TabStripModelDelegate:
virtual void AddTabAt(const GURL& url,
int index,
bool foreground) OVERRIDE;
virtual Browser* CreateNewStripWithContents(
const std::vector<NewStripContents>& contentses,
const gfx::Rect& window_bounds,
bool maximize) OVERRIDE;
virtual void WillAddWebContents(content::WebContents* contents) OVERRIDE;
virtual int GetDragActions() const OVERRIDE;
virtual bool CanDuplicateContentsAt(int index) OVERRIDE;
virtual void DuplicateContentsAt(int index) OVERRIDE;
virtual void CreateHistoricalTab(content::WebContents* contents) OVERRIDE;
virtual bool RunUnloadListenerBeforeClosing(
content::WebContents* contents) OVERRIDE;
virtual bool ShouldRunUnloadListenerBeforeClosing(
content::WebContents* contents) OVERRIDE;
virtual bool CanBookmarkAllTabs() const OVERRIDE;
virtual void BookmarkAllTabs() OVERRIDE;
virtual RestoreTabType GetRestoreTabType() OVERRIDE;
virtual void RestoreTab() OVERRIDE;
void CloseFrame();
Browser* browser_;
// The following factory is used to close the frame at a later time.
base::WeakPtrFactory<BrowserTabStripModelDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(BrowserTabStripModelDelegate);
};
} // namespace chrome
#endif // CHROME_BROWSER_UI_BROWSER_TAB_STRIP_MODEL_DELEGATE_H_
|
/* d3des.h -
*
* Headers and defines for d3des.c
* Graven Imagery, 1992.
*
* THIS SOFTWARE PLACED IN THE PUBLIC DOMAIN BY THE AUTHOUR
* 920825 19:42 EDST
*
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
* (GEnie : OUTER; CIS : [71755,204])
*/
#pragma once
#undef D2_DES
#undef D3_DES
#ifdef D3_DES
#ifndef D2_DES
#define D2_DES /* D2_DES is needed for D3_DES */
#endif
#endif
#define EN0 0 /* MODE == encrypt */
#define DE1 1 /* MODE == decrypt */
/* Useful on 68000-ish machines, but NOT USED here. */
typedef union {
unsigned long blok[2];
unsigned short word[4];
unsigned char byte[8];
} M68K;
typedef union {
unsigned long dblok[4];
unsigned short dword[8];
unsigned char dbyte[16];
} M68K2;
extern void deskey(unsigned char *, short);
/* hexkey[8] MODE
* Sets the internal key register according to the hexadecimal
* key contained in the 8 bytes of hexkey, according to the DES,
* for encryption or decryption according to MODE.
*/
extern void usekey(unsigned long *);
/* cookedkey[32]
* Loads the internal key register with the data in cookedkey.
*/
extern void cpkey(unsigned long *);
/* cookedkey[32]
* Copies the contents of the internal key register into the storage
* located at &cookedkey[0].
*/
extern void des(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the key currently loaded in the
* internal key register) one block of eight bytes at address 'from'
* into the block at address 'to'. They can be the same.
*/
#ifdef D2_DES
#define desDkey(a,b) des2key((a),(b))
extern void des2key(unsigned char *, short);
/* hexkey[16] MODE
* Sets the internal key registerS according to the hexadecimal
* keyS contained in the 16 bytes of hexkey, according to the DES,
* for DOUBLE encryption or decryption according to MODE.
* NOTE: this clobbers all three key registers!
*/
extern void Ddes(unsigned char *, unsigned char *);
/* from[8] to[8]
* Encrypts/Decrypts (according to the keyS currently loaded in the
* internal key registerS) one block of eight bytes at address 'from'
* into the block at address 'to'. They can be the same.
*/
extern void D2des(unsigned char *, unsigned char *);
/* from[16] to[16]
* Encrypts/Decrypts (according to the keyS currently loaded in the
* internal key registerS) one block of SIXTEEN bytes at address 'from'
* into the block at address 'to'. They can be the same.
*/
extern void makekey(char *, unsigned char *);
/* *password, single-length key[8]
* With a double-length default key, this routine hashes a NULL-terminated
* string into an eight-byte random-looking key, suitable for use with the
* deskey() routine.
*/
#define makeDkey(a,b) make2key((a),(b))
extern void make2key(char *, unsigned char *);
/* *password, double-length key[16]
* With a double-length default key, this routine hashes a NULL-terminated
* string into a sixteen-byte random-looking key, suitable for use with the
* des2key() routine.
*/
#ifndef D3_DES /* D2_DES only */
#define useDkey(a) use2key((a))
#define cpDkey(a) cp2key((a))
extern void use2key(unsigned long *);
/* cookedkey[64]
* Loads the internal key registerS with the data in cookedkey.
* NOTE: this clobbers all three key registers!
*/
extern voi cp2key(unsigned long *);
/* cookedkey[64]
* Copies the contents of the internal key registerS into the storage
* located at &cookedkey[0].
*/
#else /* D3_DES too */
#define useDkey(a) use3key((a))
#define cpDkey(a) cp3key((a))
extern void des3key(unsigned char *, short);
/* hexkey[24] MODE
* Sets the internal key registerS according to the hexadecimal
* keyS contained in the 24 bytes of hexkey, according to the DES,
* for DOUBLE encryption or decryption according to MODE.
*/
extern void use3key(unsigned long *);
/* cookedkey[96]
* Loads the 3 internal key registerS with the data in cookedkey.
*/
extern void cp3key(unsigned long *);
/* cookedkey[96]
* Copies the contents of the 3 internal key registerS into the storage
* located at &cookedkey[0].
*/
extern void make3key(char *, unsigned char *);
/* *password, triple-length key[24]
* With a triple-length default key, this routine hashes a NULL-terminated
* string into a twenty-four-byte random-looking key, suitable for use with
* the des3key() routine.
*/
#endif /* D3_DES */
#endif /* D2_DES */
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
********************************************************************/
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2004 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
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. */
#include <stdlib.h>
#include "unwind_i.h"
PROTECTED unw_addr_space_t
unw_create_addr_space (unw_accessors_t *a, int byte_order)
{
#ifdef UNW_LOCAL_ONLY
return NULL;
#else
unw_addr_space_t as;
/*
* hppa supports only big-endian.
*/
if (byte_order != 0 && byte_order != __BIG_ENDIAN)
return NULL;
as = malloc (sizeof (*as));
if (!as)
return NULL;
memset (as, 0, sizeof (*as));
as->acc = *a;
return as;
#endif
}
|
#ifndef __ASM_MIPS_MT_H
#define __ASM_MIPS_MT_H
#include <linux/cpumask.h>
extern int tclimit;
extern int vpelimit;
extern cpumask_t mt_fpu_cpumask;
extern unsigned long mt_fpemul_threshold;
extern void mips_mt_regdump(unsigned long previous_mvpcontrol_value);
extern void mips_mt_set_cpuoptions(void);
struct class;
extern struct class *mt_class;
#endif
|
/*
* Copyright (c) 2016, Mellanox Technologies. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* 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 __MLX5_EN_TC_H__
#define __MLX5_EN_TC_H__
#include <net/pkt_cls.h>
#define MLX5E_TC_FLOW_ID_MASK 0x0000ffff
#ifdef CONFIG_MLX5_ESWITCH
enum {
MLX5E_TC_INGRESS = BIT(0),
MLX5E_TC_EGRESS = BIT(1),
MLX5E_TC_NIC_OFFLOAD = BIT(2),
MLX5E_TC_ESW_OFFLOAD = BIT(3),
MLX5E_TC_LAST_EXPORTED_BIT = 3,
};
int mlx5e_tc_nic_init(struct mlx5e_priv *priv);
void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv);
int mlx5e_tc_esw_init(struct rhashtable *tc_ht);
void mlx5e_tc_esw_cleanup(struct rhashtable *tc_ht);
int mlx5e_configure_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags);
int mlx5e_delete_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags);
int mlx5e_stats_flower(struct net_device *dev, struct mlx5e_priv *priv,
struct tc_cls_flower_offload *f, int flags);
struct mlx5e_encap_entry;
void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
struct mlx5e_encap_entry *e);
void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
struct mlx5e_encap_entry *e);
struct mlx5e_neigh_hash_entry;
void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe);
int mlx5e_tc_num_filters(struct mlx5e_priv *priv, int flags);
void mlx5e_tc_reoffload_flows_work(struct work_struct *work);
#else /* CONFIG_MLX5_ESWITCH */
static inline int mlx5e_tc_nic_init(struct mlx5e_priv *priv) { return 0; }
static inline void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) {}
static inline int mlx5e_tc_num_filters(struct mlx5e_priv *priv, int flags) { return 0; }
#endif
#endif /* __MLX5_EN_TC_H__ */
|
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef DIAG_DCI_H
#define DIAG_DCI_H
#define MAX_DCI_CLIENT 10
#define DCI_CMD_CODE 0x93
extern unsigned int dci_max_reg;
extern unsigned int dci_max_clients;
struct diag_dci_tbl {
int pid;
int uid;
int tag;
};
struct dci_notification_tbl {
struct task_struct *client;
uint16_t list; /* bit mask */
int signal_type;
};
enum {
DIAG_DCI_NO_ERROR = 1001, /* No error */
DIAG_DCI_NO_REG, /* Could not register */
DIAG_DCI_NO_MEM, /* Failed memory allocation */
DIAG_DCI_NOT_SUPPORTED, /* This particular client is not supported */
DIAG_DCI_HUGE_PACKET, /* Request/Response Packet too huge */
DIAG_DCI_SEND_DATA_FAIL,/* writing to kernel or peripheral fails */
DIAG_DCI_TABLE_ERR /* Error dealing with registration tables */
};
int diag_dci_init(void);
void diag_dci_exit(void);
void diag_read_smd_dci_work_fn(struct work_struct *);
int diag_process_dci_client(unsigned char *buf, int len);
int diag_send_dci_pkt(struct diag_master_table entry, unsigned char *buf,
int len, int index);
#endif
|
/*****************************************************************************
* *
* PrimeSense PSCommon Library *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of PSCommon. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*****************************************************************************/
#ifndef _XN_SMART_POINTER_H_
#define _XN_SMART_POINTER_H_
#include <stdio.h>
namespace xnl
{
template <class T>
class SmartPointer
{
public:
SmartPointer(T* ptr = 0, bool takeCharge = true) :
m_pCounterPtr(0)
{
if (ptr != 0)
{
m_pCounterPtr = XN_NEW(CountedPointer, ptr, takeCharge);
}
}
SmartPointer(const SmartPointer<T>& other)
{
acquire(other.m_pCounterPtr);
}
SmartPointer& operator=(const SmartPointer& other)
{
if (m_pCounterPtr != other.m_pCounterPtr)
{
release();
acquire(other.m_pCounterPtr);
}
return *this;
}
virtual ~SmartPointer()
{
release();
}
bool operator==(const SmartPointer& other) const
{
return (m_pCounterPtr == other.m_pCounterPtr);
}
bool operator!=(const SmartPointer& other) const
{
return (m_pCounterPtr != other.m_pCounterPtr);
}
T& operator*() const
{
return *m_pCounterPtr->ptr;
}
T* operator->() const
{
return m_pCounterPtr->ptr;
}
T* get() const
{
return m_pCounterPtr!=NULL?m_pCounterPtr->ptr:NULL;
}
private:
class CountedPointer
{
public:
CountedPointer(T* ptr, bool takeCharge) :
ptr(ptr), refcount(1), takeCharge(takeCharge)
{}
T* ptr;
int refcount;
bool takeCharge;
};
void acquire(CountedPointer* pOther)
{
m_pCounterPtr = pOther;
if (m_pCounterPtr != 0)
{
++m_pCounterPtr->refcount;
}
}
void release()
{
printf("--> Release\n");
if (m_pCounterPtr != 0)
{
--m_pCounterPtr->refcount;
if (m_pCounterPtr->refcount == 0)
{
printf("Deleting\n");
if (m_pCounterPtr->takeCharge)
{
printf("Deleting internal\n");
XN_DELETE(m_pCounterPtr->ptr);
}
XN_DELETE(m_pCounterPtr);
}
m_pCounterPtr = 0;
}
printf("<-- Release\n");
}
CountedPointer* m_pCounterPtr;
};
} // xnl
#endif // _XN_SMART_POINTER_H_
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_BASE_URL_UTIL_H_
#define NET_BASE_URL_UTIL_H_
#include <string>
#include "net/base/net_export.h"
class GURL;
namespace net {
// Returns a new GURL by appending the given query parameter name and the
// value. Unsafe characters in the name and the value are escaped like
// %XX%XX. The original query component is preserved if it's present.
//
// Examples:
//
// AppendQueryParameter(GURL("http://example.com"), "name", "value").spec()
// => "http://example.com?name=value"
// AppendQueryParameter(GURL("http://example.com?x=y"), "name", "value").spec()
// => "http://example.com?x=y&name=value"
NET_EXPORT GURL AppendQueryParameter(const GURL& url,
const std::string& name,
const std::string& value);
// Returns a new GURL by appending or replacing the given query parameter name
// and the value. If |name| appears more than once, only the first name-value
// pair is replaced. Unsafe characters in the name and the value are escaped
// like %XX%XX. The original query component is preserved if it's present.
//
// Examples:
//
// AppendOrReplaceQueryParameter(
// GURL("http://example.com"), "name", "new").spec()
// => "http://example.com?name=value"
// AppendOrReplaceQueryParameter(
// GURL("http://example.com?x=y&name=old"), "name", "new").spec()
// => "http://example.com?x=y&name=new"
NET_EXPORT GURL AppendOrReplaceQueryParameter(const GURL& url,
const std::string& name,
const std::string& value);
// Looks for |search_key| in the query portion of |url|. Returns true if the
// key is found and sets |out_value| to the unescaped value for the key.
// Returns false if the key is not found.
NET_EXPORT bool GetValueForKeyInQuery(const GURL& url,
const std::string& search_key,
std::string* out_value);
} // namespace net
#endif // NET_BASE_URL_UTIL_H_
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2014 Samsung Electronics. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef HTMLTagCollection_h
#define HTMLTagCollection_h
#include "core/dom/Element.h"
#include "core/dom/TagCollection.h"
namespace blink {
// Collection that limits to a particular tag and whose rootNode is in an HTMLDocument.
class HTMLTagCollection final : public TagCollection {
public:
static PassRefPtrWillBeRawPtr<HTMLTagCollection> create(ContainerNode& rootNode, CollectionType type, const AtomicString& localName)
{
ASSERT_UNUSED(type, type == HTMLTagCollectionType);
return adoptRefWillBeNoop(new HTMLTagCollection(rootNode, localName));
}
bool elementMatches(const Element&) const;
private:
HTMLTagCollection(ContainerNode& rootNode, const AtomicString& localName);
AtomicString m_loweredLocalName;
};
DEFINE_TYPE_CASTS(HTMLTagCollection, LiveNodeListBase, collection, collection->type() == HTMLTagCollectionType, collection.type() == HTMLTagCollectionType);
inline bool HTMLTagCollection::elementMatches(const Element& testElement) const
{
// Implements http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-getelementsbytagname
if (m_localName != starAtom) {
const AtomicString& localName = testElement.isHTMLElement() ? m_loweredLocalName : m_localName;
if (localName != testElement.localName())
return false;
}
ASSERT(m_namespaceURI == starAtom);
return true;
}
} // namespace blink
#endif // HTMLTagCollection_h
|
/*=========================================================================
Program: DICOMParser
Module: DICOMConfig.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2003 Matt Turek
All rights reserved.
See Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef __DICOM_CONFIG_H_
#define __DICOM_CONFIG_H_
//
// CMake Hook
//
#include "DICOMCMakeConfig.h"
//
// BEGIN Toolkit (ITK,VTK, etc) specific
//
#ifdef vtkDICOMParser_EXPORTS
#define DICOM_EXPORT_SYMBOLS
#endif
#ifdef ITKDICOMParser_EXPORTS
#define DICOM_EXPORT_SYMBOLS
#endif
//
// END toolkit (ITK, VTK, etc) specific
//
#ifdef DICOM_NO_STD_NAMESPACE
#define dicom_stl
#else
#define dicom_stl std
#endif
#ifdef DICOM_ANSI_STDLIB
#define dicom_stream std
#include <iostream>
#include <fstream>
#include <iomanip>
#else
#define dicom_stream
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#endif
#ifdef DICOM_DLL
#ifdef DICOM_EXPORT_SYMBOLS
#define DICOM_EXPORT __declspec(dllexport)
#define DICOM_EXPIMP_TEMPLATE
#else
#define DICOM_EXPORT __declspec(dllimport)
#define DICOM_EXPIMP_TEMPLATE extern
#endif
#else
#define DICOM_EXPORT
#endif
#endif // __DICOM_CONFIG_H_
|
/*
Copyright (c) 2015, 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.
3. Neither the name of the copyright holder(s) nor the names of any contributors
may be used to endorse or promote products derived from this software without
specific prior written permission. No license is granted to the trademarks of
the copyright holders even if such marks are included in this software.
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.
*/
#import "ORKStepHeaderView.h"
#import "ORKHeadlineLabel.h"
#import "ORKSubheadlineLabel.h"
#import "ORKTextButton.h"
NS_ASSUME_NONNULL_BEGIN
@interface ORKStepHeaderView ()
@property (nonatomic, strong, readonly) ORKHeadlineLabel *captionLabel;
@property (nonatomic, strong, readonly) ORKTextButton *learnMoreButton;
@property (nonatomic, strong, readonly) ORKSubheadlineLabel *instructionLabel;
@property (nonatomic) BOOL hasContentAbove;
- (void)updateCaptionLabelPreferredWidth;
@end
NS_ASSUME_NONNULL_END
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* TI LMU (Lighting Management Unit) Core Driver
*
* Copyright 2017 Texas Instruments
*
* Author: Milo Kim <milo.kim@ti.com>
*/
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/mfd/ti-lmu.h>
#include <linux/mfd/ti-lmu-register.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/slab.h>
struct ti_lmu_data {
const struct mfd_cell *cells;
int num_cells;
unsigned int max_register;
};
static int ti_lmu_enable_hw(struct ti_lmu *lmu, enum ti_lmu_id id)
{
if (lmu->en_gpio)
gpiod_set_value(lmu->en_gpio, 1);
/* Delay about 1ms after HW enable pin control */
usleep_range(1000, 1500);
/* LM3631 has additional power up sequence - enable LCD_EN bit. */
if (id == LM3631) {
return regmap_update_bits(lmu->regmap, LM3631_REG_DEVCTRL,
LM3631_LCD_EN_MASK,
LM3631_LCD_EN_MASK);
}
return 0;
}
static void ti_lmu_disable_hw(void *data)
{
struct ti_lmu *lmu = data;
if (lmu->en_gpio)
gpiod_set_value(lmu->en_gpio, 0);
}
#define LM363X_REGULATOR(_id) \
{ \
.name = "lm363x-regulator", \
.id = _id, \
.of_compatible = "ti,lm363x-regulator", \
} \
static const struct mfd_cell lm3631_devices[] = {
LM363X_REGULATOR(LM3631_BOOST),
LM363X_REGULATOR(LM3631_LDO_CONT),
LM363X_REGULATOR(LM3631_LDO_OREF),
LM363X_REGULATOR(LM3631_LDO_POS),
LM363X_REGULATOR(LM3631_LDO_NEG),
{
.name = "ti-lmu-backlight",
.id = LM3631,
.of_compatible = "ti,lm3631-backlight",
},
};
static const struct mfd_cell lm3632_devices[] = {
LM363X_REGULATOR(LM3632_BOOST),
LM363X_REGULATOR(LM3632_LDO_POS),
LM363X_REGULATOR(LM3632_LDO_NEG),
{
.name = "ti-lmu-backlight",
.id = LM3632,
.of_compatible = "ti,lm3632-backlight",
},
};
static const struct mfd_cell lm3633_devices[] = {
{
.name = "ti-lmu-backlight",
.id = LM3633,
.of_compatible = "ti,lm3633-backlight",
},
{
.name = "lm3633-leds",
.of_compatible = "ti,lm3633-leds",
},
/* Monitoring driver for open/short circuit detection */
{
.name = "ti-lmu-fault-monitor",
.id = LM3633,
.of_compatible = "ti,lm3633-fault-monitor",
},
};
static const struct mfd_cell lm3695_devices[] = {
{
.name = "ti-lmu-backlight",
.id = LM3695,
.of_compatible = "ti,lm3695-backlight",
},
};
static const struct mfd_cell lm36274_devices[] = {
LM363X_REGULATOR(LM36274_BOOST),
LM363X_REGULATOR(LM36274_LDO_POS),
LM363X_REGULATOR(LM36274_LDO_NEG),
{
.name = "lm36274-leds",
.id = LM36274,
.of_compatible = "ti,lm36274-backlight",
},
};
#define TI_LMU_DATA(chip, max_reg) \
static const struct ti_lmu_data chip##_data = \
{ \
.cells = chip##_devices, \
.num_cells = ARRAY_SIZE(chip##_devices),\
.max_register = max_reg, \
} \
TI_LMU_DATA(lm3631, LM3631_MAX_REG);
TI_LMU_DATA(lm3632, LM3632_MAX_REG);
TI_LMU_DATA(lm3633, LM3633_MAX_REG);
TI_LMU_DATA(lm3695, LM3695_MAX_REG);
TI_LMU_DATA(lm36274, LM36274_MAX_REG);
static int ti_lmu_probe(struct i2c_client *cl, const struct i2c_device_id *id)
{
struct device *dev = &cl->dev;
const struct ti_lmu_data *data;
struct regmap_config regmap_cfg;
struct ti_lmu *lmu;
int ret;
/*
* Get device specific data from of_match table.
* This data is defined by using TI_LMU_DATA() macro.
*/
data = of_device_get_match_data(dev);
if (!data)
return -ENODEV;
lmu = devm_kzalloc(dev, sizeof(*lmu), GFP_KERNEL);
if (!lmu)
return -ENOMEM;
lmu->dev = &cl->dev;
/* Setup regmap */
memset(®map_cfg, 0, sizeof(struct regmap_config));
regmap_cfg.reg_bits = 8;
regmap_cfg.val_bits = 8;
regmap_cfg.name = id->name;
regmap_cfg.max_register = data->max_register;
lmu->regmap = devm_regmap_init_i2c(cl, ®map_cfg);
if (IS_ERR(lmu->regmap))
return PTR_ERR(lmu->regmap);
/* HW enable pin control and additional power up sequence if required */
lmu->en_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(lmu->en_gpio)) {
ret = PTR_ERR(lmu->en_gpio);
dev_err(dev, "Can not request enable GPIO: %d\n", ret);
return ret;
}
ret = ti_lmu_enable_hw(lmu, id->driver_data);
if (ret)
return ret;
ret = devm_add_action_or_reset(dev, ti_lmu_disable_hw, lmu);
if (ret)
return ret;
/*
* Fault circuit(open/short) can be detected by ti-lmu-fault-monitor.
* After fault detection is done, some devices should re-initialize
* configuration. The notifier enables such kind of handling.
*/
BLOCKING_INIT_NOTIFIER_HEAD(&lmu->notifier);
i2c_set_clientdata(cl, lmu);
return devm_mfd_add_devices(lmu->dev, 0, data->cells,
data->num_cells, NULL, 0, NULL);
}
static const struct of_device_id ti_lmu_of_match[] = {
{ .compatible = "ti,lm3631", .data = &lm3631_data },
{ .compatible = "ti,lm3632", .data = &lm3632_data },
{ .compatible = "ti,lm3633", .data = &lm3633_data },
{ .compatible = "ti,lm3695", .data = &lm3695_data },
{ .compatible = "ti,lm36274", .data = &lm36274_data },
{ }
};
MODULE_DEVICE_TABLE(of, ti_lmu_of_match);
static const struct i2c_device_id ti_lmu_ids[] = {
{ "lm3631", LM3631 },
{ "lm3632", LM3632 },
{ "lm3633", LM3633 },
{ "lm3695", LM3695 },
{ "lm36274", LM36274 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ti_lmu_ids);
static struct i2c_driver ti_lmu_driver = {
.probe = ti_lmu_probe,
.driver = {
.name = "ti-lmu",
.of_match_table = ti_lmu_of_match,
},
.id_table = ti_lmu_ids,
};
module_i2c_driver(ti_lmu_driver);
MODULE_DESCRIPTION("TI LMU MFD Core Driver");
MODULE_AUTHOR("Milo Kim");
MODULE_LICENSE("GPL v2");
|
char *frame_names[] =
{"I_CMD","RR_CMD","RNR_CMD","REJ_CMD","DISC_CMD",
"SABME_CMD","I_RSP","RR_RSP","RNR_RSP","REJ_RSP",
"UA_RSP","DM_RSP","FRMR_RSP","BAD_FRAME","UI_CMD",
"XID_CMD","TEST_CMD","XID_RSP","TEST_RSP"
};
|
/* ioctl.c --- wrappers for Windows ioctl function
Copyright (C) 2008-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by Paolo Bonzini */
#include <config.h>
#include <sys/ioctl.h>
#include <stdarg.h>
#if HAVE_IOCTL
/* Provide a wrapper with the POSIX prototype. */
# undef ioctl
int
rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
{
void *buf;
va_list args;
va_start (args, request);
buf = va_arg (args, void *);
va_end (args);
/* Cast 'request' so that when the system's ioctl function takes a 64-bit
request argument, the value gets zero-extended, not sign-extended. */
return ioctl (fd, (unsigned int) request, buf);
}
#else /* mingw */
# include <errno.h>
/* Get HANDLE. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include "fd-hook.h"
/* Get _get_osfhandle. */
# include "msvc-nothrow.h"
static int
primary_ioctl (int fd, int request, void *arg)
{
/* We don't support FIONBIO on pipes here. If you want to make pipe
fds non-blocking, use the gnulib 'nonblocking' module, until
gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */
if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
errno = ENOSYS;
else
errno = EBADF;
return -1;
}
int
ioctl (int fd, int request, ... /* {void *,char *} arg */)
{
void *arg;
va_list args;
va_start (args, request);
arg = va_arg (args, void *);
va_end (args);
# if WINDOWS_SOCKETS
return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
# else
return primary_ioctl (fd, request, arg);
# endif
}
#endif
|
/***************************************************************************
qgskeyvaluefieldformatter.h - QgsKeyValueFieldFormatter
---------------------
begin : 3.12.2016
copyright : (C) 2016 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************
* *
* 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 QGSKEYVALUEFIELDKIT_H
#define QGSKEYVALUEFIELDKIT_H
#include "qgis_core.h"
#include "qgsfieldformatter.h"
/**
* \ingroup core
* Field formatter for a key value field.
* This represents a list type value.
* Values will be represented as a colon-delimited and
* comma-separated list.
*
* E.g. "color: yellow, amount: 5"
*
* \since QGIS 3.0
*/
class CORE_EXPORT QgsKeyValueFieldFormatter : public QgsFieldFormatter
{
public:
/**
* Default constructor of field formatter for a key value field.
*/
QgsKeyValueFieldFormatter() = default;
QString id() const override;
QString representValue( QgsVectorLayer *layer, int fieldIndex, const QVariantMap &config, const QVariant &cache, const QVariant &value ) const override;
};
#endif // QGSKEYVALUEFIELDKIT_H
|
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
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.
*/
#include "ch.h"
#include "hal.h"
#include "test.h"
/*
* This is a periodic thread that does absolutely nothing except flashing LEDs.
*/
static WORKING_AREA(waThread1, 128);
static msg_t Thread1(void *arg) {
(void)arg;
chRegSetThreadName("blinker");
while (TRUE) {
palClearPad(GPIOC, GPIOC_LED1);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED1);
palClearPad(GPIOC, GPIOC_LED2);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED2);
palClearPad(GPIOC, GPIOC_LED3);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED3);
palClearPad(GPIOC, GPIOC_LED4);
chThdSleepMilliseconds(250);
palSetPad(GPIOC, GPIOC_LED4);
}
}
/*
* Application entry point.
*/
int main(void) {
/*
* System initializations.
* - HAL initialization, this also initializes the configured device drivers
* and performs the board-specific initializations.
* - Kernel initialization, the main() function becomes a thread and the
* RTOS is active.
*/
halInit();
chSysInit();
/*
* Activates the serial driver 2 using the default configuration, pins
* are pre-configured in board.h.
*/
sdStart(&SD2, NULL);
/*
* Creates the example thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
/*
* Normal main() thread activity, in this demo it does nothing except
* sleeping in a loop and check the button state, when the button is
* pressed the test procedure is launched.
*/
while (TRUE) {
if (palReadPad(GPIOA, GPIOA_WKUP_BUTTON))
TestThread(&SD2);
chThdSleepMilliseconds(500);
}
}
|
/* gmp_printf -- formatted output.
Copyright 2001 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "config.h"
#if HAVE_STDARG
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
int
#if HAVE_STDARG
gmp_printf (const char *fmt, ...)
#else
gmp_printf (va_alist)
va_dcl
#endif
{
va_list ap;
int ret;
#if HAVE_STDARG
va_start (ap, fmt);
#else
const char *fmt;
va_start (ap);
fmt = va_arg (ap, const char *);
#endif
ret = __gmp_doprnt (&__gmp_fprintf_funs, stdout, fmt, ap);
va_end (ap);
return ret;
}
|
// @(#)root/roostats:$Id$
// Authors: Kevin Belasco 7/22/2009
// Authors: Kyle Cranmer 7/22/2009
/*************************************************************************
* Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef RooStats_ProposalHelper
#define RooStats_ProposalHelper
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOSTATS_ProposalFunction
#include "RooStats/ProposalFunction.h"
#endif
#ifndef ROOSTATS_UniformProposal
#include "RooStats/UniformProposal.h"
#endif
#ifndef ROOSTATS_PdfProposal
#include "RooStats/PdfProposal.h"
#endif
#ifndef ROO_ARG_SET
#include "RooArgSet.h"
#endif
#ifndef ROO_MSG_SERVICE
#include "RooMsgService.h"
#endif
#ifndef ROO_REAL_VAR
#include "RooRealVar.h"
#endif
#ifndef ROOT_TObject
#include "TObject.h"
#endif
namespace RooStats {
class ProposalHelper : public TObject {
public:
ProposalHelper();
// Set the PDF to be the proposal density function
virtual void SetPdf(RooAbsPdf& pdf) { fPdf = &pdf; }
// Set the bank of clues to add to the current proposal density function
virtual void SetClues(RooDataSet& clues) { fClues = &clues; }
// Get the ProposalFunction that we've been designing
virtual ProposalFunction* GetProposalFunction();
virtual void SetCacheSize(Int_t size)
{
if (size > 0)
fCacheSize = size;
else
coutE(Eval) << "Warning: Requested non-positive cache size: " <<
size << ". Cache size unchanged." << std::endl;
}
virtual void SetUpdateProposalParameters(Bool_t updateParams)
{ fUseUpdates = updateParams; }
virtual void SetVariables(RooArgList& vars)
{ fVars = &vars; }
virtual void SetVariables(const RooArgList& vars)
{ fVars = new RooArgList(vars); fOwnsVars = kTRUE; }
// set what fraction of the proposal density function should come from
// a uniform proposal distribution
virtual void SetUniformFraction(Double_t uniFrac) { fUniFrac = uniFrac; }
// set what fraction of the proposal density function should come from
// the bank of clues
virtual void SetCluesFraction(Double_t cluesFrac) { fCluesFrac = cluesFrac; }
// set the covariance matrix to use for a multi-variate Gaussian proposal
virtual void SetCovMatrix(const TMatrixDSym& covMatrix)
{ fCovMatrix = new TMatrixDSym(covMatrix); }
// set what divisor we will use when dividing the range of a variable to
// determine the width of the proposal function for each dimension
// e.g. divisor = 6 for sigma = 1/6th
virtual void SetWidthRangeDivisor(Double_t divisor)
{ if (divisor > 0.) fSigmaRangeDivisor = divisor; }
// set the option string to pass to the RooNDKeysPdf constructor
// if the bank of clues pdf is being automatically generated by this
// ProposalHelper
virtual void SetCluesOptions(const Option_t* options)
{ if (options != NULL) fCluesOptions = options; }
virtual void SetVariables(RooArgSet& vars)
{
RooArgList* argList = new RooArgList(vars);
SetVariables(*argList);
fOwnsVars = kTRUE;
}
virtual ~ProposalHelper()
{
if (fOwnsPdfProp) delete fPdfProp;
if (fOwnsPdf) delete fPdf;
if (fOwnsCluesPdf) delete fCluesPdf;
if (fOwnsVars) delete fVars;
delete fCovMatrix;
delete fUniformPdf;
}
protected:
RooAbsPdf* fPdf; // the main proposal density function
RooAbsPdf* fCluesPdf; // proposal dens. func. with clues for certain points
RooAbsPdf* fUniformPdf; // uniform proposal dens. func.
RooDataSet* fClues; // data set of clues
TMatrixDSym* fCovMatrix; // covariance matrix for multi var gaussian pdf
PdfProposal* fPdfProp; // the PdfProposal we are (probably) going to return
RooArgList* fVars; // the RooRealVars to generate proposals for
Int_t fCacheSize; // for generating proposals from PDFs
Double_t fSigmaRangeDivisor; // range divisor to get sigma for each variable
Double_t fUniFrac; // what fraction of the PDF integral is uniform
Double_t fCluesFrac; // what fraction of the PDF integral comes from clues
Bool_t fOwnsPdfProp; // whether we own the PdfProposal; equivalent to:
// !(whether we have returned it in GetProposalFunction)
Bool_t fOwnsPdf; // whether we created (and own) the main pdf
Bool_t fOwnsCluesPdf; // whether we created (and own) the clues pdf
Bool_t fOwnsVars; // whether we own fVars
Bool_t fUseUpdates; // whether to set updates for proposal params in PdfProposal
const Option_t* fCluesOptions; // option string for clues RooNDKeysPdf
void CreatePdf();
void CreateCluesPdf();
void CreateUniformPdf();
void CreateCovMatrix(RooArgList& xVec);
ClassDef(ProposalHelper,1)
};
}
#endif
|
#ifndef _LINUX_CPUSET_H
#define _LINUX_CPUSET_H
/*
* cpuset interface
*
* Copyright (C) 2003 BULL SA
* Copyright (C) 2004-2006 Silicon Graphics, Inc.
*
*/
#include <linux/sched.h>
#include <linux/cpumask.h>
#include <linux/nodemask.h>
#include <linux/mm.h>
#include <linux/jump_label.h>
#ifdef CONFIG_CPUSETS
extern struct static_key cpusets_enabled_key;
static inline bool cpusets_enabled(void)
{
return static_key_false(&cpusets_enabled_key);
}
static inline int nr_cpusets(void)
{
/* jump label reference count + the top-level cpuset */
return static_key_count(&cpusets_enabled_key) + 1;
}
static inline void cpuset_inc(void)
{
static_key_slow_inc(&cpusets_enabled_key);
}
static inline void cpuset_dec(void)
{
static_key_slow_dec(&cpusets_enabled_key);
}
extern int cpuset_init(void);
extern void cpuset_init_smp(void);
extern void cpuset_update_active_cpus(bool cpu_online);
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
#define cpuset_current_mems_allowed (current->mems_allowed)
void cpuset_init_current_mems_allowed(void);
int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
extern int __cpuset_node_allowed(int node, gfp_t gfp_mask);
static inline int cpuset_node_allowed(int node, gfp_t gfp_mask)
{
return nr_cpusets() <= 1 || __cpuset_node_allowed(node, gfp_mask);
}
static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
{
return cpuset_node_allowed(zone_to_nid(z), gfp_mask);
}
extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
const struct task_struct *tsk2);
#define cpuset_memory_pressure_bump() \
do { \
if (cpuset_memory_pressure_enabled) \
__cpuset_memory_pressure_bump(); \
} while (0)
extern int cpuset_memory_pressure_enabled;
extern void __cpuset_memory_pressure_bump(void);
extern void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task);
extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *tsk);
extern int cpuset_mem_spread_node(void);
extern int cpuset_slab_spread_node(void);
static inline int cpuset_do_page_mem_spread(void)
{
return task_spread_page(current);
}
static inline int cpuset_do_slab_mem_spread(void)
{
return task_spread_slab(current);
}
extern int current_cpuset_is_being_rebound(void);
extern void rebuild_sched_domains(void);
extern void cpuset_print_current_mems_allowed(void);
/*
* read_mems_allowed_begin is required when making decisions involving
* mems_allowed such as during page allocation. mems_allowed can be updated in
* parallel and depending on the new value an operation can fail potentially
* causing process failure. A retry loop with read_mems_allowed_begin and
* read_mems_allowed_retry prevents these artificial failures.
*/
static inline unsigned int read_mems_allowed_begin(void)
{
if (!cpusets_enabled())
return 0;
return read_seqcount_begin(¤t->mems_allowed_seq);
}
/*
* If this returns true, the operation that took place after
* read_mems_allowed_begin may have failed artificially due to a concurrent
* update of mems_allowed. It is up to the caller to retry the operation if
* appropriate.
*/
static inline bool read_mems_allowed_retry(unsigned int seq)
{
if (!cpusets_enabled())
return false;
return read_seqcount_retry(¤t->mems_allowed_seq, seq);
}
static inline void set_mems_allowed(nodemask_t nodemask)
{
unsigned long flags;
task_lock(current);
local_irq_save(flags);
write_seqcount_begin(¤t->mems_allowed_seq);
current->mems_allowed = nodemask;
write_seqcount_end(¤t->mems_allowed_seq);
local_irq_restore(flags);
task_unlock(current);
}
extern void cpuset_post_attach_flush(void);
#else /* !CONFIG_CPUSETS */
static inline bool cpusets_enabled(void) { return false; }
static inline int cpuset_init(void) { return 0; }
static inline void cpuset_init_smp(void) {}
static inline void cpuset_update_active_cpus(bool cpu_online)
{
partition_sched_domains(1, NULL, NULL);
}
static inline void cpuset_cpus_allowed(struct task_struct *p,
struct cpumask *mask)
{
cpumask_copy(mask, cpu_possible_mask);
}
static inline void cpuset_cpus_allowed_fallback(struct task_struct *p)
{
}
static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
{
return node_possible_map;
}
#define cpuset_current_mems_allowed (node_states[N_MEMORY])
static inline void cpuset_init_current_mems_allowed(void) {}
static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
{
return 1;
}
static inline int cpuset_node_allowed(int node, gfp_t gfp_mask)
{
return 1;
}
static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
{
return 1;
}
static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
const struct task_struct *tsk2)
{
return 1;
}
static inline void cpuset_memory_pressure_bump(void) {}
static inline void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task)
{
}
static inline int cpuset_mem_spread_node(void)
{
return 0;
}
static inline int cpuset_slab_spread_node(void)
{
return 0;
}
static inline int cpuset_do_page_mem_spread(void)
{
return 0;
}
static inline int cpuset_do_slab_mem_spread(void)
{
return 0;
}
static inline int current_cpuset_is_being_rebound(void)
{
return 0;
}
static inline void rebuild_sched_domains(void)
{
partition_sched_domains(1, NULL, NULL);
}
static inline void cpuset_print_current_mems_allowed(void)
{
}
static inline void set_mems_allowed(nodemask_t nodemask)
{
}
static inline unsigned int read_mems_allowed_begin(void)
{
return 0;
}
static inline bool read_mems_allowed_retry(unsigned int seq)
{
return false;
}
static inline void cpuset_post_attach_flush(void)
{
}
#endif /* !CONFIG_CPUSETS */
#endif /* _LINUX_CPUSET_H */
|
/* Copyright 2020 noclew
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vaneelaex.h"
|
/*
* linux/arch/h8300/kernel/gpio.c
*
* Yoshinori Sato <ysato@users.sourceforge.jp>
*
*/
/*
* Internal I/O Port Management
*/
#include <linux/config.h>
#include <linux/stddef.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/init.h>
#define _(addr) (volatile unsigned char *)(addr)
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
#include <asm/regs306x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
};
#define MAX_PORT 11
#endif
#if defined(CONFIG_H83002) || defined(CONFIG_H8048)
/* Fix me!! */
#include <asm/regs306x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),_(P4DDR),_(P5DDR),_(P6DDR),
NULL, _(P8DDR),_(P9DDR),_(PADDR),_(PBDDR),
};
#define MAX_PORT 11
#endif
#if defined(CONFIG_H8S2678)
#include <asm/regs267x.h>
static volatile unsigned char *ddrs[] = {
_(P1DDR),_(P2DDR),_(P3DDR),NULL ,_(P5DDR),_(P6DDR),
_(P7DDR),_(P8DDR),NULL, _(PADDR),_(PBDDR),_(PCDDR),
_(PDDDR),_(PEDDR),_(PFDDR),_(PGDDR),_(PHDDR),
_(PADDR),_(PBDDR),_(PCDDR),_(PDDDR),_(PEDDR),_(PFDDR),
_(PGDDR),_(PHDDR)
};
#define MAX_PORT 17
#endif
#undef _
#if !defined(P1DDR)
#error Unsuppoted CPU Selection
#endif
static struct {
unsigned char used;
unsigned char ddr;
} gpio_regs[MAX_PORT];
extern char *_platform_gpio_table(int length);
int h8300_reserved_gpio(int port, unsigned int bits)
{
unsigned char *used;
if (port < 0 || port >= MAX_PORT)
return -1;
used = &(gpio_regs[port].used);
if ((*used & bits) != 0)
return 0;
*used |= bits;
return 1;
}
int h8300_free_gpio(int port, unsigned int bits)
{
unsigned char *used;
if (port < 0 || port >= MAX_PORT)
return -1;
used = &(gpio_regs[port].used);
if ((*used & bits) != bits)
return 0;
*used &= (~bits);
return 1;
}
int h8300_set_gpio_dir(int port_bit,int dir)
{
int port = (port_bit >> 8) & 0xff;
int bit = port_bit & 0xff;
if (ddrs[port] == NULL)
return 0;
if (gpio_regs[port].used & bit) {
if (dir)
gpio_regs[port].ddr |= bit;
else
gpio_regs[port].ddr &= ~bit;
*ddrs[port] = gpio_regs[port].ddr;
return 1;
} else
return 0;
}
int h8300_get_gpio_dir(int port_bit)
{
int port = (port_bit >> 8) & 0xff;
int bit = port_bit & 0xff;
if (ddrs[port] == NULL)
return 0;
if (gpio_regs[port].used & bit) {
return (gpio_regs[port].ddr & bit) != 0;
} else
return -1;
}
#if defined(CONFIG_PROC_FS)
static char *port_status(int portno)
{
static char result[10];
const static char io[2]={'I','O'};
char *rp;
int c;
unsigned char used,ddr;
used = gpio_regs[portno].used;
ddr = gpio_regs[portno].ddr;
result[8]='\0';
rp = result + 7;
for (c = 8; c > 0; c--,rp--,used >>= 1, ddr >>= 1)
if (used & 0x01)
*rp = io[ ddr & 0x01];
else
*rp = '-';
return result;
}
static int gpio_proc_read(char *buf, char **start, off_t offset,
int len, int *unused_i, void *unused_v)
{
int c,outlen;
const static char port_name[]="123456789ABCDEFGH";
outlen = 0;
for (c = 0; c < MAX_PORT; c++) {
if (ddrs[c] == NULL)
continue ;
len = sprintf(buf,"P%c: %s\n",port_name[c],port_status(c));
buf += len;
outlen += len;
}
return outlen;
}
static __init int register_proc(void)
{
struct proc_dir_entry *proc_gpio;
proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL);
if (proc_gpio)
proc_gpio->read_proc = gpio_proc_read;
return proc_gpio != NULL;
}
__initcall(register_proc);
#endif
void __init h8300_gpio_init(void)
{
memcpy(gpio_regs,_platform_gpio_table(sizeof(gpio_regs)),sizeof(gpio_regs));
}
|
///////////////////////////////////////////////////////////////////////////////
// Name: wx/persist/treebook.h
// Purpose: persistence support for wxBookCtrl
// Author: Vadim Zeitlin
// Created: 2009-01-19
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PERSIST_TREEBOOK_H_
#define _WX_PERSIST_TREEBOOK_H_
#include "wx/persist/bookctrl.h"
#include "wx/arrstr.h"
#include "wx/treebook.h"
// ----------------------------------------------------------------------------
// string constants used by wxPersistentTreeBookCtrl
// ----------------------------------------------------------------------------
#define wxPERSIST_TREEBOOK_KIND "TreeBook"
// this key contains the indices of all expanded nodes in the tree book
// separated by wxPERSIST_TREEBOOK_EXPANDED_SEP
#define wxPERSIST_TREEBOOK_EXPANDED_BRANCHES "Expanded"
#define wxPERSIST_TREEBOOK_EXPANDED_SEP ','
// ----------------------------------------------------------------------------
// wxPersistentTreeBookCtrl: supports saving/restoring open tree branches
// ----------------------------------------------------------------------------
class wxPersistentTreeBookCtrl : public wxPersistentBookCtrl
{
public:
wxPersistentTreeBookCtrl(wxTreebook *book)
: wxPersistentBookCtrl(book)
{
}
virtual void Save() const wxOVERRIDE
{
const wxTreebook * const book = GetTreeBook();
wxString expanded;
const size_t count = book->GetPageCount();
for ( size_t n = 0; n < count; n++ )
{
if ( book->IsNodeExpanded(n) )
{
if ( !expanded.empty() )
expanded += wxPERSIST_TREEBOOK_EXPANDED_SEP;
expanded += wxString::Format("%u", static_cast<unsigned>(n));
}
}
SaveValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, expanded);
wxPersistentBookCtrl::Save();
}
virtual bool Restore() wxOVERRIDE
{
wxTreebook * const book = GetTreeBook();
wxString expanded;
if ( RestoreValue(wxPERSIST_TREEBOOK_EXPANDED_BRANCHES, &expanded) )
{
const wxArrayString
indices(wxSplit(expanded, wxPERSIST_TREEBOOK_EXPANDED_SEP));
const size_t pageCount = book->GetPageCount();
const size_t count = indices.size();
for ( size_t n = 0; n < count; n++ )
{
unsigned long idx;
if ( indices[n].ToULong(&idx) && idx < pageCount )
book->ExpandNode(idx);
}
}
return wxPersistentBookCtrl::Restore();
}
virtual wxString GetKind() const wxOVERRIDE { return wxPERSIST_TREEBOOK_KIND; }
wxTreebook *GetTreeBook() const { return static_cast<wxTreebook *>(Get()); }
};
inline wxPersistentObject *wxCreatePersistentObject(wxTreebook *book)
{
return new wxPersistentTreeBookCtrl(book);
}
#endif // _WX_PERSIST_TREEBOOK_H_
|
//
// GADBannerView.h
// Google Mobile Ads SDK
//
// Copyright 2011 Google Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <GoogleMobileAds/GADAdSize.h>
#import <GoogleMobileAds/GADAdSizeDelegate.h>
#import <GoogleMobileAds/GADBannerViewDelegate.h>
#import <GoogleMobileAds/GADInAppPurchaseDelegate.h>
#import <GoogleMobileAds/GADRequest.h>
#import <GoogleMobileAds/GADRequestError.h>
#import <GoogleMobileAds/GoogleMobileAdsDefines.h>
GAD_ASSUME_NONNULL_BEGIN
/// The view that displays banner ads. A minimum implementation to get an ad from within a
/// UIViewController class is:
///
/// <pre>
/// // Create and setup the ad view, specifying the size and origin at {0, 0}.
/// GADBannerView *adView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
/// adView.rootViewController = self;
/// adView.adUnitID = @"ID created when registering your app";
/// // Place the ad view onto the screen.
/// [self.view addSubview:adView];
/// // Request an ad without any additional targeting information.
/// [adView loadRequest:[GADRequest request]];
/// </pre>
@interface GADBannerView : UIView
#pragma mark Initialization
/// Initializes and returns a banner view with the specified ad size and origin relative to the
/// banner's superview.
- (instancetype)initWithAdSize:(GADAdSize)adSize origin:(CGPoint)origin;
/// Initializes and returns a banner view with the specified ad size placed at its superview's
/// origin.
- (instancetype)initWithAdSize:(GADAdSize)adSize;
#pragma mark Pre-Request
/// Required value created on the AdMob website. Create a new ad unit for every unique placement of
/// an ad in your application. Set this to the ID assigned for this placement. Ad units are
/// important for targeting and statistics.
///
/// Example AdMob ad unit ID: @"ca-app-pub-0123456789012345/0123456789"
@property(nonatomic, copy, GAD_NULLABLE) IBInspectable NSString *adUnitID;
/// Required reference to the current root view controller. For example the root view controller in
/// tab-based application would be the UITabViewController.
@property(nonatomic, weak, GAD_NULLABLE) IBOutlet UIViewController *rootViewController;
/// Required to set this banner view to a proper size. Never create your own GADAdSize directly. Use
/// one of the predefined standard ad sizes (such as kGADAdSizeBanner), or create one using the
/// GADAdSizeFromCGSize method. If not using mediation, then changing the adSize after an ad has
/// been shown will cause a new request (for an ad of the new size) to be sent. If using mediation,
/// then a new request may not be sent.
@property(nonatomic, assign) GADAdSize adSize;
/// Optional delegate object that receives state change notifications from this GADBannerView.
/// Typically this is a UIViewController.
@property(nonatomic, weak, GAD_NULLABLE) IBOutlet id<GADBannerViewDelegate> delegate;
/// Optional delegate that is notified when creatives cause the banner to change size.
@property(nonatomic, weak, GAD_NULLABLE) IBOutlet id<GADAdSizeDelegate> adSizeDelegate;
#pragma mark Making an Ad Request
/// Makes an ad request. The request object supplies targeting information.
- (void)loadRequest:(GADRequest *GAD_NULLABLE_TYPE)request;
/// A Boolean value that determines whether autoloading of ads in the receiver is enabled. If
/// enabled, you do not need to call the loadRequest: method to load ads.
@property(nonatomic, assign, getter=isAutoloadEnabled) IBInspectable BOOL autoloadEnabled;
#pragma mark Mediation
/// The ad network class name that fetched the current ad. Returns nil while the latest ad request
/// is in progress or if the latest ad request failed. For both standard and mediated Google AdMob
/// ads, this property returns @"GADMAdapterGoogleAdMobAds". For ads fetched via mediation custom
/// events, this property returns @"GADMAdapterCustomEvents".
@property(nonatomic, readonly, copy, GAD_NULLABLE) NSString *adNetworkClassName;
#pragma mark Deprecated
/// Indicates if the currently displayed ad (or most recent failure) was a result of auto refreshing
/// as specified on server. This property is set to NO after each loadRequest: method.
@property(nonatomic, readonly, assign) BOOL hasAutoRefreshed GAD_DEPRECATED_ATTRIBUTE;
/// Deprecated delegate. GADInAppPurchase has been deprecated.
@property(nonatomic, weak, GAD_NULLABLE)
IBOutlet id<GADInAppPurchaseDelegate> inAppPurchaseDelegate GAD_DEPRECATED_ATTRIBUTE;
/// The mediated ad network's underlying ad view. You may use this property to read the ad's actual
/// size and adjust this banner view's frame origin. However, modifying the banner view's frame size
/// triggers the Mobile Ads SDK to request a new ad. Only update the banner view's frame origin.
@property(nonatomic, readonly, weak, GAD_NULLABLE)
UIView *mediatedAdView GAD_DEPRECATED_MSG_ATTRIBUTE("Use adNetworkClassName.");
@end
GAD_ASSUME_NONNULL_END
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_
#define MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "media/base/audio_renderer_sink.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace media {
class AudioBus;
class ClocklessAudioSinkThread;
// Implementation of an AudioRendererSink that consumes the audio as fast as
// possible. This class does not support multiple Play()/Pause() events.
class MEDIA_EXPORT ClocklessAudioSink
: NON_EXPORTED_BASE(public AudioRendererSink) {
public:
ClocklessAudioSink();
// AudioRendererSink implementation.
virtual void Initialize(const AudioParameters& params,
RenderCallback* callback) OVERRIDE;
virtual void Start() OVERRIDE;
virtual void Stop() OVERRIDE;
virtual void Pause() OVERRIDE;
virtual void Play() OVERRIDE;
virtual bool SetVolume(double volume) OVERRIDE;
// Returns the time taken to consume all the audio.
base::TimeDelta render_time() { return playback_time_; }
protected:
virtual ~ClocklessAudioSink();
private:
scoped_ptr<ClocklessAudioSinkThread> thread_;
bool initialized_;
bool playing_;
// Time taken in last set of Render() calls.
base::TimeDelta playback_time_;
DISALLOW_COPY_AND_ASSIGN(ClocklessAudioSink);
};
} // namespace media
#endif // MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_
|
/* -*- mode: C; c-basic-offset: 3; -*- */
#include <assert.h>
#include "vtest.h"
/* Check the result of a unary operation. */
static void
check_result_for_unary(const irop_t *op, const test_data_t *data)
{
const opnd_t *result = &data->result;
const opnd_t *opnd = &data->opnds[0];
unsigned num_bits = result->vbits.num_bits;
vbits_t expected_vbits;
/* Only handle those undef-kinds that actually occur. */
switch (op->undef_kind) {
case UNDEF_ALL:
expected_vbits = undefined_vbits(num_bits);
break;
case UNDEF_SAME:
expected_vbits = opnd->vbits;
break;
case UNDEF_TRUNC:
expected_vbits = truncate_vbits(opnd->vbits, num_bits);
break;
case UNDEF_LEFT:
expected_vbits = left_vbits(opnd->vbits, num_bits);
break;
case UNDEF_UPPER:
assert(num_bits * 2 == opnd->vbits.num_bits);
expected_vbits = upper_vbits(opnd->vbits);
break;
case UNDEF_SEXT:
expected_vbits = sextend_vbits(opnd->vbits, num_bits);
break;
case UNDEF_ZEXT:
expected_vbits = zextend_vbits(opnd->vbits, num_bits);
break;
default:
panic(__func__);
}
if (! equal_vbits(result->vbits, expected_vbits))
complain(op, data, expected_vbits);
}
int
test_unary_op(const irop_t *op, test_data_t *data)
{
unsigned num_input_bits, bitpos;
int tests_done = 0;
num_input_bits = bitsof_irtype(data->opnds[0].type);
for (bitpos = 0; bitpos < num_input_bits; ++bitpos) {
data->opnds[0].vbits = onehot_vbits(bitpos, num_input_bits);
valgrind_execute_test(op, data);
check_result_for_unary(op, data);
tests_done++;
}
return tests_done;
}
|
/****************************************************************
The author of this software is David M. Gay.
Copyright (C) 1998 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
/* Please send bug reports to David M. Gay (dmg at acm dot org,
* with " at " changed at "@" and " dot " changed to "."). */
#include "gdtoaimp.h"
Bigint *
#ifdef KR_headers
sum(a, b) Bigint *a; Bigint *b;
#else
sum(Bigint *a, Bigint *b)
#endif
{
Bigint *c;
ULong carry, *xc, *xa, *xb, *xe, y;
#ifdef Pack_32
ULong z;
#endif
if (a->wds < b->wds) {
c = b; b = a; a = c;
}
c = Balloc(a->k);
c->wds = a->wds;
carry = 0;
xa = a->x;
xb = b->x;
xc = c->x;
xe = xc + b->wds;
#ifdef Pack_32
do {
y = (*xa & 0xffff) + (*xb & 0xffff) + carry;
carry = (y & 0x10000) >> 16;
z = (*xa++ >> 16) + (*xb++ >> 16) + carry;
carry = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
while(xc < xe);
xe += a->wds - b->wds;
while(xc < xe) {
y = (*xa & 0xffff) + carry;
carry = (y & 0x10000) >> 16;
z = (*xa++ >> 16) + carry;
carry = (z & 0x10000) >> 16;
Storeinc(xc, z, y);
}
#else
do {
y = *xa++ + *xb++ + carry;
carry = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
while(xc < xe);
xe += a->wds - b->wds;
while(xc < xe) {
y = *xa++ + carry;
carry = (y & 0x10000) >> 16;
*xc++ = y & 0xffff;
}
#endif
if (carry) {
if (c->wds == c->maxwds) {
b = Balloc(c->k + 1);
Bcopy(b, c);
Bfree(c);
c = b;
}
c->x[c->wds++] = 1;
}
return c;
}
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLE_ENVIRONMENTAL_SERVICE_H__
#define __BLE_ENVIRONMENTAL_SERVICE_H__
#include "ble/BLE.h"
/**
* @class EnvironmentalService
* @brief BLE Environmental Service. This service provides temperature, humidity and pressure measurement.
* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.environmental_sensing.xml
* Temperature: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.temperature.xml
* Humidity: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.humidity.xml
* Pressure: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.pressure.xml
*/
class EnvironmentalService {
public:
typedef int16_t TemperatureType_t;
typedef uint16_t HumidityType_t;
typedef uint32_t PressureType_t;
/**
* @brief EnvironmentalService constructor.
* @param ble Reference to BLE device.
* @param temperature_en Enable this characteristic.
* @param humidity_en Enable this characteristic.
* @param pressure_en Enable this characteristic.
*/
EnvironmentalService(BLE& _ble) :
ble(_ble),
temperatureCharacteristic(GattCharacteristic::UUID_TEMPERATURE_CHAR, &temperature),
humidityCharacteristic(GattCharacteristic::UUID_HUMIDITY_CHAR, &humidity),
pressureCharacteristic(GattCharacteristic::UUID_PRESSURE_CHAR, &pressure)
{
static bool serviceAdded = false; /* We should only ever need to add the information service once. */
if (serviceAdded) {
return;
}
GattCharacteristic *charTable[] = { &humidityCharacteristic,
&pressureCharacteristic,
&temperatureCharacteristic };
GattService environmentalService(GattService::UUID_ENVIRONMENTAL_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.gattServer().addService(environmentalService);
serviceAdded = true;
}
/**
* @brief Update humidity characteristic.
* @param newHumidityVal New humidity measurement.
*/
void updateHumidity(HumidityType_t newHumidityVal)
{
humidity = (HumidityType_t) (newHumidityVal * 100);
ble.gattServer().write(humidityCharacteristic.getValueHandle(), (uint8_t *) &humidity, sizeof(HumidityType_t));
}
/**
* @brief Update pressure characteristic.
* @param newPressureVal New pressure measurement.
*/
void updatePressure(PressureType_t newPressureVal)
{
pressure = (PressureType_t) (newPressureVal * 10);
ble.gattServer().write(pressureCharacteristic.getValueHandle(), (uint8_t *) &pressure, sizeof(PressureType_t));
}
/**
* @brief Update temperature characteristic.
* @param newTemperatureVal New temperature measurement.
*/
void updateTemperature(float newTemperatureVal)
{
temperature = (TemperatureType_t) (newTemperatureVal * 100);
ble.gattServer().write(temperatureCharacteristic.getValueHandle(), (uint8_t *) &temperature, sizeof(TemperatureType_t));
}
private:
BLE& ble;
TemperatureType_t temperature;
HumidityType_t humidity;
PressureType_t pressure;
ReadOnlyGattCharacteristic<TemperatureType_t> temperatureCharacteristic;
ReadOnlyGattCharacteristic<HumidityType_t> humidityCharacteristic;
ReadOnlyGattCharacteristic<PressureType_t> pressureCharacteristic;
};
#endif /* #ifndef __BLE_ENVIRONMENTAL_SERVICE_H__*/
|
/* Copyright 2019 Khader Syed
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum keyboard_layers {
_QWERTY,
_FNM
};
#define FNM MO(_FNM)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_DEL, KC_HOME,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSPC, KC_PGUP,
KC_GRV, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,
KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_SPC, FNM, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[_FNM] = LAYOUT(
KC_GESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_VOLD, KC_VOLU, KC_MFFD,
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD, RGB_SPI, KC_TRNS, KC_TRNS, RESET, KC_MRWD,
KC_TRNS, RGB_M_P, RGB_M_G, RGB_M_K, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, KC_TRNS, KC_TRNS, KC_MPLY, KC_TRNS,
AG_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BRID, KC_BRIU, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END
),
};
|
/* Functions for Linux Android as target machine for GNU C compiler.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "linux-protos.h"
bool
linux_libc_has_function (enum function_class fn_class)
{
if (OPTION_GLIBC)
return true;
if (OPTION_BIONIC)
if (fn_class == function_c94
|| fn_class == function_c99_misc
|| fn_class == function_sincos)
return true;
return false;
}
|
/*
* ebt_limit
*
* Authors:
* Tom Marshall <tommy@home.tig-grr.com>
*
* Mostly copied from netfilter's ipt_limit.c, see that file for
* more explanation
*
* September, 2003
*
*/
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_bridge/ebtables.h>
#include <linux/netfilter_bridge/ebt_limit.h>
static DEFINE_SPINLOCK(limit_lock);
#define MAX_CPJ (0xFFFFFFFF / (HZ*60*60*24))
#define _POW2_BELOW2(x) ((x)|((x)>>1))
#define _POW2_BELOW4(x) (_POW2_BELOW2(x)|_POW2_BELOW2((x)>>2))
#define _POW2_BELOW8(x) (_POW2_BELOW4(x)|_POW2_BELOW4((x)>>4))
#define _POW2_BELOW16(x) (_POW2_BELOW8(x)|_POW2_BELOW8((x)>>8))
#define _POW2_BELOW32(x) (_POW2_BELOW16(x)|_POW2_BELOW16((x)>>16))
#define POW2_BELOW32(x) ((_POW2_BELOW32(x)>>1) + 1)
#define CREDITS_PER_JIFFY POW2_BELOW32(MAX_CPJ)
static bool
ebt_limit_mt(const struct sk_buff *skb, const struct xt_match_param *par)
{
struct ebt_limit_info *info = (void *)par->matchinfo;
unsigned long now = jiffies;
spin_lock_bh(&limit_lock);
info->credit += (now - xchg(&info->prev, now)) * CREDITS_PER_JIFFY;
if (info->credit > info->credit_cap)
info->credit = info->credit_cap;
if (info->credit >= info->cost) {
/* We're not limited. */
info->credit -= info->cost;
spin_unlock_bh(&limit_lock);
return true;
}
spin_unlock_bh(&limit_lock);
return false;
}
/* Precision saver. */
static u_int32_t
user2credits(u_int32_t user)
{
/* If multiplying would overflow... */
if (user > 0xFFFFFFFF / (HZ*CREDITS_PER_JIFFY))
/* Divide first. */
return (user / EBT_LIMIT_SCALE) * HZ * CREDITS_PER_JIFFY;
return (user * HZ * CREDITS_PER_JIFFY) / EBT_LIMIT_SCALE;
}
static bool ebt_limit_mt_check(const struct xt_mtchk_param *par)
{
struct ebt_limit_info *info = par->matchinfo;
/* Check for overflow. */
if (info->burst == 0 ||
user2credits(info->avg * info->burst) < user2credits(info->avg)) {
printk("Overflow in ebt_limit, try lower: %u/%u\n",
info->avg, info->burst);
return false;
}
/* User avg in seconds * EBT_LIMIT_SCALE: convert to jiffies * 128. */
info->prev = jiffies;
info->credit = user2credits(info->avg * info->burst);
info->credit_cap = user2credits(info->avg * info->burst);
info->cost = user2credits(info->avg);
return true;
}
#ifdef CONFIG_COMPAT
/*
* no conversion function needed --
* only avg/burst have meaningful values in userspace.
*/
struct ebt_compat_limit_info {
compat_uint_t avg, burst;
compat_ulong_t prev;
compat_uint_t credit, credit_cap, cost;
};
#endif
static struct xt_match ebt_limit_mt_reg __read_mostly = {
.name = "limit",
.revision = 0,
.family = NFPROTO_BRIDGE,
.match = ebt_limit_mt,
.checkentry = ebt_limit_mt_check,
.matchsize = sizeof(struct ebt_limit_info),
#ifdef CONFIG_COMPAT
.compatsize = sizeof(struct ebt_compat_limit_info),
#endif
.me = THIS_MODULE,
};
static int __init ebt_limit_init(void)
{
return xt_register_match(&ebt_limit_mt_reg);
}
static void __exit ebt_limit_fini(void)
{
xt_unregister_match(&ebt_limit_mt_reg);
}
module_init(ebt_limit_init);
module_exit(ebt_limit_fini);
MODULE_DESCRIPTION("Ebtables: Rate-limit match");
MODULE_LICENSE("GPL");
|
#ifndef __ASM_SH_PROCESSOR_H
#define __ASM_SH_PROCESSOR_H
#include <asm/cpu-features.h>
#include <asm/segment.h>
#include <asm/cache.h>
#ifndef __ASSEMBLY__
/*
* CPU type and hardware bug flags. Kept separately for each CPU.
*
* Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
* in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
* for parsing the subtype in get_cpu_subtype().
*/
enum cpu_type {
/* SH-2 types */
CPU_SH7619,
/* SH-2A types */
CPU_SH7201, CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
/* SH-3 types */
CPU_SH7705, CPU_SH7706, CPU_SH7707,
CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
CPU_SH7720, CPU_SH7721, CPU_SH7729,
/* SH-4 types */
CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
/* SH-4A types */
CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SHX3,
/* SH4AL-DSP types */
CPU_SH7343, CPU_SH7722, CPU_SH7366,
/* SH-5 types */
CPU_SH5_101, CPU_SH5_103,
/* Unknown subtype */
CPU_SH_NONE
};
enum cpu_family {
CPU_FAMILY_SH2,
CPU_FAMILY_SH2A,
CPU_FAMILY_SH3,
CPU_FAMILY_SH4,
CPU_FAMILY_SH4A,
CPU_FAMILY_SH4AL_DSP,
CPU_FAMILY_SH5,
CPU_FAMILY_UNKNOWN,
};
/*
* TLB information structure
*
* Defined for both I and D tlb, per-processor.
*/
struct tlb_info {
unsigned long long next;
unsigned long long first;
unsigned long long last;
unsigned int entries;
unsigned int step;
unsigned long flags;
};
struct sh_cpuinfo {
unsigned int type, family;
int cut_major, cut_minor;
unsigned long loops_per_jiffy;
unsigned long asid_cache;
struct cache_info icache; /* Primary I-cache */
struct cache_info dcache; /* Primary D-cache */
struct cache_info scache; /* Secondary cache */
/* TLB info */
struct tlb_info itlb;
struct tlb_info dtlb;
#ifdef CONFIG_SMP
struct task_struct *idle;
#endif
unsigned int phys_bits;
unsigned long flags;
} __attribute__ ((aligned(L1_CACHE_BYTES)));
extern struct sh_cpuinfo cpu_data[];
#define boot_cpu_data cpu_data[0]
#define current_cpu_data cpu_data[smp_processor_id()]
#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
#define cpu_relax() barrier()
/* Forward decl */
struct seq_operations;
struct task_struct;
extern struct pt_regs fake_swapper_regs;
extern void cpu_init(void);
extern void cpu_probe(void);
/* arch/sh/kernel/process.c */
extern unsigned int xstate_size;
extern void free_thread_xstate(struct task_struct *);
extern struct kmem_cache *task_xstate_cachep;
/* arch/sh/mm/alignment.c */
extern int get_unalign_ctl(struct task_struct *, unsigned long addr);
extern int set_unalign_ctl(struct task_struct *, unsigned int val);
#define GET_UNALIGN_CTL(tsk, addr) get_unalign_ctl((tsk), (addr))
#define SET_UNALIGN_CTL(tsk, val) set_unalign_ctl((tsk), (val))
/* arch/sh/mm/init.c */
extern unsigned int mem_init_done;
/* arch/sh/kernel/setup.c */
const char *get_cpu_subtype(struct sh_cpuinfo *c);
extern const struct seq_operations cpuinfo_op;
/* thread_struct flags */
#define SH_THREAD_UAC_NOPRINT (1 << 0)
#define SH_THREAD_UAC_SIGBUS (1 << 1)
#define SH_THREAD_UAC_MASK (SH_THREAD_UAC_NOPRINT | SH_THREAD_UAC_SIGBUS)
/* processor boot mode configuration */
#define MODE_PIN0 (1 << 0)
#define MODE_PIN1 (1 << 1)
#define MODE_PIN2 (1 << 2)
#define MODE_PIN3 (1 << 3)
#define MODE_PIN4 (1 << 4)
#define MODE_PIN5 (1 << 5)
#define MODE_PIN6 (1 << 6)
#define MODE_PIN7 (1 << 7)
#define MODE_PIN8 (1 << 8)
#define MODE_PIN9 (1 << 9)
#define MODE_PIN10 (1 << 10)
#define MODE_PIN11 (1 << 11)
#define MODE_PIN12 (1 << 12)
#define MODE_PIN13 (1 << 13)
#define MODE_PIN14 (1 << 14)
#define MODE_PIN15 (1 << 15)
int generic_mode_pins(void);
int test_mode_pin(int pin);
#ifdef CONFIG_VSYSCALL
int vsyscall_init(void);
#else
#define vsyscall_init() do { } while (0)
#endif
#endif /* __ASSEMBLY__ */
#ifdef CONFIG_SUPERH32
# include "processor_32.h"
#else
# include "processor_64.h"
#endif
#endif /* __ASM_SH_PROCESSOR_H */
|
/*
* tcpprobe - Observe the TCP flow with kprobes.
*
* The idea for this came from Werner Almesberger's umlsim
* Copyright (C) 2004, Stephen Hemminger <shemminger@osdl.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/kernel.h>
#include <linux/kprobes.h>
#include <linux/socket.h>
#include <linux/tcp.h>
#include <linux/proc_fs.h>
#include <linux/module.h>
#include <linux/ktime.h>
#include <linux/time.h>
#include <net/net_namespace.h>
#include <net/tcp.h>
MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
MODULE_DESCRIPTION("TCP cwnd snooper");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.1");
static int port __read_mostly = 0;
MODULE_PARM_DESC(port, "Port to match (0=all)");
module_param(port, int, 0);
static int bufsize __read_mostly = 4096;
MODULE_PARM_DESC(bufsize, "Log buffer size in packets (4096)");
module_param(bufsize, int, 0);
static int full __read_mostly;
MODULE_PARM_DESC(full, "Full log (1=every ack packet received, 0=only cwnd changes)");
module_param(full, int, 0);
static const char procname[] = "tcpprobe";
struct tcp_log {
ktime_t tstamp;
__be32 saddr, daddr;
__be16 sport, dport;
u16 length;
u32 snd_nxt;
u32 snd_una;
u32 snd_wnd;
u32 snd_cwnd;
u32 ssthresh;
u32 srtt;
};
static struct {
spinlock_t lock;
wait_queue_head_t wait;
ktime_t start;
u32 lastcwnd;
unsigned long head, tail;
struct tcp_log *log;
} tcp_probe;
static inline int tcp_probe_used(void)
{
return (tcp_probe.head - tcp_probe.tail) % bufsize;
}
static inline int tcp_probe_avail(void)
{
return bufsize - tcp_probe_used();
}
/*
* Hook inserted to be called before each receive packet.
* Note: arguments must match tcp_rcv_established()!
*/
static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
struct tcphdr *th, unsigned len)
{
const struct tcp_sock *tp = tcp_sk(sk);
const struct inet_sock *inet = inet_sk(sk);
/* Only update if port matches */
if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port)
&& (full || tp->snd_cwnd != tcp_probe.lastcwnd)) {
spin_lock(&tcp_probe.lock);
/* If log fills, just silently drop */
if (tcp_probe_avail() > 1) {
struct tcp_log *p = tcp_probe.log + tcp_probe.head;
p->tstamp = ktime_get();
p->saddr = inet->saddr;
p->sport = inet->sport;
p->daddr = inet->daddr;
p->dport = inet->dport;
p->length = skb->len;
p->snd_nxt = tp->snd_nxt;
p->snd_una = tp->snd_una;
p->snd_cwnd = tp->snd_cwnd;
p->snd_wnd = tp->snd_wnd;
p->ssthresh = tcp_current_ssthresh(sk);
p->srtt = tp->srtt >> 3;
tcp_probe.head = (tcp_probe.head + 1) % bufsize;
}
tcp_probe.lastcwnd = tp->snd_cwnd;
spin_unlock(&tcp_probe.lock);
wake_up(&tcp_probe.wait);
}
jprobe_return();
return 0;
}
static struct jprobe tcp_jprobe = {
.kp = {
.symbol_name = "tcp_rcv_established",
},
.entry = jtcp_rcv_established,
};
static int tcpprobe_open(struct inode * inode, struct file * file)
{
/* Reset (empty) log */
spin_lock_bh(&tcp_probe.lock);
tcp_probe.head = tcp_probe.tail = 0;
tcp_probe.start = ktime_get();
spin_unlock_bh(&tcp_probe.lock);
return 0;
}
static int tcpprobe_sprint(char *tbuf, int n)
{
const struct tcp_log *p
= tcp_probe.log + tcp_probe.tail % bufsize;
struct timespec tv
= ktime_to_timespec(ktime_sub(p->tstamp, tcp_probe.start));
return snprintf(tbuf, n,
"%lu.%09lu " NIPQUAD_FMT ":%u " NIPQUAD_FMT ":%u"
" %d %#x %#x %u %u %u %u\n",
(unsigned long) tv.tv_sec,
(unsigned long) tv.tv_nsec,
NIPQUAD(p->saddr), ntohs(p->sport),
NIPQUAD(p->daddr), ntohs(p->dport),
p->length, p->snd_nxt, p->snd_una,
p->snd_cwnd, p->ssthresh, p->snd_wnd, p->srtt);
}
static ssize_t tcpprobe_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos)
{
int error = 0, cnt = 0;
if (!buf || len < 0)
return -EINVAL;
while (cnt < len) {
char tbuf[128];
int width;
/* Wait for data in buffer */
error = wait_event_interruptible(tcp_probe.wait,
tcp_probe_used() > 0);
if (error)
break;
spin_lock_bh(&tcp_probe.lock);
if (tcp_probe.head == tcp_probe.tail) {
/* multiple readers race? */
spin_unlock_bh(&tcp_probe.lock);
continue;
}
width = tcpprobe_sprint(tbuf, sizeof(tbuf));
if (cnt + width < len)
tcp_probe.tail = (tcp_probe.tail + 1) % bufsize;
spin_unlock_bh(&tcp_probe.lock);
/* if record greater than space available
return partial buffer (so far) */
if (cnt + width >= len)
break;
if (copy_to_user(buf + cnt, tbuf, width))
return -EFAULT;
cnt += width;
}
return cnt == 0 ? error : cnt;
}
static const struct file_operations tcpprobe_fops = {
.owner = THIS_MODULE,
.open = tcpprobe_open,
.read = tcpprobe_read,
};
static __init int tcpprobe_init(void)
{
int ret = -ENOMEM;
init_waitqueue_head(&tcp_probe.wait);
spin_lock_init(&tcp_probe.lock);
if (bufsize < 0)
return -EINVAL;
tcp_probe.log = kcalloc(bufsize, sizeof(struct tcp_log), GFP_KERNEL);
if (!tcp_probe.log)
goto err0;
if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &tcpprobe_fops))
goto err0;
ret = register_jprobe(&tcp_jprobe);
if (ret)
goto err1;
pr_info("TCP probe registered (port=%d)\n", port);
return 0;
err1:
proc_net_remove(&init_net, procname);
err0:
kfree(tcp_probe.log);
return ret;
}
module_init(tcpprobe_init);
static __exit void tcpprobe_exit(void)
{
proc_net_remove(&init_net, procname);
unregister_jprobe(&tcp_jprobe);
kfree(tcp_probe.log);
}
module_exit(tcpprobe_exit);
|
/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
Used by <stdlib.h> and <math.h> functions for overflow.
SH version.
Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MATH_H
# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
#endif
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
#if __GNUC_PREREQ(3,3)
# define HUGE_VAL (__builtin_huge_val())
#elif __GNUC_PREREQ(2,96)
# define HUGE_VAL (__extension__ 0x1.0p2047)
#elif defined __GNUC__
# define HUGE_VAL \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
{ __l: 0x000000007ff00000ULL }).__d)
#else /* not GCC */
# include <endian.h>
typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
# if __BYTE_ORDER == __BIG_ENDIAN
# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
# endif
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define __HUGE_VAL_bytes { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
# endif
static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
# define HUGE_VAL (__huge_val.__d)
#endif /* GCC. */
|
/*
* Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef __BFA_DEFS_ADAPTER_H__
#define __BFA_DEFS_ADAPTER_H__
#include <protocol/types.h>
#include <defs/bfa_defs_version.h>
#include <defs/bfa_defs_mfg.h>
/**
* BFA adapter level attributes.
*/
enum {
BFA_ADAPTER_SERIAL_NUM_LEN = STRSZ(BFA_MFG_SERIALNUM_SIZE),
/*
*!< adapter serial num length
*/
BFA_ADAPTER_MODEL_NAME_LEN = 16, /* model name length */
BFA_ADAPTER_MODEL_DESCR_LEN = 128, /* model description length */
BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */
BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */
BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */
};
struct bfa_adapter_attr_s {
char manufacturer[BFA_ADAPTER_MFG_NAME_LEN];
char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
u32 rsvd1;
char model[BFA_ADAPTER_MODEL_NAME_LEN];
char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN];
wwn_t pwwn;
char node_symname[FC_SYMNAME_MAX];
char hw_ver[BFA_VERSION_LEN];
char fw_ver[BFA_VERSION_LEN];
char optrom_ver[BFA_VERSION_LEN];
char os_type[BFA_ADAPTER_OS_TYPE_LEN];
struct bfa_mfg_vpd_s vpd;
struct mac_s mac;
u8 nports;
u8 max_speed;
u8 prototype;
char asic_rev;
u8 pcie_gen;
u8 pcie_lanes_orig;
u8 pcie_lanes;
u8 cna_capable;
};
/**
* BFA adapter level events
* Arguments below are in BFAL context from Mgmt
* BFA_PORT_AEN_ADD: [in]: None [out]: serial_num, pwwn, nports
* BFA_PORT_AEN_REMOVE: [in]: pwwn [out]: serial_num, pwwn, nports
*/
enum bfa_adapter_aen_event {
BFA_ADAPTER_AEN_ADD = 1, /* New Adapter found event */
BFA_ADAPTER_AEN_REMOVE = 2, /* Adapter removed event */
};
struct bfa_adapter_aen_data_s {
char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
u32 nports; /* Number of NPorts */
wwn_t pwwn; /* WWN of one of its physical port */
};
#endif /* __BFA_DEFS_ADAPTER_H__ */
|
/* Copyright 2020 Koichi Katano
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_tkl_ansi(
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
)
};
|
//===-- asan_activation.h ---------------------------------------*- C++ -*-===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
// ASan activation/deactivation logic.
//===----------------------------------------------------------------------===//
#ifndef ASAN_ACTIVATION_H
#define ASAN_ACTIVATION_H
namespace __asan {
void AsanStartDeactivated();
void AsanActivate();
} // namespace __asan
#endif // ASAN_ACTIVATION_H
|
/* Hash routine.
Copyright (C) 1998 Kunihiro Ishiguro
This file is part of GNU Zebra.
GNU Zebra 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.
GNU Zebra is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Zebra; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _ZEBRA_HASH_H
#define _ZEBRA_HASH_H
/* Default hash table size. */
#define HASH_INITIAL_SIZE 256 /* initial number of backets. */
#define HASH_THRESHOLD 10 /* expand when backet. */
struct hash_backet
{
/* Linked list. */
struct hash_backet *next;
/* Hash key. */
unsigned int key;
/* Data. */
void *data;
};
struct hash
{
/* Hash backet. */
struct hash_backet **index;
/* Hash table size. Must be power of 2 */
unsigned int size;
/* If expansion failed. */
int no_expand;
/* Key make function. */
unsigned int (*hash_key) (void *);
/* Data compare function. */
int (*hash_cmp) (const void *, const void *);
/* Backet alloc. */
unsigned long count;
};
extern struct hash *hash_create (unsigned int (*) (void *),
int (*) (const void *, const void *));
extern struct hash *hash_create_size (unsigned int, unsigned int (*) (void *),
int (*) (const void *, const void *));
extern void *hash_get (struct hash *, void *, void * (*) (void *));
extern void *hash_alloc_intern (void *);
extern void *hash_lookup (struct hash *, void *);
extern void *hash_release (struct hash *, void *);
extern void hash_iterate (struct hash *,
void (*) (struct hash_backet *, void *), void *);
extern void hash_clean (struct hash *, void (*) (void *));
extern void hash_free (struct hash *);
extern unsigned int string_hash_make (const char *);
#endif /* _ZEBRA_HASH_H */
|
/* This file is part of the program psim.
Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _BASICS_H_
#define _BASICS_H_
/* from Michael Meissner, macro's to handle concating symbols better */
#if defined(__STDC__) || defined(ALMOST_STDC)
#define CONCAT2(a,b) a##b
#define CONCAT3(a,b,c) a##b##c
#define CONCAT4(a,b,c,d) a##b##c##d
#else
#define CONCAT2(a,b) a/**/b
#define CONCAT3(a,b,c) a/**/b/**/c
#define CONCAT4(a,b,c,d) a/**/b/**/c/**/d
#endif
#define XCONCAT2(a,b) CONCAT2(a,b)
#define XCONCAT3(a,b,c) CONCAT3(a,b,c)
#define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d)
/* many things pass around the cpu and psim object with out knowing
what it is */
typedef struct _cpu cpu;
typedef struct _psim psim;
typedef struct _device device;
typedef struct _device_instance device_instance;
typedef struct _event_queue event_queue;
typedef struct _event_entry_tag *event_entry_tag;
/* many things are moving data between the host and target */
typedef enum {
cooked_transfer,
raw_transfer,
} transfer_mode;
/* possible exit statuses */
typedef enum {
was_continuing, was_trap, was_exited, was_signalled
} stop_reason;
/* disposition of an object when things are next restarted */
typedef enum {
permenant_object,
tempoary_object,
} object_disposition;
/* directions */
typedef enum {
bidirect_port,
input_port,
output_port,
} port_direction;
/* Basic configuration */
#include "config.h"
#include "ppc-config.h"
#include "inline.h"
/* Basic host dependant mess - hopefully <stdio.h> + <stdarg.h> will
bring potential conflicts out in the open */
#include <stdarg.h>
#include <stdio.h>
#ifndef NORETURN
#define NORETURN
#endif
#ifndef NULL
#define NULL 0
#endif
#if !defined (__attribute__)
#if (!defined(__GNUC__) \
|| (__GNUC__ < 2) \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 6))
#define __attribute__(arg)
#endif
#endif
#if !defined (UNUSED)
#if (!defined(__GNUC__) \
|| (__GNUC__ < 2) \
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 7))
#define UNUSED
#else
#define UNUSED __attribute__((__unused__))
#endif
#endif
/* Basic definitions - ordered so that nothing calls what comes after
it */
#include "sim_callbacks.h"
#include "debug.h"
#include "words.h"
#include "bits.h"
#include "sim-endian.h"
#endif /* _BASICS_H_ */
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2016 Chandan Kumar, IBM Corporation.
*/
#include <errno.h>
#include <libunwind.h>
#include <asm/perf_regs.h>
#include "../../util/unwind.h"
#include "../../util/debug.h"
int libunwind__arch_reg_id(int regnum)
{
switch (regnum) {
case UNW_PPC64_R0:
return PERF_REG_POWERPC_R0;
case UNW_PPC64_R1:
return PERF_REG_POWERPC_R1;
case UNW_PPC64_R2:
return PERF_REG_POWERPC_R2;
case UNW_PPC64_R3:
return PERF_REG_POWERPC_R3;
case UNW_PPC64_R4:
return PERF_REG_POWERPC_R4;
case UNW_PPC64_R5:
return PERF_REG_POWERPC_R5;
case UNW_PPC64_R6:
return PERF_REG_POWERPC_R6;
case UNW_PPC64_R7:
return PERF_REG_POWERPC_R7;
case UNW_PPC64_R8:
return PERF_REG_POWERPC_R8;
case UNW_PPC64_R9:
return PERF_REG_POWERPC_R9;
case UNW_PPC64_R10:
return PERF_REG_POWERPC_R10;
case UNW_PPC64_R11:
return PERF_REG_POWERPC_R11;
case UNW_PPC64_R12:
return PERF_REG_POWERPC_R12;
case UNW_PPC64_R13:
return PERF_REG_POWERPC_R13;
case UNW_PPC64_R14:
return PERF_REG_POWERPC_R14;
case UNW_PPC64_R15:
return PERF_REG_POWERPC_R15;
case UNW_PPC64_R16:
return PERF_REG_POWERPC_R16;
case UNW_PPC64_R17:
return PERF_REG_POWERPC_R17;
case UNW_PPC64_R18:
return PERF_REG_POWERPC_R18;
case UNW_PPC64_R19:
return PERF_REG_POWERPC_R19;
case UNW_PPC64_R20:
return PERF_REG_POWERPC_R20;
case UNW_PPC64_R21:
return PERF_REG_POWERPC_R21;
case UNW_PPC64_R22:
return PERF_REG_POWERPC_R22;
case UNW_PPC64_R23:
return PERF_REG_POWERPC_R23;
case UNW_PPC64_R24:
return PERF_REG_POWERPC_R24;
case UNW_PPC64_R25:
return PERF_REG_POWERPC_R25;
case UNW_PPC64_R26:
return PERF_REG_POWERPC_R26;
case UNW_PPC64_R27:
return PERF_REG_POWERPC_R27;
case UNW_PPC64_R28:
return PERF_REG_POWERPC_R28;
case UNW_PPC64_R29:
return PERF_REG_POWERPC_R29;
case UNW_PPC64_R30:
return PERF_REG_POWERPC_R30;
case UNW_PPC64_R31:
return PERF_REG_POWERPC_R31;
case UNW_PPC64_LR:
return PERF_REG_POWERPC_LINK;
case UNW_PPC64_CTR:
return PERF_REG_POWERPC_CTR;
case UNW_PPC64_XER:
return PERF_REG_POWERPC_XER;
case UNW_PPC64_NIP:
return PERF_REG_POWERPC_NIP;
default:
pr_err("unwind: invalid reg id %d\n", regnum);
return -EINVAL;
}
return -EINVAL;
}
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* spu hypervisor abstraction for direct hardware access.
*
* Copyright (C) 2006 Sony Computer Entertainment Inc.
* Copyright 2006 Sony Corp.
*/
#ifndef SPU_PRIV1_MMIO_H
#define SPU_PRIV1_MMIO_H
struct device_node *spu_devnode(struct spu *spu);
#endif /* SPU_PRIV1_MMIO_H */
|
/*
* Copyright © 2007 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef _RRTRANSFORM_H_
#define _RRTRANSFORM_H_
#include <X11/extensions/randr.h>
#include "picturestr.h"
typedef struct _rrTransform RRTransformRec, *RRTransformPtr;
struct _rrTransform {
PictTransform transform;
struct pict_f_transform f_transform;
struct pict_f_transform f_inverse;
PictFilterPtr filter;
xFixed *params;
int nparams;
int width;
int height;
};
extern _X_EXPORT void
RRTransformInit(RRTransformPtr transform);
extern _X_EXPORT void
RRTransformFini(RRTransformPtr transform);
extern _X_EXPORT Bool
RRTransformEqual(RRTransformPtr a, RRTransformPtr b);
extern _X_EXPORT Bool
RRTransformSetFilter(RRTransformPtr dst,
PictFilterPtr filter,
xFixed * params, int nparams, int width, int height);
extern _X_EXPORT Bool
RRTransformCopy(RRTransformPtr dst, RRTransformPtr src);
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
* offset.
*
* Return TRUE if the resulting transform is not a simple translation.
*/
extern _X_EXPORT Bool
RRTransformCompute(int x,
int y,
int width,
int height,
Rotation rotation,
RRTransformPtr rr_transform,
PictTransformPtr transform,
struct pict_f_transform *f_transform,
struct pict_f_transform *f_inverse);
#endif /* _RRTRANSFORM_H_ */
|
// SPDX-License-Identifier: GPL-2.0
/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.gnu.org/licenses/gpl-2.0.html
*
* GPL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2011, 2015 Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
#ifndef _MDC_INTERNAL_H
#define _MDC_INTERNAL_H
#include <lustre_mdc.h>
void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
__u64 valid, size_t ea_size, __u32 suppgid, u32 flags);
void mdc_swap_layouts_pack(struct ptlrpc_request *req,
struct md_op_data *op_data);
void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
const struct lu_fid *fid);
void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, u32 flags,
struct md_op_data *data, size_t ea_size);
void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
void *ea, size_t ealen);
void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
const void *data, size_t datalen, umode_t mode, uid_t uid,
gid_t gid, cfs_cap_t capability, __u64 rdev);
void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
umode_t mode, __u64 rdev, __u64 flags, const void *data,
size_t datalen);
void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
const char *old, size_t oldlen,
const char *new, size_t newlen);
void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data);
/* mdc/mdc_locks.c */
int mdc_set_lock_data(struct obd_export *exp,
const struct lustre_handle *lockh,
void *data, __u64 *bits);
int mdc_null_inode(struct obd_export *exp, const struct lu_fid *fid);
int mdc_intent_lock(struct obd_export *exp,
struct md_op_data *op_data,
struct lookup_intent *it,
struct ptlrpc_request **reqp,
ldlm_blocking_callback cb_blocking,
__u64 extra_lock_flags);
int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
const union ldlm_policy_data *policy,
struct lookup_intent *it, struct md_op_data *op_data,
struct lustre_handle *lockh, __u64 extra_lock_flags);
int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,
struct list_head *cancels, enum ldlm_mode mode,
__u64 bits);
/* mdc/mdc_request.c */
int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp,
struct lu_fid *fid, struct md_op_data *op_data);
struct obd_client_handle;
int mdc_set_open_replay_data(struct obd_export *exp,
struct obd_client_handle *och,
struct lookup_intent *it);
void mdc_commit_open(struct ptlrpc_request *req);
void mdc_replay_open(struct ptlrpc_request *req);
int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
const void *data, size_t datalen, umode_t mode, uid_t uid,
gid_t gid, cfs_cap_t capability, __u64 rdev,
struct ptlrpc_request **request);
int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
struct ptlrpc_request **request);
int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
const char *old, size_t oldlen,
const char *new, size_t newlen,
struct ptlrpc_request **request);
int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
void *ea, size_t ealen, struct ptlrpc_request **request);
int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
struct ptlrpc_request **request);
int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
union ldlm_policy_data *policy, enum ldlm_mode mode,
enum ldlm_cancel_flags flags, void *opaque);
int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
struct lu_fid *fid, __u64 *bits);
int mdc_intent_getattr_async(struct obd_export *exp,
struct md_enqueue_info *minfo);
enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags,
const struct lu_fid *fid, enum ldlm_type type,
union ldlm_policy_data *policy,
enum ldlm_mode mode,
struct lustre_handle *lockh);
static inline int mdc_prep_elc_req(struct obd_export *exp,
struct ptlrpc_request *req, int opc,
struct list_head *cancels, int count)
{
return ldlm_prep_elc_req(exp, req, LUSTRE_MDS_VERSION, opc, 0, cancels,
count);
}
static inline unsigned long hash_x_index(__u64 hash, int hash64)
{
if (BITS_PER_LONG == 32 && hash64)
hash >>= 32;
/* save hash 0 with hash 1 */
return ~0UL - (hash + !hash);
}
#endif
|
/*
===========================================================================
Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Doom 3 Source Code 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 Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
#pragma once
// CTearoffContainerWindow
class CTabsDlg;
class CTearoffContainerWindow : public CWnd
{
DECLARE_DYNAMIC(CTearoffContainerWindow)
public:
CTearoffContainerWindow();
virtual ~CTearoffContainerWindow();
CWnd* m_ContainedDialog; //dialog that is being docked/undocked
int m_DialogID; //identifier for this dialog
CTabsDlg* m_DockManager; //the dialog that contains m_ContainedDialog when docked
protected:
DECLARE_MESSAGE_MAP()
bool m_DragPreviewActive;
public:
afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
void SetDialog ( CWnd* dlg , int ID );
void SetDockManager ( CTabsDlg* dlg );
afx_msg void OnClose();
BOOL PreTranslateMessage( MSG* pMsg );
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnDestroy();
afx_msg void OnSetFocus(CWnd* pOldWnd);
};
|
/* -*- c++ -*- */
/*
* Copyright 2006 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_ATSC_FPLL_H
#define INCLUDED_ATSC_FPLL_H
#include <gnuradio/atsc/api.h>
#include <gnuradio/sync_block.h>
#include <gnuradio/nco.h>
#include <gnuradio/filter/single_pole_iir.h>
#include <gnuradio/analog/agc.h>
#include <stdio.h>
#include <gnuradio/atsc/diag_output_impl.h>
using namespace gr;
class atsc_fpll;
typedef boost::shared_ptr<atsc_fpll> atsc_fpll_sptr;
ATSC_API atsc_fpll_sptr atsc_make_fpll();
/*!
* \brief ATSC FPLL (2nd Version)
* \ingroup atsc
*
* A/D --> GrFIRfilterFFF ----> GrAtscFPLL ---->
*
* We use GrFIRfilterFFF to bandpass filter the signal of interest.
*
* This class accepts a single real input and produces a single real output
*/
class ATSC_API atsc_fpll : public gr::sync_block
{
friend ATSC_API atsc_fpll_sptr atsc_make_fpll();
atsc_fpll();
public:
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void reset() { /* nop */ }
void initialize () ;
protected:
double initial_freq;
double initial_phase;
bool debug_no_update;
gr::nco<float,float> nco;
analog::kernel::agc_ff agc; // automatic gain control
filter::single_pole_iir<float,float,float> afci;
filter::single_pole_iir<float,float,float> afcq;
};
#endif /* INCLUDED_ATSC_FPLL_H */
|
/*
* QEMU PowerPC 4xx emulation shared definitions
*
* Copyright (c) 2007 Jocelyn Mayer
*
* 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.
*/
#if !defined(PPC_4XX_H)
#define PPC_4XX_H
#include "pci.h"
/* PowerPC 4xx core initialization */
CPUState *ppc4xx_init (const char *cpu_model,
clk_setup_t *cpu_clk, clk_setup_t *tb_clk,
uint32_t sysclk);
/* PowerPC 4xx universal interrupt controller */
enum {
PPCUIC_OUTPUT_INT = 0,
PPCUIC_OUTPUT_CINT = 1,
PPCUIC_OUTPUT_NB,
};
qemu_irq *ppcuic_init (CPUState *env, qemu_irq *irqs,
uint32_t dcr_base, int has_ssr, int has_vr);
ram_addr_t ppc4xx_sdram_adjust(ram_addr_t ram_size, int nr_banks,
MemoryRegion ram_memories[],
target_phys_addr_t ram_bases[],
target_phys_addr_t ram_sizes[],
const unsigned int sdram_bank_sizes[]);
void ppc4xx_sdram_init (CPUState *env, qemu_irq irq, int nbanks,
MemoryRegion ram_memories[],
target_phys_addr_t *ram_bases,
target_phys_addr_t *ram_sizes,
int do_init);
PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
target_phys_addr_t config_space,
target_phys_addr_t int_ack,
target_phys_addr_t special_cycle,
target_phys_addr_t registers);
#endif /* !defined(PPC_4XX_H) */
|
/**
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <Foundation/Foundation.h>
# import <Parse/PFConstants.h>
typedef uint8_t PFLoggingTag;
@interface PFLogger : NSObject
@property (atomic, assign) PFLogLevel logLevel;
///--------------------------------------
#pragma mark - Shared Logger
///--------------------------------------
/**
A shared instance of `PFLogger` that should be used for all logging.
@return An shared singleton instance of `PFLogger`.
*/
+ (instancetype)sharedLogger; //TODO: (nlutsenko) Convert to use an instance everywhere instead of a shared singleton.
///--------------------------------------
#pragma mark - Logging Messages
///--------------------------------------
/**
Logs a message at a specific level for a tag.
If current logging level doesn't include this level - this method does nothing.
@param level Logging Level
@param tag Logging Tag
@param format Format to use for the log message.
*/
- (void)logMessageWithLevel:(PFLogLevel)level
tag:(PFLoggingTag)tag
format:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4);
@end
|
/*
* arch/arm/mach-sun5i/include/mach/dram.h
*/
#include <plat/dram.h>
|
/*
* Copyright (c) 2016, 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/module.h>
#include <linux/init.h>
#include <linux/kthread.h>
#include <linux/freezer.h>
#include <linux/sched.h>
#include <soc/qcom/smd.h>
#include "inv_icm20689_iio.h"
#if INV20689_SMD_IRQ_TRIGGER
#define TS_IMU_PORT_NAME "imu_timestamp"
#define TS_CHANNEL_TYPE SMD_APPS_MODEM
static smd_channel_t *imu_chan;
static struct completion work;
struct iio_trigger *inv_trig = NULL;
/* event handler of imu, called in smd_irq */
static void imu_smd_handler(void *priv, unsigned event)
{
uint64_t patten;
switch (event) {
case SMD_EVENT_OPEN:
complete(&work);
break;
case SMD_EVENT_CLOSE:
break;
case SMD_EVENT_DATA:
/* need to read data otherwise it would stop*/
smd_read_from_cb(imu_chan, &patten, sizeof(patten));
if (inv_trig)
iio_trigger_poll(inv_trig);
break;
}
}
int imu_ts_smd_channel_init(void)
{
int ret;
init_completion(&work);
ret = smd_named_open_on_edge(TS_IMU_PORT_NAME, TS_CHANNEL_TYPE,
&imu_chan, NULL, imu_smd_handler);
if (ret) {
pr_err("open channel %s failed\n", TS_IMU_PORT_NAME);
return ret;
}
ret = wait_for_completion_timeout(&work, 5*HZ);
if (!ret) {
pr_err("%s wait for completion failed\n", TS_IMU_PORT_NAME);
smd_close(imu_chan);
return ret;
}
return 0;
}
void imu_ts_smd_channel_close(void)
{
smd_close(imu_chan);
imu_chan = NULL;
}
#endif
|
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/delay.h>
#include <linux/clk.h>
#include <mach/board.h>
#include <mach/camera.h>
int msm_cam_clk_enable(struct device *dev, struct msm_cam_clk_info *clk_info,
struct clk **clk_ptr, int num_clk, int enable)
{
int i;
int rc = 0;
if (enable) {
for (i = 0; i < num_clk; i++) {
clk_ptr[i] = clk_get(dev, clk_info[i].clk_name);
if (IS_ERR(clk_ptr[i])) {
pr_err("%s get failed\n", clk_info[i].clk_name);
rc = PTR_ERR(clk_ptr[i]);
goto cam_clk_get_err;
}
if (clk_info[i].clk_rate >= 0) {
rc = clk_set_rate(clk_ptr[i],
clk_info[i].clk_rate);
if (rc < 0) {
pr_err("%s set failed rate %ld\n",
clk_info[i].clk_name, clk_info[i].clk_rate);
goto cam_clk_set_err;
}
}
rc = clk_enable(clk_ptr[i]);
if (rc < 0) {
pr_err("%s enable failed\n",
clk_info[i].clk_name);
goto cam_clk_set_err;
}
}
} else {
for (i = num_clk - 1; i >= 0; i--) {
if (clk_ptr[i] != NULL) {
clk_disable(clk_ptr[i]);
clk_put(clk_ptr[i]);
}
}
}
return rc;
cam_clk_set_err:
clk_put(clk_ptr[i]);
cam_clk_get_err:
for (i--; i >= 0; i--) {
if (clk_ptr[i] != NULL) {
clk_disable(clk_ptr[i]);
clk_put(clk_ptr[i]);
}
}
return rc;
}
|
#pragma once
namespace Javelin {
template<typename T>
class ColorRgb {
public:
T r;
T g;
T b;
ColorRgb()
: r(0)
, g(0)
, b(0) {
}
ColorRgb(T red, T green, T blue)
: r(red)
, g(green)
, b(blue) {
}
ColorRgb(const ColorRgb<T> &x)
: r(x.r)
, g(x.g)
, b(x.b) {
}
ColorRgb<int> operator *(int x) {
return ColorRgb<int>(r * x, g * x, b * x);
}
ColorRgb<int> operator +(const ColorRgb<T> &x) const {
return ColorRgb<int>(r + (int)x.r, g + (int)x.g, b + (int)x.b);
}
ColorRgb<int> operator -(const ColorRgb<T> &x) const {
return ColorRgb<int>(r - (int)x.r, g - (int)x.g, b - (int)x.b);
}
int operator %(const ColorRgb<T> &x) const {
return r * (int)x.r + g * (int)x.g + b * (int)x.b;
}
bool operator ==(const ColorRgb<T> &x) const {
return r == x.r && g == x.g && b == x.b;
}
bool operator !=(const ColorRgb<T> &x) const {
return r != x.r || g != x.g || b != x.b;
}
void SetMin(const ColorRgb<T> &x) {
if (x.r < r) {
r = x.r;
}
if (x.g < g) {
g = x.g;
}
if (x.b < b) {
b = x.b;
}
}
void SetMax(const ColorRgb<T> &x) {
if (x.r > r) {
r = x.r;
}
if (x.g > g) {
g = x.g;
}
if (x.b > b) {
b = x.b;
}
}
};
template<typename T>
class ColorRgba : public ColorRgb<T> {
public:
T a;
ColorRgba() :
a(0) {
}
ColorRgba(T red, T green, T blue, T alpha)
: ColorRgb<T>(red, green, blue)
, a(alpha) {
}
ColorRgba(const ColorRgba<T> &x)
: ColorRgb<T>(x.r, x.g, x.b)
, a(x.a) {
}
ColorRgba<int> operator *(int x) {
return ColorRgba<T>(ColorRgb<T>::r * x,
ColorRgb<T>::g * x,
ColorRgb<T>::b * x,
a * x);
}
ColorRgba<int> operator +(const ColorRgba<T> &x) {
return ColorRgba<T>(ColorRgb<T>::r + (int)x.r,
ColorRgb<T>::g + (int)x.g,
ColorRgb<T>::b + (int)x.b,
a + (int)x.a);
}
ColorRgba<int> operator -(const ColorRgba<T> &x) {
return ColorRgba<T>(ColorRgb<T>::r - (int)x.r,
ColorRgb<T>::g - (int)x.g,
ColorRgb<T>::b - (int)x.b,
a - (int)x.a);
}
int operator %(const ColorRgba<T> &x) {
return ColorRgb<T>::r * (int)x.r +
ColorRgb<T>::g * (int)x.g +
ColorRgb<T>::b * (int)x.b +
a * (int)x.a;
}
bool operator ==(const ColorRgba<T> &x) {
return ColorRgb<T>::r == x.r && ColorRgb<T>::g == x.g &&
ColorRgb<T>::b == x.b && a == x.a;
}
bool operator !=(const ColorRgba<T> &x) {
return ColorRgb<T>::r != x.r || ColorRgb<T>::g != x.g ||
ColorRgb<T>::b != x.b || a != x.a;
}
void SetMin(const ColorRgba<T> &x) {
ColorRgb<T>::SetMin(x);
if (x.a < a) {
a = x.a;
}
}
void SetMax(const ColorRgba<T> &x) {
ColorRgb<T>::SetMax(x);
if (x.a > a) {
a = x.a;
}
}
};
}
|
/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
* GPL HEADER END
*/
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/obdclass/lu_object.c
*
* Lustre Object.
* These are the only exported functions, they provide some generic
* infrastructure for managing object devices
*
* Author: Nikita Danilov <nikita.danilov@sun.com>
*/
#define DEBUG_SUBSYSTEM S_CLASS
#include <linux/libcfs/libcfs.h>
#include <obd_support.h>
#include <lu_object.h>
#include <md_object.h>
/* context key constructor/destructor: lu_ucred_key_init, lu_ucred_key_fini */
LU_KEY_INIT_FINI(lu_ucred, struct lu_ucred);
static struct lu_context_key lu_ucred_key = {
.lct_tags = LCT_SESSION,
.lct_init = lu_ucred_key_init,
.lct_fini = lu_ucred_key_fini
};
/**
* Get ucred key if session exists and ucred key is allocated on it.
* Return NULL otherwise.
*/
struct lu_ucred *lu_ucred(const struct lu_env *env)
{
if (!env->le_ses)
return NULL;
return lu_context_key_get(env->le_ses, &lu_ucred_key);
}
EXPORT_SYMBOL(lu_ucred);
/**
* Get ucred key and check if it is properly initialized.
* Return NULL otherwise.
*/
struct lu_ucred *lu_ucred_check(const struct lu_env *env)
{
struct lu_ucred *uc = lu_ucred(env);
if (uc && uc->uc_valid != UCRED_OLD && uc->uc_valid != UCRED_NEW)
return NULL;
return uc;
}
EXPORT_SYMBOL(lu_ucred_check);
/**
* Get ucred key, which must exist and must be properly initialized.
* Assert otherwise.
*/
struct lu_ucred *lu_ucred_assert(const struct lu_env *env)
{
struct lu_ucred *uc = lu_ucred_check(env);
LASSERT(uc != NULL);
return uc;
}
EXPORT_SYMBOL(lu_ucred_assert);
int lu_ucred_global_init(void)
{
LU_CONTEXT_KEY_INIT(&lu_ucred_key);
return lu_context_key_register(&lu_ucred_key);
}
void lu_ucred_global_fini(void)
{
lu_context_key_degister(&lu_ucred_key);
}
|
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#import <Bolts/BoltsVersion.h>
#import <Bolts/BFExecutor.h>
#import <Bolts/BFTask.h>
#import <Bolts/BFTaskCompletionSource.h>
#if __has_include(<Bolts/BFAppLink.h>) && TARGET_OS_IPHONE
#import <Bolts/BFAppLinkNavigation.h>
#import <Bolts/BFAppLink.h>
#import <Bolts/BFAppLinkResolving.h>
#import <Bolts/BFAppLinkReturnToRefererController.h>
#import <Bolts/BFAppLinkReturnToRefererView.h>
#import <Bolts/BFAppLinkTarget.h>
#import <Bolts/BFMeasurementEvent.h>
#import <Bolts/BFURL.h>
#import <Bolts/BFWebViewAppLinkResolver.h>
#endif
/*! @abstract 80175001: There were multiple errors. */
extern NSInteger const kBFMultipleErrorsError;
@interface Bolts : NSObject
/*!
Returns the version of the Bolts Framework as an NSString.
@returns The NSString representation of the current version.
*/
+ (NSString *)version;
@end
|
/* kafstimod.h: AFS timeout daemon
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _LINUX_AFS_KAFSTIMOD_H
#define _LINUX_AFS_KAFSTIMOD_H
#include "types.h"
struct afs_timer;
struct afs_timer_ops {
/* called when the front of the timer queue has timed out */
void (*timed_out)(struct afs_timer *timer);
};
/*****************************************************************************/
/*
* AFS timer/timeout record
*/
struct afs_timer
{
struct list_head link; /* link in timer queue */
unsigned long timo_jif; /* timeout time */
const struct afs_timer_ops *ops; /* timeout expiry function */
};
static inline void afs_timer_init(struct afs_timer *timer,
const struct afs_timer_ops *ops)
{
INIT_LIST_HEAD(&timer->link);
timer->ops = ops;
}
extern int afs_kafstimod_start(void);
extern void afs_kafstimod_stop(void);
extern void afs_kafstimod_add_timer(struct afs_timer *timer,
unsigned long timeout);
extern int afs_kafstimod_del_timer(struct afs_timer *timer);
#endif /* _LINUX_AFS_KAFSTIMOD_H */
|
// SPDX-License-Identifier: GPL-2.0
#include <linux/compiler.h>
#include <linux/context_tracking.h>
#include <linux/errno.h>
#include <linux/nospec.h>
#include <linux/ptrace.h>
#include <linux/syscalls.h>
#include <asm/daifflags.h>
#include <asm/debug-monitors.h>
#include <asm/fpsimd.h>
#include <asm/syscall.h>
#include <asm/thread_info.h>
#include <asm/unistd.h>
long compat_arm_syscall(struct pt_regs *regs, int scno);
long sys_ni_syscall(void);
static long do_ni_syscall(struct pt_regs *regs, int scno)
{
#ifdef CONFIG_COMPAT
long ret;
if (is_compat_task()) {
ret = compat_arm_syscall(regs, scno);
if (ret != -ENOSYS)
return ret;
}
#endif
return sys_ni_syscall();
}
static long __invoke_syscall(struct pt_regs *regs, syscall_fn_t syscall_fn)
{
return syscall_fn(regs);
}
static void invoke_syscall(struct pt_regs *regs, unsigned int scno,
unsigned int sc_nr,
const syscall_fn_t syscall_table[])
{
long ret;
if (scno < sc_nr) {
syscall_fn_t syscall_fn;
syscall_fn = syscall_table[array_index_nospec(scno, sc_nr)];
ret = __invoke_syscall(regs, syscall_fn);
} else {
ret = do_ni_syscall(regs, scno);
}
regs->regs[0] = ret;
}
static inline bool has_syscall_work(unsigned long flags)
{
return unlikely(flags & _TIF_SYSCALL_WORK);
}
int syscall_trace_enter(struct pt_regs *regs);
void syscall_trace_exit(struct pt_regs *regs);
#ifdef CONFIG_ARM64_ERRATUM_1463225
DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa);
static void cortex_a76_erratum_1463225_svc_handler(void)
{
u32 reg, val;
if (!unlikely(test_thread_flag(TIF_SINGLESTEP)))
return;
if (!unlikely(this_cpu_has_cap(ARM64_WORKAROUND_1463225)))
return;
__this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 1);
reg = read_sysreg(mdscr_el1);
val = reg | DBG_MDSCR_SS | DBG_MDSCR_KDE;
write_sysreg(val, mdscr_el1);
asm volatile("msr daifclr, #8");
isb();
/* We will have taken a single-step exception by this point */
write_sysreg(reg, mdscr_el1);
__this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 0);
}
#else
static void cortex_a76_erratum_1463225_svc_handler(void) { }
#endif /* CONFIG_ARM64_ERRATUM_1463225 */
static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
const syscall_fn_t syscall_table[])
{
unsigned long flags = current_thread_info()->flags;
regs->orig_x0 = regs->regs[0];
regs->syscallno = scno;
cortex_a76_erratum_1463225_svc_handler();
local_daif_restore(DAIF_PROCCTX);
user_exit();
if (has_syscall_work(flags)) {
/* set default errno for user-issued syscall(-1) */
if (scno == NO_SYSCALL)
regs->regs[0] = -ENOSYS;
scno = syscall_trace_enter(regs);
if (scno == NO_SYSCALL)
goto trace_exit;
}
invoke_syscall(regs, scno, sc_nr, syscall_table);
/*
* The tracing status may have changed under our feet, so we have to
* check again. However, if we were tracing entry, then we always trace
* exit regardless, as the old entry assembly did.
*/
if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) {
local_daif_mask();
flags = current_thread_info()->flags;
if (!has_syscall_work(flags)) {
/*
* We're off to userspace, where interrupts are
* always enabled after we restore the flags from
* the SPSR.
*/
trace_hardirqs_on();
return;
}
local_daif_restore(DAIF_PROCCTX);
}
trace_exit:
syscall_trace_exit(regs);
}
static inline void sve_user_discard(void)
{
if (!system_supports_sve())
return;
clear_thread_flag(TIF_SVE);
/*
* task_fpsimd_load() won't be called to update CPACR_EL1 in
* ret_to_user unless TIF_FOREIGN_FPSTATE is still set, which only
* happens if a context switch or kernel_neon_begin() or context
* modification (sigreturn, ptrace) intervenes.
* So, ensure that CPACR_EL1 is already correct for the fast-path case.
*/
sve_user_disable();
}
asmlinkage void el0_svc_handler(struct pt_regs *regs)
{
sve_user_discard();
el0_svc_common(regs, regs->regs[8], __NR_syscalls, sys_call_table);
}
#ifdef CONFIG_COMPAT
asmlinkage void el0_svc_compat_handler(struct pt_regs *regs)
{
el0_svc_common(regs, regs->regs[7], __NR_compat_syscalls,
compat_sys_call_table);
}
#endif
|
/* { dg-do run } */
/* { dg-shouldfail "bounds violation" } */
/* { dg-options "-fcheck-pointer-bounds -mmpx" } */
#define SHOULDFAIL
#include "mpx-check.h"
struct s {
int a;
int b : 10;
int c : 1;
int e : 10;
} s;
#define HH (unsigned char)1
int foo (struct s *p)
{
int val = p->b;
printf ("%d\n", val);
return val == HH;
}
int mpx_test (int argc, const char **argv)
{
struct s buf[100];
foo (buf - 1);
return 0;
}
|
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O2 -ffast-math -mcpu=power5 -mno-altivec -mabi=altivec -fno-unroll-loops" } */
/* { dg-final { scan-assembler-times "vaddfp" 1 } } */
/* { dg-final { scan-assembler-times "xvaddsp" 1 } } */
/* { dg-final { scan-assembler-times "fadds" 1 } } */
#ifndef SIZE
#define SIZE 1024
#endif
#ifdef __ALTIVEC__
#error "__ALTIVEC__ should not be defined."
#endif
#ifdef __VSX__
#error "__VSX__ should not be defined."
#endif
#pragma GCC target("vsx")
#include <altivec.h>
#pragma GCC reset_options
#pragma GCC push_options
#pragma GCC target("altivec,no-vsx")
#ifndef __ALTIVEC__
#error "__ALTIVEC__ should be defined."
#endif
#ifdef __VSX__
#error "__VSX__ should not be defined."
#endif
void
av_add (vector float *a, vector float *b, vector float *c)
{
unsigned long i;
unsigned long n = SIZE / 4;
for (i = 0; i < n; i++)
a[i] = vec_add (b[i], c[i]);
}
#pragma GCC target("vsx")
#ifndef __ALTIVEC__
#error "__ALTIVEC__ should be defined."
#endif
#ifndef __VSX__
#error "__VSX__ should be defined."
#endif
void
vsx_add (vector float *a, vector float *b, vector float *c)
{
unsigned long i;
unsigned long n = SIZE / 4;
for (i = 0; i < n; i++)
a[i] = vec_add (b[i], c[i]);
}
#pragma GCC pop_options
#pragma GCC target("no-vsx,no-altivec")
#ifdef __ALTIVEC__
#error "__ALTIVEC__ should not be defined."
#endif
#ifdef __VSX__
#error "__VSX__ should not be defined."
#endif
void
norm_add (float *a, float *b, float *c)
{
unsigned long i;
for (i = 0; i < SIZE; i++)
a[i] = b[i] + c[i];
}
|
#include <unistd.h>
#include <fcntl.h>
#include "fdleak.h"
int main (int argc, char **argv)
{
int s1;
int s2;
CLOSE_INHERITED_FDS;
s1 = DO( open("/dev/null", O_RDONLY) );
s2 = DO( open("/dev/null", O_RDONLY) );
(void) DO( dup2(s1, 20) ); // dup s1 as fd 20
(void) DO( dup2(s1, s2) ); // dup s1 as fd s2, which closes existing s2 fd
return 0;
}
|
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef __BASE64_H_INCLUDED__
#define __BASE64_H_INCLUDED__
#ifdef __cplusplus
extern "C" {
#endif
/*
Calculate how much memory needed for dst of base64_encode()
*/
int my_base64_needed_encoded_length(int length_of_data);
/*
Calculate how much memory needed for dst of base64_decode()
*/
int my_base64_needed_decoded_length(int length_of_encoded_data);
/*
Encode data as a base64 string
*/
int my_base64_encode(const void *src, size_t src_len, char *dst);
/*
Decode a base64 string into data
*/
int my_base64_decode(const char *src, size_t src_len,
void *dst, const char **end_ptr);
#ifdef __cplusplus
}
#endif
#endif /* !__BASE64_H_INCLUDED__ */
|
#ifndef __MAC802154_DRVIER_OPS
#define __MAC802154_DRIVER_OPS
#include <linux/types.h>
#include <linux/rtnetlink.h>
#include <net/mac802154.h>
#include "ieee802154_i.h"
static inline int
drv_xmit_async(struct ieee802154_local *local, struct sk_buff *skb)
{
return local->ops->xmit_async(&local->hw, skb);
}
static inline int
drv_xmit_sync(struct ieee802154_local *local, struct sk_buff *skb)
{
/* don't allow other operations while sync xmit */
ASSERT_RTNL();
might_sleep();
return local->ops->xmit_sync(&local->hw, skb);
}
static inline int drv_start(struct ieee802154_local *local)
{
might_sleep();
local->started = true;
smp_mb();
return local->ops->start(&local->hw);
}
static inline void drv_stop(struct ieee802154_local *local)
{
might_sleep();
local->ops->stop(&local->hw);
/* sync away all work on the tasklet before clearing started */
tasklet_disable(&local->tasklet);
tasklet_enable(&local->tasklet);
barrier();
local->started = false;
}
static inline int
drv_set_channel(struct ieee802154_local *local, u8 page, u8 channel)
{
might_sleep();
return local->ops->set_channel(&local->hw, page, channel);
}
static inline int drv_set_tx_power(struct ieee802154_local *local, s8 dbm)
{
might_sleep();
if (!local->ops->set_txpower) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_txpower(&local->hw, dbm);
}
static inline int drv_set_cca_mode(struct ieee802154_local *local, u8 cca_mode)
{
might_sleep();
if (!local->ops->set_cca_mode) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_cca_mode(&local->hw, cca_mode);
}
static inline int drv_set_lbt_mode(struct ieee802154_local *local, bool mode)
{
might_sleep();
if (!local->ops->set_lbt) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_lbt(&local->hw, mode);
}
static inline int
drv_set_cca_ed_level(struct ieee802154_local *local, s32 ed_level)
{
might_sleep();
if (!local->ops->set_cca_ed_level) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_cca_ed_level(&local->hw, ed_level);
}
static inline int drv_set_pan_id(struct ieee802154_local *local, __le16 pan_id)
{
struct ieee802154_hw_addr_filt filt;
might_sleep();
if (!local->ops->set_hw_addr_filt) {
WARN_ON(1);
return -EOPNOTSUPP;
}
filt.pan_id = pan_id;
return local->ops->set_hw_addr_filt(&local->hw, &filt,
IEEE802154_AFILT_PANID_CHANGED);
}
static inline int
drv_set_extended_addr(struct ieee802154_local *local, __le64 extended_addr)
{
struct ieee802154_hw_addr_filt filt;
might_sleep();
if (!local->ops->set_hw_addr_filt) {
WARN_ON(1);
return -EOPNOTSUPP;
}
filt.ieee_addr = extended_addr;
return local->ops->set_hw_addr_filt(&local->hw, &filt,
IEEE802154_AFILT_IEEEADDR_CHANGED);
}
static inline int
drv_set_short_addr(struct ieee802154_local *local, __le16 short_addr)
{
struct ieee802154_hw_addr_filt filt;
might_sleep();
if (!local->ops->set_hw_addr_filt) {
WARN_ON(1);
return -EOPNOTSUPP;
}
filt.short_addr = short_addr;
return local->ops->set_hw_addr_filt(&local->hw, &filt,
IEEE802154_AFILT_SADDR_CHANGED);
}
static inline int
drv_set_pan_coord(struct ieee802154_local *local, bool is_coord)
{
struct ieee802154_hw_addr_filt filt;
might_sleep();
if (!local->ops->set_hw_addr_filt) {
WARN_ON(1);
return -EOPNOTSUPP;
}
filt.pan_coord = is_coord;
return local->ops->set_hw_addr_filt(&local->hw, &filt,
IEEE802154_AFILT_PANC_CHANGED);
}
static inline int
drv_set_csma_params(struct ieee802154_local *local, u8 min_be, u8 max_be,
u8 max_csma_backoffs)
{
might_sleep();
if (!local->ops->set_csma_params) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_csma_params(&local->hw, min_be, max_be,
max_csma_backoffs);
}
static inline int
drv_set_max_frame_retries(struct ieee802154_local *local, s8 max_frame_retries)
{
might_sleep();
if (!local->ops->set_frame_retries) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_frame_retries(&local->hw, max_frame_retries);
}
static inline int
drv_set_promiscuous_mode(struct ieee802154_local *local, bool on)
{
might_sleep();
if (!local->ops->set_promiscuous_mode) {
WARN_ON(1);
return -EOPNOTSUPP;
}
return local->ops->set_promiscuous_mode(&local->hw, on);
}
#endif /* __MAC802154_DRVIER_OPS */
|
/*
* comedi_usb.c
* Comedi USB driver specific functions.
*
* COMEDI - Linux Control and Measurement Device Interface
* Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/usb.h>
#include "comedidev.h"
/**
* comedi_to_usb_interface() - comedi_device pointer to usb_interface pointer.
* @dev: comedi_device struct
*/
struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev)
{
return dev->hw_dev ? to_usb_interface(dev->hw_dev) : NULL;
}
EXPORT_SYMBOL_GPL(comedi_to_usb_interface);
/**
* comedi_to_usb_dev() - comedi_device pointer to usb_device pointer.
* @dev: comedi_device struct
*/
struct usb_device *comedi_to_usb_dev(struct comedi_device *dev)
{
struct usb_interface *intf = comedi_to_usb_interface(dev);
return intf ? interface_to_usbdev(intf) : NULL;
}
EXPORT_SYMBOL_GPL(comedi_to_usb_dev);
/**
* comedi_usb_auto_config() - Configure/probe a comedi USB driver.
* @intf: usb_interface struct
* @driver: comedi_driver struct
* @context: driver specific data, passed to comedi_auto_config()
*
* Typically called from the usb_driver (*probe) function.
*/
int comedi_usb_auto_config(struct usb_interface *intf,
struct comedi_driver *driver,
unsigned long context)
{
return comedi_auto_config(&intf->dev, driver, context);
}
EXPORT_SYMBOL_GPL(comedi_usb_auto_config);
/**
* comedi_pci_auto_unconfig() - Unconfigure/disconnect a comedi USB driver.
* @intf: usb_interface struct
*
* Typically called from the usb_driver (*disconnect) function.
*/
void comedi_usb_auto_unconfig(struct usb_interface *intf)
{
comedi_auto_unconfig(&intf->dev);
}
EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig);
/**
* comedi_usb_driver_register() - Register a comedi USB driver.
* @comedi_driver: comedi_driver struct
* @usb_driver: usb_driver struct
*
* This function is used for the module_init() of comedi USB drivers.
* Do not call it directly, use the module_comedi_usb_driver() helper
* macro instead.
*/
int comedi_usb_driver_register(struct comedi_driver *comedi_driver,
struct usb_driver *usb_driver)
{
int ret;
ret = comedi_driver_register(comedi_driver);
if (ret < 0)
return ret;
ret = usb_register(usb_driver);
if (ret < 0) {
comedi_driver_unregister(comedi_driver);
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(comedi_usb_driver_register);
/**
* comedi_usb_driver_unregister() - Unregister a comedi USB driver.
* @comedi_driver: comedi_driver struct
* @usb_driver: usb_driver struct
*
* This function is used for the module_exit() of comedi USB drivers.
* Do not call it directly, use the module_comedi_usb_driver() helper
* macro instead.
*/
void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver,
struct usb_driver *usb_driver)
{
usb_deregister(usb_driver);
comedi_driver_unregister(comedi_driver);
}
EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
static int __init comedi_usb_init(void)
{
return 0;
}
module_init(comedi_usb_init);
static void __exit comedi_usb_exit(void)
{
}
module_exit(comedi_usb_exit);
MODULE_AUTHOR("http://www.comedi.org");
MODULE_DESCRIPTION("Comedi USB interface module");
MODULE_LICENSE("GPL");
|
/*
* Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*/
#ifndef _LINUX_POLL_H
#define _LINUX_POLL_H
#include <linux/compiler.h>
#include <linux/ktime.h>
#include <linux/wait.h>
#include <linux/string.h>
#include <linux/fs.h>
#include <linux/sysctl.h>
#include <asm/uaccess.h>
#include <uapi/linux/poll.h>
extern struct ctl_table epoll_table[]; /* for sysctl */
/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
additional memory. */
#define MAX_STACK_ALLOC 832
#define FRONTEND_STACK_ALLOC 256
#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
struct poll_table_struct;
/*
* structures and helpers for f_op->poll implementations
*/
typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
/*
* Do not touch the structure directly, use the access functions
* poll_does_not_wait() and poll_requested_events() instead.
*/
typedef struct poll_table_struct {
poll_queue_proc _qproc;
unsigned long _key;
} poll_table;
static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
{
if (p && p->_qproc && wait_address)
p->_qproc(filp, wait_address, p);
}
/*
* Return true if it is guaranteed that poll will not wait. This is the case
* if the poll() of another file descriptor in the set got an event, so there
* is no need for waiting.
*/
static inline bool poll_does_not_wait(const poll_table *p)
{
return p == NULL || p->_qproc == NULL;
}
/*
* Return the set of events that the application wants to poll for.
* This is useful for drivers that need to know whether a DMA transfer has
* to be started implicitly on poll(). You typically only want to do that
* if the application is actually polling for POLLIN and/or POLLOUT.
*/
static inline unsigned long poll_requested_events(const poll_table *p)
{
return p ? p->_key : ~0UL;
}
static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
{
pt->_qproc = qproc;
pt->_key = ~0UL; /* all events enabled */
}
struct poll_table_entry {
struct file *filp;
unsigned long key;
wait_queue_t wait;
wait_queue_head_t *wait_address;
};
/*
* Structures and helpers for select/poll syscall
*/
struct poll_wqueues {
poll_table pt;
struct poll_table_page *table;
struct task_struct *polling_task;
int triggered;
int error;
int inline_index;
struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
};
extern void poll_initwait(struct poll_wqueues *pwq);
extern void poll_freewait(struct poll_wqueues *pwq);
extern int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key);
extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
ktime_t *expires, unsigned long slack);
extern long select_estimate_accuracy(struct timespec *tv);
static inline int poll_schedule(struct poll_wqueues *pwq, int state)
{
return poll_schedule_timeout(pwq, state, NULL, 0);
}
/*
* Scalable version of the fd_set.
*/
typedef struct {
unsigned long *in, *out, *ex;
unsigned long *res_in, *res_out, *res_ex;
} fd_set_bits;
/*
* How many longwords for "nr" bits?
*/
#define FDS_BITPERLONG (8*sizeof(long))
#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
/*
* We do a VERIFY_WRITE here even though we are only reading this time:
* we'll write to it eventually..
*
* Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
*/
static inline
int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
{
nr = FDS_BYTES(nr);
if (ufdset)
return copy_from_user(fdset, ufdset, nr) ? -EFAULT : 0;
memset(fdset, 0, nr);
return 0;
}
static inline unsigned long __must_check
set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
{
if (ufdset)
return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
return 0;
}
static inline
void zero_fd_set(unsigned long nr, unsigned long *fdset)
{
memset(fdset, 0, FDS_BYTES(nr));
}
#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time);
extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
struct timespec *end_time);
extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
fd_set __user *exp, struct timespec *end_time);
extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec);
#endif /* _LINUX_POLL_H */
|
/* udis86 - libudis86/extern.h
*
* Copyright (c) 2002-2009, 2013 Vivek Thampi
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UD_EXTERN_H
#define UD_EXTERN_H
#ifdef __cplusplus
extern "C" {
#endif
#include "types.h"
#if defined(_MSC_VER) && defined(_USRDLL)
# ifdef LIBUDIS86_EXPORTS
# define LIBUDIS86_DLLEXTERN __declspec(dllexport)
# else
# define LIBUDIS86_DLLEXTERN __declspec(dllimport)
# endif
#else
# define LIBUDIS86_DLLEXTERN
#endif
/* ============================= PUBLIC API ================================= */
extern LIBUDIS86_DLLEXTERN void ud_init(struct ud*);
extern LIBUDIS86_DLLEXTERN void ud_set_mode(struct ud*, uint8_t);
extern LIBUDIS86_DLLEXTERN void ud_set_pc(struct ud*, uint64_t);
extern LIBUDIS86_DLLEXTERN void ud_set_input_hook(struct ud*, int (*)(struct ud*));
extern LIBUDIS86_DLLEXTERN void ud_set_input_buffer(struct ud*, const uint8_t*, size_t);
#ifndef __UD_STANDALONE__
extern LIBUDIS86_DLLEXTERN void ud_set_input_file(struct ud*, FILE*);
#endif /* __UD_STANDALONE__ */
extern LIBUDIS86_DLLEXTERN void ud_set_vendor(struct ud*, unsigned);
extern LIBUDIS86_DLLEXTERN void ud_set_syntax(struct ud*, void (*)(struct ud*));
extern LIBUDIS86_DLLEXTERN void ud_input_skip(struct ud*, size_t);
extern LIBUDIS86_DLLEXTERN int ud_input_end(const struct ud*);
extern LIBUDIS86_DLLEXTERN unsigned int ud_decode(struct ud*);
extern LIBUDIS86_DLLEXTERN unsigned int ud_disassemble(struct ud*);
extern LIBUDIS86_DLLEXTERN void ud_translate_intel(struct ud*);
extern LIBUDIS86_DLLEXTERN void ud_translate_att(struct ud*);
extern LIBUDIS86_DLLEXTERN const char* ud_insn_asm(const struct ud* u);
extern LIBUDIS86_DLLEXTERN const uint8_t* ud_insn_ptr(const struct ud* u);
extern LIBUDIS86_DLLEXTERN uint64_t ud_insn_off(const struct ud*);
extern LIBUDIS86_DLLEXTERN const char* ud_insn_hex(struct ud*);
extern LIBUDIS86_DLLEXTERN unsigned int ud_insn_len(const struct ud* u);
extern LIBUDIS86_DLLEXTERN const struct ud_operand* ud_insn_opr(const struct ud *u, unsigned int n);
extern LIBUDIS86_DLLEXTERN int ud_opr_is_sreg(const struct ud_operand *opr);
extern LIBUDIS86_DLLEXTERN int ud_opr_is_gpr(const struct ud_operand *opr);
extern LIBUDIS86_DLLEXTERN enum ud_mnemonic_code ud_insn_mnemonic(const struct ud *u);
extern LIBUDIS86_DLLEXTERN const char* ud_lookup_mnemonic(enum ud_mnemonic_code c);
extern LIBUDIS86_DLLEXTERN const struct ud_eflags* ud_lookup_eflags(struct ud *u);
extern LIBUDIS86_DLLEXTERN const enum ud_type* ud_lookup_implicit_reg_used_list(struct ud *u);
extern LIBUDIS86_DLLEXTERN const enum ud_type* ud_lookup_implicit_reg_defined_list(struct ud *u);
extern LIBUDIS86_DLLEXTERN void ud_set_user_opaque_data(struct ud*, void*);
extern LIBUDIS86_DLLEXTERN void* ud_get_user_opaque_data(const struct ud*);
extern LIBUDIS86_DLLEXTERN void ud_set_asm_buffer(struct ud *u, char *buf, size_t size);
extern LIBUDIS86_DLLEXTERN void ud_set_sym_resolver(struct ud *u,
const char* (*resolver)(struct ud*,
uint64_t addr,
int64_t *offset));
/* ========================================================================== */
#ifdef __cplusplus
}
#endif
#endif /* UD_EXTERN_H */
|
#ifndef _LINUX_VIRTIO_BLK_H
#define _LINUX_VIRTIO_BLK_H
/* This header is BSD licensed so anyone can use the definitions to implement
* compatible drivers/servers.
*
* 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 IBM 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 IBM OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. */
#include <linux/types.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
/* Feature bits */
#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
struct virtio_blk_config {
/* The capacity (in 512-byte sectors). */
__u64 capacity;
/* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
__u32 size_max;
/* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
__u32 seg_max;
/* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
struct virtio_blk_geometry {
__u16 cylinders;
__u8 heads;
__u8 sectors;
} geometry;
/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
__u32 blk_size;
/* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */
/* exponent for physical block per logical block. */
__u8 physical_block_exp;
/* alignment offset in logical blocks. */
__u8 alignment_offset;
/* minimum I/O size without performance penalty in logical blocks. */
__u16 min_io_size;
/* optimal sustained I/O size in logical blocks. */
__u32 opt_io_size;
} __attribute__((packed));
/*
* Command types
*
* Usage is a bit tricky as some bits are used as flags and some are not.
*
* Rules:
* VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
* VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
* and may not be combined with any of the other flags.
*/
/* These two define direction. */
#define VIRTIO_BLK_T_IN 0
#define VIRTIO_BLK_T_OUT 1
/* This bit says it's a scsi command, not an actual read or write. */
#define VIRTIO_BLK_T_SCSI_CMD 2
/* Cache flush command */
#define VIRTIO_BLK_T_FLUSH 4
/* Get device ID command */
#define VIRTIO_BLK_T_GET_ID 8
/* Barrier before this op. */
#define VIRTIO_BLK_T_BARRIER 0x80000000
/* This is the first element of the read scatter-gather list. */
struct virtio_blk_outhdr {
/* VIRTIO_BLK_T* */
__u32 type;
/* io priority. */
__u32 ioprio;
/* Sector (ie. 512 byte offset) */
__u64 sector;
};
struct virtio_scsi_inhdr {
__u32 errors;
__u32 data_len;
__u32 sense_len;
__u32 residual;
};
/* And this is the final byte of the write scatter-gather list. */
#define VIRTIO_BLK_S_OK 0
#define VIRTIO_BLK_S_IOERR 1
#define VIRTIO_BLK_S_UNSUPP 2
#endif /* _LINUX_VIRTIO_BLK_H */
|
/*
* flowcont.c - CC31xx/CC32xx Host Driver Implementation
*
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
*
*
* 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 Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#include "protocol.h"
#include "driver.h"
#include "flowcont.h"
/*****************************************************************************/
/* _SlDrvFlowContInit */
/*****************************************************************************/
#if 0
void _SlDrvFlowContInit(void)
{
g_pCB->FlowContCB.TxPoolCnt = FLOW_CONT_MIN;
OSI_RET_OK_CHECK(sl_LockObjCreate(&g_pCB->FlowContCB.TxLockObj, "TxLockObj"));
OSI_RET_OK_CHECK(sl_SyncObjCreate(&g_pCB->FlowContCB.TxSyncObj, "TxSyncObj"));
}
/*****************************************************************************/
/* _SlDrvFlowContDeinit */
/*****************************************************************************/
void _SlDrvFlowContDeinit(void)
{
g_pCB->FlowContCB.TxPoolCnt = 0;
OSI_RET_OK_CHECK(sl_LockObjDelete(&g_pCB->FlowContCB.TxLockObj));
OSI_RET_OK_CHECK(sl_SyncObjDelete(&g_pCB->FlowContCB.TxSyncObj));
}
#endif
|
/*
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
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.
*/
#include "hal.h"
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
* This variable is used by the HAL when initializing the PAL driver.
*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
const PALConfig pal_default_config =
{
{VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH},
{VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH},
{VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH},
{VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH},
{VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH},
};
#endif
/*
* Early initialization code.
* This initialization must be performed just after stack setup and before
* any other initialization.
*/
void __early_init(void) {
stm32_clock_init();
}
/*
* Board-specific initialization code.
*/
void boardInit(void) {
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
}
|
/*
* AR71xx Reset Controller Driver
* Author: Alban Bedel
*
* Copyright (C) 2015 Alban Bedel <albeu@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/io.h>
#include <linux/init.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/reset-controller.h>
#include <linux/reboot.h>
struct ath79_reset {
struct reset_controller_dev rcdev;
struct notifier_block restart_nb;
void __iomem *base;
spinlock_t lock;
};
#define FULL_CHIP_RESET 24
static int ath79_reset_update(struct reset_controller_dev *rcdev,
unsigned long id, bool assert)
{
struct ath79_reset *ath79_reset =
container_of(rcdev, struct ath79_reset, rcdev);
unsigned long flags;
u32 val;
spin_lock_irqsave(&ath79_reset->lock, flags);
val = readl(ath79_reset->base);
if (assert)
val |= BIT(id);
else
val &= ~BIT(id);
writel(val, ath79_reset->base);
spin_unlock_irqrestore(&ath79_reset->lock, flags);
return 0;
}
static int ath79_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return ath79_reset_update(rcdev, id, true);
}
static int ath79_reset_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
return ath79_reset_update(rcdev, id, false);
}
static int ath79_reset_status(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct ath79_reset *ath79_reset =
container_of(rcdev, struct ath79_reset, rcdev);
u32 val;
val = readl(ath79_reset->base);
return !!(val & BIT(id));
}
static const struct reset_control_ops ath79_reset_ops = {
.assert = ath79_reset_assert,
.deassert = ath79_reset_deassert,
.status = ath79_reset_status,
};
static int ath79_reset_restart_handler(struct notifier_block *nb,
unsigned long action, void *data)
{
struct ath79_reset *ath79_reset =
container_of(nb, struct ath79_reset, restart_nb);
ath79_reset_assert(&ath79_reset->rcdev, FULL_CHIP_RESET);
return NOTIFY_DONE;
}
static int ath79_reset_probe(struct platform_device *pdev)
{
struct ath79_reset *ath79_reset;
struct resource *res;
int err;
ath79_reset = devm_kzalloc(&pdev->dev,
sizeof(*ath79_reset), GFP_KERNEL);
if (!ath79_reset)
return -ENOMEM;
platform_set_drvdata(pdev, ath79_reset);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ath79_reset->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(ath79_reset->base))
return PTR_ERR(ath79_reset->base);
spin_lock_init(&ath79_reset->lock);
ath79_reset->rcdev.ops = &ath79_reset_ops;
ath79_reset->rcdev.owner = THIS_MODULE;
ath79_reset->rcdev.of_node = pdev->dev.of_node;
ath79_reset->rcdev.of_reset_n_cells = 1;
ath79_reset->rcdev.nr_resets = 32;
err = devm_reset_controller_register(&pdev->dev, &ath79_reset->rcdev);
if (err)
return err;
ath79_reset->restart_nb.notifier_call = ath79_reset_restart_handler;
ath79_reset->restart_nb.priority = 128;
err = register_restart_handler(&ath79_reset->restart_nb);
if (err)
dev_warn(&pdev->dev, "Failed to register restart handler\n");
return 0;
}
static const struct of_device_id ath79_reset_dt_ids[] = {
{ .compatible = "qca,ar7100-reset", },
{ },
};
static struct platform_driver ath79_reset_driver = {
.probe = ath79_reset_probe,
.driver = {
.name = "ath79-reset",
.of_match_table = ath79_reset_dt_ids,
.suppress_bind_attrs = true,
},
};
builtin_platform_driver(ath79_reset_driver);
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* ff.c - a part of driver for RME Fireface series
*
* Copyright (c) 2015-2017 Takashi Sakamoto
*/
#include "ff.h"
#define OUI_RME 0x000a35
MODULE_DESCRIPTION("RME Fireface series Driver");
MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>");
MODULE_LICENSE("GPL v2");
static void name_card(struct snd_ff *ff)
{
struct fw_device *fw_dev = fw_parent_device(ff->unit);
strcpy(ff->card->driver, "Fireface");
strcpy(ff->card->shortname, ff->spec->name);
strcpy(ff->card->mixername, ff->spec->name);
snprintf(ff->card->longname, sizeof(ff->card->longname),
"RME %s, GUID %08x%08x at %s, S%d", ff->spec->name,
fw_dev->config_rom[3], fw_dev->config_rom[4],
dev_name(&ff->unit->device), 100 << fw_dev->max_speed);
}
static void ff_card_free(struct snd_card *card)
{
struct snd_ff *ff = card->private_data;
snd_ff_stream_destroy_duplex(ff);
snd_ff_transaction_unregister(ff);
}
static void do_registration(struct work_struct *work)
{
struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
int err;
if (ff->registered)
return;
err = snd_card_new(&ff->unit->device, -1, NULL, THIS_MODULE, 0,
&ff->card);
if (err < 0)
return;
ff->card->private_free = ff_card_free;
ff->card->private_data = ff;
err = snd_ff_transaction_register(ff);
if (err < 0)
goto error;
name_card(ff);
err = snd_ff_stream_init_duplex(ff);
if (err < 0)
goto error;
snd_ff_proc_init(ff);
err = snd_ff_create_midi_devices(ff);
if (err < 0)
goto error;
err = snd_ff_create_pcm_devices(ff);
if (err < 0)
goto error;
err = snd_ff_create_hwdep_devices(ff);
if (err < 0)
goto error;
err = snd_card_register(ff->card);
if (err < 0)
goto error;
ff->registered = true;
return;
error:
snd_card_free(ff->card);
dev_info(&ff->unit->device,
"Sound card registration failed: %d\n", err);
}
static int snd_ff_probe(struct fw_unit *unit,
const struct ieee1394_device_id *entry)
{
struct snd_ff *ff;
ff = devm_kzalloc(&unit->device, sizeof(struct snd_ff), GFP_KERNEL);
if (!ff)
return -ENOMEM;
ff->unit = fw_unit_get(unit);
dev_set_drvdata(&unit->device, ff);
mutex_init(&ff->mutex);
spin_lock_init(&ff->lock);
init_waitqueue_head(&ff->hwdep_wait);
ff->spec = (const struct snd_ff_spec *)entry->driver_data;
/* Register this sound card later. */
INIT_DEFERRABLE_WORK(&ff->dwork, do_registration);
snd_fw_schedule_registration(unit, &ff->dwork);
return 0;
}
static void snd_ff_update(struct fw_unit *unit)
{
struct snd_ff *ff = dev_get_drvdata(&unit->device);
/* Postpone a workqueue for deferred registration. */
if (!ff->registered)
snd_fw_schedule_registration(unit, &ff->dwork);
snd_ff_transaction_reregister(ff);
if (ff->registered)
snd_ff_stream_update_duplex(ff);
}
static void snd_ff_remove(struct fw_unit *unit)
{
struct snd_ff *ff = dev_get_drvdata(&unit->device);
/*
* Confirm to stop the work for registration before the sound card is
* going to be released. The work is not scheduled again because bus
* reset handler is not called anymore.
*/
cancel_work_sync(&ff->dwork.work);
if (ff->registered) {
// Block till all of ALSA character devices are released.
snd_card_free(ff->card);
}
mutex_destroy(&ff->mutex);
fw_unit_put(ff->unit);
}
static const struct snd_ff_spec spec_ff800 = {
.name = "Fireface800",
.pcm_capture_channels = {28, 20, 12},
.pcm_playback_channels = {28, 20, 12},
.midi_in_ports = 1,
.midi_out_ports = 1,
.protocol = &snd_ff_protocol_ff800,
.midi_high_addr = 0x000200000320ull,
.midi_addr_range = 12,
.midi_rx_addrs = {0x000080180000ull, 0},
};
static const struct snd_ff_spec spec_ff400 = {
.name = "Fireface400",
.pcm_capture_channels = {18, 14, 10},
.pcm_playback_channels = {18, 14, 10},
.midi_in_ports = 2,
.midi_out_ports = 2,
.protocol = &snd_ff_protocol_ff400,
.midi_high_addr = 0x0000801003f4ull,
.midi_addr_range = SND_FF_MAXIMIM_MIDI_QUADS * 4,
.midi_rx_addrs = {0x000080180000ull, 0x000080190000ull},
};
static const struct snd_ff_spec spec_ucx = {
.name = "FirefaceUCX",
.pcm_capture_channels = {18, 14, 12},
.pcm_playback_channels = {18, 14, 12},
.midi_in_ports = 2,
.midi_out_ports = 2,
.protocol = &snd_ff_protocol_latter,
.midi_high_addr = 0xffff00000034ull,
.midi_addr_range = 0x80,
.midi_rx_addrs = {0xffff00000030ull, 0xffff00000030ull},
};
static const struct ieee1394_device_id snd_ff_id_table[] = {
/* Fireface 800 */
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
IEEE1394_MATCH_SPECIFIER_ID |
IEEE1394_MATCH_VERSION |
IEEE1394_MATCH_MODEL_ID,
.vendor_id = OUI_RME,
.specifier_id = OUI_RME,
.version = 0x000001,
.model_id = 0x101800,
.driver_data = (kernel_ulong_t)&spec_ff800,
},
/* Fireface 400 */
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
IEEE1394_MATCH_SPECIFIER_ID |
IEEE1394_MATCH_VERSION |
IEEE1394_MATCH_MODEL_ID,
.vendor_id = OUI_RME,
.specifier_id = OUI_RME,
.version = 0x000002,
.model_id = 0x101800,
.driver_data = (kernel_ulong_t)&spec_ff400,
},
// Fireface UCX.
{
.match_flags = IEEE1394_MATCH_VENDOR_ID |
IEEE1394_MATCH_SPECIFIER_ID |
IEEE1394_MATCH_VERSION |
IEEE1394_MATCH_MODEL_ID,
.vendor_id = OUI_RME,
.specifier_id = OUI_RME,
.version = 0x000004,
.model_id = 0x101800,
.driver_data = (kernel_ulong_t)&spec_ucx,
},
{}
};
MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table);
static struct fw_driver ff_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "snd-fireface",
.bus = &fw_bus_type,
},
.probe = snd_ff_probe,
.update = snd_ff_update,
.remove = snd_ff_remove,
.id_table = snd_ff_id_table,
};
static int __init snd_ff_init(void)
{
return driver_register(&ff_driver.driver);
}
static void __exit snd_ff_exit(void)
{
driver_unregister(&ff_driver.driver);
}
module_init(snd_ff_init);
module_exit(snd_ff_exit);
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/******************************************************************************
*
* Module Name: osunixmap - Unix OSL for file mappings
*
* Copyright (C) 2000 - 2019, Intel Corp.
*
*****************************************************************************/
#include "acpidump.h"
#include <unistd.h>
#include <sys/mman.h>
#ifdef _free_BSD
#include <sys/param.h>
#endif
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME("osunixmap")
#ifndef O_BINARY
#define O_BINARY 0
#endif
#if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX)
#define MMAP_FLAGS MAP_SHARED
#else
#define MMAP_FLAGS MAP_PRIVATE
#endif
#define SYSTEM_MEMORY "/dev/mem"
/*******************************************************************************
*
* FUNCTION: acpi_os_get_page_size
*
* PARAMETERS: None
*
* RETURN: Page size of the platform.
*
* DESCRIPTION: Obtain page size of the platform.
*
******************************************************************************/
static acpi_size acpi_os_get_page_size(void)
{
#ifdef PAGE_SIZE
return PAGE_SIZE;
#else
return sysconf(_SC_PAGESIZE);
#endif
}
/******************************************************************************
*
* FUNCTION: acpi_os_map_memory
*
* PARAMETERS: where - Physical address of memory to be mapped
* length - How much memory to map
*
* RETURN: Pointer to mapped memory. Null on error.
*
* DESCRIPTION: Map physical memory into local address space.
*
*****************************************************************************/
void *acpi_os_map_memory(acpi_physical_address where, acpi_size length)
{
u8 *mapped_memory;
acpi_physical_address offset;
acpi_size page_size;
int fd;
fd = open(SYSTEM_MEMORY, O_RDONLY | O_BINARY);
if (fd < 0) {
fprintf(stderr, "Cannot open %s\n", SYSTEM_MEMORY);
return (NULL);
}
/* Align the offset to use mmap */
page_size = acpi_os_get_page_size();
offset = where % page_size;
/* Map the table header to get the length of the full table */
mapped_memory = mmap(NULL, (length + offset), PROT_READ, MMAP_FLAGS,
fd, (where - offset));
if (mapped_memory == MAP_FAILED) {
fprintf(stderr, "Cannot map %s\n", SYSTEM_MEMORY);
close(fd);
return (NULL);
}
close(fd);
return (ACPI_CAST8(mapped_memory + offset));
}
/******************************************************************************
*
* FUNCTION: acpi_os_unmap_memory
*
* PARAMETERS: where - Logical address of memory to be unmapped
* length - How much memory to unmap
*
* RETURN: None.
*
* DESCRIPTION: Delete a previously created mapping. Where and Length must
* correspond to a previous mapping exactly.
*
*****************************************************************************/
void acpi_os_unmap_memory(void *where, acpi_size length)
{
acpi_physical_address offset;
acpi_size page_size;
page_size = acpi_os_get_page_size();
offset = ACPI_TO_INTEGER(where) % page_size;
munmap((u8 *)where - offset, (length + offset));
}
|
/* { dg-do run } */
/* { dg-options "-O" } */
/* { dg-options "-O -march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
extern void abort(void);
float foo(float f)
{
if (f < 0.0f)
f = -f;
return f;
}
int main(void)
{
if (foo (-1.0f) != 1.0f)
abort ();
return 0;
}
|
/*
* $Id$
*
* Copyright (c) 2008, David Fishburn
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* This module contains functions for generating tags for MATLAB language files.
*/
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include <string.h>
#include "parse.h"
/*
* FUNCTION DEFINITIONS
*/
static void installMatLabRegex (const langType language)
{
/* function [x,y,z] = asdf */
addTagRegex (language, "^function[ \t]*\\[.*\\][ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL);
/* function x = asdf */
addTagRegex (language, "^function[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL);
/* function asdf */
addTagRegex (language, "^function[ \t]*([a-zA-Z0-9_]+)[^=]*$", "\\1", "f,function", NULL);
}
extern parserDefinition* MatLabParser ()
{
static const char *const extensions [] = { "m", NULL };
parserDefinition* const def = parserNew ("MatLab");
def->extensions = extensions;
def->initialize = installMatLabRegex;
def->regex = TRUE;
return def;
}
/* vi:set tabstop=4 shiftwidth=4: */
|
#ifndef __LINUX_CLASS_DUAL_ROLE_H__
#define __LINUX_CLASS_DUAL_ROLE_H__
#include <linux/workqueue.h>
#include <linux/errno.h>
#include <linux/types.h>
struct device;
enum dual_role_supported_modes {
DUAL_ROLE_SUPPORTED_MODES_DFP_AND_UFP = 0,
DUAL_ROLE_SUPPORTED_MODES_DFP,
DUAL_ROLE_SUPPORTED_MODES_UFP,
/*The following should be the last element*/
DUAL_ROLE_PROP_SUPPORTED_MODES_TOTAL,
};
enum {
DUAL_ROLE_PROP_MODE_UFP = 0,
DUAL_ROLE_PROP_MODE_DFP,
DUAL_ROLE_PROP_MODE_NONE,
/*The following should be the last element*/
DUAL_ROLE_PROP_MODE_TOTAL,
};
enum {
DUAL_ROLE_PROP_PR_SRC = 0,
DUAL_ROLE_PROP_PR_SNK,
DUAL_ROLE_PROP_PR_NONE,
/*The following should be the last element*/
DUAL_ROLE_PROP_PR_TOTAL,
};
enum {
DUAL_ROLE_PROP_DR_HOST = 0,
DUAL_ROLE_PROP_DR_DEVICE,
DUAL_ROLE_PROP_DR_NONE,
/*The following should be the last element*/
DUAL_ROLE_PROP_DR_TOTAL,
};
enum {
DUAL_ROLE_PROP_VCONN_SUPPLY_NO = 0,
DUAL_ROLE_PROP_VCONN_SUPPLY_YES,
/*The following should be the last element*/
DUAL_ROLE_PROP_VCONN_SUPPLY_TOTAL,
};
enum dual_role_property {
DUAL_ROLE_PROP_SUPPORTED_MODES = 0,
DUAL_ROLE_PROP_MODE,
DUAL_ROLE_PROP_PR,
DUAL_ROLE_PROP_DR,
DUAL_ROLE_PROP_VCONN_SUPPLY,
};
struct dual_role_phy_instance;
/* Description of typec port */
struct dual_role_phy_desc {
/* /sys/class/dual_role_usb/<name>/ */
const char *name;
enum dual_role_supported_modes supported_modes;
enum dual_role_property *properties;
size_t num_properties;
/* Callback for "cat /sys/class/dual_role_usb/<name>/<property>" */
int (*get_property)(struct dual_role_phy_instance *dual_role,
enum dual_role_property prop,
unsigned int *val);
/* Callback for "echo <value> >
* /sys/class/dual_role_usb/<name>/<property>" */
int (*set_property)(struct dual_role_phy_instance *dual_role,
enum dual_role_property prop,
const unsigned int *val);
/* Decides whether userspace can change a specific property */
int (*property_is_writeable)(struct dual_role_phy_instance *dual_role,
enum dual_role_property prop);
};
struct dual_role_phy_instance {
const struct dual_role_phy_desc *desc;
/* Driver private data */
void *drv_data;
struct device dev;
struct work_struct changed_work;
};
#if IS_ENABLED(CONFIG_DUAL_ROLE_USB_INTF)
extern void dual_role_instance_changed(struct dual_role_phy_instance
*dual_role);
extern struct dual_role_phy_instance *__must_check
devm_dual_role_instance_register(struct device *parent,
const struct dual_role_phy_desc *desc);
extern void devm_dual_role_instance_unregister(struct device *dev,
struct dual_role_phy_instance
*dual_role);
extern int dual_role_get_property(struct dual_role_phy_instance *dual_role,
enum dual_role_property prop,
unsigned int *val);
extern int dual_role_set_property(struct dual_role_phy_instance *dual_role,
enum dual_role_property prop,
const unsigned int *val);
extern int dual_role_property_is_writeable(struct dual_role_phy_instance
*dual_role,
enum dual_role_property prop);
extern void *dual_role_get_drvdata(struct dual_role_phy_instance *dual_role);
#else /* CONFIG_DUAL_ROLE_USB_INTF */
static inline void dual_role_instance_changed(struct dual_role_phy_instance
*dual_role){}
static inline struct dual_role_phy_instance *__must_check
devm_dual_role_instance_register(struct device *parent,
const struct dual_role_phy_desc *desc)
{
return ERR_PTR(-ENOSYS);
}
static inline void devm_dual_role_instance_unregister(struct device *dev,
struct dual_role_phy_instance
*dual_role){}
static inline void *dual_role_get_drvdata(struct dual_role_phy_instance
*dual_role)
{
return ERR_PTR(-ENOSYS);
}
#endif /* CONFIG_DUAL_ROLE_USB_INTF */
#endif /* __LINUX_CLASS_DUAL_ROLE_H__ */
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2012 ARM Ltd.
*/
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
#include <asm/cputype.h>
#define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */
#define USER_ASID_BIT 48
#define USER_ASID_FLAG (UL(1) << USER_ASID_BIT)
#define TTBR_ASID_MASK (UL(0xffff) << 48)
#ifndef __ASSEMBLY__
#include <linux/refcount.h>
typedef struct {
atomic64_t id;
#ifdef CONFIG_COMPAT
void *sigpage;
#endif
refcount_t pinned;
void *vdso;
unsigned long flags;
} mm_context_t;
/*
* We use atomic64_read() here because the ASID for an 'mm_struct' can
* be reallocated when scheduling one of its threads following a
* rollover event (see new_context() and flush_context()). In this case,
* a concurrent TLBI (e.g. via try_to_unmap_one() and ptep_clear_flush())
* may use a stale ASID. This is fine in principle as the new ASID is
* guaranteed to be clean in the TLB, but the TLBI routines have to take
* care to handle the following race:
*
* CPU 0 CPU 1 CPU 2
*
* // ptep_clear_flush(mm)
* xchg_relaxed(pte, 0)
* DSB ISHST
* old = ASID(mm)
* | <rollover>
* | new = new_context(mm)
* \-----------------> atomic_set(mm->context.id, new)
* cpu_switch_mm(mm)
* // Hardware walk of pte using new ASID
* TLBI(old)
*
* In this scenario, the barrier on CPU 0 and the dependency on CPU 1
* ensure that the page-table walker on CPU 1 *must* see the invalid PTE
* written by CPU 0.
*/
#define ASID(mm) (atomic64_read(&(mm)->context.id) & 0xffff)
static inline bool arm64_kernel_unmapped_at_el0(void)
{
return cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0);
}
extern void arm64_memblock_init(void);
extern void paging_init(void);
extern void bootmem_init(void);
extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
extern void init_mem_pgprot(void);
extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
unsigned long virt, phys_addr_t size,
pgprot_t prot, bool page_mappings_only);
extern void *fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot);
extern void mark_linear_text_alias_ro(void);
extern bool kaslr_requires_kpti(void);
#define INIT_MM_CONTEXT(name) \
.pgd = init_pg_dir,
#endif /* !__ASSEMBLY__ */
#endif
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Thunderbolt driver - Tunneling support
*
* Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com>
* Copyright (C) 2019, Intel Corporation
*/
#ifndef TB_TUNNEL_H_
#define TB_TUNNEL_H_
#include "tb.h"
enum tb_tunnel_type {
TB_TUNNEL_PCI,
TB_TUNNEL_DP,
TB_TUNNEL_DMA,
TB_TUNNEL_USB3,
};
/**
* struct tb_tunnel - Tunnel between two ports
* @tb: Pointer to the domain
* @src_port: Source port of the tunnel
* @dst_port: Destination port of the tunnel. For discovered incomplete
* tunnels may be %NULL or null adapter port instead.
* @paths: All paths required by the tunnel
* @npaths: Number of paths in @paths
* @init: Optional tunnel specific initialization
* @activate: Optional tunnel specific activation/deactivation
* @consumed_bandwidth: Return how much bandwidth the tunnel consumes
* @release_unused_bandwidth: Release all unused bandwidth
* @reclaim_available_bandwidth: Reclaim back available bandwidth
* @list: Tunnels are linked using this field
* @type: Type of the tunnel
* @max_up: Maximum upstream bandwidth (Mb/s) available for the tunnel.
* Only set if the bandwidth needs to be limited.
* @max_down: Maximum downstream bandwidth (Mb/s) available for the tunnel.
* Only set if the bandwidth needs to be limited.
* @allocated_up: Allocated upstream bandwidth (only for USB3)
* @allocated_down: Allocated downstream bandwidth (only for USB3)
*/
struct tb_tunnel {
struct tb *tb;
struct tb_port *src_port;
struct tb_port *dst_port;
struct tb_path **paths;
size_t npaths;
int (*init)(struct tb_tunnel *tunnel);
int (*activate)(struct tb_tunnel *tunnel, bool activate);
int (*consumed_bandwidth)(struct tb_tunnel *tunnel, int *consumed_up,
int *consumed_down);
int (*release_unused_bandwidth)(struct tb_tunnel *tunnel);
void (*reclaim_available_bandwidth)(struct tb_tunnel *tunnel,
int *available_up,
int *available_down);
struct list_head list;
enum tb_tunnel_type type;
int max_up;
int max_down;
int allocated_up;
int allocated_down;
};
struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down);
struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,
struct tb_port *down);
struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in);
struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
struct tb_port *out, int max_up,
int max_down);
struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi,
struct tb_port *dst, int transmit_ring,
int transmit_path, int receive_ring,
int receive_path);
struct tb_tunnel *tb_tunnel_discover_usb3(struct tb *tb, struct tb_port *down);
struct tb_tunnel *tb_tunnel_alloc_usb3(struct tb *tb, struct tb_port *up,
struct tb_port *down, int max_up,
int max_down);
void tb_tunnel_free(struct tb_tunnel *tunnel);
int tb_tunnel_activate(struct tb_tunnel *tunnel);
int tb_tunnel_restart(struct tb_tunnel *tunnel);
void tb_tunnel_deactivate(struct tb_tunnel *tunnel);
bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel);
bool tb_tunnel_port_on_path(const struct tb_tunnel *tunnel,
const struct tb_port *port);
int tb_tunnel_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up,
int *consumed_down);
int tb_tunnel_release_unused_bandwidth(struct tb_tunnel *tunnel);
void tb_tunnel_reclaim_available_bandwidth(struct tb_tunnel *tunnel,
int *available_up,
int *available_down);
static inline bool tb_tunnel_is_pci(const struct tb_tunnel *tunnel)
{
return tunnel->type == TB_TUNNEL_PCI;
}
static inline bool tb_tunnel_is_dp(const struct tb_tunnel *tunnel)
{
return tunnel->type == TB_TUNNEL_DP;
}
static inline bool tb_tunnel_is_dma(const struct tb_tunnel *tunnel)
{
return tunnel->type == TB_TUNNEL_DMA;
}
static inline bool tb_tunnel_is_usb3(const struct tb_tunnel *tunnel)
{
return tunnel->type == TB_TUNNEL_USB3;
}
#endif
|
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/init_task.h>
#include <linux/mqueue.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
static struct fs_struct init_fs = INIT_FS;
static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
struct mm_struct init_mm = INIT_MM(init_mm);
EXPORT_SYMBOL(init_mm);
/* .text section in head.S is aligned at 2 page boundary and this gets linked
* right after that so that the init_thread_union is aligned properly as well.
* We really don't need this special alignment like the Intel does, but
* I do it anyways for completeness.
*/
__asm__ (".text");
union thread_union init_thread_union = { INIT_THREAD_INFO(init_task) };
/*
* Initial task structure.
*
* All other task structs will be allocated on slabs in fork.c
*/
EXPORT_SYMBOL(init_task);
__asm__(".data");
struct task_struct init_task = INIT_TASK(init_task);
|
/*
* linux/fs/proc/root.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
* proc root directory handling functions
*/
#include <asm/uaccess.h>
#include <linux/errno.h>
#include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/mount.h>
#include <linux/pid_namespace.h>
#include "internal.h"
static int proc_test_super(struct super_block *sb, void *data)
{
return sb->s_fs_info == data;
}
static int proc_set_super(struct super_block *sb, void *data)
{
struct pid_namespace *ns;
ns = (struct pid_namespace *)data;
sb->s_fs_info = get_pid_ns(ns);
return set_anon_super(sb, NULL);
}
static int proc_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, struct vfsmount *mnt)
{
int err;
struct super_block *sb;
struct pid_namespace *ns;
struct proc_inode *ei;
if (proc_mnt) {
/* Seed the root directory with a pid so it doesn't need
* to be special in base.c. I would do this earlier but
* the only task alive when /proc is mounted the first time
* is the init_task and it doesn't have any pids.
*/
ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode);
if (!ei->pid)
ei->pid = find_get_pid(1);
}
if (flags & MS_KERNMOUNT)
ns = (struct pid_namespace *)data;
else
ns = current->nsproxy->pid_ns;
sb = sget(fs_type, proc_test_super, proc_set_super, ns);
if (IS_ERR(sb))
return PTR_ERR(sb);
if (!sb->s_root) {
sb->s_flags = flags;
err = proc_fill_super(sb);
if (err) {
deactivate_locked_super(sb);
return err;
}
ei = PROC_I(sb->s_root->d_inode);
if (!ei->pid) {
rcu_read_lock();
ei->pid = get_pid(find_pid_ns(1, ns));
rcu_read_unlock();
}
sb->s_flags |= MS_ACTIVE;
ns->proc_mnt = mnt;
}
simple_set_mnt(mnt, sb);
return 0;
}
static void proc_kill_sb(struct super_block *sb)
{
struct pid_namespace *ns;
ns = (struct pid_namespace *)sb->s_fs_info;
kill_anon_super(sb);
put_pid_ns(ns);
}
static struct file_system_type proc_fs_type = {
.name = "proc",
.get_sb = proc_get_sb,
.kill_sb = proc_kill_sb,
};
void __init proc_root_init(void)
{
int err;
proc_init_inodecache();
err = register_filesystem(&proc_fs_type);
if (err)
return;
proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
if (IS_ERR(proc_mnt)) {
unregister_filesystem(&proc_fs_type);
return;
}
proc_symlink("mounts", NULL, "self/mounts");
proc_net_init();
#ifdef CONFIG_SYSVIPC
proc_mkdir("sysvipc", NULL);
#endif
proc_mkdir("fs", NULL);
proc_mkdir("driver", NULL);
proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */
#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)
/* just give it a mountpoint */
proc_mkdir("openprom", NULL);
#endif
proc_tty_init();
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
proc_mkdir("bus", NULL);
proc_sys_init();
}
static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
)
{
generic_fillattr(dentry->d_inode, stat);
stat->nlink = proc_root.nlink + nr_processes();
return 0;
}
static struct dentry *proc_root_lookup(struct inode * dir, struct dentry * dentry, struct nameidata *nd)
{
if (!proc_lookup(dir, dentry, nd)) {
return NULL;
}
return proc_pid_lookup(dir, dentry, nd);
}
static int proc_root_readdir(struct file * filp,
void * dirent, filldir_t filldir)
{
unsigned int nr = filp->f_pos;
int ret;
if (nr < FIRST_PROCESS_ENTRY) {
int error = proc_readdir(filp, dirent, filldir);
if (error <= 0)
return error;
filp->f_pos = FIRST_PROCESS_ENTRY;
}
ret = proc_pid_readdir(filp, dirent, filldir);
return ret;
}
/*
* The root /proc directory is special, as it has the
* <pid> directories. Thus we don't use the generic
* directory handling functions for that..
*/
static const struct file_operations proc_root_operations = {
.read = generic_read_dir,
.readdir = proc_root_readdir,
};
/*
* proc root can do almost nothing..
*/
static const struct inode_operations proc_root_inode_operations = {
.lookup = proc_root_lookup,
.getattr = proc_root_getattr,
};
/*
* This is the root "inode" in the /proc tree..
*/
struct proc_dir_entry proc_root = {
.low_ino = PROC_ROOT_INO,
.namelen = 5,
.name = "/proc",
.mode = S_IFDIR | S_IRUGO | S_IXUGO,
.nlink = 2,
.count = ATOMIC_INIT(1),
.proc_iops = &proc_root_inode_operations,
.proc_fops = &proc_root_operations,
.parent = &proc_root,
};
int pid_ns_prepare_proc(struct pid_namespace *ns)
{
struct vfsmount *mnt;
mnt = kern_mount_data(&proc_fs_type, ns);
if (IS_ERR(mnt))
return PTR_ERR(mnt);
return 0;
}
void pid_ns_release_proc(struct pid_namespace *ns)
{
mntput(ns->proc_mnt);
}
|
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
extern int ngx_eventfd;
extern aio_context_t ngx_aio_ctx;
static void ngx_file_aio_event_handler(ngx_event_t *ev);
static int
io_submit(aio_context_t ctx, long n, struct iocb **paiocb)
{
return syscall(SYS_io_submit, ctx, n, paiocb);
}
ssize_t
ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset,
ngx_pool_t *pool)
{
ngx_err_t err;
struct iocb *piocb[1];
ngx_event_t *ev;
ngx_event_aio_t *aio;
if (!ngx_file_aio) {
return ngx_read_file(file, buf, size, offset);
}
aio = file->aio;
if (aio == NULL) {
aio = ngx_pcalloc(pool, sizeof(ngx_event_aio_t));
if (aio == NULL) {
return NGX_ERROR;
}
aio->file = file;
aio->fd = file->fd;
aio->event.data = aio;
aio->event.ready = 1;
aio->event.log = file->log;
file->aio = aio;
}
ev = &aio->event;
if (!ev->ready) {
ngx_log_error(NGX_LOG_ALERT, file->log, 0,
"second aio post for \"%V\"", &file->name);
return NGX_AGAIN;
}
ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0,
"aio complete:%d @%O:%z %V",
ev->complete, offset, size, &file->name);
if (ev->complete) {
ev->active = 0;
ev->complete = 0;
if (aio->res >= 0) {
ngx_set_errno(0);
return aio->res;
}
ngx_set_errno(-aio->res);
ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
"aio read \"%s\" failed", file->name.data);
return NGX_ERROR;
}
ngx_memzero(&aio->aiocb, sizeof(struct iocb));
aio->aiocb.aio_data = (uint64_t) (uintptr_t) ev;
aio->aiocb.aio_lio_opcode = IOCB_CMD_PREAD;
aio->aiocb.aio_fildes = file->fd;
aio->aiocb.aio_buf = (uint64_t) (uintptr_t) buf;
aio->aiocb.aio_nbytes = size;
aio->aiocb.aio_offset = offset;
aio->aiocb.aio_flags = IOCB_FLAG_RESFD;
aio->aiocb.aio_resfd = ngx_eventfd;
ev->handler = ngx_file_aio_event_handler;
piocb[0] = &aio->aiocb;
if (io_submit(ngx_aio_ctx, 1, piocb) == 1) {
ev->active = 1;
ev->ready = 0;
ev->complete = 0;
return NGX_AGAIN;
}
err = ngx_errno;
if (err == NGX_EAGAIN) {
return ngx_read_file(file, buf, size, offset);
}
ngx_log_error(NGX_LOG_CRIT, file->log, err,
"io_submit(\"%V\") failed", &file->name);
if (err == NGX_ENOSYS) {
ngx_file_aio = 0;
return ngx_read_file(file, buf, size, offset);
}
return NGX_ERROR;
}
static void
ngx_file_aio_event_handler(ngx_event_t *ev)
{
ngx_event_aio_t *aio;
aio = ev->data;
ngx_log_debug2(NGX_LOG_DEBUG_CORE, ev->log, 0,
"aio event handler fd:%d %V", aio->fd, &aio->file->name);
aio->handler(ev);
}
|
/* linux/arch/arm/mach-s3c2440/mach-rx3715.c
*
* Copyright (c) 2003-2004 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
* http://www.handhelds.org/projects/rx3715.html
*
* 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/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/memblock.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/serial.h>
#include <linux/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/partitions.h>
#include <asm/mach/arch.h>
#include <asm/mach/irq.h>
#include <asm/mach/map.h>
#include <linux/platform_data/mtd-nand-s3c2410.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <mach/fb.h>
#include <mach/hardware.h>
#include <mach/regs-gpio.h>
#include <mach/regs-lcd.h>
#include <mach/gpio-samsung.h>
#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/pm.h>
#include <plat/samsung-time.h>
#include "common.h"
#include "h1940.h"
static struct map_desc rx3715_iodesc[] __initdata = {
/* dump ISA space somewhere unused */
{
.virtual = (u32)S3C24XX_VA_ISA_WORD,
.pfn = __phys_to_pfn(S3C2410_CS3),
.length = SZ_1M,
.type = MT_DEVICE,
}, {
.virtual = (u32)S3C24XX_VA_ISA_BYTE,
.pfn = __phys_to_pfn(S3C2410_CS3),
.length = SZ_1M,
.type = MT_DEVICE,
},
};
static struct s3c2410_uartcfg rx3715_uartcfgs[] = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
.clk_sel = S3C2410_UCON_CLKSEL3,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x00,
.clk_sel = S3C2410_UCON_CLKSEL3,
},
/* IR port */
[2] = {
.hwport = 2,
.uart_flags = UPF_CONS_FLOW,
.ucon = 0x3c5,
.ulcon = 0x43,
.ufcon = 0x51,
.clk_sel = S3C2410_UCON_CLKSEL3,
}
};
/* framebuffer lcd controller information */
static struct s3c2410fb_display rx3715_lcdcfg __initdata = {
.lcdcon5 = S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 240,
.height = 320,
.pixclock = 260000,
.xres = 240,
.yres = 320,
.bpp = 16,
.left_margin = 36,
.right_margin = 36,
.hsync_len = 8,
.upper_margin = 6,
.lower_margin = 7,
.vsync_len = 3,
};
static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
.displays = &rx3715_lcdcfg,
.num_displays = 1,
.default_display = 0,
.lpcsel = 0xf82,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
};
static struct mtd_partition __initdata rx3715_nand_part[] = {
[0] = {
.name = "Whole Flash",
.offset = 0,
.size = MTDPART_SIZ_FULL,
.mask_flags = MTD_WRITEABLE,
}
};
static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
[0] = {
.name = "Internal",
.nr_chips = 1,
.nr_partitions = ARRAY_SIZE(rx3715_nand_part),
.partitions = rx3715_nand_part,
},
};
static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
.tacls = 25,
.twrph0 = 50,
.twrph1 = 15,
.nr_sets = ARRAY_SIZE(rx3715_nand_sets),
.sets = rx3715_nand_sets,
.ecc_mode = NAND_ECC_SOFT,
};
static struct platform_device *rx3715_devices[] __initdata = {
&s3c_device_ohci,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c_device_nand,
};
static void __init rx3715_map_io(void)
{
s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
}
static void __init rx3715_init_time(void)
{
s3c2440_init_clocks(16934000);
samsung_timer_init();
}
/* H1940 and RX3715 need to reserve this for suspend */
static void __init rx3715_reserve(void)
{
memblock_reserve(0x30003000, 0x1000);
memblock_reserve(0x30081000, 0x1000);
}
static void __init rx3715_init_machine(void)
{
#ifdef CONFIG_PM_H1940
memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
#endif
s3c_pm_init();
s3c_nand_set_platdata(&rx3715_nand_info);
s3c24xx_fb_set_platdata(&rx3715_fb_info);
platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
}
MACHINE_START(RX3715, "IPAQ-RX3715")
/* Maintainer: Ben Dooks <ben-linux@fluff.org> */
.atag_offset = 0x100,
.map_io = rx3715_map_io,
.reserve = rx3715_reserve,
.init_irq = s3c2440_init_irq,
.init_machine = rx3715_init_machine,
.init_time = rx3715_init_time,
MACHINE_END
|
/* Copyright 2008 - 2016 Freescale Semiconductor, Inc.
*
* 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 Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor 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 __DPAA_SYS_H
#define __DPAA_SYS_H
#include <linux/cpu.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/kthread.h>
#include <linux/sched/signal.h>
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_reserved_mem.h>
#include <linux/prefetch.h>
#include <linux/genalloc.h>
#include <asm/cacheflush.h>
/* For 2-element tables related to cache-inhibited and cache-enabled mappings */
#define DPAA_PORTAL_CE 0
#define DPAA_PORTAL_CI 1
#if (L1_CACHE_BYTES != 32) && (L1_CACHE_BYTES != 64)
#error "Unsupported Cacheline Size"
#endif
static inline void dpaa_flush(void *p)
{
#ifdef CONFIG_PPC
flush_dcache_range((unsigned long)p, (unsigned long)p+64);
#elif defined(CONFIG_ARM32)
__cpuc_flush_dcache_area(p, 64);
#elif defined(CONFIG_ARM64)
__flush_dcache_area(p, 64);
#endif
}
#define dpaa_invalidate(p) dpaa_flush(p)
#define dpaa_zero(p) memset(p, 0, 64)
static inline void dpaa_touch_ro(void *p)
{
#if (L1_CACHE_BYTES == 32)
prefetch(p+32);
#endif
prefetch(p);
}
/* Commonly used combo */
static inline void dpaa_invalidate_touch_ro(void *p)
{
dpaa_invalidate(p);
dpaa_touch_ro(p);
}
#ifdef CONFIG_FSL_DPAA_CHECKING
#define DPAA_ASSERT(x) WARN_ON(!(x))
#else
#define DPAA_ASSERT(x)
#endif
/* cyclic helper for rings */
static inline u8 dpaa_cyc_diff(u8 ringsize, u8 first, u8 last)
{
/* 'first' is included, 'last' is excluded */
if (first <= last)
return last - first;
return ringsize + last - first;
}
/* Offset applied to genalloc pools due to zero being an error return */
#define DPAA_GENALLOC_OFF 0x80000000
#endif /* __DPAA_SYS_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.