text stringlengths 4 6.14k |
|---|
/* This testcase is part of GDB, the GNU debugger.
Copyright 2012-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
void
nodebug (void)
{
}
|
/*
* Copyright IBM Corporation, 2010
* Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef FS_9P_ACL_H
#define FS_9P_ACL_H
#ifdef CONFIG_9P_FS_POSIX_ACL
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, bool rcu);
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
extern int v9fs_set_create_acl(struct inode *, struct p9_fid *,
struct posix_acl *, struct posix_acl *);
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
struct posix_acl **dpacl, struct posix_acl **pacl);
extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
#else
#define v9fs_iop_get_acl NULL
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
{
return 0;
}
static inline int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid)
{
return 0;
}
static inline int v9fs_set_create_acl(struct inode *inode,
struct p9_fid *fid,
struct posix_acl *dacl,
struct posix_acl *acl)
{
return 0;
}
static inline void v9fs_put_acl(struct posix_acl *dacl,
struct posix_acl *acl)
{
}
static inline int v9fs_acl_mode(struct inode *dir, umode_t *modep,
struct posix_acl **dpacl,
struct posix_acl **pacl)
{
return 0;
}
#endif
#endif /* FS_9P_XATTR_H */
|
/*******************************************************************************
**NOTE** This code was generated by a tool and will occasionally be
overwritten. We welcome comments and issues regarding this code; they will be
addressed in the generation tool. If you wish to submit pull requests, please
do so for the templates in that tool.
This code was generated by Vipr (https://github.com/microsoft/vipr) using
the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter).
Copyright (c) Microsoft Corporation. All Rights Reserved.
Licensed under the Apache License 2.0; see LICENSE in the source repository
root for authoritative license information.
******************************************************************************/
#ifndef MSGRAPHSERVICETHUMBNAILSETFETCHER_H
#define MSGRAPHSERVICETHUMBNAILSETFETCHER_H
#import "MSGraphServiceModels.h"
#import "api/api.h"
#import "core/core.h"
#import "core/MSOrcEntityFetcher.h"
@class MSGraphServiceThumbnailFetcher;
@class MSGraphServiceThumbnailSetOperations;
/** MSGraphServiceThumbnailSetFetcher
*
*/
@interface MSGraphServiceThumbnailSetFetcher : MSOrcEntityFetcher
@property (copy, nonatomic, readonly) MSGraphServiceThumbnailSetOperations *operations;
- (instancetype)initWithUrl:(NSString*)urlComponent parent:(id<MSOrcExecutable>)parent;
- (void)readWithCallback:(void (^)(MSGraphServiceThumbnailSet *, MSOrcError *))callback;
- (void)update:(MSGraphServiceThumbnailSet *)thumbnailSet callback:(void (^)(MSGraphServiceThumbnailSet *, MSOrcError*))callback ;
- (void)delete:(void(^)(int status, MSOrcError *))callback;
- (MSGraphServiceThumbnailSetFetcher *)addCustomParametersWithName:(NSString *)name value:(id)value;
- (MSGraphServiceThumbnailSetFetcher *)addCustomHeaderWithName:(NSString *)name value:(NSString *)value;
- (MSGraphServiceThumbnailSetFetcher *)select:(NSString *)params;
- (MSGraphServiceThumbnailSetFetcher *)expand:(NSString *)value;
@end
#endif
|
#include "precomp.h"
UINT_32
p2pCalculate_IEForAssocReq(IN P_ADAPTER_T prAdapter,
IN UINT_8 ucBssIndex, IN P_STA_RECORD_T prStaRec)
{
P_P2P_ROLE_FSM_INFO_T prP2pRoleFsmInfo = (P_P2P_ROLE_FSM_INFO_T) NULL;
P_BSS_INFO_T prP2pBssInfo = (P_BSS_INFO_T) NULL;
P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T) NULL;
UINT_32 u4RetValue = 0;
do {
ASSERT_BREAK((prStaRec != NULL) && (prAdapter != NULL));
prP2pBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, ucBssIndex);
prP2pRoleFsmInfo =
P2P_ROLE_INDEX_2_ROLE_FSM_INFO(prAdapter, (UINT_8) prP2pBssInfo->u4PrivateData);
prConnReqInfo = &(prP2pRoleFsmInfo->rConnReqInfo);
u4RetValue = prConnReqInfo->u4BufLength;
/* ADD WMM Information Element */
u4RetValue += (ELEM_HDR_LEN + ELEM_MAX_LEN_WMM_INFO);
/* ADD HT Capability */
if ((prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11N) &&
(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11N)) {
u4RetValue += (ELEM_HDR_LEN + ELEM_MAX_LEN_HT_CAP);
}
#if CFG_SUPPORT_802_11AC
/* ADD VHT Capability */
if ((prAdapter->rWifiVar.ucAvailablePhyTypeSet & PHY_TYPE_SET_802_11AC) &&
(prStaRec->ucPhyTypeSet & PHY_TYPE_SET_802_11AC)) {
u4RetValue += (ELEM_HDR_LEN + ELEM_MAX_LEN_VHT_CAP);
}
#endif
} while (FALSE);
return u4RetValue;
} /* p2pCalculate_IEForAssocReq */
/*----------------------------------------------------------------------------*/
/*!
* @brief This function is used to generate P2P IE for Beacon frame.
*
* @param[in] prMsduInfo Pointer to the composed MSDU_INFO_T.
*
* @return none
*/
/*----------------------------------------------------------------------------*/
VOID p2pGenerate_IEForAssocReq(IN P_ADAPTER_T prAdapter, IN P_MSDU_INFO_T prMsduInfo)
{
P_BSS_INFO_T prBssInfo = (P_BSS_INFO_T) NULL;
P_P2P_ROLE_FSM_INFO_T prP2pRoleFsmInfo = (P_P2P_ROLE_FSM_INFO_T) NULL;
P_P2P_CONNECTION_REQ_INFO_T prConnReqInfo = (P_P2P_CONNECTION_REQ_INFO_T) NULL;
PUINT_8 pucIEBuf = (PUINT_8) NULL;
do {
ASSERT_BREAK((prAdapter != NULL) && (prMsduInfo != NULL));
prBssInfo = GET_BSS_INFO_BY_INDEX(prAdapter, prMsduInfo->ucBssIndex);
prP2pRoleFsmInfo =
P2P_ROLE_INDEX_2_ROLE_FSM_INFO(prAdapter, (UINT_8) prBssInfo->u4PrivateData);
prConnReqInfo = &(prP2pRoleFsmInfo->rConnReqInfo);
pucIEBuf =
(PUINT_8) ((UINT_32) prMsduInfo->prPacket +
(UINT_32) prMsduInfo->u2FrameLength);
kalMemCopy(pucIEBuf, prConnReqInfo->aucIEBuf, prConnReqInfo->u4BufLength);
prMsduInfo->u2FrameLength += prConnReqInfo->u4BufLength;
/* Add WMM IE */
mqmGenerateWmmInfoIE(prAdapter, prMsduInfo);
/* Add HT IE */
rlmReqGenerateHtCapIE(prAdapter, prMsduInfo);
#if CFG_SUPPORT_802_11AC
/* Add VHT IE */
rlmReqGenerateVhtCapIE(prAdapter, prMsduInfo);
#endif
} while (FALSE);
return;
} /* p2pGenerate_IEForAssocReq */
|
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* linux/drivers/mmc/core/bus.h
*
* Copyright (C) 2003 Russell King, All Rights Reserved.
* Copyright 2007 Pierre Ossman
*/
#ifndef _MMC_CORE_BUS_H
#define _MMC_CORE_BUS_H
#include <linux/device.h>
struct mmc_host;
struct mmc_card;
#define MMC_DEV_ATTR(name, fmt, args...) \
static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
{ \
struct mmc_card *card = mmc_dev_to_card(dev); \
return sprintf(buf, fmt, args); \
} \
static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
struct mmc_card *mmc_alloc_card(struct mmc_host *host,
struct device_type *type);
int mmc_add_card(struct mmc_card *card);
void mmc_remove_card(struct mmc_card *card);
int mmc_register_bus(void);
void mmc_unregister_bus(void);
struct mmc_driver {
struct device_driver drv;
int (*probe)(struct mmc_card *card);
void (*remove)(struct mmc_card *card);
void (*shutdown)(struct mmc_card *card);
};
int mmc_register_driver(struct mmc_driver *drv);
void mmc_unregister_driver(struct mmc_driver *drv);
#endif
|
/*!
* @section LICENSE
* $license$
*
* @filename $filename$
* @date $date$
* @id $id$
*
* @brief
* This file implements moudle function, which add
* the driver to SPI core.
*/
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/delay.h>
#include "bmp280_core.h"
#include "bs_log.h"
/*! @defgroup bmp280_spi_src
* @brief bmp280 spi driver module
@{*/
/*! the maximum of retry during SPI transfer */
#define BMP_MAX_RETRY_SPI_XFER 10
/*! delay time between two error transfers */
#define BMP_SPI_WRITE_DELAY_TIME 1
static struct spi_device *bmp_spi_client;
/*!
* @brief define spi wirte function
*
* @param dev_addr sensor device address
* @param reg_addr register address
* @param data the pointer of data buffer
* @param len block size need to write
*
* @return zero success, non-zero failed
* @retval zero success
* @retval non-zero failed
*/
static char bmp_spi_write_block(u8 dev_addr, u8 reg_addr, u8 *data, u8 len)
{
struct spi_device *client = bmp_spi_client;
u8 buffer[2];
u8 retry;
while (0 != len--) {
buffer[0] = reg_addr;
buffer[1] = *data;
for (retry = 0; retry < BMP_MAX_RETRY_SPI_XFER; retry++) {
if (spi_write(client, buffer, 2) >= 0)
break;
else
mdelay(BMP_SPI_WRITE_DELAY_TIME);
}
if (BMP_MAX_RETRY_SPI_XFER <= retry) {
PERR("SPI xfer error");
return -EIO;
}
reg_addr++;
data++;
}
return 0;
}
/*!
* @brief define spi read function
*
* @param dev_addr sensor device address
* @param reg_addr register address
* @param data the pointer of data buffer
* @param len block size need to read
*
* @return zero success, non-zero failed
* @retval zero success
* @retval non-zero failed
*/
static char bmp_spi_read_block(u8 dev_addr, u8 reg_addr, u8 *data, u8 len)
{
struct spi_device *client = bmp_spi_client;
u8 buffer[2] = {reg_addr, 0};
int status = spi_write(client, buffer, 2);
if (status < 0)
return status;
return spi_read(client, data, len);
}
/*!
* @brief spi bus operation
*/
static const struct bmp_bus_ops bmp_spi_bus_ops = {
/**< spi block write pointer */
.bus_write = bmp_spi_write_block,
/**< spi block read pointer */
.bus_read = bmp_spi_read_block
};
/*!
* @brief BMP probe function via spi bus
*
* @param client the pointer of spi client
*
* @return zero success, non-zero failed
* @retval zero success
* @retval non-zero failed
*/
static int __devinit bmp_spi_probe(struct spi_device *client)
{
int status;
struct bmp_data_bus data_bus = {
.bops = &bmp_spi_bus_ops,
.client = client
};
if (NULL == bmp_spi_client)
bmp_spi_client = client;
else{
PERR("This driver does not support multiple clients!\n");
return -EINVAL;
}
client->bits_per_word = 8;
status = spi_setup(client);
if (status < 0) {
PERR("spi_setup failed!\n");
return status;
}
return bmp_probe(&client->dev, &data_bus);
}
/*!
* @brief shutdown bmp device in spi driver
*
* @param client the pointer of spi client
*
* @return no return value
*/
static void bmp_spi_shutdown(struct spi_device *client)
{
#ifdef CONFIG_PM
bmp_disable(&client->dev);
#endif
}
/*!
* @brief remove bmp spi client
*
* @param client the pointer of spi client
*
* @return zero
* @retval zero
*/
static int bmp_spi_remove(struct spi_device *client)
{
return bmp_remove(&client->dev);
}
#ifdef CONFIG_PM
/*!
* @brief suspend bmp device in spi driver
*
* @param dev the pointer of device
*
* @return zero
* @retval zero
*/
static int bmp_spi_suspend(struct device *dev)
{
return bmp_disable(dev);
}
/*!
* @brief resume bmp device in spi driver
*
* @param dev the pointer of device
*
* @return zero
* @retval zero
*/
static int bmp_spi_resume(struct device *dev)
{
return bmp_enable(dev);
}
/*!
* @brief register spi device power manager hooks
*/
static const struct dev_pm_ops bmp_spi_pm_ops = {
/**< device suspend */
.suspend = bmp_spi_suspend,
/**< device resume */
.resume = bmp_spi_resume
};
#endif
/*!
* @brief register spi device id
*/
static const struct spi_device_id bmp_id[] = {
{ BMP_NAME, 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, bmp_id);
/*!
* @brief register spi driver hooks
*/
static struct spi_driver bmp_spi_driver = {
.driver = {
.owner = THIS_MODULE,
.name = BMP_NAME,
#ifdef CONFIG_PM
.pm = &bmp_spi_pm_ops,
#endif
},
.id_table = bmp_id,
.probe = bmp_spi_probe,
.shutdown = bmp_spi_shutdown,
.remove = __devexit_p(bmp_spi_remove)
};
/*!
* @brief initialize bmp spi module
*
* @return zero success, non-zero failed
* @retval zero success
* @retval non-zero failed
*/
static int __init bmp_spi_init(void)
{
return spi_register_driver(&bmp_spi_driver);
}
/*!
* @brief remove bmp spi module
*
* @return no return value
*/
static void __exit bmp_spi_exit(void)
{
spi_unregister_driver(&bmp_spi_driver);
}
MODULE_DESCRIPTION("BMP280 SPI BUS DRIVER");
MODULE_LICENSE("GPL");
module_init(bmp_spi_init);
module_exit(bmp_spi_exit);
/*@}*/
|
/* libunwind - a platform-independent unwind library
Copyright (C) 2006-2007 IBM
Contributed by
Corey Ashford <cjashfor@us.ibm.com>
Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "unwind_i.h"
int
tdep_get_func_addr (unw_addr_space_t as, unw_word_t symbol_val_addr,
unw_word_t *real_func_addr)
{
*real_func_addr = symbol_val_addr;
return 0;
}
|
#pragma once
#ifdef KEYBOARD_keebio_bdn9_rev1
#include "rev1.h"
#elif KEYBOARD_keebio_bdn9_rev2
#include "rev2.h"
#endif
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* (C) 2013 Astaro GmbH & Co KG
*/
#include <linux/module.h>
#include <linux/skbuff.h>
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_ecache.h>
#include <net/netfilter/nf_conntrack_labels.h>
#include <linux/netfilter/x_tables.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Florian Westphal <fw@strlen.de>");
MODULE_DESCRIPTION("Xtables: add/match connection tracking labels");
MODULE_ALIAS("ipt_connlabel");
MODULE_ALIAS("ip6t_connlabel");
static bool
connlabel_mt(const struct sk_buff *skb, struct xt_action_param *par)
{
const struct xt_connlabel_mtinfo *info = par->matchinfo;
enum ip_conntrack_info ctinfo;
struct nf_conn_labels *labels;
struct nf_conn *ct;
bool invert = info->options & XT_CONNLABEL_OP_INVERT;
ct = nf_ct_get(skb, &ctinfo);
if (ct == NULL)
return invert;
labels = nf_ct_labels_find(ct);
if (!labels)
return invert;
if (test_bit(info->bit, labels->bits))
return !invert;
if (info->options & XT_CONNLABEL_OP_SET) {
if (!test_and_set_bit(info->bit, labels->bits))
nf_conntrack_event_cache(IPCT_LABEL, ct);
return !invert;
}
return invert;
}
static int connlabel_mt_check(const struct xt_mtchk_param *par)
{
const int options = XT_CONNLABEL_OP_INVERT |
XT_CONNLABEL_OP_SET;
struct xt_connlabel_mtinfo *info = par->matchinfo;
int ret;
if (info->options & ~options) {
pr_info_ratelimited("Unknown options in mask %x\n",
info->options);
return -EINVAL;
}
ret = nf_ct_netns_get(par->net, par->family);
if (ret < 0) {
pr_info_ratelimited("cannot load conntrack support for proto=%u\n",
par->family);
return ret;
}
ret = nf_connlabels_get(par->net, info->bit);
if (ret < 0)
nf_ct_netns_put(par->net, par->family);
return ret;
}
static void connlabel_mt_destroy(const struct xt_mtdtor_param *par)
{
nf_connlabels_put(par->net);
nf_ct_netns_put(par->net, par->family);
}
static struct xt_match connlabels_mt_reg __read_mostly = {
.name = "connlabel",
.family = NFPROTO_UNSPEC,
.checkentry = connlabel_mt_check,
.match = connlabel_mt,
.matchsize = sizeof(struct xt_connlabel_mtinfo),
.destroy = connlabel_mt_destroy,
.me = THIS_MODULE,
};
static int __init connlabel_mt_init(void)
{
return xt_register_match(&connlabels_mt_reg);
}
static void __exit connlabel_mt_exit(void)
{
xt_unregister_match(&connlabels_mt_reg);
}
module_init(connlabel_mt_init);
module_exit(connlabel_mt_exit);
|
/**
* dwc3-pci.c - PCI Specific glue layer
*
* Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
*
* Authors: Felipe Balbi <balbi@ti.com>,
* Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/usb/otg.h>
#include <linux/usb/usb_phy_gen_xceiv.h>
/* FIXME define these in <linux/pci_ids.h> */
#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
#define PCI_DEVICE_ID_INTEL_BYT 0x0f37
#define PCI_DEVICE_ID_INTEL_MRFLD 0x119e
struct dwc3_pci {
struct device *dev;
struct platform_device *dwc3;
struct platform_device *usb2_phy;
struct platform_device *usb3_phy;
};
static int dwc3_pci_register_phys(struct dwc3_pci *glue)
{
struct usb_phy_gen_xceiv_platform_data pdata;
struct platform_device *pdev;
int ret;
memset(&pdata, 0x00, sizeof(pdata));
pdev = platform_device_alloc("usb_phy_gen_xceiv", 0);
if (!pdev)
return -ENOMEM;
glue->usb2_phy = pdev;
pdata.type = USB_PHY_TYPE_USB2;
ret = platform_device_add_data(glue->usb2_phy, &pdata, sizeof(pdata));
if (ret)
goto err1;
pdev = platform_device_alloc("usb_phy_gen_xceiv", 1);
if (!pdev) {
ret = -ENOMEM;
goto err1;
}
glue->usb3_phy = pdev;
pdata.type = USB_PHY_TYPE_USB3;
ret = platform_device_add_data(glue->usb3_phy, &pdata, sizeof(pdata));
if (ret)
goto err2;
ret = platform_device_add(glue->usb2_phy);
if (ret)
goto err2;
ret = platform_device_add(glue->usb3_phy);
if (ret)
goto err3;
return 0;
err3:
platform_device_del(glue->usb2_phy);
err2:
platform_device_put(glue->usb3_phy);
err1:
platform_device_put(glue->usb2_phy);
return ret;
}
static int dwc3_pci_probe(struct pci_dev *pci,
const struct pci_device_id *id)
{
struct resource res[2];
struct platform_device *dwc3;
struct dwc3_pci *glue;
int ret = -ENOMEM;
struct device *dev = &pci->dev;
glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(dev, "not enough memory\n");
return -ENOMEM;
}
glue->dev = dev;
ret = pci_enable_device(pci);
if (ret) {
dev_err(dev, "failed to enable pci device\n");
return -ENODEV;
}
pci_set_master(pci);
ret = dwc3_pci_register_phys(glue);
if (ret) {
dev_err(dev, "couldn't register PHYs\n");
return ret;
}
dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
if (!dwc3) {
dev_err(dev, "couldn't allocate dwc3 device\n");
ret = -ENOMEM;
goto err1;
}
memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
res[0].start = pci_resource_start(pci, 0);
res[0].end = pci_resource_end(pci, 0);
res[0].name = "dwc_usb3";
res[0].flags = IORESOURCE_MEM;
res[1].start = pci->irq;
res[1].name = "dwc_usb3";
res[1].flags = IORESOURCE_IRQ;
ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
if (ret) {
dev_err(dev, "couldn't add resources to dwc3 device\n");
goto err1;
}
pci_set_drvdata(pci, glue);
dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask);
dwc3->dev.dma_mask = dev->dma_mask;
dwc3->dev.dma_parms = dev->dma_parms;
dwc3->dev.parent = dev;
glue->dwc3 = dwc3;
ret = platform_device_add(dwc3);
if (ret) {
dev_err(dev, "failed to register dwc3 device\n");
goto err3;
}
return 0;
err3:
platform_device_put(dwc3);
err1:
pci_disable_device(pci);
return ret;
}
static void dwc3_pci_remove(struct pci_dev *pci)
{
struct dwc3_pci *glue = pci_get_drvdata(pci);
platform_device_unregister(glue->dwc3);
platform_device_unregister(glue->usb2_phy);
platform_device_unregister(glue->usb3_phy);
pci_disable_device(pci);
}
static DEFINE_PCI_DEVICE_TABLE(dwc3_pci_id_table) = {
{
PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS,
PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3),
},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), },
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), },
{ } /* Terminating Entry */
};
MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);
#ifdef CONFIG_PM_SLEEP
static int dwc3_pci_suspend(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
pci_disable_device(pci);
return 0;
}
static int dwc3_pci_resume(struct device *dev)
{
struct pci_dev *pci = to_pci_dev(dev);
int ret;
ret = pci_enable_device(pci);
if (ret) {
dev_err(dev, "can't re-enable device --> %d\n", ret);
return ret;
}
pci_set_master(pci);
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static const struct dev_pm_ops dwc3_pci_dev_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume)
};
static struct pci_driver dwc3_pci_driver = {
.name = "dwc3-pci",
.id_table = dwc3_pci_id_table,
.probe = dwc3_pci_probe,
.remove = dwc3_pci_remove,
.driver = {
.pm = &dwc3_pci_dev_pm_ops,
},
};
MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("DesignWare USB3 PCI Glue Layer");
module_pci_driver(dwc3_pci_driver);
|
/* *********************************************************************
* Broadcom Common Firmware Environment (CFE)
*
* BSP Configuration file File: bsp_config.h
*
* This module contains global parameters and conditional
* compilation settings for building CFE.
*
* Author: Mitch Lichtenberg (mpl@broadcom.com)
*
*********************************************************************
*
* Copyright 2000,2001,2002,2003
* Broadcom Corporation. All rights reserved.
*
* This software is furnished under license and may be used and
* copied only in accordance with the following terms and
* conditions. Subject to these conditions, you may download,
* copy, install, use, modify and distribute modified or unmodified
* copies of this software in source and/or binary form. No title
* or ownership is transferred hereby.
*
* 1) Any source code used, modified or distributed must reproduce
* and retain this copyright notice and list of conditions
* as they appear in the source file.
*
* 2) No right is granted to use any trade name, trademark, or
* logo of Broadcom Corporation. The "Broadcom Corporation"
* name may not be used to endorse or promote products derived
* from this software without the prior written permission of
* Broadcom Corporation.
*
* 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
* SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
* PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR 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), EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************* */
#define CFG_INIT_L1 1 /* initialize the L1 cache */
#define CFG_INIT_L2 1 /* initialize the L2 cache */
#define CFG_INIT_DRAM 1 /* initialize DRAM controller */
#define CFG_DRAM_SIZE xxx /* size of DRAM if you don't initialize */
#define CFG_NETWORK 1 /* define to include network support */
#define CFG_FATFS 1
#define CFG_UI 1 /* Define to enable user interface */
#define CFG_MULTI_CPUS 0 /* BCM11xx has only one CPU */
#define CFG_HEAP_SIZE 1024 /* heap size in kilobytes */
#define CFG_STACK_SIZE 8192 /* stack size (bytes, rounded up to K) */
/*
* These parameters control the flash driver's sector buffer.
* If you write environment variables or make small changes to
* flash sectors from user applications, you
* need to have the heap big enough to store a temporary sector
* for merging in small changes to flash sectors, so you
* should set CFG_FLASH_ALLOC_SECTOR_BUFFER in that case.
* Otherwise, you can provide an address in unallocated memory
* of where to place the sector buffer.
*/
#define CFG_FLASH_ALLOC_SECTOR_BUFFER 0 /* '1' to allocate sector buffer from the heap */
#define CFG_FLASH_SECTOR_BUFFER_ADDR (100*1024*1024-128*1024) /* 100MB - 128K */
#define CFG_FLASH_SECTOR_BUFFER_SIZE (128*1024)
/*
* The flash staging buffer is where we store a flash image before we write
* it to the flash. It's too big for the heap.
*/
#define CFG_FLASH_STAGING_BUFFER_ADDR (100*1024*1024)
#define CFG_FLASH_STAGING_BUFFER_SIZE (4*1024*1024)
/*
* These parameters control the default DRAM init table
* inside of sb1250_draminit.c.
*/
#define CFG_DRAM_INTERLEAVE 0 /* Can't interleave channels, there is only one */
#ifndef CFG_DRAM_ECC
#define CFG_DRAM_ECC 1 /* Turn on to enable ECC */
#endif
#define CFG_DRAM_BLOCK_SIZE 32 /* don't interleave columns */
#define CFG_DRAM_CSINTERLEAVE 2 /* Use 0,1, or 2. Max number of address
bits allowed for chip select
interleaving. Only matching dimms
will be interleaved. 3 outcomes:
no interleaving, interleave CS 0 &
1, and interleave CS 0,1,2 & 3. */
#define CFG_SERIAL_BAUD_RATE 115200 /* normal console speed */
#define CFG_VENDOR_EXTENSIONS 0
/*
* Include board-specific stuff
*/
#include "bcm91120c.h"
|
#ifndef __PIPE__
#define __PIPE__
#define LOCALMSGSZ (8*1024)
#define SHMEMMSGSZ (30*1024)
#define MAX_PIPES 30
#define MAX_EVENTS 30
#define MAX_LOCKS 256
typedef struct _message_item {
char *message;
float8 timestamp;
struct _message_item *next_message;
struct _message_item *prev_message;
unsigned char message_id;
int *receivers; /* copy of array all registered receivers */
int receivers_number;
} message_item;
typedef struct _message_echo {
struct _message_item *message;
unsigned char message_id;
struct _message_echo *next_echo;
} message_echo;
typedef struct {
char *event_name;
unsigned char max_receivers;
int *receivers;
int receivers_number;
struct _message_item *messages;
} alert_event;
typedef struct {
unsigned int sid;
message_echo *echo;
} alert_lock;
bool ora_lock_shmem(size_t size, int max_pipes, int max_events, int max_locks, bool reset);
#define ERRCODE_ORA_PACKAGES_LOCK_REQUEST_ERROR MAKE_SQLSTATE('3','0', '0','0','1')
#define LOCK_ERROR() \
ereport(ERROR, \
(errcode(ERRCODE_ORA_PACKAGES_LOCK_REQUEST_ERROR), \
errmsg("lock request error"), \
errdetail("Failed exclusive locking of shared memory."), \
errhint("Restart PostgreSQL server.")));
#endif
|
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* spu_save.c
*
* (C) Copyright IBM Corp. 2005
*
* SPU-side context save sequence outlined in
* Synergistic Processor Element Book IV
*
* Author: Mark Nutter <mnutter@us.ibm.com>
*/
#ifndef LS_SIZE
#define LS_SIZE 0x40000 /* 256K (in bytes) */
#endif
typedef unsigned int u32;
typedef unsigned long long u64;
#include <spu_intrinsics.h>
#include <asm/spu_csa.h>
#include "spu_utils.h"
static inline void save_event_mask(void)
{
unsigned int offset;
/* Save, Step 2:
* Read the SPU_RdEventMsk channel and save to the LSCSA.
*/
offset = LSCSA_QW_OFFSET(event_mask);
regs_spill[offset].slot[0] = spu_readch(SPU_RdEventMask);
}
static inline void save_tag_mask(void)
{
unsigned int offset;
/* Save, Step 3:
* Read the SPU_RdTagMsk channel and save to the LSCSA.
*/
offset = LSCSA_QW_OFFSET(tag_mask);
regs_spill[offset].slot[0] = spu_readch(MFC_RdTagMask);
}
static inline void save_upper_240kb(addr64 lscsa_ea)
{
unsigned int ls = 16384;
unsigned int list = (unsigned int)&dma_list[0];
unsigned int size = sizeof(dma_list);
unsigned int tag_id = 0;
unsigned int cmd = 0x24; /* PUTL */
/* Save, Step 7:
* Enqueue the PUTL command (tag 0) to the MFC SPU command
* queue to transfer the remaining 240 kb of LS to CSA.
*/
spu_writech(MFC_LSA, ls);
spu_writech(MFC_EAH, lscsa_ea.ui[0]);
spu_writech(MFC_EAL, list);
spu_writech(MFC_Size, size);
spu_writech(MFC_TagID, tag_id);
spu_writech(MFC_Cmd, cmd);
}
static inline void save_fpcr(void)
{
// vector unsigned int fpcr;
unsigned int offset;
/* Save, Step 9:
* Issue the floating-point status and control register
* read instruction, and save to the LSCSA.
*/
offset = LSCSA_QW_OFFSET(fpcr);
regs_spill[offset].v = spu_mffpscr();
}
static inline void save_decr(void)
{
unsigned int offset;
/* Save, Step 10:
* Read and save the SPU_RdDec channel data to
* the LSCSA.
*/
offset = LSCSA_QW_OFFSET(decr);
regs_spill[offset].slot[0] = spu_readch(SPU_RdDec);
}
static inline void save_srr0(void)
{
unsigned int offset;
/* Save, Step 11:
* Read and save the SPU_WSRR0 channel data to
* the LSCSA.
*/
offset = LSCSA_QW_OFFSET(srr0);
regs_spill[offset].slot[0] = spu_readch(SPU_RdSRR0);
}
static inline void spill_regs_to_mem(addr64 lscsa_ea)
{
unsigned int ls = (unsigned int)®s_spill[0];
unsigned int size = sizeof(regs_spill);
unsigned int tag_id = 0;
unsigned int cmd = 0x20; /* PUT */
/* Save, Step 13:
* Enqueue a PUT command (tag 0) to send the LSCSA
* to the CSA.
*/
spu_writech(MFC_LSA, ls);
spu_writech(MFC_EAH, lscsa_ea.ui[0]);
spu_writech(MFC_EAL, lscsa_ea.ui[1]);
spu_writech(MFC_Size, size);
spu_writech(MFC_TagID, tag_id);
spu_writech(MFC_Cmd, cmd);
}
static inline void enqueue_sync(addr64 lscsa_ea)
{
unsigned int tag_id = 0;
unsigned int cmd = 0xCC;
/* Save, Step 14:
* Enqueue an MFC_SYNC command (tag 0).
*/
spu_writech(MFC_TagID, tag_id);
spu_writech(MFC_Cmd, cmd);
}
static inline void save_complete(void)
{
/* Save, Step 18:
* Issue a stop-and-signal instruction indicating
* "save complete". Note: This function will not
* return!!
*/
spu_stop(SPU_SAVE_COMPLETE);
}
/**
* main - entry point for SPU-side context save.
*
* This code deviates from the documented sequence as follows:
*
* 1. The EA for LSCSA is passed from PPE in the
* signal notification channels.
* 2. All 128 registers are saved by crt0.o.
*/
int main()
{
addr64 lscsa_ea;
lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1);
lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2);
/* Step 1: done by exit(). */
save_event_mask(); /* Step 2. */
save_tag_mask(); /* Step 3. */
set_event_mask(); /* Step 4. */
set_tag_mask(); /* Step 5. */
build_dma_list(lscsa_ea); /* Step 6. */
save_upper_240kb(lscsa_ea); /* Step 7. */
/* Step 8: done by exit(). */
save_fpcr(); /* Step 9. */
save_decr(); /* Step 10. */
save_srr0(); /* Step 11. */
enqueue_putllc(lscsa_ea); /* Step 12. */
spill_regs_to_mem(lscsa_ea); /* Step 13. */
enqueue_sync(lscsa_ea); /* Step 14. */
set_tag_update(); /* Step 15. */
read_tag_status(); /* Step 16. */
read_llar_status(); /* Step 17. */
save_complete(); /* Step 18. */
return 0;
}
|
/* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 15. February 2012
* $Revision: V1.1.0
*
* Project: CMSIS DSP Library
* Title: arm_mat_init_q15.c
*
* Description: Q15 matrix initialization.
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Version 1.1.0 2012/02/15
* Updated with more optimizations, bug fixes and minor API changes.
*
* Version 1.0.10 2011/7/15
* Big Endian support added and Merged M0 and M3/M4 Source code.
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.2 2010/11/11
* Documentation updated.
*
* Version 1.0.1 2010/10/05
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20
* Production release and review comments incorporated.
*
* Version 0.0.5 2010/04/26
* incorporated review comments and updated with latest CMSIS layer
*
* Version 0.0.3 2010/03/10
* Initial version
* -------------------------------------------------------------------------- */
#include "arm_math.h"
/**
* @ingroup groupMatrix
*/
/**
* @addtogroup MatrixInit
* @{
*/
/**
* @brief Q15 matrix initialization.
* @param[in,out] *S points to an instance of the floating-point matrix structure.
* @param[in] nRows number of rows in the matrix.
* @param[in] nColumns number of columns in the matrix.
* @param[in] *pData points to the matrix data array.
* @return none
*/
void arm_mat_init_q15(
arm_matrix_instance_q15 * S,
uint16_t nRows,
uint16_t nColumns,
q15_t * pData)
{
/* Assign Number of Rows */
S->numRows = nRows;
/* Assign Number of Columns */
S->numCols = nColumns;
/* Assign Data pointer */
S->pData = pData;
}
/**
* @} end of MatrixInit group
*/
|
/*
* gatemp.h
*
* Definitions of gatemp support proxies
*
* Copyright (C) 2008-2009 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE.
*/
#ifndef _GATEMPDEFS_H_
#define _GATEMPDEFS_H_
/* Utilities headers */
#include <gatepeterson.h>
#include <gatehwspinlock.h>
/* Enable once ported - GateMPSupportNull may not be needed
#include <_GateMPSupportNull.h>
#include <GateMPSupportNull.h>
*/
#if 1 /* Enable when SpinLock is available */
#define gatemp_remote_system_proxy_params_init gatehwspinlock_params_init
#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
#define gatemp_remote_system_proxy_create gatehwspinlock_create
#define gatemp_remote_custom1_proxy_create gatepeterson_create
#define gatemp_remote_custom2_proxy_create gatepeterson_create
#define gatemp_remote_system_proxy_delete gatehwspinlock_delete
#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
#define gatemp_remote_system_proxy_params struct gatehwspinlock_params
#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
#define gatemp_remote_system_proxy_shared_mem_req \
gatehwspinlock_shared_mem_req
#define gatemp_remote_custom1_proxy_shared_mem_req \
gatepeterson_shared_mem_req
#define gatemp_remote_custom2_proxy_shared_mem_req \
gatepeterson_shared_mem_req
#define gatemp_remote_system_proxy_get_num_instances \
gatehwspinlock_get_num_instances
#define gatemp_remote_custom1_proxy_get_num_instances \
gatepeterson_get_num_instances
#define gatemp_remote_custom2_proxy_get_num_instances \
gatepeterson_get_num_instances
#define gatemp_remote_system_proxy_get_num_reserved \
gatehwspinlock_get_num_reserved
#define gatemp_remote_custom1_proxy_get_num_reserved \
gatepeterson_get_num_reserved
#define gatemp_remote_custom2_proxy_get_num_reserved \
gatepeterson_get_num_reserved
#define gatemp_remote_system_proxy_locks_init gatehwspinlock_locks_init
#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
#define gatemp_remote_system_proxy_handle void *
#define gatemp_remote_custom1_proxy_handle void *
#define gatemp_remote_custom2_proxy_handle void *
#define gatemp_remote_system_proxy_open_by_addr gatehwspinlock_open_by_addr
#define gatemp_remote_custom1_proxy_open_by_addr \
gatepeterson_open_by_addr
#define gatemp_remote_custom2_proxy_open_by_addr \
gatepeterson_open_by_addr
#define gatemp_remote_system_proxy_enter gatehwspinlock_enter
#define gatemp_remote_system_proxy_leave gatehwspinlock_leave
#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
#else
#define gatemp_remote_system_proxy_params_init gatepeterson_params_init
#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
#define gatemp_remote_system_proxy_create gatepeterson_create
#define gatemp_remote_custom1_proxy_create gatepeterson_create
#define gatemp_remote_custom2_proxy_create gatepeterson_create
#define gatemp_remote_system_proxy_delete gatepeterson_delete
#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
#define gatemp_remote_system_proxy_params struct gatepeterson_params
#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
#define gatemp_remote_system_proxy_shared_mem_req \
gatepeterson_shared_mem_req
#define gatemp_remote_custom1_proxy_shared_mem_req \
gatepeterson_shared_mem_req
#define gatemp_remote_custom2_proxy_shared_mem_req \
gatepeterson_shared_mem_req
#define gatemp_remote_system_proxy_get_num_instances \
gatepeterson_get_num_instances
#define gatemp_remote_custom1_proxy_get_num_instances \
gatepeterson_get_num_instances
#define gatemp_remote_custom2_proxy_get_num_instances \
gatepeterson_get_num_instances
#define gatemp_remote_system_proxy_get_num_reserved \
gatepeterson_get_num_reserved
#define gatemp_remote_custom1_proxy_get_num_reserved \
gatepeterson_get_num_reserved
#define gatemp_remote_custom2_proxy_get_num_reserved \
gatepeterson_get_num_reserved
#define gatemp_remote_system_proxy_locks_init gatepeterson_locks_init
#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
#define gatemp_remote_system_proxy_handle void *
#define gatemp_remote_custom1_proxy_handle void *
#define gatemp_remote_custom2_proxy_handle void *
#define gatemp_remote_system_proxy_open_by_addr gatepeterson_open_by_addr
#define gatemp_remote_custom1_proxy_open_by_addr \
gatepeterson_open_by_addr
#define gatemp_remote_custom2_proxy_open_by_addr \
gatepeterson_open_by_addr
#define gatemp_remote_system_proxy_enter gatepeterson_enter
#define gatemp_remote_system_proxy_leave gatepeterson_leave
#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
#endif
#endif /* _GATEMPDEFS_H_ */
|
// AFPropertyListRequestOperation.h
//
// Copyright (c) 2011 Gowalla (http://gowalla.com/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "AFHTTPRequestOperation.h"
/**
`AFPropertyListRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and deserializing objects with property list (plist) response data.
## Acceptable Content Types
By default, `AFPropertyListRequestOperation` accepts the following MIME types:
- `application/x-plist`
*/
@interface AFPropertyListRequestOperation : AFHTTPRequestOperation
///----------------------------
/// @name Getting Response Data
///----------------------------
/**
An object deserialized from a plist constructed using the response data.
*/
@property (readonly, nonatomic) id responsePropertyList;
///--------------------------------------
/// @name Managing Property List Behavior
///--------------------------------------
/**
One of the `NSPropertyListMutabilityOptions` options, specifying the mutability of objects deserialized from the property list. By default, this is `NSPropertyListImmutable`.
*/
@property (nonatomic, assign) NSPropertyListReadOptions propertyListReadOptions;
/**
Creates and returns an `AFPropertyListRequestOperation` object and sets the specified success and failure callbacks.
@param urlRequest The request object to be loaded asynchronously during execution of the operation
@param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the object deserialized from a plist constructed using the response data.
@param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while deserializing the object from a property list. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred.
@return A new property list request operation
*/
+ (instancetype)propertyListRequestOperationWithRequest:(NSURLRequest *)urlRequest
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList))failure;
@end
|
#ifndef HINGE_JOINT_SW_H
#define HINGE_JOINT_SW_H
#include "servers/physics/joints_sw.h"
#include "servers/physics/joints/jacobian_entry_sw.h"
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
class HingeJointSW : public JointSW {
union {
struct {
BodySW *A;
BodySW *B;
};
BodySW *_arr[2];
};
JacobianEntrySW m_jac[3]; //3 orthogonal linear constraints
JacobianEntrySW m_jacAng[3]; //2 orthogonal angular constraints+ 1 for limit/motor
Transform m_rbAFrame; // constraint axii. Assumes z is hinge axis.
Transform m_rbBFrame;
real_t m_motorTargetVelocity;
real_t m_maxMotorImpulse;
real_t m_limitSoftness;
real_t m_biasFactor;
real_t m_relaxationFactor;
real_t m_lowerLimit;
real_t m_upperLimit;
real_t m_kHinge;
real_t m_limitSign;
real_t m_correction;
real_t m_accLimitImpulse;
real_t tau;
bool m_useLimit;
bool m_angularOnly;
bool m_enableAngularMotor;
bool m_solveLimit;
real_t m_appliedImpulse;
public:
virtual PhysicsServer::JointType get_type() const { return PhysicsServer::JOINT_HINGE; }
virtual bool setup(float p_step);
virtual void solve(float p_step);
real_t get_hinge_angle();
void set_param(PhysicsServer::HingeJointParam p_param, float p_value);
float get_param(PhysicsServer::HingeJointParam p_param) const;
void set_flag(PhysicsServer::HingeJointFlag p_flag, bool p_value);
bool get_flag(PhysicsServer::HingeJointFlag p_flag) const;
HingeJointSW(BodySW* rbA,BodySW* rbB, const Transform& frameA, const Transform& frameB);
HingeJointSW(BodySW* rbA,BodySW* rbB, const Vector3& pivotInA,const Vector3& pivotInB, const Vector3& axisInA,const Vector3& axisInB);
};
#endif // HINGE_JOINT_SW_H
|
/*
* include/asm-xtensa/tlbflush.h
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2001 - 2005 Tensilica Inc.
*/
#ifndef _XTENSA_TLBFLUSH_H
#define _XTENSA_TLBFLUSH_H
#ifdef __KERNEL__
#include <linux/stringify.h>
#include <asm/processor.h>
#define DTLB_WAY_PGD 7
#define ITLB_ARF_WAYS 4
#define DTLB_ARF_WAYS 4
#define ITLB_HIT_BIT 3
#define DTLB_HIT_BIT 4
#ifndef __ASSEMBLY__
/* TLB flushing:
*
* - flush_tlb_all() flushes all processes TLB entries
* - flush_tlb_mm(mm) flushes the specified mm context TLB entries
* - flush_tlb_page(mm, vmaddr) flushes a single page
* - flush_tlb_range(mm, start, end) flushes a range of pages
*/
extern void flush_tlb_all(void);
extern void flush_tlb_mm(struct mm_struct*);
extern void flush_tlb_page(struct vm_area_struct*,unsigned long);
extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long);
#define flush_tlb_kernel_range(start,end) flush_tlb_all()
/* This is calld in munmap when we have freed up some page-table pages.
* We don't need to do anything here, there's nothing special about our
* page-table pages.
*/
static inline void flush_tlb_pgtables(struct mm_struct *mm,
unsigned long start, unsigned long end)
{
}
/* TLB operations. */
static inline unsigned long itlb_probe(unsigned long addr)
{
unsigned long tmp;
__asm__ __volatile__("pitlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
return tmp;
}
static inline unsigned long dtlb_probe(unsigned long addr)
{
unsigned long tmp;
__asm__ __volatile__("pdtlb %0, %1\n\t" : "=a" (tmp) : "a" (addr));
return tmp;
}
static inline void invalidate_itlb_entry (unsigned long probe)
{
__asm__ __volatile__("iitlb %0; isync\n\t" : : "a" (probe));
}
static inline void invalidate_dtlb_entry (unsigned long probe)
{
__asm__ __volatile__("idtlb %0; dsync\n\t" : : "a" (probe));
}
/* Use the .._no_isync functions with caution. Generally, these are
* handy for bulk invalidates followed by a single 'isync'. The
* caller must follow up with an 'isync', which can be relatively
* expensive on some Xtensa implementations.
*/
static inline void invalidate_itlb_entry_no_isync (unsigned entry)
{
/* Caller must follow up with 'isync'. */
__asm__ __volatile__ ("iitlb %0\n" : : "a" (entry) );
}
static inline void invalidate_dtlb_entry_no_isync (unsigned entry)
{
/* Caller must follow up with 'isync'. */
__asm__ __volatile__ ("idtlb %0\n" : : "a" (entry) );
}
static inline void set_itlbcfg_register (unsigned long val)
{
__asm__ __volatile__("wsr %0, "__stringify(ITLBCFG)"\n\t" "isync\n\t"
: : "a" (val));
}
static inline void set_dtlbcfg_register (unsigned long val)
{
__asm__ __volatile__("wsr %0, "__stringify(DTLBCFG)"; dsync\n\t"
: : "a" (val));
}
static inline void set_ptevaddr_register (unsigned long val)
{
__asm__ __volatile__(" wsr %0, "__stringify(PTEVADDR)"; isync\n"
: : "a" (val));
}
static inline unsigned long read_ptevaddr_register (void)
{
unsigned long tmp;
__asm__ __volatile__("rsr %0, "__stringify(PTEVADDR)"\n\t" : "=a" (tmp));
return tmp;
}
static inline void write_dtlb_entry (pte_t entry, int way)
{
__asm__ __volatile__("wdtlb %1, %0; dsync\n\t"
: : "r" (way), "r" (entry) );
}
static inline void write_itlb_entry (pte_t entry, int way)
{
__asm__ __volatile__("witlb %1, %0; isync\n\t"
: : "r" (way), "r" (entry) );
}
static inline void invalidate_page_directory (void)
{
invalidate_dtlb_entry (DTLB_WAY_PGD);
invalidate_dtlb_entry (DTLB_WAY_PGD+1);
invalidate_dtlb_entry (DTLB_WAY_PGD+2);
}
static inline void invalidate_itlb_mapping (unsigned address)
{
unsigned long tlb_entry;
if (((tlb_entry = itlb_probe(address)) & (1 << ITLB_HIT_BIT)) != 0)
invalidate_itlb_entry(tlb_entry);
}
static inline void invalidate_dtlb_mapping (unsigned address)
{
unsigned long tlb_entry;
if (((tlb_entry = dtlb_probe(address)) & (1 << DTLB_HIT_BIT)) != 0)
invalidate_dtlb_entry(tlb_entry);
}
#define check_pgt_cache() do { } while (0)
/*
* DO NOT USE THESE FUNCTIONS. These instructions aren't part of the Xtensa
* ISA and exist only for test purposes..
* You may find it helpful for MMU debugging, however.
*
* 'at' is the unmodified input register
* 'as' is the output register, as follows (specific to the Linux config):
*
* as[31..12] contain the virtual address
* as[11..08] are meaningless
* as[07..00] contain the asid
*/
static inline unsigned long read_dtlb_virtual (int way)
{
unsigned long tmp;
__asm__ __volatile__("rdtlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
return tmp;
}
static inline unsigned long read_dtlb_translation (int way)
{
unsigned long tmp;
__asm__ __volatile__("rdtlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
return tmp;
}
static inline unsigned long read_itlb_virtual (int way)
{
unsigned long tmp;
__asm__ __volatile__("ritlb0 %0, %1\n\t" : "=a" (tmp), "+a" (way));
return tmp;
}
static inline unsigned long read_itlb_translation (int way)
{
unsigned long tmp;
__asm__ __volatile__("ritlb1 %0, %1\n\t" : "=a" (tmp), "+a" (way));
return tmp;
}
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _XTENSA_TLBFLUSH_H */
|
/*
* Copyright 2006 IBM Corporation.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#ifndef _PSERIES_PSERIES_H
#define _PSERIES_PSERIES_H
#include <linux/interrupt.h>
#include <asm/rtas.h>
struct device_node;
extern void request_event_sources_irqs(struct device_node *np,
irq_handler_t handler, const char *name);
#include <linux/of.h>
struct pt_regs;
extern int pSeries_system_reset_exception(struct pt_regs *regs);
extern int pSeries_machine_check_exception(struct pt_regs *regs);
extern long pseries_machine_check_realmode(struct pt_regs *regs);
#ifdef CONFIG_SMP
extern void smp_init_pseries(void);
/* Get state of physical CPU from query_cpu_stopped */
int smp_query_cpu_stopped(unsigned int pcpu);
#define QCSS_STOPPED 0
#define QCSS_STOPPING 1
#define QCSS_NOT_STOPPED 2
#define QCSS_HARDWARE_ERROR -1
#define QCSS_HARDWARE_BUSY -2
#else
static inline void smp_init_pseries(void) { };
#endif
extern void pseries_kexec_cpu_down(int crash_shutdown, int secondary);
extern void pSeries_final_fixup(void);
/* Poweron flag used for enabling auto ups restart */
extern unsigned long rtas_poweron_auto;
/* Provided by HVC VIO */
extern void hvc_vio_init_early(void);
/* Dynamic logical Partitioning/Mobility */
extern void dlpar_free_cc_nodes(struct device_node *);
extern void dlpar_free_cc_property(struct property *);
extern struct device_node *dlpar_configure_connector(__be32,
struct device_node *);
extern int dlpar_attach_node(struct device_node *, struct device_node *);
extern int dlpar_detach_node(struct device_node *);
extern int dlpar_acquire_drc(u32 drc_index);
extern int dlpar_release_drc(u32 drc_index);
void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog);
int handle_dlpar_errorlog(struct pseries_hp_errorlog *hp_errlog);
#ifdef CONFIG_MEMORY_HOTPLUG
int dlpar_memory(struct pseries_hp_errorlog *hp_elog);
int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog);
#else
static inline int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
{
return -EOPNOTSUPP;
}
static inline int dlpar_hp_pmem(struct pseries_hp_errorlog *hp_elog)
{
return -EOPNOTSUPP;
}
#endif
#ifdef CONFIG_HOTPLUG_CPU
int dlpar_cpu(struct pseries_hp_errorlog *hp_elog);
#else
static inline int dlpar_cpu(struct pseries_hp_errorlog *hp_elog)
{
return -EOPNOTSUPP;
}
#endif
/* PCI root bridge prepare function override for pseries */
struct pci_host_bridge;
int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
extern struct pci_controller_ops pseries_pci_controller_ops;
unsigned long pseries_memory_block_size(void);
extern int CMO_PrPSP;
extern int CMO_SecPSP;
extern unsigned long CMO_PageSize;
static inline int cmo_get_primary_psp(void)
{
return CMO_PrPSP;
}
static inline int cmo_get_secondary_psp(void)
{
return CMO_SecPSP;
}
static inline unsigned long cmo_get_page_size(void)
{
return CMO_PageSize;
}
int dlpar_workqueue_init(void);
void pseries_setup_rfi_flush(void);
#endif /* _PSERIES_PSERIES_H */
|
/*!
* \copy
* Copyright (c) 2011-2013, Cisco Systems
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT 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.
*
* \file : util.h
*
* \brief : utils for wels video processor class
*
* \date : 2011/01/04
*
* \description :
*
*************************************************************************************
*/
#ifndef WELSVP_UTIL_H
#define WELSVP_UTIL_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "typedef.h"
#include "memory.h"
#include "IWelsVP.h"
WELSVP_NAMESPACE_BEGIN
#define MAX_WIDTH (4096)
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
#define MB_WIDTH_LUMA (16)
#define PESN (1e-6) // desired float precision
#define AQ_INT_MULTIPLY 10000000
#define AQ_TIME_INT_MULTIPLY 10000
#define AQ_QSTEP_INT_MULTIPLY 100
#define AQ_PESN 10 // (1e-6)*AQ_INT_MULTIPLY
#define MB_TYPE_INTRA4x4 0x00000001
#define MB_TYPE_INTRA16x16 0x00000002
#define MB_TYPE_INTRA_PCM 0x00000004
#define MB_TYPE_INTRA (MB_TYPE_INTRA4x4 | MB_TYPE_INTRA16x16 | MB_TYPE_INTRA_PCM)
#define IS_INTRA(type) ((type)&MB_TYPE_INTRA)
#define WELS_MAX(x, y) ((x) > (y) ? (x) : (y))
#define WELS_MIN(x, y) ((x) < (y) ? (x) : (y))
#ifndef WELS_SIGN
#define WELS_SIGN(a) ((int32_t)(a) >> 31)
#endif
#ifndef WELS_ABS
#define WELS_ABS(a) ((WELS_SIGN(a) ^ (int32_t)(a)) - WELS_SIGN(a))
#endif
#define WELS_CLAMP(x, minv, maxv) WELS_MIN(WELS_MAX(x, minv), maxv)
#define ALIGNBYTES (16) /* Worst case is requiring alignment to an 16 byte boundary */
#define WELS_ALIGN(iInput) ((iInput+(ALIGNMENT-1)) & ~(ALIGNMENT-1))
#define WELS_ALIGN2(iInput) ((iInput+1) & ~1)
#define WELS_ALIGN4(iInput) ((iInput+3) & ~3)
#define WELS_ALIGN8(iInput) ((iInput+7) & ~7)
#define WelsCastFromPointer(p) (reinterpret_cast<intptr_t>(p))
#define WelsStaticCast(type, p) (static_cast<type>(p))
#define WelsDynamicCast(type, p) (dynamic_cast<type>(p))
#define GET_METHOD(x) ((x) & 0xff) // mask method as the lowest 8bits
#define GET_SPECIAL(x) (((x) >> 8) & 0xff) // mask special flag as 8bits
inline EMethods WelsVpGetValidMethod (int32_t a) {
int32_t iMethod = GET_METHOD (a);
return WelsStaticCast (EMethods, WELS_CLAMP (iMethod, METHOD_NULL + 1, METHOD_MASK - 1));
}
WELSVP_NAMESPACE_END
#endif
|
/* { dg-do compile } */
/* { dg-options "-mavx512vl -O2" } */
/* { dg-final { scan-assembler-times "vptestmq\[ \\t\]+\[^\{\n\]*%xmm\[0-7\]+\[^\n\]*k\[1-7\](?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vptestmq\[ \\t\]+\[^\{\n\]*%ymm\[0-7\]+\[^\n\]*k\[1-7\](?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vptestmq\[ \\t\]+\[^\{\n\]*%xmm\[0-7\]+\[^\n\]*k\[1-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
/* { dg-final { scan-assembler-times "vptestmq\[ \\t\]+\[^\{\n\]*%ymm\[0-7\]+\[^\n\]*k\[1-7\]\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */
#include <immintrin.h>
volatile __m128i x128;
volatile __m256i x256;
volatile __mmask8 m;
void extern
avx512vl_test (void)
{
m = _mm_test_epi64_mask (x128, x128);
m = _mm256_test_epi64_mask (x256, x256);
m = _mm_mask_test_epi64_mask (3, x128, x128);
m = _mm256_mask_test_epi64_mask (3, x256, x256);
}
|
// 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 STORAGE_BROWSER_QUOTA_STORAGE_OBSERVER_H_
#define STORAGE_BROWSER_QUOTA_STORAGE_OBSERVER_H_
#include "base/basictypes.h"
#include "base/time/time.h"
#include "storage/browser/quota/quota_client.h"
#include "storage/common/quota/quota_types.h"
#include "url/gurl.h"
namespace storage {
// This interface is implemented by observers that wish to monitor storage
// events, such as changes in quota or usage.
class STORAGE_EXPORT StorageObserver {
public:
struct STORAGE_EXPORT Filter {
// The storage type to monitor. This must not be kStorageTypeUnknown or
// kStorageTypeQuotaNotManaged.
StorageType storage_type;
// The origin to monitor usage for. Must be specified.
GURL origin;
Filter();
Filter(StorageType storage_type, const GURL& origin);
bool operator==(const Filter& other) const;
};
struct STORAGE_EXPORT MonitorParams {
// Storage type and origin to monitor.
Filter filter;
// The rate at which storage events will be fired. Events will be fired at
// approximately this rate, or when a storage status change has been
// detected, whichever is the least frequent.
base::TimeDelta rate;
// If set to true, the observer will be dispatched an event when added.
bool dispatch_initial_state;
MonitorParams();
MonitorParams(StorageType storage_type,
const GURL& origin,
const base::TimeDelta& rate,
bool get_initial_state);
MonitorParams(const Filter& filter,
const base::TimeDelta& rate,
bool get_initial_state);
};
struct STORAGE_EXPORT Event {
// The storage type and origin monitored.
Filter filter;
// The current usage corresponding to the filter.
int64 usage;
// The quota corresponding to the filter.
int64 quota;
Event();
Event(const Filter& filter, int64 usage, int64 quota);
bool operator==(const Event& other) const;
};
// Will be called on the IO thread when a storage event occurs.
virtual void OnStorageEvent(const Event& event) = 0;
protected:
virtual ~StorageObserver() {}
};
} // namespace storage
#endif // STORAGE_BROWSER_QUOTA_STORAGE_OBSERVER_H_
|
#pragma once
#include "quantum.h"
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
/* Tap for Tab, hold for Hyper (Super+Ctrl+Shift+Alt) */
#define HPR_TAB ALL_T(KC_TAB)
/* Shift when held, Enter when tapped */
#define SFT_ENT MT(MOD_RSFT, KC_ENT)
/* Activate util layer while holding space */
#define SPC_UTL LT(_UTIL, KC_SPC)
/* Control when held, Escape when tapped */
#define ESC_CTL MT(MOD_LCTL, KC_ESC)
/* Toggle gaming layer */
#define TG_GAME TG(_GAMING)
/*
* Make it easy to navigate back and forward in Chrome.
*/
#define GO_BACK LGUI(KC_LBRC)
#define GO_FWD LGUI(KC_RBRC)
/*
* When using a 40% layout, these keycodes make it easy to change tabs in apps
* like Chrome and VSCode.
*/
#define GUI_1 LGUI(KC_1)
#define GUI_2 LGUI(KC_2)
#define GUI_3 LGUI(KC_3)
#define GUI_4 LGUI(KC_4)
#define GUI_5 LGUI(KC_5)
#define GUI_6 LGUI(KC_6)
#define GUI_7 LGUI(KC_7)
#define GUI_8 LGUI(KC_8)
#define GUI_9 LGUI(KC_9)
#define GUI_0 LGUI(KC_0)
/*
* Common layers and keycodes that are shared between Planck and Preonic
*/
enum ortho_layers {
_QWERTY,
_GAMING,
_UTIL,
_COLEMAK,
_DVORAK,
_LOWER,
_RAISE,
_PLOVER,
_ADJUST
};
enum ortho_keycodes {
QWERTY = SAFE_RANGE,
GAMING,
UTIL,
COLEMAK,
DVORAK,
PLOVER,
BACKLIT,
EXT_PLV
};
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_M32R_CACHE_H
#define _ASM_M32R_CACHE_H
/* L1 cache line size */
#define L1_CACHE_SHIFT 4
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
#endif /* _ASM_M32R_CACHE_H */
|
#include "isp.h"
#ifndef __INLINE_ISP__
#include "isp_private.h"
#endif /* __INLINE_ISP__ */
void cnd_isp_irq_enable(
const isp_ID_t ID,
const bool cnd)
{
if (cnd) {
isp_ctrl_setbit(ID, ISP_IRQ_READY_REG, ISP_IRQ_READY_BIT);
/* Enabling the IRQ immediately triggers an interrupt, clear it */
isp_ctrl_setbit(ID, ISP_IRQ_CLEAR_REG, ISP_IRQ_CLEAR_BIT);
} else /* { */
isp_ctrl_clearbit(ID, ISP_IRQ_READY_REG,
ISP_IRQ_READY_BIT);
/* } */
return;
}
void isp_get_state(
const isp_ID_t ID,
isp_state_t *state,
isp_stall_t *stall)
{
hrt_data sc = isp_ctrl_load(ID, ISP_SC_REG);
state->pc = isp_ctrl_load(ID, ISP_PC_REG);
state->status_register = sc;
state->is_broken = isp_ctrl_getbit(ID, ISP_SC_REG, ISP_BROKEN_BIT);
state->is_idle = isp_ctrl_getbit(ID, ISP_SC_REG, ISP_IDLE_BIT);
state->is_sleeping = isp_ctrl_getbit(ID, ISP_SC_REG, ISP_SLEEPING_BIT);
state->is_stalling = isp_ctrl_getbit(ID, ISP_SC_REG, ISP_STALLING_BIT);
stall->stat_ctrl =
!isp_ctrl_getbit(ID, ISP_CTRL_SINK_REG, ISP_CTRL_SINK_BIT);
/*
stall->pmem =
!isp_ctrl_getbit(ID, ISP_PMEM_SINK_REG, ISP_PMEM_SINK_BIT);
*/
stall->dmem =
!isp_ctrl_getbit(ID, ISP_DMEM_SINK_REG, ISP_DMEM_SINK_BIT);
stall->vmem =
!isp_ctrl_getbit(ID, ISP_VMEM_SINK_REG, ISP_VMEM_SINK_BIT);
stall->fifo0 =
!isp_ctrl_getbit(ID, ISP_FIFO0_SINK_REG, ISP_FIFO0_SINK_BIT);
stall->fifo1 =
!isp_ctrl_getbit(ID, ISP_FIFO1_SINK_REG, ISP_FIFO1_SINK_BIT);
stall->fifo2 =
!isp_ctrl_getbit(ID, ISP_FIFO2_SINK_REG, ISP_FIFO2_SINK_BIT);
stall->fifo3 =
!isp_ctrl_getbit(ID, ISP_FIFO3_SINK_REG, ISP_FIFO3_SINK_BIT);
stall->fifo4 =
!isp_ctrl_getbit(ID, ISP_FIFO4_SINK_REG, ISP_FIFO4_SINK_BIT);
stall->fifo5 =
!isp_ctrl_getbit(ID, ISP_FIFO5_SINK_REG, ISP_FIFO5_SINK_BIT);
stall->vamem1 =
!isp_ctrl_getbit(ID, ISP_VAMEM1_SINK_REG, ISP_VAMEM1_SINK_BIT);
stall->vamem2 =
!isp_ctrl_getbit(ID, ISP_VAMEM2_SINK_REG, ISP_VAMEM2_SINK_BIT);
return;
}
|
/*
* Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "../ssp.h"
#define BOSCH_ID 0
#define VENDOR "BOSCH"
#define CHIP_ID "BMP280"
#define STM_ID 1
#define VENDOR_STM "STM"
#define CHIP_ID_STM "LPS25H"
#define CALIBRATION_FILE_PATH "/efs/FactoryApp/baro_delta"
#define PR_ABS_MAX 8388607 /* 24 bit 2'compl */
#define PR_ABS_MIN -8388608
/*************************************************************************/
/* factory Sysfs */
/*************************************************************************/
static ssize_t sea_level_pressure_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct ssp_data *data = dev_get_drvdata(dev);
sscanf(buf, "%d", &data->buf[PRESSURE_SENSOR].pressure_sealevel);
if (data->buf[PRESSURE_SENSOR].pressure_sealevel == 0) {
pr_info("%s, our->temperature = 0\n", __func__);
data->buf[PRESSURE_SENSOR].pressure_sealevel = -1;
}
pr_info("[SSP] %s sea_level_pressure = %d\n",
__func__, data->buf[PRESSURE_SENSOR].pressure_sealevel);
return size;
}
int pressure_open_calibration(struct ssp_data *data)
{
char chBuf[10] = {0,};
int iErr = 0;
mm_segment_t old_fs;
struct file *cal_filp = NULL;
old_fs = get_fs();
set_fs(KERNEL_DS);
cal_filp = filp_open(CALIBRATION_FILE_PATH, O_RDONLY, 0660);
if (IS_ERR(cal_filp)) {
iErr = PTR_ERR(cal_filp);
if (iErr != -ENOENT)
pr_err("[SSP]: %s - Can't open calibration file(%d)\n",
__func__, iErr);
set_fs(old_fs);
return iErr;
}
iErr = cal_filp->f_op->read(cal_filp,
chBuf, 10 * sizeof(char), &cal_filp->f_pos);
if (iErr < 0) {
pr_err("[SSP]: %s - Can't read the cal data from file (%d)\n",
__func__, iErr);
return iErr;
}
filp_close(cal_filp, current->files);
set_fs(old_fs);
iErr = kstrtoint(chBuf, 10, &data->buf[PRESSURE_SENSOR].pressure_cal);
if (iErr < 0) {
pr_err("[SSP]: %s - kstrtoint failed. %d", __func__, iErr);
return iErr;
}
ssp_info("open barometer calibration %d",
data->buf[PRESSURE_SENSOR].pressure_cal);
if (data->buf[PRESSURE_SENSOR].pressure_cal < PR_ABS_MIN
|| data->buf[PRESSURE_SENSOR].pressure_cal > PR_ABS_MAX)
pr_err("[SSP]: %s - wrong offset value!!!\n", __func__);
return iErr;
}
static ssize_t pressure_cabratioin_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size)
{
struct ssp_data *data = dev_get_drvdata(dev);
int iPressureCal = 0, iErr = 0;
iErr = kstrtoint(buf, 10, &iPressureCal);
if (iErr < 0) {
pr_err("[SSP]: %s - kstrtoint failed.(%d)", __func__, iErr);
return iErr;
}
if (iPressureCal < PR_ABS_MIN || iPressureCal > PR_ABS_MAX)
return -EINVAL;
data->buf[PRESSURE_SENSOR].pressure_cal = (s32)iPressureCal;
return size;
}
static ssize_t pressure_cabratioin_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ssp_data *data = dev_get_drvdata(dev);
pressure_open_calibration(data);
return sprintf(buf, "%d\n", data->buf[PRESSURE_SENSOR].pressure_cal);
}
static ssize_t eeprom_check_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
char chTempBuf = 0;
int iRet = 0;
struct ssp_data *data = dev_get_drvdata(dev);
struct ssp_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
msg->cmd = PRESSURE_FACTORY;
msg->length = 1;
msg->options = AP2HUB_READ;
msg->buffer = &chTempBuf;
msg->free_buffer = 0;
iRet = ssp_spi_sync(data, msg, 3000);
if (iRet != SUCCESS) {
pr_err("[SSP]: %s - Pressure Selftest Timeout!!\n", __func__);
goto exit;
}
ssp_infof("%u", chTempBuf);
exit:
return snprintf(buf, PAGE_SIZE, "%d", chTempBuf);
}
/* sysfs for vendor & name */
static ssize_t pressure_vendor_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ssp_data *data = dev_get_drvdata(dev);
if (data->pressure_type == STM_ID)
return sprintf(buf, "%s\n", VENDOR_STM);
else
return sprintf(buf, "%s\n", VENDOR);
}
static ssize_t pressure_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ssp_data *data = dev_get_drvdata(dev);
if (data->pressure_type == STM_ID)
return sprintf(buf, "%s\n", CHIP_ID_STM);
else
return sprintf(buf, "%s\n", CHIP_ID);
}
static DEVICE_ATTR(vendor, S_IRUGO, pressure_vendor_show, NULL);
static DEVICE_ATTR(name, S_IRUGO, pressure_name_show, NULL);
static DEVICE_ATTR(eeprom_check, S_IRUGO, eeprom_check_show, NULL);
static DEVICE_ATTR(calibration, S_IRUGO | S_IWUSR | S_IWGRP,
pressure_cabratioin_show, pressure_cabratioin_store);
static DEVICE_ATTR(sea_level_pressure, S_IWUSR | S_IWGRP,
NULL, sea_level_pressure_store);
static struct device_attribute *pressure_attrs[] = {
&dev_attr_vendor,
&dev_attr_name,
&dev_attr_calibration,
&dev_attr_sea_level_pressure,
&dev_attr_eeprom_check,
NULL,
};
void initialize_pressure_factorytest(struct ssp_data *data)
{
sensors_register(data->prs_device, data, pressure_attrs,
"barometer_sensor");
}
void remove_pressure_factorytest(struct ssp_data *data)
{
sensors_unregister(data->prs_device, pressure_attrs);
}
|
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_IDLEMOVEMENTGENERATOR_H
#define TRINITY_IDLEMOVEMENTGENERATOR_H
#include "MovementGenerator.h"
class IdleMovementGenerator : public MovementGenerator
{
public:
void Initialize(Unit &);
void Finalize(Unit &) { }
void Reset(Unit &);
bool Update(Unit &, const uint32&) { return true; }
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
};
extern IdleMovementGenerator si_idleMovement;
class RotateMovementGenerator : public MovementGenerator
{
public:
explicit RotateMovementGenerator(uint32 time, RotateDirection direction) : m_duration(time), m_maxDuration(time), m_direction(direction) {}
void Initialize(Unit& owner);
void Finalize(Unit& owner);
void Reset(Unit& owner) { Initialize(owner); }
bool Update(Unit& owner, const uint32& time_diff);
MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; }
private:
uint32 m_duration, m_maxDuration;
RotateDirection m_direction;
};
class DistractMovementGenerator : public MovementGenerator
{
public:
explicit DistractMovementGenerator(uint32 timer) : m_timer(timer) {}
void Initialize(Unit& owner);
void Finalize(Unit& owner);
void Reset(Unit& owner) { Initialize(owner); }
bool Update(Unit& owner, const uint32& time_diff);
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
private:
uint32 m_timer;
};
class AssistanceDistractMovementGenerator : public DistractMovementGenerator
{
public:
AssistanceDistractMovementGenerator(uint32 timer) :
DistractMovementGenerator(timer) {}
MovementGeneratorType GetMovementGeneratorType() { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
void Finalize(Unit& unit);
};
#endif
|
/*
* Copyright IBM Corp. 2007
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
*/
#ifndef _ASM_S390_SCLP_H
#define _ASM_S390_SCLP_H
#include <linux/types.h>
#include <asm/chpid.h>
#include <asm/cpu.h>
#define SCLP_CHP_INFO_MASK_SIZE 32
#define SCLP_MAX_CORES 256
struct sclp_chp_info {
u8 recognized[SCLP_CHP_INFO_MASK_SIZE];
u8 standby[SCLP_CHP_INFO_MASK_SIZE];
u8 configured[SCLP_CHP_INFO_MASK_SIZE];
};
#define LOADPARM_LEN 8
struct sclp_ipl_info {
int is_valid;
int has_dump;
char loadparm[LOADPARM_LEN];
};
struct sclp_core_entry {
u8 core_id;
u8 reserved0;
u8 : 4;
u8 sief2 : 1;
u8 skey : 1;
u8 : 2;
u8 : 2;
u8 gpere : 1;
u8 siif : 1;
u8 sigpif : 1;
u8 : 3;
u8 reserved2[3];
u8 : 2;
u8 ib : 1;
u8 cei : 1;
u8 : 4;
u8 reserved3[6];
u8 type;
u8 reserved1;
} __attribute__((packed));
struct sclp_core_info {
unsigned int configured;
unsigned int standby;
unsigned int combined;
struct sclp_core_entry core[SCLP_MAX_CORES];
};
struct sclp_info {
unsigned char has_linemode : 1;
unsigned char has_vt220 : 1;
unsigned char has_siif : 1;
unsigned char has_sigpif : 1;
unsigned char has_core_type : 1;
unsigned char has_sprp : 1;
unsigned char has_hvs : 1;
unsigned char has_esca : 1;
unsigned char has_sief2 : 1;
unsigned char has_64bscao : 1;
unsigned char has_gpere : 1;
unsigned char has_cmma : 1;
unsigned char has_gsls : 1;
unsigned char has_ib : 1;
unsigned char has_cei : 1;
unsigned char has_pfmfi : 1;
unsigned char has_ibs : 1;
unsigned char has_skey : 1;
unsigned char has_kss : 1;
unsigned int ibc;
unsigned int mtid;
unsigned int mtid_cp;
unsigned int mtid_prev;
unsigned long rzm;
unsigned long rnmax;
unsigned long hamax;
unsigned int max_cores;
unsigned long hsa_size;
unsigned long facilities;
unsigned int hmfai;
};
extern struct sclp_info sclp;
struct zpci_report_error_header {
u8 version; /* Interface version byte */
u8 action; /* Action qualifier byte
* 1: Deconfigure and repair action requested
* (OpenCrypto Problem Call Home)
* 2: Informational Report
* (OpenCrypto Successful Diagnostics Execution)
*/
u16 length; /* Length of Subsequent Data (up to 4K – SCLP header */
u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */
} __packed;
int sclp_early_get_core_info(struct sclp_core_info *info);
void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
void sclp_early_detect(void);
void sclp_early_printk(const char *s);
void __sclp_early_printk(const char *s, unsigned int len);
int _sclp_get_core_info(struct sclp_core_info *info);
int sclp_core_configure(u8 core);
int sclp_core_deconfigure(u8 core);
int sclp_sdias_blk_count(void);
int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
int sclp_chp_configure(struct chp_id chpid);
int sclp_chp_deconfigure(struct chp_id chpid);
int sclp_chp_read_info(struct sclp_chp_info *info);
int sclp_pci_configure(u32 fid);
int sclp_pci_deconfigure(u32 fid);
int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid);
int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count);
int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count);
void sclp_ocf_cpc_name_copy(char *dst);
static inline int sclp_get_core_info(struct sclp_core_info *info, int early)
{
if (early)
return sclp_early_get_core_info(info);
return _sclp_get_core_info(info);
}
#endif /* _ASM_S390_SCLP_H */
|
/*
* Copyright (C) 2012 Altera Corporation <www.altera.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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _SOCFPGA_BASE_ADDRS_H_
#define _SOCFPGA_BASE_ADDRS_H_
#define SOCFPGA_L3REGS_ADDRESS 0xff800000
#define SOCFPGA_UART0_ADDRESS 0xffc02000
#define SOCFPGA_UART1_ADDRESS 0xffc03000
#define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000
#define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
#endif /* _SOCFPGA_BASE_ADDRS_H_ */
|
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/******************************************************************
iLBC Speech Coder ANSI-C Source Code
WebRtcIlbcfix_GetSyncSeq.c
******************************************************************/
#include "defines.h"
#include "constants.h"
#include "refiner.h"
#include "nearest_neighbor.h"
/*----------------------------------------------------------------*
* get the pitch-synchronous sample sequence
*---------------------------------------------------------------*/
void WebRtcIlbcfix_GetSyncSeq(
int16_t *idata, /* (i) original data */
int16_t idatal, /* (i) dimension of data */
int16_t centerStartPos, /* (i) where current block starts */
int16_t *period, /* (i) rough-pitch-period array (Q-2) */
int16_t *plocs, /* (i) where periods of period array are taken (Q-2) */
int16_t periodl, /* (i) dimension period array */
int16_t hl, /* (i) 2*hl+1 is the number of sequences */
int16_t *surround /* (i/o) The contribution from this sequence
summed with earlier contributions */
){
int16_t i,centerEndPos,q;
/* Stack based */
int16_t lagBlock[2*ENH_HL+1];
int16_t blockStartPos[2*ENH_HL+1]; /* Defines the position to search around (Q2) */
int16_t plocs2[ENH_PLOCSL];
centerEndPos=centerStartPos+ENH_BLOCKL-1;
/* present (find predicted lag from this position) */
WebRtcIlbcfix_NearestNeighbor(lagBlock+hl,plocs,
(int16_t)WEBRTC_SPL_MUL_16_16(2, (centerStartPos+centerEndPos)),
periodl);
blockStartPos[hl]=(int16_t)WEBRTC_SPL_MUL_16_16(4, centerStartPos);
/* past (find predicted position and perform a refined
search to find the best sequence) */
for(q=hl-1;q>=0;q--) {
blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]];
WebRtcIlbcfix_NearestNeighbor(lagBlock+q, plocs,
(int16_t)(blockStartPos[q] + (int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)-period[lagBlock[q+1]]),
periodl);
if((blockStartPos[q]-(int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_OVERHANG))>=0) {
/* Find the best possible sequence in the 4 times upsampled
domain around blockStartPos+q */
WebRtcIlbcfix_Refiner(blockStartPos+q,idata,idatal,
centerStartPos,blockStartPos[q],surround,WebRtcIlbcfix_kEnhWt[q]);
} else {
/* Don't add anything since this sequence would
be outside the buffer */
}
}
/* future (find predicted position and perform a refined
search to find the best sequence) */
for(i=0;i<periodl;i++) {
plocs2[i]=(plocs[i]-period[i]);
}
for(q=hl+1;q<=WEBRTC_SPL_MUL_16_16(2, hl);q++) {
WebRtcIlbcfix_NearestNeighbor(lagBlock+q,plocs2,
(int16_t)(blockStartPos[q-1]+
(int16_t)WEBRTC_SPL_MUL_16_16(4, ENH_BLOCKL_HALF)),periodl);
blockStartPos[q]=blockStartPos[q-1]+period[lagBlock[q]];
if( (blockStartPos[q]+(int16_t)WEBRTC_SPL_MUL_16_16(4, (ENH_BLOCKL+ENH_OVERHANG)))
<
(int16_t)WEBRTC_SPL_MUL_16_16(4, idatal)) {
/* Find the best possible sequence in the 4 times upsampled
domain around blockStartPos+q */
WebRtcIlbcfix_Refiner(blockStartPos+q, idata, idatal,
centerStartPos,blockStartPos[q],surround,WebRtcIlbcfix_kEnhWt[2*hl-q]);
}
else {
/* Don't add anything since this sequence would
be outside the buffer */
}
}
}
|
#define XEMPORTS 0xC02
#define XEPORTS 0xC22
#define MAX_ALLOC 0x100
#define MAXBOARDS 12
#define FEPCODESEG 0x0200L
#define FEPCODE 0x2000L
#define BIOSCODE 0xf800L
#define MISCGLOBAL 0x0C00L
#define NPORT 0x0C22L
#define MBOX 0x0C40L
#define PORTBASE 0x0C90L
/* Begin code defines used for epca_setup */
#define INVALID_BOARD_TYPE 0x1
#define INVALID_NUM_PORTS 0x2
#define INVALID_MEM_BASE 0x4
#define INVALID_PORT_BASE 0x8
#define INVALID_BOARD_STATUS 0x10
#define INVALID_ALTPIN 0x20
/* End code defines used for epca_setup */
#define FEPCLR 0x00
#define FEPMEM 0x02
#define FEPRST 0x04
#define FEPINT 0x08
#define FEPMASK 0x0e
#define FEPWIN 0x80
#define PCXE 0
#define PCXEVE 1
#define PCXEM 2
#define EISAXEM 3
#define PC64XE 4
#define PCXI 5
#define PCIXEM 7
#define PCICX 8
#define PCIXR 9
#define PCIXRJ 10
#define EPCA_NUM_TYPES 6
static char *board_desc[] =
{
"PC/Xe",
"PC/Xeve",
"PC/Xem",
"EISA/Xem",
"PC/64Xe",
"PC/Xi",
"unknown",
"PCI/Xem",
"PCI/CX",
"PCI/Xr",
"PCI/Xrj",
};
#define STARTC 021
#define STOPC 023
#define IAIXON 0x2000
#define TXSTOPPED 0x1
#define LOWWAIT 0x2
#define EMPTYWAIT 0x4
#define RXSTOPPED 0x8
#define TXBUSY 0x10
#define DISABLED 0
#define ENABLED 1
#define OFF 0
#define ON 1
#define FEPTIMEOUT 200000
#define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_INFO 3
#define EPCA_EVENT_HANGUP 1
#define EPCA_MAGIC 0x5c6df104L
struct channel
{
long magic;
unsigned char boardnum;
unsigned char channelnum;
unsigned char omodem; /* FEP output modem status */
unsigned char imodem; /* FEP input modem status */
unsigned char modemfake; /* Modem values to be forced */
unsigned char modem; /* Force values */
unsigned char hflow;
unsigned char dsr;
unsigned char dcd;
unsigned char m_rts ; /* The bits used in whatever FEP */
unsigned char m_dcd ; /* is indiginous to this board to */
unsigned char m_dsr ; /* represent each of the physical */
unsigned char m_cts ; /* handshake lines */
unsigned char m_ri ;
unsigned char m_dtr ;
unsigned char stopc;
unsigned char startc;
unsigned char stopca;
unsigned char startca;
unsigned char fepstopc;
unsigned char fepstartc;
unsigned char fepstopca;
unsigned char fepstartca;
unsigned char txwin;
unsigned char rxwin;
unsigned short fepiflag;
unsigned short fepcflag;
unsigned short fepoflag;
unsigned short txbufhead;
unsigned short txbufsize;
unsigned short rxbufhead;
unsigned short rxbufsize;
int close_delay;
int count;
int blocked_open;
unsigned long event;
int asyncflags;
uint dev;
unsigned long statusflags;
unsigned long c_iflag;
unsigned long c_cflag;
unsigned long c_lflag;
unsigned long c_oflag;
unsigned char __iomem *txptr;
unsigned char __iomem *rxptr;
struct board_info *board;
struct board_chan __iomem *brdchan;
struct digi_struct digiext;
struct tty_struct *tty;
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
struct work_struct tqueue;
struct global_data __iomem *mailbox;
};
struct board_info
{
unsigned char status;
unsigned char type;
unsigned char altpin;
unsigned short numports;
unsigned long port;
unsigned long membase;
void __iomem *re_map_port;
void __iomem *re_map_membase;
unsigned long memory_seg;
void ( * memwinon ) (struct board_info *, unsigned int) ;
void ( * memwinoff ) (struct board_info *, unsigned int) ;
void ( * globalwinon ) (struct channel *) ;
void ( * txwinon ) (struct channel *) ;
void ( * rxwinon ) (struct channel *) ;
void ( * memoff ) (struct channel *) ;
void ( * assertgwinon ) (struct channel *) ;
void ( * assertmemoff ) (struct channel *) ;
unsigned char poller_inhibited ;
};
|
/*
* fixmap.h: compile-time virtual memory allocation
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1998 Ingo Molnar
* Copyright (C) 2013 Mark Salter <msalter@redhat.com>
*
* Adapted from arch/x86_64 version.
*
*/
#ifndef _ASM_ARM64_FIXMAP_H
#define _ASM_ARM64_FIXMAP_H
#ifndef __ASSEMBLY__
#include <linux/kernel.h>
#include <asm/page.h>
/*
* Here we define all the compile-time 'special' virtual
* addresses. The point is to have a constant address at
* compile time, but to set the physical address only
* in the boot process.
*
* These 'compile-time allocated' memory buffers are
* page-sized. Use set_fixmap(idx,phys) to associate
* physical memory with fixmap indices.
*
*/
enum fixed_addresses {
FIX_EARLYCON_MEM_BASE,
__end_of_permanent_fixed_addresses,
/*
* Temporary boot-time mappings, used by early_ioremap(),
* before ioremap() is functional.
*/
#ifdef CONFIG_ARM64_64K_PAGES
#define NR_FIX_BTMAPS 4
#else
#define NR_FIX_BTMAPS 64
#endif
#define FIX_BTMAPS_SLOTS 7
#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
__end_of_fixed_addresses
};
#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
#define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE)
extern void __early_set_fixmap(enum fixed_addresses idx,
phys_addr_t phys, pgprot_t flags);
#define __set_fixmap __early_set_fixmap
#include <asm-generic/fixmap.h>
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_ARM64_FIXMAP_H */
|
/*
* Copyright (C) 2010 The Paparazzi Team
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/** @file arch/sim/subsystems/actuators/actuators_dualpwm_arch.c
* dummy servos handling for sim
*/
#include "subsystems/actuators/actuators_dualpwm_arch.h"
void actuators_dualpwm_arch_init(void)
{
}
|
/*
* (C) Copyright 2008 Sergey Lapin <slapin@ossfans.org>
*
* Configuation settings for the AFEB9260 board.
* Based on configuration for AT91SAM9260-EK
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#define CONFIG_AT91SAM9260 /* Atmel AT91SAM9260 SoC*/
#include <asm/arch/hardware.h>
#define CONFIG_SYS_TEXT_BASE 0x21f00000
/* ARM asynchronous clock */
#define CONFIG_SYS_AT91_MAIN_CLOCK 18429952 /* from 18.432 MHz crystal */
#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
#define CONFIG_SYS_HZ 1000
#define CONFIG_BOARD_EARLY_INIT_F
#define CONFIG_DISPLAY_CPUINFO
#define CONFIG_AFEB9260 /* AFEB9260 Board */
#define CONFIG_ARCH_CPU_INIT
#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_INITRD_TAG 1
#define CONFIG_SKIP_LOWLEVEL_INIT
/*
* Hardware drivers
*/
#define CONFIG_ATMEL_LEGACY
#define CONFIG_AT91_GPIO
#define CONFIG_AT91_PULLUP 1
#define CONFIG_ATMEL_USART
#define CONFIG_USART_BASE ATMEL_BASE_DBGU
#define CONFIG_USART_ID ATMEL_ID_SYS
#define CONFIG_USART3 /* USART 3 is DBGU */
#define CONFIG_BOOTDELAY 3
/*
* BOOTP options
*/
#define CONFIG_BOOTP_BOOTFILESIZE 1
#define CONFIG_BOOTP_BOOTPATH 1
#define CONFIG_BOOTP_GATEWAY 1
#define CONFIG_BOOTP_HOSTNAME 1
/*
* Command line configuration.
*/
#include <config_cmd_default.h>
#undef CONFIG_CMD_BDI
#undef CONFIG_CMD_FPGA
#undef CONFIG_CMD_IMI
#undef CONFIG_CMD_IMLS
#undef CONFIG_CMD_LOADS
#undef CONFIG_CMD_SOURCE
#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_NAND
#define CONFIG_CMD_USB
/* SDRAM */
#define CONFIG_NR_DRAM_BANKS 1
#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_CS1
#define CONFIG_SYS_SDRAM_SIZE 0x04000000 /* 64 megs */
/* DataFlash */
#define CONFIG_ATMEL_DATAFLASH_SPI
#define CONFIG_HAS_DATAFLASH
#define CONFIG_SYS_SPI_WRITE_TOUT (5 * CONFIG_SYS_HZ)
#define CONFIG_SYS_MAX_DATAFLASH_BANKS 2
#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 0xC0000000 /* CS0 */
#define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 0xD0000000 /* CS1 */
#define AT91_SPI_CLK 15000000
#define DATAFLASH_TCSS (0x1a << 16)
#define DATAFLASH_TCHS (0x1 << 24)
/* NAND flash */
#ifdef CONFIG_CMD_NAND
#define CONFIG_NAND_ATMEL
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_SYS_NAND_BASE ATMEL_BASE_CS3
#define CONFIG_SYS_NAND_DBW_8
/* our ALE is AD21 */
#define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
/* our CLE is AD22 */
#define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PC14
#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC13
#endif
/* NOR flash - no real flash on this board */
#define CONFIG_SYS_NO_FLASH
/* Ethernet */
#define CONFIG_MACB
#define CONFIG_RESET_PHY_R
#define CONFIG_NET_RETRY_COUNT 20
/* USB */
#define CONFIG_USB_ATMEL
#define CONFIG_USB_OHCI_NEW
#define CONFIG_DOS_PARTITION
#define CONFIG_SYS_USB_OHCI_CPU_INIT
#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00500000 /* AT91SAM9260_UHP_BASE */
#define CONFIG_SYS_USB_OHCI_SLOT_NAME "at91sam9260"
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
#define CONFIG_USB_STORAGE
#define CONFIG_SYS_LOAD_ADDR 0x21000000 /* load address */
#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
#define CONFIG_SYS_MEMTEST_END 0x21e00000
#define CONFIG_SYS_USE_DATAFLASH_CS1
#define CONFIG_SYS_INIT_SP_ADDR (ATMEL_BASE_SRAM1 + 0x1000 -\
GENERATED_GBL_DATA_SIZE)
/* bootstrap + u-boot + env + linux in dataflash on CS1 */
#define CONFIG_ENV_IS_IN_DATAFLASH
#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400)
#define CONFIG_ENV_OFFSET 0x4200
#define CONFIG_ENV_ADDR (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET)
#define CONFIG_ENV_SIZE 0x4200
#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0xa0000 0x200000; bootm"
#define CONFIG_BOOTARGS "console=ttyS0,115200 " \
"root=/dev/mtdblock2 " \
"rw rootfstype=jffs2 panic=20"
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_PROMPT "U-Boot> "
#define CONFIG_SYS_CBSIZE 256
#define CONFIG_SYS_MAXARGS 16
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
#define CONFIG_SYS_LONGHELP
#define CONFIG_CMDLINE_EDITING
/*
* Size of malloc() pool
*/
#define CONFIG_SYS_MALLOC_LEN ROUND(3 * CONFIG_ENV_SIZE + 128*1024, 0x1000)
#endif
|
/*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "jni.h"
#include "jvm.h"
#include "java_io_ObjectStreamClass.h"
static jclass noSuchMethodErrCl;
/*
* Class: java_io_ObjectStreamClass
* Method: initNative
* Signature: ()V
*
* Native code initialization hook.
*/
JNIEXPORT void JNICALL
Java_java_io_ObjectStreamClass_initNative(JNIEnv *env, jclass this)
{
jclass cl = (*env)->FindClass(env, "java/lang/NoSuchMethodError");
if (cl == NULL) { /* exception thrown */
return;
}
noSuchMethodErrCl = (*env)->NewGlobalRef(env, cl);
}
/*
* Class: java_io_ObjectStreamClass
* Method: hasStaticInitializer
* Signature: (Ljava/lang/Class;)Z
*
* Returns true if the given class defines a <clinit>()V method; returns false
* otherwise.
*/
JNIEXPORT jboolean JNICALL
Java_java_io_ObjectStreamClass_hasStaticInitializer(JNIEnv *env, jclass this,
jclass clazz)
{
jclass superCl = NULL;
jmethodID superClinitId = NULL;
jmethodID clinitId =
(*env)->GetStaticMethodID(env, clazz, "<clinit>", "()V");
if (clinitId == NULL) { /* error thrown */
jthrowable th = (*env)->ExceptionOccurred(env);
(*env)->ExceptionClear(env); /* normal return */
if (!(*env)->IsInstanceOf(env, th, noSuchMethodErrCl)) {
(*env)->Throw(env, th);
}
return JNI_FALSE;
}
/*
* Check superclass for static initializer as well--if the same method ID
* is returned, then the static initializer is from a superclass.
* Empirically, this step appears to be unnecessary in 1.4; however, the
* JNI spec makes no guarantee that GetStaticMethodID will not return the
* ID for a superclass initializer.
*/
if ((superCl = (*env)->GetSuperclass(env, clazz)) == NULL) {
return JNI_TRUE;
}
superClinitId =
(*env)->GetStaticMethodID(env, superCl, "<clinit>", "()V");
if (superClinitId == NULL) { /* error thrown */
jthrowable th = (*env)->ExceptionOccurred(env);
(*env)->ExceptionClear(env); /* normal return */
if (!(*env)->IsInstanceOf(env, th, noSuchMethodErrCl)) {
(*env)->Throw(env, th);
}
return JNI_TRUE;
}
return (clinitId != superClinitId);
}
|
/*
* max1111.c - +2.7V, Low-Power, Multichannel, Serial 8-bit ADCs
*
* Based on arch/arm/mach-pxa/corgi_ssp.c
*
* Copyright (C) 2004-2005 Richard Purdie
*
* Copyright (C) 2008 Marvell International Ltd.
* Eric Miao <eric.miao@marvell.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* publishhed by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#define MAX1111_TX_BUF_SIZE 1
#define MAX1111_RX_BUF_SIZE 2
/* MAX1111 Commands */
#define MAX1111_CTRL_PD0 (1u << 0)
#define MAX1111_CTRL_PD1 (1u << 1)
#define MAX1111_CTRL_SGL (1u << 2)
#define MAX1111_CTRL_UNI (1u << 3)
#define MAX1111_CTRL_SEL_SH (5) /* NOTE: bit 4 is ignored */
#define MAX1111_CTRL_STR (1u << 7)
struct max1111_data {
struct spi_device *spi;
struct device *hwmon_dev;
struct spi_message msg;
struct spi_transfer xfer[2];
uint8_t tx_buf[MAX1111_TX_BUF_SIZE];
uint8_t rx_buf[MAX1111_RX_BUF_SIZE];
struct mutex drvdata_lock;
/* protect msg, xfer and buffers from multiple access */
};
static int max1111_read(struct device *dev, int channel)
{
struct max1111_data *data = dev_get_drvdata(dev);
uint8_t v1, v2;
int err;
/* writing to drvdata struct is not thread safe, wait on mutex */
mutex_lock(&data->drvdata_lock);
data->tx_buf[0] = (channel << MAX1111_CTRL_SEL_SH) |
MAX1111_CTRL_PD0 | MAX1111_CTRL_PD1 |
MAX1111_CTRL_SGL | MAX1111_CTRL_UNI | MAX1111_CTRL_STR;
err = spi_sync(data->spi, &data->msg);
if (err < 0) {
dev_err(dev, "spi_sync failed with %d\n", err);
mutex_unlock(&data->drvdata_lock);
return err;
}
v1 = data->rx_buf[0];
v2 = data->rx_buf[1];
mutex_unlock(&data->drvdata_lock);
if ((v1 & 0xc0) || (v2 & 0x3f))
return -EINVAL;
return (v1 << 2) | (v2 >> 6);
}
#ifdef CONFIG_SHARPSL_PM
static struct max1111_data *the_max1111;
int max1111_read_channel(int channel)
{
return max1111_read(&the_max1111->spi->dev, channel);
}
EXPORT_SYMBOL(max1111_read_channel);
#endif
/*
* NOTE: SPI devices do not have a default 'name' attribute, which is
* likely to be used by hwmon applications to distinguish between
* different devices, explicitly add a name attribute here.
*/
static ssize_t show_name(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "max1111\n");
}
static ssize_t show_adc(struct device *dev,
struct device_attribute *attr, char *buf)
{
int channel = to_sensor_dev_attr(attr)->index;
int ret;
ret = max1111_read(dev, channel);
if (ret < 0)
return ret;
/* assume the reference voltage to be 2.048V, with an 8-bit sample,
* the LSB weight is 8mV
*/
return sprintf(buf, "%d\n", ret * 8);
}
#define MAX1111_ADC_ATTR(_id) \
SENSOR_DEVICE_ATTR(in##_id##_input, S_IRUGO, show_adc, NULL, _id)
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
static MAX1111_ADC_ATTR(0);
static MAX1111_ADC_ATTR(1);
static MAX1111_ADC_ATTR(2);
static MAX1111_ADC_ATTR(3);
static struct attribute *max1111_attributes[] = {
&dev_attr_name.attr,
&sensor_dev_attr_in0_input.dev_attr.attr,
&sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
NULL,
};
static const struct attribute_group max1111_attr_group = {
.attrs = max1111_attributes,
};
static int __devinit setup_transfer(struct max1111_data *data)
{
struct spi_message *m;
struct spi_transfer *x;
m = &data->msg;
x = &data->xfer[0];
spi_message_init(m);
x->tx_buf = &data->tx_buf[0];
x->len = MAX1111_TX_BUF_SIZE;
spi_message_add_tail(x, m);
x++;
x->rx_buf = &data->rx_buf[0];
x->len = MAX1111_RX_BUF_SIZE;
spi_message_add_tail(x, m);
return 0;
}
static int __devinit max1111_probe(struct spi_device *spi)
{
struct max1111_data *data;
int err;
spi->bits_per_word = 8;
spi->mode = SPI_MODE_0;
err = spi_setup(spi);
if (err < 0)
return err;
data = kzalloc(sizeof(struct max1111_data), GFP_KERNEL);
if (data == NULL) {
dev_err(&spi->dev, "failed to allocate memory\n");
return -ENOMEM;
}
err = setup_transfer(data);
if (err)
goto err_free_data;
mutex_init(&data->drvdata_lock);
data->spi = spi;
spi_set_drvdata(spi, data);
err = sysfs_create_group(&spi->dev.kobj, &max1111_attr_group);
if (err) {
dev_err(&spi->dev, "failed to create attribute group\n");
goto err_free_data;
}
data->hwmon_dev = hwmon_device_register(&spi->dev);
if (IS_ERR(data->hwmon_dev)) {
dev_err(&spi->dev, "failed to create hwmon device\n");
err = PTR_ERR(data->hwmon_dev);
goto err_remove;
}
#ifdef CONFIG_SHARPSL_PM
the_max1111 = data;
#endif
return 0;
err_remove:
sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
err_free_data:
kfree(data);
return err;
}
static int __devexit max1111_remove(struct spi_device *spi)
{
struct max1111_data *data = spi_get_drvdata(spi);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group);
mutex_destroy(&data->drvdata_lock);
kfree(data);
return 0;
}
static struct spi_driver max1111_driver = {
.driver = {
.name = "max1111",
.owner = THIS_MODULE,
},
.probe = max1111_probe,
.remove = __devexit_p(max1111_remove),
};
static int __init max1111_init(void)
{
return spi_register_driver(&max1111_driver);
}
module_init(max1111_init);
static void __exit max1111_exit(void)
{
spi_unregister_driver(&max1111_driver);
}
module_exit(max1111_exit);
MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
MODULE_DESCRIPTION("MAX1111 ADC Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("spi:max1111");
|
/*
* A collection of structures, addresses, and values associated with
* the Motorola MPC8260ADS/MPC8266ADS-PCI boards.
* Copied from the RPX-Classic and SBS8260 stuff.
*
* Copyright (c) 2001 Dan Malek (dan@mvista.com)
*/
#ifdef __KERNEL__
#ifndef __MACH_ADS8260_DEFS
#define __MACH_ADS8260_DEFS
#include <asm/ppcboot.h>
#if defined(CONFIG_ADS8272)
#define BOARD_CHIP_NAME "8272"
#endif
/* Memory map is configured by the PROM startup.
* We just map a few things we need. The CSR is actually 4 byte-wide
* registers that can be accessed as 8-, 16-, or 32-bit values.
*/
#define CPM_MAP_ADDR ((uint)0xf0000000)
#define BCSR_ADDR ((uint)0xf4500000)
#define BCSR_SIZE ((uint)(32 * 1024))
#define BOOTROM_RESTART_ADDR ((uint)0xff000104)
/* For our show_cpuinfo hooks. */
#define CPUINFO_VENDOR "Motorola"
#define CPUINFO_MACHINE "PQ2 ADS PowerPC"
/* The ADS8260 has 16, 32-bit wide control/status registers, accessed
* only on word boundaries.
* Not all are used (yet), or are interesting to us (yet).
*/
/* Things of interest in the CSR.
*/
#define BCSR0_LED0 ((uint)0x02000000) /* 0 == on */
#define BCSR0_LED1 ((uint)0x01000000) /* 0 == on */
#define BCSR1_FETHIEN ((uint)0x08000000) /* 0 == enable */
#define BCSR1_FETH_RST ((uint)0x04000000) /* 0 == reset */
#define BCSR1_RS232_EN1 ((uint)0x02000000) /* 0 == enable */
#define BCSR1_RS232_EN2 ((uint)0x01000000) /* 0 == enable */
#define BCSR3_FETHIEN2 ((uint)0x10000000) /* 0 == enable */
#define BCSR3_FETH2_RST ((uint)0x80000000) /* 0 == reset */
#define PHY_INTERRUPT SIU_INT_IRQ7
#ifdef CONFIG_PCI
/* PCI interrupt controller */
#define PCI_INT_STAT_REG 0xF8200000
#define PCI_INT_MASK_REG 0xF8200004
#define PIRQA (NR_CPM_INTS + 0)
#define PIRQB (NR_CPM_INTS + 1)
#define PIRQC (NR_CPM_INTS + 2)
#define PIRQD (NR_CPM_INTS + 3)
/*
* PCI memory map definitions for MPC8266ADS-PCI.
*
* processor view
* local address PCI address target
* 0x80000000-0x9FFFFFFF 0x80000000-0x9FFFFFFF PCI mem with prefetch
* 0xA0000000-0xBFFFFFFF 0xA0000000-0xBFFFFFFF PCI mem w/o prefetch
* 0xF4000000-0xF7FFFFFF 0x00000000-0x03FFFFFF PCI IO
*
* PCI master view
* local address PCI address target
* 0x00000000-0x1FFFFFFF 0x00000000-0x1FFFFFFF MPC8266 local memory
*/
/* All the other PCI memory map definitions reside at syslib/m82xx_pci.h
Here we should redefine what is unique for this board */
#define M82xx_PCI_SLAVE_MEM_LOCAL 0x00000000 /* Local base */
#define M82xx_PCI_SLAVE_MEM_BUS 0x00000000 /* PCI base */
#define M82xx_PCI_SLAVE_MEM_SIZE 0x10000000 /* 256 Mb */
#define M82xx_PCI_SLAVE_SEC_WND_SIZE ~(0x40000000 - 1U) /* 2 x 512Mb */
#define M82xx_PCI_SLAVE_SEC_WND_BASE 0x80000000 /* PCI Memory base */
#if defined(CONFIG_ADS8272)
#define PCI_INT_TO_SIU SIU_INT_IRQ2
#elif defined(CONFIG_PQ2FADS)
#define PCI_INT_TO_SIU SIU_INT_IRQ6
#else
#warning PCI Bridge will be without interrupts support
#endif
#endif /* CONFIG_PCI */
#endif /* __MACH_ADS8260_DEFS */
#endif /* __KERNEL__ */
|
// 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 CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REGISTRY_SYNCER_WIN_H_
#define CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REGISTRY_SYNCER_WIN_H_
#include "base/timer/timer.h"
namespace chrome_variations {
// This class manages synchronizing active VariationIDs with the Google Update
// experiment_labels value in the registry.
class VariationsRegistrySyncer {
public:
VariationsRegistrySyncer();
~VariationsRegistrySyncer();
// Starts a timer that, when it expires, updates the registry with the current
// Variations associated with Google Update. If the timer is already running,
// calling this just resets the timer.
void RequestRegistrySync();
private:
// Perform the actual synchronization process with the registry.
void SyncWithRegistry();
// A timer used to delay the writes to the registry. This is done to optimize
// the case where lazy-loaded features start their field trials some time
// after initial batch of field trials are created, and also to avoid blocking
// the UI thread. The timer effectively allows this class to batch together
// update requests, to avoid reading and writing from the registry too much.
base::OneShotTimer<VariationsRegistrySyncer> timer_;
DISALLOW_COPY_AND_ASSIGN(VariationsRegistrySyncer);
};
} // namespace chrome_variations
#endif // CHROME_BROWSER_METRICS_VARIATIONS_VARIATIONS_REGISTRY_SYNCER_WIN_H_
|
typedef unsigned long uintptr_t;
namespace v8 {
class Extension;
namespace internal {
class A {
public:
A(int) {};
};
class B {
public:
B(int) {};
};
class Scanner;
class FuncNameInferrer;
template <typename Traits> class ParserBase : Traits {
class FunctionState;
bool parenthesized_function_;
typename Traits::Type::Scope *scope_;
FunctionState *function_state_;
v8::Extension *extension_;
FuncNameInferrer *fni_;
Scanner *scanner_;
uintptr_t stack_limit_;
bool stack_overflow_;
bool allow_lazy_;
bool allow_natives_syntax_;
bool allow_generators_;
bool allow_for_of_;
typename Traits::Type::Zone *zone_;
};
class PreParserScope;
class F;
class PreParserTraits {
public:
struct Type {
typedef PreParserScope Scope;
typedef void Zone;
};
private:
F *pre_parser_;
};
class F : ParserBase<PreParserTraits> {};
class C {
public:
struct Type {
typedef v8::internal::FuncNameInferrer Scope;
typedef int Zone;
};
};
class G : ParserBase<C> {
public:
static int m_fn1();
static int test();
F reusable_preparser_;
};
class D {
public:
D(int a) : function_(0), context_(0), nested_scope_chain_(0) { G::test(); }
B function_;
B context_;
A nested_scope_chain_;
};
}
}
|
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort ();
extern void exit (int);
int x;
void
foo()
{
static int count;
count++;
if (count > 1)
abort ();
}
static inline int
frob ()
{
int a;
__asm__ ("mov %1, %0\n\t" : "=r" (a) : "m" (x));
x++;
return a;
}
int
main ()
{
int i;
for (i = 0; i < 10 && frob () == 0; i++)
foo();
exit (0);
}
|
/**
* \file pbkdf2.h
*
* \brief Password-Based Key Derivation Function 2 (from PKCS#5)
* DEPRECATED: use pkcs5.h instead.
*
* \author Mathias Olsson <mathias@kompetensum.com>
*
* Copyright (C) 2006-2012, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 POLARSSL_PBKDF2_H
#define POLARSSL_PBKDF2_H
#include <string.h>
#include "md.h"
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
#include <basetsd.h>
typedef UINT32 uint32_t;
#else
#include <inttypes.h>
#endif
#define POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA -0x007C /**< Bad input parameters to function. */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief PKCS#5 PBKDF2 using HMAC
* DEPRECATED: Use pkcs5_pbkdf2_hmac() instead!
*
* \param ctx Generic HMAC context
* \param password Password to use when generating key
* \param plen Length of password
* \param salt Salt to use when generating key
* \param slen Length of salt
* \param iteration_count Iteration count
* \param key_length Length of generated key
* \param output Generated key. Must be at least as big as key_length
*
* \returns 0 on success, or a PolarSSL error code if verification fails.
*/
int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
size_t plen, const unsigned char *salt, size_t slen,
unsigned int iteration_count,
uint32_t key_length, unsigned char *output );
/**
* \brief Checkup routine
* DEPRECATED: Use pkcs5_self_test() instead!
*
* \return 0 if successful, or 1 if the test failed
*/
int pbkdf2_self_test( int verbose );
#ifdef __cplusplus
}
#endif
#endif /* pbkdf2.h */
|
/* PR rtl-optimization/63637 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
int
foo (void)
{
int a, b, c;
asm ("# Magic instruction" : "=r" (a) : "r" (0) : "eax", "memory");
asm ("# Magic instruction" : "=r" (b) : "r" (0) : "edx", "memory");
asm ("# Magic instruction" : "=r" (c) : "r" (0) : "ecx", "memory");
return a + b + c;
}
/* { dg-final { scan-assembler-times "# Magic instruction" 3 } } */
|
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEF_STRATHOLME_H
#define DEF_STRATHOLME_H
#define TYPE_BARON_RUN 1
#define TYPE_BARONESS 2
#define TYPE_NERUB 3
#define TYPE_PALLID 4
#define TYPE_RAMSTEIN 5
#define TYPE_BARON 6
#define DATA_BARON 10
#define DATA_YSIDA_TRIGGER 11
#define TYPE_SH_QUEST 20
#define TYPE_SH_CATHELA 21
#define TYPE_SH_GREGOR 22
#define TYPE_SH_NEMAS 23
#define TYPE_SH_VICAR 24
#define TYPE_SH_AELMAR 25
#define QUEST_DEAD_MAN_PLEA 8945
#define SPELL_BARON_ULTIMATUM 27861
#endif
|
/*
* Copyright (c) 2017-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
/*
* This file contains the information of memory zones for code and data on
* ARM Versatile Express Cortex-M Prototyping Systems (V2M-MPS2) TRM.
* It is used in startup code and linker scripts of supported compilers (ARM and
* GCC_ARM).
*
* WARNING: IAR does not include this file and re-define these values in
* MPS2.icf file. Please make sure that the two files share the same values.
*
* These memory zones are defined in section 4.2 of ARM V2M-MPS2 RTL and
* Fast Model Reference Guide.
*/
#ifndef MEMORY_ZONES_H
#define MEMORY_ZONES_H
/*
* Code memory zones
* Please note that MPS2 on Fast Models do not implemented persistent flash memory.
* The FLASH memory can be simulated via 4MB ZBT_SRAM1 block
* only to keep the same name than in the CMSDK RTL and Fast Models Reference
* Guide.
*/
#define ZBT_SRAM1_START 0x00000000
#define ZBT_SRAM1_SIZE 0x00400000 /* 4 MiB */
/* Data memory zones */
#define ZBT_SRAM2_START 0x20000000
#define ZBT_SRAM2_SIZE 0x00400000 /* 4 MiB */
#endif /* MEMORY_ZONES_H */
|
/*
* Copyright (c) 2012, NVIDIA Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* 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 __TEGRA_IRQ_H
#define __TEGRA_IRQ_H
bool tegra_pending_sgi(void);
#ifdef CONFIG_PM_SLEEP
int tegra_legacy_irq_syscore_init(void);
#else
static inline int tegra_legacy_irq_syscore_init(void) { return 0; }
#endif
#endif
|
#ifndef __GENERIC_IO_H
#define __GENERIC_IO_H
#include <linux/linkage.h>
#include <asm/byteorder.h>
/*
* These are the "generic" interfaces for doing new-style
* memory-mapped or PIO accesses. Architectures may do
* their own arch-optimized versions, these just act as
* wrappers around the old-style IO register access functions:
* read[bwl]/write[bwl]/in[bwl]/out[bwl]
*
* Don't include this directly, include it from <asm/io.h>.
*/
/*
* Read/write from/to an (offsettable) iomem cookie. It might be a PIO
* access or a MMIO access, these functions don't care. The info is
* encoded in the hardware mapping set up by the mapping functions
* (or the cookie itself, depending on implementation and hw).
*
* The generic routines just encode the PIO/MMIO as part of the
* cookie, and coldly assume that the MMIO IO mappings are not
* in the low address range. Architectures for which this is not
* true can't use this generic implementation.
*/
extern unsigned int ioread8(void __iomem *);
extern unsigned int ioread16(void __iomem *);
extern unsigned int ioread16be(void __iomem *);
extern unsigned int ioread32(void __iomem *);
extern unsigned int ioread32be(void __iomem *);
extern void iowrite8(u8, void __iomem *);
extern void iowrite16(u16, void __iomem *);
extern void iowrite16be(u16, void __iomem *);
extern void iowrite32(u32, void __iomem *);
extern void iowrite32be(u32, void __iomem *);
/*
* "string" versions of the above. Note that they
* use native byte ordering for the accesses (on
* the assumption that IO and memory agree on a
* byte order, and CPU byteorder is irrelevant).
*
* They do _not_ update the port address. If you
* want MMIO that copies stuff laid out in MMIO
* memory across multiple ports, use "memcpy_toio()"
* and friends.
*/
extern void ioread8_rep(void __iomem *port, void *buf, unsigned long count);
extern void ioread16_rep(void __iomem *port, void *buf, unsigned long count);
extern void ioread32_rep(void __iomem *port, void *buf, unsigned long count);
extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count);
extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
/* Create a virtual mapping cookie for an IO port range */
extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
extern void ioport_unmap(void __iomem *);
#ifndef ARCH_HAS_IOREMAP_WC
#define ioremap_wc ioremap_nocache
#endif
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
#endif
|
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <asm/setup.h>
#include <asm/errno.h>
#include <asm/sizes.h>
#include <linux/mutex.h>
#include <mach/msm_memtypes.h>
#include "smd_private.h"
#if defined(CONFIG_ARCH_MSM8960)
#include "rpm_resources.h"
#endif
static struct mem_region_t {
u64 start;
u64 size;
/* reserved for future use */
u64 num_partitions;
int state;
int mask;
struct mutex state_mutex;
} mem_regions[MAX_NR_REGIONS];
static unsigned int nr_mem_regions;
enum {
STATE_POWER_DOWN = 0x0,
STATE_ACTIVE = 0x2,
STATE_DEFAULT = STATE_ACTIVE
};
static int default_mask = ~0x0;
/* Return the number of chipselects populated with a memory bank */
/* This is 7x30 only and will be re-implemented in the future */
#if defined(CONFIG_ARCH_MSM7X30)
unsigned int get_num_populated_chipselects()
{
/* Currently, Linux cannot determine the memory toplogy of a target */
/* This is a kludge until all this info is figured out from smem */
/* There is atleast one chipselect populated for hosting the 1st bank */
unsigned int num_chipselects = 1;
int i;
for (i = 0; i < meminfo.nr_banks; i++) {
struct membank *bank = &meminfo.bank[i];
if (bank->start == EBI1_PHYS_OFFSET)
num_chipselects++;
}
return num_chipselects;
}
#endif
#if defined(CONFIG_ARCH_MSM8960)
static int rpm_change_memory_state(int retention_mask,
int active_mask)
{
int ret;
struct msm_rpm_iv_pair cmd[2];
struct msm_rpm_iv_pair status[2];
cmd[0].id = MSM_RPM_ID_DDR_DMM_0;
cmd[1].id = MSM_RPM_ID_DDR_DMM_1;
status[0].id = MSM_RPM_STATUS_ID_DDR_DMM_0;
status[1].id = MSM_RPM_STATUS_ID_DDR_DMM_1;
cmd[0].value = retention_mask;
cmd[1].value = active_mask;
ret = msm_rpm_set(MSM_RPM_CTX_SET_0, cmd, 2);
if (ret < 0) {
pr_err("rpm set failed");
return -EINVAL;
}
ret = msm_rpm_get_status(status, 2);
if (ret < 0) {
pr_err("rpm status failed");
return -EINVAL;
}
if (status[0].value == retention_mask &&
status[1].value == active_mask)
return 0;
else {
pr_err("rpm failed to change memory state");
return -EINVAL;
}
}
static int switch_memory_state(int id, int new_state)
{
int mask;
int disable_masks[MAX_NR_REGIONS] = { 0xFFFFFF00, 0xFFFF00FF,
0xFF00FFFF, 0x00FFFFFF };
mutex_lock(&mem_regions[id].state_mutex);
if (new_state == mem_regions[id].state)
goto no_change;
if (new_state == STATE_POWER_DOWN)
mask = mem_regions[id].mask & disable_masks[id];
else if (new_state == STATE_ACTIVE)
mask = mem_regions[id].mask | (~disable_masks[id]);
/* For now we only support Deep Power Down */
/* So set the active and retention states as the same */
if (rpm_change_memory_state(mask, mask) == 0) {
mem_regions[id].state = new_state;
mem_regions[id].mask = mask;
mutex_unlock(&mem_regions[id].state_mutex);
return 0;
}
no_change:
mutex_unlock(&mem_regions[id].state_mutex);
return -EINVAL;
}
#else
static int switch_memory_state(int id, int new_state)
{
return -EINVAL;
}
#endif
/* The hotplug code expects the number of bytes that switched state successfully
* as the return value, so a return value of zero indicates an error
*/
int soc_change_memory_power(u64 start, u64 size, int change)
{
int i = 0;
int match = 0;
/* Find the memory region starting just below start */
for (i = 0; i < nr_mem_regions; i++) {
if (mem_regions[i].start <= start &&
mem_regions[i].start >= mem_regions[match].start) {
match = i;
}
}
if (start + size > mem_regions[match].start + mem_regions[match].size) {
pr_info("passed size exceeds size of memory bank\n");
return 0;
}
if (change != STATE_ACTIVE && change != STATE_POWER_DOWN) {
pr_info("requested state transition invalid\n");
return 0;
}
if (!switch_memory_state(match, change))
return size;
else
return 0;
}
unsigned int get_num_memory_banks(void)
{
return nr_mem_regions;
}
unsigned int get_memory_bank_size(unsigned int id)
{
BUG_ON(id >= nr_mem_regions);
return mem_regions[id].size;
}
unsigned int get_memory_bank_start(unsigned int id)
{
BUG_ON(id >= nr_mem_regions);
return mem_regions[id].start;
}
int __init meminfo_init(unsigned int type, unsigned int min_bank_size)
{
unsigned int i;
struct smem_ram_ptable *ram_ptable;
nr_mem_regions = 0;
ram_ptable = smem_alloc(SMEM_USABLE_RAM_PARTITION_TABLE,
sizeof(struct smem_ram_ptable));
if (!ram_ptable) {
pr_err("Could not read ram partition table\n");
return -EINVAL;
}
pr_info("meminfo_init: smem ram ptable found: ver: %d len: %d\n",
ram_ptable->version, ram_ptable->len);
for (i = 0; i < ram_ptable->len; i++) {
if (ram_ptable->parts[i].type == type &&
ram_ptable->parts[i].size >= min_bank_size) {
mem_regions[nr_mem_regions].start =
ram_ptable->parts[i].start;
mem_regions[nr_mem_regions].size =
ram_ptable->parts[i].size;
mutex_init(&mem_regions[nr_mem_regions].state_mutex);
mem_regions[nr_mem_regions].state = STATE_DEFAULT;
mem_regions[nr_mem_regions].mask = default_mask;
nr_mem_regions++;
}
}
pr_info("Found %d memory banks\n", nr_mem_regions);
return 0;
}
|
/*
* (C) Copyright 2003
* Murray Jensen, CSIRO-MIT, <Murray.Jensen@csiro.au>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
int
hymod_get_serno (const char *prompt)
{
for (;;) {
int n, serno;
char *p;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout ();
#endif
n = readline (prompt);
if (n < 0)
return (n);
if (n == 0)
continue;
serno = (int) simple_strtol (console_buffer, &p, 10);
if (p > console_buffer && *p == '\0' && serno > 0)
return (serno);
printf ("Invalid number (%s) - please re-enter\n",
console_buffer);
}
}
int
hymod_get_ethaddr (void)
{
for (;;) {
int n;
#ifdef CONFIG_BOOT_RETRY_TIME
reset_cmd_timeout ();
#endif
n = readline ("Enter board ethernet address: ");
if (n < 0)
return (n);
if (n == 0)
continue;
if (n == 17) {
int i;
char *p, *q;
/* see if it looks like an ethernet address */
p = console_buffer;
for (i = 0; i < 6; i++) {
char term = (i == 5 ? '\0' : ':');
(void)simple_strtol (p, &q, 16);
if ((q - p) != 2 || *q++ != term)
break;
p = q;
}
if (i == 6) {
/* it looks ok - set it */
printf ("Setting ethernet addr to %s\n",
console_buffer);
setenv ("ethaddr", console_buffer);
puts ("Remember to do a 'saveenv' to "
"make it permanent\n");
return (0);
}
}
printf ("Invalid ethernet addr (%s) - please re-enter\n",
console_buffer);
}
}
|
/*
* Copyright (c) 2009 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <net/mac80211.h>
#include "../ath.h"
#include "hw.h"
#include "hw-ops.h"
/* Common header for Atheros 802.11n base driver cores */
#define IEEE80211_WEP_NKID 4
#define WME_NUM_TID 16
#define WME_BA_BMP_SIZE 64
#define WME_MAX_BA WME_BA_BMP_SIZE
#define ATH_TID_MAX_BUFS (2 * WME_MAX_BA)
/* These must match mac80211 skb queue mapping numbers */
#define WME_AC_VO 0
#define WME_AC_VI 1
#define WME_AC_BE 2
#define WME_AC_BK 3
#define WME_NUM_AC 4
#define ATH_RSSI_DUMMY_MARKER 0x127
#define ATH_RSSI_LPF_LEN 10
#define RSSI_LPF_THRESHOLD -20
#define ATH_RSSI_EP_MULTIPLIER (1<<7)
#define ATH_EP_MUL(x, mul) ((x) * (mul))
#define ATH_RSSI_IN(x) (ATH_EP_MUL((x), ATH_RSSI_EP_MULTIPLIER))
#define ATH_LPF_RSSI(x, y, len) \
((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
#define ATH_RSSI_LPF(x, y) do { \
if ((y) >= RSSI_LPF_THRESHOLD) \
x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
} while (0)
#define ATH_EP_RND(x, mul) \
((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
/* Defines the BT AR_BT_COEX_WGHT used */
enum ath_stomp_type {
ATH_BTCOEX_NO_STOMP,
ATH_BTCOEX_STOMP_ALL,
ATH_BTCOEX_STOMP_LOW,
ATH_BTCOEX_STOMP_NONE
};
int ath9k_cmn_padpos(__le16 frame_control);
int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type);
struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
struct ath_hw *ah);
int ath9k_cmn_count_streams(unsigned int chainmask, int max);
void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
enum ath_stomp_type stomp_type);
|
#include <asm-m68k/timex.h>
|
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// 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 Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED 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.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// This header is logically internal, but is made public because it is used
// from protocol-compiler-generated code, which may reside in other components.
#ifndef GOOGLE_PROTOBUF_REFLECTION_OPS_H__
#define GOOGLE_PROTOBUF_REFLECTION_OPS_H__
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/message.h>
namespace google {
namespace protobuf {
namespace internal {
// Basic operations that can be performed using reflection.
// These can be used as a cheap way to implement the corresponding
// methods of the Message interface, though they are likely to be
// slower than implementations tailored for the specific message type.
//
// This class should stay limited to operations needed to implement
// the Message interface.
//
// This class is really a namespace that contains only static methods.
class LIBPROTOBUF_EXPORT ReflectionOps {
public:
static void Copy(const Message& from, Message* to);
static void Merge(const Message& from, Message* to);
static void Clear(Message* message);
static bool IsInitialized(const Message& message);
static void DiscardUnknownFields(Message* message);
// Finds all unset required fields in the message and adds their full
// paths (e.g. "foo.bar[5].baz") to *names. "prefix" will be attached to
// the front of each name.
static void FindInitializationErrors(const Message& message,
const string& prefix,
vector<string>* errors);
private:
// All methods are static. No need to construct.
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ReflectionOps);
};
} // namespace internal
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_REFLECTION_OPS_H__
|
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RemoteLayerTreeContext_h
#define RemoteLayerTreeContext_h
#include <WebCore/GraphicsLayerFactory.h>
#include <WebCore/Timer.h>
#include <wtf/Vector.h>
namespace WebKit {
class RemoteGraphicsLayer;
class RemoteLayerTreeTransaction;
class WebPage;
class RemoteLayerTreeContext : public WebCore::GraphicsLayerFactory {
public:
static PassOwnPtr<RemoteLayerTreeContext> create(WebPage*);
~RemoteLayerTreeContext();
void setRootLayer(WebCore::GraphicsLayer*);
void layerWillBeDestroyed(RemoteGraphicsLayer*);
void scheduleLayerFlush();
RemoteLayerTreeTransaction& currentTransaction();
private:
explicit RemoteLayerTreeContext(WebPage*);
// WebCore::GraphicsLayerFactory
virtual PassOwnPtr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient*) OVERRIDE;
void layerFlushTimerFired(WebCore::Timer<RemoteLayerTreeContext>*);
void flushLayers();
WebPage* m_webPage;
WebCore::Timer<RemoteLayerTreeContext> m_layerFlushTimer;
uint64_t m_rootLayerID;
Vector<uint64_t> m_destroyedLayers;
RemoteLayerTreeTransaction* m_currentTransaction;
};
} // namespace WebKit
#endif // RemoteLayerTreeContext_h
|
/*
* hostapd / IEEE 802.11 MLME
* Copyright 2003-2006, Jouni Malinen <j@w1.fi>
* Copyright 2003-2004, Instant802 Networks, Inc.
* Copyright 2005-2006, Devicescape Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#include "utils/includes.h"
#include "utils/common.h"
#include "common/ieee802_11_defs.h"
#include "ieee802_11.h"
#include "wpa_auth.h"
#include "sta_info.h"
#include "ap_mlme.h"
#ifndef CONFIG_NO_HOSTAPD_LOGGER
static const char * mlme_auth_alg_str(int alg)
{
switch (alg) {
case WLAN_AUTH_OPEN:
return "OPEN_SYSTEM";
case WLAN_AUTH_SHARED_KEY:
return "SHARED_KEY";
case WLAN_AUTH_FT:
return "FT";
}
return "unknown";
}
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
/**
* mlme_authenticate_indication - Report the establishment of an authentication
* relationship with a specific peer MAC entity
* @hapd: BSS data
* @sta: peer STA data
*
* MLME calls this function as a result of the establishment of an
* authentication relationship with a specific peer MAC entity that
* resulted from an authentication procedure that was initiated by
* that specific peer MAC entity.
*
* PeerSTAAddress = sta->addr
* AuthenticationType = sta->auth_alg (WLAN_AUTH_OPEN / WLAN_AUTH_SHARED_KEY)
*/
void mlme_authenticate_indication(struct hostapd_data *hapd,
struct sta_info *sta)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-AUTHENTICATE.indication(" MACSTR ", %s)",
MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg));
if (sta->auth_alg != WLAN_AUTH_FT && !(sta->flags & WLAN_STA_MFP))
mlme_deletekeys_request(hapd, sta);
}
/**
* mlme_deauthenticate_indication - Report the invalidation of an
* authentication relationship with a specific peer MAC entity
* @hapd: BSS data
* @sta: Peer STA data
* @reason_code: ReasonCode from Deauthentication frame
*
* MLME calls this function as a result of the invalidation of an
* authentication relationship with a specific peer MAC entity.
*
* PeerSTAAddress = sta->addr
*/
void mlme_deauthenticate_indication(struct hostapd_data *hapd,
struct sta_info *sta, u16 reason_code)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)",
MAC2STR(sta->addr), reason_code);
mlme_deletekeys_request(hapd, sta);
}
/**
* mlme_associate_indication - Report the establishment of an association with
* a specific peer MAC entity
* @hapd: BSS data
* @sta: peer STA data
*
* MLME calls this function as a result of the establishment of an
* association with a specific peer MAC entity that resulted from an
* association procedure that was initiated by that specific peer MAC entity.
*
* PeerSTAAddress = sta->addr
*/
void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-ASSOCIATE.indication(" MACSTR ")",
MAC2STR(sta->addr));
if (sta->auth_alg != WLAN_AUTH_FT)
mlme_deletekeys_request(hapd, sta);
}
/**
* mlme_reassociate_indication - Report the establishment of an reassociation
* with a specific peer MAC entity
* @hapd: BSS data
* @sta: peer STA data
*
* MLME calls this function as a result of the establishment of an
* reassociation with a specific peer MAC entity that resulted from a
* reassociation procedure that was initiated by that specific peer MAC entity.
*
* PeerSTAAddress = sta->addr
*
* sta->previous_ap contains the "Current AP" information from ReassocReq.
*/
void mlme_reassociate_indication(struct hostapd_data *hapd,
struct sta_info *sta)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-REASSOCIATE.indication(" MACSTR ")",
MAC2STR(sta->addr));
if (sta->auth_alg != WLAN_AUTH_FT)
mlme_deletekeys_request(hapd, sta);
}
/**
* mlme_disassociate_indication - Report disassociation with a specific peer
* MAC entity
* @hapd: BSS data
* @sta: Peer STA data
* @reason_code: ReasonCode from Disassociation frame
*
* MLME calls this function as a result of the invalidation of an association
* relationship with a specific peer MAC entity.
*
* PeerSTAAddress = sta->addr
*/
void mlme_disassociate_indication(struct hostapd_data *hapd,
struct sta_info *sta, u16 reason_code)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-DISASSOCIATE.indication(" MACSTR ", %d)",
MAC2STR(sta->addr), reason_code);
mlme_deletekeys_request(hapd, sta);
}
void mlme_michaelmicfailure_indication(struct hostapd_data *hapd,
const u8 *addr)
{
hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-MichaelMICFailure.indication(" MACSTR ")",
MAC2STR(addr));
}
void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta)
{
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
HOSTAPD_LEVEL_DEBUG,
"MLME-DELETEKEYS.request(" MACSTR ")",
MAC2STR(sta->addr));
if (sta->wpa_sm)
wpa_remove_ptk(sta->wpa_sm);
}
|
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_TRACE_SEQ_H
#define _LINUX_TRACE_SEQ_H
#include <linux/seq_buf.h>
#include <asm/page.h>
/*
* Trace sequences are used to allow a function to call several other functions
* to create a string of data to use (up to a max of PAGE_SIZE).
*/
struct trace_seq {
unsigned char buffer[PAGE_SIZE];
struct seq_buf seq;
int full;
};
static inline void
trace_seq_init(struct trace_seq *s)
{
seq_buf_init(&s->seq, s->buffer, PAGE_SIZE);
s->full = 0;
}
/**
* trace_seq_used - amount of actual data written to buffer
* @s: trace sequence descriptor
*
* Returns the amount of data written to the buffer.
*
* IMPORTANT!
*
* Use this instead of @s->seq.len if you need to pass the amount
* of data from the buffer to another buffer (userspace, or what not).
* The @s->seq.len on overflow is bigger than the buffer size and
* using it can cause access to undefined memory.
*/
static inline int trace_seq_used(struct trace_seq *s)
{
return seq_buf_used(&s->seq);
}
/**
* trace_seq_buffer_ptr - return pointer to next location in buffer
* @s: trace sequence descriptor
*
* Returns the pointer to the buffer where the next write to
* the buffer will happen. This is useful to save the location
* that is about to be written to and then return the result
* of that write.
*/
static inline unsigned char *
trace_seq_buffer_ptr(struct trace_seq *s)
{
return s->buffer + seq_buf_used(&s->seq);
}
/**
* trace_seq_has_overflowed - return true if the trace_seq took too much
* @s: trace sequence descriptor
*
* Returns true if too much data was added to the trace_seq and it is
* now full and will not take anymore.
*/
static inline bool trace_seq_has_overflowed(struct trace_seq *s)
{
return s->full || seq_buf_has_overflowed(&s->seq);
}
/*
* Currently only defined when tracing is enabled.
*/
#ifdef CONFIG_TRACING
extern __printf(2, 3)
void trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
extern __printf(2, 0)
void trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args);
extern void
trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
extern int trace_print_seq(struct seq_file *m, struct trace_seq *s);
extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
int cnt);
extern void trace_seq_puts(struct trace_seq *s, const char *str);
extern void trace_seq_putc(struct trace_seq *s, unsigned char c);
extern void trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len);
extern void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
unsigned int len);
extern int trace_seq_path(struct trace_seq *s, const struct path *path);
extern void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
int nmaskbits);
extern int trace_seq_hex_dump(struct trace_seq *s, const char *prefix_str,
int prefix_type, int rowsize, int groupsize,
const void *buf, size_t len, bool ascii);
#else /* CONFIG_TRACING */
static inline void trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
{
}
static inline void
trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
{
}
static inline void
trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
int nmaskbits)
{
}
static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
{
return 0;
}
static inline int trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
int cnt)
{
return 0;
}
static inline void trace_seq_puts(struct trace_seq *s, const char *str)
{
}
static inline void trace_seq_putc(struct trace_seq *s, unsigned char c)
{
}
static inline void
trace_seq_putmem(struct trace_seq *s, const void *mem, unsigned int len)
{
}
static inline void trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
unsigned int len)
{
}
static inline int trace_seq_path(struct trace_seq *s, const struct path *path)
{
return 0;
}
#endif /* CONFIG_TRACING */
#endif /* _LINUX_TRACE_SEQ_H */
|
#include <linux/unistd.h>
#include <linux/bpf.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <arpa/inet.h>
#include "libbpf.h"
#include "bpf_util.h"
#define MAX_INDEX 64
#define MAX_STARS 38
char bpf_log_buf[BPF_LOG_BUF_SIZE];
static void stars(char *str, long val, long max, int width)
{
int i;
for (i = 0; i < (width * val / max) - 1 && i < width - 1; i++)
str[i] = '*';
if (val > max)
str[i - 1] = '+';
str[i] = '\0';
}
int main(int argc, char **argv)
{
unsigned int nr_cpus = bpf_num_possible_cpus();
const char *map_filename = "/sys/fs/bpf/tc/globals/lwt_len_hist_map";
uint64_t values[nr_cpus], sum, max_value = 0, data[MAX_INDEX] = {};
uint64_t key = 0, next_key, max_key = 0;
char starstr[MAX_STARS];
int i, map_fd;
map_fd = bpf_obj_get(map_filename);
if (map_fd < 0) {
fprintf(stderr, "bpf_obj_get(%s): %s(%d)\n",
map_filename, strerror(errno), errno);
return -1;
}
while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) {
if (next_key >= MAX_INDEX) {
fprintf(stderr, "Key %lu out of bounds\n", next_key);
continue;
}
bpf_map_lookup_elem(map_fd, &next_key, values);
sum = 0;
for (i = 0; i < nr_cpus; i++)
sum += values[i];
data[next_key] = sum;
if (sum && next_key > max_key)
max_key = next_key;
if (sum > max_value)
max_value = sum;
key = next_key;
}
for (i = 1; i <= max_key + 1; i++) {
stars(starstr, data[i - 1], max_value, MAX_STARS);
printf("%8ld -> %-8ld : %-8ld |%-*s|\n",
(1l << i) >> 1, (1l << i) - 1, data[i - 1],
MAX_STARS, starstr);
}
close(map_fd);
return 0;
}
|
/******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
* which accompanies this distribution, and is available at
* http://www.opensource.org/licenses/bsd-license.php
*
* Contributors:
* IBM Corporation - initial implementation
*****************************************************************************/
#include <stdio.h>
int
fileno(FILE *stream)
{
return stream->fd;
}
|
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/cpu.h>
#define MODULE_NAME "msm_ebi_erp"
#define EBI_ERR_ADDR 0x100
#define SLV_ERR_APACKET_0 0x108
#define SLV_ERR_APACKET_1 0x10C
#define SLV_ERR_CNTL 0x114
#define CNTL_ERR_OCCURRED BIT(4)
#define CNTL_CLEAR_ERR BIT(8)
#define CNTL_IRQ_EN BIT(12)
#define AMID_MASK 0xFFFF
#define ERR_AWRITE BIT(0)
#define ERR_AOOOWR BIT(1)
#define ERR_AOOORD BIT(2)
#define ERR_APTORNS BIT(3)
#define ERR_ALOCK_SHIFT 6
#define ERR_ALOCK_MASK 0x3
#define ERR_ATYPE_SHIFT 8
#define ERR_ATYPE_MASK 0xF
#define ERR_ABURST BIT(12)
#define ERR_ASIZE_SHIFT 13
#define ERR_ASIZE_MASK 0x7
#define ERR_ATID_SHIFT 16
#define ERR_ATID_MASK 0xFF
#define ERR_ALEN_SHIFT 24
#define ERR_ALEN_MASK 0xF
#define ERR_CODE_DECODE_ERROR BIT(0)
#define ERR_CODE_MPU_ERROR BIT(1)
struct msm_ebi_erp_data {
void __iomem *base;
struct device *dev;
};
static const char *err_lock_types[4] = {
"normal",
"exclusive",
"locked",
"barrier",
};
static const char *err_sizes[8] = {
"byte",
"half word",
"word",
"double word",
"reserved_4",
"reserved_5",
"reserved_6",
"reserved_7",
};
static irqreturn_t msm_ebi_irq(int irq, void *dev_id)
{
struct msm_ebi_erp_data *drvdata = dev_id;
void __iomem *base = drvdata->base;
unsigned int err_addr, err_apacket0, err_apacket1, err_cntl;
err_addr = readl_relaxed(base + EBI_ERR_ADDR);
err_apacket0 = readl_relaxed(base + SLV_ERR_APACKET_0);
err_apacket1 = readl_relaxed(base + SLV_ERR_APACKET_1);
err_cntl = readl_relaxed(base + SLV_ERR_CNTL);
if (!(err_cntl & CNTL_ERR_OCCURRED))
return IRQ_NONE;
pr_alert("EBI error detected!\n");
pr_alert("\tDevice = %s\n", dev_name(drvdata->dev));
pr_alert("\tERR_ADDR = 0x%08x\n", err_addr);
pr_alert("\tAPACKET0 = 0x%08x\n", err_apacket0);
pr_alert("\tAPACKET1 = 0x%08x\n", err_apacket1);
pr_alert("\tERR_CNTL = 0x%08x\n", err_cntl);
pr_alert("\tAMID = 0x%08x\n", err_apacket0 & AMID_MASK);
pr_alert("\tType = %s, %s, %s\n",
err_apacket1 & ERR_AWRITE ? "write" : "read",
err_sizes[(err_apacket1 >> ERR_ASIZE_SHIFT) & ERR_ASIZE_MASK],
err_apacket1 & ERR_APTORNS ? "non-secure" : "secure");
pr_alert("\tALOCK = %s\n",
err_lock_types[(err_apacket1 >> ERR_ALOCK_SHIFT) & ERR_ALOCK_MASK]);
pr_alert("\tABURST = %s\n", err_apacket1 & ERR_ABURST ?
"increment" : "wrap");
pr_alert("\tCODE = %s %s\n", err_cntl & ERR_CODE_DECODE_ERROR ?
"decode error" : "",
err_cntl & ERR_CODE_MPU_ERROR ?
"mpu error" : "");
err_cntl |= CNTL_CLEAR_ERR;
writel_relaxed(err_cntl, base + SLV_ERR_CNTL);
mb(); /* Ensure interrupt is cleared before returning */
return IRQ_HANDLED;
}
static int __devinit msm_ebi_erp_probe(struct platform_device *pdev)
{
struct resource *r;
struct msm_ebi_erp_data *drvdata;
int ret, irq;
unsigned int err_cntl;
drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
drvdata->dev = &pdev->dev;
platform_set_drvdata(pdev, drvdata);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r)
return -EINVAL;
drvdata->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
if (!drvdata->base)
return -ENOMEM;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
ret = devm_request_irq(&pdev->dev, irq, msm_ebi_irq, IRQF_TRIGGER_HIGH,
dev_name(&pdev->dev), drvdata);
if (ret)
return ret;
/* Enable the interrupt */
err_cntl = readl_relaxed(drvdata->base + SLV_ERR_CNTL);
err_cntl |= CNTL_IRQ_EN;
writel_relaxed(err_cntl, drvdata->base + SLV_ERR_CNTL);
mb(); /* Ensure interrupt is enabled before returning */
return 0;
}
static int msm_ebi_erp_remove(struct platform_device *pdev)
{
struct msm_ebi_erp_data *drvdata = platform_get_drvdata(pdev);
unsigned int err_cntl;
/* Disable the interrupt */
err_cntl = readl_relaxed(drvdata->base + SLV_ERR_CNTL);
err_cntl &= ~CNTL_IRQ_EN;
writel_relaxed(err_cntl, drvdata->base + SLV_ERR_CNTL);
mb(); /* Ensure interrupt is disabled before returning */
return 0;
}
static struct platform_driver msm_ebi_erp_driver = {
.probe = msm_ebi_erp_probe,
.remove = __devexit_p(msm_ebi_erp_remove),
.driver = {
.name = MODULE_NAME,
.owner = THIS_MODULE,
},
};
static int __init msm_ebi_erp_init(void)
{
return platform_driver_register(&msm_ebi_erp_driver);
}
static void __exit msm_ebi_erp_exit(void)
{
platform_driver_unregister(&msm_ebi_erp_driver);
}
module_init(msm_ebi_erp_init);
module_exit(msm_ebi_erp_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("MSM cache error reporting driver");
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */
extern void abort (void) __attribute__ ((__noreturn__));
union tree_node;
typedef union tree_node *tree;
enum tree_code
{
ERROR_MARK,
COND_EXPR = 42,
};
extern const unsigned char tree_code_length[];
struct tree_common
{
enum tree_code code:8;
};
union tree_node
{
struct tree_common common;
};
void
blah (tree t)
{
if (t->common.code != COND_EXPR)
abort ();
if (1 >= tree_code_length[t->common.code])
abort ();
}
/* { dg-final { scan-tree-dump-times "tree_code_length.42." 1 "vrp1" } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */
|
// -*- C++ -*-
//=============================================================================
/**
* @file OS_NS_sys_select.h
*
* $Id: OS_NS_sys_select.h 80826 2008-03-04 14:51:23Z wotte $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
* @author Jesper S. M|ller<stophph@diku.dk>
* @author and a cast of thousands...
*
* Originally in OS.h.
*/
//=============================================================================
#ifndef ACE_OS_NS_SYS_SELECT_H
# define ACE_OS_NS_SYS_SELECT_H
# include /**/ "ace/pre.h"
# include "ace/config-all.h"
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
// The following is needed for Mac OSX 10.2 (Jaguar). Mac OSX 10.3 (Panther)
// doesn't seem to have this issue.
#if defined (ACE_SYS_SELECT_NEEDS_UNISTD_H)
#include "ace/OS_NS_unistd.h"
#endif
#include "ace/os_include/sys/os_select.h"
#include /**/ "ace/ACE_export.h"
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Time_Value;
namespace ACE_OS
{
// Should be moved to cpp or inl.
ACE_NAMESPACE_INLINE_FUNCTION
int select (int width,
fd_set *rfds,
fd_set *wfds = 0,
fd_set *efds = 0,
const ACE_Time_Value *tv = 0);
ACE_NAMESPACE_INLINE_FUNCTION
int select (int width,
fd_set *rfds,
fd_set *wfds,
fd_set *efds,
const ACE_Time_Value &tv);
} /* namespace ACE_OS */
ACE_END_VERSIONED_NAMESPACE_DECL
# if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
# endif /* ACE_INLINE */
# define ACE_INLINE inline
# include "ace/OS_NS_sys_select.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_SELECT_H */
|
/*
zip_add_dir.c -- add directory
Copyright (C) 1999-2013 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
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 of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _ZIP_COMPILING_DEPRECATED
#include "zipint.h"
/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */
ZIP_EXTERN zip_int64_t
zip_add_dir(struct zip *za, const char *name)
{
return zip_dir_add(za, name, 0);
}
|
/* SPDX-License-Identifier: GPL-2.0 */
#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include "../kselftest.h"
#include "clone3_selftests.h"
#ifndef CLONE_CLEAR_SIGHAND
#define CLONE_CLEAR_SIGHAND 0x100000000ULL
#endif
static void nop_handler(int signo)
{
}
static int wait_for_pid(pid_t pid)
{
int status, ret;
again:
ret = waitpid(pid, &status, 0);
if (ret == -1) {
if (errno == EINTR)
goto again;
return -1;
}
if (!WIFEXITED(status))
return -1;
return WEXITSTATUS(status);
}
static void test_clone3_clear_sighand(void)
{
int ret;
pid_t pid;
struct __clone_args args = {};
struct sigaction act;
/*
* Check that CLONE_CLEAR_SIGHAND and CLONE_SIGHAND are mutually
* exclusive.
*/
args.flags |= CLONE_CLEAR_SIGHAND | CLONE_SIGHAND;
args.exit_signal = SIGCHLD;
pid = sys_clone3(&args, sizeof(args));
if (pid > 0)
ksft_exit_fail_msg(
"clone3(CLONE_CLEAR_SIGHAND | CLONE_SIGHAND) succeeded\n");
act.sa_handler = nop_handler;
ret = sigemptyset(&act.sa_mask);
if (ret < 0)
ksft_exit_fail_msg("%s - sigemptyset() failed\n",
strerror(errno));
act.sa_flags = 0;
/* Register signal handler for SIGUSR1 */
ret = sigaction(SIGUSR1, &act, NULL);
if (ret < 0)
ksft_exit_fail_msg(
"%s - sigaction(SIGUSR1, &act, NULL) failed\n",
strerror(errno));
/* Register signal handler for SIGUSR2 */
ret = sigaction(SIGUSR2, &act, NULL);
if (ret < 0)
ksft_exit_fail_msg(
"%s - sigaction(SIGUSR2, &act, NULL) failed\n",
strerror(errno));
/* Check that CLONE_CLEAR_SIGHAND works. */
args.flags = CLONE_CLEAR_SIGHAND;
pid = sys_clone3(&args, sizeof(args));
if (pid < 0)
ksft_exit_fail_msg("%s - clone3(CLONE_CLEAR_SIGHAND) failed\n",
strerror(errno));
if (pid == 0) {
ret = sigaction(SIGUSR1, NULL, &act);
if (ret < 0)
exit(EXIT_FAILURE);
if (act.sa_handler != SIG_DFL)
exit(EXIT_FAILURE);
ret = sigaction(SIGUSR2, NULL, &act);
if (ret < 0)
exit(EXIT_FAILURE);
if (act.sa_handler != SIG_DFL)
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
ret = wait_for_pid(pid);
if (ret)
ksft_exit_fail_msg(
"Failed to clear signal handler for child process\n");
ksft_test_result_pass("Cleared signal handlers for child process\n");
}
int main(int argc, char **argv)
{
ksft_print_header();
ksft_set_plan(1);
test_clone3_supported();
test_clone3_clear_sighand();
return ksft_exit_pass();
}
|
/*
* Copyright (C) 2011-2012 NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA
*/
#ifndef __MACH_TEGRA_MEMORY_H
#define __MACH_TEGRA_MEMORY_H
/*
* Unaligned DMA causes tegra dma to place data on 4-byte boundary after
* expected address. Call to skb_reserve(skb, NET_IP_ALIGN) was causing skb
* buffers in usbnet.c and u_ether.c to become unaligned.
*/
#define NET_IP_ALIGN 0
#endif
|
/*
** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
#if defined(LUA_COMPAT_GETN)
LUALIB_API int (luaL_getn) (lua_State *L, int t);
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
#else
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */
#endif
#if defined(LUA_COMPAT_OPENLIB)
#define luaI_openlib luaL_openlib
#endif
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
const luaL_Reg *l);
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
const char *name);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
const char *fname, int szhint);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_argcheck(L, cond,numarg,extramsg) \
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *p; /* current position in buffer */
int lvl; /* number of strings in the stack (level) */
lua_State *L;
char buffer[LUAL_BUFFERSIZE];
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
(*(B)->p++ = (char)(c)))
/* compatibility only */
#define luaL_putchar(B,c) luaL_addchar(B,c)
#define luaL_addsize(B,n) ((B)->p += (n))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
/* }====================================================== */
/* compatibility with ref system */
/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
#define luaL_reg luaL_Reg
#endif
|
/*
* Copyright (c) 2016 Hisilicon Limited.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above
* copyright notice, this list of conditions and the following
* disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <linux/platform_device.h>
#include "hns_roce_device.h"
static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
{
return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn);
}
static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
{
hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn, BITMAP_NO_RR);
}
int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev)
{
return hns_roce_bitmap_init(&hr_dev->pd_bitmap, hr_dev->caps.num_pds,
hr_dev->caps.num_pds - 1,
hr_dev->caps.reserved_pds, 0);
}
void hns_roce_cleanup_pd_table(struct hns_roce_dev *hr_dev)
{
hns_roce_bitmap_cleanup(&hr_dev->pd_bitmap);
}
struct ib_pd *hns_roce_alloc_pd(struct ib_device *ib_dev,
struct ib_ucontext *context,
struct ib_udata *udata)
{
struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);
struct device *dev = &hr_dev->pdev->dev;
struct hns_roce_pd *pd;
int ret;
pd = kmalloc(sizeof(*pd), GFP_KERNEL);
if (!pd)
return ERR_PTR(-ENOMEM);
ret = hns_roce_pd_alloc(to_hr_dev(ib_dev), &pd->pdn);
if (ret) {
kfree(pd);
dev_err(dev, "[alloc_pd]hns_roce_pd_alloc failed!\n");
return ERR_PTR(ret);
}
if (context) {
if (ib_copy_to_udata(udata, &pd->pdn, sizeof(u64))) {
hns_roce_pd_free(to_hr_dev(ib_dev), pd->pdn);
dev_err(dev, "[alloc_pd]ib_copy_to_udata failed!\n");
kfree(pd);
return ERR_PTR(-EFAULT);
}
}
return &pd->ibpd;
}
int hns_roce_dealloc_pd(struct ib_pd *pd)
{
hns_roce_pd_free(to_hr_dev(pd->device), to_hr_pd(pd)->pdn);
kfree(to_hr_pd(pd));
return 0;
}
int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
{
struct resource *res;
int ret = 0;
/* Using bitmap to manager UAR index */
ret = hns_roce_bitmap_alloc(&hr_dev->uar_table.bitmap, &uar->index);
if (ret == -1)
return -ENOMEM;
if (uar->index > 0)
uar->index = (uar->index - 1) %
(hr_dev->caps.phy_num_uars - 1) + 1;
res = platform_get_resource(hr_dev->pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&hr_dev->pdev->dev, "memory resource not found!\n");
return -EINVAL;
}
uar->pfn = ((res->start) >> PAGE_SHIFT) + uar->index;
return 0;
}
void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
{
hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->index,
BITMAP_NO_RR);
}
int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev)
{
return hns_roce_bitmap_init(&hr_dev->uar_table.bitmap,
hr_dev->caps.num_uars,
hr_dev->caps.num_uars - 1,
hr_dev->caps.reserved_uars, 0);
}
void hns_roce_cleanup_uar_table(struct hns_roce_dev *hr_dev)
{
hns_roce_bitmap_cleanup(&hr_dev->uar_table.bitmap);
}
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __javax_swing_event_TableModelListener__
#define __javax_swing_event_TableModelListener__
#pragma interface
#include <java/lang/Object.h>
extern "Java"
{
namespace javax
{
namespace swing
{
namespace event
{
class TableModelEvent;
class TableModelListener;
}
}
}
}
class javax::swing::event::TableModelListener : public ::java::lang::Object
{
public:
virtual void tableChanged(::javax::swing::event::TableModelEvent *) = 0;
static ::java::lang::Class class$;
} __attribute__ ((java_interface));
#endif // __javax_swing_event_TableModelListener__
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __gnu_javax_crypto_key_dh_GnuDHKey__
#define __gnu_javax_crypto_key_dh_GnuDHKey__
#pragma interface
#include <java/lang/Object.h>
#include <gcj/array.h>
extern "Java"
{
namespace gnu
{
namespace javax
{
namespace crypto
{
namespace key
{
namespace dh
{
class GnuDHKey;
}
}
}
}
}
namespace java
{
namespace math
{
class BigInteger;
}
}
namespace javax
{
namespace crypto
{
namespace spec
{
class DHParameterSpec;
}
}
}
}
class gnu::javax::crypto::key::dh::GnuDHKey : public ::java::lang::Object
{
public: // actually protected
GnuDHKey(jint, ::java::math::BigInteger *, ::java::math::BigInteger *, ::java::math::BigInteger *);
public:
virtual ::javax::crypto::spec::DHParameterSpec * getParams();
virtual ::java::lang::String * getAlgorithm();
virtual JArray< jbyte > * getEncoded();
virtual ::java::lang::String * getFormat();
virtual ::java::math::BigInteger * getQ();
virtual jboolean equals(::java::lang::Object *);
virtual ::java::lang::String * toString();
virtual JArray< jbyte > * getEncoded(jint) = 0;
public: // actually protected
::java::math::BigInteger * __attribute__((aligned(__alignof__( ::java::lang::Object)))) q;
::java::math::BigInteger * p;
::java::math::BigInteger * g;
jint defaultFormat;
private:
::java::lang::String * str;
public:
static ::java::lang::Class class$;
};
#endif // __gnu_javax_crypto_key_dh_GnuDHKey__
|
/*
* AD193X Audio Codec driver
*
* Copyright 2010 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#ifndef __AD193X_H__
#define __AD193X_H__
#define AD193X_PLL_CLK_CTRL0 0x800
#define AD193X_PLL_POWERDOWN 0x01
#define AD193X_PLL_INPUT_MASK (~0x6)
#define AD193X_PLL_INPUT_256 (0 << 1)
#define AD193X_PLL_INPUT_384 (1 << 1)
#define AD193X_PLL_INPUT_512 (2 << 1)
#define AD193X_PLL_INPUT_768 (3 << 1)
#define AD193X_PLL_CLK_CTRL1 0x801
#define AD193X_DAC_CTRL0 0x802
#define AD193X_DAC_POWERDOWN 0x01
#define AD193X_DAC_SERFMT_MASK 0xC0
#define AD193X_DAC_SERFMT_STEREO (0 << 6)
#define AD193X_DAC_SERFMT_TDM (1 << 6)
#define AD193X_DAC_CTRL1 0x803
#define AD193X_DAC_2_CHANNELS 0
#define AD193X_DAC_4_CHANNELS 1
#define AD193X_DAC_8_CHANNELS 2
#define AD193X_DAC_16_CHANNELS 3
#define AD193X_DAC_CHAN_SHFT 1
#define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT)
#define AD193X_DAC_LCR_MASTER (1 << 4)
#define AD193X_DAC_BCLK_MASTER (1 << 5)
#define AD193X_DAC_LEFT_HIGH (1 << 3)
#define AD193X_DAC_BCLK_INV (1 << 7)
#define AD193X_DAC_CTRL2 0x804
#define AD193X_DAC_WORD_LEN_MASK 0xC
#define AD193X_DAC_MASTER_MUTE 1
#define AD193X_DAC_CHNL_MUTE 0x805
#define AD193X_DACL1_MUTE 0
#define AD193X_DACR1_MUTE 1
#define AD193X_DACL2_MUTE 2
#define AD193X_DACR2_MUTE 3
#define AD193X_DACL3_MUTE 4
#define AD193X_DACR3_MUTE 5
#define AD193X_DACL4_MUTE 6
#define AD193X_DACR4_MUTE 7
#define AD193X_DAC_L1_VOL 0x806
#define AD193X_DAC_R1_VOL 0x807
#define AD193X_DAC_L2_VOL 0x808
#define AD193X_DAC_R2_VOL 0x809
#define AD193X_DAC_L3_VOL 0x80a
#define AD193X_DAC_R3_VOL 0x80b
#define AD193X_DAC_L4_VOL 0x80c
#define AD193X_DAC_R4_VOL 0x80d
#define AD193X_ADC_CTRL0 0x80e
#define AD193X_ADC_POWERDOWN 0x01
#define AD193X_ADC_HIGHPASS_FILTER 1
#define AD193X_ADCL1_MUTE 2
#define AD193X_ADCR1_MUTE 3
#define AD193X_ADCL2_MUTE 4
#define AD193X_ADCR2_MUTE 5
#define AD193X_ADC_CTRL1 0x80f
#define AD193X_ADC_SERFMT_MASK 0x60
#define AD193X_ADC_SERFMT_STEREO (0 << 5)
#define AD193X_ADC_SERFMT_TDM (1 << 2)
#define AD193X_ADC_SERFMT_AUX (2 << 5)
#define AD193X_ADC_WORD_LEN_MASK 0x3
#define AD193X_ADC_CTRL2 0x810
#define AD193X_ADC_2_CHANNELS 0
#define AD193X_ADC_4_CHANNELS 1
#define AD193X_ADC_8_CHANNELS 2
#define AD193X_ADC_16_CHANNELS 3
#define AD193X_ADC_CHAN_SHFT 4
#define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT)
#define AD193X_ADC_LCR_MASTER (1 << 3)
#define AD193X_ADC_BCLK_MASTER (1 << 6)
#define AD193X_ADC_LEFT_HIGH (1 << 2)
#define AD193X_ADC_BCLK_INV (1 << 1)
#define AD193X_NUM_REGS 17
#endif
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "peripherals/bus/PeripheralBus.h"
#include "peripherals/devices/Peripheral.h"
struct usb_bus;
namespace PERIPHERALS
{
class CPeripherals;
class CPeripheralBusUSB : public CPeripheralBus
{
public:
CPeripheralBusUSB(CPeripherals *manager);
/*!
* @see PeripheralBus::PerformDeviceScan()
*/
bool PerformDeviceScan(PeripheralScanResults &results);
protected:
static const PeripheralType GetType(int iDeviceClass);
struct usb_bus *m_busses;
};
}
|
// SPDX-License-Identifier: LGPL-2.1
/*
* trace/beauty/statx.c
*
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "trace/beauty/beauty.h"
#include <linux/kernel.h>
#include <sys/types.h>
#include <uapi/linux/fcntl.h>
#include <uapi/linux/stat.h>
size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_arg *arg)
{
bool show_prefix = arg->show_string_prefix;
const char *prefix = "AT_";
int printed = 0, flags = arg->val;
if (flags == 0)
return scnprintf(bf, size, "%s%s", show_prefix ? "AT_STATX_" : "", "SYNC_AS_STAT");
#define P_FLAG(n) \
if (flags & AT_##n) { \
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
flags &= ~AT_##n; \
}
P_FLAG(SYMLINK_NOFOLLOW);
P_FLAG(REMOVEDIR);
P_FLAG(SYMLINK_FOLLOW);
P_FLAG(NO_AUTOMOUNT);
P_FLAG(EMPTY_PATH);
P_FLAG(STATX_FORCE_SYNC);
P_FLAG(STATX_DONT_SYNC);
#undef P_FLAG
if (flags)
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
return printed;
}
size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_arg *arg)
{
bool show_prefix = arg->show_string_prefix;
const char *prefix = "STATX_";
int printed = 0, flags = arg->val;
#define P_FLAG(n) \
if (flags & STATX_##n) { \
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
flags &= ~STATX_##n; \
}
P_FLAG(TYPE);
P_FLAG(MODE);
P_FLAG(NLINK);
P_FLAG(UID);
P_FLAG(GID);
P_FLAG(ATIME);
P_FLAG(MTIME);
P_FLAG(CTIME);
P_FLAG(INO);
P_FLAG(SIZE);
P_FLAG(BLOCKS);
P_FLAG(BTIME);
#undef P_FLAG
if (flags)
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
return printed;
}
|
#ifndef __NVKM_LTC_H__
#define __NVKM_LTC_H__
#include <core/subdev.h>
#include <core/mm.h>
#define NVKM_LTC_MAX_ZBC_CNT 16
struct nvkm_ltc {
const struct nvkm_ltc_func *func;
struct nvkm_subdev subdev;
u32 ltc_nr;
u32 lts_nr;
u32 num_tags;
u32 tag_base;
struct nvkm_mm tags;
struct nvkm_mm_node *tag_ram;
int zbc_min;
int zbc_max;
u32 zbc_color[NVKM_LTC_MAX_ZBC_CNT][4];
u32 zbc_depth[NVKM_LTC_MAX_ZBC_CNT];
};
int nvkm_ltc_tags_alloc(struct nvkm_ltc *, u32 count, struct nvkm_mm_node **);
void nvkm_ltc_tags_free(struct nvkm_ltc *, struct nvkm_mm_node **);
void nvkm_ltc_tags_clear(struct nvkm_ltc *, u32 first, u32 count);
int nvkm_ltc_zbc_color_get(struct nvkm_ltc *, int index, const u32[4]);
int nvkm_ltc_zbc_depth_get(struct nvkm_ltc *, int index, const u32);
void nvkm_ltc_invalidate(struct nvkm_ltc *);
void nvkm_ltc_flush(struct nvkm_ltc *);
int gf100_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gk104_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gk20a_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
int gm107_ltc_new(struct nvkm_device *, int, struct nvkm_ltc **);
#endif
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#import <FBSDKCoreKit/FBSDKGraphRequestConnection.h>
@interface FBSDKGraphRequestConnection(Internal)
@property (nonatomic, readonly) NSMutableArray *requests;
@end
|
/*
* Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_CIRCLE_CONTACT_H
#define B2_CIRCLE_CONTACT_H
#include <Box2D/Dynamics/Contacts/b2Contact.h>
class b2BlockAllocator;
class b2CircleContact : public b2Contact
{
public:
static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
~b2CircleContact() {}
void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
};
#endif
|
/*
* arch/sh/kernel/process.c
*
* This file handles the architecture-dependent parts of process handling..
*
* Copyright (C) 1995 Linus Torvalds
*
* SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
* Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
* Copyright (C) 2002 - 2008 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/elfcore.h>
#include <linux/kallsyms.h>
#include <linux/fs.h>
#include <linux/ftrace.h>
#include <linux/hw_breakpoint.h>
#include <linux/prefetch.h>
#include <linux/stackprotector.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/fpu.h>
#include <asm/syscalls.h>
#include <asm/switch_to.h>
void show_regs(struct pt_regs * regs)
{
printk("\n");
show_regs_print_info(KERN_DEFAULT);
print_symbol("PC is at %s\n", instruction_pointer(regs));
print_symbol("PR is at %s\n", regs->pr);
printk("PC : %08lx SP : %08lx SR : %08lx ",
regs->pc, regs->regs[15], regs->sr);
#ifdef CONFIG_MMU
printk("TEA : %08x\n", __raw_readl(MMU_TEA));
#else
printk("\n");
#endif
printk("R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
regs->regs[0],regs->regs[1],
regs->regs[2],regs->regs[3]);
printk("R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
regs->regs[4],regs->regs[5],
regs->regs[6],regs->regs[7]);
printk("R8 : %08lx R9 : %08lx R10 : %08lx R11 : %08lx\n",
regs->regs[8],regs->regs[9],
regs->regs[10],regs->regs[11]);
printk("R12 : %08lx R13 : %08lx R14 : %08lx\n",
regs->regs[12],regs->regs[13],
regs->regs[14]);
printk("MACH: %08lx MACL: %08lx GBR : %08lx PR : %08lx\n",
regs->mach, regs->macl, regs->gbr, regs->pr);
show_trace(NULL, (unsigned long *)regs->regs[15], regs);
show_code(regs);
}
void start_thread(struct pt_regs *regs, unsigned long new_pc,
unsigned long new_sp)
{
regs->pr = 0;
regs->sr = SR_FD;
regs->pc = new_pc;
regs->regs[15] = new_sp;
free_thread_xstate(current);
}
EXPORT_SYMBOL(start_thread);
void flush_thread(void)
{
struct task_struct *tsk = current;
flush_ptrace_hw_breakpoint(tsk);
#if defined(CONFIG_SH_FPU)
/* Forget lazy FPU state */
clear_fpu(tsk, task_pt_regs(tsk));
clear_used_math();
#endif
}
void release_thread(struct task_struct *dead_task)
{
/* do nothing */
}
/* Fill in the fpu structure for a core dump.. */
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
{
int fpvalid = 0;
#if defined(CONFIG_SH_FPU)
struct task_struct *tsk = current;
fpvalid = !!tsk_used_math(tsk);
if (fpvalid)
fpvalid = !fpregs_get(tsk, NULL, 0,
sizeof(struct user_fpu_struct),
fpu, NULL);
#endif
return fpvalid;
}
EXPORT_SYMBOL(dump_fpu);
asmlinkage void ret_from_fork(void);
asmlinkage void ret_from_kernel_thread(void);
int copy_thread(unsigned long clone_flags, unsigned long usp,
unsigned long arg, struct task_struct *p)
{
struct thread_info *ti = task_thread_info(p);
struct pt_regs *childregs;
#if defined(CONFIG_SH_DSP)
struct task_struct *tsk = current;
if (is_dsp_enabled(tsk)) {
/* We can use the __save_dsp or just copy the struct:
* __save_dsp(p);
* p->thread.dsp_status.status |= SR_DSP
*/
p->thread.dsp_status = tsk->thread.dsp_status;
}
#endif
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
childregs = task_pt_regs(p);
p->thread.sp = (unsigned long) childregs;
if (unlikely(p->flags & PF_KTHREAD)) {
memset(childregs, 0, sizeof(struct pt_regs));
p->thread.pc = (unsigned long) ret_from_kernel_thread;
childregs->regs[4] = arg;
childregs->regs[5] = usp;
childregs->sr = SR_MD;
#if defined(CONFIG_SH_FPU)
childregs->sr |= SR_FD;
#endif
ti->addr_limit = KERNEL_DS;
ti->status &= ~TS_USEDFPU;
p->thread.fpu_counter = 0;
return 0;
}
*childregs = *current_pt_regs();
if (usp)
childregs->regs[15] = usp;
ti->addr_limit = USER_DS;
if (clone_flags & CLONE_SETTLS)
childregs->gbr = childregs->regs[0];
childregs->regs[0] = 0; /* Set return value for child */
p->thread.pc = (unsigned long) ret_from_fork;
return 0;
}
/*
* switch_to(x,y) should switch tasks from x to y.
*
*/
__notrace_funcgraph struct task_struct *
__switch_to(struct task_struct *prev, struct task_struct *next)
{
struct thread_struct *next_t = &next->thread;
#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
__stack_chk_guard = next->stack_canary;
#endif
unlazy_fpu(prev, task_pt_regs(prev));
/* we're going to use this soon, after a few expensive things */
if (next->thread.fpu_counter > 5)
prefetch(next_t->xstate);
#ifdef CONFIG_MMU
/*
* Restore the kernel mode register
* k7 (r7_bank1)
*/
asm volatile("ldc %0, r7_bank"
: /* no output */
: "r" (task_thread_info(next)));
#endif
/*
* If the task has used fpu the last 5 timeslices, just do a full
* restore of the math state immediately to avoid the trap; the
* chances of needing FPU soon are obviously high now
*/
if (next->thread.fpu_counter > 5)
__fpu_state_restore();
return prev;
}
unsigned long get_wchan(struct task_struct *p)
{
unsigned long pc;
if (!p || p == current || p->state == TASK_RUNNING)
return 0;
/*
* The same comment as on the Alpha applies here, too ...
*/
pc = thread_saved_pc(p);
#ifdef CONFIG_FRAME_POINTER
if (in_sched_functions(pc)) {
unsigned long schedule_frame = (unsigned long)p->thread.sp;
return ((unsigned long *)schedule_frame)[21];
}
#endif
return pc;
}
|
/***********************license start***************
* Author: Cavium Networks
*
* Contact: support@caviumnetworks.com
* This file is part of the OCTEON SDK
*
* Copyright (c) 2003-2008 Cavium Networks
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, Version 2, as
* published by the Free Software Foundation.
*
* This file is distributed in the hope that it will be useful, but
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
* NONINFRINGEMENT. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this file; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* or visit http://www.gnu.org/licenses/.
*
* This file may also be available under a different license from Cavium.
* Contact Cavium Networks for more information
***********************license end**************************************/
/**
* @file
*
* Functions for SGMII initialization, configuration,
* and monitoring.
*
*/
#ifndef __CVMX_HELPER_SGMII_H__
#define __CVMX_HELPER_SGMII_H__
/**
* Probe a SGMII interface and determine the number of ports
* connected to it. The SGMII interface should still be down after
* this call.
*
* @interface: Interface to probe
*
* Returns Number of ports on the interface. Zero to disable.
*/
extern int __cvmx_helper_sgmii_probe(int interface);
extern int __cvmx_helper_sgmii_enumerate(int interface);
/**
* Bringup and enable a SGMII interface. After this call packet
* I/O should be fully functional. This is called with IPD
* enabled but PKO disabled.
*
* @interface: Interface to bring up
*
* Returns Zero on success, negative on failure
*/
extern int __cvmx_helper_sgmii_enable(int interface);
/**
* Return the link state of an IPD/PKO port as returned by
* auto negotiation. The result of this function may not match
* Octeon's link config if auto negotiation has changed since
* the last call to cvmx_helper_link_set().
*
* @ipd_port: IPD/PKO port to query
*
* Returns Link state
*/
extern cvmx_helper_link_info_t __cvmx_helper_sgmii_link_get(int ipd_port);
/**
* Configure an IPD/PKO port for the specified link state. This
* function does not influence auto negotiation at the PHY level.
* The passed link state must always match the link state returned
* by cvmx_helper_link_get(). It is normally best to use
* cvmx_helper_link_autoconf() instead.
*
* @ipd_port: IPD/PKO port to configure
* @link_info: The new link state
*
* Returns Zero on success, negative on failure
*/
extern int __cvmx_helper_sgmii_link_set(int ipd_port,
cvmx_helper_link_info_t link_info);
/**
* Configure a port for internal and/or external loopback. Internal loopback
* causes packets sent by the port to be received by Octeon. External loopback
* causes packets received from the wire to sent out again.
*
* @ipd_port: IPD/PKO port to loopback.
* @enable_internal:
* Non zero if you want internal loopback
* @enable_external:
* Non zero if you want external loopback
*
* Returns Zero on success, negative on failure.
*/
extern int __cvmx_helper_sgmii_configure_loopback(int ipd_port,
int enable_internal,
int enable_external);
#endif
|
/* use 0 for NULL so no need for system header */
int test_c_assoc_0(void *my_c_ptr);
int test_c_assoc_1(void *my_c_ptr_1, void *my_c_ptr_2);
int test_c_assoc_2(void *my_c_ptr_1, void *my_c_ptr_2, int num_ptrs);
void verify_assoc(void *my_c_ptr_1, void *my_c_ptr_2);
extern void abort(void);
int main(int argc, char **argv)
{
int i;
int j;
if(test_c_assoc_0(0) != 0)
abort();
if(test_c_assoc_0(&i) != 1)
abort();
if(test_c_assoc_1(0, 0) != 0)
abort();
if(test_c_assoc_1(0, &i) != 0)
abort();
if(test_c_assoc_1(&i, &i) != 1)
abort();
if(test_c_assoc_1(&i, 0) != 0)
abort();
if(test_c_assoc_1(&i, &j) != 0)
abort();
/* this should be associated, cause only testing 1 ptr (i) */
if(test_c_assoc_2(&i, 0, 1) != 1)
abort();
/* this should be associated */
if(test_c_assoc_2(&i, &i, 2) != 1)
abort();
/* this should not be associated (i) */
if(test_c_assoc_2(&i, &j, 2) != 0)
abort();
/* this should be associated, cause only testing 1 ptr (i) */
if(test_c_assoc_2(&i, &j, 1) != 1)
abort();
verify_assoc(&i, &i);
return 0;
}/* end main() */
|
/**
Copyright (c) 2014-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
*/
#import "POPDecayAnimation.h"
#import <cmath>
#import "POPPropertyAnimationInternal.h"
// minimal velocity factor before decay animation is considered complete, in units / s
static CGFloat kPOPAnimationDecayMinimalVelocityFactor = 5.;
// default decay animation deceleration
static CGFloat kPOPAnimationDecayDecelerationDefault = 0.998;
static void decay_position(CGFloat *x, CGFloat *v, NSUInteger count, CFTimeInterval dt, CGFloat deceleration)
{
dt *= 1000;
// v0 = v / 1000
// v = v0 * powf(deceleration, dt);
// v = v * 1000;
// x0 = x;
// x = x0 + v0 * deceleration * (1 - powf(deceleration, dt)) / (1 - deceleration)
float v0[count];
float kv = powf(deceleration, dt);
float kx = deceleration * (1 - kv) / (1 - deceleration);
for (NSUInteger idx = 0; idx < count; idx++) {
v0[idx] = v[idx] / 1000.;
v[idx] = v0[idx] * kv * 1000.;
x[idx] = x[idx] + v0[idx] * kx;
}
}
struct _POPDecayAnimationState : _POPPropertyAnimationState
{
double deceleration;
CFTimeInterval duration;
_POPDecayAnimationState(id __unsafe_unretained anim) :
_POPPropertyAnimationState(anim),
deceleration(kPOPAnimationDecayDecelerationDefault),
duration(0)
{
type = kPOPAnimationDecay;
}
bool isDone() {
if (_POPPropertyAnimationState::isDone()) {
return true;
}
CGFloat f = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor;
const CGFloat *velocityValues = vec_data(velocityVec);
for (NSUInteger idx = 0; idx < valueCount; idx++) {
if (std::abs((velocityValues[idx])) >= f)
return false;
}
return true;
}
void computeDuration() {
// compute duration till threshold velocity
Vector4r scaledVelocity = vector4(velocityVec) / 1000.;
double k = dynamicsThreshold * kPOPAnimationDecayMinimalVelocityFactor / 1000.;
double vx = k / scaledVelocity.x;
double vy = k / scaledVelocity.y;
double vz = k / scaledVelocity.z;
double vw = k / scaledVelocity.w;
double d = log(deceleration) * 1000.;
duration = MAX(MAX(MAX(log(fabs(vx)) / d, log(fabs(vy)) / d), log(fabs(vz)) / d), log(fabs(vw)) / d);
// ensure velocity threshold is exceeded
if (std::isnan(duration) || duration < 0) {
duration = 0;
}
}
void computeToValue() {
// to value assuming final velocity as a factor of dynamics threshold
// derived from v' = v * d^dt used in decay_position
// to compute the to value with maximal dt, p' = p + (v * d) / (1 - d)
VectorRef fromValue = NULL != currentVec ? currentVec : fromVec;
if (!fromValue) {
return;
}
// ensure duration is computed
if (0 == duration) {
computeDuration();
}
// compute to value
VectorRef toValue(Vector::new_vector(fromValue.get()));
Vector4r velocity = velocityVec->vector4r();
decay_position(toValue->data(), velocity.data(), valueCount, duration, deceleration);
toVec = toValue;
}
bool advance(CFTimeInterval time, CFTimeInterval dt, id obj) {
// advance past not yet initialized animations
if (NULL == currentVec) {
return false;
}
decay_position(currentVec->data(), velocityVec->data(), valueCount, dt, deceleration);
// clamp to compute end value; avoid possibility of decaying past
clampCurrentValue(kPOPAnimationClampEnd | clampMode);
return true;
}
};
typedef struct _POPDecayAnimationState POPDecayAnimationState;
|
/*
* ALSA SoC codec driver for HDMI audio on OMAP processors.
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
* Author: Ricardo Neri <ricardo.neri@ti.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include <linux/module.h>
#include <sound/soc.h>
#define DRV_NAME "hdmi-audio-codec"
static struct snd_soc_codec_driver omap_hdmi_codec;
static struct snd_soc_dai_driver omap_hdmi_codec_dai = {
.name = "omap-hdmi-hifi",
.playback = {
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_32000 |
SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE,
},
};
static __devinit int omap_hdmi_codec_probe(struct platform_device *pdev)
{
return snd_soc_register_codec(&pdev->dev, &omap_hdmi_codec,
&omap_hdmi_codec_dai, 1);
}
static __devexit int omap_hdmi_codec_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
static struct platform_driver omap_hdmi_codec_driver = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
},
.probe = omap_hdmi_codec_probe,
.remove = __devexit_p(omap_hdmi_codec_remove),
};
module_platform_driver(omap_hdmi_codec_driver);
MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
MODULE_DESCRIPTION("ASoC OMAP HDMI codec driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
|
/***************************************************************************/
/* */
/* ftmm.c */
/* */
/* Multiple Master font support (body). */
/* */
/* Copyright 1996-2001, 2003, 2004, 2009, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
#include FT_MULTIPLE_MASTERS_H
#include FT_INTERNAL_OBJECTS_H
#include FT_SERVICE_MULTIPLE_MASTERS_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_mm
static FT_Error
ft_face_get_mm_service( FT_Face face,
FT_Service_MultiMasters *aservice )
{
FT_Error error;
*aservice = NULL;
if ( !face )
return FT_THROW( Invalid_Face_Handle );
error = FT_ERR( Invalid_Argument );
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
{
FT_FACE_LOOKUP_SERVICE( face,
*aservice,
MULTI_MASTERS );
if ( *aservice )
error = FT_Err_Ok;
}
return error;
}
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master *amaster )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->get_mm )
error = service->get_mm( face, amaster );
}
return error;
}
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_MM_Var( FT_Face face,
FT_MM_Var* *amaster )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->get_mm_var )
error = service->get_mm_var( face, amaster );
}
return error;
}
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Long* coords )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->set_mm_design )
error = service->set_mm_design( face, num_coords, coords );
}
return error;
}
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->set_var_design )
error = service->set_var_design( face, num_coords, coords );
}
return error;
}
/* documentation is in ftmm.h */
FT_EXPORT_DEF( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->set_mm_blend )
error = service->set_mm_blend( face, num_coords, coords );
}
return error;
}
/* documentation is in ftmm.h */
/* This is exactly the same as the previous function. It exists for */
/* orthogonality. */
FT_EXPORT_DEF( FT_Error )
FT_Set_Var_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Error error;
FT_Service_MultiMasters service;
error = ft_face_get_mm_service( face, &service );
if ( !error )
{
error = FT_ERR( Invalid_Argument );
if ( service->set_mm_blend )
error = service->set_mm_blend( face, num_coords, coords );
}
return error;
}
/* END */
|
// { dg-do compile }
int bar ();
void foo()
{
int i;
#pragma omp for schedule // { dg-error "expected '\\('" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule static // { dg-error "expected '\\('" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( // { dg-error "invalid schedule kind" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static // { dg-error "expected" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static )
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( foo ) // { dg-error "invalid schedule kind" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static 1 // { dg-error "expected" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static 1 ) nowait // { dg-error "expected" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static, 1 ) nowait
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static, 1, 1 ) nowait // { dg-error "expected '\\)'" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static, 1 + 1 ) nowait
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule ( static, 1.0 ) // { dg-error "expected integer expression" }
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (dynamic)
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (dynamic, bar ())
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (guided)
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (guided, bar ())
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (runtime)
for (i = 0; i < 10; ++i) ;
#pragma omp for schedule (runtime, bar ()) // { dg-error "does not take" }
for (i = 0; i < 10; ++i) ;
}
|
/*
* Huawei HiNIC PCI Express Linux driver
* Copyright(c) 2017 Huawei Technologies Co., Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*/
#ifndef HINIC_HW_CSR_H
#define HINIC_HW_CSR_H
/* HW interface registers */
#define HINIC_CSR_FUNC_ATTR0_ADDR 0x0
#define HINIC_CSR_FUNC_ATTR1_ADDR 0x4
#define HINIC_CSR_FUNC_ATTR4_ADDR 0x10
#define HINIC_CSR_FUNC_ATTR5_ADDR 0x14
#define HINIC_DMA_ATTR_BASE 0xC80
#define HINIC_ELECTION_BASE 0x4200
#define HINIC_DMA_ATTR_STRIDE 0x4
#define HINIC_CSR_DMA_ATTR_ADDR(idx) \
(HINIC_DMA_ATTR_BASE + (idx) * HINIC_DMA_ATTR_STRIDE)
#define HINIC_PPF_ELECTION_STRIDE 0x4
#define HINIC_CSR_MAX_PORTS 4
#define HINIC_CSR_PPF_ELECTION_ADDR(idx) \
(HINIC_ELECTION_BASE + (idx) * HINIC_PPF_ELECTION_STRIDE)
/* API CMD registers */
#define HINIC_CSR_API_CMD_BASE 0xF000
#define HINIC_CSR_API_CMD_STRIDE 0x100
#define HINIC_CSR_API_CMD_CHAIN_HEAD_HI_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x0 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_CHAIN_HEAD_LO_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x4 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_STATUS_HI_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x8 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_STATUS_LO_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0xC + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_CHAIN_NUM_CELLS_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x10 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_CHAIN_CTRL_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x14 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_CHAIN_PI_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x1C + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_CHAIN_REQ_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x20 + (idx) * HINIC_CSR_API_CMD_STRIDE)
#define HINIC_CSR_API_CMD_STATUS_ADDR(idx) \
(HINIC_CSR_API_CMD_BASE + 0x30 + (idx) * HINIC_CSR_API_CMD_STRIDE)
/* MSI-X registers */
#define HINIC_CSR_MSIX_CTRL_BASE 0x2000
#define HINIC_CSR_MSIX_CNT_BASE 0x2004
#define HINIC_CSR_MSIX_STRIDE 0x8
#define HINIC_CSR_MSIX_CTRL_ADDR(idx) \
(HINIC_CSR_MSIX_CTRL_BASE + (idx) * HINIC_CSR_MSIX_STRIDE)
#define HINIC_CSR_MSIX_CNT_ADDR(idx) \
(HINIC_CSR_MSIX_CNT_BASE + (idx) * HINIC_CSR_MSIX_STRIDE)
/* EQ registers */
#define HINIC_AEQ_MTT_OFF_BASE_ADDR 0x200
#define HINIC_CEQ_MTT_OFF_BASE_ADDR 0x400
#define HINIC_EQ_MTT_OFF_STRIDE 0x40
#define HINIC_CSR_AEQ_MTT_OFF(id) \
(HINIC_AEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE)
#define HINIC_CSR_CEQ_MTT_OFF(id) \
(HINIC_CEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE)
#define HINIC_CSR_EQ_PAGE_OFF_STRIDE 8
#define HINIC_CSR_AEQ_HI_PHYS_ADDR_REG(q_id, pg_num) \
(HINIC_CSR_AEQ_MTT_OFF(q_id) + \
(pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE)
#define HINIC_CSR_CEQ_HI_PHYS_ADDR_REG(q_id, pg_num) \
(HINIC_CSR_CEQ_MTT_OFF(q_id) + \
(pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE)
#define HINIC_CSR_AEQ_LO_PHYS_ADDR_REG(q_id, pg_num) \
(HINIC_CSR_AEQ_MTT_OFF(q_id) + \
(pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4)
#define HINIC_CSR_CEQ_LO_PHYS_ADDR_REG(q_id, pg_num) \
(HINIC_CSR_CEQ_MTT_OFF(q_id) + \
(pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4)
#define HINIC_AEQ_CTRL_0_ADDR_BASE 0xE00
#define HINIC_AEQ_CTRL_1_ADDR_BASE 0xE04
#define HINIC_AEQ_CONS_IDX_ADDR_BASE 0xE08
#define HINIC_AEQ_PROD_IDX_ADDR_BASE 0xE0C
#define HINIC_CEQ_CTRL_0_ADDR_BASE 0x1000
#define HINIC_CEQ_CTRL_1_ADDR_BASE 0x1004
#define HINIC_CEQ_CONS_IDX_ADDR_BASE 0x1008
#define HINIC_CEQ_PROD_IDX_ADDR_BASE 0x100C
#define HINIC_EQ_OFF_STRIDE 0x80
#define HINIC_CSR_AEQ_CTRL_0_ADDR(idx) \
(HINIC_AEQ_CTRL_0_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_AEQ_CTRL_1_ADDR(idx) \
(HINIC_AEQ_CTRL_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_AEQ_CONS_IDX_ADDR(idx) \
(HINIC_AEQ_CONS_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_AEQ_PROD_IDX_ADDR(idx) \
(HINIC_AEQ_PROD_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_CEQ_CTRL_0_ADDR(idx) \
(HINIC_CEQ_CTRL_0_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_CEQ_CTRL_1_ADDR(idx) \
(HINIC_CEQ_CTRL_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_CEQ_CONS_IDX_ADDR(idx) \
(HINIC_CEQ_CONS_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#define HINIC_CSR_CEQ_PROD_IDX_ADDR(idx) \
(HINIC_CEQ_PROD_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE)
#endif
|
/*
* Copyright (c) 2014 TRUSTONIC LIMITED
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _TUI_HAL_H_
#define _TUI_HAL_H_
#include <linux/types.h>
uint32_t hal_tui_init(void);
void hal_tui_exit(void);
uint32_t hal_tui_alloc(tuiAllocBuffer_t allocbuffer[MAX_DCI_BUFFER_NUMBER],
size_t allocsize, uint32_t number);
void hal_tui_free(void);
uint32_t hal_tui_deactivate(void);
uint32_t hal_tui_activate(void);
#endif
|
/*
* Handle mapping of the flash on MBX860 boards
*
* Author: Anton Todorov
* Copyright: (C) 2001 Emness Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#define WINDOW_ADDR 0xfe000000
#define WINDOW_SIZE 0x00200000
/* Flash / Partition sizing */
#define MAX_SIZE_KiB 8192
#define BOOT_PARTITION_SIZE_KiB 512
#define KERNEL_PARTITION_SIZE_KiB 5632
#define APP_PARTITION_SIZE_KiB 2048
#define NUM_PARTITIONS 3
/* partition_info gives details on the logical partitions that the split the
* single flash device into. If the size if zero we use up to the end of the
* device. */
static struct mtd_partition partition_info[]={
{ .name = "MBX flash BOOT partition",
.offset = 0,
.size = BOOT_PARTITION_SIZE_KiB*1024 },
{ .name = "MBX flash DATA partition",
.offset = BOOT_PARTITION_SIZE_KiB*1024,
.size = (KERNEL_PARTITION_SIZE_KiB)*1024 },
{ .name = "MBX flash APPLICATION partition",
.offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 }
};
static struct mtd_info *mymtd;
struct map_info mbx_map = {
.name = "MBX flash",
.size = WINDOW_SIZE,
.phys = WINDOW_ADDR,
.bankwidth = 4,
};
static int __init init_mbx(void)
{
printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR);
mbx_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4);
if (!mbx_map.virt) {
printk("Failed to ioremap\n");
return -EIO;
}
simple_map_init(&mbx_map);
mymtd = do_map_probe("jedec_probe", &mbx_map);
if (mymtd) {
mymtd->owner = THIS_MODULE;
add_mtd_device(mymtd);
add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS);
return 0;
}
iounmap((void *)mbx_map.virt);
return -ENXIO;
}
static void __exit cleanup_mbx(void)
{
if (mymtd) {
del_mtd_device(mymtd);
map_destroy(mymtd);
}
if (mbx_map.virt) {
iounmap((void *)mbx_map.virt);
mbx_map.virt = 0;
}
}
module_init(init_mbx);
module_exit(cleanup_mbx);
MODULE_AUTHOR("Anton Todorov <a.todorov@emness.com>");
MODULE_DESCRIPTION("MTD map driver for Motorola MBX860 board");
MODULE_LICENSE("GPL");
|
/*
* the simple DMA Implementation for Blackfin
*
* Copyright 2007-2008 Analog Devices Inc.
*
* Licensed under the GPL-2 or later.
*/
#include <linux/module.h>
#include <asm/blackfin.h>
#include <asm/dma.h>
struct dma_register * const dma_io_base_addr[MAX_DMA_CHANNELS] = {
(struct dma_register *) DMA1_0_NEXT_DESC_PTR,
(struct dma_register *) DMA1_1_NEXT_DESC_PTR,
(struct dma_register *) DMA1_2_NEXT_DESC_PTR,
(struct dma_register *) DMA1_3_NEXT_DESC_PTR,
(struct dma_register *) DMA1_4_NEXT_DESC_PTR,
(struct dma_register *) DMA1_5_NEXT_DESC_PTR,
(struct dma_register *) DMA1_6_NEXT_DESC_PTR,
(struct dma_register *) DMA1_7_NEXT_DESC_PTR,
(struct dma_register *) DMA1_8_NEXT_DESC_PTR,
(struct dma_register *) DMA1_9_NEXT_DESC_PTR,
(struct dma_register *) DMA1_10_NEXT_DESC_PTR,
(struct dma_register *) DMA1_11_NEXT_DESC_PTR,
(struct dma_register *) DMA2_0_NEXT_DESC_PTR,
(struct dma_register *) DMA2_1_NEXT_DESC_PTR,
(struct dma_register *) DMA2_2_NEXT_DESC_PTR,
(struct dma_register *) DMA2_3_NEXT_DESC_PTR,
(struct dma_register *) DMA2_4_NEXT_DESC_PTR,
(struct dma_register *) DMA2_5_NEXT_DESC_PTR,
(struct dma_register *) DMA2_6_NEXT_DESC_PTR,
(struct dma_register *) DMA2_7_NEXT_DESC_PTR,
(struct dma_register *) DMA2_8_NEXT_DESC_PTR,
(struct dma_register *) DMA2_9_NEXT_DESC_PTR,
(struct dma_register *) DMA2_10_NEXT_DESC_PTR,
(struct dma_register *) DMA2_11_NEXT_DESC_PTR,
(struct dma_register *) MDMA_D0_NEXT_DESC_PTR,
(struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
(struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
(struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
(struct dma_register *) MDMA_D2_NEXT_DESC_PTR,
(struct dma_register *) MDMA_S2_NEXT_DESC_PTR,
(struct dma_register *) MDMA_D3_NEXT_DESC_PTR,
(struct dma_register *) MDMA_S3_NEXT_DESC_PTR,
(struct dma_register *) IMDMA_D0_NEXT_DESC_PTR,
(struct dma_register *) IMDMA_S0_NEXT_DESC_PTR,
(struct dma_register *) IMDMA_D1_NEXT_DESC_PTR,
(struct dma_register *) IMDMA_S1_NEXT_DESC_PTR,
};
EXPORT_SYMBOL(dma_io_base_addr);
int channel2irq(unsigned int channel)
{
int ret_irq = -1;
switch (channel) {
case CH_PPI0:
ret_irq = IRQ_PPI0;
break;
case CH_PPI1:
ret_irq = IRQ_PPI1;
break;
case CH_SPORT0_RX:
ret_irq = IRQ_SPORT0_RX;
break;
case CH_SPORT0_TX:
ret_irq = IRQ_SPORT0_TX;
break;
case CH_SPORT1_RX:
ret_irq = IRQ_SPORT1_RX;
break;
case CH_SPORT1_TX:
ret_irq = IRQ_SPORT1_TX;
break;
case CH_SPI:
ret_irq = IRQ_SPI;
break;
case CH_UART_RX:
ret_irq = IRQ_UART_RX;
break;
case CH_UART_TX:
ret_irq = IRQ_UART_TX;
break;
case CH_MEM_STREAM0_SRC:
case CH_MEM_STREAM0_DEST:
ret_irq = IRQ_MEM_DMA0;
break;
case CH_MEM_STREAM1_SRC:
case CH_MEM_STREAM1_DEST:
ret_irq = IRQ_MEM_DMA1;
break;
case CH_MEM_STREAM2_SRC:
case CH_MEM_STREAM2_DEST:
ret_irq = IRQ_MEM_DMA2;
break;
case CH_MEM_STREAM3_SRC:
case CH_MEM_STREAM3_DEST:
ret_irq = IRQ_MEM_DMA3;
break;
case CH_IMEM_STREAM0_SRC:
case CH_IMEM_STREAM0_DEST:
ret_irq = IRQ_IMEM_DMA0;
break;
case CH_IMEM_STREAM1_SRC:
case CH_IMEM_STREAM1_DEST:
ret_irq = IRQ_IMEM_DMA1;
break;
}
return ret_irq;
}
|
/*
* Copyright (c) 1999-2000 by The XFree86 Project, 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _XF86OSPRIV_H
#define _XF86OSPRIV_H
typedef pointer (*MapMemProcPtr)(int, unsigned long, unsigned long, int);
typedef void (*UnmapMemProcPtr)(int, pointer, unsigned long);
typedef pointer (*SetWCProcPtr)(int, unsigned long, unsigned long, Bool,
MessageType);
typedef void (*ProtectMemProcPtr)(int, pointer, unsigned long, Bool);
typedef void (*UndoWCProcPtr)(int, pointer);
typedef void (*ReadSideEffectsProcPtr)(int, pointer, unsigned long);
typedef struct {
Bool initialised;
MapMemProcPtr mapMem;
UnmapMemProcPtr unmapMem;
ProtectMemProcPtr protectMem;
SetWCProcPtr setWC;
UndoWCProcPtr undoWC;
ReadSideEffectsProcPtr readSideEffects;
Bool linearSupported;
} VidMemInfo, *VidMemInfoPtr;
void xf86OSInitVidMem(VidMemInfoPtr);
#endif /* _XF86OSPRIV_H */
|
double x(){int x1,x2;double v;
if(((long)(x1-x2))<1)return -1.0;v=t(v);v=y(1,v>0.0?(int)v:((int)v-1));}
|
/* ----------------------------------------------------------------------
* Copyright (C) 2010 ARM Limited. All rights reserved.
*
* $Date: 15. July 2011
* $Revision: V1.0.10
*
* Project: CMSIS DSP Library
* Title: arm_sub_q7.c
*
* Description: Q7 vector subtraction.
*
* Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
*
* Version 1.0.10 2011/7/15
* Big Endian support added and Merged M0 and M3/M4 Source code.
*
* Version 1.0.3 2010/11/29
* Re-organized the CMSIS folders and updated documentation.
*
* Version 1.0.2 2010/11/11
* Documentation updated.
*
* Version 1.0.1 2010/10/05
* Production release and review comments incorporated.
*
* Version 1.0.0 2010/09/20
* Production release and review comments incorporated.
*
* Version 0.0.7 2010/06/10
* Misra-C changes done
* -------------------------------------------------------------------- */
#include "arm_math.h"
/**
* @ingroup groupMath
*/
/**
* @addtogroup BasicSub
* @{
*/
/**
* @brief Q7 vector subtraction.
* @param[in] *pSrcA points to the first input vector
* @param[in] *pSrcB points to the second input vector
* @param[out] *pDst points to the output vector
* @param[in] blockSize number of samples in each vector
* @return none.
*
* <b>Scaling and Overflow Behavior:</b>
* \par
* The function uses saturating arithmetic.
* Results outside of the allowable Q7 range [0x80 0x7F] will be saturated.
*/
void arm_sub_q7(
q7_t * pSrcA,
q7_t * pSrcB,
q7_t * pDst,
uint32_t blockSize)
{
uint32_t blkCnt; /* loop counter */
#ifndef ARM_MATH_CM0
/* Run the below code for Cortex-M4 and Cortex-M3 */
/*loop Unrolling */
blkCnt = blockSize >> 2u;
/* First part of the processing with loop unrolling. Compute 4 outputs at a time.
** a second loop below computes the remaining 1 to 3 samples. */
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the results in the destination buffer 4 samples at a time. */
*__SIMD32(pDst)++ = __QSUB8(*__SIMD32(pSrcA)++, *__SIMD32(pSrcB)++);
/* Decrement the loop counter */
blkCnt--;
}
/* If the blockSize is not a multiple of 4, compute any remaining output samples here.
** No loop unrolling is used. */
blkCnt = blockSize % 0x4u;
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the result in the destination buffer. */
*pDst++ = __SSAT(*pSrcA++ - *pSrcB++, 8);
/* Decrement the loop counter */
blkCnt--;
}
#else
/* Run the below code for Cortex-M0 */
/* Initialize blkCnt with number of samples */
blkCnt = blockSize;
while(blkCnt > 0u)
{
/* C = A - B */
/* Subtract and then store the result in the destination buffer. */
*pDst++ = (q7_t) __SSAT((q15_t) * pSrcA++ - *pSrcB++, 8);
/* Decrement the loop counter */
blkCnt--;
}
#endif /* #ifndef ARM_MATH_CM0 */
}
/**
* @} end of BasicSub group
*/
|
/*
* Copyright (C) 2002 ARM Ltd.
* All Rights Reserved
* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/hardware/gic.h>
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/mach-types.h>
#include <asm/smp_plat.h>
#include <mach/socinfo.h>
#include <mach/hardware.h>
#include <mach/msm_iomap.h>
#include "pm.h"
#include "scm-boot.h"
#include "spm.h"
#define VDD_SC1_ARRAY_CLAMP_GFS_CTL 0x15A0
#define SCSS_CPU1CORE_RESET 0xD80
#define SCSS_DBG_STATUS_CORE_PWRDUP 0xE64
extern void msm_secondary_startup(void);
/*
* control for which core is the next to come out of the secondary
* boot "holding pen".
*/
volatile int pen_release = -1;
static DEFINE_SPINLOCK(boot_lock);
void __cpuinit platform_secondary_init(unsigned int cpu)
{
WARN_ON(msm_platform_secondary_init(cpu));
/*
* if any interrupts are already enabled for the primary
* core (e.g. timer irq), then they will not have been enabled
* for us: do so
*/
gic_secondary_init(0);
/*
* Synchronise with the boot thread.
*/
spin_lock(&boot_lock);
spin_unlock(&boot_lock);
}
static int __cpuinit scorpion_release_secondary(void)
{
void *base_ptr = ioremap_nocache(0x00902000, SZ_4K*2);
if (!base_ptr)
return -EINVAL;
writel_relaxed(0, base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL);
dmb();
writel_relaxed(0, base_ptr + SCSS_CPU1CORE_RESET);
writel_relaxed(3, base_ptr + SCSS_DBG_STATUS_CORE_PWRDUP);
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit krait_release_secondary_sim(unsigned long base, int cpu)
{
void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K);
if (!base_ptr)
return -ENODEV;
if (machine_is_msm8960_sim() || machine_is_msm8960_rumi3()) {
writel_relaxed(0x10, base_ptr+0x04);
writel_relaxed(0x80, base_ptr+0x04);
}
if (machine_is_apq8064_sim())
writel_relaxed(0xf0000, base_ptr+0x04);
if (machine_is_msm8974_sim()) {
writel_relaxed(0x800, base_ptr+0x04);
writel_relaxed(0x3FFF, base_ptr+0x14);
}
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit krait_release_secondary(unsigned long base, int cpu)
{
void *base_ptr = ioremap_nocache(base + (cpu * 0x10000), SZ_4K);
if (!base_ptr)
return -ENODEV;
msm_spm_turn_on_cpu_rail(cpu);
writel_relaxed(0x109, base_ptr+0x04);
writel_relaxed(0x101, base_ptr+0x04);
ndelay(300);
writel_relaxed(0x121, base_ptr+0x04);
udelay(2);
writel_relaxed(0x020, base_ptr+0x04);
udelay(2);
writel_relaxed(0x000, base_ptr+0x04);
udelay(100);
writel_relaxed(0x080, base_ptr+0x04);
mb();
iounmap(base_ptr);
return 0;
}
static int __cpuinit release_secondary(unsigned int cpu)
{
BUG_ON(cpu >= get_core_count());
if (cpu_is_msm8x60())
return scorpion_release_secondary();
if (machine_is_msm8960_sim() || machine_is_msm8960_rumi3() ||
machine_is_apq8064_sim())
return krait_release_secondary_sim(0x02088000, cpu);
if (machine_is_msm8974_sim())
return krait_release_secondary_sim(0xf9088000, cpu);
if (cpu_is_msm8960() || cpu_is_msm8930() || cpu_is_msm8930aa() ||
cpu_is_apq8064() || cpu_is_msm8627())
return krait_release_secondary(0x02088000, cpu);
WARN(1, "unknown CPU case in release_secondary\n");
return -EINVAL;
}
DEFINE_PER_CPU(int, cold_boot_done);
static int cold_boot_flags[] = {
0,
SCM_FLAG_COLDBOOT_CPU1,
SCM_FLAG_COLDBOOT_CPU2,
SCM_FLAG_COLDBOOT_CPU3,
};
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
{
int ret;
int flag = 0;
unsigned long timeout;
pr_debug("Starting secondary CPU %d\n", cpu);
/* Set preset_lpj to avoid subsequent lpj recalculations */
preset_lpj = loops_per_jiffy;
if (cpu > 0 && cpu < ARRAY_SIZE(cold_boot_flags))
flag = cold_boot_flags[cpu];
else
__WARN();
if (per_cpu(cold_boot_done, cpu) == false) {
ret = scm_set_boot_addr((void *)
virt_to_phys(msm_secondary_startup),
flag);
if (ret == 0)
release_secondary(cpu);
else
printk(KERN_DEBUG "Failed to set secondary core boot "
"address\n");
per_cpu(cold_boot_done, cpu) = true;
}
/*
* set synchronisation state between this boot processor
* and the secondary one
*/
spin_lock(&boot_lock);
/*
* The secondary processor is waiting to be released from
* the holding pen - release it, then wait for it to flag
* that it has been released by resetting pen_release.
*
* Note that "pen_release" is the hardware CPU ID, whereas
* "cpu" is Linux's internal ID.
*/
pen_release = cpu_logical_map(cpu);
__cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
/*
* Send the secondary CPU a soft interrupt, thereby causing
* the boot monitor to read the system wide flags register,
* and branch to the address found there.
*/
gic_raise_softirq(cpumask_of(cpu), 1);
timeout = jiffies + (1 * HZ);
while (time_before(jiffies, timeout)) {
smp_rmb();
if (pen_release == -1)
break;
dmac_inv_range((void *)&pen_release,
(void *)(&pen_release+sizeof(pen_release)));
udelay(10);
}
/*
* now the secondary core is starting up let it run its
* calibrations, then wait for it to finish
*/
spin_unlock(&boot_lock);
return pen_release != -1 ? -ENOSYS : 0;
}
/*
* Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system.
*/
void __init smp_init_cpus(void)
{
unsigned int i, ncores = get_core_count();
if (ncores > nr_cpu_ids) {
pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
ncores, nr_cpu_ids);
ncores = nr_cpu_ids;
}
for (i = 0; i < ncores; i++)
set_cpu_possible(i, true);
set_smp_cross_call(gic_raise_softirq);
}
void __init platform_smp_prepare_cpus(unsigned int max_cpus)
{
}
|
#ifndef __PERF_COUNTS_H
#define __PERF_COUNTS_H
#include "xyarray.h"
struct perf_counts_values {
union {
struct {
u64 val;
u64 ena;
u64 run;
};
u64 values[3];
};
};
struct perf_counts {
s8 scaled;
struct perf_counts_values aggr;
struct xyarray *values;
};
static inline struct perf_counts_values*
perf_counts(struct perf_counts *counts, int cpu, int thread)
{
return xyarray__entry(counts->values, cpu, thread);
}
struct perf_counts *perf_counts__new(int ncpus, int nthreads);
void perf_counts__delete(struct perf_counts *counts);
void perf_evsel__reset_counts(struct perf_evsel *evsel);
int perf_evsel__alloc_counts(struct perf_evsel *evsel, int ncpus, int nthreads);
void perf_evsel__free_counts(struct perf_evsel *evsel);
#endif /* __PERF_COUNTS_H */
|
/*
* PPC32 code to handle Linux booting another kernel.
*
* Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
* GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
* Copyright (C) 2005 IBM Corporation.
*
* This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details.
*/
#include <linux/kexec.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <asm/cacheflush.h>
#include <asm/hw_irq.h>
#include <asm/io.h>
typedef NORET_TYPE void (*relocate_new_kernel_t)(
unsigned long indirection_page,
unsigned long reboot_code_buffer,
unsigned long start_address) ATTRIB_NORET;
/*
* This is a generic machine_kexec function suitable at least for
* non-OpenFirmware embedded platforms.
* It merely copies the image relocation code to the control page and
* jumps to it.
* A platform specific function may just call this one.
*/
void default_machine_kexec(struct kimage *image)
{
extern const unsigned char relocate_new_kernel[];
extern const unsigned int relocate_new_kernel_size;
unsigned long page_list;
unsigned long reboot_code_buffer, reboot_code_buffer_phys;
relocate_new_kernel_t rnk;
/* Interrupts aren't acceptable while we reboot */
local_irq_disable();
/* mask each interrupt so we are in a more sane state for the
* kexec kernel */
machine_kexec_mask_interrupts();
page_list = image->head;
/* we need both effective and real address here */
reboot_code_buffer =
(unsigned long)page_address(image->control_code_page);
reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
/* copy our kernel relocation code to the control code page */
memcpy((void *)reboot_code_buffer, relocate_new_kernel,
relocate_new_kernel_size);
flush_icache_range(reboot_code_buffer,
reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
printk(KERN_INFO "Bye!\n");
/* now call it */
rnk = (relocate_new_kernel_t) reboot_code_buffer;
(*rnk)(page_list, reboot_code_buffer_phys, image->start);
}
int default_machine_kexec_prepare(struct kimage *image)
{
return 0;
}
|
/*
* sky81452.c SKY81452 MFD driver
*
* Copyright 2014 Skyworks Solutions Inc.
* Author : Gyungoh Yoo <jack.yoo@skyworksinc.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/mfd/core.h>
#include <linux/mfd/sky81452.h>
static const struct regmap_config sky81452_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int sky81452_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
const struct sky81452_platform_data *pdata = dev_get_platdata(dev);
struct mfd_cell cells[2];
struct regmap *regmap;
int ret;
if (!pdata) {
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
}
regmap = devm_regmap_init_i2c(client, &sky81452_config);
if (IS_ERR(regmap)) {
dev_err(dev, "failed to initialize.err=%ld\n", PTR_ERR(regmap));
return PTR_ERR(regmap);
}
i2c_set_clientdata(client, regmap);
memset(cells, 0, sizeof(cells));
cells[0].name = "sky81452-backlight";
cells[0].of_compatible = "skyworks,sky81452-backlight";
cells[0].platform_data = pdata->bl_pdata;
cells[0].pdata_size = sizeof(*pdata->bl_pdata);
cells[1].name = "sky81452-regulator";
cells[1].platform_data = pdata->regulator_init_data;
cells[1].pdata_size = sizeof(*pdata->regulator_init_data);
ret = devm_mfd_add_devices(dev, -1, cells, ARRAY_SIZE(cells),
NULL, 0, NULL);
if (ret)
dev_err(dev, "failed to add child devices. err=%d\n", ret);
return ret;
}
static const struct i2c_device_id sky81452_ids[] = {
{ "sky81452" },
{ }
};
MODULE_DEVICE_TABLE(i2c, sky81452_ids);
#ifdef CONFIG_OF
static const struct of_device_id sky81452_of_match[] = {
{ .compatible = "skyworks,sky81452", },
{ }
};
MODULE_DEVICE_TABLE(of, sky81452_of_match);
#endif
static struct i2c_driver sky81452_driver = {
.driver = {
.name = "sky81452",
.of_match_table = of_match_ptr(sky81452_of_match),
},
.probe = sky81452_probe,
.id_table = sky81452_ids,
};
module_i2c_driver(sky81452_driver);
MODULE_DESCRIPTION("Skyworks SKY81452 MFD driver");
MODULE_AUTHOR("Gyungoh Yoo <jack.yoo@skyworksinc.com>");
MODULE_LICENSE("GPL v2");
|
/*
* Copyright (c) 2016-2021, OARC, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. Neither the name of the copyright holder 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.
*/
#include "config.h"
#include "endpoint.h"
#include "args.h"
#include "iaddr.h"
void endpoint_arg(endpoint_list* list, const char* arg)
{
struct addrinfo* ai;
iaddr ia;
void* p;
if (inet_pton(AF_INET6, arg, &ia.u.a6) > 0) {
ia.af = AF_INET6;
endpoint_add(list, ia);
} else if (inet_pton(AF_INET, arg, &ia.u.a4) > 0) {
ia.af = AF_INET;
endpoint_add(list, ia);
} else if (getaddrinfo(arg, NULL, NULL, &ai) == 0) {
struct addrinfo* a;
for (a = ai; a != NULL; a = a->ai_next) {
if (a->ai_socktype != SOCK_DGRAM)
continue;
switch (a->ai_family) {
case PF_INET:
ia.af = AF_INET;
p = &((struct sockaddr_in*)a->ai_addr)
->sin_addr;
memcpy(&ia.u.a4, p, sizeof ia.u.a4);
break;
case PF_INET6:
ia.af = AF_INET6;
p = &((struct sockaddr_in6*)a->ai_addr)
->sin6_addr;
memcpy(&ia.u.a6, p, sizeof ia.u.a6);
break;
default:
continue;
}
endpoint_add(list, ia);
}
freeaddrinfo(ai);
} else
usage("invalid host address");
}
void endpoint_add(endpoint_list* list, iaddr ia)
{
endpoint_ptr ep;
ep = calloc(1, sizeof *ep);
assert(ep != NULL);
INIT_LINK(ep, link);
ep->ia = ia;
APPEND(*list, ep, link);
}
int ep_present(const endpoint_list* list, iaddr ia)
{
endpoint_ptr ep;
for (ep = HEAD(*list);
ep != NULL;
ep = NEXT(ep, link))
if (ia_equal(ia, ep->ia))
return TRUE;
return (FALSE);
}
|
/* $OpenBSD: ucred.h,v 1.11 2015/03/02 20:46:50 guenther Exp $ */
/* $NetBSD: ucred.h,v 1.12 1995/06/01 22:44:50 jtc Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. 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 University 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 REGENTS 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 REGENTS 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.
*
* @(#)ucred.h 8.2 (Berkeley) 1/4/94
*/
#ifndef _SYS_UCRED_H_
#define _SYS_UCRED_H_
#include <sys/syslimits.h>
/*
* Credentials.
*/
struct ucred {
u_int cr_ref; /* reference count */
/* The following fields are all copied by crset() */
#define cr_startcopy cr_uid
uid_t cr_uid; /* effective user id */
uid_t cr_ruid; /* Real user id. */
uid_t cr_svuid; /* Saved effective user id. */
gid_t cr_gid; /* effective group id */
gid_t cr_rgid; /* Real group id. */
gid_t cr_svgid; /* Saved effective group id. */
short cr_ngroups; /* number of groups */
gid_t cr_groups[NGROUPS_MAX]; /* groups */
};
#define NOCRED ((struct ucred *)-1) /* no credential available */
#define FSCRED ((struct ucred *)-2) /* filesystem credential */
/*
* Userspace version, for use in syscalls arguments
*/
struct xucred {
uid_t cr_uid; /* user id */
gid_t cr_gid; /* group id */
short cr_ngroups; /* number of groups */
gid_t cr_groups[NGROUPS_MAX]; /* groups */
};
#ifdef _KERNEL
#define crhold(cr) (cr)->cr_ref++
#define SUSER_NOACCT 0x1 /* don't mark accounting flags */
int crfromxucred(struct ucred *, const struct xucred *);
void crset(struct ucred *, const struct ucred *);
struct ucred *crcopy(struct ucred *cr);
struct ucred *crdup(struct ucred *cr);
void crfree(struct ucred *cr);
struct ucred *crget(void);
int suser(struct proc *p, u_int flags);
int suser_ucred(struct ucred *cred);
#endif /* _KERNEL */
#endif /* !_SYS_UCRED_H_ */
|
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ev.h>
#include "../src/config.h"
#include "../src/net.h"
#include "../src/table.h"
void sock_accepted(int fd, struct sockaddr *addr, socklen_t len);
static void reload_motd(void);
char *g_motd = NULL;
static void accept_trampoline(struct ev_loop *loop, struct ev_io *w, int revents)
{
struct sockaddr addr;
socklen_t len = sizeof(addr);
int fd;
assert(revents == EV_READ);
(void)loop;
fd = accept_connect(w->fd, &addr, &len);
if (fd < 0)
return;
sock_accepted(fd, &addr, len);
}
static void signal_trampoline(struct ev_loop *loop, struct ev_signal *w, int revents)
{
(void)loop; (void)w; (void)revents;
assert(revents == EV_SIGNAL);
reload_motd();
}
static void reload_motd(void)
{
char *path = getenv("MCP_MOTD_FILE");
char *new_motd;
if (path == NULL)
path = MCP_MOTD_FILE;
new_motd = load_file(path);
if (new_motd == NULL) {
printf("-1 failed to motd (%s)\n", path);
return;
}
free(g_motd);
g_motd = new_motd;
printf("-1 motd loaded (%s)\n", path);
}
int main(int argc, char **argv)
{
int fd;
struct ev_io iow;
struct ev_signal sw;
(void)argc; (void)argv;
fd = create_listener(getenv("MCP_LISTENER"), 25565);
if (fd < 0) {
perror("-1 failed to listen");
return 1;
}
g_motd = NULL;
reload_motd();
ev_io_init(&iow, accept_trampoline, fd, EV_READ);
ev_io_start(ev_default_loop(0), &iow);
ev_signal_init(&sw, signal_trampoline, SIGUSR1);
ev_signal_start(ev_default_loop(0), &sw);
signal(SIGPIPE, SIG_IGN);
ev_run(ev_default_loop(0), 0);
return 0;
}
|
#ifndef JOINT_PUBLIC_BINDINGACCESSOR_H
#define JOINT_PUBLIC_BINDINGACCESSOR_H
#include <joint/public/JointConfig.h>
JOINT_CORE_EXTERN_C_BEGIN
typedef struct
{
const struct JointCore_BindingAccessorVTable_s* VTable;
void* Instance;
} JointCore_BindingAccessor;
JOINT_CORE_EXTERN_C_END
#endif
|
/*
* Copyright (c) 2008 Rainer Clasen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms described in the file LICENSE included in this
* distribution.
*
*/
#ifndef _PGDB_USER_H
#define _PGDB_USER_H
#include <commondb/user.h>
#endif
|
/*
ANNOUNCEMENT: Up to 20% marks will be allotted for good programming practice. These include
- Comments: for the non trivial part of the code
- Indentation: align your code properly
-Don't put extra whitespace anywhere.
---------------------------------
Given an integer N(N>0) as input,your program should output the following pattern:
Example:
Input
5
Output
55555
45555
34555
23455
12345
Input
2
Output
22
12
*/
#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
int i, j, k;
for(i=n;i>=1;i--)
{
k = i;
for(j=1;j<=n;j++)
{
if(k <= n)
{
printf("%d",k);
}
else
{
printf("%d",n);
}
k++;
}
printf("\n");
}
return 0;
}
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "UIScrollView.h"
@class NSObject<BlockableScrollViewDelegate>;
@interface BlockableScrollView : UIScrollView
{
NSObject<BlockableScrollViewDelegate> *_blockableDelegate;
}
@property(nonatomic) __weak NSObject<BlockableScrollViewDelegate> *blockableDelegate; // @synthesize blockableDelegate=_blockableDelegate;
- (void).cxx_destruct;
- (_Bool)gestureRecognizerShouldBegin:(id)arg1;
@end
|
#pragma once
#include <cstdint>
namespace DirtRally
{
struct UDPPacketNoExtra
{
static constexpr size_t GetStructSizeinByte()
{
return sizeof(UDPPacketNoExtra);
}
// Dirt:Rally
// X and Y axes are on the ground, Z is up
// Heading anticlockwise from above (Z)
// Pitch anticlockwise from right (X)
// Roll anticlockwise from front (Y)
// Motion Platform:
// X = Forward
// Y = Right Wing
// Z = Down
// Roll about X
// Pitch about Y
// Yaw about Z
uint32_t m_time;
float m_angvelx;
float m_angvely;
float m_angvelz;
float m_heading;
float m_pitch;
float m_roll;
float m_accelx;
float m_accely;
float m_accelz;
float m_velx;
float m_vely;
float m_velz;
float m_x;
float m_y;
float m_z;
uint32_t m_id; //unused
};
struct UDPPacket
{
static constexpr size_t GetStructSizeinByte()
{
return sizeof(UDPPacket);
}
float m_time;
float m_lapTime;
float m_lapDistance;
float m_totalDistance;
float m_x; // World space position
float m_y; // World space position
float m_z;// World space position
float m_speed;
float m_xv;// Velocity in world space
float m_yv;// Velocity in world space
float m_zv;// Velocity in world space
float m_xr;// World space right direction
float m_yr;// World space right direction
float m_zr;// World space right direction
float m_xd;// World space forward direction
float m_yd;// World space forward direction
float m_zd;// World space forward direction
////Extra Data
//float m_susp_pos_bl;
//float m_susp_pos_br;
//float m_susp_pos_fl;
//float m_susp_pos_fr;
//float m_susp_vel_bl;
//float m_susp_vel_br;
//float m_susp_vel_fl;
//float m_susp_vel_fr;
//float m_wheel_speed_bl;
//float m_wheel_speed_br;
//float m_wheel_speed_fl;
//float m_wheel_speed_fr;
//float m_throttle;
//float m_steer;
//float m_brake;
//float m_clutch;
//float m_gear;
//float m_gforce_lat;
//float m_gforce_lon;
//float m_lap;
//float m_engineRate;
//float m_sli_pro_native_support;// SLI Pro support
//float m_car_position;// car race position
//float m_kers_level;// kers energy left
//float m_kers_max_level;// kers maximum energy
//float m_drs;// 0 = off, 1 = on
//float m_traction_control;// 0 (off) - 2 (high)
//float m_anti_lock_brakes;// 0 (off) - 1 (on)
//float m_fuel_in_tank;// current fuel mass
//float m_fuel_capacity;// fuel capacity
//float m_in_pits;// 0 = none, 1 = pitting, 2 = in pit area
//float m_sector;// 0 = sector1, 1 = sector2; 2 = sector3
//float m_sector1_time;// time of sector1 (or 0)
//float m_sector2_time;// time of sector2 (or 0)
//float m_brakes_temp[4];// brakes temperature (centigrade)
//float m_wheels_pressure[4];// wheels pressure PSI
//float m_team_info;// team ID
//float m_total_laps;// total number of laps in this race
//float m_track_size;// track size meters
//float m_last_lap_time;// last lap time
//float m_max_rpm;// cars max RPM, at which point the rev limiter will kick in
//float m_idle_rpm;// cars idle RPM
//float m_max_gears;// maximum number of gears
//float m_sessionType;// 0 = unknown, 1 = practice, 2 = qualifying, 3 = race
//float m_drsAllowed;// 0 = not allowed, 1 = allowed, -1 = invalid / unknown
//float m_track_number;// -1 for unknown, 0-21 for tracks
//float m_vehicleFIAFlags;// -1 = invalid/unknown, 0 = none, 1 = green, 2 = blue, 3 = yellow, 4 = red
};
} |
//
// XWCalendarViewFlowLayout.h
// XWCalendar
//
// Created by zengchao on 16/5/25.
// Copyright © 2016年 zengchao. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "XWCalendarConfig.h"
@interface XWCalendarViewFlowLayout : UICollectionViewFlowLayout
@end
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include <QLineEdit>
#include <QCheckBox>
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>
#include <QInputDialog>
#include <QDialog>
#include <string>
#include <QVector>
using namespace std;
#include "minecraftloader.h"
#include "FileUtilities.h"
#include "settingsmanager.h"
#include "minecraftoldversionincluder.h"
#include "launcherprofileloader.h"
#include "versionmanagerdialog.h"
namespace Ui {
class MainWindow;
}
void refreshMinecraftVersion(QString mp, QComboBox *cb, QString last);
extern QString playerName, minecraftPath, launchMode, javaPath, last;
extern int maxMemory;
extern bool loaded, debug;
extern bool lpLoaded;
extern LauncherProfileLoader *loader;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
QString generateLaunchString();
private slots:
void on_btnRun_clicked();
void on_btnSelHome_clicked();
void on_btnSelGoodMem_clicked();
void on_btnSelMCPath_clicked();
void on_txtMinecraftPath_editingFinished();
void on_rdo64Bit_clicked();
void on_rdo32Bit_clicked();
void on_rdoNormal_clicked();
void on_btnSelJavaPath_clicked();
void on_txtJavaPath_editingFinished();
void on_txtMaxMemory_editingFinished();
void on_txtPlayerName_editingFinished();
void on_cboVersion_currentIndexChanged(const QString &arg1);
void on_btnMakeSh_clicked();
void on_btnInclude_clicked();
void on_btnManageVersion_clicked();
private:
Ui::MainWindow *ui;
private:
QProcess *pro;
QLineEdit *txtMinecraftPath, *txtJavaPath, *txtPlayerName;
QCheckBox *chkUseJava, *chk64Bit;
};
#endif // MAINWINDOW_H
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.