text
stringlengths 4
6.14k
|
|---|
/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; 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,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
#ifndef PFS_RWLOCK_PROVIDER_H
#define PFS_RWLOCK_PROVIDER_H
/**
@file include/pfs_rwlock_provider.h
Performance schema instrumentation (declarations).
*/
#include <sys/types.h>
#include "my_psi_config.h"
#ifdef HAVE_PSI_RWLOCK_INTERFACE
#ifdef MYSQL_SERVER
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "my_inttypes.h"
#include "my_macros.h"
#include "mysql/psi/psi_rwlock.h"
#define PSI_RWLOCK_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_rwlock_v1(const char *category,
PSI_rwlock_info_v1 *info,
int count);
PSI_rwlock*
pfs_init_rwlock_v1(PSI_rwlock_key key, const void *identity);
void pfs_destroy_rwlock_v1(PSI_rwlock* rwlock);
PSI_rwlock_locker*
pfs_start_rwlock_rdwait_v1(PSI_rwlock_locker_state *state,
PSI_rwlock *rwlock,
PSI_rwlock_operation op,
const char *src_file, uint src_line);
PSI_rwlock_locker*
pfs_start_rwlock_wrwait_v1(PSI_rwlock_locker_state *state,
PSI_rwlock *rwlock,
PSI_rwlock_operation op,
const char *src_file, uint src_line);
void pfs_unlock_rwlock_v1(PSI_rwlock *rwlock);
void pfs_end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc);
void pfs_end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_RWLOCK_INTERFACE */
#endif
|
/*
Copyright (C) 2003-2008 FreeIPMI Core Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#ifdef STDC_HEADERS
#include <string.h>
#endif /* STDC_HEADERS */
#include "freeipmi/spec/ipmi-event-reading-type-code-spec.h"
#include "freeipmi/spec/ipmi-sensor-types-spec.h"
#include "freeipmi-portability.h"
#include "tool-sensor-common.h"
int
sensor_classify (uint8_t event_reading_type_code)
{
if (IPMI_EVENT_READING_TYPE_CODE_IS_THRESHOLD(event_reading_type_code))
return SENSOR_CLASS_THRESHOLD;
if (IPMI_EVENT_READING_TYPE_CODE_IS_GENERIC(event_reading_type_code))
return SENSOR_CLASS_GENERIC_DISCRETE;
if (IPMI_EVENT_READING_TYPE_CODE_IS_SENSOR_SPECIFIC(event_reading_type_code))
return SENSOR_CLASS_SENSOR_SPECIFIC_DISCRETE;
if (IPMI_EVENT_READING_TYPE_CODE_IS_OEM(event_reading_type_code))
return SENSOR_CLASS_OEM;
return SENSOR_CLASS_NOT_AVAILABLE;
}
const char *
sensor_group (int sensor_type)
{
if (IPMI_SENSOR_TYPE_VALID(sensor_type))
return (ipmi_sensor_types[sensor_type]);
if (IPMI_SENSOR_TYPE_IS_OEM (sensor_type))
return ipmi_oem_sensor_type;
return NULL;
}
|
#ifndef _SYS_WAIT_H_
#define _SYS_WAIT_H_
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
#define WTERMSIG(status) ((status) & 0x7f)
#define WCOREDUMP(status) ((status) & 0x80)
#define WIFEXITED(status) (WTERMSIG(status) == 0)
#define WNOHANG 0x00000001
#define WUNTRACED 0x00000002
#define WCOREFLAG 0x80
#define WSTOPSIG(status) WEXITSTATUS(status)
typedef enum {
P_ALL,
P_PID,
P_PGID
} idtype_t;
extern pid_t wait(int *);
extern pid_t waitpid(pid_t, int *, int);
extern pid_t wait4(pid_t, int *, int, struct rusage *);
#ifdef __cplusplus
}
#endif
#endif
|
/***************************************************************************
* License: *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef TUPAUDIOEXTRACTOR_H
#define TUPAUDIOEXTRACTOR_H
#include "tglobal.h"
#include "tapplicationproperties.h"
#include "tuppg_config.h"
#include "sndfile.h"
//
// This class is the general audio extractor that wraps the library specific extractors.
// Its main purpose is to extract audio tracks from audio and video media and place them
// in either a .aiff or .wav temporary file depending on the platform and the library.
// The audio library libsndfile will than read into memory the temporary file as sound samples.
//
// NOTE: If a path is already a .aiff or .wav file it is just read in directly by libsndfile.
//
class TUPITUBE_EXPORT TupAudioExtractor : public QObject
// class TupAudioExtractor : public QObject
{
Q_OBJECT
public:
TupAudioExtractor(const char *path, bool reverse = false);
~TupAudioExtractor();
bool isValid() const;
real duration() const;
real getAmplitude(real startTime, real duration) const;
real getRMSAmplitude(real startTime, real duration) const;
real getMaxAmplitude(real startTime, real duration) const;
uint32 getNumSamples() const;
int32 sampleRate() const;
real *buffer() const;
uint32 timeToSample(real time, bool clamped) const;
private:
const char *sourcePath;
SF_INFO soundInfo;
uint32 numSamples;
sf_count_t numFrames;
float *samples;
// This function uses the cross platform libsndfile to read .aiff and .wav files
bool readSoundFile(const char *soundFilePath);
};
#endif
|
/***********************************************************************
WalkSurfaceNavigationTool - Version of the WalkNavigationTool that lets
a user navigate along an application-defined surface.
Copyright (c) 2009-2012 Oliver Kreylos
This file is part of the Virtual Reality User Interface Library (Vrui).
The Virtual Reality User Interface Library is free software; you can
redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
The Virtual Reality User Interface Library is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with the Virtual Reality User Interface Library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA
***********************************************************************/
#ifndef VRUI_WALKSURFACENAVIGATIONTOOL_INCLUDED
#define VRUI_WALKSURFACENAVIGATIONTOOL_INCLUDED
#include <Geometry/Point.h>
#include <Geometry/Vector.h>
#include <Geometry/OrthogonalTransformation.h>
#include <Geometry/Plane.h>
#include <GL/gl.h>
#include <GL/GLObject.h>
#include <GL/GLNumberRenderer.h>
#include <Vrui/Vrui.h>
#include <Vrui/SurfaceNavigationTool.h>
/* Forward declarations: */
class GLContextData;
namespace Vrui {
class WalkSurfaceNavigationTool;
class WalkSurfaceNavigationToolFactory:public ToolFactory
{
friend class WalkSurfaceNavigationTool;
/* Elements: */
private:
bool centerOnActivation; // Flag if to center navigation on the head position when the tool is activated
Point centerPoint; // Center point of movement circles on floor
Scalar moveSpeed; // Maximum movement speed
Scalar innerRadius; // Radius of circle of no motion around center point
Scalar outerRadius; // Radius where maximum movement speed is reached
Vector centerViewDirection; // Central view direction
Scalar rotateSpeed; // Maximum rotation speed in radians per second
Scalar innerAngle; // Angle of no rotation around central view direction
Scalar outerAngle; // Angle where maximum rotation speed is reached
Scalar fallAcceleration; // Acceleration when falling in physical space units per second^2, defaults to g
Scalar jetpackAcceleration; // Maximum acceleration of virtual jetpack in physical space units per second^2, defaults to 1.5*fallAcceleration
Scalar probeSize; // Size of probe to use when aligning surface frames
Scalar maxClimb; // Maximum amount of climb per frame
bool fixAzimuth; // Flag whether to fix the tool's azimuth angle during panning
bool drawMovementCircles; // Flag whether to draw the movement circles
Color movementCircleColor; // Color for drawing movement circles
bool drawHud; // Flag whether to draw a heads-up display
float hudFontSize; // Font size for heads-up display
/* Constructors and destructors: */
public:
WalkSurfaceNavigationToolFactory(ToolManager& toolManager);
virtual ~WalkSurfaceNavigationToolFactory(void);
/* Methods from ToolFactory: */
virtual const char* getName(void) const;
virtual const char* getButtonFunction(int buttonSlotIndex) const;
virtual const char* getValuatorFunction(int valuatorSlotIndex) const;
virtual Tool* createTool(const ToolInputAssignment& inputAssignment) const;
virtual void destroyTool(Tool* tool) const;
};
class WalkSurfaceNavigationTool:public SurfaceNavigationTool,public GLObject
{
friend class WalkSurfaceNavigationToolFactory;
/* Embedded classes: */
private:
struct DataItem:public GLObject::DataItem
{
/* Elements: */
public:
GLuint movementCircleListId; // Display list ID to render movement circles
GLuint hudListId; // Display list ID to render the hud
/* Constructors and destructors: */
DataItem(void);
virtual ~DataItem(void);
};
/* Elements: */
private:
static WalkSurfaceNavigationToolFactory* factory; // Pointer to the factory object for this class
GLNumberRenderer numberRenderer; // Helper class to render numbers using a HUD-style font
/* Transient navigation state: */
Point centerPoint; // Center point of movement circle while the navigation tool is active
Point footPos; // Position of the main viewer's foot on the last frame
Scalar headHeight; // Height of viewer's head above the foot point
NavTransform surfaceFrame; // Current local coordinate frame aligned to the surface in navigation coordinates
Scalar azimuth; // Current azimuth of view relative to local coordinate frame
Scalar elevation; // Current elevation of view relative to local coordinate frame
Scalar jetpack; // Current acceleration of virtual jetpack in units per second^2
Scalar fallVelocity; // Current falling velocity while airborne in units per second^2
/* Private methods: */
void applyNavState(void) const; // Sets the navigation transformation based on the tool's current navigation state
void initNavState(void); // Initializes the tool's navigation state when it is activated
/* Constructors and destructors: */
public:
WalkSurfaceNavigationTool(const ToolFactory* factory,const ToolInputAssignment& inputAssignment);
/* Methods from Tool: */
virtual const ToolFactory* getFactory(void) const;
virtual void buttonCallback(int buttonSlotIndex,InputDevice::ButtonCallbackData* cbData);
virtual void valuatorCallback(int valuatorSlotIndex,InputDevice::ValuatorCallbackData* cbData);
virtual void frame(void);
virtual void display(GLContextData& contextData) const;
/* Methods from GLObject: */
virtual void initContext(GLContextData& contextData) const;
};
}
#endif
|
#include <linux/mutex.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
#include <net/netlink.h>
#include <net/net_namespace.h>
#include <linux/module.h>
#include <linux/rtnetlink.h>
#include <net/sock.h>
#include <linux/inet_diag.h>
#include <linux/sock_diag.h>
static struct sock_diag_handler *sock_diag_handlers[AF_MAX];
static int (*inet_rcv_compat)(struct sk_buff *skb, struct nlmsghdr *nlh);
static DEFINE_MUTEX(sock_diag_table_mutex);
int sock_diag_check_cookie(void *sk, __u32 *cookie)
{
if ((cookie[0] != INET_DIAG_NOCOOKIE ||
cookie[1] != INET_DIAG_NOCOOKIE) &&
((u32)(unsigned long)sk != cookie[0] ||
(u32)((((unsigned long)sk) >> 31) >> 1) != cookie[1]))
return -ESTALE;
else
return 0;
}
EXPORT_SYMBOL_GPL(sock_diag_check_cookie);
void sock_diag_save_cookie(void *sk, __u32 *cookie)
{
cookie[0] = (u32)(unsigned long)sk;
cookie[1] = (u32)(((unsigned long)sk >> 31) >> 1);
}
EXPORT_SYMBOL_GPL(sock_diag_save_cookie);
int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attrtype)
{
__u32 *mem;
mem = RTA_DATA(__RTA_PUT(skb, attrtype, SK_MEMINFO_VARS * sizeof(__u32)));
mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk);
mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf;
mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk);
mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf;
mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;
mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued;
mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc);
return 0;
rtattr_failure:
return -EMSGSIZE;
}
EXPORT_SYMBOL_GPL(sock_diag_put_meminfo);
void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh))
{
mutex_lock(&sock_diag_table_mutex);
inet_rcv_compat = fn;
mutex_unlock(&sock_diag_table_mutex);
}
EXPORT_SYMBOL_GPL(sock_diag_register_inet_compat);
void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh))
{
mutex_lock(&sock_diag_table_mutex);
inet_rcv_compat = NULL;
mutex_unlock(&sock_diag_table_mutex);
}
EXPORT_SYMBOL_GPL(sock_diag_unregister_inet_compat);
int sock_diag_register(struct sock_diag_handler *hndl)
{
int err = 0;
if (hndl->family >= AF_MAX)
return -EINVAL;
mutex_lock(&sock_diag_table_mutex);
if (sock_diag_handlers[hndl->family])
err = -EBUSY;
else
sock_diag_handlers[hndl->family] = hndl;
mutex_unlock(&sock_diag_table_mutex);
return err;
}
EXPORT_SYMBOL_GPL(sock_diag_register);
void sock_diag_unregister(struct sock_diag_handler *hnld)
{
int family = hnld->family;
if (family >= AF_MAX)
return;
mutex_lock(&sock_diag_table_mutex);
BUG_ON(sock_diag_handlers[family] != hnld);
sock_diag_handlers[family] = NULL;
mutex_unlock(&sock_diag_table_mutex);
}
EXPORT_SYMBOL_GPL(sock_diag_unregister);
static inline struct sock_diag_handler *sock_diag_lock_handler(int family)
{
if (sock_diag_handlers[family] == NULL)
request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
NETLINK_SOCK_DIAG, family);
mutex_lock(&sock_diag_table_mutex);
return sock_diag_handlers[family];
}
static inline void sock_diag_unlock_handler(struct sock_diag_handler *h)
{
mutex_unlock(&sock_diag_table_mutex);
}
static int __sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
int err;
struct sock_diag_req *req = NLMSG_DATA(nlh);
struct sock_diag_handler *hndl;
if (nlmsg_len(nlh) < sizeof(*req))
return -EINVAL;
//#ifdef FEATURE_SKY_DS_GOOGLE_PATCH
if (req->sdiag_family >= AF_MAX)
return -EINVAL;
//#endif FEATURE_SKY_DS_GOOGLE_PATCH
if (req->sdiag_family >= AF_MAX)
return -EINVAL;
hndl = sock_diag_lock_handler(req->sdiag_family);
if (hndl == NULL)
err = -ENOENT;
else
err = hndl->dump(skb, nlh);
sock_diag_unlock_handler(hndl);
return err;
}
static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
int ret;
switch (nlh->nlmsg_type) {
case TCPDIAG_GETSOCK:
case DCCPDIAG_GETSOCK:
if (inet_rcv_compat == NULL)
request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
NETLINK_SOCK_DIAG, AF_INET);
mutex_lock(&sock_diag_table_mutex);
if (inet_rcv_compat != NULL)
ret = inet_rcv_compat(skb, nlh);
else
ret = -EOPNOTSUPP;
mutex_unlock(&sock_diag_table_mutex);
return ret;
case SOCK_DIAG_BY_FAMILY:
return __sock_diag_rcv_msg(skb, nlh);
default:
return -EINVAL;
}
}
static DEFINE_MUTEX(sock_diag_mutex);
static void sock_diag_rcv(struct sk_buff *skb)
{
mutex_lock(&sock_diag_mutex);
netlink_rcv_skb(skb, &sock_diag_rcv_msg);
mutex_unlock(&sock_diag_mutex);
}
struct sock *sock_diag_nlsk;
EXPORT_SYMBOL_GPL(sock_diag_nlsk);
static int __init sock_diag_init(void)
{
sock_diag_nlsk = netlink_kernel_create(&init_net, NETLINK_SOCK_DIAG, 0,
sock_diag_rcv, NULL, THIS_MODULE);
return sock_diag_nlsk == NULL ? -ENOMEM : 0;
}
static void __exit sock_diag_exit(void)
{
netlink_kernel_release(sock_diag_nlsk);
}
module_init(sock_diag_init);
module_exit(sock_diag_exit);
MODULE_LICENSE("GPL");
MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_SOCK_DIAG);
|
/* $Id: diddfunc.c,v 1.14.6.2 2004/08/28 20:03:53 armin Exp $
*
* DIDD Interface module for Eicon active cards.
*
* Functions are in dadapter.c
*
* Copyright 2002-2003 by Armin Schindler (mac@melware.de)
* Copyright 2002-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include "platform.h"
#include "di_defs.h"
#include "dadapter.h"
#include "divasync.h"
#define DBG_MINIMUM (DL_LOG + DL_FTL + DL_ERR)
#define DBG_DEFAULT (DBG_MINIMUM + DL_XLOG + DL_REG)
extern void DIVA_DIDD_Read(void *, int);
extern char *DRIVERRELEASE_DIDD;
static dword notify_handle;
static DESCRIPTOR _DAdapter;
/*
* didd callback function
*/
static void didd_callback(void *context, DESCRIPTOR *adapter,
int removal)
{
if (adapter->type == IDI_DADAPTER) {
DBG_ERR(("Notification about IDI_DADAPTER change ! Oops."))
return;
} else if (adapter->type == IDI_DIMAINT) {
if (removal) {
DbgDeregister();
} else {
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
}
/*
* connect to didd
*/
static int __init connect_didd(void)
{
int x = 0;
int dadapter = 0;
IDI_SYNC_REQ req;
DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
for (x = 0; x < MAX_DESCRIPTORS; x++) {
if (DIDD_Table[x].type == IDI_DADAPTER) { /* DADAPTER found */
dadapter = 1;
memcpy(&_DAdapter, &DIDD_Table[x], sizeof(_DAdapter));
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = didd_callback;
req.didd_notify.info.context = NULL;
_DAdapter.request((ENTITY *)&req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
notify_handle = req.didd_notify.info.handle;
} else if (DIDD_Table[x].type == IDI_DIMAINT) { /* MAINT found */
DbgRegister("DIDD", DRIVERRELEASE_DIDD, DBG_DEFAULT);
}
}
return (dadapter);
}
/*
* disconnect from didd
*/
static void __exit disconnect_didd(void)
{
IDI_SYNC_REQ req;
req.didd_notify.e.Req = 0;
req.didd_notify.e.Rc = IDI_SYNC_REQ_DIDD_REMOVE_ADAPTER_NOTIFY;
req.didd_notify.info.handle = notify_handle;
_DAdapter.request((ENTITY *)&req);
}
/*
* init
*/
int __init diddfunc_init(void)
{
diva_didd_load_time_init();
if (!connect_didd()) {
DBG_ERR(("init: failed to connect to DIDD."))
diva_didd_load_time_finit();
return (0);
}
return (1);
}
/*
* finit
*/
void __exit diddfunc_finit(void)
{
DbgDeregister();
disconnect_didd();
diva_didd_load_time_finit();
}
|
/*
* initialize SA ID structure
* Copyright (C) 2000 Henry Spencer.
*
* 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. See <http://www.fsf.org/copyleft/lgpl.txt>.
*
* 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.
*
* RCSID $Id: initsaid.c,v 1.5 2004-04-09 18:00:39 mcr Exp $
*/
#include "internal.h"
#include "openswan.h"
/*
- initsaid - initialize SA ID from bits
*/
void
initsaid(addr, spi, proto, dst)
const ip_address *addr;
ipsec_spi_t spi;
int proto;
ip_said *dst;
{
dst->dst = *addr;
dst->spi = spi;
dst->proto = proto;
}
|
/* (C) IT Sky Consulting GmbH 2015
* http://www.it-sky-consulting.com/
* Author: Karl Brodowsky
* Date: 2016-06-05
* License: GPL v2 (See https://de.wikipedia.org/wiki/GNU_General_Public_License )
*/
/* implements tests for c-arithmetic */
/* enable qsort_r */
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <CUnit/Basic.h>
#include <math.h>
#include <time.h>
#include <sqrt.h>
// static const uint128 MAX_UINT128 = (uint128) -1;
// static const uint128 MAX_UINT128_POW2 = ((uint128) 1) << 127;
// static const uint64 MAX_UINT64 = (uint64) -1;
// static const uint64 MAX_UINT64_POW2 = ((uint64) 1) << 63;
// static const uint32 MAX_UINT32 = (uint32) -1;
// static const uint32 MAX_UINT32_POW2 = ((uint32) 1) << 31;
/* The suite initialization function.
* Opens the temporary file used by the tests.
* Returns zero on success, non-zero otherwise.
*/
int init_suite1() {
return 0;
}
/* The suite cleanup function.
* Closes the temporary file used by the tests.
* Returns zero on success, non-zero otherwise.
*/
int clean_suite1(void) {
return 0;
}
void test_ffff() {
printf("\n");
uint128 x = (((uint128) 1) << 126) + 1;
uint64 yb = sqrt_bit_wise(x);
uint64 yw = sqrt_word_wise(x);
uint64 y_expected = ((uint64) 1) << 63;
char bufd[1024];
char bufx[1024];
sprint_uint128_dec(bufd, x);
sprint_uint128_hex(bufx, x, 1);
printf(" 0x40000000000000000000000000000001\n");
printf(" x=%s (%s)\n", bufd, bufx);
printf("yb=%llu (0x%llx)\n", yb, yb);
printf("yw=%llu (0x%llx)\n", yw, yw);
CU_ASSERT_EQUAL(y_expected, yb);
CU_ASSERT_EQUAL(y_expected, yw);
}
/* The main() function for setting up and running the tests.
* Returns a CUE_SUCCESS on successful running, another
* CUnit error code on failure.
*/
int main() {
CU_pSuite pSuite = NULL;
/* initialize the CUnit test registry */
if (CUE_SUCCESS != CU_initialize_registry()) {
return CU_get_error();
}
/* add a suite to the registry */
pSuite = CU_add_suite("Suite_1", init_suite1, clean_suite1);
if (NULL == pSuite) {
CU_cleanup_registry();
return CU_get_error();
}
/* add the tests to the suite */
if ((NULL == CU_add_test(pSuite, "test near max uint128", test_ffff))
) {
CU_cleanup_registry();
return CU_get_error();
}
/* Run all tests using the CUnit Basic interface */
CU_basic_set_mode(CU_BRM_VERBOSE);
CU_basic_run_tests();
CU_cleanup_registry();
return CU_get_error();
}
|
/*
* ShellForge example: execute /bin/ls -aR /
* $Id$
*/
int main()
{
char *a[] = {"/bin/ls", "-aR", "/", 0};
execve(*a, a, 0);
}
|
#ifndef _TLB_CONTEXT_H
#define _TLB_CONTEXT_H
struct sTlbContext
{
};
#endif
|
/************************************************************************
Copyright (C) Alain Di Chiappari
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
************************************************************************/
/*************************** SCHEDULER.C *******************************
Questo modulo implementa uno scheduler con politica round robin e
fornisce una parte dei servizi utili per la gestione del tempo.
************************************************************************/
/* Phase1 */
#include <msg.e>
#include <tcb.e>
/* Phase2 */
#include <boot.e>
/**********************************************************************
SCHEDULER
Complementare del gestore delle eccezioni e degli interrupt per la
gestione del tempo,si occupa di:
-Rilevare la situazione di shutdown e invocare la routine HALT()
-Rilevare la situazione di deadlock e invocare la routine PANIC()
-Rilevare la situazione di wait, aspettando un interrupt
-Caricare i processi sulla CPU con una politica Round-Robin
-Settare l'Interval Timer garantendo sia l'equità di time slice per i
thread, sia l'astrazione di device virtuale Pseudo Clock Tick
**********************************************************************/
void scheduler () {
/* Nessun processo attualmente caricato sulla CPU */
if (current_thread == NULL) {
/* Ready Queue vuota: distinzione dei 3 casi particolari */
if (emptyThreadQ(&ready_queue)) {
/* L'unico processo sulla CPU è l'SSI -> Normal System Shutdown */
if (thread_count == 1) HALT();
/*
Semplice Deadlock Detection:
Tutti i processi nel sistema sono fermi in attesa di
un messaggio ma non di servizi o I/O, quindi situazione
non risolvibile con input da SSI o Interrupt.
Viene invocata la routine PANIC().
*/
if ((thread_count > 0) && (soft_block_count == 0)) PANIC();
/* Wait state, i processi che sono nel sistema aspettano servizio SSI o I/O */
if ((thread_count > 0) && (soft_block_count > 0)) {
/* Setto lo stato del processore abilitando gli Interrupt e aspetto */
setSTATUS((getSTATUS() | STATUS_IEc | STATUS_INT_UNMASKED));
/* With new istruction of umps2 */
WAIT();
/* Without WAIT() istruction
* while(TRUE) ;
*/
}
else PANIC();
}
/* Ready Queue non vuota */
else {
/* Tolgo il primo thread dalla ready queue e lo imposto come thread corrente */
if ((current_thread = removeThread(&ready_queue)) == NULL) PANIC();
/* Aggiorno lo Pseudo Clock Tick */
pseudo_tick += (GET_TODLOW - start_pseudo_tick);
/* Riprendo subito il tempo */
start_pseudo_tick = GET_TODLOW;
/* Gestione tempi thread: inizializzo time slice nel campo apposito del TCB */
current_thread->cpu_slice = 0;
/* Prendo il tempo inizale utile all'aggiornamento successivo */
current_thread_tod = GET_TODLOW;
/* Se lo pseudo clock è stato superato faccio scattare subito l'interrupt */
if (pseudo_tick >= SCHED_PSEUDO_CLOCK)
SET_IT(1);
/* Per tenere la gestione di Time Slice e Pseudo Clock Tick setto il tempo minimo fra le due scadenze */
else
SET_IT(MIN(SCHED_TIME_SLICE, (SCHED_PSEUDO_CLOCK - pseudo_tick)));
/* Carico lo stato del processore e quindi parte il thread */
LDST(&(current_thread->t_state));
PANIC();
}
}
/* Un thread è già attivo nel sistema */
else if (current_thread != NULL) {
/* Come sopra: calcolo delle tempistiche per Pseudo Clock e Thread Time Slice */
pseudo_tick += (GET_TODLOW - start_pseudo_tick);
start_pseudo_tick = GET_TODLOW;
current_thread_tod = GET_TODLOW;
/* Come sopra: settaggio Interval Timer */
if (pseudo_tick >= SCHED_PSEUDO_CLOCK)
SET_IT(1);
else
SET_IT(MIN((SCHED_TIME_SLICE - current_thread->cpu_slice),(SCHED_PSEUDO_CLOCK - pseudo_tick)));
LDST(&(current_thread->t_state));
}
}
|
/* assembly.h - assembly language definitions
Copyright (C) 2010 Hector Martin "marcan" <hector@marcansoft.com
This code is licensed to you under the terms of the GNU GPL, version 2;
see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
#ifndef ASSEMBLY_H
#define ASSEMBLY_H
#define r0 0
#define r1 1
#define r2 2
#define r3 3
#define r4 4
#define r5 5
#define r6 6
#define r7 7
#define r8 8
#define r9 9
#define r10 10
#define r11 11
#define r12 12
#define r13 13
#define r14 14
#define r15 15
#define r16 16
#define r17 17
#define r18 18
#define r19 19
#define r20 20
#define r21 21
#define r22 22
#define r23 23
#define r24 24
#define r25 25
#define r26 26
#define r27 27
#define r28 28
#define r29 29
#define r30 30
#define r31 31
#define sp r1
#define toc r2
#define cr0 0
#define cr1 1
#define cr2 2
#define cr3 3
#define cr4 4
#define cr5 5
#define cr6 6
#define cr7 7
#define fr0 0
#define fr1 1
#define fr2 2
#define fr3 3
#define fr4 4
#define fr5 5
#define fr6 6
#define fr7 7
#define fr8 8
#define fr9 9
#define fr10 10
#define fr11 11
#define fr12 12
#define fr13 13
#define fr14 14
#define fr15 15
#define fr16 16
#define fr17 17
#define fr18 18
#define fr19 19
#define fr20 20
#define fr21 21
#define fr22 22
#define fr23 23
#define fr24 24
#define fr25 25
#define fr26 26
#define fr27 27
#define fr28 28
#define fr29 29
#define fr30 30
#define fr31 31
#define lv1call sc 1; extsw r3, r3
#define XGLUE(a,b) a##b
#define GLUE(a,b) XGLUE(a,b)
#define _GLOBAL(name) \
.section ".text"; \
.align 2 ; \
.globl name; \
.globl GLUE(.,name); \
.section ".opd","aw"; \
name: \
.quad GLUE(.,name); \
.quad .TOC.@tocbase; \
.quad 0; \
.previous; \
.type GLUE(.,name),@function; \
GLUE(.,name):
#endif
|
/* GemRB - Infinity Engine Emulator
* Copyright (C) 2003 The GemRB Project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef FILECACHE_H
#define FILECACHE_H
#include "Streams/DataStream.h"
namespace GemRB {
GEM_EXPORT DataStream* CacheCompressedStream(DataStream *stream, const std::string& filename, int length = 0, bool overwrite = false);
}
#endif
|
/* horst - Highly Optimized Radio Scanning Tool
*
* Copyright (C) 2005-2014 Bruno Randolf (br1@einfach.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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/******************* FILTER *******************/
#include <stdlib.h>
#include "display.h"
#include "main.h"
#include "channel.h"
#include "network.h"
void
update_channel_win(WINDOW *win)
{
box(win, 0 , 0);
print_centered(win, 0, 39, " Channel Settings ");
mvwprintw(win, 2, 2, "a: [%c] Automatically change channel",
conf.do_change_channel ? '*' : ' ');
mvwprintw(win, 3, 2, "d: Channel dwell time: %d ms ",
conf.channel_time/1000);
mvwprintw(win, 4, 2, "u: Upper channel limit: %d ", conf.channel_max);
mvwprintw(win, 6, 2, "m: Manually change channel: %d ", channel_get_current_chan());
print_centered(win, 8, 39, "[ Press key or ENTER ]");
wrefresh(win);
}
int
channel_input(WINDOW *win, int c)
{
char buf[6];
int x;
switch (c) {
case 'a': case 'A':
conf.do_change_channel = conf.do_change_channel ? 0 : 1;
break;
case 'd': case 'D':
echo();
curs_set(1);
mvwgetnstr(win, 3, 25, buf, 6);
curs_set(0);
noecho();
sscanf(buf, "%d", &x);
conf.channel_time = x*1000;
break;
case 'u': case 'U':
echo();
curs_set(1);
mvwgetnstr(win, 4, 26, buf, 6);
curs_set(0);
noecho();
sscanf(buf, "%d", &x);
conf.channel_max = x;
break;
case 'm': case 'M':
echo();
curs_set(1);
mvwgetnstr(win, 6, 30, buf, 3);
curs_set(0);
noecho();
sscanf(buf, "%d", &x);
x = channel_find_index_from_chan(x);
if (x >= 0) {
if (!conf.serveraddr[0] != '\0')
channel_change(x);
else
conf.channel_idx = x;
}
break;
default:
return 0; /* didn't handle input */
}
net_send_channel_config();
update_channel_win(win);
return 1;
}
|
/* This file is part of Pazpar2.
Copyright (C) 2006-2013 Index Data
Pazpar2 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.
Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PAZPAR2_CONFIG_H
#define PAZPAR2_CONFIG_H
#include "normalize_cache.h"
#include <yaz/nmem.h>
#include <yaz/mutex.h>
#include <yaz/ccl.h>
#include "charsets.h"
#include "http.h"
#include "database.h"
#include "host.h"
enum conf_metadata_type {
Metadata_type_generic, // Generic text field
Metadata_type_year, // A number
Metadata_type_date // A number
};
enum conf_metadata_merge {
Metadata_merge_no, // Don't merge
Metadata_merge_unique, // Include unique elements in merged block
Metadata_merge_longest, // Include the longest (strlen) value
Metadata_merge_range, // Store value as a range of lowest-highest
Metadata_merge_all // Just include all elements found
};
enum conf_sortkey_type {
Metadata_sortkey_relevance,
Metadata_sortkey_numeric, // Standard numerical sorting
Metadata_sortkey_skiparticle, // Skip leading article when sorting
Metadata_sortkey_string, // Flat string
Metadata_sortkey_position // Position
};
// This controls the ability to insert 'static' values from settings into retrieval recs
enum conf_setting_type {
Metadata_setting_no,
Metadata_setting_postproc, // Insert setting value into normalized record
Metadata_setting_parameter // Expose value to normalization stylesheets
};
enum conf_metadata_mergekey {
Metadata_mergekey_no,
Metadata_mergekey_optional,
Metadata_mergekey_required
};
// Describes known metadata elements and how they are to be manipulated
// An array of these structure provides a 'map' against which
// discovered metadata elements are matched. It also governs storage,
// to minimize number of cycles needed at various tages of processing
struct conf_metadata
{
char *name; // The field name. Output by normalization stylesheet
int brief; // Is this element to be returned in the brief format?
int termlist;// Is this field to be treated as a termlist for browsing?
const char *rank;
int sortkey_offset; // -1 if it's not a sortkey, otherwise index
// into service/record_cluster->sortkey array
enum conf_metadata_type type;
enum conf_metadata_merge merge;
enum conf_setting_type setting; // Value is to be taken from session/db settings?
enum conf_metadata_mergekey mergekey;
char *facetrule;
char *limitmap; // Should be expanded into service-wide default e.g. pz:limitmap:<name>=value setting
char *limitcluster;
};
// Controls sorting
struct conf_sortkey
{
char *name;
enum conf_sortkey_type type;
};
struct conf_server;
// It is conceivable that there will eventually be several 'services'
// offered from one server, with separate configuration -- possibly
// more than one services associated with the same port. For now,
// however, only a single service is possible.
struct conf_service
{
YAZ_MUTEX mutex;
int num_metadata;
struct conf_metadata *metadata;
int num_sortkeys;
struct conf_sortkey *sortkeys;
struct setting_dictionary *dictionary;
struct settings_array *settings;
struct conf_service *next;
char *id;
NMEM nmem;
int session_timeout;
int z3950_session_timeout;
int z3950_operation_timeout;
int rank_cluster;
int rank_debug;
double rank_follow;
double rank_lead;
int rank_length;
char *default_sort;
int ref_count;
/* duplicated from conf_server */
pp2_charset_fact_t charsets;
struct service_xslt *xslt_list;
CCL_bibset ccl_bibset;
struct database *databases;
struct conf_server *server;
};
int conf_service_metadata_field_id(struct conf_service *service, const char * name);
int conf_service_sortkey_field_id(struct conf_service *service, const char * name);
struct conf_server
{
char *host;
int port;
char *proxy_host;
int proxy_port;
char *myurl;
char *settings_fname;
char *server_id;
pp2_charset_fact_t charsets;
struct conf_service *service;
struct conf_server *next;
struct conf_config *config;
http_server_t http_server;
iochan_man_t iochan_man;
database_hosts_t database_hosts;
};
struct conf_config *config_create(const char *fname, int verbose);
void config_destroy(struct conf_config *config);
void config_process_events(struct conf_config *config);
void info_services(struct conf_server *server, WRBUF w);
struct conf_service *locate_service(struct conf_server *server,
const char *service_id);
struct conf_service *service_create(struct conf_server *server,
xmlNode *node);
void service_incref(struct conf_service *service);
void service_destroy(struct conf_service *service);
int config_start_listeners(struct conf_config *conf,
const char *listener_override,
const char *record_fname);
void config_stop_listeners(struct conf_config *conf);
WRBUF conf_get_fname(struct conf_config *config, const char *fname);
#endif
/*
* Local variables:
* c-basic-offset: 4
* c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
|
/* Copyright (C) 2000 drscholl@users.sourceforge.net
This is free software distributed under the terms of the
GNU Public License. See the file COPYING for details.
$Id$ */
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include "opennap.h"
#include "debug.h"
/* this is nasty but a necessary evil to avoid using a static buffer */
char *
append_string (char *in, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
vsnprintf (Buf, sizeof (Buf), fmt, ap);
va_end (ap);
if (!in)
return STRDUP (Buf);
else
{
int len = strlen (in);
if(safe_realloc((void**)&in, len + strlen (Buf) + 1))
return 0;
strcpy(in+len,Buf);
return in;
}
}
/* 604 <user> */
HANDLER (whois)
{
USER *sender, *user;
time_t online;
LIST *chan;
USERDB *db;
char *cap;
char *rsp = 0;
(void) tag;
(void) len;
CHECK_USER_CLASS ("whois");
sender = con->user;
ASSERT (validate_connection (con));
user = hash_lookup (Users, pkt);
if (!user)
{
/* check to see if this is a registered nick */
db = hash_lookup (User_Db, pkt);
if (db)
send_cmd (con, MSG_SERVER_WHOWAS, "%s \"%s\" %d", db->nick,
Levels[db->level], db->lastSeen);
else
nosuchuser (con);
return;
}
ASSERT (validate_user (user));
online = (int) (Current_Time - user->connected);
rsp = append_string (rsp, "%s", user->nick);
rsp = append_string (rsp, " \"%s\"", Levels[user->level]);
rsp = append_string (rsp, " %d", (int) online);
rsp = append_string (rsp, " \" ");
/* always show channel membership to privileged users */
if (!user->cloaked || sender->level > LEVEL_USER)
{
for (chan = user->channels; chan; chan = chan->next)
{
if((((CHANNEL*)chan->data)->flags & ON_CHANNEL_PRIVATE)==0)
rsp = append_string (rsp, "%s ", ((CHANNEL *) chan->data)->name);
}
}
rsp = append_string (rsp, "\""); /* terminate the channel list */
if (user->muzzled)
cap = "Muzzled";
else if (user->cloaked && sender->level > LEVEL_USER)
cap = "Cloaked"; /* show cloaked state to privileged users */
else
cap = "Active";
rsp = append_string (rsp, " \"%s\"", cap);
rsp = append_string (rsp, " %d %d %d %d", user->shared, user->downloads,
user->uploads, user->speed);
rsp = append_string (rsp, " \"%s\"", user->clientinfo);
/* moderators and above see some additional information */
if (sender->level > LEVEL_USER)
{
db = hash_lookup (User_Db, user->nick);
rsp = append_string (rsp, " %d %d %s %d %d",
user->totaldown, user->totalup,
my_ntoa (user->ip),
user->conport, user->port);
#if EMAIL
#define EmailAddr(db) db?db->email:"unknown"
#else
#define EmailAddr(db) "unknown"
#endif
rsp = append_string (rsp, " %s", EmailAddr(db));
}
/* admins and above see the server the user is connected to. this is
only admin+ since the windows client would likely barf if present.
i assume that admin+ will use another client such as BWap which
understands the extra field */
if (sender->level > LEVEL_MODERATOR)
rsp =
append_string (rsp, " %s",
user->server ? user->server : Server_Name);
send_user (sender, MSG_SERVER_WHOIS_RESPONSE, "%s", rsp);
FREE (rsp);
/* notify privileged users when someone requests their info */
if (user->level >= LEVEL_MODERATOR && sender != user)
{
ASSERT (validate_connection (user->con));
send_user (user, MSG_SERVER_NOSUCH,
"%s has requested your info", con->user->nick);
}
}
|
/*
* include/asm-generic/mutex-xchg.h
*
* Generic implementation of the mutex fastpath, based on xchg().
*
* NOTE: An xchg based implementation might be less optimal than an atomic
* decrement/increment based implementation. If your architecture
* has a reasonable atomic dec/inc then you should probably use
* asm-generic/mutex-dec.h instead, or you could open-code an
* optimized version in asm/mutex.h.
*/
#ifndef _ASM_GENERIC_MUTEX_XCHG_H
#define _ASM_GENERIC_MUTEX_XCHG_H
/**
* __mutex_fastpath_lock - try to take the lock by moving the count
* from 1 to a 0 value
* @count: pointer of type atomic_t
* @fail_fn: function to call if the original value was not 1
*
* Change the count from 1 to a value lower than 1, and call <fail_fn> if it
* wasn't 1 originally. This function MUST leave the value lower than 1
* even when the "1" assertion wasn't true.
*/
static inline void
__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
if (unlikely(atomic_xchg(count, 0) != 1))
/*
* We failed to acquire the lock, so mark it contended
* to ensure that any waiting tasks are woken up by the
* unlock slow path.
*/
if (likely(atomic_xchg(count, -1) != 1))
fail_fn(count);
}
/**
* __mutex_fastpath_lock_retval - try to take the lock by moving the count
* from 1 to a 0 value
* @count: pointer of type atomic_t
* @fail_fn: function to call if the original value was not 1
*
* Change the count from 1 to a value lower than 1, and call <fail_fn> if it
* wasn't 1 originally. This function returns 0 if the fastpath succeeds,
* or anything the slow path function returns
*/
static inline int
__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
{
if (unlikely(atomic_xchg(count, 0) != 1))
if (likely(atomic_xchg(count, -1) != 1))
return fail_fn(count);
return 0;
}
/**
* __mutex_fastpath_unlock - try to promote the mutex from 0 to 1
* @count: pointer of type atomic_t
* @fail_fn: function to call if the original value was not 0
*
* try to promote the mutex from 0 to 1. if it wasn't 0, call <function>
* In the failure case, this function is allowed to either set the value to
* 1, or to set it to a value lower than one.
* If the implementation sets it to a value of lower than one, the
* __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
* to return 0 otherwise.
*/
static inline void
__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
{
if (unlikely(atomic_xchg(count, 1) != 0))
fail_fn(count);
}
#define __mutex_slowpath_needs_to_unlock() 0
/**
* __mutex_fastpath_trylock - try to acquire the mutex, without waiting
*
* @count: pointer of type atomic_t
* @fail_fn: spinlock based trylock implementation
*
* Change the count from 1 to a value lower than 1, and return 0 (failure)
* if it wasn't 1 originally, or return 1 (success) otherwise. This function
* MUST leave the value lower than 1 even when the "1" assertion wasn't true.
* Additionally, if the value was < 0 originally, this function must not leave
* it to 0 on failure.
*
* If the architecture has no effective trylock variant, it should call the
* <fail_fn> spinlock-based trylock variant unconditionally.
*/
static inline int
__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
{
int prev = atomic_xchg(count, 0);
if (unlikely(prev < 0)) {
/*
* The lock was marked contended so we must restore that
* state. If while doing so we get back a prev value of 1
* then we just own it.
*
* [ In the rare case of the mutex going to 1, to 0, to -1
* and then back to 0 in this few-instructions window,
* this has the potential to trigger the slowpath for the
* owner's unlock path needlessly, but that's not a problem
* in practice. ]
*/
prev = atomic_xchg(count, prev);
if (prev < 0)
prev = 0;
}
return prev;
}
#endif
|
/* $begin csapp.h */
#ifndef __CSAPP_H__
#define __CSAPP_H__
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <errno.h>
#include <math.h>
#include <pthread.h>
#include <semaphore.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/* Default file permissions are DEF_MODE & ~DEF_UMASK */
/* $begin createmasks */
#define DEF_MODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
#define DEF_UMASK S_IWGRP|S_IWOTH
/* $end createmasks */
/* Simplifies calls to bind(), connect(), and accept() */
/* $begin sockaddrdef */
typedef struct sockaddr SA;
/* $end sockaddrdef */
/* Persistent state for the robust I/O (Rio) package */
/* $begin rio_t */
#define RIO_BUFSIZE 8192
typedef struct {
int rio_fd; /* descriptor for this internal buf */
int rio_cnt; /* unread bytes in internal buf */
char *rio_bufptr; /* next unread byte in internal buf */
char rio_buf[RIO_BUFSIZE]; /* internal buffer */
} rio_t;
/* $end rio_t */
/* External variables */
extern int h_errno; /* defined by BIND for DNS errors */
extern char **environ; /* defined by libc */
/* Misc constants */
#define MAXLINE 8192 /* max text line length */
#define MAXBUF 8192 /* max I/O buffer size */
#define LISTENQ 1024 /* second argument to listen() */
/* Our own error-handling functions */
void unix_error(char *msg);
void posix_error(int code, char *msg);
void dns_error(char *msg);
void log_unix_error(char *msg);
void log_dns_error(char *msg);
/* Signal wrappers */
typedef void handler_t(int);
handler_t *Signal(int signum, handler_t *handler);
void Sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
void Sigemptyset(sigset_t *set);
void Sigfillset(sigset_t *set);
void Sigaddset(sigset_t *set, int signum);
void Sigdelset(sigset_t *set, int signum);
int Sigismember(const sigset_t *set, int signum);
/* Unix I/O wrappers */
int Open(const char *pathname, int flags, mode_t mode);
ssize_t Read(int fd, void *buf, size_t count);
ssize_t Write(int fd, const void *buf, size_t count);
off_t Lseek(int fildes, off_t offset, int whence);
void Close(int fd);
int Select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout);
int Dup2(int fd1, int fd2);
void Stat(const char *filename, struct stat *buf);
void Fstat(int fd, struct stat *buf) ;
/* Dynamic storage allocation wrappers */
void *Malloc(size_t size);
void *Realloc(void *ptr, size_t size);
void *Calloc(size_t nmemb, size_t size);
void Free(void *ptr);
/* Sockets interface wrappers */
int Socket(int domain, int type, int protocol);
int Setsockopt(int s, int level, int optname, const void *optval, int optlen);
int Bind(int sockfd, struct sockaddr *my_addr, int addrlen);
int Listen(int s, int backlog);
int Accept(int s, struct sockaddr *addr, int *addrlen);
int Connect(int sockfd, struct sockaddr *serv_addr, int addrlen);
/* DNS wrappers */
struct hostent *Gethostbyname(const char *name);
struct hostent *Gethostbyaddr(const char *addr, int len, int type);
/* Pthreads thread control wrappers */
void Pthread_create(pthread_t *tidp, pthread_attr_t *attrp,
void * (*routine)(void *), void *argp);
void Pthread_join(pthread_t tid, void **thread_return);
void Pthread_cancel(pthread_t tid);
void Pthread_detach(pthread_t tid);
void Pthread_exit(void *retval);
pthread_t Pthread_self(void);
void Pthread_once(pthread_once_t *once_control, void (*init_function)());
/* Mutex wrappers */
void Pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
void Pthread_mutex_lock(pthread_mutex_t *mutex);
void Pthread_mutex_unlock(pthread_mutex_t *mutex);
/* Condition variable wrappers */
void Pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
void Pthread_cond_signal(pthread_cond_t *cond);
void Pthread_cond_broadcast(pthread_cond_t *cond);
void Pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
int Pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime);
/* Rio (Robust I/O) package */
ssize_t rio_readp(int fd, void *ptr, size_t nbytes);
ssize_t rio_writep(int fd, void *ptr, size_t nbytes);
ssize_t rio_readn(int fd, void *usrbuf, size_t n);
ssize_t rio_writen(int fd, void *usrbuf, size_t n);
void rio_readinitb(rio_t *rp, int fd);
ssize_t rio_readnb(rio_t *rp, void *usrbuf, size_t n);
ssize_t rio_readlineb(rio_t *rp, void *usrbuf, size_t maxlen);
/* Wrappers for Rio package */
ssize_t Rio_readp(int fd, void *ptr, size_t nbytes);
size_t Rio_writep(int fd, void *usrbuf, size_t n);
ssize_t Rio_readn(int fd, void *usrbuf, size_t n);
size_t Rio_writen(int fd, void *usrbuf, size_t n);
void Rio_readinitb(rio_t *rp, int fd);
ssize_t Rio_readnb(rio_t *rp, void *usrbuf, size_t n);
ssize_t Rio_readlineb(rio_t *rp, void *usrbuf, size_t maxlen);
/* Client/server helper functions */
int open_clientfd(char *hostname, int portno);
int open_listenfd(int portno);
/* Wrappers for client/server helper functions */
int Open_clientfd(char *hostname, int port);
int Open_listenfd(int port);
#endif /* __CSAPP_H__ */
/* $end csapp.h */
|
/*
* Copyright (C) 2014 Gautier Hattenberger
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/** @file modules/digital_cam/hackhd.h
* @brief Digital video/photo recorder HackHD control
*
* Provides the control of the HackHD power, start and stop of recording.
* If you are using firmware >= 1.1.5, it is also possible to take pictures
* according to the parameter in the config.txt file (on HackHD SD card).
* It is not possible to have both video and photo at the same time.
* This driver starts the HackHD in standby mode and trigger the start/stop
* of recording or take a picture.
* Minimum time between two pictures is 2 seconds.
*
* It is mandatory to configure the control GPIO:
* @verbatim
* <configure name="HACKHD_GPIO" value="GPIOC,GPIO5"/>
* @endverbatim
*
*/
#ifndef HACKHD_H
#define HACKHD_H
#include "std.h"
#include "math/pprz_geodetic_float.h"
enum hackhd_status {
HACKHD_NONE,
HACKHD_POWER_ON,
HACKHD_POWER_OFF,
HACKHD_START_RECORD,
HACKHD_STOP_RECORD,
HACKHD_SHOOT,
HACKHD_AUTOSHOOT_START
};
struct HackHD {
enum hackhd_status status;
uint32_t timer;
uint32_t photo_nr;
uint32_t autoshoot;
struct EnuCoor_f last_shot_pos;
uint32_t log_delay;
};
extern struct HackHD hackhd;
extern void hackhd_init(void);
extern void hackhd_periodic(void);
extern void hackhd_autoshoot(void);
extern void hackhd_autoshoot_start(void);
extern void hackhd_command(enum hackhd_status cmd);
// macro for setting handler
#define hackhd_SendCmd(cmd) hackhd_command(cmd)
#endif // HACKHD_H
|
/*
* palmtc-gpio.h
*
* Authors: Holger Bocklet <bitz.email@gmx.net>
*
*/
#ifndef _PALMTC_GPIO_H_
#define _PALMTC_GPIO_H_
#include <asm/arch/pxa-regs.h>
/* Palm Tungsten C GPIOs */
#define GPIO_NR_PALMTC_EARPHONE_DETECT 2
#define GPIO_NR_PALMTC_CRADLE_DETECT_N 4
#define GPIO_NR_PALMTC_USB_DETECT 5
#define GPIO_NR_PALMTC_HOTSYNC_BUTTON 7
#define GPIO_NR_PALMTC_SD_DETECT 12 // low->high when out, high->low when inserted
#define GPIO_NR_PALMTC_BL_POWER 16
#define GPIO_NR_PALMTC_USB_POWER 36
//#define GPIO_NR_PALMLD_STD_RXD 46 /* IRDA */
//#define GPIO_NR_PALMLD_STD_TXD 47
#define IRQ_GPIO_PALMTC_SD_DETECT IRQ_GPIO(GPIO_NR_PALMTC_SD_DETECT)
/* Utility macros */
#define GET_PALMTC_GPIO(gpio) \
(GPLR(GPIO_NR_PALMTC_ ## gpio) & GPIO_bit(GPIO_NR_PALMTC_ ## gpio))
#define SET_PALMTC_GPIO(gpio, setp) \
do { \
if (setp) \
GPSR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \
else \
GPCR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \
} while (0)
#define SET_PALMTC_GPIO_N(gpio, setp) \
do { \
if (setp) \
GPCR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \
else \
GPSR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \
} while (0)
#define GET_GPIO(gpio) (GPLR(gpio) & GPIO_bit(gpio))
#define SET_GPIO(gpio, setp) \
do { \
if (setp) \
GPSR(gpio) = GPIO_bit(gpio); \
else \
GPCR(gpio) = GPIO_bit(gpio); \
} while (0)
#define SET_GPIO_N(gpio, setp) \
do { \
if (setp) \
GPCR(gpio) = GPIO_bit(gpio); \
else \
GPSR(gpio) = GPIO_bit(gpio); \
} while (0)
#endif /* _PALMTC_GPIO_H_ */
|
#include <linux/sched.h>
#include <linux/stacktrace.h>
#include <linux/module.h>
#include <asm/stacktrace.h>
static void save_raw_context_stack(struct stack_trace *trace,
unsigned long reg29)
{
unsigned long *sp = (unsigned long *)reg29;
unsigned long addr;
while (!kstack_end(sp)) {
addr = *sp++;
if (__kernel_text_address(addr)) {
if (trace->skip > 0)
trace->skip--;
else
trace->entries[trace->nr_entries++] = addr;
if (trace->nr_entries >= trace->max_entries)
break;
}
}
}
static void save_context_stack(struct stack_trace *trace,
struct task_struct *tsk, struct pt_regs *regs)
{
unsigned long sp = regs->regs[29];
#ifdef CONFIG_KALLSYMS
unsigned long ra = regs->regs[31];
unsigned long pc = regs->cp0_epc;
if (raw_show_trace || !__kernel_text_address(pc)) {
unsigned long stack_page =
(unsigned long)task_stack_page(tsk);
if (stack_page && sp >= stack_page &&
sp <= stack_page + THREAD_SIZE - 32)
save_raw_context_stack(trace, sp);
return;
}
do {
if (trace->skip > 0)
trace->skip--;
else
trace->entries[trace->nr_entries++] = pc;
if (trace->nr_entries >= trace->max_entries)
break;
pc = unwind_stack(tsk, &sp, pc, &ra);
} while (pc);
#else
save_raw_context_stack(trace, sp);
#endif
}
void save_stack_trace(struct stack_trace *trace)
{
save_stack_trace_tsk(current, trace);
}
EXPORT_SYMBOL_GPL(save_stack_trace);
void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
struct pt_regs dummyregs;
struct pt_regs *regs = &dummyregs;
WARN_ON(trace->nr_entries || !trace->max_entries);
if (tsk != current) {
regs->regs[29] = tsk->thread.reg29;
regs->regs[31] = 0;
regs->cp0_epc = tsk->thread.reg31;
} else
prepare_frametrace(regs);
save_context_stack(trace, tsk, regs);
}
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Edge resistance for move/resize operations */
/*
* Copyright (C) 2005 Elijah Newren
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_EDGE_RESISTANCE_H
#define META_EDGE_RESISTANCE_H
#include "window-private.h"
void meta_window_edge_resistance_for_move (MetaWindow *window,
int old_x,
int old_y,
int *new_x,
int *new_y,
gboolean snap,
gboolean is_keyboard_op);
void meta_window_edge_resistance_for_resize (MetaWindow *window,
int old_width,
int old_height,
int *new_width,
int *new_height,
int gravity,
gboolean snap,
gboolean is_keyboard_op);
#endif /* META_EDGE_RESISTANCE_H */
|
#pragma once
#include "frontends/common2/commonframe.h"
#include <string>
namespace common2
{
class GNUFrame : public virtual CommonFrame
{
public:
GNUFrame();
std::string Video_GetScreenShotFolder() const override;
std::string getResourcePath(const std::string & filename) override;
private:
const std::string myHomeDir;
const std::string myResourceFolder;
};
}
|
/* 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.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/memory_alloc.h>
#include <mach/memory.h>
#include <mach/scm.h>
#include <mach/msm_dcvs_scm.h>
#define DCVS_CMD_REGISTER_CORE 2
#define DCVS_CMD_SET_ALGO_PARAM 3
#define DCVS_CMD_EVENT 4
#define DCVS_CMD_INIT 5
#define DCVS_CMD_SET_POWER_PARAM 6
struct scm_register_core {
uint32_t core_id;
phys_addr_t core_param_phy;
};
struct scm_algo {
uint32_t core_id;
phys_addr_t algo_phy;
};
struct scm_init {
uint32_t phy;
uint32_t size;
};
struct scm_pwr_param {
uint32_t core_id;
phys_addr_t pwr_param_phy;
phys_addr_t freq_phy;
phys_addr_t coeffs_phy;
};
int msm_dcvs_scm_init(size_t size)
{
int ret = 0;
struct scm_init init;
uint32_t p = 0;
/* Allocate word aligned non-cacheable memory */
p = allocate_contiguous_ebi_nomap(size, 4);
if (!p)
return -ENOMEM;
init.phy = p;
init.size = size;
ret = scm_call(SCM_SVC_DCVS, DCVS_CMD_INIT,
&init, sizeof(init), NULL, 0);
/* Not freed if the initialization succeeds */
if (ret)
free_contiguous_memory_by_paddr(p);
return ret;
}
EXPORT_SYMBOL(msm_dcvs_scm_init);
int msm_dcvs_scm_register_core(uint32_t core_id,
struct msm_dcvs_core_param *param)
{
int ret = 0;
struct scm_register_core reg_data;
struct msm_dcvs_core_param *p = NULL;
p = kzalloc(PAGE_ALIGN(sizeof(struct msm_dcvs_core_param)), GFP_KERNEL);
if (!p)
return -ENOMEM;
memcpy(p, param, sizeof(struct msm_dcvs_core_param));
reg_data.core_id = core_id;
reg_data.core_param_phy = virt_to_phys(p);
ret = scm_call(SCM_SVC_DCVS, DCVS_CMD_REGISTER_CORE,
®_data, sizeof(reg_data), NULL, 0);
kfree(p);
return ret;
}
EXPORT_SYMBOL(msm_dcvs_scm_register_core);
int msm_dcvs_scm_set_algo_params(uint32_t core_id,
struct msm_dcvs_algo_param *param)
{
int ret = 0;
struct scm_algo algo;
struct msm_dcvs_algo_param *p = NULL;
p = kzalloc(PAGE_ALIGN(sizeof(struct msm_dcvs_algo_param)), GFP_KERNEL);
if (!p)
return -ENOMEM;
memcpy(p, param, sizeof(struct msm_dcvs_algo_param));
algo.core_id = core_id;
algo.algo_phy = virt_to_phys(p);
ret = scm_call(SCM_SVC_DCVS, DCVS_CMD_SET_ALGO_PARAM,
&algo, sizeof(algo), NULL, 0);
kfree(p);
return ret;
}
EXPORT_SYMBOL(msm_dcvs_scm_set_algo_params);
int msm_dcvs_scm_set_power_params(uint32_t core_id,
struct msm_dcvs_power_params *pwr_param,
struct msm_dcvs_freq_entry *freq_entry,
struct msm_dcvs_energy_curve_coeffs *coeffs)
{
int ret = 0;
struct scm_pwr_param pwr;
struct msm_dcvs_power_params *pwrt = NULL;
struct msm_dcvs_freq_entry *freqt = NULL;
struct msm_dcvs_energy_curve_coeffs *coefft = NULL;
pwrt = kzalloc(PAGE_ALIGN(sizeof(struct msm_dcvs_power_params)),
GFP_KERNEL);
if (!pwrt)
return -ENOMEM;
freqt = kzalloc(PAGE_ALIGN(sizeof(struct msm_dcvs_freq_entry)
* pwr_param->num_freq),
GFP_KERNEL);
if (!freqt) {
kfree(pwrt);
return -ENOMEM;
}
coefft = kzalloc(PAGE_ALIGN(
sizeof(struct msm_dcvs_energy_curve_coeffs)),
GFP_KERNEL);
if (!coefft) {
kfree(pwrt);
kfree(freqt);
return -ENOMEM;
}
memcpy(pwrt, pwr_param, sizeof(struct msm_dcvs_power_params));
memcpy(freqt, freq_entry,
sizeof(struct msm_dcvs_freq_entry)*pwr_param->num_freq);
memcpy(coefft, coeffs, sizeof(struct msm_dcvs_energy_curve_coeffs));
pwr.core_id = core_id;
pwr.pwr_param_phy = virt_to_phys(pwrt);
pwr.freq_phy = virt_to_phys(freqt);
pwr.coeffs_phy = virt_to_phys(coefft);
ret = scm_call(SCM_SVC_DCVS, DCVS_CMD_SET_POWER_PARAM,
&pwr, sizeof(pwr), NULL, 0);
kfree(pwrt);
kfree(freqt);
kfree(coefft);
return ret;
}
EXPORT_SYMBOL(msm_dcvs_scm_set_power_params);
int msm_dcvs_scm_event(uint32_t core_id,
enum msm_dcvs_scm_event event_id,
uint32_t param0, uint32_t param1,
uint32_t *ret0, uint32_t *ret1)
{
int ret = -EINVAL;
if (!ret0 || !ret1)
return ret;
ret = scm_call_atomic4_3(SCM_SVC_DCVS, DCVS_CMD_EVENT,
core_id, event_id, param0, param1, ret0, ret1);
#if 0
trace_msm_dcvs_scm_event(core_id, (int)event_id, param0, param1,
*ret0, *ret1);
#endif
return ret;
}
EXPORT_SYMBOL(msm_dcvs_scm_event);
|
#ifndef SLICES_INCLUDED
#define SLICES_INCLUDED
/* Vrui includes */
#include <GL/GLColorMap.h>
#include <GLMotif/Blind.h>
#include <GLMotif/Popup.h>
#include <GLMotif/PopupWindow.h>
#include <GLMotif/RadioBox.h>
#include <GLMotif/RowColumn.h>
#include <GLMotif/Slider.h>
#include <GLMotif/StyleSheet.h>
#include <GLMotif/TextField.h>
#include <Misc/CallbackData.h>
#include <Misc/CallbackList.h>
#include "ExampleVTKReader.h"
// begin Forward Declarations
class ColorMap;
class Storage;
class SwatchesWidget;
// end Forward Declarations
class Slices: public GLMotif::PopupWindow {
public:
ExampleVTKReader * exampleVTKReader;
Slices(double* _sliceColormap, ExampleVTKReader * _ExampleVTKReader);
virtual ~Slices(void);
void changeSlicesColorMap(int colormap) const;
void changeSlicesColorMapCallback(GLMotif::RadioBox::ValueChangedCallbackData * callBackData);
void exportSlicesColorMap(double* colormap) const;
Storage * getColorMap(void) const;
void setColorMap(Storage* storage);
const ColorMap* getSlicesColorMap(void) const;
ColorMap* getSlicesColorMap(void);
void setSlicesColorMap(int colorMapCreationType, double _minimum, double _maximum);
Misc::CallbackList& getSlicesColorMapChangedCallbacks(void);
void sliceColorMapChangedCallback(Misc::CallbackData * callBackData);
void sliderCallback(GLMotif::Slider::ValueChangedCallbackData * callBackData);
void toggleSelectCallback(GLMotif::ToggleButton::ValueChangedCallbackData * callBackData);
private:
ColorMap * colorMap;
GLMotif::Blind * colorPane;
GLMotif::Slider * colorSliders[3];
double* sliceColormap;
SwatchesWidget * swatchesWidget;
GLMotif::TextField* xSliceValue;
GLMotif::TextField* ySliceValue;
GLMotif::TextField* zSliceValue;
void colorMapChangedCallback(Misc::CallbackData * callbackData);
void colorSliderCallback(Misc::CallbackData * callbackData);
void colorSwatchesWidgetCallback(Misc::CallbackData * callbackData);
void controlPointChangedCallback(Misc::CallbackData * callbackData);
GLMotif::RowColumn * createButtonBox(GLMotif::RowColumn * & colorMapDialog);
GLMotif::RowColumn * createColorEditor(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * & colorMapDialog);
void createColorMap(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * & colorMapDialog);
void createColorMapDialog(const GLMotif::StyleSheet & styleSheet);
void createColorPanel(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * & colorMapDialog);
GLMotif::Slider * createColorSlider(const char * title, GLMotif::Color color, const GLMotif::StyleSheet & styleSheet,
GLMotif::RowColumn * colorSlidersBox);
GLMotif::RowColumn * createColorSliderBox(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * colorEditor);
void createColorSliders(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * colorEditor);
void createColorSwatchesWidget(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * & colorEditor);
GLMotif::Popup * createSliceColorMapSubMenu(void);
void createXSlices(GLMotif::RowColumn * & xyzSlicesRowColumn, const GLMotif::StyleSheet & styleSheet);
void createXYZSlices(const GLMotif::StyleSheet & styleSheet, GLMotif::RowColumn * & colorMapDialog);
void createYSlices(GLMotif::RowColumn * & xyzSlicesRowColumn, const GLMotif::StyleSheet & styleSheet);
void createZSlices(GLMotif::RowColumn * & xyzSlicesRowColumn, const GLMotif::StyleSheet & styleSheet);
void initialize(void);
void removeControlPointCallback(Misc::CallbackData * callbackData);
};
#endif
|
/*
* OMAP34xx M2 divider clock code
*
* Copyright (C) 2007-2008 Texas Instruments, Inc.
* Copyright (C) 2007-2010 Nokia Corporation
*
* Paul Walmsley
* Jouni Högander
*
* Parts of this code are based on code written by
* Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
*
* 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.
*/
#undef DEBUG
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/clk.h>
#include <linux/io.h>
#include "clock.h"
#include "clock3xxx.h"
#include "clock34xx.h"
#include "sdrc.h"
#include "sram.h"
#define CYCLES_PER_MHZ 1000000
/*
* CORE DPLL (DPLL3) M2 divider rate programming functions
*
* These call into SRAM code to do the actual CM writes, since the SDRAM
* is clocked from DPLL3.
*/
/**
* omap3_core_dpll_m2_set_rate - set CORE DPLL M2 divider
* @clk: struct clk * of DPLL to set
* @rate: rounded target rate
*
* Program the DPLL M2 divider with the rounded target rate. Returns
* -EINVAL upon error, or 0 upon success.
*/
int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 new_div = 0;
u32 unlock_dll = 0;
u32 c;
unsigned long validrate, sdrcrate, _mpurate;
struct omap_sdrc_params *sdrc_cs0;
struct omap_sdrc_params *sdrc_cs1;
int ret;
unsigned long clkrate;
if (!clk || !rate)
return -EINVAL;
validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
if (validrate != rate)
return -EINVAL;
sdrcrate = __clk_get_rate(sdrc_ick_p);
clkrate = __clk_get_rate(hw->clk);
if (rate > clkrate)
sdrcrate <<= ((rate / clkrate) >> 1);
else
sdrcrate >>= ((clkrate / rate) >> 1);
ret = omap2_sdrc_get_params(sdrcrate, &sdrc_cs0, &sdrc_cs1);
if (ret)
return -EINVAL;
if (sdrcrate < MIN_SDRC_DLL_LOCK_FREQ) {
pr_debug("clock: will unlock SDRC DLL\n");
unlock_dll = 1;
}
/*
* XXX This only needs to be done when the CPU frequency changes
*/
_mpurate = __clk_get_rate(arm_fck_p) / CYCLES_PER_MHZ;
c = (_mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT;
c += 1; /* for safety */
c *= SDRC_MPURATE_LOOPS;
c >>= SDRC_MPURATE_SCALE;
if (c == 0)
c = 1;
pr_debug("clock: changing CORE DPLL rate from %lu to %lu\n",
clkrate, validrate);
pr_debug("clock: SDRC CS0 timing params used: RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr);
if (sdrc_cs1)
pr_debug("clock: SDRC CS1 timing params used: RFR %08x CTRLA %08x CTRLB %08x MR %08x\n",
sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
if (sdrc_cs1)
omap3_configure_core_dpll(
new_div, unlock_dll, c, rate > clkrate,
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
sdrc_cs1->rfr_ctrl, sdrc_cs1->actim_ctrla,
sdrc_cs1->actim_ctrlb, sdrc_cs1->mr);
else
omap3_configure_core_dpll(
new_div, unlock_dll, c, rate > clkrate,
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
0, 0, 0, 0);
return 0;
}
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2010 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
#ifndef CALLBACKS_H
#define CALLBACKS_H
#include <gthumb.h>
void pb__gth_browser_construct_cb (GthBrowser *browser);
#endif /* CALLBACKS_H */
|
/**************************************************************************************************
* *
* Project: NextGIS Formbuilder *
* Authors: Mikhail Gusev, gusevmihs@gmail.com *
* Copyright (C) 2014-2019 NextGIS *
* *
* This program is free software: you can redistribute it and/or modify it under the terms *
* of the GNU General Public License as published by the Free Software Foundation, either *
* version 2 of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; *
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with this program. *
* If not, see http://www.gnu.org/licenses/. *
* *
**************************************************************************************************/
#pragma once
#include "util/ngw_io.h"
#include "util/gdal_dataset_deleter.h"
#include "util/ngw_api.h"
#include "ogrsf_frmts.h"
namespace Fb
{
namespace Util
{
enum class NgwFormErr
{
Ok,
NoForm,
Err
};
class NgwGdalIo: public NgwIo
{
public:
NgwGdalIo (const QString &app_version = "");
virtual ~NgwGdalIo () override;
virtual void reset () override;
virtual QString getLastError () override { return error; }
virtual QString getLastDeatiledError () override { return detailed_error; }
virtual bool getRootResources (QList<NgwResourceData> &resources,
QString base_url, QString login, QString password,
const std::set<NgwResourceType> &allowed_types) override;
virtual bool getResources (QList<NgwResourceData> &resources,
QString base_url, int resource_id,
const std::set<NgwResourceType> &allowed_types) override;
virtual bool getLayerInfo (NgwLayerInfo &layer_info, QString base_url,
int resource_id) override;
virtual bool createLayer (int &new_layer_id, const NgwLayerInfo &layer_info, QString base_url,
int resource_group_id = 0, QString base_url_copy_features = "",
int layer_id_copy_features = -1) override;
virtual bool createFile (int &new_form_id, QString upload_reply, QString base_url,
int layer_id, QString res_type, QString disp_name) override;
virtual QList<QPair<int, QString>> getCollectorUsers (QString base_url);
virtual bool createCollectorUser (QString base_url, QString email);
virtual int createResource (QString base_url, const QJsonObject &body);
virtual int createSimpleBasemap (QString base_url, int group_id, QString basemap_name);
virtual int createSimpleCollectorProject (QString base_url, int group_id, int collector_user_id,
QString user, QString password,
QString proj_name, QString proj_description,
int layer_id, QString layer_name,
int basemap_id, QString basemap_name);
virtual int createSimpleWebmap (QString base_url, int group_id, QString webmap_name, int style_id, QString layer_name);
virtual NgwFormErr downloadForm (QString base_url, int layer_id, QString file_path);
QString getUrlResourcePage (QString base_url, int resource_id);
QString getUrlVersion (QString base_url);
protected:
bool u_getChildResources (QList<NgwResourceData> &resources,
QString base_url, int resource_id,
const std::set<NgwResourceType> &allowed_types);
void u_openDataset (GDALDatasetPtr &dataset_p, QString base_url, int resource_id, bool read_only);
NgwApi *api;
QString error;
QString detailed_error;
QString app_version;
};
}
}
|
/*
File: Kernel.h
Contains: Kernel Interfaces
Version: Technology: System 8
Release: QuickTime 6.0.2
Copyright: (c) 1994-2001 by Apple Computer, Inc., all rights reserved
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __KERNEL__
#define __KERNEL__
#ifndef __DRIVERSERVICES__
#include "DriverServices.h"
#endif
/*
The contents of Kernel.h has been merged into DriverServices.h
*/
#endif /* __KERNEL__ */
|
/*
* Copyright (C) 2010 Martin Mueller
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/**
* @file modules/sensors/trigger_ext.c
* Measure external trigger pulse at PPM input
*
* This measures a trigger pulse length (e.g. duration of a wind turbine
* rotation) and sends a message with the info.
*/
#include "trigger_ext.h"
#include "modules/sensors/trig_ext_hw.h"
#include "subsystems/gps.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/uart.h"
#include "messages.h"
#include "subsystems/datalink/downlink.h"
void trigger_ext_init(void)
{
trig_ext_init();
}
void trigger_ext_periodic(void)
{
if (trig_ext_valid == TRUE)
{
uint8_t ac_id = 0;
uint8_t turb_id = TURBINE_ID;
uint32_t sync_itow, cycle_time;
sync_itow = gps_tow_from_sys_ticks(trigger_t0);
cycle_time = msec_of_sys_time_ticks(delta_t0);
DOWNLINK_SEND_WINDTURBINE_STATUS_(DefaultChannel, DefaultDevice,
&ac_id,
&turb_id,
&sync_itow,
&cycle_time);
trig_ext_valid = FALSE;
}
}
|
#pragma once
namespace Tasker {
namespace Cli {
static std::string openEditor(std::string text);
static std::string trim(const std::string &str);
class View;
enum TextClass {
TASK_ID,
TASK_NAME,
TASK_STATE,
TASK_STATE_CLOSED,
TASK_LIST_HEADER,
SUB_TASK_HEADER,
EVENT_HEADER,
};
class CliInterface {
public:
virtual void newView(View *view) = 0;
//virtual void replaceView(View *view) = 0;
virtual void deleteView(View *view) = 0;
virtual Backend::Project *getProject() = 0;
virtual void quit() = 0;
virtual bool hasColor() = 0;
virtual std::string getText(TextClass klass, std::string text) = 0;
};
class View
{
public:
virtual ~View() {};
virtual void render(CliInterface *parent) = 0;
};
class ModifyTaskTypeView : public View
{
public:
ModifyTaskTypeView(std::string name);
void render(CliInterface *parent) override;
private:
std::string mName;
};
class TaskView : public View
{
public:
TaskView(Backend::Task *task);
void render(CliInterface *parent) override;
void view(CliInterface *parent);
private:
Backend::Task *mTask;
bool mShowView;
};
class CreateTaskView : public View
{
public:
CreateTaskView(Backend::Task *parent = NULL);
void render(CliInterface *parent) override;
private:
Backend::Task *mParent;
};
class TaskListView : public View
{
public:
TaskListView();
~TaskListView();
void setFilter(Backend::TaskFilter *filter);
void render(CliInterface *parent) override;
void view(CliInterface *parent);
private:
Backend::TaskFilter *mFilter;
bool mShowView;
};
class Main : public CliInterface
{
public:
Main();
~Main();
bool init(int argc, char **argv);
bool mainLoop();
void newView(View *view) override;
void deleteView(View *view) override;
Backend::Project *getProject() override;
void quit() override;
View *getActiveView();
static std::string getLine(std::string cmd);
static void readline(std::string cmd, std::string &command, std::vector<std::string> &args);
bool hasColor() {return mColors;};
std::string getText(TextClass klass, std::string text);
private:
Backend::Project *mProject;
TaskListView mListView;
std::vector<View*> mViewStack;
bool mColors;
const char *NORMAL;
const char *BOLD;
const char *UNDERLINE;
const char *INVERT;
const char *OVERLINE;
const char *RED;
const char *GREEN;
const char *BLUE;
const char *CYAN;
};
};
};
|
/*
* Copyright (c) Bull S.A. 2007 All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* History:
* Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net)
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <rpc/rpc.h>
//Standard define
#define PROCNUM 1
#define VERSNUM 1
//Set number of test call
int maxIter;
int eachResult (char *out, struct sockaddr_in *addr);
double average(double *tbl)
{
//Return average of values in tbl
int i;
double rslt = 0;
for (i = 0; i < maxIter; i++)
{
rslt += tbl[i];
}
rslt = rslt / maxIter;
return rslt;
}
double mini(double *tbl)
{
//Return minimal of values in tbl
int i;
double rslt = tbl[0];
for (i = 0; i < maxIter; i++)
{
if (rslt > tbl[i])
rslt = tbl[i];
}
return rslt;
}
double maxi(double *tbl)
{
//Return maximal of values in tbl
int i;
double rslt = tbl[0];
for (i = 0; i < maxIter; i++)
{
if (rslt < tbl[i])
rslt = tbl[i];
}
return rslt;
}
int main(int argn, char *argc[])
{
//Program parameters : argc[1] : HostName or Host IP
// argc[2] : Server Program Number
// argc[3] : Number of test call
// other arguments depend on test case
//run_mode can switch into stand alone program or program launch by shell script
//1 : stand alone, debug mode, more screen information
//0 : launch by shell script as test case, only one printf -> result status
int run_mode = 0;
int test_status = 0; //Default test result set to FAILED
int i;
double *resultTbl;
struct timeval tv1,tv2;
struct timezone tz;
long long diff;
double rslt;
int progNum = atoi(argc[2]);
enum clnt_stat cs;
int varSnd = 10;
int varRec = -1;
//Test initialisation
maxIter = atoi(argc[3]);
resultTbl = (double *)malloc(maxIter * sizeof(double));
//Call tested function several times
for (i = 0; i < maxIter; i++)
{
//Tic
gettimeofday(&tv1, &tz);
//Call function
cs = clnt_broadcast(progNum, VERSNUM, PROCNUM,
(xdrproc_t)xdr_int, (char *)&varSnd,
(xdrproc_t)xdr_int, (char *)&varRec,
eachResult);
if (cs != RPC_SUCCESS)
clnt_perrno(cs);
//Toc
gettimeofday(&tv2, &tz);
//Add function execution time (toc-tic)
diff = (tv2.tv_sec-tv1.tv_sec) * 1000000L + (tv2.tv_usec-tv1.tv_usec);
rslt = (double)diff / 1000;
if (cs == RPC_SUCCESS)
{
resultTbl[i] = rslt;
}
else
{
test_status = 1;
break;
}
if (run_mode)
{
fprintf(stderr, "lf time = %lf usecn\n", resultTbl[i]);
}
}
//This last printf gives the result status to the tests suite
//normally should be 0: test has passed or 1: test has failed
printf("%d\n", test_status);
return test_status;
}
int eachResult (char *out, struct sockaddr_in *addr)
{
//Nothing to do here in that test case...
return 1;
}
|
#ifndef __ANALYZE_CONFIG___
#define __ANALYZE_CONFIG___
#include <glib.h>
#include "analyze.h"
typedef struct {
double dir_op_ratio; /* dir 操作概率 */
double symbol_link_op_ratio; /* symlink 操作概率 */
double file_op_ratio; /* file 操作概率 */
int accuracy;
int accuracy_num;
int log_level;
int write_size;
int read_size;
int dir_max_depth;
int initial_dir_cnts;
int initial_file_cnts;
int initial_symlink_counts;
int total_op_group;
char test_dir_path[PATH_MAX];
char validation_dir_path[PATH_MAX];
char working_directory[PATH_MAX];
int working_threads;
int operations_waiting_list;
int operations_of_opened_file;
int operations_of_unopened_file;
int operations_of_opened_dir;
int operations_of_unopened_dir;
int operations_of_symlink;
double new_dir_ratio;
double open_dir_ratio;
double new_file_ratio;
double open_file_ratio;
double fsync_open_dir;
double fsetxattr_open_dir;
double fgetxattr_open_dir;
double fremovexattr_open_dir;
double readdir_open_dir;
double lk_open_dir;
double fchmod_open_dir;
double fchown_open_dir;
double futimes_open_dir;
double fstat_open_dir;
double access_unopen_dir;
double rename_unopen_dir;
double symlink_unopen_dir;
double setxattr_unopen_dir;
double getxattr_unopen_dir;
double removexattr_unopen_dir;
double chown_unopen_dir;
double chmod_unopen_dir;
double utimes_unopen_dir;
double rmdir_unopen_dir;
double stat_unopen_dir;
double statfs_unopen_dir;
double writev_open_file;
double readv_open_file;
double fallocate_open_file;
double ftruncate_open_file;
double fsync_open_file;
double fsetxattr_open_file;
double fgetxattr_open_file;
double fremovexattr_open_file;
double lk_open_file;
double fchown_open_file;
double fchmod_open_file;
double futimes_open_file;
double fstat_open_file;
double rename_unopen_file;
double symlink_unopen_file;
double link_unopen_file;
double truncate_unopen_file;
double setxattr_unopen_file;
double getxattr_unopen_file;
double removexattr_unopen_file;
double access_unopen_file;
double chown_unopen_file;
double chmod_unopen_file;
double utimes_unopen_file;
double stat_unopen_file;
double unlink_unopen_file;
double statfs_unopen_file;
double readlink_symbol_link;
double unlink_symbol_link;
int first_open_for_log;
}config_globle_var ;
extern config_globle_var cgv;
#define GET_CONFIG_STRING(src,dst) \
p = strtok (dst, tmp_delim); \
memset (src, 0, sizeof (src)); \
strcpy (src, p); \
tmp_p = strrchr(src, '/'); \
tmp_len = strlen (tmp_p); \
if (tmp_len > 1) \
strcat (src, "/"); \
free (dst);
int
get_operation_percent_int (char *config_file_path,
const gchar *group_name, const gchar *key);
double
get_operation_percent (char *config_file_path,
const gchar *group_name, const gchar *key);
char *
get_operation_string (char *config_file_path,
const gchar *group_name, const gchar *key);
int is_dir_exsit (const char *pathname);
int
config_globle_var_init (config_globle_var *cgv,
char *config_file_path);
#endif
|
/*
Copyright (C) 2018 Erik Ogenvik
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef CYPHESIS_CYPY_MEMMAP_H
#define CYPHESIS_CYPY_MEMMAP_H
#include "rules/entityfilter/Providers.h"
#include "rules/ai/MemMap.h"
#include "pythonbase/WrapperBase.h"
/**
* \ingroup PythonWrappers
*/
class CyPy_MemMap : public WrapperBase<MemMap*, CyPy_MemMap>
{
public:
CyPy_MemMap(Py::PythonClassInstance* self, Py::Tuple& args, Py::Dict& kwds);
CyPy_MemMap(Py::PythonClassInstance* self, MemMap* value);
~CyPy_MemMap() = default;
static void init_type();
Py::Object find_by_location(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, find_by_location);
Py::Object find_by_type(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, find_by_type);
Py::Object updateAdd(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, updateAdd);
Py::Object delete_(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, delete_);
Py::Object get(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, get);
Py::Object get_all();
PYCXX_NOARGS_METHOD_DECL(CyPy_MemMap, get_all);
Py::Object get_add(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, get_add);
Py::Object find_by_filter(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, find_by_filter);
Py::Object find_by_location_query(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, find_by_location_query);
Py::Object add_entity_memory(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, add_entity_memory);
Py::Object remove_entity_memory(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, remove_entity_memory);
Py::Object recall_entity_memory(const Py::Tuple& args);
PYCXX_VARARGS_METHOD_DECL(CyPy_MemMap, recall_entity_memory);
static EntityFilter::QueryContext createFilterContext(LocatedEntity* entity, MemMap* memMap);
};
#endif //CYPHESIS_CYPY_MEMMAP_H
|
/*
* arch/arm/plat-mxc/iomux-v1.c
*
* Copyright (C) 2004 Sascha Hauer, Synertronixx GmbH
* Copyright (C) 2009 Uwe Kleine-Koenig, Pengutronix
*
* Common code for i.MX1, i.MX21 and i.MX27
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/gpio.h>
#include <mach/hardware.h>
#include <asm/mach/map.h>
#include <mach/iomux-v1.h>
static void __iomem *imx_iomuxv1_baseaddr;
static unsigned imx_iomuxv1_numports;
static inline unsigned long imx_iomuxv1_readl(unsigned offset)
{
return __raw_readl(imx_iomuxv1_baseaddr + offset);
}
static inline void imx_iomuxv1_writel(unsigned long val, unsigned offset)
{
__raw_writel(val, imx_iomuxv1_baseaddr + offset);
}
static inline void imx_iomuxv1_rmwl(unsigned offset,
unsigned long mask, unsigned long value)
{
unsigned long reg = imx_iomuxv1_readl(offset);
reg &= ~mask;
reg |= value;
imx_iomuxv1_writel(reg, offset);
}
static inline void imx_iomuxv1_set_puen(
unsigned int port, unsigned int pin, int on)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_PUEN(port), mask, on ? mask : 0);
}
static inline void imx_iomuxv1_set_ddir(
unsigned int port, unsigned int pin, int out)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_DDIR(port), mask, out ? mask : 0);
}
static inline void imx_iomuxv1_set_gpr(
unsigned int port, unsigned int pin, int af)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_GPR(port), mask, af ? mask : 0);
}
static inline void imx_iomuxv1_set_gius(
unsigned int port, unsigned int pin, int inuse)
{
unsigned long mask = 1 << pin;
imx_iomuxv1_rmwl(MXC_GIUS(port), mask, inuse ? mask : 0);
}
static inline void imx_iomuxv1_set_ocr(
unsigned int port, unsigned int pin, unsigned int ocr)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = ocr << shift;
unsigned long offset = pin < 16 ? MXC_OCR1(port) : MXC_OCR2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
static inline void imx_iomuxv1_set_iconfa(
unsigned int port, unsigned int pin, unsigned int aout)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = aout << shift;
unsigned long offset = pin < 16 ? MXC_ICONFA1(port) : MXC_ICONFA2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
static inline void imx_iomuxv1_set_iconfb(
unsigned int port, unsigned int pin, unsigned int bout)
{
unsigned long shift = (pin & 0xf) << 1;
unsigned long mask = 3 << shift;
unsigned long value = bout << shift;
unsigned long offset = pin < 16 ? MXC_ICONFB1(port) : MXC_ICONFB2(port);
imx_iomuxv1_rmwl(offset, mask, value);
}
int mxc_gpio_mode(int gpio_mode)
{
unsigned int pin = gpio_mode & GPIO_PIN_MASK;
unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT;
unsigned int aout = (gpio_mode >> GPIO_AOUT_SHIFT) & 3;
unsigned int bout = (gpio_mode >> GPIO_BOUT_SHIFT) & 3;
if (port >= imx_iomuxv1_numports)
return -EINVAL;
/* Pullup enable */
imx_iomuxv1_set_puen(port, pin, gpio_mode & GPIO_PUEN);
/* Data direction */
imx_iomuxv1_set_ddir(port, pin, gpio_mode & GPIO_OUT);
/* Primary / alternate function */
imx_iomuxv1_set_gpr(port, pin, gpio_mode & GPIO_AF);
/* use as gpio? */
imx_iomuxv1_set_gius(port, pin, !(gpio_mode & (GPIO_PF | GPIO_AF)));
imx_iomuxv1_set_ocr(port, pin, ocr);
imx_iomuxv1_set_iconfa(port, pin, aout);
imx_iomuxv1_set_iconfb(port, pin, bout);
return 0;
}
EXPORT_SYMBOL(mxc_gpio_mode);
static int imx_iomuxv1_setup_multiple(const int *list, unsigned count)
{
size_t i;
int ret;
for (i = 0; i < count; ++i) {
ret = mxc_gpio_mode(list[i]);
if (ret)
return ret;
}
return ret;
}
int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
const char *label)
{
size_t i;
int ret;
for (i = 0; i < count; ++i) {
unsigned gpio = pin_list[i] & (GPIO_PIN_MASK | GPIO_PORT_MASK);
ret = gpio_request(gpio, label);
if (ret)
goto err_gpio_request;
}
ret = imx_iomuxv1_setup_multiple(pin_list, count);
if (ret)
goto err_setup;
return 0;
err_setup:
BUG_ON(i != count);
err_gpio_request:
mxc_gpio_release_multiple_pins(pin_list, i);
return ret;
}
EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
void mxc_gpio_release_multiple_pins(const int *pin_list, int count)
{
size_t i;
for (i = 0; i < count; ++i) {
unsigned gpio = pin_list[i] & (GPIO_PIN_MASK | GPIO_PORT_MASK);
gpio_free(gpio);
}
}
EXPORT_SYMBOL(mxc_gpio_release_multiple_pins);
<<<<<<< HEAD
int __init imx_iomuxv1_init(void __iomem *base, int numports)
{
imx_iomuxv1_baseaddr = base;
imx_iomuxv1_numports = numports;
return 0;
}
=======
static int imx_iomuxv1_init(void)
{
#ifdef CONFIG_ARCH_MX1
if (cpu_is_mx1()) {
imx_iomuxv1_baseaddr = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR);
imx_iomuxv1_numports = MX1_NUM_GPIO_PORT;
} else
#endif
#ifdef CONFIG_MACH_MX21
if (cpu_is_mx21()) {
imx_iomuxv1_baseaddr = MX21_IO_ADDRESS(MX21_GPIO_BASE_ADDR);
imx_iomuxv1_numports = MX21_NUM_GPIO_PORT;
} else
#endif
#ifdef CONFIG_MACH_MX27
if (cpu_is_mx27()) {
imx_iomuxv1_baseaddr = MX27_IO_ADDRESS(MX27_GPIO_BASE_ADDR);
imx_iomuxv1_numports = MX27_NUM_GPIO_PORT;
} else
#endif
return -ENODEV;
return 0;
}
pure_initcall(imx_iomuxv1_init);
>>>>>>> 296c66da8a02d52243f45b80521febece5ed498a
|
/***************************************************************************
File : AbstractFilter.h
Project : SciDAVis
--------------------------------------------------------------------
Copyright : (C) 2007,2008 by Knut Franke, Tilman Benkert
Email (use @ for *) : knut.franke*gmx.de, thzs*gmx.net
Description : Base class for all analysis operations.
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef ABSTRACT_FILTER_H
#define ABSTRACT_FILTER_H
#include "AbstractAspect.h"
#include <QVector>
class AbstractColumn;
class AbstractFilter : public AbstractAspect
{
Q_OBJECT
public:
explicit AbstractFilter(const QString& name) : AbstractAspect(name) {}
virtual ~AbstractFilter() {}
virtual int inputCount() const = 0;
virtual int outputCount() const = 0;
int highestConnectedInput() const;
bool input(int port, const AbstractColumn* source);
bool input(const AbstractFilter* sources);
const AbstractColumn *input(int port) const;
virtual QString inputLabel(int port) const;
virtual AbstractColumn *output(int port=0) = 0;
virtual const AbstractColumn *output(int port=0) const = 0;
int portIndexOf(const AbstractColumn * column);
protected:
virtual bool inputAcceptable(int port, const AbstractColumn *source);
virtual void inputAboutToBeDisconnected(const AbstractColumn * source);
protected slots:
virtual void inputDescriptionAboutToChange(const AbstractColumn * source);
void inputDescriptionAboutToChange(const AbstractAspect * aspect);
virtual void inputDescriptionChanged(const AbstractColumn * source);
void inputDescriptionChanged(const AbstractAspect * aspect);
virtual void inputPlotDesignationAboutToChange(const AbstractColumn * source);
virtual void inputPlotDesignationChanged(const AbstractColumn * source);
virtual void inputModeAboutToChange(const AbstractColumn * source);
virtual void inputModeChanged(const AbstractColumn * source);
virtual void inputDataAboutToChange(const AbstractColumn * source);
virtual void inputDataChanged(const AbstractColumn * source);
virtual void inputRowsAboutToBeInserted(const AbstractColumn * source, int before, int count) {
Q_UNUSED(source); Q_UNUSED(before); Q_UNUSED(count);
}
virtual void inputRowsInserted(const AbstractColumn * source, int before, int count) {
Q_UNUSED(source); Q_UNUSED(before); Q_UNUSED(count);
}
virtual void inputRowsAboutToBeRemoved(const AbstractColumn * source, int first, int count) {
Q_UNUSED(source); Q_UNUSED(first); Q_UNUSED(count);
}
virtual void inputRowsRemoved(const AbstractColumn * source, int first, int count) {
Q_UNUSED(source); Q_UNUSED(first); Q_UNUSED(count);
}
virtual void inputMaskingAboutToChange(const AbstractColumn * source) {
Q_UNUSED(source);
}
virtual void inputMaskingChanged(const AbstractColumn * source) {
Q_UNUSED(source);
}
void inputAboutToBeDestroyed(const AbstractColumn * source) {
input(portIndexOf(source), 0);
}
protected:
QVector<const AbstractColumn*> m_inputs;
};
#endif // ifndef ABSTRACT_FILTER_H
|
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
#include "xf86_OSlib.h"
#include <machine/apmvar.h>
#define APM_DEVICE "/dev/apm"
static pointer APMihPtr = NULL;
static void bsdCloseAPM(void);
static struct {
u_int apmBsd;
pmEvent xf86;
} bsdToXF86Array[] = {
{APM_STANDBY_REQ, XF86_APM_SYS_STANDBY},
{APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND},
{APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME},
{APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME},
{APM_BATTERY_LOW, XF86_APM_LOW_BATTERY},
{APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE},
{APM_UPDATE_TIME, XF86_APM_UPDATE_TIME},
{APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND},
{APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY},
{APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND},
{APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME},
#ifdef APM_CAPABILITY_CHANGE
{APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED},
#endif
};
#define numApmEvents (sizeof(bsdToXF86Array) / sizeof(bsdToXF86Array[0]))
static pmEvent
bsdToXF86(int type)
{
int i;
for (i = 0; i < numApmEvents; i++) {
if (type == bsdToXF86Array[i].apmBsd) {
return bsdToXF86Array[i].xf86;
}
}
return XF86_APM_UNKNOWN;
}
/*
* APM events can be requested direclty from /dev/apm
*/
static int
bsdPMGetEventFromOS(int fd, pmEvent * events, int num)
{
struct apm_event_info bsdEvent;
int i;
for (i = 0; i < num; i++) {
if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) {
if (errno != EAGAIN) {
xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT"
" %s\n", strerror(errno));
}
break;
}
events[i] = bsdToXF86(bsdEvent.type);
}
return i;
}
/*
* XXX This won't work on /dev/apm !
* We should either use /dev/apm_ctl (and kill apmd(8))
* or talk to apmd (but its protocol is not publically available)...
*/
static pmWait
bsdPMConfirmEventToOs(int fd, pmEvent event)
{
switch (event) {
case XF86_APM_SYS_STANDBY:
case XF86_APM_USER_STANDBY:
if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0)
return PM_WAIT; /* should we stop the Xserver in standby, too? */
else
return PM_NONE;
case XF86_APM_SYS_SUSPEND:
case XF86_APM_CRITICAL_SUSPEND:
case XF86_APM_USER_SUSPEND:
if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0)
return PM_WAIT;
else
return PM_NONE;
case XF86_APM_STANDBY_RESUME:
case XF86_APM_NORMAL_RESUME:
case XF86_APM_CRITICAL_RESUME:
case XF86_APM_STANDBY_FAILED:
case XF86_APM_SUSPEND_FAILED:
return PM_CONTINUE;
default:
return PM_NONE;
}
}
PMClose
xf86OSPMOpen(void)
{
int fd;
if (APMihPtr || !xf86Info.pmFlag) {
return NULL;
}
if ((fd = open(APM_DEVICE, O_RDWR)) == -1) {
return NULL;
}
xf86PMGetEventFromOs = bsdPMGetEventFromOS;
xf86PMConfirmEventToOs = bsdPMConfirmEventToOs;
APMihPtr = xf86AddGeneralHandler(fd, xf86HandlePMEvents, NULL);
return bsdCloseAPM;
}
static void
bsdCloseAPM(void)
{
int fd;
if (APMihPtr) {
fd = xf86RemoveGeneralHandler(APMihPtr);
close(fd);
APMihPtr = NULL;
}
}
|
/*
** use.h for epiDatabase in /epiEngine
**
** Made by Thomas Moulard
** Login moular_j
**
** Started on 02/01/2005 moular_t
** Last update 24/02/2005 moular_t
*/
#ifndef USE_H_
# define USE_H_
# include <stdio.h>
# include "utilsdb.h"
# include "../types.h"
# include "../locale/msg_index.h"
void usedb(struct s_sql_query *query, struct s_sql_result *result);
#endif /* !USE_H_ */
|
/*
* Copyright 2001-2004 Brandon Long
* All Rights Reserved.
*
* ClearSilver Templating System
*
* This code is made available under the terms of the ClearSilver License.
* http://www.clearsilver.net/license.hdf
*
*/
/* Initial version based on multi-proc based server (like apache 1.x)
*
* Parts are:
* 1) server Init
* 2) sub-proc start
* 3) sub-proc init
* 4) sub-proc process request
* 5) sub-proc cleanup
* 6) server cleanup
*
* Parts 1 & 6 aren't part of the framework, and at this point, I don't
* think I need to worry about 3 & 5 either, but maybe in the future.
*/
#ifndef __VC
#include "cs_config.h"
#endif
#ifndef __VC
#include <unistd.h>
#endif
#include <sys/types.h>
#ifndef __VC
#include <sys/wait.h>
#endif
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include "neo_misc.h"
#include "neo_err.h"
#include "neo_net.h"
#include "ulocks.h"
#include "neo_server.h"
static NEOERR *nserver_child_loop(NSERVER *server, int num)
{
NEOERR *err = STATUS_OK, *clean_err;
int loop = 0;
NSOCK *child_sock;
if (server->init_cb)
{
err = server->init_cb(server->data, num);
if (err) return nerr_pass(err);
}
while (loop++ < server->num_requests)
{
err = fLock(server->accept_lock);
if (err) break;
err = ne_net_accept(&child_sock, server->server_fd, server->data_timeout);
fUnlock(server->accept_lock);
if (err) break;
err = server->req_cb(server->data, num, child_sock);
if (err)
{
ne_net_close(&child_sock);
}
else
{
err = ne_net_close(&child_sock);
}
nerr_log_error(err);
nerr_ignore(&err);
}
ne_warn("nserver child loop handled %d connections", loop-1);
if (server->clean_cb)
{
clean_err = server->clean_cb(server->data, num);
if (clean_err)
{
nerr_log_error(clean_err);
nerr_ignore(&clean_err);
}
}
return nerr_pass(err);
}
static void ignore_pipe(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
sa.sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
sigaction(SIGPIPE, &sa, NULL);
}
/* Handle shutdown by accepting a TERM signal and then passing it to our
* program group */
static int ShutdownPending = 0;
static void sig_term(int sig)
{
ShutdownPending = 1;
ne_net_shutdown();
}
static void setup_term(void)
{
struct sigaction sa;
memset(&sa, 0, sizeof(struct sigaction));
sa.sa_handler = sig_term;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sigaction(SIGTERM, &sa, NULL);
}
NEOERR *nserver_proc_start(NSERVER *server, BOOL debug)
{
NEOERR *err;
if (server->req_cb == NULL)
return nerr_raise(NERR_ASSERT, "nserver requires a request callback");
ignore_pipe();
setup_term();
ShutdownPending = 0;
err = fFind(&(server->accept_lock), server->lockfile);
if (err && nerr_handle(&err, NERR_NOT_FOUND))
{
err = fCreate(&(server->accept_lock), server->lockfile);
}
if (err) return nerr_pass(err);
do
{
err = ne_net_listen(server->port, &(server->server_fd));
if (err) break;
if (debug == TRUE)
{
err = nserver_child_loop(server, 0);
break;
}
else
{
/* create children and restart them as necessary */
pid_t child;
int count, status;
for (count = 0; count < server->num_children; count++)
{
child = fork();
if (child == -1)
{
err = nerr_raise_errno(NERR_SYSTEM, "Unable to fork child");
break;
}
if (!child)
{
err = nserver_child_loop(server, count);
if (err) exit(-1);
exit(0);
}
ne_warn("Starting child pid %d", child);
}
if (count < server->num_children) break;
while (!ShutdownPending)
{
child = wait3(&status, 0, NULL);
if (child == -1)
{
ne_warn("wait3 failed [%d] %s", errno, strerror(errno));
continue;
}
if (WIFSTOPPED(status))
{
ne_warn("pid %d stopped on signal %d", child, WSTOPSIG(status));
continue;
}
if (WIFEXITED(status))
{
/* at some point, we might do something here with the
* particular exit value */
ne_warn("pid %d exited, returned %d", child, WEXITSTATUS(status));
}
else if (WIFSIGNALED(status))
{
ne_warn("pid %d exited on signal %d", child, WTERMSIG(status));
}
count++;
child = fork();
if (child == -1)
{
err = nerr_raise_errno(NERR_SYSTEM, "Unable to fork child");
break;
}
if (!child)
{
err = nserver_child_loop(server, count);
if (err) exit(-1);
exit(0);
}
ne_warn("Starting child pid %d", child);
}
/* At some point, we might want to actually maintain information
* on our children, and then we can be more specific here in terms
* of making sure they all shutdown... for now, fergitaboutit */
if (ShutdownPending)
{
killpg(0, SIGTERM);
}
}
}
while (0);
fDestroy(server->accept_lock);
return nerr_pass(err);
}
|
/***************************************************
*
* SPI interface for motion sensor L3G4200D/LIS33DE
*
***************************************************/
#ifndef __SENSOR_MOTION_L3G4200D_SPI__
#define __SENSOR_MOTION_L3G4200D_SPI__
#include <rtdef.h>
#include <rtthread.h>
#include "misc.h"
#include <stm32f10x.h>
#include <stm32f10x_spi.h>
#include <stm32f10x_gpio.h>
#include <stm32f10x_rcc.h>
#include <stm32f10x_exti.h>
#include <stm32f10x_dma.h>
/*
* L3G4200D registers
*/
#define GYRO_CTRL_REG1 0x20
#define GYRO_CTRL_REG2 0x21
#define GYRO_CTRL_REG3 0x22
#define GYRO_CTRL_REG4 0x23
#define GYRO_CTRL_REG5 0x24
#define GYRO_OUT_X_L 0x28
#define GYRO_OUT_X_H 0x29
#define GYRO_OUT_Y_L 0x2A
#define GYRO_OUT_Y_H 0x2B
#define GYRO_OUT_Z_L 0x2C
#define GYRO_OUT_Z_H 0x2D
/*
* LIS33DE write accessible registers
*/
#define ACLE_CTRL_REG1 0x20
#define ACLE_CTRL_REG2 0x21
#define ACLE_CTRL_REG3 0x22
#define ACLE_FF_WU_CFG 0x30
#define ACLE_FF_WU_THS 0x32
#define ACLE_FF_WU_DURATION 0x33
#define ACLE_WRITABLE(addr) (addr == ACLE_CTRL_REG1 || \
addr == ACLE_CTRL_REG2 || \
addr == ACLE_CTRL_REG3 || \
addr == ACLE_FF_WU_CFG || \
addr == ACLE_FF_WU_THS || \
addr == ACLE_FF_WU_DURATION)
void motion_sensor_init (void);
void l3g4200d_isr (void);
void lis33de_isr (void);
void write_gyro_reg (rt_uint8_t addr, rt_uint8_t val);
void write_acle_reg (rt_uint8_t addr, rt_uint8_t val);
rt_uint8_t read_gyro_reg (rt_uint8_t addr, rt_uint8_t len,
rt_uint8_t *data);
rt_uint8_t read_acle_reg (rt_uint8_t addr, rt_uint8_t len,
rt_uint8_t *data);
rt_uint16_t gyro_read_data (rt_uint8_t dir);
#endif
|
/* MEX function for Matlab */
#include "mex.h"
#include "ariac.h"
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
double *p;
if(nrhs != 1) {
mexErrMsgIdAndTxt("arrobot_setvel", "One input required.");
return;
}
arrobot_setvel(*(mxGetPr(prhs[0])));
}
|
#ifndef FLAGS_H
#define FLAGS_H
#include "definitions.h"
void MAJ_flags_move(processeur *p, short int source, char typage);
void MAJ_flags_cmp_sub(processeur *p, short int source);
void MAJ_flags_ls(processeur *p, short int source,short int dest);
void MAJ_flags_logique(processeur *p,short int res);
#endif
|
/*
* Copyright (C) 1996-2022 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
*/
#ifndef SQUID_BASE_RUNNERSREGISTRY_H
#define SQUID_BASE_RUNNERSREGISTRY_H
/**
* This API allows virtually any module to register its interest in receiving
* notification about initial configuration availability, configuration changes
* and other critical events in Squid lifetime without exposing the notifier
* to the details of the module.
*
* For example, main.cc may activate registered I/O modules after parsing
* squid.conf and deactivate them before exiting, all without knowing what
* those I/O modules really are.
*
* A module in this context is code providing a functionality or service to the
* rest of Squid, such as src/DiskIO/Blocking, src/fs/ufs, or Cache Manager. To
* receive notifications, a module must declare a RegisteredRunner child class
* and implement the methods corresponding to the events the module is
* interested in.
*
* The order of events is documented in this header (where applicable), but
* the order in which runners are notified about a given event is undefined.
* If a specific notification order is required, split the event into two or
* more related event(s), documenting their relative order here.
*
*/
/// a runnable registrant API
/// kids must override [only] the methods they are interested in
class RegisteredRunner
{
public:
/* Related methods below are declared in their calling order */
/* Configuration events */
/// Called after parsing squid.conf.
/// Meant for setting configuration options that depend on other
/// configuration options and were not explicitly configured.
virtual void finalizeConfig() {}
/// Called after finalizeConfig().
/// Meant for announcing memory reservations before memory is allocated.
virtual void claimMemoryNeeds() {}
/// Called after claimMemoryNeeds().
/// Meant for activating modules and features using a finalized
/// configuration with known memory requirements.
virtual void useConfig() {}
/* Reconfiguration events */
/// Called after receiving a reconfigure request and before parsing squid.conf.
/// Meant for modules that need to prepare for their configuration being changed
/// [outside their control]. The changes end with the syncConfig() event.
virtual void startReconfigure() {}
/// Called after parsing squid.conf during reconfiguration.
/// Meant for adjusting the module state based on configuration changes.
virtual void syncConfig() {}
/* Shutdown events */
/// Called after receiving a shutdown request and before stopping the main
/// loop. At least one main loop iteration is guaranteed after this call.
/// Meant for cleanup and state saving that may require other modules.
virtual void startShutdown() {}
/// Called after shutdown_lifetime grace period ends and before stopping
/// the main loop. At least one main loop iteration is guaranteed after
/// this call.
/// Meant for cleanup and state saving that may require other modules.
virtual void endingShutdown() {}
/// Called after stopping the main loop and before releasing memory.
/// Meant for quick/basic cleanup that does not require any other modules.
virtual ~RegisteredRunner() {}
/// Meant for cleanup of services needed by the already destroyed objects.
virtual void finishShutdown() {}
/// a pointer to one of the above notification methods
typedef void (RegisteredRunner::*Method)();
};
/// registers a given runner with the given registry and returns true on success
bool RegisterRunner(RegisteredRunner *rr);
/// Calls a given method of all runners.
/// All runners are destroyed after the finishShutdown() call.
void RunRegistered(const RegisteredRunner::Method &m);
/// A RegisteredRunner with lifetime determined by forces outside the Registry.
class IndependentRunner: public RegisteredRunner
{
public:
virtual ~IndependentRunner() { unregisterRunner(); }
protected:
void registerRunner();
void unregisterRunner(); ///< unregisters self; safe to call multiple times
};
/// convenience macro to describe/debug the caller and the method being called
#define RunRegisteredHere(m) \
debugs(1, 2, "running " # m); \
RunRegistered(&m)
/// convenience function to "use" an otherwise unreferenced static variable
bool UseThisStatic(const void *);
/// convenience macro: register one RegisteredRunner kid as early as possible
#define RunnerRegistrationEntry(Who) \
static const bool Who ## _Registered_ = \
RegisterRunner(new Who) > 0 && \
UseThisStatic(& Who ## _Registered_);
#endif /* SQUID_BASE_RUNNERSREGISTRY_H */
|
/* $Id: errno.c 3174 2010-05-17 12:51:06Z ming $ */
/*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pjmedia-audiodev/errno.h>
#include <pj/string.h>
#include <pj/unicode.h>
#if PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
# include <portaudio.h>
#endif
#if PJMEDIA_AUDIO_DEV_HAS_WMME
# ifdef _MSC_VER
# pragma warning(push, 3)
# endif
# include <windows.h>
# include <mmsystem.h>
# ifdef _MSC_VER
# pragma warning(pop)
# endif
#endif
/* PJMEDIA-Audiodev's own error codes/messages
* MUST KEEP THIS ARRAY SORTED!!
* Message must be limited to 64 chars!
*/
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
static const struct
{
int code;
const char *msg;
} err_str[] =
{
PJ_BUILD_ERR( PJMEDIA_EAUD_ERR, "Unspecified audio device error" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_SYSERR, "Unknown error from audio driver" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_INIT, "Audio subsystem not initialized" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_INVDEV, "Invalid audio device" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_NODEV, "Found no audio devices" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_NODEFDEV, "Unable to find default audio device" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_NOTREADY, "Audio device not ready" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_INVCAP, "Invalid or unsupported audio capability" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_INVOP, "Invalid or unsupported audio device operation" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_BADFORMAT, "Bad or invalid audio device format" ),
PJ_BUILD_ERR( PJMEDIA_EAUD_SAMPFORMAT, "Invalid audio device sample format"),
PJ_BUILD_ERR( PJMEDIA_EAUD_BADLATENCY, "Bad audio latency setting")
};
#endif /* PJ_HAS_ERROR_STRING */
/*
* pjmedia_audiodev_strerror()
*/
PJ_DEF(pj_str_t) pjmedia_audiodev_strerror(pj_status_t statcode,
char *buf, pj_size_t bufsize )
{
pj_str_t errstr;
#if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING != 0)
/* See if the error comes from Core Audio. */
#if PJMEDIA_AUDIO_DEV_HAS_COREAUDIO
if (statcode >= PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START &&
statcode <= PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_END)
{
int ca_err = PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START - statcode;
PJ_UNUSED_ARG(ca_err);
// TODO: create more helpful error messages
errstr.ptr = buf;
pj_strcpy2(&errstr, "Core audio error");
return errstr;
} else
#endif
/* See if the error comes from PortAudio. */
#if PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO
if (statcode >= PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_START &&
statcode <= PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_END)
{
//int pa_err = statcode - PJMEDIA_ERRNO_FROM_PORTAUDIO(0);
int pa_err = PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_START - statcode;
pj_str_t msg;
msg.ptr = (char*)Pa_GetErrorText(pa_err);
msg.slen = pj_ansi_strlen(msg.ptr);
errstr.ptr = buf;
pj_strncpy_with_null(&errstr, &msg, bufsize);
return errstr;
} else
#endif /* PJMEDIA_SOUND_IMPLEMENTATION */
/* See if the error comes from WMME */
#if PJMEDIA_AUDIO_DEV_HAS_WMME
if ((statcode >= PJMEDIA_AUDIODEV_WMME_IN_ERROR_START &&
statcode < PJMEDIA_AUDIODEV_WMME_IN_ERROR_END) ||
(statcode >= PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START &&
statcode < PJMEDIA_AUDIODEV_WMME_OUT_ERROR_END))
{
MMRESULT native_err, mr;
MMRESULT (WINAPI *waveGetErrText)(UINT mmrError, LPTSTR pszText, UINT cchText);
PJ_DECL_UNICODE_TEMP_BUF(wbuf, 80)
if (statcode >= PJMEDIA_AUDIODEV_WMME_IN_ERROR_START &&
statcode <= PJMEDIA_AUDIODEV_WMME_IN_ERROR_END)
{
native_err = statcode - PJMEDIA_AUDIODEV_WMME_IN_ERROR_START;
waveGetErrText = &waveInGetErrorText;
} else {
native_err = statcode - PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START;
waveGetErrText = &waveOutGetErrorText;
}
#if PJ_NATIVE_STRING_IS_UNICODE
mr = (*waveGetErrText)(native_err, wbuf, PJ_ARRAY_SIZE(wbuf));
if (mr == MMSYSERR_NOERROR) {
int len = wcslen(wbuf);
pj_unicode_to_ansi(wbuf, len, buf, bufsize);
}
#else
mr = (*waveGetErrText)(native_err, buf, bufsize);
#endif
if (mr==MMSYSERR_NOERROR) {
errstr.ptr = buf;
errstr.slen = pj_ansi_strlen(buf);
return errstr;
} else {
pj_ansi_snprintf(buf, bufsize, "MMSYSTEM native error %d",
native_err);
return pj_str(buf);
}
} else
#endif
/* Audiodev error */
if (statcode >= PJMEDIA_AUDIODEV_ERRNO_START &&
statcode < PJMEDIA_AUDIODEV_ERRNO_END)
{
/* Find the error in the table.
* Use binary search!
*/
int first = 0;
int n = PJ_ARRAY_SIZE(err_str);
while (n > 0) {
int half = n/2;
int mid = first + half;
if (err_str[mid].code < statcode) {
first = mid+1;
n -= (half+1);
} else if (err_str[mid].code > statcode) {
n = half;
} else {
first = mid;
break;
}
}
if (PJ_ARRAY_SIZE(err_str) && err_str[first].code == statcode) {
pj_str_t msg;
msg.ptr = (char*)err_str[first].msg;
msg.slen = pj_ansi_strlen(err_str[first].msg);
errstr.ptr = buf;
pj_strncpy_with_null(&errstr, &msg, bufsize);
return errstr;
}
}
#endif /* PJ_HAS_ERROR_STRING */
/* Error not found. */
errstr.ptr = buf;
errstr.slen = pj_ansi_snprintf(buf, bufsize,
"Unknown pjmedia-audiodev error %d",
statcode);
return errstr;
}
|
/*
* ORXONOX - the hottest 3D action shooter ever to exist
* > www.orxonox.net <
*
*
* License notice:
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
* Fabian 'x3n' Landau
* Co-authors:
* ...
*
*/
/**
@file EventDispatcher.h
@brief Definition of the EventDispatcher class.
@ingroup Eventsystem
*/
#ifndef _EventDispatcher_H__
#define _EventDispatcher_H__
#include "objects/ObjectsPrereqs.h"
#include <list>
#include "core/BaseObject.h"
namespace orxonox
{
class _ObjectsExport EventDispatcher : public BaseObject
{
public:
EventDispatcher(Context* context);
virtual ~EventDispatcher();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void processEvent(Event& event);
void addTarget(BaseObject* target);
BaseObject* getTarget(unsigned int index) const;
private:
std::list<BaseObject*> targets_;
};
}
#endif /* _EventDispatcher_H__ */
|
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
MODULE_INFO(intree, "Y");
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0xb95b937f, __VMLINUX_SYMBOL_STR(module_layout) },
{ 0x6bb32e6b, __VMLINUX_SYMBOL_STR(rc_map_unregister) },
{ 0x2e5810c6, __VMLINUX_SYMBOL_STR(__aeabi_unwind_cpp_pr1) },
{ 0x444b8c81, __VMLINUX_SYMBOL_STR(rc_map_register) },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=rc-core";
MODULE_INFO(srcversion, "5943257B27ABA91ACBC3C45");
|
// SPDX-License-Identifier: GPL-2.0
//
// Exemples de la formation
// "Ecriture de drivers et programmation noyau Linux"
// Chapitre "Driver en mode caracteres"
//
// (c) 2001-2022 Christophe Blaess
//
// https://www.logilin.fr/
//
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <linux/version.h>
#include <asm/uaccess.h>
#include "example-IV-06.h"
static int example_ppid_flag = 1;
static ssize_t example_read(struct file *filp, char *u_buffer, size_t length, loff_t *offset)
{
char k_buffer[128];
int l;
if (example_ppid_flag)
snprintf(k_buffer, 128, "PID= %u, PPID= %u\n",
current->pid,
current->real_parent->pid);
else
snprintf(k_buffer, 128, "PID= %u\n", current->pid);
l = strlen(k_buffer) - (*offset);
if (l <= 0)
return 0;
if (length < l)
l = length;
if (copy_to_user(u_buffer, &k_buffer[*offset], l) != 0)
return -EFAULT;
*offset += l;
return l;
}
static long example_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
if (_IOC_TYPE(cmd) != EXAMPLE_IOCTL_MAGIC)
return -ENOTTY;
switch (_IOC_NR(cmd)) {
case EXAMPLE_GET_PPID_FLAG:
if (copy_to_user((void *) arg, &example_ppid_flag, sizeof(example_ppid_flag)) != 0)
return -EFAULT;
break;
case EXAMPLE_SET_PPID_FLAG:
if (copy_from_user(&example_ppid_flag, (void *) arg, sizeof(example_ppid_flag)) != 0)
return -EFAULT;
break;
default:
return -ENOTTY;
}
return 0;
}
static const struct file_operations example_fops = {
.owner = THIS_MODULE,
.read = example_read,
.unlocked_ioctl = example_ioctl,
};
static struct miscdevice example_misc_driver = {
.minor = MISC_DYNAMIC_MINOR,
.name = THIS_MODULE->name,
.fops = &example_fops,
.mode = 0666,
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
module_misc_device(example_misc_driver);
#else
module_driver(example_misc_driver, misc_register, misc_deregister)
#endif
MODULE_DESCRIPTION("ioctl() system call implementation.");
MODULE_AUTHOR("Christophe Blaess <Christophe.Blaess@Logilin.fr>");
MODULE_LICENSE("GPL v2");
|
#ifndef CAMERACALIBRATION_SETTINGS_H_
#define CAMERACALIBRATION_SETTINGS_H_
enum CameraCalibrationPattern { CAMCALIB_CHESSBOARD, CAMCALIB_CIRCLES_GRID, CAMCALIB_ASYMMETRIC_CIRCLES_GRID };
struct StereoCalibrationSettings_struct {
bool doCalibration;
bool isCalibrated;
char *loadFileName_cam0;
bool useFisheyeModel_cam0;
bool useFisheyeModel_cam1;
char *loadFileName_cam1;
char *saveFileName_extrinsics;
char *saveFileName_intrinsics;
uint32_t captureDelay;
uint32_t numPairsImagesBeforCalib;
uint32_t boardWidth;
uint32_t boardHeigth;
enum CameraCalibrationPattern calibrationPattern;
float aspectRatio;
bool assumeZeroTangentialDistortion;
bool fixPrincipalPointAtCenter;
float boardSquareSize;
bool doDisparity;
float acceptableAvrEpipolarErr;
float acceptableRMSErr;
};
typedef struct StereoCalibrationSettings_struct *StereoCalibrationSettings;
#endif /* CAMERACALIBRATION_SETTINGS_H_ */
|
/* -*- Mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright 2012
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef ICENS_TCP_SERVER
#define ICENS_TCP_SERVER
#include "ns3/application.h"
#include "ns3/event-id.h"
#include "ns3/ptr.h"
#include "ns3/traced-callback.h"
#include "ns3/address.h"
namespace ns3 {
class Socket;
class Packet;
/**
* \ingroup applications
* \defgroup TcpEcho
*/
/**
* \ingroup tcpecho
* \brief A Tcp Echo server
*
* Every packet received is sent back to the client.
*/
class iCenSTCPServer : public Application
{
public:
typedef void (* ReceivedPacketTraceCallback) (uint32_t nodeid, Ptr<Packet> packet, const Address &address, uint32_t localport, uint32_t packetSize, uint32_t subscription, Ipv4Address localip);
typedef void (* SentPacketTraceCallback) (uint32_t nodeid, Ptr<Packet> packet, const Address &address, uint32_t localport);
static TypeId GetTypeId (void);
iCenSTCPServer ();
virtual ~iCenSTCPServer ();
/**
*
* Receive the packet from client echo on socket level (layer 4),
* handle the packet and return to the client.
*
* \param socket TCP socket.
*
*/
void ReceivePacket(Ptr<Socket> socket);
/**
*
* Handle packet from accept connections.
*
* \parm s TCP socket.
* \parm from Address from client echo.
*/
void HandleAccept (Ptr<Socket> s, const Address& from);
/**
*
* Handle successful closing connections.
*
* \parm s TCP socket.
*
*/
void HandleSuccessClose(Ptr<Socket> s);
protected:
virtual void DoDispose (void);
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
void HandleRead (Ptr<Socket> socket);
Ptr<Socket> m_socket;
Ptr<Socket> m_socket6;
uint16_t m_local_port;
bool m_running;
uint32_t m_subscription; //!< Subscription value of packet
Address m_remote_address;
Ipv4Address m_local_ip;
uint32_t m_packet_size;
TracedCallback<uint32_t, Ptr<Packet>, const Address &, uint32_t, uint32_t, Ipv4Address> m_receivedPacket;
TracedCallback<uint32_t, Ptr<Packet>, const Address &, uint32_t> m_sentPacket;
};
} // namespace ns3
#endif /* ICENS_TCP_SERVER */
|
#if defined(HEADER_ASN1_H) && !defined(HAVE_ASN1_STRING_GET0_DATA)
const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *);
#endif
|
/* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek Software")
* have been modified by MediaTek Inc. All revisions are subject to any receiver's
* applicable license agreements with MediaTek Inc.
*/
/* Assembler macros for SPARC
*
* (C) Copyright 2007, taken from linux asm-sparc/asmmacro.h
* Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*/
#ifndef __SPARC_ASMMACRO_H__
#define __SPARC_ASMMACRO_H__
#include <config.h>
/* All trap entry points _must_ begin with this macro or else you
* lose. It makes sure the kernel has a proper window so that
* c-code can be called.
*/
#define SAVE_ALL_HEAD \
sethi %hi(trap_setup+(CONFIG_SYS_RELOC_MONITOR_BASE-TEXT_BASE)), %l4; \
jmpl %l4 + %lo(trap_setup+(CONFIG_SYS_RELOC_MONITOR_BASE-TEXT_BASE)), %l6;
#define SAVE_ALL \
SAVE_ALL_HEAD \
nop;
/* All traps low-level code here must end with this macro. */
#define RESTORE_ALL b ret_trap_entry; clr %l6;
#endif
|
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
*
* 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 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __clang__
unsigned long __builtin_addcl(unsigned long, unsigned long, unsigned long, unsigned long *);
#endif
int main() {
unsigned long carryout;
__builtin_addcl((unsigned long) 0x0, (unsigned long) 0x0, 0, &carryout);
if (carryout != 0) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFF, (unsigned long) 0x0, 0, &carryout);
if (carryout != 0) {
return -1;
}
__builtin_addcl((unsigned long) 0x0, (unsigned long) 0xFFFFFFFFFFFFFFFF, 0, &carryout);
if (carryout != 0) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFF, (unsigned long) 0x1, 0, &carryout);
if (carryout != 1) {
return -1;
}
__builtin_addcl((unsigned long) 0x1, (unsigned long) 0xFFFFFFFFFFFFFFFF, 0, &carryout);
if (carryout != 1) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFF, (unsigned long) 0xFFFFFFFFFFFFFFF, 0, &carryout);
if (carryout != 1) {
return -1;
}
__builtin_addcl((unsigned long) 0x0, (unsigned long) 0xFFFFFFFFFFFFFFFE, 1, &carryout);
if (carryout != 0) {
return -1;
}
__builtin_addcl((unsigned long) 0x0, (unsigned long) 0xFFFFFFFFFFFFFFFF, 1, &carryout);
if (carryout != 1) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFE, (unsigned long) 0x0, 1, &carryout);
if (carryout != 0) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFF, (unsigned long) 0x0, 1, &carryout);
if (carryout != 1) {
return -1;
}
__builtin_addcl((unsigned long) 0xFFFFFFFFFFFFFFFF, (unsigned long) 0xFFFFFFFFFFFFFFFF, 1, &carryout);
if (carryout != 1) {
return -1;
}
long res1 = __builtin_addcl((unsigned long) 0x0FFFFFFFFFFFFFFF, (unsigned long) 0x1, 0, &carryout);
if (res1 != 0x1000000000000000 || carryout != 0) {
return -1;
}
long res2 = __builtin_addcl((unsigned long) 0x0FFFFFFFFFFFFFFF, (unsigned long) 0x1, 1, &carryout);
if (res2 != 0x1000000000000001 || carryout != 0) {
return -1;
}
return 0;
}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/* Test if a string represented in the form of a linked list is a palindrome */
#define TRUE 1
#define FALSE 0
#define ENDS ('\0')
struct node {
char c;
struct node * next;
};
struct node * createll(char * str)
{
int i = 0;
char c;
struct node * new = NULL;
struct node * head = NULL;
while ((c = str[i++]) != ENDS) {
if (head) {
new->next = malloc(sizeof(struct node));
new = new->next;
} else {
new = malloc(sizeof(struct node));
head = new;
}
new->c = c;
new->next = NULL;
}
return head;
}
void printll(struct node * head)
{
while(head) {
printf("%c", head->c);
head = head->next;
}
printf("\n");
}
void freell(struct node * head)
{
struct node * this = head;
while(this) {
head = this->next;
free(this);
this = head;
}
}
/* curr pointer is the left probe moving from left to right. this is global
* this pointer is the right probe moving from right to left as the recursion returns
*/
struct node * curr = NULL;
int recurse(struct node * this)
{
int ret = TRUE;
if (!this || !curr)
return FALSE;
if (this->next)
ret = recurse(this->next);
if (ret == FALSE)
return FALSE;
if (this->c == curr->c) {
curr = curr->next;
return TRUE;
}
return FALSE;
}
void testPalindrome(char str[])
{
struct node * strll = NULL;
strll = createll(str);
curr = strll;
if (recurse(strll))
printf("%s is a palindrome\n", str);
else
printf("%s is NOT a palindrome\n", str);
freell(strll);
}
int main (int argc, char *argv[])
{
int c;
for (c = 0; c < argc; ++c) {
printf("%s ", argv[c]);
}
printf("(%d)\n", argc);
testPalindrome("");
testPalindrome("a");
testPalindrome("ab");
testPalindrome("aa");
testPalindrome("aba");
testPalindrome("abba");
testPalindrome("adam");
testPalindrome("adad");
testPalindrome("abacus");
testPalindrome("abaaba");
return 0;
}
|
/*
* Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright 2008 Juergen Beisert, kernel@pengutronix.de
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef __MACH_MXS_GPIO_H__
#define __MACH_MXS_GPIO_H__
#include <asm-generic/gpio.h>
#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
/* use gpiolib dispatchers */
#define gpio_get_value __gpio_get_value
#define gpio_set_value __gpio_set_value
#define gpio_cansleep __gpio_cansleep
#define gpio_to_irq __gpio_to_irq
#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
#endif /* __MACH_MXS_GPIO_H__ */
|
/****************************************************************
* *
* Copyright 2001, 2002 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsroot.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "filestruct.h"
#include "hashdef.h"
#include "gtm_string.h"
#include "cmidef.h"
#include "cmmdef.h"
#include "gtcm_add_region.h"
#include "relqueopi.h"
GBLREF node_local_ptr_t locknl;
void gtcm_add_region(connection_struct *cnx,cm_region_head *rh)
{
cm_region_list *ptr, *list_head;
for (ptr = cnx->region_root; ptr ; ptr = ptr->next)
if (ptr->reghead == rh)
break;
if (!ptr)
{
ptr = (cm_region_list *)malloc(sizeof(*ptr));
memset(ptr,0,sizeof(*ptr));
ptr->regnum = cnx->maxregnum++;
assert(!cnx->region_array[ptr->regnum]);
cnx->region_array[ptr->regnum] = ptr;
ptr->reghead = rh;
ptr->cs = cnx;
DEBUG_ONLY(locknl = FILE_INFO(rh->reg)->s_addrs.nl;) /* for DEBUG_ONLY LOCK_HIST macro */
INSQTI(ptr,rh);
DEBUG_ONLY(locknl = NULL;) /* restore "locknl" to default value */
rh->refcnt++;
if (cnx->region_root == 0)
cnx->region_root = ptr;
else
{
list_head = cnx->region_root;
cnx->region_root = ptr;
ptr->next = list_head;
}
}
cnx->current_region = ptr;
}
|
/* kernel/power/fbearlysuspend.c
*
* Copyright (C) 2005-2008 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/earlysuspend.h>
#include <linux/module.h>
#include <linux/wait.h>
#include "power.h"
static wait_queue_head_t fb_state_wq;
static DEFINE_SPINLOCK(fb_state_lock);
static enum {
FB_STATE_STOPPED_DRAWING,
FB_STATE_REQUEST_STOP_DRAWING,
FB_STATE_DRAWING_OK,
} fb_state;
/* tell userspace to stop drawing, wait for it to stop */
static void stop_drawing_early_suspend(struct early_suspend *h)
{
int ret;
unsigned long irq_flags;
spin_lock_irqsave(&fb_state_lock, irq_flags);
fb_state = FB_STATE_REQUEST_STOP_DRAWING;
spin_unlock_irqrestore(&fb_state_lock, irq_flags);
wake_up_all(&fb_state_wq);
ret = wait_event_timeout(fb_state_wq,
fb_state == FB_STATE_STOPPED_DRAWING,
HZ);
if (unlikely(fb_state != FB_STATE_STOPPED_DRAWING))
pr_warning("stop_drawing_early_suspend: timeout waiting for "
"userspace to stop drawing\n");
}
/* tell userspace to start drawing */
static void start_drawing_late_resume(struct early_suspend *h)
{
unsigned long irq_flags;
spin_lock_irqsave(&fb_state_lock, irq_flags);
fb_state = FB_STATE_DRAWING_OK;
spin_unlock_irqrestore(&fb_state_lock, irq_flags);
wake_up(&fb_state_wq);
}
static struct early_suspend stop_drawing_early_suspend_desc = {
.level = EARLY_SUSPEND_LEVEL_STOP_DRAWING,
.suspend = stop_drawing_early_suspend,
.resume = start_drawing_late_resume,
};
static ssize_t wait_for_fb_sleep_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
char *s = buf;
int ret;
ret = wait_event_interruptible(fb_state_wq,
fb_state != FB_STATE_DRAWING_OK);
if (ret && fb_state == FB_STATE_DRAWING_OK)
return ret;
else
s += sprintf(buf, "sleeping");
return s - buf;
}
static ssize_t wait_for_fb_wake_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
char *s = buf;
int ret;
unsigned long irq_flags;
spin_lock_irqsave(&fb_state_lock, irq_flags);
if (fb_state == FB_STATE_REQUEST_STOP_DRAWING) {
fb_state = FB_STATE_STOPPED_DRAWING;
wake_up(&fb_state_wq);
}
spin_unlock_irqrestore(&fb_state_lock, irq_flags);
ret = wait_event_interruptible(fb_state_wq,
fb_state == FB_STATE_DRAWING_OK);
if (ret && fb_state != FB_STATE_DRAWING_OK)
return ret;
else
s += sprintf(buf, "awake");
return s - buf;
}
#define power_ro_attr(_name) \
static struct kobj_attribute _name##_attr = { \
.attr = { \
.name = __stringify(_name), \
.mode = 0444, \
}, \
.show = _name##_show, \
.store = NULL, \
}
power_ro_attr(wait_for_fb_sleep);
power_ro_attr(wait_for_fb_wake);
static struct attribute *g[] = {
&wait_for_fb_sleep_attr.attr,
&wait_for_fb_wake_attr.attr,
NULL,
};
static struct attribute_group attr_group = {
.attrs = g,
};
static int __init android_power_init(void)
{
int ret;
init_waitqueue_head(&fb_state_wq);
fb_state = FB_STATE_DRAWING_OK;
ret = sysfs_create_group(power_kobj, &attr_group);
if (ret) {
pr_err("android_power_init: sysfs_create_group failed\n");
return ret;
}
register_early_suspend(&stop_drawing_early_suspend_desc);
return 0;
}
static void __exit android_power_exit(void)
{
unregister_early_suspend(&stop_drawing_early_suspend_desc);
sysfs_remove_group(power_kobj, &attr_group);
}
module_init(android_power_init);
module_exit(android_power_exit);
|
//
// TVGSGFNode.h
// TivoGo
//
// Created by BiXiaopeng on 13-11-30.
// Copyright (c) 2013年 BiXiaopeng. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TVGSGFProperty.h"
@interface TVGSGFNode : NSObject
@property (nonatomic,readonly)BOOL isMoveNode;
@property (nonatomic)BOOL isLeaf;
@property (nonatomic)NSUInteger nodeID;
@property (nonatomic)NSUInteger parentID;
@property (nonatomic)NSUInteger nextStepID;
@property (nonatomic)NSMutableArray* otherVaris;
@property (nonatomic)NSArray *props;
-(NSArray *)getPropertyByName:(NSString *) name;
-(void)printPropertys;
@end
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// Copyright 2009 Aurora Feint, Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#import "OFService.h"
#import "OFActionRequestType.h"
#import "OFNotificationData.h"
class OFHttpNestedQueryStringWriter;
@class OFNotificationData;
@interface OFService ( Private )
- (void)_performAction:(NSString*)action
withParameters:(OFHttpNestedQueryStringWriter*)params
withHttpMethod:(NSString*)httpMethod
withSuccess:(const OFDelegate&)onSuccess
withFailure:(const OFDelegate&)onFailure
withRequestType:(OFActionRequestType)requestType
withNotice:(OFNotificationData*)notice
requiringAuthentication:(bool)requiringAuthentication;
- (void)getAction:(NSString*)action
withParameters:(OFHttpNestedQueryStringWriter*)params
withSuccess:(const OFDelegate&)onSuccess
withFailure:(const OFDelegate&)onFailure
withRequestType:(OFActionRequestType)requestType
withNotice:(OFNotificationData*)notice;
- (void)postAction:(NSString*)action
withParameters:(OFHttpNestedQueryStringWriter*)params
withSuccess:(const OFDelegate&)onSuccess
withFailure:(const OFDelegate&)onFailure
withRequestType:(OFActionRequestType)requestType
withNotice:(OFNotificationData*)notice;
- (void)putAction:(NSString*)action
withParameters:(OFHttpNestedQueryStringWriter*)params
withSuccess:(const OFDelegate&)onSuccess
withFailure:(const OFDelegate&)onFailure
withRequestType:(OFActionRequestType)requestType
withNotice:(OFNotificationData*)notice;
- (void)deleteAction:(NSString*)action
withParameters:(OFHttpNestedQueryStringWriter*)params
withSuccess:(const OFDelegate&)onSuccess
withFailure:(const OFDelegate&)onFailure
withRequestType:(OFActionRequestType)requestType
withNotice:(OFNotificationData*)notice;
@end
|
#include <windows.h>
#include <errno.h>
#include <io.h>
#include "mman.h"
#ifndef FILE_MAP_EXECUTE
#define FILE_MAP_EXECUTE 0x0020
#endif /* FILE_MAP_EXECUTE */
static int __map_mman_error(const DWORD err, const int deferr)
{
if (err == 0)
return 0;
//TODO: implement
return err;
}
static DWORD __map_mmap_prot_page(const int prot)
{
DWORD protect = 0;
if (prot == PROT_NONE)
return protect;
if ((prot & PROT_EXEC) != 0)
{
protect = ((prot & PROT_WRITE) != 0) ?
PAGE_EXECUTE_READWRITE : PAGE_EXECUTE_READ;
}
else
{
protect = ((prot & PROT_WRITE) != 0) ?
PAGE_READWRITE : PAGE_READONLY;
}
return protect;
}
static DWORD __map_mmap_prot_file(const int prot)
{
DWORD desiredAccess = 0;
if (prot == PROT_NONE)
return desiredAccess;
if ((prot & PROT_READ) != 0)
desiredAccess |= FILE_MAP_READ;
if ((prot & PROT_WRITE) != 0)
desiredAccess |= FILE_MAP_WRITE;
if ((prot & PROT_EXEC) != 0)
desiredAccess |= FILE_MAP_EXECUTE;
return desiredAccess;
}
void* mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
{
HANDLE fm, h;
void * map = MAP_FAILED;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4293)
#endif
const DWORD dwFileOffsetLow = (sizeof(off_t) <= sizeof(DWORD)) ?
(DWORD)off : (DWORD)(off & 0xFFFFFFFFL);
const DWORD dwFileOffsetHigh = (sizeof(off_t) <= sizeof(DWORD)) ?
(DWORD)0 : (DWORD)((off >> 32) & 0xFFFFFFFFL);
const DWORD protect = __map_mmap_prot_page(prot);
const DWORD desiredAccess = __map_mmap_prot_file(prot);
const off_t maxSize = off + (off_t)len;
const DWORD dwMaxSizeLow = (sizeof(off_t) <= sizeof(DWORD)) ?
(DWORD)maxSize : (DWORD)(maxSize & 0xFFFFFFFFL);
const DWORD dwMaxSizeHigh = (sizeof(off_t) <= sizeof(DWORD)) ?
(DWORD)0 : (DWORD)((maxSize >> 32) & 0xFFFFFFFFL);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
errno = 0;
if (len == 0
/* Unsupported flag combinations */
|| (flags & MAP_FIXED) != 0
/* Usupported protection combinations */
|| prot == PROT_EXEC)
{
errno = EINVAL;
return MAP_FAILED;
}
h = ((flags & MAP_ANONYMOUS) == 0) ?
(HANDLE)_get_osfhandle(fildes) : INVALID_HANDLE_VALUE;
if ((flags & MAP_ANONYMOUS) == 0 && h == INVALID_HANDLE_VALUE)
{
errno = EBADF;
return MAP_FAILED;
}
fm = CreateFileMapping(h, NULL, protect, dwMaxSizeHigh, dwMaxSizeLow, NULL);
if (fm == NULL)
{
errno = __map_mman_error(GetLastError(), EPERM);
return MAP_FAILED;
}
map = MapViewOfFile(fm, desiredAccess, dwFileOffsetHigh, dwFileOffsetLow, len);
CloseHandle(fm);
if (map == NULL)
{
errno = __map_mman_error(GetLastError(), EPERM);
return MAP_FAILED;
}
return map;
}
int munmap(void *addr, size_t len)
{
if (UnmapViewOfFile(addr))
return 0;
errno = __map_mman_error(GetLastError(), EPERM);
return -1;
}
int mprotect(void *addr, size_t len, int prot)
{
DWORD newProtect = __map_mmap_prot_page(prot);
DWORD oldProtect = 0;
if (VirtualProtect(addr, len, newProtect, &oldProtect))
return 0;
errno = __map_mman_error(GetLastError(), EPERM);
return -1;
}
int msync(void *addr, size_t len, int flags)
{
if (FlushViewOfFile(addr, len))
return 0;
errno = __map_mman_error(GetLastError(), EPERM);
return -1;
}
int mlock(const void *addr, size_t len)
{
if (VirtualLock((LPVOID)addr, len))
return 0;
errno = __map_mman_error(GetLastError(), EPERM);
return -1;
}
int munlock(const void *addr, size_t len)
{
if (VirtualUnlock((LPVOID)addr, len))
return 0;
errno = __map_mman_error(GetLastError(), EPERM);
return -1;
}
|
#ifndef EX13_18
#define EX13_18
#include <string>
class Employee{
public:
Employee();
Employee(std::string &);
const int id() const { return id_; }
private:
int id_;
static int s_id;
std::string name;
};
#endif
|
#ifndef DLG_UPDATE_H
#define DLG_UPDATE_H
#include <QtNetwork>
#include <QProgressDialog>
#include "update_checker.h"
#include "update_downloader.h"
class DlgUpdate : public QDialog {
Q_OBJECT
public:
DlgUpdate(QWidget *parent);
private slots:
void finishedUpdateCheck(bool needToUpdate, bool isCompatible, QVariantMap *build);
void gotoDownloadPage();
void downloadUpdate();
void updateCheckError(QString errorString);
void downloadSuccessful(QUrl filepath);
void downloadProgressMade(qint64 bytesRead, qint64 totalBytes);
void downloadError(QString errorString);
void closeDialog();
private:
QUrl updateUrl;
void enableUpdateButton(bool enable);
void beginUpdateCheck();
void setLabel(QString text);
QLabel *text;
QProgressBar *progress;
QPushButton *manualDownload, *gotoDownload, *ok;
QPushButton *cancel;
UpdateChecker *uChecker;
UpdateDownloader *uDownloader;
};
#endif
|
#include <linux/backlight.h>
#include <linux/fb.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#define ADX_BACKLIGHT_CONTROL 0x00
#define ADX_BACKLIGHT_CONTROL_ENABLE (1 << 0)
#define ADX_BACKLIGHT_BRIGHTNESS 0x08
#define ADX_BACKLIGHT_STATUS 0x10
#define ADX_BACKLIGHT_ERROR 0x18
struct adxbl {
void __iomem *base;
};
static int adx_backlight_update_status(struct backlight_device *bldev)
{
struct adxbl *bl = bl_get_data(bldev);
u32 value;
value = bldev->props.brightness;
writel(value, bl->base + ADX_BACKLIGHT_BRIGHTNESS);
value = readl(bl->base + ADX_BACKLIGHT_CONTROL);
if (bldev->props.state & BL_CORE_FBBLANK)
value &= ~ADX_BACKLIGHT_CONTROL_ENABLE;
else
value |= ADX_BACKLIGHT_CONTROL_ENABLE;
writel(value, bl->base + ADX_BACKLIGHT_CONTROL);
return 0;
}
static int adx_backlight_get_brightness(struct backlight_device *bldev)
{
struct adxbl *bl = bl_get_data(bldev);
u32 brightness;
brightness = readl(bl->base + ADX_BACKLIGHT_BRIGHTNESS);
return brightness & 0xff;
}
static int adx_backlight_check_fb(struct fb_info *fb)
{
return 1;
}
static struct backlight_ops adx_backlight_ops = {
.options = 0,
.update_status = adx_backlight_update_status,
.get_brightness = adx_backlight_get_brightness,
.check_fb = adx_backlight_check_fb,
};
static int __devinit adx_backlight_probe(struct platform_device *pdev)
{
struct backlight_device *bldev;
struct resource *res;
struct adxbl *bl;
int ret = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
ret = -ENXIO;
goto out;
}
res = devm_request_mem_region(&pdev->dev, res->start,
resource_size(res), res->name);
if (!res) {
ret = -ENXIO;
goto out;
}
bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL);
if (!bl) {
ret = -ENOMEM;
goto out;
}
bl->base = devm_ioremap_nocache(&pdev->dev, res->start,
resource_size(res));
if (!bl->base) {
ret = -ENXIO;
goto out;
}
bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, bl,
&adx_backlight_ops);
if (!bldev) {
ret = -ENOMEM;
goto out;
}
bldev->props.max_brightness = 0xff;
bldev->props.brightness = 0xff;
bldev->props.power = FB_BLANK_UNBLANK;
platform_set_drvdata(pdev, bldev);
out:
return ret;
}
static int __devexit adx_backlight_remove(struct platform_device *pdev)
{
struct backlight_device *bldev;
int ret = 0;
bldev = platform_get_drvdata(pdev);
bldev->props.power = FB_BLANK_UNBLANK;
bldev->props.brightness = 0xff;
backlight_update_status(bldev);
backlight_device_unregister(bldev);
platform_set_drvdata(pdev, NULL);
return ret;
}
#ifdef CONFIG_PM
static int adx_backlight_suspend(struct platform_device *pdev,
pm_message_t state)
{
return 0;
}
static int adx_backlight_resume(struct platform_device *pdev)
{
return 0;
}
#else
#define adx_backlight_suspend NULL
#define adx_backlight_resume NULL
#endif
static struct platform_driver adx_backlight_driver = {
.probe = adx_backlight_probe,
.remove = __devexit_p(adx_backlight_remove),
.suspend = adx_backlight_suspend,
.resume = adx_backlight_resume,
.driver = {
.name = "adx-backlight",
.owner = THIS_MODULE,
},
};
static int __init adx_backlight_init(void)
{
return platform_driver_register(&adx_backlight_driver);
}
static void __exit adx_backlight_exit(void)
{
platform_driver_unregister(&adx_backlight_driver);
}
module_init(adx_backlight_init);
module_exit(adx_backlight_exit);
MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>");
MODULE_DESCRIPTION("Avionic Design Xanthos Backlight Driver");
MODULE_LICENSE("GPL v2");
|
/*
* HTR -- The Heisetrolljan
*
* Copyright (C) 2016 Martin Wolters
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to
* the Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301, USA
*
*/
#include <stdint.h>
#include <stdlib.h>
/*
* lookup3 hash function by Bob Jenkins, abridged version.
*
* All special cases were removed. Only works on x86 and x64
* machines. Maybe more, but no guarantees!
*/
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
#define mix_jenkins(a, b, c) \
do { \
a -= c; a ^= rot(c, 4); c += b; \
b -= a; b ^= rot(a, 6); a += c; \
c -= b; c ^= rot(b, 8); b += a; \
a -= c; a ^= rot(c,16); c += b; \
b -= a; b ^= rot(a,19); a += c; \
c -= b; c ^= rot(b, 4); b += a; \
} while(0);
#define final_jenkins(a, b, c) \
do { \
c ^= b; c -= rot(b, 14); \
a ^= c; a -= rot(c, 11); \
b ^= a; b -= rot(a, 25); \
c ^= b; c -= rot(b, 16); \
a ^= c; a -= rot(c, 4); \
b ^= a; b -= rot(a, 14); \
c ^= b; c -= rot(b, 24); \
} while(0);
size_t hfunc_jenkins(const uint8_t *key, const size_t klen) {
uint32_t a, b, c;
uint32_t length = klen;
uint32_t *k;
size_t out;
a = b = c = 0xdeadbeef + klen;
k = (uint32_t*)key;
while(length > 12) {
a += k[0];
b += k[1];
c += k[2];
mix_jenkins(a, b, c);
length -= 12;
k += 3;
}
switch(length) {
case 12: c += k[2]; b += k[1]; a += k[0]; break;
case 11: c += k[2] & 0xffffff; b += k[1]; a += k[0]; break;
case 10: c += k[2] & 0xffff; b += k[1]; a += k[0]; break;
case 9: c += k[2] & 0xff; b += k[1]; a += k[0]; break;
case 8: b += k[1]; a += k[0]; break;
case 7: b += k[1] & 0xffffff; a += k[0]; break;
case 6: b += k[1] & 0xffff; a += k[0]; break;
case 5: b += k[1] & 0xff; a += k[0]; break;
case 4: a += k[0]; break;
case 3: a += k[0] & 0xffffff; break;
case 2: a += k[0] & 0xffff; break;
case 1: a += k[0] & 0xff; break;
case 0: goto ret;
}
final_jenkins(a, b, c);
ret:
out = b;
out <<= 32;
out += c;
return out;
}
/*
* Peter K. Pearson's algorithm from June 1990
* Communications of the ACM 33 (6): 677
*
* Adapted from http://en.wikipedia.org/wiki/Pearson_hashing
* using Pearson's original table from page 679 of the paper.
*/
size_t hfunc_pearson(const uint8_t *key, const size_t klen) {
size_t i, j;
size_t out = 0;
uint8_t h;
const uint8_t T[] = {
1, 87, 49, 12, 176, 178, 102, 166, 121, 193, 6, 84, 249, 230, 44, 163,
14, 197, 213, 181, 161, 85, 218, 80, 64, 239, 24, 226, 236, 142, 38, 200,
110, 177, 104, 103, 141, 253, 255, 50, 77, 101, 81, 18, 45, 96, 31, 222,
25, 107, 190, 70, 86, 237, 240, 34, 72, 242, 20, 214, 244, 227, 149, 235,
97, 234, 57, 22, 60, 250, 82, 175, 208, 5, 127, 199, 111, 62, 135, 248,
174, 169, 211, 58, 66, 154, 106, 195, 245, 171, 17, 187, 182, 179, 0, 243,
132, 56, 148, 75, 128, 133, 158, 100, 130, 126, 91, 13, 153, 246, 216, 219,
119, 68, 223, 78, 83, 88, 201, 99, 122, 11, 92, 32, 136, 114, 52, 10,
138, 30, 48, 183, 156, 35, 61, 26, 143, 74, 251, 94, 129, 162, 63, 152,
170, 7, 115, 167, 241, 206, 3, 150, 55, 59, 151, 220, 90, 53, 23, 131,
125, 173, 15, 238, 79, 95, 89, 16, 105, 137, 225, 224, 217, 160, 37, 123,
118, 73, 2, 157, 46, 116, 9, 145, 134, 228, 207, 212, 202, 215, 69, 229,
27, 188, 67, 124, 168, 252, 42, 4, 29, 108, 21, 247, 19, 205, 39, 203,
233, 40, 186, 147, 198, 192, 155, 33, 164, 191, 98, 204, 165, 180, 117, 76,
140, 36, 210, 172, 41, 54, 159, 8, 185, 232, 113, 196, 231, 47, 146, 120,
51, 65, 28, 144, 254, 221, 93, 189, 194, 139, 112, 43, 71, 109, 184, 209
};
for(j = 0; j < sizeof(size_t); j++) {
h = T[(key[0] + j) & 0xff];
for(i = 1; i < klen; i++)
h = T[h ^ key[i]];
out <<= 8;
out |= h;
}
return out;
}
/*
* Simple hash function from Stackoverflow user "Enno":
* http://stackoverflow.com/posts/5075554/revisions
*/
size_t hfunc_stackov(const uint8_t *key, const size_t klen) {
size_t out = 0, i;
for(i = 0; i < klen; i++)
out = out * 37 + key[i];
return out;
}
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************
rbpangomatrix.c -
$Author: mutoh $
$Date: 2006/12/10 15:13:10 $
Copyright (C) 2005 Masao Mutoh
************************************************/
#include "rbpango.h"
#if PANGO_CHECK_VERSION(1,6,0)
#define _SELF(self) ((PangoMatrix*)(RVAL2BOXED(self, PANGO_TYPE_MATRIX)))
#define ATTR_FLOAT(name)\
static VALUE \
matrix_get_ ## name (self)\
VALUE self;\
{\
return rb_float_new(_SELF(self)->name);\
}\
static VALUE \
matrix_set_ ## name (self, val)\
VALUE self, val;\
{\
_SELF(self)->name = NUM2DBL(val);\
return self;\
}
#define DEFINE_ACCESSOR(name) \
rb_define_method(matrix, G_STRINGIFY(name), matrix_get_ ## name, 0);\
rb_define_method(matrix, G_STRINGIFY(set_ ## name), matrix_set_## name, 1);
static VALUE
matrix_initialize(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
PangoMatrix matrix = PANGO_MATRIX_INIT;
VALUE xx, xy, yx, yy, x0, y0;
rb_scan_args(argc, argv, "06", &xx, &xy, &yx, &yy, &x0, &y0);
if (argc > 0){
matrix.xx = NUM2DBL(xx);
matrix.xy = NUM2DBL(xy);
matrix.yx = NUM2DBL(yx);
matrix.yy = NUM2DBL(yy);
matrix.x0 = NUM2DBL(x0);
matrix.y0 = NUM2DBL(y0);
}
G_INITIALIZE(self, &matrix);
return Qnil;
}
static VALUE
matrix_translate(self, tx, ty)
VALUE self, tx, ty;
{
pango_matrix_translate(_SELF(self), NUM2DBL(tx), NUM2DBL(ty));
return self;
}
static VALUE
matrix_scale(self, scale_x, scale_y)
VALUE self, scale_x, scale_y;
{
pango_matrix_scale(_SELF(self), NUM2DBL(scale_x), NUM2DBL(scale_y));
return self;
}
static VALUE
matrix_rotate(self, degrees)
VALUE self, degrees;
{
pango_matrix_rotate(_SELF(self), NUM2DBL(degrees));
return self;
}
#if PANGO_CHECK_VERSION(1,16,0)
static VALUE
matrix_get_gravity(VALUE self)
{
return GENUM2RVAL(pango_gravity_get_for_matrix(_SELF(self)), PANGO_TYPE_GRAVITY);
}
#endif
static VALUE
matrix_concat(self, new_matrix)
VALUE self, new_matrix;
{
pango_matrix_concat(_SELF(self), _SELF(new_matrix));
return self;
}
#if PANGO_CHECK_VERSION(1,12,0)
static VALUE
matrix_get_font_scale_factor(self)
VALUE self;
{
return rb_float_new(pango_matrix_get_font_scale_factor(_SELF(self)));
}
#endif
ATTR_FLOAT(xx);
ATTR_FLOAT(xy);
ATTR_FLOAT(yx);
ATTR_FLOAT(yy);
ATTR_FLOAT(x0);
ATTR_FLOAT(y0);
static VALUE
matrix_to_a(self)
VALUE self;
{
PangoMatrix* matrix = _SELF(self);
return rb_ary_new3(6, INT2NUM(matrix->xx), INT2NUM(matrix->xy), INT2NUM(matrix->yx),
INT2NUM(matrix->yy), INT2NUM(matrix->x0), INT2NUM(matrix->y0));
}
#endif
void
Init_pango_matrix()
{
#if PANGO_CHECK_VERSION(1,6,0)
VALUE matrix = G_DEF_CLASS(PANGO_TYPE_MATRIX, "Matrix", mPango);
rb_define_method(matrix, "initialize", matrix_initialize, -1);
rb_define_method(matrix, "translate!", matrix_translate, 2);
rb_define_method(matrix, "scale!", matrix_scale, 2);
rb_define_method(matrix, "rotate!", matrix_rotate, 1);
rb_define_method(matrix, "concat!", matrix_concat, 1);
#if PANGO_CHECK_VERSION(1,12,0)
rb_define_method(matrix, "font_scale_factor", matrix_get_font_scale_factor, 0);
#endif
#if PANGO_CHECK_VERSION(1,16,0)
rb_define_method(matrix, "gravity", matrix_get_gravity, 0);
#endif
rb_define_method(matrix, "to_a", matrix_to_a, 0);
DEFINE_ACCESSOR(xx);
DEFINE_ACCESSOR(xy);
DEFINE_ACCESSOR(yx);
DEFINE_ACCESSOR(yy);
DEFINE_ACCESSOR(x0);
DEFINE_ACCESSOR(y0);
G_DEF_SETTERS(matrix);
#endif
}
|
unsigned char PurpleWhite_Red[] = { 0, 82, 82, 83, 84, 84, 85, 86, 87, 87, 88,
89, 90, 91, 91, 92, 93, 94, 94, 95, 96, 97, 97, 98, 99, 99, 100, 101, 101, 102,
103, 103, 104, 104, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111,
111, 112, 112, 112, 113, 113, 114, 114, 115, 115, 116, 116, 116, 117, 117, 118,
118, 119, 119, 119, 120, 120, 121, 121, 122, 122, 123, 123, 123, 124, 124, 125,
125, 126, 126, 127, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, 139, 140,
140, 141, 141, 142, 142, 143, 143, 144, 144, 145, 145, 146, 146, 147, 147, 148,
148, 149, 149, 150, 150, 151, 151, 152, 152, 153, 153, 154, 154, 155, 155, 156,
156, 157, 157, 158, 158, 159, 159, 160, 160, 161, 162, 162, 163, 163, 164, 164,
165, 165, 166, 166, 167, 167, 168, 169, 169, 170, 170, 171, 171, 172, 172, 173,
174, 174, 175, 175, 176, 177, 177, 178, 178, 179, 180, 180, 181, 181, 182, 183,
183, 184, 184, 185, 186, 186, 187, 188, 188, 189, 190, 190, 191, 192, 192, 193,
194, 194, 195, 196, 196, 197, 198, 198, 199, 200, 200, 201, 202, 203, 203, 204,
205, 205, 206, 207, 207, 208, 209, 210, 210, 211, 212, 212, 213, 214, 214, 215,
216, 217, 217, 218, 219, 219, 220, 221, 222, 222, 223, 224, 225, 225, 226, 227,
228, 228};
unsigned char PurpleWhite_Grn[] = { 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6,
6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 18,
19, 19, 20, 21, 21, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31,
32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, 46, 46,
47, 48, 49, 50, 50, 51, 52, 53, 54, 54, 55, 56, 57, 58, 59, 60, 60, 61, 62, 63,
64, 65, 66, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100, 101, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 175, 176, 177, 178, 179,
180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
212, 213, 214, 215, 216, 217, 218, 219, 220, 222};
unsigned char PurpleWhite_Blu[] = { 0, 116, 117, 118, 119, 120, 122, 123, 124,
125, 127, 128, 129, 130, 132, 133, 134, 135, 137, 138, 139, 140, 141, 143, 144,
145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 158, 159,
160, 161, 162, 162, 163, 164, 165, 165, 166, 167, 168, 168, 169, 170, 171, 171,
172, 173, 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, 180, 181, 181, 182,
183, 183, 184, 185, 185, 186, 186, 187, 188, 188, 189, 190, 190, 191, 191, 192,
193, 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, 201, 201, 202,
202, 203, 203, 204, 205, 205, 206, 206, 207, 207, 208, 209, 209, 210, 210, 211,
211, 212, 212, 213, 213, 214, 214, 215, 215, 216, 216, 217, 217, 218, 218, 219,
219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 223, 224, 224, 224, 225, 225,
226, 226, 226, 227, 227, 228, 228, 228, 229, 229, 229, 230, 230, 231, 231, 231,
232, 232, 232, 233, 233, 233, 234, 234, 234, 235, 235, 235, 236, 236, 236, 237,
237, 237, 238, 238, 238, 239, 239, 239, 240, 240, 240, 241, 241, 241, 242, 242,
242, 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, 246, 246, 246, 246, 247,
247, 247, 247, 248, 248, 248, 248, 249, 249, 249, 249, 250, 250, 250, 250, 250,
250, 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
253, 254, 254, 254, 254, 254, 255};
|
/*******************************************************
* query.h
* author:ÌìÃü½£Ö÷
* copyright(c) 2015 - ~: ÇëÔĶÁ LICENSE Îļþ
* Description(ÃèÊö):²éѯº¯Êý
******************************************************/
#pragma once
#ifndef QUERY_H
#define QUERY_H
#include "command_cycle_defination.h"
bool CommandCycle::query(sregex_token_iterator &it, ResultSet* ¤t_result_set) {
if (it == end) {
lose_argument_error("selectÖ®ºóÐèÒª½ô¸úÁÐÃûµÈ²ÎÊý!");
return false;
}
string select_column_str = *it;
it++;
if (it == end) {
lose_argument_error("selectÖ®ºóÐèÒªwhere»òÕßfromµÈ²ÎÊý!");
return false;
}
string where_str = *it;
it++;
bool has_where = false;
if (where_str != keyword_where) {
if (where_str != keyword_from) {
print_error(error_unknown_command, where_str, "ÊÇ·ñÓ¦¸ÃÊÇwhere¹Ø¼ü×Ö!");
end_of_last_command = true;
return false;
}
else {
has_where = false;
}
}
else {
has_where = true;
}
string condition_str;
if (has_where) {
if (it == end) {
lose_argument_error("whereÖ®ºóÐèÒª½ô¸úÌõ¼þ±í´ïʽµÈ²ÎÊý!");
return false;
}
condition_str = *it;
it++;
if (it == end) {
lose_argument_error("ȱÉÙfromµÈ²ÎÊý!");
return false;
}
string from_str = *it;it++;
if (from_str != keyword_from) {
if (condition_str == keyword_from) {
print_error(error_lose_arguments, "whereÖ®ºóÐèÒªÌõ¼þ!");
end_of_last_command = true;
return false;
}
else {
print_error(error_unknown_command, from_str, "ÐèÒªfrom¹Ø¼ü×Ö!");
end_of_last_command = true;
return false;
}
}
}
else {
condition_str = "";
}
if (it == end) {
lose_argument_error(keyword_from, "Ö®ºóÐèÒª±íÃûµÈ²ÎÊý!");
return false;
}
string table_name = *it;
it++;
if (table_name != "select") {
DestinyTable* p_table = NULL;
if (database->contains_table(table_name, p_table)) {
current_result_set = new ResultSet();
current_result_set->column_names = p_table->column_names;
current_result_set->objects = p_table->objects;
}
else {
print_error(error_table_not_exists, table_name);
end_of_last_command = true;
if (current_result_set) {
delete current_result_set;
current_result_set = NULL;
}
return false;
}
}
else {
if (!query(it, current_result_set)) {
delete current_result_set;
current_result_set = NULL;
return false;
}
}
//NOTICE
//if (current_result_set == NULL) {
// end_of_last_command = false;
// return false;
//}
sregex_token_iterator column_it(select_column_str.begin(), select_column_str.end(), regex_comma, -1);
SingleList<string> columns;
while (column_it != end) {
string single_column = *column_it;
column_it++;
SingleNode<string> *p_c = current_result_set->column_names.head_node;
while (p_c != NULL) {
if (p_c->element == single_column) {
if (columns.index_of(p_c->element) == -1) {
columns.add_tail(p_c->element);
}
}
else {
try {
regex pattern(single_column);
if (regex_match(p_c->element, pattern)) {
if (columns.index_of(p_c->element) == -1) {
columns.add_tail(p_c->element);
}
}
}
catch (regex_error) {
;//ºöÂÔÕýÔò±í´ïʽ´íÎó
}
}
p_c = p_c->next;
}
}
SingleList<Condition*> all_conditions;
if (!get_conditions_by_str(condition_str, current_result_set->column_names, all_conditions)) {
delete current_result_set;
current_result_set = NULL;
return false;
}
ResultSet* result_set_final = current_result_set->select_objects(all_conditions, columns);
delete current_result_set;
current_result_set = result_set_final;
list_free(all_conditions);
end_of_last_command = true;
return true;
}
#endif
|
/**********************************************************************
*
* FreeDoko a Doppelkopf-Game
*
* Copyright (C) 2001-2013 by Diether Knof and Borg Enders
*
* 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 can find this license in the file 'gpl.txt'.
*
* 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
*
* Contact:
* Diether Knof dknof@gmx.de
* Borg Enders borg@borgsoft.de
*
*********************************************************************/
#ifndef HEADER_NETWORK_FREEDOKO_CONSTANTS
#define HEADER_NETWORK_FREEDOKO_CONSTANTS
#include "../constants.h"
#endif // #ifndef HEADER_NETWORK_FREEDOKO_CONSTANTS
|
/*
* Copyright (C) 2022 Colin Ian King.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef CORE_VECMATH_H
#define CORE_VECMATH_H
#include "core-arch.h"
/*
* Clang 5.0 is the lowest version of clang that
* can build this without issues (clang 4.0 seems
* to spend forever optimizing this and causes the build
* to never complete)
*/
#if defined(__clang__) && \
defined(__clang_major__) && \
__clang_major__ < 5
#undef HAVE_VECMATH
#endif
/*
* gcc 5.x or earlier breaks on 128 bit vector maths on
* PPC64 for some reason with some flavours of the toolchain
* so disable this test for now
*/
#if defined(STRESS_ARCH_PPC64) && \
defined(__GNUC__) && \
__GNUC__ < 6
#undef HAVE_VECMATH
#endif
#endif
|
/******************************************************************************
* Icinga 2 *
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.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. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software Foundation *
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#ifndef AGGREGATOR_H
#define AGGREGATOR_H
#include "livestatus/table.h"
#include "livestatus/filter.h"
namespace livestatus
{
/**
* @ingroup livestatus
*/
class Aggregator : public Object
{
public:
DECLARE_PTR_TYPEDEFS(Aggregator);
virtual void Apply(const Table::Ptr& table, const Value& row) = 0;
virtual double GetResult(void) const = 0;
void SetFilter(const Filter::Ptr& filter);
protected:
Aggregator(void);
Filter::Ptr GetFilter(void) const;
private:
Filter::Ptr m_Filter;
};
}
#endif /* AGGREGATOR_H */
|
/***************************************************************************
* Copyright (C) 2013 by Christoph Thelen *
* doc_bacardi@users.sourceforge.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef __HEADER_H__
#define __HEADER_H__
typedef struct VERSION_HEADER_STRUCT
{
unsigned long ulVersionMajor;
unsigned long ulVersionMinor;
unsigned long ulVersionMicro;
const char acVersionVcs[16];
} VERSION_HEADER_T;
extern const VERSION_HEADER_T tVersionHeader __attribute__ ((section (".header")));
#endif /* __HEADER_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2017-2018 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <arch/acpi.h>
#include <arch/io.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <intelblocks/pmc.h>
#include <soc/pci_devs.h>
/* SoC overrides */
/* Fill up PMC resource structure inside SoC directory */
__weak int pmc_soc_get_resources(
struct pmc_resource_config *cfg)
{
/* no-op */
return -1;
}
/* SoC override PMC initialization */
__weak void pmc_soc_init(struct device *dev)
{
/* no-op */
}
static void pch_pmc_add_new_resource(struct device *dev,
uint8_t offset, uintptr_t base, size_t size,
unsigned long flags)
{
struct resource *res;
res = new_resource(dev, offset);
res->base = base;
res->size = size;
res->flags = flags;
}
static void pch_pmc_add_mmio_resources(struct device *dev,
const struct pmc_resource_config *cfg)
{
pch_pmc_add_new_resource(dev, cfg->pwrmbase_offset,
cfg->pwrmbase_addr, cfg->pwrmbase_size,
IORESOURCE_MEM | IORESOURCE_ASSIGNED |
IORESOURCE_FIXED | IORESOURCE_RESERVE);
}
static void pch_pmc_add_io_resources(struct device *dev,
const struct pmc_resource_config *cfg)
{
pch_pmc_add_new_resource(dev, cfg->abase_offset,
cfg->abase_addr, cfg->abase_size,
IORESOURCE_IO | IORESOURCE_ASSIGNED |
IORESOURCE_FIXED);
if (CONFIG(PMC_INVALID_READ_AFTER_WRITE)) {
/*
* The ACPI IO BAR (offset 0x20) is not PCI compliant. We've
* observed cases where the BAR reads back as 0, but the IO
* window is open. This also means that it will not respond
* to PCI probing.
*/
pci_write_config16(dev, cfg->abase_offset, cfg->abase_addr);
/*
* In pci_dev_enable_resources, reading IO SPACE ACCESS bit in
* STATUSCOMMAND register does not read back the written
* value correctly, hence IO access gets disabled. This is
* seen in some PMC devices, hence this code makes sure
* IO access is available.
*/
dev->command |= PCI_COMMAND_IO;
}
}
static void pch_pmc_read_resources(struct device *dev)
{
struct pmc_resource_config pmc_cfg;
struct pmc_resource_config *config = &pmc_cfg;
if (pmc_soc_get_resources(config) < 0)
die("Unable to get PMC controller resource information!");
/* Get the normal PCI resources of this device. */
pci_dev_read_resources(dev);
/* Add non-standard MMIO resources. */
pch_pmc_add_mmio_resources(dev, config);
/* Add IO resources. */
pch_pmc_add_io_resources(dev, config);
}
void pmc_set_acpi_mode(void)
{
if (CONFIG(HAVE_SMI_HANDLER) && !acpi_is_wakeup_s3()) {
printk(BIOS_DEBUG, "Disabling ACPI via APMC:\n");
outb(APM_CNT_ACPI_DISABLE, APM_CNT);
printk(BIOS_DEBUG, "done.\n");
}
}
static struct device_operations device_ops = {
.read_resources = pch_pmc_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = pmc_soc_init,
.ops_pci = &pci_dev_ops_pci,
.scan_bus = scan_lpc_bus,
};
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_INTEL_SPT_LP_PMC,
PCI_DEVICE_ID_INTEL_SPT_H_PMC,
PCI_DEVICE_ID_INTEL_KBP_H_PMC,
PCI_DEVICE_ID_INTEL_APL_PMC,
PCI_DEVICE_ID_INTEL_GLK_PMC,
PCI_DEVICE_ID_INTEL_CNP_H_PMC,
PCI_DEVICE_ID_INTEL_ICP_PMC,
PCI_DEVICE_ID_INTEL_CMP_PMC,
0
};
static const struct pci_driver pch_pmc __pci_driver = {
.ops = &device_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.devices = pci_device_ids,
};
|
#import <Cocoa/Cocoa.h>
@interface COLoginItem : NSObject {
}
+ (BOOL)willStartAtLogin:(NSURL *)itemURL;
+ (void)setStartAtLogin:(NSURL *)itemURL enabled:(BOOL)enabled;
@end
|
/*
* Created on 14. August 2008, 11:41
*
* Copyright 2008 Oliver Eichner <o.eichner@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* Parts included from HDM
* hdm.c - Hard Disk Metadata
* Copyright (C) Finnbarr P. Murphy 2010 <fpm[AT]fpmurphy.com>
* Read more: http://blog.fpmurphy.com/2010/05/hard-disk-metadata.html#ixzz16WBhY72R
*/
/**
* @file Device.h
* Device Class header
*/
#ifndef _DEVICE_H
#define _DEVICE_H
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <fstream>
#include <iostream>
#include <string.h>
#include <string>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/fs.h>
#include <asm/byteorder.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h>
#include <parted/parted.h>
#define DUMPTXT 2
#define NONEWLINE 0
#define DI_VERSION "1.0"
#define TRANSPORT_MAJOR 0xDE
#define TRANSPORT_MINOR 0xDF
#define ATA_PIDENTIFY 0xA1
#define ATA_IDENTIFY 0xEC
#define NMRR 0xD9
#define CAPAB 0x31
#define CMDS_SUPP_1 0x53
#define VALID 0xC000
#define VALID_VAL 0x4000
#define SUPPORT_48_BIT 0x0400
#define LBA_SUP 0x0200
#define LBA_LSB 0x64
#define LBA_MID 0x65
#define LBA_48_MSB 0x66
#define LBA_64_MSB 0x67
using namespace std;
/**
* @class Device
* The Device class, one object per device wich stores tableau-parm informations..
* @author Oliver Eichner
* @version 0.3
*/
class Device {
public:
Device(string devName);
~Device();
virtual void setComment(string nComment);
virtual string getComment();
string getDeviceName();
string getVendor();
string getModel();
string getSerial();
string getSize();
int getSizeMB();
string getSizeBLK();
//tableau-parm getter
//## Bridge Information ##
string getBridge_chan_index();
string getBridge_chan_type();
bool getBridge_writes_permitted();
bool getBridge_declare_write_blocked();
bool getBridge_declare_write_errors();
string getBridge_serial();
string getBridge_vendor();
string getBridge_model();
string getBridge_firmware_date();
string getBridge_firmware_time();
// ## Drive Information ##
string getBridge_drive_vendor();
string getBridge_drive_model();
string getBridge_drive_serial();
string getBridge_drive_revision();
//## Drive HPA/DCO/Security Information ##
bool getBridge_security_in_use();
bool getBridge_security_support();
bool getBridge_hpa_in_use();
bool getBridge_hpa_support();
bool getBridge_dco_in_use();
bool getBridge_dco_support();
string getBridge_drive_capacity();
string getBridge_hpa_capacity();
string getBridge_dco_capacity();
string getBridge_dco_challenge_key();
private:
string comment;
string deviceName;
string vendor;
string model;
string serial;
string size, capacity;
string bus; // atm not in use
__u16 *id;
struct hd_geometry *g;
int fd;
//tableau-parm vars
//## Bridge Information ##
string bridge_chan_index;
string bridge_chan_type;
bool bridge_writes_permitted;
bool bridge_declare_write_blocked;
bool bridge_declare_write_errors;
string bridge_serial;
string bridge_vendor;
string bridge_model;
string bridge_firmware_date;
string bridge_firmware_time;
// ## Drive Information ##
string bridge_drive_vendor;
string bridge_drive_model;
string bridge_drive_serial;
string bridge_drive_revision;
//## Drive HPA/DCO/Security Information ##
bool bridge_security_in_use;
bool bridge_security_support;
bool bridge_hpa_in_use;
bool bridge_hpa_support;
bool bridge_dco_in_use;
bool bridge_dco_support;
string bridge_drive_capacity;
string bridge_hpa_capacity;
string bridge_dco_capacity;
string bridge_dco_challenge_key;
long long sizeBlk;
string sizeBlkString;
int sizeMB;
void fetchSys();
void fetchTableauParmStats();
//hd meta data
struct hd_geometry* get_geometry(int fd);
void* get_diskinfo(int fd);
char* get_transport(__u16 id[]);
char* get_rpm(__u16 id[]);
char* ascii_string(__u16 *p, unsigned int len);
char* get_capacity(int fd, __u16 id[]);
void dump_partitions(char *device, int dumpmode, int nlmode);
void dump(char *device);
};
#endif /* _DEVICE_H */
|
#include "objects_common.h"
#define T_GEYSIR 3000
#define T_GEYSIR_DUR 1000
/** \brief Geyser
*/
class Geyser : public Object {
public:
Geyser(Sint16 xpos=0, Sint16 ypos=0, const ParameterMap& param=ParameterMap());
virtual ~Geyser();
static ParameterMap default_parameters;
virtual void idle(Uint16 dt);
private:
Sint16 aspeed;
Mix_Chunk* au_geyser;
Uint16 Deffect;
};
|
/*
* Copyright (c) [2011-2012] Novell, Inc.
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail, you may
* find current contact information at www.novell.com.
*/
#ifndef SNAPPER_COMPARE_H
#define SNAPPER_COMPARE_H
#include <string>
#include <vector>
#include <functional>
#include "snapper/FileUtils.h"
namespace snapper
{
using std::string;
typedef std::function<void(const string& name, unsigned int status)> cmpdirs_cb_t;
/* Compares the two files. */
unsigned int
cmpFiles(const SFile& file1, const SFile& file2);
/* Compares the two directories. All file-operations use the openat
et.al. functions. */
void
cmpDirs(const SDir& dir1, const SDir& dir2, cmpdirs_cb_t cb);
}
#endif
|
#ifndef _ASM_GENERIC_GPIO_H
#define _ASM_GENERIC_GPIO_H
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/of.h>
#ifdef CONFIG_GPIOLIB
#include <linux/compiler.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/consumer.h>
/* Platforms may implement their GPIO interface with library code,
* at a small performance cost for non-inlined operations and some
* extra memory (for code and for per-GPIO table entries).
*
* While the GPIO programming interface defines valid GPIO numbers
* to be in the range 0..MAX_INT, this library restricts them to the
* smaller range 0..ARCH_NR_GPIOS-1.
*
* ARCH_NR_GPIOS is somewhat arbitrary; it usually reflects the sum of
* builtin/SoC GPIOs plus a number of GPIOs on expanders; the latter is
* actually an estimate of a board-specific value.
*/
#ifndef ARCH_NR_GPIOS
#define ARCH_NR_GPIOS 512
#endif
/*
* "valid" GPIO numbers are nonnegative and may be passed to
* setup routines like gpio_request(). only some valid numbers
* can successfully be requested and used.
*
* Invalid GPIO numbers are useful for indicating no-such-GPIO in
* platform data and other tables.
*/
static inline bool gpio_is_valid(int number)
{
return number >= 0 && number < ARCH_NR_GPIOS;
}
struct device;
struct gpio;
struct seq_file;
struct module;
struct device_node;
struct gpio_desc;
/* caller holds gpio_lock *OR* gpio is marked as requested */
static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
{
return gpiod_to_chip(gpio_to_desc(gpio));
}
/* Always use the library code for GPIO management calls,
* or when sleeping may be involved.
*/
extern int gpio_request(unsigned gpio, const char *label);
extern void gpio_free(unsigned gpio);
static inline int gpio_direction_input(unsigned gpio)
{
return gpiod_direction_input(gpio_to_desc(gpio));
}
static inline int gpio_direction_output(unsigned gpio, int value)
{
return gpiod_direction_output_raw(gpio_to_desc(gpio), value);
}
static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
{
return gpiod_set_debounce(gpio_to_desc(gpio), debounce);
}
static inline int gpio_set_drive(unsigned gpio, unsigned mode)
{
return gpiod_set_drive(gpio_to_desc(gpio), mode);
}
static inline int gpio_get_value_cansleep(unsigned gpio)
{
return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
}
static inline void gpio_set_value_cansleep(unsigned gpio, int value)
{
return gpiod_set_raw_value_cansleep(gpio_to_desc(gpio), value);
}
/* A platform's <asm/gpio.h> code may want to inline the I/O calls when
* the GPIO is constant and refers to some always-present controller,
* giving direct access to chip registers and tight bitbanging loops.
*/
static inline int __gpio_get_value(unsigned gpio)
{
return gpiod_get_raw_value(gpio_to_desc(gpio));
}
static inline void __gpio_set_value(unsigned gpio, int value)
{
return gpiod_set_raw_value(gpio_to_desc(gpio), value);
}
static inline int __gpio_cansleep(unsigned gpio)
{
return gpiod_cansleep(gpio_to_desc(gpio));
}
static inline int __gpio_to_irq(unsigned gpio)
{
return gpiod_to_irq(gpio_to_desc(gpio));
}
extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *label);
extern int gpio_request_array(const struct gpio *array, size_t num);
extern void gpio_free_array(const struct gpio *array, size_t num);
/*
* A sysfs interface can be exported by individual drivers if they want,
* but more typically is configured entirely from userspace.
*/
static inline int gpio_export(unsigned gpio, bool direction_may_change)
{
return gpiod_export(gpio_to_desc(gpio), direction_may_change);
}
static inline int gpio_export_link(struct device *dev, const char *name,
unsigned gpio)
{
return gpiod_export_link(dev, name, gpio_to_desc(gpio));
}
static inline void gpio_unexport(unsigned gpio)
{
gpiod_unexport(gpio_to_desc(gpio));
}
#else /* !CONFIG_GPIOLIB */
static inline bool gpio_is_valid(int number)
{
/* only non-negative numbers are valid */
return number >= 0;
}
/* platforms that don't directly support access to GPIOs through I2C, SPI,
* or other blocking infrastructure can use these wrappers.
*/
static inline int gpio_cansleep(unsigned gpio)
{
return 0;
}
static inline int gpio_get_value_cansleep(unsigned gpio)
{
might_sleep();
return __gpio_get_value(gpio);
}
static inline void gpio_set_value_cansleep(unsigned gpio, int value)
{
might_sleep();
__gpio_set_value(gpio, value);
}
#endif /* !CONFIG_GPIOLIB */
#endif /* _ASM_GENERIC_GPIO_H */
|
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Definitions for the Super I/O chips.
*
* Version: @(#)sio.h 1.0.6 2019/05/17
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2017 Fred N. van Kempen.
*/
#ifndef EMU_SIO_H
# define EMU_SIO_H
extern const device_t acc3221_device;
extern const device_t fdc37c663_device;
extern const device_t fdc37c665_device;
extern const device_t fdc37c666_device;
extern const device_t fdc37c669_device;
extern const device_t fdc37c932fr_device;
extern const device_t fdc37c932qf_device;
extern const device_t fdc37c935_device;
extern const device_t pc87306_device;
extern const device_t sio_detect_device;
extern const device_t um8669f_device;
extern const device_t w83877f_device;
extern const device_t w83877f_president_device;
extern const device_t w83877tf_device;
#endif /*EMU_SIO_H*/
|
#include <unistd.h>
#include <sys/reboot.h>
#include <stdlib.h>
#include "platform/platform.h"
#define ABORTMSG "hard-reboot: Aborted.\n"
#define USAGE "Say \"hard-reboot (RESTART|HALT|POWER_OFF)\" if you really mean it.\n"
void usage(void) {
write(2, ABORTMSG, str_len(ABORTMSG));
write(2, USAGE, str_len(USAGE));
exit(1);
}
int main(int argc, char *argv[]) {
if (argc!=2)
usage();
sync();
sync();
sync();
if (strcmp(argv[1], "RESTART")==0) {
reboot(RB_AUTOBOOT);
} else if (strcmp(argv[1], "HALT")==0) {
reboot(RB_HALT_SYSTEM);
} else if (strcmp(argv[1], "POWER_OFF")==0) {
reboot(RB_POWER_OFF);
} else {
usage();
}
while(1)
sleep(10);
}
|
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
* 2013, Ported by Ravishka Fernando. <rn.fernando3@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 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 _ARCH_ARM_MACH_MSM_MDM_H
#define _ARXH_ARM_MACH_MSM_MDM_H
struct charm_platform_data {
void (*charm_modem_on)(void);
void (*charm_modem_off)(void);
void (*charm_modem_reset)(void);
void (*charm_modem_suspend)(void);
void (*charm_modem_resume)(void);
unsigned gpio_ap2mdm_status;
unsigned gpio_ap2mdm_wakeup;
unsigned gpio_ap2mdm_errfatal;
unsigned gpio_ap2mdm_sync;
unsigned gpio_ap2mdm_pmic_reset_n;
unsigned gpio_ap2mdm_kpdpwr_n;
unsigned gpio_ap2pmic_tmpni_cken;
unsigned gpio_mdm2ap_status;
unsigned gpio_mdm2ap_wakeup;
unsigned gpio_mdm2ap_errfatal;
unsigned gpio_mdm2ap_sync;
unsigned gpio_mdm2ap_vfr;
};
extern void (*charm_intentional_reset)(void);
unsigned charm_get_MDM_error_flag(void);
void charm_panic_notify(void);
void charm_panic_wait_mdm_shutdown(void);
void check_mdm9k_serial(void);
#endif
|
/***************************************************************************
* Copyright (C) 2008 by I2P-Messenger *
* Messenger-Dev@I2P-Messenger *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef I2PSTREAM_H
#define I2PSTREAM_H
#include <QTcpSocket>
#include <QSocketNotifier>
#include <QTimer>
#include "I2PSamMessageAnalyser.h"
namespace STREAMS
{
enum StreamMode{
ACCEPT,
CONNECT
};
}
namespace CONNECTIONTYPE
{
enum Type{
UNKNOWN,
KNOWN
};
}
using namespace STREAMS;
using namespace CONNECTIONTYPE;
class CI2PStream:public QObject
{
Q_OBJECT
public:
CI2PStream(
QString SamHost,
QString SamPort,
qint32 ID,
QString StreamBridgeName,
StreamMode Mode,
bool Silence=false,
QString UsedFor=""
);
~CI2PStream();
//forbid some operators
CI2PStream(const CI2PStream&)=delete;
CI2PStream& operator=(const CI2PStream&)=delete;
bool doConnect(QString Destination);
bool doAccept();
void doDisconnect();
QString getDestination() const {return mDestination;}
qint32 getID() const {return mID;}
StreamMode getStreamMode() const {return mMode;}
Type getConnectionType() const {return mConnectionType;}
bool getFIRSTPAKETCHAT_allreadySended() const {return mFIRSTPAKETCHAT_allreadySended;}
QString getUsedFor(){return mUsedFor;};
void setConnectionType ( const Type newTyp );
void setFIRSTPAKETCHAT_allreadySended ( bool theValue );
void setUsedFor(QString value){mUsedFor=value;};
void operator <<(const QByteArray Data);
void operator <<(const QString Data);
void startUnlimintedReconnect(qint32 msec);
void stopUnlimintedReconnect();
private slots:
void slotConnected();
void slotDisconnected();
void slotReadFromSocket();
void slotCheckForReconnect();
void slotInitConnectionTimeout();
signals:
void signDebugMessages(const QString Message);
void signStreamStatusRecived(const SAM_Message_Types::RESULT result,const qint32 ID,const QString Message);
void signDataRecived(const qint32 ID,const QByteArray Data);
void signModeAcceptIncomingStream(qint32 ID);//emit if Destination recived (SILENCE=false)
private:
const QString mSamHost;
const QString mSamPort;
const qint32 mID;
const QString mStreamBridgeName;
const StreamMode mMode;
Type mConnectionType;
const bool mSilence;
QString mUsedFor; //like Filetransfer....
QString mDestination;
bool mDoneDisconnect;
bool mModeStreamConnect;
bool mModeStreamAccept;
bool mStatusRecived;
bool mHandShakeWasSuccesfullDone;
bool mDestinationRecived;
bool mFIRSTPAKETCHAT_allreadySended;
QByteArray* mIncomingPackets;
QTcpSocket mTcpSocket;
QTimer* mTimer;
QTimer mUnKnownConnectionTimeout;
CI2PSamMessageAnalyser* mAnalyser;
};
#endif
|
#ifndef BUFSOCKET_H
#define BUFSOCKET_H
#include <Socket.h>
class BufferedSocket: public Socket{
uint8_t* recvBuffer;
uint16_t bufferSize;
uint16_t bufferCapacity;
void init(uint16_t bufferSize);
protected:
bool onDataReceived(Buffer* buf);
public:
BufferedSocket(char* server, uint16_t port, DNSHandler* dns,
uint16_t bufferSize);
BufferedSocket(uint8_t* remoteIP, uint16_t remotePort, uint16_t bufferSize);
BufferedSocket(uint16_t listenPort, uint16_t bufferSize);
~BufferedSocket();
uint16_t dataAvailable();
uint16_t read(void* data, uint16_t length);
uint16_t getApplicationWindowSize();
};
#endif
|
#ifndef RMADataConvWidget_H
#define RMADataConvWidget_H
// Include wxWindows' headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/dialog.h>
#include <wx/image.h>
#include <wx/statline.h>
#include <wx/spinbutt.h>
#include <wx/spinctrl.h>
#include <wx/splitter.h>
#include <wx/listctrl.h>
#include <wx/treectrl.h>
#include <wx/notebook.h>
#include <wx/grid.h>
#ifdef BUFFERED
#include "PreferencesDialog.h"
#endif
// Declare window functions
#define ID_TEXT 10000
#define ID_TEXTCTRL 10001
#define ABOUT_BUTTON 10003
#define CONVERT_BUTTON 10004
#define QUIT_BUTTON 10005
#define PREF_BUTTON 10006
#define CELBROWSE_BUTTON 10010
#define CDFBROWSE_BUTTON 10011
#define RESTRICTBROWSE_BUTTON 10012
#define OUTPUTBROWSE_BUTTON 10013
#define PGFBROWSE_BUTTON 10014
#define CLFBROWSE_BUTTON 10015
#define PSBROWSE_BUTTON 10016
#define MPSBROWSE_BUTTON 10017
static const wxChar
*CDFFILETYPES = _T( "CDF files|*.cdf;*.CDF;*.Cdf" );
static const wxChar
*CELFILETYPES = _T( "CEL files|*.cel;*.Cel;*.CEL" );
static const wxChar
*PGFFILETYPES = _T( "PGF files|*.pgf;*.PGF;*.Pgf" );
static const wxChar
*CLFFILETYPES = _T( "CLF files|*.clf;*.CLF;*.Clf" );
static const wxChar
*PSFILETYPES = _T( "PS files|*.ps;*.PS;*.Ps" );
static const wxChar
*MPSFILETYPES = _T( "MPS files|*.mps;*.MPS;*.Mps" );
class RMADataConvDlg : public wxDialog
{
public:
RMADataConvDlg(const wxString& title, const wxPoint& pos, const wxSize& size);
~RMADataConvDlg();
void OnAbout(wxCommandEvent& WXUNUSED(event));
void OnQuit(wxCommandEvent& WXUNUSED(event));
void OnQuit2(wxCloseEvent& WXUNUSED(event));
void OnCelBrowse(wxCommandEvent& WXUNUSED(event));
void OnCdfBrowse(wxCommandEvent& WXUNUSED(event));
void OnCLFBrowse(wxCommandEvent& WXUNUSED(event));
void OnPGFBrowse(wxCommandEvent& WXUNUSED(event));
void OnPSBrowse(wxCommandEvent& WXUNUSED(event));
void OnMPSBrowse(wxCommandEvent& WXUNUSED(event));
void OnRestrictBrowse(wxCommandEvent& WXUNUSED(event));
void OnOutputBrowse(wxCommandEvent& WXUNUSED(event));
void OnConvert(wxCommandEvent& WXUNUSED(event));
void OnPreferences(wxCommandEvent& WXUNUSED(event));
wxTextCtrl *CelDirectory;
wxTextCtrl *CdfFile;
wxTextCtrl *RestrictFile;
wxTextCtrl *OutputDirectory;
wxTextCtrl *ForceBox;
wxTextCtrl *PGFFile;
wxTextCtrl *CLFFile;
wxTextCtrl *PSFile;
wxTextCtrl *MPSFile;
private:
#ifdef BUFFERED
Preferences *myprefs;
#endif
DECLARE_EVENT_TABLE()
};
class RMADataConv: public wxApp
{
virtual bool OnInit();
};
#endif
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/IMAVCore.framework/IMAVCore
*/
#import <IMAVCore/AVChatResponseOp.h>
__attribute__((visibility("hidden")))
@interface AVChatCounterProposalOp : AVChatResponseOp {
}
- (void)_sendMessageToBuddy:(id)buddy result:(id)result; // 0x5401
@end
|
/*
* misc.c
*
* This is a collection of several routines from gzip-1.0.3
* adapted for Linux.
*
* Modified for ARM Linux by Russell King
*
* Nicolas Pitre <nico@visuaide.com> 1999/04/14 :
* For this code to run directly from Flash, all constant variables must
* be marked with 'const' and all other variables initialized at run-time
* only. This way all non constant variables will end up in the bss segment,
* which should point to addresses in RAM and cleared to 0 on start.
* This allows for a much quicker boot time.
*/
unsigned int __machine_arch_type;
#include <linux/kernel.h>
#include <asm/uaccess.h>
#include "uncompress.h"
#ifdef STANDALONE_DEBUG
#define puts printf
#endif
#define __ptr_t void *
/*
* gzip delarations
*/
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
#define WSIZE 0x8000 /* Window size must be at least 32k, */
/* and a power of two */
static uch window[WSIZE]; /* Sliding window buffer */
static unsigned outcnt; /* bytes in output buffer */
static void flush_window(void);
static void error(char *m);
extern char input_data[];
extern char input_data_end[];
static uch *output_data;
static ulg output_ptr;
static ulg bytes_out;
static void puts(const char *);
extern int end;
static ulg free_mem_ptr;
static ulg free_mem_ptr_end;
#define HEAP_SIZE 0x2000
#include "../../../../lib/inflate.c"
#ifdef STANDALONE_DEBUG
#define NO_INFLATE_MALLOC
#endif
/* ===========================================================================
* Write the output window window[0..outcnt-1] and update bytes_out.
* (Used for the decompressed data only.)
*/
void flush_window(void)
{
unsigned n;
uch *in, *out, ch;
in = window;
out = &output_data[output_ptr];
for (n = 0; n < outcnt; n++)
ch = *out++ = *in++;
bytes_out += (ulg)outcnt;
output_ptr += (ulg)outcnt;
outcnt = 0;
puts(".");
}
static void error(char *x)
{
int ptr;
puts("\n\n");
puts(x);
puts("\n\n -- System halted");
while(1); /* Halt */
}
#ifndef STANDALONE_DEBUG
ulg
decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p,
int arch_id)
{
output_data = (uch *)output_start; /* Points to kernel start */
free_mem_ptr = free_mem_ptr_p;
free_mem_ptr_end = free_mem_ptr_end_p;
__machine_arch_type = arch_id;
arch_decomp_setup();
puts("Uncompressing Linux...");
gunzip(input_data, input_data_end - input_data, NULL);
puts(" done, booting the kernel.\n");
return output_ptr;
}
#else
char output_buffer[1500*1024];
int main()
{
output_data = output_buffer;
puts("Uncompressing Linux...");
gunzip(input_data, input_data_end - input_data, NULL);
puts("done.\n");
return 0;
}
#endif
|
#include <linux/version.h>
#include <linux/module.h>
#include <linux/irq.h>
#include <linux/types.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/mm.h>
#include <linux/major.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/cdev.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <asm/delay.h>
#include <mach/am_regs.h>
#include <mach/power_gate.h>
#include <linux/amlogic/tvin/tvin.h>
#include <mach/gpio.h>
#include <mach/hdmi_tx_reg.h>
#include <linux/amlogic/hdmi_tx/hdmi_tx_module.h>
#include <linux/amlogic/hdmi_tx/hdmi_tx_cec.h>
hdmitx_dev_t *hdmitx_device = NULL;
__u16 cec_key_map[128] = {
KEY_ENTER, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, 0 , 0 , 0 ,//0x00
0 , KEY_HOMEPAGE , KEY_MENU, 0, 0, KEY_BACK, 0, 0,
0 , 0, 0, 0, 0, 0, 0, 0,//0x10
0 , 0, 0, 0, 0, 0, 0, 0,
KEY_0 , KEY_1, KEY_2, KEY_3,KEY_4, KEY_5, KEY_6, KEY_7,//0x20
KEY_8 , KEY_9, KEY_DOT, 0, 0, 0, 0, 0,
0 , 0, 0, 0, 0, 0, 0, 0,//0x30
0 , 0, 0, 0, 0, 0, 0, 0,
KEY_POWER , KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_MUTE, KEY_PLAYPAUSE, KEY_STOP, KEY_PLAYPAUSE, KEY_RECORD,//0x40
KEY_REWIND, KEY_FASTFORWARD, KEY_EJECTCD, KEY_NEXTSONG, KEY_PREVIOUSSONG, 0, 0, 0,
0 , 0, 0, 0, 0, 0, 0, 0,//0x50
0 , 0, 0, 0, 0, 0, 0, 0,
KEY_PLAYCD, KEY_PLAYPAUSE, KEY_RECORD, KEY_PAUSECD, KEY_STOPCD, KEY_MUTE, 0, KEY_TUNER,//0x60
0 , KEY_MEDIA, 0, 0, KEY_POWER, 0, 0, 0,
0 , KEY_BLUE, KEY_RED, KEY_GREEN, KEY_YELLOW, 0, 0, 0,//0x70
0 , 0, 0, 0, 0, 0, 0, 0x2fd,
};
void cec_send_event(cec_rx_message_t* pcec_message)
{
int i;
unsigned char brdcst, opcode;
unsigned char initiator, follower;
unsigned char operand_num;
unsigned char msg_length;
unsigned char operands[14];
/* parse message */
if ((!pcec_message) || (check_cec_msg_valid(pcec_message) == 0)) return;
initiator = pcec_message->content.msg.header >> 4;
follower = pcec_message->content.msg.header & 0x0f;
opcode = pcec_message->content.msg.opcode;
operand_num = pcec_message->operand_num;
brdcst = (follower == 0x0f);
msg_length = pcec_message->msg_length;
for (i = 0; i < operand_num; i++ ) {
operands[i] = pcec_message->content.msg.operands[i];
hdmi_print(INF, CEC ":operands[%d]:%u\n", i, operands[i]);
}
if(cec_global_info.cec_flag.cec_key_flag) {
input_event(cec_global_info.remote_cec_dev, EV_KEY, cec_key_map[operands[0]], 1);
input_sync(cec_global_info.remote_cec_dev);
hdmi_print(INF, CEC ":key map:%d\n",cec_key_map[operands[0]]);
}
else{
input_event(cec_global_info.remote_cec_dev, EV_KEY, cec_key_map[operands[0]], 0);
input_sync(cec_global_info.remote_cec_dev);
hdmi_print(INF, CEC ":key map:%d\n",cec_key_map[operands[0]]);
}
}
void cec_send_event_irq(void)
{
int i;
unsigned char operand_num_irq;
unsigned char operands_irq[14];
operand_num_irq = cec_global_info.cec_rx_msg_buf.cec_rx_message[cec_global_info.cec_rx_msg_buf.rx_write_pos].operand_num;
for (i = 0; i < operand_num_irq; i++ )
{
operands_irq[i] = cec_global_info.cec_rx_msg_buf.cec_rx_message[cec_global_info.cec_rx_msg_buf.rx_write_pos].content.msg.operands[i];
hdmi_print(INF, CEC ":operands_irq[%d]:0x%x\n", i, operands_irq[i]);
}
switch(cec_global_info.cec_rx_msg_buf.cec_rx_message[cec_global_info.cec_rx_msg_buf.rx_write_pos].content.msg.operands[0]){
case 0x33:
//cec_system_audio_mode_request();
//cec_set_system_audio_mode();
break;
case 0x35:
break;
default:
break;
}
input_event(cec_global_info.remote_cec_dev, EV_KEY, cec_key_map[operands_irq[0]], 1);
input_sync(cec_global_info.remote_cec_dev);
input_event(cec_global_info.remote_cec_dev, EV_KEY, cec_key_map[operands_irq[0]], 0);
input_sync(cec_global_info.remote_cec_dev);
hdmi_print(INF, CEC ":key map:%d\n",cec_key_map[operands_irq[0]]);
}
void cec_user_control_pressed_irq(void)
{
hdmi_print(INF, CEC ": Key pressed \n");
cec_send_event_irq();
}
void cec_user_control_released_irq(void)
{
hdmi_print(INF, CEC ": Key released \n");
}
void cec_user_control_pressed(cec_rx_message_t* pcec_message)
{
hdmi_print(INF, CEC ": Key pressed \n");
cec_global_info.cec_flag.cec_key_flag = 1;
cec_send_event(pcec_message);
}
void cec_user_control_released(cec_rx_message_t* pcec_message)
{
hdmi_print(INF, CEC ": Key released \n");
cec_global_info.cec_flag.cec_key_flag = 1;
cec_send_event(pcec_message);
}
/*
* STANDBY: get STANDBY command from TV
*/
void cec_standby(cec_rx_message_t* pcec_message)
{
if(hdmitx_device->cec_func_config & (1 << CEC_FUNC_MSAK)) {
if(hdmitx_device->cec_func_config & (1 << ONE_TOUCH_STANDBY_MASK)) {
hdmi_print(INF, CEC ": System will be in standby mode\n");
input_event(cec_global_info.remote_cec_dev, EV_KEY, KEY_POWER, 1);
input_sync(cec_global_info.remote_cec_dev);
input_event(cec_global_info.remote_cec_dev, EV_KEY, KEY_POWER, 0);
input_sync(cec_global_info.remote_cec_dev);
cec_disable_irq();
}
}
}
void cec_key_init(void)
{
extern hdmitx_dev_t * get_hdmitx_device(void);
hdmitx_device = get_hdmitx_device();
}
|
#ifndef GENERATEIMAGE_H
#define GENERATEIMAGE_H
#include <QRgb>
#include <QImage>
#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
#include <libtorrent/bitfield.hpp>
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/torrent_status.hpp>
using libtorrent::bitfield;
using libtorrent::partial_piece_info;
using libtorrent::torrent_handle;
using libtorrent::torrent_info;
using std::vector;
class GenerateImage: public QWidget
{
public:
GenerateImage(const torrent_handle &h);
static QImage generate(const bitfield &b, const vector<partial_piece_info> &v);\
protected:
void paintEvent(QPaintEvent *);
private:
torrent_handle torrent;
};
#endif // GENERATEIMAGE_H
|
#ifndef _NAOMIGD_H_
#define _NAOMIGD_H_
#include "naomibd.h"
#define MCFG_NAOMI_GDROM_BOARD_ADD(_tag, _image_tag, _pic_tag, _eeprom_tag, _maincpu_tag, _irq_cb) \
MCFG_NAOMI_BOARD_ADD(_tag, NAOMI_GDROM_BOARD, _eeprom_tag, _maincpu_tag, _irq_cb) \
naomi_gdrom_board::static_set_tags(*device, _image_tag, _pic_tag);
class naomi_gdrom_board : public naomi_board
{
public:
naomi_gdrom_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
static void static_set_tags(device_t &device, const char *_image_tag, const char *_pic_tag);
protected:
virtual void device_start();
virtual void device_reset();
virtual void board_setup_address(UINT32 address, bool is_dma);
virtual void board_get_buffer(UINT8 *&base, UINT32 &limit);
virtual void board_advance(UINT32 size);
private:
enum { FILENAME_LENGTH=24 };
const char *image_tag, *pic_tag;
UINT32 dimm_cur_address;
// Note: voluntarily not saved into the state
UINT8 *dimm_data;
UINT32 dimm_data_size;
static const UINT32 DES_LEFTSWAP[];
static const UINT32 DES_RIGHTSWAP[];
static const UINT32 DES_SBOX1[];
static const UINT32 DES_SBOX2[];
static const UINT32 DES_SBOX3[];
static const UINT32 DES_SBOX4[];
static const UINT32 DES_SBOX5[];
static const UINT32 DES_SBOX6[];
static const UINT32 DES_SBOX7[];
static const UINT32 DES_SBOX8[];
static const UINT32 DES_MASK_TABLE[];
static const UINT8 DES_ROTATE_TABLE[16];
void find_file(const char *name, const UINT8 *dir_sector, UINT32 &file_start, UINT32 &file_size);
inline void permutate(UINT32 &a, UINT32 &b, UINT32 m, int shift);
void des_generate_subkeys(const UINT64 key, UINT32 *subkeys);
UINT64 des_encrypt_decrypt(bool decrypt, UINT64 src, const UINT32 *des_subkeys);
UINT64 rev64(UINT64 src);
UINT64 read_to_qword(const UINT8 *region);
void write_from_qword(UINT8 *region, UINT64 qword);
};
extern const device_type NAOMI_GDROM_BOARD;
#endif
|
//
// Copyright (C) 2006-2011 Christoph Sommer <christoph.sommer@uibk.ac.at>
//
// Documentation for these modules is at http://veins.car2x.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.
//
// 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 TraCIGSRSU11p_H
#define TraCIGSRSU11p_H
#include "veins/modules/application/ieee80211p/BaseWaveApplLayer.h"
#include "veins/modules/world/annotations/AnnotationManager.h"
using Veins::AnnotationManager;
typedef std::vector<int> PrefList;
typedef std::map<int, PrefList> PrefMap;
typedef std::multimap<int, int> Matching;
/**
* Small RSU Demo using 11p
*/
class TraCIGSRSU11p : public BaseWaveApplLayer {
public:
class Statistics {
public:
double numCH;
double numON;
double numFN;
double meanCluster;
double sigmaCluster;
double CHutility;
double meanCHutility;
double sigmaCHutility;
double diffCHutility;
double meandiffCHutility;
double sigmadiffCHutility;
double expCHutility;
double meanexpCHutility;
double sigmaexpCHutility;
void initialize();
void recordScalars(cSimpleModule& module);
};
virtual void initialize(int stage);
enum WaveApplMessageKinds {
SERVICE_PROVIDER = LAST_BASE_APPL_MESSAGE_KIND,
SEND_BEACON_EVT,
SEND_MATCH
};
protected:
Statistics statistics;
AnnotationManager* annotations;
BaseMobility* mobi;
bool sentMessage;
cMessage* startMatching;
//create the maps of Preference lists
PrefMap PrefCHLists;
PrefMap PrefONLists;
Matching Matched;
std::map<int, Coord> nodesCoord;
std::map<int, int> CHcapacity;
protected:
virtual void onBeacon(WaveShortMessage* wsm);
virtual void onData(WaveShortMessage* wsm);
void sendMessage(std::string blockedRoadId);
virtual void sendWSM(WaveShortMessage* wsm);
virtual void handleLowerMsg(cMessage* msg);
virtual void handleSelfMsg(cMessage* msg);
void onPreferenceList(WaveShortMessage* data);
void launchMatching();
double calcUtility(double sqrD);
void orgStatistic();
};
#endif
|
/* -*- c++ -*- */
/*
* Copyright 2004 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 2, 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* HSR - MOBKOM LABOR
* Semesterarbeit GnuRadio Contributions
* U. Schaufelberger and R. Gaensli
*
* Written by : Ronnie Gaensli
* Created: 2005/05
*
*/
#ifndef INCLUDED_gr_rds_bpsk_demod_H
#define INCLUDED_gr_rds_bpsk_demod_H
#include <gr_block.h>
#include <iostream>
#include <fstream>
class gr_rds_bpsk_demod;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
*
* * C++ / Python system.
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*/
typedef boost::shared_ptr<gr_rds_bpsk_demod> gr_rds_bpsk_demod_sptr;
/*!
* \brief Return a shared_ptr to a new instance of gr_rds_bpsk_demod.
*
* To avoid accidental use of raw pointers, gr_rds_bpsk_demod's
* constructor is private. gr_rds_make_bpsk_demod is the public
* interface for creating new instances.
*/
gr_rds_bpsk_demod_sptr gr_rds_make_bpsk_demod (double input_sample_rate);
/*!
* \brief Decodes a biphase or manchester coded signal to 1, 0 as bool
* \ingroup RDS
*/
class gr_rds_bpsk_demod : public gr_block
{
private:
enum state_t { ST_LOOKING, ST_LOCKED };
state_t d_state;
int SYMBOL_LENGTH;
int d_zc; // Zero crosses in clk
int d_last_zc;
int d_sign_last;
float d_symbol_integrator;
unsigned int synccounter;
// The friend declaration allows gr_rds_make_bpsk_demod to
// access the private constructor.
friend gr_rds_bpsk_demod_sptr gr_rds_make_bpsk_demod (double input_sample_rate);
gr_rds_bpsk_demod (double input_samping_rate); // private constructor
void enter_looking();
void enter_locked();
public:
~gr_rds_bpsk_demod ();
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void reset();
};
#endif /* INCLUDED_gr_rds_bpsk_demod_H */
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2008 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 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 <config.h>
#include <gtk/gtk.h>
#include <gthumb.h>
#include "callbacks.h"
G_MODULE_EXPORT void
gthumb_extension_activate (void)
{
gth_hook_add_callback ("gth-catalog-load-from-data", 10, G_CALLBACK (search__gth_catalog_load_from_data_cb), NULL);
gth_hook_add_callback ("gth-catalog-new-for-uri", 10, G_CALLBACK (search__gth_catalog_new_for_uri_cb), NULL);
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (search__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-extra-widget", 20, G_CALLBACK (search__gth_browser_update_extra_widget_cb), NULL);
gth_hook_add_callback ("gth-browser-load-location-before", 10, G_CALLBACK (search__gth_browser_load_location_before_cb), NULL);
gth_hook_add_callback ("dlg-catalog-properties", 10, G_CALLBACK (search__dlg_catalog_properties), NULL);
gth_hook_add_callback ("dlg-catalog-properties-save", 10, G_CALLBACK (search__dlg_catalog_properties_save), NULL);
gth_hook_add_callback ("dlg-catalog-properties-saved", 10, G_CALLBACK (search__dlg_catalog_properties_saved), NULL);
gth_hook_add_callback ("gth-organize-task-create-catalog", 10, G_CALLBACK (search__gth_organize_task_create_catalog), NULL);
}
G_MODULE_EXPORT void
gthumb_extension_deactivate (void)
{
}
G_MODULE_EXPORT gboolean
gthumb_extension_is_configurable (void)
{
return FALSE;
}
G_MODULE_EXPORT void
gthumb_extension_configure (GtkWindow *parent)
{
}
|
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSCREENDRIVERPLUGIN_QWS_H
#define QSCREENDRIVERPLUGIN_QWS_H
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#ifndef QT_NO_LIBRARY
class QScreen;
struct Q_GUI_EXPORT QScreenDriverFactoryInterface : public QFactoryInterface
{
virtual QScreen* create(const QString& driver, int displayId) = 0;
};
#define QScreenDriverFactoryInterface_iid "com.trolltech.Qt.QScreenDriverFactoryInterface"
Q_DECLARE_INTERFACE(QScreenDriverFactoryInterface, QScreenDriverFactoryInterface_iid)
class Q_GUI_EXPORT QScreenDriverPlugin : public QObject, public QScreenDriverFactoryInterface
{
Q_OBJECT
Q_INTERFACES(QScreenDriverFactoryInterface:QFactoryInterface)
public:
explicit QScreenDriverPlugin(QObject *parent = 0);
~QScreenDriverPlugin();
virtual QStringList keys() const = 0;
virtual QScreen *create(const QString& driver, int displayId) = 0;
};
#endif // QT_NO_LIBRARY
QT_END_NAMESPACE
QT_END_HEADER
#endif // QSCREENDRIVERPLUGIN_QWS_H
|
/*
* Copyright (c) 2013 Andrew Mortensen
* All rights reserved. See LICENSE.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "duo_cosign_cfg.h"
extern int errno;
char *
dc_get_cfg_path( void )
{
char *path = NULL;
path = getenv( DC_CFG_PATH_ENV_NAME );
if ( path == NULL ) {
path = DC_CFG_PATH_DEFAULT;
}
return( path );
}
int
dc_cfg_read( char *cfg_path, dc_cfg_entry_t **cfg_list )
{
FILE *cfg_f;
dc_cfg_entry_t *cfg_ent, **cur_ent;
char linebuf[ LINE_MAX ];
char *line;
size_t idx, i;
int len, linenum = 0;
int rc = -1;
assert( cfg_path != NULL );
assert( cfg_list != NULL );
*cfg_list = NULL;
cfg_f = fopen( cfg_path, "r" );
if ( cfg_f == NULL ) {
fprintf( stderr, "dc_cfg_read: fopen %s: %s\n",
cfg_path, strerror( errno ));
goto done;
}
while ( fgets( linebuf, sizeof( linebuf ), cfg_f ) != NULL ) {
linenum++;
line = linebuf;
while( isspace( *line )) {
line++;
}
if ( *line == '#' || *line == '\0' ) {
continue;
}
if ( memcmp( line, DC_CFG_LINE_FS, strlen( DC_CFG_LINE_FS )) == 0 ) {
fprintf( stderr, "dc_cfg_read: %s line %d: "
"invalid config line: missing key\n",
cfg_path, linenum );
continue;
}
len = strlen( line );
if ( line[ len - 1 ] != '\n' ) {
fprintf( stderr, "dc_cfg_read: %s line %d: line too long\n",
cfg_path, linenum );
goto done;
}
line[ len - 1 ] = '\0';
idx = strcspn( line, DC_CFG_LINE_FS );
if ( idx == 0 ) {
fprintf( stderr, "dc_cfg_read: %s line %d: invalid config line\n",
cfg_path, linenum );
goto done;
}
if ( line[ idx + 1 ] == '\0' ) {
fprintf( stderr, "dc_cfg_read: %s line %d: invalid config line\n",
cfg_path, linenum );
goto done;
}
for ( i = (idx - 1); i > 0 && isspace( line[ i ] ); i-- ) {
;
}
cfg_ent = (dc_cfg_entry_t *)malloc( sizeof( dc_cfg_entry_t ));
if ( cfg_ent == NULL ) {
fprintf( stderr, "dc_cfg_read: %s line %d: failed to allocate "
"config entry: %s\n", cfg_path, linenum,
strerror( errno ));
goto done;
}
memset( cfg_ent, 0, sizeof( dc_cfg_entry_t ));
cfg_ent->key = (char *)malloc( i + 1 );
if ( cfg_ent->key == NULL ) {
fprintf( stderr, "dc_cfg_read: %s line %d: malloc config "
"entry key failed: %s\n", cfg_path, linenum,
strerror( errno ));
goto done;
}
memcpy( cfg_ent->key, line, i + 1 );
cfg_ent->key[ i + 1 ] = '\0';
idx++;
while ( isspace( line[ idx ] )) {
idx++;
}
cfg_ent->val = (char *)malloc(( len - idx ) + 1 );
if ( cfg_ent->val == NULL ) {
fprintf( stderr, "dc_cfg_read: %s line %d: malloc config "
"entry value failed: %s\n", cfg_path, linenum,
strerror( errno ));
goto done;
}
memcpy( cfg_ent->val, &line[ idx ], len - idx );
cfg_ent->val[ len - idx ] = '\0';
for ( cur_ent = cfg_list;
*cur_ent != NULL;
cur_ent = &(*cur_ent)->next ) {
;
}
cfg_ent->next = *cur_ent;
*cur_ent = cfg_ent;
}
rc = linenum;
done:
return( rc );
}
char *
dc_cfg_value_for_key( dc_cfg_entry_t *cfg_list, char *key )
{
char *value = NULL;
for ( ; cfg_list != NULL; cfg_list = cfg_list->next ) {
if ( strcmp( key, cfg_list->key ) == 0 ) {
value = cfg_list->val;
}
}
return( value );
}
void
dc_cfg_print( dc_cfg_entry_t *cfg_list )
{
for ( ; cfg_list != NULL; cfg_list = cfg_list->next ) {
printf( "%s => %s\n", cfg_list->key, cfg_list->val );
}
}
void
dc_cfg_free( dc_cfg_entry_t **cfg_list )
{
dc_cfg_entry_t *cur_ent, *tmp;
assert( cfg_list != NULL );
for ( cur_ent = *cfg_list; cur_ent != NULL; cur_ent = tmp ) {
tmp = cur_ent->next;
free( cur_ent->key );
free( cur_ent->val );
free( cur_ent );
}
*cfg_list = NULL;
}
#ifdef notdef
int
main( int ac, char *av[] )
{
dc_cfg_entry_t *cfg_list = NULL;
char *v;
if ( ac != 2 ) {
exit( 1 );
}
dc_cfg_read( av[ 1 ], &cfg_list );
dc_cfg_print( cfg_list );
v = dc_cfg_value_for_key( cfg_list, "identikit" );
if ( v ) {
printf( "VALUE: %s\n", v );
}
v = dc_cfg_value_for_key( cfg_list, "har har har" );
if ( v ) {
printf( "VALUE: %s\n", v );
}
dc_cfg_free( &cfg_list );
return( 0 );
}
#endif /* notdef */
|
/*
* NET Generic infrastructure for INET6 connection oriented protocols.
*
* Authors: Many people, see the TCPv6 sources
*
* From code originally in TCPv6
*
* 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 _INET6_CONNECTION_SOCK_H
#define _INET6_CONNECTION_SOCK_H
#include <linux/types.h>
struct in6_addr;
struct inet_bind_bucket;
struct request_sock;
struct sk_buff;
struct sock;
struct sockaddr;
extern int inet6_csk_bind_conflict(const struct sock *sk,
const struct inet_bind_bucket *tb, bool relax);
extern u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport,
const u32 rnd, const u32 synq_hsize);
extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
const struct request_sock *req);
extern struct request_sock *inet6_csk_search_req(const struct sock *sk,
struct request_sock ***prevp,
const __be16 rport,
const struct in6_addr *raddr,
const struct in6_addr *laddr,
const int iif);
extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
struct request_sock *req,
const unsigned long timeout);
extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl);
#endif /* _INET6_CONNECTION_SOCK_H */
|
#ifndef BLUETOOTH_H
#define BLUETOOTH_H
boolean BtDataComplete = false; // whether the string is complete
char bt_packet[20];
int serialCount = 0;
const static char* getPIDValues = "GP;";
const static char* getSettings = "GS;";
const static char* getInfo = "GI;";
const static char* getKalman = "GK;";
const static char* setPValue = "SP,";
const static char* setIValue = "SI,";
const static char* setDValue = "SD,";
const static char* setKalman = "SK,";
const static char* setTargetAngle = "ST,";
const static char* setMaxAngle = "SA,";
const static char* setMaxTurning = "SU,";
const static char* setBackToSpot = "SB,";
const static char* imuBegin = "IB;";
const static char* imuStop = "IS;";
const static char* statusBegin = "RB;";
const static char* statusStop = "RS;";
const static char* sendStop = "CS;";
const static char* sendIMUValues = "CM,";
const static char* sendJoystickValues = "CJ,";
const static char* sendPairWithWii = "CPW;";
const static char* sendPairWithPS4 = "CPP;";
const static char* restoreDefaultValues = "CR;";
const static char* responsePIDValues = "P";
const static char* responseKalmanValues = "K";
const static char* responseSettings = "S";
const static char* responseInfo = "I";
const static char* responseIMU = "V";
const static char* responseStatus = "R";
const static char* responsePairConfirmation = "PC";
const static int HEADER_LEN = 3;
float bt_pitch = 0;
float bt_yaw_rate = 0;
void bluetooth_clear()
{
memset(&bt_packet[0], 0, sizeof(bt_packet));
serialCount = 0;
BtDataComplete = false;
}
void decode_pitch_yaw(float pitch_yaw[], int size)
{
int j=0;
int k=0;
char float_buf[14];
for (int i=HEADER_LEN;i<serialCount;i++)
{
if ((bt_packet[i] != ',') && (bt_packet[i] !=';'))
{
float_buf[j++] = bt_packet[i];
}
else{
float_buf[j] = '\0';
if (k < size){
pitch_yaw[k] = atof(float_buf);
// Serial.println(pitch_yaw[k]);
k++;
memset(&float_buf[0], 0, sizeof(float_buf));
j = 0;
}
else{
return;
}
}
}
}
void processBluetooth()
{
while (Bluetooth.available()) {
// get the new byte:
char inChar = (char)Bluetooth.read();
bt_packet[serialCount++] = inChar;
if (inChar == ';') {
BtDataComplete = true;
}
}
if (BtDataComplete) {
// for (int i=0;i<serialCount;i++)
// Serial.print(bt_packet[i]);
// Serial.println(serialCount);
char header[HEADER_LEN+1];
if (serialCount < HEADER_LEN){
bluetooth_clear();
return;
}
for (int i=0;i<HEADER_LEN;i++)
{
header[i] = bt_packet[i];
}
header[HEADER_LEN] = '\0';
//classify by header
if (strcmp(header, sendStop) == 0)
{
// Serial.println("stop");
bt_pitch = 0;
bt_yaw_rate = 0;
}
if (strcmp(header, sendJoystickValues) == 0)
{
//Serial.println("joystick");
float pitch_yaw[2] = {0};
decode_pitch_yaw(pitch_yaw, 2);
bt_pitch = pitch_yaw[1]*MAX_PITCH;
bt_yaw_rate = pitch_yaw[0]*MAX_YAW_RATE;
}
if (strcmp(header, sendIMUValues) == 0)
{
//Serial.println("imu");
float pitch_yaw[2]={0};
decode_pitch_yaw(pitch_yaw, 2);
const static float MAX_PHONE_ANGLE = 45.0f;
pitch_yaw[0] = constrain(pitch_yaw[0], -MAX_PHONE_ANGLE, MAX_PHONE_ANGLE);
pitch_yaw[1] = constrain(pitch_yaw[1], -MAX_PHONE_ANGLE, MAX_PHONE_ANGLE);
applyDeadband(pitch_yaw[0], 5.0f);
applyDeadband(pitch_yaw[1], 5.0f);
bt_pitch = pitch_yaw[0]/MAX_PHONE_ANGLE*MAX_PITCH;
bt_yaw_rate = pitch_yaw[1]/MAX_PHONE_ANGLE*MAX_YAW_RATE;
}
}
bluetooth_clear();
}
#endif /* BLUETOOTH_H */
|
/*
* linux/include/asm-arm/arch-versatile/time.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <asm/system.h>
#include <asm/leds.h>
/*
* Where is the timer (VA)?
*/
#define TIMER0_VA_BASE IO_ADDRESS(VERSATILE_TIMER0_1_BASE)
#define TIMER1_VA_BASE (IO_ADDRESS(VERSATILE_TIMER0_1_BASE) + 0x20)
#define TIMER2_VA_BASE IO_ADDRESS(VERSATILE_TIMER2_3_BASE)
#define TIMER3_VA_BASE (IO_ADDRESS(VERSATILE_TIMER2_3_BASE) + 0x20)
#define VA_IC_BASE IO_ADDRESS(VERSATILE_VIC_BASE)
/*
* How long is the timer interval?
*/
#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10)
#if TIMER_INTERVAL >= 0x100000
#define TIMER_RELOAD (TIMER_INTERVAL >> 8) /* Divide by 256 */
#define TIMER_CTRL 0x88 /* Enable, Clock / 256 */
#define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC)
#elif TIMER_INTERVAL >= 0x10000
#define TIMER_RELOAD (TIMER_INTERVAL >> 4) /* Divide by 16 */
#define TIMER_CTRL 0x84 /* Enable, Clock / 16 */
#define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC)
#else
#define TIMER_RELOAD (TIMER_INTERVAL)
#define TIMER_CTRL 0x80 /* Enable */
#define TICKS2USECS(x) ((x) / TICKS_PER_uSEC)
#endif
#define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable */
/*
* What does it look like?
*/
typedef struct TimerStruct {
unsigned long TimerLoad;
unsigned long TimerValue;
unsigned long TimerControl;
unsigned long TimerClear;
} TimerStruct_t;
extern unsigned long (*gettimeoffset)(void);
/*
* Returns number of ms since last clock interrupt. Note that interrupts
* will have been disabled by do_gettimeoffset()
*/
static unsigned long versatile_gettimeoffset(void)
{
volatile TimerStruct_t *timer0 = (TimerStruct_t *)TIMER0_VA_BASE;
unsigned long ticks1, ticks2, status;
/*
* Get the current number of ticks. Note that there is a race
* condition between us reading the timer and checking for
* an interrupt. We get around this by ensuring that the
* counter has not reloaded between our two reads.
*/
ticks2 = timer0->TimerValue & 0xffff;
do {
ticks1 = ticks2;
status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS);
ticks2 = timer0->TimerValue & 0xffff;
} while (ticks2 > ticks1);
/*
* Number of ticks since last interrupt.
*/
ticks1 = TIMER_RELOAD - ticks2;
/*
* Interrupt pending? If so, we've reloaded once already.
*
* FIXME: Need to check this is effectively timer 0 that expires
*/
if (status & IRQMASK_TIMERINT0_1)
ticks1 += TIMER_RELOAD;
/*
* Convert the ticks to usecs
*/
return TICKS2USECS(ticks1);
}
/*
* IRQ handler for the timer
*/
static irqreturn_t versatile_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE;
// ...clear the interrupt
timer0->TimerClear = 1;
do_leds();
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED;
}
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init time_init(void)
{
volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE;
volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE;
volatile TimerStruct_t *timer2 = (volatile TimerStruct_t *)TIMER2_VA_BASE;
volatile TimerStruct_t *timer3 = (volatile TimerStruct_t *)TIMER3_VA_BASE;
/*
* set clock frequency:
* VERSATILE_REFCLK is 32KHz
* VERSATILE_TIMCLK is 1MHz
*/
*(volatile unsigned int *)IO_ADDRESS(VERSATILE_SCTL_BASE) |=
((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
(VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) | (VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel));
timer_irq.handler = versatile_timer_interrupt;
/*
* Initialise to a known state (all timers off)
*/
timer0->TimerControl = 0;
timer1->TimerControl = 0;
timer2->TimerControl = 0;
timer3->TimerControl = 0;
timer0->TimerLoad = TIMER_RELOAD;
timer0->TimerValue = TIMER_RELOAD;
timer0->TimerControl = TIMER_CTRL | 0x40 | TIMER_CTRL_IE; /* periodic + IE */
/*
* Make irqs happen for the system timer
*/
setup_irq(IRQ_TIMERINT0_1, &timer_irq);
gettimeoffset = versatile_gettimeoffset;
}
|
/*
* $Id: iq80310.c 573 2006-02-20 17:09:11Z stsp2 $
*
* Mapping for the Intel XScale IQ80310 evaluation board
*
* Author: Nicolas Pitre
* Copyright: (C) 2001 MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#define WINDOW_ADDR 0
#define WINDOW_SIZE 8*1024*1024
#define BUSWIDTH 1
static struct mtd_info *mymtd;
static struct map_info iq80310_map = {
.name = "IQ80310 flash",
.size = WINDOW_SIZE,
.bankwidth = BUSWIDTH,
.phys = WINDOW_ADDR
};
static struct mtd_partition iq80310_partitions[4] = {
{
.name = "Firmware",
.size = 0x00080000,
.offset = 0,
.mask_flags = MTD_WRITEABLE /* force read-only */
},{
.name = "Kernel",
.size = 0x000a0000,
.offset = 0x00080000,
},{
.name = "Filesystem",
.size = 0x00600000,
.offset = 0x00120000
},{
.name = "RedBoot",
.size = 0x000e0000,
.offset = 0x00720000,
.mask_flags = MTD_WRITEABLE
}
};
static struct mtd_info *mymtd;
static struct mtd_partition *parsed_parts;
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
static int __init init_iq80310(void)
{
struct mtd_partition *parts;
int nb_parts = 0;
int parsed_nr_parts = 0;
int ret;
iq80310_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
if (!iq80310_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
simple_map_init(&iq80310_map);
mymtd = do_map_probe("cfi_probe", &iq80310_map);
if (!mymtd) {
iounmap((void *)iq80310_map.virt);
return -ENXIO;
}
mymtd->owner = THIS_MODULE;
ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
if (ret > 0)
parsed_nr_parts = ret;
if (parsed_nr_parts > 0) {
parts = parsed_parts;
nb_parts = parsed_nr_parts;
} else {
parts = iq80310_partitions;
nb_parts = ARRAY_SIZE(iq80310_partitions);
}
add_mtd_partitions(mymtd, parts, nb_parts);
return 0;
}
static void __exit cleanup_iq80310(void)
{
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
if (parsed_parts)
kfree(parsed_parts);
}
if (iq80310_map.virt)
iounmap((void *)iq80310_map.virt);
}
module_init(init_iq80310);
module_exit(cleanup_iq80310);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
MODULE_DESCRIPTION("MTD map driver for Intel XScale IQ80310 evaluation board");
|
/*
* linux/arch/arm/mach-omap1/timer32k.c
*
* OMAP 32K Timer
*
* Copyright (C) 2004 - 2005 Nokia Corporation
* Partial timer rewrite and additional dynamic tick timer support by
* Tony Lindgen <tony@atomide.com> and
* Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
* OMAP Dual-mode timer framework support by Timo Teras
*
* MPU timer code based on the older MPU timer code for OMAP
* Copyright (C) 2000 RidgeRun, Inc.
* Author: Greg Lonnon <glonnon@ridgerun.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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/init.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/io.h>
#include <asm/leds.h>
#include <asm/irq.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
#include <plat/dmtimer.h>
#include <mach/hardware.h>
#include "common.h"
/*
* ---------------------------------------------------------------------------
* 32KHz OS timer
*
* This currently works only on 16xx, as 1510 does not have the continuous
* 32KHz synchronous timer. The 32KHz synchronous timer is used to keep track
* of time in addition to the 32KHz OS timer. Using only the 32KHz OS timer
* on 1510 would be possible, but the timer would not be as accurate as
* with the 32KHz synchronized timer.
* ---------------------------------------------------------------------------
*/
/* 16xx specific defines */
#define OMAP1_32K_TIMER_BASE 0xfffb9000
#define OMAP1_32K_TIMER_CR 0x08
#define OMAP1_32K_TIMER_TVR 0x00
#define OMAP1_32K_TIMER_TCR 0x04
#define OMAP_32K_TICKS_PER_SEC (32768)
/*
* TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
* so with HZ = 128, TVR = 255.
*/
#define OMAP_32K_TIMER_TICK_PERIOD ((OMAP_32K_TICKS_PER_SEC / HZ) - 1)
#define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate) \
(((nr_jiffies) * (clock_rate)) / HZ)
static inline void omap_32k_timer_write(int val, int reg)
{
omap_writew(val, OMAP1_32K_TIMER_BASE + reg);
}
static inline unsigned long omap_32k_timer_read(int reg)
{
return omap_readl(OMAP1_32K_TIMER_BASE + reg) & 0xffffff;
}
static inline void omap_32k_timer_start(unsigned long load_val)
{
if (!load_val)
load_val = 1;
omap_32k_timer_write(load_val, OMAP1_32K_TIMER_TVR);
omap_32k_timer_write(0x0f, OMAP1_32K_TIMER_CR);
}
static inline void omap_32k_timer_stop(void)
{
omap_32k_timer_write(0x0, OMAP1_32K_TIMER_CR);
}
#define omap_32k_timer_ack_irq()
static int omap_32k_timer_set_next_event(unsigned long delta,
struct clock_event_device *dev)
{
omap_32k_timer_start(delta);
return 0;
}
static void omap_32k_timer_set_mode(enum clock_event_mode mode,
struct clock_event_device *evt)
{
omap_32k_timer_stop();
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD);
break;
case CLOCK_EVT_MODE_ONESHOT:
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
break;
case CLOCK_EVT_MODE_RESUME:
break;
}
}
static struct clock_event_device clockevent_32k_timer = {
.name = "32k-timer",
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.shift = 32,
.set_next_event = omap_32k_timer_set_next_event,
.set_mode = omap_32k_timer_set_mode,
};
static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *evt = &clockevent_32k_timer;
omap_32k_timer_ack_irq();
evt->event_handler(evt);
return IRQ_HANDLED;
}
static struct irqaction omap_32k_timer_irq = {
.name = "32KHz timer",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = omap_32k_timer_interrupt,
};
static __init void omap_init_32k_timer(void)
{
setup_irq(INT_OS_TIMER, &omap_32k_timer_irq);
clockevent_32k_timer.mult = div_sc(OMAP_32K_TICKS_PER_SEC,
NSEC_PER_SEC,
clockevent_32k_timer.shift);
clockevent_32k_timer.max_delta_ns =
clockevent_delta2ns(0xfffffffe, &clockevent_32k_timer);
clockevent_32k_timer.min_delta_ns =
clockevent_delta2ns(1, &clockevent_32k_timer);
clockevent_32k_timer.cpumask = cpumask_of(0);
clockevents_register_device(&clockevent_32k_timer);
}
/*
* ---------------------------------------------------------------------------
* Timer initialization
* ---------------------------------------------------------------------------
*/
bool __init omap_32k_timer_init(void)
{
omap_init_clocksource_32k();
omap_init_32k_timer();
return true;
}
|
/*
* Copyright (C) 2003 Robert Kooima
*
* NEVERBALL 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.
*/
#ifndef VEC_H
#define VEC_H
#include <math.h>
#define V_PI 3.1415927f
#define V_RAD(d) (d * V_PI / 180.f)
#define V_DEG(r) (r * 180.f / V_PI)
#define fsinf(a) ((float) sin((double) a))
#define fcosf(a) ((float) cos((double) a))
#define ftanf(a) ((float) tan((double) a))
#define fabsf(a) ((float) fabs((double) a))
#define fsqrtf(a) ((float) sqrt((double) a))
#define fpowf(x,y) ((float) pow((double) x, (double) y))
#define fasinf(a) ((float) asin((double) a))
#define facosf(a) ((float) acos((double) a))
#define fmodf(x,y) ((float) fmod((double) x, (double) y))
#define fatan2f(x, y) ((float) atan2((double) x, (double) y))
/*---------------------------------------------------------------------------*/
#define v_dot(u, v) ((u)[0] * (v)[0] + (u)[1] * (v)[1] + (u)[2] * (v)[2])
#define v_len(u) fsqrtf(v_dot(u, u))
#define v_cpy(u, v) do { \
(u)[0] = (v)[0]; \
(u)[1] = (v)[1]; \
(u)[2] = (v)[2]; \
} while (0)
#define v_inv(u, v) do { \
(u)[0] = -(v)[0]; \
(u)[1] = -(v)[1]; \
(u)[2] = -(v)[2]; \
} while (0)
#define v_scl(u, v, k) do { \
(u)[0] = (v)[0] * (k); \
(u)[1] = (v)[1] * (k); \
(u)[2] = (v)[2] * (k); \
} while (0)
#define v_add(u, v, w) do { \
(u)[0] = (v)[0] + (w)[0]; \
(u)[1] = (v)[1] + (w)[1]; \
(u)[2] = (v)[2] + (w)[2]; \
} while (0)
#define v_sub(u, v, w) do { \
(u)[0] = (v)[0] - (w)[0]; \
(u)[1] = (v)[1] - (w)[1]; \
(u)[2] = (v)[2] - (w)[2]; \
} while (0)
#define v_mid(u, v, w) do { \
(u)[0] = ((v)[0] + (w)[0]) / 2.f; \
(u)[1] = ((v)[1] + (w)[1]) / 2.f; \
(u)[2] = ((v)[2] + (w)[2]) / 2.f; \
} while (0)
#define v_mad(u, p, v, t) do { \
(u)[0] = (p)[0] + (v)[0] * (t); \
(u)[1] = (p)[1] + (v)[1] * (t); \
(u)[2] = (p)[2] + (v)[2] * (t); \
} while (0)
#define v_lerp(u, v, w, a) do { \
(u)[0] = (v)[0] * (1.0f - (a)) + (w)[0] * (a); \
(u)[1] = (v)[1] * (1.0f - (a)) + (w)[1] * (a); \
(u)[2] = (v)[2] * (1.0f - (a)) + (w)[2] * (a); \
} while (0)
#define e_cpy(d, e) do { \
v_cpy((d)[0], (e)[0]); \
v_cpy((d)[1], (e)[1]); \
v_cpy((d)[2], (e)[2]); \
} while (0)
#define e_orthonrm(e) do { \
v_crs((e)[0], (e)[1], (e)[2]); \
v_crs((e)[2], (e)[0], (e)[1]); \
v_nrm((e)[0], (e)[0]); \
v_nrm((e)[1], (e)[1]); \
v_nrm((e)[2], (e)[2]); \
} while (0)
#define e_lerp(c, d, e, a) do { \
v_lerp((c)[0], (d)[0], (e)[0], a); \
v_lerp((c)[1], (d)[1], (e)[1], a); \
v_lerp((c)[2], (d)[2], (e)[2], a); \
e_orthonrm(c); \
} while (0)
/*---------------------------------------------------------------------------*/
void v_nrm(float *, const float *);
void v_crs(float *, const float *, const float *);
void m_cpy(float *, const float *);
void m_xps(float *, const float *);
int m_inv(float *, const float *);
void m_ident(float *);
void m_basis(float *, const float *,
const float *,
const float *);
void m_xlt(float *, const float *);
void m_scl(float *, const float *);
void m_rot(float *, const float *, float);
void m_mult(float *, const float *, const float *);
void m_pxfm(float *, const float *, const float *);
void m_vxfm(float *, const float *, const float *);
void m_view(float *, const float *,
const float *,
const float *);
/*---------------------------------------------------------------------------*/
#define q_dot(q, r) ((q)[0] * (r)[0] + v_dot((q) + 1, (r) + 1))
#define q_len(q) fsqrtf(q_dot((q), (q)))
#define q_cpy(q, r) do { \
(q)[0] = (r)[0]; \
(q)[1] = (r)[1]; \
(q)[2] = (r)[2]; \
(q)[3] = (r)[3]; \
} while (0)
#define q_conj(q, r) do { \
(q)[0] = (r)[0]; \
(q)[1] = -(r)[1]; \
(q)[2] = -(r)[2]; \
(q)[3] = -(r)[3]; \
} while (0)
void q_as_axisangle(const float q[4], float u[3], float *a);
void q_by_axisangle(float q[4], const float u[3], float a);
void q_nrm(float q[4], const float r[4]);
void q_mul(float q[4], const float a[4], const float b[4]);
void q_rot(float v[3], const float r[4], const float w[3]);
void q_euler(float v[3], const float q[4]);
void q_slerp(float q[4], const float a[4], const float b[4], float t);
#endif
|
/*
* arch/arm/mach-tegra/wdt-recovery.c
*
* Copyright (c) 2012, NVIDIA Corporation.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/suspend.h>
#include <linux/resource.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/syscore_ops.h>
#include <linux/io.h>
#include <asm/mach-types.h>
#include <asm/mach/time.h>
#include <asm/localtimer.h>
#include <linux/nvmap.h>
#include <mach/irqs.h>
#include <mach/iomap.h>
#include <mach/clk.h>
#include <mach/io.h>
/*static int wdt_heartbeat = 30;*/
#if defined(CONFIG_ARCH_TEGRA_3x_SOC)
#define TIMER_PTV 0
#define TIMER_EN (1 << 31)
#define TIMER_PERIODIC (1 << 30)
#define TIMER_PCR 0x4
#define TIMER_PCR_INTR (1 << 30)
#define WDT_CFG (0)
#define WDT_CFG_TMR_SRC (0 << 0) /* for TMR10. */
#define WDT_CFG_PERIOD (1 << 4)
#define WDT_CFG_INT_EN (1 << 12)
#define WDT_CFG_SYS_RST_EN (1 << 14)
#define WDT_CFG_PMC2CAR_RST_EN (1 << 15)
#define WDT_CMD (8)
#define WDT_CMD_START_COUNTER (1 << 0)
#define WDT_CMD_DISABLE_COUNTER (1 << 1)
#define WDT_UNLOCK (0xC)
#define WDT_UNLOCK_PATTERN (0xC45A << 0)
static void __iomem *wdt_timer = IO_ADDRESS(TEGRA_TMR10_BASE);
static void __iomem *wdt_source = IO_ADDRESS(TEGRA_WDT3_BASE);
static void tegra_wdt_reset_enable(void)
{
u32 val;
writel(TIMER_PCR_INTR, wdt_timer + TIMER_PCR);
val = (wdt_heartbeat * 1000000ul) / 4;
val |= (TIMER_EN | TIMER_PERIODIC);
writel(val, wdt_timer + TIMER_PTV);
val = WDT_CFG_TMR_SRC | WDT_CFG_PERIOD | /*WDT_CFG_INT_EN |*/
/*WDT_CFG_SYS_RST_EN |*/ WDT_CFG_PMC2CAR_RST_EN;
writel(val, wdt_source + WDT_CFG);
writel(WDT_CMD_START_COUNTER, wdt_source + WDT_CMD);
pr_info("%s: WDT Recovery Enabled\n", __func__);
}
static int tegra_wdt_reset_disable(void)
{
writel(TIMER_PCR_INTR, wdt_timer + TIMER_PCR);
writel(WDT_UNLOCK_PATTERN, wdt_source + WDT_UNLOCK);
writel(WDT_CMD_DISABLE_COUNTER, wdt_source + WDT_CMD);
writel(0, wdt_timer + TIMER_PTV);
pr_info("%s: WDT Recovery Disabled\n", __func__);
return 0;
}
#elif defined(CONFIG_ARCH_TEGRA_2x_SOC)
static void tegra_wdt_reset_enable(void)
{
}
static int tegra_wdt_reset_disable(void)
{
return 0;
}
#endif
static int tegra_pm_notify(struct notifier_block *nb,
unsigned long event, void *nouse)
{
switch (event) {
case PM_SUSPEND_PREPARE:
tegra_wdt_reset_enable();
break;
case PM_POST_SUSPEND:
tegra_wdt_reset_disable();
break;
}
return NOTIFY_OK;
}
static struct notifier_block tegra_wdt_notify = {
.notifier_call = tegra_pm_notify,
};
static struct syscore_ops tegra_wdt_syscore_ops = {
.suspend = tegra_wdt_reset_disable,
.resume = tegra_wdt_reset_enable,
};
void __init tegra_wdt_recovery_init(void)
{
#ifdef CONFIG_PM
/* Register PM notifier. */
register_pm_notifier(&tegra_wdt_notify);
#endif
register_syscore_ops(&tegra_wdt_syscore_ops);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.