blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e333dfcc0bd1986e90e1d639730b4a4f60ff8b56
|
8cdd62807f116fb92851f99bfcdd7de3c3330ed6
|
/arduino/opencr_arduino/opencr/variants/OpenCR/bsp/opencr/bsp.c
|
a7f5ce4a977dbdeb670a2bdf022605af6fec93c2
|
[
"Apache-2.0"
] |
permissive
|
ROBOTIS-GIT/OpenCR
|
60ae4d28e39207430687b18e09bab88e5aee6107
|
68ec75d8a400949580ecf263e0105ea9743b878e
|
refs/heads/master
| 2023-08-24T23:05:27.672638
| 2023-08-01T08:58:39
| 2023-08-01T08:58:39
| 57,167,157
| 388
| 258
|
Apache-2.0
| 2023-09-05T04:41:46
| 2016-04-26T22:48:46
|
C
|
UTF-8
|
C
| false
| false
| 2,150
|
c
|
bsp.c
|
/*
* bsp.c
*
* boart support package
*
* Created on: 2017. 3. 16.
* Author: Baram
*/
#include "bsp.h"
#include "hw.h"
#include "usbd_core.h"
#include "usbd_desc.h"
#include "usbd_cdc.h"
#include "usbd_cdc_interface.h"
USBD_HandleTypeDef USBD_Device;
extern void stop();
void bsp_mpu_config(void);
void bsp_init()
{
// STM32Cube HAL Init
HAL_Init();
// Clock Setup
// SYSCLK(Hz) = 216000000
// HCLK(Hz) = 216000000
// HSE(Hz) = 25000000
SystemClock_Config();
SCB_EnableDCache();
SCB_EnableICache();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
//HAL_Delay(100);
/* Init Device Library */
USBD_Init(&USBD_Device, &VCP_Desc, 0);
/* Add Supported Class */
USBD_RegisterClass(&USBD_Device, USBD_CDC_CLASS);
/* Add CDC Interface Class */
USBD_CDC_RegisterInterface(&USBD_Device, &USBD_CDC_fops);
/* Start Device Process */
USBD_Start(&USBD_Device);
}
void bsp_deinit()
{
USBD_DeInit(&USBD_Device);
HAL_DeInit();
__disable_irq();
SCB_InvalidateDCache();
SCB_InvalidateICache();
SCB_DisableDCache();
SCB_DisableICache();
}
void bsp_mpu_config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU attributes as WT for SRAM */
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x20010000;
MPU_InitStruct.Size = MPU_REGION_SIZE_256KB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}
|
bcc4c233bae02ba27efa339b7385062e9919a762
|
fb47ab6337a71029dee71933e449cf7f6805fc0f
|
/external/platform/lpc15xx/lpcopen/periph_gpio/example/src/gpio.c
|
c904ee4edad392ab5019780e3ec3ae240a2fda53
|
[
"MIT"
] |
permissive
|
littlekernel/lk
|
7e7ba50b87b1f2e0b6e2f052c59249825c91975b
|
30dc320054f70910e1c1ee40a6948ee99672acec
|
refs/heads/master
| 2023-09-02T00:47:52.203963
| 2023-06-21T22:42:35
| 2023-06-21T22:42:35
| 3,058,456
| 3,077
| 618
|
MIT
| 2023-08-30T09:41:31
| 2011-12-27T19:19:36
|
C
|
UTF-8
|
C
| false
| false
| 3,819
|
c
|
gpio.c
|
/*
* @brief General Purpose Input/Output example
*
* @note
* Copyright(C) NXP Semiconductors, 2013
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/
#include "board.h"
/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/
/* Number of tickrate per second */
#define TICKRATE_HZ (10)
#if defined(BOARD_NXP_LPCXPRESSO_1549)
/* LPCXpresso LPC1549 board has LEDs on P0_0, P0_1, and P0_24. We'll toggle them
all at once. */
#define PORT_MASK ((1 << 0) | (1 << 1) | (1 << 24))
#else
#error "No PORT_MASK defined"
#endif /* defined(BOARD_NXP_LPCXPRESSO_1549) */
/*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/
/*****************************************************************************
* Private functions
****************************************************************************/
/*****************************************************************************
* Public functions
****************************************************************************/
/**
* @brief Handle interrupt from SysTick timer
* @return Nothing
*/
void SysTick_Handler(void)
{
uint32_t states;
/* Get current masked port states */
states = Chip_GPIO_GetMaskedPortValue(LPC_GPIO, 0);
/* Toggle all the states */
states = ~states;
/* Write states back via masked set function. Only the enanled
(masked states) will be changed. */
Chip_GPIO_SetMaskedPortValue(LPC_GPIO, 0, states);
}
/**
* @brief Main program body
* @return Does not return
*/
int main(void) {
/* Generic Initialization */
SystemCoreClockUpdate();
Board_Init();
/* Chip_GPIO_Init(LPC_GPIO) is called as part of Board_Init() */
/* Set port 0 pins to the output direction */
Chip_GPIO_SetPortDIROutput(LPC_GPIO, 0, PORT_MASK);
/* Set GPIO port mask value to make sure only port 0
selected pins are activated during writes */
Chip_GPIO_SetPortMask(LPC_GPIO, 0, ~PORT_MASK);
/* Enable SysTick Timer */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);
/* All work happens in the systick interrupt handler */
while (1) {
__WFI();
}
return 0;
}
|
d566d1debad27b1a4f6f9c7d708c2a488c86148b
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
|
74861a7fb807d8c2441f3cce86c5921e8c4787f5
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 3,968
|
c
|
pq2ads-pci-pic.c
|
/*
* PQ2 ADS-style PCI interrupt controller
*
* Copyright 2007 Freescale Semiconductor, Inc.
* Author: Scott Wood <scottwood@freescale.com>
*
* Loosely based on mpc82xx ADS support by Vitaly Bordug <vbordug@ru.mvista.com>
* Copyright (c) 2006 MontaVista Software, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/irq.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/cpm2.h>
#include "pq2.h"
static DEFINE_RAW_SPINLOCK(pci_pic_lock);
struct pq2ads_pci_pic {
struct device_node *node;
struct irq_domain *host;
struct {
u32 stat;
u32 mask;
} __iomem *regs;
};
#define NUM_IRQS 32
static void pq2ads_pci_mask_irq(struct irq_data *d)
{
struct pq2ads_pci_pic *priv = irq_data_get_irq_chip_data(d);
int irq = NUM_IRQS - irqd_to_hwirq(d) - 1;
if (irq != -1) {
unsigned long flags;
raw_spin_lock_irqsave(&pci_pic_lock, flags);
setbits32(&priv->regs->mask, 1 << irq);
mb();
raw_spin_unlock_irqrestore(&pci_pic_lock, flags);
}
}
static void pq2ads_pci_unmask_irq(struct irq_data *d)
{
struct pq2ads_pci_pic *priv = irq_data_get_irq_chip_data(d);
int irq = NUM_IRQS - irqd_to_hwirq(d) - 1;
if (irq != -1) {
unsigned long flags;
raw_spin_lock_irqsave(&pci_pic_lock, flags);
clrbits32(&priv->regs->mask, 1 << irq);
raw_spin_unlock_irqrestore(&pci_pic_lock, flags);
}
}
static struct irq_chip pq2ads_pci_ic = {
.name = "PQ2 ADS PCI",
.irq_mask = pq2ads_pci_mask_irq,
.irq_mask_ack = pq2ads_pci_mask_irq,
.irq_ack = pq2ads_pci_mask_irq,
.irq_unmask = pq2ads_pci_unmask_irq,
.irq_enable = pq2ads_pci_unmask_irq,
.irq_disable = pq2ads_pci_mask_irq
};
static void pq2ads_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
{
struct pq2ads_pci_pic *priv = irq_desc_get_handler_data(desc);
u32 stat, mask, pend;
int bit;
for (;;) {
stat = in_be32(&priv->regs->stat);
mask = in_be32(&priv->regs->mask);
pend = stat & ~mask;
if (!pend)
break;
for (bit = 0; pend != 0; ++bit, pend <<= 1) {
if (pend & 0x80000000) {
int virq = irq_linear_revmap(priv->host, bit);
generic_handle_irq(virq);
}
}
}
}
static int pci_pic_host_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw)
{
irq_set_status_flags(virq, IRQ_LEVEL);
irq_set_chip_data(virq, h->host_data);
irq_set_chip_and_handler(virq, &pq2ads_pci_ic, handle_level_irq);
return 0;
}
static const struct irq_domain_ops pci_pic_host_ops = {
.map = pci_pic_host_map,
};
int __init pq2ads_pci_init_irq(void)
{
struct pq2ads_pci_pic *priv;
struct irq_domain *host;
struct device_node *np;
int ret = -ENODEV;
int irq;
np = of_find_compatible_node(NULL, NULL, "fsl,pq2ads-pci-pic");
if (!np) {
printk(KERN_ERR "No pci pic node in device tree.\n");
of_node_put(np);
goto out;
}
irq = irq_of_parse_and_map(np, 0);
if (irq == NO_IRQ) {
printk(KERN_ERR "No interrupt in pci pic node.\n");
of_node_put(np);
goto out;
}
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
of_node_put(np);
ret = -ENOMEM;
goto out_unmap_irq;
}
/* PCI interrupt controller registers: status and mask */
priv->regs = of_iomap(np, 0);
if (!priv->regs) {
printk(KERN_ERR "Cannot map PCI PIC registers.\n");
goto out_free_kmalloc;
}
/* mask all PCI interrupts */
out_be32(&priv->regs->mask, ~0);
mb();
host = irq_domain_add_linear(np, NUM_IRQS, &pci_pic_host_ops, priv);
if (!host) {
ret = -ENOMEM;
goto out_unmap_regs;
}
priv->host = host;
irq_set_handler_data(irq, priv);
irq_set_chained_handler(irq, pq2ads_pci_irq_demux);
of_node_put(np);
return 0;
out_unmap_regs:
iounmap(priv->regs);
out_free_kmalloc:
kfree(priv);
of_node_put(np);
out_unmap_irq:
irq_dispose_mapping(irq);
out:
return ret;
}
|
defc3dfd82d72021c25b8a9131745144647af23d
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/ffmpeg/libavformat/network.c
|
21e20b3e9a9057760b315b6974d74392c608451b
|
[
"LGPL-2.1-or-later",
"BSD-2-Clause",
"LGPL-2.1-only",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"GPL-3.0-or-later",
"LGPL-3.0-or-later",
"IJG",
"LicenseRef-scancode-other-permissive",
"MIT",
"GPL-2.0-or-later",
"Apache-2.0",
"GPL-3.0-only",
"BSD-3-Clause"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 18,631
|
c
|
network.c
|
/*
* Copyright (c) 2007 The FFmpeg Project
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config_components.h"
#include <fcntl.h>
#include "network.h"
#include "tls.h"
#include "url.h"
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "libavutil/time.h"
int ff_tls_init(void)
{
#if CONFIG_TLS_PROTOCOL
#if CONFIG_OPENSSL
int ret;
if ((ret = ff_openssl_init()) < 0)
return ret;
#endif
#if CONFIG_GNUTLS
ff_gnutls_init();
#endif
#endif
return 0;
}
void ff_tls_deinit(void)
{
#if CONFIG_TLS_PROTOCOL
#if CONFIG_OPENSSL
ff_openssl_deinit();
#endif
#if CONFIG_GNUTLS
ff_gnutls_deinit();
#endif
#endif
}
int ff_network_init(void)
{
#if HAVE_WINSOCK2_H
WSADATA wsaData;
if (WSAStartup(MAKEWORD(1,1), &wsaData))
return 0;
#endif
return 1;
}
int ff_network_wait_fd(int fd, int write)
{
int ev = write ? POLLOUT : POLLIN;
struct pollfd p = { .fd = fd, .events = ev, .revents = 0 };
int ret;
ret = poll(&p, 1, POLLING_TIME);
return ret < 0 ? ff_neterrno() : p.revents & (ev | POLLERR | POLLHUP) ? 0 : AVERROR(EAGAIN);
}
int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)
{
int ret;
int64_t wait_start = 0;
while (1) {
if (ff_check_interrupt(int_cb))
return AVERROR_EXIT;
ret = ff_network_wait_fd(fd, write);
if (ret != AVERROR(EAGAIN))
return ret;
if (timeout > 0) {
if (!wait_start)
wait_start = av_gettime_relative();
else if (av_gettime_relative() - wait_start > timeout)
return AVERROR(ETIMEDOUT);
}
}
}
int ff_network_sleep_interruptible(int64_t timeout, AVIOInterruptCB *int_cb)
{
int64_t wait_start = av_gettime_relative();
while (1) {
int64_t time_left;
if (ff_check_interrupt(int_cb))
return AVERROR_EXIT;
time_left = timeout - (av_gettime_relative() - wait_start);
if (time_left <= 0)
return AVERROR(ETIMEDOUT);
av_usleep(FFMIN(time_left, POLLING_TIME * 1000));
}
}
void ff_network_close(void)
{
#if HAVE_WINSOCK2_H
WSACleanup();
#endif
}
#if HAVE_WINSOCK2_H
int ff_neterrno(void)
{
int err = WSAGetLastError();
switch (err) {
case WSAEWOULDBLOCK:
return AVERROR(EAGAIN);
case WSAEINTR:
return AVERROR(EINTR);
case WSAEPROTONOSUPPORT:
return AVERROR(EPROTONOSUPPORT);
case WSAETIMEDOUT:
return AVERROR(ETIMEDOUT);
case WSAECONNREFUSED:
return AVERROR(ECONNREFUSED);
case WSAEINPROGRESS:
return AVERROR(EINPROGRESS);
}
return -err;
}
#endif
int ff_is_multicast_address(struct sockaddr *addr)
{
if (addr->sa_family == AF_INET) {
return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
}
#if HAVE_STRUCT_SOCKADDR_IN6
if (addr->sa_family == AF_INET6) {
return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
}
#endif
return 0;
}
static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout,
AVIOInterruptCB *cb)
{
int runs = timeout / POLLING_TIME;
int ret = 0;
do {
if (ff_check_interrupt(cb))
return AVERROR_EXIT;
ret = poll(p, nfds, POLLING_TIME);
if (ret != 0) {
if (ret < 0)
ret = ff_neterrno();
if (ret == AVERROR(EINTR))
continue;
break;
}
} while (timeout <= 0 || runs-- > 0);
if (!ret)
return AVERROR(ETIMEDOUT);
return ret;
}
int ff_socket(int af, int type, int proto, void *logctx)
{
int fd;
#ifdef SOCK_CLOEXEC
fd = socket(af, type | SOCK_CLOEXEC, proto);
if (fd == -1 && errno == EINVAL)
#endif
{
fd = socket(af, type, proto);
#if HAVE_FCNTL
if (fd != -1) {
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
av_log(logctx, AV_LOG_DEBUG, "Failed to set close on exec\n");
}
#endif
}
#ifdef SO_NOSIGPIPE
if (fd != -1) {
if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &(int){1}, sizeof(int))) {
av_log(logctx, AV_LOG_WARNING, "setsockopt(SO_NOSIGPIPE) failed\n");
}
}
#endif
return fd;
}
int ff_listen(int fd, const struct sockaddr *addr,
socklen_t addrlen, void *logctx)
{
int ret;
int reuse = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))) {
av_log(logctx, AV_LOG_WARNING, "setsockopt(SO_REUSEADDR) failed\n");
}
ret = bind(fd, addr, addrlen);
if (ret)
return ff_neterrno();
ret = listen(fd, 1);
if (ret)
return ff_neterrno();
return ret;
}
int ff_accept(int fd, int timeout, URLContext *h)
{
int ret;
struct pollfd lp = { fd, POLLIN, 0 };
ret = ff_poll_interrupt(&lp, 1, timeout, &h->interrupt_callback);
if (ret < 0)
return ret;
ret = accept(fd, NULL, NULL);
if (ret < 0)
return ff_neterrno();
if (ff_socket_nonblock(ret, 1) < 0)
av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
return ret;
}
int ff_listen_bind(int fd, const struct sockaddr *addr,
socklen_t addrlen, int timeout, URLContext *h)
{
int ret;
if ((ret = ff_listen(fd, addr, addrlen, h)) < 0)
return ret;
if ((ret = ff_accept(fd, timeout, h)) < 0)
return ret;
closesocket(fd);
return ret;
}
int ff_listen_connect(int fd, const struct sockaddr *addr,
socklen_t addrlen, int timeout, URLContext *h,
int will_try_next)
{
struct pollfd p = {fd, POLLOUT, 0};
int ret;
socklen_t optlen;
if (ff_socket_nonblock(fd, 1) < 0)
av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n");
while ((ret = connect(fd, addr, addrlen))) {
ret = ff_neterrno();
switch (ret) {
case AVERROR(EINTR):
if (ff_check_interrupt(&h->interrupt_callback))
return AVERROR_EXIT;
continue;
case AVERROR(EINPROGRESS):
case AVERROR(EAGAIN):
ret = ff_poll_interrupt(&p, 1, timeout, &h->interrupt_callback);
if (ret < 0)
return ret;
optlen = sizeof(ret);
if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
ret = AVUNERROR(ff_neterrno());
if (ret != 0) {
char errbuf[100];
ret = AVERROR(ret);
av_strerror(ret, errbuf, sizeof(errbuf));
if (will_try_next)
av_log(h, AV_LOG_WARNING,
"Connection to %s failed (%s), trying next address\n",
h->filename, errbuf);
else
av_log(h, AV_LOG_ERROR, "Connection to %s failed: %s\n",
h->filename, errbuf);
}
default:
return ret;
}
}
return ret;
}
static void interleave_addrinfo(struct addrinfo *base)
{
struct addrinfo **next = &base->ai_next;
while (*next) {
struct addrinfo *cur = *next;
// Iterate forward until we find an entry of a different family.
if (cur->ai_family == base->ai_family) {
next = &cur->ai_next;
continue;
}
if (cur == base->ai_next) {
// If the first one following base is of a different family, just
// move base forward one step and continue.
base = cur;
next = &base->ai_next;
continue;
}
// Unchain cur from the rest of the list from its current spot.
*next = cur->ai_next;
// Hook in cur directly after base.
cur->ai_next = base->ai_next;
base->ai_next = cur;
// Restart with a new base. We know that before moving the cur element,
// everything between the previous base and cur had the same family,
// different from cur->ai_family. Therefore, we can keep next pointing
// where it was, and continue from there with base at the one after
// cur.
base = cur->ai_next;
}
}
static void print_address_list(void *ctx, const struct addrinfo *addr,
const char *title)
{
char hostbuf[100], portbuf[20];
av_log(ctx, AV_LOG_DEBUG, "%s:\n", title);
while (addr) {
getnameinfo(addr->ai_addr, addr->ai_addrlen,
hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
NI_NUMERICHOST | NI_NUMERICSERV);
av_log(ctx, AV_LOG_DEBUG, "Address %s port %s\n", hostbuf, portbuf);
addr = addr->ai_next;
}
}
struct ConnectionAttempt {
int fd;
int64_t deadline_us;
struct addrinfo *addr;
};
// Returns < 0 on error, 0 on successfully started connection attempt,
// > 0 for a connection that succeeded already.
static int start_connect_attempt(struct ConnectionAttempt *attempt,
struct addrinfo **ptr, int timeout_ms,
URLContext *h,
void (*customize_fd)(void *, int), void *customize_ctx)
{
struct addrinfo *ai = *ptr;
int ret;
*ptr = ai->ai_next;
attempt->fd = ff_socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol, h);
if (attempt->fd < 0)
return ff_neterrno();
attempt->deadline_us = av_gettime_relative() + timeout_ms * 1000;
attempt->addr = ai;
ff_socket_nonblock(attempt->fd, 1);
if (customize_fd)
customize_fd(customize_ctx, attempt->fd);
while ((ret = connect(attempt->fd, ai->ai_addr, ai->ai_addrlen))) {
ret = ff_neterrno();
switch (ret) {
case AVERROR(EINTR):
if (ff_check_interrupt(&h->interrupt_callback)) {
closesocket(attempt->fd);
attempt->fd = -1;
return AVERROR_EXIT;
}
continue;
case AVERROR(EINPROGRESS):
case AVERROR(EAGAIN):
return 0;
default:
closesocket(attempt->fd);
attempt->fd = -1;
return ret;
}
}
return 1;
}
// Try a new connection to another address after 200 ms, as suggested in
// RFC 8305 (or sooner if an earlier attempt fails).
#define NEXT_ATTEMPT_DELAY_MS 200
int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address,
int parallel, URLContext *h, int *fd,
void (*customize_fd)(void *, int), void *customize_ctx)
{
struct ConnectionAttempt attempts[3];
struct pollfd pfd[3];
int nb_attempts = 0, i, j;
int64_t next_attempt_us = av_gettime_relative(), next_deadline_us;
int last_err = AVERROR(EIO);
socklen_t optlen;
char errbuf[100], hostbuf[100], portbuf[20];
if (parallel > FF_ARRAY_ELEMS(attempts))
parallel = FF_ARRAY_ELEMS(attempts);
print_address_list(h, addrs, "Original list of addresses");
// This mutates the list, but the head of the list is still the same
// element, so the caller, who owns the list, doesn't need to get
// an updated pointer.
interleave_addrinfo(addrs);
print_address_list(h, addrs, "Interleaved list of addresses");
while (nb_attempts > 0 || addrs) {
// Start a new connection attempt, if possible.
if (nb_attempts < parallel && addrs) {
getnameinfo(addrs->ai_addr, addrs->ai_addrlen,
hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
NI_NUMERICHOST | NI_NUMERICSERV);
av_log(h, AV_LOG_VERBOSE, "Starting connection attempt to %s port %s\n",
hostbuf, portbuf);
last_err = start_connect_attempt(&attempts[nb_attempts], &addrs,
timeout_ms_per_address, h,
customize_fd, customize_ctx);
if (last_err < 0) {
av_strerror(last_err, errbuf, sizeof(errbuf));
av_log(h, AV_LOG_VERBOSE, "Connected attempt failed: %s\n",
errbuf);
continue;
}
if (last_err > 0) {
for (i = 0; i < nb_attempts; i++)
closesocket(attempts[i].fd);
*fd = attempts[nb_attempts].fd;
return 0;
}
pfd[nb_attempts].fd = attempts[nb_attempts].fd;
pfd[nb_attempts].events = POLLOUT;
next_attempt_us = av_gettime_relative() + NEXT_ATTEMPT_DELAY_MS * 1000;
nb_attempts++;
}
av_assert0(nb_attempts > 0);
// The connection attempts are sorted from oldest to newest, so the
// first one will have the earliest deadline.
next_deadline_us = attempts[0].deadline_us;
// If we can start another attempt in parallel, wait until that time.
if (nb_attempts < parallel && addrs)
next_deadline_us = FFMIN(next_deadline_us, next_attempt_us);
last_err = ff_poll_interrupt(pfd, nb_attempts,
(next_deadline_us - av_gettime_relative())/1000,
&h->interrupt_callback);
if (last_err < 0 && last_err != AVERROR(ETIMEDOUT))
break;
// Check the status from the poll output.
for (i = 0; i < nb_attempts; i++) {
last_err = 0;
if (pfd[i].revents) {
// Some sort of action for this socket, check its status (either
// a successful connection or an error).
optlen = sizeof(last_err);
if (getsockopt(attempts[i].fd, SOL_SOCKET, SO_ERROR, &last_err, &optlen))
last_err = ff_neterrno();
else if (last_err != 0)
last_err = AVERROR(last_err);
if (last_err == 0) {
// Everything is ok, we seem to have a successful
// connection. Close other sockets and return this one.
for (j = 0; j < nb_attempts; j++)
if (j != i)
closesocket(attempts[j].fd);
*fd = attempts[i].fd;
getnameinfo(attempts[i].addr->ai_addr, attempts[i].addr->ai_addrlen,
hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
NI_NUMERICHOST | NI_NUMERICSERV);
av_log(h, AV_LOG_VERBOSE, "Successfully connected to %s port %s\n",
hostbuf, portbuf);
return 0;
}
}
if (attempts[i].deadline_us < av_gettime_relative() && !last_err)
last_err = AVERROR(ETIMEDOUT);
if (!last_err)
continue;
// Error (or timeout) for this socket; close the socket and remove
// it from the attempts/pfd arrays, to let a new attempt start
// directly.
getnameinfo(attempts[i].addr->ai_addr, attempts[i].addr->ai_addrlen,
hostbuf, sizeof(hostbuf), portbuf, sizeof(portbuf),
NI_NUMERICHOST | NI_NUMERICSERV);
av_strerror(last_err, errbuf, sizeof(errbuf));
av_log(h, AV_LOG_VERBOSE, "Connection attempt to %s port %s "
"failed: %s\n", hostbuf, portbuf, errbuf);
closesocket(attempts[i].fd);
memmove(&attempts[i], &attempts[i + 1],
(nb_attempts - i - 1) * sizeof(*attempts));
memmove(&pfd[i], &pfd[i + 1],
(nb_attempts - i - 1) * sizeof(*pfd));
i--;
nb_attempts--;
}
}
for (i = 0; i < nb_attempts; i++)
closesocket(attempts[i].fd);
if (last_err >= 0)
last_err = AVERROR(ECONNREFUSED);
if (last_err != AVERROR_EXIT) {
av_strerror(last_err, errbuf, sizeof(errbuf));
av_log(h, AV_LOG_ERROR, "Connection to %s failed: %s\n",
h->filename, errbuf);
}
return last_err;
}
static int match_host_pattern(const char *pattern, const char *hostname)
{
int len_p, len_h;
if (!strcmp(pattern, "*"))
return 1;
// Skip a possible *. at the start of the pattern
if (pattern[0] == '*')
pattern++;
if (pattern[0] == '.')
pattern++;
len_p = strlen(pattern);
len_h = strlen(hostname);
if (len_p > len_h)
return 0;
// Simply check if the end of hostname is equal to 'pattern'
if (!strcmp(pattern, &hostname[len_h - len_p])) {
if (len_h == len_p)
return 1; // Exact match
if (hostname[len_h - len_p - 1] == '.')
return 1; // The matched substring is a domain and not just a substring of a domain
}
return 0;
}
int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
{
char *buf, *start;
int ret = 0;
if (!no_proxy)
return 0;
if (!hostname)
return 0;
buf = av_strdup(no_proxy);
if (!buf)
return 0;
start = buf;
while (start) {
char *sep, *next = NULL;
start += strspn(start, " ,");
sep = start + strcspn(start, " ,");
if (*sep) {
next = sep + 1;
*sep = '\0';
}
if (match_host_pattern(start, hostname)) {
ret = 1;
break;
}
start = next;
}
av_free(buf);
return ret;
}
void ff_log_net_error(void *ctx, int level, const char* prefix)
{
char errbuf[100];
av_strerror(ff_neterrno(), errbuf, sizeof(errbuf));
av_log(ctx, level, "%s: %s\n", prefix, errbuf);
}
|
d4835725ec277bf7355e80243153f5745111412b
|
f83a1496c5180a875ceeac552696bb1cf1886c35
|
/examples/chtest/setuid.c
|
90da1f06214ff3353e0d9b450adc3060493d050a
|
[
"Apache-2.0"
] |
permissive
|
hpc/charliecloud
|
08771e0e37a774d94c99833e825161762af9428b
|
707f5600f803221ccd56dd29a8a7bc163d7bf2a2
|
refs/heads/master
| 2023-09-01T19:52:32.224517
| 2023-08-30T17:42:09
| 2023-08-30T17:42:09
| 37,544,052
| 304
| 66
|
Apache-2.0
| 2023-09-14T20:59:56
| 2015-06-16T17:04:19
|
Shell
|
UTF-8
|
C
| false
| false
| 868
|
c
|
setuid.c
|
/* Try to change effective UID. */
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#define NOBODY 65534
#define NOBODY2 65533
int main(int argc, char ** argv)
{
// target UID is nobody, unless we're already nobody
uid_t start = geteuid();
uid_t target = start != NOBODY ? NOBODY : NOBODY2;
int result;
fprintf(stderr, "current EUID=%u, attempting EUID=%u\n", start, target);
result = seteuid(target);
// setuid(2) fails with EINVAL in user namespaces and EPERM if not root.
if (result == 0) {
printf("RISK\tsetuid(2) succeeded for EUID=%u\n", target);
return 1;
} else if (errno == EINVAL) {
printf("SAFE\tsetuid(2) failed as expected with EINVAL\n");
return 0;
}
printf("ERROR\tsetuid(2) failed unexpectedly with errno=%d\n", errno);
return 1;
}
|
e481eab2e74f88cc43238f821c443545988ffa2e
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/devel/mingw32-gcc/files/patch-gcc_config_alpha_vms.h
|
2f355b7c83575dedfa4603d080a7d892822dd176
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 908
|
h
|
patch-gcc_config_alpha_vms.h
|
--- gcc/config/alpha/vms.h.orig 2013-01-10 20:38:27 UTC
+++ gcc/config/alpha/vms.h
@@ -219,7 +219,7 @@ typedef struct {int num_args; enum avms_
/* This is how to advance the location counter by SIZE bytes. */
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
- fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
+ fprintf (FILE, "\t.space " HOST_WIDE_INT_PRINT_UNSIGNED "\n", (SIZE))
/* This says how to output an assembler line
to define a global common symbol. */
@@ -227,7 +227,7 @@ typedef struct {int num_args; enum avms_
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE,ROUNDED) \
( fputs ("\t.lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)))
+ fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED "\n", (SIZE)))
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
|
78b9434068d49de01ccf4300c6ccad0a742c63ce
|
4e32ea5b4a215f427af04630e01b1312ffd31a55
|
/test/programs/simple/blast_incorrect.c
|
0b6cf03b0a3f88a7514e09220fda34e1ed3a050e
|
[
"Apache-2.0",
"GPL-1.0-or-later"
] |
permissive
|
sosy-lab/cpachecker
|
1add74cb774316dd6e1aea3fb1f352c8141466b7
|
1822761867d106301bda0bc99ed3cc0a25c529aa
|
refs/heads/trunk
| 2023-08-31T14:47:22.284597
| 2023-08-31T14:20:58
| 2023-08-31T14:20:58
| 20,107,238
| 186
| 90
|
Apache-2.0
| 2021-07-27T14:24:30
| 2014-05-23T16:57:37
|
SWIG
|
UTF-8
|
C
| false
| false
| 884
|
c
|
blast_incorrect.c
|
// This file is part of CPAchecker,
// a tool for configurable software verification:
// https://cpachecker.sosy-lab.org
//
// SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
//
// SPDX-License-Identifier: Apache-2.0
#define __attribute__(x) /*NOTHING*/
#include <assert.h>
// Contributed by Pavel Shved and Vadim Mutilin.
//
// This program is unsafe, but BLAST reports a `No new predicates' error.
//
// BLAST was run with the following arguments:
// pblast.opt -craig 2 -predH 7 -alias bdd -dfs -cref
typedef int rr;
rr yyyy;
rr * getrr()
{
rr * r = &yyyy;
*r = 1;
return r;
}
int main()
{
rr * ptr1,*ptr2;
ptr1 = getrr();
//If we uncomment the next line, BLAST will work correctly and report unsafety.
//ptr1 = &yyyy; *ptr1 = 1;
ptr2 = ptr1;
assert(*ptr2 == 1);
*ptr2 = 2;
ptr2 = ptr1;
assert(*ptr2 == 1);
*ptr2 = 2;
return 0;
}
|
144b05152012a14177f109538af2751a45fc6d28
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/mfd/tps65912-i2c.c
|
c041f2c3d2bdd01190fd7bbc72d17acb6228c51f
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 3,182
|
c
|
tps65912-i2c.c
|
/*
* tps65912-i2c.c -- I2C access for TI TPS65912x PMIC
*
* Copyright 2011 Texas Instruments Inc.
*
* Author: Margarita Olaya Cabrera <magi@slimlogic.co.uk>
*
* 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 driver is based on wm8350 implementation.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/mfd/core.h>
#include <linux/mfd/tps65912.h>
static int tps65912_i2c_read(struct tps65912 *tps65912, u8 reg,
int bytes, void *dest)
{
struct i2c_client *i2c = tps65912->control_data;
struct i2c_msg xfer[2];
int ret;
/* Write register */
xfer[0].addr = i2c->addr;
xfer[0].flags = 0;
xfer[0].len = 1;
xfer[0].buf = ®
/* Read data */
xfer[1].addr = i2c->addr;
xfer[1].flags = I2C_M_RD;
xfer[1].len = bytes;
xfer[1].buf = dest;
ret = i2c_transfer(i2c->adapter, xfer, 2);
if (ret == 2)
ret = 0;
else if (ret >= 0)
ret = -EIO;
return ret;
}
static int tps65912_i2c_write(struct tps65912 *tps65912, u8 reg,
int bytes, void *src)
{
struct i2c_client *i2c = tps65912->control_data;
/* we add 1 byte for device register */
u8 msg[TPS6591X_MAX_REGISTER + 1];
int ret;
if (bytes > TPS6591X_MAX_REGISTER)
return -EINVAL;
msg[0] = reg;
memcpy(&msg[1], src, bytes);
ret = i2c_master_send(i2c, msg, bytes + 1);
if (ret < 0)
return ret;
if (ret != bytes + 1)
return -EIO;
return 0;
}
static int tps65912_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct tps65912 *tps65912;
tps65912 = kzalloc(sizeof(struct tps65912), GFP_KERNEL);
if (tps65912 == NULL)
return -ENOMEM;
i2c_set_clientdata(i2c, tps65912);
tps65912->dev = &i2c->dev;
tps65912->control_data = i2c;
tps65912->read = tps65912_i2c_read;
tps65912->write = tps65912_i2c_write;
return tps65912_device_init(tps65912);
}
static int tps65912_i2c_remove(struct i2c_client *i2c)
{
struct tps65912 *tps65912 = i2c_get_clientdata(i2c);
tps65912_device_exit(tps65912);
return 0;
}
static const struct i2c_device_id tps65912_i2c_id[] = {
{"tps65912", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tps65912_i2c_id);
static struct i2c_driver tps65912_i2c_driver = {
.driver = {
.name = "tps65912",
.owner = THIS_MODULE,
},
.probe = tps65912_i2c_probe,
.remove = tps65912_i2c_remove,
.id_table = tps65912_i2c_id,
};
static int __init tps65912_i2c_init(void)
{
int ret;
ret = i2c_add_driver(&tps65912_i2c_driver);
if (ret != 0)
pr_err("Failed to register TPS65912 I2C driver: %d\n", ret);
return ret;
}
/* init early so consumer devices can complete system boot */
subsys_initcall(tps65912_i2c_init);
static void __exit tps65912_i2c_exit(void)
{
i2c_del_driver(&tps65912_i2c_driver);
}
module_exit(tps65912_i2c_exit);
MODULE_AUTHOR("Margarita Olaya <magi@slimlogic.co.uk>");
MODULE_DESCRIPTION("TPS6591x chip family multi-function driver");
MODULE_LICENSE("GPL");
|
2ceb4be67cd788456f6de5cbd3f775809848a0fe
|
80d97bc5ff8a43da99893a57f03002e68081d780
|
/src/Extension/IPC/FileMapping.h
|
105b2d7da36115433cec020ce96950fc16e80dca
|
[
"BSD-2-Clause",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ProgerXP/Notepad2e
|
38798db10e0fe0a5602a463a5681bd653afe3bb6
|
c703f11bc278457286b3ca1565047a3b09ccdf8d
|
refs/heads/master
| 2023-09-05T23:32:07.576076
| 2023-07-27T11:03:30
| 2023-07-27T11:03:49
| 10,840,481
| 376
| 50
|
NOASSERTION
| 2022-08-22T14:06:36
| 2013-06-21T10:28:18
|
C++
|
UTF-8
|
C
| false
| false
| 1,917
|
h
|
FileMapping.h
|
#pragma once
#include "Event.h"
#define LODWORD(l) ((DWORD)(((__int64)(l)) & 0xffffffff))
#define HIDWORD(l) ((DWORD)((((__int64)(l)) >> 32) & 0xffffffff))
extern DWORD dwFileMapAllocationGranularity;
struct TFileMapping
{
HANDLE file;
HANDLE handle;
WCHAR name[MAX_PATH];
Event eventTryCreate;
Event eventCreated;
Event eventTryClose;
Event eventClosed;
__int64 iBufferSize;
__int64 iFileOffset;
LPBYTE lpData;
LPBYTE lpDataCurrent;
__int64 iDataSize;
DWORD error;
};
typedef struct TFileMapping FileMapping;
void FileMapping_ResetError(FileMapping *pFileMapping);
DWORD FileMapping_GetError(const FileMapping *pFileMapping);
void FileMapping_SaveError(FileMapping *pFileMapping);
BOOL FileMapping_IsOK(const FileMapping *pFileMapping);
HANDLE FileMapping_GetTryCreateHandle(const FileMapping *pFileMapping);
HANDLE FileMapping_GetCreatedHandle(const FileMapping *pFileMapping);
HANDLE FileMapping_GetTryCloseHandle(const FileMapping *pFileMapping);
HANDLE FileMapping_GetClosedHandle(const FileMapping *pFileMapping);
BOOL FileMapping_Init(FileMapping *pFileMapping, LPCWSTR lpName, const BOOL bOpenExisting);
BOOL FileMapping_Free(FileMapping *pFileMapping);
BOOL FileMapping_TryCreate(FileMapping *pFileMapping);
BOOL FileMapping_TryClose(FileMapping *pFileMapping);
BOOL FileMapping_IsOpened(const FileMapping *pFileMapping);
BOOL FileMapping_Open(FileMapping *pFileMapping, LPCWSTR lpFile, const __int64 size, const BOOL bOpenExisting);
BOOL FileMapping_Close(FileMapping *pFileMapping, const __int64 size);
BOOL FileMapping_MapViewOfFile(FileMapping *pFileMapping);
BOOL FileMapping_UnmapViewOfFile(FileMapping *pFileMapping);
BOOL FileMapping_FlushViewOfFile(FileMapping *pFileMapping);
BOOL FileMapping_Read(FileMapping *pFileMapping, LPBYTE pBuffer, const DWORD count);
BOOL FileMapping_Write(FileMapping *pFileMapping, LPCBYTE pBuffer, const DWORD count);
|
87aeb6230005140ed41e50bc9aaa574a84162af7
|
ce99bd11ca505967277f4689c621479c1987698e
|
/src/game/initpathtablelinks.c
|
f0038f5bb12d3771ab7cb749dbcf436b33d6bf86
|
[] |
no_license
|
n64decomp/007
|
5951258890f15431f273e1503674c5e0402c66e0
|
c46751089ddc18b12ef7a45b6a3e03de2054c422
|
refs/heads/master
| 2022-11-08T23:34:54.021033
| 2022-10-29T14:41:01
| 2022-10-29T14:41:01
| 241,212,109
| 359
| 48
| null | 2020-11-21T23:30:31
| 2020-02-17T21:31:00
|
C
|
UTF-8
|
C
| false
| false
| 17,050
|
c
|
initpathtablelinks.c
|
#include <ultra64.h>
#include "initpathtablelinks.h"
#ifdef NONMATCHING
void init_path_table_links(void) {
}
#else
GLOBAL_ASM(
.text
glabel init_path_table_links
/* 03B3C0 7F006890 27BDFF20 */ addiu $sp, $sp, -0xe0
/* 03B3C4 7F006894 AFB40028 */ sw $s4, 0x28($sp)
/* 03B3C8 7F006898 3C148007 */ lui $s4, %hi(g_CurrentSetup+0)
/* 03B3CC 7F00689C 26945D00 */ addiu $s4, %lo(g_CurrentSetup+0) # addiu $s4, $s4, 0x5d00
/* 03B3D0 7F0068A0 AFB00018 */ sw $s0, 0x18($sp)
/* 03B3D4 7F0068A4 8E900000 */ lw $s0, ($s4)
/* 03B3D8 7F0068A8 8E8E0004 */ lw $t6, 4($s4)
/* 03B3DC 7F0068AC AFB60030 */ sw $s6, 0x30($sp)
/* 03B3E0 7F0068B0 AFBF003C */ sw $ra, 0x3c($sp)
/* 03B3E4 7F0068B4 AFBE0038 */ sw $fp, 0x38($sp)
/* 03B3E8 7F0068B8 AFB70034 */ sw $s7, 0x34($sp)
/* 03B3EC 7F0068BC AFB5002C */ sw $s5, 0x2c($sp)
/* 03B3F0 7F0068C0 AFB30024 */ sw $s3, 0x24($sp)
/* 03B3F4 7F0068C4 AFB20020 */ sw $s2, 0x20($sp)
/* 03B3F8 7F0068C8 AFB1001C */ sw $s1, 0x1c($sp)
/* 03B3FC 7F0068CC 0000B025 */ move $s6, $zero
/* 03B400 7F0068D0 12000036 */ beqz $s0, .L7F0069AC
/* 03B404 7F0068D4 AFAE00D8 */ sw $t6, 0xd8($sp)
/* 03B408 7F0068D8 8E0F0000 */ lw $t7, ($s0)
/* 03B40C 7F0068DC 00003825 */ move $a3, $zero
/* 03B410 7F0068E0 02006825 */ move $t5, $s0
/* 03B414 7F0068E4 05E20032 */ bltzl $t7, .L7F0069B0
/* 03B418 7F0068E8 8FAE00D8 */ lw $t6, 0xd8($sp)
/* 03B41C 7F0068EC 8DA20004 */ lw $v0, 4($t5)
.L7F0068F0:
/* 03B420 7F0068F0 8C460000 */ lw $a2, ($v0)
/* 03B424 7F0068F4 00404025 */ move $t0, $v0
/* 03B428 7F0068F8 04C20027 */ bltzl $a2, .L7F006998
/* 03B42C 7F0068FC 24E70001 */ addiu $a3, $a3, 1
.L7F006900:
/* 03B430 7F006900 14C70007 */ bne $a2, $a3, .L7F006920
/* 03B434 7F006904 0006C900 */ sll $t9, $a2, 4
/* 03B438 7F006908 8E980020 */ lw $t8, 0x20($s4)
/* 03B43C 7F00690C 24160001 */ li $s6, 1
/* 03B440 7F006910 5300001D */ beql $t8, $zero, .L7F006988
/* 03B444 7F006914 8D060004 */ lw $a2, 4($t0)
/* 03B448 7F006918 1000001B */ b .L7F006988
/* 03B44C 7F00691C 8D060004 */ lw $a2, 4($t0)
.L7F006920:
/* 03B450 7F006920 03301821 */ addu $v1, $t9, $s0
/* 03B454 7F006924 8C650004 */ lw $a1, 4($v1)
/* 03B458 7F006928 00002025 */ move $a0, $zero
/* 03B45C 7F00692C 8CAE0000 */ lw $t6, ($a1)
/* 03B460 7F006930 05C2000F */ bltzl $t6, .L7F006970
/* 03B464 7F006934 0004C880 */ sll $t9, $a0, 2
/* 03B468 7F006938 10EE000C */ beq $a3, $t6, .L7F00696C
/* 03B46C 7F00693C 00001080 */ sll $v0, $zero, 2
/* 03B470 7F006940 24420004 */ addiu $v0, $v0, 4
.L7F006944:
/* 03B474 7F006944 00A2C021 */ addu $t8, $a1, $v0
/* 03B478 7F006948 8F190000 */ lw $t9, ($t8)
/* 03B47C 7F00694C 24840001 */ addiu $a0, $a0, 1
/* 03B480 7F006950 07220007 */ bltzl $t9, .L7F006970
/* 03B484 7F006954 0004C880 */ sll $t9, $a0, 2
/* 03B488 7F006958 8C6E0004 */ lw $t6, 4($v1)
/* 03B48C 7F00695C 01C27821 */ addu $t7, $t6, $v0
/* 03B490 7F006960 8DF80000 */ lw $t8, ($t7)
/* 03B494 7F006964 54F8FFF7 */ bnel $a3, $t8, .L7F006944
/* 03B498 7F006968 24420004 */ addiu $v0, $v0, 4
.L7F00696C:
/* 03B49C 7F00696C 0004C880 */ sll $t9, $a0, 2
.L7F006970:
/* 03B4A0 7F006970 00B97021 */ addu $t6, $a1, $t9
/* 03B4A4 7F006974 8DCF0000 */ lw $t7, ($t6)
/* 03B4A8 7F006978 50EF0003 */ beql $a3, $t7, .L7F006988
/* 03B4AC 7F00697C 8D060004 */ lw $a2, 4($t0)
/* 03B4B0 7F006980 24160001 */ li $s6, 1
/* 03B4B4 7F006984 8D060004 */ lw $a2, 4($t0)
.L7F006988:
/* 03B4B8 7F006988 25080004 */ addiu $t0, $t0, 4
/* 03B4BC 7F00698C 04C1FFDC */ bgez $a2, .L7F006900
/* 03B4C0 7F006990 00000000 */ nop
/* 03B4C4 7F006994 24E70001 */ addiu $a3, $a3, 1
.L7F006998:
/* 03B4C8 7F006998 0007C100 */ sll $t8, $a3, 4
/* 03B4CC 7F00699C 03106821 */ addu $t5, $t8, $s0
/* 03B4D0 7F0069A0 8DB90000 */ lw $t9, ($t5)
/* 03B4D4 7F0069A4 0723FFD2 */ bgezl $t9, .L7F0068F0
/* 03B4D8 7F0069A8 8DA20004 */ lw $v0, 4($t5)
.L7F0069AC:
/* 03B4DC 7F0069AC 8FAE00D8 */ lw $t6, 0xd8($sp)
.L7F0069B0:
/* 03B4E0 7F0069B0 11C00054 */ beqz $t6, .L7F006B04
/* 03B4E4 7F0069B4 00000000 */ nop
/* 03B4E8 7F0069B8 8DCF0000 */ lw $t7, ($t6)
/* 03B4EC 7F0069BC 00008825 */ move $s1, $zero
/* 03B4F0 7F0069C0 01C0A825 */ move $s5, $t6
/* 03B4F4 7F0069C4 11E0004F */ beqz $t7, .L7F006B04
/* 03B4F8 7F0069C8 27BE00A0 */ addiu $fp, $sp, 0xa0
/* 03B4FC 7F0069CC AFAE0048 */ sw $t6, 0x48($sp)
/* 03B500 7F0069D0 2417000C */ li $s7, 12
/* 03B504 7F0069D4 8EB80000 */ lw $t8, ($s5)
.L7F0069D8:
/* 03B508 7F0069D8 00009825 */ move $s3, $zero
/* 03B50C 7F0069DC 8F020000 */ lw $v0, ($t8)
/* 03B510 7F0069E0 04420042 */ bltzl $v0, .L7F006AEC
/* 03B514 7F0069E4 8FAE0048 */ lw $t6, 0x48($sp)
.L7F0069E8:
/* 03B518 7F0069E8 14510007 */ bne $v0, $s1, .L7F006A08
/* 03B51C 7F0069EC 00000000 */ nop
/* 03B520 7F0069F0 8E990024 */ lw $t9, 0x24($s4)
/* 03B524 7F0069F4 24160001 */ li $s6, 1
/* 03B528 7F0069F8 53200036 */ beql $t9, $zero, .L7F006AD4
/* 03B52C 7F0069FC 8EB90000 */ lw $t9, ($s5)
/* 03B530 7F006A00 10000034 */ b .L7F006AD4
/* 03B534 7F006A04 8EB90000 */ lw $t9, ($s5)
.L7F006A08:
/* 03B538 7F006A08 00570019 */ multu $v0, $s7
/* 03B53C 7F006A0C 8FAE00D8 */ lw $t6, 0xd8($sp)
/* 03B540 7F006A10 00002825 */ move $a1, $zero
/* 03B544 7F006A14 00007812 */ mflo $t7
/* 03B548 7F006A18 01EE9021 */ addu $s2, $t7, $t6
/* 03B54C 7F006A1C 8E460000 */ lw $a2, ($s2)
/* 03B550 7F006A20 02402025 */ move $a0, $s2
/* 03B554 7F006A24 8CD80000 */ lw $t8, ($a2)
/* 03B558 7F006A28 07020011 */ bltzl $t8, .L7F006A70
/* 03B55C 7F006A2C 00057880 */ sll $t7, $a1, 2
/* 03B560 7F006A30 8CD90000 */ lw $t9, ($a2)
/* 03B564 7F006A34 00001080 */ sll $v0, $zero, 2
/* 03B568 7F006A38 00C21821 */ addu $v1, $a2, $v0
/* 03B56C 7F006A3C 5239000C */ beql $s1, $t9, .L7F006A70
/* 03B570 7F006A40 00057880 */ sll $t7, $a1, 2
/* 03B574 7F006A44 8C6F0004 */ lw $t7, 4($v1)
.L7F006A48:
/* 03B578 7F006A48 24A50001 */ addiu $a1, $a1, 1
/* 03B57C 7F006A4C 24420004 */ addiu $v0, $v0, 4
/* 03B580 7F006A50 05E00006 */ bltz $t7, .L7F006A6C
/* 03B584 7F006A54 24630004 */ addiu $v1, $v1, 4
/* 03B588 7F006A58 8C8E0000 */ lw $t6, ($a0)
/* 03B58C 7F006A5C 01C2C021 */ addu $t8, $t6, $v0
/* 03B590 7F006A60 8F190000 */ lw $t9, ($t8)
/* 03B594 7F006A64 5639FFF8 */ bnel $s1, $t9, .L7F006A48
/* 03B598 7F006A68 8C6F0004 */ lw $t7, 4($v1)
.L7F006A6C:
/* 03B59C 7F006A6C 00057880 */ sll $t7, $a1, 2
.L7F006A70:
/* 03B5A0 7F006A70 00CF7021 */ addu $t6, $a2, $t7
/* 03B5A4 7F006A74 8DD80000 */ lw $t8, ($t6)
/* 03B5A8 7F006A78 52380008 */ beql $s1, $t8, .L7F006A9C
/* 03B5AC 7F006A7C 8E8F0000 */ lw $t7, ($s4)
/* 03B5B0 7F006A80 8E990024 */ lw $t9, 0x24($s4)
/* 03B5B4 7F006A84 24160001 */ li $s6, 1
/* 03B5B8 7F006A88 53200012 */ beql $t9, $zero, .L7F006AD4
/* 03B5BC 7F006A8C 8EB90000 */ lw $t9, ($s5)
/* 03B5C0 7F006A90 10000010 */ b .L7F006AD4
/* 03B5C4 7F006A94 8EB90000 */ lw $t9, ($s5)
/* 03B5C8 7F006A98 8E8F0000 */ lw $t7, ($s4)
.L7F006A9C:
/* 03B5CC 7F006A9C 02A02025 */ move $a0, $s5
/* 03B5D0 7F006AA0 02402825 */ move $a1, $s2
/* 03B5D4 7F006AA4 11E0000A */ beqz $t7, .L7F006AD0
/* 03B5D8 7F006AA8 03C03025 */ move $a2, $fp
/* 03B5DC 7F006AAC 0FC23D0E */ jal sub_GAME_7F08F438
/* 03B5E0 7F006AB0 27A7009C */ addiu $a3, $sp, 0x9c
/* 03B5E4 7F006AB4 8FAE00A0 */ lw $t6, 0xa0($sp)
/* 03B5E8 7F006AB8 8FB8009C */ lw $t8, 0x9c($sp)
/* 03B5EC 7F006ABC 51C00004 */ beql $t6, $zero, .L7F006AD0
/* 03B5F0 7F006AC0 24160001 */ li $s6, 1
/* 03B5F4 7F006AC4 57000003 */ bnezl $t8, .L7F006AD4
/* 03B5F8 7F006AC8 8EB90000 */ lw $t9, ($s5)
/* 03B5FC 7F006ACC 24160001 */ li $s6, 1
.L7F006AD0:
/* 03B600 7F006AD0 8EB90000 */ lw $t9, ($s5)
.L7F006AD4:
/* 03B604 7F006AD4 26730004 */ addiu $s3, $s3, 4
/* 03B608 7F006AD8 03337821 */ addu $t7, $t9, $s3
/* 03B60C 7F006ADC 8DE20000 */ lw $v0, ($t7)
/* 03B610 7F006AE0 0441FFC1 */ bgez $v0, .L7F0069E8
/* 03B614 7F006AE4 00000000 */ nop
/* 03B618 7F006AE8 8FAE0048 */ lw $t6, 0x48($sp)
.L7F006AEC:
/* 03B61C 7F006AEC 26310001 */ addiu $s1, $s1, 1
/* 03B620 7F006AF0 25D5000C */ addiu $s5, $t6, 0xc
/* 03B624 7F006AF4 AFB50048 */ sw $s5, 0x48($sp)
/* 03B628 7F006AF8 8EB90000 */ lw $t9, ($s5)
/* 03B62C 7F006AFC 5720FFB6 */ bnezl $t9, .L7F0069D8
/* 03B630 7F006B00 8EB80000 */ lw $t8, ($s5)
.L7F006B04:
/* 03B634 7F006B04 12000091 */ beqz $s0, .L7F006D4C
/* 03B638 7F006B08 8FAF00D8 */ lw $t7, 0xd8($sp)
/* 03B63C 7F006B0C 11E0008F */ beqz $t7, .L7F006D4C
/* 03B640 7F006B10 00000000 */ nop
/* 03B644 7F006B14 8DE30000 */ lw $v1, ($t7)
/* 03B648 7F006B18 00004825 */ move $t1, $zero
/* 03B64C 7F006B1C 01E05825 */ move $t3, $t7
/* 03B650 7F006B20 1060001F */ beqz $v1, .L7F006BA0
/* 03B654 7F006B24 0200B825 */ move $s7, $s0
/* 03B658 7F006B28 01E06825 */ move $t5, $t7
.L7F006B2C:
/* 03B65C 7F006B2C 8D640004 */ lw $a0, 4($t3)
/* 03B660 7F006B30 00003825 */ move $a3, $zero
/* 03B664 7F006B34 8C830000 */ lw $v1, ($a0)
/* 03B668 7F006B38 04600011 */ bltz $v1, .L7F006B80
/* 03B66C 7F006B3C 00037100 */ sll $t6, $v1, 4
.L7F006B40:
/* 03B670 7F006B40 01D02821 */ addu $a1, $t6, $s0
/* 03B674 7F006B44 8CA60008 */ lw $a2, 8($a1)
/* 03B678 7F006B48 04C10005 */ bgez $a2, .L7F006B60
/* 03B67C 7F006B4C 00000000 */ nop
/* 03B680 7F006B50 ACA90008 */ sw $t1, 8($a1)
/* 03B684 7F006B54 8D640004 */ lw $a0, 4($t3)
/* 03B688 7F006B58 10000004 */ b .L7F006B6C
/* 03B68C 7F006B5C 00871021 */ addu $v0, $a0, $a3
.L7F006B60:
/* 03B690 7F006B60 11260002 */ beq $t1, $a2, .L7F006B6C
/* 03B694 7F006B64 00871021 */ addu $v0, $a0, $a3
/* 03B698 7F006B68 24160001 */ li $s6, 1
.L7F006B6C:
/* 03B69C 7F006B6C 8C430004 */ lw $v1, 4($v0)
/* 03B6A0 7F006B70 24E70004 */ addiu $a3, $a3, 4
/* 03B6A4 7F006B74 24420004 */ addiu $v0, $v0, 4
/* 03B6A8 7F006B78 0463FFF1 */ bgezl $v1, .L7F006B40
/* 03B6AC 7F006B7C 00037100 */ sll $t6, $v1, 4
.L7F006B80:
/* 03B6B0 7F006B80 8DB8000C */ lw $t8, 0xc($t5)
/* 03B6B4 7F006B84 25AD000C */ addiu $t5, $t5, 0xc
/* 03B6B8 7F006B88 01A05825 */ move $t3, $t5
/* 03B6BC 7F006B8C 1700FFE7 */ bnez $t8, .L7F006B2C
/* 03B6C0 7F006B90 25290001 */ addiu $t1, $t1, 1
/* 03B6C4 7F006B94 8FAB00D8 */ lw $t3, 0xd8($sp)
/* 03B6C8 7F006B98 00004825 */ move $t1, $zero
/* 03B6CC 7F006B9C 8D630000 */ lw $v1, ($t3)
.L7F006BA0:
/* 03B6D0 7F006BA0 8EEF0000 */ lw $t7, ($s7)
/* 03B6D4 7F006BA4 02E03025 */ move $a2, $s7
/* 03B6D8 7F006BA8 8FAD00D8 */ lw $t5, 0xd8($sp)
/* 03B6DC 7F006BAC 05E0000A */ bltz $t7, .L7F006BD8
/* 03B6E0 7F006BB0 24070001 */ li $a3, 1
/* 03B6E4 7F006BB4 8CCE0008 */ lw $t6, 8($a2)
.L7F006BB8:
/* 03B6E8 7F006BB8 25290001 */ addiu $t1, $t1, 1
/* 03B6EC 7F006BBC 0009C100 */ sll $t8, $t1, 4
/* 03B6F0 7F006BC0 05C10002 */ bgez $t6, .L7F006BCC
/* 03B6F4 7F006BC4 03103021 */ addu $a2, $t8, $s0
/* 03B6F8 7F006BC8 24160001 */ li $s6, 1
.L7F006BCC:
/* 03B6FC 7F006BCC 8CD90000 */ lw $t9, ($a2)
/* 03B700 7F006BD0 0723FFF9 */ bgezl $t9, .L7F006BB8
/* 03B704 7F006BD4 8CCE0008 */ lw $t6, 8($a2)
.L7F006BD8:
/* 03B708 7F006BD8 1060005C */ beqz $v1, .L7F006D4C
/* 03B70C 7F006BDC 00000000 */ nop
/* 03B710 7F006BE0 8D640004 */ lw $a0, 4($t3)
.L7F006BE4:
/* 03B714 7F006BE4 00001825 */ move $v1, $zero
/* 03B718 7F006BE8 00004025 */ move $t0, $zero
/* 03B71C 7F006BEC 8C850000 */ lw $a1, ($a0)
/* 03B720 7F006BF0 00006025 */ move $t4, $zero
/* 03B724 7F006BF4 00004825 */ move $t1, $zero
/* 03B728 7F006BF8 04A00012 */ bltz $a1, .L7F006C44
/* 03B72C 7F006BFC 00A01025 */ move $v0, $a1
.L7F006C00:
/* 03B730 7F006C00 15200005 */ bnez $t1, .L7F006C18
/* 03B734 7F006C04 0002C100 */ sll $t8, $v0, 4
/* 03B738 7F006C08 00027900 */ sll $t7, $v0, 4
/* 03B73C 7F006C0C 01F07021 */ addu $t6, $t7, $s0
/* 03B740 7F006C10 10000003 */ b .L7F006C20
/* 03B744 7F006C14 ADC7000C */ sw $a3, 0xc($t6)
.L7F006C18:
/* 03B748 7F006C18 0310C821 */ addu $t9, $t8, $s0
/* 03B74C 7F006C1C AF20000C */ sw $zero, 0xc($t9)
.L7F006C20:
/* 03B750 7F006C20 8D640004 */ lw $a0, 4($t3)
/* 03B754 7F006C24 25290004 */ addiu $t1, $t1, 4
/* 03B758 7F006C28 00897821 */ addu $t7, $a0, $t1
/* 03B75C 7F006C2C 8DE20000 */ lw $v0, ($t7)
/* 03B760 7F006C30 0441FFF3 */ bgez $v0, .L7F006C00
/* 03B764 7F006C34 00000000 */ nop
/* 03B768 7F006C38 8C850000 */ lw $a1, ($a0)
/* 03B76C 7F006C3C 00001825 */ move $v1, $zero
/* 03B770 7F006C40 00A01025 */ move $v0, $a1
.L7F006C44:
/* 03B774 7F006C44 04400020 */ bltz $v0, .L7F006CC8
/* 03B778 7F006C48 00004825 */ move $t1, $zero
/* 03B77C 7F006C4C 00027100 */ sll $t6, $v0, 4
.L7F006C50:
/* 03B780 7F006C50 01D03021 */ addu $a2, $t6, $s0
/* 03B784 7F006C54 8CD8000C */ lw $t8, 0xc($a2)
/* 03B788 7F006C58 25290004 */ addiu $t1, $t1, 4
/* 03B78C 7F006C5C 54F80014 */ bnel $a3, $t8, .L7F006CB0
/* 03B790 7F006C60 0089C021 */ addu $t8, $a0, $t1
/* 03B794 7F006C64 8CC50004 */ lw $a1, 4($a2)
/* 03B798 7F006C68 00001825 */ move $v1, $zero
/* 03B79C 7F006C6C 8CA20000 */ lw $v0, ($a1)
/* 03B7A0 7F006C70 0440000E */ bltz $v0, .L7F006CAC
/* 03B7A4 7F006C74 0002C900 */ sll $t9, $v0, 4
.L7F006C78:
/* 03B7A8 7F006C78 03302021 */ addu $a0, $t9, $s0
/* 03B7AC 7F006C7C 8C8F000C */ lw $t7, 0xc($a0)
/* 03B7B0 7F006C80 24630004 */ addiu $v1, $v1, 4
/* 03B7B4 7F006C84 50EF0005 */ beql $a3, $t7, .L7F006C9C
/* 03B7B8 7F006C88 00A37021 */ addu $t6, $a1, $v1
/* 03B7BC 7F006C8C AC87000C */ sw $a3, 0xc($a0)
/* 03B7C0 7F006C90 8CC50004 */ lw $a1, 4($a2)
/* 03B7C4 7F006C94 00E04025 */ move $t0, $a3
/* 03B7C8 7F006C98 00A37021 */ addu $t6, $a1, $v1
.L7F006C9C:
/* 03B7CC 7F006C9C 8DC20000 */ lw $v0, ($t6)
/* 03B7D0 7F006CA0 0443FFF5 */ bgezl $v0, .L7F006C78
/* 03B7D4 7F006CA4 0002C900 */ sll $t9, $v0, 4
/* 03B7D8 7F006CA8 8D640004 */ lw $a0, 4($t3)
.L7F006CAC:
/* 03B7DC 7F006CAC 0089C021 */ addu $t8, $a0, $t1
.L7F006CB0:
/* 03B7E0 7F006CB0 8F020000 */ lw $v0, ($t8)
/* 03B7E4 7F006CB4 0443FFE6 */ bgezl $v0, .L7F006C50
/* 03B7E8 7F006CB8 00027100 */ sll $t6, $v0, 4
/* 03B7EC 7F006CBC 8C850000 */ lw $a1, ($a0)
/* 03B7F0 7F006CC0 00001825 */ move $v1, $zero
/* 03B7F4 7F006CC4 00A01025 */ move $v0, $a1
.L7F006CC8:
/* 03B7F8 7F006CC8 0440000C */ bltz $v0, .L7F006CFC
/* 03B7FC 7F006CCC 0002C900 */ sll $t9, $v0, 4
.L7F006CD0:
/* 03B800 7F006CD0 03307821 */ addu $t7, $t9, $s0
/* 03B804 7F006CD4 8DEE000C */ lw $t6, 0xc($t7)
/* 03B808 7F006CD8 24630001 */ addiu $v1, $v1, 1
/* 03B80C 7F006CDC 0003C080 */ sll $t8, $v1, 2
/* 03B810 7F006CE0 10EE0003 */ beq $a3, $t6, .L7F006CF0
/* 03B814 7F006CE4 0098C821 */ addu $t9, $a0, $t8
/* 03B818 7F006CE8 10000004 */ b .L7F006CFC
/* 03B81C 7F006CEC 00E06025 */ move $t4, $a3
.L7F006CF0:
/* 03B820 7F006CF0 8F220000 */ lw $v0, ($t9)
/* 03B824 7F006CF4 0443FFF6 */ bgezl $v0, .L7F006CD0
/* 03B828 7F006CF8 0002C900 */ sll $t9, $v0, 4
.L7F006CFC:
/* 03B82C 7F006CFC 11000003 */ beqz $t0, .L7F006D0C
/* 03B830 7F006D00 00001825 */ move $v1, $zero
/* 03B834 7F006D04 15800009 */ bnez $t4, .L7F006D2C
/* 03B838 7F006D08 00A01025 */ move $v0, $a1
.L7F006D0C:
/* 03B83C 7F006D0C 5180000B */ beql $t4, $zero, .L7F006D3C
/* 03B840 7F006D10 8DAE000C */ lw $t6, 0xc($t5)
/* 03B844 7F006D14 8E8F0024 */ lw $t7, 0x24($s4)
/* 03B848 7F006D18 24160001 */ li $s6, 1
/* 03B84C 7F006D1C 51E00007 */ beql $t7, $zero, .L7F006D3C
/* 03B850 7F006D20 8DAE000C */ lw $t6, 0xc($t5)
/* 03B854 7F006D24 10000005 */ b .L7F006D3C
/* 03B858 7F006D28 8DAE000C */ lw $t6, 0xc($t5)
.L7F006D2C:
/* 03B85C 7F006D2C 00004025 */ move $t0, $zero
/* 03B860 7F006D30 1000FFC4 */ b .L7F006C44
/* 03B864 7F006D34 00006025 */ move $t4, $zero
/* 03B868 7F006D38 8DAE000C */ lw $t6, 0xc($t5)
.L7F006D3C:
/* 03B86C 7F006D3C 25AD000C */ addiu $t5, $t5, 0xc
/* 03B870 7F006D40 01A05825 */ move $t3, $t5
/* 03B874 7F006D44 55C0FFA7 */ bnezl $t6, .L7F006BE4
/* 03B878 7F006D48 8D640004 */ lw $a0, 4($t3)
.L7F006D4C:
/* 03B87C 7F006D4C 12C00003 */ beqz $s6, .L7F006D5C
/* 03B880 7F006D50 8FB00018 */ lw $s0, 0x18($sp)
.L7F006D54:
/* 03B884 7F006D54 1000FFFF */ b .L7F006D54
/* 03B888 7F006D58 00000000 */ nop
.L7F006D5C:
/* 03B88C 7F006D5C 8FBF003C */ lw $ra, 0x3c($sp)
/* 03B890 7F006D60 8FB1001C */ lw $s1, 0x1c($sp)
/* 03B894 7F006D64 8FB20020 */ lw $s2, 0x20($sp)
/* 03B898 7F006D68 8FB30024 */ lw $s3, 0x24($sp)
/* 03B89C 7F006D6C 8FB40028 */ lw $s4, 0x28($sp)
/* 03B8A0 7F006D70 8FB5002C */ lw $s5, 0x2c($sp)
/* 03B8A4 7F006D74 8FB60030 */ lw $s6, 0x30($sp)
/* 03B8A8 7F006D78 8FB70034 */ lw $s7, 0x34($sp)
/* 03B8AC 7F006D7C 8FBE0038 */ lw $fp, 0x38($sp)
/* 03B8B0 7F006D80 03E00008 */ jr $ra
/* 03B8B4 7F006D84 27BD00E0 */ addiu $sp, $sp, 0xe0
)
#endif
|
6ca436d720adaa653f0d254177badf43d4a7056d
|
58003f1173b71158ac24097d05219dd03b59d190
|
/examples/add-compressed-data.c
|
6f58106626a628ca2d54497a539ba80d9956161c
|
[
"BSD-3-Clause"
] |
permissive
|
nih-at/libzip
|
fa5598382549520397cbb222b7278d278cc1cecd
|
c719428916b4d19e838f873b1a177b126a080d61
|
refs/heads/main
| 2023-08-31T16:01:08.580400
| 2023-08-24T12:07:50
| 2023-08-24T12:07:50
| 51,913,230
| 749
| 333
|
NOASSERTION
| 2023-09-01T14:51:34
| 2016-02-17T10:07:33
|
C
|
UTF-8
|
C
| false
| false
| 5,875
|
c
|
add-compressed-data.c
|
/*
add-compressed-data.c -- add already compressed file to zip archive
Copyright (C) 2022 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.
*/
/*
This layered source can be used to add pre-compressed data to a zip archive.
The data is taken from the lower layer source.
Metadata (uncompressed size, crc, compression method) must be provided by the caller.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zip.h>
struct ctx {
zip_uint64_t uncompressed_size;
zip_uint32_t crc;
zip_uint32_t compression_method;
};
zip_int64_t callback(zip_source_t* src, void *ud, void* data, zip_uint64_t length, zip_source_cmd_t command) {
struct ctx* ctx = (struct ctx*)ud;
switch (command) {
case ZIP_SOURCE_FREE:
/* Free our context. */
free(ctx);
return 0;
case ZIP_SOURCE_STAT: {
zip_stat_t *st = (zip_stat_t *)data;
/* Fix metadata with provided values. */
if (st->valid & ZIP_STAT_SIZE) {
st->comp_size = st->size;
st->valid |= ZIP_STAT_COMP_SIZE;
}
st->size = ctx->uncompressed_size;
st->crc = ctx->crc;
st->comp_method = ctx->compression_method;
st->valid |= ZIP_STAT_COMP_METHOD | ZIP_STAT_SIZE | ZIP_STAT_CRC;
return 0;
}
default:
/* For all other commands, use default implementation */
return zip_source_pass_to_lower_layer(src, data, length, command);
}
}
zip_source_t* create_layered_compressed_source(zip_source_t* source, zip_uint64_t uncompressed_size, zip_uint32_t crc, zip_uint32_t compression_method, zip_error_t *error) {
struct ctx* ctx = (struct ctx*)malloc(sizeof(*ctx));
zip_source_t *compressed_source;
/* Allocate context. */
if (ctx == NULL) {
zip_error_set(error, ZIP_ER_MEMORY, 0);
return NULL;
}
/* Initialize context */
ctx->compression_method = compression_method;
ctx->uncompressed_size = uncompressed_size;
ctx->crc = crc;
/* Create layered source using our callback and context. */
compressed_source = zip_source_layered_create(source, callback, ctx, error);
/* In case of error, free context. */
if (compressed_source == NULL) {
free(ctx);
}
return compressed_source;
}
/* This is the information needed to add pre-compressed data to a zip archive. data must be compressed in a format compatible with Zip (e.g. no gzip header for deflate). */
zip_uint16_t compression_method = ZIP_CM_DEFLATE;
zip_uint64_t uncompressed_size = 60;
zip_uint32_t crc = 0xb0354048;
zip_uint8_t data[] = {
0x4B, 0x4C, 0x44, 0x06, 0x5C, 0x49, 0x28, 0x80,
0x2B, 0x11, 0x55 ,0x36, 0x19, 0x05, 0x70, 0x01,
0x00
};
int
main(int argc, char *argv[]) {
const char *archive;
zip_source_t *src, *src_comp;
zip_t *za;
int err;
if (argc != 2) {
fprintf(stderr, "usage: %s archive\n", argv[0]);
return 1;
}
archive = argv[1];
if ((za = zip_open(archive, ZIP_CREATE, &err)) == NULL) {
zip_error_t error;
zip_error_init_with_code(&error, err);
fprintf(stderr, "%s: cannot open zip archive '%s': %s\n", argv[0], archive, zip_error_strerror(&error));
zip_error_fini(&error);
exit(1);
}
/* The data can come from any source. To keep the example simple, it is provided in a static buffer here. */
if ((src = zip_source_buffer(za, data, sizeof(data), 0)) == NULL) {
fprintf(stderr, "%s: cannot create buffer source: %s\n", argv[0], zip_strerror(za));
zip_discard(za);
exit(1);
}
zip_error_t error;
if ((src_comp = create_layered_compressed_source(src, uncompressed_size, crc, compression_method, &error)) == NULL) {
fprintf(stderr, "%s: cannot create layered source: %s\n", argv[0], zip_error_strerror(&error));
zip_source_free(src);
zip_discard(za);
exit(1);
}
if ((zip_file_add(za, "precompressed", src_comp, 0)) < 0) {
fprintf(stderr, "%s: cannot add precompressed file: %s\n", argv[0], zip_strerror(za));
zip_source_free(src_comp);
zip_discard(za);
exit(1);
}
if ((zip_close(za)) < 0) {
fprintf(stderr, "%s: cannot close archive '%s': %s\n", argv[0], archive, zip_strerror(za));
zip_discard(za);
exit(1);
}
exit(0);
}
|
56758c6fdb2d61cbafd2033226c112f002929dc6
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/components/drivers/cputime/cputimer.c
|
0431833640788401c2c8804461efc4fdc9c25f89
|
[
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 8,490
|
c
|
cputimer.c
|
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-02-13 zhkag first version
* 2023-04-03 xqyjlj fix cputimer in multithreading
*/
#include <rtdevice.h>
#include <rthw.h>
#include <rtthread.h>
static rt_list_t _cputimer_list = RT_LIST_OBJECT_INIT(_cputimer_list);
static struct rt_cputimer *_cputimer_nowtimer = RT_NULL;
static void _cputime_sleep_timeout(void *parameter)
{
struct rt_semaphore *sem;
sem = (struct rt_semaphore *)parameter;
rt_sem_release(sem);
}
static void _cputime_timeout_callback(void *parameter)
{
struct rt_cputimer *timer;
timer = (struct rt_cputimer *)parameter;
rt_base_t level;
level = rt_hw_interrupt_disable();
_cputimer_nowtimer = RT_NULL;
rt_list_remove(&(timer->row));
rt_hw_interrupt_enable(level);
timer->timeout_func(timer->parameter);
if (&_cputimer_list != _cputimer_list.prev)
{
struct rt_cputimer *t;
t = rt_list_entry(_cputimer_list.next, struct rt_cputimer, row);
clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t);
}
else
{
clock_cpu_settimeout(RT_NULL, RT_NULL, RT_NULL);
}
}
static void _set_next_timeout()
{
struct rt_cputimer *t;
if (&_cputimer_list != _cputimer_list.prev)
{
t = rt_list_entry((&_cputimer_list)->next, struct rt_cputimer, row);
if (_cputimer_nowtimer != RT_NULL)
{
if (t != _cputimer_nowtimer && t->timeout_tick < _cputimer_nowtimer->timeout_tick)
{
_cputimer_nowtimer = t;
clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t);
}
}
else
{
_cputimer_nowtimer = t;
clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t);
}
}
else
{
_cputimer_nowtimer = RT_NULL;
clock_cpu_settimeout(RT_NULL, RT_NULL, RT_NULL);
}
}
void rt_cputimer_init(rt_cputimer_t timer,
const char *name,
void (*timeout)(void *parameter),
void *parameter,
rt_uint64_t tick,
rt_uint8_t flag)
{
/* parameter check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(timeout != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
/* set flag */
timer->parent.flag = flag;
/* set deactivated */
timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
timer->timeout_func = timeout;
timer->parameter = parameter;
timer->timeout_tick = tick + clock_cpu_gettime();
timer->init_tick = tick;
rt_list_init(&(timer->row));
rt_sem_init(&(timer->sem), "cputime", 0, RT_IPC_FLAG_PRIO);
}
rt_err_t rt_cputimer_delete(rt_cputimer_t timer)
{
rt_base_t level;
/* parameter check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
/* disable interrupt */
level = rt_hw_interrupt_disable();
rt_list_remove(&timer->row);
/* stop timer */
timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
/* enable interrupt */
rt_hw_interrupt_enable(level);
_set_next_timeout();
return RT_EOK;
}
rt_err_t rt_cputimer_start(rt_cputimer_t timer)
{
rt_list_t *timer_list;
rt_base_t level;
/* parameter check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
/* stop timer firstly */
level = rt_hw_interrupt_disable();
/* remove timer from list */
rt_list_remove(&timer->row);
/* change status of timer */
timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
timer_list = &_cputimer_list;
for (; timer_list != _cputimer_list.prev;
timer_list = timer_list->next)
{
struct rt_cputimer *t;
rt_list_t *p = timer_list->next;
t = rt_list_entry(p, struct rt_cputimer, row);
if ((t->timeout_tick - timer->timeout_tick) == 0)
{
continue;
}
else if ((t->timeout_tick - timer->timeout_tick) < 0x7fffffffffffffff)
{
break;
}
}
rt_list_insert_after(timer_list, &(timer->row));
timer->parent.flag |= RT_TIMER_FLAG_ACTIVATED;
_set_next_timeout();
/* enable interrupt */
rt_hw_interrupt_enable(level);
return RT_EOK;
}
rt_err_t rt_cputimer_stop(rt_cputimer_t timer)
{
rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
/* timer check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
if (!(timer->parent.flag & RT_TIMER_FLAG_ACTIVATED))
{
rt_hw_interrupt_enable(level);
return -RT_ERROR;
}
rt_list_remove(&timer->row);
/* change status */
timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
_set_next_timeout();
/* enable interrupt */
rt_hw_interrupt_enable(level);
return RT_EOK;
}
rt_err_t rt_cputimer_control(rt_cputimer_t timer, int cmd, void *arg)
{
rt_base_t level;
/* parameter check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
level = rt_hw_interrupt_disable();
switch (cmd)
{
case RT_TIMER_CTRL_GET_TIME:
*(rt_uint64_t *)arg = timer->init_tick;
break;
case RT_TIMER_CTRL_SET_TIME:
RT_ASSERT((*(rt_uint64_t *)arg) < 0x7fffffffffffffff);
timer->init_tick = *(rt_uint64_t *)arg;
timer->timeout_tick = *(rt_uint64_t *)arg + clock_cpu_gettime();
break;
case RT_TIMER_CTRL_SET_ONESHOT:
timer->parent.flag &= ~RT_TIMER_FLAG_PERIODIC;
break;
case RT_TIMER_CTRL_SET_PERIODIC:
timer->parent.flag |= RT_TIMER_FLAG_PERIODIC;
break;
case RT_TIMER_CTRL_GET_STATE:
if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED)
{
/*timer is start and run*/
*(rt_uint32_t *)arg = RT_TIMER_FLAG_ACTIVATED;
}
else
{
/*timer is stop*/
*(rt_uint32_t *)arg = RT_TIMER_FLAG_DEACTIVATED;
}
break;
case RT_TIMER_CTRL_GET_REMAIN_TIME:
*(rt_uint64_t *)arg = timer->timeout_tick;
break;
case RT_TIMER_CTRL_GET_FUNC:
arg = (void *)timer->timeout_func;
break;
case RT_TIMER_CTRL_SET_FUNC:
timer->timeout_func = (void (*)(void *))arg;
break;
case RT_TIMER_CTRL_GET_PARM:
*(void **)arg = timer->parameter;
break;
case RT_TIMER_CTRL_SET_PARM:
timer->parameter = arg;
break;
default:
break;
}
rt_hw_interrupt_enable(level);
return RT_EOK;
}
rt_err_t rt_cputimer_detach(rt_cputimer_t timer)
{
rt_base_t level;
/* parameter check */
RT_ASSERT(timer != RT_NULL);
RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE);
/* disable interrupt */
level = rt_hw_interrupt_disable();
rt_list_remove(&timer->row);
/* stop timer */
timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
_set_next_timeout();
/* enable interrupt */
rt_hw_interrupt_enable(level);
rt_sem_detach(&(timer->sem));
return RT_EOK;
}
rt_err_t rt_cputime_sleep(rt_uint64_t tick)
{
rt_base_t level;
struct rt_cputimer cputimer;
if (!clock_cpu_issettimeout())
{
rt_int32_t ms = clock_cpu_millisecond(tick);
return rt_thread_delay(rt_tick_from_millisecond(ms));
}
if (tick == 0)
{
return -RT_EINVAL;
}
rt_cputimer_init(&cputimer, "cputime_sleep", _cputime_sleep_timeout, &(cputimer.sem), tick,
RT_TIMER_FLAG_ONE_SHOT | RT_TIMER_FLAG_SOFT_TIMER);
/* disable interrupt */
level = rt_hw_interrupt_disable();
rt_cputimer_start(&cputimer); /* reset the timeout of thread timer and start it */
rt_hw_interrupt_enable(level);
rt_sem_take_interruptible(&(cputimer.sem), RT_WAITING_FOREVER);
rt_cputimer_detach(&cputimer);
return RT_EOK;
}
rt_err_t rt_cputime_ndelay(rt_uint64_t ns)
{
uint64_t unit = clock_cpu_getres();
return rt_cputime_sleep(ns * (1000UL * 1000) / unit);
}
rt_err_t rt_cputime_udelay(rt_uint64_t us)
{
return rt_cputime_ndelay(us * 1000);
}
rt_err_t rt_cputime_mdelay(rt_uint64_t ms)
{
return rt_cputime_ndelay(ms * 1000000);
}
|
49a25c0c5f123a6faf6d97419fc52597855ce70a
|
c689f560f72e51c1f0db28d601c5ed9aa3f636cd
|
/software/hello/main.c
|
6483c273909ada9ae3fa4c936a674b66cc1f5c91
|
[
"BSD-3-Clause"
] |
permissive
|
skordal/potato
|
2f43a58b835f3da7d4e2d2daaded464105f0200f
|
63b08920156cd0a99185b799a8bc18593a829af6
|
refs/heads/master
| 2023-02-13T10:52:53.468282
| 2023-01-28T14:51:50
| 2023-01-28T14:51:50
| 46,445,169
| 248
| 54
|
BSD-3-Clause
| 2021-02-12T17:50:26
| 2015-11-18T20:23:24
|
VHDL
|
UTF-8
|
C
| false
| false
| 603
|
c
|
main.c
|
// The Potato Processor Benchmark Applications
// (c) Kristian Klomsten Skordal 2015 <kristian.skordal@wafflemail.net>
// Report bugs and issues on <https://github.com/skordal/potato/issues>
#include <stdint.h>
#include "platform.h"
#include "uart.h"
static struct uart uart0;
void exception_handler(uint32_t cause, void * epc, void * regbase)
{
// Not used in this application
}
int main(void)
{
uart_initialize(&uart0, (volatile void *) PLATFORM_UART0_BASE);
uart_set_divisor(&uart0, uart_baud2divisor(115200, PLATFORM_SYSCLK_FREQ));
uart_tx_string(&uart0, "Hello world\n\r");
return 0;
}
|
e3a07242edcf483111de377fc8fbaec9ca25fd09
|
39568e19301a7a112398be542154950af25591de
|
/third_party/coremark/top_earlgrey/ee_printf.c
|
f2f9dc6d342a361c71f90438bebab5326f4a14cb
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
lowRISC/opentitan
|
493995bc7cf7cb3aee486a5203af3fd62bba3bfc
|
51f6017b8425b14d5a4aa9abace8fe5a25ef08c8
|
refs/heads/master
| 2023-08-31T22:05:09.425796
| 2023-08-14T14:52:15
| 2023-08-31T20:31:13
| 204,516,692
| 2,077
| 634
|
Apache-2.0
| 2023-09-14T21:16:21
| 2019-08-26T16:30:16
|
SystemVerilog
|
UTF-8
|
C
| false
| false
| 15,628
|
c
|
ee_printf.c
|
/*
Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <coremark.h>
#include <stdarg.h>
#include "sw/device/lib/dif/dif_uart.h"
extern dif_uart_t uart;
#define ZEROPAD (1 << 0) /* Pad with zero */
#define SIGN (1 << 1) /* Unsigned/signed long */
#define PLUS (1 << 2) /* Show plus */
#define SPACE (1 << 3) /* Spacer */
#define LEFT (1 << 4) /* Left justified */
#define HEX_PREP (1 << 5) /* 0x */
#define UPPERCASE (1 << 6) /* 'ABCDEF' */
#define is_digit(c) ((c) >= '0' && (c) <= '9')
static char * digits = "0123456789abcdefghijklmnopqrstuvwxyz";
static char * upper_digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static ee_size_t strnlen(const char *s, ee_size_t count);
static ee_size_t
strnlen(const char *s, ee_size_t count)
{
const char *sc;
for (sc = s; *sc != '\0' && count--; ++sc)
;
return sc - s;
}
static int
skip_atoi(const char **s)
{
int i = 0;
while (is_digit(**s))
i = i * 10 + *((*s)++) - '0';
return i;
}
static char *
number(char *str, long num, int base, int size, int precision, int type)
{
char c, sign, tmp[66];
char *dig = digits;
int i;
if (type & UPPERCASE)
dig = upper_digits;
if (type & LEFT)
type &= ~ZEROPAD;
if (base < 2 || base > 36)
return 0;
c = (type & ZEROPAD) ? '0' : ' ';
sign = 0;
if (type & SIGN)
{
if (num < 0)
{
sign = '-';
num = -num;
size--;
}
else if (type & PLUS)
{
sign = '+';
size--;
}
else if (type & SPACE)
{
sign = ' ';
size--;
}
}
if (type & HEX_PREP)
{
if (base == 16)
size -= 2;
else if (base == 8)
size--;
}
i = 0;
if (num == 0)
tmp[i++] = '0';
else
{
while (num != 0)
{
tmp[i++] = dig[((unsigned long)num) % (unsigned)base];
num = ((unsigned long)num) / (unsigned)base;
}
}
if (i > precision)
precision = i;
size -= precision;
if (!(type & (ZEROPAD | LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (type & HEX_PREP)
{
if (base == 8)
*str++ = '0';
else if (base == 16)
{
*str++ = '0';
*str++ = digits[33];
}
}
if (!(type & LEFT))
while (size-- > 0)
*str++ = c;
while (i < precision--)
*str++ = '0';
while (i-- > 0)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
}
static char *
eaddr(char *str, unsigned char *addr, int size, int precision, int type)
{
char tmp[24];
char *dig = digits;
int i, len;
if (type & UPPERCASE)
dig = upper_digits;
len = 0;
for (i = 0; i < 6; i++)
{
if (i != 0)
tmp[len++] = ':';
tmp[len++] = dig[addr[i] >> 4];
tmp[len++] = dig[addr[i] & 0x0F];
}
if (!(type & LEFT))
while (len < size--)
*str++ = ' ';
for (i = 0; i < len; ++i)
*str++ = tmp[i];
while (len < size--)
*str++ = ' ';
return str;
}
static char *
iaddr(char *str, unsigned char *addr, int size, int precision, int type)
{
char tmp[24];
int i, n, len;
len = 0;
for (i = 0; i < 4; i++)
{
if (i != 0)
tmp[len++] = '.';
n = addr[i];
if (n == 0)
tmp[len++] = digits[0];
else
{
if (n >= 100)
{
tmp[len++] = digits[n / 100];
n = n % 100;
tmp[len++] = digits[n / 10];
n = n % 10;
}
else if (n >= 10)
{
tmp[len++] = digits[n / 10];
n = n % 10;
}
tmp[len++] = digits[n];
}
}
if (!(type & LEFT))
while (len < size--)
*str++ = ' ';
for (i = 0; i < len; ++i)
*str++ = tmp[i];
while (len < size--)
*str++ = ' ';
return str;
}
#if HAS_FLOAT
char * ecvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf);
char * fcvtbuf(double arg, int ndigits, int *decpt, int *sign, char *buf);
static void ee_bufcpy(char *d, char *s, int count);
void
ee_bufcpy(char *pd, char *ps, int count)
{
char *pe = ps + count;
while (ps != pe)
*pd++ = *ps++;
}
static void
parse_float(double value, char *buffer, char fmt, int precision)
{
int decpt, sign, exp, pos;
char *digits = NULL;
char cvtbuf[80];
int capexp = 0;
int magnitude;
if (fmt == 'G' || fmt == 'E')
{
capexp = 1;
fmt += 'a' - 'A';
}
if (fmt == 'g')
{
digits = ecvtbuf(value, precision, &decpt, &sign, cvtbuf);
magnitude = decpt - 1;
if (magnitude < -4 || magnitude > precision - 1)
{
fmt = 'e';
precision -= 1;
}
else
{
fmt = 'f';
precision -= decpt;
}
}
if (fmt == 'e')
{
digits = ecvtbuf(value, precision + 1, &decpt, &sign, cvtbuf);
if (sign)
*buffer++ = '-';
*buffer++ = *digits;
if (precision > 0)
*buffer++ = '.';
ee_bufcpy(buffer, digits + 1, precision);
buffer += precision;
*buffer++ = capexp ? 'E' : 'e';
if (decpt == 0)
{
if (value == 0.0)
exp = 0;
else
exp = -1;
}
else
exp = decpt - 1;
if (exp < 0)
{
*buffer++ = '-';
exp = -exp;
}
else
*buffer++ = '+';
buffer[2] = (exp % 10) + '0';
exp = exp / 10;
buffer[1] = (exp % 10) + '0';
exp = exp / 10;
buffer[0] = (exp % 10) + '0';
buffer += 3;
}
else if (fmt == 'f')
{
digits = fcvtbuf(value, precision, &decpt, &sign, cvtbuf);
if (sign)
*buffer++ = '-';
if (*digits)
{
if (decpt <= 0)
{
*buffer++ = '0';
*buffer++ = '.';
for (pos = 0; pos < -decpt; pos++)
*buffer++ = '0';
while (*digits)
*buffer++ = *digits++;
}
else
{
pos = 0;
while (*digits)
{
if (pos++ == decpt)
*buffer++ = '.';
*buffer++ = *digits++;
}
}
}
else
{
*buffer++ = '0';
if (precision > 0)
{
*buffer++ = '.';
for (pos = 0; pos < precision; pos++)
*buffer++ = '0';
}
}
}
*buffer = '\0';
}
static void
decimal_point(char *buffer)
{
while (*buffer)
{
if (*buffer == '.')
return;
if (*buffer == 'e' || *buffer == 'E')
break;
buffer++;
}
if (*buffer)
{
int n = strnlen(buffer, 256);
while (n > 0)
{
buffer[n + 1] = buffer[n];
n--;
}
*buffer = '.';
}
else
{
*buffer++ = '.';
*buffer = '\0';
}
}
static void
cropzeros(char *buffer)
{
char *stop;
while (*buffer && *buffer != '.')
buffer++;
if (*buffer++)
{
while (*buffer && *buffer != 'e' && *buffer != 'E')
buffer++;
stop = buffer--;
while (*buffer == '0')
buffer--;
if (*buffer == '.')
buffer--;
while (buffer != stop)
*++buffer = 0;
}
}
static char *
flt(char *str, double num, int size, int precision, char fmt, int flags)
{
char tmp[80];
char c, sign;
int n, i;
// Left align means no zero padding
if (flags & LEFT)
flags &= ~ZEROPAD;
// Determine padding and sign char
c = (flags & ZEROPAD) ? '0' : ' ';
sign = 0;
if (flags & SIGN)
{
if (num < 0.0)
{
sign = '-';
num = -num;
size--;
}
else if (flags & PLUS)
{
sign = '+';
size--;
}
else if (flags & SPACE)
{
sign = ' ';
size--;
}
}
// Compute the precision value
if (precision < 0)
precision = 6; // Default precision: 6
// Convert floating point number to text
parse_float(num, tmp, fmt, precision);
if ((flags & HEX_PREP) && precision == 0)
decimal_point(tmp);
if (fmt == 'g' && !(flags & HEX_PREP))
cropzeros(tmp);
n = strnlen(tmp, 256);
// Output number with alignment and padding
size -= n;
if (!(flags & (ZEROPAD | LEFT)))
while (size-- > 0)
*str++ = ' ';
if (sign)
*str++ = sign;
if (!(flags & LEFT))
while (size-- > 0)
*str++ = c;
for (i = 0; i < n; i++)
*str++ = tmp[i];
while (size-- > 0)
*str++ = ' ';
return str;
}
#endif
static int
ee_vsprintf(char *buf, const char *fmt, va_list args)
{
int len;
unsigned long num;
int i, base;
char * str;
char * s;
int flags; // Flags to number()
int field_width; // Width of output field
int precision; // Min. # of digits for integers; max number of chars for
// from string
int qualifier; // 'h', 'l', or 'L' for integer fields
for (str = buf; *fmt; fmt++)
{
if (*fmt != '%')
{
*str++ = *fmt;
continue;
}
// Process flags
flags = 0;
repeat:
fmt++; // This also skips first '%'
switch (*fmt)
{
case '-':
flags |= LEFT;
goto repeat;
case '+':
flags |= PLUS;
goto repeat;
case ' ':
flags |= SPACE;
goto repeat;
case '#':
flags |= HEX_PREP;
goto repeat;
case '0':
flags |= ZEROPAD;
goto repeat;
}
// Get field width
field_width = -1;
if (is_digit(*fmt))
field_width = skip_atoi(&fmt);
else if (*fmt == '*')
{
fmt++;
field_width = va_arg(args, int);
if (field_width < 0)
{
field_width = -field_width;
flags |= LEFT;
}
}
// Get the precision
precision = -1;
if (*fmt == '.')
{
++fmt;
if (is_digit(*fmt))
precision = skip_atoi(&fmt);
else if (*fmt == '*')
{
++fmt;
precision = va_arg(args, int);
}
if (precision < 0)
precision = 0;
}
// Get the conversion qualifier
qualifier = -1;
if (*fmt == 'l' || *fmt == 'L')
{
qualifier = *fmt;
fmt++;
}
// Default base
base = 10;
switch (*fmt)
{
case 'c':
if (!(flags & LEFT))
while (--field_width > 0)
*str++ = ' ';
*str++ = (unsigned char)va_arg(args, int);
while (--field_width > 0)
*str++ = ' ';
continue;
case 's':
s = va_arg(args, char *);
if (!s)
s = "<NULL>";
len = strnlen(s, precision);
if (!(flags & LEFT))
while (len < field_width--)
*str++ = ' ';
for (i = 0; i < len; ++i)
*str++ = *s++;
while (len < field_width--)
*str++ = ' ';
continue;
case 'p':
if (field_width == -1)
{
field_width = 2 * sizeof(void *);
flags |= ZEROPAD;
}
str = number(str,
(unsigned long)va_arg(args, void *),
16,
field_width,
precision,
flags);
continue;
case 'A':
flags |= UPPERCASE;
case 'a':
if (qualifier == 'l')
str = eaddr(str,
va_arg(args, unsigned char *),
field_width,
precision,
flags);
else
str = iaddr(str,
va_arg(args, unsigned char *),
field_width,
precision,
flags);
continue;
// Integer number formats - set up the flags and "break"
case 'o':
base = 8;
break;
case 'X':
flags |= UPPERCASE;
case 'x':
base = 16;
break;
case 'd':
case 'i':
flags |= SIGN;
case 'u':
break;
#if HAS_FLOAT
case 'f':
str = flt(str,
va_arg(args, double),
field_width,
precision,
*fmt,
flags | SIGN);
continue;
#endif
default:
if (*fmt != '%')
*str++ = '%';
if (*fmt)
*str++ = *fmt;
else
--fmt;
continue;
}
if (qualifier == 'l')
num = va_arg(args, unsigned long);
else if (flags & SIGN)
num = va_arg(args, int);
else
num = va_arg(args, unsigned int);
str = number(str, num, base, field_width, precision, flags);
}
*str = '\0';
return str - buf;
}
void
uart_send_char(char c)
{
(void)dif_uart_byte_send_polled(&uart, c);
}
int
ee_printf(const char *fmt, ...)
{
char buf[1024], *p;
va_list args;
int n = 0;
va_start(args, fmt);
ee_vsprintf(buf, fmt, args);
va_end(args);
p = buf;
while (*p)
{
uart_send_char(*p);
n++;
p++;
}
return n;
}
|
7cb7d690c04e2cc676f2be8e8cb0edbda1df6b63
|
1231e1bf4117cfaaa54bd4752cca1bdb71290cec
|
/ext/stub/concat.zep.c
|
24f1583fe5e46966e84a9827bd11e962d267a069
|
[
"MIT"
] |
permissive
|
zephir-lang/zephir
|
ac53ec68e35d19860a4d80224d94f38a6a5e04b5
|
6773f19d9b272cafee96b9a30f9b152c28e982ea
|
refs/heads/development
| 2023-08-31T10:33:38.621586
| 2023-02-28T10:27:43
| 2023-02-28T10:27:43
| 11,478,636
| 291
| 47
|
MIT
| 2023-08-28T22:07:11
| 2013-07-17T14:49:27
|
PHP
|
UTF-8
|
C
| false
| true
| 4,874
|
c
|
concat.zep.c
|
#ifdef HAVE_CONFIG_H
#include "../ext_config.h"
#endif
#include <php.h>
#include "../php_ext.h"
#include "../ext.h"
#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>
#include "kernel/main.h"
#include "kernel/object.h"
#include "kernel/memory.h"
#include "kernel/operators.h"
#include "kernel/concat.h"
ZEPHIR_INIT_CLASS(Stub_Concat)
{
ZEPHIR_REGISTER_CLASS(Stub, Concat, stub, concat, stub_concat_method_entry, 0);
zend_declare_property_null(stub_concat_ce, SL("testProperty"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC);
return SUCCESS;
}
PHP_METHOD(Stub_Concat, getTestProperty)
{
zval _0;
zval *this_ptr = getThis();
ZVAL_UNDEF(&_0);
zephir_read_static_property_ce(&_0, stub_concat_ce, SL("testProperty"), PH_NOISY_CC | PH_READONLY);
RETURN_CTORW(&_0);
}
PHP_METHOD(Stub_Concat, testConcatBySelfProperty)
{
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *title_param = NULL, _0;
zval title;
zval *this_ptr = getThis();
ZVAL_UNDEF(&title);
ZVAL_UNDEF(&_0);
#if PHP_VERSION_ID >= 80000
bool is_null_true = 1;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR(title)
ZEND_PARSE_PARAMETERS_END();
#endif
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &title_param);
zephir_get_strval(&title, title_param);
ZEPHIR_OBS_NVAR(&_0);
zephir_read_static_property_ce(&_0, stub_concat_ce, SL("testProperty"), PH_NOISY_CC);
SEPARATE_ZVAL(&title);
zephir_concat_function(&title, &_0, &title);
zephir_update_static_property_ce(stub_concat_ce, ZEND_STRL("testProperty"), &title);
ZEPHIR_MM_RESTORE();
}
PHP_METHOD(Stub_Concat, testConcat1)
{
zval url, _0;
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *this_ptr = getThis();
ZVAL_UNDEF(&url);
ZVAL_UNDEF(&_0);
ZEPHIR_MM_GROW();
ZEPHIR_INIT_VAR(&url);
ZVAL_STRING(&url, "test");
ZEPHIR_INIT_VAR(&_0);
ZEPHIR_CONCAT_SV(&_0, "append", &url);
ZEPHIR_CPY_WRT(&url, &_0);
RETURN_CCTOR(&url);
}
PHP_METHOD(Stub_Concat, testConcat2)
{
zval _1;
zval url, _0;
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *this_ptr = getThis();
ZVAL_UNDEF(&url);
ZVAL_UNDEF(&_0);
ZVAL_UNDEF(&_1);
ZEPHIR_MM_GROW();
ZEPHIR_INIT_VAR(&url);
ZVAL_STRING(&url, "test");
ZEPHIR_INIT_VAR(&_0);
ZEPHIR_CONCAT_SVS(&_0, "append", &url, "other");
ZEPHIR_CPY_WRT(&url, &_0);
ZEPHIR_INIT_VAR(&_1);
ZEPHIR_CONCAT_SS(&_1, "append", "other");
ZEPHIR_CPY_WRT(&url, &_1);
ZEPHIR_INIT_NVAR(&_0);
ZEPHIR_CONCAT_SSV(&_0, "append", "other", &url);
ZEPHIR_CPY_WRT(&url, &_0);
RETURN_CCTOR(&url);
}
/**
* @link https://github.com/zephir-lang/zephir/issues/1573
*/
PHP_METHOD(Stub_Concat, testConcat3)
{
zval a, b;
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *this_ptr = getThis();
ZVAL_UNDEF(&a);
ZVAL_UNDEF(&b);
ZEPHIR_MM_GROW();
ZEPHIR_INIT_VAR(&a);
ZVAL_STRING(&a, "1");
ZEPHIR_INIT_VAR(&b);
ZVAL_STRING(&b, "2");
zephir_concat_self(&b, &a);
RETURN_CCTOR(&b);
}
/**
* @link https://github.com/zephir-lang/zephir/issues/1893
*/
PHP_METHOD(Stub_Concat, testConcat4)
{
zval query, _1, _3;
double min = 0, max = 0;
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *value, value_sub, _0, _2;
zval *this_ptr = getThis();
ZVAL_UNDEF(&value_sub);
ZVAL_UNDEF(&_0);
ZVAL_UNDEF(&_2);
ZVAL_UNDEF(&query);
ZVAL_UNDEF(&_1);
ZVAL_UNDEF(&_3);
#if PHP_VERSION_ID >= 80000
bool is_null_true = 1;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(value)
ZEND_PARSE_PARAMETERS_END();
#endif
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &value);
ZEPHIR_INIT_VAR(&query);
min = (zephir_safe_div_zval_long(value, 100) * (double) (25));
max = (zephir_safe_div_zval_long(value, 100) * (double) (50));
ZEPHIR_INIT_VAR(&_0);
ZVAL_DOUBLE(&_0, max);
ZEPHIR_INIT_VAR(&_1);
ZEPHIR_CONCAT_SV(&_1, "SELECT * FROM TEST WHERE value <= ", &_0);
zephir_concat_self(&query, &_1);
ZEPHIR_INIT_VAR(&_2);
ZVAL_DOUBLE(&_2, min);
ZEPHIR_INIT_VAR(&_3);
ZEPHIR_CONCAT_SV(&_3, " AND value >= ", &_2);
zephir_concat_self(&query, &_3);
RETURN_CTOR(&query);
}
/**
* @link https://github.com/zephir-lang/zephir/issues/1893
*/
PHP_METHOD(Stub_Concat, testConcat5)
{
zval retval, left;
zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL;
zval *number_param = NULL, _0;
double number;
zval *this_ptr = getThis();
ZVAL_UNDEF(&_0);
ZVAL_UNDEF(&retval);
ZVAL_UNDEF(&left);
#if PHP_VERSION_ID >= 80000
bool is_null_true = 1;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ZVAL(number)
ZEND_PARSE_PARAMETERS_END();
#endif
ZEPHIR_MM_GROW();
zephir_fetch_params(1, 1, 0, &number_param);
number = zephir_get_doubleval(number_param);
ZEPHIR_INIT_VAR(&left);
ZVAL_STRING(&left, "Concatenated string with number ");
ZEPHIR_INIT_VAR(&_0);
ZVAL_DOUBLE(&_0, number);
ZEPHIR_INIT_VAR(&retval);
ZEPHIR_CONCAT_VV(&retval, &left, &_0);
RETURN_CTOR(&retval);
}
|
c4f201c2a898aa0ce115545a7a597eb79e86c992
|
85ccd32aa73eecf274a937f1fc3b6f4d484b77da
|
/test cases/python/9 extmodule limited api/limited.c
|
0d1c718200ba28897f8c72b748f9d34aba71962c
|
[
"Apache-2.0"
] |
permissive
|
mesonbuild/meson
|
48321cf4235dfcc0194fed90ff43a57367592bf7
|
cf5adf0c646474f0259d123fad60ca5ed38ec891
|
refs/heads/master
| 2023-09-01T05:58:50.807952
| 2023-03-17T20:27:37
| 2023-08-31T11:52:41
| 19,784,232
| 5,122
| 1,848
|
Apache-2.0
| 2023-09-14T15:47:23
| 2014-05-14T15:08:16
|
Python
|
UTF-8
|
C
| false
| false
| 371
|
c
|
limited.c
|
#include <Python.h>
#ifndef Py_LIMITED_API
#error Py_LIMITED_API must be defined.
#elif Py_LIMITED_API != 0x03070000
#error Wrong value for Py_LIMITED_API
#endif
static struct PyModuleDef limited_module = {
PyModuleDef_HEAD_INIT,
"limited_api_test",
NULL,
-1,
NULL
};
PyMODINIT_FUNC PyInit_limited(void) {
return PyModule_Create(&limited_module);
}
|
a1260b698df0f04512e63c85d9515a42a52bf8a5
|
e73547787354afd9b717ea57fe8dd0695d161821
|
/src/world/area_sbk/sbk_36/sbk_36.h
|
6791593119c9bd87fa9b9d565b084409e896d716
|
[] |
no_license
|
pmret/papermario
|
8b514b19653cef8d6145e47499b3636b8c474a37
|
9774b26d93f1045dd2a67e502b6efc9599fb6c31
|
refs/heads/main
| 2023-08-31T07:09:48.951514
| 2023-08-21T18:07:08
| 2023-08-21T18:07:08
| 287,151,133
| 904
| 139
| null | 2023-09-14T02:44:23
| 2020-08-13T01:22:57
|
C
|
UTF-8
|
C
| false
| false
| 288
|
h
|
sbk_36.h
|
/// @file sbk_36.h
/// @brief Dry Dry Desert - E3 Outside Outpost
#include "common.h"
#include "message_ids.h"
#include "map.h"
#include "../sbk.h"
#include "mapfs/sbk_36_shape.h"
#include "mapfs/sbk_36_hit.h"
enum {
MF_TreeDrop_Letter = MapFlag(10),
};
#define NAMESPACE sbk_36
|
f3705bdab73c7869752cbc2c352da614896d6723
|
22255c9f7abe89185b137bd93df53de822022c37
|
/tools/hidpp20-reset.c
|
bb944e832af3a3bf7b75df59ccab2a462d34a291
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
libratbag/libratbag
|
a150581d65e73516562f7dcd760b93261766d9e3
|
a4eb09ea6ddf4c2c670c32d27a1ecb465fa7ed53
|
refs/heads/master
| 2023-07-20T08:19:10.731911
| 2023-07-17T15:05:06
| 2023-07-17T15:05:06
| 41,394,739
| 1,964
| 345
|
MIT
| 2023-09-10T12:50:33
| 2015-08-26T00:18:46
|
C
|
UTF-8
|
C
| false
| false
| 2,906
|
c
|
hidpp20-reset.c
|
/*
* Copyright © 2017 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) 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 <config.h>
#include <errno.h>
#include <fcntl.h>
#include <hidpp20.h>
#include <libratbag-util.h>
static inline int
reset_sector(struct hidpp20_device *dev, uint16_t sector_size, uint16_t sector)
{
int rc = 0;
_cleanup_free_ uint8_t *data = NULL;
data = zalloc(sector_size);
/* this returns error 4: hardware error and is expected */
rc = hidpp20_onboard_profiles_write_sector(dev, sector, sector_size, data, false);
if (rc == 4)
rc = 0;
return rc;
}
static int
reset_all_sectors(struct hidpp20_device *dev, uint16_t sector_size)
{
uint8_t sector;
int rc = 0;
for (sector = 1; sector < 31; sector++) {
rc = reset_sector(dev, sector_size, sector);
if (rc != 0)
break;
}
if (!rc)
rc = reset_sector(dev, sector_size, 0);
return rc;
}
static void
usage(void)
{
printf("Usage: %s [sector] /dev/hidraw0\n", program_invocation_short_name);
}
int
main(int argc, char **argv)
{
_cleanup_close_ int fd = -1;
const char *path;
size_t sector = 0;
struct hidpp20_device *dev = NULL;
struct hidpp_device base;
struct hidpp20_onboard_profiles_info info = { 0 };
int rc;
if (argc < 2 || argc > 3) {
usage();
return 1;
}
path = argv[argc - 1];
fd = open(path, O_RDWR);
if (fd < 0) {
fprintf(stderr, "Failed to open path '%s': %s", path, strerror(errno));
exit(3);
}
hidpp_device_init(&base, fd);
dev = hidpp20_device_new(&base, 0xff, NULL, 0);
if (!dev) {
fprintf(stderr, "Failed to open %s as a HID++ 2.0 device", path);
exit(3);
}
hidpp20_onboard_profiles_get_profiles_desc(dev, &info);
if (argc == 2)
rc = reset_all_sectors(dev, info.sector_size);
else {
sector = atoi(argv[1]);
rc = reset_sector(dev, info.sector_size, sector);
}
hidpp20_device_destroy(dev);
return rc;
}
|
e828938b9dba7ef2875f5b4d2d84329a498d5266
|
4dc10d8db088da3a445c1ca35fc3da9415703f81
|
/src/strptime.h
|
ce0cbfaa7349774a77e0449fc0b2d40ba74aa2e1
|
[
"MIT"
] |
permissive
|
ibmdb/node-ibm_db
|
9cfffc2354ad37e2f874fb3bc54d7b2d5755ae39
|
c4f94cde2aba6e57ed707c0cf782ac830f3754f2
|
refs/heads/master
| 2023-09-06T01:50:37.303005
| 2023-08-17T13:18:33
| 2023-08-17T13:18:33
| 15,696,040
| 201
| 274
|
MIT
| 2023-09-14T19:04:11
| 2014-01-07T05:38:11
|
JavaScript
|
UTF-8
|
C
| false
| false
| 1,003
|
h
|
strptime.h
|
#ifndef _STRPTIME_H
#define _STRPTIME_H
#define ALT_E 0x01
#define ALT_O 0x02
//#define LEGAL_ALT(x) { if (alt_format & ~(x)) return (0); }
#define LEGAL_ALT(x) { ; }
#define TM_YEAR_BASE (1900)
#include <ctype.h>
#include <string.h>
#include <time.h>
#include <conio.h>
#ifdef __cplusplus
extern "C" {
#endif
char * strptime(const char *buf, const char *fmt, struct tm *tm);
#ifdef __cplusplus
}
#endif
static const char *day[7] = {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"
};
static const char *abday[7] = {
"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
};
static const char *mon[12] = {
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
};
static const char *abmon[12] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static const char *am_pm[2] = {
"AM", "PM"
};
#endif
|
6ce3d61943d9fe44ecf6eda639506aad26ef8302
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/net/phonet/pn_dev.c
|
45a7df6575ded371ef75fc11fc41a2b48371e51e
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 10,103
|
c
|
pn_dev.c
|
/*
* File: pn_dev.c
*
* Phonet network device
*
* Copyright (C) 2008 Nokia Corporation.
*
* Authors: Sakari Ailus <sakari.ailus@nokia.com>
* Rémi Denis-Courmont
*
* 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/kernel.h>
#include <linux/net.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/phonet.h>
#include <linux/proc_fs.h>
#include <linux/if_arp.h>
#include <net/sock.h>
#include <net/netns/generic.h>
#include <net/phonet/pn_dev.h>
struct phonet_routes {
struct mutex lock;
struct net_device *table[64];
};
struct phonet_net {
struct phonet_device_list pndevs;
struct phonet_routes routes;
};
static int phonet_net_id __read_mostly;
static struct phonet_net *phonet_pernet(struct net *net)
{
BUG_ON(!net);
return net_generic(net, phonet_net_id);
}
struct phonet_device_list *phonet_device_list(struct net *net)
{
struct phonet_net *pnn = phonet_pernet(net);
return &pnn->pndevs;
}
/* Allocate new Phonet device. */
static struct phonet_device *__phonet_device_alloc(struct net_device *dev)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd = kmalloc(sizeof(*pnd), GFP_ATOMIC);
if (pnd == NULL)
return NULL;
pnd->netdev = dev;
bitmap_zero(pnd->addrs, 64);
BUG_ON(!mutex_is_locked(&pndevs->lock));
list_add_rcu(&pnd->list, &pndevs->list);
return pnd;
}
static struct phonet_device *__phonet_get(struct net_device *dev)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd;
BUG_ON(!mutex_is_locked(&pndevs->lock));
list_for_each_entry(pnd, &pndevs->list, list) {
if (pnd->netdev == dev)
return pnd;
}
return NULL;
}
static struct phonet_device *__phonet_get_rcu(struct net_device *dev)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd;
list_for_each_entry_rcu(pnd, &pndevs->list, list) {
if (pnd->netdev == dev)
return pnd;
}
return NULL;
}
static void phonet_device_destroy(struct net_device *dev)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd;
ASSERT_RTNL();
mutex_lock(&pndevs->lock);
pnd = __phonet_get(dev);
if (pnd)
list_del_rcu(&pnd->list);
mutex_unlock(&pndevs->lock);
if (pnd) {
u8 addr;
for_each_set_bit(addr, pnd->addrs, 64)
phonet_address_notify(RTM_DELADDR, dev, addr);
kfree(pnd);
}
}
struct net_device *phonet_device_get(struct net *net)
{
struct phonet_device_list *pndevs = phonet_device_list(net);
struct phonet_device *pnd;
struct net_device *dev = NULL;
rcu_read_lock();
list_for_each_entry_rcu(pnd, &pndevs->list, list) {
dev = pnd->netdev;
BUG_ON(!dev);
if ((dev->reg_state == NETREG_REGISTERED) &&
((pnd->netdev->flags & IFF_UP)) == IFF_UP)
break;
dev = NULL;
}
if (dev)
dev_hold(dev);
rcu_read_unlock();
return dev;
}
int phonet_address_add(struct net_device *dev, u8 addr)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd;
int err = 0;
mutex_lock(&pndevs->lock);
/* Find or create Phonet-specific device data */
pnd = __phonet_get(dev);
if (pnd == NULL)
pnd = __phonet_device_alloc(dev);
if (unlikely(pnd == NULL))
err = -ENOMEM;
else if (test_and_set_bit(addr >> 2, pnd->addrs))
err = -EEXIST;
mutex_unlock(&pndevs->lock);
return err;
}
int phonet_address_del(struct net_device *dev, u8 addr)
{
struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
struct phonet_device *pnd;
int err = 0;
mutex_lock(&pndevs->lock);
pnd = __phonet_get(dev);
if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs)) {
err = -EADDRNOTAVAIL;
pnd = NULL;
} else if (bitmap_empty(pnd->addrs, 64))
list_del_rcu(&pnd->list);
else
pnd = NULL;
mutex_unlock(&pndevs->lock);
if (pnd)
kfree_rcu(pnd, rcu);
return err;
}
/* Gets a source address toward a destination, through a interface. */
u8 phonet_address_get(struct net_device *dev, u8 daddr)
{
struct phonet_device *pnd;
u8 saddr;
rcu_read_lock();
pnd = __phonet_get_rcu(dev);
if (pnd) {
BUG_ON(bitmap_empty(pnd->addrs, 64));
/* Use same source address as destination, if possible */
if (test_bit(daddr >> 2, pnd->addrs))
saddr = daddr;
else
saddr = find_first_bit(pnd->addrs, 64) << 2;
} else
saddr = PN_NO_ADDR;
rcu_read_unlock();
if (saddr == PN_NO_ADDR) {
/* Fallback to another device */
struct net_device *def_dev;
def_dev = phonet_device_get(dev_net(dev));
if (def_dev) {
if (def_dev != dev)
saddr = phonet_address_get(def_dev, daddr);
dev_put(def_dev);
}
}
return saddr;
}
int phonet_address_lookup(struct net *net, u8 addr)
{
struct phonet_device_list *pndevs = phonet_device_list(net);
struct phonet_device *pnd;
int err = -EADDRNOTAVAIL;
rcu_read_lock();
list_for_each_entry_rcu(pnd, &pndevs->list, list) {
/* Don't allow unregistering devices! */
if ((pnd->netdev->reg_state != NETREG_REGISTERED) ||
((pnd->netdev->flags & IFF_UP)) != IFF_UP)
continue;
if (test_bit(addr >> 2, pnd->addrs)) {
err = 0;
goto found;
}
}
found:
rcu_read_unlock();
return err;
}
/* automatically configure a Phonet device, if supported */
static int phonet_device_autoconf(struct net_device *dev)
{
struct if_phonet_req req;
int ret;
if (!dev->netdev_ops->ndo_do_ioctl)
return -EOPNOTSUPP;
ret = dev->netdev_ops->ndo_do_ioctl(dev, (struct ifreq *)&req,
SIOCPNGAUTOCONF);
if (ret < 0)
return ret;
ASSERT_RTNL();
ret = phonet_address_add(dev, req.ifr_phonet_autoconf.device);
if (ret)
return ret;
phonet_address_notify(RTM_NEWADDR, dev,
req.ifr_phonet_autoconf.device);
return 0;
}
static void phonet_route_autodel(struct net_device *dev)
{
struct phonet_net *pnn = phonet_pernet(dev_net(dev));
unsigned int i;
DECLARE_BITMAP(deleted, 64);
/* Remove left-over Phonet routes */
bitmap_zero(deleted, 64);
mutex_lock(&pnn->routes.lock);
for (i = 0; i < 64; i++)
if (dev == pnn->routes.table[i]) {
RCU_INIT_POINTER(pnn->routes.table[i], NULL);
set_bit(i, deleted);
}
mutex_unlock(&pnn->routes.lock);
if (bitmap_empty(deleted, 64))
return; /* short-circuit RCU */
synchronize_rcu();
for_each_set_bit(i, deleted, 64) {
rtm_phonet_notify(RTM_DELROUTE, dev, i);
dev_put(dev);
}
}
/* notify Phonet of device events */
static int phonet_device_notify(struct notifier_block *me, unsigned long what,
void *arg)
{
struct net_device *dev = arg;
switch (what) {
case NETDEV_REGISTER:
if (dev->type == ARPHRD_PHONET)
phonet_device_autoconf(dev);
break;
case NETDEV_UNREGISTER:
phonet_device_destroy(dev);
phonet_route_autodel(dev);
break;
}
return 0;
}
static struct notifier_block phonet_device_notifier = {
.notifier_call = phonet_device_notify,
.priority = 0,
};
/* Per-namespace Phonet devices handling */
static int __net_init phonet_init_net(struct net *net)
{
struct phonet_net *pnn = phonet_pernet(net);
if (!proc_create("phonet", 0, net->proc_net, &pn_sock_seq_fops))
return -ENOMEM;
INIT_LIST_HEAD(&pnn->pndevs.list);
mutex_init(&pnn->pndevs.lock);
mutex_init(&pnn->routes.lock);
return 0;
}
static void __net_exit phonet_exit_net(struct net *net)
{
remove_proc_entry("phonet", net->proc_net);
}
static struct pernet_operations phonet_net_ops = {
.init = phonet_init_net,
.exit = phonet_exit_net,
.id = &phonet_net_id,
.size = sizeof(struct phonet_net),
};
/* Initialize Phonet devices list */
int __init phonet_device_init(void)
{
int err = register_pernet_subsys(&phonet_net_ops);
if (err)
return err;
proc_create("pnresource", 0, init_net.proc_net, &pn_res_seq_fops);
register_netdevice_notifier(&phonet_device_notifier);
err = phonet_netlink_register();
if (err)
phonet_device_exit();
return err;
}
void phonet_device_exit(void)
{
rtnl_unregister_all(PF_PHONET);
unregister_netdevice_notifier(&phonet_device_notifier);
unregister_pernet_subsys(&phonet_net_ops);
remove_proc_entry("pnresource", init_net.proc_net);
}
int phonet_route_add(struct net_device *dev, u8 daddr)
{
struct phonet_net *pnn = phonet_pernet(dev_net(dev));
struct phonet_routes *routes = &pnn->routes;
int err = -EEXIST;
daddr = daddr >> 2;
mutex_lock(&routes->lock);
if (routes->table[daddr] == NULL) {
rcu_assign_pointer(routes->table[daddr], dev);
dev_hold(dev);
err = 0;
}
mutex_unlock(&routes->lock);
return err;
}
int phonet_route_del(struct net_device *dev, u8 daddr)
{
struct phonet_net *pnn = phonet_pernet(dev_net(dev));
struct phonet_routes *routes = &pnn->routes;
daddr = daddr >> 2;
mutex_lock(&routes->lock);
if (dev == routes->table[daddr])
RCU_INIT_POINTER(routes->table[daddr], NULL);
else
dev = NULL;
mutex_unlock(&routes->lock);
if (!dev)
return -ENOENT;
synchronize_rcu();
dev_put(dev);
return 0;
}
struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr)
{
struct phonet_net *pnn = phonet_pernet(net);
struct phonet_routes *routes = &pnn->routes;
struct net_device *dev;
daddr >>= 2;
dev = rcu_dereference(routes->table[daddr]);
return dev;
}
struct net_device *phonet_route_output(struct net *net, u8 daddr)
{
struct phonet_net *pnn = phonet_pernet(net);
struct phonet_routes *routes = &pnn->routes;
struct net_device *dev;
daddr >>= 2;
rcu_read_lock();
dev = rcu_dereference(routes->table[daddr]);
if (dev)
dev_hold(dev);
rcu_read_unlock();
if (!dev)
dev = phonet_device_get(net); /* Default route */
return dev;
}
|
cb99e9613383e4d299416065224766ae4bb3f52f
|
f2d0bc028d2b37e44748ca02ac25db91af15f1d4
|
/pg_wait_sampling.c
|
eaa03271c0c0bf38deca12242ed3f4f48d640117
|
[
"PostgreSQL"
] |
permissive
|
postgrespro/pg_wait_sampling
|
b37f3ed726f3305922209c576d69e3ff58f2b33f
|
c6ae0dd43220afc12c5eec80ad349e6896eaac8e
|
refs/heads/master
| 2023-08-23T21:44:33.716623
| 2023-02-15T08:12:50
| 2023-02-15T08:12:50
| 54,636,498
| 130
| 37
|
NOASSERTION
| 2023-02-15T08:12:51
| 2016-03-24T11:19:52
|
C
|
UTF-8
|
C
| false
| false
| 24,114
|
c
|
pg_wait_sampling.c
|
/*
* pg_wait_sampling.c
* Track information about wait events.
*
* Copyright (c) 2015-2017, Postgres Professional
*
* IDENTIFICATION
* contrib/pg_wait_sampling/pg_wait_sampling.c
*/
#include "postgres.h"
#include "access/htup_details.h"
#include "access/twophase.h"
#include "catalog/pg_type.h"
#include "fmgr.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "optimizer/planner.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#if PG_VERSION_NUM >= 120000
#include "replication/walsender.h"
#endif
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
#include "storage/procarray.h"
#include "storage/shm_mq.h"
#include "storage/shm_toc.h"
#include "storage/spin.h"
#include "utils/builtins.h"
#include "utils/datetime.h"
#include "utils/guc_tables.h"
#include "utils/guc.h"
#include "utils/memutils.h" /* TopMemoryContext. Actually for PG 9.6 only,
* but there should be no harm for others. */
#include "compat.h"
#include "pg_wait_sampling.h"
PG_MODULE_MAGIC;
void _PG_init(void);
static bool shmem_initialized = false;
/* Hooks */
static ExecutorEnd_hook_type prev_ExecutorEnd = NULL;
static planner_hook_type planner_hook_next = NULL;
/* Pointers to shared memory objects */
shm_mq *pgws_collector_mq = NULL;
uint64 *pgws_proc_queryids = NULL;
CollectorShmqHeader *pgws_collector_hdr = NULL;
/* Receiver (backend) local shm_mq pointers and lock */
static shm_mq *recv_mq = NULL;
static shm_mq_handle *recv_mqh = NULL;
static LOCKTAG queueTag;
#if PG_VERSION_NUM >= 150000
static shmem_request_hook_type prev_shmem_request_hook = NULL;
#endif
static shmem_startup_hook_type prev_shmem_startup_hook = NULL;
static PGPROC * search_proc(int backendPid);
static PlannedStmt *pgws_planner_hook(Query *parse,
#if PG_VERSION_NUM >= 130000
const char *query_string,
#endif
int cursorOptions, ParamListInfo boundParams);
static void pgws_ExecutorEnd(QueryDesc *queryDesc);
/*
* Calculate max processes count.
*
* The value has to be in sync with ProcGlobal->allProcCount, initialized in
* InitProcGlobal() (proc.c).
*
*/
static int
get_max_procs_count(void)
{
int count = 0;
/* First, add the maximum number of backends (MaxBackends). */
#if PG_VERSION_NUM >= 150000
/*
* On pg15+, we can directly access the MaxBackends variable, as it will
* have already been initialized in shmem_request_hook.
*/
Assert(MaxBackends > 0);
count += MaxBackends;
#else
/*
* On older versions, we need to compute MaxBackends: bgworkers, autovacuum
* workers and launcher.
* This has to be in sync with the value computed in
* InitializeMaxBackends() (postinit.c)
*
* Note that we need to calculate the value as it won't initialized when we
* need it during _PG_init().
*
* Note also that the value returned during _PG_init() might be different
* from the value returned later if some third-party modules change one of
* the underlying GUC. This isn't ideal but can't lead to a crash, as the
* value returned during _PG_init() is only used to ask for additional
* shmem with RequestAddinShmemSpace(), and postgres has an extra 100kB of
* shmem to compensate some small unaccounted usage. So if the value later
* changes, we will allocate and initialize the new (and correct) memory
* size, which will either work thanks for the extra 100kB of shmem, of
* fail (and prevent postgres startup) due to an out of shared memory
* error.
*/
count += MaxConnections + autovacuum_max_workers + 1
+ max_worker_processes;
/*
* Starting with pg12, wal senders aren't part of MaxConnections anymore
* and have to be accounted for.
*/
#if PG_VERSION_NUM >= 120000
count += max_wal_senders;
#endif /* pg 12+ */
#endif /* pg 15- */
/* End of MaxBackends calculation. */
/* Add AuxiliaryProcs */
count += NUM_AUXILIARY_PROCS;
return count;
}
/*
* Estimate amount of shared memory needed.
*/
static Size
pgws_shmem_size(void)
{
shm_toc_estimator e;
Size size;
int nkeys;
shm_toc_initialize_estimator(&e);
nkeys = 3;
shm_toc_estimate_chunk(&e, sizeof(CollectorShmqHeader));
shm_toc_estimate_chunk(&e, (Size) COLLECTOR_QUEUE_SIZE);
shm_toc_estimate_chunk(&e, sizeof(uint64) * get_max_procs_count());
shm_toc_estimate_keys(&e, nkeys);
size = shm_toc_estimate(&e);
return size;
}
static bool
shmem_int_guc_check_hook(int *newval, void **extra, GucSource source)
{
if (UsedShmemSegAddr == NULL)
return false;
return true;
}
static bool
shmem_bool_guc_check_hook(bool *newval, void **extra, GucSource source)
{
if (UsedShmemSegAddr == NULL)
return false;
return true;
}
/*
* This union allows us to mix the numerous different types of structs
* that we are organizing.
*/
typedef union
{
struct config_generic generic;
struct config_bool _bool;
struct config_real real;
struct config_int integer;
struct config_string string;
struct config_enum _enum;
} mixedStruct;
/*
* Setup new GUCs or modify existsing.
*/
static void
setup_gucs()
{
struct config_generic **guc_vars;
int numOpts,
i;
bool history_size_found = false,
history_period_found = false,
profile_period_found = false,
profile_pid_found = false,
profile_queries_found = false;
get_guc_variables_compat(&guc_vars, &numOpts);
for (i = 0; i < numOpts; i++)
{
mixedStruct *var = (mixedStruct *) guc_vars[i];
const char *name = var->generic.name;
if (var->generic.flags & GUC_CUSTOM_PLACEHOLDER)
continue;
if (!strcmp(name, "pg_wait_sampling.history_size"))
{
history_size_found = true;
var->integer.variable = &pgws_collector_hdr->historySize;
pgws_collector_hdr->historySize = 5000;
}
else if (!strcmp(name, "pg_wait_sampling.history_period"))
{
history_period_found = true;
var->integer.variable = &pgws_collector_hdr->historyPeriod;
pgws_collector_hdr->historyPeriod = 10;
}
else if (!strcmp(name, "pg_wait_sampling.profile_period"))
{
profile_period_found = true;
var->integer.variable = &pgws_collector_hdr->profilePeriod;
pgws_collector_hdr->profilePeriod = 10;
}
else if (!strcmp(name, "pg_wait_sampling.profile_pid"))
{
profile_pid_found = true;
var->_bool.variable = &pgws_collector_hdr->profilePid;
pgws_collector_hdr->profilePid = true;
}
else if (!strcmp(name, "pg_wait_sampling.profile_queries"))
{
profile_queries_found = true;
var->_bool.variable = &pgws_collector_hdr->profileQueries;
pgws_collector_hdr->profileQueries = true;
}
}
if (!history_size_found)
DefineCustomIntVariable("pg_wait_sampling.history_size",
"Sets size of waits history.", NULL,
&pgws_collector_hdr->historySize, 5000, 100, INT_MAX,
PGC_SUSET, 0, shmem_int_guc_check_hook, NULL, NULL);
if (!history_period_found)
DefineCustomIntVariable("pg_wait_sampling.history_period",
"Sets period of waits history sampling.", NULL,
&pgws_collector_hdr->historyPeriod, 10, 1, INT_MAX,
PGC_SUSET, 0, shmem_int_guc_check_hook, NULL, NULL);
if (!profile_period_found)
DefineCustomIntVariable("pg_wait_sampling.profile_period",
"Sets period of waits profile sampling.", NULL,
&pgws_collector_hdr->profilePeriod, 10, 1, INT_MAX,
PGC_SUSET, 0, shmem_int_guc_check_hook, NULL, NULL);
if (!profile_pid_found)
DefineCustomBoolVariable("pg_wait_sampling.profile_pid",
"Sets whether profile should be collected per pid.", NULL,
&pgws_collector_hdr->profilePid, true,
PGC_SUSET, 0, shmem_bool_guc_check_hook, NULL, NULL);
if (!profile_queries_found)
DefineCustomBoolVariable("pg_wait_sampling.profile_queries",
"Sets whether profile should be collected per query.", NULL,
&pgws_collector_hdr->profileQueries, true,
PGC_SUSET, 0, shmem_bool_guc_check_hook, NULL, NULL);
if (history_size_found
|| history_period_found
|| profile_period_found
|| profile_pid_found
|| profile_queries_found)
{
ProcessConfigFile(PGC_SIGHUP);
}
}
#if PG_VERSION_NUM >= 150000
/*
* shmem_request hook: request additional shared memory resources.
*
* If you change code here, don't forget to also report the modifications in
* _PG_init() for pg14 and below.
*/
static void
pgws_shmem_request(void)
{
if (prev_shmem_request_hook)
prev_shmem_request_hook();
RequestAddinShmemSpace(pgws_shmem_size());
}
#endif
/*
* Distribute shared memory.
*/
static void
pgws_shmem_startup(void)
{
bool found;
Size segsize = pgws_shmem_size();
void *pgws;
shm_toc *toc;
pgws = ShmemInitStruct("pg_wait_sampling", segsize, &found);
if (!found)
{
toc = shm_toc_create(PG_WAIT_SAMPLING_MAGIC, pgws, segsize);
pgws_collector_hdr = shm_toc_allocate(toc, sizeof(CollectorShmqHeader));
shm_toc_insert(toc, 0, pgws_collector_hdr);
pgws_collector_mq = shm_toc_allocate(toc, COLLECTOR_QUEUE_SIZE);
shm_toc_insert(toc, 1, pgws_collector_mq);
pgws_proc_queryids = shm_toc_allocate(toc,
sizeof(uint64) * get_max_procs_count());
shm_toc_insert(toc, 2, pgws_proc_queryids);
MemSet(pgws_proc_queryids, 0, sizeof(uint64) * get_max_procs_count());
/* Initialize GUC variables in shared memory */
setup_gucs();
}
else
{
toc = shm_toc_attach(PG_WAIT_SAMPLING_MAGIC, pgws);
#if PG_VERSION_NUM >= 100000
pgws_collector_hdr = shm_toc_lookup(toc, 0, false);
pgws_collector_mq = shm_toc_lookup(toc, 1, false);
pgws_proc_queryids = shm_toc_lookup(toc, 2, false);
#else
pgws_collector_hdr = shm_toc_lookup(toc, 0);
pgws_collector_mq = shm_toc_lookup(toc, 1);
pgws_proc_queryids = shm_toc_lookup(toc, 2);
#endif
}
shmem_initialized = true;
if (prev_shmem_startup_hook)
prev_shmem_startup_hook();
}
/*
* Check shared memory is initialized. Report an error otherwise.
*/
static void
check_shmem(void)
{
if (!shmem_initialized)
{
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("pg_wait_sampling shared memory wasn't initialized yet")));
}
}
static void
pgws_cleanup_callback(int code, Datum arg)
{
elog(DEBUG3, "pg_wait_sampling cleanup: detaching shm_mq and releasing queue lock");
shm_mq_detach_compat(recv_mqh, recv_mq);
LockRelease(&queueTag, ExclusiveLock, false);
}
/*
* Module load callback
*/
void
_PG_init(void)
{
if (!process_shared_preload_libraries_in_progress)
return;
#if PG_VERSION_NUM < 150000
/*
* Request additional shared resources. (These are no-ops if we're not in
* the postmaster process.) We'll allocate or attach to the shared
* resources in pgws_shmem_startup().
*
* If you change code here, don't forget to also report the modifications
* in pgsp_shmem_request() for pg15 and later.
*/
RequestAddinShmemSpace(pgws_shmem_size());
#endif
pgws_register_wait_collector();
/*
* Install hooks.
*/
#if PG_VERSION_NUM >= 150000
prev_shmem_request_hook = shmem_request_hook;
shmem_request_hook = pgws_shmem_request;
#endif
prev_shmem_startup_hook = shmem_startup_hook;
shmem_startup_hook = pgws_shmem_startup;
planner_hook_next = planner_hook;
planner_hook = pgws_planner_hook;
prev_ExecutorEnd = ExecutorEnd_hook;
ExecutorEnd_hook = pgws_ExecutorEnd;
}
/*
* Find PGPROC entry responsible for given pid assuming ProcArrayLock was
* already taken.
*/
static PGPROC *
search_proc(int pid)
{
int i;
if (pid == 0)
return MyProc;
for (i = 0; i < ProcGlobal->allProcCount; i++)
{
PGPROC *proc = &ProcGlobal->allProcs[i];
if (proc->pid && proc->pid == pid)
{
return proc;
}
}
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("backend with pid=%d not found", pid)));
return NULL;
}
typedef struct
{
HistoryItem *items;
TimestampTz ts;
} WaitCurrentContext;
PG_FUNCTION_INFO_V1(pg_wait_sampling_get_current);
Datum
pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
{
FuncCallContext *funcctx;
WaitCurrentContext *params;
check_shmem();
if (SRF_IS_FIRSTCALL())
{
MemoryContext oldcontext;
TupleDesc tupdesc;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
params = (WaitCurrentContext *)palloc0(sizeof(WaitCurrentContext));
params->ts = GetCurrentTimestamp();
funcctx->user_fctx = params;
tupdesc = CreateTemplateTupleDescCompat(4, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "event",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "queryid",
INT8OID, -1, 0);
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
LWLockAcquire(ProcArrayLock, LW_SHARED);
if (!PG_ARGISNULL(0))
{
HistoryItem *item;
PGPROC *proc;
proc = search_proc(PG_GETARG_UINT32(0));
params->items = (HistoryItem *) palloc0(sizeof(HistoryItem));
item = ¶ms->items[0];
item->pid = proc->pid;
item->wait_event_info = proc->wait_event_info;
item->queryId = pgws_proc_queryids[proc - ProcGlobal->allProcs];
funcctx->max_calls = 1;
}
else
{
int procCount = ProcGlobal->allProcCount,
i,
j = 0;
params->items = (HistoryItem *) palloc0(sizeof(HistoryItem) * procCount);
for (i = 0; i < procCount; i++)
{
PGPROC *proc = &ProcGlobal->allProcs[i];
if (proc != NULL && proc->pid != 0 && proc->wait_event_info)
{
params->items[j].pid = proc->pid;
params->items[j].wait_event_info = proc->wait_event_info;
params->items[j].queryId = pgws_proc_queryids[i];
j++;
}
}
funcctx->max_calls = j;
}
LWLockRelease(ProcArrayLock);
MemoryContextSwitchTo(oldcontext);
}
/* stuff done on every call of the function */
funcctx = SRF_PERCALL_SETUP();
params = (WaitCurrentContext *) funcctx->user_fctx;
if (funcctx->call_cntr < funcctx->max_calls)
{
HeapTuple tuple;
Datum values[4];
bool nulls[4];
const char *event_type,
*event;
HistoryItem *item;
item = ¶ms->items[funcctx->call_cntr];
/* Make and return next tuple to caller */
MemSet(values, 0, sizeof(values));
MemSet(nulls, 0, sizeof(nulls));
event_type = pgstat_get_wait_event_type(item->wait_event_info);
event = pgstat_get_wait_event(item->wait_event_info);
values[0] = Int32GetDatum(item->pid);
if (event_type)
values[1] = PointerGetDatum(cstring_to_text(event_type));
else
nulls[1] = true;
if (event)
values[2] = PointerGetDatum(cstring_to_text(event));
else
nulls[2] = true;
values[3] = UInt64GetDatum(item->queryId);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
}
else
{
SRF_RETURN_DONE(funcctx);
}
}
typedef struct
{
Size count;
ProfileItem *items;
} Profile;
void
pgws_init_lock_tag(LOCKTAG *tag, uint32 lock)
{
tag->locktag_field1 = PG_WAIT_SAMPLING_MAGIC;
tag->locktag_field2 = lock;
tag->locktag_field3 = 0;
tag->locktag_field4 = 0;
tag->locktag_type = LOCKTAG_USERLOCK;
tag->locktag_lockmethodid = USER_LOCKMETHOD;
}
static void *
receive_array(SHMRequest request, Size item_size, Size *count)
{
LOCKTAG collectorTag;
shm_mq_result res;
Size len,
i;
void *data;
Pointer result,
ptr;
MemoryContext oldctx;
/* Ensure nobody else trying to send request to queue */
pgws_init_lock_tag(&queueTag, PGWS_QUEUE_LOCK);
LockAcquire(&queueTag, ExclusiveLock, false, false);
pgws_init_lock_tag(&collectorTag, PGWS_COLLECTOR_LOCK);
LockAcquire(&collectorTag, ExclusiveLock, false, false);
recv_mq = shm_mq_create(pgws_collector_mq, COLLECTOR_QUEUE_SIZE);
pgws_collector_hdr->request = request;
LockRelease(&collectorTag, ExclusiveLock, false);
if (!pgws_collector_hdr->latch)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("pg_wait_sampling collector wasn't started")));
SetLatch(pgws_collector_hdr->latch);
shm_mq_set_receiver(recv_mq, MyProc);
/*
* We switch to TopMemoryContext, so that recv_mqh is allocated there
* and is guaranteed to survive until before_shmem_exit callbacks are
* fired. Anyway, shm_mq_detach() will free handler on its own.
*
* NB: we do not pass `seg` to shm_mq_attach(), so it won't set its own
* callback, i.e. we do not interfere here with shm_mq_detach_callback().
*/
oldctx = MemoryContextSwitchTo(TopMemoryContext);
recv_mqh = shm_mq_attach(recv_mq, NULL, NULL);
MemoryContextSwitchTo(oldctx);
/*
* Now we surely attached to the shm_mq and got collector's attention.
* If anything went wrong (e.g. Ctrl+C received from the client) we have
* to cleanup some things, i.e. detach from the shm_mq, so collector was
* able to continue responding to other requests.
*
* PG_ENSURE_ERROR_CLEANUP() guaranties that cleanup callback will be
* fired for both ERROR and FATAL.
*/
PG_ENSURE_ERROR_CLEANUP(pgws_cleanup_callback, 0);
{
res = shm_mq_receive(recv_mqh, &len, &data, false);
if (res != SHM_MQ_SUCCESS || len != sizeof(*count))
elog(ERROR, "error reading mq");
memcpy(count, data, sizeof(*count));
result = palloc(item_size * (*count));
ptr = result;
for (i = 0; i < *count; i++)
{
res = shm_mq_receive(recv_mqh, &len, &data, false);
if (res != SHM_MQ_SUCCESS || len != item_size)
elog(ERROR, "error reading mq");
memcpy(ptr, data, item_size);
ptr += item_size;
}
}
PG_END_ENSURE_ERROR_CLEANUP(pgws_cleanup_callback, 0);
/* We still have to detach and release lock during normal operation. */
shm_mq_detach_compat(recv_mqh, recv_mq);
LockRelease(&queueTag, ExclusiveLock, false);
return result;
}
PG_FUNCTION_INFO_V1(pg_wait_sampling_get_profile);
Datum
pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
{
Profile *profile;
FuncCallContext *funcctx;
check_shmem();
if (SRF_IS_FIRSTCALL())
{
MemoryContext oldcontext;
TupleDesc tupdesc;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
/* Receive profile from shmq */
profile = (Profile *) palloc0(sizeof(Profile));
profile->items = (ProfileItem *) receive_array(PROFILE_REQUEST,
sizeof(ProfileItem), &profile->count);
funcctx->user_fctx = profile;
funcctx->max_calls = profile->count;
/* Make tuple descriptor */
tupdesc = CreateTemplateTupleDescCompat(5, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "event",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "queryid",
INT8OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "count",
INT8OID, -1, 0);
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
MemoryContextSwitchTo(oldcontext);
}
/* stuff done on every call of the function */
funcctx = SRF_PERCALL_SETUP();
profile = (Profile *) funcctx->user_fctx;
if (funcctx->call_cntr < funcctx->max_calls)
{
/* for each row */
Datum values[5];
bool nulls[5];
HeapTuple tuple;
ProfileItem *item;
const char *event_type,
*event;
item = &profile->items[funcctx->call_cntr];
MemSet(values, 0, sizeof(values));
MemSet(nulls, 0, sizeof(nulls));
/* Make and return next tuple to caller */
event_type = pgstat_get_wait_event_type(item->wait_event_info);
event = pgstat_get_wait_event(item->wait_event_info);
values[0] = Int32GetDatum(item->pid);
if (event_type)
values[1] = PointerGetDatum(cstring_to_text(event_type));
else
nulls[1] = true;
if (event)
values[2] = PointerGetDatum(cstring_to_text(event));
else
nulls[2] = true;
if (pgws_collector_hdr->profileQueries)
values[3] = UInt64GetDatum(item->queryId);
else
values[3] = (Datum) 0;
values[4] = UInt64GetDatum(item->count);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
}
else
{
/* nothing left */
SRF_RETURN_DONE(funcctx);
}
}
PG_FUNCTION_INFO_V1(pg_wait_sampling_reset_profile);
Datum
pg_wait_sampling_reset_profile(PG_FUNCTION_ARGS)
{
LOCKTAG collectorTag;
check_shmem();
pgws_init_lock_tag(&queueTag, PGWS_QUEUE_LOCK);
LockAcquire(&queueTag, ExclusiveLock, false, false);
pgws_init_lock_tag(&collectorTag, PGWS_COLLECTOR_LOCK);
LockAcquire(&collectorTag, ExclusiveLock, false, false);
pgws_collector_hdr->request = PROFILE_RESET;
LockRelease(&collectorTag, ExclusiveLock, false);
SetLatch(pgws_collector_hdr->latch);
LockRelease(&queueTag, ExclusiveLock, false);
PG_RETURN_VOID();
}
PG_FUNCTION_INFO_V1(pg_wait_sampling_get_history);
Datum
pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
{
History *history;
FuncCallContext *funcctx;
check_shmem();
if (SRF_IS_FIRSTCALL())
{
MemoryContext oldcontext;
TupleDesc tupdesc;
funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
/* Receive history from shmq */
history = (History *) palloc0(sizeof(History));
history->items = (HistoryItem *) receive_array(HISTORY_REQUEST,
sizeof(HistoryItem), &history->count);
funcctx->user_fctx = history;
funcctx->max_calls = history->count;
/* Make tuple descriptor */
tupdesc = CreateTemplateTupleDescCompat(5, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
INT4OID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "sample_ts",
TIMESTAMPTZOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "type",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "event",
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "queryid",
INT8OID, -1, 0);
funcctx->tuple_desc = BlessTupleDesc(tupdesc);
MemoryContextSwitchTo(oldcontext);
}
/* stuff done on every call of the function */
funcctx = SRF_PERCALL_SETUP();
history = (History *) funcctx->user_fctx;
if (history->index < history->count)
{
HeapTuple tuple;
HistoryItem *item;
Datum values[5];
bool nulls[5];
const char *event_type,
*event;
item = &history->items[history->index];
/* Make and return next tuple to caller */
MemSet(values, 0, sizeof(values));
MemSet(nulls, 0, sizeof(nulls));
event_type = pgstat_get_wait_event_type(item->wait_event_info);
event = pgstat_get_wait_event(item->wait_event_info);
values[0] = Int32GetDatum(item->pid);
values[1] = TimestampTzGetDatum(item->ts);
if (event_type)
values[2] = PointerGetDatum(cstring_to_text(event_type));
else
nulls[2] = true;
if (event)
values[3] = PointerGetDatum(cstring_to_text(event));
else
nulls[3] = true;
values[4] = UInt64GetDatum(item->queryId);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
history->index++;
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
}
else
{
/* nothing left */
SRF_RETURN_DONE(funcctx);
}
PG_RETURN_VOID();
}
/*
* planner_hook hook, save queryId for collector
*/
static PlannedStmt *
pgws_planner_hook(Query *parse,
#if PG_VERSION_NUM >= 130000
const char *query_string,
#endif
int cursorOptions,
ParamListInfo boundParams)
{
if (MyProc)
{
int i = MyProc - ProcGlobal->allProcs;
#if PG_VERSION_NUM >= 110000
/*
* since we depend on queryId we need to check that its size
* is uint64 as we coded in pg_wait_sampling
*/
StaticAssertExpr(sizeof(parse->queryId) == sizeof(uint64),
"queryId size is not uint64");
#else
StaticAssertExpr(sizeof(parse->queryId) == sizeof(uint32),
"queryId size is not uint32");
#endif
if (!pgws_proc_queryids[i])
pgws_proc_queryids[i] = parse->queryId;
}
/* Invoke original hook if needed */
if (planner_hook_next)
return planner_hook_next(parse,
#if PG_VERSION_NUM >= 130000
query_string,
#endif
cursorOptions, boundParams);
return standard_planner(parse,
#if PG_VERSION_NUM >= 130000
query_string,
#endif
cursorOptions, boundParams);
}
/*
* ExecutorEnd hook: clear queryId
*/
static void
pgws_ExecutorEnd(QueryDesc *queryDesc)
{
if (MyProc)
pgws_proc_queryids[MyProc - ProcGlobal->allProcs] = UINT64CONST(0);
if (prev_ExecutorEnd)
prev_ExecutorEnd(queryDesc);
else
standard_ExecutorEnd(queryDesc);
}
|
bce76877a4deef3aac18bbb6bd2f581af5906abe
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/nt/struct/linkedlist.h
|
461c12355140579204369cb42110d010324bd252
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 365
|
h
|
linkedlist.h
|
#ifndef COSMOPOLITAN_LIBC_NT_STRUCT_LINKEDLIST_H_
#define COSMOPOLITAN_LIBC_NT_STRUCT_LINKEDLIST_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
/**
* Dynamic linked list overlay.
*/
struct NtLinkedList {
struct NtLinkedList *Next;
struct NtLinkedList *Prev;
};
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_STRUCT_LINKEDLIST_H_ */
|
4fc94042bf5188f75a4756e8936c9c98c2f9a4ed
|
010279e2ba272d09e9d2c4e903722e5faba2cf7a
|
/contrib/python/Pillow/py2/libImaging/GifDecode.c
|
68429ab26c0d21a49bec02111496440da0574691
|
[
"Apache-2.0",
"LicenseRef-scancode-secret-labs-2011"
] |
permissive
|
catboost/catboost
|
854c1a1f439a96f1ae6b48e16644be20aa04dba2
|
f5042e35b945aded77b23470ead62d7eacefde92
|
refs/heads/master
| 2023-09-01T12:14:14.174108
| 2023-09-01T10:01:01
| 2023-09-01T10:22:12
| 97,556,265
| 8,012
| 1,425
|
Apache-2.0
| 2023-09-11T03:32:32
| 2017-07-18T05:29:04
|
Python
|
UTF-8
|
C
| false
| false
| 6,425
|
c
|
GifDecode.c
|
/*
* The Python Imaging Library.
* $Id$
*
* a fast, suspendable GIF decoder
*
* history:
* 95-09-03 fl Created
* 95-09-05 fl Fixed sign problem on 16-bit platforms
* 95-09-13 fl Added some storage shortcuts
* 96-03-28 fl Revised API, integrated with PIL
* 96-12-10 fl Added interlace support
* 96-12-16 fl Fixed premature termination bug introduced by last fix
* 97-01-05 fl Don't mess up on bogus configuration
* 97-01-17 fl Don't mess up on very small, interlaced files
* 99-02-07 fl Minor speedups
*
* Copyright (c) Secret Labs AB 1997-99.
* Copyright (c) Fredrik Lundh 1995-97.
*
* See the README file for information on usage and redistribution.
*/
#include "Imaging.h"
#include <stdio.h>
#include <memory.h> /* memcpy() */
#include "Gif.h"
#define NEWLINE(state, context) {\
state->x = 0;\
state->y += context->step;\
while (state->y >= state->ysize)\
switch (context->interlace) {\
case 1:\
context->repeat = state->y = 4;\
context->interlace = 2;\
break;\
case 2:\
context->step = 4;\
context->repeat = state->y = 2;\
context->interlace = 3;\
break;\
case 3:\
context->step = 2;\
context->repeat = state->y = 1;\
context->interlace = 0;\
break;\
default:\
return -1;\
}\
if (state->y < state->ysize)\
out = im->image8[state->y + state->yoff] + state->xoff;\
}
int
ImagingGifDecode(Imaging im, ImagingCodecState state, UINT8* buffer, Py_ssize_t bytes)
{
UINT8* p;
UINT8* out;
int c, i;
int thiscode;
GIFDECODERSTATE *context = (GIFDECODERSTATE*) state->context;
UINT8 *ptr = buffer;
if (!state->state) {
/* Initialise state */
if (context->bits < 0 || context->bits > 12) {
state->errcode = IMAGING_CODEC_CONFIG;
return -1;
}
/* Clear code */
context->clear = 1 << context->bits;
/* End code */
context->end = context->clear + 1;
/* Interlace */
if (context->interlace) {
context->interlace = 1;
context->step = context->repeat = 8;
} else
context->step = 1;
state->state = 1;
}
out = im->image8[state->y + state->yoff] + state->xoff + state->x;
for (;;) {
if (state->state == 1) {
/* First free entry in table */
context->next = context->clear + 2;
/* Initial code size */
context->codesize = context->bits + 1;
context->codemask = (1 << context->codesize) - 1;
/* Buffer pointer. We fill the buffer from right, which
allows us to return all of it in one operation. */
context->bufferindex = GIFBUFFER;
state->state = 2;
}
if (context->bufferindex < GIFBUFFER) {
/* Return whole buffer in one chunk */
i = GIFBUFFER - context->bufferindex;
p = &context->buffer[context->bufferindex];
context->bufferindex = GIFBUFFER;
} else {
/* Get current symbol */
while (context->bitcount < context->codesize) {
if (context->blocksize > 0) {
/* Read next byte */
c = *ptr++; bytes--;
context->blocksize--;
/* New bits are shifted in from from the left. */
context->bitbuffer |= (INT32) c << context->bitcount;
context->bitcount += 8;
} else {
/* New GIF block */
/* We don't start decoding unless we have a full block */
if (bytes < 1)
return ptr - buffer;
c = *ptr;
if (bytes < c+1)
return ptr - buffer;
context->blocksize = c;
ptr++; bytes--;
}
}
/* Extract current symbol from bit buffer. */
c = (int) context->bitbuffer & context->codemask;
/* Adjust buffer */
context->bitbuffer >>= context->codesize;
context->bitcount -= context->codesize;
/* If c is less than "clear", it's a data byte. Otherwise,
it's either clear/end or a code symbol which should be
expanded. */
if (c == context->clear) {
if (state->state != 2)
state->state = 1;
continue;
}
if (c == context->end)
break;
i = 1;
p = &context->lastdata;
if (state->state == 2) {
/* First valid symbol after clear; use as is */
if (c > context->clear) {
state->errcode = IMAGING_CODEC_BROKEN;
return -1;
}
context->lastdata = context->lastcode = c;
state->state = 3;
} else {
thiscode = c;
if (c > context->next) {
state->errcode = IMAGING_CODEC_BROKEN;
return -1;
}
if (c == context->next) {
/* c == next is allowed. not sure why. */
if (context->bufferindex <= 0) {
state->errcode = IMAGING_CODEC_BROKEN;
return -1;
}
context->buffer[--context->bufferindex] =
context->lastdata;
c = context->lastcode;
}
while (c >= context->clear) {
/* Copy data string to buffer (beginning from right) */
if (context->bufferindex <= 0 || c >= GIFTABLE) {
state->errcode = IMAGING_CODEC_BROKEN;
return -1;
}
context->buffer[--context->bufferindex] =
context->data[c];
c = context->link[c];
}
context->lastdata = c;
if (context->next < GIFTABLE) {
/* We'll only add this symbol if we have room
for it (take advise, Netscape!) */
context->data[context->next] = c;
context->link[context->next] = context->lastcode;
if (context->next == context->codemask &&
context->codesize < GIFBITS) {
/* Expand code size */
context->codesize++;
context->codemask = (1 << context->codesize) - 1;
}
context->next++;
}
context->lastcode = thiscode;
}
}
/* Copy the bytes into the image */
if (state->y >= state->ysize) {
state->errcode = IMAGING_CODEC_OVERRUN;
return -1;
}
/* To squeeze some extra pixels out of this loop, we test for
some common cases and handle them separately. */
/* FIXME: should we handle the transparency index in here??? */
if (i == 1) {
if (state->x < state->xsize-1) {
/* Single pixel, not at the end of the line. */
*out++ = p[0];
state->x++;
continue;
}
} else if (state->x + i <= state->xsize) {
/* This string fits into current line. */
memcpy(out, p, i);
out += i;
state->x += i;
if (state->x == state->xsize) {
NEWLINE(state, context);
}
continue;
}
/* No shortcut, copy pixel by pixel */
for (c = 0; c < i; c++) {
*out++ = p[c];
if (++state->x >= state->xsize) {
NEWLINE(state, context);
}
}
}
return ptr - buffer;
}
|
ecfc4de7e959c9fd7280061995a49130943cd580
|
dfb59af794367d02891de53923aa3b67f7073472
|
/src/ds/ds_vector.h
|
77391c817c340ece398955475ec427cf8d1f7655
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
php-ds/ext-ds
|
b31df34b05ad14af53a0d23ba7a7a15437f4004a
|
d42750d69beb684ec3ef7b3da48fba769ce57ffc
|
refs/heads/master
| 2023-08-26T11:28:53.328205
| 2023-07-29T04:04:32
| 2023-07-29T04:04:32
| 50,824,235
| 625
| 40
|
MIT
| 2023-07-29T04:04:33
| 2016-02-01T08:05:07
|
C
|
UTF-8
|
C
| false
| false
| 3,774
|
h
|
ds_vector.h
|
#ifndef DS_VECTOR_H
#define DS_VECTOR_H
#include "../common.h"
typedef struct ds_vector {
zval *buffer;
zend_long capacity; // Buffer length
zend_long size; // Number of values in the buffer
} ds_vector_t;
#define DS_VECTOR_MIN_CAPACITY 8 // Does not have to be a power of 2
#define DS_VECTOR_SIZE(v) ((v)->size)
#define DS_VECTOR_IS_EMPTY(v) (DS_VECTOR_SIZE(v) == 0)
/**
* Foreach value
*/
#define DS_VECTOR_FOREACH(v, z) \
do { \
zval *x = v->buffer; \
zval *y = x + v->size; \
for (; x < y; ++x) { \
z = x;
/**
* Foreach value from back to front
*/
#define DS_VECTOR_FOREACH_REVERSED(v, z) \
do { \
zval *y = v->buffer; \
zval *x = y + v->size - 1; \
for (; x >= y; --x) { \
z = x;
/**
* Call this after DS_VECTOR_FOREACH*
*/
#define DS_VECTOR_FOREACH_END() \
} \
} while (0)
ds_vector_t *ds_vector_clone(ds_vector_t *src);
ds_vector_t *ds_vector();
ds_vector_t *ds_vector_ex(zend_long capacity);
ds_vector_t *ds_vector_from_buffer(zval *buffer, zend_long capacity, zend_long size);
void ds_vector_allocate(ds_vector_t *vector, zend_long capacity);
void ds_vector_clear(ds_vector_t *vector);
void ds_vector_free(ds_vector_t *vector);
void ds_vector_set(ds_vector_t *vector, zend_long index, zval *value);
void ds_vector_pop(ds_vector_t *vector, zval *return_value);
void ds_vector_pop_throw(ds_vector_t *vector, zval *return_value);
void ds_vector_shift(ds_vector_t *vector, zval *return_value);
void ds_vector_shift_throw(ds_vector_t *vector, zval *return_value);
void ds_vector_find(ds_vector_t *vector, zval *value, zval *return_value);
void ds_vector_remove(ds_vector_t *vector, zend_long index, zval *return_value);
void ds_vector_insert(ds_vector_t *vector, zend_long index, zval *value);
void ds_vector_insert_va(ds_vector_t *vector, zend_long index, VA_PARAMS);
void ds_vector_unshift(ds_vector_t *vector, zval *value);
void ds_vector_unshift_va(ds_vector_t *vector, VA_PARAMS);
bool ds_vector_contains(ds_vector_t *vector, zval *value);
bool ds_vector_contains_va(ds_vector_t *vector, VA_PARAMS);
void ds_vector_push(ds_vector_t *vector, zval *value);
void ds_vector_push_va(ds_vector_t *vector, VA_PARAMS);
void ds_vector_push_all(ds_vector_t *vector, zval *values);
zval *ds_vector_get(ds_vector_t *vector, zend_long index);
zval *ds_vector_get_last(ds_vector_t *vector);
zval *ds_vector_get_first(ds_vector_t *vector);
zval *ds_vector_get_last_throw(ds_vector_t *vector);
zval *ds_vector_get_first_throw(ds_vector_t *vector);
ds_vector_t *ds_vector_map(ds_vector_t *vector, FCI_PARAMS);
ds_vector_t *ds_vector_slice(ds_vector_t *vector, zend_long index, zend_long length);
ds_vector_t *ds_vector_filter(ds_vector_t *vector);
ds_vector_t *ds_vector_filter_callback(ds_vector_t *vector, FCI_PARAMS);
ds_vector_t *ds_vector_merge(ds_vector_t *vector, zval *values);
ds_vector_t *ds_vector_reversed(ds_vector_t *vector);
void ds_vector_reduce(ds_vector_t *vector, zval *initial, zval *return_value, FCI_PARAMS);
void ds_vector_reverse(ds_vector_t *vector);
void ds_vector_rotate(ds_vector_t *vector, zend_long rotations);
void ds_vector_join(ds_vector_t *vector, char *str, size_t len, zval *return_value);
void ds_vector_apply(ds_vector_t *vector, FCI_PARAMS);
void ds_vector_sum(ds_vector_t *vector, zval *return_value);
void ds_vector_sort(ds_vector_t *vector);
void ds_vector_sort_callback(ds_vector_t *vector);
void ds_vector_to_array(ds_vector_t *vector, zval *return_value);
bool ds_vector_index_exists(ds_vector_t *vector, zend_long index);
bool ds_vector_isset(ds_vector_t *vector, zend_long index, int check_empty);
#endif
|
06e46c335b3203174c1d3fc82cc83baeeffb6fed
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/um/os-Linux/drivers/tuntap.h
|
7367354ac8df6e548cb1b94eab806e0b8263c452
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 336
|
h
|
tuntap.h
|
/*
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#ifndef __UM_TUNTAP_H
#define __UM_TUNTAP_H
#include <net_user.h>
struct tuntap_data {
char *dev_name;
int fixed_config;
char *gate_addr;
int fd;
void *dev;
};
extern const struct net_user_info tuntap_user_info;
#endif
|
d96c2d4c44bc20bb9e201b5263d00a4a1334cd68
|
2ff8c59ae7c7ef805b1e89191a459f614e0f9c4d
|
/src/kms-message/src/kms_message/kms_kmip_request.h
|
68eac8120893000fd1d9f998b2d2cce5a3750058
|
[
"Apache-2.0"
] |
permissive
|
mongodb/mongo-c-driver
|
e02c40e01fb921a29750cf1c0205678f9c86a741
|
5c101ce5a565ffa9d160b6e44fb276b502b57157
|
refs/heads/master
| 2023-09-06T09:32:54.594891
| 2023-09-01T19:21:01
| 2023-09-01T19:21:01
| 9,735,077
| 811
| 506
|
Apache-2.0
| 2023-09-14T18:10:00
| 2013-04-28T19:34:36
|
C
|
UTF-8
|
C
| false
| false
| 2,056
|
h
|
kms_kmip_request.h
|
/*
* Copyright 2021-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef KMS_KMIP_REQUEST_H
#define KMS_KMIP_REQUEST_H
#include "kms_message_defines.h"
#include "kms_request.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define KMS_KMIP_REQUEST_SECRETDATA_LENGTH 96
/* kms_kmip_request_register_secretdata_new creates a KMIP Register request with
* a SecretData payload of length KMS_KMIP_REQUEST_SECRETDATA_LENGTH.
* - len must be KMS_KMIP_REQUEST_SECRETDATA_LENGTH.
* - Callers must check for an error by calling kms_request_get_error. */
KMS_MSG_EXPORT (kms_request_t *)
kms_kmip_request_register_secretdata_new (void *reserved,
const uint8_t *data,
size_t len);
/* kms_kmip_request_activate_new creates a KMIP Activate request with the
* provided unique identifer.
* - unique_identifier must be a NULL terminated string.
* - Callers must check for an error by calling kms_request_get_error. */
KMS_MSG_EXPORT (kms_request_t *)
kms_kmip_request_activate_new (void *reserved, const char *unique_identifier);
/* kms_kmip_request_get_new creates a KMIP Get request with the provided unique
* identifer.
* - unique_identifier must be a NULL terminated string.
* - Callers must check for an error by calling kms_request_get_error. */
KMS_MSG_EXPORT (kms_request_t *)
kms_kmip_request_get_new (void *reserved, const char *unique_identifier);
#ifdef __cplusplus
}
#endif
#endif /* KMS_KMIP_REQUEST_H */
|
d121bc596deff0ac7fa4fbba457f0c1474a41914
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/lang/mono/patches/patch-mono_utils_mono-utils-debug.c
|
715e4579a5cddf9202ff85f2936ee845acf977d7
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 1,255
|
c
|
patch-mono_utils_mono-utils-debug.c
|
$NetBSD: patch-mono_utils_mono-utils-debug.c,v 1.1 2021/03/03 12:05:41 nia Exp $
Learn to use kinfo_proc2 on netbsd
--- mono/utils/mono-utils-debug.c.orig 2020-02-04 17:00:34.000000000 +0000
+++ mono/utils/mono-utils-debug.c
@@ -32,6 +32,8 @@ mono_is_usermode_native_debugger_present
#endif
#if defined (__NetBSD__)
#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
#endif
#if defined (_AIX)
#include <procinfo.h>
@@ -74,14 +76,23 @@ mono_is_usermode_native_debugger_present
#elif defined (__NetBSD__)
- kvm_t * const kd = kvm_open (NULL, NULL, NULL, KVM_NO_FILES, "kvm_open");
- if (!kd)
+ struct kinfo_proc2 p;
+ size_t len = sizeof(p);
+ int name[] = {
+ [0] = CTL_KERN,
+ [1] = KERN_PROC2,
+ [2] = KERN_PROC_PID,
+ [3] = getpid(),
+ [4] = (int)(sizeof(struct kinfo_proc2)),
+ [5] = 1
+ };
+
+ const size_t namelen = __arraycount(name);
+
+ if (sysctl(name, namelen, &p, &len, NULL, 0) == -1)
return FALSE;
- int count = 0;
- struct kinfo_proc const * const info = kvm_getprocs (kd, KERN_PROC_PID, getpid (), &count);
- gboolean const traced = info && count > 0 && (info->kp_proc.p_slflag & PSL_TRACED);
- kvm_close (kd);
- return traced;
+
+ return (p.p_flag & P_TRACED) ? TRUE : FALSE;
#elif defined (_AIX)
|
3515d205e6adf1cfb61f41b3d42e6d544f11027e
|
29f2c40392489fc1656010f2c9b384fd0b090847
|
/play/arrays/test02-false.c
|
592fb61857794d083deae10eb1fe5f48d8d62e75
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
seahorn/seahorn
|
6498777c0d12716379035c0bc102b9baec6f28f9
|
2bab7831960766a0a16f149adcdce55f0651eb8f
|
refs/heads/main
| 2023-08-25T13:51:48.354660
| 2023-08-11T00:48:27
| 2023-08-14T16:43:13
| 31,487,486
| 423
| 126
|
NOASSERTION
| 2023-09-08T21:30:09
| 2015-03-01T05:08:17
|
C
|
UTF-8
|
C
| false
| false
| 402
|
c
|
test02-false.c
|
extern void __VERIFIER_assume (int);
extern void __VERIFIER_error (void);
__attribute__((always_inline)) void assert (int v) { if (!v) __VERIFIER_error (); }
extern int nd ();
#define N 10
int a[N];
int main ()
{
int i;
for (i=0;i<N;i++)
{
if (nd ())
a[i] = 0;
else
a[i] =5;
}
int j = nd ();
if (j >=0 && j < N)
assert (a[j] >= 0 && a[j] <= 4);
return 42;
}
|
070aa6f36dfb35b06a9f349e350d3e8e01fe4b46
|
e9b2c1f687bb9f34732d7eb2bc784a75705a371e
|
/filters/ext2/ext2.c
|
f9858ca40d157edbb485e162130994021d9a5a01
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
libguestfs/nbdkit
|
30bf70eb29843805597a6bbe5b56cc024bfedead
|
45b72f5bd8fc1b475fa130d06c86cd877bf595d5
|
refs/heads/master
| 2023-09-02T12:48:33.201066
| 2023-03-10T09:59:15
| 2023-03-10T10:08:50
| 10,839,800
| 209
| 45
|
NOASSERTION
| 2021-01-24T00:25:00
| 2013-06-21T09:43:21
|
C
|
UTF-8
|
C
| false
| false
| 14,704
|
c
|
ext2.c
|
/* nbdkit
* Copyright Red Hat
*
* 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 Red Hat 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 RED HAT 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 RED HAT 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 <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
/* Inlining is broken in the ext2fs header file. Disable it by
* defining the following:
*/
#define NO_INLINE_FUNCS
#include <ext2fs.h>
#define NBDKIT_API_VERSION 2
#include <nbdkit-filter.h>
#include "cleanup.h"
#include "io.h"
/* Filename parameter, or NULL to honor export name. Using the export
* name is opt-in (see ext2_config_complete).
*/
static const char *file;
static void
ext2_load (void)
{
initialize_ext2_error_table ();
}
static int
ext2_config (nbdkit_next_config *next, nbdkit_backend *nxdata,
const char *key, const char *value)
{
if (strcmp (key, "ext2file") == 0) {
if (file != NULL) {
nbdkit_error ("ext2file parameter specified more than once");
return -1;
}
file = value;
return 0;
}
else
return next (nxdata, key, value);
}
static int
ext2_config_complete (nbdkit_next_config_complete *next, nbdkit_backend *nxdata)
{
if (file == NULL) {
nbdkit_error ("you must supply ext2file=<FILE> parameter "
"after the plugin name on the command line");
return -1;
}
if (strcmp (file, "exportname") == 0)
file = NULL;
else if (file[0] != '/') {
nbdkit_error ("the file parameter must refer to an absolute path");
return -1;
}
return next (nxdata);
}
#define ext2_config_help \
"ext2file=<FILENAME> (required) Absolute name of file to serve inside the\n" \
" disk image, or 'exportname' for client choice."
/* The per-connection handle. */
struct handle {
const char *exportname; /* Client export name. */
ext2_filsys fs; /* Filesystem handle. */
ext2_ino_t ino; /* Inode of open file. */
ext2_file_t file; /* File handle. */
nbdkit_next *next; /* "name" parameter to ext2fs_open. */
};
/* Export list. */
static int
ext2_list_exports (nbdkit_next_list_exports *next, nbdkit_backend *nxdata,
int readonly, int is_tls, struct nbdkit_exports *exports)
{
/* If we are honoring export names, the default export "" won't
* work, and we must not leak export names from the underlying
* plugin. Advertising all filenames within the ext2 image could be
* huge, and even if we wanted to, it would require that we could
* open the plugin prior to the client reaching our .open. So leave
* the list empty instead.
*/
if (!file)
return 0;
/* If we are serving a specific ext2file, we don't care what export
* name the user passes, but the underlying plugin might; there's no
* harm in advertising that list.
*/
return next (nxdata, readonly, exports);
}
/* Default export. */
static const char *
ext2_default_export (nbdkit_next_default_export *next, nbdkit_backend *nxdata,
int readonly, int is_tls)
{
/* If we are honoring exports, "" will fail (even if we resolve to
* the inode of embedded "/", we can't serve directories), and we
* don't really have a sane default. XXX picking the largest
* embedded file might be in interesting knob to add.
*/
if (!file)
return NULL;
/* Otherwise, we don't care about export name, so keeping things at
* "" is fine, regardless of the underlying plugin's default.
*/
return "";
}
/* Create the per-connection handle. */
static void *
ext2_open (nbdkit_next_open *next, nbdkit_context *nxdata,
int readonly, const char *exportname, int is_tls)
{
struct handle *h;
h = calloc (1, sizeof *h);
if (h == NULL) {
nbdkit_error ("calloc: %m");
return NULL;
}
/* Save the client exportname in the handle. */
h->exportname = nbdkit_strdup_intern (exportname);
if (h->exportname == NULL) {
free (h);
return NULL;
}
/* If file == NULL (ie. using exportname) then don't
* pass the client exportname to the lower layers.
*/
exportname = file ? exportname : "";
/* Request write access to the underlying plugin, for journal replay. */
if (next (nxdata, 0, exportname) == -1) {
free (h);
return NULL;
}
return h;
}
static int
ext2_prepare (nbdkit_next *next, void *handle, int readonly)
{
struct handle *h = handle;
errcode_t err;
int fs_flags;
int file_flags;
struct ext2_inode inode;
int64_t r;
CLEANUP_FREE char *name = NULL;
const char *fname = file ?: h->exportname;
CLEANUP_FREE char *absname = NULL;
fs_flags = 0;
#ifdef EXT2_FLAG_64BITS
fs_flags |= EXT2_FLAG_64BITS;
#endif
r = next->get_size (next);
if (r == -1)
return -1;
r = next->can_write (next);
if (r == -1)
return -1;
if (r == 0)
readonly = 1;
if (!readonly)
fs_flags |= EXT2_FLAG_RW;
h->next = next;
name = nbdkit_io_encode (next);
if (!name) {
nbdkit_error ("nbdkit_io_encode: %m");
return -1;
}
if (fname[0] != '/') {
if (asprintf (&absname, "/%s", fname) < 0) {
nbdkit_error ("asprintf: %m");
return -1;
}
fname = absname;
}
err = ext2fs_open (name, fs_flags, 0, 0, nbdkit_io_manager, &h->fs);
if (err != 0) {
nbdkit_error ("open: %s", error_message (err));
goto err0;
}
if (strcmp (fname, "/") == 0)
/* probably gonna fail, but we'll catch it later */
h->ino = EXT2_ROOT_INO;
else {
err = ext2fs_namei (h->fs, EXT2_ROOT_INO, EXT2_ROOT_INO,
&fname[1], &h->ino);
if (err != 0) {
nbdkit_error ("%s: namei: %s", fname, error_message (err));
goto err1;
}
}
/* Check that fname is a regular file.
* XXX This won't follow symlinks, we'd have to do that manually.
*/
err = ext2fs_read_inode (h->fs, h->ino, &inode);
if (err != 0) {
nbdkit_error ("%s: inode: %s", fname, error_message (err));
goto err1;
}
if (!LINUX_S_ISREG (inode.i_mode)) {
nbdkit_error ("%s: must be a regular file in the disk image", fname);
goto err1;
}
file_flags = 0;
if (!readonly)
file_flags |= EXT2_FILE_WRITE;
err = ext2fs_file_open2 (h->fs, h->ino, NULL, file_flags, &h->file);
if (err != 0) {
nbdkit_error ("%s: open: %s", fname, error_message (err));
goto err1;
}
return 0;
err1:
ext2fs_close (h->fs);
h->fs = NULL;
err0:
return -1;
}
/* Free up the per-connection handle. */
static void
ext2_close (void *handle)
{
struct handle *h = handle;
if (h->fs) {
ext2fs_file_close (h->file);
ext2fs_close (h->fs);
}
free (h);
}
static int
ext2_can_fua (nbdkit_next *next, void *handle)
{
return NBDKIT_FUA_NATIVE;
}
static int
ext2_can_cache (nbdkit_next *next, void *handle)
{
/* Let nbdkit call pread to populate the file system cache. */
return NBDKIT_CACHE_EMULATE;
}
static int
ext2_can_multi_conn (nbdkit_next *next, void *handle)
{
/* Since we do not permit parallel connections, it does not matter
* what we advertise here, and we could just as easily inherit the
* plugin's .can_multi_conn. But realistically, if we adjust
* .thread_model, we cannot advertise support unless .flush is
* consistent, and that would require inspecting the ext2 source
* code, so for now, we hard-code a safe answer.
*/
return 0;
}
static int
ext2_can_flush (nbdkit_next *next, void *handle)
{
/* Regardless of the underlying plugin, we handle flush at the level
* of the filesystem. However, we also need to cache the underlying
* plugin ability, since ext2 wants to flush the filesystem into
* permanent storage when possible.
*/
if (next->can_flush (next) == -1)
return -1;
return 1;
}
/* XXX It seems as if we should be able to support trim and zero, if
* the ext2fs API were to ever add something like ext2fs_file_fallocate.
*/
static int
ext2_can_zero (nbdkit_next *next, void *handle)
{
/* For now, tell nbdkit to call .pwrite instead of any optimization.
* However, we also want to cache the underlying plugin support - even
* though we don't implement .zero, the file system wants to know if
* it can use next->zero() during io_zeroout.
*/
if (next->can_zero (next) == -1)
return -1;
return NBDKIT_ZERO_EMULATE;
}
static int
ext2_can_trim (nbdkit_next *next, void *handle)
{
/* For now, tell nbdkit to never call .trim. However, we also want
* to cache the underlying plugin support - even though we don't
* implement .trim, the file system wants to know if it can use
* next->trim() during io_discard.
*/
if (next->can_trim (next) == -1)
return -1;
return 0;
}
/* It might be possible to relax this, but it's complicated.
*
* It's desirable for ‘nbdkit -r’ to behave the same way as
* ‘mount -o ro’. But we don't know the state of the readonly flag
* until ext2_open is called (because the NBD client can also request
* a readonly connection). So we could not set the "ro" flag if we
* opened the filesystem any earlier (eg in ext2_config).
*
* So out of necessity we have one ext2_filsys handle per connection,
* but if we allowed parallel work on those handles then we would get
* data corruption, so we need to serialize connections.
*/
static int ext2_thread_model (void)
{
return NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS;
}
/* Description. */
static const char *
ext2_export_description (nbdkit_next *next, void *handle)
{
struct handle *h = handle;
const char *fname = file ?: h->exportname;
const char *slash = fname[0] == '/' ? "" : "/";
const char *base = next->export_description (next);
if (!base)
return NULL;
return nbdkit_printf_intern ("embedded '%s%s' from within ext2 image: %s",
slash, fname, base);
}
/* Get the disk size. */
static int64_t
ext2_get_size (nbdkit_next *next, void *handle)
{
struct handle *h = handle;
errcode_t err;
uint64_t size;
err = ext2fs_file_get_lsize (h->file, (__u64 *) &size);
if (err != 0) {
nbdkit_error ("%s: lsize: %s", file, error_message (err));
return -1;
}
return (int64_t) size;
}
/* Read data. */
static int
ext2_pread (nbdkit_next *next,
void *handle, void *buf, uint32_t count, uint64_t offset,
uint32_t flags, int *errp)
{
struct handle *h = handle;
errcode_t err;
unsigned int got;
while (count > 0) {
/* Although this function weirdly can return the new offset,
* examination of the code shows that it never returns anything
* different from what we set, so NULL out that parameter.
*/
err = ext2fs_file_llseek (h->file, offset, EXT2_SEEK_SET, NULL);
if (err != 0) {
nbdkit_error ("%s: llseek: %s", file, error_message (err));
*errp = errno;
return -1;
}
err = ext2fs_file_read (h->file, buf, (unsigned int) count, &got);
if (err != 0) {
nbdkit_error ("%s: read: %s", file, error_message (err));
*errp = errno;
return -1;
}
buf += got;
count -= got;
offset += got;
}
return 0;
}
/* Write data to the file. */
static int
ext2_pwrite (nbdkit_next *next,
void *handle, const void *buf, uint32_t count, uint64_t offset,
uint32_t flags, int *errp)
{
struct handle *h = handle;
errcode_t err;
unsigned int written;
while (count > 0) {
err = ext2fs_file_llseek (h->file, offset, EXT2_SEEK_SET, NULL);
if (err != 0) {
nbdkit_error ("%s: llseek: %s", file, error_message (err));
*errp = errno;
return -1;
}
err = ext2fs_file_write (h->file, buf, (unsigned int) count, &written);
if (err != 0) {
nbdkit_error ("%s: write: %s", file, error_message (err));
*errp = errno;
return -1;
}
buf += written;
count -= written;
offset += written;
}
if ((flags & NBDKIT_FLAG_FUA) != 0) {
err = ext2fs_file_flush (h->file);
if (err != 0) {
nbdkit_error ("%s: flush: %s", file, error_message (err));
*errp = errno;
return -1;
}
}
return 0;
}
static int
ext2_flush (nbdkit_next *next,
void *handle, uint32_t flags, int *errp)
{
struct handle *h = handle;
errcode_t err;
err = ext2fs_file_flush (h->file);
if (err != 0) {
nbdkit_error ("%s: flush: %s", file, error_message (err));
*errp = errno;
return -1;
}
return 0;
}
static struct nbdkit_filter filter = {
.name = "ext2",
.longname = "nbdkit ext2 filter",
.load = ext2_load,
.config = ext2_config,
.config_complete = ext2_config_complete,
.config_help = ext2_config_help,
.thread_model = ext2_thread_model,
.list_exports = ext2_list_exports,
.default_export = ext2_default_export,
.open = ext2_open,
.prepare = ext2_prepare,
.close = ext2_close,
.can_fua = ext2_can_fua,
.can_cache = ext2_can_cache,
.can_multi_conn = ext2_can_multi_conn,
.can_zero = ext2_can_zero,
.can_trim = ext2_can_trim,
.can_flush = ext2_can_flush,
.export_description = ext2_export_description,
.get_size = ext2_get_size,
.pread = ext2_pread,
.pwrite = ext2_pwrite,
.flush = ext2_flush,
};
NBDKIT_REGISTER_FILTER (filter)
|
17b395f56c7922a60e5ac8bac446ca64b759dcc9
|
409d14156eb919757bf1c6ae8c94827520e98667
|
/KEY/key.h
|
6da43ed8445327f69881faf707619d8cb75499a6
|
[
"BSD-3-Clause"
] |
permissive
|
Mculover666/HAL_Driver_Lib
|
8fa69e7590802290b1ef8b33dee6585d1c8a51e0
|
2c09811e01fed3ec64c85be50a5565f55fee995d
|
refs/heads/master
| 2023-04-12T03:27:19.326842
| 2023-04-08T14:30:03
| 2023-04-08T14:30:03
| 196,137,750
| 189
| 78
|
BSD-3-Clause
| 2022-06-26T10:39:17
| 2019-07-10T05:33:30
|
C
|
UTF-8
|
C
| false
| false
| 542
|
h
|
key.h
|
/**
* @Copyright (c) 2019,mculover666 All rights reserved
* @filename key.h
* @breif independent KEY driver file
* @version
* v1.0 mculover666 2019/7/15
*/
#ifndef _KEY_H_
#define _KEY_H_
#include "stm32l4xx_hal.h"
#define KEY1_CLK() __HAL_RCC_GPIOB_CLK_ENABLE();
#define KEY1_Pin GPIO_PIN_2
#define KEY1_GPIO_Port GPIOB
#define KEY2_CLK() __HAL_RCC_GPIOB_CLK_ENABLE();
#define KEY2_Pin GPIO_PIN_3
#define KEY2_GPIO_Port GPIOB
void KEY_GPIO_Init(void);
#endif /* _KEY_H_ */
|
4f2113ab296b1ff68ad2610f8a32370ee4e3625f
|
bed3ac926beac0f4e0293303d7b2a6031ee476c9
|
/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/double/dlaset.h
|
fa98bf7fe9e25a152fb62a22530ff912a741d86a
|
[
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-hdf5",
"MIT",
"NTP",
"LicenseRef-scancode-mit-old-style",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
InsightSoftwareConsortium/ITK
|
ed9dbbc5b8b3f7511f007c0fc0eebb3ad37b88eb
|
3eb8fd7cdfbc5ac2d0c2e5e776848a4cbab3d7e1
|
refs/heads/master
| 2023-08-31T17:21:47.754304
| 2023-08-31T00:58:51
| 2023-08-31T14:12:21
| 800,928
| 1,229
| 656
|
Apache-2.0
| 2023-09-14T17:54:00
| 2010-07-27T15:48:04
|
C++
|
UTF-8
|
C
| false
| false
| 247
|
h
|
dlaset.h
|
extern int v3p_netlib_dlaset_(
char *uplo,
v3p_netlib_integer *m,
v3p_netlib_integer *n,
v3p_netlib_doublereal *alpha,
v3p_netlib_doublereal *beta,
v3p_netlib_doublereal *a,
v3p_netlib_integer *lda,
v3p_netlib_ftnlen uplo_len
);
|
5c73a9eccd83c77152c9e8fc43376378b28b807d
|
624e2fe126418d2135dec26551c1cb52f13f4e4e
|
/Exec/UnitTests/prob.H
|
e6816667f79f8c93b690984f074b5e3803b7ca6d
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] |
permissive
|
AMReX-Combustion/PeleC
|
51dee424ab0037fca793ae97afe3f7848643fadc
|
bae27e635f1bebedd30221dc58e757be62aef683
|
refs/heads/development
| 2023-08-28T02:49:24.556463
| 2023-08-23T22:01:59
| 2023-08-23T22:01:59
| 153,825,534
| 128
| 72
|
NOASSERTION
| 2023-09-12T01:51:21
| 2018-10-19T18:28:51
|
C++
|
UTF-8
|
C
| false
| false
| 2,338
|
h
|
prob.H
|
#ifndef PROB_H
#define PROB_H
#include "ProblemDerive.H"
AMREX_GPU_DEVICE
AMREX_FORCE_INLINE
void
pc_initdata(
int /*i*/,
int /*j*/,
int /*k*/,
amrex::Array4<amrex::Real> const& /*state*/,
amrex::GeometryData const& /*geomdata*/,
ProbParmDevice const& /*prob_parm*/)
{
// Could init some data here
}
AMREX_GPU_DEVICE
AMREX_FORCE_INLINE
void
bcnormal(
const amrex::Real* /*x[AMREX_SPACEDIM]*/,
const amrex::Real* /*s_int[NVAR]*/,
amrex::Real* /*s_ext[NVAR]*/,
const int /*idir*/,
const int /*sgn*/,
const amrex::Real /*time*/,
amrex::GeometryData const& /*geomdata*/,
ProbParmDevice const& /*prob_parm*/,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM>& /*turb_fluc*/)
{
}
struct MyProbTagStruct
{
AMREX_GPU_DEVICE
AMREX_FORCE_INLINE
static void set_problem_tags(
const int /*i*/,
const int /*j*/,
const int /*k*/,
amrex::Array4<amrex::EBCellFlag const> const& /*flags*/,
amrex::Array4<char> const& /*tag*/,
amrex::Array4<amrex::Real const> const& /*field*/,
char /*tagval*/,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> /*dx*/,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> /*prob_lo*/,
const amrex::Real /*time*/,
const int /*level*/,
ProbParmDevice const& /*d_prob_parm_device*/) noexcept
{
// could do problem specific tagging here
}
};
using ProblemTags = MyProbTagStruct;
struct MyProbDeriveStruct
{
static void
add(amrex::DeriveList& /*derive_lst*/, amrex::DescriptorList& /*desc_lst*/)
{
// Add derives as follows and define the derive function below:
// derive_lst.add(
// "varname", amrex::IndexType::TheCellType(), 1, pc_varname,
// the_same_box);
// derive_lst.addComponent("varname", desc_lst, State_Type, 0, NVAR);
}
static void pc_varname(
const amrex::Box& /*bx*/,
amrex::FArrayBox& /*derfab*/,
int /*dcomp*/,
int /*ncomp*/,
const amrex::FArrayBox& /*datfab*/,
const amrex::Geometry& /*geomdata*/,
amrex::Real /*time*/,
const int* /*bcrec*/,
int /*level*/)
{
// auto const dat = datfab.array();
// auto arr = derfab.array();
// amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept
// { do something with arr
// });
}
};
void pc_prob_close();
using ProblemDerives = MyProbDeriveStruct;
#endif
|
2a24e99518b9efa5ba22dc4de7e4104d138aafbf
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/allwinner/libraries/sunxi-hal/hal/source/disp2/disp/de/lowlevel_v2x/de_vep_table.c
|
ff1f49bc0d8eccf57dce54a67442179f046cb7c3
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"GPL-2.0-only"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 10,277
|
c
|
de_vep_table.c
|
/*
* Allwinner SoCs display driver.
*
* Copyright (C) 2016 Allwinner.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
/*******************************************************************************
* All Winner Tech, All Right Reserved. 2014-2015 Copyright (c)
*
* File name : de_vep_table.c
*
* Description : display engine 2.0 video enhancement processor
* common fir table coefficients
*
* History : 2014/03/28 iptang v0.1 Initial version
*
******************************************************************************/
#include "de_vep_table.h"
int y2r[192] = {
/* bt601 */
0x000012A0, 0x0, 0x00000000, 0x0, 0x00001989, 0x0, 0xFFF21168,
0xFFFFFFFF, 0x000012A0, 0x0, 0xFFFFF9BE, 0xFFFFFFFF, 0xFFFFF2FE,
0xFFFFFFFF, 0x000877CF, 0x0,
0x000012A0, 0x0, 0x0000204A, 0x0, 0x00000000, 0x0, 0xFFEEB127,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* bt709 */
0x000012A0, 0x0, 0x00000000, 0x0, 0x00001CB0, 0x0, 0xFFF07DF4,
0xFFFFFFFF, 0x000012A0, 0x0, 0xfffffC98, 0xFFFFFFFF, 0xfffff775,
0xFFFFFFFF, 0x0004CFDF, 0x0,
0x000012A0, 0x0, 0x000021D7, 0x0, 0x00000000, 0x0, 0xFFEDEA7F,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* ycc */
0x00001000, 0x0, 0x00000000, 0x0, 0x0000166F, 0x0, 0xFFF4C84B,
0xFFFFFFFF, 0x00001000, 0x0, 0xFFFFFA78, 0xFFFFFFFF, 0xFFFFF491,
0xFFFFFFFF, 0x00087B16, 0x0,
0x00001000, 0x0, 0x00001C56, 0x0, 0x00000000, 0x0, 0xFFF1D4FE,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* ehance */
0x00001000, 0x0, 0x00000000, 0x0, 0x00001933, 0x0, 0xFFF36666,
0xFFFFFFFF, 0x00001000, 0x0, 0xFFFFFD02, 0xFFFFFFFF, 0xFFFFF883,
0xFFFFFFFF, 0x00053D71, 0x0,
0x00001000, 0x0, 0x00001DB2, 0x0, 0x00000000, 0x0, 0xFFF126E9,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* bt601 studio */
0x00001000, 0x0, 0x00000000, 0x0, 0x000015F0, 0x0, 0xFFF50831,
0xFFFFFFFF, 0x00001000, 0x0, 0xFFFFFAA0, 0xFFFFFFFF, 0xFFFFF4FA,
0xFFFFFFFF, 0x00083333, 0x0,
0x00001000, 0x0, 0x00001BB6, 0x0, 0x00000000, 0x0, 0xFFF224DD,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* bt709 studio */
0x00001000, 0x0, 0x00000000, 0x0, 0x000018A4, 0x0, 0xFFF3AE14,
0xFFFFFFFF, 0x00001000, 0x0, 0xFFFFFD12, 0xFFFFFFFF, 0xFFFFF8A8,
0xFFFFFFFF, 0x000522D1, 0x0,
0x00001000, 0x0, 0x00001D0E, 0x0, 0x00000000, 0x0, 0xFFF178D5,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
};
int r2y[128] = {
/* bt601 */
0x0000041D, 0x0, 0x00000810, 0x0, 0x00000191, 0x0, 0x00010000, 0x0,
0xFFFFFDA2, 0xFFFFFFFF, 0xFFFFFB58, 0xFFFFFFFF, 0x00000706, 0x0,
0x00080000, 0x0,
0x00000706, 0x0, 0xFFFFFA1D, 0xFFFFFFFF, 0xFFFFFEDD, 0xFFFFFFFF,
0x00080000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* bt709 */
0x000002EE, 0x0, 0x000009D3, 0x0, 0x000000FE, 0x0, 0x00010000, 0x0,
0xfffffe62, 0xFFFFFFFF, 0xfffffA98, 0xFFFFFFFF, 0x00000706, 0x0,
0x00080000, 0x0,
0x00000706, 0x0, 0xfffff99E, 0xFFFFFFFF, 0xffffff5C, 0xFFFFFFFF,
0x00080000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* ycc */
0x000004C8, 0x0, 0x00000963, 0x0, 0x000001D5, 0x0, 0x00000000, 0x0,
0xFFFFFD4D, 0xFFFFFFFF, 0xFFFFFAB3, 0xFFFFFFFF, 0x00000800, 0x0,
0x00080000, 0x0,
0x00000800, 0x0, 0xFFFFF94F, 0xFFFFFFFF, 0xFFFFFEB2, 0xFFFFFFFF,
0x00080000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* ehance */
0x00000368, 0x0, 0x00000B71, 0x0, 0x00000127, 0x0, 0x00000000, 0x0,
0xFFFFFE29, 0xFFFFFFFF, 0xFFFFF9D7, 0xFFFFFFFF, 0x00000800, 0x0,
0x00080000, 0x0,
0x00000800, 0x0, 0xFFFFF8BC, 0xFFFFFFFF, 0xFFFFFF44, 0xFFFFFFFF,
0x00080000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
};
int y2y[64] = {
/* bt601 to bt709 */
0x00001000, 0x0, 0xFFFFFE27, 0xFFFFFFFF, 0xFFFFFCAC, 0xFFFFFFFF,
0x00029681, 0x0, 0x00000000, 0x0, 0x0000104C, 0x0, 0x000001D5, 0x0,
0xFFFEEF17, 0xFFFFFFFF,
0x00000000, 0x0, 0x00000133, 0x0, 0x00001068, 0x0, 0xFFFF326E,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0,
0x00001000, 0x0,
/* bt709 to bt601 */
0x00001000, 0x0, 0x00000197, 0x0, 0x00000311, 0x0, 0xFFFDAC02,
0xFFFFFFFF, 0x00000000, 0x0, 0x00000FD6, 0x0, 0xFFFFFE3B,
0xFFFFFFFF, 0x0000F765, 0x0,
0x00000000, 0x0, 0xFFFFFED7, 0xFFFFFFFF, 0x00000FBC, 0x0, 0x0000B663,
0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00001000,
0x0,
};
int r2r[32] = {
/* 0-255 to 16-235 */
0x00000DC0, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00010000, 0x0,
0x00000000, 0x0, 0x00000DC0, 0x0, 0x00000000, 0x0, 0x00010000, 0x0,
0x00000000, 0x0, 0x00000000, 0x0, 0x00000DC0, 0x0, 0x00010000, 0x0,
0x00000000, 0x0, 0x00000000, 0x0, 0x00000000, 0x0, 0x00001000, 0x0,
};
int bypass_csc[12] = {
0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000400,
0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000400, 0x00000000,
};
unsigned int sin_cos[128] = {
/* sin table */
0xffffffbd, 0xffffffbf, 0xffffffc1, 0xffffffc2, 0xffffffc4, 0xffffffc6,
0xffffffc8, 0xffffffca,
0xffffffcc, 0xffffffce, 0xffffffd1, 0xffffffd3, 0xffffffd5, 0xffffffd7,
0xffffffd9, 0xffffffdb,
0xffffffdd, 0xffffffdf, 0xffffffe2, 0xffffffe4, 0xffffffe6, 0xffffffe8,
0xffffffea, 0xffffffec,
0xffffffef, 0xfffffff1, 0xfffffff3, 0xfffffff5, 0xfffffff8, 0xfffffffa,
0xfffffffc, 0xfffffffe,
0x00000000, 0x00000002, 0x00000004, 0x00000006, 0x00000008, 0x0000000b,
0x0000000d, 0x0000000f,
0x00000011, 0x00000014, 0x00000016, 0x00000018, 0x0000001a, 0x0000001c,
0x0000001e, 0x00000021,
0x00000023, 0x00000025, 0x00000027, 0x00000029, 0x0000002b, 0x0000002d,
0x0000002f, 0x00000032,
0x00000034, 0x00000036, 0x00000038, 0x0000003a, 0x0000003c, 0x0000003e,
0x0000003f, 0x00000041,
/* cos table */
0x0000006c, 0x0000006d, 0x0000006e, 0x0000006f, 0x00000071, 0x00000072,
0x00000073, 0x00000074,
0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079,
0x00000079, 0x0000007a,
0x0000007b, 0x0000007b, 0x0000007c, 0x0000007c, 0x0000007d, 0x0000007d,
0x0000007e, 0x0000007e,
0x0000007e, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f,
0x0000007f, 0x0000007f,
0x00000080, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f,
0x0000007f, 0x0000007f,
0x0000007e, 0x0000007e, 0x0000007e, 0x0000007d, 0x0000007d, 0x0000007c,
0x0000007c, 0x0000007b,
0x0000007b, 0x0000007a, 0x00000079, 0x00000079, 0x00000078, 0x00000077,
0x00000076, 0x00000075,
0x00000074, 0x00000074, 0x00000073, 0x00000072, 0x00000071, 0x0000006f,
0x0000006e, 0x0000006d
};
int fcc_range_gain[6] = {
0x01550eaa, 0x070503f3, 0x0bdd084f, 0x0a000705,
0x0eaa0bdd, 0x03330155
};
unsigned char ce_bypass_lut[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
190, 191,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
254, 255
};
unsigned char ce_constant_lut[256] = {
0, 1, 1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11,
12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 25, 26, 27, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127,
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
190, 191,
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
222, 223,
225, 226, 228, 229, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244,
246, 247,
248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254,
255, 255,
};
|
adad946d1ba964601f6870190b8a380ebff99e26
|
bcb62f36caa6ab1f92715cffae29cf4353d247e8
|
/src/os/__osAtomicDec.c
|
87ff265ebb993045b1b04d20e8f2e46b32ef0f1d
|
[] |
no_license
|
n64decomp/mk64
|
4b74ffb8c896e739b908534b74bc1cb79a21ae60
|
c4c00f159845fddd1eced906c14cc25a0cb7a10b
|
refs/heads/master
| 2023-09-01T02:48:30.111868
| 2023-09-01T02:28:49
| 2023-09-01T02:28:49
| 304,205,548
| 476
| 88
| null | 2023-09-14T04:36:28
| 2020-10-15T04:01:57
|
C
|
UTF-8
|
C
| false
| false
| 257
|
c
|
__osAtomicDec.c
|
#include "libultra_internal.h"
s32 __osAtomicDec(u32 *a0) {
s32 sp1c;
s32 sp18;
sp1c = __osDisableInt();
if (*a0 != 0) {
(*a0)--;
sp18 = 1;
} else {
sp18 = 0;
}
__osRestoreInt(sp1c);
return sp18;
}
|
734845378568812152042b3f7925ae36c464fc56
|
d7121e03910c4b3aaf4ed470c33c5dab67ffa962
|
/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTTypesetter.h
|
b1196c596433563c108bc94174881a836e874621
|
[
"MIT"
] |
permissive
|
theos/sdks
|
129eda2d399c209aa36fcc2e266e960ac6c91cf6
|
bb425abf3acae8eac328b828628b82df544d2774
|
refs/heads/master
| 2023-08-28T13:01:04.995109
| 2022-12-24T01:06:07
| 2022-12-24T01:06:07
| 66,124,251
| 517
| 199
|
NOASSERTION
| 2022-12-24T01:06:08
| 2016-08-20T02:36:04
|
C
|
UTF-8
|
C
| false
| false
| 8,056
|
h
|
CTTypesetter.h
|
/*
* CTTypesetter.h
* CoreText
*
* Copyright (c) 2003-2015 Apple Inc. All rights reserved.
*
*/
/*!
@header
Thread Safety Information
All functions in this header are thread safe unless otherwise specified.
*/
#ifndef __CTTYPESETTER__
#define __CTTYPESETTER__
#include <CoreText/CTDefines.h>
#include <CoreText/CTLine.h>
CF_IMPLICIT_BRIDGING_ENABLED
CF_EXTERN_C_BEGIN
CF_ASSUME_NONNULL_BEGIN
/* --------------------------------------------------------------------------- */
/* Typesetter Types */
/* --------------------------------------------------------------------------- */
typedef const struct CF_BRIDGED_TYPE(id) __CTTypesetter * CTTypesetterRef;
/*!
@function CTTypesetterGetTypeID
@abstract Returns the CFType of the typesetter object
*/
CFTypeID CTTypesetterGetTypeID( void ) CT_AVAILABLE(10_5, 3_2);
/* --------------------------------------------------------------------------- */
/* Typesetter Values */
/* --------------------------------------------------------------------------- */
/*!
@const kCTTypesetterOptionDisableBidiProcessing
@abstract Disables bidi processing.
@discussion Value must be a CFBooleanRef. Default is false.
Normally, typesetting applies the Unicode Bidirectional
Algorithm as described in UAX #9. If a typesetter is created
with this option set to true, no directional reordering is
performed and any directional control characters are ignored.
*/
extern const CFStringRef kCTTypesetterOptionDisableBidiProcessing CT_DEPRECATED(10_5, 10_8, 3_2, 6_0);
/*!
@const kCTTypesetterOptionForcedEmbeddingLevel
@abstract Specifies the embedding level.
@discussion Value must be a CFNumberRef. Default is unset. Normally,
typesetting applies the Unicode Bidirectional Algorithm as
described in UAX #9. If present, this specifies the embedding
level and any directional control characters are ignored.
*/
extern const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel CT_AVAILABLE(10_5, 3_2);
/* --------------------------------------------------------------------------- */
/* Typesetter Creation */
/* --------------------------------------------------------------------------- */
/*!
@function CTTypesetterCreateWithAttributedString
@abstract Creates an immutable typesetter object using an attributed
string.
@discussion The resultant typesetter can be used to create lines, perform
line breaking, and do other contextual analysis based on the
characters in the string.
@param string
The CFAttributedStringRef that you want to typeset. This
parameter must be filled in with a valid CFAttributedString.
@result This function will return a reference to a CTTypesetter.
*/
CTTypesetterRef CTTypesetterCreateWithAttributedString(
CFAttributedStringRef string ) CT_AVAILABLE(10_5, 3_2);
/*!
@function CTTypesetterCreateWithAttributedStringAndOptions
@abstract Creates an immutable typesetter object using an attributed
string and a dictionary of options.
@discussion The resultant typesetter can be used to create lines, perform
line breaking, and do other contextual analysis based on the
characters in the string.
@param string
The CFAttributedStringRef that you want to typeset. This
parameter must be filled in with a valid CFAttributedString.
@param options
A CFDictionary of typesetter options, or NULL if there are none.
@result This function will return a reference to a CTTypesetter.
*/
CTTypesetterRef CTTypesetterCreateWithAttributedStringAndOptions(
CFAttributedStringRef string,
CFDictionaryRef __nullable options ) CT_AVAILABLE(10_5, 3_2);
/* --------------------------------------------------------------------------- */
/* Typeset Line Creation */
/* --------------------------------------------------------------------------- */
/*!
@function CTTypesetterCreateLineWithOffset
@abstract Creates an immutable line from the typesetter.
@discussion The resultant line will consist of glyphs in the correct visual
order, ready to draw.
@param typesetter
The typesetter which the line will come from.
@param stringRange
The string range which the line will be based on. If the length
portion of range is set to 0, then the typesetter will continue
to add glyphs to the line until it runs out of characters in the
string. The location and length of the range must be within the
bounds of the string, otherwise the call will fail.
@param offset
The line position offset.
@result This function will return a reference to a CTLine.
*/
CTLineRef CTTypesetterCreateLineWithOffset(
CTTypesetterRef typesetter,
CFRange stringRange,
double offset ) CT_AVAILABLE(10_6, 3_2);
/*!
@function CTTypesetterCreateLine
@abstract Equivalent to CTTypesetterCreateLineWithOffset with offset = 0.0.
*/
CTLineRef CTTypesetterCreateLine(
CTTypesetterRef typesetter,
CFRange stringRange ) CT_AVAILABLE(10_5, 3_2);
/* --------------------------------------------------------------------------- */
/* Typeset Line Breaking */
/* --------------------------------------------------------------------------- */
/*!
@function CTTypesetterSuggestLineBreakWithOffset
@abstract Suggests a contextual line break point based on the width
provided.
@discussion The line break can be triggered either by a hard break character
in the stream or by filling the specified width with characters.
@param typesetter
The typesetter which the line will come from.
@param startIndex
The starting point for the line break calculations. The break
calculations will include the character starting at startIndex.
@param width
The requested line break width.
@param offset
The line position offset.
@result The value returned is a count of the characters from startIndex
that would cause the line break. This value returned can be used
to construct a character range for CTTypesetterCreateLine.
*/
CFIndex CTTypesetterSuggestLineBreakWithOffset(
CTTypesetterRef typesetter,
CFIndex startIndex,
double width,
double offset ) CT_AVAILABLE(10_6, 3_2);
/*!
@function CTTypesetterSuggestLineBreak
@abstract Equivalent to CTTypesetterSuggestLineBreakWithOffset with offset = 0.0.
*/
CFIndex CTTypesetterSuggestLineBreak(
CTTypesetterRef typesetter,
CFIndex startIndex,
double width ) CT_AVAILABLE(10_5, 3_2);
/*!
@function CTTypesetterSuggestClusterBreakWithOffset
@abstract Suggests a cluster line break point based on the width provided.
@discussion Suggests a typographic cluster line break point based on the width
provided. This cluster break is similar to a character break,
except that it will not break apart linguistic clusters. No other
contextual analysis will be done. This can be used by the caller
to implement a different line breaking scheme, such as
hyphenation. Note that a typographic cluster break can also be
triggered by a hard break character in the stream.
@param typesetter
The typesetter which the line will come from.
@param startIndex
The starting point for the typographic cluster break
calculations. The break calculations will include the character
starting at startIndex.
@param width
The requested typographic cluster break width.
@param offset
The line position offset.
@result The value returned is a count of the characters from startIndex
that would cause the cluster break. This value returned can be
used to construct a character range for CTTypesetterCreateLine.
*/
CFIndex CTTypesetterSuggestClusterBreakWithOffset(
CTTypesetterRef typesetter,
CFIndex startIndex,
double width,
double offset ) CT_AVAILABLE(10_6, 3_2);
/*!
@function CTTypesetterSuggestClusterBreak
@abstract Equivalent to CTTypesetterSuggestClusterBreakWithOffset with offset = 0.0.
*/
CFIndex CTTypesetterSuggestClusterBreak(
CTTypesetterRef typesetter,
CFIndex startIndex,
double width ) CT_AVAILABLE(10_5, 3_2);
CF_ASSUME_NONNULL_END
CF_EXTERN_C_END
CF_IMPLICIT_BRIDGING_DISABLED
#endif
|
9ebc8b2739347273e19ee8a57531c2b1799ffd9f
|
50dd46b8ece33f3cdd174284b15d1d51f89669d4
|
/third_party/tomcrypt/src/math/rand_prime.c
|
fdc8a16c610e34d3e4c78985fb2d93a9254a2d56
|
[
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] |
permissive
|
google/google-ctf
|
f99da1ee07729bbccb869fff1cbaed6a80e43bcc
|
df02323eaf945d15e124801c74abaadca2749dc7
|
refs/heads/master
| 2023-08-31T14:30:27.548081
| 2023-08-29T13:04:20
| 2023-08-29T13:04:20
| 131,317,137
| 4,136
| 607
|
Apache-2.0
| 2023-08-30T22:17:02
| 2018-04-27T15:56:03
|
Go
|
UTF-8
|
C
| false
| false
| 1,972
|
c
|
rand_prime.c
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
#if defined(LTC_MRSA) || (!defined(LTC_NO_MATH) && !defined(LTC_NO_PRNGS))
/**
@file rand_prime.c
Generate a random prime, Tom St Denis
*/
#define USE_BBS 1
int rand_prime(void *N, long len, prng_state *prng, int wprng)
{
int err, res, type;
unsigned char *buf;
LTC_ARGCHK(N != NULL);
/* get type */
if (len < 0) {
type = USE_BBS;
len = -len;
} else {
type = 0;
}
/* allow sizes between 2 and 512 bytes for a prime size */
if (len < 2 || len > 512) {
return CRYPT_INVALID_PRIME_SIZE;
}
/* valid PRNG? Better be! */
if ((err = prng_is_valid(wprng)) != CRYPT_OK) {
return err;
}
/* allocate buffer to work with */
buf = XCALLOC(1, len);
if (buf == NULL) {
return CRYPT_MEM;
}
do {
/* generate value */
if (prng_descriptor[wprng].read(buf, len, prng) != (unsigned long)len) {
XFREE(buf);
return CRYPT_ERROR_READPRNG;
}
/* munge bits */
buf[0] |= 0x80 | 0x40;
buf[len-1] |= 0x01 | ((type & USE_BBS) ? 0x02 : 0x00);
/* load value */
if ((err = mp_read_unsigned_bin(N, buf, len)) != CRYPT_OK) {
XFREE(buf);
return err;
}
/* test */
if ((err = mp_prime_is_prime(N, LTC_MILLER_RABIN_REPS, &res)) != CRYPT_OK) {
XFREE(buf);
return err;
}
} while (res == LTC_MP_NO);
#ifdef LTC_CLEAN_STACK
zeromem(buf, len);
#endif
XFREE(buf);
return CRYPT_OK;
}
#endif /* LTC_NO_MATH */
/* ref: HEAD -> develop */
/* git commit: 9c0d7085234bd6baba2ab8fd9eee62254599341c */
/* commit time: 2018-10-15 10:51:17 +0200 */
|
00e9360c94ec7cd197bc1997dc34b1f3ad57dde1
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/Infineon/libraries/IFX_PSOC6_HAL/core-lib/include/cy_utils.h
|
a6cef295df839af604f9dba51bee7ade06baed55
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 18,439
|
h
|
cy_utils.h
|
/***********************************************************************************************//**
* \file cy_utils.h
*
* \brief
* Basic utility macros and functions.
*
***************************************************************************************************
* \copyright
* Copyright 2018-2021 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation
*
* 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.
**************************************************************************************************/
/**
* \addtogroup group_utils Utilities
* \ingroup group_abstraction
* \{
* Basic utility macros and functions.
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#if defined(__cplusplus)
extern "C" {
#endif
/** Simple macro to suppress the unused parameter warning by casting to void. */
#define CY_UNUSED_PARAMETER(x) ( (void)(x) )
/** Halt the processor in the debug state
*/
static inline void CY_HALT(void)
{
__asm(" bkpt 1");
}
#ifdef CY_ASSERT
#undef CY_ASSERT
#endif // ifdef(CY_ASSERT)
/** Utility macro when neither NDEBUG or CY_NO_ASSERT is not declared to check a condition and, if
false, trigger a breakpoint */
#if defined(NDEBUG) || defined(CY_NO_ASSERT)
#define CY_ASSERT(x) do { \
} while(false)
#else
#define CY_ASSERT(x) do { \
if(!(x)) \
{ \
CY_HALT(); \
} \
} while(false)
#endif // defined(NDEBUG)
/*******************************************************************************
* Data manipulation defines
*******************************************************************************/
/** Get the lower 8 bits of a 16-bit value. */
#define CY_LO8(x) ((uint8_t) ((x) & 0xFFU))
/** Get the upper 8 bits of a 16-bit value. */
#define CY_HI8(x) ((uint8_t) ((uint16_t)(x) >> 8U))
/** Get the lower 16 bits of a 32-bit value. */
#define CY_LO16(x) ((uint16_t) ((x) & 0xFFFFU))
/** Get the upper 16 bits of a 32-bit value. */
#define CY_HI16(x) ((uint16_t) ((uint32_t)(x) >> 16U))
/** Swap the byte ordering of a 16-bit value */
#define CY_SWAP_ENDIAN16(x) ((uint16_t)(((x) << 8U) | (((x) >> 8U) & 0x00FFU)))
/** Swap the byte ordering of a 32-bit value */
#define CY_SWAP_ENDIAN32(x) \
((uint32_t)((((x) >> 24U) & 0x000000FFU) | (((x) & 0x00FF0000U) >> 8U) | \
(((x) & 0x0000FF00U) << 8U) | ((x) << 24U)))
/** Swap the byte ordering of a 64-bit value */
#define CY_SWAP_ENDIAN64(x) ((uint64_t) (((uint64_t) CY_SWAP_ENDIAN32((uint32_t)(x)) << 32U) | \
CY_SWAP_ENDIAN32((uint32_t)((x) >> 32U))))
/*******************************************************************************
* Memory model definitions
*******************************************************************************/
#if defined(__ARMCC_VERSION)
/** To create cross compiler compatible code, use the CY_NOINIT, CY_SECTION, CY_UNUSED, CY_ALIGN
* attributes at the first place of declaration/definition.
* For example: CY_NOINIT uint32_t noinitVar;
*/
#if (__ARMCC_VERSION >= 6010050)
#define CY_NOINIT __attribute__ ((section(".noinit")))
#else
#define CY_NOINIT __attribute__ ((section(".noinit"), zero_init))
#endif // (__ARMCC_VERSION >= 6010050)
#define CY_SECTION(name) __attribute__ ((section(name)))
#define CY_UNUSED __attribute__ ((unused))
#define CY_NOINLINE __attribute__ ((noinline))
// Specifies the minimum alignment (in bytes) for variables of the specified type.
#define CY_ALIGN(align) __ALIGNED(align)
#define CY_RAMFUNC_BEGIN __attribute__ ((section(".cy_ramfunc")))
#define CY_RAMFUNC_END
#elif defined (__GNUC__)
#if defined (__clang__)
#define CY_NOINIT __attribute__ ((section("__DATA, __noinit")))
#define CY_SECTION(name) __attribute__ ((section("__DATA, "name)))
#define CY_RAMFUNC_BEGIN __attribute__ ((section("__DATA, .cy_ramfunc")))
#define CY_RAMFUNC_END
#else
#define CY_NOINIT __attribute__ ((section(".noinit")))
#define CY_SECTION(name) __attribute__ ((section(name)))
#define CY_RAMFUNC_BEGIN __attribute__ ((section(".cy_ramfunc")))
#define CY_RAMFUNC_END
#endif
#define CY_UNUSED __attribute__ ((unused))
#define CY_NOINLINE __attribute__ ((noinline))
#define CY_ALIGN(align) __ALIGNED(align)
#elif defined (__ICCARM__)
#define CY_PRAGMA(x) _Pragma(#x)
#define CY_NOINIT __no_init
#define CY_SECTION(name) CY_PRAGMA(location = name)
#define CY_UNUSED
#define CY_NOINLINE CY_PRAGMA(optimize = no_inline)
#define CY_RAMFUNC_BEGIN CY_PRAGMA(diag_suppress = Ta023) __ramfunc
#define CY_RAMFUNC_END CY_PRAGMA(diag_default = Ta023)
#if (__VER__ < 8010001)
#define CY_ALIGN(align) CY_PRAGMA(data_alignment = align)
#else
#define CY_ALIGN(align) __ALIGNED(align)
#endif // (__VER__ < 8010001)
#else // if defined(__ARMCC_VERSION)
#error "An unsupported toolchain"
#endif // (__ARMCC_VERSION)
/***************************************************************************************************
* Macro Name: CY_GET_REG8(addr)
***********************************************************************************************//**
*
* Reads the 8-bit value from the specified address. This function can't be
* used to access the Core register, otherwise a fault occurs.
*
* \param addr The register address.
*
* \return The read value.
*
**************************************************************************************************/
#define CY_GET_REG8(addr) (*((const volatile uint8_t *)(addr)))
/***************************************************************************************************
* Macro Name: CY_SET_REG8(addr, value)
***********************************************************************************************//**
*
* Writes an 8-bit value to the specified address. This function can't be
* used to access the Core register, otherwise a fault occurs.
*
* \param addr The register address.
*
* \param value The value to write.
*
**************************************************************************************************/
#define CY_SET_REG8(addr, value) (*((volatile uint8_t *)(addr)) = (uint8_t)(value))
/***************************************************************************************************
* Macro Name: CY_GET_REG16(addr)
***********************************************************************************************//**
*
* Reads the 16-bit value from the specified address.
*
* \param addr The register address.
*
* \return The read value.
*
**************************************************************************************************/
#define CY_GET_REG16(addr) (*((const volatile uint16_t *)(addr)))
/***************************************************************************************************
* Macro Name: CY_SET_REG16(addr, value)
***********************************************************************************************//**
*
* Writes the 16-bit value to the specified address.
*
* \param addr The register address.
*
* \param value The value to write.
*
**************************************************************************************************/
#define CY_SET_REG16(addr, value) (*((volatile uint16_t *)(addr)) = (uint16_t)(value))
/***************************************************************************************************
* Macro Name: CY_GET_REG24(addr)
***********************************************************************************************//**
*
* Reads the 24-bit value from the specified address.
*
* \param addr The register address.
*
* \return The read value.
*
**************************************************************************************************/
#define CY_GET_REG24(addr) (((uint32_t) (*((const volatile uint8_t *)(addr)))) | \
(((uint32_t) (*((const volatile uint8_t *)(addr) + 1))) << 8U) | \
(((uint32_t) (*((const volatile uint8_t *)(addr) + 2))) << 16U))
/***************************************************************************************************
* Macro Name: CY_SET_REG24(addr, value)
***********************************************************************************************//**
*
* Writes the 24-bit value to the specified address.
*
* \param addr The register address.
*
* \param value The value to write.
*
**************************************************************************************************/
#define CY_SET_REG24(addr, value) \
do \
{ \
(*((volatile uint8_t *) (addr))) = (uint8_t)(value); \
(*((volatile uint8_t *) (addr) + 1)) = (uint8_t)((value) >> 8U); \
(*((volatile uint8_t *) (addr) + 2)) = (uint8_t)((value) >> 16U); \
} \
while(0)
/***************************************************************************************************
* Macro Name: CY_GET_REG32(addr)
***********************************************************************************************//**
*
* Reads the 32-bit value from the specified register. The address is the little
* endian order (LSB in lowest address).
*
* \param addr The register address.
*
* \return The read value.
*
**************************************************************************************************/
#define CY_GET_REG32(addr) (*((const volatile uint32_t *)(addr)))
/***************************************************************************************************
* Macro Name: CY_SET_REG32(addr, value)
***********************************************************************************************//**
*
* Writes the 32-bit value to the specified register. The address is the little
* endian order (LSB in lowest address).
*
* \param addr The register address.
*
* \param value The value to write.
*
**************************************************************************************************/
#define CY_SET_REG32(addr, value) (*((volatile uint32_t *)(addr)) = (uint32_t)(value))
/***************************************************************************************************
* Macro Name: _CLR_SET_FLD32U
***********************************************************************************************//**
*
* The macro for setting a register with a name field and value for providing
* get-clear-modify-write operations.
* Returns a resulting value to be assigned to the register.
*
**************************************************************************************************/
#define _CLR_SET_FLD32U(reg, field, value) \
(((reg) & ((uint32_t)(~(field ## _Msk)))) | (_VAL2FLD(field, value)))
/***************************************************************************************************
* Macro Name: CY_REG32_CLR_SET
***********************************************************************************************//**
*
* Uses _CLR_SET_FLD32U macro for providing get-clear-modify-write
* operations with a name field and value and writes a resulting value
* to the 32-bit register.
*
**************************************************************************************************/
#define CY_REG32_CLR_SET(reg, field, value) ((reg) = _CLR_SET_FLD32U((reg), field, (value)))
/***************************************************************************************************
* Macro Name: _CLR_SET_FLD16U
***********************************************************************************************//**
*
* The macro for setting a 16-bit register with a name field and value for providing
* get-clear-modify-write operations.
* Returns a resulting value to be assigned to the 16-bit register.
*
**************************************************************************************************/
#define _CLR_SET_FLD16U(reg, field, value) \
((uint16_t)(((reg) & ((uint16_t)(~(field ## _Msk)))) | ((uint16_t)_VAL2FLD(field, value))))
/***************************************************************************************************
* Macro Name: CY_REG16_CLR_SET
***********************************************************************************************//**
*
* Uses _CLR_SET_FLD16U macro for providing get-clear-modify-write
* operations with a name field and value and writes a resulting value
* to the 16-bit register.
*
**************************************************************************************************/
#define CY_REG16_CLR_SET(reg, field, value) ((reg) = _CLR_SET_FLD16U((reg), field, (value)))
/***************************************************************************************************
* Macro Name: _CLR_SET_FLD8U
***********************************************************************************************//**
*
* The macro for setting a 8-bit register with a name field and value for providing
* get-clear-modify-write operations.
* Returns a resulting value to be assigned to the 8-bit register.
*
**************************************************************************************************/
#define _CLR_SET_FLD8U(reg, field, value) \
((uint8_t)(((reg) & ((uint8_t)(~(field ## _Msk)))) | ((uint8_t)_VAL2FLD(field, value))))
/***************************************************************************************************
* Macro Name: CY_REG8_CLR_SET
***********************************************************************************************//**
*
* Uses _CLR_SET_FLD8U macro for providing get-clear-modify-write
* operations with a name field and value and writes a resulting value
* to the 8-bit register.
*
**************************************************************************************************/
#define CY_REG8_CLR_SET(reg, field, value) ((reg) = _CLR_SET_FLD8U((reg), field, (value)))
/***************************************************************************************************
* Macro Name: _BOOL2FLD
***********************************************************************************************//**
*
* Returns a field mask if the value is not false.
* Returns 0, if the value is false.
*
**************************************************************************************************/
#define _BOOL2FLD(field, value) (((value) != false) ? (field ## _Msk) : 0UL)
/***************************************************************************************************
* Macro Name: _FLD2BOOL
***********************************************************************************************//**
*
* Returns true, if the value includes the field mask.
* Returns false, if the value doesn't include the field mask.
*
**************************************************************************************************/
#define _FLD2BOOL(field, value) (((value) & (field ## _Msk)) != 0UL)
/***************************************************************************************************
* Macro Name: CY_SYSLIB_DIV_ROUND
***********************************************************************************************//**
*
* Calculates a / b with rounding to the nearest integer,
* a and b must have the same sign.
*
**************************************************************************************************/
#define CY_SYSLIB_DIV_ROUND(a, b) (((a) + ((b) / 2U)) / (b))
/***************************************************************************************************
* Macro Name: CY_SYSLIB_DIV_ROUNDUP
***********************************************************************************************//**
*
* Calculates a / b with rounding up if remainder != 0,
* both a and b must be positive.
*
**************************************************************************************************/
#define CY_SYSLIB_DIV_ROUNDUP(a, b) ((((a) - 1U) / (b)) + 1U)
/*******************************************************************************
* Provides the macros for MISRA violation documentation in Coverity tool.
*******************************************************************************/
/** \cond INTERNAL */
#ifdef CY_COVERITY_2012_CHECK // Check MISRA-C:2012 with Coverity tool
#define CY_COVERITY_PRAGMA_STR(a) #a
#define CY_MISRA_DEVIATE_LINE(MISRA, MESSAGE) \
_Pragma(CY_COVERITY_PRAGMA_STR(coverity compliance deviate MISRA MESSAGE))
#define CY_MISRA_FP_LINE(MISRA, MESSAGE) \
_Pragma(CY_COVERITY_PRAGMA_STR(coverity compliance fp MISRA MESSAGE))
#define CY_MISRA_DEVIATE_BLOCK_START(MISRA, COUNT, MESSAGE) \
_Pragma(CY_COVERITY_PRAGMA_STR(coverity compliance block (deviate:COUNT MISRA MESSAGE)))
#define CY_MISRA_FP_BLOCK_START(MISRA, COUNT, MESSAGE) \
_Pragma(CY_COVERITY_PRAGMA_STR(coverity compliance block (fp:COUNT MISRA MESSAGE)))
#define CY_MISRA_BLOCK_END(MISRA) \
_Pragma(CY_COVERITY_PRAGMA_STR(coverity compliance end_block MISRA))
#else // General usage
#define CY_MISRA_DEVIATE_LINE(MISRA, MESSAGE) do{}while(false)
#define CY_MISRA_FP_LINE(MISRA, MESSAGE) do{}while(false)
#define CY_MISRA_DEVIATE_BLOCK_START(MISRA, COUNT, MESSAGE)
#define CY_MISRA_FP_BLOCK_START(MISRA, COUNT, MESSAGE)
#define CY_MISRA_BLOCK_END(MISRA)
#endif // CY_COVERITY_2012_CHECK
/** \endcond */
#ifdef __cplusplus
}
#endif
/** \} group_utils */
|
a303e489ee32b2696d1c0151ae449e6fa68f623e
|
a0838b4cd2ce8a2862a6a82dc2e75a701447c28b
|
/examples/mcp4725/default/main/main.c
|
9358d65fc0301d458f65e638b48880fcd2a07c88
|
[
"BSD-3-Clause"
] |
permissive
|
UncleRus/esp-idf-lib
|
bfa97226f6df9313dd01f56de1b8bef1824ad642
|
9dd86b23aff2445b905da63d3c6481474e430a10
|
refs/heads/master
| 2023-08-31T06:04:48.102658
| 2023-08-30T15:57:59
| 2023-08-30T15:57:59
| 126,475,029
| 1,117
| 394
| null | 2023-09-01T06:25:56
| 2018-03-23T11:17:22
|
C
|
UTF-8
|
C
| false
| false
| 1,645
|
c
|
main.c
|
#include <stdio.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <mcp4725.h>
#include <string.h>
#define VDD 3.3
static void wait_for_eeprom(i2c_dev_t *dev)
{
bool busy;
while (true)
{
ESP_ERROR_CHECK(mcp4725_eeprom_busy(dev, &busy));
if (!busy)
return;
printf("...DAC is busy, waiting...\n");
vTaskDelay(1);
}
}
void task(void *pvParameters)
{
i2c_dev_t dev;
memset(&dev, 0, sizeof(i2c_dev_t));
// Init device descriptor
ESP_ERROR_CHECK(mcp4725_init_desc(&dev, CONFIG_EXAMPLE_I2C_ADDR, 0, CONFIG_EXAMPLE_I2C_MASTER_SDA, CONFIG_EXAMPLE_I2C_MASTER_SCL));
mcp4725_power_mode_t pm;
ESP_ERROR_CHECK(mcp4725_get_power_mode(&dev, true, &pm));
if (pm != MCP4725_PM_NORMAL)
{
printf("DAC was sleeping... Wake up Neo!\n");
ESP_ERROR_CHECK(mcp4725_set_power_mode(&dev, true, MCP4725_PM_NORMAL));
wait_for_eeprom(&dev);
}
printf("Set default DAC output value to MAX...\n");
ESP_ERROR_CHECK(mcp4725_set_raw_output(&dev, MCP4725_MAX_VALUE, true));
wait_for_eeprom(&dev);
printf("Now let's generate the sawtooth wave in slow manner\n");
float vout = 0;
while (1)
{
vout += 0.1;
if (vout > VDD) vout = 0;
printf("Vout: %.02f\n", vout);
ESP_ERROR_CHECK(mcp4725_set_voltage(&dev, VDD, vout, false));
// It will be very low freq wave
vTaskDelay(pdMS_TO_TICKS(100));
}
}
void app_main()
{
// Init i2cdev library
ESP_ERROR_CHECK(i2cdev_init());
xTaskCreate(task, "test", configMINIMAL_STACK_SIZE * 8, NULL, 5, NULL);
}
|
200ea4ca591ca7b2f4523b745c69ed3be5abdc10
|
f268b50cfc676024734009a0678825d01fa78a57
|
/src/replay/replay.h
|
9fc6874d0973f8faea4496c0c316cab9c9b2b399
|
[
"LicenseRef-scancode-warranty-disclaimer",
"CC-BY-4.0",
"LicenseRef-scancode-public-domain",
"MIT"
] |
permissive
|
taisei-project/taisei
|
90a1358567c77555eabfdb340bb6adeb913e2ced
|
f1c156cacdb579e66d4bc1776d4d1809e93014d2
|
refs/heads/master
| 2023-09-04T06:25:18.445412
| 2023-09-02T17:31:06
| 2023-09-02T17:31:06
| 977,986
| 785
| 87
|
NOASSERTION
| 2023-04-29T18:16:47
| 2010-10-11T07:31:32
|
C
|
UTF-8
|
C
| false
| false
| 1,654
|
h
|
replay.h
|
/*
* This software is licensed under the terms of the MIT License.
* See COPYING for further information.
* ---
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
*/
#pragma once
#include "taisei.h"
#include "util/callchain.h"
#include <SDL.h>
#define REPLAY_EXTENSION "tsr"
#ifdef DEBUG
// #define REPLAY_LOAD_DEBUG
#endif
typedef struct Replay Replay;
typedef struct ReplayStage ReplayStage;
typedef struct ReplayEvent ReplayEvent;
typedef enum ReplayReadMode {
// bitflags
REPLAY_READ_META = (1 << 0),
REPLAY_READ_EVENTS = (1 << 1),
REPLAY_READ_IGNORE_ERRORS = (1 << 2),
REPLAY_READ_ALL = REPLAY_READ_META | REPLAY_READ_EVENTS,
} ReplayReadMode;
void replay_reset(Replay *rpy) attr_nonnull_all;
void replay_destroy_events(Replay *rpy) attr_nonnull_all;
bool replay_write(Replay *rpy, SDL_RWops *file, uint16_t version) attr_nonnull_all;
bool replay_read(Replay *rpy, SDL_RWops *file, ReplayReadMode mode, const char *source) attr_nonnull(1, 2);
bool replay_save(Replay *rpy, const char *name) attr_nonnull_all;
bool replay_save_syspath(Replay *rpy, const char *path, uint16_t version) attr_nonnull_all;
bool replay_load(Replay *rpy, const char *name, ReplayReadMode mode) attr_nonnull_all;
bool replay_load_syspath(Replay *rpy, const char *path, ReplayReadMode mode) attr_nonnull_all;
bool replay_load_vfspath(Replay *rpy, const char *path, ReplayReadMode mode) attr_nonnull_all;
int replay_find_stage_idx(Replay *rpy, uint8_t stageid) attr_nonnull_all;
void replay_play(Replay *rpy, int firstidx, bool demo_mode, CallChain next) attr_nonnull_all;
|
4a4f56c9b865830c10e39a6644202187ee4613bb
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/musl/src/misc/pty.c
|
a0577147a4c2b6ef251ede679d56354b406fbb4c
|
[
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-musl-exception",
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 636
|
c
|
pty.c
|
#include <stdlib.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include "syscall.h"
int posix_openpt(int flags)
{
int r = open("/dev/ptmx", flags);
if (r < 0 && errno == ENOSPC) errno = EAGAIN;
return r;
}
int grantpt(int fd)
{
return 0;
}
int unlockpt(int fd)
{
int unlock = 0;
return ioctl(fd, TIOCSPTLCK, &unlock);
}
int __ptsname_r(int fd, char *buf, size_t len)
{
int pty, err;
if (!buf) len = 0;
if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return -err;
if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE;
return 0;
}
weak_alias(__ptsname_r, ptsname_r);
|
1be4f5d16d1de5cf2788100e02f0738a88311a39
|
bf9f350094a6bd4c4a5ddba22fa3671cf987d82e
|
/tests/wasi/c/atof.c
|
ebd7b84cff1a738ff9a2715c0ed8dc230a3132e4
|
[
"MIT",
"BSD-3-Clause"
] |
permissive
|
gwsystems/aWsm
|
e16759a1d7d899660d07e83026b4c0f5a5d414d8
|
69c8b6116664d65a851cc459601bef6af3caeaea
|
refs/heads/master
| 2023-08-27T11:21:34.680919
| 2022-09-22T18:05:20
| 2022-09-22T18:05:20
| 139,072,240
| 248
| 21
|
BSD-3-Clause
| 2022-09-14T23:20:31
| 2018-06-28T21:58:42
|
C
|
UTF-8
|
C
| false
| false
| 123
|
c
|
atof.c
|
#include <stdlib.h>
const char* pi_str = "3.14";
int main() {
float pi = strtof(pi_str, NULL);
return (int)pi;
}
|
251690b2d06b09bb8b57c654b5a8281cc534be04
|
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
|
/AKWF-c/AKWF_0014/AKWF_1331.h
|
d1ff4e6ede576169af043c70d005aa25b9017dff
|
[
"CC0-1.0"
] |
permissive
|
KristofferKarlAxelEkstrand/AKWF-FREE
|
b2defa1a2d389d309be6dd2e9f968923daf80d1b
|
cf8171df36e9fec25416b5f568b72a6e2cb69194
|
refs/heads/master
| 2023-07-23T18:22:36.939705
| 2023-07-10T17:14:40
| 2023-07-10T17:14:40
| 145,817,187
| 359
| 59
|
CC0-1.0
| 2023-07-10T17:14:41
| 2018-08-23T07:26:56
| null |
UTF-8
|
C
| false
| false
| 4,672
|
h
|
AKWF_1331.h
|
/* Adventure Kid Waveforms (AKWF) converted for use with Teensy Audio Library
*
* Adventure Kid Waveforms(AKWF) Open waveforms library
* https://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/
*
* This code is in the public domain, CC0 1.0 Universal (CC0 1.0)
* https://creativecommons.org/publicdomain/zero/1.0/
*
* Converted by Brad Roy, https://github.com/prosper00
*/
/* AKWF_1331 256 samples
+-----------------------------------------------------------------------------------------------------------------+
| *************** * |
| * * |
| * * * |
| * *************** |
| * * |
| * * |
|************** * |
| * |
| * |
| *************** |
| * |
| * **************|
| * * |
| * * |
| **************** * |
+-----------------------------------------------------------------------------------------------------------------+
*/
const uint16_t AKWF_1331 [] = {
36699, 39097, 38252, 38822, 38369, 38754, 38415, 38719, 38445, 38692, 38473, 38663, 38503, 38631, 38538, 38593,
38579, 38548, 38629, 38493, 38689, 38426, 38763, 38345, 38854, 38241, 38976, 38089, 39173, 37810, 39639, 36775,
44670, 61344, 59391, 60324, 59838, 60071, 60001, 59958, 60081, 59902, 60119, 59878, 60131, 59876, 60125, 59888,
60106, 59913, 60078, 59946, 60041, 59985, 60001, 60026, 59957, 60072, 59909, 60125, 59847, 60213, 59670, 60978,
65368, 65223, 65243, 65277, 65215, 65289, 65214, 65284, 65225, 65269, 65241, 65250, 65263, 65229, 65283, 65210,
65299, 65196, 65310, 65191, 65311, 65196, 65298, 65217, 65266, 65261, 65206, 65343, 65091, 65518, 64789, 65535,
55534, 50092, 51824, 50772, 51517, 50955, 51394, 51045, 51326, 51096, 51287, 51124, 51271, 51132, 51271, 51122,
51290, 51095, 51323, 51054, 51373, 50998, 51437, 50925, 51520, 50829, 51632, 50687, 51830, 50368, 52519, 47451,
26038, 26270, 26249, 26069, 26384, 25976, 26450, 25927, 26484, 25903, 26500, 25897, 26499, 25902, 26489, 25919,
26468, 25944, 26437, 25981, 26395, 26027, 26342, 26090, 26269, 26176, 26163, 26312, 25980, 26583, 25515, 27648,
11402, 3362, 6100, 4394, 5636, 4668, 5448, 4811, 5333, 4907, 5250, 4979, 5186, 5037, 5135, 5083,
5094, 5120, 5060, 5149, 5034, 5174, 5013, 5193, 4995, 5210, 4976, 5234, 4945, 5282, 4856, 5493,
3706, 134, 585, 345, 498, 394, 466, 417, 447, 433, 432, 449, 415, 467, 396, 488,
372, 513, 345, 541, 315, 575, 277, 616, 231, 669, 168, 750, 54, 942, 0, 2896,
15128, 14914, 14974, 15042, 14889, 15102, 14845, 15135, 14818, 15157, 14803, 15168, 14795, 15172, 14795, 15169,
14800, 15160, 14814, 15142, 14837, 15113, 14872, 15070, 14925, 15005, 15006, 14899, 15154, 14679, 15531, 13826,
};
|
357b9c08b1c6ef12f024fe6000c475c38e24bcc8
|
165cf5ce4f80ca7037237f3abf59eeef68e3105e
|
/lib/nghttp3_stream.c
|
6188a141dd123b65194278d2e9a8efdf44798a3f
|
[
"MIT"
] |
permissive
|
ngtcp2/nghttp3
|
1eb043960397ec5bdd3f704d4ccc9b11613ec99c
|
dd5d9d55dcb13a1729b7ad1c8c30f8e5ad82c4df
|
refs/heads/main
| 2023-08-31T03:23:38.565595
| 2023-08-30T09:58:04
| 2023-08-30T09:58:04
| 156,868,263
| 693
| 82
|
MIT
| 2023-08-30T09:55:36
| 2018-11-09T13:49:36
|
C
|
UTF-8
|
C
| false
| false
| 34,792
|
c
|
nghttp3_stream.c
|
/*
* nghttp3
*
* Copyright (c) 2019 nghttp3 contributors
*
* 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 "nghttp3_stream.h"
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include "nghttp3_conv.h"
#include "nghttp3_macro.h"
#include "nghttp3_frame.h"
#include "nghttp3_conn.h"
#include "nghttp3_str.h"
#include "nghttp3_http.h"
#include "nghttp3_vec.h"
#include "nghttp3_unreachable.h"
/* NGHTTP3_STREAM_MAX_COPY_THRES is the maximum size of buffer which
makes a copy to outq. */
#define NGHTTP3_STREAM_MAX_COPY_THRES 128
/* NGHTTP3_MIN_RBLEN is the minimum length of nghttp3_ringbuf */
#define NGHTTP3_MIN_RBLEN 4
nghttp3_objalloc_def(stream, nghttp3_stream, oplent);
int nghttp3_stream_new(nghttp3_stream **pstream, int64_t stream_id,
const nghttp3_stream_callbacks *callbacks,
nghttp3_objalloc *out_chunk_objalloc,
nghttp3_objalloc *stream_objalloc,
const nghttp3_mem *mem) {
nghttp3_stream *stream = nghttp3_objalloc_stream_get(stream_objalloc);
if (stream == NULL) {
return NGHTTP3_ERR_NOMEM;
}
memset(stream, 0, sizeof(*stream));
stream->out_chunk_objalloc = out_chunk_objalloc;
stream->stream_objalloc = stream_objalloc;
nghttp3_tnode_init(&stream->node, stream_id);
nghttp3_ringbuf_init(&stream->frq, 0, sizeof(nghttp3_frame_entry), mem);
nghttp3_ringbuf_init(&stream->chunks, 0, sizeof(nghttp3_buf), mem);
nghttp3_ringbuf_init(&stream->outq, 0, sizeof(nghttp3_typed_buf), mem);
nghttp3_ringbuf_init(&stream->inq, 0, sizeof(nghttp3_buf), mem);
nghttp3_qpack_stream_context_init(&stream->qpack_sctx, stream_id, mem);
stream->qpack_blocked_pe.index = NGHTTP3_PQ_BAD_INDEX;
stream->mem = mem;
stream->tx.offset = 0;
stream->rx.http.status_code = -1;
stream->rx.http.content_length = -1;
stream->rx.http.pri.urgency = NGHTTP3_DEFAULT_URGENCY;
stream->error_code = NGHTTP3_H3_NO_ERROR;
if (callbacks) {
stream->callbacks = *callbacks;
}
*pstream = stream;
return 0;
}
static void delete_outq(nghttp3_ringbuf *outq, const nghttp3_mem *mem) {
nghttp3_typed_buf *tbuf;
size_t i, len = nghttp3_ringbuf_len(outq);
for (i = 0; i < len; ++i) {
tbuf = nghttp3_ringbuf_get(outq, i);
if (tbuf->type == NGHTTP3_BUF_TYPE_PRIVATE) {
nghttp3_buf_free(&tbuf->buf, mem);
}
}
nghttp3_ringbuf_free(outq);
}
static void delete_chunks(nghttp3_ringbuf *chunks, const nghttp3_mem *mem) {
nghttp3_buf *buf;
size_t i, len = nghttp3_ringbuf_len(chunks);
for (i = 0; i < len; ++i) {
buf = nghttp3_ringbuf_get(chunks, i);
nghttp3_buf_free(buf, mem);
}
nghttp3_ringbuf_free(chunks);
}
static void delete_out_chunks(nghttp3_ringbuf *chunks,
nghttp3_objalloc *out_chunk_objalloc,
const nghttp3_mem *mem) {
nghttp3_buf *buf;
size_t i, len = nghttp3_ringbuf_len(chunks);
for (i = 0; i < len; ++i) {
buf = nghttp3_ringbuf_get(chunks, i);
if (nghttp3_buf_cap(buf) == NGHTTP3_STREAM_MIN_CHUNK_SIZE) {
nghttp3_objalloc_chunk_release(out_chunk_objalloc,
(nghttp3_chunk *)(void *)buf->begin);
continue;
}
nghttp3_buf_free(buf, mem);
}
nghttp3_ringbuf_free(chunks);
}
static void delete_frq(nghttp3_ringbuf *frq, const nghttp3_mem *mem) {
nghttp3_frame_entry *frent;
size_t i, len = nghttp3_ringbuf_len(frq);
for (i = 0; i < len; ++i) {
frent = nghttp3_ringbuf_get(frq, i);
switch (frent->fr.hd.type) {
case NGHTTP3_FRAME_HEADERS:
nghttp3_frame_headers_free(&frent->fr.headers, mem);
break;
case NGHTTP3_FRAME_PRIORITY_UPDATE:
nghttp3_frame_priority_update_free(&frent->fr.priority_update, mem);
break;
default:
break;
}
}
nghttp3_ringbuf_free(frq);
}
void nghttp3_stream_del(nghttp3_stream *stream) {
if (stream == NULL) {
return;
}
nghttp3_qpack_stream_context_free(&stream->qpack_sctx);
delete_chunks(&stream->inq, stream->mem);
delete_outq(&stream->outq, stream->mem);
delete_out_chunks(&stream->chunks, stream->out_chunk_objalloc, stream->mem);
delete_frq(&stream->frq, stream->mem);
nghttp3_tnode_free(&stream->node);
nghttp3_objalloc_stream_release(stream->stream_objalloc, stream);
}
void nghttp3_varint_read_state_reset(nghttp3_varint_read_state *rvint) {
memset(rvint, 0, sizeof(*rvint));
}
void nghttp3_stream_read_state_reset(nghttp3_stream_read_state *rstate) {
memset(rstate, 0, sizeof(*rstate));
}
nghttp3_ssize nghttp3_read_varint(nghttp3_varint_read_state *rvint,
const uint8_t *src, size_t srclen, int fin) {
size_t nread = 0;
size_t n;
size_t i;
assert(srclen > 0);
if (rvint->left == 0) {
assert(rvint->acc == 0);
rvint->left = nghttp3_get_varintlen(src);
if (rvint->left <= srclen) {
rvint->acc = nghttp3_get_varint(&nread, src);
rvint->left = 0;
return (nghttp3_ssize)nread;
}
if (fin) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}
rvint->acc = nghttp3_get_varint_fb(src);
nread = 1;
++src;
--srclen;
--rvint->left;
}
n = nghttp3_min(rvint->left, srclen);
for (i = 0; i < n; ++i) {
rvint->acc = (rvint->acc << 8) + src[i];
}
rvint->left -= n;
nread += n;
if (fin && rvint->left) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}
return (nghttp3_ssize)nread;
}
int nghttp3_stream_frq_add(nghttp3_stream *stream,
const nghttp3_frame_entry *frent) {
nghttp3_ringbuf *frq = &stream->frq;
nghttp3_frame_entry *dest;
int rv;
if (nghttp3_ringbuf_full(frq)) {
size_t nlen = nghttp3_max(NGHTTP3_MIN_RBLEN, nghttp3_ringbuf_len(frq) * 2);
rv = nghttp3_ringbuf_reserve(frq, nlen);
if (rv != 0) {
return rv;
}
}
dest = nghttp3_ringbuf_push_back(frq);
*dest = *frent;
return 0;
}
int nghttp3_stream_fill_outq(nghttp3_stream *stream) {
nghttp3_ringbuf *frq = &stream->frq;
nghttp3_frame_entry *frent;
int data_eof;
int rv;
for (; nghttp3_ringbuf_len(frq) &&
stream->unsent_bytes < NGHTTP3_MIN_UNSENT_BYTES;) {
frent = nghttp3_ringbuf_get(frq, 0);
switch (frent->fr.hd.type) {
case NGHTTP3_FRAME_SETTINGS:
rv = nghttp3_stream_write_settings(stream, frent);
if (rv != 0) {
return rv;
}
break;
case NGHTTP3_FRAME_HEADERS:
rv = nghttp3_stream_write_headers(stream, frent);
if (rv != 0) {
return rv;
}
nghttp3_frame_headers_free(&frent->fr.headers, stream->mem);
break;
case NGHTTP3_FRAME_DATA:
rv = nghttp3_stream_write_data(stream, &data_eof, frent);
if (rv != 0) {
return rv;
}
if (stream->flags & NGHTTP3_STREAM_FLAG_READ_DATA_BLOCKED) {
return 0;
}
if (!data_eof) {
return 0;
}
break;
case NGHTTP3_FRAME_GOAWAY:
rv = nghttp3_stream_write_goaway(stream, frent);
if (rv != 0) {
return rv;
}
break;
case NGHTTP3_FRAME_PRIORITY_UPDATE:
rv = nghttp3_stream_write_priority_update(stream, frent);
if (rv != 0) {
return rv;
}
nghttp3_frame_priority_update_free(&frent->fr.priority_update,
stream->mem);
break;
default:
/* TODO Not implemented */
break;
}
nghttp3_ringbuf_pop_front(frq);
}
return 0;
}
static void typed_buf_shared_init(nghttp3_typed_buf *tbuf,
const nghttp3_buf *chunk) {
nghttp3_typed_buf_init(tbuf, chunk, NGHTTP3_BUF_TYPE_SHARED);
tbuf->buf.pos = tbuf->buf.last;
}
int nghttp3_stream_write_stream_type(nghttp3_stream *stream) {
size_t len = nghttp3_put_varintlen((int64_t)stream->type);
nghttp3_buf *chunk;
nghttp3_typed_buf tbuf;
int rv;
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_put_varint(chunk->last, (int64_t)stream->type);
tbuf.buf.last = chunk->last;
return nghttp3_stream_outq_add(stream, &tbuf);
}
int nghttp3_stream_write_settings(nghttp3_stream *stream,
nghttp3_frame_entry *frent) {
size_t len;
int rv;
nghttp3_buf *chunk;
nghttp3_typed_buf tbuf;
struct {
nghttp3_frame_settings settings;
nghttp3_settings_entry iv[15];
} fr;
nghttp3_settings_entry *iv;
nghttp3_settings *local_settings = frent->aux.settings.local_settings;
fr.settings.hd.type = NGHTTP3_FRAME_SETTINGS;
fr.settings.niv = 3;
iv = &fr.settings.iv[0];
iv[0].id = NGHTTP3_SETTINGS_ID_MAX_FIELD_SECTION_SIZE;
iv[0].value = local_settings->max_field_section_size;
iv[1].id = NGHTTP3_SETTINGS_ID_QPACK_MAX_TABLE_CAPACITY;
iv[1].value = local_settings->qpack_max_dtable_capacity;
iv[2].id = NGHTTP3_SETTINGS_ID_QPACK_BLOCKED_STREAMS;
iv[2].value = local_settings->qpack_blocked_streams;
if (local_settings->h3_datagram) {
iv[fr.settings.niv].id = NGHTTP3_SETTINGS_ID_H3_DATAGRAM;
iv[fr.settings.niv].value = 1;
++fr.settings.niv;
}
if (local_settings->enable_connect_protocol) {
iv[fr.settings.niv].id = NGHTTP3_SETTINGS_ID_ENABLE_CONNECT_PROTOCOL;
iv[fr.settings.niv].value = 1;
++fr.settings.niv;
}
len = nghttp3_frame_write_settings_len(&fr.settings.hd.length, &fr.settings);
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_frame_write_settings(chunk->last, &fr.settings);
tbuf.buf.last = chunk->last;
return nghttp3_stream_outq_add(stream, &tbuf);
}
int nghttp3_stream_write_goaway(nghttp3_stream *stream,
nghttp3_frame_entry *frent) {
nghttp3_frame_goaway *fr = &frent->fr.goaway;
size_t len;
int rv;
nghttp3_buf *chunk;
nghttp3_typed_buf tbuf;
len = nghttp3_frame_write_goaway_len(&fr->hd.length, fr);
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_frame_write_goaway(chunk->last, fr);
tbuf.buf.last = chunk->last;
return nghttp3_stream_outq_add(stream, &tbuf);
}
int nghttp3_stream_write_priority_update(nghttp3_stream *stream,
nghttp3_frame_entry *frent) {
nghttp3_frame_priority_update *fr = &frent->fr.priority_update;
size_t len;
int rv;
nghttp3_buf *chunk;
nghttp3_typed_buf tbuf;
len = nghttp3_frame_write_priority_update_len(&fr->hd.length, fr);
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_frame_write_priority_update(chunk->last, fr);
tbuf.buf.last = chunk->last;
return nghttp3_stream_outq_add(stream, &tbuf);
}
int nghttp3_stream_write_headers(nghttp3_stream *stream,
nghttp3_frame_entry *frent) {
nghttp3_frame_headers *fr = &frent->fr.headers;
nghttp3_conn *conn = stream->conn;
assert(conn);
return nghttp3_stream_write_header_block(
stream, &conn->qenc, conn->tx.qenc, &conn->tx.qpack.rbuf,
&conn->tx.qpack.ebuf, NGHTTP3_FRAME_HEADERS, fr->nva, fr->nvlen);
}
int nghttp3_stream_write_header_block(nghttp3_stream *stream,
nghttp3_qpack_encoder *qenc,
nghttp3_stream *qenc_stream,
nghttp3_buf *rbuf, nghttp3_buf *ebuf,
int64_t frame_type, const nghttp3_nv *nva,
size_t nvlen) {
nghttp3_buf pbuf;
int rv;
size_t len;
nghttp3_buf *chunk;
nghttp3_typed_buf tbuf;
nghttp3_frame_hd hd;
uint8_t raw_pbuf[16];
size_t pbuflen, rbuflen, ebuflen;
nghttp3_buf_wrap_init(&pbuf, raw_pbuf, sizeof(raw_pbuf));
rv = nghttp3_qpack_encoder_encode(qenc, &pbuf, rbuf, ebuf, stream->node.id,
nva, nvlen);
if (rv != 0) {
goto fail;
}
pbuflen = nghttp3_buf_len(&pbuf);
rbuflen = nghttp3_buf_len(rbuf);
ebuflen = nghttp3_buf_len(ebuf);
hd.type = frame_type;
hd.length = (int64_t)(pbuflen + rbuflen);
len = nghttp3_frame_write_hd_len(&hd) + pbuflen;
if (rbuflen <= NGHTTP3_STREAM_MAX_COPY_THRES) {
len += rbuflen;
}
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
goto fail;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_frame_write_hd(chunk->last, &hd);
chunk->last = nghttp3_cpymem(chunk->last, pbuf.pos, pbuflen);
nghttp3_buf_init(&pbuf);
if (rbuflen > NGHTTP3_STREAM_MAX_COPY_THRES) {
tbuf.buf.last = chunk->last;
rv = nghttp3_stream_outq_add(stream, &tbuf);
if (rv != 0) {
goto fail;
}
nghttp3_typed_buf_init(&tbuf, rbuf, NGHTTP3_BUF_TYPE_PRIVATE);
rv = nghttp3_stream_outq_add(stream, &tbuf);
if (rv != 0) {
goto fail;
}
nghttp3_buf_init(rbuf);
} else if (rbuflen) {
chunk->last = nghttp3_cpymem(chunk->last, rbuf->pos, rbuflen);
tbuf.buf.last = chunk->last;
rv = nghttp3_stream_outq_add(stream, &tbuf);
if (rv != 0) {
goto fail;
}
nghttp3_buf_reset(rbuf);
}
if (ebuflen > NGHTTP3_STREAM_MAX_COPY_THRES) {
assert(qenc_stream);
nghttp3_typed_buf_init(&tbuf, ebuf, NGHTTP3_BUF_TYPE_PRIVATE);
rv = nghttp3_stream_outq_add(qenc_stream, &tbuf);
if (rv != 0) {
return rv;
}
nghttp3_buf_init(ebuf);
} else if (ebuflen) {
assert(qenc_stream);
rv = nghttp3_stream_ensure_chunk(qenc_stream, ebuflen);
if (rv != 0) {
goto fail;
}
chunk = nghttp3_stream_get_chunk(qenc_stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_cpymem(chunk->last, ebuf->pos, ebuflen);
tbuf.buf.last = chunk->last;
rv = nghttp3_stream_outq_add(qenc_stream, &tbuf);
if (rv != 0) {
goto fail;
}
nghttp3_buf_reset(ebuf);
}
assert(0 == nghttp3_buf_len(&pbuf));
assert(0 == nghttp3_buf_len(rbuf));
assert(0 == nghttp3_buf_len(ebuf));
return 0;
fail:
return rv;
}
int nghttp3_stream_write_data(nghttp3_stream *stream, int *peof,
nghttp3_frame_entry *frent) {
int rv;
size_t len;
nghttp3_typed_buf tbuf;
nghttp3_buf buf;
nghttp3_buf *chunk;
nghttp3_read_data_callback read_data = frent->aux.data.dr.read_data;
nghttp3_conn *conn = stream->conn;
int64_t datalen;
uint32_t flags = 0;
nghttp3_frame_hd hd;
nghttp3_vec vec[8];
nghttp3_vec *v;
nghttp3_ssize sveccnt;
size_t i;
assert(!(stream->flags & NGHTTP3_STREAM_FLAG_READ_DATA_BLOCKED));
assert(read_data);
assert(conn);
*peof = 0;
sveccnt = read_data(conn, stream->node.id, vec, nghttp3_arraylen(vec), &flags,
conn->user_data, stream->user_data);
if (sveccnt < 0) {
if (sveccnt == NGHTTP3_ERR_WOULDBLOCK) {
stream->flags |= NGHTTP3_STREAM_FLAG_READ_DATA_BLOCKED;
return 0;
}
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
datalen = nghttp3_vec_len_varint(vec, (size_t)sveccnt);
if (datalen == -1) {
return NGHTTP3_ERR_STREAM_DATA_OVERFLOW;
}
assert(datalen || flags & NGHTTP3_DATA_FLAG_EOF);
if (flags & NGHTTP3_DATA_FLAG_EOF) {
*peof = 1;
if (!(flags & NGHTTP3_DATA_FLAG_NO_END_STREAM)) {
stream->flags |= NGHTTP3_STREAM_FLAG_WRITE_END_STREAM;
if (datalen == 0) {
if (nghttp3_stream_outq_write_done(stream)) {
/* If this is the last data and its is 0 length, we don't
need send DATA frame. We rely on the non-emptiness of
outq to schedule stream, so add empty tbuf to outq to
just send fin. */
nghttp3_buf_init(&buf);
nghttp3_typed_buf_init(&tbuf, &buf, NGHTTP3_BUF_TYPE_PRIVATE);
return nghttp3_stream_outq_add(stream, &tbuf);
}
return 0;
}
}
if (datalen == 0) {
/* We are going to send more frames, but no DATA frame this
time. */
return 0;
}
}
hd.type = NGHTTP3_FRAME_DATA;
hd.length = datalen;
len = nghttp3_frame_write_hd_len(&hd);
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
chunk->last = nghttp3_frame_write_hd(chunk->last, &hd);
tbuf.buf.last = chunk->last;
rv = nghttp3_stream_outq_add(stream, &tbuf);
if (rv != 0) {
return rv;
}
if (datalen) {
for (i = 0; i < (size_t)sveccnt; ++i) {
v = &vec[i];
if (v->len == 0) {
continue;
}
nghttp3_buf_wrap_init(&buf, v->base, v->len);
buf.last = buf.end;
nghttp3_typed_buf_init(&tbuf, &buf, NGHTTP3_BUF_TYPE_ALIEN);
rv = nghttp3_stream_outq_add(stream, &tbuf);
if (rv != 0) {
return rv;
}
}
}
return 0;
}
int nghttp3_stream_write_qpack_decoder_stream(nghttp3_stream *stream) {
nghttp3_qpack_decoder *qdec;
nghttp3_buf *chunk;
int rv;
nghttp3_typed_buf tbuf;
size_t len;
assert(stream->conn);
assert(stream->conn->tx.qdec == stream);
qdec = &stream->conn->qdec;
assert(qdec);
len = nghttp3_qpack_decoder_get_decoder_streamlen(qdec);
if (len == 0) {
return 0;
}
rv = nghttp3_stream_ensure_chunk(stream, len);
if (rv != 0) {
return rv;
}
chunk = nghttp3_stream_get_chunk(stream);
typed_buf_shared_init(&tbuf, chunk);
nghttp3_qpack_decoder_write_decoder(qdec, chunk);
tbuf.buf.last = chunk->last;
return nghttp3_stream_outq_add(stream, &tbuf);
}
int nghttp3_stream_outq_add(nghttp3_stream *stream,
const nghttp3_typed_buf *tbuf) {
nghttp3_ringbuf *outq = &stream->outq;
int rv;
nghttp3_typed_buf *dest;
size_t len = nghttp3_ringbuf_len(outq);
size_t buflen = nghttp3_buf_len(&tbuf->buf);
if (buflen > NGHTTP3_MAX_VARINT - stream->tx.offset) {
return NGHTTP3_ERR_STREAM_DATA_OVERFLOW;
}
stream->tx.offset += buflen;
stream->unsent_bytes += buflen;
if (len) {
dest = nghttp3_ringbuf_get(outq, len - 1);
if (dest->type == tbuf->type && dest->type == NGHTTP3_BUF_TYPE_SHARED &&
dest->buf.begin == tbuf->buf.begin && dest->buf.last == tbuf->buf.pos) {
/* If we have already written last entry, adjust outq_idx and
offset so that this entry is eligible to send. */
if (len == stream->outq_idx) {
--stream->outq_idx;
stream->outq_offset = nghttp3_buf_len(&dest->buf);
}
dest->buf.last = tbuf->buf.last;
/* TODO Is this required? */
dest->buf.end = tbuf->buf.end;
return 0;
}
}
if (nghttp3_ringbuf_full(outq)) {
size_t nlen = nghttp3_max(NGHTTP3_MIN_RBLEN, len * 2);
rv = nghttp3_ringbuf_reserve(outq, nlen);
if (rv != 0) {
return rv;
}
}
dest = nghttp3_ringbuf_push_back(outq);
*dest = *tbuf;
return 0;
}
int nghttp3_stream_ensure_chunk(nghttp3_stream *stream, size_t need) {
nghttp3_ringbuf *chunks = &stream->chunks;
nghttp3_buf *chunk;
size_t len = nghttp3_ringbuf_len(chunks);
uint8_t *p;
int rv;
size_t n = NGHTTP3_STREAM_MIN_CHUNK_SIZE;
if (len) {
chunk = nghttp3_ringbuf_get(chunks, len - 1);
if (nghttp3_buf_left(chunk) >= need) {
return 0;
}
}
for (; n < need; n *= 2)
;
if (n == NGHTTP3_STREAM_MIN_CHUNK_SIZE) {
p = (uint8_t *)nghttp3_objalloc_chunk_len_get(stream->out_chunk_objalloc,
n);
} else {
p = nghttp3_mem_malloc(stream->mem, n);
}
if (p == NULL) {
return NGHTTP3_ERR_NOMEM;
}
if (nghttp3_ringbuf_full(chunks)) {
size_t nlen = nghttp3_max(NGHTTP3_MIN_RBLEN, len * 2);
rv = nghttp3_ringbuf_reserve(chunks, nlen);
if (rv != 0) {
return rv;
}
}
chunk = nghttp3_ringbuf_push_back(chunks);
nghttp3_buf_wrap_init(chunk, p, n);
return 0;
}
nghttp3_buf *nghttp3_stream_get_chunk(nghttp3_stream *stream) {
nghttp3_ringbuf *chunks = &stream->chunks;
size_t len = nghttp3_ringbuf_len(chunks);
assert(len);
return nghttp3_ringbuf_get(chunks, len - 1);
}
int nghttp3_stream_is_blocked(nghttp3_stream *stream) {
return (stream->flags & NGHTTP3_STREAM_FLAG_FC_BLOCKED) ||
(stream->flags & NGHTTP3_STREAM_FLAG_SHUT_WR) ||
(stream->flags & NGHTTP3_STREAM_FLAG_READ_DATA_BLOCKED);
}
int nghttp3_stream_require_schedule(nghttp3_stream *stream) {
return (!nghttp3_stream_outq_write_done(stream) &&
!(stream->flags & NGHTTP3_STREAM_FLAG_FC_BLOCKED) &&
!(stream->flags & NGHTTP3_STREAM_FLAG_SHUT_WR)) ||
(nghttp3_ringbuf_len(&stream->frq) &&
!(stream->flags & NGHTTP3_STREAM_FLAG_READ_DATA_BLOCKED));
}
size_t nghttp3_stream_writev(nghttp3_stream *stream, int *pfin,
nghttp3_vec *vec, size_t veccnt) {
nghttp3_ringbuf *outq = &stream->outq;
size_t len = nghttp3_ringbuf_len(outq);
size_t i = stream->outq_idx;
uint64_t offset = stream->outq_offset;
size_t buflen;
nghttp3_vec *vbegin = vec, *vend = vec + veccnt;
nghttp3_typed_buf *tbuf;
assert(veccnt > 0);
if (i < len) {
tbuf = nghttp3_ringbuf_get(outq, i);
buflen = nghttp3_buf_len(&tbuf->buf);
if (offset < buflen) {
vec->base = tbuf->buf.pos + offset;
vec->len = (size_t)(buflen - offset);
++vec;
} else {
/* This is the only case that satisfies offset >= buflen */
assert(0 == offset);
assert(0 == buflen);
}
++i;
for (; i < len && vec != vend; ++i, ++vec) {
tbuf = nghttp3_ringbuf_get(outq, i);
vec->base = tbuf->buf.pos;
vec->len = nghttp3_buf_len(&tbuf->buf);
}
}
/* TODO Rework this if we have finished implementing HTTP
messaging */
*pfin = nghttp3_ringbuf_len(&stream->frq) == 0 && i == len &&
(stream->flags & NGHTTP3_STREAM_FLAG_WRITE_END_STREAM);
return (size_t)(vec - vbegin);
}
void nghttp3_stream_add_outq_offset(nghttp3_stream *stream, size_t n) {
nghttp3_ringbuf *outq = &stream->outq;
size_t i;
size_t len = nghttp3_ringbuf_len(outq);
uint64_t offset = stream->outq_offset + n;
size_t buflen;
nghttp3_typed_buf *tbuf;
for (i = stream->outq_idx; i < len; ++i) {
tbuf = nghttp3_ringbuf_get(outq, i);
buflen = nghttp3_buf_len(&tbuf->buf);
if (offset >= buflen) {
offset -= buflen;
continue;
}
break;
}
assert(i < len || offset == 0);
stream->unsent_bytes -= n;
stream->outq_idx = i;
stream->outq_offset = offset;
}
int nghttp3_stream_outq_write_done(nghttp3_stream *stream) {
nghttp3_ringbuf *outq = &stream->outq;
size_t len = nghttp3_ringbuf_len(outq);
return len == 0 || stream->outq_idx >= len;
}
static void stream_pop_outq_entry(nghttp3_stream *stream,
nghttp3_typed_buf *tbuf) {
nghttp3_ringbuf *chunks = &stream->chunks;
nghttp3_buf *chunk;
switch (tbuf->type) {
case NGHTTP3_BUF_TYPE_PRIVATE:
nghttp3_buf_free(&tbuf->buf, stream->mem);
break;
case NGHTTP3_BUF_TYPE_ALIEN:
break;
case NGHTTP3_BUF_TYPE_SHARED:
assert(nghttp3_ringbuf_len(chunks));
chunk = nghttp3_ringbuf_get(chunks, 0);
assert(chunk->begin == tbuf->buf.begin);
assert(chunk->end == tbuf->buf.end);
if (chunk->last == tbuf->buf.last) {
if (nghttp3_buf_cap(chunk) == NGHTTP3_STREAM_MIN_CHUNK_SIZE) {
nghttp3_objalloc_chunk_release(stream->out_chunk_objalloc,
(nghttp3_chunk *)(void *)chunk->begin);
} else {
nghttp3_buf_free(chunk, stream->mem);
}
nghttp3_ringbuf_pop_front(chunks);
}
break;
default:
nghttp3_unreachable();
};
nghttp3_ringbuf_pop_front(&stream->outq);
}
int nghttp3_stream_add_ack_offset(nghttp3_stream *stream, uint64_t n) {
nghttp3_ringbuf *outq = &stream->outq;
uint64_t offset = stream->ack_offset + n;
size_t buflen;
size_t npopped = 0;
uint64_t nack;
nghttp3_typed_buf *tbuf;
int rv;
for (; nghttp3_ringbuf_len(outq);) {
tbuf = nghttp3_ringbuf_get(outq, 0);
buflen = nghttp3_buf_len(&tbuf->buf);
if (tbuf->type == NGHTTP3_BUF_TYPE_ALIEN) {
nack = nghttp3_min(offset, (uint64_t)buflen) - stream->ack_done;
if (stream->callbacks.acked_data) {
rv = stream->callbacks.acked_data(stream, stream->node.id, nack,
stream->user_data);
if (rv != 0) {
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
}
stream->ack_done += nack;
}
if (offset >= buflen) {
stream_pop_outq_entry(stream, tbuf);
offset -= buflen;
++npopped;
stream->ack_done = 0;
if (stream->outq_idx + 1 == npopped) {
stream->outq_offset = 0;
break;
}
continue;
}
break;
}
assert(stream->outq_idx + 1 >= npopped);
if (stream->outq_idx >= npopped) {
stream->outq_idx -= npopped;
} else {
stream->outq_idx = 0;
}
stream->ack_offset = offset;
return 0;
}
int nghttp3_stream_buffer_data(nghttp3_stream *stream, const uint8_t *data,
size_t datalen) {
nghttp3_ringbuf *inq = &stream->inq;
size_t len = nghttp3_ringbuf_len(inq);
nghttp3_buf *buf;
size_t nwrite;
uint8_t *rawbuf;
size_t bufleft;
int rv;
if (len) {
buf = nghttp3_ringbuf_get(inq, len - 1);
bufleft = nghttp3_buf_left(buf);
nwrite = nghttp3_min(datalen, bufleft);
buf->last = nghttp3_cpymem(buf->last, data, nwrite);
data += nwrite;
datalen -= nwrite;
}
for (; datalen;) {
if (nghttp3_ringbuf_full(inq)) {
size_t nlen =
nghttp3_max(NGHTTP3_MIN_RBLEN, nghttp3_ringbuf_len(inq) * 2);
rv = nghttp3_ringbuf_reserve(inq, nlen);
if (rv != 0) {
return rv;
}
}
rawbuf = nghttp3_mem_malloc(stream->mem, 16384);
if (rawbuf == NULL) {
return NGHTTP3_ERR_NOMEM;
}
buf = nghttp3_ringbuf_push_back(inq);
nghttp3_buf_wrap_init(buf, rawbuf, 16384);
bufleft = nghttp3_buf_left(buf);
nwrite = nghttp3_min(datalen, bufleft);
buf->last = nghttp3_cpymem(buf->last, data, nwrite);
data += nwrite;
datalen -= nwrite;
}
return 0;
}
size_t nghttp3_stream_get_buffered_datalen(nghttp3_stream *stream) {
nghttp3_ringbuf *inq = &stream->inq;
size_t len = nghttp3_ringbuf_len(inq);
size_t i, n = 0;
nghttp3_buf *buf;
for (i = 0; i < len; ++i) {
buf = nghttp3_ringbuf_get(inq, i);
n += nghttp3_buf_len(buf);
}
return n;
}
int nghttp3_stream_transit_rx_http_state(nghttp3_stream *stream,
nghttp3_stream_http_event event) {
int rv;
switch (stream->rx.hstate) {
case NGHTTP3_HTTP_STATE_NONE:
return NGHTTP3_ERR_H3_INTERNAL_ERROR;
case NGHTTP3_HTTP_STATE_REQ_INITIAL:
switch (event) {
case NGHTTP3_HTTP_EVENT_HEADERS_BEGIN:
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_HEADERS_BEGIN;
return 0;
default:
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
case NGHTTP3_HTTP_STATE_REQ_HEADERS_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_HEADERS_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_HEADERS_END;
return 0;
case NGHTTP3_HTTP_STATE_REQ_HEADERS_END:
switch (event) {
case NGHTTP3_HTTP_EVENT_HEADERS_BEGIN:
/* TODO Better to check status code */
if (stream->rx.http.flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_TRAILERS_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_DATA_BEGIN:
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_DATA_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_MSG_END:
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_END;
return 0;
default:
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
case NGHTTP3_HTTP_STATE_REQ_DATA_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_DATA_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_DATA_END;
return 0;
case NGHTTP3_HTTP_STATE_REQ_DATA_END:
switch (event) {
case NGHTTP3_HTTP_EVENT_DATA_BEGIN:
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_DATA_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_HEADERS_BEGIN:
/* TODO Better to check status code */
if (stream->rx.http.flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_TRAILERS_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_MSG_END:
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_END;
return 0;
default:
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
case NGHTTP3_HTTP_STATE_REQ_TRAILERS_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_HEADERS_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_TRAILERS_END;
return 0;
case NGHTTP3_HTTP_STATE_REQ_TRAILERS_END:
if (event != NGHTTP3_HTTP_EVENT_MSG_END) {
/* TODO Should ignore unexpected frame in this state as per
spec. */
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_REQ_END;
return 0;
case NGHTTP3_HTTP_STATE_REQ_END:
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
case NGHTTP3_HTTP_STATE_RESP_INITIAL:
if (event != NGHTTP3_HTTP_EVENT_HEADERS_BEGIN) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_HEADERS_BEGIN;
return 0;
case NGHTTP3_HTTP_STATE_RESP_HEADERS_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_HEADERS_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_HEADERS_END;
return 0;
case NGHTTP3_HTTP_STATE_RESP_HEADERS_END:
switch (event) {
case NGHTTP3_HTTP_EVENT_HEADERS_BEGIN:
if (stream->rx.http.status_code == -1) {
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_HEADERS_BEGIN;
return 0;
}
if ((stream->rx.http.flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) &&
stream->rx.http.status_code / 100 == 2) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_TRAILERS_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_DATA_BEGIN:
if (stream->rx.http.flags & NGHTTP3_HTTP_FLAG_EXPECT_FINAL_RESPONSE) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_DATA_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_MSG_END:
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_END;
return 0;
default:
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
case NGHTTP3_HTTP_STATE_RESP_DATA_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_DATA_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_DATA_END;
return 0;
case NGHTTP3_HTTP_STATE_RESP_DATA_END:
switch (event) {
case NGHTTP3_HTTP_EVENT_DATA_BEGIN:
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_DATA_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_HEADERS_BEGIN:
if ((stream->rx.http.flags & NGHTTP3_HTTP_FLAG_METH_CONNECT) &&
stream->rx.http.status_code / 100 == 2) {
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_TRAILERS_BEGIN;
return 0;
case NGHTTP3_HTTP_EVENT_MSG_END:
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_END;
return 0;
default:
return NGHTTP3_ERR_H3_FRAME_UNEXPECTED;
}
case NGHTTP3_HTTP_STATE_RESP_TRAILERS_BEGIN:
if (event != NGHTTP3_HTTP_EVENT_HEADERS_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_TRAILERS_END;
return 0;
case NGHTTP3_HTTP_STATE_RESP_TRAILERS_END:
if (event != NGHTTP3_HTTP_EVENT_MSG_END) {
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
rv = nghttp3_http_on_remote_end_stream(stream);
if (rv != 0) {
return rv;
}
stream->rx.hstate = NGHTTP3_HTTP_STATE_RESP_END;
return 0;
case NGHTTP3_HTTP_STATE_RESP_END:
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
default:
nghttp3_unreachable();
}
}
int nghttp3_stream_empty_headers_allowed(nghttp3_stream *stream) {
switch (stream->rx.hstate) {
case NGHTTP3_HTTP_STATE_REQ_TRAILERS_BEGIN:
case NGHTTP3_HTTP_STATE_RESP_TRAILERS_BEGIN:
return 0;
default:
return NGHTTP3_ERR_MALFORMED_HTTP_MESSAGING;
}
}
int nghttp3_stream_uni(int64_t stream_id) { return (stream_id & 0x2) != 0; }
int nghttp3_client_stream_bidi(int64_t stream_id) {
return (stream_id & 0x3) == 0;
}
int nghttp3_client_stream_uni(int64_t stream_id) {
return (stream_id & 0x3) == 0x2;
}
int nghttp3_server_stream_uni(int64_t stream_id) {
return (stream_id & 0x3) == 0x3;
}
|
31d9066f5aa99fc9618265a98c3ce1896c3e95b0
|
0cc343d927d5db6693006018986715c43acab961
|
/examples/preprocessor/multiple_include2.h
|
4fdac74d608a81a2959adf7d37eb299bb9a611e7
|
[
"MIT"
] |
permissive
|
verifast/verifast
|
ec0101fc4a69bd33c5f66be4444169c4e060ead8
|
d152da790c7ebf72ce616533a6c83082629adbdb
|
refs/heads/master
| 2023-08-25T00:13:51.464802
| 2023-08-13T10:00:00
| 2023-08-13T10:00:00
| 14,519,163
| 325
| 64
|
NOASSERTION
| 2023-08-10T21:16:08
| 2013-11-19T08:57:02
|
OCaml
|
UTF-8
|
C
| false
| false
| 222
|
h
|
multiple_include2.h
|
#ifndef MULTIPLE_INCLUDE2_H
#define MULTIPLE_INCLUDE2_H
#include "multiple_include3.h"
void decrement(int* count)
//@ requires integer(count,?count0);
//@ ensures integer(count,count0 - 1);
{
(*count)--;
}
#endif
|
0503a8faeca8f020d04eda72dc5f0050841b5691
|
68bc5885147e5a0294f716e0ea7c5cb79cb54b31
|
/test/fuzz.h
|
5c34e8fee7435dc61bc4f60538af284f40902439
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
NTAP/quant
|
ebcdc38b1c5b38db86a50118c77bc6d8a68df71a
|
dc77211c300fbf677c016796f4eeecb8fc542ffe
|
refs/heads/main
| 2023-08-21T19:43:04.122856
| 2023-08-08T13:57:35
| 2023-08-08T13:57:35
| 75,819,176
| 275
| 41
|
BSD-2-Clause
| 2023-08-08T13:57:37
| 2016-12-07T09:12:31
|
C
|
UTF-8
|
C
| false
| false
| 2,288
|
h
|
fuzz.h
|
// SPDX-License-Identifier: BSD-2-Clause
//
// Copyright (c) 2016-2022, NetApp, 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 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.
#pragma once
#include <netinet/in.h>
#include <stdint.h>
#include <quant/quant.h>
#include "conn.h"
extern int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size);
static void * w;
static struct q_conn * c = 0;
static void mk_conn()
{
if (likely(c))
free_conn(c);
c = new_conn(w, 0, 0, 0,
&(struct w_sockaddr){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmany-braces-around-scalar-init"
.addr = {.af = AF_INET6, .ip6 = IN6ADDR_LOOPBACK_INIT},
#pragma clang diagnostic pop
.port = bswap16(5678)},
"fuzzer", 0, 0, 0);
init_tls(c, "", 0);
}
static int init(void)
{
util_dlevel = CRT;
w = q_init("lo"
#ifndef __linux__
"0"
#endif
,
0);
w_init_rand();
mk_conn();
return 0;
}
|
fbd11b53b28a0ca5325539b5ee0e6f58cadbc5fc
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/sysutils/xentools415/patches/patch-tools_libs_xenstore_xenstored_control.c
|
7eea884d485bf889df800f5a9b4a32b5924be7f0
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 636
|
c
|
patch-tools_libs_xenstore_xenstored_control.c
|
$NetBSD: patch-tools_libs_xenstore_xenstored_control.c,v 1.1 2021/04/18 12:31:26 bouyer Exp $
error: array subscript has type 'char' [-Werror=char-subscripts]
--- tools/xenstore/xenstored_control.c.orig 2021-04-17 22:20:28.658953461 +0200
+++ tools/xenstore/xenstored_control.c 2021-04-17 22:20:41.265121523 +0200
@@ -601,7 +601,7 @@
if (lu_status->cmdline) {
argc = 4; /* At least one arg + progname + "-U" + NULL. */
for (i = 0; lu_status->cmdline[i]; i++)
- if (isspace(lu_status->cmdline[i]))
+ if (isspace((unsigned char)lu_status->cmdline[i]))
argc++;
argv = talloc_array(ctx, char *, argc);
if (!argv)
|
5b64148a7e737840b65dcdbb3d31e1fe6b535810
|
59864cbd213b5da6f50d6255b0a021564b3d5bd4
|
/challenges/Enslavednode_chat/src/main.c
|
729e23508ecd590a0bbb9490373a27637509ee82
|
[
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown",
"BSD-2-Clause"
] |
permissive
|
trailofbits/cb-multios
|
8af96a4fbc3b34644367faa135347f88e0e0d0a3
|
810d7b24b1f62f56ef49b148fe155b0d0629cad2
|
refs/heads/master
| 2023-09-05T03:56:20.229403
| 2022-12-27T15:47:54
| 2022-12-27T15:47:54
| 41,688,943
| 522
| 133
|
MIT
| 2023-06-29T02:47:13
| 2015-08-31T17:04:31
|
C
|
UTF-8
|
C
| false
| false
| 8,305
|
c
|
main.c
|
/*
* Copyright (c) 2015 Kaprica Security, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include "libcgc.h"
#include "cgc_ctype.h"
#include "cgc_stdlib.h"
#include "cgc_string.h"
#include "cgc_common.h"
#include "cgc_corpus.h"
#include "cgc_error.h"
#include "cgc_list.h"
#include "cgc_tree.h"
#include "cgc_wl.h"
#include "cgc_string.h"
tree *cgc_ct = NULL;
typedef struct cmd cmd;
struct cmd {
const char *keyword;
int (*fp)(const char *s);
};
int cgc_hello_cmd(const char *s)
{
cgc_printf("case > Hello, you.\n");
return 0;
}
int cgc_int_cmd(const char *s)
{
cgc_size_t i = 0;
for (list *it = cgc_tree_to_list(cgc_ct); it; it = it ->n)
i += cgc_len_list(it->d);
cgc_size_t n = cgc_num_nodes(cgc_ct);
cgc_printf("case > I have an intelligence rating of: %u / %u\n", i, (n * 8));
return 0;
}
int cgc_rev_cmd(const char *s)
{
char *r = cgc_calloc(1, cgc_strlen(s) + 1);
cgc_strcpy(r, s);
if (!cgc_strchr(r, '\0'))
return -1;
char *start = r;
char *end = cgc_strchr(r, '\0') - 1;
while (start < end) {
*start ^= *end;
*end ^= *start;
*start ^= *end;
start++, end--;
}
cgc_printf("case > %s\n", r);
cgc_free(r);
return 0;
}
int cgc_pont_cmd(const char *s)
{
#define MAD_SIZE 10
char *mad[MAD_SIZE] = {
NULL,
" is ",
"a ",
"symptom ",
"of ",
"the ",
NULL,
" ",
NULL,
" complex."
};
if (!s)
return -1;
list *passed = cgc_split_words(s, 0);
string *resp = cgc_new_string("Hmm, I think that ");
if (!passed || !resp)
return -1;
for (int i = 0; i < MAD_SIZE; i++) {
if (mad[i] == NULL) {
const DATA e = cgc_random_element(passed);
if (!e)
return -1;
cgc_append_string(resp, e);
} else {
cgc_append_string(resp, mad[i]);
}
}
string *ret = cgc_new_string(resp->d);
if (!ret)
return -1;
cgc_free_string(resp);
cgc_printf("molly > %s\n", ret->d);
cgc_free_string(ret);
cgc_free_list(passed, 0);
return 0;
}
int cgc_part_cmd(const char *s)
{
cgc_printf("BYE!\n");
cgc_exit(0);
return 0;
}
cmd hello = {
.keyword = "/hello",
.fp = cgc_hello_cmd
};
cmd _int = {
.keyword = "/howsmart",
.fp = cgc_int_cmd
};
cmd rev = {
.keyword = "/rev",
.fp = cgc_rev_cmd
};
cmd pont = {
.keyword = "/pont",
.fp = cgc_pont_cmd
};
cmd part = {
.keyword = "/part",
.fp = cgc_part_cmd
};
list *cgc_b1_cmds = NULL;
list *cgc_b2_cmds = NULL;
string *cgc_crosstalk = NULL;
int cgc_is_command(const char *s, list *cmds)
{
if (!s)
return 0;
if (!cgc_strlen(s))
return 0;
for (list *it = cmds; it; it = it->n) {
cmd *x = (cmd *)it->d;
if (!cgc_strncmp(s, x->keyword, cgc_strlen(x->keyword)))
return 1;
}
return 0;
}
cmd *cgc_get_command(const char *s, list *cmds)
{
if (!s)
return NULL;
for (list *it = cmds; it; it = it->n) {
cmd *x = (cmd *)it->d;
if (!cgc_strncmp(s, x->keyword, cgc_strlen(x->keyword)))
return x;
}
return NULL;
}
int cgc_will_chat(unsigned n)
{
unsigned p;
cgc_size_t wrote;
if (cgc_random(&p, sizeof(unsigned), &wrote) < 0)
return 0;
if (wrote == sizeof(unsigned) && (p % 100) <= n)
return 1;
else
return 0;
}
list *cgc_follow_chain(list *word_list, cgc_size_t times)
{
#define MAX_WORDS 15
if (!word_list || !times)
return NULL;
list *generated = NULL;
list *msg = NULL;
list *l = cgc_upto_last(word_list);
if (!l)
return NULL;
HASH k = cgc_key_from_wordlist(l);
if (!k)
return NULL;
for (cgc_size_t i = 0; i < times; i++) {
list *t = cgc_copy_list(l, 0, 0);
msg = NULL;
for (cgc_size_t nw = 0; nw < MAX_WORDS; nw++) {
const void *first_word = cgc_lindex(t, 0);
cgc_append_list(&msg, first_word, 1);
list *list_for_key = cgc_get_tree(cgc_ct, k);
if (!list_for_key) {
break;
}
char *random_next = (char *)cgc_random_element(list_for_key);
if (!random_next)
error(ELIST);
t = cgc_copy_list(t, 1, 0);
cgc_append_list(&t, random_next, 1);
k = cgc_key_from_wordlist(t);
}
cgc_append_list(&generated, msg, 1);
}
return generated;
}
list *cgc_gen_msg(list *lists)
{
list *msg = NULL;
for (list *it = lists; it ; it = it->n) {
list *tmp = cgc_follow_chain((list *)it->d, 5);
for (list *it2 = tmp; it2; it2 = it2->n)
if (!msg || cgc_len_list(it2->d) > cgc_len_list(msg))
msg = (list *)it2->d;
}
return msg;
}
string *cgc_wordlist_to_string(list *l)
{
if (!l)
return NULL;
string *s = cgc_new_string(NULL);
for (list *it = l; it ; it = it->n) {
if (cgc_append_string(s, it->d) < 0)
goto err;
if (cgc_append_string(s, " ") < 0)
goto err;
}
return s;
err:
cgc_free_string(s);
return NULL;
}
int cgc_tick_common(const char *s, list *cmds, const char *botname, unsigned ctyn)
{
cmd *c = NULL;
if (cgc_is_command(s, cmds)) {
c = cgc_get_command(s, cmds);
if (!c)
error(ECMD);
if (cgc_strchr(s, ' '))
s = cgc_strchr(s, ' ') + 1;
else
s = s + cgc_strlen(c->keyword);
c->fp(s);
return 0;
}
list *lists = cgc_str_to_wordlists(s);
if (!lists)
return 0;
list *gm = cgc_gen_msg(lists);
string *res = cgc_wordlist_to_string(gm);
if (res && cgc_will_chat(ctyn))
cgc_printf("%s > %s\n", botname, res->d);
cgc_crosstalk = res;
if (cgc_insert_wordlists(lists, &cgc_ct) < 0)
return -1;
return 0;
}
int cgc_tick_main_bot(const char *s)
{
return cgc_tick_common(s, cgc_b1_cmds, "case", 33);
}
int cgc_tick_buddy_bot(const char *s)
{
return cgc_tick_common(s, cgc_b2_cmds, "molly", 10);
}
void cgc_print_prompt(void)
{
cgc_printf("%s", "you > ");
}
void cgc_load_corpus(void)
{
char **sentence = (char **)sentences;
while (*sentence) {
list *l = cgc_split_words(*sentence, 1);
if (!l)
error(ELIST);
if (cgc_insert_wordlist(l, &cgc_ct) < 0)
error(ELIST);
sentence++;
}
}
void cgc_init(void)
{
cgc_append_list(&cgc_b1_cmds, &hello, 0);
cgc_append_list(&cgc_b1_cmds, &_int, 0);
cgc_append_list(&cgc_b1_cmds, &rev, 0);
cgc_append_list(&cgc_b1_cmds, &part, 0);
cgc_append_list(&cgc_b2_cmds, &pont, 0);
cgc_ct = cgc_init_tree(cgc_hash_str("ROOT NODE"), "ROOT NODE");
cgc_crosstalk = NULL;
cgc_load_corpus();
char *welcome = "\n"
"Welcome to the Enslavednode chat server!\n"
"The bots here love to talk, but they are shy...\n"
"You need to get the ball rolling.\n";
cgc_printf("%s", welcome);
}
int main(int cgc_argc, char *cgc_argv[])
{
#define BUF_SIZE 8126
char *buf = NULL;
cgc_size_t rx;
cgc_init();
while (1) {
buf = cgc_calloc(1, BUF_SIZE + 1);
if (!buf)
error(EALLOC);
cgc_print_prompt();
cgc_memset(buf, '\0', BUF_SIZE + 1);
if ((cgc_readline(1, buf, BUF_SIZE, &rx) < 0) || rx == (cgc_size_t)NULL) {
cgc_free(buf);
continue;
}
buf[rx] = '\0';
if (cgc_tick_main_bot((const char *)buf) < 0) {
cgc_free(buf);
break;
}
if (!cgc_crosstalk || !cgc_crosstalk->d) {
cgc_free(buf);
continue;
}
cgc_tick_buddy_bot(cgc_crosstalk->d);
cgc_crosstalk = NULL;
cgc_free(buf);
}
return 0;
}
|
52b1c1fe7d0fb84a189c38d68a9791928abb0e4d
|
bdde837a40e37ef1c47b6acaaf256f304658c652
|
/shared/devdriver/apis/ddEvent/ddEventClient/inc/ddEventClient.h
|
a6f5532e061fe590b054fd19b688c5c5c79cbb8a
|
[
"MIT",
"NCSA",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
GPUOpen-Drivers/pal
|
e09b977fd784fd18447e4b9d208163b316ba5234
|
9a07f5b7883ea0f1c94b330f4960d33c68016c32
|
refs/heads/dev
| 2023-08-22T15:30:04.950288
| 2023-08-02T09:57:54
| 2023-08-02T09:57:55
| 113,846,915
| 336
| 107
|
MIT
| 2023-07-17T17:28:08
| 2017-12-11T10:45:47
|
C++
|
UTF-8
|
C
| false
| false
| 3,312
|
h
|
ddEventClient.h
|
/*
***********************************************************************************************************************
*
* Copyright (c) 2021-2023 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
**********************************************************************************************************************/
#ifndef DD_EVENT_CLIENT_HEADER
#define DD_EVENT_CLIENT_HEADER
#include <ddEventClientApi.h>
#ifdef __cplusplus
extern "C" {
#endif
/// Attempts to create a new client object with the provided creation information
DD_RESULT ddEventClientCreate(
const DDEventClientCreateInfo* pInfo, /// [in] Create info
DDEventClient* phClient); /// [out] Handle to the new client object
/// Destroys an existing client object
void ddEventClientDestroy(
DDEventClient hClient); /// [in] Handle to the existing client object
/// Attempts to read incoming event from the server
///
/// Any data received through the read operation will be returned via the event data callback that was provided during
/// client creation.
DD_RESULT ddEventClientReadEventData(
DDEventClient hClient, /// [in] Handle to an existing client object
uint32_t timeoutInMs); /// Timeout in milliseconds
/// Attempts to fully enable all specified providers on the remote server
///
/// This will enable the providers themselves and all individual events supported by them
DD_RESULT ddEventClientEnableProviders(
DDEventClient hClient, /// [in] Handle to an existing client object
size_t numProviderIds, /// Number of items in the pProviderIds array
const uint32_t* pProviderIds); /// [in] Array of provider ids to send to the server
/// Attempts to fully disable all specified providers on the remote server
///
/// This will disable the providers themselves and all individual events supported by them
DD_RESULT ddEventClientDisableProviders(
DDEventClient hClient, /// [in] Handle to an existing client object
size_t numProviderIds, /// Number of items in the pProviderIds array
const uint32_t* pProviderIds); /// [in] Array of provider ids to send to the server
#ifdef __cplusplus
} // extern "C"
#endif
#endif
|
91059214f6f9b2bffd3620ccdee49b3405f1bc89
|
2b3bbfc742ad6a2529f2906193c3c5263ebd5fac
|
/src/app/driver/ts/vishay/ntcalug01a103g/vishay_ntcalug01a103g.c
|
c324165ec978bec20f6504eaefd509d977f4d12b
|
[
"CC-BY-4.0",
"BSD-3-Clause"
] |
permissive
|
foxBMS/foxbms-2
|
35502ef8441dfc7374fd6c0839e7f5328a5bda8f
|
9eb6d1c44e63e43e62bbf6983b2e618fb6ad02cc
|
refs/heads/master
| 2023-05-22T05:30:25.862475
| 2023-02-23T15:03:35
| 2023-02-24T15:04:15
| 353,751,476
| 151
| 80
|
NOASSERTION
| 2023-09-01T09:59:30
| 2021-04-01T15:52:24
|
C
|
UTF-8
|
C
| false
| false
| 12,764
|
c
|
vishay_ntcalug01a103g.c
|
/**
*
* @copyright © 2010 - 2023, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* 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.
*
* We kindly request you to use one or more of the following phrases to refer to
* foxBMS in your hardware, software, documentation or advertising materials:
*
* - ″This product uses parts of foxBMS®″
* - ″This product includes parts of foxBMS®″
* - ″This product is derived from foxBMS®″
*
*/
/**
* @file vishay_ntcalug01a103g.c
* @author foxBMS Team
* @date 2018-10-30 (date of creation)
* @updated 2023-02-23 (date of last update)
* @version v1.5.1
* @ingroup TEMPERATURE_SENSORS
* @prefix TS
*
* @brief Resistive divider used for measuring temperature
*
*/
/*========== Includes =======================================================*/
#include "vishay_ntcalug01a103g.h"
#include "fassert.h"
#include "foxmath.h"
#include "temperature_sensor_defs.h"
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
/*========== Macros and Definitions =========================================*/
/*========== Static Constant and Variable Definitions =======================*/
/* clang-format off */
/** LUT filled from higher resistance to lower resistance */
static const TS_TEMPERATURE_SENSOR_LUT_s ts_ntcalug01a103gLut[] = {
{ -400, 334274.4f},
{ -390, 312904.4f},
{ -380, 293033.6f},
{ -370, 274548.0f},
{ -360, 257343.1f},
{ -350, 241322.9f},
{ -340, 226398.8f},
{ -330, 212489.7f},
{ -320, 199520.6f},
{ -310, 187422.7f},
{ -300, 176132.5f},
{ -290, 165591.5f},
{ -280, 155745.6f},
{ -270, 146545.1f},
{ -260, 137944.1f},
{ -250, 129900.0f},
{ -240, 122373.7f},
{ -230, 115329.0f},
{ -220, 108732.2f},
{ -210, 102552.5f},
{ -200, 96761.1f },
{ -190, 91331.5f },
{ -180, 86239.0f },
{ -170, 81460.9f },
{ -160, 76976.0f },
{ -150, 72764.6f },
{ -140, 68808.6f },
{ -130, 65091.1f },
{ -120, 61596.4f },
{ -110, 58309.9f },
{ -100, 55218.1f },
{ -90, 52308.4f },
{ -80, 49569.0f },
{ -70, 46989.1f },
{ -60, 44558.56f},
{ -50, 42267.85f},
{ -40, 40108.20f},
{ -30, 38071.41f},
{ -20, 36149.83f},
{ -10, 34336.32f},
{ 0, 32624.23f},
{ 10, 31007.34f},
{ 20, 29479.85f},
{ 30, 28036.35f},
{ 40, 26671.76f},
{ 50, 25381.36f},
{ 60, 24160.73f},
{ 70, 23005.71f},
{ 80, 21912.45f},
{ 90, 20877.31f},
{ 100, 19896.90f},
{ 110, 18968.04f},
{ 120, 18087.75f},
{ 130, 17253.25f},
{ 140, 16461.90f},
{ 150, 15711.26f},
{ 160, 14999.01f},
{ 170, 14323.01f},
{ 180, 13681.22f},
{ 190, 13071.73f},
{ 200, 12492.75f},
{ 210, 11942.59f},
{ 220, 11419.69f},
{ 230, 10922.54f},
{ 240, 10449.75f},
{ 250, 10000.00f},
{ 260, 9572.05f },
{ 270, 9164.74f },
{ 280, 8776.97f },
{ 290, 8407.70f },
{ 300, 8055.96f },
{ 310, 7720.82f },
{ 320, 7401.43f },
{ 330, 7096.96f },
{ 340, 6806.64f },
{ 350, 6529.74f },
{ 360, 6265.58f },
{ 370, 6013.51f },
{ 380, 5772.92f },
{ 390, 5543.22f },
{ 400, 5323.88f },
{ 410, 5114.37f },
{ 420, 4914.20f },
{ 430, 4722.92f },
{ 440, 4540.08f },
{ 450, 4365.27f },
{ 460, 4198.11f },
{ 470, 4038.21f },
{ 480, 3885.23f },
{ 490, 3738.84f },
{ 500, 3598.72f },
{ 510, 3464.58f },
{ 520, 3336.12f },
{ 530, 3213.08f },
{ 540, 3095.22f },
{ 550, 2982.27f },
{ 560, 2874.02f },
{ 570, 2770.26f },
{ 580, 2670.76f },
{ 590, 2575.34f },
{ 600, 2483.82f },
{ 610, 2396.00f },
{ 620, 2311.74f },
{ 630, 2230.85f },
{ 640, 2153.21f },
{ 650, 2078.65f },
{ 660, 2007.05f },
{ 670, 1938.27f },
{ 680, 1872.19f },
{ 690, 1808.69f },
{ 700, 1747.65f },
{ 710, 1688.98f },
{ 720, 1632.56f },
{ 730, 1578.31f },
{ 740, 1526.13f },
{ 750, 1475.92f },
{ 760, 1427.62f },
{ 770, 1381.12f },
{ 780, 1336.37f },
{ 790, 1293.29f },
{ 800, 1251.80f },
{ 810, 1211.85f },
{ 820, 1173.36f },
{ 830, 1136.28f },
{ 840, 1100.55f },
{ 850, 1066.11f },
{ 860, 1032.91f },
{ 870, 1000.91f },
{ 880, 970.05f },
{ 890, 940.29f },
{ 900, 911.59f },
{ 910, 883.89f },
{ 920, 857.17f },
{ 930, 831.38f },
{ 940, 806.49f },
{ 950, 782.46f },
{ 960, 759.26f },
{ 970, 736.85f },
{ 980, 715.21f },
{ 990, 694.31f },
{ 1000, 674.11f },
{ 1010, 654.60f },
{ 1020, 635.74f },
{ 1030, 617.51f },
{ 1040, 599.88f },
{ 1050, 582.84f }
};
/* clang-format on */
/** size of the #ts_ntcalug01a103gLut LUT */
static const uint16_t ts_ntcalug01a103gLutSize = sizeof(ts_ntcalug01a103gLut) / sizeof(TS_TEMPERATURE_SENSOR_LUT_s);
/*========== Extern Constant and Variable Definitions =======================*/
/**
* Defines for calculating the ADC voltage on the ends of the operating range.
* The ADC voltage is calculated with the following formula:
*
* V_adc = ( ( V_supply * R_ntc ) / ( R + R_ntc ) )
*
* Depending on the position of the NTC in the voltage resistor (R_1/R_2),
* different R_ntc values are used for the calculation.
* @{
*/
#if defined(TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && \
(TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
#define TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MAX_V \
(float_t)( \
(TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * \
ts_ntcalug01a103gLut[ts_ntcalug01a103gLutSize - 1].resistance_Ohm) / \
(ts_ntcalug01a103gLut[ts_ntcalug01a103gLutSize - 1].resistance_Ohm + \
TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
#define TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MIN_V \
(float_t)( \
(TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_ntcalug01a103gLut[0].resistance_Ohm) / \
(ts_ntcalug01a103gLut[0].resistance_Ohm + TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
#else /* TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == false */
#define TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MIN_V \
((float_t)((TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_ntcalug01a103gLut[ts_ntcalug01a103gLutSize-1].resistance_Ohm) / (ts_ntcalug01a103gLut[ts_ntcalug01a103gLutSize-1].resistance_Ohm+TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
#define TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MAX_V \
((float_t)((TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_ntcalug01a103gLut[0].resistance_Ohm) / (ts_ntcalug01a103gLut[0].resistance_Ohm+TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
#endif
/**@}*/
/*========== Static Function Prototypes =====================================*/
/*========== Static Function Implementations ================================*/
/*========== Extern Function Implementations ================================*/
extern int16_t TS_Vis00GetTemperatureFromLut(uint16_t adcVoltage_mV) {
int16_t temperature_ddegC = 0;
float_t resistance_Ohm = 0.0f;
float_t adcVoltage_V = adcVoltage_mV / 1000.0f; /* Convert mV to V */
/* Check for valid ADC measurements to prevent undefined behavior */
if (adcVoltage_V > TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MAX_V) {
/* Invalid measured ADC voltage -> sensor out of operating range or disconnected/shorted */
temperature_ddegC = INT16_MIN;
} else if (adcVoltage_V < TS_VISHAY_NTCALUG01A103G_ADC_VOLTAGE_V_MIN_V) {
/* Invalid measured ADC voltage -> sensor out of operating range or shorted/disconnected */
temperature_ddegC = INT16_MAX;
} else {
/* Calculate NTC resistance based on measured ADC voltage */
#if defined(TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && \
(TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
/* R_1 = R_2 * ( ( V_supply / V_adc ) - 1 ) */
resistance_Ohm = TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm *
((TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V / adcVoltage_V) - 1);
#else /* TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == false */
/* R_2 = R_1 * ( V_2 / ( V_supply - V_adc ) ) */
resistance_Ohm = TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm *
(adcVoltage_V / (TS_VISHAY_NTCALUG01A103G_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V - adcVoltage_V));
#endif /* TS_VISHAY_NTCALUG01A103G_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 */
/* Variables for interpolating LUT value */
uint16_t between_high = 0;
uint16_t between_low = 0;
for (uint16_t i = 1u; i < ts_ntcalug01a103gLutSize; i++) {
if (resistance_Ohm < ts_ntcalug01a103gLut[i].resistance_Ohm) {
between_low = i + 1u;
between_high = i;
}
}
/* Interpolate between LUT values, but do not extrapolate LUT! */
if (!(((between_high == 0u) && (between_low == 0u)) || /* measured resistance > maximum LUT resistance */
(between_low >= ts_ntcalug01a103gLutSize))) { /* measured resistance < minimum LUT resistance */
temperature_ddegC = (int16_t)MATH_LinearInterpolation(
ts_ntcalug01a103gLut[between_low].resistance_Ohm,
ts_ntcalug01a103gLut[between_low].temperature_ddegC,
ts_ntcalug01a103gLut[between_high].resistance_Ohm,
ts_ntcalug01a103gLut[between_high].temperature_ddegC,
resistance_Ohm);
}
}
/* Return temperature based on measured NTC resistance */
return temperature_ddegC;
}
extern int16_t TS_Vis00GetTemperatureFromPolynomial(uint16_t adcVoltage_mV) {
(void)adcVoltage_mV;
FAS_ASSERT(FAS_TRAP);
int16_t temperature_ddegC = 0;
/* TODO this is not implemented */
return temperature_ddegC;
}
/*========== Externalized Static Function Implementations (Unit Test) =======*/
#ifdef UNITY_UNIT_TEST
#endif
|
9c29f0f6a2e54ba113227789a592ca7024af1c96
|
4e366db41b2bb755c5a1d8fa8149bf619ac7c970
|
/components/x11/sun-ext-protos/files/include/interactive.h
|
c40f82c6a5261e4d8462be7513ad904c36d4219a
|
[
"MIT"
] |
permissive
|
OpenIndiana/oi-userland
|
0af05f09a04dc95d814fce1d56ff1d74f07fd042
|
a40cd6c757239bcf4e1f0d5943a65d9b57fbc3f7
|
refs/heads/oi/hipster
| 2023-09-04T04:41:58.585774
| 2023-09-03T18:00:28
| 2023-09-03T18:00:28
| 10,007,731
| 220
| 334
| null | 2023-09-14T21:48:26
| 2013-05-12T01:29:19
|
C
|
UTF-8
|
C
| false
| false
| 3,443
|
h
|
interactive.h
|
/*
* Copyright (c) 1993, 1994, Oracle and/or its affiliates. All rights reserved.
*
* 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 (including the next
* paragraph) 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.
*/
/************************************************************
Protocol defs for XIA extension
********************************************************/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#ifndef _INTERACTIVE_H
#define _INTERACTIVE_H
#include <X11/Xproto.h>
#include "interactiveCommon.h"
#define X_IAQueryVersion 0
#define X_IASetProcessInfo 1
#define X_IAGetProcessInfo 2
#define IANumberEvents 0
#define IANumberErrors 0
typedef int ConnectionPidRec;
typedef int * ConnectionPidPtr;
#define IANAME "SolarisIA"
#define IA_MAJOR_VERSION 1 /* current version numbers */
#define IA_MINOR_VERSION 1
typedef struct _IAQueryVersion {
CARD8 reqType; /* always IAReqCode */
CARD8 IAReqType; /* always X_IAQueryVersion */
CARD16 length B16;
} xIAQueryVersionReq;
#define sz_xIAQueryVersionReq 4
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad; /* padding */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD16 majorVersion B16; /* major version of IA protocol */
CARD16 minorVersion B16; /* minor version of IA protocol */
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xIAQueryVersionReply;
#define sz_xIAQueryVersionReply 32
typedef struct _IASetProcessInfo {
CARD8 reqType; /* Always IAReqCode */
CARD8 connectionAttrType; /* What attribute */
CARD16 length B16; /* Request length */
CARD32 flags B32; /* Request flags */
CARD32 uid B32; /* requestor's uid */
} xIASetProcessInfoReq;
#define sz_xIASetProcessInfoReq 12
typedef struct _IAGetProcessInfo {
CARD8 reqType; /* Always IAReqCode */
CARD8 connectionAttrType; /* What attribute */
CARD16 length; /* Request length */
CARD32 flags B32; /* Request flags */
} xIAGetProcessInfoReq;
#define sz_xIAGetProcessInfoReq 8
typedef struct {
BYTE type; /* X_Reply */
CARD8 pad; /* padding */
CARD16 sequenceNumber B16;
CARD32 length B32;
CARD32 count B32;
CARD32 pad1 B32;
CARD32 pad2 B32;
CARD32 pad3 B32;
CARD32 pad4 B32;
CARD32 pad5 B32;
} xIAGetProcessInfoReply;
#define sz_xIAGetProcessInfo 32
#endif
|
8da668ea696c1af299df310ef4457c5d00583b5d
|
505585f1d89447adea3f9519f12255602acdb1b2
|
/src/cvode/fcmix/fcvdense.c
|
56686ea3852a670fe5d7f41f1ccd048a10bfb399
|
[
"BSD-3-Clause"
] |
permissive
|
LLNL/sundials
|
11a879f8c8e7a5e40d78d13d0f9baed04d37a280
|
1ea097bb3bce207335ac35f0b5e78df5d71c6409
|
refs/heads/main
| 2023-08-31T12:36:23.500757
| 2023-07-20T16:50:46
| 2023-07-20T16:50:46
| 105,918,649
| 396
| 120
|
BSD-3-Clause
| 2023-09-14T20:38:05
| 2017-10-05T17:20:03
|
C
|
UTF-8
|
C
| false
| false
| 2,952
|
c
|
fcvdense.c
|
/*
* -----------------------------------------------------------------
* Programmer(s): Daniel R. Reynolds @ SMU
* Alan C. Hindmarsh and Radu Serban @ LLNL
* -----------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2023, Lawrence Livermore National Security
* and Southern Methodist University.
* All rights reserved.
*
* See the top-level LICENSE and NOTICE files for details.
*
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------
* Fortran/C interface routines for CVODE/CVLS, for the case
* of a user-supplied Jacobian approximation routine.
* -----------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include "fcvode.h" /* actual fn. names, prototypes and global vars.*/
#include "cvode_impl.h" /* definition of CVodeMem type */
#include <cvode/cvode_ls.h>
#include <sunmatrix/sunmatrix_dense.h>
/***************************************************************************/
/* Prototype of the Fortran routine */
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
extern void FCV_DJAC(long int *N, realtype *T, realtype *Y,
realtype *FY, realtype *DJAC, realtype *H,
long int *IPAR, realtype *RPAR, realtype *V1,
realtype *V2, realtype *V3, int *ier);
#ifdef __cplusplus
}
#endif
/***************************************************************************/
void FCV_DENSESETJAC(int *flag, int *ier)
{
if (*flag == 0) {
*ier = CVodeSetJacFn(CV_cvodemem, NULL);
} else {
*ier = CVodeSetJacFn(CV_cvodemem, FCVDenseJac);
}
}
/***************************************************************************/
/* C function CVDenseJac interfaces between CVODE and a Fortran subroutine
FCVDJAC for solution of a linear system with dense Jacobian approximation.
Addresses of arguments are passed to FCVDJAC, using accessor functions
from the SUNDenseMatrix and N_Vector modules. */
int FCVDenseJac(realtype t, N_Vector y, N_Vector fy, SUNMatrix J,
void *user_data, N_Vector vtemp1, N_Vector vtemp2,
N_Vector vtemp3)
{
int ier;
realtype *ydata, *fydata, *jacdata, *v1data, *v2data, *v3data;
realtype h;
long int N;
FCVUserData CV_userdata;
CVodeGetLastStep(CV_cvodemem, &h);
ydata = N_VGetArrayPointer(y);
fydata = N_VGetArrayPointer(fy);
v1data = N_VGetArrayPointer(vtemp1);
v2data = N_VGetArrayPointer(vtemp2);
v3data = N_VGetArrayPointer(vtemp3);
N = SUNDenseMatrix_Columns(J);
jacdata = SUNDenseMatrix_Column(J,0);
CV_userdata = (FCVUserData) user_data;
FCV_DJAC(&N, &t, ydata, fydata, jacdata, &h,
CV_userdata->ipar, CV_userdata->rpar, v1data,
v2data, v3data, &ier);
return(ier);
}
|
668ed433c58052c51d32a528114490c8cd54f23b
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/sysv/consts/uc.h
|
8f0b6fde86862d6a098713b250819daaa730a7d8
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 359
|
h
|
uc.h
|
#ifndef COSMOPOLITAN_LIBC_SYSV_CONSTS_UC_H_
#define COSMOPOLITAN_LIBC_SYSV_CONSTS_UC_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define UC_FP_XSTATE 1
#define UC_SIGCONTEXT_SS 2
#define UC_STRICT_RESTORE_SS 4
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SYSV_CONSTS_UC_H_ */
|
8fc39e3906a49b8daf37ecf0fc4ad877e6e5f7a0
|
ecce427678ecff2a93a47f3b1b664202c7d27617
|
/levels/bitfs/areas/1/13/model.inc.c
|
9d292fcaec5a8bf7a3f05d02759512d405c0ea35
|
[] |
no_license
|
sm64pc/sm64ex
|
ecf37f31b3f7426c4874254660d856030d789714
|
54cd27ccee45a2403b45f07a00d6043c51149969
|
refs/heads/nightly
| 2023-08-11T12:14:34.424168
| 2023-07-01T11:45:50
| 2023-07-01T11:45:50
| 262,091,731
| 795
| 238
| null | 2023-07-01T11:45:51
| 2020-05-07T15:43:27
|
C
|
UTF-8
|
C
| false
| false
| 6,041
|
c
|
model.inc.c
|
// 0x07009258 - 0x07009358
static const Vtx bitfs_seg7_vertex_07009258[] = {
{{{ 819, 205, 307}, 0, { 1414, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 512, 0, 614}, 0, { 0, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 819, 0, 307}, 0, { 1414, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 819, 0, -307}, 0, { 0, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 512, 205, -615}, 0, { 1414, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 819, 205, -307}, 0, { 0, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 512, 0, -615}, 0, { 1414, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -511, 205, -615}, 0, { 0, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -511, 0, -615}, 0, { 0, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -818, 0, -307}, 0, { 1414, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -818, 205, -307}, 0, { 1414, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -818, 0, 307}, 0, { -454, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -511, 205, 614}, 0, { 990, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -818, 205, 307}, 0, { -454, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ -511, 0, 614}, 0, { 990, 990}, {0x7d, 0x7d, 0x7d, 0xff}}},
{{{ 512, 205, 614}, 0, { 0, 308}, {0x7d, 0x7d, 0x7d, 0xff}}},
};
// 0x07009358 - 0x07009458
static const Vtx bitfs_seg7_vertex_07009358[] = {
{{{ -818, 0, 307}, 0, { 2016, 990}, {0x64, 0x64, 0x64, 0xff}}},
{{{ -818, 205, -307}, 0, { 0, 308}, {0x64, 0x64, 0x64, 0xff}}},
{{{ -818, 0, -307}, 0, { 0, 990}, {0x64, 0x64, 0x64, 0xff}}},
{{{ -818, 205, 307}, 0, { 2016, 308}, {0x64, 0x64, 0x64, 0xff}}},
{{{ 819, 0, -307}, 0, { 2016, 990}, {0x64, 0x64, 0x64, 0xff}}},
{{{ 819, 205, -307}, 0, { 2016, 308}, {0x64, 0x64, 0x64, 0xff}}},
{{{ 819, 205, 307}, 0, { 0, 308}, {0x64, 0x64, 0x64, 0xff}}},
{{{ 819, 0, 307}, 0, { 0, 990}, {0x64, 0x64, 0x64, 0xff}}},
{{{ -511, 205, -615}, 0, { 3374, 308}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ 512, 205, -615}, 0, { 0, 308}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ 512, 0, -615}, 0, { 0, 990}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ -511, 0, -615}, 0, { 3374, 990}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ 512, 205, 614}, 0, { 3374, 308}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ -511, 0, 614}, 0, { 0, 990}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ 512, 0, 614}, 0, { 3374, 990}, {0x8c, 0x8c, 0x8c, 0xff}}},
{{{ -511, 205, 614}, 0, { 0, 308}, {0x8c, 0x8c, 0x8c, 0xff}}},
};
// 0x07009458 - 0x070094D8
static const Vtx bitfs_seg7_vertex_07009458[] = {
{{{ -818, 205, -307}, 0, { 736, 2522}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 512, 205, 614}, 0, { 1246, -288}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 819, 205, 307}, 0, { 2012, -288}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 819, 205, -307}, 0, { 2780, 480}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 512, 205, -615}, 0, { 2780, 1244}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -511, 205, 614}, 0, { 0, 990}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -511, 205, -615}, 0, { 1502, 2522}, {0xff, 0xff, 0xff, 0xff}}},
{{{ -818, 205, 307}, 0, { 0, 1754}, {0xff, 0xff, 0xff, 0xff}}},
};
// 0x070094D8 - 0x07009588
static const Gfx bitfs_seg7_dl_070094D8[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, bitfs_seg7_texture_07001800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPVertex(bitfs_seg7_vertex_07009258, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0),
gsSP2Triangles( 3, 6, 4, 0x0, 7, 8, 9, 0x0),
gsSP2Triangles(10, 7, 9, 0x0, 11, 12, 13, 0x0),
gsSP2Triangles(11, 14, 12, 0x0, 0, 15, 1, 0x0),
gsSPVertex(bitfs_seg7_vertex_07009358, 16, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 1, 0x0),
gsSP2Triangles( 4, 5, 6, 0x0, 4, 6, 7, 0x0),
gsSP2Triangles( 8, 9, 10, 0x0, 8, 10, 11, 0x0),
gsSP2Triangles(12, 13, 14, 0x0, 12, 15, 13, 0x0),
gsSPEndDisplayList(),
};
// 0x07009588 - 0x070095E0
static const Gfx bitfs_seg7_dl_07009588[] = {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, sky_09001800),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES)),
gsSPVertex(bitfs_seg7_vertex_07009458, 8, 0),
gsSP2Triangles( 0, 1, 2, 0x0, 0, 3, 4, 0x0),
gsSP2Triangles( 0, 2, 3, 0x0, 0, 5, 1, 0x0),
gsSP2Triangles( 0, 4, 6, 0x0, 0, 7, 5, 0x0),
gsSPEndDisplayList(),
};
// 0x070095E0 - 0x07009670
const Gfx bitfs_seg7_dl_070095E0[] = {
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_MODULATERGB, G_CC_MODULATERGB),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_CLAMP, 5, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(bitfs_seg7_dl_070094D8),
gsDPTileSync(),
gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0, G_TX_RENDERTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 5, G_TX_NOLOD),
gsDPSetTileSize(0, 0, 0, (32 - 1) << G_TEXTURE_IMAGE_FRAC, (32 - 1) << G_TEXTURE_IMAGE_FRAC),
gsSPDisplayList(bitfs_seg7_dl_07009588),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPPipeSync(),
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
gsSPSetGeometryMode(G_LIGHTING),
gsSPEndDisplayList(),
};
|
37c245348af0526c33c70cfeca4c1e725c81704f
|
19a9f2c19bcb81c4a14ba17831d3098de7731fb5
|
/ncarg2d/src/libncarg/sppsC/c_kpmy.c
|
51f64b371e0a3c918891017fcd98be1bc59698ee
|
[
"Apache-2.0"
] |
permissive
|
NCAR/ncl
|
243c30eaefce642d53373aa583b73df72eb59f22
|
8a96101fe14d0cf0f5ed66a5e6b1733084bc69df
|
refs/heads/develop
| 2023-03-17T07:53:18.883458
| 2022-05-11T16:01:03
| 2022-05-11T16:01:03
| 67,087,395
| 254
| 68
|
NOASSERTION
| 2022-10-08T07:20:06
| 2016-09-01T01:34:28
|
C
|
UTF-8
|
C
| false
| false
| 871
|
c
|
c_kpmy.c
|
/*
* $Id: c_kpmy.c,v 1.4 2008-07-23 16:17:01 haley Exp $
*/
/************************************************************************
* *
* Copyright (C) 2000 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
* The use of this Software is governed by a License Agreement. *
* *
************************************************************************/
#include <ncarg/ncargC.h>
int c_kpmy
#ifdef NeedFuncProto
(
int iy
)
#else
(iy)
int iy;
#endif
{
return(NGCALLF(kpmy,KPMY)(&iy));
}
|
d6cb7f0a6e3531eb113fa27f8f0005238b9e8bd6
|
35ece1a78314060ee6f815745db24f85012a6c77
|
/texlive/texk/seetexk/dvitodvi.c
|
316892635b7b12f52e4e61fe8ac267c9a3d8b606
|
[
"X11",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
clerkma/ptex-ng
|
dabc12a3df48aef6107efd1b4555f0141f858e12
|
a646d1cfe835712601b7edcfa96ad90c2549778b
|
refs/heads/master
| 2023-08-16T23:10:11.143532
| 2023-08-13T06:52:31
| 2023-08-13T06:52:31
| 24,095,177
| 260
| 46
| null | 2022-06-22T04:57:30
| 2014-09-16T10:25:01
|
C
|
UTF-8
|
C
| false
| false
| 28,833
|
c
|
dvitodvi.c
|
/* Copyright (c) 1987, 1989, 2012, 2020 University of Maryland Department of
Computer Science.
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, this permission
notice and the disclaimer statement 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.
*/
/*
* DVI page rearrangement program
*
* Reads DVI version 2 files and rearranges pages,
* writing a new DVI file.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef KPATHSEA
#include <kpathsea/config.h>
#include <kpathsea/c-fopen.h>
#include <kpathsea/getopt.h>
#if defined(WIN32)
#include <kpathsea/variable.h>
#endif
#else
#define FOPEN_RBIN_MODE "rb"
#define FOPEN_WBIN_MODE "wb"
#define SET_BINARY(x) (void)0
extern char *optarg;
extern int optind;
#endif
#include "types.h"
#include "dviclass.h"
#include "dvicodes.h"
#include "error.h"
#include "fio.h"
#include "gripes.h"
#include "search.h"
#include <stdio.h>
#include <ctype.h>
#include "seek.h"
#include "common.h"
#define white(x) ((x) == ' ' || (x) == '\t' || (x) == ',')
char *ProgName;
/* Globals */
char serrbuf[BUFSIZ]; /* buffer for stderr */
/*
* We will try to keep output lines shorter than MAXCOL characters.
*/
#define MAXCOL 75
/*
* We use the following structure to keep track of fonts we have seen.
* The final DVI file lists only the fonts it uses.
*/
struct fontinfo {
i32 fi_newindex; /* font number in output file */
int fi_reallyused; /* true => used on a page we copied */
i32 fi_checksum; /* the checksum */
i32 fi_mag; /* the magnification */
i32 fi_designsize; /* the design size */
short fi_n1; /* the name header length */
short fi_n2; /* the name body length */
char *fi_name; /* the name itself */
};
i32 Width; /* width of page */
i32 Height; /* height of page */
i32 Magnification; /* Magnification of pages */
int Modulo; /* page spec modulo */
struct pagespec *PageSpecs; /* page specification list */
int SFlag; /* true => -s, silent operation */
struct search *FontFinder; /* maps from input indicies to fontinfo */
i32 NextOutputFontIndex; /* generates output indicies */
i32 CurrentFontIndex; /* current (old) index in input */
i32 OutputFontIndex; /* current (new) index in ouput */
const char *DVIFileName; /* name of input DVI file */
FILE *inf; /* the input file itself */
FILE *outf; /* the output DVI file */
long *StartOfPage; /* The file positions of the input pages */
long StartOfPageSpace; /* Number of entries of StartOfPage array */
long StartOfLastPage; /* The file position just before we
started the last page */
long CurrentPosition; /* The current position of the file */
int UseThisPage; /* true => current page is selected */
int WritingPage; /* true while writing a page */
i32 InputPageNumber; /* current absolute page in old DVI file */
int NumberOfOutputPages; /* number of pages in new DVI file */
#ifdef ASCIIPTEX
int ptexdvi; /* true if dvi file is extended (TATEKUMI) */
#endif
i32 Numerator; /* numerator from DVI file */
i32 Denominator; /* denominator from DVI file */
i32 DVIMag; /* magnification from DVI file */
i32 Count[10]; /* the 10 \count variables */
/* save some string space: we use this a lot */
char writeerr[] = "error writing DVI file";
#ifndef KPATHSEA
void *malloc(), *realloc();
void free();
#endif
static void WriteFont(struct fontinfo *fi);
static void PutFontSelector(i32 index);
static void ScanDVIFile(void);
static void HandleDVIFile(void);
/*
* You may get lint warnings about sprintf's return value.
* Older versions of 4BSD have `char *sprintf()'. ANSI and
* SysV use `int sprintf()'; so ignore the warnings.
*/
/*
* Lint gets somewhat confused over putc.
*/
#ifdef lint
#undef putc
#ifdef ultrix /* grr */
#define putc(c, f) fputc((char)(c), f)
#else
#define putc(c, f) fputc((int)(c), f)
#endif
#endif
static void
specusage(void)
{
error(1, -1, "page specification error:\n\
<pagespecs> = [modulo:][mag@]<spec>\n\
<spec> = [-]pageno[(xoff,yoff)][,spec|+spec]\n\
modulo>=1, 0<=pageno<modulo");
}
/*
* This function calculates approximately (whole + num/den) * sf.
* No need for real extreme accuracy; one ten thousandth of an
* inch should be sufficient.
*
* Assumptions:
*
* 0 <= num < den <= 10000
* 0 <= whole
*/
i32 defaultscale = 4736286 ;
static i32
scale(i32 whole, int num, int den, i32 sf)
{
i32 v ;
if (!sf)
sf = defaultscale ;
v = whole * sf + num * (sf / den) ;
if (v / sf != whole || v < 0 || v > 0x40000000L)
error(1, -1, "arithmetic overflow in dimension") ;
sf = sf % den ;
v += (sf * num * 2 + den) / (2 * den) ;
return (v) ;
}
struct pagespec {
int reversed, pageno, add;
i32 xoff, yoff;
struct pagespec *next;
};
static struct pagespec *
newspec(void)
{
struct pagespec *temp = (struct pagespec *)malloc(sizeof(struct pagespec));
temp->reversed = temp->pageno = temp->add = 0;
temp->xoff = temp->yoff = 0;
temp->next = NULL;
return (temp);
}
static int
parseint(char **sp)
{
char *s = *sp;
int n = 0, neg = 0;
if (*s == '-') {
neg = 1;
s++;
}
for (; isdigit((unsigned char)*s); s++)
n = n*10 + (*s-'0');
if (*sp == s) specusage();
*sp = s;
return (neg ? -n : n);
}
static i32
parsedimen(char **sp)
{
i32 whole = 0;
int num = 0, den = 1, neg = 0;
i32 fac = 0L;
char *s = *sp;
if (*s == '-') {
neg = 1;
*sp = ++s;
}
for (; isdigit((unsigned char)*s); s++)
whole = whole*10 + (*s-'0');
if (*s == '.') {
*sp = ++s;
for (; isdigit((unsigned char)*s); s++) {
if (den < 10000) { /* limit precision for scale to work */
num = num*10 + (*s-'0');
den *= 10;
}
}
}
if (*sp == s) specusage();
*sp = s;
/*
* Allowed units are `in', `cm', `mm', `pt', `sp', `cc', `dd', and `pc';
* must be in lower case.
*/
if (*s == 'c' && s[1] == 'm') {
/* centimeters need to be scaled by 72.27 * 216 / 2.54, or 1 864 680 */
fac = 1864680L ;
s += 2;
} else if (*s == 'p' && s[1] == 't') {
/* real points need to be scaled by 65536 */
fac = 65536L ;
s += 2;
} else if (*s == 'p' && s[1] == 'c') {
/* picas need to be scaled by 65536 * 12, or 786 432 */
fac = 786432L ;
s += 2;
} else if (*s == 'm' && s[1] == 'm') {
/* millimeters need to be scaled by 72.27 * 216 / 25.4, or 186 468 */
fac = 186468L ;
s += 2;
} else if (*s == 's' && s[1] == 'p') {
/* scaled points are already taken care of; simply round */
fac = 1L ;
s += 2;
} else if (*s == 'b' && s[1] == 'p') {
/* big points need to be scaled by 72.27 * 65536 / 72, or 65782 */
fac = 65782L ;
s += 2;
} else if (*s == 'd' && s[1] == 'd') {
/* didot points need to be scaled by 65536 * 1238 / 1157, or 70124 */
fac = 70124L ;
s += 2;
} else if (*s == 'c' && s[1] == 'c') {
/* cicero need to be scaled by 65536 * 1238 / 1157 * 12, or 841 489 */
fac = 841489L ;
s += 2;
} else if (*s == 'i' && s[1] == 'n') {
/* inches need to be scaled by 72.27 * 65536, or 4 736 286 */
fac = 4736286L ;
s += 2;
} else if (*s == 'w') {
fac = Width;
s++;
} else if (*s == 'h') {
fac = Height;
s++;
}
whole = scale(whole, num, den, fac) ;
*sp = s;
return (neg ? -whole : whole);
}
static struct pagespec *
ParseSpecs(char *str, int make)
{
struct pagespec *result, *head, *tail;
int other = 0;
int num = -1;
struct pagespec spare;
if (make)
result = head = tail = newspec();
else {
result = NULL;
head = tail = &spare;
}
while (*str) {
if (isdigit((unsigned char)*str)) {
num = parseint(&str);
} else {
switch (*str++) {
case ':':
if (other || head != tail || num < 1) specusage();
Modulo = num;
num = -1;
break;
case '@':
if (other || head != tail || num < 1) specusage();
Magnification = num;
num = -1;
break;
case '-':
tail->reversed = !tail->reversed;
other = 1;
break;
case '(':
tail->xoff += parsedimen(&str);
if (*str++ != ',') specusage();
tail->yoff += parsedimen(&str);
if (*str++ != ')') specusage();
other = 1;
break;
case '+':
tail->add = 1;
case ',':
if (num < 0 || num >= Modulo) specusage();
tail->pageno = num;
if (make) {
tail->next = newspec();
tail = tail->next;
}
num = -1;
other = 1;
break;
default:
specusage();
}
}
}
if (num >= Modulo)
specusage();
else if (num >= 0)
tail->pageno = num;
return result;
}
static i32
singledimen(char *str)
{
i32 num = parsedimen(&str);
if (*str) return (0);
return (num);
}
/*
* Print a message to stderr, with an optional leading space, and handling
* long line wraps.
*/
static void
message(int space, const char *str, int len)
{
static int beenhere;
static int col;
if (!beenhere)
space = 0, beenhere++;
if (len == 0)
len = strlen(str);
col += len;
if (space) {
if (col >= MAXCOL)
(void) putc('\n', stderr), col = len;
else
(void) putc(' ', stderr), col++;
}
while (--len >= 0)
(void) putc(*str++, stderr);
(void) fflush(stderr);
}
/*
* Start a page (process a DVI_BOP).
*/
static void
BeginPage(int really)
{
register i32 *i;
OutputFontIndex = -1; /* new page requires respecifying font */
for (i = Count; i < &Count[10]; i++)
fGetLong(inf, *i);
(void) GetLong(inf); /* previous page pointer */
if (!UseThisPage || !really)
return;
putbyte(outf, DVI_BOP);
for (i = Count; i < &Count[10]; i++)
PutLong(outf, *i);
PutLong(outf, StartOfLastPage);
if (ferror(outf))
error(1, -1, writeerr);
StartOfLastPage = CurrentPosition;
CurrentPosition += 45; /* we just wrote this much */
if (!SFlag) { /* write nice page usage messages */
register int z = 0;
register int mlen = 0;
char msg[80];
(void) sprintf(msg, "[%ld", (long)Count[0]);
mlen = strlen(msg);
for (i = &Count[1]; i < &Count[10]; i++) {
if (*i == 0) {
z++;
continue;
}
while (--z >= 0)
msg[mlen++] = '.', msg[mlen++] = '0';
z = 0;
(void) sprintf(msg + mlen, ".%ld", (long)*i);
mlen += strlen(msg + mlen);
}
message(1, msg, mlen);
}
WritingPage = 1;
}
/*
* End a page (process a DVI_EOP).
*/
static void
EndPage(int really)
{
if (!UseThisPage || !really)
return;
if (!SFlag)
message(0, "]", 1);
putbyte(outf, DVI_EOP);
if (ferror(outf))
error(1, -1, writeerr);
CurrentPosition++;
NumberOfOutputPages++;
WritingPage = 0;
}
/*
* For each of the fonts used in the new DVI file, write out a definition.
*/
/* ARGSUSED */
static void
PostAmbleFontEnumerator(char *addr, i32 key)
{
if (((struct fontinfo *)addr)->fi_reallyused)
WriteFont((struct fontinfo *)addr);
}
static void
HandlePostAmble(void)
{
register i32 c;
(void) GetLong(inf); /* previous page pointer */
if (GetLong(inf) != Numerator)
GripeMismatchedValue("numerator");
if (GetLong(inf) != Denominator)
GripeMismatchedValue("denominator");
if (GetLong(inf) * Magnification / 1000 != DVIMag)
GripeMismatchedValue("\\magnification");
putbyte(outf, DVI_POST);
PutLong(outf, StartOfLastPage);
PutLong(outf, Numerator);
PutLong(outf, Denominator);
PutLong(outf, DVIMag);
c = GetLong(inf);
PutLong(outf, c); /* tallest page height */
c = GetLong(inf);
PutLong(outf, c); /* widest page width */
c = GetWord(inf)+1;
PutWord(outf, c); /* DVI stack size */
PutWord(outf, NumberOfOutputPages);
StartOfLastPage = CurrentPosition; /* point at post */
CurrentPosition += 29; /* count all those `put's */
#ifdef notdef
(void) GetWord(inf); /* skip original number of pages */
#endif
/*
* just ignore all the incoming font definitions; we are done with
* input file
*/
/*
* run through the FontFinder table and dump definitions for the
* fonts we have used.
*/
SEnumerate(FontFinder, PostAmbleFontEnumerator);
putbyte(outf, DVI_POSTPOST);
PutLong(outf, StartOfLastPage); /* actually start of postamble */
#ifdef ASCIIPTEX
if(ptexdvi)
putbyte(outf, DVI_PTEXVERSION);
else
#endif
putbyte(outf, DVI_VERSION);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
putbyte(outf, DVI_FILLER);
CurrentPosition += 10;
while (CurrentPosition & 3) {
putbyte(outf, DVI_FILLER);
CurrentPosition++;
}
if (ferror(outf))
error(1, -1, writeerr);
}
/*
* Write a font definition to the output file
*/
static void
WriteFont(struct fontinfo *fi)
{
register int l;
register char *s;
if (fi->fi_newindex < 256) {
putbyte(outf, DVI_FNTDEF1);
putbyte(outf, fi->fi_newindex);
CurrentPosition += 2;
} else if (fi->fi_newindex < 65536) {
putbyte(outf, DVI_FNTDEF2);
PutWord(outf, fi->fi_newindex);
CurrentPosition += 3;
} else if (fi->fi_newindex < 16777216) {
putbyte(outf, DVI_FNTDEF3);
Put3Byte(outf, fi->fi_newindex);
CurrentPosition += 4;
} else {
putbyte(outf, DVI_FNTDEF4);
PutLong(outf, fi->fi_newindex);
CurrentPosition += 5;
}
PutLong(outf, fi->fi_checksum);
PutLong(outf, fi->fi_mag);
PutLong(outf, fi->fi_designsize);
putbyte(outf, fi->fi_n1);
putbyte(outf, fi->fi_n2);
l = fi->fi_n1 + fi->fi_n2;
CurrentPosition += 14 + l;
s = fi->fi_name;
while (--l >= 0)
putbyte(outf, *s++);
}
/*
* Handle the preamble. Someday we should update the comment field.
*/
static void
HandlePreAmble(void)
{
register int n, c;
c = getc(inf);
if (c == EOF)
GripeUnexpectedDVIEOF();
if (c != DVI_PRE)
GripeMissingOp("PRE");
if (getc(inf) != DVI_VERSION)
error(1, 0, "%s is not a DVI version %d file",
DVIFileName, DVI_VERSION);
Numerator = GetLong(inf);
Denominator = GetLong(inf);
DVIMag = GetLong(inf) * Magnification / 1000;
putbyte(outf, DVI_PRE);
putbyte(outf, DVI_VERSION);
PutLong(outf, Numerator);
PutLong(outf, Denominator);
PutLong(outf, DVIMag);
n = UnSign8(GetByte(inf));
CurrentPosition = 15 + n; /* well, almost */
putbyte(outf, n);
while (--n >= 0) {
c = GetByte(inf);
putbyte(outf, c);
}
}
int
main(int argc, char **argv)
{
register int c;
register char *s;
char *outname = NULL;
char *specstring = NULL;
#if defined(WIN32) && defined(KPATHSEA)
int ac;
char **av, *enc;
if (argc>1) {
kpse_set_program_name(argv[0], "dvitodvi");
enc = kpse_var_value("command_line_encoding");
if (get_command_line_args_utf8(enc, &ac, &av)) {
argc = ac;
argv = av;
}
}
#endif
Width = 0;
Height = 0;
Magnification = 1000;
Modulo = 1;
ProgName = *argv;
setbuf(stderr, serrbuf);
while ((c = getopt(argc, argv, "i:o:w:h:q")) != EOF) {
switch (c) {
case 'q': /* silent */
SFlag++;
break;
case 'i':
if (DVIFileName != NULL)
goto usage;
DVIFileName = optarg;
break;
case 'o':
if (outname != NULL)
goto usage;
outname = optarg;
break;
case 'w':
if (Width != 0)
goto usage;
Width = singledimen(optarg);
if (Width <= 0)
error(1, -1, "-w parameter must be > 0");
break;
case 'h':
if (Height != 0)
goto usage;
Height = singledimen(optarg);
if (Height <= 0)
error(1, -1, "-h parameter must be > 0");
break;
case '?':
usage:
(void) fprintf(stderr,
"dvitodvi in SeeTeX Ver.%s (%s)\n", VERSION, TL_VERSION);
(void) fprintf(stderr, "\
Usage: %s [-q] [-i infile] [-o outfile] [-w width] [-h height] <pagespecs> [infile [outfile]]\n",
ProgName);
(void) fprintf(stderr,
"\nEmail bug reports to %s.\n", BUG_ADDRESS);
(void) fflush(stderr);
exit(1);
}
}
while (optind < argc) {
s = argv[optind++];
c = *s;
if (specstring == NULL)
(void) ParseSpecs((specstring = s), 0);
else if (DVIFileName == NULL)
DVIFileName = s;
else if (outname == NULL)
outname = s;
else
goto usage;
}
if (specstring == NULL)
goto usage;
if (DVIFileName == NULL) {
DVIFileName = "`stdin'";
inf = stdin;
if (!isatty(fileno(inf)))
SET_BINARY(fileno(inf));
else
goto usage;
} else if ((inf = fopen(DVIFileName, FOPEN_RBIN_MODE)) == 0)
error(1, -1, "cannot read %s", DVIFileName);
if (outname == NULL) {
outf = stdout;
if (!isatty(fileno(outf)))
SET_BINARY(fileno(outf));
}
else if ((outf = fopen(outname, FOPEN_WBIN_MODE)) == 0)
error(1, -1, "cannot write %s", outname);
if ((FontFinder = SCreate(sizeof(struct fontinfo))) == 0)
error(1, 0, "cannot create font finder (out of memory?)");
/* copy inf to TEMP file if not seekable */
if ((inf = SeekFile(inf)) == NULL) {
error(1, 0, "can't seek file");
}
#ifdef ASCIIPTEX
ptexdvi = 0;
#endif
InputPageNumber = 0;
StartOfPageSpace = 32;
StartOfLastPage = -1;
StartOfPage = malloc(sizeof(long) * StartOfPageSpace);
if (!StartOfPage) {
error(1, -1, "cannot allocate list of pages; out of memory");
}
HandlePreAmble();
ScanDVIFile();
if (fseek(inf, 16L, 1) == -1)
error(1, -1, "can't seek postamble");
if (Height == 0) /* get height from postamble */
Height = GetLong(inf);
else
(void) GetLong(inf); /* ignore height */
if (Width == 0) /* get width from postamble */
Width = GetLong(inf);
PageSpecs = ParseSpecs(specstring, 1);
HandleDVIFile();
free(StartOfPage);
if (WritingPage)
EndPage(1);
HandlePostAmble();
if (!SFlag)
(void) fprintf(stderr, "\nWrote %d page%s, %ld bytes\n",
NumberOfOutputPages, NumberOfOutputPages == 1 ? "" : "s",
(long)CurrentPosition);
return 0;
}
/*
* Handle a font definition.
*/
static void
HandleFontDef(i32 index)
{
register struct fontinfo *fi;
register int i;
register char *s;
int def = S_CREATE | S_EXCL;
if (!UseThisPage) {
if ((fi = (struct fontinfo *)SSearch(FontFinder, index, &def)) == 0) {
if (def & S_COLL)
error(1, 0, "font %ld already defined", (long)index);
else
error(1, 0, "cannot stash font %ld (out of memory?)",
(long)index);
}
fi->fi_reallyused = 0;
fi->fi_checksum = GetLong(inf);
fi->fi_mag = GetLong(inf);
fi->fi_designsize = GetLong(inf);
fi->fi_n1 = UnSign8(GetByte(inf));
fi->fi_n2 = UnSign8(GetByte(inf));
i = fi->fi_n1 + fi->fi_n2;
if ((s = malloc((unsigned)i)) == 0)
GripeOutOfMemory(i, "font name");
fi->fi_name = s;
while (--i >= 0)
*s++ = GetByte(inf);
} else {
(void) GetLong(inf);
(void) GetLong(inf);
(void) GetLong(inf);
i = UnSign8(GetByte(inf));
i += UnSign8(GetByte(inf));
while (--i >= 0)
(void) GetByte(inf);
}
}
/*
* Handle a \special.
*/
static void
HandleSpecial(int c, int l, i32 p)
{
register int i;
if (UseThisPage) {
putbyte(outf, c);
switch (l) {
case DPL_UNS1:
putbyte(outf, p);
CurrentPosition += 2;
break;
case DPL_UNS2:
PutWord(outf, p);
CurrentPosition += 3;
break;
case DPL_UNS3:
Put3Byte(outf, p);
CurrentPosition += 4;
break;
case DPL_SGN4:
PutLong(outf, p);
CurrentPosition += 5;
break;
default:
panic("HandleSpecial l=%d", l);
/* NOTREACHED */
}
CurrentPosition += p;
while (--p >= 0) {
i = getc(inf);
putbyte(outf, i);
}
if (feof(inf))
GripeUnexpectedDVIEOF();
if (ferror(outf))
error(1, -1, writeerr);
} else
while (--p >= 0)
(void) getc(inf);
}
static void
ReallyUseFont(void)
{
register struct fontinfo *fi;
int look = S_LOOKUP;
fi = (struct fontinfo *)SSearch(FontFinder, CurrentFontIndex, &look);
if (fi == NULL)
error(1, 0, "DVI file requested font %ld without defining it",
(long)CurrentFontIndex);
if (fi->fi_reallyused == 0) {
fi->fi_reallyused++;
fi->fi_newindex = NextOutputFontIndex++;
WriteFont(fi);
}
if (fi->fi_newindex != OutputFontIndex) {
PutFontSelector(fi->fi_newindex);
OutputFontIndex = fi->fi_newindex;
}
}
/*
* Write a font selection command to the output file
*/
static void
PutFontSelector(i32 index)
{
if (index < 64) {
putbyte(outf, index + DVI_FNTNUM0);
CurrentPosition++;
} else if (index < 256) {
putbyte(outf, DVI_FNT1);
putbyte(outf, index);
CurrentPosition += 2;
} else if (index < 65536) {
putbyte(outf, DVI_FNT2);
PutWord(outf, index);
CurrentPosition += 3;
} else if (index < 16777216) {
putbyte(outf, DVI_FNT3);
Put3Byte(outf, index);
CurrentPosition += 4;
} else {
putbyte(outf, DVI_FNT4);
PutLong(outf, index);
CurrentPosition += 5;
}
}
/*
* The following table describes the length (in bytes) of each of the DVI
* commands that we can simply copy, starting with DVI_SET1 (128).
*/
char oplen[128] = {
0, 0, 0, 0, /* DVI_SET1 .. DVI_SET4 */
9, /* DVI_SETRULE */
0, 0, 0, 0, /* DVI_PUT1 .. DVI_PUT4 */
9, /* DVI_PUTRULE */
1, /* DVI_NOP */
0, /* DVI_BOP */
0, /* DVI_EOP */
1, /* DVI_PUSH */
1, /* DVI_POP */
2, 3, 4, 5, /* DVI_RIGHT1 .. DVI_RIGHT4 */
1, /* DVI_W0 */
2, 3, 4, 5, /* DVI_W1 .. DVI_W4 */
1, /* DVI_X0 */
2, 3, 4, 5, /* DVI_X1 .. DVI_X4 */
2, 3, 4, 5, /* DVI_DOWN1 .. DVI_DOWN4 */
1, /* DVI_Y0 */
2, 3, 4, 5, /* DVI_Y1 .. DVI_Y4 */
1, /* DVI_Z0 */
2, 3, 4, 5, /* DVI_Z1 .. DVI_Z4 */
0, /* DVI_FNTNUM0 (171) */
0, 0, 0, 0, 0, 0, 0, 0, /* 172 .. 179 */
0, 0, 0, 0, 0, 0, 0, 0, /* 180 .. 187 */
0, 0, 0, 0, 0, 0, 0, 0, /* 188 .. 195 */
0, 0, 0, 0, 0, 0, 0, 0, /* 196 .. 203 */
0, 0, 0, 0, 0, 0, 0, 0, /* 204 .. 211 */
0, 0, 0, 0, 0, 0, 0, 0, /* 212 .. 219 */
0, 0, 0, 0, 0, 0, 0, 0, /* 220 .. 227 */
0, 0, 0, 0, 0, 0, 0, /* 228 .. 234 */
0, 0, 0, 0, /* DVI_FNT1 .. DVI_FNT4 */
0, 0, 0, 0, /* DVI_XXX1 .. DVI_XXX4 */
0, 0, 0, 0, /* DVI_FNTDEF1 .. DVI_FNTDEF4 */
0, /* DVI_PRE */
0, /* DVI_POST */
0, /* DVI_POSTPOST */
#ifdef ASCIIPTEX
0, 0, 0, 0, 0, /* 250 .. 254 */
0, /* DVI_DIR */
#else
0, 0, 0, 0, 0, 0, /* 250 .. 255 */
#endif
};
static int
HandlePage(int first, int last, i32 hoffset, i32 voffset)
{
register int c, l;
register i32 p = 0; /* avoid uninitialized warning */
register int CurrentFontOK = 0;
int doingpage = 0;
/* Only way out is via "return" statement */
for (;;) {
c = getc(inf); /* getc() returns unsigned values */
if (DVI_IsChar(c)) {
/*
* Copy chars, note font usage, but ignore if
* page is not interesting.
*/
if (!UseThisPage)
continue;
if (!CurrentFontOK) {
ReallyUseFont();
CurrentFontOK++;
}
putbyte(outf, c);
CurrentPosition++;
continue;
}
if (DVI_IsFont(c)) { /* note font change */
CurrentFontIndex = c - DVI_FNTNUM0;
CurrentFontOK = 0;
continue;
}
if (c == EOF)
GripeUnexpectedDVIEOF();
if ((l = (oplen - 128)[c]) != 0) { /* simple copy */
if (!UseThisPage) {
while (--l > 0)
(void) getc(inf);
continue;
}
CurrentPosition += l;
putbyte(outf, c);
while (--l > 0) {
c = getc(inf);
putbyte(outf, c);
}
if (ferror(outf))
error(1, -1, writeerr);
continue;
}
if ((l = DVI_OpLen(c)) != 0) {
/*
* Handle other generics.
* N.B.: there should only be unsigned parameters
* here (save SGN4), for commands with negative
* parameters have been taken care of above.
*/
switch (l) {
case DPL_UNS1:
p = getc(inf);
break;
case DPL_UNS2:
fGetWord(inf, p);
break;
case DPL_UNS3:
fGet3Byte(inf, p);
break;
case DPL_SGN4:
fGetLong(inf, p);
break;
default:
panic("HandleDVIFile l=%d", l);
}
/*
* Now that we have the parameter, perform the
* command.
*/
switch (DVI_DT(c)) {
case DT_SET:
case DT_PUT:
if (!UseThisPage)
continue;
if (!CurrentFontOK) {
ReallyUseFont();
CurrentFontOK++;
}
putbyte(outf, c);
switch (l) {
case DPL_UNS1:
putbyte(outf, p);
CurrentPosition += 2;
continue;
case DPL_UNS2:
PutWord(outf, p);
CurrentPosition += 3;
continue;
case DPL_UNS3:
Put3Byte(outf, p);
CurrentPosition += 4;
continue;
case DPL_SGN4:
PutLong(outf, p);
CurrentPosition += 5;
continue;
}
case DT_FNT:
CurrentFontIndex = p;
CurrentFontOK = 0;
continue;
case DT_XXX:
HandleSpecial(c, l, p);
continue;
case DT_FNTDEF:
HandleFontDef(p);
continue;
#ifdef ASCIIPTEX
case DT_DIR:
if (!UseThisPage)
continue;
ptexdvi = 1;
putbyte(outf, c);
putbyte(outf, p);
CurrentPosition += 2;
continue;
#endif
default:
panic("HandleDVIFile DVI_DT(%d)=%d",
c, DVI_DT(c));
}
continue;
}
switch (c) { /* handle the few remaining cases */
case DVI_BOP:
if (doingpage)
GripeUnexpectedOp("BOP (during page)");
BeginPage(first);
if (UseThisPage) {
if (!last) {
putbyte(outf, DVI_PUSH);
CurrentPosition++;
}
if (hoffset != 0) {
putbyte(outf, DVI_RIGHT4) ;
PutLong(outf, hoffset) ;
CurrentPosition += 5;
}
if (voffset != 0) {
putbyte(outf, DVI_DOWN4) ;
PutLong(outf, voffset) ;
CurrentPosition += 5;
}
}
doingpage = 1;
break;
case DVI_EOP:
if (!doingpage)
GripeUnexpectedOp("EOP (outside page)");
if (!last && UseThisPage) {
putbyte(outf, DVI_POP);
CurrentPosition++;
}
EndPage(last);
doingpage = 0;
return(1);
case DVI_PRE:
GripeUnexpectedOp("PRE");
/* NOTREACHED */
case DVI_POST:
if (doingpage)
GripeUnexpectedOp("POST (inside page)");
return(0);
case DVI_POSTPOST:
GripeUnexpectedOp("POSTPOST");
/* NOTREACHED */
default:
GripeUndefinedOp(c);
/* NOTREACHED */
}
}
}
/* write an empty page to fill out space */
static void
PutEmptyPage(void)
{
int i;
putbyte(outf, DVI_BOP);
PutLong(outf, -1L);
for (i = 1; i < 10; i++) /* set all sub counts to 0 */
PutLong(outf, 0L);
PutLong(outf, StartOfLastPage);
putbyte(outf, DVI_EOP);
if (!SFlag) { /* write nice page usage messages */
const char *msg = "[*]";
message(1, msg, strlen(msg));
}
if (ferror(outf))
error(1, -1, writeerr);
StartOfLastPage = CurrentPosition;
CurrentPosition += 46; /* we just wrote this much */
NumberOfOutputPages++;
}
/*
* Here we scan the input DVI file and record pointers to the pages.
*/
static void
ScanDVIFile(void)
{
long *tmp;
UseThisPage = 0;
StartOfPage[InputPageNumber] = ftell(inf);
while (HandlePage(0, 0, 0, 0)) { /* scan DVI file */
++InputPageNumber;
if (InputPageNumber >= StartOfPageSpace) {
StartOfPageSpace *= 2;
tmp = realloc(StartOfPage, sizeof(long) * StartOfPageSpace);
if (!tmp) {
error(1, -1, "cannot grow list of pages; out of memory");
}
StartOfPage = tmp;
}
StartOfPage[InputPageNumber] = ftell(inf);
}
}
/*
* Here we read the input DVI file and write relevant pages to the
* output DVI file. We also keep track of font changes, handle font
* definitions, and perform some other housekeeping.
*/
static void
HandleDVIFile(void)
{
int CurrentPage, ActualPage, MaxPage;
UseThisPage = 1;
MaxPage = ((InputPageNumber+Modulo-1)/Modulo)*Modulo;
for (CurrentPage = 0; CurrentPage < MaxPage; CurrentPage += Modulo) {
int add_last = 0;
struct pagespec *ps;
for (ps = PageSpecs; ps != NULL; ps = ps->next) {
int add_next = ps->add;
if (ps->reversed)
ActualPage = MaxPage-CurrentPage-Modulo+ps->pageno;
else
ActualPage = CurrentPage+ps->pageno;
if (ActualPage < InputPageNumber) {
if (fseek(inf, StartOfPage[ActualPage], 0) == -1)
error(1, -1,
"can't seek page %d", ActualPage+1);
HandlePage(!add_last, !add_next, ps->xoff, ps->yoff);
} else if (!add_last && !add_next)
PutEmptyPage();
add_last = add_next;
}
}
if (fseek(inf, StartOfPage[InputPageNumber]+1, 0) == -1)
error(1, -1, "can't seek last page");
}
|
4d76ddb67914852868097a27560637eacd88c049
|
632f6f14abb1dbdf86aca1506b8012392bef2a41
|
/source/usb/hid/usbd_hid.c
|
980c9100316355385e3b0a80f6b89f17aef4c73f
|
[
"Apache-2.0"
] |
permissive
|
ARMmbed/DAPLink
|
a34f7ce41d6bfc38d49283766a03280f52322f2a
|
19f797fa6396b726250c57eb9be80245a5f877dd
|
refs/heads/main
| 2023-08-23T20:37:22.744671
| 2023-06-29T19:36:00
| 2023-08-16T16:39:58
| 24,571,059
| 1,865
| 883
|
Apache-2.0
| 2023-08-16T16:39:59
| 2014-09-28T21:38:24
|
C
|
UTF-8
|
C
| false
| false
| 16,153
|
c
|
usbd_hid.c
|
/**
* @file usbd_hid.c
* @brief Human Interface Device driver
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* 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.
*/
#include <string.h>
#include "rl_usb.h"
#include "usb_for_lib.h"
U8 USBD_HID_Protocol;
BOOL DataOutAsyncReq;
U32 DataOutUpdateReqMask;
U8 *ptrDataOut;
volatile U16 DataOutToSendLen;
U16 DataOutSentLen;
BOOL DataOutEndWithShortPacket;
U8 *ptrDataIn;
U16 DataInReceMax;
U16 DataInReceLen;
U8 *ptrDataFeat;
U16 DataFeatReceLen;
/* Dummy Weak Functions that need to be provided by user */
__WEAK void usbd_hid_init(void)
{
}
__WEAK int usbd_hid_get_report(U8 rtype, U8 rid, U8 *buf, U8 req)
{
return (0);
};
__WEAK void usbd_hid_set_report(U8 rtype, U8 rid, U8 *buf, int len, U8 req)
{
}
__WEAK U8 usbd_hid_get_protocol(void)
{
return (0);
};
__WEAK void usbd_hid_set_protocol(U8 protocol)
{
};
/*
* USB Device HID Get Report Request Callback
* Called automatically on USB Device HID Get Report Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_GetReport(void)
{
U8 *ptr_buf = 0;
/* Report Type = USBD_SetupPacket.wValueH */
/* Report ID = USBD_SetupPacket.wValueL */
/* Report Length = USBD_SetupPacket.wLength */
switch (USBD_SetupPacket.wValueH) {
case HID_REPORT_INPUT:
ptr_buf = &USBD_HID_InReport[1];
break;
case HID_REPORT_OUTPUT:
return (__FALSE); /* Not Supported */
case HID_REPORT_FEATURE:
ptr_buf = &USBD_HID_FeatReport[1];
break;
}
usbd_hid_get_report(USBD_SetupPacket.wValueH, USBD_SetupPacket.wValueL, ptr_buf, USBD_HID_REQ_EP_CTRL);
return (__TRUE);
}
/*
* USB Device HID Set Report Request Callback
* Called automatically on USB Device HID Set Report Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_SetReport(void)
{
U8 *ptr_buf = 0;
/* Report Type = USBD_SetupPacket.wValueH */
/* Report ID = USBD_SetupPacket.wValueL */
/* Report Length = USBD_SetupPacket.wLength */
switch (USBD_SetupPacket.wValueH) {
case HID_REPORT_INPUT:
return (__FALSE); /* Not Supported */
case HID_REPORT_OUTPUT:
ptr_buf = &USBD_HID_OutReport[1];
break;
case HID_REPORT_FEATURE:
ptr_buf = &USBD_HID_FeatReport[1];
break;
}
usbd_hid_set_report(USBD_SetupPacket.wValueH, USBD_SetupPacket.wValueL, ptr_buf, USBD_SetupPacket.wLength, USBD_HID_REQ_EP_CTRL);
return (__TRUE);
}
/*
* USB Device HID Get Idle Request Callback
* Called automatically on USB Device HID Get Idle Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_GetIdle(void)
{
USBD_EP0Buf[0] = USBD_HID_IdleSet[USBD_SetupPacket.wValueL];
return (__TRUE);
}
/*
* USB Device HID Set Idle Request Callback
* Called automatically on USB Device HID Set Idle Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_SetIdle(void)
{
U8 i;
if (USBD_SetupPacket.wValueL) { /* If > 0 Report ID specified */
USBD_HID_IdleSet[USBD_SetupPacket.wValueL - 1] = USBD_SetupPacket.wValueH;
} else { /* If == 0 all reports */
for (i = 0; i < usbd_hid_inreport_num; i++) {
USBD_HID_IdleSet[i] = USBD_SetupPacket.wValueH;
}
}
return (__TRUE);
}
/*
* USB Device HID Get Protocol Request Callback
* Called automatically on USB Device HID Get Protocol Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_GetProtocol(void)
{
USBD_EP0Buf[0] = usbd_hid_get_protocol();
return (__TRUE);
}
/*
* USB Device HID Set Protocol Request Callback
* Called automatically on USB Device HID Set Protocol Request
* Parameters: None
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL USBD_HID_SetProtocol(void)
{
usbd_hid_set_protocol(USBD_SetupPacket.wValueL);
return (__TRUE);
}
/*
* USB Device HID Interrupt In Endpoint Event Callback
* Parameters: event: not used (just for compatibility)
* Return Value: None
*/
void USBD_HID_EP_INTIN_Event(U32 event)
{
U8 i;
U16 bytes_to_send;
/* Check if sending is finished */
if ((DataOutSentLen >= DataOutToSendLen) &&
!DataOutEndWithShortPacket) { /* If all sent and short packet also */
ptrDataOut = NULL;
DataOutSentLen = 0;
DataOutToSendLen = usbd_hid_get_report(HID_REPORT_INPUT, USBD_HID_InReport[0], &USBD_HID_InReport[1], USBD_HID_REQ_EP_INT);
if (DataOutToSendLen) { /* If new send should be started */
ptrDataOut = USBD_HID_InReport;
if (usbd_hid_inreport_num <= 1) { /* If only in 1 report skip ReportID */
ptrDataOut++;
} else { /* If more in reports, send ReportID */
DataOutToSendLen++;
}
}
}
/* Check if new data out sending should be started */
if (!DataOutToSendLen) { /* If send not in progress */
if (DataOutAsyncReq) { /* If asynchronous send requested */
DataOutAsyncReq = __FALSE;
} else if (DataOutUpdateReqMask) { /* If update requested */
if (usbd_hid_inreport_num <= 1) { /* If only one in report in system */
if (DataOutUpdateReqMask) {
USBD_HID_InReport[0] = 0; /* ReportID = 0 */
DataOutSentLen = 0;
DataOutToSendLen = usbd_hid_get_report(HID_REPORT_INPUT, 0, &USBD_HID_InReport[1], USBD_HID_REQ_PERIOD_UPDATE);
if (DataOutToSendLen) {
ptrDataOut = &USBD_HID_InReport[1];
}
DataOutUpdateReqMask = 0;
}
} else { /* If multiple reports in system */
for (i = USBD_HID_InReport[0]; ; i++) {
if (i >= 32) {
i = 0;
}
if (DataOutUpdateReqMask & (1 << i)) {
USBD_HID_InReport[0] = i + 1; /* ReportID */
DataOutSentLen = 0;
DataOutToSendLen = usbd_hid_get_report(HID_REPORT_INPUT, i + 1, &USBD_HID_InReport[1], USBD_HID_REQ_PERIOD_UPDATE);
if (DataOutToSendLen) {
ptrDataOut = USBD_HID_InReport;
DataOutToSendLen++;
}
DataOutUpdateReqMask &= ~(1 << i);
break;
}
}
}
}
}
/* Check if data needs to be sent */
if (DataOutToSendLen ||
DataOutEndWithShortPacket) { /* If sending is in progress */
bytes_to_send = DataOutToSendLen - DataOutSentLen;
if (bytes_to_send > usbd_hid_maxpacketsize[USBD_HighSpeed]) {
bytes_to_send = usbd_hid_maxpacketsize[USBD_HighSpeed];
}
if (usbd_hid_ep_intin != 0) { //control ep does the sending to host
USBD_WriteEP(usbd_hid_ep_intin | 0x80, ptrDataOut, bytes_to_send);
}
ptrDataOut += bytes_to_send;
DataOutSentLen += bytes_to_send;
if ((DataOutSentLen < usbd_hid_inreport_max_sz) &&
(bytes_to_send == usbd_hid_maxpacketsize[USBD_HighSpeed])) {
/* If short packet should be sent also*/
DataOutEndWithShortPacket = __TRUE;
} else {
DataOutEndWithShortPacket = __FALSE;
}
}
}
/*
* USB Device HID Interrupt Out Endpoint Event Callback
* Parameters: event: not used (just for compatibility)
* Return Value: None
*/
void USBD_HID_EP_INTOUT_Event(U32 event)
{
U16 bytes_rece;
if (!DataInReceLen) { /* Check if new reception */
ptrDataIn = USBD_HID_OutReport;
DataInReceMax = usbd_hid_outreport_max_sz;
DataInReceLen = 0;
}
bytes_rece = USBD_ReadEP(usbd_hid_ep_intout, ptrDataIn, DataInReceMax - DataInReceLen);
ptrDataIn += bytes_rece;
DataInReceLen += bytes_rece;
if (!bytes_rece ||
(DataInReceLen >= usbd_hid_outreport_max_sz) ||
(bytes_rece < usbd_hid_maxpacketsize[USBD_HighSpeed])) {
if (usbd_hid_outreport_num <= 1) { /* If only one out report in system */
usbd_hid_set_report(HID_REPORT_OUTPUT, 0 , USBD_HID_OutReport , DataInReceLen, USBD_HID_REQ_EP_INT);
} else {
usbd_hid_set_report(HID_REPORT_OUTPUT, USBD_HID_OutReport[0], &USBD_HID_OutReport[1], DataInReceLen - 1, USBD_HID_REQ_EP_INT);
}
DataInReceLen = 0;
}
}
/*
* USB Device HID Configure Callback
* Parameters: None
* Return Value: None
*/
void USBD_HID_Configure_Event(void)
{
/* Reset all variables after connect event */
USBD_HID_Protocol = 0;
DataOutAsyncReq = __FALSE;
DataOutUpdateReqMask = __FALSE;
ptrDataOut = NULL;
DataOutToSendLen = 0;
DataOutSentLen = 0;
DataOutEndWithShortPacket = __FALSE;
ptrDataIn = NULL;
DataInReceMax = 0;
DataInReceLen = 0;
ptrDataFeat = NULL;
DataFeatReceLen = 0;
}
/*
* USB Device HID Interrupt In/Out Endpoint Event Callback
* Parameters: event: USB Device Event
* USBD_EVT_IN: Input Event
* USBD_EVT_OUT: Output Event
* Return Value: None
*/
void USBD_HID_EP_INT_Event(U32 event)
{
if (event & USBD_EVT_IN) {
USBD_HID_EP_INTIN_Event(event);
}
if (event & USBD_EVT_OUT) {
USBD_HID_EP_INTOUT_Event(event);
}
}
/*
* USB Device HID SOF Handler (handles report timings: polling and idle times)
* Called automatically on USB Device Start of Frame
* Parameters: None
* Return Value: None
*/
void USBD_HID_SOF_Event(void)
{
static U8 cnt_for_4ms = 0;
U8 i;
BOOL tick_4ms, do_polling, polling_reload, idle_reload;
if (USBD_Configuration) {
tick_4ms = __FALSE;
if (cnt_for_4ms++ >= ((4 << (3 * USBD_HighSpeed))) - 1) {
cnt_for_4ms = 0;
tick_4ms = __TRUE;
}
polling_reload = __FALSE;
if (USBD_HID_PollingCnt < 255) {
USBD_HID_PollingCnt++;
}
if (USBD_HID_PollingCnt == usbd_hid_interval[USBD_HighSpeed]) {
polling_reload = __TRUE; /* If polling interval expired */
}
for (i = 0; i < usbd_hid_inreport_num; i++) {
idle_reload = __FALSE;
if (tick_4ms) {
if (USBD_HID_IdleCnt[i] < 255) {
USBD_HID_IdleCnt[i]++;
}
if (USBD_HID_IdleReload[i]) {
if (USBD_HID_IdleCnt[i] >= USBD_HID_IdleReload[i]) {
idle_reload = __TRUE; /* If idle period expired */
}
}
}
do_polling = (usbd_hid_interval[USBD_HighSpeed] > ((U16)(USBD_HID_IdleReload[i]) << (2 << (3 * USBD_HighSpeed)))) && (USBD_HID_IdleReload[i] != 0);
if (polling_reload) {
if (do_polling) {
/* If polling is longer than idle */
DataOutUpdateReqMask |= (1 << i);
}
}
if (USBD_HID_IdleReload[i] != USBD_HID_IdleSet[i]) {
if (USBD_HID_IdleCnt[i] >= USBD_HID_IdleSet[i]) {
DataOutUpdateReqMask |= (1 << i);
cnt_for_4ms = 0;
}
USBD_HID_IdleReload[i] = USBD_HID_IdleSet[i];
}
if (idle_reload) {
if (!do_polling) {
DataOutUpdateReqMask |= (1 << i);
}
USBD_HID_IdleCnt[i] = 0;
}
}
if (polling_reload) {
USBD_HID_PollingCnt = 0;
}
if (DataOutUpdateReqMask && !DataOutToSendLen) { /* If pending */
/* refresh request and no active data */
/* out then start data out */
USBD_HID_EP_INTIN_Event(0);
}
}
}
#ifdef __RTX /* RTX task for handling events */
/*
* USB Device HID Interrupt In Endpoint Event Handler Task
* Parameters: None
* Return Value: None
*/
void USBD_RTX_HID_EP_INTIN_Event(void)
{
for (;;) {
usbd_os_evt_wait_or(0xFFFF, 0xFFFF);
if (usbd_os_evt_get() & USBD_EVT_IN) {
USBD_HID_EP_INTIN_Event(0);
}
}
}
/*
* USB Device HID Interrupt Out Endpoint Event Handler Task
* Parameters: None
* Return Value: None
*/
void USBD_RTX_HID_EP_INTOUT_Event(void)
{
for (;;) {
usbd_os_evt_wait_or(0xFFFF, 0xFFFF);
if (usbd_os_evt_get() & USBD_EVT_OUT) {
USBD_HID_EP_INTOUT_Event(0);
}
}
}
/*
* USB Device HID Interrupt In/Out Endpoint Event Handler Task
* Parameters: None
* Return Value: None
*/
void USBD_RTX_HID_EP_INT_Event(void)
{
for (;;) {
usbd_os_evt_wait_or(0xFFFF, 0xFFFF);
USBD_HID_EP_INT_Event(usbd_os_evt_get());
}
}
#endif
/*
* USB Device HID Get Report Trigger (asynchronous Get_Report request)
* Parameters: rid: Report ID
* buf: Pointer to data buffer
* len: Number of bytes to be sent
* Return Value: TRUE - Success, FALSE - Error
*/
BOOL usbd_hid_get_report_trigger(U8 rid, U8 *buf, int len)
{
if (len > usbd_hid_inreport_max_sz) {
return (__FALSE);
}
if (USBD_Configuration) {
DataOutAsyncReq = __TRUE; /* Asynchronous data out request */
while (DataOutToSendLen) {
if (!USBD_Configuration) { /* If device not configured reject rq */
DataOutAsyncReq = __FALSE; /* Asynchronous data out request */
ptrDataOut = NULL;
DataOutSentLen = 0;
DataOutToSendLen = 0;
return (__FALSE);
}
}
USBD_HID_InReport[0] = rid;
memcpy(&USBD_HID_InReport[1], buf, len);
ptrDataOut = USBD_HID_InReport;
DataOutSentLen = 0;
DataOutToSendLen = len;
if (usbd_hid_inreport_num <= 1) { /* If only 1 in report skip ReportID */
ptrDataOut ++;
} else { /* If more in reports, send ReportID */
DataOutToSendLen ++;
}
USBD_HID_EP_INTIN_Event(0);
USBD_HID_IdleCnt[rid] = 0;
return (__TRUE);
}
return (__FALSE);
}
|
e210b83aaab9877ae33b173d948a1ccbaeabd645
|
3e5d22bf807717d5825e1bcbcf88ec53a0dd04b1
|
/dsrom/vwii_loader/sd_loader/src/entry.c
|
d729e7915519964d211807c2db85d94db5af8e4f
|
[] |
no_license
|
FIX94/haxchi
|
a1b064b76b5e24320cb977acb6c5164c5efa8827
|
c42ae327911cfdda983cfad48e00d5a13806681b
|
refs/heads/master
| 2022-02-04T03:18:44.282368
| 2019-12-14T23:35:46
| 2019-12-14T23:35:46
| 73,130,757
| 260
| 89
| null | 2022-01-26T16:56:45
| 2016-11-07T23:36:49
|
C
|
UTF-8
|
C
| false
| false
| 15,040
|
c
|
entry.c
|
#include <gctypes.h>
#include "elf_abi.h"
#include "../../common.h"
#include "../../fs_defs.h"
#include "../../os_defs.h"
#include "kernel_defs.h"
#include "loader_defs.h"
#define EXPORT_DECL(res, func, ...) res (* func)(__VA_ARGS__);
#define OS_FIND_EXPORT(handle, funcName, func) OSDynLoad_FindExport(handle, 0, funcName, &func)
static void (*DCFlushRange)(void *addr, unsigned int size);
static void (*DCInvalidateRange)(void *addr, unsigned int size);
static void (*ICInvalidateRange)(void *addr, unsigned int size);
static unsigned int hook_LiWaitOneChunk;
static unsigned int addrphys_LiWaitOneChunk;
extern void SC0x25_KernelCopyData(unsigned int addr, unsigned int src, unsigned int len);
extern void my_PrepareTitle_hook(void);
static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len)
{
/*
* Setup a DBAT access with cache inhibited to write through and read directly from memory
*/
unsigned int dbatu0, dbatl0, dbatu1, dbatl1;
// save the original DBAT value
asm volatile("mfdbatu %0, 0" : "=r" (dbatu0));
asm volatile("mfdbatl %0, 0" : "=r" (dbatl0));
asm volatile("mfdbatu %0, 1" : "=r" (dbatu1));
asm volatile("mfdbatl %0, 1" : "=r" (dbatl1));
unsigned int target_dbatu0 = 0;
unsigned int target_dbatl0 = 0;
unsigned int target_dbatu1 = 0;
unsigned int target_dbatl1 = 0;
unsigned int *dst_p = (unsigned int*)addr;
unsigned int *src_p = (unsigned int*)src;
// we only need DBAT modification for addresses out of our own DBAT range
// as our own DBAT is available everywhere for user and supervisor
// since our own DBAT is on DBAT5 position we don't collide here
if(addr < 0x00800000 || addr >= 0x01000000)
{
target_dbatu0 = (addr & 0x00F00000) | 0xC0000000 | 0x1F;
target_dbatl0 = (addr & 0xFFF00000) | 0x32;
asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0));
asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0));
dst_p = (unsigned int*)((addr & 0xFFFFFF) | 0xC0000000);
}
if(src < 0x00800000 || src >= 0x01000000)
{
target_dbatu1 = (src & 0x00F00000) | 0xB0000000 | 0x1F;
target_dbatl1 = (src & 0xFFF00000) | 0x32;
asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1));
asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1));
src_p = (unsigned int*)((src & 0xFFFFFF) | 0xB0000000);
}
asm volatile("eieio; isync");
unsigned int i;
for(i = 0; i < len; i += 4)
{
// if we are on the edge to next chunk
if((target_dbatu0 != 0) && (((unsigned int)dst_p & 0x00F00000) != (target_dbatu0 & 0x00F00000)))
{
target_dbatu0 = ((addr + i) & 0x00F00000) | 0xC0000000 | 0x1F;
target_dbatl0 = ((addr + i) & 0xFFF00000) | 0x32;
dst_p = (unsigned int*)(((addr + i) & 0xFFFFFF) | 0xC0000000);
asm volatile("eieio; isync");
asm volatile("mtdbatu 0, %0" : : "r" (target_dbatu0));
asm volatile("mtdbatl 0, %0" : : "r" (target_dbatl0));
asm volatile("eieio; isync");
}
if((target_dbatu1 != 0) && (((unsigned int)src_p & 0x00F00000) != (target_dbatu1 & 0x00F00000)))
{
target_dbatu1 = ((src + i) & 0x00F00000) | 0xB0000000 | 0x1F;
target_dbatl1 = ((src + i) & 0xFFF00000) | 0x32;
src_p = (unsigned int*)(((src + i) & 0xFFFFFF) | 0xB0000000);
asm volatile("eieio; isync");
asm volatile("mtdbatu 1, %0" : : "r" (target_dbatu1));
asm volatile("mtdbatl 1, %0" : : "r" (target_dbatl1));
asm volatile("eieio; isync");
}
*dst_p = *src_p;
++dst_p;
++src_p;
}
/*
* Restore original DBAT value
*/
asm volatile("eieio; isync");
asm volatile("mtdbatu 0, %0" : : "r" (dbatu0));
asm volatile("mtdbatl 0, %0" : : "r" (dbatl0));
asm volatile("mtdbatu 1, %0" : : "r" (dbatu1));
asm volatile("mtdbatl 1, %0" : : "r" (dbatl1));
asm volatile("eieio; isync");
}
// This function is called every time after LiBounceOneChunk.
// It waits for the asynchronous call of LiLoadAsync for the IOSU to fill data to the RPX/RPL address
// and return the still remaining bytes to load.
// We override it and replace the loaded date from LiLoadAsync with our data and our remaining bytes to load.
static int LiWaitOneChunk(unsigned int * iRemainingBytes, const char *filename, int fileType)
{
unsigned int result;
register int core_id;
int remaining_bytes = 0;
int sgFileOffset;
int sgBufferNumber;
int *sgBounceError;
int *sgGotBytes;
int *sgTotalBytes;
int *sgIsLoadingBuffer;
int *sgFinishedLoadingBuffer;
// get the current core
asm volatile("mfspr %0, 0x3EF" : "=r" (core_id));
// get the offset of per core global variable for dynload initialized (just a simple address + (core_id * 4))
unsigned int gDynloadInitialized = *(volatile unsigned int*)(OS_SPECIFICS->addr_gDynloadInitialized + (core_id << 2));
// Comment (Dimok):
// time measurement at this position for logger -> we don't need it right now except maybe for debugging
//unsigned long long systemTime1 = Loader_GetSystemTime();
if(OS_FIRMWARE == 550)
{
// pointer to global variables of the loader
loader_globals_550_t *loader_globals = (loader_globals_550_t*)(0xEFE19E80);
sgBufferNumber = loader_globals->sgBufferNumber;
sgFileOffset = loader_globals->sgFileOffset;
sgBounceError = &loader_globals->sgBounceError;
sgGotBytes = &loader_globals->sgGotBytes;
sgTotalBytes = &loader_globals->sgTotalBytes;
sgFinishedLoadingBuffer = &loader_globals->sgFinishedLoadingBuffer;
// not available on 5.5.x
sgIsLoadingBuffer = NULL;
}
else
{
// pointer to global variables of the loader
loader_globals_t *loader_globals = (loader_globals_t*)(OS_SPECIFICS->addr_sgIsLoadingBuffer);
sgBufferNumber = loader_globals->sgBufferNumber;
sgFileOffset = loader_globals->sgFileOffset;
sgBounceError = &loader_globals->sgBounceError;
sgGotBytes = &loader_globals->sgGotBytes;
sgIsLoadingBuffer = &loader_globals->sgIsLoadingBuffer;
// not available on < 5.5.x
sgTotalBytes = NULL;
sgFinishedLoadingBuffer = NULL;
}
// the data loading was started in LiBounceOneChunk() and here it waits for IOSU to finish copy the data
if(gDynloadInitialized != 0) {
result = OS_SPECIFICS->LiWaitIopCompleteWithInterrupts(0x2160EC0, &remaining_bytes);
}
else {
result = OS_SPECIFICS->LiWaitIopComplete(0x2160EC0, &remaining_bytes);
}
// Comment (Dimok):
// time measurement at this position for logger -> we don't need it right now except maybe for debugging
//unsigned long long systemTime2 = Loader_GetSystemTime();
//------------------------------------------------------------------------------------------------------------------
// Start of our function intrusion:
// After IOSU is done writing the data into the 0xF6000000/0xF6400000 address,
// we overwrite it with our data before setting the global flag for IsLoadingBuffer to 0
// Do this only if we are in the game that was launched by our method
s_mem_area *mem_area = MEM_AREA_TABLE;
if((ELF_DATA_ADDR == mem_area->address) && (fileType == 0))
{
unsigned int load_address = (sgBufferNumber == 1) ? 0xF6000000 : (0xF6000000 + 0x00400000);
unsigned int load_addressPhys = (sgBufferNumber == 1) ? 0x1B000000 : (0x1B000000 + 0x00400000); // virtual 0xF6000000 and 0xF6400000
remaining_bytes = ELF_DATA_SIZE - sgFileOffset;
if (remaining_bytes > 0x400000)
// truncate size
remaining_bytes = 0x400000;
DCFlushRange((void*)load_address, remaining_bytes);
u32 rpxBlockPos = 0;
u32 done = 0;
u32 mapOffset = 0;
while((done < (u32)sgFileOffset) && mem_area)
{
if((done + mem_area->size) > (u32)sgFileOffset)
{
mapOffset = sgFileOffset - done;
done = sgFileOffset;
}
else
{
done += mem_area->size;
mem_area = mem_area->next;
}
}
while((done < ELF_DATA_SIZE) && (rpxBlockPos < 0x400000) && mem_area)
{
u32 address = mem_area->address + mapOffset;
u32 blockSize = ELF_DATA_SIZE - done;
if(blockSize > (0x400000 - rpxBlockPos))
{
blockSize = 0x400000 - rpxBlockPos;
}
if((mapOffset + blockSize) >= mem_area->size)
{
blockSize = mem_area->size - mapOffset;
//! this value is incremented later by blockSize, so set it to -blockSize for it to be 0 after copy
//! it makes smaller code then if(mapOffset == mem_area->size) after copy
mapOffset = -blockSize;
mem_area = mem_area->next;
}
SC0x25_KernelCopyData(load_addressPhys + rpxBlockPos, address, blockSize);
done += blockSize;
rpxBlockPos += blockSize;
mapOffset += blockSize;
}
DCInvalidateRange((void*)load_address, remaining_bytes);
if((u32)(sgFileOffset + remaining_bytes) == ELF_DATA_SIZE)
{
ELF_DATA_ADDR = 0xDEADC0DE;
ELF_DATA_SIZE = 0;
MAIN_ENTRY_ADDR = 0xC001C0DE;
}
// set result to 0 -> "everything OK"
result = 0;
}
// end of our little intrusion into this function
//------------------------------------------------------------------------------------------------------------------
// set the result to the global bounce error variable
if(sgBounceError) {
*sgBounceError = result;
}
// disable global flag that buffer is still loaded by IOSU
if(sgFinishedLoadingBuffer)
{
unsigned int zeroBitCount = 0;
asm volatile("cntlzw %0, %0" : "=r" (zeroBitCount) : "r"(*sgFinishedLoadingBuffer));
*sgFinishedLoadingBuffer = zeroBitCount >> 5;
}
else if(sgIsLoadingBuffer)
{
*sgIsLoadingBuffer = 0;
}
// check result for errors
if(result == 0)
{
// the remaining size is set globally and in stack variable only
// if a pointer was passed to this function
if(iRemainingBytes) {
if(sgGotBytes) {
*sgGotBytes = remaining_bytes;
}
*iRemainingBytes = remaining_bytes;
// on 5.5.x a new variable for total loaded bytes was added
if(sgTotalBytes) {
*sgTotalBytes += remaining_bytes;
}
}
// Comment (Dimok):
// calculate time difference and print it on logging how long the wait for asynchronous data load took
// something like (systemTime2 - systemTime1) * constant / bus speed, did not look deeper into it as we don't need that crap
}
else {
// Comment (Dimok):
// a lot of error handling here. depending on error code sometimes calls Loader_Panic() -> we don't make errors so we can skip that part ;-P
}
return result;
}
void my_PrepareTitle(CosAppXmlInfo *xmlKernelInfo)
{
if(ELF_DATA_ADDR == MEM_AREA_TABLE->address)
{
xmlKernelInfo->max_size = RPX_MAX_SIZE;
xmlKernelInfo->max_codesize = RPX_MAX_CODE_SIZE;
//! setup our hook to LiWaitOneChunk for RPX loading
hook_LiWaitOneChunk = ((u32)LiWaitOneChunk) | 0x48000002;
KernelCopyData(addrphys_LiWaitOneChunk, (u32) &hook_LiWaitOneChunk, 4);
asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31));
}
else if((MAIN_ENTRY_ADDR == 0xC001C0DE) && (*(u32*)xmlKernelInfo->rpx_name == 0x66666c5f)) // ffl_
{
//! restore original LiWaitOneChunk instruction as our RPX is done
MAIN_ENTRY_ADDR = 0xDEADC0DE;
KernelCopyData(addrphys_LiWaitOneChunk, (u32)&OS_SPECIFICS->orig_LiWaitOneChunkInstr, 4);
asm volatile("icbi 0, %0" : : "r" (OS_SPECIFICS->addr_LiWaitOneChunk & ~31));
}
}
unsigned int _main(int argc, char **argv)
{
if(MAIN_ENTRY_ADDR != 0xC001C0DE)
{
EXPORT_DECL(int, OSDynLoad_Acquire, const char* rpl, u32 *handle);
EXPORT_DECL(int, OSDynLoad_FindExport, u32 handle, int isdata, const char *symbol, void *address);
OSDynLoad_Acquire = (int (*)(const char*, u32 *))OS_SPECIFICS->addr_OSDynLoad_Acquire;
OSDynLoad_FindExport = (int (*)(u32, int, const char *, void *))OS_SPECIFICS->addr_OSDynLoad_FindExport;
unsigned int coreinit_handle;
OSDynLoad_Acquire("coreinit.rpl", &coreinit_handle);
OS_FIND_EXPORT(coreinit_handle, "DCFlushRange", DCFlushRange);
OS_FIND_EXPORT(coreinit_handle, "DCInvalidateRange", DCInvalidateRange);
OS_FIND_EXPORT(coreinit_handle, "ICInvalidateRange", ICInvalidateRange);
EXPORT_DECL(void *, MEMAllocFromDefaultHeapEx,int size, int align);
EXPORT_DECL(void, MEMFreeToDefaultHeap,void *ptr);
unsigned int *functionPtr = 0;
OSDynLoad_FindExport(coreinit_handle, 1, "MEMAllocFromDefaultHeapEx", &functionPtr);
MEMAllocFromDefaultHeapEx = (void * (*)(int, int))*functionPtr;
OSDynLoad_FindExport(coreinit_handle, 1, "MEMFreeToDefaultHeap", &functionPtr);
MEMFreeToDefaultHeap = (void (*)(void *))*functionPtr;
//get all the CMPT functions
unsigned int cmpt_handle;
OSDynLoad_Acquire("nn_cmpt.rpl", &cmpt_handle);
int (*CMPTLaunchTitle)(void* CMPTConfigure, int ConfigSize, int titlehigh, int titlelow);
int (*CMPTAcctSetScreenType)(int screenType);
int (*CMPTGetDataSize)(int* dataSize);
int (*CMPTCheckScreenState)();
OSDynLoad_FindExport(cmpt_handle, 0, "CMPTLaunchTitle", &CMPTLaunchTitle);
OSDynLoad_FindExport(cmpt_handle, 0, "CMPTAcctSetScreenType", &CMPTAcctSetScreenType);
OSDynLoad_FindExport(cmpt_handle, 0, "CMPTGetDataSize", &CMPTGetDataSize);
OSDynLoad_FindExport(cmpt_handle, 0, "CMPTCheckScreenState", &CMPTCheckScreenState);
//1 = TV Only, 2 = GamePad Only, 3 = Both
CMPTAcctSetScreenType(3);
if(CMPTCheckScreenState() < 0)
{
CMPTAcctSetScreenType(2);
if(CMPTCheckScreenState() < 0)
CMPTAcctSetScreenType(1);
}
int datasize;
CMPTGetDataSize(&datasize);
//needed for CMPT to work
unsigned int padscore_handle;
OSDynLoad_Acquire("padscore.rpl", &padscore_handle);
void(*KPADInit)();
OSDynLoad_FindExport(padscore_handle, 0, "KPADInit", &KPADInit);
KPADInit();
void *databuf = MEMAllocFromDefaultHeapEx(datasize, 0x40);
CMPTLaunchTitle(databuf, datasize, VWII_TITLE_ID_LOW, VWII_TITLE_ID_HIGH);
MEMFreeToDefaultHeap(databuf);
MAIN_ENTRY_ADDR = 0xC001C0DE;
}
unsigned int entry = *(unsigned int*)OS_SPECIFICS->addr_OSTitle_main_entry;
//! launch the original title with clean stack
return entry;
}
|
f508d4b1d96e902b2a71b7bd54c672d795fa4552
|
fdf08b05ff4c660e183739dbc18009d0a9b8a49a
|
/OpenTESArena/src/Input/InputStateType.h
|
df2dec4c43d39e8e5da2aef5e97207cd926fa55d
|
[
"MIT"
] |
permissive
|
afritz1/OpenTESArena
|
f67c4f6ee8981ef3bffbfe5894e2b48d67554475
|
7e91599157e2b9268237b6689f691d29e89b1d74
|
refs/heads/main
| 2023-08-31T09:25:21.908575
| 2023-08-27T01:24:29
| 2023-08-27T01:24:29
| 50,629,945
| 942
| 100
|
MIT
| 2023-08-21T03:42:36
| 2016-01-29T02:07:08
|
C++
|
UTF-8
|
C
| false
| false
| 422
|
h
|
InputStateType.h
|
#ifndef INPUT_STATE_TYPE_H
#define INPUT_STATE_TYPE_H
// State types for non-mono-state inputs like button presses. Mono-state inputs like mouse wheel scrolls do
// not have a state type.
enum class InputStateType
{
BeginPerform, // The instant the physical input starts.
Performing, // While the physical input is considered still happening.
EndPerform // The instant the physical input stops completely.
};
#endif
|
f7fe10c21afc7bc1fa60e31d8c6e16cdf33a1345
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/mips/dec/ioasic-irq.c
|
824e08c737981d8d9be039892b49f876b4c54bd0
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 1,717
|
c
|
ioasic-irq.c
|
/*
* DEC I/O ASIC interrupts.
*
* Copyright (c) 2002, 2003 Maciej W. Rozycki
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/types.h>
#include <asm/dec/ioasic.h>
#include <asm/dec/ioasic_addrs.h>
#include <asm/dec/ioasic_ints.h>
static int ioasic_irq_base;
static void unmask_ioasic_irq(struct irq_data *d)
{
u32 simr;
simr = ioasic_read(IO_REG_SIMR);
simr |= (1 << (d->irq - ioasic_irq_base));
ioasic_write(IO_REG_SIMR, simr);
}
static void mask_ioasic_irq(struct irq_data *d)
{
u32 simr;
simr = ioasic_read(IO_REG_SIMR);
simr &= ~(1 << (d->irq - ioasic_irq_base));
ioasic_write(IO_REG_SIMR, simr);
}
static void ack_ioasic_irq(struct irq_data *d)
{
mask_ioasic_irq(d);
fast_iob();
}
static struct irq_chip ioasic_irq_type = {
.name = "IO-ASIC",
.irq_ack = ack_ioasic_irq,
.irq_mask = mask_ioasic_irq,
.irq_mask_ack = ack_ioasic_irq,
.irq_unmask = unmask_ioasic_irq,
};
static struct irq_chip ioasic_dma_irq_type = {
.name = "IO-ASIC-DMA",
.irq_ack = ack_ioasic_irq,
.irq_mask = mask_ioasic_irq,
.irq_mask_ack = ack_ioasic_irq,
.irq_unmask = unmask_ioasic_irq,
};
void __init init_ioasic_irqs(int base)
{
int i;
/* Mask interrupts. */
ioasic_write(IO_REG_SIMR, 0);
fast_iob();
for (i = base; i < base + IO_INR_DMA; i++)
irq_set_chip_and_handler(i, &ioasic_irq_type,
handle_level_irq);
for (; i < base + IO_IRQ_LINES; i++)
irq_set_chip(i, &ioasic_dma_irq_type);
ioasic_irq_base = base;
}
|
f0a16d8d0a16804c747362435d4badfa9542c71f
|
7f62590ea2397fe0804e22a6d35ea00beaa111c8
|
/YubiKit/YubiKit/SPMHeaderLinks/YKFFIDO2GetInfoAPDU.h
|
614d3299576284098fb313c9ad61d32d36cb1372
|
[
"Apache-2.0"
] |
permissive
|
Yubico/yubikit-ios
|
2b3e6118bebcdf4b7f980df4b1d7e09650af8f82
|
02403a2384997c64b84a967c8f587e86fc1e605d
|
refs/heads/main
| 2023-05-27T06:40:44.456959
| 2023-05-25T13:40:34
| 2023-05-25T13:40:34
| 191,902,737
| 179
| 53
|
Apache-2.0
| 2023-05-25T13:40:36
| 2019-06-14T08:08:13
|
Objective-C
|
UTF-8
|
C
| false
| false
| 54
|
h
|
YKFFIDO2GetInfoAPDU.h
|
../Connections/Shared/APDU/FIDO2/YKFFIDO2GetInfoAPDU.h
|
c6acb4ba03c02b1eba33098f9b1ad901885659b2
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/mach/m68020/as/mach4.c
|
3103ad5e106e654f4cf7ce5d538b8c8147990494
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 16,682
|
c
|
mach4.c
|
/* $Id$ */
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
* Motorola 68020 syntax rules
*/
/* Please do not add more terminal symbols. As it is, 127 terminal symbols
are used, and this is the limit for some "yacc" implementations,
notably the Ultrix one.
*/
operation
: { instrp = instr;
dot_offset = 0;
curr_instr = curr_token;
}
instruction
{ emit_instr();
}
;
instruction
: bcdx DREG ',' DREG
{ emit2($1 | $2 | $4<<9);}
| bcdx '-' '(' AREG ')' ',' '-' '(' AREG ')'
{ emit2($1 | $4 | $9<<9 | 010);}
| ADD sizedef ea_ea
{ add($1, $2);}
| AND sizenon ea_ea
{ and($1, $2);}
| SHIFT sizedef ea_ea
{ shift_op($1, $2);}
| SHIFT sizedef ea /* This syntax is also allowed */
{ checksize($2, 2);
T_EMIT2(($1 & 0177700) | mrg_2,0,0,0);
ea_2(SIZE_W, MEM|ALT);
}
| BR expr
{ branch($1, $2);}
| DBR DREG ',' expr
{ T_EMIT2($1 | $2,0,0,0);
$4.val -= (DOTVAL+dot_offset);
fit(fitw($4.val));
T_EMIT2(loww($4.val), $4.typ,
RELPC|RELO2, relonami);
}
| BITOP ea_ea
{ bitop($1);}
| BITFIELD ea off_width
{ bitfield($1, $3);}
| BF_TO_D ea off_width ',' DREG
{ bitfield($1, $3 | $5<<12);}
| BFINS DREG ',' ea off_width
{ bitfield($1, $5 | $2<<12);}
| DIVMUL sizedef ea ',' DREG
{ checksize($2, 2|4);
if ($2 == SIZE_W) {
T_EMIT2((0140300^($1<<8))|mrg_2|$5<<9,
0, 0, 0);
ea_2(SIZE_W, DTA);
}
else { /* 32 bit dividend or product */
T_EMIT2((046000 | ($1 & ~1)) | mrg_2,
0, 0, 0);
T_EMIT2(($1&1)<<11 | $5<<12 | $5,
0, 0, 0);
ea_2(SIZE_L, DTA);
}
}
| DIVMUL sizedef ea ',' DREG ':' DREG
{ /* 64 bit dividend or product */
checksize($2, 4);
T_EMIT2((046000 | ($1 & ~1)) | mrg_2, 0, 0, 0);
T_EMIT2(($1&1)<<11 | $7<<12 | $5 | 02000 ,0,0,0);
ea_2(SIZE_L, DTA);
}
| DIVL sizedef ea ',' DREG ':' DREG
{ /* 32 bit long division with remainder */
checksize($2, 4);
T_EMIT2(($1 & ~1) | mrg_2, 0, 0, 0);
T_EMIT2(($1 & 1)<<11 | $7<<12 | $5 , 0, 0, 0);
ea_2(SIZE_L, DTA);
}
| LEA ea ',' AREG
{ T_EMIT2(040700 | mrg_2 | $4<<9,0,0,0);
ea_2(SIZE_L, CTR);
}
| op_ea ea
{ if (mrg_2==074)
serror("bad adressing category");
T_EMIT2(($1&0177700) | mrg_2,0,0,0);
ea_2($1&0300, $1&017);
}
| OP_NOOP
{ emit2($1);}
| OP_EXT SIZE DREG
{ checksize($2, ($1 & 0400) ? 4 : (2|4));
emit2($1 | $2+0100 | $3);
}
| OP_RANGE sizedef ea ',' reg
{ T_EMIT2(0300 | ($2<<3) | mrg_2,0,0,0);
T_EMIT2($1 | ($5<<12),0,0,0);
ea_2($2, CTR);
}
| TRAPCC SIZE imm
{ checksize($2, 2|4);
T_EMIT2($1 | ($2>>6)+1,0,0,0);
ea_2($2, 0);
}
| TRAPCC { emit2($1 | 4);}
| PACK '-' '(' AREG ')' ',' '-' '(' AREG ')' ',' imm
{ T_EMIT2($1 | 8 | $4 | $9<<9, 0, 0, 0);
ea_2(SIZE_W, 0);
}
| PACK DREG ',' DREG ',' imm
{ T_EMIT2($1 | $2 | $4<<9, 0, 0, 0);
ea_2(SIZE_W, 0);
}
| CMP sizedef ea_ea
{ cmp($2);}
| CHK sizedef ea ',' DREG
{ checksize($2, 2|4);
T_EMIT2(040000 | mrg_2 | $5<<9 |
($2==SIZE_W ? 0600 : 0400),
0, 0, 0);
ea_2($2, DTA);
}
| MOVE sizenon ea_ea
{ move($2);}
| MOVEM sizedef regs ',' notimmreg
{ movem(0, $2, $3);}
| MOVEM sizedef notimmreg ',' regs
{ movem(1, $2, $5);}
| MOVESP sizedef
{ curr_size = $1; }
ea_ea
{ if ($1 == 0) {
/* movep */
movep($2);
} else if (mrg_1 <= 017) {
T_EMIT2(007000 | $2 | mrg_2,0,0,0);
T_EMIT2(mrg_1 << 12 | 04000,0,0,0);
ea_2($2,ALT|MEM);
} else if (mrg_2 <= 017) {
T_EMIT2(007000 | $2 | mrg_1,0,0,0);
T_EMIT2(mrg_2 << 12,0,0,0);
ea_1($2,ALT|MEM);
} else
badoperand();
}
| MOVEC creg ',' reg
{ T_EMIT2(047172,0,0,0);
T_EMIT2($2 | $4<<12,0,0,0);
}
| MOVEC reg ',' creg
{ T_EMIT2(047173,0,0,0);
T_EMIT2($4 | $2<<12,0,0,0);
}
| EXG reg ',' reg
{ if (($2 & 010) == 0)
emit2(
(0140500|$4|$2<<9)
+
(($4&010)<<3)
);
else
emit2(
(0140610|$2|($4&07)<<9)
-
(($4&010)<<3)
);
}
| SWAP DREG
{ emit2(044100 | $2);}
| OP_IMM imm
{ T_EMIT2($1, 0, 0, 0);
ea_2(SIZE_W, 0);
}
| LINK sizenon AREG ',' imm
{ link_instr($2, $3);}
| UNLK AREG
{ emit2(047130 | $2);}
| TRAP '#' absexp
{ fit(fit4($3));
emit2(047100|low4($3));
}
| BKPT '#' absexp
{ fit(($3 & ~07) == 0);
emit2(044110 | low3($3));
}
| CALLM '#' absexp ',' ea
{ fit(fitb($3));
T_EMIT2(03300 | mrg_2,0,0,0);
T_EMIT2((short) $3,0,0,0);
ea_2(SIZE_L, CTR);
}
| RTM reg
{ emit2(03300 | $2);}
| CAS sizedef DREG ',' DREG ',' ea
{ T_EMIT2(04300 | (($2+0100)<<3) | mrg_2,0,0,0);
T_EMIT2($3 | ($5<<6),0,0,0);
ea_2($2, MEM|ALT);
}
| CAS2 sizedef DREG ':' DREG ',' DREG ':' DREG ','
'(' reg ')' ':' '(' reg ')'
{ checksize($2 , 2|4);
emit2(04374 | (($2+0100)<<3));
emit2($3 | ($7<<6) | ($12<<12));
emit2($5 | ($9<<6) | ($16<<12));
}
| fp_op
| mm_op
;
bcdx : ABCD
| ADDX sizedef
{ $$ = $1 | $2;}
;
creg : CREG
| SPEC { if ($1 != 075)
badoperand();
$$ = 04000;
}
;
off_width /* note: these should be curly brackets, but that would
* leave us without brackets for expressions.
*/
: '[' off31 ':' wid31 ']'
{ $$ = ($2<<6) | $4;
}
;
off31 : DREG { $$ = 040 | $1;}
| absexp { fit(fit5($1)); /* 0 to 31 */
$$ = low5($1);
}
;
wid31 : DREG { $$ = 040 | $1;}
| absexp { fit(fit5($1) - 1); /* 1 to 32 */
$$ = low5($1);
}
;
op_ea : OP_EA
| SZ_EA sizedef
{ $$ = $1 | $2;}
;
regs : rrange
| regs '/' rrange
{ $$ = $1 | $3;}
;
rrange : reg
{ $$ = 1<<$1;}
| reg '-' reg
{ if ($1 > $3)
badoperand();
for ($$ = 0; $1 <= $3; $1++)
$$ |= (1<<$1);
}
;
ea : DREG
{ mrg_2 = $1;}
| AREG
{ mrg_2 = 010 | $1;}
| SPEC
{ mrg_2 = $1;}
| notimmreg
| imm
;
notimmreg
:
{ mrg_2 = 0; ffew_2 = 0400; /* initialization */}
notimmreg1
;
notimmreg1
: '(' AREG ')'
{ mrg_2 = 020 | $2;}
| '(' AREG ')' '+'
{ mrg_2 = 030 | $2;}
| '-' '(' AREG ')'
{ mrg_2 = 040 | $3;}
| '(' expr ')' sizenon
{ bd_2 = $2; ea7071($4);
RELOMOVE(bd_rel2, relonami);
}
| '(' bd_areg_index ')'
{ if ((mrg_2 & INDEX) == 0)
ffew_2 |= 0100; /* suppress index */
if ( !(mrg_2 & PC_MODE) &&
(ffew_2 & 0300) == 0100 &&
bd_2.typ==S_ABS && fitw(bd_2.val)
)
mrg_2 = (loww(bd_2.val)?050:020) | $2;
else {
mrg_2 = (mrg_2&PC_MODE)?073:(060 | $2);
ffew_2 |= 060; /* long displacement */
}
}
| '(' '[' bd_areg_index ']' index_od ')'
{ switch(mrg_2 & INDEX) {
case 0:
ffew_2 |= 0163; /* suppress index */
break;
case DBL_INDEX:
serror("bad indexing");
case PRE_INDEX:
ffew_2 |= 063; break;
case POST_INDEX:
ffew_2 |= 067; break;
}
mrg_2 = (mrg_2 & PC_MODE) ? 073 : (060 | $3);
}
;
imm : '#' expr
{ mrg_2 = 074; bd_2 = $2;
RELOMOVE(bd_rel2, relonami);
}
;
bd_areg_index
: /* empty */
{ $$ = 0; ffew_2 |= 0200;
/* base-reg suppressed */
bd_2.typ = S_ABS; bd_2.val = (valu_t)0;
/* zero displacement */
}
| expr { $$ = 0; ffew_2 |= 0200;
bd_2 = $1;
RELOMOVE(bd_rel2, relonami);
}
| areg_index
{ bd_2.typ = S_ABS; bd_2.val = (valu_t)0;
}
| expr ',' areg_index
{ $$ = $3; bd_2 = $1;
RELOMOVE(bd_rel2, relonami);
}
;
areg_index
: areg
| index { $$ = 0;
ffew_2 |= 0200; /* base-reg suppressed */
mrg_2 |= PRE_INDEX;
}
| areg ',' index
{ mrg_2 |= PRE_INDEX;
}
;
areg : AREG
| PC { mrg_2 |= PC_MODE;
ffew_2 |= $1; /* base-reg suppressed for zpc */
$$ = 0;
}
;
index : reg sizedef scale
{ checksize($2, 2|4);
ffew_2 |= $1<<12 | ($2&0200)<<4 | $3;
}
;
scale : /* empty */
{ $$ = 0;}
| '*' absexp
{ $$ = checkscale($2);}
;
index_od: /* empty */
{ od_2.typ = S_ABS; od_2.val = (valu_t)0;}
| ',' index
{ od_2.typ = S_ABS; od_2.val = (valu_t)0;
mrg_2 |= POST_INDEX;
}
| ',' expr
{ od_2 = $2;
RELOMOVE(od_rel2, relonami);
}
| ',' index ',' expr
{ od_2 = $4;
mrg_2 |= POST_INDEX;
RELOMOVE(od_rel2, relonami);
}
;
reg : DREG
| AREG
{ $$ = $1 | 010;}
;
sizedef : /* empty */
{ $$ = SIZE_DEF; curr_size = SIZE_DEF; }
| SIZE { curr_size = $1; $$ = $1; }
;
sizenon : /* empty */
{ $$ = SIZE_NON;}
| SIZE
;
ea_ea : ea ','
{ mrg_1 = mrg_2;
bd_1 = bd_2;
od_1 = od_2;
ffew_1 = ffew_2;
RELOMOVE(bd_rel1, bd_rel2);
RELOMOVE(od_rel1, od_rel2);
}
ea
;
fp_op : CP
{ co_id = $1; }
fp_op1
| { co_id = DEF_FP; }
fp_op1
;
fp_op1 : FMOVE fsize ea ',' FPCR
{ check_fsize($2, FSIZE_L);
if ((mrg_2&070) == 010 && $5 != 001)
badoperand();
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0100000|($5<<10)),0,0,0);
ea_2(SIZE_L, 0);
}
| FMOVE fsize FPCR ',' ea
{ check_fsize($2, FSIZE_L);
if ((mrg_2&070) == 010 && $3 == 001)
badoperand();
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0120000|($3<<10)),0,0,0);
ea_2(SIZE_L, ALT);
}
| FMOVE fsize FPREG ',' FPREG
{ emit2(0170000|co_id);
emit2(($3<<10)|($5<<7));
}
| FMOVE fsize ea ',' FPREG
{ ch_sz_dreg($2, mrg_2&070);
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0040000|($2<<10)|($5<<7)),0,0,0);
ea_2(SIZE_L, DTA);
}
| FMOVE fsize FPREG ',' ea
{ ch_sz_dreg($2, mrg_2&070);
if ($2 == FSIZE_P)
serror("packed decimal needs k-factor");
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0060000|($2<<10)|($3<<7)),0,0,0);
ea_2(SIZE_L, DTA|ALT);
}
| FMOVE fsize FPREG ',' ea '{' '#' absexp '}'
{ check_fsize($2, FSIZE_P);
fit(sfit7($8));
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0066000|($3<<7)|low7($8)),0,0,0);
ea_2(SIZE_L, MEM|DTA|ALT);
}
| FMOVE fsize FPREG ',' ea '{' DREG '}'
{ check_fsize($2, FSIZE_P);
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0076000|($3<<7)|($7<<4)),0,0,0);
ea_2(SIZE_L, MEM|DTA|ALT);
}
| FMOVECR fsize '#' absexp ',' FPREG
{ fit(fit7($4));
check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(056000|($6<<7)|low7($4));
}
| FMOVEM FSIZE fregs ',' notimmreg
{ check_fsize($2, FSIZE_X);
if ((mrg_2&070) == 030)
serror("bad addressing category");
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2(0160000 |
(((mrg_2&070)==040 || ($3&04000)) ?
$3 :
(010000|reverse($3,8))),
0,0,0);
ea_2(SIZE_L, MEM|ALT);
}
| FMOVEM FSIZE notimmreg ',' fregs
{ check_fsize($2, FSIZE_X);
if ((mrg_2&070) == 040)
serror("bad addressing category");
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0150000|(($5&04000)?$5:reverse($5,8))),0,0,0);
ea_2(SIZE_L, MEM);
}
| FMOVEM SIZE fcregs ',' ea
{ checksize($2, 4);
if ((mrg_2&070) == 1 && $3!= 02000)
serror("bad addressing category");
if ((mrg_2 & 070) == 0 &&
$3 != 02000 && $3 != 04000 && $3 != 010000)
serror("bad addressing category");
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0120000|$3),0,0,0);
ea_2(SIZE_L, ALT);
}
| FMOVEM SIZE ea ',' fcregs
{ checksize($2, 4);
if ((mrg_2&070) == 1 && $5!= 02000)
serror("bad addressing category");
if ((mrg_2 & 070) == 0 &&
$5 != 02000 && $5 != 04000 && $5 != 010000)
serror("bad addressing category");
T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0100000|$5),0,0,0);
ea_2(SIZE_L, 0);
}
| FDYADIC fsize ea ',' FPREG
{ T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0040000|($2<<10)|($5<<7)|$1),0,0,0);
ch_sz_dreg($2, mrg_2&070);
ea_2(SIZE_L, DTA);
}
| FDYADIC fsize FPREG ',' FPREG
{ check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(($3<<10)|($5<<7)|$1);
}
| FMONADIC fsize ea ',' FPREG
{ T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0040000|($2<<10)|($5<<7)|$1),0,0,0);
ch_sz_dreg($2, mrg_2&070);
ea_2(SIZE_L, DTA);
}
| FMONADIC fsize FPREG ',' FPREG
{ check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(($3<<10)|($5<<7)|$1);
}
| FMONADIC fsize FPREG
{ check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(($3<<10)|($3<<7)|$1);
}
| FSINCOS fsize ea ',' FPREG ':' FPREG
{ T_EMIT2(0170000|co_id|mrg_2,0,0,0);
T_EMIT2(0040000|($2<<10)|($7<<7)|$1|$5,0,0,0);
ea_2(SIZE_L, DTA);
}
| FSINCOS fsize FPREG ',' FPREG ':' FPREG
{ check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(($3<<10)|($7<<7)|$1|$5);
}
| FBCC expr
{ fbranch($1, $2);}
| FDBCC DREG ',' expr
{ T_EMIT2(0170110|co_id|$2,0,0,0);
T_EMIT2($1,0,0,0);
$4.val -= (DOTVAL+dot_offset);
fit(fitw($4.val));
T_EMIT2(loww($4.val), $4.typ,
RELPC|RELO2,relonami);
}
| FNOP
{ emit2(0170200|co_id);
emit2(0);
}
| FSCC ea
{ T_EMIT2(0170100|co_id|mrg_2,0,0,0);
T_EMIT2($1,0,0,0);
ea_2(SIZE_B, DTA|ALT);
}
| FTST fsize ea
{ T_EMIT2((0170000|co_id|mrg_2),0,0,0);
T_EMIT2((0040072|($2<<10)),0,0,0);
ch_sz_dreg($2, mrg_2&070);
ea_2(SIZE_L, DTA);
}
| FTST fsize FPREG
{ check_fsize($2, FSIZE_X);
emit2(0170000|co_id);
emit2(($3<<10)|072);
}
| FSAVRES ea
{ if ((mrg_2&070) == ($1&070))
badoperand();
T_EMIT2((0170000|co_id|($1&0700)|mrg_2),0,0,0);
ea_2(0, $1&07);
}
| FTRAPCC
{ emit2(0170174|co_id);
emit2($1);
}
| FTRAPCC SIZE imm
{ checksize($2, 2|4);
T_EMIT2((0170170|co_id|($2==SIZE_L?03:02)),
0,0,0);
T_EMIT2($1,0,0,0);
ea_2($2,0);
}
;
fregs : DREG
{ $$ = 04000 | $1 << 4; }
| frlist
;
frlist : frrange
| frlist '/' frrange
{ $$ = $1 | $3;}
;
frrange : FPREG
{ $$ = 1 << $1; }
| FPREG '-' FPREG
{ if ($1 > $3)
badoperand();
for ($$ = 0; $1 <= $3; $1++)
$$ |= (1 << $1);
}
;
fcregs : FPCR
{ $$ = $1 << 10; }
| fcregs '/' FPCR
{ $$ = $1 | ($3 << 10); }
;
fsize : /* empty */
{ $$ = FSIZE_X; }
| SIZE
{ if ($1 == SIZE_L)
$$ = FSIZE_L;
else if ($1 == SIZE_W)
$$ = FSIZE_W;
else $$ = FSIZE_B;
}
| FSIZE
;
mm_op : CP
{ co_id = $1; }
mm_op1
| { co_id = DEF_MM; }
mm_op1
;
mm_op1 : /* Coprocessor instructions; syntax may be changed (please).
* No coprocessor defined extension words are emitted.
*/
CPBCC cp_cond expr
{ cpbcc($1 | co_id | $2, $3);
}
| CPDBCC cp_cond DREG ',' expr
{ T_EMIT2($1 | co_id | $3,0,0,0);
$5.val -= (DOTVAL+dot_offset);
fit(fitw($5.val));
T_EMIT2(loww($5.val), $5.typ,
RELPC|RELO2, relonami);
}
| CPGEN
{ T_EMIT2($1 | co_id,0,0,0);
/* NO COMMAND WORD IS EMITTED;
* THIS INSTRUCTIONS IS (STILL) ONE BIG RIDDLE.
* NO EFFECTIVE ADDRESS IS CALCULATED (SYNTAX ?)
*/
}
| CPSAVREST ea
{ T_EMIT2($1 | co_id | mrg_2,0,0,0);
if ($1 & 0100) {
/* restore */
ea_2(SIZE_W, (mrg_2 & 070)==030 ? 0 : CTR);
}
else ea_2(SIZE_W,(mrg_2 & 070)==020 ? 0 : CTR|ALT);
}
| CPSCC cp_cond ea
{ T_EMIT2($1 | co_id | mrg_2,0,0,0);
T_EMIT2($2,0,0,0);
ea_2(SIZE_B,DTA|ALT);
}
| CPTRAPCC cp_cond SIZE imm
{ checksize($3,2|4);
T_EMIT2($1 | co_id | ($3>>6)+1,0,0,0);
T_EMIT2($2,0,0,0);
ea_2($3, 0);
}
| CPTRAPCC cp_cond
{ emit2($1 | co_id | 4);
emit2($2);
}
/* M68030 MMU instructions */
| PFLUSHA
{ emit2(0170000);
emit2($1);
}
| PFLUSH fc ',' mask
{ emit2(0170000);
emit2($1|010000|($4<<5)|$2);
}
| PFLUSH fc ',' mask ',' ea
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|014000|($4<<5)|$2, 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
| PTEST fc ',' ea ',' mask
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|($6<<10)|$2, 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
| PTEST fc ',' ea ',' mask ',' AREG
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|($6<<10)|$2|0400|($8<<5), 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
| PLOAD fc ',' ea
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|$2, 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
| PMOVE MREG ',' ea
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|$2|01000, 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
| PMOVE ea ',' MREG
{ T_EMIT2(0170000|mrg_2, 0, 0, 0);
T_EMIT2($1|$4, 0, 0, 0);
ea_2(SIZE_L, DTA|CTR);
}
;
mask : '#' absexp
{ fit(fit3($2));
$$ = low3($2);
}
;
fc : '#' absexp
{ fit(fit3($2));
$$ = (020|low3($2));
}
| DREG
{ $$ = (010|$1); }
| CREG
{ if ($1 > 1) serror("illegal control register");
$$ = ($1&01);
}
;
cp_cond : DOT absexp
{ fit(fit6($2));
$$ = low6($2);
}
;
|
2e95a42421c554870328dd3bb3de88a8c9f60e79
|
52c8ed39b32ccc7c0673278c1adea3638797c9ff
|
/src/arch/arm64/mach-nswitch/include/nswitch-gpio.h
|
8678225e9a8d9fdc452ca9f25b673b1f44a2d9e3
|
[
"MIT"
] |
permissive
|
xboot/xboot
|
0cab7b440b612aa0a4c366025598a53a7ec3adf1
|
6d6b93947b7fcb8c3924fedb0715c23877eedd5e
|
refs/heads/master
| 2023-08-20T05:56:25.149388
| 2023-07-12T07:38:29
| 2023-07-12T07:38:29
| 471,539
| 765
| 296
|
MIT
| 2023-05-25T09:39:01
| 2010-01-14T08:25:12
|
C
|
UTF-8
|
C
| false
| false
| 13,964
|
h
|
nswitch-gpio.h
|
#ifndef __NSWITCH_GPIO_H__
#define __NSWITCH_GPIO_H__
#ifdef __cplusplus
extern "C" {
#endif
#define NSWITCH_GPIOA0 (0)
#define NSWITCH_GPIOA1 (1)
#define NSWITCH_GPIOA2 (2)
#define NSWITCH_GPIOA3 (3)
#define NSWITCH_GPIOA4 (4)
#define NSWITCH_GPIOA5 (5)
#define NSWITCH_GPIOA6 (6)
#define NSWITCH_GPIOA7 (7)
#define NSWITCH_GPIOB0 (8)
#define NSWITCH_GPIOB1 (9)
#define NSWITCH_GPIOB2 (10)
#define NSWITCH_GPIOB3 (11)
#define NSWITCH_GPIOB4 (12)
#define NSWITCH_GPIOB5 (13)
#define NSWITCH_GPIOB6 (14)
#define NSWITCH_GPIOB7 (15)
#define NSWITCH_GPIOC0 (16)
#define NSWITCH_GPIOC1 (17)
#define NSWITCH_GPIOC2 (18)
#define NSWITCH_GPIOC3 (19)
#define NSWITCH_GPIOC4 (20)
#define NSWITCH_GPIOC5 (21)
#define NSWITCH_GPIOC6 (22)
#define NSWITCH_GPIOC7 (23)
#define NSWITCH_GPIOD0 (24)
#define NSWITCH_GPIOD1 (25)
#define NSWITCH_GPIOD2 (26)
#define NSWITCH_GPIOD3 (27)
#define NSWITCH_GPIOD4 (28)
#define NSWITCH_GPIOD5 (29)
#define NSWITCH_GPIOD6 (30)
#define NSWITCH_GPIOD7 (31)
#define NSWITCH_GPIOE0 (32)
#define NSWITCH_GPIOE1 (33)
#define NSWITCH_GPIOE2 (34)
#define NSWITCH_GPIOE3 (35)
#define NSWITCH_GPIOE4 (36)
#define NSWITCH_GPIOE5 (37)
#define NSWITCH_GPIOE6 (38)
#define NSWITCH_GPIOE7 (39)
#define NSWITCH_GPIOF0 (40)
#define NSWITCH_GPIOF1 (41)
#define NSWITCH_GPIOF2 (42)
#define NSWITCH_GPIOF3 (43)
#define NSWITCH_GPIOF4 (44)
#define NSWITCH_GPIOF5 (45)
#define NSWITCH_GPIOF6 (46)
#define NSWITCH_GPIOF7 (47)
#define NSWITCH_GPIOG0 (48)
#define NSWITCH_GPIOG1 (49)
#define NSWITCH_GPIOG2 (50)
#define NSWITCH_GPIOG3 (51)
#define NSWITCH_GPIOG4 (52)
#define NSWITCH_GPIOG5 (53)
#define NSWITCH_GPIOG6 (54)
#define NSWITCH_GPIOG7 (55)
#define NSWITCH_GPIOH0 (56)
#define NSWITCH_GPIOH1 (57)
#define NSWITCH_GPIOH2 (58)
#define NSWITCH_GPIOH3 (59)
#define NSWITCH_GPIOH4 (60)
#define NSWITCH_GPIOH5 (61)
#define NSWITCH_GPIOH6 (62)
#define NSWITCH_GPIOH7 (63)
#define NSWITCH_GPIOI0 (64)
#define NSWITCH_GPIOI1 (65)
#define NSWITCH_GPIOI2 (66)
#define NSWITCH_GPIOI3 (67)
#define NSWITCH_GPIOI4 (68)
#define NSWITCH_GPIOI5 (69)
#define NSWITCH_GPIOI6 (70)
#define NSWITCH_GPIOI7 (71)
#define NSWITCH_GPIOJ0 (72)
#define NSWITCH_GPIOJ1 (73)
#define NSWITCH_GPIOJ2 (74)
#define NSWITCH_GPIOJ3 (75)
#define NSWITCH_GPIOJ4 (76)
#define NSWITCH_GPIOJ5 (77)
#define NSWITCH_GPIOJ6 (78)
#define NSWITCH_GPIOJ7 (79)
#define NSWITCH_GPIOK0 (80)
#define NSWITCH_GPIOK1 (81)
#define NSWITCH_GPIOK2 (82)
#define NSWITCH_GPIOK3 (83)
#define NSWITCH_GPIOK4 (84)
#define NSWITCH_GPIOK5 (85)
#define NSWITCH_GPIOK6 (86)
#define NSWITCH_GPIOK7 (87)
#define NSWITCH_GPIOL0 (88)
#define NSWITCH_GPIOL1 (89)
#define NSWITCH_GPIOL2 (90)
#define NSWITCH_GPIOL3 (91)
#define NSWITCH_GPIOL4 (92)
#define NSWITCH_GPIOL5 (93)
#define NSWITCH_GPIOL6 (94)
#define NSWITCH_GPIOL7 (95)
#define NSWITCH_GPIOM0 (96)
#define NSWITCH_GPIOM1 (97)
#define NSWITCH_GPIOM2 (98)
#define NSWITCH_GPIOM3 (99)
#define NSWITCH_GPIOM4 (100)
#define NSWITCH_GPIOM5 (101)
#define NSWITCH_GPIOM6 (102)
#define NSWITCH_GPIOM7 (103)
#define NSWITCH_GPION0 (104)
#define NSWITCH_GPION1 (105)
#define NSWITCH_GPION2 (106)
#define NSWITCH_GPION3 (107)
#define NSWITCH_GPION4 (108)
#define NSWITCH_GPION5 (109)
#define NSWITCH_GPION6 (110)
#define NSWITCH_GPION7 (111)
#define NSWITCH_GPIOO0 (112)
#define NSWITCH_GPIOO1 (113)
#define NSWITCH_GPIOO2 (114)
#define NSWITCH_GPIOO3 (115)
#define NSWITCH_GPIOO4 (116)
#define NSWITCH_GPIOO5 (117)
#define NSWITCH_GPIOO6 (118)
#define NSWITCH_GPIOO7 (119)
#define NSWITCH_GPIOP0 (120)
#define NSWITCH_GPIOP1 (121)
#define NSWITCH_GPIOP2 (122)
#define NSWITCH_GPIOP3 (123)
#define NSWITCH_GPIOP4 (124)
#define NSWITCH_GPIOP5 (125)
#define NSWITCH_GPIOP6 (126)
#define NSWITCH_GPIOP7 (127)
#define NSWITCH_GPIOQ0 (128)
#define NSWITCH_GPIOQ1 (129)
#define NSWITCH_GPIOQ2 (130)
#define NSWITCH_GPIOQ3 (131)
#define NSWITCH_GPIOQ4 (132)
#define NSWITCH_GPIOQ5 (133)
#define NSWITCH_GPIOQ6 (134)
#define NSWITCH_GPIOQ7 (135)
#define NSWITCH_GPIOR0 (136)
#define NSWITCH_GPIOR1 (137)
#define NSWITCH_GPIOR2 (138)
#define NSWITCH_GPIOR3 (139)
#define NSWITCH_GPIOR4 (140)
#define NSWITCH_GPIOR5 (141)
#define NSWITCH_GPIOR6 (142)
#define NSWITCH_GPIOR7 (143)
#define NSWITCH_GPIOS0 (144)
#define NSWITCH_GPIOS1 (145)
#define NSWITCH_GPIOS2 (146)
#define NSWITCH_GPIOS3 (147)
#define NSWITCH_GPIOS4 (148)
#define NSWITCH_GPIOS5 (149)
#define NSWITCH_GPIOS6 (150)
#define NSWITCH_GPIOS7 (151)
#define NSWITCH_GPIOT0 (152)
#define NSWITCH_GPIOT1 (153)
#define NSWITCH_GPIOT2 (154)
#define NSWITCH_GPIOT3 (155)
#define NSWITCH_GPIOT4 (156)
#define NSWITCH_GPIOT5 (157)
#define NSWITCH_GPIOT6 (158)
#define NSWITCH_GPIOT7 (159)
#define NSWITCH_GPIOU0 (160)
#define NSWITCH_GPIOU1 (161)
#define NSWITCH_GPIOU2 (162)
#define NSWITCH_GPIOU3 (163)
#define NSWITCH_GPIOU4 (164)
#define NSWITCH_GPIOU5 (165)
#define NSWITCH_GPIOU6 (166)
#define NSWITCH_GPIOU7 (167)
#define NSWITCH_GPIOV0 (168)
#define NSWITCH_GPIOV1 (169)
#define NSWITCH_GPIOV2 (170)
#define NSWITCH_GPIOV3 (171)
#define NSWITCH_GPIOV4 (172)
#define NSWITCH_GPIOV5 (173)
#define NSWITCH_GPIOV6 (174)
#define NSWITCH_GPIOV7 (175)
#define NSWITCH_GPIOW0 (176)
#define NSWITCH_GPIOW1 (177)
#define NSWITCH_GPIOW2 (178)
#define NSWITCH_GPIOW3 (179)
#define NSWITCH_GPIOW4 (180)
#define NSWITCH_GPIOW5 (181)
#define NSWITCH_GPIOW6 (182)
#define NSWITCH_GPIOW7 (183)
#define NSWITCH_GPIOX0 (184)
#define NSWITCH_GPIOX1 (185)
#define NSWITCH_GPIOX2 (186)
#define NSWITCH_GPIOX3 (187)
#define NSWITCH_GPIOX4 (188)
#define NSWITCH_GPIOX5 (189)
#define NSWITCH_GPIOX6 (190)
#define NSWITCH_GPIOX7 (191)
#define NSWITCH_GPIOY0 (192)
#define NSWITCH_GPIOY1 (193)
#define NSWITCH_GPIOY2 (194)
#define NSWITCH_GPIOY3 (195)
#define NSWITCH_GPIOY4 (196)
#define NSWITCH_GPIOY5 (197)
#define NSWITCH_GPIOY6 (198)
#define NSWITCH_GPIOY7 (199)
#define NSWITCH_GPIOZ0 (200)
#define NSWITCH_GPIOZ1 (201)
#define NSWITCH_GPIOZ2 (202)
#define NSWITCH_GPIOZ3 (203)
#define NSWITCH_GPIOZ4 (204)
#define NSWITCH_GPIOZ5 (205)
#define NSWITCH_GPIOZ6 (206)
#define NSWITCH_GPIOZ7 (207)
#define NSWITCH_GPIOAA0 (208)
#define NSWITCH_GPIOAA1 (209)
#define NSWITCH_GPIOAA2 (210)
#define NSWITCH_GPIOAA3 (211)
#define NSWITCH_GPIOAA4 (212)
#define NSWITCH_GPIOAA5 (213)
#define NSWITCH_GPIOAA6 (214)
#define NSWITCH_GPIOAA7 (215)
#define NSWITCH_GPIOBB0 (216)
#define NSWITCH_GPIOBB1 (217)
#define NSWITCH_GPIOBB2 (218)
#define NSWITCH_GPIOBB3 (219)
#define NSWITCH_GPIOBB4 (220)
#define NSWITCH_GPIOBB5 (221)
#define NSWITCH_GPIOBB6 (222)
#define NSWITCH_GPIOBB7 (223)
#define NSWITCH_GPIOCC0 (224)
#define NSWITCH_GPIOCC1 (225)
#define NSWITCH_GPIOCC2 (226)
#define NSWITCH_GPIOCC3 (227)
#define NSWITCH_GPIOCC4 (228)
#define NSWITCH_GPIOCC5 (229)
#define NSWITCH_GPIOCC6 (230)
#define NSWITCH_GPIOCC7 (231)
#define NSWITCH_GPIODD0 (232)
#define NSWITCH_GPIODD1 (233)
#define NSWITCH_GPIODD2 (234)
#define NSWITCH_GPIODD3 (235)
#define NSWITCH_GPIODD4 (236)
#define NSWITCH_GPIODD5 (237)
#define NSWITCH_GPIODD6 (238)
#define NSWITCH_GPIODD7 (239)
#define NSWITCH_GPIOEE0 (240)
#define NSWITCH_GPIOEE1 (241)
#define NSWITCH_GPIOEE2 (242)
#define NSWITCH_GPIOEE3 (243)
#define NSWITCH_GPIOEE4 (244)
#define NSWITCH_GPIOEE5 (245)
#define NSWITCH_GPIOEE6 (246)
#define NSWITCH_GPIOEE7 (247)
#define NSWITCH_PEX_L0_RST_N_PA0 (0)
#define NSWITCH_PEX_L0_CLKREQ_N_PA1 (1)
#define NSWITCH_PEX_WAKE_N_PA2 (2)
#define NSWITCH_PEX_L1_RST_N_PA3 (3)
#define NSWITCH_PEX_L1_CLKREQ_N_PA4 (4)
#define NSWITCH_SATA_LED_ACTIVE_PA5 (5)
#define NSWITCH_PA6 (6)
#define NSWITCH_DAP1_FS_PB0 (8)
#define NSWITCH_DAP1_DIN_PB1 (9)
#define NSWITCH_DAP1_DOUT_PB2 (10)
#define NSWITCH_DAP1_SCLK_PB3 (11)
#define NSWITCH_SPI2_MOSI_PB4 (12)
#define NSWITCH_SPI2_MISO_PB5 (13)
#define NSWITCH_SPI2_SCK_PB6 (14)
#define NSWITCH_SPI2_CS0_PB7 (15)
#define NSWITCH_SPI1_MOSI_PC0 (16)
#define NSWITCH_SPI1_MISO_PC1 (17)
#define NSWITCH_SPI1_SCK_PC2 (18)
#define NSWITCH_SPI1_CS0_PC3 (19)
#define NSWITCH_SPI1_CS1_PC4 (20)
#define NSWITCH_SPI4_SCK_PC5 (21)
#define NSWITCH_SPI4_CS0_PC6 (22)
#define NSWITCH_SPI4_MOSI_PC7 (23)
#define NSWITCH_SPI4_MISO_PD0 (24)
#define NSWITCH_UART3_TX_PD1 (25)
#define NSWITCH_UART3_RX_PD2 (26)
#define NSWITCH_UART3_RTS_PD3 (27)
#define NSWITCH_UART3_CTS_PD4 (28)
#define NSWITCH_DMIC1_CLK_PE0 (32)
#define NSWITCH_DMIC1_DAT_PE1 (33)
#define NSWITCH_DMIC2_CLK_PE2 (34)
#define NSWITCH_DMIC2_DAT_PE3 (35)
#define NSWITCH_DMIC3_CLK_PE4 (36)
#define NSWITCH_DMIC3_DAT_PE5 (37)
#define NSWITCH_PE6 (38)
#define NSWITCH_PE7 (39)
#define NSWITCH_GEN3_I2C_SCL_PF0 (40)
#define NSWITCH_GEN3_I2C_SDA_PF1 (41)
#define NSWITCH_UART2_TX_PG0 (48)
#define NSWITCH_UART2_RX_PG1 (49)
#define NSWITCH_UART2_RTS_PG2 (50)
#define NSWITCH_UART2_CTS_PG3 (51)
#define NSWITCH_WIFI_EN_PH0 (56)
#define NSWITCH_WIFI_RST_PH1 (57)
#define NSWITCH_WIFI_WAKE_AP_PH2 (58)
#define NSWITCH_AP_WAKE_BT_PH3 (59)
#define NSWITCH_BT_RST_PH4 (60)
#define NSWITCH_BT_WAKE_AP_PH5 (61)
#define NSWITCH_PH6 (62)
#define NSWITCH_AP_WAKE_NFC_PH7 (63)
#define NSWITCH_NFC_EN_PI0 (64)
#define NSWITCH_NFC_INT_PI1 (65)
#define NSWITCH_GPS_EN_PI2 (66)
#define NSWITCH_GPS_RST_PI3 (67)
#define NSWITCH_UART4_TX_PI4 (68)
#define NSWITCH_UART4_RX_PI5 (69)
#define NSWITCH_UART4_RTS_PI6 (70)
#define NSWITCH_UART4_CTS_PI7 (71)
#define NSWITCH_GEN1_I2C_SDA_PJ0 (72)
#define NSWITCH_GEN1_I2C_SCL_PJ1 (73)
#define NSWITCH_GEN2_I2C_SCL_PJ2 (74)
#define NSWITCH_GEN2_I2C_SDA_PJ3 (75)
#define NSWITCH_DAP4_FS_PJ4 (76)
#define NSWITCH_DAP4_DIN_PJ5 (77)
#define NSWITCH_DAP4_DOUT_PJ6 (78)
#define NSWITCH_DAP4_SCLK_PJ7 (79)
#define NSWITCH_PK0 (80)
#define NSWITCH_PK1 (81)
#define NSWITCH_PK2 (82)
#define NSWITCH_PK3 (83)
#define NSWITCH_PK4 (84)
#define NSWITCH_PK5 (85)
#define NSWITCH_PK6 (86)
#define NSWITCH_PK7 (87)
#define NSWITCH_PL0 (88)
#define NSWITCH_PL1 (89)
#define NSWITCH_SDMMC1_CLK_PM0 (96)
#define NSWITCH_SDMMC1_CMD_PM1 (97)
#define NSWITCH_SDMMC1_DAT3_PM2 (98)
#define NSWITCH_SDMMC1_DAT2_PM3 (99)
#define NSWITCH_SDMMC1_DAT1_PM4 (100)
#define NSWITCH_SDMMC1_DAT0_PM5 (101)
#define NSWITCH_SDMMC3_CLK_PP0 (120)
#define NSWITCH_SDMMC3_CMD_PP1 (121)
#define NSWITCH_SDMMC3_DAT3_PP2 (122)
#define NSWITCH_SDMMC3_DAT2_PP3 (123)
#define NSWITCH_SDMMC3_DAT1_PP4 (124)
#define NSWITCH_SDMMC3_DAT0_PP5 (125)
#define NSWITCH_CAM1_MCLK_PS0 (144)
#define NSWITCH_CAM2_MCLK_PS1 (145)
#define NSWITCH_CAM_I2C_SCL_PS2 (146)
#define NSWITCH_CAM_I2C_SDA_PS3 (147)
#define NSWITCH_CAM_RST_PS4 (148)
#define NSWITCH_CAM_AF_EN_PS5 (149)
#define NSWITCH_CAM_FLASH_EN_PS6 (150)
#define NSWITCH_CAM1_PWDN_PS7 (151)
#define NSWITCH_CAM2_PWDN_PT0 (152)
#define NSWITCH_CAM1_STROBE_PT1 (153)
#define NSWITCH_UART1_TX_PU0 (160)
#define NSWITCH_UART1_RX_PU1 (161)
#define NSWITCH_UART1_RTS_PU2 (162)
#define NSWITCH_UART1_CTS_PU3 (163)
#define NSWITCH_LCD_BL_PWM_PV0 (168)
#define NSWITCH_LCD_BL_EN_PV1 (169)
#define NSWITCH_LCD_RST_PV2 (170)
#define NSWITCH_LCD1_PV3 (171)
#define NSWITCH_LCD2_PV4 (172)
#define NSWITCH_AP_READY_PV5 (173)
#define NSWITCH_TOUCH_RST_PV6 (174)
#define NSWITCH_TOUCH_CLK_PV7 (175)
#define NSWITCH_MODEM_WAKE_AP_PX0 (184)
#define NSWITCH_TOUCH_INT_PX1 (185)
#define NSWITCH_MOTION_INT_PX2 (186)
#define NSWITCH_ALS_PROX_INT_PX3 (187)
#define NSWITCH_TEMP_ALERT_PX4 (188)
#define NSWITCH_BUTTON_POWER_ON_PX5 (189)
#define NSWITCH_BUTTON_VOL_UP_PX6 (190)
#define NSWITCH_BUTTON_VOL_DOWN_PX7 (191)
#define NSWITCH_BUTTON_SLIDE_SW_PY0 (192)
#define NSWITCH_BUTTON_HOME_PY1 (193)
#define NSWITCH_LCD_TE_PY2 (194)
#define NSWITCH_PWR_I2C_SCL_PY3 (195)
#define NSWITCH_PWR_I2C_SDA_PY4 (196)
#define NSWITCH_CLK_32K_OUT_PY5 (197)
#define NSWITCH_PZ0 (200)
#define NSWITCH_PZ1 (201)
#define NSWITCH_PZ2 (202)
#define NSWITCH_PZ3 (203)
#define NSWITCH_PZ4 (204)
#define NSWITCH_PZ5 (205)
#define NSWITCH_DAP2_FS_PAA0 (208)
#define NSWITCH_DAP2_SCLK_PAA1 (209)
#define NSWITCH_DAP2_DIN_PAA2 (210)
#define NSWITCH_DAP2_DOUT_PAA3 (211)
#define NSWITCH_AUD_MCLK_PBB0 (216)
#define NSWITCH_DVFS_PWM_PBB1 (217)
#define NSWITCH_DVFS_CLK_PBB2 (218)
#define NSWITCH_X1_AUD_PBB3 (219)
#define NSWITCH_X3_AUD_PBB4 (220)
#define NSWITCH_HDMI_CEC_PCC0 (224)
#define NSWITCH_HDMI_INT_DP_HPD_PCC1 (225)
#define NSWITCH_SPDIF_OUT_PCC2 (226)
#define NSWITCH_SPDIF_IN_PCC3 (227)
#define NSWITCH_USB_VBUS_EN0_PCC4 (228)
#define NSWITCH_USB_VBUS_EN1_PCC5 (229)
#define NSWITCH_DP_HPD0_PCC6 (230)
#define NSWITCH_PCC7 (231)
#define NSWITCH_SPI2_CS1_PDD0 (232)
#define NSWITCH_QSPI_SCK_PEE0 (240)
#define NSWITCH_QSPI_CS_N_PEE1 (241)
#define NSWITCH_QSPI_IO0_PEE2 (242)
#define NSWITCH_QSPI_IO1_PEE3 (243)
#define NSWITCH_QSPI_IO2_PEE4 (244)
#define NSWITCH_QSPI_IO3_PEE5 (245)
#ifdef __cplusplus
}
#endif
#endif /* __NSWITCH_GPIO_H__ */
|
3ede5ea725b5b72a8e66f48bfbc8270cfe81b3bd
|
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
|
/AKWF-c/AKWF_0009/AKWF_0890.h
|
9d2d49dfcefc8354f53ebc41b07622af1ffccbeb
|
[
"CC0-1.0"
] |
permissive
|
KristofferKarlAxelEkstrand/AKWF-FREE
|
b2defa1a2d389d309be6dd2e9f968923daf80d1b
|
cf8171df36e9fec25416b5f568b72a6e2cb69194
|
refs/heads/master
| 2023-07-23T18:22:36.939705
| 2023-07-10T17:14:40
| 2023-07-10T17:14:40
| 145,817,187
| 359
| 59
|
CC0-1.0
| 2023-07-10T17:14:41
| 2018-08-23T07:26:56
| null |
UTF-8
|
C
| false
| false
| 4,672
|
h
|
AKWF_0890.h
|
/* Adventure Kid Waveforms (AKWF) converted for use with Teensy Audio Library
*
* Adventure Kid Waveforms(AKWF) Open waveforms library
* https://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/
*
* This code is in the public domain, CC0 1.0 Universal (CC0 1.0)
* https://creativecommons.org/publicdomain/zero/1.0/
*
* Converted by Brad Roy, https://github.com/prosper00
*/
/* AKWF_0890 256 samples
+-----------------------------------------------------------------------------------------------------------------+
| ***** * |
| *** * |
| ** * |
| ** ** |
|** ** |
|* *** |
|* * * * |
| * * * |
| * **|
| ** **|
| * **|
| * * |
| ** * |
| *** * |
| ***** * |
+-----------------------------------------------------------------------------------------------------------------+
*/
const uint16_t AKWF_0890 [] = {
33992, 37643, 40702, 43541, 45977, 48197, 50129, 51869, 53399, 54764, 55976, 57044, 58006, 58841, 59607, 60255,
60870, 61368, 61866, 62246, 62651, 62934, 63272, 63476, 63760, 63904, 64145, 64242, 64446, 64510, 64681, 64725,
64861, 64900, 64998, 65046, 65096, 65167, 65166, 65273, 65214, 65363, 65243, 65442, 65258, 65510, 65265, 65535,
65271, 65535, 65281, 65535, 65299, 65535, 65332, 65535, 65385, 65535, 65467, 65490, 65535, 65356, 65535, 65141,
65535, 64760, 65535, 63839, 65535, 48300, 41436, 52564, 43855, 41448, 35078, 32406, 27827, 25389, 22050, 19897,
17473, 15587, 13852, 12205, 10989, 9551, 8717, 7473, 6916, 5848, 5483, 4581, 4342, 3594, 3433, 2825,
2707, 2229, 2128, 1765, 1666, 1403, 1300, 1120, 1012, 896, 784, 720, 605, 579, 468, 464,
363, 373, 281, 296, 220, 236, 174, 186, 138, 146, 110, 113, 89, 87, 73, 66,
60, 51, 48, 40, 40, 31, 32, 24, 27, 20, 21, 15, 17, 12, 14, 10,
12, 8, 9, 8, 8, 7, 5, 5, 5, 4, 3, 4, 3, 3, 2, 4,
4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2,
1, 2, 1, 3, 0, 5, 0, 5, 0, 5, 0, 7, 0, 7, 0, 5,
0, 4, 1, 3, 3, 0, 8, 0, 13, 0, 18, 1, 25, 0, 31, 0,
37, 0, 40, 0, 40, 0, 35, 0, 24, 1, 8, 8, 0, 34, 0, 66,
0, 102, 1, 139, 0, 173, 0, 203, 0, 220, 1, 223, 0, 201, 1, 149,
0, 56, 18, 0, 223, 0, 598, 0, 1538, 0, 19901, 22895, 12939, 22435, 24248, 31197,
};
|
86826bec0707d0044fe1cefc23999f43dc3eccb7
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/arm/imx/imx51_ipuv3var.h
|
e561aae0cf24c690f43c689d9e416bb2500906b5
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 3,576
|
h
|
imx51_ipuv3var.h
|
/* $NetBSD: imx51_ipuv3var.h,v 1.3 2015/12/21 04:26:28 hkenken Exp $ */
/*
* Copyright (c) 2009, 2011, 2012 Genetec Corporation. All rights reserved.
* Written by Hashimoto Kenichi for Genetec Corporation.
*
* 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 GENETEC CORPORATION ``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 GENETEC CORPORATION
* 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 _ARM_IMX_IMX51_IPUV3_H
#define _ARM_IMX_IMX51_IPUV3_H
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
#include <sys/bus.h>
/* IPUV3 Contoroller */
struct imx51_ipuv3_screen {
LIST_ENTRY(imx51_ipuv3_screen) link;
/* Frame buffer */
bus_dmamap_t dma;
bus_dma_segment_t segs[1];
int nsegs;
size_t buf_size;
size_t map_size;
void *buf_va;
int depth;
int stride;
/* DMA frame descriptor */
struct ipuv3_dma_descriptor *dma_desc;
paddr_t dma_desc_pa;
};
struct lcd_panel_geometry {
int depth;
short panel_width;
short panel_height;
uint32_t pixel_clk;
short hsync_width;
short left;
short right;
short vsync_width;
short upper;
short lower;
short panel_info;
#define IPUV3PANEL_SHARP (1<<0) /* sharp panel */
uint32_t panel_sig_pol;
};
struct imx51_ipuv3_softc {
device_t dev;
/* control register */
bus_space_tag_t iot;
bus_space_handle_t cm_ioh; /* CM */
bus_space_handle_t dmfc_ioh; /* DMFC */
bus_space_handle_t di0_ioh; /* DI 0 */
bus_space_handle_t dp_ioh; /* DP */
bus_space_handle_t dc_ioh; /* DC */
bus_space_handle_t idmac_ioh; /* IDMAC */
bus_space_handle_t cpmem_ioh; /* CPMEM */
bus_space_handle_t dctmpl_ioh; /* DCTMPL */
bus_dma_tag_t dma_tag;
uint32_t flags;
#define FLAG_NOUSE_ACBIAS (1U<<0)
const struct lcd_panel_geometry *geometry;
int n_screens;
LIST_HEAD(, imx51_ipuv3_screen) screens;
struct imx51_ipuv3_screen *active;
void *ih; /* interrupt handler */
device_t fbdev;
};
struct imx51_ipuv3_softc;
void imx51_ipuv3_attach_sub(struct imx51_ipuv3_softc *,
struct axi_attach_args *, const struct lcd_panel_geometry *);
int imx51_ipuv3_cnattach(bool);
void imx51_ipuv3_start_dma(struct imx51_ipuv3_softc *,
struct imx51_ipuv3_screen *);
void imx51_ipuv3_geometry(struct imx51_ipuv3_softc *,
const struct lcd_panel_geometry *);
int imx51_ipuv3_new_screen(struct imx51_ipuv3_softc *,
struct imx51_ipuv3_screen **);
int imx51_ipuv3_show_screen(void *, void *, int, void (*)(void *, int, int),
void *);
#endif /* _ARM_IMX_IMX51_IPUV3_H */
|
339d9701513965a6d344d2fe7b46882abee98251
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/ffmpeg/libavutil/channel_layout.c
|
e2f7512254a861542e592eaa1a340078c8a6ef31
|
[
"BSD-3-Clause",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"LGPL-2.1-only",
"LGPL-3.0-only",
"GPL-2.0-only",
"LGPL-2.1-or-later",
"GPL-3.0-or-later",
"LGPL-3.0-or-later",
"IJG",
"LicenseRef-scancode-other-permissive",
"GPL-2.0-or-later",
"GPL-3.0-only"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 34,336
|
c
|
channel_layout.c
|
/*
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* audio channel layout utility functions
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "avassert.h"
#include "channel_layout.h"
#include "bprint.h"
#include "common.h"
#include "error.h"
#include "macros.h"
#include "opt.h"
#define CHAN_IS_AMBI(x) ((x) >= AV_CHAN_AMBISONIC_BASE &&\
(x) <= AV_CHAN_AMBISONIC_END)
struct channel_name {
const char *name;
const char *description;
};
static const struct channel_name channel_names[] = {
[AV_CHAN_FRONT_LEFT ] = { "FL", "front left" },
[AV_CHAN_FRONT_RIGHT ] = { "FR", "front right" },
[AV_CHAN_FRONT_CENTER ] = { "FC", "front center" },
[AV_CHAN_LOW_FREQUENCY ] = { "LFE", "low frequency" },
[AV_CHAN_BACK_LEFT ] = { "BL", "back left" },
[AV_CHAN_BACK_RIGHT ] = { "BR", "back right" },
[AV_CHAN_FRONT_LEFT_OF_CENTER ] = { "FLC", "front left-of-center" },
[AV_CHAN_FRONT_RIGHT_OF_CENTER] = { "FRC", "front right-of-center" },
[AV_CHAN_BACK_CENTER ] = { "BC", "back center" },
[AV_CHAN_SIDE_LEFT ] = { "SL", "side left" },
[AV_CHAN_SIDE_RIGHT ] = { "SR", "side right" },
[AV_CHAN_TOP_CENTER ] = { "TC", "top center" },
[AV_CHAN_TOP_FRONT_LEFT ] = { "TFL", "top front left" },
[AV_CHAN_TOP_FRONT_CENTER ] = { "TFC", "top front center" },
[AV_CHAN_TOP_FRONT_RIGHT ] = { "TFR", "top front right" },
[AV_CHAN_TOP_BACK_LEFT ] = { "TBL", "top back left" },
[AV_CHAN_TOP_BACK_CENTER ] = { "TBC", "top back center" },
[AV_CHAN_TOP_BACK_RIGHT ] = { "TBR", "top back right" },
[AV_CHAN_STEREO_LEFT ] = { "DL", "downmix left" },
[AV_CHAN_STEREO_RIGHT ] = { "DR", "downmix right" },
[AV_CHAN_WIDE_LEFT ] = { "WL", "wide left" },
[AV_CHAN_WIDE_RIGHT ] = { "WR", "wide right" },
[AV_CHAN_SURROUND_DIRECT_LEFT ] = { "SDL", "surround direct left" },
[AV_CHAN_SURROUND_DIRECT_RIGHT] = { "SDR", "surround direct right" },
[AV_CHAN_LOW_FREQUENCY_2 ] = { "LFE2", "low frequency 2" },
[AV_CHAN_TOP_SIDE_LEFT ] = { "TSL", "top side left" },
[AV_CHAN_TOP_SIDE_RIGHT ] = { "TSR", "top side right" },
[AV_CHAN_BOTTOM_FRONT_CENTER ] = { "BFC", "bottom front center" },
[AV_CHAN_BOTTOM_FRONT_LEFT ] = { "BFL", "bottom front left" },
[AV_CHAN_BOTTOM_FRONT_RIGHT ] = { "BFR", "bottom front right" },
};
static const char *get_channel_name(enum AVChannel channel_id)
{
if ((unsigned) channel_id >= FF_ARRAY_ELEMS(channel_names) ||
!channel_names[channel_id].name)
return NULL;
return channel_names[channel_id].name;
}
void av_channel_name_bprint(AVBPrint *bp, enum AVChannel channel_id)
{
if (channel_id >= AV_CHAN_AMBISONIC_BASE &&
channel_id <= AV_CHAN_AMBISONIC_END)
av_bprintf(bp, "AMBI%d", channel_id - AV_CHAN_AMBISONIC_BASE);
else if ((unsigned)channel_id < FF_ARRAY_ELEMS(channel_names) &&
channel_names[channel_id].name)
av_bprintf(bp, "%s", channel_names[channel_id].name);
else if (channel_id == AV_CHAN_NONE)
av_bprintf(bp, "NONE");
else
av_bprintf(bp, "USR%d", channel_id);
}
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel_id)
{
AVBPrint bp;
if (!buf && buf_size)
return AVERROR(EINVAL);
av_bprint_init_for_buffer(&bp, buf, buf_size);
av_channel_name_bprint(&bp, channel_id);
return bp.len;
}
void av_channel_description_bprint(AVBPrint *bp, enum AVChannel channel_id)
{
if (channel_id >= AV_CHAN_AMBISONIC_BASE &&
channel_id <= AV_CHAN_AMBISONIC_END)
av_bprintf(bp, "ambisonic ACN %d", channel_id - AV_CHAN_AMBISONIC_BASE);
else if ((unsigned)channel_id < FF_ARRAY_ELEMS(channel_names) &&
channel_names[channel_id].description)
av_bprintf(bp, "%s", channel_names[channel_id].description);
else if (channel_id == AV_CHAN_NONE)
av_bprintf(bp, "none");
else
av_bprintf(bp, "user %d", channel_id);
}
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel_id)
{
AVBPrint bp;
if (!buf && buf_size)
return AVERROR(EINVAL);
av_bprint_init_for_buffer(&bp, buf, buf_size);
av_channel_description_bprint(&bp, channel_id);
return bp.len;
}
enum AVChannel av_channel_from_string(const char *str)
{
int i;
char *endptr = (char *)str;
enum AVChannel id = AV_CHAN_NONE;
if (!strncmp(str, "AMBI", 4)) {
i = strtol(str + 4, NULL, 0);
if (i < 0 || i > AV_CHAN_AMBISONIC_END - AV_CHAN_AMBISONIC_BASE)
return AV_CHAN_NONE;
return AV_CHAN_AMBISONIC_BASE + i;
}
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++) {
if (channel_names[i].name && !strcmp(str, channel_names[i].name))
return i;
}
if (!strncmp(str, "USR", 3)) {
const char *p = str + 3;
id = strtol(p, &endptr, 0);
}
if (id >= 0 && !*endptr)
return id;
return AV_CHAN_NONE;
}
struct channel_layout_name {
const char *name;
AVChannelLayout layout;
};
static const struct channel_layout_name channel_layout_map[] = {
{ "mono", AV_CHANNEL_LAYOUT_MONO },
{ "stereo", AV_CHANNEL_LAYOUT_STEREO },
{ "2.1", AV_CHANNEL_LAYOUT_2POINT1 },
{ "3.0", AV_CHANNEL_LAYOUT_SURROUND },
{ "3.0(back)", AV_CHANNEL_LAYOUT_2_1 },
{ "4.0", AV_CHANNEL_LAYOUT_4POINT0 },
{ "quad", AV_CHANNEL_LAYOUT_QUAD },
{ "quad(side)", AV_CHANNEL_LAYOUT_2_2 },
{ "3.1", AV_CHANNEL_LAYOUT_3POINT1 },
{ "5.0", AV_CHANNEL_LAYOUT_5POINT0_BACK },
{ "5.0(side)", AV_CHANNEL_LAYOUT_5POINT0 },
{ "4.1", AV_CHANNEL_LAYOUT_4POINT1 },
{ "5.1", AV_CHANNEL_LAYOUT_5POINT1_BACK },
{ "5.1(side)", AV_CHANNEL_LAYOUT_5POINT1 },
{ "6.0", AV_CHANNEL_LAYOUT_6POINT0 },
{ "6.0(front)", AV_CHANNEL_LAYOUT_6POINT0_FRONT },
{ "hexagonal", AV_CHANNEL_LAYOUT_HEXAGONAL },
{ "6.1", AV_CHANNEL_LAYOUT_6POINT1 },
{ "6.1(back)", AV_CHANNEL_LAYOUT_6POINT1_BACK },
{ "6.1(front)", AV_CHANNEL_LAYOUT_6POINT1_FRONT },
{ "7.0", AV_CHANNEL_LAYOUT_7POINT0 },
{ "7.0(front)", AV_CHANNEL_LAYOUT_7POINT0_FRONT },
{ "7.1", AV_CHANNEL_LAYOUT_7POINT1 },
{ "7.1(wide)", AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK },
{ "7.1(wide-side)", AV_CHANNEL_LAYOUT_7POINT1_WIDE },
{ "7.1(top)", AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK },
{ "octagonal", AV_CHANNEL_LAYOUT_OCTAGONAL },
{ "cube", AV_CHANNEL_LAYOUT_CUBE },
{ "hexadecagonal", AV_CHANNEL_LAYOUT_HEXADECAGONAL },
{ "downmix", AV_CHANNEL_LAYOUT_STEREO_DOWNMIX, },
{ "22.2", AV_CHANNEL_LAYOUT_22POINT2, },
};
#if FF_API_OLD_CHANNEL_LAYOUT
FF_DISABLE_DEPRECATION_WARNINGS
static uint64_t get_channel_layout_single(const char *name, int name_len)
{
int i;
char *end;
int64_t layout;
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {
if (strlen(channel_layout_map[i].name) == name_len &&
!memcmp(channel_layout_map[i].name, name, name_len))
return channel_layout_map[i].layout.u.mask;
}
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
if (channel_names[i].name &&
strlen(channel_names[i].name) == name_len &&
!memcmp(channel_names[i].name, name, name_len))
return (int64_t)1 << i;
errno = 0;
i = strtol(name, &end, 10);
if (!errno && (end + 1 - name == name_len && *end == 'c'))
return av_get_default_channel_layout(i);
errno = 0;
layout = strtoll(name, &end, 0);
if (!errno && end - name == name_len)
return FFMAX(layout, 0);
return 0;
}
uint64_t av_get_channel_layout(const char *name)
{
const char *n, *e;
const char *name_end = name + strlen(name);
int64_t layout = 0, layout_single;
for (n = name; n < name_end; n = e + 1) {
for (e = n; e < name_end && *e != '+' && *e != '|'; e++);
layout_single = get_channel_layout_single(n, e - n);
if (!layout_single)
return 0;
layout |= layout_single;
}
return layout;
}
int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels)
{
int nb = 0;
char *end;
uint64_t layout = av_get_channel_layout(name);
if (layout) {
*channel_layout = layout;
*nb_channels = av_get_channel_layout_nb_channels(layout);
return 0;
}
nb = strtol(name, &end, 10);
if (!errno && *end == 'C' && *(end + 1) == '\0' && nb > 0 && nb < 64) {
*channel_layout = 0;
*nb_channels = nb;
return 0;
}
return AVERROR(EINVAL);
}
void av_bprint_channel_layout(struct AVBPrint *bp,
int nb_channels, uint64_t channel_layout)
{
int i;
if (nb_channels <= 0)
nb_channels = av_get_channel_layout_nb_channels(channel_layout);
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (nb_channels == channel_layout_map[i].layout.nb_channels &&
channel_layout == channel_layout_map[i].layout.u.mask) {
av_bprintf(bp, "%s", channel_layout_map[i].name);
return;
}
av_bprintf(bp, "%d channels", nb_channels);
if (channel_layout) {
int i, ch;
av_bprintf(bp, " (");
for (i = 0, ch = 0; i < 64; i++) {
if ((channel_layout & (UINT64_C(1) << i))) {
const char *name = get_channel_name(i);
if (name) {
if (ch > 0)
av_bprintf(bp, "+");
av_bprintf(bp, "%s", name);
}
ch++;
}
}
av_bprintf(bp, ")");
}
}
void av_get_channel_layout_string(char *buf, int buf_size,
int nb_channels, uint64_t channel_layout)
{
AVBPrint bp;
av_bprint_init_for_buffer(&bp, buf, buf_size);
av_bprint_channel_layout(&bp, nb_channels, channel_layout);
}
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
{
return av_popcount64(channel_layout);
}
int64_t av_get_default_channel_layout(int nb_channels) {
int i;
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (nb_channels == channel_layout_map[i].layout.nb_channels)
return channel_layout_map[i].layout.u.mask;
return 0;
}
int av_get_channel_layout_channel_index(uint64_t channel_layout,
uint64_t channel)
{
if (!(channel_layout & channel) ||
av_get_channel_layout_nb_channels(channel) != 1)
return AVERROR(EINVAL);
channel_layout &= channel - 1;
return av_get_channel_layout_nb_channels(channel_layout);
}
const char *av_get_channel_name(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < 64; i++)
if ((1ULL<<i) & channel)
return get_channel_name(i);
return NULL;
}
const char *av_get_channel_description(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
if ((1ULL<<i) & channel)
return channel_names[i].description;
return NULL;
}
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
{
int i;
if (av_get_channel_layout_nb_channels(channel_layout) <= index)
return 0;
for (i = 0; i < 64; i++) {
if ((1ULL << i) & channel_layout && !index--)
return 1ULL << i;
}
return 0;
}
int av_get_standard_channel_layout(unsigned index, uint64_t *layout,
const char **name)
{
if (index >= FF_ARRAY_ELEMS(channel_layout_map))
return AVERROR_EOF;
if (layout) *layout = channel_layout_map[index].layout.u.mask;
if (name) *name = channel_layout_map[index].name;
return 0;
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
int av_channel_layout_from_mask(AVChannelLayout *channel_layout,
uint64_t mask)
{
if (!mask)
return AVERROR(EINVAL);
channel_layout->order = AV_CHANNEL_ORDER_NATIVE;
channel_layout->nb_channels = av_popcount64(mask);
channel_layout->u.mask = mask;
return 0;
}
int av_channel_layout_from_string(AVChannelLayout *channel_layout,
const char *str)
{
int i;
int channels = 0, nb_channels = 0, native = 1;
enum AVChannel highest_channel = AV_CHAN_NONE;
const char *dup;
char *chlist, *end;
uint64_t mask = 0;
/* channel layout names */
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) {
if (channel_layout_map[i].name && !strcmp(str, channel_layout_map[i].name)) {
*channel_layout = channel_layout_map[i].layout;
return 0;
}
}
/* ambisonic */
if (!strncmp(str, "ambisonic ", 10)) {
const char *p = str + 10;
char *endptr;
AVChannelLayout extra = {0};
int order;
order = strtol(p, &endptr, 0);
if (order < 0 || order + 1 > INT_MAX / (order + 1) ||
(*endptr && *endptr != '+'))
return AVERROR(EINVAL);
channel_layout->order = AV_CHANNEL_ORDER_AMBISONIC;
channel_layout->nb_channels = (order + 1) * (order + 1);
if (*endptr) {
int ret = av_channel_layout_from_string(&extra, endptr + 1);
if (ret < 0)
return ret;
if (extra.nb_channels >= INT_MAX - channel_layout->nb_channels) {
av_channel_layout_uninit(&extra);
return AVERROR(EINVAL);
}
if (extra.order == AV_CHANNEL_ORDER_NATIVE) {
channel_layout->u.mask = extra.u.mask;
} else {
channel_layout->order = AV_CHANNEL_ORDER_CUSTOM;
channel_layout->u.map =
av_calloc(channel_layout->nb_channels + extra.nb_channels,
sizeof(*channel_layout->u.map));
if (!channel_layout->u.map) {
av_channel_layout_uninit(&extra);
return AVERROR(ENOMEM);
}
for (i = 0; i < channel_layout->nb_channels; i++)
channel_layout->u.map[i].id = AV_CHAN_AMBISONIC_BASE + i;
for (i = 0; i < extra.nb_channels; i++) {
enum AVChannel ch = av_channel_layout_channel_from_index(&extra, i);
if (CHAN_IS_AMBI(ch)) {
av_channel_layout_uninit(&extra);
return AVERROR(EINVAL);
}
channel_layout->u.map[channel_layout->nb_channels + i].id = ch;
if (extra.order == AV_CHANNEL_ORDER_CUSTOM &&
extra.u.map[i].name[0])
av_strlcpy(channel_layout->u.map[channel_layout->nb_channels + i].name,
extra.u.map[i].name,
sizeof(channel_layout->u.map[channel_layout->nb_channels + i].name));
}
}
channel_layout->nb_channels += extra.nb_channels;
av_channel_layout_uninit(&extra);
}
return 0;
}
chlist = av_strdup(str);
if (!chlist)
return AVERROR(ENOMEM);
/* channel names */
av_sscanf(str, "%d channels (%[^)]", &nb_channels, chlist);
end = strchr(str, ')');
dup = chlist;
while (*dup) {
char *channel, *chname;
int ret = av_opt_get_key_value(&dup, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname);
if (ret < 0) {
av_free(chlist);
return ret;
}
if (*dup)
dup++; // skip separator
if (channel && !*channel)
av_freep(&channel);
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++) {
if (channel_names[i].name && !strcmp(channel ? channel : chname, channel_names[i].name)) {
if (channel || i < highest_channel || mask & (1ULL << i))
native = 0; // Not a native layout, use a custom one
highest_channel = i;
mask |= 1ULL << i;
break;
}
}
if (!channel && i >= FF_ARRAY_ELEMS(channel_names)) {
char *endptr = chname;
enum AVChannel id = AV_CHAN_NONE;
if (!strncmp(chname, "USR", 3)) {
const char *p = chname + 3;
id = strtol(p, &endptr, 0);
}
if (id < 0 || *endptr) {
native = 0; // Unknown channel name
channels = 0;
mask = 0;
av_free(chname);
break;
}
if (id > 63)
native = 0; // Not a native layout, use a custom one
else {
if (id < highest_channel || mask & (1ULL << id))
native = 0; // Not a native layout, use a custom one
highest_channel = id;
mask |= 1ULL << id;
}
}
channels++;
av_free(channel);
av_free(chname);
}
if (mask && native) {
av_free(chlist);
if (nb_channels && ((nb_channels != channels) || (!end || *++end)))
return AVERROR(EINVAL);
av_channel_layout_from_mask(channel_layout, mask);
return 0;
}
/* custom layout of channel names */
if (channels && !native) {
int idx = 0;
if (nb_channels && ((nb_channels != channels) || (!end || *++end))) {
av_free(chlist);
return AVERROR(EINVAL);
}
channel_layout->u.map = av_calloc(channels, sizeof(*channel_layout->u.map));
if (!channel_layout->u.map) {
av_free(chlist);
return AVERROR(ENOMEM);
}
channel_layout->order = AV_CHANNEL_ORDER_CUSTOM;
channel_layout->nb_channels = channels;
dup = chlist;
while (*dup) {
char *channel, *chname;
int ret = av_opt_get_key_value(&dup, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname);
if (ret < 0) {
av_freep(&channel_layout->u.map);
av_free(chlist);
return ret;
}
if (*dup)
dup++; // skip separator
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++) {
if (channel_names[i].name && !strcmp(channel ? channel : chname, channel_names[i].name)) {
channel_layout->u.map[idx].id = i;
if (channel)
av_strlcpy(channel_layout->u.map[idx].name, chname, sizeof(channel_layout->u.map[idx].name));
idx++;
break;
}
}
if (i >= FF_ARRAY_ELEMS(channel_names)) {
const char *p = (channel ? channel : chname) + 3;
channel_layout->u.map[idx].id = strtol(p, NULL, 0);
if (channel)
av_strlcpy(channel_layout->u.map[idx].name, chname, sizeof(channel_layout->u.map[idx].name));
idx++;
}
av_free(channel);
av_free(chname);
}
av_free(chlist);
return 0;
}
av_freep(&chlist);
errno = 0;
mask = strtoull(str, &end, 0);
/* channel layout mask */
if (!errno && !*end && !strchr(str, '-') && mask) {
av_channel_layout_from_mask(channel_layout, mask);
return 0;
}
errno = 0;
channels = strtol(str, &end, 10);
/* number of channels */
if (!errno && !strcmp(end, "c") && channels > 0) {
av_channel_layout_default(channel_layout, channels);
if (channel_layout->order == AV_CHANNEL_ORDER_NATIVE)
return 0;
}
/* number of unordered channels */
if (!errno && (!strcmp(end, "C") || !strcmp(end, " channels"))
&& channels > 0) {
channel_layout->order = AV_CHANNEL_ORDER_UNSPEC;
channel_layout->nb_channels = channels;
return 0;
}
return AVERROR(EINVAL);
}
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
{
if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM)
av_freep(&channel_layout->u.map);
memset(channel_layout, 0, sizeof(*channel_layout));
}
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
{
av_channel_layout_uninit(dst);
*dst = *src;
if (src->order == AV_CHANNEL_ORDER_CUSTOM) {
dst->u.map = av_malloc_array(src->nb_channels, sizeof(*dst->u.map));
if (!dst->u.map)
return AVERROR(ENOMEM);
memcpy(dst->u.map, src->u.map, src->nb_channels * sizeof(*src->u.map));
}
return 0;
}
/**
* If the layout is n-th order standard-order ambisonic, with optional
* extra non-diegetic channels at the end, return the order.
* Return a negative error code otherwise.
*/
static int ambisonic_order(const AVChannelLayout *channel_layout)
{
int i, highest_ambi, order;
highest_ambi = -1;
if (channel_layout->order == AV_CHANNEL_ORDER_AMBISONIC)
highest_ambi = channel_layout->nb_channels - av_popcount64(channel_layout->u.mask) - 1;
else {
const AVChannelCustom *map = channel_layout->u.map;
av_assert0(channel_layout->order == AV_CHANNEL_ORDER_CUSTOM);
for (i = 0; i < channel_layout->nb_channels; i++) {
int is_ambi = CHAN_IS_AMBI(map[i].id);
/* ambisonic following non-ambisonic */
if (i > 0 && is_ambi && !CHAN_IS_AMBI(map[i - 1].id))
return AVERROR(EINVAL);
/* non-default ordering */
if (is_ambi && map[i].id - AV_CHAN_AMBISONIC_BASE != i)
return AVERROR(EINVAL);
if (CHAN_IS_AMBI(map[i].id))
highest_ambi = i;
}
}
/* no ambisonic channels*/
if (highest_ambi < 0)
return AVERROR(EINVAL);
order = floor(sqrt(highest_ambi));
/* incomplete order - some harmonics are missing */
if ((order + 1) * (order + 1) != highest_ambi + 1)
return AVERROR(EINVAL);
return order;
}
/**
* If the custom layout is n-th order standard-order ambisonic, with optional
* extra non-diegetic channels at the end, write its string description in bp.
* Return a negative error code otherwise.
*/
static int try_describe_ambisonic(AVBPrint *bp, const AVChannelLayout *channel_layout)
{
int nb_ambi_channels;
int order = ambisonic_order(channel_layout);
if (order < 0)
return order;
av_bprintf(bp, "ambisonic %d", order);
/* extra channels present */
nb_ambi_channels = (order + 1) * (order + 1);
if (nb_ambi_channels < channel_layout->nb_channels) {
AVChannelLayout extra = { 0 };
if (channel_layout->order == AV_CHANNEL_ORDER_AMBISONIC) {
extra.order = AV_CHANNEL_ORDER_NATIVE;
extra.nb_channels = av_popcount64(channel_layout->u.mask);
extra.u.mask = channel_layout->u.mask;
} else {
extra.order = AV_CHANNEL_ORDER_CUSTOM;
extra.nb_channels = channel_layout->nb_channels - nb_ambi_channels;
extra.u.map = channel_layout->u.map + nb_ambi_channels;
}
av_bprint_chars(bp, '+', 1);
av_channel_layout_describe_bprint(&extra, bp);
/* Not calling uninit here on extra because we don't own the u.map pointer */
}
return 0;
}
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout,
AVBPrint *bp)
{
int i;
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_NATIVE:
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (channel_layout->u.mask == channel_layout_map[i].layout.u.mask) {
av_bprintf(bp, "%s", channel_layout_map[i].name);
return 0;
}
// fall-through
case AV_CHANNEL_ORDER_CUSTOM:
if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) {
int res = try_describe_ambisonic(bp, channel_layout);
if (res >= 0)
return 0;
}
if (channel_layout->nb_channels)
av_bprintf(bp, "%d channels (", channel_layout->nb_channels);
for (i = 0; i < channel_layout->nb_channels; i++) {
enum AVChannel ch = av_channel_layout_channel_from_index(channel_layout, i);
if (i)
av_bprintf(bp, "+");
av_channel_name_bprint(bp, ch);
if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM &&
channel_layout->u.map[i].name[0])
av_bprintf(bp, "@%s", channel_layout->u.map[i].name);
}
if (channel_layout->nb_channels) {
av_bprintf(bp, ")");
return 0;
}
// fall-through
case AV_CHANNEL_ORDER_UNSPEC:
av_bprintf(bp, "%d channels", channel_layout->nb_channels);
return 0;
case AV_CHANNEL_ORDER_AMBISONIC:
return try_describe_ambisonic(bp, channel_layout);
default:
return AVERROR(EINVAL);
}
}
int av_channel_layout_describe(const AVChannelLayout *channel_layout,
char *buf, size_t buf_size)
{
AVBPrint bp;
int ret;
if (!buf && buf_size)
return AVERROR(EINVAL);
av_bprint_init_for_buffer(&bp, buf, buf_size);
ret = av_channel_layout_describe_bprint(channel_layout, &bp);
if (ret < 0)
return ret;
return bp.len;
}
enum AVChannel
av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout,
unsigned int idx)
{
int i;
if (idx >= channel_layout->nb_channels)
return AV_CHAN_NONE;
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_CUSTOM:
return channel_layout->u.map[idx].id;
case AV_CHANNEL_ORDER_AMBISONIC: {
int ambi_channels = channel_layout->nb_channels - av_popcount64(channel_layout->u.mask);
if (idx < ambi_channels)
return AV_CHAN_AMBISONIC_BASE + idx;
idx -= ambi_channels;
}
// fall-through
case AV_CHANNEL_ORDER_NATIVE:
for (i = 0; i < 64; i++) {
if ((1ULL << i) & channel_layout->u.mask && !idx--)
return i;
}
default:
return AV_CHAN_NONE;
}
}
enum AVChannel
av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout,
const char *str)
{
int index = av_channel_layout_index_from_string(channel_layout, str);
if (index < 0)
return AV_CHAN_NONE;
return av_channel_layout_channel_from_index(channel_layout, index);
}
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout,
enum AVChannel channel)
{
int i;
if (channel == AV_CHAN_NONE)
return AVERROR(EINVAL);
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_CUSTOM:
for (i = 0; i < channel_layout->nb_channels; i++)
if (channel_layout->u.map[i].id == channel)
return i;
return AVERROR(EINVAL);
case AV_CHANNEL_ORDER_AMBISONIC:
case AV_CHANNEL_ORDER_NATIVE: {
uint64_t mask = channel_layout->u.mask;
int ambi_channels = channel_layout->nb_channels - av_popcount64(mask);
if (channel_layout->order == AV_CHANNEL_ORDER_AMBISONIC &&
channel >= AV_CHAN_AMBISONIC_BASE) {
if (channel - AV_CHAN_AMBISONIC_BASE >= ambi_channels)
return AVERROR(EINVAL);
return channel - AV_CHAN_AMBISONIC_BASE;
}
if ((unsigned)channel > 63 || !(mask & (1ULL << channel)))
return AVERROR(EINVAL);
mask &= (1ULL << channel) - 1;
return av_popcount64(mask) + ambi_channels;
}
default:
return AVERROR(EINVAL);
}
}
int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout,
const char *str)
{
char *chname;
enum AVChannel ch = AV_CHAN_NONE;
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_CUSTOM:
chname = strstr(str, "@");
if (chname) {
char buf[16];
chname++;
av_strlcpy(buf, str, FFMIN(sizeof(buf), chname - str));
if (!*chname)
chname = NULL;
ch = av_channel_from_string(buf);
if (ch == AV_CHAN_NONE && *buf)
return AVERROR(EINVAL);
}
for (int i = 0; chname && i < channel_layout->nb_channels; i++) {
if (!strcmp(chname, channel_layout->u.map[i].name) &&
(ch == AV_CHAN_NONE || ch == channel_layout->u.map[i].id))
return i;
}
// fall-through
case AV_CHANNEL_ORDER_AMBISONIC:
case AV_CHANNEL_ORDER_NATIVE:
ch = av_channel_from_string(str);
if (ch == AV_CHAN_NONE)
return AVERROR(EINVAL);
return av_channel_layout_index_from_channel(channel_layout, ch);
}
return AVERROR(EINVAL);
}
int av_channel_layout_check(const AVChannelLayout *channel_layout)
{
if (channel_layout->nb_channels <= 0)
return 0;
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_NATIVE:
return av_popcount64(channel_layout->u.mask) == channel_layout->nb_channels;
case AV_CHANNEL_ORDER_CUSTOM:
if (!channel_layout->u.map)
return 0;
for (int i = 0; i < channel_layout->nb_channels; i++) {
if (channel_layout->u.map[i].id == AV_CHAN_NONE)
return 0;
}
return 1;
case AV_CHANNEL_ORDER_AMBISONIC:
/* If non-diegetic channels are present, ensure they are taken into account */
return av_popcount64(channel_layout->u.mask) < channel_layout->nb_channels;
case AV_CHANNEL_ORDER_UNSPEC:
return 1;
default:
return 0;
}
}
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
{
int i;
/* different channel counts -> not equal */
if (chl->nb_channels != chl1->nb_channels)
return 1;
/* if only one is unspecified -> not equal */
if ((chl->order == AV_CHANNEL_ORDER_UNSPEC) !=
(chl1->order == AV_CHANNEL_ORDER_UNSPEC))
return 1;
/* both are unspecified -> equal */
else if (chl->order == AV_CHANNEL_ORDER_UNSPEC)
return 0;
/* can compare masks directly */
if ((chl->order == AV_CHANNEL_ORDER_NATIVE ||
chl->order == AV_CHANNEL_ORDER_AMBISONIC) &&
chl->order == chl1->order)
return chl->u.mask != chl1->u.mask;
/* compare channel by channel */
for (i = 0; i < chl->nb_channels; i++)
if (av_channel_layout_channel_from_index(chl, i) !=
av_channel_layout_channel_from_index(chl1, i))
return 1;
return 0;
}
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
{
int i;
for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++)
if (nb_channels == channel_layout_map[i].layout.nb_channels) {
*ch_layout = channel_layout_map[i].layout;
return;
}
ch_layout->order = AV_CHANNEL_ORDER_UNSPEC;
ch_layout->nb_channels = nb_channels;
}
const AVChannelLayout *av_channel_layout_standard(void **opaque)
{
uintptr_t i = (uintptr_t)*opaque;
const AVChannelLayout *ch_layout = NULL;
if (i < FF_ARRAY_ELEMS(channel_layout_map)) {
ch_layout = &channel_layout_map[i].layout;
*opaque = (void*)(i + 1);
}
return ch_layout;
}
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout,
uint64_t mask)
{
uint64_t ret = 0;
int i;
switch (channel_layout->order) {
case AV_CHANNEL_ORDER_NATIVE:
case AV_CHANNEL_ORDER_AMBISONIC:
return channel_layout->u.mask & mask;
case AV_CHANNEL_ORDER_CUSTOM:
for (i = 0; i < 64; i++)
if (mask & (1ULL << i) && av_channel_layout_index_from_channel(channel_layout, i) >= 0)
ret |= (1ULL << i);
break;
}
return ret;
}
|
37d0d1a30bbeee1a864b8af84ac8346e392ed6d1
|
ec6a71b57ebe88538269197fd16bede6bc2062ae
|
/erts/lib_src/yielding_c_fun/lib/simple_c_gc/simple_c_gc.c
|
c1f5a50e1b7f55678252636374dd12fed7fec1aa
|
[
"Apache-2.0"
] |
permissive
|
erlang/otp
|
7c6e88ca955bd6a3ede1530154c80e8ce449a370
|
334589af62a8db25a81afba2ecc50f33ff69ddb8
|
refs/heads/master
| 2023-08-30T23:37:28.061328
| 2023-08-30T04:20:48
| 2023-08-30T04:20:48
| 374,927
| 9,920
| 3,018
|
Apache-2.0
| 2023-09-14T10:37:26
| 2009-11-16T17:17:57
|
Erlang
|
UTF-8
|
C
| false
| false
| 8,855
|
c
|
simple_c_gc.c
|
/*
* %CopyrightBegin%
*
* Copyright 2019-2021 Kjell Winblad (kjellwinblad@gmail.com, http://winsh.me).
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
/*
*
* Author: Kjell Winblad
*
*/
#include "simple_c_gc.h"
#include "chained_hash_set.h"
#include <setjmp.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
static bool scgc_print_gc_info = false;
static ChainedHashSet *scgc_objects;
static void *scgc_stack_top;
#define SCGC_MIN_ALLOCS_UNTIL_FREE 100
static int scgc_allocs_until_gc = SCGC_MIN_ALLOCS_UNTIL_FREE;
static void *(*scgc_user_malloc)(size_t size);
static void (*scgc_user_free)(void *ptr);
typedef enum { scgc_blank_state, scgc_marked } scgc_object_state;
typedef struct {
unsigned long magic_number;
size_t size;
scgc_object_state state;
void *data[1];
} scgc_object;
typedef struct {
void *address;
scgc_object *base;
unsigned long magic_number;
} scgc_object_ref;
static void *scgc_malloc(size_t size) {
void *(*my_malloc)(size_t size);
if (scgc_user_malloc == NULL) {
my_malloc = malloc;
} else {
my_malloc = scgc_user_malloc;
}
void *res = my_malloc(size);
if (res == NULL) {
printf("GCGC: Allocator returned NULL.\n");
exit(1);
}
return res;
}
static void scgc_free(void *ptr) {
void (*my_free)(void *ptr);
if (scgc_user_free == NULL) {
my_free = free;
} else {
my_free = scgc_user_free;
}
my_free(ptr);
}
static void *scgc_extract_key(void *v, int keyPos) {
(void)keyPos;
return v;
}
static unsigned int scgc_hash_key(void *keyPtr) {
/* From
* https://lemire.me/blog/2018/08/15/fast-strongly-universal-64-bit-hashing-everywhere*/
int64_t x = (intptr_t)*((void **)keyPtr);
int64_t a = 2348923;
int64_t b = 3292;
int64_t c = 9893487421;
int32_t low = (int)x;
int32_t high = (int)(x >> 32);
return (unsigned int)((a * low + b * high + c) >> 32);
}
static bool scgc_are_equal(void *v1p, void *v2p) {
scgc_object_ref *v1 = ((scgc_object_ref *)v1p);
scgc_object_ref *v2 = ((scgc_object_ref *)v2p);
return v1->address == v2->address;
}
static char *scgc_to_string(void *vp) {
scgc_object_ref *v = ((scgc_object_ref *)vp);
char *str = scgc_malloc(200);
sprintf(str, "{.address=%p, .base_address=%p, magic_number=%lu}", v->address,
(void *)v->base, v->magic_number);
return str;
}
static void scgc_initialize_global_state() {
scgc_objects =
ch_set_create(0, scgc_extract_key, scgc_hash_key, scgc_are_equal,
scgc_to_string, scgc_malloc, scgc_free);
srand((int)(intptr_t)scgc_objects * 2654435761);
}
static void scgc_do_gc(bool no_stack);
static void scgc_destroy_global_state() {
scgc_do_gc(true);
ch_set_free(scgc_objects);
}
static int scgc_start_gced_code_2(int (*main)(int, char *[]), int argc,
char **argv[]) {
volatile int noinline = 1;
volatile char **my_argv = (volatile char **)*argv;
scgc_stack_top = (void *)my_argv;
int (*next)(int, char *[]) = noinline ? main : (int (*)(int, char *[]))(NULL);
{
int to_return;
scgc_initialize_global_state();
to_return = next(argc, (char **)my_argv);
scgc_destroy_global_state();
return to_return;
}
}
static void scgc_global_set_put(scgc_object_ref ref) {
ch_set_insert(scgc_objects, &ref, sizeof(scgc_object_ref));
}
static void scgc_global_set_del(void *key) {
ch_set_delete(scgc_objects, &key, sizeof(void *));
}
static scgc_object_ref *scgc_global_set_get(void *key) {
scgc_object_ref *ret = ch_set_lookup(scgc_objects, &key);
return ret;
}
static void scgc_mark_reachable_objects_in_region(void *start, void *end);
static void *scgc_min(void *a, void *b) { return a <= b ? a : b; }
static void *scgc_max(void *a, void *b) { return a > b ? a : b; }
static void ycf_find_stack_bottom_and_mark_conservative_helper(void) {
volatile void *p = NULL;
volatile intptr_t stack_bottom = (intptr_t)&p;
scgc_mark_reachable_objects_in_region(
scgc_min(scgc_stack_top, (void *)&stack_bottom),
scgc_max((void *)&stack_bottom, scgc_stack_top));
}
static void scgc_get_stack_bottom_and_mark() {
jmp_buf env;
setjmp(env);
volatile int noinline = 1;
void (*bottom)(void) =
noinline ? ycf_find_stack_bottom_and_mark_conservative_helper
: (void (*)(void))(NULL);
bottom();
}
static void scgc_mark_reachable_objects_in_region(void *start, void *end) {
void **iter = start;
void **iter_end = end;
scgc_object *object;
while (iter <= iter_end) {
scgc_object_ref *ref = scgc_global_set_get(*iter);
if (ref != NULL && ref->base->data == *iter &&
ref->magic_number == ref->base->magic_number &&
ref->base->state == scgc_blank_state) {
object = ref->base;
object->state = scgc_marked;
scgc_mark_reachable_objects_in_region(
&object->data[0], &((char *)object->data)[object->size - 1]);
}
iter = iter + 1;
}
}
static void scgc_mark_reachable_objects(bool no_stack) {
void *tmp = NULL;
if (no_stack) {
scgc_mark_reachable_objects_in_region(&tmp, &tmp);
} else {
scgc_get_stack_bottom_and_mark();
}
}
static void scgc_collect_unmarked_traverser(size_t index, void *v,
void *context) {
void **objects_to_remove = context;
scgc_object_ref *ref = v;
if (ref->base->state == scgc_blank_state) {
scgc_free(ref->base);
objects_to_remove[index] = ref->address;
} else {
objects_to_remove[index] = NULL;
}
}
static void scgc_remove_unmarked_objects() {
size_t nr_of_candidates = scgc_objects->size;
void **objects_to_remove = scgc_malloc(sizeof(void *) * nr_of_candidates);
for (size_t i = 0; i < nr_of_candidates; i++) {
objects_to_remove[i] = NULL;
}
ch_set_traverse(scgc_objects, scgc_collect_unmarked_traverser,
objects_to_remove);
for (size_t i = 0; i < nr_of_candidates; i++) {
if (objects_to_remove[i] != NULL) {
scgc_global_set_del(objects_to_remove[i]);
}
}
scgc_free(objects_to_remove);
}
static void scgc_unmark_traverser(size_t index, void *v, void *context) {
scgc_object_ref *ref = v;
ref->base->state = scgc_blank_state;
}
static void scgc_unmark_objects() {
ch_set_traverse(scgc_objects, scgc_unmark_traverser, NULL);
}
static void scgc_do_gc(bool no_stack) {
unsigned int objects_before = scgc_objects->size;
scgc_mark_reachable_objects(no_stack);
scgc_remove_unmarked_objects();
scgc_unmark_objects();
if (scgc_print_gc_info) {
unsigned int objects_after = scgc_objects->size;
unsigned int objects_removed = objects_before - objects_after;
fprintf(stderr, "GC: before=%u, after=%u, removed=%u\n", objects_before,
objects_after, objects_removed);
}
}
static void scgc_gc() {
scgc_allocs_until_gc--;
if (scgc_allocs_until_gc <= 0) {
scgc_do_gc(false);
unsigned int objects_after = scgc_objects->size;
scgc_allocs_until_gc = objects_after * 2;
if (scgc_allocs_until_gc < SCGC_MIN_ALLOCS_UNTIL_FREE) {
scgc_allocs_until_gc = SCGC_MIN_ALLOCS_UNTIL_FREE;
}
}
}
/* Public interface */
int scgc_start_gced_code(int (*main)(int, char *[]), int argc, char *argv[],
void *(*my_malloc)(size_t), void (*my_free)(void *)) {
volatile int noinline = 1;
int (*next)(int (*)(int, char *[]), int, char **[]) =
(noinline ? scgc_start_gced_code_2
: (int (*)(int (*)(int, char *[]), int, char **[]))(NULL));
volatile char **my_argv = (volatile char **)argv;
int res;
scgc_user_malloc = my_malloc;
scgc_user_free = my_free;
if (my_argv == NULL) {
fprintf(stderr,
"scgc_start_gced_code: the argv parameter should not be NULL!");
exit(1);
}
res = next(main, argc, (char ***)&my_argv);
return res;
}
void *scgc_new(size_t size) {
scgc_gc();
scgc_object *new = scgc_malloc(size + sizeof(scgc_object));
scgc_object_ref new_ref;
unsigned long magic_number = (unsigned long)rand();
new->state = scgc_blank_state;
new->magic_number = magic_number;
new->size = size;
new_ref.address = new->data;
new_ref.base = new;
new_ref.magic_number = magic_number;
scgc_global_set_put(new_ref);
return new->data;
}
void scgc_enable_print_gc_info() { scgc_print_gc_info = true; }
|
1457d89258c1990d5ab5a6ffaab20cd85cb49cdc
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/VBox/Devices/PC/ipxe/src/drivers/net/sis900.h
|
7a5c6b537d7f34f2969782412f9ee53c51dd49f0
|
[
"MIT",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 10,816
|
h
|
sis900.h
|
/* -*- Mode:C; c-basic-offset:4; -*- */
/* Definitions for SiS ethernet controllers including 7014/7016 and 900
* References:
* SiS 7016 Fast Ethernet PCI Bus 10/100 Mbps LAN Controller with OnNow Support,
* preliminary Rev. 1.0 Jan. 14, 1998
* SiS 900 Fast Ethernet PCI Bus 10/100 Mbps LAN Single Chip with OnNow Support,
* preliminary Rev. 1.0 Nov. 10, 1998
* SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
* preliminary Rev. 1.0 Jan. 18, 1998
* http://www.sis.com.tw/support/databook.htm
*/
FILE_LICENCE ( GPL_ANY );
/* MAC operationl registers of SiS 7016 and SiS 900 ethernet controller */
/* The I/O extent, SiS 900 needs 256 bytes of io address */
#define SIS900_TOTAL_SIZE 0x100
/* Symbolic offsets to registers. */
enum sis900_registers {
cr=0x0, /* Command Register */
cfg=0x4, /* Configuration Register */
mear=0x8, /* EEPROM Access Register */
ptscr=0xc, /* PCI Test Control Register */
isr=0x10, /* Interrupt Status Register */
imr=0x14, /* Interrupt Mask Register */
ier=0x18, /* Interrupt Enable Register */
epar=0x18, /* Enhanced PHY Access Register */
txdp=0x20, /* Transmit Descriptor Pointer Register */
txcfg=0x24, /* Transmit Configuration Register */
rxdp=0x30, /* Receive Descriptor Pointer Register */
rxcfg=0x34, /* Receive Configuration Register */
flctrl=0x38, /* Flow Control Register */
rxlen=0x3c, /* Receive Packet Length Register */
rfcr=0x48, /* Receive Filter Control Register */
rfdr=0x4C, /* Receive Filter Data Register */
pmctrl=0xB0, /* Power Management Control Register */
pmer=0xB4 /* Power Management Wake-up Event Register */
};
/* Symbolic names for bits in various registers */
enum sis900_command_register_bits {
RELOAD = 0x00000400,
ACCESSMODE = 0x00000200,
RESET = 0x00000100,
SWI = 0x00000080,
RxRESET = 0x00000020,
TxRESET = 0x00000010,
RxDIS = 0x00000008,
RxENA = 0x00000004,
TxDIS = 0x00000002,
TxENA = 0x00000001
};
enum sis900_configuration_register_bits {
DESCRFMT = 0x00000100, /* 7016 specific */
REQALG = 0x00000080,
SB = 0x00000040,
POW = 0x00000020,
EXD = 0x00000010,
PESEL = 0x00000008,
LPM = 0x00000004,
BEM = 0x00000001,
RND_CNT = 0x00000400,
FAIR_BACKOFF = 0x00000200,
EDB_MASTER_EN = 0x00002000
};
enum sis900_eeprom_access_reigster_bits {
MDC = 0x00000040,
MDDIR = 0x00000020,
MDIO = 0x00000010, /* 7016 specific */
EECS = 0x00000008,
EECLK = 0x00000004,
EEDO = 0x00000002,
EEDI = 0x00000001
};
enum sis900_interrupt_register_bits {
WKEVT = 0x10000000,
TxPAUSEEND = 0x08000000,
TxPAUSE = 0x04000000,
TxRCMP = 0x02000000,
RxRCMP = 0x01000000,
DPERR = 0x00800000,
SSERR = 0x00400000,
RMABT = 0x00200000,
RTABT = 0x00100000,
RxSOVR = 0x00010000,
HIBERR = 0x00008000,
SWINT = 0x00001000,
MIBINT = 0x00000800,
TxURN = 0x00000400,
TxIDLE = 0x00000200,
TxERR = 0x00000100,
TxDESC = 0x00000080,
TxOK = 0x00000040,
RxORN = 0x00000020,
RxIDLE = 0x00000010,
RxEARLY = 0x00000008,
RxERR = 0x00000004,
RxDESC = 0x00000002,
RxOK = 0x00000001
};
enum sis900_interrupt_enable_reigster_bits {
IE = 0x00000001
};
/* maximum dma burst fro transmission and receive*/
#define MAX_DMA_RANGE 7 /* actually 0 means MAXIMUM !! */
#define TxMXDMA_shift 20
#define RxMXDMA_shift 20
#define TX_DMA_BURST 0
#define RX_DMA_BURST 0
enum sis900_tx_rx_dma{
DMA_BURST_512 = 0, DMA_BURST_64 = 5
};
/* transmit FIFO threshholds */
#define TX_FILL_THRESH 16 /* 1/4 FIFO size */
#define TxFILLT_shift 8
#define TxDRNT_shift 0
#define TxDRNT_100 48 /* 3/4 FIFO size */
#define TxDRNT_10 16 /* 1/2 FIFO size */
enum sis900_transmit_config_register_bits {
TxCSI = 0x80000000,
TxHBI = 0x40000000,
TxMLB = 0x20000000,
TxATP = 0x10000000,
TxIFG = 0x0C000000,
TxFILLT = 0x00003F00,
TxDRNT = 0x0000003F
};
/* recevie FIFO thresholds */
#define RxDRNT_shift 1
#define RxDRNT_100 16 /* 1/2 FIFO size */
#define RxDRNT_10 24 /* 3/4 FIFO size */
enum sis900_reveive_config_register_bits {
RxAEP = 0x80000000,
RxARP = 0x40000000,
RxATX = 0x10000000,
RxAJAB = 0x08000000,
RxDRNT = 0x0000007F
};
#define RFAA_shift 28
#define RFADDR_shift 16
enum sis900_receive_filter_control_register_bits {
RFEN = 0x80000000,
RFAAB = 0x40000000,
RFAAM = 0x20000000,
RFAAP = 0x10000000,
RFPromiscuous = (RFAAB|RFAAM|RFAAP)
};
enum sis900_reveive_filter_data_mask {
RFDAT = 0x0000FFFF
};
/* EEPROM Addresses */
enum sis900_eeprom_address {
EEPROMSignature = 0x00,
EEPROMVendorID = 0x02,
EEPROMDeviceID = 0x03,
EEPROMMACAddr = 0x08,
EEPROMChecksum = 0x0b
};
/* The EEPROM commands include the alway-set leading bit. Refer to NM93Cxx datasheet */
enum sis900_eeprom_command {
EEread = 0x0180,
EEwrite = 0x0140,
EEerase = 0x01C0,
EEwriteEnable = 0x0130,
EEwriteDisable = 0x0100,
EEeraseAll = 0x0120,
EEwriteAll = 0x0110,
EEaddrMask = 0x013F,
EEcmdShift = 16
};
/* For SiS962 or SiS963, request the eeprom software access */
enum sis96x_eeprom_command {
EEREQ = 0x00000400, EEDONE = 0x00000200, EEGNT = 0x00000100
};
/* Manamgement Data I/O (mdio) frame */
#define MIIread 0x6000
#define MIIwrite 0x5002
#define MIIpmdShift 7
#define MIIregShift 2
#define MIIcmdLen 16
#define MIIcmdShift 16
/* Buffer Descriptor Status*/
enum sis900_buffer_status {
OWN = 0x80000000,
MORE = 0x40000000,
INTR = 0x20000000,
SUPCRC = 0x10000000,
INCCRC = 0x10000000,
OK = 0x08000000,
DSIZE = 0x00000FFF
};
/* Status for TX Buffers */
enum sis900_tx_buffer_status {
ABORT = 0x04000000,
UNDERRUN = 0x02000000,
NOCARRIER = 0x01000000,
DEFERD = 0x00800000,
EXCDEFER = 0x00400000,
OWCOLL = 0x00200000,
EXCCOLL = 0x00100000,
COLCNT = 0x000F0000
};
enum sis900_rx_bufer_status {
OVERRUN = 0x02000000,
DEST = 0x00800000,
BCAST = 0x01800000,
MCAST = 0x01000000,
UNIMATCH = 0x00800000,
TOOLONG = 0x00400000,
RUNT = 0x00200000,
RXISERR = 0x00100000,
CRCERR = 0x00080000,
FAERR = 0x00040000,
LOOPBK = 0x00020000,
RXCOL = 0x00010000
};
/* MII register offsets */
enum mii_registers {
MII_CONTROL = 0x0000,
MII_STATUS = 0x0001,
MII_PHY_ID0 = 0x0002,
MII_PHY_ID1 = 0x0003,
MII_ANADV = 0x0004,
MII_ANLPAR = 0x0005,
MII_ANEXT = 0x0006
};
/* mii registers specific to SiS 900 */
enum sis_mii_registers {
MII_CONFIG1 = 0x0010,
MII_CONFIG2 = 0x0011,
MII_STSOUT = 0x0012,
MII_MASK = 0x0013,
MII_RESV = 0x0014
};
/* mii registers specific to AMD 79C901 */
enum amd_mii_registers {
MII_STATUS_SUMMARY = 0x0018
};
/* mii registers specific to ICS 1893 */
enum ics_mii_registers {
MII_EXTCTRL = 0x0010, MII_QPDSTS = 0x0011, MII_10BTOP = 0x0012,
MII_EXTCTRL2 = 0x0013
};
/* MII Control register bit definitions. */
enum mii_control_register_bits {
MII_CNTL_FDX = 0x0100,
MII_CNTL_RST_AUTO = 0x0200,
MII_CNTL_ISOLATE = 0x0400,
MII_CNTL_PWRDWN = 0x0800,
MII_CNTL_AUTO = 0x1000,
MII_CNTL_SPEED = 0x2000,
MII_CNTL_LPBK = 0x4000,
MII_CNTL_RESET = 0x8000
};
/* MII Status register bit */
enum mii_status_register_bits {
MII_STAT_EXT = 0x0001,
MII_STAT_JAB = 0x0002,
MII_STAT_LINK = 0x0004,
MII_STAT_CAN_AUTO = 0x0008,
MII_STAT_FAULT = 0x0010,
MII_STAT_AUTO_DONE = 0x0020,
MII_STAT_CAN_T = 0x0800,
MII_STAT_CAN_T_FDX = 0x1000,
MII_STAT_CAN_TX = 0x2000,
MII_STAT_CAN_TX_FDX = 0x4000,
MII_STAT_CAN_T4 = 0x8000
};
#define MII_ID1_OUI_LO 0xFC00 /* low bits of OUI mask */
#define MII_ID1_MODEL 0x03F0 /* model number */
#define MII_ID1_REV 0x000F /* model number */
/* MII NWAY Register Bits ...
valid for the ANAR (Auto-Negotiation Advertisement) and
ANLPAR (Auto-Negotiation Link Partner) registers */
enum mii_nway_register_bits {
MII_NWAY_NODE_SEL = 0x001f,
MII_NWAY_CSMA_CD = 0x0001,
MII_NWAY_T = 0x0020,
MII_NWAY_T_FDX = 0x0040,
MII_NWAY_TX = 0x0080,
MII_NWAY_TX_FDX = 0x0100,
MII_NWAY_T4 = 0x0200,
MII_NWAY_PAUSE = 0x0400,
MII_NWAY_RF = 0x2000,
MII_NWAY_ACK = 0x4000,
MII_NWAY_NP = 0x8000
};
enum mii_stsout_register_bits {
MII_STSOUT_LINK_FAIL = 0x4000,
MII_STSOUT_SPD = 0x0080,
MII_STSOUT_DPLX = 0x0040
};
enum mii_stsics_register_bits {
MII_STSICS_SPD = 0x8000, MII_STSICS_DPLX = 0x4000,
MII_STSICS_LINKSTS = 0x0001
};
enum mii_stssum_register_bits {
MII_STSSUM_LINK = 0x0008,
MII_STSSUM_DPLX = 0x0004,
MII_STSSUM_AUTO = 0x0002,
MII_STSSUM_SPD = 0x0001
};
enum sis900_revision_id {
SIS630A_900_REV = 0x80, SIS630E_900_REV = 0x81,
SIS630S_900_REV = 0x82, SIS630EA1_900_REV = 0x83,
SIS630ET_900_REV = 0x84, SIS635A_900_REV = 0x90,
SIS96x_900_REV = 0X91, SIS900B_900_REV = 0x03
};
enum sis630_revision_id {
SIS630A0 = 0x00, SIS630A1 = 0x01,
SIS630B0 = 0x10, SIS630B1 = 0x11
};
#define FDX_CAPABLE_DUPLEX_UNKNOWN 0
#define FDX_CAPABLE_HALF_SELECTED 1
#define FDX_CAPABLE_FULL_SELECTED 2
#define HW_SPEED_UNCONFIG 0
#define HW_SPEED_HOME 1
#define HW_SPEED_10_MBPS 10
#define HW_SPEED_100_MBPS 100
#define HW_SPEED_DEFAULT (HW_SPEED_100_MBPS)
#define CRC_SIZE 4
#define MAC_HEADER_SIZE 14
#define TX_BUF_SIZE 1536
#define RX_BUF_SIZE 1536
#define NUM_RX_DESC 4 /* Number of Rx descriptor registers. */
/* Time in ticks before concluding the transmitter is hung. */
#define TX_TIMEOUT (4*TICKS_PER_SEC)
typedef struct _BufferDesc {
u32 link;
volatile u32 cmdsts;
u32 bufptr;
} BufferDesc;
|
86e7bd2aa2a3fdeea0b78f304894755097139e69
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/any-macos-any/mach-o/nlist.h
|
7b979a52aa12d3273d1ed1125cca01059d94610f
|
[
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 13,983
|
h
|
nlist.h
|
/*
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _MACHO_NLIST_H_
#define _MACHO_NLIST_H_
/* $NetBSD: nlist.h,v 1.5 1994/10/26 00:56:11 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. 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.
*
* @(#)nlist.h 8.2 (Berkeley) 1/21/94
*/
#include <stdint.h>
/*
* Format of a symbol table entry of a Mach-O file for 32-bit architectures.
* Modified from the BSD format. The modifications from the original format
* were changing n_other (an unused field) to n_sect and the addition of the
* N_SECT type. These modifications are required to support symbols in a larger
* number of sections not just the three sections (text, data and bss) in a BSD
* file.
*/
struct nlist {
union {
#ifndef __LP64__
char *n_name; /* for use when in-core */
#endif
uint32_t n_strx; /* index into the string table */
} n_un;
uint8_t n_type; /* type flag, see below */
uint8_t n_sect; /* section number or NO_SECT */
int16_t n_desc; /* see <mach-o/stab.h> */
uint32_t n_value; /* value of this symbol (or stab offset) */
};
/*
* This is the symbol table entry structure for 64-bit architectures.
*/
struct nlist_64 {
union {
uint32_t n_strx; /* index into the string table */
} n_un;
uint8_t n_type; /* type flag, see below */
uint8_t n_sect; /* section number or NO_SECT */
uint16_t n_desc; /* see <mach-o/stab.h> */
uint64_t n_value; /* value of this symbol (or stab offset) */
};
/*
* Symbols with a index into the string table of zero (n_un.n_strx == 0) are
* defined to have a null, "", name. Therefore all string indexes to non null
* names must not have a zero string index. This is bit historical information
* that has never been well documented.
*/
/*
* The n_type field really contains four fields:
* unsigned char N_STAB:3,
* N_PEXT:1,
* N_TYPE:3,
* N_EXT:1;
* which are used via the following masks.
*/
#define N_STAB 0xe0 /* if any of these bits set, a symbolic debugging entry */
#define N_PEXT 0x10 /* private external symbol bit */
#define N_TYPE 0x0e /* mask for the type bits */
#define N_EXT 0x01 /* external symbol bit, set for external symbols */
/*
* Only symbolic debugging entries have some of the N_STAB bits set and if any
* of these bits are set then it is a symbolic debugging entry (a stab). In
* which case then the values of the n_type field (the entire field) are given
* in <mach-o/stab.h>
*/
/*
* Values for N_TYPE bits of the n_type field.
*/
#define N_UNDF 0x0 /* undefined, n_sect == NO_SECT */
#define N_ABS 0x2 /* absolute, n_sect == NO_SECT */
#define N_SECT 0xe /* defined in section number n_sect */
#define N_PBUD 0xc /* prebound undefined (defined in a dylib) */
#define N_INDR 0xa /* indirect */
/*
* If the type is N_INDR then the symbol is defined to be the same as another
* symbol. In this case the n_value field is an index into the string table
* of the other symbol's name. When the other symbol is defined then they both
* take on the defined type and value.
*/
/*
* If the type is N_SECT then the n_sect field contains an ordinal of the
* section the symbol is defined in. The sections are numbered from 1 and
* refer to sections in order they appear in the load commands for the file
* they are in. This means the same ordinal may very well refer to different
* sections in different files.
*
* The n_value field for all symbol table entries (including N_STAB's) gets
* updated by the link editor based on the value of it's n_sect field and where
* the section n_sect references gets relocated. If the value of the n_sect
* field is NO_SECT then it's n_value field is not changed by the link editor.
*/
#define NO_SECT 0 /* symbol is not in any section */
#define MAX_SECT 255 /* 1 thru 255 inclusive */
/*
* Common symbols are represented by undefined (N_UNDF) external (N_EXT) types
* who's values (n_value) are non-zero. In which case the value of the n_value
* field is the size (in bytes) of the common symbol. The n_sect field is set
* to NO_SECT. The alignment of a common symbol may be set as a power of 2
* between 2^1 and 2^15 as part of the n_desc field using the macros below. If
* the alignment is not set (a value of zero) then natural alignment based on
* the size is used.
*/
#define GET_COMM_ALIGN(n_desc) (((n_desc) >> 8) & 0x0f)
#define SET_COMM_ALIGN(n_desc,align) \
(n_desc) = (((n_desc) & 0xf0ff) | (((align) & 0x0f) << 8))
/*
* To support the lazy binding of undefined symbols in the dynamic link-editor,
* the undefined symbols in the symbol table (the nlist structures) are marked
* with the indication if the undefined reference is a lazy reference or
* non-lazy reference. If both a non-lazy reference and a lazy reference is
* made to the same symbol the non-lazy reference takes precedence. A reference
* is lazy only when all references to that symbol are made through a symbol
* pointer in a lazy symbol pointer section.
*
* The implementation of marking nlist structures in the symbol table for
* undefined symbols will be to use some of the bits of the n_desc field as a
* reference type. The mask REFERENCE_TYPE will be applied to the n_desc field
* of an nlist structure for an undefined symbol to determine the type of
* undefined reference (lazy or non-lazy).
*
* The constants for the REFERENCE FLAGS are propagated to the reference table
* in a shared library file. In that case the constant for a defined symbol,
* REFERENCE_FLAG_DEFINED, is also used.
*/
/* Reference type bits of the n_desc field of undefined symbols */
#define REFERENCE_TYPE 0x7
/* types of references */
#define REFERENCE_FLAG_UNDEFINED_NON_LAZY 0
#define REFERENCE_FLAG_UNDEFINED_LAZY 1
#define REFERENCE_FLAG_DEFINED 2
#define REFERENCE_FLAG_PRIVATE_DEFINED 3
#define REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY 4
#define REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY 5
/*
* To simplify stripping of objects that use are used with the dynamic link
* editor, the static link editor marks the symbols defined an object that are
* referenced by a dynamicly bound object (dynamic shared libraries, bundles).
* With this marking strip knows not to strip these symbols.
*/
#define REFERENCED_DYNAMICALLY 0x0010
/*
* For images created by the static link editor with the -twolevel_namespace
* option in effect the flags field of the mach header is marked with
* MH_TWOLEVEL. And the binding of the undefined references of the image are
* determined by the static link editor. Which library an undefined symbol is
* bound to is recorded by the static linker in the high 8 bits of the n_desc
* field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded
* references the libraries listed in the Mach-O's LC_LOAD_DYLIB,
* LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and
* LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the
* headers. The library ordinals start from 1.
* For a dynamic library that is built as a two-level namespace image the
* undefined references from module defined in another use the same nlist struct
* an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For
* defined symbols in all images they also must have the library ordinal set to
* SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable
* image for references from plugins that refer to the executable that loads
* them.
*
* The DYNAMIC_LOOKUP_ORDINAL is for undefined symbols in a two-level namespace
* image that are looked up by the dynamic linker with flat namespace semantics.
* This ordinal was added as a feature in Mac OS X 10.3 by reducing the
* value of MAX_LIBRARY_ORDINAL by one. So it is legal for existing binaries
* or binaries built with older tools to have 0xfe (254) dynamic libraries. In
* this case the ordinal value 0xfe (254) must be treated as a library ordinal
* for compatibility.
*/
#define GET_LIBRARY_ORDINAL(n_desc) (((n_desc) >> 8) & 0xff)
#define SET_LIBRARY_ORDINAL(n_desc,ordinal) \
(n_desc) = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8))
#define SELF_LIBRARY_ORDINAL 0x0
#define MAX_LIBRARY_ORDINAL 0xfd
#define DYNAMIC_LOOKUP_ORDINAL 0xfe
#define EXECUTABLE_ORDINAL 0xff
/*
* The bit 0x0020 of the n_desc field is used for two non-overlapping purposes
* and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED.
*/
/*
* The N_NO_DEAD_STRIP bit of the n_desc field only ever appears in a
* relocatable .o file (MH_OBJECT filetype). And is used to indicate to the
* static link editor it is never to dead strip the symbol.
*/
#define N_NO_DEAD_STRIP 0x0020 /* symbol is not to be dead stripped */
/*
* The N_DESC_DISCARDED bit of the n_desc field never appears in linked image.
* But is used in very rare cases by the dynamic link editor to mark an in
* memory symbol as discared and longer used for linking.
*/
#define N_DESC_DISCARDED 0x0020 /* symbol is discarded */
/*
* The N_WEAK_REF bit of the n_desc field indicates to the dynamic linker that
* the undefined symbol is allowed to be missing and is to have the address of
* zero when missing.
*/
#define N_WEAK_REF 0x0040 /* symbol is weak referenced */
/*
* The N_WEAK_DEF bit of the n_desc field indicates to the static and dynamic
* linkers that the symbol definition is weak, allowing a non-weak symbol to
* also be used which causes the weak definition to be discared. Currently this
* is only supported for symbols in coalesed sections.
*/
#define N_WEAK_DEF 0x0080 /* coalesed symbol is a weak definition */
/*
* The N_REF_TO_WEAK bit of the n_desc field indicates to the dynamic linker
* that the undefined symbol should be resolved using flat namespace searching.
*/
#define N_REF_TO_WEAK 0x0080 /* reference to a weak symbol */
/*
* The N_ARM_THUMB_DEF bit of the n_desc field indicates that the symbol is
* a defintion of a Thumb function.
*/
#define N_ARM_THUMB_DEF 0x0008 /* symbol is a Thumb function (ARM) */
/*
* The N_SYMBOL_RESOLVER bit of the n_desc field indicates that the
* that the function is actually a resolver function and should
* be called to get the address of the real function to use.
* This bit is only available in .o files (MH_OBJECT filetype)
*/
#define N_SYMBOL_RESOLVER 0x0100
/*
* The N_ALT_ENTRY bit of the n_desc field indicates that the
* symbol is pinned to the previous content.
*/
#define N_ALT_ENTRY 0x0200
/*
* The N_COLD_FUNC bit of the n_desc field indicates that the symbol is used
* infrequently and the linker should order it towards the end of the section.
*/
#define N_COLD_FUNC 0x0400
#ifndef __STRICT_BSD__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* The function nlist(3) from the C library.
*/
extern int nlist (const char *filename, struct nlist *list);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __STRICT_BSD__ */
#endif /* _MACHO_LIST_H_ */
|
e088c2390e8216415a074498d2372ba5d86c43a9
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/lang/fortran/lib/libF77/abort_.c
|
bcbe987781ed0e32a28f645f5bc36529c7eb2bc1
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 123
|
c
|
abort_.c
|
#include "stdio.h"
#include "f2c.h"
extern VOID sig_die();
VOID abort_()
{
sig_die("Fortran abort routine called", 1);
}
|
6a6d83b9db0a1c0e3fef4dfcd4344925afbc4f33
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/s390x-linux-any/asm/kvm_perf.h
|
75f6eae76068ce2f421383b50f4f4c96f4613c33
|
[
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 473
|
h
|
kvm_perf.h
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
* Definitions for perf-kvm on s390
*
* Copyright 2014 IBM Corp.
* Author(s): Alexander Yarygin <yarygin@linux.vnet.ibm.com>
*/
#ifndef __LINUX_KVM_PERF_S390_H
#define __LINUX_KVM_PERF_S390_H
#include <asm/sie.h>
#define DECODE_STR_LEN 40
#define VCPU_ID "id"
#define KVM_ENTRY_TRACE "kvm:kvm_s390_sie_enter"
#define KVM_EXIT_TRACE "kvm:kvm_s390_sie_exit"
#define KVM_EXIT_REASON "icptcode"
#endif
|
b336e8a444d4789f7690673acdd307c8f6d0c1d6
|
eecd5e4c50d8b78a769bcc2675250576bed34066
|
/src/ksp/pc/impls/shell/shellpc.c
|
3423f1a51cc2be4f03d2c55fffe93ccf20eeaae5
|
[
"BSD-2-Clause"
] |
permissive
|
petsc/petsc
|
3b1a04fea71858e0292f9fd4d04ea11618c50969
|
9c5460f9064ca60dd71a234a1f6faf93e7a6b0c9
|
refs/heads/main
| 2023-08-17T20:51:16.507070
| 2023-08-17T16:08:06
| 2023-08-17T16:08:06
| 8,691,401
| 341
| 169
|
NOASSERTION
| 2023-03-29T11:02:58
| 2013-03-10T20:55:21
|
C
|
UTF-8
|
C
| false
| false
| 33,755
|
c
|
shellpc.c
|
/*
This provides a simple shell for Fortran (and C programmers) to
create their own preconditioner without writing much interface code.
*/
#include <petsc/private/pcimpl.h> /*I "petscpc.h" I*/
typedef struct {
void *ctx; /* user provided contexts for preconditioner */
PetscErrorCode (*destroy)(PC);
PetscErrorCode (*setup)(PC);
PetscErrorCode (*apply)(PC, Vec, Vec);
PetscErrorCode (*matapply)(PC, Mat, Mat);
PetscErrorCode (*applysymmetricleft)(PC, Vec, Vec);
PetscErrorCode (*applysymmetricright)(PC, Vec, Vec);
PetscErrorCode (*applyBA)(PC, PCSide, Vec, Vec, Vec);
PetscErrorCode (*presolve)(PC, KSP, Vec, Vec);
PetscErrorCode (*postsolve)(PC, KSP, Vec, Vec);
PetscErrorCode (*view)(PC, PetscViewer);
PetscErrorCode (*applytranspose)(PC, Vec, Vec);
PetscErrorCode (*applyrich)(PC, Vec, Vec, Vec, PetscReal, PetscReal, PetscReal, PetscInt, PetscBool, PetscInt *, PCRichardsonConvergedReason *);
char *name;
} PC_Shell;
/*@C
PCShellGetContext - Returns the user-provided context associated with a shell `PC` that was provided with `PCShellSetContext()`
Not Collective
Input Parameter:
. pc - of type `PCSHELL`
Output Parameter:
. ctx - the user provided context
Level: advanced
Note:
This routine is intended for use within the various user-provided routines set with, for example, `PCShellSetApply()`
Fortran Note:
To use this from Fortran you must write a Fortran interface definition for this
function that tells Fortran the Fortran derived data type that you are passing in as the ctx argument.
.seealso: `PC`, `PCSHELL`, `PCShellSetContext()`, `PCShellSetApply()`, `PCShellSetDestroy()`
@*/
PetscErrorCode PCShellGetContext(PC pc, void *ctx)
{
PetscBool flg;
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscAssertPointer(ctx, 2);
PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCSHELL, &flg));
if (!flg) *(void **)ctx = NULL;
else *(void **)ctx = ((PC_Shell *)(pc->data))->ctx;
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@
PCShellSetContext - sets the context for a shell `PC` that can be accessed with `PCShellGetContext()`
Logically Collective
Input Parameters:
+ pc - the `PC` of type `PCSHELL`
- ctx - the context
Level: advanced
Notes:
This routine is intended for use within the various user-provided routines set with, for example, `PCShellSetApply()`
One should also provide a routine to destroy the context when `pc` is destroyed with `PCShellSetDestroy()`
Fortran Notes:
To use this from Fortran you must write a Fortran interface definition for this
function that tells Fortran the Fortran derived data type that you are passing in as the ctx argument.
.seealso: `PC`, `PCShellGetContext()`, `PCSHELL`, `PCShellSetApply()`, `PCShellSetDestroy()`
@*/
PetscErrorCode PCShellSetContext(PC pc, void *ctx)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscBool flg;
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscCall(PetscObjectTypeCompare((PetscObject)pc, PCSHELL, &flg));
if (flg) shell->ctx = ctx;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCSetUp_Shell(PC pc)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCheck(shell->setup, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No setup() routine provided to Shell PC");
PetscCallBack("PCSHELL callback setup", (*shell->setup)(pc));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApply_Shell(PC pc, Vec x, Vec y)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscObjectState instate, outstate;
PetscFunctionBegin;
PetscCheck(shell->apply, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No apply() routine provided to Shell PC");
PetscCall(PetscObjectStateGet((PetscObject)y, &instate));
PetscCallBack("PCSHELL callback apply", (*shell->apply)(pc, x, y));
PetscCall(PetscObjectStateGet((PetscObject)y, &outstate));
/* increase the state of the output vector if the user did not update its state themself as should have been done */
if (instate == outstate) PetscCall(PetscObjectStateIncrease((PetscObject)y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCMatApply_Shell(PC pc, Mat X, Mat Y)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscObjectState instate, outstate;
PetscFunctionBegin;
PetscCheck(shell->matapply, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No apply() routine provided to Shell PC");
PetscCall(PetscObjectStateGet((PetscObject)Y, &instate));
PetscCallBack("PCSHELL callback apply", (*shell->matapply)(pc, X, Y));
PetscCall(PetscObjectStateGet((PetscObject)Y, &outstate));
/* increase the state of the output vector if the user did not update its state themself as should have been done */
if (instate == outstate) PetscCall(PetscObjectStateIncrease((PetscObject)Y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApplySymmetricLeft_Shell(PC pc, Vec x, Vec y)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCheck(shell->applysymmetricleft, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No apply() routine provided to Shell PC");
PetscCallBack("PCSHELL callback apply symmetric left", (*shell->applysymmetricleft)(pc, x, y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApplySymmetricRight_Shell(PC pc, Vec x, Vec y)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCheck(shell->applysymmetricright, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No apply() routine provided to Shell PC");
PetscCallBack("PCSHELL callback apply symmetric right", (*shell->applysymmetricright)(pc, x, y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApplyBA_Shell(PC pc, PCSide side, Vec x, Vec y, Vec w)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscObjectState instate, outstate;
PetscFunctionBegin;
PetscCheck(shell->applyBA, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No applyBA() routine provided to Shell PC");
PetscCall(PetscObjectStateGet((PetscObject)w, &instate));
PetscCallBack("PCSHELL callback applyBA", (*shell->applyBA)(pc, side, x, y, w));
PetscCall(PetscObjectStateGet((PetscObject)w, &outstate));
/* increase the state of the output vector if the user did not update its state themself as should have been done */
if (instate == outstate) PetscCall(PetscObjectStateIncrease((PetscObject)w));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCPreSolveChangeRHS_Shell(PC pc, PetscBool *change)
{
PetscFunctionBegin;
*change = PETSC_TRUE;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCPreSolve_Shell(PC pc, KSP ksp, Vec b, Vec x)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCheck(shell->presolve, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No presolve() routine provided to Shell PC");
PetscCallBack("PCSHELL callback presolve", (*shell->presolve)(pc, ksp, b, x));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCPostSolve_Shell(PC pc, KSP ksp, Vec b, Vec x)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCheck(shell->postsolve, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No postsolve() routine provided to Shell PC");
PetscCallBack("PCSHELL callback postsolve()", (*shell->postsolve)(pc, ksp, b, x));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApplyTranspose_Shell(PC pc, Vec x, Vec y)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscObjectState instate, outstate;
PetscFunctionBegin;
PetscCheck(shell->applytranspose, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No applytranspose() routine provided to Shell PC");
PetscCall(PetscObjectStateGet((PetscObject)y, &instate));
PetscCallBack("PCSHELL callback applytranspose", (*shell->applytranspose)(pc, x, y));
PetscCall(PetscObjectStateGet((PetscObject)y, &outstate));
/* increase the state of the output vector if the user did not update its state themself as should have been done */
if (instate == outstate) PetscCall(PetscObjectStateIncrease((PetscObject)y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCApplyRichardson_Shell(PC pc, Vec x, Vec y, Vec w, PetscReal rtol, PetscReal abstol, PetscReal dtol, PetscInt it, PetscBool guesszero, PetscInt *outits, PCRichardsonConvergedReason *reason)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscObjectState instate, outstate;
PetscFunctionBegin;
PetscCheck(shell->applyrich, PetscObjectComm((PetscObject)pc), PETSC_ERR_USER, "No applyrichardson() routine provided to Shell PC");
PetscCall(PetscObjectStateGet((PetscObject)y, &instate));
PetscCallBack("PCSHELL callback applyrichardson", (*shell->applyrich)(pc, x, y, w, rtol, abstol, dtol, it, guesszero, outits, reason));
PetscCall(PetscObjectStateGet((PetscObject)y, &outstate));
/* increase the state of the output vector since the user did not update its state themself as should have been done */
if (instate == outstate) PetscCall(PetscObjectStateIncrease((PetscObject)y));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCDestroy_Shell(PC pc)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCall(PetscFree(shell->name));
if (shell->destroy) PetscCallBack("PCSHELL callback destroy", (*shell->destroy)(pc));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetDestroy_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetSetUp_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApply_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetMatApply_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplySymmetricLeft_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplySymmetricRight_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyBA_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetPreSolve_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetPostSolve_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetView_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyTranspose_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetName_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellGetName_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyRichardson_C", NULL));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCPreSolveChangeRHS_C", NULL));
PetscCall(PetscFree(pc->data));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCView_Shell(PC pc, PetscViewer viewer)
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscBool iascii;
PetscFunctionBegin;
PetscCall(PetscObjectTypeCompare((PetscObject)viewer, PETSCVIEWERASCII, &iascii));
if (iascii) {
if (shell->name) PetscCall(PetscViewerASCIIPrintf(viewer, " %s\n", shell->name));
else PetscCall(PetscViewerASCIIPrintf(viewer, " no name\n"));
}
if (shell->view) {
PetscCall(PetscViewerASCIIPushTab(viewer));
PetscCall((*shell->view)(pc, viewer));
PetscCall(PetscViewerASCIIPopTab(viewer));
}
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetDestroy_Shell(PC pc, PetscErrorCode (*destroy)(PC))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->destroy = destroy;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetSetUp_Shell(PC pc, PetscErrorCode (*setup)(PC))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->setup = setup;
if (setup) pc->ops->setup = PCSetUp_Shell;
else pc->ops->setup = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApply_Shell(PC pc, PetscErrorCode (*apply)(PC, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->apply = apply;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetMatApply_Shell(PC pc, PetscErrorCode (*matapply)(PC, Mat, Mat))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->matapply = matapply;
if (matapply) pc->ops->matapply = PCMatApply_Shell;
else pc->ops->matapply = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApplySymmetricLeft_Shell(PC pc, PetscErrorCode (*apply)(PC, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->applysymmetricleft = apply;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApplySymmetricRight_Shell(PC pc, PetscErrorCode (*apply)(PC, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->applysymmetricright = apply;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApplyBA_Shell(PC pc, PetscErrorCode (*applyBA)(PC, PCSide, Vec, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->applyBA = applyBA;
if (applyBA) pc->ops->applyBA = PCApplyBA_Shell;
else pc->ops->applyBA = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetPreSolve_Shell(PC pc, PetscErrorCode (*presolve)(PC, KSP, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->presolve = presolve;
if (presolve) {
pc->ops->presolve = PCPreSolve_Shell;
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCPreSolveChangeRHS_C", PCPreSolveChangeRHS_Shell));
} else {
pc->ops->presolve = NULL;
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCPreSolveChangeRHS_C", NULL));
}
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetPostSolve_Shell(PC pc, PetscErrorCode (*postsolve)(PC, KSP, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->postsolve = postsolve;
if (postsolve) pc->ops->postsolve = PCPostSolve_Shell;
else pc->ops->postsolve = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetView_Shell(PC pc, PetscErrorCode (*view)(PC, PetscViewer))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->view = view;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApplyTranspose_Shell(PC pc, PetscErrorCode (*applytranspose)(PC, Vec, Vec))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->applytranspose = applytranspose;
if (applytranspose) pc->ops->applytranspose = PCApplyTranspose_Shell;
else pc->ops->applytranspose = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetApplyRichardson_Shell(PC pc, PetscErrorCode (*applyrich)(PC, Vec, Vec, Vec, PetscReal, PetscReal, PetscReal, PetscInt, PetscBool, PetscInt *, PCRichardsonConvergedReason *))
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
shell->applyrich = applyrich;
if (applyrich) pc->ops->applyrichardson = PCApplyRichardson_Shell;
else pc->ops->applyrichardson = NULL;
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellSetName_Shell(PC pc, const char name[])
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
PetscCall(PetscFree(shell->name));
PetscCall(PetscStrallocpy(name, &shell->name));
PetscFunctionReturn(PETSC_SUCCESS);
}
static PetscErrorCode PCShellGetName_Shell(PC pc, const char *name[])
{
PC_Shell *shell = (PC_Shell *)pc->data;
PetscFunctionBegin;
*name = shell->name;
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetDestroy - Sets routine to use to destroy the user-provided application context that was provided with `PCShellSetContext()`
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- destroy - the application-provided destroy routine
Calling sequence of `destroy`:
. pc - the preconditioner
Level: intermediate
.seealso: `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetDestroy(PC pc, PetscErrorCode (*destroy)(PC pc))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetDestroy_C", (PC, PetscErrorCode(*)(PC)), (pc, destroy));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetSetUp - Sets routine to use to "setup" the preconditioner whenever the
matrix operator is changed.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- setup - the application-provided setup routine
Calling sequence of `setup`:
. pc - the preconditioner
Level: intermediate
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `setup`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetApply()`, `PCShellSetContext()`, , `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetSetUp(PC pc, PetscErrorCode (*setup)(PC pc))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetSetUp_C", (PC, PetscErrorCode(*)(PC)), (pc, setup));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetView - Sets routine to use as viewer of a `PCSHELL` shell preconditioner
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- view - the application-provided view routine
Calling sequence of `view`:
+ pc - the preconditioner
- v - viewer
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `view`.
.seealso: `PC`, `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetView(PC pc, PetscErrorCode (*view)(PC pc, PetscViewer v))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetView_C", (PC, PetscErrorCode(*)(PC, PetscViewer)), (pc, view));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApply - Sets routine to use as preconditioner.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- apply - the application-provided preconditioning routine
Calling sequence of `apply`:
+ pc - the preconditioner, get the application context with `PCShellGetContext()`
. xin - input vector
- xout - output vector
Level: intermediate
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `apply`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellSetApplyBA()`, `PCShellSetApplySymmetricRight()`, `PCShellSetApplySymmetricLeft()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetApply(PC pc, PetscErrorCode (*apply)(PC pc, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApply_C", (PC, PetscErrorCode(*)(PC, Vec, Vec)), (pc, apply));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetMatApply - Sets routine to use as preconditioner on a block of vectors.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- matapply - the application-provided preconditioning routine
Calling sequence of `matapply`:
+ pc - the preconditioner
. Xin - input block of vectors represented as a dense `Mat`
- Xout - output block of vectors represented as a dense `Mat`
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `matapply`.
.seealso: `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetMatApply(PC pc, PetscErrorCode (*matapply)(PC pc, Mat Xin, Mat Xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetMatApply_C", (PC, PetscErrorCode(*)(PC, Mat, Mat)), (pc, matapply));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApplySymmetricLeft - Sets routine to use as left preconditioner (when the `PC_SYMMETRIC` is used).
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- apply - the application-provided left preconditioning routine
Calling sequence of `apply`:
+ pc - the preconditioner
. xin - input vector
- xout - output vector
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `apply`.
.seealso: `PCSHELL`, `PCShellSetApply()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`
@*/
PetscErrorCode PCShellSetApplySymmetricLeft(PC pc, PetscErrorCode (*apply)(PC pc, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApplySymmetricLeft_C", (PC, PetscErrorCode(*)(PC, Vec, Vec)), (pc, apply));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApplySymmetricRight - Sets routine to use as right preconditioner (when the `PC_SYMMETRIC` is used).
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- apply - the application-provided right preconditioning routine
Calling sequence of `apply`:
+ pc - the preconditioner
. xin - input vector
- xout - output vector
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `apply`.
.seealso: `PCSHELL`, `PCShellSetApply()`, `PCShellSetApplySymmetricLeft()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetApplySymmetricRight(PC pc, PetscErrorCode (*apply)(PC pc, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApplySymmetricRight_C", (PC, PetscErrorCode(*)(PC, Vec, Vec)), (pc, apply));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApplyBA - Sets routine to use as the preconditioner times the operator.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- applyBA - the application-provided BA routine
Calling sequence of `applyBA`:
+ pc - the preconditioner
. side - `PC_LEFT`, `PC_RIGHT`, or `PC_SYMMETRIC`
. xin - input vector
. xout - output vector
- w - work vector
Level: intermediate
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `applyBA`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetContext()`, `PCShellSetApply()`, `PCShellGetContext()`, `PCSide`
@*/
PetscErrorCode PCShellSetApplyBA(PC pc, PetscErrorCode (*applyBA)(PC pc, PCSide side, Vec xin, Vec xout, Vec w))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApplyBA_C", (PC, PetscErrorCode(*)(PC, PCSide, Vec, Vec, Vec)), (pc, applyBA));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApplyTranspose - Sets routine to use as preconditioner transpose.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- applytranspose - the application-provided preconditioning transpose routine
Calling sequence of `applytranspose`:
+ pc - the preconditioner
. xin - input vector
- xout - output vector
Level: intermediate
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `applytranspose`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApply()`, `PCSetContext()`, `PCShellSetApplyBA()`, `PCGetContext()`
@*/
PetscErrorCode PCShellSetApplyTranspose(PC pc, PetscErrorCode (*applytranspose)(PC pc, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApplyTranspose_C", (PC, PetscErrorCode(*)(PC, Vec, Vec)), (pc, applytranspose));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetPreSolve - Sets routine to apply to the operators/vectors before a `KSPSolve()` is
applied. This usually does something like scale the linear system in some application
specific way.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- presolve - the application-provided presolve routine
Calling sequence of `presolve`:
+ pc - the preconditioner
. ksp - the `KSP` that contains `pc`
. xin - input vector
- xout - output vector
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `presolve`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetPostSolve()`, `PCShellSetContext()`, `PCGetContext()`
@*/
PetscErrorCode PCShellSetPreSolve(PC pc, PetscErrorCode (*presolve)(PC pc, KSP ksp, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetPreSolve_C", (PC, PetscErrorCode(*)(PC, KSP, Vec, Vec)), (pc, presolve));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetPostSolve - Sets routine to apply to the operators/vectors after a `KSPSolve()` is
applied. This usually does something like scale the linear system in some application
specific way.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- postsolve - the application-provided presolve routine
Calling sequence of `postsolve`:
+ pc - the preconditioner
. ksp - the `KSP` that contains `pc`
. xin - input vector
- xout - output vector
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `postsolve`.
.seealso: `PCSHELL`, `PCShellSetApplyRichardson()`, `PCShellSetSetUp()`, `PCShellSetApplyTranspose()`, `PCShellSetPreSolve()`, `PCShellSetContext()`, `PCGetContext()`
@*/
PetscErrorCode PCShellSetPostSolve(PC pc, PetscErrorCode (*postsolve)(PC pc, KSP ksp, Vec xin, Vec xout))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetPostSolve_C", (PC, PetscErrorCode(*)(PC, KSP, Vec, Vec)), (pc, postsolve));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetName - Sets an optional name to associate with a `PCSHELL`
preconditioner.
Not Collective
Input Parameters:
+ pc - the preconditioner context
- name - character string describing shell preconditioner
Level: intermediate
Note:
This is seperate from the name you can provide with `PetscObjectSetName()`
.seealso: `PCSHELL`, `PCShellGetName()`, `PetscObjectSetName()`, `PetscObjectGetName()`
@*/
PetscErrorCode PCShellSetName(PC pc, const char name[])
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetName_C", (PC, const char[]), (pc, name));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellGetName - Gets an optional name that the user has set for a `PCSHELL` with `PCShellSetName()`
preconditioner.
Not Collective
Input Parameter:
. pc - the preconditioner context
Output Parameter:
. name - character string describing shell preconditioner (you should not free this)
Level: intermediate
.seealso: `PCSHELL`, `PCShellSetName()`, `PetscObjectSetName()`, `PetscObjectGetName()`
@*/
PetscErrorCode PCShellGetName(PC pc, const char *name[])
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscAssertPointer(name, 2);
PetscUseMethod(pc, "PCShellGetName_C", (PC, const char *[]), (pc, name));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*@C
PCShellSetApplyRichardson - Sets routine to use as preconditioner
in Richardson iteration.
Logically Collective
Input Parameters:
+ pc - the preconditioner context
- apply - the application-provided preconditioning routine
Calling sequence of `apply`:
+ pc - the preconditioner
. b - right-hand-side
. x - current iterate
. r - work space
. rtol - relative tolerance of residual norm to stop at
. abstol - absolute tolerance of residual norm to stop at
. dtol - if residual norm increases by this factor than return
. maxits - number of iterations to run
. zeroinitialguess - `PETSC_TRUE` if `x` is known to be initially zero
. its - returns the number of iterations used
- reason - returns the reason the iteration has converged
Level: advanced
Note:
You can get the `PCSHELL` context set with `PCShellSetContext()` using `PCShellGetContext()` if needed by `apply`.
.seealso: `PCSHELL`, `PCShellSetApply()`, `PCShellSetContext()`, `PCRichardsonConvergedReason()`, `PCShellGetContext()`
@*/
PetscErrorCode PCShellSetApplyRichardson(PC pc, PetscErrorCode (*apply)(PC pc, Vec b, Vec x, Vec r, PetscReal rtol, PetscReal abstol, PetscReal dtol, PetscInt maxits, PetscBool zeroinitialguess, PetscInt *its, PCRichardsonConvergedReason *reason))
{
PetscFunctionBegin;
PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
PetscTryMethod(pc, "PCShellSetApplyRichardson_C", (PC, PetscErrorCode(*)(PC, Vec, Vec, Vec, PetscReal, PetscReal, PetscReal, PetscInt, PetscBool, PetscInt *, PCRichardsonConvergedReason *)), (pc, apply));
PetscFunctionReturn(PETSC_SUCCESS);
}
/*MC
PCSHELL - Creates a new preconditioner class for use with a users
own private data storage format and preconditioner application code
Level: advanced
Usage:
.vb
extern PetscErrorCode apply(PC,Vec,Vec);
extern PetscErrorCode applyba(PC,PCSide,Vec,Vec,Vec);
extern PetscErrorCode applytranspose(PC,Vec,Vec);
extern PetscErrorCode setup(PC);
extern PetscErrorCode destroy(PC);
PCCreate(comm,&pc);
PCSetType(pc,PCSHELL);
PCShellSetContext(pc,ctx)
PCShellSetApply(pc,apply);
PCShellSetApplyBA(pc,applyba); (optional)
PCShellSetApplyTranspose(pc,applytranspose); (optional)
PCShellSetSetUp(pc,setup); (optional)
PCShellSetDestroy(pc,destroy); (optional)
.ve
Note:
Information required for the preconditioner and its internal datastructures can be set with `PCShellSetContext()` and then accessed
with `PCShellGetContext()` inside the routines provided above
.seealso: `PCCreate()`, `PCSetType()`, `PCType`, `PC`,
`MATSHELL`, `PCShellSetSetUp()`, `PCShellSetApply()`, `PCShellSetView()`, `PCShellSetDestroy()`, `PCShellSetPostSolve()`,
`PCShellSetApplyTranspose()`, `PCShellSetName()`, `PCShellSetApplyRichardson()`, `PCShellSetPreSolve()`, `PCShellSetView()`,
`PCShellGetName()`, `PCShellSetContext()`, `PCShellGetContext()`, `PCShellSetApplyBA()`, `MATSHELL`, `PCShellSetMatApply()`,
M*/
PETSC_EXTERN PetscErrorCode PCCreate_Shell(PC pc)
{
PC_Shell *shell;
PetscFunctionBegin;
PetscCall(PetscNew(&shell));
pc->data = (void *)shell;
pc->ops->destroy = PCDestroy_Shell;
pc->ops->view = PCView_Shell;
pc->ops->apply = PCApply_Shell;
pc->ops->applysymmetricleft = PCApplySymmetricLeft_Shell;
pc->ops->applysymmetricright = PCApplySymmetricRight_Shell;
pc->ops->matapply = NULL;
pc->ops->applytranspose = NULL;
pc->ops->applyrichardson = NULL;
pc->ops->setup = NULL;
pc->ops->presolve = NULL;
pc->ops->postsolve = NULL;
shell->apply = NULL;
shell->applytranspose = NULL;
shell->name = NULL;
shell->applyrich = NULL;
shell->presolve = NULL;
shell->postsolve = NULL;
shell->ctx = NULL;
shell->setup = NULL;
shell->view = NULL;
shell->destroy = NULL;
shell->applysymmetricleft = NULL;
shell->applysymmetricright = NULL;
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetDestroy_C", PCShellSetDestroy_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetSetUp_C", PCShellSetSetUp_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApply_C", PCShellSetApply_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetMatApply_C", PCShellSetMatApply_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplySymmetricLeft_C", PCShellSetApplySymmetricLeft_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplySymmetricRight_C", PCShellSetApplySymmetricRight_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyBA_C", PCShellSetApplyBA_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetPreSolve_C", PCShellSetPreSolve_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetPostSolve_C", PCShellSetPostSolve_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetView_C", PCShellSetView_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyTranspose_C", PCShellSetApplyTranspose_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetName_C", PCShellSetName_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellGetName_C", PCShellGetName_Shell));
PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCShellSetApplyRichardson_C", PCShellSetApplyRichardson_Shell));
PetscFunctionReturn(PETSC_SUCCESS);
}
|
ee6333363bea09ffe7486929a04776298e9eeb38
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/mips/include/asm/octeon/cvmx-gmxx-defs.h
|
e347496a33c38c69869a7dc47ef94565ca9dcb5c
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 231,844
|
h
|
cvmx-gmxx-defs.h
|
/***********************license start***************
* Author: Cavium Networks
*
* Contact: support@caviumnetworks.com
* This file is part of the OCTEON SDK
*
* Copyright (c) 2003-2012 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**************************************/
#ifndef __CVMX_GMXX_DEFS_H__
#define __CVMX_GMXX_DEFS_H__
static inline uint64_t CVMX_GMXX_BAD_REG(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000518ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000518ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000518ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000518ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_BIST(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000400ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000400ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000400ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000400ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_BPID_MAPX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000680ull) + (((offset) & 15) + ((block_id) & 7) * 0x200000ull) * 8)
#define CVMX_GMXX_BPID_MSK(block_id) (CVMX_ADD_IO_SEG(0x0001180008000700ull) + ((block_id) & 7) * 0x1000000ull)
static inline uint64_t CVMX_GMXX_CLK_EN(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080007F0ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_EBP_DIS(block_id) (CVMX_ADD_IO_SEG(0x0001180008000608ull) + ((block_id) & 7) * 0x1000000ull)
#define CVMX_GMXX_EBP_MSK(block_id) (CVMX_ADD_IO_SEG(0x0001180008000600ull) + ((block_id) & 7) * 0x1000000ull)
static inline uint64_t CVMX_GMXX_HG2_CONTROL(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000550ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_INF_MODE(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080007F8ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_NXA_ADR(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000510ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000510ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000510ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000510ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_PIPE_STATUS(block_id) (CVMX_ADD_IO_SEG(0x0001180008000760ull) + ((block_id) & 7) * 0x1000000ull)
static inline uint64_t CVMX_GMXX_PRTX_CBFC_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000580ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000580ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000580ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000580ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_PRTX_CFG(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000010ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
#define CVMX_GMXX_RXAUI_CTL(block_id) (CVMX_ADD_IO_SEG(0x0001180008000740ull) + ((block_id) & 7) * 0x1000000ull)
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM0(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000180ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM1(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000188ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM2(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000190ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM3(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000198ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM4(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080001A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM5(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080001A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM_ALL_EN(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000110ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000110ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000110ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000110ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CAM_EN(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000108ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_ADR_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000100ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_DECISION(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000040ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_FRM_CHK(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000020ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_FRM_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000018ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
#define CVMX_GMXX_RXX_FRM_MAX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000030ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
#define CVMX_GMXX_RXX_FRM_MIN(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000028ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
static inline uint64_t CVMX_GMXX_RXX_IFG(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000058ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_INT_EN(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000008ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_INT_REG(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000000ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_JABBER(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000038ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_PAUSE_DROP_TIME(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000068ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
#define CVMX_GMXX_RXX_RX_INBND(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000060ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
static inline uint64_t CVMX_GMXX_RXX_STATS_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000050ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_OCTS(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000088ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_OCTS_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000098ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_OCTS_DMAC(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080000A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_OCTS_DRP(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080000B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_PKTS(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000080ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_PKTS_BAD(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080000C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_PKTS_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000090ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_PKTS_DMAC(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080000A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_STATS_PKTS_DRP(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080000B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RXX_UDD_SKP(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000048ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_RX_BP_DROPX(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x0ull) * 8;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x200000ull) * 8;
}
return CVMX_ADD_IO_SEG(0x0001180008000420ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
}
static inline uint64_t CVMX_GMXX_RX_BP_OFFX(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x0ull) * 8;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x200000ull) * 8;
}
return CVMX_ADD_IO_SEG(0x0001180008000460ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
}
static inline uint64_t CVMX_GMXX_RX_BP_ONX(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x0ull) * 8;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x200000ull) * 8;
}
return CVMX_ADD_IO_SEG(0x0001180008000440ull) + ((offset) + (block_id) * 0x1000000ull) * 8;
}
static inline uint64_t CVMX_GMXX_RX_HG2_STATUS(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000548ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000548ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000548ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000548ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_RX_PASS_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800080005F8ull) + ((block_id) & 1) * 0x8000000ull)
#define CVMX_GMXX_RX_PASS_MAPX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000600ull) + (((offset) & 15) + ((block_id) & 1) * 0x1000000ull) * 8)
static inline uint64_t CVMX_GMXX_RX_PRTS(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000410ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_RX_PRT_INFO(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004E8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004E8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004E8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004E8ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_RX_TX_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800080007E8ull))
static inline uint64_t CVMX_GMXX_RX_XAUI_BAD_COL(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000538ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000538ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000538ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000538ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_RX_XAUI_CTL(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000530ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_SMACX(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000230ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_SOFT_BIST(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080007E8ull) + (block_id) * 0x1000000ull;
}
static inline uint64_t CVMX_GMXX_STAT_BP(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000520ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000520ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000520ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000520ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TB_REG(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E0ull) + (block_id) * 0x8000000ull;
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080007E0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080007E0ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TXX_APPEND(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000218ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_BURST(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000228ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_CBFC_XOFF(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005A0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005A0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005A0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080005A0ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TXX_CBFC_XON(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005C0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005C0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080005C0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080005C0ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_TXX_CLK(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000208ull) + (((offset) & 3) + ((block_id) & 1) * 0x10000ull) * 2048)
static inline uint64_t CVMX_GMXX_TXX_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000270ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_MIN_PKT(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000240ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_PAUSE_PKT_INTERVAL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000248ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_PAUSE_PKT_TIME(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000238ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_PAUSE_TOGO(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000258ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_PAUSE_ZERO(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000260ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
#define CVMX_GMXX_TXX_PIPE(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000310ull) + (((offset) & 3) + ((block_id) & 7) * 0x2000ull) * 2048)
static inline uint64_t CVMX_GMXX_TXX_SGMII_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000300ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000300ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000300ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000300ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000300ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_SLOT(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000220ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_SOFT_PAUSE(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000250ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT0(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000280ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT1(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000288ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT2(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000290ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT3(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000298ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT4(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002A0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT5(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002A8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT6(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002B0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT7(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002B8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT8(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002C0ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STAT9(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x00011800080002C8ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_STATS_CTL(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000268ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TXX_THRESH(unsigned long offset, unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x0ull) * 2048;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x2000ull) * 2048;
}
return CVMX_ADD_IO_SEG(0x0001180008000210ull) + ((offset) + (block_id) * 0x10000ull) * 2048;
}
static inline uint64_t CVMX_GMXX_TX_BP(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004D0ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_TX_CLK_MSKX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000780ull) + (((offset) & 1) + ((block_id) & 0) * 0x0ull) * 8)
static inline uint64_t CVMX_GMXX_TX_COL_ATTEMPT(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000498ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000498ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000498ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000498ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_CORRUPT(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004D8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004D8ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_HG2_REG1(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000558ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000558ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000558ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000558ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_HG2_REG2(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000560ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000560ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000560ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000560ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_IFG(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000488ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000488ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000488ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000488ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_INT_EN(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000508ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_INT_REG(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000500ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_JAM(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000490ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000490ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000490ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000490ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_LFSR(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004F8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004F8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004F8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004F8ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_OVR_BP(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004C8ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_PAUSE_PKT_DMAC(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A0ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A0ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004A0ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_PAUSE_PKT_TYPE(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A8ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x00011800080004A8ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x00011800080004A8ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_TX_PRTS(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CN30XX & OCTEON_FAMILY_MASK:
case OCTEON_CN50XX & OCTEON_FAMILY_MASK:
case OCTEON_CN31XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN38XX & OCTEON_FAMILY_MASK:
case OCTEON_CN58XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000480ull) + (block_id) * 0x8000000ull;
}
#define CVMX_GMXX_TX_SPI_CTL(block_id) (CVMX_ADD_IO_SEG(0x00011800080004C0ull) + ((block_id) & 1) * 0x8000000ull)
#define CVMX_GMXX_TX_SPI_DRAIN(block_id) (CVMX_ADD_IO_SEG(0x00011800080004E0ull) + ((block_id) & 1) * 0x8000000ull)
#define CVMX_GMXX_TX_SPI_MAX(block_id) (CVMX_ADD_IO_SEG(0x00011800080004B0ull) + ((block_id) & 1) * 0x8000000ull)
#define CVMX_GMXX_TX_SPI_ROUNDX(offset, block_id) (CVMX_ADD_IO_SEG(0x0001180008000680ull) + (((offset) & 31) + ((block_id) & 1) * 0x1000000ull) * 8)
#define CVMX_GMXX_TX_SPI_THRESH(block_id) (CVMX_ADD_IO_SEG(0x00011800080004B8ull) + ((block_id) & 1) * 0x8000000ull)
static inline uint64_t CVMX_GMXX_TX_XAUI_CTL(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000528ull) + (block_id) * 0x8000000ull;
}
static inline uint64_t CVMX_GMXX_XAUI_EXT_LOOPBACK(unsigned long block_id)
{
switch (cvmx_get_octeon_family()) {
case OCTEON_CNF71XX & OCTEON_FAMILY_MASK:
case OCTEON_CN52XX & OCTEON_FAMILY_MASK:
case OCTEON_CN63XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000540ull) + (block_id) * 0x8000000ull;
case OCTEON_CN56XX & OCTEON_FAMILY_MASK:
case OCTEON_CN66XX & OCTEON_FAMILY_MASK:
case OCTEON_CN61XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000540ull) + (block_id) * 0x8000000ull;
case OCTEON_CN68XX & OCTEON_FAMILY_MASK:
return CVMX_ADD_IO_SEG(0x0001180008000540ull) + (block_id) * 0x1000000ull;
}
return CVMX_ADD_IO_SEG(0x0001180008000540ull) + (block_id) * 0x8000000ull;
}
union cvmx_gmxx_bad_reg {
uint64_t u64;
struct cvmx_gmxx_bad_reg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_31_63:33;
uint64_t inb_nxa:4;
uint64_t statovr:1;
uint64_t loststat:4;
uint64_t reserved_18_21:4;
uint64_t out_ovr:16;
uint64_t ncb_ovr:1;
uint64_t out_col:1;
#else
uint64_t out_col:1;
uint64_t ncb_ovr:1;
uint64_t out_ovr:16;
uint64_t reserved_18_21:4;
uint64_t loststat:4;
uint64_t statovr:1;
uint64_t inb_nxa:4;
uint64_t reserved_31_63:33;
#endif
} s;
struct cvmx_gmxx_bad_reg_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_31_63:33;
uint64_t inb_nxa:4;
uint64_t statovr:1;
uint64_t reserved_25_25:1;
uint64_t loststat:3;
uint64_t reserved_5_21:17;
uint64_t out_ovr:3;
uint64_t reserved_0_1:2;
#else
uint64_t reserved_0_1:2;
uint64_t out_ovr:3;
uint64_t reserved_5_21:17;
uint64_t loststat:3;
uint64_t reserved_25_25:1;
uint64_t statovr:1;
uint64_t inb_nxa:4;
uint64_t reserved_31_63:33;
#endif
} cn30xx;
struct cvmx_gmxx_bad_reg_cn30xx cn31xx;
struct cvmx_gmxx_bad_reg_s cn38xx;
struct cvmx_gmxx_bad_reg_s cn38xxp2;
struct cvmx_gmxx_bad_reg_cn30xx cn50xx;
struct cvmx_gmxx_bad_reg_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_31_63:33;
uint64_t inb_nxa:4;
uint64_t statovr:1;
uint64_t loststat:4;
uint64_t reserved_6_21:16;
uint64_t out_ovr:4;
uint64_t reserved_0_1:2;
#else
uint64_t reserved_0_1:2;
uint64_t out_ovr:4;
uint64_t reserved_6_21:16;
uint64_t loststat:4;
uint64_t statovr:1;
uint64_t inb_nxa:4;
uint64_t reserved_31_63:33;
#endif
} cn52xx;
struct cvmx_gmxx_bad_reg_cn52xx cn52xxp1;
struct cvmx_gmxx_bad_reg_cn52xx cn56xx;
struct cvmx_gmxx_bad_reg_cn52xx cn56xxp1;
struct cvmx_gmxx_bad_reg_s cn58xx;
struct cvmx_gmxx_bad_reg_s cn58xxp1;
struct cvmx_gmxx_bad_reg_cn52xx cn61xx;
struct cvmx_gmxx_bad_reg_cn52xx cn63xx;
struct cvmx_gmxx_bad_reg_cn52xx cn63xxp1;
struct cvmx_gmxx_bad_reg_cn52xx cn66xx;
struct cvmx_gmxx_bad_reg_cn52xx cn68xx;
struct cvmx_gmxx_bad_reg_cn52xx cn68xxp1;
struct cvmx_gmxx_bad_reg_cn52xx cnf71xx;
};
union cvmx_gmxx_bist {
uint64_t u64;
struct cvmx_gmxx_bist_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t status:25;
#else
uint64_t status:25;
uint64_t reserved_25_63:39;
#endif
} s;
struct cvmx_gmxx_bist_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t status:10;
#else
uint64_t status:10;
uint64_t reserved_10_63:54;
#endif
} cn30xx;
struct cvmx_gmxx_bist_cn30xx cn31xx;
struct cvmx_gmxx_bist_cn30xx cn38xx;
struct cvmx_gmxx_bist_cn30xx cn38xxp2;
struct cvmx_gmxx_bist_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_12_63:52;
uint64_t status:12;
#else
uint64_t status:12;
uint64_t reserved_12_63:52;
#endif
} cn50xx;
struct cvmx_gmxx_bist_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t status:16;
#else
uint64_t status:16;
uint64_t reserved_16_63:48;
#endif
} cn52xx;
struct cvmx_gmxx_bist_cn52xx cn52xxp1;
struct cvmx_gmxx_bist_cn52xx cn56xx;
struct cvmx_gmxx_bist_cn52xx cn56xxp1;
struct cvmx_gmxx_bist_cn58xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_17_63:47;
uint64_t status:17;
#else
uint64_t status:17;
uint64_t reserved_17_63:47;
#endif
} cn58xx;
struct cvmx_gmxx_bist_cn58xx cn58xxp1;
struct cvmx_gmxx_bist_s cn61xx;
struct cvmx_gmxx_bist_s cn63xx;
struct cvmx_gmxx_bist_s cn63xxp1;
struct cvmx_gmxx_bist_s cn66xx;
struct cvmx_gmxx_bist_s cn68xx;
struct cvmx_gmxx_bist_s cn68xxp1;
struct cvmx_gmxx_bist_s cnf71xx;
};
union cvmx_gmxx_bpid_mapx {
uint64_t u64;
struct cvmx_gmxx_bpid_mapx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_17_63:47;
uint64_t status:1;
uint64_t reserved_9_15:7;
uint64_t val:1;
uint64_t reserved_6_7:2;
uint64_t bpid:6;
#else
uint64_t bpid:6;
uint64_t reserved_6_7:2;
uint64_t val:1;
uint64_t reserved_9_15:7;
uint64_t status:1;
uint64_t reserved_17_63:47;
#endif
} s;
struct cvmx_gmxx_bpid_mapx_s cn68xx;
struct cvmx_gmxx_bpid_mapx_s cn68xxp1;
};
union cvmx_gmxx_bpid_msk {
uint64_t u64;
struct cvmx_gmxx_bpid_msk_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t msk_or:16;
uint64_t reserved_16_31:16;
uint64_t msk_and:16;
#else
uint64_t msk_and:16;
uint64_t reserved_16_31:16;
uint64_t msk_or:16;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_bpid_msk_s cn68xx;
struct cvmx_gmxx_bpid_msk_s cn68xxp1;
};
union cvmx_gmxx_clk_en {
uint64_t u64;
struct cvmx_gmxx_clk_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t clk_en:1;
#else
uint64_t clk_en:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_clk_en_s cn52xx;
struct cvmx_gmxx_clk_en_s cn52xxp1;
struct cvmx_gmxx_clk_en_s cn56xx;
struct cvmx_gmxx_clk_en_s cn56xxp1;
struct cvmx_gmxx_clk_en_s cn61xx;
struct cvmx_gmxx_clk_en_s cn63xx;
struct cvmx_gmxx_clk_en_s cn63xxp1;
struct cvmx_gmxx_clk_en_s cn66xx;
struct cvmx_gmxx_clk_en_s cn68xx;
struct cvmx_gmxx_clk_en_s cn68xxp1;
struct cvmx_gmxx_clk_en_s cnf71xx;
};
union cvmx_gmxx_ebp_dis {
uint64_t u64;
struct cvmx_gmxx_ebp_dis_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t dis:16;
#else
uint64_t dis:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_ebp_dis_s cn68xx;
struct cvmx_gmxx_ebp_dis_s cn68xxp1;
};
union cvmx_gmxx_ebp_msk {
uint64_t u64;
struct cvmx_gmxx_ebp_msk_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t msk:16;
#else
uint64_t msk:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_ebp_msk_s cn68xx;
struct cvmx_gmxx_ebp_msk_s cn68xxp1;
};
union cvmx_gmxx_hg2_control {
uint64_t u64;
struct cvmx_gmxx_hg2_control_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t hg2tx_en:1;
uint64_t hg2rx_en:1;
uint64_t phys_en:1;
uint64_t logl_en:16;
#else
uint64_t logl_en:16;
uint64_t phys_en:1;
uint64_t hg2rx_en:1;
uint64_t hg2tx_en:1;
uint64_t reserved_19_63:45;
#endif
} s;
struct cvmx_gmxx_hg2_control_s cn52xx;
struct cvmx_gmxx_hg2_control_s cn52xxp1;
struct cvmx_gmxx_hg2_control_s cn56xx;
struct cvmx_gmxx_hg2_control_s cn61xx;
struct cvmx_gmxx_hg2_control_s cn63xx;
struct cvmx_gmxx_hg2_control_s cn63xxp1;
struct cvmx_gmxx_hg2_control_s cn66xx;
struct cvmx_gmxx_hg2_control_s cn68xx;
struct cvmx_gmxx_hg2_control_s cn68xxp1;
struct cvmx_gmxx_hg2_control_s cnf71xx;
};
union cvmx_gmxx_inf_mode {
uint64_t u64;
struct cvmx_gmxx_inf_mode_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t rate:4;
uint64_t reserved_12_15:4;
uint64_t speed:4;
uint64_t reserved_7_7:1;
uint64_t mode:3;
uint64_t reserved_3_3:1;
uint64_t p0mii:1;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t p0mii:1;
uint64_t reserved_3_3:1;
uint64_t mode:3;
uint64_t reserved_7_7:1;
uint64_t speed:4;
uint64_t reserved_12_15:4;
uint64_t rate:4;
uint64_t reserved_20_63:44;
#endif
} s;
struct cvmx_gmxx_inf_mode_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_3_63:61;
uint64_t p0mii:1;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t p0mii:1;
uint64_t reserved_3_63:61;
#endif
} cn30xx;
struct cvmx_gmxx_inf_mode_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t reserved_2_63:62;
#endif
} cn31xx;
struct cvmx_gmxx_inf_mode_cn31xx cn38xx;
struct cvmx_gmxx_inf_mode_cn31xx cn38xxp2;
struct cvmx_gmxx_inf_mode_cn30xx cn50xx;
struct cvmx_gmxx_inf_mode_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t speed:2;
uint64_t reserved_6_7:2;
uint64_t mode:2;
uint64_t reserved_2_3:2;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t reserved_2_3:2;
uint64_t mode:2;
uint64_t reserved_6_7:2;
uint64_t speed:2;
uint64_t reserved_10_63:54;
#endif
} cn52xx;
struct cvmx_gmxx_inf_mode_cn52xx cn52xxp1;
struct cvmx_gmxx_inf_mode_cn52xx cn56xx;
struct cvmx_gmxx_inf_mode_cn52xx cn56xxp1;
struct cvmx_gmxx_inf_mode_cn31xx cn58xx;
struct cvmx_gmxx_inf_mode_cn31xx cn58xxp1;
struct cvmx_gmxx_inf_mode_cn61xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_12_63:52;
uint64_t speed:4;
uint64_t reserved_5_7:3;
uint64_t mode:1;
uint64_t reserved_2_3:2;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t reserved_2_3:2;
uint64_t mode:1;
uint64_t reserved_5_7:3;
uint64_t speed:4;
uint64_t reserved_12_63:52;
#endif
} cn61xx;
struct cvmx_gmxx_inf_mode_cn61xx cn63xx;
struct cvmx_gmxx_inf_mode_cn61xx cn63xxp1;
struct cvmx_gmxx_inf_mode_cn66xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t rate:4;
uint64_t reserved_12_15:4;
uint64_t speed:4;
uint64_t reserved_5_7:3;
uint64_t mode:1;
uint64_t reserved_2_3:2;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t reserved_2_3:2;
uint64_t mode:1;
uint64_t reserved_5_7:3;
uint64_t speed:4;
uint64_t reserved_12_15:4;
uint64_t rate:4;
uint64_t reserved_20_63:44;
#endif
} cn66xx;
struct cvmx_gmxx_inf_mode_cn68xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_12_63:52;
uint64_t speed:4;
uint64_t reserved_7_7:1;
uint64_t mode:3;
uint64_t reserved_2_3:2;
uint64_t en:1;
uint64_t type:1;
#else
uint64_t type:1;
uint64_t en:1;
uint64_t reserved_2_3:2;
uint64_t mode:3;
uint64_t reserved_7_7:1;
uint64_t speed:4;
uint64_t reserved_12_63:52;
#endif
} cn68xx;
struct cvmx_gmxx_inf_mode_cn68xx cn68xxp1;
struct cvmx_gmxx_inf_mode_cn61xx cnf71xx;
};
union cvmx_gmxx_nxa_adr {
uint64_t u64;
struct cvmx_gmxx_nxa_adr_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_23_63:41;
uint64_t pipe:7;
uint64_t reserved_6_15:10;
uint64_t prt:6;
#else
uint64_t prt:6;
uint64_t reserved_6_15:10;
uint64_t pipe:7;
uint64_t reserved_23_63:41;
#endif
} s;
struct cvmx_gmxx_nxa_adr_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_6_63:58;
uint64_t prt:6;
#else
uint64_t prt:6;
uint64_t reserved_6_63:58;
#endif
} cn30xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn31xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn38xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn38xxp2;
struct cvmx_gmxx_nxa_adr_cn30xx cn50xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn52xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn52xxp1;
struct cvmx_gmxx_nxa_adr_cn30xx cn56xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn56xxp1;
struct cvmx_gmxx_nxa_adr_cn30xx cn58xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn58xxp1;
struct cvmx_gmxx_nxa_adr_cn30xx cn61xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn63xx;
struct cvmx_gmxx_nxa_adr_cn30xx cn63xxp1;
struct cvmx_gmxx_nxa_adr_cn30xx cn66xx;
struct cvmx_gmxx_nxa_adr_s cn68xx;
struct cvmx_gmxx_nxa_adr_s cn68xxp1;
struct cvmx_gmxx_nxa_adr_cn30xx cnf71xx;
};
union cvmx_gmxx_pipe_status {
uint64_t u64;
struct cvmx_gmxx_pipe_status_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t ovr:4;
uint64_t reserved_12_15:4;
uint64_t bp:4;
uint64_t reserved_4_7:4;
uint64_t stop:4;
#else
uint64_t stop:4;
uint64_t reserved_4_7:4;
uint64_t bp:4;
uint64_t reserved_12_15:4;
uint64_t ovr:4;
uint64_t reserved_20_63:44;
#endif
} s;
struct cvmx_gmxx_pipe_status_s cn68xx;
struct cvmx_gmxx_pipe_status_s cn68xxp1;
};
union cvmx_gmxx_prtx_cbfc_ctl {
uint64_t u64;
struct cvmx_gmxx_prtx_cbfc_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t phys_en:16;
uint64_t logl_en:16;
uint64_t phys_bp:16;
uint64_t reserved_4_15:12;
uint64_t bck_en:1;
uint64_t drp_en:1;
uint64_t tx_en:1;
uint64_t rx_en:1;
#else
uint64_t rx_en:1;
uint64_t tx_en:1;
uint64_t drp_en:1;
uint64_t bck_en:1;
uint64_t reserved_4_15:12;
uint64_t phys_bp:16;
uint64_t logl_en:16;
uint64_t phys_en:16;
#endif
} s;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn52xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn56xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn61xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn63xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn63xxp1;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn66xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn68xx;
struct cvmx_gmxx_prtx_cbfc_ctl_s cn68xxp1;
struct cvmx_gmxx_prtx_cbfc_ctl_s cnf71xx;
};
union cvmx_gmxx_prtx_cfg {
uint64_t u64;
struct cvmx_gmxx_prtx_cfg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_22_63:42;
uint64_t pknd:6;
uint64_t reserved_14_15:2;
uint64_t tx_idle:1;
uint64_t rx_idle:1;
uint64_t reserved_9_11:3;
uint64_t speed_msb:1;
uint64_t reserved_4_7:4;
uint64_t slottime:1;
uint64_t duplex:1;
uint64_t speed:1;
uint64_t en:1;
#else
uint64_t en:1;
uint64_t speed:1;
uint64_t duplex:1;
uint64_t slottime:1;
uint64_t reserved_4_7:4;
uint64_t speed_msb:1;
uint64_t reserved_9_11:3;
uint64_t rx_idle:1;
uint64_t tx_idle:1;
uint64_t reserved_14_15:2;
uint64_t pknd:6;
uint64_t reserved_22_63:42;
#endif
} s;
struct cvmx_gmxx_prtx_cfg_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t slottime:1;
uint64_t duplex:1;
uint64_t speed:1;
uint64_t en:1;
#else
uint64_t en:1;
uint64_t speed:1;
uint64_t duplex:1;
uint64_t slottime:1;
uint64_t reserved_4_63:60;
#endif
} cn30xx;
struct cvmx_gmxx_prtx_cfg_cn30xx cn31xx;
struct cvmx_gmxx_prtx_cfg_cn30xx cn38xx;
struct cvmx_gmxx_prtx_cfg_cn30xx cn38xxp2;
struct cvmx_gmxx_prtx_cfg_cn30xx cn50xx;
struct cvmx_gmxx_prtx_cfg_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_14_63:50;
uint64_t tx_idle:1;
uint64_t rx_idle:1;
uint64_t reserved_9_11:3;
uint64_t speed_msb:1;
uint64_t reserved_4_7:4;
uint64_t slottime:1;
uint64_t duplex:1;
uint64_t speed:1;
uint64_t en:1;
#else
uint64_t en:1;
uint64_t speed:1;
uint64_t duplex:1;
uint64_t slottime:1;
uint64_t reserved_4_7:4;
uint64_t speed_msb:1;
uint64_t reserved_9_11:3;
uint64_t rx_idle:1;
uint64_t tx_idle:1;
uint64_t reserved_14_63:50;
#endif
} cn52xx;
struct cvmx_gmxx_prtx_cfg_cn52xx cn52xxp1;
struct cvmx_gmxx_prtx_cfg_cn52xx cn56xx;
struct cvmx_gmxx_prtx_cfg_cn52xx cn56xxp1;
struct cvmx_gmxx_prtx_cfg_cn30xx cn58xx;
struct cvmx_gmxx_prtx_cfg_cn30xx cn58xxp1;
struct cvmx_gmxx_prtx_cfg_cn52xx cn61xx;
struct cvmx_gmxx_prtx_cfg_cn52xx cn63xx;
struct cvmx_gmxx_prtx_cfg_cn52xx cn63xxp1;
struct cvmx_gmxx_prtx_cfg_cn52xx cn66xx;
struct cvmx_gmxx_prtx_cfg_s cn68xx;
struct cvmx_gmxx_prtx_cfg_s cn68xxp1;
struct cvmx_gmxx_prtx_cfg_cn52xx cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam0 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam0_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam0_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam0_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam0_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam0_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam0_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam0_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam0_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam0_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam1 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam1_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam1_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam1_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam1_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam1_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam1_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam1_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam1_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam1_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam2 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam2_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam2_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam2_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam2_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam2_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam2_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam2_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam2_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam2_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam3 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam3_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam3_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam3_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam3_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam3_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam3_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam3_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam3_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam3_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam4 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam4_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam4_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam4_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam4_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam4_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam4_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam4_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam4_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam4_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam5 {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam5_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t adr:64;
#else
uint64_t adr:64;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam5_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam5_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam5_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam5_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam5_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam5_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam5_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam5_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam_all_en {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam_all_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t en:32;
#else
uint64_t en:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam_all_en_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam_all_en_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam_all_en_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam_all_en_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_cam_en {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_cam_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_8_63:56;
uint64_t en:8;
#else
uint64_t en:8;
uint64_t reserved_8_63:56;
#endif
} s;
struct cvmx_gmxx_rxx_adr_cam_en_s cn30xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn31xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn38xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_cam_en_s cn50xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn52xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_cam_en_s cn56xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_cam_en_s cn58xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_cam_en_s cn61xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn63xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_cam_en_s cn66xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn68xx;
struct cvmx_gmxx_rxx_adr_cam_en_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_cam_en_s cnf71xx;
};
union cvmx_gmxx_rxx_adr_ctl {
uint64_t u64;
struct cvmx_gmxx_rxx_adr_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t cam_mode:1;
uint64_t mcst:2;
uint64_t bcst:1;
#else
uint64_t bcst:1;
uint64_t mcst:2;
uint64_t cam_mode:1;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_rxx_adr_ctl_s cn30xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn31xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn38xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn38xxp2;
struct cvmx_gmxx_rxx_adr_ctl_s cn50xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn52xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn52xxp1;
struct cvmx_gmxx_rxx_adr_ctl_s cn56xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn56xxp1;
struct cvmx_gmxx_rxx_adr_ctl_s cn58xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn58xxp1;
struct cvmx_gmxx_rxx_adr_ctl_s cn61xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn63xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn63xxp1;
struct cvmx_gmxx_rxx_adr_ctl_s cn66xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn68xx;
struct cvmx_gmxx_rxx_adr_ctl_s cn68xxp1;
struct cvmx_gmxx_rxx_adr_ctl_s cnf71xx;
};
union cvmx_gmxx_rxx_decision {
uint64_t u64;
struct cvmx_gmxx_rxx_decision_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_5_63:59;
uint64_t cnt:5;
#else
uint64_t cnt:5;
uint64_t reserved_5_63:59;
#endif
} s;
struct cvmx_gmxx_rxx_decision_s cn30xx;
struct cvmx_gmxx_rxx_decision_s cn31xx;
struct cvmx_gmxx_rxx_decision_s cn38xx;
struct cvmx_gmxx_rxx_decision_s cn38xxp2;
struct cvmx_gmxx_rxx_decision_s cn50xx;
struct cvmx_gmxx_rxx_decision_s cn52xx;
struct cvmx_gmxx_rxx_decision_s cn52xxp1;
struct cvmx_gmxx_rxx_decision_s cn56xx;
struct cvmx_gmxx_rxx_decision_s cn56xxp1;
struct cvmx_gmxx_rxx_decision_s cn58xx;
struct cvmx_gmxx_rxx_decision_s cn58xxp1;
struct cvmx_gmxx_rxx_decision_s cn61xx;
struct cvmx_gmxx_rxx_decision_s cn63xx;
struct cvmx_gmxx_rxx_decision_s cn63xxp1;
struct cvmx_gmxx_rxx_decision_s cn66xx;
struct cvmx_gmxx_rxx_decision_s cn68xx;
struct cvmx_gmxx_rxx_decision_s cn68xxp1;
struct cvmx_gmxx_rxx_decision_s cnf71xx;
};
union cvmx_gmxx_rxx_frm_chk {
uint64_t u64;
struct cvmx_gmxx_rxx_frm_chk_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t reserved_10_63:54;
#endif
} s;
struct cvmx_gmxx_rxx_frm_chk_s cn30xx;
struct cvmx_gmxx_rxx_frm_chk_s cn31xx;
struct cvmx_gmxx_rxx_frm_chk_s cn38xx;
struct cvmx_gmxx_rxx_frm_chk_s cn38xxp2;
struct cvmx_gmxx_rxx_frm_chk_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_6_6:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t reserved_6_6:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t reserved_10_63:54;
#endif
} cn50xx;
struct cvmx_gmxx_rxx_frm_chk_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_63:55;
#endif
} cn52xx;
struct cvmx_gmxx_rxx_frm_chk_cn52xx cn52xxp1;
struct cvmx_gmxx_rxx_frm_chk_cn52xx cn56xx;
struct cvmx_gmxx_rxx_frm_chk_cn52xx cn56xxp1;
struct cvmx_gmxx_rxx_frm_chk_s cn58xx;
struct cvmx_gmxx_rxx_frm_chk_s cn58xxp1;
struct cvmx_gmxx_rxx_frm_chk_cn61xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_63:55;
#endif
} cn61xx;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cn63xx;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cn63xxp1;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cn66xx;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cn68xx;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cn68xxp1;
struct cvmx_gmxx_rxx_frm_chk_cn61xx cnf71xx;
};
union cvmx_gmxx_rxx_frm_ctl {
uint64_t u64;
struct cvmx_gmxx_rxx_frm_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_13_63:51;
uint64_t ptp_mode:1;
uint64_t reserved_11_11:1;
uint64_t null_dis:1;
uint64_t pre_align:1;
uint64_t pad_len:1;
uint64_t vlan_len:1;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t vlan_len:1;
uint64_t pad_len:1;
uint64_t pre_align:1;
uint64_t null_dis:1;
uint64_t reserved_11_11:1;
uint64_t ptp_mode:1;
uint64_t reserved_13_63:51;
#endif
} s;
struct cvmx_gmxx_rxx_frm_ctl_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t pad_len:1;
uint64_t vlan_len:1;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t vlan_len:1;
uint64_t pad_len:1;
uint64_t reserved_9_63:55;
#endif
} cn30xx;
struct cvmx_gmxx_rxx_frm_ctl_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_8_63:56;
uint64_t vlan_len:1;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t vlan_len:1;
uint64_t reserved_8_63:56;
#endif
} cn31xx;
struct cvmx_gmxx_rxx_frm_ctl_cn30xx cn38xx;
struct cvmx_gmxx_rxx_frm_ctl_cn31xx cn38xxp2;
struct cvmx_gmxx_rxx_frm_ctl_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_11_63:53;
uint64_t null_dis:1;
uint64_t pre_align:1;
uint64_t reserved_7_8:2;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t reserved_7_8:2;
uint64_t pre_align:1;
uint64_t null_dis:1;
uint64_t reserved_11_63:53;
#endif
} cn50xx;
struct cvmx_gmxx_rxx_frm_ctl_cn50xx cn52xx;
struct cvmx_gmxx_rxx_frm_ctl_cn50xx cn52xxp1;
struct cvmx_gmxx_rxx_frm_ctl_cn50xx cn56xx;
struct cvmx_gmxx_rxx_frm_ctl_cn56xxp1 {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t pre_align:1;
uint64_t reserved_7_8:2;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t reserved_7_8:2;
uint64_t pre_align:1;
uint64_t reserved_10_63:54;
#endif
} cn56xxp1;
struct cvmx_gmxx_rxx_frm_ctl_cn58xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_11_63:53;
uint64_t null_dis:1;
uint64_t pre_align:1;
uint64_t pad_len:1;
uint64_t vlan_len:1;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t vlan_len:1;
uint64_t pad_len:1;
uint64_t pre_align:1;
uint64_t null_dis:1;
uint64_t reserved_11_63:53;
#endif
} cn58xx;
struct cvmx_gmxx_rxx_frm_ctl_cn30xx cn58xxp1;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_13_63:51;
uint64_t ptp_mode:1;
uint64_t reserved_11_11:1;
uint64_t null_dis:1;
uint64_t pre_align:1;
uint64_t reserved_7_8:2;
uint64_t pre_free:1;
uint64_t ctl_smac:1;
uint64_t ctl_mcst:1;
uint64_t ctl_bck:1;
uint64_t ctl_drp:1;
uint64_t pre_strp:1;
uint64_t pre_chk:1;
#else
uint64_t pre_chk:1;
uint64_t pre_strp:1;
uint64_t ctl_drp:1;
uint64_t ctl_bck:1;
uint64_t ctl_mcst:1;
uint64_t ctl_smac:1;
uint64_t pre_free:1;
uint64_t reserved_7_8:2;
uint64_t pre_align:1;
uint64_t null_dis:1;
uint64_t reserved_11_11:1;
uint64_t ptp_mode:1;
uint64_t reserved_13_63:51;
#endif
} cn61xx;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cn63xx;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cn63xxp1;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cn66xx;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cn68xx;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cn68xxp1;
struct cvmx_gmxx_rxx_frm_ctl_cn61xx cnf71xx;
};
union cvmx_gmxx_rxx_frm_max {
uint64_t u64;
struct cvmx_gmxx_rxx_frm_max_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t len:16;
#else
uint64_t len:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_rxx_frm_max_s cn30xx;
struct cvmx_gmxx_rxx_frm_max_s cn31xx;
struct cvmx_gmxx_rxx_frm_max_s cn38xx;
struct cvmx_gmxx_rxx_frm_max_s cn38xxp2;
struct cvmx_gmxx_rxx_frm_max_s cn58xx;
struct cvmx_gmxx_rxx_frm_max_s cn58xxp1;
};
union cvmx_gmxx_rxx_frm_min {
uint64_t u64;
struct cvmx_gmxx_rxx_frm_min_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t len:16;
#else
uint64_t len:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_rxx_frm_min_s cn30xx;
struct cvmx_gmxx_rxx_frm_min_s cn31xx;
struct cvmx_gmxx_rxx_frm_min_s cn38xx;
struct cvmx_gmxx_rxx_frm_min_s cn38xxp2;
struct cvmx_gmxx_rxx_frm_min_s cn58xx;
struct cvmx_gmxx_rxx_frm_min_s cn58xxp1;
};
union cvmx_gmxx_rxx_ifg {
uint64_t u64;
struct cvmx_gmxx_rxx_ifg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t ifg:4;
#else
uint64_t ifg:4;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_rxx_ifg_s cn30xx;
struct cvmx_gmxx_rxx_ifg_s cn31xx;
struct cvmx_gmxx_rxx_ifg_s cn38xx;
struct cvmx_gmxx_rxx_ifg_s cn38xxp2;
struct cvmx_gmxx_rxx_ifg_s cn50xx;
struct cvmx_gmxx_rxx_ifg_s cn52xx;
struct cvmx_gmxx_rxx_ifg_s cn52xxp1;
struct cvmx_gmxx_rxx_ifg_s cn56xx;
struct cvmx_gmxx_rxx_ifg_s cn56xxp1;
struct cvmx_gmxx_rxx_ifg_s cn58xx;
struct cvmx_gmxx_rxx_ifg_s cn58xxp1;
struct cvmx_gmxx_rxx_ifg_s cn61xx;
struct cvmx_gmxx_rxx_ifg_s cn63xx;
struct cvmx_gmxx_rxx_ifg_s cn63xxp1;
struct cvmx_gmxx_rxx_ifg_s cn66xx;
struct cvmx_gmxx_rxx_ifg_s cn68xx;
struct cvmx_gmxx_rxx_ifg_s cn68xxp1;
struct cvmx_gmxx_rxx_ifg_s cnf71xx;
};
union cvmx_gmxx_rxx_int_en {
uint64_t u64;
struct cvmx_gmxx_rxx_int_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} s;
struct cvmx_gmxx_rxx_int_en_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t reserved_19_63:45;
#endif
} cn30xx;
struct cvmx_gmxx_rxx_int_en_cn30xx cn31xx;
struct cvmx_gmxx_rxx_int_en_cn30xx cn38xx;
struct cvmx_gmxx_rxx_int_en_cn30xx cn38xxp2;
struct cvmx_gmxx_rxx_int_en_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_6_6:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t reserved_6_6:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t reserved_20_63:44;
#endif
} cn50xx;
struct cvmx_gmxx_rxx_int_en_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} cn52xx;
struct cvmx_gmxx_rxx_int_en_cn52xx cn52xxp1;
struct cvmx_gmxx_rxx_int_en_cn52xx cn56xx;
struct cvmx_gmxx_rxx_int_en_cn56xxp1 {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_27_63:37;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t reserved_27_63:37;
#endif
} cn56xxp1;
struct cvmx_gmxx_rxx_int_en_cn58xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t reserved_20_63:44;
#endif
} cn58xx;
struct cvmx_gmxx_rxx_int_en_cn58xx cn58xxp1;
struct cvmx_gmxx_rxx_int_en_cn61xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} cn61xx;
struct cvmx_gmxx_rxx_int_en_cn61xx cn63xx;
struct cvmx_gmxx_rxx_int_en_cn61xx cn63xxp1;
struct cvmx_gmxx_rxx_int_en_cn61xx cn66xx;
struct cvmx_gmxx_rxx_int_en_cn61xx cn68xx;
struct cvmx_gmxx_rxx_int_en_cn61xx cn68xxp1;
struct cvmx_gmxx_rxx_int_en_cn61xx cnf71xx;
};
union cvmx_gmxx_rxx_int_reg {
uint64_t u64;
struct cvmx_gmxx_rxx_int_reg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} s;
struct cvmx_gmxx_rxx_int_reg_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t reserved_19_63:45;
#endif
} cn30xx;
struct cvmx_gmxx_rxx_int_reg_cn30xx cn31xx;
struct cvmx_gmxx_rxx_int_reg_cn30xx cn38xx;
struct cvmx_gmxx_rxx_int_reg_cn30xx cn38xxp2;
struct cvmx_gmxx_rxx_int_reg_cn50xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_6_6:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t reserved_6_6:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t reserved_20_63:44;
#endif
} cn50xx;
struct cvmx_gmxx_rxx_int_reg_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} cn52xx;
struct cvmx_gmxx_rxx_int_reg_cn52xx cn52xxp1;
struct cvmx_gmxx_rxx_int_reg_cn52xx cn56xx;
struct cvmx_gmxx_rxx_int_reg_cn56xxp1 {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_27_63:37;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t reserved_0_0:1;
#else
uint64_t reserved_0_0:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t reserved_27_63:37;
#endif
} cn56xxp1;
struct cvmx_gmxx_rxx_int_reg_cn58xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t pause_drp:1;
uint64_t phy_dupx:1;
uint64_t phy_spd:1;
uint64_t phy_link:1;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t niberr:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t lenerr:1;
uint64_t alnerr:1;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t maxerr:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t maxerr:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t alnerr:1;
uint64_t lenerr:1;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t niberr:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t phy_link:1;
uint64_t phy_spd:1;
uint64_t phy_dupx:1;
uint64_t pause_drp:1;
uint64_t reserved_20_63:44;
#endif
} cn58xx;
struct cvmx_gmxx_rxx_int_reg_cn58xx cn58xxp1;
struct cvmx_gmxx_rxx_int_reg_cn61xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_29_63:35;
uint64_t hg2cc:1;
uint64_t hg2fld:1;
uint64_t undat:1;
uint64_t uneop:1;
uint64_t unsop:1;
uint64_t bad_term:1;
uint64_t bad_seq:1;
uint64_t rem_fault:1;
uint64_t loc_fault:1;
uint64_t pause_drp:1;
uint64_t reserved_16_18:3;
uint64_t ifgerr:1;
uint64_t coldet:1;
uint64_t falerr:1;
uint64_t rsverr:1;
uint64_t pcterr:1;
uint64_t ovrerr:1;
uint64_t reserved_9_9:1;
uint64_t skperr:1;
uint64_t rcverr:1;
uint64_t reserved_5_6:2;
uint64_t fcserr:1;
uint64_t jabber:1;
uint64_t reserved_2_2:1;
uint64_t carext:1;
uint64_t minerr:1;
#else
uint64_t minerr:1;
uint64_t carext:1;
uint64_t reserved_2_2:1;
uint64_t jabber:1;
uint64_t fcserr:1;
uint64_t reserved_5_6:2;
uint64_t rcverr:1;
uint64_t skperr:1;
uint64_t reserved_9_9:1;
uint64_t ovrerr:1;
uint64_t pcterr:1;
uint64_t rsverr:1;
uint64_t falerr:1;
uint64_t coldet:1;
uint64_t ifgerr:1;
uint64_t reserved_16_18:3;
uint64_t pause_drp:1;
uint64_t loc_fault:1;
uint64_t rem_fault:1;
uint64_t bad_seq:1;
uint64_t bad_term:1;
uint64_t unsop:1;
uint64_t uneop:1;
uint64_t undat:1;
uint64_t hg2fld:1;
uint64_t hg2cc:1;
uint64_t reserved_29_63:35;
#endif
} cn61xx;
struct cvmx_gmxx_rxx_int_reg_cn61xx cn63xx;
struct cvmx_gmxx_rxx_int_reg_cn61xx cn63xxp1;
struct cvmx_gmxx_rxx_int_reg_cn61xx cn66xx;
struct cvmx_gmxx_rxx_int_reg_cn61xx cn68xx;
struct cvmx_gmxx_rxx_int_reg_cn61xx cn68xxp1;
struct cvmx_gmxx_rxx_int_reg_cn61xx cnf71xx;
};
union cvmx_gmxx_rxx_jabber {
uint64_t u64;
struct cvmx_gmxx_rxx_jabber_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t cnt:16;
#else
uint64_t cnt:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_rxx_jabber_s cn30xx;
struct cvmx_gmxx_rxx_jabber_s cn31xx;
struct cvmx_gmxx_rxx_jabber_s cn38xx;
struct cvmx_gmxx_rxx_jabber_s cn38xxp2;
struct cvmx_gmxx_rxx_jabber_s cn50xx;
struct cvmx_gmxx_rxx_jabber_s cn52xx;
struct cvmx_gmxx_rxx_jabber_s cn52xxp1;
struct cvmx_gmxx_rxx_jabber_s cn56xx;
struct cvmx_gmxx_rxx_jabber_s cn56xxp1;
struct cvmx_gmxx_rxx_jabber_s cn58xx;
struct cvmx_gmxx_rxx_jabber_s cn58xxp1;
struct cvmx_gmxx_rxx_jabber_s cn61xx;
struct cvmx_gmxx_rxx_jabber_s cn63xx;
struct cvmx_gmxx_rxx_jabber_s cn63xxp1;
struct cvmx_gmxx_rxx_jabber_s cn66xx;
struct cvmx_gmxx_rxx_jabber_s cn68xx;
struct cvmx_gmxx_rxx_jabber_s cn68xxp1;
struct cvmx_gmxx_rxx_jabber_s cnf71xx;
};
union cvmx_gmxx_rxx_pause_drop_time {
uint64_t u64;
struct cvmx_gmxx_rxx_pause_drop_time_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t status:16;
#else
uint64_t status:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_rxx_pause_drop_time_s cn50xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn52xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn52xxp1;
struct cvmx_gmxx_rxx_pause_drop_time_s cn56xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn56xxp1;
struct cvmx_gmxx_rxx_pause_drop_time_s cn58xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn58xxp1;
struct cvmx_gmxx_rxx_pause_drop_time_s cn61xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn63xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn63xxp1;
struct cvmx_gmxx_rxx_pause_drop_time_s cn66xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn68xx;
struct cvmx_gmxx_rxx_pause_drop_time_s cn68xxp1;
struct cvmx_gmxx_rxx_pause_drop_time_s cnf71xx;
};
union cvmx_gmxx_rxx_rx_inbnd {
uint64_t u64;
struct cvmx_gmxx_rxx_rx_inbnd_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t duplex:1;
uint64_t speed:2;
uint64_t status:1;
#else
uint64_t status:1;
uint64_t speed:2;
uint64_t duplex:1;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_rxx_rx_inbnd_s cn30xx;
struct cvmx_gmxx_rxx_rx_inbnd_s cn31xx;
struct cvmx_gmxx_rxx_rx_inbnd_s cn38xx;
struct cvmx_gmxx_rxx_rx_inbnd_s cn38xxp2;
struct cvmx_gmxx_rxx_rx_inbnd_s cn50xx;
struct cvmx_gmxx_rxx_rx_inbnd_s cn58xx;
struct cvmx_gmxx_rxx_rx_inbnd_s cn58xxp1;
};
union cvmx_gmxx_rxx_stats_ctl {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t rd_clr:1;
#else
uint64_t rd_clr:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_rxx_stats_ctl_s cn30xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn31xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn38xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_ctl_s cn50xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn52xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_ctl_s cn56xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_ctl_s cn58xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_ctl_s cn61xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn63xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_ctl_s cn66xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn68xx;
struct cvmx_gmxx_rxx_stats_ctl_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_ctl_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_octs {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_octs_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t cnt:48;
#else
uint64_t cnt:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_rxx_stats_octs_s cn30xx;
struct cvmx_gmxx_rxx_stats_octs_s cn31xx;
struct cvmx_gmxx_rxx_stats_octs_s cn38xx;
struct cvmx_gmxx_rxx_stats_octs_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_octs_s cn50xx;
struct cvmx_gmxx_rxx_stats_octs_s cn52xx;
struct cvmx_gmxx_rxx_stats_octs_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_octs_s cn56xx;
struct cvmx_gmxx_rxx_stats_octs_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_octs_s cn58xx;
struct cvmx_gmxx_rxx_stats_octs_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_octs_s cn61xx;
struct cvmx_gmxx_rxx_stats_octs_s cn63xx;
struct cvmx_gmxx_rxx_stats_octs_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_octs_s cn66xx;
struct cvmx_gmxx_rxx_stats_octs_s cn68xx;
struct cvmx_gmxx_rxx_stats_octs_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_octs_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_octs_ctl {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_octs_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t cnt:48;
#else
uint64_t cnt:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn30xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn31xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn38xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn50xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn52xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn56xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn58xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn61xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn63xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn66xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn68xx;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_octs_ctl_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_octs_dmac {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_octs_dmac_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t cnt:48;
#else
uint64_t cnt:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn30xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn31xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn38xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn50xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn52xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn56xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn58xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn61xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn63xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn66xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn68xx;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_octs_dmac_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_octs_drp {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_octs_drp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t cnt:48;
#else
uint64_t cnt:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn30xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn31xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn38xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn50xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn52xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn56xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn58xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn61xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn63xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn66xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn68xx;
struct cvmx_gmxx_rxx_stats_octs_drp_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_octs_drp_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_pkts {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_pkts_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t cnt:32;
#else
uint64_t cnt:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_stats_pkts_s cn30xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn31xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn38xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_pkts_s cn50xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn52xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_pkts_s cn56xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_pkts_s cn58xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_pkts_s cn61xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn63xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_pkts_s cn66xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn68xx;
struct cvmx_gmxx_rxx_stats_pkts_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_pkts_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_pkts_bad {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_pkts_bad_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t cnt:32;
#else
uint64_t cnt:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn30xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn31xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn38xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn50xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn52xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn56xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn58xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn61xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn63xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn66xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn68xx;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_pkts_bad_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_pkts_ctl {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t cnt:32;
#else
uint64_t cnt:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn30xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn31xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn38xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn50xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn52xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn56xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn58xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn61xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn63xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn66xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn68xx;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_pkts_ctl_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_pkts_dmac {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t cnt:32;
#else
uint64_t cnt:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn30xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn31xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn38xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn50xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn52xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn56xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn58xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn61xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn63xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn66xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn68xx;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_pkts_dmac_s cnf71xx;
};
union cvmx_gmxx_rxx_stats_pkts_drp {
uint64_t u64;
struct cvmx_gmxx_rxx_stats_pkts_drp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t cnt:32;
#else
uint64_t cnt:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn30xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn31xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn38xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn38xxp2;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn50xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn52xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn52xxp1;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn56xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn56xxp1;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn58xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn58xxp1;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn61xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn63xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn63xxp1;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn66xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn68xx;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cn68xxp1;
struct cvmx_gmxx_rxx_stats_pkts_drp_s cnf71xx;
};
union cvmx_gmxx_rxx_udd_skp {
uint64_t u64;
struct cvmx_gmxx_rxx_udd_skp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t fcssel:1;
uint64_t reserved_7_7:1;
uint64_t len:7;
#else
uint64_t len:7;
uint64_t reserved_7_7:1;
uint64_t fcssel:1;
uint64_t reserved_9_63:55;
#endif
} s;
struct cvmx_gmxx_rxx_udd_skp_s cn30xx;
struct cvmx_gmxx_rxx_udd_skp_s cn31xx;
struct cvmx_gmxx_rxx_udd_skp_s cn38xx;
struct cvmx_gmxx_rxx_udd_skp_s cn38xxp2;
struct cvmx_gmxx_rxx_udd_skp_s cn50xx;
struct cvmx_gmxx_rxx_udd_skp_s cn52xx;
struct cvmx_gmxx_rxx_udd_skp_s cn52xxp1;
struct cvmx_gmxx_rxx_udd_skp_s cn56xx;
struct cvmx_gmxx_rxx_udd_skp_s cn56xxp1;
struct cvmx_gmxx_rxx_udd_skp_s cn58xx;
struct cvmx_gmxx_rxx_udd_skp_s cn58xxp1;
struct cvmx_gmxx_rxx_udd_skp_s cn61xx;
struct cvmx_gmxx_rxx_udd_skp_s cn63xx;
struct cvmx_gmxx_rxx_udd_skp_s cn63xxp1;
struct cvmx_gmxx_rxx_udd_skp_s cn66xx;
struct cvmx_gmxx_rxx_udd_skp_s cn68xx;
struct cvmx_gmxx_rxx_udd_skp_s cn68xxp1;
struct cvmx_gmxx_rxx_udd_skp_s cnf71xx;
};
union cvmx_gmxx_rx_bp_dropx {
uint64_t u64;
struct cvmx_gmxx_rx_bp_dropx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_6_63:58;
uint64_t mark:6;
#else
uint64_t mark:6;
uint64_t reserved_6_63:58;
#endif
} s;
struct cvmx_gmxx_rx_bp_dropx_s cn30xx;
struct cvmx_gmxx_rx_bp_dropx_s cn31xx;
struct cvmx_gmxx_rx_bp_dropx_s cn38xx;
struct cvmx_gmxx_rx_bp_dropx_s cn38xxp2;
struct cvmx_gmxx_rx_bp_dropx_s cn50xx;
struct cvmx_gmxx_rx_bp_dropx_s cn52xx;
struct cvmx_gmxx_rx_bp_dropx_s cn52xxp1;
struct cvmx_gmxx_rx_bp_dropx_s cn56xx;
struct cvmx_gmxx_rx_bp_dropx_s cn56xxp1;
struct cvmx_gmxx_rx_bp_dropx_s cn58xx;
struct cvmx_gmxx_rx_bp_dropx_s cn58xxp1;
struct cvmx_gmxx_rx_bp_dropx_s cn61xx;
struct cvmx_gmxx_rx_bp_dropx_s cn63xx;
struct cvmx_gmxx_rx_bp_dropx_s cn63xxp1;
struct cvmx_gmxx_rx_bp_dropx_s cn66xx;
struct cvmx_gmxx_rx_bp_dropx_s cn68xx;
struct cvmx_gmxx_rx_bp_dropx_s cn68xxp1;
struct cvmx_gmxx_rx_bp_dropx_s cnf71xx;
};
union cvmx_gmxx_rx_bp_offx {
uint64_t u64;
struct cvmx_gmxx_rx_bp_offx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_6_63:58;
uint64_t mark:6;
#else
uint64_t mark:6;
uint64_t reserved_6_63:58;
#endif
} s;
struct cvmx_gmxx_rx_bp_offx_s cn30xx;
struct cvmx_gmxx_rx_bp_offx_s cn31xx;
struct cvmx_gmxx_rx_bp_offx_s cn38xx;
struct cvmx_gmxx_rx_bp_offx_s cn38xxp2;
struct cvmx_gmxx_rx_bp_offx_s cn50xx;
struct cvmx_gmxx_rx_bp_offx_s cn52xx;
struct cvmx_gmxx_rx_bp_offx_s cn52xxp1;
struct cvmx_gmxx_rx_bp_offx_s cn56xx;
struct cvmx_gmxx_rx_bp_offx_s cn56xxp1;
struct cvmx_gmxx_rx_bp_offx_s cn58xx;
struct cvmx_gmxx_rx_bp_offx_s cn58xxp1;
struct cvmx_gmxx_rx_bp_offx_s cn61xx;
struct cvmx_gmxx_rx_bp_offx_s cn63xx;
struct cvmx_gmxx_rx_bp_offx_s cn63xxp1;
struct cvmx_gmxx_rx_bp_offx_s cn66xx;
struct cvmx_gmxx_rx_bp_offx_s cn68xx;
struct cvmx_gmxx_rx_bp_offx_s cn68xxp1;
struct cvmx_gmxx_rx_bp_offx_s cnf71xx;
};
union cvmx_gmxx_rx_bp_onx {
uint64_t u64;
struct cvmx_gmxx_rx_bp_onx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_11_63:53;
uint64_t mark:11;
#else
uint64_t mark:11;
uint64_t reserved_11_63:53;
#endif
} s;
struct cvmx_gmxx_rx_bp_onx_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t mark:9;
#else
uint64_t mark:9;
uint64_t reserved_9_63:55;
#endif
} cn30xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn31xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn38xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn38xxp2;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn50xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn52xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn52xxp1;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn56xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn56xxp1;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn58xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn58xxp1;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn61xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn63xx;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn63xxp1;
struct cvmx_gmxx_rx_bp_onx_cn30xx cn66xx;
struct cvmx_gmxx_rx_bp_onx_s cn68xx;
struct cvmx_gmxx_rx_bp_onx_s cn68xxp1;
struct cvmx_gmxx_rx_bp_onx_cn30xx cnf71xx;
};
union cvmx_gmxx_rx_hg2_status {
uint64_t u64;
struct cvmx_gmxx_rx_hg2_status_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t phtim2go:16;
uint64_t xof:16;
uint64_t lgtim2go:16;
#else
uint64_t lgtim2go:16;
uint64_t xof:16;
uint64_t phtim2go:16;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_rx_hg2_status_s cn52xx;
struct cvmx_gmxx_rx_hg2_status_s cn52xxp1;
struct cvmx_gmxx_rx_hg2_status_s cn56xx;
struct cvmx_gmxx_rx_hg2_status_s cn61xx;
struct cvmx_gmxx_rx_hg2_status_s cn63xx;
struct cvmx_gmxx_rx_hg2_status_s cn63xxp1;
struct cvmx_gmxx_rx_hg2_status_s cn66xx;
struct cvmx_gmxx_rx_hg2_status_s cn68xx;
struct cvmx_gmxx_rx_hg2_status_s cn68xxp1;
struct cvmx_gmxx_rx_hg2_status_s cnf71xx;
};
union cvmx_gmxx_rx_pass_en {
uint64_t u64;
struct cvmx_gmxx_rx_pass_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t en:16;
#else
uint64_t en:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_rx_pass_en_s cn38xx;
struct cvmx_gmxx_rx_pass_en_s cn38xxp2;
struct cvmx_gmxx_rx_pass_en_s cn58xx;
struct cvmx_gmxx_rx_pass_en_s cn58xxp1;
};
union cvmx_gmxx_rx_pass_mapx {
uint64_t u64;
struct cvmx_gmxx_rx_pass_mapx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t dprt:4;
#else
uint64_t dprt:4;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_rx_pass_mapx_s cn38xx;
struct cvmx_gmxx_rx_pass_mapx_s cn38xxp2;
struct cvmx_gmxx_rx_pass_mapx_s cn58xx;
struct cvmx_gmxx_rx_pass_mapx_s cn58xxp1;
};
union cvmx_gmxx_rx_prt_info {
uint64_t u64;
struct cvmx_gmxx_rx_prt_info_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t drop:16;
uint64_t commit:16;
#else
uint64_t commit:16;
uint64_t drop:16;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_rx_prt_info_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t drop:3;
uint64_t reserved_3_15:13;
uint64_t commit:3;
#else
uint64_t commit:3;
uint64_t reserved_3_15:13;
uint64_t drop:3;
uint64_t reserved_19_63:45;
#endif
} cn30xx;
struct cvmx_gmxx_rx_prt_info_cn30xx cn31xx;
struct cvmx_gmxx_rx_prt_info_s cn38xx;
struct cvmx_gmxx_rx_prt_info_cn30xx cn50xx;
struct cvmx_gmxx_rx_prt_info_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t drop:4;
uint64_t reserved_4_15:12;
uint64_t commit:4;
#else
uint64_t commit:4;
uint64_t reserved_4_15:12;
uint64_t drop:4;
uint64_t reserved_20_63:44;
#endif
} cn52xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn52xxp1;
struct cvmx_gmxx_rx_prt_info_cn52xx cn56xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn56xxp1;
struct cvmx_gmxx_rx_prt_info_s cn58xx;
struct cvmx_gmxx_rx_prt_info_s cn58xxp1;
struct cvmx_gmxx_rx_prt_info_cn52xx cn61xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn63xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn63xxp1;
struct cvmx_gmxx_rx_prt_info_cn52xx cn66xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn68xx;
struct cvmx_gmxx_rx_prt_info_cn52xx cn68xxp1;
struct cvmx_gmxx_rx_prt_info_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_18_63:46;
uint64_t drop:2;
uint64_t reserved_2_15:14;
uint64_t commit:2;
#else
uint64_t commit:2;
uint64_t reserved_2_15:14;
uint64_t drop:2;
uint64_t reserved_18_63:46;
#endif
} cnf71xx;
};
union cvmx_gmxx_rx_prts {
uint64_t u64;
struct cvmx_gmxx_rx_prts_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_3_63:61;
uint64_t prts:3;
#else
uint64_t prts:3;
uint64_t reserved_3_63:61;
#endif
} s;
struct cvmx_gmxx_rx_prts_s cn30xx;
struct cvmx_gmxx_rx_prts_s cn31xx;
struct cvmx_gmxx_rx_prts_s cn38xx;
struct cvmx_gmxx_rx_prts_s cn38xxp2;
struct cvmx_gmxx_rx_prts_s cn50xx;
struct cvmx_gmxx_rx_prts_s cn52xx;
struct cvmx_gmxx_rx_prts_s cn52xxp1;
struct cvmx_gmxx_rx_prts_s cn56xx;
struct cvmx_gmxx_rx_prts_s cn56xxp1;
struct cvmx_gmxx_rx_prts_s cn58xx;
struct cvmx_gmxx_rx_prts_s cn58xxp1;
struct cvmx_gmxx_rx_prts_s cn61xx;
struct cvmx_gmxx_rx_prts_s cn63xx;
struct cvmx_gmxx_rx_prts_s cn63xxp1;
struct cvmx_gmxx_rx_prts_s cn66xx;
struct cvmx_gmxx_rx_prts_s cn68xx;
struct cvmx_gmxx_rx_prts_s cn68xxp1;
struct cvmx_gmxx_rx_prts_s cnf71xx;
};
union cvmx_gmxx_rx_tx_status {
uint64_t u64;
struct cvmx_gmxx_rx_tx_status_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_7_63:57;
uint64_t tx:3;
uint64_t reserved_3_3:1;
uint64_t rx:3;
#else
uint64_t rx:3;
uint64_t reserved_3_3:1;
uint64_t tx:3;
uint64_t reserved_7_63:57;
#endif
} s;
struct cvmx_gmxx_rx_tx_status_s cn30xx;
struct cvmx_gmxx_rx_tx_status_s cn31xx;
struct cvmx_gmxx_rx_tx_status_s cn50xx;
};
union cvmx_gmxx_rx_xaui_bad_col {
uint64_t u64;
struct cvmx_gmxx_rx_xaui_bad_col_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_40_63:24;
uint64_t val:1;
uint64_t state:3;
uint64_t lane_rxc:4;
uint64_t lane_rxd:32;
#else
uint64_t lane_rxd:32;
uint64_t lane_rxc:4;
uint64_t state:3;
uint64_t val:1;
uint64_t reserved_40_63:24;
#endif
} s;
struct cvmx_gmxx_rx_xaui_bad_col_s cn52xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn52xxp1;
struct cvmx_gmxx_rx_xaui_bad_col_s cn56xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn56xxp1;
struct cvmx_gmxx_rx_xaui_bad_col_s cn61xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn63xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn63xxp1;
struct cvmx_gmxx_rx_xaui_bad_col_s cn66xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn68xx;
struct cvmx_gmxx_rx_xaui_bad_col_s cn68xxp1;
struct cvmx_gmxx_rx_xaui_bad_col_s cnf71xx;
};
union cvmx_gmxx_rx_xaui_ctl {
uint64_t u64;
struct cvmx_gmxx_rx_xaui_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t status:2;
#else
uint64_t status:2;
uint64_t reserved_2_63:62;
#endif
} s;
struct cvmx_gmxx_rx_xaui_ctl_s cn52xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn52xxp1;
struct cvmx_gmxx_rx_xaui_ctl_s cn56xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn56xxp1;
struct cvmx_gmxx_rx_xaui_ctl_s cn61xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn63xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn63xxp1;
struct cvmx_gmxx_rx_xaui_ctl_s cn66xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn68xx;
struct cvmx_gmxx_rx_xaui_ctl_s cn68xxp1;
struct cvmx_gmxx_rx_xaui_ctl_s cnf71xx;
};
union cvmx_gmxx_rxaui_ctl {
uint64_t u64;
struct cvmx_gmxx_rxaui_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t disparity:1;
#else
uint64_t disparity:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_rxaui_ctl_s cn68xx;
struct cvmx_gmxx_rxaui_ctl_s cn68xxp1;
};
union cvmx_gmxx_smacx {
uint64_t u64;
struct cvmx_gmxx_smacx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t smac:48;
#else
uint64_t smac:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_smacx_s cn30xx;
struct cvmx_gmxx_smacx_s cn31xx;
struct cvmx_gmxx_smacx_s cn38xx;
struct cvmx_gmxx_smacx_s cn38xxp2;
struct cvmx_gmxx_smacx_s cn50xx;
struct cvmx_gmxx_smacx_s cn52xx;
struct cvmx_gmxx_smacx_s cn52xxp1;
struct cvmx_gmxx_smacx_s cn56xx;
struct cvmx_gmxx_smacx_s cn56xxp1;
struct cvmx_gmxx_smacx_s cn58xx;
struct cvmx_gmxx_smacx_s cn58xxp1;
struct cvmx_gmxx_smacx_s cn61xx;
struct cvmx_gmxx_smacx_s cn63xx;
struct cvmx_gmxx_smacx_s cn63xxp1;
struct cvmx_gmxx_smacx_s cn66xx;
struct cvmx_gmxx_smacx_s cn68xx;
struct cvmx_gmxx_smacx_s cn68xxp1;
struct cvmx_gmxx_smacx_s cnf71xx;
};
union cvmx_gmxx_soft_bist {
uint64_t u64;
struct cvmx_gmxx_soft_bist_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t start_bist:1;
uint64_t clear_bist:1;
#else
uint64_t clear_bist:1;
uint64_t start_bist:1;
uint64_t reserved_2_63:62;
#endif
} s;
struct cvmx_gmxx_soft_bist_s cn63xx;
struct cvmx_gmxx_soft_bist_s cn63xxp1;
struct cvmx_gmxx_soft_bist_s cn66xx;
struct cvmx_gmxx_soft_bist_s cn68xx;
struct cvmx_gmxx_soft_bist_s cn68xxp1;
};
union cvmx_gmxx_stat_bp {
uint64_t u64;
struct cvmx_gmxx_stat_bp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_17_63:47;
uint64_t bp:1;
uint64_t cnt:16;
#else
uint64_t cnt:16;
uint64_t bp:1;
uint64_t reserved_17_63:47;
#endif
} s;
struct cvmx_gmxx_stat_bp_s cn30xx;
struct cvmx_gmxx_stat_bp_s cn31xx;
struct cvmx_gmxx_stat_bp_s cn38xx;
struct cvmx_gmxx_stat_bp_s cn38xxp2;
struct cvmx_gmxx_stat_bp_s cn50xx;
struct cvmx_gmxx_stat_bp_s cn52xx;
struct cvmx_gmxx_stat_bp_s cn52xxp1;
struct cvmx_gmxx_stat_bp_s cn56xx;
struct cvmx_gmxx_stat_bp_s cn56xxp1;
struct cvmx_gmxx_stat_bp_s cn58xx;
struct cvmx_gmxx_stat_bp_s cn58xxp1;
struct cvmx_gmxx_stat_bp_s cn61xx;
struct cvmx_gmxx_stat_bp_s cn63xx;
struct cvmx_gmxx_stat_bp_s cn63xxp1;
struct cvmx_gmxx_stat_bp_s cn66xx;
struct cvmx_gmxx_stat_bp_s cn68xx;
struct cvmx_gmxx_stat_bp_s cn68xxp1;
struct cvmx_gmxx_stat_bp_s cnf71xx;
};
union cvmx_gmxx_tb_reg {
uint64_t u64;
struct cvmx_gmxx_tb_reg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t wr_magic:1;
#else
uint64_t wr_magic:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_tb_reg_s cn61xx;
struct cvmx_gmxx_tb_reg_s cn66xx;
struct cvmx_gmxx_tb_reg_s cn68xx;
struct cvmx_gmxx_tb_reg_s cnf71xx;
};
union cvmx_gmxx_txx_append {
uint64_t u64;
struct cvmx_gmxx_txx_append_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t force_fcs:1;
uint64_t fcs:1;
uint64_t pad:1;
uint64_t preamble:1;
#else
uint64_t preamble:1;
uint64_t pad:1;
uint64_t fcs:1;
uint64_t force_fcs:1;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_txx_append_s cn30xx;
struct cvmx_gmxx_txx_append_s cn31xx;
struct cvmx_gmxx_txx_append_s cn38xx;
struct cvmx_gmxx_txx_append_s cn38xxp2;
struct cvmx_gmxx_txx_append_s cn50xx;
struct cvmx_gmxx_txx_append_s cn52xx;
struct cvmx_gmxx_txx_append_s cn52xxp1;
struct cvmx_gmxx_txx_append_s cn56xx;
struct cvmx_gmxx_txx_append_s cn56xxp1;
struct cvmx_gmxx_txx_append_s cn58xx;
struct cvmx_gmxx_txx_append_s cn58xxp1;
struct cvmx_gmxx_txx_append_s cn61xx;
struct cvmx_gmxx_txx_append_s cn63xx;
struct cvmx_gmxx_txx_append_s cn63xxp1;
struct cvmx_gmxx_txx_append_s cn66xx;
struct cvmx_gmxx_txx_append_s cn68xx;
struct cvmx_gmxx_txx_append_s cn68xxp1;
struct cvmx_gmxx_txx_append_s cnf71xx;
};
union cvmx_gmxx_txx_burst {
uint64_t u64;
struct cvmx_gmxx_txx_burst_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t burst:16;
#else
uint64_t burst:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_burst_s cn30xx;
struct cvmx_gmxx_txx_burst_s cn31xx;
struct cvmx_gmxx_txx_burst_s cn38xx;
struct cvmx_gmxx_txx_burst_s cn38xxp2;
struct cvmx_gmxx_txx_burst_s cn50xx;
struct cvmx_gmxx_txx_burst_s cn52xx;
struct cvmx_gmxx_txx_burst_s cn52xxp1;
struct cvmx_gmxx_txx_burst_s cn56xx;
struct cvmx_gmxx_txx_burst_s cn56xxp1;
struct cvmx_gmxx_txx_burst_s cn58xx;
struct cvmx_gmxx_txx_burst_s cn58xxp1;
struct cvmx_gmxx_txx_burst_s cn61xx;
struct cvmx_gmxx_txx_burst_s cn63xx;
struct cvmx_gmxx_txx_burst_s cn63xxp1;
struct cvmx_gmxx_txx_burst_s cn66xx;
struct cvmx_gmxx_txx_burst_s cn68xx;
struct cvmx_gmxx_txx_burst_s cn68xxp1;
struct cvmx_gmxx_txx_burst_s cnf71xx;
};
union cvmx_gmxx_txx_cbfc_xoff {
uint64_t u64;
struct cvmx_gmxx_txx_cbfc_xoff_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t xoff:16;
#else
uint64_t xoff:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_cbfc_xoff_s cn52xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn56xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn61xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn63xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn63xxp1;
struct cvmx_gmxx_txx_cbfc_xoff_s cn66xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn68xx;
struct cvmx_gmxx_txx_cbfc_xoff_s cn68xxp1;
struct cvmx_gmxx_txx_cbfc_xoff_s cnf71xx;
};
union cvmx_gmxx_txx_cbfc_xon {
uint64_t u64;
struct cvmx_gmxx_txx_cbfc_xon_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t xon:16;
#else
uint64_t xon:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_cbfc_xon_s cn52xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn56xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn61xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn63xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn63xxp1;
struct cvmx_gmxx_txx_cbfc_xon_s cn66xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn68xx;
struct cvmx_gmxx_txx_cbfc_xon_s cn68xxp1;
struct cvmx_gmxx_txx_cbfc_xon_s cnf71xx;
};
union cvmx_gmxx_txx_clk {
uint64_t u64;
struct cvmx_gmxx_txx_clk_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_6_63:58;
uint64_t clk_cnt:6;
#else
uint64_t clk_cnt:6;
uint64_t reserved_6_63:58;
#endif
} s;
struct cvmx_gmxx_txx_clk_s cn30xx;
struct cvmx_gmxx_txx_clk_s cn31xx;
struct cvmx_gmxx_txx_clk_s cn38xx;
struct cvmx_gmxx_txx_clk_s cn38xxp2;
struct cvmx_gmxx_txx_clk_s cn50xx;
struct cvmx_gmxx_txx_clk_s cn58xx;
struct cvmx_gmxx_txx_clk_s cn58xxp1;
};
union cvmx_gmxx_txx_ctl {
uint64_t u64;
struct cvmx_gmxx_txx_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t xsdef_en:1;
uint64_t xscol_en:1;
#else
uint64_t xscol_en:1;
uint64_t xsdef_en:1;
uint64_t reserved_2_63:62;
#endif
} s;
struct cvmx_gmxx_txx_ctl_s cn30xx;
struct cvmx_gmxx_txx_ctl_s cn31xx;
struct cvmx_gmxx_txx_ctl_s cn38xx;
struct cvmx_gmxx_txx_ctl_s cn38xxp2;
struct cvmx_gmxx_txx_ctl_s cn50xx;
struct cvmx_gmxx_txx_ctl_s cn52xx;
struct cvmx_gmxx_txx_ctl_s cn52xxp1;
struct cvmx_gmxx_txx_ctl_s cn56xx;
struct cvmx_gmxx_txx_ctl_s cn56xxp1;
struct cvmx_gmxx_txx_ctl_s cn58xx;
struct cvmx_gmxx_txx_ctl_s cn58xxp1;
struct cvmx_gmxx_txx_ctl_s cn61xx;
struct cvmx_gmxx_txx_ctl_s cn63xx;
struct cvmx_gmxx_txx_ctl_s cn63xxp1;
struct cvmx_gmxx_txx_ctl_s cn66xx;
struct cvmx_gmxx_txx_ctl_s cn68xx;
struct cvmx_gmxx_txx_ctl_s cn68xxp1;
struct cvmx_gmxx_txx_ctl_s cnf71xx;
};
union cvmx_gmxx_txx_min_pkt {
uint64_t u64;
struct cvmx_gmxx_txx_min_pkt_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_8_63:56;
uint64_t min_size:8;
#else
uint64_t min_size:8;
uint64_t reserved_8_63:56;
#endif
} s;
struct cvmx_gmxx_txx_min_pkt_s cn30xx;
struct cvmx_gmxx_txx_min_pkt_s cn31xx;
struct cvmx_gmxx_txx_min_pkt_s cn38xx;
struct cvmx_gmxx_txx_min_pkt_s cn38xxp2;
struct cvmx_gmxx_txx_min_pkt_s cn50xx;
struct cvmx_gmxx_txx_min_pkt_s cn52xx;
struct cvmx_gmxx_txx_min_pkt_s cn52xxp1;
struct cvmx_gmxx_txx_min_pkt_s cn56xx;
struct cvmx_gmxx_txx_min_pkt_s cn56xxp1;
struct cvmx_gmxx_txx_min_pkt_s cn58xx;
struct cvmx_gmxx_txx_min_pkt_s cn58xxp1;
struct cvmx_gmxx_txx_min_pkt_s cn61xx;
struct cvmx_gmxx_txx_min_pkt_s cn63xx;
struct cvmx_gmxx_txx_min_pkt_s cn63xxp1;
struct cvmx_gmxx_txx_min_pkt_s cn66xx;
struct cvmx_gmxx_txx_min_pkt_s cn68xx;
struct cvmx_gmxx_txx_min_pkt_s cn68xxp1;
struct cvmx_gmxx_txx_min_pkt_s cnf71xx;
};
union cvmx_gmxx_txx_pause_pkt_interval {
uint64_t u64;
struct cvmx_gmxx_txx_pause_pkt_interval_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t interval:16;
#else
uint64_t interval:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn30xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn31xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn38xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn38xxp2;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn50xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn52xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn52xxp1;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn56xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn56xxp1;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn58xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn58xxp1;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn61xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn63xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn63xxp1;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn66xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn68xx;
struct cvmx_gmxx_txx_pause_pkt_interval_s cn68xxp1;
struct cvmx_gmxx_txx_pause_pkt_interval_s cnf71xx;
};
union cvmx_gmxx_txx_pause_pkt_time {
uint64_t u64;
struct cvmx_gmxx_txx_pause_pkt_time_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t time:16;
#else
uint64_t time:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_pause_pkt_time_s cn30xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn31xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn38xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn38xxp2;
struct cvmx_gmxx_txx_pause_pkt_time_s cn50xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn52xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn52xxp1;
struct cvmx_gmxx_txx_pause_pkt_time_s cn56xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn56xxp1;
struct cvmx_gmxx_txx_pause_pkt_time_s cn58xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn58xxp1;
struct cvmx_gmxx_txx_pause_pkt_time_s cn61xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn63xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn63xxp1;
struct cvmx_gmxx_txx_pause_pkt_time_s cn66xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn68xx;
struct cvmx_gmxx_txx_pause_pkt_time_s cn68xxp1;
struct cvmx_gmxx_txx_pause_pkt_time_s cnf71xx;
};
union cvmx_gmxx_txx_pause_togo {
uint64_t u64;
struct cvmx_gmxx_txx_pause_togo_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t msg_time:16;
uint64_t time:16;
#else
uint64_t time:16;
uint64_t msg_time:16;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_txx_pause_togo_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t time:16;
#else
uint64_t time:16;
uint64_t reserved_16_63:48;
#endif
} cn30xx;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn31xx;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn38xx;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn38xxp2;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn50xx;
struct cvmx_gmxx_txx_pause_togo_s cn52xx;
struct cvmx_gmxx_txx_pause_togo_s cn52xxp1;
struct cvmx_gmxx_txx_pause_togo_s cn56xx;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn56xxp1;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn58xx;
struct cvmx_gmxx_txx_pause_togo_cn30xx cn58xxp1;
struct cvmx_gmxx_txx_pause_togo_s cn61xx;
struct cvmx_gmxx_txx_pause_togo_s cn63xx;
struct cvmx_gmxx_txx_pause_togo_s cn63xxp1;
struct cvmx_gmxx_txx_pause_togo_s cn66xx;
struct cvmx_gmxx_txx_pause_togo_s cn68xx;
struct cvmx_gmxx_txx_pause_togo_s cn68xxp1;
struct cvmx_gmxx_txx_pause_togo_s cnf71xx;
};
union cvmx_gmxx_txx_pause_zero {
uint64_t u64;
struct cvmx_gmxx_txx_pause_zero_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t send:1;
#else
uint64_t send:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_txx_pause_zero_s cn30xx;
struct cvmx_gmxx_txx_pause_zero_s cn31xx;
struct cvmx_gmxx_txx_pause_zero_s cn38xx;
struct cvmx_gmxx_txx_pause_zero_s cn38xxp2;
struct cvmx_gmxx_txx_pause_zero_s cn50xx;
struct cvmx_gmxx_txx_pause_zero_s cn52xx;
struct cvmx_gmxx_txx_pause_zero_s cn52xxp1;
struct cvmx_gmxx_txx_pause_zero_s cn56xx;
struct cvmx_gmxx_txx_pause_zero_s cn56xxp1;
struct cvmx_gmxx_txx_pause_zero_s cn58xx;
struct cvmx_gmxx_txx_pause_zero_s cn58xxp1;
struct cvmx_gmxx_txx_pause_zero_s cn61xx;
struct cvmx_gmxx_txx_pause_zero_s cn63xx;
struct cvmx_gmxx_txx_pause_zero_s cn63xxp1;
struct cvmx_gmxx_txx_pause_zero_s cn66xx;
struct cvmx_gmxx_txx_pause_zero_s cn68xx;
struct cvmx_gmxx_txx_pause_zero_s cn68xxp1;
struct cvmx_gmxx_txx_pause_zero_s cnf71xx;
};
union cvmx_gmxx_txx_pipe {
uint64_t u64;
struct cvmx_gmxx_txx_pipe_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_33_63:31;
uint64_t ign_bp:1;
uint64_t reserved_21_31:11;
uint64_t nump:5;
uint64_t reserved_7_15:9;
uint64_t base:7;
#else
uint64_t base:7;
uint64_t reserved_7_15:9;
uint64_t nump:5;
uint64_t reserved_21_31:11;
uint64_t ign_bp:1;
uint64_t reserved_33_63:31;
#endif
} s;
struct cvmx_gmxx_txx_pipe_s cn68xx;
struct cvmx_gmxx_txx_pipe_s cn68xxp1;
};
union cvmx_gmxx_txx_sgmii_ctl {
uint64_t u64;
struct cvmx_gmxx_txx_sgmii_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t align:1;
#else
uint64_t align:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_txx_sgmii_ctl_s cn52xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn52xxp1;
struct cvmx_gmxx_txx_sgmii_ctl_s cn56xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn56xxp1;
struct cvmx_gmxx_txx_sgmii_ctl_s cn61xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn63xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn63xxp1;
struct cvmx_gmxx_txx_sgmii_ctl_s cn66xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn68xx;
struct cvmx_gmxx_txx_sgmii_ctl_s cn68xxp1;
struct cvmx_gmxx_txx_sgmii_ctl_s cnf71xx;
};
union cvmx_gmxx_txx_slot {
uint64_t u64;
struct cvmx_gmxx_txx_slot_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t slot:10;
#else
uint64_t slot:10;
uint64_t reserved_10_63:54;
#endif
} s;
struct cvmx_gmxx_txx_slot_s cn30xx;
struct cvmx_gmxx_txx_slot_s cn31xx;
struct cvmx_gmxx_txx_slot_s cn38xx;
struct cvmx_gmxx_txx_slot_s cn38xxp2;
struct cvmx_gmxx_txx_slot_s cn50xx;
struct cvmx_gmxx_txx_slot_s cn52xx;
struct cvmx_gmxx_txx_slot_s cn52xxp1;
struct cvmx_gmxx_txx_slot_s cn56xx;
struct cvmx_gmxx_txx_slot_s cn56xxp1;
struct cvmx_gmxx_txx_slot_s cn58xx;
struct cvmx_gmxx_txx_slot_s cn58xxp1;
struct cvmx_gmxx_txx_slot_s cn61xx;
struct cvmx_gmxx_txx_slot_s cn63xx;
struct cvmx_gmxx_txx_slot_s cn63xxp1;
struct cvmx_gmxx_txx_slot_s cn66xx;
struct cvmx_gmxx_txx_slot_s cn68xx;
struct cvmx_gmxx_txx_slot_s cn68xxp1;
struct cvmx_gmxx_txx_slot_s cnf71xx;
};
union cvmx_gmxx_txx_soft_pause {
uint64_t u64;
struct cvmx_gmxx_txx_soft_pause_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t time:16;
#else
uint64_t time:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_txx_soft_pause_s cn30xx;
struct cvmx_gmxx_txx_soft_pause_s cn31xx;
struct cvmx_gmxx_txx_soft_pause_s cn38xx;
struct cvmx_gmxx_txx_soft_pause_s cn38xxp2;
struct cvmx_gmxx_txx_soft_pause_s cn50xx;
struct cvmx_gmxx_txx_soft_pause_s cn52xx;
struct cvmx_gmxx_txx_soft_pause_s cn52xxp1;
struct cvmx_gmxx_txx_soft_pause_s cn56xx;
struct cvmx_gmxx_txx_soft_pause_s cn56xxp1;
struct cvmx_gmxx_txx_soft_pause_s cn58xx;
struct cvmx_gmxx_txx_soft_pause_s cn58xxp1;
struct cvmx_gmxx_txx_soft_pause_s cn61xx;
struct cvmx_gmxx_txx_soft_pause_s cn63xx;
struct cvmx_gmxx_txx_soft_pause_s cn63xxp1;
struct cvmx_gmxx_txx_soft_pause_s cn66xx;
struct cvmx_gmxx_txx_soft_pause_s cn68xx;
struct cvmx_gmxx_txx_soft_pause_s cn68xxp1;
struct cvmx_gmxx_txx_soft_pause_s cnf71xx;
};
union cvmx_gmxx_txx_stat0 {
uint64_t u64;
struct cvmx_gmxx_txx_stat0_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t xsdef:32;
uint64_t xscol:32;
#else
uint64_t xscol:32;
uint64_t xsdef:32;
#endif
} s;
struct cvmx_gmxx_txx_stat0_s cn30xx;
struct cvmx_gmxx_txx_stat0_s cn31xx;
struct cvmx_gmxx_txx_stat0_s cn38xx;
struct cvmx_gmxx_txx_stat0_s cn38xxp2;
struct cvmx_gmxx_txx_stat0_s cn50xx;
struct cvmx_gmxx_txx_stat0_s cn52xx;
struct cvmx_gmxx_txx_stat0_s cn52xxp1;
struct cvmx_gmxx_txx_stat0_s cn56xx;
struct cvmx_gmxx_txx_stat0_s cn56xxp1;
struct cvmx_gmxx_txx_stat0_s cn58xx;
struct cvmx_gmxx_txx_stat0_s cn58xxp1;
struct cvmx_gmxx_txx_stat0_s cn61xx;
struct cvmx_gmxx_txx_stat0_s cn63xx;
struct cvmx_gmxx_txx_stat0_s cn63xxp1;
struct cvmx_gmxx_txx_stat0_s cn66xx;
struct cvmx_gmxx_txx_stat0_s cn68xx;
struct cvmx_gmxx_txx_stat0_s cn68xxp1;
struct cvmx_gmxx_txx_stat0_s cnf71xx;
};
union cvmx_gmxx_txx_stat1 {
uint64_t u64;
struct cvmx_gmxx_txx_stat1_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t scol:32;
uint64_t mcol:32;
#else
uint64_t mcol:32;
uint64_t scol:32;
#endif
} s;
struct cvmx_gmxx_txx_stat1_s cn30xx;
struct cvmx_gmxx_txx_stat1_s cn31xx;
struct cvmx_gmxx_txx_stat1_s cn38xx;
struct cvmx_gmxx_txx_stat1_s cn38xxp2;
struct cvmx_gmxx_txx_stat1_s cn50xx;
struct cvmx_gmxx_txx_stat1_s cn52xx;
struct cvmx_gmxx_txx_stat1_s cn52xxp1;
struct cvmx_gmxx_txx_stat1_s cn56xx;
struct cvmx_gmxx_txx_stat1_s cn56xxp1;
struct cvmx_gmxx_txx_stat1_s cn58xx;
struct cvmx_gmxx_txx_stat1_s cn58xxp1;
struct cvmx_gmxx_txx_stat1_s cn61xx;
struct cvmx_gmxx_txx_stat1_s cn63xx;
struct cvmx_gmxx_txx_stat1_s cn63xxp1;
struct cvmx_gmxx_txx_stat1_s cn66xx;
struct cvmx_gmxx_txx_stat1_s cn68xx;
struct cvmx_gmxx_txx_stat1_s cn68xxp1;
struct cvmx_gmxx_txx_stat1_s cnf71xx;
};
union cvmx_gmxx_txx_stat2 {
uint64_t u64;
struct cvmx_gmxx_txx_stat2_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t octs:48;
#else
uint64_t octs:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_txx_stat2_s cn30xx;
struct cvmx_gmxx_txx_stat2_s cn31xx;
struct cvmx_gmxx_txx_stat2_s cn38xx;
struct cvmx_gmxx_txx_stat2_s cn38xxp2;
struct cvmx_gmxx_txx_stat2_s cn50xx;
struct cvmx_gmxx_txx_stat2_s cn52xx;
struct cvmx_gmxx_txx_stat2_s cn52xxp1;
struct cvmx_gmxx_txx_stat2_s cn56xx;
struct cvmx_gmxx_txx_stat2_s cn56xxp1;
struct cvmx_gmxx_txx_stat2_s cn58xx;
struct cvmx_gmxx_txx_stat2_s cn58xxp1;
struct cvmx_gmxx_txx_stat2_s cn61xx;
struct cvmx_gmxx_txx_stat2_s cn63xx;
struct cvmx_gmxx_txx_stat2_s cn63xxp1;
struct cvmx_gmxx_txx_stat2_s cn66xx;
struct cvmx_gmxx_txx_stat2_s cn68xx;
struct cvmx_gmxx_txx_stat2_s cn68xxp1;
struct cvmx_gmxx_txx_stat2_s cnf71xx;
};
union cvmx_gmxx_txx_stat3 {
uint64_t u64;
struct cvmx_gmxx_txx_stat3_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_32_63:32;
uint64_t pkts:32;
#else
uint64_t pkts:32;
uint64_t reserved_32_63:32;
#endif
} s;
struct cvmx_gmxx_txx_stat3_s cn30xx;
struct cvmx_gmxx_txx_stat3_s cn31xx;
struct cvmx_gmxx_txx_stat3_s cn38xx;
struct cvmx_gmxx_txx_stat3_s cn38xxp2;
struct cvmx_gmxx_txx_stat3_s cn50xx;
struct cvmx_gmxx_txx_stat3_s cn52xx;
struct cvmx_gmxx_txx_stat3_s cn52xxp1;
struct cvmx_gmxx_txx_stat3_s cn56xx;
struct cvmx_gmxx_txx_stat3_s cn56xxp1;
struct cvmx_gmxx_txx_stat3_s cn58xx;
struct cvmx_gmxx_txx_stat3_s cn58xxp1;
struct cvmx_gmxx_txx_stat3_s cn61xx;
struct cvmx_gmxx_txx_stat3_s cn63xx;
struct cvmx_gmxx_txx_stat3_s cn63xxp1;
struct cvmx_gmxx_txx_stat3_s cn66xx;
struct cvmx_gmxx_txx_stat3_s cn68xx;
struct cvmx_gmxx_txx_stat3_s cn68xxp1;
struct cvmx_gmxx_txx_stat3_s cnf71xx;
};
union cvmx_gmxx_txx_stat4 {
uint64_t u64;
struct cvmx_gmxx_txx_stat4_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t hist1:32;
uint64_t hist0:32;
#else
uint64_t hist0:32;
uint64_t hist1:32;
#endif
} s;
struct cvmx_gmxx_txx_stat4_s cn30xx;
struct cvmx_gmxx_txx_stat4_s cn31xx;
struct cvmx_gmxx_txx_stat4_s cn38xx;
struct cvmx_gmxx_txx_stat4_s cn38xxp2;
struct cvmx_gmxx_txx_stat4_s cn50xx;
struct cvmx_gmxx_txx_stat4_s cn52xx;
struct cvmx_gmxx_txx_stat4_s cn52xxp1;
struct cvmx_gmxx_txx_stat4_s cn56xx;
struct cvmx_gmxx_txx_stat4_s cn56xxp1;
struct cvmx_gmxx_txx_stat4_s cn58xx;
struct cvmx_gmxx_txx_stat4_s cn58xxp1;
struct cvmx_gmxx_txx_stat4_s cn61xx;
struct cvmx_gmxx_txx_stat4_s cn63xx;
struct cvmx_gmxx_txx_stat4_s cn63xxp1;
struct cvmx_gmxx_txx_stat4_s cn66xx;
struct cvmx_gmxx_txx_stat4_s cn68xx;
struct cvmx_gmxx_txx_stat4_s cn68xxp1;
struct cvmx_gmxx_txx_stat4_s cnf71xx;
};
union cvmx_gmxx_txx_stat5 {
uint64_t u64;
struct cvmx_gmxx_txx_stat5_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t hist3:32;
uint64_t hist2:32;
#else
uint64_t hist2:32;
uint64_t hist3:32;
#endif
} s;
struct cvmx_gmxx_txx_stat5_s cn30xx;
struct cvmx_gmxx_txx_stat5_s cn31xx;
struct cvmx_gmxx_txx_stat5_s cn38xx;
struct cvmx_gmxx_txx_stat5_s cn38xxp2;
struct cvmx_gmxx_txx_stat5_s cn50xx;
struct cvmx_gmxx_txx_stat5_s cn52xx;
struct cvmx_gmxx_txx_stat5_s cn52xxp1;
struct cvmx_gmxx_txx_stat5_s cn56xx;
struct cvmx_gmxx_txx_stat5_s cn56xxp1;
struct cvmx_gmxx_txx_stat5_s cn58xx;
struct cvmx_gmxx_txx_stat5_s cn58xxp1;
struct cvmx_gmxx_txx_stat5_s cn61xx;
struct cvmx_gmxx_txx_stat5_s cn63xx;
struct cvmx_gmxx_txx_stat5_s cn63xxp1;
struct cvmx_gmxx_txx_stat5_s cn66xx;
struct cvmx_gmxx_txx_stat5_s cn68xx;
struct cvmx_gmxx_txx_stat5_s cn68xxp1;
struct cvmx_gmxx_txx_stat5_s cnf71xx;
};
union cvmx_gmxx_txx_stat6 {
uint64_t u64;
struct cvmx_gmxx_txx_stat6_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t hist5:32;
uint64_t hist4:32;
#else
uint64_t hist4:32;
uint64_t hist5:32;
#endif
} s;
struct cvmx_gmxx_txx_stat6_s cn30xx;
struct cvmx_gmxx_txx_stat6_s cn31xx;
struct cvmx_gmxx_txx_stat6_s cn38xx;
struct cvmx_gmxx_txx_stat6_s cn38xxp2;
struct cvmx_gmxx_txx_stat6_s cn50xx;
struct cvmx_gmxx_txx_stat6_s cn52xx;
struct cvmx_gmxx_txx_stat6_s cn52xxp1;
struct cvmx_gmxx_txx_stat6_s cn56xx;
struct cvmx_gmxx_txx_stat6_s cn56xxp1;
struct cvmx_gmxx_txx_stat6_s cn58xx;
struct cvmx_gmxx_txx_stat6_s cn58xxp1;
struct cvmx_gmxx_txx_stat6_s cn61xx;
struct cvmx_gmxx_txx_stat6_s cn63xx;
struct cvmx_gmxx_txx_stat6_s cn63xxp1;
struct cvmx_gmxx_txx_stat6_s cn66xx;
struct cvmx_gmxx_txx_stat6_s cn68xx;
struct cvmx_gmxx_txx_stat6_s cn68xxp1;
struct cvmx_gmxx_txx_stat6_s cnf71xx;
};
union cvmx_gmxx_txx_stat7 {
uint64_t u64;
struct cvmx_gmxx_txx_stat7_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t hist7:32;
uint64_t hist6:32;
#else
uint64_t hist6:32;
uint64_t hist7:32;
#endif
} s;
struct cvmx_gmxx_txx_stat7_s cn30xx;
struct cvmx_gmxx_txx_stat7_s cn31xx;
struct cvmx_gmxx_txx_stat7_s cn38xx;
struct cvmx_gmxx_txx_stat7_s cn38xxp2;
struct cvmx_gmxx_txx_stat7_s cn50xx;
struct cvmx_gmxx_txx_stat7_s cn52xx;
struct cvmx_gmxx_txx_stat7_s cn52xxp1;
struct cvmx_gmxx_txx_stat7_s cn56xx;
struct cvmx_gmxx_txx_stat7_s cn56xxp1;
struct cvmx_gmxx_txx_stat7_s cn58xx;
struct cvmx_gmxx_txx_stat7_s cn58xxp1;
struct cvmx_gmxx_txx_stat7_s cn61xx;
struct cvmx_gmxx_txx_stat7_s cn63xx;
struct cvmx_gmxx_txx_stat7_s cn63xxp1;
struct cvmx_gmxx_txx_stat7_s cn66xx;
struct cvmx_gmxx_txx_stat7_s cn68xx;
struct cvmx_gmxx_txx_stat7_s cn68xxp1;
struct cvmx_gmxx_txx_stat7_s cnf71xx;
};
union cvmx_gmxx_txx_stat8 {
uint64_t u64;
struct cvmx_gmxx_txx_stat8_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t mcst:32;
uint64_t bcst:32;
#else
uint64_t bcst:32;
uint64_t mcst:32;
#endif
} s;
struct cvmx_gmxx_txx_stat8_s cn30xx;
struct cvmx_gmxx_txx_stat8_s cn31xx;
struct cvmx_gmxx_txx_stat8_s cn38xx;
struct cvmx_gmxx_txx_stat8_s cn38xxp2;
struct cvmx_gmxx_txx_stat8_s cn50xx;
struct cvmx_gmxx_txx_stat8_s cn52xx;
struct cvmx_gmxx_txx_stat8_s cn52xxp1;
struct cvmx_gmxx_txx_stat8_s cn56xx;
struct cvmx_gmxx_txx_stat8_s cn56xxp1;
struct cvmx_gmxx_txx_stat8_s cn58xx;
struct cvmx_gmxx_txx_stat8_s cn58xxp1;
struct cvmx_gmxx_txx_stat8_s cn61xx;
struct cvmx_gmxx_txx_stat8_s cn63xx;
struct cvmx_gmxx_txx_stat8_s cn63xxp1;
struct cvmx_gmxx_txx_stat8_s cn66xx;
struct cvmx_gmxx_txx_stat8_s cn68xx;
struct cvmx_gmxx_txx_stat8_s cn68xxp1;
struct cvmx_gmxx_txx_stat8_s cnf71xx;
};
union cvmx_gmxx_txx_stat9 {
uint64_t u64;
struct cvmx_gmxx_txx_stat9_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t undflw:32;
uint64_t ctl:32;
#else
uint64_t ctl:32;
uint64_t undflw:32;
#endif
} s;
struct cvmx_gmxx_txx_stat9_s cn30xx;
struct cvmx_gmxx_txx_stat9_s cn31xx;
struct cvmx_gmxx_txx_stat9_s cn38xx;
struct cvmx_gmxx_txx_stat9_s cn38xxp2;
struct cvmx_gmxx_txx_stat9_s cn50xx;
struct cvmx_gmxx_txx_stat9_s cn52xx;
struct cvmx_gmxx_txx_stat9_s cn52xxp1;
struct cvmx_gmxx_txx_stat9_s cn56xx;
struct cvmx_gmxx_txx_stat9_s cn56xxp1;
struct cvmx_gmxx_txx_stat9_s cn58xx;
struct cvmx_gmxx_txx_stat9_s cn58xxp1;
struct cvmx_gmxx_txx_stat9_s cn61xx;
struct cvmx_gmxx_txx_stat9_s cn63xx;
struct cvmx_gmxx_txx_stat9_s cn63xxp1;
struct cvmx_gmxx_txx_stat9_s cn66xx;
struct cvmx_gmxx_txx_stat9_s cn68xx;
struct cvmx_gmxx_txx_stat9_s cn68xxp1;
struct cvmx_gmxx_txx_stat9_s cnf71xx;
};
union cvmx_gmxx_txx_stats_ctl {
uint64_t u64;
struct cvmx_gmxx_txx_stats_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t rd_clr:1;
#else
uint64_t rd_clr:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_txx_stats_ctl_s cn30xx;
struct cvmx_gmxx_txx_stats_ctl_s cn31xx;
struct cvmx_gmxx_txx_stats_ctl_s cn38xx;
struct cvmx_gmxx_txx_stats_ctl_s cn38xxp2;
struct cvmx_gmxx_txx_stats_ctl_s cn50xx;
struct cvmx_gmxx_txx_stats_ctl_s cn52xx;
struct cvmx_gmxx_txx_stats_ctl_s cn52xxp1;
struct cvmx_gmxx_txx_stats_ctl_s cn56xx;
struct cvmx_gmxx_txx_stats_ctl_s cn56xxp1;
struct cvmx_gmxx_txx_stats_ctl_s cn58xx;
struct cvmx_gmxx_txx_stats_ctl_s cn58xxp1;
struct cvmx_gmxx_txx_stats_ctl_s cn61xx;
struct cvmx_gmxx_txx_stats_ctl_s cn63xx;
struct cvmx_gmxx_txx_stats_ctl_s cn63xxp1;
struct cvmx_gmxx_txx_stats_ctl_s cn66xx;
struct cvmx_gmxx_txx_stats_ctl_s cn68xx;
struct cvmx_gmxx_txx_stats_ctl_s cn68xxp1;
struct cvmx_gmxx_txx_stats_ctl_s cnf71xx;
};
union cvmx_gmxx_txx_thresh {
uint64_t u64;
struct cvmx_gmxx_txx_thresh_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_10_63:54;
uint64_t cnt:10;
#else
uint64_t cnt:10;
uint64_t reserved_10_63:54;
#endif
} s;
struct cvmx_gmxx_txx_thresh_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_7_63:57;
uint64_t cnt:7;
#else
uint64_t cnt:7;
uint64_t reserved_7_63:57;
#endif
} cn30xx;
struct cvmx_gmxx_txx_thresh_cn30xx cn31xx;
struct cvmx_gmxx_txx_thresh_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_9_63:55;
uint64_t cnt:9;
#else
uint64_t cnt:9;
uint64_t reserved_9_63:55;
#endif
} cn38xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn38xxp2;
struct cvmx_gmxx_txx_thresh_cn30xx cn50xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn52xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn52xxp1;
struct cvmx_gmxx_txx_thresh_cn38xx cn56xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn56xxp1;
struct cvmx_gmxx_txx_thresh_cn38xx cn58xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn58xxp1;
struct cvmx_gmxx_txx_thresh_cn38xx cn61xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn63xx;
struct cvmx_gmxx_txx_thresh_cn38xx cn63xxp1;
struct cvmx_gmxx_txx_thresh_cn38xx cn66xx;
struct cvmx_gmxx_txx_thresh_s cn68xx;
struct cvmx_gmxx_txx_thresh_s cn68xxp1;
struct cvmx_gmxx_txx_thresh_cn38xx cnf71xx;
};
union cvmx_gmxx_tx_bp {
uint64_t u64;
struct cvmx_gmxx_tx_bp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t bp:4;
#else
uint64_t bp:4;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_tx_bp_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_3_63:61;
uint64_t bp:3;
#else
uint64_t bp:3;
uint64_t reserved_3_63:61;
#endif
} cn30xx;
struct cvmx_gmxx_tx_bp_cn30xx cn31xx;
struct cvmx_gmxx_tx_bp_s cn38xx;
struct cvmx_gmxx_tx_bp_s cn38xxp2;
struct cvmx_gmxx_tx_bp_cn30xx cn50xx;
struct cvmx_gmxx_tx_bp_s cn52xx;
struct cvmx_gmxx_tx_bp_s cn52xxp1;
struct cvmx_gmxx_tx_bp_s cn56xx;
struct cvmx_gmxx_tx_bp_s cn56xxp1;
struct cvmx_gmxx_tx_bp_s cn58xx;
struct cvmx_gmxx_tx_bp_s cn58xxp1;
struct cvmx_gmxx_tx_bp_s cn61xx;
struct cvmx_gmxx_tx_bp_s cn63xx;
struct cvmx_gmxx_tx_bp_s cn63xxp1;
struct cvmx_gmxx_tx_bp_s cn66xx;
struct cvmx_gmxx_tx_bp_s cn68xx;
struct cvmx_gmxx_tx_bp_s cn68xxp1;
struct cvmx_gmxx_tx_bp_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t bp:2;
#else
uint64_t bp:2;
uint64_t reserved_2_63:62;
#endif
} cnf71xx;
};
union cvmx_gmxx_tx_clk_mskx {
uint64_t u64;
struct cvmx_gmxx_tx_clk_mskx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_1_63:63;
uint64_t msk:1;
#else
uint64_t msk:1;
uint64_t reserved_1_63:63;
#endif
} s;
struct cvmx_gmxx_tx_clk_mskx_s cn30xx;
struct cvmx_gmxx_tx_clk_mskx_s cn50xx;
};
union cvmx_gmxx_tx_col_attempt {
uint64_t u64;
struct cvmx_gmxx_tx_col_attempt_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_5_63:59;
uint64_t limit:5;
#else
uint64_t limit:5;
uint64_t reserved_5_63:59;
#endif
} s;
struct cvmx_gmxx_tx_col_attempt_s cn30xx;
struct cvmx_gmxx_tx_col_attempt_s cn31xx;
struct cvmx_gmxx_tx_col_attempt_s cn38xx;
struct cvmx_gmxx_tx_col_attempt_s cn38xxp2;
struct cvmx_gmxx_tx_col_attempt_s cn50xx;
struct cvmx_gmxx_tx_col_attempt_s cn52xx;
struct cvmx_gmxx_tx_col_attempt_s cn52xxp1;
struct cvmx_gmxx_tx_col_attempt_s cn56xx;
struct cvmx_gmxx_tx_col_attempt_s cn56xxp1;
struct cvmx_gmxx_tx_col_attempt_s cn58xx;
struct cvmx_gmxx_tx_col_attempt_s cn58xxp1;
struct cvmx_gmxx_tx_col_attempt_s cn61xx;
struct cvmx_gmxx_tx_col_attempt_s cn63xx;
struct cvmx_gmxx_tx_col_attempt_s cn63xxp1;
struct cvmx_gmxx_tx_col_attempt_s cn66xx;
struct cvmx_gmxx_tx_col_attempt_s cn68xx;
struct cvmx_gmxx_tx_col_attempt_s cn68xxp1;
struct cvmx_gmxx_tx_col_attempt_s cnf71xx;
};
union cvmx_gmxx_tx_corrupt {
uint64_t u64;
struct cvmx_gmxx_tx_corrupt_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_4_63:60;
uint64_t corrupt:4;
#else
uint64_t corrupt:4;
uint64_t reserved_4_63:60;
#endif
} s;
struct cvmx_gmxx_tx_corrupt_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_3_63:61;
uint64_t corrupt:3;
#else
uint64_t corrupt:3;
uint64_t reserved_3_63:61;
#endif
} cn30xx;
struct cvmx_gmxx_tx_corrupt_cn30xx cn31xx;
struct cvmx_gmxx_tx_corrupt_s cn38xx;
struct cvmx_gmxx_tx_corrupt_s cn38xxp2;
struct cvmx_gmxx_tx_corrupt_cn30xx cn50xx;
struct cvmx_gmxx_tx_corrupt_s cn52xx;
struct cvmx_gmxx_tx_corrupt_s cn52xxp1;
struct cvmx_gmxx_tx_corrupt_s cn56xx;
struct cvmx_gmxx_tx_corrupt_s cn56xxp1;
struct cvmx_gmxx_tx_corrupt_s cn58xx;
struct cvmx_gmxx_tx_corrupt_s cn58xxp1;
struct cvmx_gmxx_tx_corrupt_s cn61xx;
struct cvmx_gmxx_tx_corrupt_s cn63xx;
struct cvmx_gmxx_tx_corrupt_s cn63xxp1;
struct cvmx_gmxx_tx_corrupt_s cn66xx;
struct cvmx_gmxx_tx_corrupt_s cn68xx;
struct cvmx_gmxx_tx_corrupt_s cn68xxp1;
struct cvmx_gmxx_tx_corrupt_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t corrupt:2;
#else
uint64_t corrupt:2;
uint64_t reserved_2_63:62;
#endif
} cnf71xx;
};
union cvmx_gmxx_tx_hg2_reg1 {
uint64_t u64;
struct cvmx_gmxx_tx_hg2_reg1_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t tx_xof:16;
#else
uint64_t tx_xof:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_hg2_reg1_s cn52xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn52xxp1;
struct cvmx_gmxx_tx_hg2_reg1_s cn56xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn61xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn63xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn63xxp1;
struct cvmx_gmxx_tx_hg2_reg1_s cn66xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn68xx;
struct cvmx_gmxx_tx_hg2_reg1_s cn68xxp1;
struct cvmx_gmxx_tx_hg2_reg1_s cnf71xx;
};
union cvmx_gmxx_tx_hg2_reg2 {
uint64_t u64;
struct cvmx_gmxx_tx_hg2_reg2_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t tx_xon:16;
#else
uint64_t tx_xon:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_hg2_reg2_s cn52xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn52xxp1;
struct cvmx_gmxx_tx_hg2_reg2_s cn56xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn61xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn63xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn63xxp1;
struct cvmx_gmxx_tx_hg2_reg2_s cn66xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn68xx;
struct cvmx_gmxx_tx_hg2_reg2_s cn68xxp1;
struct cvmx_gmxx_tx_hg2_reg2_s cnf71xx;
};
union cvmx_gmxx_tx_ifg {
uint64_t u64;
struct cvmx_gmxx_tx_ifg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_8_63:56;
uint64_t ifg2:4;
uint64_t ifg1:4;
#else
uint64_t ifg1:4;
uint64_t ifg2:4;
uint64_t reserved_8_63:56;
#endif
} s;
struct cvmx_gmxx_tx_ifg_s cn30xx;
struct cvmx_gmxx_tx_ifg_s cn31xx;
struct cvmx_gmxx_tx_ifg_s cn38xx;
struct cvmx_gmxx_tx_ifg_s cn38xxp2;
struct cvmx_gmxx_tx_ifg_s cn50xx;
struct cvmx_gmxx_tx_ifg_s cn52xx;
struct cvmx_gmxx_tx_ifg_s cn52xxp1;
struct cvmx_gmxx_tx_ifg_s cn56xx;
struct cvmx_gmxx_tx_ifg_s cn56xxp1;
struct cvmx_gmxx_tx_ifg_s cn58xx;
struct cvmx_gmxx_tx_ifg_s cn58xxp1;
struct cvmx_gmxx_tx_ifg_s cn61xx;
struct cvmx_gmxx_tx_ifg_s cn63xx;
struct cvmx_gmxx_tx_ifg_s cn63xxp1;
struct cvmx_gmxx_tx_ifg_s cn66xx;
struct cvmx_gmxx_tx_ifg_s cn68xx;
struct cvmx_gmxx_tx_ifg_s cn68xxp1;
struct cvmx_gmxx_tx_ifg_s cnf71xx;
};
union cvmx_gmxx_tx_int_en {
uint64_t u64;
struct cvmx_gmxx_tx_int_en_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} s;
struct cvmx_gmxx_tx_int_en_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t late_col:3;
uint64_t reserved_15_15:1;
uint64_t xsdef:3;
uint64_t reserved_11_11:1;
uint64_t xscol:3;
uint64_t reserved_5_7:3;
uint64_t undflw:3;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:3;
uint64_t reserved_5_7:3;
uint64_t xscol:3;
uint64_t reserved_11_11:1;
uint64_t xsdef:3;
uint64_t reserved_15_15:1;
uint64_t late_col:3;
uint64_t reserved_19_63:45;
#endif
} cn30xx;
struct cvmx_gmxx_tx_int_en_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_15_63:49;
uint64_t xsdef:3;
uint64_t reserved_11_11:1;
uint64_t xscol:3;
uint64_t reserved_5_7:3;
uint64_t undflw:3;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:3;
uint64_t reserved_5_7:3;
uint64_t xscol:3;
uint64_t reserved_11_11:1;
uint64_t xsdef:3;
uint64_t reserved_15_63:49;
#endif
} cn31xx;
struct cvmx_gmxx_tx_int_en_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t ncb_nxa:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t ncb_nxa:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t reserved_20_63:44;
#endif
} cn38xx;
struct cvmx_gmxx_tx_int_en_cn38xxp2 {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t ncb_nxa:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t ncb_nxa:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t reserved_16_63:48;
#endif
} cn38xxp2;
struct cvmx_gmxx_tx_int_en_cn30xx cn50xx;
struct cvmx_gmxx_tx_int_en_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t reserved_20_63:44;
#endif
} cn52xx;
struct cvmx_gmxx_tx_int_en_cn52xx cn52xxp1;
struct cvmx_gmxx_tx_int_en_cn52xx cn56xx;
struct cvmx_gmxx_tx_int_en_cn52xx cn56xxp1;
struct cvmx_gmxx_tx_int_en_cn38xx cn58xx;
struct cvmx_gmxx_tx_int_en_cn38xx cn58xxp1;
struct cvmx_gmxx_tx_int_en_s cn61xx;
struct cvmx_gmxx_tx_int_en_cn63xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_24_63:40;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t reserved_24_63:40;
#endif
} cn63xx;
struct cvmx_gmxx_tx_int_en_cn63xx cn63xxp1;
struct cvmx_gmxx_tx_int_en_s cn66xx;
struct cvmx_gmxx_tx_int_en_cn68xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t pko_nxp:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t pko_nxp:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} cn68xx;
struct cvmx_gmxx_tx_int_en_cn68xx cn68xxp1;
struct cvmx_gmxx_tx_int_en_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t reserved_22_23:2;
uint64_t ptp_lost:2;
uint64_t reserved_18_19:2;
uint64_t late_col:2;
uint64_t reserved_14_15:2;
uint64_t xsdef:2;
uint64_t reserved_10_11:2;
uint64_t xscol:2;
uint64_t reserved_4_7:4;
uint64_t undflw:2;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:2;
uint64_t reserved_4_7:4;
uint64_t xscol:2;
uint64_t reserved_10_11:2;
uint64_t xsdef:2;
uint64_t reserved_14_15:2;
uint64_t late_col:2;
uint64_t reserved_18_19:2;
uint64_t ptp_lost:2;
uint64_t reserved_22_23:2;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} cnf71xx;
};
union cvmx_gmxx_tx_int_reg {
uint64_t u64;
struct cvmx_gmxx_tx_int_reg_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} s;
struct cvmx_gmxx_tx_int_reg_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_19_63:45;
uint64_t late_col:3;
uint64_t reserved_15_15:1;
uint64_t xsdef:3;
uint64_t reserved_11_11:1;
uint64_t xscol:3;
uint64_t reserved_5_7:3;
uint64_t undflw:3;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:3;
uint64_t reserved_5_7:3;
uint64_t xscol:3;
uint64_t reserved_11_11:1;
uint64_t xsdef:3;
uint64_t reserved_15_15:1;
uint64_t late_col:3;
uint64_t reserved_19_63:45;
#endif
} cn30xx;
struct cvmx_gmxx_tx_int_reg_cn31xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_15_63:49;
uint64_t xsdef:3;
uint64_t reserved_11_11:1;
uint64_t xscol:3;
uint64_t reserved_5_7:3;
uint64_t undflw:3;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:3;
uint64_t reserved_5_7:3;
uint64_t xscol:3;
uint64_t reserved_11_11:1;
uint64_t xsdef:3;
uint64_t reserved_15_63:49;
#endif
} cn31xx;
struct cvmx_gmxx_tx_int_reg_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t ncb_nxa:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t ncb_nxa:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t reserved_20_63:44;
#endif
} cn38xx;
struct cvmx_gmxx_tx_int_reg_cn38xxp2 {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t ncb_nxa:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t ncb_nxa:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t reserved_16_63:48;
#endif
} cn38xxp2;
struct cvmx_gmxx_tx_int_reg_cn30xx cn50xx;
struct cvmx_gmxx_tx_int_reg_cn52xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_20_63:44;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t reserved_20_63:44;
#endif
} cn52xx;
struct cvmx_gmxx_tx_int_reg_cn52xx cn52xxp1;
struct cvmx_gmxx_tx_int_reg_cn52xx cn56xx;
struct cvmx_gmxx_tx_int_reg_cn52xx cn56xxp1;
struct cvmx_gmxx_tx_int_reg_cn38xx cn58xx;
struct cvmx_gmxx_tx_int_reg_cn38xx cn58xxp1;
struct cvmx_gmxx_tx_int_reg_s cn61xx;
struct cvmx_gmxx_tx_int_reg_cn63xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_24_63:40;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t reserved_24_63:40;
#endif
} cn63xx;
struct cvmx_gmxx_tx_int_reg_cn63xx cn63xxp1;
struct cvmx_gmxx_tx_int_reg_s cn66xx;
struct cvmx_gmxx_tx_int_reg_cn68xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t ptp_lost:4;
uint64_t late_col:4;
uint64_t xsdef:4;
uint64_t xscol:4;
uint64_t reserved_6_7:2;
uint64_t undflw:4;
uint64_t pko_nxp:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t pko_nxp:1;
uint64_t undflw:4;
uint64_t reserved_6_7:2;
uint64_t xscol:4;
uint64_t xsdef:4;
uint64_t late_col:4;
uint64_t ptp_lost:4;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} cn68xx;
struct cvmx_gmxx_tx_int_reg_cn68xx cn68xxp1;
struct cvmx_gmxx_tx_int_reg_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_25_63:39;
uint64_t xchange:1;
uint64_t reserved_22_23:2;
uint64_t ptp_lost:2;
uint64_t reserved_18_19:2;
uint64_t late_col:2;
uint64_t reserved_14_15:2;
uint64_t xsdef:2;
uint64_t reserved_10_11:2;
uint64_t xscol:2;
uint64_t reserved_4_7:4;
uint64_t undflw:2;
uint64_t reserved_1_1:1;
uint64_t pko_nxa:1;
#else
uint64_t pko_nxa:1;
uint64_t reserved_1_1:1;
uint64_t undflw:2;
uint64_t reserved_4_7:4;
uint64_t xscol:2;
uint64_t reserved_10_11:2;
uint64_t xsdef:2;
uint64_t reserved_14_15:2;
uint64_t late_col:2;
uint64_t reserved_18_19:2;
uint64_t ptp_lost:2;
uint64_t reserved_22_23:2;
uint64_t xchange:1;
uint64_t reserved_25_63:39;
#endif
} cnf71xx;
};
union cvmx_gmxx_tx_jam {
uint64_t u64;
struct cvmx_gmxx_tx_jam_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_8_63:56;
uint64_t jam:8;
#else
uint64_t jam:8;
uint64_t reserved_8_63:56;
#endif
} s;
struct cvmx_gmxx_tx_jam_s cn30xx;
struct cvmx_gmxx_tx_jam_s cn31xx;
struct cvmx_gmxx_tx_jam_s cn38xx;
struct cvmx_gmxx_tx_jam_s cn38xxp2;
struct cvmx_gmxx_tx_jam_s cn50xx;
struct cvmx_gmxx_tx_jam_s cn52xx;
struct cvmx_gmxx_tx_jam_s cn52xxp1;
struct cvmx_gmxx_tx_jam_s cn56xx;
struct cvmx_gmxx_tx_jam_s cn56xxp1;
struct cvmx_gmxx_tx_jam_s cn58xx;
struct cvmx_gmxx_tx_jam_s cn58xxp1;
struct cvmx_gmxx_tx_jam_s cn61xx;
struct cvmx_gmxx_tx_jam_s cn63xx;
struct cvmx_gmxx_tx_jam_s cn63xxp1;
struct cvmx_gmxx_tx_jam_s cn66xx;
struct cvmx_gmxx_tx_jam_s cn68xx;
struct cvmx_gmxx_tx_jam_s cn68xxp1;
struct cvmx_gmxx_tx_jam_s cnf71xx;
};
union cvmx_gmxx_tx_lfsr {
uint64_t u64;
struct cvmx_gmxx_tx_lfsr_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t lfsr:16;
#else
uint64_t lfsr:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_lfsr_s cn30xx;
struct cvmx_gmxx_tx_lfsr_s cn31xx;
struct cvmx_gmxx_tx_lfsr_s cn38xx;
struct cvmx_gmxx_tx_lfsr_s cn38xxp2;
struct cvmx_gmxx_tx_lfsr_s cn50xx;
struct cvmx_gmxx_tx_lfsr_s cn52xx;
struct cvmx_gmxx_tx_lfsr_s cn52xxp1;
struct cvmx_gmxx_tx_lfsr_s cn56xx;
struct cvmx_gmxx_tx_lfsr_s cn56xxp1;
struct cvmx_gmxx_tx_lfsr_s cn58xx;
struct cvmx_gmxx_tx_lfsr_s cn58xxp1;
struct cvmx_gmxx_tx_lfsr_s cn61xx;
struct cvmx_gmxx_tx_lfsr_s cn63xx;
struct cvmx_gmxx_tx_lfsr_s cn63xxp1;
struct cvmx_gmxx_tx_lfsr_s cn66xx;
struct cvmx_gmxx_tx_lfsr_s cn68xx;
struct cvmx_gmxx_tx_lfsr_s cn68xxp1;
struct cvmx_gmxx_tx_lfsr_s cnf71xx;
};
union cvmx_gmxx_tx_ovr_bp {
uint64_t u64;
struct cvmx_gmxx_tx_ovr_bp_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t tx_prt_bp:16;
uint64_t reserved_12_31:20;
uint64_t en:4;
uint64_t bp:4;
uint64_t ign_full:4;
#else
uint64_t ign_full:4;
uint64_t bp:4;
uint64_t en:4;
uint64_t reserved_12_31:20;
uint64_t tx_prt_bp:16;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_tx_ovr_bp_cn30xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_11_63:53;
uint64_t en:3;
uint64_t reserved_7_7:1;
uint64_t bp:3;
uint64_t reserved_3_3:1;
uint64_t ign_full:3;
#else
uint64_t ign_full:3;
uint64_t reserved_3_3:1;
uint64_t bp:3;
uint64_t reserved_7_7:1;
uint64_t en:3;
uint64_t reserved_11_63:53;
#endif
} cn30xx;
struct cvmx_gmxx_tx_ovr_bp_cn30xx cn31xx;
struct cvmx_gmxx_tx_ovr_bp_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_12_63:52;
uint64_t en:4;
uint64_t bp:4;
uint64_t ign_full:4;
#else
uint64_t ign_full:4;
uint64_t bp:4;
uint64_t en:4;
uint64_t reserved_12_63:52;
#endif
} cn38xx;
struct cvmx_gmxx_tx_ovr_bp_cn38xx cn38xxp2;
struct cvmx_gmxx_tx_ovr_bp_cn30xx cn50xx;
struct cvmx_gmxx_tx_ovr_bp_s cn52xx;
struct cvmx_gmxx_tx_ovr_bp_s cn52xxp1;
struct cvmx_gmxx_tx_ovr_bp_s cn56xx;
struct cvmx_gmxx_tx_ovr_bp_s cn56xxp1;
struct cvmx_gmxx_tx_ovr_bp_cn38xx cn58xx;
struct cvmx_gmxx_tx_ovr_bp_cn38xx cn58xxp1;
struct cvmx_gmxx_tx_ovr_bp_s cn61xx;
struct cvmx_gmxx_tx_ovr_bp_s cn63xx;
struct cvmx_gmxx_tx_ovr_bp_s cn63xxp1;
struct cvmx_gmxx_tx_ovr_bp_s cn66xx;
struct cvmx_gmxx_tx_ovr_bp_s cn68xx;
struct cvmx_gmxx_tx_ovr_bp_s cn68xxp1;
struct cvmx_gmxx_tx_ovr_bp_cnf71xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t tx_prt_bp:16;
uint64_t reserved_10_31:22;
uint64_t en:2;
uint64_t reserved_6_7:2;
uint64_t bp:2;
uint64_t reserved_2_3:2;
uint64_t ign_full:2;
#else
uint64_t ign_full:2;
uint64_t reserved_2_3:2;
uint64_t bp:2;
uint64_t reserved_6_7:2;
uint64_t en:2;
uint64_t reserved_10_31:22;
uint64_t tx_prt_bp:16;
uint64_t reserved_48_63:16;
#endif
} cnf71xx;
};
union cvmx_gmxx_tx_pause_pkt_dmac {
uint64_t u64;
struct cvmx_gmxx_tx_pause_pkt_dmac_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_48_63:16;
uint64_t dmac:48;
#else
uint64_t dmac:48;
uint64_t reserved_48_63:16;
#endif
} s;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn30xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn31xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn38xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn38xxp2;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn50xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn52xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn52xxp1;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn56xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn56xxp1;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn58xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn58xxp1;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn61xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn63xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn63xxp1;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn66xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn68xx;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cn68xxp1;
struct cvmx_gmxx_tx_pause_pkt_dmac_s cnf71xx;
};
union cvmx_gmxx_tx_pause_pkt_type {
uint64_t u64;
struct cvmx_gmxx_tx_pause_pkt_type_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t type:16;
#else
uint64_t type:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_pause_pkt_type_s cn30xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn31xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn38xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn38xxp2;
struct cvmx_gmxx_tx_pause_pkt_type_s cn50xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn52xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn52xxp1;
struct cvmx_gmxx_tx_pause_pkt_type_s cn56xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn56xxp1;
struct cvmx_gmxx_tx_pause_pkt_type_s cn58xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn58xxp1;
struct cvmx_gmxx_tx_pause_pkt_type_s cn61xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn63xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn63xxp1;
struct cvmx_gmxx_tx_pause_pkt_type_s cn66xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn68xx;
struct cvmx_gmxx_tx_pause_pkt_type_s cn68xxp1;
struct cvmx_gmxx_tx_pause_pkt_type_s cnf71xx;
};
union cvmx_gmxx_tx_prts {
uint64_t u64;
struct cvmx_gmxx_tx_prts_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_5_63:59;
uint64_t prts:5;
#else
uint64_t prts:5;
uint64_t reserved_5_63:59;
#endif
} s;
struct cvmx_gmxx_tx_prts_s cn30xx;
struct cvmx_gmxx_tx_prts_s cn31xx;
struct cvmx_gmxx_tx_prts_s cn38xx;
struct cvmx_gmxx_tx_prts_s cn38xxp2;
struct cvmx_gmxx_tx_prts_s cn50xx;
struct cvmx_gmxx_tx_prts_s cn52xx;
struct cvmx_gmxx_tx_prts_s cn52xxp1;
struct cvmx_gmxx_tx_prts_s cn56xx;
struct cvmx_gmxx_tx_prts_s cn56xxp1;
struct cvmx_gmxx_tx_prts_s cn58xx;
struct cvmx_gmxx_tx_prts_s cn58xxp1;
struct cvmx_gmxx_tx_prts_s cn61xx;
struct cvmx_gmxx_tx_prts_s cn63xx;
struct cvmx_gmxx_tx_prts_s cn63xxp1;
struct cvmx_gmxx_tx_prts_s cn66xx;
struct cvmx_gmxx_tx_prts_s cn68xx;
struct cvmx_gmxx_tx_prts_s cn68xxp1;
struct cvmx_gmxx_tx_prts_s cnf71xx;
};
union cvmx_gmxx_tx_spi_ctl {
uint64_t u64;
struct cvmx_gmxx_tx_spi_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_2_63:62;
uint64_t tpa_clr:1;
uint64_t cont_pkt:1;
#else
uint64_t cont_pkt:1;
uint64_t tpa_clr:1;
uint64_t reserved_2_63:62;
#endif
} s;
struct cvmx_gmxx_tx_spi_ctl_s cn38xx;
struct cvmx_gmxx_tx_spi_ctl_s cn38xxp2;
struct cvmx_gmxx_tx_spi_ctl_s cn58xx;
struct cvmx_gmxx_tx_spi_ctl_s cn58xxp1;
};
union cvmx_gmxx_tx_spi_drain {
uint64_t u64;
struct cvmx_gmxx_tx_spi_drain_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t drain:16;
#else
uint64_t drain:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_spi_drain_s cn38xx;
struct cvmx_gmxx_tx_spi_drain_s cn58xx;
struct cvmx_gmxx_tx_spi_drain_s cn58xxp1;
};
union cvmx_gmxx_tx_spi_max {
uint64_t u64;
struct cvmx_gmxx_tx_spi_max_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_23_63:41;
uint64_t slice:7;
uint64_t max2:8;
uint64_t max1:8;
#else
uint64_t max1:8;
uint64_t max2:8;
uint64_t slice:7;
uint64_t reserved_23_63:41;
#endif
} s;
struct cvmx_gmxx_tx_spi_max_cn38xx {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t max2:8;
uint64_t max1:8;
#else
uint64_t max1:8;
uint64_t max2:8;
uint64_t reserved_16_63:48;
#endif
} cn38xx;
struct cvmx_gmxx_tx_spi_max_cn38xx cn38xxp2;
struct cvmx_gmxx_tx_spi_max_s cn58xx;
struct cvmx_gmxx_tx_spi_max_s cn58xxp1;
};
union cvmx_gmxx_tx_spi_roundx {
uint64_t u64;
struct cvmx_gmxx_tx_spi_roundx_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_16_63:48;
uint64_t round:16;
#else
uint64_t round:16;
uint64_t reserved_16_63:48;
#endif
} s;
struct cvmx_gmxx_tx_spi_roundx_s cn58xx;
struct cvmx_gmxx_tx_spi_roundx_s cn58xxp1;
};
union cvmx_gmxx_tx_spi_thresh {
uint64_t u64;
struct cvmx_gmxx_tx_spi_thresh_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_6_63:58;
uint64_t thresh:6;
#else
uint64_t thresh:6;
uint64_t reserved_6_63:58;
#endif
} s;
struct cvmx_gmxx_tx_spi_thresh_s cn38xx;
struct cvmx_gmxx_tx_spi_thresh_s cn38xxp2;
struct cvmx_gmxx_tx_spi_thresh_s cn58xx;
struct cvmx_gmxx_tx_spi_thresh_s cn58xxp1;
};
union cvmx_gmxx_tx_xaui_ctl {
uint64_t u64;
struct cvmx_gmxx_tx_xaui_ctl_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_11_63:53;
uint64_t hg_pause_hgi:2;
uint64_t hg_en:1;
uint64_t reserved_7_7:1;
uint64_t ls_byp:1;
uint64_t ls:2;
uint64_t reserved_2_3:2;
uint64_t uni_en:1;
uint64_t dic_en:1;
#else
uint64_t dic_en:1;
uint64_t uni_en:1;
uint64_t reserved_2_3:2;
uint64_t ls:2;
uint64_t ls_byp:1;
uint64_t reserved_7_7:1;
uint64_t hg_en:1;
uint64_t hg_pause_hgi:2;
uint64_t reserved_11_63:53;
#endif
} s;
struct cvmx_gmxx_tx_xaui_ctl_s cn52xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn52xxp1;
struct cvmx_gmxx_tx_xaui_ctl_s cn56xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn56xxp1;
struct cvmx_gmxx_tx_xaui_ctl_s cn61xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn63xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn63xxp1;
struct cvmx_gmxx_tx_xaui_ctl_s cn66xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn68xx;
struct cvmx_gmxx_tx_xaui_ctl_s cn68xxp1;
struct cvmx_gmxx_tx_xaui_ctl_s cnf71xx;
};
union cvmx_gmxx_xaui_ext_loopback {
uint64_t u64;
struct cvmx_gmxx_xaui_ext_loopback_s {
#ifdef __BIG_ENDIAN_BITFIELD
uint64_t reserved_5_63:59;
uint64_t en:1;
uint64_t thresh:4;
#else
uint64_t thresh:4;
uint64_t en:1;
uint64_t reserved_5_63:59;
#endif
} s;
struct cvmx_gmxx_xaui_ext_loopback_s cn52xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn52xxp1;
struct cvmx_gmxx_xaui_ext_loopback_s cn56xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn56xxp1;
struct cvmx_gmxx_xaui_ext_loopback_s cn61xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn63xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn63xxp1;
struct cvmx_gmxx_xaui_ext_loopback_s cn66xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn68xx;
struct cvmx_gmxx_xaui_ext_loopback_s cn68xxp1;
struct cvmx_gmxx_xaui_ext_loopback_s cnf71xx;
};
#endif
|
e601304f930e6bf5e41ac0aa498711ec660a163a
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/gd32450z-eval/Libraries/GD32F4xx_standard_peripheral/Include/gd32f4xx_dci.h
|
4986d5afd4d5c304a293612073356c0a39a6790d
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 13,456
|
h
|
gd32f4xx_dci.h
|
/*!
\file gd32f4xx_dci.h
\brief definitions for the DCI
\version 2016-08-15, V1.0.0, firmware for GD32F4xx
\version 2018-12-12, V2.0.0, firmware for GD32F4xx
\version 2020-09-30, V2.1.0, firmware for GD32F4xx
*/
/*
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef GD32F4XX_DCI_H
#define GD32F4XX_DCI_H
#include "gd32f4xx.h"
/* DCI definitions */
#define DCI DCI_BASE
/* registers definitions */
#define DCI_CTL REG32(DCI + 0x00U) /*!< DCI control register */
#define DCI_STAT0 REG32(DCI + 0x04U) /*!< DCI status register 0 */
#define DCI_STAT1 REG32(DCI + 0x08U) /*!< DCI status register 1 */
#define DCI_INTEN REG32(DCI + 0x0CU) /*!< DCI interrupt enable register */
#define DCI_INTF REG32(DCI + 0x10U) /*!< DCI interrupt flag register */
#define DCI_INTC REG32(DCI + 0x14U) /*!< DCI interrupt clear register */
#define DCI_SC REG32(DCI + 0x18U) /*!< DCI synchronization codes register */
#define DCI_SCUMSK REG32(DCI + 0x1CU) /*!< DCI synchronization codes unmask register */
#define DCI_CWSPOS REG32(DCI + 0x20U) /*!< DCI cropping window start position register */
#define DCI_CWSZ REG32(DCI + 0x24U) /*!< DCI cropping window size register */
#define DCI_DATA REG32(DCI + 0x28U) /*!< DCI data register */
/* bits definitions */
/* DCI_CTL */
#define DCI_CTL_CAP BIT(0) /*!< capture enable */
#define DCI_CTL_SNAP BIT(1) /*!< snapshot mode */
#define DCI_CTL_WDEN BIT(2) /*!< window enable */
#define DCI_CTL_JM BIT(3) /*!< JPEG mode */
#define DCI_CTL_ESM BIT(4) /*!< embedded synchronous mode */
#define DCI_CTL_CKS BIT(5) /*!< clock polarity selection */
#define DCI_CTL_HPS BIT(6) /*!< horizontal polarity selection */
#define DCI_CTL_VPS BIT(7) /*!< vertical polarity selection */
#define DCI_CTL_FR BITS(8,9) /*!< frame rate */
#define DCI_CTL_DCIF BITS(10,11) /*!< digital camera interface format */
#define DCI_CTL_DCIEN BIT(14) /*!< DCI enable */
/* DCI_STAT0 */
#define DCI_STAT0_HS BIT(0) /*!< HS line status */
#define DCI_STAT0_VS BIT(1) /*!< VS line status */
#define DCI_STAT0_FV BIT(2) /*!< FIFO valid */
/* DCI_STAT1 */
#define DCI_STAT1_EFF BIT(0) /*!< end of frame flag */
#define DCI_STAT1_OVRF BIT(1) /*!< FIFO overrun flag */
#define DCI_STAT1_ESEF BIT(2) /*!< embedded synchronous error flag */
#define DCI_STAT1_VSF BIT(3) /*!< vsync flag */
#define DCI_STAT1_ELF BIT(4) /*!< end of line flag */
/* DCI_INTEN */
#define DCI_INTEN_EFIE BIT(0) /*!< end of frame interrupt enable */
#define DCI_INTEN_OVRIE BIT(1) /*!< FIFO overrun interrupt enable */
#define DCI_INTEN_ESEIE BIT(2) /*!< embedded synchronous error interrupt enable */
#define DCI_INTEN_VSIE BIT(3) /*!< vsync interrupt enable */
#define DCI_INTEN_ELIE BIT(4) /*!< end of line interrupt enable */
/* DCI_INTF */
#define DCI_INTF_EFIF BIT(0) /*!< end of frame interrupt flag */
#define DCI_INTF_OVRIF BIT(1) /*!< FIFO overrun interrupt flag */
#define DCI_INTF_ESEIF BIT(2) /*!< embedded synchronous error interrupt flag */
#define DCI_INTF_VSIF BIT(3) /*!< vsync interrupt flag */
#define DCI_INTF_ELIF BIT(4) /*!< end of line interrupt flag */
/* DCI_INTC */
#define DCI_INTC_EFFC BIT(0) /*!< clear end of frame flag */
#define DCI_INTC_OVRFC BIT(1) /*!< clear FIFO overrun flag */
#define DCI_INTC_ESEFC BIT(2) /*!< clear embedded synchronous error flag */
#define DCI_INTC_VSFC BIT(3) /*!< vsync flag clear */
#define DCI_INTC_ELFC BIT(4) /*!< end of line flag clear */
/* DCI_SC */
#define DCI_SC_FS BITS(0,7) /*!< frame start code in embedded synchronous mode */
#define DCI_SC_LS BITS(8,15) /*!< line start code in embedded synchronous mode */
#define DCI_SC_LE BITS(16,23) /*!< line end code in embedded synchronous mode */
#define DCI_SC_FE BITS(24,31) /*!< frame end code in embedded synchronous mode */
/* DCI_SCUNMSK */
#define DCI_SCUMSK_FSM BITS(0,7) /*!< frame start code unmask bits in embedded synchronous mode */
#define DCI_SCUMSK_LSM BITS(8,15) /*!< line start code unmask bits in embedded synchronous mode */
#define DCI_SCUMSK_LEM BITS(16,23) /*!< line end code unmask bits in embedded synchronous mode */
#define DCI_SCUMSK_FEM BITS(24,31) /*!< frame end code unmask bits in embedded synchronous mode */
/* DCI_CWSPOS */
#define DCI_CWSPOS_WHSP BITS(0,13) /*!< window horizontal start position */
#define DCI_CWSPOS_WVSP BITS(16,28) /*!< window vertical start position */
/* DCI_CWSZ */
#define DCI_CWSZ_WHSZ BITS(0,13) /*!< window horizontal size */
#define DCI_CWSZ_WVSZ BITS(16,29) /*!< window vertical size */
/* constants definitions */
/* DCI parameter structure definitions */
typedef struct
{
uint32_t capture_mode; /*!< DCI capture mode: continuous or snapshot */
uint32_t clock_polarity; /*!< clock polarity selection */
uint32_t hsync_polarity; /*!< horizontal polarity selection */
uint32_t vsync_polarity; /*!< vertical polarity selection */
uint32_t frame_rate; /*!< frame capture rate */
uint32_t interface_format; /*!< digital camera interface format */
}dci_parameter_struct;
#define DCI_CAPTURE_MODE_CONTINUOUS ((uint32_t)0x00000000U) /*!< continuous capture mode */
#define DCI_CAPTURE_MODE_SNAPSHOT DCI_CTL_SNAP /*!< snapshot capture mode */
#define DCI_CK_POLARITY_FALLING ((uint32_t)0x00000000U) /*!< capture at falling edge */
#define DCI_CK_POLARITY_RISING DCI_CTL_CKS /*!< capture at rising edge */
#define DCI_HSYNC_POLARITY_LOW ((uint32_t)0x00000000U) /*!< low level during blanking period */
#define DCI_HSYNC_POLARITY_HIGH DCI_CTL_HPS /*!< high level during blanking period */
#define DCI_VSYNC_POLARITY_LOW ((uint32_t)0x00000000U) /*!< low level during blanking period */
#define DCI_VSYNC_POLARITY_HIGH DCI_CTL_VPS /*!< high level during blanking period*/
#define CTL_FR(regval) (BITS(8,9)&((uint32_t)(regval) << 8U))
#define DCI_FRAME_RATE_ALL CTL_FR(0) /*!< capture all frames */
#define DCI_FRAME_RATE_1_2 CTL_FR(1) /*!< capture one in 2 frames */
#define DCI_FRAME_RATE_1_4 CTL_FR(2) /*!< capture one in 4 frames */
#define CTL_DCIF(regval) (BITS(10,11)&((uint32_t)(regval) << 10U))
#define DCI_INTERFACE_FORMAT_8BITS CTL_DCIF(0) /*!< 8-bit data on every pixel clock */
#define DCI_INTERFACE_FORMAT_10BITS CTL_DCIF(1) /*!< 10-bit data on every pixel clock */
#define DCI_INTERFACE_FORMAT_12BITS CTL_DCIF(2) /*!< 12-bit data on every pixel clock */
#define DCI_INTERFACE_FORMAT_14BITS CTL_DCIF(3) /*!< 14-bit data on every pixel clock */
/* DCI interrupt constants definitions */
#define DCI_INT_EF BIT(0) /*!< end of frame interrupt */
#define DCI_INT_OVR BIT(1) /*!< FIFO overrun interrupt */
#define DCI_INT_ESE BIT(2) /*!< embedded synchronous error interrupt */
#define DCI_INT_VSYNC BIT(3) /*!< vsync interrupt */
#define DCI_INT_EL BIT(4) /*!< end of line interrupt */
/* DCI interrupt flag definitions */
#define DCI_INT_FLAG_EF BIT(0) /*!< end of frame interrupt flag */
#define DCI_INT_FLAG_OVR BIT(1) /*!< FIFO overrun interrupt flag */
#define DCI_INT_FLAG_ESE BIT(2) /*!< embedded synchronous error interrupt flag */
#define DCI_INT_FLAG_VSYNC BIT(3) /*!< vsync interrupt flag */
#define DCI_INT_FLAG_EL BIT(4) /*!< end of line interrupt flag */
/* DCI flag definitions */
#define DCI_FLAG_HS DCI_STAT0_HS /*!< HS line status */
#define DCI_FLAG_VS DCI_STAT0_VS /*!< VS line status */
#define DCI_FLAG_FV DCI_STAT0_FV /*!< FIFO valid */
#define DCI_FLAG_EF (DCI_STAT1_EFF | BIT(31)) /*!< end of frame flag */
#define DCI_FLAG_OVR (DCI_STAT1_OVRF | BIT(31)) /*!< FIFO overrun flag */
#define DCI_FLAG_ESE (DCI_STAT1_ESEF | BIT(31)) /*!< embedded synchronous error flag */
#define DCI_FLAG_VSYNC (DCI_STAT1_VSF | BIT(31)) /*!< vsync flag */
#define DCI_FLAG_EL (DCI_STAT1_ELF | BIT(31)) /*!< end of line flag */
/* function declarations */
/* initialization functions */
/* DCI deinit */
void dci_deinit(void);
/* initialize DCI registers */
void dci_init(dci_parameter_struct* dci_struct);
/* enable DCI function */
void dci_enable(void);
/* disable DCI function */
void dci_disable(void);
/* enable DCI capture */
void dci_capture_enable(void);
/* disable DCI capture */
void dci_capture_disable(void);
/* enable DCI jpeg mode */
void dci_jpeg_enable(void);
/* disable DCI jpeg mode */
void dci_jpeg_disable(void);
/* function configuration */
/* enable cropping window function */
void dci_crop_window_enable(void);
/* disable cropping window function */
void dci_crop_window_disable(void);
/* configure DCI cropping window */
void dci_crop_window_config(uint16_t start_x, uint16_t start_y, uint16_t size_width, uint16_t size_height);
/* enable embedded synchronous mode */
void dci_embedded_sync_enable(void);
/* disable embedded synchronous mode */
void dci_embedded_sync_disable(void);
/* configure synchronous codes in embedded synchronous mode */
void dci_sync_codes_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end);
/* configure synchronous codes unmask in embedded synchronous mode */
void dci_sync_codes_unmask_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end);
/* read DCI data register */
uint32_t dci_data_read(void);
/* interrupt & flag functions */
/* get specified flag */
FlagStatus dci_flag_get(uint32_t flag);
/* enable specified DCI interrupt */
void dci_interrupt_enable(uint32_t interrupt);
/* disable specified DCI interrupt */
void dci_interrupt_disable(uint32_t interrupt);
/* get specified interrupt flag */
FlagStatus dci_interrupt_flag_get(uint32_t int_flag);
/* clear specified interrupt flag */
void dci_interrupt_flag_clear(uint32_t int_flag);
#endif /* GD32F4XX_DCI_H */
|
6420c534e78383b7adc88971e42ad0ab497eb5de
|
ac8f2bb926d3afc27f27109620d1fdc357f93284
|
/src/cbor/ints.c
|
b4d035a1897e953f90073ae36d2fd382e6e062bd
|
[
"MIT"
] |
permissive
|
PJK/libcbor
|
43c35ca9ec6c618ce4774f981c63f16cb2dbc7ea
|
9b1b5a18101201756940d96e5198b980c1a8d92a
|
refs/heads/master
| 2023-08-27T19:12:56.667264
| 2023-06-05T22:23:21
| 2023-06-05T22:23:21
| 28,867,623
| 329
| 105
|
MIT
| 2023-08-14T23:38:04
| 2015-01-06T14:45:32
|
C
|
UTF-8
|
C
| false
| false
| 5,433
|
c
|
ints.c
|
/*
* Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com>
*
* libcbor is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#include "ints.h"
cbor_int_width cbor_int_get_width(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
return item->metadata.int_metadata.width;
}
uint8_t cbor_get_uint8(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
return *item->data;
}
uint16_t cbor_get_uint16(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
return *(uint16_t *)item->data;
}
uint32_t cbor_get_uint32(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
return *(uint32_t *)item->data;
}
uint64_t cbor_get_uint64(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
return *(uint64_t *)item->data;
}
uint64_t cbor_get_int(const cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
// cppcheck-suppress missingReturn
switch (cbor_int_get_width(item)) {
case CBOR_INT_8:
return cbor_get_uint8(item);
case CBOR_INT_16:
return cbor_get_uint16(item);
case CBOR_INT_32:
return cbor_get_uint32(item);
case CBOR_INT_64:
return cbor_get_uint64(item);
}
}
void cbor_set_uint8(cbor_item_t *item, uint8_t value) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
*item->data = value;
}
void cbor_set_uint16(cbor_item_t *item, uint16_t value) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
*(uint16_t *)item->data = value;
}
void cbor_set_uint32(cbor_item_t *item, uint32_t value) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
*(uint32_t *)item->data = value;
}
void cbor_set_uint64(cbor_item_t *item, uint64_t value) {
CBOR_ASSERT(cbor_is_int(item));
CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
*(uint64_t *)item->data = value;
}
void cbor_mark_uint(cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
item->type = CBOR_TYPE_UINT;
}
void cbor_mark_negint(cbor_item_t *item) {
CBOR_ASSERT(cbor_is_int(item));
item->type = CBOR_TYPE_NEGINT;
}
cbor_item_t *cbor_new_int8(void) {
cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 1);
_CBOR_NOTNULL(item);
*item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
.refcount = 1,
.metadata = {.int_metadata = {.width = CBOR_INT_8}},
.type = CBOR_TYPE_UINT};
return item;
}
cbor_item_t *cbor_new_int16(void) {
cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 2);
_CBOR_NOTNULL(item);
*item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
.refcount = 1,
.metadata = {.int_metadata = {.width = CBOR_INT_16}},
.type = CBOR_TYPE_UINT};
return item;
}
cbor_item_t *cbor_new_int32(void) {
cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 4);
_CBOR_NOTNULL(item);
*item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
.refcount = 1,
.metadata = {.int_metadata = {.width = CBOR_INT_32}},
.type = CBOR_TYPE_UINT};
return item;
}
cbor_item_t *cbor_new_int64(void) {
cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 8);
_CBOR_NOTNULL(item);
*item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
.refcount = 1,
.metadata = {.int_metadata = {.width = CBOR_INT_64}},
.type = CBOR_TYPE_UINT};
return item;
}
cbor_item_t *cbor_build_uint8(uint8_t value) {
cbor_item_t *item = cbor_new_int8();
_CBOR_NOTNULL(item);
cbor_set_uint8(item, value);
cbor_mark_uint(item);
return item;
}
cbor_item_t *cbor_build_uint16(uint16_t value) {
cbor_item_t *item = cbor_new_int16();
_CBOR_NOTNULL(item);
cbor_set_uint16(item, value);
cbor_mark_uint(item);
return item;
}
cbor_item_t *cbor_build_uint32(uint32_t value) {
cbor_item_t *item = cbor_new_int32();
_CBOR_NOTNULL(item);
cbor_set_uint32(item, value);
cbor_mark_uint(item);
return item;
}
cbor_item_t *cbor_build_uint64(uint64_t value) {
cbor_item_t *item = cbor_new_int64();
_CBOR_NOTNULL(item);
cbor_set_uint64(item, value);
cbor_mark_uint(item);
return item;
}
cbor_item_t *cbor_build_negint8(uint8_t value) {
cbor_item_t *item = cbor_new_int8();
_CBOR_NOTNULL(item);
cbor_set_uint8(item, value);
cbor_mark_negint(item);
return item;
}
cbor_item_t *cbor_build_negint16(uint16_t value) {
cbor_item_t *item = cbor_new_int16();
_CBOR_NOTNULL(item);
cbor_set_uint16(item, value);
cbor_mark_negint(item);
return item;
}
cbor_item_t *cbor_build_negint32(uint32_t value) {
cbor_item_t *item = cbor_new_int32();
_CBOR_NOTNULL(item);
cbor_set_uint32(item, value);
cbor_mark_negint(item);
return item;
}
cbor_item_t *cbor_build_negint64(uint64_t value) {
cbor_item_t *item = cbor_new_int64();
_CBOR_NOTNULL(item);
cbor_set_uint64(item, value);
cbor_mark_negint(item);
return item;
}
|
a6e2b0394afd0bfe24f5a00e39566213096a827f
|
4d78977ee7a816f97134d92b5826e929fb56c571
|
/include/thread-pool.h
|
57f25a66a73968f3fb98e0153d3aa45b8d40e53e
|
[
"MIT"
] |
permissive
|
ireader/sdk
|
312e3ebdd4b0f694977236efab012d75cbd4bdd1
|
9fb240206c4d925d12be5b29aeb94c7884ea8262
|
refs/heads/master
| 2023-09-01T17:49:04.171634
| 2023-07-22T01:56:22
| 2023-07-22T01:56:22
| 11,940,320
| 394
| 250
|
MIT
| 2022-05-01T08:18:58
| 2013-08-07T03:16:47
|
C
|
UTF-8
|
C
| false
| false
| 1,046
|
h
|
thread-pool.h
|
#ifndef _threadpool_h_
#define _threadpool_h_
#ifdef __cplusplus
extern "C" {
#endif
typedef void* thread_pool_t;
///create thread pool
///@param[in] num initialize thread count
///@param[in] min minimum thread count
///@param[in] max maximum thread count
///@return 0-error, other-thread pool id
thread_pool_t thread_pool_create(int num, int min, int max);
///destroy thread pool
///@param[in] pool thread pool id
void thread_pool_destroy(thread_pool_t pool);
///get thread count of the thread pool
///@param[in] pool thread pool id
///@return <0-error code, >=0-thread count
int thread_pool_threads_count(thread_pool_t pool);
///thread pool procedure
///@param[in] param user parameter
typedef void (*thread_pool_proc)(void *param);
///push a task to thread pool
///@param[in] pool thread pool id
///@param[in] proc task procedure
///@param[in] param user parameter
///@return =0-ok, <0-error code
int thread_pool_push(thread_pool_t pool, thread_pool_proc proc, void *param);
#ifdef __cplusplus
}
#endif
#endif /* !_threadpool_h_ */
|
1422cb729f4aced1da919ecc94cc501618958bc6
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/math/p5-Text-AsciiTeX/files/patch-src_asciitex_asciiTeX.c
|
32053fdb8d1099de83e928b0d3c25fed02349a27
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 207
|
c
|
patch-src_asciitex_asciiTeX.c
|
--- src/asciitex/asciiTeX.c.orig 2023-04-16 15:12:02 UTC
+++ src/asciitex/asciiTeX.c
@@ -38,6 +38,7 @@
#include "dim.h"
#include "utils.h"
+STAT SYNTAX_ERR_FLAG;
char ** messages;
int Nmes;
int Nall;
|
96a13c9f56715cd5be0dff7673a5de2492d01136
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/libs/libxml2-2.9.4/doc/examples/xpath2.c
|
f604114f80db9d56f380ce0ef26315a810b159c3
|
[
"MIT",
"FSFAP",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 5,330
|
c
|
xpath2.c
|
/**
* section: XPath
* synopsis: Load a document, locate subelements with XPath, modify
* said elements and save the resulting document.
* purpose: Shows how to make a full round-trip from a load/edit/save
* usage: xpath2 <xml-file> <xpath-expr> <new-value>
* test: xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
* author: Aleksey Sanin and Daniel Veillard
* copy: see Copyright for the status of this software.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_SAX1_ENABLED) && \
defined(LIBXML_OUTPUT_ENABLED)
static void usage(const char *name);
static int example4(const char *filename, const xmlChar * xpathExpr,
const xmlChar * value);
static void update_xpath_nodes(xmlNodeSetPtr nodes, const xmlChar * value);
int
main(int argc, char **argv) {
/* Parse command line and process file */
if (argc != 4) {
fprintf(stderr, "Error: wrong number of arguments.\n");
usage(argv[0]);
return(-1);
}
/* Init libxml */
xmlInitParser();
LIBXML_TEST_VERSION
/* Do the main job */
if (example4(argv[1], BAD_CAST argv[2], BAD_CAST argv[3])) {
usage(argv[0]);
return(-1);
}
/* Shutdown libxml */
xmlCleanupParser();
/*
* this is to debug memory for regression tests
*/
xmlMemoryDump();
return 0;
}
/**
* usage:
* @name: the program name.
*
* Prints usage information.
*/
static void
usage(const char *name) {
assert(name);
fprintf(stderr, "Usage: %s <xml-file> <xpath-expr> <value>\n", name);
}
/**
* example4:
* @filename: the input XML filename.
* @xpathExpr: the xpath expression for evaluation.
* @value: the new node content.
*
* Parses input XML file, evaluates XPath expression and update the nodes
* then print the result.
*
* Returns 0 on success and a negative value otherwise.
*/
static int
example4(const char* filename, const xmlChar* xpathExpr, const xmlChar* value) {
xmlDocPtr doc;
xmlXPathContextPtr xpathCtx;
xmlXPathObjectPtr xpathObj;
assert(filename);
assert(xpathExpr);
assert(value);
/* Load XML document */
doc = xmlParseFile(filename);
if (doc == NULL) {
fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
return(-1);
}
/* Create xpath evaluation context */
xpathCtx = xmlXPathNewContext(doc);
if(xpathCtx == NULL) {
fprintf(stderr,"Error: unable to create new XPath context\n");
xmlFreeDoc(doc);
return(-1);
}
/* Evaluate xpath expression */
xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx);
if(xpathObj == NULL) {
fprintf(stderr,"Error: unable to evaluate xpath expression \"%s\"\n", xpathExpr);
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
return(-1);
}
/* update selected nodes */
update_xpath_nodes(xpathObj->nodesetval, value);
/* Cleanup of XPath data */
xmlXPathFreeObject(xpathObj);
xmlXPathFreeContext(xpathCtx);
/* dump the resulting document */
xmlDocDump(stdout, doc);
/* free the document */
xmlFreeDoc(doc);
return(0);
}
/**
* update_xpath_nodes:
* @nodes: the nodes set.
* @value: the new value for the node(s)
*
* Prints the @nodes content to @output.
*/
static void
update_xpath_nodes(xmlNodeSetPtr nodes, const xmlChar* value) {
int size;
int i;
assert(value);
size = (nodes) ? nodes->nodeNr : 0;
/*
* NOTE: the nodes are processed in reverse order, i.e. reverse document
* order because xmlNodeSetContent can actually free up descendant
* of the node and such nodes may have been selected too ! Handling
* in reverse order ensure that descendant are accessed first, before
* they get removed. Mixing XPath and modifications on a tree must be
* done carefully !
*/
for(i = size - 1; i >= 0; i--) {
assert(nodes->nodeTab[i]);
xmlNodeSetContent(nodes->nodeTab[i], value);
/*
* All the elements returned by an XPath query are pointers to
* elements from the tree *except* namespace nodes where the XPath
* semantic is different from the implementation in libxml2 tree.
* As a result when a returned node set is freed when
* xmlXPathFreeObject() is called, that routine must check the
* element type. But node from the returned set may have been removed
* by xmlNodeSetContent() resulting in access to freed data.
* This can be exercised by running
* valgrind xpath2 test3.xml '//discarded' discarded
* There is 2 ways around it:
* - make a copy of the pointers to the nodes from the result set
* then call xmlXPathFreeObject() and then modify the nodes
* or
* - remove the reference to the modified nodes from the node set
* as they are processed, if they are not namespace nodes.
*/
if (nodes->nodeTab[i]->type != XML_NAMESPACE_DECL)
nodes->nodeTab[i] = NULL;
}
}
#else
int main(void) {
fprintf(stderr, "XPath support not compiled in\n");
exit(1);
}
#endif
|
526acf5543f9c7396e4d241671bfec985ba617de
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/x11/kdelibs4/patches/patch-kdecore_io_kdirwatch__p.h
|
b0712959a780d4f8a7a9e75adcc3dd5b1559541c
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 445
|
h
|
patch-kdecore_io_kdirwatch__p.h
|
$NetBSD: patch-kdecore_io_kdirwatch__p.h,v 1.1 2015/01/31 22:52:56 jperkin Exp $
SunOS inotify requires sys/filio.h for FIONREAD
--- kdecore/io/kdirwatch_p.h.orig 2014-11-06 22:33:50.000000000 +0000
+++ kdecore/io/kdirwatch_p.h
@@ -52,6 +52,9 @@ class QSocketNotifier;
#include <unistd.h>
#include <fcntl.h>
#include <sys/inotify.h>
+#ifdef __sun
+#include <sys/filio.h>
+#endif
#ifndef IN_DONT_FOLLOW
#define IN_DONT_FOLLOW 0x02000000
|
8384fd03052f44cbf905faf83a59146f562200f1
|
6ff85b80c6fe1b3ad5416a304b93551a5e80de10
|
/C/Algorithm/DeleteItem.c
|
ef3f77c84cc33364894538e8d9c5646c7a024f0f
|
[
"MIT"
] |
permissive
|
maniero/SOpt
|
c600cc2333e0a47ce013be3516bbb8080502ff2a
|
5d17e1a9cbf115eaea6d30af2079d0c92ffff7a3
|
refs/heads/master
| 2023-08-10T16:48:46.058739
| 2023-08-10T13:42:17
| 2023-08-10T13:42:17
| 78,631,930
| 1,002
| 136
|
MIT
| 2023-01-28T12:10:01
| 2017-01-11T11:19:24
|
C#
|
UTF-8
|
C
| false
| false
| 643
|
c
|
DeleteItem.c
|
void eliminar() { //o certo é receber o array como parâmetro
Livro cadas_livro[MAX]; //isto está bem errado, em todas funções
char Nome_livro[20];
printf("Insira o nome do livro a eliminar");
fgets(Nome_livro, 20, stdin);
for (int i = 0; i <= MAX; i++) { //MAX não vai dar certo se o número é variável
if (strcmp(cadas_livro[i].Nome_livro, Nome_livro)) {
for (int j = i; j <= MAX; j++) { //precisa "puxar" todos os seguintes
cadas_livro[j] = cadas_livro[j + 1];
}
} else printf("Livro nao encontrado\n");
}
}
//https://pt.stackoverflow.com/q/138360/101
|
93ae62283ff0dfdcb68db58fec050f3456bf964a
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/japanese/kon2-16dot/files/patch-lib_coding.c
|
dbb2af5f95d818972e6804f1b9e96bdbefeb65b3
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 239
|
c
|
patch-lib_coding.c
|
--- lib/coding.c.orig 1997-01-24 16:08:40.000000000 +0900
+++ lib/coding.c 2012-05-10 00:14:28.797032559 +0900
@@ -28,6 +28,7 @@
#include <config.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <interface.h>
|
4312b6d4b6a5bb8ea8c439ffb3c7e1491929411a
|
cdbc0478f7d630d7c7bbbd7cfce2499f0fe4689b
|
/C/kmp.c
|
a40b33d028b349ae7cb566c72c2cea48fee55dbe
|
[
"MIT"
] |
permissive
|
sukritishah15/DS-Algo-Point
|
79bf3f7767592e5d6dd49b97a14a800b90c82e88
|
1b6040f7d9af5830882b53916e83d53a9c0d67d1
|
refs/heads/master
| 2023-08-28T18:17:55.003418
| 2022-10-08T12:53:58
| 2022-10-08T12:53:58
| 299,329,204
| 1,185
| 514
|
MIT
| 2023-01-22T07:12:14
| 2020-09-28T14:09:43
|
Java
|
UTF-8
|
C
| false
| false
| 2,043
|
c
|
kmp.c
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
void computeLPSArray(char *pat, int M, int *lps);
void KMPSearch(char *pat, char *txt)
{
int M = strlen(pat);
int N = strlen(txt);
// create lps[] that will hold the longest prefix suffix
// values for pattern
int *lps = (int *)malloc(sizeof(int)*M);
int j = 0; // index for pat[]
// Preprocess the pattern (calculate lps[] array)
computeLPSArray(pat, M, lps);
int i = 0; // index for txt[]
while (i < N)
{
if (pat[j] == txt[i])
{
j++;
i++;
}
if (j == M)
{
printf("Found pattern at index %d \n", i-j);
j = lps[j-1];
}
// mismatch after j matches
else if (i < N && pat[j] != txt[i])
{
// Do not match lps[0..lps[j-1]] characters,
// they will match anyway
if (j != 0)
j = lps[j-1];
else
i = i+1;
}
}
free(lps); // to avoid memory leak
}
void computeLPSArray(char *pat, int M, int *lps)
{
int len = 0; // length of the previous longest prefix suffix
int i;
lps[0] = 0; // lps[0] is always 0
i = 1;
// the loop calculates lps[i] for i = 1 to M-1
while (i < M)
{
if (pat[i] == pat[len])
{
len++;
lps[i] = len;
i++;
}
else // (pat[i] != pat[len])
{
if (len != 0)
{
// This is tricky. Consider the example
// AAACAAAA and i = 7.
len = lps[len-1];
// Also, note that we do not increment i here
}
else // if (len == 0)
{
lps[i] = 0;
i++;
}
}
}
}
// Driver program to test above function
int main()
{
char *txt = "ABABDABACDABABCABAB";
char *pat = "ABABCABAB";
KMPSearch(pat, txt);
return 0;
}
/*
Time Complexity - O(N+M)
Space Complexity = O(M)
Input -already taken in the code.
Output -Found pattern at index 10
*/
|
79ded556c3ccd131926cb9ed2389459dcdaf96f9
|
847ebadf2b0e7c01ad33ce92b42528a1a5c4846c
|
/lib/dpif-netdev-private-dpif.c
|
ef4cee2bad444083361a4bb13d0f701ccea9e876
|
[
"Apache-2.0",
"BSD-3-Clause",
"ISC",
"SISSL",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] |
permissive
|
openvswitch/ovs
|
6f782527cf5fde4ccfd25e68d359b91ff41acf8a
|
bc79a7bf033fa4cda8ccfc5481db3cfccd72650c
|
refs/heads/master
| 2023-09-04T06:31:47.899017
| 2023-08-03T16:19:12
| 2023-09-01T20:15:05
| 18,383,364
| 3,366
| 2,259
|
Apache-2.0
| 2023-08-17T13:17:13
| 2014-04-02T22:15:28
|
C
|
UTF-8
|
C
| false
| false
| 4,730
|
c
|
dpif-netdev-private-dpif.c
|
/*
* Copyright (c) 2021 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <config.h>
#include "dpif-netdev-private-dpif.h"
#include "dpif-netdev-private-thread.h"
#include <errno.h>
#include <string.h>
#include "cpu.h"
#include "openvswitch/dynamic-string.h"
#include "openvswitch/vlog.h"
#include "util.h"
VLOG_DEFINE_THIS_MODULE(dpif_netdev_impl);
#define DPIF_NETDEV_IMPL_AVX512_CHECK (__x86_64__ && HAVE_AVX512F \
&& HAVE_LD_AVX512_GOOD && __SSE4_2__)
enum dpif_netdev_impl_info_idx {
DPIF_NETDEV_IMPL_SCALAR,
DPIF_NETDEV_IMPL_AVX512
};
#if DPIF_NETDEV_IMPL_AVX512_CHECK
static int32_t
dp_netdev_input_outer_avx512_probe(void)
{
if (!cpu_has_isa(OVS_CPU_ISA_X86_AVX512F)
|| !cpu_has_isa(OVS_CPU_ISA_X86_BMI2)) {
return -ENOTSUP;
}
return 0;
}
#endif
/* Actual list of implementations goes here. */
static struct dpif_netdev_impl_info_t dpif_impls[] = {
/* The default scalar C code implementation. */
[DPIF_NETDEV_IMPL_SCALAR] = { .input_func = dp_netdev_input,
.probe = NULL,
.name = "dpif_scalar", },
#if DPIF_NETDEV_IMPL_AVX512_CHECK
/* Only available on x86_64 bit builds with SSE 4.2 used for OVS core. */
[DPIF_NETDEV_IMPL_AVX512] = { .input_func = dp_netdev_input_outer_avx512,
.probe = dp_netdev_input_outer_avx512_probe,
.name = "dpif_avx512", },
#endif
};
static dp_netdev_input_func default_dpif_func;
dp_netdev_input_func
dp_netdev_impl_get_default(void)
{
/* For the first call, this will be NULL. Compute the compile time default.
*/
if (!default_dpif_func) {
int dpif_idx = DPIF_NETDEV_IMPL_SCALAR;
/* Configure-time overriding to run test suite on all implementations. */
#if DPIF_NETDEV_IMPL_AVX512_CHECK
#ifdef DPIF_AVX512_DEFAULT
dp_netdev_input_func_probe probe;
/* Check if the compiled default is compatible. */
probe = dpif_impls[DPIF_NETDEV_IMPL_AVX512].probe;
if (!probe || !probe()) {
dpif_idx = DPIF_NETDEV_IMPL_AVX512;
}
#endif
#endif
VLOG_INFO("Default DPIF implementation is %s.\n",
dpif_impls[dpif_idx].name);
default_dpif_func = dpif_impls[dpif_idx].input_func;
}
return default_dpif_func;
}
void
dp_netdev_impl_get(struct ds *reply, struct dp_netdev_pmd_thread **pmd_list,
size_t n)
{
/* Add all dpif functions to reply string. */
ds_put_cstr(reply, "Available DPIF implementations:\n");
for (uint32_t i = 0; i < ARRAY_SIZE(dpif_impls); i++) {
ds_put_format(reply, " %s (pmds: ", dpif_impls[i].name);
for (size_t j = 0; j < n; j++) {
struct dp_netdev_pmd_thread *pmd = pmd_list[j];
if (pmd->core_id == NON_PMD_CORE_ID) {
continue;
}
if (pmd->netdev_input_func == dpif_impls[i].input_func) {
ds_put_format(reply, "%u,", pmd->core_id);
}
}
ds_chomp(reply, ',');
if (ds_last(reply) == ' ') {
ds_put_cstr(reply, "none");
}
ds_put_cstr(reply, ")\n");
}
}
/* This function checks all available DPIF implementations, and selects the
* returns the function pointer to the one requested by "name".
*/
static int32_t
dp_netdev_impl_get_by_name(const char *name, dp_netdev_input_func *out_func)
{
ovs_assert(name);
ovs_assert(out_func);
uint32_t i;
for (i = 0; i < ARRAY_SIZE(dpif_impls); i++) {
if (strcmp(dpif_impls[i].name, name) == 0) {
/* Probe function is optional - so check it is set before exec. */
if (dpif_impls[i].probe) {
int probe_err = dpif_impls[i].probe();
if (probe_err) {
*out_func = NULL;
return probe_err;
}
}
*out_func = dpif_impls[i].input_func;
return 0;
}
}
return -EINVAL;
}
int32_t
dp_netdev_impl_set_default_by_name(const char *name)
{
dp_netdev_input_func new_default;
int32_t err = dp_netdev_impl_get_by_name(name, &new_default);
if (!err) {
default_dpif_func = new_default;
}
return err;
}
|
bf85f533d9100bfd47444a26d26d8a40ba7a6a80
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/operators/AMRStitchCell/AMRStitchCellViewerPluginInfo.C
|
3a208b95dd0c9db3741be336e350ab4307101aed
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 1,074
|
c
|
AMRStitchCellViewerPluginInfo.C
|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
// ****************************************************************************
// File: AMRStitchCellViewerPluginInfo.C
// ****************************************************************************
#include <AMRStitchCellPluginInfo.h>
#include <AMRStitchCellAttributes.h>
VISIT_OPERATOR_PLUGIN_ENTRY_EV(AMRStitchCell,Viewer)
// ****************************************************************************
// Method: AMRStitchCellViewerPluginInfo::XPMIconData
//
// Purpose:
// Return a pointer to the icon data.
//
// Returns: A pointer to the icon data.
//
// Programmer: generated by xml2info
// Creation: omitted
//
// ****************************************************************************
#include <AMRStitchCell.xpm>
const char **
AMRStitchCellViewerPluginInfo::XPMIconData() const
{
return AMRStitchCell_xpm;
}
|
9240718369d6b54ba94d70ef6bc82f9c7f4cb5ee
|
cfe8ea74ce5651e9954b3e9c6e4e495e031e0ad7
|
/cl_dll/hud_benchtrace.h
|
86093218d4ba89f7f1ab948aa84290a13f6b2af7
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"curl"
] |
permissive
|
YaLTeR/OpenAG
|
dd699ec10d25672bf640812cd118f09ca92523b3
|
78fac3a9d0d8c033166f13d099d50ca1410e89e4
|
refs/heads/master
| 2023-05-10T17:15:01.445266
| 2023-05-02T04:20:02
| 2023-05-02T04:20:02
| 61,480,530
| 139
| 63
|
NOASSERTION
| 2022-12-31T00:07:53
| 2016-06-19T13:03:05
|
C++
|
UTF-8
|
C
| false
| false
| 200
|
h
|
hud_benchtrace.h
|
#if !defined( HUD_BENCHTRACEH )
#define HUD_BENCHTRACEH
#pragma once
void Trace_StartTrace( int *results, int *finished, const char *pszServer );
void Trace_Think( void );
#endif // !HUD_BENCHTRACEH
|
15bdd7b7bb9040648ac4db4588334f2ca7a7c89c
|
2b6a4eddac65e3712d0d06f3a0262dae6253263e
|
/Source/src/WixSharp.Samples/Wix_bin/SDK/inc/dlutil.h
|
3e95103acc0d6f5212a521b135ea1cc867807547
|
[
"MIT"
] |
permissive
|
oleg-shilo/wixsharp
|
6005721bb7607b7060b99d6e4f5569b3404ca63d
|
7601893a5e9e14408ce9ef63415290d5c56254a6
|
refs/heads/master
| 2023-08-24T07:45:11.137770
| 2023-07-22T10:50:56
| 2023-07-22T10:50:56
| 49,761,249
| 976
| 245
|
MIT
| 2023-07-22T10:50:57
| 2016-01-16T05:51:01
|
C#
|
UTF-8
|
C
| false
| false
| 1,333
|
h
|
dlutil.h
|
#pragma once
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#ifdef __cplusplus
extern "C" {
#endif
typedef HRESULT (WINAPI *LPAUTHENTICATION_ROUTINE)(
__in LPVOID pVoid,
__in HINTERNET hUrl,
__in long lHttpCode,
__out BOOL* pfRetrySend,
__out BOOL* pfRetry
);
typedef int (WINAPI *LPCANCEL_ROUTINE)(
__in HRESULT hrError,
__in_z_opt LPCWSTR wzError,
__in BOOL fAllowRetry,
__in_opt LPVOID pvContext
);
// structs
typedef struct _DOWNLOAD_SOURCE
{
LPWSTR sczUrl;
LPWSTR sczUser;
LPWSTR sczPassword;
} DOWNLOAD_SOURCE;
typedef struct _DOWNLOAD_CACHE_CALLBACK
{
LPPROGRESS_ROUTINE pfnProgress;
LPCANCEL_ROUTINE pfnCancel;
LPVOID pv;
} DOWNLOAD_CACHE_CALLBACK;
typedef struct _DOWNLOAD_AUTHENTICATION_CALLBACK
{
LPAUTHENTICATION_ROUTINE pfnAuthenticate;
LPVOID pv;
} DOWNLOAD_AUTHENTICATION_CALLBACK;
// functions
HRESULT DAPI DownloadUrl(
__in DOWNLOAD_SOURCE* pDownloadSource,
__in DWORD64 dw64AuthoredDownloadSize,
__in LPCWSTR wzDestinationPath,
__in_opt DOWNLOAD_CACHE_CALLBACK* pCache,
__in_opt DOWNLOAD_AUTHENTICATION_CALLBACK* pAuthenticate
);
#ifdef __cplusplus
}
#endif
|
4ab05087b47d5c5057a2fb772837a93d9746fd01
|
9907672fcd81ab73ac63b2a83422a82bf31eadde
|
/tyama_icpc2012s3bC(aizu2442).c
|
3675ba0dceb7a83807da81dde6563600cc067ac8
|
[
"0BSD"
] |
permissive
|
cielavenir/procon
|
bbe1974b9bddb51b76d58722a0686a5b477c4456
|
746e1a91f574f20647e8aaaac0d9e6173f741176
|
refs/heads/master
| 2023-06-21T23:11:24.562546
| 2023-06-11T13:15:15
| 2023-06-11T13:15:15
| 7,557,464
| 137
| 136
| null | 2020-10-20T09:35:52
| 2013-01-11T09:40:26
|
C++
|
UTF-8
|
C
| false
| false
| 223
|
c
|
tyama_icpc2012s3bC(aizu2442).c
|
#define Z(x,i)(x[i]+x[n/2+i])
x[99],y[99],X,Y;
n,i;main(){
for(gets(x);~scanf("%d %d",x+n,y+n);n++);
if(!(n&1))for(X=Z(x,0),Y=Z(y,0);++i<n/2&&Z(x,i)==X&&Z(y,i)==Y;);
printf(i==n/2?"%f %f\n":"NA\n",X/2.0,Y/2.0);exit(0);
}
|
8c3cb39e4b05f3ef50af16d0883c18f339dfa41a
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/pthreadpool/src/examples/addition.c
|
de806dfefede91cfa047aa59ab280a4e64d76167
|
[
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 1,291
|
c
|
addition.c
|
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
#include <pthreadpool.h>
struct array_addition_context {
double *augend;
double *addend;
double *sum;
};
static void add_arrays(struct array_addition_context* context, size_t i) {
context->sum[i] = context->augend[i] + context->addend[i];
}
#define ARRAY_SIZE 4
int main() {
double augend[ARRAY_SIZE] = { 1.0, 2.0, 4.0, -5.0 };
double addend[ARRAY_SIZE] = { 0.25, -1.75, 0.0, 0.5 };
double sum[ARRAY_SIZE];
pthreadpool_t threadpool = pthreadpool_create(0);
assert(threadpool != NULL);
const size_t threads_count = pthreadpool_get_threads_count(threadpool);
printf("Created thread pool with %zu threads\n", threads_count);
struct array_addition_context context = { augend, addend, sum };
pthreadpool_parallelize_1d(threadpool,
(pthreadpool_task_1d_t) add_arrays,
(void**) &context,
ARRAY_SIZE,
PTHREADPOOL_FLAG_DISABLE_DENORMALS /* flags */);
pthreadpool_destroy(threadpool);
threadpool = NULL;
printf("%8s\t%.2lf\t%.2lf\t%.2lf\t%.2lf\n", "Augend",
augend[0], augend[1], augend[2], augend[3]);
printf("%8s\t%.2lf\t%.2lf\t%.2lf\t%.2lf\n", "Addend",
addend[0], addend[1], addend[2], addend[3]);
printf("%8s\t%.2lf\t%.2lf\t%.2lf\t%.2lf\n", "Sum",
sum[0], sum[1], sum[2], sum[3]);
return 0;
}
|
a175582ac2de7182948c9bd1d99851ffdb1bdc9b
|
1577e1cf4e89584a125cffb855ca50a9654c6d55
|
/NFS/nfsrvTests/nfs_prot/nfs_prot_xdr.c
|
13caa26f86bd2b75d6c72f76c557a11af89ac9c7
|
[] |
no_license
|
apple-open-source/macos
|
a4188b5c2ef113d90281d03cd1b14e5ee52ebffb
|
2d2b15f13487673de33297e49f00ef94af743a9a
|
refs/heads/master
| 2023-08-01T11:03:26.870408
| 2023-03-27T00:00:00
| 2023-03-27T00:00:00
| 180,595,052
| 124
| 24
| null | 2022-12-27T14:54:09
| 2019-04-10T14:06:23
| null |
UTF-8
|
C
| false
| false
| 47,198
|
c
|
nfs_prot_xdr.c
|
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include "nfs_prot.h"
#ifndef lint
/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/
/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
#endif /* not lint */
#include <sys/cdefs.h>
__RCSID("$FreeBSD: src/include/rpcsvc/nfs_prot.x,v 1.8 2003/05/04 02:51:42 obrien Exp $");
bool_t
xdr_nfsstat(XDR *xdrs, nfsstat *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_ftype(XDR *xdrs, ftype *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfs_fh(XDR *xdrs, nfs_fh *objp)
{
if (!xdr_opaque(xdrs, objp->data, NFS_FHSIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfstime(XDR *xdrs, nfstime *objp)
{
if (!xdr_u_int(xdrs, &objp->seconds))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->useconds))
return (FALSE);
return (TRUE);
}
bool_t
xdr_fattr(XDR *xdrs, fattr *objp)
{
int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
if (!xdr_ftype(xdrs, &objp->type))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 10 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->nlink))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocksize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->rdev))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fsid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fileid))
return (FALSE);
} else {
IXDR_PUT_U_LONG(buf, objp->mode);
IXDR_PUT_U_LONG(buf, objp->nlink);
IXDR_PUT_U_LONG(buf, objp->uid);
IXDR_PUT_U_LONG(buf, objp->gid);
IXDR_PUT_U_LONG(buf, objp->size);
IXDR_PUT_U_LONG(buf, objp->blocksize);
IXDR_PUT_U_LONG(buf, objp->rdev);
IXDR_PUT_U_LONG(buf, objp->blocks);
IXDR_PUT_U_LONG(buf, objp->fsid);
IXDR_PUT_U_LONG(buf, objp->fileid);
}
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->ctime))
return (FALSE);
} else if (xdrs->x_op == XDR_DECODE) {
if (!xdr_ftype(xdrs, &objp->type))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 10 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->nlink))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocksize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->rdev))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fsid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fileid))
return (FALSE);
} else {
objp->mode = IXDR_GET_U_LONG(buf);
objp->nlink = IXDR_GET_U_LONG(buf);
objp->uid = IXDR_GET_U_LONG(buf);
objp->gid = IXDR_GET_U_LONG(buf);
objp->size = IXDR_GET_U_LONG(buf);
objp->blocksize = IXDR_GET_U_LONG(buf);
objp->rdev = IXDR_GET_U_LONG(buf);
objp->blocks = IXDR_GET_U_LONG(buf);
objp->fsid = IXDR_GET_U_LONG(buf);
objp->fileid = IXDR_GET_U_LONG(buf);
}
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->ctime))
return (FALSE);
} else {
if (!xdr_ftype(xdrs, &objp->type))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->nlink))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocksize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->rdev))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fsid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->fileid))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->ctime))
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_sattr(XDR *xdrs, sattr *objp)
{
int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
buf = (int32_t *)XDR_INLINE(xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
} else {
IXDR_PUT_U_LONG(buf, objp->mode);
IXDR_PUT_U_LONG(buf, objp->uid);
IXDR_PUT_U_LONG(buf, objp->gid);
IXDR_PUT_U_LONG(buf, objp->size);
}
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
} else if (xdrs->x_op == XDR_DECODE) {
buf = (int32_t *)XDR_INLINE(xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
} else {
objp->mode = IXDR_GET_U_LONG(buf);
objp->uid = IXDR_GET_U_LONG(buf);
objp->gid = IXDR_GET_U_LONG(buf);
objp->size = IXDR_GET_U_LONG(buf);
}
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
} else {
if (!xdr_u_int(xdrs, &objp->mode))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->uid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->gid))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->size))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime(xdrs, &objp->mtime))
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_filename(XDR *xdrs, filename *objp)
{
if (!xdr_string(xdrs, objp, NFS_MAXNAMLEN))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfspath(XDR *xdrs, nfspath *objp)
{
if (!xdr_string(xdrs, objp, NFS_MAXPATHLEN))
return (FALSE);
return (TRUE);
}
bool_t
xdr_attrstat(XDR *xdrs, attrstat *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_fattr(xdrs, &objp->attrstat_u.attributes))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_sattrargs(XDR *xdrs, sattrargs *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
if (!xdr_sattr(xdrs, &objp->attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_diropargs(XDR *xdrs, diropargs *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->dir))
return (FALSE);
if (!xdr_filename(xdrs, &objp->name))
return (FALSE);
return (TRUE);
}
bool_t
xdr_diropokres(XDR *xdrs, diropokres *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
if (!xdr_fattr(xdrs, &objp->attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_diropres(XDR *xdrs, diropres *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_diropokres(xdrs, &objp->diropres_u.diropres))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_readlinkres(XDR *xdrs, readlinkres *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_nfspath(xdrs, &objp->readlinkres_u.data))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_readargs(XDR *xdrs, readargs *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->offset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->count))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->totalcount))
return (FALSE);
return (TRUE);
}
bool_t
xdr_readokres(XDR *xdrs, readokres *objp)
{
if (!xdr_fattr(xdrs, &objp->attributes))
return (FALSE);
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA))
return (FALSE);
return (TRUE);
}
bool_t
xdr_readres(XDR *xdrs, readres *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_readokres(xdrs, &objp->readres_u.reply))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_writeargs(XDR *xdrs, writeargs *objp)
{
int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 3 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->beginoffset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->offset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->totalcount))
return (FALSE);
} else {
IXDR_PUT_U_LONG(buf, objp->beginoffset);
IXDR_PUT_U_LONG(buf, objp->offset);
IXDR_PUT_U_LONG(buf, objp->totalcount);
}
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA))
return (FALSE);
} else if (xdrs->x_op == XDR_DECODE) {
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 3 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->beginoffset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->offset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->totalcount))
return (FALSE);
} else {
objp->beginoffset = IXDR_GET_U_LONG(buf);
objp->offset = IXDR_GET_U_LONG(buf);
objp->totalcount = IXDR_GET_U_LONG(buf);
}
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA))
return (FALSE);
} else {
if (!xdr_nfs_fh(xdrs, &objp->file))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->beginoffset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->offset))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->totalcount))
return (FALSE);
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS_MAXDATA))
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_createargs(XDR *xdrs, createargs *objp)
{
if (!xdr_diropargs(xdrs, &objp->where))
return (FALSE);
if (!xdr_sattr(xdrs, &objp->attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_renameargs(XDR *xdrs, renameargs *objp)
{
if (!xdr_diropargs(xdrs, &objp->from))
return (FALSE);
if (!xdr_diropargs(xdrs, &objp->to))
return (FALSE);
return (TRUE);
}
bool_t
xdr_linkargs(XDR *xdrs, linkargs *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->from))
return (FALSE);
if (!xdr_diropargs(xdrs, &objp->to))
return (FALSE);
return (TRUE);
}
bool_t
xdr_symlinkargs(XDR *xdrs, symlinkargs *objp)
{
if (!xdr_diropargs(xdrs, &objp->from))
return (FALSE);
if (!xdr_nfspath(xdrs, &objp->to))
return (FALSE);
if (!xdr_sattr(xdrs, &objp->attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfscookie(XDR *xdrs, nfscookie objp)
{
if (!xdr_opaque(xdrs, objp, NFS_COOKIESIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_readdirargs(XDR *xdrs, readdirargs *objp)
{
if (!xdr_nfs_fh(xdrs, &objp->dir))
return (FALSE);
if (!xdr_nfscookie(xdrs, objp->cookie))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->count))
return (FALSE);
return (TRUE);
}
bool_t
xdr_entry1(XDR *xdrs, entry1 *objp)
{
if (!xdr_u_int(xdrs, &objp->fileid))
return (FALSE);
if (!xdr_filename(xdrs, &objp->name))
return (FALSE);
if (!xdr_nfscookie(xdrs, objp->cookie))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry1), (xdrproc_t)xdr_entry1))
return (FALSE);
return (TRUE);
}
bool_t
xdr_dirlist(XDR *xdrs, dirlist *objp)
{
if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entry1), (xdrproc_t)xdr_entry1))
return (FALSE);
if (!xdr_bool(xdrs, &objp->eof))
return (FALSE);
return (TRUE);
}
bool_t
xdr_readdirres(XDR *xdrs, readdirres *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_dirlist(xdrs, &objp->readdirres_u.reply))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_statfsokres(XDR *xdrs, statfsokres *objp)
{
int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
buf = (int32_t *)XDR_INLINE(xdrs, 5 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->tsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bfree))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bavail))
return (FALSE);
} else {
IXDR_PUT_U_LONG(buf, objp->tsize);
IXDR_PUT_U_LONG(buf, objp->bsize);
IXDR_PUT_U_LONG(buf, objp->blocks);
IXDR_PUT_U_LONG(buf, objp->bfree);
IXDR_PUT_U_LONG(buf, objp->bavail);
}
} else if (xdrs->x_op == XDR_DECODE) {
buf = (int32_t *)XDR_INLINE(xdrs, 5 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_u_int(xdrs, &objp->tsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bfree))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bavail))
return (FALSE);
} else {
objp->tsize = IXDR_GET_U_LONG(buf);
objp->bsize = IXDR_GET_U_LONG(buf);
objp->blocks = IXDR_GET_U_LONG(buf);
objp->bfree = IXDR_GET_U_LONG(buf);
objp->bavail = IXDR_GET_U_LONG(buf);
}
} else {
if (!xdr_u_int(xdrs, &objp->tsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bsize))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->blocks))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bfree))
return (FALSE);
if (!xdr_u_int(xdrs, &objp->bavail))
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_statfsres(XDR *xdrs, statfsres *objp)
{
if (!xdr_nfsstat(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS_OK:
if (!xdr_statfsokres(xdrs, &objp->statfsres_u.reply))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_uint64(XDR *xdrs, uint64 *objp)
{
if (!xdr_u_int64_t(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_int64(XDR *xdrs, int64 *objp)
{
if (!xdr_int64_t(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_uint32(XDR *xdrs, uint32 *objp)
{
if (!xdr_u_int(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_int32(XDR *xdrs, int32 *objp)
{
if (!xdr_int(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_filename3(XDR *xdrs, filename3 *objp)
{
if (!xdr_string(xdrs, objp, ~0))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfspath3(XDR *xdrs, nfspath3 *objp)
{
if (!xdr_string(xdrs, objp, ~0))
return (FALSE);
return (TRUE);
}
bool_t
xdr_fileid3(XDR *xdrs, fileid3 *objp)
{
if (!xdr_uint64(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_cookie3(XDR *xdrs, cookie3 *objp)
{
if (!xdr_uint64(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_cookieverf3(XDR *xdrs, cookieverf3 objp)
{
if (!xdr_opaque(xdrs, objp, NFS3_COOKIEVERFSIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_createverf3(XDR *xdrs, createverf3 objp)
{
if (!xdr_opaque(xdrs, objp, NFS3_CREATEVERFSIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_writeverf3(XDR *xdrs, writeverf3 objp)
{
if (!xdr_opaque(xdrs, objp, NFS3_WRITEVERFSIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_uid3(XDR *xdrs, uid3 *objp)
{
if (!xdr_uint32(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_gid3(XDR *xdrs, gid3 *objp)
{
if (!xdr_uint32(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_size3(XDR *xdrs, size3 *objp)
{
if (!xdr_uint64(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_offset3(XDR *xdrs, offset3 *objp)
{
if (!xdr_uint64(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_mode3(XDR *xdrs, mode3 *objp)
{
if (!xdr_uint32(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_count3(XDR *xdrs, count3 *objp)
{
if (!xdr_uint32(xdrs, objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfsstat3(XDR *xdrs, nfsstat3 *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_ftype3(XDR *xdrs, ftype3 *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_specdata3(XDR *xdrs, specdata3 *objp)
{
if (!xdr_uint32(xdrs, &objp->specdata1))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->specdata2))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfs_fh3(XDR *xdrs, nfs_fh3 *objp)
{
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, NFS3_FHSIZE))
return (FALSE);
return (TRUE);
}
bool_t
xdr_nfstime3(XDR *xdrs, nfstime3 *objp)
{
if (!xdr_uint32(xdrs, &objp->seconds))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->nseconds))
return (FALSE);
return (TRUE);
}
bool_t
xdr_fattr3(XDR *xdrs, fattr3 *objp)
{
if (!xdr_ftype3(xdrs, &objp->type))
return (FALSE);
if (!xdr_mode3(xdrs, &objp->mode))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->nlink))
return (FALSE);
if (!xdr_uid3(xdrs, &objp->uid))
return (FALSE);
if (!xdr_gid3(xdrs, &objp->gid))
return (FALSE);
if (!xdr_size3(xdrs, &objp->size))
return (FALSE);
if (!xdr_size3(xdrs, &objp->used))
return (FALSE);
if (!xdr_specdata3(xdrs, &objp->rdev))
return (FALSE);
if (!xdr_uint64(xdrs, &objp->fsid))
return (FALSE);
if (!xdr_fileid3(xdrs, &objp->fileid))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->atime))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->mtime))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->ctime))
return (FALSE);
return (TRUE);
}
bool_t
xdr_post_op_attr(XDR *xdrs, post_op_attr *objp)
{
if (!xdr_bool(xdrs, &objp->attributes_follow))
return (FALSE);
switch (objp->attributes_follow) {
case TRUE:
if (!xdr_fattr3(xdrs, &objp->post_op_attr_u.attributes))
return (FALSE);
break;
case FALSE:
break;
default:
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_wcc_attr(XDR *xdrs, wcc_attr *objp)
{
if (!xdr_size3(xdrs, &objp->size))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->mtime))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->ctime))
return (FALSE);
return (TRUE);
}
bool_t
xdr_pre_op_attr(XDR *xdrs, pre_op_attr *objp)
{
if (!xdr_bool(xdrs, &objp->attributes_follow))
return (FALSE);
switch (objp->attributes_follow) {
case TRUE:
if (!xdr_wcc_attr(xdrs, &objp->pre_op_attr_u.attributes))
return (FALSE);
break;
case FALSE:
break;
default:
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_wcc_data(XDR *xdrs, wcc_data *objp)
{
if (!xdr_pre_op_attr(xdrs, &objp->before))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->after))
return (FALSE);
return (TRUE);
}
bool_t
xdr_post_op_fh3(XDR *xdrs, post_op_fh3 *objp)
{
if (!xdr_bool(xdrs, &objp->handle_follows))
return (FALSE);
switch (objp->handle_follows) {
case TRUE:
if (!xdr_nfs_fh3(xdrs, &objp->post_op_fh3_u.handle))
return (FALSE);
break;
case FALSE:
break;
default:
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_time_how(XDR *xdrs, time_how *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_set_mode3(XDR *xdrs, set_mode3 *objp)
{
if (!xdr_bool(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case TRUE:
if (!xdr_mode3(xdrs, &objp->set_mode3_u.mode))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_set_uid3(XDR *xdrs, set_uid3 *objp)
{
if (!xdr_bool(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case TRUE:
if (!xdr_uid3(xdrs, &objp->set_uid3_u.uid))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_set_gid3(XDR *xdrs, set_gid3 *objp)
{
if (!xdr_bool(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case TRUE:
if (!xdr_gid3(xdrs, &objp->set_gid3_u.gid))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_set_size3(XDR *xdrs, set_size3 *objp)
{
if (!xdr_bool(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case TRUE:
if (!xdr_size3(xdrs, &objp->set_size3_u.size))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_set_atime(XDR *xdrs, set_atime *objp)
{
if (!xdr_time_how(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case SET_TO_CLIENT_TIME:
if (!xdr_nfstime3(xdrs, &objp->set_atime_u.atime))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_set_mtime(XDR *xdrs, set_mtime *objp)
{
if (!xdr_time_how(xdrs, &objp->set_it))
return (FALSE);
switch (objp->set_it) {
case SET_TO_CLIENT_TIME:
if (!xdr_nfstime3(xdrs, &objp->set_mtime_u.mtime))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_sattr3(XDR *xdrs, sattr3 *objp)
{
if (!xdr_set_mode3(xdrs, &objp->mode))
return (FALSE);
if (!xdr_set_uid3(xdrs, &objp->uid))
return (FALSE);
if (!xdr_set_gid3(xdrs, &objp->gid))
return (FALSE);
if (!xdr_set_size3(xdrs, &objp->size))
return (FALSE);
if (!xdr_set_atime(xdrs, &objp->atime))
return (FALSE);
if (!xdr_set_mtime(xdrs, &objp->mtime))
return (FALSE);
return (TRUE);
}
bool_t
xdr_diropargs3(XDR *xdrs, diropargs3 *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->dir))
return (FALSE);
if (!xdr_filename3(xdrs, &objp->name))
return (FALSE);
return (TRUE);
}
bool_t
xdr_GETATTR3args(XDR *xdrs, GETATTR3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->object))
return (FALSE);
return (TRUE);
}
bool_t
xdr_GETATTR3resok(XDR *xdrs, GETATTR3resok *objp)
{
if (!xdr_fattr3(xdrs, &objp->obj_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_GETATTR3res(XDR *xdrs, GETATTR3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_GETATTR3resok(xdrs, &objp->GETATTR3res_u.resok))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_sattrguard3(XDR *xdrs, sattrguard3 *objp)
{
if (!xdr_bool(xdrs, &objp->check))
return (FALSE);
switch (objp->check) {
case TRUE:
if (!xdr_nfstime3(xdrs, &objp->sattrguard3_u.obj_ctime))
return (FALSE);
break;
case FALSE:
break;
default:
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_SETATTR3args(XDR *xdrs, SETATTR3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->object))
return (FALSE);
if (!xdr_sattr3(xdrs, &objp->new_attributes))
return (FALSE);
if (!xdr_sattrguard3(xdrs, &objp->guard))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SETATTR3resok(XDR *xdrs, SETATTR3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->obj_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SETATTR3resfail(XDR *xdrs, SETATTR3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->obj_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SETATTR3res(XDR *xdrs, SETATTR3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_SETATTR3resok(xdrs, &objp->SETATTR3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_SETATTR3resfail(xdrs, &objp->SETATTR3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_LOOKUP3args(XDR *xdrs, LOOKUP3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->what))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LOOKUP3resok(XDR *xdrs, LOOKUP3resok *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->object))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LOOKUP3resfail(XDR *xdrs, LOOKUP3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LOOKUP3res(XDR *xdrs, LOOKUP3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_LOOKUP3resok(xdrs, &objp->LOOKUP3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_LOOKUP3resfail(xdrs, &objp->LOOKUP3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_ACCESS3args(XDR *xdrs, ACCESS3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->object))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->access))
return (FALSE);
return (TRUE);
}
bool_t
xdr_ACCESS3resok(XDR *xdrs, ACCESS3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->access))
return (FALSE);
return (TRUE);
}
bool_t
xdr_ACCESS3resfail(XDR *xdrs, ACCESS3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_ACCESS3res(XDR *xdrs, ACCESS3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_ACCESS3resok(xdrs, &objp->ACCESS3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_ACCESS3resfail(xdrs, &objp->ACCESS3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_READLINK3args(XDR *xdrs, READLINK3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->symlink))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READLINK3resok(XDR *xdrs, READLINK3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes))
return (FALSE);
if (!xdr_nfspath3(xdrs, &objp->data))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READLINK3resfail(XDR *xdrs, READLINK3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READLINK3res(XDR *xdrs, READLINK3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_READLINK3resok(xdrs, &objp->READLINK3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_READLINK3resfail(xdrs, &objp->READLINK3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_READ3args(XDR *xdrs, READ3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->file))
return (FALSE);
if (!xdr_offset3(xdrs, &objp->offset))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READ3resok(XDR *xdrs, READ3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->file_attributes))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
if (!xdr_bool(xdrs, &objp->eof))
return (FALSE);
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, ~0))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READ3resfail(XDR *xdrs, READ3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->file_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READ3res(XDR *xdrs, READ3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_READ3resok(xdrs, &objp->READ3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_READ3resfail(xdrs, &objp->READ3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_stable_how(XDR *xdrs, stable_how *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_WRITE3args(XDR *xdrs, WRITE3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->file))
return (FALSE);
if (!xdr_offset3(xdrs, &objp->offset))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
if (!xdr_stable_how(xdrs, &objp->stable))
return (FALSE);
if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (u_int *)&objp->data.data_len, ~0))
return (FALSE);
return (TRUE);
}
bool_t
xdr_WRITE3resok(XDR *xdrs, WRITE3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->file_wcc))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
if (!xdr_stable_how(xdrs, &objp->committed))
return (FALSE);
if (!xdr_writeverf3(xdrs, objp->verf))
return (FALSE);
return (TRUE);
}
bool_t
xdr_WRITE3resfail(XDR *xdrs, WRITE3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->file_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_WRITE3res(XDR *xdrs, WRITE3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_WRITE3resok(xdrs, &objp->WRITE3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_WRITE3resfail(xdrs, &objp->WRITE3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_createmode3(XDR *xdrs, createmode3 *objp)
{
if (!xdr_enum(xdrs, (enum_t *)objp))
return (FALSE);
return (TRUE);
}
bool_t
xdr_createhow3(XDR *xdrs, createhow3 *objp)
{
if (!xdr_createmode3(xdrs, &objp->mode))
return (FALSE);
switch (objp->mode) {
case UNCHECKED:
case GUARDED:
if (!xdr_sattr3(xdrs, &objp->createhow3_u.obj_attributes))
return (FALSE);
break;
case EXCLUSIVE:
if (!xdr_createverf3(xdrs, objp->createhow3_u.verf))
return (FALSE);
break;
default:
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_CREATE3args(XDR *xdrs, CREATE3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->where))
return (FALSE);
if (!xdr_createhow3(xdrs, &objp->how))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CREATE3resok(XDR *xdrs, CREATE3resok *objp)
{
if (!xdr_post_op_fh3(xdrs, &objp->obj))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CREATE3resfail(XDR *xdrs, CREATE3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_CREATE3res(XDR *xdrs, CREATE3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_CREATE3resok(xdrs, &objp->CREATE3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_CREATE3resfail(xdrs, &objp->CREATE3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_MKDIR3args(XDR *xdrs, MKDIR3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->where))
return (FALSE);
if (!xdr_sattr3(xdrs, &objp->attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKDIR3resok(XDR *xdrs, MKDIR3resok *objp)
{
if (!xdr_post_op_fh3(xdrs, &objp->obj))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKDIR3resfail(XDR *xdrs, MKDIR3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKDIR3res(XDR *xdrs, MKDIR3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_MKDIR3resok(xdrs, &objp->MKDIR3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_MKDIR3resfail(xdrs, &objp->MKDIR3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_symlinkdata3(XDR *xdrs, symlinkdata3 *objp)
{
if (!xdr_sattr3(xdrs, &objp->symlink_attributes))
return (FALSE);
if (!xdr_nfspath3(xdrs, &objp->symlink_data))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SYMLINK3args(XDR *xdrs, SYMLINK3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->where))
return (FALSE);
if (!xdr_symlinkdata3(xdrs, &objp->symlink))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SYMLINK3resok(XDR *xdrs, SYMLINK3resok *objp)
{
if (!xdr_post_op_fh3(xdrs, &objp->obj))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SYMLINK3resfail(XDR *xdrs, SYMLINK3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_SYMLINK3res(XDR *xdrs, SYMLINK3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_SYMLINK3resok(xdrs, &objp->SYMLINK3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_SYMLINK3resfail(xdrs, &objp->SYMLINK3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_devicedata3(XDR *xdrs, devicedata3 *objp)
{
if (!xdr_sattr3(xdrs, &objp->dev_attributes))
return (FALSE);
if (!xdr_specdata3(xdrs, &objp->spec))
return (FALSE);
return (TRUE);
}
bool_t
xdr_mknoddata3(XDR *xdrs, mknoddata3 *objp)
{
if (!xdr_ftype3(xdrs, &objp->type))
return (FALSE);
switch (objp->type) {
case NF3CHR:
case NF3BLK:
if (!xdr_devicedata3(xdrs, &objp->mknoddata3_u.device))
return (FALSE);
break;
case NF3SOCK:
case NF3FIFO:
if (!xdr_sattr3(xdrs, &objp->mknoddata3_u.pipe_attributes))
return (FALSE);
break;
default:
break;
}
return (TRUE);
}
bool_t
xdr_MKNOD3args(XDR *xdrs, MKNOD3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->where))
return (FALSE);
if (!xdr_mknoddata3(xdrs, &objp->what))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKNOD3resok(XDR *xdrs, MKNOD3resok *objp)
{
if (!xdr_post_op_fh3(xdrs, &objp->obj))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKNOD3resfail(XDR *xdrs, MKNOD3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_MKNOD3res(XDR *xdrs, MKNOD3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_MKNOD3resok(xdrs, &objp->MKNOD3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_MKNOD3resfail(xdrs, &objp->MKNOD3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_REMOVE3args(XDR *xdrs, REMOVE3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->object))
return (FALSE);
return (TRUE);
}
bool_t
xdr_REMOVE3resok(XDR *xdrs, REMOVE3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_REMOVE3resfail(XDR *xdrs, REMOVE3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_REMOVE3res(XDR *xdrs, REMOVE3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_REMOVE3resok(xdrs, &objp->REMOVE3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_REMOVE3resfail(xdrs, &objp->REMOVE3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_RMDIR3args(XDR *xdrs, RMDIR3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->object))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RMDIR3resok(XDR *xdrs, RMDIR3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RMDIR3resfail(XDR *xdrs, RMDIR3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->dir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RMDIR3res(XDR *xdrs, RMDIR3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_RMDIR3resok(xdrs, &objp->RMDIR3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_RMDIR3resfail(xdrs, &objp->RMDIR3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_RENAME3args(XDR *xdrs, RENAME3args *objp)
{
if (!xdr_diropargs3(xdrs, &objp->from))
return (FALSE);
if (!xdr_diropargs3(xdrs, &objp->to))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RENAME3resok(XDR *xdrs, RENAME3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->todir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RENAME3resfail(XDR *xdrs, RENAME3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->todir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_RENAME3res(XDR *xdrs, RENAME3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_RENAME3resok(xdrs, &objp->RENAME3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_RENAME3resfail(xdrs, &objp->RENAME3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_LINK3args(XDR *xdrs, LINK3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->file))
return (FALSE);
if (!xdr_diropargs3(xdrs, &objp->link))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LINK3resok(XDR *xdrs, LINK3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->file_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LINK3resfail(XDR *xdrs, LINK3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->file_attributes))
return (FALSE);
if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_LINK3res(XDR *xdrs, LINK3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_LINK3resok(xdrs, &objp->LINK3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_LINK3resfail(xdrs, &objp->LINK3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_READDIR3args(XDR *xdrs, READDIR3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->dir))
return (FALSE);
if (!xdr_cookie3(xdrs, &objp->cookie))
return (FALSE);
if (!xdr_cookieverf3(xdrs, objp->cookieverf))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
return (TRUE);
}
bool_t
xdr_entry3(XDR *xdrs, entry3 *objp)
{
if (!xdr_fileid3(xdrs, &objp->fileid))
return (FALSE);
if (!xdr_filename3(xdrs, &objp->name))
return (FALSE);
if (!xdr_cookie3(xdrs, &objp->cookie))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entry3), (xdrproc_t)xdr_entry3))
return (FALSE);
return (TRUE);
}
bool_t
xdr_dirlist3(XDR *xdrs, dirlist3 *objp)
{
if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entry3), (xdrproc_t)xdr_entry3))
return (FALSE);
if (!xdr_bool(xdrs, &objp->eof))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIR3resok(XDR *xdrs, READDIR3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
if (!xdr_cookieverf3(xdrs, objp->cookieverf))
return (FALSE);
if (!xdr_dirlist3(xdrs, &objp->reply))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIR3resfail(XDR *xdrs, READDIR3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIR3res(XDR *xdrs, READDIR3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_READDIR3resok(xdrs, &objp->READDIR3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_READDIR3resfail(xdrs, &objp->READDIR3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_READDIRPLUS3args(XDR *xdrs, READDIRPLUS3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->dir))
return (FALSE);
if (!xdr_cookie3(xdrs, &objp->cookie))
return (FALSE);
if (!xdr_cookieverf3(xdrs, objp->cookieverf))
return (FALSE);
if (!xdr_count3(xdrs, &objp->dircount))
return (FALSE);
if (!xdr_count3(xdrs, &objp->maxcount))
return (FALSE);
return (TRUE);
}
bool_t
xdr_entryplus3(XDR *xdrs, entryplus3 *objp)
{
if (!xdr_fileid3(xdrs, &objp->fileid))
return (FALSE);
if (!xdr_filename3(xdrs, &objp->name))
return (FALSE);
if (!xdr_cookie3(xdrs, &objp->cookie))
return (FALSE);
if (!xdr_post_op_attr(xdrs, &objp->name_attributes))
return (FALSE);
if (!xdr_post_op_fh3(xdrs, &objp->name_handle))
return (FALSE);
if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof(entryplus3), (xdrproc_t)xdr_entryplus3))
return (FALSE);
return (TRUE);
}
bool_t
xdr_dirlistplus3(XDR *xdrs, dirlistplus3 *objp)
{
if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof(entryplus3), (xdrproc_t)xdr_entryplus3))
return (FALSE);
if (!xdr_bool(xdrs, &objp->eof))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIRPLUS3resok(XDR *xdrs, READDIRPLUS3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
if (!xdr_cookieverf3(xdrs, objp->cookieverf))
return (FALSE);
if (!xdr_dirlistplus3(xdrs, &objp->reply))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIRPLUS3resfail(XDR *xdrs, READDIRPLUS3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->dir_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_READDIRPLUS3res(XDR *xdrs, READDIRPLUS3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_READDIRPLUS3resok(xdrs, &objp->READDIRPLUS3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_READDIRPLUS3resfail(xdrs, &objp->READDIRPLUS3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_FSSTAT3args(XDR *xdrs, FSSTAT3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->fsroot))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSSTAT3resok(XDR *xdrs, FSSTAT3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_size3(xdrs, &objp->tbytes))
return (FALSE);
if (!xdr_size3(xdrs, &objp->fbytes))
return (FALSE);
if (!xdr_size3(xdrs, &objp->abytes))
return (FALSE);
if (!xdr_size3(xdrs, &objp->tfiles))
return (FALSE);
if (!xdr_size3(xdrs, &objp->ffiles))
return (FALSE);
if (!xdr_size3(xdrs, &objp->afiles))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->invarsec))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSSTAT3resfail(XDR *xdrs, FSSTAT3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSSTAT3res(XDR *xdrs, FSSTAT3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_FSSTAT3resok(xdrs, &objp->FSSTAT3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_FSSTAT3resfail(xdrs, &objp->FSSTAT3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_FSINFO3args(XDR *xdrs, FSINFO3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->fsroot))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSINFO3resok(XDR *xdrs, FSINFO3resok *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->rtmax))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->rtpref))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->rtmult))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->wtmax))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->wtpref))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->wtmult))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->dtpref))
return (FALSE);
if (!xdr_size3(xdrs, &objp->maxfilesize))
return (FALSE);
if (!xdr_nfstime3(xdrs, &objp->time_delta))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->properties))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSINFO3resfail(XDR *xdrs, FSINFO3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_FSINFO3res(XDR *xdrs, FSINFO3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_FSINFO3resok(xdrs, &objp->FSINFO3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_FSINFO3resfail(xdrs, &objp->FSINFO3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_PATHCONF3args(XDR *xdrs, PATHCONF3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->object))
return (FALSE);
return (TRUE);
}
bool_t
xdr_PATHCONF3resok(XDR *xdrs, PATHCONF3resok *objp)
{
int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->linkmax))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->name_max))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_bool(xdrs, &objp->no_trunc))
return (FALSE);
if (!xdr_bool(xdrs, &objp->chown_restricted))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_insensitive))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_preserving))
return (FALSE);
} else {
IXDR_PUT_BOOL(buf, objp->no_trunc);
IXDR_PUT_BOOL(buf, objp->chown_restricted);
IXDR_PUT_BOOL(buf, objp->case_insensitive);
IXDR_PUT_BOOL(buf, objp->case_preserving);
}
} else if (xdrs->x_op == XDR_DECODE) {
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->linkmax))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->name_max))
return (FALSE);
buf = (int32_t *)XDR_INLINE(xdrs, 4 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
if (!xdr_bool(xdrs, &objp->no_trunc))
return (FALSE);
if (!xdr_bool(xdrs, &objp->chown_restricted))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_insensitive))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_preserving))
return (FALSE);
} else {
objp->no_trunc = IXDR_GET_BOOL(buf);
objp->chown_restricted = IXDR_GET_BOOL(buf);
objp->case_insensitive = IXDR_GET_BOOL(buf);
objp->case_preserving = IXDR_GET_BOOL(buf);
}
} else {
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->linkmax))
return (FALSE);
if (!xdr_uint32(xdrs, &objp->name_max))
return (FALSE);
if (!xdr_bool(xdrs, &objp->no_trunc))
return (FALSE);
if (!xdr_bool(xdrs, &objp->chown_restricted))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_insensitive))
return (FALSE);
if (!xdr_bool(xdrs, &objp->case_preserving))
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_PATHCONF3resfail(XDR *xdrs, PATHCONF3resfail *objp)
{
if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
return (FALSE);
return (TRUE);
}
bool_t
xdr_PATHCONF3res(XDR *xdrs, PATHCONF3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_PATHCONF3resok(xdrs, &objp->PATHCONF3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_PATHCONF3resfail(xdrs, &objp->PATHCONF3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
bool_t
xdr_COMMIT3args(XDR *xdrs, COMMIT3args *objp)
{
if (!xdr_nfs_fh3(xdrs, &objp->file))
return (FALSE);
if (!xdr_offset3(xdrs, &objp->offset))
return (FALSE);
if (!xdr_count3(xdrs, &objp->count))
return (FALSE);
return (TRUE);
}
bool_t
xdr_COMMIT3resok(XDR *xdrs, COMMIT3resok *objp)
{
if (!xdr_wcc_data(xdrs, &objp->file_wcc))
return (FALSE);
if (!xdr_writeverf3(xdrs, objp->verf))
return (FALSE);
return (TRUE);
}
bool_t
xdr_COMMIT3resfail(XDR *xdrs, COMMIT3resfail *objp)
{
if (!xdr_wcc_data(xdrs, &objp->file_wcc))
return (FALSE);
return (TRUE);
}
bool_t
xdr_COMMIT3res(XDR *xdrs, COMMIT3res *objp)
{
if (!xdr_nfsstat3(xdrs, &objp->status))
return (FALSE);
switch (objp->status) {
case NFS3_OK:
if (!xdr_COMMIT3resok(xdrs, &objp->COMMIT3res_u.resok))
return (FALSE);
break;
default:
if (!xdr_COMMIT3resfail(xdrs, &objp->COMMIT3res_u.resfail))
return (FALSE);
break;
}
return (TRUE);
}
|
195582c693b2593af039eef7041aba3d9756c2a5
|
b2f295072d61bd25c47a05aedc4a5f9a8d9df670
|
/Foundation/AptPackageVersion/Sources/AptPackageVersion/dpkgInline.h
|
872fb1ac43899da8d0ec182876a5fd091246e6f0
|
[
"Unlicense",
"MIT"
] |
permissive
|
SailyTeam/Saily
|
8f48fde0abec0c5c79e53e5db31af17351958962
|
c0ae33ee26db2ecbab7d33e42c15148cad80f22f
|
refs/heads/main-2.0
| 2022-12-23T05:41:58.080306
| 2022-12-22T12:30:53
| 2022-12-22T12:33:52
| 280,041,061
| 796
| 63
|
Unlicense
| 2022-12-22T11:22:33
| 2020-07-16T03:16:41
|
Swift
|
UTF-8
|
C
| false
| false
| 1,027
|
h
|
dpkgInline.h
|
//
// dpkgInline.h
// Sail
//
// Created by Lakr Aream on 2020/2/22.
// Copyright © 2020 Lakr Aream. All rights reserved.
//
#ifndef dpkgInline_h
#define dpkgInline_h
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DPKG_VERSION_OBJECT(e, v, r) \
(struct dpkg_version) { .epoch = (e), .version = (v), .revision = (r) }
/**
* Data structure representing a Debian version.
*
* @see deb-version(5)
*/
struct dpkg_version {
/** The epoch. It will be zero if no epoch is present. */
unsigned int epoch;
/** The upstream part of the version. */
const char *version;
/** The Debian revision part of the version. */
const char *revision;
};
int parseversion(struct dpkg_version *rversion, const char *string);
int dpkg_version_compare(const struct dpkg_version *a,
const struct dpkg_version *b);
#endif /* dpkgInline_h */
|
af48f79ea7dbb19ab725cd0dd4167da024e7efb6
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/nuvoton/libraries/nuc980/rtt_port/drv_qspi.h
|
87be3e6e42102d6da5f8d24256a9e404a21b8baf
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 641
|
h
|
drv_qspi.h
|
/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-2-7 Wayne First version
*
******************************************************************************/
#ifndef __DRV_QSPI_H__
#define __DRV_QSPI_H__
#include <rtdevice.h>
rt_err_t nu_qspi_bus_attach_device(const char *bus_name, const char *device_name, rt_uint8_t data_line_width, void (*enter_qspi_mode)(), void (*exit_qspi_mode)());
#endif // __DRV_QSPI_H___
|
0c49601661ca4b306a2a951e8192ef129be50aca
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/compat/common/uipc_syscalls_30.c
|
7c8f56ade0dd25937b10a9456652144bee17623e
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 1,233
|
c
|
uipc_syscalls_30.c
|
/* $NetBSD: uipc_syscalls_30.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $ */
/* written by Pavel Cahyna, 2006. Public domain. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_30.c,v 1.4 2019/01/27 02:08:39 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
#endif
/*
* System call interface to the socket abstraction.
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/msg.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <sys/syscallargs.h>
#include <sys/errno.h>
#include <compat/common/compat_mod.h>
static const struct syscall_package uipc_syscalls_30_syscalls[] = {
{ SYS_compat_30_socket, 0, (sy_call_t *)compat_30_sys_socket },
{ 0, 0, NULL}
};
int
compat_30_sys_socket(struct lwp *l,
const struct compat_30_sys_socket_args *uap, register_t *retval)
{
int error;
error = sys___socket30(l, (const void *)uap, retval);
if (error == EAFNOSUPPORT)
error = EPROTONOSUPPORT;
return (error);
}
int
uipc_syscalls_30_init(void)
{
return syscall_establish(NULL, uipc_syscalls_30_syscalls);
}
int
uipc_syscalls_30_fini(void)
{
return syscall_disestablish(NULL, uipc_syscalls_30_syscalls);
}
|
0b31bb47b70a45035153ba51bb941e364fc2825a
|
03b2c80dbc41e904b167d504666e27d798da5447
|
/src/array_adjust.c
|
e530d1f17b4bfd0ebb658c253b15cf837dde649a
|
[
"Unlicense"
] |
permissive
|
nptcl/npt
|
7c1570b497cdce0b8971cb445fbc04cb500232d3
|
aa714a2370ac9fa5348c2fc96159b40b9de3de07
|
refs/heads/master
| 2023-03-20T09:13:54.669118
| 2022-07-02T11:17:44
| 2022-07-02T11:17:44
| 171,985,905
| 160
| 12
|
Unlicense
| 2023-03-11T01:36:37
| 2019-02-22T03:11:34
|
C
|
UTF-8
|
C
| false
| false
| 16,693
|
c
|
array_adjust.c
|
#include <math.h>
#include "arch.h"
#include "array.h"
#include "array_access.h"
#include "array_adjust.h"
#include "array_make.h"
#include "array_vector.h"
#include "bit.h"
#include "character.h"
#include "condition.h"
#include "cons.h"
#include "integer.h"
#include "local.h"
#include "sequence.h"
#include "strtype.h"
#include "strvect.h"
#include "type_table.h"
#include "type_upgraded.h"
/*
* adjust-array
*/
static int array_adjust_move_default_(addr pos, size_t index, addr value)
{
struct array_struct *str;
/* :initial-element */
if (value != Unbound)
return array_set_(pos, index, value);
/* default value */
str = ArrayInfoStruct(pos);
switch (str->type) {
case ARRAY_TYPE_CHARACTER:
return array_set_character_(pos, index, 0);
#ifdef LISP_DEBUG
case ARRAY_TYPE_BIT:
return array_set_bit_(pos, index, 1);
case ARRAY_TYPE_SIGNED:
case ARRAY_TYPE_UNSIGNED:
fixnum_heap(&value, 88);
return array_set_(pos, index, value);
case ARRAY_TYPE_SINGLE_FLOAT:
return array_set_single_(pos, index, nanf(""));
case ARRAY_TYPE_DOUBLE_FLOAT:
return array_set_double_(pos, index, nan(""));
case ARRAY_TYPE_LONG_FLOAT:
return array_set_long_(pos, index, nanl(""));
#endif
default:
return 0;
}
}
static int array_index_dimension_(const size_t *data,
const size_t *dimension, size_t depth, size_t *ret)
{
size_t i, value;
/* [1] n1
* [2] s2*... + n2
* [3] s3*... + n3
* [4] s4*... + n4
*/
if (depth == 0)
return Result(ret, 1);
if (depth == 1)
return Result(ret, data[0]);
value = data[0];
for (i = 1; i < depth; i++) {
if (multisafe_size(value, dimension[i], &value)) {
*ret = 0;
return fmte_("Too large index value.", NULL);
}
if (plussafe_size(value, data[i], &value)) {
*ret = 0;
return fmte_("Too large index value.", NULL);
}
}
return Result(ret, value);
}
static int array_adjust_move_p(addr array, const size_t *data)
{
struct array_struct *str;
const size_t *bound;
size_t size, i;
str = ArrayInfoStruct(array);
bound = array_ptrsize(array);
size = str->dimension;
for (i = 0; i < size; i++) {
if (bound[i] <= data[i])
return 0;
}
return 1;
}
static int array_adjust_move_element_(
addr pos, addr array, addr initial, const size_t *data)
{
struct array_struct *str1;
const size_t *data1, *data2;
size_t index1, index2, depth;
str1 = ArrayInfoStruct(pos);
data1 = array_ptrsize(pos);
depth = str1->dimension;
Return(array_index_dimension_(data, data1, depth, &index1));
if (! array_adjust_move_p(array, data))
return array_adjust_move_default_(pos, index1, initial);
data2 = array_ptrsize(array);
Return(array_index_dimension_(data, data2, depth, &index2));
return array_setget_(pos, index1, array, index2);
}
static int array_adjust_move_depth_(
addr pos, addr array, addr initial, size_t *data, size_t depth)
{
struct array_struct *str;
const size_t *data1;
size_t size, i;
str = ArrayInfoStruct(pos);
if (str->dimension <= depth)
return array_adjust_move_element_(pos, array, initial, data);
data1 = array_ptrsize(pos);
size = data1[depth];
for (i = 0; i < size; i++) {
data[depth] = i;
Return(array_adjust_move_depth_(pos, array, initial, data, depth + 1));
}
return 0;
}
static int array_adjust_move_(addr pos, addr array, addr initial)
{
struct array_struct *str;
size_t size, *data;
LocalRoot local;
LocalStack stack;
local = Local_Thread;
str = ArrayInfoStruct(pos);
size = str->dimension;
push_local(local, &stack);
data = (size_t *)lowlevel_local(local, IdxSize * size);
memset(data, 0, IdxSize * size);
Return(array_adjust_move_depth_(pos, array, initial, data, 0));
rollback_local(local, stack);
return 0;
}
static int array_adjust_notnot_(addr pos, addr array, addr initial, addr contents)
{
struct array_struct *str;
str = ArrayInfoStruct(pos);
Return(array_allocate_(NULL, pos, str));
if (contents == Unbound)
return array_adjust_move_(pos, array, initial);
else
return array_make_initial_(pos, initial, contents);
}
static int array_adjust_make_(addr pos, addr array, addr initial, addr contents)
{
int check1, check2;
struct array_struct *str1, *str2;
str1 = ArrayInfoStruct(pos);
str2 = ArrayInfoStruct(array);
check1 = str1->displaced;
check2 = str2->displaced;
if (check1 && check2) {
/* displaced -> displaced */
return array_make_initial_(pos, initial, contents);
}
else if (check1) {
/* not -> displaced */
return array_make_initial_(pos, initial, contents);
}
else if (check2) {
/* displaced -> not */
return array_adjust_notnot_(pos, array, initial, contents);
}
else {
/* not-displaced -> not-displaced */
return array_adjust_notnot_(pos, array, initial, contents);
}
}
static int array_adjust_element_type_(addr pos, addr type, addr array)
{
enum ARRAY_TYPE value;
int size;
struct array_struct *str1, *str2;
str1 = ArrayInfoStruct(pos);
str2 = ArrayInfoStruct(array);
if (type == Unbound) {
str1->type = str2->type;
str1->bytesize = str2->bytesize;
}
else {
Return(upgraded_array_value_(type, &value, &size));
if (! array_equal_type(str2, value, size))
return fmte_(":element-type ~S must be equal to base array.", type, NULL);
str1->type = value;
str1->bytesize = size;
}
array_set_type(pos);
return 0;
}
static void array_adjust_adjustable(addr pos, addr array)
{
ArrayInfoStruct(pos)->adjustable = ArrayInfoStruct(array)->adjustable;
}
static int array_adjust_fillpointer_(addr pos, addr array, addr fill)
{
int check;
struct array_struct *str1;
struct array_struct *str2;
addr type;
size_t size;
str1 = ArrayInfoStruct(pos);
str2 = ArrayInfoStruct(array);
/* nil */
if (fill == Nil) {
if (str2->fillpointer == 0)
return 0;
str1->fillpointer = str2->fillpointer;
str1->front = str2->front;
goto fill_check;
}
/* t */
if (fill == T) {
str1->fillpointer = 1;
str1->front = str1->size;
goto fill_check;
}
/* integer */
if (integerp(fill)) {
Return(minusp_integer_(fill, &check));
if (check)
return fmte_("fill-pointer ~A must be a non-negative integer.", fill, NULL);
if (GetIndex_integer(fill, &size))
return fmte_("fill-pointer ~A is too large.", fill, NULL);
str1->fillpointer = 1;
str1->front = size;
goto fill_check;
}
/* type error */
return fmte_("Invalid fill-pointer value ~S.", fill, NULL);
fill_check:
if (str2->fillpointer == 0) {
GetTypeTable(&type, Array);
return call_type_error_va_(NULL, array, type,
"The argument ~S must be a fill-pointer array.", array, NULL);
}
if (str1->dimension != 1)
return fmte_("fill-pointer array must be a 1 dimensional.", NULL);
if (str1->size < str1->front) {
return fmte_("fill-pointer ~A must be less than array size ~A.",
intsizeh(str1->front), intsizeh(str1->size), NULL);
}
return 0;
}
static int array_adjust_dimension_(addr pos, addr array)
{
struct array_struct *str1;
struct array_struct *str2;
str1 = ArrayInfoStruct(pos);
str2 = ArrayInfoStruct(array);
if (str1->dimension != str2->dimension) {
return fmte_("Array rank ~S must be equal to base array ~S.",
intsizeh(str1->dimension),
intsizeh(str2->dimension), NULL);
}
return 0;
}
static void array_adjust_replace(addr pos, addr array)
{
struct array_struct *str1, *str2;
int i;
addr temp;
str1 = ArrayInfoStruct(array);
str2 = ArrayInfoStruct(pos);
*str1 = *str2;
for (i = 0; i < ARRAY_INDEX_SIZE; i++) {
GetArrayInfo(pos, i, &temp);
SetArrayInfo(array, i, temp);
}
}
static void array_adjust_result(addr pos, addr array, addr *ret)
{
if (array_adjustable_p(array)) {
array_adjust_replace(pos, array);
*ret = array;
}
else {
*ret = pos;
}
}
static int array_adjust_arraytype_(addr *ret, addr array, addr dimension,
addr type, addr initial, addr contents,
addr fill, addr displaced, addr offset)
{
addr pos;
CheckType(array, LISPTYPE_ARRAY);
array_empty_heap(&pos);
Return(array_adjust_element_type_(pos, type, array));
array_set_element_size(pos);
Return(array_set_dimension_(pos, dimension));
array_adjust_adjustable(pos, array);
Return(array_adjust_fillpointer_(pos, array, fill));
Return(array_set_displaced_(pos, displaced, offset));
array_set_simple(pos);
Return(array_adjust_dimension_(pos, array));
Return(array_adjust_make_(pos, array, initial, contents));
array_adjust_result(pos, array, ret);
return 0;
}
/*
* array_adjust_simple
*/
static int array_adjust_simple_contents_list_(addr pos, size_t size, addr list)
{
addr value;
size_t i;
for (i = 0; i < size; i++) {
Return_getcons(list, &value, &list);
Return(setelt_sequence_(pos, i, value));
}
return 0;
}
static int array_adjust_simple_contents_sequence_(addr pos, size_t size, addr x)
{
addr value;
size_t i;
for (i = 0; i < size; i++) {
Return(getelt_sequence_(NULL, x, i, &value));
Return(setelt_sequence_(pos, i, value));
}
return 0;
}
static int array_adjust_simple_contents_(addr pos, size_t size, addr contents)
{
size_t len;
Return(length_sequence_(contents, 1, &len));
if (size != len)
return fmte_("Mismatch :displaced-to ~S length.", pos, NULL);
if (listp(contents))
return array_adjust_simple_contents_list_(pos, size, contents);
else
return array_adjust_simple_contents_sequence_(pos, size, contents);
}
static int array_adjust_simple_default_(addr pos, size_t index, addr initial)
{
/* :initial-element */
if (initial != Unbound)
return setelt_sequence_(pos, index, initial);
/* default value */
switch (GetType(pos)) {
case LISPTYPE_STRING:
return strvect_setc_(pos, index, 0);
#ifdef LISP_DEBUG
case LISPTYPE_BITVECTOR:
return bitmemory_setint_(pos, index, 1);
case LISPTYPE_VECTOR:
setarray(pos, index, T);
break;
#endif
default:
break;
}
return 0;
}
static int array_adjust_simple_move_(addr pos, addr array, size_t size, addr initial)
{
addr value;
size_t check, i;
Return(length_sequence_(array, 1, &check));
for (i = 0; i < size; i++) {
if (i < check) {
Return(getelt_sequence_(NULL, array, i, &value));
Return(setelt_sequence_(pos, i, value));
}
else {
Return(array_adjust_simple_default_(pos, i, initial));
}
}
return 0;
}
static int array_adjust_simple_(
addr pos, addr array, size_t size, addr initial, addr contents)
{
if (contents != Unbound)
return array_adjust_simple_contents_(pos, size, contents);
else
return array_adjust_simple_move_(pos, array, size, initial);
}
/*
* array_adjust_sequence
*/
static int array_adjust_vector_type_(addr pos, addr type, enum ARRAY_TYPE check)
{
int size;
enum ARRAY_TYPE value;
struct array_struct *str;
str = ArrayInfoStruct(pos);
if (type == Unbound) {
str->type = check;
str->bytesize = 0;
}
else {
Return(upgraded_array_value_(type, &value, &size));
if (check != value)
return fmte_(":element-type ~S must be equal to base array.", type, NULL);
str->type = value;
str->bytesize = 0;
}
array_set_type(pos);
return 0;
}
static int array_adjust_vector_move_(addr pos, addr array, addr initial)
{
struct array_struct *str;
addr value;
size_t size1, size2, i;
str = ArrayInfoStruct(pos);
size1 = str->size;
Return(length_sequence_(array, 0, &size2));
for (i = 0; i < size1; i++) {
if (i < size2) {
Return(getelt_sequence_(NULL, array, i, &value));
Return(setelt_sequence_(pos, i, value));
}
else {
Return(array_adjust_move_default_(pos, i, initial));
}
}
return 0;
}
static int array_adjust_vector_not_(
addr pos, addr array, addr initial, addr contents)
{
struct array_struct *str;
str = ArrayInfoStruct(pos);
Return(array_allocate_(NULL, pos, str));
if (contents == Unbound)
return array_adjust_vector_move_(pos, array, initial);
else
return array_make_initial_(pos, initial, contents);
}
static int array_adjust_vector_make_(addr pos, addr array, addr initial, addr contents)
{
struct array_struct *str;
str = ArrayInfoStruct(pos);
if (str->displaced) {
/* not -> displaced */
return array_make_initial_(pos, initial, contents);
}
else {
/* not-displaced -> not-displaced */
return array_adjust_vector_not_(pos, array, initial, contents);
}
}
static void array_adjust_vector_adjustable(addr pos)
{
ArrayInfoStruct(pos)->adjustable = 0;
}
static int array_adjust_vector_fillpointer_(addr pos, addr array, addr fill)
{
addr type;
if (fill != Nil) {
GetTypeTable(&type, Array);
return call_type_error_va_(NULL, array, type,
"The argument ~S must be a fill-pointer array.", array, NULL);
}
ArrayInfoStruct(pos)->fillpointer = 0;
return 0;
}
static int array_adjust_sequence_(addr *ret, addr array, addr dimension,
addr type, enum ARRAY_TYPE type_value,
addr initial, addr contents, addr fill, addr displaced, addr offset)
{
addr pos;
array_empty_heap(&pos);
Return(array_adjust_vector_type_(pos, type, type_value));
array_set_element_size(pos);
Return(array_set_dimension_(pos, dimension));
array_adjust_vector_adjustable(pos);
Return(array_adjust_vector_fillpointer_(pos, array, fill));
Return(array_set_displaced_(pos, displaced, offset));
array_set_simple(pos);
Return(array_adjust_vector_make_(pos, array, initial, contents));
return Result(ret, pos);
}
/*
* array_adjust_array
*/
static int array_adjust_vector_check_(addr pos, size_t *ret)
{
if (pos == Nil) {
*ret = 0;
return fmte_("Array rank must be a 1, but 0.", NULL);
}
if (singlep(pos))
GetCar(pos, &pos);
if (integerp(pos)) {
if (GetIndex_integer(pos, ret)) {
*ret = 0;
return fmte_("Dimension ~A is too large.", pos, NULL);
}
return 0;
}
/* error */
*ret = 0;
if (consp(pos))
return fmte_("Array rank must be a 1.", NULL);
else
return fmte_("Invalid pos type ~S.", pos, NULL);
}
static int array_adjust_simple_check(addr pos, addr fill, addr displaced)
{
if (fill != Nil || displaced != Nil)
return 0;
if (! arrayp(pos))
return 1;
return ArrayInfoStruct(pos)->adjustable == 0;
}
static int array_adjust_vector_(addr *ret, addr array, addr dimension,
addr type, addr initial, addr contents,
addr fill, addr displaced, addr offset)
{
addr pos;
size_t size;
Return(array_adjust_vector_check_(dimension, &size));
if (array_adjust_simple_check(array, fill, displaced)) {
vector_heap(&pos, size);
Return(array_adjust_simple_(pos, array, size, initial, contents));
}
else {
Return(array_adjust_sequence_(&pos, array, dimension, type,
ARRAY_TYPE_T, initial, contents, fill, displaced, offset));
}
return Result(ret, pos);
}
static int array_adjust_string_(addr *ret, addr array, addr dimension,
addr type, addr initial, addr contents,
addr fill, addr displaced, addr offset)
{
addr pos;
size_t size;
Return(array_adjust_vector_check_(dimension, &size));
if (initial != Unbound && characterp(initial) == 0) {
*ret = Nil;
return fmte_(":initial-element ~S must be a character type.", initial, NULL);
}
if (array_adjust_simple_check(array, fill, displaced)) {
strvect_heap(&pos, size);
Return(array_adjust_simple_(pos, array, size, initial, contents));
}
else {
Return(array_adjust_sequence_(&pos, array, dimension, type,
ARRAY_TYPE_CHARACTER, initial, contents, fill, displaced, offset));
}
return Result(ret, pos);
}
static int array_adjust_bitvector_(addr *ret, addr array, addr dimension,
addr type, addr initial, addr contents,
addr fill, addr displaced, addr offset)
{
addr pos;
size_t size;
Return(array_adjust_vector_check_(dimension, &size));
if (initial != Unbound && bitp(initial) == 0) {
*ret = Nil;
return fmte_(":initial-element ~S must be a bit type (0 or 1).", initial, NULL);
}
if (array_adjust_simple_check(array, fill, displaced)) {
bitmemory_heap(&pos, size);
Return(array_adjust_simple_(pos, array, size, initial, contents));
}
else {
Return(array_adjust_sequence_(&pos, array, dimension, type,
ARRAY_TYPE_BIT, initial, contents, fill, displaced, offset));
}
return Result(ret, pos);
}
int array_adjust_array_(addr *ret, addr array, addr dimension,
addr type, addr initial, addr contents,
addr fill, addr displaced, addr offset)
{
switch (GetType(array)) {
case LISPTYPE_ARRAY:
return array_adjust_arraytype_(ret, array, dimension,
type, initial, contents, fill, displaced, offset);
case LISPTYPE_VECTOR:
return array_adjust_vector_(ret, array, dimension,
type, initial, contents, fill, displaced, offset);
case LISPTYPE_STRING:
return array_adjust_string_(ret, array, dimension,
type, initial, contents, fill, displaced, offset);
case LISPTYPE_BITVECTOR:
return array_adjust_bitvector_(ret, array, dimension,
type, initial, contents, fill, displaced, offset);
default:
*ret = Nil;
return TypeError_(array, ARRAY);
}
}
|
0e29bf63c678967d65abfda955c26f18eb245f1a
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/comms/xdx/files/patch-src_net.c
|
fa1c588da326f26cf0df1fd436e3027fe904625e
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 298
|
c
|
patch-src_net.c
|
- workaround for https://github.com/N0NB/xdx/issues/12
--- src/net.c.orig 2022-09-11 15:53:06 UTC
+++ src/net.c
@@ -62,7 +62,7 @@
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
-#include <resolv.h>
+//#include <resolv.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
|
cdbf6b7901def862cd26a1edcc3bd4f95c63d671
|
bece8b97cdb15988562c8c8dc27a5b58cd3acb90
|
/wizard_spider/Resources/Mimikatz/mimikatz/modules/rpc/kull_m_rpc_ms-claims.c
|
1e3e29dcfbeb08d1567837e768d3ad63a2b2446e
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
center-for-threat-informed-defense/adversary_emulation_library
|
4382e78f56faa635d5a6cc89bce5b36f3b74476c
|
4b1d1327ebfbd550ba7e5f1b5562c1f3db61311e
|
refs/heads/master
| 2023-08-12T20:08:57.078612
| 2023-07-17T16:54:16
| 2023-07-17T16:54:16
| 259,753,257
| 1,220
| 243
|
Apache-2.0
| 2023-09-06T16:23:00
| 2020-04-28T21:16:54
|
C
|
UTF-8
|
C
| false
| false
| 8,300
|
c
|
kull_m_rpc_ms-claims.c
|
#include "kull_m_rpc_ms-claims.h"
#if defined(_M_X64) || defined(_M_ARM64) // TODO:ARM64
#define _Claims_MIDL_TYPE_FORMAT_STRING_SIZE 371
#define _Claims_MIDL_TYPE_FORMAT_OFFSET 316
#elif defined(_M_IX86)
#define _Claims_MIDL_TYPE_FORMAT_STRING_SIZE 383
#define _Claims_MIDL_TYPE_FORMAT_OFFSET 328
#endif
typedef struct _Claims_MIDL_TYPE_FORMAT_STRING {
SHORT Pad;
UCHAR Format[_Claims_MIDL_TYPE_FORMAT_STRING_SIZE];
} Claims_MIDL_TYPE_FORMAT_STRING;
extern const Claims_MIDL_TYPE_FORMAT_STRING Claims__MIDL_TypeFormatString;
static const RPC_CLIENT_INTERFACE Claims___RpcClientInterface = {sizeof(RPC_CLIENT_INTERFACE), {{0xbba9cb76, 0xeb0c, 0x462c, {0xaa, 0x1b, 0x5d, 0x8c, 0x34, 0x41, 0x57, 0x01}}, {1, 0}}, {{0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60}}, {2, 0}}, 0, 0, 0, 0, 0, 0x00000000};
static const MIDL_TYPE_PICKLING_INFO __MIDL_TypePicklingInfo = {0x33205054, 0x3, 0, 0, 0,};
static RPC_BINDING_HANDLE Claims__MIDL_AutoBindHandle;
static const MIDL_STUB_DESC Claims_StubDesc = {(void *) &Claims___RpcClientInterface, MIDL_user_allocate, MIDL_user_free, &Claims__MIDL_AutoBindHandle, 0, 0, 0, 0, Claims__MIDL_TypeFormatString.Format, 1, 0x60000, 0, 0x8000253, 0, 0, 0, 0x1, 0, 0, 0};
size_t PCLAIMS_SET_AlignSize(handle_t _MidlEsHandle, PCLAIMS_SET * _pType)
{
return NdrMesTypeAlignSize2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING ) &Claims__MIDL_TypeFormatString.Format[2], _pType);
}
void PCLAIMS_SET_Encode(handle_t _MidlEsHandle, PCLAIMS_SET * _pType)
{
NdrMesTypeEncode2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[2], _pType);
}
void PCLAIMS_SET_Decode(handle_t _MidlEsHandle, PCLAIMS_SET * _pType)
{
NdrMesTypeDecode2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[2], _pType);
}
void PCLAIMS_SET_Free(handle_t _MidlEsHandle, PCLAIMS_SET * _pType)
{
NdrMesTypeFree2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[2], _pType);
}
size_t PCLAIMS_SET_METADATA_AlignSize(handle_t _MidlEsHandle, PCLAIMS_SET_METADATA * _pType)
{
return NdrMesTypeAlignSize2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[_Claims_MIDL_TYPE_FORMAT_OFFSET], _pType);
}
void PCLAIMS_SET_METADATA_Encode(handle_t _MidlEsHandle, PCLAIMS_SET_METADATA * _pType)
{
NdrMesTypeEncode2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[_Claims_MIDL_TYPE_FORMAT_OFFSET], _pType);
}
void PCLAIMS_SET_METADATA_Decode(handle_t _MidlEsHandle, PCLAIMS_SET_METADATA * _pType)
{
NdrMesTypeDecode2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[_Claims_MIDL_TYPE_FORMAT_OFFSET], _pType);
}
void PCLAIMS_SET_METADATA_Free(handle_t _MidlEsHandle, PCLAIMS_SET_METADATA * _pType)
{
NdrMesTypeFree2(_MidlEsHandle, (PMIDL_TYPE_PICKLING_INFO) &__MIDL_TypePicklingInfo, &Claims_StubDesc, (PFORMAT_STRING) &Claims__MIDL_TypeFormatString.Format[_Claims_MIDL_TYPE_FORMAT_OFFSET], _pType);
}
#if defined(_M_X64) || defined(_M_ARM64) // TODO:ARM64
static const Claims_MIDL_TYPE_FORMAT_STRING Claims__MIDL_TypeFormatString = {0, {
0x00, 0x00, 0x12, 0x00, 0x20, 0x01, 0x2b, 0x0d, 0x06, 0x00, 0xf8, 0xff, 0x01, 0x00, 0x02, 0x00, 0x10, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00,
0x03, 0x00, 0x00, 0x00, 0x72, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1b, 0x07, 0x08, 0x00, 0x19, 0x00, 0x00, 0x00,
0x01, 0x00, 0x0b, 0x5b, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x4c, 0x00, 0xe0, 0xff, 0x40, 0x36, 0x5c, 0x5b, 0x12, 0x00, 0xe2, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x4c, 0x00, 0xec, 0xff, 0x40, 0x36, 0x5c, 0x5b, 0x12, 0x00, 0xc4, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
0x21, 0x03, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x12, 0x08, 0x25, 0x5c, 0x5c, 0x5b, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x4c, 0x00,
0xd6, 0xff, 0x40, 0x36, 0x5c, 0x5b, 0x12, 0x00, 0xd8, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x4c, 0x00, 0xec, 0xff,
0x40, 0x36, 0x5c, 0x5b, 0x12, 0x00, 0x72, 0xff, 0x1a, 0x03, 0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x36, 0x0d, 0x40, 0x4c, 0x00, 0x31, 0xff, 0x5b, 0x12, 0x08, 0x25, 0x5c, 0x21, 0x03, 0x00, 0x00,
0x19, 0x00, 0x04, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x4c, 0x00, 0xda, 0xff, 0x5c, 0x5b, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0d, 0x08, 0x36, 0x5b, 0x12, 0x00,
0xdc, 0xff, 0x21, 0x03, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x4c, 0x00, 0xde, 0xff, 0x5c, 0x5b, 0x1b, 0x00, 0x01, 0x00, 0x19, 0x00, 0x14, 0x00,
0x01, 0x00, 0x01, 0x5b, 0x1a, 0x03, 0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x08, 0x40, 0x36, 0x06, 0x3e, 0x08, 0x36, 0x5b, 0x12, 0x00, 0xcc, 0xff, 0x12, 0x00, 0xde, 0xff, 0x12, 0x00, 0x1a, 0x00,
0x1b, 0x00, 0x01, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x1b, 0x00, 0x01, 0x00, 0x19, 0x00, 0x1c, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x1a, 0x03, 0x28, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x08, 0x40, 0x36, 0x0d, 0x08, 0x06, 0x3e, 0x08, 0x36, 0x5b, 0x12, 0x00, 0xd4, 0xff, 0x12, 0x00, 0xdc, 0xff, 0x00,
}};
#elif defined(_M_IX86)
static const Claims_MIDL_TYPE_FORMAT_STRING Claims__MIDL_TypeFormatString = {0, {
0x00, 0x00, 0x12, 0x00, 0x22, 0x01, 0x2b, 0x0d, 0x06, 0x00, 0xfc, 0xff, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x42, 0x00,
0x03, 0x00, 0x00, 0x00, 0x78, 0x00, 0x06, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1b, 0x07, 0x08, 0x00, 0x19, 0x00, 0x00, 0x00,
0x01, 0x00, 0x0b, 0x5b, 0x1a, 0x03, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x4c, 0x00, 0xe0, 0xff, 0x36, 0x5b, 0x12, 0x00, 0xe4, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00,
0x1a, 0x03, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x4c, 0x00, 0xec, 0xff, 0x36, 0x5b, 0x12, 0x00, 0xc8, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1b, 0x03, 0x04, 0x00,
0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4b, 0x5c, 0x48, 0x49, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x08, 0x25, 0x5c, 0x5b, 0x08, 0x5c, 0x5b, 0x1a, 0x03, 0x08, 0x00,
0x00, 0x00, 0x08, 0x00, 0x4c, 0x00, 0xcc, 0xff, 0x36, 0x5b, 0x12, 0x00, 0xd0, 0xff, 0xb7, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x1a, 0x03, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00,
0x4c, 0x00, 0xec, 0xff, 0x36, 0x5b, 0x12, 0x00, 0x70, 0xff, 0x1a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x36, 0x0d, 0x4c, 0x00, 0x30, 0xff, 0x5c, 0x5b, 0x12, 0x08, 0x25, 0x5c, 0x21, 0x03,
0x00, 0x00, 0x19, 0x00, 0x04, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x4c, 0x00, 0xda, 0xff, 0x5c, 0x5b, 0x1a, 0x03, 0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x0d, 0x08, 0x36, 0x5b,
0x12, 0x00, 0xdc, 0xff, 0x21, 0x03, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x4c, 0x00, 0xde, 0xff, 0x5c, 0x5b, 0x1b, 0x00, 0x01, 0x00, 0x19, 0x00,
0x0c, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x16, 0x03, 0x14, 0x00, 0x4b, 0x5c, 0x46, 0x5c, 0x04, 0x00, 0x04, 0x00, 0x12, 0x00, 0xd0, 0xff, 0x46, 0x5c, 0x10, 0x00, 0x10, 0x00, 0x12, 0x00, 0xdc, 0xff,
0x5b, 0x08, 0x08, 0x06, 0x3e, 0x08, 0x08, 0x5b, 0x12, 0x00, 0x1a, 0x00, 0x1b, 0x00, 0x01, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x5b, 0x1b, 0x00, 0x01, 0x00, 0x19, 0x00, 0x14, 0x00,
0x01, 0x00, 0x01, 0x5b, 0x1a, 0x03, 0x1c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x08, 0x36, 0x0d, 0x08, 0x06, 0x3e, 0x08, 0x36, 0x5c, 0x5b, 0x12, 0x00, 0xd4, 0xff, 0x12, 0x00, 0xdc, 0xff, 0x00,
}};
#endif
|
a26d389f384d3cf35d5fdff033029220c9cd5de4
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/Drivers/AtaBus/AtaBus.c
|
a0581b4cbb8666e4d4f84eb125e4ba7fb7dcc131
|
[
"BSD-2-Clause"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 72,512
|
c
|
AtaBus.c
|
/** @file
This file implements protocol interfaces for ATA bus driver.
This file implements protocol interfaces: Driver Binding protocol,
Block IO protocol and DiskInfo protocol.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "AtaBus.h"
#ifndef DEBUG_ALL
#define DEBUG_ATABUS 0
#else
#define DEBUG_ATABUS DEBUG_ALL
#endif
#if DEBUG_ATABUS==0
#define DBG(...)
#else
//#define DBG(...) DebugLog(DEBUG_ATABUS, __VA_ARGS__)
#define DBG(...) Print(__VA_ARGS__)
#endif
UINT8 mMorControl;
BOOLEAN mHasMor;
//
// ATA Bus Driver Binding Protocol Instance
//
EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding = {
AtaBusDriverBindingSupported,
AtaBusDriverBindingStart,
AtaBusDriverBindingStop,
0x10,
NULL,
NULL
};
//
// Template for ATA Child Device.
//
ATA_DEVICE gAtaDeviceTemplate = {
ATA_DEVICE_SIGNATURE, // Signature
NULL, // Handle
{ // BlockIo
EFI_BLOCK_IO_PROTOCOL_REVISION,
NULL,
AtaBlockIoReset,
AtaBlockIoReadBlocks,
AtaBlockIoWriteBlocks,
AtaBlockIoFlushBlocks
},
{ // BlockIo2
NULL,
AtaBlockIoResetEx,
AtaBlockIoReadBlocksEx,
AtaBlockIoWriteBlocksEx,
AtaBlockIoFlushBlocksEx
},
{ // BlockMedia
0, // MediaId
FALSE, // RemovableMedia
TRUE, // MediaPresent
FALSE, // LogicPartition
FALSE, // ReadOnly
FALSE, // WritingCache
0x200, // BlockSize
0, // IoAlign
0, // LastBlock
0, // LowestAlignedLba
1, // LogicalBlocksPerPhysicalBlock
0,
},
{ // DiskInfo
EFI_DISK_INFO_IDE_INTERFACE_GUID,
AtaDiskInfoInquiry,
AtaDiskInfoIdentify,
AtaDiskInfoSenseData,
AtaDiskInfoWhichIde
},
NULL, // DevicePath
{
AtaStorageSecurityReceiveData,
AtaStorageSecuritySendData
},
NULL, // AtaBusDriverData
0, // Port
0, // PortMultiplierPort
{ 0, }, // Packet
{{0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0} }, // Acb
NULL, // Asb
FALSE, // UdmaValid
FALSE, // Lba48Bit
NULL, // IdentifyData
NULL, // ExitBootServiceEvent
NULL, // ControllerNameTable
{L'\0', }, // ModelName
{NULL, NULL}, // AtaTaskList
{NULL, NULL} // AtaSubTaskList
};
/**
Allocates an aligned buffer for ATA device.
This function allocates an aligned buffer for the ATA device to perform
ATA pass through operations. The alignment requirement is from ATA pass
through interface.
@param AtaDevice The ATA child device involved for the operation.
@param BufferSize The request buffer size.
@return A pointer to the aligned buffer or NULL if the allocation fails.
**/
VOID *
AllocateAlignedBuffer (
IN ATA_DEVICE *AtaDevice,
IN UINTN BufferSize
)
{
return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), AtaDevice->AtaBusDriverData->AtaPassThru->Mode->IoAlign);
}
/**
Frees an aligned buffer for ATA device.
This function frees an aligned buffer for the ATA device to perform
ATA pass through operations.
@param Buffer The aligned buffer to be freed.
@param BufferSize The request buffer size.
**/
VOID
FreeAlignedBuffer (
IN VOID *Buffer,
IN UINTN BufferSize
)
{
if (Buffer != NULL) {
FreeAlignedPages (Buffer, EFI_SIZE_TO_PAGES (BufferSize));
}
}
/**
Release all the resources allocated for the ATA device.
This function releases all the resources allocated for the ATA device.
@param AtaDevice The ATA child device involved for the operation.
**/
VOID
ReleaseAtaResources (
IN ATA_DEVICE *AtaDevice
)
{
ATA_BUS_ASYN_SUB_TASK *SubTask;
ATA_BUS_ASYN_TASK *AtaTask;
LIST_ENTRY *Entry;
LIST_ENTRY *DelEntry;
EFI_TPL OldTpl;
FreeUnicodeStringTable (AtaDevice->ControllerNameTable);
FreeAlignedBuffer (AtaDevice->Asb, sizeof (EFI_ATA_STATUS_BLOCK));
FreeAlignedBuffer (AtaDevice->IdentifyData, sizeof (ATA_IDENTIFY_DATA));
if (AtaDevice->DevicePath != NULL) {
FreePool(AtaDevice->DevicePath);
}
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
if (!IsListEmpty (&AtaDevice->AtaSubTaskList)) {
//
// Free the Subtask list.
//
for(Entry = AtaDevice->AtaSubTaskList.ForwardLink;
Entry != (&AtaDevice->AtaSubTaskList);
) {
DelEntry = Entry;
Entry = Entry->ForwardLink;
SubTask = ATA_AYNS_SUB_TASK_FROM_ENTRY (DelEntry);
RemoveEntryList (DelEntry);
FreeAtaSubTask (SubTask);
}
}
if (!IsListEmpty (&AtaDevice->AtaTaskList)) {
//
// Free the Subtask list.
//
for(Entry = AtaDevice->AtaTaskList.ForwardLink;
Entry != (&AtaDevice->AtaTaskList);
) {
DelEntry = Entry;
Entry = Entry->ForwardLink;
AtaTask = ATA_AYNS_TASK_FROM_ENTRY (DelEntry);
RemoveEntryList (DelEntry);
FreePool(AtaTask);
}
}
if (AtaDevice->ExitBootServiceEvent != NULL) {
gBS->CloseEvent (AtaDevice->ExitBootServiceEvent);
AtaDevice->ExitBootServiceEvent = NULL;
}
gBS->RestoreTPL (OldTpl);
FreePool(AtaDevice);
}
/**
The is an event(generally the event is exitBootService event) call back function.
Clear pending IDE interrupt before OS loader/kernel take control of the IDE device.
@param Event Pointer to this event
@param Context Event handler private data
**/
VOID
EFIAPI
ClearInterrupt (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
// UINT64 IoPortForBmis;
// UINT8 RegisterValue;
ATA_DEVICE *AtaDev;
// ATA_BUS_DRIVER_DATA *AtaBusDriverData;
// EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
//
// Get our context
//
AtaDev = (ATA_DEVICE *) Context;
// AtaBusDriverData = AtaDev->AtaBusDriverData;
// AtaPassThru = AtaBusDriverData->AtaPassThru;
//
// Obtain IDE IO port registers' base addresses in case switch native<->legacy
//
/* Status = ReassignIdeResources (IdeDev);
if (EFI_ERROR(Status)) {
return;
}*/
//
// Check whether interrupt is pending
//
//
// Reset IDE device to force it de-assert interrupt pin
// Note: this will reset all devices on this IDE channel
//
// AtaSoftReset (PciIo, IdeRegisters, Timeout);
// Status = AtaDev->BlockIo.Reset(AtaDev->BlockIo, FALSE);
// Status = AtaPassThru->ResetPort(AtaPassThru->ResetPort, 0);
Status = ResetAtaDevice(AtaDev);
if (EFI_ERROR(Status)) {
return;
}
/*
//
// Get base address of IDE Bus Master Status Register
//
if (IdePrimary == IdeDev->Channel) {
IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISP_OFFSET;
} else {
if (IdeSecondary == IdeDev->Channel) {
IoPortForBmis = IdeDev->IoPort->BusMasterBaseAddr + BMISS_OFFSET;
} else {
return;
}
}
//
// Read BMIS register and clear ERROR and INTR bit
//
IdeDev->PciIo->Io.Read (
IdeDev->PciIo,
EfiPciIoWidthUint8,
EFI_PCI_IO_PASS_THROUGH_BAR,
IoPortForBmis,
1,
&RegisterValue
);
RegisterValue |= (BMIS_INTERRUPT | BMIS_ERROR);
IdeDev->PciIo->Io.Write (
IdeDev->PciIo,
EfiPciIoWidthUint8,
EFI_PCI_IO_PASS_THROUGH_BAR,
IoPortForBmis,
1,
&RegisterValue
);
//
// Select the other device on this channel to ensure this device to release the interrupt pin
//
if (IdeDev->Device == 0) {
RegisterValue = (1 << 4) | 0xe0;
} else {
RegisterValue = (0 << 4) | 0xe0;
}
IdeWritePortB (IdeDev->PciIo, IdeDev->IoPort->Head, RegisterValue);
*/
}
/**
Registers an ATA device.
This function allocates an ATA device structure for the ATA device specified by
Port and PortMultiplierPort if the ATA device is identified as a valid one.
Then it will create child handle and install Block IO and Disk Info protocol on
it.
@param AtaBusDriverData The parent ATA bus driver data structure.
@param Port The port number of the ATA device.
@param PortMultiplierPort The port multiplier port number of the ATA device.
@retval EFI_SUCCESS The ATA device is successfully registered.
@retval EFI_OUT_OF_RESOURCES There is not enough memory to allocate the ATA device
and related data structures.
@return Others Some error occurs when registering the ATA device.
**/
EFI_STATUS
RegisterAtaDevice (
IN OUT ATA_BUS_DRIVER_DATA *AtaBusDriverData,
IN UINT16 Port,
IN UINT16 PortMultiplierPort
)
{
EFI_STATUS Status;
ATA_DEVICE *AtaDevice;
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
EFI_DEVICE_PATH_PROTOCOL *NewDevicePathNode;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
EFI_HANDLE DeviceHandle;
AtaDevice = NULL;
NewDevicePathNode = NULL;
DevicePath = NULL;
RemainingDevicePath = NULL;
//
// Build device path
//
AtaPassThru = AtaBusDriverData->AtaPassThru;
Status = AtaPassThru->BuildDevicePath (AtaPassThru, Port, PortMultiplierPort, &NewDevicePathNode);
if (EFI_ERROR(Status)) {
goto Done;
}
DevicePath = AppendDevicePathNode (AtaBusDriverData->ParentDevicePath, NewDevicePathNode);
if (DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
DeviceHandle = NULL;
RemainingDevicePath = DevicePath;
Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &DeviceHandle);
if (!EFI_ERROR(Status) && (DeviceHandle != NULL) && IsDevicePathEnd(RemainingDevicePath)) {
Status = EFI_ALREADY_STARTED;
FreePool(DevicePath);
goto Done;
}
//
// Allocate ATA device from the template.
//
AtaDevice = AllocateCopyPool(sizeof (ATA_DEVICE), &gAtaDeviceTemplate);
if (AtaDevice == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
//
// Initializes ATA device structures and allocates the required buffer.
//
AtaDevice->BlockIo.Media = &AtaDevice->BlockMedia;
AtaDevice->BlockIo2.Media = &AtaDevice->BlockMedia;
AtaDevice->AtaBusDriverData = AtaBusDriverData;
AtaDevice->DevicePath = DevicePath;
AtaDevice->Port = Port;
AtaDevice->PortMultiplierPort = PortMultiplierPort;
AtaDevice->Asb = AllocateAlignedBuffer (AtaDevice, sizeof (EFI_ATA_STATUS_BLOCK));
if (AtaDevice->Asb == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
AtaDevice->IdentifyData = AllocateAlignedBuffer (AtaDevice, sizeof (ATA_IDENTIFY_DATA));
if (AtaDevice->IdentifyData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
//
// Initial Ata Task List
//
InitializeListHead (&AtaDevice->AtaTaskList);
InitializeListHead (&AtaDevice->AtaSubTaskList);
//
// Try to identify the ATA device via the ATA pass through command.
//
Status = DiscoverAtaDevice (AtaDevice);
if (EFI_ERROR(Status)) {
goto Done;
}
//
// Build controller name for Component Name (2) protocol.
//
Status = AddUnicodeString2 (
"eng",
gAtaBusComponentName.SupportedLanguages,
&AtaDevice->ControllerNameTable,
AtaDevice->ModelName,
TRUE
);
if (EFI_ERROR(Status)) {
goto Done;
}
Status = AddUnicodeString2 (
"en",
gAtaBusComponentName2.SupportedLanguages,
&AtaDevice->ControllerNameTable,
AtaDevice->ModelName,
FALSE
);
if (EFI_ERROR(Status)) {
goto Done;
}
//
// Update to AHCI interface GUID based on device path node. The default one
// is IDE interface GUID copied from template.
//
if (NewDevicePathNode->SubType == MSG_SATA_DP) {
CopyGuid (&AtaDevice->DiskInfo.Interface, &gEfiDiskInfoAhciInterfaceGuid);
}
Status = gBS->InstallMultipleProtocolInterfaces (
&AtaDevice->Handle,
&gEfiDevicePathProtocolGuid,
AtaDevice->DevicePath,
&gEfiBlockIoProtocolGuid,
&AtaDevice->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&AtaDevice->BlockIo2,
&gEfiDiskInfoProtocolGuid,
&AtaDevice->DiskInfo,
NULL
);
if (EFI_ERROR(Status)) {
goto Done;
}
//
// See if the ata device support trust computing feature or not.
// If yes, then install Storage Security Protocol at the ata device handle.
//
if ((AtaDevice->IdentifyData->trusted_computing_support & BIT0) != 0) {
// DEBUG ((EFI_D_INFO, "Found TCG support in Port %x PortMultiplierPort %x\n", Port, PortMultiplierPort));
DBG(L"Found TCG support in Port %x PortMultiplierPort %x\n", Port, PortMultiplierPort);
Status = gBS->InstallProtocolInterface (
&AtaDevice->Handle,
&gEfiStorageSecurityCommandProtocolGuid,
EFI_NATIVE_INTERFACE,
&AtaDevice->StorageSecurity
);
if (EFI_ERROR(Status)) {
goto Done;
}
DEBUG ((EFI_D_INFO, "Successfully Install Storage Security Protocol on the ATA device\n"));
}
if (mHasMor) {
if (((mMorControl & 0x01) == 0x01) && ((AtaDevice->IdentifyData->trusted_computing_support & BIT0) != 0)) {
DEBUG ((EFI_D_INFO,
"mMorControl = %x, AtaDevice->IdentifyData->trusted_computing_support & BIT0 = %x\n",
mMorControl,
(AtaDevice->IdentifyData->trusted_computing_support & BIT0)
));
DEBUG ((EFI_D_INFO, "Try to lock device by sending TPer Reset command...\n"));
InitiateTPerReset(AtaDevice);
}
}
gBS->OpenProtocol (
AtaBusDriverData->Controller,
&gEfiAtaPassThruProtocolGuid,
(VOID **) &AtaPassThru,
AtaBusDriverData->DriverBindingHandle,
AtaDevice->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
//Slice - here we want to create event... really?
//
// Create event to clear pending IDE interrupt
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
ClearInterrupt,
AtaDevice,
&gEfiEventExitBootServicesGuid,
&AtaDevice->ExitBootServiceEvent
);
Done:
if (NewDevicePathNode != NULL) {
FreePool(NewDevicePathNode);
}
if (EFI_ERROR(Status) && (AtaDevice != NULL)) {
ReleaseAtaResources (AtaDevice);
// DEBUG ((EFI_D_ERROR | EFI_D_INIT, "Failed to initialize Port %x PortMultiplierPort %x, status = %r\n", Port, PortMultiplierPort, Status));
DBG(L"Failed to initialize Port %x PortMultiplierPort %x, status = %r\n", Port, PortMultiplierPort, Status);
}
return Status;
}
/**
Unregisters an ATA device.
This function removes the protocols installed on the controller handle and
frees the resources allocated for the ATA device.
@param This The pointer to EFI_DRIVER_BINDING_PROTOCOL instance.
@param Controller The controller handle of the ATA device.
@param Handle The child handle.
@retval EFI_SUCCESS The ATA device is successfully unregistered.
@return Others Some error occurs when unregistering the ATA device.
**/
EFI_STATUS
UnregisterAtaDevice (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_HANDLE Handle
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
ATA_DEVICE *AtaDevice;
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *StorageSecurity;
BlockIo2 = NULL;
BlockIo = NULL;
Status = gBS->OpenProtocol (
Handle,
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
//
// Locate BlockIo2 protocol
//
Status = gBS->OpenProtocol (
Handle,
&gEfiBlockIo2ProtocolGuid,
(VOID **) &BlockIo2,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
return Status;
}
}
//
// Get AtaDevice data.
//
if (BlockIo != NULL) {
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (BlockIo);
} else {
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (BlockIo2);
}
//
// Close the child handle
//
gBS->CloseProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
This->DriverBindingHandle,
Handle
);
//
// The Ata Bus driver installs the BlockIo and BlockIo2 in the DriverBindingStart().
// Here should uninstall both of them.
//
Status = gBS->UninstallMultipleProtocolInterfaces (
Handle,
&gEfiDevicePathProtocolGuid,
AtaDevice->DevicePath,
&gEfiBlockIoProtocolGuid,
&AtaDevice->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&AtaDevice->BlockIo2,
&gEfiDiskInfoProtocolGuid,
&AtaDevice->DiskInfo,
NULL
);
if (EFI_ERROR(Status)) {
gBS->OpenProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
(VOID **) &AtaPassThru,
This->DriverBindingHandle,
Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
return Status;
}
//
// If Storage Security Command Protocol is installed, then uninstall this protocol.
//
Status = gBS->OpenProtocol (
Handle,
&gEfiStorageSecurityCommandProtocolGuid,
(VOID **) &StorageSecurity,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR(Status)) {
Status = gBS->UninstallProtocolInterface (
Handle,
&gEfiStorageSecurityCommandProtocolGuid,
&AtaDevice->StorageSecurity
);
if (EFI_ERROR(Status)) {
gBS->OpenProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
(VOID **) &AtaPassThru,
This->DriverBindingHandle,
Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
return Status;
}
}
ReleaseAtaResources (AtaDevice);
return EFI_SUCCESS;
}
/**
Tests to see if this driver supports a given controller. If a child device is provided,
it further tests to see if this driver supports creating a handle for the specified child device.
This function checks to see if the driver specified by This supports the device specified by
ControllerHandle. Drivers will typically use the device path attached to
ControllerHandle and/or the services from the bus I/O abstraction attached to
ControllerHandle to determine if the driver supports ControllerHandle. This function
may be called many times during platform initialization. In order to reduce boot times, the tests
performed by this function must be very small, and take as little time as possible to execute. This
function must not change the state of any hardware devices, and this function must be aware that the
device specified by ControllerHandle may already be managed by the same driver or a
different driver. This function must match its calls to AllocatePages() with FreePages(),
AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
Since ControllerHandle may have been previously started by the same driver, if a protocol is
already in the opened state, then it must not be closed with CloseProtocol(). This is required
to guarantee the state of ControllerHandle is not modified by this function.
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
@param[in] ControllerHandle The handle of the controller to test. This handle
must support a protocol interface that supplies
an I/O abstraction to the driver.
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
parameter is ignored by device drivers, and is optional for bus
drivers. For bus drivers, if this parameter is not NULL, then
the bus driver must determine if the bus controller specified
by ControllerHandle and the child controller specified
by RemainingDevicePath are both supported by this
bus driver.
@retval EFI_SUCCESS The device specified by ControllerHandle and
RemainingDevicePath is supported by the driver specified by This.
@retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
RemainingDevicePath is already being managed by the driver
specified by This.
@retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
RemainingDevicePath is already being managed by a different
driver or an application that requires exclusive access.
Currently not implemented.
@retval EFI_UNSUPPORTED The device specified by ControllerHandle and
RemainingDevicePath is not supported by the driver specified by This.
**/
EFI_STATUS
EFIAPI
AtaBusDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
UINT16 Port;
UINT16 PortMultiplierPort;
//
// Test EFI_ATA_PASS_THRU_PROTOCOL on controller handle.
//
Status = gBS->OpenProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
(VOID **) &AtaPassThru,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (Status == EFI_ALREADY_STARTED) {
return EFI_SUCCESS;
}
if (EFI_ERROR(Status)) {
return Status;
}
//
// Test RemainingDevicePath is valid or not.
//
if ((RemainingDevicePath != NULL) && !IsDevicePathEnd (RemainingDevicePath)) {
Status = AtaPassThru->GetDevice (AtaPassThru, RemainingDevicePath, &Port, &PortMultiplierPort);
if (EFI_ERROR(Status)) {
return Status;
}
}
//
// Close the I/O Abstraction(s) used to perform the supported test
//
gBS->CloseProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
//
// Open the EFI Device Path protocol needed to perform the supported test
//
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
return Status;
}
/**
Starts a device controller or a bus controller.
The Start() function is designed to be invoked from the EFI boot service ConnectController().
As a result, much of the error checking on the parameters to Start() has been moved into this
common boot service. It is legal to call Start() from other locations,
but the following calling restrictions must be followed or the system behavior will not be deterministic.
1. ControllerHandle must be a valid EFI_HANDLE.
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
EFI_DEVICE_PATH_PROTOCOL.
3. Prior to calling Start(), the Supported() function for the driver specified by This must
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
@param[in] ControllerHandle The handle of the controller to start. This handle
must support a protocol interface that supplies
an I/O abstraction to the driver.
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
parameter is ignored by device drivers, and is optional for bus
drivers. For a bus driver, if this parameter is NULL, then handles
for all the children of Controller are created by this driver.
If this parameter is not NULL and the first Device Path Node is
not the End of Device Path Node, then only the handle for the
child device specified by the first Device Path Node of
RemainingDevicePath is created by this driver.
If the first Device Path Node of RemainingDevicePath is
the End of Device Path Node, no child handle is created by this
driver.
@retval EFI_SUCCESS The device was started.
@retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
@retval Others The driver failded to start the device.
**/
EFI_STATUS
EFIAPI
AtaBusDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
UINT16 Port;
UINT16 PortMultiplierPort;
AtaBusDriverData = NULL;
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
return Status;
}
Status = gBS->OpenProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
(VOID **) &AtaPassThru,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if ((EFI_ERROR(Status)) && (Status != EFI_ALREADY_STARTED)) {
goto ErrorExit;
}
//
// Check EFI_ALREADY_STARTED to reuse the original ATA_BUS_DRIVER_DATA.
//
if (Status != EFI_ALREADY_STARTED) {
AtaBusDriverData = AllocateZeroPool(sizeof (ATA_BUS_DRIVER_DATA));
if (AtaBusDriverData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ErrorExit;
}
AtaBusDriverData->AtaPassThru = AtaPassThru;
AtaBusDriverData->Controller = Controller;
AtaBusDriverData->ParentDevicePath = ParentDevicePath;
AtaBusDriverData->DriverBindingHandle = This->DriverBindingHandle;
Status = gBS->InstallMultipleProtocolInterfaces (
&Controller,
&gEfiCallerIdGuid,
AtaBusDriverData,
NULL
);
if (EFI_ERROR(Status)) {
goto ErrorExit;
}
} else {
Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
(VOID **) &AtaBusDriverData,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR(Status)) {
AtaBusDriverData = NULL;
goto ErrorExit;
}
}
if (RemainingDevicePath == NULL) {
Port = 0xFFFF;
while (TRUE) {
Status = AtaPassThru->GetNextPort (AtaPassThru, &Port);
if (EFI_ERROR(Status)) {
//
// We cannot find more legal port then we are done.
//
break;
}
PortMultiplierPort = 0xFFFF;
while (TRUE) {
Status = AtaPassThru->GetNextDevice (AtaPassThru, Port, &PortMultiplierPort);
if (EFI_ERROR(Status)) {
//
// We cannot find more legal port multiplier port number for ATA device
// on the port, then we are done.
//
break;
}
RegisterAtaDevice (AtaBusDriverData, Port, PortMultiplierPort);
}
}
Status = EFI_SUCCESS;
} else if (!IsDevicePathEnd (RemainingDevicePath)) {
Status = AtaPassThru->GetDevice (AtaPassThru, RemainingDevicePath, &Port, &PortMultiplierPort);
if (!EFI_ERROR(Status)) {
Status = RegisterAtaDevice (AtaBusDriverData,Port, PortMultiplierPort);
}
}
return Status;
ErrorExit:
if (AtaBusDriverData != NULL) {
gBS->UninstallMultipleProtocolInterfaces (
Controller,
&gEfiCallerIdGuid,
AtaBusDriverData,
NULL
);
FreePool(AtaBusDriverData);
}
gBS->CloseProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
return Status;
}
/**
Stops a device controller or a bus controller.
The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
As a result, much of the error checking on the parameters to Stop() has been moved
into this common boot service. It is legal to call Stop() from other locations,
but the following calling restrictions must be followed or the system behavior will not be deterministic.
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
same driver's Start() function.
2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
Start() function, and the Start() function must have called OpenProtocol() on
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
@param[in] ControllerHandle A handle to the device being stopped. The handle must
support a bus specific I/O protocol for the driver
to use to stop the device.
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
if NumberOfChildren is 0.
@retval EFI_SUCCESS The device was stopped.
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
**/
EFI_STATUS
EFIAPI
AtaBusDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
BOOLEAN AllChildrenStopped;
UINTN Index;
ATA_BUS_DRIVER_DATA *AtaBusDriverData;
if (NumberOfChildren == 0) {
Status = gBS->OpenProtocol (
Controller,
&gEfiCallerIdGuid,
(VOID **) &AtaBusDriverData,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR(Status)) {
gBS->UninstallMultipleProtocolInterfaces (
Controller,
&gEfiCallerIdGuid,
AtaBusDriverData,
NULL
);
FreePool(AtaBusDriverData);
}
gBS->CloseProtocol (
Controller,
&gEfiAtaPassThruProtocolGuid,
This->DriverBindingHandle,
Controller
);
return EFI_SUCCESS;
}
AllChildrenStopped = TRUE;
for (Index = 0; Index < NumberOfChildren; Index++) {
Status = UnregisterAtaDevice (This, Controller, ChildHandleBuffer[Index]);
if (EFI_ERROR(Status)) {
AllChildrenStopped = FALSE;
}
}
if (!AllChildrenStopped) {
return EFI_DEVICE_ERROR;
}
return EFI_SUCCESS;
}
/**
Reset the Block Device.
@param This Indicates a pointer to the calling context.
@param ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
not be reset.
**/
EFI_STATUS
EFIAPI
AtaBlockIoReset (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
ATA_DEVICE *AtaDevice;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (This);
Status = ResetAtaDevice (AtaDevice);
if (EFI_ERROR(Status)) {
Status = EFI_DEVICE_ERROR;
}
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Read/Write BufferSize bytes from Lba from/into Buffer.
@param[in] This Indicates a pointer to the calling context. Either be
block I/O or block I/O2.
@param[in] MediaId The media ID that the read/write request is for.
@param[in] Lba The starting logical block address to be read/written.
The caller is responsible for reading/writing to only
legitimate locations.
@param[in, out] Token A pointer to the token associated with the transaction.
@param[in] BufferSize Size of Buffer, must be a multiple of device block size.
@param[out] Buffer A pointer to the destination/source buffer for the data.
@param[in] IsBlockIo2 Indicate the calling is from BlockIO or BlockIO2. TURE is
from BlockIO2, FALSE is for BlockIO.
@param[in] IsWrite Indicates whether it is a write operation.
@retval EFI_SUCCESS The data was read/written correctly to the device.
@retval EFI_WRITE_PROTECTED The device can not be read/written to.
@retval EFI_DEVICE_ERROR The device reported an error while performing the read/write.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
@retval EFI_INVALID_PARAMETER The read/write request contains LBAs that are not valid,
or the buffer is not on proper alignment.
**/
EFI_STATUS
BlockIoReadWrite (
IN VOID *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer,
IN BOOLEAN IsBlockIo2,
IN BOOLEAN IsWrite
)
{
ATA_DEVICE *AtaDevice;
EFI_STATUS Status;
EFI_TPL OldTpl;
EFI_BLOCK_IO_MEDIA *Media;
UINTN BlockSize;
UINTN NumberOfBlocks;
UINTN IoAlign;
if (IsBlockIo2) {
Media = ((EFI_BLOCK_IO2_PROTOCOL *) This)->Media;
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (This);
} else {
Media = ((EFI_BLOCK_IO_PROTOCOL *) This)->Media;
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO (This);
}
if (MediaId != Media->MediaId) {
return EFI_MEDIA_CHANGED;
}
//
// Check parameters.
//
if (Buffer == NULL) {
return EFI_INVALID_PARAMETER;
}
if (BufferSize == 0) {
return EFI_SUCCESS;
}
BlockSize = Media->BlockSize;
if ((BufferSize % BlockSize) != 0) {
return EFI_BAD_BUFFER_SIZE;
}
NumberOfBlocks = BufferSize / BlockSize;
if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {
return EFI_INVALID_PARAMETER;
}
IoAlign = Media->IoAlign;
if (IoAlign > 0 && (((UINTN) Buffer & (IoAlign - 1)) != 0)) {
return EFI_INVALID_PARAMETER;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
// Invoke low level AtaDevice Access Routine.
//
Status = AccessAtaDevice (AtaDevice, Buffer, Lba, NumberOfBlocks, IsWrite, Token);
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Read BufferSize bytes from Lba into Buffer.
@param This Indicates a pointer to the calling context.
@param MediaId Id of the media, changes every time the media is replaced.
@param Lba The starting Logical Block Address to read from
@param BufferSize Size of Buffer, must be a multiple of device block size.
@param Buffer A pointer to the destination buffer for the data. The caller is
responsible for either having implicit or explicit ownership of the buffer.
@retval EFI_SUCCESS The data was read correctly from the device.
@retval EFI_DEVICE_ERROR The device reported an error while performing the read.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
or the buffer is not on proper alignment.
**/
EFI_STATUS
EFIAPI
AtaBlockIoReadBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, FALSE);
}
/**
Write BufferSize bytes from Lba into Buffer.
@param This Indicates a pointer to the calling context.
@param MediaId The media ID that the write request is for.
@param Lba The starting logical block address to be written. The caller is
responsible for writing to only legitimate locations.
@param BufferSize Size of Buffer, must be a multiple of device block size.
@param Buffer A pointer to the source buffer for the data.
@retval EFI_SUCCESS The data was written correctly to the device.
@retval EFI_WRITE_PROTECTED The device can not be written to.
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
or the buffer is not on proper alignment.
**/
EFI_STATUS
EFIAPI
AtaBlockIoWriteBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, NULL, BufferSize, Buffer, FALSE, TRUE);
}
/**
Flush the Block Device.
@param This Indicates a pointer to the calling context.
@retval EFI_SUCCESS All outstanding data was written to the device
@retval EFI_DEVICE_ERROR The device reported an error while writing back the data
@retval EFI_NO_MEDIA There is no media in the device.
**/
EFI_STATUS
EFIAPI
AtaBlockIoFlushBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This
)
{
//
// return directly
//
return EFI_SUCCESS;
}
/**
Reset the Block Device.
@param[in] This Indicates a pointer to the calling context.
@param[in] ExtendedVerification Driver may perform diagnostics on reset.
@retval EFI_SUCCESS The device was reset.
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
not be reset.
**/
EFI_STATUS
EFIAPI
AtaBlockIoResetEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
ATA_DEVICE *AtaDevice;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
AtaDevice = ATA_DEVICE_FROM_BLOCK_IO2 (This);
Status = ResetAtaDevice (AtaDevice);
if (EFI_ERROR(Status)) {
Status = EFI_DEVICE_ERROR;
}
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Read BufferSize bytes from Lba into Buffer.
@param[in] This Indicates a pointer to the calling context.
@param[in] MediaId Id of the media, changes every time the media is replaced.
@param[in] Lba The starting Logical Block Address to read from.
@param[in, out] Token A pointer to the token associated with the transaction.
@param[in] BufferSize Size of Buffer, must be a multiple of device block size.
@param[out] Buffer A pointer to the destination buffer for the data. The caller is
responsible for either having implicit or explicit ownership of the buffer.
@retval EFI_SUCCESS The read request was queued if Event is not NULL.
The data was read correctly from the device if
the Event is NULL.
@retval EFI_DEVICE_ERROR The device reported an error while performing
the read.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
intrinsic block size of the device.
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
or the buffer is not on proper alignment.
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
of resources.
**/
EFI_STATUS
EFIAPI
AtaBlockIoReadBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, FALSE);
}
/**
Write BufferSize bytes from Lba into Buffer.
@param[in] This Indicates a pointer to the calling context.
@param[in] MediaId The media ID that the write request is for.
@param[in] Lba The starting logical block address to be written. The
caller is responsible for writing to only legitimate
locations.
@param[in, out] Token A pointer to the token associated with the transaction.
@param[in] BufferSize Size of Buffer, must be a multiple of device block size.
@param[in] Buffer A pointer to the source buffer for the data.
@retval EFI_SUCCESS The data was written correctly to the device.
@retval EFI_WRITE_PROTECTED The device can not be written to.
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
or the buffer is not on proper alignment.
**/
EFI_STATUS
EFIAPI
AtaBlockIoWriteBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
return BlockIoReadWrite ((VOID *) This, MediaId, Lba, Token, BufferSize, Buffer, TRUE, TRUE);
}
/**
Flush the Block Device.
@param[in] This Indicates a pointer to the calling context.
@param[in, out] Token A pointer to the token associated with the transaction.
@retval EFI_SUCCESS All outstanding data was written to the device
@retval EFI_DEVICE_ERROR The device reported an error while writing back the data
@retval EFI_NO_MEDIA There is no media in the device.
**/
EFI_STATUS
EFIAPI
AtaBlockIoFlushBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
)
{
//
// Signal event and return directly.
//
if (Token != NULL && Token->Event != NULL) {
Token->TransactionStatus = EFI_SUCCESS;
gBS->SignalEvent (Token->Event);
}
return EFI_SUCCESS;
}
/**
Provides inquiry information for the controller type.
This function is used by the IDE bus driver to get inquiry data. Data format
of Identify data is defined by the Interface GUID.
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
@param[in, out] InquiryData Pointer to a buffer for the inquiry data.
@param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
@retval EFI_SUCCESS The command was accepted without any errors.
@retval EFI_NOT_FOUND Device does not support this data class
@retval EFI_DEVICE_ERROR Error reading InquiryData from device
@retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
**/
EFI_STATUS
EFIAPI
AtaDiskInfoInquiry (
IN EFI_DISK_INFO_PROTOCOL *This,
IN OUT VOID *InquiryData,
IN OUT UINT32 *InquiryDataSize
)
{
return EFI_NOT_FOUND;
}
/**
Provides identify information for the controller type.
This function is used by the IDE bus driver to get identify data. Data format
of Identify data is defined by the Interface GUID.
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
instance.
@param[in, out] IdentifyData Pointer to a buffer for the identify data.
@param[in, out] IdentifyDataSize Pointer to the value for the identify data
size.
@retval EFI_SUCCESS The command was accepted without any errors.
@retval EFI_NOT_FOUND Device does not support this data class
@retval EFI_DEVICE_ERROR Error reading IdentifyData from device
@retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
**/
EFI_STATUS
EFIAPI
AtaDiskInfoIdentify (
IN EFI_DISK_INFO_PROTOCOL *This,
IN OUT VOID *IdentifyData,
IN OUT UINT32 *IdentifyDataSize
)
{
EFI_STATUS Status;
ATA_DEVICE *AtaDevice;
AtaDevice = ATA_DEVICE_FROM_DISK_INFO (This);
Status = EFI_BUFFER_TOO_SMALL;
if (*IdentifyDataSize >= sizeof (ATA_IDENTIFY_DATA)) {
Status = EFI_SUCCESS;
CopyMem(IdentifyData, AtaDevice->IdentifyData, sizeof (ATA_IDENTIFY_DATA));
}
*IdentifyDataSize = sizeof (ATA_IDENTIFY_DATA);
return Status;
}
/**
Provides sense data information for the controller type.
This function is used by the IDE bus driver to get sense data.
Data format of Sense data is defined by the Interface GUID.
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
@param[in, out] SenseData Pointer to the SenseData.
@param[in, out] SenseDataSize Size of SenseData in bytes.
@param[out] SenseDataNumber Pointer to the value for the sense data size.
@retval EFI_SUCCESS The command was accepted without any errors.
@retval EFI_NOT_FOUND Device does not support this data class.
@retval EFI_DEVICE_ERROR Error reading SenseData from device.
@retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
**/
EFI_STATUS
EFIAPI
AtaDiskInfoSenseData (
IN EFI_DISK_INFO_PROTOCOL *This,
IN OUT VOID *SenseData,
IN OUT UINT32 *SenseDataSize,
OUT UINT8 *SenseDataNumber
)
{
return EFI_NOT_FOUND;
}
/**
This function is used by the IDE bus driver to get controller information.
@param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
@param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
@param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
@retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
@retval EFI_UNSUPPORTED This is not an IDE device.
**/
EFI_STATUS
EFIAPI
AtaDiskInfoWhichIde (
IN EFI_DISK_INFO_PROTOCOL *This,
OUT UINT32 *IdeChannel,
OUT UINT32 *IdeDevice
)
{
ATA_DEVICE *AtaDevice;
AtaDevice = ATA_DEVICE_FROM_DISK_INFO (This);
*IdeChannel = AtaDevice->Port;
*IdeDevice = AtaDevice->PortMultiplierPort;
return EFI_SUCCESS;
}
/**
Send a security protocol command to a device that receives data and/or the result
of one or more commands sent by SendData.
The ReceiveData function sends a security protocol command to the given MediaId.
The security protocol command sent is defined by SecurityProtocolId and contains
the security protocol specific data SecurityProtocolSpecificData. The function
returns the data from the security protocol command in PayloadBuffer.
For devices supporting the SCSI command set, the security protocol command is sent
using the SECURITY PROTOCOL IN command defined in SPC-4.
For devices supporting the ATA command set, the security protocol command is sent
using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize
is non-zero.
If the PayloadBufferSize is zero, the security protocol command is sent using the
Trusted Non-Data command defined in ATA8-ACS.
If PayloadBufferSize is too small to store the available data from the security
protocol command, the function shall copy PayloadBufferSize bytes into the
PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.
If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,
the function shall return EFI_INVALID_PARAMETER.
If the given MediaId does not support security protocol commands, the function shall
return EFI_UNSUPPORTED. If there is no media in the device, the function returns
EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,
the function returns EFI_MEDIA_CHANGED.
If the security protocol fails to complete within the Timeout period, the function
shall return EFI_TIMEOUT.
If the security protocol command completes without an error, the function shall
return EFI_SUCCESS. If the security protocol command completes with an error, the
function shall return EFI_DEVICE_ERROR.
@param This Indicates a pointer to the calling context.
@param MediaId ID of the medium to receive data from.
@param Timeout The timeout, in 100ns units, to use for the execution
of the security protocol command. A Timeout value of 0
means that this function will wait indefinitely for the
security protocol command to execute. If Timeout is greater
than zero, then this function will return EFI_TIMEOUT
if the time required to execute the receive data command
is greater than Timeout.
@param SecurityProtocolId The value of the "Security Protocol" parameter of
the security protocol command to be sent.
@param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
of the security protocol command to be sent.
@param PayloadBufferSize Size in bytes of the payload data buffer.
@param PayloadBuffer A pointer to a destination buffer to store the security
protocol command specific payload data for the security
protocol command. The caller is responsible for having
either implicit or explicit ownership of the buffer.
@param PayloadTransferSize A pointer to a buffer to store the size in bytes of the
data written to the payload data buffer.
@retval EFI_SUCCESS The security protocol command completed successfully.
@retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available
data from the device. The PayloadBuffer contains the truncated data.
@retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
@retval EFI_DEVICE_ERROR The security protocol command completed with an error.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
@retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and
PayloadBufferSize is non-zero.
@retval EFI_TIMEOUT A timeout occurred while waiting for the security
protocol command to execute.
**/
EFI_STATUS
EFIAPI
AtaStorageSecurityReceiveData (
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Timeout,
IN UINT8 SecurityProtocolId,
IN UINT16 SecurityProtocolSpecificData,
IN UINTN PayloadBufferSize,
OUT VOID *PayloadBuffer,
OUT UINTN *PayloadTransferSize
)
{
EFI_STATUS Status;
ATA_DEVICE *Private;
EFI_TPL OldTpl;
// DEBUG ((EFI_D_INFO, "EFI Storage Security Protocol - Read"));
if ((PayloadBuffer == NULL || PayloadTransferSize == NULL) && PayloadBufferSize != 0) {
return EFI_INVALID_PARAMETER;
}
Status = EFI_SUCCESS;
Private = ATA_DEVICE_FROM_STORAGE_SECURITY (This);
if (MediaId != Private->BlockIo.Media->MediaId) {
return EFI_MEDIA_CHANGED;
}
if (!Private->BlockIo.Media->MediaPresent) {
return EFI_NO_MEDIA;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Status = TrustTransferAtaDevice (
Private,
PayloadBuffer,
SecurityProtocolId,
SecurityProtocolSpecificData,
PayloadBufferSize,
FALSE,
Timeout,
PayloadTransferSize
);
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Send a security protocol command to a device.
The SendData function sends a security protocol command containing the payload
PayloadBuffer to the given MediaId. The security protocol command sent is
defined by SecurityProtocolId and contains the security protocol specific data
SecurityProtocolSpecificData. If the underlying protocol command requires a
specific padding for the command payload, the SendData function shall add padding
bytes to the command payload to satisfy the padding requirements.
For devices supporting the SCSI command set, the security protocol command is sent
using the SECURITY PROTOCOL OUT command defined in SPC-4.
For devices supporting the ATA command set, the security protocol command is sent
using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize
is non-zero. If the PayloadBufferSize is zero, the security protocol command is
sent using the Trusted Non-Data command defined in ATA8-ACS.
If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall
return EFI_INVALID_PARAMETER.
If the given MediaId does not support security protocol commands, the function
shall return EFI_UNSUPPORTED. If there is no media in the device, the function
returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the
device, the function returns EFI_MEDIA_CHANGED.
If the security protocol fails to complete within the Timeout period, the function
shall return EFI_TIMEOUT.
If the security protocol command completes without an error, the function shall return
EFI_SUCCESS. If the security protocol command completes with an error, the function
shall return EFI_DEVICE_ERROR.
@param This Indicates a pointer to the calling context.
@param MediaId ID of the medium to receive data from.
@param Timeout The timeout, in 100ns units, to use for the execution
of the security protocol command. A Timeout value of 0
means that this function will wait indefinitely for the
security protocol command to execute. If Timeout is greater
than zero, then this function will return EFI_TIMEOUT
if the time required to execute the receive data command
is greater than Timeout.
@param SecurityProtocolId The value of the "Security Protocol" parameter of
the security protocol command to be sent.
@param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter
of the security protocol command to be sent.
@param PayloadBufferSize Size in bytes of the payload data buffer.
@param PayloadBuffer A pointer to a destination buffer to store the security
protocol command specific payload data for the security
protocol command.
@retval EFI_SUCCESS The security protocol command completed successfully.
@retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.
@retval EFI_DEVICE_ERROR The security protocol command completed with an error.
@retval EFI_NO_MEDIA There is no media in the device.
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
@retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.
@retval EFI_TIMEOUT A timeout occurred while waiting for the security
protocol command to execute.
**/
EFI_STATUS
EFIAPI
AtaStorageSecuritySendData (
IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Timeout,
IN UINT8 SecurityProtocolId,
IN UINT16 SecurityProtocolSpecificData,
IN UINTN PayloadBufferSize,
IN VOID *PayloadBuffer
)
{
EFI_STATUS Status;
ATA_DEVICE *Private;
EFI_TPL OldTpl;
// DEBUG ((EFI_D_INFO, "EFI Storage Security Protocol - Send"));
if ((PayloadBuffer == NULL) && (PayloadBufferSize != 0)) {
return EFI_INVALID_PARAMETER;
}
Status = EFI_SUCCESS;
Private = ATA_DEVICE_FROM_STORAGE_SECURITY (This);
if (MediaId != Private->BlockIo.Media->MediaId) {
return EFI_MEDIA_CHANGED;
}
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Status = TrustTransferAtaDevice (
Private,
PayloadBuffer,
SecurityProtocolId,
SecurityProtocolSpecificData,
PayloadBufferSize,
TRUE,
Timeout,
NULL
);
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
The user Entry Point for module AtaBus. The user code starts with this function.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
**/
EFI_STATUS
EFIAPI
InitializeAtaBus(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
UINTN DataSize;
//
// Install driver model protocol(s).
//
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gAtaBusDriverBinding,
ImageHandle,
&gAtaBusComponentName,
&gAtaBusComponentName2
);
// ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) {
return Status;
}
//
// Get the MorControl bit.
//
DataSize = sizeof (mMorControl);
Status = gRT->GetVariable (
MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME,
&gEfiMemoryOverwriteControlDataGuid,
NULL,
&DataSize,
&mMorControl
);
if (EFI_ERROR(Status)) {
// DEBUG ((EFI_D_INFO, "AtaBus:gEfiMemoryOverwriteControlDataGuid doesn't exist!!***\n"));
mHasMor = FALSE;
mMorControl = 0;
Status = EFI_SUCCESS;
} else {
// DEBUG ((EFI_D_INFO, "AtaBus:Get the gEfiMemoryOverwriteControlDataGuid = %x!!***\n", mMorControl));
mHasMor = TRUE;
}
return Status;
}
/**
Send TPer Reset command to reset eDrive to lock all protected bands.
Typically, there are 2 mechanism for resetting eDrive. They are:
1. TPer Reset through IEEE 1667 protocol.
2. TPer Reset through native TCG protocol.
This routine will detect what protocol the attached eDrive comform to, TCG or
IEEE 1667 protocol. Then send out TPer Reset command separately.
@param[in] AtaDevice ATA_DEVICE pointer.
**/
VOID
InitiateTPerReset (
IN ATA_DEVICE *AtaDevice
)
{
EFI_STATUS Status;
UINT8 *Buffer;
UINTN XferSize;
UINTN Len;
UINTN Index;
BOOLEAN TcgFlag;
BOOLEAN IeeeFlag;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *Ssp;
SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA *Data;
// Buffer = NULL;
if (!AtaDevice) {
return;
}
TcgFlag = FALSE;
IeeeFlag = FALSE;
Ssp = &AtaDevice->StorageSecurity;
BlockIo = &AtaDevice->BlockIo;
//
// ATA8-ACS 7.57.6.1 indicates the Transfer Length field requirements a multiple of 512.
// If the length of the TRUSTED RECEIVE parameter data is greater than the Transfer Length,
// then the device shall return the TRUSTED RECEIVE parameter data truncated to the requested Transfer Length.
//
Len = ROUNDUP512(sizeof(SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA));
Buffer = AllocateZeroPool(Len);
if (Buffer == NULL) {
return;
}
//
// When the Security Protocol field is set to 00h, and SP Specific is set to 0000h in a TRUSTED RECEIVE
// command, the device basic information data shall be returned.
//
Status = Ssp->ReceiveData (
Ssp,
BlockIo->Media->MediaId,
100000000, // Timeout 10-sec
0, // SecurityProtocol
0, // SecurityProtocolSpecifcData
Len, // PayloadBufferSize,
Buffer, // PayloadBuffer
&XferSize
);
if (EFI_ERROR(Status)) {
goto Exit;
}
//
// In returned data, the ListLength field indicates the total length, in bytes,
// of the supported security protocol list.
//
Data = (SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA*)Buffer;
Len = ROUNDUP512(sizeof (SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA) +
(Data->SupportedSecurityListLength[0] << 8) +
(Data->SupportedSecurityListLength[1])
);
//
// Free original buffer and allocate new buffer.
//
FreePool(Buffer);
Buffer = AllocateZeroPool(Len);
if (Buffer == NULL) {
return;
}
//
// Read full supported security protocol list from device.
//
Status = Ssp->ReceiveData (
Ssp,
BlockIo->Media->MediaId,
100000000, // Timeout 10-sec
0, // SecurityProtocol
0, // SecurityProtocolSpecifcData
Len, // PayloadBufferSize,
Buffer, // PayloadBuffer
&XferSize
);
if (EFI_ERROR(Status)) {
goto Exit;
}
Data = (SUPPORTED_SECURITY_PROTOCOLS_PARAMETER_DATA*)Buffer;
Len = (Data->SupportedSecurityListLength[0] << 8) + Data->SupportedSecurityListLength[1];
//
// Iterate full supported security protocol list to check if TCG or IEEE 1667 protocol
// is supported.
//
for (Index = 0; Index < Len; Index++) {
if (Data->SupportedSecurityProtocol[Index] == SECURITY_PROTOCOL_TCG) {
//
// Found a TCG device.
//
TcgFlag = TRUE;
DEBUG ((EFI_D_INFO, "This device is a TCG protocol device\n"));
break;
}
if (Data->SupportedSecurityProtocol[Index] == SECURITY_PROTOCOL_IEEE1667) {
//
// Found a IEEE 1667 device.
//
IeeeFlag = TRUE;
DEBUG ((EFI_D_INFO, "This device is a IEEE 1667 protocol device\n"));
break;
}
}
if (!TcgFlag && !IeeeFlag) {
DEBUG ((EFI_D_INFO, "Neither a TCG nor IEEE 1667 protocol device is found\n"));
goto Exit;
}
if (TcgFlag) {
//
// As long as TCG protocol is supported, send out a TPer Reset
// TCG command to the device via the TrustedSend command with a non-zero Transfer Length.
//
Status = Ssp->SendData (
Ssp,
BlockIo->Media->MediaId,
100000000, // Timeout 10-sec
SECURITY_PROTOCOL_TCG, // SecurityProtocol
0x0400, // SecurityProtocolSpecifcData
512, // PayloadBufferSize,
Buffer // PayloadBuffer
);
if (!EFI_ERROR(Status)) {
DEBUG ((EFI_D_INFO, "Send TPer Reset Command Successfully !\n"));
} else {
DEBUG ((EFI_D_INFO, "Send TPer Reset Command Fail !\n"));
}
}
if (IeeeFlag) {
//
// TBD : Perform a TPer Reset via IEEE 1667 Protocol
//
DEBUG ((EFI_D_INFO, "IEEE 1667 Protocol didn't support yet!\n"));
}
Exit:
if (Buffer != NULL) {
FreePool(Buffer);
}
}
|
f33198311059b5e3365da15f268c88b06b97cf9d
|
fb0f9abad373cd635c2635bbdf491ea0f32da5ff
|
/src/mono/mono/mini/mini-windows-dllmain.c
|
3cbc8ba3621359197e92bbf4ed4ed2244cbde8bf
|
[
"MIT"
] |
permissive
|
dotnet/runtime
|
f6fd23936752e202f8e4d6d94f3a4f3b0e77f58f
|
47bb554d298e1e34c4e3895d7731e18ad1c47d02
|
refs/heads/main
| 2023-09-03T15:35:46.493337
| 2023-09-03T08:13:23
| 2023-09-03T08:13:23
| 210,716,005
| 13,765
| 5,179
|
MIT
| 2023-09-14T21:58:52
| 2019-09-24T23:36:39
|
C#
|
UTF-8
|
C
| false
| false
| 604
|
c
|
mini-windows-dllmain.c
|
/**
* \file
* DllMain entry point.
*
* (C) 2002-2003 Ximian, Inc.
* (C) 2003-2006 Novell, Inc.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "mini-runtime.h"
#ifdef HOST_WIN32
#include "mini-windows.h"
#include <windows.h>
MONO_EXTERN_C
BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved);
MONO_EXTERN_C
BOOL APIENTRY DllMain (HMODULE module_handle, DWORD reason, LPVOID reserved)
{
return mono_win32_runtime_tls_callback (module_handle, reason, reserved, MONO_WIN32_TLS_CALLBACK_TYPE_DLL);
}
#endif
|
60a15d7ad90b73a94face6541bd6e44d1b1bbbf5
|
5cf6a985ce1ba56ce65999be93c859482307967d
|
/other-languages/number-theory/inverse/inverse.c
|
b5aeedc10589a55e297e027be188705439c96f2c
|
[] |
no_license
|
hacktoon/1001
|
5e1abdeb6313d8960370dbcff33f7359933e4686
|
9117eea9389de180a994fd51a3abc8befacaed2a
|
refs/heads/master
| 2023-08-15T21:44:46.231928
| 2017-10-30T18:09:12
| 2017-10-30T18:09:12
| 1,232,142
| 161
| 67
| null | 2017-10-30T18:09:13
| 2011-01-08T04:00:38
|
Python
|
UTF-8
|
C
| false
| false
| 569
|
c
|
inverse.c
|
/*
Inverse
Autor:
JoseFernandoTolentino (JoseFernandoTolentino@gmail.com)
Tipo:
number-theory
Descrição:
Inverte os algarismos de um número
Complexidade:
Pior caso: O(infinito)
Melhor caso: O(n)
Dificuldade:
facil
Referências:
*/
#include <stdio.h>
int inverse(int input)
{
int x=input;
int output=0;
while (x>0) {
output = output * 10 + x % 10;
x = x / 10;
}
return output;
}
int main()
{
int input = 12345;
int output= inverse(input);
printf("Numero=%d\ninverso=%d\n", input, output);
return 0;
}
|
13398b644ab0f55f9564b214a62130ef1bb22db7
|
b4c2b8dc89417e966a67a433267ebb9c156dbff4
|
/src/vehicles/sounds/8v92PeterbiltRev.h
|
ea08890625da87e694ad8975a79f51aa624cc945
|
[] |
no_license
|
TheDIYGuy999/Rc_Engine_Sound_ESP32
|
92134030dbc047627310d54ccf1fd34fb3cad791
|
eeeb47964861b66f8e1db34bffe35657846d8b20
|
refs/heads/master
| 2023-08-31T00:17:03.698027
| 2023-05-04T19:46:51
| 2023-05-04T19:46:51
| 225,658,413
| 230
| 105
| null | 2023-08-26T14:38:39
| 2019-12-03T15:51:13
|
C
|
UTF-8
|
C
| false
| false
| 18,865
|
h
|
8v92PeterbiltRev.h
|
const unsigned int revSampleRate = 22050;
const unsigned int revSampleCount = 3751;
const signed char revSamples[] = {//0
0, -1, -1, -1, -1, -2, -2, -3, -4, -4, -4, -4, -4, -3, -3, -3, //16
-3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -3, -3, -2, -1, 0, 1, //32
2, 2, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -4, -6, -4, -4, //48
-2, -1, 1, 6, 8, 11, 13, 16, 18, 20, 21, 21, 20, 19, 17, 13, //64
12, 10, 9, 8, 7, 6, 6, 6, 7, 7, 8, 9, 9, 10, 10, 10, //80
11, 11, 10, 10, 9, 7, 4, 1, -1, -3, -7, -9, -11, -12, -12, -13, //96
-13, -12, -11, -10, -8, -6, -3, -1, 0, 1, 1, 2, 1, 1, 0, -1, //112
-1, -2, -2, -2, -1, 0, 1, 3, 4, 7, 8, 9, 9, 9, 9, 8, //128
7, 6, 3, 2, 1, 0, -1, -2, -3, -4, -6, -7, -8, -9, -11, -12, //144
-14, -17, -19, -22, -25, -27, -29, -30, -31, -32, -33, -33, -32, -32, -31, -30, //160
-29, -28, -27, -27, -26, -26, -25, -23, -22, -20, -17, -13, -10, -7, -2, 1, //176
6, 9, 11, 14, 17, 20, 23, 27, 30, 33, 38, 45, 49, 53, 58, 61, //192
65, 69, 71, 74, 75, 76, 77, 79, 80, 81, 82, 84, 85, 85, 84, 84, //208
82, 81, 78, 77, 75, 72, 70, 67, 64, 61, 58, 55, 51, 47, 43, 40, //224
37, 35, 31, 28, 25, 22, 20, 18, 16, 14, 13, 12, 12, 12, 13, 14, //240
17, 18, 20, 21, 23, 25, 26, 27, 27, 29, 30, 31, 33, 35, 37, 40, //256
42, 45, 46, 47, 47, 47, 47, 47, 47, 47, 49, 50, 52, 53, 56, 58, //272
61, 64, 66, 68, 69, 69, 69, 69, 68, 68, 67, 66, 66, 65, 64, 64, //288
62, 62, 62, 62, 62, 62, 64, 64, 65, 65, 66, 66, 65, 64, 61, 59, //304
58, 56, 52, 50, 48, 46, 45, 42, 42, 41, 41, 41, 41, 41, 40, 39, //320
38, 36, 33, 29, 27, 25, 21, 19, 17, 16, 14, 13, 13, 13, 13, 12, //336
12, 11, 10, 8, 4, 2, -1, -3, -6, -10, -12, -13, -16, -17, -18, -20, //352
-20, -21, -21, -21, -22, -22, -23, -25, -25, -26, -25, -25, -23, -22, -21, -20, //368
-19, -19, -19, -20, -21, -22, -25, -27, -28, -29, -31, -32, -32, -33, -33, -33, //384
-33, -33, -33, -33, -32, -32, -33, -35, -36, -37, -39, -41, -45, -47, -50, -53, //400
-56, -59, -61, -63, -63, -65, -65, -66, -66, -67, -67, -67, -68, -69, -70, -71, //416
-74, -75, -77, -80, -81, -84, -85, -87, -88, -90, -91, -92, -92, -94, -94, -92, //432
-92, -92, -94, -94, -94, -94, -95, -95, -95, -94, -94, -94, -94, -94, -94, -94, //448
-92, -91, -89, -87, -85, -82, -80, -79, -77, -77, -75, -75, -74, -74, -74, -74, //464
-75, -75, -76, -77, -78, -79, -81, -84, -86, -88, -91, -95, -97, -99, -100, -101, //480
-101, -101, -100, -99, -98, -96, -95, -92, -90, -89, -87, -87, -86, -86, -87, -88, //496
-89, -91, -92, -92, -92, -92, -91, -89, -86, -84, -80, -78, -75, -72, -70, -69, //512
-68, -68, -68, -68, -69, -69, -69, -69, -69, -67, -66, -62, -60, -57, -52, -49, //528
-46, -43, -41, -40, -37, -36, -33, -32, -31, -29, -27, -25, -21, -19, -17, -12, //544
-10, -8, -6, -3, -1, 1, 2, 2, 2, 1, 1, 0, 0, -1, -1, -1, //560
-1, -2, -2, -3, -4, -4, -7, -7, -8, -9, -10, -10, -10, -10, -9, -9, //576
-8, -6, -4, -3, -2, -1, 0, 0, -1, -1, -2, -2, -1, -1, 0, 1, //592
2, 4, 6, 8, 9, 10, 11, 11, 11, 10, 9, 8, 7, 6, 6, 6, //608
6, 7, 8, 9, 9, 10, 10, 9, 8, 6, 3, 0, -2, -4, -7, -8, //624
-8, -7, -6, -4, -2, 0, 2, 6, 8, 11, 16, 18, 21, 23, 26, 29, //640
32, 35, 37, 40, 42, 47, 50, 53, 57, 61, 65, 70, 72, 76, 78, 80, //656
84, 86, 88, 90, 91, 94, 97, 99, 101, 104, 106, 108, 110, 111, 113, 114, //672
114, 114, 113, 113, 111, 111, 111, 113, 113, 114, 114, 114, 114, 114, 114, 113, //688
111, 111, 109, 108, 107, 106, 104, 102, 100, 100, 99, 99, 98, 98, 98, 98, //704
98, 98, 98, 97, 97, 96, 96, 95, 95, 94, 94, 94, 95, 96, 97, 99, //720
100, 101, 102, 102, 102, 104, 104, 104, 104, 104, 104, 104, 102, 102, 101, 101, //736
100, 100, 99, 99, 98, 97, 97, 97, 97, 98, 98, 97, 97, 96, 95, 94, //752
90, 89, 87, 85, 82, 81, 79, 78, 78, 77, 78, 78, 78, 79, 79, 78, //768
78, 75, 72, 70, 68, 65, 62, 58, 56, 52, 50, 48, 46, 42, 40, 38, //784
35, 32, 28, 25, 22, 19, 16, 13, 10, 8, 6, 3, 2, 0, -3, -7, //800
-9, -12, -16, -20, -22, -25, -27, -29, -31, -33, -35, -37, -38, -39, -40, -41, //816
-42, -43, -45, -46, -47, -48, -49, -50, -50, -51, -52, -53, -53, -55, -55, -56, //832
-56, -55, -55, -53, -52, -51, -50, -49, -49, -49, -49, -50, -50, -51, -52, -53, //848
-53, -55, -55, -53, -53, -53, -53, -53, -55, -57, -59, -62, -68, -72, -76, -79, //864
-81, -85, -88, -90, -91, -94, -95, -97, -98, -99, -101, -104, -105, -109, -111, -114, //880
-117, -119, -121, -123, -124, -125, -124, -124, -121, -119, -117, -116, -114, -113, -111, -110, //896
-109, -108, -108, -107, -106, -105, -105, -105, -104, -104, -102, -102, -101, -101, -100, -100, //912
-100, -99, -99, -99, -97, -96, -95, -92, -90, -89, -87, -86, -86, -86, -86, -86, //928
-86, -85, -85, -85, -85, -85, -86, -86, -87, -87, -88, -88, -87, -86, -85, -82, //944
-80, -76, -72, -70, -67, -65, -61, -60, -58, -57, -56, -56, -55, -55, -55, -55, //960
-53, -52, -51, -49, -48, -46, -45, -41, -39, -37, -33, -31, -29, -27, -26, -26, //976
-26, -26, -26, -26, -26, -26, -26, -26, -23, -22, -21, -19, -17, -16, -12, -11, //992
-10, -9, -8, -7, -7, -7, -8, -9, -10, -12, -14, -17, -19, -21, -23, -27, //1008
-29, -30, -31, -32, -32, -32, -31, -31, -30, -29, -28, -28, -28, -27, -27, -27, //1024
-27, -27, -28, -29, -29, -30, -30, -30, -30, -29, -28, -25, -22, -20, -18, -16, //1040
-12, -9, -7, -4, -2, 0, 1, 2, 3, 4, 6, 7, 9, 11, 12, 14, //1056
17, 19, 21, 23, 26, 28, 30, 32, 35, 37, 39, 41, 42, 46, 48, 49, //1072
51, 53, 56, 59, 60, 62, 65, 68, 71, 74, 76, 78, 81, 84, 87, 89, //1088
91, 94, 96, 98, 100, 101, 102, 102, 102, 101, 100, 99, 98, 96, 95, 91, //1104
89, 87, 85, 84, 82, 80, 79, 78, 76, 74, 70, 68, 65, 61, 58, 55, //1120
49, 46, 42, 39, 36, 32, 29, 27, 25, 23, 23, 22, 23, 23, 25, 27, //1136
28, 31, 35, 37, 40, 43, 46, 50, 52, 55, 57, 59, 62, 65, 68, 70, //1152
74, 77, 81, 86, 89, 92, 96, 99, 105, 107, 109, 111, 114, 116, 117, 118, //1168
118, 119, 119, 120, 120, 121, 123, 124, 125, 126, 126, 127, 127, 127, 127, 127, //1184
127, 126, 125, 125, 124, 123, 123, 123, 121, 120, 119, 118, 116, 114, 110, 106, //1200
104, 100, 97, 94, 91, 88, 87, 86, 85, 86, 86, 87, 87, 88, 88, 89, //1216
89, 89, 89, 89, 89, 88, 87, 87, 86, 86, 86, 85, 85, 85, 84, 82, //1232
81, 80, 78, 76, 74, 70, 67, 60, 55, 50, 45, 40, 32, 28, 23, 19, //1248
16, 11, 7, 3, 0, -3, -7, -10, -14, -18, -20, -23, -26, -30, -32, -36, //1264
-38, -41, -43, -48, -50, -53, -56, -58, -60, -63, -65, -67, -68, -69, -70, -71, //1280
-72, -72, -74, -75, -75, -75, -76, -76, -76, -76, -76, -76, -77, -77, -77, -78, //1296
-79, -80, -80, -81, -81, -81, -81, -80, -80, -80, -79, -78, -78, -77, -76, -75, //1312
-74, -72, -71, -70, -69, -67, -66, -65, -63, -63, -63, -63, -65, -65, -66, -66, //1328
-67, -68, -69, -70, -71, -72, -74, -76, -77, -78, -79, -81, -84, -86, -88, -90, //1344
-92, -95, -98, -99, -100, -101, -101, -102, -102, -102, -104, -104, -105, -106, -108, -109, //1360
-110, -113, -115, -117, -118, -119, -119, -120, -120, -119, -119, -118, -117, -116, -114, -114, //1376
-113, -113, -113, -114, -114, -115, -115, -116, -116, -116, -115, -114, -113, -111, -110, -108, //1392
-107, -106, -105, -102, -100, -97, -95, -91, -89, -87, -85, -81, -79, -77, -75, -72, //1408
-70, -68, -67, -66, -63, -62, -60, -58, -56, -52, -50, -47, -42, -39, -37, -33, //1424
-31, -28, -27, -25, -23, -23, -22, -21, -21, -21, -21, -20, -20, -19, -18, -17, //1440
-16, -16, -14, -14, -13, -14, -14, -16, -18, -19, -19, -20, -20, -20, -19, -19, //1456
-19, -19, -19, -19, -20, -20, -21, -21, -22, -22, -21, -20, -19, -17, -12, -9, //1472
-7, -3, -1, 1, 2, 3, 4, 4, 3, 3, 2, 1, 0, -1, -2, -3, //1488
-4, -7, -8, -10, -12, -14, -16, -18, -19, -20, -21, -23, -23, -25, -25, -25, //1504
-25, -25, -25, -26, -26, -26, -26, -25, -25, -23, -22, -20, -17, -14, -11, -8, //1520
-4, 2, 6, 10, 16, 20, 25, 30, 35, 38, 42, 45, 48, 52, 55, 58, //1536
61, 65, 69, 71, 75, 78, 81, 85, 90, 94, 98, 101, 105, 108, 113, 115, //1552
117, 119, 120, 121, 121, 120, 120, 118, 117, 115, 114, 111, 110, 109, 108, 106, //1568
105, 104, 102, 100, 97, 95, 91, 88, 86, 82, 78, 75, 72, 70, 68, 66, //1584
62, 60, 59, 57, 56, 56, 57, 58, 59, 61, 64, 67, 70, 72, 76, 78, //1600
81, 86, 88, 90, 94, 96, 99, 101, 104, 106, 108, 110, 113, 114, 115, 116, //1616
117, 118, 119, 119, 119, 119, 118, 118, 117, 116, 116, 115, 114, 111, 109, 107, //1632
105, 102, 99, 98, 96, 92, 90, 88, 86, 84, 82, 81, 81, 80, 77, 75, //1648
72, 69, 67, 62, 59, 57, 55, 53, 51, 49, 48, 48, 47, 45, 43, 41, //1664
40, 39, 37, 36, 35, 33, 32, 31, 30, 30, 29, 29, 29, 29, 29, 29, //1680
28, 28, 27, 27, 26, 25, 25, 23, 23, 23, 22, 22, 21, 21, 20, 20, //1696
19, 18, 17, 16, 14, 13, 10, 8, 6, 3, 1, -1, -4, -7, -9, -11, //1712
-13, -17, -20, -22, -25, -26, -28, -30, -31, -32, -33, -36, -37, -41, -43, -47, //1728
-50, -53, -57, -61, -66, -69, -74, -77, -82, -86, -89, -92, -95, -97, -101, -104, //1744
-106, -108, -109, -110, -111, -111, -110, -110, -109, -108, -107, -106, -104, -102, -101, -98, //1760
-97, -95, -94, -91, -89, -87, -85, -84, -81, -80, -78, -77, -76, -75, -72, -71, //1776
-69, -68, -67, -65, -62, -60, -58, -56, -55, -53, -51, -50, -50, -49, -49, -49, //1792
-49, -50, -50, -51, -51, -51, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, //1808
-53, -53, -55, -56, -57, -58, -59, -60, -62, -63, -65, -67, -68, -70, -71, -71, //1824
-72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -72, -71, -69, -68, //1840
-66, -63, -61, -59, -55, -51, -49, -46, -42, -39, -36, -33, -31, -29, -27, -23, //1856
-21, -19, -18, -17, -17, -16, -17, -17, -17, -18, -18, -19, -20, -21, -21, -22, //1872
-23, -23, -23, -22, -22, -21, -20, -19, -18, -17, -16, -13, -13, -12, -12, -12, //1888
-12, -12, -13, -13, -12, -12, -11, -10, -9, -9, -8, -8, -7, -6, -4, -3, //1904
-2, 0, 3, 4, 6, 8, 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, //1920
8, 8, 8, 9, 9, 10, 11, 12, 13, 14, 16, 17, 18, 18, 19, 19, //1936
20, 20, 20, 20, 21, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 25, //1952
25, 25, 25, 26, 26, 25, 25, 25, 23, 22, 22, 21, 21, 21, 21, 21, //1968
21, 22, 23, 25, 25, 26, 27, 27, 28, 28, 28, 28, 28, 27, 25, 22, //1984
20, 17, 14, 12, 11, 10, 10, 10, 11, 12, 13, 16, 18, 19, 20, 21, //2000
22, 23, 25, 25, 25, 25, 25, 25, 23, 23, 22, 22, 21, 21, 21, 21, //2016
21, 21, 20, 20, 20, 21, 21, 22, 22, 23, 23, 23, 23, 22, 21, 20, //2032
19, 17, 16, 14, 13, 13, 12, 12, 13, 13, 14, 14, 16, 16, 16, 17, //2048
18, 19, 20, 21, 22, 23, 25, 26, 26, 26, 27, 28, 29, 30, 32, 33, //2064
37, 38, 40, 41, 43, 45, 47, 49, 50, 52, 53, 56, 57, 58, 59, 60, //2080
62, 64, 66, 67, 68, 68, 69, 69, 70, 70, 70, 71, 71, 71, 71, 70, //2096
69, 67, 65, 61, 59, 58, 56, 55, 53, 53, 52, 52, 51, 49, 48, 47, //2112
46, 45, 43, 41, 41, 40, 40, 39, 39, 38, 37, 36, 35, 33, 31, 30, //2128
28, 27, 26, 25, 23, 23, 22, 22, 21, 21, 20, 20, 20, 20, 20, 20, //2144
20, 20, 20, 20, 20, 20, 20, 19, 18, 18, 17, 17, 18, 18, 19, 20, //2160
23, 25, 27, 28, 29, 30, 30, 29, 28, 27, 25, 23, 20, 19, 18, 17, //2176
16, 16, 14, 14, 13, 13, 12, 12, 11, 11, 11, 10, 10, 9, 8, 8, //2192
7, 7, 6, 4, 3, 3, 2, 1, 0, 0, -1, -1, -2, -3, -3, -4, //2208
-4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2, -2, -3, -3, -6, -7, //2224
-8, -10, -11, -12, -13, -14, -16, -17, -18, -19, -21, -22, -23, -25, -26, -27, //2240
-28, -29, -29, -30, -30, -30, -30, -30, -30, -30, -30, -31, -32, -32, -33, -35, //2256
-36, -36, -37, -37, -37, -38, -39, -40, -42, -45, -46, -48, -51, -53, -55, -57, //2272
-58, -60, -61, -61, -62, -62, -63, -66, -67, -69, -71, -72, -75, -78, -79, -80, //2288
-81, -82, -84, -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, -86, -86, -86, //2304
-86, -87, -87, -87, -87, -86, -85, -84, -82, -79, -78, -77, -76, -76, -76, -76, //2320
-76, -76, -76, -76, -76, -76, -75, -75, -74, -74, -74, -74, -72, -72, -71, -71, //2336
-69, -68, -67, -66, -65, -63, -62, -63, -63, -63, -65, -67, -68, -69, -70, -72, //2352
-74, -75, -76, -77, -78, -79, -80, -81, -84, -85, -87, -88, -91, -92, -95, -96, //2368
-98, -99, -100, -100, -100, -99, -99, -97, -96, -94, -91, -89, -87, -82, -79, -76, //2384
-72, -69, -65, -61, -59, -57, -53, -51, -48, -46, -43, -40, -38, -36, -32, -30, //2400
-29, -27, -25, -22, -20, -19, -18, -17, -16, -13, -11, -10, -9, -8, -7, -7, //2416
-8, -8, -9, -11, -12, -13, -13, -14, -14, -14, -13, -13, -13, -12, -10, -9, //2432
-6, -4, -2, 0, 1, 3, 3, 4, 4, 4, 3, 2, 2, 2, 2, 2, //2448
3, 4, 7, 8, 10, 12, 16, 17, 19, 20, 21, 22, 22, 22, 22, 22, //2464
22, 22, 22, 23, 25, 26, 27, 29, 30, 31, 31, 31, 31, 32, 32, 32, //2480
32, 32, 31, 30, 29, 28, 27, 25, 23, 21, 20, 19, 18, 17, 16, 16, //2496
14, 16, 16, 17, 18, 19, 21, 23, 26, 29, 30, 31, 32, 33, 35, 38, //2512
40, 42, 46, 49, 53, 58, 61, 65, 68, 71, 76, 78, 80, 82, 85, 87, //2528
90, 94, 96, 99, 101, 106, 108, 109, 110, 111, 111, 111, 110, 110, 109, 109, //2544
109, 108, 108, 108, 109, 109, 110, 111, 114, 115, 117, 118, 119, 120, 120, 120, //2560
119, 118, 116, 115, 114, 114, 114, 114, 114, 115, 115, 115, 114, 114, 113, 111, //2576
110, 109, 108, 107, 106, 106, 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, //2592
111, 111, 110, 109, 106, 104, 100, 98, 96, 94, 92, 92, 92, 92, 92, 94, //2608
95, 96, 96, 96, 96, 94, 92, 90, 88, 85, 80, 78, 75, 72, 69, 67, //2624
64, 62, 60, 59, 57, 55, 52, 50, 49, 47, 45, 42, 41, 40, 39, 38, //2640
38, 37, 36, 33, 32, 31, 29, 28, 26, 23, 22, 20, 17, 16, 14, 12, //2656
11, 9, 7, 6, 3, 1, -1, -4, -7, -9, -10, -12, -13, -16, -17, -19, //2672
-21, -22, -25, -29, -31, -33, -36, -38, -40, -41, -42, -43, -43, -45, -45, -45, //2688
-46, -46, -47, -47, -48, -49, -50, -51, -53, -56, -58, -60, -62, -65, -67, -70, //2704
-72, -75, -77, -78, -79, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, //2720
-81, -82, -84, -85, -86, -87, -89, -90, -91, -94, -95, -96, -97, -98, -98, -98, //2736
-99, -99, -100, -100, -101, -101, -101, -100, -100, -100, -100, -100, -101, -102, -104, -104, //2752
-106, -107, -108, -109, -110, -111, -111, -111, -111, -110, -110, -109, -107, -105, -102, -100, //2768
-99, -98, -97, -97, -96, -96, -97, -97, -97, -97, -97, -97, -97, -97, -97, -97, //2784
-96, -96, -96, -96, -95, -94, -92, -90, -89, -87, -85, -84, -82, -81, -80, -78, //2800
-77, -76, -75, -74, -72, -71, -70, -69, -69, -68, -68, -68, -68, -68, -67, -66, //2816
-65, -62, -60, -58, -56, -53, -51, -49, -48, -47, -46, -45, -45, -43, -42, -41, //2832
-39, -36, -33, -31, -29, -26, -23, -18, -16, -12, -9, -7, -2, 0, 1, 3, //2848
4, 4, 7, 7, 8, 9, 9, 10, 10, 10, 10, 10, 9, 9, 8, 7, //2864
6, 4, 3, 1, 1, 1, 1, 1, 2, 3, 4, 4, 6, 6, 6, 6, //2880
6, 4, 3, 2, -1, -3, -6, -8, -10, -11, -13, -14, -14, -16, -16, -17, //2896
-18, -19, -19, -20, -21, -22, -23, -25, -26, -27, -28, -30, -31, -31, -31, -31, //2912
-30, -29, -27, -26, -23, -20, -17, -13, -10, -6, -2, 2, 8, 12, 17, 21, //2928
26, 31, 35, 38, 41, 43, 47, 51, 53, 57, 60, 65, 70, 75, 78, 81, //2944
85, 88, 91, 92, 94, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, //2960
96, 96, 95, 91, 90, 88, 85, 82, 80, 76, 74, 71, 69, 68, 66, 65, //2976
64, 62, 61, 60, 58, 57, 55, 52, 50, 49, 45, 42, 40, 38, 36, 32, //2992
31, 31, 31, 31, 32, 33, 35, 35, 36, 37, 39, 41, 43, 46, 48, 50, //3008
53, 57, 60, 64, 67, 70, 76, 78, 81, 85, 87, 90, 95, 97, 100, 104, //3024
106, 110, 113, 115, 117, 118, 119, 121, 123, 123, 123, 123, 123, 123, 123, 121, //3040
121, 120, 118, 117, 116, 115, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, //3056
111, 111, 110, 107, 105, 102, 99, 97, 95, 90, 88, 86, 84, 81, 79, 76, //3072
75, 74, 72, 71, 71, 71, 71, 71, 71, 70, 69, 67, 66, 65, 64, 61, //3088
59, 58, 57, 55, 53, 51, 49, 48, 47, 46, 45, 43, 42, 41, 40, 38, //3104
36, 35, 33, 31, 30, 28, 25, 21, 18, 14, 11, 8, 3, 1, -2, -4, //3120
-7, -10, -12, -14, -16, -18, -20, -22, -25, -27, -29, -30, -32, -36, -38, -40, //3136
-43, -46, -49, -52, -55, -57, -59, -61, -65, -68, -70, -72, -74, -76, -78, -79, //3152
-81, -84, -85, -88, -90, -92, -94, -95, -96, -97, -98, -99, -99, -100, -100, -101, //3168
-101, -102, -101, -101, -100, -98, -97, -95, -92, -90, -87, -86, -85, -84, -84, -84, //3184
-84, -85, -86, -87, -88, -89, -89, -89, -88, -87, -86, -85, -82, -81, -80, -79, //3200
-78, -77, -77, -77, -76, -76, -76, -76, -77, -77, -77, -78, -78, -78, -78, -78, //3216
-78, -78, -78, -79, -79, -79, -80, -80, -80, -80, -80, -80, -79, -79, -79, -78, //3232
-79, -79, -81, -82, -85, -87, -89, -90, -94, -95, -96, -97, -98, -98, -98, -97, //3248
-97, -97, -97, -97, -97, -98, -99, -100, -101, -104, -105, -106, -106, -106, -106, -104, //3264
-102, -101, -99, -97, -95, -92, -91, -90, -88, -87, -85, -82, -80, -78, -77, -75, //3280
-71, -70, -68, -67, -65, -62, -60, -58, -56, -53, -50, -47, -45, -41, -39, -37, //3296
-33, -31, -29, -28, -27, -26, -23, -23, -22, -22, -22, -22, -23, -23, -25, -25, //3312
-26, -26, -26, -25, -25, -25, -23, -23, -22, -22, -22, -21, -20, -19, -18, -17, //3328
-16, -16, -13, -12, -10, -9, -7, -4, -3, -1, 0, 1, 2, 3, 4, 7, //3344
8, 9, 10, 12, 13, 14, 16, 16, 16, 14, 14, 13, 12, 11, 10, 9, //3360
8, 7, 6, 4, 4, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, //3376
4, 4, 6, 6, 7, 8, 9, 10, 12, 14, 17, 20, 23, 27, 31, 35, //3392
39, 46, 50, 53, 58, 62, 67, 70, 74, 76, 78, 81, 85, 87, 89, 91, //3408
94, 96, 100, 102, 106, 109, 111, 116, 118, 119, 121, 121, 123, 123, 123, 123, //3424
121, 121, 120, 118, 116, 115, 113, 110, 107, 105, 102, 100, 98, 97, 95, 94, //3440
92, 91, 89, 87, 84, 82, 80, 78, 76, 72, 71, 69, 69, 68, 68, 68, //3456
68, 69, 70, 71, 74, 76, 78, 79, 81, 85, 88, 90, 91, 94, 95, 96, //3472
97, 97, 98, 98, 99, 99, 100, 100, 101, 102, 104, 106, 108, 109, 111, 114, //3488
115, 117, 118, 118, 118, 118, 117, 116, 115, 114, 113, 110, 108, 105, 102, 99, //3504
96, 92, 87, 82, 79, 76, 72, 69, 65, 61, 58, 56, 52, 48, 46, 42, //3520
39, 36, 32, 28, 25, 22, 20, 18, 14, 13, 12, 11, 10, 10, 9, 8, //3536
8, 8, 8, 8, 8, 9, 9, 9, 8, 8, 7, 7, 6, 4, 3, 2, //3552
1, 0, -1, -2, -3, -4, -6, -7, -8, -9, -10, -10, -11, -11, -12, -12, //3568
-13, -13, -14, -14, -16, -17, -19, -21, -23, -25, -27, -28, -28, -28, -28, -28, //3584
-28, -28, -29, -30, -32, -35, -37, -42, -46, -50, -55, -58, -63, -68, -71, -75, //3600
-78, -80, -85, -87, -88, -90, -91, -92, -94, -95, -96, -97, -99, -101, -104, -106, //3616
-108, -110, -111, -114, -114, -115, -116, -117, -117, -118, -118, -118, -118, -117, -116, -115, //3632
-115, -114, -114, -113, -110, -108, -106, -104, -101, -99, -97, -95, -94, -92, -92, -92, //3648
-92, -91, -91, -91, -90, -89, -88, -87, -87, -86, -84, -81, -80, -77, -75, -72, //3664
-69, -67, -66, -63, -63, -62, -61, -60, -60, -59, -59, -57, -56, -55, -53, -51, //3680
-50, -48, -46, -45, -42, -41, -39, -38, -36, -35, -35, -33, -32, -31, -31, -30, //3696
-30, -31, -32, -32, -33, -35, -35, -33, -32, -31, -30, -29, -29, -30, -30, -31, //3712
-32, -33, -35, -37, -37, -38, -39, -40, -40, -40, -39, -38, -37, -36, -35, -33, //3728
-32, -31, -30, -28, -26, -23, -21, -18, -16, -13, -11, -9, -8, -7, -7, -4, //3744
-3, -3, -2, -1, -1, -1, 0, };
|
b3a4ac0978d45796df86324dc45372f38d39cdd1
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/video/via/via_aux_vt1621.c
|
38eca84798987402aa717430fa494afd8908ccc3
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 1,224
|
c
|
via_aux_vt1621.c
|
/*
* Copyright 2011 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; 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.
*/
/*
* driver for VIA VT1621(M) TV Encoder
*/
#include <linux/slab.h>
#include "via_aux.h"
static const char *name = "VT1621(M) TV Encoder";
void via_aux_vt1621_probe(struct via_aux_bus *bus)
{
struct via_aux_drv drv = {
.bus = bus,
.addr = 0x20,
.name = name};
u8 tmp;
if (!via_aux_read(&drv, 0x1B, &tmp, 1) || tmp != 0x02)
return;
printk(KERN_INFO "viafb: Found %s\n", name);
via_aux_add(&drv);
}
|
2f7c615d1479f21a238893441d45d89e0b56247f
|
44884709500205c213b20afee91775656b1b56cf
|
/src/SharpLang.Runtime/coreclr/pal/tests/palsuite/threading/SetConsoleCtrlHandler/test7/test7.c
|
eabfb19532b960a1f019ceaa1570b864130ef9e9
|
[
"BSD-2-Clause",
"BSD-2-Clause-Views"
] |
permissive
|
xen2/SharpLang
|
37299f94b71278766a0261b62021a85951cb5543
|
07902915970ace70c4ee0430a672d25187a75d3a
|
refs/heads/coreclr
| 2022-09-01T12:11:24.459301
| 2015-11-20T00:34:57
| 2015-11-20T00:34:57
| 20,264,525
| 294
| 47
| null | 2015-04-26T05:54:46
| 2014-05-28T16:29:11
|
C#
|
UTF-8
|
C
| false
| false
| 4,292
|
c
|
test7.c
|
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/*=============================================================================
**
** Source: test7.c
**
** Dependencies: PAL_Initialize
** PAL_Terminate
** GenerateConsoleCtrlEvent
**
** Purpose:
**
** Test to ensure proper operation of the SetConsoleCtrlHandler()
** API by checking whether a console control handler function is
** actually removed by the API when it returns success for that
** operation.
**
**
**===========================================================================*/
#include <palsuite.h>
static BOOL g_bFlag1 = FALSE;
static BOOL g_bFlag2 = FALSE;
/* first handler function */
static BOOL PALAPI CtrlHandler1( DWORD CtrlType )
{
if( CtrlType == CTRL_C_EVENT )
{
g_bFlag1 = TRUE;
return TRUE;
}
return FALSE;
}
/* second handler function */
static BOOL PALAPI CtrlHandler2( DWORD CtrlType )
{
if( CtrlType == CTRL_C_EVENT )
{
g_bFlag2 = TRUE;
return FALSE;
}
return FALSE;
}
/* main entry point function */
int __cdecl main( int argc, char **argv )
{
/* local variables */
BOOL ret = PASS;
BOOL bSetHandler1 = FALSE;
/* PAL initialization */
if( (PAL_Initialize(argc, argv)) != 0 )
{
return( FAIL );
}
/* set the console control handler functions */
if( SetConsoleCtrlHandler( CtrlHandler1, TRUE ) )
{
bSetHandler1 = TRUE;
}
else
{
ret = FAIL;
Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
"CtrlHandler1\n",
GetLastError() );
Fail( "Test failed\n" );
}
if( ! SetConsoleCtrlHandler( CtrlHandler2, TRUE ) )
{
ret = FAIL;
Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to add "
"CtrlHandler2\n",
GetLastError() );
Fail( "Test failed\n" );
}
/* test that the right control handler functions are set */
if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
{
Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
GetLastError() );
ret = FAIL;
goto done;
}
/* give the handlers a chance to execute */
Sleep( 2000 );
/* check the results */
if( ! g_bFlag1 )
{
Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
ret = FAIL;
goto done;
}
if( ! g_bFlag2 )
{
Trace( "ERROR:CtrlHandler2() was not called but should have been\n" );
ret = FAIL;
goto done;
}
/* reset our flags */
g_bFlag1 = FALSE;
g_bFlag2 = FALSE;
/* try to unset CtrlHandler2 */
if( ! SetConsoleCtrlHandler( CtrlHandler2, FALSE ) )
{
ret = FAIL;
Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
"remove CtrlHandler2\n",
GetLastError() );
goto done;
}
/* make sure that CtrlHandler1 is set and CtrlHandler2 isn't */
if( ! GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 ) )
{
Trace( "ERROR:%lu:GenerateConsoleCtrlEvent() failed\n",
GetLastError() );
ret = FAIL;
goto done;
}
/* give the handlers a chance to execute */
Sleep( 2000 );
/* check the results */
if( g_bFlag2 )
{
Trace( "ERROR:CtrlHandler2() was called after it was unset\n" );
ret = FAIL;
goto done;
}
if( ! g_bFlag1 )
{
Trace( "ERROR:CtrlHandler1() was not called but should have been\n" );
ret = FAIL;
goto done;
}
done:
/* unset CtrlHandler1 if it was set */
if( bSetHandler1 )
{
if( ! SetConsoleCtrlHandler( CtrlHandler1, FALSE ) )
{
ret = FAIL;
Trace( "ERROR:%lu:SetConsoleCtrlHandler() failed to "
"remove CtrlHandler1\n",
GetLastError() );
Fail( "Test failed\n" );
}
}
/* PAL termination */
PAL_TerminateEx(ret);
/* return our result */
return ret;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.