text
stringlengths 4
6.14k
|
|---|
// This file has been prepared for Doxygen automatic documentation generation.
/*! \file *********************************************************************
*
* \brief VRT_TIMER_CONF_H
*
* \par Application note:
* AVR2017: RZRAVEN FW
*
* \par Documentation
* For comprehensive code documentation, supported compilers, compiler
* settings and supported devices see readme.html
*
* \author
* Atmel Corporation: http://www.atmel.com \n
* Support email: avr@atmel.com
*
* $Id: vrt_timer_conf.h 41144 2008-04-29 12:42:28Z ihanssen $
*
* Copyright (c) 2008 , Atmel Corporation. All rights reserved.
*
* Licensed under Atmels Limited License Agreement (RZRaven Evaluation and Starter Kit).
*****************************************************************************/
#ifndef VRT_TIMER_CONF_H
#define VRT_TIMER_CONF_H
/*================================= INCLUDES =========================*/
#include <stdint.h>
#include <stdbool.h>
//! \addtogroup grVRTTimer
//! @{
/*================================= MACROS =========================*/
/*================================= TYEPDEFS =========================*/
typedef uint8_t vrt_time_queue_size_t; //!< Size type for holding number of events in queue.
/*================================= GLOBAL VARIABLES =========================*/
/*================================= LOCAL VARIABLES =========================*/
/*================================= PROTOTYPES =========================*/
//! @}
#endif
/*EOF*/
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
#define WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "webkit/dom_storage/dom_storage_database_adapter.h"
#include "webkit/storage/webkit_storage_export.h"
namespace base {
class FilePath;
}
namespace dom_storage {
class DomStorageDatabase;
class WEBKIT_STORAGE_EXPORT LocalStorageDatabaseAdapter :
public DomStorageDatabaseAdapter {
public:
explicit LocalStorageDatabaseAdapter(const base::FilePath& path);
virtual ~LocalStorageDatabaseAdapter();
virtual void ReadAllValues(ValuesMap* result) OVERRIDE;
virtual bool CommitChanges(bool clear_all_first,
const ValuesMap& changes) OVERRIDE;
virtual void DeleteFiles() OVERRIDE;
virtual void Reset() OVERRIDE;
protected:
// Constructor that uses an in-memory sqlite database, for testing.
LocalStorageDatabaseAdapter();
private:
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, BackingDatabaseOpened);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitChangesAtShutdown);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, CommitTasks);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, DeleteOrigin);
FRIEND_TEST_ALL_PREFIXES(DomStorageAreaTest, PurgeMemory);
scoped_ptr<DomStorageDatabase> db_;
DISALLOW_COPY_AND_ASSIGN(LocalStorageDatabaseAdapter);
};
} // namespace dom_storage
#endif // WEBKIT_DOM_STORAGE_LOCAL_STORAGE_DATABASE_ADAPTER_H_
|
//
// Swiftz.h
// Swiftz
//
// Created by Robert Widmann on 1/21/15.
// Copyright (c) 2015 TypeLift. All rights reserved.
//
|
/*
*
* Copyright (C) 1998-2012, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
*
* Module: dcmpstat
*
* Author: Marco Eichelberg
*
* Purpose:
* classes: DVPSDisplayedArea_PList
*
*/
#ifndef DVPSDAL_H
#define DVPSDAL_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmpstat/dpdefine.h"
#include "dcmtk/dcmpstat/dvpstyp.h" /* for enum types */
#include "dcmtk/dcmdata/dcitem.h"
class DVPSDisplayedArea;
class DVPSReferencedSeries_PList;
/** the list of displayed area selections contained in a presentation state (internal use only).
* This class manages the data structures comprising one complete displayed area selection sequence
* contained in a presentation state object.
*/
class DCMTK_DCMPSTAT_EXPORT DVPSDisplayedArea_PList
{
public:
/// default constructor
DVPSDisplayedArea_PList();
/// copy constructor
DVPSDisplayedArea_PList(const DVPSDisplayedArea_PList& copy);
/** clone method.
* @return a pointer to a new DVPSDisplayedArea_PList object containing
* a deep copy of this object.
*/
DVPSDisplayedArea_PList *clone() { return new DVPSDisplayedArea_PList(*this); }
/// destructor
virtual ~DVPSDisplayedArea_PList();
/** reads a list of displayed area selections (DisplayedAreaSelectionSequence) from a DICOM dataset.
* The DICOM elements of the displayed area selection item are copied from the dataset to this object.
* The completeness of all items (presence of all required elements,
* value multiplicity) is checked.
* If this method returns an error code, the object is in undefined state afterwards.
* @param dset the DICOM dataset from which the sequence is to be read
* @return EC_Normal if successful, an error code otherwise.
*/
OFCondition read(DcmItem &dset);
/** writes the list of displayed area selections managed by this object to a DICOM dataset.
* Copies of the DICOM elements managed by this object are inserted into
* the DICOM dataset.
* @param dset the DICOM dataset to which the DisplayedAreaSelectionSequence is written
* @return EC_Normal if successful, an error code otherwise.
*/
OFCondition write(DcmItem &dset);
/** reset the object to initial state.
* After this call, the object is in the same state as after
* creation with the default constructor.
*/
void clear();
/** gets the number of displayed area selections in this list.
* @return the number of displayed area selections.
*/
size_t size() const { return list_.size(); }
/** checks if an displayed area selection exists for the given image and frame.
* @param instanceUID SOP instance UID of the current image
* @param frame number of the current frame
* @return pointer to the displayed area if it exists, NULL otherwise.
*/
DVPSDisplayedArea *findDisplayedArea(const char *instanceUID, unsigned long frame);
/** finds or creates a displayed area selection SQ item
* with an applicability controlled by the applicability, instanceUID and frame
* parameters. The displayed area selection sequence is rearranged such that
* all other referenced images/frames keep their old displayed area settings.
* @param allReferences list of series/instance references registered for the
* presentation state.
* @param sopclassUID SOP class UID of the current image
* @param instanceUID SOP instance UID of the current image
* @param frame number of the current frame
* @param numberOfFrames number of frames of the current image
* @param applicability applicability of the new displayed area selection
* @return pointer to a displayed area selection object from the list
* that matches the applicability parameters. NULL is returned if
* out of memory.
*/
DVPSDisplayedArea *createDisplayedArea(
DVPSReferencedSeries_PList& allReferences,
const char *sopclassUID,
const char *instanceUID,
unsigned long frame,
unsigned long numberOfFrames,
DVPSObjectApplicability applicability);
/** adjusts all displayed area coordinates for the rotation and flipping
* status of the image.
* @param rotationFrom previous rotation
* @param isFlippedFrom previous flip status
* @param rotationTo new rotation
* @param isFlippedTo new flip status
*/
void rotateAndFlip(
DVPSRotationType rotationFrom,
OFBool isFlippedFrom,
DVPSRotationType rotationTo,
OFBool isFlippedTo);
private:
/** private undefined assignment operator
*/
DVPSDisplayedArea_PList& operator=(const DVPSDisplayedArea_PList&);
/** the list maintained by this object
*/
OFList<DVPSDisplayedArea *> list_;
};
#endif
|
#include "../../../../../src/gui/painting/qbezier_p.h"
|
/*
* Copyright (c) 2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include <jni.h>
#include <gcm_util.h>
#include <hmac_util.h>
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env = NULL;
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
return -1;
}
Init_GCM_CTX_Ptr_Field(env);
Init_HMAC_CTX_Ptr_Field(env);
return JNI_VERSION_1_4;
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef RTCOfferOptionsPlatform_h
#define RTCOfferOptionsPlatform_h
#include "platform/heap/Handle.h"
namespace blink {
class RTCOfferOptionsPlatform final : public GarbageCollected<RTCOfferOptionsPlatform> {
public:
static RTCOfferOptionsPlatform* create(int32_t offerToReceiveVideo, int32_t offerToReceiveAudio, bool voiceActivityDetection, bool iceRestart)
{
return new RTCOfferOptionsPlatform(offerToReceiveVideo, offerToReceiveAudio, voiceActivityDetection, iceRestart);
}
int32_t offerToReceiveVideo() const { return m_offerToReceiveVideo; }
int32_t offerToReceiveAudio() const { return m_offerToReceiveAudio; }
bool voiceActivityDetection() const { return m_voiceActivityDetection; }
bool iceRestart() const { return m_iceRestart; }
DEFINE_INLINE_TRACE() {}
private:
RTCOfferOptionsPlatform(int32_t offerToReceiveVideo, int32_t offerToReceiveAudio, bool voiceActivityDetection, bool iceRestart)
: m_offerToReceiveVideo(offerToReceiveVideo)
, m_offerToReceiveAudio(offerToReceiveAudio)
, m_voiceActivityDetection(voiceActivityDetection)
, m_iceRestart(iceRestart)
{
}
int32_t m_offerToReceiveVideo;
int32_t m_offerToReceiveAudio;
bool m_voiceActivityDetection;
bool m_iceRestart;
};
} // namespace blink
#endif // RTCOfferOptionsPlatform_h
|
/*
Copyright Rene Rivera 2006.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include "jam.h"
#ifdef OPT_BOEHM_GC
/* Compile the Boehm GC as one big chunk of code. It's much easier
this way, than trying to make radical changes to the bjam build
scripts. */
#define ATOMIC_UNCOLLECTABLE
#define NO_EXECUTE_PERMISSION
#define ALL_INTERIOR_POINTERS
#define LARGE_CONFIG
/*
#define NO_SIGNALS
#define SILENT
*/
#ifndef GC_DEBUG
#define NO_DEBUGGING
#endif
#ifdef __GLIBC__
#define __USE_GNU
#endif
#include "boehm_gc/reclaim.c"
#include "boehm_gc/allchblk.c"
#include "boehm_gc/misc.c"
#include "boehm_gc/alloc.c"
#include "boehm_gc/mach_dep.c"
#include "boehm_gc/os_dep.c"
#include "boehm_gc/mark_rts.c"
#include "boehm_gc/headers.c"
#include "boehm_gc/mark.c"
#include "boehm_gc/obj_map.c"
#include "boehm_gc/pcr_interface.c"
#include "boehm_gc/blacklst.c"
#include "boehm_gc/new_hblk.c"
#include "boehm_gc/real_malloc.c"
#include "boehm_gc/dyn_load.c"
#include "boehm_gc/dbg_mlc.c"
#include "boehm_gc/malloc.c"
#include "boehm_gc/stubborn.c"
#include "boehm_gc/checksums.c"
#include "boehm_gc/pthread_support.c"
#include "boehm_gc/pthread_stop_world.c"
#include "boehm_gc/darwin_stop_world.c"
#include "boehm_gc/typd_mlc.c"
#include "boehm_gc/ptr_chck.c"
#include "boehm_gc/mallocx.c"
#include "boehm_gc/gcj_mlc.c"
#include "boehm_gc/specific.c"
#include "boehm_gc/gc_dlopen.c"
#include "boehm_gc/backgraph.c"
#include "boehm_gc/win32_threads.c"
/* Needs to be last. */
#include "boehm_gc/finalize.c"
#elif defined(OPT_DUMA)
#ifdef OS_NT
#define WIN32
#endif
#include "duma/duma.c"
#include "duma/print.c"
#endif
|
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of The University of Texas at Austin 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.
*/
void bli_sumsqv_unb_var1( obj_t* x,
obj_t* scale,
obj_t* sumsq );
#undef GENTPROTR
#define GENTPROTR( ctype, ctype_r, ch, chr, varname ) \
\
void PASTEMAC(ch,varname)( \
dim_t n, \
void* x, inc_t incx, \
void* scale, \
void* sumsq \
);
INSERT_GENTPROTR_BASIC( sumsqv_unb_var1 )
|
/*
** $Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp $
** Definitions for Lua code that must come before any other header file
** See Copyright Notice in lutf8lib.c
*/
#ifndef lprefix_h
#define lprefix_h
/*
** Allows POSIX/XSI stuff
*/
#if !defined(LUA_USE_C89) /* { */
#if !defined(_XOPEN_SOURCE)
#define _XOPEN_SOURCE 600
#elif _XOPEN_SOURCE == 0
#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */
#endif
/*
** Allows manipulation of large files in gcc and some other compilers
*/
#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS)
#define _LARGEFILE_SOURCE 1
#define _FILE_OFFSET_BITS 64
#endif
#endif /* } */
/*
** Windows stuff
*/
#if defined(_WIN32) /* { */
#if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */
#endif
#endif /* } */
#endif
|
////////////////////////////////////////////////////////////////////////////////
//
// TYPHOON FRAMEWORK
// Copyright 2013, Typhoon Framework Contributors
// All Rights Reserved.
//
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "TyphoonDefinition.h"
@protocol TyphoonPropertyInjection;
@protocol TyphoonInjection;
@class TyphoonComponentFactory;
@class TyphoonRuntimeArguments;
typedef void(^TyphoonInjectionsEnumerationBlock)(id injection, id*injectionToReplace, BOOL*stop);
typedef enum {
TyphoonInjectionsEnumerationOptionProperties = 1 << 0,
TyphoonInjectionsEnumerationOptionMethods = 1 << 2
} TyphoonInjectionsEnumerationOption;
#define TyphoonInjectionsEnumerationOptionAll (TyphoonInjectionsEnumerationOptionProperties | TyphoonInjectionsEnumerationOptionMethods)
@interface TyphoonDefinition (InstanceBuilder)
- (TyphoonMethod *)beforeInjections;
- (NSSet *)injectedProperties;
- (NSSet *)injectedMethods;
- (TyphoonMethod *)afterInjections;
- (void)enumerateInjectionsOfKind:(Class)injectionClass options:(TyphoonInjectionsEnumerationOption)options
usingBlock:(TyphoonInjectionsEnumerationBlock)block;
- (BOOL)hasRuntimeArgumentInjections;
- (void)addInjectedProperty:(id <TyphoonPropertyInjection>)property;
- (void)addInjectedPropertyIfNotExists:(id <TyphoonPropertyInjection>)property;
- (id)targetForInitializerWithFactory:(TyphoonComponentFactory *)factory args:(TyphoonRuntimeArguments *)args;
@end
|
/*
* libev poll fd activity backend
*
* Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
* CIAL, 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 OTH-
* ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU General Public License ("GPL") version 2 or any later version,
* in which case the provisions of the GPL are applicable instead of
* the above. If you wish to allow the use of your version of this file
* only under the terms of the GPL and not to allow others to use your
* version of this file under the BSD license, indicate your decision
* by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete the
* provisions above, a recipient may use your version of this file under
* either the BSD or the GPL.
*/
#include <poll.h>
void inline_size
pollidx_init (int *base, int count)
{
/* consider using memset (.., -1, ...), which is pratically guarenteed
* to work on all systems implementing poll */
while (count--)
*base++ = -1;
}
static void
poll_modify (EV_P_ int fd, int oev, int nev)
{
int idx;
if (oev == nev)
return;
array_needsize (int, pollidxs, pollidxmax, fd + 1, pollidx_init);
idx = pollidxs [fd];
if (idx < 0) /* need to allocate a new pollfd */
{
pollidxs [fd] = idx = pollcnt++;
array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2);
polls [idx].fd = fd;
}
assert (polls [idx].fd == fd);
if (nev)
polls [idx].events =
(nev & EV_READ ? POLLIN : 0)
| (nev & EV_WRITE ? POLLOUT : 0);
else /* remove pollfd */
{
pollidxs [fd] = -1;
if (expect_true (idx < --pollcnt))
{
polls [idx] = polls [pollcnt];
pollidxs [polls [idx].fd] = idx;
}
}
}
static void
poll_poll (EV_P_ ev_tstamp timeout)
{
struct pollfd *p;
int res = poll (polls, pollcnt, (int)ceil (timeout * 1000.));
if (expect_false (res < 0))
{
if (errno == EBADF)
fd_ebadf (EV_A);
else if (errno == ENOMEM && !syserr_cb)
fd_enomem (EV_A);
else if (errno != EINTR)
ev_syserr ("(libev) poll");
}
else
for (p = polls; res; ++p)
if (expect_false (p->revents)) /* this expect is debatable */
{
--res;
if (expect_false (p->revents & POLLNVAL))
fd_kill (EV_A_ p->fd);
else
fd_event (
EV_A_
p->fd,
(p->revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0)
| (p->revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
);
}
}
int inline_size
poll_init (EV_P_ int flags)
{
backend_fudge = 0.; /* posix says this is zero */
backend_modify = poll_modify;
backend_poll = poll_poll;
pollidxs = 0; pollidxmax = 0;
polls = 0; pollmax = 0; pollcnt = 0;
return EVBACKEND_POLL;
}
void inline_size
poll_destroy (EV_P)
{
ev_free (pollidxs);
ev_free (polls);
}
|
/* Public Domain Curses */
#include <curspriv.h>
RCSID("$Id: inchstr.c,v 1.1 2009/05/10 08:29:53 jld Exp $")
/*man-start**************************************************************
Name: inchstr
Synopsis:
int inchstr(chtype *ch);
int inchnstr(chtype *ch, int n);
int winchstr(WINDOW *win, chtype *ch);
int winchnstr(WINDOW *win, chtype *ch, int n);
int mvinchstr(int y, int x, chtype *ch);
int mvinchnstr(int y, int x, chtype *ch, int n);
int mvwinchstr(WINDOW *, int y, int x, chtype *ch);
int mvwinchnstr(WINDOW *, int y, int x, chtype *ch, int n);
int in_wchstr(cchar_t *wch);
int in_wchnstr(cchar_t *wch, int n);
int win_wchstr(WINDOW *win, cchar_t *wch);
int win_wchnstr(WINDOW *win, cchar_t *wch, int n);
int mvin_wchstr(int y, int x, cchar_t *wch);
int mvin_wchnstr(int y, int x, cchar_t *wch, int n);
int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch);
int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n);
Description:
These routines read a chtype or cchar_t string from the window,
starting at the current or specified position, and ending at the
right margin, or after n elements, whichever is less.
Return Value:
All functions return the number of elements read, or ERR on
error.
Portability X/Open BSD SYS V
inchstr Y - 4.0
winchstr Y - 4.0
mvinchstr Y - 4.0
mvwinchstr Y - 4.0
inchnstr Y - 4.0
winchnstr Y - 4.0
mvinchnstr Y - 4.0
mvwinchnstr Y - 4.0
in_wchstr Y
win_wchstr Y
mvin_wchstr Y
mvwin_wchstr Y
in_wchnstr Y
win_wchnstr Y
mvin_wchnstr Y
mvwin_wchnstr Y
**man-end****************************************************************/
int winchnstr(WINDOW *win, chtype *ch, int n)
{
chtype *src;
int i;
PDC_LOG(("winchnstr() - called\n"));
if (!win || !ch || n < 0)
return ERR;
if ((win->_curx + n) > win->_maxx)
n = win->_maxx - win->_curx;
src = win->_y[win->_cury] + win->_curx;
for (i = 0; i < n; i++)
*ch++ = *src++;
*ch = (chtype)0;
return OK;
}
int inchstr(chtype *ch)
{
PDC_LOG(("inchstr() - called\n"));
return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx);
}
int winchstr(WINDOW *win, chtype *ch)
{
PDC_LOG(("winchstr() - called\n"));
return winchnstr(win, ch, win->_maxx - win->_curx);
}
int mvinchstr(int y, int x, chtype *ch)
{
PDC_LOG(("mvinchstr() - called: y %d x %d\n", y, x));
if (move(y, x) == ERR)
return ERR;
return winchnstr(stdscr, ch, stdscr->_maxx - stdscr->_curx);
}
int mvwinchstr(WINDOW *win, int y, int x, chtype *ch)
{
PDC_LOG(("mvwinchstr() - called:\n"));
if (wmove(win, y, x) == ERR)
return ERR;
return winchnstr(win, ch, win->_maxx - win->_curx);
}
int inchnstr(chtype *ch, int n)
{
PDC_LOG(("inchnstr() - called\n"));
return winchnstr(stdscr, ch, n);
}
int mvinchnstr(int y, int x, chtype *ch, int n)
{
PDC_LOG(("mvinchnstr() - called: y %d x %d n %d\n", y, x, n));
if (move(y, x) == ERR)
return ERR;
return winchnstr(stdscr, ch, n);
}
int mvwinchnstr(WINDOW *win, int y, int x, chtype *ch, int n)
{
PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n));
if (wmove(win, y, x) == ERR)
return ERR;
return winchnstr(win, ch, n);
}
#ifdef PDC_WIDE
int win_wchnstr(WINDOW *win, cchar_t *wch, int n)
{
PDC_LOG(("win_wchnstr() - called\n"));
return winchnstr(win, wch, n);
}
int in_wchstr(cchar_t *wch)
{
PDC_LOG(("in_wchstr() - called\n"));
return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx);
}
int win_wchstr(WINDOW *win, cchar_t *wch)
{
PDC_LOG(("win_wchstr() - called\n"));
return win_wchnstr(win, wch, win->_maxx - win->_curx);
}
int mvin_wchstr(int y, int x, cchar_t *wch)
{
PDC_LOG(("mvin_wchstr() - called: y %d x %d\n", y, x));
if (move(y, x) == ERR)
return ERR;
return win_wchnstr(stdscr, wch, stdscr->_maxx - stdscr->_curx);
}
int mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wch)
{
PDC_LOG(("mvwin_wchstr() - called:\n"));
if (wmove(win, y, x) == ERR)
return ERR;
return win_wchnstr(win, wch, win->_maxx - win->_curx);
}
int in_wchnstr(cchar_t *wch, int n)
{
PDC_LOG(("in_wchnstr() - called\n"));
return win_wchnstr(stdscr, wch, n);
}
int mvin_wchnstr(int y, int x, cchar_t *wch, int n)
{
PDC_LOG(("mvin_wchnstr() - called: y %d x %d n %d\n", y, x, n));
if (move(y, x) == ERR)
return ERR;
return win_wchnstr(stdscr, wch, n);
}
int mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wch, int n)
{
PDC_LOG(("mvwinchnstr() - called: y %d x %d n %d \n", y, x, n));
if (wmove(win, y, x) == ERR)
return ERR;
return win_wchnstr(win, wch, n);
}
#endif
|
/*
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2010 revosec AG
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup tls_eap tls_eap
* @{ @ingroup libtls
*/
#ifndef TLS_EAP_H_
#define TLS_EAP_H_
typedef struct tls_eap_t tls_eap_t;
#include <eap/eap.h>
#include "tls.h"
/**
* TLS over EAP helper, as used by EAP-TLS and EAP-TTLS.
*/
struct tls_eap_t {
/**
* Initiate TLS/TTLS/TNC over EAP exchange (as client).
*
* @param out allocated EAP packet data to send
* @return
* - NEED_MORE if more exchanges required
* - FAILED if initiation failed
*/
status_t (*initiate)(tls_eap_t *this, chunk_t *out);
/**
* Process a received EAP-TLS/TTLS/TNC packet, create response.
*
* @param in EAP packet data to process
* @param out allocated EAP packet data to send
* @return
* - SUCCESS if TLS negotiation completed
* - FAILED if TLS negotiation failed
* - NEED_MORE if more exchanges required
*/
status_t (*process)(tls_eap_t *this, chunk_t in, chunk_t *out);
/**
* Get the EAP-MSK.
*
* @return MSK
*/
chunk_t (*get_msk)(tls_eap_t *this);
/**
* Get the current EAP identifier.
*
* @return identifier
*/
u_int8_t (*get_identifier)(tls_eap_t *this);
/**
* Set the EAP identifier to a deterministic value, overwriting
* the randomly initialized default value.
*
* @param identifier EAP identifier
*/
void (*set_identifier) (tls_eap_t *this, u_int8_t identifier);
/**
* Destroy a tls_eap_t.
*/
void (*destroy)(tls_eap_t *this);
};
/**
* Create a tls_eap instance.
*
* @param type EAP type, EAP-TLS or EAP-TTLS
* @param tls TLS implementation
* @param frag_size maximum size of a TLS fragment we send
* @param max_msg_count maximum number of processed messages
* @param include_length if TRUE include length in non-fragmented packets
*/
tls_eap_t *tls_eap_create(eap_type_t type, tls_t *tls, size_t frag_size,
int max_msg_count, bool include_length);
#endif /** TLS_EAP_H_ @}*/
|
/*
* Copied from newlib 1.8.2
*/
typedef void (*pfunc) (void);
extern pfunc __ctors[];
extern pfunc __ctors_end[];
void __main (void)
{
static int initialized;
pfunc *p;
if (initialized)
return;
initialized = 1;
for (p = __ctors_end; p > __ctors; )
(*--p) ();
}
|
/*
* 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.
*/
#include "config.h"
#include "directory_save.h"
#include "directory.h"
#include "song.h"
#include "text_file.h"
#include "song_save.h"
#include "playlist_database.h"
#include <assert.h>
#include <string.h>
#define DIRECTORY_DIR "directory: "
#define DIRECTORY_MTIME "mtime: "
#define DIRECTORY_BEGIN "begin: "
#define DIRECTORY_END "end: "
/**
* The quark used for GError.domain.
*/
static inline GQuark
directory_quark(void)
{
return g_quark_from_static_string("directory");
}
void
directory_save(FILE *fp, const struct directory *directory)
{
if (!directory_is_root(directory)) {
fprintf(fp, DIRECTORY_MTIME "%lu\n",
(unsigned long)directory->mtime);
fprintf(fp, "%s%s\n", DIRECTORY_BEGIN,
directory_get_path(directory));
}
struct directory *cur;
directory_for_each_child(cur, directory) {
char *base = g_path_get_basename(cur->path);
fprintf(fp, DIRECTORY_DIR "%s\n", base);
g_free(base);
directory_save(fp, cur);
if (ferror(fp))
return;
}
struct song *song;
directory_for_each_song(song, directory)
song_save(fp, song);
playlist_vector_save(fp, &directory->playlists);
if (!directory_is_root(directory))
fprintf(fp, DIRECTORY_END "%s\n",
directory_get_path(directory));
}
static struct directory *
directory_load_subdir(FILE *fp, struct directory *parent, const char *name,
GString *buffer, GError **error_r)
{
const char *line;
bool success;
if (directory_get_child(parent, name) != NULL) {
g_set_error(error_r, directory_quark(), 0,
"Duplicate subdirectory '%s'", name);
return NULL;
}
struct directory *directory = directory_new_child(parent, name);
line = read_text_line(fp, buffer);
if (line == NULL) {
g_set_error(error_r, directory_quark(), 0,
"Unexpected end of file");
directory_delete(directory);
return NULL;
}
if (g_str_has_prefix(line, DIRECTORY_MTIME)) {
directory->mtime =
g_ascii_strtoull(line + sizeof(DIRECTORY_MTIME) - 1,
NULL, 10);
line = read_text_line(fp, buffer);
if (line == NULL) {
g_set_error(error_r, directory_quark(), 0,
"Unexpected end of file");
directory_delete(directory);
return NULL;
}
}
if (!g_str_has_prefix(line, DIRECTORY_BEGIN)) {
g_set_error(error_r, directory_quark(), 0,
"Malformed line: %s", line);
directory_delete(directory);
return NULL;
}
success = directory_load(fp, directory, buffer, error_r);
if (!success) {
directory_delete(directory);
return NULL;
}
return directory;
}
bool
directory_load(FILE *fp, struct directory *directory,
GString *buffer, GError **error)
{
const char *line;
while ((line = read_text_line(fp, buffer)) != NULL &&
!g_str_has_prefix(line, DIRECTORY_END)) {
if (g_str_has_prefix(line, DIRECTORY_DIR)) {
struct directory *subdir =
directory_load_subdir(fp, directory,
line + sizeof(DIRECTORY_DIR) - 1,
buffer, error);
if (subdir == NULL)
return false;
} else if (g_str_has_prefix(line, SONG_BEGIN)) {
const char *name = line + sizeof(SONG_BEGIN) - 1;
struct song *song;
if (directory_get_song(directory, name) != NULL) {
g_set_error(error, directory_quark(), 0,
"Duplicate song '%s'", name);
return NULL;
}
song = song_load(fp, directory, name,
buffer, error);
if (song == NULL)
return false;
directory_add_song(directory, song);
} else if (g_str_has_prefix(line, PLAYLIST_META_BEGIN)) {
/* duplicate the name, because
playlist_metadata_load() will overwrite the
buffer */
char *name = g_strdup(line + sizeof(PLAYLIST_META_BEGIN) - 1);
if (!playlist_metadata_load(fp, &directory->playlists,
name, buffer, error)) {
g_free(name);
return false;
}
g_free(name);
} else {
g_set_error(error, directory_quark(), 0,
"Malformed line: %s", line);
return false;
}
}
return true;
}
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifndef LAMMPS_MY_POOL_CHUNK_H
#define LAMMPS_MY_POOL_CHUNK_H
namespace LAMMPS_NS {
template <class T> class MyPoolChunk {
public:
int ndatum; // total # of stored datums
int nchunk; // total # of stored chunks
MyPoolChunk(int user_minchunk = 1, int user_maxchunk = 1, int user_nbin = 1,
int user_chunkperpage = 1024, int user_pagedelta = 1);
// free all allocated memory
~MyPoolChunk();
// return pointer/index of unused chunk of size maxchunk
T *get(int &index);
// return pointer/index of unused chunk of size N
T *get(int n, int &index);
// return indexed chunk to pool via free list
// index = -1 if no allocated chunk
void put(int index);
// total memory used in bytes
double size() const;
/** Return error status
*
* \return 0 if no error, 1 if invalid input, 2 if malloc() failed, 3 if chunk > maxchunk */
int status() const { return errorflag; }
private:
int minchunk; // min # of datums per chunk
int maxchunk; // max # of datums per chunk
int nbin; // # of bins to split min-to-max into
int chunkperpage; // # of chunks on every page, regardless of which bin
int pagedelta; // # of pages to allocate at once, default = 1
int binsize; // delta in chunk sizes between adjacent bins
int errorflag; // flag > 0 if error has occurred
// 1 = invalid inputs
// 2 = memory allocation error
// 3 = chunk size exceeded maxchunk
T **pages; // list of allocated pages
int *whichbin; // which bin each page belongs to
int npage; // # of allocated pages
int *freelist; // each chunk points to next unused chunk in same bin
int *freehead; // index of first unused chunk in each bin
int *chunksize; // size of chunks in each bin
void allocate(int ibin);
};
} // namespace LAMMPS_NS
#endif
|
/*
* arch/arm/mach-spear6xx/include/mach/misc_regs.h
*
* Miscellaneous registers definitions for SPEAr6xx machine family
*
* Copyright (C) 2009 ST Microelectronics
* Viresh Kumar<viresh.kumar@st.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#ifndef __MACH_MISC_REGS_H
#define __MACH_MISC_REGS_H
#include <mach/spear.h>
#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE)
#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
#endif /* __MACH_MISC_REGS_H */
|
/*
* Copyright (C) 2005-2016 Team XBMC
* http://kodi.tv
*
* 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
#include "cores/IPlayer.h"
#include "../ProcessInfo.h"
namespace VIDEOPLAYER
{
class CProcessInfoWin10 : public CProcessInfo
{
public:
static CProcessInfo* Create();
static void Register();
EINTERLACEMETHOD GetFallbackDeintMethod() override;
std::vector<AVPixelFormat> GetRenderFormats() override;
};
}
|
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright (C) 2011 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, 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 name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
/*
* Declarations for credential cache selection module implementors.
*
* The ccselect pluggable interface currently has only one supported major
* version, which is 1. Major version 1 has a current minor version number of
* 1.
*
* Credential cache selection modules should define a function named
* ccselect_<modulename>_initvt, matching the signature:
*
* krb5_error_code
* ccselect_modname_initvt(krb5_context context, int maj_ver, int min_ver,
* krb5_plugin_vtable vtable);
*
* The initvt function should:
*
* - Check that the supplied maj_ver number is supported by the module, or
* return KRB5_PLUGIN_VER_NOTSUPP if it is not.
*
* - Cast the vtable pointer as appropriate for maj_ver:
* maj_ver == 1: Cast to krb5_ccselect_vtable
*
* - Initialize the methods of the vtable, stopping as appropriate for the
* supplied min_ver. Optional methods may be left uninitialized.
*
* Memory for the vtable is allocated by the caller, not by the module.
*/
#ifndef KRB5_CCSELECT_PLUGIN_H
#define KRB5_CCSELECT_PLUGIN_H
#include <krb5/krb5.h>
#include <krb5/plugin.h>
/* An abstract type for credential cache selection module data. */
typedef struct krb5_ccselect_moddata_st *krb5_ccselect_moddata;
#define KRB5_CCSELECT_PRIORITY_AUTHORITATIVE 2
#define KRB5_CCSELECT_PRIORITY_HEURISTIC 1
/*** Method type declarations ***/
/*
* Mandatory: Initialize module data and set *priority_out to one of the
* KRB5_CCSELECT_PRIORITY constants above. Authoritative modules will be
* consulted before heuristic ones.
*/
typedef krb5_error_code
(*krb5_ccselect_init_fn)(krb5_context context, krb5_ccselect_moddata *data_out,
int *priority_out);
/*
* Mandatory: Select a cache based on a server principal. Return 0 on success,
* with *cache_out set to the selected cache and *princ_out set to its default
* principal. Return KRB5_PLUGIN_NO_HANDLE to defer to other modules. Return
* KRB5_CC_NOTFOUND with *princ_out set if the client principal can be
* authoritatively determined but no cache exists for it. Return other errors
* as appropriate.
*/
typedef krb5_error_code
(*krb5_ccselect_choose_fn)(krb5_context context, krb5_ccselect_moddata data,
krb5_principal server, krb5_ccache *cache_out,
krb5_principal *princ_out);
/* Optional: Release resources used by module data. */
typedef void
(*krb5_ccselect_fini_fn)(krb5_context context, krb5_ccselect_moddata data);
/*** vtable declarations **/
/* Credential cache selection plugin vtable for major version 1. */
typedef struct krb5_ccselect_vtable_st {
const char *name; /* Mandatory: name of module. */
krb5_ccselect_init_fn init;
krb5_ccselect_choose_fn choose;
krb5_ccselect_fini_fn fini;
/* Minor version 1 ends here. */
} *krb5_ccselect_vtable;
#endif /* KRB5_CCSELECT_PLUGIN_H */
|
/*
Copyright 2005-2014 Intel Corporation. All Rights Reserved.
This file is part of Threading Building Blocks. Threading Building Blocks 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. Threading Building Blocks 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 Threading Building Blocks; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
As a special exception, you may use this file as part of a free software library without
restriction. Specifically, if other files instantiate templates or use macros or inline
functions from this file, or you compile this file and link it with other files to produce
an executable, this file does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General Public License.
*/
/*
The original source for this example is
Copyright (c) 1994-2008 John E. Stone
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/*
* ring.h - This file contains the defines for rings etc.
*
* $Id: ring.h,v 1.2 2007-02-22 17:54:16 Exp $
*/
object * newring(void * tex, vector ctr, vector norm, flt in, flt out);
#ifdef RING_PRIVATE
typedef struct {
unsigned int id; /* Unique Object serial number */
void * nextobj; /* pointer to next object in list */
object_methods * methods; /* this object's methods */
texture * tex; /* object texture */
vector ctr;
vector norm;
flt inrad;
flt outrad;
} ring;
static int ring_bbox(void * obj, vector * min, vector * max);
static void ring_intersect(ring *, ray *);
static void ring_normal(ring *, vector *, ray * incident, vector *);
#endif
|
/*
* embedded.h - Code for embedding data files
*
* This feature is only active when --enable-embedded is given to the
* configure script, its main use is to make developing new ports easier
* and to allow ports for platforms which don't have a filesystem, or a
* filesystem which is hard/impossible to load data files from.
*
* Written by
* Marco van den Heuvel <blackystardust68@yahoo.com>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_EMBEDDED_H
#define VICE_EMBEDDED_H
#include "vice.h"
#include "types.h"
#include "palette.h"
#ifdef USE_EMBEDDED
extern size_t embedded_check_file(const char *name, BYTE *dest, int minsize, int maxsize);
extern size_t embedded_check_extra(const char *name, BYTE *dest, int minsize, int maxsize);
extern int embedded_palette_load(const char *file_name, palette_t *palette_return);
#else
#define embedded_check_file(w, x, y, z) (0)
#define embedded_palette_load(x, y) (-1)
#endif
typedef struct embedded_s {
char *name;
int minsize;
int maxsize;
size_t size;
BYTE *esrc;
} embedded_t;
typedef struct embedded_palette_s {
char *name1;
char *name2;
int num_entries;
unsigned char *palette;
} embedded_palette_t;
#endif
|
/* ====================================================================
* Copyright (c) 1989-2000 Carnegie Mellon University. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The names "Sphinx" and "Carnegie Mellon" must not be used to
* endorse or promote products derived from this software without
* prior written permission. To obtain permission, contact
* sphinx@cs.cmu.edu.
*
* 4. Products derived from this software may not be called "Sphinx"
* nor may "Sphinx" appear in their names without prior written
* permission of Carnegie Mellon University. To obtain permission,
* contact sphinx@cs.cmu.edu.
*
* 5. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by Carnegie
* Mellon University (http://www.speech.cs.cmu.edu/)."
*
* THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
* ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
* NOR ITS EMPLOYEES 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.
*
* ====================================================================
*
*/
/*
30 May 1989 David R. Fulmer (drf) updated to do byte order
conversions when necessary.
*/
#include <stdio.h>
#include <stdlib.h>
#if (! WIN32)
#include <sys/file.h>
#include <sys/fcntl.h>
#include <unistd.h>
#else
#include <fcntl.h>
#endif
#include "byteorder.h"
int
f2read (char *file, float **data1_ref, float **data2_ref, int *length_ref)
{
int fd;
int length;
int size;
int offset;
char *data1, *data2;
if ((fd = open (file, O_RDONLY, 0644)) < 0)
{
fprintf (stderr, "f2read: %s: can't open\n", file);
return -1;
}
if (read (fd, (char *) &length, 4) != 4)
{
fprintf (stderr, "f2read: %s: can't read length (empty file?)\n", file);
return (-1);
}
SWAPL(&length);
size = length * sizeof (float);
if (!(data1 = malloc ((unsigned) size)))
{
fprintf (stderr, "f2read: %s: can't alloc data1\n", file);
close (fd);
return -1;
}
if (read (fd, data1, size) != size)
{
fprintf (stderr, "f2read: %s: can't read data1\n", file);
close (fd);
free (data1);
return -1;
}
if (!(data2 = malloc ((unsigned) size)))
{
fprintf (stderr, "f2read: %s: can't alloc data2\n", file);
close (fd);
free (data1);
return -1;
}
if (read (fd, data2, size) != size)
{
fprintf (stderr, "f2read: %s: can't read data2\n", file);
close (fd);
free (data1);
free (data2);
return -1;
}
close (fd);
*data1_ref = (float *) data1;
*data2_ref = (float *) data2;
for(offset = 0; offset < length; offset++) {
SWAPF(*data1_ref + offset);
SWAPF(*data2_ref + offset);
}
*length_ref = length;
return length;
}
|
/* { dg-do run } */
/* { dg-require-effective-target p8vector_hw } */
/* { dg-options "-mdejagnu-cpu=power8 -O3 " } */
#include <altivec.h>
extern void abort (void);
vector int x;
vector int y = { 0, 1, 2, 3 };
vector int z;
vector int
foo (void)
{
return y; /* Remove 1 swap and use lvx. */
}
vector int
foo1 (void)
{
x = y; /* Remove 2 redundant swaps here. */
return x; /* Remove 1 swap and use lvx. */
}
void __attribute__ ((noinline))
fill_local (vector int *vp)
{
*vp = x; /* Remove 2 redundant swaps here. */
}
/* Test aligned load from local. */
vector int
foo2 (void)
{
vector int v;
/* Need to be clever here because v will normally reside in a
register rather than memory. */
fill_local (&v);
return v; /* Remove 1 swap and use lvx. */
}
/* Test aligned load from pointer. */
vector int
foo3 (vector int *arg)
{
return *arg; /* Remove 1 swap and use lvx. */
}
/* In this structure, the compiler should insert padding to assure
that a_vector is properly aligned. */
struct bar {
short a_field;
vector int a_vector;
};
vector int
foo4 (struct bar *bp)
{
return bp->a_vector; /* Remove 1 swap and use lvx. */
}
/* Test aligned store to global. */
void
baz (vector int arg)
{
x = arg; /* Remove 1 swap and use stvx. */
}
void __attribute__ ((noinline))
copy_local (vector int *arg)
{
x = *arg; /* Remove 2 redundant swaps. */
}
/* Test aligned store to local. */
void
baz1 (vector int arg)
{
vector int v;
/* Need cleverness, because v will normally reside in a register
rather than memory. */
v = arg; /* Aligned store to local: remove 1
swap and use stvx. */
copy_local (&v);
}
/* Test aligned store to pointer. */
void
baz2 (vector int *arg1, vector int arg2)
{
/* Assume arg2 resides in register. */
*arg1 = arg2; /* Remove 1 swap and use stvx. */
}
void
baz3 (struct bar *bp, vector int v)
{
/* Assume v resides in register. */
bp->a_vector = v; /* Remove 1 swap and use stvx. */
}
int
main (int argc, int *argv[])
{
vector int fetched_value = foo ();
if (fetched_value[0] != 0 || fetched_value[3] != 3)
abort ();
fetched_value = foo1 ();
if (fetched_value[1] != 1 || fetched_value[2] != 2)
abort ();
fetched_value = foo2 ();
if (fetched_value[2] != 2 || fetched_value[1] != 1)
abort ();
fetched_value = foo3 (&x);
if (fetched_value[3] != 3 || fetched_value[0] != 0)
abort ();
struct bar a_struct;
a_struct.a_vector = x; /* Remove 2 redundant swaps. */
fetched_value = foo4 (&a_struct);
if (fetched_value[2] != 2 || fetched_value[3] != 3)
abort ();
z[0] = 7;
z[1] = 6;
z[2] = 5;
z[3] = 4;
baz (z);
if (x[0] != 7 || x[3] != 4)
abort ();
vector int source = { 8, 7, 6, 5 };
baz1 (source);
if (x[2] != 6 || x[1] != 7)
abort ();
vector int dest;
baz2 (&dest, source);
if (dest[0] != 8 || dest[1] != 7)
abort ();
baz3 (&a_struct, source);
if (a_struct.a_vector[3] != 5 || a_struct.a_vector[0] != 8)
abort ();
return 0;
}
|
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
/* GeoIPCity.h
*
* Copyright (C) 2006 MaxMind LLC
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GEOIPCITY_H
#define GEOIPCITY_H
#include <GeoIP.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GEOIP_UNKNOWN_CONF ( 0x7f )
#define GEOIP_UNKNOWN_ACCURACY_RADIUS ( 0x3ff )
typedef struct GeoIPRecordTag {
char *country_code;
char *country_code3;
char *country_name;
char *region;
char *city;
char *postal_code;
float latitude;
float longitude;
union {
int metro_code; /* metro_code is a alias for dma_code */
int dma_code;
};
int area_code;
int charset;
char *continent_code;
/* confidence factor for Country/Region/City/Postal */
unsigned char country_conf, region_conf, city_conf, postal_conf;
int accuracy_radius;
} GeoIPRecord;
GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr);
GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host);
int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr);
int GeoIP_init_record_iter (GeoIP* gi);
/* returns 0 on success, 1 on failure */
int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
void GeoIPRecord_delete (GeoIPRecord *gir);
/* NULL on failure otherwise a malloced string in utf8 */
/* char * GeoIP_iso_8859_1__utf8(const char *); */
#ifdef __cplusplus
}
#endif
#endif /* GEOIPCITY_H */
|
/*
* squawk_memory.h
*
* Created on: 31 jan 2014
* Author: zsz
*/
#ifndef SQUAWK_MEMORY_H_
#define SQUAWK_MEMORY_H_
//#include "stddef.h"
#define squawk_heap_size 20971520 //20M
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long ulong;
/* roundmb - round address up to size of memblock */
#define roundmb(x) (void *)( (7 + (ulong)(x)) & ~0x07 )
/* truncmb - truncate address down to size of memblock */
#define truncmb(x) (void *)( ((ulong)(x)) & ~0x07 )
/**
* @ingroup memory_mgmt
*
* Frees memory allocated with stkget().
*
* @param p
* Pointer to the topmost (highest address) word of the allocated stack (as
* returned by stkget()).
* @param len
* Size of the allocated stack, in bytes. (Same value passed to stkget().)
*/
#define stkfree(p, len) memfree((void *)((ulong)(p) \
- (ulong)roundmb(len) \
+ (ulong)sizeof(ulong)), \
(ulong)roundmb(len))
/**
* Structure for a block of memory.
*/
struct memblock
{
struct memblock *next; /**< pointer to next memory block */
uint length; /**< size of memory block (with struct) */
};
extern struct memblock memlist; /**< head of free memory list */
/* Other memory data */
//extern void *_end; /**< linker provides end of image */
extern void *memheap; /**< bottom of heap */
/* Memory function prototypes */
void usb_heap_init(void);
void *memget(uint);
void memfree(void *, uint);
void *stkget(uint);
//void bzero(void *s, unsigned n);
#endif /* SQUAWK_MEMORY_H_ */
|
#ifndef LIBHEADER_H
#define LIBHEADER_H
void libA_process();
#endif //#ifndef LIBHEADER_H
|
/*
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
***************************************************************************
* *
* FreeRTOS tutorial books are available in pdf and paperback. *
* Complete, revised, and edited pdf reference manuals are also *
* available. *
* *
* Purchasing FreeRTOS documentation will not only help you, by *
* ensuring you get running as quickly as possible and with an *
* in-depth knowledge of how to use FreeRTOS, it will also help *
* the FreeRTOS project to continue with its mission of providing *
* professional grade, cross platform, de facto standard solutions *
* for microcontrollers - completely free of charge! *
* *
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
* *
* Thank you for using FreeRTOS, and thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS 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 AND MODIFIED BY the FreeRTOS exception.
>>>NOTE<<< The modification to the GPL is included to allow you to
distribute a combined work that includes FreeRTOS without being obliged to
provide the source code for proprietary components outside of the FreeRTOS
kernel. FreeRTOS 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 and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
/*
* Implementation of pvPortMalloc() and vPortFree() that relies on the
* compilers own malloc() and free() implementations.
*
* This file can only be used if the linker is configured to to generate
* a heap memory area.
*
* See heap_2.c and heap_1.c for alternative implementations, and the memory
* management pages of http://www.FreeRTOS.org for more information.
*/
#include <stdlib.h>
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when
task.h is included from an application file. */
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#include "FreeRTOS.h"
#include "task.h"
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
/*-----------------------------------------------------------*/
void *pvPortMalloc( size_t xWantedSize )
{
void *pvReturn;
vTaskSuspendAll();
{
pvReturn = malloc( xWantedSize );
}
xTaskResumeAll();
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
{
if( pvReturn == NULL )
{
extern void vApplicationMallocFailedHook( void );
vApplicationMallocFailedHook();
}
}
#endif
return pvReturn;
}
/*-----------------------------------------------------------*/
void vPortFree( void *pv )
{
if( pv )
{
vTaskSuspendAll();
{
free( pv );
}
xTaskResumeAll();
}
}
|
/*
*
* 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
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#include "ref_params.h"
class IWorld;
class IProxy;
class DirectorCmd;
class IBaseSystem;
class ISystemModule;
class IObjectContainer;
class IDemoPlayer {
public:
virtual ~IDemoPlayer() {}
virtual bool Init(IBaseSystem *system, int serial, char *name) = 0;
virtual void RunFrame(double time) = 0;
virtual void ReceiveSignal(ISystemModule *module, unsigned int signal, void *data) = 0;
virtual void ExecuteCommand(int commandID, char *commandLine) = 0;
virtual void RegisterListener(ISystemModule *module) = 0;
virtual void RemoveListener(ISystemModule *module) = 0;
virtual IBaseSystem *GetSystem() = 0;
virtual int GetSerial() = 0;
virtual char *GetStatusLine() = 0;
virtual char *GetType() = 0;
virtual char *GetName() = 0;
virtual int GetState() = 0;
virtual int GetVersion() = 0;
virtual void ShutDown() = 0;
virtual void NewGame(IWorld *world, IProxy *proxy = nullptr) = 0;
virtual char *GetModName() = 0;
virtual void WriteCommands(BitBuffer *stream, float startTime, float endTime) = 0;
virtual int AddCommand(DirectorCmd *cmd) = 0;
virtual bool RemoveCommand(int index) = 0;
virtual DirectorCmd *GetLastCommand() = 0;
virtual IObjectContainer *GetCommands() = 0;
virtual void SetWorldTime(double time, bool relative) = 0;
virtual void SetTimeScale(float scale) = 0;
virtual void SetPaused(bool state) = 0;
virtual void SetEditMode(bool state) = 0;
virtual void SetMasterMode(bool state) = 0;
virtual bool IsPaused() = 0;
virtual bool IsLoading() = 0;
virtual bool IsActive() = 0;
virtual bool IsEditMode() = 0;
virtual bool IsMasterMode() = 0;
virtual void RemoveFrames(double starttime, double endtime) = 0;
virtual void ExecuteDirectorCmd(DirectorCmd *cmd) = 0;
virtual double GetWorldTime() = 0;
virtual double GetStartTime() = 0;
virtual double GetEndTime() = 0;
virtual float GetTimeScale() = 0;
virtual IWorld *GetWorld() = 0;
virtual char *GetFileName() = 0;
virtual bool SaveGame(char *filename) = 0;
virtual bool LoadGame(char *filename) = 0;
virtual void Stop() = 0;
virtual void ForceHLTV(bool state) = 0;
virtual void GetDemoViewInfo(ref_params_t *rp, float *view, int *viewmodel) = 0;
virtual int ReadDemoMessage(unsigned char *buffer, int size) = 0;
virtual void ReadNetchanState(int *incoming_sequence, int *incoming_acknowledged, int *incoming_reliable_acknowledged, int *incoming_reliable_sequence, int *outgoing_sequence, int *reliable_sequence, int *last_reliable_sequence) = 0;
};
#define DEMOPLAYER_INTERFACE_VERSION "demoplayer001"
|
#ifndef VT_MATH3D_H
#define VT_MATH3D_H
/* FILE: vt_math3d.h -- */
/* */
/* Header file for vt_math3d.c: 3D gmtl::Matrix44f and Vector */
/* operations */
/* */
/* ========================================================== */
/* -- Copyright (C) 1990,91,92,93 Virtual Technologies -- */
/* -- Copyright (C) 1990,91,92 Larry Edwards -- */
/* -- -- */
/* -- Authors: Larry Edwards, William L. Chapin -- */
/* ========================================================== */
#include <gadget/Devices/DriverConfig.h>
#include <math.h>
#define epsilon 0.000001
#define EPSILON 0.01
#ifndef RAD2DEG
#define RAD2DEG (180.0 / M_PI)
#endif
#ifndef DEG2RAD
#define DEG2RAD (M_PI / 180.0)
#endif
enum { XAXIS = 0, YAXIS, ZAXIS };
enum { VX = 0, VY, VZ, VW, AZ = 3, EL, ROLL };
enum { PX = 0, PY, PZ, PW };
enum { Premult, Postmult };
typedef float vec2d[2];
typedef float vec3d[3];
typedef float vec4d[4];
typedef float vec5d[5];
typedef float vec6d[6];
typedef vec2d pos2d;
typedef vec3d pos3d;
typedef vec4d pos4d;
typedef vec5d pos5d;
typedef vec6d pos6d;
typedef float matrix2x2[2][2];
typedef float matrix3x3[3][3];
typedef float matrix4x4[4][4];
extern matrix4x4 identity_matrix,zero_matrix;
extern float vt_atan2(float x, float y);
extern float vt_coord_plane_dist(pos3d pnt, int plane_normal_axis);
extern void vt_set_vec3(float u, float v, float w, vec3d result);
extern void vt_copy_vec3(vec3d v1, vec3d v2);
extern void vt_copy_vec6(vec6d v1, vec6d v2);
extern void vt_vec_diff3(vec3d pnt1, vec3d pnt2, vec3d result);
extern void vt_vec_sub3(vec3d v1, vec3d v2, vec3d result);
extern void vt_vec_neg3(vec3d v1, vec3d result);
extern void vt_vec_add3(vec3d v1, vec3d v2, vec3d result);
extern void vt_cross_prod3(vec3d v1, vec3d v2, vec3d v1Xv2);
extern float vt_dot_prod3(vec3d v1, vec3d v2);
extern float vt_vec_length3(vec3d v1);
extern void vt_normalize3(vec3d v1, vec3d v2);
extern void vt_copy_matrix(matrix4x4 A, matrix4x4 B);
extern void vt_identity_matrix_fill(matrix4x4 A);
extern void vt_zero_matrix_fill(matrix4x4 A);
extern void vt_rot_matrix(float theta, char axis, matrix4x4 A);
extern void vt_trans_matrix(vec3d pnt, matrix4x4 A);
extern void vt_scale_matrix(vec3d scale, matrix4x4 A);
extern void vt_axis_rot_matrix(vec3d rot_pt, vec3d rot_axis, float rot_angle,
matrix4x4 rot_matrix);
extern void vt_mult_matrix(matrix4x4 A, matrix4x4 B, matrix4x4 result);
extern void vt_mult_rot_matrix(float theta, char axis, int order, matrix4x4 A);
extern void vt_mult_trans_matrix(pos3d pnt, int order, matrix4x4 A);
extern void vt_mult_scale_matrix(vec3d scale, int order, matrix4x4 A);
extern void vt_transform3(vec3d pt, matrix4x4 A, vec3d xformedpt);
extern void vt_transform4(vec4d pt, matrix4x4 A, vec4d xformedpt);
extern void vt_matrix_to_euler_angles(matrix4x4 rotm, vec3d euler_angle);
extern void vt_gen_view_matrix(vec3d camera, vec3d gaze_vec,
matrix4x4 viewmatrix);
#endif /* VT_MATH3D_H */
|
/****************************************************************************
*
* Copyright 2021 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
#include <stdio.h>
#include <tinyara/net/if/ble.h>
#include <tinyara/ble/ble_manager.h>
#include "bledev_mgr_server.h"
#define BLE_DRV_TAG "[BLEDRV_SERVER]"
static void ble_server_connected_null_cb(trble_conn_handle con_handle, trble_server_connection_type_e conn_type, uint8_t mac[TRBLE_BD_ADDR_MAX_LEN])
{
return;
}
static void ble_server_null_cb(trble_attr_cb_type_e type, trble_conn_handle linkindex, trble_attr_handle handle, void *arg)
{
return;
}
static trble_gatt_t gatt_null_profile[] = {
{
.type = TRBLE_GATT_SERVICE,
.uuid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01},
.uuid_length = 16,
.attr_handle = 0x00a1,
},
{
.type = TRBLE_GATT_CHARACT,
.uuid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02},
.uuid_length = 16,
.property = TRBLE_ATTR_PROP_RWN | TRBLE_ATTR_PROP_WRITE_NO_RSP,
.permission = TRBLE_ATTR_PERM_R_PERMIT | TRBLE_ATTR_PERM_W_PERMIT,
.attr_handle = 0x00a2,
.cb = ble_server_null_cb,
.arg = NULL
},
{
.type = TRBLE_GATT_DESC,
.uuid = {0x02, 0x29},
.uuid_length = 2,
.permission = TRBLE_ATTR_PERM_R_PERMIT | TRBLE_ATTR_PERM_W_PERMIT,
.attr_handle = 0x00a3,
.cb = ble_server_null_cb,
.arg = NULL,
},
};
// This config is for empty server.
static trble_server_init_config g_server_null_config = {
ble_server_connected_null_cb,
true,
gatt_null_profile,
sizeof(gatt_null_profile) / sizeof(trble_gatt_t)
};
trble_server_init_config *bledrv_server_get_null_config(void)
{
return &g_server_null_config;
}
|
#pragma once
struct ChannelSearchInfo
{
int type;
CHANNEL_HANDLE hChannel;
};
typedef void (* ChannelHandler)(CHANNEL_HANDLE, int);
bool SearchChannel(ChannelSearchInfo * searchInfo);
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
#define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/cras_audio_client.h"
namespace chromeos {
class CrasAudioHandlerTest;
// The CrasAudioClient implementation used on Linux desktop.
class CHROMEOS_EXPORT FakeCrasAudioClient : public CrasAudioClient {
public:
FakeCrasAudioClient();
~FakeCrasAudioClient() override;
// CrasAudioClient overrides:
void Init(dbus::Bus* bus) override;
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
bool HasObserver(const Observer* observer) const override;
void GetVolumeState(const GetVolumeStateCallback& callback) override;
void GetNodes(const GetNodesCallback& callback,
const ErrorCallback& error_callback) override;
void SetOutputNodeVolume(uint64 node_id, int32 volume) override;
void SetOutputUserMute(bool mute_on) override;
void SetInputNodeGain(uint64 node_id, int32 gain) override;
void SetInputMute(bool mute_on) override;
void SetActiveOutputNode(uint64 node_id) override;
void SetActiveInputNode(uint64 node_id) override;
void AddActiveInputNode(uint64 node_id) override;
void RemoveActiveInputNode(uint64 node_id) override;
void AddActiveOutputNode(uint64 node_id) override;
void RemoveActiveOutputNode(uint64 node_id) override;
void SwapLeftRight(uint64 node_id, bool swap) override;
// Updates |node_list_| to contain |audio_nodes|.
void SetAudioNodesForTesting(const AudioNodeList& audio_nodes);
// Calls SetAudioNodesForTesting() and additionally notifies |observers_|.
void SetAudioNodesAndNotifyObserversForTesting(
const AudioNodeList& new_nodes);
private:
VolumeState volume_state_;
AudioNodeList node_list_;
uint64 active_input_node_id_;
uint64 active_output_node_id_;
base::ObserverList<Observer> observers_;
DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient);
};
} // namespace chromeos
#endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
|
/****************************************************************************
*
* Copyright (c) 2013 PX4 Development Team. All rights reserved.
* Author: Lorenz Meier <lm@inf.ethz.ch>
*
* 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 PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*
* @file params.h
*
* Definition of parameters for fixedwing example
*/
#include <parameters/param.h>
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
#define NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
#include <memory>
#include "net/base/net_export.h"
namespace net {
class URLRequest;
class URLRequestJob;
// In tests, URLRequestFilter lets URLRequestInterceptors create URLRequestJobs
// to handle URLRequests before they're handed off to the ProtocolHandler for
// the request's scheme.
//
// TODO(mmenke): Only include this file in test targets. Also consider using
// callbacks instead, or even removing URLRequestFilter.
class NET_EXPORT URLRequestInterceptor {
public:
URLRequestInterceptor();
URLRequestInterceptor(const URLRequestInterceptor&) = delete;
URLRequestInterceptor& operator=(const URLRequestInterceptor&) = delete;
virtual ~URLRequestInterceptor();
// Returns a URLRequestJob to handle |request|, if the interceptor wants to
// take over the handling the request instead of the default ProtocolHandler.
// Otherwise, returns nullptr.
virtual std::unique_ptr<URLRequestJob> MaybeInterceptRequest(
URLRequest* request) const = 0;
};
} // namespace net
#endif // NET_URL_REQUEST_URL_REQUEST_INTERCEPTOR_H_
|
/*
* Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \addtogroup cc2538-rtimer
* @{
*
* \file
* Implementation of the arch-specific rtimer functions for the cc2538
*
*/
#include "contiki.h"
#include "sys/energest.h"
#include "sys/rtimer.h"
#include "dev/nvic.h"
#include "dev/smwdthrosc.h"
#include "cpu.h"
#include "lpm.h"
#include <stdint.h>
/*---------------------------------------------------------------------------*/
static volatile rtimer_clock_t next_trigger;
/*---------------------------------------------------------------------------*/
/**
* \brief We don't need to explicitly initialise anything but this
* routine is required by the API.
*
* The Sleep Timer starts ticking automatically as soon as the device
* turns on. We don't need to turn on interrupts before the first call
* to rtimer_arch_schedule()
*/
void
rtimer_arch_init(void)
{
return;
}
/*---------------------------------------------------------------------------*/
/**
* \brief Schedules an rtimer task to be triggered at time t
* \param t The time when the task will need executed. This is an absolute
* time, in other words the task will be executed AT time \e t,
* not IN \e t ticks
*/
void
rtimer_arch_schedule(rtimer_clock_t t)
{
rtimer_clock_t now;
/* STLOAD must be 1 */
while((REG(SMWDTHROSC_STLOAD) & SMWDTHROSC_STLOAD_STLOAD) != 1);
INTERRUPTS_DISABLE();
now = RTIMER_NOW();
/*
* New value must be 5 ticks in the future. The ST may tick once while we're
* writing the registers. We play it safe here and we add a bit of leeway
*/
if((int32_t)(t - now) < 7) {
t = now + 7;
}
/* ST0 latches ST[1:3] and must be written last */
REG(SMWDTHROSC_ST3) = (t >> 24) & 0x000000FF;
REG(SMWDTHROSC_ST2) = (t >> 16) & 0x000000FF;
REG(SMWDTHROSC_ST1) = (t >> 8) & 0x000000FF;
REG(SMWDTHROSC_ST0) = t & 0x000000FF;
INTERRUPTS_ENABLE();
/* Store the value. The LPM module will query us for it */
next_trigger = t;
nvic_interrupt_enable(NVIC_INT_SM_TIMER);
}
/*---------------------------------------------------------------------------*/
rtimer_clock_t
rtimer_arch_next_trigger()
{
return next_trigger;
}
/*---------------------------------------------------------------------------*/
/**
* \brief Returns the current real-time clock time
* \return The current rtimer time in ticks
*/
rtimer_clock_t
rtimer_arch_now()
{
rtimer_clock_t rv;
/* SMWDTHROSC_ST0 latches ST[1:3] and must be read first */
rv = REG(SMWDTHROSC_ST0);
rv |= (REG(SMWDTHROSC_ST1) << 8);
rv |= (REG(SMWDTHROSC_ST2) << 16);
rv |= (REG(SMWDTHROSC_ST3) << 24);
return rv;
}
/*---------------------------------------------------------------------------*/
/**
* \brief The rtimer ISR
*
* Interrupts are only turned on when we have an rtimer task to schedule
* Once the interrupt fires, the task is called and then interrupts no
* longer get acknowledged until the next task needs scheduled.
*/
void
rtimer_isr()
{
/*
* If we were in PM1+, call the wake-up sequence first. This will make sure
* that the 32MHz OSC is selected as the clock source. We need to do this
* before calling the next rtimer_task, since the task may need the RF.
*/
lpm_exit();
ENERGEST_ON(ENERGEST_TYPE_IRQ);
next_trigger = 0;
nvic_interrupt_unpend(NVIC_INT_SM_TIMER);
nvic_interrupt_disable(NVIC_INT_SM_TIMER);
rtimer_run_next();
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
/** @} */
|
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
* Copyright 2016,2019 NXP
*/
#ifndef __RTA_KEY_CMD_H__
#define __RTA_KEY_CMD_H__
extern enum rta_sec_era rta_sec_era;
/* Allowed encryption flags for each SEC Era */
static const uint32_t key_enc_flags[] = {
ENC,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK,
ENC | NWB | EKT | TK | PTS,
ENC | NWB | EKT | TK | PTS,
ENC | NWB | EKT | TK | PTS,
ENC | NWB | EKT | TK | PTS
};
static inline int
rta_key(struct program *program, uint32_t key_dst,
uint32_t encrypt_flags, uint64_t src, uint32_t length,
uint32_t flags)
{
uint32_t opcode = 0;
bool is_seq_cmd = false;
unsigned int start_pc = program->current_pc;
if (encrypt_flags & ~key_enc_flags[rta_sec_era]) {
pr_err("KEY: Flag(s) not supported by SEC Era %d\n",
USER_SEC_ERA(rta_sec_era));
goto err;
}
/* write cmd type */
if (flags & SEQ) {
opcode = CMD_SEQ_KEY;
is_seq_cmd = true;
} else {
opcode = CMD_KEY;
}
/* check parameters */
if (is_seq_cmd) {
if ((flags & IMMED) || (flags & SGF)) {
pr_err("SEQKEY: Invalid flag. SEC PC: %d; Instr: %d\n",
program->current_pc,
program->current_instruction);
goto err;
}
if ((rta_sec_era <= RTA_SEC_ERA_5) &&
((flags & VLF) || (flags & AIDF))) {
pr_err("SEQKEY: Flag(s) not supported by SEC Era %d\n",
USER_SEC_ERA(rta_sec_era));
goto err;
}
} else {
if ((flags & AIDF) || (flags & VLF)) {
pr_err("KEY: Invalid flag. SEC PC: %d; Instr: %d\n",
program->current_pc,
program->current_instruction);
goto err;
}
if ((flags & SGF) && (flags & IMMED)) {
pr_err("KEY: Invalid flag. SEC PC: %d; Instr: %d\n",
program->current_pc,
program->current_instruction);
goto err;
}
}
if ((encrypt_flags & PTS) &&
((encrypt_flags & ENC) || (encrypt_flags & NWB) ||
(key_dst == PKE))) {
pr_err("KEY: Invalid flag / destination. SEC PC: %d; Instr: %d\n",
program->current_pc, program->current_instruction);
goto err;
}
if (key_dst == AFHA_SBOX) {
if (rta_sec_era == RTA_SEC_ERA_7) {
pr_err("KEY: AFHA S-box not supported by SEC Era %d\n",
USER_SEC_ERA(rta_sec_era));
goto err;
}
if (flags & IMMED) {
pr_err("KEY: Invalid flag. SEC PC: %d; Instr: %d\n",
program->current_pc,
program->current_instruction);
goto err;
}
/*
* Sbox data loaded into the ARC-4 processor must be exactly
* 258 bytes long, or else a data sequence error is generated.
*/
if (length != 258) {
pr_err("KEY: Invalid length. SEC PC: %d; Instr: %d\n",
program->current_pc,
program->current_instruction);
goto err;
}
}
/* write key destination and class fields */
switch (key_dst) {
case (KEY1):
opcode |= KEY_DEST_CLASS1;
break;
case (KEY2):
opcode |= KEY_DEST_CLASS2;
break;
case (PKE):
opcode |= KEY_DEST_CLASS1 | KEY_DEST_PKHA_E;
break;
case (AFHA_SBOX):
opcode |= KEY_DEST_CLASS1 | KEY_DEST_AFHA_SBOX;
break;
case (MDHA_SPLIT_KEY):
opcode |= KEY_DEST_CLASS2 | KEY_DEST_MDHA_SPLIT;
break;
default:
pr_err("KEY: Invalid destination. SEC PC: %d; Instr: %d\n",
program->current_pc, program->current_instruction);
goto err;
}
/* write key length */
length &= KEY_LENGTH_MASK;
opcode |= length;
/* write key command specific flags */
if (encrypt_flags & ENC) {
/* Encrypted (black) keys must be padded to 8 bytes (CCM) or
* 16 bytes (ECB) depending on EKT bit. AES-CCM encrypted keys
* (EKT = 1) have 6-byte nonce and 6-byte MAC after padding.
*/
opcode |= KEY_ENC;
if (encrypt_flags & EKT) {
opcode |= KEY_EKT;
length = ALIGN(length, 8);
length += 12;
} else {
length = ALIGN(length, 16);
}
if (encrypt_flags & TK)
opcode |= KEY_TK;
}
if (encrypt_flags & NWB)
opcode |= KEY_NWB;
if (encrypt_flags & PTS)
opcode |= KEY_PTS;
/* write general command flags */
if (!is_seq_cmd) {
if (flags & IMMED)
opcode |= KEY_IMM;
if (flags & SGF)
opcode |= KEY_SGF;
} else {
if (flags & AIDF)
opcode |= KEY_AIDF;
if (flags & VLF)
opcode |= KEY_VLF;
}
__rta_out32(program, opcode);
program->current_instruction++;
if (flags & IMMED)
__rta_inline_data(program, src, flags & __COPY_MASK, length);
else
__rta_out64(program, program->ps, src);
return (int)start_pc;
err:
program->first_error_pc = start_pc;
program->current_instruction++;
return -EINVAL;
}
#endif /* __RTA_KEY_CMD_H__ */
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtk_hdf5.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef __vtk_hdf5_h
#define __vtk_hdf5_h
/* Use the zlib library configured for VTK. */
#include "vtkToolkits.h"
#ifdef VTK_USE_SYSTEM_HDF5
# include <hdf5.h>
#else
# include <vtkhdf5/src/hdf5.h>
#endif
#endif
|
#if AMPLITUDE_SSL_PINNING
//
// AMPURLConnection.h
// Amplitude
//
// Created by Allan on 3/13/15.
// Copyright (c) 2015 Amplitude. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ISPPinnedNSURLConnectionDelegate.h"
@interface AMPURLConnection : ISPPinnedNSURLConnectionDelegate <NSURLConnectionDelegate,NSURLConnectionDataDelegate>
+ (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue *)queue completionHandler:(void (^)(NSURLResponse *response, NSData *data, NSError *connectionError))handler;
@end
#endif
|
/*
* x86 CPU topology data structures and functions
*
* Copyright (c) 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef TARGET_I386_TOPOLOGY_H
#define TARGET_I386_TOPOLOGY_H
/* This file implements the APIC-ID-based CPU topology enumeration logic,
* documented at the following document:
* Intel® 64 Architecture Processor Topology Enumeration
* http://software.intel.com/en-us/articles/intel-64-architecture-processor-topology-enumeration/
*
* This code should be compatible with AMD's "Extended Method" described at:
* AMD CPUID Specification (Publication #25481)
* Section 3: Multiple Core Calcuation
* as long as:
* nr_threads is set to 1;
* OFFSET_IDX is assumed to be 0;
* CPUID Fn8000_0008_ECX[ApicIdCoreIdSize[3:0]] is set to apicid_core_width().
*/
#include <stdint.h>
#include <string.h>
#include "qemu/bitops.h"
/* APIC IDs can be 32-bit, but beware: APIC IDs > 255 require x2APIC support
*/
typedef uint32_t apic_id_t;
/* Return the bit width needed for 'count' IDs
*/
static unsigned apicid_bitwidth_for_count(unsigned count)
{
g_assert(count >= 1);
if (count == 1) {
return 0;
}
return bitops_flsl(count - 1) + 1;
}
/* Bit width of the SMT_ID (thread ID) field on the APIC ID
*/
static inline unsigned apicid_smt_width(unsigned nr_cores, unsigned nr_threads)
{
return apicid_bitwidth_for_count(nr_threads);
}
/* Bit width of the Core_ID field
*/
static inline unsigned apicid_core_width(unsigned nr_cores, unsigned nr_threads)
{
return apicid_bitwidth_for_count(nr_cores);
}
/* Bit offset of the Core_ID field
*/
static inline unsigned apicid_core_offset(unsigned nr_cores,
unsigned nr_threads)
{
return apicid_smt_width(nr_cores, nr_threads);
}
/* Bit offset of the Pkg_ID (socket ID) field
*/
static inline unsigned apicid_pkg_offset(unsigned nr_cores, unsigned nr_threads)
{
return apicid_core_offset(nr_cores, nr_threads) +
apicid_core_width(nr_cores, nr_threads);
}
/* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID
*
* The caller must make sure core_id < nr_cores and smt_id < nr_threads.
*/
static inline apic_id_t apicid_from_topo_ids(unsigned nr_cores,
unsigned nr_threads,
unsigned pkg_id,
unsigned core_id,
unsigned smt_id)
{
return (pkg_id << apicid_pkg_offset(nr_cores, nr_threads)) |
(core_id << apicid_core_offset(nr_cores, nr_threads)) |
smt_id;
}
/* Calculate thread/core/package IDs for a specific topology,
* based on (contiguous) CPU index
*/
static inline void x86_topo_ids_from_idx(unsigned nr_cores,
unsigned nr_threads,
unsigned cpu_index,
unsigned *pkg_id,
unsigned *core_id,
unsigned *smt_id)
{
unsigned core_index = cpu_index / nr_threads;
*smt_id = cpu_index % nr_threads;
*core_id = core_index % nr_cores;
*pkg_id = core_index / nr_cores;
}
/* Make APIC ID for the CPU 'cpu_index'
*
* 'cpu_index' is a sequential, contiguous ID for the CPU.
*/
static inline apic_id_t x86_apicid_from_cpu_idx(unsigned nr_cores,
unsigned nr_threads,
unsigned cpu_index)
{
unsigned pkg_id, core_id, smt_id;
x86_topo_ids_from_idx(nr_cores, nr_threads, cpu_index,
&pkg_id, &core_id, &smt_id);
return apicid_from_topo_ids(nr_cores, nr_threads, pkg_id, core_id, smt_id);
}
#endif /* TARGET_I386_TOPOLOGY_H */
|
/*
This source file is part of Konsole, a terminal emulator.
Copyright 2007-2008 by Robert Knight <robertknight@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., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef COLORSCHEMEMANAGER_H
#define COLORSCHEMEMANAGER_H
// Qt
#include <QtCore/QHash>
#include <QtCore/QStringList>
// Konsole
#include "ColorScheme.h"
namespace Konsole
{
/**
* Manages the color schemes available for use by terminal displays.
* See ColorScheme
*/
class ColorSchemeManager
{
public:
/**
* Constructs a new ColorSchemeManager and loads the list
* of available color schemes.
*
* The color schemes themselves are not loaded until they are first
* requested via a call to findColorScheme()
*/
ColorSchemeManager();
/**
* Destroys the ColorSchemeManager and saves any modified color schemes to disk.
*/
~ColorSchemeManager();
/**
* Returns the default color scheme for Konsole
*/
const ColorScheme* defaultColorScheme() const;
/**
* Returns the color scheme with the given name or 0 if no
* scheme with that name exists. If @p name is empty, the
* default color scheme is returned.
*
* The first time that a color scheme with a particular name is
* requested, the configuration information is loaded from disk.
*/
const ColorScheme* findColorScheme(const QString& name);
/**
* Adds a new color scheme to the manager. If @p scheme has the same name as
* an existing color scheme, it replaces the existing scheme.
*/
void addColorScheme(ColorScheme* scheme);
/**
* Deletes a color scheme. Returns true on successful deletion or false otherwise.
*/
bool deleteColorScheme(const QString& name);
/**
* Returns a list of the all the available color schemes.
* This may be slow when first called because all of the color
* scheme resources on disk must be located, read and parsed.
*
* Subsequent calls will be inexpensive.
*/
QList<const ColorScheme*> allColorSchemes();
/** Returns the global color scheme manager instance. */
static ColorSchemeManager* instance();
private:
// loads a color scheme from a KDE 4+ .colorscheme file
bool loadColorScheme(const QString& path);
// loads a color scheme from a KDE 3 .schema file
bool loadKDE3ColorScheme(const QString& path);
// returns a list of paths of color schemes in the KDE 4+ .colorscheme file format
QStringList listColorSchemes();
// returns a list of paths of color schemes in the .schema file format
// used in KDE 3
QStringList listKDE3ColorSchemes();
// loads all of the color schemes
void loadAllColorSchemes();
// finds the path of a color scheme
QString findColorSchemePath(const QString& name) const;
QHash<QString, const ColorScheme*> _colorSchemes;
bool _haveLoadedAll;
static const ColorScheme _defaultColorScheme;
};
}
#endif //COLORSCHEMEMANAGER_H
|
#ifndef ISCSI_TARGET_CONFIGFS_H
#define ISCSI_TARGET_CONFIGFS_H
extern int iscsi_target_register_configfs(void);
extern void iscsi_target_deregister_configfs(void);
#endif /* */
|
/*
*
* Alchemy Semi Au1000 pcmcia driver include file
*
* Copyright 2001 MontaVista Software Inc.
* Author: MontaVista Software, Inc.
* ppopov@mvista.com or source@mvista.com
*
* ########################################################################
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope 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_AU1000_PCMCIA_H
#define __ASM_AU1000_PCMCIA_H
#define AU1000_PCMCIA_POLL_PERIOD (2*HZ)
#define AU1000_PCMCIA_IO_SPEED (255)
#define AU1000_PCMCIA_MEM_SPEED (300)
#define AU1X_SOCK0_IO 0xF00000000
#define AU1X_SOCK0_PHYS_ATTR 0xF40000000
#define AU1X_SOCK0_PHYS_MEM 0xF80000000
/* pcmcia socket 1 needs external glue logic so the memory map
* differs from board to board. the general rule is that
* static bus address bit 26 should be used to decode socket 0
* from socket 1. alas, some boards dont follow this...
* These really belong in a board-specific header file...
*/
#ifdef CONFIG_MIPS_PB1000
#define SOCK1_DECODE (1<<27)
#endif
#ifdef CONFIG_MIPS_DB1000
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_DB1500
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_DB1100
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_DB1550
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_DB1200
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_PB1550
#define SOCK1_DECODE (1<<26)
#endif
#ifdef CONFIG_MIPS_PB1200
#define SOCK1_DECODE (1<<26)
#endif
/* The board has a second PCMCIA socket */
#ifdef SOCK1_DECODE
#define AU1X_SOCK1_IO (0xF00000000|SOCK1_DECODE)
#define AU1X_SOCK1_PHYS_ATTR (0xF40000000|SOCK1_DECODE)
#define AU1X_SOCK1_PHYS_MEM (0xF80000000|SOCK1_DECODE)
#endif
struct pcmcia_state {
unsigned detect: 1,
ready: 1,
wrprot: 1,
bvd1: 1,
bvd2: 1,
vs_3v: 1,
vs_Xv: 1;
};
struct pcmcia_configure {
unsigned sock: 8,
vcc: 8,
vpp: 8,
output: 1,
speaker: 1,
reset: 1;
};
struct pcmcia_irq_info {
unsigned int sock;
unsigned int irq;
};
struct au1000_pcmcia_socket {
socket_state_t cs_state;
struct pcmcia_state k_state;
unsigned int irq;
void (*handler)(void *, unsigned int);
void *handler_info;
pccard_io_map io_map[MAX_IO_WIN];
pccard_mem_map mem_map[MAX_WIN];
u32 virt_io;
ioaddr_t phys_attr, phys_mem;
unsigned short speed_io, speed_attr, speed_mem;
};
struct pcmcia_init {
void (*handler)(int irq, void *dev, struct pt_regs *regs);
};
struct pcmcia_low_level {
int (*init)(struct pcmcia_init *);
int (*shutdown)(void);
int (*socket_state)(unsigned sock, struct pcmcia_state *);
int (*get_irq_info)(struct pcmcia_irq_info *);
int (*configure_socket)(const struct pcmcia_configure *);
};
extern struct pcmcia_low_level au1x00_pcmcia_ops;
#endif /* __ASM_AU1000_PCMCIA_H */
|
#ifndef _LINUX_VIRTIO_BLK_H
#define _LINUX_VIRTIO_BLK_H
/* This header is BSD licensed so anyone can use the definitions to implement
* compatible drivers/servers.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of IBM nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. */
#include <linux/types.h>
#include <linux/virtio_ids.h>
#include <linux/virtio_config.h>
/* Feature bits */
#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */
#define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */
#define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */
#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */
#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */
#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
/* Old (deprecated) name for VIRTIO_BLK_F_WCE. */
#define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE
#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
struct virtio_blk_config {
/* The capacity (in 512-byte sectors). */
__u64 capacity;
/* The maximum segment size (if VIRTIO_BLK_F_SIZE_MAX) */
__u32 size_max;
/* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */
__u32 seg_max;
/* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */
struct virtio_blk_geometry {
__u16 cylinders;
__u8 heads;
__u8 sectors;
} geometry;
/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
__u32 blk_size;
/* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */
/* exponent for physical block per logical block. */
__u8 physical_block_exp;
/* alignment offset in logical blocks. */
__u8 alignment_offset;
/* minimum I/O size without performance penalty in logical blocks. */
__u16 min_io_size;
/* optimal sustained I/O size in logical blocks. */
__u32 opt_io_size;
/* writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */
__u8 wce;
__u8 unused;
/* number of vqs, only available when VIRTIO_BLK_F_MQ is set */
__u16 num_queues;
} __attribute__((packed));
/*
* Command types
*
* Usage is a bit tricky as some bits are used as flags and some are not.
*
* Rules:
* VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
* VIRTIO_BLK_T_BARRIER. VIRTIO_BLK_T_FLUSH is a command of its own
* and may not be combined with any of the other flags.
*/
/* These two define direction. */
#define VIRTIO_BLK_T_IN 0
#define VIRTIO_BLK_T_OUT 1
/* This bit says it's a scsi command, not an actual read or write. */
#define VIRTIO_BLK_T_SCSI_CMD 2
/* Cache flush command */
#define VIRTIO_BLK_T_FLUSH 4
/* Get device ID command */
#define VIRTIO_BLK_T_GET_ID 8
/* Barrier before this op. */
#define VIRTIO_BLK_T_BARRIER 0x80000000
/* This is the first element of the read scatter-gather list. */
struct virtio_blk_outhdr {
/* VIRTIO_BLK_T* */
__u32 type;
/* io priority. */
__u32 ioprio;
/* Sector (ie. 512 byte offset) */
__u64 sector;
};
struct virtio_scsi_inhdr {
__u32 errors;
__u32 data_len;
__u32 sense_len;
__u32 residual;
};
/* And this is the final byte of the write scatter-gather list. */
#define VIRTIO_BLK_S_OK 0
#define VIRTIO_BLK_S_IOERR 1
#define VIRTIO_BLK_S_UNSUPP 2
#endif /* _LINUX_VIRTIO_BLK_H */
|
/*
*/
#include <linux/percpu_counter.h>
#include <linux/notifier.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/debugobjects.h>
#ifdef CONFIG_HOTPLUG_CPU
static LIST_HEAD(percpu_counters);
static DEFINE_MUTEX(percpu_counters_lock);
#endif
#ifdef CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER
static struct debug_obj_descr percpu_counter_debug_descr;
static int percpu_counter_fixup_free(void *addr, enum debug_obj_state state)
{
struct percpu_counter *fbc = addr;
switch (state) {
case ODEBUG_STATE_ACTIVE:
percpu_counter_destroy(fbc);
debug_object_free(fbc, &percpu_counter_debug_descr);
return 1;
default:
return 0;
}
}
static struct debug_obj_descr percpu_counter_debug_descr = {
.name = "percpu_counter",
.fixup_free = percpu_counter_fixup_free,
};
static inline void debug_percpu_counter_activate(struct percpu_counter *fbc)
{
debug_object_init(fbc, &percpu_counter_debug_descr);
debug_object_activate(fbc, &percpu_counter_debug_descr);
}
static inline void debug_percpu_counter_deactivate(struct percpu_counter *fbc)
{
debug_object_deactivate(fbc, &percpu_counter_debug_descr);
debug_object_free(fbc, &percpu_counter_debug_descr);
}
#else /* */
static inline void debug_percpu_counter_activate(struct percpu_counter *fbc)
{ }
static inline void debug_percpu_counter_deactivate(struct percpu_counter *fbc)
{ }
#endif /* */
void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
{
int cpu;
raw_spin_lock(&fbc->lock);
for_each_possible_cpu(cpu) {
s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
*pcount = 0;
}
fbc->count = amount;
raw_spin_unlock(&fbc->lock);
}
EXPORT_SYMBOL(percpu_counter_set);
void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)
{
s64 count;
preempt_disable();
count = __this_cpu_read(*fbc->counters) + amount;
if (count >= batch || count <= -batch) {
raw_spin_lock(&fbc->lock);
fbc->count += count;
__this_cpu_write(*fbc->counters, 0);
raw_spin_unlock(&fbc->lock);
} else {
__this_cpu_write(*fbc->counters, count);
}
preempt_enable();
}
EXPORT_SYMBOL(__percpu_counter_add);
/*
*/
s64 __percpu_counter_sum(struct percpu_counter *fbc)
{
s64 ret;
int cpu;
raw_spin_lock(&fbc->lock);
ret = fbc->count;
for_each_online_cpu(cpu) {
s32 *pcount = per_cpu_ptr(fbc->counters, cpu);
ret += *pcount;
}
raw_spin_unlock(&fbc->lock);
return ret;
}
EXPORT_SYMBOL(__percpu_counter_sum);
int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
struct lock_class_key *key)
{
raw_spin_lock_init(&fbc->lock);
lockdep_set_class(&fbc->lock, key);
fbc->count = amount;
fbc->counters = alloc_percpu(s32);
if (!fbc->counters)
return -ENOMEM;
debug_percpu_counter_activate(fbc);
#ifdef CONFIG_HOTPLUG_CPU
INIT_LIST_HEAD(&fbc->list);
mutex_lock(&percpu_counters_lock);
list_add(&fbc->list, &percpu_counters);
mutex_unlock(&percpu_counters_lock);
#endif
return 0;
}
EXPORT_SYMBOL(__percpu_counter_init);
void percpu_counter_destroy(struct percpu_counter *fbc)
{
if (!fbc->counters)
return;
debug_percpu_counter_deactivate(fbc);
#ifdef CONFIG_HOTPLUG_CPU
mutex_lock(&percpu_counters_lock);
list_del(&fbc->list);
mutex_unlock(&percpu_counters_lock);
#endif
free_percpu(fbc->counters);
fbc->counters = NULL;
}
EXPORT_SYMBOL(percpu_counter_destroy);
int percpu_counter_batch __read_mostly = 32;
EXPORT_SYMBOL(percpu_counter_batch);
static void compute_batch_value(void)
{
int nr = num_online_cpus();
percpu_counter_batch = max(32, nr*2);
}
static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb,
unsigned long action, void *hcpu)
{
#ifdef CONFIG_HOTPLUG_CPU
unsigned int cpu;
struct percpu_counter *fbc;
compute_batch_value();
if (action != CPU_DEAD)
return NOTIFY_OK;
cpu = (unsigned long)hcpu;
mutex_lock(&percpu_counters_lock);
list_for_each_entry(fbc, &percpu_counters, list) {
s32 *pcount;
unsigned long flags;
raw_spin_lock_irqsave(&fbc->lock, flags);
pcount = per_cpu_ptr(fbc->counters, cpu);
fbc->count += *pcount;
*pcount = 0;
raw_spin_unlock_irqrestore(&fbc->lock, flags);
}
mutex_unlock(&percpu_counters_lock);
#endif
return NOTIFY_OK;
}
/*
*/
int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
{
s64 count;
count = percpu_counter_read(fbc);
/* */
if (abs(count - rhs) > (percpu_counter_batch*num_online_cpus())) {
if (count > rhs)
return 1;
else
return -1;
}
/* */
count = percpu_counter_sum(fbc);
if (count > rhs)
return 1;
else if (count < rhs)
return -1;
else
return 0;
}
EXPORT_SYMBOL(percpu_counter_compare);
static int __init percpu_counter_startup(void)
{
compute_batch_value();
hotcpu_notifier(percpu_counter_hotcpu_callback, 0);
return 0;
}
module_init(percpu_counter_startup);
|
/* x264_prt_id.h
* Definitions of X.264/ISO 11570 transport protocol IDs
*
* $Id: x264_prt_id.h 18197 2006-05-21 05:12:17Z sahlberg $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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 __X264_PRT_ID_H__
#define __X264_PRT_ID_H__
/* X.264 / ISO 11570 transport protocol ID values. */
#define PRT_ID_ISO_8073 0x01 /* X.224/ISO 8073 COTP */
#define PRT_ID_ISO_8602 0x02 /* X.234/ISO 8602 CLTP */
#define PRT_ID_ISO_10736_ISO_8073 0x03 /* X.274/ISO 10736 + X.224/ISO 8073 */
#define PRT_ID_ISO_10736_ISO_8602 0x04 /* X.274/ISO 10736 + X.234/ISO 8602 */
#endif
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MB8795_H
#define MB8795_H
#define MCFG_MB8795_ADD(_tag, _tx_irq, _rx_irq, _tx_drq, _rx_drq) \
MCFG_DEVICE_ADD(_tag, MB8795, 0) \
downcast<mb8795_device *>(device)->set_irq_cb(_tx_irq, _rx_irq); \
downcast<mb8795_device *>(device)->set_drq_cb(_tx_drq, _rx_drq);
#define MCFG_MB8795_TX_IRQ_CALLBACK(_write) \
devcb = &mb8795_device::set_tx_irq_wr_callback(*device, DEVCB_##_write);
#define MCFG_MB8795_RX_IRQ_CALLBACK(_write) \
devcb = &mb8795_device::set_rx_irq_wr_callback(*device, DEVCB_##_write);
#define MCFG_MB8795_TX_DRQ_CALLBACK(_write) \
devcb = &mb8795_device::set_tx_drq_wr_callback(*device, DEVCB_##_write);
#define MCFG_MB8795_RX_DRQ_CALLBACK(_write) \
devcb = &mb8795_device::set_rx_drq_wr_callback(*device, DEVCB_##_write);
class mb8795_device : public device_t,
public device_network_interface
{
public:
mb8795_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
template<class _Object> static devcb_base &set_tx_irq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).irq_tx_cb.set_callback(object); }
template<class _Object> static devcb_base &set_rx_irq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).irq_rx_cb.set_callback(object); }
template<class _Object> static devcb_base &set_tx_drq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).drq_tx_cb.set_callback(object); }
template<class _Object> static devcb_base &set_rx_drq_wr_callback(device_t &device, _Object object) { return downcast<mb8795_device &>(device).drq_rx_cb.set_callback(object); }
DECLARE_ADDRESS_MAP(map, 8);
DECLARE_READ8_MEMBER(txstat_r);
DECLARE_WRITE8_MEMBER(txstat_w);
DECLARE_READ8_MEMBER(txmask_r);
DECLARE_WRITE8_MEMBER(txmask_w);
DECLARE_READ8_MEMBER(rxstat_r);
DECLARE_WRITE8_MEMBER(rxstat_w);
DECLARE_READ8_MEMBER(rxmask_r);
DECLARE_WRITE8_MEMBER(rxmask_w);
DECLARE_READ8_MEMBER(txmode_r);
DECLARE_WRITE8_MEMBER(txmode_w);
DECLARE_READ8_MEMBER(rxmode_r);
DECLARE_WRITE8_MEMBER(rxmode_w);
DECLARE_WRITE8_MEMBER(reset_w);
DECLARE_READ8_MEMBER(tdc_lsb_r);
DECLARE_READ8_MEMBER(mac_r);
DECLARE_WRITE8_MEMBER(mac_w);
void tx_dma_w(UINT8 data, bool eof);
void rx_dma_r(UINT8 &data, bool &eof);
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void recv_cb(UINT8 *buf, int len) override;
private:
enum { TIMER_TX, TIMER_RX };
// Lifted from netbsd
enum {
EN_TXS_READY = 0x80, /* ready for packet */
EN_TXS_BUSY = 0x40, /* receive carrier detect */
EN_TXS_TXRECV = 0x20, /* transmission received */
EN_TXS_SHORTED = 0x10, /* possible coax short */
EN_TXS_UNDERFLOW = 0x08, /* underflow on xmit */
EN_TXS_COLLERR = 0x04, /* collision detected */
EN_TXS_COLLERR16 = 0x02, /* 16th collision error */
EN_TXS_PARERR = 0x01, /* parity error in tx data */
EN_RXS_OK = 0x80, /* packet received ok */
EN_RXS_RESET = 0x10, /* reset packet received */
EN_RXS_SHORT = 0x08, /* < minimum length */
EN_RXS_ALIGNERR = 0x04, /* alignment error */
EN_RXS_CRCERR = 0x02, /* CRC error */
EN_RXS_OVERFLOW = 0x01, /* receiver FIFO overflow */
EN_TMD_COLLMASK = 0xf0, /* collision count */
EN_TMD_COLLSHIFT = 4,
EN_TMD_PARIGNORE = 0x08, /* ignore parity */
EN_TMD_TURBO1 = 0x04,
EN_TMD_LB_DISABLE = 0x02, /* loop back disabled */
EN_TMD_DISCONTENT = 0x01, /* disable contention (rx carrier) */
EN_RMD_TEST = 0x80, /* must be zero */
EN_RMD_ADDRSIZE = 0x10, /* reduces NODE match to 5 chars */
EN_RMD_SHORTENABLE = 0x08, /* "rx packets >= 10 bytes" - <? */
EN_RMD_RESETENABLE = 0x04, /* detect "reset" ethernet frames */
EN_RMD_WHATRECV = 0x03, /* controls what packets are received */
EN_RMD_RECV_PROMISC = 0x03, /* all packets */
EN_RMD_RECV_MULTI = 0x02, /* accept broad/multicasts */
EN_RMD_RECV_NORMAL = 0x01, /* accept broad/limited multicasts */
EN_RMD_RECV_NONE = 0x00, /* accept no packets */
EN_RST_RESET = 0x80 /* reset interface */
};
UINT8 mac[6];
UINT8 txbuf[2000], rxbuf[2000];
UINT8 txstat, txmask, rxstat, rxmask, txmode, rxmode;
UINT16 txlen, rxlen, txcount;
bool drq_tx, drq_rx, irq_tx, irq_rx;
emu_timer *timer_tx, *timer_rx;
devcb_write_line irq_tx_cb, irq_rx_cb, drq_tx_cb, drq_rx_cb;
void check_irq();
void start_send();
void receive();
bool recv_is_broadcast();
bool recv_is_me();
bool recv_is_multicast();
bool recv_is_local_multicast();
};
extern const device_type MB8795;
#endif
|
/*
* Copyright 2008 Cisco Systems, Inc. All rights reserved.
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
*
* This program is free software; you may 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef _VNIC_CQ_COPY_H_
#define _VNIC_CQ_COPY_H_
#include "fcpio.h"
static inline unsigned int vnic_cq_copy_service(
struct vnic_cq *cq,
int (*q_service)(struct vnic_dev *vdev,
unsigned int index,
struct fcpio_fw_req *desc),
unsigned int work_to_do)
{
struct fcpio_fw_req *desc;
unsigned int work_done = 0;
u8 color;
desc = (struct fcpio_fw_req *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
fcpio_color_dec(desc, &color);
while (color != cq->last_color) {
if ((*q_service)(cq->vdev, cq->index, desc))
break;
cq->to_clean++;
if (cq->to_clean == cq->ring.desc_count) {
cq->to_clean = 0;
cq->last_color = cq->last_color ? 0 : 1;
}
desc = (struct fcpio_fw_req *)((u8 *)cq->ring.descs +
cq->ring.desc_size * cq->to_clean);
fcpio_color_dec(desc, &color);
work_done++;
if (work_done >= work_to_do)
break;
}
return work_done;
}
#endif /* */
|
/* @(#)s_fabs.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/*
* ieee_fabs(x) returns the absolute value of x.
*/
#include "fdlibm.h"
#ifdef __STDC__
double ieee_fabs(double x)
#else
double ieee_fabs(x)
double x;
#endif
{
__HI(x) &= 0x7fffffff;
return x;
}
|
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2011 Dennis Nienhüser <earthwings@gentoo.org>
//
#ifndef MARBLE_DECLARATIVE_TRACKING_H
#define MARBLE_DECLARATIVE_TRACKING_H
#include "PositionSource.h"
#include <QObject>
#if QT_VERSION < 0x050000
#include <QtDeclarative/qdeclarative.h>
#else
#include <QtQml/qqml.h>
#endif
class MarbleWidget;
namespace Marble {
class AutoNavigation;
}
class Tracking : public QObject
{
Q_OBJECT
Q_ENUMS( PositionMarkerType )
Q_PROPERTY( MarbleWidget* map READ map WRITE setMap NOTIFY mapChanged )
Q_PROPERTY( bool showTrack READ showTrack WRITE setShowTrack NOTIFY showTrackChanged )
Q_PROPERTY( bool autoCenter READ autoCenter WRITE setAutoCenter NOTIFY autoCenterChanged )
Q_PROPERTY( bool autoZoom READ autoZoom WRITE setAutoZoom NOTIFY autoZoomChanged )
Q_PROPERTY( PositionSource* positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged )
Q_PROPERTY( QObject* positionMarker READ positionMarker WRITE setPositionMarker NOTIFY positionMarkerChanged )
Q_PROPERTY( bool hasLastKnownPosition READ hasLastKnownPosition NOTIFY hasLastKnownPositionChanged )
Q_PROPERTY( Coordinate* lastKnownPosition READ lastKnownPosition WRITE setLastKnownPosition NOTIFY lastKnownPositionChanged )
Q_PROPERTY( PositionMarkerType positionMarkerType READ positionMarkerType WRITE setPositionMarkerType NOTIFY positionMarkerTypeChanged )
Q_PROPERTY( double distance READ distance NOTIFY distanceChanged )
public:
enum PositionMarkerType {
None,
Circle,
Arrow
};
explicit Tracking( QObject* parent = 0 );
bool showTrack() const;
void setShowTrack( bool show );
PositionSource* positionSource();
void setPositionSource( PositionSource* source );
QObject* positionMarker();
void setPositionMarker( QObject* marker );
MarbleWidget* map();
void setMap( MarbleWidget* widget );
bool hasLastKnownPosition() const;
Coordinate *lastKnownPosition();
void setLastKnownPosition( Coordinate* lastKnownPosition );
bool autoCenter() const;
void setAutoCenter( bool enabled );
bool autoZoom() const;
void setAutoZoom( bool enabled );
PositionMarkerType positionMarkerType() const;
void setPositionMarkerType( PositionMarkerType type );
double distance() const;
public Q_SLOTS:
void saveTrack( const QString &fileName );
void openTrack( const QString &fileName );
void clearTrack();
Q_SIGNALS:
void mapChanged();
void showTrackChanged();
void positionSourceChanged();
void positionMarkerChanged();
void hasLastKnownPositionChanged();
void lastKnownPositionChanged();
void autoCenterChanged();
void autoZoomChanged();
void positionMarkerTypeChanged();
void distanceChanged();
private Q_SLOTS:
void updatePositionMarker();
void updateLastKnownPosition();
void setHasLastKnownPosition();
private:
void setShowPositionMarkerPlugin( bool visible );
bool m_showTrack;
PositionSource* m_positionSource;
QObject* m_positionMarker;
MarbleWidget* m_marbleWidget;
bool m_hasLastKnownPosition;
Coordinate m_lastKnownPosition;
Marble::AutoNavigation* m_autoNavigation;
PositionMarkerType m_positionMarkerType;
};
#endif
|
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link off all namespaces;
#pragma link C++ nestedclass;
#pragma link C++ namespace TMVA;
// other classes
#pragma link C++ class TMVA::TNeuron+;
#pragma link C++ class TMVA::TSynapse+;
#pragma link C++ class TMVA::TActivationChooser+;
#pragma link C++ class TMVA::TActivation+;
#pragma link C++ class TMVA::TActivationSigmoid+;
#pragma link C++ class TMVA::TActivationIdentity+;
#pragma link C++ class TMVA::TActivationTanh+;
#pragma link C++ class TMVA::TActivationRadial+;
#pragma link C++ class TMVA::TNeuronInputChooser+;
#pragma link C++ class TMVA::TNeuronInput+;
#pragma link C++ class TMVA::TNeuronInputSum+;
#pragma link C++ class TMVA::TNeuronInputSqSum+;
#pragma link C++ class TMVA::TNeuronInputAbs+;
#pragma link C++ class TMVA::Types+;
#pragma link C++ class TMVA::Ranking+;
#pragma link C++ class TMVA::RuleFit+;
#pragma link C++ class TMVA::RuleFitAPI+;
#pragma link C++ class TMVA::IMethod+;
#pragma link C++ class TMVA::MsgLogger+;
#pragma link C++ class TMVA::VariableTransformBase+;
#pragma link C++ class TMVA::VariableIdentityTransform+;
#pragma link C++ class TMVA::VariableDecorrTransform+;
#pragma link C++ class TMVA::VariablePCATransform+;
#pragma link C++ class TMVA::VariableGaussTransform+;
#pragma link C++ class TMVA::VariableNormalizeTransform+;
#pragma link C++ class TMVA::VariableRearrangeTransform+;
#pragma link C++ class TMVA::ROCCalc+;
#endif
|
#pragma once
#include "../TKTopAlgo/Precompiled.h"
#include "ShapeAlgo.hxx"
#include "ShapeAnalysis.hxx"
#include "ShapeAnalysis_Geom.hxx"
#include "ShapeAnalysis_Shell.hxx"
#include "ShapeAnalysis_Surface.hxx"
#include "ShapeAnalysis_Wire.hxx"
#include "ShapeAnalysis_Curve.hxx"
#include "ShapeBuild.hxx"
#include "ShapeConstruct.hxx"
#include "ShapeCustom.hxx"
#include "ShapeExtend.hxx"
#include "ShapeFix.hxx"
#include "ShapeFix_Edge.hxx"
#include "ShapeFix_Wire.hxx"
#include "ShapeFix_Root.hxx"
#include "ShapeFix_Shell.hxx"
#include "ShapeFix_Solid.hxx"
#include "ShapeFix_Face.hxx"
#include "ShapeProcess.hxx"
#include "ShapeUpgrade.hxx"
#include "ShapeUpgrade_Tool.hxx"
|
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_TIME_H
/** Defined when <sofia-sip/su_time.h> has been included. */
#define SU_TIME_H
/**@ingroup su_time
* @file sofia-sip/su_time.h
* @brief Time types and functions.
*
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @date Created: Thu Mar 18 19:40:51 1999 pessi
*
*/
#ifndef SU_TYPES_H
#include "sofia-sip/su_types.h"
#endif
SOFIA_BEGIN_DECLS
/** Time in seconds and microsecondcs.
*
* The structure su_time_t contains time in seconds and microseconds since
* epoch (January 1, 1900).
*/
struct su_time_s {
unsigned long tv_sec; /**< Seconds */
unsigned long tv_usec; /**< Microseconds */
};
/** Time in seconds and microsecondcs. */
typedef struct su_time_s su_time_t;
/** Time difference in microseconds.
*
* The type su_duration_t is used to present small time differences (24
* days), usually calculated between two su_time_t timestamps. Note that
* the su_duration_t is signed.
*/
typedef long su_duration_t;
enum {
/** Maximum duration in milliseconds. */
SU_DURATION_MAX = 0x7fffffffL
};
#define SU_DURATION_MAX SU_DURATION_MAX
/** NTP timestamp.
*
* NTP timestamp is defined as microseconds since epoch (1-Jan-1900)
* with 64-bit resolution.
*/
typedef uint64_t su_ntp_t;
/** Represent NTP constant */
#define SU_NTP_C(x) SU_U64_C(x)
#define SU_TIME_CMP(t1, t2) su_time_cmp(t1, t2)
/** Seconds from 1.1.1900 to 1.1.1970. @NEW_1_12_4. */
#define SU_TIME_EPOCH 2208988800UL
typedef uint64_t su_nanotime_t;
#define SU_E9 (1000000000U)
SOFIAPUBFUN su_nanotime_t su_nanotime(su_nanotime_t *return_time);
SOFIAPUBFUN su_nanotime_t su_monotime(su_nanotime_t *return_time);
SOFIAPUBFUN su_time_t su_now(void);
SOFIAPUBFUN void su_time(su_time_t *tv);
SOFIAPUBFUN long su_time_cmp(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN double su_time_diff(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN su_duration_t su_duration(su_time_t const t1, su_time_t const t2);
SOFIAPUBFUN su_time_t su_time_add(su_time_t t, su_duration_t dur);
SOFIAPUBFUN su_time_t su_time_dadd(su_time_t t, double dur);
SOFIAPUBFUN int su_time_print(char *s, int n, su_time_t const *tv);
#define SU_SEC_TO_DURATION(sec) ((su_duration_t)(1000 * (sec)))
SOFIAPUBFUN su_ntp_t su_ntp_now(void);
SOFIAPUBFUN uint32_t su_ntp_sec(void);
SOFIAPUBFUN uint32_t su_ntp_hi(su_ntp_t);
SOFIAPUBFUN uint32_t su_ntp_lo(su_ntp_t);
SOFIAPUBFUN uint32_t su_ntp_mw(su_ntp_t ntp);
#if !SU_HAVE_INLINE
SOFIAPUBFUN uint32_t su_ntp_fraq(su_time_t t);
SOFIAPUBFUN uint32_t su_time_ms(su_time_t t);
#else
su_inline uint32_t su_ntp_fraq(su_time_t t);
su_inline uint32_t su_time_ms(su_time_t t);
#endif
SOFIAPUBFUN su_ntp_t su_ntp_hilo(uint32_t hi, uint32_t lo);
SOFIAPUBFUN uint64_t su_counter(void);
SOFIAPUBFUN uint64_t su_nanocounter(void);
SOFIAPUBFUN uint32_t su_random(void);
#if SU_HAVE_INLINE
/** Middle 32 bit of NTP timestamp. */
su_inline uint32_t su_ntp_fraq(su_time_t t)
{
/*
* Multiply usec by 0.065536 (ie. 2**16 / 1E6)
*
* Utilize fact that 0.065536 == 1024 / 15625
*/
return (t.tv_sec << 16) + (1024 * t.tv_usec + 7812) / 15625;
}
/** Time as milliseconds. */
su_inline uint32_t su_time_ms(su_time_t t)
{
return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000;
}
#endif
SOFIA_END_DECLS
#endif /* !defined(SU_TIME_H) */
|
//===-- Implementation header for remainderl --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MATH_REMAINDERL_H
#define LLVM_LIBC_SRC_MATH_REMAINDERL_H
namespace __llvm_libc {
long double remainderl(long double x, long double y);
} // namespace __llvm_libc
#endif // LLVM_LIBC_SRC_MATH_REMAINDERL_H
|
/************************************************************************************
* configs/stm_tiny/src/up_watchdog.c
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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 NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/watchdog.h>
#include <arch/board/board.h>
#include "stm32_wdg.h"
#ifdef CONFIG_WATCHDOG
/************************************************************************************
* Definitions
************************************************************************************/
/* Configuration *******************************************************************/
/* Wathdog hardware should be enabled */
#if !defined(CONFIG_STM32_WWDG) && !defined(CONFIG_STM32_IWDG)
# warning "One of CONFIG_STM32_WWDG or CONFIG_STM32_IWDG must be defined"
#endif
/* Select the path to the registered watchdog timer device */
#ifndef CONFIG_STM32_WDG_DEVPATH
# ifdef CONFIG_EXAMPLES_WATCHDOG_DEVPATH
# define CONFIG_STM32_WDG_DEVPATH CONFIG_EXAMPLES_WATCHDOG_DEVPATH
# else
# define CONFIG_STM32_WDG_DEVPATH "/dev/watchdog0"
# endif
#endif
/* Use the un-calibrated LSI frequency if we have nothing better */
#if defined(CONFIG_STM32_IWDG) && !defined(CONFIG_STM32_LSIFREQ)
# define CONFIG_STM32_LSIFREQ STM32_LSI_FREQUENCY
#endif
/* Debug ***************************************************************************/
/* Non-standard debug that may be enabled just for testing the watchdog timer */
#ifndef CONFIG_DEBUG
# undef CONFIG_DEBUG_WATCHDOG
#endif
#ifdef CONFIG_DEBUG_WATCHDOG
# define wdgdbg dbg
# define wdglldbg lldbg
# ifdef CONFIG_DEBUG_VERBOSE
# define wdgvdbg vdbg
# define wdgllvdbg llvdbg
# else
# define wdgvdbg(x...)
# define wdgllvdbg(x...)
# endif
#else
# define wdgdbg(x...)
# define wdglldbg(x...)
# define wdgvdbg(x...)
# define wdgllvdbg(x...)
#endif
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Name: up_wdginitialize()
*
* Description:
* Perform architecuture-specific initialization of the Watchdog hardware.
* This interface must be provided by all configurations using
* apps/examples/watchdog
*
****************************************************************************/
int up_wdginitialize(void)
{
/* Initialize tha register the watchdog timer device */
#if defined(CONFIG_STM32_WWDG)
stm32_wwdginitialize(CONFIG_STM32_WDG_DEVPATH);
return OK;
#elif defined(CONFIG_STM32_IWDG)
stm32_iwdginitialize(CONFIG_STM32_WDG_DEVPATH, CONFIG_STM32_LSIFREQ);
return OK;
#else
return -ENODEV;
#endif
}
#endif /* CONFIG_WATCHDOG */
|
/****************************************************************************
*
* Copyright (c) 2014-2016 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* Total flight time in microseconds
*
* Total flight time of this autopilot. Higher 32 bits of the value.
* Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
*
* @min 0
* @volatile
* @category system
* @group Land Detector
*
*/
PARAM_DEFINE_INT32(LND_FLIGHT_T_HI, 0);
/**
* Total flight time in microseconds
*
* Total flight time of this autopilot. Lower 32 bits of the value.
* Flight time in microseconds = (LND_FLIGHT_T_HI << 32) | LND_FLIGHT_T_LO.
*
* @min 0
* @volatile
* @category system
* @group Land Detector
*
*/
PARAM_DEFINE_INT32(LND_FLIGHT_T_LO, 0);
|
//
// CardIODetectionMode.h
// Version 5.1.1
//
// See the file "LICENSE.md" for the full license governing this code.
//
//
#ifndef icc_CardIODetectionMode_h
#define icc_CardIODetectionMode_h
typedef NS_ENUM(NSInteger, CardIODetectionMode) {
CardIODetectionModeCardImageAndNumber = 0,
CardIODetectionModeCardImageOnly,
CardIODetectionModeAutomatic
};
#endif
|
/* linux/arch/arm/mach-msm/board-supersonic-wifi.c
* Copyright (C) 2009 HTC Corporation.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <asm/mach-types.h>
#include <asm/gpio.h>
#include <asm/io.h>
#include <linux/skbuff.h>
#include <linux/wifi_tiwlan.h>
#include "board-supersonic.h"
int supersonic_wifi_power(int on);
int supersonic_wifi_reset(int on);
int supersonic_wifi_set_carddetect(int on);
#define PREALLOC_WLAN_NUMBER_OF_SECTIONS 4
#define PREALLOC_WLAN_NUMBER_OF_BUFFERS 160
#define PREALLOC_WLAN_SECTION_HEADER 24
#define WLAN_SECTION_SIZE_0 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 128)
#define WLAN_SECTION_SIZE_1 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 128)
#define WLAN_SECTION_SIZE_2 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 512)
#define WLAN_SECTION_SIZE_3 (PREALLOC_WLAN_NUMBER_OF_BUFFERS * 1024)
#define WLAN_SKB_BUF_NUM 16
static struct sk_buff *wlan_static_skb[WLAN_SKB_BUF_NUM];
typedef struct wifi_mem_prealloc_struct {
void *mem_ptr;
unsigned long size;
} wifi_mem_prealloc_t;
static wifi_mem_prealloc_t wifi_mem_array[PREALLOC_WLAN_NUMBER_OF_SECTIONS] = {
{ NULL, (WLAN_SECTION_SIZE_0 + PREALLOC_WLAN_SECTION_HEADER) },
{ NULL, (WLAN_SECTION_SIZE_1 + PREALLOC_WLAN_SECTION_HEADER) },
{ NULL, (WLAN_SECTION_SIZE_2 + PREALLOC_WLAN_SECTION_HEADER) },
{ NULL, (WLAN_SECTION_SIZE_3 + PREALLOC_WLAN_SECTION_HEADER) }
};
static void *supersonic_wifi_mem_prealloc(int section, unsigned long size)
{
if (section == PREALLOC_WLAN_NUMBER_OF_SECTIONS)
return wlan_static_skb;
if ((section < 0) || (section > PREALLOC_WLAN_NUMBER_OF_SECTIONS))
return NULL;
if (wifi_mem_array[section].size < size)
return NULL;
return wifi_mem_array[section].mem_ptr;
}
int __init supersonic_init_wifi_mem(void)
{
int i;
for(i=0;( i < WLAN_SKB_BUF_NUM );i++) {
if (i < (WLAN_SKB_BUF_NUM/2))
wlan_static_skb[i] = dev_alloc_skb(4096);
else
wlan_static_skb[i] = dev_alloc_skb(8192);
}
for(i=0;( i < PREALLOC_WLAN_NUMBER_OF_SECTIONS );i++) {
wifi_mem_array[i].mem_ptr = kmalloc(wifi_mem_array[i].size,
GFP_KERNEL);
if (wifi_mem_array[i].mem_ptr == NULL)
return -ENOMEM;
}
return 0;
}
static struct resource supersonic_wifi_resources[] = {
[0] = {
.name = "bcm4329_wlan_irq",
.start = MSM_GPIO_TO_INT(SUPERSONIC_GPIO_WIFI_IRQ),
.end = MSM_GPIO_TO_INT(SUPERSONIC_GPIO_WIFI_IRQ),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
},
};
static struct wifi_platform_data supersonic_wifi_control = {
.set_power = supersonic_wifi_power,
.set_reset = supersonic_wifi_reset,
.set_carddetect = supersonic_wifi_set_carddetect,
.mem_prealloc = supersonic_wifi_mem_prealloc,
};
static struct platform_device supersonic_wifi_device = {
.name = "bcm4329_wlan",
.id = 1,
.num_resources = ARRAY_SIZE(supersonic_wifi_resources),
.resource = supersonic_wifi_resources,
.dev = {
.platform_data = &supersonic_wifi_control,
},
};
extern unsigned char *get_wifi_nvs_ram(void);
static unsigned supersonic_wifi_update_nvs(char *str)
{
#define NVS_LEN_OFFSET 0x0C
#define NVS_DATA_OFFSET 0x40
unsigned char *ptr;
unsigned len;
if (!str)
return -EINVAL;
ptr = get_wifi_nvs_ram();
/* Size in format LE assumed */
memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
/* the last bye in NVRAM is 0, trim it */
if (ptr[NVS_DATA_OFFSET + len -1] == 0)
len -= 1;
strcpy(ptr + NVS_DATA_OFFSET + len, str);
len += strlen(str);
memcpy(ptr + NVS_LEN_OFFSET, &len, sizeof(len));
return 0;
}
static unsigned strip_nvs_param(char* param)
{
unsigned char *nvs_data;
unsigned param_len;
int start_idx, end_idx;
unsigned char *ptr;
unsigned len;
if (!param)
return -EINVAL;
ptr = get_wifi_nvs_ram();
/* Size in format LE assumed */
memcpy(&len, ptr + NVS_LEN_OFFSET, sizeof(len));
/* the last bye in NVRAM is 0, trim it */
if (ptr[NVS_DATA_OFFSET + len -1] == 0)
len -= 1;
nvs_data = ptr + NVS_DATA_OFFSET;
param_len = strlen(param);
/* search param */
for (start_idx = 0; start_idx < len - param_len; start_idx++) {
if (memcmp(&nvs_data[start_idx], param, param_len) == 0) {
break;
}
}
end_idx = 0;
if (start_idx < len - param_len) {
/* search end-of-line */
for (end_idx = start_idx + param_len; end_idx < len; end_idx++) {
if (nvs_data[end_idx] == '\n' || nvs_data[end_idx] == 0) {
break;
}
}
}
if (start_idx < end_idx) {
/* move the remain data forward */
for (; end_idx + 1 < len; start_idx++, end_idx++) {
nvs_data[start_idx] = nvs_data[end_idx+1];
}
len = len - (end_idx - start_idx + 1);
memcpy(ptr + NVS_LEN_OFFSET, &len, sizeof(len));
}
return 0;
}
static int __init supersonic_wifi_init(void)
{
int ret;
if (!machine_is_supersonic())
return 0;
printk("%s: start\n", __func__);
supersonic_wifi_update_nvs("sd_oobonly=1\n");
supersonic_wifi_update_nvs("btc_params80=0\n");
strip_nvs_param("pa0maxpwr");
supersonic_wifi_update_nvs("pa0maxpwr=78\n");
strip_nvs_param("mcs2gpo0");
supersonic_wifi_update_nvs("mcs2gpo0=0xCCCC\n");
strip_nvs_param("mcs2gpo1");
supersonic_wifi_update_nvs("mcs2gpo1=0xCCCC\n");
strip_nvs_param("rxpo2g");
supersonic_wifi_update_nvs("rxpo2g=0\n");
supersonic_init_wifi_mem();
ret = platform_device_register(&supersonic_wifi_device);
return ret;
}
device_initcall(supersonic_wifi_init);
|
/*
* linux/drivers/mtd/nand/ox810_nand.c
*
* Copyright (C) 2008 Oxford Semiconductor
*
* 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.
*
* Overview:
* This is a device driver for the NAND flash device found on the
* OX810 demo board.
*/
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <asm/io.h>
#include <asm/arch-oxnas/hardware.h>
#define OX810_NAND_NAME "OX810_NAND";
#define OX810_NAND_BASE STATIC_CS1_BASE // base address of NAND chip on static bus
#define OX810_NAND_DATA OX810_NAND_BASE + 0x0000
//#define OX810_NAND_ADDRESS_LATCH OX810_NAND_BASE + 0x1000
#define OX810_NAND_ADDRESS_LATCH OX810_NAND_BASE + 0x8000
//#define OX810_NAND_COMMAND_LATCH OX810_NAND_BASE + 0x2000
#define OX810_NAND_COMMAND_LATCH OX810_NAND_BASE + 0x4000
// commands
#define OX810_NAND_COMMAND_READ_CYCLE1 0x00
#define OX810_NAND_COMMAND_WRITE_CYCLE2 0x10
#define OX810_NAND_COMMAND_READ_CYCLE2 0x30
#define OX810_NAND_COMMAND_CACHE_READ 0x31
#define OX810_NAND_COMMAND_BLOCK_ERASE 0x60
#define OX810_NAND_COMMAND_READ_STATUS 0x70
#define OX810_NAND_COMMAND_READ_ID 0x90
#define OX810_NAND_COMMAND_STATUS 0x70
#define OX810_NAND_COMMAND_WRITE_CYCLE1 0x80
#define OX810_NAND_COMMAND_ERASE_CONFIRM 0xd0
#define OX810_NAND_COMMAND_PARAMETER_PAGE 0xec
#define OX810_NAND_COMMAND_RESET 0xff
// status register bits
#define OX810_NAND_STATUS_FAIL (1 << 0)
#define OX810_NAND_STATUS_READY (1 << 6)
#ifdef CONFIG_MTD_PARTITIONS
#define NUM_PARTITIONS 2
static struct mtd_partition partition_info[] =
{
{
.name = "Boot partition",
.offset = 0,
.size = 1024 * 1024 * 64
},
{
.name = "Data Partition",
.offset = MTDPART_OFS_NXTBLK,
.size = MTDPART_SIZ_FULL
}
};
#endif
static struct priv {
struct mtd_info *mtd;
} priv;
static void ox810_nand_write_command(u_int8_t command)
{
writeb(command, OX810_NAND_COMMAND_LATCH);
}
static u_int8_t ox810_nand_read_data(void)
{
return readb(OX810_NAND_DATA);
}
static uint8_t ox810_nand_wait_for_ready(void)
{
int timeout = 100;
uint8_t status;
ox810_nand_write_command(OX810_NAND_COMMAND_STATUS);
status = ox810_nand_read_data();
if (status & OX810_NAND_STATUS_READY)
return status;
udelay(100);
while (timeout--) {
status = ox810_nand_read_data();
if (status & OX810_NAND_STATUS_READY)
return status;
msleep(1);
}
printk(KERN_ERR "OX810 NAND Timeout waiting for ready\n");
return OX810_NAND_STATUS_FAIL;
}
static void ox810_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
{
struct nand_chip *this = (struct nand_chip *)priv.mtd->priv;
unsigned long bits = 0;
char *addr = this->IO_ADDR_W;
if (ctrl & NAND_CLE)
bits |= (OX810_NAND_COMMAND_LATCH - OX810_NAND_BASE);
if (ctrl & NAND_ALE)
bits |= (OX810_NAND_ADDRESS_LATCH - OX810_NAND_BASE);
if (cmd != NAND_CMD_NONE)
writeb(cmd, addr + bits);
}
static int ox810_nand_init(void)
{
int err,i ;
struct nand_chip *this;
priv.mtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL);
if (!priv.mtd)
return -ENOMEM;
this = (struct nand_chip *)((char *)(priv.mtd) + sizeof(struct mtd_info));
priv.mtd->priv = this;
priv.mtd->owner = THIS_MODULE;
this->IO_ADDR_R = (void __iomem *)OX810_NAND_DATA;
this->IO_ADDR_W = (void __iomem *)OX810_NAND_DATA;
this->cmd_ctrl = ox810_nand_hwcontrol;
this->dev_ready = NULL;
this->ecc.mode = NAND_ECC_SOFT;
// enable CS_1
*(volatile u32*)SYS_CTRL_GPIO_PRIMSEL_CTRL_0 |= 0x00100000;
*(volatile u32*)SYS_CTRL_GPIO_SECSEL_CTRL_0 &= ~0x00100000;
*(volatile u32*)SYS_CTRL_GPIO_TERTSEL_CTRL_0 &= ~0x00100000;
// reset
ox810_nand_write_command(OX810_NAND_COMMAND_RESET);
ox810_nand_wait_for_ready();
ox810_nand_write_command(OX810_NAND_COMMAND_PARAMETER_PAGE);
ox810_nand_wait_for_ready();
ox810_nand_write_command(OX810_NAND_COMMAND_READ_CYCLE1);
for (i = 0; i < 137; i++) { // skip to max page read time parameter
ox810_nand_read_data();
}
this->chip_delay = (ox810_nand_read_data() + 256 * ox810_nand_read_data()) / 1000;
#ifdef CONFIG_MTD_DEBUG
printk("Page read time %dms\n", this->chip_delay);
#endif
if (nand_scan(priv.mtd, 1)) {
err = -ENXIO;
goto error;
}
err = add_mtd_device(priv.mtd);
if (err) {
err = -ENFILE;
goto error;
}
#ifdef CONFIG_MTD_PARTITIONS
add_mtd_partitions(priv.mtd, partition_info, NUM_PARTITIONS);
#endif
return 0;
error:
kfree(priv.mtd);
return err;
}
static void ox810_nand_exit(void)
{
if (priv.mtd) {
del_mtd_device(priv.mtd);
nand_release(priv.mtd);
kfree(priv.mtd);
}
}
module_init(ox810_nand_init);
module_exit(ox810_nand_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Oxford Semiconductor");
MODULE_DESCRIPTION("NAND flash driver 810 demo board");
|
/*
** Zabbix
** Copyright (C) 2000-2011 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
#include "common.h"
#include "sysinfo.h"
int SYSTEM_UPTIME(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
#ifdef HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME
int mib[2], now;
size_t len;
struct timeval uptime;
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
len = sizeof(struct timeval);
if (0 != sysctl(mib, 2, &uptime, &len, NULL, 0))
return SYSINFO_RET_FAIL;
now = time(NULL);
SET_UI64_RESULT(result, now - uptime.tv_sec);
return SYSINFO_RET_OK;
#else
return SYSINFO_RET_FAIL;
#endif /* HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME */
}
|
// Read an INI file into easy-to-access name/value pairs.
// inih and INIReader are released under the New BSD license (see LICENSE.txt).
// Go to the project home page for more info:
//
// https://github.com/benhoyt/inih
#ifndef __INIREADER_H__
#define __INIREADER_H__
#include <map>
#include <string>
// Read an INI file into easy-to-access name/value pairs. (Note that I've gone
// for simplicity here rather than speed, but it should be pretty decent.)
class INIReader
{
public:
// Construct INIReader and parse given filename. See ini.h for more info
// about the parsing.
INIReader(const std::string& filename);
// Return the result of ini_parse(), i.e., 0 on success, line number of
// first error on parse error, or -1 on file open error.
int ParseError() const;
// Get a string value from INI file, returning default_value if not found.
std::string Get(const std::string& section, const std::string& name,
const std::string& default_value) const;
// Get an integer (long) value from INI file, returning default_value if
// not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2").
long GetInteger(const std::string& section, const std::string& name, long default_value) const;
// Get a real (floating point double) value from INI file, returning
// default_value if not found or not a valid floating point value
// according to strtod().
double GetReal(const std::string& section, const std::string& name, double default_value) const;
// Get a boolean value from INI file, returning default_value if not found or if
// not a valid true/false value. Valid true values are "true", "yes", "on", "1",
// and valid false values are "false", "no", "off", "0" (not case sensitive).
bool GetBoolean(const std::string& section, const std::string& name, bool default_value) const;
private:
int _error;
std::map<std::string, std::string> _values;
static std::string MakeKey(const std::string& section, const std::string& name);
static int ValueHandler(void* user, const char* section, const char* name,
const char* value);
};
#endif // __INIREADER_H__
|
/* GCC option-handling definitions for the Synopsys DesignWare ARC architecture.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
enum processor_type
{
PROCESSOR_NONE,
PROCESSOR_ARC600,
PROCESSOR_ARC601,
PROCESSOR_ARC700
};
|
/* { dg-do compile } */
/* { dg-options "-mdejagnu-cpu=power10" } */
#include <altivec.h>
extern void abort (void);
/* Vector string isolate right-justified on array of unsigned short. */
vector unsigned short
sirj (vector unsigned short arg)
{
return vec_strir (arg);
}
/* Enforce that a single dot-form instruction which is properly biased
for the target's endianness implements this built-in. */
/* { dg-final { scan-assembler-times {\mvstrihr\M} 1 { target { be } } } } */
/* { dg-final { scan-assembler-times {\mvstrihl} 0 { target { be } } } } */
/* { dg-final { scan-assembler-times {\mvstrihl\M} 1 { target { le } } } } */
/* { dg-final { scan-assembler-times {\mvstrihr} 0 { target { le } } } } */
|
#include <gsl/gsl_rng.h>
#include <gsl/gsl_sort_double.h>
int
main ()
{
gsl_rng * r;
int i, k = 5, N = 100000;
double * x = malloc (N * sizeof(double));
double * small = malloc (k * sizeof(double));
gsl_rng_env_setup();
r = gsl_rng_alloc (gsl_rng_default);
for (i = 0; i < N; i++)
{
x[i] = gsl_rng_uniform(r);
}
gsl_sort_smallest (small, k, x, 1, N);
printf("%d smallest values from %d\n", k, N);
for (i = 0; i < k; i++)
{
printf ("%d: %.18f\n", i, small[i]);
}
}
|
/***********************************************************************
filename: CEGUIMenuBaseProperties.h
created: 5/4/2005
author: Tomas Lindquist Olsen (based on code by Paul D Turner)
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* 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 BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIMenuBaseProperties_h_
#define _CEGUIMenuBaseProperties_h_
#include "../CEGUIProperty.h"
// Start of CEGUI namespace section
namespace CEGUI
{
// Start of ItemListBaseProperties namespace section
namespace MenuBaseProperties
{
/*!
\brief
Property to access the item spacing of the menu.
\par Usage:
- Name: ItemSpacing
- Format: "[float]".
\par Where:
- [float] represents the item spacing of the menu.
*/
class ItemSpacing : public Property
{
public:
ItemSpacing() : Property(
"ItemSpacing",
"Property to get/set the item spacing of the menu. Value is a float.",
"10.000000")
{}
String get(const PropertyReceiver* receiver) const;
void set(PropertyReceiver* receiver, const String& value);
};
/*!
\brief
Property to access the state of the allow multiple popups setting.
\par Usage:
- Name: AllowMultiplePopups
- Format: "[text]".
\par Where [Text] is:
- "True" to indicate that auto resizing is enabled.
- "False" to indicate that auto resizing is disabled.
*/
class AllowMultiplePopups : public Property
{
public:
AllowMultiplePopups() : Property(
"AllowMultiplePopups",
"Property to get/set the state of the allow multiple popups setting for the menu. Value is either \"True\" or \"False\".",
"False")
{}
String get(const PropertyReceiver* receiver) const;
void set(PropertyReceiver* receiver, const String& value);
};
} // End of MenuBaseProperties namespace section
} // End of CEGUI namespace section
#endif // end of guard _CEGUIMenuBaseProperties_h_
|
/*
* Copyright (C) 2005-2006 Martin Willi
* Copyright (C) 2005 Jan Hutter
* Hochschule fuer Technik Rapperswil
*
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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.
*/
/**
* @defgroup auth_payload auth_payload
* @{ @ingroup payloads
*/
#ifndef AUTH_PAYLOAD_H_
#define AUTH_PAYLOAD_H_
typedef struct auth_payload_t auth_payload_t;
#include <library.h>
#include <encoding/payloads/payload.h>
#include <sa/authenticator.h>
/**
* Class representing an IKEv2 AUTH payload.
*
* The AUTH payload format is described in RFC section 3.8.
*/
struct auth_payload_t {
/**
* The payload_t interface.
*/
payload_t payload_interface;
/**
* Set the AUTH method.
*
* @param method auth_method_t to use
*/
void (*set_auth_method) (auth_payload_t *this, auth_method_t method);
/**
* Get the AUTH method.
*
* @return auth_method_t used
*/
auth_method_t (*get_auth_method) (auth_payload_t *this);
/**
* Set the AUTH data.
*
* @param data AUTH data as chunk_t, gets cloned
*/
void (*set_data) (auth_payload_t *this, chunk_t data);
/**
* Get the AUTH data.
*
* @return AUTH data as chunk_t, internal data
*/
chunk_t (*get_data) (auth_payload_t *this);
/**
* Get the value of a reserved bit.
*
* @param nr number of the reserved bit, 0-6
* @return TRUE if bit was set, FALSE to clear
*/
bool (*get_reserved_bit)(auth_payload_t *this, u_int nr);
/**
* Set one of the reserved bits.
*
* @param nr number of the reserved bit, 0-6
*/
void (*set_reserved_bit)(auth_payload_t *this, u_int nr);
/**
* Destroys an auth_payload_t object.
*/
void (*destroy) (auth_payload_t *this);
};
/**
* Creates an empty auth_payload_t object.
*
* @return auth_payload_t object
*/
auth_payload_t *auth_payload_create(void);
#endif /** AUTH_PAYLOAD_H_ @}*/
|
/*
* Copyright 2015 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
#ifndef NETTY_UNIX_ERRORS_H_
#define NETTY_UNIX_ERRORS_H_
#include <jni.h>
void netty_unix_errors_throwRuntimeException(JNIEnv* env, char* message);
void netty_unix_errors_throwRuntimeExceptionErrorNo(JNIEnv* env, char* message, int errorNumber);
void netty_unix_errors_throwChannelExceptionErrorNo(JNIEnv* env, char* message, int errorNumber);
void netty_unix_errors_throwIOException(JNIEnv* env, char* message);
void netty_unix_errors_throwIOExceptionErrorNo(JNIEnv* env, char* message, int errorNumber);
void netty_unix_errors_throwClosedChannelException(JNIEnv* env);
void netty_unix_errors_throwOutOfMemoryError(JNIEnv* env);
// JNI initialization hooks. Users of this file are responsible for calling these in the JNI_OnLoad and JNI_OnUnload methods.
jint netty_unix_errors_JNI_OnLoad(JNIEnv* env);
void netty_unix_errors_JNI_OnUnLoad(JNIEnv* env);
#endif /* NETTY_UNIX_ERRORS_H_ */
|
/*****************************************************************************
Copyright (c) 2014, Intel Corp.
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 Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function sbdsqr
* Author: Intel Corporation
* Generated November 2015
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_sbdsqr_work( int matrix_layout, char uplo, lapack_int n,
lapack_int ncvt, lapack_int nru, lapack_int ncc,
float* d, float* e, float* vt, lapack_int ldvt,
float* u, lapack_int ldu, float* c,
lapack_int ldc, float* work )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_sbdsqr( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu,
c, &ldc, work, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int ldc_t = MAX(1,n);
lapack_int ldu_t = MAX(1,nru);
lapack_int ldvt_t = MAX(1,n);
float* vt_t = NULL;
float* u_t = NULL;
float* c_t = NULL;
/* Check leading dimension(s) */
if( ldc < ncc ) {
info = -14;
LAPACKE_xerbla( "LAPACKE_sbdsqr_work", info );
return info;
}
if( ldu < n ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_sbdsqr_work", info );
return info;
}
if( ldvt < ncvt ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_sbdsqr_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
if( ncvt != 0 ) {
vt_t = (float*)
LAPACKE_malloc( sizeof(float) * ldvt_t * MAX(1,ncvt) );
if( vt_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
}
if( nru != 0 ) {
u_t = (float*)LAPACKE_malloc( sizeof(float) * ldu_t * MAX(1,n) );
if( u_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
if( ncc != 0 ) {
c_t = (float*)LAPACKE_malloc( sizeof(float) * ldc_t * MAX(1,ncc) );
if( c_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
}
/* Transpose input matrices */
if( ncvt != 0 ) {
LAPACKE_sge_trans( matrix_layout, n, ncvt, vt, ldvt, vt_t, ldvt_t );
}
if( nru != 0 ) {
LAPACKE_sge_trans( matrix_layout, nru, n, u, ldu, u_t, ldu_t );
}
if( ncc != 0 ) {
LAPACKE_sge_trans( matrix_layout, n, ncc, c, ldc, c_t, ldc_t );
}
/* Call LAPACK function and adjust info */
LAPACK_sbdsqr( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt_t, &ldvt_t, u_t,
&ldu_t, c_t, &ldc_t, work, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
if( ncvt != 0 ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncvt, vt_t, ldvt_t, vt,
ldvt );
}
if( nru != 0 ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, nru, n, u_t, ldu_t, u, ldu );
}
if( ncc != 0 ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncc, c_t, ldc_t, c, ldc );
}
/* Release memory and exit */
if( ncc != 0 ) {
LAPACKE_free( c_t );
}
exit_level_2:
if( nru != 0 ) {
LAPACKE_free( u_t );
}
exit_level_1:
if( ncvt != 0 ) {
LAPACKE_free( vt_t );
}
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_sbdsqr_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_sbdsqr_work", info );
}
return info;
}
|
// Copyright 2015 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 REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
#define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
#include <stdint.h>
#include <map>
#include "base/callback.h"
#include "base/macros.h"
#include "base/timer/timer.h"
#include "remoting/base/rate_counter.h"
#include "remoting/base/running_average.h"
namespace remoting {
class VideoPacket;
namespace protocol {
// PerformanceTracker defines a bundle of performance counters and statistics
// for chromoting.
class PerformanceTracker {
public:
// Callback that updates UMA custom counts or custom times histograms.
typedef base::Callback<void(const std::string& histogram_name,
int64_t value,
int histogram_min,
int histogram_max,
int histogram_buckets)>
UpdateUmaCustomHistogramCallback;
// Callback that updates UMA enumeration histograms.
typedef base::Callback<
void(const std::string& histogram_name, int64_t value, int histogram_max)>
UpdateUmaEnumHistogramCallback;
PerformanceTracker();
virtual ~PerformanceTracker();
// Constant used to calculate the average for rate metrics and used by the
// plugin for the frequency at which stats should be updated.
static const int kStatsUpdatePeriodSeconds = 1;
// Return rates and running-averages for different metrics.
double video_bandwidth() { return video_bandwidth_.Rate(); }
double video_frame_rate() { return video_frame_rate_.Rate(); }
double video_packet_rate() { return video_packet_rate_.Rate(); }
double video_capture_ms() { return video_capture_ms_.Average(); }
double video_encode_ms() { return video_encode_ms_.Average(); }
double video_decode_ms() { return video_decode_ms_.Average(); }
double video_paint_ms() { return video_paint_ms_.Average(); }
double round_trip_ms() { return round_trip_ms_.Average(); }
// Record stats for a video-packet.
void RecordVideoPacketStats(const VideoPacket& packet);
// Helpers to track decode and paint time. If the render drops some frames
// before they are painted then OnFramePainted() records paint time when the
// following frame is rendered. OnFramePainted() may be called multiple times,
// in which case all calls after the first one are ignored.
void OnFrameDecoded(int32_t frame_id);
void OnFramePainted(int32_t frame_id);
// Sets callbacks in ChromotingInstance to update a UMA custom counts, custom
// times or enum histogram.
void SetUpdateUmaCallbacks(
UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback,
UpdateUmaCustomHistogramCallback update_uma_custom_times_callback,
UpdateUmaEnumHistogramCallback update_uma_enum_histogram_callback);
void OnPauseStateChanged(bool paused);
private:
struct FrameTimestamps {
FrameTimestamps();
~FrameTimestamps();
// Set to null for frames that were not sent after a fresh input event.
base::TimeTicks latest_event_timestamp;
// Set to TimeDelta::Max() when unknown.
base::TimeDelta total_host_latency;
base::TimeTicks time_received;
base::TimeTicks time_decoded;
};
typedef std::map<int32_t, FrameTimestamps> FramesTimestampsMap;
// Helper to record input roundtrip latency after a frame has been painted.
void RecordRoundTripLatency(const FrameTimestamps& timestamps);
// Updates frame-rate, packet-rate and bandwidth UMA statistics.
void UploadRateStatsToUma();
// The video and packet rate metrics below are updated per video packet
// received and then, for reporting, averaged over a 1s time-window.
// Bytes per second for non-empty video-packets.
RateCounter video_bandwidth_;
// Frames per second for non-empty video-packets.
RateCounter video_frame_rate_;
// Video packets per second, including empty video-packets.
// This will be greater than the frame rate, as individual frames are
// contained in packets, some of which might be empty (e.g. when there are no
// screen changes).
RateCounter video_packet_rate_;
// The following running-averages are uploaded to UMA per video packet and
// also used for display to users, averaged over the N most recent samples.
// N = kLatencySampleSize.
RunningAverage video_capture_ms_;
RunningAverage video_encode_ms_;
RunningAverage video_decode_ms_;
RunningAverage video_paint_ms_;
RunningAverage round_trip_ms_;
// Used to update UMA stats, if set.
UpdateUmaCustomHistogramCallback uma_custom_counts_updater_;
UpdateUmaCustomHistogramCallback uma_custom_times_updater_;
UpdateUmaEnumHistogramCallback uma_enum_histogram_updater_;
// The latest event timestamp that a VideoPacket was seen annotated with.
base::TimeTicks latest_event_timestamp_;
// Stores timestamps for the frames that are currently being processed.
FramesTimestampsMap frame_timestamps_;
bool is_paused_ = false;
base::RepeatingTimer upload_uma_stats_timer_;
DISALLOW_COPY_AND_ASSIGN(PerformanceTracker);
};
} // namespace protocol
} // namespace remoting
#endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
|
/*
* This file is a part of the open source stm32plus library.
* Copyright (c) 2011,2012,2013,2014 Andy Brown <www.andybrown.me.uk>
* Please see website for licensing terms.
*/
#pragma once
// ensure the MCU series is correct
#ifndef STM32PLUS_F0
#error This class can only be used with the STM32F0 series
#endif
namespace stm32plus {
/**
* Class to measure the frequency of the LSI using its output into channel 1
* of Timer14. Of course this method fundamentally relies on the accuracy of the
* oscillator that runs the timer (e.g. HSI) being better than that of the LSI itself.
*/
class RtcMeasuredLsiFrequencyProvider {
/**
* Compute the LSI frequency
* @return The measured frequency
*/
public:
static uint32_t getLsiFrequency();
};
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_
#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_
#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/prefs/pref_store.h"
#include "chrome/browser/supervised_user/supervised_users.h"
namespace base {
class DictionaryValue;
class Value;
}
class PrefValueMap;
class SupervisedUserSettingsService;
// A PrefStore that gets its values from supervised user settings via the
// SupervisedUserSettingsService passed in at construction.
class SupervisedUserPrefStore : public PrefStore {
public:
SupervisedUserPrefStore(
SupervisedUserSettingsService* supervised_user_settings_service);
// PrefStore overrides:
bool GetValue(const std::string& key,
const base::Value** value) const override;
void AddObserver(PrefStore::Observer* observer) override;
void RemoveObserver(PrefStore::Observer* observer) override;
bool HasObservers() const override;
bool IsInitializationComplete() const override;
private:
~SupervisedUserPrefStore() override;
void OnNewSettingsAvailable(const base::DictionaryValue* settings);
scoped_ptr<PrefValueMap> prefs_;
base::ObserverList<PrefStore::Observer, true> observers_;
base::WeakPtrFactory<SupervisedUserPrefStore> weak_ptr_factory_;
};
#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_
|
/* AUTORIGHTS
Copyright (C) 2007 Princeton University
This file is part of Ferret Toolkit.
Ferret Toolkit 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.
*/
#include <cass.h>
int main (int argc, char *argv[])
{
cass_env_t *env;
int ret;
cass_init();
if (argc < 2)
{
printf("Describe the content of a cass database.\n"
"usage:\n\t%s <path>\n"
"\t<path> -- base directory.\n", argv[0]);
return 0;
}
ret = cass_env_open(&env, argv[1], 0);
if (ret != 0) { printf("ERROR: %s\n", cass_strerror(ret)); return 0; }
ret = cass_env_describe(env, stdout);
if (ret != 0) { printf("ERROR: %s\n", cass_strerror(ret)); return 0; }
ret = cass_env_close(env, 0);
if (ret != 0) { printf("ERROR: %s\n", cass_strerror(ret)); return 0; }
cass_cleanup();
return 0;
}
|
#ifndef lint
static char rcsid[] = "$Header: /usr/people/sam/tiff/libtiff/RCS/tif_jpeg.c,v 1.4 92/02/10 19:06:04 sam Exp $";
#endif
/*
* Copyright (c) 1990, 1991, 1992 Sam Leffler
* Copyright (c) 1991, 1992 Silicon Graphics, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
/*
* TIFF Library.
*
* Baseline JPEG Compression Algorithm Support.
*/
#include "tiffioP.h"
TIFFInitJPEG(tif)
register TIFF *tif;
{
return (1);
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#ifndef TwoWayPipe_H
#define TwoWayPipe_H
#ifdef FEATURE_PAL
#define INVALID_PIPE -1
#else
#define INVALID_PIPE INVALID_HANDLE_VALUE
#endif
// This file contains definition of a simple IPC mechanism - bidirectional named pipe.
// It is implemented on top of two one-directional names pipes (fifos on UNIX)
// One Windows it is possible to ask OS to create a bidirectional pipe, but it is not the case on UNIX.
// In order to unify implementation we use two pipes on all systems.
// This all methods of this class are *NOT* thread safe: it is assumed the caller provides synchronization at a higher level.
class TwoWayPipe
{
public:
enum State
{
NotInitialized, // Object didn't create or connect to any pipes.
Created, // Server side of the pipe has been created, but didn't bind it to a client.
ServerConnected, // Server side of the pipe is connected to a client
ClientConnected, // Client side of the pipe is connected to a server.
};
TwoWayPipe()
:m_state(NotInitialized),
m_inboundPipe(INVALID_PIPE),
m_outboundPipe(INVALID_PIPE)
{}
~TwoWayPipe()
{
Disconnect();
}
// Creates a server side of the pipe.
// Id is used to create pipes names and uniquely identify the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool CreateServer(DWORD id);
// Connects to a previously opened server side of the pipe.
// Id is used to locate the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool Connect(DWORD id);
// Waits for incoming client connections, assumes GetState() == Created
// true - success, false - failure (use GetLastError() for more details)
bool WaitForConnection();
// Reads data from pipe. Returns number of bytes read or a negative number in case of an error.
// use GetLastError() for more details
int Read(void *buffer, DWORD bufferSize);
// Writes data to pipe. Returns number of bytes written or a negative number in case of an error.
// use GetLastError() for more details
int Write(const void *data, DWORD dataSize);
// Disconnects server or client side of the pipe.
// true - success, false - failure (use GetLastError() for more details)
bool Disconnect();
State GetState()
{
return m_state;
}
private:
State m_state;
#ifdef FEATURE_PAL
int m_id; //id that was passed to CreateServer() or Connect()
int m_inboundPipe, m_outboundPipe; //two one sided pipes used for communication
#else
// Connects to a one sided pipe previously created by CreateOneWayPipe.
// In order to successfully connect id and inbound flag should be the same.
HANDLE OpenOneWayPipe(DWORD id, bool inbound);
// Creates a one way pipe, id and inboud flag are used for naming.
// Created pipe is supposed to be connected to by OpenOneWayPipe.
HANDLE CreateOneWayPipe(DWORD id, bool inbound);
HANDLE m_inboundPipe, m_outboundPipe; //two one sided pipes used for communication
#endif //FEATURE_PAL
};
#endif //TwoWayPipe_H
|
//
// UIImageView+LBBlurredImage.h
// LBBlurredImage
//
// Created by Luca Bernardi on 11/11/12.
// Copyright (c) 2012 Luca Bernardi. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^LBBlurredImageCompletionBlock)(NSError *error);
extern NSString *const kLBBlurredImageErrorDomain;
extern CGFloat const kLBBlurredImageDefaultBlurRadius;
enum LBBlurredImageError {
LBBlurredImageErrorFilterNotAvailable = 0,
};
@interface UIImageView (LBBlurredImage)
/**
Set the blurred version of the provided image to the UIImageView
@param UIImage the image to blur and set as UIImageView's image
@param CGFLoat the radius of the blur used by the Gaussian filter
*param LBBlurredImageCompletionBlock a completion block called after the image
was blurred and set to the UIImageView (the block is dispatched on main thread)
*/
- (void)setImageToBlur: (UIImage *)image
blurRadius: (CGFloat)blurRadius
completionBlock: (LBBlurredImageCompletionBlock) completion;
@end
|
/* GStreamer
* Copyright (C) <2007> Julien Moutte <julien@fluendo.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __MPEG4VIDEO_PARSE_H__
#define __MPEG4VIDEO_PARSE_H__
#include <gst/gst.h>
#include <gst/base/gstbaseparse.h>
#include <gst/codecparsers/gstmpeg4parser.h>
G_BEGIN_DECLS
#define GST_TYPE_MPEG4VIDEO_PARSE (gst_mpeg4vparse_get_type())
#define GST_MPEG4VIDEO_PARSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
GST_TYPE_MPEG4VIDEO_PARSE, GstMpeg4VParse))
#define GST_MPEG4VIDEO_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
GST_TYPE_MPEG4VIDEO_PARSE, GstMpeg4VParseClass))
#define GST_MPEG4VIDEO_PARSE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
GST_TYPE_MPEG4VIDEO_PARSE, GstMpeg4VParseClass))
#define GST_IS_MPEG4VIDEO_PARSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
GST_TYPE_MPEG4VIDEO_PARSE))
#define GST_IS_MPEG4VIDEO_PARSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
GST_TYPE_MPEG4VIDEO_PARSE))
typedef struct _GstMpeg4VParse GstMpeg4VParse;
typedef struct _GstMpeg4VParseClass GstMpeg4VParseClass;
struct _GstMpeg4VParse {
GstBaseParse element;
GstClockTime last_report;
/* parse state */
gint last_sc;
gint vop_offset;
gboolean vo_found;
gboolean config_found;
gboolean intra_frame;
gboolean update_caps;
GstMpeg4VisualObject vo;
gint vo_offset;
GstBuffer *config;
GstMpeg4VideoObjectLayer vol;
gboolean vol_offset;
const gchar *profile;
const gchar *level;
/* properties */
gboolean drop;
guint interval;
GstClockTime pending_key_unit_ts;
GstEvent *force_key_unit_event;
};
struct _GstMpeg4VParseClass {
GstBaseParseClass parent_class;
};
GType gst_mpeg4vparse_get_type (void);
G_END_DECLS
#endif /* __MPEG4VIDEO_PARSE_H__ */
|
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
/* { dg-add-options arm_v8_1m_mve } */
/* { dg-additional-options "-O2" } */
#include "arm_mve.h"
uint8x16_t
foo (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p)
{
return veorq_m_u8 (inactive, a, b, p);
}
/* { dg-final { scan-assembler "vpst" } } */
/* { dg-final { scan-assembler "veort" } } */
uint8x16_t
foo1 (uint8x16_t inactive, uint8x16_t a, uint8x16_t b, mve_pred16_t p)
{
return veorq_m (inactive, a, b, p);
}
/* { dg-final { scan-assembler "vpst" } } */
/* { dg-final { scan-assembler "veort" } } */
|
#ifndef CYGONCE_HAL_VAR_ARCH_H
#define CYGONCE_HAL_VAR_ARCH_H
//=============================================================================
//
// var_arch.h
//
// MAC7100 variant architecture overrides
//
//=============================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 2003 Free Software Foundation, Inc.
//
// eCos 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.
//
// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): Ilija Koco <ilijak@siva.com.mk>
// Contributors:
// Date: 2006-02-03
// Purpose: MAC7100 variant architecture overrides
// Description:
// Usage: #include <cyg/hal/hal_arch.h>
//
//####DESCRIPTIONEND####
//
//=============================================================================
#include <pkgconf/hal.h>
#include <cyg/hal/hal_io.h>
//--------------------------------------------------------------------------
// Idle thread code.
// This macro is called in the idle thread loop, and gives the HAL the
// chance to insert code. Typical idle thread behaviour might be to halt the
// processor. These implementations halt the system core clock.
#ifndef HAL_IDLE_THREAD_ACTION
// No idle action
#endif
#endif // CYGONCE_HAL_VAR_ARCH_H
//-----------------------------------------------------------------------------
// end of var_arch.h
|
#ifndef _IP_H
#define _IP_H
struct iphdr {
uint8_t verhdrlen;
uint8_t service;
uint16_t len;
uint16_t ident;
uint16_t frags;
uint8_t ttl;
uint8_t protocol;
uint16_t chksum;
in_addr src;
in_addr dest;
} PACKED;
#endif /* _IP_H */
|
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef ReputationPackets_h__
#define ReputationPackets_h__
#include "Packet.h"
#include <array>
namespace WorldPackets
{
namespace Reputation
{
static uint16 const FactionCount = 300;
class InitializeFactions final : public ServerPacket
{
public:
InitializeFactions() : ServerPacket(SMSG_INITIALIZE_FACTIONS, 1312)
{
FactionStandings.fill(0);
FactionHasBonus.fill(false);
FactionFlags.fill(0);
}
WorldPacket const* Write() override;
std::array<int32, FactionCount> FactionStandings;
std::array<bool, FactionCount> FactionHasBonus; ///< @todo: implement faction bonus
std::array<uint8, FactionCount> FactionFlags; ///< @see enum FactionFlags
};
class RequestForcedReactions final : public ClientPacket
{
public:
RequestForcedReactions(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_FORCED_REACTIONS, std::move(packet)) { }
void Read() override { }
};
struct ForcedReaction
{
int32 Faction = 0;
int32 Reaction = 0;
};
class SetForcedReactions final : public ServerPacket
{
public:
SetForcedReactions() : ServerPacket(SMSG_SET_FORCED_REACTIONS) { }
WorldPacket const* Write() override;
std::vector<ForcedReaction> Reactions;
};
struct FactionStandingData
{
FactionStandingData() { }
FactionStandingData(int32 index, int32 standing) : Index(index), Standing(standing) { }
int32 Index = 0;
int32 Standing = 0;
};
class SetFactionStanding final : public ServerPacket
{
public:
SetFactionStanding() : ServerPacket(SMSG_SET_FACTION_STANDING) { }
WorldPacket const* Write() override;
float ReferAFriendBonus = 0.0f;
float BonusFromAchievementSystem = 0.0f;
std::vector<FactionStandingData> Faction;
bool ShowVisual = false;
};
}
}
#endif // ReputationPackets_h__
|
/**
* @file
*
* @brief Suspends Execution of calling thread until Time elaps
* @ingroup POSIXAPI
*/
/*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <time.h>
#include <errno.h>
#include <rtems/seterr.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/timespec.h>
#include <rtems/score/watchdogimpl.h>
/*
* 14.2.5 High Resolution Sleep, P1003.1b-1993, p. 269
*/
int nanosleep(
const struct timespec *rqtp,
struct timespec *rmtp
)
{
/*
* It is critical to obtain the executing thread after thread dispatching is
* disabled on SMP configurations.
*/
Thread_Control *executing;
Watchdog_Interval ticks;
/*
* Return EINVAL if the delay interval is negative.
*
* NOTE: This behavior is beyond the POSIX specification.
* FSU and GNU/Linux pthreads shares this behavior.
*/
if ( !_Timespec_Is_valid( rqtp ) )
rtems_set_errno_and_return_minus_one( EINVAL );
ticks = _Timespec_To_ticks( rqtp );
/*
* A nanosleep for zero time is implemented as a yield.
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS API and yields desirable behavior.
*/
if ( !ticks ) {
_Thread_Disable_dispatch();
executing = _Thread_Executing;
_Thread_Yield( executing );
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
}
return 0;
}
/*
* Block for the desired amount of time
*/
_Thread_Disable_dispatch();
executing = _Thread_Executing;
_Thread_Set_state(
executing,
STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
);
_Watchdog_Initialize(
&executing->Timer,
_Thread_Delay_ended,
0,
executing
);
_Watchdog_Insert_ticks( &executing->Timer, ticks );
_Thread_Enable_dispatch();
/* calculate time remaining */
if ( rmtp ) {
ticks -= executing->Timer.stop_time - executing->Timer.start_time;
_Timespec_From_ticks( ticks, rmtp );
/*
* Only when POSIX is enabled, can a sleep be interrupted.
*/
#if defined(RTEMS_POSIX_API)
/*
* If there is time remaining, then we were interrupted by a signal.
*/
if ( ticks )
rtems_set_errno_and_return_minus_one( EINTR );
#endif
}
return 0;
}
|
/*************************************************************************
* TinyFugue - programmable mud client
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2006-2007 Ken Keys
*
* TinyFugue (aka "tf") is protected under the terms of the GNU
* General Public License. See the file "COPYING" for details.
************************************************************************/
/* $Id: socket.h,v 35004.44 2007/01/13 23:12:39 kkeys Exp $ */
#ifndef SOCKET_H
#define SOCKET_H
/* socktime ids */
#define SOCK_RECV 0
#define SOCK_SEND 1
/* /connect flags */
#define CONN_AUTOLOGIN 0x01
#define CONN_QUIETLOGIN 0x02
#define CONN_SSL 0x04
#define CONN_BG 0x08
#define CONN_FG 0x10
struct World *world_decl; /* declares struct World */
extern String *incoming_text;
extern int quit_flag;
extern struct Sock *xsock;
extern void main_loop(void);
extern void init_sock(void);
extern int sockecho(void);
extern int is_active(int fd);
extern void readers_clear(int fd);
extern void readers_set(int fd);
extern struct timeval *socktime(const char *name, int dir);
extern int tog_bg(Var *var);
extern int tog_keepalive(Var *var);
extern int openworld(const char *name, const char *port, int flags);
extern void world_output(struct World *world, conString *line);
extern int send_line(const char *s, unsigned int len, int eol_flag);
extern conString *fgprompt(void);
extern int tog_lp(Var *var);
extern void transmit_window_size(void);
extern int local_echo(int flag);
extern int handle_send_function(conString *string, const char *world,
const char *flags);
extern int handle_fake_recv_function(conString *string, const char *world,
const char *flags);
extern int is_connected(const char *worldname);
extern int is_open(const char *worldname);
extern int nactive(const char *worldname);
extern int world_hook(const char *fmt, const char *name);
extern struct World *xworld(void);
extern int xsock_is_fg(void);
extern int have_active_socks(void);
extern void xsock_alert_id(void);
extern const char *fgname(void);
extern const char *world_info(const char *worldname, const char *fieldname);
extern struct World *named_or_current_world(const char *name);
#endif /* SOCKET_H */
|
/***
This file is part of systemd.
Copyright 2016 Lennart Poettering
systemd 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.
systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <sd-bus.h>
#include "macro.h"
static bool track_cb_called_x = false;
static bool track_cb_called_y = false;
static int track_cb_x(sd_bus_track *t, void *userdata) {
log_error("TRACK CB X");
assert_se(!track_cb_called_x);
track_cb_called_x = true;
/* This means b's name disappeared. Let's now disconnect, to make sure the track handling on disconnect works
* as it should. */
assert_se(shutdown(sd_bus_get_fd(sd_bus_track_get_bus(t)), SHUT_RDWR) >= 0);
return 1;
}
static int track_cb_y(sd_bus_track *t, void *userdata) {
int r;
log_error("TRACK CB Y");
assert_se(!track_cb_called_y);
track_cb_called_y = true;
/* We got disconnected, let's close everything */
r = sd_event_exit(sd_bus_get_event(sd_bus_track_get_bus(t)), EXIT_SUCCESS);
assert_se(r >= 0);
return 0;
}
int main(int argc, char *argv[]) {
_cleanup_(sd_event_unrefp) sd_event *event = NULL;
_cleanup_(sd_bus_track_unrefp) sd_bus_track *x = NULL, *y = NULL;
_cleanup_(sd_bus_unrefp) sd_bus *a = NULL, *b = NULL;
const char *unique;
int r;
r = sd_event_default(&event);
assert_se(r >= 0);
r = sd_bus_open_system(&a);
if (IN_SET(r, -ECONNREFUSED, -ENOENT)) {
log_info("Failed to connect to bus, skipping tests.");
return EXIT_TEST_SKIP;
}
assert_se(r >= 0);
r = sd_bus_attach_event(a, event, SD_EVENT_PRIORITY_NORMAL);
assert_se(r >= 0);
r = sd_bus_open_system(&b);
assert_se(r >= 0);
r = sd_bus_attach_event(b, event, SD_EVENT_PRIORITY_NORMAL);
assert_se(r >= 0);
/* Watch b's name from a */
r = sd_bus_track_new(a, &x, track_cb_x, NULL);
assert_se(r >= 0);
r = sd_bus_get_unique_name(b, &unique);
assert_se(r >= 0);
r = sd_bus_track_add_name(x, unique);
assert_se(r >= 0);
/* Watch's a's own name from a */
r = sd_bus_track_new(a, &y, track_cb_y, NULL);
assert_se(r >= 0);
r = sd_bus_get_unique_name(a, &unique);
assert_se(r >= 0);
r = sd_bus_track_add_name(y, unique);
assert_se(r >= 0);
/* Now make b's name disappear */
sd_bus_close(b);
r = sd_event_loop(event);
assert_se(r >= 0);
assert_se(track_cb_called_x);
assert_se(track_cb_called_y);
return 0;
}
|
/*
*
* Copyright (c) 2001-2002, Biswapesh Chattopadhyay
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
*/
#ifndef TM_SOURCE_FILE_H
#define TM_SOURCE_FILE_H
#include "tm_work_object.h"
#ifndef LIBCTAGS_DEFINED
typedef int langType;
typedef void tagEntryInfo;
#endif
#if !defined(tagEntryInfo)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/* Casts a pointer to a pointer to a TMSourceFile structure */
#define TM_SOURCE_FILE(work_object) ((TMSourceFile *) work_object)
/* Checks whether the object is a TMSourceFile */
#define IS_TM_SOURCE_FILE(source_file) (((TMWorkObject *) (source_file))->type \
== source_file_class_id)
/*!
The TMSourceFile structure is derived from TMWorkObject and contains all it's
attributes, plus an integer representing the language of the file.
*/
typedef struct
{
TMWorkObject work_object; /*!< The base work object */
langType lang; /*!< Programming language used */
gboolean inactive; /*!< Whether this file should be scanned for tags */
} TMSourceFile;
/* Initializes a TMSourceFile structure from a file name. */
gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
gboolean update, const char *name);
/* Initializes a TMSourceFile structure and returns a pointer to it. */
TMWorkObject *tm_source_file_new(const char *file_name, gboolean update, const char *name);
/* Destroys the contents of the source file. Note that the tags are owned by the
source file and are also destroyed when the source file is destroyed. If pointers
to these tags are used elsewhere, then those tag arrays should be rebuilt.
*/
void tm_source_file_destroy(TMSourceFile *source_file);
/* Frees a TMSourceFile structure, including all contents */
void tm_source_file_free(gpointer source_file);
/*! Updates the source file by reparsing if the modification time is greater
than the timestamp in the structure, or if force is TRUE. The tags array and
the tags themselves are destroyed and re-created, hence any other tag arrays
pointing to these tags should be rebuilt as well. All sorting information is
also lost. The language parameter is automatically set the first time the file
is parsed.
\param source_file The source file to update.
\param force Ignored. The source file is always updated.
\param recurse This parameter is ignored for source files and is only there for consistency.
\param update_parent If set to TRUE, sends an update signal to parent if required. You should
always set this to TRUE if you are calling this function directly.
\return TRUE if the file was parsed, FALSE otherwise.
\sa tm_work_object_update(), tm_project_update(), tm_workspace_update()
*/
gboolean tm_source_file_update(TMWorkObject *source_file, gboolean force
, gboolean recurse, gboolean update_parent);
/*! Updates the source file by reparsing the text-buffer passed as parameter.
Ctags will use a parsing based on buffer instead of on files.
You should call this function when you don't want a previous saving of the file
you're editing. It's useful for a "real-time" updating of the tags.
The tags array and the tags themselves are destroyed and re-created, hence any
other tag arrays pointing to these tags should be rebuilt as well. All sorting
information is also lost. The language parameter is automatically set the first
time the file is parsed.
\param source_file The source file to update with a buffer.
\param text_buf A text buffer. The user should take care of allocate and free it after
the use here.
\param buf_size The size of text_buf.
\param update_parent If set to TRUE, sends an update signal to parent if required. You should
always set this to TRUE if you are calling this function directly.
\return TRUE if the file was parsed, FALSE otherwise.
\sa tm_work_object_update(), tm_project_update(), tm_workspace_update()
*/
gboolean tm_source_file_buffer_update(TMWorkObject *source_file, guchar* text_buf,
gint buf_size, gboolean update_parent);
/* Parses the source file and regenarates the tags.
\param source_file The source file to parse
\return TRUE on success, FALSE on failure
\sa tm_source_file_update()
*/
gboolean tm_source_file_parse(TMSourceFile *source_file);
/* Parses the text-buffer and regenarates the tags.
\param source_file The source file to parse
\param text_buf The text buffer to parse
\param buf_size The size of text_buf.
\return TRUE on success, FALSE on failure
\sa tm_source_file_update()
*/
gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf, gint buf_size);
/*
This function is registered into the ctags parser when a file is parsed for
the first time. The function is then called by the ctags parser each time
it finds a new tag. You should not have to use this function.
\sa tm_source_file_parse()
*/
int tm_source_file_tags(const tagEntryInfo *tag);
/*
Writes all tags of a source file (including the file tag itself) to the passed
file pointer.
\param source_file The source file to write.
\param fp The file pointer to write to.
\param attrs The attributes to write.
\return TRUE on success, FALSE on failure.
*/
gboolean tm_source_file_write(TMWorkObject *source_file, FILE *fp, guint attrs);
/* Contains the id obtained by registering the TMSourceFile class as a child of
TMWorkObject.
\sa tm_work_object_register()
*/
extern guint source_file_class_id;
/* Gets the name associated with the language index.
\param lang The language index.
\return The language name, or NULL.
*/
const gchar *tm_source_file_get_lang_name(gint lang);
/* Gets the language index for \a name.
\param name The language name.
\return The language index, or -2.
*/
gint tm_source_file_get_named_lang(const gchar *name);
/* Set the argument list of tag identified by its name */
void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist);
#ifdef __cplusplus
}
#endif
#endif /* TM_SOURCE_FILE_H */
|
#ifndef OFX_CV_CONSTANTS_H
#define OFX_CV_CONSTANTS_H
#include "cv.h"
#include <vector>
#include "ofMain.h"
enum ofxCvRoiMode {
OFX_CV_ROI_MODE_INTERSECT,
OFX_CV_ROI_MODE_NONINTERSECT
};
#endif
|
/**
* This is a very small example that shows how to use
* protothreads. The program consists of two protothreads that wait
* for each other to toggle a variable.
*/
/* We must always include pt.h in our protothreads code. */
#include "pt.h"
#include <stdio.h> /* For printf(). */
/* Two flags that the two protothread functions use. */
static int protothread1_flag, protothread2_flag;
/**
* The first protothread function. A protothread function must always
* return an integer, but must never explicitly return - returning is
* performed inside the protothread statements.
*
* The protothread function is driven by the main loop further down in
* the code.
*/
static int
protothread1(struct pt *pt)
{
/* A protothread function must begin with PT_BEGIN() which takes a
pointer to a struct pt. */
PT_BEGIN(pt);
/* We loop forever here. */
while(1) {
/* Wait until the other protothread has set its flag. */
PT_WAIT_UNTIL(pt, protothread2_flag != 0);
printf("Protothread 1 running\n");
/* We then reset the other protothread's flag, and set our own
flag so that the other protothread can run. */
protothread2_flag = 0;
protothread1_flag = 1;
/* And we loop. */
}
/* All protothread functions must end with PT_END() which takes a
pointer to a struct pt. */
PT_END(pt);
}
/**
* The second protothread function. This is almost the same as the
* first one.
*/
static int
protothread2(struct pt *pt)
{
PT_BEGIN(pt);
while(1) {
/* Let the other protothread run. */
protothread2_flag = 1;
/* Wait until the other protothread has set its flag. */
PT_WAIT_UNTIL(pt, protothread1_flag != 0);
printf("Protothread 2 running\n");
/* We then reset the other protothread's flag. */
protothread1_flag = 0;
/* And we loop. */
}
PT_END(pt);
}
/**
* Finally, we have the main loop. Here is where the protothreads are
* initialized and scheduled. First, however, we define the
* protothread state variables pt1 and pt2, which hold the state of
* the two protothreads.
*/
static struct pt pt1, pt2;
int
main(void)
{
/* Initialize the protothread state variables with PT_INIT(). */
PT_INIT(&pt1);
PT_INIT(&pt2);
/*
* Then we schedule the two protothreads by repeatedly calling their
* protothread functions and passing a pointer to the protothread
* state variables as arguments.
*/
while(1) {
protothread1(&pt1);
protothread2(&pt2);
}
}
|
/*
This file is part of darktable,
copyright (c) 2013 Jeremy Rosen
darktable 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.
darktable 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 darktable. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <common/imageio_module.h>
#include <lua/lua.h>
#define dt_lua_register_module_member(L, storage, struct_type, member, member_type) \
luaA_struct_member_type(L, storage->parameter_lua_type, #member, luaA_type(L, member_type), \
offsetof(struct_type, member))
#define dt_lua_register_module_member_indirect(L, storage, struct_type, struct_member, child_type,child_member, member_type) \
luaA_struct_member_type(L, storage->parameter_lua_type, #child_member, luaA_type(L, member_type), \
offsetof(struct_type, struct_member)+offsetof( child_type, child_member))
// define a new module type
void dt_lua_module_new(lua_State *L, const char *module_type_name);
// get the singleton object that represent this module type
void dt_lua_module_push(lua_State *L, const char *module_type_name);
/// create a new entry into the module, the object to be the entry is taken from the index)
void dt_lua_module_entry_new(lua_State *L, int index, const char *module_type_name, const char *entry_name);
/// create a new entry into the module, a singleton is created for you that contains entry
void dt_lua_module_entry_new_singleton(lua_State *L, const char *module_type_name, const char *entry_name,
void *entry);
/// get the singleton reprensenting an entry
void dt_lua_module_entry_push(lua_State *L, const char *module_type_name, const char *entry_name);
/// get the type of an entry
luaA_Type dt_lua_module_entry_get_type(lua_State *L, const char *module_type_name, const char *entry_name);
/// preset handling
#define dt_lua_register_module_presets(L, module, entry, type) \
dt_lua_register_module_presets_type(L, module, entry, luaA_type_id(type))
void dt_lua_register_module_presets_type(lua_State *L, const char *module_type_name, const char *entry_name,
luaA_Type preset_type);
luaA_Type dt_lua_module_get_preset_type(lua_State *L, const char *module_type_name, const char *entry_name);
void dt_lua_register_current_preset(lua_State *L, const char *module_type_name, const char *entry_name,
lua_CFunction pusher, lua_CFunction getter);
int dt_lua_init_early_modules(lua_State *L);
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.sh
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
|
/*
* Copyright (C) 2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup drivers_nrf52_802154 IEEE802.15.4 Driver for nRF52840 SoCs
* @ingroup drivers_netdev
* @brief Driver for using the nRF52's radio in IEEE802.15.4 mode
*
* ## Implementation state ##
* Netdev events supported:
*
* - NETDEV_EVENT_RX_COMPLETE
* - NETDEV_EVENT_TX_COMPLETE
*
* Transmission options not yet implemented:
* - Send acknowledgement for packages
* - Request acknowledgement
* - Retransmit unacked packages
* - Carrier Sense Multiple Access (CSMA) and Implementation of Clear Channel
* Assessment Control (CCACTRL)
*
* @{
*
* @file
* @brief Driver interface for using the nRF52 in IEEE802.15.4 mode
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Semjon Kerner <semjon.kerner@fu-berlin.de>
*/
#ifndef NRF802154_H
#define NRF802154_H
#include "net/ieee802154/radio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Device descriptor for NRF802154 transceiver
*/
typedef struct nrf802154 nrf802154_t;
/**
* @defgroup drivers_nrf52_802154_conf nrf802154 driver compile configuration
* @ingroup drivers_nrf52_802154
* @ingroup config_drivers_netdev
* @{
*/
/**
* @brief NRF802154 default CCA threshold value for CCACTRL register.
*
* @note This value was copied from the Nordic reference driver configuration
*/
#ifndef CONFIG_NRF802154_CCA_THRESH_DEFAULT
#define CONFIG_NRF802154_CCA_THRESH_DEFAULT 0x14
#endif
/** @} */
/**
* @brief IEEE 802.15.4 radio timer configuration
*
* this radio relies on a dedicated hardware timer to maintain IFS
* the default timer may be overwritten in the board configuration
*/
#ifndef NRF802154_TIMER
#define NRF802154_TIMER TIMER_DEV(1)
#endif
/**
* @brief Setup NRF802154 in order to be used with the IEEE 802.15.4 Radio HAL
*
* @note This functions MUST be called before @ref nrf802154_init.
*
* @param[in] hal pointer to the HAL descriptor associated to the device.
*/
void nrf802154_hal_setup(ieee802154_dev_t *hal);
/**
* @brief Initialize the NRF52840 radio.
*
* @return 0 on success
* @return negative errno on error
*/
int nrf802154_init(void);
/**
* @brief Setup a NRF802154 radio device
*
* @param[out] dev Device descriptor
*/
void nrf802154_setup(nrf802154_t *dev);
#ifdef __cplusplus
}
#endif
#endif /* NRF802154_H */
/** @} */
|
/*
* Copyright (C) 2015-2016 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup cpu_nrf5x_common
* @{
*
* @file
* @brief CPU specific definitions for handling peripherals
*
* @author Hauke Petersen <hauke.peterse@fu-berlin.de>
*/
#ifndef CPU_PERIPH_H
#define CPU_PERIPH_H
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Iron out some differences in register and IRQ channel naming between
* the different nRFx family members
* @{
*/
#if defined(CPU_FAM_NRF51)
#define GPIO_BASE (NRF_GPIO)
#define UART_IRQN (UART0_IRQn)
#elif defined(CPU_FAM_NRF52)
#define GPIO_BASE (NRF_P0)
#define UART_IRQN (UARTE0_UART0_IRQn)
#else
#error "nrf5x_common: no valid value for CPU_FAM_XX defined"
#endif
/** @} */
/**
* @brief Length of the CPU_ID in octets
*/
#define CPUID_LEN (8U)
/**
* @brief Override macro for defining GPIO pins
*
* The port definition is used (and zeroed) to suppress compiler warnings
*/
#define GPIO_PIN(x,y) ((x & 0) | y)
/**
* @brief Generate GPIO mode bitfields
*
* We use 4 bit to encode the pin mode:
* - bit 0: output enable
* - bit 1: input connect
* - bit 2+3: pull resistor configuration
*/
#define GPIO_MODE(oe, ic, pr) (oe | (ic << 1) | (pr << 2))
/**
* @brief Override GPIO modes
*
* We use 4 bit to encode the pin mode:
* - bit 0: output enable
* - bit 1: input connect
* - bit 2+3: pull resistor configuration
* @{
*/
#define HAVE_GPIO_MODE_T
typedef enum {
GPIO_IN = GPIO_MODE(0, 0, 0), /**< IN */
GPIO_IN_PD = GPIO_MODE(0, 0, 1), /**< IN with pull-down */
GPIO_IN_PU = GPIO_MODE(0, 0, 3), /**< IN with pull-up */
GPIO_OUT = GPIO_MODE(1, 1, 0), /**< OUT (push-pull) */
GPIO_OD = (0xff), /**< not supported by HW */
GPIO_OD_PU = (0xfe) /**< not supported by HW */
} gpio_mode_t;
/** @} */
/**
* @brief Override GPIO active flank values
* @{
*/
#define HAVE_GPIO_FLANK_T
typedef enum {
GPIO_FALLING = 2, /**< emit interrupt on falling flank */
GPIO_RISING = 1, /**< emit interrupt on rising flank */
GPIO_BOTH = 3 /**< emit interrupt on both flanks */
} gpio_flank_t;
/** @} */
/**
* @brief Override ADC resolution values
* @{
*/
#define HAVE_ADC_RES_T
typedef enum {
ADC_RES_6BIT = 0xf0, /**< ADC resolution: 6 bit */
ADC_RES_8BIT = 0x00, /**< ADC resolution: 8 bit */
ADC_RES_10BIT = 0x02, /**< ADC resolution: 10 bit */
ADC_RES_12BIT = 0xf1, /**< ADC resolution: 12 bit */
ADC_RES_14BIT = 0xf2, /**< ADC resolution: 14 bit */
ADC_RES_16BIT = 0xf3 /**< ADC resolution: 16 bit */
} adc_res_t;
/** @} */
/**
* @brief Timer configuration options
*/
typedef struct {
NRF_TIMER_Type *dev;
uint8_t channels;
uint8_t bitmode;
uint8_t irqn;
} timer_conf_t;
#ifdef __cplusplus
}
#endif
#endif /* CPU_PERIPH_H */
/** @} */
|
#ifndef UTIL_H
#define UTIL_H
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <getopt.h>
#include "libopensc/opensc.h"
#ifdef __cplusplus
extern "C" {
#endif
#if _MSC_VER >= 1310
/* MS Visual Studio 2003/.NET Framework 1.1 or newer */
# define NORETURN _declspec( noreturn)
#elif __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ >= 5)) || (defined __clang__)
# define NORETURN __attribute__ ((noreturn))
#elif __cplusplus >= 201103L
# define NORETURN [[noreturn]]
#elif __STDC_VERSION__ >= 201112L
# define NORETURN _Noreturn
#else
# define NORETURN
#endif
void util_print_binary(FILE *f, const u8 *buf, int count);
void util_hex_dump(FILE *f, const u8 *in, int len, const char *sep);
void util_hex_dump_asc(FILE *f, const u8 *in, size_t count, int addr);
NORETURN void util_print_usage_and_die(const char *app_name, const struct option options[],
const char *option_help[], const char *args);
int util_list_card_drivers(const sc_context_t *ctx);
const char * util_acl_to_str(const struct sc_acl_entry *e);
void util_warn(const char *fmt, ...);
void util_error(const char *fmt, ...);
NORETURN void util_fatal(const char *fmt, ...);
int util_connect_reader (sc_context_t *ctx, sc_reader_t **reader, const char *reader_id, int do_wait, int verbose);
/* All singing all dancing card connect routine */
int util_connect_card_ex(struct sc_context *, struct sc_card **, const char *reader_id, int do_wait, int do_lock, int verbose);
int util_connect_card(struct sc_context *, struct sc_card **, const char *reader_id, int do_wait, int verbose);
int util_getpass (char **lineptr, size_t *n, FILE *stream);
/* Get a PIN (technically just a string). The source depends on the value of *input:
* env:<var> - get from the environment variable <var>
* otherwise - use input
*/
size_t util_get_pin(const char *input, const char **pin);
#ifdef __cplusplus
}
#endif
#endif
|
/*===================================================================
BlueBerry Platform
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef __BERRY_OR_EXPRESSION_H__
#define __BERRY_OR_EXPRESSION_H__
#include "berryCompositeExpression.h"
namespace berry {
class OrExpression : public CompositeExpression {
public:
EvaluationResult::ConstPointer Evaluate(IEvaluationContext* context) const override;
bool operator==(const Object* object) const override;
};
} // namespace berry
#endif // __BERRY_OR_EXPRESSION_H__
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_RENDERERS_SHARED_IMAGE_VIDEO_FRAME_TEST_UTILS_H_
#define MEDIA_RENDERERS_SHARED_IMAGE_VIDEO_FRAME_TEST_UTILS_H_
#include <GLES3/gl3.h>
#include <stdint.h>
#include "base/bind.h"
#include "components/viz/common/gpu/context_provider.h"
#include "media/base/video_frame.h"
namespace media {
// Creates a video frame from a set of shared images with a common texture
// target and sync token.
scoped_refptr<VideoFrame> CreateSharedImageFrame(
scoped_refptr<viz::ContextProvider> context_provider,
VideoPixelFormat format,
std::vector<gpu::Mailbox> mailboxes,
const gpu::SyncToken& sync_token,
GLenum texture_target,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
base::OnceClosure destroyed_callback);
// Creates a shared image backed frame in RGBA format, with colors on the shared
// image mapped as follow.
// Bk | R | G | Y
// ---+---+---+---
// Bl | M | C | W
scoped_refptr<VideoFrame> CreateSharedImageRGBAFrame(
scoped_refptr<viz::ContextProvider> context_provider,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
base::OnceClosure destroyed_callback);
// Creates a shared image backed frame in I420 format, with colors mapped
// exactly like CreateSharedImageRGBAFrame above, noting that subsamples may get
// interpolated leading to inconsistent colors around the "seams".
scoped_refptr<VideoFrame> CreateSharedImageI420Frame(
scoped_refptr<viz::ContextProvider> context_provider,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
base::OnceClosure destroyed_callback);
// Creates a shared image backed frame in NV12 format, with colors mapped
// exactly like CreateSharedImageRGBAFrame above.
// This will return nullptr if the necessary extension is not available for NV12
// support.
scoped_refptr<VideoFrame> CreateSharedImageNV12Frame(
scoped_refptr<viz::ContextProvider> context_provider,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
base::OnceClosure destroyed_callback);
} // namespace media
#endif // MEDIA_RENDERERS_SHARED_IMAGE_VIDEO_FRAME_TEST_UTILS_H_
|
//===-- call_apsr.h - Helpers for ARM EABI floating point tests -----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares helpers for ARM EABI floating point tests for the
// compiler_rt library.
//
//===----------------------------------------------------------------------===//
#ifndef CALL_APSR_H
#define CALL_APSR_H
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
#error big endian support not implemented
#endif
union cpsr {
struct {
uint32_t filler: 28;
uint32_t v: 1;
uint32_t c: 1;
uint32_t z: 1;
uint32_t n: 1;
} flags;
uint32_t value;
};
extern __attribute__((pcs("aapcs")))
uint32_t call_apsr_f(float a, float b, __attribute__((pcs("aapcs"))) void (*fn)(float, float));
extern __attribute__((pcs("aapcs")))
uint32_t call_apsr_d(double a, double b, __attribute__((pcs("aapcs"))) void (*fn)(double, double));
#endif // CALL_APSR_H
|
#ifndef QT_NO_QT_INCLUDE_WARN
#if defined(__GNUC__)
#warning "Inclusion of header files from include/Qt is deprecated."
#elif defined(_MSC_VER)
#pragma message("WARNING: Inclusion of header files from include/Qt is deprecated.")
#endif
#endif
#include "../QtDeclarative/qdeclarativeexpression.h"
|
// 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_LOGIN_LOGIN_MODEL_H_
#define CHROME_BROWSER_UI_LOGIN_LOGIN_MODEL_H_
#pragma once
#include "base/string16.h"
// Simple Model & Observer interfaces for a LoginView to facilitate exchanging
// information.
class LoginModelObserver {
public:
// Called by the model when a username,password pair has been identified
// as a match for the pending login prompt.
virtual void OnAutofillDataAvailable(const string16& username,
const string16& password) = 0;
protected:
virtual ~LoginModelObserver() {}
};
class LoginModel {
public:
// Set the observer interested in the data from the model.
// observer can be null, signifying there is no longer any observer
// interested in the data.
virtual void SetObserver(LoginModelObserver* observer) = 0;
protected:
virtual ~LoginModel() {}
};
#endif // CHROME_BROWSER_UI_LOGIN_LOGIN_MODEL_H_
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_WM_PUBLIC_WINDOW_MOVE_CLIENT_H_
#define UI_WM_PUBLIC_WINDOW_MOVE_CLIENT_H_
#include "ui/gfx/geometry/vector2d.h"
#include "ui/wm/public/wm_public_export.h"
namespace aura {
class Window;
}
namespace wm {
enum WindowMoveResult {
MOVE_SUCCESSFUL, // Moving window was successful.
MOVE_CANCELED // Moving window was canceled.
};
enum WindowMoveSource {
WINDOW_MOVE_SOURCE_MOUSE,
WINDOW_MOVE_SOURCE_TOUCH,
};
// An interface implemented by an object that manages programatically keyed
// window moving.
class WM_PUBLIC_EXPORT WindowMoveClient {
public:
// Starts a nested run loop for moving the window. |drag_offset| is the
// offset from the window origin to the cursor when the drag was started.
// Returns MOVE_SUCCESSFUL if the move has completed successfully, or
// MOVE_CANCELED otherwise.
virtual WindowMoveResult RunMoveLoop(aura::Window* window,
const gfx::Vector2d& drag_offset,
WindowMoveSource source) = 0;
// Ends a previously started move loop.
virtual void EndMoveLoop() = 0;
protected:
virtual ~WindowMoveClient() {}
};
// Sets/Gets the activation client for the specified window.
WM_PUBLIC_EXPORT void SetWindowMoveClient(aura::Window* window,
WindowMoveClient* client);
WM_PUBLIC_EXPORT WindowMoveClient* GetWindowMoveClient(aura::Window* window);
} // namespace wm
#endif // UI_WM_PUBLIC_WINDOW_MOVE_CLIENT_H_
|
/**
******************************************************************************
* @file stm32f30x_pwr.h
* @author MCD Application Team
* @version V1.2.2
* @date 27-February-2015
* @brief This file contains all the functions prototypes for the PWR firmware
* library.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F30x_PWR_H
#define __STM32F30x_PWR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f30x.h"
/** @addtogroup STM32F30x_StdPeriph_Driver
* @{
*/
/** @addtogroup PWR
* @{
*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup PWR_Exported_Constants
* @{
*/
/** @defgroup PWR_PVD_detection_level
* @{
*/
#define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
#define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
#define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
#define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
#define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
#define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
#define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
#define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
#define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
/**
* @}
*/
/** @defgroup PWR_WakeUp_Pins
* @{
*/
#define PWR_WakeUpPin_1 PWR_CSR_EWUP1
#define PWR_WakeUpPin_2 PWR_CSR_EWUP2
#define PWR_WakeUpPin_3 PWR_CSR_EWUP3
#define IS_PWR_WAKEUP_PIN(PIN) (((PIN) == PWR_WakeUpPin_1) || \
((PIN) == PWR_WakeUpPin_2) || \
((PIN) == PWR_WakeUpPin_3))
/**
* @}
*/
/** @defgroup PWR_Regulator_state_is_Sleep_STOP_mode
* @{
*/
#define PWR_Regulator_ON ((uint32_t)0x00000000)
#define PWR_Regulator_LowPower PWR_CR_LPSDSR
#define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
((REGULATOR) == PWR_Regulator_LowPower))
/**
* @}
*/
/** @defgroup PWR_SLEEP_mode_entry
* @{
*/
#define PWR_SLEEPEntry_WFI ((uint8_t)0x01)
#define PWR_SLEEPEntry_WFE ((uint8_t)0x02)
#define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPEntry_WFI) || ((ENTRY) == PWR_SLEEPEntry_WFE))
/**
* @}
*/
/** @defgroup PWR_STOP_mode_entry
* @{
*/
#define PWR_STOPEntry_WFI ((uint8_t)0x01)
#define PWR_STOPEntry_WFE ((uint8_t)0x02)
#define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
/**
* @}
*/
/** @defgroup PWR_Flag
* @{
*/
#define PWR_FLAG_WU PWR_CSR_WUF
#define PWR_FLAG_SB PWR_CSR_SBF
#define PWR_FLAG_PVDO PWR_CSR_PVDO
#define PWR_FLAG_VREFINTRDY PWR_CSR_VREFINTRDYF
#define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_VREFINTRDY))
#define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
/**
* @}
*/
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/* Function used to set the PWR configuration to the default reset state ******/
void PWR_DeInit(void);
/* Backup Domain Access function **********************************************/
void PWR_BackupAccessCmd(FunctionalState NewState);
/* PVD configuration functions ************************************************/
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
void PWR_PVDCmd(FunctionalState NewState);
/* WakeUp pins configuration functions ****************************************/
void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState);
/* Low Power modes configuration functions ************************************/
void PWR_EnterSleepMode(uint8_t PWR_SLEEPEntry);
void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
void PWR_EnterSTANDBYMode(void);
/* Flags management functions *************************************************/
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
void PWR_ClearFlag(uint32_t PWR_FLAG);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F30x_PWR_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UINT256_H
#define BITCOIN_UINT256_H
#include <span.h>
#include <assert.h>
#include <cstring>
#include <stdint.h>
#include <string>
#include <vector>
/** Template base class for fixed-sized opaque blobs. */
template<unsigned int BITS>
class base_blob
{
protected:
static constexpr int WIDTH = BITS / 8;
uint8_t m_data[WIDTH];
public:
/* construct 0 value by default */
constexpr base_blob() : m_data() {}
/* constructor for constants between 1 and 255 */
constexpr explicit base_blob(uint8_t v) : m_data{v} {}
explicit base_blob(const std::vector<unsigned char>& vch);
bool IsNull() const
{
for (int i = 0; i < WIDTH; i++)
if (m_data[i] != 0)
return false;
return true;
}
void SetNull()
{
memset(m_data, 0, sizeof(m_data));
}
inline int Compare(const base_blob& other) const { return memcmp(m_data, other.m_data, sizeof(m_data)); }
friend inline bool operator==(const base_blob& a, const base_blob& b) { return a.Compare(b) == 0; }
friend inline bool operator!=(const base_blob& a, const base_blob& b) { return a.Compare(b) != 0; }
friend inline bool operator<(const base_blob& a, const base_blob& b) { return a.Compare(b) < 0; }
std::string GetHex() const;
void SetHex(const char* psz);
void SetHex(const std::string& str);
std::string ToString() const;
const unsigned char* data() const { return m_data; }
unsigned char* data() { return m_data; }
unsigned char* begin()
{
return &m_data[0];
}
unsigned char* end()
{
return &m_data[WIDTH];
}
const unsigned char* begin() const
{
return &m_data[0];
}
const unsigned char* end() const
{
return &m_data[WIDTH];
}
static constexpr unsigned int size()
{
return sizeof(m_data);
}
uint64_t GetUint64(int pos) const
{
const uint8_t* ptr = m_data + pos * 8;
return ((uint64_t)ptr[0]) | \
((uint64_t)ptr[1]) << 8 | \
((uint64_t)ptr[2]) << 16 | \
((uint64_t)ptr[3]) << 24 | \
((uint64_t)ptr[4]) << 32 | \
((uint64_t)ptr[5]) << 40 | \
((uint64_t)ptr[6]) << 48 | \
((uint64_t)ptr[7]) << 56;
}
template<typename Stream>
void Serialize(Stream& s) const
{
s.write(MakeByteSpan(m_data));
}
template<typename Stream>
void Unserialize(Stream& s)
{
s.read(MakeWritableByteSpan(m_data));
}
};
/** 160-bit opaque blob.
* @note This type is called uint160 for historical reasons only. It is an opaque
* blob of 160 bits and has no integer operations.
*/
class uint160 : public base_blob<160> {
public:
constexpr uint160() {}
explicit uint160(const std::vector<unsigned char>& vch) : base_blob<160>(vch) {}
};
/** 256-bit opaque blob.
* @note This type is called uint256 for historical reasons only. It is an
* opaque blob of 256 bits and has no integer operations. Use arith_uint256 if
* those are required.
*/
class uint256 : public base_blob<256> {
public:
constexpr uint256() {}
constexpr explicit uint256(uint8_t v) : base_blob<256>(v) {}
explicit uint256(const std::vector<unsigned char>& vch) : base_blob<256>(vch) {}
static const uint256 ZERO;
static const uint256 ONE;
};
/* uint256 from const char *.
* This is a separate function because the constructor uint256(const char*) can result
* in dangerously catching uint256(0).
*/
inline uint256 uint256S(const char *str)
{
uint256 rv;
rv.SetHex(str);
return rv;
}
/* uint256 from std::string.
* This is a separate function because the constructor uint256(const std::string &str) can result
* in dangerously catching uint256(0) via std::string(const char*).
*/
inline uint256 uint256S(const std::string& str)
{
uint256 rv;
rv.SetHex(str);
return rv;
}
#endif // BITCOIN_UINT256_H
|
/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "rpr220.h"
#include <upm_fti.h>
/**
* This file implements the Function Table Interface (FTI) for this sensor
*/
const char upm_rpr220_name[] = "RPR220";
const char upm_rpr220_description[] = "IR Reflective Sensor";
const upm_protocol_t upm_rpr220_protocol[] = {UPM_GPIO};
const upm_sensor_t upm_rpr220_category[] = {UPM_BINARY};
// forward declarations
const void* upm_rpr220_get_ft(upm_sensor_t sensor_type);
void* upm_rpr220_init_name();
void upm_rpr220_close(void *dev);
upm_result_t upm_rpr220_black_detected(void *dev, bool *value);
const upm_sensor_descriptor_t upm_rpr220_get_descriptor()
{
upm_sensor_descriptor_t usd;
usd.name = upm_rpr220_name;
usd.description = upm_rpr220_description;
usd.protocol_size = 1;
usd.protocol = upm_rpr220_protocol;
usd.category_size = 1;
usd.category = upm_rpr220_category;
return usd;
}
static const upm_sensor_ft ft =
{
.upm_sensor_init_name = upm_rpr220_init_name,
.upm_sensor_close = upm_rpr220_close,
};
static const upm_binary_ft bft =
{
.upm_binary_get_value = upm_rpr220_black_detected,
};
const void* upm_rpr220_get_ft(upm_sensor_t sensor_type)
{
switch(sensor_type)
{
case UPM_SENSOR:
return &ft;
case UPM_BINARY:
return &bft;
default:
return NULL;
}
}
void *upm_rpr220_init_name()
{
return NULL;
}
void upm_rpr220_close(void *dev)
{
rpr220_close((rpr220_context)dev);
}
upm_result_t upm_rpr220_black_detected(void *dev, bool *value)
{
*value = rpr220_black_detected((rpr220_context)dev);
return UPM_SUCCESS;
}
|
/*
* Exynos PLL helper functions for clock drivers.
* Copyright (C) 2016 Samsung Electronics
* Thomas Abraham <thomas.ab@samsung.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
unsigned long pll145x_get_rate(unsigned int *con1, unsigned long fin_freq);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.