text stringlengths 4 6.14k |
|---|
/* PR middle-end/48389 */
/* { dg-do compile } */
/* { dg-options "-O -mtune=pentiumpro -Wno-abi" } */
/* { dg-require-effective-target ilp32 } */
typedef float V2SF __attribute__ ((vector_size (128)));
V2SF foo (int x, V2SF a)
{
V2SF b = {};
if (x & 42)
b = a;
a += b;
return a;
}
|
/* Executor of MF code (for Push-Relabel) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <values.h>
/* statistic variables */
long n_push = 0; /* number of pushes */
long n_rel = 0; /* number of relabels */
long n_up = 0; /* number of updates */
long n_gap = 0; /* number of gaps */
long n_gnode = 0; /* number of nodes after gap */
float t, t2;
/* definitions of types: node & arc */
#include "types_pr.h"
/* parser for getting extended DIMACS format input and transforming the
data to the internal representation */
#include "parser_fl.c"
/* function 'timer()' for mesuring processor time */
#include "timer.c"
/* function for constructing maximal flow */
#include "m_prf.c"
main ( argc, argv )
int argc;
char *argv[];
{
arc *arp, *a;
long *cap;
node *ndp, *source, *sink, *i;
long n, m, nmin;
long ni, na;
double flow = 0;
int cc, prt;
prt = ( argc > 1 ) ? atoi( argv[1] ): 1;
#define N_NODE( i ) ( (i) - ndp + nmin )
#define N_ARC( a ) ( ( a == NULL )? -1 : (a) - arp )
printf("c\nc maxflow - push-relabel (highest level, no gaps)\nc\n");
parse( &n, &m, &ndp, &arp, &cap, &source, &sink, &nmin );
printf("c nodes: %10ld\nc arcs: %10ld\nc\n", n, m);
t = timer();
t2 = t;
cc = prflow ( n, ndp, arp, cap, source, sink, &flow );
t = timer() - t;
if ( cc ) { fprintf ( stderr, "Allocating error\n"); exit ( 1 ); }
printf ("c time: %10.2f\nc flow: %10.0lf\nc\n", t, flow );
printf ("c cut tm: %10.2f\n", t2);
if ( prt )
{
printf ("c pushes: %10ld\n", n_push);
printf ("c relabels: %10ld\n", n_rel);
printf ("c updates: %10ld\n", n_up);
printf ("c\n");
}
if ( prt > 1 )
{
printf ("s %.0lf\n", flow);
for ( i = ndp; i < ndp + n; i ++ )
{
ni = N_NODE(i);
for ( a = i -> first; a != NULL; a = a -> next )
{
na = N_ARC(a);
if ( cap[na] > 0 )
printf ( "f %7ld %7ld %12ld\n",
ni, N_NODE( a -> head ), cap[na] - ( a -> r_cap )
);
}
}
printf("c\n");
}
}
|
#include <system/allocator.h>
#include <system/log.h>
#include <x3d/rendertree.h>
#include <x3d/rendernoderadiance.h>
static const int c_RenderableLoaderSlot = 0;
static bool render_node_radiance_free(struct render_node* self)
{
render_node_free(self);
free_fix(self);
return true;
}
static bool render_node_radiance_insert(struct render_node* self, struct render_node* input)
{
enum RenderNodeType type = render_node_get_type(input);
switch(type) {
case RenderNodeRenderableLoader:
{
render_node_set_input(self, input, c_RenderableLoaderSlot);
return true;
}
default:
{
log_mild_err_dbg("unsupported input type: %d", type);
return false;
}
}
}
static bool render_node_radiance_remove(struct render_node* self, struct render_node* input)
{
render_node_remove_input(self, input);
return true;
}
static bool render_node_radiance_self(struct render_tree* tree, struct render_node* self)
{
return true;
}
void render_node_radiance_set_pipe(struct render_radiance* node, enum RenderPipeType pipe)
{
node->pipe = pipe;
}
enum RenderPipeType render_node_radiance_get_pipe(const struct render_radiance* node)
{
return node->pipe;
}
const int render_node_radiance_get_input_slot(enum RenderNodeType type)
{
switch(type) {
case RenderNodeRenderableLoader:
{
return c_RenderableLoaderSlot;
}
default:
{
log_severe_err_dbg("render radiance doesn't contain input nodes of type: %d", type);
return -1;
}
}
}
struct render_node* render_node_radiance_create(const char* name, enum RenderPipeType pipe)
{
static const int c_NumInput = 1;
static const int c_NumOutput = 1;
struct render_radiance* node = alloc_obj(node);
render_node_init((struct render_node*) node,
render_node_radiance_free,
render_node_radiance_self,
render_node_radiance_insert,
render_node_radiance_remove,
RenderNodeRadiance, name, c_NumInput, c_NumOutput);
render_node_ex_init((struct render_node_ex*) node, RenderNodeRadiance);
node->pipe = pipe;
return (struct render_node*) node;
}
|
/*
* Copyright (C) 2011-2021 Project SkyFire <https://www.projectskyfire.org/>
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2021 MaNGOS <https://www.getmangos.eu/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BATTLEFIELD_MGR_H_
#define BATTLEFIELD_MGR_H_
#include "Battlefield.h"
#include "ace/Singleton.h"
class Player;
class GameObject;
class Creature;
class ZoneScript;
struct GossipMenuItems;
// class to handle player enter / leave / areatrigger / GO use events
class BattlefieldMgr
{
public:
// ctor
BattlefieldMgr() : m_UpdateTimer(0) { }
// dtor
~BattlefieldMgr();
// create battlefield events
void InitBattlefield();
// called when a player enters an battlefield area
void HandlePlayerEnterZone(Player* player, uint32 areaflag);
// called when player leaves an battlefield area
void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
// called when player resurrects
void HandlePlayerResurrects(Player* player, uint32 areaflag);
// return assigned battlefield
Battlefield* GetBattlefieldToZoneId(uint32 zoneid);
Battlefield* GetBattlefieldByBattleId(uint32 battleid);
Battlefield *GetBattlefieldByGUID(uint64 guid);
ZoneScript* GetZoneScript(uint32 zoneId);
void AddZone(uint32 zoneid, Battlefield * handle);
void Update(uint32 diff);
void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems gso);
void HandleDropFlag(Player* player, uint32 spellId);
typedef std::vector < Battlefield * >BattlefieldSet;
typedef std::map < uint32 /* zoneid */, Battlefield * >BattlefieldMap;
private:
// contains all initiated battlefield events
// used when initing / cleaning up
BattlefieldSet m_BattlefieldSet;
// maps the zone ids to an battlefield event
// used in player event handling
BattlefieldMap m_BattlefieldMap;
// update interval
uint32 m_UpdateTimer;
};
#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
#endif
|
/*
* Functions related to generic helpers functions
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/scatterlist.h>
#include <linux/gfp.h>
#include "blk.h"
struct bio_batch {
atomic_t done;
unsigned long flags;
struct completion *wait;
};
static void bio_batch_end_io(struct bio *bio, int err)
{
struct bio_batch *bb = bio->bi_private;
if (err && (err != -EOPNOTSUPP))
clear_bit(BIO_UPTODATE, &bb->flags);
if (atomic_dec_and_test(&bb->done))
complete(bb->wait);
bio_put(bio);
}
/**
* blkdev_issue_discard - queue a discard
* @bdev: blockdev to issue discard for
* @sector: start sector
* @nr_sects: number of sectors to discard
* @gfp_mask: memory allocation flags (for bio_alloc)
* @flags: BLKDEV_IFL_* flags to control behaviour
*
* Description:
* Issue a discard request for the sectors in question.
*/
int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask, int flags)
{
DECLARE_COMPLETION_ONSTACK(wait);
struct request_queue *q = bdev_get_queue(bdev);
int type = (1 << BIO_RW) | (1 << BIO_RW_DISCARD);
unsigned int max_discard_sectors;
unsigned int granularity, alignment, mask;
struct bio_batch bb;
struct bio *bio;
int ret = 0;
/*
* DEPRECATED support for DISCARD_FL_BARRIER which will
* fail with -EOPNOTSUPP (due to implicit BIO_RW_BARRIER)
*/
if (flags & DISCARD_FL_BARRIER)
type = DISCARD_BARRIER;
if (!q)
return -ENXIO;
if (!blk_queue_discard(q))
return -EOPNOTSUPP;
/* Zero-sector (unknown) and one-sector granularities are the same. */
granularity = max(q->limits.discard_granularity >> 9, 1U);
mask = granularity - 1;
alignment = (bdev_discard_alignment(bdev) >> 9) & mask;
/*
* Ensure that max_discard_sectors is of the proper
* granularity, so that requests stay aligned after a split.
*/
max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9);
max_discard_sectors = round_down(max_discard_sectors, granularity);
if (unlikely(!max_discard_sectors)) {
/* Avoid infinite loop below. Being cautious never hurts. */
return -EOPNOTSUPP;
}
atomic_set(&bb.done, 1);
bb.flags = 1 << BIO_UPTODATE;
bb.wait = &wait;
while (nr_sects) {
unsigned int req_sects;
sector_t end_sect;
bio = bio_alloc(gfp_mask, 1);
if (!bio) {
ret = -ENOMEM;
break;
}
req_sects = min_t(sector_t, nr_sects, max_discard_sectors);
/*
* If splitting a request, and the next starting sector would be
* misaligned, stop the discard at the previous aligned sector.
*/
end_sect = sector + req_sects;
if (req_sects < nr_sects && (end_sect & mask) != alignment) {
end_sect =
round_down(end_sect - alignment, granularity)
+ alignment;
req_sects = end_sect - sector;
}
bio->bi_sector = sector;
bio->bi_end_io = bio_batch_end_io;
bio->bi_bdev = bdev;
bio->bi_private = &bb;
bio->bi_size = req_sects << 9;
nr_sects -= req_sects;
sector = end_sect;
atomic_inc(&bb.done);
submit_bio(type, bio);
}
/* Wait for bios in-flight */
if (!atomic_dec_and_test(&bb.done))
wait_for_completion(&wait);
if (!test_bit(BIO_UPTODATE, &bb.flags))
ret = -EIO;
return ret;
}
EXPORT_SYMBOL(blkdev_issue_discard);
/**
* blkdev_issue_zeroout - generate number of zero filed write bios
* @bdev: blockdev to issue
* @sector: start sector
* @nr_sects: number of sectors to write
* @gfp_mask: memory allocation flags (for bio_alloc)
*
* Description:
* Generate and issue number of bios with zerofiled pages.
*/
int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
sector_t nr_sects, gfp_t gfp_mask)
{
int ret;
struct bio *bio;
struct bio_batch bb;
unsigned int sz;
DECLARE_COMPLETION_ONSTACK(wait);
atomic_set(&bb.done, 1);
bb.flags = 1 << BIO_UPTODATE;
bb.wait = &wait;
ret = 0;
while (nr_sects != 0) {
bio = bio_alloc(gfp_mask,
min(nr_sects, (sector_t)BIO_MAX_PAGES));
if (!bio) {
ret = -ENOMEM;
break;
}
bio->bi_sector = sector;
bio->bi_bdev = bdev;
bio->bi_end_io = bio_batch_end_io;
bio->bi_private = &bb;
while (nr_sects != 0) {
sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
ret = bio_add_page(bio, ZERO_PAGE(0), sz << 9, 0);
nr_sects -= ret >> 9;
sector += ret >> 9;
if (ret < (sz << 9))
break;
}
ret = 0;
atomic_inc(&bb.done);
submit_bio(WRITE, bio);
}
/* Wait for bios in-flight */
if (!atomic_dec_and_test(&bb.done))
wait_for_completion(&wait);
if (!test_bit(BIO_UPTODATE, &bb.flags))
/* One of bios in the batch was completed with error.*/
ret = -EIO;
return ret;
}
EXPORT_SYMBOL(blkdev_issue_zeroout);
|
/**
* \addtogroup helloworld
* @{
*/
/**
* \file
* An example of how to write uIP applications
* with protosockets.
* \author
* Adam Dunkels <adam@sics.se>
*/
/*
* This is a short example of how to write uIP applications using
* protosockets.
*/
/*
* We define the application state (struct hello_world_state) in the
* hello-world.h file, so we need to include it here. We also include
* uip.h (since this cannot be included in hello-world.h) and
* <string.h>, since we use the memcpy() function in the code.
*/
#include "hello-world.h"
#include "uip.h"
#include <string.h>
/*
* Declaration of the protosocket function that handles the connection
* (defined at the end of the code).
*/
static int handle_connection(struct hello_world_state *s);
static int rt_show_info(struct hello_world_state *s);
/*---------------------------------------------------------------------------*/
/*
* The initialization function. We must explicitly call this function
* from the system initialization code, some time after uip_init() is
* called.
*/
void
hello_world_init(void)
{
/* We start to listen for connections on TCP port 1000. */
//uip_listen(HTONS(1000));
}
/*---------------------------------------------------------------------------*/
/*
* In hello-world.h we have defined the UIP_APPCALL macro to
* hello_world_appcall so that this funcion is uIP's application
* function. This function is called whenever an uIP event occurs
* (e.g. when a new connection is established, new data arrives, sent
* data is acknowledged, data needs to be retransmitted, etc.).
*/
void
hello_world_appcall(void)
{
/*
* The uip_conn structure has a field called "appstate" that holds
* the application state of the connection. We make a pointer to
* this to access it easier.
*/
#if 0
struct hello_world_state *s = &(uip_conn->appstate);
/*
* If a new connection was just established, we should initialize
* the protosocket in our applications' state structure.
*/
if(uip_connected()) {
PSOCK_INIT(&s->p, s->inputbuffer, sizeof(s->inputbuffer));
rt_show_info(s);
}
/*
* Finally, we run the protosocket function that actually handles
* the communication. We pass it a pointer to the application state
* of the current connection.
*/
handle_connection(s);
#endif
}
/*---------------------------------------------------------------------------*/
/*
* This is the protosocket function that handles the communication. A
* protosocket function must always return an int, but must never
* explicitly return - all return statements are hidden in the PSOCK
* macros.
*/
static int rt_show_info(struct hello_world_state *s)
{
/*
PSOCK_BEGIN(&s->p);
PSOCK_SEND_STR(&s->p,"RT-Thread RTOS");
PSOCK_READTO(&s->p, '\n');
PSOCK_END(&s->p);
*/
return 0;
}
static int
handle_connection(struct hello_world_state *s)
{
int i;
for (i=0;i<BUF_SIZE;i++)
{
s->name[i] = 0;
s->inputbuffer[i] = 0;
}
#if 0
PSOCK_BEGIN(&s->p);
//PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n");
PSOCK_READTO(&s->p, '\n');
strncpy(s->name, s->inputbuffer, sizeof(s->name));
//PSOCK_SEND_STR(&s->p, "Hello ");
PSOCK_SEND_STR(&s->p, s->name);
//PSOCK_CLOSE(&s->p);
PSOCK_END(&s->p);
#endif
}
/*---------------------------------------------------------------------------*/
|
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
*
* Copyright (C) 2008 Sun Microsystems, 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; 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#pragma once
#include <string>
#include <drizzled/definitions.h>
#include <drizzled/common.h>
#include <drizzled/comp_creator.h>
#include <drizzled/identifier.h>
#include <drizzled/error_t.h>
#include <drizzled/visibility.h>
namespace drizzled {
DRIZZLED_API const std::string& getCommandName(const enum_server_command& command);
bool execute_sqlcom_select(Session*, TableList *all_tables);
bool insert_select_prepare(Session*);
bool update_precheck(Session*, TableList *tables);
bool delete_precheck(Session*, TableList *tables);
bool insert_precheck(Session*, TableList *tables);
Item *negate_expression(Session*, Item *expr);
bool check_identifier_name(str_ref, error_t err_code= EE_OK);
bool check_string_byte_length(str_ref, const char *err_msg, uint32_t max_byte_length);
bool check_string_char_length(str_ref, const char *err_msg, uint32_t max_char_length, const charset_info_st*, bool no_error);
bool test_parse_for_slave(Session*, char *inBuf, uint32_t length);
void reset_session_for_next_command(Session*);
void create_select_for_variable(Session*, const char *var_name);
void init_update_queries();
bool dispatch_command(enum_server_command, Session&, str_ref);
bool check_simple_select(Session*);
void init_select(LEX*);
bool new_select(LEX*, bool move_down);
int prepare_new_schema_table(Session*, LEX&, const std::string& schema_table_name);
Item * all_any_subquery_creator(Item *left_expr,
chooser_compare_func_creator cmp,
bool all,
Select_Lex *select_lex);
char* query_table_status(Session*,const char *db,const char *table_name);
} /* namespace drizzled */
|
/***************************************************************************
* Copyright (C) 2007 by Michael Ambrus *
* michael.ambrus@maquet.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 <assert.h>
#include <string.h>
#include <limits.h>
#if !defined(PATH_MAX) || !defined(NAME_MAX)
#include <sys/syslimits.h>
#endif
#include <filesys/filesys.h>
#define RX_BUFFLEN 102
#define TX_BUFFLEN 102
extern tk_id_t __fcntr;
extern tk_id_t __flid;
extern tk_inode_t *__Rnod;
extern tk_iohandle_t std_files[3];
static const char assert_info[] = "Something is wrong - please report this bug";
int fs_close(int file)
{
if ((file >= 0) && (file <= 2)) {
assert("close for sddin/out not supported" == NULL);
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, close);
return hndl->inode->iohandle->close(file);
}
int fs_fcntl(int file, int command, ...)
{
va_list ap;
tk_fhandle_t *hndl;
int rc;
va_start(ap, command);
hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, fcntl);
rc = hndl->inode->iohandle->fcntl(file, command, ap);
va_end(ap);
return rc;
}
int fs_fstat(int file, struct stat *st)
{
if ((file >= 0) && (file <= 2)) {
st->st_mode = S_IFCHR;
st->st_blksize = TX_BUFFLEN;
return 0;
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, fstat);
return hndl->inode->iohandle->fstat(file, st);
}
int fs_isatty(int file)
{
if ((file >= 0) && (file <= 2)) {
return 1;
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, isatty);
return hndl->inode->iohandle->isatty(file);
}
int fs_link(char *old, char *new)
{
assert(assert_info == NULL);
errno = EMLINK;
return -1;
}
int fs_lseek(int file, int ptr, int dir)
{
if ((file >= 0) && (file <= 2)) {
assert("lseek for sddin/out not supported" == NULL);
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, lseek);
return hndl->inode->iohandle->lseek(file, ptr, dir);
}
int fs_open(const char *filename, int oflag, ...)
{
va_list ap;
#if DEBUG
_tk_dbgflag_t dbgflags;
#endif
mode_t accessflgs = 0;
tk_inode_t *inode;
va_start(ap, oflag);
va_end(ap);
assert(tk_dbg_flags(&dbgflags, oflag) == 0);
inode = isearch(__Rnod, filename);
if (inode == NULL) {
int rc = 0;
if (oflag & O_CREAT) {
if (filename[strnlen(filename, PATH_MAX)] == '/') {
char tname[PATH_MAX];
strncpy(tname, filename, PATH_MAX);
tname[strnlen(tname, PATH_MAX)] = 0;
rc = imknod(__Rnod, tname, S_IFDIR, accessflgs);
} else {
rc = imknod(__Rnod, filename, S_IFREG,
accessflgs);
}
if (rc == 0) {
inode = isearch(__Rnod, filename);
assure(inode->iohandle);
assure(inode->iohandle->open);
return inode->iohandle->open(filename, oflag,
accessflgs, inode);
} else {
return -1;
}
} else {
errno = ENOENT;
return -1;
}
}
if (inode != NULL && strncmp(inode->name, igetname(filename), NAME_MAX)) {
assure(inode->mount != NULL);
assure(inode->iohandle);
assure(inode->iohandle->open);
return inode->iohandle->open(filename, oflag, inode);
}
if (inode != NULL && (oflag & (O_CREAT | O_EXCL))) {
errno = EEXIST;
return -1;
}
assure(inode->iohandle);
assure(inode->iohandle->open);
return inode->iohandle->open(filename, oflag, inode);
}
int fs_read(int file, char *ptr, int len)
{
if ((file >= 0) && (file <= 2)) {
return std_files[file].read(file, ptr, len);
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, fcntl);
return hndl->inode->iohandle->read(file, ptr, len);
}
int fs_stat(const char *file, struct stat *st)
{
assert(assert_info == NULL);
st->st_mode = S_IFCHR;
return 0;
}
int fs_unlink(char *name)
{
assert(assert_info == NULL);
errno = ENOENT;
return -1;
}
int fs_write(int file, char *ptr, int len)
{
if ((file >= 0) && (file <= 2)) {
return std_files[file].write(file, ptr, len);
}
tk_fhandle_t *hndl = (tk_fhandle_t *) file;
CHECK_FH(hndl, fcntl);
return hndl->inode->iohandle->write(file, ptr, len);
}
tk_fhandle_t *tk_new_handle(tk_inode_t * inode, int oflag)
{
tk_fhandle_t *hndl;
assure((hndl = (tk_fhandle_t *) calloc(1, sizeof(tk_fhandle_t))));
__fcntr++;
hndl->id = __flid++;
hndl->oflag = oflag;
hndl->inode = inode;
return hndl;
}
int tk_free_handle(tk_fhandle_t * fhndl)
{
free(fhndl);
__fcntr--;
return 0;
}
|
/*
Copyright (C) 2011 Birunthan Mohanathas (www.poiru.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __PLAYERAIMP_H__
#define __PLAYERAIMP_H__
#include "Player.h"
class CPlayerAIMP : public CPlayer
{
public:
virtual ~CPlayerAIMP();
static CPlayer* Create();
virtual void UpdateData();
virtual void Pause();
virtual void Play();
virtual void Stop();
virtual void Next();
virtual void Previous();
virtual void SetPosition(int position);
virtual void SetRating(int rating);
virtual void SetVolume(int volume);
virtual void SetShuffle(bool state);
virtual void SetRepeat(bool state);
virtual void ClosePlayer();
virtual void OpenPlayer(std::wstring& path);
protected:
CPlayerAIMP();
private:
bool Initialize();
bool CheckWindow();
static CPlayer* c_Player;
HWND m_Window; // AIMP window
HWND m_WinampWindow; // AIMP Winamp API window
DWORD m_LastCheckTime;
INT64 m_LastFileSize;
DWORD m_LastTitleSize;
LPVOID m_FileMap;
HANDLE m_FileMapHandle;
};
#endif
|
/**
******************************************************************************
* @file IWDG/IWDG_Example/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.0.1
* @date 26-February-2014
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
*
* 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 STMicroelectronics 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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void EXTI15_10_IRQHandler(void);
void TIM5_IRQHandler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*
* Virtio Support
*
* Copyright IBM, Corp. 2007-2008
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
* Rusty Russell <rusty@rustcorp.com.au>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/
#ifndef _QEMU_VIRTIO_BALLOON_H
#define _QEMU_VIRTIO_BALLOON_H
#include "hw/virtio/virtio.h"
#include "hw/pci/pci.h"
#define TYPE_VIRTIO_BALLOON "virtio-balloon"
#define VIRTIO_BALLOON(obj) \
OBJECT_CHECK(VirtIOBalloon, (obj), TYPE_VIRTIO_BALLOON)
/* from Linux's linux/virtio_balloon.h */
/* The ID for virtio_balloon */
#define VIRTIO_ID_BALLOON 5
/* The feature bitmap for virtio balloon */
#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
#define VIRTIO_BALLOON_F_STATS_VQ 1 /* Memory stats virtqueue */
/* Size of a PFN in the balloon interface. */
#define VIRTIO_BALLOON_PFN_SHIFT 12
struct virtio_balloon_config
{
/* Number of pages host wants Guest to give up. */
uint32_t num_pages;
/* Number of pages we've actually got in balloon. */
uint32_t actual;
};
/* Memory Statistics */
#define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */
#define VIRTIO_BALLOON_S_SWAP_OUT 1 /* Amount of memory swapped out */
#define VIRTIO_BALLOON_S_MAJFLT 2 /* Number of major faults */
#define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */
#define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */
#define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */
#define VIRTIO_BALLOON_S_NR 6
typedef struct VirtIOBalloonStat {
uint16_t tag;
uint64_t val;
} QEMU_PACKED VirtIOBalloonStat;
typedef struct VirtIOBalloon {
VirtIODevice parent_obj;
VirtQueue *ivq, *dvq, *svq;
uint32_t num_pages;
uint32_t actual;
uint64_t stats[VIRTIO_BALLOON_S_NR];
VirtQueueElement stats_vq_elem;
size_t stats_vq_offset;
QEMUTimer *stats_timer;
int64_t stats_last_update;
int64_t stats_poll_interval;
} VirtIOBalloon;
#endif
|
/* UOL Messenger
* Copyright (c) 2005 Universo Online S/A
*
* Direitos Autorais Reservados
* All rights reserved
*
* Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo
* sob os termos da Licença Pública Geral GNU conforme publicada pela Free
* Software Foundation; tanto a versão 2 da Licença, como (a seu critério)
* qualquer versão posterior.
* Este programa é distribuído na expectativa de que seja útil, porém,
* SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE
* OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
* do GNU para mais detalhes.
* Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
* com este programa; se não, escreva para a Free Software Foundation, Inc.,
* no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
*
* 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.
*
* Universo Online S/A - A/C: UOL Messenger 5o. Andar
* Avenida Brigadeiro Faria Lima, 1.384 - Jardim Paulistano
* São Paulo SP - CEP 01452-002 - BRASIL */
#pragma once
#include "../skin/elementbuilder.h"
#include "ReadyForChatListCtrl.h"
class CReadyForChatListCtrlBuilder : public CElementBuilder
{
public:
DECLARE_ELEMENT_NAME("ReadyForChatList");
CReadyForChatListCtrlBuilder(void);
virtual ~CReadyForChatListCtrlBuilder(void);
protected:
virtual CElementPtr AllocElement();
virtual CString GetName() const;
private:
CStringGUID m_strGUID;
};
MAKEAUTOPTR(CReadyForChatListCtrlBuilder); |
/****************************************************************
* *
* Copyright 2001, 2003 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_stdlib.h"
#include "gtm_string.h"
#include "startup.h"
#include "rtnhdr.h"
#include "stack_frame.h"
#include "error.h"
#include "cli.h"
#include "gdsroot.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "op.h"
#include "tp_timeout.h"
#include "ctrlc_handler.h"
#include "mprof.h"
#include "gtm_startup_chk.h"
#include "gtm_compile.h"
#include "gtm_startup.h"
#include "jobchild_init.h"
#include "cli_parse.h"
#include "invocation_mode.h"
GBLREF void (*tp_timeout_start_timer_ptr)(int4 tmout_sec);
GBLREF void (*tp_timeout_clear_ptr)(void);
GBLREF void (*tp_timeout_action_ptr)(void);
GBLREF void (*ctrlc_handler_ptr)();
GBLREF int (*op_open_ptr)(mval *v, mval *p, int t, mval *mspace);
GBLREF void (*unw_prof_frame_ptr)(void);
GBLREF mstr default_sysid;
GBLDEF boolean_t gtm_startup_active = FALSE;
void init_gtm(void)
{
struct startup_vector svec;
/* We believe much of our code depends on these relationships. */
assert (sizeof(int) == 4);
assert (sizeof(int4) == 4);
assert (sizeof(short) == 2);
#if defined(OFF_T_LONG) || defined(__MVS__)
assert (sizeof(off_t) == 8);
#else
assert (sizeof(off_t) == 4);
#endif
assert (sizeof(sgmnt_data) == ROUND_UP(sizeof(sgmnt_data), DISK_BLOCK_SIZE));
assert (sizeof(key_t) == sizeof(int4));
assert (sizeof(boolean_t) == 4); /* generated code passes 4 byte arguments, run time rtn might be expecting boolean_t arg */
assert (BITS_PER_UCHAR == 8);
tp_timeout_start_timer_ptr = tp_start_timer;
tp_timeout_clear_ptr = tp_clear_timeout;
tp_timeout_action_ptr = tp_timeout_action;
ctrlc_handler_ptr = ctrlc_handler;
op_open_ptr = op_open;
unw_prof_frame_ptr = unw_prof_frame;
if (MUMPS_COMPILE == invocation_mode)
exit(gtm_compile());
/* this should be after cli_lex_setup() due to S390 A/E conversion in cli_lex_setup */
memset(&svec, 0, sizeof(svec));
svec.argcnt = sizeof(svec);
svec.rtn_start = svec.rtn_end = malloc(sizeof(RTN_TABENT));
memset(svec.rtn_start, 0, sizeof(RTN_TABENT));
svec.user_stack_size = 120 * 1024;
svec.user_indrcache_size = 32;
svec.user_strpl_size = 20480;
svec.ctrlc_enable = 1;
svec.break_message_mask = 15;
svec.labels = 1;
svec.lvnullsubs = 1;
svec.base_addr = (unsigned char *)1;
svec.zdate_form = 0;
svec.sysid_ptr = &default_sysid;
gtm_startup(&svec);
gtm_startup_active = TRUE;
}
|
#ifndef DEFINED /*so that things aren't included twice*/
/*
Copyright (C) 2012 Jason Giancono (jasongiancono@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
/*constants*/
#define VOIDENTRY 0
#define ROTATE 1
#define MOVE 2
#define DRAW 3
#define FG 4
#define BG 5
#define PATTERN 6
typedef struct {
void *magnitude;
int type;
} Instruction;
typedef struct LinkedListNode{
Instruction *instruction;
struct LinkedListNode *next;
} LinkedListNode;
typedef struct {
LinkedListNode *head;
LinkedListNode *tail;
} LinkedList;
LinkedList *createList();
void insertLast(LinkedList *lL, Instruction *inInstruction);
void removeFirst(LinkedList *lL);
Instruction *returnFirstElement(LinkedList *lL);
void freeList(LinkedList *lL);
#define DEFINED /*for the ifndef statement*/
#endif
|
#ifndef PARAMETERSTRUCT_H
#include "parameterStruct.h"
#endif
double sterileOscillation(paramList *pList);
|
/** @file
WT450 wireless weather sensors protocol.
Tested devices:
WT260H
WT405H
Copyright (C) 2015 Tommy Vestermark
Copyright (C) 2015 Ladislav Foldyna
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.
*/
/**
source from:
http://ala-paavola.fi/jaakko/doku.php?id=wt450h
- The signal is FM encoded with clock cycle around 2000 µs
- No level shift within the clock cycle translates to a logic 0
- One level shift within the clock cycle translates to a logic 1
- Each clock cycle begins with a level shift
- My timing constants defined below are those observed by my program
+---+ +---+ +-------+ + high
| | | | | | |
| | | | | | |
+ +---+ +---+ +-------+ low
^ ^ ^ ^ ^ clock cycle
| 1 | 1 | 0 | 0 | translates as
Each transmission is 36 bits long (i.e. 72 ms).
Data is transmitted in pure binary values, NOT BCD-coded.
Outdoor sensor transmits data temperature, humidity.
Transmissions also include channel code and house code. The sensor transmits
every 60 seconds 3 packets.
1100 0001 | 0011 0011 | 1000 0011 | 1011 0011 | 0001
xxxx ssss | ccxx bhhh | hhhh tttt | tttt tttt | sseo
- x: constant
- s: House code
- c: Channel
- b: battery low indicator (0=>OK, 1=>LOW)
- h: Humidity
- t: Temperature, 12 bit, offset 50, scale 16
- s: sequence number of message repeat
- e: parity of all even bits
- o: parity of all odd bits
*/
#include "decoder.h"
static int wt450_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
uint8_t *b = bitbuffer->bb[0];
uint8_t humidity;
uint8_t temp_whole;
uint8_t temp_fraction;
uint8_t house_code;
uint8_t channel;
uint8_t battery_low;
int seq;
float temp;
uint8_t parity;
data_t *data;
if (bitbuffer->bits_per_row[0] != 36) {
decoder_logf(decoder, 1, __func__, "wrong size of bit per row %d",
bitbuffer->bits_per_row[0]);
return DECODE_ABORT_LENGTH;
}
if (b[0] >> 4 != 0xC) {
decoder_log_bitbuffer(decoder, 1, __func__, bitbuffer, "wrong preamble");
return DECODE_ABORT_EARLY;
}
parity = xor_bytes(b, 5);
parity ^= (parity >> 4);
parity ^= (parity >> 2);
parity &= 0x3;
if (parity) {
decoder_logf_bitbuffer(decoder, 1, __func__, bitbuffer, "wrong parity (%x)", parity);
return DECODE_FAIL_MIC;
}
house_code = b[0] & 0xF;
channel = (b[1] >> 6) + 1;
battery_low = b[1] & 0x8;
humidity = ((b[1] & 0x7) << 4) | (b[2] >> 4);
temp_whole = (b[2] << 4) | (b[3] >> 4);
temp_fraction = (b[3] & 0xF);
temp = (temp_whole - 50) + (temp_fraction / 16.0);
seq = (b[4] >> 6);
/* clang-format off */
data = data_make(
"model", "", DATA_STRING, "WT450-TH",
"id", "House Code", DATA_INT, house_code,
"channel", "Channel", DATA_INT, channel,
"battery_ok", "Battery", DATA_INT, !battery_low,
"temperature_C", "Temperature", DATA_FORMAT, "%.02f C", DATA_DOUBLE, temp,
"humidity", "Humidity", DATA_FORMAT, "%u %%", DATA_INT, humidity,
"seq", "Sequence", DATA_INT, seq,
NULL);
/* clang-format on */
decoder_output_data(decoder, data);
return 1;
}
static char *output_fields[] = {
"model",
"id",
"channel",
"battery_ok",
"temperature_C",
"humidity",
"seq",
NULL,
};
r_device wt450 = {
.name = "WT450, WT260H, WT405H",
.modulation = OOK_PULSE_DMC,
.short_width = 976, // half-bit width 976 us
.long_width = 1952, // bit width 1952 us
.reset_limit = 18000,
.tolerance = 100, // us
.decode_fn = &wt450_callback,
.fields = output_fields,
};
|
#if !defined(AFX_REPORTSELE_H__890DA06D_69E5_4125_B9C6_AD64B98454E2__INCLUDED_)
#define AFX_REPORTSELE_H__890DA06D_69E5_4125_B9C6_AD64B98454E2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ReportSele.h : header file
//
#undef CListBox
/////////////////////////////////////////////////////////////////////////////
// CReportSele dialog
class CReportSele : public CDialog
{
// Construction
public:
CReportSele(CWnd* pParent = NULL); // standard constructor
TCHAR cPath[MAX_PATH] ;
CString cFileName;
// CString cFile;
// Dialog Data
//{{AFX_DATA(CReportSele)
enum { IDD = IDD_DIALOG_SELE };
CListBox m_ListFileName;
CString cFile;
int m_iSelect;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CReportSele)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CReportSele)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void FindFile();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_REPORTSELE_H__890DA06D_69E5_4125_B9C6_AD64B98454E2__INCLUDED_)
|
/*
* =============================================================================
*
* Filename: cat.c
*
* Description: cat class derived from animal base class.
*
* Created: 12/31/2012 12:52:26 PM
*
* Author: Fu Haiping (forhappy), haipingf@gmail.com
* Company: ICT ( Institute Of Computing Technology, CAS )
*
* =============================================================================
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cat.h"
static void eat(char *food);
static void walk(int steps);
static void talk(char *msg);
cat_t * cat_init()
{
cat_t *cat = (cat_t *)malloc(sizeof(cat_t));
animal_t *animal = (animal_t *)animal_init("cat");
memcpy(&(cat->base), animal, sizeof(animal_t));
cat->base.animal_ops->eat = eat;
cat->base.animal_ops->walk = walk;
cat->base.animal_ops->talk = talk;
free(animal);
return cat;
}
void cat_die(cat_t *cat)
{
/* nothing to do here. */
}
static void eat(char *food)
{
printf("I'm a cat, I eat %s\n", food);
}
static void walk(int steps)
{
printf("I'm a cat, I can jump %d steps one time\n", steps);
}
static void talk(char *msg)
{
printf("I'm a cat, I talk my language %s\n", msg);
}
¸´ÖÆ´úÂë |
// copyright (C) 2004 david griffiths <dave@pawfal.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.
#include <sys/time.h>
#include <limits.h>
#ifndef SPIRALCORE_TIME
#define SPIRALCORE_TIME
static const double ONE_OVER_UINT_MAX = 1.0/UINT_MAX;
// This is the deal with time
// --------------------------
//
// We have two types of time dealt with here, unix timestamps
// and ntp timestamps - this class is an ntp timestamp but is derived
// from gettimeofday which produces unix timestamps.
//
// Unix timestamps
// ---------------
// Unix timestamps can either be 32 or 64 bits, but both correspond
// to seconds and microseconds (millioth of a second) since 1970. Not
// sure what the benefit of microseconds being 64 bit is, other than
// symmetry?
//
// NTP timestamps
// --------------
// These are 2 X 32 bits, seconds and fractions of a second (using the
// full unsigned 32 bit int range) from 1900, we use this for OSC
// compatibility
namespace spiralcore
{
class time
{
public:
time();
time(unsigned int s, unsigned int f) : seconds(s),fraction(f) {}
void set_to_now();
void set_from_posix(timeval tv);
void inc_by_sample(unsigned long samples, unsigned long samplerate);
bool operator<(const time& other);
bool operator>(const time& other);
bool operator<=(const time& other);
bool operator>=(const time& other);
bool operator==(const time& other);
time &operator+=(double s);
void print() const;
double get_fraction() const { return fraction*ONE_OVER_UINT_MAX; }
void set_fraction(double s) { fraction = (unsigned int)(s*(double)UINT_MAX); }
bool is_empty() { return (!seconds && !fraction); }
double get_difference(const time& other);
unsigned int seconds;
unsigned int fraction;
};
}
#endif
|
//--------------------------------------------------------------------------
// Copyright (C) 2016-2016 Cisco 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 Version 2 as published
// by the Free Software Foundation. You may not use, modify or distribute
// this program under any other version of the GNU General Public 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.
//--------------------------------------------------------------------------
// prune_stats.h author Joel Cornett <jocornet@cisco.com>
#ifndef PRUNE_STATS_H
#define PRUNE_STATS_H
#include <cstdint>
#include <type_traits>
#include "framework/counts.h"
// FIXIT-L J we can probably fiddle with these breakdowns
enum class PruneReason : uint8_t
{
// FIXIT-L J do we want to count purges?
PURGE = 0,
TIMEOUT,
EXCESS,
UNI,
PREEMPTIVE,
MEMCAP,
USER,
MAX
};
struct PruneStats
{
using reason_t = std::underlying_type<PruneReason>::type;
PegCount prunes[static_cast<reason_t>(PruneReason::MAX)] { };
PegCount get_total() const;
PegCount& get(PruneReason reason)
{ return prunes[static_cast<reason_t>(reason)]; }
const PegCount& get(PruneReason reason) const
{ return prunes[static_cast<reason_t>(reason)]; }
void update(PruneReason reason)
{ ++get(reason); }
};
inline PegCount PruneStats::get_total() const
{
PegCount total = 0;
for ( reason_t i = 0; i < static_cast<reason_t>(PruneReason::MAX); ++i )
total += prunes[i];
return total;
}
#endif
|
/*
GAMEMAP.H
Map Include File.
Info:
Section :
Bank : 0
Map size : 20 x 18
Tile set : C:\gbdk\Tools\turtle.gbr
Plane count : 1 plane (8 bits)
Plane order : Tiles are continues
Tile offset : 0
Split data : No
This file was generated by GBMB v1.8
*/
#define gameMapWidth 20
#define gameMapHeight 18
#define gameMapBank 0
extern unsigned char gameMap[];
/* End of GAMEMAP.H */
|
/*
* nvidia-installer: A tool for installing NVIDIA software packages on
* Unix and Linux systems.
*
* Copyright (C) 2003 NVIDIA Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 __NVIDIA_INSTALLER_CRC_H__
#define __NVIDIA_INSTALLER_CRC_H__
uint32 compute_crc_from_buffer(const uint8 *buf, int len);
uint32 compute_crc(Options *op, const char *filename);
#endif /* __NVIDIA_INSTALLER_CRC_H__ */
|
/*
* s390 IPL device
*
* Copyright 2015 IBM Corp.
* Author(s): Zhang Fan <bjfanzh@cn.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or (at
* your option) any later version. See the COPYING file in the top-level
* directory.
*/
#ifndef HW_S390_IPL_H
#define HW_S390_IPL_H
#include "hw/qdev.h"
#include "cpu.h"
struct IplBlockCcw {
uint64_t netboot_start_addr;
uint8_t reserved0[77];
uint8_t ssid;
uint16_t devno;
uint8_t vm_flags;
uint8_t reserved3[3];
uint32_t vm_parm_len;
uint8_t nss_name[8];
uint8_t vm_parm[64];
uint8_t reserved4[8];
} QEMU_PACKED;
typedef struct IplBlockCcw IplBlockCcw;
struct IplBlockFcp {
uint8_t reserved1[305 - 1];
uint8_t opt;
uint8_t reserved2[3];
uint16_t reserved3;
uint16_t devno;
uint8_t reserved4[4];
uint64_t wwpn;
uint64_t lun;
uint32_t bootprog;
uint8_t reserved5[12];
uint64_t br_lba;
uint32_t scp_data_len;
uint8_t reserved6[260];
uint8_t scp_data[];
} QEMU_PACKED;
typedef struct IplBlockFcp IplBlockFcp;
struct IplBlockQemuScsi {
uint32_t lun;
uint16_t target;
uint16_t channel;
uint8_t reserved0[77];
uint8_t ssid;
uint16_t devno;
} QEMU_PACKED;
typedef struct IplBlockQemuScsi IplBlockQemuScsi;
union IplParameterBlock {
struct {
uint32_t len;
uint8_t reserved0[3];
uint8_t version;
uint32_t blk0_len;
uint8_t pbt;
uint8_t flags;
uint16_t reserved01;
uint8_t loadparm[8];
union {
IplBlockCcw ccw;
IplBlockFcp fcp;
IplBlockQemuScsi scsi;
};
} QEMU_PACKED;
struct {
uint8_t reserved1[110];
uint16_t devno;
uint8_t reserved2[88];
uint8_t reserved_ext[4096 - 200];
} QEMU_PACKED;
} QEMU_PACKED;
typedef union IplParameterBlock IplParameterBlock;
void s390_ipl_update_diag308(IplParameterBlock *iplb);
void s390_ipl_prepare_cpu(S390CPU *cpu);
IplParameterBlock *s390_ipl_get_iplb(void);
void s390_reipl_request(void);
#define TYPE_S390_IPL "s390-ipl"
#define S390_IPL(obj) OBJECT_CHECK(S390IPLState, (obj), TYPE_S390_IPL)
struct S390IPLState {
/*< private >*/
DeviceState parent_obj;
uint64_t start_addr;
uint64_t compat_start_addr;
uint64_t bios_start_addr;
uint64_t compat_bios_start_addr;
bool enforce_bios;
IplParameterBlock iplb;
bool iplb_valid;
bool reipl_requested;
bool netboot;
/*< public >*/
char *kernel;
char *initrd;
char *cmdline;
char *firmware;
char *netboot_fw;
uint8_t cssid;
uint8_t ssid;
uint16_t devno;
bool iplbext_migration;
};
typedef struct S390IPLState S390IPLState;
#define S390_IPL_TYPE_FCP 0x00
#define S390_IPL_TYPE_CCW 0x02
#define S390_IPL_TYPE_QEMU_SCSI 0xff
#define S390_IPLB_HEADER_LEN 8
#define S390_IPLB_MIN_CCW_LEN 200
#define S390_IPLB_MIN_FCP_LEN 384
#define S390_IPLB_MIN_QEMU_SCSI_LEN 200
static inline bool iplb_valid_len(IplParameterBlock *iplb)
{
return be32_to_cpu(iplb->len) <= sizeof(IplParameterBlock);
}
static inline bool iplb_valid_ccw(IplParameterBlock *iplb)
{
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_CCW_LEN &&
iplb->pbt == S390_IPL_TYPE_CCW;
}
static inline bool iplb_valid_fcp(IplParameterBlock *iplb)
{
return be32_to_cpu(iplb->len) >= S390_IPLB_MIN_FCP_LEN &&
iplb->pbt == S390_IPL_TYPE_FCP;
}
#endif
|
/*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
* Copyright (c) 2011-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 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/smp.h>
#include <linux/cpu.h>
#include <asm/cacheflush.h>
#include <asm/smp_plat.h>
#include <asm/vfp.h>
#include <mach/jtag.h>
#include <mach/msm_rtb.h>
#include "pm.h"
#include "spm.h"
#ifdef CONFIG_SMP
extern volatile int pen_release;
struct msm_hotplug_device {
struct completion cpu_killed;
unsigned int warm_boot;
};
static DEFINE_PER_CPU_SHARED_ALIGNED(struct msm_hotplug_device,
msm_hotplug_devices);
static inline void cpu_enter_lowpower(void)
{
/* Just flush the cache. Changing the coherency is not yet
* available on msm. */
flush_cache_all();
}
static inline void cpu_leave_lowpower(void)
{
}
static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
{
/* Just enter wfi for now. TODO: Properly shut off the cpu. */
for (;;) {
msm_pm_cpu_enter_lowpower(cpu);
if (pen_release == cpu_logical_map(cpu)) {
/*
* OK, proper wakeup, we're done
*/
break;
}
/*
* getting here, means that we have come out of WFI without
* having been woken up - this shouldn't happen
*
* The trouble is, letting people know about this is not really
* possible, since we are currently running incoherently, and
* therefore cannot safely call printk() or anything else
*/
(*spurious)++;
}
}
#endif
int platform_cpu_kill(unsigned int cpu)
{
int ret;
ret = msm_pm_wait_cpu_shutdown(cpu);
if (ret)
return 0;
return 1;
}
/*
* platform-specific code to shutdown a CPU
*
* Called with IRQs disabled
*/
void platform_cpu_die(unsigned int cpu)
{
int spurious = 0;
if (unlikely(cpu != smp_processor_id())) {
pr_crit("%s: running on %u, should be %u\n",
__func__, smp_processor_id(), cpu);
BUG();
}
complete(&__get_cpu_var(msm_hotplug_devices).cpu_killed);
/*
* we're ready for shutdown now, so do it
*/
cpu_enter_lowpower();
platform_do_lowpower(cpu, &spurious);
pr_debug("CPU%u: %s: normal wakeup\n", cpu, __func__);
cpu_leave_lowpower();
if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
}
int platform_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
* e.g. clock tick interrupts)
*/
return cpu == 0 ? -EPERM : 0;
}
#define CPU_SHIFT 0
#define CPU_MASK 0xF
#define CPU_OF(n) (((n) & CPU_MASK) << CPU_SHIFT)
#define CPUSET_SHIFT 4
#define CPUSET_MASK 0xFFFF
#define CPUSET_OF(n) (((n) & CPUSET_MASK) << CPUSET_SHIFT)
static int hotplug_rtb_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
/*
* Bits [19:4] of the data are the online mask, lower 4 bits are the
* cpu number that is being changed. Additionally, changes to the
* online_mask that will be done by the current hotplug will be made
* even though they aren't necessarily in the online mask yet.
*
* XXX: This design is limited to supporting at most 16 cpus
*/
int this_cpumask = CPUSET_OF(1 << (int)hcpu);
int cpumask = CPUSET_OF(cpumask_bits(cpu_online_mask)[0]);
int cpudata = CPU_OF((int)hcpu) | cpumask;
switch (action & (~CPU_TASKS_FROZEN)) {
case CPU_STARTING:
uncached_logk(LOGK_HOTPLUG, (void *)(cpudata | this_cpumask));
break;
case CPU_DYING:
uncached_logk(LOGK_HOTPLUG, (void *)(cpudata & ~this_cpumask));
break;
default:
break;
}
return NOTIFY_OK;
}
static struct notifier_block hotplug_rtb_notifier = {
.notifier_call = hotplug_rtb_callback,
};
int msm_platform_secondary_init(unsigned int cpu)
{
int ret;
struct msm_hotplug_device *dev = &__get_cpu_var(msm_hotplug_devices);
if (!dev->warm_boot) {
dev->warm_boot = 1;
init_completion(&dev->cpu_killed);
return 0;
}
msm_jtag_restore_state();
#if defined(CONFIG_VFP) && defined (CONFIG_CPU_PM)
vfp_pm_resume();
#endif
ret = msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING, false);
return ret;
}
static int __init init_hotplug(void)
{
struct msm_hotplug_device *dev = &__get_cpu_var(msm_hotplug_devices);
init_completion(&dev->cpu_killed);
return register_hotcpu_notifier(&hotplug_rtb_notifier);
}
early_initcall(init_hotplug);
|
/*
* Copyright (c) 2005, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* 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.
*
* 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.
* This sample test aims to check the following assertions:
*
* If SA_SIGINFO is set in sa_flags and Real Time Signals extension is supported,
* sa_sigaction is used as the signal handling function.
* The steps are:
* -> test for RTS extension
* -> register a handler for SIGXCPU with SA_SIGINFO, and a known function
* as sa_sigaction
* -> raise SIGXCPU, and check the function has been called.
* The test fails if the function is not called
*/
/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */
#define _POSIX_C_SOURCE 200112L
/******************************************************************************/
/*************************** standard includes ********************************/
/******************************************************************************/
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/******************************************************************************/
/*************************** Test framework *******************************/
/******************************************************************************/
#include "../testfrmw/testfrmw.h"
#include "../testfrmw/testfrmw.c"
/* This header is responsible for defining the following macros:
* UNRESOLVED(ret, descr);
* where descr is a description of the error and ret is an int
* (error code for example)
* FAILED(descr);
* where descr is a short text saying why the test has failed.
* PASSED();
* No parameter.
*
* Both three macros shall terminate the calling process.
* The testcase shall not terminate in any other maneer.
*
* The other file defines the functions
* void output_init()
* void output(char * string, ...)
*
* Those may be used to output information.
*/
/******************************************************************************/
/**************************** Configuration ***********************************/
/******************************************************************************/
#ifndef VERBOSE
#define VERBOSE 1
#endif
#define SIGNAL SIGXCPU
/******************************************************************************/
/*************************** Test case ***********************************/
/******************************************************************************/
int called = 0;
void handler(int sig, siginfo_t * info, void *context)
{
if (info->si_signo != SIGNAL) {
FAILED("Wrong signal generated?");
}
called = 1;
}
/* main function */
int main()
{
int ret;
long rts;
struct sigaction sa;
/* Initialize output */
output_init();
/* Test the RTS extension */
rts = sysconf(_SC_REALTIME_SIGNALS);
if (rts < 0L) {
UNTESTED("This test needs the RTS extension");
}
/* Set the signal handler */
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = handler;
ret = sigemptyset(&sa.sa_mask);
if (ret != 0) {
UNRESOLVED(ret, "Failed to empty signal set");
}
/* Install the signal handler for SIGXCPU */
ret = sigaction(SIGNAL, &sa, 0);
if (ret != 0) {
UNRESOLVED(ret, "Failed to set signal handler");
}
if (called) {
FAILED
("The signal handler has been called when no signal was raised");
}
ret = raise(SIGNAL);
if (ret != 0) {
UNRESOLVED(ret, "Failed to raise SIGXCPU");
}
if (!called) {
FAILED
("the sa_handler was not called whereas SA_SIGINFO was not set");
}
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
|
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __Q6_ADM_H__
#define __Q6_ADM_H__
#ifdef CONFIG_INCALL_RECORDING_PATCH
int adm_open(int port, int path, int rate, int mode, int topology);
#else
int adm_open(int port, int session, int path,
int rate, int mode, int topology);
#endif /*CONFIG_INCALL_RECORDING_PATCH*/
int adm_memory_map_regions(uint32_t *buf_add, uint32_t mempool_id,
uint32_t *bufsz, uint32_t bufcnt);
int adm_memory_unmap_regions(uint32_t *buf_add, uint32_t *bufsz,
uint32_t bufcnt);
int adm_close(int port);
#ifdef CONFIG_INCALL_RECORDING_PATCH
int adm_matrix_map(int session_id, int path, int num_copps, int *port_id);
#endif /*CONFIG_INCALL_RECORDING_PATCH*/
#endif /* __Q6_ADM_H__ */
|
#pragma once
#include <Common/stdtypes.h>
#ifdef ANDROID
void UpdateScreenResolution(int ScreenWidth, int ScreenHeight);
#else
const char ** getFullScreenResList(int32_t * Size);
uint32_t getFullScreenRes(uint32_t * width, uint32_t * height);
#endif
uint32_t GetScreenResolutionCount();
uint32_t GetDefaultScreenRes();
uint32_t GetScreenResWidth(uint32_t index);
uint32_t GetScreenResHeight(uint32_t index);
const char * GetScreenResolutionName(uint32_t index);
int GetCurrentResIndex(void);
uint32_t GetFullScreenResWidth(uint32_t index);
uint32_t GetFullScreenResHeight(uint32_t index);
bool EnterFullScreen(uint32_t index);
|
/*
* Part of The TCMP Matroska CDL, and Matroska Shell Extension
*
* MP3TagReader.h
*
* Copyright (C) Jory Stone - 2003
*
* The TCMP Matroska CDL 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.
*
* The TCMP Matroska CDL 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 TCMP Matroska CDL; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*!
\file AviTagReader.h
\version \$Id: MP3TagReader.h,v 1.3 2004/02/09 23:14:14 jcsston Exp $
\brief A MP3 ID3 Tag Importer
\author Jory Stone <jcsston @ toughguy.net>
*/
#ifndef _MP3_TAG_READER_H_
#define _MP3_TAG_READER_H_
#include "TagReader.h"
#include <time.h>
#include "MatroskaUtilsReader.h"
#ifdef USING_ID3LIB
// Dll link
#define ID3LIB_LINKOPTION 3
// Static link
//#define ID3LIB_LINKOPTION 1
#include <id3/tag.h>
//#include "id3.h"
#endif
class MP3TagReader : public TagReader {
public:
MP3TagReader(const JString &filename);
~MP3TagReader();
void ReadFile(const JString &filename);
bool HasTags();
void ImportTags(MatroskaTagInfo *target);
protected:
JString m_MP3Filename;
#ifdef USING_ID3LIB
ID3_Tag m_Tag;
#endif
};
#endif // _MP3_TAG_READER_H_
|
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include "mp_mul.h"
#include "mp_mod.h"
void hex_out(FILE *fp, uint64_t data[], uint64_t size)
{
uint64_t i;
for(i = 0; i < size; i++) fprintf(fp, "%016lx", data[size - i - 1]);
fprintf(fp, "\n");
return;
}
int main(int argc, char *argv[])
{
uint64_t a[6], b[6], c[12], r[6];
//input
a[5] = 0xaa87ca22be8b0537;
a[4] = 0x8eb1c71ef320ad74;
a[3] = 0x6e1d3b628ba79b98;
a[2] = 0x59f741e082542a38;
a[1] = 0x5502f25dbf55296c;
a[0] = 0x3a545e3872760aB7;
b[5] = 0x3617de4a96262c6f;
b[4] = 0x5d9e98bf9292dc29;
b[3] = 0xf8f41dbd289a147c;
b[2] = 0xe9da3113b5f0b8c0;
b[1] = 0x0a60b1ce1d7e819d;
b[0] = 0x7a431d7c90ea0e5F;
//process
mp_mul_384(c, a, b);//c = a * b
mp_mod_384(r, c);//r = c mod p
//output
hex_out(stdout, c, 12);
hex_out(stdout, r, 6);
exit(EXIT_SUCCESS);
}
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:35 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm/page_64.h */
#ifndef _X86_64_PAGE_H
#if defined(__cplusplus) && !CLICK_CXX_PROTECTED
# error "missing #include <click/cxxprotect.h>"
#endif
#define _X86_64_PAGE_H
#define PAGETABLE_LEVELS 4
#define THREAD_ORDER 1
#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
#define CURRENT_MASK (~(THREAD_SIZE - 1))
#define EXCEPTION_STACK_ORDER 0
#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
#define IRQSTACK_ORDER 2
#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
#define STACKFAULT_STACK 1
#define DOUBLEFAULT_STACK 2
#define NMI_STACK 3
#define DEBUG_STACK 4
#define MCE_STACK 5
#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
/*
* Set __PAGE_OFFSET to the most negative possible address +
* PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a
* hypervisor to fit. Choosing 16 slots here is arbitrary, but it's
* what Xen requires.
*/
#define __PAGE_OFFSET _AC(0xffff880000000000, UL)
#define __PHYSICAL_START CONFIG_PHYSICAL_START
#define __KERNEL_ALIGN 0x200000
/*
* Make sure kernel is aligned to 2MB address. Catching it at compile
* time is better. Change your config file and compile the kernel
* for a 2MB aligned address (CONFIG_PHYSICAL_START)
*/
#if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
#error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
#endif
#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
#define __START_KERNEL_map _AC(0xffffffff80000000, UL)
/* See Documentation/x86_64/mm.txt for a description of the memory map. */
#define __PHYSICAL_MASK_SHIFT 46
#define __VIRTUAL_MASK_SHIFT 48
/*
* Kernel image size is limited to 512 MB (see level2_kernel_pgt in
* arch/x86/kernel/head_64.S), and it is mapped here:
*/
#define KERNEL_IMAGE_SIZE (512 * 1024 * 1024)
#define KERNEL_IMAGE_START _AC(0xffffffff80000000, UL)
#ifndef __ASSEMBLY__
void clear_page(void *page);
void copy_page(void *to, void *from);
/* duplicated to the one in bootmem.h */
extern unsigned long max_pfn;
extern unsigned long phys_base;
extern unsigned long __phys_addr(unsigned long);
#define __phys_reloc_hide(x) (x)
/*
* These are used to make use of C type-checking..
*/
typedef unsigned long pteval_t;
typedef unsigned long pmdval_t;
typedef unsigned long pudval_t;
typedef unsigned long pgdval_t;
typedef unsigned long pgprotval_t;
typedef unsigned long phys_addr_t;
typedef struct page *pgtable_t;
typedef struct { pteval_t pte; } pte_t;
#define vmemmap ((struct page *)VMEMMAP_START)
extern unsigned long init_memory_mapping(unsigned long start,
unsigned long end);
extern void initmem_init(unsigned long start_pfn, unsigned long end_pfn);
extern void init_extra_mapping_uc(unsigned long phys, unsigned long size);
extern void init_extra_mapping_wb(unsigned long phys, unsigned long size);
#endif /* !__ASSEMBLY__ */
#ifdef CONFIG_FLATMEM
#define pfn_valid(pfn) ((pfn) < max_pfn)
#endif
#endif /* _X86_64_PAGE_H */
|
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
#include <asm/types.h>
#include <asm/setup.h>
#include <asm/memory.h>
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
#define COYOTE_IDE_REGION_SIZE 0x1000
#define COYOTE_IDE_DATA_PORT 0xFFFE10E0
#define COYOTE_IDE_CTRL_PORT 0xFFFE10FC
#define COYOTE_IDE_ERROR_PORT 0xFFFE10E2
#define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
static struct flash_platform_data coyote_flash_data = {
.map_name = "cfi_probe",
.width = 2,
};
static struct resource coyote_flash_resource = {
.flags = IORESOURCE_MEM,
};
static struct platform_device coyote_flash = {
.name = "IXP4XX-Flash",
.id = 0,
.dev = {
.platform_data = &coyote_flash_data,
},
.num_resources = 1,
.resource = &coyote_flash_resource,
};
static struct resource coyote_uart_resource = {
.start = IXP4XX_UART2_BASE_PHYS,
.end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
.flags = IORESOURCE_MEM,
};
static struct plat_serial8250_port coyote_uart_data[] = {
{
.mapbase = IXP4XX_UART2_BASE_PHYS,
.membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
.irq = IRQ_IXP4XX_UART2,
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = IXP4XX_UART_XTAL,
},
{ },
};
static struct platform_device coyote_uart = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = coyote_uart_data,
},
.num_resources = 1,
.resource = &coyote_uart_resource,
};
static struct platform_device *coyote_devices[] __initdata = {
&coyote_flash,
&coyote_uart
};
static void __init coyote_init(void)
{
ixp4xx_sys_init();
coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
if (machine_is_ixdpg425()) {
coyote_uart_data[0].membase =
(char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
}
platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
}
#ifdef CONFIG_ARCH_ADI_COYOTE
MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
/* Maintainer: MontaVista Software, Inc. */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
.map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq,
.timer = &ixp4xx_timer,
.boot_params = 0x0100,
.init_machine = coyote_init,
MACHINE_END
#endif
#ifdef CONFIG_MACH_IXDPG425
MACHINE_START(IXDPG425, "Intel IXDPG425")
/* Maintainer: MontaVista Software, Inc. */
.phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
.io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
.map_io = ixp4xx_map_io,
.init_irq = ixp4xx_init_irq,
.timer = &ixp4xx_timer,
.boot_params = 0x0100,
.init_machine = coyote_init,
MACHINE_END
#endif
|
#include <gtk/gtk.h>
GtkWidget *okno;
GtkWidget *kontener;
int koniec;
int yy;
int sx, sy;
static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event)
{
if(event->button == 1) printf("ok");
sx = (int) event->x;
sy = (int) event->y;
return TRUE;
}
static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
{
int x, y;
GdkModifierType state;
gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(okno)), &x, &y, &state);
if(state&GDK_BUTTON1_MASK)
{
gtk_fixed_move((GtkFixed*)kontener, (GtkWidget*)widget, x-sx, y-sy);
}
return TRUE;
}
gboolean przesun_widget(GtkWidget *w, GdkEvent *e, gpointer d)
{
GdkEventMotion *event = (GdkEventMotion*)e;
if (event->state == GDK_BUTTON1_MASK)
// if(koniec)
{
char polozenie[10];
sprintf(polozenie, "%d, %d", (guint)event->x, (guint)event->y);
gtk_window_set_title((GtkWindow*)okno, polozenie);
gtk_fixed_move((GtkFixed*)kontener, w, (guint)event->x, (guint)event->y);
}
if (event->state == GDK_BUTTON_RELEASE_MASK)
{
gtk_window_set_title((GtkWindow*)okno, "test");
g_signal_handler_disconnect(okno, yy);
yy = 0 ;
}
return TRUE;
}
void wez_widget(GtkWidget *w, GdkEvent *e, gpointer d)
{
//GdkEventMotion *event = (GdkEventMotion*)e;
//gtk_fixed_move((GtkFixed*)kontener, d, (guint)e->x, (guint)e->y);
koniec = 1;
yy = g_signal_connect(G_OBJECT(okno), "motion_notify_event", G_CALLBACK(motion_notify_event), w);
}
void pusc_widget(GtkWidget *w, gpointer d)
{
koniec = 0;
//g_signal_handler_disconnect(okno, yy);
}
void dodaj_widget(GtkWidget *w, GdkEvent *e, gpointer d)
{
GtkWidget *widget = gtk_button_new_with_label("Przycisk");
gtk_widget_set_size_request(widget, 180, 35);
gtk_fixed_put(GTK_FIXED(d), widget, 200, 100);
g_signal_connect(G_OBJECT(widget), "button_press_event", G_CALLBACK(button_press_event), d);
gtk_widget_set_events(widget, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
//g_signal_connect(G_OBJECT(widget), "button_release_event", G_CALLBACK(pusc_widget), d);
g_signal_connect(G_OBJECT(widget), "motion_notify_event", G_CALLBACK(motion_notify_event), w);
printf("ok");
gtk_widget_show(widget);
}
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
okno = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(okno), 400, 400);
gtk_window_set_position(GTK_WINDOW(okno), GTK_WIN_POS_CENTER);
gtk_window_set_title(GTK_WINDOW(okno), "Projektor Gtk");
g_signal_connect(G_OBJECT(okno), "destroy", G_CALLBACK(gtk_main_quit), NULL);
kontener = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(okno), kontener);
GtkWidget *przycisk = gtk_button_new_with_label("Przycisk");
gtk_widget_set_size_request(przycisk, 180, 35);
gtk_fixed_put(GTK_FIXED(kontener), przycisk, 10, 10);
g_signal_connect(G_OBJECT(przycisk), "clicked", G_CALLBACK(dodaj_widget), kontener);
gtk_widget_set_events(okno, GDK_BUTTON1_MOTION_MASK|GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_events(okno, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
gtk_widget_show_all(okno);
gtk_main();
return 0;
}
|
/*
* $Id: nioConvert.h,v 1.1 2009-05-15 00:49:27 dbrown Exp $
*/
/************************************************************************
* *
* Copyright (C) 1992 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
************************************************************************/
/*
* File: Convert.h
*
* Author: Jeff W. Boote
* National Center for Atmospheric Research
* PO 3000, Boulder, Colorado
*
* Date: Fri Sep 11 13:26:02 MDT 1992
*
* Description: This file contains all the public declarations
* neccessary to use type conversion. It should be
* included from hlu.h so everything get's these
* declarations.
*/
#ifndef _NCONVERT_H
#define _NCONVERT_H
/* used to set args for converters during registration */
typedef enum _NhlConvertAddrModes{
NhlIMMEDIATE, /* values that fit in an NhlArgVal only! */
NhlADDR,
NhlSTRENUM, /* a hack - the size parameter is data */
NhlLAYEROFFSET
} NhlConvertAddrModes;
typedef struct _NhlConvertArg{
NhlConvertAddrModes addressmode;
int size;
NhlArgVal data;
} NhlConvertArg, *NhlConvertArgList;
/* opaque type for un-re registering */
typedef struct _NhlConvertRec NhlConvertRec, *NhlConvertPtr;
/* type for converter functions */
typedef NhlErrorTypes (*NhlTypeConverter)(
#if NhlNeedProto
NrmValue *from,
NrmValue *to,
NhlConvertArgList args,
int nargs
#endif
);
/* type for closure functions */
typedef void (*NhlCacheClosure)(
#if NhlNeedProto
NrmValue from,
NrmValue to
#endif
);
/*
* Conversion functions
*/
extern NhlErrorTypes NhlRegisterConverter(
#if NhlNeedProto
NhlClass ref_class,
NhlString from,
NhlString to,
NhlTypeConverter convert,
NhlConvertArgList args,
int nargs,
NhlBoolean cache,
NhlCacheClosure close
#endif
);
extern NhlErrorTypes NhlDeleteConverter(
#if NhlNeedProto
NhlClass ref_class,
NhlString from,
NhlString to
#endif
);
extern NhlErrorTypes NhlUnRegisterConverter(
#if NhlNeedProto
NhlClass ref_class,
NhlString from,
NhlString to,
NhlConvertPtr* ptr
#endif
);
extern NhlErrorTypes NhlReRegisterConverter(
#if NhlNeedProto
NhlConvertPtr ptr /* identifies converter to re-install */
#endif
);
extern NhlErrorTypes NhlConvertData(
#if NhlNeedProto
int ref_obj,
NhlString from,
NhlString to,
NrmValue* fptr,
NrmValue* tptr
#endif
);
/*
* These functions are for use inside Converter functions.
*/
extern NhlPointer NhlConvertMalloc(
#if NhlNeedProto
unsigned int size /* size of memory requested */
#endif
);
extern NhlGenArray NhlAllocCreateGenArray(
#if NhlNeedProto
NhlPointer data, /* data array */
NhlString type, /* type of each element */
unsigned int size, /* size of each element */
int num_dimensions, /* number of dimensions */
ng_size_t *len_dimensions /* number of dimensions */
#endif
);
/*
* This function is used as an indirection of the converter. If two
* types are equivalent (but have different names), this is one way to call
* a previously installed converter to convert the data.
*/
extern NhlErrorTypes NhlReConvertData(
#if NhlNeedProto
NhlString fname, /* from type */
NhlString tname, /* to type */
NrmValue *from, /* ptr to from data */
NrmValue *to /* ptr to to data */
#endif
);
#endif /* _NCONVERT_H */
|
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __EXTERNAL_COMMON_H__
#define __EXTERNAL_COMMON_H__
#include <linux/switch.h>
#include <video/msm_hdmi_modes.h>
#ifdef DEBUG
#ifndef DEV_DBG_PREFIX
#define DEV_DBG_PREFIX "EXT_INTERFACE: "
#endif
#define DEV_DBG(args...) pr_info(DEV_DBG_PREFIX args)
#else
#define DEV_DBG(args...) (void)0
#endif /* DEBUG */
#define DEV_INFO(args...) dev_info(external_common_state->dev, args)
#define DEV_WARN(args...) dev_warn(external_common_state->dev, args)
#define DEV_ERR(args...) dev_err(external_common_state->dev, args)
#if defined(CONFIG_FB_MSM_HDMI_COMMON)
extern int ext_resolution;
/* A lookup table for all the supported display modes by the HDMI
* hardware and driver. Use HDMI_SETUP_LUT in the module init to
* setup the LUT with the supported modes. */
extern struct msm_hdmi_mode_timing_info
hdmi_common_supported_video_mode_lut[HDMI_VFRMT_MAX];
/* Structure that encapsulates all the supported display modes by the HDMI sink
* device */
struct hdmi_disp_mode_list_type {
uint32 disp_mode_list[HDMI_VFRMT_MAX];
#define TOP_AND_BOTTOM 0x10
#define FRAME_PACKING 0x20
#define SIDE_BY_SIDE_HALF 0x40
uint32 disp_3d_mode_list[HDMI_VFRMT_MAX];
uint32 disp_multi_3d_mode_list[16];
uint32 disp_multi_3d_mode_list_cnt;
uint32 num_of_elements;
};
#endif
/*
* As per the CEA-861E spec, there can be a total of 10 short audio
* descriptors with each SAD being 3 bytes long.
* Thus, the maximum length of the audio data block would be 30 bytes
*/
#define MAX_AUDIO_DATA_BLOCK_SIZE 30
#define MAX_SPKR_ALLOC_DATA_BLOCK_SIZE 3
struct external_common_state_type {
boolean hpd_state;
boolean pre_suspend_hpd_state;
struct kobject *uevent_kobj;
uint32 video_resolution;
struct device *dev;
struct switch_dev sdev;
struct switch_dev audio_sdev;
#ifdef CONFIG_FB_MSM_HDMI_3D
boolean format_3d;
void (*switch_3d)(boolean on);
#endif
#ifdef CONFIG_FB_MSM_HDMI_COMMON
boolean hdcp_active;
boolean hpd_feature_on;
boolean hdmi_sink;
struct hdmi_disp_mode_list_type disp_mode_list;
uint16 video_latency, audio_latency;
uint16 physical_address;
uint32 preferred_video_format;
uint8 pt_scan_info;
uint8 it_scan_info;
uint8 ce_scan_info;
uint8 spd_vendor_name[9];
uint8 spd_product_description[17];
boolean present_3d;
boolean present_hdcp;
uint8 audio_data_block[MAX_AUDIO_DATA_BLOCK_SIZE];
int adb_size;
uint8 spkr_alloc_data_block[MAX_SPKR_ALLOC_DATA_BLOCK_SIZE];
int sadb_size;
int (*read_edid_block)(int block, uint8 *edid_buf);
int (*hpd_feature)(int on);
#endif
#ifdef CONFIG_MACH_LGE
boolean boot_completed;
boolean external_block;
#endif
};
/* The external interface driver needs to initialize the common state. */
extern struct external_common_state_type *external_common_state;
extern struct mutex external_common_state_hpd_mutex;
extern struct mutex hdmi_msm_state_mutex;
#ifdef CONFIG_FB_MSM_HDMI_COMMON
int hdmi_common_read_edid(void);
const char *video_format_2string(uint32 format);
bool hdmi_common_get_video_format_from_drv_data(struct msm_fb_data_type *mfd);
const struct msm_hdmi_mode_timing_info *hdmi_common_get_mode(uint32 mode);
const struct msm_hdmi_mode_timing_info *hdmi_common_get_supported_mode(
uint32 mode);
const struct msm_hdmi_mode_timing_info *hdmi_mhl_get_mode(uint32 mode);
const struct msm_hdmi_mode_timing_info *hdmi_mhl_get_supported_mode(
uint32 mode);
void hdmi_common_init_panel_info(struct msm_panel_info *pinfo);
ssize_t video_3d_format_2string(uint32 format, char *buf);
#endif
int external_common_state_create(struct platform_device *pdev);
void external_common_state_remove(void);
#endif /* __EXTERNAL_COMMON_H__ */
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
#define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_
#pragma once
#include <vector>
class GURL;
class URLPattern;
class ExtensionExtent {
public:
typedef std::vector<URLPattern> PatternList;
ExtensionExtent();
ExtensionExtent(const ExtensionExtent& rhs);
~ExtensionExtent();
ExtensionExtent& operator=(const ExtensionExtent& rhs);
bool is_empty() const;
const PatternList& patterns() const { return patterns_; }
void AddPattern(const URLPattern& pattern);
void ClearPaths();
bool ContainsURL(const GURL& url) const;
bool OverlapsWith(const ExtensionExtent& other) const;
private:
PatternList patterns_;
};
#endif
|
/*
UserinfoEx plugin for Miranda IM
Copyright:
© 2006-2010 DeathAxe, Yasnovidyashii, Merlin, K. Romanov, Kreol
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.
*/
//Not including CRLFs
//NOTE: For BASE64 and UUENCODE, this actually
//represents the amount of unencoded characters
//per line
#define TSSMTPMAX_QP_LINE_LENGTH 76
#define TSSMTPMAX_BASE64_LINE_LENGTH 57
#define TSSMTPMAX_UUENCODE_LINE_LENGTH 45
//=======================================================================
// Quoted Printable encode/decode
// compliant with RFC 2045
//=======================================================================
//
#define TSSMTPQPENCODE_DOT 1
#define TSSMTPQPENCODE_TRAILING_SOFT 2
inline INT_PTR QPEncodeGetRequiredLength(INT_PTR nSrcLen)
{
INT_PTR nRet = 3*((3*nSrcLen)/(TSSMTPMAX_QP_LINE_LENGTH-8));
nRet += 3*nSrcLen;
nRet += 3;
return nRet;
}
inline INT_PTR QPDecodeGetRequiredLength(INT_PTR nSrcLen)
{
return nSrcLen;
}
inline BOOL QPEncode(uint8_t *pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR *pnDestLen, uint8_t *bEncoded, uint32_t dwFlags = 0)
{
//The hexadecimal character set
static const CHAR s_chHexChars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' };
INT_PTR nRead = 0, nWritten = 0, nLineLen = 0;
CHAR ch;
uint8_t bChanged = FALSE;
if (!pbSrcData || !szDest || !pnDestLen)
return FALSE;
while (nRead < nSrcLen) {
ch = *pbSrcData++;
nRead++;
if (nLineLen == 0 && ch == '.' && (dwFlags & TSSMTPQPENCODE_DOT)) {
*szDest++ = '.';
nWritten++;
nLineLen++;
bChanged = TRUE;
}
if ((ch > 32 && ch < 61) || (ch > 61 && ch < 127)) {
*szDest++ = ch;
nWritten++;
nLineLen++;
}
else
if ((ch == ' ' || ch == '\t') && (nLineLen < (TSSMTPMAX_QP_LINE_LENGTH - 12))) {
*szDest++ = ch;
nWritten++;
nLineLen++;
}
else {
*szDest++ = '=';
*szDest++ = s_chHexChars[(ch >> 4) & 0x0F];
*szDest++ = s_chHexChars[ch & 0x0F];
nWritten += 3;
nLineLen += 3;
bChanged = TRUE;
}
if (nLineLen >= (TSSMTPMAX_QP_LINE_LENGTH - 11)) {
*szDest++ = '=';
*szDest++ = '\r';
*szDest++ = '\n';
nLineLen = 0;
nWritten += 3;
bChanged = TRUE;
}
}
if (dwFlags & TSSMTPQPENCODE_TRAILING_SOFT) {
*szDest++ = '=';
*szDest++ = '\r';
*szDest++ = '\n';
nWritten += 3;
bChanged = TRUE;
}
*pnDestLen = nWritten;
if (bEncoded) *bEncoded = bChanged;
return TRUE;
}
inline BOOL QPDecode(uint8_t *pbSrcData, INT_PTR nSrcLen, LPSTR szDest, INT_PTR *pnDestLen, uint32_t dwFlags = 0)
{
if (!pbSrcData || !szDest || !pnDestLen) {
return FALSE;
}
INT_PTR nRead = 0, nWritten = 0, nLineLen = -1;
char ch;
while (nRead <= nSrcLen) {
ch = *pbSrcData++;
nRead++;
nLineLen++;
if (ch == '=') {
// if the next character is a digit or a character, convert
if (nRead < nSrcLen && (isdigit(*pbSrcData) || isalpha(*pbSrcData))) {
char szBuf[5];
szBuf[0] = *pbSrcData++;
szBuf[1] = *pbSrcData++;
szBuf[2] = '\0';
char *tmp = '\0';
*szDest++ = (uint8_t)strtoul(szBuf, &tmp, 16);
nWritten++;
nRead += 2;
continue;
}
// if the next character is a carriage return or line break, eat it
if (nRead < nSrcLen && *pbSrcData == '\r' && (nRead + 1 < nSrcLen) && *(pbSrcData + 1) == '\n') {
pbSrcData++;
nRead++;
nLineLen = -1;
continue;
}
return FALSE;
}
if (ch == '\r' || ch == '\n') {
nLineLen = -1;
continue;
}
if ((dwFlags & TSSMTPQPENCODE_DOT) && ch == '.' && nLineLen == 0) {
continue;
}
*szDest++ = ch;
nWritten++;
}
*pnDestLen = nWritten - 1;
return TRUE;
}
|
#ifndef _UAPI_ASM_X86_E820_H
#define _UAPI_ASM_X86_E820_H
#define E820MAP 0x2d0 /* our map */
#define E820MAX 128 /* number of entries in E820MAP */
/*
* Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the
* constrained space in the zeropage. If we have more nodes than
* that, and if we've booted off EFI firmware, then the EFI tables
* passed us from the EFI firmware can list more nodes. Size our
* internal memory map tables to have room for these additional
* nodes, based on up to three entries per node for which the
* kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT),
* plus E820MAX, allowing space for the possible duplicate E820
* entries that might need room in the same arrays, prior to the
* call to sanitize_e820_map() to remove duplicates. The allowance
* of three memory map entries per node is "enough" entries for
* the initial hardware platform motivating this mechanism to make
* use of additional EFI map entries. Future platforms may want
* to allow more than three entries per node or otherwise refine
* this size.
*/
/*
* Odd: 'make headers_check' complains about numa.h if I try
* to collapse the next two #ifdef lines to a single line:
* #if defined(__KERNEL__) && defined(CONFIG_EFI)
*/
#ifndef __KERNEL__
#define E820_X_MAX E820MAX
#endif
#define E820NR 0x1e8 /* # entries in E820MAP */
#define E820_RAM 1
#define E820_RESERVED 2
#define E820_ACPI 3
#define E820_NVS 4
#define E820_UNUSABLE 5
/*
* reserved RAM used by kernel itself
* if CONFIG_INTEL_TXT is enabled, memory of this type will be
* included in the S3 integrity calculation and so should not include
* any memory that BIOS might alter over the S3 transition
*/
#define E820_RESERVED_KERN 128
#ifndef __ASSEMBLY__
#include <linux/types.h>
struct e820entry {
__u64 addr; /* start of memory segment */
__u64 size; /* size of memory segment */
__u32 type; /* type of memory segment */
} __attribute__((packed));
struct e820map {
__u32 nr_map;
struct e820entry map[E820_X_MAX];
};
#ifndef CONFIG_XEN
#define ISA_START_ADDRESS 0xa0000
#else
#define ISA_START_ADDRESS 0
#endif
#define ISA_END_ADDRESS 0x100000
#define BIOS_BEGIN 0x000a0000
#define BIOS_END 0x00100000
#define BIOS_ROM_BASE 0xffe00000
#define BIOS_ROM_END 0xffffffff
#endif /* __ASSEMBLY__ */
#endif /* _UAPI_ASM_X86_E820_H */
|
#include <stdio.h>
#include <stdlib.h>
int connect_wireless(char *essid, char *this_ip, char *ping_ip)
{
char cmd[100];
int retval;
int n = 0;
snprintf(cmd, sizeof(cmd), "ifconfig wlan0 up");
printf("%s\n", cmd);
while (1)
{
retval = system(cmd);
if (retval == 0)
{
break;
}
printf("Can't bring wlan0 up, will try again (%d)\n", n++);
sleep(2);
}
snprintf(cmd, sizeof(cmd), "iwconfig wlan0 essid %s", essid);
printf("%s\n", cmd);
n = 0;
while (1)
{
retval = system(cmd);
if (retval == 0)
{
break;
}
printf("Can't set essid \"%s\", will try again (%d)\n", essid, n++);
sleep(2);
}
snprintf(cmd, sizeof(cmd), "ifconfig wlan0 %s", this_ip);
printf("%s\n", cmd);
n = 0;
while (1)
{
retval = system(cmd);
if (retval == 0)
{
break;
}
printf("Can't configure wlan0 for %s (%d)\n", this_ip, n++);
sleep(2);
}
snprintf(cmd, sizeof(cmd), "ping -c 1 %s", ping_ip, n++);
printf("%s\n", cmd);
n = 0;
while (1)
{
retval = system(cmd);
if (retval == 0)
{
break;
}
printf("Can't can' ping %s (%d)\n", ping_ip, n++);
sleep(2);
}
printf("Connected!!!!!!!!!\n", ping_ip, n++);
return 0;
}
int main(int argc, char *argv[])
{
if (argc > 1)
connect_wireless("CARR_UDG", "192.168.1.55", "192.168.1.1");
else
connect_wireless("CARR_DLINK_DI624", "192.168.0.55", "192.168.0.1");
}
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nemo-progress-info.h: file operation progress info.
Copyright (C) 2007 Red Hat, 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/>.
Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef NEMO_PROGRESS_INFO_H
#define NEMO_PROGRESS_INFO_H
#include <glib-object.h>
#include <gio/gio.h>
#define NEMO_TYPE_PROGRESS_INFO (nemo_progress_info_get_type ())
#define NEMO_PROGRESS_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NEMO_TYPE_PROGRESS_INFO, NemoProgressInfo))
#define NEMO_PROGRESS_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NEMO_TYPE_PROGRESS_INFO, NemoProgressInfoClass))
#define NEMO_IS_PROGRESS_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NEMO_TYPE_PROGRESS_INFO))
#define NEMO_IS_PROGRESS_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NEMO_TYPE_PROGRESS_INFO))
#define NEMO_PROGRESS_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NEMO_TYPE_PROGRESS_INFO, NemoProgressInfoClass))
typedef struct _NemoProgressInfo NemoProgressInfo;
typedef struct _NemoProgressInfoClass NemoProgressInfoClass;
GType nemo_progress_info_get_type (void) G_GNUC_CONST;
/* Signals:
"changed" - status or details changed
"progress-changed" - the percentage progress changed (or we pulsed if in activity_mode
"started" - emited on job start
"finished" - emitted when job is done
All signals are emitted from idles in main loop.
All methods are threadsafe.
*/
NemoProgressInfo *nemo_progress_info_new (void);
GList * nemo_get_all_progress_info (void);
char * nemo_progress_info_get_status (NemoProgressInfo *info);
char * nemo_progress_info_get_details (NemoProgressInfo *info);
char * nemo_progress_info_get_initial_details (NemoProgressInfo *info);
double nemo_progress_info_get_progress (NemoProgressInfo *info);
GCancellable *nemo_progress_info_get_cancellable (NemoProgressInfo *info);
void nemo_progress_info_cancel (NemoProgressInfo *info);
gboolean nemo_progress_info_get_is_started (NemoProgressInfo *info);
gboolean nemo_progress_info_get_is_finished (NemoProgressInfo *info);
gboolean nemo_progress_info_get_is_paused (NemoProgressInfo *info);
double nemo_progress_info_get_current (NemoProgressInfo *info);
double nemo_progress_info_get_total (NemoProgressInfo *info);
void nemo_progress_info_queue (NemoProgressInfo *info);
void nemo_progress_info_start (NemoProgressInfo *info);
void nemo_progress_info_finish (NemoProgressInfo *info);
void nemo_progress_info_pause (NemoProgressInfo *info);
void nemo_progress_info_resume (NemoProgressInfo *info);
void nemo_progress_info_set_status (NemoProgressInfo *info,
const char *status);
void nemo_progress_info_take_status (NemoProgressInfo *info,
char *status);
void nemo_progress_info_set_details (NemoProgressInfo *info,
const char *details);
void nemo_progress_info_take_initial_details (NemoProgressInfo *info,
char *initial_details);
void nemo_progress_info_take_details (NemoProgressInfo *info,
char *details);
void nemo_progress_info_set_progress (NemoProgressInfo *info,
double current,
double total);
void nemo_progress_info_pulse_progress (NemoProgressInfo *info);
#endif /* NEMO_PROGRESS_INFO_H */
|
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef DEF_ZULGURUB_H
#define DEF_ZULGURUB_H
enum
{
MAX_ENCOUNTER = 8,
MAX_PRIESTS = 5,
TYPE_JEKLIK = 0,
TYPE_VENOXIS = 1,
TYPE_MARLI = 2,
TYPE_THEKAL = 3,
TYPE_ARLOKK = 4,
TYPE_OHGAN = 5, // Do not change, used by Acid
TYPE_LORKHAN = 6,
TYPE_ZATH = 7,
NPC_LORKHAN = 11347,
NPC_ZATH = 11348,
NPC_THEKAL = 14509,
NPC_JINDO = 11380,
NPC_HAKKAR = 14834,
NPC_PANTHER_TRIGGER = 15091,
NPC_BLOODLORD_MANDOKIR = 11382,
NPC_MARLI = 14510,
GO_SPIDER_EGG = 179985,
GO_GONG_OF_BETHEKK = 180526,
GO_FORCEFIELD = 180497,
SAY_MINION_DESTROY = -1309022,
SAY_HAKKAR_PROTECT = -1309023,
HP_LOSS_PER_PRIEST = 60000,
AREATRIGGER_ENTER = 3958,
AREATRIGGER_ALTAR = 3960,
};
static const float aMandokirDownstairsPos[3] = { -12196.30f, -1948.37f, 130.31f};
class instance_zulgurub : public ScriptedInstance
{
public:
instance_zulgurub(Map* pMap);
~instance_zulgurub() {}
void Initialize() override;
// IsEncounterInProgress() const override { return false; } // not active in Zul'Gurub
void OnCreatureCreate(Creature* pCreature) override;
void OnObjectCreate(GameObject* pGo) override;
void SetData(uint32 uiType, uint32 uiData) override;
uint32 GetData(uint32 uiType) const override;
const char* Save() const override { return m_strInstData.c_str(); }
void Load(const char* chrIn) override;
void DoYellAtTriggerIfCan(uint32 uiTriggerId);
Creature* SelectRandomPantherTrigger(bool bIsLeft);
protected:
void DoLowerHakkarHitPoints();
uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string m_strInstData;
GuidList m_lRightPantherTriggerGUIDList;
GuidList m_lLeftPantherTriggerGUIDList;
GuidList m_lSpiderEggGUIDList;
bool m_bHasIntroYelled;
bool m_bHasAltarYelled;
};
#endif
|
#ifndef _ASM_ARM_TRACE_CLOCK_OMAP3_H
#define _ASM_ARM_TRACE_CLOCK_OMAP3_H
#include <linux/clk.h>
#include <linux/timer.h>
#include <plat/clock.h>
#define TC_HW_BITS 31
/* Expected maximum interrupt latency in ms : 15ms, *2 for security */
#define TC_EXPECTED_INTERRUPT_LATENCY 30
/* Resync with 32k clock each 100ms */
#define TC_RESYNC_PERIOD 100
struct tc_cur_freq {
u64 cur_cpu_freq; /* in khz */
/* cur time : (now - base) * (max_freq / cur_freq) + base */
u32 mul_fact; /* (max_cpu_freq << 10) / cur_freq */
u64 hw_base; /* stamp of last cpufreq change, hw cycles */
u64 virt_base; /* same as above, virtual trace clock cycles */
u64 floor; /* floor value, so time never go back */
};
/* 32KHz counter per-cpu count save upon PM sleep and cpufreq management */
struct pm_save_count {
struct tc_cur_freq cf[2]; /* rcu-protected */
unsigned int index; /* tc_cur_freq current read index */
/*
* Is fast clock ready to be read ? Read with preemption off. Modified
* only by local CPU in thread and interrupt context or by start/stop
* when time is not read concurrently.
*/
int fast_clock_ready;
u64 int_fast_clock;
struct timer_list clear_ccnt_ms_timer;
struct timer_list clock_resync_timer;
u32 ext_32k;
int refcount;
u32 init_clock;
raw_spinlock_t lock; /* spinlock only sync the refcount */
unsigned int dvfs_count; /* Number of DVFS updates in period */
/* cpufreq management */
u64 max_cpu_freq; /* in khz */
};
DECLARE_PER_CPU(struct pm_save_count, pm_save_count);
extern u64 trace_clock_read_synthetic_tsc(void);
extern void _trace_clock_write_synthetic_tsc(u64 value);
extern unsigned long long cpu_hz;
DECLARE_PER_CPU(int, fast_clock_ready);
extern u64 _trace_clock_read_slow(void);
extern u64 trace_clock_async_tsc_read(void);
extern void _trace_clock_write_synthetic_tsc(u64 value);
#ifdef CONFIG_DEBUG_TRACE_CLOCK
DECLARE_PER_CPU(unsigned int, last_clock_nest);
extern void trace_clock_debug(u64 value);
#else
static inline void trace_clock_debug(u64 value)
{
}
#endif
static inline u32 read_ccnt(void)
{
u32 val;
__asm__ __volatile__ ("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
return val & ~(1 << TC_HW_BITS);
}
static inline u32 trace_clock_read32(void)
{
u32 val;
isb();
val = read_ccnt();
isb();
return val;
}
static inline u64 trace_clock_read64(void)
{
struct pm_save_count *pm_count;
struct tc_cur_freq *cf;
u64 val;
#ifdef CONFIG_DEBUG_TRACE_CLOCK
unsigned long flags;
local_irq_save(flags);
per_cpu(last_clock_nest, smp_processor_id())++;
barrier();
#endif
preempt_disable();
pm_count = &per_cpu(pm_save_count, smp_processor_id());
if (likely(pm_count->fast_clock_ready)) {
cf = &pm_count->cf[ACCESS_ONCE(pm_count->index)];
val = max((((trace_clock_read_synthetic_tsc() - cf->hw_base)
* cf->mul_fact) >> 10) + cf->virt_base, cf->floor);
} else
val = _trace_clock_read_slow();
trace_clock_debug(val);
preempt_enable();
#ifdef CONFIG_DEBUG_TRACE_CLOCK
barrier();
per_cpu(last_clock_nest, smp_processor_id())--;
local_irq_restore(flags);
#endif
return val;
}
static inline u64 trace_clock_frequency(void)
{
return cpu_hz;
}
static inline u32 trace_clock_freq_scale(void)
{
return 1;
}
extern void get_trace_clock(void);
extern void put_trace_clock(void);
extern void get_synthetic_tsc(void);
extern void put_synthetic_tsc(void);
extern void resync_trace_clock(void);
extern void save_sync_trace_clock(void);
extern void start_trace_clock(void);
extern void stop_trace_clock(void);
static inline void set_trace_clock_is_sync(int state)
{
}
#endif /* _ASM_MIPS_TRACE_CLOCK_OMAP3_H */
|
/*
* object_event_private.h: object event queue processing helpers
*
* Copyright (C) 2012-2014 Red Hat, Inc.
* Copyright (C) 2008 VirtualIron
* Copyright (C) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Author: Ben Guthro
*/
#include "datatypes.h"
#ifndef __OBJECT_EVENT_PRIVATE_H__
# define __OBJECT_EVENT_PRIVATE_H__
struct _virObjectMeta {
int id;
char *name;
unsigned char uuid[VIR_UUID_BUFLEN];
};
typedef struct _virObjectMeta virObjectMeta;
typedef virObjectMeta *virObjectMetaPtr;
typedef struct _virObjectEventCallbackList virObjectEventCallbackList;
typedef virObjectEventCallbackList *virObjectEventCallbackListPtr;
typedef void
(*virObjectEventDispatchFunc)(virConnectPtr conn,
virObjectEventPtr event,
virConnectObjectEventGenericCallback cb,
void *cbopaque);
struct _virObjectEvent {
virObject parent;
int eventID;
virObjectMeta meta;
virObjectEventDispatchFunc dispatch;
};
virClassPtr
virClassForObjectEvent(void);
int
virObjectEventStateCallbackID(virConnectPtr conn,
virObjectEventStatePtr state,
virClassPtr klass,
int eventID,
virConnectObjectEventGenericCallback callback)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(5);
void *
virObjectEventNew(virClassPtr klass,
virObjectEventDispatchFunc dispatcher,
int eventID,
int id,
const char *name,
const unsigned char *uuid)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_NONNULL(6);
#endif
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_
#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_NAME_FOLDER_CONTROLLER_H_
#pragma once
#import <Cocoa/Cocoa.h>
#include "base/memory/scoped_nsobject.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
class BookmarkModelObserverForCocoa;
@interface BookmarkNameFolderController : NSWindowController {
@private
IBOutlet NSTextField* nameField_;
IBOutlet NSButton* okButton_;
NSWindow* parentWindow_;
Profile* profile_;
const BookmarkNode* node_;
const BookmarkNode* parent_;
int newIndex_;
scoped_nsobject<NSString> initialName_;
scoped_ptr<BookmarkModelObserverForCocoa> observer_;
}
- (id)initWithParentWindow:(NSWindow*)window
profile:(Profile*)profile
node:(const BookmarkNode*)node;
- (id)initWithParentWindow:(NSWindow*)window
profile:(Profile*)profile
parent:(const BookmarkNode*)parent
newIndex:(int)newIndex;
- (void)runAsModalSheet;
- (IBAction)cancel:(id)sender;
- (IBAction)ok:(id)sender;
@end
@interface BookmarkNameFolderController(TestingAPI)
- (NSString*)folderName;
- (void)setFolderName:(NSString*)name;
- (NSButton*)okButton;
@end
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2012 Google 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; 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 <cbfs.h>
#include <types.h>
#include <arch/io.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <fmap.h>
#include <southbridge/intel/bd82x6x/pch.h>
#include "onboard.h"
static unsigned int search(char *p, u8 *a, unsigned int lengthp,
unsigned int lengtha)
{
int i, j;
/* Searching */
for (j = 0; j <= lengtha - lengthp; j++) {
for (i = 0; i < lengthp && p[i] == a[i + j]; i++)
;
if (i >= lengthp)
return j;
}
return lengtha;
}
static unsigned char get_hex_digit(u8 *offset)
{
unsigned char retval = 0;
retval = *offset - '0';
if (retval > 0x09) {
retval = *offset - 'A' + 0x0A;
if (retval > 0x0F)
retval = *offset - 'a' + 0x0a;
}
if (retval > 0x0F) {
printk(BIOS_DEBUG, "Error: Invalid Hex digit found: %c - 0x%02x\n",
*offset, *offset);
retval = 0;
}
return retval;
}
static int get_mac_address(u32 *high_dword, u32 *low_dword,
u8 *search_address, u32 search_length)
{
char key[] = "ethernet_mac";
unsigned int offset;
int i;
offset = search(key, search_address, sizeof(key) - 1, search_length);
if (offset == search_length) {
printk(BIOS_DEBUG,
"Error: Could not locate '%s' in VPD\n", key);
return 0;
}
printk(BIOS_DEBUG, "Located '%s' in VPD\n", key);
offset += sizeof(key); /* move to next character */
*high_dword = 0;
/* Fetch the MAC address and put the octets in the correct order to
* be programmed.
*
* From RTL8105E_Series_EEPROM-Less_App_Note_1.1
* If the MAC address is 001122334455h:
* Write 33221100h to I/O register offset 0x00 via double word access
* Write 00005544h to I/O register offset 0x04 via double word access
*/
for (i = 0; i < 4; i++) {
*high_dword |= (get_hex_digit(search_address + offset)
<< (4 + (i * 8)));
*high_dword |= (get_hex_digit(search_address + offset + 1)
<< (i * 8));
offset += 3;
}
*low_dword = 0;
for (i = 0; i < 2; i++) {
*low_dword |= (get_hex_digit(search_address + offset)
<< (4 + (i * 8)));
*low_dword |= (get_hex_digit(search_address + offset + 1)
<< (i * 8));
offset += 3;
}
return *high_dword | *low_dword;
}
static void program_mac_address(u16 io_base)
{
void *search_address = NULL;
size_t search_length = -1;
/* Default MAC Address of A0:00:BA:D0:0B:AD */
u32 high_dword = 0xD0BA00A0; /* high dword of mac address */
u32 low_dword = 0x0000AD0B; /* low word of mac address as a dword */
if (CONFIG(CHROMEOS)) {
struct region_device rdev;
if (fmap_locate_area_as_rdev("RO_VPD", &rdev) == 0) {
search_address = rdev_mmap_full(&rdev);
if (search_address != NULL)
search_length = region_device_sz(&rdev);
}
} else {
search_address = cbfs_boot_map_with_leak("vpd.bin",
CBFS_TYPE_RAW,
&search_length);
}
if (search_address == NULL)
printk(BIOS_ERR, "LAN: VPD not found.\n");
else
get_mac_address(&high_dword, &low_dword, search_address,
search_length);
if (io_base) {
printk(BIOS_DEBUG, "Realtek NIC io_base = 0x%04x\n", io_base);
printk(BIOS_DEBUG, "Programming MAC Address\n");
/* Disable register protection */
outb(0xc0, io_base + 0x50);
outl(high_dword, io_base);
outl(low_dword, io_base + 0x04);
outb(0x60, io_base + 54);
/* Enable register protection again */
outb(0x00, io_base + 0x50);
}
}
void lan_init(void)
{
u16 io_base = 0;
struct device *ethernet_dev = NULL;
/* Get NIC's IO base address */
ethernet_dev = dev_find_device(NIC_VENDOR_ID,
NIC_DEVICE_ID, 0);
if (ethernet_dev != NULL) {
io_base = pci_read_config16(ethernet_dev, 0x10) & 0xfffe;
/*
* Battery life time - LAN PCIe should enter ASPM L1 to save
* power when LAN connection is idle.
* enable CLKREQ: LAN pci config space 0x81h=01
*/
pci_write_config8(ethernet_dev, 0x81, 0x01);
}
if (io_base) {
/* Program MAC address based on VPD data */
program_mac_address(io_base);
/*
* Program NIC LEDS
*
* RTL8105E Series EEPROM-Less Application Note,
* Section 5.6 LED Mode Configuration
*
* Step1: Write C0h to I/O register 0x50 via byte access to
* disable 'register protection'
* Step2: Write xx001111b to I/O register 0x52 via byte access
* (bit7 is LEDS1 and bit6 is LEDS0)
* Step3: Write 0x00 to I/O register 0x50 via byte access to
* enable 'register protection'
*/
outb(0xc0, io_base + 0x50); /* Disable protection */
outb((NIC_LED_MODE << 6) | 0x0f, io_base + 0x52);
outb(0x00, io_base + 0x50); /* Enable register protection */
}
}
|
/**
* @file confrw.h helper functions and macros for reading and writing
* the configuration file
*/
#ifndef __HDR_confrw_h
#define __HDR_confrw_h
#include "includes.h"
#include "globals.h"
/**
* Declare a function that reads an enum-type variable
* The function will have two parameters:
* - a string containing the value
* - a variable of the given type, passed by reference
* that will store the read value
*
* @param a the enumeration type
* @param b a string containing the valid enumeration items,
* separated by commas
*/
#define MULTIRDR(a,b)\
void CONFREAD_##a(char *&s, a &v) \
{ \
v=(a)multiplechoice(s,b); \
DBG(CONFIG," value " #a " %d (from:%s)\n" ,(int)v ,s); \
}
/**
* @defgroup CONFWRITE
* Declare a set of macros with uniform naming for writing different
* data types to the configuration file
* @param a - value to be written
* note the usage of file "fou" from the current scope
* @{
*/
#define CONFWRITE_GLfloat(a) fprintf(fou,"%f",a)
#define CONFWRITE_int(a) fprintf(fou,"%d",a)
#define CONFWRITE_string(a) fprintf(fou,"%s",a.c_str())
/** @} */
/**
* @defgroup CONFREAD
* Declare a set of macros with uniform naming for reading different
* data types from the configuration files
* @{
*/
/**
* Read a value of type GLfloat from a (char *) string
* @param s the input string
* @param v variable that will store the value
*/
void CONFREAD_GLfloat(char *&s, GLfloat &v);
/**
* Read a value of type int from a (char *) string
* @param s the input string
* @param v variable that will store the value
*/
void CONFREAD_int(char *&s, int &v);
/**
* Read a value of type (STL) string from a (char *) string
* @param s the input string
* @param v variable that will store the value
*/
void CONFREAD_string(char *&s, string &v);
/**
* Read a value of type mcolor from a (char *) string
* the color is stored in the #RRGGBB format
* @param s the input string
* @param v variable that will store the value
*/
void CONFREAD_mcolor(char *&s, mcolor &v);
/** @} */
/**
* Match a string to a set of possible values
* @param s the string to look for
* @param choices the possible values, separated by comma
* @return the index of the matched value, if the value was not
* found among the list of options 0 is returned
*/
int multiplechoice(const char *s, const char *choices);
#endif
|
/*
Copyright (C) 2001 NuSphere Corporation, All Rights Reserved.
This program is open source software. You may not copy or use this
file, in either source code or executable form, except in compliance
with the NuSphere Public License. You can redistribute it and/or
modify it under the terms of the NuSphere Public License as published
by the NuSphere Corporation; 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
NuSphere Public License for more details.
You should have received a copy of the NuSphere Public License
along with this program; if not, write to NuSphere Corporation
14 Oak Park, Bedford, MA 01730.
*/
/* Always include gem_global.h first. There are places where dbconfig.h
** is not the first include, so we can't put gem_config.h there.
*/
#include "gem_global.h"
#include <stdlib.h>
#include <errno.h>
#include "dbconfig.h"
#if SHMEMORY
#include "shmpub.h"
#include "shmprv.h"
#include "sempub.h"
#include "dbcontext.h"
#include "dbmsg.h"
#include "dsmpub.h"
#include "utmsg.h"
#include "utfpub.h"
#include "uttpub.h"
#if OPSYS==WIN32API
#include <windows.h>
#endif /* WIN32API */
#if OPSYS==WIN32API
/* PROGRAM: shmDeleteSegment - delete a shared memory segment */
int shmDeleteSegment(dsmContext_t *pcontext,
TEXT *pname, /* the database name or other file name*/
int idchar) /* id number for segment within db */
{
char szShareMem[MAXUTFLEN];
char szFile[MAXUTFLEN];
LPVOID lpmem;
HANDLE hmap;
utapath(szFile, MAXUTFLEN, pname, "");
utmkosnm("sharemem.", szFile, szShareMem, MAXUTFLEN, idchar);
if ((lpmem = (LPVOID)utshmGetNamedSegment(szShareMem)) == (LPVOID)-1)
return -1;
hmap = (HANDLE)utshmGetUserData((int)lpmem);
/*
* Remove table reference to the segment name
*/
utshmFreeNamedSegment(szShareMem);
UnmapViewOfFile(lpmem);
if (hmap != NULL && hmap != INVALID_HANDLE_VALUE)
CloseHandle(hmap);
return 0;
}
#endif /* OPSYS==WIN32API */
#if OPSYS==UNIX
/* PROGRAM: shmDeleteSegment - delete a shared memory segment */
int shmDeleteSegment(dsmContext_t *pcontext,
TEXT *pname _UNUSED_, /*database name or other file name*/
int shmid) /* id number for segment within db */
{
int rc;
if (shmid < 0) return shmid; /* bad */
rc = shmctl(shmid, IPC_RMID, (struct shmid_ds *)NULL);
if(rc)
{
LONG localErrno = errno;
MSGD_CALLBACK(pcontext,
"%LSYSTEM ERROR: removing shared memory with segment_id: %l errno = %l",
(LONG)shmid,localErrno);
}
else
MSGD_CALLBACK(pcontext,
"%LRemoved shared memory with segment_id: %l",
shmid );
return rc;
}
#endif /* OPSYS==UNIX */
#if OPSYS==UNIX || OPSYS==WIN32API
/* PROGRAM: shmDeleteSegments - delete the shared memory associated
with a db */
DSMVOID
shmDeleteSegments(
dsmContext_t *pcontext,
SHMDSC *pshmdsc)/* describes the segments to delete */
{
int segno;
int numsegs;
#if OPSYS==UNIX
SEGMNT *pseg = NULL;
int shmid;
#endif
if (pshmdsc == NULL) return; /* never initialized at all */
/* The broker wont delete the shared memory until all users */
/* have detached it. This prevents unpleasant effects */
while( pshmdsc
&& pshmdsc->pfrstseg
&& shmqpid(pcontext, pshmdsc->pfrstseg) > 0)
utsleep(5);
#if OPSYS==UNIX
/* the broker should then delete the segments */
for(segno=0, numsegs=pshmdsc->numsegs; segno < numsegs; segno++)
{
/* get the correct shmid to for the segment to delete */
if (segno == 0)
{
pseg = (pshmdsc->pfrstseg);
shmid = pseg->seghdr.shmid;
}
else
{
shmid = pseg->seghdr.qnextshmid;
}
/* delete the segment */
shmDeleteSegment(pcontext,pshmdsc->pname, shmid);
}
#else
/* the broker should then delete the segments */
for(segno=0, numsegs=pshmdsc->numsegs; segno < numsegs; segno++)
shmDeleteSegment(pcontext,pshmdsc->pname, segno);
#endif
}
#endif /* OPSYS==UNIX || OPSYS==WIN32API */
#endif /* SHMEMORY */
|
/* Additional defines for autoheader. */
/* Define to 'off_t' if <sys/types.h> doesn't define. */
#undef loff_t
|
/***************************************************************************
* Copyright (C) 2013-2015 by Savoir-Faire Linux *
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.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, see <http://www.gnu.org/licenses/>. *
**************************************************************************/
#ifndef VIDEOWIDGET3_H
#define VIDEOWIDGET3_H
#include <QtGui/QGraphicsView>
#include "videoglframe.h"
#include <lib/video/renderer.h>
//Qt
class QGLWidget;
class QDragLeaveEvent;
class QDragEnterEvent;
class QDragMoveEvent;
class QDropEvent;
//SFLPhone
namespace Video {
class Renderer;
}
class VideoScene;
class VideoGLFrame;
class VideoWidget3 : public QGraphicsView
{
Q_OBJECT
public:
explicit VideoWidget3(QWidget *parent);
~VideoWidget3();
// virtual int heightForWidth( int w ) const;
// virtual QSize sizeHint ( ) const;
protected:
virtual void resizeEvent(QResizeEvent* event);
virtual void dragLeaveEvent ( QDragLeaveEvent * e );
virtual void dragEnterEvent ( QDragEnterEvent * e );
virtual void dragMoveEvent ( QDragMoveEvent * e );
virtual void dropEvent ( QDropEvent * e );
private:
VideoScene* m_pScene ;
QGLWidget* m_pWdg ;
Video::Device* m_pBackDevice;
QHash<Video::Renderer*,VideoGLFrame*> m_hFrames;
public Q_SLOTS:
void addRenderer(Video::Renderer* renderer);
void removeRenderer(Video::Renderer* renderer);
void slotRotateLeft();
void slotRotateRight();
void slotShowPreview(bool show);
void slotMuteOutgoindVideo(bool mute);
void slotKeepAspectRatio(bool mute);
void slotPreviewEnabled(bool show);
Q_SIGNALS:
void changed();
};
#endif
|
/*
$Id$
OWFS -- One-Wire filesystem
OWHTTPD -- One-Wire Web Server
Written 2003 Paul H Alfille
email: palfille@earthlink.net
Released under the GPL
See the header file: ow.h for full attribution
1wire/iButton system from Dallas Semiconductor
*/
#ifndef OW_1977_H
#define OW_1977_H
#ifndef OWFS_CONFIG_H
#error Please make sure owfs_config.h is included *before* this header file
#endif
#include "ow_standard.h"
/* ------- Structures ----------- */
DeviceHeader(DS1977);
#endif /* OW_1977_H */
|
/*
Spassus2 is a free game (and powerfull engine) for Casio calculators
Copyright (C) 2016 Hugo KUENY
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 _LIST_H_
#define _LIST_H_
#include <Calculib.h>
#define MAX_LOST_LIMIT 100
#define MAX_PREALLOC_SIZE 100
template <class T> class List {
private:
T * table = NULL;
unsigned int size = 0;
unsigned int allocSize = 0;
void changeAllocSize(int addToSize);
public:
T get(unsigned int id);
void set(unsigned int id, T);
void add(T);
void remove(unsigned int id);
void searchAndRemove(T data);
unsigned int getSize();
//tests
unsigned int getAllocSize();
};
#include "error/Error.h"
template <class T> T List<T>::get(unsigned int id)
{
if(id >= size)
{
printf("List get out of range id");
}
return table[id];
}
template <class T> void List<T>::set(unsigned int id, T data)
{
if(id >= size)
{
printf("List get out of range id");
}
table[id] = data;
}
template <class T> void List<T>::add(T data)
{
if(size+1 > allocSize) // out of slot
{
changeAllocSize(((int)(MAX_PREALLOC_SIZE)/sizeof(T))+1); // add more than enough
}
table[size] = data;
size++;
}
template <class T> void List<T>::searchAndRemove(T data)
{
for(unsigned int pos = 0 ; pos < size ; pos++)
{
if(table[pos] == data)
{
remove(pos);
pos--;
}
}
}
template <class T> void List<T>::remove(unsigned int id)
{
unsigned int lostSize = ((allocSize-size)+1);
memmove(table+id,table+id+1,(size-id-1)*sizeof(T));
if(lostSize*sizeof(T) > MAX_LOST_LIMIT) // too much waste
{
changeAllocSize((int)-lostSize); // remove until it's compact
}
size--;
}
template <class T> void List<T>::changeAllocSize(int countToAdd)
{
allocSize += (unsigned int)countToAdd;
if(allocSize > 0)
{
table = (T*)realloc(table,allocSize*sizeof(T));
if(table == NULL)
{
printf("List changeSize Out of memory");
}
}
else
{
free(table);
table = (T*)NULL;
}
}
template <class T> unsigned int List<T>::getSize()
{
return size;
}
template <class T> unsigned int List<T>::getAllocSize()
{
return allocSize;
}
#endif |
#ifndef __UI_InterFace_H__
#define __UI_InterFace_H__
#define DISPPLAY_640_480 640
#define DISPPLAY_800_600 800
#define UI_DISPLAY_RESOLUTION ((GetDisPlay_Resolution())==(640) ? (DISPPLAY_640_480):(DISPPLAY_800_600))
void UI_InitFrom(HWND hWnd);
void UI_ClearCarKind(void);
void UI_ClearCarType(void);
void UI_Show_Info(char *pszInfo);
void UI_SetCarKind(int imgID );
void UI_SetFromColor(BOOL isLOGIN);
void UI_Set_From_Title( void);
void UI_ShowRightInfo(char * TempInfor );
void UI_ShowOperatorInfo(char *LeftInfor,char *RightInfo);
void UI_ShowLeftInfo(char *TempInfor );
void UI_ClearCarMoney(void);
void UI_Input_NumberString(int nKey ,char * PutTo);
void UI_SetCarMoney(short money);
void UI_Set_Device_State(int btnindex,BOOL bFlag);
void UI_ShowNowTime(char * szInfo );
void UI_MsgBox(char *strTitle, char *strSubTitle,BOOL good ,char *Format,...);
void UI_Show_Help_Info(char *pszInfo);
void UI_ShowLoginTime(BOOL bEmpty);
void UI_SetCarType(int nKey);
void UI_LoadRes(void);
void UI_ClearAbateChargeEditC(void);
HWND UI_Get_From_Handl(void);
void UI_Set_From_Handl(HWND hwnd);
void UI_ShowMenu(char *menuname,char *title, char *Info);
void UI_Draw_Login_UserNmber(char *Info);
void UI_Draw_Login_UserPwd(char *Info);
void UI_Show_UserNumber_Text(char *Info);
void UI_Show_Login_UserPwd(char *Info);
void UI_Clear_Login_And_Input(void);
void UI_Show_Input_Text(char *Info);
void UI_Draw_Input_Text(char *Title);
#endif
|
/*
* Copyright (C) 2020 by Jonathan Naylor G4KLX
*
* 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.
*/
#if !defined(FMCTCSSTX_H)
#define FMCTCSSTX_H
#include "Config.h"
class CFMCTCSSTX {
public:
CFMCTCSSTX();
uint8_t setParams(uint8_t frequency, uint8_t level);
q15_t getAudio(bool reverse);
private:
q15_t* m_values;
uint16_t m_length;
uint16_t m_n;
};
#endif
|
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria 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 PATHFINDING_H
#define PATHFINDING_H
#include "../BBGE/Base.h"
//#include "Astar.h"
#include "TileVector.h"
#include <assert.h>
class RenderObject;
class SearchGrid;
class Game;
class PathFinding
{
public:
void forceMinimumPath(VectorPath &path, const Vector &start, const Vector &dest);
void molestPath(VectorPath &path);
void generatePath(RenderObject *go, TileVector g1, TileVector g2, int offx=0, int offy=0);
bool generatePathSimple(VectorPath& path, const Vector& start, const Vector& end, unsigned int step = 0);
};
#endif
|
/*
* CPU idle for AM33XX SoCs
*
* Copyright (C) 2011 Texas Instruments Incorporated. http://www.ti.com/
*
* Derived from Davinci CPU idle code
* (arch/arm/mach-davinci/cpuidle.c)
*
* 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.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; 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/io.h>
#include <linux/platform_device.h>
#include <linux/cpuidle.h>
#include <linux/sched.h>
#include <asm/proc-fns.h>
#include <plat/emif.h>
#include "cpuidle33xx.h"
#define AM33XX_CPUIDLE_MAX_STATES 2
struct am33xx_ops {
void (*enter) (u32 flags);
void (*exit) (u32 flags);
u32 flags;
};
/* fields in am33xx_ops.flags */
#define AM33XX_CPUIDLE_FLAGS_DDR2_PWDN BIT(0)
static struct cpuidle_driver am33xx_idle_driver = {
.name = "cpuidle-am33xx",
.owner = THIS_MODULE,
};
static DEFINE_PER_CPU(struct cpuidle_device, am33xx_cpuidle_device);
static void __iomem *emif_base;
static void am33xx_save_ddr_power(int enter, bool pdown)
{
u32 val;
val = __raw_readl(emif_base + EMIF4_0_SDRAM_MGMT_CTRL);
/* TODO: Choose the mode based on memory type */
if (enter)
val = SELF_REFRESH_ENABLE(64);
else
val = SELF_REFRESH_DISABLE;
__raw_writel(val, emif_base + EMIF4_0_SDRAM_MGMT_CTRL);
}
static void am33xx_c2state_enter(u32 flags)
{
am33xx_save_ddr_power(1, !!(flags & AM33XX_CPUIDLE_FLAGS_DDR2_PWDN));
}
static void am33xx_c2state_exit(u32 flags)
{
am33xx_save_ddr_power(0, !!(flags & AM33XX_CPUIDLE_FLAGS_DDR2_PWDN));
}
static struct am33xx_ops am33xx_states[AM33XX_CPUIDLE_MAX_STATES] = {
[1] = {
.enter = am33xx_c2state_enter,
.exit = am33xx_c2state_exit,
},
};
/* Actual code that puts the SoC in different idle states */
static int am33xx_enter_idle(struct cpuidle_device *dev,
struct cpuidle_state *state)
{
struct am33xx_ops *ops = cpuidle_get_statedata(state);
struct timeval before, after;
int idle_time;
local_irq_disable();
do_gettimeofday(&before);
if (ops && ops->enter)
ops->enter(ops->flags);
/* Wait for interrupt state */
cpu_do_idle();
if (ops && ops->exit)
ops->exit(ops->flags);
do_gettimeofday(&after);
local_irq_enable();
idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
(after.tv_usec - before.tv_usec);
return idle_time;
}
static int __init am33xx_cpuidle_probe(struct platform_device *pdev)
{
int ret;
struct cpuidle_device *device;
struct am33xx_cpuidle_config *pdata = pdev->dev.platform_data;
device = &per_cpu(am33xx_cpuidle_device, smp_processor_id());
if (!pdata) {
dev_err(&pdev->dev, "cannot get platform data\n");
return -ENOENT;
}
emif_base = pdata->emif_base;
ret = cpuidle_register_driver(&am33xx_idle_driver);
if (ret) {
dev_err(&pdev->dev, "failed to register driver\n");
return ret;
}
/* Wait for interrupt state */
device->states[0].enter = am33xx_enter_idle;
device->states[0].exit_latency = 1;
device->states[0].target_residency = 10000;
device->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
strcpy(device->states[0].name, "WFI");
strcpy(device->states[0].desc, "Wait for interrupt");
/* Wait for interrupt and DDR self refresh state */
device->states[1].enter = am33xx_enter_idle;
device->states[1].exit_latency = 100;
device->states[1].target_residency = 10000;
device->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
strcpy(device->states[1].name, "DDR SR");
strcpy(device->states[1].desc, "WFI and DDR Self Refresh");
if (pdata->ddr2_pdown)
am33xx_states[1].flags |= AM33XX_CPUIDLE_FLAGS_DDR2_PWDN;
cpuidle_set_statedata(&device->states[1], &am33xx_states[1]);
device->state_count = AM33XX_CPUIDLE_MAX_STATES;
ret = cpuidle_register_device(device);
if (ret) {
dev_err(&pdev->dev, "failed to register device\n");
cpuidle_unregister_driver(&am33xx_idle_driver);
return ret;
}
return 0;
}
static struct platform_driver am33xx_cpuidle_driver = {
.driver = {
.name = "cpuidle-am33xx",
.owner = THIS_MODULE,
},
};
static int __init am33xx_cpuidle_init(void)
{
return platform_driver_probe(&am33xx_cpuidle_driver,
am33xx_cpuidle_probe);
}
device_initcall(am33xx_cpuidle_init);
|
/*
The MIT License (MIT)
Copyright (c) 2016 Adam Simpson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once
#if USE_CUDA > 0
#include "cuda_runtime.h"
#endif
#include <iostream>
#include <new>
/*! Inheritable class which overload new/delete operators to use cuda managed memory if CUDA is defined
*/
class ManagedAllocation {
public:
ManagedAllocation() = default;
~ManagedAllocation() = default;
ManagedAllocation(const ManagedAllocation &) = delete;
ManagedAllocation &operator=(const ManagedAllocation &) = delete;
ManagedAllocation(ManagedAllocation &&) noexcept = delete;
ManagedAllocation &operator=(ManagedAllocation &&) = delete;
/*! new operator
*/
static void *operator new(std::size_t size) {
#if USE_CUDA > 0
void* data;
auto err = cudaMallocManaged(&data, size);
if(err != cudaSuccess) {
//throw std::runtime_error("error allocating managed memory");
}
return data;
#else
return ::operator new(size);
#endif
}
/*! new array operator
*/
static void *operator new[](std::size_t size) {
return ManagedAllocation::operator new(size);
}
/*! delete operator
*/
static void operator delete(void *block) {
#if USE_CUDA > 0
cudaFree((void*)block);
#else
::operator delete(block);
#endif
}
/*! delete array operator
*/
static void operator delete[](void *block) {
ManagedAllocation::operator delete(block);
}
};
|
/**
* @file
*/
/*
Copyright (C) 2002-2011 UFO: Alien Invasion.
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 CL_BATTLESCAPE_H_
#define CL_BATTLESCAPE_H_
typedef struct {
char name[MAX_VAR];
} clientinfo_t;
/**
* @brief This is the structure that should be used for data that is needed for tactical missions only.
* @note the client_state_t structure is wiped completely at every server map change
* @sa client_static_t
*/
typedef struct clientBattleScape_s {
int time; /**< this is the time value that the client
* is rendering at. always <= cls.realtime */
camera_t cam;
le_t *teamList[MAX_ACTIVETEAM];
int numTeamList;
int numEnemiesSpotted;
bool eventsBlocked; /**< if the client interrupts the event execution, this is true */
/** server state information */
int pnum; /**< player num you have on the server */
int actTeam; /**< the currently active team (in this round) */
char configstrings[MAX_CONFIGSTRINGS][MAX_TOKEN_CHARS];
/** locally derived information from server state */
model_t *model_draw[MAX_MODELS];
const struct cBspModel_s *model_clip[MAX_MODELS];
bool radarInited; /**< every radar image (for every level [1-8]) is loaded */
clientinfo_t clientinfo[MAX_CLIENTS]; /**< client info of all connected clients */
int mapMaxLevel;
/** @todo make this private to the particle code */
int numMapParticles;
int numLMs;
localModel_t LMs[MAX_LOCALMODELS];
int numLEs;
le_t LEs[MAX_EDICTS];
const char *leInlineModelList[MAX_EDICTS + 1];
bool spawned; /**< soldiers already spawned? This is only true if we are already on battlescape but
* our team is not yet spawned */
bool started; /**< match already started? */
mapData_t *mapData;
pathing_t pathMap; /**< This is where the data for TUS used to move and actor locations go */
mapTiles_t *mapTiles;
chrList_t chrList; /**< the list of characters that are used as team in the currently running tactical mission */
} clientBattleScape_t;
extern clientBattleScape_t cl;
le_t* CL_BattlescapeSearchAtGridPos(const pos3_t pos, bool includingStunned, const le_t *actor);
bool CL_OnBattlescape(void);
bool CL_BattlescapeRunning(void);
int CL_GetHitProbability(const le_t* actor);
bool CL_OutsideMap(const vec3_t impact, const float delta);
int CL_CountVisibleEnemies(void);
char *CL_GetConfigString(int index);
int CL_GetConfigStringInteger(int index);
char *CL_SetConfigString(int index, dbuffer *msg);
#ifdef DEBUG
void Grid_DumpWholeClientMap_f(void);
void Grid_DumpClientRoutes_f(void);
#endif
#endif /* CL_BATTLESCAPE_H_ */
|
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* Copyright: 2015-2016 Haydar Alkaduhimi
* Authors:
* Haydar Alkaduhimi <haydar@hosting4all.com>
*
* This program or library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef TESTAPPLET_H
#define TESTAPPLET_H
#include "../../lib/applet.h"
#include <QtCore>
#include <QtDebug>
class TextGraphicsItem;
class TestApplet;
class PanelWindow;
/**
* The plugin class for the TestApplet
*/
class TestAppletPlugin: public QObject, public AppletPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "hde.panel.appletplugin")
Q_INTERFACES(AppletPlugin)
public:
TestAppletPlugin(){}
~TestAppletPlugin(){}
Applet* createApplet(PanelWindow* panelWindow) Q_DECL_OVERRIDE;
};
/**
* @brief A Test Applet that can be used as a base for new applets
*/
class TestApplet: public Applet
{
Q_OBJECT
public:
TestApplet(PanelWindow* panelWindow = 0);
~TestApplet(){}
void close(){}
virtual void setPanelWindow(PanelWindow* panelWindow);
bool init(){return true;}
//void startPlugin();
QSize desiredSize();
public slots:
void clicked(){}
void fontChanged(){}
protected:
void layoutChanged();
bool isHighlighted(){ return false;}
private:
TextGraphicsItem* m_textItem;
};
#endif // TESTAPPLET_H
|
/*
* MPD SACD Decoder plugin
* Copyright (c) 2017 Maxim V.Anisiutkin <maxim.anisiutkin@gmail.com>
*
* This module partially uses code from SACD Ripper http://code.google.com/p/sacd-ripper/ project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _SACD_DISC_H_INCLUDED
#define _SACD_DISC_H_INCLUDED
#include "config.h"
#include <cstdint>
#include "endianess.h"
#include "scarletbook.h"
#include "sacd_reader.h"
#define CP_ACP 0
#define SACD_PSN_SIZE 2064
#define MAX_DATA_SIZE (1024 * 64)
typedef struct {
uint8_t data[MAX_DATA_SIZE];
int size;
bool started;
int sector_count;
int dst_encoded;
} audio_frame_t;
class sacd_disc_t : public sacd_reader_t {
private:
sacd_media_t* sacd_media;
open_mode_e mode;
scarletbook_handle_t sb_handle;
area_id_e track_area;
uint32_t sel_track_index;
uint32_t sel_track_start_lsn;
uint32_t sel_track_length_lsn;
uint32_t sel_track_current_lsn;
uint32_t channel_count;
bool is_emaster;
bool is_dst_encoded;
audio_sector_t audio_sector;
audio_frame_t frame;
int frame_info_counter;
int packet_info_idx;
uint8_t sector_buffer[SACD_PSN_SIZE];
uint32_t sector_size;
int sector_bad_reads;
uint8_t* buffer;
int buffer_offset;
public:
sacd_disc_t();
~sacd_disc_t();
scarletbook_area_t* get_area(area_id_e area_id);
uint32_t get_tracks();
uint32_t get_tracks(area_id_e area_id = AREA_BOTH);
area_id_e get_track_area_id();
uint32_t get_track_index();
uint32_t get_channels();
uint32_t get_loudspeaker_config();
uint32_t get_samplerate();
uint16_t get_framerate();
uint64_t get_size();
uint64_t get_offset();
double get_duration();
double get_duration(uint32_t track_index);
void get_info(uint32_t track_index, const struct TagHandler& handler, void* handler_ctx);
uint32_t get_track_length_lsn();
bool is_dst();
void set_emaster(bool emaster);
bool open(sacd_media_t* sacd_media, open_mode_e mode = MODE_MULTI_TRACK);
bool close();
void select_area(area_id_e area_id);
bool select_track(uint32_t track_index, area_id_e area_id = AREA_BOTH, uint32_t offset = 0);
bool read_frame(uint8_t* frame_data, size_t* frame_size, frame_type_e* frame_type);
bool seek(double seconds);
bool read_blocks_raw(uint32_t lb_start, uint32_t block_count, uint8_t* data);
private:
scarletbook_handle_t* get_handle();
bool read_master_toc();
bool read_area_toc(int area_idx);
void free_area(scarletbook_area_t* area);
};
#endif
|
/*
* linux/include/linux/touchboost.h
*
* franciscofranco.1990@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _LINUX_TOUCHBOOST_H
#define _LINUX_TOUCHBOOST_H
u64 get_input_time(void);
#endif
|
//
// cisco.h
//
// Copyright 2012 - 2015 by John Pietrzak (jpietrzak8@gmail.com)
//
// This file is part of Pierogi.
//
// Pierogi 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.
//
// Pierogi 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 CISCO_H
#define CISCO_H
#include "pirkeysetmetadata.h"
class QComboBox;
class CiscoSTB1: public PIRKeysetMetaData
{
Q_OBJECT
public:
CiscoSTB1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb) const;
};
class CiscoSTB2: public PIRKeysetMetaData
{
Q_OBJECT
public:
CiscoSTB2(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb) const;
};
class CiscoSTB3: public PIRKeysetMetaData
{
Q_OBJECT
public:
CiscoSTB3(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
};
class CiscoSTB4: public PIRKeysetMetaData
{
Q_OBJECT
public:
CiscoSTB4(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
};
#endif // CISCO_H
|
/*
* Copyright (C) 2009 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License (not later!)
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <http://www.gnu.org/licenses>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef __LIST_H
#define __LIST_H
#define offset_of(type, field) (long)(&((type *)0)->field)
#define container_of(p, type, field) (type *)((long)p - offset_of(type, field))
struct list_head {
struct list_head *next;
struct list_head *prev;
};
static inline void list_head_init(struct list_head *list)
{
list->next = list;
list->prev = list;
}
static inline void list_add(struct list_head *p, struct list_head *head)
{
struct list_head *next = head->next;
p->prev = head;
p->next = next;
next->prev = p;
head->next = p;
}
static inline void list_add_tail(struct list_head *p, struct list_head *head)
{
struct list_head *prev = head->prev;
p->prev = prev;
p->next = head;
prev->next = p;
head->prev = p;
}
static inline void list_del(struct list_head *p)
{
struct list_head *next = p->next;
struct list_head *prev = p->prev;
next->prev = prev;
prev->next = next;
}
static inline int list_empty(struct list_head *list)
{
return list->next == list;
}
#define list_for_each_entry(p, list, field) \
for (p = container_of((list)->next, typeof(*p), field); \
&(p)->field != list; \
p = container_of((p)->field.next, typeof(*p), field))
#define list_for_each_entry_safe(p, n, list, field) \
for (p = container_of((list)->next, typeof(*p), field), \
n = container_of((p)->field.next, typeof(*p), field); \
&(p)->field != list; \
p = n, n = container_of((p)->field.next, typeof(*p), field))
#define list_for_each_entry_reverse(p, list, field) \
for (p = container_of((list)->prev, typeof(*p), field); \
&p->field != list; \
p = container_of((p)->field.prev, typeof(*p), field))
#endif /* __LIST_H */
|
/*
* renderer - A simple implementation of polygon-based 3D algorithms.
* Copyright (C) 2004 Thanassis Tsiodras (ttsiodras@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __algebra_h__
#define __algebra_h__
#include <config.h>
#include "Types.h"
struct Matrix3 {
Vector3 _row1, _row2, _row3;
Matrix3(const Vector3& row1, const Vector3& row2, const Vector3& row3)
:
_row1(row1), _row2(row2), _row3(row3) {}
Matrix3()
:
_row1(Vector3()), _row2(Vector3()), _row3(Vector3()) {}
Vector3 multiplyRightWith(const Vector3& r) const;
};
Vector3 cross(const Vector3&, const Vector3&);
coord dot(const Vector3&, const Vector3&);
#endif
|
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* SNI specific PCI support for RM200/RM300.
*
* Copyright (C) 1997 - 2000 Ralf Baechle
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/types.h>
#include <asm/byteorder.h>
#include <asm/sni.h>
#define mkaddr(bus, devfn, where) \
do { \
if (bus->number == 0) \
return -1; \
*(volatile u32 *)PCIMT_CONFIG_ADDRESS = \
((bus->number & 0xff) << 0x10) | \
((devfn & 0xff) << 0x08) | \
(where & 0xfc); \
} while(0)
#if 0
/* To do: Bring this uptodate ... */
static void pcimt_pcibios_fixup(void)
{
struct pci_dev *dev = NULL;
while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
/*
* TODO: Take care of RM300 revision D boards for where the
* network slot became an ordinary PCI slot.
*/
if (dev->devfn == PCI_DEVFN(1, 0)) {
/* Evil hack ... */
set_cp0_config(CONF_CM_CMASK,
CONF_CM_CACHABLE_NO_WA);
dev->irq = PCIMT_IRQ_SCSI;
continue;
}
if (dev->devfn == PCI_DEVFN(2, 0)) {
dev->irq = PCIMT_IRQ_ETHERNET;
continue;
}
switch (dev->irq) {
case 1...4:
dev->irq += PCIMT_IRQ_INTA - 1;
break;
case 0:
break;
default:
printk("PCI device on bus %d, dev %d, function %d "
"impossible interrupt configured.\n",
dev->bus->number, PCI_SLOT(dev->devfn),
PCI_SLOT(dev->devfn));
}
}
}
#endif
/*
* We can't address 8 and 16 bit words directly. Instead we have to
* read/write a 32bit word and mask/modify the data we actually want.
*/
static int pcimt_read(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 * val)
{
u32 res;
switch (size) {
case 1:
mkaddr(bus, devfn, where);
res = *(volatile u32 *) PCIMT_CONFIG_DATA;
res = (le32_to_cpu(res) >> ((where & 3) << 3)) & 0xff;
*val = (u8) res;
break;
case 2:
if (where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
mkaddr(bus, devfn, where);
res = *(volatile u32 *) PCIMT_CONFIG_DATA;
res = (le32_to_cpu(res) >> ((where & 3) << 3)) & 0xffff;
*val = (u16) res;
break;
case 4:
if (where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
mkaddr(bus, devfn, where);
res = *(volatile u32 *) PCIMT_CONFIG_DATA;
res = le32_to_cpu(res);
*val = res;
break;
}
return PCIBIOS_SUCCESSFUL;
}
static int pcimt_write(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 val)
{
switch (size) {
case 1:
mkaddr(bus, devfn, where);
*(volatile u8 *) (PCIMT_CONFIG_DATA + (where & 3)) =
(u8) le32_to_cpu(val);
break;
case 2:
if (where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
mkaddr(bus, devfn, where);
*(volatile u16 *) (PCIMT_CONFIG_DATA + (where & 3)) =
(u16) le32_to_cpu(val);
break;
case 4:
if (where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
mkaddr(bus, devfn, where);
*(volatile u32 *) PCIMT_CONFIG_DATA = le32_to_cpu(val);
break;
}
return PCIBIOS_SUCCESSFUL;
}
struct pci_ops sni_pci_ops = {
.read = pcimt_read,
.write = pcimt_write,
};
void __devinit pcibios_fixup_bus(struct pci_bus *b)
{
}
static int __init pcibios_init(void)
{
struct pci_ops *ops = &sni_pci_ops;
pci_scan_bus(0, ops, NULL);
return 0;
}
subsys_initcall(pcibios_init);
int __init pcibios_enable_device(struct pci_dev *dev, int mask)
{
/* Not needed, since we enable all devices at startup. */
return 0;
}
void pcibios_align_resource(void *data, struct resource *res,
unsigned long size, unsigned long align)
{
}
unsigned __init int pcibios_assign_all_busses(void)
{
return 0;
}
char *__init pcibios_setup(char *str)
{
/* Nothing to do for now. */
return str;
}
struct pci_fixup pcibios_fixups[] = {
{0}
};
|
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.kipi-plugins.org
*
* Date : 2006-10-15
* Description : IPTC keywords settings page.
*
* Copyright (C) 2006-2010 by Gilles Caulier <caulier dot gilles at gmail dot 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, 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 IPTC_KEYWORDS_H
#define IPTC_KEYWORDS_H
// Qt includes
#include <QWidget>
#include <QByteArray>
namespace KIPIMetadataEditPlugin
{
class IPTCKeywordsPriv;
class IPTCKeywords : public QWidget
{
Q_OBJECT
public:
IPTCKeywords(QWidget* parent);
~IPTCKeywords();
void applyMetadata(QByteArray& iptcData);
void readMetadata(QByteArray& iptcData);
Q_SIGNALS:
void signalModified();
private Q_SLOTS:
void slotKeywordSelectionChanged();
void slotAddKeyword();
void slotDelKeyword();
void slotRepKeyword();
private:
IPTCKeywordsPriv* const d;
};
} // namespace KIPIMetadataEditPlugin
#endif // IPTC_KEYWORDS_H
|
/*
* linux/arch/arm/kernel/smp_scu.c
*
* Copyright (C) 2002 ARM Ltd.
* 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 as
* published by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/io.h>
#include <asm/smp_scu.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#define SCU_CTRL 0x00
#define SCU_CONFIG 0x04
#define SCU_CPU_STATUS 0x08
#define SCU_INVALIDATE 0x0c
#define SCU_FPGA_REVISION 0x10
/*
* Get the number of CPU cores from the SCU configuration
*/
unsigned int __init scu_get_core_count(void __iomem *scu_base)
{
unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG);
return (ncores & 0x03) + 1;
}
/*
* Enable the SCU
*/
void __init scu_enable(void __iomem *scu_base)
{
u32 scu_ctrl;
#ifdef CONFIG_ARM_ERRATA_764369
/* Cortex-A9 only */
if ((read_cpuid(CPUID_ID) & 0xff0ffff0) == 0x410fc090) {
scu_ctrl = __raw_readl(scu_base + 0x30);
if (!(scu_ctrl & 1))
__raw_writel(scu_ctrl | 0x1, scu_base + 0x30);
}
#endif
scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
scu_ctrl |= (1 << 3);
scu_ctrl |= 1;
__raw_writel(scu_ctrl, scu_base + SCU_CTRL);
/*
* Ensure that the data accessed by CPU0 before the SCU was
* initialised is visible to the other CPUs.
*/
flush_cache_all();
}
/*
* Set the executing CPUs power mode as defined. This will be in
* preparation for it executing a WFI instruction.
*
* This function must be called with preemption disabled, and as it
* has the side effect of disabling coherency, caches must have been
* flushed. Interrupts must also have been disabled.
*/
int scu_power_mode(void __iomem *scu_base, unsigned int mode)
{
unsigned int val;
int cpu = smp_processor_id();
if (mode > 3 || mode == 1 || cpu > 3)
return -EINVAL;
val = __raw_readb(scu_base + SCU_CPU_STATUS + cpu) & ~0x03;
val |= mode;
__raw_writeb(val, scu_base + SCU_CPU_STATUS + cpu);
return 0;
}
|
/***************************************************************************
* 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. *
* *
* copyright (C) 2002-2012 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef CMDS_H
#define CMDS_H
#include <QUndoCommand>
#include <QUndoStack>
#include <kundostack.h>
#include "cmds/cmd_createDiagram.h"
#include "cmds/cmd_handleRename.h"
#include "cmds/cmd_moveWidget.h"
#include "cmds/cmd_resizeWidget.h"
#include "cmds/cmd_setStereotype.h"
#include "cmds/cmd_setVisibility.h"
/************************************************************
* Generic
************************************************************/
#include "cmds/generic/cmd_createUMLObject.h"
#include "cmds/generic/cmd_renameUMLObject.h"
/************************************************************
* Widgets
************************************************************/
#include "cmds/widget/cmd_changeFillColor.h"
#include "cmds/widget/cmd_changeFontSelection.h"
#include "cmds/widget/cmd_changeLineColor.h"
#include "cmds/widget/cmd_changeMultiplicity.h"
#include "cmds/widget/cmd_changeTextColor.h"
#include "cmds/widget/cmd_createWidget.h"
#include "cmds/widget/cmd_setName.h"
#include "cmds/widget/cmd_setTxt.h"
#endif
|
/* ============================================================
*
* This file is a part of digiKam project
* http://www.digikam.org
*
* Date : 2010-05-01
* Description : a dialog that can be used to display a configuration
* dialog for a rule
*
* Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot 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, 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 RULEDIALOG_H
#define RULEDIALOG_H
// Qt includes
#include <QDialog>
namespace Digikam
{
class Rule;
class RuleDialog : public QDialog
{
Q_OBJECT
public:
explicit RuleDialog(Rule* const parent);
virtual ~RuleDialog();
void setSettingsWidget(QWidget* const settingsWidget);
private:
RuleDialog(const RuleDialog&);
RuleDialog& operator=(const RuleDialog&);
void setDialogTitle(const QString& title);
void setDialogDescription(const QString& description);
void setDialogIcon(const QPixmap& pixmap);
private:
class Private;
Private* const d;
};
} // namespace Digikam
#endif /* RULEDIALOG_H */
|
/*!
*** \file MotorController_config.c
*** \ingroup MotorController_config
*** \author Daniel
*** \date 10/18/2015 11:02:58 PM
*** \brief TODO
***
******************************************************************************/
/* Header file guard symbol to prevent multiple includes */
#ifndef MotorController_config_H_
#define MotorController_config_H_
/* storage class specifier if used with C++ */
#ifdef __cplusplus
extern "C" {
#endif
/*=============================================================================
======= INCLUDES =======
=============================================================================*/
#include "../BLDC/BLDC.h"
/*=============================================================================
======= DEFINES & MACROS FOR GENERAL PURPOSE =======
=============================================================================*/
#define MC_MIN_PULSE_DURATION (750) /* Min. Pulsdauer in µs */
#define MC_MAX_PULSE_DURATION (2250) /* Max. Pulsdauer in µs */
#define MC_THROTTLE_CAL_MAX_JITTER (10)
#define MC_CHECK_CAL_TIME (1000)
#define MC_ARMING_TIMEOUT (10000)
#define MC_CALIBRATE_TIME (2000)
#define MC_CALIBRATION_TIMEOUT (10000)
#define MC_START_TIMEOUT (50)
#define MC_PWM_STEPS (255)
#define MC_LOOP_INTERVAL (1)
#define MC_ERROR_ID 0x10
/*=============================================================================
======= CONSTANTS & TYPES =======
=============================================================================*/
typedef struct MC_Config_s
{
uint16_t throttleOffDuration;
uint16_t throttleFullDuration;
uint16_t checkThrottleTime;
uint16_t throttleTimeout;
uint8_t maxThrottle;
}MC_Config_t;
/*=============================================================================
======= EXPORTS =======
=============================================================================*/
extern MC_Config_t MC_ConfigDataEE;
extern uint8_t MC_ErrorMemoryEE[];
extern uint8_t MC_LastErrorEE;
extern BLDC_Config_t MC_bldcConfigDataEE;
/* end of storage class specifier if used with C++ */
#ifdef __cplusplus
}
#endif
#endif /*MotorController_config_H_*/
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:42 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/usb/net/ax8817x.h */
|
/*
* ======== imports ========
*/
/*
* ======== forward declarations for intrinsics ========
*/
void test62_Test_pollen__reset__E();
void test62_Test_pollen__ready__E();
void test62_Test_pollen__shutdown__E(uint8 i);
/*
* ======== extern definition ========
*/
extern struct test61_PrintImpl_ test61_PrintImpl;
/*
* ======== struct module definition (unit PrintImpl) ========
*/
struct test61_PrintImpl_ {
};
typedef struct test61_PrintImpl_ test61_PrintImpl_;
/*
* ======== function members (unit PrintImpl) ========
*/
extern void test61_PrintImpl_printUint__E( uint32 u );
extern void test61_PrintImpl_printInt__E( int32 i );
extern void test61_PrintImpl_printReal__E( float f );
extern void test61_PrintImpl_printBool__E( bool b );
extern void test61_PrintImpl_targetInit__I();
extern void test61_PrintImpl_printStr__E( string s );
/*
* ======== data members (unit PrintImpl) ========
*/
|
#include "bbs.h"
#include "bmy/convcode.h"
extern int cmpbnames(char *bname, struct boardheader *brec);
int main(int argc, char *argv[])
{
if(argc!=3) {
printf("Error usage!\n"
"Please use this command:\n"
"\033[1;32mchangeboardname\033[m \033[4mboard name\033[m \033[4mnew chinese name(in utf8)\033[m\n");
return -1;
}
struct boardheader fh, newfh;
int pos = new_search_record(BOARDS, &fh, sizeof(fh), (void *)cmpbnames, argv[1]);
if(!pos) {
printf("\033[1;31mwrong board name, exit!\033[m\n");
return -1;
}
char *newtitle_gbk = (char *)malloc(strlen(argv[2])*2);
memset(newtitle_gbk, 0, strlen(argv[2])*2);
u2g(argv[2], strlen(argv[2]), newtitle_gbk, strlen(argv[2])*2);
memset(fh.title, 0, sizeof(fh.title));
strncpy(fh.title, newtitle_gbk, 24);
substitute_record(BOARDS, &fh, sizeof(fh), pos);
printf("board %s at position %d updated successfully!\n", argv[1], pos);
return 0;
}
|
#ifndef __LWIP_DRIVER_H_
#define __LWIP_DRIVER_H_
#include <minix/endpoint.h>
#include <minix/ds.h>
#include <lwip/pbuf.h>
#define NIC_NAME_LEN 6
#define DRV_NAME_LEN DS_MAX_KEYLEN
#define TX_IOVEC_NUM 16 /* something the drivers assume */
struct packet_q {
struct packet_q * next;
unsigned buf_len;
char buf[];
};
#define DRV_IDLE 0
#define DRV_SENDING 1
#define DRV_RECEIVING 2
struct nic {
unsigned flags;
char name[NIC_NAME_LEN];
char drv_name[DRV_NAME_LEN];
endpoint_t drv_ep;
int is_default;
int state;
cp_grant_id_t rx_iogrant;
iovec_s_t rx_iovec[1];
struct pbuf * rx_pbuf;
cp_grant_id_t tx_iogrant;
iovec_s_t tx_iovec[TX_IOVEC_NUM];
struct packet_q * tx_head;
struct packet_q * tx_tail;
void * tx_buffer;
struct netif netif;
unsigned max_pkt_sz;
unsigned min_pkt_sz;
struct socket * raw_socket;
};
int driver_tx_enqueue(struct nic * nic, struct pbuf * pbuf);
void driver_tx_dequeue(struct nic * nic);
struct packet_q * driver_tx_head(struct nic * nic);
/*
* Transmit the next packet in the TX queue of this device. Returns 1 if
* success, 0 otherwise.
*/
int driver_tx(struct nic * nic);
int raw_socket_input(struct pbuf * pbuf, struct nic * nic);
#endif /* __LWIP_DRIVER_H_ */
|
/*
* linux/include/asm-arm/arch-omap/board-3430sdp.h
*
* Hardware definitions for TI OMAP3430 SDP board.
*
* Initial creation by Syed Mohammed Khasim
*
* 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.
*/
#ifndef __ASM_ARCH_OMAP_3430SDP_H
#define __ASM_ARCH_OMAP_3430SDP_H
#define DEBUG_BASE 0x08000000 /* debug board */
/* Placeholder for 3430SDP specific defines */
#define OMAP34XX_ETHR_START DEBUG_BASE
#define OMAP34XX_ETHR_GPIO_IRQ 29
/* NAND */
/* IMPORTANT NOTE ON MAPPING
* 3430SDP - 343X
* ----------
* NOR always on 0x04000000
* MPDB always on 0x08000000
* NAND always on 0x0C000000
* OneNand Mapped to 0x20000000
* Boot Mode(NAND/NOR). The other on CS1
*/
#define FLASH_BASE 0x04000000 /* NOR flash (64 Meg aligned) */
#define DEBUG_BASE 0x08000000 /* debug board */
#define NAND_BASE 0x0C000000 /* NAND flash */
#define ONENAND_MAP 0x20000000 /* OneNand flash */
#ifdef CONFIG_I2C_TWL4030_CORE
#define TWL4030_IRQNUM INT_34XX_SYS_NIRQ
/* TWL4030 Primary Interrupt Handler (PIH) interrupts */
#define IH_TWL4030_BASE IH_BOARD_BASE
#define IH_TWL4030_END (IH_TWL4030_BASE+8)
#ifdef CONFIG_I2C_TWL4030_GPIO
/* TWL4030 GPIO Interrupts */
#define IH_TWL4030_GPIO_BASE (IH_TWL4030_END)
#define IH_TWL4030_GPIO_END (IH_TWL4030_BASE+18)
#define NR_IRQS (IH_TWL4030_GPIO_END)
#else
#define NR_IRQS (IH_TWL4030_END)
#endif /* CONFIG_I2C_TWL4030_GPIO */
#endif /* End of support for TWL4030 */
#endif /* __ASM_ARCH_OMAP_3430SDP_H */
|
/*========================================================================
ストーリー管理
==========================================================================*/
#pragma once
#include "define_const.h"
#include "script_story.h"
class CStoryElement_Settings;
/*!
* @ingroup global
*/
/*@{*/
/*!
* @brief ストーリーリスト保持
* Initializeはキャラクターリスト・ステージリストが構築された後に行うこと
*/
class CStoryList
{
public:
struct CStoryInfo;
void Initialize();
UINT GetAllStoryNum(); //!< 全ストーリー数を取得
void StartStory(UINT index); //!< 指定インデックスのストーリーを開始する
char* GetStoryName(UINT index); //!< 指定インデックスのストーリー名を取得する
char* GetStoryBrief(UINT index); //!< 指定インデックスのストーリー概要を取得する
char* GetStoryDir(UINT index); //!< 指定インデックスのストーリーディレクトリを取得する
void GetStoryIconPath(UINT index,char* dst); //!< 指定インデックスのストーリーアイコンファイル名を取得する
void GetStoryPreviewPath(UINT index,char* dst); //!< 指定インデックスのストーリープレビューファイル名を取得する
CStoryInfo* GetStoryInfo(UINT index); //!< 指定インデックスのストーリー情報を取得
int Ring2Index(UINT ridx,UINT idx); //!< ディレクトリインデックス+ディレクトリ内インデックスから、全体通し番号を取得
UINT GetRingNum(); //!< ディレクトリ数取得
int GetRingCount(UINT idx); //!< 指定インデックスのディレクトリ内にあるストーリー数取得
int GetErrorCount(); //!< 読み込みに失敗したストーリー数取得
char* GetErrorStr(UINT idx); //!< 読み込み失敗理由取得
char* GetErrorDir(UINT idx); //!< 読み込み失敗ディレクトリ
/*
@brief ストーリーリスト要素定義
*/
struct CStoryInfo
{
char dir[128]; //!< 実行ファイルからの相対パス
char name[64];
char icon[64];
char preview[64];
char brief[512];
//キャラクタ定義
int cnum; //!< char指定数
int characters[MAXNUM_TEAM]; //!< char指定 (-1:userselect -2:指定なし)
int color[MAXNUM_TEAM]; //!< 色指定
DWORD option[MAXNUM_TEAM]; //!< オプション直接指定(userselect以外で有効)
StoryOptType opttype[MAXNUM_TEAM];//!< オプション指定フラグ(userselect以外で有効)
void Clear();
void Setup(CStoryElement_Settings* settings,char* dir1,char* dir2);
void SetDir(char *s,char *s2);
void SetName(char *s);
void SetBrief(char *s);
void SetIcon(char *s);
void SetPreview(char *s);
CStoryInfo* Clone();
};
typedef std::vector<CStoryInfo> CStoryInfoList;
protected:
//!ディレクトリリスト要素
struct CStoryRingInfo
{
char dir[64];
std::vector<DWORD> ring2serial;//!< リング内でのインデックス→全体通し番号インデックス変換
};
typedef std::vector<CStoryRingInfo> CStoryRingInfoList;
CStoryInfoList list;
CStoryInfoList dlist;//!< 検証失敗リスト。brief にダメ理由を入れる。
CStoryRingInfoList rlist;
protected:
//スクリプト解釈後の要素リストからの各種情報取り出し
static char* GetName(SScriptElementList& scr);
static char* GetBrief(SScriptElementList& scr);
static int* GetCharacters(SScriptElementList& scr);
static char* GetFirstError(SScriptElementList& scr);
static CStoryElement_Settings* GetSettingsFromScriptList(SScriptElementList& scr);
};
/*@}*/
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#if (defined HAVE_CONFIG_H) && (!defined WIN32)
#include "config.h"
#endif
#ifndef _LINUX
enum StreamType;
enum CodecID;
#else
#include "DVDDemuxers/DVDDemux.h"
extern "C" {
#if (defined USE_EXTERNAL_FFMPEG)
#if (defined HAVE_LIBAVCODEC_AVCODEC_H)
#include <libavcodec/avcodec.h>
#elif (defined HAVE_FFMPEG_AVCODEC_H)
#include <ffmpeg/avcodec.h>
#endif
#else
#include "libavcodec/avcodec.h"
#endif
}
#endif
class CDemuxStream;
class CDVDStreamInfo
{
public:
CDVDStreamInfo();
CDVDStreamInfo(const CDVDStreamInfo &right, bool withextradata = true);
CDVDStreamInfo(const CDemuxStream &right, bool withextradata = true);
~CDVDStreamInfo();
void Clear(); // clears current information
bool Equal(const CDVDStreamInfo &right, bool withextradata);
bool Equal(const CDemuxStream &right, bool withextradata);
void Assign(const CDVDStreamInfo &right, bool withextradata);
void Assign(const CDemuxStream &right, bool withextradata);
CodecID codec;
StreamType type;
bool software; //force software decoding
// VIDEO
int fpsscale; // scale of 1000 and a rate of 29970 will result in 29.97 fps
int fpsrate;
int height; // height of the stream reported by the demuxer
int width; // width of the stream reported by the demuxer
float aspect; // display aspect as reported by demuxer
bool vfr; // variable framerate
bool stills; // there may be odd still frames in video
int level; // encoder level of the stream reported by the decoder. used to qualify hw decoders.
int profile; // encoder profile of the stream reported by the decoder. used to qualify hw decoders.
bool ptsinvalid; // pts cannot be trusted (avi's).
bool forced_aspect; // aspect is forced from container
int orientation; // orientation of the video in degress counter clockwise
int bitsperpixel;
// AUDIO
int channels;
int samplerate;
int bitrate;
int blockalign;
int bitspersample;
// SUBTITLE
int identifier;
// CODEC EXTRADATA
void* extradata; // extra data for codec to use
unsigned int extrasize; // size of extra data
unsigned int codec_tag; // extra identifier hints for decoding
bool operator==(const CDVDStreamInfo& right) { return Equal(right, true);}
bool operator!=(const CDVDStreamInfo& right) { return !Equal(right, true);}
void operator=(const CDVDStreamInfo& right) { Assign(right, true); }
bool operator==(const CDemuxStream& right) { return Equal( CDVDStreamInfo(right, true), true);}
bool operator!=(const CDemuxStream& right) { return !Equal( CDVDStreamInfo(right, true), true);}
void operator=(const CDemuxStream& right) { Assign(right, true); }
};
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:36 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/linux/nfs_fs_sb.h */
#ifndef _NFS_FS_SB
#if defined(__cplusplus) && !CLICK_CXX_PROTECTED
# error "missing #include <click/cxxprotect.h>"
#endif
#define _NFS_FS_SB
#include <linux/list.h>
#include <linux/backing-dev.h>
#include <linux/wait.h>
#include <asm/atomic.h>
struct nfs_iostats;
struct nlm_host;
/*
* The nfs_client identifies our client state to the server.
*/
struct nfs_client {
atomic_t cl_count;
int cl_cons_state; /* current construction state (-ve: init error) */
#define NFS_CS_READY 0 /* ready to be used */
#define NFS_CS_INITING 1 /* busy initialising */
unsigned long cl_res_state; /* NFS resources state */
#define NFS_CS_CALLBACK 1 /* - callback started */
#define NFS_CS_IDMAP 2 /* - idmap started */
#define NFS_CS_RENEWD 3 /* - renewd started */
struct sockaddr_storage cl_addr; /* server identifier */
size_t cl_addrlen;
char * cl_hostname; /* hostname of server */
struct list_head cl_share_link; /* link in global client list */
struct list_head cl_superblocks; /* List of nfs_server structs */
struct rpc_clnt * cl_rpcclient;
const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
int cl_proto; /* Network transport protocol */
struct rpc_cred *cl_machine_cred;
#ifdef CONFIG_NFS_V4
u64 cl_clientid; /* constant */
nfs4_verifier cl_confirm;
unsigned long cl_state;
struct rb_root cl_openowner_id;
struct rb_root cl_lockowner_id;
/*
* The following rwsem ensures exclusive access to the server
* while we recover the state following a lease expiration.
*/
struct rw_semaphore cl_sem;
struct list_head cl_delegations;
struct rb_root cl_state_owners;
spinlock_t cl_lock;
unsigned long cl_lease_time;
unsigned long cl_last_renewal;
struct delayed_work cl_renewd;
struct rpc_wait_queue cl_rpcwaitq;
/* used for the setclientid verifier */
struct timespec cl_boot_time;
/* idmapper */
struct idmap * cl_idmap;
/* Our own IP address, as a null-terminated string.
* This is used to generate the clientid, and the callback address.
*/
char cl_ipaddr[48];
unsigned char cl_id_uniquifier;
#endif
};
/*
* NFS client parameters stored in the superblock.
*/
struct nfs_server {
struct nfs_client * nfs_client; /* shared client and NFS4 state */
struct list_head client_link; /* List of other nfs_server structs
* that share the same client
*/
struct list_head master_link; /* link in master servers list */
struct rpc_clnt * client; /* RPC client handle */
struct rpc_clnt * client_acl; /* ACL RPC client handle */
struct nlm_host *nlm_host; /* NLM client handle */
struct nfs_iostats * io_stats; /* I/O statistics */
struct backing_dev_info backing_dev_info;
atomic_long_t writeback; /* number of writeback pages */
int flags; /* various flags */
unsigned int caps; /* server capabilities */
unsigned int rsize; /* read size */
unsigned int rpages; /* read size (in pages) */
unsigned int wsize; /* write size */
unsigned int wpages; /* write size (in pages) */
unsigned int wtmult; /* server disk block size */
unsigned int dtsize; /* readdir size */
unsigned short port; /* "port=" setting */
unsigned int bsize; /* server block size */
unsigned int acregmin; /* attr cache timeouts */
unsigned int acregmax;
unsigned int acdirmin;
unsigned int acdirmax;
unsigned int namelen;
struct nfs_fsid fsid;
__u64 maxfilesize; /* maximum file size */
unsigned long mount_time; /* when this fs was mounted */
dev_t s_dev; /* superblock dev numbers */
#ifdef CONFIG_NFS_V4
u32 attr_bitmask[2];/* V4 bitmask representing the set
of attributes supported on this
filesystem */
u32 acl_bitmask; /* V4 bitmask representing the ACEs
that are supported on this
filesystem */
#endif
void (*destroy)(struct nfs_server *);
atomic_t active; /* Keep trace of any activity to this server */
wait_queue_head_t active_wq; /* Wait for any activity to stop */
/* mountd-related mount options */
struct sockaddr_storage mountd_address;
size_t mountd_addrlen;
u32 mountd_version;
unsigned short mountd_port;
unsigned short mountd_protocol;
};
/* Server capabilities */
#define NFS_CAP_READDIRPLUS (1U << 0)
#define NFS_CAP_HARDLINKS (1U << 1)
#define NFS_CAP_SYMLINKS (1U << 2)
#define NFS_CAP_ACLS (1U << 3)
#define NFS_CAP_ATOMIC_OPEN (1U << 4)
#endif
|
// Copyright 2008 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
//
// Additional copyrights go to Duddie and Tratax (c) 2004
#pragma once
// Anything to do with SR and conditions goes here.
#include "Common/CommonTypes.h"
namespace DSP
{
namespace Interpreter
{
bool CheckCondition(u8 _Condition);
void Update_SR_Register16(s16 _Value, bool carry = false, bool overflow = false,
bool overS32 = false);
void Update_SR_Register64(s64 _Value, bool carry = false, bool overflow = false);
void Update_SR_LZ(bool value);
inline bool isCarry(u64 val, u64 result)
{
return (val > result);
}
inline bool isCarry2(u64 val, u64 result)
{
return (val >= result);
}
inline bool isOverflow(s64 val1, s64 val2, s64 res)
{
return ((val1 ^ res) & (val2 ^ res)) < 0;
}
inline bool isOverS32(s64 acc)
{
return (acc != (s32)acc) ? true : false;
}
} // namespace Interpreter
} // namespace DSP
|
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include "mydnsutil.h"
#ifndef HAVE_INET_NTOP
#if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$BINDId: inet_ntop.c,v 1.8 1999/10/13 16:39:28 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x)
#else
# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static const char *inet_ntop4 (const char *src, char *dst, unsigned int size);
static const char *inet_ntop6 (const char *src, char *dst, unsigned int size);
/* char *
* inet_ntop(af, src, dst, size)
* convert a network format address to presentation format.
* return:
* pointer to presentation format address (`dst'), or NULL (see errno).
* author:
* Paul Vixie, 1996.
*/
const char *
inet_ntop(af, src, dst, size)
int af;
const void *src;
char *dst;
unsigned int size;
{
switch (af) {
case AF_INET:
return (inet_ntop4(src, dst, size));
case AF_INET6:
return (inet_ntop6(src, dst, size));
default:
errno = EAFNOSUPPORT;
return (NULL);
}
/* NOTREACHED */
}
/* const char *
* inet_ntop4(src, dst, size)
* format an IPv4 address
* return:
* `dst' (as a const)
* notes:
* (1) uses no statics
* (2) takes a char* not an in_addr as input
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(src, dst, size)
const char *src;
char *dst;
unsigned int size;
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
errno = ENOSPC;
return (NULL);
}
return strcpy(dst, tmp);
}
/* const char *
* inet_ntop6(src, dst, size)
* convert IPv6 binary address into presentation (printable) format
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop6(src, dst, size)
const char *src;
char *dst;
unsigned int size;
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
* to contain a value of the specified size. On some systems, like
* Crays, there is no such thing as an integer variable with 16 bits.
* Keep this in mind if you think this function should have been coded
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
unsigned int words[16 / sizeof(uint16_t)];
int i;
/*
* Preprocess:
* Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding.
*/
memset(words, '\0', sizeof words);
for (i = 0; i < 16; i += 2)
words[i / 2] = (src[i] << 8) | src[i + 1];
best.base = -1;
cur.base = -1;
for (i = 0; i < (16 / sizeof(uint16_t)); i++) {
if (words[i] == 0) {
if (cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
} else {
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
cur.base = -1;
}
}
}
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
}
if (best.base != -1 && best.len < 2)
best.base = -1;
/*
* Format the result.
*/
tp = tmp;
for (i = 0; i < (16 / sizeof(uint16_t)); i++) {
/* Are we inside the best run of 0x00's? */
if (best.base != -1 && i >= best.base &&
i < (best.base + best.len)) {
if (i == best.base)
*tp++ = ':';
continue;
}
/* Are we following an initial run of 0x00s or any real hex? */
if (i != 0)
*tp++ = ':';
/* Is this address an encapsulated IPv4? */
if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
return (NULL);
tp += strlen(tp);
break;
}
tp += SPRINTF((tp, "%x", words[i]));
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==
(16 / sizeof(uint16_t)))
*tp++ = ':';
*tp++ = '\0';
/*
* Check for overflow, copy, and we're done.
*/
if ((unsigned int)(tp - tmp) > size) {
errno = ENOSPC;
return (NULL);
}
return strcpy(dst, tmp);
}
#endif /* !HAVE_INET_NTOP */
|
//===-- unordsf2vfp_test.c - Test __unordsf2vfp ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file tests __unordsf2vfp for the compiler_rt library.
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
extern int __unordsf2vfp(float a, float b);
#if __arm__
int test__unordsf2vfp(float a, float b)
{
int actual = __unordsf2vfp(a, b);
int expected = (isnan(a) || isnan(b)) ? 1 : 0;
if (actual != expected)
printf("error in __unordsf2vfp(%f, %f) = %d, expected %d\n",
a, b, actual, expected);
return actual != expected;
}
#endif
int main()
{
#if __arm__
if (test__unordsf2vfp(0.0, NAN))
return 1;
if (test__unordsf2vfp(NAN, 1.0))
return 1;
if (test__unordsf2vfp(NAN, NAN))
return 1;
if (test__unordsf2vfp(1.0, 1.0))
return 1;
#endif
return 0;
}
|
#include <regex.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
int ret;
regmatch_t pmatch1[1];
regmatch_t pmatch2[10];
regex_t preg;
int i;
ret = regcomp(&preg, "\\(ab*\\)\\{1,3\\}\\1", 0);
//ret = regcomp(&preg, "\\(ab*\\)*\\1", 0);
printf("%s ret=%d\n","\\(ab*\\)*\\1", ret);
ret = regexec(&preg, "abbbabbabbbbb", 1, pmatch2, 0);
printf("%s ret=%d\n","abbbabbabbbbb", ret);
for(i = 0;i < 1;i++)
{
printf("%d pmatch.rm_so = %d\n", i, (long)pmatch2[i].rm_so);
printf("%d pmatch.rm_eo = %d\n", i, (long)pmatch2[i].rm_eo);
}
return 0;
}
|
/*
* linux/arch/arm/plat-pnx/include/mach/timer.h
*
* Copyright (C) 2010 ST-Ericsson
*
* 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 __ASM_ARCH_PNX_TIMER_H
#define __ASM_ARCH_PNX_TIMER_H
#ifdef PNX_TIMER_C
#define PUBLIC
#else
#define PUBLIC extern
#endif
struct sys_timer;
extern struct sys_timer pnx_timer;
/*======================= Function prototypes =======================*/
PUBLIC void __init pnx_timer_init(void);
PUBLIC int pnx_rtke_timer_init(void);
#undef PUBLIC
#endif
|
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.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.
*/
#ifndef MPD_DIRECTORY_H
#define MPD_DIRECTORY_H
#include "check.h"
#include "dirvec.h"
#include "songvec.h"
#include "playlist_vector.h"
#include <stdbool.h>
#include <sys/types.h>
#define DIRECTORY_DIR "directory: "
#define DEVICE_INARCHIVE (dev_t)(-1)
#define DEVICE_CONTAINER (dev_t)(-2)
struct directory {
struct dirvec children;
struct songvec songs;
struct playlist_vector playlists;
struct directory *parent;
time_t mtime;
ino_t inode;
dev_t device;
unsigned stat; /* not needed if ino_t == dev_t == 0 is impossible */
char path[sizeof(long)];
};
static inline bool
isRootDirectory(const char *name)
{
return name[0] == 0 || (name[0] == '/' && name[1] == 0);
}
struct directory *
directory_new(const char *dirname, struct directory *parent);
void
directory_free(struct directory *directory);
static inline bool
directory_is_empty(const struct directory *directory)
{
return directory->children.nr == 0 && directory->songs.nr == 0 &&
playlist_vector_is_empty(&directory->playlists);
}
static inline const char *
directory_get_path(const struct directory *directory)
{
return directory->path;
}
/**
* Is this the root directory of the music database?
*/
static inline bool
directory_is_root(const struct directory *directory)
{
return directory->parent == NULL;
}
/**
* Returns the base name of the directory.
*/
const char *
directory_get_name(const struct directory *directory);
static inline struct directory *
directory_get_child(const struct directory *directory, const char *name)
{
return dirvec_find(&directory->children, name);
}
static inline struct directory *
directory_new_child(struct directory *directory, const char *name)
{
struct directory *subdir = directory_new(name, directory);
dirvec_add(&directory->children, subdir);
return subdir;
}
void
directory_prune_empty(struct directory *directory);
/**
* Looks up a directory by its relative URI.
*
* @param directory the parent (or grandparent, ...) directory
* @param uri the relative URI
* @return the directory, or NULL if none was found
*/
struct directory *
directory_lookup_directory(struct directory *directory, const char *uri);
/**
* Looks up a song by its relative URI.
*
* @param directory the parent (or grandparent, ...) directory
* @param uri the relative URI
* @return the song, or NULL if none was found
*/
struct song *
directory_lookup_song(struct directory *directory, const char *uri);
void
directory_sort(struct directory *directory);
int
directory_walk(struct directory *directory,
int (*forEachSong)(struct song *, void *),
int (*forEachDir)(struct directory *, void *),
void *data);
#endif
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
* Jonathan Schleifer <js@webkeks.org>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "NSArray+OFObject.h"
#import "NSString+OFObject.h"
#import "OFArray+NSObject.h"
#import "OFString+NSObject.h"
|
/*
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.
*/
#ifndef _IPMI_RMCPPLUS_SUPPORT_AND_PAYLOAD_CMDS_API_H
#define _IPMI_RMCPPLUS_SUPPORT_AND_PAYLOAD_CMDS_API_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <freeipmi/api/ipmi-api.h>
#include <freeipmi/fiid/fiid.h>
int8_t ipmi_cmd_set_user_payload_access (ipmi_ctx_t ctx,
uint8_t channel_number,
uint8_t user_id,
uint8_t operation,
uint8_t standard_payload_1,
uint8_t standard_payload_2,
uint8_t standard_payload_3,
uint8_t standard_payload_4,
uint8_t standard_payload_5,
uint8_t standard_payload_6,
uint8_t standard_payload_7,
uint8_t oem_payload_0,
uint8_t oem_payload_1,
uint8_t oem_payload_2,
uint8_t oem_payload_3,
uint8_t oem_payload_4,
uint8_t oem_payload_5,
uint8_t oem_payload_6,
uint8_t oem_payload_7,
fiid_obj_t obj_cmd_rs);
int8_t ipmi_cmd_get_user_payload_access (ipmi_ctx_t ctx,
uint8_t channel_number,
uint8_t user_id,
fiid_obj_t obj_cmd_rs);
#ifdef __cplusplus
}
#endif
#endif /* _IPMI_RMCPPLUS_SUPPORT_AND_PAYLOAD_CMDS_API_H */
|
/***************************************************************************
* Copyright (C) 2007 by Rafał Rzepecki *
* divided.mind@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef VERSION_H
#define VERSION_H
#define VERSION "0.9." SVN_REVISION
#endif
|
/* arch/arm/mach-s3c2410/include/mach/regs-timer.h
*
* Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
* http://www.simtec.co.uk/products/SWLINUX/
*
* 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.
*
* S3C2410 Timer configuration
*/
#ifndef __ASM_ARCH_REGS_TIMER_H
#define __ASM_ARCH_REGS_TIMER_H
#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x))
#define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c))
#define S3C2410_TCFG0 S3C_TIMERREG(0x00)
#define S3C2410_TCFG1 S3C_TIMERREG(0x04)
#define S3C2410_TCON S3C_TIMERREG(0x08)
#define S3C64XX_TINT_CSTAT S3C_TIMERREG(0x44)
#define S3C2410_TCFG_PRESCALER0_MASK (255<<0)
#define S3C2410_TCFG_PRESCALER1_MASK (255<<8)
#define S3C2410_TCFG_PRESCALER1_SHIFT (8)
#define S3C2410_TCFG_DEADZONE_MASK (255<<16)
#define S3C2410_TCFG_DEADZONE_SHIFT (16)
#define S3C2410_TCFG1_MUX4_DIV2 (0<<16)
#define S3C2410_TCFG1_MUX4_DIV4 (1<<16)
#define S3C2410_TCFG1_MUX4_DIV8 (2<<16)
#define S3C2410_TCFG1_MUX4_DIV16 (3<<16)
#define S3C2410_TCFG1_MUX4_TCLK1 (4<<16)
#define S3C2410_TCFG1_MUX4_MASK (15<<16)
#define S3C2410_TCFG1_MUX4_SHIFT (16)
#define S3C2410_TCFG1_MUX3_DIV2 (0<<12)
#define S3C2410_TCFG1_MUX3_DIV4 (1<<12)
#define S3C2410_TCFG1_MUX3_DIV8 (2<<12)
#define S3C2410_TCFG1_MUX3_DIV16 (3<<12)
#define S3C2410_TCFG1_MUX3_TCLK1 (4<<12)
#define S3C2410_TCFG1_MUX3_MASK (15<<12)
#define S3C2410_TCFG1_MUX2_DIV2 (0<<8)
#define S3C2410_TCFG1_MUX2_DIV4 (1<<8)
#define S3C2410_TCFG1_MUX2_DIV8 (2<<8)
#define S3C2410_TCFG1_MUX2_DIV16 (3<<8)
#define S3C2410_TCFG1_MUX2_TCLK1 (4<<8)
#define S3C2410_TCFG1_MUX2_MASK (15<<8)
#define S3C2410_TCFG1_MUX1_DIV2 (0<<4)
#define S3C2410_TCFG1_MUX1_DIV4 (1<<4)
#define S3C2410_TCFG1_MUX1_DIV8 (2<<4)
#define S3C2410_TCFG1_MUX1_DIV16 (3<<4)
#define S3C2410_TCFG1_MUX1_TCLK0 (4<<4)
#define S3C2410_TCFG1_MUX1_MASK (15<<4)
#define S3C2410_TCFG1_MUX0_DIV2 (0<<0)
#define S3C2410_TCFG1_MUX0_DIV4 (1<<0)
#define S3C2410_TCFG1_MUX0_DIV8 (2<<0)
#define S3C2410_TCFG1_MUX0_DIV16 (3<<0)
#define S3C2410_TCFG1_MUX0_TCLK0 (4<<0)
#define S3C2410_TCFG1_MUX0_MASK (15<<0)
#define S3C2410_TCFG1_MUX_DIV2 (0<<0)
#define S3C2410_TCFG1_MUX_DIV4 (1<<0)
#define S3C2410_TCFG1_MUX_DIV8 (2<<0)
#define S3C2410_TCFG1_MUX_DIV16 (3<<0)
#define S3C2410_TCFG1_MUX_TCLK (4<<0)
#define S3C2410_TCFG1_MUX_MASK (15<<0)
#define S3C64XX_TCFG1_MUX_DIV1 (0<<0)
#define S3C64XX_TCFG1_MUX_DIV2 (1<<0)
#define S3C64XX_TCFG1_MUX_DIV4 (2<<0)
#define S3C64XX_TCFG1_MUX_DIV8 (3<<0)
#define S3C64XX_TCFG1_MUX_DIV16 (4<<0)
#define S3C64XX_TCFG1_MUX_TCLK (5<<0) /* 3 sets of TCLK */
#define S3C64XX_TCFG1_MUX_MASK (15<<0)
#define S3C2410_TCFG1_SHIFT(x) ((x) * 4)
/* for each timer, we have an count buffer, an compare buffer and
* an observation buffer
*/
/* WARNING - timer 4 has no buffer reg, and it's observation is at +4 */
#define S3C2410_TCNTB(tmr) S3C_TIMERREG2(tmr, 0x00)
#define S3C2410_TCMPB(tmr) S3C_TIMERREG2(tmr, 0x04)
#define S3C2410_TCNTO(tmr) S3C_TIMERREG2(tmr, (((tmr) == 4) ? 0x04 : 0x08))
#define S3C2410_TCON_T4RELOAD (1<<22)
#define S3C2410_TCON_T4MANUALUPD (1<<21)
#define S3C2410_TCON_T4START (1<<20)
#define S3C2410_TCON_T3RELOAD (1<<19)
#define S3C2410_TCON_T3INVERT (1<<18)
#define S3C2410_TCON_T3MANUALUPD (1<<17)
#define S3C2410_TCON_T3START (1<<16)
#define S3C2410_TCON_T2RELOAD (1<<15)
#define S3C2410_TCON_T2INVERT (1<<14)
#define S3C2410_TCON_T2MANUALUPD (1<<13)
#define S3C2410_TCON_T2START (1<<12)
#define S3C2410_TCON_T1RELOAD (1<<11)
#define S3C2410_TCON_T1INVERT (1<<10)
#define S3C2410_TCON_T1MANUALUPD (1<<9)
#define S3C2410_TCON_T1START (1<<8)
#define S3C2410_TCON_T0DEADZONE (1<<4)
#define S3C2410_TCON_T0RELOAD (1<<3)
#define S3C2410_TCON_T0INVERT (1<<2)
#define S3C2410_TCON_T0MANUALUPD (1<<1)
#define S3C2410_TCON_T0START (1<<0)
#define S5PV210_TINT_CSTAT S3C_TIMERREG(0x44)
#define S5PV210_TINT_CSTAT_T4INT (1<<9)
#define S5PV210_TINT_CSTAT_T3INT (1<<8)
#define S5PV210_TINT_CSTAT_T2INT (1<<7)
#define S5PV210_TINT_CSTAT_T1INT (1<<6)
#define S5PV210_TINT_CSTAT_T0INT (1<<5)
#define S5PV210_TINT_CSTAT_T4INTEN (1<<4)
#define S5PV210_TINT_CSTAT_T3INTEN (1<<3)
#define S5PV210_TINT_CSTAT_T2INTEN (1<<2)
#define S5PV210_TINT_CSTAT_T1INTEN (1<<1)
#define S5PV210_TINT_CSTAT_T0INTEN (1<<0)
#define S5PV210_TCFG1_MUX3_DIV1 (0<<12)
#define S5PV210_TCFG1_MUX3_DIV2 (1<<12)
#define S5PV210_TCFG1_MUX3_DIV4 (2<<12)
#define S5PV210_TCFG1_MUX3_DIV8 (3<<12)
#define S5PV210_TCFG1_MUX3_DIV16 (4<<12)
#define S5PV210_TCFG1_MUX3_SCLK (5<<12)
#define S5PV210_TCFG1_MUX3_MASK (15<<12)
#endif /* __ASM_ARCH_REGS_TIMER_H */
|
/* #define DEBUG */
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/pagemap.h>
#include <linux/init.h>
#include <linux/namei.h>
#include <linux/security.h>
#include <linux/magic.h>
static struct vfsmount *mount;
static int mount_count;
static ssize_t default_read_file(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
return 0;
}
static ssize_t default_write_file(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
return count;
}
static int default_open(struct inode *inode, struct file *file)
{
if (inode->i_private)
file->private_data = inode->i_private;
return 0;
}
static const struct file_operations default_file_ops = {
.read = default_read_file,
.write = default_write_file,
.open = default_open,
};
static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
{
struct inode *inode = new_inode(sb);
if (inode) {
inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
default:
init_special_inode(inode, mode, dev);
break;
case S_IFREG:
inode->i_fop = &default_file_ops;
break;
case S_IFDIR:
inode->i_op = &simple_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
/* directory inodes start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
break;
}
}
return inode;
}
/* SMP-safe */
static int mknod(struct inode *dir, struct dentry *dentry,
int mode, dev_t dev)
{
struct inode *inode;
int error = -EPERM;
if (dentry->d_inode)
return -EEXIST;
inode = get_inode(dir->i_sb, mode, dev);
if (inode) {
d_instantiate(dentry, inode);
dget(dentry);
error = 0;
}
return error;
}
static int mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
int res;
mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
res = mknod(dir, dentry, mode, 0);
if (!res)
inc_nlink(dir);
return res;
}
static int create(struct inode *dir, struct dentry *dentry, int mode)
{
mode = (mode & S_IALLUGO) | S_IFREG;
return mknod(dir, dentry, mode, 0);
}
static inline int positive(struct dentry *dentry)
{
return dentry->d_inode && !d_unhashed(dentry);
}
static int fill_super(struct super_block *sb, void *data, int silent)
{
static struct tree_descr files[] = {{""}};
return simple_fill_super(sb, SECURITYFS_MAGIC, files);
}
static int get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name,
void *data, struct vfsmount *mnt)
{
return get_sb_single(fs_type, flags, data, fill_super, mnt);
}
static struct file_system_type fs_type = {
.owner = THIS_MODULE,
.name = "securityfs",
.get_sb = get_sb,
.kill_sb = kill_litter_super,
};
static int create_by_name(const char *name, mode_t mode,
struct dentry *parent,
struct dentry **dentry)
{
int error = 0;
*dentry = NULL;
/* If the parent is not specified, we create it in the root.
* We need the root dentry to do this, which is in the super
* block. A pointer to that is in the struct vfsmount that we
* have around.
*/
if (!parent)
parent = mount->mnt_sb->s_root;
mutex_lock(&parent->d_inode->i_mutex);
*dentry = lookup_one_len(name, parent, strlen(name));
if (!IS_ERR(*dentry)) {
if ((mode & S_IFMT) == S_IFDIR)
error = mkdir(parent->d_inode, *dentry, mode);
else
error = create(parent->d_inode, *dentry, mode);
} else
error = PTR_ERR(*dentry);
mutex_unlock(&parent->d_inode->i_mutex);
return error;
}
struct dentry *securityfs_create_file(const char *name, mode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops)
{
struct dentry *dentry = NULL;
int error;
pr_debug("securityfs: creating file '%s'\n",name);
error = simple_pin_fs(&fs_type, &mount, &mount_count);
if (error) {
dentry = ERR_PTR(error);
goto exit;
}
error = create_by_name(name, mode, parent, &dentry);
if (error) {
dentry = ERR_PTR(error);
simple_release_fs(&mount, &mount_count);
goto exit;
}
if (dentry->d_inode) {
if (fops)
dentry->d_inode->i_fop = fops;
if (data)
dentry->d_inode->i_private = data;
}
exit:
return dentry;
}
EXPORT_SYMBOL_GPL(securityfs_create_file);
struct dentry *securityfs_create_dir(const char *name, struct dentry *parent)
{
return securityfs_create_file(name,
S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO,
parent, NULL, NULL);
}
EXPORT_SYMBOL_GPL(securityfs_create_dir);
void securityfs_remove(struct dentry *dentry)
{
struct dentry *parent;
if (!dentry || IS_ERR(dentry))
return;
parent = dentry->d_parent;
if (!parent || !parent->d_inode)
return;
mutex_lock(&parent->d_inode->i_mutex);
if (positive(dentry)) {
if (dentry->d_inode) {
if (S_ISDIR(dentry->d_inode->i_mode))
simple_rmdir(parent->d_inode, dentry);
else
simple_unlink(parent->d_inode, dentry);
dput(dentry);
}
}
mutex_unlock(&parent->d_inode->i_mutex);
simple_release_fs(&mount, &mount_count);
}
EXPORT_SYMBOL_GPL(securityfs_remove);
static struct kobject *security_kobj;
static int __init securityfs_init(void)
{
int retval;
security_kobj = kobject_create_and_add("security", kernel_kobj);
if (!security_kobj)
return -EINVAL;
retval = register_filesystem(&fs_type);
if (retval)
kobject_put(security_kobj);
return retval;
}
core_initcall(securityfs_init);
MODULE_LICENSE("GPL");
|
/*
*
* This source code is part of
*
* G R O M A C S
*
* GROningen MAchine for Chemical Simulations
*
* VERSION 3.2.0
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team,
* check out http://www.gromacs.org for more information.
* 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.
*
* If you want to redistribute modifications, please consider that
* scientific software is very special. Version control is crucial -
* bugs must be traceable. We will be happy to consider code for
* inclusion in the official distribution, but derived work must not
* be called official GROMACS. Details are found in the README & COPYING
* files - if they are missing, get the official version at www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the papers on the package - you can find them in the top README file.
*
* For more info, check our website at http://www.gromacs.org
*
* And Hey:
* GROningen Mixture of Alchemy and Childrens' Stories
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <math.h>
#include "typedefs.h"
#include "sysstuff.h"
#include "smalloc.h"
#include "macros.h"
#include "physics.h"
#include "vec.h"
#include "futil.h"
#include "xvgr.h"
#include "gmx_fatal.h"
#include "bondf.h"
#include "copyrite.h"
#include "disre.h"
#include "main.h"
#include "mtop_util.h"
void init_dihres(FILE *fplog,gmx_mtop_t *mtop,t_inputrec *ir,t_fcdata *fcd)
{
int count;
fcd->dihre_fc = ir->dihre_fc;
count = gmx_mtop_ftype_count(mtop,F_DIHRES);
if (fplog && count) {
fprintf(fplog,"There are %d dihedral restraints\n",count);
}
}
real ta_dihres(int nfa,const t_iatom forceatoms[],const t_iparams ip[],
const rvec x[],rvec f[],rvec fshift[],
const t_pbc *pbc,const t_graph *g,
real lambda,real *dvdlambda,
const t_mdatoms *md,t_fcdata *fcd,
int *ddgatindex)
{
real vtot = 0;
int ai,aj,ak,al,i,k,type,typep,label,power,t1,t2,t3;
real phi0,phi,ddphi,ddp,dp,dp2,dphi,kfac,cos_phi,sign,d2r,fc;
rvec r_ij,r_kj,r_kl,m,n;
fc = fcd->dihre_fc;
d2r = DEG2RAD;
k = 0;
for(i=0; (i<nfa); ) {
type = forceatoms[i++];
ai = forceatoms[i++];
aj = forceatoms[i++];
ak = forceatoms[i++];
al = forceatoms[i++];
phi0 = ip[type].dihres.phi*d2r;
dphi = ip[type].dihres.dphi*d2r;
kfac = ip[type].dihres.kfac*fc;
power = ip[type].dihres.power;
label = ip[type].dihres.label;
phi = dih_angle(x[ai],x[aj],x[ak],x[al],pbc,r_ij,r_kj,r_kl,m,n,
&cos_phi,&sign,&t1,&t2,&t3);
/* 84 flops */
if (debug)
fprintf(debug,"dihres[%d]: %d %d %d %d : phi=%f, dphi=%f, kfac=%f, power=%d, label=%d\n",
k++,ai,aj,ak,al,phi,dphi,kfac,power,label);
/* phi can jump if phi0 is close to Pi/-Pi, which will cause huge
* force changes if we just apply a normal harmonic.
* Instead, we first calculate phi-phi0 and take it modulo (-Pi,Pi).
* This means we will never have the periodicity problem, unless
* the dihedral is Pi away from phiO, which is very unlikely due to
* the potential.
*/
dp = phi-phi0;
if (fabs(dp) > dphi) {
/* dp cannot be outside (-2*pi,2*pi) */
if (dp >= M_PI)
dp -= 2*M_PI;
else if(dp < -M_PI)
dp += 2*M_PI;
if (dp > dphi)
ddp = dp-dphi;
else if (dp < -dphi)
ddp = dp+dphi;
else
ddp = 0;
if (ddp != 0.0) {
vtot += 0.5*kfac*ddp*ddp;
ddphi = kfac*ddp;
do_dih_fup(ai,aj,ak,al,ddphi,r_ij,r_kj,r_kl,m,n,
f,fshift,pbc,g,x,t1,t2,t3); /* 112 */
}
}
}
return vtot;
}
|
/*
XEvol3D Rendering Engine . (http://gforge.osdn.net.cn/projects/xevol3d/) .
Stanly.Lee 2006
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 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 __GDI_FONT_H__
#define __GDI_FONT_H__
#include "xFontRender.h"
#include <ft2build.h>
#include FT_FREETYPE_H
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#define _FT2_FULL_TEXTURE_
BEGIN_NAMESPACE_XEVOL3D
class xGdiFontCharLoader;
class xGdiFontChar;
typedef TResHandle <xGdiFontChar, wchar_t, xGdiFontCharLoader > HXGdiFontChar;
typedef TLRUPolicyResMgr<xGdiFontChar , wchar_t , xGdiFontCharLoader > xGdiFontCharMgr;
class xGdiFTIdxMgr
{
vector<int> m_vFreeIndex;
int m_maxIndex;
public:
void setMaxIndex(int maxIndex);
void freeAllIndex();
int useIndex();
void freeIndex(int index);
};
class xGdiFont;
class xGdiFontChar
{
public:
int m_tex_w ;
int m_tex_h ;
#ifndef _FT2_FULL_TEXTURE_
IBaseTexture* m_pTexture;
#else
int m_tex_x ;
int m_tex_y ;
int m_tex_idx;
xGdiFontCharLoader* m_FT2FontLoader;
#endif
float m_adv_x;
float m_adv_y;
float m_left;
float m_top;
public:
xGdiFontChar(IFontRenderDevice* pRenderer , xGdiFontCharLoader* pFT2FontLoader);
~xGdiFontChar();
void unload();
};
class xGdiFontCharLoader : public IRefCountObject
{
public:
FT_Face m_FT_Face;
int m_w , m_h;
bool m_bBold;
bool m_Italic;
bool m_UnderLine;
bool m_bAntilias;
IFontRenderDevice* m_pRenderer;
#ifdef _FT2_FULL_TEXTURE_
IBaseTexture* m_pTexture;
xGdiFTIdxMgr m_idxManager;
int m_nCharOfRow;
int m_tex_w;
int m_tex_h;
#endif
#ifdef _DEBUG
HXGdiFontChar* m_hFontList;
#endif
IMPL_REFCOUNT_OBJECT_INTERFACE(xGdiFontCharLoader);
public:
static void releaseAll();
xGdiFontCharLoader();
virtual ~xGdiFontCharLoader();
void setCacheSize(int maxSize, int maxFontW , int maxFontH);
void setRenderer(IFontRenderDevice* pRenderer) { m_pRenderer = pRenderer ; };
bool load_font(const wchar_t* font_file , int _w , int _h);
unsigned int _getResSize(xGdiFontChar*& pRes);
bool _isResLoaded(xGdiFontChar* pRes);
bool _preLoadResource(wchar_t& _char , xGdiFontChar*& pRes, int& ResSize,unsigned int arg) { return true ; }
bool _postLoadResource(wchar_t& _char , xGdiFontChar*& pRes, int& ResSize,unsigned int arg) { return true ; }
bool _loadResource(wchar_t& _char , xGdiFontChar*& pRes, int& ResSize,unsigned int arg);
bool _unloadResource(wchar_t& _char , xGdiFontChar*& pRes, unsigned int& TotalResSize);
void _deleteResource(wchar_t& _char , xGdiFontChar* pRes);
};
class xGdiFont : public xFontRender
{
xGdiFontCharMgr* m_pFontCharMgr;
public:
xFontInfo m_Info;
int m_LinePitch;
bool m_bLinearFilter;
eFontFilter m_Filter;
public:
IMPL_BASE_OBJECT_INTERFACE(xGdiFont);
HXGdiFontChar GetFontCharHandle(wchar_t _chr);
public:
void createFontCharManager(const wchar_t* managerName);
void setFontChareManager(xGdiFontCharMgr* pMgr);
xGdiFontCharMgr* getFontCharManager();
xGdiFont(IFontRenderDevice* pRenderer);
~xGdiFont();
void releaseChache();
const xFontInfo& getInfo(){ return m_Info ; }
void setDrawFilter(eFontFilter filter){m_Filter = filter ; }
bool drawChar(wchar_t _chr , float x , float y, int& dx , int& dy, xColor_4f cl) ;
void enableAntialias(bool bAnti);
bool isAntialias();
bool getCharDim(wchar_t _chr , int& dx , int& dy);
void setCacheSize(int maxSize);
int getCacheSize();
int getLinePitch(){return 0; m_LinePitch ; };
};
END_NAMESPACE_XEVOL3D
#endif
|
//
// BaseDetailCell.h
// Http同步请求
//
// Created by qianfeng on 14/3/21.
// Copyright © 2014年 zhangying. All rights reserved.
//
#import <UIKit/UIKit.h>
@class NewsModel;
@interface BaseDetailCell : UITableViewCell
@property (nonatomic, strong) NewsModel * model;
+ (instancetype)initWithTableView:(UITableView *)tableView;
+ (CGFloat)rowHeight;
@end
|
/*
* Generated by asn1c-0.9.22 (http://lionet.info/asn1c)
* From ASN.1 module "PKIX1Explicit88"
* found in "lpa2.asn1"
* `asn1c -S/skeletons`
*/
#include <asn_internal.h>
#include "ExtensionAttributes.h"
static asn_TYPE_member_t asn_MBR_ExtensionAttributes_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_ExtensionAttribute,
0, /* Defer constraints checking to the member type */
0, /* PER is not compiled, use -gen-PER */
0,
""
},
};
static ber_tlv_tag_t asn_DEF_ExtensionAttributes_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (17 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_ExtensionAttributes_specs_1 = {
sizeof(struct ExtensionAttributes),
offsetof(struct ExtensionAttributes, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_ExtensionAttributes = {
"ExtensionAttributes",
"ExtensionAttributes",
SET_OF_free,
SET_OF_print,
SET_OF_constraint,
SET_OF_decode_ber,
SET_OF_encode_der,
SET_OF_decode_xer,
SET_OF_encode_xer,
0, 0, /* No PER support, use "-gen-PER" to enable */
0, /* Use generic outmost tag fetcher */
asn_DEF_ExtensionAttributes_tags_1,
sizeof(asn_DEF_ExtensionAttributes_tags_1)
/sizeof(asn_DEF_ExtensionAttributes_tags_1[0]), /* 1 */
asn_DEF_ExtensionAttributes_tags_1, /* Same as above */
sizeof(asn_DEF_ExtensionAttributes_tags_1)
/sizeof(asn_DEF_ExtensionAttributes_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
asn_MBR_ExtensionAttributes_1,
1, /* Single element */
&asn_SPC_ExtensionAttributes_specs_1 /* Additional specs */
};
|
/*
* Sonics Silicon Backplane
* Broadcom USB-core OHCI driver
*
* Copyright 2007 Michael Buesch <mb@bu3sch.de>
*
* Derived from the OHCI-PCI driver
* Copyright 1999 Roman Weissgaerber
* Copyright 2000-2002 David Brownell
* Copyright 1999 Linus Torvalds
* Copyright 1999 Gregory P. Smith
*
* Derived from the USBcore related parts of Broadcom-SB
* Copyright 2005 Broadcom Corporation
*
* Licensed under the GNU/GPL. See COPYING for details.
*/
#include <linux/ssb/ssb.h>
#define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
struct ssb_ohci_device {
struct ohci_hcd ohci; /* _must_ be at the beginning. */
u32 enable_flags;
};
static inline
struct ssb_ohci_device *hcd_to_ssb_ohci(struct usb_hcd *hcd)
{
return (struct ssb_ohci_device *)(hcd->hcd_priv);
}
static int ssb_ohci_reset(struct usb_hcd *hcd)
{
struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
struct ohci_hcd *ohci = &ohcidev->ohci;
int err;
ohci_hcd_init(ohci);
err = ohci_init(ohci);
return err;
}
static int ssb_ohci_start(struct usb_hcd *hcd)
{
struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
struct ohci_hcd *ohci = &ohcidev->ohci;
int err;
err = ohci_run(ohci);
if (err < 0) {
ohci_err(ohci, "can't start\n");
ohci_stop(hcd);
}
return err;
}
static const struct hc_driver ssb_ohci_hc_driver = {
.description = "ssb-usb-ohci",
.product_desc = "SSB OHCI Controller",
.hcd_priv_size = sizeof(struct ssb_ohci_device),
.irq = ohci_irq,
.flags = HCD_MEMORY | HCD_USB11,
.reset = ssb_ohci_reset,
.start = ssb_ohci_start,
.stop = ohci_stop,
.shutdown = ohci_shutdown,
.urb_enqueue = ohci_urb_enqueue,
.urb_dequeue = ohci_urb_dequeue,
.endpoint_disable = ohci_endpoint_disable,
.get_frame_number = ohci_get_frame,
.hub_status_data = ohci_hub_status_data,
.hub_control = ohci_hub_control,
#ifdef CONFIG_PM
.bus_suspend = ohci_bus_suspend,
.bus_resume = ohci_bus_resume,
#endif
.start_port_reset = ohci_start_port_reset,
};
static void ssb_ohci_detach(struct ssb_device *dev)
{
struct usb_hcd *hcd = ssb_get_drvdata(dev);
if (hcd->driver->shutdown)
hcd->driver->shutdown(hcd);
usb_remove_hcd(hcd);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
ssb_device_disable(dev, 0);
}
static int ssb_ohci_attach(struct ssb_device *dev)
{
struct ssb_ohci_device *ohcidev;
struct usb_hcd *hcd;
int err = -ENOMEM;
u32 tmp, flags = 0;
if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) ||
dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32)))
return -EOPNOTSUPP;
if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) {
/* Put the device into host-mode. */
flags |= SSB_OHCI_TMSLOW_HOSTMODE;
ssb_device_enable(dev, flags);
} else if (dev->id.coreid == SSB_DEV_USB20_HOST) {
/*
* USB 2.0 special considerations:
*
* In addition to the standard SSB reset sequence, the Host
* Control Register must be programmed to bring the USB core
* and various phy components out of reset.
*/
ssb_device_enable(dev, 0);
ssb_write32(dev, 0x200, 0x7ff);
/* Change Flush control reg */
tmp = ssb_read32(dev, 0x400);
tmp &= ~8;
ssb_write32(dev, 0x400, tmp);
tmp = ssb_read32(dev, 0x400);
/* Change Shim control reg */
tmp = ssb_read32(dev, 0x304);
tmp &= ~0x100;
ssb_write32(dev, 0x304, tmp);
tmp = ssb_read32(dev, 0x304);
udelay(1);
/* Work around for 5354 failures */
if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) {
/* Change syn01 reg */
tmp = 0x00fe00fe;
ssb_write32(dev, 0x894, tmp);
/* Change syn03 reg */
tmp = ssb_read32(dev, 0x89c);
tmp |= 0x1;
ssb_write32(dev, 0x89c, tmp);
}
} else
ssb_device_enable(dev, 0);
hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
dev_name(dev->dev));
if (!hcd)
goto err_dev_disable;
ohcidev = hcd_to_ssb_ohci(hcd);
ohcidev->enable_flags = flags;
tmp = ssb_read32(dev, SSB_ADMATCH0);
hcd->rsrc_start = ssb_admatch_base(tmp);
hcd->rsrc_len = ssb_admatch_size(tmp);
hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
if (!hcd->regs)
goto err_put_hcd;
err = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
if (err)
goto err_iounmap;
ssb_set_drvdata(dev, hcd);
return err;
err_iounmap:
iounmap(hcd->regs);
err_put_hcd:
usb_put_hcd(hcd);
err_dev_disable:
ssb_device_disable(dev, flags);
return err;
}
static int ssb_ohci_probe(struct ssb_device *dev,
const struct ssb_device_id *id)
{
int err;
u16 chipid_top;
/* USBcores are only connected on embedded devices. */
chipid_top = (dev->bus->chip_id & 0xFF00);
if (chipid_top != 0x4700 && chipid_top != 0x5300)
return -ENODEV;
/* TODO: Probably need checks here; is the core connected? */
if (usb_disabled())
return -ENODEV;
/* We currently always attach SSB_DEV_USB11_HOSTDEV
* as HOST OHCI. If we want to attach it as Client device,
* we must branch here and call into the (yet to
* be written) Client mode driver. Same for remove(). */
err = ssb_ohci_attach(dev);
return err;
}
static void ssb_ohci_remove(struct ssb_device *dev)
{
ssb_ohci_detach(dev);
}
#ifdef CONFIG_PM
static int ssb_ohci_suspend(struct ssb_device *dev, pm_message_t state)
{
ssb_device_disable(dev, 0);
return 0;
}
static int ssb_ohci_resume(struct ssb_device *dev)
{
struct usb_hcd *hcd = ssb_get_drvdata(dev);
struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
ssb_device_enable(dev, ohcidev->enable_flags);
ohci_finish_controller_resume(hcd);
return 0;
}
#else /* !CONFIG_PM */
#define ssb_ohci_suspend NULL
#define ssb_ohci_resume NULL
#endif /* CONFIG_PM */
static const struct ssb_device_id ssb_ohci_table[] = {
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV),
SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
SSB_DEVTABLE_END
};
MODULE_DEVICE_TABLE(ssb, ssb_ohci_table);
static struct ssb_driver ssb_ohci_driver = {
.name = KBUILD_MODNAME,
.id_table = ssb_ohci_table,
.probe = ssb_ohci_probe,
.remove = ssb_ohci_remove,
.suspend = ssb_ohci_suspend,
.resume = ssb_ohci_resume,
};
|
#pragma once
#include "interfaces.h"
#include "atgui.h"
#include "Hacks/hacks.h"
#include "ImGUI/imgui.h"
#include "ImGUI/imgui_impl_sdl.h"
#include "ImGUI/imgui_internal.h"
#include "ImGUI/fonts/KaiGenGothicCNRegular.h"
#include "ImGUI/fonts/RobotoMonoRegular.h"
typedef void (*SDL_GL_SwapWindow_t) (SDL_Window*);
typedef int (*SDL_PollEvent_t) (SDL_Event*);
namespace SDL2
{
void SwapWindow(SDL_Window*);
void UnhookWindow();
int PollEvent(SDL_Event*);
void UnhookPollEvent();
} |
/***********************************************************
Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/* $XFree86: xc/include/extensions/Xv.h,v 1.5 1999/12/11 19:28:48 mvojkovi Exp $ */
#ifndef XV_H
#define XV_H
/*
** File:
**
** Xv.h --- Xv shared library and server header file
**
** Author:
**
** David Carver (Digital Workstation Engineering/Project Athena)
**
** Revisions:
**
** 05.15.91 Carver
** - version 2.0 upgrade
**
** 01.24.91 Carver
** - version 1.4 upgrade
**
*/
#include <X11/X.h>
#define XvName "XVideo"
#define XvVersion 2
#define XvRevision 2
/* Symbols */
typedef XID XvPortID;
typedef XID XvEncodingID;
#define XvNone 0
#define XvInput 0
#define XvOutput 1
#define XvInputMask (1L<<XvInput)
#define XvOutputMask (1L<<XvOutput)
#define XvVideoMask 0x00000004
#define XvStillMask 0x00000008
#define XvImageMask 0x00000010
/* These two are not client viewable */
#define XvPixmapMask 0x00010000
#define XvWindowMask 0x00020000
#define XvGettable 0x01
#define XvSettable 0x02
#define XvRGB 0
#define XvYUV 1
#define XvPacked 0
#define XvPlanar 1
#define XvTopToBottom 0
#define XvBottomToTop 1
/* Events */
#define XvVideoNotify 0
#define XvPortNotify 1
#define XvNumEvents 2
/* Video Notify Reasons */
#define XvStarted 0
#define XvStopped 1
#define XvBusy 2
#define XvPreempted 3
#define XvHardError 4
#define XvLastReason 4
#define XvNumReasons (XvLastReason + 1)
#define XvStartedMask (1L<<XvStarted)
#define XvStoppedMask (1L<<XvStopped)
#define XvBusyMask (1L<<XvBusy)
#define XvPreemptedMask (1L<<XvPreempted)
#define XvHardErrorMask (1L<<XvHardError)
#define XvAnyReasonMask ((1L<<XvNumReasons) - 1)
#define XvNoReasonMask 0
/* Errors */
#define XvBadPort 0
#define XvBadEncoding 1
#define XvBadControl 2
#define XvNumErrors 3
/* Status */
#define XvBadExtension 1
#define XvAlreadyGrabbed 2
#define XvInvalidTime 3
#define XvBadReply 4
#define XvBadAlloc 5
#endif /* XV_H */
|
/****************************************************************************
Copyright (c) 2000 - 2010 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
****************************************************************************
File: YCPMenuItem.h
Author: Stefan Hundhammer <shundhammer@suse.de>
/-*/
#ifndef YCPMenuItem_h
#define YCPMenuItem_h
#include <ycp/YCPValue.h>
#include <ycp/YCPString.h>
#include <yui/YMenuItem.h>
/**
* Menu item class with YCPValue IDs.
*
* Similar to YCPItem (and even more similar to YCPTreeItem, but with YMenuItem
* as base class. There should be an elegant way to do this with templates, but
* the different constructor arguments make this difficult.
**/
class YCPMenuItem: public YMenuItem
{
public:
/**
* Constructors
**/
YCPMenuItem( const YCPString & label,
const YCPValue & id )
: YMenuItem( label->value() )
, _id( id )
{}
YCPMenuItem( const YCPString & label,
const YCPValue & id,
const YCPString & iconName )
: YMenuItem( label->value(), iconName->value() )
, _id( id )
{}
YCPMenuItem( YCPMenuItem * parent,
const YCPString & label,
const YCPValue & id )
: YMenuItem( parent, label->value() )
, _id( id )
{}
YCPMenuItem( YCPMenuItem * parent,
const YCPString & label,
const YCPValue & id,
const YCPString & iconName )
: YMenuItem( parent, label->value(), iconName->value() )
, _id( id )
{}
/**
* Destructor.
**/
virtual ~YCPMenuItem()
{}
/**
* Return 'true' if this item has an ID.
**/
bool hasId() const { return ! _id.isNull() && ! _id->isVoid(); }
/**
* Return this item's ID.
**/
YCPValue id() const { return _id; }
/**
* Set a new ID.
**/
void setId( const YCPValue & newId ) { _id = newId; }
/**
* Return this item's label as a YCPString.
**/
YCPString label() const { return YCPString( YMenuItem::label() ); }
/**
* Set this item's label with a YCPString.
**/
void setLabel( const YCPString & newLabel )
{ YMenuItem::setLabel( newLabel->value() ); }
/**
* Return this item's icon name as a YCPString.
**/
YCPString iconName() const { return YCPString( YMenuItem::iconName() ); }
/**
* Set this item's icon name with a YCPString.
**/
void setIconName( const YCPString & newIconName )
{ YMenuItem::setIconName( newIconName->value() ); }
private:
YCPValue _id;
};
#endif // YCPMenuItem_h
|
#include "ibm.h"
#include "mouse.h"
#include "amstrad.h"
#include "mouse_ps2.h"
#include "mouse_serial.h"
#include "keyboard_olim24.h"
static mouse_t *mouse_list[] =
{
&mouse_serial_microsoft,
&mouse_ps2_2_button,
&mouse_intellimouse,
&mouse_amstrad,
&mouse_olim24,
NULL
};
static mouse_t *cur_mouse;
static void *mouse_p;
int mouse_type = 0;
void mouse_emu_init()
{
cur_mouse = mouse_list[mouse_type];
mouse_p = cur_mouse->init();
}
void mouse_emu_close()
{
if (cur_mouse)
cur_mouse->close(mouse_p);
cur_mouse = NULL;
}
void mouse_poll(int x, int y, int z, int b)
{
if (cur_mouse)
cur_mouse->poll(x, y, z, b, mouse_p);
}
char *mouse_get_name(int mouse)
{
if (!mouse_list[mouse])
return NULL;
return mouse_list[mouse]->name;
}
int mouse_get_type(int mouse)
{
return mouse_list[mouse]->type;
}
|
#ifndef __H4D_MAINTOOLBAR_H__
#define __H4D_MAINTOOLBAR_H__
/*
* ****************************************
*
* Harmony4D - Praktische Aspekte der Informatik WS1314
*
* (c) 2013 by Alexander Knueppel
*
* ****************************************
*/
#include <qtoolbar.h>
#include <qtoolbutton.h>
class MainToolBar : public QToolBar {
Q_OBJECT
public:
MainToolBar(QWidget* parent = 0) : QToolBar(parent) {
createButtons();
createToolBar();
}
private:
void createButtons() {
btnSelect = new QToolButton;
btnSelect->setGeometry(0,0,25,25);
btnSelect->setIcon(QIcon("icons/select.png"));
btnRecSelect = new QToolButton;
btnRecSelect->setGeometry(0,0,25,25);
btnRecSelect->setIcon(QIcon("icons/rect_select.png"));
btnCircleSelect = new QToolButton;
btnCircleSelect->setGeometry(0,0,25,25);
btnCircleSelect->setIcon(QIcon("icons/circle_select.png"));
btnMove = new QToolButton;
btnMove->setGeometry(0,0,25,25);
btnMove->setIcon(QIcon("icons/move.png"));
btnRotate = new QToolButton;
btnRotate->setGeometry(0,0,25,25);
btnRotate->setIcon(QIcon("icons/rotate.png"));
btnScale = new QToolButton;
btnScale->setGeometry(0,0,25,25);
btnScale->setIcon(QIcon("icons/scale.png"));
btnMatEditor = new QToolButton;
btnMatEditor->setGeometry(0,0,25,25);
btnMatEditor->setIcon(QIcon("icons/material_editor.png"));
btnRenderSetup = new QToolButton;
btnRenderSetup->setGeometry(0,0,25,25);
btnRenderSetup->setIcon(QIcon("icons/render_setup.png"));
}
void createToolBar() {
addWidget(btnSelect);
addWidget(btnRecSelect);
addWidget(btnCircleSelect);
addSeparator();
addWidget(btnMove);
addWidget(btnRotate);
addWidget(btnScale);
addSeparator();
addWidget(btnMatEditor);
addWidget(btnRenderSetup);
}
QToolButton *btnSelect;
QToolButton *btnRecSelect;
QToolButton *btnCircleSelect;
QToolButton *btnMove;
QToolButton *btnRotate;
QToolButton *btnScale;
QToolButton *btnMatEditor;
QToolButton *btnRenderSetup;
};
#endif |
#pragma once
#include "afxwin.h"
#include "TrueWineLib.h"
// CAddSpecToAnaInfo ¶Ô»°¿ò
class CAddSpecToAnaInfo : public CDialogEx
{
DECLARE_DYNAMIC(CAddSpecToAnaInfo)
public:
CAddSpecToAnaInfo(CWnd* pParent = NULL); // ±ê×¼¹¹Ô캯Êý
virtual ~CAddSpecToAnaInfo();
// ¶Ô»°¿òÊý¾Ý
enum { IDD = IDD_DIALOG_ADDSPECINFO };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö
DECLARE_MESSAGE_MAP()
public:
CComboBox m_ComboWineName;
CString m_Winename;
CComboBox m_ComboAlcoholContent;
CString m_Alcoholcontent;
CComboBox m_ComboFlavour;
CString m_Flavour;
CComboBox m_ComboBrand;
CString m_Brand;
CString m_WinenameExam;
CString m_AlcoholContentExam;
CString m_FlavourExam;
CString m_BrandExam;
virtual BOOL OnInitDialog();
afx_msg void OnCbnSelchangeComboWinename();
CTrueWineLib Alcohol;
CTrueWineLib Flavour;
CTrueWineLib Brand;
CTrueWineLib WineName;
afx_msg void OnCbnEditchangeComboWinename();
afx_msg void OnCbnSelchangeComboAlcoholcentent();
afx_msg void OnCbnSelchangeComboFlavour();
afx_msg void OnCbnSelchangeComboBrand();
};
|
/*
This file is a portion of Hsim 0.4
Hsim 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.
*/
/*
* This routine is an access method for fuel.csv
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fuel.h"
#include "rsim.h"
extern char *myname;
/*
* fuel.csv definitions
*/
#define FUEL "fuel.csv"
static char *columns[] ={
"fuel",
"N",
"A",
"K",
"Density",
"cpropep",
};
#define NCOL ((sizeof columns)/(sizeof columns[0]))
#define FUEL_NAME 0
#define FUEL_N 1
#define FUEL_A 2
#define FUEL_K 3
#define FUEL_DENSITY 4
#define FUEL_CPROPEP 5
int
fuel_data(char *fuel_name, struct fuel_data_s *fp)
{
int j;
FILE *input;
char buffer[256];
char *ptrs[NCOL];
if (!fuel_name) {
fprintf(stderr, "%s: no fuel specified\n",
myname);
return 1;
}
input = fopen(FUEL, "r");
if (input == NULL) {
fprintf(stderr, "%s: cannot open data file %s for reading.\n",
myname, FUEL);
perror("open");
return 1;
}
if (csv_read(input, buffer, sizeof buffer, ptrs, NCOL) == 0) {
fprintf(stderr, "%s: data file %s is empty\n",
myname, FUEL);
return 1;
}
for (j = 0; j < NCOL; j++) {
if (ptrs[j] == (char *)0) {
fprintf(stderr, "%s: error in fuel.csv. "
"Column %d is blank\n",
myname,
j + 1);
exit(1);
}
if (strcmp(ptrs[j], columns[j]) != 0) {
fprintf(stderr, "%s: bad column heading in "
"data file %s\n",
myname, FUEL);
fprintf(stderr, "\tExpected \'%s\' got \'%s\' "
"in column %d\n",
columns[j], ptrs[j], j);
return 1;
}
}
while (csv_read(input, buffer, sizeof buffer, ptrs, NCOL))
if (strcasecmp(ptrs[0], fuel_name) == 0)
goto found;
/* The supplied fuel is not a solid fuel */
fclose(input);
return 2;
found:
fclose(input);
if (fp) {
fp->fuel_n = atof(ptrs[FUEL_N]);
fp->fuel_a = atof(ptrs[FUEL_A]);
fp->fuel_k = atof(ptrs[FUEL_K]);
fp->fuel_density = atof(ptrs[FUEL_DENSITY]);
fp->cpropep = atoi(ptrs[FUEL_CPROPEP]);
}
return 0;
}
|
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_X86_CPU_H
#define AVUTIL_X86_CPU_H
#include "config.h"
#include "libavutil/cpu.h"
#include "libavutil/cpu_internal.h"
#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
#define X86_AMD3DNOW(flags) CPUEXT(flags, AMD3DNOW)
#define X86_AMD3DNOWEXT(flags) CPUEXT(flags, AMD3DNOWEXT)
#define X86_MMX(flags) CPUEXT(flags, MMX)
#define X86_MMXEXT(flags) CPUEXT(flags, MMXEXT)
#define X86_SSE(flags) CPUEXT(flags, SSE)
#define X86_SSE2(flags) CPUEXT(flags, SSE2)
#define X86_SSE3(flags) CPUEXT(flags, SSE3)
#define X86_SSSE3(flags) CPUEXT(flags, SSSE3)
#define X86_SSE4(flags) CPUEXT(flags, SSE4)
#define X86_SSE42(flags) CPUEXT(flags, SSE42)
#define X86_AVX(flags) CPUEXT(flags, AVX)
#define X86_FMA4(flags) CPUEXT(flags, FMA4)
#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
#define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX)
#define EXTERNAL_MMXEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT)
#define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE)
#define EXTERNAL_SSE2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2)
#define EXTERNAL_SSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3)
#define EXTERNAL_SSSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
#define EXTERNAL_SSE4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4)
#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW)
#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT)
#define INLINE_MMX(flags) CPUEXT_SUFFIX(flags, _INLINE, MMX)
#define INLINE_MMXEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, MMXEXT)
#define INLINE_SSE(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE)
#define INLINE_SSE2(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE2)
#define INLINE_SSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE3)
#define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
#define INLINE_SSE4(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE4)
#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX)
#define INLINE_FMA4(flags) CPUEXT_SUFFIX(flags, _INLINE, FMA4)
void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx);
void ff_cpu_xgetbv(int op, int *eax, int *edx);
int ff_cpu_cpuid_test(void);
#endif /* AVUTIL_X86_CPU_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.