blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 2 268 | content_id stringlengths 40 40 | detected_licenses listlengths 0 58 | license_type stringclasses 2 values | repo_name stringlengths 5 118 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 816 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 2.31k 677M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 151 values | src_encoding stringclasses 33 values | language stringclasses 1 value | is_vendor bool 2 classes | is_generated bool 2 classes | length_bytes int64 3 10.3M | extension stringclasses 119 values | content stringlengths 3 10.3M | authors listlengths 1 1 | author_id stringlengths 0 228 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e295e342d0e068db5c0e05ebc47018dc3011afea | cc215e2f54d91e1ba20e7a5affead251afef7b93 | /freetype/src/pcf/pcf.c | 00c98fbc6975bfa12b654efae2a5e8d7db303ea8 | [
"FTL",
"MIT"
] | permissive | SeriyyKust/CreatePNG | 8bc365daf8274330251d2cad06aaa8c103aead07 | e79d08991bf1d579af6596bb3b18467a48fd5537 | refs/heads/master | 2023-04-13T09:56:50.487595 | 2021-04-21T05:18:03 | 2021-04-21T05:18:03 | 360,038,702 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,288 | c | /* pcf.c
FreeType font driver for pcf fonts
Copyright 2000-2001, 2003 by
Francesco Zappa Nardelli
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.
*/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include "pcfdrivr.c"
#include "pcfread.c"
#include "pcfutil.c"
/* END */
| [
"tima.zavrazhnov@mail.ru"
] | tima.zavrazhnov@mail.ru |
f84b1cf23f444182504ab29826f57e6435b39cac | a70324bf8e5cf644e66b93d002370b0618b4b56f | /includes/move_finger.h | e2ba7681df1bb9a839a6420f835d949d01afd2a4 | [] | no_license | bibaswan-bhawal/robotic-hand | 7012e3dca7ba5f5fdc1954442a6529a32f4396dd | 37212c89b83b8fa70c3220c0560de249c17a735b | refs/heads/main | 2023-07-29T08:35:51.006139 | 2021-09-12T08:21:22 | 2021-09-12T08:21:22 | 405,585,248 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 153 | h | #ifndef MOVE_FINGER_H
#define MOVE_FINGER_H
#include "Arduino.h"
#include "var_def.h"
void movefinger(Finger finger, int speed, int direction);
#endif | [
"bibaswan3600@gmail.com"
] | bibaswan3600@gmail.com |
d621677a14d67cd0196ea1240bd548581c005257 | b09bd2fda971f526d386b755648150e605f53458 | /rush00/ex00/rush04.c | 82b0211d1a808c235fd29caf545f6f874cd6cfa6 | [] | no_license | JeanHo3/42Pool | 4e91037b11f96d233c0298d73f928cb49dcbc8dc | 51b476c85501c8d79b1361774cc97cbfe1356fc2 | refs/heads/master | 2020-03-23T12:17:28.000555 | 2018-07-25T18:39:42 | 2018-07-25T18:39:42 | 141,549,590 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,495 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush04.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tcherret <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/07/07 13:32:05 by tcherret #+# #+# */
/* Updated: 2018/07/07 14:51:59 by jhourman ### ########.fr */
/* */
/* ************************************************************************** */
void ft_putchar(char c);
void ft_print(int x, int y, int a, int b)
{
if ((a == 1 && b == 1) || (a == x && b == y))
{
ft_putchar('A');
}
else if ((a == 1 && b == y) || (a == x && b == 1))
{
ft_putchar('C');
}
else if ((b >= 1 && b <= y) && (a == 1 || a == x))
{
ft_putchar('B');
}
else if ((b == 1 || b == y) && (a > 1 && a < x))
{
ft_putchar('B');
}
else
{
ft_putchar(' ');
}
if (a == x)
{
ft_putchar('\n');
}
}
void rush04(int x, int y)
{
int a;
int b;
a = 1;
b = 1;
while (b <= y)
{
while (a <= x)
{
ft_print(x, y, a, b);
a++;
}
a = 1;
b++;
}
}
| [
"jhourman@e3r5p15.42.fr"
] | jhourman@e3r5p15.42.fr |
9bbcc951c7d52cde4c38591cb385092b7241a32c | e1704387d3045c8a0d631839fb6e317ffbe01605 | /rounding.c | b1cd609a6d89fd24c23ec4c0da25cb5eb5ea80dd | [] | no_license | StevenXL/codeabbey | 018f2e8a3e8473e24203313aa6bc74d287c602a6 | bb60a78b55af4d364f4dfd880a802c354be99e20 | refs/heads/master | 2021-01-22T01:05:57.874532 | 2015-05-25T22:09:46 | 2015-05-25T22:09:46 | 27,338,129 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,997 | c | #include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// open file in read only mode
FILE* inFile = fopen("rounding.txt", "r");
if (inFile == NULL)
{
printf("Unable to open file!\n");
return 1;
}
// create int var, store first line of file
int num_pairs;
fscanf(inFile, "%d", &num_pairs);
// create array to hold pairs
int* pairsArray;
pairsArray = malloc (num_pairs * 2 * sizeof(int));
// read each line, add the pairs to our pairsArray
int ii;
for (ii = 0; ii < (num_pairs * 2); ii = ii + 2)
{
fscanf(inFile, "%d %d", &pairsArray[ii], &pairsArray[ii + 1]);
}
// create array to hold answers
int* answersArray;
answersArray = malloc (num_pairs * sizeof(int));
// find the answers and hold them in the array
int jj = 0;
int kk = 0;
for (jj = 0, kk= 0; jj < (num_pairs * 2); jj = jj + 2, kk++)
{
float abs_div = fabsf( (float) pairsArray[jj] / pairsArray[jj + 1]);
int int_div = abs( pairsArray[jj] / pairsArray[jj + 1] );
if ( (pairsArray[jj] / pairsArray[jj + 1]) > 0 )
{
if ( (abs_div - int_div) >= 0.5 )
{
answersArray[kk] = (pairsArray[jj] / pairsArray[jj + 1]) + 1;
}
else
{
answersArray[kk] = pairsArray[jj] / pairsArray[jj + 1];
}
}
else
{
if ( (abs_div - int_div) >= 0.5 )
{
answersArray[kk] = (int_div + 1) * -1;
}
else
{
answersArray[kk] = int_div * -1;
}
}
}
// print answers
int ll = 0;
for (ll = 0; ll < num_pairs; ll++)
{
if (ll == (num_pairs - 1))
{
printf("%d\n", answersArray[ll]);
}
else
{
printf("%d ", answersArray[ll]);
}
}
return 0;
}
| [
"leiva.steven@gmail.com"
] | leiva.steven@gmail.com |
d58104b278162aaf063c1d3dd1b17f57f82d16ef | d63125caee9b6e9d54a29603da1680321cc884c4 | /fibbronacci.c | 4e1a528f466f420110501801465b37c8a6f844e7 | [] | no_license | Kishankr09/Even-Fibonacci-numbers | dcb2903f10808112f82f335334a0b24de5c76794 | e9f9f3d023cebe91b872af250418364634d511cd | refs/heads/master | 2022-12-17T04:45:45.396062 | 2020-09-16T12:46:04 | 2020-09-16T12:46:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 265 | c | #include<stdio.h>
#include<conio.h>
int main()
{
long n,j,k,s=2;
j=2;
k=1;
do
{
n=j+k;
k=j;
j=n;
if(n%2==0)
s=s+n;
}while(n<=4000000);
printf("even sum %d",s);
getch();
}
| [
"noreply@github.com"
] | Kishankr09.noreply@github.com |
f85279fed26ed221e934ec0179c20fbdbd9d1b1d | 9bfd1035daefdc9037289089ed4e6d00b208b672 | /src/image.h | 8f64fd652643b8e2dddbdd1818a34d0c58f41f37 | [] | no_license | pjreddie/dl-hw1 | bbb2a22e91b37b60a9ba6fb61b0ea2954a1bf63d | 8440db1f85807f2fd33b18498a212a5f46619e8a | refs/heads/master | 2020-04-01T08:39:07.358248 | 2018-10-25T19:31:17 | 2018-10-25T19:31:17 | 153,040,722 | 19 | 28 | null | null | null | null | UTF-8 | C | false | false | 1,274 | h | #ifndef IMAGE_H
#define IMAGE_H
#include <stdio.h>
// DO NOT CHANGE THIS FILE
#include "matrix.h"
#define TWOPI 6.2831853
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef struct{
int w,h,c;
float *data;
} image;
// Basic operations
float get_pixel(image im, int x, int y, int c);
void set_pixel(image im, int x, int y, int c, float v);
image copy_image(image im);
void shift_image(image im, int c, float v);
void scale_image(image im, int c, float v);
void clamp_image(image im);
image get_channel(image im, int c);
int same_image(image a, image b);
image sub_image(image a, image b);
image add_image(image a, image b);
// Loading and saving
typedef enum{ PNG, BMP, TGA, JPG } IMAGE_TYPE;
image make_image(int w, int h, int c);
image float_to_image(float *data, int w, int h, int c);
image load_image(char *filename);
void save_image_options(image im, const char *name, IMAGE_TYPE f, int quality);
void save_image(image im, const char *name);
void free_image(image im);
// Resizing
float nn_interpolate(image im, float x, float y, int c);
image nn_resize(image im, int w, int h);
float bilinear_interpolate(image im, float x, float y, int c);
image bilinear_resize(image im, int w, int h);
// Used for saving images
#endif
| [
"pjreddie@gmail.com"
] | pjreddie@gmail.com |
11f27fb7a445127a9afcd94f9d2f85e2f1f703ef | a95227278641ba65e6a09f77c6320bbdc9359886 | /130.c | d4c4f6c7ae153190a8b79d2634ab4ce280a46df4 | [] | no_license | MANOJTMK/player13 | 868bb171fd34f14ef4a4787ed1e8d43b308feb71 | 59b0c76be80745e46af83fbb6970fa6514b1fecc | refs/heads/master | 2020-04-27T23:16:03.566539 | 2019-03-24T09:09:00 | 2019-03-24T09:09:00 | 174,768,732 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 281 | c | #include <stdio.h>
#include<conio.h>
int main(void)
{
int n;
scanf("%d",&n);
int a[n],i,sum=0;
for(i=0;i<n;i++)
{
scanf("%d ",&a[i]);
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
if(sum%2==0)
{
printf("%d ",sum);
}
else
{
printf("%d ",a[i]);
}
}
return 0;
}
| [
"noreply@github.com"
] | MANOJTMK.noreply@github.com |
8dc0d4d3dbded87f4679d55880984f02b50741fc | 1c34c2aebd8294cddc9f7600d14d77bd007bffad | /ADC_CONFIGURATIONS_EXAMPLE1/src/asf.h | 1d6120e7d5f6930ed7546d84ce894558a1fb7b59 | [] | no_license | Hamidreza-k/adc | a9b0b2975ab3ebc820aa4d45904f38115e5ceaed | 0f784b20d22fcd5bd6b4badd29f156a0ed8c21cf | refs/heads/master | 2020-03-11T07:27:21.885771 | 2018-04-20T03:50:16 | 2018-04-20T03:50:16 | 129,857,224 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,802 | h | /**
* \file
*
* \brief Autogenerated API include file for the Atmel Software Framework (ASF)
*
* Copyright (c) 2012 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
#ifndef ASF_H
#define ASF_H
/*
* This file includes all API header files for the selected drivers from ASF.
* Note: There might be duplicate includes required by more than one driver.
*
* The file is automatically generated and will be re-written when
* running the ASF driver selector tool. Any changes will be discarded.
*/
// From module: ADC - Analog-to-Digital Converter (Callback APIs)
#include <adc.h>
#include <adc_callback.h>
// From module: Common SAM0 compiler driver
#include <compiler.h>
#include <status_codes.h>
// From module: Delay routines
#include <delay.h>
// From module: EVSYS - Event System Common
#include <events.h>
// From module: EVSYS - Event System with interupt hooks support
#include <events_hooks.h>
// From module: Generic board support
#include <board.h>
// From module: Interrupt management - SAM implementation
#include <interrupt.h>
// From module: PORT - GPIO Pin Control
#include <port.h>
// From module: Part identification macros
#include <parts.h>
// From module: SERCOM Callback API
#include <sercom.h>
#include <sercom_interrupt.h>
// From module: SERCOM USART - Serial Communications (Callback APIs)
#include <usart.h>
#include <usart_interrupt.h>
// From module: SYSTEM - Clock Management for SAMD21/R21/DA/HA
#include <clock.h>
#include <gclk.h>
// From module: SYSTEM - Core System Driver
#include <system.h>
// From module: SYSTEM - I/O Pin Multiplexer
#include <pinmux.h>
// From module: SYSTEM - Interrupt Driver
#include <system_interrupt.h>
// From module: SYSTEM - Power Management for SAM D20/D21/R21/D09/D10/D11/DA/HA
#include <power.h>
// From module: SYSTEM - Reset Management for SAM D20/D21/R21/D09/D10/D11/DA/HA
#include <reset.h>
// From module: Standard serial I/O (stdio)
#include <stdio_serial.h>
// From module: TC - Timer Counter (Callback APIs)
#include <tc.h>
#include <tc_interrupt.h>
// From module: USART - Serial interface- SAM implementation for devices with only USART
#include <serial.h>
#endif // ASF_H
| [
"H.KHISHAVAND@GMAIL.com"
] | H.KHISHAVAND@GMAIL.com |
b217cf352fd01dcd53f6d84df5144c03be758dd5 | 43441cde04695a2bf62a7a5f7db4072aa0a6d366 | /vc60/G3D/Stdafx.h | 52bd5687350a089aee5d51cb0558126e1952c8f6 | [] | no_license | crespo2014/cpp-lib | a8aaf4b963d3bf41f91db3832dd51bcf601d54ee | de6b653bf4c689fc5ceb3e9fe0f4fe47d79acf95 | refs/heads/master | 2020-12-24T15:23:32.396924 | 2016-03-21T11:53:37 | 2016-03-21T11:53:37 | 26,559,932 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,529 | h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_)
#define AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC Automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <gl\gl.h>
#include <gl\glu.h>
#include <afxmt.h>
#include "math.h"
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__8FC3CE27_AEEE_11D3_A036_0000E8DE4B3B__INCLUDED_)
| [
"lester.crespo.es@gmail.com"
] | lester.crespo.es@gmail.com |
26516eeb302ec10ec5ccb915df2051c0ec08a920 | 805666a84218be543410ff5089588f1572dd20ec | /d/quanzhou/yongning.c | 405b9906349c5168742a6fa1ccc739e6c54c8adc | [] | no_license | mudchina/xkx2001 | d47a9caca686ab7c89fe0b9140fbaf9d3601e1f5 | 4e8f8a13a72884d5dbe4b589542eb34e29e89d70 | refs/heads/master | 2021-01-10T06:50:29.517433 | 2016-02-20T14:09:12 | 2016-02-20T14:09:12 | 52,156,038 | 24 | 23 | null | null | null | null | GB18030 | C | false | false | 801 | c | //Cracked by Roath
// yongning.c 永宁港
// qfy Nov 3, 1996
// modified by aln
#include <ansi.h>
inherit HARBOR;
void create()
{
set("short", "永宁港");
set("long", @LONG
永宁港是泉州三大港口之一。这里港阔水深,风平浪静。极目远眺,海天
一色,蔚蓝无暇。岸边停靠着密密麻麻的各种船只。南边的姑嫂塔流传着一个
感人的故事。
LONG
);
set("exits", ([ /* sizeof() == 4 */
"south" : __DIR__"gushao",
"northwest" : __DIR__"gangkou2",
]));
set("objects", ([
__DIR__"npc/tiao-fu" : 1,
__DIR__"npc/kuli" : 1,
]));
set("no_clean_up", 0);
set("outdoors", "quanzhou");
set("navigate/locx", 0);
set("navigate/locy", -280);
set("cost", 1);
setup();
}
| [
"liming.xie@gmail.com"
] | liming.xie@gmail.com |
98e55fd99cc5141ee22b5e3e008a1b3b9eb21a97 | 28be9376f20320248283114ca82938b7561a3f76 | /PWM_Code/lpc_chip_5411x_m0/inc/spi_common_5411x.h | d50aca447fcd7a889268b10169e67b71d0ecdbce | [] | no_license | ankitjhall/Project_Pixybot | 5f08b4c1fea7f4c492fb89d373e1dea706ac6ce7 | 85bf0f825e1c9fa48516a7ba3ff5b8ff19b8e73d | refs/heads/master | 2022-03-15T23:08:49.831199 | 2022-03-03T05:01:11 | 2022-03-03T05:01:11 | 187,408,114 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 31,896 | h | /*
* @brief LPC5411X SPI common functions and definitions
*
* @note
* Copyright(C) NXP Semiconductors, 2015
* 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.
*/
#ifndef __SPI_COMMON_5411X_H_
#define __SPI_COMMON_5411X_H_
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup SPI_COMMON_5411X CHIP: LPC5411X SPI driver
*
* The SPI interface is provided via FlexCOMM module in the CHIP, to associate a SPI to
* a flexcom the source file must add a define like <b>\#define SPI0_FLEXCOMM 5</b> which
* will make LPC_SPI0 use LPC_FLEXCOMM5, interrupt service function name and IRQ number
* DMA REQUEST number will all be mapped automatically. <b> Note that this define must
* be available/visible to all the sources that uses SPI.</b><br><br> The SPI driver
* by default will use FIFOs for TX and RX. TX and RX FIFOs has a depth of 8 entries each.
*
* @ingroup CHIP_5411X_DRIVERS
* @{
*/
/**
* @brief SPI register block structure
*/
typedef struct { /*!< SPI Structure */
/** SPI registers @endcond */
__I uint32_t RESERVED0[256];
__IO uint32_t CFG; /*!< Offset: 0x400 SPI Configuration register */
__IO uint32_t DLY; /*!< Offset: 0x404 SPI Delay register */
__IO uint32_t STAT; /*!< Offset: 0x408 SPI Status register */
__IO uint32_t INTENSET; /*!< Offset: 0x40c SPI Interrupt Enable Set register */
__IO uint32_t INTENCLR; /*!< Offset: 0x410 SPI Interrupt Enable Clear register */
__I uint32_t RESERVED1[4];
__IO uint32_t DIV; /*!< Offset: 0x424 SPI clock Divider register */
__IO uint32_t INTSTAT; /*!< Offset: 0x428 SPI Interrupt Status register @cond */
__I uint32_t RESERVED2[629];
/** SPI FIFO Specific registers @endcond */
__IO uint32_t FIFOCFG; /*!< Offset: 0xE00 FIFO Configuration register */
__IO uint32_t FIFOSTAT; /*!< Offset: 0xE04 FIFO Status register */
__IO uint32_t FIFOTRIG; /*!< Offset: 0xE08 FIFO Trigger level register @cond */
__I uint32_t RESERVED3; /*!< Offset: 0xE0C Reserved register @endcond */
__IO uint32_t FIFOINTENSET; /*!< Offset: 0xE10 FIFO Interrupt enable SET register */
__IO uint32_t FIFOINTENCLR; /*!< Offset: 0xE14 FIFO Interrupt enable CLEAR register */
__IO uint32_t FIFOINTSTAT; /*!< Offset: 0xE18 FIFO Interrupt Status register @cond */
__I uint32_t RESERVED4; /*!< Offset: 0xE1C Reserved register @endcond */
__O uint32_t FIFOWR; /*!< Offset: 0xE20 FIFO Data write register @cond */
__I uint32_t RESERVED5[3]; /*!< Offset: 0xE24 Reserved register @endcond */
__I uint32_t FIFORD; /*!< Offset: 0xE30 FIFO Data read register @cond */
__I uint32_t RESERVED6[3]; /*!< Offset: 0xE24 Reserved register @endcond */
__I uint32_t FIFORDNOPOP; /*!< Offset: 0xE40 FIFO Data peek (read without popping out of queue) register @cond */
__I uint32_t RESERVED7[109]; /*!< Offset: 0xE44 Reserved register */
/** FLEXCOMM Interface registers @endcond */
__IO uint32_t PSELID; /*!< Offset: 0xFF8 Peripheral select/identification register */
__I uint32_t PID; /*!< Offset: 0xFFC Module identification register */
} LPC_SPI_T;
/**
* Macro defines for SPI Configuration register
*/
#define SPI_CFG_BITMASK (0x0FBD) /** SPI register bit mask */
#define SPI_CFG_SPI_EN (1 << 0) /** SPI Slave Mode Select */
#define SPI_CFG_SLAVE_EN (0 << 0) /** SPI Master Mode Select */
#define SPI_CFG_MASTER_EN (1 << 2) /** SPI MSB First mode enable */
#define SPI_CFG_MSB_FIRST_EN (0 << 3) /** SPI LSB First mode enable */
#define SPI_CFG_LSB_FIRST_EN (1 << 3) /** SPI Clock Phase Select */
#define SPI_CFG_CPHA_FIRST (0 << 4) /** Capture data on the first edge, Change data on the following edge */
#define SPI_CFG_CPHA_SECOND (1 << 4) /** SPI Clock Polarity Select */
#define SPI_CFG_CPOL_LO (0 << 5) /** The rest state of the clock (between frames) is low. */
#define SPI_CFG_CPOL_HI (1 << 5) /** The rest state of the clock (between frames) is high. */
#define SPI_CFG_LBM_EN (1 << 7) /** SPI control 1 loopback mode enable */
#define SPI_CFG_SPOL_LO (0 << 8) /** SPI SSEL0 Polarity Select */
#define SPI_CFG_SPOL_HI (1 << 8) /** SSEL0 is active High */
#define SPI_CFG_SPOLNUM_HI(n) (1 << ((n) + 8)) /** SSELN is active High, selects 0 - 3 */
/**
* Macro defines for SPI Delay register
*/
#define SPI_DLY_BITMASK (0xFFFF) /** SPI DLY Register Mask */
#define SPI_DLY_PRE_DELAY(n) (((n) & 0x0F) << 0) /** Time in SPI clocks between SSEL assertion and the beginning of a data frame */
#define SPI_DLY_POST_DELAY(n) (((n) & 0x0F) << 4) /** Time in SPI clocks between the end of a data frame and SSEL deassertion. */
#define SPI_DLY_FRAME_DELAY(n) (((n) & 0x0F) << 8) /** Minimum time in SPI clocks between adjacent data frames. */
#define SPI_DLY_TRANSFER_DELAY(n) (((n) & 0x0F) << 12) /** Minimum time in SPI clocks that the SSEL is deasserted between transfers. */
/**
* Macro defines for SPI Status register
*/
#define SPI_STAT_BITMASK (0x01F0) /** SPI STAT Register BitMask */
#define SPI_STAT_SSA (1 << 4) /** Slave Select Assert */
#define SPI_STAT_SSD (1 << 5) /** Slave Select Deassert */
#define SPI_STAT_STALLED (1 << 6) /** Stalled status flag */
#define SPI_STAT_EOT (1 << 7) /** End Transfer flag */
#define SPI_STAT_MSTIDLE (1 << 8) /** Idle status flag */
/**
* Macro defines for SPI interrupt register
*/
#define SPI_INT_BITMASK (0x0130) /** SPI interrupt Enable/Disable bits */
#define SPI_INT_SSAEN (1 << 4) /** Slave Select is asserted interrupt [BIT-4 of INTENSET/INTENCLR/INTSTAT register] */
#define SPI_INT_SSDEN (1 << 5) /** Slave Select is deasserted interrupt [BIT-5 of INTENSET/INTENCLR/INTSTAT register] */
#define SPI_INT_MSTIDLE (1 << 8) /** SPI master is Idle [BIT-8 of INTENSET/INTENCLR/INTSTAT register] */
/**
* @brief SPI FIFO Configuration register bits
* @cond
*/
#define SPI_FIFOCFG_MASK (0x3F033) /*!< Register mask bit @endcond */
#define SPI_FIFOCFG_ENABLETX (1 << 0) /*!< Enable TX FIFO */
#define SPI_FIFOCFG_ENABLERX (1 << 1) /*!< Enable RX FIFO */
#define SPI_FIFOCFG_DMATX (1 << 12) /*!< Enable DMA TX */
#define SPI_FIFOCFG_DMARX (1 << 13) /*!< Enable DMA RX */
#define SPI_FIFOCFG_WAKETX (1 << 14) /*!< Enable wakeup triggered by TX */
#define SPI_FIFOCFG_WAKERX (1 << 15) /*!< Enable wakeup triggered by RX */
#define SPI_FIFOCFG_EMPTYTX (1 << 16) /*!< Empty the TX FIFO */
#define SPI_FIFOCFG_EMPTYRX (1 << 17) /*!< Empty the RX FIFO */
/**
* @brief Macro defines for FIFO Status register
*/
#define SPI_FIFO_DEPTH (8) /** SPI-FIFO How many entries are in the FIFO */
#define SPI_FIFOSTAT_BITMASK (0x1F1FFB) /** SPI-FIFO STAT Register BitMask */
#define SPI_FIFOSTAT_TXERR (1 << 0) /** SPI-FIFO transmit error */
#define SPI_FIFOSTAT_RXERR (1 << 1) /** SPI-FIFO receive error */
#define SPI_FIFOSTAT_PERINT (1 << 3) /** SPI-FIFO peripheral (SPI) interrupt */
#define SPI_FIFOSTAT_TXEMPTY (1 << 4) /** SPI-FIFO transmitter empty */
#define SPI_FIFOSTAT_TXNOTFULL (1 << 5) /** SPI-FIFO transmitter not full */
#define SPI_FIFOSTAT_RXNOTEMPTY (1 << 6) /** SPI-FIFO receiver not empty */
#define SPI_FIFOSTAT_RXFULL (1 << 7) /** SPI-FIFO receiver not full */
#define SPI_FIFOSTAT_TXLVL(val) (((val) >> 8) & 0x1F) /** SPI-FIFO extract transmit level */
#define SPI_FIFOSTAT_RXLVL(val) (((val) >> 16) & 0x1F) /** SPI-FIFO extract receive level */
/**
* @brief UART FIFO trigger settings register defines
*/
#define SPI_FIFOTRIG_BITMASK (0x000f0f03) /** SPI FIFO trigger settings Register BitMask */
#define SPI_FIFOTRIG_TXLVLENA (1 << 0) /*!< TX level enable*/
#define SPI_FIFOTRIG_RXLVLENA (1 << 1) /*!< RX level enable */
#define SPI_FIFOTRIG_TXLVL(lvl) ((lvl & 0x0f) << 8) /*!< Set TX Level trigger */
#define SPI_FIFOTRIG_RXLVL(lvl) ((lvl & 0x0f) << 16) /*!< Set RX Level trigger */
#define SPI_FIFOTRIG_TXLVL_DEFAULT 4 /*!< Set TX default trigger level to half-full */
#define SPI_FIFOTRIG_RXLVL_DEFAULT 0 /*!< Set RX default trigger level to one item */
/**
* @brief Macro defines for SPI Interrupt enable/disable/status [INTSET/INTCLR/INTSTAT and FIFOINTSET/FIFOINTCLR/FIFOINTSTAT registers]
*/
#define SPI_FIFOINT_BITMASK (0x001F) /** FIFO interrupt Bit mask */
#define SPI_FIFOINT_TXERR (1 << 0) /** TX error interrupt [BIT-0 of FIFOINTENSET/FIFOINTENCLR/FIFOINTSTAT register] */
#define SPI_FIFOINT_RXERR (1 << 1) /** RX error interrupt [BIT-1 of FIFOINTENSET/FIFOINTENCLR/FIFOINTSTAT register] */
#define SPI_FIFOINT_TXLVL (1 << 2) /** TX FIFO ready interrupt [BIT-2 of FIFOINTENSET/FIFOINTENCLR/FIFOINTSTAT register] */
#define SPI_FIFOINT_RXLVL (1 << 3) /** RX Data ready interrupt [BIT-3 of FIFOINTENSET/FIFOINTENCLR/FIFOINTSTAT register] */
#define SPI_FIFOINT_PERINT (1 << 4) /** SPI peripheral interrupt [BIT-4 of FIFOINTSTAT register] */
/**
* Macro defines for SPI FIFO Receiver Data register
*/
#define SPI_RXDAT_BITMASK (0x1FFFFF) /** SPI RXDAT Register BitMask */
#define SPI_RXDAT_DATA(n) ((n) & 0xFFFF) /** Receiver Data */
#define SPI_RXDAT_RXSSELN(n) ((~((n >> 16) & 0x0f)) & 0x0f) /** Determine the active SSEL pin */
#define SPI_RXDAT_RXSSELN_ACTIVE (0 << 16) /** The state of SSEL pin is active */
#define SPI_RXDAT_SOT (1 << 20) /** Start of Transfer flag */
/**
* Macro defines for SPI FIFO Transmitter Data and Control register
*/
#define SPI_TXDAT_BITMASK (0xF7FFFFF) /** SPI TXDATCTL Register BitMask */
#define SPI_TXDAT_DATA(n) ((n) & 0xFFFF) /** SPI Transmit Data */
#define SPI_TXDAT_CTRLMASK (0xF7F) /** SPI TXDATCTL Register BitMask for control bits only */
#define SPI_TXDAT_ASSERT_SSEL (0) /** Assert SSEL0 pin */
#define SPI_TXDAT_ASSERTNUM_SSEL(n) ((~(1 << (n))) & 0x0f) /** Assert SSELN pin */
#define SPI_TXDAT_DEASSERT_SSEL (1) /** Deassert SSEL0 pin */
#define SPI_TXDAT_DEASSERTNUM_SSEL(n) (1 << (n)) /** Deassert SSELN pin */
#define SPI_TXDAT_DEASSERT_ALL (0xF) /** Deassert all SSEL pins */
#define SPI_TXDAT_EOT (1 << 4) /** End of Transfer flag (TRANSFER_DELAY is applied after sending the current frame) */
#define SPI_TXDAT_EOF (1 << 5) /** End of Frame flag (FRAME_DELAY is applied after sending the current part) */
#define SPI_TXDAT_RXIGNORE (1 << 6) /** Receive Ignore Flag */
#define SPI_TXDAT_FLEN(n) (((n) & 0x0F) << 8) /** Frame length - 1 */
#define SPI_TXDAT_FLENMASK (0xF << 8) /** Frame length mask */
/**
* Macro defines for SPI Transmitter Data Register
*/
#define SPI_TXDAT_DATA(n) ((n) & 0xFFFF) /** SPI Transmit Data */
/**
* Macro defines for SPI Divider register
*/
#define SPI_DIV_VAL(n) ((n) & 0xFFFF) /** Rate divider value mask (In Master Mode only)*/
/** @brief SPI Clock Mode*/
typedef enum {
ROM_SPI_CLOCK_CPHA0_CPOL0 = 0, /**< CPHA = 0, CPOL = 0 */
ROM_SPI_CLOCK_MODE0 = ROM_SPI_CLOCK_CPHA0_CPOL0, /**< Alias for CPHA = 0, CPOL = 0 */
ROM_SPI_CLOCK_CPHA1_CPOL0 = 1, /**< CPHA = 0, CPOL = 1 */
ROM_SPI_CLOCK_MODE1 = ROM_SPI_CLOCK_CPHA1_CPOL0, /**< Alias for CPHA = 0, CPOL = 1 */
ROM_SPI_CLOCK_CPHA0_CPOL1 = 2, /**< CPHA = 1, CPOL = 0 */
ROM_SPI_CLOCK_MODE2 = ROM_SPI_CLOCK_CPHA0_CPOL1, /**< Alias for CPHA = 1, CPOL = 0 */
ROM_SPI_CLOCK_CPHA1_CPOL1 = 3, /**< CPHA = 1, CPOL = 1 */
ROM_SPI_CLOCK_MODE3 = ROM_SPI_CLOCK_CPHA1_CPOL1, /**< Alias for CPHA = 1, CPOL = 1 */
} ROM_SPI_CLOCK_MODE_T;
/**
* @brief Initialize the SPI
* @param pSPI : The base SPI peripheral on the chip
* @return Nothing
*/
int Chip_SPI_Init(LPC_SPI_T *pSPI);
/**
* @brief Disable SPI operation
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
* @note The SPI controller is disabled.
*/
__STATIC_INLINE void Chip_SPI_DeInit(LPC_SPI_T *pSPI)
{
Chip_FLEXCOMM_DeInit(pSPI);
}
/**
* @brief Set SPI CFG register values
* @param pSPI : Base on-chip SPI peripheral address
* @param bits : CFG register bits to set, amd OR'ed value of SPI_CFG_* definitions
* @return Nothing
* @note This function safely sets only the selected bits in the SPI CFG register.
* It can be used to enable multiple bits at once.
*/
__STATIC_INLINE void Chip_SPI_SetCFGRegBits(LPC_SPI_T *pSPI, uint32_t bits)
{
pSPI->CFG = (pSPI->CFG & SPI_CFG_BITMASK) | bits;
}
/**
* @brief Clear SPI CFG register values
* @param pSPI : Base on-chip SPI peripheral address
* @param bits : CFG register bits to clear, amd OR'ed value of SPI_CFG_* definitions
* @return Nothing
* @note This function safely clears only the selected bits in the SPI CFG register.
* It can be used to disable multiple bits at once.
*/
__STATIC_INLINE void Chip_SPI_ClearCFGRegBits(LPC_SPI_T *pSPI, uint32_t bits)
{
pSPI->CFG = pSPI->CFG & (~bits & SPI_CFG_BITMASK);
}
/**
* @brief Enable SPI peripheral
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_Enable(LPC_SPI_T *pSPI)
{
Chip_SPI_SetCFGRegBits(pSPI, SPI_CFG_SPI_EN);
}
/**
* @brief Disable SPI peripheral
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_Disable(LPC_SPI_T *pSPI)
{
Chip_SPI_ClearCFGRegBits(pSPI, SPI_CFG_SPI_EN);
}
/**
* @brief Enable SPI slave mode
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
* @note SPI master mode will be disabled with this call.
*/
__STATIC_INLINE void Chip_SPI_EnableSlaveMode(LPC_SPI_T *pSPI)
{
Chip_SPI_ClearCFGRegBits(pSPI, SPI_CFG_MASTER_EN);
}
/**
* @brief Enable LSB First transfers
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_EnableLSBFirst(LPC_SPI_T *pSPI)
{
Chip_SPI_SetCFGRegBits(pSPI, SPI_CFG_LSB_FIRST_EN);
}
/**
* @brief Enable MSB First transfers
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_EnableMSBFirst(LPC_SPI_T *pSPI)
{
Chip_SPI_ClearCFGRegBits(pSPI, SPI_CFG_LSB_FIRST_EN);
}
/** @brief SPI Clock Mode*/
typedef enum IP_SPI_CLOCK_MODE {
SPI_CLOCK_CPHA0_CPOL0 = SPI_CFG_CPOL_LO | SPI_CFG_CPHA_FIRST, /**< CPHA = 0, CPOL = 0 */
SPI_CLOCK_MODE0 = SPI_CLOCK_CPHA0_CPOL0, /**< Alias for CPHA = 0, CPOL = 0 */
SPI_CLOCK_CPHA1_CPOL0 = SPI_CFG_CPOL_LO | SPI_CFG_CPHA_SECOND, /**< CPHA = 0, CPOL = 1 */
SPI_CLOCK_MODE1 = SPI_CLOCK_CPHA1_CPOL0, /**< Alias for CPHA = 0, CPOL = 1 */
SPI_CLOCK_CPHA0_CPOL1 = SPI_CFG_CPOL_HI | SPI_CFG_CPHA_FIRST, /**< CPHA = 1, CPOL = 0 */
SPI_CLOCK_MODE2 = SPI_CLOCK_CPHA0_CPOL1, /**< Alias for CPHA = 1, CPOL = 0 */
SPI_CLOCK_CPHA1_CPOL1 = SPI_CFG_CPOL_HI | SPI_CFG_CPHA_SECOND, /**< CPHA = 1, CPOL = 1 */
SPI_CLOCK_MODE3 = SPI_CLOCK_CPHA1_CPOL1, /**< Alias for CPHA = 1, CPOL = 1 */
} SPI_CLOCK_MODE_T;
/**
* @brief Set SPI mode
* @param pSPI : Base on-chip SPI peripheral address
* @param mode : SPI mode to set the SPI interface to
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_SetSPIMode(LPC_SPI_T *pSPI, SPI_CLOCK_MODE_T mode)
{
Chip_SPI_ClearCFGRegBits(pSPI, (SPI_CFG_CPOL_HI | SPI_CFG_CPHA_SECOND));
Chip_SPI_SetCFGRegBits(pSPI, (uint32_t) mode);
}
/**
* @brief Set polarity on the SPI chip select high
* @param pSPI : Base on-chip SPI peripheral address
* @param csNum : Chip select number, 0 - 3
* @return Nothing
* @note SPI chip select polarity is active high.
*/
__STATIC_INLINE void Chip_SPI_SetCSPolHigh(LPC_SPI_T *pSPI, uint8_t csNum)
{
Chip_SPI_SetCFGRegBits(pSPI, SPI_CFG_SPOLNUM_HI(csNum));
}
/**
* @brief Set polarity on the SPI chip select low
* @param pSPI : Base on-chip SPI peripheral address
* @param csNum : Chip select number, 0 - 3
* @return Nothing
* @note SPI chip select polarity is active low.
*/
__STATIC_INLINE void Chip_SPI_SetCSPolLow(LPC_SPI_T *pSPI, uint8_t csNum)
{
Chip_SPI_ClearCFGRegBits(pSPI, SPI_CFG_SPOLNUM_HI(csNum));
}
/** SPI configuration structure used for setting up master/slave mode, LSB or
* MSB first, and SPI mode in a single function call. */
typedef struct {
uint32_t master : 8; /* Set to non-0 value to use master mode, 0 for slave */
uint32_t lsbFirst : 8; /* Set to non-0 value to send LSB first, 0 for MSB first */
SPI_CLOCK_MODE_T mode : 8; /* Mode selection */
uint32_t reserved : 8; /* Reserved, for alignment only */
} SPI_CFGSETUP_T;
/**
* @brief Setup SPI configuration
* @param pSPI : Base on-chip SPI peripheral address
* @param pCFG : Pointer to SPI configuration structure
* @return Nothing
*/
void Chip_SPI_ConfigureSPI(LPC_SPI_T *pSPI, SPI_CFGSETUP_T *pCFG);
/**
* @brief Get the current status of SPI controller
* @param pSPI : Base on-chip SPI peripheral address
* @return SPI Status (Or-ed bit value of SPI_STAT_*)
* @note Mask the return value with a value of type SPI_STAT_* to determine
* if that status is active.
*/
__STATIC_INLINE uint32_t Chip_SPI_GetStatus(LPC_SPI_T *pSPI)
{
return pSPI->STAT;
}
/**
* @brief Clear SPI status
* @param pSPI : Base on-chip SPI peripheral address
* @param Flag : Clear Flag (Or-ed bit value of SPI_STAT_*)
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_ClearStatus(LPC_SPI_T *pSPI, uint32_t Flag)
{
pSPI->STAT = Flag;
}
/**
* @brief Enable a SPI interrupt
* @param pSPI : Base on-chip SPI peripheral address
* @param intMask : Or'ed value of SPI_INT_* values to enable
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_EnableInts(LPC_SPI_T *pSPI, uint32_t intMask)
{
pSPI->INTENSET = intMask & SPI_INT_BITMASK;
}
/**
* @brief Disable a SPI interrupt
* @param pSPI : Base on-chip SPI peripheral address
* @param intMask : Or'ed value of SPI_INT_* values to disable (See #SPI_INT_BITMASK)
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_DisableInts(LPC_SPI_T *pSPI, uint32_t intMask)
{
pSPI->INTENCLR = intMask & SPI_INT_BITMASK;
}
/**
* @brief Return enabled SPI interrupts
* @param pSPI : Base on-chip SPI peripheral address
* @return An Or'ed value of SPI_INT_* values
* @note Mask the return value with a SPI_INT_* value to determine (See #SPI_INT_BITMASK)
* if the interrupt is enabled.
* @note INTSTAT contains enabled interrupts, not pending interrupts.
*/
__STATIC_INLINE uint32_t Chip_SPI_GetEnabledInts(LPC_SPI_T *pSPI)
{
return pSPI->INTSTAT & SPI_INT_BITMASK;
}
/**
* @brief Return pending SPI interrupts
* @param pSPI : Base on-chip SPI peripheral address
* @return An Or'ed value of SPI_INT_* values
*/
__STATIC_INLINE uint32_t Chip_SPI_GetPendingInts(LPC_SPI_T *pSPI)
{
uint32_t stat, mask;
mask = pSPI->INTSTAT;
stat = pSPI->STAT;
stat &= mask;
return stat;
}
//------------------------------------------------------------------------------
//
// End SPI functions / Start of FIFO functions
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// FIFO configuration functions
//------------------------------------------------------------------------------
/**
* @brief Set FIFO Configuration register
* @param pSPI : Base on-chip SPI peripheral address
* @param cfg : Configuration value mask (OR'ed SPI_FIFOCFG_* values like #SPI_FIFOCFG_ENABLETX)
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_SetFIFOCfg(LPC_SPI_T *pSPI, uint32_t cfg)
{
pSPI->FIFOCFG = (pSPI->FIFOCFG & SPI_FIFOCFG_MASK) | cfg;
}
/**
* @brief Clear FIFO Configuration register
* @param pSPI : Base on-chip SPI peripheral address
* @param cfg : Configuration value mask (OR'ed SPI_FIFOCFG_* values like #SPI_FIFOCFG_ENABLETX)
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_ClearFIFOCfg(LPC_SPI_T *pSPI, uint32_t cfg)
{
pSPI->FIFOCFG = pSPI->FIFOCFG & (SPI_FIFOCFG_MASK & ~cfg);
}
//------------------------------------------------------------------------------
// FIFO status functions
//------------------------------------------------------------------------------
/**
* @brief Get the current status of SPI controller FIFO
* @param pSPI : Base on-chip SPI peripheral address
* @return SPI Status (Or-ed bit value of SPI_FIFOSTAT_*)
* @note Mask the return value with a value of type SPI_FIFOSTAT_* to determine
* if that status is active.
*/
__STATIC_INLINE uint32_t Chip_SPI_GetFIFOStatus(LPC_SPI_T *pSPI)
{
return pSPI->FIFOSTAT;
}
/**
* @brief Clear the FIFO status register
* @param pSPI : Base on-chip SPI peripheral address
* @param mask : Mask of the status bits that needs to be cleared
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_ClearFIFOStatus(LPC_SPI_T *pSPI, uint32_t mask)
{
pSPI->FIFOSTAT = mask;
}
//------------------------------------------------------------------------------
// FIFO trigger functions
//------------------------------------------------------------------------------
/**
* @brief Setup SPI FIFO trigger-level
* @param pSPI : Base on-chip SPI peripheral address
* @param tx_lvl : TX Trigger level [Valid values 0 to 7]
* @param rx_lvl : RX Trigger level [Valid values 0 to 7]
* @return Nothing
* @note When @a tx_lvl = 0; trigger will happen when TX FIFO is empty
* if @a tx_lvl = 7; trigger will happen when TX FIFO has at least one free space<br>
* When @a rx_lvl = 0; trigger will happen when RX FIFO has at least one data in it,
* if @a rx_lvl = 7; trigger will happen when RX FIFO is full and cannot receive anymore data.
*/
__STATIC_INLINE void Chip_SPI_SetFIFOTrigLevel(LPC_SPI_T *pSPI, uint8_t tx_lvl, uint8_t rx_lvl)
{
pSPI->FIFOTRIG = SPI_FIFOTRIG_TXLVL(tx_lvl) | SPI_FIFOTRIG_RXLVL(rx_lvl) |SPI_FIFOTRIG_TXLVLENA | SPI_FIFOTRIG_TXLVLENA;
}
/**
* @brief Get SPI FIFO trigger-level
* @param pSPI : Base of on-chip SPI peripheral
* @return Returns the complete raw trigger register.
*/
__STATIC_INLINE uint32_t Chip_SPI_GetFIFOTrigLevel(LPC_SPI_T *pSPI)
{
return pSPI->FIFOTRIG;
}
//------------------------------------------------------------------------------
// FIFO interrupt functions
//------------------------------------------------------------------------------
/**
* @brief Enable a SPI FIFO interrupt
* @param pSPI : Base on-chip SPI peripheral address
* @param intMask : Or'ed value of SPI_FIFOINT_* values to enable
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_EnableFIFOInts(LPC_SPI_T *pSPI, uint32_t intMask)
{
pSPI->FIFOINTENSET = intMask & SPI_FIFOINT_BITMASK;
}
/**
* @brief Disable a SPI FIFO interrupt
* @param pSPI : Base on-chip SPI peripheral address
* @param intMask : Or'ed value of SPI_FIFOINT_* values to disable (See #SPI_FIFOINT_BITMASK)
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_DisableFIFOInts(LPC_SPI_T *pSPI, uint32_t intMask)
{
pSPI->FIFOINTENCLR = intMask & SPI_FIFOINT_BITMASK;
}
/**
* @brief Return enabled SPI FIFO interrupts
* @param pSPI : Base on-chip SPI peripheral address
* @return An Or'ed value of SPI_FIFOINT_* values
*/
__STATIC_INLINE uint32_t Chip_SPI_GetFIFOEnabledInts(LPC_SPI_T *pSPI)
{
return pSPI->FIFOINTENSET & SPI_FIFOINT_BITMASK;
}
/**
* @brief Return pending SPI FIFO interrupts
* @param pSPI : Base on-chip SPI peripheral address
* @return An Or'ed value of SPI_FIFOINT_* values
*/
__STATIC_INLINE uint32_t Chip_SPI_GetFIFOPendingInts(LPC_SPI_T *pSPI)
{
return pSPI->FIFOINTSTAT & SPI_FIFOINT_BITMASK;
}
//------------------------------------------------------------------------------
// FIFO I/O functions
//------------------------------------------------------------------------------
/**
* @brief Read raw data from receive FIFO with status bits
* @param pSPI : Base on-chip SPI peripheral address
* @return Current value in receive data FIFO plus status bits
*/
__STATIC_INLINE uint32_t Chip_SPI_ReadRawRXFifo(LPC_SPI_T *pSPI)
{
return pSPI->FIFORD;
}
#define Chip_SPI_ReadFIFO Chip_SPI_ReadRawRXFifo
/**
* @brief Read data from receive FIFO masking off status bits
* @param pSPI : Base on-chip SPI peripheral address
* @return Current value in receive data FIFO
* @note The entire register is read, but only the low 16-bits
* are returned.
*/
__STATIC_INLINE uint16_t Chip_SPI_ReadRXData(LPC_SPI_T *pSPI)
{
__I void *ptr = &pSPI->FIFORD;
return *((__I uint16_t *) ptr);
}
#define Chip_SPI_ReadFIFOdata Chip_SPI_ReadRXData
/**
* @brief Write FIFOWR register: writes 32-bit value to FIFO
* @param pSPI : Base on-chip SPI peripheral address
* @param data : Control and Data to be transfered
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_WriteFIFO(LPC_SPI_T *pSPI, uint32_t data)
{
pSPI->FIFOWR = data;
}
/**
* @brief Write FIFOWR register: writes control options and data
* @param pSPI : Base on-chip SPI peripheral address
* @param ctrl : Control bits to be set
* @param data : Data to be transfered
* @return Nothing
* @note This function safely sets only set bits in FIFOWR control register.
* It can be used to enable multiple options at once.
*/
__STATIC_INLINE void Chip_SPI_SetTXCTRLData(LPC_SPI_T *pSPI, uint16_t ctrl, uint16_t data)
{
pSPI->FIFOWR = (ctrl << 16) | data;
}
#define Chip_SPI_WriteFIFOcd Chip_SPI_SetTXCTRLData
/**
* @brief Write data to transmit FIFO
* @param pSPI : Base on-chip SPI peripheral address
* @param data : Data to write
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_WriteTXData(LPC_SPI_T *pSPI, uint16_t data)
{
__O void *ptr = &pSPI->FIFOWR;
*((__O uint16_t *) ptr) = data;
}
#define Chip_SPI_WriteFIFOdata Chip_SPI_WriteTXData
/**
* @brief Flush FIFOs
* @param pSPI : Base on-chip SPI peripheral address
* @return Nothing
*/
__STATIC_INLINE void Chip_SPI_FlushFifos(LPC_SPI_T *pSPI)
{
Chip_SPI_SetFIFOCfg(pSPI, SPI_FIFOCFG_EMPTYTX | SPI_FIFOCFG_EMPTYRX);
}
#define Chip_SPI_FlushFIFOs Chip_SPI_FlushFifos
#ifndef __DOXYGEN__
/* SPI0 Defines */
#define LPC_SPI0_BASE __APPEND3(LPC_FLEXCOMM,SPI0_FLEXCOMM,_BASE)
#define LPC_SPI0 ((LPC_SPI_T *) LPC_SPI0_BASE)
#define SPI0_IRQHandler __APPEND3(FLEXCOMM,SPI0_FLEXCOMM,_IRQHandler)
#define SPI0_IRQn __APPEND3(FLEXCOMM,SPI0_FLEXCOMM,_IRQn)
#define DMAREQ_SPI0_RX __APPEND3(DMAREQ_FLEXCOMM,SPI0_FLEXCOMM,_RX)
#define DMAREQ_SPI0_TX __APPEND3(DMAREQ_FLEXCOMM,SPI0_FLEXCOMM,_TX)
/* SPI1 Defines */
#define LPC_SPI1_BASE __APPEND3(LPC_FLEXCOMM,SPI1_FLEXCOMM,_BASE)
#define LPC_SPI1 ((LPC_SPI_T *) LPC_SPI1_BASE)
#define SPI1_IRQHandler __APPEND3(FLEXCOMM,SPI1_FLEXCOMM,_IRQHandler)
#define SPI1_IRQn __APPEND3(FLEXCOMM,SPI1_FLEXCOMM,_IRQn)
#define DMAREQ_SPI1_RX __APPEND3(DMAREQ_FLEXCOMM,SPI1_FLEXCOMM,_RX)
#define DMAREQ_SPI1_TX __APPEND3(DMAREQ_FLEXCOMM,SPI1_FLEXCOMM,_TX)
/* SPI2 Defines */
#define LPC_SPI2_BASE __APPEND3(LPC_FLEXCOMM,SPI2_FLEXCOMM,_BASE)
#define LPC_SPI2 ((LPC_SPI_T *) LPC_SPI2_BASE)
#define SPI2_IRQHandler __APPEND3(FLEXCOMM,SPI2_FLEXCOMM,_IRQHandler)
#define SPI2_IRQn __APPEND3(FLEXCOMM,SPI2_FLEXCOMM,_IRQn)
#define DMAREQ_SPI2_RX __APPEND3(DMAREQ_FLEXCOMM,SPI2_FLEXCOMM,_RX)
#define DMAREQ_SPI2_TX __APPEND3(DMAREQ_FLEXCOMM,SPI2_FLEXCOMM,_TX)
/* SPI3 Defines */
#define LPC_SPI3_BASE __APPEND3(LPC_FLEXCOMM,SPI3_FLEXCOMM,_BASE)
#define LPC_SPI3 ((LPC_SPI_T *) LPC_SPI3_BASE)
#define SPI3_IRQHandler __APPEND3(FLEXCOMM,SPI3_FLEXCOMM,_IRQHandler)
#define SPI3_IRQn __APPEND3(FLEXCOMM,SPI3_FLEXCOMM,_IRQn)
#define DMAREQ_SPI3_RX __APPEND3(DMAREQ_FLEXCOMM,SPI3_FLEXCOMM,_RX)
#define DMAREQ_SPI3_TX __APPEND3(DMAREQ_FLEXCOMM,SPI3_FLEXCOMM,_TX)
/* SPI4 Defines */
#define LPC_SPI4_BASE __APPEND3(LPC_FLEXCOMM,SPI4_FLEXCOMM,_BASE)
#define LPC_SPI4 ((LPC_SPI_T *) LPC_SPI4_BASE)
#define SPI4_IRQHandler __APPEND3(FLEXCOMM,SPI4_FLEXCOMM,_IRQHandler)
#define SPI4_IRQn __APPEND3(FLEXCOMM,SPI4_FLEXCOMM,_IRQn)
#define DMAREQ_SPI4_RX __APPEND3(DMAREQ_FLEXCOMM,SPI4_FLEXCOMM,_RX)
#define DMAREQ_SPI4_TX __APPEND3(DMAREQ_FLEXCOMM,SPI4_FLEXCOMM,_TX)
/* SPI5 Defines */
#define LPC_SPI5_BASE __APPEND3(LPC_FLEXCOMM,SPI5_FLEXCOMM,_BASE)
#define LPC_SPI5 ((LPC_SPI_T *) LPC_SPI5_BASE)
#define SPI5_IRQHandler __APPEND3(FLEXCOMM,SPI5_FLEXCOMM,_IRQHandler)
#define SPI5_IRQn __APPEND3(FLEXCOMM,SPI5_FLEXCOMM,_IRQn)
#define DMAREQ_SPI5_RX __APPEND3(DMAREQ_FLEXCOMM,SPI5_FLEXCOMM,_RX)
#define DMAREQ_SPI5_TX __APPEND3(DMAREQ_FLEXCOMM,SPI5_FLEXCOMM,_TX)
/* SPI6 Defines */
#define LPC_SPI6_BASE __APPEND3(LPC_FLEXCOMM,SPI6_FLEXCOMM,_BASE)
#define LPC_SPI6 ((LPC_SPI_T *) LPC_SPI6_BASE)
#define SPI6_IRQHandler __APPEND3(FLEXCOMM,SPI6_FLEXCOMM,_IRQHandler)
#define SPI6_IRQn __APPEND3(FLEXCOMM,SPI6_FLEXCOMM,_IRQn)
#define DMAREQ_SPI6_RX __APPEND3(DMAREQ_FLEXCOMM,SPI6_FLEXCOMM,_RX)
#define DMAREQ_SPI6_TX __APPEND3(DMAREQ_FLEXCOMM,SPI6_FLEXCOMM,_TX)
/* SPI7 Defines */
#define LPC_SPI7_BASE __APPEND3(LPC_FLEXCOMM,SPI7_FLEXCOMM,_BASE)
#define LPC_SPI7 ((LPC_SPI_T *) LPC_SPI7_BASE)
#define SPI7_IRQHandler __APPEND3(FLEXCOMM,SPI7_FLEXCOMM,_IRQHandler)
#define SPI7_IRQn __APPEND3(FLEXCOMM,SPI7_FLEXCOMM,_IRQn)
#define DMAREQ_SPI7_RX __APPEND3(DMAREQ_FLEXCOMM,SPI7_FLEXCOMM,_RX)
#define DMAREQ_SPI7_TX __APPEND3(DMAREQ_FLEXCOMM,SPI7_FLEXCOMM,_TX)
#endif
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __SPI_COMMON_5411X_H_ */
| [
"ankitjhall33@gmail.com"
] | ankitjhall33@gmail.com |
93aabd81aeb654a4f0c98886f687b127b3124af7 | 3d0de0f2549d9025540fcec88624c72c079b406f | /BSW/src/bsw/gen/CanIf/src/CanIf_TriggerTransmit.c | 86228e4eb3c6f75359a840610685dce687fba441 | [] | no_license | ongbut999/Jenkins_Test | ee19936e1577bd93d2755d21299ed3fbec553db6 | abb74480c4ce938dd1c7463627c4074071580af4 | refs/heads/master | 2023-06-23T21:26:57.794427 | 2021-07-22T08:05:20 | 2021-07-22T08:05:20 | 388,372,287 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,714 | c |
/*
***************************************************************************************************
* Includes
***************************************************************************************************
*/
#include "CanIf_Prv.h"
/*
***************************************************************************************************
* used functions
***************************************************************************************************
*/
#if (CANIF_TRIGGERTRANSMIT_SUPPORT == STD_ON)
#define CANIF_START_SEC_CODE
#include "CanIf_MemMap.h"
Std_ReturnType CanIf_TriggerTransmit(PduIdType TxPduId, PduInfoType* PduInfoPtr)
{
VAR (Std_ReturnType, AUTOMATIC ) lRetVal_en = E_NOT_OK;
#if (CANIF_CFG_TX_FEATURE_ENABLED== STD_ON)
/* Pointer to Tx Pdu configuration */
P2CONST(CanIf_Cfg_TxPduConfig_tst, AUTOMATIC, CANIF_CFG_CONST) lTxPduConfig_pst;
VAR(uint16, AUTOMATIC) ltxPduCustId_t;
/* If CAN Interface is uninitialized, report to DET and return E_NOT_OK */
CANIF_DET_REPORT_ERROR_NOT_OK((FALSE == CanIf_Prv_InitStatus_b), CANIF_TRIGGER_TRANSMIT_SID, CANIF_E_UNINIT)
ltxPduCustId_t = CanIf_Prv_ConfigSet_tpst->TxPduIdTable_Ptr[TxPduId];
lTxPduConfig_pst = (CanIf_Prv_ConfigSet_tpst->CanIf_TxPduConfigPtr) + ltxPduCustId_t; /*TxPduId passed is always valid as it is sent by Canif to Can*/
if(lTxPduConfig_pst->TxPduTriggerTransmit == TRUE)
{
if(NULL_PTR != lTxPduConfig_pst->UserTriggerTransmit)
{
lRetVal_en = lTxPduConfig_pst->UserTriggerTransmit(TxPduId, PduInfoPtr);
}
}
#endif
return lRetVal_en;
}
#define CANIF_STOP_SEC_CODE
#include "CanIf_MemMap.h"
#endif
| [
"fixed-term.Truong.HuynhQuang@vn.bosch.com"
] | fixed-term.Truong.HuynhQuang@vn.bosch.com |
96863f5fae2e7c1f7dfa5b94409f7f243208783b | d683b22f6b58a5c29350ab8088215f246bf2d184 | /admission criteria.c | ece3c24b9ce1570bc1cfa58e7a1b40c5c44a63fb | [] | no_license | hvn4k/C | ff9517000f669b659398fb7ca92b99c1b5b528a9 | 60b34e2cca333c599b2335dbc7262aa7447bd6aa | refs/heads/main | 2023-06-22T05:43:25.714961 | 2021-05-26T09:21:07 | 2021-05-26T09:21:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 513 | c | #include<stdio.h>
void func(int m , int p , int c)
{
if(m>=65 || p>=55 || c>=50)
{
printf("ADMISSION ACCEPTED");
}
else if(m+p+c>=180)
{
printf("ADMISSION ACCEPTED");
}
else if(m+p>=140)
{
printf("ADMISSION ACCEPTED");
}
else
{
printf("ADMISSION NOT ACCEPTED");
}
}
main()
{
int m,p,c;
printf("Enter marks in Maths");
scanf("%d",&m);
printf("Enter marks in physics");
scanf("%d",&p);
printf("Enter marks in Chemistry");
scanf("%d",&c);
func(m,p,c);
}
| [
"noreply@github.com"
] | hvn4k.noreply@github.com |
9371a19c502fd81fc0b7dc7ba3a570f978387bce | 2dbfaaf469b864698c33e1849059a41b76812659 | /Phase-2-UAV-Experimental-Platform-June/CAmkES_sel4_VM/slang_libraries/SW_Impl_Instance_RADIO_RadioDriver_Attestation/ext/RadioDriver_Attestation_thr_Impl_Impl_api.h | a6e4e89737d16eb2cc01304a919ce3bc1dcc3c8c | [] | no_license | loonwerks/case-ta6-experimental-platform-models | e12b92aced4841cb6b785718e9af4c8da9a370b6 | fe273e2fdbac92b3553a9e9dbf6d5738a5431e17 | refs/heads/master | 2022-01-20T18:11:30.444037 | 2022-01-10T17:08:21 | 2022-01-10T17:12:13 | 171,710,829 | 0 | 2 | null | 2021-01-27T20:05:53 | 2019-02-20T16:39:34 | C | UTF-8 | C | false | false | 110 | h | ../../../../hamr/src/c/ext-c/RadioDriver_Attestation_thr_Impl_Impl/RadioDriver_Attestation_thr_Impl_Impl_api.h | [
"egm@cs.byu.edu"
] | egm@cs.byu.edu |
519ccb0190db14fef617c8af9e2ac59b57620731 | bcddcbd49bfc9101c05640525b0f32b60ffa0562 | /libft/ft_isdigit.c | 20e45149f1e564b42b8bdc98b716c2f72d9c5853 | [] | no_license | arodiono/lem-in | 16169ba9955fb6742d00328b1ac2848847e3198d | 9bae77270ae51a636f3b365fe9d7a4295c8416d5 | refs/heads/master | 2021-01-25T10:56:30.218627 | 2017-06-09T21:15:52 | 2017-06-09T21:15:52 | 93,897,258 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 978 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_isdigit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: arodiono <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/23 16:53:27 by arodiono #+# #+# */
/* Updated: 2016/11/23 16:57:35 by arodiono ### ########.fr */
/* */
/* ************************************************************************** */
int ft_isdigit(int ch)
{
if (ch > 47 && ch < 58)
return (1);
else
return (0);
}
| [
"arodiono@e1r5p7.unit.ua"
] | arodiono@e1r5p7.unit.ua |
ead92b80700b8e7be1df60ae3c6d85de32e8d348 | bb45f01aa5b26d4c7640528eacbd39932bdfca13 | /applications/rmsd/src/server/server.c | 18417afac4b5055c54ce54736be95ac306c6ee2f | [] | no_license | BGCX067/f2f-hg-to-git | f8d17ecc95a0b72eb67505db96216a24d5d477e1 | 4655aa5d6983c0c8716f3ad9e8ca0b6805a67d30 | refs/heads/master | 2016-09-01T08:52:34.881547 | 2012-01-13T02:23:59 | 2012-01-13T02:23:59 | 48,871,771 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,297 | c | /*
server.c:
Copyright (C) 2011 Martin Ramiro Gioiosa, FuDePAN
This file is part of the F2F project.
F2F is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
F2F 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 F2F. If not, see <http://www.gnu.org/licenses/>.
NOTE: This file is in prototype stage, and is under active development.
*/
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <errno.h>
#include <netinet/in.h>
#include <unistd.h>
#include <stdlib.h>
/**** OWN HEADERS ****************************/
#include "arithmetic.h"
#include "communication.h"
#include "types.h"
#include "endianTool.h"
#include "socketTool.h"
#include "rmsdCalc.h"
/*********************************************/
static void process_packet(BufferClient* inpacket, BufferServer* outpacket)
{
const size_t sizeOfStructures = inpacket->numberOfCoords * 3 * sizeof(FloatType);
char* pointer_first_element = inpacket->data;
char* pointer_last_element = inpacket->data + sizeOfStructures * (inpacket->numberOfStructs - 1);
FloatType* pointer_results = (FloatType*)outpacket->data;
size_t numberOfResults = 0;
char* it1;
for (it1 = pointer_first_element; it1 < pointer_last_element; it1 += sizeOfStructures)
{
char* it2;
for (it2 = it1 + sizeOfStructures; it2 <= pointer_last_element; it2 += sizeOfStructures)
{
*pointer_results = rmsd_to((Coord3d*)it1, (Coord3d*)it2, inpacket->numberOfCoords);
++pointer_results;
++numberOfResults;
}
}
outpacket->numberOfResults = numberOfResults;
}
int main(void)
{
const int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
if (sock == -1)
{
printf ("Error creating socket\n");
exit(EXIT_FAILURE);
}
struct sockaddr_in sa;
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = INADDR_ANY;
sa.sin_port = htons(PORT);
socklen_t address_len = sizeof(sa);
const int b = bind(sock, (struct sockaddr*)&sa, sizeof(sa));
if (b == -1)
{
printf("Error bind failed\n");
close(sock);
exit(EXIT_FAILURE);
}
/* PREPARE FOR INCOMING CONNECTION */
const int list = listen(sock, 1);
if (list == -1)
{
printf("Error list failed\n");
close(sock);
exit(EXIT_FAILURE);
}
/***********************************/
BufferClient buffer_in;
BufferServer buffer_out;
while (1)
{
/* WAIT FOR CONNECT CLIENT */
printf ("Waiting for client...\n");
const int sock_client = accept(sock, (struct sockaddr*)&sa, &address_len);
if (sock_client == -1)
{
printf("Error accepting client\n");
}
/***************************/
/* WAIT TO RECEIVE A PACKET */
const int read = read_socket(sock_client, (char*)&buffer_in, LENGHT_BUFFER);
if (read == -1)
{
printf("Error receiving packet\n");
}
/****************************/
/* CONVERT */
endian_buffer_client(&buffer_in, networkToHost);
/***********/
/* PROCESS THE PACKET */
process_packet(&buffer_in, &buffer_out);
/**********************/
/* CONVERT */
endian_buffer_server(&buffer_out, hostToNetwork);
/***********/
/* SEND RESULTS */
const int write = write_socket(sock_client, (char*)&buffer_out, LENGHT_BUFFER);
if (write == -1)
{
printf("Error sending packet\n");
}
/****************/
/* END OF COMMUNICATION */
const int shutdn = shutdown(sock_client, SHUT_RDWR);
if (shutdn == -1)
{
printf("Error shutting down\n");
}
/****************/
}
return EXIT_SUCCESS;
}
| [
"giomartinr@gmail.com"
] | giomartinr@gmail.com |
723e17d307a937d2a0b8fbcd4834e76b8bde5d40 | 91ddd17e771f99cd4eb5acec6e9127f2acb833d6 | /C-algorithm/ProgrammingPearls/maxSumOfSubsequence/maxSequence_2.c | cee643333950f4be8a7377b4eb28008f864a6184 | [] | no_license | jabc1/ProgramLearning | 8a5a7d174e9cf6b1d0672704effa8c320380442e | 90684a7f5fa76b784375b258658396c9f23f2314 | refs/heads/master | 2020-05-17T08:38:00.222995 | 2018-03-11T14:37:30 | 2018-03-11T14:37:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,021 | c | /**
最大子序列求和
时间复杂度:O(n^2)
*/
int maxSequence(int *arr, int n){
int maxSum = 0;
int currentSum = 0;
for (int i = 0; i < n; i++){
currentSum = 0;
for (int j = i; j < n; j++){ // 必须有等于号
currentSum += arr[j];
if (maxSum < currentSum){
maxSum = currentSum;
}
}
}
return maxSum;
}
/********************** 第二种方法 *********************/
int maxSequence(int *arr, int n){
if (arr == NULL || n < 1){
return -1; // invalid arguments
}
int *cumarr = (int *)malloc(n * sizeof(int));
cumarr[0] = arr[0];
for (int i = 1; i < n; i++){
cumarr[i] = cumarr[i-1] + arr[i];
} // partial_sum
int maxSum = arr[0];
int currentSum = 0;
for (int i = 0; i < n; i++){
for (int j = i; j < n; j++){
if (i == 0){
currentSum = cumarr[j] - 0;
}
else{
currentSum = cumarr[j] - cumarr[i-1];
}
if (maxSum < currentSum){
maxSum = currentSum;
}
}
}
return maxSum;
} | [
"ywangsh2014@sina.com"
] | ywangsh2014@sina.com |
1ab6078efe73ef412931f3ea46d4b43180afd40b | e81220623f8e27b9df4364cd41cd63ed0edf9d72 | /NavigationDG/jni/3rdParty/fftw3/dft/scalar/codelets/t2_4.c | 75a1fa2547ed0d038a03aebcafea77b6938909a2 | [
"Apache-2.0"
] | permissive | jwietrzykowski/DiamentowyGrant | f04514812e7e4f46815f073e3df3820d5f7501cd | 490470eff4cacc04102109e25a17044da8273c89 | refs/heads/master | 2021-05-30T03:49:11.013568 | 2015-09-16T11:04:29 | 2015-09-16T11:04:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,367 | c | /*
* Copyright (c) 2003, 2007-8 Matteo Frigo
* Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Sun Jul 12 06:37:48 EDT 2009 */
#include "../../codelet-dft.h"
#ifdef HAVE_FMA
/* Generated by: ../../../genfft/gen_twiddle -fma -reorder-insns -schedule-for-pipeline -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 4 -name t2_4 -include t.h */
/*
* This function contains 24 FP additions, 16 FP multiplications,
* (or, 16 additions, 8 multiplications, 8 fused multiply/add),
* 33 stack variables, 0 constants, and 16 memory accesses
*/
#include "../t.h"
static void t2_4(float *ri, float *ii, const float *W, stride rs, INT mb, INT me, INT ms)
{
INT m;
for (m = mb, W = W + (mb * 4); m < me; m = m + 1, ri = ri + ms, ii = ii + ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) {
E Ti, Tq, To, Te, Ty, Tz, Tm, Ts;
{
E T2, T6, T3, T5;
T2 = W[0];
T6 = W[3];
T3 = W[2];
T5 = W[1];
{
E T1, Tx, Td, Tw, Tj, Tl, Ta, T4, Tk, Tr;
T1 = ri[0];
Ta = T2 * T6;
T4 = T2 * T3;
Tx = ii[0];
{
E T8, Tb, T7, Tc;
T8 = ri[WS(rs, 2)];
Tb = FNMS(T5, T3, Ta);
T7 = FMA(T5, T6, T4);
Tc = ii[WS(rs, 2)];
{
E Tf, Th, T9, Tv, Tg, Tp;
Tf = ri[WS(rs, 1)];
Th = ii[WS(rs, 1)];
T9 = T7 * T8;
Tv = T7 * Tc;
Tg = T2 * Tf;
Tp = T2 * Th;
Td = FMA(Tb, Tc, T9);
Tw = FNMS(Tb, T8, Tv);
Ti = FMA(T5, Th, Tg);
Tq = FNMS(T5, Tf, Tp);
}
Tj = ri[WS(rs, 3)];
Tl = ii[WS(rs, 3)];
}
To = T1 - Td;
Te = T1 + Td;
Ty = Tw + Tx;
Tz = Tx - Tw;
Tk = T3 * Tj;
Tr = T3 * Tl;
Tm = FMA(T6, Tl, Tk);
Ts = FNMS(T6, Tj, Tr);
}
}
{
E Tn, TA, Tu, Tt;
Tn = Ti + Tm;
TA = Ti - Tm;
Tu = Tq + Ts;
Tt = Tq - Ts;
ii[WS(rs, 3)] = TA + Tz;
ii[WS(rs, 1)] = Tz - TA;
ri[0] = Te + Tn;
ri[WS(rs, 2)] = Te - Tn;
ri[WS(rs, 1)] = To + Tt;
ri[WS(rs, 3)] = To - Tt;
ii[WS(rs, 2)] = Ty - Tu;
ii[0] = Tu + Ty;
}
}
}
static const tw_instr twinstr[] = {
{TW_CEXP, 0, 1},
{TW_CEXP, 0, 3},
{TW_NEXT, 1, 0}
};
static const ct_desc desc = { 4, "t2_4", twinstr, &fftwf_dft_t_genus, {16, 8, 8, 0}, 0, 0, 0 };
void fftwf_codelet_t2_4 (planner *p) {
fftwf_kdft_dit_register (p, t2_4, &desc);
}
#else /* HAVE_FMA */
/* Generated by: ../../../genfft/gen_twiddle -compact -variables 4 -pipeline-latency 4 -twiddle-log3 -precompute-twiddles -n 4 -name t2_4 -include t.h */
/*
* This function contains 24 FP additions, 16 FP multiplications,
* (or, 16 additions, 8 multiplications, 8 fused multiply/add),
* 21 stack variables, 0 constants, and 16 memory accesses
*/
#include "../t.h"
static void t2_4(float *ri, float *ii, const float *W, stride rs, INT mb, INT me, INT ms)
{
INT m;
for (m = mb, W = W + (mb * 4); m < me; m = m + 1, ri = ri + ms, ii = ii + ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) {
E T2, T4, T3, T5, T6, T8;
T2 = W[0];
T4 = W[1];
T3 = W[2];
T5 = W[3];
T6 = FMA(T2, T3, T4 * T5);
T8 = FNMS(T4, T3, T2 * T5);
{
E T1, Tp, Ta, To, Te, Tk, Th, Tl, T7, T9;
T1 = ri[0];
Tp = ii[0];
T7 = ri[WS(rs, 2)];
T9 = ii[WS(rs, 2)];
Ta = FMA(T6, T7, T8 * T9);
To = FNMS(T8, T7, T6 * T9);
{
E Tc, Td, Tf, Tg;
Tc = ri[WS(rs, 1)];
Td = ii[WS(rs, 1)];
Te = FMA(T2, Tc, T4 * Td);
Tk = FNMS(T4, Tc, T2 * Td);
Tf = ri[WS(rs, 3)];
Tg = ii[WS(rs, 3)];
Th = FMA(T3, Tf, T5 * Tg);
Tl = FNMS(T5, Tf, T3 * Tg);
}
{
E Tb, Ti, Tn, Tq;
Tb = T1 + Ta;
Ti = Te + Th;
ri[WS(rs, 2)] = Tb - Ti;
ri[0] = Tb + Ti;
Tn = Tk + Tl;
Tq = To + Tp;
ii[0] = Tn + Tq;
ii[WS(rs, 2)] = Tq - Tn;
}
{
E Tj, Tm, Tr, Ts;
Tj = T1 - Ta;
Tm = Tk - Tl;
ri[WS(rs, 3)] = Tj - Tm;
ri[WS(rs, 1)] = Tj + Tm;
Tr = Tp - To;
Ts = Te - Th;
ii[WS(rs, 1)] = Tr - Ts;
ii[WS(rs, 3)] = Ts + Tr;
}
}
}
}
static const tw_instr twinstr[] = {
{TW_CEXP, 0, 1},
{TW_CEXP, 0, 3},
{TW_NEXT, 1, 0}
};
static const ct_desc desc = { 4, "t2_4", twinstr, &fftwf_dft_t_genus, {16, 8, 8, 0}, 0, 0, 0 };
void fftwf_codelet_t2_4 (planner *p) {
fftwf_kdft_dit_register(p, t2_4, &desc);
}
#endif /* HAVE_FMA */
| [
"michalsminowicki@gmail.com"
] | michalsminowicki@gmail.com |
cf0612c57b36d6c3644efc482aac3bd55cf2ddac | 9a3b9d80afd88e1fa9a24303877d6e130ce22702 | /src/Providers/UNIXProviders/StorageRelocationService/UNIX_StorageRelocationServicePrivate.h | 9d7da4ab60cb56f61e80e76b7ba21d841b109555 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers | 3244b76d075bc66a77e4ed135893437a66dd769f | f24c56acab2c4c210a8d165bb499cd1b3a12f222 | refs/heads/master | 2020-04-17T04:27:14.970917 | 2015-01-04T22:08:09 | 2015-01-04T22:08:09 | 19,707,296 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,554 | h | //%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// 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.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
#if defined(PEGASUS_OS_HPUX)
# include "UNIX_StorageRelocationServicePrivate_HPUX.h"
#elif defined(PEGASUS_OS_LINUX)
# include "UNIX_StorageRelocationServicePrivate_LINUX.h"
#elif defined(PEGASUS_OS_DARWIN)
# include "UNIX_StorageRelocationServicePrivate_DARWIN.h"
#elif defined(PEGASUS_OS_AIX)
# include "UNIX_StorageRelocationServicePrivate_AIX.h"
#elif defined(PEGASUS_OS_FREEBSD)
# include "UNIX_StorageRelocationServicePrivate_FREEBSD.h"
#elif defined(PEGASUS_OS_SOLARIS)
# include "UNIX_StorageRelocationServicePrivate_SOLARIS.h"
#elif defined(PEGASUS_OS_ZOS)
# include "UNIX_StorageRelocationServicePrivate_ZOS.h"
#elif defined(PEGASUS_OS_VMS)
# include "UNIX_StorageRelocationServicePrivate_VMS.h"
#elif defined(PEGASUS_OS_TRU64)
# include "UNIX_StorageRelocationServicePrivate_TRU64.h"
#else
# include "UNIX_StorageRelocationServicePrivate_STUB.h"
#endif
| [
"brunolauze@msn.com"
] | brunolauze@msn.com |
95e6949088651e36b7b514e5ef9004f89e7e7752 | 496db11ab732538b6d7f486a3afc3c5593abebc9 | /src/guide/FUSION.H | c0e682d8bc2094bff947791b14694047521a68ea | [] | no_license | luckialuo/4rotor | 74502a86640e4ae324d9d625ed220246ed2df335 | f1993832fd3e32b29949cfff1bd772088a266ca1 | refs/heads/code | 2021-01-10T07:37:07.587922 | 2016-03-26T14:25:00 | 2016-03-26T14:25:00 | 54,782,318 | 0 | 0 | null | 2016-03-26T14:37:22 | 2016-03-26T14:18:56 | C | GB18030 | C | false | false | 513 | h | #ifndef _FUSION_H_
#define _FUSION_H_
extern FP32 ac_lon, ac_lat; /*[经度/纬度]*/
extern FP32 ac_Vd, /*[地速]*/
ac_psi, /*[真航向][0~360]*/
psi_cat;
extern FP32 ac_height;
extern INT32S info_alt; /*[高度信息源]*/
extern INT16S dL_mix0, dZ_mix0;
void fusion_refresh_gps(FP32 lon, FP32 lat, FP32 psi);
void fusion_guide(void);
void fusion_slow(void);
#endif
| [
"luckialuo@gmail.com"
] | luckialuo@gmail.com |
b5241295a36ced51dc6cf50d3ecc9b7eaf3f2140 | d4f05d3ce52560b8b91c9ba96f6c6f7324af3314 | /main.c | 125ab966fbc379db7457e030c5f9f57510e91810 | [] | no_license | matheyal/NF16-ABR | 04a559728aa438f586cf05398a61dce451b0d55a | adf5b6018a5c54032eb1621d477dcf5ae1bc323b | refs/heads/master | 2021-01-01T05:53:59.715354 | 2015-04-01T14:27:41 | 2015-04-01T14:27:41 | 28,718,026 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 5,694 | c | #include "liste.h"
#include "arbre.h"
#include "outils.h"
//outil.c : pb main 6 : avec certains mot.
int main()
{
printf("Bonjour !\n\n");
/*Variables utilisées pour gérer le menu et les appels de fonction*/
int choix, mots_lus, fichier_charge=0;
char* filename=(char*)malloc(200*sizeof(char));
char* filename2=(char*)malloc(200*sizeof(char));
char* mot=(char*)malloc(50*sizeof(char));
char* mot1=(char*)malloc(50*sizeof(char));
char* mot2=(char*)malloc(50*sizeof(char));
ArbreBR* a=NULL;
/*Affichage de l'en-tete du programme */
printf("\tBienvenue dans votre programme de classement alphabetique de texte\n\n");
while(1)
{
printf("Menu principal : Veuillez choisir une fonction a effectuer \n");
printf("\t1 - Creer un arbre binaire de recherche\n");
printf("\t2 - Charger un fichier dans l'ABR\n");
printf("\t3 - Afficher les caracteristiques de l'ABR\n");
printf("\t4 - Afficher tous les mots distincts de l'ABR par ordre alphabetique\n");
printf("\t5 - Rechercher un mot dans l'ABR\n");
printf("\t6 - Afficher les phrases contenant les 2 mots saisis\n");
printf("\t7 - Afficher un fichier ligne par ligne\n");
printf("\t8 - Quitter le programme\n");
scanf("%d", &choix);
switch (choix)
{
/*Création ABR*/
case 1:
a=creer_abr();
if (a!=NULL) printf("Arbre cree !\n\n");
else
printf("Erreur de création de l'arbre.\n\n");
break;
/*Charger un fichier*/
case 2:
if (a!=NULL)
{
printf("Veuillez saisir le fichier a charger en chemin relatif ou absolu : ");
scanf("%s",filename);
mots_lus=charger_fichier(a,filename);
if (mots_lus==-1) printf("Veuillez verifier votre saisie de chemin.\n\n");
else
{
fichier_charge=1;
if(mots_lus==0) printf("Aucun mot n'a pu etre lu !\n\n");
else
printf("%d mots ont ete lus dans le fichier !\n\n",mots_lus);
}
}
else
printf("Impossible ! Arbre non cree !\n\n");
break;
/*Afficher caractériqtiques ABR*/
case 3:
if (a!=NULL)
{
printf("Nombre de mots total : %d\nNombre de noeuds : %d\nProfondeur de l'arbre : %d\n",a->nb_mots_total,a->nb_mots_differents,hauteur_arbre(a));
if (est_equilibre(a->racine)) printf("Arbre equilibre.\n\n");
else
printf("Arbre non equilibre.\n\n");
}
else
printf("Impossible ! Arbre non cree !\n\n");
break;
/*Afficher mots distincts*/
case 4:
if (a!=NULL)
{
afficher_arbre(*a);
printf("\n");
}
else
printf("Impossible ! Arbre non cree !\n\n");
break;
/*Rechercher un mot*/
case 5:
if (a!=NULL)
{
printf("\nVeuillez saisir le mot a rechercher : ");
scanf("%s",mot);
mot2=StringToLower(mot);
char* nom1 = (char*)malloc(strlen(mot2));
memcpy(nom1, mot2, strlen(mot2)+1);
NoeudABR* x=rechercher_noeud(a,nom1);
afficher_position(x);
}
else
printf("Impossible ! Arbre non cree !\n\n");
break;
/*Recherche de phrase à partir de 2 mots*/
case 6:
if (a!=NULL)
{
if(fichier_charge)
{
printf("Veuillez saisir les mots recherches : ");
scanf("%s %s",mot, mot1);
afficher_phrases(a,mot,mot1,filename);
}
else
printf("Impossible ! Aucun fichier charge dans l'ABR.\n\n");
}
else
{
printf("Impossible ! Arbre non cree.\n\n");
}
break;
/*Affichage d'un fichier texte */
case 7:
printf("Veuillez saisir le fichier a afficher en chemin relatif ou absolu : ");
scanf("%s",filename2);
afficher_fichier(filename2);
break;
/*Quitter le programme et rendre les allocations */
case 8:
free(filename); free(filename2); free(mot); free(mot1);
free_arbre(a, a->racine);
printf("Au revoir !\n");
return 0;
default:
printf("Commande non reconnue.\n\n");
break;
}
}
}
| [
"alex.mathey78@gmail.com"
] | alex.mathey78@gmail.com |
e959db03dfcb3736ed80c3dccc0a5f0d2a6c349f | caf26a8bb8ffe570e699d9c968c2b447b1f399ba | /firmware/Back_FC/MAVLINK/minimal/mavlink_msg_gps_status.h | d8673bd8688814160361437266db9e9adc5182fe | [] | no_license | bygreencn/Oldx_fly_controller | d07bfd00b29b6ebe4d1c76cc7eb02240ca6d47aa | 021cd924378f77e56d89289ee5c4e864ea787402 | refs/heads/master | 2020-04-13T08:44:30.883246 | 2018-12-25T14:44:50 | 2018-12-25T14:44:50 | 163,090,609 | 1 | 2 | null | 2018-12-25T14:45:53 | 2018-12-25T14:45:52 | null | UTF-8 | C | false | false | 5,040 | h | // MESSAGE GPS_STATUS PACKING
#ifndef _MAVLINK_MSG_GPS_STATUS_H_
#define _MAVLINK_MSG_GPS_STATUS_H_
#include "../mavlink_helpers.h"
#define MAVLINK_MSG_ID_GPS_STATUS 25
typedef struct __mavlink_gps_status_t
{
uint8_t satellites_visible; /*< Number of satellites visible*/
uint8_t satellite_prn[20]; /*< Global satellite ID*/
uint8_t satellite_used[20]; /*< 0: Satellite not used, 1: used for localization*/
uint8_t satellite_elevation[20]; /*< Elevation (0: right on top of receiver, 90: on the horizon) of satellite*/
uint8_t satellite_azimuth[20]; /*< Direction of satellite, 0: 0 deg, 255: 360 deg.*/
uint8_t satellite_snr[20]; /*< Signal to noise ratio of satellite*/
} mavlink_gps_status_t;
#define MAVLINK_MSG_ID_GPS_STATUS_LEN 101
#define MAVLINK_MSG_ID_25_LEN 101
#define MAVLINK_MSG_ID_GPS_STATUS_CRC 23
#define MAVLINK_MSG_ID_25_CRC 23
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20
#define MAVLINK_MESSAGE_INFO_GPS_STATUS { \
"GPS_STATUS", \
6, \
{ { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \
{ "satellite_prn", NULL, MAVLINK_TYPE_UINT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \
{ "satellite_used", NULL, MAVLINK_TYPE_UINT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \
{ "satellite_elevation", NULL, MAVLINK_TYPE_UINT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \
{ "satellite_azimuth", NULL, MAVLINK_TYPE_UINT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \
{ "satellite_snr", NULL, MAVLINK_TYPE_UINT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \
} \
}
/**
* @brief Pack a gps_status message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param satellites_visible Number of satellites visible
* @param satellite_prn Global satellite ID
* @param satellite_used 0: Satellite not used, 1: used for localization
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
* @param satellite_snr Signal to noise ratio of satellite
* @return length of the message in bytes (excluding serial stream start sign)
*/
uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr);
uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t satellites_visible,const uint8_t *satellite_prn,const uint8_t *satellite_used,const uint8_t *satellite_elevation,const uint8_t *satellite_azimuth,const uint8_t *satellite_snr);
uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status);
uint16_t mavlink_msg_gps_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status);
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr);
#if MAVLINK_MSG_ID_GPS_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
void mavlink_msg_gps_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t satellites_visible, const uint8_t *satellite_prn, const uint8_t *satellite_used, const uint8_t *satellite_elevation, const uint8_t *satellite_azimuth, const uint8_t *satellite_snr);
#endif
#endif
// MESSAGE GPS_STATUS UNPACKING
uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg);
uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, uint8_t *satellite_prn);
uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, uint8_t *satellite_used);
uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, uint8_t *satellite_elevation);
uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, uint8_t *satellite_azimuth);
uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, uint8_t *satellite_snr);
void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status);
#endif /*_xx_h_*/
| [
"golaced@163.com"
] | golaced@163.com |
b44fd3b9a001535f1927033ca48a5be1527afbc9 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/abd0265d-4c43-4805-b898-2b1b1c979923.c | 23953ab547c8114b260ca41cdefa2d94afd81f67 | [] | no_license | nmharmon8/Deep-Buffer-Overflow-Detection | 70fe02c8dc75d12e91f5bc4468cf260e490af1a4 | e0c86210c86afb07c8d4abcc957c7f1b252b4eb2 | refs/heads/master | 2021-09-11T19:09:59.944740 | 2018-04-06T16:26:34 | 2018-04-06T16:26:34 | 125,521,331 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 608 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=14;
int k;
int l;
k = 53;
l = 64;
k = i/j;
l = i/j;
l = i/j;
l = l/j;
l = k%j;
l = k-j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
int b[69];
int c[47];
a = 0;
while (( a - 1 ) > -1) {
a--;
/* START BUFFER SET */
*((int *)c + ( a - 1 )) = *((int *)b + ( a - 1 ));
/* END BUFFER SET */
//random
}
/* END VULNERABILITY */
//random
printf("%d%d\n",k,l);
return 0;
}
| [
"nharmon8@gmail.com"
] | nharmon8@gmail.com |
0fb33c31617130aca08fba96332d0338ab13c50c | fa19a9c2e6ca05a67ebb4bf5b1dfa1b00f90fe3b | /src/h4_path_hpm.h | 585c025e4349f1ec49f9a10b4439f06ab54663cc | [] | no_license | gwwilburn/HPMHomology | 95aa73cfdd9d29db58831b33521814b3143b897f | 5b6725bbf29b431983fd581e4b03d2e64cdc1bf0 | refs/heads/master | 2022-12-17T23:53:04.277739 | 2020-09-16T21:58:46 | 2020-09-16T21:58:46 | 127,052,587 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 553 | h | /* h4_path_hpm.h*/
/* Grey's functions with h4 paths */
#ifndef h4PATHHPM_INCLUDED
#define h4PATHHPM_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "easel.h"
#include "esl_alphabet.h"
#include "esl_msa.h"
#include "h4_config.h"
#include "h4_mode.h"
#include "h4_profile.h"
#include "h4_path.h"
extern int h4_path_FromMSA(ESL_MSA *msa, int8_t *matassign, int optflags, H4_PATH **pi);
extern int h4_path_DumpAnnotated(FILE *fp, const H4_PATH *pi, const H4_PROFILE *hmm, const H4_MODE *mo, const ESL_DSQ *dsq);
#endif
| [
"wilburn@g.harvard.edu"
] | wilburn@g.harvard.edu |
0607cf2828108a7cebc58f556610ed3b27a33c22 | 3636d82c2e754fbd60c6e1b48387165ecde79726 | /C_Plus/Learning_C/NUMTST.C | 6df0e709e530d52dc0ea6a0a9ae46109b8b0a1db | [
"MIT"
] | permissive | MCLifeLeader/MiscProjects | 2762fa69ea55a91cc668e7be7e29b178ed6fa6c1 | 335d7dc0f5819e4aff19860a71d65653aecee2d6 | refs/heads/master | 2023-08-04T22:08:32.016662 | 2023-07-08T05:53:45 | 2023-07-08T05:53:45 | 115,904,264 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 415 | c |
#include "stdio.h"
main()
{
int s, w, x, y, z;
unsigned char inpt;
w = 0;
do {
w++;
if(w>=255) {
w = 0;
}
inpt = w;
printf("%d\n", inpt);
x = ((w+x+y)/3)+z;
inpt = x;
printf("%d\n", inpt);
y = ((w+x+y)/3)+x;
inpt = y;
printf("%d\n", inpt);
z = ((w+x+y)/3)+y;
inpt = z;
printf("%d\n", inpt);
} while(s != 1);
}
| [
"kb7ppb@hotmail.com"
] | kb7ppb@hotmail.com |
44759bdeaa2eda0de230f4b81e3d7455c8e36d0c | a5bb874436a5238fc94e13ad900e6107dad92330 | /examples/eeprom/eeprom-test.c | e543d4feaf3fe6a5c3382d763557ebe23c602a96 | [] | no_license | nikhilpnarang/sprinkio-atmel-firmware | 683f1865a7c192738b33db531424b17ab929c4dc | 4edec2d823e12ada7248e25d364a5ea382c87b30 | refs/heads/master | 2021-06-14T19:37:46.523575 | 2017-01-12T19:50:44 | 2017-01-12T19:50:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 366 | c | #include "../../sprinkio.h"
uint8_t EEMEM testInteger = 30;
int main() {
uint8_t SRAMchar = eeprom_read_byte(&testInteger);
_delay_ms(1000); // allow time for data transfer
sei(); // enable global interrupts
usart_init(); // enable usart connections
write_rs232_s("\r\nRandom Variable: ");
write_rs232_int(SRAMchar);
_delay_ms(1000);
return 0;
} | [
"nikhilnarang@Nikhils-MacBook.local"
] | nikhilnarang@Nikhils-MacBook.local |
f234d2a5cd7973325b8c1b57ee1768a11488a6c2 | ff68c5e9516bba84ad4398e0094f0385ec738661 | /hq_source_code/013_test_rd_wr/rd_wr.c | dad377ae0cd255d9bf5fe101a434cd65215868ee | [] | no_license | 007skyfall/itop_4412_driver | 28e889fb3feaa0248b976c45e3729b2c6e5e359c | 8c19cfac84ea9573fdcff16b068355e8030277b0 | refs/heads/master | 2020-05-07T17:30:54.996804 | 2019-04-14T01:59:10 | 2019-04-14T01:59:10 | 180,729,593 | 1 | 2 | null | null | null | null | GB18030 | C | false | false | 1,931 | c | #include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#define NAME "rd_wr_demo"
#define MAX 64
char ker_buf[MAX] = {0};
/*
1.模块三要素
2.字符框架相关
2.1 申请设备号
2.2 cdev申请
2.3 cdev初始化
2.4 cdev注册
*/
ssize_t demo_read(struct file *file, char __user *user, size_t size, loff_t *loff)
{
if(size > MAX) size = MAX;
//unsigned long copy_to_user(void *to, const void __user *from, unsigned long n)
if(raw_copy_to_user(user,ker_buf,size)){
printk("copy_to_user fail...%s,%d\n",__func__,__LINE__);
return -EAGAIN;
}
printk("%s,%d\n",__func__,__LINE__);
return size;
}
ssize_t demo_write(struct file *file, const char __user *user ,size_t size, loff_t *loff)
{
if(size > MAX) size = MAX;
//unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
if(raw_copy_from_user(ker_buf,user,size)){
printk("copy_from_user fail...%s,%d\n",__func__,__LINE__);
return -EAGAIN;
}
printk("%s,%d\n",__func__,__LINE__);
return size;
}
int demo_open (struct inode *inode, struct file *file)
{
printk("%s,%d\n",__func__,__LINE__);
return 0;
}
int demo_close (struct inode *inode, struct file *file)
{
printk("%s,%d\n",__func__,__LINE__);
return 0;
}
int major = 0 , minor = 0;
struct file_operations f_ops = {
.owner = THIS_MODULE,
.open = demo_open,
.release = demo_close,
.read = demo_read,
.write = demo_write,
};
int __init demo_init(void)
{
major = register_chrdev(major,NAME,&f_ops);
if(major < 0){
printk("register_chrdev fail ...%s,%d\n",__func__,__LINE__);
return -EINVAL;
}
printk("major :%d \t %s,%d\n",major ,__func__,__LINE__);
return 0;
}
void __exit demo_exit(void)
{
unregister_chrdev(major,NAME);
printk("%s,%d\n",__func__,__LINE__);
}
module_init(demo_init);
module_exit(demo_exit);
MODULE_LICENSE("GPL");
| [
"565911459@qq.com"
] | 565911459@qq.com |
f61efdf3e7d13023c1dcd7a6b0b33646224ba264 | f3a5d435414b7389f0e3ac72f2ccd28d7a4911e4 | /src/mx_print.c | 3f3dfb9c5121474cb4b2da1354183877319564b2 | [] | no_license | zeromotivat1on/ush | 1a794c7abd8c7bd8ebc8ed8bc56e8f0527108110 | cfae0103030163ce9fc409a6cc3f4a6f105387a2 | refs/heads/master | 2023-03-06T15:33:56.449353 | 2021-02-22T12:20:59 | 2021-02-22T12:20:59 | 329,904,735 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,471 | c | #include "ush.h"
void mx_print_color(char *macros, char *str) {
mx_printstr(macros);
mx_printstr(str);
mx_printstr(RESET);
}
void mx_print_strarr_in_line(char **result, const char *delim) {
if (!result || !delim) {
return;
}
if (result[0] == NULL) {
mx_printstr("NULL\n");
}
for (int i = 0; result[i]; i++) {
mx_printstr(result[i]);
mx_printstr(delim);
if (result[i + 1] == NULL){
mx_printstr("NULL\n");
}
}
}
bool mx_parse_error(char *str, int k) {
mx_printerr("ush: parse error near `");
write(2, str, k);
mx_printerr("\'\n");
return true;
}
bool mx_unmached_error(char c) {
if (c == '\"' || c == '\'') {
mx_printerr("Odd number of quotes.\n");
return true;
}
else {
mx_printerr("Unmatched ");
write(2, &c, 1);
mx_printerr(".\n");
return true;
}
}
char *mx_syntax_error(char *str) {
mx_printerr("ush: syntax error near unexpected token `");
mx_printerr(str);
mx_printerr("'\n");
return NULL;
}
static char *get_delim_from_type(int t) {
if (t == SEP) {
return mx_strdup(";");
}
else if (t == FON) {
return mx_strdup("&");
}
else if (t == R_OUTPUT) {
return mx_strdup(">");
}
else if (t == OR) {
return mx_strdup("||");
}
else if (t == AND) {
return mx_strdup("&&");
}
else if (t == PIPE) {
return mx_strdup("|");
}
else if (t == R_INPUT) {
return mx_strdup("<");
}
else if (t == R_OUTPUT_DBL) {
return mx_strdup(">>");
}
else if (t == R_INPUT_DBL) {
return mx_strdup("<<");
}
return NULL;
}
Abstract *mx_parse_error_ush(int t, Abstract *ast_res, char *str) {
char *delim;
if (t != SEP) {
delim = get_delim_from_type(t);
mx_printerr("ush: parse error near `");
write(2, delim, mx_strlen(delim));
mx_strdel(&delim);
mx_printerr("\'\n");
}
mx_ast_clear_list(&ast_res);
mx_strdel(&str);
return NULL;
}
static void print_all(char *command, char *error, char arg) {
mx_printerr("ush: ");
mx_printerr(command);
mx_printerr(": -");
mx_printerr(&arg);
mx_printerr(": invalid option\n");
mx_printerr(command);
mx_printerr(": usage: ");
mx_printerr(command);
mx_printerr(error);
mx_printerr(" \n");
}
int mx_count_options(char **args, char *options, char *command, char *error) {
int n_options = 0;
for (int i = 1; args[i] != NULL; i++) {
if (args[i][0] != '-' || strcmp(args[i], "-") == 0) break;
if (strcmp(args[i], "--") == 0) {
n_options++;
break;
}
for (int j = 1; j < mx_strlen(args[i]); j++) {
if(mx_get_char_index(options,args[i][j]) < 0) {
print_all(command, error, args[i][j]);
return -1;
}
}
n_options++;
}
return n_options;
}
static void print_left(Abstract *q) {
for (Abstract *tmp_left = q->left; tmp_left; tmp_left = tmp_left->next) {
mx_printstr("redir == ");
if (tmp_left->type == R_INPUT) mx_printstr("< ");
else if (tmp_left->type == R_INPUT_DBL) mx_printstr("<< ");
else if (tmp_left->type == R_OUTPUT) mx_printstr("> ");
else if (tmp_left->type == R_OUTPUT_DBL) mx_printstr(">> ");
if (tmp_left->args)
mx_print_strarr_in_line(tmp_left->args, " ");
else if (tmp_left->token) {
mx_printstr(q->token);
mx_printstr("\n");
}
}
}
static void print_list(Abstract *parsed_line) {
for (Abstract *q = parsed_line; q; q = q->next) {
mx_printstr("proc == ");
if (q->args)
mx_print_strarr_in_line(q->args, " ");
else if (q->token) {
mx_printstr(q->token);
mx_printstr("\n");
}
if (q->left)
print_left(q);
mx_printstr("delim == ");
mx_printint(q->type);
mx_printstr("\n");
}
}
void mx_ast_print(Abstract **ast) {
char *tmp = NULL;
for (int i = 0; ast[i]; i++) {
mx_print_color(MX_YEL, "job-");
tmp = mx_itoa(i + 1);
mx_print_color(MX_YEL, tmp);
mx_strdel(&tmp);
mx_printstr("\n");
print_list(ast[i]);
}
mx_print_color(MX_YEL, "-----\n");
}
| [
"lyannoy.alexander@gmail.com"
] | lyannoy.alexander@gmail.com |
e329a6d561f98c7ebb6243011394b7451a6e2b48 | 7069cb71852cf1a5995133b1858bab3e46b501f9 | /source/ekernel/drivers/drv/legacy/deviceman/devices/dev.h | 368d04cf99d6cf4e2bdf98d8b8d21bf15c6f04a5 | [] | no_license | lindenis-org/lindenis-v833-RTOS-melis-4.0 | d2646c7093851d45645679a55bcf1462b8d4d18e | 71ab8faeee960e27ef83a9ff2e4ae4b7f33eda20 | refs/heads/master | 2023-06-24T01:40:55.111140 | 2021-07-23T08:01:43 | 2021-07-23T08:09:40 | 388,733,103 | 14 | 13 | null | null | null | null | GB18030 | C | false | false | 2,971 | h | /*
*********************************************************************************************************
* ePOS
* the Easy Portable/Player Operation System
* eMOD sub-system
*
* (c) Copyright 2006-2007, Steven.ZGJ China
* All Rights Reserved
*
* File : devman_private.h
* Version: V1.0
* By : steven.zgj
*********************************************************************************************************
*/
#ifndef __DEV_H__
#define __DEV_H__
#include <typedef.h>
#include <sys_device.h>
#define NODETYPE_CLASS 0x00000000
#define NODETYPE_DEV 0x00000001
#define DEV_STAT_INACTIVE 0x00
#define DEV_STAT_ACTIVE 0x01
typedef struct __DEV_NODE __dev_node_t;
typedef struct __DEV_CLASSNODE __dev_classnode_t;
/* 设备类节点 */
struct __DEV_CLASSNODE
{
__dev_classnode_t *next;
__dev_node_t *nodelist;
int nodetype;
__u8 usedcnt;
char *name;
};
/* 设备节点句柄,此句柄用于保存一个设备各种信息的数据结构 */
struct __DEV_NODE
{
__dev_node_t *next;
__dev_classnode_t *classnode; /* 类节点 */
int attrib;
char *name;
char pletter;
__u32 opentimes; /* 句柄打开的次数 */
__u32 status; /* 节点状态:0表示正常,0xff表示为死节点(驱动程序代码已经卸载)*/
__dev_devop_t DevOp; /* 保存设备操作句柄 */
void *pOpenArg;
__hdle sem;
__hdle hDev; /* 设备句柄 */
};
/*
******************************************************
* 设备节点操作句柄,此句柄用于用户打开一个设备节点时返
* 回的句柄,它不同于设备句柄,它是设备节点的实例,而设
* 备句柄是设备的实例。
******************************************************
*/
typedef struct __DEV_DEV
{
__dev_node_t *devnode; /* 指向设备节点 */
__hdle hDev; /* 设备句柄,直接从__dev_node_t里copy,以方便使用 */
__dev_devop_t DevOp; /* 设备操作入口,直接从__dev_node_t里copy,以方便使用 */
} __dev_dev_t;
#endif //#ifndef __DEV_H__
| [
"given@lindeni.com"
] | given@lindeni.com |
224de462e5906a73e4333232f3c940cdba1b2130 | 4dcf7947fabb231588487532c067c38b822871a8 | /cw04/zad4/zad4b/sender.c | 881d435bf1db2246d6c4d2ffd1ba24538f84668b | [] | no_license | PKopel/Unix-Linux-programming | 7152422594f8ae20c17b7385b1061738ce48860e | 9c4692f40cbdf21ed65d8c1e7d2d27b7ac307184 | refs/heads/master | 2022-10-22T15:14:05.492095 | 2020-06-10T14:10:40 | 2020-06-10T14:10:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,386 | c | #define _XOPEN_SOURCE 700
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
int counter = 0;
pid_t catcher = -1;
void (*send)(int);
int sig1,sig2,confirmation = 0;
void handler(int sig, siginfo_t *info, void *ucontext){
if(sig == sig1){
if(info->si_value.sival_int)
printf("sender received %d-th sig1\n",info->si_value.sival_int);
if(!confirmation) counter++;
} else if(sig == sig2){
printf("sender: %d sig1\n",counter);
counter = -1;
exit(0);
}
confirmation = 0;
return;
}
void send_kill(int num){
for (int i = 0; i < num; i++){
sigset_t new_mask;
sigfillset(&new_mask);
sigdelset(&new_mask,SIGUSR1);
confirmation = 1;
kill(catcher,sig1);
sigsuspend(&new_mask);
}
kill(catcher,sig2);
}
void send_queue(int num){
union sigval number;
for (int i = 0; i < num; i++){
number.sival_int = i+1;
sigset_t new_mask;
sigfillset(&new_mask);
sigdelset(&new_mask,SIGUSR1);
confirmation = 1;
sigqueue(catcher,sig1,number);
sigsuspend(&new_mask);
}
number.sival_int = -1;
sigqueue(catcher,sig2,number);
}
int main(int argc, char** argv){
if(argc != 4) return 22;
catcher = atoi(argv[1]);
int num = atoi(argv[2]);
if(strcmp(argv[3],"KILL") == 0){
send = send_kill;
sig1 = SIGUSR1;
sig2 = SIGUSR2;
} else if (strcmp(argv[3],"SIGQUEUE") == 0){
send = send_queue;
sig1 = SIGUSR1;
sig2 = SIGUSR2;
} else if (strcmp(argv[3],"SIGRT") == 0){
send = send_kill;
sig1 = SIGRTMIN;
sig2 = SIGRTMIN+1;
} else return 22;
struct sigaction new_action;
new_action.sa_sigaction = handler;
sigfillset(&new_action.sa_mask);
new_action.sa_flags = SA_SIGINFO;
if(sigaction(sig1, &new_action, NULL) < 0)
printf("can't catch %d\n",sig1);
if(sigaction(sig2, &new_action, NULL) < 0)
printf("can't catch %d\n",sig2);
if(sigaction(SIGUSR1, &new_action, NULL) < 0)
printf("can't catch SIGUSR1\n");
sigset_t mask;
sigfillset(&mask);
sigdelset(&mask,sig1);
sigdelset(&mask,sig2);
sigprocmask(SIG_SETMASK,&mask,NULL);
send(num);
while(counter >= 0){
pause();
}
return 0;
} | [
"pawel.kopel2@gmail.com"
] | pawel.kopel2@gmail.com |
f75c64978f23f2c316c808a60473f85d8c575085 | 7e41f5263395d119d4fba880fa05022d58324ca5 | /liblinear-2.1/predict.c | 1b5c54715ff1f9cef62a303ce02089bd4f69c392 | [
"BSD-3-Clause"
] | permissive | moulygupta23/MCM-mtp | 93b95a9ed357840eb48a24577d50cf63b1d73242 | 1713e5a84d9269902ae8792d71e6e995c0503c83 | refs/heads/master | 2021-01-21T04:54:00.263144 | 2016-07-01T12:30:17 | 2016-07-01T12:30:17 | 54,060,125 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,337 | c | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "linear.h"
int print_null(const char *s,...) {return 0;}
static int (*info)(const char *fmt,...) = &printf;
struct feature_node *x;
int max_nr_attr = 64;
struct model* model_;
int flag_predict_probability=0;
void exit_input_error(int line_num)
{
fprintf(stderr,"Wrong input format at line %d\n", line_num);
exit(1);
}
static char *line = NULL;
static int max_line_len;
static char* readline(FILE *input)
{
int len;
if(fgets(line,max_line_len,input) == NULL)
return NULL;
while(strrchr(line,'\n') == NULL)
{
max_line_len *= 2;
line = (char *) realloc(line,max_line_len);
len = (int) strlen(line);
if(fgets(line+len,max_line_len-len,input) == NULL)
break;
}
return line;
}
void do_predict(FILE *input, FILE *output)
{
int correct = 0;
int total = 0;
double error = 0;
double sump = 0, sumt = 0, sumpp = 0, sumtt = 0, sumpt = 0;
int nr_class=get_nr_class(model_);
double *prob_estimates=NULL;
int j, n;
int nr_feature=get_nr_feature(model_);
if(model_->bias>=0)
n=nr_feature+1;
else
n=nr_feature;
if(flag_predict_probability)
{
int *labels;
if(!check_probability_model(model_))
{
fprintf(stderr, "probability output is only supported for logistic regression\n");
exit(1);
}
labels=(int *) malloc(nr_class*sizeof(int));
get_labels(model_,labels);
prob_estimates = (double *) malloc(nr_class*sizeof(double));
fprintf(output,"labels");
for(j=0;j<nr_class;j++)
fprintf(output," %d",labels[j]);
fprintf(output,"\n");
free(labels);
}
max_line_len = 1024;
line = (char *)malloc(max_line_len*sizeof(char));
while(readline(input) != NULL)
{
int i = 0;
double target_label, predict_label;
char *idx, *val, *label, *endptr;
int inst_max_index = 0; // strtol gives 0 if wrong format
label = strtok(line," \t\n");
if(label == NULL) // empty line
exit_input_error(total+1);
target_label = strtod(label,&endptr);
if(endptr == label || *endptr != '\0')
exit_input_error(total+1);
while(1)
{
if(i>=max_nr_attr-2) // need one more for index = -1
{
max_nr_attr *= 2;
x = (struct feature_node *) realloc(x,max_nr_attr*sizeof(struct feature_node));
}
idx = strtok(NULL,":");
val = strtok(NULL," \t");
if(val == NULL)
break;
errno = 0;
x[i].index = (int) strtol(idx,&endptr,10);
if(endptr == idx || errno != 0 || *endptr != '\0' || x[i].index <= inst_max_index)
exit_input_error(total+1);
else
inst_max_index = x[i].index;
errno = 0;
x[i].value = strtod(val,&endptr);
if(endptr == val || errno != 0 || (*endptr != '\0' && !isspace(*endptr)))
exit_input_error(total+1);
// feature indices larger than those in training are not used
if(x[i].index <= nr_feature)
++i;
}
if(model_->bias>=0)
{
x[i].index = n;
x[i].value = model_->bias;
i++;
}
x[i].index = -1;
if(flag_predict_probability)
{
int j;
predict_label = predict_probability(model_,x,prob_estimates);
fprintf(output,"%g",predict_label);
for(j=0;j<model_->nr_class;j++)
fprintf(output," %g",prob_estimates[j]);
fprintf(output,"\n");
}
else
{
predict_label = predict(model_,x);
fprintf(output,"%g\n",predict_label);
}
if(predict_label == target_label)
++correct;
error += (predict_label-target_label)*(predict_label-target_label);
sump += predict_label;
sumt += target_label;
sumpp += predict_label*predict_label;
sumtt += target_label*target_label;
sumpt += predict_label*target_label;
++total;
}
if(check_regression_model(model_))
{
info("Mean squared error = %g (regression)\n",error/total);
info("Squared correlation coefficient = %g (regression)\n",
((total*sumpt-sump*sumt)*(total*sumpt-sump*sumt))/
((total*sumpp-sump*sump)*(total*sumtt-sumt*sumt))
);
}
else
info("Accuracy = %g%% (%d/%d)\n",(double) correct/total*100,correct,total);
if(flag_predict_probability)
free(prob_estimates);
}
void exit_with_help()
{
printf(
"Usage: predict [options] test_file model_file output_file\n"
"options:\n"
"-b probability_estimates: whether to output probability estimates, 0 or 1 (default 0); currently for logistic regression only\n"
"-q : quiet mode (no outputs)\n"
);
exit(1);
}
int main(int argc, char **argv)
{
FILE *input, *output;
int i;
// parse options
for(i=1;i<argc;i++)
{
if(argv[i][0] != '-') break;
++i;
switch(argv[i-1][1])
{
case 'b':
flag_predict_probability = atoi(argv[i]);
break;
case 'q':
info = &print_null;
i--;
break;
default:
fprintf(stderr,"unknown option: -%c\n", argv[i-1][1]);
exit_with_help();
break;
}
}
if(i>=argc)
exit_with_help();
input = fopen(argv[i],"r");
if(input == NULL)
{
fprintf(stderr,"can't open input file %s\n",argv[i]);
exit(1);
}
output = fopen(argv[i+2],"w");
if(output == NULL)
{
fprintf(stderr,"can't open output file %s\n",argv[i+2]);
exit(1);
}
if((model_=load_model(argv[i+1]))==0)
{
fprintf(stderr,"can't open model file %s\n",argv[i+1]);
exit(1);
}
x = (struct feature_node *) malloc(max_nr_attr*sizeof(struct feature_node));
do_predict(input, output);
free_and_destroy_model(&model_);
free(line);
free(x);
fclose(input);
fclose(output);
return 0;
}
| [
"moulygupta23@gmail.com"
] | moulygupta23@gmail.com |
8f07dbee6914ea966e7a17f9c878dde87d7c257f | 5bcbe7af06d0e47fa8c95041639e5b43f22e153a | /usr/tools/wpm/conf.h | d9183fd840d633462ff253bf681c41a7af28c061 | [] | no_license | hongbochen/OS-Zero | d19a84591718fe95b622a60ba5578e70853954a5 | a636f512fe31626b6aa463c0f7a635167dee951a | refs/heads/master | 2020-04-05T23:30:01.475181 | 2014-06-24T12:32:12 | 2014-06-24T12:32:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 298 | h | #ifndef __WPM_CONF_H__
#define __WPM_CONF_H__
#define WPMPREWARM 1
#define WPMVECFULL 0
#define WPMPROF 1
#define WPMVEC 0
#define PTHREAD 1
#define WPMDB 0
#define WPMDEBUG 0
#define WPMTRACE 0
#define ZASDB 0
#define WPMWORDSIZE 32
#endif /* __WPM_CONF_H__ */
| [
"tuomoster@gmail.com"
] | tuomoster@gmail.com |
cd2f29d9a3d249ce259828b7c31bc2aacda1a1a9 | ca739813905897c93d7b2bdb8866f93f18186060 | /001HumidtyMonitor/Core/Src/DHT11.c | 51cf855a45100feffbd44f7c88111445a07d4e70 | [] | no_license | 99003199/CortexM4_Embedded | f007b62f1ceaa6685b4bc078816a664c5a614799 | 8743fba4f5d3fb0596d79440c2d425ed96a5ca5e | refs/heads/main | 2022-12-27T06:54:33.958097 | 2020-10-05T11:23:03 | 2020-10-05T11:23:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,570 | c | #include "main.h"
#include <stdint.h>
void Set_Pin_Output (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
}
void Set_Pin_Input (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
}
void DHT11_Start (void)
{
Set_Pin_Output (dht11_GPIO_Port, dht11_Pin);
HAL_GPIO_WritePin (dht11_GPIO_Port, dht11_Pin, DISABLE);
delay(18000);
HAL_GPIO_WritePin(dht11_GPIO_Port, dht11_Pin, ENABLE);
delay(20);
Set_Pin_Input(dht11_GPIO_Port, dht11_Pin);
}
uint8_t DHT11_Check_Response (void)
{
uint8_t Response = 0;
delay (40);
if (!(HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)))
{
delay (80);
if ((HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)))
Response = 1;
else
Response = -1;
}
while ((HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)));
return Response;
}
uint8_t DHT11_Read (void)
{
uint8_t i,j;
for (j=0;j<8;j++)
{
while (!(HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)));
delay (40);
if (!(HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)))
{
i&= ~(1<<(7-j));
}
else
{
i|= (1<<(7-j));
}
while ((HAL_GPIO_ReadPin (dht11_GPIO_Port, dht11_Pin)));
}
return i;
}
| [
"amit.das@ltts.com"
] | amit.das@ltts.com |
89426255b0ddd889d9ebfac0aa89ef5284842875 | 3523b5bae2f818f65275d73780c0bb69f8640249 | /hmcu_timer.h | c63ca16aa6af30b5afee5ed93c25e9c63f249089 | [] | no_license | LucianaMarques/soft_timer | 7ebd2fee22f54641edd6357e22fca0cad7a15d97 | b4b354dd8e7e6670d28bf1d9369d5781fb64e658 | refs/heads/master | 2020-03-28T21:49:09.699040 | 2018-09-23T14:26:48 | 2018-09-23T14:26:48 | 149,184,576 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,500 | h | /**
* @file hmcu_timer.h
*
* @brief Hypothetical MCU Timer register addresses and IRQ handler.
*/
#ifndef __HMCU_TIMER_H__
#define __HMCU_TIMER_H__
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
/*****************************************************************************
* Timer clock frequency.
*****************************************************************************/
#define TIMER_CLK_HZ (1000)
/*****************************************************************************
* Timer register addresses.
*****************************************************************************/
#define TIMER_CTRL_REG_ADDR (&timer_ctrl)
#define TIMER_CNT_REG_ADDR (&timer_cnt)
#define TIMER_RLD_REG_ADDR (&timer_rld)
/*****************************************************************************
* Timer IRQ handler prototype.
*****************************************************************************/
/**
* @brief Timeout IRQ handler.
*
* @details This function will be called by our hypothetical MCU interrupt
* vector when timer countdown reaches zero.
*/
void hmcu_timer_irq_handler(void);
/*****************************************************************************
* For test purposes: variables abstracting hypothetical MCU registers.
*****************************************************************************/
extern uint16_t timer_ctrl;
extern uint16_t timer_cnt;
extern uint16_t timer_rld;
#endif /** __HMCU_TIMER_H__ */
| [
"lucianadacostamarques@gmail.com"
] | lucianadacostamarques@gmail.com |
eb5a3df8f01f18570018bc227655aa5b8ed3b91e | e516aa3fce5fc72bb900de01254f252187252096 | /wolf3d.h | cbbe1305f4c2b991932871108261974fa51119cd | [] | no_license | Ggrybova/Wolf3D | fe604a3cf33b5936c775c8998b7e19df603dc77b | 10bdfcc85d810c3cc4f27b177ec3600ebaf4dfdb | refs/heads/master | 2021-05-13T13:41:50.887397 | 2018-01-08T18:51:20 | 2018-01-08T18:51:20 | 116,714,716 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,377 | h | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* wolf3d.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ggrybova <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/07/14 19:26:51 by ggrybova #+# #+# */
/* Updated: 2017/11/14 13:04:22 by ggrybova ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef WOLF3D_H
# define WOLF3D_H
# define WIDTH 640
# define HEIGHT 480
# include "libft/libft.h"
# include "minilibx_macos/mlx.h"
# include <math.h>
typedef struct s_im
{
int w;
int h;
void *im;
char *addr;
int b_p_p;
int size_l;
int end;
} t_im;
typedef struct s_col
{
int red;
int green;
int blue;
int c;
} t_col;
typedef struct s_mlx
{
void *mlx;
void *win;
int map_width;
int map_height;
int map[24][24];
double px;
double py;
double dx;
double dy;
double plane_x;
double plane_y;
double move_speed;
double rot_speed;
t_im *wall_tex;
t_im image;
double camera;
double ray_px;
double ray_py;
double ray_dx;
double ray_dy;
double dside_x;
double dside_y;
double side_x;
double side_y;
double wall_dist;
int box_x;
int box_y;
int wall;
int side;
int step_x;
int step_y;
int line_height;
int y0;
int y1;
int tex_n;
int tex_x;
int tex_y;
double wall_x;
double fl_wall_x;
double fl_wall_y;
int fl_tex_x;
int fl_tex_y;
int ray_y;
int music;
} t_mlx;
void fill_map(t_mlx *m);
void fill_data(t_mlx *m);
int create_labyrinth(t_mlx *m);
void get_img_color(t_im *tex, int x, int y, t_col *c);
void pixel_coord_img(t_im *img, int x, int y, t_col *c);
void draw_wall(t_mlx *m, int x);
void draw_floor_and_ceil(t_mlx *m, int x);
int hook_func(int key, t_mlx *m);
void *mlx_init();
int hook_func2(t_mlx *m);
#endif
| [
"ggrybova@e3r5p9.unit.ua"
] | ggrybova@e3r5p9.unit.ua |
1f154d18b755c958e9de32cd576abca2612694f0 | 76e7239d2090d861aad90fe25c5fb34860aa5d18 | /src/github.com/moovweb/gokogiri/xml/helper.h | 6dbde9ad5a8151470276dc2c771a18bcf3a1ade7 | [
"MIT"
] | permissive | codygman/movie-availability-api | 085f421820412c7adfdf00c75aecd9057a705855 | e998765466bc59cb558cedcffc31a1e875a8038b | refs/heads/master | 2020-04-20T03:20:19.027432 | 2014-01-08T19:52:29 | 2014-01-08T19:52:29 | 15,745,081 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,220 | h | #ifndef __CHELPER_H__
#define __CHELPER_H__
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/HTMLtree.h>
#include <libxml/HTMLparser.h>
#include <libxml/xmlsave.h>
#include <libxml/xpath.h>
#include <libxml/debugXML.h>
xmlDoc* xmlParse(void *buffer, int buffer_len, void *url, void *encoding, int options, void *error_buffer, int errror_buffer_len);
xmlNode* xmlParseFragment(void* doc, void *buffer, int buffer_len, void *url, int options, void *error_buffer, int error_buffer_len);
xmlNode* xmlParseFragmentAsDoc(void *doc, void *buffer, int buffer_len, void *url, void *encoding, int options, void *error_buffer, int error_buffer_len);
int xmlSaveNode(void *wbuffer, void *node, void *encoding, int options);
void xmlSetContent(void* node, void *content);
xmlDoc* newEmptyXmlDoc();
xmlElementType getNodeType(xmlNode *node);
char *xmlDocDumpToString(xmlDoc *doc, void *encoding, int format);
char *htmlDocDumpToString(xmlDoc *doc, int format);
void xmlFreeChars(char *buffer);
int xmlUnlinkNodeWithCheck(xmlNode *node);
int xmlNodePtrCheck(void *node);
typedef struct XmlBufferContext {
void *obj;
char *buffer;
int buffer_len;
int data_size;
} XmlBufferContext;
#endif //__CHELPER_H__
| [
"codygman.consulting@gmail.com"
] | codygman.consulting@gmail.com |
1333074ef47ef099b416a615062366b52e3eb099 | 1744185a1e318fd0705b7c8d71635966bf2f7451 | /template/lib/Projects/STM324xG_EVAL/Examples/FSMC/FSMC_SRAM_DataMemory/Src/stm32f4xx_it.c | 4322586785c2bd59aeb8d68244afd9b3b24b7626 | [
"BSD-2-Clause",
"MIT"
] | permissive | swedishhat/stm32f4-bear-metal | 99554444acc611433190b00599d5be9ebbcbac49 | 04c8ae72ee6ea658dc376afe64f7f3a47c67512b | refs/heads/master | 2020-12-24T09:09:59.574026 | 2016-11-09T18:07:57 | 2016-11-09T18:07:57 | 73,302,594 | 0 | 1 | MIT | 2020-03-08T01:27:48 | 2016-11-09T16:45:24 | C | UTF-8 | C | false | false | 5,595 | c | /**
******************************************************************************
* @file FSMC/FSMC_SRAM_DataMemory/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.2.6
* @date 06-May-2016
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx_it.h"
/** @addtogroup STM32F4xx_HAL_Examples
* @{
*/
/** @addtogroup FSMC_SRAM_DataMemory
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
HAL_IncTick();
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"patrick.d.lloyd@gmail.com"
] | patrick.d.lloyd@gmail.com |
e354269707a6613f4991b9bbd1834e80739f4adf | 45d1881440cd736dc3624e69026d95922f9e1289 | /Silicon/TigerlakePkg/Include/CpuPcieInfo.h | eb02a589cedf48494934c45f14896c7a603f4d12 | [
"BSD-2-Clause-Patent",
"BSD-3-Clause"
] | permissive | sagraw2/slimbootloader | cf794d9cf593f4c9ee99b958ac17480e4ccbec10 | c62c995e496368a4c426da478b054120ebbc8eca | refs/heads/master | 2021-06-19T18:16:08.746301 | 2021-01-07T21:34:59 | 2021-01-08T04:22:54 | 160,243,111 | 0 | 0 | BSD-2-Clause | 2018-12-03T19:31:52 | 2018-12-03T19:31:52 | null | UTF-8 | C | false | false | 3,635 | h | /** @file
This file contains definitions of PCIe controller information
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _CPU_PCIE_INFO_H_
#define _CPU_PCIE_INFO_H_
#define PCIE_HWEQ_COEFFS_MAX 5
/**
PCIe controller configuration.
**/
#define CPU_PCIE_1x16 7
#define CPU_PCIE_1x8_2x4 4
#define CPU_PCIE_2x8 5
#define CPU_PCIE_1x4 0
//
// Device 1 Memory Mapped IO Register Offset Equates
//
#define SA_PEG_BUS_NUM 0x00
#define SA_PEG_DEV_NUM 0x01
#define SA_PEG0_DEV_NUM SA_PEG_DEV_NUM
#define SA_PEG0_FUN_NUM 0x00
#define SA_PEG1_DEV_NUM SA_PEG_DEV_NUM
#define SA_PEG1_FUN_NUM 0x01
#define SA_PEG2_DEV_NUM SA_PEG_DEV_NUM
#define SA_PEG2_FUN_NUM 0x02
#define SA_PEG3_DEV_NUM 0x06
#define SA_PEG3_FUN_NUM 0x00
#define V_SA_PEG_VID 0x8086
#define V_PH3_FS_CR_OVR 0x3E
#define B_PH3_FS_CR_OVR_EN BIT8
#define V_PH3_LF_CR_OVR 0x14
#define B_PH3_LF_CR_OVR_EN BIT16
//
// Temporary Device & Function Number used for Switchable Graphics DGPU
//
#define SA_TEMP_DGPU_DEV 0x00
#define SA_TEMP_DGPU_FUN 0x00
#define CPU_PCIE_MAX_ROOT_PORTS 4
#define CPU_PCIE_MAX_CONTROLLERS 3
#define SA_PEG_MAX_FUN 0x04
#define SA_PEG_MAX_LANE 0x14
#define SA_PEG_MAX_BUNDLE 0x0A
#define SA_PEG_MAX_FUN_GEN3 0x03
#define SA_PEG_MAX_LANE_GEN3 0x10
#define SA_PEG_MAX_BUNDLE_GEN3 0x08
#define SA_PEG0_CNT_MAX_LANE 0x10
#define SA_PEG0_CNT_MAX_BUNDLE 0x08
#define SA_PEG0_CNT_FIRST_LANE 0x00
#define SA_PEG0_CNT_FIRST_BUNDLE 0x00
#define SA_PEG0_CNT_LAST_LANE 0x0F
#define SA_PEG0_CNT_LAST_BUNDLE 0x07
#define SA_PEG3_CNT_MAX_LANE 0x04
#define SA_PEG3_CNT_MAX_BUNDLE 0x02
#define SA_PEG3_CNT_FIRST_LANE 0x00
#define SA_PEG3_CNT_FIRST_BUNDLE 0x00
#define SA_PEG3_CNT_LAST_LANE 0x03
#define SA_PEG3_CNT_LAST_BUNDLE 0x01
#define SA_PEG3_CNT_MAX_LANE_GEN3 0x00
#define SA_PEG3_CNT_MAX_BUNDLE_GEN3 0x00
#define SA_PEG3_CNT_FIRST_LANE_GEN3 0x00
#define SA_PEG3_CNT_FIRST_BUNDLE_GEN3 0x00
#define SA_PEG3_CNT_LAST_LANE_GEN3 0x00
#define SA_PEG3_CNT_LAST_BUNDLE_GEN3 0x00
//
// Silicon and SKU- specific MAX defines
//
#define SA_PEG_CNL_H_MAX_FUN SA_PEG_MAX_FUN // CNL-H- SKU supports 4 controllers with 20 PEG lanes and 10 bundles
#define SA_PEG_CNL_H_MAX_LANE SA_PEG_MAX_LANE
#define SA_PEG_CNL_H_MAX_BUNDLE SA_PEG_MAX_BUNDLE
#define SA_PEG_NON_CNL_H_MAX_FUN 0x03 // All non-CNL-H- SKU supports 3 controllers with 16 PEG lanes and 8 bundles
#define SA_PEG_NON_CNL_H_MAX_LANE 0x10
#define SA_PEG_NON_CNL_H_MAX_BUNDLE 0x08
#define DMI_AUTO 0
#define DMI_GEN1 1
#define DMI_GEN2 2
#define DMI_GEN3 3
#define PH3_METHOD_AUTO 0x0
#define PH3_METHOD_HWEQ 0x1
#define PH3_METHOD_SWEQ 0x2
#define PH3_METHOD_STATIC 0x3
#define PH3_METHOD_DISABLED 0x4
#define MAX_PRESETS 9
#define BEST_PRESETS 4
//
// The PEG Disable Mask BIT0 ~ BIT3 for PEG0 ~ PEG3
//
#define V_PEG_DISABLE_MASK 0x0F
#define B_PEG0_DISABLE_MASK BIT0
#define B_PEG1_DISABLE_MASK BIT1
#define B_PEG2_DISABLE_MASK BIT2
#define B_PEG3_DISABLE_MASK BIT3
#define CPU_PCIE_CTRL_060 0
#define CPU_PCIE_CTRL_010 1
#define CPU_PCIE_CTRL_011_012 2
//
// SIP version
//
#define PCIE_SIP16 0
#define PCIE_SIP17 1
#endif
| [
"guo.dong@intel.com"
] | guo.dong@intel.com |
cdddeacb82da25ccb2e46fdfcbd46150dc6d8dfb | fe5e5f3e3da1d6199da2161fa4ee1b8516009894 | /Midterm_C/Problem3_20/Problem3_20/main.c | a6bd508fdbe30ff284a36adcb13e6449fbf22eac | [] | no_license | alien-house/C | 4a4d2f8ebbd2e6a86ae8e1050c2f87fd3a9f57bc | 5c9c9e70580a328b761a02bbcd5c2da17c8d8a59 | refs/heads/master | 2021-06-12T12:10:48.901062 | 2017-02-03T20:09:57 | 2017-02-03T20:09:57 | 53,290,261 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 463 | c | //
// main.c
// Problem3_20
//
// Created by sin on 2017/01/28.
// Copyright © 2017年 shinji. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p \n", a);
printf("%d \n", *p);
printf("%p \n", p);
printf("%d \n", **r);
printf("%p \n", &p);
printf("%p \n", p);
printf("%p \n", r);
printf("%p %p", *r, a);
return 0;
}
| [
"info@alien-house.com"
] | info@alien-house.com |
382cdb2c263ecef7ace773b52519020028485ccd | 8d66da22764e44dd5680a5ce4bdf165f1546c25e | /Firmware_F411 V1.2/COMMUNICATE/src/radiolink.c | a02d2abcbe136ebfef46847029748e4002200d30 | [] | no_license | xindong324/MiniFly | 679210b8f00d7f2bac73470ffbb62d5718e9c2a9 | 21c0679563510728590a306e627fbeeb42a4cdd3 | refs/heads/master | 2020-03-26T13:19:32.942801 | 2018-08-16T03:42:51 | 2018-08-16T03:42:51 | 144,932,913 | 3 | 3 | null | null | null | null | GB18030 | C | false | false | 4,515 | c | #include <string.h>
#include "config.h"
#include "radiolink.h"
#include "config_param.h"
#include "led.h"
#include "ledseq.h"
#include "uart_syslink.h"
/*FreeRtos includes*/
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "queue.h"
/********************************************************************************
* 本程序只供学习使用,未经作者许可,不得用于其它任何用途
* ALIENTEK MiniFly
* 无线通信驱动代码
* 正点原子@ALIENTEK
* 技术论坛:www.openedv.com
* 创建日期:2018/6/22
* 版本:V1.2
* 版权所有,盗版必究。
* Copyright(C) 广州市星翼电子科技有限公司 2014-2024
* All rights reserved
********************************************************************************/
#define RADIOLINK_TX_QUEUE_SIZE 30 /*接收队列个数*/
static enum
{
waitForStartByte1,
waitForStartByte2,
waitForMsgID,
waitForDataLength,
waitForData,
waitForChksum1,
}rxState;
static bool isInit;
static atkp_t txPacket;
static atkp_t rxPacket;
static xQueueHandle txQueue;
static void atkpPacketDispatch(atkp_t *rxPacket);
//radiolink接收ATKPPacket任务
void radiolinkTask(void *param)
{
rxState = waitForStartByte1;
u8 c;
u8 dataIndex = 0;
u8 cksum = 0;
while(1)
{
if (uartslkGetDataWithTimout(&c))
{
switch(rxState)
{
case waitForStartByte1:
rxState = (c == DOWN_BYTE1) ? waitForStartByte2 : waitForStartByte1;
cksum = c;
break;
case waitForStartByte2:
rxState = (c == DOWN_BYTE2) ? waitForMsgID : waitForStartByte1;
cksum += c;
break;
case waitForMsgID:
rxPacket.msgID = c;
rxState = waitForDataLength;
cksum += c;
break;
case waitForDataLength:
if (c <= ATKP_MAX_DATA_SIZE)
{
rxPacket.dataLen = c;
dataIndex = 0;
rxState = (c > 0) ? waitForData : waitForChksum1; /*c=0,数据长度为0,校验1*/
cksum += c;
} else
{
rxState = waitForStartByte1;
}
break;
case waitForData:
rxPacket.data[dataIndex] = c;
dataIndex++;
cksum += c;
if (dataIndex == rxPacket.dataLen)
{
rxState = waitForChksum1;
}
break;
case waitForChksum1:
if (cksum == c) /*所有校验正确*/
{
atkpPacketDispatch(&rxPacket);
}
else /*校验错误*/
{
rxState = waitForStartByte1;
IF_DEBUG_ASSERT(1);
}
rxState = waitForStartByte1;
break;
default:
ASSERT(0);
break;
}
}
else /*超时处理*/
{
rxState = waitForStartByte1;
}
}
}
void radiolinkInit(void)
{
if (isInit) return;
uartslkInit();
/*创建发送队列,CRTP_TX_QUEUE_SIZE个消息*/
txQueue = xQueueCreate(RADIOLINK_TX_QUEUE_SIZE, sizeof(atkp_t));
ASSERT(txQueue);
isInit = true;
}
/*打包ATKPPacket数据通过串口DMA发送*/
static void uartSendPacket(atkp_t *p)
{
int dataSize;
u8 cksum = 0;
u8 sendBuffer[36];
ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE);
sendBuffer[0] = UP_BYTE1;
sendBuffer[1] = UP_BYTE2;
sendBuffer[2] = p->msgID;
sendBuffer[3] = p->dataLen;
memcpy(&sendBuffer[4], p->data, p->dataLen);
dataSize = p->dataLen + 5;//加上cksum
/*计算校验和*/
for (int i=0; i<dataSize-1; i++)
{
cksum += sendBuffer[i];
}
sendBuffer[dataSize-1] = cksum;
/*串口DMA发送*/
uartslkSendDataDmaBlocking(dataSize, sendBuffer);
}
/*radiolink接收到ATKPPacket预处理*/
static void atkpPacketDispatch(atkp_t *rxPacket)
{
atkpReceivePacketBlocking(rxPacket);
if( rxPacket->msgID == DOWN_POWER)
{;}/*do noting*/
else
{
ledseqRun(DATA_RX_LED, seq_linkup);
/*接收到一个遥控无线数据包则发送一个包*/
if(xQueueReceive(txQueue, &txPacket, 0) == pdTRUE)
{
ASSERT(txPacket.dataLen <= ATKP_MAX_DATA_SIZE);
ledseqRun(DATA_TX_LED, seq_linkup);
uartSendPacket(&txPacket);
}
}
}
bool radiolinkSendPacket(const atkp_t *p)
{
ASSERT(p);
ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE);
return xQueueSend(txQueue, p, 0);
}
bool radiolinkSendPacketBlocking(const atkp_t *p)
{
ASSERT(p);
ASSERT(p->dataLen <= ATKP_MAX_DATA_SIZE);
return xQueueSend(txQueue, p, portMAX_DELAY);
}
//获取剩余可用txQueue个数
int radiolinkGetFreeTxQueuePackets(void)
{
return (RADIOLINK_TX_QUEUE_SIZE - uxQueueMessagesWaiting(txQueue));
}
| [
"xindong324@163.com"
] | xindong324@163.com |
37d39a2e57918af3b613758d06ab5e8eb4a6a5d0 | 243b969733833e83002586aeeee40dc21b0d55c0 | /libft/src/ft_print_byte.c | cc3c556e6d1d1ed4df4a67cb967aa9860f368353 | [] | no_license | KostyaBovt/ft_ssl | bec99134c8d4a39d523c888c9d374bd7dc29b949 | bc4cbb2764dbe2703e1c749dda42e8fdc881d18c | refs/heads/master | 2020-04-11T03:43:34.028613 | 2018-12-25T13:25:44 | 2018-12-25T13:25:44 | 161,487,391 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,107 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_byte.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kbovt <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/12/15 13:34:57 by kbovt #+# #+# */
/* Updated: 2018/12/15 13:35:47 by kbovt ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/libft.h"
void ft_print_byte(unsigned char c)
{
int i;
unsigned char shift;
i = 7;
shift = 1;
while (i >= 0)
{
(c & (shift << i)) ? write(1, "1", 1) : write(1, "0", 1);
i--;
}
}
| [
"kbovt@e1r1p9.unit.ua"
] | kbovt@e1r1p9.unit.ua |
08113360ad500737a7a5484c45b9eafc178d9774 | c4afbfe1885e8d0c7a1c8b928563f7bb8ab6a683 | /openETCS_Releases/v0.3-D3.6.3/KCG_GreenField/CAST_int_to_DMI_TEXT_DATA_Varia.c | cc1403d9726ddbafe4826b0732e7b218f84714c1 | [] | no_license | VladislavLasmann/srcAndBinary | cd48ebaa2f1f7f697ba5df9f38abb9ed50658e10 | 13aa76e545b9596f6dac84fb20480dffae7584d8 | refs/heads/master | 2021-05-08T15:04:05.709079 | 2016-01-22T12:40:10 | 2016-01-22T12:40:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,086 | c | /* $**************** KCG Version 6.4 (build i21) ****************
** Command: kcg64.exe -config D:/Github/modeling/model/Scade/System/OBU_PreIntegrations/openETCS_EVC/KCG_GreenField/config.txt
** Generation date: 2015-11-05T08:54:04
*************************************************************$ */
#include "kcg_consts.h"
#include "kcg_sensors.h"
#include "CAST_int_to_DMI_TEXT_DATA_Varia.h"
/* DATA::Variables::CAST_int_to_DMI_TEXT */
void CAST_int_to_DMI_TEXT_DATA_Varia(
/* DATA::Variables::CAST_int_to_DMI_TEXT::dmi_text_int_array_in */ DMI_TEXT_INT_Array_T_DATA *dmi_text_int_array_in,
/* DATA::Variables::CAST_int_to_DMI_TEXT::dmi_text_string_out */ DMI_TEXT_DMI_Types_Pkg *dmi_text_string_out)
{
static kcg_int i;
/* 1 */ for (i = 0; i < 255; i++) {
(*dmi_text_string_out)[i] = /* 1 */
Int_to_Char_Utilities((*dmi_text_int_array_in)[i]);
}
}
/* $**************** KCG Version 6.4 (build i21) ****************
** CAST_int_to_DMI_TEXT_DATA_Varia.c
** Generation date: 2015-11-05T08:54:04
*************************************************************$ */
| [
"bernd.hekele@deutschebahn.com"
] | bernd.hekele@deutschebahn.com |
d45f88e7cfdd51b0c9e171c4a2258fa03e959458 | f7ff15d6f0eaf897d9ed9918544d68e3ed2f3c6b | /set2prgm19.c | c14bb997aad77dcd21a606c4af6bfabe1792e684 | [] | no_license | SUBHAPRANAV/c | 4912899a966a677677976241c9d10e702fc1fa30 | 91b7bbc72a331cfbfa6bf4346eb243588e25f082 | refs/heads/master | 2020-04-22T04:10:28.675175 | 2019-04-01T11:03:19 | 2019-04-01T11:03:19 | 170,113,746 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 129 | c | #include<stdio.h>
int main()
{
int a,i,fact=1;
scanf("%d",&a);
for(i=1;i<=a;i++)
{
fact=fact*i;
}
printf("%d",fact);
return 0;
}
| [
"noreply@github.com"
] | SUBHAPRANAV.noreply@github.com |
d1793a3f1aac82f038110473741d9ee6b69982f2 | e80e5374b8fd00379293adb35fc8cf017d5f4cc7 | /qemu_mode/qemu-2.10.0/hw/ssi/omap_spi.c | 22034656b8c8fde4edcdc063372ac98b36d7ee35 | [
"GPL-2.0-only",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | CAFA1/afl | dcebf3a3acae3e9783bbb79d8cff6958b496fa34 | 01c113b61ab70c3b02f3d7c74e6dfa20cfc7813d | refs/heads/master | 2023-04-10T14:30:34.901666 | 2020-07-27T01:06:32 | 2020-07-27T01:06:32 | 272,596,630 | 0 | 2 | Apache-2.0 | 2021-04-15T00:56:55 | 2020-06-16T03:03:26 | C | UTF-8 | C | false | false | 10,538 | c | /*
* TI OMAP processor's Multichannel SPI emulation.
*
* Copyright (C) 2007-2009 Nokia Corporation
*
* Original code for OMAP2 by Andrzej Zaborowski <andrew@openedhand.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "qemu/osdep.h"
#include "hw/hw.h"
#include "hw/arm/omap.h"
/* Multichannel SPI */
struct omap_mcspi_s {
MemoryRegion iomem;
qemu_irq irq;
int chnum;
uint32_t sysconfig;
uint32_t systest;
uint32_t irqst;
uint32_t irqen;
uint32_t wken;
uint32_t control;
struct omap_mcspi_ch_s {
qemu_irq txdrq;
qemu_irq rxdrq;
uint32_t (*txrx)(void *opaque, uint32_t, int);
void *opaque;
uint32_t tx;
uint32_t rx;
uint32_t config;
uint32_t status;
uint32_t control;
} ch[4];
};
static inline void omap_mcspi_interrupt_update(struct omap_mcspi_s *s)
{
qemu_set_irq(s->irq, s->irqst & s->irqen);
}
static inline void omap_mcspi_dmarequest_update(struct omap_mcspi_ch_s *ch)
{
qemu_set_irq(ch->txdrq,
(ch->control & 1) && /* EN */
(ch->config & (1 << 14)) && /* DMAW */
(ch->status & (1 << 1)) && /* TXS */
((ch->config >> 12) & 3) != 1); /* TRM */
qemu_set_irq(ch->rxdrq,
(ch->control & 1) && /* EN */
(ch->config & (1 << 15)) && /* DMAW */
(ch->status & (1 << 0)) && /* RXS */
((ch->config >> 12) & 3) != 2); /* TRM */
}
static void omap_mcspi_transfer_run(struct omap_mcspi_s *s, int chnum)
{
struct omap_mcspi_ch_s *ch = s->ch + chnum;
if (!(ch->control & 1)) /* EN */
return;
if ((ch->status & (1 << 0)) && /* RXS */
((ch->config >> 12) & 3) != 2 && /* TRM */
!(ch->config & (1 << 19))) /* TURBO */
goto intr_update;
if ((ch->status & (1 << 1)) && /* TXS */
((ch->config >> 12) & 3) != 1) /* TRM */
goto intr_update;
if (!(s->control & 1) || /* SINGLE */
(ch->config & (1 << 20))) { /* FORCE */
if (ch->txrx)
ch->rx = ch->txrx(ch->opaque, ch->tx, /* WL */
1 + (0x1f & (ch->config >> 7)));
}
ch->tx = 0;
ch->status |= 1 << 2; /* EOT */
ch->status |= 1 << 1; /* TXS */
if (((ch->config >> 12) & 3) != 2) /* TRM */
ch->status |= 1 << 0; /* RXS */
intr_update:
if ((ch->status & (1 << 0)) && /* RXS */
((ch->config >> 12) & 3) != 2 && /* TRM */
!(ch->config & (1 << 19))) /* TURBO */
s->irqst |= 1 << (2 + 4 * chnum); /* RX_FULL */
if ((ch->status & (1 << 1)) && /* TXS */
((ch->config >> 12) & 3) != 1) /* TRM */
s->irqst |= 1 << (0 + 4 * chnum); /* TX_EMPTY */
omap_mcspi_interrupt_update(s);
omap_mcspi_dmarequest_update(ch);
}
void omap_mcspi_reset(struct omap_mcspi_s *s)
{
int ch;
s->sysconfig = 0;
s->systest = 0;
s->irqst = 0;
s->irqen = 0;
s->wken = 0;
s->control = 4;
for (ch = 0; ch < 4; ch ++) {
s->ch[ch].config = 0x060000;
s->ch[ch].status = 2; /* TXS */
s->ch[ch].control = 0;
omap_mcspi_dmarequest_update(s->ch + ch);
}
omap_mcspi_interrupt_update(s);
}
static uint64_t omap_mcspi_read(void *opaque, hwaddr addr,
unsigned size)
{
struct omap_mcspi_s *s = (struct omap_mcspi_s *) opaque;
int ch = 0;
uint32_t ret;
if (size != 4) {
return omap_badwidth_read32(opaque, addr);
}
switch (addr) {
case 0x00: /* MCSPI_REVISION */
return 0x91;
case 0x10: /* MCSPI_SYSCONFIG */
return s->sysconfig;
case 0x14: /* MCSPI_SYSSTATUS */
return 1; /* RESETDONE */
case 0x18: /* MCSPI_IRQSTATUS */
return s->irqst;
case 0x1c: /* MCSPI_IRQENABLE */
return s->irqen;
case 0x20: /* MCSPI_WAKEUPENABLE */
return s->wken;
case 0x24: /* MCSPI_SYST */
return s->systest;
case 0x28: /* MCSPI_MODULCTRL */
return s->control;
case 0x68: ch ++;
/* fall through */
case 0x54: ch ++;
/* fall through */
case 0x40: ch ++;
/* fall through */
case 0x2c: /* MCSPI_CHCONF */
return s->ch[ch].config;
case 0x6c: ch ++;
/* fall through */
case 0x58: ch ++;
/* fall through */
case 0x44: ch ++;
/* fall through */
case 0x30: /* MCSPI_CHSTAT */
return s->ch[ch].status;
case 0x70: ch ++;
/* fall through */
case 0x5c: ch ++;
/* fall through */
case 0x48: ch ++;
/* fall through */
case 0x34: /* MCSPI_CHCTRL */
return s->ch[ch].control;
case 0x74: ch ++;
/* fall through */
case 0x60: ch ++;
/* fall through */
case 0x4c: ch ++;
/* fall through */
case 0x38: /* MCSPI_TX */
return s->ch[ch].tx;
case 0x78: ch ++;
/* fall through */
case 0x64: ch ++;
/* fall through */
case 0x50: ch ++;
/* fall through */
case 0x3c: /* MCSPI_RX */
s->ch[ch].status &= ~(1 << 0); /* RXS */
ret = s->ch[ch].rx;
omap_mcspi_transfer_run(s, ch);
return ret;
}
OMAP_BAD_REG(addr);
return 0;
}
static void omap_mcspi_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
struct omap_mcspi_s *s = (struct omap_mcspi_s *) opaque;
int ch = 0;
if (size != 4) {
omap_badwidth_write32(opaque, addr, value);
return;
}
switch (addr) {
case 0x00: /* MCSPI_REVISION */
case 0x14: /* MCSPI_SYSSTATUS */
case 0x30: /* MCSPI_CHSTAT0 */
case 0x3c: /* MCSPI_RX0 */
case 0x44: /* MCSPI_CHSTAT1 */
case 0x50: /* MCSPI_RX1 */
case 0x58: /* MCSPI_CHSTAT2 */
case 0x64: /* MCSPI_RX2 */
case 0x6c: /* MCSPI_CHSTAT3 */
case 0x78: /* MCSPI_RX3 */
OMAP_RO_REG(addr);
return;
case 0x10: /* MCSPI_SYSCONFIG */
if (value & (1 << 1)) /* SOFTRESET */
omap_mcspi_reset(s);
s->sysconfig = value & 0x31d;
break;
case 0x18: /* MCSPI_IRQSTATUS */
if (!((s->control & (1 << 3)) && (s->systest & (1 << 11)))) {
s->irqst &= ~value;
omap_mcspi_interrupt_update(s);
}
break;
case 0x1c: /* MCSPI_IRQENABLE */
s->irqen = value & 0x1777f;
omap_mcspi_interrupt_update(s);
break;
case 0x20: /* MCSPI_WAKEUPENABLE */
s->wken = value & 1;
break;
case 0x24: /* MCSPI_SYST */
if (s->control & (1 << 3)) /* SYSTEM_TEST */
if (value & (1 << 11)) { /* SSB */
s->irqst |= 0x1777f;
omap_mcspi_interrupt_update(s);
}
s->systest = value & 0xfff;
break;
case 0x28: /* MCSPI_MODULCTRL */
if (value & (1 << 3)) /* SYSTEM_TEST */
if (s->systest & (1 << 11)) { /* SSB */
s->irqst |= 0x1777f;
omap_mcspi_interrupt_update(s);
}
s->control = value & 0xf;
break;
case 0x68: ch ++;
/* fall through */
case 0x54: ch ++;
/* fall through */
case 0x40: ch ++;
/* fall through */
case 0x2c: /* MCSPI_CHCONF */
if ((value ^ s->ch[ch].config) & (3 << 14)) /* DMAR | DMAW */
omap_mcspi_dmarequest_update(s->ch + ch);
if (((value >> 12) & 3) == 3) /* TRM */
fprintf(stderr, "%s: invalid TRM value (3)\n", __FUNCTION__);
if (((value >> 7) & 0x1f) < 3) /* WL */
fprintf(stderr, "%s: invalid WL value (%" PRIx64 ")\n",
__FUNCTION__, (value >> 7) & 0x1f);
s->ch[ch].config = value & 0x7fffff;
break;
case 0x70: ch ++;
/* fall through */
case 0x5c: ch ++;
/* fall through */
case 0x48: ch ++;
/* fall through */
case 0x34: /* MCSPI_CHCTRL */
if (value & ~s->ch[ch].control & 1) { /* EN */
s->ch[ch].control |= 1;
omap_mcspi_transfer_run(s, ch);
} else
s->ch[ch].control = value & 1;
break;
case 0x74: ch ++;
/* fall through */
case 0x60: ch ++;
/* fall through */
case 0x4c: ch ++;
/* fall through */
case 0x38: /* MCSPI_TX */
s->ch[ch].tx = value;
s->ch[ch].status &= ~(1 << 1); /* TXS */
omap_mcspi_transfer_run(s, ch);
break;
default:
OMAP_BAD_REG(addr);
return;
}
}
static const MemoryRegionOps omap_mcspi_ops = {
.read = omap_mcspi_read,
.write = omap_mcspi_write,
.endianness = DEVICE_NATIVE_ENDIAN,
};
struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum,
qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk)
{
struct omap_mcspi_s *s = g_new0(struct omap_mcspi_s, 1);
struct omap_mcspi_ch_s *ch = s->ch;
s->irq = irq;
s->chnum = chnum;
while (chnum --) {
ch->txdrq = *drq ++;
ch->rxdrq = *drq ++;
ch ++;
}
omap_mcspi_reset(s);
memory_region_init_io(&s->iomem, NULL, &omap_mcspi_ops, s, "omap.mcspi",
omap_l4_region_size(ta, 0));
omap_l4_attach(ta, 0, &s->iomem);
return s;
}
void omap_mcspi_attach(struct omap_mcspi_s *s,
uint32_t (*txrx)(void *opaque, uint32_t, int), void *opaque,
int chipselect)
{
if (chipselect < 0 || chipselect >= s->chnum)
hw_error("%s: Bad chipselect %i\n", __FUNCTION__, chipselect);
s->ch[chipselect].txrx = txrx;
s->ch[chipselect].opaque = opaque;
}
| [
"longlong_vm@dell_book.com"
] | longlong_vm@dell_book.com |
9a90ab0d4adacd276f4a6f1f675cafe6eebb8c97 | 206b7b2e6d7a2b55deef44d1283efdfdb9b801e1 | /src/keylogger.h | 8f6a0da2ee9faacaf3e4bd79e6a368dab26c07f2 | [] | no_license | MatthiasJReisinger/keylogger | c9210ed47def7c37f6365cf9f857e68e76561faf | 347679078810f27550e6c386c07c3ae98a1de3c3 | refs/heads/master | 2020-04-09T10:24:09.665444 | 2013-05-21T16:00:18 | 2013-05-21T16:00:18 | 10,199,563 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 865 | h | /**
* key logger component
* the key logger is a singleton which is only accessible
* through the methods declared here. the key logger is a thread.
* there can only be one key logger at a time.
*
* @author d412vv1n
*/
#ifndef KEYLOGGER_H
#define KEYLOGGER_H
/**
* starts the key logger in a separate thread. if the key logger
* has already been started, subsequent calls of this method are
* ignored.
*
* @return 0 if the key logger started successfully, 1 if it could
* not be started
*/
int startKeylogger(void);
/**
* stops the key logger and clears all resources the key logger
* has been using. after the key logger has been stopped through this
* method, it can be started again through the startKeylogger() method.
*
* @return 0 if the key logger stopped successfully, 1 if there was an error
*/
int stopKeylogger(void);
#endif
| [
"mr@master-studios.net"
] | mr@master-studios.net |
7e0f473475d35ae38dfa32db1440aac2da28a6e9 | cd0ffa00c856e47050254e862c2c8651d9652ab9 | /beginset36.c | 2ee6692f2b39fad703b84e45148e9d86161d0c2c | [] | no_license | RANJITHKUMAR12345/ranjith | 861d4eefcf8df715af33bade03385f30a3ecebe1 | 92379ac8ddd8ab6f17c38ff0a3408a24a97e8dfa | refs/heads/master | 2021-04-30T13:59:51.036372 | 2019-03-26T10:43:16 | 2019-03-26T10:43:16 | 121,208,531 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 297 | c | #include<stdio.h>
void main()
{
int a[10],i,j,tp,n;
printf("enter the number");
scanf("%d",&n);
printf("enter the number");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
tp=a[i];
a[i]=a[j];
a[j]=tp;
}
}
}
for(i=0;i<n;i++)
{
printf("%d",a[i]);
}
}
| [
"noreply@github.com"
] | RANJITHKUMAR12345.noreply@github.com |
569854ba4bcf306821fc8938cfd0e90e233272ea | 7eab8a9d4e3d04842b319305e826215ca9bb5cbe | /Examples/Linux/Testbenches/ftp_test/Sources/ardrone_testing_tool.c | be67111096346633cc3a4a2efd6142545e437c72 | [] | no_license | islanderz/ARDRoneSDK | 65ef37320ee439eadfd70a09ba2cb220a25e59f5 | 7c56c8bfb36b81c01879295cff093b1eb1a51329 | refs/heads/master | 2021-01-10T10:19:35.649098 | 2016-02-24T14:38:59 | 2016-02-24T14:38:59 | 48,492,531 | 2 | 1 | null | null | null | null | UTF-8 | C | false | false | 30,614 | c | /**
* @file main.c
* @author sylvain.gaeremynck@parrot.com
* @date 2009/07/01
*/
#include <ardrone_testing_tool.h>
//ARDroneLib
#include <utils/ardrone_time.h>
#include <ardrone_tool/Navdata/ardrone_navdata_client.h>
#include <ardrone_tool/Control/ardrone_control.h>
#include <ardrone_tool/UI/ardrone_input.h>
#include <ardrone_tool/ardrone_tool_configuration.h>
//Common
#include <config.h>
#include <ardrone_api.h>
//VP_SDK
#include <ATcodec/ATcodec_api.h>
#include <VP_Os/vp_os_print.h>
#include <VP_Os/vp_os_thread.h>
#include <VP_Api/vp_api_thread_helper.h>
#include <VP_Os/vp_os_signal.h>
#include <VP_Os/vp_os_types.h>
#include <VP_Os/vp_os_delay.h>
//Local project
#include <Video/video_stage.h>
#include <utils/ardrone_ftp.h>
#include <semaphore.h>
static int32_t exit_ihm_program = 1;
/* Implementing Custom methods for the main function of an ARDrone application */
int main(int argc, char** argv)
{
return ardrone_tool_main(argc, argv);
}
/* The delegate object calls this method during initialization of an ARDrone application */
C_RESULT ardrone_tool_init_custom(void)
{
/* Start all threads of your application */
START_THREAD( main_application_thread , NULL );
return C_OK;
}
/* The delegate object calls this method when the event loop exit */
C_RESULT ardrone_tool_shutdown_custom()
{
/* Relinquish all threads of your application */
JOIN_THREAD( main_application_thread );
return C_OK;
}
/* The event loop calls this method for the exit condition */
bool_t ardrone_tool_exit()
{
return exit_ihm_program == 0;
}
C_RESULT signal_exit()
{
exit_ihm_program = 0;
return C_OK;
}
PROTO_THREAD_ROUTINE(main_application_thread, data);
/* Implementing thread table in which you add routines of your application and those provided by the SDK */
BEGIN_THREAD_TABLE
THREAD_TABLE_ENTRY( main_application_thread, 20 )
END_THREAD_TABLE
sem_t synchroSem;
#define BLUE { printf("%s","\033[34;01m"); }
#define RED { printf("%s","\033[31;01m"); }
#define GREEN { printf("%s","\033[32;01m"); }
#define RAZ { printf("%s","\033[0m"); }
#define TEST_RESULT(result, formatFAIL, formatOK, ...) \
do \
{ \
_ftp_status locResult = (result); \
totalOp++; \
if (FTP_FAILED (locResult)) \
{ \
RED; \
printf ("[%i : KO] : ", __LINE__); \
printf (formatFAIL, __VA_ARGS__); \
printf ("\n"); \
RAZ; \
} \
else \
{ \
GREEN; \
printf ("[%i : OK] : ", __LINE__); \
printf (formatOK, __VA_ARGS__); \
printf ("\n"); \
RAZ; \
opOk++; \
} \
if ((FTP_TIMEOUT == locResult) || \
(FTP_BUSY == locResult)) \
{ \
runOperation = 1; \
} \
else \
{ \
runOperation = 0; \
} \
} \
while (0)
#define COMPUTE_PERCENT_OK \
do \
{ \
if (totalOp> 0) \
{ \
float percentOk = (100.0 * opOk) / (1.0 * totalOp); \
if (90.0 < percentOk) \
{ \
GREEN; \
} \
else \
{ \
RED; \
} \
printf ("Success of %llu operations on %llu (%6.2f %%)\n", opOk, totalOp, percentOk); \
RAZ; \
} \
} while (0)
#define TEST_ABORTION(abortFunc) \
do \
{ \
_ftp_status locStat = (abortFunc); \
totalOp++; \
switch (locStat) \
{ \
case FTP_SUCCESS: \
GREEN; \
printf ("[%i : OK] : ", __LINE__); \
printf ("Abortion successfull\n"); \
RAZ; \
opOk++; \
break; \
case FTP_SAMESIZE: \
RED; \
printf ("[%i : KO] : ", __LINE__); \
printf ("Abortion failed, op was not running\n"); \
RAZ; \
break; \
case FTP_FAIL: \
default: \
RED; \
printf ("[%i : KO] : ", __LINE__); \
printf ("Unknown result\n"); \
RAZ; \
break; \
} \
} while (0) \
#define WAIT_COND(result) \
do \
{ \
sem_wait (&synchroSem); \
} while (0)
#define SEND_COND \
do \
{ \
sem_post (&synchroSem); \
} \
while (0)
_ftp_status globalStatus;
int runOperation = 1;
char *listBuffer = NULL;
void
ftpCallback (_ftp_status status, void *arg, _ftp_t *callingFtp)
{
float percent = (NULL != arg) ? *(float *)arg : -1.0;
if (NULL != arg && FTP_SUCCESS == status) { listBuffer = arg; }
globalStatus = status;
static int calls = 0;
#define CALLBACK_FORMAT "Callback called with status %s\n"
#ifdef DEBUG
#define PRINT_CALLBACK_FORMAT(statusString) { printf (CALLBACK_FORMAT, statusString); calls++; }
#else
#define PRINT_CALLBACK_FORMAT(statusString) { calls++; }
#endif
switch (status)
{
case FTP_BUSY:
PRINT_CALLBACK_FORMAT ("FTP_BUSY");
SEND_COND;
break;
case FTP_ABORT:
PRINT_CALLBACK_FORMAT ("FTP_ABORT");
SEND_COND;
break;
case FTP_FAIL:
PRINT_CALLBACK_FORMAT ("FTP_FAIL");
SEND_COND;
break;
case FTP_SUCCESS:
PRINT_CALLBACK_FORMAT ("FTP_SUCCESS");
SEND_COND;
break;
case FTP_TIMEOUT:
PRINT_CALLBACK_FORMAT ("FTP_TIMEOUT");
SEND_COND;
break;
case FTP_BADSIZE:
PRINT_CALLBACK_FORMAT ("FTP_BADSIZE");
SEND_COND;
break;
case FTP_SAMESIZE:
PRINT_CALLBACK_FORMAT ("FTP_SAMESIZE");
SEND_COND;
break;
case FTP_PROGRESS:
printf ("\rProgress : %5.2f", percent);
fflush (stdout);
if (100.0 <= percent)
{
printf ("\n");
}
break;
default: // Should not happen ... kill the program in this case !
printf ("Callback called with unknown status : %d\n", status);
exit (-1);
break;
}
#undef CALLBACK_FORMAT
}
#define title(x) { BLUE; printf("[%i] %s",__LINE__,x); RAZ; }
#define ARDRONE_IP "192.168.1.1"
#define ARDRONE_PORT (21)
#define ARDRONE_USER "anonymous"
#define ARDRONE_PASSWORD ""
#define _1MB_ORIGIN_FILE "origin.txt"
#define _512K_FAILED_FILE "half_file.txt"
#define _256K_FAILED_FILE "quarter_file.txt"
#define _1MB_MERGED_FILE "merged.txt"
#define LOCAL_RESULT_FILE "result.txt"
#define NOCB_NORESUME_RESULT "result_nocb_noresume.txt"
#define CB_NORESUME_RESULT "result_cb_noresume.txt"
#define NOCB_RESUME_RESULT "result_nocb_resume.txt"
#define CB_RESUME_RESULT "result_cb_resume.txt"
#define ARDRONE_FILE_BEFORE_RENAME "origin.txt"
#define ARDRONE_FILE_AFTER_RENAME "result.txt"
DEFINE_THREAD_ROUTINE(main_application_thread, data)
{
/* Semaphore for synchronisation */
sem_init (&synchroSem, 0, 0);
vp_os_delay(1000);
char buffer [512] = {0};
int systemRet = 0;
_ftp_t *droneFtp = NULL;
_ftp_status ftp_result = FTP_FAIL;
int runOperation = 1;
uint64_t totalOp = 0;
uint64_t opOk = 0;
title ("\n\n------ CLEANING ------\n\n");
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Getting PWD ---\n");
char pwd [256] = {0};
ftp_result = ftpPwd (droneFtp, pwd, 256);
TEST_RESULT (ftp_result, "Unable to get PWD [%1s]", "Got PWD : %s", pwd);
title ("--- Removing previous file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_BEFORE_RENAME);
TEST_RESULT (ftp_result, " (STILL OK !) file %s does not exist", "Deleted file %s", ARDRONE_FILE_BEFORE_RENAME);
}
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, " (STILL OK !) file %s does not exist", "Deleted file %s", ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Removing local result file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "rm -f %s", LOCAL_RESULT_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Disconnecting from AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
while (1)
{
title ("\n\n------ TESTS WITHOUT RESUME NOR CALLBACK ------\n\n");
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Sending origin file to the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 0, NULL);
TEST_RESULT (ftp_result, "Unable to send file %s->%s", "Sent file %s->%s", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Renaming file on the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRename (droneFtp, ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Impossible to rename %s->%s", "Renamed %s->%s", ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Getting AR.Drone FTP Listing ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, &listBuffer, NULL);
TEST_RESULT (ftp_result, "Unable to list FTP [%1s]", "Listed FTP :\n%s", listBuffer);
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting back result file ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE, 0, NULL);
TEST_RESULT (ftp_result, "Unable to get file %s->%s", "Got back file %s->%s", ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Checking file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "diff %s %s > /dev/null", LOCAL_RESULT_FILE, _1MB_ORIGIN_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
totalOp++;
if (0 != systemRet)
{
RED; printf ("[%d : KO] : Files are different !\n", __LINE__); RAZ;
}
else
{
opOk++;
GREEN; printf ("[%d : OK] : Files are the same\n", __LINE__); RAZ;
}
title ("--- Removing file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Unable to delete file %s", "Deleted file %s", ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Local file backup ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "mv %s %s", LOCAL_RESULT_FILE, NOCB_NORESUME_RESULT);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Closing AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
title ("\n\n------ TESTS WITHOUT RESUME / WITH CALLBACK ------\n\n");
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Sending origin file to the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 0, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to send file %s->%s", "Sent file %s->%s", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Renaming file on the AR.Drone ---\n");
ftp_result = ftpRename (droneFtp, ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Impossible to rename %s->%s", "Renamed %s->%s", ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
title ("--- Getting AR.Drone FTP Listing ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, NULL, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to list FTP [%1s]", "Listed FTP :\n%s", listBuffer);
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting back result file ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE, 0, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to get file %s->%s", "Got back file %s->%s", ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Checking file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "diff %s %s > /dev/null", LOCAL_RESULT_FILE, _1MB_ORIGIN_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
totalOp++;
if (0 != systemRet)
{
RED; printf ("[%d : KO] : Files are different !\n", __LINE__); RAZ;
}
else
{
opOk++;
GREEN; printf ("[%d : OK] : Files are the same\n", __LINE__); RAZ;
}
title ("--- Removing file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Unable to delete file %s", "Deleted file %s", ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Local file backup ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "mv %s %s", LOCAL_RESULT_FILE, CB_NORESUME_RESULT);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Closing AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
title ("\n\n------ TESTS WITH RESUME / NO CALLBACK ------\n\n");
title ("--- Preparing bad file (256K) locally ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "cp %s %s", _256K_FAILED_FILE, LOCAL_RESULT_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Preparing bad file (512K) on AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _512K_FAILED_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, NULL);
TEST_RESULT (ftp_result, "Unable to send partial file %s->%s", "Sent partial file %s->%s", _512K_FAILED_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Sending origin file to the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, NULL);
TEST_RESULT (ftp_result, "Unable to send file %s->%s", "Sent file %s->%s", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Renaming file on the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRename (droneFtp, ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Impossible to rename %s->%s", "Renamed %s->%s", ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Getting AR.Drone FTP Listing ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, &listBuffer, NULL);
TEST_RESULT (ftp_result, "Unable to list FTP [%1s]", "Listed FTP :\n%s", listBuffer);
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting back result file ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE, 1, NULL);
TEST_RESULT (ftp_result, "Unable to get file %s->%s", "Got back file %s->%s", ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Checking file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "diff %s %s > /dev/null", LOCAL_RESULT_FILE, _1MB_MERGED_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
totalOp++;
if (0 != systemRet)
{
RED; printf ("[%d : KO] : Files are different !\n", __LINE__); RAZ;
}
else
{
opOk++;
GREEN; printf ("[%d : OK] : Files are the same\n", __LINE__); RAZ;
}
title ("--- Removing file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Unable to delete file %s", "Deleted file %s", ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Local file backup ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "mv %s %s", LOCAL_RESULT_FILE, NOCB_RESUME_RESULT);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Closing AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
title ("\n\n------ TESTS WITH RESUME AND CALLBACK ------\n\n");
title ("--- Preparing bad file (256K) locally ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "cp %s %s", _256K_FAILED_FILE, LOCAL_RESULT_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Preparing bad file (512K) on AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _512K_FAILED_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to send partial file %s->%s", "Sent partial file %s->%s", _512K_FAILED_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Sending origin file to the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to send file %s->%s", "Sent file %s->%s", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Renaming file on the AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRename (droneFtp, ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Impossible to rename %s->%s", "Renamed %s->%s", ARDRONE_FILE_BEFORE_RENAME, ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Getting AR.Drone FTP Listing ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, NULL, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to list FTP [%1s]", "Listed FTP :\n%s", listBuffer);
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting back result file ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE, 1, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to get file %s->%s", "Got back file %s->%s", ARDRONE_FILE_AFTER_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Checking file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "diff %s %s > /dev/null", LOCAL_RESULT_FILE, _1MB_MERGED_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
totalOp++;
if (0 != systemRet)
{
RED; printf ("[%d : KO] : Files are different !\n", __LINE__); RAZ;
}
else
{
opOk++;
GREEN; printf ("[%d : OK] : Files are the same\n", __LINE__); RAZ;
}
title ("--- Removing file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_AFTER_RENAME);
TEST_RESULT (ftp_result, "Unable to delete file %s", "Deleted file %s", ARDRONE_FILE_AFTER_RENAME);
}
title ("--- Local file backup ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "mv %s %s", LOCAL_RESULT_FILE, CB_RESUME_RESULT);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
title ("--- Closing AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
title ("\n\n------ ABORTION TESTS ------\n\n");
title ("--- Connecting to AR.Drone FTP ---\n");
for (runOperation = 1; runOperation;)
{
droneFtp = ftpConnect (ARDRONE_IP, ARDRONE_PORT, ARDRONE_USER, ARDRONE_PASSWORD, &ftp_result);
TEST_RESULT (ftp_result, "Unable to connect to %s@%s:%d (PASS : %s)", "Connected to %s@%s:%d (PASS : %s)", ARDRONE_USER, ARDRONE_IP, ARDRONE_PORT, ARDRONE_PASSWORD);
}
title ("--- Sending origin file to the AR.Drone ... aborted ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, ftpCallback);
usleep (500000);
TEST_ABORTION (ftpAbort (droneFtp));
WAIT_COND (ftp_result);
TEST_RESULT ((FTP_ABORT == globalStatus) ? FTP_SUCCESS : FTP_FAIL, "Impossible to abort %s->%s transfert", "Aborted %s->%s transfert", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Sending origin file to the AR.Drone ... complete previous operation ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpPut (droneFtp, _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME, 1, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to send file %s->%s", "Sent file %s->%s", _1MB_ORIGIN_FILE, ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Getting AR.Drone FTP Listing ... aborted ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, NULL, ftpCallback);
usleep (1000);
TEST_ABORTION (ftpAbort (droneFtp));
WAIT_COND (ftp_result);
TEST_RESULT ((FTP_ABORT == globalStatus) ? FTP_SUCCESS : FTP_FAIL, "Impossible to abort %s", "Aborted %s", "listing");
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting AR.Drone FTP Listing ... ok ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpList (droneFtp, NULL, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to list FTP [%1s]", "Listed FTP :\n%s", listBuffer);
if (NULL != listBuffer) { vp_os_free (listBuffer); listBuffer = NULL; }
}
title ("--- Getting back origin file as result ... aborted ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_BEFORE_RENAME, LOCAL_RESULT_FILE, 1, ftpCallback);
usleep (500000);
TEST_ABORTION (ftpAbort (droneFtp));
WAIT_COND (ftp_result);
TEST_RESULT ((FTP_ABORT == globalStatus) ? FTP_SUCCESS : FTP_FAIL, "Impossible to abort %s->%s transfert", "Aborted %s->%s transfert", ARDRONE_FILE_BEFORE_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Getting back origin file as result ... complete previous operation ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpGet (droneFtp, ARDRONE_FILE_BEFORE_RENAME, LOCAL_RESULT_FILE, 1, ftpCallback);
WAIT_COND (ftp_result);
TEST_RESULT (globalStatus, "Unable to get file %s->%s", "Got back file %s->%s", ARDRONE_FILE_BEFORE_RENAME, LOCAL_RESULT_FILE);
}
title ("--- Checking file ---\n");
vp_os_memset (buffer, 0x0, 512);
snprintf (buffer, 512, "diff %s %s > /dev/null", LOCAL_RESULT_FILE, _1MB_ORIGIN_FILE);
systemRet = system (buffer);
printf ("System : %s\n", buffer);
totalOp++;
if (0 != systemRet)
{
RED; printf ("[%d : KO] : Files are different !\n", __LINE__); RAZ;
}
else
{
opOk++;
GREEN; printf ("[%d : OK] : Files are the same\n", __LINE__); RAZ;
}
title ("--- Removing file on AR.Drone ---\n");
for (runOperation = 1; runOperation;)
{
ftp_result = ftpRemove (droneFtp, ARDRONE_FILE_BEFORE_RENAME);
TEST_RESULT (ftp_result, "Unable to delete file %s", "Deleted file %s", ARDRONE_FILE_BEFORE_RENAME);
}
title ("--- Closing AR.Drone FTP ---\n");
TEST_RESULT (ftpClose (&droneFtp), "AR.Drone FTP (%s:%d) was not opened", "Closed AR.Drone FTP (%s:%d)", ARDRONE_IP, ARDRONE_PORT);
title ("\n\n------ RESULT ------\n\n");
COMPUTE_PERCENT_OK;
}
sem_destroy (&synchroSem);
exit (0);
return 0;
}
| [
"kamilns@hotmail.com"
] | kamilns@hotmail.com |
d97fd8400d58fe7c7c2e3d4cdc56be9c1c672c63 | e381bee2348bb2af111c726e86866a1759312563 | /srcs/lst/ft_lstiter.c | a01f0fb4c1e0a119370d22e617a6e07cac39c660 | [] | no_license | AnthonyLedru/libft | 852f3ccffb5ebe4a3ed17ec648ae8de54ed4ac0a | ac807dc2d59de2fea77278eae1f474fd0ff1ecf8 | refs/heads/master | 2021-03-24T10:18:53.851026 | 2020-10-07T19:59:33 | 2020-10-07T19:59:33 | 113,672,950 | 7 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,018 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstiter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aledru <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/10 01:52:56 by aledru #+# #+# */
/* Updated: 2017/11/10 02:24:57 by aledru ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstiter(t_list *lst, void (*f)(t_list *elem))
{
while (lst)
{
f(lst);
lst = lst->next;
}
}
| [
"aledru@e1r10p7.42.fr"
] | aledru@e1r10p7.42.fr |
14ebb3be62e42e60047eccb260e7219aef395c97 | fd90d577d6c848607ef56bf24ce5fe108bf13da8 | /devices/MIMXRT1062/drivers/fsl_elcdif.h | 063a1b777f2ac43caacb0d986b90537a498ea099 | [
"Apache-2.0"
] | permissive | JayHeng/imxrt-tool-flash-algo | 210e7adb904c8d95761e2914e69b8cc15e349326 | 0af70dfeea9dea669916bf404769144ed403a5e1 | refs/heads/master | 2022-11-26T20:56:24.771562 | 2022-03-26T14:18:45 | 2022-03-26T14:18:45 | 232,016,920 | 40 | 17 | Apache-2.0 | 2022-10-31T18:21:32 | 2020-01-06T03:29:02 | C | UTF-8 | C | false | false | 24,052 | h | /*
* Copyright 2017-2019 NXP
* All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FSL_ELCDIF_H_
#define _FSL_ELCDIF_H_
#include "fsl_common.h"
/*!
* @addtogroup elcdif
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @name Driver version */
/*@{*/
/*! @brief eLCDIF driver version */
#define FSL_ELCDIF_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
/*@}*/
/* All IRQ flags in CTRL1 register. */
#define ELCDIF_CTRL1_IRQ_MASK \
(LCDIF_CTRL1_BM_ERROR_IRQ_MASK | LCDIF_CTRL1_OVERFLOW_IRQ_MASK | LCDIF_CTRL1_UNDERFLOW_IRQ_MASK | \
LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_MASK | LCDIF_CTRL1_VSYNC_EDGE_IRQ_MASK)
/* All IRQ enable control bits in CTRL1 register. */
#define ELCDIF_CTRL1_IRQ_EN_MASK \
(LCDIF_CTRL1_BM_ERROR_IRQ_EN_MASK | LCDIF_CTRL1_OVERFLOW_IRQ_EN_MASK | LCDIF_CTRL1_UNDERFLOW_IRQ_EN_MASK | \
LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_EN_MASK | LCDIF_CTRL1_VSYNC_EDGE_IRQ_EN_MASK)
/* All IRQ flags in AS_CTRL register. */
#if defined(LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_MASK)
#define ELCDIF_AS_CTRL_IRQ_MASK (LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_MASK)
#else
#define ELCDIF_AS_CTRL_IRQ_MASK 0U
#endif
/* All IRQ enable control bits in AS_CTRL register. */
#if defined(LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_EN_MASK)
#define ELCDIF_AS_CTRL_IRQ_EN_MASK (LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_EN_MASK)
#else
#define ELCDIF_AS_CTRL_IRQ_EN_MASK 0U
#endif
#if ((ELCDIF_CTRL1_IRQ_MASK & ELCDIF_AS_CTRL_IRQ_MASK) || (ELCDIF_AS_CTRL_IRQ_MASK & ELCDIF_AS_CTRL_IRQ_EN_MASK))
#error Interrupt bits overlap, need to update the interrupt functions.
#endif
/* LUT memory entery number. */
#define ELCDIF_LUT_ENTRY_NUM 256U
/*!
* @brief eLCDIF signal polarity flags
*/
enum _elcdif_polarity_flags
{
kELCDIF_VsyncActiveLow = 0U, /*!< VSYNC active low. */
kELCDIF_VsyncActiveHigh = LCDIF_VDCTRL0_VSYNC_POL_MASK, /*!< VSYNC active high. */
kELCDIF_HsyncActiveLow = 0U, /*!< HSYNC active low. */
kELCDIF_HsyncActiveHigh = LCDIF_VDCTRL0_HSYNC_POL_MASK, /*!< HSYNC active high. */
kELCDIF_DataEnableActiveLow = 0U, /*!< Data enable line active low. */
kELCDIF_DataEnableActiveHigh = LCDIF_VDCTRL0_ENABLE_POL_MASK, /*!< Data enable line active high. */
kELCDIF_DriveDataOnFallingClkEdge = 0U, /*!< Drive data on falling clock edge, capture data
on rising clock edge. */
kELCDIF_DriveDataOnRisingClkEdge = LCDIF_VDCTRL0_DOTCLK_POL_MASK, /*!< Drive data on falling
clock edge, capture data
on rising clock edge. */
};
/*!
* @brief The eLCDIF interrupts to enable.
*/
enum _elcdif_interrupt_enable
{
kELCDIF_BusMasterErrorInterruptEnable = LCDIF_CTRL1_BM_ERROR_IRQ_EN_MASK, /*!< Bus master error interrupt. */
kELCDIF_TxFifoOverflowInterruptEnable = LCDIF_CTRL1_OVERFLOW_IRQ_EN_MASK, /*!< TXFIFO overflow interrupt. */
kELCDIF_TxFifoUnderflowInterruptEnable = LCDIF_CTRL1_UNDERFLOW_IRQ_EN_MASK, /*!< TXFIFO underflow interrupt. */
kELCDIF_CurFrameDoneInterruptEnable =
LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_EN_MASK, /*!< Interrupt when hardware enters vertical blanking state. */
kELCDIF_VsyncEdgeInterruptEnable =
LCDIF_CTRL1_VSYNC_EDGE_IRQ_EN_MASK, /*!< Interrupt when hardware encounters VSYNC edge. */
#if defined(LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_EN_MASK)
kELCDIF_SciSyncOnInterruptEnable =
LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_EN_MASK, /*!< Interrupt when eLCDIF lock with CSI input. */
#endif
};
/*!
* @brief The eLCDIF interrupt status flags.
*/
enum _elcdif_interrupt_flags
{
kELCDIF_BusMasterError = LCDIF_CTRL1_BM_ERROR_IRQ_MASK, /*!< Bus master error interrupt. */
kELCDIF_TxFifoOverflow = LCDIF_CTRL1_OVERFLOW_IRQ_MASK, /*!< TXFIFO overflow interrupt. */
kELCDIF_TxFifoUnderflow = LCDIF_CTRL1_UNDERFLOW_IRQ_MASK, /*!< TXFIFO underflow interrupt. */
kELCDIF_CurFrameDone =
LCDIF_CTRL1_CUR_FRAME_DONE_IRQ_MASK, /*!< Interrupt when hardware enters vertical blanking state. */
kELCDIF_VsyncEdge = LCDIF_CTRL1_VSYNC_EDGE_IRQ_MASK, /*!< Interrupt when hardware encounters VSYNC edge. */
#if defined(LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_MASK)
kELCDIF_SciSyncOn = LCDIF_AS_CTRL_CSI_SYNC_ON_IRQ_MASK, /*!< Interrupt when eLCDIF lock with CSI input. */
#endif
};
/*!
* @brief eLCDIF status flags
*/
enum _elcdif_status_flags
{
kELCDIF_LFifoFull = LCDIF_STAT_LFIFO_FULL_MASK, /*!< LFIFO full. */
kELCDIF_LFifoEmpty = LCDIF_STAT_LFIFO_EMPTY_MASK, /*!< LFIFO empty. */
kELCDIF_TxFifoFull = LCDIF_STAT_TXFIFO_FULL_MASK, /*!< TXFIFO full. */
kELCDIF_TxFifoEmpty = LCDIF_STAT_TXFIFO_EMPTY_MASK, /*!< TXFIFO empty. */
#if defined(LCDIF_STAT_BUSY_MASK)
kELCDIF_LcdControllerBusy = LCDIF_STAT_BUSY_MASK, /*!< The external LCD controller busy signal. */
#endif
#if defined(LCDIF_STAT_DVI_CURRENT_FIELD_MASK)
kELCDIF_CurDviField2 = LCDIF_STAT_DVI_CURRENT_FIELD_MASK, /*!< Current DVI filed, if set, then current filed is 2,
otherwise current filed is 1. */
#endif
};
/*!
* @brief The pixel format.
*
* This enumerator should be defined together with the array s_pixelFormatReg.
* To support new pixel format, enhance this enumerator and s_pixelFormatReg.
*/
typedef enum _elcdif_pixel_format
{
kELCDIF_PixelFormatRAW8 = 0, /*!< RAW 8 bit, four data use 32 bits. */
kELCDIF_PixelFormatRGB565 = 1, /*!< RGB565, two pixel use 32 bits. */
kELCDIF_PixelFormatRGB666 = 2, /*!< RGB666 unpacked, one pixel uses 32 bits, high byte unused,
upper 2 bits of other bytes unused. */
kELCDIF_PixelFormatXRGB8888 = 3, /*!< XRGB8888 unpacked, one pixel uses 32 bits, high byte unused. */
kELCDIF_PixelFormatRGB888 = 4, /*!< RGB888 packed, one pixel uses 24 bits. */
} elcdif_pixel_format_t;
/*! @brief The LCD data bus type. */
typedef enum _elcdif_lcd_data_bus
{
kELCDIF_DataBus8Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(1), /*!< 8-bit data bus. */
kELCDIF_DataBus16Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(0), /*!< 16-bit data bus, support RGB565. */
kELCDIF_DataBus18Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(2), /*!< 18-bit data bus, support RGB666. */
kELCDIF_DataBus24Bit = LCDIF_CTRL_LCD_DATABUS_WIDTH(3), /*!< 24-bit data bus, support RGB888. */
} elcdif_lcd_data_bus_t;
/*!
* @brief The register value when using different pixel format.
*
* These register bits control the pixel format:
* - CTRL[DATA_FORMAT_24_BIT]
* - CTRL[DATA_FORMAT_18_BIT]
* - CTRL[DATA_FORMAT_16_BIT]
* - CTRL[WORD_LENGTH]
* - CTRL1[BYTE_PACKING_FORMAT]
*/
typedef struct _elcdif_pixel_format_reg
{
uint32_t regCtrl; /*!< Value of register CTRL. */
uint32_t regCtrl1; /*!< Value of register CTRL1. */
} elcdif_pixel_format_reg_t;
/*!
* @brief eLCDIF configure structure for RGB mode (DOTCLK mode).
*/
typedef struct _elcdif_rgb_mode_config
{
uint16_t panelWidth; /*!< Display panel width, pixels per line. */
uint16_t panelHeight; /*!< Display panel height, how many lines per panel. */
uint8_t hsw; /*!< HSYNC pulse width. */
uint8_t hfp; /*!< Horizontal front porch. */
uint8_t hbp; /*!< Horizontal back porch. */
uint8_t vsw; /*!< VSYNC pulse width. */
uint8_t vfp; /*!< Vrtical front porch. */
uint8_t vbp; /*!< Vertical back porch. */
uint32_t polarityFlags; /*!< OR'ed value of @ref _elcdif_polarity_flags, used to contol the signal polarity. */
uint32_t bufferAddr; /*!< Frame buffer address. */
elcdif_pixel_format_t pixelFormat; /*!< Pixel format. */
elcdif_lcd_data_bus_t dataBus; /*!< LCD data bus. */
} elcdif_rgb_mode_config_t;
/*!
* @brief eLCDIF alpha surface pixel format.
*/
typedef enum _elcdif_as_pixel_format
{
kELCDIF_AsPixelFormatARGB8888 = 0x0, /*!< 32-bit pixels with alpha. */
kELCDIF_AsPixelFormatRGB888 = 0x4, /*!< 32-bit pixels without alpha (unpacked 24-bit format) */
kELCDIF_AsPixelFormatARGB1555 = 0x8, /*!< 16-bit pixels with alpha. */
kELCDIF_AsPixelFormatARGB4444 = 0x9, /*!< 16-bit pixels with alpha. */
kELCDIF_AsPixelFormatRGB555 = 0xC, /*!< 16-bit pixels without alpha. */
kELCDIF_AsPixelFormatRGB444 = 0xD, /*!< 16-bit pixels without alpha. */
kELCDIF_AsPixelFormatRGB565 = 0xE, /*!< 16-bit pixels without alpha. */
} elcdif_as_pixel_format_t;
/*!
* @brief eLCDIF alpha surface buffer configuration.
*/
typedef struct _elcdif_as_buffer_config
{
uint32_t bufferAddr; /*!< Buffer address. */
elcdif_as_pixel_format_t pixelFormat; /*!< Pixel format. */
} elcdif_as_buffer_config_t;
/*!
* @brief eLCDIF alpha mode during blending.
*/
typedef enum _elcdif_alpha_mode
{
kELCDIF_AlphaEmbedded, /*!< The alpha surface pixel alpha value will be used for blend. */
kELCDIF_AlphaOverride, /*!< The user defined alpha value will be used for blend directly. */
kELCDIF_AlphaMultiply, /*!< The alpha surface pixel alpha value scaled the user defined
alpha value will be used for blend, for example, pixel alpha set
set to 200, user defined alpha set to 100, then the reault alpha
is 200 * 100 / 255. */
kELCDIF_AlphaRop /*!< Raster operation. */
} elcdif_alpha_mode_t;
/*!
* @brief eLCDIF ROP mode during blending.
*
* Explanation:
* - AS: Alpha surface
* - PS: Process surface
* - nAS: Alpha surface NOT value
* - nPS: Process surface NOT value
*/
typedef enum _elcdif_rop_mode
{
kELCDIF_RopMaskAs = 0x0, /*!< AS AND PS. */
kELCDIF_RopMaskNotAs = 0x1, /*!< nAS AND PS. */
kELCDIF_RopMaskAsNot = 0x2, /*!< AS AND nPS. */
kELCDIF_RopMergeAs = 0x3, /*!< AS OR PS. */
kELCDIF_RopMergeNotAs = 0x4, /*!< nAS OR PS. */
kELCDIF_RopMergeAsNot = 0x5, /*!< AS OR nPS. */
kELCDIF_RopNotCopyAs = 0x6, /*!< nAS. */
kELCDIF_RopNot = 0x7, /*!< nPS. */
kELCDIF_RopNotMaskAs = 0x8, /*!< AS NAND PS. */
kELCDIF_RopNotMergeAs = 0x9, /*!< AS NOR PS. */
kELCDIF_RopXorAs = 0xA, /*!< AS XOR PS. */
kELCDIF_RopNotXorAs = 0xB /*!< AS XNOR PS. */
} elcdif_rop_mode_t;
/*!
* @brief eLCDIF alpha surface blending configuration.
*/
typedef struct _elcdif_as_blend_config
{
uint8_t alpha; /*!< User defined alpha value, only used when @ref alphaMode is @ref kELCDIF_AlphaOverride or @ref
kELCDIF_AlphaRop. */
bool invertAlpha; /*!< Set true to invert the alpha. */
elcdif_alpha_mode_t alphaMode; /*!< Alpha mode. */
elcdif_rop_mode_t ropMode; /*!< ROP mode, only valid when @ref alphaMode is @ref kELCDIF_AlphaRop. */
} elcdif_as_blend_config_t;
/*!
* @brief eLCDIF LUT
*
* The Lookup Table (LUT) is used to expand the 8 bits pixel to 24 bits pixel
* before output to external displayer.
*
* There are two 256x24 bits LUT memory in LCDIF, the LSB of frame buffer address
* determins which memory to use.
*/
typedef enum _elcdif_lut
{
kELCDIF_Lut0 = 0, /*!< LUT 0. */
kELCDIF_Lut1, /*!< LUT 1. */
} elcdif_lut_t;
/*******************************************************************************
* APIs
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif /* __cplusplus */
/*!
* @name eLCDIF initialization and de-initialization
* @{
*/
/*!
* @brief Initializes the eLCDIF to work in RGB mode (DOTCLK mode).
*
* This function ungates the eLCDIF clock and configures the eLCDIF peripheral according
* to the configuration structure.
*
* @param base eLCDIF peripheral base address.
* @param config Pointer to the configuration structure.
*/
void ELCDIF_RgbModeInit(LCDIF_Type *base, const elcdif_rgb_mode_config_t *config);
/*!
* @brief Gets the eLCDIF default configuration structure for RGB (DOTCLK) mode.
*
* This function sets the configuration structure to default values.
* The default configuration is set to the following values.
* @code
config->panelWidth = 480U;
config->panelHeight = 272U;
config->hsw = 41;
config->hfp = 4;
config->hbp = 8;
config->vsw = 10;
config->vfp = 4;
config->vbp = 2;
config->polarityFlags = kELCDIF_VsyncActiveLow |
kELCDIF_HsyncActiveLow |
kELCDIF_DataEnableActiveLow |
kELCDIF_DriveDataOnFallingClkEdge;
config->bufferAddr = 0U;
config->pixelFormat = kELCDIF_PixelFormatRGB888;
config->dataBus = kELCDIF_DataBus24Bit;
@code
*
* @param config Pointer to the eLCDIF configuration structure.
*/
void ELCDIF_RgbModeGetDefaultConfig(elcdif_rgb_mode_config_t *config);
/*!
* @brief Deinitializes the eLCDIF peripheral.
*
* @param base eLCDIF peripheral base address.
*/
void ELCDIF_Deinit(LCDIF_Type *base);
/* @} */
/*!
* @name Module operation
* @{
*/
/*!
* @brief Set the pixel format in RGB (DOTCLK) mode.
*
* @param base eLCDIF peripheral base address.
* @param pixelFormat The pixel format.
*/
void ELCDIF_RgbModeSetPixelFormat(LCDIF_Type *base, elcdif_pixel_format_t pixelFormat);
/*!
* @brief Start to display in RGB (DOTCLK) mode.
*
* @param base eLCDIF peripheral base address.
*/
static inline void ELCDIF_RgbModeStart(LCDIF_Type *base)
{
base->CTRL_SET = LCDIF_CTRL_RUN_MASK | LCDIF_CTRL_DOTCLK_MODE_MASK;
}
/*!
* @brief Stop display in RGB (DOTCLK) mode and wait until finished.
*
* @param base eLCDIF peripheral base address.
*/
void ELCDIF_RgbModeStop(LCDIF_Type *base);
/*!
* @brief Set the next frame buffer address to display.
*
* @param base eLCDIF peripheral base address.
* @param bufferAddr The frame buffer address to set.
*/
static inline void ELCDIF_SetNextBufferAddr(LCDIF_Type *base, uint32_t bufferAddr)
{
base->NEXT_BUF = bufferAddr;
}
/*!
* @brief Reset the eLCDIF peripheral.
*
* @param base eLCDIF peripheral base address.
*/
void ELCDIF_Reset(LCDIF_Type *base);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_RESET_PIN) && FSL_FEATURE_LCDIF_HAS_NO_RESET_PIN)
/*!
* @brief Pull up or down the reset pin for the externel LCD controller.
*
* @param base eLCDIF peripheral base address.
* @param pullUp True to pull up reset pin, false to pull down.
*/
static inline void ELCDIF_PullUpResetPin(LCDIF_Type *base, bool pullUp)
{
if (pullUp)
{
base->CTRL1_SET = LCDIF_CTRL1_RESET_MASK;
}
else
{
base->CTRL1_CLR = LCDIF_CTRL1_RESET_MASK;
}
}
#endif
/*!
* @brief Enable or disable the hand shake with PXP.
*
* @param base eLCDIF peripheral base address.
* @param enable True to enable, false to disable.
*/
static inline void ELCDIF_EnablePxpHandShake(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->CTRL_SET = LCDIF_CTRL_ENABLE_PXP_HANDSHAKE_MASK;
}
else
{
base->CTRL_CLR = LCDIF_CTRL_ENABLE_PXP_HANDSHAKE_MASK;
}
}
/* @} */
/*!
* @name Status
* @{
*/
/*!
* @brief Get the CRC value of the frame sent out.
*
* When a frame is sent complete (the interrupt @ref kELCDIF_CurFrameDone assert), this function
* can be used to get the CRC value of the frame sent.
*
* @param base eLCDIF peripheral base address.
* @return The CRC value.
*
* @note The CRC value is dependent on the LCD_DATABUS_WIDTH.
*/
static inline uint32_t ELCDIF_GetCrcValue(LCDIF_Type *base)
{
return base->CRC_STAT;
}
/*!
* @brief Get the bus master error virtual address.
*
* When bus master error occurs (the interrupt kELCDIF_BusMasterError assert), this function
* can get the virtual address at which the AXI master received an error
* response from the slave.
*
* @param base eLCDIF peripheral base address.
* @return The error virtual address.
*/
static inline uint32_t ELCDIF_GetBusMasterErrorAddr(LCDIF_Type *base)
{
return base->BM_ERROR_STAT;
}
/*!
* @brief Get the eLCDIF status.
*
* The status flags are returned as a mask value, application could check the
* corresponding bit. Example:
*
* @code
uint32_t statusFlags;
statusFlags = ELCDIF_GetStatus(LCDIF);
if (kELCDIF_LFifoFull & statusFlags)
{
}
if (kELCDIF_TxFifoEmpty & statusFlags)
{
}
@endcode
*
* @param base eLCDIF peripheral base address.
* @return The mask value of status flags, it is OR'ed value of @ref _elcdif_status_flags.
*/
static inline uint32_t ELCDIF_GetStatus(LCDIF_Type *base)
{
return base->STAT & (LCDIF_STAT_LFIFO_FULL_MASK | LCDIF_STAT_LFIFO_EMPTY_MASK | LCDIF_STAT_TXFIFO_FULL_MASK |
LCDIF_STAT_TXFIFO_EMPTY_MASK
#if defined(LCDIF_STAT_BUSY_MASK)
| LCDIF_STAT_BUSY_MASK
#endif
#if defined(LCDIF_STAT_DVI_CURRENT_FIELD_MASK)
| LCDIF_STAT_DVI_CURRENT_FIELD_MASK
#endif
);
}
/*!
* @brief Get current count in Latency buffer (LFIFO).
*
* @param base eLCDIF peripheral base address.
* @return The LFIFO current count
*/
static inline uint32_t ELCDIF_GetLFifoCount(LCDIF_Type *base)
{
return (base->STAT & LCDIF_STAT_LFIFO_COUNT_MASK) >> LCDIF_STAT_LFIFO_COUNT_SHIFT;
}
/* @} */
/*!
* @name Interrupts
* @{
*/
/*!
* @brief Enables eLCDIF interrupt requests.
*
* @param base eLCDIF peripheral base address.
* @param mask interrupt source, OR'ed value of _elcdif_interrupt_enable.
*/
static inline void ELCDIF_EnableInterrupts(LCDIF_Type *base, uint32_t mask)
{
base->CTRL1_SET = (mask & ELCDIF_CTRL1_IRQ_EN_MASK);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_AS) && FSL_FEATURE_LCDIF_HAS_NO_AS)
base->AS_CTRL |= (mask & ELCDIF_AS_CTRL_IRQ_EN_MASK);
#endif
}
/*!
* @brief Disables eLCDIF interrupt requests.
*
* @param base eLCDIF peripheral base address.
* @param mask interrupt source, OR'ed value of _elcdif_interrupt_enable.
*/
static inline void ELCDIF_DisableInterrupts(LCDIF_Type *base, uint32_t mask)
{
base->CTRL1_CLR = (mask & ELCDIF_CTRL1_IRQ_EN_MASK);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_AS) && FSL_FEATURE_LCDIF_HAS_NO_AS)
base->AS_CTRL &= ~(mask & ELCDIF_AS_CTRL_IRQ_EN_MASK);
#endif
}
/*!
* @brief Get eLCDIF interrupt peding status.
*
* @param base eLCDIF peripheral base address.
* @return Interrupt pending status, OR'ed value of _elcdif_interrupt_flags.
*/
static inline uint32_t ELCDIF_GetInterruptStatus(LCDIF_Type *base)
{
uint32_t flags;
flags = (base->CTRL1 & ELCDIF_CTRL1_IRQ_MASK);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_AS) && FSL_FEATURE_LCDIF_HAS_NO_AS)
flags |= (base->AS_CTRL & ELCDIF_AS_CTRL_IRQ_MASK);
#endif
return flags;
}
/*!
* @brief Clear eLCDIF interrupt peding status.
*
* @param base eLCDIF peripheral base address.
* @param mask of the flags to clear, OR'ed value of _elcdif_interrupt_flags.
*/
static inline void ELCDIF_ClearInterruptStatus(LCDIF_Type *base, uint32_t mask)
{
base->CTRL1_CLR = (mask & ELCDIF_CTRL1_IRQ_MASK);
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_AS) && FSL_FEATURE_LCDIF_HAS_NO_AS)
base->AS_CTRL &= ~(mask & ELCDIF_AS_CTRL_IRQ_MASK);
#endif
}
/* @} */
#if !(defined(FSL_FEATURE_LCDIF_HAS_NO_AS) && FSL_FEATURE_LCDIF_HAS_NO_AS)
/*!
* @name Alpha surface
* @{
*/
/*!
* @brief Set the configuration for alpha surface buffer.
*
* @param base eLCDIF peripheral base address.
* @param config Pointer to the configuration structure.
*/
void ELCDIF_SetAlphaSurfaceBufferConfig(LCDIF_Type *base, const elcdif_as_buffer_config_t *config);
/*!
* @brief Set the alpha surface blending configuration.
*
* @param base eLCDIF peripheral base address.
* @param config Pointer to the configuration structure.
*/
void ELCDIF_SetAlphaSurfaceBlendConfig(LCDIF_Type *base, const elcdif_as_blend_config_t *config);
/*!
* @brief Set the next alpha surface buffer address.
*
* @param base eLCDIF peripheral base address.
* @param bufferAddr Alpha surface buffer address.
*/
static inline void ELCDIF_SetNextAlphaSurfaceBufferAddr(LCDIF_Type *base, uint32_t bufferAddr)
{
base->AS_NEXT_BUF = bufferAddr;
}
/*!
* @brief Set the overlay color key.
*
* If a pixel in the current overlay image with a color that falls in the range
* from the @p colorKeyLow to @p colorKeyHigh range, it will use the process surface
* pixel value for that location.
*
* @param base eLCDIF peripheral base address.
* @param colorKeyLow Color key low range.
* @param colorKeyHigh Color key high range.
*
* @note Colorkey operations are higher priority than alpha or ROP operations
*/
static inline void ELCDIF_SetOverlayColorKey(LCDIF_Type *base, uint32_t colorKeyLow, uint32_t colorKeyHigh)
{
base->AS_CLRKEYLOW = colorKeyLow;
base->AS_CLRKEYHIGH = colorKeyHigh;
}
/*!
* @brief Enable or disable the color key.
*
* @param base eLCDIF peripheral base address.
* @param enable True to enable, false to disable.
*/
static inline void ELCDIF_EnableOverlayColorKey(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->AS_CTRL |= LCDIF_AS_CTRL_ENABLE_COLORKEY_MASK;
}
else
{
base->AS_CTRL &= ~LCDIF_AS_CTRL_ENABLE_COLORKEY_MASK;
}
}
/*!
* @brief Enable or disable the alpha surface.
*
* @param base eLCDIF peripheral base address.
* @param enable True to enable, false to disable.
*/
static inline void ELCDIF_EnableAlphaSurface(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->AS_CTRL |= LCDIF_AS_CTRL_AS_ENABLE_MASK;
}
else
{
base->AS_CTRL &= ~LCDIF_AS_CTRL_AS_ENABLE_MASK;
}
}
/*!
* @brief Enable or disable the process surface.
*
* Process surface is the normal frame buffer. The process surface content
* is controlled by @ref ELCDIF_SetNextBufferAddr.
*
* @param base eLCDIF peripheral base address.
* @param enable True to enable, false to disable.
*/
static inline void ELCDIF_EnableProcessSurface(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->AS_CTRL &= ~LCDIF_AS_CTRL_PS_DISABLE_MASK;
}
else
{
base->AS_CTRL |= LCDIF_AS_CTRL_PS_DISABLE_MASK;
}
}
/* @} */
#endif /* FSL_FEATURE_LCDIF_HAS_NO_AS */
#if (defined(FSL_FEATURE_LCDIF_HAS_LUT) && FSL_FEATURE_LCDIF_HAS_LUT)
/*!
* @name LUT
*
* The Lookup Table (LUT) is used to expand the 8 bits pixel to 24 bits pixel
* before output to external displayer.
*
* There are two 256x24 bits LUT memory in LCDIF, the LSB of frame buffer address
* determins which memory to use.
*
* @{
*/
/*!
* @brief Enable or disable the LUT.
*
* @param base eLCDIF peripheral base address.
* @param enable True to enable, false to disable.
*/
static inline void ELCDIF_EnableLut(LCDIF_Type *base, bool enable)
{
if (enable)
{
base->LUT_CTRL &= ~LCDIF_LUT_CTRL_LUT_BYPASS_MASK;
}
else
{
base->LUT_CTRL |= LCDIF_LUT_CTRL_LUT_BYPASS_MASK;
}
}
/*!
* @brief Load the LUT value.
*
* This function loads the LUT value to the specific LUT memory, user can
* specify the start entry index.
*
* @param base eLCDIF peripheral base address.
* @param lut Which LUT to load.
* @param startIndex The start index of the LUT entry to update.
* @param lutData The LUT data to load.
* @param count Count of @p lutData.
* @retval kStatus_Success Initialization success.
* @retval kStatus_InvalidArgument Wrong argument.
*/
status_t ELCDIF_UpdateLut(
LCDIF_Type *base, elcdif_lut_t lut, uint16_t startIndex, const uint32_t *lutData, uint16_t count);
/* @} */
#endif /* FSL_FEATURE_LCDIF_HAS_LUT */
#if defined(__cplusplus)
}
#endif /* __cplusplus */
/* @} */
#endif /*_FSL_ELCDIF_H_*/
| [
"jie.heng@nxp.com"
] | jie.heng@nxp.com |
fc2f2fc3f3ab5920563455ebe43d334e723b728c | af7c753cfbc9309e1276d12e2e29fbbd6d7602ce | /Firmware/ESP8266/Clay_ESP8266EX_Firmware/user/Message.c | 22acdc922d747c3a6b001c8467ec576401269790 | [
"MIT"
] | permissive | zzrgenius/Clay | b179c64f2348449f6766ba356af5daecf90639e5 | 31a84237d09eb93affb9b2587ff1d5b9a2b8c6a6 | refs/heads/master | 2021-05-31T08:29:51.309212 | 2016-06-05T04:52:12 | 2016-06-05T04:52:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,414 | c | #include "stdlib.h"
#include "stdint.h"
#include "stdio.h"
#include "string.h"
#include "Message.h"
#include "CRC16.h"
#define DEFAULT_UUID_LENGTH 37
char messageUuidBuffer[DEFAULT_UUID_LENGTH] =
{ 0 };
char grammarSymbolBuffer[MAXIMUM_GRAMMAR_SYMBOL_LENGTH] =
{ 0 };
Message* Create_Message()
{
// Allocate memory for message structure.
Message *message = (Message *) malloc(sizeof(Message));
(*message).message_type = NULL;
(*message).source = NULL;
(*message).destination = NULL;
(*message).content_length = 0;
(*message).content_checksum = 0;
(*message).content_type = NULL;
(*message).content = NULL;
// Set up links for queue
(*message).previous = NULL;
(*message).next = NULL;
return message;
}
int8_t Delete_Message(Message *message)
{
if (message != NULL)
{
// TODO: Remove references to the message in the queue.
if ((*message).message_type != NULL)
{
free((*message).message_type);
(*message).message_type = NULL;
}
if ((*message).source != NULL)
{
free((*message).source);
(*message).source = NULL;
}
if ((*message).destination != NULL)
{
free((*message).destination);
(*message).destination = NULL;
}
if ((*message).content_type != NULL)
{
free((*message).content_type);
(*message).content_type = NULL;
}
if ((*message).content != NULL)
{
free((*message).content);
(*message).content = NULL;
}
free(message);
message = NULL;
return true;
}
return false;
}
void Set_Message_Type(Message *message, const char *type)
{
// Free the message's destination stored type from memory
if ((*message).message_type != NULL)
{
free((*message).message_type);
(*message).message_type = NULL;
}
// Copy the type into the structure
(*message).message_type = (char *) zalloc(strlen(type) + 1);
memset((*message).message_type, '\0', strlen(type) + 1);
strcpy((*message).message_type, type);
}
void Set_Message_Source(Message *message, const char *address)
{
// Free the message's destination address from memory
if ((*message).source != NULL)
{
free((*message).source);
(*message).source = NULL;
}
// Copy the message destination address
(*message).source = (char *) zalloc(strlen(address) + 1);
memset((*message).source, '\0', strlen(address) + 1);
strcpy((*message).source, address);
}
void Set_Message_Destination(Message *message, const char *address)
{
// Free the message's destination address from memory
if ((*message).destination != NULL)
{
free((*message).destination);
(*message).destination = NULL;
}
// Copy the message destination address
(*message).destination = (char *) zalloc(strlen(address) + 1);
memset((*message).destination, '\0', strlen(address) + 1);
strcpy((*message).destination, address);
}
void Set_Message_Content(Message * message, const char *content,
uint32_t content_length)
{
if ((*message).content != NULL)
{
free((*message).content);
(*message).content = NULL;
(*message).content_length = 0;
(*message).content_checksum = 0;
}
(*message).content_length = content_length;
// Allocate memory for the message's content.
(*message).content = (char *) malloc((*message).content_length + 1);
(*message).content_checksum = Calculate_Checksum_On_Bytes(content,
content_length);
memset((*message).content, 0, (*message).content_length + 1);
// Copy message content
memcpy((*message).content, content, (*message).content_length);
}
extern void Set_Message_Content_Type(Message *message, const char *content_type)
{
// Free the message's destination address from memory
if ((*message).content_type != NULL)
{
free((*message).content_type);
(*message).content_type = NULL;
}
// Copy the message content_type address
(*message).content_type = (char *) malloc(strlen(content_type) + 1);
memset((*message).content_type, '\0', strlen(content_type) + 1);
strcpy((*message).content_type, content_type);
}
char * Get_Message_Type(Message *message)
{
return (*message).message_type;
}
char * Get_Message_Source(Message *message)
{
return (*message).source;
}
char * Get_Message_Destination(Message *message)
{
return (*message).destination;
}
char * Get_Message_Content(Message *message)
{
return (*message).content;
}
uint32_t Get_Message_Content_Length(Message *message)
{
return (*message).content_length;
}
char * Get_Message_Content_Type(Message *message)
{
return (*message).message_type;
}
| [
"thebhef@gmail.com"
] | thebhef@gmail.com |
be5e0fd30545eef4145079ab6832219510e984f0 | 7774f5fa84edbe372df5bbb536e8b07b51306681 | /Temp/StagingArea/Data/il2cppOutput/t1295.h | a44fa6b78fca3271b53f369182495cb1f49677c2 | [] | no_license | 1jeffcohen/Mr-Turtle-Breaks-Free | 677f4792b30ac3041e1454e6027a64478ec18a05 | 360506196b46e3b8234cf732230b266e655975e1 | refs/heads/master | 2016-09-01T16:24:29.294516 | 2015-10-08T21:46:23 | 2015-10-08T21:46:23 | 43,917,971 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 215 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
struct t322;
#include "t14.h"
struct t1295 : public t14
{
t322* f0;
};
| [
"1jeffcohen@gmail.com"
] | 1jeffcohen@gmail.com |
56b300ff87268a31a62843dc4f6b607b18532df6 | afc8d5a9b1c2dd476ea59a7211b455732806fdfd | /Configurations/VBF/Full2016BDT/mymacros/hww_VBF_mvaBDT14.C | 05f3a8592e7615fe79e28e06efd226fbe8cf6bec | [] | no_license | latinos/PlotsConfigurations | 6d88a5ad828dde4a7f45c68765081ed182fcda21 | 02417839021e2112e740607b0fb78e09b58c930f | refs/heads/master | 2023-08-18T20:39:31.954943 | 2023-08-18T09:23:34 | 2023-08-18T09:23:34 | 39,819,875 | 10 | 63 | null | 2023-08-10T14:08:04 | 2015-07-28T07:36:50 | Python | UTF-8 | C | false | false | 2,101 | c | #include <TMVA/Reader.h>
using namespace std;
TMVA::Reader* myreaderBDT14 = new TMVA::Reader();
// float lepton_pt1;
// float lepton_pt2;
float mll_52;
float mjj_52;
float jetpt1_52;
float jetpt2_52;
float detajj_52;
// float ptll_52;
float jeteta1_52;
float jeteta2_52;
float met_52;
float mth_52;
void initmyreaderBDT14(){
// myreaderBDT14->AddVariable( "std_vector_lepton_pt[0]", &lepton_pt1 );
// myreaderBDT14->AddVariable( "std_vector_lepton_pt[1]", &lepton_pt2 );
myreaderBDT14->AddVariable( "mll", &mll_52 );
myreaderBDT14->AddVariable( "mjj", &mjj_52 );
myreaderBDT14->AddVariable( "jetpt1", &jetpt1_52 );
myreaderBDT14->AddVariable( "jetpt2", &jetpt2_52 );
myreaderBDT14->AddVariable( "detajj",&detajj_52);
// myreaderBDT14->AddVariable( "ptll", &ptll_52 );
myreaderBDT14->AddVariable( "jeteta1", &jeteta1_52);
myreaderBDT14->AddVariable( "jeteta2", &jeteta2_52);
myreaderBDT14->AddVariable( "metPfType1",&met_52);
myreaderBDT14->AddVariable( "mth",&mth_52);
TString direction = "";
direction = "/afs/cern.ch/work/a/arun/Latinos/HWW_Full2016/CMSSW_8_0_26_patch1/src/MUCCA/Optimization/weights/VBF_INCL_TMVAClassification_VBF_new_BDT14.weights.xml";
cout<<direction<<endl;
myreaderBDT14->BookMVA("BDT14",direction);
}
float hww_VBF_mvaBDT14(
//float leppt1,
// float leppt2,
float mll_53,
float mjj_53,
float jetpt1_53,
float jetpt2_53,
float detajj_53,
// float ptllf,
float jeteta1_53,
float jeteta2_53,
float met_53,
float mth_53
){
// lepton_pt1 = leppt1;
// lepton_pt2 = leppt2;
mll_52 = mll_53;
mjj_52 = mjj_53;
jetpt1_52 = jetpt1_53;
jetpt2_52 = jetpt2_53;
detajj_52 = detajj_53;
// ptll_52 = ptllf;
jeteta1_52 = jeteta1_53;
jeteta2_52 = jeteta2_53;
met_52 = met_53;
mth_52 = mth_53;
//cout<<"BEFORE READING!!!!!!-------"<<endl;
return myreaderBDT14->EvaluateMVA("BDT14");
}
| [
"arun.kumar@cern.ch"
] | arun.kumar@cern.ch |
885767f5ed2f17df19164d9915b241118b43e746 | ea09f69660a8982a94c15adf66bdc99531b4b8aa | /0x0D-preprocessor/3-function_like_macro.h | d1f7f2ae20be34fd19be81d0c13622ce7b90d75d | [] | no_license | gorgyboy/holbertonschool-low_level_programming | 96ff91a00c4373ca77b513a6ba81fa78b6a4374f | ac3660f83e207417ff2a01f0992f14f2bd998515 | refs/heads/master | 2020-12-29T08:33:48.049008 | 2020-12-01T08:18:05 | 2020-12-01T08:18:05 | 238,536,274 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 95 | h | #ifndef FLM_H
#define FLM_H
#define ABS(x) (((x) < 0) ? ((x) * -1) : (x))
#endif /* FLM_H */
| [
"jlrogb@gmail.com"
] | jlrogb@gmail.com |
955a4350db196e2dfccbde697d8e1be98beea1a8 | 67d65e4ba2381b7a8ca36afb3189085512fa8197 | /HttpRequest/pheader.h | ea0122c8936c4bf488c1cb0fe940583c0e1a39a3 | [] | no_license | Ryan--Yang/winpcap | 6a06a8317e98b6957c3a38b7be3a22077963a1f7 | f844dd097887d45da6b81fd26e6a914d6ce08b56 | refs/heads/master | 2020-02-26T13:23:18.383554 | 2013-04-07T11:53:51 | 2013-04-07T11:53:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,983 | h | #ifndef PHEADER_H_INCLUDED
#define PHEADER_H_INCLUDED
/*
*
*/
#define ETHER_ADDR_LEN 6 /* ethernet address */
#define ETHERTYPE_IP 0x0800 /* ip protocol */
#define TCP_PROTOCAL 0x0600 /* tcp protocol */
#define BUFFER_MAX_LENGTH 65536 /* buffer max length */
#define true 1 /* define true */
#define false 0 /* define false */
/*
* define struct of ethernet header , ip address , ip header and tcp header
*/
/* ethernet header */
typedef struct ether_header {
u_char ether_shost[ETHER_ADDR_LEN]; /* source ethernet address, 8 bytes */
u_char ether_dhost[ETHER_ADDR_LEN]; /* destination ethernet addresss, 8 bytes */
u_short ether_type; /* ethernet type, 16 bytes */
}ether_header;
/* four bytes ip address */
typedef struct ip_address {
u_char byte1;
u_char byte2;
u_char byte3;
u_char byte4;
}ip_address;
/* ipv4 header */
typedef struct ip_header {
u_char ver_ihl; /* version and ip header length */
u_char tos; /* type of service */
u_short tlen; /* total length */
u_short identification; /* identification */
u_short flags_fo; // flags and fragment offset
u_char ttl; /* time to live */
u_char proto; /* protocol */
u_short crc; /* header checksum */
ip_address saddr; /* source address */
ip_address daddr; /* destination address */
u_int op_pad; /* option and padding */
}ip_header;
/* tcp header */
typedef struct tcp_header {
u_short th_sport; /* source port */
u_short th_dport; /* destination port */
u_int th_seq; /* sequence number */
u_int th_ack; /* acknowledgement number */
u_short th_len_resv_code; /* datagram length and reserved code */
u_short th_window; /* window */
u_short th_sum; /* checksum */
u_short th_urp; /* urgent pointer */
}tcp_header;
#endif // PHEADER_H_INCLUDED
| [
"yfnick2010@gmail.com"
] | yfnick2010@gmail.com |
59756cdc7478a47f4c2393d8d2fc18e6c812af5b | d0c4232f57b408e9d4de4813a28e0b4396772d05 | /gems/gems/libxml-ruby-0.9.4/ext/libxml/ruby_xml_document.c | 467b3a069fd8e594e2bec5592a4c5555d7585916 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | larssg/group-shelf | 8a154feb39a820b66411d54a25f4d066cd87b894 | fa1a0156c62b9ea3694180ba415bacc77a3cabb9 | refs/heads/master | 2020-04-13T13:42:48.417264 | 2008-12-07T16:38:00 | 2008-12-07T16:38:00 | 81,270 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 24,922 | c | /* $Id: ruby_xml_document.c 626 2008-11-22 20:47:07Z cfis $ */
/*
* Document-class: LibXML::XML::Document
*
* The XML::Document class provides a tree based API for working
* with xml documents. You may directly create a document and
* manipulate it, or create a document from a data source by
* using an XML::Parser object.
*
* To create a document from scratch:
*
* doc = XML::Document.new()
* doc.root = XML::Node.new('root_node')
* doc.root << XML::Node.new('elem1')
* doc.save('output.xml', format)
*
* To read a document from a file:
*
* doc = XML::Document.file('my_file')
*
* To use a parser to read a document:
*
* parser = XML::Parser.new
* parser.file = 'my_file'
* doc = parser.parse
*
* To write a file:
*
*
* doc = XML::Document.new()
* doc.root = XML::Node.new('root_node')
* root = doc.root
*
* root << elem1 = XML::Node.new('elem1')
* elem1['attr1'] = 'val1'
* elem1['attr2'] = 'val2'
*
* root << elem2 = XML::Node.new('elem2')
* elem2['attr1'] = 'val1'
* elem2['attr2'] = 'val2'
*
* root << elem3 = XML::Node.new('elem3')
* elem3 << elem4 = XML::Node.new('elem4')
* elem3 << elem5 = XML::Node.new('elem5')
*
* elem5 << elem6 = XML::Node.new('elem6')
* elem6 << 'Content for element 6'
*
* elem3['attr'] = 'baz'
*
* format = true
* doc.save('output.xml', format)
*/
#include <stdarg.h>
#include <st.h>
#include "ruby_libxml.h"
#include "ruby_xml_document.h"
VALUE cXMLDocument;
void
rxml_document_free(xmlDocPtr xdoc) {
xdoc->_private = NULL;
xmlFreeDoc(xdoc);
}
void
rxml_document_mark(xmlDocPtr xdoc) {
rb_gc_mark(LIBXML_STATE);
}
VALUE
rxml_document_wrap(xmlDocPtr xdoc) {
VALUE result;
// This node is already wrapped
if (xdoc->_private != NULL)
{
result = (VALUE)xdoc->_private;
}
else
{
result = Data_Wrap_Struct(cXMLDocument, rxml_document_mark, rxml_document_free, xdoc);
xdoc->_private = (void*)result;
}
return result;
}
/*
* call-seq:
* XML::Document.alloc(xml_version = 1.0) -> document
*
* Alocates a new XML::Document, optionally specifying the
* XML version.
*/
static VALUE
rxml_document_alloc(VALUE klass) {
return Data_Wrap_Struct(klass, rxml_document_mark, rxml_document_free, NULL);
}
/*
* call-seq:
* XML::Document.initialize(xml_version = 1.0) -> document
*
* Initializes a new XML::Document, optionally specifying the
* XML version.
*/
static VALUE
rxml_document_initialize(int argc, VALUE *argv, VALUE self) {
xmlDocPtr xdoc;
VALUE xmlver;
switch (argc) {
case 0:
xmlver = rb_str_new2("1.0");
break;
case 1:
rb_scan_args(argc, argv, "01", &xmlver);
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (need 0 or 1)");
}
Check_Type(xmlver, T_STRING);
xdoc = xmlNewDoc((xmlChar*)StringValuePtr(xmlver));
xdoc->_private = (void*)self;
DATA_PTR(self) = xdoc;
return self;
}
/*
* call-seq:
* document.compression -> num
*
* Obtain this document's compression mode identifier.
*/
static VALUE
rxml_document_compression_get(VALUE self) {
#ifdef HAVE_ZLIB_H
xmlDocPtr xdoc;
int compmode;
Data_Get_Struct(self, xmlDoc, xdoc);
compmode = xmlGetDocCompressMode(xdoc);
if (compmode == -1)
return(Qnil);
else
return(INT2NUM(compmode));
#else
rb_warn("libxml not compiled with zlib support");
return(Qfalse);
#endif
}
/*
* call-seq:
* document.compression = num
*
* Set this document's compression mode.
*/
static VALUE
rxml_document_compression_set(VALUE self, VALUE num) {
#ifdef HAVE_ZLIB_H
xmlDocPtr xdoc;
int compmode;
Check_Type(num, T_FIXNUM);
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL) {
return(Qnil);
} else {
xmlSetDocCompressMode(xdoc, NUM2INT(num));
compmode = xmlGetDocCompressMode(xdoc);
if (compmode == -1)
return(Qnil);
else
return(INT2NUM(compmode));
}
#else
rb_warn("libxml compiled without zlib support");
return(Qfalse);
#endif
}
/*
* call-seq:
* document.compression? -> (true|false)
*
* Determine whether this document is compressed.
*/
static VALUE
rxml_document_compression_q(VALUE self) {
#ifdef HAVE_ZLIB_H
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->compression != -1)
return(Qtrue);
else
return(Qfalse);
#else
rb_warn("libxml compiled without zlib support");
return(Qfalse);
#endif
}
/*
* call-seq:
* document.child -> node
*
* Get this document's child node.
*/
static VALUE
rxml_document_child_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->children == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xdoc->children);
}
/*
* call-seq:
* document.child? -> (true|false)
*
* Determine whether this document has a child node.
*/
static VALUE
rxml_document_child_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->children == NULL)
return(Qfalse);
else
return(Qtrue);
}
/*
* call-seq:
* document.dump([stream]) -> true
*
* Dump this document's XML to the specified IO stream.
* If no stream is specified, stdout is used.
*/
static VALUE
rxml_document_dump(int argc, VALUE *argv, VALUE self) {
OpenFile *fptr;
VALUE io;
FILE *out;
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL)
return(Qnil);
switch (argc) {
case 0:
io = rb_stdout;
break;
case 1:
io = argv[0];
if (!rb_obj_is_kind_of(io, rb_cIO))
rb_raise(rb_eTypeError, "need an IO object");
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
}
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
out = GetWriteFile(fptr);
xmlDocDump(out, xdoc);
return(Qtrue);
}
/*
* call-seq:
* document.debug_dump([stream]) -> true
*
* Debug version of dump.
*/
static VALUE
rxml_document_debug_dump(int argc, VALUE *argv, VALUE self) {
#ifdef LIBXML_DEBUG_ENABLED
OpenFile *fptr;
VALUE io;
FILE *out;
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL)
return(Qnil);
switch (argc) {
case 0:
io = rb_stderr;
break;
case 1:
io = argv[0];
if (!rb_obj_is_kind_of(io, rb_cIO))
rb_raise(rb_eTypeError, "need an IO object");
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
}
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
out = GetWriteFile(fptr);
xmlDebugDumpDocument(out, xdoc);
return(Qtrue);
#else
rb_warn("libxml was compiled without debugging support. Please recompile libxml and ruby-libxml");
return(Qfalse);
#endif
}
/*
* call-seq:
* document.debug_dump_head([stream]) -> true
*
* Debug-dump this document's header to the specified IO stream.
* If no stream is specified, stdout is used.
*/
static VALUE
rxml_document_debug_dump_head(int argc, VALUE *argv, VALUE self) {
#ifdef LIBXML_DEBUG_ENABLED
OpenFile *fptr;
VALUE io;
FILE *out;
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL)
return(Qnil);
switch (argc) {
case 0:
io = rb_stdout;
break;
case 1:
io = argv[0];
if (!rb_obj_is_kind_of(io, rb_cIO))
rb_raise(rb_eTypeError, "need an IO object");
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
}
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
out = GetWriteFile(fptr);
xmlDebugDumpDocumentHead(out, xdoc);
return(Qtrue);
#else
rb_warn("libxml was compiled without debugging support. Please recompile libxml and ruby-libxml");
return(Qfalse);
#endif
}
/*
* call-seq:
* document.format_dump([stream], [spacing]) -> true
*
* Dump this document's formatted XML to the specified IO stream.
* If no stream is specified, stdout is used. If spacing is
* specified, it must be a boolean that determines whether
* spacing is used.
*/
static VALUE
rxml_document_format_dump(int argc, VALUE *argv, VALUE self) {
OpenFile *fptr;
VALUE bool, io;
FILE *out;
xmlDocPtr xdoc;
int size, spacing;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL)
return(Qnil);
switch (argc) {
case 0:
io = rb_stdout;
spacing = 1;
break;
case 1:
io = argv[0];
if (!rb_obj_is_kind_of(io, rb_cIO))
rb_raise(rb_eTypeError, "need an IO object");
spacing = 1;
break;
case 2:
io = argv[0];
if (!rb_obj_is_kind_of(io, rb_cIO))
rb_raise(rb_eTypeError, "need an IO object");
bool = argv[1];
if (TYPE(bool) == T_TRUE)
spacing = 1;
else if (TYPE(bool) == T_FALSE)
spacing = 0;
else
rb_raise(rb_eTypeError, "incorect argument type, second argument must be bool");
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
}
GetOpenFile(io, fptr);
rb_io_check_writable(fptr);
out = GetWriteFile(fptr);
size = xmlDocFormatDump(out, xdoc, spacing);
return(INT2NUM(size));
}
/*
* call-seq:
* document.debug_format_dump([stream]) -> true
*
* *Deprecated* in favour of format_dump.
*/
static VALUE
rxml_document_debug_format_dump(int argc, VALUE *argv, VALUE self) {
rb_warn("debug_format_dump has been deprecaited, use format_dump instead");
return(rxml_document_format_dump(argc, argv, self));
}
/*
* call-seq:
* document.encoding -> "encoding"
*
* Obtain the encoding specified by this document.
*/
static VALUE
rxml_document_encoding_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->encoding == NULL)
return(Qnil);
else
return(rb_str_new2((const char*)xdoc->encoding));
}
/*
* call-seq:
* document.encoding = "encoding"
*
* Set the encoding for this document.
*/
static VALUE
rxml_document_encoding_set(VALUE self, VALUE encoding) {
xmlDocPtr xdoc;
Check_Type(encoding, T_STRING);
Data_Get_Struct(self, xmlDoc, xdoc);
xdoc->encoding = xmlStrdup(StringValuePtr(encoding));
return(rxml_document_encoding_get(self));
}
/*
* call-seq:
* document.last -> node
*
* Obtain the last node.
*/
static VALUE
rxml_document_last_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->last == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xdoc->last);
}
/*
* call-seq:
* document.last? -> (true|false)
*
* Determine whether there is a last node.
*/
static VALUE
rxml_document_last_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->last == NULL)
return(Qfalse);
else
return(Qtrue);
}
/*
* call-seq:
* document.next -> node
*
* Obtain the next node.
*/
static VALUE
rxml_document_next_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->next == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xdoc->next);
}
/*
* call-seq:
* document.next? -> (true|false)
*
* Determine whether there is a next node.
*/
static VALUE
rxml_document_next_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->next == NULL)
return(Qfalse);
else
return(Qtrue);
}
/*
* call-seq:
* document.parent -> node
*
* Obtain the parent node.
*/
static VALUE
rxml_document_parent_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->parent == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xdoc->parent);
}
/*
* call-seq:
* document.parent? -> (true|false)
*
* Determine whether there is a parent node.
*/
static VALUE
rxml_document_parent_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->parent == NULL)
return(Qfalse);
else
return(Qtrue);
}
/*
* call-seq:
* document.prev -> node
*
* Obtain the previous node.
*/
static VALUE
rxml_document_prev_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->prev == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xdoc->prev);
}
/*
* call-seq:
* document.prev? -> (true|false)
*
* Determine whether there is a previous node.
*/
static VALUE
rxml_document_prev_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->prev == NULL)
return(Qfalse);
else
return(Qtrue);
}
/*
* call-seq:
* document.root -> node
*
* Obtain the root node.
*/
static VALUE
rxml_document_root_get(VALUE self) {
xmlDocPtr xdoc;
xmlNodePtr root;
Data_Get_Struct(self, xmlDoc, xdoc);
root = xmlDocGetRootElement(xdoc);
if (root == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, root);
}
/*
* call-seq:
* document.root = node
*
* Set the root node.
*/
static VALUE
rxml_document_root_set(VALUE self, VALUE node) {
xmlDocPtr xdoc;
xmlNodePtr xroot, xnode;
if (rb_obj_is_kind_of(node, cXMLNode) == Qfalse)
rb_raise(rb_eTypeError, "must pass an XML::Node type object");
Data_Get_Struct(self, xmlDoc, xdoc);
Data_Get_Struct(node, xmlNode, xnode);
xroot = xmlDocSetRootElement(xdoc, xnode);
if (xroot == NULL)
return(Qnil);
return rxml_node2_wrap(cXMLNode, xroot);
}
/*
* call-seq:
* document.save(filename, format = false) -> int
*
* Save this document to the file given by filename,
* optionally formatting the output.
* Parameters:
* filename: The filename or URL of the new document
* format: Specifies whether formatting spaces should be added.
* returns: The number of bytes written or -1 in case of error.
*/
static VALUE
rxml_document_save(int argc, VALUE *argv, VALUE self) {
xmlDocPtr xdoc;
const char *filename;
int format = 0;
int len;
if (argc <1 || argc > 2)
rb_raise(rb_eArgError, "wrong number of arguments (need 1 or 2)");
Check_Type(argv[0], T_STRING);
filename = StringValuePtr(argv[0]);
if (argc == 2)
{
switch (TYPE(argv[1])) {
case T_TRUE:
format = 1;
break;
case T_FALSE:
format = 0;
break;
default:
rb_raise(rb_eArgError, "The second parameter (format) must be true or false");
}
}
Data_Get_Struct(self, xmlDoc, xdoc);
len = xmlSaveFormatFileEnc(filename, xdoc, (const char*)xdoc->encoding, format);
if (len == -1)
rb_raise(rb_eIOError, "Could not write document");
else
return(INT2NUM(len));
}
/*
* call-seq:
* document.standalone? -> (true|false)
*
* Determine whether this is a standalone document.
*/
static VALUE
rxml_document_standalone_q(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->standalone)
return(Qtrue);
else
return(Qfalse);
}
/*
* call-seq:
* document.to_s({format=true,encoding) -> "xml"
*
* Coerce this document to a string representation
* of it's XML. The default is to pretty format, but this
* depends Parser#indent_tree_output==true or
* Parser#default_keep_blanks==false.
*
* The encoding is not applied to the document, but is
* encoding target of the resulting string.
*/
static VALUE
rxml_document_to_s(int argc, VALUE *argv, VALUE self) {
xmlDocPtr xdoc;
xmlChar *result, *encoding=NULL;
int format, len;
VALUE rresult;
switch (argc) {
case 0:
format = 1;
break;
case 2:
if (TYPE(argv[1]) == T_STRING)
encoding=(xmlChar *)StringValuePtr(argv[1]);
case 1:
if (TYPE(argv[0]) == T_TRUE)
format = 1;
else if (TYPE(argv[0]) == T_FALSE)
format = 0;
else
rb_raise(rb_eTypeError, "wrong type of argument, must be bool");
break;
default:
rb_raise(rb_eArgError, "wrong number of arguments (0 or 1)");
}
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc == NULL) {
return(Qnil);
} else if (encoding != NULL) {
if (format) {
xmlDocDumpFormatMemoryEnc(xdoc, &result, &len,
(const char*)encoding, format);
} else {
xmlDocDumpMemoryEnc(xdoc, &result, &len,
(const char *)encoding);
}
} else {
if (format)
xmlDocDumpFormatMemory(xdoc, &result, &len, format);
else
xmlDocDumpMemory(xdoc, &result, &len);
}
rresult=rb_str_new((const char*)result,len);
xmlFree(result);
return rresult;
}
/*
* call-seq:
* document.url -> "url"
*
* Obtain this document's source URL, if any.
*/
static VALUE
rxml_document_url_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->URL == NULL)
return(Qnil);
else
return(rb_str_new2((const char*)xdoc->URL));
}
/*
* call-seq:
* document.version -> "version"
*
* Obtain the XML version specified by this document.
*/
static VALUE
rxml_document_version_get(VALUE self) {
xmlDocPtr xdoc;
Data_Get_Struct(self, xmlDoc, xdoc);
if (xdoc->version == NULL)
return(Qnil);
else
return(rb_str_new2((const char*)xdoc->version));
}
/*
* call-seq:
* document.xinclude -> num
*
* Process xinclude directives in this document.
*/
static VALUE
rxml_document_xinclude(VALUE self) {
#ifdef LIBXML_XINCLUDE_ENABLED
xmlDocPtr xdoc;
int ret;
Data_Get_Struct(self, xmlDoc, xdoc);
ret = xmlXIncludeProcess(xdoc);
if (ret >= 0)
{
return(INT2NUM(ret));
}
else
{
rxml_raise(&xmlLastError);
return Qnil;
}
#else
rb_warn("libxml was compiled without XInclude support. Please recompile libxml and ruby-libxml");
return(Qfalse);
#endif
}
void
LibXML_validity_error(void * ctxt, const char * msg, va_list ap)
{
if (rb_block_given_p()) {
char buff[1024];
snprintf(buff, 1024, msg, ap);
rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qtrue));
} else {
fprintf(stderr, "error -- found validity error: ");
fprintf(stderr, msg, ap);
}
}
void
LibXML_validity_warning(void * ctxt, const char * msg, va_list ap)
{
if (rb_block_given_p()) {
char buff[1024];
snprintf(buff, 1024, msg, ap);
rb_yield(rb_ary_new3(2, rb_str_new2(buff), Qfalse));
} else {
fprintf(stderr, "warning -- found validity error: ");
fprintf(stderr, msg, ap);
}
}
/*
* call-seq:
* document.validate_schema(schema) -> (true|false)
*
* Validate this document against the specified XML::Schema.
*
* If a block is provided it is used as an error handler for validaten errors.
* The block is called with two argument, the message and a flag indication
* if the message is an error (true) or a warning (false).
*/
static VALUE
rxml_document_validate_schema(VALUE self, VALUE schema) {
xmlSchemaValidCtxtPtr vptr;
xmlDocPtr xdoc;
xmlSchemaPtr xschema;
int is_invalid;
Data_Get_Struct(self, xmlDoc, xdoc);
Data_Get_Struct(schema, xmlSchema, xschema);
vptr = xmlSchemaNewValidCtxt(xschema);
xmlSchemaSetValidErrors(vptr, (xmlSchemaValidityErrorFunc)LibXML_validity_error,
(xmlSchemaValidityWarningFunc)LibXML_validity_warning, NULL);
is_invalid = xmlSchemaValidateDoc(vptr, xdoc);
xmlSchemaFreeValidCtxt(vptr);
if (is_invalid)
{
rxml_raise(&xmlLastError);
return Qfalse;
}
else
{
return Qtrue;
}
}
/*
* call-seq:
* document.validate_schema(relaxng) -> (true|false)
*
* Validate this document against the specified XML::RelaxNG.
*
* If a block is provided it is used as an error handler for validaten errors.
* The block is called with two argument, the message and a flag indication
* if the message is an error (true) or a warning (false).
*/
static VALUE
rxml_document_validate_relaxng(VALUE self, VALUE relaxng) {
xmlRelaxNGValidCtxtPtr vptr;
xmlDocPtr xdoc;
xmlRelaxNGPtr xrelaxng;
int is_invalid;
Data_Get_Struct(self, xmlDoc, xdoc);
Data_Get_Struct(relaxng, xmlRelaxNG, xrelaxng);
vptr = xmlRelaxNGNewValidCtxt(xrelaxng);
xmlRelaxNGSetValidErrors(vptr, (xmlRelaxNGValidityErrorFunc)LibXML_validity_error,
(xmlRelaxNGValidityWarningFunc)LibXML_validity_warning, NULL);
is_invalid = xmlRelaxNGValidateDoc(vptr, xdoc);
xmlRelaxNGFreeValidCtxt(vptr);
if (is_invalid)
{
rxml_raise(&xmlLastError);
return Qfalse;
} else
{
return Qtrue;
}
}
/*
* call-seq:
* document.validate(dtd) -> (true|false)
*
* Validate this document against the specified XML::DTD.
*/
static VALUE
rxml_document_validate_dtd(VALUE self, VALUE dtd) {
VALUE error = Qnil;
xmlValidCtxt ctxt;
xmlDocPtr xdoc;
xmlDtdPtr xdtd;
Data_Get_Struct(self, xmlDoc, xdoc);
Data_Get_Struct(dtd, xmlDtd, xdtd);
ctxt.userData = &error;
ctxt.error = (xmlValidityErrorFunc)LibXML_validity_error;
ctxt.warning = (xmlValidityWarningFunc)LibXML_validity_warning;
ctxt.nodeNr = 0;
ctxt.nodeTab = NULL;
ctxt.vstateNr = 0;
ctxt.vstateTab = NULL;
if (xmlValidateDtd(&ctxt, xdoc, xdtd))
{
return(Qtrue);
}
else
{
rxml_raise(&xmlLastError);
return Qfalse;
}
}
/*
* call-seq:
* document.reader -> reader
*
* Create a XML::Reader from the document. This is a shortcut to
* XML::Reader.walker().
*/
static VALUE
rxml_document_reader(VALUE self)
{
return rxml_reader_new_walker(cXMLReader, self);
}
// Rdoc needs to know
#ifdef RDOC_NEVER_DEFINED
mLibXML = rb_define_module("LibXML");
mXML = rb_define_module_under(mLibXML, "XML");
#endif
void
ruby_init_xml_document(void) {
cXMLDocument = rb_define_class_under(mXML, "Document", rb_cObject);
rb_define_alloc_func(cXMLDocument, rxml_document_alloc);
rb_define_method(cXMLDocument, "initialize", rxml_document_initialize, -1);
rb_define_method(cXMLDocument, "child", rxml_document_child_get, 0);
rb_define_method(cXMLDocument, "child?", rxml_document_child_q, 0);
rb_define_method(cXMLDocument, "compression", rxml_document_compression_get, 0);
rb_define_method(cXMLDocument, "compression=", rxml_document_compression_set, 1);
rb_define_method(cXMLDocument, "compression?", rxml_document_compression_q, 0);
rb_define_method(cXMLDocument, "dump", rxml_document_dump, -1);
rb_define_method(cXMLDocument, "debug_dump", rxml_document_debug_dump, -1);
rb_define_method(cXMLDocument, "debug_dump_head", rxml_document_debug_dump_head, -1);
rb_define_method(cXMLDocument, "debug_format_dump", rxml_document_debug_format_dump, -1);
rb_define_method(cXMLDocument, "encoding", rxml_document_encoding_get, 0);
rb_define_method(cXMLDocument, "encoding=", rxml_document_encoding_set, 1);
rb_define_method(cXMLDocument, "format_dump", rxml_document_format_dump, -1);
rb_define_method(cXMLDocument, "last", rxml_document_last_get, 0);
rb_define_method(cXMLDocument, "last?", rxml_document_last_q, 0);
rb_define_method(cXMLDocument, "next", rxml_document_next_get, 0);
rb_define_method(cXMLDocument, "next?", rxml_document_next_q, 0);
rb_define_method(cXMLDocument, "parent", rxml_document_parent_get, 0);
rb_define_method(cXMLDocument, "parent?", rxml_document_parent_q, 0);
rb_define_method(cXMLDocument, "prev", rxml_document_prev_get, 0);
rb_define_method(cXMLDocument, "prev?", rxml_document_prev_q, 0);
rb_define_method(cXMLDocument, "root", rxml_document_root_get, 0);
rb_define_method(cXMLDocument, "root=", rxml_document_root_set, 1);
rb_define_method(cXMLDocument, "save", rxml_document_save, -1);
rb_define_method(cXMLDocument, "standalone?", rxml_document_standalone_q, 0);
rb_define_method(cXMLDocument, "to_s", rxml_document_to_s, -1);
rb_define_method(cXMLDocument, "url", rxml_document_url_get, 0);
rb_define_method(cXMLDocument, "version", rxml_document_version_get, 0);
rb_define_method(cXMLDocument, "xinclude", rxml_document_xinclude, 0);
rb_define_method(cXMLDocument, "validate", rxml_document_validate_dtd, 1);
rb_define_method(cXMLDocument, "validate_schema", rxml_document_validate_schema, 1);
rb_define_method(cXMLDocument, "validate_relaxng", rxml_document_validate_relaxng, 1);
rb_define_method(cXMLDocument, "reader", rxml_document_reader, 0);
}
| [
"lgs@lenio.dk"
] | lgs@lenio.dk |
d590cc92c070f3e44fad3ed8985e80174f21d20b | b2d48aac47dc3a3050f9cb562808f0e6f19a36e4 | /mohansai/zetair/src/bucket.c | fe2a221cbe62c8cca6760d793fd2823b8ab59b25 | [] | no_license | bhagavansprasad/students | 7f7df2f4c2350025d58406794a7d94d9c8a9d7be | 2822fb81cfb6714d48dea1e4957d6011ffa6198b | refs/heads/master | 2023-08-04T04:44:11.346963 | 2023-07-24T06:09:00 | 2023-07-24T06:09:00 | 193,177,404 | 0 | 0 | null | 2022-11-30T23:33:00 | 2019-06-22T01:21:59 | C | UTF-8 | C | false | false | 76,306 | c | /* bucket.c implements a structure that manages short inverted lists by
* keeping them in fixed size buckets.
*
* actually, since i need to do some experimentation to find the best bucket
* design, it will probably implement a number of structures. There are a
* number of good reasons for having different bucket structures around,
* including specialising to match the current architecture endianness and
* reducing costs for fixed-length entries and keys.
*
* The first bucket design that we will use is as follows:
*
* +-------------------------------+
* |num|t1p|t1l|t2p|t2l| |
* +-------------------------------+
* | |xxxxx,term2|xxxxxxxxx,term1|
* +-------------------------------+
*
* term vectors are stored in lexographic order with the corresponding term
* immediately afterward. (shown as xxxx,term1 etc).
* The term length is stored in the directory as t1l, t2l etc.
* The term pointers (t1p, t2p etc) point to the start of the entry for that
* term, where entries are kept packed to the back of the bucket (to allow
* easy appending of new entries). All entries in the directory (shown on top
* row) are fixed length numbers of size 16 bits (stored in big-endian format),
* which allows quick lookup given the index of the term.
* The term pointers combined with knowledge of the size of the bucket
* and the term lengths can be used to deduce the length of each vector.
*
* Bucket design 2 is the same as one, except that all entries have uniform
* length and are stored (once) at the start of the bucket.
*
* +-------------------------------+
* |num|size|t1p|t2p| |
* +-------------------------------+
* | |xxxxx,term2|xxxxxxxxx,term1|
* +-------------------------------+
*
* written nml 2003-10-06
*
*/
#include "firstinclude.h"
#include "bucket.h"
#include "_mem.h"
#include "bit.h"
#include "mem.h"
#include "str.h" /* for str_ncmp use in assert */
#include "vec.h"
#include "zstdint.h"
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
/* return address of entries (it's at the start of memory) for bucket designs
* 1 and 2 */
#define B1_ENTRIES_ADDR(base) (base)
#define B2_ENTRIES_ADDR(base) (base)
/* return address of the pointer for entries for bucket designs 1 and 2 */
#define B1_PTR(entry) (sizeof(uint16_t) * (2 * (entry) + 1))
#define B1_PTR_ADDR(base, entry) (((char *) base) + B1_PTR(entry))
#define B2_PTR(entry) (sizeof(uint16_t) * ((entry) + 2))
#define B2_PTR_ADDR(base, entry) (((char *) base) + B2_PTR(entry))
/* return address of the size for an entry for bucket designs 1 and 2 */
#define B1_SIZE(entry) (sizeof(uint16_t) * (2 * (entry) + 2))
#define B1_SIZE_ADDR(base, entry) (((char *) base) + B1_SIZE(entry))
#define B2_SIZE(entry) (sizeof(uint16_t))
#define B2_SIZE_ADDR(base, entry) (((char *) base) + B1_SIZE(entry))
/* macro to read a vbyte number from cmem (which is incremented over the number)
* into n. Note that cmem must be a uchar * */
#define GETVBYTE(cmem, n) \
if (1) { \
unsigned int GETVBYTE_count = 0; \
\
*(n) = 0; \
while ((STR_FROM_CHAR(*(cmem)) >= 128)) { \
*(n) |= (*(cmem) & 0x7f) << GETVBYTE_count; \
GETVBYTE_count += 7; \
(cmem)++; \
} \
*(n) |= STR_FROM_CHAR(*(cmem)) << GETVBYTE_count; \
(cmem)++; \
} else
/* macro to put a vbyte number to cmem (which is incremented over the number)
* from n (which is destroyed by the operation). Note that cmem must be
* a uchar * */
#define PUTVBYTE(cmem, n) \
if (1) { \
while ((n) >= 128) { \
*(cmem) = ((n) & 0x7f) | 0x80; \
(n) >>= 7; \
(cmem)++; \
} \
*(cmem) = ((unsigned char) n); \
(cmem)++; \
} else
int bucket_new(void *mem, unsigned int bucketsize, int strategy) {
if (bucketsize >= UINT16_MAX) {
return 0;
}
/* this isn't strictly necessary, but means that everything is guaranteed
* to be initialised (even the space we don't use) */
memset(mem, 0, bucketsize);
switch (strategy) {
case 1:
case 2:
return 1;
default:
return 0;
};
}
int bucket_sorted(int strategy) {
switch (strategy) {
case 1:
case 2:
return 1;
default:
return 0;
}
}
unsigned int bucket_entries(void *mem, unsigned int bucketsize, int strategy) {
uint16_t entries;
switch (strategy) {
case 1:
case 2:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
return entries;
break;
default:
assert(0);
return 0;
break;
}
}
unsigned int bucket_utilised(void *mem, unsigned int bucketsize, int strategy) {
unsigned int i;
uint16_t entries,
length,
utilised = 0;
switch (strategy) {
case 1:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read each entry */
for (i = 0; i < entries; i++) {
MEM_NTOH(&length, B1_SIZE_ADDR(mem, i), sizeof(length));
utilised += length;
}
return utilised;
break;
case 2:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read each entry */
for (i = 0; i < entries; i++) {
MEM_NTOH(&length, B2_SIZE_ADDR(mem, i), sizeof(length));
utilised += length;
}
return utilised;
break;
default:
assert(0);
return 0;
break;
}
}
unsigned int bucket_string(void *mem, unsigned int bucketsize, int strategy) {
unsigned int i;
uint16_t entries,
prevptr = bucketsize,
ptr,
length,
string = 0;
switch (strategy) {
case 1:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read each entry */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
MEM_NTOH(&length, B1_SIZE_ADDR(mem, i), sizeof(length));
string += (prevptr - ptr) - length;
prevptr = ptr;
}
return string;
break;
case 2:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read each entry */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
MEM_NTOH(&length, B2_SIZE_ADDR(mem, i), sizeof(length));
string += (prevptr - ptr) - length;
prevptr = ptr;
}
return string;
break;
default:
assert(0);
return 0;
break;
}
}
unsigned int bucket_overhead(void *mem, unsigned int bucketsize, int strategy) {
uint16_t entries;
switch (strategy) {
case 1:
case 2:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
return entries * 2 * sizeof(uint16_t) + sizeof(entries);
break;
default:
assert(0);
return 0;
break;
}
}
unsigned int bucket_unused(void *mem, unsigned int bucketsize, int strategy) {
uint16_t entries,
lastptr;
switch (strategy) {
case 1:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read last entry */
if (entries) {
MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, entries - 1), sizeof(lastptr));
return lastptr - B1_PTR(entries);
} else {
return bucketsize - sizeof(entries);
}
break;
case 2:
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
/* read last entry */
if (entries) {
MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, entries - 1), sizeof(lastptr));
return lastptr - B2_PTR(entries);
} else {
return bucketsize - sizeof(entries);
}
break;
default:
assert(0);
return 0;
break;
}
}
/* functions for strategy 1 */
/* binary searches a bucket for a term, returning the largest thing that is less
* than or equal to the given term (this property, which the usual binary search
* must be modified to provide, is important because we can then use it for
* insertion sorting as well as searching) */
static unsigned int bucket1_binsearch(void *mem, unsigned int bucketsize,
unsigned int entries, const char *term, unsigned int termlen) {
unsigned int l,
r,
m,
i,
len,
tlen;
uint16_t ptr,
prevptr,
size;
assert(entries);
l = 0;
r = entries - 1;
while (l < r) {
m = BIT_DIV2((r + l + 1), 1);
/* decode m ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, m), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, m), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (m) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, m - 1), sizeof(prevptr));
tlen = prevptr - ptr - size;
len = (tlen > termlen) ? termlen : tlen;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
r = m - 1;
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
l = m;
break;
}
}
/* exact match of prefixes */
if (i == len) {
if (termlen == tlen) {
return m;
} else if (termlen < tlen) {
r = m - 1;
} else {
l = m;
}
}
} else {
/* m is first entry */
prevptr = bucketsize;
tlen = prevptr - ptr - size;
len = (tlen > termlen) ? termlen : tlen;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
/* no exact match, act now to prevent underflow */
return 0;
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
l = m;
break;
}
}
/* exact match of prefixes */
if (i == len) {
if (termlen <= tlen) {
/* no match, act now to prevent underflow */
return 0;
} else {
l = m;
}
}
}
}
/* no exact match */
return l;
}
void *bucket1_find(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
unsigned int index,
i;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
return NULL;
}
index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr) - size == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[i + ptr + size]) {
return NULL;
}
}
*veclen = size;
if (idx) {
*idx = index;
}
return ((char *) mem) + ptr;
}
return NULL;
}
void *bucket1_search(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
unsigned int index;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
return NULL;
}
index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
if (idx) {
*idx = index;
}
*veclen = size;
return ((char *) mem) + ptr;
}
void *bucket1_realloc_at(void *mem, unsigned int bucketsize,
unsigned int index, unsigned int newsize, int *toobig) {
unsigned int termlen;
uint16_t size,
lastaddr,
entries,
new_bucket_size,
ptr,
prevptr,
movesize;
new_bucket_size = bucketsize - sizeof(uint16_t);
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries || (index >= entries)) {
*toobig = 0;
return NULL;
}
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
/* read the last entry */
MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
/* infer term length */
termlen = prevptr - ptr - size;
if (newsize > size) {
/* allocation is growing */
if ((newsize - size) > lastaddr - B1_PTR(entries)) {
/* not enough space to grow the entry */
if (termlen + newsize + sizeof(uint16_t) * 2
> new_bucket_size) {
/* ... even if the bucket was empty */
*toobig = 1;
}
return NULL;
}
/* only need to move the bytes from the old entry */
movesize = size;
} else {
/* shrinking realloc, move only the bytes that will be preserved */
movesize = newsize;
}
/* move strings and vectors (careful, this line is tricky) */
memmove(((char *) mem) + lastaddr - (newsize - size),
((char *) mem) + lastaddr, ptr + movesize - lastaddr);
/* adjust pointers */
assert(((newsize > size) && ptr > (newsize - size))
|| ((newsize < size) && ptr > (size - newsize))
|| (newsize == size));
ptr -= (newsize - size);
MEM_HTON(B1_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
MEM_HTON(B1_SIZE_ADDR(mem, index), &newsize, sizeof(ptr));
prevptr = ptr;
for (index++; index < entries; index++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index),
sizeof(ptr));
ptr -= (newsize - size);
MEM_HTON(B1_PTR_ADDR(mem, index), &ptr,
sizeof(ptr));
}
/* done */
return ((char *) mem) + prevptr;
}
void *bucket1_realloc(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int newsize, int *toobig) {
unsigned int i,
index;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
*toobig = 0;
return NULL;
}
index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
/* verify that index points to requested term */
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr - size) == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[ptr + size + i]) {
return NULL;
}
}
return bucket1_realloc_at(mem, bucketsize, index, newsize, toobig);
} else {
return NULL;
}
}
void *bucket1_alloc(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int newsize, int *toobig,
unsigned int *idx) {
unsigned int index,
i,
len;
uint16_t size,
lastaddr,
entries,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
size = newsize;
if (entries) {
/* read the last entry */
MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
/* check that we have enough space to allocate entry */
if ((size + termlen + 2 * (sizeof(uint16_t)))
> (lastaddr - B1_PTR(entries))) {
/* test whether theres enough space to allocate the entry if the
* bucket was empty */
*toobig = (termlen + newsize + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries));
return NULL;
}
index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
/* need to do a last comparison to figure out whether we want to insert
* here or in the next position */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1),
sizeof(prevptr));
} else {
prevptr = bucketsize;
}
/* the way we do our binary search, the item may need to be inserted
* at the *next* location (assuming that there is no exact match) */
assert(prevptr >= ptr);
len = (unsigned int) (((unsigned int) prevptr - ptr - size) > termlen)
? termlen : prevptr - ptr - size;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
index++;
prevptr = ptr;
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
break;
}
}
/* exact match of prefixes */
/* XXX: should check for exact match */
if (i == len) {
if (termlen > len) {
index++;
prevptr = ptr;
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
}
}
/* new allocation needs to be inserted at index */
if (index < entries) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1),
sizeof(prevptr));
} else {
prevptr = bucketsize;
}
/* move strings and data down */
memmove(((char *) mem) + lastaddr - termlen - newsize,
((char *) mem) + lastaddr,
ptr - lastaddr + (prevptr - ptr));
/* shift pointers up */
for (i = entries; (i > index); i--) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i - 1), sizeof(ptr));
ptr -= termlen + newsize;
MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
memcpy(B1_SIZE_ADDR(mem, i), B1_SIZE_ADDR(mem, i - 1),
sizeof(size));
}
ptr = prevptr - termlen - newsize;
} else {
ptr = lastaddr - termlen - newsize;
}
} else {
/* check that we have enough space to allocate entry */
if (termlen + newsize + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries)) {
*toobig = 1;
return NULL;
}
ptr = bucketsize - termlen - newsize;
index = 0;
}
/* encode new pointer */
size = newsize;
MEM_HTON(B1_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
MEM_HTON(B1_SIZE_ADDR(mem, index), &size, sizeof(size));
/* copy new string in */
memcpy(((char *) mem) + ptr + size, term, termlen);
/* encode new entries record */
entries++;
MEM_HTON(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
if (idx) {
*idx = index;
}
return ((char *) mem) + ptr;
}
int bucket1_remove_at(void *mem, unsigned int bucketsize, unsigned int index) {
unsigned int i;
uint16_t lastaddr,
entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries || (index >= entries)) {
return 0;
}
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
/* read the last entry */
MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
/* move strings/data up */
memmove(((char *) mem) + lastaddr + (prevptr - ptr),
((char *) mem) + lastaddr, ptr - lastaddr);
size = prevptr - ptr;
/* update pointers */
for (i = index; i + 1 < entries; i++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i + 1), sizeof(ptr));
ptr += size;
MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
memcpy(B1_SIZE_ADDR(mem, i),
B1_SIZE_ADDR(mem, i + 1), sizeof(size));
}
/* encode new entries record */
entries--;
MEM_HTON(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
return 1;
}
int bucket1_remove(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen) {
unsigned int i,
index;
uint16_t entries,
ptr,
size,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries) {
return 0;
}
index = bucket1_binsearch(mem, bucketsize, entries, term, termlen);
/* verify that index points to requested term */
/* decode ptr */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr - size) == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[ptr + size + i]) {
return 0;
}
}
return bucket1_remove_at(mem, bucketsize, index);
} else {
return 0;
}
}
const char *bucket1_term_at(void *mem, unsigned int bucketsize,
unsigned int index, unsigned int *len, void **data, unsigned int *veclen) {
uint16_t addr,
prevaddr, /* logically previous (physically next) address */
size,
entries;
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
if (index < entries) {
/* read the entry */
MEM_NTOH(&addr, B1_PTR_ADDR(mem, index), sizeof(addr));
MEM_NTOH(&size, B1_SIZE_ADDR(mem, index), sizeof(size));
assert(((sizeof(addr) * entries) <= addr)
&& (bucketsize > addr));
if (index) {
/* its not the first entry, read the previous entry's address */
MEM_NTOH(&prevaddr, B1_PTR_ADDR(mem, index - 1),
sizeof(prevaddr));
} else {
/* its the first entry, boundary is the end of the bucket */
prevaddr = bucketsize;
}
*len = prevaddr - addr - size;
*veclen = size;
*data = ((char *) mem) + addr;
return ((char *) mem) + addr + size;
} else {
/* its past the last entry */
return NULL;
}
}
int bucket1_split(void *mem1, unsigned int bucketsize1, void *mem2,
unsigned int bucketsize2, unsigned int terms) {
unsigned int i,
j;
uint16_t lastaddr,
entries,
size,
ptr,
prevptr;
memset(mem2, 0, bucketsize2);
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem1), sizeof(entries));
if (terms >= entries) {
return (terms == entries);
}
if (terms) {
/* read split entry */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem1, terms - 1), sizeof(ptr));
} else {
ptr = bucketsize1;
}
/* read last entry */
MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem1, entries - 1), sizeof(lastaddr));
/* copy strings and data from bucket 1 to bucket 2 */
memcpy((char *) mem2 + bucketsize2 - (ptr - lastaddr),
(char *) mem1 + lastaddr, ptr - lastaddr);
/* copy pointers to new bucket */
prevptr = ptr;
for (j = 0, i = terms; i < entries; i++, j++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem1, i), sizeof(ptr));
ptr += bucketsize1 - prevptr;
MEM_HTON(B1_PTR_ADDR(mem2, j), &ptr, sizeof(size));
memcpy(B1_SIZE_ADDR(mem2, j), B1_SIZE_ADDR(mem1, i), sizeof(size));
}
/* adjust entries record in both buckets */
size = terms;
mem_hton(B1_ENTRIES_ADDR(mem1), &size, sizeof(size));
entries -= size;
mem_hton(B1_ENTRIES_ADDR(mem2), &entries, sizeof(entries));
return 1;
}
int bucket1_set_term(void *mem, unsigned int bucketsize, unsigned int termno,
const char *newterm, unsigned int newtermlen, int *toobig) {
unsigned int i,
termlen;
uint16_t size,
ptr,
prevptr,
lastptr,
entries;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
if (termno >= entries) {
return 0;
}
/* read entry, previous and last pointers */
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, termno), sizeof(ptr));
if (termno + 1 < entries) {
MEM_NTOH(&prevptr, B1_PTR_ADDR(mem, termno + 1), sizeof(prevptr));
/* read the last entry */
MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
} else {
prevptr = bucketsize;
lastptr = ptr;
}
MEM_NTOH(&size, B1_SIZE_ADDR(mem, size), sizeof(size));
termlen = prevptr - ptr - size;
if (newtermlen > termlen) {
/* string is growing */
/* check that we have enough space to allocate entry */
if (((newtermlen - termlen) > (lastptr - B1_PTR(entries)))) {
/* not enough space to allocate the entry */
if ((newtermlen + 2 * sizeof(uint16_t) + size)
> bucketsize - sizeof(entries)) {
/* ... even if the bucket was empty */
*toobig = 1;
}
return 0;
}
/* move strings and data prior to the entry */
memmove(((char *) mem) + lastptr - (newtermlen - termlen),
((char *) mem) + lastptr, ptr - lastptr + size);
/* update pointers prior to the entry */
for (i = termno; i < entries; i++) {
MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, i), sizeof(lastptr));
lastptr -= (newtermlen - termlen);
MEM_HTON(B1_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
}
} else if (newtermlen < termlen) {
/* string is shrinking */
/* move strings and data prior to the entry */
memmove(((char *) mem) + lastptr + (termlen - newtermlen),
((char *) mem) + lastptr, ptr - lastptr + size);
/* update pointers prior to the entry */
for (i = termno; i < entries; i++) {
MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, i), sizeof(lastptr));
lastptr += (termlen - newtermlen);
MEM_HTON(B1_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
}
}
/* copy new string in */
memcpy(((char *) mem) + ptr + size, newterm, newtermlen);
return 1;
}
int bucket1_resize(void *mem, unsigned int oldsize, unsigned int newsize) {
unsigned int i;
uint16_t ptr,
lastptr,
entries;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries) {
return 1;
}
/* read last entry */
MEM_NTOH(&lastptr, B1_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
if (newsize < oldsize) {
/* shrinking */
if ((oldsize - newsize) > (lastptr - B1_PTR(entries))) {
return 0;
}
/* move data and strings */
memmove(((char *) mem) + lastptr - (oldsize - newsize),
((char *) mem) + lastptr, oldsize - lastptr);
/* update pointer entries */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
ptr -= (oldsize - newsize);
MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
}
} else if (newsize > oldsize) {
/* growing */
/* move data and strings */
memmove(((char *) mem) + lastptr + (newsize - oldsize),
((char *) mem) + lastptr, oldsize - lastptr);
/* update pointer entries */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B1_PTR_ADDR(mem, i), sizeof(ptr));
ptr += (newsize - oldsize);
MEM_HTON(B1_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
}
}
return 1;
}
void *bucket1_append(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int size, int *toobig) {
uint16_t entries,
lastaddr,
ptr;
/* read number of entries */
MEM_NTOH(&entries, B1_ENTRIES_ADDR(mem), sizeof(entries));
if (entries) {
/* read the last entry */
MEM_NTOH(&lastaddr, B1_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
} else {
lastaddr = bucketsize;
}
/* check that we have enough free space */
if ((size + termlen + 2 * (sizeof(uint16_t)))
> (lastaddr - B1_PTR(entries))) {
/* test whether theres enough space to allocate the entry if the
* bucket was empty */
*toobig = (termlen + size + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries));
return NULL;
}
/* copy term in */
memcpy(((char *) mem) + lastaddr - termlen, term, termlen);
/* update entries record and pointer */
ptr = lastaddr - termlen - size;
mem_hton(B1_PTR_ADDR(mem, entries), &ptr, sizeof(ptr));
ptr = size;
mem_hton(B1_SIZE_ADDR(mem, entries), &ptr, sizeof(ptr));
entries++;
mem_hton(B1_ENTRIES_ADDR(mem), &entries, sizeof(entries));
return ((char *) mem) + lastaddr - termlen - size;
}
/* functions for strategy 2 */
/* binary searches a bucket for a term, returning the largest thing that is less
* than or equal to the given term (this property, which the usual binary search
* must be modified to provide, is important because we can then use it for
* insertion sorting as well as searching) */
static unsigned int bucket2_binsearch(void *mem, unsigned int bucketsize,
unsigned int entries, const char *term, unsigned int termlen) {
unsigned int l,
r,
m,
i,
len,
tlen;
uint16_t ptr,
prevptr,
size;
assert(entries);
l = 0;
r = entries - 1;
while (l < r) {
m = BIT_DIV2((r + l + 1), 1);
/* decode m ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, m), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, m), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (m) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, m - 1), sizeof(prevptr));
tlen = prevptr - ptr - size;
len = (tlen > termlen) ? termlen : tlen;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
r = m - 1;
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
l = m;
break;
}
}
/* exact match of prefixes */
if (i == len) {
if (termlen == tlen) {
return m;
} else if (termlen < tlen) {
r = m - 1;
} else {
l = m;
}
}
} else {
/* m is first entry */
prevptr = bucketsize;
tlen = prevptr - ptr - size;
len = (tlen > termlen) ? termlen : tlen;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
/* no exact match, act now to prevent underflow */
return 0;
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
l = m;
break;
}
}
/* exact match of prefixes */
if (i == len) {
if (termlen <= tlen) {
/* no match, act now to prevent underflow */
return 0;
} else {
l = m;
}
}
}
}
/* no exact match */
return l;
}
void *bucket2_find(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
unsigned int index,
i;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
return NULL;
}
index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr) - size == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[i + ptr + size]) {
return NULL;
}
}
*veclen = size;
if (idx) {
*idx = index;
}
return ((char *) mem) + ptr;
}
return NULL;
}
void *bucket2_search(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int *veclen, unsigned int *idx) {
unsigned int index;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
return NULL;
}
index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
if (idx) {
*idx = index;
}
*veclen = size;
return ((char *) mem) + ptr;
}
void *bucket2_realloc_at(void *mem, unsigned int bucketsize,
unsigned int index, unsigned int newsize, int *toobig) {
uint16_t size,
entries,
new_bucket_size,
ptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries || (index >= entries)) {
*toobig = 0;
return NULL;
}
new_bucket_size = bucketsize - sizeof(uint16_t);
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
if (size == newsize) {
return ((char *) mem) + ptr;
} else {
return NULL;
}
}
void *bucket2_realloc(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int newsize, int *toobig) {
unsigned int i,
index;
uint16_t entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
/* handle 0 entries case */
if (!entries) {
*toobig = 0;
return NULL;
}
index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
/* verify that index points to requested term */
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
if (size != newsize) {
return NULL;
}
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr - size) == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[ptr + size + i]) {
return NULL;
}
}
return bucket2_realloc_at(mem, bucketsize, index, newsize, toobig);
} else {
return NULL;
}
}
void *bucket2_alloc(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int newsize, int *toobig,
unsigned int *idx) {
unsigned int index,
i,
len;
uint16_t size,
lastaddr,
entries,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, 0), sizeof(size));
if (entries && (size != newsize)) {
return NULL;
}
if (entries) {
/* read the last entry */
MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
/* check that we have enough space to allocate entry */
if ((size + termlen + 2 * (sizeof(uint16_t)))
> (lastaddr - B2_PTR(entries))) {
/* test whether theres enough space to allocate the entry if the
* bucket was empty */
*toobig = (termlen + newsize + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries));
return NULL;
}
index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
/* need to do a last comparison to figure out whether we want to insert
* here or in the next position */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1),
sizeof(prevptr));
} else {
prevptr = bucketsize;
}
/* the way we do our binary search, the item may need to be inserted
* at the *next* location (assuming that there is no exact match) */
assert(prevptr >= ptr);
len = (unsigned int) (((unsigned int) prevptr - ptr - size) > termlen)
? termlen : prevptr - ptr - size;
for (i = 0; i < len; i++) {
if (term[i] < ((char *) mem)[i + ptr + size]) {
break;
} else if (term[i] > ((char *) mem)[i + ptr + size]) {
index++;
prevptr = ptr;
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
break;
}
}
/* exact match of prefixes */
/* XXX: should check for exact match */
if (i == len) {
if (termlen > len) {
index++;
prevptr = ptr;
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
}
}
/* new allocation needs to be inserted at index */
if (index < entries) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1),
sizeof(prevptr));
} else {
prevptr = bucketsize;
}
/* move strings and data down */
memmove(((char *) mem) + lastaddr - termlen - newsize,
((char *) mem) + lastaddr,
ptr - lastaddr + (prevptr - ptr));
/* shift pointers up */
for (i = entries; (i > index); i--) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i - 1), sizeof(ptr));
ptr -= termlen + newsize;
MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
memcpy(B2_SIZE_ADDR(mem, i), B2_SIZE_ADDR(mem, i - 1),
sizeof(size));
}
ptr = prevptr - termlen - newsize;
} else {
ptr = lastaddr - termlen - newsize;
}
} else {
/* check that we have enough space to allocate entry */
if (termlen + newsize + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries)) {
*toobig = 1;
return NULL;
}
ptr = bucketsize - termlen - newsize;
index = 0;
}
/* encode new pointer */
size = newsize;
MEM_HTON(B2_PTR_ADDR(mem, index), &ptr, sizeof(ptr));
MEM_HTON(B2_SIZE_ADDR(mem, index), &size, sizeof(size));
/* copy new string in */
memcpy(((char *) mem) + ptr + size, term, termlen);
/* encode new entries record */
entries++;
MEM_HTON(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
if (idx) {
*idx = index;
}
return ((char *) mem) + ptr;
}
int bucket2_remove_at(void *mem, unsigned int bucketsize, unsigned int index) {
unsigned int i;
uint16_t lastaddr,
entries,
size,
ptr,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries || (index >= entries)) {
return 0;
}
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
/* read the last entry */
MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
/* move strings/data up */
memmove(((char *) mem) + lastaddr + (prevptr - ptr),
((char *) mem) + lastaddr, ptr - lastaddr);
size = prevptr - ptr;
/* update pointers */
for (i = index; i + 1 < entries; i++) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i + 1), sizeof(ptr));
ptr += size;
MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
}
/* encode new entries record */
entries--;
MEM_HTON(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
return 1;
}
int bucket2_remove(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen) {
unsigned int i,
index;
uint16_t entries,
ptr,
size,
prevptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries) {
return 0;
}
index = bucket2_binsearch(mem, bucketsize, entries, term, termlen);
/* verify that index points to requested term */
/* decode ptr */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, index), sizeof(ptr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(ptr));
/* decode next pointer, so we know where this one ends */
if (index) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, index - 1), sizeof(prevptr));
} else {
prevptr = bucketsize;
}
assert(prevptr >= ptr);
if (((unsigned int) prevptr - ptr - size) == termlen) {
for (i = 0; i < termlen; i++) {
if (term[i] != ((char *) mem)[ptr + size + i]) {
return 0;
}
}
return bucket2_remove_at(mem, bucketsize, index);
} else {
return 0;
}
}
const char *bucket2_term_at(void *mem, unsigned int bucketsize,
unsigned int index, unsigned int *len, void **data, unsigned int *veclen) {
uint16_t addr,
prevaddr, /* logically previous (physically next) address */
size,
entries;
/* read number of entries */
MEM_NTOH(&entries, mem, sizeof(entries));
if (index < entries) {
/* read the entry */
MEM_NTOH(&addr, B2_PTR_ADDR(mem, index), sizeof(addr));
MEM_NTOH(&size, B2_SIZE_ADDR(mem, index), sizeof(size));
assert(((sizeof(addr) * entries) <= addr)
&& (bucketsize > addr));
if (index) {
/* its not the first entry, read the previous entry's address */
MEM_NTOH(&prevaddr, B2_PTR_ADDR(mem, index - 1),
sizeof(prevaddr));
} else {
/* its the first entry, boundary is the end of the bucket */
prevaddr = bucketsize;
}
*len = prevaddr - addr - size;
*veclen = size;
*data = ((char *) mem) + addr;
return ((char *) mem) + addr + size;
} else {
/* its past the last entry */
return NULL;
}
}
int bucket2_split(void *mem1, unsigned int bucketsize1, void *mem2,
unsigned int bucketsize2, unsigned int terms) {
unsigned int i,
j;
uint16_t lastaddr,
entries,
size,
ptr,
prevptr;
memset(mem2, 0, bucketsize2);
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem1), sizeof(entries));
if (terms >= entries) {
return (terms == entries);
}
if (terms) {
/* read split entry */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem1, terms - 1), sizeof(ptr));
} else {
ptr = bucketsize1;
}
/* read last entry */
MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem1, entries - 1), sizeof(lastaddr));
/* copy strings and data from bucket 1 to bucket 2 */
memcpy((char *) mem2 + bucketsize2 - (ptr - lastaddr),
(char *) mem1 + lastaddr, ptr - lastaddr);
/* copy pointers to new bucket */
prevptr = ptr;
for (j = 0, i = terms; i < entries; i++, j++) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem1, i), sizeof(ptr));
ptr += bucketsize1 - prevptr;
MEM_HTON(B2_PTR_ADDR(mem2, j), &ptr, sizeof(size));
}
memcpy(B2_SIZE_ADDR(mem2, j), B2_SIZE_ADDR(mem1, i), sizeof(size));
/* adjust entries record in both buckets */
size = terms;
mem_hton(B2_ENTRIES_ADDR(mem1), &size, sizeof(size));
entries -= size;
mem_hton(B2_ENTRIES_ADDR(mem2), &entries, sizeof(entries));
return 1;
}
int bucket2_set_term(void *mem, unsigned int bucketsize, unsigned int termno,
const char *newterm, unsigned int newtermlen, int *toobig) {
unsigned int i,
termlen;
uint16_t size,
ptr,
prevptr,
lastptr,
entries;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
if (termno >= entries) {
return 0;
}
/* read entry, previous and last pointers */
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, termno), sizeof(ptr));
if (termno + 1 < entries) {
MEM_NTOH(&prevptr, B2_PTR_ADDR(mem, termno + 1), sizeof(prevptr));
/* read the last entry */
MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
} else {
prevptr = bucketsize;
lastptr = ptr;
}
MEM_NTOH(&size, B2_SIZE_ADDR(mem, size), sizeof(size));
termlen = prevptr - ptr - size;
if (newtermlen > termlen) {
/* string is growing */
/* check that we have enough space to allocate entry */
if (((newtermlen - termlen) > (lastptr - B2_PTR(entries)))) {
/* not enough space to allocate the entry */
if ((newtermlen + 2 * sizeof(uint16_t) + size)
> bucketsize - sizeof(entries)) {
/* ... even if the bucket was empty */
*toobig = 1;
}
return 0;
}
/* move strings and data prior to the entry */
memmove(((char *) mem) + lastptr - (newtermlen - termlen),
((char *) mem) + lastptr, ptr - lastptr + size);
/* update pointers prior to the entry */
for (i = termno; i < entries; i++) {
MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, i), sizeof(lastptr));
lastptr -= (newtermlen - termlen);
MEM_HTON(B2_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
}
} else if (newtermlen < termlen) {
/* string is shrinking */
/* move strings and data prior to the entry */
memmove(((char *) mem) + lastptr + (termlen - newtermlen),
((char *) mem) + lastptr, ptr - lastptr + size);
/* update pointers prior to the entry */
for (i = termno; i < entries; i++) {
MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, i), sizeof(lastptr));
lastptr += (termlen - newtermlen);
MEM_HTON(B2_PTR_ADDR(mem, i), &lastptr, sizeof(lastptr));
}
}
/* copy new string in */
memcpy(((char *) mem) + ptr + size, newterm, newtermlen);
return 1;
}
int bucket2_resize(void *mem, unsigned int oldsize, unsigned int newsize) {
unsigned int i;
uint16_t ptr,
lastptr,
entries;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
if (!entries) {
return 1;
}
/* read last entry */
MEM_NTOH(&lastptr, B2_PTR_ADDR(mem, (entries - 1)), sizeof(lastptr));
if (newsize < oldsize) {
/* shrinking */
if ((oldsize - newsize) > (lastptr - B2_PTR(entries))) {
return 0;
}
/* move data and strings */
memmove(((char *) mem) + lastptr - (oldsize - newsize),
((char *) mem) + lastptr, oldsize - lastptr);
/* update pointer entries */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
ptr -= (oldsize - newsize);
MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
}
} else if (newsize > oldsize) {
/* growing */
/* move data and strings */
memmove(((char *) mem) + lastptr + (newsize - oldsize),
((char *) mem) + lastptr, oldsize - lastptr);
/* update pointer entries */
for (i = 0; i < entries; i++) {
MEM_NTOH(&ptr, B2_PTR_ADDR(mem, i), sizeof(ptr));
ptr += (newsize - oldsize);
MEM_HTON(B2_PTR_ADDR(mem, i), &ptr, sizeof(ptr));
}
}
return 1;
}
void *bucket2_append(void *mem, unsigned int bucketsize, const char *term,
unsigned int termlen, unsigned int size, int *toobig) {
uint16_t entries,
lastaddr,
ptr;
/* read number of entries */
MEM_NTOH(&entries, B2_ENTRIES_ADDR(mem), sizeof(entries));
if (entries) {
/* read the last entry */
MEM_NTOH(&lastaddr, B2_PTR_ADDR(mem, (entries - 1)),
sizeof(lastaddr));
} else {
lastaddr = bucketsize;
}
/* check that we have enough free space */
if ((size + termlen + 2 * (sizeof(uint16_t)))
> (lastaddr - B2_PTR(entries))) {
/* test whether theres enough space to allocate the entry if the
* bucket was empty */
*toobig = (termlen + size + sizeof(uint16_t) * 2
> bucketsize - sizeof(entries));
return NULL;
}
/* copy term in */
memcpy(((char *) mem) + lastaddr - termlen, term, termlen);
/* update entries record and pointer */
ptr = lastaddr - termlen - size;
mem_hton(B2_PTR_ADDR(mem, entries), &ptr, sizeof(ptr));
ptr = size;
mem_hton(B2_SIZE_ADDR(mem, entries), &ptr, sizeof(ptr));
entries++;
mem_hton(B2_ENTRIES_ADDR(mem), &entries, sizeof(entries));
return ((char *) mem) + lastaddr - termlen - size;
}
#include <stdio.h>
int bucket_print(void *mem, unsigned int bucketsize, int strategy) {
void *data;
const char *term;
unsigned int i,
tlen,
vlen;
unsigned int state = 0;
printf("%u entries\n", bucket_entries(mem, bucketsize, strategy));
while ((term = bucket_next_term(mem, bucketsize, strategy, &state, &tlen,
&data, &vlen))) {
putc('\'', stdout);
for (i = 0; i < tlen; i++) {
putc(term[i], stdout);
}
putc('\'', stdout);
putc(' ', stdout);
printf("%u %u (off %u)\n", tlen, vlen,
(unsigned int) (((char *) data) - (char *) mem));
}
putc('\n', stdout);
return 1;
}
/* switching functions */
void *bucket_alloc(void *bucketmem, unsigned int bucketsize, int strategy,
const char *term, unsigned int termlen, unsigned int newsize,
int *toobig, unsigned int *idx) {
switch (strategy) {
case 1:
return bucket1_alloc(bucketmem, bucketsize, term, termlen, newsize,
toobig, idx);
case 2:
return bucket2_alloc(bucketmem, bucketsize, term, termlen, newsize,
toobig, idx);
default:
*toobig = 0;
return NULL;
};
}
void *bucket_find(void *bucketmem, unsigned int bucketsize,
int strategy, const char *term, unsigned int termlen,
unsigned int *veclen, unsigned int *idx) {
switch (strategy) {
case 1:
return bucket1_find(bucketmem, bucketsize, term, termlen, veclen,
idx);
case 2:
return bucket2_find(bucketmem, bucketsize, term, termlen, veclen,
idx);
default:
return NULL;
};
}
void *bucket_search(void *bucketmem, unsigned int bucketsize, int strategy,
const char *term, unsigned int termlen, unsigned int *veclen,
unsigned int *idx) {
switch (strategy) {
case 1:
return bucket1_search(bucketmem, bucketsize, term, termlen, veclen,
idx);
case 2:
return bucket2_search(bucketmem, bucketsize, term, termlen, veclen,
idx);
default:
return NULL;
};
}
int bucket_remove(void *bucketmem, unsigned int bucketsize, int strategy,
const char *term, unsigned int termlen) {
switch (strategy) {
case 1:
return bucket1_remove(bucketmem, bucketsize, term, termlen);
case 2:
return bucket2_remove(bucketmem, bucketsize, term, termlen);
default:
return 0;
};
}
int bucket_remove_at(void *bucketmem, unsigned int bucketsize, int strategy,
unsigned int index) {
switch (strategy) {
case 1:
return bucket1_remove_at(bucketmem, bucketsize, index);
case 2:
return bucket2_remove_at(bucketmem, bucketsize, index);
default:
return 0;
};
}
void *bucket_realloc(void *bucketmem, unsigned int bucketsize,
int strategy, const char *term, unsigned int termlen,
unsigned int newlen, int *toobig) {
switch (strategy) {
case 1:
return bucket1_realloc(bucketmem, bucketsize, term, termlen,
newlen, toobig);
case 2:
return bucket2_realloc(bucketmem, bucketsize, term, termlen,
newlen, toobig);
default:
*toobig = 0;
return NULL;
};
}
void *bucket_realloc_at(void *bucketmem, unsigned int bucketsize,
int strategy, unsigned int index, unsigned int newlen, int *toobig) {
switch (strategy) {
case 1:
return bucket1_realloc_at(bucketmem, bucketsize, index, newlen,
toobig);
case 2:
return bucket2_realloc_at(bucketmem, bucketsize, index, newlen,
toobig);
default:
*toobig = 0;
return NULL;
};
}
const char *bucket_next_term(void *bucketmem, unsigned int bucketsize,
int strategy, unsigned int *state, unsigned int *len, void **data,
unsigned int *veclen) {
assert(bucketsize);
switch (strategy) {
case 1:
return bucket1_term_at(bucketmem, bucketsize, (*state)++, len, data,
veclen);
case 2:
return bucket2_term_at(bucketmem, bucketsize, (*state)++, len, data,
veclen);
default:
return NULL;
};
}
const char *bucket_term_at(void *bucketmem, unsigned int bucketsize,
int strategy, unsigned int index, unsigned int *len, void **data,
unsigned int *veclen) {
assert(bucketsize);
switch (strategy) {
case 1:
return bucket1_term_at(bucketmem, bucketsize, index, len, data,
veclen);
case 2:
return bucket2_term_at(bucketmem, bucketsize, index, len, data,
veclen);
default:
return NULL;
};
}
int bucket_split(void *bucketmem1, unsigned int bucketsize1,
void *bucketmem2, unsigned int bucketsize2, int strategy,
unsigned int split_terms) {
switch (strategy) {
case 1:
return bucket1_split(bucketmem1, bucketsize1, bucketmem2, bucketsize2,
split_terms);
case 2:
return bucket2_split(bucketmem1, bucketsize1, bucketmem2, bucketsize2,
split_terms);
default:
return 0;
}
}
int bucket_resize(void *bucketmem, unsigned int old_bucketsize, int strategy,
unsigned int new_bucketsize) {
switch (strategy) {
case 1:
return bucket1_resize(bucketmem, old_bucketsize, new_bucketsize);
case 2:
return bucket2_resize(bucketmem, old_bucketsize, new_bucketsize);
default:
return 0;
};
}
void *bucket_append(void *bucketmem, unsigned int bucketsize, int strategy,
const char *term, unsigned int termlen, unsigned int size,
int *toobig) {
switch (strategy) {
case 1:
return bucket1_append(bucketmem, bucketsize, term, termlen, size,
toobig);
case 2:
return bucket2_append(bucketmem, bucketsize, term, termlen, size,
toobig);
default:
*toobig = 0;
return NULL;
};
}
void bucket_print_split(void *bucketmem, unsigned int bucketsize,
int strategy, unsigned int terms, const char *term, unsigned int termlen,
unsigned int additional, int smaller) {
const char *currterm;
unsigned int state = 0;
void *vec;
unsigned int i,
j,
len,
veclen,
sum = 0;
for (i = 0; i < terms; i++) {
currterm = bucket_next_term(bucketmem, bucketsize, strategy, &state,
&len, &vec, &veclen);
assert(currterm);
for (j = 0; j < len; j++) {
putc(currterm[j], stdout);
}
printf(" (%u) ", veclen + len);
sum += len + veclen;
}
if (smaller) {
printf("(additional) ");
for (j = 0; j < termlen; j++) {
putc(term[j], stdout);
}
printf(" (%u) ", additional);
sum += additional;
}
printf("[%u] | ", sum);
sum = 0;
if (!smaller) {
printf("(additional) ");
for (j = 0; j < termlen; j++) {
putc(term[j], stdout);
}
printf(" (%u) ", additional);
sum += additional;
}
while ((currterm = bucket_next_term(bucketmem, bucketsize, strategy, &state,
&len, &vec, &veclen))) {
for (j = 0; j < len; j++) {
putc(currterm[j], stdout);
}
printf(" (%u) ", veclen + len);
sum += len + veclen;
}
printf(" [%u]\n", sum);
}
unsigned int bucket_find_split_entry(void *bucketmem, unsigned int bucketsize,
int strategy, unsigned int range, const char *term,
unsigned int termlen, unsigned int additional, int *smaller) {
const void *ret; /* return value from bucket functions */
void *dataptr; /* data location of vector in bucket */
int tmpsmaller = 0, /* value to be copied into smaller */
consumed = 0, /* whether the additional term has been
* consumed */
cmp; /* result of string comparison */
unsigned int shortest, /* size of the shortest entry we've seen */
index, /* split bucket term index */
disp, /* displacement of shortest entry from a
* perfectly balanced split */
terms = 0, /* number of terms seen thus far */
sum = 0, /* sum of data thus far */
len, /* length of string entry */
veclen, /* length of data in entry */
data, /* amount of data in bucket */
iter_state = 0; /* state of iteration */
/* determine where to split the leaf node
*
* prefix b-tree magic is performed here, by selecting shortest string to
* push up within given range. If two strings are equally short, the
* distribution of data between the buckets is considered, with more even
* distribution favoured. */
assert(bucket_sorted(strategy)); /* XXX: should handle unsorted buckets
* (by sorting) */
data = bucket_utilised(bucketmem, bucketsize, strategy)
+ bucket_string(bucketmem, bucketsize, strategy) + additional;
data /= 2;
/* our interval of interest is now data +/- range */
ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state, &len,
&dataptr, &veclen);
assert(ret);
/* iterate until we come up to term that enters range */
while (ret
/* need to do comparison to additional term now so that we can stop on
* term that crosses boundary into acceptable range */
&& ((cmp = str_nncmp(term, termlen, ret, len)), 1)
/* if additional term is less than bucket term ... */
&& (((!consumed && (cmp < 0))
/* ... check that its not going to cross into range ... */
&& (sum + additional < data - range)
/* ... and consume it */
&& ((sum += additional), (consumed = 1)))
/* else if additional term is greater than bucket term or already
* consumed ... */
|| ((consumed || (cmp > 0))
/* ... check that bucket term isn't going to cross into range ... */
&& (sum + len + veclen < data - range)
&& ((sum += len + veclen), ++terms)
&& (ret = bucket_next_term(bucketmem, bucketsize, strategy,
&iter_state, &len, &dataptr, &veclen)))
/* else if they're equal ... */
|| ((!consumed && !cmp)
/* ... check that the sum isn't going to cross into range ... */
&& (sum + len + veclen + additional < data - range)
/* ... and consume them */
&& ((sum += len + veclen + additional), ++terms, (consumed = 1))
&& (ret = bucket_next_term(bucketmem, bucketsize, strategy,
&iter_state, &len, &dataptr, &veclen))))) {
/* do nothing */
}
/* we're now up to term that may enter range, its the answer if it crosses
* the entire range. Either way we have to consume the next term here. */
/* if additional term hasn't been consumed, and is less than bucket
* term ... */
if (ret && ((cmp = str_nncmp(term, termlen, ret, len)) < 0) && !consumed) {
/* ... and its going to cross entire range ... */
if (sum + additional >= data + range) {
/* its the splitting point, determine whether it balances better on
* left or right of split and return */
*smaller = (sum + additional - data < data - sum);
return terms;
} else {
/* its not the splitting point, or even a candidate, just consume
* it */
sum += additional;
consumed = 1;
tmpsmaller = 1;
}
/* else if additional term is greater than bucket term or already
* consumed ... */
} else if (ret && (consumed || (cmp > 0))) {
/* ... and bucket term is going to cross entire range */
if (sum + len + veclen >= data + range) {
/* its the splitting point, determine whether it balances better on
* left or right of split and return */
*smaller = consumed;
return terms + (sum + len + veclen - data < data - sum);
} else {
/* its not the splitting point, or even a candidate, consume it */
sum += len + veclen;
tmpsmaller = consumed;
terms++;
ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
&len, &dataptr, &veclen);
}
/* else if they're equal ... */
} else if (ret && !consumed && !cmp) {
/* ... check if they will cross entire range ... */
if (sum + len + veclen + additional >= data + range) {
/* combination is the splitting point, determine whether it
* balances better on left or right of split and return */
*smaller = (sum + len + veclen + additional - data < data - sum);
return terms + *smaller;
} else {
/* they aren't the splitting point, or even a candidate, consume
* them */
sum += len + veclen + additional;
consumed = 1;
tmpsmaller = 1;
terms++;
ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
&len, &dataptr, &veclen);
}
}
/* haven't found a splitting point thus far, but everything until we exit
* the range is now a candidate */
index = -1;
disp = shortest = UINT_MAX;
/* XXX: note that code below here hasn't really been debugged, since
* ranges haven't been enabled yet */
/* iterate until we exit range */
assert(sum >= data - range);
while (ret && (sum < data + range)) {
cmp = str_nncmp(term, termlen, ret, len);
if (!consumed && (cmp < 0)) {
/* consume additional term */
/* if its the shortest entry, or equal shortest with smaller
* displacement from a perfectly balanced bucket, then its our
* current best candidate for splitting point */
if ((len < shortest)
|| ((len == shortest)
&& (((sum < data) && (data - sum < disp)
&& (((sum + additional < data)
&& (data - sum - additional < disp))
|| ((sum + additional > data)
&& (sum + additional - data < disp))))
|| ((sum > data)
&& (sum + additional - data < disp))))) {
/* calculate maximum displacement of term from midpoint */
if (sum < data) {
disp = data - sum;
if (sum + additional > data) {
if (sum + additional - data > disp) {
disp = sum + additional - data;
}
}
} else {
disp = sum + additional - data;
}
index = terms;
shortest = len;
tmpsmaller = 0;
}
sum += additional;
consumed = 1;
} else {
if (!consumed && !cmp) {
/* consume both terms */
if ((len < shortest)
|| ((len == shortest)
&& (((sum < data) && (data - sum < disp)
&& (((sum + len + veclen + additional < data)
&& (data - sum - len - veclen - additional < disp))
|| ((sum + len + veclen + additional > data)
&& (sum + len + veclen + additional - data < disp))))
|| ((sum > data)
&& (sum + len + veclen + additional - data
< disp))))) {
/* calculate maximum displacement of term from midpoint */
if (sum < data) {
disp = data - sum;
if (sum + len + veclen + additional > data) {
if (sum + len + veclen + additional - data > disp) {
disp = sum + len + veclen + additional - data;
}
}
} else {
disp = sum + len + veclen + additional - data;
}
index = terms + 1;
shortest = len;
tmpsmaller = 0;
}
sum += additional + len + veclen;
consumed = 1;
} else {
/* consume term from bucket */
if ((len < shortest)
|| ((len == shortest)
&& (((sum < data) && (data - sum < disp)
&& (((sum + len + veclen < data)
&& (data - sum - len - veclen < disp))
|| ((sum + len + veclen > data)
&& (sum + len + veclen - data < disp))))
|| ((sum > data)
&& (sum + len + veclen - data < disp))))) {
/* calculate maximum displacement of term from midpoint */
if (sum < data) {
disp = data - sum;
if (sum + len + veclen > data) {
if (sum + len + veclen - data > disp) {
disp = sum + len + veclen - data;
}
}
} else {
disp = sum + len + veclen - data;
}
index = terms + 1;
shortest = len;
tmpsmaller = consumed;
}
sum += len + veclen;
}
/* get next term from bucket */
terms++;
ret = bucket_next_term(bucketmem, bucketsize, strategy, &iter_state,
&len, &dataptr, &veclen);
}
}
assert((index != -1) && (disp != UINT_MAX) && (shortest != UINT_MAX));
*smaller = tmpsmaller;
return index;
}
| [
"bhagavan.prasad@blackpeppertech.com"
] | bhagavan.prasad@blackpeppertech.com |
e29206271b16aafaa8e71c6f225e0baf2ed27bd6 | f8fe633947f3db3aff35f0af688937469aa60066 | /server/server.h | a72d3f102a4e7e96398bd8c41230027943ee4692 | [] | no_license | mcordischi/photosynthesis | 5a25c5d5bc5d6e52e23fa53539bb899f03ba89d8 | 6e08001764aaf5e015e470a3ae1b74326ee087d7 | refs/heads/master | 2020-07-21T14:28:24.103792 | 2014-06-07T19:48:01 | 2014-06-07T19:48:01 | 10,872,925 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 85 | h | #ifndef __SERVER_H_
#define __SERVER_H_
void listen(char* (*proc)(char*));
#endif
| [
"nico@dazeo.com.ar"
] | nico@dazeo.com.ar |
34bfe63f15c2d0a942627f591bc3308707cd0dfd | a3421ecebedf3ba47a5480776078132be98ee61c | /lib/cmds/players/money.c | 4df874fda26619362b1604a0b595da7ebf03eb67 | [] | no_license | Muderru/NighmareMUD | 7851738d08b0d3d6a46fc7fe32cf25b3cdaffdb0 | c8f91447afaa4ff70460e300dd0a6c64e369bfd5 | refs/heads/master | 2020-03-27T13:45:03.384061 | 2018-08-29T15:57:52 | 2018-08-29T15:57:52 | 146,626,384 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,495 | c | // /bin/user/_money.c
// from the Nightmare mudlib
// a comand to allow players to search their pockets
// created by Descartes of Borg 25 april 1993
#include <lib.h>
inherit LIB_DAEMON;
mixed cmd(string str) {
string *currs;
string borg;
int i, tmp;
if(str) return 0; /* to allow the wiz command to work */
if( creatorp(this_player()) ) return "Sorry, coders don't get salaries here!";
currs = (string *)this_player()->GetCurrencies();
currs = filter(currs, (: this_player()->GetCurrency($1) > 0 :));
if( !currs || !sizeof(currs) ) {
write("You are broke.");
say(this_player()->GetName()+" comes up with empty pockets.");
return 1;
}
say(this_player()->GetName()+" fishes through "+
possessive(this_player())+" pockets examining some money.");
message("my_action", "In your pockets you find "+
((sizeof(currs) > 1) ? "these currencies: " : "only: "), this_player());
for(borg = "", i=0, tmp = sizeof(currs); i<tmp; i++) {
borg += ((this_player()->GetCurrency(currs[i]))+" "+currs[i]);
if(i == tmp-1) borg +=(".\n");
else if(tmp > 2 && i == tmp-2) borg += (", and ");
else if(tmp == 2) borg +=(" and ");
else borg +=(", ");
}
message("my_action", borg, this_player());
return 1;
}
void help() {
write("Syntax: <money>\n\n"
"Allows you to search your pockets for all your money\n"
"of all currency types.\n"
);
}
| [
"overmind2017@yandex.ru"
] | overmind2017@yandex.ru |
4c458e2fec5c9fcf895977fb1c22fc4accdef9a2 | 6f3e0000993816afa03d64c5a02b94fca2931200 | /sys/arch/amiga/dev/viewioctl.h | f1c075c8281de3e8628c8a572886e40a90191061 | [] | no_license | fallen/NetBSD6 | b6dc7a2593846816b8cb6f47cf26054ca2811667 | 44e0ac4ada812ace1f9ca8ce4792e287d83bd951 | refs/heads/master | 2022-04-09T14:50:47.274147 | 2020-03-08T14:01:38 | 2020-03-08T14:01:38 | 8,187,676 | 2 | 2 | null | 2020-03-08T14:01:39 | 2013-02-13T20:57:45 | null | UTF-8 | C | false | false | 2,588 | h | /* $NetBSD: viewioctl.h,v 1.9 2002/09/06 13:19:18 gehenna Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christian E. Hopps.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* The view major device is a placeholder device. It serves
* simply to map the semantics of a graphics dipslay to
* the semantics of a character block device. In other
* words the graphics system as currently built does not like to be
* refered to by open/close/ioctl. This device serves as
* a interface to graphics.
*/
struct view_size {
int x;
int y;
u_int width;
u_int height;
u_int depth;
};
#define VIOCREMOVE _IO('V', 0x0) /* if displaying remove. */
#define VIOCDISPLAY _IO('V', 0x1) /* if not displaying, display */
#define VIOCSSIZE _IOW('V', 0x2, struct view_size)
#define VIOCGSIZE _IOR('V', 0x3, struct view_size)
#define VIOCGBMAP _IOR('V', 0x4, bmap_t)
#define VIOCSCMAP _IOW('V', 0x5, colormap_t)
#define VIOCGCMAP _IOWR('V', 0x6, colormap_t)
#ifdef _KERNEL
void viewprobe(void);
#endif
| [
"yann.sionneau@gmail.com"
] | yann.sionneau@gmail.com |
8e40eeb74b69fcae2a3ec6744835ac2c616cabc7 | a171838fff520661daf6f7cccb2a273a4124edc9 | /NOIP2010/20100924/all/program/A王俊涛/concert.c | 20e786fbc695f88625d06c284def5fb92d9a85d8 | [] | no_license | strawberryfg/pascal | 5077e70900492e13d9857ab4fffd868e970a01ba | 257194db62aacd2fa8024aac095df601b09f417b | refs/heads/master | 2021-01-10T03:26:54.704729 | 2016-03-12T03:33:35 | 2016-03-12T03:33:35 | 53,711,195 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,399 | c | #include <stdio.h>
#include <stdlib.h>
FILE *fin,*fout;
int i,j,k,l,p1,p2,s1,s2;
int sum1,sum2,cha;
int girl[301],boy[301];
int main(int argc, char *argv[])
{ fin=fopen("concert.in","r");
fout=fopen("concert.out","w");
fscanf(fin,"%d",&l);
for(i=1;i<=l;i++)
fscanf(fin,"%d",&girl[i]);
for(i=1;i<=l;i++)
fscanf(fin,"%d",&boy[i]);
p1=1;
p2=1;
s1=1;
s2=1;
sum1=0;
sum2=0;
cha=0;
while((p1<l)&&(p2<l))
{while(boy[p2]==1)
p2++;
while(girl[p1]==1)
p1++;
sum1=boy[p2]*girl[p1];
s1=p1+1;
s2=p2+1;
if((p2!=l)&&(p1!=l))
{ for(j=1;j<p1;j++)
cha=cha+girl[p1];
sum1=sum1-cha*cha;
cha=0;
for(j=1;j<p2;j++)
cha=cha+boy[p2];
sum1=sum1-cha*cha;
}
else if(p1==l)
{for(j=p2+1;j<=l;j++)
cha=cha+boy[p2];
sum1=sum1-cha*cha;
cha=0;
for(j=s1;j<p1;j++)
cha=cha+girl[p1];
sum1=sum1-cha*cha;
}
else if(p2==l)
{
for(j=p1+1;j<=l;j++)
cha=cha+girl[p1];
sum1=sum1-cha*cha;
cha=0;
for(j=s2;j<p2;j++)
cha=cha+boy[p2];
sum1=sum1-cha*cha;
}
}
for(j=1;j<=l;j++)
sum2=sum2+boy[j]*girl[j];
if(sum2>sum1)
fprintf(fout,"%d\n",sum2);
else fprintf(fout,"%d\n",sum1);
return 0;
}
| [
"wanqingfu@sina.com"
] | wanqingfu@sina.com |
ecdf48a5e99c03e80d3d0804d4749b5ff8d67d07 | 5fe634e7327f5f62bcafa356e76d46f07b794b36 | /APUE/src/8/8-9_1.c | ef96ceb6650db9d35842bb2a1bc6f18626ff4e23 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | MarsonShine/Books | 8433bc1a5757e6d85e9cd649347926cfac59af08 | 7265c8a6226408ae687c796f604b35320926ed79 | refs/heads/master | 2023-08-31T05:32:35.202491 | 2023-08-30T10:29:26 | 2023-08-30T10:29:26 | 131,323,678 | 29 | 3 | Apache-2.0 | 2022-12-07T13:01:31 | 2018-04-27T17:00:17 | C# | UTF-8 | C | false | false | 627 | c | #include "apue.h"
static void charatatime(char *);
int main(void)
{
pid_t pid;
if ((pid == fork()) < 0) {
err_sys("fork error");
} else if (pid == 0) { // 子进程
charatatime("output from child\n");
} else {// 父进程
charatatime("output from parent\n");
}
exit(0);
}
static void charatatime(char *str)
{
char *ptr;
int c;
setbuf(stdout, NULL); // 设置无缓冲
for (ptr = str; (c = *ptr++) != 0;)
putc(c, stdout);
}
// 可能的输出结果:
// 1.
// ooutput form child
// utput from parent
// 2.
// oooutput from child
// utput from parent | [
"ms27946@outlook.com"
] | ms27946@outlook.com |
b6e8634221cb4319c3532a60dc30f6d8f8b006a1 | accbe82b976125427a864937a3b5d57e2c90ddcf | /09/ex10/main.c | 3b9461b37ab9379d1fdcf9ef9a1ba7225019b754 | [] | no_license | simdax/42correc | 861882cf9efebfad6266f819ed5a585832984e2b | 6e9af8980f74e48a945f61c7e51679b86e9a7f65 | refs/heads/master | 2021-01-15T22:39:30.229327 | 2017-08-24T12:23:24 | 2017-08-24T12:23:24 | 99,907,453 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 670 | c | #include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void ft_scrambler(int ***a, int *b, int *******c, int ****d);
int main()
{
int nb = 1;
int nb1 = 2;
int nb2 = 3;
int nb3 = 4;
int *pnb0 = &nb;
int **pnb01 = &pnb0;
int ***pnb02 = &pnb01;
int *pnb1 = &nb2;
int **pnb11 = &pnb1;
int ***pnb12 = &pnb11;
int ****pnb13 = &pnb12;
int *****pnb14 = &pnb13;
int ******pnb15 = &pnb14;
int *******pnb16 = &pnb15;
int *pnb2 = &nb3;
int **pnb21 = &pnb2;
int ***pnb22 = &pnb21;
int ****pnb23 = &pnb22;
int *pnb3 = &nb1;
ft_scrambler(pnb02, pnb3, pnb16, pnb23);
printf("%d et %d et %d et %d", nb, nb1, nb2, nb3);
return (0);
}
| [
"scornaz@e2r5p7.42.fr"
] | scornaz@e2r5p7.42.fr |
6ac15295a92c8a12a0c975af81dbd9a355096001 | 4c518f3a393e8a436dd75ceede72cc8eacd3e797 | /abc.c | 03c4af0f798ffdd70177dc44501711b3bfd60c1f | [] | no_license | aartigodase1998/AssignmentDemo | dc852189fdcd39b8462ce6ca156243f91d4d943a | d63d7fdf7584d5e32cbe982187e50e6f36f9f19b | refs/heads/master | 2023-05-14T22:42:44.443112 | 2021-05-28T13:59:43 | 2021-05-28T13:59:43 | 371,621,422 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 158 | c | #include<stdio.h>
void main()
{
int i;
int n=5;
for(i=0;i<10;i++)
{
printf("i value is %d",i);
}
for(i=1;i<=10;i++)
{
printf("\n %d",i*n);
}
} | [
"arati.godase@ibm.com"
] | arati.godase@ibm.com |
f2ddd405c80a7469f4b5a0b544f63369a81d3848 | c461a81314c3ae909c734a1736f90894344ff006 | /temp/util69.c | a2a0952d8ab4e62627e1cfdb17d610e9a58f115d | [] | no_license | flarss/many | 3e85ea139fc702ba4561942ac8bee6a520839f57 | a671f2fec22cde015f3bccf0bbd9eef345225de7 | refs/heads/master | 2021-01-10T11:42:52.047674 | 2015-10-08T18:46:40 | 2015-10-08T18:46:40 | 43,835,809 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 256 | c | #include "inc6.h"
#include <stdio.h>
#include "inc61.h"
#include "inc62.h"
#include "inc63.h"
#include "inc64.h"
#include "inc65.h"
#include "inc66.h"
#include "inc67.h"
#include "inc68.h"
#include "inc69.h"
void util69() { printf("util69 was here\n"); }
| [
"fredrikgit@gmail.com"
] | fredrikgit@gmail.com |
4ceddd972c5c748c17bb9f57e841a370ef477ea6 | fb75dcfff838efddd2148080f910608b36ee0e40 | /bin/MACROS/src/CMSStyle.C | 54831975de4c3d1999c57916bb3fd40e04ad4dea | [] | no_license | iraklic/myZgamma | 14231930d63c749458e85dd052cd3c3976039699 | 9b4ced4b134fbb4f557138fe4e6c5f6b833a1635 | refs/heads/master | 2020-12-24T17:17:22.019058 | 2015-09-14T23:47:35 | 2015-09-14T23:47:35 | 42,483,524 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,637 | c | //##########################################################################
// Initialization code executed at the start of a ROOT session.
//
// File: $Id: CMSStyle.C,v 1.1 2005/11/10 15:46:14 ganzhur Exp $
//##########################################################################
//#include <iostream>
//using namespace std;
void CMSstyle(){
// use the 'plain' style for plots (white backgrounds, etc)
// cout << "...using style 'Plain'" << endl;
gROOT->SetStyle("Plain");
// Create the 'CMS' style for approved plots. Note that this style may need
// some fine tuning in your macro depending on what you are plotting, e.g.
//
// gStyle->SetMarkerSize(0.75); // use smaller markers in a histogram with many bins
// gStyle->SetTitleOffset(0.65,"y"); // bring y axis label closer to narrow values
TStyle *cmsStyle= new TStyle("CMS","CMS approved plots style");
// use plain black on white colors
cmsStyle->SetFrameBorderMode(0);
cmsStyle->SetCanvasBorderMode(0);
cmsStyle->SetPadBorderMode(0);
cmsStyle->SetPadColor(0);
cmsStyle->SetCanvasColor(0);
cmsStyle->SetTitleColor(1);
cmsStyle->SetStatColor(0);
cmsStyle->SetFrameFillColor(0);
cmsStyle->SetLegendBorderSize(0);
// set the paper & margin sizes
cmsStyle->SetPaperSize(20,26);
cmsStyle->SetPadTopMargin(0.05);
cmsStyle->SetPadRightMargin(0.05);
cmsStyle->SetPadBottomMargin(0.17);
cmsStyle->SetPadLeftMargin(0.17);
// use large Times-Roman fonts
cmsStyle->SetTextFont(132);
cmsStyle->SetTextSize(0.08);
cmsStyle->SetLabelFont(132,"x");
cmsStyle->SetLabelFont(132,"y");
cmsStyle->SetLabelFont(132,"z");
cmsStyle->SetTitleFont(132,"x");
cmsStyle->SetTitleFont(132,"y");
cmsStyle->SetTitleFont(132,"z");
cmsStyle->SetLabelSize(0.05,"x");
cmsStyle->SetTitleSize(0.06,"x");
cmsStyle->SetLabelSize(0.05,"y");
cmsStyle->SetTitleSize(0.06,"y");
cmsStyle->SetLabelSize(0.05,"z");
cmsStyle->SetTitleSize(0.06,"z");
// use bold lines and markers
cmsStyle->SetMarkerStyle(8);
cmsStyle->SetHistLineWidth(1.85);
cmsStyle->SetLineStyleString(2,"[12 12]"); // postscript dashes
// do not display any of the standard histogram decorations
cmsStyle->SetOptTitle(1);
cmsStyle->SetOptStat(1);
cmsStyle->SetOptFit(1);
// put tick marks on top and RHS of plots
cmsStyle->SetPadTickX(1);
cmsStyle->SetPadTickY(1);
// cout << endl << " For approved plots use: gROOT->SetStyle(\"CMS\");"
// << endl << " To add a CMS label use: CMSLabel();"
// << endl << endl;
// restore the plain style
gROOT->SetStyle("Plain");
gROOT->SetStyle("CMS");
return ;
}
| [
"iraklic@gmail.com"
] | iraklic@gmail.com |
c410186aaa272cd6625a38f8e698df7b7265309d | 09f63e43bb01fb1803584cd4774f07bddbb21d25 | /Windows/stdafx.h | a427989b1d5faf40799d03d8192c87f3bd7d0d02 | [] | no_license | KatekovAnton/wwiseIntegrationDemo | 74ab0d5302e9d09c689db0f6798798c0af6fe01e | 70caeb323919076e5ca66dde1bdbfb2063da9551 | refs/heads/master | 2020-06-20T23:20:09.395626 | 2020-03-19T13:33:11 | 2020-03-19T13:33:11 | 197,285,062 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,313 | h | /*******************************************************************************
The content of this file includes portions of the AUDIOKINETIC Wwise Technology
released in source code form as part of the SDK installer package.
Commercial License Usage
Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
may use this file in accordance with the end user license agreement provided
with the software or, alternatively, in accordance with the terms contained in a
written agreement between you and Audiokinetic Inc.
Version: v2019.1.1 Build: 6977
Copyright (c) 2006-2019 Audiokinetic Inc.
*******************************************************************************/
// stdafx.h
/// \file
/// Precompiled Header File for the Integration Demo application.
#pragma once
////////////////////////////////////////////
// Helper Includes
////////////////////////////////////////////
#include <AK/SoundEngine/Common/AkTypes.h>
#include <AK/Tools/Common/AkPlatformFuncs.h>
#define WIN32_LEAN_AND_MEAN
#define DIRECTINPUT_VERSION 0x0800
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#include <windows.h>
#include <dinput.h>
#include <xinput.h>
#include <d3d9.h>
#include <D3dx9core.h>
#include <wchar.h> | [
"void0main@gmail.com"
] | void0main@gmail.com |
7c4fd607ae87f32065be8efdbc63793683534436 | 13b21706e7ed4dc1291c88c9ad62c88de4320b9b | /Projects/Shark/Reload.h | 51ed1406b59d46a6f31602d9c24af0e43f1a3f91 | [
"MIT"
] | permissive | fadinglr/Shark | dcbf1139433ecd8bb62d70e48b93a510215597a4 | 0a62f87eb5ea6f8b963775e8be2481f3b5a8a31a | refs/heads/master | 2023-04-27T01:40:14.289676 | 2021-04-27T02:06:10 | 2021-04-27T02:06:10 | 319,513,746 | 0 | 0 | MIT | 2021-04-27T02:06:11 | 2020-12-08T03:23:56 | null | UTF-8 | C | false | false | 10,178 | h | /*
*
* Copyright (c) 2015 - 2021 by blindtiger. All rights reserved.
*
* The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. SEe the License
* for the specific language governing rights and limitations under the
* License.
*
* The Initial Developer of the Original e is blindtiger.
*
*/
#ifndef _RELOAD_H_
#define _RELOAD_H_
#include <guarddefs.h>
#include <devicedefs.h>
#include <dump.h>
#include "Space.h"
#ifdef __cplusplus
/* Assume byte packing throughout */
extern "C" {
#endif /* __cplusplus */
typedef LONG EX_SPIN_LOCK, *PEX_SPIN_LOCK;
typedef enum _OB_PREOP_CALLBACK_STATUS OB_PREOP_CALLBACK_STATUS;
typedef struct _OB_PRE_OPERATION_INFORMATION *POB_PRE_OPERATION_INFORMATION;
typedef struct _OB_POST_OPERATION_INFORMATION *POB_POST_OPERATION_INFORMATION;
typedef struct _GPBLOCK {
PLIST_ENTRY PsLoadedModuleList;
PEPROCESS PsInitialSystemProcess;
PERESOURCE PsLoadedModuleResource;
struct _FUNCTION_TABLE * PsInvertedFunctionTable;
KSERVICE_TABLE_DESCRIPTOR * KeServiceDescriptorTable;
KSERVICE_TABLE_DESCRIPTOR * KeServiceDescriptorTableShadow;
PKLDR_DATA_TABLE_ENTRY KernelDataTableEntry; // ntoskrnl.exe
PKLDR_DATA_TABLE_ENTRY CoreDataTableEntry; // self
ptr CpuControlBlock; // hypervisor
ptr NativeObject;
#ifdef _WIN64
ptr Wx86NativeObject;
#endif // _WIN64
LIST_ENTRY LoadedPrivateImageList;
LIST_ENTRY ObjectList;
KSPIN_LOCK ObjectLock;
s8 NumberProcessors;
s8 Linkage[3];// { 0x33, 0xc0, 0xc3 };
s32 BuildNumber;
u32 Flags;
u64 * PerfGlobalGroupMask;
s8 KiSystemServiceCopyEnd[6];
cptr PerfInfoLogSysCallEntry;
ptr KeUserExceptionDispatcher;
#ifdef _WIN64
PMMPTE PxeBase;
PMMPTE PxeTop;
PMMPTE PpeBase;
PMMPTE PpeTop;
#endif // _WIN64
PMMPTE PdeBase;
PMMPTE PdeTop;
PMMPTE PteBase;
PMMPTE PteTop;
void
(NTAPI * KiDispatchException)(
__in PEXCEPTION_RECORD ExceptionRecord,
__in PKEXCEPTION_FRAME ExceptionFrame,
__in PKTRAP_FRAME TrapFrame,
__in KPROCESSOR_MODE PreviousMode,
__in b FirstChance
);
void
(NTAPI * KeContextFromKframes)(
__in PKTRAP_FRAME TrapFrame,
#if defined(_X86_)
__in_opt PKEXCEPTION_FRAME ExceptionFrame,
#else
__in PKEXCEPTION_FRAME ExceptionFrame,
#endif
__inout PCONTEXT ContextFrame
);
void
(NTAPI * KeContextToKframes)(
__inout PKTRAP_FRAME TrapFrame,
#if defined(_X86_)
__inout_opt PKEXCEPTION_FRAME ExceptionFrame,
#else
__inout PKEXCEPTION_FRAME ExceptionFrame,
#endif
__in PCONTEXT ContextFrame,
__in u32 ContextFlags,
__in KPROCESSOR_MODE PreviousMode
);
#ifndef _WIN64
status
(NTAPI * DbgkpSendApiMessageLpc)(
__inout ptr ApiMsg,
__in ptr Port,
__in b SuspendProcess
);
status
(FASTCALL * FastDbgkpSendApiMessageLpc)(
__inout ptr ApiMsg,
__in ptr Port,
__in b SuspendProcess
);
#else
status
(FASTCALL * DbgkpSendApiMessageLpc)(
__inout ptr ApiMsg,
__in ptr Port,
__in b SuspendProcess
);
#endif // !_WIN64
OB_PREOP_CALLBACK_STATUS
(NTAPI * GlobalObjectPreCallback)(
__in ptr RegistrationContext,
__in POB_PRE_OPERATION_INFORMATION OperationInformation
);
void
(NTAPI * GlobalObjectPostCallback)(
__in ptr RegistrationContext,
__in POB_POST_OPERATION_INFORMATION OperationInformation
);
void
(NTAPI * GlobalProcessNotify)(
__in ptr ParentId,
__in ptr ProcessId,
__in b Create
);
void
(NTAPI * GlobalThreadNotify)(
__in ptr ProcessId,
__in ptr ThreadId,
__in b Create
);
void
(NTAPI * GlobalImageNotify)(
__in PUNICODE_STRING FullImageName,
__in ptr ProcessId,
__in PIMAGE_INFO ImageInfo
);
void
(NTAPI * KeEnterCriticalRegion)(
void
);
void
(NTAPI * KeLeaveCriticalRegion)(
void
);
status
(NTAPI * PspCreateThread)(
__out ptr * ThreadHandle,
__in ACCESS_MASK DesiredAccess,
__in_opt POBJECT_ATTRIBUTES ObjectAttributes,
__in ptr ProcessHandle,
__in PEPROCESS ProcessPointer,
__in_opt ptr Reserved,
__in_opt PLARGE_INTEGER Cookie,
__out_opt PCLIENT_ID ClientId,
__in_opt PCONTEXT ThreadContext,
__in_opt PINITIAL_TEB InitialTeb,
__in b CreateSuspended,
__in_opt PKSTART_ROUTINE StartRoutine,
__in ptr StartContext
);
void
(NTAPI * PspInitializeThunkContext)(
void
);
b
(FASTCALL * ExAcquireRundownProtection)(
__inout PEX_RUNDOWN_REF RunRef
);
void
(FASTCALL * ExReleaseRundownProtection)(
__inout PEX_RUNDOWN_REF RunRef
);
void
(FASTCALL * ExWaitForRundownProtectionRelease)(
__inout PEX_RUNDOWN_REF RunRef
);
KIRQL
(NTAPI * ExAcquireSpinLockShared)(
__inout PEX_SPIN_LOCK SpinLock
);
void
(NTAPI * ExReleaseSpinLockShared)(
__inout PEX_SPIN_LOCK SpinLock,
__in KIRQL OldIrql
);
u32
(NTAPI * DbgPrint)(
__in PCH Format,
...
);
u
(NTAPI * RtlCompareMemory)(
const void * Destination,
const void * Source,
u Length
);
void
(NTAPI * RtlRestoreContext)(
__in PCONTEXT ContextRecord,
__in_opt struct _EXCEPTION_RECORD *ExceptionRecord
);
void
(NTAPI * ExQueueWorkItem)(
__inout PWORK_QUEUE_ITEM WorkItem,
__in WORK_QUEUE_TYPE QueueType
);
void
(NTAPI * ExFreePoolWithTag)(
__in ptr P,
__in u32 Tag
);
PSAFEGUARD_OBJECT BugCheckHandle;
void
(NTAPI * KeBugCheckEx)(
__in u32 BugCheckCode,
__in u P1,
__in u P2,
__in u P3,
__in u P4
);
PLIST_ENTRY
(FASTCALL * ExInterlockedRemoveHeadList)(
__inout PLIST_ENTRY ListHead,
__inout PKSPIN_LOCK Lock
);
ptr ObjectCallback;
KDDEBUGGER_DATA64 DebuggerDataBlock;
KDDEBUGGER_DATA_ADDITION64 DebuggerDataAdditionBlock;
u16 OffsetKProcessThreadListHead;
u16 OffsetKThreadThreadListEntry;
u16 OffsetKThreadWin32StartAddress;
u32 OffsetKThreadProcessId;
struct _PGBLOCK * PgBlock;
} GPBLOCK, *PGPBLOCK;
NTKERNELAPI
status
NTAPI
PsAcquireProcessExitSynchronization(
__in PEPROCESS Process
);
NTKERNELAPI
void
NTAPI
PsReleaseProcessExitSynchronization(
__in PEPROCESS Process
);
#define FastAcquireRundownProtection(ref) \
GpBlock.ExAcquireRundownProtection((ref))
#define FastReleaseRundownProtection(ref) \
GpBlock.ExReleaseRundownProtection((ref))
#define FastWaitForRundownProtectionRelease(ref) \
GpBlock.ExWaitForRundownProtectionRelease((ref))
#define FastAcquireObjectLock(irql) \
*(irql) = GpBlock.ExAcquireSpinLockShared(&GpBlock.ObjectLock)
#define FastReleaseObjectLock(irql) \
GpBlock.ExReleaseSpinLockShared(&GpBlock.ObjectLock, (irql))
VOID
NTAPI
InitializeGpBlock(
__in PGPBLOCK Block
);
ULONG
NTAPI
GetPlatform(
__in PVOID ImageBase
);
ULONG
NTAPI
GetTimeStamp(
__in PVOID ImageBase
);
USHORT
NTAPI
GetSubsystem(
__in PVOID ImageBase
);
ULONG
NTAPI
GetSizeOfImage(
__in PVOID ImageBase
);
PVOID
NTAPI
GetAddressOfEntryPoint(
__in PVOID ImageBase
);
PIMAGE_SECTION_HEADER
NTAPI
SectionTableFromVirtualAddress(
__in PVOID ImageBase,
__in PVOID Address
);
PIMAGE_SECTION_HEADER
NTAPI
FindSection(
__in PVOID ImageBase,
__in PCSTR SectionName
);
NTSTATUS
NTAPI
FindEntryForKernelImage(
__in PUNICODE_STRING ImageFileName,
__out PKLDR_DATA_TABLE_ENTRY * DataTableEntry
);
NTSTATUS
NTAPI
FindEntryForKernelImageAddress(
__in PVOID Address,
__out PKLDR_DATA_TABLE_ENTRY * DataTableEntry
);
extern PGPBLOCK GpBlock;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // !_RELOAD_H_
| [
"blindtiger@foxmail.com"
] | blindtiger@foxmail.com |
5db7b7772830f1476bd1d8df4109aad3f0f5a622 | 863f370574674bfcdc79961a4b1589778d6c2624 | /charData.c | aa2272ccfbfdd60b293bca18134168435a8e11ae | [] | no_license | NoMan2000/c-prog | df94aec681a41567093f1b24bbdae5359516cea7 | 6e20d0d98e772d0f37f32078ff6aecdbb1c8b4d2 | refs/heads/master | 2021-01-16T19:20:25.993495 | 2013-10-02T20:13:38 | 2013-10-02T20:13:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 188 | c | #include <stdio.h>
#include <cstring>
int main()
{
char firstName[20];
strcpy(firstName, "Michael");
printf("Your first name is %s", firstName);
return(0);
} | [
"msoileau@itt-tech.edu"
] | msoileau@itt-tech.edu |
96da62af45a6379c5b8c44c233ce6528905d61d7 | 48a400042c41feb1b305da0aff3b8a2ad535bdc1 | /clang/test/RC99/CodeGen/irf-sub-02.c | ef52b4a29131feab34bcf99426fa245f027828b7 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | Daasin/tpc_llvm | d9942f0a031213ba5f23e2053d04c3649aa67b03 | ece488f96ae81dd9790f07438a949407dc87ef66 | refs/heads/main | 2023-07-29T16:10:36.488513 | 2021-08-23T10:38:48 | 2021-09-10T05:48:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 407 | c | // RUN: %codegen -S -O1 -triple tpc-none-none -std=rc99 %s -o - | FileCheck %s
void main(int src, int src1, int src2) {
int64 val = src;
int cnt = 0;
int5 ndx1 = { src, src, src, src, src };
while (cnt > src2) {
i32_st_tnsr_i_v_b(ndx1, 1, val, 1, 0);
ndx1[3] -= 10;
}
}
// CHECK: st_tnsr 0x1, [[NDX:%I[0-9]+]], %V{{[0-9]+}}, %SP{{[0-9]+}}
// CHECK: add.i32 b01000 %I2, -0xa, %I2, %SP0
| [
"ogabbay@kernel.org"
] | ogabbay@kernel.org |
9e778b020a7b122b424fc4a64f489a0fd59c25c5 | 77cf4be91eb945cacf96e8cc56bec03c97e144d0 | /evenint.c | 232a3918e7243568191620bd566d7bed14f716e8 | [] | no_license | THARANYATHANGAVEL/hai-dear | a3aa72c8b36315206321ff98f04ebbedde5fed79 | 3642319093c3da442c86e016b5c39d7fb4e71274 | refs/heads/master | 2021-01-16T18:07:15.441115 | 2018-04-11T14:14:56 | 2018-04-11T14:14:56 | 100,038,034 | 1 | 7 | null | null | null | null | UTF-8 | C | false | false | 225 | c | #include<stdio.h>
#include<conio.h>
void main()
{
int f,l,i;
printf("enter the value first number");
scanf("%d",&f);
printf("enter last value");
scanf("%d",&l);
for(i=f;i<=l;i++)
{
if(i%2==0)
{
printf("%d",i);
}
}
getch();
}
| [
"noreply@github.com"
] | THARANYATHANGAVEL.noreply@github.com |
2da9f5686999c7948360488a9a01990c280f5971 | 805263fc4563a4074df54272d6e96ade9b4ca9da | /glues/source/glues_quad.c | 7b6fc207ffbb3ba12babdb7d3a1e6aec51888e3c | [] | no_license | spygunsoft/Physic-and-Gameplay-Implementation-on-PrimeEngine | b2aa37d7781941400851e8a7551f3b789f6e5c80 | f47366bd0d69691ab335924e23e915061d5ee71a | refs/heads/master | 2020-04-06T12:59:28.492976 | 2018-11-14T02:34:37 | 2018-11-14T02:34:37 | 157,478,887 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 53,166 | c | /*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, 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 including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*
* OpenGL ES CM 1.0 port of part of GLU by Mike Gorchak <mike@malva.ua>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "glues_quad.h"
/* Make it not a power of two to avoid cache thrashing on the chip */
#define CACHE_SIZE 240
#undef PI
#define PI 3.14159265358979323846f
struct GLUquadric
{
GLint normals;
GLboolean textureCoords;
GLint orientation;
GLint drawStyle;
void (APIENTRY* errorCallback)( GLint );
};
GLAPI GLUquadric* APIENTRY gluNewQuadric(void)
{
GLUquadric *newstate;
newstate=(GLUquadric*)malloc(sizeof(GLUquadric));
if (newstate==NULL)
{
/* Can't report an error at this point... */
return NULL;
}
newstate->normals=GLU_SMOOTH;
newstate->textureCoords=GL_FALSE;
newstate->orientation=GLU_OUTSIDE;
newstate->drawStyle=GLU_FILL;
newstate->errorCallback=NULL;
return newstate;
}
GLAPI void APIENTRY gluDeleteQuadric(GLUquadric* state)
{
if (state!=NULL)
{
free(state);
}
}
static void gluQuadricError(GLUquadric* qobj, GLenum which)
{
if (qobj->errorCallback)
{
qobj->errorCallback(which);
}
}
GLAPI void APIENTRY gluQuadricCallback(GLUquadric* qobj, GLenum which, _GLUfuncptr fn)
{
switch (which)
{
case GLU_ERROR:
qobj->errorCallback=(void(APIENTRY*)(GLint))fn;
break;
default:
gluQuadricError(qobj, GLU_INVALID_ENUM);
return;
}
}
GLAPI void APIENTRY gluQuadricNormals(GLUquadric* qobj, GLenum normals)
{
switch (normals)
{
case GLU_SMOOTH:
case GLU_FLAT:
case GLU_NONE:
break;
default:
gluQuadricError(qobj, GLU_INVALID_ENUM);
return;
}
qobj->normals=normals;
}
GLAPI void APIENTRY gluQuadricTexture(GLUquadric* qobj, GLboolean textureCoords)
{
qobj->textureCoords=textureCoords;
}
GLAPI void APIENTRY gluQuadricOrientation(GLUquadric* qobj, GLenum orientation)
{
switch(orientation)
{
case GLU_OUTSIDE:
case GLU_INSIDE:
break;
default:
gluQuadricError(qobj, GLU_INVALID_ENUM);
return;
}
qobj->orientation=orientation;
}
GLAPI void APIENTRY gluQuadricDrawStyle(GLUquadric* qobj, GLenum drawStyle)
{
switch(drawStyle)
{
case GLU_POINT:
case GLU_LINE:
case GLU_FILL:
case GLU_SILHOUETTE:
break;
default:
gluQuadricError(qobj, GLU_INVALID_ENUM);
return;
}
qobj->drawStyle=drawStyle;
}
GLAPI void APIENTRY gluCylinder(GLUquadric* qobj, GLfloat baseRadius,
GLfloat topRadius, GLfloat height,
GLint slices, GLint stacks)
{
GLint i, j;
GLfloat sinCache[CACHE_SIZE];
GLfloat cosCache[CACHE_SIZE];
GLfloat sinCache2[CACHE_SIZE];
GLfloat cosCache2[CACHE_SIZE];
GLfloat sinCache3[CACHE_SIZE];
GLfloat cosCache3[CACHE_SIZE];
GLfloat sintemp, costemp;
GLfloat vertices[(CACHE_SIZE+1)*2][3];
GLfloat texcoords[(CACHE_SIZE+1)*2][2];
GLfloat normals[(CACHE_SIZE+1)*2][3];
GLfloat angle;
GLfloat zLow, zHigh;
GLfloat length;
GLfloat deltaRadius;
GLfloat zNormal;
GLfloat xyNormalRatio;
GLfloat radiusLow, radiusHigh;
int needCache2, needCache3;
GLboolean texcoord_enabled;
GLboolean normal_enabled;
GLboolean vertex_enabled;
GLboolean color_enabled;
if (slices>=CACHE_SIZE)
{
slices=CACHE_SIZE-1;
}
/* Avoid vertex array overflow */
if (stacks>=CACHE_SIZE)
{
stacks=CACHE_SIZE-1;
}
if (slices<2 || stacks<1 || baseRadius<0.0 || topRadius<0.0 || height<0.0)
{
gluQuadricError(qobj, GLU_INVALID_VALUE);
return;
}
/* Compute length (needed for normal calculations) */
deltaRadius=baseRadius-topRadius;
length=(GLfloat)sqrt(deltaRadius*deltaRadius+height*height);
if (length==0.0)
{
gluQuadricError(qobj, GLU_INVALID_VALUE);
return;
}
/* Cache is the vertex locations cache */
/* Cache2 is the various normals at the vertices themselves */
/* Cache3 is the various normals for the faces */
needCache2=needCache3=0;
if (qobj->normals==GLU_SMOOTH)
{
needCache2=1;
}
if (qobj->normals==GLU_FLAT)
{
if (qobj->drawStyle!=GLU_POINT)
{
needCache3=1;
}
if (qobj->drawStyle==GLU_LINE)
{
needCache2=1;
}
}
zNormal=deltaRadius/length;
xyNormalRatio=height/length;
for (i=0; i<slices; i++)
{
angle=2.0f*PI*i/slices;
if (needCache2)
{
if (qobj->orientation==GLU_OUTSIDE)
{
sinCache2[i]=(GLfloat)(xyNormalRatio*sin(angle));
cosCache2[i]=(GLfloat)(xyNormalRatio*cos(angle));
}
else
{
sinCache2[i]=(GLfloat)(-xyNormalRatio*sin(angle));
cosCache2[i]=(GLfloat)(-xyNormalRatio*cos(angle));
}
}
sinCache[i]=(GLfloat)sin(angle);
cosCache[i]=(GLfloat)cos(angle);
}
if (needCache3)
{
for (i=0; i<slices; i++)
{
angle=2.0f*PI*(i-0.5f)/slices;
if (qobj->orientation==GLU_OUTSIDE)
{
sinCache3[i]=(GLfloat)(xyNormalRatio*sin(angle));
cosCache3[i]=(GLfloat)(xyNormalRatio*cos(angle));
}
else
{
sinCache3[i]=(GLfloat)(-xyNormalRatio*sin(angle));
cosCache3[i]=(GLfloat)(-xyNormalRatio*cos(angle));
}
}
}
sinCache[slices]=sinCache[0];
cosCache[slices]=cosCache[0];
if (needCache2)
{
sinCache2[slices]=sinCache2[0];
cosCache2[slices]=cosCache2[0];
}
if (needCache3)
{
sinCache3[slices]=sinCache3[0];
cosCache3[slices]=cosCache3[0];
}
/* Store status of enabled arrays */
texcoord_enabled=GL_FALSE; //glIsEnabled(GL_TEXTURE_COORD_ARRAY);
normal_enabled=GL_FALSE; //glIsEnabled(GL_NORMAL_ARRAY);
vertex_enabled=GL_FALSE; //glIsEnabled(GL_VERTEX_ARRAY);
color_enabled=GL_FALSE; //glIsEnabled(GL_COLOR_ARRAY);
/* Enable or disable arrays */
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
if (qobj->textureCoords)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (qobj->normals!=GLU_NONE)
{
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, normals);
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
glDisableClientState(GL_COLOR_ARRAY);
switch (qobj->drawStyle)
{
case GLU_FILL:
for (j=0; j<stacks; j++)
{
zLow=j*height/stacks;
zHigh=(j+1)*height/stacks;
radiusLow=baseRadius-deltaRadius*((GLfloat)j/stacks);
radiusHigh=baseRadius-deltaRadius*((GLfloat)(j+1)/stacks);
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_FLAT:
/* per vertex normals */
normals[i*2][0]=sinCache3[i];
normals[i*2][1]=cosCache3[i];
normals[i*2][2]=zNormal;
normals[i*2+1][0]=sinCache3[i];
normals[i*2+1][1]=cosCache3[i];
normals[i*2+1][2]=zNormal;
break;
case GLU_SMOOTH:
/* per vertex normals */
normals[i*2][0]=sinCache2[i];
normals[i*2][1]=cosCache2[i];
normals[i*2][2]=zNormal;
normals[i*2+1][0]=sinCache2[i];
normals[i*2+1][1]=cosCache2[i];
normals[i*2+1][2]=zNormal;
break;
case GLU_NONE:
default:
break;
}
if (qobj->orientation==GLU_OUTSIDE)
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=1-(GLfloat)i/slices;
texcoords[i*2][1]=(GLfloat)j/stacks;
}
vertices[i*2][0]=radiusLow*sinCache[i];
vertices[i*2][1]=radiusLow*cosCache[i];
vertices[i*2][2]=zLow;
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=1-(GLfloat)i/slices;
texcoords[i*2+1][1]=(GLfloat)(j+1)/stacks;
}
vertices[i*2+1][0]=radiusHigh*sinCache[i];
vertices[i*2+1][1]=radiusHigh*cosCache[i];
vertices[i*2+1][2]=zHigh;
}
else
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=1-(GLfloat)i/slices;
texcoords[i*2][1]=(GLfloat)(j+1)/ stacks;
}
vertices[i*2][0]=radiusHigh*sinCache[i];
vertices[i*2][1]=radiusHigh*cosCache[i];
vertices[i*2][2]=zHigh;
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=1-(GLfloat)i/slices;
texcoords[i*2+1][1]=(GLfloat)j/stacks;
}
vertices[i*2+1][0]=radiusLow*sinCache[i];
vertices[i*2+1][1]=radiusLow*cosCache[i];
vertices[i*2+1][2]=zLow;
}
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, 2*(slices+1));
}
break;
case GLU_POINT:
for (i=0; i<slices; i++)
{
sintemp=sinCache[i];
costemp=cosCache[i];
for (j=0; j<=stacks; j++)
{
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
normals[j][0]=sinCache2[i];
normals[j][1]=cosCache2[i];
normals[j][2]=zNormal;
break;
case GLU_NONE:
default:
break;
}
zLow=j*height/stacks;
radiusLow=baseRadius-deltaRadius*((GLfloat)j/stacks);
if (qobj->textureCoords)
{
texcoords[j][0]=1-(GLfloat)i/slices;
texcoords[j][1]=(GLfloat)j/stacks;
}
vertices[j][0]=radiusLow*sintemp;
vertices[j][1]=radiusLow*costemp;
vertices[j][2]=zLow;
}
glDrawArrays(GL_POINTS, 0, (stacks+1));
}
break;
case GLU_LINE:
for (j=1; j<stacks; j++)
{
zLow=j*height/stacks;
radiusLow=baseRadius-deltaRadius*((GLfloat)j/stacks);
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_FLAT:
normals[i][0]=sinCache3[i];
normals[i][1]=cosCache3[i];
normals[i][2]=zNormal;
break;
case GLU_SMOOTH:
normals[i][0]=sinCache2[i];
normals[i][1]=cosCache2[i];
normals[i][2]=zNormal;
break;
case GLU_NONE:
default:
break;
}
if (qobj->textureCoords)
{
texcoords[i][0]=1-(GLfloat)i/slices;
texcoords[i][1]=(GLfloat)j/stacks;
}
vertices[i][0]=radiusLow*sinCache[i];
vertices[i][1]=radiusLow*cosCache[i];
vertices[i][2]=zLow;
}
glDrawArrays(GL_LINE_STRIP, 0, (slices+1));
}
/* Intentionally fall through here... */
case GLU_SILHOUETTE:
for (j=0; j<=stacks; j+=stacks)
{
zLow=j*height/stacks;
radiusLow=baseRadius-deltaRadius*((GLfloat)j/stacks);
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_FLAT:
normals[i][0]=sinCache3[i];
normals[i][1]=cosCache3[i];
normals[i][2]=zNormal;
break;
case GLU_SMOOTH:
normals[i][0]=sinCache2[i];
normals[i][1]=cosCache2[i];
normals[i][2]=zNormal;
break;
case GLU_NONE:
default:
break;
}
if (qobj->textureCoords)
{
texcoords[i][0]=1-(GLfloat)i/slices;
texcoords[i][1]=(GLfloat)j/stacks;
}
vertices[i][0]=radiusLow*sinCache[i];
vertices[i][1]=radiusLow*cosCache[i];
vertices[i][2]=zLow;
}
glDrawArrays(GL_LINE_STRIP, 0, (slices+1));
}
for (i=0; i<slices; i++)
{
sintemp=sinCache[i];
costemp=cosCache[i];
for (j=0; j<=stacks; j++)
{
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
normals[j][0]=sinCache2[i];
normals[j][1]=cosCache2[i];
normals[j][2]=0.0f;
break;
case GLU_NONE:
default:
break;
}
zLow=j*height/stacks;
radiusLow=baseRadius-deltaRadius*((GLfloat)j/stacks);
if (qobj->textureCoords)
{
texcoords[j][0]=1-(GLfloat)i/slices;
texcoords[j][1]=(GLfloat)j/stacks;
}
vertices[j][0]=radiusLow*sintemp;
vertices[j][1]=radiusLow*costemp;
vertices[j][2]=zLow;
}
glDrawArrays(GL_LINE_STRIP, 0, (stacks+1));
}
break;
default:
break;
}
/* Disable or re-enable arrays */
if (vertex_enabled)
{
/* Re-enable vertex array */
glEnableClientState(GL_VERTEX_ARRAY);
}
else
{
glDisableClientState(GL_VERTEX_ARRAY);
}
if (texcoord_enabled)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (normal_enabled)
{
glEnableClientState(GL_NORMAL_ARRAY);
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
if (color_enabled)
{
glEnableClientState(GL_COLOR_ARRAY);
}
else
{
glDisableClientState(GL_COLOR_ARRAY);
}
}
GLAPI void APIENTRY gluDisk(GLUquadric* qobj, GLfloat innerRadius,
GLfloat outerRadius, GLint slices, GLint loops)
{
gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0);
}
GLAPI void APIENTRY gluPartialDisk(GLUquadric* qobj, GLfloat innerRadius,
GLfloat outerRadius, GLint slices,
GLint loops, GLfloat startAngle,
GLfloat sweepAngle)
{
GLint i, j;
GLfloat sinCache[CACHE_SIZE];
GLfloat cosCache[CACHE_SIZE];
GLfloat angle;
GLfloat sintemp, costemp;
GLfloat vertices[(CACHE_SIZE+1)*2][3];
GLfloat texcoords[(CACHE_SIZE+1)*2][2];
GLfloat deltaRadius;
GLfloat radiusLow, radiusHigh;
GLfloat texLow = 0.0, texHigh = 0.0;
GLfloat angleOffset;
GLint slices2;
GLint finish;
GLboolean texcoord_enabled;
GLboolean normal_enabled;
GLboolean vertex_enabled;
GLboolean color_enabled;
if (slices>=CACHE_SIZE)
{
slices=CACHE_SIZE-1;
}
if (slices<2 || loops<1 || outerRadius<=0.0 ||
innerRadius<0.0 ||innerRadius > outerRadius)
{
gluQuadricError(qobj, GLU_INVALID_VALUE);
return;
}
if (sweepAngle<-360.0)
{
sweepAngle=-360.0;
}
if (sweepAngle>360.0)
{
sweepAngle=360.0;
}
if (sweepAngle<0)
{
startAngle+=sweepAngle;
sweepAngle=-sweepAngle;
}
if (sweepAngle==360.0)
{
slices2=slices;
}
else
{
slices2=slices+1;
}
/* Compute length (needed for normal calculations) */
deltaRadius=outerRadius-innerRadius;
/* Cache is the vertex locations cache */
angleOffset=startAngle/180.0f*PI;
for (i=0; i<=slices; i++)
{
angle=angleOffset+((PI*sweepAngle)/180.0f)*i/slices;
sinCache[i]=(GLfloat)sin(angle);
cosCache[i]=(GLfloat)cos(angle);
}
if (sweepAngle==360.0)
{
sinCache[slices]=sinCache[0];
cosCache[slices]=cosCache[0];
}
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
if (qobj->orientation==GLU_OUTSIDE)
{
glNormal3f(0.0f, 0.0f, 1.0f);
}
else
{
glNormal3f(0.0f, 0.0f, -1.0f);
}
break;
default:
case GLU_NONE:
break;
}
/* Store status of enabled arrays */
texcoord_enabled=GL_FALSE; //glIsEnabled(GL_TEXTURE_COORD_ARRAY);
normal_enabled=GL_FALSE; //glIsEnabled(GL_NORMAL_ARRAY);
vertex_enabled=GL_FALSE; //glIsEnabled(GL_VERTEX_ARRAY);
color_enabled=GL_FALSE; //glIsEnabled(GL_COLOR_ARRAY);
/* Enable arrays */
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
if (qobj->textureCoords)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
switch (qobj->drawStyle)
{
case GLU_FILL:
if (innerRadius==0.0)
{
finish=loops-1;
/* Triangle strip for inner polygons */
if (qobj->textureCoords)
{
texcoords[0][0]=0.5f;
texcoords[0][1]=0.5f;
}
vertices[0][0]=0.0f;
vertices[0][1]=0.0f;
vertices[0][2]=0.0f;
radiusLow=outerRadius-deltaRadius*((GLfloat)(loops-1)/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
}
if (qobj->orientation==GLU_OUTSIDE)
{
for (i=slices; i>=0; i--)
{
if (qobj->textureCoords)
{
texcoords[slices-i+1][0]=texLow*sinCache[i]+0.5f;
texcoords[slices-i+1][1]=texLow*cosCache[i]+0.5f;
}
vertices[slices-i+1][0]=radiusLow*sinCache[i];
vertices[slices-i+1][1]=radiusLow*cosCache[i];
vertices[slices-i+1][2]=0.0f;
}
}
else
{
for (i=0; i<=slices; i++)
{
if (qobj->textureCoords)
{
texcoords[i+1][0]=texLow*sinCache[i]+0.5f;
texcoords[i+1][1]=texLow*cosCache[i]+0.5f;
}
vertices[i+1][0]=radiusLow*sinCache[i];
vertices[i+1][1]=radiusLow*cosCache[i];
vertices[i+1][2]=0.0f;
}
}
glDrawArrays(GL_TRIANGLE_FAN, 0, (slices+2));
}
else
{
finish=loops;
}
for (j=0; j<finish; j++)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
radiusHigh=outerRadius-deltaRadius*((GLfloat)(j+1)/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
texHigh=radiusHigh/outerRadius/2;
}
for (i=0; i<=slices; i++)
{
if (qobj->orientation==GLU_OUTSIDE)
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=texLow*sinCache[i]+0.5f;
texcoords[i*2][1]=texLow*cosCache[i]+0.5f;
}
vertices[i*2][0]=radiusLow*sinCache[i];
vertices[i*2][1]=radiusLow*cosCache[i];
vertices[i*2][2]=0.0;
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=texHigh*sinCache[i]+0.5f;
texcoords[i*2+1][1]=texHigh*cosCache[i]+0.5f;
}
vertices[i*2+1][0]=radiusHigh*sinCache[i];
vertices[i*2+1][1]=radiusHigh*cosCache[i];
vertices[i*2+1][2]=0.0;
}
else
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=texHigh*sinCache[i]+0.5f;
texcoords[i*2][1]=texHigh*cosCache[i]+0.5f;
}
vertices[i*2][0]=radiusHigh*sinCache[i];
vertices[i*2][1]=radiusHigh*cosCache[i];
vertices[i*2][2]=0.0;
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=texLow*sinCache[i]+0.5f;
texcoords[i*2+1][1]=texLow*cosCache[i]+0.5f;
}
vertices[i*2+1][0]=radiusLow*sinCache[i];
vertices[i*2+1][1]=radiusLow*cosCache[i];
vertices[i*2+1][2]=0.0;
}
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, ((slices+1)*2));
}
break;
case GLU_POINT:
for (j=0; j<=loops; j++)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
for (i=0; i<slices2; i++)
{
sintemp=sinCache[i];
costemp=cosCache[i];
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
texcoords[i][0]=texLow*sinCache[i]+0.5f;
texcoords[i][1]=texLow*cosCache[i]+0.5f;
}
vertices[i][0]=radiusLow*sintemp;
vertices[i][1]=radiusLow*costemp;
vertices[i][2]=0.0f;
}
glDrawArrays(GL_POINTS, 0, slices2);
}
break;
case GLU_LINE:
if (innerRadius==outerRadius)
{
for (i=0; i<=slices; i++)
{
if (qobj->textureCoords)
{
texcoords[i][0]=sinCache[i]/2+0.5f;
texcoords[i][1]=cosCache[i]/2+0.5f;
}
vertices[i][0]=innerRadius*sinCache[i];
vertices[i][1]=innerRadius*cosCache[i];
vertices[i][2]=0.0f;
}
glDrawArrays(GL_LINE_STRIP, 0, slices+1);
break;
}
for (j=0; j<=loops; j++)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
}
for (i=0; i<=slices; i++)
{
if (qobj->textureCoords)
{
texcoords[i][0]=texLow*sinCache[i]+0.5f;
texcoords[i][1]=texLow*cosCache[i]+0.5f;
}
vertices[i][0]=radiusLow*sinCache[i];
vertices[i][1]=radiusLow*cosCache[i];
vertices[i][2]=0.0f;
}
glDrawArrays(GL_LINE_STRIP, 0, slices+1);
}
for (i=0; i<slices2; i++)
{
sintemp=sinCache[i];
costemp=cosCache[i];
for (j=0; j<=loops; j++)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
}
if (qobj->textureCoords)
{
texcoords[j][0]=texLow*sinCache[i]+0.5f;
texcoords[j][1]=texLow*cosCache[i]+0.5f;
}
vertices[j][0]=radiusLow*sintemp;
vertices[j][1]=radiusLow*costemp;
vertices[j][2]=0.0f;
}
glDrawArrays(GL_LINE_STRIP, 0, loops+1);
}
break;
case GLU_SILHOUETTE:
if (sweepAngle<360.0)
{
for (i=0; i<=slices; i+=slices)
{
sintemp=sinCache[i];
costemp=cosCache[i];
for (j=0; j<=loops; j++)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
texcoords[j][0]=texLow*sinCache[i]+0.5f;
texcoords[j][1]=texLow*cosCache[i]+0.5f;
}
vertices[j][0]=radiusLow*sintemp;
vertices[j][1]=radiusLow*costemp;
vertices[j][2]=0.0f;
}
glDrawArrays(GL_LINE_STRIP, 0, loops+1);
}
}
for (j=0; j<=loops; j+=loops)
{
radiusLow=outerRadius-deltaRadius*((GLfloat)j/loops);
if (qobj->textureCoords)
{
texLow=radiusLow/outerRadius/2;
}
for (i=0; i<=slices; i++)
{
if (qobj->textureCoords)
{
texcoords[i][0]=texLow*sinCache[i]+0.5f;
texcoords[i][1]=texLow*cosCache[i]+0.5f;
}
vertices[i][0]=radiusLow*sinCache[i];
vertices[i][1]=radiusLow*cosCache[i];
vertices[i][2]=0.0f;
}
glDrawArrays(GL_LINE_STRIP, 0, slices+1);
if (innerRadius==outerRadius)
{
break;
}
}
break;
default:
break;
}
/* Disable or re-enable arrays */
if (vertex_enabled)
{
/* Re-enable vertex array */
glEnableClientState(GL_VERTEX_ARRAY);
}
else
{
glDisableClientState(GL_VERTEX_ARRAY);
}
if (texcoord_enabled)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (normal_enabled)
{
glEnableClientState(GL_NORMAL_ARRAY);
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
if (color_enabled)
{
glEnableClientState(GL_COLOR_ARRAY);
}
else
{
glDisableClientState(GL_COLOR_ARRAY);
}
}
GLAPI void APIENTRY gluSphere(GLUquadric* qobj, GLfloat radius, GLint slices, GLint stacks)
{
GLint i, j;
GLfloat sinCache1a[CACHE_SIZE];
GLfloat cosCache1a[CACHE_SIZE];
GLfloat sinCache2a[CACHE_SIZE];
GLfloat cosCache2a[CACHE_SIZE];
GLfloat sinCache3a[CACHE_SIZE];
GLfloat cosCache3a[CACHE_SIZE];
GLfloat sinCache1b[CACHE_SIZE];
GLfloat cosCache1b[CACHE_SIZE];
GLfloat sinCache2b[CACHE_SIZE];
GLfloat cosCache2b[CACHE_SIZE];
GLfloat sinCache3b[CACHE_SIZE];
GLfloat cosCache3b[CACHE_SIZE];
GLfloat angle;
GLfloat zLow, zHigh;
GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0;
GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
GLfloat vertices[(CACHE_SIZE+1)*2][3];
GLfloat texcoords[(CACHE_SIZE+1)*2][2];
GLfloat normals[(CACHE_SIZE+1)*2][3];
GLboolean needCache2, needCache3;
GLint start, finish;
GLboolean texcoord_enabled;
GLboolean normal_enabled;
GLboolean vertex_enabled;
GLboolean color_enabled;
if (slices>=CACHE_SIZE)
{
slices=CACHE_SIZE-1;
}
if (stacks>=CACHE_SIZE)
{
stacks=CACHE_SIZE-1;
}
if (slices<2 || stacks<1 || radius<0.0)
{
gluQuadricError(qobj, GLU_INVALID_VALUE);
return;
}
/* Cache is the vertex locations cache */
/* Cache2 is the various normals at the vertices themselves */
/* Cache3 is the various normals for the faces */
needCache2=needCache3=GL_FALSE;
if (qobj->normals==GLU_SMOOTH)
{
needCache2=GL_TRUE;
}
if (qobj->normals==GLU_FLAT)
{
if (qobj->drawStyle!=GLU_POINT)
{
needCache3=GL_TRUE;
}
if (qobj->drawStyle==GLU_LINE)
{
needCache2=GL_TRUE;
}
}
for (i=0; i<slices; i++)
{
angle=2.0f*PI*i/slices;
sinCache1a[i]=(GLfloat)sin(angle);
cosCache1a[i]=(GLfloat)cos(angle);
if (needCache2)
{
sinCache2a[i] = sinCache1a[i];
cosCache2a[i] = cosCache1a[i];
}
}
for (j=0; j<=stacks; j++)
{
angle=PI*j/stacks;
if (needCache2)
{
if (qobj->orientation==GLU_OUTSIDE)
{
sinCache2b[j]=(GLfloat)sin(angle);
cosCache2b[j]=(GLfloat)cos(angle);
}
else
{
sinCache2b[j]=(GLfloat)-sin(angle);
cosCache2b[j]=(GLfloat)-cos(angle);
}
}
sinCache1b[j]=(GLfloat)(radius*sin(angle));
cosCache1b[j]=(GLfloat)(radius*cos(angle));
}
/* Make sure it comes to a point */
sinCache1b[0]=0;
sinCache1b[stacks]=0;
if (needCache3)
{
for (i=0; i<slices; i++)
{
angle=2.0f*PI*(i-0.5f)/slices;
sinCache3a[i]=(GLfloat)sin(angle);
cosCache3a[i]=(GLfloat)cos(angle);
}
for (j=0; j<=stacks; j++)
{
angle=PI*(j-0.5f)/stacks;
if (qobj->orientation==GLU_OUTSIDE)
{
sinCache3b[j]=(GLfloat)sin(angle);
cosCache3b[j]=(GLfloat)cos(angle);
}
else
{
sinCache3b[j]=(GLfloat)-sin(angle);
cosCache3b[j]=(GLfloat)-cos(angle);
}
}
}
sinCache1a[slices]=sinCache1a[0];
cosCache1a[slices]=cosCache1a[0];
if (needCache2)
{
sinCache2a[slices]=sinCache2a[0];
cosCache2a[slices]=cosCache2a[0];
}
if (needCache3)
{
sinCache3a[slices]=sinCache3a[0];
cosCache3a[slices]=cosCache3a[0];
}
/* Store status of enabled arrays */
texcoord_enabled=GL_FALSE; //glIsEnabled(GL_TEXTURE_COORD_ARRAY);
normal_enabled=GL_FALSE; //glIsEnabled(GL_NORMAL_ARRAY);
vertex_enabled=GL_FALSE; //glIsEnabled(GL_VERTEX_ARRAY);
color_enabled=GL_FALSE; //glIsEnabled(GL_COLOR_ARRAY);
/* Enable arrays */
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
if (qobj->textureCoords)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (qobj->normals!=GLU_NONE)
{
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, normals);
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
glDisableClientState(GL_COLOR_ARRAY);
switch (qobj->drawStyle)
{
case GLU_FILL:
if (!(qobj->textureCoords))
{
start=1;
finish=stacks-1;
/* Low end first (j == 0 iteration) */
sintemp2=sinCache1b[1];
zHigh=cosCache1b[1];
switch(qobj->normals)
{
case GLU_FLAT:
sintemp3=sinCache3b[1];
costemp3=cosCache3b[1];
normals[0][0]=sinCache3a[0]*sinCache3b[0];
normals[0][1]=cosCache3a[0]*sinCache3b[0];
normals[0][2]=cosCache3b[0];
break;
case GLU_SMOOTH:
sintemp3=sinCache2b[1];
costemp3=cosCache2b[1];
normals[0][0]=sinCache2a[0]*sinCache2b[0];
normals[0][1]=cosCache2a[0]*sinCache2b[0];
normals[0][2]=cosCache2b[0];
break;
default:
break;
}
vertices[0][0]=0.0f;
vertices[0][1]=0.0f;
vertices[0][2]=radius;
if (qobj->orientation==GLU_OUTSIDE)
{
for (i=slices; i>=0; i--)
{
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[slices-i+1][0]=sinCache2a[i]*sintemp3;
normals[slices-i+1][1]=cosCache2a[i]*sintemp3;
normals[slices-i+1][2]=costemp3;
break;
case GLU_FLAT:
if (i!=slices)
{
normals[slices-i+1][0]=sinCache3a[i+1]*sintemp3;
normals[slices-i+1][1]=cosCache3a[i+1]*sintemp3;
normals[slices-i+1][2]=costemp3;
}
else
{
/* We must add any normal here */
normals[slices-i+1][0]=sinCache3a[i]*sintemp3;
normals[slices-i+1][1]=cosCache3a[i]*sintemp3;
normals[slices-i+1][2]=costemp3;
}
break;
case GLU_NONE:
default:
break;
}
vertices[slices-i+1][0]=sintemp2*sinCache1a[i];
vertices[slices-i+1][1]=sintemp2*cosCache1a[i];
vertices[slices-i+1][2]=zHigh;
}
}
else
{
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[i+1][0]=sinCache2a[i]*sintemp3;
normals[i+1][1]=cosCache2a[i]*sintemp3;
normals[i+1][2]=costemp3;
break;
case GLU_FLAT:
normals[i+1][0]=sinCache3a[i]*sintemp3;
normals[i+1][1]=cosCache3a[i]*sintemp3;
normals[i+1][2]=costemp3;
break;
case GLU_NONE:
default:
break;
}
vertices[i+1][0]=sintemp2*sinCache1a[i];
vertices[i+1][1]=sintemp2*cosCache1a[i];
vertices[i+1][2]=zHigh;
}
}
glDrawArrays(GL_TRIANGLE_FAN, 0, (slices+2));
/* High end next (j==stacks-1 iteration) */
sintemp2=sinCache1b[stacks-1];
zHigh=cosCache1b[stacks-1];
switch(qobj->normals)
{
case GLU_FLAT:
sintemp3=sinCache3b[stacks];
costemp3=cosCache3b[stacks];
normals[0][0]=sinCache3a[stacks]*sinCache3b[stacks];
normals[0][1]=cosCache3a[stacks]*sinCache3b[stacks];
normals[0][2]=cosCache3b[stacks];
break;
case GLU_SMOOTH:
sintemp3=sinCache2b[stacks-1];
costemp3=cosCache2b[stacks-1];
normals[0][0]=sinCache2a[stacks]*sinCache2b[stacks];
normals[0][1]=cosCache2a[stacks]*sinCache2b[stacks];
normals[0][2]=cosCache2b[stacks];
break;
default:
break;
}
vertices[0][0]=0.0f;
vertices[0][1]=0.0f;
vertices[0][2]=-radius;
if (qobj->orientation==GLU_OUTSIDE)
{
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[i+1][0]=sinCache2a[i]*sintemp3;
normals[i+1][1]=cosCache2a[i]*sintemp3;
normals[i+1][2]=costemp3;
break;
case GLU_FLAT:
normals[i+1][0]=sinCache3a[i]*sintemp3;
normals[i+1][1]=cosCache3a[i]*sintemp3;
normals[i+1][2]=costemp3;
break;
case GLU_NONE:
default:
break;
}
vertices[i+1][0]=sintemp2*sinCache1a[i];
vertices[i+1][1]=sintemp2*cosCache1a[i];
vertices[i+1][2]=zHigh;
}
}
else
{
for (i=slices; i>=0; i--)
{
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[slices-i+1][0]=sinCache2a[i]*sintemp3;
normals[slices-i+1][1]=cosCache2a[i]*sintemp3;
normals[slices-i+1][2]=costemp3;
break;
case GLU_FLAT:
if (i!=slices)
{
normals[slices-i+1][0]=sinCache3a[i+1]*sintemp3;
normals[slices-i+1][1]=cosCache3a[i+1]*sintemp3;
normals[slices-i+1][2]=costemp3;
}
else
{
normals[slices-i+1][0]=sinCache3a[i]*sintemp3;
normals[slices-i+1][1]=cosCache3a[i]*sintemp3;
normals[slices-i+1][2]=costemp3;
}
break;
case GLU_NONE:
default:
break;
}
vertices[slices-i+1][0]=sintemp2*sinCache1a[i];
vertices[slices-i+1][1]=sintemp2*cosCache1a[i];
vertices[slices-i+1][2]=zHigh;
}
}
glDrawArrays(GL_TRIANGLE_FAN, 0, (slices+2));
}
else
{
start=0;
finish=stacks;
}
for (j=start; j<finish; j++)
{
zLow=cosCache1b[j];
zHigh=cosCache1b[j+1];
sintemp1=sinCache1b[j];
sintemp2=sinCache1b[j+1];
switch(qobj->normals)
{
case GLU_FLAT:
sintemp4=sinCache3b[j+1];
costemp4=cosCache3b[j+1];
break;
case GLU_SMOOTH:
if (qobj->orientation==GLU_OUTSIDE)
{
sintemp3=sinCache2b[j+1];
costemp3=cosCache2b[j+1];
sintemp4=sinCache2b[j];
costemp4=cosCache2b[j];
}
else
{
sintemp3=sinCache2b[j];
costemp3=cosCache2b[j];
sintemp4=sinCache2b[j+1];
costemp4=cosCache2b[j+1];
}
break;
default:
break;
}
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[i*2][0]=sinCache2a[i]*sintemp3;
normals[i*2][1]=cosCache2a[i]*sintemp3;
normals[i*2][2]=costemp3;
break;
case GLU_FLAT:
normals[i*2][0]=sinCache3a[i]*sintemp4;
normals[i*2][1]=cosCache3a[i]*sintemp4;
normals[i*2][2]=costemp4;
break;
case GLU_NONE:
default:
break;
}
if (qobj->orientation==GLU_OUTSIDE)
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=1-(GLfloat)i/slices;
texcoords[i*2][1]=1-(GLfloat)(j+1)/stacks;
}
vertices[i*2][0]=sintemp2*sinCache1a[i];
vertices[i*2][1]=sintemp2*cosCache1a[i];
vertices[i*2][2]=zHigh;
}
else
{
if (qobj->textureCoords)
{
texcoords[i*2][0]=1-(GLfloat)i/slices;
texcoords[i*2][1]=1-(GLfloat)j/stacks;
}
vertices[i*2][0]=sintemp1*sinCache1a[i];
vertices[i*2][1]=sintemp1*cosCache1a[i];
vertices[i*2][2]=zLow;
}
switch(qobj->normals)
{
case GLU_SMOOTH:
normals[i*2+1][0]=sinCache2a[i]*sintemp4;
normals[i*2+1][1]=cosCache2a[i]*sintemp4;
normals[i*2+1][2]=costemp4;
break;
case GLU_FLAT:
normals[i*2+1][0]=sinCache3a[i]*sintemp4;
normals[i*2+1][1]=cosCache3a[i]*sintemp4;
normals[i*2+1][2]=costemp4;
break;
case GLU_NONE:
default:
break;
}
if (qobj->orientation==GLU_OUTSIDE)
{
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=1-(GLfloat)i/slices;
texcoords[i*2+1][1]=1-(GLfloat)j/stacks;
}
vertices[i*2+1][0]=sintemp1*sinCache1a[i];
vertices[i*2+1][1]=sintemp1*cosCache1a[i];
vertices[i*2+1][2]=zLow;
}
else
{
if (qobj->textureCoords)
{
texcoords[i*2+1][0]=1-(GLfloat)i/slices;
texcoords[i*2+1][1]=1-(GLfloat)(j+1)/stacks;
}
vertices[i*2+1][0]=sintemp2*sinCache1a[i];
vertices[i*2+1][1]=sintemp2*cosCache1a[i];
vertices[i*2+1][2]=zHigh;
}
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, (slices+1)*2);
}
break;
case GLU_POINT:
for (j=0; j<=stacks; j++)
{
sintemp1=sinCache1b[j];
costemp1=cosCache1b[j];
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
sintemp2=sinCache2b[j];
costemp2=cosCache2b[j];
break;
default:
break;
}
for (i=0; i<slices; i++)
{
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
normals[i][0]=sinCache2a[i]*sintemp2;
normals[i][1]=cosCache2a[i]*sintemp2;
normals[i][2]=costemp2;
break;
case GLU_NONE:
default:
break;
}
zLow=j*radius/stacks;
if (qobj->textureCoords)
{
texcoords[i][0]=1-(GLfloat)i/slices;
texcoords[i][1]=1-(GLfloat)j/stacks;
}
vertices[i][0]=sintemp1*sinCache1a[i];
vertices[i][1]=sintemp1*cosCache1a[i];
vertices[i][2]=costemp1;
}
glDrawArrays(GL_POINTS, 0, slices);
}
break;
case GLU_LINE:
case GLU_SILHOUETTE:
for (j=1; j<stacks; j++)
{
sintemp1=sinCache1b[j];
costemp1=cosCache1b[j];
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
sintemp2=sinCache2b[j];
costemp2=cosCache2b[j];
break;
default:
break;
}
for (i=0; i<=slices; i++)
{
switch(qobj->normals)
{
case GLU_FLAT:
normals[i][0]=sinCache3a[i]*sintemp2;
normals[i][1]=cosCache3a[i]*sintemp2;
normals[i][2]=costemp2;
break;
case GLU_SMOOTH:
normals[i][0]=sinCache2a[i]*sintemp2;
normals[i][1]=cosCache2a[i]*sintemp2;
normals[i][2]=costemp2;
break;
case GLU_NONE:
default:
break;
}
if (qobj->textureCoords)
{
texcoords[i][0]=1-(GLfloat)i/slices;
texcoords[i][1]=1-(GLfloat)j/stacks;
}
vertices[i][0]=sintemp1*sinCache1a[i];
vertices[i][1]=sintemp1*cosCache1a[i];
vertices[i][2]=costemp1;
}
glDrawArrays(GL_LINE_STRIP, 0, slices+1);
}
for (i=0; i<slices; i++)
{
sintemp1=sinCache1a[i];
costemp1=cosCache1a[i];
switch(qobj->normals)
{
case GLU_FLAT:
case GLU_SMOOTH:
sintemp2=sinCache2a[i];
costemp2=cosCache2a[i];
break;
default:
break;
}
for (j=0; j<=stacks; j++)
{
switch(qobj->normals)
{
case GLU_FLAT:
normals[j][0]=sintemp2*sinCache3b[j];
normals[j][1]=costemp2*sinCache3b[j];
normals[j][2]=cosCache3b[j];
break;
case GLU_SMOOTH:
normals[j][0]=sintemp2*sinCache2b[j];
normals[j][1]=costemp2*sinCache2b[j];
normals[j][2]=cosCache2b[j];
break;
case GLU_NONE:
default:
break;
}
if (qobj->textureCoords)
{
texcoords[j][0]=1-(GLfloat)i/slices;
texcoords[j][1]=1-(GLfloat)j/stacks;
}
vertices[j][0]=sintemp1*sinCache1b[j];
vertices[j][1]=costemp1*sinCache1b[j];
vertices[j][2]=cosCache1b[j];
}
glDrawArrays(GL_LINE_STRIP, 0, stacks+1);
}
break;
default:
break;
}
/* Disable or re-enable arrays */
if (vertex_enabled)
{
/* Re-enable vertex array */
glEnableClientState(GL_VERTEX_ARRAY);
}
else
{
glDisableClientState(GL_VERTEX_ARRAY);
}
if (texcoord_enabled)
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
else
{
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (normal_enabled)
{
glEnableClientState(GL_NORMAL_ARRAY);
}
else
{
glDisableClientState(GL_NORMAL_ARRAY);
}
if (color_enabled)
{
glEnableClientState(GL_COLOR_ARRAY);
}
else
{
glDisableClientState(GL_COLOR_ARRAY);
}
}
| [
"devel.spygunsoft@gmail.com"
] | devel.spygunsoft@gmail.com |
08aecb4a9536aebf4aaf37b98cc367687a0c8365 | eb7a1fb1c70fc82be0dfc0245255d5506433d156 | /Microchip/SAMG_DFP/3.2.35/samg53/include/samg53n19.h | 6fe2860ec312ae40a34b60f4ebcb58b456db212b | [
"Apache-2.0"
] | permissive | muthukrishnankarthik/dev_packs | c03f66ce3f32d34340c8053363121657a0a37474 | 60d97ca66b10c00b3c42430b0cf0b4ae7542f217 | refs/heads/master | 2021-01-06T13:26:53.637757 | 2020-02-10T23:49:35 | 2020-02-10T23:49:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 30,365 | h | /**
* \brief Header file for ATSAMG53N19
*
* Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software and any derivatives
* exclusively with Microchip products. It is your responsibility to comply with third party license
* terms applicable to your use of third party software (including open source software) that may
* accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY,
* APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND
* FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
* MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT
* EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
*/
/* file generated from device description version 2019-12-16T02:52:00Z */
#ifndef _SAMG53N19_H_
#define _SAMG53N19_H_
// Header version uses Semantic Versioning 2.0.0 (https://semver.org/)
#define HEADER_FORMAT_VERSION "2.0.0"
#define HEADER_FORMAT_VERSION_MAJOR (2)
#define HEADER_FORMAT_VERSION_MINOR (0)
/** \addtogroup SAMG53N19_definitions SAMG53N19 definitions
This file defines all structures and symbols for SAMG53N19:
- registers and bitfields
- peripheral base address
- peripheral ID
- PIO definitions
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
# include <stdint.h>
#endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
#if !defined(SKIP_INTEGER_LITERALS)
# if defined(_U_) || defined(_L_) || defined(_UL_)
# error "Integer Literals macros already defined elsewhere"
# endif
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
/* Macros that deal with adding suffixes to integer literal constants for C/C++ */
# define _U_(x) (x ## U) /**< C code: Unsigned integer literal constant value */
# define _L_(x) (x ## L) /**< C code: Long integer literal constant value */
# define _UL_(x) (x ## UL) /**< C code: Unsigned Long integer literal constant value */
#else /* Assembler */
# define _U_(x) x /**< Assembler: Unsigned integer literal constant value */
# define _L_(x) x /**< Assembler: Long integer literal constant value */
# define _UL_(x) x /**< Assembler: Unsigned Long integer literal constant value */
#endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* SKIP_INTEGER_LITERALS */
/** @} end of Atmel Global Defines */
/* ************************************************************************** */
/* CMSIS DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
/** Interrupt Number Definition */
typedef enum IRQn
{
/****** CORTEX-M4 Processor Exceptions Numbers ******************************/
Reset_IRQn = -15, /**< -15 Reset Vector, invoked on Power up and warm reset */
NonMaskableInt_IRQn = -14, /**< -14 Non maskable Interrupt, cannot be stopped or preempted */
HardFault_IRQn = -13, /**< -13 Hard Fault, all classes of Fault */
MemoryManagement_IRQn = -12, /**< -12 Memory Management, MPU mismatch, including Access Violation and No Match */
BusFault_IRQn = -11, /**< -11 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
UsageFault_IRQn = -10, /**< -10 Usage Fault, i.e. Undef Instruction, Illegal State Transition */
SVCall_IRQn = -5, /**< -5 System Service Call via SVC instruction */
DebugMonitor_IRQn = -4, /**< -4 Debug Monitor */
PendSV_IRQn = -2, /**< -2 Pendable request for system service */
SysTick_IRQn = -1, /**< -1 System Tick Timer */
/****** SAMG53N19 specific Interrupt Numbers ***********************************/
SUPC_IRQn = 0, /**< 0 Supply Controller (SUPC) */
RSTC_IRQn = 1, /**< 1 Reset Controller (RSTC) */
RTC_IRQn = 2, /**< 2 Real-time Clock (RTC) */
RTT_IRQn = 3, /**< 3 Real-time Timer (RTT) */
WDT_IRQn = 4, /**< 4 Watchdog Timer (WDT) */
PMC_IRQn = 5, /**< 5 Power Management Controller (PMC) */
EFC_IRQn = 6, /**< 6 Embedded Flash Controller (EFC) */
UART0_IRQn = 8, /**< 8 Universal Asynchronous Receiver Transmitter (UART0) */
UART1_IRQn = 9, /**< 9 Universal Asynchronous Receiver Transmitter (UART1) */
PIOA_IRQn = 11, /**< 11 Parallel Input/Output Controller (PIOA) */
PIOB_IRQn = 12, /**< 12 Parallel Input/Output Controller (PIOB) */
PDMIC0_IRQn = 13, /**< 13 Pulse Density Modulation Interface Controller (PDMIC0) */
USART_IRQn = 14, /**< 14 Universal Synchronous Asynchronous Receiver Transmitter (USART) */
MEM2MEM_IRQn = 15, /**< 15 Memory to Memory (MEM2MEM) */
I2SC0_IRQn = 16, /**< 16 Inter-IC Sound Controller (I2SC0) */
I2SC1_IRQn = 17, /**< 17 Inter-IC Sound Controller (I2SC1) */
PDMIC1_IRQn = 18, /**< 18 Pulse Density Modulation Interface Controller (PDMIC1) */
TWI0_IRQn = 19, /**< 19 Two-wire Interface High Speed (TWI0) */
TWI1_IRQn = 20, /**< 20 Two-wire Interface (TWI1) */
SPI_IRQn = 21, /**< 21 Serial Peripheral Interface (SPI) */
TWI2_IRQn = 22, /**< 22 Two-wire Interface (TWI2) */
TC0_CH0_IRQn = 23, /**< 23 Timer/Counter 0 Channel 0 (TC0) */
TC0_CH1_IRQn = 24, /**< 24 Timer/Counter 0 Channel 1 (TC0) */
TC0_CH2_IRQn = 25, /**< 25 Timer/Counter 0 Channel 2 (TC0) */
TC1_CH0_IRQn = 26, /**< 26 Timer/Counter 1 Channel 0 (TC1) */
TC1_CH1_IRQn = 27, /**< 27 Timer/Counter 1 Channel 1 (TC1) */
TC1_CH2_IRQn = 28, /**< 28 Timer/Counter 1 Channel 2 (TC1) */
ADC_IRQn = 29, /**< 29 Analog-to-Digital Converter (ADC) */
PERIPH_MAX_IRQn = 29 /**< Max peripheral ID */
} IRQn_Type;
#endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
typedef struct _DeviceVectors
{
/* Stack pointer */
void* pvStack;
/* Cortex-M handlers */
void* pfnReset_Handler; /* -15 Reset Vector, invoked on Power up and warm reset */
void* pfnNonMaskableInt_Handler; /* -14 Non maskable Interrupt, cannot be stopped or preempted */
void* pfnHardFault_Handler; /* -13 Hard Fault, all classes of Fault */
void* pfnMemoryManagement_Handler; /* -12 Memory Management, MPU mismatch, including Access Violation and No Match */
void* pfnBusFault_Handler; /* -11 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */
void* pfnUsageFault_Handler; /* -10 Usage Fault, i.e. Undef Instruction, Illegal State Transition */
void* pvReservedC9;
void* pvReservedC8;
void* pvReservedC7;
void* pvReservedC6;
void* pfnSVCall_Handler; /* -5 System Service Call via SVC instruction */
void* pfnDebugMonitor_Handler; /* -4 Debug Monitor */
void* pvReservedC3;
void* pfnPendSV_Handler; /* -2 Pendable request for system service */
void* pfnSysTick_Handler; /* -1 System Tick Timer */
/* Peripheral handlers */
void* pfnSUPC_Handler; /* 0 Supply Controller (SUPC) */
void* pfnRSTC_Handler; /* 1 Reset Controller (RSTC) */
void* pfnRTC_Handler; /* 2 Real-time Clock (RTC) */
void* pfnRTT_Handler; /* 3 Real-time Timer (RTT) */
void* pfnWDT_Handler; /* 4 Watchdog Timer (WDT) */
void* pfnPMC_Handler; /* 5 Power Management Controller (PMC) */
void* pfnEFC_Handler; /* 6 Embedded Flash Controller (EFC) */
void* pvReserved7;
void* pfnUART0_Handler; /* 8 Universal Asynchronous Receiver Transmitter (UART0) */
void* pfnUART1_Handler; /* 9 Universal Asynchronous Receiver Transmitter (UART1) */
void* pvReserved10;
void* pfnPIOA_Handler; /* 11 Parallel Input/Output Controller (PIOA) */
void* pfnPIOB_Handler; /* 12 Parallel Input/Output Controller (PIOB) */
void* pfnPDMIC0_Handler; /* 13 Pulse Density Modulation Interface Controller (PDMIC0) */
void* pfnUSART_Handler; /* 14 Universal Synchronous Asynchronous Receiver Transmitter (USART) */
void* pfnMEM2MEM_Handler; /* 15 Memory to Memory (MEM2MEM) */
void* pfnI2SC0_Handler; /* 16 Inter-IC Sound Controller (I2SC0) */
void* pfnI2SC1_Handler; /* 17 Inter-IC Sound Controller (I2SC1) */
void* pfnPDMIC1_Handler; /* 18 Pulse Density Modulation Interface Controller (PDMIC1) */
void* pfnTWI0_Handler; /* 19 Two-wire Interface High Speed (TWI0) */
void* pfnTWI1_Handler; /* 20 Two-wire Interface (TWI1) */
void* pfnSPI_Handler; /* 21 Serial Peripheral Interface (SPI) */
void* pfnTWI2_Handler; /* 22 Two-wire Interface (TWI2) */
void* pfnTC0_CH0_Handler; /* 23 Timer/Counter 0 Channel 0 (TC0) */
void* pfnTC0_CH1_Handler; /* 24 Timer/Counter 0 Channel 1 (TC0) */
void* pfnTC0_CH2_Handler; /* 25 Timer/Counter 0 Channel 2 (TC0) */
void* pfnTC1_CH0_Handler; /* 26 Timer/Counter 1 Channel 0 (TC1) */
void* pfnTC1_CH1_Handler; /* 27 Timer/Counter 1 Channel 1 (TC1) */
void* pfnTC1_CH2_Handler; /* 28 Timer/Counter 1 Channel 2 (TC1) */
void* pfnADC_Handler; /* 29 Analog-to-Digital Converter (ADC) */
} DeviceVectors;
/* Defines for Deprecated Interrupt and Exceptions handler names */
#define pfnMemManage_Handler pfnMemoryManagement_Handler /**< \deprecated Backward compatibility for ASF*/
#define pfnDebugMon_Handler pfnDebugMonitor_Handler /**< \deprecated Backward compatibility for ASF*/
#define pfnNMI_Handler pfnNonMaskableInt_Handler /**< \deprecated Backward compatibility for ASF*/
#define pfnSVC_Handler pfnSVCall_Handler /**< \deprecated Backward compatibility for ASF*/
#endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
#if !defined DONT_USE_PREDEFINED_CORE_HANDLERS
/* CORTEX-M4 exception handlers */
void Reset_Handler ( void );
void NonMaskableInt_Handler ( void );
void HardFault_Handler ( void );
void MemoryManagement_Handler ( void );
void BusFault_Handler ( void );
void UsageFault_Handler ( void );
void SVCall_Handler ( void );
void DebugMonitor_Handler ( void );
void PendSV_Handler ( void );
void SysTick_Handler ( void );
#endif /* DONT_USE_PREDEFINED_CORE_HANDLERS */
#if !defined DONT_USE_PREDEFINED_PERIPHERALS_HANDLERS
/* Peripherals interrupt handlers */
void SUPC_Handler ( void );
void RSTC_Handler ( void );
void RTC_Handler ( void );
void RTT_Handler ( void );
void WDT_Handler ( void );
void PMC_Handler ( void );
void EFC_Handler ( void );
void UART0_Handler ( void );
void UART1_Handler ( void );
void PIOA_Handler ( void );
void PIOB_Handler ( void );
void PDMIC0_Handler ( void );
void USART_Handler ( void );
void MEM2MEM_Handler ( void );
void I2SC0_Handler ( void );
void I2SC1_Handler ( void );
void PDMIC1_Handler ( void );
void TWI0_Handler ( void );
void TWI1_Handler ( void );
void SPI_Handler ( void );
void TWI2_Handler ( void );
void TC0_CH0_Handler ( void );
void TC0_CH1_Handler ( void );
void TC0_CH2_Handler ( void );
void TC1_CH0_Handler ( void );
void TC1_CH1_Handler ( void );
void TC1_CH2_Handler ( void );
void ADC_Handler ( void );
#endif /* DONT_USE_PREDEFINED_PERIPHERALS_HANDLERS */
/* Defines for Deprecated Interrupt and Exceptions handler names */
#define MemManage_Handler MemoryManagement_Handler /**< \deprecated Backward compatibility*/
#define DebugMon_Handler DebugMonitor_Handler /**< \deprecated Backward compatibility*/
#define NMI_Handler NonMaskableInt_Handler /**< \deprecated Backward compatibility*/
#define SVC_Handler SVCall_Handler /**< \deprecated Backward compatibility*/
#endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
/*
* \brief Configuration of the CORTEX-M4 Processor and Core Peripherals
*/
#define __CM4_REV 0x0001 /**< CM4 Core Revision */
#define __NVIC_PRIO_BITS 4 /**< Number of Bits used for Priority Levels */
#define __Vendor_SysTickConfig 0 /**< Set to 1 if different SysTick Config is used */
#define __MPU_PRESENT 1 /**< MPU present or not */
#define __VTOR_PRESENT 1 /**< Vector Table Offset Register present or not */
#define __FPU_PRESENT 1 /**< FPU present or not */
#define __ARCH_ARM 1
#define __ARCH_ARM_CORTEX_M 1
#define __DEVICE_IS_SAM 1
/*
* \brief CMSIS includes
*/
#include "core_cm4.h"
#if defined USE_CMSIS_INIT
#include "system_samg53.h"
#endif /* USE_CMSIS_INIT */
/** \defgroup SAMG53N19_api Peripheral Software API
* @{
*/
/* ************************************************************************** */
/** SOFTWARE PERIPHERAL API DEFINITION FOR SAMG53N19 */
/* ************************************************************************** */
#include "component/adc.h"
#include "component/chipid.h"
#include "component/efc.h"
#include "component/gpbr.h"
#include "component/i2sc.h"
#include "component/matrix.h"
#include "component/mem2mem.h"
#include "component/pdc.h"
#include "component/pdmic.h"
#include "component/pio.h"
#include "component/pmc.h"
#include "component/rstc.h"
#include "component/rtc.h"
#include "component/rtt.h"
#include "component/spi.h"
#include "component/supc.h"
#include "component/tc.h"
#include "component/twi.h"
#include "component/twihs.h"
#include "component/uart.h"
#include "component/usart.h"
#include "component/wdt.h"
/** @} end of Peripheral Software API */
/** \addtogroup SAMG53N19_id Peripheral Ids Definitions
* @{
*/
/* ************************************************************************** */
/* PERIPHERAL ID DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#define ID_SUPC ( 0) /**< \brief Supply Controller (SUPC) */
#define ID_RSTC ( 1) /**< \brief Reset Controller (RSTC) */
#define ID_RTC ( 2) /**< \brief Real-time Clock (RTC) */
#define ID_RTT ( 3) /**< \brief Real-time Timer (RTT) */
#define ID_WDT ( 4) /**< \brief Watchdog Timer (WDT) */
#define ID_PMC ( 5) /**< \brief Power Management Controller (PMC) */
#define ID_EFC ( 6) /**< \brief Embedded Flash Controller (EFC) */
#define ID_UART0 ( 8) /**< \brief Universal Asynchronous Receiver Transmitter (UART0) */
#define ID_UART1 ( 9) /**< \brief Universal Asynchronous Receiver Transmitter (UART1) */
#define ID_PIOA ( 11) /**< \brief Parallel Input/Output Controller (PIOA) */
#define ID_PIOB ( 12) /**< \brief Parallel Input/Output Controller (PIOB) */
#define ID_PDMIC0 ( 13) /**< \brief Pulse Density Modulation Interface Controller (PDMIC0) */
#define ID_USART ( 14) /**< \brief Universal Synchronous Asynchronous Receiver Transmitter (USART) */
#define ID_MEM2MEM ( 15) /**< \brief Memory to Memory (MEM2MEM) */
#define ID_I2SC0 ( 16) /**< \brief Inter-IC Sound Controller (I2SC0) */
#define ID_I2SC1 ( 17) /**< \brief Inter-IC Sound Controller (I2SC1) */
#define ID_PDMIC1 ( 18) /**< \brief Pulse Density Modulation Interface Controller (PDMIC1) */
#define ID_TWI0 ( 19) /**< \brief Two-wire Interface High Speed (TWI0) */
#define ID_TWI1 ( 20) /**< \brief Two-wire Interface (TWI1) */
#define ID_SPI ( 21) /**< \brief Serial Peripheral Interface (SPI) */
#define ID_TWI2 ( 22) /**< \brief Two-wire Interface (TWI2) */
#define ID_TC0_CHANNEL0 ( 23) /**< \brief Timer Counter (TC0_CHANNEL0) */
#define ID_TC0_CHANNEL1 ( 24) /**< \brief Timer Counter (TC0_CHANNEL1) */
#define ID_TC0_CHANNEL2 ( 25) /**< \brief Timer Counter (TC0_CHANNEL2) */
#define ID_TC1_CHANNEL0 ( 26) /**< \brief Timer Counter (TC1_CHANNEL0) */
#define ID_TC1_CHANNEL1 ( 27) /**< \brief Timer Counter (TC1_CHANNEL1) */
#define ID_TC1_CHANNEL2 ( 28) /**< \brief Timer Counter (TC1_CHANNEL2) */
#define ID_ADC ( 29) /**< \brief Analog-to-Digital Converter (ADC) */
#define ID_PERIPH_MAX ( 29) /**< \brief Number of peripheral IDs */
/** @} end of Peripheral Ids Definitions */
/** \addtogroup SAMG53N19_base Peripheral Base Address Definitions
* @{
*/
/* ************************************************************************** */
/* REGISTER STRUCTURE ADDRESS DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
#define ADC_REGS ((adc_registers_t*)0x40038000) /**< \brief ADC Registers Address */
#define CHIPID_REGS ((chipid_registers_t*)0x400e0740) /**< \brief CHIPID Registers Address */
#define EFC_REGS ((efc_registers_t*)0x400e0a00) /**< \brief EFC Registers Address */
#define GPBR_REGS ((gpbr_registers_t*)0x400e1490) /**< \brief GPBR Registers Address */
#define I2SC0_REGS ((i2sc_registers_t*)0x40000000) /**< \brief I2SC0 Registers Address */
#define I2SC1_REGS ((i2sc_registers_t*)0x40004000) /**< \brief I2SC1 Registers Address */
#define MATRIX_REGS ((matrix_registers_t*)0x400e0200) /**< \brief MATRIX Registers Address */
#define MEM2MEM_REGS ((mem2mem_registers_t*)0x40028000) /**< \brief MEM2MEM Registers Address */
#define PDMIC0_REGS ((pdmic_registers_t*)0x4002c000) /**< \brief PDMIC0 Registers Address */
#define PDMIC1_REGS ((pdmic_registers_t*)0x40030000) /**< \brief PDMIC1 Registers Address */
#define PIOA_REGS ((pio_registers_t*)0x400e0e00) /**< \brief PIOA Registers Address */
#define PIOB_REGS ((pio_registers_t*)0x400e1000) /**< \brief PIOB Registers Address */
#define PMC_REGS ((pmc_registers_t*)0x400e0400) /**< \brief PMC Registers Address */
#define RSTC_REGS ((rstc_registers_t*)0x400e1400) /**< \brief RSTC Registers Address */
#define RTC_REGS ((rtc_registers_t*)0x400e1460) /**< \brief RTC Registers Address */
#define RTT_REGS ((rtt_registers_t*)0x400e1430) /**< \brief RTT Registers Address */
#define SPI_REGS ((spi_registers_t*)0x40008000) /**< \brief SPI Registers Address */
#define SUPC_REGS ((supc_registers_t*)0x400e1410) /**< \brief SUPC Registers Address */
#define TC0_REGS ((tc_registers_t*)0x40010000) /**< \brief TC0 Registers Address */
#define TC1_REGS ((tc_registers_t*)0x40014000) /**< \brief TC1 Registers Address */
#define TWI1_REGS ((twi_registers_t*)0x4001c000) /**< \brief TWI1 Registers Address */
#define TWI2_REGS ((twi_registers_t*)0x40040000) /**< \brief TWI2 Registers Address */
#define TWI0_REGS ((twihs_registers_t*)0x40018000) /**< \brief TWI0 Registers Address */
#define UART0_REGS ((uart_registers_t*)0x400e0600) /**< \brief UART0 Registers Address */
#define UART1_REGS ((uart_registers_t*)0x400e0800) /**< \brief UART1 Registers Address */
#define USART_REGS ((usart_registers_t*)0x40024000) /**< \brief USART Registers Address */
#define WDT_REGS ((wdt_registers_t*)0x400e1450) /**< \brief WDT Registers Address */
#endif /* (defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
/** @} end of Peripheral Base Address Definitions */
/** \addtogroup SAMG53N19_base Peripheral Base Address Definitions
* @{
*/
/* ************************************************************************** */
/* BASE ADDRESS DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#define ADC_BASE_ADDRESS _UL_(0x40038000) /**< \brief ADC Base Address */
#define CHIPID_BASE_ADDRESS _UL_(0x400e0740) /**< \brief CHIPID Base Address */
#define EFC_BASE_ADDRESS _UL_(0x400e0a00) /**< \brief EFC Base Address */
#define GPBR_BASE_ADDRESS _UL_(0x400e1490) /**< \brief GPBR Base Address */
#define I2SC0_BASE_ADDRESS _UL_(0x40000000) /**< \brief I2SC0 Base Address */
#define I2SC1_BASE_ADDRESS _UL_(0x40004000) /**< \brief I2SC1 Base Address */
#define MATRIX_BASE_ADDRESS _UL_(0x400e0200) /**< \brief MATRIX Base Address */
#define MEM2MEM_BASE_ADDRESS _UL_(0x40028000) /**< \brief MEM2MEM Base Address */
#define PDMIC0_BASE_ADDRESS _UL_(0x4002c000) /**< \brief PDMIC0 Base Address */
#define PDMIC1_BASE_ADDRESS _UL_(0x40030000) /**< \brief PDMIC1 Base Address */
#define PIOA_BASE_ADDRESS _UL_(0x400e0e00) /**< \brief PIOA Base Address */
#define PIOB_BASE_ADDRESS _UL_(0x400e1000) /**< \brief PIOB Base Address */
#define PMC_BASE_ADDRESS _UL_(0x400e0400) /**< \brief PMC Base Address */
#define RSTC_BASE_ADDRESS _UL_(0x400e1400) /**< \brief RSTC Base Address */
#define RTC_BASE_ADDRESS _UL_(0x400e1460) /**< \brief RTC Base Address */
#define RTT_BASE_ADDRESS _UL_(0x400e1430) /**< \brief RTT Base Address */
#define SPI_BASE_ADDRESS _UL_(0x40008000) /**< \brief SPI Base Address */
#define SUPC_BASE_ADDRESS _UL_(0x400e1410) /**< \brief SUPC Base Address */
#define TC0_BASE_ADDRESS _UL_(0x40010000) /**< \brief TC0 Base Address */
#define TC1_BASE_ADDRESS _UL_(0x40014000) /**< \brief TC1 Base Address */
#define TWI1_BASE_ADDRESS _UL_(0x4001c000) /**< \brief TWI1 Base Address */
#define TWI2_BASE_ADDRESS _UL_(0x40040000) /**< \brief TWI2 Base Address */
#define TWI0_BASE_ADDRESS _UL_(0x40018000) /**< \brief TWI0 Base Address */
#define UART0_BASE_ADDRESS _UL_(0x400e0600) /**< \brief UART0 Base Address */
#define UART1_BASE_ADDRESS _UL_(0x400e0800) /**< \brief UART1 Base Address */
#define USART_BASE_ADDRESS _UL_(0x40024000) /**< \brief USART Base Address */
#define WDT_BASE_ADDRESS _UL_(0x400e1450) /**< \brief WDT Base Address */
/** @} end of Peripheral Base Address Definitions */
/** \addtogroup SAMG53N19_pio Peripheral Pio Definitions
* @{
*/
/* ************************************************************************** */
/* PIO DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#include "pio/samg53n19.h"
/** @} end of Peripheral Pio Definitions */
/* ************************************************************************** */
/* MEMORY MAPPING DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#define PERIPHERALS_SIZE _UL_(0x20000000) /* 524288kB Memory segment type: io */
#define SYSTEM_SIZE _UL_(0x10000000) /* 262144kB Memory segment type: io */
#define IFLASH_SIZE _UL_(0x00080000) /* 512kB Memory segment type: flash */
#define IFLASH_PAGE_SIZE _UL_( 512)
#define IFLASH_NB_OF_PAGES _UL_( 1024)
#define IROM_SIZE _UL_(0x00400000) /* 4096kB Memory segment type: rom */
#define IRAM_SIZE _UL_(0x00018000) /* 96kB Memory segment type: ram */
#define PERIPHERALS_ADDR _UL_(0x40000000) /**< PERIPHERALS base address (type: io)*/
#define SYSTEM_ADDR _UL_(0xe0000000) /**< SYSTEM base address (type: io)*/
#define IFLASH_ADDR _UL_(0x00400000) /**< IFLASH base address (type: flash)*/
#define IROM_ADDR _UL_(0x00800000) /**< IROM base address (type: rom)*/
#define IRAM_ADDR _UL_(0x20000000) /**< IRAM base address (type: ram)*/
/* ************************************************************************** */
/** DEVICE SIGNATURES FOR SAMG53N19 */
/* ************************************************************************** */
#define CHIP_JTAGID _UL_(0X05B3C03F)
#define CHIP_CIDR _UL_(0X247E0AE8)
#define CHIP_EXID _UL_(0X00000000)
/* ************************************************************************** */
/** ELECTRICAL DEFINITIONS FOR SAMG53N19 */
/* ************************************************************************** */
#define CHIP_FREQ_SLCK_RC_MIN _UL_(20000)
#define CHIP_FREQ_SLCK_RC _UL_(32000) /**< \brief Typical Slow Clock Internal RC frequency */
#define CHIP_FREQ_SLCK_RC_MAX _UL_(44000)
#define CHIP_FREQ_MAINCK_RC_8MHZ _UL_(8000000)
#define CHIP_FREQ_MAINCK_RC_16MHZ _UL_(16000000)
#define CHIP_FREQ_MAINCK_RC_24MHZ _UL_(24000000)
#define CHIP_FREQ_CPU_MAX _UL_(48000000)
#define CHIP_FREQ_XTAL_32K _UL_(32768)
#define CHIP_FLASH_WRITE_WAIT_STATE _UL_(6) /**< \brief Embedded Flash Write Wait State */
#define CHIP_FREQ_FWS_0 _UL_(12000000) /**< \brief Maximum operating frequency when FWS is 0 */
#define CHIP_FREQ_FWS_1 _UL_(25000000) /**< \brief Maximum operating frequency when FWS is 1 */
#define CHIP_FREQ_FWS_2 _UL_(38000000) /**< \brief Maximum operating frequency when FWS is 2 */
#define CHIP_FREQ_FWS_3 _UL_(48000000) /**< \brief Maximum operating frequency when FWS is 3 */
#define CHIP_FREQ_FWS_NUMBER _UL_(4) /**< \brief Number of FWS ranges */
#ifdef __cplusplus
}
#endif
/** @} end of SAMG53N19 definitions */
#endif /* _SAMG53N19_H_ */
| [
"thibaut.viard@microchip.com"
] | thibaut.viard@microchip.com |
db2a78e09b1a1fcb258316b2a2245c63fc704a22 | 91d42e36516668992e7df8b63823392601f07cb8 | /CommonTools/test/plotSyst_ch6.C | 0e6eefe3e4f19198f517de495b06aaf5b99fc4c3 | [] | no_license | senka/CombinedEWKAnalysis_shapeVSlnN_debug | 9e0a04876792c236782cfd1769d0719ff8d7694c | 35925317281eb2c7d841dd2c7fb1415037644e3e | refs/heads/master | 2016-09-05T20:49:52.142062 | 2014-04-29T11:26:17 | 2014-04-29T11:26:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 8,458 | c | void plotSyst_ch6(){
TFile * file_in=new TFile("../data/WV_semileptonic/ch6_boosted.root","read");
file_in->cd();
zz2l2nu ->SetFillColor(0);
zz2l2nu_CMS_eff_bUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_lesUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_puUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_umetUp ->SetFillColor(0);
zz2l2nu_CMS_res_jUp ->SetFillColor(0);
zz2l2nu_CMS_scale_jUp ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_sherpaUp ->SetFillColor(0);
zz2l2nu_CMS_eff_bDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_lesDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_puDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_umetDown ->SetFillColor(0);
zz2l2nu_CMS_res_jDown ->SetFillColor(0);
zz2l2nu_CMS_scale_jDown ->SetFillColor(0);
zz2l2nu_CMS_hzz2l2v_sherpaDown ->SetFillColor(0);
wz3lnu ->SetFillColor(0);
wz3lnu_CMS_eff_bUp ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_lesUp ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_puUp ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVUp ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_umetUp ->SetFillColor(0);
wz3lnu_CMS_res_jUp ->SetFillColor(0);
wz3lnu_CMS_scale_jUp ->SetFillColor(0);
wz3lnu_CMS_eff_bDown ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_lesDown ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_puDown ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVDown ->SetFillColor(0);
wz3lnu_CMS_hzz2l2v_umetDown ->SetFillColor(0);
wz3lnu_CMS_res_jDown ->SetFillColor(0);
wz3lnu_CMS_scale_jDown ->SetFillColor(0);
zll ->SetFillColor(0);
zll_CMS_hzz2l2v_stat_ll_zll_8TeVUp ->SetFillColor(0);
zll_CMS_hzz2l2v_stat_ll_zll_8TeVDown ->SetFillColor(0);
topwwwjetsdata ->SetFillColor(0);
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVUp ->SetFillColor(0);
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVDown ->SetFillColor(0);
data_obs ->SetFillColor(0);
zz2l2nu_CMS_eff_bUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_lesUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_puUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_umetUp ->SetLineColor(2);
zz2l2nu_CMS_res_jUp ->SetLineColor(2);
zz2l2nu_CMS_scale_jUp ->SetLineColor(2);
zz2l2nu_CMS_hzz2l2v_sherpaUp ->SetLineColor(2);
wz3lnu_CMS_eff_bUp ->SetLineColor(2);
wz3lnu_CMS_hzz2l2v_lesUp ->SetLineColor(2);
wz3lnu_CMS_hzz2l2v_puUp ->SetLineColor(2);
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVUp ->SetLineColor(2);
wz3lnu_CMS_hzz2l2v_umetUp ->SetLineColor(2);
wz3lnu_CMS_res_jUp ->SetLineColor(2);
wz3lnu_CMS_scale_jUp ->SetLineColor(2);
zll_CMS_hzz2l2v_stat_ll_zll_8TeVUp ->SetLineColor(2);
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVUp ->SetLineColor(2);
zz2l2nu_CMS_eff_bDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_lesDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_puDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_umetDown ->SetLineColor(3);
zz2l2nu_CMS_res_jDown ->SetLineColor(3);
zz2l2nu_CMS_scale_jDown ->SetLineColor(3);
zz2l2nu_CMS_hzz2l2v_sherpaDown ->SetLineColor(3);
wz3lnu_CMS_eff_bDown ->SetLineColor(3);
wz3lnu_CMS_hzz2l2v_lesDown ->SetLineColor(3);
wz3lnu_CMS_hzz2l2v_puDown ->SetLineColor(3);
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVDown ->SetLineColor(3);
wz3lnu_CMS_hzz2l2v_umetDown ->SetLineColor(3);
wz3lnu_CMS_res_jDown ->SetLineColor(3);
wz3lnu_CMS_scale_jDown ->SetLineColor(3);
zll_CMS_hzz2l2v_stat_ll_zll_8TeVDown ->SetLineColor(3);
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVDown ->SetLineColor(3);
TCanvas * c1_eff_b=new TCanvas("c1_eff_b","c1_eff_b",600,600);
zz2l2nu_CMS_eff_bUp->Draw("histo");
zz2l2nu_CMS_eff_bDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_QCD_ACC_JVeto=new TCanvas("c1_hzz2l2v_QCD_ACC_JVeto","c1_hzz2l2v_QCD_ACC_JVeto",600,600);
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_QCD_ACC_JVetoDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_les=new TCanvas("c1_hzz2l2v_les","c1_hzz2l2v_les",600,600);
zz2l2nu_CMS_hzz2l2v_lesUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_lesDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_pu=new TCanvas("c1_hzz2l2v_pu","c1_hzz2l2v_pu",600,600);
zz2l2nu_CMS_hzz2l2v_puUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_puDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_stat_ll_zz2l2nu_8TeV=new TCanvas("c1_hzz2l2v_stat_ll_zz2l2nu_8TeV","c1_hzz2l2v_stat_ll_zz2l2nu_8TeV",600,600);
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_stat_ll_zz2l2nu_8TeVDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_umet=new TCanvas("c1_hzz2l2v_umet","c1_hzz2l2v_umet",600,600);
zz2l2nu_CMS_hzz2l2v_umetUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_umetDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_res_j=new TCanvas("c1_res_j","c1_res_j",600,600);
zz2l2nu_CMS_res_jUp->Draw("histo");
zz2l2nu_CMS_res_jDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_scale_j=new TCanvas("c1_scale_j","c1_scale_j",600,600);
zz2l2nu_CMS_scale_jDown->Draw("histo");
zz2l2nu_CMS_scale_jUp->Draw("samehisto");
// zz2l2nu_CMS_scale_jDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_hzz2l2v_sherpa=new TCanvas("c1_hzz2l2v_sherpa","c1_hzz2l2v_sherpa",600,600);
zz2l2nu_CMS_hzz2l2v_sherpaUp->Draw("histo");
zz2l2nu_CMS_hzz2l2v_sherpaDown->Draw("samehisto");
zz2l2nu->Draw("histosame");
TCanvas * c1_wz3lnu_eff_b=new TCanvas("c1_wz3lnu_eff_b","c1_wz3lnu_eff_b",600,600);
wz3lnu_CMS_eff_bUp->Draw("histo");
wz3lnu_CMS_eff_bDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_hzz2l2v_les=new TCanvas("c1_wz3lnu_hzz2l2v_les","c1_wz3lnu_hzz2l2v_les",600,600);
wz3lnu_CMS_hzz2l2v_lesUp->Draw("histo");
wz3lnu_CMS_hzz2l2v_lesDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_hzz2l2v_pu=new TCanvas("c1_wz3lnu_hzz2l2v_pu","c1_wz3lnu_hzz2l2v_pu",600,600);
wz3lnu_CMS_hzz2l2v_puUp->Draw("histo");
wz3lnu_CMS_hzz2l2v_puDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_hzz2l2v_stat_ll_wz3lnu_8TeV=new TCanvas("c1_wz3lnu_hzz2l2v_stat_ll_wz3lnu_8TeV","c1_wz3lnu_hzz2l2v_stat_ll_wz3lnu_8TeV",600,600);
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVUp->Draw("histo");
wz3lnu_CMS_hzz2l2v_stat_ll_wz3lnu_8TeVDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_hzz2l2v_umet=new TCanvas("c1_wz3lnu_hzz2l2v_umet","c1_wz3lnu_hzz2l2v_umet",600,600);
wz3lnu_CMS_hzz2l2v_umetUp->Draw("histo");
wz3lnu_CMS_hzz2l2v_umetDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_res_j=new TCanvas("c1_wz3lnu_res_j","c1_wz3lnu_res_j",600,600);
wz3lnu_CMS_res_jUp->Draw("histo");
wz3lnu_CMS_res_jDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_wz3lnu_scale_j=new TCanvas("c1_wz3lnu_scale_j","c1_wz3lnu_scale_j",600,600);
wz3lnu_CMS_scale_jDown->Draw("histo");
wz3lnu_CMS_scale_jUp->Draw("samehisto");
// wz3lnu_CMS_scale_jDown->Draw("samehisto");
wz3lnu->Draw("histosame");
TCanvas * c1_zll_hzz2l2v_stat_ll_zll_8TeV=new TCanvas("c1_zll_hzz2l2v_stat_ll_zll_8TeV","c1_zll_hzz2l2v_stat_ll_zll_8TeV",600,600);
zll_CMS_hzz2l2v_stat_ll_zll_8TeVUp->Draw("histo");
zll_CMS_hzz2l2v_stat_ll_zll_8TeVDown->Draw("samehisto");
zll->Draw("histosame");
TCanvas * c1_top_hzz2l2v_stat_ll_topwwwjetsdata_8TeV=new TCanvas("c1_top_hzz2l2v_stat_ll_topwwwjetsdata_8TeV","c1_top_hzz2l2v_stat_ll_topwwwjetsdata_8TeV",600,600);
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVUp->Draw("histo");
topwwwjetsdata_CMS_hzz2l2v_stat_ll_topwwwjetsdata_8TeVDown->Draw("samehisto");
topwwwjetsdata->Draw("histosame");
}
| [
"senka.duric@cern.ch"
] | senka.duric@cern.ch |
a0e3a07a3dae566c5a995ecd3772ef4caf72a311 | 440fe9bc55a3d9fc44410d1748f47fbc74e30506 | /anycloud39ev300/SDK/component/UVC_check_sensor/component/drvlib/include/randomizer.h | 7f768eb96d869a227d1c1a8c4e627985959e8a51 | [] | no_license | haihoang1219931/qiwen | 5def7764f48e70a8c4fbb9692f5fd0714dcb5a20 | 6c86facd09a5c2efe5314a669f653fa90acbc999 | refs/heads/main | 2023-07-10T17:37:18.512888 | 2021-08-22T07:01:43 | 2021-08-22T07:01:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,232 | h | /**
* @filename randomizer.h
* @brief the arithmetic to randomize or derandomize the data
* Copyright (C) 2006 Anyka (Guangzhou) Software Technology Co., LTD
* @author yangyiming
* @date 2012-05-15
* @version 1.0
*/
#ifndef __RANDOMIZER_H_
#define __RANDOMIZER_H_
#define MALLOC drv_malloc
/**
*@brief initial the randomizer
*
*@author yangyiming
*@date 2012-05-15
*@param PageSize[in] the pagesize of the nand
*@return bool true for success, false for failure
*/
bool randomizer_init(unsigned long PageSize);
/**
*@brief randomize the data or derandomize the randomized data
*
*@author yangyiming
*@date 2012-05-15
*@param pageIndex[in] the offset of the page where the data got from /will be stored in the nand
*@param EccFrameIndex[in] which ecc frame in a page
*@param destBuff[out] the buffer to store the data to be converted
*@param srcBuff[in] the buffer stored the data to be converted
*@param datalen[in] the data length ,unit byte
*@return void
*/
void randomize(unsigned long pageIndex, unsigned long EccFrameIndex, unsigned char *destBuff,unsigned char *srcBuff, unsigned long datalen);
#endif
| [
"1397610152@qq.com"
] | 1397610152@qq.com |
9599475ac5875a9c5fa0a0f563aee79bb4b2d68d | 65e8e9886d6a6ac18e76809b3153d62aaff1a4ad | /socket_test/net_test/client.c | a630e02b185cba6e6e53f1f79c9323d00086fa0c | [] | no_license | Greatjackson/test | e7c0cacd968628fc3ab516d0bd5ddbefc9c5bbdb | e9ffb5aecfe96f042a2f7102df41fdea52fbb77b | refs/heads/master | 2023-01-14T05:24:21.310828 | 2020-11-24T08:45:27 | 2020-11-24T08:45:27 | 50,358,034 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,103 | c | /*************************************************************************
> File Name: client.c
> Author: liugang
> Mail: 308584349@163.com
> Created Time: Sat 26 Sep 2020 10:07:32 PM CST
************************************************************************/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "wrap.h"
#define MAXLINE 80
#define SERV_PORT 8000
int main(int argc, char *argv[])
{
struct sockaddr_in servaddr;
char buf[MAXLINE];
int sockfd, n;
sockfd = Socket(AF_INET, SOCK_STREAM, 0);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
inet_pton(AF_INET, "192.168.93.128", &servaddr.sin_addr);
servaddr.sin_port = htons(SERV_PORT);
Connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
while (fgets(buf, MAXLINE, stdin)!= NULL) {
Write (sockfd, buf, strlen(buf));
n = Read(sockfd, buf, MAXLINE);
if (n == 0)
printf("the other side has been closed.\n");
else
Write(STDOUT_FILENO, buf, n);
}
Close(sockfd);
return 0;
}
| [
"308584349@163.com"
] | 308584349@163.com |
99ac395fe9f250c485f763d5cc1a616351eb417c | 3d5d50bf1e4ea7c67b86f3de44b03e6a0ce0a0be | /Robot/Velho/SENSOR.C | ad6f001984b41e81d3790256bd4fa3d04d2883a6 | [] | no_license | mzani/main | 1df9ff4640a5167732052d18f757bbc07aa7571d | e1a1e024888435d28c2b4766a24931c61b85c087 | refs/heads/master | 2020-03-31T15:27:54.115404 | 2018-12-05T01:02:47 | 2018-12-05T01:02:47 | 152,338,053 | 0 | 0 | null | null | null | null | ISO-8859-1 | C | false | false | 11,929 | c | /*****************************************************************/
/* Programa........: Robot */
/*----------------------------------------------------------------*/
/* Módulo..........: robot.c */
/*----------------------------------------------------------------*/
/* Início..........: 01/03/2007 */
/* Autor...........: Marcelo Tadeu Marchesoni Zani */
/*----------------------------------------------------------------*/
/* Última alteração: 13/03/2007 */
/* Responsável.....: Marcelo Tadeu Marchesoni Zani */
/*----------------------------------------------------------------*/
/* 01/03/2007, mtmz : Codificação inicial. */
/*----------------------------------------------------------------*/
/* 13/03/2007, mtmz : Mudança na estrutura do programa. */
/*----------------------------------------------------------------*/
/* 22/03/2007, mtmz : Primeiro teste do programa e função */
/* que verifica e mostra sensores */
/* funcionando. */
/******************************************************************/
/*################################################################*/
/*
Includes
*/
/*################################################################*/
#include "8085io.h"
#include "8085int.h"
#include "C:\USERS\MZani\defines.h"
/*################################################################*/
/*
Variaveis Globais
*/
/*################################################################*/
int ValorSensor1;
int ValorSensor2;
int ValorSensor3;
int ValorSensor4;
int MostraSensor1;
int MostraSensor2;
int MostraSensor3;
int MostraSensor4;
int TeclaPressionada;
int FinalizaRobo;
/*################################################################*/
/*
Rotinas de display
*/
/*################################################################*/
/******************************************************************/
/* Função: getStatusLCD */
/******************************************************************/
/* Verifica se o visor está livre*/
int getStatusLCD ()
{
// Retorna o flag de busy.
return (in(END_DSPL_BUSY) & END_FLG_BUSY) != 0;
}
/******************************************************************/
/* Função: setCursorLCD */
/******************************************************************/
/* Posiciona o cursor na posicao c da linha l */
int setCursorLCD (int l, int c)
{
int posicao;
if (l == 1)
posicao = END_DSPL_PRIM_POS_L_1;
else
if(l == 2)
posicao = END_DSPL_PRIM_POS_L_2;
else
return FALSE; // Se passar linha errada ignora.
if(c > 40 || c < 1)
return FALSE; // Se passar uma posicao invalida, ignora.
out(END_DSPL, posicao + c - 1);
return TRUE;
}
/******************************************************************/
/* Função: putChrLCD */
/******************************************************************/
/* Escreve um char no display na posicao atual do cursor */
putChrLCD (char c)
{
while(getStatusLCD()); // Aguarda o display desocupar.
out(END_DSPL_WRITE, c);
}
/******************************************************************/
/* Função: putStrLCD */
/******************************************************************/
/* Escreve uma string no display a partir da posicao atual */
putStrLCD (char *s)
{
int i;
for(i=0; s[i] != '\0'; i++)
putChrLCD (s[i]);
}
/******************************************************************/
/* Função: MostraSensorLed */
/******************************************************************/
/* Escreve os leds no display */
MostraSensorLed(int ValorMedido)
{
int ValorLed;
ValorLed = ValorMedido/VALOR_ESCALA;
// Acende os leds correspondentes
switch (ValorLed)
{
case 0:
out(END_LEDS, END_1_LED_LIGADO);
break;
case 1:
out(END_LEDS, END_2_LEDS_LIGADOS);
break;
case 2:
out(END_LEDS, END_3_LEDS_LIGADOS);
break;
case 3:
out(END_LEDS, END_4_LEDS_LIGADOS);
break;
case 4:
out(END_LEDS, END_5_LEDS_LIGADOS);
break;
case 5:
out(END_LEDS, END_6_LEDS_LIGADOS);
break;
case 6:
out(END_LEDS, END_7_LEDS_LIGADOS);
break;
case 7:
out(END_LEDS, END_8_LEDS_LIGADOS);
break;
}// Switch leds.
}
/*################################################################*/
/*
Rotinas de Interrupção
*/
/*################################################################*/
/******************************************************************/
/* Função: IniciaSensorLed */
/******************************************************************/
/* Função de interrupção que atualiza os sensores.*/
INTERRUPT (32820) IniciaSensorLed ()
{
/* Para quando o robo estiver funcionando.*/
// Le e guarda o valor lido do sensor 1.
if (MostraSensor1 == TRUE)
{
out(END_ROBOT, END_RD_GP2D_1);
ValorSensor1 = in(END_ROBOT);
}
// Le e guarda o valor lido do sensor 2.
if (MostraSensor2 == TRUE)
{
out(END_ROBOT, END_RD_GP2D_2);
ValorSensor2 = in(END_ROBOT);
}
// Le e guarda o valor lido do sensor 3.
if (MostraSensor3 == TRUE)
{
out(END_ROBOT, END_RD_GP2D_3);
ValorSensor3 = in(END_ROBOT);
}
// Le e guarda o valor lido do sensor 4.
if (MostraSensor4 == TRUE)
{
out(END_ROBOT, END_RD_GP2D_4);
ValorSensor4 = in(END_ROBOT);
}
}
/*################################################################*/
/*
Main
*/
/*################################################################*/
main ()
{
int tecla, i, ValorSensor;
char Sensor;
char s[TAM_MSG_TEXTO];
/******************************************************************
Inicializa as Variaveis Globais.
******************************************************************/
ValorSensor1 = 0;
ValorSensor2 = 0;
ValorSensor3 = 0;
ValorSensor4 = 0;
MostraSensor1 = FALSE;
MostraSensor2 = FALSE;
MostraSensor3 = FALSE;
MostraSensor4 = FALSE;
TeclaPressionada = 0;
FinalizaRobo = FALSE;
/*****************************************************************/
/******************************************************************
Inicializa as Variaveis Locais.
******************************************************************/
ValorSensor = 0;
/*****************************************************************/
/******************************************************************
Inicializa o visor LCD.
******************************************************************/
// 8 bits, 2 linhas, matrix 5x10.
out (END_DSPL, END_DSPL_CONFIG);
for (i=0 ; i<TEMPO_ESP_INIC; i++);
// Desliga o display.
out (END_DSPL, END_DSPL_DESLIGA);
for (i=0 ; i<TEMPO_ESP_INIC; i++);
// Limpa memoria e contador.
out (END_DSPL, END_DSPL_LIMPA);
for (i=0 ; i<TEMPO_ESP_INIC; i++);
// Incrementa contador.
out (END_DSPL, END_DSPL_INC);
for (i=0 ; i<TEMPO_ESP_INIC; i++);
// Liga display com cursor piscando.
out (END_DSPL, END_DSPL_LIGA);
for (i=0 ; i<TEMPO_ESP_INIC; i++);
// Aponta para o endereco 80h - primeira posicao da linha 1.
out (END_DSPL, END_DSPL_PRIM_POS_L_1);
/*****************************************************************/
printf ("Inicializa Inter \n\n");
/******************************************************************
Inicializa as interupções.
******************************************************************/
// Marca o tempo das interrupções.
out(END_ROBOT, END_TMR_MS);
out(END_ROBOT, TEMPO_INTERRUPCAO);
//Inicializa o timer.
out (END_ROBOT, END_TMR_ON);
printf ("Inicializa Inter \n\n");
//desmascara
asm {
mvi A,$1D
sim
}
printf ("Inicializa Inter \n\n");
//Habilita
enable();
printf ("Inicializa Inter \n\n");
/*****************************************************************/
printf ("Inicia Loop\n\n");
/******************************************************************
Loop Principal.
******************************************************************/
while (TRUE)
{
/*****************************************************************
Verifica se há alguma tecla pressionada.
*****************************************************************/
// Pega ultima tecla pressionada.
tecla = in(END_TECLAS);
/****************************************************************/
/*******************************************************************
Sinaliza os flags de teclas.
*******************************************************************/
switch (TeclaPressionada)
{
case VALOR_TECLA_1: // Tecla verifica o sensor 1
MostraSensor1 = TRUE;
break;
case VALOR_TECLA_2:
MostraSensor2 = TRUE;
break;
case VALOR_TECLA_3:
MostraSensor3 = TRUE;
break;
case VALOR_TECLA_4:
MostraSensor4 = TRUE;
break;
case VALOR_TECLA_5:
break;
case VALOR_TECLA_6:
break;
case VALOR_TECLA_7:
break;
case VALOR_TECLA_8:// Tecla de Saida.
FinalizaRobo = TRUE;
break;
}// Switch.
/******************************************************************/
/*****************************************************************
Posiciona e escreve o sensor no display e nos leds.
*****************************************************************/
if (MostraSensor1)
{
Sensor = '1';
ValorSensor = ValorSensor1;
}
if (MostraSensor2)
{
Sensor = '2';
ValorSensor = ValorSensor2;
}
if (MostraSensor3)
{
Sensor = '3';
ValorSensor = ValorSensor3;
}
if (MostraSensor4)
{
Sensor = '4';
ValorSensor = ValorSensor4;
}
//Verifico se devo escrever Sensor 1 no display
if ((MostraSensor1 == TRUE) || (MostraSensor2 == TRUE) ||
(MostraSensor3 == TRUE) || (MostraSensor4 == TRUE)
)
{
setCursorLCD(1,8);
if (in(END_DSPL_READ) != Sensor)
{
setCursorLCD(1,1);
sprintf(s, "Sensor %c", Sensor);
putStrLCD(s);
}
}
if (ValorSensor != 0)
{
MostraSensorLed (ValorSensor);
}
printf("%d %d %d %d\n", ValorSensor1, ValorSensor2, ValorSensor3, ValorSensor4);
/****************************************************************/
/*****************************************************************
Finalizo o robo, a interrupção, os leds e o display.
*****************************************************************/
if (FinalizaRobo == TRUE)
{
// Para o Robo.
out(END_ROBOT, STOP);
// Desabilita Interrupções.
disable();
out (0xf0, 0x51);
// Apaga os Leds.
out (END_LEDS, END_0_LEDS_LIGADOS);
while (getStatusLCD()); // Aguarda o display ser liberado.
// Desliga o display.
out (END_DSPL, END_DSPL_DESLIGA);
break;
}
/****************************************************************/
/*****************************************************************
Confirma tecla pressionada e reinicia os flags.
*****************************************************************/
if(tecla)
{
if( (tecla == in(END_TECLAS)) )
{
TeclaPressionada = tecla;
// Reseta os flags de Controle de sensor
MostraSensor1 = FALSE;
MostraSensor2 = FALSE;
MostraSensor3 = FALSE;
MostraSensor4 = FALSE;
}
}
/******************************************************************/
}// While Principal.
/******************************************************************/
}
| [
"zani.marcelo@gmail.com"
] | zani.marcelo@gmail.com |
5d93b30fd7dfe7127b17698784cae3c30f5a6bab | 4ca4e6d6bf69dd0a0dc4d3317396d593446555bd | /event_selection.h | 99f2cfb85dcb721b0d4f6bcc2b095ab0df568917 | [] | no_license | tylern4/analysis | 985949f4fc9aefc22c02073c43a465a82d759edb | aead716e49cbba70e3c5649ff02cdf3fd340c7eb | refs/heads/master | 2021-01-22T06:18:25.927521 | 2017-02-09T22:17:40 | 2017-02-09T22:17:40 | 81,751,306 | 0 | 0 | null | 2017-02-12T19:34:49 | 2017-02-12T19:34:49 | null | UTF-8 | C | false | false | 7,260 | h | #ifndef EVENT_SELECTION_H
#define EVENT_SELECTION_H
#include "constants.h"
#include "hid.h"
#include "TVector3.h"
#include <TLorentzVector.h>
//Determine if multiple ids assigned to a single particle
//These are the only particles I'm IDing so if it is something else it comes in as zero
bool clean_id ( bool electron, bool proton, bool pi_plus, bool pi_minus)
{
bool clean = kFALSE;
if((int)electron +(int)proton +(int)pi_plus +(int)pi_minus<=1)
{
clean = kTRUE;
}
return clean;
}
/*
//Determine if kinematically clean
//Only need to do when all particles are present
//A momentum correction is all the more necessary after these
bool clean_kin
*/
//Give proper particle ID number to the particle id varaible array you made
int give_id( bool electron, bool proton, bool pi_plus, bool pi_minus)
{
//Check that the id is clean
int id = 0;
bool is_clean = clean_id(electron, proton, pi_plus, pi_minus);
if( is_clean == kTRUE)
{
if( electron == kTRUE)
{
id = ELECTRON;
}
if( proton == kTRUE)
{
id = PROTON;
}
if( pi_plus == kTRUE)
{
id = PION;
}
if( pi_minus == kTRUE)
{
id = -PION;
}
}
return id;
}
//Determine if there were only clean id's in an event
//Not sure how this is useful, probably won't use.
bool clean_event (Int_t gpart, int real_id[24])
{
bool clean_event = kFALSE;
int mult = 1;
for( int a=0;a<gpart;a++)
{
mult = mult * real_id[a];
}
if( mult != 0)
{
clean_event = kTRUE;
}
return clean_event;
}
//
/*
1) Identify particles
2) Choose Topology
3) Pi-Missing mass
3.1
/*
//pi- Missing Mass
if(real_id[0]==ELECTRON)
{
int pidx = -1;
int pipidx = -1;
int event = 0;
for(int k=1; k<gpart; k++)
{
if(is_proton(k) == kTRUE)
{
for(int l = 1; l<gpart; l++)
{
if(is_pip(l) == kTRUE && l!=k)
{
if(missing_mass(k,l) > (pim_center-3*pim_sigma) && missing_mass(k,l) < (pim_center+3*pim_sigma))
{
event++;
pidx = k;
pipidx = l;
}
}
}
}
}
if(event == 1)
{
//Event found
}
}
*/
//proton, pi_plus measured
// Looks for
/* Takes in
personal id: real_id
bank momentum: p
bank: gpart
bank cosines: cx, cy, cz
Energy of beam
*/
bool pi_m_miss (int real_id[24], Float_t p[23], Int_t gpart, bool clean_id, Float_t cx[23], Float_t cy[23], Float_t cz[23], double Energy)
{
bool pi_mi_found = kFALSE;
int number_pi_mi = 0;
TLorentzVector p_mu_prime, pi_mu_prime, k_mu_prime, k_mu(0.0,0.0,Energy,Energy),p_mu(0.0,0.0,0.0,mp),q_mu;
TVector3 p_mu3_prime, pi_mu3_prime, k_mu_prime3;
double missing_mass;
//Need to recalculate four momentum of virtual exchange photon
if(real_id[0]==ELECTRON)
{
k_mu_prime3.SetXYZ(p[0]*cx[0],p[0]*cy[0],p[0]*cz[0]);
k_mu_prime.SetVectM(k_mu_prime3,me);
q_mu = (k_mu - k_mu_prime);
//Loop over particles twice to find a set of proton and pi_plus
for(int w=0;w<gpart;w++)
{
for(int r=0;r<gpart;r++)
{
if( real_id[w]==PROTON && real_id[r]==PION)
{
p_mu3_prime.SetXYZ(p[w]*cx[w],p[w]*cy[w],p[w]*cz[w]);
pi_mu3_prime.SetXYZ(p[r]*cx[r],p[r]*cy[r],p[r]*cz[r]);
p_mu_prime.SetVectM(p_mu3_prime,mp);
pi_mu_prime.SetVectM(pi_mu3_prime,mpi);
missing_mass = (q_mu + p_mu - p_mu_prime - pi_mu_prime).Mag2();
if(missing_mass>=(pim_center - 3*pim_sig) && missing_mass<=(pim_center - 3*pim_sig))
{
number_pi_mi++;
}
}
}
}
}
//Looking for just a single pi_minus paired with a proton, pi_plus
if(number_pi_mi ==1)
{
pi_mi_found = kTRUE;
}
return pi_mi_found;
}
//Seen pi plus and minus
bool proton_miss (int real_id[24], Float_t p[23], Int_t gpart, bool clean_id, Float_t cx[23], Float_t cy[23], Float_t cz[23], double Energy)
{
bool proton_found = kFALSE;
int number_proton = 0;
TLorentzVector p_mu_prime, pi_mu_prime, k_mu_prime, k_mu(0.0,0.0,Energy,Energy),p_mu(0.0,0.0,0.0,mp),q_mu;
TVector3 p_mu3_prime, pi_mu3_prime, k_mu_prime3;
double missing_mass;
//Need to recalculate four momentum of virtual exchange photon
if(real_id[0]==ELECTRON)
{
k_mu_prime3.SetXYZ(p[0]*cx[0],p[0]*cy[0],p[0]*cz[0]);
k_mu_prime.SetVectM(k_mu_prime3,me);
q_mu = (k_mu - k_mu_prime);
//Loop over particles twice to find a set of pi_minus and pi_plus
for(int w=0;w<gpart;w++)
{
for(int r=0;r<gpart;r++)
{
if( real_id[w]==PION && real_id[r]==-PION)
{
p_mu3_prime.SetXYZ(p[w]*cx[w],p[w]*cy[w],p[w]*cz[w]);
pi_mu3_prime.SetXYZ(p[r]*cx[r],p[r]*cy[r],p[r]*cz[r]);
p_mu_prime.SetVectM(p_mu3_prime,mpi);
pi_mu_prime.SetVectM(pi_mu3_prime,mpi);
missing_mass = (q_mu + p_mu - p_mu_prime - pi_mu_prime).Mag2();
if(missing_mass>=(p_center - 3*p_sig) && missing_mass<=(p_center - 3*p_sig))
{
number_proton++;
}
}
}
}
}
//Looking for just a single proton paired with a pi minus, pi_plus
if(number_proton ==1)
{
proton_found = kTRUE;
}
return proton_found;
}
//Seen proton and pi minus: missing mass on pi plus
bool pi_p_miss (int real_id[24], Float_t p[23], Int_t gpart, bool clean_id, Float_t cx[23], Float_t cy[23], Float_t cz[23], double Energy)
{
bool pi_p_found = kFALSE;
int number_pi_p = 0;
TLorentzVector p_mu_prime, pi_mu_prime, k_mu_prime, k_mu(0.0,0.0,Energy,Energy),p_mu(0.0,0.0,0.0,mp),q_mu;
TVector3 p_mu3_prime, pi_mu3_prime, k_mu_prime3;
double missing_mass;
//Need to recalculate four momentum of virtual exchange photon
if(real_id[0]==ELECTRON)
{
k_mu_prime3.SetXYZ(p[0]*cx[0],p[0]*cy[0],p[0]*cz[0]);
k_mu_prime.SetVectM(k_mu_prime3,me);
q_mu = (k_mu - k_mu_prime);
//Loop over particles twice to find a set of proton and pi_minus
for( int w=0;w<gpart;w++)
{
for( int r=0;r<gpart;r++)
{
if( real_id[w]==PROTON && real_id[r]==-PION)
{
p_mu3_prime.SetXYZ(p[w]*cx[w],p[w]*cy[w],p[w]*cz[w]);
pi_mu3_prime.SetXYZ(p[r]*cx[r],p[r]*cy[r],p[r]*cz[r]);
p_mu_prime.SetVectM(p_mu3_prime,mp);
pi_mu_prime.SetVectM(pi_mu3_prime,mpi);
missing_mass = (q_mu + p_mu - p_mu_prime - pi_mu_prime).Mag2();
if(missing_mass>=(pip_center - 3*pip_sig) && missing_mass<=(pip_center - 3*pip_sig))
{
number_pi_p++;
}
}
}
}
}
//Looking for just a single pi_minus paired with a proton, pi_minus
if(number_pi_p ==1)
{
pi_p_found = kTRUE;
}
return pi_p_found;
}
//This just says whether or not all target particles are in the event
bool all_present(int real_id[24], Int_t gpart)
{
bool all_present = kFALSE;
for(int i=0;i<gpart;i++)
{
for(int j=0;j<gpart;j++)
{
for(int k=0;k<gpart;k++)
{
if( real_id[i]==PROTON && real_id[j]==PION && real_id[k]==-PION)
{
all_present = kTRUE;
}
}
}
}
return all_present;
}
//To see if an event satisfies any of the four topologies
bool topology_cross ( bool all_present, bool pi_mi_miss, bool pi_p_miss, bool proton_miss)
{
bool cross = kFALSE;
if( ((int)all_present + (int)pi_mi_miss +(int)pi_p_miss +(int)proton_miss)>=1)
{
cross = kTRUE;
}
return cross;
}
//Actual event selection
//Will cross reference through diffrent topologies to make sure that events are not double, or triple counted
/*
Says whether or not the event fits within
- Taret Particles
- Kinematic Agreement
- no momentum corrections yet
*/
//bool event_selection()
#endif /* EVENT_SELECTION_H */ | [
"c.a.mclauchlin@gmail.com"
] | c.a.mclauchlin@gmail.com |
c334b30f354d2fd11eb3cf7de70c6e160f30d843 | 4b8cc482b171a24b9e77b5baf2d44c57797140f2 | /mod_sslhaf.c | 4643de2a8ded2ed6ef2f43fdb84eaf816b24527d | [] | no_license | grimreaper/sslhaf | 78aed96fc5b5bd7ed8f98f9602d7e352fcb52fee | cf4a7961df890e35c2ae8bf58822ad95343f3f87 | refs/heads/master | 2021-01-18T09:23:25.274953 | 2012-10-18T14:28:59 | 2012-10-18T14:28:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 36,718 | c | /*
mod_sslhaf: Apache module for passive SSL client fingerprinting
| THIS PRODUCT IS NOT READY FOR PRODUCTION USE. DEPLOY AT YOUR OWN RISK.
Copyright (c) 2009-2012, Qualys, 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:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Qualys, Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
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.
*/
/*
* This Apache module will extract the list of SSL cipher suites
* offered by HTTP clients during the SSL negotiation phase. The idea
* is that different clients use different SSL implementations and
* configure them in different ways. By looking at the differences in
* the cipher suites we should be able to identify clients, irrespective
* of what they seem to be (looking at HTTP request headers).
*
* This way of fingerprinting is much more reliable than other approaches
* (e.g. TCP/IP fingerprinting), for the following reasons:
*
* - HTTP proxies do not terminate SSL, which means that every client
* creates a unique data stream that is sent directly to servers.
*
* - NAT will modify TCP/IP packets, but leave SSL data streams
* untouched.
*
*
* To compile and install the module, do this:
*
* # apxs -cia mod_sslhaf.c
*
* The above script will try to add a LoadModule statement to your
* configuration file but it will fail if it can't find at least one
* previous such statement. If that happens (you'll see the error
* message) you'll need to add the following line manually:
*
* LoadModule sslhaf_module /path/to/modules/mod_sslhaf.so
*
* You will also need to add a custom log to record cipher suite information.
* For example (add to the virtual host where you want the fingerprinting
* to take place):
*
* CustomLog logs/sslhaf.log "%t %h \"%{SSLHAF_HANDSHAKE}e\" \
* \"%{SSLHAF_PROTOCOL}e\" \"%{SSLHAF_SUITES}e\" \"%{SSLHAF_BEAST}e\" \
* \"%{SSLHAF_COMPRESSION}e\" \"%{SSLHAF_EXTENSIONS_LEN}e\" \"%{SSLHAF_EXTENSIONS}e\" \
* \"%{User-Agent}i\""
*
* As an example, these are the values you'd get from a visit by the Google
* search engine:
*
* SSLHAF_HANDSHAKE 2
* SSLHAF_PROTOCOL 3.1
* SSLHAF_SUITES 04,010080,05,0a
*
* The tokens have the following meaning:
*
* - SSL_HANDSHAKE contains the handshake version used: 2 and 3 for an SSL v2 and SSL v3+
* handshake, respectively. You can see in the example that Google bot uses a SSLv2 handshake,
* which means that it is ready to use SSL v2 or better.
*
* - SSL_PROTOCOL The second token contains the best SSL/TLS version supported by the client. For
* example, SSLv3 is "3.0"; TLS 1.0 is "3.1"; TLS 1.1 is "3.2", etc.
*
* - SSLHAF_SUITES contains a list of the supported cipher suites. Each value, a hexadecimal number,
* corresponds to one cipher suite. From the example, 0x04 stands for SSL_RSA_WITH_RC4_128_MD5,
* 0x010080 stands for SSL_CK_RC4_128_WITH_MD5 (a SSLv2 suite) and 0x05 stands
* for SSL_RSA_WITH_RC4_128_SHA.
*
* - SSLHAF_BEAST is 1 if the 1/n-1 BEAST mitigation was detected, 0 otherwise.
*
* - SSLHAF_COMPRESSION contains the list of compression methods offered by the
* client (NULL 00, DEFLATE 01). The field can be NULL, in which case it will appear
* in the logs as "-". This happens when SSLv2 handshake is used.
*
* - SSLHAF_LOG is defined (and contains "1") only on the first request in a connection. This
* variable can be used to reduce the amount of logging (SSL parameters will typically not
* change across requests on the same connection). Example:
*
* CustomLog logs/sslhaf.log "YOUR_LOG_STRING_HERE" env=SSLHAF_LOG
*
*/
#include "ap_config.h"
#include "apr_lib.h"
#include "apr_hash.h"
#include "apr_optional.h"
#include "apr_sha1.h"
#include "apr_strings.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_connection.h"
#include "http_log.h"
#include "http_protocol.h"
#include "mod_log_config.h"
module AP_MODULE_DECLARE_DATA sslhaf_module;
static const char sslhaf_in_filter_name[] = "SSLHAF_IN";
static const char sslhaf_out_filter_name[] = "SSLHAF_OUT";
struct sslhaf_cfg_t {
/* Inspection state; see above for the constants. */
int state;
/* The buffer we use to store the first SSL packet.
* Allocated from the connection pool.
*/
int buf_protocol;
unsigned char *buf;
apr_size_t buf_len;
apr_size_t buf_to_go;
/* The client hello version used; 2 or 3. */
unsigned int hello_version;
/* SSL version indicated in the handshake. */
unsigned int protocol_high;
unsigned int protocol_low;
/* How many suites are there? */
unsigned int slen;
/* Pointer to the first suite. Do note that a v3 suites consumes
* 2 bytes whereas a v2 suite consumes 3 bytes. You need to check
* hello_version before you access the suites.
*/
const char *suites;
/* Handkshake version as string. */
const char *thandshake;
/* Protocol version number as string. */
const char *tprotocol;
/* Suites as text. */
const char *tsuites;
/* How many requests were there on this connection? */
unsigned int request_counter;
/* SHA1 hash of the remote address. */
const char *ipaddress_hash;
/* How many output buckets seen on a connection */
int out_bucket_count;
/* How many input data fragments seen before first output data fragment. */
int in_data_fragments;
/* How many output buckets sent before first input data fragment. */
int in_data_fragment_out_buckets;
/* Indicates the connection has switched to encrypted handshake messages. */
int seen_cipher_change;
/* How many compression methods are there. */
int compression_len;
/* List of all compression methods as a comma-separated string. */
const char *compression_methods;
/* How many extensions were there in the handshake? */
int extensions_len;
/* A string that contains the list of all extensions seen in the handshake. */
const char *extensions;
};
typedef struct sslhaf_cfg_t sslhaf_cfg_t;
#define STATE_START 0
#define STATE_BUFFER 1
#define STATE_READING 2
#define STATE_GOAWAY 3
#define BUF_LIMIT 16384
#define PROTOCOL_CHANGE_CIPHER_SPEC 20
#define PROTOCOL_HANDSHAKE 22
#define PROTOCOL_APPLICATION 23
/**
* Convert the bytes given on input into their hexadecimal representation.
*/
char *bytes2hex(apr_pool_t *pool, unsigned char *data, int len) {
static unsigned char b2hex[] = "0123456789abcdef";
char *hex = NULL;
int i, j;
hex = apr_palloc(pool, (len * 2) + 1);
if (hex == NULL) return NULL;
j = 0;
for(i = 0; i < len; i++) {
hex[j++] = b2hex[data[i] >> 4];
hex[j++] = b2hex[data[i] & 0x0f];
}
hex[j] = '\0';
return hex;
}
/**
* Generate a SHA1 hash of the supplied data.
*/
char *generate_sha1(apr_pool_t *pool, char *data, int len) {
unsigned char digest[APR_SHA1_DIGESTSIZE];
apr_sha1_ctx_t context;
apr_sha1_init(&context);
apr_sha1_update(&context, (const char *)data, len);
apr_sha1_final(digest, &context);
return bytes2hex(pool, digest, APR_SHA1_DIGESTSIZE);
}
/**
* Convert one byte into its hexadecimal representation.
*/
unsigned char *c2x(unsigned what, unsigned char *where) {
static const char c2x_table[] = "0123456789abcdef";
what = what & 0xff;
*where++ = c2x_table[what >> 4];
*where++ = c2x_table[what & 0x0f];
return where;
}
/**
* Decode SSLv2 packet.
*/
static int decode_packet_v2(ap_filter_t *f, sslhaf_cfg_t *cfg) {
unsigned char *buf = cfg->buf;
apr_size_t len = cfg->buf_len;
int cslen;
unsigned char *q;
// There are 6 bytes before the list of cipher suites:
// cipher suite length (2 bytes), session ID length (2 bytes)
// and challenge length (2 bytes).
if (len < 6) {
return -1;
}
// How many bytes do the cipher suites consume?
cslen = (buf[0] * 256) + buf[1];
// Skip over to the list.
buf += 6;
len -= 6;
// Check that we have the suites in the buffer.
if (len < (apr_size_t)cslen) {
return -2;
}
// In SSLv2 each suite consumes 3 bytes.
cslen = cslen / 3;
// Keep the pointer to where the suites begin. The memory
// was allocated from the connection pool, so it should
// be around for as long as we need it.
cfg->slen = cslen;
cfg->suites = (const char *)buf;
cfg->thandshake = apr_psprintf(f->c->pool, "%i", cfg->hello_version);
cfg->tprotocol = apr_psprintf(f->c->pool, "%i.%i", cfg->protocol_high, cfg->protocol_low);
// Create a list of suites as text, for logging. Each 3-byte
// suite can consume up to 6 bytes (in hexadecimal form) with
// an additional byte for a comma. We need 9 bytes at the
// beginning (handshake and version), as well as a byte for
// the terminating NUL byte.
q = apr_pcalloc(f->c->pool, (cslen * 7) + 1);
if (q == NULL) {
return -3;
}
cfg->tsuites = (const char *)q;
// Extract cipher suites; each suite consists of 3 bytes.
while(cslen--) {
if ((const char *)q != cfg->tsuites) {
*q++ = ',';
}
if (*buf != 0) {
c2x(*buf, q);
q += 2;
c2x(*(buf + 1), q);
q += 2;
} else {
if (*(buf + 1) != 0) {
c2x(*(buf + 1), q);
q += 2;
}
}
c2x(*(buf + 2), q);
q += 2;
buf += 3;
}
*q = '\0';
return 1;
}
/**
* Decode SSLv3+ packet containing handshake data.
*/
static int decode_packet_v3_handshake(ap_filter_t *f, sslhaf_cfg_t *cfg) {
unsigned char *buf = cfg->buf;
apr_size_t len = cfg->buf_len;
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_packet_v3_handshake (len %" APR_SIZE_T_FMT ")",
f->c->remote_ip, len);
#endif
// Loop while there's data in buffer
while(len > 0) {
apr_size_t ml;
int mt;
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_packet_v3_handshake loop (len %" APR_SIZE_T_FMT,
f->c->remote_ip, len);
#endif
// Check for size first
if (len < 4) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Decoding packet v3 HANDSHAKE: Packet too small %" APR_SIZE_T_FMT,
f->c->remote_ip, len);
return -1;
}
// Message type
mt = buf[0];
// Message length
ml = (buf[1] * 65536) + (buf[2] * 256) + buf[3];
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_packet_v3_handshake mt %d %" APR_SIZE_T_FMT,
f->c->remote_ip, mt, ml);
#endif
if (mt != 1) {
return 1;
}
// Does the message length correspond
// to the size of our buffer?
if (ml > len - 4) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Decoding packet v3 HANDSHAKE: Length mismatch. Expecting %"
APR_SIZE_T_FMT " got %" APR_SIZE_T_FMT, f->c->remote_ip, ml, len - 4);
return -2;
}
// Is this a Client Hello message?
if (mt == 1) {
unsigned char *p = buf + 4; // skip over the message type and length
unsigned char *q;
apr_size_t mylen = ml;
int idlen;
int cslen;
if (mylen < 34) { // for the version number and random value
return -3;
}
p += 2; // version number
p += 32; // random value
mylen -= 34;
if (mylen < 1) { // for the ID length byte
return -4;
}
idlen = *p;
p += 1; // ID len
mylen -= 1;
if (mylen < (apr_size_t)idlen) { // for the ID
return -5;
}
p += idlen; // ID
mylen -= idlen;
if (mylen < 2) { // for the CS length bytes
return -6;
}
cslen = (*p * 256) + *(p + 1);
cslen = cslen / 2; // each suite consumes 2 bytes
p += 2; // Cipher Suites len
mylen -= 2;
if (mylen < (apr_size_t)cslen * 2) { // for the suites
return -7;
}
// Keep the pointer to where the suites begin. The memory
// was allocated from the connection pool, so it should
// be around for as long as we need it.
cfg->slen = cslen;
cfg->suites = (const char *)p;
cfg->thandshake = apr_psprintf(f->c->pool, "%d", cfg->hello_version);
cfg->tprotocol = apr_psprintf(f->c->pool, "%d.%d", cfg->protocol_high, cfg->protocol_low);
// Create a list of suites as text, for logging
q = apr_pcalloc(f->c->pool, (cslen * 7) + 1);
cfg->tsuites = (const char *)q;
// Extract cipher suites; each suite consists of 2 bytes
while(cslen--) {
if ((const char *)q != cfg->tsuites) {
*q++ = ',';
}
if (*p != 0) {
c2x(*p, q);
q += 2;
}
c2x(*(p + 1), q);
q += 2;
p += 2;
}
*q = '\0';
mylen -= cfg->slen * 2;
// Compression
if (mylen < 1) { // compression data length
return -8;
}
int clen = *p++;
mylen--;
if (mylen < clen) { // compression data
return -9;
}
cfg->compression_len = clen;
q = apr_pcalloc(f->c->pool, (clen * 3) + 1);
cfg->compression_methods = (const char *)q;
while(clen--) {
if ((const char *)q != cfg->compression_methods) {
*q++ = ',';
}
c2x(*p, q);
p++;
q += 2;
}
*q = '\0';
mylen -= cfg->compression_len;
if (mylen == 0) {
// It's OK if there is no more data; that means
// we're seeing a handshake without any extensions
return 1;
}
// Extensions
if (mylen < 2) { // extensions length
return -10;
}
int elen = (*p * 256) + *(p + 1);
mylen -= 2;
p += 2;
if (mylen < elen) { // extension data
return -11;
}
cfg->extensions_len = 0;
q = apr_pcalloc(f->c->pool, (elen * 5) + 1);
cfg->extensions = (const char *)q;
while(elen > 0) {
cfg->extensions_len++;
if ((const char *)q != cfg->extensions) {
*q++ = ',';
}
// extension type, byte 1
c2x(*p, q);
p++;
elen--;
q += 2;
// extension type, byte 2
c2x(*p, q);
p++;
elen--;
q += 2;
// extension length
int ext1len = (*p * 256) + *(p + 1);
p += 2;
elen -= 2;
// skip over extension data
p += ext1len;
elen -= ext1len;
}
*q = '\0';
}
// Skip over the message
len -= 4;
len -= ml;
buf += 4;
buf += ml;
}
return 1;
}
/**
* Decode SSLv3+ packet data.
*/
static int decode_packet_v3(ap_filter_t *f, sslhaf_cfg_t *cfg) {
/* Handshake */
if (cfg->buf_protocol == PROTOCOL_HANDSHAKE) {
if (cfg->seen_cipher_change == 0) {
return decode_packet_v3_handshake(f, cfg);
} else {
// Ignore encrypted handshake messages
return 1;
}
} else
/* Application data */
if (cfg->buf_protocol == PROTOCOL_APPLICATION) {
// On first data fragment, remember how many
// output buckets we have seen so far
if (cfg->in_data_fragments == 0) {
cfg->in_data_fragment_out_buckets = cfg->out_bucket_count;
cfg->in_data_fragments++;
} else {
// Increment data fragement counter for as
// long as the output bucket counter remains
// the same
if (cfg->out_bucket_count == cfg->in_data_fragment_out_buckets) {
cfg->in_data_fragments++;
}
}
return 1;
} else
/* Change cipher spec */
if (cfg->buf_protocol == PROTOCOL_CHANGE_CIPHER_SPEC) {
cfg->seen_cipher_change = 1;
return 1;
} else {
// Ignore unknown protocols
return 1;
}
}
/**
* Deal with a single bucket. We look for a handshake SSL packet, buffer
* it (possibly across several invocations), then invoke a function to analyse it.
*/
static int decode_bucket(ap_filter_t *f, sslhaf_cfg_t *cfg,
const unsigned char *inputbuf, apr_size_t inputlen)
{
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_bucket (inputlen %" APR_SIZE_T_FMT ")", f->c->remote_ip, inputlen);
#endif
// Loop while there's input to process
while(inputlen > 0) {
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_bucket (inputlen %" APR_SIZE_T_FMT ", state %d)", f->c->remote_ip, inputlen, cfg->state);
#endif
// Are we looking for the next packet of data?
if ((cfg->state == STATE_START)||(cfg->state == STATE_READING)) {
apr_size_t len;
// Are we expecting a handshake packet?
if (cfg->state == STATE_START) {
if ((inputbuf[0] != PROTOCOL_HANDSHAKE)&&(inputbuf[0] != 128)) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf: First byte (%d) of this connection does not indicate SSL; skipping", inputbuf[0]);
return -1;
}
}
// Check for SSLv3+
if ( (inputbuf[0] == PROTOCOL_HANDSHAKE)
||(inputbuf[0] == PROTOCOL_APPLICATION)
||(inputbuf[0] == PROTOCOL_CHANGE_CIPHER_SPEC))
{
// Remember protocol
cfg->buf_protocol = inputbuf[0];
// Go over the protocol byte
inputbuf++;
inputlen--;
// Are there enough bytes to begin analysis?
if (inputlen < 4) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Less than 5 bytes from the packet available in this bucket",
f->c->remote_ip);
return -1;
}
cfg->hello_version = 3;
cfg->protocol_high = inputbuf[0];
cfg->protocol_low = inputbuf[1];
// Go over the version bytes
inputbuf += 2;
inputlen -= 2;
// Calculate packet length
len = (inputbuf[0] * 256) + inputbuf[1];
// Limit what we are willing to accept
if ((len <= 0)||(len > BUF_LIMIT)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: TLS record too long: %" APR_SIZE_T_FMT "; limit %d",
f->c->remote_ip, len, BUF_LIMIT);
return -1;
}
// Go over the packet length bytes
inputbuf += 2;
inputlen -= 2;
// Allocate a buffer to hold the entire packet
cfg->buf = malloc(len);
if (cfg->buf == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Failed to allocate %" APR_SIZE_T_FMT " bytes",
f->c->remote_ip, len);
return -1;
}
// Go into buffering mode
cfg->state = STATE_BUFFER;
cfg->buf_len = 0;
cfg->buf_to_go = len;
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, f->c->base_server,
"mod_sslhaf [%s]: decode_bucket; buffering protocol %d high %d low %d len %" APR_SIZE_T_FMT,
f->c->remote_ip, cfg->buf_protocol, cfg->protocol_high, cfg->protocol_low, len);
#endif
}
else
// Is it a SSLv2 ClientHello?
if (inputbuf[0] == 128) {
// Go over packet type
inputbuf++;
inputlen--;
// Are there enough bytes to begin analysis?
if (inputlen < 4) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Less than 5 bytes from the packet available in this bucket",
f->c->remote_ip);
return -1;
}
// Check that it is indeed ClientHello
if (inputbuf[1] != 1) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Not SSLv2 ClientHello (%d)",
f->c->remote_ip, inputbuf[1]);
return -1;
}
cfg->hello_version = 2;
if ((inputbuf[2] == 0x00)&&(inputbuf[3] == 0x02)) {
// SSL v2 uses 0x0002 for the version number
cfg->protocol_high = inputbuf[3];
cfg->protocol_low = inputbuf[2];
} else {
// SSL v3 will use 0x0300, 0x0301, etc.
cfg->protocol_high = inputbuf[2];
cfg->protocol_low = inputbuf[3];
}
// We've already consumed 3 bytes from the packet
len = inputbuf[0] - 3;
// Limit what we are willing to accept
if ((len <= 0)||(len > BUF_LIMIT)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: TLS record too long: %" APR_SIZE_T_FMT "; limit %d",
f->c->remote_ip, len, BUF_LIMIT);
return -1;
}
// Go over the packet length (1 byte), message
// type (1 byte) and version (2 bytes)
inputbuf += 4;
inputlen -= 4;
// Allocate a buffer to hold the entire packet
cfg->buf = apr_pcalloc(f->c->pool, len);
if (cfg->buf == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Failed to allocate %" APR_SIZE_T_FMT " bytes",
f->c->remote_ip, len);
return -1;
}
// Go into buffering mode
cfg->state = STATE_BUFFER;
cfg->buf_len = 0;
cfg->buf_to_go = len;
}
else {
// Unknown protocol
return -1;
}
}
// Are we buffering?
if (cfg->state == STATE_BUFFER) {
// How much data is available?
if (cfg->buf_to_go <= inputlen) {
int rc;
// We have enough data to complete this packet
memcpy(cfg->buf + cfg->buf_len, inputbuf, cfg->buf_to_go);
cfg->buf_len += cfg->buf_to_go;
inputbuf += cfg->buf_to_go;
inputlen -= cfg->buf_to_go;
cfg->buf_to_go = 0;
// Decode the packet now
if (cfg->hello_version == 3) {
rc = decode_packet_v3(f, cfg);
} else {
rc = decode_packet_v2(f, cfg);
}
// Free the packet buffer, which we no longer need
free(cfg->buf);
cfg->buf = NULL;
if (rc < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, f->c->base_server,
"mod_sslhaf [%s]: Packet decoding error rc %d (hello %d)",
f->c->remote_ip, rc, cfg->hello_version);
return -1;
}
// Go back to looking at the next packet
cfg->state = STATE_READING;
return rc;
} else {
// There's not enough data; copy what we can and
// we'll get the rest later
memcpy(cfg->buf + cfg->buf_len, inputbuf, inputlen);
cfg->buf_len += inputlen;
cfg->buf_to_go -= inputlen;
inputbuf += inputlen;
inputlen = 0;
}
}
}
return 1;
}
/**
* Monitor outbound data and count buckets. This will help us determine
* if input data is fragmented (we see more than one inbound bucket before
* we see one outbound bucket).
*/
static apr_status_t sslhaf_out_filter(ap_filter_t *f, apr_bucket_brigade *bb) {
sslhaf_cfg_t *cfg = ap_get_module_config(f->c->conn_config, &sslhaf_module);
apr_status_t status;
apr_bucket *bucket;
// Return straight away if there's no configuration
if (cfg == NULL) {
return ap_pass_brigade(f->next, bb);
}
// Loop through the buckets
for (bucket = APR_BRIGADE_FIRST(bb);
bucket != APR_BRIGADE_SENTINEL(bb);
bucket = APR_BUCKET_NEXT(bucket))
{
const char *buf = NULL;
apr_size_t buflen = 0;
if (!(APR_BUCKET_IS_METADATA(bucket))) {
// Get bucket data
status = apr_bucket_read(bucket, &buf, &buflen, APR_BLOCK_READ);
if (status != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, status, f->c->base_server,
"mod_sslhaf [%s]: Error while reading output bucket",
f->c->remote_ip);
return status;
}
// Count output buckets
cfg->out_bucket_count++;
}
}
return ap_pass_brigade(f->next, bb);
}
/**
* This input filter will basicall sniff on a connection and analyse
* the packets when it detects SSL.
*/
static apr_status_t sslhaf_in_filter(ap_filter_t *f,
apr_bucket_brigade *bb,
ap_input_mode_t mode,
apr_read_type_e block,
apr_off_t readbytes)
{
sslhaf_cfg_t *cfg = ap_get_module_config(f->c->conn_config, &sslhaf_module);
apr_status_t status;
apr_bucket *bucket;
// Return straight away if there's no configuration
if (cfg == NULL) {
return ap_get_brigade(f->next, bb, mode, block, readbytes);
}
// Sanity check first
if (cfg->state == STATE_GOAWAY) {
return ap_get_brigade(f->next, bb, mode, block, readbytes);
}
// Get brigade
status = ap_get_brigade(f->next, bb, mode, block, readbytes);
if (status != APR_SUCCESS) {
// Do not log, since we're passing the status anyway
cfg->state = STATE_GOAWAY;
return status;
}
// Loop through the buckets
for(bucket = APR_BRIGADE_FIRST(bb);
bucket != APR_BRIGADE_SENTINEL(bb);
bucket = APR_BUCKET_NEXT(bucket))
{
const char *buf = NULL;
apr_size_t buflen = 0;
if (!(APR_BUCKET_IS_METADATA(bucket))) {
// Get bucket data
status = apr_bucket_read(bucket, &buf, &buflen, APR_BLOCK_READ);
if (status != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, status, f->c->base_server,
"mod_sslhaf [%s]: Error while reading input bucket",
f->c->remote_ip);
return status;
}
// Look into the bucket
if (decode_bucket(f, cfg, (const unsigned char *)buf, buflen) <= 0) {
cfg->state = STATE_GOAWAY;
}
}
}
return APR_SUCCESS;
}
/**
* Attach our filter to every incoming connection.
*/
static int sslhaf_pre_conn(conn_rec *c, void *csd) {
sslhaf_cfg_t *cfg = NULL;
// TODO Can we determine if SSL is enabled on this connection
// and don't bother if it isn't? It is actually possible that
// someone speaks SSL on a non-SSL connection, but we won't
// be able to detect that. It wouldn't matter, though, because
// Apache will not process such a request.
cfg = apr_pcalloc(c->pool, sizeof(*cfg));
if (cfg == NULL) return OK;
ap_set_module_config(c->conn_config, &sslhaf_module, cfg);
ap_add_input_filter(sslhaf_in_filter_name, NULL, NULL, c);
ap_add_output_filter(sslhaf_out_filter_name, NULL, NULL, c);
#ifdef ENABLE_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,
"mod_sslhaf: Connection from %s", c->remote_ip);
#endif
return OK;
}
/**
* Take the textual representation of the client's cipher suite
* list and attach it to the request.
*/
static int sslhaf_post_request(request_rec *r) {
sslhaf_cfg_t *cfg = ap_get_module_config(r->connection->conn_config, &sslhaf_module);
if ((cfg != NULL)&&(cfg->tsuites != NULL)) {
// Release the packet buffer if we're still holding it
if (cfg->buf != NULL) {
free(cfg->buf);
cfg->buf = NULL;
}
// Make the handshake information available to other modules
apr_table_setn(r->subprocess_env, "SSLHAF_HANDSHAKE", cfg->thandshake);
apr_table_setn(r->subprocess_env, "SSLHAF_PROTOCOL", cfg->tprotocol);
apr_table_setn(r->subprocess_env, "SSLHAF_SUITES", cfg->tsuites);
// BEAST mitigation detection
if (cfg->in_data_fragments > 1) {
apr_table_setn(r->subprocess_env, "SSLHAF_BEAST", "1");
} else {
apr_table_setn(r->subprocess_env, "SSLHAF_BEAST", "0");
}
// Expose compression methods
apr_table_setn(r->subprocess_env, "SSLHAF_COMPRESSION", cfg->compression_methods);
// Expose extension data
char *extensions_len = apr_psprintf(r->pool, "%d", cfg->extensions_len);
apr_table_setn(r->subprocess_env, "SSLHAF_EXTENSIONS_LEN", extensions_len);
apr_table_setn(r->subprocess_env, "SSLHAF_EXTENSIONS", cfg->extensions);
// Keep track of how many requests there were
cfg->request_counter++;
// Help to log only once per connection
if (cfg->request_counter == 1) {
apr_table_setn(r->subprocess_env, "SSLHAF_LOG", "1");
}
#if 0
// Generate a sha1 of the remote address on the first request
if (cfg->ipaddress_hash == NULL) {
cfg->ipaddress_hash = generate_sha1(r->connection->pool,
r->connection->remote_ip, strlen(r->connection->remote_ip));
}
apr_table_setn(r->subprocess_env, "SSLHAF_IP_HASH", cfg->ipaddress_hash);
#endif
}
return DECLINED;
}
/**
* Main entry point.
*/
static void register_hooks(apr_pool_t *p) {
static const char * const afterme[] = { "mod_security2.c", NULL };
ap_hook_pre_connection(sslhaf_pre_conn, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_read_request(sslhaf_post_request, NULL, afterme, APR_HOOK_REALLY_FIRST);
ap_register_input_filter(sslhaf_in_filter_name, sslhaf_in_filter,
NULL, AP_FTYPE_NETWORK - 1);
ap_register_output_filter(sslhaf_out_filter_name, sslhaf_out_filter,
NULL, AP_FTYPE_NETWORK - 1);
}
module AP_MODULE_DECLARE_DATA sslhaf_module = {
STANDARD20_MODULE_STUFF,
NULL, /* create per-dir config */
NULL, /* merge per-dir config */
NULL, /* server config */
NULL, /* merge server config */
NULL, /* command apr_table_t */
register_hooks /* register hooks */
};
| [
"ivanr@webkreator.com"
] | ivanr@webkreator.com |
f87e6ea06fb1bd1da03641948cd311c077adaef4 | b9c44d43f69fd3e6eea09cff9d33ccb77d00b001 | /UVA10341.c | dcc345281cdf54e71b9718747337af0d31883296 | [] | no_license | harryramsey/UVA-Online | e04b924aec2079d0b4a918267276cda03b9b58f4 | 32062582ec0c5e110c1a7fd7ddbd750091e0bd6c | refs/heads/master | 2021-01-21T12:35:50.591520 | 2015-09-18T04:08:21 | 2015-09-18T04:08:21 | 23,942,293 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,017 | c | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
double fun(double p, double q, double r, double s, double t, double u, double x)
{
return p*exp(-x) + q*sin(x) + r*cos(x) + s*tan(x) + t*x*x + u;
}
void secant(double pcoeff, double q, double r, double s, double t, double u){
double tol = 0.00000001;
double p = 0, q0 = 0, q1 = 0, p0 = 0, p1 = 1;
if (fun(pcoeff,q,r,s,t,u,0) * fun(pcoeff,q,r,s,t,u,1) > 0){
printf("No solution\n");
}
else if (pcoeff == 0.0 && q == 0.0 && r == 0.0 && s == 0.0 && s == 0.0 && t == 0.0 && u == 0.0){
printf("0.0000\n");
}
else {
while (1){
q0 = fun(pcoeff,q,r,s,t,u,p0);
q1 = fun(pcoeff,q,r,s,t,u,p1);
p = p1-q1*(p1-p0)/(q1-q0);
if (fabs(p-p1) < tol){
printf("%.4lf\n",p);
break;
}
p0 = p1;
q0 = q1;
p1 = p;
q1 = fun(pcoeff,q,r,s,t,u,p1);
}
}
}
int main()
{
double p,q,r,s,t,u;
while(scanf("%lf %lf %lf %lf %lf %lf", &p, &q, &r, &s, &t, &u) == 6){
secant(p,q,r,s,t,u);
}
return 0;
}
| [
"hbramsey@live.unc.edu"
] | hbramsey@live.unc.edu |
3bcfe912e2c48183513153ec1e084967483f23ef | 4d09e33424a0cee1605701fc905e4c5585044000 | /C_Projects/ft_printf/src/help_functions2.c | 0748ba72435d1c2714fb933b78909bede1e3a2cf | [] | no_license | BenjaminLaine/projects | c0e01adfa827aba51b1b3373215b667cfa2f7752 | c324881a7a644c7dbe342969efce37eb0a189b92 | refs/heads/main | 2023-02-24T03:52:13.782997 | 2021-02-04T08:55:55 | 2021-02-04T08:55:55 | 328,151,926 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,432 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* help_functions2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: blaine <blaine@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/29 15:36:38 by blaine #+# #+# */
/* Updated: 2020/01/29 18:31:22 by blaine ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_des(int *len, int *prec, long double *nb, long double num)
{
if ((*len - 1) < *prec)
{
if (num > (long double)-1 && num < (long double)1)
*len = *prec + 2;
else
*len += *prec - 1;
}
if (*nb > (long double)18446744073709551615.0)
{
num = (num < 0) ? -num : num;
*len = *prec + 1 + ft_f_count((unsigned long long)num);
}
(*nb == 0.500000) ? *len = *prec + 2 : 1;
((*len - 1) == *prec) ? *len += 1 : 1;
(*prec == 0) ? *len -= 1 : 1;
}
char *ft_ftoa(long double num, int prec)
{
long double nb;
char *str;
int len;
int neg;
neg = (num < 0) ? 1 : 0;
nb = (num < 0) ? -num : num;
prec = (prec == -1) ? 6 : prec;
nb = ft_change_prec(prec, nb);
nb += 0.5000000;
len = ft_f_count((unsigned long long)nb) + 1;
ft_des(&len, &prec, &nb, num);
if (!(str = (char *)ft_strnew(len + neg)))
return (NULL);
while ((len-- + neg > 0))
{
str[len + neg] = (((unsigned long long)nb % 10) + 48);
(--prec == 0 && len > neg) ? str[--len + neg] = '.' : 1;
nb /= 10;
}
neg == 1 ? str[0] = '-' : 1;
return (str);
}
void ft_putnstr(t_stf *stf, int i, int n)
{
stf->printed += n;
write(1, stf->str + i, n);
}
void ft_putunbr(unsigned long long n)
{
char str[20];
int z;
unsigned long long num;
z = n < 0 ? 2 : 1;
num = n < 0 ? -n : n;
str[0] = z == 2 ? '-' : 1;
while (((n > 0) || (n < 0)) && (n = n < 0 ? ((n * -1) / 10) : (n / 10)))
z++;
str[z] = '\0';
while ((str[0] == '-' ? z > 1 : z > 0) && (str[--z] = ((num % 10) + 48)))
num /= 10;
ft_putstr(str);
}
| [
"benjaminlaine@hotmail.com"
] | benjaminlaine@hotmail.com |
6035cafa88364518e5bca3786ea93973a01d3c33 | b6f243f2350fc859980946a33c794bd75cdbc953 | /src/audio/opus-1.2.1/warped_autocorrelation_FIX.c | 30ed61581518875b6a2b43e41b0da1ea274d553b | [] | no_license | ubicore/nrf52_audio_opus_sgtl5000 | 83b8ea3bc4b33567d2b0c164e0121af3e0a80037 | dd7d363e0aff573b7e005ed0cab36c1426fb869f | refs/heads/master | 2020-05-04T00:31:41.330571 | 2019-04-01T16:43:24 | 2019-04-01T16:43:24 | 178,886,385 | 9 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,746 | c | /***********************************************************************
Copyright (c) 2006-2011, Skype Limited. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "main_FIX.h"
#if defined(MIPSr1_ASM)
#include "mips/warped_autocorrelation_FIX_mipsr1.h"
#endif
/* Autocorrelations for a warped frequency axis */
void silk_warped_autocorrelation_FIX_c(
opus_int32 *corr, /* O Result [order + 1] */
opus_int *scale, /* O Scaling of the correlation vector */
const opus_int16 *input, /* I Input data to correlate */
const opus_int warping_Q16, /* I Warping coefficient */
const opus_int length, /* I Length of input */
const opus_int order /* I Correlation order (even) */
)
{
opus_int n, i, lsh;
opus_int32 tmp1_QS, tmp2_QS;
opus_int32 state_QS[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 };
opus_int64 corr_QC[ MAX_SHAPE_LPC_ORDER + 1 ] = { 0 };
/* Order must be even */
silk_assert( ( order & 1 ) == 0 );
silk_assert( 2 * QS - QC >= 0 );
/* Loop over samples */
for( n = 0; n < length; n++ ) {
tmp1_QS = silk_LSHIFT32( (opus_int32)input[ n ], QS );
/* Loop over allpass sections */
for( i = 0; i < order; i += 2 ) {
/* Output of allpass section */
tmp2_QS = silk_SMLAWB( state_QS[ i ], state_QS[ i + 1 ] - tmp1_QS, warping_Q16 );
state_QS[ i ] = tmp1_QS;
corr_QC[ i ] += silk_RSHIFT64( silk_SMULL( tmp1_QS, state_QS[ 0 ] ), 2 * QS - QC );
/* Output of allpass section */
tmp1_QS = silk_SMLAWB( state_QS[ i + 1 ], state_QS[ i + 2 ] - tmp2_QS, warping_Q16 );
state_QS[ i + 1 ] = tmp2_QS;
corr_QC[ i + 1 ] += silk_RSHIFT64( silk_SMULL( tmp2_QS, state_QS[ 0 ] ), 2 * QS - QC );
}
state_QS[ order ] = tmp1_QS;
corr_QC[ order ] += silk_RSHIFT64( silk_SMULL( tmp1_QS, state_QS[ 0 ] ), 2 * QS - QC );
}
lsh = silk_CLZ64( corr_QC[ 0 ] ) - 35;
lsh = silk_LIMIT( lsh, -12 - QC, 30 - QC );
*scale = -( QC + lsh );
silk_assert( *scale >= -30 && *scale <= 12 );
if( lsh >= 0 ) {
for( i = 0; i < order + 1; i++ ) {
corr[ i ] = (opus_int32)silk_CHECK_FIT32( silk_LSHIFT64( corr_QC[ i ], lsh ) );
}
} else {
for( i = 0; i < order + 1; i++ ) {
corr[ i ] = (opus_int32)silk_CHECK_FIT32( silk_RSHIFT64( corr_QC[ i ], -lsh ) );
}
}
silk_assert( corr_QC[ 0 ] >= 0 ); /* If breaking, decrease QC*/
}
| [
"nicolas.lantz@ubicore.net"
] | nicolas.lantz@ubicore.net |
b4b50e5c43c975540144d0ce9d857e9991ad805d | f7f0e3e5a2938997ea417c79436e2813a47951d1 | /Pods/Headers/Private/MBDataEnvironment/MBMLRegexFunctions.h | 264c53e68d8f2674bc97cfee9dddd3a0face48d7 | [] | no_license | emaloney/Boilerplate | 1240fadd4f9e4a0fd51fdda44646dee6b5a53d3c | 07922d3a3c74c407d484e482c1c0ee015d5ae093 | refs/heads/master | 2021-01-16T21:46:28.795685 | 2016-12-13T15:20:40 | 2016-12-13T15:20:40 | 38,087,473 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 77 | h | ../../../MBDataEnvironment/Code/Functions/Implementation/MBMLRegexFunctions.h | [
"emaloney@gilt.com"
] | emaloney@gilt.com |
1d13319c0abacec7a7884e288d607b1f790a4d41 | 7e07ea939d0717c416b1306258e519b94fb53efb | /main_strncmp.c | d5d4fd111930eaae249ca77458a0bd993fb41c92 | [] | no_license | mduma123/Main-Programs_libft | 08fd73903a743c24cf5899b9a404f3a9d308832f | c96cc621b6a024ea932e5a107c94989ff55e78f8 | refs/heads/master | 2020-06-06T10:52:52.541570 | 2019-06-24T11:06:19 | 2019-06-24T11:06:19 | 192,720,340 | 4 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,378 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mduma <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/06/12 16:17:20 by mduma #+# #+# */
/* Updated: 2019/06/12 16:23:00 by mduma ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libft.h"
//Compare two strings, up to a given length
//Returns < 0 s1 is less than s2 .0 s1 is equal to s2 .> 0s1 is greater than s2.
int main( void )
{
printf( "%d\n", ft_strncmp( "abcdef", "abcDEF", 10 ) );
printf( "%d\n", ft_strncmp( "abcdef", "abcDEF", 6 ) );
printf( "%d\n", ft_strncmp( "abcdef", "abcDEF", 3 ) );
printf( "%d\n", ft_strncmp( "abcdef", "abcDEF", 0 ) );
return (0);
}
| [
"mduma@c5r10s8.wethinkcode.co.za"
] | mduma@c5r10s8.wethinkcode.co.za |
7bdfdf6a3020153b749c760381267abf99310848 | c5cce7b6f031440198fa7462e581c48cf1cfd0ee | /NANE/src/NES/CPU/overload_macro.h | d2ebc81860e185fb91fa42376a158e7cbc90f2f8 | [] | no_license | BlueSquid1/NANE | 34516c9568c0543df96caccd1072912d5762ae91 | 5bdc8b6702bfcb05b0a6e50bf8bd72a479c4b9d9 | refs/heads/master | 2021-11-27T14:57:38.637314 | 2021-11-22T10:07:40 | 2021-11-22T10:07:40 | 229,574,914 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,210 | h | #pragma once
// Augmented from
// https://stackoverflow.com/a/26408195
#define EXPAND( x ) x
// get number of arguments with __NARG__
#define __NARG__(...) __NARG_I_(__VA_ARGS__,__RSEQ_N())
#define __NARG_I_(...) EXPAND(__ARG_N(__VA_ARGS__))
#define __ARG_N( \
_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,N,...) N
#define __RSEQ_N() \
63,62,61,60, \
59,58,57,56,55,54,53,52,51,50, \
49,48,47,46,45,44,43,42,41,40, \
39,38,37,36,35,34,33,32,31,30, \
29,28,27,26,25,24,23,22,21,20, \
19,18,17,16,15,14,13,12,11,10, \
9,8,7,6,5,4,3,2,1,0
// general definition for any function name
#define _VFUNC_(name, n) name##n
#define _VFUNC(name, n) _VFUNC_(name, n)
#define VFUNC(func, ...) _VFUNC(func, __NARG__(__VA_ARGS__)) (__VA_ARGS__)
// To define a function foo:
// #define FOO(...) VFUNC(FOO, __VA_ARGS__)
// #define FOO2(a) a
// #define FOO2(a,b) a + b
// #define FOO3(a,b,c) a + b + c
| [
"clinton.page123@gmail.com"
] | clinton.page123@gmail.com |
b094ca8edbfa69f6494619cb347abe2b450d3106 | d2c82245525562e94cc8658c42d2e0a8305b3979 | /week10/4.c | 81c3efae5415e835a3d4440e9085892a96e46885 | [] | no_license | sak-18/DSA-assignments | 3b06e7886cbfaf2ed25bbf9fc6903932964dee9a | bcb3b2d5d74bf351d89445ee0b7eb28a31d1e9cf | refs/heads/master | 2020-06-12T21:46:31.314588 | 2019-06-29T18:30:24 | 2019-06-29T18:30:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 575 | c | #include<stdio.h>
int size;
int check(int index,int heap[size])
{
int child=index*2;
if(child+1<=size && heap[index]<heap[child] && heap[index]<heap[child+1])
{
return (check(child,heap) && check(child+1,heap));
}
else if(child==size && heap[index]<heap[child])
{
return 1;
}
else if(child>size)
{
return 1;
}
return 0;
}
int main()
{
scanf("%d",&size);
int heap[size+1];
heap[0]=-99999;
for(int i=1;i<size+1;i++)
scanf("%d",&heap[i]);
if( check(1,heap) )
{
printf("\nYes\n");
}
else
{
printf("\nNo\n");
}
return 0;
}
| [
"saketh181199@gmail.com"
] | saketh181199@gmail.com |
c30c4a0db83a18aac98d5fa2c1f4c53594c607c6 | e369c7b16495b0d913f46a1a3e293d7ff5368d92 | /src/univalue/lib/univalue_escapes.h | 1c8b5dd372c32209bca39c2ffabe27ce58f8a4a3 | [
"MIT"
] | permissive | giracoin/girauno | be459789d8e00e424f4a6b881b27008479ab3276 | cee08e12174831a08967c6764f612ba73cf0d7e8 | refs/heads/master | 2020-03-17T06:19:37.157684 | 2018-05-14T11:34:54 | 2018-05-14T11:34:54 | 133,350,681 | 3 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,165 | h | // Automatically generated file. Do not modify.
#ifndef GIRACOIN_UNIVALUE_UNIVALUE_ESCAPES_H
#define GIRACOIN_UNIVALUE_UNIVALUE_ESCAPES_H
static const char *escapes[256] = {
"\\u0000",
"\\u0001",
"\\u0002",
"\\u0003",
"\\u0004",
"\\u0005",
"\\u0006",
"\\u0007",
"\\b",
"\\t",
"\\n",
"\\u000b",
"\\f",
"\\r",
"\\u000e",
"\\u000f",
"\\u0010",
"\\u0011",
"\\u0012",
"\\u0013",
"\\u0014",
"\\u0015",
"\\u0016",
"\\u0017",
"\\u0018",
"\\u0019",
"\\u001a",
"\\u001b",
"\\u001c",
"\\u001d",
"\\u001e",
"\\u001f",
NULL,
NULL,
"\\\"",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"\\\\",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"\\u007f",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
#endif // GIRACOIN_UNIVALUE_UNIVALUE_ESCAPES_H
| [
"info@giracoin.com"
] | info@giracoin.com |
a56523d691f882861f8034e7160307fc7fd860c8 | 409e10d2e57f7a3ee7c5a8c03320df0cef990d39 | /移动距离/src/移动距离.c | d04b23b232c8dd43f24087e8327bc68b233dff6c | [] | no_license | asdlei99/SomeOjCode-CXX | 7f437ed041ee984d5abd7b10b0d433f4b759b99c | bc7253f8534184fac748f28f9c93ecbb09e0906f | refs/heads/master | 2021-06-13T17:24:07.097452 | 2017-04-03T11:48:17 | 2017-04-03T11:48:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 870 | c | /*
============================================================================
Name : 移动距离.c
Author :
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#define N 100
int main(void) {
int n, a, b;
scanf("%d%d%d", &n, &a, &b);
int arr[N / n][n];
for (int i = 0; i < N / n; i++) {
for (int j = 0; j < n; j++) {
if (i % 2 == 0)
arr[i][j] = i * n + j + 1;
else
arr[i][j] = (i + 1) * n - j;
}
}
int x1, y1, x2, y2;
for (int i = 0; i < N / n; i++) {
for (int j = 0; j < n; j++) {
if (a == arr[i][j]) {
x1 = i;
y1 = j;
}
if (b == arr[i][j]) {
x2 = i;
y2 = j;
}
}
}
printf("%d",abs(x2-x1)+abs(y2-y1));
return EXIT_SUCCESS;
}
| [
"imqqyangfan@gmail.com"
] | imqqyangfan@gmail.com |
5c0e9080894923a5ba84036b28af5ba33bf042be | 65bf3ac6edd22aa104bc6576d05f6f39e9a14bc0 | /runcodes/binary_tree/bt.c | 7984998fb837eb553a290540ed7661e3ccfdfe1d | [] | no_license | LuisFelipeJorge/Algoritmos-Estruturas_de_Dados | de812bfe27969b2dcbec6a82bb466c3596db0fd9 | a24eb7c3a55a65d7902f82c00af2bda1249d5eb1 | refs/heads/main | 2023-02-04T19:04:02.457188 | 2020-12-29T17:16:14 | 2020-12-29T17:16:14 | 324,878,798 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,176 | c | #include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "bt.h"
struct tnode
{
elem info;
tnode_t *left,*right;
};
tnode_t* create_tnode(elem x)
{
tnode_t *new_node = (tnode_t*)malloc(sizeof(tnode_t));
assert(new_node != NULL);
new_node->info = x;
new_node->left = NULL;
new_node->right = NULL;
return new_node;
}
tree_t* create_tree()
{
tree_t *new_tree = (tree_t*)malloc(sizeof(tree_t));
assert(new_tree != NULL);
new_tree->root = NULL;
return new_tree;
}
int tree_is_empty(tree_t *tree)
{
assert(tree != NULL);
if (tree->root == NULL) return 1;
return 0;
}
void free_tree(tnode_t *root)
{
if (root != NULL)
{
free_tree(root->left);
free_tree(root->right);
free(root);
}
}
int insert_left(tree_t *t, elem x, elem parent)
{
tnode_t *new_node = create_tnode(x);
if(parent == -1)
{
if (tree_is_empty(t)) t->root = new_node;
else
{
free(new_node);
return 0;
}
}else
{
tnode_t *parent_node = search_elem(t->root, parent);
if (parent_node != NULL && parent_node->left == NULL)
{
parent_node->left = new_node;
}else
{
free(new_node);
return 0;
}
}
return 1;
}
int insert_right(tree_t *t, elem x, elem parent)
{
tnode_t *new_node = create_tnode(x);
if(parent == -1)
{
if (tree_is_empty(t)) t->root = new_node;
else
{
free(new_node);
return 0;
}
}else
{
tnode_t *parent_node = search_elem(t->root, parent);
if (parent_node != NULL && parent_node->right == NULL)
{
parent_node->right = new_node;
}else
{
free(new_node);
return 0;
}
}
return 1;
}
tnode_t* search_elem(tnode_t *root, elem x)
{
if (root == NULL) return NULL;
if(root->info == x) return root;
tnode_t *current_node = search_elem(root->left, x);
if (current_node == NULL) current_node = search_elem(root->right, x);
return current_node;
}
int get_height(tnode_t *root)
{
if (root == NULL) return 0;
int left_height = 1 + get_height(root->left);
int right_height = 1 + get_height(root->right);
return (left_height>right_height)?left_height:right_height;
}
int get_grade(tnode_t *root)
{
int count = 0;
if(root->left != NULL) count++;
if(root->right != NULL) count++;
return count;
}
char* get_type(tnode_t *root, int parent)
{
char *type = (char*)malloc(sizeof(char)*10);
if (parent == -1) strcpy(type, "raiz");
else if (root->left == NULL && root->right == NULL) strcpy(type, "folha");
else strcpy(type, "interno");
return type;
}
void print_tree(tnode_t *root, int parent)
{
if (root == NULL) return;
char *t = get_type(root, parent);
int left, right;
left = right = -1;
if (root->left != NULL) left = root->left->info;
if (root->right != NULL) right = root->right->info;
printf("no %d: ", root->info);
printf("pai = %d, ", parent);
printf("altura = %d, ", get_height(root));
printf("grau = %d, ", get_grade(root));
printf("filhos = (%d,%d), ", left, right);
printf("tipo = %s\n", t);
free(t);
print_tree(root->left, root->info);
print_tree(root->right, root->info);
} | [
"luisfelipe.jorge123@gmail.com"
] | luisfelipe.jorge123@gmail.com |
872c6f5c25bfa463f7ff174bac4321c79b57bb47 | cb44d748dc4074a4979019a3cadfa7fde337a0b3 | /socket_inet_netof.c | 77480986e21029faddc8297d779ce6dbde30dbf5 | [] | no_license | sba1/clib2 | dbb42f0875d510cfd9b92ab890855cfc2277519f | f1db9d75872d2618100961b9f000410f25a430ce | refs/heads/master | 2020-05-25T11:45:19.923616 | 2015-04-03T17:54:40 | 2015-04-03T17:54:40 | 32,605,450 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,120 | c | /*
* $Id$
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of Olaf Barthel nor the names of contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(SOCKET_SUPPORT)
/****************************************************************************/
#ifndef _SOCKET_HEADERS_H
#include "socket_headers.h"
#endif /* _SOCKET_HEADERS_H */
/****************************************************************************/
in_addr_t
inet_netof(struct in_addr in)
{
in_addr_t result;
ENTER();
assert(__SocketBase != NULL);
PROFILE_OFF();
result = __Inet_NetOf(in.s_addr);
PROFILE_ON();
if(__check_abort_enabled)
__check_abort();
RETURN(result);
return(result);
}
/****************************************************************************/
#endif /* SOCKET_SUPPORT */
| [
"obarthel"
] | obarthel |
8b06bfef28bf3b4e6db115183151b5a0aa28bd2f | 3c3be69e95cecedb3cea2f727fa407d325a913dd | /labs/lab4/averageProfit_6.c | c33041851bfbe8dc4e485b1eeb4bedc1f8e34978 | [] | no_license | fanfan-cse-cources/cse-2421 | cc2d3fbbbd002f37532e2ed497e331d6ca151b3b | e1258944d1dc3404dcc8640de7512436fea2f144 | refs/heads/master | 2023-03-16T08:03:03.390790 | 2020-05-16T03:25:26 | 2020-05-16T03:25:26 | 233,189,160 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,070 | c | /*
BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I HAVE STRICTLY ADHERED TO THE
TENURES OF THE OHIO STATE UNIVERSITY’S ACADEMIC INTEGRITY POLICY WITH RESPECT TO
THIS ASSIGNMENT.
*/
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
/* Author: Yifan Yao.740 */
#include "lab4.h"
void averageProfit_6(Node **list_head_ptr) {
float averageProfit = 0.0;
float totalProfit = 0.0;
int totalGroceryItemsSold = 0;
Node *n = *list_head_ptr;
while (n != NULL) {
/*
RECALCULATED PROFIT
totalProfit = retailQuantity * (retailPrice - wholesalePrice)
*/
totalProfit += (n -> grocery_item.pricing.retailQuantity) *
((n -> grocery_item.pricing.retailPrice) -
(n -> grocery_item.pricing.wholesalePrice));
totalGroceryItemsSold += (n -> grocery_item.pricing.retailQuantity);
n = n -> next;
}
averageProfit = totalProfit / totalGroceryItemsSold;
setlocale(LC_NUMERIC,"");
printf("Average Profit: $%'.2f\n", averageProfit);
} | [
"fanfannnmn@gmail.com"
] | fanfannnmn@gmail.com |
3f0210bc5ceae8833b3cee35a477f46884e617bb | ba4959e109ff0257444c036802f1ac1c360f7d95 | /kent/src/hg/lib/jalview.c | ba1a1d1790062beb8b6923f510145848bcc085dc | [
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | hillerlab/CESAR2.0 | 7d98c705259ee3e1e6bb3dc58fb3571435816cdf | 84b5fc739523c5407bb23e4ead1c5af778fec587 | refs/heads/master | 2022-12-12T12:10:49.874628 | 2022-12-01T08:19:12 | 2022-12-01T08:19:12 | 86,730,515 | 29 | 13 | MIT | 2020-11-20T11:49:20 | 2017-03-30T17:34:11 | C | UTF-8 | C | false | false | 2,342 | c | /* display multiple alignment using jalview */
/* Copyright (C) 2014 The Regents of the University of California
* See README in this or parent directory for licensing information. */
#include "common.h"
#include "portable.h"
void displayJalView(char *inUrl, char *type, char *optional)
{
//char *host = getenv("HTTP_HOST");
printf("<applet code=\"jalview.bin.JalviewLite\"\n");
printf(" width=\"140\"");
printf(" height=\"35\"");
printf(" archive=\"/pseudogene/jalviewApplet.jar\">\n");
printf("<param name=\"file\" value=\"%s\">\n", inUrl);
//printf("<param name=\"file\" value=\"http://%s/%s\">\n", host, inUrl);
printf("<param name=\"defaultColour\" value=\"%% Identity\">\n");
printf("<param name=\"showAnnotation\" value=\"false\">\n");
printf("<param name=\"wrap\" value=\"true\">\n");
printf("<param name=\"sortBy\" value=\"Pairwise Identity\">\n");
printf("<param name=\"type\" value=\"URL\">\n");
printf("<param name=\"format\" value=\"%s\">\n", type);
if (optional != NULL)
printf("%s\n",optional);
#ifdef GROUP
printf("<param name=\"groups\" value=\"1\">");
printf("<param name=\"group1\" value=\"1-99:PID:false:false:false\">");
printf("jalview");
#endif
printf("</APPLET>\n");
#ifdef samplejalview
<applet code="jalview.bin.JalviewLite" width="140" height="35" archive="jalviewApplet.jar">
<param name="file" value="uniref50.fa">
<param name="defaultColour" value="Blosum62">
<param name="RGB" value="F2F2FF">
<param name="linkLabel_1" value="SRS">
<param name="linkUrl_1" value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
<param name="linkLabel_2" value="Uniprot">
<param name="linkUrl_2" value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
</applet>
#endif
#ifdef OBJECT
printf("\n<OBJECT ");
printf(" classid=\"jalview.ButtonAlignApplet.class\"\n");
printf(" codetype=\"application/java\"\n");
printf(" codebase=\"pseudogene/\"\n");
printf(" code=\"jalview.ButtonAlignApplet.class\"\n");
printf(" width=\"100\"");
printf(" height=\"35\"");
printf(">\n");
printf("<param name=\"input\" value=\"http://%s/%s\">\n", host, inUrl);
printf("<param name=\"type\" value=\"URL\">\n");
printf("<param name=\"format\" value=\"%s\">\n", type);
printf("<PARAM name=fontsize value=\"14\">\n");
if (optional != NULL)
printf("%s\n",optional);
printf("</OBJECT>\n");
#endif
}
| [
"hiller@mpi-cbg.de"
] | hiller@mpi-cbg.de |
6ea162c9a2f7bdc3dcb958629cf9f01b5ffe325a | 517848af126ed8f198b890a07a6bc5b7b1b94683 | /sys/dev/siba/siba_pcib.c | d43f54c9c0a4361ce230fe4b8aebd9f58f59432f | [] | no_license | coolgoose85/FreeBSD | e9dbd33b95bf0a472a3e291451c273054b843a1f | ef72c1183400fd106d838c8ed0702649bc1b1b4e | refs/heads/master | 2021-01-15T22:29:25.584742 | 2014-08-03T17:32:40 | 2014-08-03T17:32:40 | 22,535,409 | 2 | 1 | null | null | null | null | UTF-8 | C | false | false | 11,838 | c | /*-
* Copyright (c) 2007 Bruce M. Simpson.
* 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 AUTHOR 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 AUTHOR 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.
*/
/*
* Child driver for PCI host bridge core.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/malloc.h>
#include <sys/endian.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/pcb.h>
#include <machine/pmap.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcib_private.h>
#include "pcib_if.h"
#include <dev/siba/sibavar.h>
#include <dev/siba/sibareg.h>
#include <dev/siba/siba_ids.h>
#include <dev/siba/siba_pcibvar.h>
#ifndef MIPS_MEM_RID
#define MIPS_MEM_RID 0x20
#endif
#define SBPCI_SLOTMAX 15
#define SBPCI_READ_4(sc, reg) \
bus_space_write_4((sc)->sc_bt, (sc)->sc_bh, (reg))
#define SBPCI_WRITE_4(sc, reg, val) \
bus_space_write_4((sc)->sc_bt, (sc)->sc_bh, (reg), (val))
/*
* PCI Configuration space window (64MB).
* contained in SBTOPCI1 window.
*/
#define SBPCI_CFGBASE 0x0C000000
#define SBPCI_CFGSIZE 0x01000000
#define SBPCI_SBTOPCI0 0x100
#define SBPCI_SBTOPCI1 0x104
#define SBPCI_SBTOPCI2 0x108
/*
* TODO: implement type 1 config space access (ie beyond bus 0)
* we may need to tweak the windows to do this
* TODO: interrupt routing.
* TODO: fully implement bus allocation.
* TODO: implement resource managers.
* TODO: code cleanup.
*/
static int siba_pcib_activate_resource(device_t, device_t, int,
int, struct resource *);
static struct resource *
siba_pcib_alloc_resource(device_t, device_t, int, int *,
u_long , u_long, u_long, u_int);
static int siba_pcib_attach(device_t);
static int siba_pcib_deactivate_resource(device_t, device_t, int,
int, struct resource *);
static int siba_pcib_maxslots(device_t);
static int siba_pcib_probe(device_t);
static u_int32_t
siba_pcib_read_config(device_t, u_int, u_int, u_int, u_int,
int);
static int siba_pcib_read_ivar(device_t, device_t, int, uintptr_t *);
static int siba_pcib_release_resource(device_t, device_t, int, int,
struct resource *);
static int siba_pcib_route_interrupt(device_t, device_t, int);
static int siba_pcib_setup_intr(device_t, device_t, struct resource *,
int, driver_filter_t *, driver_intr_t *, void *, void **);
static int siba_pcib_teardown_intr(device_t, device_t, struct resource *,
void *);
static void siba_pcib_write_config(device_t, u_int, u_int, u_int, u_int,
u_int32_t, int);
static int siba_pcib_write_ivar(device_t, device_t, int, uintptr_t);
static int
siba_pcib_probe(device_t dev)
{
/* TODO: support earlier cores. */
/* TODO: Check if PCI host mode is enabled in the SPROM. */
if (siba_get_vendor(dev) == SIBA_VID_BROADCOM &&
siba_get_device(dev) == SIBA_DEVID_PCI) {
device_set_desc(dev, "SiBa-to-PCI host bridge");
return (BUS_PROBE_DEFAULT);
}
return (ENXIO);
}
//extern int rman_debug;
static int
siba_pcib_attach(device_t dev)
{
struct siba_pcib_softc *sc = device_get_softc(dev);
int rid;
/*
* Allocate the resources which the parent bus has already
* determined for us.
*/
rid = MIPS_MEM_RID; /* XXX */
//rman_debug = 1;
sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
RF_ACTIVE);
if (sc->sc_mem == NULL) {
device_printf(dev, "unable to allocate memory\n");
return (ENXIO);
}
sc->sc_bt = rman_get_bustag(sc->sc_mem);
sc->sc_bh = rman_get_bushandle(sc->sc_mem);
device_printf(dev, "bridge registers addr 0x%08x vaddr %p\n",
(uint32_t)sc->sc_bh, rman_get_virtual(sc->sc_mem));
SBPCI_WRITE_4(sc, 0x0000, 0x05);
SBPCI_WRITE_4(sc, 0x0000, 0x0D);
DELAY(150);
SBPCI_WRITE_4(sc, 0x0000, 0x0F);
SBPCI_WRITE_4(sc, 0x0010, 0x01);
DELAY(1);
bus_space_handle_t sc_cfg_hand;
int error;
/*
* XXX this doesn't actually do anything on mips; however... should
* we not be mapping to KSEG1? we need to wire down the range.
*/
error = bus_space_map(sc->sc_bt, SBPCI_CFGBASE, SBPCI_CFGSIZE,
0, &sc_cfg_hand);
if (error) {
device_printf(dev, "cannot map PCI configuration space\n");
return (ENXIO);
}
device_printf(dev, "mapped pci config space at 0x%08x\n",
(uint32_t)sc_cfg_hand);
/*
* Setup configuration, io, and dma space windows.
* XXX we need to be able to do type 1 too.
* we probably don't need to be able to do i/o cycles.
*/
SBPCI_WRITE_4(sc, SBPCI_SBTOPCI0, 1); /* I/O read/write window */
SBPCI_WRITE_4(sc, SBPCI_SBTOPCI1, 2); /* type 0 configuration only */
SBPCI_WRITE_4(sc, SBPCI_SBTOPCI2, 1 << 30); /* memory only */
DELAY(500);
/* XXX resource managers */
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
}
/* bus functions */
static int
siba_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
{
struct siba_pcib_softc *sc;
sc = device_get_softc(dev);
switch (which) {
case PCIB_IVAR_BUS:
*result = sc->sc_bus;
return (0);
}
return (ENOENT);
}
static int
siba_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
{
struct siba_pcib_softc *sc;
sc = device_get_softc(dev);
switch (which) {
case PCIB_IVAR_BUS:
sc->sc_bus = value;
return (0);
}
return (ENOENT);
}
static int
siba_pcib_setup_intr(device_t dev, device_t child, struct resource *ires,
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
void **cookiep)
{
return (BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags,
filt, intr, arg, cookiep));
}
static int
siba_pcib_teardown_intr(device_t dev, device_t child, struct resource *vec,
void *cookie)
{
return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, vec, cookie));
}
static struct resource *
siba_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
{
#if 1
//device_printf(bus, "%s: not yet implemented\n", __func__);
return (NULL);
#else
bus_space_tag_t tag;
struct siba_pcib_softc *sc = device_get_softc(bus);
struct rman *rmanp;
struct resource *rv;
tag = 0;
rv = NULL;
switch (type) {
case SYS_RES_IRQ:
rmanp = &sc->sc_irq_rman;
break;
case SYS_RES_MEMORY:
rmanp = &sc->sc_mem_rman;
tag = &sc->sc_pci_memt;
break;
default:
return (rv);
}
rv = rman_reserve_resource(rmanp, start, end, count, flags, child);
if (rv != NULL) {
rman_set_rid(rv, *rid);
if (type == SYS_RES_MEMORY) {
#if 0
rman_set_bustag(rv, tag);
rman_set_bushandle(rv, rman_get_bushandle(sc->sc_mem) +
(rman_get_start(rv) - IXP425_PCI_MEM_HWBASE));
#endif
}
}
return (rv);
#endif
}
static int
siba_pcib_activate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
device_printf(bus, "%s: not yet implemented\n", __func__);
device_printf(bus, "%s called activate_resource\n",
device_get_nameunit(child));
return (ENXIO);
}
static int
siba_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
device_printf(bus, "%s: not yet implemented\n", __func__);
device_printf(bus, "%s called deactivate_resource\n",
device_get_nameunit(child));
return (ENXIO);
}
static int
siba_pcib_release_resource(device_t bus, device_t child, int type, int rid,
struct resource *r)
{
device_printf(bus, "%s: not yet implemented\n", __func__);
device_printf(bus, "%s called release_resource\n",
device_get_nameunit(child));
return (ENXIO);
}
/* pcib interface functions */
static int
siba_pcib_maxslots(device_t dev)
{
return (SBPCI_SLOTMAX);
}
/*
* This needs hacking and fixery. It is currently broke and hangs.
* Debugging it will be tricky; there seems to be no way to enable
* a target abort which would cause a nice target abort.
* Look at linux again?
*/
static u_int32_t
siba_pcib_read_config(device_t dev, u_int bus, u_int slot, u_int func,
u_int reg, int bytes)
{
struct siba_pcib_softc *sc = device_get_softc(dev);
bus_addr_t cfgaddr;
uint32_t cfgtag;
uint32_t val;
/* XXX anything higher than slot 2 currently seems to hang the bus.
* not sure why this is; look at linux again
*/
if (bus != 0 || slot > 2) {
printf("%s: bad b/s/f %d/%d/%d\n", __func__, bus, slot, func);
return 0xffffffff; // XXX
}
device_printf(dev, "requested %d bytes from b/s/f %d/%d/%d reg %d\n",
bytes, bus, slot, func, reg);
/*
* The configuration tag on the broadcom is weird.
*/
SBPCI_WRITE_4(sc, SBPCI_SBTOPCI1, 2); /* XXX again??? */
cfgtag = ((1 << slot) << 16) | (func << 8);
cfgaddr = SBPCI_CFGBASE | cfgtag | (reg & ~3);
/* cfg space i/o is always 32 bits on this bridge */
printf("reading 4 bytes from %08x\n", cfgaddr);
val = *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(cfgaddr); /* XXX MIPS */
val = bswap32(val); /* XXX seems to be needed for now */
/* swizzle and return what was asked for */
val &= 0xffffffff >> ((4 - bytes) * 8);
return (val);
}
static void
siba_pcib_write_config(device_t dev, u_int bus, u_int slot,
u_int func, u_int reg, u_int32_t val, int bytes)
{
/* write to pci configuration space */
//device_printf(dev, "%s: not yet implemented\n", __func__);
}
static int
siba_pcib_route_interrupt(device_t bridge, device_t device, int pin)
{
//device_printf(bridge, "%s: not yet implemented\n", __func__);
return (-1);
}
static device_method_t siba_pcib_methods[] = {
/* Device interface */
DEVMETHOD(device_attach, siba_pcib_attach),
DEVMETHOD(device_probe, siba_pcib_probe),
/* Bus interface */
DEVMETHOD(bus_print_child, bus_generic_print_child),
DEVMETHOD(bus_read_ivar, siba_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, siba_pcib_write_ivar),
DEVMETHOD(bus_setup_intr, siba_pcib_setup_intr),
DEVMETHOD(bus_teardown_intr, siba_pcib_teardown_intr),
DEVMETHOD(bus_alloc_resource, siba_pcib_alloc_resource),
DEVMETHOD(bus_activate_resource, siba_pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, siba_pcib_deactivate_resource),
DEVMETHOD(bus_release_resource, siba_pcib_release_resource),
/* pcib interface */
DEVMETHOD(pcib_maxslots, siba_pcib_maxslots),
DEVMETHOD(pcib_read_config, siba_pcib_read_config),
DEVMETHOD(pcib_write_config, siba_pcib_write_config),
DEVMETHOD(pcib_route_interrupt, siba_pcib_route_interrupt),
{0, 0},
};
static driver_t siba_pcib_driver = {
"pcib",
siba_pcib_methods,
sizeof(struct siba_softc),
};
static devclass_t siba_pcib_devclass;
DRIVER_MODULE(siba_pcib, siba, siba_pcib_driver, siba_pcib_devclass, 0, 0);
| [
"vaibhav123@gmail.com"
] | vaibhav123@gmail.com |
367bb56df727c29178277ba213e1be509a61d57f | 579f280ee6fe00796cc3565cba635edfef0abfb6 | /alzamilb/dominion/cardtest3.c | 985c85b49b76e9516fa637e289bda60e65e149bf | [] | no_license | fahlmant/cs362 | 633bac35ba641797f1cc26edaa0713576d54ccd6 | 3af6b387129c5c9ba7a4b0159a20c7a09ed0c3f8 | refs/heads/master | 2020-04-30T17:20:29.717562 | 2015-06-10T10:27:53 | 2015-06-10T10:27:53 | 176,976,345 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,341 | c | /* Basil Alzamil
CS 362 - Assignment #2
April 21, 2015
*/
#include "assert.h"
#include "dominion.h"
#include <stdio.h>
#include "rngs.h"
#include <stdlib.h>
//Testing embargo()
int main (int argc, char** argv) {
int currentPlayer;
struct gameState G;
int choice3 = 0;
int handPos = 5;
int r;
int players = 2;
int bonus = 0;
int coins_before;
int coins_after;
int embargoTokens_before;
int embargoTokens_after;
int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, sea_hag, tribute, smithy};
r = initializeGame(players, k, 3, &G);
currentPlayer = whoseTurn(&G);
assert (r == 0);
//Test 1: returned value is zero
//Test 2: embargo suppose to add +2 coins: Checking G coins before and after
//Test 3: Checking emabargoTokens
coins_before = G.coins;
embargoTokens_before = G.embargoTokens[4]; //4 is choice1
r = cardEffect(embargo, copper, province, choice3, &G, handPos, &bonus);
assert(r == 0);
printf("Passed Test#1 successfully!\n");
coins_after = G.coins;
embargoTokens_after = G.embargoTokens[4];
assert(coins_after == coins_before+2);
printf("Passed Test#2 successfully!\n");
assert(embargoTokens_after == embargoTokens_before+1);
printf("Passed Test#3 successfully!\n");
return 0;
}
| [
"alzamilb@onid.oregonstate.edu"
] | alzamilb@onid.oregonstate.edu |
c5fe78fa6ff0a5410061f63200fdafb0a28005ac | 44eacd34a69672425d20ef8ddb982cd06b3b4c81 | /src/legacy/btchip_apdu_get_coin_version.c | 516f9b938028d343c2257aa411cd60e35c905042 | [] | no_license | Surfndez/app-bitcoin-new | c4695999fbb5d9c3928d9b6e3f61a88ffda44a5f | fc66d99d82a886e22ea32da7c150c34c00a16f78 | refs/heads/master | 2023-08-02T07:00:00.563492 | 2021-09-24T14:53:07 | 2021-09-24T14:53:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,182 | c | /*******************************************************************************
* Ledger App - Bitcoin Wallet
* (c) 2016-2019 Ledger
*
* 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.
********************************************************************************/
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <string.h>
#include "btchip_internal.h"
#include "btchip_apdu_constants.h"
#define P1_VERSION_ONLY 0x00
#define P1_VERSION_COINID 0x01
unsigned short btchip_apdu_get_coin_version() {
uint8_t offset = 0;
SB_CHECK(N_btchip.bkp.config.operationMode);
if ((SB_GET(N_btchip.bkp.config.operationMode) ==
BTCHIP_MODE_SETUP_NEEDED) ||
(SB_GET(N_btchip.bkp.config.operationMode) == BTCHIP_MODE_ISSUER)) {
return BTCHIP_SW_CONDITIONS_OF_USE_NOT_SATISFIED;
}
G_io_apdu_buffer[offset++] = G_coin_config->p2pkh_version >> 8;
G_io_apdu_buffer[offset++] = G_coin_config->p2pkh_version;
G_io_apdu_buffer[offset++] = G_coin_config->p2sh_version >> 8;
G_io_apdu_buffer[offset++] = G_coin_config->p2sh_version;
G_io_apdu_buffer[offset++] = G_coin_config->family;
G_io_apdu_buffer[offset++] = strlen(G_coin_config->coinid);
os_memmove(G_io_apdu_buffer + offset, G_coin_config->coinid,
strlen(G_coin_config->coinid));
offset += strlen(G_coin_config->coinid);
G_io_apdu_buffer[offset++] = strlen(G_coin_config->name_short);
os_memmove(G_io_apdu_buffer + offset, G_coin_config->name_short,
strlen(G_coin_config->name_short));
offset += strlen(G_coin_config->name_short);
btchip_context_D.outLength = offset;
return BTCHIP_SW_OK;
}
| [
"6681844+bigspider@users.noreply.github.com"
] | 6681844+bigspider@users.noreply.github.com |
ef4eb7f03d5d5290057a929b677f5a57104c48ec | 0c0dac0626aaadd561e250fb47eeede8312d5d82 | /sys/arch/octeon/include/timetc.h | 5cf2b5ff0152cc6b8b9214ac2f6056b90b9785a4 | [] | no_license | arekinath/openbsd-6.9-a3 | 5c25a287c481699a09c9c4630c5c773a38412e0a | 744a280e5e7d8e71664847a5d9a9693e80f7f5ec | refs/heads/main | 2023-08-19T04:33:48.119966 | 2021-10-05T02:07:50 | 2021-10-05T11:12:50 | 413,786,977 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 969 | h | /* $OpenBSD: timetc.h,v 1.1 2020/07/06 13:33:08 pirofti Exp $ */
/*
* Copyright (c) 2020 Paul Irofti <paul@irofti.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _MACHINE_TIMETC_H_
#define _MACHINE_TIMETC_H_
#include <mips64/timetc.h>
#endif /* _MACHINE_TIMETC_H_ */
| [
"alex@cooperi.net"
] | alex@cooperi.net |
afe853d8c954970c14ca17e4b66fa011f555d424 | c3bb88e81944625ea1cb9a23bbc23e209bdf100d | /lib/ble5stack/central/comdef.h | 0f079e014f0e788ff8ce0797161f7455bfc70cd1 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | BertLindeman/pybricks-micropython | 7a275366869bc4788e5337841aec2439c977da42 | 8f22a99551100e66ddf08d014d9f442f22b33b4d | refs/heads/master | 2023-04-11T00:44:21.911227 | 2021-04-12T19:45:23 | 2021-04-12T19:45:23 | 358,292,780 | 0 | 0 | MIT | 2021-04-15T15:24:23 | 2021-04-15T14:41:40 | null | UTF-8 | C | false | false | 5,069 | h | ///******************************************************************************
//
// Group: WCS, LPC, BTS
// Target Device: cc13x2_26x2
//
// ******************************************************************************
//
// Copyright (c) 2004-2019, Texas Instruments Incorporated
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ******************************************************************************
//
//
// *****************************************************************************/
//
///**
// * @file comdef.h
// * @brief Common Defines
// */
//
//#ifndef COMDEF_H
//#define COMDEF_H
//
//#ifdef __cplusplus
//extern "C"
//{
//#endif
//
//
///*********************************************************************
// * INCLUDES
// */
//
///* HAL */
////#include "hal_types.h"
////#include "hal_defs.h"
//
///// @cond NODOC
//
///*********************************************************************
// * Lint Keywords
// */
////#define VOID (void)
////
////#define NULL_OK
////#define INP
////#define OUTP
////#define UNUSED
////#define ONLY
////#define READONLY
////#define SHARED
////#define KEEP
////#define RELAX
//
///*********************************************************************
// * CONSTANTS
// */
//
//#ifndef false
// #define false 0
//#endif
//
//#ifndef true
// #define true 1
//#endif
//
//#ifndef CONST
// #define CONST const
//#endif
//
//#ifndef GENERIC
// #define GENERIC
//#endif
//
///// @endcond // NODOC
//
///*** Generic Status Return Values ***/
////#define bleSUCCESS 0x00 //!< bleSUCCESS
////#define bleFAILURE 0x01 //!< Failure
////#define INVALIDPARAMETER 0x02 //!< Invalid Parameter
////#define INVALID_TASK 0x03 //!< Invalid Task
////#define MSG_BUFFER_NOT_AVAIL 0x04 //!< No HCI Buffer is Available
////#define INVALID_MSG_POINTER 0x05 //!< Invalid Message Pointer
////#define INVALID_EVENT_ID 0x06 //!< Invalid Event ID
////#define INVALID_INTERRUPT_ID 0x07 //!< Invalid Interupt ID
////#define NO_TIMER_AVAIL 0x08 //!< No Timer Available
////#define NV_ITEM_UNINIT 0x09 //!< NV Item Uninitialized
////#define NV_OPER_FAILED 0x0A //!< NV Operation Failed
////#define INVALID_MEM_SIZE 0x0B //!< Invalid Memory Size
////#define NV_BAD_ITEM_LEN 0x0C //!< NV Bad Item Length
//
///*********************************************************************
// * TYPEDEFS
// */
//
///// @cond NODOC
//
//// Generic Status return
//typedef uint8_t Status_t;
//
///// @endcond // NODOC
//
///*********************************************************************
// * Global System Events
// */
//
//#define SYS_EVENT_MSG 0x8000 //!< A message is waiting event
//
///*********************************************************************
// * Global Generic System Messages
// */
//
//#define KEY_CHANGE 0xC0 //!< Key Events
//
//// OSAL System Message IDs/Events Reserved for applications (user applications)
//// 0xE0 - 0xFC
//
///*********************************************************************
// * MACROS
// */
//
///*********************************************************************
// * GLOBAL VARIABLES
// */
//
///*********************************************************************
// * FUNCTIONS
// */
//
///*********************************************************************
//*********************************************************************/
//
//#ifdef __cplusplus
//}
//#endif
//
//#endif /* COMDEF_H */
| [
"david@pybricks.com"
] | david@pybricks.com |
e5abb2fc9149b84f9790965fc2039d793bbd3693 | 4164af5834312ba308da26994f602d928d1cc137 | /Section 9/handout-TPM09-A/problem3.c | 87f3cee22c8902a66db2068d314c4b39a4ecca5f | [] | no_license | bwyogatama/Problem-Solving-with-C | 1cd5b8f3c85fdaf558376118a4d96d8a5104f7c1 | 334102dd287b977bdf898d8fa4924fb5d0c808dd | refs/heads/master | 2021-05-10T13:49:40.149201 | 2018-01-22T17:40:05 | 2018-01-22T17:40:05 | 118,490,018 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,862 | c | // Tugas Pendahuluan Praktikum EL2208 Pemecahan Masalah dengan C
// Modul : 9
// Percobaan : 3
// Tanggal : 26 Maret 2016
// Nama (NIM) : Bobbi Winema Yogatama (13214071)
// Nama File : problem3.c
// Deskripsi : program ini akan mengalikan dua buah matriks. Pertama tama User diminta untuk menginputkan orde kedua matriks untuk validasi proses perkalian
//Jika memungkinkan, barulah program ini akan meminta input dari user untuk mengisis tiap elemen matriks
//mengakses library
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
//Deklarasi Variable
int row1, row2, kol1,kol2,i,j,k;
int **M1; //deklarasi variabel untuk dynamic multidimensional array
int **M2; //deklarasi variabel untuk dynamic multidimensional array
int **Hasil; //deklarasi variabel untuk dynamic multidimensional array
//Input Orde Matriks
printf("Masukkan orde matriks pertama :\n");
scanf("%d %d",&row1,&kol1); //menerima input orde matriks pertama
printf("Masukkan orde matriks kedua :\n");
scanf("%d %d",&row2,&kol2); //menerima input orde matriks kedua
//Alokasi Memori
//Alokasi memori untuk baris ketiga matriks
M1 = (int**)calloc(row1,sizeof(int*));
M2 = (int**)calloc(row1,sizeof(int*));
Hasil = (int**)calloc(row1,sizeof(int*));
//Alokasi memori untuk kolom ketiga matriks dengan iterasi
for(i=0; i<row1; i++)
M1[i] = (int *)calloc(kol1,sizeof(int));
for(i=0; i<row2; i++)
M2[i] = (int *)calloc(kol2,sizeof(int));
for(i=0; i<row1; i++)
Hasil[i] = (int *)calloc(kol2,sizeof(int));
//Cek Orde Matriks
if (kol1!=row2) //kondisi apabila perkalian tidak dapat dilakukan
printf("Orde matriks yang dimasukkan salah!\n"); //memberi peringatan kepada user apabila orde matriks tidak valid
else //apabila orde matriks valid
{
//Input Nilai matriks pertama menggunakan iterasi
for (i=0;i<row1;i++)
{
for (j=0;j<kol1;j++)
{
printf("Masukkan elemen (%d, %d) dari matriks pertama :\n",i,j);
scanf("%d",&M1[i][j]); //menerima input elemen pada baris ke-i kolom ke-j
}
}
//Input Nilai matriks kedua
for (i=0;i<row2;i++)
{
for (j=0;j<kol2;j++)
{
printf("Masukkan elemen (%d, %d) dari matriks kedua :\n",i,j);
scanf("%d",&M2[i][j]);//menerima input elemen pada baris ke-i kolom ke-j
}
}
//Proses Perkalian Matriks
for (i=0;i<row1;i++)
{
for (j=0;j<kol2;j++)
{
Hasil[i][j] = 0; //inisialisasi matriks hasil perkalian
for (k=0;k<kol1;k++)
{
Hasil[i][j] = Hasil[i][j] + (M1[i][k]*M2[k][j]); //mengalikan Matriks A dan Matriks B
}
}
}
//Cetak Matriks Pertama
printf("Matriks pertama :\n");
for (i=0;i<row1;i++)
{
for (j=0;j<kol1;j++)
{
printf("%d\t",M1[i][j]); //mencetak elemen pada baris -i kolom -j
}
printf("\n"); //berpindah baris apabila semua elemen pada kolom -j sudah dicetak
}
//Cetak Matriks kedua
printf("Matriks kedua :\n");
for (i=0;i<row2;i++)
{
for (j=0;j<kol2;j++)
{
printf("%d\t",M2[i][j]);//mencetak elemen pada baris -i kolom -j
}
printf("\n");//berpindah baris apabila semua elemen pada kolom -j sudah dicetak
}
//Cetak Matriks hasil perkalian
printf("Hasil perkalian matriks :\n");
for (i=0;i<row1;i++)
{
for (j=0;j<kol2;j++)
{
printf("%d\t",Hasil[i][j]);//mencetak elemen pada baris -i kolom -j
}
printf("\n");//berpindah baris apabila semua elemen pada kolom -j sudah dicetak
}
}
//END of Program
return 0;
}
| [
"noreply@github.com"
] | bwyogatama.noreply@github.com |
32474aed5ccd3db330a745d0bf31c60353564c3a | 99e6cbf28bf7d7904d23cb644ac975cd8aef5792 | /C/funcao_argumentada.c | 2c551dcdaddeace65a088541301d2682d5c69b06 | [] | no_license | sr-ght/scripts | d0afe8af22493a92c345d062bac6702f0c12f288 | 210ef4615fb792f859e4739540d270460b6f173b | refs/heads/master | 2023-06-25T08:40:56.613763 | 2021-07-30T12:23:26 | 2021-07-30T12:23:26 | 384,148,723 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 173 | c | #include <stdio.h>
// Função argumentada
int arg(int x, int y){
printf("%i em funcao de %i", y, x);
}
void main(){
int x = 10;
int y = 5;
arg(x, y);
} | [
"sr.ght@protonmail.ch"
] | sr.ght@protonmail.ch |
56d59f7a24c21bfa9482c5381203f92b49776ffa | aced0b0b4b73ecb9837500a9b65eb039033e94d3 | /Win10_1511_TS2/x64/System32/hal.dll/ALL_SORTED.h | e7faf7a4bbc814dd7a71ba6d568333f4373508a0 | [] | no_license | Qazwar/headers | a16193b7343f8497c4dde1f0eb6fee52a0ed91e1 | 049e8a564a1f82a8316f187f8a8bbcdb29be5e01 | refs/heads/master | 2020-04-05T15:36:20.462296 | 2018-11-08T18:53:40 | 2018-11-08T20:37:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 164,009 | h | enum BUS_QUERY_ID_TYPE;
enum DEVICE_TEXT_TYPE;
struct LIST_ENTRY32;
struct LIST_ENTRY64;
struct POHANDLE__;
enum POWER_ACTION;
struct _ACCESS_STATE;
struct _ACPI_CACHED_TABLE;
struct _CM_FULL_RESOURCE_DESCRIPTOR;
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR;
struct _CM_PARTIAL_RESOURCE_LIST;
struct _CM_RESOURCE_LIST;
struct _COMPRESSED_DATA_INFO;
struct _CONTEXT;
struct _CONTROLLER_OBJECT;
struct _DESCRIPTION_HEADER;
struct _DEVICE_CAPABILITIES;
struct _DEVICE_OBJECT;
struct _DEVICE_OBJECT_POWER_EXTENSION;
enum _DEVICE_POWER_STATE;
enum _DEVICE_RELATION_TYPE;
enum _DEVICE_USAGE_NOTIFICATION_TYPE;
enum _DEVICE_WAKE_DEPTH;
struct _DEVOBJ_EXTENSION;
struct _DISPATCHER_HEADER;
struct _DRIVER_EXTENSION;
struct _DRIVER_OBJECT;
struct _ECP_LIST;
struct _EPROCESS;
struct _ERESOURCE;
struct _ESILO;
struct _ETHREAD;
struct _EVENT_DATA_DESCRIPTOR;
struct _EVENT_DESCRIPTOR;
enum _EVENT_TYPE;
enum _EXCEPTION_DISPOSITION;
struct _EXCEPTION_RECORD;
struct _EXCEPTION_REGISTRATION_RECORD;
struct _EXT_DELETE_PARAMETERS;
struct _EXT_SET_PARAMETERS_V0;
struct _FACS;
struct _FADT;
struct _FAST_IO_DISPATCH;
struct _FAST_MUTEX;
struct _FILE_BASIC_INFORMATION;
struct _FILE_GET_QUOTA_INFORMATION;
enum _FILE_INFORMATION_CLASS;
struct _FILE_NETWORK_OPEN_INFORMATION;
struct _FILE_OBJECT;
struct _FILE_STANDARD_INFORMATION;
enum _FSINFOCLASS;
struct _GENERAL_LOOKASIDE;
struct _GENERAL_LOOKASIDE_POOL;
struct _GEN_ADDR;
struct _GROUP_AFFINITY;
struct _GUID;
struct _HALP_ALLOC_CONTEXT;
enum _HALP_DMA_MAP_BUFFER_TYPE;
enum _HAL_DMA_CRASH_DUMP_REGISTER_TYPE;
struct _HAL_HV_SVM_DEVICE_CAPABILITIES;
struct _HAL_HV_SVM_SYSTEM_CAPABILITIES;
enum _HAL_INIT_PHASE;
struct _HAL_INTEL_ENLIGHTENMENT_INFORMATION;
struct _HARDWARE_PTE;
struct _INITIAL_PRIVILEGE_SET;
struct _INTERFACE;
enum _INTERFACE_TYPE;
enum _INTERLOCKED_RESULT;
struct _INTERRUPT_FUNCTION_TABLE;
struct _INTERRUPT_LINE;
struct _INTERRUPT_LINE_STATE;
enum _INTERRUPT_PROBLEM;
enum _INTERRUPT_RESULT;
struct _INTERRUPT_TARGET;
enum _INTERRUPT_TARGET_TYPE;
struct _IOAPIC;
struct _IOSAPIC;
enum _IO_ALLOCATION_ACTION;
struct _IO_APIC_DATA;
struct _IO_APIC_REGISTERS;
struct _IO_COMPLETION_CONTEXT;
struct _IO_DRIVER_CREATE_CONTEXT;
struct _IO_NMISOURCE;
struct _IO_RESOURCE_DESCRIPTOR;
struct _IO_RESOURCE_LIST;
struct _IO_RESOURCE_REQUIREMENTS_LIST;
struct _IO_SECURITY_CONTEXT;
struct _IO_STACK_LOCATION;
struct _IO_STATUS_BLOCK;
struct _IO_TIMER;
struct _IRP;
enum _IRQ_PRIORITY;
struct _ISA_VECTOR;
struct _KAFFINITY_EX;
struct _KAPC;
struct _KDESCRIPTOR;
struct _KDEVICE_QUEUE;
struct _KDEVICE_QUEUE_ENTRY;
struct _KDPC;
struct _KEVENT;
struct _KFLOATING_SAVE;
union _KGDTENTRY64;
union _KIDTENTRY64;
enum _KINTERRUPT_MODE;
enum _KINTERRUPT_POLARITY;
struct _KNODE;
enum _KNOWN_CONTROLLER_TYPE;
struct _KPCR;
struct _KPRCB;
struct _KPROCESS;
struct _KPROCESSOR_STATE;
struct _KSPECIAL_REGISTERS;
struct _KSPIN_LOCK_QUEUE;
struct _KTB_FLUSH_VA;
struct _KTHREAD;
struct _KTSS64;
struct _KWAIT_CHAIN;
union _LARGE_INTEGER;
struct _LIST_ENTRY;
struct _LOCAL_NMISOURCE;
struct _LOOKASIDE_LIST_EX;
struct _LUID;
struct _LUID_AND_ATTRIBUTES;
struct _M128A;
struct _MAILSLOT_CREATE_PARAMETERS;
struct _MAPIC;
union _MCG_STATUS;
union _MCI_STATUS;
struct _MDL;
enum _MEMORY_CACHING_TYPE;
enum _MEMORY_CACHING_TYPE_ORIG;
enum _MODE;
struct _NAMED_PIPE_CREATE_PARAMETERS;
struct _NPAGED_LOOKASIDE_LIST;
struct _NT_TIB;
struct _OWNER_ENTRY;
struct _PAGED_LOOKASIDE_LIST;
struct _PLATFORM_INTERRUPT;
enum _POOL_TYPE;
struct _POWER_SEQUENCE;
union _POWER_STATE;
enum _POWER_STATE_TYPE;
struct _PRIVILEGE_SET;
struct _PROCLOCALAPIC;
struct _PROCLOCALSAPIC;
struct _REGISTERED_INTERRUPT_CONTROLLER;
enum _REG_NOTIFY_CLASS;
struct _RSDP;
struct _RSDT_32;
struct _RTL_AVL_TREE;
struct _RTL_BALANCED_NODE;
struct _RTL_BITMAP;
struct _RTL_DYNAMIC_HASH_TABLE;
struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT;
struct _RTL_DYNAMIC_HASH_TABLE_ENTRY;
struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR;
struct _RTL_QUERY_REGISTRY_TABLE;
struct _RTL_RB_TREE;
struct _RTL_SPLAY_LINKS;
struct _SCSI_REQUEST_BLOCK;
struct _SECONDARY_IC_LIST_ENTRY;
struct _SECONDARY_INTERRUPT_LINE_STATE;
struct _SECONDARY_INTERRUPT_PROVIDER_INTERFACE;
struct _SECTION_OBJECT_POINTERS;
enum _SECURITY_IMPERSONATION_LEVEL;
struct _SECURITY_QUALITY_OF_SERVICE;
struct _SECURITY_SUBJECT_CONTEXT;
struct _SINGLE_LIST_ENTRY;
struct _SLIST_ENTRY;
union _SLIST_HEADER;
struct _STRING;
enum _SYSTEM_POWER_STATE;
struct _SYSTEM_POWER_STATE_CONTEXT;
struct _TXN_PARAMETER_BLOCK;
union _ULARGE_INTEGER;
struct _UNICODE_STRING;
enum _USER_ACTIVITY_PRESENCE;
struct _VPB;
struct _WAIT_CONTEXT_BLOCK;
enum _WHEA_CPU_VENDOR;
enum _WHEA_ERROR_PACKET_DATA_FORMAT;
union _WHEA_ERROR_PACKET_FLAGS;
struct _WHEA_ERROR_PACKET_V2;
struct _WHEA_ERROR_RECORD;
struct _WHEA_ERROR_RECORD_HEADER;
union _WHEA_ERROR_RECORD_HEADER_FLAGS;
union _WHEA_ERROR_RECORD_HEADER_VALIDBITS;
struct _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR;
union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS;
union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS;
enum _WHEA_ERROR_SEVERITY;
enum _WHEA_ERROR_SOURCE_TYPE;
enum _WHEA_ERROR_TYPE;
union _WHEA_PERSISTENCE_INFO;
struct _WHEA_PROCESSOR_GENERIC_ERROR_SECTION;
union _WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS;
struct _WHEA_RECOVERY_CONTEXT;
union _WHEA_REVISION;
union _WHEA_TIMESTAMP;
struct _WHEA_XPF_MCA_SECTION;
struct _WHEA_XPF_PROCESSOR_ERROR_SECTION;
union _WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS;
struct _WORK_QUEUE_ITEM;
struct _XSAVE_FORMAT;
struct _XSDT;
enum BUS_QUERY_ID_TYPE
{
BusQueryDeviceID = 0,
BusQueryHardwareIDs = 1,
BusQueryCompatibleIDs = 2,
BusQueryInstanceID = 3,
BusQueryDeviceSerialNumber = 4,
BusQueryContainerID = 5,
};
enum DEVICE_TEXT_TYPE
{
DeviceTextDescription = 0,
DeviceTextLocationInformation = 1,
};
struct LIST_ENTRY32
{
/* 0x0000 */ unsigned long Flink;
/* 0x0004 */ unsigned long Blink;
}; /* size: 0x0008 */
struct LIST_ENTRY64
{
/* 0x0000 */ unsigned __int64 Flink;
/* 0x0008 */ unsigned __int64 Blink;
}; /* size: 0x0010 */
struct POHANDLE__
{
/* 0x0000 */ int unused;
}; /* size: 0x0004 */
enum POWER_ACTION
{
PowerActionNone = 0,
PowerActionReserved = 1,
PowerActionSleep = 2,
PowerActionHibernate = 3,
PowerActionShutdown = 4,
PowerActionShutdownReset = 5,
PowerActionShutdownOff = 6,
PowerActionWarmEject = 7,
PowerActionDisplayOff = 8,
};
typedef struct _ACCESS_STATE
{
/* 0x0000 */ struct _LUID OperationID;
/* 0x0008 */ unsigned char SecurityEvaluated;
/* 0x0009 */ unsigned char GenerateAudit;
/* 0x000a */ unsigned char GenerateOnClose;
/* 0x000b */ unsigned char PrivilegesAllocated;
/* 0x000c */ unsigned long Flags;
/* 0x0010 */ unsigned long RemainingDesiredAccess;
/* 0x0014 */ unsigned long PreviouslyGrantedAccess;
/* 0x0018 */ unsigned long OriginalDesiredAccess;
/* 0x0020 */ struct _SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
/* 0x0040 */ void* SecurityDescriptor;
/* 0x0048 */ void* AuxData;
union // _TAG_UNNAMED_1
{
union
{
/* 0x0050 */ struct _INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
/* 0x0050 */ struct _PRIVILEGE_SET PrivilegeSet;
}; /* size: 0x002c */
} /* size: 0x002c */ Privileges;
/* 0x007c */ unsigned char AuditPrivileges;
/* 0x0080 */ struct _UNICODE_STRING ObjectName;
/* 0x0090 */ struct _UNICODE_STRING ObjectTypeName;
} ACCESS_STATE, *PACCESS_STATE; /* size: 0x00a0 */
typedef struct _ACPI_CACHED_TABLE
{
/* 0x0000 */ struct _LIST_ENTRY Links;
/* 0x0010 */ union _LARGE_INTEGER PhysicalAddress;
/* 0x0018 */ struct _DESCRIPTION_HEADER Header;
/* 0x003c */ long __PADDING__[1];
} ACPI_CACHED_TABLE, *PACPI_CACHED_TABLE; /* size: 0x0040 */
typedef struct _CM_FULL_RESOURCE_DESCRIPTOR
{
/* 0x0000 */ enum _INTERFACE_TYPE InterfaceType;
/* 0x0004 */ unsigned long BusNumber;
/* 0x0008 */ struct _CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR; /* size: 0x0024 */
typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char ShareDisposition;
/* 0x0002 */ unsigned short Flags;
union // _TAG_UNNAMED_2
{
union
{
struct // _TAG_UNNAMED_3
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length;
} /* size: 0x000c */ Generic;
struct // _TAG_UNNAMED_3
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length;
} /* size: 0x000c */ Port;
struct // _TAG_UNNAMED_4
{
/* 0x0004 */ unsigned short Level;
/* 0x0006 */ unsigned short Group;
/* 0x0008 */ unsigned long Vector;
/* 0x000c */ unsigned __int64 Affinity;
} /* size: 0x0010 */ Interrupt;
struct // _TAG_UNNAMED_5
{
union
{
struct // _TAG_UNNAMED_6
{
/* 0x0004 */ unsigned short Group;
/* 0x0006 */ unsigned short MessageCount;
/* 0x0008 */ unsigned long Vector;
/* 0x000c */ unsigned __int64 Affinity;
} /* size: 0x0010 */ Raw;
struct // _TAG_UNNAMED_4
{
/* 0x0004 */ unsigned short Level;
/* 0x0006 */ unsigned short Group;
/* 0x0008 */ unsigned long Vector;
/* 0x000c */ unsigned __int64 Affinity;
} /* size: 0x0010 */ Translated;
}; /* size: 0x0010 */
} /* size: 0x0010 */ MessageInterrupt;
struct // _TAG_UNNAMED_3
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length;
} /* size: 0x000c */ Memory;
struct // _TAG_UNNAMED_7
{
/* 0x0004 */ unsigned long Channel;
/* 0x0008 */ unsigned long Port;
/* 0x000c */ unsigned long Reserved1;
} /* size: 0x000c */ Dma;
struct // _TAG_UNNAMED_8
{
/* 0x0004 */ unsigned long Channel;
/* 0x0008 */ unsigned long RequestLine;
/* 0x000c */ unsigned char TransferWidth;
/* 0x000d */ unsigned char Reserved1;
/* 0x000e */ unsigned char Reserved2;
/* 0x000f */ unsigned char Reserved3;
} /* size: 0x000c */ DmaV3;
struct // _TAG_UNNAMED_9
{
/* 0x0004 */ unsigned long Data[3];
} /* size: 0x000c */ DevicePrivate;
struct // _TAG_UNNAMED_10
{
/* 0x0004 */ unsigned long Start;
/* 0x0008 */ unsigned long Length;
/* 0x000c */ unsigned long Reserved;
} /* size: 0x000c */ BusNumber;
struct // _TAG_UNNAMED_11
{
/* 0x0004 */ unsigned long DataSize;
/* 0x0008 */ unsigned long Reserved1;
/* 0x000c */ unsigned long Reserved2;
} /* size: 0x000c */ DeviceSpecificData;
struct // _TAG_UNNAMED_12
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length40;
} /* size: 0x000c */ Memory40;
struct // _TAG_UNNAMED_13
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length48;
} /* size: 0x000c */ Memory48;
struct // _TAG_UNNAMED_14
{
/* 0x0004 */ union _LARGE_INTEGER Start;
/* 0x000c */ unsigned long Length64;
} /* size: 0x000c */ Memory64;
struct // _TAG_UNNAMED_15
{
/* 0x0004 */ unsigned char Class;
/* 0x0005 */ unsigned char Type;
/* 0x0006 */ unsigned char Reserved1;
/* 0x0007 */ unsigned char Reserved2;
/* 0x0008 */ unsigned long IdLowPart;
/* 0x000c */ unsigned long IdHighPart;
} /* size: 0x000c */ Connection;
}; /* size: 0x0010 */
} /* size: 0x0010 */ u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR; /* size: 0x0014 */
typedef struct _CM_PARTIAL_RESOURCE_LIST
{
/* 0x0000 */ unsigned short Version;
/* 0x0002 */ unsigned short Revision;
/* 0x0004 */ unsigned long Count;
/* 0x0008 */ struct _CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST; /* size: 0x001c */
typedef struct _CM_RESOURCE_LIST
{
/* 0x0000 */ unsigned long Count;
/* 0x0004 */ struct _CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST; /* size: 0x0028 */
struct _COMPRESSED_DATA_INFO;
typedef struct _CONTEXT
{
/* 0x0000 */ unsigned __int64 P1Home;
/* 0x0008 */ unsigned __int64 P2Home;
/* 0x0010 */ unsigned __int64 P3Home;
/* 0x0018 */ unsigned __int64 P4Home;
/* 0x0020 */ unsigned __int64 P5Home;
/* 0x0028 */ unsigned __int64 P6Home;
/* 0x0030 */ unsigned long ContextFlags;
/* 0x0034 */ unsigned long MxCsr;
/* 0x0038 */ unsigned short SegCs;
/* 0x003a */ unsigned short SegDs;
/* 0x003c */ unsigned short SegEs;
/* 0x003e */ unsigned short SegFs;
/* 0x0040 */ unsigned short SegGs;
/* 0x0042 */ unsigned short SegSs;
/* 0x0044 */ unsigned long EFlags;
/* 0x0048 */ unsigned __int64 Dr0;
/* 0x0050 */ unsigned __int64 Dr1;
/* 0x0058 */ unsigned __int64 Dr2;
/* 0x0060 */ unsigned __int64 Dr3;
/* 0x0068 */ unsigned __int64 Dr6;
/* 0x0070 */ unsigned __int64 Dr7;
/* 0x0078 */ unsigned __int64 Rax;
/* 0x0080 */ unsigned __int64 Rcx;
/* 0x0088 */ unsigned __int64 Rdx;
/* 0x0090 */ unsigned __int64 Rbx;
/* 0x0098 */ unsigned __int64 Rsp;
/* 0x00a0 */ unsigned __int64 Rbp;
/* 0x00a8 */ unsigned __int64 Rsi;
/* 0x00b0 */ unsigned __int64 Rdi;
/* 0x00b8 */ unsigned __int64 R8;
/* 0x00c0 */ unsigned __int64 R9;
/* 0x00c8 */ unsigned __int64 R10;
/* 0x00d0 */ unsigned __int64 R11;
/* 0x00d8 */ unsigned __int64 R12;
/* 0x00e0 */ unsigned __int64 R13;
/* 0x00e8 */ unsigned __int64 R14;
/* 0x00f0 */ unsigned __int64 R15;
/* 0x00f8 */ unsigned __int64 Rip;
union
{
/* 0x0100 */ struct _XSAVE_FORMAT FltSave;
struct
{
/* 0x0100 */ struct _M128A Header[2];
/* 0x0120 */ struct _M128A Legacy[8];
/* 0x01a0 */ struct _M128A Xmm0;
/* 0x01b0 */ struct _M128A Xmm1;
/* 0x01c0 */ struct _M128A Xmm2;
/* 0x01d0 */ struct _M128A Xmm3;
/* 0x01e0 */ struct _M128A Xmm4;
/* 0x01f0 */ struct _M128A Xmm5;
/* 0x0200 */ struct _M128A Xmm6;
/* 0x0210 */ struct _M128A Xmm7;
/* 0x0220 */ struct _M128A Xmm8;
/* 0x0230 */ struct _M128A Xmm9;
/* 0x0240 */ struct _M128A Xmm10;
/* 0x0250 */ struct _M128A Xmm11;
/* 0x0260 */ struct _M128A Xmm12;
/* 0x0270 */ struct _M128A Xmm13;
/* 0x0280 */ struct _M128A Xmm14;
/* 0x0290 */ struct _M128A Xmm15;
}; /* size: 0x01a0 */
}; /* size: 0x0200 */
/* 0x0300 */ struct _M128A VectorRegister[26];
/* 0x04a0 */ unsigned __int64 VectorControl;
/* 0x04a8 */ unsigned __int64 DebugControl;
/* 0x04b0 */ unsigned __int64 LastBranchToRip;
/* 0x04b8 */ unsigned __int64 LastBranchFromRip;
/* 0x04c0 */ unsigned __int64 LastExceptionToRip;
/* 0x04c8 */ unsigned __int64 LastExceptionFromRip;
} CONTEXT, *PCONTEXT; /* size: 0x04d0 */
typedef struct _CONTROLLER_OBJECT
{
/* 0x0000 */ short Type;
/* 0x0002 */ short Size;
/* 0x0008 */ void* ControllerExtension;
/* 0x0010 */ struct _KDEVICE_QUEUE DeviceWaitQueue;
/* 0x0038 */ unsigned long Spare1;
/* 0x0040 */ union _LARGE_INTEGER Spare2;
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; /* size: 0x0048 */
typedef struct _DESCRIPTION_HEADER
{
/* 0x0000 */ unsigned long Signature;
/* 0x0004 */ unsigned long Length;
/* 0x0008 */ unsigned char Revision;
/* 0x0009 */ unsigned char Checksum;
/* 0x000a */ char OEMID[6];
/* 0x0010 */ char OEMTableID[8];
/* 0x0018 */ unsigned long OEMRevision;
/* 0x001c */ char CreatorID[4];
/* 0x0020 */ unsigned long CreatorRev;
} DESCRIPTION_HEADER, *PDESCRIPTION_HEADER; /* size: 0x0024 */
typedef struct _DEVICE_CAPABILITIES
{
/* 0x0000 */ unsigned short Size;
/* 0x0002 */ unsigned short Version;
struct /* bitfield */
{
/* 0x0004 */ unsigned long DeviceD1 : 1; /* bit position: 0 */
/* 0x0004 */ unsigned long DeviceD2 : 1; /* bit position: 1 */
/* 0x0004 */ unsigned long LockSupported : 1; /* bit position: 2 */
/* 0x0004 */ unsigned long EjectSupported : 1; /* bit position: 3 */
/* 0x0004 */ unsigned long Removable : 1; /* bit position: 4 */
/* 0x0004 */ unsigned long DockDevice : 1; /* bit position: 5 */
/* 0x0004 */ unsigned long UniqueID : 1; /* bit position: 6 */
/* 0x0004 */ unsigned long SilentInstall : 1; /* bit position: 7 */
/* 0x0004 */ unsigned long RawDeviceOK : 1; /* bit position: 8 */
/* 0x0004 */ unsigned long SurpriseRemovalOK : 1; /* bit position: 9 */
/* 0x0004 */ unsigned long WakeFromD0 : 1; /* bit position: 10 */
/* 0x0004 */ unsigned long WakeFromD1 : 1; /* bit position: 11 */
/* 0x0004 */ unsigned long WakeFromD2 : 1; /* bit position: 12 */
/* 0x0004 */ unsigned long WakeFromD3 : 1; /* bit position: 13 */
/* 0x0004 */ unsigned long HardwareDisabled : 1; /* bit position: 14 */
/* 0x0004 */ unsigned long NonDynamic : 1; /* bit position: 15 */
/* 0x0004 */ unsigned long WarmEjectSupported : 1; /* bit position: 16 */
/* 0x0004 */ unsigned long NoDisplayInUI : 1; /* bit position: 17 */
/* 0x0004 */ unsigned long Reserved1 : 1; /* bit position: 18 */
/* 0x0004 */ unsigned long WakeFromInterrupt : 1; /* bit position: 19 */
/* 0x0004 */ unsigned long Reserved : 12; /* bit position: 20 */
}; /* bitfield */
/* 0x0008 */ unsigned long Address;
/* 0x000c */ unsigned long UINumber;
/* 0x0010 */ enum _DEVICE_POWER_STATE DeviceState[7];
/* 0x002c */ enum _SYSTEM_POWER_STATE SystemWake;
/* 0x0030 */ enum _DEVICE_POWER_STATE DeviceWake;
/* 0x0034 */ unsigned long D1Latency;
/* 0x0038 */ unsigned long D2Latency;
/* 0x003c */ unsigned long D3Latency;
} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES; /* size: 0x0040 */
typedef struct _DEVICE_OBJECT
{
/* 0x0000 */ short Type;
/* 0x0002 */ unsigned short Size;
/* 0x0004 */ long ReferenceCount;
/* 0x0008 */ struct _DRIVER_OBJECT* DriverObject;
/* 0x0010 */ struct _DEVICE_OBJECT* NextDevice;
/* 0x0018 */ struct _DEVICE_OBJECT* AttachedDevice;
/* 0x0020 */ struct _IRP* CurrentIrp;
/* 0x0028 */ struct _IO_TIMER* Timer;
/* 0x0030 */ unsigned long Flags;
/* 0x0034 */ unsigned long Characteristics;
/* 0x0038 */ struct _VPB* Vpb;
/* 0x0040 */ void* DeviceExtension;
/* 0x0048 */ unsigned long DeviceType;
/* 0x004c */ char StackSize;
union // _TAG_UNNAMED_16
{
union
{
/* 0x0050 */ struct _LIST_ENTRY ListEntry;
/* 0x0050 */ struct _WAIT_CONTEXT_BLOCK Wcb;
}; /* size: 0x0048 */
} /* size: 0x0048 */ Queue;
/* 0x0098 */ unsigned long AlignmentRequirement;
/* 0x00a0 */ struct _KDEVICE_QUEUE DeviceQueue;
/* 0x00c8 */ struct _KDPC Dpc;
/* 0x0108 */ unsigned long ActiveThreadCount;
/* 0x0110 */ void* SecurityDescriptor;
/* 0x0118 */ struct _KEVENT DeviceLock;
/* 0x0130 */ unsigned short SectorSize;
/* 0x0132 */ unsigned short Spare1;
/* 0x0138 */ struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
/* 0x0140 */ void* Reserved;
/* 0x0148 */ long __PADDING__[2];
} DEVICE_OBJECT, *PDEVICE_OBJECT; /* size: 0x0150 */
struct _DEVICE_OBJECT_POWER_EXTENSION;
typedef enum _DEVICE_POWER_STATE
{
PowerDeviceUnspecified = 0,
PowerDeviceD0 = 1,
PowerDeviceD1 = 2,
PowerDeviceD2 = 3,
PowerDeviceD3 = 4,
PowerDeviceMaximum = 5,
} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
typedef enum _DEVICE_RELATION_TYPE
{
BusRelations = 0,
EjectionRelations = 1,
PowerRelations = 2,
RemovalRelations = 3,
TargetDeviceRelation = 4,
SingleBusRelations = 5,
TransportRelations = 6,
} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE
{
DeviceUsageTypeUndefined = 0,
DeviceUsageTypePaging = 1,
DeviceUsageTypeHibernation = 2,
DeviceUsageTypeDumpFile = 3,
DeviceUsageTypeBoot = 4,
DeviceUsageTypePostDisplay = 5,
} DEVICE_USAGE_NOTIFICATION_TYPE, *PDEVICE_USAGE_NOTIFICATION_TYPE;
typedef enum _DEVICE_WAKE_DEPTH
{
DeviceWakeDepthNotWakeable = 0,
DeviceWakeDepthD0 = 1,
DeviceWakeDepthD1 = 2,
DeviceWakeDepthD2 = 3,
DeviceWakeDepthD3hot = 4,
DeviceWakeDepthD3cold = 5,
DeviceWakeDepthMaximum = 6,
} DEVICE_WAKE_DEPTH, *PDEVICE_WAKE_DEPTH;
typedef struct _DEVOBJ_EXTENSION
{
/* 0x0000 */ short Type;
/* 0x0002 */ unsigned short Size;
/* 0x0008 */ struct _DEVICE_OBJECT* DeviceObject;
/* 0x0010 */ unsigned long PowerFlags;
/* 0x0018 */ struct _DEVICE_OBJECT_POWER_EXTENSION* Dope;
/* 0x0020 */ unsigned long ExtensionFlags;
/* 0x0028 */ void* DeviceNode;
/* 0x0030 */ struct _DEVICE_OBJECT* AttachedTo;
/* 0x0038 */ long StartIoCount;
/* 0x003c */ long StartIoKey;
/* 0x0040 */ unsigned long StartIoFlags;
/* 0x0048 */ struct _VPB* Vpb;
/* 0x0050 */ void* DependencyNode;
/* 0x0058 */ void* InterruptContext;
/* 0x0060 */ void* VerifierContext;
} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION; /* size: 0x0068 */
typedef struct _DISPATCHER_HEADER
{
union
{
/* 0x0000 */ volatile long Lock;
/* 0x0000 */ long LockNV;
struct
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Signalling;
/* 0x0002 */ unsigned char Size;
/* 0x0003 */ unsigned char Reserved1;
}; /* size: 0x0004 */
struct
{
/* 0x0000 */ unsigned char TimerType;
union
{
/* 0x0001 */ unsigned char TimerControlFlags;
struct
{
struct /* bitfield */
{
/* 0x0001 */ unsigned char Absolute : 1; /* bit position: 0 */
/* 0x0001 */ unsigned char Wake : 1; /* bit position: 1 */
/* 0x0001 */ unsigned char EncodedTolerableDelay : 6; /* bit position: 2 */
}; /* bitfield */
/* 0x0002 */ unsigned char Hand;
union
{
/* 0x0003 */ unsigned char TimerMiscFlags;
struct /* bitfield */
{
/* 0x0003 */ unsigned char Index : 6; /* bit position: 0 */
/* 0x0003 */ unsigned char Inserted : 1; /* bit position: 6 */
/* 0x0003 */ volatile unsigned char Expired : 1; /* bit position: 7 */
}; /* bitfield */
}; /* size: 0x0001 */
}; /* size: 0x0003 */
}; /* size: 0x0003 */
}; /* size: 0x0004 */
struct
{
/* 0x0000 */ unsigned char Timer2Type;
union
{
/* 0x0001 */ unsigned char Timer2Flags;
struct
{
struct /* bitfield */
{
/* 0x0001 */ unsigned char Timer2Inserted : 1; /* bit position: 0 */
/* 0x0001 */ unsigned char Timer2Expiring : 1; /* bit position: 1 */
/* 0x0001 */ unsigned char Timer2CancelPending : 1; /* bit position: 2 */
/* 0x0001 */ unsigned char Timer2SetPending : 1; /* bit position: 3 */
/* 0x0001 */ unsigned char Timer2Running : 1; /* bit position: 4 */
/* 0x0001 */ unsigned char Timer2Disabled : 1; /* bit position: 5 */
/* 0x0001 */ unsigned char Timer2ReservedFlags : 2; /* bit position: 6 */
}; /* bitfield */
/* 0x0002 */ unsigned char Timer2Reserved1;
/* 0x0003 */ unsigned char Timer2Reserved2;
}; /* size: 0x0003 */
}; /* size: 0x0003 */
}; /* size: 0x0004 */
struct
{
/* 0x0000 */ unsigned char QueueType;
union
{
/* 0x0001 */ unsigned char QueueControlFlags;
struct
{
struct /* bitfield */
{
/* 0x0001 */ unsigned char Abandoned : 1; /* bit position: 0 */
/* 0x0001 */ unsigned char DisableIncrement : 1; /* bit position: 1 */
/* 0x0001 */ unsigned char QueueReservedControlFlags : 6; /* bit position: 2 */
}; /* bitfield */
/* 0x0002 */ unsigned char QueueSize;
/* 0x0003 */ unsigned char QueueReserved;
}; /* size: 0x0003 */
}; /* size: 0x0003 */
}; /* size: 0x0004 */
struct
{
/* 0x0000 */ unsigned char ThreadType;
/* 0x0001 */ unsigned char ThreadReserved;
union
{
/* 0x0002 */ unsigned char ThreadControlFlags;
struct
{
struct /* bitfield */
{
/* 0x0002 */ unsigned char CycleProfiling : 1; /* bit position: 0 */
/* 0x0002 */ unsigned char CounterProfiling : 1; /* bit position: 1 */
/* 0x0002 */ unsigned char GroupScheduling : 1; /* bit position: 2 */
/* 0x0002 */ unsigned char AffinitySet : 1; /* bit position: 3 */
/* 0x0002 */ unsigned char Tagged : 1; /* bit position: 4 */
/* 0x0002 */ unsigned char EnergyProfiling : 1; /* bit position: 5 */
/* 0x0002 */ unsigned char ThreadReservedControlFlags : 2; /* bit position: 6 */
}; /* bitfield */
union
{
/* 0x0003 */ unsigned char DebugActive;
struct /* bitfield */
{
/* 0x0003 */ unsigned char ActiveDR7 : 1; /* bit position: 0 */
/* 0x0003 */ unsigned char Instrumented : 1; /* bit position: 1 */
/* 0x0003 */ unsigned char Minimal : 1; /* bit position: 2 */
/* 0x0003 */ unsigned char Reserved4 : 3; /* bit position: 3 */
/* 0x0003 */ unsigned char UmsScheduled : 1; /* bit position: 6 */
/* 0x0003 */ unsigned char UmsPrimary : 1; /* bit position: 7 */
}; /* bitfield */
}; /* size: 0x0001 */
}; /* size: 0x0002 */
}; /* size: 0x0002 */
}; /* size: 0x0004 */
struct
{
/* 0x0000 */ unsigned char MutantType;
/* 0x0001 */ unsigned char MutantSize;
/* 0x0002 */ unsigned char DpcActive;
/* 0x0003 */ unsigned char MutantReserved;
}; /* size: 0x0004 */
}; /* size: 0x0004 */
/* 0x0004 */ long SignalState;
/* 0x0008 */ struct _LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER, *PDISPATCHER_HEADER; /* size: 0x0018 */
typedef struct _DRIVER_EXTENSION
{
/* 0x0000 */ struct _DRIVER_OBJECT* DriverObject;
/* 0x0008 */ void* AddDevice /* function */;
/* 0x0010 */ unsigned long Count;
/* 0x0018 */ struct _UNICODE_STRING ServiceKeyName;
} DRIVER_EXTENSION, *PDRIVER_EXTENSION; /* size: 0x0028 */
typedef struct _DRIVER_OBJECT
{
/* 0x0000 */ short Type;
/* 0x0002 */ short Size;
/* 0x0008 */ struct _DEVICE_OBJECT* DeviceObject;
/* 0x0010 */ unsigned long Flags;
/* 0x0018 */ void* DriverStart;
/* 0x0020 */ unsigned long DriverSize;
/* 0x0028 */ void* DriverSection;
/* 0x0030 */ struct _DRIVER_EXTENSION* DriverExtension;
/* 0x0038 */ struct _UNICODE_STRING DriverName;
/* 0x0048 */ struct _UNICODE_STRING* HardwareDatabase;
/* 0x0050 */ struct _FAST_IO_DISPATCH* FastIoDispatch;
/* 0x0058 */ void* DriverInit /* function */;
/* 0x0060 */ void* DriverStartIo /* function */;
/* 0x0068 */ void* DriverUnload /* function */;
/* 0x0070 */ void* MajorFunction[28] /* function */;
} DRIVER_OBJECT, *PDRIVER_OBJECT; /* size: 0x0150 */
struct _ECP_LIST;
struct _EPROCESS;
typedef struct _ERESOURCE
{
/* 0x0000 */ struct _LIST_ENTRY SystemResourcesList;
/* 0x0010 */ struct _OWNER_ENTRY* OwnerTable;
/* 0x0018 */ short ActiveCount;
union
{
/* 0x001a */ unsigned short Flag;
struct
{
/* 0x001a */ unsigned char ReservedLowFlags;
/* 0x001b */ unsigned char WaiterPriority;
}; /* size: 0x0002 */
}; /* size: 0x0002 */
/* 0x0020 */ struct _KWAIT_CHAIN SharedWaiters;
/* 0x0028 */ struct _KEVENT* ExclusiveWaiters;
/* 0x0030 */ struct _OWNER_ENTRY OwnerEntry;
/* 0x0040 */ unsigned long ActiveEntries;
/* 0x0044 */ unsigned long ContentionCount;
/* 0x0048 */ unsigned long NumberOfSharedWaiters;
/* 0x004c */ unsigned long NumberOfExclusiveWaiters;
/* 0x0050 */ void* Reserved2;
union
{
/* 0x0058 */ void* Address;
/* 0x0058 */ unsigned __int64 CreatorBackTraceIndex;
}; /* size: 0x0008 */
/* 0x0060 */ unsigned __int64 SpinLock;
} ERESOURCE, *PERESOURCE; /* size: 0x0068 */
struct _ESILO;
struct _ETHREAD;
typedef struct _EVENT_DATA_DESCRIPTOR
{
/* 0x0000 */ unsigned __int64 Ptr;
/* 0x0008 */ unsigned long Size;
union
{
/* 0x000c */ unsigned long Reserved;
struct
{
/* 0x000c */ unsigned char Type;
/* 0x000d */ unsigned char Reserved1;
/* 0x000e */ unsigned short Reserved2;
}; /* size: 0x0004 */
}; /* size: 0x0004 */
} EVENT_DATA_DESCRIPTOR, *PEVENT_DATA_DESCRIPTOR; /* size: 0x0010 */
typedef struct _EVENT_DESCRIPTOR
{
/* 0x0000 */ unsigned short Id;
/* 0x0002 */ unsigned char Version;
/* 0x0003 */ unsigned char Channel;
/* 0x0004 */ unsigned char Level;
/* 0x0005 */ unsigned char Opcode;
/* 0x0006 */ unsigned short Task;
/* 0x0008 */ unsigned __int64 Keyword;
} EVENT_DESCRIPTOR, *PEVENT_DESCRIPTOR; /* size: 0x0010 */
typedef enum _EVENT_TYPE
{
NotificationEvent = 0,
SynchronizationEvent = 1,
} EVENT_TYPE, *PEVENT_TYPE;
typedef enum _EXCEPTION_DISPOSITION
{
ExceptionContinueExecution = 0,
ExceptionContinueSearch = 1,
ExceptionNestedException = 2,
ExceptionCollidedUnwind = 3,
} EXCEPTION_DISPOSITION, *PEXCEPTION_DISPOSITION;
typedef struct _EXCEPTION_RECORD
{
/* 0x0000 */ long ExceptionCode;
/* 0x0004 */ unsigned long ExceptionFlags;
/* 0x0008 */ struct _EXCEPTION_RECORD* ExceptionRecord;
/* 0x0010 */ void* ExceptionAddress;
/* 0x0018 */ unsigned long NumberParameters;
/* 0x0020 */ unsigned __int64 ExceptionInformation[15];
} EXCEPTION_RECORD, *PEXCEPTION_RECORD; /* size: 0x0098 */
typedef struct _EXCEPTION_REGISTRATION_RECORD
{
/* 0x0000 */ struct _EXCEPTION_REGISTRATION_RECORD* Next;
/* 0x0008 */ void* Handler /* function */;
} EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD; /* size: 0x0010 */
typedef struct _EXT_DELETE_PARAMETERS
{
/* 0x0000 */ unsigned long Version;
/* 0x0004 */ unsigned long Reserved;
/* 0x0008 */ void* DeleteCallback /* function */;
/* 0x0010 */ void* DeleteContext;
} EXT_DELETE_PARAMETERS, *PEXT_DELETE_PARAMETERS; /* size: 0x0018 */
typedef struct _EXT_SET_PARAMETERS_V0
{
/* 0x0000 */ unsigned long Version;
/* 0x0004 */ unsigned long Reserved;
/* 0x0008 */ __int64 NoWakeTolerance;
} EXT_SET_PARAMETERS_V0, *PEXT_SET_PARAMETERS_V0; /* size: 0x0010 */
typedef struct _FACS
{
/* 0x0000 */ unsigned long Signature;
/* 0x0004 */ unsigned long Length;
/* 0x0008 */ unsigned long HardwareSignature;
/* 0x000c */ unsigned long pFirmwareWakingVector;
/* 0x0010 */ unsigned long GlobalLock;
/* 0x0014 */ unsigned long Flags;
/* 0x0018 */ union _LARGE_INTEGER x_FirmwareWakingVector;
/* 0x0020 */ unsigned char version;
/* 0x0021 */ unsigned char Reserved[31];
} FACS, *PFACS; /* size: 0x0040 */
typedef struct _FADT
{
/* 0x0000 */ struct _DESCRIPTION_HEADER Header;
/* 0x0024 */ unsigned long facs;
/* 0x0028 */ unsigned long dsdt;
/* 0x002c */ unsigned char int_model;
/* 0x002d */ unsigned char pm_profile;
/* 0x002e */ unsigned short sci_int_vector;
/* 0x0030 */ unsigned long smi_cmd_io_port;
/* 0x0034 */ unsigned char acpi_on_value;
/* 0x0035 */ unsigned char acpi_off_value;
/* 0x0036 */ unsigned char s4bios_req;
/* 0x0037 */ unsigned char pstate_control;
/* 0x0038 */ unsigned long pm1a_evt_blk_io_port;
/* 0x003c */ unsigned long pm1b_evt_blk_io_port;
/* 0x0040 */ unsigned long pm1a_ctrl_blk_io_port;
/* 0x0044 */ unsigned long pm1b_ctrl_blk_io_port;
/* 0x0048 */ unsigned long pm2_ctrl_blk_io_port;
/* 0x004c */ unsigned long pm_tmr_blk_io_port;
/* 0x0050 */ unsigned long gp0_blk_io_port;
/* 0x0054 */ unsigned long gp1_blk_io_port;
/* 0x0058 */ unsigned char pm1_evt_len;
/* 0x0059 */ unsigned char pm1_ctrl_len;
/* 0x005a */ unsigned char pm2_ctrl_len;
/* 0x005b */ unsigned char pm_tmr_len;
/* 0x005c */ unsigned char gp0_blk_len;
/* 0x005d */ unsigned char gp1_blk_len;
/* 0x005e */ unsigned char gp1_base;
/* 0x005f */ unsigned char cstate_control;
/* 0x0060 */ unsigned short lvl2_latency;
/* 0x0062 */ unsigned short lvl3_latency;
/* 0x0064 */ unsigned short flush_size;
/* 0x0066 */ unsigned short flush_stride;
/* 0x0068 */ unsigned char duty_offset;
/* 0x0069 */ unsigned char duty_width;
/* 0x006a */ unsigned char day_alarm_index;
/* 0x006b */ unsigned char month_alarm_index;
/* 0x006c */ unsigned char century_alarm_index;
/* 0x006d */ unsigned short boot_arch;
/* 0x006f */ unsigned char reserved3[1];
/* 0x0070 */ unsigned long flags;
/* 0x0074 */ struct _GEN_ADDR reset_reg;
/* 0x0080 */ unsigned char reset_val;
/* 0x0081 */ unsigned short arm_boot_arch;
/* 0x0083 */ unsigned char reserved4;
/* 0x0084 */ union _LARGE_INTEGER x_firmware_ctrl;
/* 0x008c */ union _LARGE_INTEGER x_dsdt;
/* 0x0094 */ struct _GEN_ADDR x_pm1a_evt_blk;
/* 0x00a0 */ struct _GEN_ADDR x_pm1b_evt_blk;
/* 0x00ac */ struct _GEN_ADDR x_pm1a_ctrl_blk;
/* 0x00b8 */ struct _GEN_ADDR x_pm1b_ctrl_blk;
/* 0x00c4 */ struct _GEN_ADDR x_pm2_ctrl_blk;
/* 0x00d0 */ struct _GEN_ADDR x_pm_tmr_blk;
/* 0x00dc */ struct _GEN_ADDR x_gp0_blk;
/* 0x00e8 */ struct _GEN_ADDR x_gp1_blk;
/* 0x00f4 */ struct _GEN_ADDR sleep_control_reg;
/* 0x0100 */ struct _GEN_ADDR sleep_status_reg;
} FADT, *PFADT; /* size: 0x010c */
typedef struct _FAST_IO_DISPATCH
{
/* 0x0000 */ unsigned long SizeOfFastIoDispatch;
/* 0x0008 */ void* FastIoCheckIfPossible /* function */;
/* 0x0010 */ void* FastIoRead /* function */;
/* 0x0018 */ void* FastIoWrite /* function */;
/* 0x0020 */ void* FastIoQueryBasicInfo /* function */;
/* 0x0028 */ void* FastIoQueryStandardInfo /* function */;
/* 0x0030 */ void* FastIoLock /* function */;
/* 0x0038 */ void* FastIoUnlockSingle /* function */;
/* 0x0040 */ void* FastIoUnlockAll /* function */;
/* 0x0048 */ void* FastIoUnlockAllByKey /* function */;
/* 0x0050 */ void* FastIoDeviceControl /* function */;
/* 0x0058 */ void* AcquireFileForNtCreateSection /* function */;
/* 0x0060 */ void* ReleaseFileForNtCreateSection /* function */;
/* 0x0068 */ void* FastIoDetachDevice /* function */;
/* 0x0070 */ void* FastIoQueryNetworkOpenInfo /* function */;
/* 0x0078 */ void* AcquireForModWrite /* function */;
/* 0x0080 */ void* MdlRead /* function */;
/* 0x0088 */ void* MdlReadComplete /* function */;
/* 0x0090 */ void* PrepareMdlWrite /* function */;
/* 0x0098 */ void* MdlWriteComplete /* function */;
/* 0x00a0 */ void* FastIoReadCompressed /* function */;
/* 0x00a8 */ void* FastIoWriteCompressed /* function */;
/* 0x00b0 */ void* MdlReadCompleteCompressed /* function */;
/* 0x00b8 */ void* MdlWriteCompleteCompressed /* function */;
/* 0x00c0 */ void* FastIoQueryOpen /* function */;
/* 0x00c8 */ void* ReleaseForModWrite /* function */;
/* 0x00d0 */ void* AcquireForCcFlush /* function */;
/* 0x00d8 */ void* ReleaseForCcFlush /* function */;
} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH; /* size: 0x00e0 */
typedef struct _FAST_MUTEX
{
/* 0x0000 */ long Count;
/* 0x0008 */ void* Owner;
/* 0x0010 */ unsigned long Contention;
/* 0x0018 */ struct _KEVENT Event;
/* 0x0030 */ unsigned long OldIrql;
/* 0x0034 */ long __PADDING__[1];
} FAST_MUTEX, *PFAST_MUTEX; /* size: 0x0038 */
typedef struct _FILE_BASIC_INFORMATION
{
/* 0x0000 */ union _LARGE_INTEGER CreationTime;
/* 0x0008 */ union _LARGE_INTEGER LastAccessTime;
/* 0x0010 */ union _LARGE_INTEGER LastWriteTime;
/* 0x0018 */ union _LARGE_INTEGER ChangeTime;
/* 0x0020 */ unsigned long FileAttributes;
/* 0x0024 */ long __PADDING__[1];
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; /* size: 0x0028 */
struct _FILE_GET_QUOTA_INFORMATION;
typedef enum _FILE_INFORMATION_CLASS
{
FileDirectoryInformation = 1,
FileFullDirectoryInformation = 2,
FileBothDirectoryInformation = 3,
FileBasicInformation = 4,
FileStandardInformation = 5,
FileInternalInformation = 6,
FileEaInformation = 7,
FileAccessInformation = 8,
FileNameInformation = 9,
FileRenameInformation = 10,
FileLinkInformation = 11,
FileNamesInformation = 12,
FileDispositionInformation = 13,
FilePositionInformation = 14,
FileFullEaInformation = 15,
FileModeInformation = 16,
FileAlignmentInformation = 17,
FileAllInformation = 18,
FileAllocationInformation = 19,
FileEndOfFileInformation = 20,
FileAlternateNameInformation = 21,
FileStreamInformation = 22,
FilePipeInformation = 23,
FilePipeLocalInformation = 24,
FilePipeRemoteInformation = 25,
FileMailslotQueryInformation = 26,
FileMailslotSetInformation = 27,
FileCompressionInformation = 28,
FileObjectIdInformation = 29,
FileCompletionInformation = 30,
FileMoveClusterInformation = 31,
FileQuotaInformation = 32,
FileReparsePointInformation = 33,
FileNetworkOpenInformation = 34,
FileAttributeTagInformation = 35,
FileTrackingInformation = 36,
FileIdBothDirectoryInformation = 37,
FileIdFullDirectoryInformation = 38,
FileValidDataLengthInformation = 39,
FileShortNameInformation = 40,
FileIoCompletionNotificationInformation = 41,
FileIoStatusBlockRangeInformation = 42,
FileIoPriorityHintInformation = 43,
FileSfioReserveInformation = 44,
FileSfioVolumeInformation = 45,
FileHardLinkInformation = 46,
FileProcessIdsUsingFileInformation = 47,
FileNormalizedNameInformation = 48,
FileNetworkPhysicalNameInformation = 49,
FileIdGlobalTxDirectoryInformation = 50,
FileIsRemoteDeviceInformation = 51,
FileUnusedInformation = 52,
FileNumaNodeInformation = 53,
FileStandardLinkInformation = 54,
FileRemoteProtocolInformation = 55,
FileRenameInformationBypassAccessCheck = 56,
FileLinkInformationBypassAccessCheck = 57,
FileVolumeNameInformation = 58,
FileIdInformation = 59,
FileIdExtdDirectoryInformation = 60,
FileReplaceCompletionInformation = 61,
FileHardLinkFullIdInformation = 62,
FileIdExtdBothDirectoryInformation = 63,
FileMaximumInformation = 64,
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
typedef struct _FILE_NETWORK_OPEN_INFORMATION
{
/* 0x0000 */ union _LARGE_INTEGER CreationTime;
/* 0x0008 */ union _LARGE_INTEGER LastAccessTime;
/* 0x0010 */ union _LARGE_INTEGER LastWriteTime;
/* 0x0018 */ union _LARGE_INTEGER ChangeTime;
/* 0x0020 */ union _LARGE_INTEGER AllocationSize;
/* 0x0028 */ union _LARGE_INTEGER EndOfFile;
/* 0x0030 */ unsigned long FileAttributes;
/* 0x0034 */ long __PADDING__[1];
} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION; /* size: 0x0038 */
typedef struct _FILE_OBJECT
{
/* 0x0000 */ short Type;
/* 0x0002 */ short Size;
/* 0x0008 */ struct _DEVICE_OBJECT* DeviceObject;
/* 0x0010 */ struct _VPB* Vpb;
/* 0x0018 */ void* FsContext;
/* 0x0020 */ void* FsContext2;
/* 0x0028 */ struct _SECTION_OBJECT_POINTERS* SectionObjectPointer;
/* 0x0030 */ void* PrivateCacheMap;
/* 0x0038 */ long FinalStatus;
/* 0x0040 */ struct _FILE_OBJECT* RelatedFileObject;
/* 0x0048 */ unsigned char LockOperation;
/* 0x0049 */ unsigned char DeletePending;
/* 0x004a */ unsigned char ReadAccess;
/* 0x004b */ unsigned char WriteAccess;
/* 0x004c */ unsigned char DeleteAccess;
/* 0x004d */ unsigned char SharedRead;
/* 0x004e */ unsigned char SharedWrite;
/* 0x004f */ unsigned char SharedDelete;
/* 0x0050 */ unsigned long Flags;
/* 0x0058 */ struct _UNICODE_STRING FileName;
/* 0x0068 */ union _LARGE_INTEGER CurrentByteOffset;
/* 0x0070 */ unsigned long Waiters;
/* 0x0074 */ unsigned long Busy;
/* 0x0078 */ void* LastLock;
/* 0x0080 */ struct _KEVENT Lock;
/* 0x0098 */ struct _KEVENT Event;
/* 0x00b0 */ struct _IO_COMPLETION_CONTEXT* CompletionContext;
/* 0x00b8 */ unsigned __int64 IrpListLock;
/* 0x00c0 */ struct _LIST_ENTRY IrpList;
/* 0x00d0 */ void* FileObjectExtension;
} FILE_OBJECT, *PFILE_OBJECT; /* size: 0x00d8 */
typedef struct _FILE_STANDARD_INFORMATION
{
/* 0x0000 */ union _LARGE_INTEGER AllocationSize;
/* 0x0008 */ union _LARGE_INTEGER EndOfFile;
/* 0x0010 */ unsigned long NumberOfLinks;
/* 0x0014 */ unsigned char DeletePending;
/* 0x0015 */ unsigned char Directory;
/* 0x0016 */ char __PADDING__[2];
} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; /* size: 0x0018 */
typedef enum _FSINFOCLASS
{
FileFsVolumeInformation = 1,
FileFsLabelInformation = 2,
FileFsSizeInformation = 3,
FileFsDeviceInformation = 4,
FileFsAttributeInformation = 5,
FileFsControlInformation = 6,
FileFsFullSizeInformation = 7,
FileFsObjectIdInformation = 8,
FileFsDriverPathInformation = 9,
FileFsVolumeFlagsInformation = 10,
FileFsSectorSizeInformation = 11,
FileFsDataCopyInformation = 12,
FileFsMetadataSizeInformation = 13,
FileFsMaximumInformation = 14,
} FSINFOCLASS, *PFSINFOCLASS;
typedef struct _GENERAL_LOOKASIDE
{
union
{
/* 0x0000 */ union _SLIST_HEADER ListHead;
/* 0x0000 */ struct _SINGLE_LIST_ENTRY SingleListHead;
}; /* size: 0x0010 */
/* 0x0010 */ unsigned short Depth;
/* 0x0012 */ unsigned short MaximumDepth;
/* 0x0014 */ unsigned long TotalAllocates;
union
{
/* 0x0018 */ unsigned long AllocateMisses;
/* 0x0018 */ unsigned long AllocateHits;
}; /* size: 0x0004 */
/* 0x001c */ unsigned long TotalFrees;
union
{
/* 0x0020 */ unsigned long FreeMisses;
/* 0x0020 */ unsigned long FreeHits;
}; /* size: 0x0004 */
/* 0x0024 */ enum _POOL_TYPE Type;
/* 0x0028 */ unsigned long Tag;
/* 0x002c */ unsigned long Size;
union
{
/* 0x0030 */ void* AllocateEx /* function */;
/* 0x0030 */ void* Allocate /* function */;
}; /* size: 0x0008 */
union
{
/* 0x0038 */ void* FreeEx /* function */;
/* 0x0038 */ void* Free /* function */;
}; /* size: 0x0008 */
/* 0x0040 */ struct _LIST_ENTRY ListEntry;
/* 0x0050 */ unsigned long LastTotalAllocates;
union
{
/* 0x0054 */ unsigned long LastAllocateMisses;
/* 0x0054 */ unsigned long LastAllocateHits;
}; /* size: 0x0004 */
/* 0x0058 */ unsigned long Future[2];
/* 0x0060 */ long __PADDING__[8];
} GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE; /* size: 0x0080 */
typedef struct _GENERAL_LOOKASIDE_POOL
{
union
{
/* 0x0000 */ union _SLIST_HEADER ListHead;
/* 0x0000 */ struct _SINGLE_LIST_ENTRY SingleListHead;
}; /* size: 0x0010 */
/* 0x0010 */ unsigned short Depth;
/* 0x0012 */ unsigned short MaximumDepth;
/* 0x0014 */ unsigned long TotalAllocates;
union
{
/* 0x0018 */ unsigned long AllocateMisses;
/* 0x0018 */ unsigned long AllocateHits;
}; /* size: 0x0004 */
/* 0x001c */ unsigned long TotalFrees;
union
{
/* 0x0020 */ unsigned long FreeMisses;
/* 0x0020 */ unsigned long FreeHits;
}; /* size: 0x0004 */
/* 0x0024 */ enum _POOL_TYPE Type;
/* 0x0028 */ unsigned long Tag;
/* 0x002c */ unsigned long Size;
union
{
/* 0x0030 */ void* AllocateEx /* function */;
/* 0x0030 */ void* Allocate /* function */;
}; /* size: 0x0008 */
union
{
/* 0x0038 */ void* FreeEx /* function */;
/* 0x0038 */ void* Free /* function */;
}; /* size: 0x0008 */
/* 0x0040 */ struct _LIST_ENTRY ListEntry;
/* 0x0050 */ unsigned long LastTotalAllocates;
union
{
/* 0x0054 */ unsigned long LastAllocateMisses;
/* 0x0054 */ unsigned long LastAllocateHits;
}; /* size: 0x0004 */
/* 0x0058 */ unsigned long Future[2];
} GENERAL_LOOKASIDE_POOL, *PGENERAL_LOOKASIDE_POOL; /* size: 0x0060 */
typedef struct _GEN_ADDR
{
/* 0x0000 */ unsigned char AddressSpaceID;
/* 0x0001 */ unsigned char BitWidth;
/* 0x0002 */ unsigned char BitOffset;
/* 0x0003 */ unsigned char AccessSize;
/* 0x0004 */ union _LARGE_INTEGER Address;
} GEN_ADDR, *PGEN_ADDR; /* size: 0x000c */
typedef struct _GROUP_AFFINITY
{
/* 0x0000 */ unsigned __int64 Mask;
/* 0x0008 */ unsigned short Group;
/* 0x000a */ unsigned short Reserved[3];
} GROUP_AFFINITY, *PGROUP_AFFINITY; /* size: 0x0010 */
typedef struct _GUID
{
/* 0x0000 */ unsigned long Data1;
/* 0x0004 */ unsigned short Data2;
/* 0x0006 */ unsigned short Data3;
/* 0x0008 */ unsigned char Data4[8];
} GUID, *PGUID; /* size: 0x0010 */
typedef struct _HALP_ALLOC_CONTEXT
{
/* 0x0000 */ struct _LIST_ENTRY BufferList;
/* 0x0010 */ unsigned __int64 Lock;
} HALP_ALLOC_CONTEXT, *PHALP_ALLOC_CONTEXT; /* size: 0x0018 */
typedef enum _HALP_DMA_MAP_BUFFER_TYPE
{
HalpDmaContiguousMapBuffer = 0,
HalpDmaNonContiguousMapBuffer = 1,
HalpDmaMaximumMapBufferType = 2,
} HALP_DMA_MAP_BUFFER_TYPE, *PHALP_DMA_MAP_BUFFER_TYPE;
typedef enum _HAL_DMA_CRASH_DUMP_REGISTER_TYPE
{
HalDmaCrashDumpRegisterSet1 = 0,
HalDmaCrashDumpRegisterSet2 = 1,
HalDmaCrashDumpRegisterSetMax = 2,
} HAL_DMA_CRASH_DUMP_REGISTER_TYPE, *PHAL_DMA_CRASH_DUMP_REGISTER_TYPE;
typedef struct _HAL_HV_SVM_DEVICE_CAPABILITIES
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long SvmSupported : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long PciExecute : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long NoExecute : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long Reserved : 28; /* bit position: 3 */
/* 0x0000 */ unsigned long OverflowPossible : 1; /* bit position: 31 */
}; /* bitfield */
/* 0x0004 */ unsigned long PasidCount;
/* 0x0008 */ unsigned long IommuIndex;
} HAL_HV_SVM_DEVICE_CAPABILITIES, *PHAL_HV_SVM_DEVICE_CAPABILITIES; /* size: 0x000c */
typedef struct _HAL_HV_SVM_SYSTEM_CAPABILITIES
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long SvmSupported : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long GpaAlwaysValid : 1; /* bit position: 1 */
}; /* bitfield */
/* 0x0004 */ unsigned long MaxPasidSpaceCount;
/* 0x0008 */ unsigned long MaxPasidSpacePasidCount;
/* 0x000c */ unsigned long MaxPrqSize;
/* 0x0010 */ unsigned long IommuCount;
/* 0x0014 */ unsigned long MinIommuPasidCount;
} HAL_HV_SVM_SYSTEM_CAPABILITIES, *PHAL_HV_SVM_SYSTEM_CAPABILITIES; /* size: 0x0018 */
typedef enum _HAL_INIT_PHASE
{
HalInitPhaseBspProcEarly = 0,
HalInitPhaseBspProcEarlyMmReady = 1,
HalInitPhaseBspProcEarlyTimerReady = 2,
HalInitPhaseBspProcEarlyEnd = 3,
HalInitPhasePnProcEarly = 4,
HalInitPhasePnProcEarlyEnd = 5,
HalInitPhaseBspSystemEarly = 6,
HalInitPhaseBspSystemEarlyAcpiReady = 7,
HalInitPhaseBspSystemEarlyHalExtensionsReady = 8,
HalInitPhaseBspSystemEarlyInterruptsAlmostReady = 9,
HalInitPhaseBspSystemEarlyIommusReady = 10,
HalInitPhaseBspSystemEarlyInterruptsReady = 11,
HalInitPhaseBspSystemEarlyDmaReady = 11,
HalInitPhaseBspSystemEarlyProcReady = 12,
HalInitPhaseBspSystemEarlyHwPerfCntReady = 13,
HalInitPhaseBspSystemEarlyEnd = 14,
HalInitPhaseBspSystemLate = 15,
HalInitPhaseBspSystemLateEnd = 16,
HalInitPhasePnSystemLate = 17,
HalInitPhasePnSystemLateEnd = 18,
HalInitPhaseAllProcStartComplete = 19,
HalInitPhaseAllProcStartCompleteEnd = 20,
HalInitPhaseAcpiPdoStarted = 21,
HalInitPhaseAcpiPdoStartedEnd = 22,
HalInitPhaseReportResources = 23,
HalInitPhaseReportResourcesEnd = 24,
HalInitPhaseReportCoreSystemResources = 25,
HalInitPhaseReportCoreSystemResourcesEnd = 26,
HalInitPhaseInitializeTelemetry = 27,
HalInitPhaseTelemetryReady = 28,
HalInitPhaseTelemetryEnd = 29,
} HAL_INIT_PHASE, *PHAL_INIT_PHASE;
typedef struct _HAL_INTEL_ENLIGHTENMENT_INFORMATION
{
/* 0x0000 */ unsigned long Enlightenments;
/* 0x0004 */ unsigned long HypervisorConnected;
/* 0x0008 */ void* EndOfInterrupt /* function */;
/* 0x0010 */ void* ApicWriteIcr /* function */;
/* 0x0018 */ unsigned long Reserved0;
/* 0x001c */ unsigned long SpinCountMask;
/* 0x0020 */ void* LongSpinWait /* function */;
/* 0x0028 */ void* GetReferenceTime /* function */;
/* 0x0030 */ void* SetSystemSleepProperty /* function */;
/* 0x0038 */ void* EnterSleepState /* function */;
/* 0x0040 */ void* NotifyDebugDeviceAvailable /* function */;
/* 0x0048 */ void* MapDeviceInterrupt /* function */;
/* 0x0050 */ void* UnmapDeviceInterrupt /* function */;
/* 0x0058 */ void* RetargetDeviceInterrupt /* function */;
/* 0x0060 */ void* SetHpetConfig /* function */;
/* 0x0068 */ void* NotifyHpetEnabled /* function */;
/* 0x0070 */ void* QueryAssociatedProcessors /* function */;
/* 0x0078 */ void* ReadMultipleMsr /* function */;
/* 0x0080 */ void* WriteMultipleMsr /* function */;
/* 0x0088 */ void* ReadCpuid /* function */;
/* 0x0090 */ void* LpWritebackInvalidate /* function */;
/* 0x0098 */ void* GetMachineCheckContext /* function */;
/* 0x00a0 */ void* SuspendPartition /* function */;
/* 0x00a8 */ void* ResumePartition /* function */;
/* 0x00b0 */ void* SetSystemMachineCheckProperty /* function */;
/* 0x00b8 */ void* WheaErrorNotification /* function */;
/* 0x00c0 */ void* GetProcessorIndexFromVpIndex /* function */;
/* 0x00c8 */ void* SyntheticClusterIpi /* function */;
/* 0x00d0 */ void* VpStartEnabled /* function */;
/* 0x00d8 */ void* StartVirtualProcessor /* function */;
/* 0x00e0 */ void* GetVpIndexFromApicId /* function */;
/* 0x00e8 */ void* IumEfiRuntimeService /* function */;
/* 0x00f0 */ void* SvmGetSystemCapabilities /* function */;
/* 0x00f8 */ void* SvmGetDeviceCapabilities /* function */;
/* 0x0100 */ void* SvmCreatePasidSpace /* function */;
/* 0x0108 */ void* SvmSetPasidAddressSpace /* function */;
/* 0x0110 */ void* SvmFlushPasid /* function */;
/* 0x0118 */ void* SvmAttachPasidSpace /* function */;
/* 0x0120 */ void* SvmDetachPasidSpace /* function */;
/* 0x0128 */ void* SvmEnablePasid /* function */;
/* 0x0130 */ void* SvmDisablePasid /* function */;
/* 0x0138 */ void* SvmAcknowledgePageRequest /* function */;
/* 0x0140 */ void* SvmCreatePrQueue /* function */;
/* 0x0148 */ void* SvmDeletePrQueue /* function */;
/* 0x0150 */ void* SvmClearPrqStalled /* function */;
/* 0x0158 */ void* SvmSetDeviceEnabled /* function */;
} HAL_INTEL_ENLIGHTENMENT_INFORMATION, *PHAL_INTEL_ENLIGHTENMENT_INFORMATION; /* size: 0x0160 */
typedef struct _HARDWARE_PTE
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 Valid : 1; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 Write : 1; /* bit position: 1 */
/* 0x0000 */ unsigned __int64 Owner : 1; /* bit position: 2 */
/* 0x0000 */ unsigned __int64 WriteThrough : 1; /* bit position: 3 */
/* 0x0000 */ unsigned __int64 CacheDisable : 1; /* bit position: 4 */
/* 0x0000 */ unsigned __int64 Accessed : 1; /* bit position: 5 */
/* 0x0000 */ unsigned __int64 Dirty : 1; /* bit position: 6 */
/* 0x0000 */ unsigned __int64 LargePage : 1; /* bit position: 7 */
/* 0x0000 */ unsigned __int64 Global : 1; /* bit position: 8 */
/* 0x0000 */ unsigned __int64 CopyOnWrite : 1; /* bit position: 9 */
/* 0x0000 */ unsigned __int64 Prototype : 1; /* bit position: 10 */
/* 0x0000 */ unsigned __int64 reserved0 : 1; /* bit position: 11 */
/* 0x0000 */ unsigned __int64 PageFrameNumber : 36; /* bit position: 12 */
/* 0x0000 */ unsigned __int64 reserved1 : 4; /* bit position: 48 */
/* 0x0000 */ unsigned __int64 SoftwareWsIndex : 11; /* bit position: 52 */
/* 0x0000 */ unsigned __int64 NoExecute : 1; /* bit position: 63 */
}; /* bitfield */
} HARDWARE_PTE, *PHARDWARE_PTE; /* size: 0x0008 */
typedef struct _INITIAL_PRIVILEGE_SET
{
/* 0x0000 */ unsigned long PrivilegeCount;
/* 0x0004 */ unsigned long Control;
/* 0x0008 */ struct _LUID_AND_ATTRIBUTES Privilege[3];
} INITIAL_PRIVILEGE_SET, *PINITIAL_PRIVILEGE_SET; /* size: 0x002c */
typedef struct _INTERFACE
{
/* 0x0000 */ unsigned short Size;
/* 0x0002 */ unsigned short Version;
/* 0x0008 */ void* Context;
/* 0x0010 */ void* InterfaceReference /* function */;
/* 0x0018 */ void* InterfaceDereference /* function */;
} INTERFACE, *PINTERFACE; /* size: 0x0020 */
typedef enum _INTERFACE_TYPE
{
InterfaceTypeUndefined = -1,
Internal = 0,
Isa = 1,
Eisa = 2,
MicroChannel = 3,
TurboChannel = 4,
PCIBus = 5,
VMEBus = 6,
NuBus = 7,
PCMCIABus = 8,
CBus = 9,
MPIBus = 10,
MPSABus = 11,
ProcessorInternal = 12,
InternalPowerBus = 13,
PNPISABus = 14,
PNPBus = 15,
Vmcs = 16,
ACPIBus = 17,
MaximumInterfaceType = 18,
} INTERFACE_TYPE, *PINTERFACE_TYPE;
typedef enum _INTERLOCKED_RESULT
{
ResultNegative = 1,
ResultZero = 0,
ResultPositive = 2,
} INTERLOCKED_RESULT, *PINTERLOCKED_RESULT;
typedef struct _INTERRUPT_FUNCTION_TABLE
{
/* 0x0000 */ void* InitializeLocalUnit /* function */;
/* 0x0008 */ void* InitializeIoUnit /* function */;
/* 0x0010 */ void* SetPriority /* function */;
/* 0x0018 */ void* GetLocalUnitError /* function */;
/* 0x0020 */ void* ClearLocalUnitError /* function */;
/* 0x0028 */ void* GetLogicalId /* function */;
/* 0x0030 */ void* SetLogicalId /* function */;
/* 0x0038 */ void* AcceptAndGetSource /* function */;
/* 0x0040 */ void* EndOfInterrupt /* function */;
/* 0x0048 */ void* FastEndOfInterrupt /* function */;
/* 0x0050 */ void* SetLineState /* function */;
/* 0x0058 */ void* RequestInterrupt /* function */;
/* 0x0060 */ void* StartProcessor /* function */;
/* 0x0068 */ void* GenerateMessage /* function */;
/* 0x0070 */ void* ConvertId /* function */;
/* 0x0078 */ void* SaveLocalInterrupts /* function */;
/* 0x0080 */ void* ReplayLocalInterrupts /* function */;
/* 0x0088 */ void* DeinitializeLocalUnit /* function */;
/* 0x0090 */ void* DeinitializeIoUnit /* function */;
/* 0x0098 */ void* QueryAndGetSource /* function */;
} INTERRUPT_FUNCTION_TABLE, *PINTERRUPT_FUNCTION_TABLE; /* size: 0x00a0 */
typedef struct _INTERRUPT_LINE
{
/* 0x0000 */ unsigned long UnitId;
/* 0x0004 */ long Line;
} INTERRUPT_LINE, *PINTERRUPT_LINE; /* size: 0x0008 */
typedef struct _INTERRUPT_LINE_STATE
{
/* 0x0000 */ enum _KINTERRUPT_POLARITY Polarity;
/* 0x0004 */ unsigned char EmulateActiveBoth;
/* 0x0008 */ enum _KINTERRUPT_MODE TriggerMode;
/* 0x000c */ unsigned long Flags;
/* 0x0010 */ struct _INTERRUPT_LINE Routing;
/* 0x0018 */ struct _INTERRUPT_TARGET ProcessorTarget;
/* 0x0030 */ unsigned long Vector;
/* 0x0034 */ unsigned long Priority;
} INTERRUPT_LINE_STATE, *PINTERRUPT_LINE_STATE; /* size: 0x0038 */
typedef enum _INTERRUPT_PROBLEM
{
InterruptProblemNone = 0,
InterruptProblemMadtParsingFailure = 1,
InterruptProblemNoControllersFound = 2,
InterruptProblemFailedDiscovery = 3,
InterruptProblemInitializeLocalUnitFailed = 4,
InterruptProblemInitializeIoUnitFailed = 5,
InterruptProblemSetLogicalIdFailed = 6,
InterruptProblemSetLineStateFailed = 7,
InterruptProblemGenerateMessageFailed = 8,
InterruptProblemConvertIdFailed = 9,
InterruptProblemCmciSetupFailed = 10,
InterruptProblemQueryMaxProcessorsCalledTooEarly = 11,
InterruptProblemProcessorReset = 12,
InterruptProblemStartProcessorFailed = 13,
InterruptProblemProcessorNotAlive = 14,
InterruptProblemLowerIrqlViolation = 15,
InterruptProblemInvalidIrql = 16,
InterruptProblemNoSuchController = 17,
InterruptProblemNoSuchLines = 18,
InterruptProblemBadConnectionData = 19,
InterruptProblemBadRoutingData = 20,
InterruptProblemInvalidProcessor = 21,
InterruptProblemFailedToAttainTarget = 22,
InterruptProblemUnsupportedWiringConfiguration = 23,
InterruptProblemSpareAlreadyStarted = 24,
InterruptProblemClusterNotFullyReplaced = 25,
InterruptProblemNewClusterAlreadyActive = 26,
InterruptProblemNewClusterTooLarge = 27,
InterruptProblemCannotHardwareQuiesce = 28,
InterruptProblemIpiDestinationUpdateFailed = 29,
InterruptProblemNoMemory = 30,
InterruptProblemNoIrtEntries = 31,
InterruptProblemConnectionDataBaitAndSwitch = 32,
InterruptProblemInvalidLogicalFlatId = 33,
InterruptProblemDeinitializeLocalUnitFailed = 34,
InterruptProblemDeinitializeIoUnitFailed = 35,
InterruptProblemMismatchedThermalLvtIsr = 36,
} INTERRUPT_PROBLEM, *PINTERRUPT_PROBLEM;
typedef enum _INTERRUPT_RESULT
{
InterruptBeginFatalError = 0,
InterruptBeginLine = 1,
InterruptBeginSpurious = 2,
InterruptBeginVector = 3,
InterruptBeginNone = 4,
} INTERRUPT_RESULT, *PINTERRUPT_RESULT;
typedef struct _INTERRUPT_TARGET
{
/* 0x0000 */ enum _INTERRUPT_TARGET_TYPE Target;
union
{
/* 0x0008 */ unsigned long PhysicalTarget;
/* 0x0008 */ unsigned long LogicalFlatTarget;
/* 0x0008 */ unsigned long RemapIndex;
struct
{
/* 0x0008 */ unsigned long ClusterId;
/* 0x000c */ unsigned long ClusterMask;
}; /* size: 0x0008 */
struct // _TAG_UNNAMED_17
{
/* 0x0008 */ unsigned long Low32;
/* 0x000c */ unsigned long High32;
/* 0x0010 */ unsigned __int64 InterruptData;
} /* size: 0x0010 */ HypervisorTarget;
}; /* size: 0x0010 */
} INTERRUPT_TARGET, *PINTERRUPT_TARGET; /* size: 0x0018 */
typedef enum _INTERRUPT_TARGET_TYPE
{
InterruptTargetInvalid = 0,
InterruptTargetAllIncludingSelf = 1,
InterruptTargetAllExcludingSelf = 2,
InterruptTargetSelfOnly = 3,
InterruptTargetPhysical = 4,
InterruptTargetLogicalFlat = 5,
InterruptTargetLogicalClustered = 6,
InterruptTargetRemapIndex = 7,
InterruptTargetHypervisor = 8,
} INTERRUPT_TARGET_TYPE, *PINTERRUPT_TARGET_TYPE;
typedef struct _IOAPIC
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char IOAPICID;
/* 0x0003 */ unsigned char Reserved;
/* 0x0004 */ unsigned long IOAPICAddress;
/* 0x0008 */ unsigned long SystemVectorBase;
} IOAPIC, *PIOAPIC; /* size: 0x000c */
typedef struct _IOSAPIC
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char IOSAPICID;
/* 0x0003 */ unsigned char Reserved;
/* 0x0004 */ unsigned long SystemVectorBase;
/* 0x0008 */ unsigned __int64 IOSAPICAddress;
} IOSAPIC, *PIOSAPIC; /* size: 0x0010 */
typedef enum _IO_ALLOCATION_ACTION
{
KeepObject = 1,
DeallocateObject = 2,
DeallocateObjectKeepRegisters = 3,
} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
typedef struct _IO_APIC_DATA
{
/* 0x0000 */ unsigned __int64 PhysicalAddress;
/* 0x0008 */ unsigned long Identifier;
/* 0x0010 */ struct _IO_APIC_REGISTERS* BaseAddress;
/* 0x0018 */ unsigned char Version;
/* 0x0019 */ unsigned char PinCount;
/* 0x001a */ unsigned char Initialized;
/* 0x001b */ unsigned char InitializedFirstLocalUnit;
/* 0x001c */ unsigned long GsiBase;
/* 0x0020 */ unsigned long CmciRegister;
/* 0x0024 */ unsigned char IoUnitMissing;
/* 0x0025 */ char __PADDING__[3];
} IO_APIC_DATA, *PIO_APIC_DATA; /* size: 0x0028 */
typedef struct _IO_APIC_REGISTERS
{
/* 0x0000 */ volatile unsigned long RegisterIndex;
/* 0x0004 */ volatile unsigned long Reserved1[3];
/* 0x0010 */ volatile unsigned long RegisterValue;
} IO_APIC_REGISTERS, *PIO_APIC_REGISTERS; /* size: 0x0014 */
typedef struct _IO_COMPLETION_CONTEXT
{
/* 0x0000 */ void* Port;
/* 0x0008 */ void* Key;
} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT; /* size: 0x0010 */
typedef struct _IO_DRIVER_CREATE_CONTEXT
{
/* 0x0000 */ short Size;
/* 0x0008 */ struct _ECP_LIST* ExtraCreateParameter;
/* 0x0010 */ void* DeviceObjectHint;
/* 0x0018 */ struct _TXN_PARAMETER_BLOCK* TxnParameters;
/* 0x0020 */ struct _ESILO* SiloContext;
} IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT; /* size: 0x0028 */
typedef struct _IO_NMISOURCE
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned short Flags;
/* 0x0004 */ unsigned long GlobalSystemInterruptVector;
} IO_NMISOURCE, *PIO_NMISOURCE; /* size: 0x0008 */
typedef struct _IO_RESOURCE_DESCRIPTOR
{
/* 0x0000 */ unsigned char Option;
/* 0x0001 */ unsigned char Type;
/* 0x0002 */ unsigned char ShareDisposition;
/* 0x0003 */ unsigned char Spare1;
/* 0x0004 */ unsigned short Flags;
/* 0x0006 */ unsigned short Spare2;
union // _TAG_UNNAMED_18
{
union
{
struct // _TAG_UNNAMED_19
{
/* 0x0008 */ unsigned long Length;
/* 0x000c */ unsigned long Alignment;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Port;
struct // _TAG_UNNAMED_19
{
/* 0x0008 */ unsigned long Length;
/* 0x000c */ unsigned long Alignment;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Memory;
struct // _TAG_UNNAMED_20
{
/* 0x0008 */ unsigned long MinimumVector;
/* 0x000c */ unsigned long MaximumVector;
/* 0x0010 */ unsigned short AffinityPolicy;
/* 0x0012 */ unsigned short Group;
/* 0x0014 */ enum _IRQ_PRIORITY PriorityPolicy;
/* 0x0018 */ unsigned __int64 TargetedProcessors;
} /* size: 0x0018 */ Interrupt;
struct // _TAG_UNNAMED_21
{
/* 0x0008 */ unsigned long MinimumChannel;
/* 0x000c */ unsigned long MaximumChannel;
} /* size: 0x0008 */ Dma;
struct // _TAG_UNNAMED_22
{
/* 0x0008 */ unsigned long RequestLine;
/* 0x000c */ unsigned long Reserved;
/* 0x0010 */ unsigned long Channel;
/* 0x0014 */ unsigned long TransferWidth;
} /* size: 0x0010 */ DmaV3;
struct // _TAG_UNNAMED_19
{
/* 0x0008 */ unsigned long Length;
/* 0x000c */ unsigned long Alignment;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Generic;
struct // _TAG_UNNAMED_9
{
/* 0x0008 */ unsigned long Data[3];
} /* size: 0x000c */ DevicePrivate;
struct // _TAG_UNNAMED_23
{
/* 0x0008 */ unsigned long Length;
/* 0x000c */ unsigned long MinBusNumber;
/* 0x0010 */ unsigned long MaxBusNumber;
/* 0x0014 */ unsigned long Reserved;
} /* size: 0x0010 */ BusNumber;
struct // _TAG_UNNAMED_24
{
/* 0x0008 */ unsigned long Priority;
/* 0x000c */ unsigned long Reserved1;
/* 0x0010 */ unsigned long Reserved2;
} /* size: 0x000c */ ConfigData;
struct // _TAG_UNNAMED_25
{
/* 0x0008 */ unsigned long Length40;
/* 0x000c */ unsigned long Alignment40;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Memory40;
struct // _TAG_UNNAMED_26
{
/* 0x0008 */ unsigned long Length48;
/* 0x000c */ unsigned long Alignment48;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Memory48;
struct // _TAG_UNNAMED_27
{
/* 0x0008 */ unsigned long Length64;
/* 0x000c */ unsigned long Alignment64;
/* 0x0010 */ union _LARGE_INTEGER MinimumAddress;
/* 0x0018 */ union _LARGE_INTEGER MaximumAddress;
} /* size: 0x0018 */ Memory64;
struct // _TAG_UNNAMED_15
{
/* 0x0008 */ unsigned char Class;
/* 0x0009 */ unsigned char Type;
/* 0x000a */ unsigned char Reserved1;
/* 0x000b */ unsigned char Reserved2;
/* 0x000c */ unsigned long IdLowPart;
/* 0x0010 */ unsigned long IdHighPart;
} /* size: 0x000c */ Connection;
}; /* size: 0x0018 */
} /* size: 0x0018 */ u;
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; /* size: 0x0020 */
typedef struct _IO_RESOURCE_LIST
{
/* 0x0000 */ unsigned short Version;
/* 0x0002 */ unsigned short Revision;
/* 0x0004 */ unsigned long Count;
/* 0x0008 */ struct _IO_RESOURCE_DESCRIPTOR Descriptors[1];
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; /* size: 0x0028 */
typedef struct _IO_RESOURCE_REQUIREMENTS_LIST
{
/* 0x0000 */ unsigned long ListSize;
/* 0x0004 */ enum _INTERFACE_TYPE InterfaceType;
/* 0x0008 */ unsigned long BusNumber;
/* 0x000c */ unsigned long SlotNumber;
/* 0x0010 */ unsigned long Reserved[3];
/* 0x001c */ unsigned long AlternativeLists;
/* 0x0020 */ struct _IO_RESOURCE_LIST List[1];
} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; /* size: 0x0048 */
typedef struct _IO_SECURITY_CONTEXT
{
/* 0x0000 */ struct _SECURITY_QUALITY_OF_SERVICE* SecurityQos;
/* 0x0008 */ struct _ACCESS_STATE* AccessState;
/* 0x0010 */ unsigned long DesiredAccess;
/* 0x0014 */ unsigned long FullCreateOptions;
} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT; /* size: 0x0018 */
typedef struct _IO_STACK_LOCATION
{
/* 0x0000 */ unsigned char MajorFunction;
/* 0x0001 */ unsigned char MinorFunction;
/* 0x0002 */ unsigned char Flags;
/* 0x0003 */ unsigned char Control;
union // _TAG_UNNAMED_28
{
union
{
struct // _TAG_UNNAMED_29
{
/* 0x0008 */ struct _IO_SECURITY_CONTEXT* SecurityContext;
/* 0x0010 */ unsigned long Options;
/* 0x0018 */ unsigned short FileAttributes;
/* 0x001a */ unsigned short ShareAccess;
/* 0x0020 */ unsigned long EaLength;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ Create;
struct // _TAG_UNNAMED_30
{
/* 0x0008 */ struct _IO_SECURITY_CONTEXT* SecurityContext;
/* 0x0010 */ unsigned long Options;
/* 0x0018 */ unsigned short Reserved;
/* 0x001a */ unsigned short ShareAccess;
/* 0x0020 */ struct _NAMED_PIPE_CREATE_PARAMETERS* Parameters;
} /* size: 0x0020 */ CreatePipe;
struct // _TAG_UNNAMED_31
{
/* 0x0008 */ struct _IO_SECURITY_CONTEXT* SecurityContext;
/* 0x0010 */ unsigned long Options;
/* 0x0018 */ unsigned short Reserved;
/* 0x001a */ unsigned short ShareAccess;
/* 0x0020 */ struct _MAILSLOT_CREATE_PARAMETERS* Parameters;
} /* size: 0x0020 */ CreateMailslot;
struct // _TAG_UNNAMED_32
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ unsigned long Key;
/* 0x0018 */ union _LARGE_INTEGER ByteOffset;
} /* size: 0x0018 */ Read;
struct // _TAG_UNNAMED_32
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ unsigned long Key;
/* 0x0018 */ union _LARGE_INTEGER ByteOffset;
} /* size: 0x0018 */ Write;
struct // _TAG_UNNAMED_33
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ struct _UNICODE_STRING* FileName;
/* 0x0018 */ enum _FILE_INFORMATION_CLASS FileInformationClass;
/* 0x0020 */ unsigned long FileIndex;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ QueryDirectory;
struct // _TAG_UNNAMED_34
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ unsigned long CompletionFilter;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ NotifyDirectory;
struct // _TAG_UNNAMED_35
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ enum _FILE_INFORMATION_CLASS FileInformationClass;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ QueryFile;
struct // _TAG_UNNAMED_36
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ enum _FILE_INFORMATION_CLASS FileInformationClass;
/* 0x0018 */ struct _FILE_OBJECT* FileObject;
union
{
struct
{
/* 0x0020 */ unsigned char ReplaceIfExists;
/* 0x0021 */ unsigned char AdvanceOnly;
}; /* size: 0x0002 */
/* 0x0020 */ unsigned long ClusterCount;
/* 0x0020 */ void* DeleteHandle;
}; /* size: 0x0008 */
} /* size: 0x0020 */ SetFile;
struct // _TAG_UNNAMED_37
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ void* EaList;
/* 0x0018 */ unsigned long EaListLength;
/* 0x0020 */ unsigned long EaIndex;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ QueryEa;
struct // _TAG_UNNAMED_38
{
/* 0x0008 */ unsigned long Length;
} /* size: 0x0004 */ SetEa;
struct // _TAG_UNNAMED_39
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ enum _FSINFOCLASS FsInformationClass;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ QueryVolume;
struct // _TAG_UNNAMED_39
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ enum _FSINFOCLASS FsInformationClass;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ SetVolume;
struct // _TAG_UNNAMED_40
{
/* 0x0008 */ unsigned long OutputBufferLength;
/* 0x0010 */ unsigned long InputBufferLength;
/* 0x0018 */ unsigned long FsControlCode;
/* 0x0020 */ void* Type3InputBuffer;
} /* size: 0x0020 */ FileSystemControl;
struct // _TAG_UNNAMED_41
{
/* 0x0008 */ union _LARGE_INTEGER* Length;
/* 0x0010 */ unsigned long Key;
/* 0x0018 */ union _LARGE_INTEGER ByteOffset;
} /* size: 0x0018 */ LockControl;
struct // _TAG_UNNAMED_42
{
/* 0x0008 */ unsigned long OutputBufferLength;
/* 0x0010 */ unsigned long InputBufferLength;
/* 0x0018 */ unsigned long IoControlCode;
/* 0x0020 */ void* Type3InputBuffer;
} /* size: 0x0020 */ DeviceIoControl;
struct // _TAG_UNNAMED_43
{
/* 0x0008 */ unsigned long SecurityInformation;
/* 0x0010 */ unsigned long Length;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ QuerySecurity;
struct // _TAG_UNNAMED_44
{
/* 0x0008 */ unsigned long SecurityInformation;
/* 0x0010 */ void* SecurityDescriptor;
} /* size: 0x0010 */ SetSecurity;
struct // _TAG_UNNAMED_45
{
/* 0x0008 */ struct _VPB* Vpb;
/* 0x0010 */ struct _DEVICE_OBJECT* DeviceObject;
} /* size: 0x0010 */ MountVolume;
struct // _TAG_UNNAMED_45
{
/* 0x0008 */ struct _VPB* Vpb;
/* 0x0010 */ struct _DEVICE_OBJECT* DeviceObject;
} /* size: 0x0010 */ VerifyVolume;
struct // _TAG_UNNAMED_46
{
/* 0x0008 */ struct _SCSI_REQUEST_BLOCK* Srb;
} /* size: 0x0008 */ Scsi;
struct // _TAG_UNNAMED_47
{
/* 0x0008 */ unsigned long Length;
/* 0x0010 */ void* StartSid;
/* 0x0018 */ struct _FILE_GET_QUOTA_INFORMATION* SidList;
/* 0x0020 */ unsigned long SidListLength;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ QueryQuota;
struct // _TAG_UNNAMED_38
{
/* 0x0008 */ unsigned long Length;
} /* size: 0x0004 */ SetQuota;
struct // _TAG_UNNAMED_48
{
/* 0x0008 */ enum _DEVICE_RELATION_TYPE Type;
} /* size: 0x0004 */ QueryDeviceRelations;
struct // _TAG_UNNAMED_49
{
/* 0x0008 */ const struct _GUID* InterfaceType;
/* 0x0010 */ unsigned short Size;
/* 0x0012 */ unsigned short Version;
/* 0x0018 */ struct _INTERFACE* Interface;
/* 0x0020 */ void* InterfaceSpecificData;
} /* size: 0x0020 */ QueryInterface;
struct // _TAG_UNNAMED_50
{
/* 0x0008 */ struct _DEVICE_CAPABILITIES* Capabilities;
} /* size: 0x0008 */ DeviceCapabilities;
struct // _TAG_UNNAMED_51
{
/* 0x0008 */ struct _IO_RESOURCE_REQUIREMENTS_LIST* IoResourceRequirementList;
} /* size: 0x0008 */ FilterResourceRequirements;
struct // _TAG_UNNAMED_52
{
/* 0x0008 */ unsigned long WhichSpace;
/* 0x0010 */ void* Buffer;
/* 0x0018 */ unsigned long Offset;
/* 0x0020 */ unsigned long Length;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ ReadWriteConfig;
struct // _TAG_UNNAMED_53
{
/* 0x0008 */ unsigned char Lock;
} /* size: 0x0001 */ SetLock;
struct // _TAG_UNNAMED_54
{
/* 0x0008 */ enum BUS_QUERY_ID_TYPE IdType;
} /* size: 0x0004 */ QueryId;
struct // _TAG_UNNAMED_55
{
/* 0x0008 */ enum DEVICE_TEXT_TYPE DeviceTextType;
/* 0x0010 */ unsigned long LocaleId;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ QueryDeviceText;
struct // _TAG_UNNAMED_56
{
/* 0x0008 */ unsigned char InPath;
/* 0x0009 */ unsigned char Reserved[3];
/* 0x0010 */ enum _DEVICE_USAGE_NOTIFICATION_TYPE Type;
/* 0x0014 */ long __PADDING__[1];
} /* size: 0x0010 */ UsageNotification;
struct // _TAG_UNNAMED_57
{
/* 0x0008 */ enum _SYSTEM_POWER_STATE PowerState;
} /* size: 0x0004 */ WaitWake;
struct // _TAG_UNNAMED_58
{
/* 0x0008 */ struct _POWER_SEQUENCE* PowerSequence;
} /* size: 0x0008 */ PowerSequence;
struct // _TAG_UNNAMED_59
{
union
{
/* 0x0008 */ unsigned long SystemContext;
/* 0x0008 */ struct _SYSTEM_POWER_STATE_CONTEXT SystemPowerStateContext;
}; /* size: 0x0004 */
/* 0x0010 */ enum _POWER_STATE_TYPE Type;
/* 0x0018 */ union _POWER_STATE State;
/* 0x0020 */ enum POWER_ACTION ShutdownType;
/* 0x0024 */ long __PADDING__[1];
} /* size: 0x0020 */ Power;
struct // _TAG_UNNAMED_60
{
/* 0x0008 */ struct _CM_RESOURCE_LIST* AllocatedResources;
/* 0x0010 */ struct _CM_RESOURCE_LIST* AllocatedResourcesTranslated;
} /* size: 0x0010 */ StartDevice;
struct // _TAG_UNNAMED_61
{
/* 0x0008 */ unsigned __int64 ProviderId;
/* 0x0010 */ void* DataPath;
/* 0x0018 */ unsigned long BufferSize;
/* 0x0020 */ void* Buffer;
} /* size: 0x0020 */ WMI;
struct // _TAG_UNNAMED_62
{
/* 0x0008 */ void* Argument1;
/* 0x0010 */ void* Argument2;
/* 0x0018 */ void* Argument3;
/* 0x0020 */ void* Argument4;
} /* size: 0x0020 */ Others;
}; /* size: 0x0020 */
} /* size: 0x0020 */ Parameters;
/* 0x0028 */ struct _DEVICE_OBJECT* DeviceObject;
/* 0x0030 */ struct _FILE_OBJECT* FileObject;
/* 0x0038 */ void* CompletionRoutine /* function */;
/* 0x0040 */ void* Context;
} IO_STACK_LOCATION, *PIO_STACK_LOCATION; /* size: 0x0048 */
typedef struct _IO_STATUS_BLOCK
{
union
{
/* 0x0000 */ long Status;
/* 0x0000 */ void* Pointer;
}; /* size: 0x0008 */
/* 0x0008 */ unsigned __int64 Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; /* size: 0x0010 */
struct _IO_TIMER;
typedef struct _IRP
{
/* 0x0000 */ short Type;
/* 0x0002 */ unsigned short Size;
/* 0x0008 */ struct _MDL* MdlAddress;
/* 0x0010 */ unsigned long Flags;
union // _TAG_UNNAMED_63
{
union
{
/* 0x0018 */ struct _IRP* MasterIrp;
/* 0x0018 */ long IrpCount;
/* 0x0018 */ void* SystemBuffer;
}; /* size: 0x0008 */
} /* size: 0x0008 */ AssociatedIrp;
/* 0x0020 */ struct _LIST_ENTRY ThreadListEntry;
/* 0x0030 */ struct _IO_STATUS_BLOCK IoStatus;
/* 0x0040 */ char RequestorMode;
/* 0x0041 */ unsigned char PendingReturned;
/* 0x0042 */ char StackCount;
/* 0x0043 */ char CurrentLocation;
/* 0x0044 */ unsigned char Cancel;
/* 0x0045 */ unsigned char CancelIrql;
/* 0x0046 */ char ApcEnvironment;
/* 0x0047 */ unsigned char AllocationFlags;
/* 0x0048 */ struct _IO_STATUS_BLOCK* UserIosb;
/* 0x0050 */ struct _KEVENT* UserEvent;
union // _TAG_UNNAMED_64
{
union
{
struct // _TAG_UNNAMED_65
{
union
{
/* 0x0058 */ void* UserApcRoutine /* function */;
/* 0x0058 */ void* IssuingProcess;
}; /* size: 0x0008 */
/* 0x0060 */ void* UserApcContext;
} /* size: 0x0010 */ AsynchronousParameters;
/* 0x0058 */ union _LARGE_INTEGER AllocationSize;
}; /* size: 0x0010 */
} /* size: 0x0010 */ Overlay;
/* 0x0068 */ void* CancelRoutine /* function */;
/* 0x0070 */ void* UserBuffer;
union // _TAG_UNNAMED_66
{
union
{
struct // _TAG_UNNAMED_67
{
union
{
/* 0x0078 */ struct _KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
/* 0x0078 */ void* DriverContext[4];
}; /* size: 0x0020 */
/* 0x0098 */ struct _ETHREAD* Thread;
/* 0x00a0 */ char* AuxiliaryBuffer;
/* 0x00a8 */ struct _LIST_ENTRY ListEntry;
union
{
/* 0x00b8 */ struct _IO_STACK_LOCATION* CurrentStackLocation;
/* 0x00b8 */ unsigned long PacketType;
}; /* size: 0x0008 */
/* 0x00c0 */ struct _FILE_OBJECT* OriginalFileObject;
} /* size: 0x0050 */ Overlay;
/* 0x0078 */ struct _KAPC Apc;
/* 0x0078 */ void* CompletionKey;
}; /* size: 0x0058 */
} /* size: 0x0058 */ Tail;
} IRP, *PIRP; /* size: 0x00d0 */
typedef enum _IRQ_PRIORITY
{
IrqPriorityUndefined = 0,
IrqPriorityLow = 1,
IrqPriorityNormal = 2,
IrqPriorityHigh = 3,
} IRQ_PRIORITY, *PIRQ_PRIORITY;
typedef struct _ISA_VECTOR
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char Bus;
/* 0x0003 */ unsigned char Source;
/* 0x0004 */ unsigned long GlobalSystemInterruptVector;
/* 0x0008 */ unsigned short Flags;
} ISA_VECTOR, *PISA_VECTOR; /* size: 0x000a */
typedef struct _KAFFINITY_EX
{
/* 0x0000 */ unsigned short Count;
/* 0x0002 */ unsigned short Size;
/* 0x0004 */ unsigned long Reserved;
/* 0x0008 */ unsigned __int64 Bitmap[20];
} KAFFINITY_EX, *PKAFFINITY_EX; /* size: 0x00a8 */
typedef struct _KAPC
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char SpareByte0;
/* 0x0002 */ unsigned char Size;
/* 0x0003 */ unsigned char SpareByte1;
/* 0x0004 */ unsigned long SpareLong0;
/* 0x0008 */ struct _KTHREAD* Thread;
/* 0x0010 */ struct _LIST_ENTRY ApcListEntry;
/* 0x0020 */ void* Reserved[3];
/* 0x0038 */ void* NormalContext;
/* 0x0040 */ void* SystemArgument1;
/* 0x0048 */ void* SystemArgument2;
/* 0x0050 */ char ApcStateIndex;
/* 0x0051 */ char ApcMode;
/* 0x0052 */ unsigned char Inserted;
/* 0x0053 */ char __PADDING__[5];
} KAPC, *PKAPC; /* size: 0x0058 */
typedef struct _KDESCRIPTOR
{
/* 0x0000 */ unsigned short Pad[3];
/* 0x0006 */ unsigned short Limit;
/* 0x0008 */ void* Base;
} KDESCRIPTOR, *PKDESCRIPTOR; /* size: 0x0010 */
typedef struct _KDEVICE_QUEUE
{
/* 0x0000 */ short Type;
/* 0x0002 */ short Size;
/* 0x0008 */ struct _LIST_ENTRY DeviceListHead;
/* 0x0018 */ unsigned __int64 Lock;
union
{
/* 0x0020 */ unsigned char Busy;
struct /* bitfield */
{
/* 0x0020 */ __int64 Reserved : 8; /* bit position: 0 */
/* 0x0020 */ __int64 Hint : 56; /* bit position: 8 */
}; /* bitfield */
}; /* size: 0x0008 */
} KDEVICE_QUEUE, *PKDEVICE_QUEUE; /* size: 0x0028 */
typedef struct _KDEVICE_QUEUE_ENTRY
{
/* 0x0000 */ struct _LIST_ENTRY DeviceListEntry;
/* 0x0010 */ unsigned long SortKey;
/* 0x0014 */ unsigned char Inserted;
/* 0x0015 */ char __PADDING__[3];
} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY; /* size: 0x0018 */
typedef struct _KDPC
{
union
{
/* 0x0000 */ unsigned long TargetInfoAsUlong;
struct
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Importance;
/* 0x0002 */ volatile unsigned short Number;
}; /* size: 0x0004 */
}; /* size: 0x0004 */
/* 0x0008 */ struct _SINGLE_LIST_ENTRY DpcListEntry;
/* 0x0010 */ unsigned __int64 ProcessorHistory;
/* 0x0018 */ void* DeferredRoutine /* function */;
/* 0x0020 */ void* DeferredContext;
/* 0x0028 */ void* SystemArgument1;
/* 0x0030 */ void* SystemArgument2;
/* 0x0038 */ void* DpcData;
} KDPC, *PKDPC; /* size: 0x0040 */
typedef struct _KEVENT
{
/* 0x0000 */ struct _DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT; /* size: 0x0018 */
typedef struct _KFLOATING_SAVE
{
/* 0x0000 */ unsigned long Dummy;
} KFLOATING_SAVE, *PKFLOATING_SAVE; /* size: 0x0004 */
typedef union _KGDTENTRY64
{
union
{
struct
{
/* 0x0000 */ unsigned short LimitLow;
/* 0x0002 */ unsigned short BaseLow;
union
{
struct // _TAG_UNNAMED_68
{
/* 0x0004 */ unsigned char BaseMiddle;
/* 0x0005 */ unsigned char Flags1;
/* 0x0006 */ unsigned char Flags2;
/* 0x0007 */ unsigned char BaseHigh;
} /* size: 0x0004 */ Bytes;
struct
{
struct // _TAG_UNNAMED_69
{
struct /* bitfield */
{
/* 0x0004 */ unsigned long BaseMiddle : 8; /* bit position: 0 */
/* 0x0004 */ unsigned long Type : 5; /* bit position: 8 */
/* 0x0004 */ unsigned long Dpl : 2; /* bit position: 13 */
/* 0x0004 */ unsigned long Present : 1; /* bit position: 15 */
/* 0x0004 */ unsigned long LimitHigh : 4; /* bit position: 16 */
/* 0x0004 */ unsigned long System : 1; /* bit position: 20 */
/* 0x0004 */ unsigned long LongMode : 1; /* bit position: 21 */
/* 0x0004 */ unsigned long DefaultBig : 1; /* bit position: 22 */
/* 0x0004 */ unsigned long Granularity : 1; /* bit position: 23 */
/* 0x0004 */ unsigned long BaseHigh : 8; /* bit position: 24 */
}; /* bitfield */
} /* size: 0x0004 */ Bits;
/* 0x0008 */ unsigned long BaseUpper;
/* 0x000c */ unsigned long MustBeZero;
}; /* size: 0x000c */
}; /* size: 0x000c */
}; /* size: 0x0010 */
struct
{
/* 0x0000 */ __int64 DataLow;
/* 0x0008 */ __int64 DataHigh;
}; /* size: 0x0010 */
}; /* size: 0x0010 */
} KGDTENTRY64, *PKGDTENTRY64; /* size: 0x0010 */
typedef union _KIDTENTRY64
{
union
{
struct
{
/* 0x0000 */ unsigned short OffsetLow;
/* 0x0002 */ unsigned short Selector;
struct /* bitfield */
{
/* 0x0004 */ unsigned short IstIndex : 3; /* bit position: 0 */
/* 0x0004 */ unsigned short Reserved0 : 5; /* bit position: 3 */
/* 0x0004 */ unsigned short Type : 5; /* bit position: 8 */
/* 0x0004 */ unsigned short Dpl : 2; /* bit position: 13 */
/* 0x0004 */ unsigned short Present : 1; /* bit position: 15 */
}; /* bitfield */
/* 0x0006 */ unsigned short OffsetMiddle;
/* 0x0008 */ unsigned long OffsetHigh;
/* 0x000c */ unsigned long Reserved1;
}; /* size: 0x0010 */
/* 0x0000 */ unsigned __int64 Alignment;
}; /* size: 0x0010 */
} KIDTENTRY64, *PKIDTENTRY64; /* size: 0x0010 */
typedef enum _KINTERRUPT_MODE
{
LevelSensitive = 0,
Latched = 1,
} KINTERRUPT_MODE, *PKINTERRUPT_MODE;
typedef enum _KINTERRUPT_POLARITY
{
InterruptPolarityUnknown = 0,
InterruptActiveHigh = 1,
InterruptRisingEdge = 1,
InterruptActiveLow = 2,
InterruptFallingEdge = 2,
InterruptActiveBoth = 3,
InterruptActiveBothTriggerLow = 3,
InterruptActiveBothTriggerHigh = 4,
} KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY;
struct _KNODE;
typedef enum _KNOWN_CONTROLLER_TYPE
{
InterruptControllerInvalid = 0,
InterruptControllerPic = 1,
InterruptControllerApic = 2,
InterruptControllerGic = 3,
InterruptControllerBcm = 4,
InterruptControllerUnknown = 4096,
} KNOWN_CONTROLLER_TYPE, *PKNOWN_CONTROLLER_TYPE;
typedef struct _KPCR
{
union
{
/* 0x0000 */ struct _NT_TIB NtTib;
struct
{
/* 0x0000 */ union _KGDTENTRY64* GdtBase;
/* 0x0008 */ struct _KTSS64* TssBase;
/* 0x0010 */ unsigned __int64 UserRsp;
/* 0x0018 */ struct _KPCR* Self;
/* 0x0020 */ struct _KPRCB* CurrentPrcb;
/* 0x0028 */ struct _KSPIN_LOCK_QUEUE* LockArray;
/* 0x0030 */ void* Used_Self;
}; /* size: 0x0038 */
}; /* size: 0x0038 */
/* 0x0038 */ union _KIDTENTRY64* IdtBase;
/* 0x0040 */ unsigned __int64 Unused[2];
/* 0x0050 */ unsigned char Irql;
/* 0x0051 */ unsigned char SecondLevelCacheAssociativity;
/* 0x0052 */ unsigned char ObsoleteNumber;
/* 0x0053 */ unsigned char Fill0;
/* 0x0054 */ unsigned long Unused0[3];
/* 0x0060 */ unsigned short MajorVersion;
/* 0x0062 */ unsigned short MinorVersion;
/* 0x0064 */ unsigned long StallScaleFactor;
/* 0x0068 */ void* Unused1[3];
/* 0x0080 */ unsigned long KernelReserved[15];
/* 0x00bc */ unsigned long SecondLevelCacheSize;
/* 0x00c0 */ unsigned long HalReserved[16];
/* 0x0100 */ unsigned long Unused2;
/* 0x0108 */ void* KdVersionBlock;
/* 0x0110 */ void* Unused3;
/* 0x0118 */ unsigned long PcrAlign1[24];
} KPCR, *PKPCR; /* size: 0x0178 */
typedef struct _KPRCB
{
/* 0x0000 */ unsigned long MxCsr;
/* 0x0004 */ unsigned char LegacyNumber;
/* 0x0005 */ unsigned char ReservedMustBeZero;
/* 0x0006 */ unsigned char InterruptRequest;
/* 0x0007 */ unsigned char IdleHalt;
/* 0x0008 */ struct _KTHREAD* CurrentThread;
/* 0x0010 */ struct _KTHREAD* NextThread;
/* 0x0018 */ struct _KTHREAD* IdleThread;
/* 0x0020 */ unsigned char NestingLevel;
/* 0x0021 */ unsigned char ClockOwner;
union
{
/* 0x0022 */ unsigned char PendingTickFlags;
struct /* bitfield */
{
/* 0x0022 */ unsigned char PendingTick : 1; /* bit position: 0 */
/* 0x0022 */ unsigned char PendingBackupTick : 1; /* bit position: 1 */
}; /* bitfield */
}; /* size: 0x0001 */
/* 0x0023 */ unsigned char IdleState;
/* 0x0024 */ unsigned long Number;
/* 0x0028 */ unsigned __int64 RspBase;
/* 0x0030 */ unsigned __int64 PrcbLock;
/* 0x0038 */ char* PriorityState;
/* 0x0040 */ struct _KPROCESSOR_STATE ProcessorState;
/* 0x05f0 */ char CpuType;
/* 0x05f1 */ char CpuID;
union
{
/* 0x05f2 */ unsigned short CpuStep;
struct
{
/* 0x05f2 */ unsigned char CpuStepping;
/* 0x05f3 */ unsigned char CpuModel;
}; /* size: 0x0002 */
}; /* size: 0x0002 */
/* 0x05f4 */ unsigned long MHz;
/* 0x05f8 */ unsigned __int64 HalReserved[8];
/* 0x0638 */ unsigned short MinorVersion;
/* 0x063a */ unsigned short MajorVersion;
/* 0x063c */ unsigned char BuildType;
/* 0x063d */ unsigned char CpuVendor;
/* 0x063e */ unsigned char CoresPerPhysicalProcessor;
/* 0x063f */ unsigned char LogicalProcessorsPerCore;
/* 0x0640 */ struct _KNODE* ParentNode;
/* 0x0648 */ unsigned __int64 GroupSetMember;
/* 0x0650 */ unsigned char Group;
/* 0x0651 */ unsigned char GroupIndex;
/* 0x0652 */ unsigned char PrcbPad05[2];
/* 0x0654 */ unsigned long InitialApicId;
/* 0x0658 */ unsigned long ScbOffset;
/* 0x065c */ unsigned long ApicMask;
/* 0x0660 */ void* AcpiReserved;
/* 0x0668 */ unsigned long CFlushSize;
/* 0x066c */ unsigned long PrcbPad10;
} KPRCB, *PKPRCB; /* size: 0x0670 */
struct _KPROCESS;
typedef struct _KPROCESSOR_STATE
{
/* 0x0000 */ struct _KSPECIAL_REGISTERS SpecialRegisters;
/* 0x00e0 */ struct _CONTEXT ContextFrame;
} KPROCESSOR_STATE, *PKPROCESSOR_STATE; /* size: 0x05b0 */
typedef struct _KSPECIAL_REGISTERS
{
/* 0x0000 */ unsigned __int64 Cr0;
/* 0x0008 */ unsigned __int64 Cr2;
/* 0x0010 */ unsigned __int64 Cr3;
/* 0x0018 */ unsigned __int64 Cr4;
/* 0x0020 */ unsigned __int64 KernelDr0;
/* 0x0028 */ unsigned __int64 KernelDr1;
/* 0x0030 */ unsigned __int64 KernelDr2;
/* 0x0038 */ unsigned __int64 KernelDr3;
/* 0x0040 */ unsigned __int64 KernelDr6;
/* 0x0048 */ unsigned __int64 KernelDr7;
/* 0x0050 */ struct _KDESCRIPTOR Gdtr;
/* 0x0060 */ struct _KDESCRIPTOR Idtr;
/* 0x0070 */ unsigned short Tr;
/* 0x0072 */ unsigned short Ldtr;
/* 0x0074 */ unsigned long MxCsr;
/* 0x0078 */ unsigned __int64 DebugControl;
/* 0x0080 */ unsigned __int64 LastBranchToRip;
/* 0x0088 */ unsigned __int64 LastBranchFromRip;
/* 0x0090 */ unsigned __int64 LastExceptionToRip;
/* 0x0098 */ unsigned __int64 LastExceptionFromRip;
/* 0x00a0 */ unsigned __int64 Cr8;
/* 0x00a8 */ unsigned __int64 MsrGsBase;
/* 0x00b0 */ unsigned __int64 MsrGsSwap;
/* 0x00b8 */ unsigned __int64 MsrStar;
/* 0x00c0 */ unsigned __int64 MsrLStar;
/* 0x00c8 */ unsigned __int64 MsrCStar;
/* 0x00d0 */ unsigned __int64 MsrSyscallMask;
/* 0x00d8 */ unsigned __int64 Xcr0;
} KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS; /* size: 0x00e0 */
typedef struct _KSPIN_LOCK_QUEUE
{
/* 0x0000 */ struct _KSPIN_LOCK_QUEUE* volatile Next;
/* 0x0008 */ unsigned __int64* volatile Lock;
} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE; /* size: 0x0010 */
typedef struct _KTB_FLUSH_VA
{
union // _TAG_UNNAMED_70
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 NumberOfEntries : 11; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 PageSize : 1; /* bit position: 11 */
}; /* bitfield */
/* 0x0000 */ void* Va;
/* 0x0000 */ unsigned __int64 VaLong;
}; /* size: 0x0008 */
} /* size: 0x0008 */ u1;
} KTB_FLUSH_VA, *PKTB_FLUSH_VA; /* size: 0x0008 */
struct _KTHREAD;
typedef struct _KTSS64
{
/* 0x0000 */ unsigned long Reserved0;
/* 0x0004 */ unsigned __int64 Rsp0;
/* 0x000c */ unsigned __int64 Rsp1;
/* 0x0014 */ unsigned __int64 Rsp2;
/* 0x001c */ unsigned __int64 Ist[8];
/* 0x005c */ unsigned __int64 Reserved1;
/* 0x0064 */ unsigned short Reserved2;
/* 0x0066 */ unsigned short IoMapBase;
} KTSS64, *PKTSS64; /* size: 0x0068 */
typedef struct _KWAIT_CHAIN
{
/* 0x0000 */ struct _SINGLE_LIST_ENTRY Head;
} KWAIT_CHAIN, *PKWAIT_CHAIN; /* size: 0x0008 */
typedef union _LARGE_INTEGER
{
union
{
struct
{
/* 0x0000 */ unsigned long LowPart;
/* 0x0004 */ long HighPart;
}; /* size: 0x0008 */
struct // _TAG_UNNAMED_71
{
/* 0x0000 */ unsigned long LowPart;
/* 0x0004 */ long HighPart;
} /* size: 0x0008 */ u;
/* 0x0000 */ __int64 QuadPart;
}; /* size: 0x0008 */
} LARGE_INTEGER, *PLARGE_INTEGER; /* size: 0x0008 */
typedef struct _LIST_ENTRY
{
/* 0x0000 */ struct _LIST_ENTRY* Flink;
/* 0x0008 */ struct _LIST_ENTRY* Blink;
} LIST_ENTRY, *PLIST_ENTRY; /* size: 0x0010 */
typedef struct _LOCAL_NMISOURCE
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char ProcessorID;
/* 0x0003 */ unsigned short Flags;
/* 0x0005 */ unsigned char LINTIN;
} LOCAL_NMISOURCE, *PLOCAL_NMISOURCE; /* size: 0x0006 */
typedef struct _LOOKASIDE_LIST_EX
{
/* 0x0000 */ struct _GENERAL_LOOKASIDE_POOL L;
} LOOKASIDE_LIST_EX, *PLOOKASIDE_LIST_EX; /* size: 0x0060 */
typedef struct _LUID
{
/* 0x0000 */ unsigned long LowPart;
/* 0x0004 */ long HighPart;
} LUID, *PLUID; /* size: 0x0008 */
typedef struct _LUID_AND_ATTRIBUTES
{
/* 0x0000 */ struct _LUID Luid;
/* 0x0008 */ unsigned long Attributes;
} LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES; /* size: 0x000c */
typedef struct _M128A
{
/* 0x0000 */ unsigned __int64 Low;
/* 0x0008 */ __int64 High;
} M128A, *PM128A; /* size: 0x0010 */
typedef struct _MAILSLOT_CREATE_PARAMETERS
{
/* 0x0000 */ unsigned long MailslotQuota;
/* 0x0004 */ unsigned long MaximumMessageSize;
/* 0x0008 */ union _LARGE_INTEGER ReadTimeout;
/* 0x0010 */ unsigned char TimeoutSpecified;
/* 0x0011 */ char __PADDING__[7];
} MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS; /* size: 0x0018 */
typedef struct _MAPIC
{
/* 0x0000 */ struct _DESCRIPTION_HEADER Header;
/* 0x0024 */ unsigned long LocalAPICAddress;
/* 0x0028 */ unsigned long Flags;
/* 0x002c */ unsigned long APICTables[1];
} MAPIC, *PMAPIC; /* size: 0x0030 */
typedef union _MCG_STATUS
{
union
{
struct
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long RestartIpValid : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long ErrorIpValid : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long MachineCheckInProgress : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long Reserved1 : 29; /* bit position: 3 */
}; /* bitfield */
/* 0x0004 */ unsigned long Reserved2;
}; /* size: 0x0008 */
/* 0x0000 */ unsigned __int64 QuadPart;
}; /* size: 0x0008 */
} MCG_STATUS, *PMCG_STATUS; /* size: 0x0008 */
typedef union _MCI_STATUS
{
union
{
struct
{
/* 0x0000 */ unsigned short McaErrorCode;
/* 0x0002 */ unsigned short ModelErrorCode;
struct /* bitfield */
{
/* 0x0004 */ unsigned long OtherInformation : 23; /* bit position: 0 */
/* 0x0004 */ unsigned long ActionRequired : 1; /* bit position: 23 */
/* 0x0004 */ unsigned long Signalling : 1; /* bit position: 24 */
/* 0x0004 */ unsigned long ContextCorrupt : 1; /* bit position: 25 */
/* 0x0004 */ unsigned long AddressValid : 1; /* bit position: 26 */
/* 0x0004 */ unsigned long MiscValid : 1; /* bit position: 27 */
/* 0x0004 */ unsigned long ErrorEnabled : 1; /* bit position: 28 */
/* 0x0004 */ unsigned long UncorrectedError : 1; /* bit position: 29 */
/* 0x0004 */ unsigned long StatusOverFlow : 1; /* bit position: 30 */
/* 0x0004 */ unsigned long Valid : 1; /* bit position: 31 */
}; /* bitfield */
}; /* size: 0x0008 */
/* 0x0000 */ unsigned __int64 QuadPart;
}; /* size: 0x0008 */
} MCI_STATUS, *PMCI_STATUS; /* size: 0x0008 */
typedef struct _MDL
{
/* 0x0000 */ struct _MDL* Next;
/* 0x0008 */ short Size;
/* 0x000a */ short MdlFlags;
/* 0x0010 */ struct _EPROCESS* Process;
/* 0x0018 */ void* MappedSystemVa;
/* 0x0020 */ void* StartVa;
/* 0x0028 */ unsigned long ByteCount;
/* 0x002c */ unsigned long ByteOffset;
} MDL, *PMDL; /* size: 0x0030 */
typedef enum _MEMORY_CACHING_TYPE
{
MmNonCached = 0,
MmCached = 1,
MmWriteCombined = 2,
MmHardwareCoherentCached = 3,
MmNonCachedUnordered = 4,
MmUSWCCached = 5,
MmMaximumCacheType = 6,
MmNotMapped = -1,
} MEMORY_CACHING_TYPE, *PMEMORY_CACHING_TYPE;
typedef enum _MEMORY_CACHING_TYPE_ORIG
{
MmFrameBufferCached = 2,
} MEMORY_CACHING_TYPE_ORIG, *PMEMORY_CACHING_TYPE_ORIG;
typedef enum _MODE
{
KernelMode = 0,
UserMode = 1,
MaximumMode = 2,
} MODE, *PMODE;
typedef struct _NAMED_PIPE_CREATE_PARAMETERS
{
/* 0x0000 */ unsigned long NamedPipeType;
/* 0x0004 */ unsigned long ReadMode;
/* 0x0008 */ unsigned long CompletionMode;
/* 0x000c */ unsigned long MaximumInstances;
/* 0x0010 */ unsigned long InboundQuota;
/* 0x0014 */ unsigned long OutboundQuota;
/* 0x0018 */ union _LARGE_INTEGER DefaultTimeout;
/* 0x0020 */ unsigned char TimeoutSpecified;
/* 0x0021 */ char __PADDING__[7];
} NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS; /* size: 0x0028 */
typedef struct _NPAGED_LOOKASIDE_LIST
{
/* 0x0000 */ struct _GENERAL_LOOKASIDE L;
} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST; /* size: 0x0080 */
typedef struct _NT_TIB
{
/* 0x0000 */ struct _EXCEPTION_REGISTRATION_RECORD* ExceptionList;
/* 0x0008 */ void* StackBase;
/* 0x0010 */ void* StackLimit;
/* 0x0018 */ void* SubSystemTib;
union
{
/* 0x0020 */ void* FiberData;
/* 0x0020 */ unsigned long Version;
}; /* size: 0x0008 */
/* 0x0028 */ void* ArbitraryUserPointer;
/* 0x0030 */ struct _NT_TIB* Self;
} NT_TIB, *PNT_TIB; /* size: 0x0038 */
typedef struct _OWNER_ENTRY
{
/* 0x0000 */ unsigned __int64 OwnerThread;
union
{
struct /* bitfield */
{
/* 0x0008 */ unsigned long IoPriorityBoosted : 1; /* bit position: 0 */
/* 0x0008 */ unsigned long OwnerReferenced : 1; /* bit position: 1 */
/* 0x0008 */ unsigned long OwnerCount : 30; /* bit position: 2 */
}; /* bitfield */
/* 0x0008 */ unsigned long TableSize;
}; /* size: 0x0004 */
/* 0x000c */ long __PADDING__[1];
} OWNER_ENTRY, *POWNER_ENTRY; /* size: 0x0010 */
typedef struct _PAGED_LOOKASIDE_LIST
{
/* 0x0000 */ struct _GENERAL_LOOKASIDE L;
} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST; /* size: 0x0080 */
typedef struct _PLATFORM_INTERRUPT
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned short Flags;
/* 0x0004 */ unsigned char InterruptType;
/* 0x0005 */ unsigned char APICID;
/* 0x0006 */ unsigned char ACPIEID;
/* 0x0007 */ unsigned char IOSAPICVector;
/* 0x0008 */ unsigned long GlobalVector;
/* 0x000c */ unsigned long Reserved;
} PLATFORM_INTERRUPT, *PPLATFORM_INTERRUPT; /* size: 0x0010 */
typedef enum _POOL_TYPE
{
NonPagedPool = 0,
NonPagedPoolExecute = 0,
PagedPool = 1,
NonPagedPoolMustSucceed = 2,
DontUseThisType = 3,
NonPagedPoolCacheAligned = 4,
PagedPoolCacheAligned = 5,
NonPagedPoolCacheAlignedMustS = 6,
MaxPoolType = 7,
NonPagedPoolBase = 0,
NonPagedPoolBaseMustSucceed = 2,
NonPagedPoolBaseCacheAligned = 4,
NonPagedPoolBaseCacheAlignedMustS = 6,
NonPagedPoolSession = 32,
PagedPoolSession = 33,
NonPagedPoolMustSucceedSession = 34,
DontUseThisTypeSession = 35,
NonPagedPoolCacheAlignedSession = 36,
PagedPoolCacheAlignedSession = 37,
NonPagedPoolCacheAlignedMustSSession = 38,
NonPagedPoolNx = 512,
NonPagedPoolNxCacheAligned = 516,
NonPagedPoolSessionNx = 544,
} POOL_TYPE, *PPOOL_TYPE;
typedef struct _POWER_SEQUENCE
{
/* 0x0000 */ unsigned long SequenceD1;
/* 0x0004 */ unsigned long SequenceD2;
/* 0x0008 */ unsigned long SequenceD3;
} POWER_SEQUENCE, *PPOWER_SEQUENCE; /* size: 0x000c */
typedef union _POWER_STATE
{
union
{
/* 0x0000 */ enum _SYSTEM_POWER_STATE SystemState;
/* 0x0000 */ enum _DEVICE_POWER_STATE DeviceState;
}; /* size: 0x0004 */
} POWER_STATE, *PPOWER_STATE; /* size: 0x0004 */
typedef enum _POWER_STATE_TYPE
{
SystemPowerState = 0,
DevicePowerState = 1,
} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
typedef struct _PRIVILEGE_SET
{
/* 0x0000 */ unsigned long PrivilegeCount;
/* 0x0004 */ unsigned long Control;
/* 0x0008 */ struct _LUID_AND_ATTRIBUTES Privilege[1];
} PRIVILEGE_SET, *PPRIVILEGE_SET; /* size: 0x0014 */
typedef struct _PROCLOCALAPIC
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char ACPIProcessorID;
/* 0x0003 */ unsigned char APICID;
/* 0x0004 */ unsigned long Flags;
} PROCLOCALAPIC, *PPROCLOCALAPIC; /* size: 0x0008 */
typedef struct _PROCLOCALSAPIC
{
/* 0x0000 */ unsigned char Type;
/* 0x0001 */ unsigned char Length;
/* 0x0002 */ unsigned char ACPIProcessorID;
/* 0x0003 */ unsigned char APICID;
/* 0x0004 */ unsigned char APICEID;
/* 0x0005 */ unsigned char Reserved[3];
/* 0x0008 */ unsigned long Flags;
/* 0x000c */ unsigned long ACPIProcessorUIDInteger;
/* 0x0010 */ char ACPIProcessorUIDString[1];
} PROCLOCALSAPIC, *PPROCLOCALSAPIC; /* size: 0x0011 */
typedef struct _REGISTERED_INTERRUPT_CONTROLLER
{
/* 0x0000 */ struct _LIST_ENTRY ListEntry;
/* 0x0010 */ void* InternalData;
/* 0x0018 */ unsigned long InternalDataSize;
/* 0x0020 */ struct _INTERRUPT_FUNCTION_TABLE FunctionTable;
/* 0x00c0 */ enum _KNOWN_CONTROLLER_TYPE KnownType;
/* 0x00c4 */ unsigned long Capabilities;
/* 0x00c8 */ unsigned long Flags;
/* 0x00cc */ unsigned long MaxPriority;
/* 0x00d0 */ unsigned long UnitId;
/* 0x00d8 */ struct _LIST_ENTRY LinesHead;
/* 0x00e8 */ struct _LIST_ENTRY OutputLinesHead;
/* 0x00f8 */ long MinLine;
/* 0x00fc */ long MaxLine;
/* 0x0100 */ unsigned long MaxClusterSize;
/* 0x0104 */ unsigned long MaxClusters;
/* 0x0108 */ unsigned long InterruptReplayDataSize;
/* 0x010c */ enum _INTERRUPT_PROBLEM Problem;
/* 0x0110 */ long ProblemStatus;
/* 0x0118 */ const char* ProblemSourceFile;
/* 0x0120 */ unsigned long ProblemSourceLine;
/* 0x0124 */ unsigned long CustomProblem;
/* 0x0128 */ long CustomProblemStatus;
/* 0x0130 */ struct _UNICODE_STRING ResourceId;
/* 0x0140 */ struct POHANDLE__* PowerHandle;
} REGISTERED_INTERRUPT_CONTROLLER, *PREGISTERED_INTERRUPT_CONTROLLER; /* size: 0x0148 */
typedef enum _REG_NOTIFY_CLASS
{
RegNtDeleteKey = 0,
RegNtPreDeleteKey = 0,
RegNtSetValueKey = 1,
RegNtPreSetValueKey = 1,
RegNtDeleteValueKey = 2,
RegNtPreDeleteValueKey = 2,
RegNtSetInformationKey = 3,
RegNtPreSetInformationKey = 3,
RegNtRenameKey = 4,
RegNtPreRenameKey = 4,
RegNtEnumerateKey = 5,
RegNtPreEnumerateKey = 5,
RegNtEnumerateValueKey = 6,
RegNtPreEnumerateValueKey = 6,
RegNtQueryKey = 7,
RegNtPreQueryKey = 7,
RegNtQueryValueKey = 8,
RegNtPreQueryValueKey = 8,
RegNtQueryMultipleValueKey = 9,
RegNtPreQueryMultipleValueKey = 9,
RegNtPreCreateKey = 10,
RegNtPostCreateKey = 11,
RegNtPreOpenKey = 12,
RegNtPostOpenKey = 13,
RegNtKeyHandleClose = 14,
RegNtPreKeyHandleClose = 14,
RegNtPostDeleteKey = 15,
RegNtPostSetValueKey = 16,
RegNtPostDeleteValueKey = 17,
RegNtPostSetInformationKey = 18,
RegNtPostRenameKey = 19,
RegNtPostEnumerateKey = 20,
RegNtPostEnumerateValueKey = 21,
RegNtPostQueryKey = 22,
RegNtPostQueryValueKey = 23,
RegNtPostQueryMultipleValueKey = 24,
RegNtPostKeyHandleClose = 25,
RegNtPreCreateKeyEx = 26,
RegNtPostCreateKeyEx = 27,
RegNtPreOpenKeyEx = 28,
RegNtPostOpenKeyEx = 29,
RegNtPreFlushKey = 30,
RegNtPostFlushKey = 31,
RegNtPreLoadKey = 32,
RegNtPostLoadKey = 33,
RegNtPreUnLoadKey = 34,
RegNtPostUnLoadKey = 35,
RegNtPreQueryKeySecurity = 36,
RegNtPostQueryKeySecurity = 37,
RegNtPreSetKeySecurity = 38,
RegNtPostSetKeySecurity = 39,
RegNtCallbackObjectContextCleanup = 40,
RegNtPreRestoreKey = 41,
RegNtPostRestoreKey = 42,
RegNtPreSaveKey = 43,
RegNtPostSaveKey = 44,
RegNtPreReplaceKey = 45,
RegNtPostReplaceKey = 46,
RegNtPreQueryKeyName = 47,
RegNtPostQueryKeyName = 48,
MaxRegNtNotifyClass = 49,
} REG_NOTIFY_CLASS, *PREG_NOTIFY_CLASS;
typedef struct _RSDP
{
/* 0x0000 */ unsigned __int64 Signature;
/* 0x0008 */ unsigned char Checksum;
/* 0x0009 */ unsigned char OEMID[6];
/* 0x000f */ unsigned char Revision;
/* 0x0010 */ unsigned long RsdtAddress;
/* 0x0014 */ unsigned long Length;
/* 0x0018 */ union _LARGE_INTEGER XsdtAddress;
/* 0x0020 */ unsigned char XChecksum;
/* 0x0021 */ unsigned char Reserved[3];
} RSDP, *PRSDP; /* size: 0x0024 */
typedef struct _RSDT_32
{
/* 0x0000 */ struct _DESCRIPTION_HEADER Header;
/* 0x0024 */ unsigned long Tables[1];
} RSDT_32, *PRSDT_32; /* size: 0x0028 */
typedef struct _RTL_AVL_TREE
{
/* 0x0000 */ struct _RTL_BALANCED_NODE* Root;
} RTL_AVL_TREE, *PRTL_AVL_TREE; /* size: 0x0008 */
typedef struct _RTL_BALANCED_NODE
{
union
{
/* 0x0000 */ struct _RTL_BALANCED_NODE* Children[2];
struct
{
/* 0x0000 */ struct _RTL_BALANCED_NODE* Left;
/* 0x0008 */ struct _RTL_BALANCED_NODE* Right;
}; /* size: 0x0010 */
}; /* size: 0x0010 */
union
{
/* 0x0010 */ unsigned char Red : 1; /* bit position: 0 */
/* 0x0010 */ unsigned char Balance : 2; /* bit position: 0 */
/* 0x0010 */ unsigned __int64 ParentValue;
}; /* size: 0x0008 */
} RTL_BALANCED_NODE, *PRTL_BALANCED_NODE; /* size: 0x0018 */
typedef struct _RTL_BITMAP
{
/* 0x0000 */ unsigned long SizeOfBitMap;
/* 0x0008 */ unsigned long* Buffer;
} RTL_BITMAP, *PRTL_BITMAP; /* size: 0x0010 */
typedef struct _RTL_DYNAMIC_HASH_TABLE
{
/* 0x0000 */ unsigned long Flags;
/* 0x0004 */ unsigned long Shift;
/* 0x0008 */ unsigned long TableSize;
/* 0x000c */ unsigned long Pivot;
/* 0x0010 */ unsigned long DivisorMask;
/* 0x0014 */ unsigned long NumEntries;
/* 0x0018 */ unsigned long NonEmptyBuckets;
/* 0x001c */ unsigned long NumEnumerators;
/* 0x0020 */ void* Directory;
} RTL_DYNAMIC_HASH_TABLE, *PRTL_DYNAMIC_HASH_TABLE; /* size: 0x0028 */
typedef struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT
{
/* 0x0000 */ struct _LIST_ENTRY* ChainHead;
/* 0x0008 */ struct _LIST_ENTRY* PrevLinkage;
/* 0x0010 */ unsigned __int64 Signature;
} RTL_DYNAMIC_HASH_TABLE_CONTEXT, *PRTL_DYNAMIC_HASH_TABLE_CONTEXT; /* size: 0x0018 */
typedef struct _RTL_DYNAMIC_HASH_TABLE_ENTRY
{
/* 0x0000 */ struct _LIST_ENTRY Linkage;
/* 0x0010 */ unsigned __int64 Signature;
} RTL_DYNAMIC_HASH_TABLE_ENTRY, *PRTL_DYNAMIC_HASH_TABLE_ENTRY; /* size: 0x0018 */
typedef struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR
{
union
{
/* 0x0000 */ struct _RTL_DYNAMIC_HASH_TABLE_ENTRY HashEntry;
/* 0x0000 */ struct _LIST_ENTRY* CurEntry;
}; /* size: 0x0018 */
/* 0x0018 */ struct _LIST_ENTRY* ChainHead;
/* 0x0020 */ unsigned long BucketIndex;
/* 0x0024 */ long __PADDING__[1];
} RTL_DYNAMIC_HASH_TABLE_ENUMERATOR, *PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR; /* size: 0x0028 */
typedef struct _RTL_QUERY_REGISTRY_TABLE
{
/* 0x0000 */ void* QueryRoutine /* function */;
/* 0x0008 */ unsigned long Flags;
/* 0x0010 */ unsigned short* Name;
/* 0x0018 */ void* EntryContext;
/* 0x0020 */ unsigned long DefaultType;
/* 0x0028 */ void* DefaultData;
/* 0x0030 */ unsigned long DefaultLength;
/* 0x0034 */ long __PADDING__[1];
} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE; /* size: 0x0038 */
typedef struct _RTL_RB_TREE
{
/* 0x0000 */ struct _RTL_BALANCED_NODE* Root;
/* 0x0008 */ struct _RTL_BALANCED_NODE* Min;
} RTL_RB_TREE, *PRTL_RB_TREE; /* size: 0x0010 */
typedef struct _RTL_SPLAY_LINKS
{
/* 0x0000 */ struct _RTL_SPLAY_LINKS* Parent;
/* 0x0008 */ struct _RTL_SPLAY_LINKS* LeftChild;
/* 0x0010 */ struct _RTL_SPLAY_LINKS* RightChild;
} RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS; /* size: 0x0018 */
struct _SCSI_REQUEST_BLOCK;
typedef struct _SECONDARY_IC_LIST_ENTRY
{
/* 0x0000 */ struct _LIST_ENTRY ListEntry;
/* 0x0010 */ unsigned long GsivBase;
/* 0x0014 */ unsigned long GsivSize;
/* 0x0018 */ struct _SECONDARY_INTERRUPT_PROVIDER_INTERFACE Interface;
/* 0x0070 */ volatile long BusyCount;
/* 0x0074 */ volatile long ExclusiveWaiterCount;
/* 0x0078 */ struct _KEVENT NotificationEvent;
/* 0x0090 */ struct _LIST_ENTRY SignalListEntry;
/* 0x00a0 */ struct _SECONDARY_INTERRUPT_LINE_STATE State[1];
} SECONDARY_IC_LIST_ENTRY, *PSECONDARY_IC_LIST_ENTRY; /* size: 0x00b0 */
typedef struct _SECONDARY_INTERRUPT_LINE_STATE
{
/* 0x0000 */ enum _KINTERRUPT_POLARITY Polarity;
/* 0x0004 */ enum _KINTERRUPT_MODE Mode;
/* 0x0008 */ unsigned long Vector;
/* 0x000c */ unsigned char Unmasked;
/* 0x000d */ char __PADDING__[3];
} SECONDARY_INTERRUPT_LINE_STATE, *PSECONDARY_INTERRUPT_LINE_STATE; /* size: 0x0010 */
typedef struct _SECONDARY_INTERRUPT_PROVIDER_INTERFACE
{
/* 0x0000 */ unsigned short Size;
/* 0x0002 */ unsigned short Version;
/* 0x0008 */ void* Context;
/* 0x0010 */ unsigned long GsivBase;
/* 0x0014 */ unsigned short GsivSize;
/* 0x0018 */ struct _DRIVER_OBJECT* DriverObject;
/* 0x0020 */ void* Reserved1;
/* 0x0028 */ void* Reserved2;
/* 0x0030 */ void* Reserved3;
/* 0x0038 */ void* Reserved4;
/* 0x0040 */ void* Reserved5;
/* 0x0048 */ void* Reserved6;
/* 0x0050 */ void* Reserved7;
} SECONDARY_INTERRUPT_PROVIDER_INTERFACE, *PSECONDARY_INTERRUPT_PROVIDER_INTERFACE; /* size: 0x0058 */
typedef struct _SECTION_OBJECT_POINTERS
{
/* 0x0000 */ void* DataSectionObject;
/* 0x0008 */ void* SharedCacheMap;
/* 0x0010 */ void* ImageSectionObject;
} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS; /* size: 0x0018 */
typedef enum _SECURITY_IMPERSONATION_LEVEL
{
SecurityAnonymous = 0,
SecurityIdentification = 1,
SecurityImpersonation = 2,
SecurityDelegation = 3,
} SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
typedef struct _SECURITY_QUALITY_OF_SERVICE
{
/* 0x0000 */ unsigned long Length;
/* 0x0004 */ enum _SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
/* 0x0008 */ unsigned char ContextTrackingMode;
/* 0x0009 */ unsigned char EffectiveOnly;
/* 0x000a */ char __PADDING__[2];
} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE; /* size: 0x000c */
typedef struct _SECURITY_SUBJECT_CONTEXT
{
/* 0x0000 */ void* ClientToken;
/* 0x0008 */ enum _SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
/* 0x0010 */ void* PrimaryToken;
/* 0x0018 */ void* ProcessAuditId;
} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT; /* size: 0x0020 */
typedef struct _SINGLE_LIST_ENTRY
{
/* 0x0000 */ struct _SINGLE_LIST_ENTRY* Next;
} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; /* size: 0x0008 */
typedef struct _SLIST_ENTRY
{
/* 0x0000 */ struct _SLIST_ENTRY* Next;
/* 0x0008 */ long __PADDING__[2];
} SLIST_ENTRY, *PSLIST_ENTRY; /* size: 0x0010 */
typedef union _SLIST_HEADER
{
union
{
struct
{
/* 0x0000 */ unsigned __int64 Alignment;
/* 0x0008 */ unsigned __int64 Region;
}; /* size: 0x0010 */
struct // _TAG_UNNAMED_72
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 Depth : 16; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 Sequence : 48; /* bit position: 16 */
}; /* bitfield */
struct /* bitfield */
{
/* 0x0008 */ unsigned __int64 Reserved : 4; /* bit position: 0 */
/* 0x0008 */ unsigned __int64 NextEntry : 60; /* bit position: 4 */
}; /* bitfield */
} /* size: 0x0010 */ HeaderX64;
}; /* size: 0x0010 */
} SLIST_HEADER, *PSLIST_HEADER; /* size: 0x0010 */
typedef struct _STRING
{
/* 0x0000 */ unsigned short Length;
/* 0x0002 */ unsigned short MaximumLength;
/* 0x0008 */ char* Buffer;
} STRING, *PSTRING; /* size: 0x0010 */
typedef enum _SYSTEM_POWER_STATE
{
PowerSystemUnspecified = 0,
PowerSystemWorking = 1,
PowerSystemSleeping1 = 2,
PowerSystemSleeping2 = 3,
PowerSystemSleeping3 = 4,
PowerSystemHibernate = 5,
PowerSystemShutdown = 6,
PowerSystemMaximum = 7,
} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
typedef struct _SYSTEM_POWER_STATE_CONTEXT
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long Reserved1 : 8; /* bit position: 0 */
/* 0x0000 */ unsigned long TargetSystemState : 4; /* bit position: 8 */
/* 0x0000 */ unsigned long EffectiveSystemState : 4; /* bit position: 12 */
/* 0x0000 */ unsigned long CurrentSystemState : 4; /* bit position: 16 */
/* 0x0000 */ unsigned long IgnoreHibernationPath : 1; /* bit position: 20 */
/* 0x0000 */ unsigned long PseudoTransition : 1; /* bit position: 21 */
/* 0x0000 */ unsigned long Reserved2 : 10; /* bit position: 22 */
}; /* bitfield */
/* 0x0000 */ unsigned long ContextAsUlong;
}; /* size: 0x0004 */
} SYSTEM_POWER_STATE_CONTEXT, *PSYSTEM_POWER_STATE_CONTEXT; /* size: 0x0004 */
typedef struct _TXN_PARAMETER_BLOCK
{
/* 0x0000 */ unsigned short Length;
/* 0x0002 */ unsigned short TxFsContext;
/* 0x0008 */ void* TransactionObject;
} TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK; /* size: 0x0010 */
typedef union _ULARGE_INTEGER
{
union
{
struct
{
/* 0x0000 */ unsigned long LowPart;
/* 0x0004 */ unsigned long HighPart;
}; /* size: 0x0008 */
struct // _TAG_UNNAMED_73
{
/* 0x0000 */ unsigned long LowPart;
/* 0x0004 */ unsigned long HighPart;
} /* size: 0x0008 */ u;
/* 0x0000 */ unsigned __int64 QuadPart;
}; /* size: 0x0008 */
} ULARGE_INTEGER, *PULARGE_INTEGER; /* size: 0x0008 */
typedef struct _UNICODE_STRING
{
/* 0x0000 */ unsigned short Length;
/* 0x0002 */ unsigned short MaximumLength;
/* 0x0008 */ unsigned short* Buffer;
} UNICODE_STRING, *PUNICODE_STRING; /* size: 0x0010 */
typedef enum _USER_ACTIVITY_PRESENCE
{
PowerUserPresent = 0,
PowerUserNotPresent = 1,
PowerUserInactive = 2,
PowerUserMaximum = 3,
PowerUserInvalid = 3,
} USER_ACTIVITY_PRESENCE, *PUSER_ACTIVITY_PRESENCE;
typedef struct _VPB
{
/* 0x0000 */ short Type;
/* 0x0002 */ short Size;
/* 0x0004 */ unsigned short Flags;
/* 0x0006 */ unsigned short VolumeLabelLength;
/* 0x0008 */ struct _DEVICE_OBJECT* DeviceObject;
/* 0x0010 */ struct _DEVICE_OBJECT* RealDevice;
/* 0x0018 */ unsigned long SerialNumber;
/* 0x001c */ unsigned long ReferenceCount;
/* 0x0020 */ wchar_t VolumeLabel[32];
} VPB, *PVPB; /* size: 0x0060 */
typedef struct _WAIT_CONTEXT_BLOCK
{
union
{
/* 0x0000 */ struct _KDEVICE_QUEUE_ENTRY WaitQueueEntry;
struct
{
/* 0x0000 */ struct _LIST_ENTRY DmaWaitEntry;
/* 0x0010 */ unsigned long NumberOfChannels;
struct /* bitfield */
{
/* 0x0014 */ unsigned long SyncCallback : 1; /* bit position: 0 */
/* 0x0014 */ unsigned long DmaContext : 1; /* bit position: 1 */
/* 0x0014 */ unsigned long Reserved : 30; /* bit position: 2 */
}; /* bitfield */
}; /* size: 0x0018 */
}; /* size: 0x0018 */
/* 0x0018 */ void* DeviceRoutine /* function */;
/* 0x0020 */ void* DeviceContext;
/* 0x0028 */ unsigned long NumberOfMapRegisters;
/* 0x0030 */ void* DeviceObject;
/* 0x0038 */ void* CurrentIrp;
/* 0x0040 */ struct _KDPC* BufferChainingDpc;
} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; /* size: 0x0048 */
typedef enum _WHEA_CPU_VENDOR
{
WheaCpuVendorOther = 0,
WheaCpuVendorIntel = 1,
WheaCpuVendorAmd = 2,
} WHEA_CPU_VENDOR, *PWHEA_CPU_VENDOR;
typedef enum _WHEA_ERROR_PACKET_DATA_FORMAT
{
WheaDataFormatIPFSalRecord = 0,
WheaDataFormatXPFMCA = 1,
WheaDataFormatMemory = 2,
WheaDataFormatPCIExpress = 3,
WheaDataFormatNMIPort = 4,
WheaDataFormatPCIXBus = 5,
WheaDataFormatPCIXDevice = 6,
WheaDataFormatGeneric = 7,
WheaDataFormatMax = 8,
} WHEA_ERROR_PACKET_DATA_FORMAT, *PWHEA_ERROR_PACKET_DATA_FORMAT;
typedef union _WHEA_ERROR_PACKET_FLAGS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long PreviousError : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long Reserved1 : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long HypervisorError : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long Simulated : 1; /* bit position: 3 */
/* 0x0000 */ unsigned long PlatformPfaControl : 1; /* bit position: 4 */
/* 0x0000 */ unsigned long PlatformDirectedOffline : 1; /* bit position: 5 */
/* 0x0000 */ unsigned long Reserved2 : 26; /* bit position: 6 */
}; /* bitfield */
/* 0x0000 */ unsigned long AsULONG;
}; /* size: 0x0004 */
} WHEA_ERROR_PACKET_FLAGS, *PWHEA_ERROR_PACKET_FLAGS; /* size: 0x0004 */
typedef struct _WHEA_ERROR_PACKET_V2
{
/* 0x0000 */ unsigned long Signature;
/* 0x0004 */ unsigned long Version;
/* 0x0008 */ unsigned long Length;
/* 0x000c */ union _WHEA_ERROR_PACKET_FLAGS Flags;
/* 0x0010 */ enum _WHEA_ERROR_TYPE ErrorType;
/* 0x0014 */ enum _WHEA_ERROR_SEVERITY ErrorSeverity;
/* 0x0018 */ unsigned long ErrorSourceId;
/* 0x001c */ enum _WHEA_ERROR_SOURCE_TYPE ErrorSourceType;
/* 0x0020 */ struct _GUID NotifyType;
/* 0x0030 */ unsigned __int64 Context;
/* 0x0038 */ enum _WHEA_ERROR_PACKET_DATA_FORMAT DataFormat;
/* 0x003c */ unsigned long Reserved1;
/* 0x0040 */ unsigned long DataOffset;
/* 0x0044 */ unsigned long DataLength;
/* 0x0048 */ unsigned long PshedDataOffset;
/* 0x004c */ unsigned long PshedDataLength;
} WHEA_ERROR_PACKET_V2, *PWHEA_ERROR_PACKET_V2; /* size: 0x0050 */
typedef struct _WHEA_ERROR_RECORD
{
/* 0x0000 */ struct _WHEA_ERROR_RECORD_HEADER Header;
/* 0x0080 */ struct _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR SectionDescriptor[1];
} WHEA_ERROR_RECORD, *PWHEA_ERROR_RECORD; /* size: 0x00c8 */
typedef struct _WHEA_ERROR_RECORD_HEADER
{
/* 0x0000 */ unsigned long Signature;
/* 0x0004 */ union _WHEA_REVISION Revision;
/* 0x0006 */ unsigned long SignatureEnd;
/* 0x000a */ unsigned short SectionCount;
/* 0x000c */ enum _WHEA_ERROR_SEVERITY Severity;
/* 0x0010 */ union _WHEA_ERROR_RECORD_HEADER_VALIDBITS ValidBits;
/* 0x0014 */ unsigned long Length;
/* 0x0018 */ union _WHEA_TIMESTAMP Timestamp;
/* 0x0020 */ struct _GUID PlatformId;
/* 0x0030 */ struct _GUID PartitionId;
/* 0x0040 */ struct _GUID CreatorId;
/* 0x0050 */ struct _GUID NotifyType;
/* 0x0060 */ unsigned __int64 RecordId;
/* 0x0068 */ union _WHEA_ERROR_RECORD_HEADER_FLAGS Flags;
/* 0x006c */ union _WHEA_PERSISTENCE_INFO PersistenceInfo;
/* 0x0074 */ unsigned char Reserved[12];
} WHEA_ERROR_RECORD_HEADER, *PWHEA_ERROR_RECORD_HEADER; /* size: 0x0080 */
typedef union _WHEA_ERROR_RECORD_HEADER_FLAGS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long Recovered : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long PreviousError : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long Simulated : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long Reserved : 29; /* bit position: 3 */
}; /* bitfield */
/* 0x0000 */ unsigned long AsULONG;
}; /* size: 0x0004 */
} WHEA_ERROR_RECORD_HEADER_FLAGS, *PWHEA_ERROR_RECORD_HEADER_FLAGS; /* size: 0x0004 */
typedef union _WHEA_ERROR_RECORD_HEADER_VALIDBITS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long PlatformId : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long Timestamp : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long PartitionId : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long Reserved : 29; /* bit position: 3 */
}; /* bitfield */
/* 0x0000 */ unsigned long AsULONG;
}; /* size: 0x0004 */
} WHEA_ERROR_RECORD_HEADER_VALIDBITS, *PWHEA_ERROR_RECORD_HEADER_VALIDBITS; /* size: 0x0004 */
typedef struct _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR
{
/* 0x0000 */ unsigned long SectionOffset;
/* 0x0004 */ unsigned long SectionLength;
/* 0x0008 */ union _WHEA_REVISION Revision;
/* 0x000a */ union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS ValidBits;
/* 0x000b */ unsigned char Reserved;
/* 0x000c */ union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS Flags;
/* 0x0010 */ struct _GUID SectionType;
/* 0x0020 */ struct _GUID FRUId;
/* 0x0030 */ enum _WHEA_ERROR_SEVERITY SectionSeverity;
/* 0x0034 */ char FRUText[20];
} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR, *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR; /* size: 0x0048 */
typedef union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned long Primary : 1; /* bit position: 0 */
/* 0x0000 */ unsigned long ContainmentWarning : 1; /* bit position: 1 */
/* 0x0000 */ unsigned long Reset : 1; /* bit position: 2 */
/* 0x0000 */ unsigned long ThresholdExceeded : 1; /* bit position: 3 */
/* 0x0000 */ unsigned long ResourceNotAvailable : 1; /* bit position: 4 */
/* 0x0000 */ unsigned long LatentError : 1; /* bit position: 5 */
/* 0x0000 */ unsigned long Reserved : 26; /* bit position: 6 */
}; /* bitfield */
/* 0x0000 */ unsigned long AsULONG;
}; /* size: 0x0004 */
} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS, *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR_FLAGS; /* size: 0x0004 */
typedef union _WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned char FRUId : 1; /* bit position: 0 */
/* 0x0000 */ unsigned char FRUText : 1; /* bit position: 1 */
/* 0x0000 */ unsigned char Reserved : 6; /* bit position: 2 */
}; /* bitfield */
/* 0x0000 */ unsigned char AsUCHAR;
}; /* size: 0x0001 */
} WHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS, *PWHEA_ERROR_RECORD_SECTION_DESCRIPTOR_VALIDBITS; /* size: 0x0001 */
typedef enum _WHEA_ERROR_SEVERITY
{
WheaErrSevRecoverable = 0,
WheaErrSevFatal = 1,
WheaErrSevCorrected = 2,
WheaErrSevInformational = 3,
} WHEA_ERROR_SEVERITY, *PWHEA_ERROR_SEVERITY;
typedef enum _WHEA_ERROR_SOURCE_TYPE
{
WheaErrSrcTypeMCE = 0,
WheaErrSrcTypeCMC = 1,
WheaErrSrcTypeCPE = 2,
WheaErrSrcTypeNMI = 3,
WheaErrSrcTypePCIe = 4,
WheaErrSrcTypeGeneric = 5,
WheaErrSrcTypeINIT = 6,
WheaErrSrcTypeBOOT = 7,
WheaErrSrcTypeSCIGeneric = 8,
WheaErrSrcTypeIPFMCA = 9,
WheaErrSrcTypeIPFCMC = 10,
WheaErrSrcTypeIPFCPE = 11,
WheaErrSrcTypeMax = 12,
} WHEA_ERROR_SOURCE_TYPE, *PWHEA_ERROR_SOURCE_TYPE;
typedef enum _WHEA_ERROR_TYPE
{
WheaErrTypeProcessor = 0,
WheaErrTypeMemory = 1,
WheaErrTypePCIExpress = 2,
WheaErrTypeNMI = 3,
WheaErrTypePCIXBus = 4,
WheaErrTypePCIXDevice = 5,
WheaErrTypeGeneric = 6,
} WHEA_ERROR_TYPE, *PWHEA_ERROR_TYPE;
typedef union _WHEA_PERSISTENCE_INFO
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 Signature : 16; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 Length : 24; /* bit position: 16 */
/* 0x0000 */ unsigned __int64 Identifier : 16; /* bit position: 40 */
/* 0x0000 */ unsigned __int64 Attributes : 2; /* bit position: 56 */
/* 0x0000 */ unsigned __int64 DoNotLog : 1; /* bit position: 58 */
/* 0x0000 */ unsigned __int64 Reserved : 5; /* bit position: 59 */
}; /* bitfield */
/* 0x0000 */ unsigned __int64 AsULONGLONG;
}; /* size: 0x0008 */
} WHEA_PERSISTENCE_INFO, *PWHEA_PERSISTENCE_INFO; /* size: 0x0008 */
typedef struct _WHEA_PROCESSOR_GENERIC_ERROR_SECTION
{
/* 0x0000 */ union _WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS ValidBits;
/* 0x0008 */ unsigned char ProcessorType;
/* 0x0009 */ unsigned char InstructionSet;
/* 0x000a */ unsigned char ErrorType;
/* 0x000b */ unsigned char Operation;
/* 0x000c */ unsigned char Flags;
/* 0x000d */ unsigned char Level;
/* 0x000e */ unsigned short Reserved;
/* 0x0010 */ unsigned __int64 CPUVersion;
/* 0x0018 */ unsigned char CPUBrandString[128];
/* 0x0098 */ unsigned __int64 ProcessorId;
/* 0x00a0 */ unsigned __int64 TargetAddress;
/* 0x00a8 */ unsigned __int64 RequesterId;
/* 0x00b0 */ unsigned __int64 ResponderId;
/* 0x00b8 */ unsigned __int64 InstructionPointer;
} WHEA_PROCESSOR_GENERIC_ERROR_SECTION, *PWHEA_PROCESSOR_GENERIC_ERROR_SECTION; /* size: 0x00c0 */
typedef union _WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 ProcessorType : 1; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 InstructionSet : 1; /* bit position: 1 */
/* 0x0000 */ unsigned __int64 ErrorType : 1; /* bit position: 2 */
/* 0x0000 */ unsigned __int64 Operation : 1; /* bit position: 3 */
/* 0x0000 */ unsigned __int64 Flags : 1; /* bit position: 4 */
/* 0x0000 */ unsigned __int64 Level : 1; /* bit position: 5 */
/* 0x0000 */ unsigned __int64 CPUVersion : 1; /* bit position: 6 */
/* 0x0000 */ unsigned __int64 CPUBrandString : 1; /* bit position: 7 */
/* 0x0000 */ unsigned __int64 ProcessorId : 1; /* bit position: 8 */
/* 0x0000 */ unsigned __int64 TargetAddress : 1; /* bit position: 9 */
/* 0x0000 */ unsigned __int64 RequesterId : 1; /* bit position: 10 */
/* 0x0000 */ unsigned __int64 ResponderId : 1; /* bit position: 11 */
/* 0x0000 */ unsigned __int64 InstructionPointer : 1; /* bit position: 12 */
/* 0x0000 */ unsigned __int64 Reserved : 51; /* bit position: 13 */
}; /* bitfield */
/* 0x0000 */ unsigned __int64 ValidBits;
}; /* size: 0x0008 */
} WHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS, *PWHEA_PROCESSOR_GENERIC_ERROR_SECTION_VALIDBITS; /* size: 0x0008 */
typedef struct _WHEA_RECOVERY_CONTEXT
{
struct // _TAG_UNNAMED_74
{
/* 0x0000 */ unsigned __int64 Address;
/* 0x0008 */ unsigned char Consumed;
/* 0x000a */ unsigned short ErrorCode;
/* 0x000c */ unsigned char ErrorIpValid;
/* 0x000d */ unsigned char RestartIpValid;
/* 0x000e */ char __PADDING__[2];
} /* size: 0x0010 */ MemoryError;
/* 0x0010 */ unsigned __int64 PartitionId;
/* 0x0018 */ unsigned int VpIndex;
/* 0x001c */ long __PADDING__[1];
} WHEA_RECOVERY_CONTEXT, *PWHEA_RECOVERY_CONTEXT; /* size: 0x0020 */
typedef union _WHEA_REVISION
{
union
{
struct
{
/* 0x0000 */ unsigned char MinorRevision;
/* 0x0001 */ unsigned char MajorRevision;
}; /* size: 0x0002 */
/* 0x0000 */ unsigned short AsUSHORT;
}; /* size: 0x0002 */
} WHEA_REVISION, *PWHEA_REVISION; /* size: 0x0002 */
typedef union _WHEA_TIMESTAMP
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 Seconds : 8; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 Minutes : 8; /* bit position: 8 */
/* 0x0000 */ unsigned __int64 Hours : 8; /* bit position: 16 */
/* 0x0000 */ unsigned __int64 Precise : 1; /* bit position: 24 */
/* 0x0000 */ unsigned __int64 Reserved : 7; /* bit position: 25 */
/* 0x0000 */ unsigned __int64 Day : 8; /* bit position: 32 */
/* 0x0000 */ unsigned __int64 Month : 8; /* bit position: 40 */
/* 0x0000 */ unsigned __int64 Year : 8; /* bit position: 48 */
/* 0x0000 */ unsigned __int64 Century : 8; /* bit position: 56 */
}; /* bitfield */
/* 0x0000 */ union _LARGE_INTEGER AsLARGE_INTEGER;
}; /* size: 0x0008 */
} WHEA_TIMESTAMP, *PWHEA_TIMESTAMP; /* size: 0x0008 */
typedef struct _WHEA_XPF_MCA_SECTION
{
/* 0x0000 */ unsigned long VersionNumber;
/* 0x0004 */ enum _WHEA_CPU_VENDOR CpuVendor;
/* 0x0008 */ union _LARGE_INTEGER Timestamp;
/* 0x0010 */ unsigned long ProcessorNumber;
/* 0x0014 */ union _MCG_STATUS GlobalStatus;
/* 0x001c */ unsigned __int64 InstructionPointer;
/* 0x0024 */ unsigned long BankNumber;
/* 0x0028 */ union _MCI_STATUS Status;
/* 0x0030 */ unsigned __int64 Address;
/* 0x0038 */ unsigned __int64 Misc;
/* 0x0040 */ unsigned long ExtendedRegisterCount;
/* 0x0044 */ unsigned long Reserved2;
/* 0x0048 */ unsigned __int64 ExtendedRegisters[24];
} WHEA_XPF_MCA_SECTION, *PWHEA_XPF_MCA_SECTION; /* size: 0x0108 */
typedef struct _WHEA_XPF_PROCESSOR_ERROR_SECTION
{
/* 0x0000 */ union _WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS ValidBits;
/* 0x0008 */ unsigned __int64 LocalAPICId;
/* 0x0010 */ unsigned char CpuId[48];
/* 0x0040 */ unsigned char VariableInfo[1];
} WHEA_XPF_PROCESSOR_ERROR_SECTION, *PWHEA_XPF_PROCESSOR_ERROR_SECTION; /* size: 0x0041 */
typedef union _WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS
{
union
{
struct /* bitfield */
{
/* 0x0000 */ unsigned __int64 LocalAPICId : 1; /* bit position: 0 */
/* 0x0000 */ unsigned __int64 CpuId : 1; /* bit position: 1 */
/* 0x0000 */ unsigned __int64 ProcInfoCount : 6; /* bit position: 2 */
/* 0x0000 */ unsigned __int64 ContextInfoCount : 6; /* bit position: 8 */
/* 0x0000 */ unsigned __int64 Reserved : 50; /* bit position: 14 */
}; /* bitfield */
/* 0x0000 */ unsigned __int64 ValidBits;
}; /* size: 0x0008 */
} WHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS, *PWHEA_XPF_PROCESSOR_ERROR_SECTION_VALIDBITS; /* size: 0x0008 */
typedef struct _WORK_QUEUE_ITEM
{
/* 0x0000 */ struct _LIST_ENTRY List;
/* 0x0010 */ void* WorkerRoutine /* function */;
/* 0x0018 */ void* Parameter;
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM; /* size: 0x0020 */
typedef struct _XSAVE_FORMAT
{
/* 0x0000 */ unsigned short ControlWord;
/* 0x0002 */ unsigned short StatusWord;
/* 0x0004 */ unsigned char TagWord;
/* 0x0005 */ unsigned char Reserved1;
/* 0x0006 */ unsigned short ErrorOpcode;
/* 0x0008 */ unsigned long ErrorOffset;
/* 0x000c */ unsigned short ErrorSelector;
/* 0x000e */ unsigned short Reserved2;
/* 0x0010 */ unsigned long DataOffset;
/* 0x0014 */ unsigned short DataSelector;
/* 0x0016 */ unsigned short Reserved3;
/* 0x0018 */ unsigned long MxCsr;
/* 0x001c */ unsigned long MxCsr_Mask;
/* 0x0020 */ struct _M128A FloatRegisters[8];
/* 0x00a0 */ struct _M128A XmmRegisters[16];
/* 0x01a0 */ unsigned char Reserved4[96];
} XSAVE_FORMAT, *PXSAVE_FORMAT; /* size: 0x0200 */
typedef struct _XSDT
{
/* 0x0000 */ struct _DESCRIPTION_HEADER Header;
/* 0x0024 */ union _LARGE_INTEGER Tables[1];
} XSDT, *PXSDT; /* size: 0x002c */
/*
Amd64AllocateCounter
Amd64ConfigureCounter
Amd64DisableMonitoring
Amd64EnableMonitoring
Amd64FreeCounter
Amd64GetProfileDescriptor
Amd64InitializeProfiling
Amd64OverflowHandler
Amd64PauseProfiling
Amd64QueryInformation
Amd64RestartProfiling
Amd64ResumeProfiling
Amd64SetInterval
ArbDeleteMmConfigRange
ArbInitializeMmConfigRange
CMOS_READ
CMOS_WRITE
DefaultDisableMonitoring
DefaultEnableMonitoring
DefaultInitializeProfiling
DefaultOverflowHandler
DefaultQueryInformation
DefaultRestartProfiling
DefaultSetInterval
EmonAllocateCounter
EmonConfigureCounter
EmonDisableMonitoring
EmonEnableMonitoring
EmonFreeCounter
EmonGetProfileDescriptor
EmonInitializeProfiling
EmonOverflowHandler
EmonPauseProfiling
EmonQueryInformation
EmonRestartProfiling
EmonResumeProfiling
EmonSetInterval
HalAcpiEmCheckOperator
HalAcpiGetAllTablesDispatch
HalAcpiGetFacsMappingDispatch
HalAcpiGetRsdpDispatch
HalAcpiGetTable
HalAcpiGetTableDispatch
HalAcpiGetTableEx
HalAcquireDisplayOwnership
HalAdjustResourceList
HalAllProcessorsStarted
HalAllocateAdapterChannel
HalAllocateAdapterChannelEx
HalAllocateAdapterChannelV2
HalAllocateCommonBuffer
HalAllocateCommonBufferEx
HalAllocateCommonBufferV2
HalAllocateCrashDumpRegisters
HalAllocateDomainCommonBuffer
HalAllocateHardwareCounters
HalAssignSlotResources
HalBugCheckSystem
HalBuildMdlFromScatterGatherListV2
HalBuildMdlFromScatterGatherListV3
HalBuildScatterGatherListEx
HalBuildScatterGatherListV2
HalBuildScatterGatherListV3
HalCalculateScatterGatherListSizeV2
HalCalculateScatterGatherListSizeV3
HalCalibratePerformanceCounter
HalCancelAdapterChannel
HalCancelMappedTransfer
HalClearSoftwareInterrupt
HalConfigureAdapterChannel
HalConvertDeviceIdtToIrql
HalDisableInterrupt
HalDisplayString
HalDmaAllocateCrashDumpRegistersEx
HalDmaFreeCrashDumpRegistersEx
HalEfiGetEnvironmentVariable
HalEfiGetTime
HalEfiQueryCapsuleCapabilities
HalEfiQueryVariableInfo
HalEfiResetSystem
HalEfiSetEnvironmentVariable
HalEfiSetTime
HalEfiUpdateCapsule
HalEnableInterrupt
HalEnumerateEnvironmentVariablesEx
HalEnumerateProcessors
HalFixInterruptLine
HalFlushAdapterBuffersEx
HalFlushCommonBuffer
HalFlushDmaBuffer
HalFreeAdapterObject
HalFreeCommonBuffer
HalFreeCommonBufferV3
HalFreeHardwareCounters
HalGetAdapter
HalGetAdapterV2
HalGetAdapterV3
HalGetBusData
HalGetBusDataByOffset
HalGetDmaAdapterInfo
HalGetDmaAlignment
HalGetDmaDomain
HalGetDmaTransferInfo
HalGetEnvironmentVariable
HalGetEnvironmentVariableEx
HalGetInterruptTargetInformation
HalGetInterruptVector
HalGetMemoryCachingRequirements
HalGetMessageRoutingInfo
HalGetProcessorIdByNtNumber
HalGetScatterGatherList
HalGetScatterGatherListEx
HalGetVectorInput
HalHandleMcheck
HalHandleNMI
HalInitSystem
HalInitializeBios
HalInitializeDmaTransferContext
HalInitializeOnResume
HalInitializeProcessor
HalIsHyperThreadingEnabled
HalJoinDmaDomain
HalLeaveDmaDomain
HalMakeBeep
HalMapIoSpace
HalMapTransferEx
HalMatchAcpiCreatorRevision
HalMatchAcpiFADTBootArch
HalMatchAcpiOemId
HalMatchAcpiOemRevision
HalMatchAcpiOemTableId
HalMatchAcpiRevision
HalMcUpdateReadPCIConfig
HalPerformEndOfInterrupt
HalPnpGetDmaAdapter
HalPnpInterfaceNullReference
HalProcessorIdle
HalPutDmaAdapter
HalPutScatterGatherList
HalPutScatterGatherListV3
HalQueryDisplayParameters
HalQueryEnvironmentVariableInfoEx
HalQueryMaximumProcessorCount
HalQueryRealTimeClock
HalReadBootRegister
HalReadDmaCounter
HalReadDmaCounterV3
HalRealAllocateAdapterChannelV2
HalRealAllocateAdapterChannelV3
HalRegisterDynamicProcessor
HalRegisterErrataCallbacks
HalRegisterPermanentAddressUsage
HalReportResourceUsage
HalRequestClockInterrupt
HalRequestDeferredRecoveryServiceInterrupt
HalRequestIpi
HalRequestIpiSpecifyVector
HalRequestSoftwareInterrupt
HalReturnToFirmware
HalSendNMI
HalSendSoftwareInterrupt
HalSetBusData
HalSetBusDataByOffset
HalSetDisplayParameters
HalSetEnvironmentVariable
HalSetEnvironmentVariableEx
HalSetProfileInterval
HalSetRealTimeClock
HalSetTimerProblem
HalSocGetAcpiTable
HalSocRequestApi
HalSocRequestConfigurationData
HalStartDynamicProcessor
HalStartNextProcessor
HalStartProfileInterrupt
HalStopProfileInterrupt
HalSystemVectorDispatchEntry
HalTranslateBusAddress
HalUnmapIoSpace
HalUpdateTimerCapabilities
HalWriteBootRegister
HalacpIrqTranslatorDereference
HalacpiIrqTranslateResourceRequirementsIsa
HalacpiIrqTranslateResourcesIsa
HalacpiIrqTranslatorReference
HaliAcpiMachineStateInit
HaliAcpiQueryFlags
HaliAcpiSleep
HaliAcpiTimerCarry
HaliAddInterruptRemapping
HaliGetDmaAdapter
HaliGetInterruptTranslator
HaliHaltSystem
HaliHandlePCIConfigSpaceAccess
HaliInitPnpDriver
HaliInitPowerManagement
HaliLocateHiberRanges
HaliPciInterfaceReadConfig
HaliPciInterfaceWriteConfig
HaliQuerySystemInformation
HaliRemoveInterruptRemapping
HaliSetMaxLegacyPciBusNumber
HaliSetPciErrorHandlerCallback
HaliSetSystemInformation
HaliSetWakeAlarm
Halp8254TimerAcknowledgeInterrupt
Halp8254TimerArm
Halp8254TimerInitialize
Halp8254TimerStop
HalpAcpiAllocateMemory
HalpAcpiAoacCapable
HalpAcpiCacheOverrideTables
HalpAcpiCacheTable
HalpAcpiCalculateCacheSizeForOverrideTables
HalpAcpiCheckAndMapTable
HalpAcpiCopyBiosTable
HalpAcpiDetectMachineSpecificActions
HalpAcpiFallbackOnLegacyConfigMethod
HalpAcpiFindRsdp
HalpAcpiFlushCache
HalpAcpiGetAllTablesWork
HalpAcpiGetCachedTable
HalpAcpiGetFacsMapping
HalpAcpiGetRsdt
HalpAcpiGetTable
HalpAcpiGetTableFromBios
HalpAcpiGetTableWork
HalpAcpiIBMExaMatch
HalpAcpiIBMVigilMatch
HalpAcpiInitDiscard
HalpAcpiInitSystem
HalpAcpiInitializePmRegisters
HalpAcpiIsCachedTableCompromised
HalpAcpiPmRegisterAvailable
HalpAcpiPmRegisterRead
HalpAcpiPmRegisterReadPciConfigSpace
HalpAcpiPmRegisterReadPort
HalpAcpiPmRegisterReadRegister
HalpAcpiPmRegisterWrite
HalpAcpiPmRegisterWritePciConfigSpace
HalpAcpiPmRegisterWritePort
HalpAcpiPmRegisterWriteRegister
HalpAcpiPostSleep
HalpAcpiPreSleep
HalpAcpiRealTimeToUtcTime
HalpAcpiSetupPmRegister
HalpAcpiSetupPmRegisterLegacy
HalpAcpiTableCacheInit
HalpAcpiValidateAcpiTable
HalpAcquireCmosSpinLock
HalpAcquireCmosSpinLockAndWait
HalpAcquireHighLevelLock
HalpAcquirePccInterface
HalpAcquireSecondaryIcEntryExclusive
HalpAddAdapterToList
HalpAddAdapterToSystemList
HalpAddDevice
HalpAddMcaToMemoryErrorSection
HalpAddMcaToProcessorGenericSection
HalpAddMcaToProcessorSpecificSection
HalpAllocPhysicalMemory
HalpAllocateAdapterCallbackV2
HalpAllocateAdapterCallbackV3
HalpAllocateAdapterChannel
HalpAllocateCR3Root
HalpAllocateDmaChannels
HalpAllocateDmaResources
HalpAllocateEarlyPages
HalpAllocateGsivForSecondaryInterrupt
HalpAllocateHalCounters
HalpAllocateKInterrupt
HalpAllocateMapRegisters
HalpAllocateNumaConfigData
HalpAllocatePmcCounterSet
HalpAllocateScratchMemory
HalpApic1EndOfInterrupt
HalpApic1ReadRegister
HalpApic1WaitForIcr
HalpApic1WriteIcr
HalpApic1WriteRegister
HalpApicClearLocalUnitError
HalpApicConvertFromRte
HalpApicConvertId
HalpApicConvertToRte
HalpApicDeinitializeLocalUnit
HalpApicDescribeLines
HalpApicDescribeLocalLines
HalpApicDiscover
HalpApicGenerateMessage
HalpApicGetCpuInfo
HalpApicGetLocalUnitError
HalpApicHvUpdateCallback
HalpApicInitializeIoUnit
HalpApicInitializeLocalUnit
HalpApicIsCmciImplemented
HalpApicQueryAndGetSource
HalpApicRegisterIoUnit
HalpApicReplayLocalInterrupts
HalpApicReplaySendSelfIpi
HalpApicRequestInterrupt
HalpApicSaveLocalInterrupts
HalpApicSetLineState
HalpApicSetLogicalId
HalpApicSetPriority
HalpApicSetupRegisterAccess
HalpApicStartProcessor
HalpApicTimerAcknowledgeInterrupt
HalpApicTimerArm
HalpApicTimerDiscover
HalpApicTimerInitialize
HalpApicTimerIsInvariant
HalpApicTimerQueryCounter
HalpApicTimerSetInterruptVector
HalpApicTimerStop
HalpApicWriteEndOfInterrupt
HalpApicX2EndOfInterrupt
HalpApicX2ReadRegister
HalpApicX2WaitForCommand
HalpApicX2WriteCommand
HalpApicX2WriteRegister
HalpArmAcpiWakeAlarm
HalpArtAvailable
HalpArtDiscover
HalpArtInitialize
HalpArtQueryCounter
HalpAssignSlotResourcesStub
HalpAuditAcpiTables
HalpAuditAllocateRsdtArrayTable
HalpAuditEnumerateRsdts
HalpAuditEnumerateRsdtsInRange
HalpAuditGetExtendedBiosDataArea
HalpAuditQuerySlicAddresses
HalpAuditSelectRsdtOrXsdt
HalpAuditSlicTables
HalpBiosDisplayReset
HalpBuildResumeStructures
HalpBuildScatterGatherList
HalpCalculateDivisorRate
HalpCalculateScatterGatherListSize
HalpCalculateTickCount
HalpCallWakeAlarmDriver
HalpChannelAscendingSort
HalpChannelAssignmentSort
HalpChannelInitializeStaticConfiguration
HalpChannelMpnIdSort
HalpChannelPowerRequest
HalpCheckFixedWakeSources
HalpCheckInterruptType
HalpCheckLowMemoryPreSleep
HalpCheckNumaConfiguration
HalpCheckPowerButton
HalpCheckSecondaryInterruptSupported
HalpCheckWakeupTimeAndAdjust
HalpClaimDebugResource
HalpCmcDeferredRoutine
HalpCmcInitializeErrorPacketContents
HalpCmcInitializePolling
HalpCmcPollProcessor
HalpCmcStartPolling
HalpCmcWorkerRoutine
HalpCmciDeferredRoutine
HalpCmciHandler
HalpCmciInit
HalpCmciInitProcessor
HalpCmciInitializeErrorPacket
HalpCmciLoadThresholdConfiguration
HalpCmciPollProcessor
HalpCmciResetState
HalpCmciSetProcessorConfig
HalpCmciSetProcessorConfigAMD
HalpCmciSetProcessorConfigIntel
HalpCmciSetProcessorMiscConfigAMD
HalpCmosNullReference
HalpCmosRangeHandler
HalpCmosReadByte
HalpCmosWriteByte
HalpCollectPmcCounters
HalpCommitCR3Worker
HalpConnectThermalInterrupt
HalpConsumeLowMemory
HalpConvertEfiToNtStatus
HalpCopyDebugDescriptor
HalpCorrectErrSrc
HalpCorrectGenericErrSrc
HalpCorrectMachineCheckErrSrc
HalpCorrectNMIErrSrc
HalpCpuID
HalpCreateErrorRecord
HalpCreateInterrupt
HalpCreateMachineCheckErrorRecord
HalpCreateMcaMemoryErrorRecord
HalpCreateMcaProcessorErrorRecord
HalpCreateNMIErrorRecord
HalpCreateSecondaryIcEntry
HalpDbgInitSystem
HalpDeallocateMsiLines
HalpDeleteSecondaryIcEntry
HalpDeviceEquals
HalpDisableCmciOnProcessor
HalpDisableSecondaryInterrupt
HalpDispatchPnp
HalpDispatchPower
HalpDispatchSystemStateTransition
HalpDispatchWmi
HalpDmaAcquireBufferMappings
HalpDmaAllocateChildAdapterV2
HalpDmaAllocateChildAdapterV3
HalpDmaAllocateContiguousMemory
HalpDmaAllocateContiguousPagesFromContiguousPool
HalpDmaAllocateContiguousPagesFromContiguousPoolAtHighLevel
HalpDmaAllocateContiguousPagesFromContiguousPoolAtHighLevelV2
HalpDmaAllocateContiguousPagesFromContiguousPoolAtHighLevelV3
HalpDmaAllocateContiguousPagesFromContiguousPoolV2
HalpDmaAllocateContiguousPagesFromContiguousPoolV3
HalpDmaAllocateDomain
HalpDmaAllocateEmergencyResources
HalpDmaAllocateLocalContiguousPool
HalpDmaAllocateLocalScatterPool
HalpDmaAllocateMapRegisters
HalpDmaAllocateMapRegistersAtHighLevel
HalpDmaAllocateMappingResources
HalpDmaAllocateNewTranslationBuffer
HalpDmaAllocateReservedMapping
HalpDmaAllocateReservedMappingArray
HalpDmaAllocateScatterMemory
HalpDmaAllocateScatterPagesFromContiguousPool
HalpDmaAllocateScatterPagesFromContiguousPoolAtHighLevelV2
HalpDmaAllocateScatterPagesFromContiguousPoolAtHighLevelV3
HalpDmaAllocateScatterPagesFromContiguousPoolV2
HalpDmaAllocateScatterPagesFromContiguousPoolV3
HalpDmaAllocateScatterPagesFromScatterPool
HalpDmaAllocateScatterPagesFromScatterPoolAtHighLevel
HalpDmaAllocateScatterPagesFromScatterPoolAtHighLevelV2
HalpDmaAllocateScatterPagesFromScatterPoolAtHighLevelV3
HalpDmaAllocateScatterPagesFromScatterPoolV2
HalpDmaAllocateScatterPagesFromScatterPoolV3
HalpDmaAllocateTranslationBuffer
HalpDmaCheckAdapterToken
HalpDmaCheckMdlAccessibility
HalpDmaCommitContiguousMapBuffers
HalpDmaCommitScatterMapBuffers
HalpDmaConfigureInterrupt
HalpDmaControllerCancelTransfer
HalpDmaControllerDpcRoutine
HalpDmaControllerFlushChannel
HalpDmaControllerInitializeController
HalpDmaControllerInterruptRoutine
HalpDmaControllerProgramChannel
HalpDmaControllerQueryMaxFragments
HalpDmaControllerReadDmaCounter
HalpDmaControllerValidateRequestLineBinding
HalpDmaDeleteDomain
HalpDmaDequeueAdapter
HalpDmaFinalizeDoubleBufferingDisposition
HalpDmaFindAdapterByDeviceObject
HalpDmaFindDeviceObjectByToken
HalpDmaFlushBuffer
HalpDmaFlushBufferWithEmergencyResources
HalpDmaFlushContiguousTransferV2
HalpDmaFlushContiguousTransferV3
HalpDmaFlushDriverMdl
HalpDmaFlushScatterTransferV2
HalpDmaFlushScatterTransferV3
HalpDmaForceAllocation
HalpDmaFreeChildAdapter
HalpDmaFreeCrashDumpRegisters
HalpDmaFreeMapRegisters
HalpDmaFreeTranslationBuffer
HalpDmaGetAdapterCacheAlignment
HalpDmaGetAdapterVersion
HalpDmaGetMasterAdapterVersion
HalpDmaGetTranslationEntries
HalpDmaGrowContiguousMapBuffers
HalpDmaGrowScatterMapBuffers
HalpDmaIndexToTranslationEntry
HalpDmaInit
HalpDmaInitDiscard
HalpDmaInitMemory
HalpDmaInitPowerManagement
HalpDmaInitSystem
HalpDmaInitializeControllers
HalpDmaInitializeDomain
HalpDmaInitializeMasterAdapter
HalpDmaInsertDeviceObjectByToken
HalpDmaIsAutomaticDomain
HalpDmaIsDomainCompatible
HalpDmaLinkContiguousTranslations
HalpDmaLinkDeviceObjectByToken
HalpDmaMapContiguousTransferV2
HalpDmaMapContiguousTransferV3
HalpDmaMapScatterTransferV2
HalpDmaMapScatterTransferV3
HalpDmaMarkHiberAdapter
HalpDmaNextContiguousPiece
HalpDmaNextContiguousPieceV2
HalpDmaNextContiguousPieceV3
HalpDmaPowerCriticalTransitionCallback
HalpDmaPrependTranslations
HalpDmaProcessMapRegisterQueueV2
HalpDmaProcessMapRegisterQueueV3
HalpDmaQueueAdapter
HalpDmaReleaseBufferMappings
HalpDmaRemoveAdapterFromChannelQueue
HalpDmaRemoveAdapterFromMasterQueue
HalpDmaRemoveWcb
HalpDmaReturnPageToOwner
HalpDmaReturnPageToSource
HalpDmaReturnToContiguousPool
HalpDmaReturnToScatterPool
HalpDmaStartWcb
HalpDmaSyncMapBuffers
HalpDmaSyncMapBuffersWithEmergencyResources
HalpDmaTranslationEntryToIndex
HalpDmaZeroMapBuffers
HalpDpGetInterruptReplayState
HalpDpInitDiscard
HalpDpInitSystem
HalpDpOfflineProcessorForReplace
HalpDpPostReplace
HalpDpPostReplaceInitialization
HalpDpPreReplace
HalpDpQueryMaxHotPlugMemoryAddress
HalpDpReplaceBegin
HalpDpReplaceControl
HalpDpReplaceEnd
HalpDpReplaceTarget
HalpDpReplayInterrupts
HalpDpSortApicList
HalpDpStartProcessor
HalpDriverEntry
HalpDynamicDeviceInterfaceNotification
HalpECmosReadByte
HalpECmosWriteByte
HalpEfiBugCheckAddPagesCallback
HalpEfiInitializeOnResume
HalpEnableSecondaryInterrupt
HalpEndOfBoot
HalpErrataInitDiscard
HalpErrataInitSystem
HalpExtBuildResourceIdString
HalpExtGetAcpiTable
HalpExtGetNextResourceDescriptor
HalpExtGetRegisteredResourceIdString
HalpExtInitExtensions
HalpExtRegisterResourceDescriptor
HalpFindAdapterByRequestLine
HalpFindBusAddressTranslation
HalpFindDevice
HalpFindDmaControllerByRequestLine
HalpFindInterruptController
HalpFindSecondaryIcEntry
HalpFindSecondaryIcEntryFromObjectAndRange
HalpFindTimer
HalpFirmwareInitDiscard
HalpFirmwareInitSystem
HalpFlushAndWait
HalpFlushMapBuffers
HalpFlushTLB
HalpFreeDmaChannels
HalpFreeNvsBuffers
HalpFreePmcCounterSet
HalpFreeResumeStructures
HalpGenericPolledDpcRoutine
HalpGenericPolledWorkerRoutine
HalpGetAcpiStaticNumaTopology
HalpGetAdapter
HalpGetCacheCoherency
HalpGetChipHacks
HalpGetCmosData
HalpGetCpuInfo
HalpGetDisplayBiosInformation
HalpGetDynamicDevicePointer
HalpGetHotPlugMemoryInfo
HalpGetIrtEntryCount
HalpGetMcaPcrContext
HalpGetNumaProcMemoryCount
HalpGetPCIData
HalpGetPlatformTimerInformation
HalpGetProcessorBrandString
HalpGetResourceSortValue
HalpGetSetCmosData
HalpGrowMapBufferWorker
HalpHalExtInitSystem
HalpHandleMaskUnmaskSecondaryInterrupt
HalpHandlePreviousMcaErrors
HalpHandlePreviousMcaErrorsOnProcessor
HalpHpetAcknowledgeInterrupt
HalpHpetArmTimer
HalpHpetDiscover
HalpHpetInitialize
HalpHpetQueryCounter
HalpHpetSetMatchValue
HalpHpetSetMessageInterruptRouting
HalpHpetStop
HalpHvBuildDeviceId
HalpHvCounterInitialize
HalpHvCounterQueryCounter
HalpHvCounterUpdateCallback
HalpHvCpuid
HalpHvDiscover
HalpHvEnterSleepState
HalpHvEpCpuid
HalpHvEpReadMsr
HalpHvEpWriteMsr
HalpHvEpWritebackInvalidate
HalpHvGetApicFrequency
HalpHvGetMachineCheckContext
HalpHvGetTscFrequency
HalpHvInitDiscard
HalpHvInitMcaPcrContext
HalpHvInitMcaStatusMsrCache
HalpHvInitSegRegister
HalpHvInitSystem
HalpHvIsFrequencyAvailable
HalpHvIsReferenceTscConfigured
HalpHvLpReadMcaStatusMsr
HalpHvLpReadMultipleMsr
HalpHvMapDeviceMsiRange
HalpHvMapIoApicDeviceInterrupt
HalpHvMceConsumedMemoryErrorRecovery
HalpHvNotifyDebugDeviceAvailable
HalpHvQueryAssociatedProcessors
HalpHvSetMachineCheckHandlerState
HalpHvSetMachineCheckRecoveryState
HalpHvSetSleepStateProperty
HalpHvStartProcessor
HalpHvTimerAcknowledgeInterrupt
HalpHvTimerArm
HalpHvTimerInitialize
HalpHvTimerSetInterruptVector
HalpHvTimerStop
HalpHvUnmapDeviceMsiRange
HalpHvUnmapIoApicDeviceInterrupt
HalpHvVpStartEnabled
HalpHwPerfCntInitSystem
HalpInitBootTable
HalpInitChipHacks
HalpInitGenericErrorSourceEntry
HalpInitGenericErrorSourcePollingRoutine
HalpInitMemoryCachingRequirementsTable
HalpInitNonBusHandler
HalpInitSystemHelper
HalpInitSystemPhase0
HalpInitSystemPhase1
HalpInitializeCmc
HalpInitializeCmciVector
HalpInitializeConfigurationFromMadt
HalpInitializeErrSrc
HalpInitializeGenericErrorSource
HalpInitializeInterruptRemappingBspLate
HalpInitializeInterrupts
HalpInitializeInterruptsBspLate
HalpInitializeInterruptsPn
HalpInitializeMce
HalpInitializeNMI
HalpInitializePnTimers
HalpInitializeProfiling
HalpInitializeSecondaryInterruptServices
HalpInitializeTelemetry
HalpInitializeTimers
HalpInsertSecondarySignalList
HalpInterruptAddTarget
HalpInterruptApplyOverrides
HalpInterruptBuildGlobalStartupStub
HalpInterruptBuildStartupStub
HalpInterruptCmciService
HalpInterruptConnect
HalpInterruptControllerInUse
HalpInterruptCreateGdtEntry32
HalpInterruptDeferredRecoveryService
HalpInterruptDestinationToTarget
HalpInterruptDpReplaceBegin
HalpInterruptEnableNmi
HalpInterruptEnablePerformanceEvents
HalpInterruptEnsureLineSwapComplete
HalpInterruptEnumerateUnmaskedInterrupts
HalpInterruptEnumerateUnmaskedSecondaryInterrupts
HalpInterruptFindBestRouting
HalpInterruptFindLines
HalpInterruptFindLinesForGsiRange
HalpInterruptForceClusterMode
HalpInterruptGenerateMessage
HalpInterruptGetApicVersion
HalpInterruptGetHighestPriorityInterrupt
HalpInterruptGetIrtInfo
HalpInterruptGetLocalIdentifier
HalpInterruptGetNextProcessorLocalId
HalpInterruptGetParkingPageInformation
HalpInterruptGetPriority
HalpInterruptGetX2ApicPolicy
HalpInterruptGsiToLine
HalpInterruptInitDiscard
HalpInterruptInitPowerManagement
HalpInterruptInitSystem
HalpInterruptInitializeController
HalpInterruptInitializeGlobals
HalpInterruptInitializeIpis
HalpInterruptInitializeLocalUnit
HalpInterruptIsCmciSupported
HalpInterruptIsGsiValid
HalpInterruptIsMsiSupported
HalpInterruptIsPicStateIntact
HalpInterruptIsRemappingRequired
HalpInterruptLineToGsi
HalpInterruptLocalErrorService
HalpInterruptLookupController
HalpInterruptMapParkedPage
HalpInterruptMarkProcessorStarted
HalpInterruptMaskAcpi
HalpInterruptMaskLevelTriggeredLines
HalpInterruptModel
HalpInterruptOfflineProcessor
HalpInterruptParseAcpiTables
HalpInterruptParseMadt
HalpInterruptPicLine
HalpInterruptPowerChange
HalpInterruptPowerComponentActiveCallback
HalpInterruptPowerComponentIdleCallback
HalpInterruptPowerCriticalTransitionCallback
HalpInterruptQueryControllerInfo
HalpInterruptQueryProcessorRestartEntryPoint
HalpInterruptRebootService
HalpInterruptRegisterController
HalpInterruptRegisterDynamicProcessor
HalpInterruptRegisterLine
HalpInterruptReinitialize
HalpInterruptReinitializeThisProcessor
HalpInterruptRemap
HalpInterruptRequestInterrupt
HalpInterruptRequestSecondaryInterrupt
HalpInterruptResetAllProcessors
HalpInterruptResetThisProcessor
HalpInterruptRestoreAllControllerState
HalpInterruptRestoreClock
HalpInterruptRestoreController
HalpInterruptSaveReplayState
HalpInterruptSelectController
HalpInterruptSendIpi
HalpInterruptServiceActiveBoth
HalpInterruptSetDestination
HalpInterruptSetDestinationInternal
HalpInterruptSetIdtEntry
HalpInterruptSetLineState
HalpInterruptSetLineStateInternal
HalpInterruptSetMsiOverride
HalpInterruptSetProblemEx
HalpInterruptSetProcessorStartContext
HalpInterruptSetRemappedDestination
HalpInterruptSetRemappedLineState
HalpInterruptSetRemappedLineStateInternal
HalpInterruptSortProcessorTable
HalpInterruptSpuriousService
HalpInterruptStandardEndOfInterrupt
HalpInterruptStartProcessor
HalpInterruptStubService
HalpInterruptSwapProcessorIdentifiers
HalpInterruptThermalService
HalpInterruptUnmap
HalpInterruptUnmaskLevelTriggeredLines
HalpInterruptUpdateLinesPostSwap
HalpInterruptUpdateLocalUnitIdentifier
HalpInterruptVectorDataToGsiv
HalpInvokeIsrForGsiv
HalpIoDelay
HalpIommuConfigureInterrupt
HalpIommuExtMarkHiberMemory
HalpIommuGetNextFlushDevice
HalpIommuHsaDiscover
HalpIommuInitDiscard
HalpIommuInitSystem
HalpIommuInitializeAll
HalpIommuInterruptRoutine
HalpIommuLocateFromDevice
HalpIommuRegister
HalpIommuRegisterDispatchTable
HalpIommuSetupMessageInterruptRouting
HalpIommuSupportEnabled
HalpIommuUpdateRemappingDestination
HalpIommuUpdateRemappingTableEntry
HalpIrtAllocateIndex
HalpIrtFreeIndex
HalpIsCmciImplemented
HalpIsEFIRuntimeActive
HalpIsHvUsedForReboot
HalpIsInterruptTypeSecondary
HalpIsMicrosoftCompatibleHvLoaded
HalpIsPartitionCpuManager
HalpIsUefiFirmwareResourceTablePresent
HalpIumGetNextVariableName
HalpIumGetTime
HalpIumGetVariable
HalpIumQueryCapsuleCapabilities
HalpIumQueryVariableInfo
HalpIumResetSystem
HalpIumSetTime
HalpIumSetVariable
HalpIumUpdateCapsule
HalpIvtCheckPathMatch
HalpIvtProcessDmarTable
HalpIvtProcessDrhdEntry
HalpIvtValidateDeviceScope
HalpKdEnumerateDebuggingDevices
HalpKdReadPCIConfig
HalpKdReleaseDebuggingDevice
HalpKdSetupDebuggingDevice
HalpKdWritePCIConfig
HalpLMIdentityStub
HalpLMStub
HalpLMStubForVM
HalpLegacyShutdown
HalpLoadMicrocode
HalpMap
HalpMapCR3Ex
HalpMapEarlyPages
HalpMapNvsArea
HalpMapPhysicalMemory64
HalpMapPhysicalMemoryWriteThrough64
HalpMapTransferV2
HalpMapTransferV3
HalpMaskInterrupt
HalpMcUpdateFindDataTableEntry
HalpMcUpdateInitialize
HalpMcUpdateLock
HalpMcUpdateMicrocode
HalpMcUpdatePostUpdate
HalpMcUpdateUnlock
HalpMcaClearError
HalpMcaInitializePcrContext
HalpMcaQueueDpc
HalpMcaReadError
HalpMcaReadErrorPresence
HalpMcaReportError
HalpMcaResumeProcessorConfig
HalpMcaSetFeatureFlags
HalpMcaSetProcessorConfig
HalpMceBarrierWait
HalpMceHandler
HalpMceHandlerCore
HalpMceHandlerWithRendezvous
HalpMceInit
HalpMceInitProcessor
HalpMceInitializeErrorPacket
HalpMceInitializeErrorPacketContents
HalpMceInitializeRecovery
HalpMceMemoryErrorDeferredHandler
HalpMceMemoryErrorDeferredRecovery
HalpMceRecovery
HalpMiscBugCheckCallback
HalpMiscGetParameters
HalpMiscInitDiscard
HalpMiscInitSystem
HalpMiscInitializeTelemetry
HalpMiscIsLegacyPcType
HalpMmAllocCtxAlloc
HalpMmAllocCtxAllocBuffer
HalpMmAllocCtxBufferCleanup
HalpMmAllocCtxFree
HalpMmAllocCtxInit
HalpMmAllocCtxMarkHiberPhase
HalpMmAllocateMemory
HalpMmAllocateMemoryInternal
HalpMmAllocatePerProcessorMemory
HalpMmBuildTiledMemoryMap
HalpMmFreeTiledMemoryMap
HalpMmInitSystem
HalpMpsValueAscendingSort
HalpNmiGenericErrorHandler
HalpNmiReboot
HalpNodeCostSort
HalpNullReadWriteBusData
HalpNumaAddRangeProximity
HalpNumaInitializeStaticConfiguration
HalpNumaQueryNodeCapacity
HalpNumaQueryNodeDistance
HalpNumaQueryProcessorNode
HalpNumaQueryProximityId
HalpNumaQueryProximityNode
HalpNumaSwapP0NodeToFront
HalpPCIConfig
HalpPCIPerformConfigAccess
HalpParseChannelCount
HalpPassIrpFromFdoToPdo
HalpPciAccessIoConfigSpace
HalpPciCheckAmdK8
HalpPciGetHpetInterruptSource
HalpPciGetHpetInterruptSourceAmd
HalpPciGetHpetInterruptSourceIntel
HalpPciGetMmConfigPhysicalAddress
HalpPciInitSystem
HalpPciInitializeMmConfigAccess
HalpPciMapMmConfigPhysicalAddress
HalpPciMarkHiberPhase
HalpPciReadIoConfigUchar
HalpPciReadIoConfigUlong
HalpPciReadIoConfigUshort
HalpPciReadMmConfigUchar
HalpPciReadMmConfigUlong
HalpPciReadMmConfigUshort
HalpPciReportMmConfigAddressRange
HalpPciWriteIoConfigUchar
HalpPciWriteIoConfigUlong
HalpPciWriteIoConfigUshort
HalpPciWriteMmConfigUchar
HalpPciWriteMmConfigUlong
HalpPciWriteMmConfigUshort
HalpPerfInterrupt
HalpPicDiscover
HalpPicInitializeIoUnit
HalpPicRequestInterrupt
HalpPicSetLineState
HalpPicWriteEndOfInterrupt
HalpPiix4Detect
HalpPmTimerConfigure
HalpPmTimerDiscover
HalpPmTimerInitialize
HalpPmTimerQueryCounterIoPort
HalpPmTimerQueryCounterMemory
HalpPnpInitSystem
HalpPopulateMsiMessages
HalpPostPnpInitialize
HalpPostSleepMP
HalpPowerEarlyRestore
HalpPowerInitDiscard
HalpPowerInitFwPerformanceTableMappings
HalpPowerInitNvsRegionData
HalpPowerInitSystem
HalpPowerSetRebootHandler
HalpPowerStateCallback
HalpPowerWriteResetCommand
HalpPreAllocateKInterrupts
HalpPrepareForBugcheck
HalpPreserveNvsArea
HalpProcGetFeatureBits
HalpProcInitDiscard
HalpProcInitSystem
HalpProcessSecondarySignalList
HalpProcessorFence
HalpProcessorPrepareForIdle
HalpProcessorResumeFromIdle
HalpPteReserveResources
HalpPutAcpiHacksInRegistry
HalpQueryAcpiRealTimeClock
HalpQueryAcpiResourceRequirements
HalpQueryCapsuleCapabilities
HalpQueryChannelTopologyInformation
HalpQueryDebuggerInformation
HalpQueryDeviceRelations
HalpQueryIdFdo
HalpQueryIdPdo
HalpQueryInterface
HalpQueryIommuReservedRegionInformation
HalpQueryMaximumGsiv
HalpQueryMaximumRegisteredProcessorCount
HalpQueryNumaRangeTableInformation
HalpQueryPccInterface
HalpQueryPrimaryInterruptInformation
HalpQueryProfileSourceList
HalpQueryResources
HalpQuerySecondaryInterruptInformation
HalpQueryVirtualRtc
HalpQueueMapBufferWorker
HalpReadCmosTime
HalpReadGenericErrorInfo
HalpReadPCIConfig
HalpReadPartitionTable
HalpReadRtcStdPCAT
HalpReadStdCmosData
HalpReadWheaPhysicalMemory
HalpReadWriteWheaPhysicalMemory
HalpReboot
HalpRecordSecondaryGsivRange
HalpReenableAcpi
HalpRegisterDeviceInUse
HalpRegisterDmaChannel
HalpRegisterDmaController
HalpRegisterKdSupportFunctions
HalpRegisterSecondaryIcInterface
HalpRegisterUsbController
HalpReleaseHighLevelLock
HalpReleaseSecondaryIcEntryShared
HalpReportResourceUsage
HalpReserveHalPtes
HalpResetSBF
HalpRestartProfiling
HalpRestoreDmaControllerState
HalpRestoreHvEnlightenment
HalpRestoreNvsArea
HalpRtcAcknowledgeInterrupt
HalpRtcArmTimer
HalpRtcDiscover
HalpRtcFixedStall
HalpRtcInitialize
HalpRtcSetDivisor
HalpRtcStop
HalpSaveAndDisableEnlightenment
HalpSaveDmaControllerState
HalpSaveProcessorState
HalpSecondaryInterruptQueryPrimaryInformation
HalpSelectFeasibleLowPowerState
HalpSendPccCommand
HalpSetAcpiRealTimeClock
HalpSetClockAfterSleep
HalpSetClockBeforeSleep
HalpSetCmosData
HalpSetIrtEntry
HalpSetPCIData
HalpSetPartitionInformation
HalpSetPlatformFlags
HalpSetProfileSourceInterval
HalpSetResumeTime
HalpSetSystemInformation
HalpSetTimer
HalpSetTimerAnyMode
HalpSetVirtualRtc
HalpSetWakeAlarm
HalpSetupAcpiPhase0
HalpSetupRealModeResume
HalpSfiTimerAcknowledgeInterrupt
HalpSfiTimerArm
HalpSfiTimerDiscover
HalpSfiTimerInitialize
HalpSfiTimerQueryCounter
HalpSfiTimerStop
HalpShutdown
HalpSimpleCheck
HalpSocApiAllocatePhysicalMemory
HalpStopLegacyUsbInterrupts
HalpStopLegacyUsbInterruptsInternal
HalpStopOhciInterrupt
HalpStopUhciInterrupt
HalpStopXhciInterrupt
HalpStoreFreeCr3
HalpTimerAlwaysOnClockInterrupt
HalpTimerCalculateMaximumAllowableDrift
HalpTimerCalibratePerformanceCounter
HalpTimerCaptureCloestAuxiliaryQpcPair
HalpTimerCaptureCurrentAuxiliaryQpcPair
HalpTimerClearProblem
HalpTimerClockActivate
HalpTimerClockArm
HalpTimerClockInitialize
HalpTimerClockInterrupt
HalpTimerClockInterruptStub
HalpTimerClockIpiRoutine
HalpTimerClockPowerChange
HalpTimerClockStart
HalpTimerClockStop
HalpTimerConfigureInterrupt
HalpTimerConfigureQpcBypass
HalpTimerConvertAuxiliaryCounter
HalpTimerConvertAuxiliaryCounterToPerformanceCounter
HalpTimerConvertPerformanceCounterToAuxiliaryCounter
HalpTimerDelayedQueryCounter
HalpTimerDetermineValidTimerPairReadLatency
HalpTimerDpcRoutine
HalpTimerEnableHypervisorTimer
HalpTimerFindBestAlwaysOnTimer
HalpTimerFindIdealClockSource
HalpTimerFindIdealPerformanceCounterSource
HalpTimerFindIdealWatchdog
HalpTimerGetClockConfiguration
HalpTimerGetClockRates
HalpTimerGetInternalData
HalpTimerGetProfilingHandler
HalpTimerGetProfilingTarget
HalpTimerGetSavedPerformanceCounter
HalpTimerHypervisorInterrupt
HalpTimerHypervisorInterruptStub
HalpTimerInitPowerManagement
HalpTimerInitSystem
HalpTimerInitialize
HalpTimerInitializeClock
HalpTimerInitializeClockPn
HalpTimerInitializeEarlyStallSource
HalpTimerInitializeHypervisorTimer
HalpTimerInitializeProfiling
HalpTimerInitializeSystemWatchdog
HalpTimerMarkWake
HalpTimerMeasureAllProcessorFrequencies
HalpTimerMeasureFrequencies
HalpTimerMeasureProcessorsWorker
HalpTimerNoteHpetMaskingBehavior
HalpTimerNotifyProcessorFreeze
HalpTimerOnlyClockInterruptPending
HalpTimerPerformanceCounterPowerChange
HalpTimerPowerChange
HalpTimerPowerComponentActiveCallback
HalpTimerPowerComponentIdleCallback
HalpTimerPowerCriticalTransitionCallback
HalpTimerPrepareClockInterrupt
HalpTimerProfileInterrupt
HalpTimerProfilePowerChange
HalpTimerQueryAuxiliaryCounterFrequency
HalpTimerQueryCycleCounter
HalpTimerQueryWakeTime
HalpTimerReadTimerPairWithLatencyLimit
HalpTimerRegister
HalpTimerRegisterBuiltinPlugins
HalpTimerRegisterBuiltinPluginsCommon
HalpTimerReportIdleStateUsage
HalpTimerResetProfileAdjustment
HalpTimerRestartProfileInterrupt
HalpTimerRestorePerformanceCounter
HalpTimerRestoreProcessorCounter
HalpTimerSavePerformanceCounter
HalpTimerSaveProcessorFrequency
HalpTimerScaleCounter
HalpTimerSchedulePeriodicQueries
HalpTimerSelectRoles
HalpTimerSetProblemEx
HalpTimerSetProfilingHandler
HalpTimerSetProfilingTarget
HalpTimerSetTimerBackedProfileInterval
HalpTimerSetupMessageInterruptRouting
HalpTimerStallCounterPowerChange
HalpTimerStallExecutionProcessor
HalpTimerStartProfileInterrupt
HalpTimerStopProfileInterrupt
HalpTimerSwitchStallSource
HalpTimerSwitchToNormalClock
HalpTimerTestHypervisorTimer
HalpTimerTraceTimingHardware
HalpTimerUnmapInterrupt
HalpTimerUpdateApiConsumers
HalpTimerWaitForPhase0Interrupt
HalpTimerWatchdogGeneratedLastReset
HalpTimerWatchdogInitWakeTimer
HalpTimerWatchdogLogReset
HalpTimerWatchdogPreResetInterrupt
HalpTimerWatchdogResetCountdown
HalpTimerWatchdogStart
HalpTimerWatchdogStop
HalpTimerWatchdogTriggerSystemReset
HalpTranslateBusAddress
HalpTranslateToLegacyMcaException
HalpTscAdjustToLeader
HalpTscAdjustToTarget
HalpTscAdvSynchCalculateRemoteDelta
HalpTscAdvSynchCalculateRemoteDeltas
HalpTscAdvSynchComputeMinimumDelta
HalpTscAdvSynchComputeMinimumDeltaAlternate
HalpTscAdvSynchLeader
HalpTscAdvSynchReadTimeStamp
HalpTscAdvSynchSkewCounter
HalpTscAdvSynchTarget
HalpTscAdvSynchToLeader
HalpTscAdvSynchToTarget
HalpTscCheckAdjustMsrCapability
HalpTscCompatibilitySynchronization
HalpTscDiscover
HalpTscFallback
HalpTscFallbackToPlatformSource
HalpTscGetAttributes
HalpTscInitialize
HalpTscInitializeSynchronizationContext
HalpTscQueryCounter
HalpTscReportSyncStatus
HalpTscReserveResources
HalpTscSynchronization
HalpTscSynchronizationWorker
HalpTscTraceProcessorSynchronization
HalpTscTraceStatus
HalpUnloadMicrocode
HalpUnmapVirtualAddress
HalpUnmaskInterrupt
HalpUnregisterSecondaryIcInterface
HalpUpdateCapsule
HalpUpdateConfigurationFromMsct
HalpUpdateCoolingPacket
HalpUpdateIrtDestinationId
HalpUpdateNumaConfiguration
HalpUtcTimeToAcpiRealTime
HalpValidPCISlot
HalpValidateInterface
HalpValidateMpns
HalpVerifySratEntryLengthAndFlag
HalpVpptAcknowledgeInterrupt
HalpVpptArmTimer
HalpVpptInitialize
HalpVpptStop
HalpVpptTimerRegister
HalpVpptUpdatePhysicalTimer
HalpWatchdoWakeTimerDpcRoutine
HalpWatchdogWakeTimerCallback
HalpWdatArmTimer
HalpWdatDiscover
HalpWdatExecuteActionBeforeInitialize
HalpWdatInitialize
HalpWdatInitializeWdat
HalpWdatInitializeWdrt
HalpWdatProcessWdatInternalData
HalpWdatProcessWdrtInternalData
HalpWdatStop
HalpWhackICHUsbSmi
HalpWheaInitDiscard
HalpWheaInitProcessorGenericSection
HalpWheaInitSystem
HalpWheaNativeCpuid
HalpWheaNativeReadMsr
HalpWheaNativeWriteMsr
HalpWheaNativeWritebackInvalidate
HalpWriteCmosTime
HalpWritePCIConfig
HalpWritePartitionTable
HalpWriteRtcStdPCAT
HalpWriteStdCmosData
HalpWriteWheaPhysicalMemory
HalpcGetCmosDataByType
HalpcSetCmosDataByType
HsaDisableInterrupt
HsaDismissPageFault
HsaEnableInterrupt
HsaEnsureNoPendingFaults
HsaFindDevice
HsaFlushDeviceTbOnly
HsaFlushTb
HsaGetPageFault
HsaGrowPasidTable
HsaHandleInterrupt
HsaInitializeIommu
HsaInvalidateDTE
HsaIommuSendCommand
HsaMarkHiberRegions
HsaSetDevicePasidTable
HsaSetDeviceSvmCapabilities
HsaSetMessageInterruptRouting
HsaSetPasidAddressSpace
HviGetHardwareFeatures
IoFlushAdapterBuffers
IoFlushAdapterBuffersV2
IoFlushAdapterBuffersV3
IoFreeAdapterChannel
IoFreeAdapterChannelV2
IoFreeAdapterChannelV3
IoFreeMapRegisters
IoFreeMapRegistersV2
IoFreeMapRegistersV3
IoMapTransfer
IoMapTransferInternal
IommuDevicePowerChange
IommuDisableDevicePasid
IommuEnableDevicePasid
IommuFlushAllPasid
IommuFlushTb
IommuGetConfiguration
IommuGetLibraryContext
IommuHvDevicePowerChange
IommuHvFlushAllPasid
IommuHvFlushTb
IommuHvGetConfiguration
IommuHvSetAddressSpace
IommuInitializeLibrary
IommuMapDevice
IommuProcessPageRequestQueue
IommuSetAddressSpace
IommuUnmapDevice
IommupGetSystemContext
IommupHvDismissPageFault
IommupHvGetDeviceCapabilities
IommupHvGetPageFault
IommupHvInitializeLibrary
IommupHvInterruptRoutine
IommupHvUnmapDevice
IvtBuildContextEntry
IvtCheckForReservedRegion
IvtDisableInterrupt
IvtDismissPageFault
IvtEnableInterrupt
IvtEnsureNoPendingFaults
IvtFindDevice
IvtFlushDeviceTbOnly
IvtFlushTb
IvtFlushTbInternal
IvtGetPageFault
IvtGrowPasidTable
IvtHandleInterrupt
IvtInitializeIommu
IvtInitializeMTRR
IvtInvalidateAllContextEntries
IvtInvalidateContextEntry
IvtInvalidateRemappingTableEntries
IvtInvalidateRemappingTableEntry
IvtIommuSendCommand
IvtMarkHiberRegions
IvtSetDevicePasidTable
IvtSetDeviceSvmCapabilities
IvtSetMessageInterruptRouting
IvtSetPasidAddressSpace
IvtUpdateContextEntryPasidTable
IvtUpdateExtendedDestination
IvtUpdateGlobalCommand
IvtUpdateRemappingDestination
IvtUpdateRemappingTableEntry
IvtUpdateSingleTargetExtendedDestination
IvtpGetNextDeviceScope
IvtpGetNextDrhdDeviceScope
IvtpGetNextInternalDeviceScope
IvtpGetNextRemappingStructure
KeFlushWriteBuffer
KeQueryPerformanceCounter
KeSaveStateForHibernate
KeStallExecutionProcessor
MmLockPagableDataSection
MmLockPagableSectionByHandle
MmUnlockPagableImageSection
PcAllocateChannelAdapter
PcFlushChannel
PcGetChannelAdapter
PcInitializeDmaHW
PcMapTransfer
PcReadCounter
PcValidateDmaAdapterRequest
PcValidateDmaScatterTransfer
READ_PORT_USHORT_PAIR
RtlCopyMemoryNonTemporal
RtlMoveMemory
RtlQueryRegistryValues
RtlRaiseException
TraceLoggingRegisterEx
TranslateGlobalVectorToIsaVector
WRITE_PORT_USHORT_PAIR
WdHwCreateHardwareRegister
WdHwDestroyHardwareRegister
WdHwpGetReadMethod
WdHwpGetWriteMethod
WdHwpReadPortUChar
WdHwpReadPortULong
WdHwpReadPortUShort
WdHwpReadRegisterUChar
WdHwpReadRegisterULong
WdHwpReadRegisterUShort
WdHwpWritePortUChar
WdHwpWritePortULong
WdHwpWritePortUShort
WdHwpWriteRegisterUChar
WdHwpWriteRegisterULong
WdHwpWriteRegisterUShort
WdInstrDestroyInstruction
WdInstrExecuteAction
WdInstrExecuteInstruction
WdInstrInitializeInstruction
XmAaaOp
XmAadOp
XmAamOp
XmAasOp
XmAccumImmediate
XmAccumRegister
XmAdcOp
XmAddOp
XmAddOperands
XmAndOp
XmBitScanGeneral
XmBoundOp
XmBsfOp
XmBsrOp
XmBswapOp
XmBtOp
XmBtcOp
XmBtrOp
XmBtsOp
XmByteImmediate
XmCallOp
XmCbwOp
XmClcOp
XmCldOp
XmCliOp
XmCmcOp
XmCmpOp
XmCmpsOp
XmCmpxchgOp
XmCompareOperands
XmCwdOp
XmDaaOp
XmDasOp
XmDecOp
XmDivOp
XmEffectiveOffset
XmEmulateInterrupt
XmEmulateStream
XmEnterOp
XmEvaluateAddressSpecifier
XmEvaluateIndexSpecifier
XmExecuteInt1a
XmFlagsRegister
XmGeneralBitOffset
XmGeneralRegister
XmGetCodeByte
XmGetImmediateSourceValue
XmGetLongImmediate
XmGetOffsetAddress
XmGetRegisterAddress
XmGetStringAddress
XmGetStringAddressRange
XmGetWordImmediate
XmGroup1General
XmGroup1Immediate
XmGroup2By1
XmGroup2ByByte
XmGroup2ByCL
XmGroup3General
XmGroup45General
XmGroup7General
XmGroup8BitOffset
XmHltOp
XmIdivOp
XmIllOp
XmImmediateEnter
XmImmediateJump
XmImulImmediate
XmImulOp
XmImulxOp
XmInOp
XmIncOp
XmInitializeEmulator
XmInsOp
XmInt1aFindPciClassCode
XmInt1aFindPciDevice
XmInt1aReadConfigRegister
XmInt1aWriteConfigRegister
XmIntOp
XmIretOp
XmJcxzOp
XmJmpOp
XmJxxOp
XmLahfOp
XmLeaveOp
XmLoadSegment
XmLodsOp
XmLongJump
XmLoopOp
XmMovOp
XmMoveGeneral
XmMoveImmediate
XmMoveRegImmediate
XmMoveSegment
XmMoveXxGeneral
XmMovsOp
XmMulOp
XmNegOp
XmNoOperands
XmNopOp
XmNotOp
XmOpcodeEscape
XmOpcodeRegister
XmOrOp
XmOutOp
XmOutsOp
XmPopGeneral
XmPopOp
XmPopStack
XmPopaOp
XmPortDX
XmPortImmediate
XmPrefixOpcode
XmPushImmediate
XmPushOp
XmPushPopSegment
XmPushStack
XmPushaOp
XmRclOp
XmRcrOp
XmRdtscOp
XmRetOp
XmRolOp
XmRorOp
XmSahfOp
XmSarOp
XmSbbOp
XmScasOp
XmSegmentOffset
XmSetDataType
XmSetDestinationValue
XmSetLogicalResult
XmSetSourceValue
XmSetccByte
XmShiftDouble
XmShlOp
XmShldOp
XmShortJump
XmShrOp
XmShrdOp
XmSmswOp
XmStcOp
XmStdOp
XmStiOp
XmStoreResult
XmStosOp
XmStringOperands
XmSubOp
XmSubOperands
XmSxxOp
XmTestOp
XmXaddOp
XmXchgOp
XmXlatOpcode
XmXorOp
ZwClose
ZwOpenKey
ZwSetValueKey
_TlgEnableCallback
_TlgKeywordOn
_TlgWrite
__GSHandlerCheck
__GSHandlerCheckCommon
__chkstk
__report_gsfailure
__security_check_cookie
__security_init_cookie
_guard_check_icall_nop
_guard_dispatch_icall_nop
_setjmp
memcmp
memcpy
memmove
memset
strcmp
x86BiosAllocateBuffer
x86BiosCall
x86BiosExecuteInterruptShadowed
x86BiosFreeBuffer
x86BiosGetPciBusData
x86BiosInitializeBiosEx
x86BiosReadCmosPort
x86BiosReadCmosPortByte
x86BiosReadIoSpace
x86BiosReadMemory
x86BiosReadPciAddressPort
x86BiosReadPciDataPort
x86BiosSetPciBusData
x86BiosTranslateAddress
x86BiosWriteCmosPort
x86BiosWriteCmosPortByte
x86BiosWriteIoSpace
x86BiosWriteMemory
x86BiosWritePciAddressPort
x86BiosWritePciDataPort
*/
| [
"w.benny@outlook.com"
] | w.benny@outlook.com |
bfe84d0bbee43f1dc84077133e5d79b5e1940c48 | 0a06fe98a9c5938e7f4befbf1d256a19e00adf6c | /projects/earthquake/rdseedv5.3.1/Parsers/free_72.c | 57bc198c5d028897bf150cc28d0001d16c8ecf75 | [] | no_license | chenyk1990/useful-utilities | 44259cc7ceb8804b9da86133ec81fa9b65096cea | 55d4a220f8467d666358b2ebff4b5cee1ade33c3 | refs/heads/master | 2023-08-15T18:42:55.899015 | 2023-08-10T03:00:13 | 2023-08-10T03:00:13 | 49,804,476 | 17 | 13 | null | null | null | null | UTF-8 | C | false | false | 813 | c |
/*===========================================================================*/
/* SEED reader | free_type72 | time header */
/*===========================================================================*/
/*
Name: free_type72
*/
#include "rdseed.h"
void free_type72 ()
{
struct type72 *type72, *t;
type72 = type72_head;
while (type72 != NULL)
{
if (type72->station)
free(type72->station);
if (type72->location)
free(type72->location);
if (type72->channel)
free(type72->channel);
if (type72->arrival_time)
free(type72->arrival_time);
if (type72->phasename)
free(type72->phasename);
if (type72->network_code != NULL)
free(type72->network_code);
t = type72->next;
free((char *) type72);
type72 = t;
}
type72_head = NULL;
}
| [
"chenyk1990@gmail.com"
] | chenyk1990@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.