blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 2
268
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
228
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5e535452df44c1b4ca6448075b62ce51c7cb99cb | db74e19c0fe42cb5700ff00f11b7827622d48308 | /Code/ATAES132A/Versuch_I2C_Slave_zu_implementieren_und_AES_Code_zu_integrieren/AES4/src/customlib/aes_cfb.c | 8021ca80cbae3c83fb78c393cc758f23bea5285f | [] | no_license | georgie047/Wahlfachprojekt | 985cfca6a76d740cbcb13a2136b9077bb738f227 | cb916c2afd0e948b94e17a562866babeb5283a16 | refs/heads/master | 2020-04-24T03:19:13.298667 | 2019-06-23T20:34:11 | 2019-06-23T20:34:11 | 171,666,608 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 11,062 | c | /* crypto/aes/aes_cfb.c -*- mode:C; c-file-style: "eay" -*- */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. 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 acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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 cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
/**
* @file aes_cfb.c
* @date 2015-10-09
*
* NOTE:
* This file is generated by DAVE. Any manual modification done to this file will be lost when the code is regenerated.
*
* @cond
***********************************************************************************************************************
* CRYPTO_AES v4.0.6 - Encrypt/Decrypt user data using the AES standard
*
* Copyright (c) 2015, Infineon Technologies AG
* 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 copyright holders 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.
*
* To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes
* with Infineon Technologies AG ([email protected]).
***********************************************************************************************************************
*/
#include "crypto_aes.h"
#ifdef CRYPTO_AES_BUILD_MODE_CFB
#ifndef AES_DEBUG
# ifndef NDEBUG
# define NDEBUG
# endif
#endif
#include <assert.h>
#include "aes.h"
#include "aes_locl.h"
/* The input and output encrypted as though 128bit cfb mode is being
* used. The extra state information to record how much of the
* 128bit block we have used is contained in *num;
*/
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
const unsigned long length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc) {
unsigned int n;
unsigned long l = length;
unsigned char c;
assert(in && out && key && ivec && num);
n = *num;
if (enc) {
while (l--) {
if (n == 0) {
AES_encrypt(ivec, ivec, key);
}
ivec[n] = *(out++) = *(in++) ^ ivec[n];
n = (n+1) % AES_BLOCK_SIZE;
}
} else {
while (l--) {
if (n == 0) {
AES_encrypt(ivec, ivec, key);
}
c = *(in);
*(out++) = *(in++) ^ ivec[n];
ivec[n] = c;
n = (n+1) % AES_BLOCK_SIZE;
}
}
*num=n;
}
/* This expects a single block of size nbits for both in and out. Note that
it corrupts any extra bits in the last byte of out */
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
const int nbits,const AES_KEY *key,
unsigned char *ivec,const int enc)
{
int n,rem,num;
unsigned char ovec[AES_BLOCK_SIZE*2];
if (nbits<=0 || nbits>128) return;
/* fill in the first half of the new IV with the current IV */
memcpy(ovec,ivec,AES_BLOCK_SIZE);
/* construct the new IV */
AES_encrypt(ivec,ivec,key);
num = (nbits+7)/8;
if (enc) /* encrypt the input */
for(n=0 ; n < num ; ++n)
out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n] ^ ivec[n]);
else /* decrypt the input */
for(n=0 ; n < num ; ++n)
out[n] = (ovec[AES_BLOCK_SIZE+n] = in[n]) ^ ivec[n];
/* shift ovec left... */
rem = nbits%8;
num = nbits/8;
if(rem==0)
memcpy(ivec,ovec+num,AES_BLOCK_SIZE);
else
for(n=0 ; n < AES_BLOCK_SIZE ; ++n)
ivec[n] = ovec[n+num]<<rem | ovec[n+num+1]>>(8-rem);
/* it is not necessary to cleanse ovec, since the IV is not secret */
}
/* N.B. This expects the input to be packed, MS bit first */
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
const unsigned long length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
unsigned int n;
unsigned char c[1],d[1];
assert(in && out && key && ivec && num);
assert(*num == 0);
memset(out,0,(length+7)/8);
for(n=0 ; n < length ; ++n)
{
c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;
AES_cfbr_encrypt_block(c,d,1,key,ivec,enc);
out[n/8]=(out[n/8]&~(1 << (7-n%8)))|((d[0]&0x80) >> (n%8));
}
}
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
const unsigned long length, const AES_KEY *key,
unsigned char *ivec, int *num, const int enc)
{
unsigned int n;
assert(in && out && key && ivec && num);
assert(*num == 0);
for(n=0 ; n < length ; ++n)
AES_cfbr_encrypt_block(&in[n],&out[n],8,key,ivec,enc);
}
#endif /* #ifdef CRYPTO_AES_BUILD_MODE_CFB */
| [
"[email protected]"
] | |
a12cb6415899bccd22af5199c14268292dfaef71 | 410dafc3ca048a723826083b5dfd8ef7ec13c50c | /agent.h | 06334db2a29784c9af7e2202bd0e8c8a76672dec | [
"Apache-2.0"
] | permissive | erimatnor/opsim | 7d48a9f1c377259801b28c69694b67a6de99ffa7 | ae42ee916d64a392410c4cdfc8c5213d2edbada4 | refs/heads/master | 2016-08-05T11:19:35.765708 | 2012-12-19T18:55:53 | 2012-12-19T18:55:53 | 7,245,498 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 434 | h | #ifndef _AGENT_H
#define _AGENT_H
#include "packet.h"
struct agent {
unsigned int id;
struct node *n;
int (* init) (struct agent *);
int (* recv) (struct agent *, struct packet *);
int (* fini) (struct agent *);
};
#define MAX_AGENTS 10
int agent_register(struct node *n, struct agent *a);
int agent_recv(struct node *n, struct packet *p);
int agent_deregister(struct node *n, unsigned int agent_num);
#endif /* _AGENT_H */
| [
"[email protected]"
] | |
449aeddfc005000e1f5e2e66ef4df8f897bf0df0 | 4f573e0e1c855a0fcafa2a28603369d5b0885ecf | /leetcode/1~50/GenerateParentheses/GenerateParentheses/solution.c | 7b2e38dfcfadf0206e1b128d9f6b92d68033d854 | [] | no_license | KnewHow/studyAlgorithms | ef486cc05ff9462e6b40d07e2a7264d66b2331fa | a5581f8bfaf792f5b04fef6c690e3c1d3518a08a | refs/heads/master | 2020-12-26T14:55:35.598785 | 2020-12-21T11:51:53 | 2020-12-21T11:51:53 | 237,544,307 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 2,665 | c | #include<stdlib.h>
#include<stdio.h>
#include<malloc.h>
#include<math.h>
// 用于存储最终结果的二维数组
char **result = NULL;
// 结果的长度
int size = 0;
/**
* 将已经获取的结果转换为对应的字符串
* @param arr 已经计算好的数组,即每个 ( 后面有多少个 )
* @param n 对小括号
*/
char* toString(int* arr, int n) {
int total = 2 * n + 1;
char* str = (char*)malloc(sizeof(char) * total);
char* p = str;
for (int i = 0; i < n; i++) {
*p++ = '(';
int times = *(arr + i);
for (int j = 0; j < times; j++) {
*p++ = ')';
}
}
*p = '\0';
return str;
}
void printArr(int * arr, int size) {
printf("printArr strart=====\n");
for (int i = 0; i < size; i++) {
printf("%d, ", *(arr + i));
}
printf("\nprintArr end=====\n");
}
/**
* @param nth 当前第nth个(后面
* @param 总共有 n 个 (
* @param preResult 当前的结果数组
* @param used 当前已经使用的 )
* @param left 当前剩余的 )
*/
void generate(int nth, int n, int* preResult, int used, int left) {
// 我们只有计算到 n-1 ( 个即可,因为第 n 个后面剩下多少就是多少
if (nth < n) {
// 第 i 个 ( 后面最多可以有 i - used 个 arr
for (int i = 0; i <= nth - used; i++) {
// 创建新数组来保存结果
int* newResult = (int*)malloc(sizeof(int) * nth);
int j = 0;
// 合并前面的结果
for (int j = 0; j < nth - 1; j++) {
*(newResult + j) = *(preResult + j);
}
// 合并当前的结果
*(newResult + nth - 1) = i;
// 消耗数 = 之前消耗 + 当前消耗
// 剩余数 = 之前剩余 - 当前消耗
generate(nth + 1, n, newResult, used + i, left - i);
/*if (newResult != NULL) {
free(newResult);
}*/
}
}
else {
// 到第n个,说明已经到了最后一个,把剩下的作为最后一个后面的 ) 即可
int* newResult = (int*)malloc(sizeof(int) * nth);
// 合并前面的结果
for (int j = 0; j < nth - 1; j++) {
*(newResult + j) = *(preResult + j);
}
// 合并当前的结果
*(newResult + nth - 1) = left;
// 现在已经有了 n 个(,和每个( 后面有多少个 ),我们可以根据这些数据构建一个完整的字符串
*(result + size) = toString(newResult, n);
size++;
/*if (newResult != NULL) {
free(newResult);
}*/
}
}
char** generateParenthesis(int n, int* returnSize) {
result = (char**)malloc(sizeof(10240 * sizeof(char*)));
generate(1, n, NULL, 0, n);
*returnSize = size;
return result;
}
int main() {
int returnSize = 0;
char** r = generateParenthesis(5, &returnSize);
for (int i = 0; i < returnSize; i++) {
printf("%s\n", *(r + i));
}
system("pause");
return 0;
} | [
"[email protected]"
] | |
9523c4882e4f976d93522a75ecfe9e5175b6c86d | fdbb74a95924e2677466614f6ab6e2bb13b2a95a | /third_party/mbedtls/blake2b256.c | 2ffec50a859daf86727452910b1d3f348d03eef3 | [
"Apache-2.0",
"ISC"
] | permissive | jart/cosmopolitan | fb11b5658939023977060a7c6c71a74093d9cb44 | 0d748ad58e1063dd1f8560f18a0c75293b9415b7 | refs/heads/master | 2023-09-06T09:17:29.303607 | 2023-09-02T03:49:13 | 2023-09-02T03:50:18 | 272,457,606 | 11,887 | 435 | ISC | 2023-09-14T17:47:58 | 2020-06-15T14:16:13 | C | UTF-8 | C | false | false | 2,221 | c | /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:4;coding:utf-8 -*-│
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2021 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/str/blake2.h"
#include "third_party/mbedtls/md.h"
/* clang-format off */
const mbedtls_md_info_t mbedtls_blake2b256_info = {
"BLAKE2B256",
MBEDTLS_MD_BLAKE2B256,
BLAKE2B256_DIGEST_LENGTH,
BLAKE2B_CBLOCK,
(void *)BLAKE2B256_Init,
(void *)BLAKE2B256_Update,
(void *)BLAKE2B256_Process,
(void *)BLAKE2B256_Final,
(void *)BLAKE2B256,
};
| [
"[email protected]"
] | |
538570660b0c13d6f757f543c85cd2f4b85e26f1 | 01854edc58ec15c07bed2e020eb2eadd6bf3c526 | /3-16.c | 980e101af356741d51449a61b2e7af0082d29929 | [] | no_license | wanmai21/58224090121 | db16f1a42303e2526c39bfd1b07b64cc15b3e090 | 7fe1a122c909d570667ccbf8e8eca76429ba53e0 | refs/heads/master | 2021-01-20T07:29:00.754958 | 2017-08-27T09:47:02 | 2017-08-27T09:47:02 | 101,543,170 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 201 | c | #include<stdio.h>
int main()
{
printf ("My name is : %.2s\n","Kmitl")
printf ("My poin : %d\n",10+40+49);
printf ("Grade : %c\n",'A');
printf ("GPA : %.2f",3.99);
printf ("A= %c"65)
return 0;
}
| [
"[email protected]"
] | |
af864e31f70e36ee1a925b05562381f957df9a0d | 976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f | /source/ccv/test/unit/extr_numeric.tests.c_dt_min1d.c | 2ba4ce386e3ed80af1f614877d7aca21dd6cc134 | [] | no_license | isabella232/AnghaBench | 7ba90823cf8c0dd25a803d1688500eec91d1cf4e | 9a5f60cdc907a0475090eef45e5be43392c25132 | refs/heads/master | 2023-04-20T09:05:33.024569 | 2021-05-07T18:36:26 | 2021-05-07T18:36:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 664 | c | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward declarations */
/* Type definitions */
/* Variables and functions */
int /*<<< orphan*/ dt_min_helper (float*,float*,int*,int,int /*<<< orphan*/ ,int,int /*<<< orphan*/ ,int,float,float) ;
void dt_min1d(float *src, float *dst, int *ptr, int step, int n,
float a, float b) {
dt_min_helper(src, dst, ptr, step, 0, n-1, 0, n-1, a, b);
} | [
"[email protected]"
] | |
dc80bba3da47075abe3de4902bc6de67cbe07fc6 | 480e02007acb6d3ec510c4f5302f833ff63f4031 | /hw/mcu/nordic/src/ext/nrfx/soc/nrfx_irqs_nrf51.h | 11532c070a56e9e607183464ccfe062ec7386979 | [
"BSD-3-Clause",
"Apache-2.0",
"EPL-1.0",
"MIT",
"OFL-1.1",
"TCL",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-unknown"
] | permissive | makerdiary/mynewt-core | bb44cf918f54ba3ae806ddd922cf203b3f3c0a2c | b6612bf4fe79b3a89cc0500942a7eb3f7265f31e | refs/heads/master | 2021-01-24T08:46:52.414518 | 2018-04-03T15:54:36 | 2018-04-03T15:54:36 | 122,992,913 | 0 | 1 | Apache-2.0 | 2018-02-26T15:56:00 | 2018-02-26T15:56:00 | null | UTF-8 | C | false | false | 3,722 | h | /**
* Copyright (c) 2017, Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA 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 NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NRFX_IRQS_NRF51_H__
#define NRFX_IRQS_NRF51_H__
#ifdef __cplusplus
extern "C" {
#endif
// POWER_CLOCK_IRQn
#define nrfx_power_clock_irq_handler POWER_CLOCK_IRQHandler
// RADIO_IRQn
// UART0_IRQn
#define nrfx_uart_0_irq_handler UART0_IRQHandler
// SPI0_TWI0_IRQn
#if NRFX_CHECK(NRFX_PRS_ENABLED) && NRFX_CHECK(NRFX_PRS_BOX_0_ENABLED)
#define nrfx_prs_box_0_irq_handler SPI0_TWI0_IRQHandler
#else
#define nrfx_spi_0_irq_handler SPI0_TWI0_IRQHandler
#define nrfx_twi_0_irq_handler SPI0_TWI0_IRQHandler
#endif
// SPI1_TWI1_IRQn
#if NRFX_CHECK(NRFX_PRS_ENABLED) && NRFX_CHECK(NRFX_PRS_BOX_1_ENABLED)
#define nrfx_prs_box_1_irq_handler SPI1_TWI1_IRQHandler
#else
#define nrfx_spi_1_irq_handler SPI1_TWI1_IRQHandler
#define nrfx_spis_1_irq_handler SPI1_TWI1_IRQHandler
#define nrfx_twi_1_irq_handler SPI1_TWI1_IRQHandler
#endif
// GPIOTE_IRQn
#define nrfx_gpiote_irq_handler GPIOTE_IRQHandler
// ADC_IRQn
#define nrfx_adc_irq_handler ADC_IRQHandler
// TIMER0_IRQn
#define nrfx_timer_0_irq_handler TIMER0_IRQHandler
// TIMER1_IRQn
#define nrfx_timer_1_irq_handler TIMER1_IRQHandler
// TIMER2_IRQn
#define nrfx_timer_2_irq_handler TIMER2_IRQHandler
// RTC0_IRQn
#define nrfx_rtc_0_irq_handler RTC0_IRQHandler
// TEMP_IRQn
// RNG_IRQn
#define nrfx_rng_irq_handler RNG_IRQHandler
// ECB_IRQn
// CCM_AAR_IRQn
// WDT_IRQn
#define nrfx_wdt_irq_handler WDT_IRQHandler
// RTC1_IRQn
#define nrfx_rtc_1_irq_handler RTC1_IRQHandler
// QDEC_IRQn
#define nrfx_qdec_irq_handler QDEC_IRQHandler
// LPCOMP_IRQn
#define nrfx_lpcomp_irq_handler LPCOMP_IRQHandler
// SWI0_IRQn
#define nrfx_swi_0_irq_handler SWI0_IRQHandler
// SWI1_IRQn
#define nrfx_swi_1_irq_handler SWI1_IRQHandler
// SWI2_IRQn
#define nrfx_swi_2_irq_handler SWI2_IRQHandler
// SWI3_IRQn
#define nrfx_swi_3_irq_handler SWI3_IRQHandler
// SWI4_IRQn
#define nrfx_swi_4_irq_handler SWI4_IRQHandler
// SWI5_IRQn
#define nrfx_swi_5_irq_handler SWI5_IRQHandler
#ifdef __cplusplus
}
#endif
#endif // NRFX_IRQS_NRF51_H__
| [
"[email protected]"
] | |
e733dd4c33cc43414b88d0e9bcceb901b96491cf | 2f28185d5157f996f61f5743583b17dc64b378cb | /Pods/Headers/Private/UIDevice-Hardware/UIDevice-Hardware.h | d7842e4ed165992edb8b30e32a46d92323be52cb | [
"Apache-2.0"
] | permissive | haithamkhedre/q-municate | 19462cd9e86728758826f0fffba4653e485e57dd | ca7b430756566334391b1d4e22d05c6454d13864 | refs/heads/master | 2023-01-29T14:18:42.731034 | 2020-12-10T04:06:59 | 2020-12-10T04:06:59 | 319,564,953 | 0 | 0 | Apache-2.0 | 2020-12-10T04:13:43 | 2020-12-08T07:49:51 | Objective-C | UTF-8 | C | false | false | 46 | h | ../../../UIDevice-Hardware/UIDevice-Hardware.h | [
"[email protected]"
] | |
508a12e0bbf98d256f6364e564565d82debead13 | 0210327555e1d83304d60c009caab37b274a795f | /laure_thomas/insertion_abr.c | 277b2ca82baa695e8075a2dc815973048f704f95 | [] | no_license | cnam-stmn-2018-2021/c | 3a2ed5a33f3ac72e22d937b837a2498d9e5c5136 | ce4afcb142ec33e9050963cea86c9d08b001aaf3 | refs/heads/master | 2020-03-28T09:33:53.015580 | 2018-10-16T16:27:44 | 2018-10-16T16:27:44 | 148,043,301 | 0 | 2 | null | 2018-10-16T16:27:45 | 2018-09-09T16:19:11 | C | UTF-8 | C | false | false | 1,934 | c | #include <stdio.h>
#include <stdlib.h>
struct noeud
{
int val;
struct noeud *filsGauche, *filsDroit;
};
struct maillon
{
struct noeud *val;
struct maillon *suivant;
};
void insere_abr(struct noeud **racine, int val);
struct noeud *cree_abr(int *tab, int taille);
struct noeud *defile(struct maillon **tete, struct maillon **queue);
void main(void)
{
}
// Insère un seul élément dans l'arbre.
void insere_abr(struct noeud **racine, int val)
{
int fini = 0;
struct noeud *ptr, *ptr2;
ptr = (struct noeud *)malloc(sizeof(struct noeud));
ptr->val = val;
ptr->filsGauche = NULL;
ptr->filsDroit = NULL;
if (*racine == NULL) {
*racine = ptr;
} else {
ptr2 = *racine;
while (!fini) {
if (ptr2->val > val) {
if (ptr2->filsGauche == NULL) {
ptr2->filsGauche = ptr;
fini = 1;
} else {
ptr2 = ptr2->filsGauche;
}
} else {
if (ptr2->filsDroit == NULL) {
ptr2->filsDroit = ptr;
fini = 1;
} else {
ptr2 = ptr2->filsDroit;
}
}
}
}
}
struct noeud *cree_abr(int *tab, int taille)
{
struct noeud *racine = NULL;
int i;
for (i = 0; i < taille; i++) {
insere(&racine, tab[i]);
}
return racine;
}
struct noeud *defile(struct maillon **tete, struct maillon **queue)
{
struct noeud *val, *tmp;
if (*tete != NULL && *queue != NULL) {
if (*tete != *queue) {
val = (*tete)->val;
tmp = *tete;
*tete = (*tete)->suivant;
free(tmp);
return val;
} else {
val = (*tete)->val;
free(*tete);
*tete = NULL;
*queue = NULL;
return val;
}
}
} | [
"[email protected]"
] | |
66687af237d0dba42ea434f4afb7fa1e1b910c8d | 9d19bca59e813ff87d1d72866706173be0c652d9 | /srcs/string/ft_strncpy.c | 7bba8edb47c7f17d23efaa1c7275273f8d445a83 | [] | no_license | Raphy42/Libft | 0b70af220e9920615476fa83e5ce4b8bd806f74c | 77d0e647ba22f0c5673ca772a96d6c107b34c08e | refs/heads/master | 2021-01-01T06:39:47.127910 | 2015-05-03T19:08:28 | 2015-05-03T19:08:28 | 34,997,183 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,108 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rdantzer <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/05 12:16:03 by rdantzer #+# #+# */
/* Updated: 2014/11/12 16:08:42 by rdantzer ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
char *ft_strncpy(char *dst, const char *src, size_t n)
{
char *s;
s = dst;
while (n > 0 && *src != 0)
{
*s++ = *src++;
n--;
}
while (n > 0)
{
*s++ = 0;
n--;
}
return (dst);
}
| [
"[email protected]"
] | |
7122fafd302e83ad85ecfdd1025ff1f56cd9fc80 | 9c0e0dc9cac1a2d59bad64e168f8d5eeea10260f | /synergy/ssp/src/bsp/mcu/s3a7/bsp_cache.h | 6d2ed3470059c1df8170ec120186c32b87e715ab | [] | no_license | caiogubel/Tuning_AE_CAP1_S3A7_ST | bd770496c462d043e8fa46e1f40ebc78013ff369 | 6880b8e652cb071d3f55056471f05c27d61d414e | refs/heads/master | 2021-04-18T18:56:39.709667 | 2018-03-24T00:08:12 | 2018-03-24T00:08:12 | 126,550,320 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 3,816 | h | /***********************************************************************************************************************
* Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
*
* This file is part of Renesas SynergyTM Software Package (SSP)
*
* The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
* and/or its licensors ("Renesas") and subject to statutory and contractual protections.
*
* This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with
* Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
* or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
* MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
* "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
* CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
* CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
* included in this file may be subject to different terms.
**********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : bsp_cache.h
* Description : This module implements cache functions.
***********************************************************************************************************************/
#ifndef BSP_CACHE_H_
#define BSP_CACHE_H_
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/*******************************************************************************************************************//**
* @ingroup BSP_MCU_S3A7
* @defgroup BSP_MCU_CACHE_S3A7 Cache Functions
*
* This module implements cache functions.
*
* @{
**********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/** Cache enum. Passed into cache functions such as R_BSP_CacheOff() and R_BSP_CacheSet. */
typedef enum e_bsp_cache_state
{
BSP_CACHE_STATE_OFF,
BSP_CACHE_STATE_ON,
} bsp_cache_state_t;
typedef uint32_t bsp_cache_frequency_t;
/** @} (end defgroup BSP_MCU_CACHE_S3A7) */
/***********************************************************************************************************************
Exported global variables
***********************************************************************************************************************/
/***********************************************************************************************************************
Exported global functions (to be accessed by other files)
***********************************************************************************************************************/
/* Public functions defined in bsp.h */
#endif /* BSP_CACHE_H_ */
| [
"[email protected]"
] | |
d8e519446b4e6bdcc4e12ecd16061e51ffbbd997 | 8058d2807fac042f972d3698c245efab31100b3e | /Iniciaçao ao UBUNTU/Experiencias/main_argumentos.c | bfd32a9bcb44af528823f9eadc03aff873c6270c | [] | no_license | saasousa18/TESE-UA---ATLASCAR---LEITURA-DA-CENTRALINA | 027225997dcefdfcf6440f33c3be65e7d130eeb7 | 3ac28fac302539802919e6d347a10f7c6cd5f3d4 | refs/heads/master | 2021-09-03T04:32:04.506703 | 2018-01-05T15:31:42 | 2018-01-05T15:31:42 | 110,358,759 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 352 | c | //programa: a funçao main aceita argumentos de entrada e representa-os
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[ ]){
int cont;
printf("O nome do programa é: %s\n",argv[0]); // o argv[0] é onde está guardado o nome do ficheiro
for(cont=1;cont<argc;cont++){
printf("%d Parametro %s\n", cont, argv[cont]);
}
return 0;
}
| [
"[email protected]"
] | |
0fbb9d4d9f881c55b5901c9af3a87c1cfe8d430e | a7dcd1a537555879a80c3257c9dcb20ad0bf78f7 | /Demo/nodejs_ex/public/test_set/Run-length_Encoding/조재현(whwogus)_point_0/source/main.c | 048e39d881093339bf5d8a38c5138941041222f1 | [] | no_license | thema0park/clustering_project | 85879582d053363f76987c8a9ab15ee1662e5ae2 | f0a78d14128e719cf1e70a25b0a06846beccaaec | refs/heads/main | 2023-04-04T10:47:30.767303 | 2021-04-18T14:03:57 | 2021-04-18T14:03:57 | 340,849,187 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,072 | c | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include <string.h>
#define MAX_LEN 51
int main()
{
char input[MAX_LEN];
char output[MAX_LEN];
int len, num, encoded_len = 0; //
int i;
int count = 1;
scanf("%s", input);
////////////////////////////////////////
for (i=0;i<MAX_LEN;i++)
{
if (input[i] == input[i+1])
{
count +=1;
if (input[i+1] == input[i+2]){
count +=1;
if (input[i+1] == input[i+2]){
count +=1;
if (input[i+1] == input[i+2]){
count +=1;
if (input[i+1] == input[i+2]){
count +=1;
if (input[i+1] == input[i+2]){
count +=1;
}
}
}
}
}
}
}
////////////////////////////////////////
printf("%s\n", input);
printf("%s\n", output);
printf("%.6lf(%d/%d)\n", (double)len / encoded_len, len, encoded_len); // 압축률, 원래길이, 압축길이
return 0;
}
| [
"[email protected]"
] | |
7d2a726fe03209a13c093c8e1485356662dbadad | f3aa587d3e6e38e688276c2dbf761fff686955a4 | /modules/nonvolatilemem.c | cff616cb2fb01d17b0989bab3d2b6fda8075c674 | [] | no_license | arjanvanheusden/bikeproject | e710841e880b35cb808f3bc59e712197a5b1c57f | bf77a5e23ed7a475c56efccab32f06b501095e4a | refs/heads/master | 2016-09-07T18:43:48.928615 | 2015-07-11T05:38:38 | 2015-07-11T05:38:38 | 38,915,075 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,042 | c | /*
* nonvolatilemem.c
*
* Created on: Dec 29, 2014
* Author: arjan
*/
#include "../modules/nonvolatilemem.h"
#include "../peripherals/EEPROM.h"
#include "../peripherals/USART.h"
typedef struct{
unsigned char identifier;
unsigned char ee_address;
unsigned char *loc_address;
unsigned char len;
unsigned char valid;
}t_nvmem_entry;
#define NVMEM_IDSTRING_L 16
unsigned char NVMEM_idstring_dat[NVMEM_IDSTRING_L];
/*
t_nvmmem_entry nvmem_entries[] = {
{NVMEM_ID_IDSTRING, this entry is identified hereby
0, ee address
NVMEM_idstring_dat, container pointer, uninitialised
NVMEM_IDSTRING_L, length
0, valid
}
};
*/
void NVMEM_init()
{
unsigned int i;
/*read valid byte for id string*/
//nvmem_entries[NVMEM_ID_IDSTRING].valid = EEPROM_read();
/*read id string from eeprom*/
//for(i=0;i<NVMEM_IDSTRING_L;i++){
// NVMEM_idstring_dat[i] = EEPROM_read(NVMEM_IDSTRING_A + i);
//}
USART_printf("NVMEM_idstring read: ");
USART_printf(NVMEM_idstring_dat);
USART_printf("\r\n");
}
| [
"[email protected]"
] | |
817fc06e580237c66386aef1e4894e20efd28dfe | bfc28ceec93416c1e4fcc938c25d64130a9762a3 | /project_wifi/boards/twrk24f120m/rtos_examples/freertos_dspi_rf _spirit1/clock_config.c | c14b5ab24c6262b5a0c85dd53065bfef6c267be4 | [] | no_license | ywtgogo/sd_mk24n256 | 857978d8e63eec6c9bc29475e1845c80be5d56c9 | a4e572f1db8b73e2dfec0012fe12626abff0840c | refs/heads/master | 2021-01-02T22:59:39.165914 | 2017-08-05T16:08:41 | 2017-08-05T16:08:41 | 99,433,215 | 2 | 2 | null | null | null | null | UTF-8 | C | false | false | 8,117 | c | /*
* Copyright (c) 2015, Freescale Semiconductor, 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:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, 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.
*/
#include "fsl_common.h"
#include "fsl_smc.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @brief Clock configuration structure. */
typedef struct _clock_config
{
mcg_config_t mcgConfig; /*!< MCG configuration. */
sim_clock_config_t simConfig; /*!< SIM configuration. */
osc_config_t oscConfig; /*!< OSC configuration. */
uint32_t coreClock; /*!< core clock frequency. */
} clock_config_t;
/*******************************************************************************
* Variables
******************************************************************************/
/* System clock frequency. */
extern uint32_t SystemCoreClock;
/* Configuration for enter VLPR mode. Core clock = 4MHz. */
const clock_config_t g_defaultClockConfigVlpr = {
.mcgConfig =
{
.mcgMode = kMCG_ModeBLPI, /* Work in BLPI mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcFast, /* Select IRC4M. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 0U,
.drs = kMCG_DrsLow, /* Low frequency range. */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25%. */
.oscsel = kMCG_OscselOsc, /* Select OSC. */
.pll0Config =
{
.enableMode = 0U, /* Don't eanble PLL. */
.prdiv = 0U,
.vdiv = 0U,
},
},
.simConfig =
{
.pllFllSel = 3U, /* PLLFLLSEL select IRC48MCLK. */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x00040000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeExt,
.oscerConfig =
{
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}},
.coreClock = 4000000U, /* Core clock frequency */
};
/* Configuration for enter RUN mode. Core clock = 120MHz. */
const clock_config_t g_defaultClockConfigRun = {
.mcgConfig =
{
.mcgMode = kMCG_ModePEE, /* Work in PEE mode. */
.irclkEnableMode = kMCG_IrclkEnable, /* MCGIRCLK enable. */
.ircs = kMCG_IrcSlow, /* Select IRC32k. */
.fcrdiv = 0U, /* FCRDIV is 0. */
.frdiv = 7U,
.drs = kMCG_DrsLow, /* Low frequency range. */
.dmx32 = kMCG_Dmx32Default, /* DCO has a default range of 25%. */
.oscsel = kMCG_OscselIrc, /* Select OSC. */
.pll0Config =
{
.enableMode = 0U, .prdiv = 0xbU, .vdiv = 0x6U,
},
},
.simConfig =
{
.pllFllSel = 1U, /* PLLFLLSEL select PLL. */
.er32kSrc = 2U, /* ERCLK32K selection, use RTC. */
.clkdiv1 = 0x01140000U, /* SIM_CLKDIV1. */
},
.oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeExt,
.oscerConfig =
{
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}},
.coreClock = 120000000U, /* Core clock frequency */
};
/*******************************************************************************
* Code
******************************************************************************/
/*
* How to setup clock using clock driver functions:
*
* 1. CLOCK_SetSimSafeDivs, to make sure core clock, bus clock, flexbus clock
* and flash clock are in allowed range during clock mode switch.
*
* 2. Call CLOCK_Osc0Init to setup OSC clock, if it is used in target mode.
*
* 3. Set MCG configuration, MCG includes three parts: FLL clock, PLL clock and
* internal reference clock(MCGIRCLK). Follow the steps to setup:
*
* 1). Call CLOCK_BootToXxxMode to set MCG to target mode.
*
* 2). If target mode is FBI/BLPI/PBI mode, the MCGIRCLK has been configured
* correctly. For other modes, need to call CLOCK_SetInternalRefClkConfig
* explicitly to setup MCGIRCLK.
*
* 3). Don't need to configure FLL explicitly, because if target mode is FLL
* mode, then FLL has been configured by the function CLOCK_BootToXxxMode,
* if the target mode is not FLL mode, the FLL is disabled.
*
* 4). If target mode is PEE/PBE/PEI/PBI mode, then the related PLL has been
* setup by CLOCK_BootToXxxMode. In FBE/FBI/FEE/FBE mode, the PLL could
* be enabled independently, call CLOCK_EnablePll0 explicitly in this case.
*
* 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM.
*/
void BOARD_BootClockVLPR(void)
{
CLOCK_SetSimSafeDivs();
CLOCK_BootToBlpiMode(g_defaultClockConfigVlpr.mcgConfig.fcrdiv, g_defaultClockConfigVlpr.mcgConfig.ircs,
g_defaultClockConfigVlpr.mcgConfig.irclkEnableMode);
CLOCK_SetSimConfig(&g_defaultClockConfigVlpr.simConfig);
SystemCoreClock = g_defaultClockConfigVlpr.coreClock;
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
SMC_SetPowerModeVlpr(SMC, false);
while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateVlpr)
{
}
}
void BOARD_BootClockRUN(void)
{
CLOCK_SetSimSafeDivs();
CLOCK_InitOsc0(&g_defaultClockConfigRun.oscConfig);
CLOCK_SetXtal0Freq(BOARD_XTAL0_CLK_HZ);
CLOCK_BootToPeeMode(g_defaultClockConfigRun.mcgConfig.oscsel, kMCG_PllClkSelPll0,
&g_defaultClockConfigRun.mcgConfig.pll0Config);
CLOCK_SetInternalRefClkConfig(g_defaultClockConfigRun.mcgConfig.irclkEnableMode,
g_defaultClockConfigRun.mcgConfig.ircs, g_defaultClockConfigRun.mcgConfig.fcrdiv);
CLOCK_SetSimConfig(&g_defaultClockConfigRun.simConfig);
SystemCoreClock = g_defaultClockConfigRun.coreClock;
}
| [
"[email protected]"
] | |
2d8999d740513ec846da3f4455cea56792a3acc1 | a4af8baee721e7c3610688a6e68586d839095c70 | /c_strings_and_arrays/string/strchr.c | 2b28a77b5f70f9128c66b3a9a71c4192b4093c1f | [] | no_license | timothyshull/cpp_scratchpad_old | 0b086916a6b93189d842f89806428976925ecc2b | f670085fa92b8cf4b911a522f88d75d7cc6a759b | refs/heads/master | 2021-01-22T20:34:31.008988 | 2017-03-17T15:52:41 | 2017-03-17T15:52:41 | 85,329,261 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 7,209 | c | /* Copyright (C) 1991,1993-1997,1999,2000,2003,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Based on strlen implementation by Torbjorn Granlund ([email protected]),
with help from Dan Sahlin ([email protected]) and
bug fix and commentary by Jim Blandy ([email protected]);
adaptation to strchr suggested by Dick Karpinski ([email protected]),
and implemented by Roland McGrath ([email protected]).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <string.h>
#include <memcopy.h>
#include <stdlib.h>
#undef strchr
/* Find the first occurrence of C in S. */
char *
strchr(s, c_in)
const char *s;
int c_in;
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, magic_bits, charmask;
unsigned char c;
c = (unsigned char) c_in;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
for (char_ptr = (const unsigned char *) s;
((unsigned long int) char_ptr & (sizeof(longword) - 1)) != 0;
++char_ptr) {
if (*char_ptr == c) {
return (void *) char_ptr;
} else if (*char_ptr == '\0') {
return NULL;
}
}
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
longword_ptr = (unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
each byte, with an extra at the end:
bits: 01111110 11111110 11111110 11111111
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
switch (sizeof(longword)) {
case 4:
magic_bits = 0x7efefeffL;
break;
case 8:
magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
break;
default:
abort();
}
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
if (sizeof(longword) > 4) {
/* Do the shift in two steps to avoid a warning if long has 32 bits. */
charmask |= (charmask << 16) << 16;
}
if (sizeof(longword) > 8) {
abort();
}
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
if *any of the four* bytes in the longword in question are zero. */
for (;;) {
/* We tentatively exit the loop if adding MAGIC_BITS to
LONGWORD fails to change any of the hole bits of LONGWORD.
1) Is this safe? Will it catch all the zero bytes?
Suppose there is a byte with all zeros. Any carry bits
propagating from its left will fall into the hole at its
least significant bit and stop. Since there will be no
carry from its most significant bit, the LSB of the
byte to the left will be unchanged, and the zero will be
detected.
2) Is this worthwhile? Will it ignore everything except
zero bytes? Suppose every byte of LONGWORD has a bit set
somewhere. There will be a carry into bit 8. If bit 8
is set, this will carry into bit 16. If bit 8 is clear,
one of bits 9-15 must be set, so there will be a carry
into bit 16. Similarly, there will be a carry into bit
24. If one of bits 24-30 is set, there will be a carry
into bit 31, so all of the hole bits will be changed.
The one misfire occurs when bits 24-30 are clear and bit
31 is set; in this case, the hole at bit 31 is not
changed. If we had access to the processor carry flag,
we could close this loophole by putting the fourth hole
at bit 32!
So it ignores everything except 128's, when they're aligned
properly.
3) But wait! Aren't we looking for C as well as zero?
Good point. So what we do is XOR LONGWORD with a longword,
each of whose bytes is C. This turns each byte that is C
into a zero. */
longword = *longword_ptr++;
/* Add MAGIC_BITS to LONGWORD. */
if ((((longword + magic_bits)
/* Set those bits that were unchanged by the addition. */
^ ~longword)
/* Look at only the hole bits. If any of the hole bits
are unchanged, most likely one of the bytes was a
zero. */
& ~magic_bits) != 0 ||
/* That caught zeroes. Now test for C. */
((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
& ~magic_bits) != 0) {
/* Which of the bytes was C or zero?
If none of them were, it was a misfire; continue the search. */
const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
if (*cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (sizeof(longword) > 4) {
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
if (*++cp == c) {
return (char *) cp;
} else if (*cp == '\0') {
return NULL;
}
}
}
}
return NULL;
}
#ifdef weak_alias
#undef index
weak_alias (strchr, index)
#endif
libc_hidden_builtin_def (strchr)
| [
"[email protected]"
] | |
ce7df61f18b2710dd0fa846e439a6bd12ecf79a6 | af010e0de25807f8ceaac7eb2425440cec1ae1da | /src/packet_alloc_legacy.c | c953a587520ccfb65b79e5b8a43484a06a2e9fa6 | [] | no_license | wizardst/zeq | 2e91620aec56cd2b78e02b73d9e8d5962ec8fef9 | bcc07d6d9c8792ac9c8326493129b0dbfe1223f9 | refs/heads/master | 2020-12-03T13:29:52.634570 | 2018-06-29T05:21:56 | 2018-06-29T05:21:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,176 | c |
#include <stdint.h>
#include <string.h>
#include "packet_structs_legacy.h"
#include "zeq_alloc.h"
#include "zeq_atomic.h"
#include "zeq_byte.h"
#include "zeq_err.h"
int packet_alloc_legacy(PacketLegacy** out, uint16_t opcode, const void* vdata, uint32_t dataLength)
{
const byte* data = (const byte*)vdata;
PacketLegacy* top = NULL;
uint32_t count = 1;
uint32_t total = dataLength + ZEQ_PACKET_LEGACY_OPCODE_SIZE;
/* Except for the opcode, no overhead is counted toward the MTU for legacy packets.
** For fragmented packets, it's important to use as much of the MTU space as possible;
** the client will reject non-final fragment packets that don't have a full MTU worth of data.
*/
if (total > ZEQ_PACKET_LEGACY_DATA_MTU) {
count = total / ZEQ_PACKET_LEGACY_DATA_MTU;
if ((total % ZEQ_PACKET_LEGACY_DATA_MTU) != 0)
count++;
}
if (count == 1) {
top = (PacketLegacy*)zeq_malloc(ZEQ_PACKET_LEGACY_ALLOC_SIZE);
if (!top) return ZEQ_ERR_MEMORY;
top->common.next = NULL;
top->common.refCount = 1;
top->offset = ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE; /*fixme: if offset and flags are constant, remove*/
top->flags = 0;
top->len = (uint16_t)total;
top->fragIndex = 0;
top->fragCount = 0;
memcpy(&top->buffer[ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE], &opcode, ZEQ_PACKET_LEGACY_OPCODE_SIZE);
memcpy(&top->buffer[ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE + ZEQ_PACKET_LEGACY_OPCODE_SIZE], data, dataLength);
} else {
PacketLegacy* prev = NULL;
uint32_t i;
for (i = 0; i < count; i++) {
PacketLegacy* packet = (PacketLegacy*)zeq_malloc(ZEQ_PACKET_LEGACY_ALLOC_SIZE);
uint32_t offset = ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE;
uint32_t len;
if (!packet) goto oom;
if (i == 0) {
len = ZEQ_PACKET_LEGACY_DATA_MTU - ZEQ_PACKET_LEGACY_OPCODE_SIZE;
top = packet;
offset += ZEQ_PACKET_LEGACY_OPCODE_SIZE;
memcpy(&packet->buffer[ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE], &opcode, ZEQ_PACKET_LEGACY_OPCODE_SIZE);
} else {
prev->common.nextLegacy = packet;
if (i == (count - 1)) {
len = dataLength % ZEQ_PACKET_LEGACY_DATA_MTU;
if (len == 0) goto max_mtu;
} else {
max_mtu:
len = ZEQ_PACKET_LEGACY_DATA_MTU;
}
}
packet->common.next = NULL;
packet->common.refCount = 1;
packet->offset = ZEQ_PACKET_LEGACY_MAX_HEADER_SIZE;
packet->flags = 0;
packet->len = (uint16_t)len;
packet->fragIndex = (uint16_t)i;
packet->fragCount = (uint16_t)count;
memcpy(&packet->buffer[offset], data, len);
data += len;
prev = packet;
}
}
*out = top;
return ZEQ_OK;
oom:
while (top) {
PacketLegacy* next = top->common.nextLegacy;
free(top);
top = next;
}
return ZEQ_ERR_MEMORY;
}
| [
"[email protected]"
] | |
0794ac061141e5e115cffea5d5662d70374e562d | 06afdb985b0ee0e662bb13d22ff90d82e3e810d0 | /examples/guesser/guesser.c | 184c50e4e19d3ccd69968e0cc78aab3751189beb | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | harkal/picovm | 786ece6c15d0a875b36ee4ae05e09c2a662f1502 | 0dfd82db9f6315c9cf7e4bacb6ff7869d28b8243 | refs/heads/master | 2022-11-23T22:18:57.167024 | 2020-07-31T16:19:16 | 2020-07-31T16:19:16 | 272,887,642 | 16 | 2 | null | null | null | null | UTF-8 | C | false | false | 981 | c |
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "../../src/picovm.h"
#define UNUSED __attribute__((unused))
void call_user(void *ctx);
#define VM_SIZE 1024
uint8_t vm_memory[VM_SIZE];
struct picovm_s vm = {
0, VM_SIZE, &vm_memory[0] + VM_SIZE, 0,
&vm_memory,
NULL,
call_user
};
void call_user(void *ctx UNUSED)
{
uint8_t op = *(char *)vm.sp;
switch (op)
{
case 0:
putc(*(char *)(vm.sp + 1), stdout);
break;
case 1:
*vm.sp = getc(stdin);
break;
case 2:
*vm.sp = rand() & 0xff;
break;
default:
break;
}
}
int main(int argc UNUSED, char **argv UNUSED)
{
time_t t;
srand((unsigned) time(&t));
memset(vm_memory, 0, VM_SIZE);
int ch;
FILE *f = fopen("guesser.hex", "rb");
if (!f)
return 1;
for (int i = 0; (ch = fgetc(f)) != -1; i++)
vm_memory[i] = ch;
fclose(f);
int i;
for(i = 0 ; ; i++) {
if(picovm_exec(&vm))
break;
}
printf("\n\nExecuted %d instructions", i);
return 0;
}
| [
"[email protected]"
] | |
961f771e4831a7c9f3b78dee3de7a3897f233a16 | 303cb679fdcd8a436dbd373f98da679eefefae01 | /3rdParty/DirectFB/lib/direct/mem.h | 8badce6118604bce15b406a5d2e1fd4a7f2b8f94 | [
"MIT",
"LGPL-2.0-or-later",
"LGPL-2.1-only"
] | permissive | rohmer/LVGL_UI_Creator | d812a66ca8e3f8a736b02f074d6fbb324560b881 | 8ff044064819be0ab52eee89642956a3cc81564b | refs/heads/Dev | 2023-02-16T01:25:33.247640 | 2023-02-09T16:58:50 | 2023-02-09T16:58:50 | 209,129,978 | 37 | 17 | MIT | 2023-02-09T16:58:51 | 2019-09-17T18:35:36 | C | UTF-8 | C | false | false | 3,694 | h | /*
(c) Copyright 2012-2013 DirectFB integrated media GmbH
(c) Copyright 2001-2013 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <[email protected]>,
Andreas Shimokawa <[email protected]>,
Marek Pikarski <[email protected]>,
Sven Neumann <[email protected]>,
Ville Syrjälä <[email protected]> and
Claudio Ciccani <[email protected]>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __DIRECT__MEM_H__
#define __DIRECT__MEM_H__
#include <direct/os/mem.h>
/**********************************************************************************************************************/
void DIRECT_API direct_print_memleaks( void );
/**********************************************************************************************************************/
void DIRECT_API *direct_dbg_malloc ( const char *file, int line,
const char *func, size_t bytes );
void DIRECT_API *direct_dbg_calloc ( const char *file, int line,
const char *func, size_t count, size_t bytes);
void DIRECT_API *direct_dbg_realloc( const char *file, int line,
const char *func, const char *what, void *mem,
size_t bytes );
char DIRECT_API *direct_dbg_strdup ( const char *file, int line,
const char *func, const char *str );
void DIRECT_API direct_dbg_free ( const char *file, int line,
const char *func, const char *what, void *mem );
/**********************************************************************************************************************/
#if DIRECT_BUILD_DEBUG || defined(DIRECT_ENABLE_DEBUG) || defined(DIRECT_FORCE_DEBUG) || defined(DIRECT_MEM_DEBUG)
#if !DIRECT_BUILD_DEBUGS
#warning Building with debug, but library headers suggest that debug is not supported.
#endif
#define D_MALLOC(bytes) direct_dbg_malloc( __FILE__, __LINE__, __FUNCTION__, bytes )
#define D_CALLOC(count,bytes) direct_dbg_calloc( __FILE__, __LINE__, __FUNCTION__, count, bytes )
#define D_REALLOC(mem,bytes) direct_dbg_realloc( __FILE__, __LINE__, __FUNCTION__, #mem, mem, bytes )
#define D_STRDUP(str) direct_dbg_strdup( __FILE__, __LINE__, __FUNCTION__, str )
#define D_FREE(mem) direct_dbg_free( __FILE__, __LINE__, __FUNCTION__, #mem, mem )
#else
/**********************************************************************************************************************/
/* base malloc is declared in direct/os/mem.h */
#define D_MALLOC direct_malloc
#define D_CALLOC direct_calloc
#define D_REALLOC direct_realloc
#define D_STRDUP direct_strdup
#define D_FREE direct_free
#endif
void __D_mem_init( void );
void __D_mem_deinit( void );
#endif
| [
"[email protected]"
] | |
4d7728b476214378594fed5fe241789d76a2c699 | bccb09267145a9663b996f4716a1aa7a9c118118 | /GameServer/GameServer/List.c | c15c3af74386c80611e194b89905f6da7611712c | [] | no_license | KimMyungJung/first | 1f2fe2f0a70c8b38f136bc2aa892a2dd844707cd | c73da1d3be23abfcdde1436ca3701c620f805301 | refs/heads/master | 2020-04-23T13:08:44.349754 | 2019-06-17T10:02:06 | 2019-06-17T10:02:06 | 171,193,547 | 0 | 0 | null | null | null | null | UHC | C | false | false | 2,160 | c | #include "list.h"
#include <stdlib.h>
void init_list(list* mylist) {
mylist->head = (node*)malloc(sizeof(node));
mylist->head->next = NULL;
mylist->last = mylist->head;
mylist->size = 0;
}
void push_back(list* mylist, void* value) {
node* new_node = (node*)malloc(sizeof(node));
new_node->value = value;
new_node->next = NULL;
mylist->last->next = new_node;
mylist->last = new_node;
mylist->size++;
}
void* get_idx(list* mylist, int idx) {
node* pre_node = mylist->head;
while (idx--) {
pre_node = pre_node->next;
}
return pre_node->next->value;
}
int count_target(list* mylist, int target) {
int count = 0;
for (node* pre_node = mylist->head; pre_node->next != NULL; pre_node = pre_node->next) {
if (pre_node->next->value == target) {
count++;
}
}
return count;
}
void clear_list(list* mylist) {
free_node(mylist->head);
init_list(mylist);
}
void free_node(node* current_node) {
if (current_node->next != NULL) {
free_node(current_node->next);
}
free(current_node);
}
int find_node(list* mylist,void *data, int(*find)(void*, void*)){
int count = 0;
for (node* pre_node = mylist->head; pre_node->next != NULL; pre_node = pre_node->next) {
if (!find(pre_node->next->value, data)) {
return 0;
}
}
return 1;
}
void* delete_node(list* mylist, void *data, int(*find)(void*, void*)) {
int len = mylist->size;
node* pre_node = mylist->head;
node* cur;
void* del = NULL;
while(len--)
{
cur = pre_node->next;
//head부터 탐색해서 같으면 삭제
if (!find(cur->value, data))
{
if (cur == mylist->last)
{
//현재 노드
pre_node->next = NULL;
mylist->last = pre_node;
}
else
{
pre_node->next = cur->next;
}
del = cur->value;
//free_node(cur);
//free(cur);
mylist->size--;
return del;
}
pre_node = cur;
}
//node* cur;
//void* del;
//for (node* pre_node = mylist->head; pre_node->next != NULL; pre_node = pre_node->next) {
//if (!find(pre_node->next->value, data)) {
// cur = pre_node->next;
// pre_node->next = cur->next;
// del = cur->value;
// free_node(cur);
// return del;
//}
//}
return NULL;
} | [
"[email protected]"
] | |
cdaa40fcee6ce3819684e03074c09184b739d702 | a03d56b9e33dccaf730c9e7d966d41495272852d | /tercer_parcial/prefijo/prefijo.c | c96111c5ce453dfa1286bd5c9bd26a358a2eeac5 | [] | no_license | HarumiGallegosBarrios/edd2015 | 4e76149347dbfbb35f811d667016233a7e9824f3 | 7e4d100d847fc5429b9bbcc6effd900ead486e73 | refs/heads/master | 2021-01-02T08:56:08.729225 | 2015-12-16T05:18:29 | 2015-12-16T05:18:29 | 42,908,035 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 759 | c | #include <stdio.h>
#include "funciones.h"
int main()
{
struct nodo_doble cabecera;
int valor_nuevo = 0;
inicializar(&cabecera);
printf("Introduce los datos\nIntroduce -1 cuando finalices\n");
while(valor_nuevo != -1){
scanf("%d", &valor_nuevo);
if(valor_nuevo != -1){
if(valor_nuevo != '-' ||valor_nuevo != '+' ||valor_nuevo != '*'||valor_nuevo != '/'){
insertar_al_final(&cabecera, valor_nuevo);
}
}
else{
if(valor_nuevo != -1){
insertar_al_principio(&cabecera, valor_nuevo);
}
}
}
resultado(&cabecera);
imprimir_lista(&cabecera);
return 0;
}
| [
"harumi@ubuntu.(none)"
] | harumi@ubuntu.(none) |
62eeca2e573674d83f0738d4135818b4c60574e0 | 79d4bab23d0f9227cce8951695faefbd88f6aaff | /C/src/FAC1/l3q2.c | 183fba5a59bcbf66c7e89e9f9e14f40f897f4acb | [] | no_license | maxjonata/Study-Projects | 68e54236d1ae263fc775e05030af664c7c3b17e9 | bd37b0ad85359e02dbd9743c0e0e7a8514131314 | refs/heads/master | 2021-04-20T20:18:58.069411 | 2020-03-24T13:33:06 | 2020-03-24T13:33:06 | 249,715,169 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 812 | c | /*
QUESTÃO 02: Pede-se o desenvolvimento
de um programa que leia n valores e
determine o maior e o menor elementos
do conjunto fornecido.
*/
#include <stdio.h>
int main() {
int qtdValores,i;
float valor,maiorValor=0.0,menorValor=0.0;
printf("Digite a quantidade de valores que deseja ser lido.\n> ");
scanf("%d", &qtdValores);
for(i=0;i<qtdValores;i++){
printf("\nValor %d: ", i+1);
scanf("%f", &valor);
if(menorValor == 0.0){
menorValor = valor;
} else {
if(valor<menorValor){
menorValor=valor;
}
}
if(valor>maiorValor){
maiorValor=valor;
}
}
printf("O menor valor foi %f\n", menorValor);
printf("O maior valor foi %f", maiorValor);
}
| [
"[email protected]"
] | |
84eb8433cd35d0719332f4e571fff6b5d5cee44d | a296a3a4cb2c2683331d80bff471ef61902f99fe | /Sources/AccelSensor.h | 4066b9f657af17aeb05ebd47e2ccd0fa5f2e49e1 | [] | no_license | davidhuwyler/LiDo | d3b4e12278553f59c9e2a1ce5989061bd11ac6b0 | f9bbc9eb17a92931f3cb8bc2630a70f371402858 | refs/heads/master | 2020-04-24T01:49:35.117676 | 2019-05-31T18:01:42 | 2019-05-31T18:01:42 | 171,613,997 | 1 | 0 | null | null | null | null | WINDOWS-1252 | C | false | false | 631 | h | /*
* AccelSens.h
*
* Created on: Feb 20, 2019
* Author: dave
*
* Driver for the ST LIS2DH Accelerometer via I2C
*/
#include <stdint.h>
#include "CLS1.h"
#ifndef SOURCES_ACCELSENS_H_
#define SOURCES_ACCELSENS_H_
typedef struct {
uint8_t xValue; // 1digit = 16mG (8Bit signed)
uint8_t yValue;
uint8_t zValue;
uint8_t temp; //Temperature in °C (1°C Resolution) (8Bit signed)
} AccelAxis_t;
void AccelSensor_init(void);
uint8_t AccelSensor_getValues(AccelAxis_t* values);
uint8_t AccelSensor_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io);
#endif /* SOURCES_ACCELSENS_H_ */
| [
"[email protected]"
] | |
b8efd1ea711f8becce4a4fbc190e7c69fdc7b8ff | 7a01a0a847f60aa2c881e468feac45a6f3490130 | /lib/isc/lfsr.c | e8b1fbbd5a03cfce1f6a2128886d438b59625331 | [
"ISC"
] | permissive | personal2222/Netsec-project | 6c06f1e769a69c8a715962458326ed08533312ae | 269860c6a7aaf8d32ab042df556de573026c955e | refs/heads/master | 2020-04-21T14:28:14.237693 | 2019-04-29T03:35:50 | 2019-04-29T03:35:50 | 169,636,126 | 0 | 1 | NOASSERTION | 2019-03-13T22:18:48 | 2019-02-07T20:17:39 | C | UTF-8 | C | false | false | 3,697 | c | /*
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lfsr.c,v 1.11 2001/01/09 21:56:11 bwelling Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/assertions.h>
#include <isc/lfsr.h>
#include <isc/util.h>
#define VALID_LFSR(x) (x != NULL)
void
isc_lfsr_init(isc_lfsr_t *lfsr, isc_uint32_t state, unsigned int bits,
isc_uint32_t tap, unsigned int count,
isc_lfsrreseed_t reseed, void *arg)
{
REQUIRE(VALID_LFSR(lfsr));
REQUIRE(8 <= bits && bits <= 32);
REQUIRE(tap != 0);
lfsr->state = state;
lfsr->bits = bits;
lfsr->tap = tap;
lfsr->count = count;
lfsr->reseed = reseed;
lfsr->arg = arg;
if (count == 0 && reseed != NULL)
reseed(lfsr, arg);
if (lfsr->state == 0)
lfsr->state = 0xffffffffU >> (32 - lfsr->bits);
}
/*
* Return the next state of the lfsr.
*/
static inline isc_uint32_t
lfsr_generate(isc_lfsr_t *lfsr)
{
unsigned int highbit;
highbit = 1 << (lfsr->bits - 1);
/*
* If the previous state is zero, we must fill it with something
* here, or we will begin to generate an extremely predictable output.
*
* First, give the reseed function a crack at it. If the state is
* still 0, set it to all ones.
*/
if (lfsr->state == 0) {
if (lfsr->reseed != NULL)
lfsr->reseed(lfsr, lfsr->arg);
if (lfsr->state == 0)
lfsr->state = 0xffffffffU >> (32 - lfsr->bits);
}
if (lfsr->state & 0x01) {
lfsr->state = ((lfsr->state ^ lfsr->tap) >> 1) | highbit;
return (1);
} else {
lfsr->state >>= 1;
return (0);
}
}
void
isc_lfsr_generate(isc_lfsr_t *lfsr, void *data, unsigned int count)
{
unsigned char *p;
unsigned int bit;
unsigned int byte;
REQUIRE(VALID_LFSR(lfsr));
REQUIRE(data != NULL);
REQUIRE(count > 0);
p = data;
byte = count;
while (byte--) {
*p = 0;
for (bit = 0 ; bit < 7 ; bit++) {
*p |= lfsr_generate(lfsr);
*p <<= 1;
}
*p |= lfsr_generate(lfsr);
p++;
}
if (lfsr->count != 0 && lfsr->reseed != NULL) {
if (lfsr->count <= count * 8)
lfsr->reseed(lfsr, lfsr->arg);
else
lfsr->count -= (count * 8);
}
}
static inline isc_uint32_t
lfsr_skipgenerate(isc_lfsr_t *lfsr, unsigned int skip)
{
while (skip--)
(void)lfsr_generate(lfsr);
(void)lfsr_generate(lfsr);
return (lfsr->state);
}
/*
* Skip "skip" states in "lfsr".
*/
void
isc_lfsr_skip(isc_lfsr_t *lfsr, unsigned int skip)
{
REQUIRE(VALID_LFSR(lfsr));
while (skip--)
(void)lfsr_generate(lfsr);
}
/*
* Skip states in lfsr1 and lfsr2 using the other's current state.
* Return the final state of lfsr1 ^ lfsr2.
*/
isc_uint32_t
isc_lfsr_generate32(isc_lfsr_t *lfsr1, isc_lfsr_t *lfsr2)
{
isc_uint32_t state1, state2;
isc_uint32_t skip1, skip2;
REQUIRE(VALID_LFSR(lfsr1));
REQUIRE(VALID_LFSR(lfsr2));
skip1 = lfsr1->state & 0x01;
skip2 = lfsr2->state & 0x01;
/* cross-skip. */
state1 = lfsr_skipgenerate(lfsr1, skip2);
state2 = lfsr_skipgenerate(lfsr2, skip1);
return (state1 ^ state2);
}
| [
"[email protected]"
] | |
0cea15a189469ccef24559bb533ca17c93769d36 | afad23ab44f54e2e6cd29246bfbe601c8139fcf9 | /libft/src/ft_printf/convert_wchar.c | b0d5924ca4713293c41d2c30dd211a05a560e1c7 | [] | no_license | rbarbazz/lem-in | 7192efe52a1b0d83d73b5916c46db4c43c0b0a0d | 5c35f0944b8e0f06431e797b293492fa43daebf9 | refs/heads/master | 2021-09-24T07:01:23.294495 | 2018-10-04T20:06:45 | 2018-10-04T20:06:45 | 147,073,092 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,018 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* convert_wchar.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbarbazz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/01/14 13:27:45 by rbarbazz #+# #+# */
/* Updated: 2018/03/08 16:14:49 by rbarbazz ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int calc_length(t_arg *arg)
{
int tmp;
int len;
len = 0;
tmp = arg->ui;
if (tmp < 0)
{
arg->error = 1;
return (-1);
}
while (tmp)
{
tmp >>= 1;
len++;
}
return (len);
}
int wchar2(t_arg *arg)
{
unsigned int mask;
unsigned int c;
c = arg->ui;
if (!arg->ws)
{
arg->width -= 2;
if (arg->flag != '-')
apply_width(arg);
}
if (arg->ws && (arg->savepr >= 0 && ((arg->prec -= 2) < 0)))
return (0);
mask = 49280;
arg->ui = (c << 26) >> 26;
mask |= arg->ui;
arg->ui = (((c << 21) >> 27) << 8);
mask |= arg->ui;
arg->uc = ((mask << 16) >> 24);
arg->buffer = strcatchar(arg->buffer, arg->uc);
arg->uc = ((mask << 24) >> 24);
arg->buffer = strcatchar(arg->buffer, arg->uc);
return (0);
}
int wchar3(t_arg *arg)
{
unsigned int mask;
unsigned int c;
c = arg->ui;
if (!arg->ws)
{
arg->width -= 3;
if (arg->flag != '-')
apply_width(arg);
}
if (arg->ws && (arg->savepr >= 0 && ((arg->prec -= 3) < 0)))
return (0);
mask = 14712960;
arg->ui = (c << 26) >> 26;
mask |= arg->ui;
arg->ui = (((c << 20) >> 26) << 8);
mask |= arg->ui;
arg->ui = ((c >> 12) << 16);
mask |= arg->ui;
add_wchar3(arg, mask);
return (0);
}
int wchar4(t_arg *arg)
{
unsigned long long mask;
unsigned long long c;
c = arg->ui;
if (!arg->ws)
{
arg->width -= 4;
if (arg->flag != '-')
apply_width(arg);
}
if (arg->ws && (arg->savepr >= 0 && ((arg->prec -= 4) < 0)))
return (0);
mask = 4034953344;
arg->ui = (c << 58) >> 58;
mask |= arg->ui;
arg->ui = (((c << 52) >> 58) << 8);
mask |= arg->ui;
arg->ui = (((c << 46) >> 58) << 16);
mask |= arg->ui;
arg->ui = (((c << 43) >> 58) << 21);
mask |= arg->ui;
add_wchar4(arg, mask);
return (0);
}
int convert_wchar(t_arg *arg)
{
int len;
if (arg->ui == 0)
c_nul(arg);
len = calc_length(arg);
if (arg->error == 1)
return (1);
if ((MB_CUR_MAX == 1 && len >= 8 && arg->ui > 255) || (arg->ui <= 57343 &&\
arg->ui >= 55296) || arg->ui > 1114111)
{
arg->error = 1;
return (1);
}
call_wchar(arg, len);
if (!arg->ws)
apply_width(arg);
arg->retc = ft_strlen(arg->buffer);
return (0);
}
| [
"[email protected]"
] | |
90cebb09387f6a22727d8b6a2f1fde6618e41608 | 1eadfc49b842f2528b7c284151d46021a4231746 | /Data Structures-3Sem/linked list/doubly linked list/CircularDoublyLinkedList.c | 3cadd60ee2cdff261c9f7e99fe4701a4afe44c36 | [] | no_license | abhiwalia15/Data-Structures-And-Algorithm-Practice-Programs | 6fae99d6f5566a86d0869130a3bd5df53bfddad8 | dca5d8d33578f0ef4fa6668ace097e51c558e199 | refs/heads/master | 2020-03-29T14:37:03.986430 | 2019-06-14T19:14:07 | 2019-06-14T19:14:07 | 150,026,128 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,224 | c | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node {
int info;
struct node *llink;
struct node *rlink;
};
typedef struct node *NODE;
NODE last=NULL;
void insert()
{
NODE temp = (NODE)malloc(sizeof(struct node));
NODE next;
printf("Enter the data\n");
scanf("%d",&temp->info);
temp->llink = temp;
temp->rlink = temp;
if(last==NULL) {
last=temp;
return;
}
next=last->rlink;
temp->rlink=next;
next->llink=temp;
last->rlink=temp;
temp->llink=last;
return;
}
void display()
{
NODE cur;
if(last==NULL)
{
printf("LIST EMPTY\n");
return;
}
cur=last->rlink;
printf("The lsit is \n");
while(cur!=last)
{
printf("%d\t",cur->info);
cur=cur->rlink;
}
printf("%d\t",cur->info);
}
void main()
{
int ch;
printf("1.insert\t2.display\t3.exit\n");
for(;;)
{
printf("Enter your choice \n");
scanf("%d",&ch);
switch(ch)
{
case 1:insert();
break;
case 2:display();
break;
case 3:exit(0);
break;
}
}
getch();
}
| [
"[email protected]"
] | |
939ec55ed96823dc58f7e27f1fff3126612ac84c | 4ea69443c30c67f457dc9727d14bba1887d121f0 | /pset1/credit/tests/checksum.c | adc1afaa5fc0cdcf8d5531fcbc577ef0becdc9a4 | [
"Unlicense"
] | permissive | UncleRumbert/osd-cs-cs50 | ba46d823186e7f7d96da7cd2e45ec3ec8b5cb5ad | c4d85965ca6b34ca4fa364e995090eeb8329231e | refs/heads/master | 2021-07-08T13:02:06.010390 | 2017-10-06T14:16:59 | 2017-10-06T14:16:59 | 106,012,260 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 231 | c | #include <cs50.h>
#include <stdio.h>
int main(void)
{
long long number = get_long_long();
for (int i = 10; i <= number * 10; i = i * 10)
{
printf("%lld\n", ((number % i) - (number % (i/10))) / (i/10));
}
} | [
"[email protected]"
] | |
0adfd7c55e30b49c004263dc52f224fc1081a8b8 | 297497957c531d81ba286bc91253fbbb78b4d8be | /third_party/libwebrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c | 021e9d7d71e386b9ec0c62298d956050fca787bc | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | marco-c/gecko-dev-comments-removed | 7a9dd34045b07e6b22f0c636c0a836b9e639f9d3 | 61942784fb157763e65608e5a29b3729b0aa66fa | refs/heads/master | 2023-08-09T18:55:25.895853 | 2023-08-01T00:40:39 | 2023-08-01T00:40:39 | 211,297,481 | 0 | 0 | NOASSERTION | 2019-09-29T01:27:49 | 2019-09-27T10:44:24 | C++ | UTF-8 | C | false | false | 1,886 | c |
#include "modules/audio_coding/codecs/ilbc/cb_search_core.h"
#include "modules/audio_coding/codecs/ilbc/constants.h"
#include "modules/audio_coding/codecs/ilbc/defines.h"
void WebRtcIlbcfix_CbSearchCore(
int32_t *cDot,
size_t range,
int16_t stage,
int16_t *inverseEnergy,
int16_t *inverseEnergyShift,
int32_t *Crit,
size_t *bestIndex,
int32_t *bestCrit,
int16_t *bestCritSh)
{
int32_t maxW32, tmp32;
int16_t max, sh, tmp16;
size_t i;
int32_t *cDotPtr;
int16_t cDotSqW16;
int16_t *inverseEnergyPtr;
int32_t *critPtr;
int16_t *inverseEnergyShiftPtr;
if (stage==0) {
cDotPtr=cDot;
for (i=0;i<range;i++) {
*cDotPtr=WEBRTC_SPL_MAX(0, (*cDotPtr));
cDotPtr++;
}
}
maxW32 = WebRtcSpl_MaxAbsValueW32(cDot, range);
sh = (int16_t)WebRtcSpl_NormW32(maxW32);
cDotPtr = cDot;
inverseEnergyPtr = inverseEnergy;
critPtr = Crit;
inverseEnergyShiftPtr=inverseEnergyShift;
max=WEBRTC_SPL_WORD16_MIN;
for (i=0;i<range;i++) {
tmp32 = *cDotPtr << sh;
tmp16 = (int16_t)(tmp32 >> 16);
cDotSqW16 = (int16_t)(((int32_t)(tmp16)*(tmp16))>>16);
*critPtr = cDotSqW16 * *inverseEnergyPtr;
if ((*critPtr)!=0) {
max = WEBRTC_SPL_MAX((*inverseEnergyShiftPtr), max);
}
inverseEnergyPtr++;
inverseEnergyShiftPtr++;
critPtr++;
cDotPtr++;
}
if (max==WEBRTC_SPL_WORD16_MIN) {
max = 0;
}
critPtr=Crit;
inverseEnergyShiftPtr=inverseEnergyShift;
for (i=0;i<range;i++) {
tmp16 = WEBRTC_SPL_MIN(16, max-(*inverseEnergyShiftPtr));
(*critPtr)=WEBRTC_SPL_SHIFT_W32((*critPtr),-tmp16);
critPtr++;
inverseEnergyShiftPtr++;
}
*bestIndex = WebRtcSpl_MaxIndexW32(Crit, range);
*bestCrit = Crit[*bestIndex];
*bestCritSh = 32 - 2*sh + max;
return;
}
| [
"[email protected]"
] | |
7e700e4fc0866f77ed59d211e2a9487c13f35d73 | dc529178b264b9f29e197a57e0edf94b24682271 | /Pods/Headers/Public/Rollbar/CrashReporter/PLCrashReportSignalInfo.h | 81f491bb4f02502d9c75128a094964b520797db6 | [] | no_license | billsea/track_and_bill_mobile_ios | 5b73f145a2626bb55ae5051ada0cbdf677bac81e | a5e4357f96b5b3cef8f3992273c932951b695add | refs/heads/master | 2022-05-04T11:38:01.862304 | 2018-08-07T22:51:28 | 2018-08-07T22:51:28 | 86,177,454 | 0 | 0 | null | 2022-04-24T22:56:08 | 2017-03-25T17:58:03 | Makefile | UTF-8 | C | false | false | 95 | h | ../../../../Rollbar/Vendor/CrashReporter.framework/Versions/A/Headers/PLCrashReportSignalInfo.h | [
"[email protected]"
] | |
93900bb954a7bb6e9972dc357f7f6ac12e53152c | 38f498ad353c91c3e02a96d517fa37218a5299a0 | /Classes/Source/receiver.c | e1c3bfaf6dc6885f7bd0b5372b4ac91b3eda33f7 | [
"WTFPL",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | umlaeute/pd-else | fb76dec1b063f1c8be2db49108734991616bd101 | def2a95ab71883489613d81b645ee6c77e000a50 | refs/heads/master | 2020-05-21T00:14:15.826225 | 2019-05-09T04:39:37 | 2019-05-09T04:39:37 | 185,820,033 | 0 | 0 | null | 2019-05-09T14:54:57 | 2019-05-09T14:54:56 | null | UTF-8 | C | false | false | 2,580 | c |
#include <string.h>
#include "m_pd.h"
/* -------------------- receiver ------------------------------ */
static t_class *receiver_class;
static t_class *receiver_proxy_class;
typedef struct _receiver_proxy
{
t_pd p_pd;
struct _receiver *p_owner;
} t_receiver_proxy;
typedef struct _receiver
{
t_object x_obj;
t_receiver_proxy x_proxy;
t_symbol *x_sym;
} t_receiver;
static void receiver_proxy_init(t_receiver_proxy * p, t_receiver *x)
{
p->p_pd = receiver_proxy_class;
p->p_owner = x;
}
static void receiver_proxy_symbol(t_receiver_proxy *p, t_symbol* s)
{
t_receiver *x = p->p_owner;
pd_unbind(&x->x_obj.ob_pd, x->x_sym);
pd_bind(&x->x_obj.ob_pd, x->x_sym = s);
}
static void receiver_bang(t_receiver *x)
{
outlet_bang(x->x_obj.ob_outlet);
}
static void receiver_float(t_receiver *x, t_float f)
{
outlet_float(x->x_obj.ob_outlet, f);
}
static void receiver_symbol(t_receiver *x, t_symbol *s)
{
outlet_symbol(x->x_obj.ob_outlet, s);
}
static void receiver_pointer(t_receiver *x, t_gpointer *gp)
{
outlet_pointer(x->x_obj.ob_outlet, gp);
}
static void receiver_list(t_receiver *x, t_symbol *s, int argc, t_atom *argv)
{
outlet_list(x->x_obj.ob_outlet, s, argc, argv);
}
static void receiver_anything(t_receiver *x, t_symbol *s, int argc, t_atom *argv)
{
outlet_anything(x->x_obj.ob_outlet, s, argc, argv);
}
static void *receiver_new(t_symbol *s)
{
t_receiver *x = (t_receiver *)pd_new(receiver_class);
x->x_sym = s;
pd_bind(&x->x_obj.ob_pd, s);
if (!*x->x_sym->s_name)
{
receiver_proxy_init(&x->x_proxy, x);
inlet_new(&x->x_obj, &x->x_proxy.p_pd, 0, 0);
}
outlet_new(&x->x_obj, 0);
return (x);
}
static void receiver_free(t_receiver *x)
{
pd_unbind(&x->x_obj.ob_pd, x->x_sym);
}
void receiver_setup(void)
{
receiver_class = class_new(gensym("receiver"), (t_newmethod)receiver_new,
(t_method)receiver_free, sizeof(t_receiver), CLASS_NOINLET, A_DEFSYM, 0);
class_addbang(receiver_class, receiver_bang);
class_addfloat(receiver_class, (t_method)receiver_float);
class_addsymbol(receiver_class, receiver_symbol);
class_addpointer(receiver_class, receiver_pointer);
class_addlist(receiver_class, receiver_list);
class_addanything(receiver_class, receiver_anything);
receiver_proxy_class = (t_class *)class_new(gensym("receiver proxy"),
0, 0, sizeof(t_receiver_proxy), 0, 0);
class_addsymbol(receiver_proxy_class, receiver_proxy_symbol);
}
| [
"[email protected]"
] | |
923a2ac23421df80239ca793c5cb78fa57933f34 | e8563a37c530cdd9ceedc052b5ce9b428725e4c0 | /profiler/vector.h | 563cbcb5281a3ada1732f3e833e4336fd122f79f | [] | no_license | imsure/mpi-profiler | 1512c912351e94b54e473400860142857612f610 | 6a8ed5ce5069c088458dbec1b8e9b8c965fc9934 | refs/heads/master | 2016-09-05T14:18:30.336412 | 2014-12-09T07:48:52 | 2014-12-09T07:48:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,335 | h | /**
* A simple vector interface for holding an array of vertex which
* represents a MPI task graph.
*/
#ifndef _VECTOR_H_
#define _VECTOR_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INIT_CAPACITY 100
typedef struct vertex vertex;
typedef struct vector vector;
/**
* A vector for holding an array of 'vertex'.
*/
struct vector {
int size; // the current size of the vector (number of elements)
int capacity; // capacity of the vector
vertex * vs; // array of vertices.
};
/**
* Represents a vertex in the MPI task graph.
* A vertex is a MPI operation.
*/
struct vertex {
/* The name of the vertex. It must uniquely identify the vertex
in the (merged) task graph. We encode name as follows:
1. For MPI_Init & MPI_Finalize, the encoding is:
MPI_Init
MPI_Finalize
The final merged graph will have only one MPI_Init &
MPI_Finalize.
2. For MPI collectives, the encoding is:
collective_name_counter
Ex. MPI_Barrier_1 means MPI_Barrier was the first collective
operation called by all ranks.
MPI_Scatter_2 means MPI_Scatter was the second collective
operation called by all ranks.
We will have a counter for all collectives.
3. For other supported MPI operations, the encoding is:
operation_name_rank_number_id
Ex. MPI_Send_0_1 means MPI_Send was called by rank 0 with id 1.
id is used to identify operations inside a rank. It increments by 1
each time an MPI operation other than MPI_Init, MPI_Finalized or
MPI Collective is called.
*/
char name[ 32 ];
double start_time; // start time of the operation
double end_time; // end time of the operation
/*
* The following fields are for sending/recving operations only.
*/
int sender_rank; // rank id of the sender
int receiver_rank; // rank id of the receiver
int tag; // message tag
int msg_size; // size of message
};
/* Initialize vector 'vec' with capacity of 'capacity'. */
void init_vector( vector * vec, int capacity );
/* Append vertex 'vt' to the vector 'vec'. */
void append_vector( vector * vec, vertex * vt );
/* Double the capacity of the vector 'vec' if it is full. */
void resize_vector( vector * vec );
/* Cleaup up vector 'vec' */
void free_vector( vector * vec );
void print_vertex( vertex *v );
#endif // _VECTOR_H_
| [
"[email protected]"
] | |
293298c2681a51eeaca3166bfc895cfa5e167df5 | 29d0a863b2d086f50dce2eec6a24cf69d8e30c35 | /GPIO/HardWave/LCD/lcd.h | c1cfb9921bfc1271d16c09578f3d1993e4192049 | [] | no_license | Taylor-Boy/Test | b951570ea9320fcc11b2bba1658e609c64debb82 | 990393d8fa1cc03745297fe31ae35bc43f1367b2 | refs/heads/master | 2023-02-15T08:12:01.232976 | 2021-01-07T14:20:58 | 2021-01-07T14:20:58 | 327,628,406 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 4,902 | h | #ifndef __LCD_H
#define __LCD_H
//#include "sys.h"
#include "stm32l4xx.h"
/*********************************************************************************
___ _ _____ _____ _ _ _____ _____ _ __
/ _ \ | | |_ _|| ___|| \ | ||_ _|| ___|| | / /
/ /_\ \| | | | | |__ | \| | | | | |__ | |/ /
| _ || | | | | __| | . ` | | | | __| | \
| | | || |_____| |_ | |___ | |\ | | | | |___ | |\ \
\_| |_/\_____/\___/ \____/ \_| \_/ \_/ \____/ \_| \_/
* ******************************************************************************
* 本程序只供学习使用,未经作者许可,不得用于其它任何用途
* ALIENTEK Pandora STM32L475 IOT开发板
* LCD TFT驱动代码
* 正点原子@ALIENTEK
* 技术论坛:www.openedv.com
* 创建日期:2018/10/27
* 版本:V1.0
* 版权所有,盗版必究。
* Copyright(C) 广州市星翼电子科技有限公司 2014-2024
* All rights reserved
* ******************************************************************************
* 初始版本
* ******************************************************************************/
//定义一些常用的数据类型短关键字
typedef int32_t s32;
typedef int16_t s16;
typedef int8_t s8;
typedef const int32_t sc32;
typedef const int16_t sc16;
typedef const int8_t sc8;
typedef __IO int32_t vs32;
typedef __IO int16_t vs16;
typedef __IO int8_t vs8;
typedef __I int32_t vsc32;
typedef __I int16_t vsc16;
typedef __I int8_t vsc8;
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
typedef const uint32_t uc32;
typedef const uint16_t uc16;
typedef const uint8_t uc8;
typedef __IO uint32_t vu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_t vu8;
typedef __I uint32_t vuc32;
typedef __I uint16_t vuc16;
typedef __I uint8_t vuc8;
extern u16 POINT_COLOR; //默认画笔颜色
extern u16 BACK_COLOR; //默认背景颜色
//LCD的宽和高定义
#define LCD_Width 240
#define LCD_Height 240
//画笔颜色
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40 //棕色
#define BRRED 0XFC07 //棕红色
#define GRAY 0X8430 //灰色
//GUI颜色
#define DARKBLUE 0X01CF //深蓝色
#define LIGHTBLUE 0X7D7C //浅蓝色
#define GRAYBLUE 0X5458 //灰蓝色
//以上三色为PANEL的颜色
#define LIGHTGREEN 0X841F //浅绿色
//#define LIGHTGRAY 0XEF5B //浅灰色(PANNEL)
#define LGRAY 0XC618 //浅灰色(PANNEL),窗体背景色
#define LGRAYBLUE 0XA651 //浅灰蓝色(中间层颜色)
#define LBBLUE 0X2B12 //浅棕蓝色(选择条目的反色)
/*
LCD_PWR: PB7
LCD_RST: PB6
LCD_DC: PB4
LCD_CS: PD7
*/
#define LCD_PWR(n) (n?HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOB,GPIO_PIN_7,GPIO_PIN_RESET))
#define LCD_RST(n) (n?HAL_GPIO_WritePin(GPIOB,GPIO_PIN_6,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOB,GPIO_PIN_6,GPIO_PIN_RESET))
#define LCD_DC(n) (n?HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOB,GPIO_PIN_4,GPIO_PIN_RESET))
#define LCD_CS(n) (n?HAL_GPIO_WritePin(GPIOD,GPIO_PIN_7,GPIO_PIN_SET):HAL_GPIO_WritePin(GPIOD,GPIO_PIN_7,GPIO_PIN_RESET))
void LCD_Init(void); //初始化
void LCD_DisplayOn(void); //开显示
void LCD_DisplayOff(void); //关显示
void LCD_Write_HalfWord(const u16 da); //写半个字节数据到LCD
void LCD_Address_Set(u16 x1, u16 y1, u16 x2, u16 y2); //设置数据显示区域
void LCD_Clear(u16 color); //清屏
void LCD_Fill(u16 x_start, u16 y_start, u16 x_end, u16 y_end, u16 color); //填充单色
void LCD_Fill_Buf(u16 x_start, u16 y_start, u16 x_end, u16 y_end, u16* clr_buf); //填充BUF
void LCD_Draw_Point(u16 x, u16 y); //画点
void LCD_Draw_ColorPoint(u16 x, u16 y,u16 color); //画带颜色点
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2); //画线
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2); //画矩形
void LCD_Draw_Circle(u16 x0, u16 y0, u8 r); //画圆
void LCD_ShowChar(u16 x, u16 y, char chr, u8 size); //显示一个字符
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len,u8 size); //显示一个数字
void LCD_ShowxNum(u16 x,u16 y,u32 num,u8 len,u8 size,u8 mode); //显示数字
void LCD_ShowString(u16 x,u16 y,u16 width,u16 height,u8 size,char *p); //显示字符串
void LCD_Show_Image(u16 x, u16 y, u16 width, u16 height, const u8 *p); //显示图片
void Display_ALIENTEK_LOGO(u16 x,u16 y); //显示ALIENTEK LOGO
#endif
| [
"[email protected]"
] | |
d00b0029d9f7dc0f0beee349f31b40e11f10c924 | ab0a8234e443a6aa152b9f7b135a1e2560e9db33 | /Server/CGSF/ThirdParty/CEGUI/include/CEGUI/CommonDialogs/Module.h | 3dc0efbd8ba64f032aa223991a5d6a1d48a34bce | [] | no_license | zetarus/Americano | 71c358d8d12b144c8858983c23d9236f7d0e941b | b62466329cf6f515661ef9fb9b9d2ae90a032a60 | refs/heads/master | 2023-04-08T04:26:29.043048 | 2018-04-19T11:21:14 | 2018-04-19T11:21:14 | 104,159,178 | 9 | 2 | null | 2023-03-23T12:10:51 | 2017-09-20T03:11:44 | C++ | UTF-8 | C | false | false | 2,161 | h | /***********************************************************************
filename: Module.h
created: Sun Oct 09 2011
author: Paul D Turner <[email protected]>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUICommonDialogsModule_h_
#define _CEGUICommonDialogsModule_h_
#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
# ifdef CEGUICOMMONDIALOGS_EXPORTS
# define CEGUI_COMMONDIALOGS_API __declspec(dllexport)
# else
# define CEGUI_COMMONDIALOGS_API __declspec(dllimport)
# endif
#else
# define CEGUI_COMMONDIALOGS_API
#endif
extern "C"
/*!
\brief
Initialise common dialogs library ready for use.
This should be called prior to creating any common dialog windows.
*/
CEGUI_COMMONDIALOGS_API void initialiseCEGUICommonDialogs();
#endif
| [
"[email protected]"
] | |
f8f53bb2b969f4a41e303d4d959c438365f7d373 | e1b7aff7e01664ecd4c2fc17ad7aa07317e96bdd | /9_5.c | 874c0da36e8455f046d8e4eefa0f321b69b93755 | [] | no_license | ammaciel/livro | bcdc8f4b1f471cf02aea8d9ff6cbbbba966e9631 | 3051e0fe8be601877db8540c09134f878d3693d7 | refs/heads/master | 2023-08-31T21:40:07.136496 | 2017-04-20T17:32:15 | 2017-04-20T17:32:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 292 | c | void parede(int altura)
{
int i;
for(i=0; i< altura; ++i)
{
printf("%c",Q);
}
printf("\n");
}
void casa(int altura_casa)
{
parede(altura_casa -2);
parede(altura_casa -2);
parede(altura_casa);
parede(altura_casa);
parede(altura_casa -2);
parede(altura_casa -2);
printf("\n");
}
| [
"[email protected]"
] | |
7b7aa53e8253812e16ab10d267437c142b09f5d5 | df16949e9f92d4eed0fb4534ac759702ebe16827 | /backup/old/2/mroldver/MagicaRush/MagicaRush/Action.h | 80f9ef6353c23909af6f872c59ca9baae182b13d | [] | no_license | easy-forks/Recycle-Bin | 083cfa4434f4731d8a3b1c3749c92876ebea7539 | cda07c87654ffd4951bff733f4a3517952433afd | refs/heads/master | 2023-03-15T18:06:13.423070 | 2018-06-10T15:45:17 | 2018-06-10T15:45:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 678 | h | #ifndef __ACTION_H__
#define __ACTION_H__
#include<Windows.h>
#define ACTION_DEFAULT 0
#define ACTION_GETREWARD 100
#define ACTION_OPENSHOP 200
#define ACTION_SELLREWARD 300
#define ACTION_CLOSESHOP 400
#define ACTION_CLOSINGSHOP 401
#define ACTION_MESOMAX 1000
#define ACTION_200P 1001
#define ACTION_EXCEPTION -1
#define ACTION_MAPTELEPORT 600
#define ACTION_MAPTELEPORTING 601
#define ACTION_LOGIN 700
#define ACTION_WORLDSELECT 701
#define ACTION_CHARACTERSELECT 702
#define ACTION_EXIT_CLOSINGSHOP 2000
#define ACTION_EXIT 2001
extern DWORD MesoAction;
void gui_update_action(DWORD Action);
void gui_update_meso(ULONGLONG Meso);
#endif | [
"[email protected]"
] | |
db5f1ad7c1adc5fb71681e18de6860040ca1e51c | 9886807f4745b1ff08e33a20f905c3b0e90582fa | /vendor/Pods/Headers/AWSiOSSDK/DynamoDB/DynamoDBProvisionedThroughputDescription.h | 034b54fbb17695da11de8a4f7642fd5d3515bbc2 | [] | no_license | SpencerArtisan/lostandfound | e2548a63b64af2b03dab9dc2245acc6125fff043 | 4cc93486f0b186ef47078f3936a5e1525d992f02 | refs/heads/master | 2021-01-21T19:28:07.468983 | 2013-09-12T18:13:56 | 2013-09-12T18:13:56 | 12,667,344 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 82 | h | ../../../AWSiOSSDK/src/include/DynamoDB/DynamoDBProvisionedThroughputDescription.h | [
"[email protected]"
] | |
6606f5e6b56ae181a96f1bceb8c3284b1b85f98f | 4acdc4a55b98bf0676adfa67402021369159b2db | /+2(HSSC)/C programs/Misc/add_matrix.c | 1f985c158e4ae264dca800621fd7a849ccf97f9f | [] | no_license | iam-sr13/4Years_of_Coding_2013_to_2017 | 3b5e29bd50d135216547a3ca27c84f8aff3eadca | 6175fef0eb364fd1fa4e81d7ec0c5599a859d9cd | refs/heads/master | 2021-01-01T15:48:32.830523 | 2018-01-12T14:29:24 | 2018-01-12T14:29:24 | 97,707,476 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 733 | c | #include<stdio.h>
main()
{
int a[6][6],d[6][6],b,c;
printf("Enter the elements of matrix 1\n");
for(b=0;b<=5;b++)
{
for(c=0;c<=5;c++)
{
scanf("%d\t",&a[b][c]);
}
}
printf("Enter the elements of matrix 2\n");
for(b=0;b<=5;b++)
{
for(c=0;c<=5;c++)
{
scanf("%d\t",&d[b][c]);
}
}
printf("\nThe elements of matrix 1 are:\n");
for(b=0;b<=5;b++)
{
for(c=0;c<=5;c++)
{
printf("%d\t",a[b][c]);
}
printf("\n");
}
printf("\nThe elements of matrix 2 are:\n");
for(b=0;b<=5;b++)
{
for(c=0;c<=5;c++)
{
printf("%d\t",d[b][c]);
}
printf("\n");
}
printf("\nSum:\n");
for(b=0;b<=5;b++)
{
for(c=0;c<=5;c++)
{
printf("%d\t",a[b][c]+d[b][c]);
}
printf("\n");
}
}
| [
"[email protected]"
] | |
26697ba0864bee8fb56274f356aeac3e12be954f | 6d7bc6936fe467ce2eafcda3c933176a0cbea0c4 | /code/include/archive/draws.h | 891ab7db9f76a06b575d6f4a56d47f3012a6d93c | [] | no_license | wrossmorrow/floatsums | f661ddc8268215b2cff37a52193cc64fb6cb9139 | 4ca64b7b4e02f60022431305c52073b344ae7363 | refs/heads/master | 2022-12-18T13:45:43.459638 | 2020-09-22T17:21:45 | 2020-09-22T17:21:45 | 297,154,727 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 501 | h |
int sign(); // a random sign, -1 or +1
double random_u( ); // a standard uniform value
int randint( int a , int b ); // a random integer between a and b (inclusive)
// a uniform random integer amount from 0 to M
long random_amount_unif( int M );
// binp ~ a bins - 1 length array of non-decreasing values in [0,1]
// binb ~ a bins + 1 length array of non-decreasing positive values
// !! WARNING !! - conditions are not checked
long random_amount_bins( int bins , double * binp , double * binb );
| [
"[email protected]"
] | |
da38b2548c956cb5b12c12e938e007141b959a00 | bc6430c488a225a2796b50632cd4a88395777a76 | /RRC_staticlib/asn1c_36331_d10/PRACH-ParametersListCE-r13.c | 7c272c88c16ad3540b7d0a6fe1f458674a48bc1d | [] | no_license | shflyeagle/EagleEye | 5f312eaaf9a8a4e2bf5786a38d4f3d6d690d71b7 | 98b3b802a572ad81bc346905dfdf8396a8189912 | refs/heads/master | 2020-05-07T08:33:53.684195 | 2019-04-10T07:53:56 | 2019-04-10T07:53:56 | 180,328,573 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,065 | c | /*
* Generated by asn1c-0.9.27 (http://lionet.info/asn1c)
* From ASN.1 module "EUTRA-RRC-Definitions"
* found in "/home/qiongbod/asn1c-0.9.27/asn1c/input/36331-d10.asn"
* `asn1c -S /home/qiongbod/asn1c-0.9.27/skeletons -fcompound-names -fwide-types -gen-PER`
*/
#include "PRACH-ParametersListCE-r13.h"
static asn_per_constraints_t asn_PER_type_PRACH_ParametersListCE_r13_constr_1 GCC_NOTUSED = {
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
{ APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */,
0, 0 /* No PER value map */
};
static asn_TYPE_member_t asn_MBR_PRACH_ParametersListCE_r13_1[] = {
{ ATF_POINTER, 0, 0,
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2)),
0,
&asn_DEF_PRACH_ParametersCE_r13,
0, /* Defer constraints checking to the member type */
0, /* No PER visible constraints */
0,
""
},
};
static ber_tlv_tag_t asn_DEF_PRACH_ParametersListCE_r13_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_SET_OF_specifics_t asn_SPC_PRACH_ParametersListCE_r13_specs_1 = {
sizeof(struct PRACH_ParametersListCE_r13),
offsetof(struct PRACH_ParametersListCE_r13, _asn_ctx),
0, /* XER encoding is XMLDelimitedItemList */
};
asn_TYPE_descriptor_t asn_DEF_PRACH_ParametersListCE_r13 = {
"PRACH-ParametersListCE-r13",
"PRACH-ParametersListCE-r13",
SEQUENCE_OF_free,
SEQUENCE_OF_print,
SEQUENCE_OF_constraint,
SEQUENCE_OF_decode_ber,
SEQUENCE_OF_encode_der,
SEQUENCE_OF_decode_xer,
SEQUENCE_OF_encode_xer,
SEQUENCE_OF_decode_uper,
SEQUENCE_OF_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_PRACH_ParametersListCE_r13_tags_1,
sizeof(asn_DEF_PRACH_ParametersListCE_r13_tags_1)
/sizeof(asn_DEF_PRACH_ParametersListCE_r13_tags_1[0]), /* 1 */
asn_DEF_PRACH_ParametersListCE_r13_tags_1, /* Same as above */
sizeof(asn_DEF_PRACH_ParametersListCE_r13_tags_1)
/sizeof(asn_DEF_PRACH_ParametersListCE_r13_tags_1[0]), /* 1 */
&asn_PER_type_PRACH_ParametersListCE_r13_constr_1,
asn_MBR_PRACH_ParametersListCE_r13_1,
1, /* Single element */
&asn_SPC_PRACH_ParametersListCE_r13_specs_1 /* Additional specs */
};
| [
"[email protected]"
] | |
6ab97ebe168c5fb678d874ecbf968806e3d91e41 | df569936262b9895cf0aac494b94058868567958 | /fleschIndex.c | 4573050661a27d44599713d1e9cf9fda212b8f16 | [] | no_license | TonyHoanTrinh/FleschIndexCalculator | 8376732f301ea24f8a9704643c674fac0d8bbe4d | 12dfd37e823c0864217d9752932aa6f6f30959a9 | refs/heads/master | 2020-05-19T14:38:06.733589 | 2019-05-05T17:52:38 | 2019-05-05T17:52:38 | 185,063,878 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,411 | c | #include <stdio.h>
int vowelCheck(char);
int whitespaceCheck(char);
int indexCalculate();
int punctuationCheck(char);
textInfo readFile(FIlE * );
typedef struct
{
int words;
int syllables;
int sentences;
double fleschIndex;
} textInfo;
int main()
{
textInfo userFile;
userFile = readFile(stdin);
printf("Flesch Index = %d\n", userFile.fleschIndex);
printf("Syllable Count = %d\n", userFile.syllables);
printf("Word Count = %d\n", userFile.words);
printf("Sentence Count = %d\n", userFile.sentences);
return 0;
}
int vowelCheck(char a)
{
if (a == "A" || a == "a" ||
a == "E" || a == "e" ||
a == "I" || a == "i" ||
a == "O" || a == "o" ||
a == "U" || a == "u" ||
a == "Y" || a == "y")
{
return 1;
}
return 0;
}
int whitespaceCheck(char a)
{
if (a == " " ||
a == "\t" ||
a == "\n" ||
a == "\r" ||)
{
return 1;
}
return 0;
}
double indexCalculate(textInfo analyzedText)
{
double index;
index = 206.835 - 84.6 * ((double) analyzedText.syllables / (double) analyzedText.words) -
1.015 * ((double) analyzedText.words / (double) analyzedText.sentences);
}
int punctuationCheck(char a)
{
if (a == "." ||
a == "?" ||
a == "!" ||
a == "," ||
a == ";")
{
return 1;
}
return 0;
}
textInfo readFile (FILE * f)
{
textInfo analyzedText;
analyzedText.words = 0;
analyzedText.syllables = 0;
analyzedText.sentences = 0;
analyzedText.index = 0;
char currentPosition;
while(!feof(f))
{
currentPosition = fgetc(f);
if (// Check if we have a complete word)
{
{
}
}
if(// Check if the chracter is a vowel or not)
{
if(// Check if the characters ahead are vowels as well)
{
}
}
else if (// Check if the character is a space or not)
{
if(// Check if the character before the current character is a letter)
{
}
}
else if (// Check if the character is punctuation or not)
{
}
else (// This means that the current character is a consonant)
{
}
}
analyzedText.fleschIndex = indexCalculate(analyzedText);
return analyzedText;
}
| [
"[email protected]"
] | |
aa927d699aa1a32ea2915ae95ef51437312dc04d | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/b1923f9c-5159-48a5-a0c3-1ba66937c446.c | 198953ac986ebe3f05c88c6ba8d8008ae5720ba3 | [] | 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 | 609 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=12;
int k;
int l;
j = 533;
l = 64;
k = i/j;
l = i/j;
l = j%j;
l = l-j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
long b[14];
long c[93];
a = 0;
do {
a--;
//random
/* START BUFFER SET */
*((long *)c + ( a - 1 )) = *((long *)b + ( a - 1 ));
/* END BUFFER SET */
//random
} while(( a - 1 ) > -1);
/* END VULNERABILITY */
//random
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
766789f2e2412e681711ad7b55ecdd82f69ddce7 | 6a6487cb64424d4ccdc05d3bb6607e8976517a80 | /ARM/opengl_bridge/software/main.c | 3a3c067e37548407d46ffccd841d7f828400a11e | [] | no_license | trueman1990/VistaModels | 79d933a150f80166c9062294f4725b812bb5d4fc | 5766de72c844a9e14fa65cb752ea81dfd6e7c42a | refs/heads/master | 2021-06-08T22:02:32.737552 | 2017-01-23T16:10:23 | 2017-01-23T16:10:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 510 | c | #include <stdint.h>
#include "opengl_bridge.h"
extern void init();
extern void draw();
#define MB_CONTROL_PAGE_ADDRESS 0x00708000
#include "mb/sw/control.h"
#define UNUSED(x) (void)(x)
// main function, it all begins here
void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) {
UNUSED(r0);
UNUSED(r1);
UNUSED(atags);
mb_core_message("OpenGL Bridge - Proof of Concept");
sdl2Open();
init();
while (1) {
draw();
sdl2Swap();
}
sdl2Close();
}
| [
"[email protected]"
] | |
52ac4f224ad11b45fe9bdd41e921f4891d659f08 | ac034b99625ad2ade926a04a0016b02f6e84eda2 | /test/src/pottery/benchmark/test_benchmark_sort_justinow_introsort_c.c | 40070f951cc58c400ad9c72e7e72e76bc0dc0bac | [
"MIT"
] | permissive | kbrafford/pottery | 9e342469aa807bd95089e4665f95afb2169447d7 | c4ccdc6b292122920799749a2d751fabcc752743 | refs/heads/master | 2023-01-31T03:11:01.114747 | 2020-12-17T05:20:58 | 2020-12-17T05:20:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,535 | c | /*
* MIT License
*
* Copyright (c) 2020 Nicholas Fraser
*
* 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.
*/
typedef int unused;
// This one is buggy.
#if 0
#include "pottery/benchmark/test_benchmark_sort_common.h"
// hack around use of variable-length arrays
#define WINDOWS 1
#define _malloca alloca
#define _freea(x) /*nothing*/
#include "justinow_introsort_c/sort.c"
void justinow_introsort_c_wrapper(int* ints, size_t count) {
sort(ints, count, sizeof(int), int_compare_pointers);
}
#endif
| [
"[email protected]"
] | |
e3154b5871529c81f095c31acb5cff590f02db5d | b0609cfdc7f491b46bac88d0404cf63b82553782 | /surf3dnet_ext/yi/include/furthest_point_sampling.h | 48f0ee668073ce78baf8451ddf00d86d99e50938 | [] | no_license | yuyi1005/Sur3dNet-Face | 34ee52d9cda85a1923e29c4e24cf98f6fdd56e32 | 4f1f281f86c87a78e5931588d97b7484e7fb37df | refs/heads/master | 2023-04-10T04:59:42.113592 | 2021-04-27T07:45:32 | 2021-04-27T07:45:32 | 285,503,295 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 175 | h |
#include <torch/extension.h>
#include <ATen/cuda/CUDAContext.h>
torch::Tensor furthest_point_sampling(torch::Tensor points, const int nsamples, const int keepsamples);
| [
"[email protected]"
] | |
6af8cf6908773f00baebcdc199833e904c3d673f | 1744185a1e318fd0705b7c8d71635966bf2f7451 | /template/lib/Projects/STM32469I-Discovery/Examples/I2C/I2C_TwoBoards_RestartComIT/Src/stm32f4xx_it.c | e4278fa63d57d87586256161fe3685df3e57ecf6 | [
"MIT",
"BSD-2-Clause"
] | 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 | 6,225 | c | /**
******************************************************************************
* @file I2C/I2C_TwoBoards_RestartComIT/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.0.3
* @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 I2C_TwoBoards_RestartComIT
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* I2C handler declared in "main.c" file */
extern I2C_HandleTypeDef I2cHandle;
/* 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 I2C event interrupt request.
* @param None
* @retval None
* @Note This function is redefined in "main.h" and related to I2C data transmission
*/
void I2Cx_EV_IRQHandler(void)
{
HAL_I2C_EV_IRQHandler(&I2cHandle);
}
/**
* @brief This function handles I2C error interrupt request.
* @param None
* @retval None
* @Note This function is redefined in "main.h" and related to I2C error
*/
void I2Cx_ER_IRQHandler(void)
{
HAL_I2C_ER_IRQHandler(&I2cHandle);
}
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
4f95f80f55be414acb07c297bf789a22b56a67c7 | 3563651c2896d088fc3f41dabc70946b43f39b13 | /WavePlayer/Resource.h | ad1fa22c0ecc2a9600cb751fed12abfd4d090d05 | [] | no_license | lhotanok/WavePlayer | 68e09f5b5f5c29a07afdc1f9b27265bab5b40183 | ca4575ed425f2eb50043b4059030fb1fc92b3a95 | refs/heads/master | 2023-07-09T16:53:50.489650 | 2021-07-29T13:16:21 | 2021-07-29T13:16:21 | 390,694,412 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 718 | h | //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by AudioPlayer.rc
#define IDS_APP_TITLE 103
#define IDR_MAINFRAME 128
#define IDD_AUDIOPLAYER_DIALOG 102
#define IDD_ABOUTBOX 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_WAVEPLAYER 107
#define IDI_SMALL 108
#define IDC_WAVEPLAYER 109
#define IDC_MYICON 2
#ifndef IDC_STATIC
#define IDC_STATIC -1
#endif
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 130
#define _APS_NEXT_RESOURCE_VALUE 129
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 110
#endif
#endif
| [
"[email protected]"
] | |
3177a7c35365e6d5ee17f66f342e0320c2b0bac1 | 801de6d2399828408910663034e3b385239eea2b | /Client&Server/Pizzeria/Prenotazioni.h | 02b26ac5f1d7615c213b19ae943dfdf88e5e84b3 | [] | no_license | AntonioNasca/TECNOLOGIE-PER-I-SISTEMI-DISTRIBUITI-E-IL-WEB | e4ad5890ba2efcaf41c8132c84ff05e5ff9b20a6 | 23166eb8f083c6d5bda7ab022b2acc84a2e86513 | refs/heads/main | 2023-02-26T17:54:28.350842 | 2021-02-03T12:29:29 | 2021-02-03T12:29:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 139 | h | #ifndef Prenotazioni_h
#define Prenotazioni_h
extern char * NomePizza[];
extern int quantita[];
int getDisponibilita(char *,int);
#endif | [
"[email protected]"
] | |
d5fa99c39b4b4de1cd97cfe639f91d61453b972f | 1eb764168e5f9afaf0f8a5fbbcf67a8123026e7a | /relay-client/noc_packet.c | ce4381bf56cb830b80030ff6fb91698665bbc238 | [] | no_license | popexizhi/test_for_relay | 1db5f69d40b58b9c6182822a523a8f75fb1c1fc4 | 6a78fe6df6311a727e9878d46b3dddfdadfc531e | refs/heads/master | 2021-01-10T04:37:00.029019 | 2016-03-03T04:03:46 | 2016-03-03T04:03:46 | 51,974,507 | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 9,009 | c |
//发送的请求内容
#define RelayQueryConnectionRequest 0
#define RelayQueryConnectionResponse 1
#define RelayRegisterRequest 2
#define RelayRegisterResponse 3
#define RelayMsgConnectionRequest 4
#define RelayMsgConnectionResponse 5
#define RelayDataIndication 6
/******************************************************************************************/
//处理返回报文内容
//参数:sock 为socket number
// buf 要处理的buffer name
// msg_ty_rec 要查找的返回msg_ty
// des 返回的数据内容
// ************************************************************************************/
void _receive(char *sock, char *buf, int msg_ty, char *des)
{
char *recvbuf;
char *reclen;
char msg_type_rec ;
int i,recvlen= 0;
//lrs_set_recv_timeout(600,0);//设置超时时间300s
//返回msg_type判断
lrs_receive_ex(sock,buf, "NumberOfBytesToRecv=2", LrsLastArg);//返回包头中的长度位置
lrs_get_last_received_buffer(sock,&recvbuf,&recvlen); //获得报文内容
lr_output_message("$$$$$$$$$$$$$$$$$$$$$$$$$$$$ len is %x %x %x %x", recvbuf[0],recvbuf[1]);
msg_type_rec = recvbuf[1];
if( (char)msg_ty == msg_type_rec){
lr_output_message("msg_type_rec 为预期结果");
}else{
//非预期返回类型,继续等待,未处理
lr_output_message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~非预期返回类型,继续等待,未处理");
}
lr_output_message("len is %d", recvlen);
//返回包长度
lrs_receive_ex(sock,buf, "NumberOfBytesToRecv=2", LrsLastArg);//返回包头中的长度位置
lrs_get_last_received_buffer(sock,&recvbuf,&recvlen); //获得报文内容
lr_output_message("$$$$$$$$$$$$$$$$$$$$$$$$$$$$ len is %x %x %x %x", recvbuf[0],recvbuf[1]);
if(0x00 == recvbuf[0]) {
recvlen = recvbuf[1];
}else {
//高字节未处理
;
}
lr_output_message("len is %d", recvlen);
//接受返回包
lr_save_int(recvlen,"recvlen");
reclen = lr_eval_string("NumberOfBytesToRecv=<recvlen>");
lrs_receive_ex(sock,buf,reclen, LrsLastArg); //返回指定长度的报文
lrs_get_last_received_buffer(sock,&recvbuf,&recvlen); //获得报文内容
for (i=0 ; i <recvlen; i++) {
des[i] = recvbuf[i];
//lr_output_message("receive[%d] is %x",i, recvbuf[i]);
}
}
//返回的请求内容
void get_receive(char *sock, char *buf)
{
;
}
/*******************************************************
//NOC协议处理
//参数:sock 为socket number
// buf 要处理的buffer name
// msg_ty 发送数据的类型[这里根据协议查找对应的返回类型]
// des 返回内容
//返回值: 返回0为成功
*******************************************************/
int Noc_get_receive(char *sock, char *buf, int msg_ty)
{
//
int msg_ty_pro ,i;
char des[255];
char result[4] = {0xff,0xff,0xff,0xff};
int res = 0;
//协议类型预期,参考#define定义
if(msg_ty <4)
msg_ty_pro = msg_ty + 1;
else
msg_ty_pro = msg_ty ;
_receive(sock,buf,msg_ty_pro,des);
//des中结果判断
if (RelayQueryConnectionResponse == msg_ty_pro) {
//L1
/*
//NOC_RELAY_MSG_QUERY_CONN_RESP
struct RelayQueryConnectionResponse
{
uint8_t version; //version(high 4its):NocRelayVersion
uint8_t msg_type; //type(low 4bits):NocRelayMsgType
uint16_t length; //length of data packet, it is will be set to zero if it is a message
uint32_t host_id; //host id of from
uint32_t target_host_id; //target host id
uint32_t result; //query result
uint32_t host_key_length; //length of hostkey, unit:bytes
uint8_t host_key[HOST_KEY_MAX_LENGTH]; //host key
} ALIGN_1_DECLARE ;
*/
for (i=0;i<4;i++) {
result[i] = des[i+8] ;//
lr_output_message("result[%d] is %x", i, result[i]);
//返回结果判断
if( result[i]!= 0x00){
lr_output_message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~RelayQueryConnectionResponse 返回存在失败 result[%d] is %x", i, result[i]);
res = 1;
}
}
}
if (RelayRegisterResponse == msg_ty_pro) {
//L1
/*
//NOC_RELAY_MSG_REGI_RESP header
struct RelayRegiResponse
{
uint8_t version; //version(high 4its):NocRelayVersion
uint8_t msg_type; //type(low 4bits):NocRelayMsgType
uint16_t length; //length of data packet, it is will be set to zero if it is a message
uint32_t host_id; //host id of the incoming connection
uint32_t result; //registration result, refer to NocRelayRegistrationResult
} ALIGN_1_DECLARE;
*/
for (i=0;i<4;i++) {
result[i] = des[i+4] ;//
lr_output_message("result[%d] is %x", i, result[i]);
//返回结果判断
if( result[i]!= 0x00){
lr_output_message("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~RelayRegiResponse 返回存在失败 result[%d] is %x", i, result[i]);
res = 1;
}
}//end for
}//end if
return res;
}
/****************************************************
//msg_ty :Xgw_RelayRegisterRequest [2]
//参数:
host_id 发送方的host_id
len 发送数据长度
param_name 发送数据
******************************************************/
void gw_RelayRegisterRequest(char host_id[],int *index,char des[])
{
int i = 0;
int j = *index;
//msg_type
des[j++] = 0x02;
//length
des[j++] =0x00;
des[j++] =0x04;
for (;i < 4;) {
des[j++] = host_id[i++];
}
*index = j;
}
/****************************************************
//host_target
//参数:
host_id 发送方的host_id
target_host_id 为接受方的host_id
len 发送数据长度
param_name 发送数据
******************************************************/
void host_target(char host_id[],char target_host_id[],int *index,char des[])
{
int i = *index;
int j = *index;
for(;i < j + 4; i++){
des[i] = host_id[i - j];
des[i + 4] = target_host_id[i - j];
}
j = j + 8;
*index = j;
}
/****************************************************
//发送数据封包
//参数:
host_id 发送方的host_id
msg_ty 发送数据的类型 RelayRegiRequest
param_name 发送数据位置
******************************************************/
void send_data(char host_id[],char target_host_id[],int msg_ty,char param_name[])
{
int length ,i , index = 0;
int *size ;
//version
char version = 0X00;
//msg_type
char msg_type;
//length_c
char c_length[2];
char des[299];
char L2_data[20] = {"1"}; //L2 send_data
des[index++] = version;
/*****************************************************************
#define RelayQueryConnectionRequest 0
#define RelayRegisterRequest 2
#define RelayMsgConnectionRequest 4
#define RelayMsgConnectionResponse 5
#define RelayDataIndication 6
*****************************************************************/
if( RelayRegisterRequest == msg_ty ){
size = &index;
gw_RelayRegisterRequest(host_id, size, des );
}
if( RelayQueryConnectionRequest == msg_ty ){
des[index++] = 0x00;
length = sizeof(host_id) + sizeof(target_host_id);
if (length < 256) {
des[index++] = 0x00;
des[index++] = length;
}
else{
//高字节位移未处理
;
}
size = &index;
host_target(host_id ,target_host_id, size,des );
}
if (RelayMsgConnectionRequest == msg_ty) {
des[index++] = 0x04;
length = sizeof(host_id) + sizeof(target_host_id);
if (length < 256) {
des[index++] = 0x00;
des[index++] = length;
}
else{
//高字节位移未处理
;
}
size = &index;
host_target(host_id ,target_host_id, size,des );
}
if (RelayMsgConnectionResponse == msg_ty) {
des[index++] = 0x05;
length = sizeof(host_id) + sizeof(target_host_id);
if (length < 256) {
des[index++] = 0x00;
des[index++] = length;
}
else{
//高字节位移未处理
;
}
size = &index;
host_target(host_id ,target_host_id, size,des );
}
if( RelayDataIndication == msg_ty){
//RelayDataIndication
;
des[index++] = 0x06;
length = sizeof(host_id) + sizeof(target_host_id) + sizeof(L2_data);
if (length < 256) {
des[index++] = 0x00;
des[index++] = length;
}
else{
//高字节位移未处理
;
}
size = &index;
host_target(host_id ,target_host_id, size,des );
for (i=0;i<sizeof(L2_data);) {
des[index++] = L2_data[i++];
}
}
//lr_output_message ("des is %X, index is %d, *size is %d",des, index, *size);
//for (i=0;i<index;i++) {
// lr_output_message ("[%d] is %x", i, des[i]);
//}
lrs_save_param_ex("relay-bgw", "user", des, 0, index ,"ascii", param_name); //存储发送字符串
}
| [
"[email protected]"
] | |
e9dd7fbde1b185e0906d0a0e16d92119673c1f98 | 72e2ca4d7f07b79156f7206ccb37b8ca57db3cdc | /docs/m25p80.c | f2e67a2242d82fefd1bfe3e581ce66d7dd2ea624 | [
"MIT"
] | permissive | kfowlks/miZy-linux-kernel | 3f1710c4f71a86dbd9997de38531768503bdf526 | f8a591ed75914d58116729f337ff1f4e77b7ab9a | refs/heads/master | 2021-01-19T06:29:10.791672 | 2017-04-04T14:49:54 | 2017-04-04T14:49:54 | 87,464,647 | 1 | 0 | null | 2017-04-06T19:00:27 | 2017-04-06T19:00:27 | null | UTF-8 | C | false | false | 33,899 | c | /*
* MTD SPI driver for ST M25Pxx (and similar) serial flash chips
*
* Author: Mike Lavender, [email protected]
*
* Copyright (c) 2005, Intec Automation Inc.
*
* Some parts are based on lart.c by Abraham Van Der Merwe
*
* Cleaned up and generalized based on mtd_dataflash.c
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/init.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mod_devicetable.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/of_platform.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#define M25_DBG(fmt, arg...) pr_debug("%s()%d - "fmt, __func__, __LINE__, ##arg)
#define M25_ERR(fmt, arg...) pr_err("%s()%d - "fmt, __func__, __LINE__, ##arg)
/* Flash opcodes. */
#define OPCODE_WREN 0x06 /* Write enable */
#define OPCODE_RDSR 0x05 /* Read status register */
#define OPCODE_WRSR 0x01 /* Write status register 1 byte */
#define OPCODE_NORM_READ 0x03 /* Read data bytes (low frequency) */
#define OPCODE_FAST_READ 0x0b /* Read data bytes (high frequency) */
#define OPCODE_DUAL_MODE_READ 0x3B /* Read data bytes in Dual Mode */
#define OPCODE_PP 0x02 /* Page program (up to 256 bytes) */
#define OPCODE_BE_4K 0x20 /* Erase 4KiB block */
#define OPCODE_BE_32K 0x52 /* Erase 32KiB block */
#define OPCODE_CHIP_ERASE 0xc7 /* Erase whole flash chip */
#define OPCODE_SE 0xd8 /* Sector erase (usually 64KiB) */
#define OPCODE_RDID 0x9f /* Read JEDEC ID */
/* Used for SST flashes only. */
#define OPCODE_BP 0x02 /* Byte program */
#define OPCODE_WRDI 0x04 /* Write disable */
#define OPCODE_AAI_WP 0xad /* Auto address increment word program */
/* Used for Macronix flashes only. */
#define OPCODE_EN4B 0xb7 /* Enter 4-byte mode */
#define OPCODE_EX4B 0xe9 /* Exit 4-byte mode */
/* Used for Spansion flashes only. */
#define OPCODE_BRWR 0x17 /* Bank register write */
/* Status Register bits. */
#define SR_WIP 1 /* Write in progress */
#define SR_WEL 2 /* Write enable latch */
/* meaning of other SR_* bits may differ between vendors */
#define SR_BP0 4 /* Block protect 0 */
#define SR_BP1 8 /* Block protect 1 */
#define SR_BP2 0x10 /* Block protect 2 */
#define SR_SRWD 0x80 /* SR write protect */
/* Define max times to check status register before we give up. */
#define MAX_READY_WAIT_JIFFIES (40 * HZ) /* M25P16 specs 40s max chip erase */
#define MAX_CMD_SIZE 6
#if defined(CONFIG_M25PXX_USE_DUAL_MODE_READ)
#define OPCODE_READ OPCODE_DUAL_MODE_READ
#define FAST_READ_DUMMY_BYTE 0
#elif defined(CONFIG_M25PXX_USE_FAST_READ)
#define OPCODE_READ OPCODE_FAST_READ
#define FAST_READ_DUMMY_BYTE 1
#else
#define OPCODE_READ OPCODE_NORM_READ
#define FAST_READ_DUMMY_BYTE 0
#endif
#define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16)
/****************************************************************************/
struct m25p {
struct spi_device *spi;
struct mutex lock;
struct mtd_info mtd;
u16 page_size;
u16 addr_width;
u8 erase_opcode;
u8 *command;
};
#define MBR_OFFSET ((256-16)*1024)
#define MBR_SIZE (16 * 1024)
#define DL_SIZE (16 * 1024)
#define MBR_MAGIC "softw411"
#define MBR_MAX_PART_COUNT 120
#define MBR_RESERVED (MBR_SIZE - 32 - (MBR_MAX_PART_COUNT * sizeof(PARTITION))) //mbr����Ŀռ�
#define NOR_BLK_SIZE 512
/* partition information */
typedef struct sunxi_partition_t
{
unsigned int addrhi; //��ʼ��ַ, ������Ϊ��λ
unsigned int addrlo; //
unsigned int lenhi; //����
unsigned int lenlo; //
unsigned char classname[16]; //���豸��
unsigned char name[16]; //���豸��
unsigned int user_type; //�û�����
unsigned int keydata; //�ؼ����ݣ�Ҫ����������ʧ
unsigned int ro; //�����
unsigned char reserved[68]; //�������ݣ�ƥ�������Ϣ128�ֽ�
}__attribute__ ((packed))PARTITION;
/* mbr information */
typedef struct
{
unsigned int crc32; // crc 1k - 4
unsigned int version; // �汾��Ϣ�� 0x00000100
unsigned char magic[8]; //softw311"
unsigned int copy; //����
unsigned int index; //�ڼ���MBR����
unsigned int PartCount; //��������
unsigned int stamp[1]; //����
PARTITION array[MBR_MAX_PART_COUNT]; //
unsigned char res[MBR_RESERVED];
}__attribute__ ((packed)) MBR;
#ifdef CONFIG_M25PXX_USE_DUAL_MODE_READ
/* spi device data, used in dual spi mode */
struct sunxi_dual_mode_dev_data {
int dual_mode; //dual SPI mode, 0-single mode, 1-dual mode
int single_cnt; //single mode transmit counter
int dummy_cnt; //dummy counter should be sent before receive in dual mode
};
struct sunxi_dual_mode_dev_data dual_mode_cfg = {1, 0, 1};
#endif
static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
{
return container_of(mtd, struct m25p, mtd);
}
/****************************************************************************/
/*
* Internal helper functions
*/
/*
* Read the status register, returning its value in the location
* Return the status register value.
* Returns negative if error occurred.
*/
static int read_sr(struct m25p *flash)
{
ssize_t retval;
u8 code = OPCODE_RDSR;
u8 val = 0;
retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
M25_DBG("Read status reg %#x, return %d \n", val, retval);
if (retval < 0) {
dev_err(&flash->spi->dev, "error %d reading SR\n",
(int) retval);
return retval;
}
return val;
}
/*
* Write status register 1 byte
* Returns negative if error occurred.
*/
static int write_sr(struct m25p *flash, u8 val)
{
flash->command[0] = OPCODE_WRSR;
flash->command[1] = val;
return spi_write(flash->spi, flash->command, 2);
}
/*
* Set write enable latch with Write Enable command.
* Returns negative if error occurred.
*/
static inline int write_enable(struct m25p *flash)
{
u8 code = OPCODE_WREN;
return spi_write_then_read(flash->spi, &code, 1, NULL, 0);
}
/*
* Send write disble instruction to the chip.
*/
static inline int write_disable(struct m25p *flash)
{
u8 code = OPCODE_WRDI;
return spi_write_then_read(flash->spi, &code, 1, NULL, 0);
}
/*
* Enable/disable 4-byte addressing mode.
*/
static inline int set_4byte(struct m25p *flash, u32 jedec_id, int enable)
{
switch (JEDEC_MFR(jedec_id)) {
case CFI_MFR_MACRONIX:
flash->command[0] = enable ? OPCODE_EN4B : OPCODE_EX4B;
return spi_write(flash->spi, flash->command, 1);
default:
/* Spansion style */
flash->command[0] = OPCODE_BRWR;
flash->command[1] = enable << 7;
return spi_write(flash->spi, flash->command, 2);
}
}
/*
* Service routine to read status register until ready, or timeout occurs.
* Returns non-zero if error.
*/
static int wait_till_ready(struct m25p *flash)
{
unsigned long deadline;
int sr;
deadline = jiffies + MAX_READY_WAIT_JIFFIES;
do {
if ((sr = read_sr(flash)) < 0)
break;
else if (!(sr & SR_WIP))
return 0;
cond_resched();
} while (!time_after_eq(jiffies, deadline));
return 1;
}
/*
* Erase the whole flash memory
*
* Returns 0 if successful, non-zero otherwise.
*/
static int erase_chip(struct m25p *flash)
{
pr_debug("%s: %s %lldKiB\n", dev_name(&flash->spi->dev), __func__,
(long long)(flash->mtd.size >> 10));
/* Wait until finished previous write command. */
if (wait_till_ready(flash))
return 1;
/* Send write enable, then erase commands. */
write_enable(flash);
/* Set up command buffer. */
flash->command[0] = OPCODE_CHIP_ERASE;
spi_write(flash->spi, flash->command, 1);
return 0;
}
static void m25p_addr2cmd(struct m25p *flash, unsigned int addr, u8 *cmd)
{
/* opcode is in cmd[0] */
cmd[1] = addr >> (flash->addr_width * 8 - 8);
cmd[2] = addr >> (flash->addr_width * 8 - 16);
cmd[3] = addr >> (flash->addr_width * 8 - 24);
cmd[4] = addr >> (flash->addr_width * 8 - 32);
}
static int m25p_cmdsz(struct m25p *flash)
{
return 1 + flash->addr_width;
}
/*
* Erase one sector of flash memory at offset ``offset'' which is any
* address within the sector which should be erased.
*
* Returns 0 if successful, non-zero otherwise.
*/
static int erase_sector(struct m25p *flash, u32 offset)
{
pr_debug("%s: %s %dKiB at 0x%08x\n", dev_name(&flash->spi->dev),
__func__, flash->mtd.erasesize / 1024, offset);
/* Wait until finished previous write command. */
if (wait_till_ready(flash)) {
printk("erase_sector fail \n");
return 1;
}
/* Send write enable, then erase commands. */
write_enable(flash);
/* Set up command buffer. */
flash->command[0] = flash->erase_opcode;
m25p_addr2cmd(flash, offset, flash->command);
spi_write(flash->spi, flash->command, m25p_cmdsz(flash));
return 0;
}
/****************************************************************************/
/*
* MTD implementation
*/
/*
* Erase an address range on the flash chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
*/
static int m25p80_erase(struct mtd_info *mtd, struct erase_info *instr)
{
struct m25p *flash = mtd_to_m25p(mtd);
u32 addr,len;
uint32_t rem;
pr_debug("%s: %s at 0x%llx, len %lld\n", dev_name(&flash->spi->dev),
__func__, (long long)instr->addr,
(long long)instr->len);
// __func__, (long long)instr->addr,
// (long long)instr->len);
div_u64_rem(instr->len, mtd->erasesize, &rem);
if (rem) {
printk("m25p80_erase EINVAL fail:\n");
return -EINVAL;
}
addr = instr->addr;
len = instr->len;
mutex_lock(&flash->lock);
/* whole-chip erase? */
if (len == flash->mtd.size) {
if (erase_chip(flash)) {
instr->state = MTD_ERASE_FAILED;
mutex_unlock(&flash->lock);
printk("m25p80_erase erase_chip warning fail:\n");
return -EIO;
}
/* REVISIT in some cases we could speed up erasing large regions
* by using OPCODE_SE instead of OPCODE_BE_4K. We may have set up
* to use "small sector erase", but that's not always optimal.
*/
/* "sector"-at-a-time erase */
} else {
while (len) {
if (erase_sector(flash, addr)) {
instr->state = MTD_ERASE_FAILED;
mutex_unlock(&flash->lock);
printk("m25p80_erase erase_sector warning: fail \n");
return -EIO;
}
addr += mtd->erasesize;
len -= mtd->erasesize;
}
}
mutex_unlock(&flash->lock);
instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr);
return 0;
}
/*
* Read an address range from the flash chip. The address range
* may be any size provided it is within the physical boundaries.
*/
static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
{
struct m25p *flash = mtd_to_m25p(mtd);
struct spi_transfer t[2];
struct spi_message m;
pr_debug("%s: %s from 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
__func__, (u32)from, len);
spi_message_init(&m);
memset(t, 0, (sizeof t));
/* NOTE:
* OPCODE_FAST_READ (if available) is faster.
* Should add 1 byte DUMMY_BYTE.
*/
t[0].tx_buf = flash->command;
t[0].len = m25p_cmdsz(flash) + FAST_READ_DUMMY_BYTE;
spi_message_add_tail(&t[0], &m);
t[1].rx_buf = buf;
t[1].len = len;
spi_message_add_tail(&t[1], &m);
mutex_lock(&flash->lock);
/* Wait till previous write/erase is done. */
if (wait_till_ready(flash)) {
/* REVISIT status return?? */
mutex_unlock(&flash->lock);
return 1;
}
/* FIXME switch to OPCODE_FAST_READ. It's required for higher
* clocks; and at this writing, every chip this driver handles
* supports that opcode.
*/
/* Set up the write data buffer. */
flash->command[0] = OPCODE_READ;
m25p_addr2cmd(flash, from, flash->command);
M25_DBG("m25p_cmdsz() = %d\n", m25p_cmdsz(flash));
spi_sync(flash->spi, &m);
*retlen = m.actual_length - m25p_cmdsz(flash) - FAST_READ_DUMMY_BYTE;
mutex_unlock(&flash->lock);
return 0;
}
/*
* Write an address range to the flash chip. Data must be written in
* FLASH_PAGESIZE chunks. The address range may be any size provided
* it is within the physical boundaries.
*/
static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
{
struct m25p *flash = mtd_to_m25p(mtd);
u32 page_offset, page_size;
struct spi_transfer t[2];
struct spi_message m;
pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
__func__, (u32)to, len);
spi_message_init(&m);
memset(t, 0, (sizeof t));
t[0].tx_buf = flash->command;
t[0].len = m25p_cmdsz(flash);
spi_message_add_tail(&t[0], &m);
t[1].tx_buf = buf;
spi_message_add_tail(&t[1], &m);
mutex_lock(&flash->lock);
/* Wait until finished previous write command. */
if (wait_till_ready(flash)) {
mutex_unlock(&flash->lock);
return 1;
}
write_enable(flash);
/* Set up the opcode in the write buffer. */
flash->command[0] = OPCODE_PP;
m25p_addr2cmd(flash, to, flash->command);
page_offset = to & (flash->page_size - 1);
M25_DBG("page_offset = %d, to = 0x%llx, flash->page_size = %d\n", page_offset, to, flash->page_size);
/* do all the bytes fit onto one page? */
if (page_offset + len <= flash->page_size) {
t[1].len = len;
spi_sync(flash->spi, &m);
*retlen = m.actual_length - m25p_cmdsz(flash);
} else {
u32 i;
/* the size of data remaining on the first page */
page_size = flash->page_size - page_offset;
t[1].len = page_size;
spi_sync(flash->spi, &m);
*retlen = m.actual_length - m25p_cmdsz(flash);
M25_DBG("m.actual_length = %d\n", m.actual_length);
/* write everything in flash->page_size chunks */
for (i = page_size; i < len; i += page_size) {
page_size = len - i;
if (page_size > flash->page_size)
page_size = flash->page_size;
/* write the next page to flash */
m25p_addr2cmd(flash, to + i, flash->command);
t[1].tx_buf = buf + i;
t[1].len = page_size;
wait_till_ready(flash);
write_enable(flash);
spi_sync(flash->spi, &m);
*retlen += m.actual_length - m25p_cmdsz(flash);
M25_DBG("*retlen = %d\n", *retlen);
}
}
mutex_unlock(&flash->lock);
return 0;
}
static int sst_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf)
{
struct m25p *flash = mtd_to_m25p(mtd);
struct spi_transfer t[2];
struct spi_message m;
size_t actual;
int cmd_sz, ret;
pr_debug("%s: %s to 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
__func__, (u32)to, len);
spi_message_init(&m);
memset(t, 0, (sizeof t));
t[0].tx_buf = flash->command;
t[0].len = m25p_cmdsz(flash);
spi_message_add_tail(&t[0], &m);
t[1].tx_buf = buf;
spi_message_add_tail(&t[1], &m);
mutex_lock(&flash->lock);
/* Wait until finished previous write command. */
ret = wait_till_ready(flash);
if (ret)
goto time_out;
write_enable(flash);
actual = to % 2;
/* Start write from odd address. */
if (actual) {
flash->command[0] = OPCODE_BP;
m25p_addr2cmd(flash, to, flash->command);
/* write one byte. */
t[1].len = 1;
spi_sync(flash->spi, &m);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
*retlen += m.actual_length - m25p_cmdsz(flash);
}
to += actual;
flash->command[0] = OPCODE_AAI_WP;
m25p_addr2cmd(flash, to, flash->command);
/* Write out most of the data here. */
cmd_sz = m25p_cmdsz(flash);
for (; actual < len - 1; actual += 2) {
t[0].len = cmd_sz;
/* write two bytes. */
t[1].len = 2;
t[1].tx_buf = buf + actual;
spi_sync(flash->spi, &m);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
*retlen += m.actual_length - cmd_sz;
cmd_sz = 1;
to += 2;
}
write_disable(flash);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
/* Write out trailing byte if it exists. */
if (actual != len) {
write_enable(flash);
flash->command[0] = OPCODE_BP;
m25p_addr2cmd(flash, to, flash->command);
t[0].len = m25p_cmdsz(flash);
t[1].len = 1;
t[1].tx_buf = buf + actual;
spi_sync(flash->spi, &m);
ret = wait_till_ready(flash);
if (ret)
goto time_out;
*retlen += m.actual_length - m25p_cmdsz(flash);
write_disable(flash);
}
time_out:
mutex_unlock(&flash->lock);
return ret;
}
/****************************************************************************/
/*
* SPI device driver setup and teardown
*/
struct flash_info {
/* JEDEC id zero means "no ID" (most older chips); otherwise it has
* a high byte of zero plus three data bytes: the manufacturer id,
* then a two byte device id.
*/
u32 jedec_id;
u16 ext_id;
/* The size listed here is what works with OPCODE_SE, which isn't
* necessarily called a "sector" by the vendor.
*/
unsigned sector_size;
u16 n_sectors;
u16 page_size;
u16 addr_width;
u16 flags;
#define SECT_4K 0x01 /* OPCODE_BE_4K works uniformly */
#define M25P_NO_ERASE 0x02 /* No erase command needed */
};
#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
((kernel_ulong_t)&(struct flash_info) { \
.jedec_id = (_jedec_id), \
.ext_id = (_ext_id), \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = 256, \
.flags = (_flags), \
})
#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width) \
((kernel_ulong_t)&(struct flash_info) { \
.sector_size = (_sector_size), \
.n_sectors = (_n_sectors), \
.page_size = (_page_size), \
.addr_width = (_addr_width), \
.flags = M25P_NO_ERASE, \
})
/* NOTE: double check command sets and memory organization when you add
* more flash chips. This current list focusses on newer chips, which
* have been converging on command sets which including JEDEC ID.
*/
static const struct spi_device_id m25p_ids[] = {
/* Atmel -- some are (confusingly) marketed as "DataFlash" */
{ "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
{ "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
{ "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
{ "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
{ "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
{ "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
{ "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
{ "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
{ "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) },
/* EON -- en25xxx */
{ "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) },
{ "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64, 0) },
{ "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) },
{ "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) },
/* GigaDevice */
{ "gd25q16", INFO(0xc84015, 0, 64 * 1024, 32, SECT_4K) },
{ "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
{ "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
{ "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, 0) }, // v3
/* Intel/Numonyx -- xxxs33b */
{ "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) },
{ "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) },
{ "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) },
/* Macronix */
{ "mx25l4005a", INFO(0xc22013, 0, 64 * 1024, 8, SECT_4K) },
{ "mx25l8005", INFO(0xc22014, 0, 64 * 1024, 16, 0) },
{ "mx25l1606e", INFO(0xc22015, 0, 64 * 1024, 32, SECT_4K) },
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) },
{ "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) },
{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
{ "mx25l25655e", INFO(0xc22619, 0, 64 * 1024, 512, 0) },
/* Spansion -- single (large) sector size only, at least
* for the chips listed here (without boot sectors).
*/
{ "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) },
{ "s25sl008a", INFO(0x010213, 0, 64 * 1024, 16, 0) },
{ "s25sl016a", INFO(0x010214, 0, 64 * 1024, 32, 0) },
{ "s25sl032a", INFO(0x010215, 0, 64 * 1024, 64, 0) },
{ "s25sl032p", INFO(0x010215, 0x4d00, 64 * 1024, 64, SECT_4K) },
{ "s25sl064a", INFO(0x010216, 0, 64 * 1024, 128, 0) },
{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
{ "s25fl256s1", INFO(0x010219, 0x4d01, 64 * 1024, 512, 0) },
{ "s25fl512s", INFO(0x010220, 0x4d00, 256 * 1024, 256, 0) },
{ "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
{ "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) },
{ "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) },
{ "s25fl016k", INFO(0xef4015, 0, 64 * 1024, 32, SECT_4K) },
{ "s25fl064k", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
/* SST -- large erase sizes are "overlays", "sectors" are 4K */
{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) },
{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) },
{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) },
{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) },
{ "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, SECT_4K) },
{ "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K) },
{ "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K) },
{ "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K) },
/* ST Microelectronics -- newer production may have feature updates */
{ "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) },
{ "m25p10", INFO(0x202011, 0, 32 * 1024, 4, 0) },
{ "m25p20", INFO(0x202012, 0, 64 * 1024, 4, 0) },
{ "m25p40", INFO(0x202013, 0, 64 * 1024, 8, 0) },
{ "m25p80", INFO(0x202014, 0, 64 * 1024, 16, 0) },
{ "m25p16", INFO(0x202015, 0, 64 * 1024, 32, 0) },
{ "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) },
{ "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) },
{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
{ "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) },
{ "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) },
{ "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) },
{ "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) },
{ "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) },
{ "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) },
{ "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) },
{ "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) },
{ "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) },
{ "m45pe10", INFO(0x204011, 0, 64 * 1024, 2, 0) },
{ "m45pe80", INFO(0x204014, 0, 64 * 1024, 16, 0) },
{ "m45pe16", INFO(0x204015, 0, 64 * 1024, 32, 0) },
{ "m25pe80", INFO(0x208014, 0, 64 * 1024, 16, 0) },
{ "m25pe16", INFO(0x208015, 0, 64 * 1024, 32, SECT_4K) },
{ "m25px32", INFO(0x207116, 0, 64 * 1024, 64, SECT_4K) },
{ "m25px32-s0", INFO(0x207316, 0, 64 * 1024, 64, SECT_4K) },
{ "m25px32-s1", INFO(0x206316, 0, 64 * 1024, 64, SECT_4K) },
{ "m25px64", INFO(0x207117, 0, 64 * 1024, 128, 0) },
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
{ "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) },
{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
{ "W25q128", INFO(0xef4018, 0, 64 * 1024, 256, 0) },
/* Catalyst / On Semiconductor -- non-JEDEC */
{ "cat25c11", CAT25_INFO( 16, 8, 16, 1) },
{ "cat25c03", CAT25_INFO( 32, 8, 16, 2) },
{ "cat25c09", CAT25_INFO( 128, 8, 32, 2) },
{ "cat25c17", CAT25_INFO( 256, 8, 32, 2) },
{ "cat25128", CAT25_INFO(2048, 8, 64, 2) },
{ },
};
MODULE_DEVICE_TABLE(spi, m25p_ids);
/* Register the whole NorFlash as a partition. */
static int partition_register(struct mtd_info *mtd, struct mtd_part_parser_data *ppdata)
{
struct mtd_partition partitions[] = {
{
.name = "NorFlash part0",
.offset = 0,
.size = MTDPART_SIZ_FULL
}};
return mtd_device_parse_register(mtd, NULL, ppdata, partitions, 1);
}
#ifdef CONFIG_ARCH_SUN8IW8
static int partitions_register(struct mtd_info *mtd, struct mtd_part_parser_data *ppdata)
{
int i;
int ret = 0;
size_t retlen = 0;
MBR *sunxi_mbr = NULL;
struct mtd_partition *partitions = NULL;
sunxi_mbr = (MBR *)kzalloc(MBR_SIZE, GFP_KERNEL);
if (sunxi_mbr == NULL) {
M25_ERR("Failed to kzalloc(%d)\n", MBR_SIZE);
return -ENOMEM;
}
ret = m25p80_read(mtd, MBR_OFFSET, MBR_SIZE, &retlen, (u_char *)sunxi_mbr);
M25_DBG("m25p80_read() ret= %d, retlen = %d\n", ret, retlen);
if ((ret != 0) || (sunxi_mbr->PartCount == 0)) {
kfree(sunxi_mbr);
M25_ERR("m25p80_read() ret %d, PartCnt: %d\n", ret, sunxi_mbr->PartCount);
return -EINVAL;
}
if ((sunxi_mbr->PartCount == 0) || (sunxi_mbr->PartCount > MBR_MAX_PART_COUNT)) {
M25_ERR("Invalid partitions count: %d\n", sunxi_mbr->PartCount);
kfree(sunxi_mbr);
return partition_register(mtd, ppdata);
}
sunxi_mbr->PartCount += 1;
partitions = kzalloc(sizeof(struct mtd_partition)*sunxi_mbr->PartCount, GFP_KERNEL);
if (partitions == NULL) {
M25_ERR("Failed to kzalloc(%d patition)\n", sunxi_mbr->PartCount);
kfree(sunxi_mbr);
return -ENOMEM;
}
printk("@@@[debug_jaosn]: Invalid partitions count: 4 %d\n",sunxi_mbr->PartCount);
for (i=0; i<sunxi_mbr->PartCount-1; i++) {
partitions[0].name = "uboot";
partitions[0].offset = 0;
partitions[0].size = 256 * 1024;
partitions[i+1].name = sunxi_mbr->array[i].name;
partitions[i+1].offset = sunxi_mbr->array[i].addrlo*NOR_BLK_SIZE + MBR_OFFSET;
partitions[i+1].size = sunxi_mbr->array[i].lenlo*NOR_BLK_SIZE;
if(i == 0) {
M25_DBG("NorFlash partition %d: name=%s, offset=0x%llx, size=0x%llx\n", i,
partitions[i].name, partitions[i].offset, partitions[i].size);
}
M25_DBG("NorFlash partition %d: name=%s, offset=0x%llx, size=0x%llx\n", i+1,
partitions[i+1].name, partitions[i+1].offset, partitions[i+1].size);
}
ret = mtd_device_parse_register(mtd, NULL, ppdata, partitions, sunxi_mbr->PartCount-1);
kfree(partitions);
kfree(sunxi_mbr);
return ret;
}
#else
static int partitions_register(struct mtd_info *mtd, struct mtd_part_parser_data *ppdata)
{
return partition_register(mtd, ppdata);
}
#endif
static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
{
int tmp;
u8 code = OPCODE_RDID;
u8 id[5];
u32 jedec;
u16 ext_jedec;
struct flash_info *info;
/* JEDEC also defines an optional "extended device information"
* string for after vendor-specific data, after the three bytes
* we use here. Supporting some chips might require using it.
*/
tmp = spi_write_then_read(spi, &code, 1, id, 5);
if (tmp < 0) {
pr_debug("%s: error %d reading JEDEC ID\n",
dev_name(&spi->dev), tmp);
return ERR_PTR(tmp);
}
jedec = id[0];
jedec = jedec << 8;
jedec |= id[1];
jedec = jedec << 8;
jedec |= id[2];
ext_jedec = id[3] << 8 | id[4];
printk("NorFlash ID: %#x - %#x\n", jedec, ext_jedec);
for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
info = (void *)m25p_ids[tmp].driver_data;
if (info->jedec_id == jedec) {
if (info->ext_id != 0 && info->ext_id != ext_jedec)
continue;
M25_DBG("Found the type: %s\n", m25p_ids[tmp].name);
return &m25p_ids[tmp];
}
}
dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
return ERR_PTR(-ENODEV);
}
/*
* board specific setup should have ensured the SPI clock used here
* matches what the READ command supports, at least until this driver
* understands FAST_READ (for clocks over 25 MHz).
*/
static int __devinit m25p_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
//#ifndef CONFIG_M25PXX_USE_DUAL_MODE_READ
struct flash_platform_data *data = NULL;
//#endif
struct m25p *flash;
struct flash_info *info;
unsigned i;
struct mtd_part_parser_data ppdata;
#ifdef CONFIG_MTD_OF_PARTS
if (!of_device_is_available(spi->dev.of_node))
return -ENODEV;
#endif
/* Platform data helps sort out which chip type we have, as
* well as how this board partitions it. If we don't have
* a chip ID, try the JEDEC id commands; they'll work for most
* newer chips, even if we don't recognize the particular chip.
*/
//#ifdef CONFIG_M25PXX_USE_DUAL_MODE_READ
// M25_ERR("Use the Dual Mode Read.\n");
// spi->dev.platform_data = &dual_mode_cfg;
//#else
data = spi->dev.platform_data;
if (data && data->type) {
const struct spi_device_id *plat_id;
for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
plat_id = &m25p_ids[i];
if (strcmp(data->type, plat_id->name))
continue;
break;
}
if (i < ARRAY_SIZE(m25p_ids) - 1)
id = plat_id;
else
dev_warn(&spi->dev, "unrecognized id %s\n", data->type);
}
//#endif
info = (void *)id->driver_data;
pr_debug("info->jedec_id = %#x \n", info->jedec_id);
if (info->jedec_id) {
const struct spi_device_id *jid;
jid = jedec_probe(spi);
pr_debug("jid = %p\n", jid);
if (IS_ERR(jid)) {
pr_debug("IS_ERR(jid)\n");
return PTR_ERR(jid);
} else if (jid != id) {
/*
* JEDEC knows better, so overwrite platform ID. We
* can't trust partitions any longer, but we'll let
* mtd apply them anyway, since some partitions may be
* marked read-only, and we don't want to lose that
* information, even if it's not 100% accurate.
*/
dev_warn(&spi->dev, "found %s, expected %s\n",
jid->name, id->name);
id = jid;
info = (void *)jid->driver_data;
}
}
flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL);
if (!flash)
return -ENOMEM;
flash->command = devm_kzalloc(&spi->dev, MAX_CMD_SIZE, GFP_KERNEL);
if (!flash->command)
return -ENOMEM;
flash->spi = spi;
mutex_init(&flash->lock);
dev_set_drvdata(&spi->dev, flash);
/*
* Atmel, SST and Intel/Numonyx serial flash tend to power
* up with the software protection bits set
*/
if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL ||
JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL ||
JEDEC_MFR(info->jedec_id) == CFI_MFR_SST) {
write_enable(flash);
write_sr(flash, 0);
}
//#ifndef CONFIG_M25PXX_USE_DUAL_MODE_READ
// if (data && data->name)
// flash->mtd.name = data->name;
// else
//#else
flash->mtd.name = dev_name(&spi->dev);
//#endif
flash->mtd.type = MTD_NORFLASH;
flash->mtd.writesize = 1;
flash->mtd.flags = MTD_CAP_NORFLASH;
flash->mtd.size = info->sector_size * info->n_sectors;
flash->mtd._erase = m25p80_erase;
flash->mtd._read = m25p80_read;
/* sst flash chips use AAI word program */
if (JEDEC_MFR(info->jedec_id) == CFI_MFR_SST)
flash->mtd._write = sst_write;
else
flash->mtd._write = m25p80_write;
/* prefer "small sector" erase if possible */
if (info->flags & SECT_4K) {
flash->erase_opcode = OPCODE_BE_4K;
flash->mtd.erasesize = 4096;
} else {
flash->erase_opcode = OPCODE_SE;
flash->mtd.erasesize = info->sector_size;
}
if (info->flags & M25P_NO_ERASE)
flash->mtd.flags |= MTD_NO_ERASE;
ppdata.of_node = spi->dev.of_node;
flash->mtd.dev.parent = &spi->dev;
flash->page_size = info->page_size;
flash->mtd.writebufsize = flash->page_size;
if (info->addr_width)
flash->addr_width = info->addr_width;
else {
/* enable 4-byte addressing if the device exceeds 16MiB */
if (flash->mtd.size > 0x1000000) {
flash->addr_width = 4;
set_4byte(flash, info->jedec_id, 1);
} else
flash->addr_width = 3;
}
dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
(long long)flash->mtd.size >> 10);
pr_debug("mtd .name = %s, .size = 0x%llx (%lldMiB) "
".erasesize = 0x%.8x (%uKiB) .numeraseregions = %d\n",
flash->mtd.name,
(long long)flash->mtd.size, (long long)(flash->mtd.size >> 20),
flash->mtd.erasesize, flash->mtd.erasesize / 1024,
flash->mtd.numeraseregions);
if (flash->mtd.numeraseregions)
for (i = 0; i < flash->mtd.numeraseregions; i++)
pr_debug("mtd.eraseregions[%d] = { .offset = 0x%llx, "
".erasesize = 0x%.8x (%uKiB), "
".numblocks = %d }\n",
i, (long long)flash->mtd.eraseregions[i].offset,
flash->mtd.eraseregions[i].erasesize,
flash->mtd.eraseregions[i].erasesize / 1024,
flash->mtd.eraseregions[i].numblocks);
/* partitions should match sector boundaries; and it may be good to
* use readonly partitions for writeprotected sectors (BP2..BP0).
*/
#if 0
return mtd_device_parse_register(&flash->mtd, NULL, &ppdata,
data ? data->parts : NULL,
data ? data->nr_parts : 0);
#else
return partitions_register(&flash->mtd, &ppdata);
#endif
}
static int __devexit m25p_remove(struct spi_device *spi)
{
struct m25p *flash = dev_get_drvdata(&spi->dev);
/* Clean up MTD stuff. */
mtd_device_unregister(&flash->mtd);
return 0;
}
static struct spi_driver m25p80_driver = {
.driver = {
.name = "m25p80",
.owner = THIS_MODULE,
},
.id_table = m25p_ids,
.probe = m25p_probe,
.remove = __devexit_p(m25p_remove),
/* REVISIT: many of these chips have deep power-down modes, which
* should clearly be entered on suspend() to minimize power use.
* And also when they're otherwise idle...
*/
};
module_spi_driver(m25p80_driver);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mike Lavender");
MODULE_DESCRIPTION("MTD SPI driver for ST M25Pxx flash chips");
| [
"[email protected]"
] | |
a16b9762f067b91f59cf9c95edf6b7ad1f92d0ef | 2d59fb0c5b5a7dbc1c31fab2ea3b89a08a859ef6 | /drivers/mtd/nand/raw/stm32_fmc2_nand.c | f3179cc21f521a5ce0de9a3c425f48c6ec18e4b2 | [
"0BSD",
"GPL-2.0-or-later"
] | permissive | CPU-Code/-u_boot_fslc | 683f4d183723df62f17645ec7f2d3c6bccbf737c | da15f58fe22fce65c6934eaa0d69d8bd2631f9a7 | refs/heads/master | 2023-04-03T15:38:33.105773 | 2020-05-16T12:04:44 | 2020-05-16T12:04:44 | 278,999,208 | 0 | 0 | 0BSD | 2021-04-20T20:20:33 | 2020-07-12T05:38:02 | C | UTF-8 | C | false | false | 28,256 | c | // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/*
* Copyright (C) STMicroelectronics 2019
* Author: Christophe Kerello <[email protected]>
*/
#include <common.h>
#include <clk.h>
#include <dm.h>
#include <nand.h>
#include <reset.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
/* Bad block marker length */
#define FMC2_BBM_LEN 2
/* ECC step size */
#define FMC2_ECC_STEP_SIZE 512
/* Command delay */
#define FMC2_RB_DELAY_US 30
/* Max chip enable */
#define FMC2_MAX_CE 2
/* Timings */
#define FMC2_THIZ 1
#define FMC2_TIO 8000
#define FMC2_TSYNC 3000
#define FMC2_PCR_TIMING_MASK 0xf
#define FMC2_PMEM_PATT_TIMING_MASK 0xff
/* FMC2 Controller Registers */
#define FMC2_BCR1 0x0
#define FMC2_PCR 0x80
#define FMC2_SR 0x84
#define FMC2_PMEM 0x88
#define FMC2_PATT 0x8c
#define FMC2_HECCR 0x94
#define FMC2_BCHISR 0x254
#define FMC2_BCHICR 0x258
#define FMC2_BCHPBR1 0x260
#define FMC2_BCHPBR2 0x264
#define FMC2_BCHPBR3 0x268
#define FMC2_BCHPBR4 0x26c
#define FMC2_BCHDSR0 0x27c
#define FMC2_BCHDSR1 0x280
#define FMC2_BCHDSR2 0x284
#define FMC2_BCHDSR3 0x288
#define FMC2_BCHDSR4 0x28c
/* Register: FMC2_BCR1 */
#define FMC2_BCR1_FMC2EN BIT(31)
/* Register: FMC2_PCR */
#define FMC2_PCR_PWAITEN BIT(1)
#define FMC2_PCR_PBKEN BIT(2)
#define FMC2_PCR_PWID_MASK GENMASK(5, 4)
#define FMC2_PCR_PWID(x) (((x) & 0x3) << 4)
#define FMC2_PCR_PWID_BUSWIDTH_8 0
#define FMC2_PCR_PWID_BUSWIDTH_16 1
#define FMC2_PCR_ECCEN BIT(6)
#define FMC2_PCR_ECCALG BIT(8)
#define FMC2_PCR_TCLR_MASK GENMASK(12, 9)
#define FMC2_PCR_TCLR(x) (((x) & 0xf) << 9)
#define FMC2_PCR_TCLR_DEFAULT 0xf
#define FMC2_PCR_TAR_MASK GENMASK(16, 13)
#define FMC2_PCR_TAR(x) (((x) & 0xf) << 13)
#define FMC2_PCR_TAR_DEFAULT 0xf
#define FMC2_PCR_ECCSS_MASK GENMASK(19, 17)
#define FMC2_PCR_ECCSS(x) (((x) & 0x7) << 17)
#define FMC2_PCR_ECCSS_512 1
#define FMC2_PCR_ECCSS_2048 3
#define FMC2_PCR_BCHECC BIT(24)
#define FMC2_PCR_WEN BIT(25)
/* Register: FMC2_SR */
#define FMC2_SR_NWRF BIT(6)
/* Register: FMC2_PMEM */
#define FMC2_PMEM_MEMSET(x) (((x) & 0xff) << 0)
#define FMC2_PMEM_MEMWAIT(x) (((x) & 0xff) << 8)
#define FMC2_PMEM_MEMHOLD(x) (((x) & 0xff) << 16)
#define FMC2_PMEM_MEMHIZ(x) (((x) & 0xff) << 24)
#define FMC2_PMEM_DEFAULT 0x0a0a0a0a
/* Register: FMC2_PATT */
#define FMC2_PATT_ATTSET(x) (((x) & 0xff) << 0)
#define FMC2_PATT_ATTWAIT(x) (((x) & 0xff) << 8)
#define FMC2_PATT_ATTHOLD(x) (((x) & 0xff) << 16)
#define FMC2_PATT_ATTHIZ(x) (((x) & 0xff) << 24)
#define FMC2_PATT_DEFAULT 0x0a0a0a0a
/* Register: FMC2_BCHISR */
#define FMC2_BCHISR_DERF BIT(1)
#define FMC2_BCHISR_EPBRF BIT(4)
/* Register: FMC2_BCHICR */
#define FMC2_BCHICR_CLEAR_IRQ GENMASK(4, 0)
/* Register: FMC2_BCHDSR0 */
#define FMC2_BCHDSR0_DUE BIT(0)
#define FMC2_BCHDSR0_DEF BIT(1)
#define FMC2_BCHDSR0_DEN_MASK GENMASK(7, 4)
#define FMC2_BCHDSR0_DEN_SHIFT 4
/* Register: FMC2_BCHDSR1 */
#define FMC2_BCHDSR1_EBP1_MASK GENMASK(12, 0)
#define FMC2_BCHDSR1_EBP2_MASK GENMASK(28, 16)
#define FMC2_BCHDSR1_EBP2_SHIFT 16
/* Register: FMC2_BCHDSR2 */
#define FMC2_BCHDSR2_EBP3_MASK GENMASK(12, 0)
#define FMC2_BCHDSR2_EBP4_MASK GENMASK(28, 16)
#define FMC2_BCHDSR2_EBP4_SHIFT 16
/* Register: FMC2_BCHDSR3 */
#define FMC2_BCHDSR3_EBP5_MASK GENMASK(12, 0)
#define FMC2_BCHDSR3_EBP6_MASK GENMASK(28, 16)
#define FMC2_BCHDSR3_EBP6_SHIFT 16
/* Register: FMC2_BCHDSR4 */
#define FMC2_BCHDSR4_EBP7_MASK GENMASK(12, 0)
#define FMC2_BCHDSR4_EBP8_MASK GENMASK(28, 16)
#define FMC2_BCHDSR4_EBP8_SHIFT 16
#define FMC2_NSEC_PER_SEC 1000000000L
enum stm32_fmc2_ecc {
FMC2_ECC_HAM = 1,
FMC2_ECC_BCH4 = 4,
FMC2_ECC_BCH8 = 8
};
struct stm32_fmc2_timings {
u8 tclr;
u8 tar;
u8 thiz;
u8 twait;
u8 thold_mem;
u8 tset_mem;
u8 thold_att;
u8 tset_att;
};
struct stm32_fmc2_nand {
struct nand_chip chip;
struct stm32_fmc2_timings timings;
int ncs;
int cs_used[FMC2_MAX_CE];
};
static inline struct stm32_fmc2_nand *to_fmc2_nand(struct nand_chip *chip)
{
return container_of(chip, struct stm32_fmc2_nand, chip);
}
struct stm32_fmc2_nfc {
struct nand_hw_control base;
struct stm32_fmc2_nand nand;
struct nand_ecclayout ecclayout;
void __iomem *io_base;
void __iomem *data_base[FMC2_MAX_CE];
void __iomem *cmd_base[FMC2_MAX_CE];
void __iomem *addr_base[FMC2_MAX_CE];
struct clk clk;
u8 cs_assigned;
int cs_sel;
};
static inline struct stm32_fmc2_nfc *to_stm32_nfc(struct nand_hw_control *base)
{
return container_of(base, struct stm32_fmc2_nfc, base);
}
/* Timings configuration */
static void stm32_fmc2_timings_init(struct nand_chip *chip)
{
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
struct stm32_fmc2_nand *nand = to_fmc2_nand(chip);
struct stm32_fmc2_timings *timings = &nand->timings;
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
u32 pmem, patt;
/* Set tclr/tar timings */
pcr &= ~FMC2_PCR_TCLR_MASK;
pcr |= FMC2_PCR_TCLR(timings->tclr);
pcr &= ~FMC2_PCR_TAR_MASK;
pcr |= FMC2_PCR_TAR(timings->tar);
/* Set tset/twait/thold/thiz timings in common bank */
pmem = FMC2_PMEM_MEMSET(timings->tset_mem);
pmem |= FMC2_PMEM_MEMWAIT(timings->twait);
pmem |= FMC2_PMEM_MEMHOLD(timings->thold_mem);
pmem |= FMC2_PMEM_MEMHIZ(timings->thiz);
/* Set tset/twait/thold/thiz timings in attribut bank */
patt = FMC2_PATT_ATTSET(timings->tset_att);
patt |= FMC2_PATT_ATTWAIT(timings->twait);
patt |= FMC2_PATT_ATTHOLD(timings->thold_att);
patt |= FMC2_PATT_ATTHIZ(timings->thiz);
writel(pcr, fmc2->io_base + FMC2_PCR);
writel(pmem, fmc2->io_base + FMC2_PMEM);
writel(patt, fmc2->io_base + FMC2_PATT);
}
/* Controller configuration */
static void stm32_fmc2_setup(struct nand_chip *chip)
{
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
/* Configure ECC algorithm (default configuration is Hamming) */
pcr &= ~FMC2_PCR_ECCALG;
pcr &= ~FMC2_PCR_BCHECC;
if (chip->ecc.strength == FMC2_ECC_BCH8) {
pcr |= FMC2_PCR_ECCALG;
pcr |= FMC2_PCR_BCHECC;
} else if (chip->ecc.strength == FMC2_ECC_BCH4) {
pcr |= FMC2_PCR_ECCALG;
}
/* Set buswidth */
pcr &= ~FMC2_PCR_PWID_MASK;
if (chip->options & NAND_BUSWIDTH_16)
pcr |= FMC2_PCR_PWID(FMC2_PCR_PWID_BUSWIDTH_16);
/* Set ECC sector size */
pcr &= ~FMC2_PCR_ECCSS_MASK;
pcr |= FMC2_PCR_ECCSS(FMC2_PCR_ECCSS_512);
writel(pcr, fmc2->io_base + FMC2_PCR);
}
/* Select target */
static void stm32_fmc2_select_chip(struct mtd_info *mtd, int chipnr)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
struct stm32_fmc2_nand *nand = to_fmc2_nand(chip);
if (chipnr < 0 || chipnr >= nand->ncs)
return;
if (nand->cs_used[chipnr] == fmc2->cs_sel)
return;
fmc2->cs_sel = nand->cs_used[chipnr];
chip->IO_ADDR_R = fmc2->data_base[fmc2->cs_sel];
chip->IO_ADDR_W = fmc2->data_base[fmc2->cs_sel];
/* FMC2 setup routine */
stm32_fmc2_setup(chip);
/* Apply timings */
stm32_fmc2_timings_init(chip);
}
/* Set bus width to 16-bit or 8-bit */
static void stm32_fmc2_set_buswidth_16(struct stm32_fmc2_nfc *fmc2, bool set)
{
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
pcr &= ~FMC2_PCR_PWID_MASK;
if (set)
pcr |= FMC2_PCR_PWID(FMC2_PCR_PWID_BUSWIDTH_16);
writel(pcr, fmc2->io_base + FMC2_PCR);
}
/* Enable/disable ECC */
static void stm32_fmc2_set_ecc(struct stm32_fmc2_nfc *fmc2, bool enable)
{
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
pcr &= ~FMC2_PCR_ECCEN;
if (enable)
pcr |= FMC2_PCR_ECCEN;
writel(pcr, fmc2->io_base + FMC2_PCR);
}
/* Clear irq sources in case of bch is used */
static inline void stm32_fmc2_clear_bch_irq(struct stm32_fmc2_nfc *fmc2)
{
writel(FMC2_BCHICR_CLEAR_IRQ, fmc2->io_base + FMC2_BCHICR);
}
/* Send command and address cycles */
static void stm32_fmc2_cmd_ctrl(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
if (cmd == NAND_CMD_NONE)
return;
if (ctrl & NAND_CLE) {
writeb(cmd, fmc2->cmd_base[fmc2->cs_sel]);
return;
}
writeb(cmd, fmc2->addr_base[fmc2->cs_sel]);
}
/*
* Enable ECC logic and reset syndrome/parity bits previously calculated
* Syndrome/parity bits is cleared by setting the ECCEN bit to 0
*/
static void stm32_fmc2_hwctl(struct mtd_info *mtd, int mode)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
stm32_fmc2_set_ecc(fmc2, false);
if (chip->ecc.strength != FMC2_ECC_HAM) {
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
if (mode == NAND_ECC_WRITE)
pcr |= FMC2_PCR_WEN;
else
pcr &= ~FMC2_PCR_WEN;
writel(pcr, fmc2->io_base + FMC2_PCR);
stm32_fmc2_clear_bch_irq(fmc2);
}
stm32_fmc2_set_ecc(fmc2, true);
}
/*
* ECC Hamming calculation
* ECC is 3 bytes for 512 bytes of data (supports error correction up to
* max of 1-bit)
*/
static int stm32_fmc2_ham_calculate(struct mtd_info *mtd, const u8 *data,
u8 *ecc)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
u32 heccr, sr;
int ret;
ret = readl_poll_timeout(fmc2->io_base + FMC2_SR, sr,
sr & FMC2_SR_NWRF, 10000);
if (ret < 0) {
pr_err("Ham timeout\n");
return ret;
}
heccr = readl(fmc2->io_base + FMC2_HECCR);
ecc[0] = heccr;
ecc[1] = heccr >> 8;
ecc[2] = heccr >> 16;
/* Disable ecc */
stm32_fmc2_set_ecc(fmc2, false);
return 0;
}
static int stm32_fmc2_ham_correct(struct mtd_info *mtd, u8 *dat,
u8 *read_ecc, u8 *calc_ecc)
{
u8 bit_position = 0, b0, b1, b2;
u32 byte_addr = 0, b;
u32 i, shifting = 1;
/* Indicate which bit and byte is faulty (if any) */
b0 = read_ecc[0] ^ calc_ecc[0];
b1 = read_ecc[1] ^ calc_ecc[1];
b2 = read_ecc[2] ^ calc_ecc[2];
b = b0 | (b1 << 8) | (b2 << 16);
/* No errors */
if (likely(!b))
return 0;
/* Calculate bit position */
for (i = 0; i < 3; i++) {
switch (b % 4) {
case 2:
bit_position += shifting;
case 1:
break;
default:
return -EBADMSG;
}
shifting <<= 1;
b >>= 2;
}
/* Calculate byte position */
shifting = 1;
for (i = 0; i < 9; i++) {
switch (b % 4) {
case 2:
byte_addr += shifting;
case 1:
break;
default:
return -EBADMSG;
}
shifting <<= 1;
b >>= 2;
}
/* Flip the bit */
dat[byte_addr] ^= (1 << bit_position);
return 1;
}
/*
* ECC BCH calculation and correction
* ECC is 7/13 bytes for 512 bytes of data (supports error correction up to
* max of 4-bit/8-bit)
*/
static int stm32_fmc2_bch_calculate(struct mtd_info *mtd, const u8 *data,
u8 *ecc)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
u32 bchpbr, bchisr;
int ret;
/* Wait until the BCH code is ready */
ret = readl_poll_timeout(fmc2->io_base + FMC2_BCHISR, bchisr,
bchisr & FMC2_BCHISR_EPBRF, 10000);
if (ret < 0) {
pr_err("Bch timeout\n");
return ret;
}
/* Read parity bits */
bchpbr = readl(fmc2->io_base + FMC2_BCHPBR1);
ecc[0] = bchpbr;
ecc[1] = bchpbr >> 8;
ecc[2] = bchpbr >> 16;
ecc[3] = bchpbr >> 24;
bchpbr = readl(fmc2->io_base + FMC2_BCHPBR2);
ecc[4] = bchpbr;
ecc[5] = bchpbr >> 8;
ecc[6] = bchpbr >> 16;
if (chip->ecc.strength == FMC2_ECC_BCH8) {
ecc[7] = bchpbr >> 24;
bchpbr = readl(fmc2->io_base + FMC2_BCHPBR3);
ecc[8] = bchpbr;
ecc[9] = bchpbr >> 8;
ecc[10] = bchpbr >> 16;
ecc[11] = bchpbr >> 24;
bchpbr = readl(fmc2->io_base + FMC2_BCHPBR4);
ecc[12] = bchpbr;
}
/* Disable ecc */
stm32_fmc2_set_ecc(fmc2, false);
return 0;
}
/* BCH algorithm correction */
static int stm32_fmc2_bch_correct(struct mtd_info *mtd, u8 *dat,
u8 *read_ecc, u8 *calc_ecc)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
u32 bchdsr0, bchdsr1, bchdsr2, bchdsr3, bchdsr4, bchisr;
u16 pos[8];
int i, ret, den, eccsize = chip->ecc.size;
unsigned int nb_errs = 0;
/* Wait until the decoding error is ready */
ret = readl_poll_timeout(fmc2->io_base + FMC2_BCHISR, bchisr,
bchisr & FMC2_BCHISR_DERF, 10000);
if (ret < 0) {
pr_err("Bch timeout\n");
return ret;
}
bchdsr0 = readl(fmc2->io_base + FMC2_BCHDSR0);
bchdsr1 = readl(fmc2->io_base + FMC2_BCHDSR1);
bchdsr2 = readl(fmc2->io_base + FMC2_BCHDSR2);
bchdsr3 = readl(fmc2->io_base + FMC2_BCHDSR3);
bchdsr4 = readl(fmc2->io_base + FMC2_BCHDSR4);
/* Disable ECC */
stm32_fmc2_set_ecc(fmc2, false);
/* No errors found */
if (likely(!(bchdsr0 & FMC2_BCHDSR0_DEF)))
return 0;
/* Too many errors detected */
if (unlikely(bchdsr0 & FMC2_BCHDSR0_DUE))
return -EBADMSG;
pos[0] = bchdsr1 & FMC2_BCHDSR1_EBP1_MASK;
pos[1] = (bchdsr1 & FMC2_BCHDSR1_EBP2_MASK) >> FMC2_BCHDSR1_EBP2_SHIFT;
pos[2] = bchdsr2 & FMC2_BCHDSR2_EBP3_MASK;
pos[3] = (bchdsr2 & FMC2_BCHDSR2_EBP4_MASK) >> FMC2_BCHDSR2_EBP4_SHIFT;
pos[4] = bchdsr3 & FMC2_BCHDSR3_EBP5_MASK;
pos[5] = (bchdsr3 & FMC2_BCHDSR3_EBP6_MASK) >> FMC2_BCHDSR3_EBP6_SHIFT;
pos[6] = bchdsr4 & FMC2_BCHDSR4_EBP7_MASK;
pos[7] = (bchdsr4 & FMC2_BCHDSR4_EBP8_MASK) >> FMC2_BCHDSR4_EBP8_SHIFT;
den = (bchdsr0 & FMC2_BCHDSR0_DEN_MASK) >> FMC2_BCHDSR0_DEN_SHIFT;
for (i = 0; i < den; i++) {
if (pos[i] < eccsize * 8) {
__change_bit(pos[i], (unsigned long *)dat);
nb_errs++;
}
}
return nb_errs;
}
static int stm32_fmc2_read_page(struct mtd_info *mtd,
struct nand_chip *chip, u8 *buf,
int oob_required, int page)
{
int i, s, stat, eccsize = chip->ecc.size;
int eccbytes = chip->ecc.bytes;
int eccsteps = chip->ecc.steps;
int eccstrength = chip->ecc.strength;
u8 *p = buf;
u8 *ecc_calc = chip->buffers->ecccalc;
u8 *ecc_code = chip->buffers->ecccode;
unsigned int max_bitflips = 0;
for (i = mtd->writesize + FMC2_BBM_LEN, s = 0; s < eccsteps;
s++, i += eccbytes, p += eccsize) {
chip->ecc.hwctl(mtd, NAND_ECC_READ);
/* Read the nand page sector (512 bytes) */
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, s * eccsize, -1);
chip->read_buf(mtd, p, eccsize);
/* Read the corresponding ECC bytes */
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, i, -1);
chip->read_buf(mtd, ecc_code, eccbytes);
/* Correct the data */
stat = chip->ecc.correct(mtd, p, ecc_code, ecc_calc);
if (stat == -EBADMSG)
/* Check for empty pages with bitflips */
stat = nand_check_erased_ecc_chunk(p, eccsize,
ecc_code, eccbytes,
NULL, 0,
eccstrength);
if (stat < 0) {
mtd->ecc_stats.failed++;
} else {
mtd->ecc_stats.corrected += stat;
max_bitflips = max_t(unsigned int, max_bitflips, stat);
}
}
/* Read oob */
if (oob_required) {
chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
}
return max_bitflips;
}
/* Controller initialization */
static void stm32_fmc2_init(struct stm32_fmc2_nfc *fmc2)
{
u32 pcr = readl(fmc2->io_base + FMC2_PCR);
u32 bcr1 = readl(fmc2->io_base + FMC2_BCR1);
/* Set CS used to undefined */
fmc2->cs_sel = -1;
/* Enable wait feature and nand flash memory bank */
pcr |= FMC2_PCR_PWAITEN;
pcr |= FMC2_PCR_PBKEN;
/* Set buswidth to 8 bits mode for identification */
pcr &= ~FMC2_PCR_PWID_MASK;
/* ECC logic is disabled */
pcr &= ~FMC2_PCR_ECCEN;
/* Default mode */
pcr &= ~FMC2_PCR_ECCALG;
pcr &= ~FMC2_PCR_BCHECC;
pcr &= ~FMC2_PCR_WEN;
/* Set default ECC sector size */
pcr &= ~FMC2_PCR_ECCSS_MASK;
pcr |= FMC2_PCR_ECCSS(FMC2_PCR_ECCSS_2048);
/* Set default tclr/tar timings */
pcr &= ~FMC2_PCR_TCLR_MASK;
pcr |= FMC2_PCR_TCLR(FMC2_PCR_TCLR_DEFAULT);
pcr &= ~FMC2_PCR_TAR_MASK;
pcr |= FMC2_PCR_TAR(FMC2_PCR_TAR_DEFAULT);
/* Enable FMC2 controller */
bcr1 |= FMC2_BCR1_FMC2EN;
writel(bcr1, fmc2->io_base + FMC2_BCR1);
writel(pcr, fmc2->io_base + FMC2_PCR);
writel(FMC2_PMEM_DEFAULT, fmc2->io_base + FMC2_PMEM);
writel(FMC2_PATT_DEFAULT, fmc2->io_base + FMC2_PATT);
}
/* Controller timings */
static void stm32_fmc2_calc_timings(struct nand_chip *chip,
const struct nand_sdr_timings *sdrt)
{
struct stm32_fmc2_nfc *fmc2 = to_stm32_nfc(chip->controller);
struct stm32_fmc2_nand *nand = to_fmc2_nand(chip);
struct stm32_fmc2_timings *tims = &nand->timings;
unsigned long hclk = clk_get_rate(&fmc2->clk);
unsigned long hclkp = FMC2_NSEC_PER_SEC / (hclk / 1000);
unsigned long timing, tar, tclr, thiz, twait;
unsigned long tset_mem, tset_att, thold_mem, thold_att;
tar = max_t(unsigned long, hclkp, sdrt->tAR_min);
timing = DIV_ROUND_UP(tar, hclkp) - 1;
tims->tar = min_t(unsigned long, timing, FMC2_PCR_TIMING_MASK);
tclr = max_t(unsigned long, hclkp, sdrt->tCLR_min);
timing = DIV_ROUND_UP(tclr, hclkp) - 1;
tims->tclr = min_t(unsigned long, timing, FMC2_PCR_TIMING_MASK);
tims->thiz = FMC2_THIZ;
thiz = (tims->thiz + 1) * hclkp;
/*
* tWAIT > tRP
* tWAIT > tWP
* tWAIT > tREA + tIO
*/
twait = max_t(unsigned long, hclkp, sdrt->tRP_min);
twait = max_t(unsigned long, twait, sdrt->tWP_min);
twait = max_t(unsigned long, twait, sdrt->tREA_max + FMC2_TIO);
timing = DIV_ROUND_UP(twait, hclkp);
tims->twait = clamp_val(timing, 1, FMC2_PMEM_PATT_TIMING_MASK);
/*
* tSETUP_MEM > tCS - tWAIT
* tSETUP_MEM > tALS - tWAIT
* tSETUP_MEM > tDS - (tWAIT - tHIZ)
*/
tset_mem = hclkp;
if (sdrt->tCS_min > twait && (tset_mem < sdrt->tCS_min - twait))
tset_mem = sdrt->tCS_min - twait;
if (sdrt->tALS_min > twait && (tset_mem < sdrt->tALS_min - twait))
tset_mem = sdrt->tALS_min - twait;
if (twait > thiz && (sdrt->tDS_min > twait - thiz) &&
(tset_mem < sdrt->tDS_min - (twait - thiz)))
tset_mem = sdrt->tDS_min - (twait - thiz);
timing = DIV_ROUND_UP(tset_mem, hclkp);
tims->tset_mem = clamp_val(timing, 1, FMC2_PMEM_PATT_TIMING_MASK);
/*
* tHOLD_MEM > tCH
* tHOLD_MEM > tREH - tSETUP_MEM
* tHOLD_MEM > max(tRC, tWC) - (tSETUP_MEM + tWAIT)
*/
thold_mem = max_t(unsigned long, hclkp, sdrt->tCH_min);
if (sdrt->tREH_min > tset_mem &&
(thold_mem < sdrt->tREH_min - tset_mem))
thold_mem = sdrt->tREH_min - tset_mem;
if ((sdrt->tRC_min > tset_mem + twait) &&
(thold_mem < sdrt->tRC_min - (tset_mem + twait)))
thold_mem = sdrt->tRC_min - (tset_mem + twait);
if ((sdrt->tWC_min > tset_mem + twait) &&
(thold_mem < sdrt->tWC_min - (tset_mem + twait)))
thold_mem = sdrt->tWC_min - (tset_mem + twait);
timing = DIV_ROUND_UP(thold_mem, hclkp);
tims->thold_mem = clamp_val(timing, 1, FMC2_PMEM_PATT_TIMING_MASK);
/*
* tSETUP_ATT > tCS - tWAIT
* tSETUP_ATT > tCLS - tWAIT
* tSETUP_ATT > tALS - tWAIT
* tSETUP_ATT > tRHW - tHOLD_MEM
* tSETUP_ATT > tDS - (tWAIT - tHIZ)
*/
tset_att = hclkp;
if (sdrt->tCS_min > twait && (tset_att < sdrt->tCS_min - twait))
tset_att = sdrt->tCS_min - twait;
if (sdrt->tCLS_min > twait && (tset_att < sdrt->tCLS_min - twait))
tset_att = sdrt->tCLS_min - twait;
if (sdrt->tALS_min > twait && (tset_att < sdrt->tALS_min - twait))
tset_att = sdrt->tALS_min - twait;
if (sdrt->tRHW_min > thold_mem &&
(tset_att < sdrt->tRHW_min - thold_mem))
tset_att = sdrt->tRHW_min - thold_mem;
if (twait > thiz && (sdrt->tDS_min > twait - thiz) &&
(tset_att < sdrt->tDS_min - (twait - thiz)))
tset_att = sdrt->tDS_min - (twait - thiz);
timing = DIV_ROUND_UP(tset_att, hclkp);
tims->tset_att = clamp_val(timing, 1, FMC2_PMEM_PATT_TIMING_MASK);
/*
* tHOLD_ATT > tALH
* tHOLD_ATT > tCH
* tHOLD_ATT > tCLH
* tHOLD_ATT > tCOH
* tHOLD_ATT > tDH
* tHOLD_ATT > tWB + tIO + tSYNC - tSETUP_MEM
* tHOLD_ATT > tADL - tSETUP_MEM
* tHOLD_ATT > tWH - tSETUP_MEM
* tHOLD_ATT > tWHR - tSETUP_MEM
* tHOLD_ATT > tRC - (tSETUP_ATT + tWAIT)
* tHOLD_ATT > tWC - (tSETUP_ATT + tWAIT)
*/
thold_att = max_t(unsigned long, hclkp, sdrt->tALH_min);
thold_att = max_t(unsigned long, thold_att, sdrt->tCH_min);
thold_att = max_t(unsigned long, thold_att, sdrt->tCLH_min);
thold_att = max_t(unsigned long, thold_att, sdrt->tCOH_min);
thold_att = max_t(unsigned long, thold_att, sdrt->tDH_min);
if ((sdrt->tWB_max + FMC2_TIO + FMC2_TSYNC > tset_mem) &&
(thold_att < sdrt->tWB_max + FMC2_TIO + FMC2_TSYNC - tset_mem))
thold_att = sdrt->tWB_max + FMC2_TIO + FMC2_TSYNC - tset_mem;
if (sdrt->tADL_min > tset_mem &&
(thold_att < sdrt->tADL_min - tset_mem))
thold_att = sdrt->tADL_min - tset_mem;
if (sdrt->tWH_min > tset_mem &&
(thold_att < sdrt->tWH_min - tset_mem))
thold_att = sdrt->tWH_min - tset_mem;
if (sdrt->tWHR_min > tset_mem &&
(thold_att < sdrt->tWHR_min - tset_mem))
thold_att = sdrt->tWHR_min - tset_mem;
if ((sdrt->tRC_min > tset_att + twait) &&
(thold_att < sdrt->tRC_min - (tset_att + twait)))
thold_att = sdrt->tRC_min - (tset_att + twait);
if ((sdrt->tWC_min > tset_att + twait) &&
(thold_att < sdrt->tWC_min - (tset_att + twait)))
thold_att = sdrt->tWC_min - (tset_att + twait);
timing = DIV_ROUND_UP(thold_att, hclkp);
tims->thold_att = clamp_val(timing, 1, FMC2_PMEM_PATT_TIMING_MASK);
}
static int stm32_fmc2_setup_interface(struct mtd_info *mtd, int chipnr,
const struct nand_data_interface *conf)
{
struct nand_chip *chip = mtd_to_nand(mtd);
const struct nand_sdr_timings *sdrt;
sdrt = nand_get_sdr_timings(conf);
if (IS_ERR(sdrt))
return PTR_ERR(sdrt);
if (chipnr == NAND_DATA_IFACE_CHECK_ONLY)
return 0;
stm32_fmc2_calc_timings(chip, sdrt);
/* Apply timings */
stm32_fmc2_timings_init(chip);
return 0;
}
/* NAND callbacks setup */
static void stm32_fmc2_nand_callbacks_setup(struct nand_chip *chip)
{
chip->ecc.hwctl = stm32_fmc2_hwctl;
/*
* Specific callbacks to read/write a page depending on
* the algo used (Hamming, BCH).
*/
if (chip->ecc.strength == FMC2_ECC_HAM) {
/* Hamming is used */
chip->ecc.calculate = stm32_fmc2_ham_calculate;
chip->ecc.correct = stm32_fmc2_ham_correct;
chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 4 : 3;
chip->ecc.options |= NAND_ECC_GENERIC_ERASED_CHECK;
return;
}
/* BCH is used */
chip->ecc.read_page = stm32_fmc2_read_page;
chip->ecc.calculate = stm32_fmc2_bch_calculate;
chip->ecc.correct = stm32_fmc2_bch_correct;
if (chip->ecc.strength == FMC2_ECC_BCH8)
chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 14 : 13;
else
chip->ecc.bytes = chip->options & NAND_BUSWIDTH_16 ? 8 : 7;
}
/* FMC2 caps */
static int stm32_fmc2_calc_ecc_bytes(int step_size, int strength)
{
/* Hamming */
if (strength == FMC2_ECC_HAM)
return 4;
/* BCH8 */
if (strength == FMC2_ECC_BCH8)
return 14;
/* BCH4 */
return 8;
}
NAND_ECC_CAPS_SINGLE(stm32_fmc2_ecc_caps, stm32_fmc2_calc_ecc_bytes,
FMC2_ECC_STEP_SIZE,
FMC2_ECC_HAM, FMC2_ECC_BCH4, FMC2_ECC_BCH8);
/* FMC2 probe */
static int stm32_fmc2_parse_child(struct stm32_fmc2_nfc *fmc2,
ofnode node)
{
struct stm32_fmc2_nand *nand = &fmc2->nand;
u32 cs[FMC2_MAX_CE];
int ret, i;
if (!ofnode_get_property(node, "reg", &nand->ncs))
return -EINVAL;
nand->ncs /= sizeof(u32);
if (!nand->ncs) {
pr_err("Invalid reg property size\n");
return -EINVAL;
}
ret = ofnode_read_u32_array(node, "reg", cs, nand->ncs);
if (ret < 0) {
pr_err("Could not retrieve reg property\n");
return -EINVAL;
}
for (i = 0; i < nand->ncs; i++) {
if (cs[i] > FMC2_MAX_CE) {
pr_err("Invalid reg value: %d\n",
nand->cs_used[i]);
return -EINVAL;
}
if (fmc2->cs_assigned & BIT(cs[i])) {
pr_err("Cs already assigned: %d\n",
nand->cs_used[i]);
return -EINVAL;
}
fmc2->cs_assigned |= BIT(cs[i]);
nand->cs_used[i] = cs[i];
}
nand->chip.flash_node = ofnode_to_offset(node);
return 0;
}
static int stm32_fmc2_parse_dt(struct udevice *dev,
struct stm32_fmc2_nfc *fmc2)
{
ofnode child;
int ret, nchips = 0;
dev_for_each_subnode(child, dev)
nchips++;
if (!nchips) {
pr_err("NAND chip not defined\n");
return -EINVAL;
}
if (nchips > 1) {
pr_err("Too many NAND chips defined\n");
return -EINVAL;
}
dev_for_each_subnode(child, dev) {
ret = stm32_fmc2_parse_child(fmc2, child);
if (ret)
return ret;
}
return 0;
}
static int stm32_fmc2_probe(struct udevice *dev)
{
struct stm32_fmc2_nfc *fmc2 = dev_get_priv(dev);
struct stm32_fmc2_nand *nand = &fmc2->nand;
struct nand_chip *chip = &nand->chip;
struct mtd_info *mtd = &chip->mtd;
struct nand_ecclayout *ecclayout;
struct resource resource;
struct reset_ctl reset;
int oob_index, chip_cs, mem_region, ret;
unsigned int i;
spin_lock_init(&fmc2->controller.lock);
init_waitqueue_head(&fmc2->controller.wq);
ret = stm32_fmc2_parse_dt(dev, fmc2);
if (ret)
return ret;
/* Get resources */
ret = dev_read_resource(dev, 0, &resource);
if (ret) {
pr_err("Resource io_base not found");
return ret;
}
fmc2->io_base = (void __iomem *)resource.start;
for (chip_cs = 0, mem_region = 1; chip_cs < FMC2_MAX_CE;
chip_cs++, mem_region += 3) {
if (!(fmc2->cs_assigned & BIT(chip_cs)))
continue;
ret = dev_read_resource(dev, mem_region, &resource);
if (ret) {
pr_err("Resource data_base not found for cs%d",
chip_cs);
return ret;
}
fmc2->data_base[chip_cs] = (void __iomem *)resource.start;
ret = dev_read_resource(dev, mem_region + 1, &resource);
if (ret) {
pr_err("Resource cmd_base not found for cs%d",
chip_cs);
return ret;
}
fmc2->cmd_base[chip_cs] = (void __iomem *)resource.start;
ret = dev_read_resource(dev, mem_region + 2, &resource);
if (ret) {
pr_err("Resource addr_base not found for cs%d",
chip_cs);
return ret;
}
fmc2->addr_base[chip_cs] = (void __iomem *)resource.start;
}
/* Enable the clock */
ret = clk_get_by_index(dev, 0, &fmc2->clk);
if (ret)
return ret;
ret = clk_enable(&fmc2->clk);
if (ret)
return ret;
/* Reset */
ret = reset_get_by_index(dev, 0, &reset);
if (!ret) {
reset_assert(&reset);
udelay(2);
reset_deassert(&reset);
}
/* FMC2 init routine */
stm32_fmc2_init(fmc2);
chip->controller = &fmc2->base;
chip->select_chip = stm32_fmc2_select_chip;
chip->setup_data_interface = stm32_fmc2_setup_interface;
chip->cmd_ctrl = stm32_fmc2_cmd_ctrl;
chip->chip_delay = FMC2_RB_DELAY_US;
chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE |
NAND_USE_BOUNCE_BUFFER;
/* Default ECC settings */
chip->ecc.mode = NAND_ECC_HW;
chip->ecc.size = FMC2_ECC_STEP_SIZE;
chip->ecc.strength = FMC2_ECC_BCH8;
/* Scan to find existence of the device */
ret = nand_scan_ident(mtd, nand->ncs, NULL);
if (ret)
return ret;
/*
* Only NAND_ECC_HW mode is actually supported
* Hamming => ecc.strength = 1
* BCH4 => ecc.strength = 4
* BCH8 => ecc.strength = 8
* ECC sector size = 512
*/
if (chip->ecc.mode != NAND_ECC_HW) {
pr_err("Nand_ecc_mode is not well defined in the DT\n");
return -EINVAL;
}
ret = nand_check_ecc_caps(chip, &stm32_fmc2_ecc_caps,
mtd->oobsize - FMC2_BBM_LEN);
if (ret) {
pr_err("No valid ECC settings set\n");
return ret;
}
if (chip->bbt_options & NAND_BBT_USE_FLASH)
chip->bbt_options |= NAND_BBT_NO_OOB;
/* NAND callbacks setup */
stm32_fmc2_nand_callbacks_setup(chip);
/* Define ECC layout */
ecclayout = &fmc2->ecclayout;
ecclayout->eccbytes = chip->ecc.bytes *
(mtd->writesize / chip->ecc.size);
oob_index = FMC2_BBM_LEN;
for (i = 0; i < ecclayout->eccbytes; i++, oob_index++)
ecclayout->eccpos[i] = oob_index;
ecclayout->oobfree->offset = oob_index;
ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset;
chip->ecc.layout = ecclayout;
/* Configure bus width to 16-bit */
if (chip->options & NAND_BUSWIDTH_16)
stm32_fmc2_set_buswidth_16(fmc2, true);
/* Scan the device to fill MTD data-structures */
ret = nand_scan_tail(mtd);
if (ret)
return ret;
return nand_register(0, mtd);
}
static const struct udevice_id stm32_fmc2_match[] = {
{ .compatible = "st,stm32mp15-fmc2" },
{ /* Sentinel */ }
};
U_BOOT_DRIVER(stm32_fmc2_nand) = {
.name = "stm32_fmc2_nand",
.id = UCLASS_MTD,
.of_match = stm32_fmc2_match,
.probe = stm32_fmc2_probe,
.priv_auto_alloc_size = sizeof(struct stm32_fmc2_nfc),
};
void board_nand_init(void)
{
struct udevice *dev;
int ret;
ret = uclass_get_device_by_driver(UCLASS_MTD,
DM_GET_DRIVER(stm32_fmc2_nand),
&dev);
if (ret && ret != -ENODEV)
pr_err("Failed to initialize STM32 FMC2 NAND controller. (error %d)\n",
ret);
}
| [
"[email protected]"
] | |
da89569d32891f2847d150d46a8647241edc1785 | aa0aa7fbdf8a38b867918338957ea0c9bc7790b5 | /build-arm64-clang/sysroot/include/zircon/device/block.h | 0a493a863fa4bd02a8b5a72981e6d0b1ae6d32f0 | [
"BSD-3-Clause",
"MIT"
] | permissive | ChristopherWen/Debug_zircon | e32c21e0caffbdf3a665c1d0c16c16b3879c62cd | 76228456e9a31a200f1d4f1fb9b5cd45b52f6263 | refs/heads/master | 2021-09-14T18:55:13.682316 | 2018-05-17T13:39:21 | 2018-05-17T13:39:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 13,727 | h | // Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include <assert.h>
#include <limits.h>
#include <zircon/device/ioctl-wrapper.h>
#include <zircon/device/ioctl.h>
#include <zircon/types.h>
// Get information about the underlying block device.
#define IOCTL_BLOCK_GET_INFO \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 1)
// Get the type GUID of the partition (if one exists)
#define IOCTL_BLOCK_GET_TYPE_GUID \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 2)
// Get the GUID of the partition (if one exists)
#define IOCTL_BLOCK_GET_PARTITION_GUID \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 3)
// Get the name of the partition (if one exists)
#define IOCTL_BLOCK_GET_NAME \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 4)
// Rebind the block device (if supported)
#define IOCTL_BLOCK_RR_PART \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 5)
// Set up a FIFO-based server on the block device; acquire the handle to it
#define IOCTL_BLOCK_GET_FIFOS \
IOCTL(IOCTL_KIND_GET_HANDLE, IOCTL_FAMILY_BLOCK, 6)
// Attach a VMO to the currently running FIFO server
#define IOCTL_BLOCK_ATTACH_VMO \
IOCTL(IOCTL_KIND_SET_HANDLE, IOCTL_FAMILY_BLOCK, 7)
// Allocate a txn with the currently running FIFO server
#define IOCTL_BLOCK_ALLOC_TXN \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 8)
// Free a txn from the currently running FIFO server
#define IOCTL_BLOCK_FREE_TXN \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 9)
// Shut down the fifo server, waiting for it to be ready to be started again.
// Only necessary to guarantee availibility to the next fifo server client;
// otherwise, closing the client fifo is sufficient to shut down the server.
#define IOCTL_BLOCK_FIFO_CLOSE \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 10)
// Allocate a virtual partition with the requested length
#define IOCTL_BLOCK_FVM_ALLOC \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 11)
// Extend a virtual partition.
#define IOCTL_BLOCK_FVM_EXTEND \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 12)
// Shink a virtual partition. Returns "success" if ANY slices are
// freed, even if part of the requested range contains unallocated slices.
#define IOCTL_BLOCK_FVM_SHRINK \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 13)
#define IOCTL_BLOCK_FVM_DESTROY \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 14)
// Returns the total number of vslices and slice size for an FVM partition
#define IOCTL_BLOCK_FVM_QUERY \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 15)
// Given a number of initial vslices, returns the number of contiguous allocated
// (or unallocated) vslices starting from each vslice.
#define IOCTL_BLOCK_FVM_VSLICE_QUERY \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 16)
// Atomically marks a vpartition (by instance GUID) as inactive, while finding
// another partition (by instance GUID) and marking it as active.
//
// If the "old" partition does not exist, the GUID is ignored.
// If the "old" partition is the same as the "new" partition, the "old"
// GUID is ignored (as in, "Upgrade" only activates).
// If the "new" partition does not exist, |ZX_ERR_NOT_FOUND| is returned.
//
// This function does not destroy the "old" partition, it just marks it as
// inactive -- to reclaim that space, the "old" partition must be explicitly
// destroyed. This destruction can also occur automatically when the FVM driver
// is rebound (i.e., on reboot).
//
// This function may be useful for A/B updates within the FVM,
// since it will allow "activating" updated partitions.
#define IOCTL_BLOCK_FVM_UPGRADE \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 17)
// Prints stats about the block device to the provided buffer and optionally
// clears the counters
#define IOCTL_BLOCK_GET_STATS \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_BLOCK, 18)
// Block Impl ioctls (specific to each block device):
#define BLOCK_FLAG_READONLY 0x00000001
#define BLOCK_FLAG_REMOVABLE 0x00000002
#define BLOCK_FLAG_BOOTPART 0x00000004 // block device has bootdata partition map
// provided by device metadata
typedef struct {
uint64_t block_count; // The number of blocks in this block device
uint32_t block_size; // The size of a single block
uint32_t max_transfer_size; // Max worst-case size in bytes per transfer, 0 is no maximum
uint32_t flags;
uint32_t reserved;
} block_info_t;
typedef struct {
size_t max_concur; // The maximum number of concurrent ops
size_t max_pending; // The maximum number of pending block ops
size_t total_ops; // Total number of block ops processed
size_t total_blocks; // Total number of blocks processed
} block_stats_t;
// ssize_t ioctl_block_get_info(int fd, block_info_t* out);
IOCTL_WRAPPER_OUT(ioctl_block_get_info, IOCTL_BLOCK_GET_INFO, block_info_t);
// ssize_t ioctl_block_get_type_guid(int fd, void* out, size_t out_len);
IOCTL_WRAPPER_VAROUT(ioctl_block_get_type_guid, IOCTL_BLOCK_GET_TYPE_GUID, void);
// ssize_t ioctl_block_get_partition_guid(int fd, void* out, size_t out_len);
IOCTL_WRAPPER_VAROUT(ioctl_block_get_partition_guid, IOCTL_BLOCK_GET_PARTITION_GUID, void);
// ssize_t ioctl_block_get_name(int fd, char* out, size_t out_len);
IOCTL_WRAPPER_VAROUT(ioctl_block_get_name, IOCTL_BLOCK_GET_NAME, char);
// ssize_t ioctl_block_rr_part(int fd);
IOCTL_WRAPPER(ioctl_block_rr_part, IOCTL_BLOCK_RR_PART);
// TODO(smklein): Move these to a separate file
// Block Device ioctls (shared between all block devices):
// ssize_t ioctl_block_get_fifos(int fd, zx_handle_t* fifo_out);
IOCTL_WRAPPER_OUT(ioctl_block_get_fifos, IOCTL_BLOCK_GET_FIFOS, zx_handle_t);
typedef uint16_t vmoid_t;
// Dummy vmoid value reserved for "invalid". Will never be allocated; can be
// used as a local value for unallocated / freed ID.
#define VMOID_INVALID 0
// ssize_t ioctl_block_attach_vmo(int fd, zx_handle_t* in, vmoid_t* out_vmoid);
IOCTL_WRAPPER_INOUT(ioctl_block_attach_vmo, IOCTL_BLOCK_ATTACH_VMO, zx_handle_t, vmoid_t);
#define MAX_TXN_COUNT 256
typedef uint16_t txnid_t;
// Dummy TXNID value reserved for "invalid". Will never be allocated; can be
// used as a local value for unallocated / freed ID.
#define TXNID_INVALID 0xFFFF
static_assert(TXNID_INVALID > MAX_TXN_COUNT, "Invalid Txn ID may be valid");
// ssize_t ioctl_block_alloc_txn(int fd, txnid_t* out_txnid);
IOCTL_WRAPPER_OUT(ioctl_block_alloc_txn, IOCTL_BLOCK_ALLOC_TXN, txnid_t);
// ssize_t ioctl_block_free_txn(int fd, const size_t* in_txnid);
IOCTL_WRAPPER_IN(ioctl_block_free_txn, IOCTL_BLOCK_FREE_TXN, txnid_t);
// ssize_t ioctl_block_fifo_close(int fd);
IOCTL_WRAPPER(ioctl_block_fifo_close, IOCTL_BLOCK_FIFO_CLOSE);
#define GUID_LEN 16
#define NAME_LEN 24
#define MAX_FVM_VSLICE_REQUESTS 16
typedef struct {
size_t slice_count;
uint8_t type[GUID_LEN];
uint8_t guid[GUID_LEN];
char name[NAME_LEN];
uint32_t flags; // Refer to fvm.h for options here; default is zero.
} alloc_req_t;
// ssize_t ioctl_block_fvm_alloc(int fd, const alloc_req_t* req);
IOCTL_WRAPPER_IN(ioctl_block_fvm_alloc, IOCTL_BLOCK_FVM_ALLOC, alloc_req_t);
typedef struct {
size_t offset; // Both in units of "slice". "0" = slice 0, "1" = slice 1, etc...
size_t length;
} extend_request_t;
// ssize_t ioctl_block_fvm_extend(int fd, const extend_request_t* request);
IOCTL_WRAPPER_IN(ioctl_block_fvm_extend, IOCTL_BLOCK_FVM_EXTEND, extend_request_t);
// ssize_t ioctl_block_fvm_shrink(int fd, const extend_request_t* request);
IOCTL_WRAPPER_IN(ioctl_block_fvm_shrink, IOCTL_BLOCK_FVM_SHRINK, extend_request_t);
// ssize_t ioctl_block_fvm_destroy(int fd);
IOCTL_WRAPPER(ioctl_block_fvm_destroy, IOCTL_BLOCK_FVM_DESTROY);
typedef struct {
bool allocated; // true if vslices are allocated, false otherwise
size_t count; // number of contiguous vslices
} vslice_range_t;
typedef struct {
size_t count; // number of elements in vslice_start
size_t vslice_start[MAX_FVM_VSLICE_REQUESTS]; // vslices to query from
} query_request_t;
typedef struct {
size_t count; // number of elements in vslice_range
vslice_range_t vslice_range[MAX_FVM_VSLICE_REQUESTS]; // number of contiguous vslices
// that are allocated (or unallocated)
} query_response_t;
typedef struct {
size_t slice_size; // Size of a single slice, in bytes
size_t vslice_count; // Number of addressable slices
} fvm_info_t;
// ssize_t ioctl_block_fvm_query(int fd, fvm_info_t* info);
IOCTL_WRAPPER_OUT(ioctl_block_fvm_query, IOCTL_BLOCK_FVM_QUERY, fvm_info_t);
// ssize_t ioctl_block_fvm_vslice_query(int fd, query_request_t* request,
// query_response_t* response);
IOCTL_WRAPPER_INOUT(ioctl_block_fvm_vslice_query, IOCTL_BLOCK_FVM_VSLICE_QUERY,
query_request_t, query_response_t);
typedef struct {
uint8_t old_guid[GUID_LEN];
uint8_t new_guid[GUID_LEN];
} upgrade_req_t;
// ssize_t ioctl_block_fvm_upgrade(int fd, const upgrade_req_t* req);
IOCTL_WRAPPER_IN(ioctl_block_fvm_upgrade, IOCTL_BLOCK_FVM_UPGRADE, upgrade_req_t);
// ssize_t ioctl_block_get_stats(int fd, bool clear, block_stats_t* out)
IOCTL_WRAPPER_INOUT(ioctl_block_get_stats, IOCTL_BLOCK_GET_STATS, bool, block_stats_t);
// Multiple Block IO operations may be sent at once before a response is actually sent back.
// Block IO ops may be sent concurrently to different vmoids, and they also may be sent
// to different transactions at any point in time. Up to MAX_TXN_COUNT transactions may
// be allocated at any point in time.
//
// "Transactions" are allocated with the "alloc_txn" ioctl. Allocating a transaction allows
// multiple message to be buffered at once on a single txn before receiving a response.
// Once a txn has been allocated, it can be re-used many times. It is recommended that
// transactions are allocated on a "per-thread" basis, and only freed on thread teardown.
//
// The protocol to communicate with a single txn is as follows:
// 1) SEND [N - 1] messages with an allocated txnid for any value of 1 <= N.
// The BLOCKIO_TXN_END flag is not set for this step.
// 2) SEND a final Nth message with the same txnid, but also the BLOCKIO_TXN_END flag.
// 3) RECEIVE a single response from the Block IO server after all N requests have completed.
// This response is sent once all operations either complete or a single operation fails.
// At this point, step (1) may begin again without reallocating the txn.
//
// For BLOCKIO_READ and BLOCKIO_WRITE, N may be greater than 1.
// Otherwise, N == 1 (skipping step (1) in the protocol above).
//
// Notes:
// - txnids may operate on any number of vmoids at once.
// - If additional requests are sent on the same txnid before step (3) has completed, then
// the additional request will not be processed. If BLOCKIO_TXN_END is set, an error will
// be returned. Otherwise, the request will be silently dropped.
// - The only requests that receive responses are ones which have the BLOCKIO_TXN_END flag
// set. This is the case for both successful and erroneous requests. This property allows
// the Block IO server to send back a response on the FIFO without waiting.
//
// For example, the following is a valid sequence of transactions:
// -> (txnid = 1, vmoid = 1, OP = Write)
// -> (txnid = 1, vmoid = 2, OP = Write)
// -> (txnid = 2, vmoid = 3, OP = Write | Want Reply)
// <- Response sent to txnid = 2
// -> (txnid = 1, vmoid = 1, OP = Read | Want Reply)
// <- Response sent to txnid = 1
// -> (txnid = 3, vmoid = 1, OP = Write)
// -> (txnid = 3, vmoid = 1, OP = Read | Want Reply)
// <- Repsonse sent to txnid = 3
//
// Each transaction reads or writes up to 'length' blocks from the device, starting at 'dev_offset'
// blocks, into the VMO associated with 'vmoid', starting at 'vmo_offset' blocks. If the
// transaction is out of range, for example if 'length' is too large or if 'dev_offset' is beyond
// the end of the device, ZX_ERR_OUT_OF_RANGE is returned.
// Reads from the Block device into the VMO
#define BLOCKIO_READ 0x00000001
// Writes to the Block device from the VMO
#define BLOCKIO_WRITE 0x00000002
// Write any cached data to nonvolatile storage.
// Implies BARRIER_BEFORE and BARRIER_AFTER.
#define BLOCKIO_FLUSH 0x00000003
// Detaches the VMO from the block device.
#define BLOCKIO_CLOSE_VMO 0x00000004
#define BLOCKIO_OP_MASK 0x000000FF
// Require that this operation will not begin until all prior operations
// have completed.
#define BLOCKIO_BARRIER_BEFORE 0x00000100
// Require that this operation must complete before additional operations begin.
#define BLOCKIO_BARRIER_AFTER 0x00000200
// Respond after request (and all previous) have completed
#define BLOCKIO_TXN_END 0x00000400
#define BLOCKIO_FLAG_MASK 0x0000FF00
typedef struct {
txnid_t txnid;
vmoid_t vmoid;
uint32_t opcode;
uint64_t length;
uint64_t vmo_offset;
uint64_t dev_offset;
} block_fifo_request_t;
typedef struct {
txnid_t txnid;
uint16_t reserved0;
zx_status_t status;
uint32_t count; // The number of messages in the transaction completed by the block server.
uint32_t reserved1;
uint64_t reserved2;
uint64_t reserved3;
} block_fifo_response_t;
static_assert(sizeof(block_fifo_request_t) == sizeof(block_fifo_response_t),
"FIFO messages are the same size in both directions");
#define BLOCK_FIFO_ESIZE (sizeof(block_fifo_request_t))
#define BLOCK_FIFO_MAX_DEPTH (4096 / BLOCK_FIFO_ESIZE)
| [
"[email protected]"
] | |
53d938068b501606324beb4a184e57c3627c108d | e3706b7bb343deaf0fe59221de64f520a7260826 | /BasecampWorkspace/Week_1/d04/d04tests/alltests.c | 6a6f0df136a08ee7563871a78aa5c65eafea0ba9 | [] | no_license | acastanome/Basecamp_42 | db8e43e229f9e5bb806d33b17c770b2d7779cc60 | c88671d138a89850136fcf5756a8dc17a39ae9c6 | refs/heads/main | 2023-06-01T23:45:26.181643 | 2021-06-17T22:30:43 | 2021-06-17T22:30:43 | 377,966,210 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,596 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* alltests.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: acastano <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/05/29 14:51:09 by acastano #+# #+# */
/* Updated: 2021/05/30 15:19:21 by acastano ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
//ex00
int ft_iterative_factorial(int nb);
int main(void)
{
printf("factorial of 0 is %d, correct 1\n", ft_iterative_factorial(0));
printf("factorial of 1 is %d, correct 1\n", ft_iterative_factorial(1));
printf("factorial of 13 is %d, correct 120\n", ft_iterative_factorial(13));
printf("factorial of -7 is %d, correct 0\n", ft_iterative_factorial(-7));
return (0);
}
//ex01
int ft_recursive_factorial(int nb);
int main(void)
{
printf("factorial of 0 is %d, correct 1\n", ft_recursive_factorial(0));
printf("factorial of 1 is %d, correct 1\n", ft_recursive_factorial(1));
printf("factorial of 13 is %d, correct 120\n", ft_recursive_factorial(13));
printf("factorial of -7 is %d, correct 0\n", ft_recursive_factorial(-7));
return (0);
}
//ex02
int ft_iterative_power(int nb, int power);
int main(void)
{
printf("0 ^ 1 is %d, correct 0\n", ft_iterative_power(0, 1));
printf("0 ^ 0 is %d, correct 1\n", ft_iterative_power(0, 0));
printf("2 ^ 4 is %d, correct 16\n", ft_iterative_power(2, 4));
printf("2 ^ -7 is %d, correct 0\n", ft_iterative_power(2, -7));
printf("2 ^ 1 is %d, correct 2\n", ft_iterative_power(2, 1));
printf("2 ^ 0 is %d, correct 1\n", ft_iterative_power(2, 0));
return (0);
}
//ex03
int ft_recursive_power(int nb, int power);
int main(void)
{
printf("0 ^ 1 is %d, correct 0\n", ft_recursive_power(0, 1));
printf("0 ^ 0 is %d, correct 1\n", ft_recursive_power(0, 0));
printf("2 ^ 4 is %d, correct 16\n", ft_recursive_power(2, 4));
printf("2 ^ -7 is %d, correct 0\n", ft_recursive_power(2, -7));
printf("2 ^ 1 is %d, correct 2\n", ft_recursive_power(2, 1));
printf("2 ^ 0 is %d, correct 1\n", ft_recursive_power(2, 0));
return (0);
}
| [
"[email protected]"
] | |
ede505e72bb9e5c31d0caf36edc4249183a5229b | 652782d2d898c7d2ca71b99b60e3fef9b685ae93 | /pixhawk/version.h | 108c9df80b75cb3740091602ff3ebf80d3974442 | [] | no_license | Jinqiang/c_library | 4a79af783ee8767ebe5811efcd86767f740d5f53 | b982d9aa1c149e210a6dc2328c408e0da5a27529 | refs/heads/master | 2020-12-25T21:35:04.175192 | 2015-03-28T18:36:22 | 2015-03-28T18:36:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 322 | h | /** @file
* @brief MAVLink comm protocol built from pixhawk.xml
* @see http://mavlink.org
*/
#ifndef MAVLINK_VERSION_H
#define MAVLINK_VERSION_H
#define MAVLINK_BUILD_DATE "Sat Mar 28 18:35:48 2015"
#define MAVLINK_WIRE_PROTOCOL_VERSION "1.0"
#define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255
#endif // MAVLINK_VERSION_H
| [
"[email protected]"
] | |
e1d91176ac46c7047c75d2ca1fa1621ba1773779 | c7d3e877322acc6f83f67cea0b62ad4add30b904 | /lab_5/src/core/queue/queue_lst.c | 586e111ef98a66b120e54455ceaf33d00257fa23 | [] | no_license | RullDeef/tads-lab | 5b07b26193b6086d1d3e11ffba5d3ee6869a7560 | eef2c77d2c424169f2a54839d6acbf1876ccd699 | refs/heads/master | 2023-06-17T21:59:05.417505 | 2021-01-30T16:50:52 | 2021-01-30T16:50:52 | 387,740,073 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,435 | c | #include <stdlib.h>
#include <assert.h>
#include "queue_lst.h"
struct queue_lst qul_create(void)
{
struct queue_lst qul = { .size = 0U, .first = NULL, .last = NULL };
return qul;
}
void qul_destroy(struct queue_lst *qul)
{
while (qul->size > 0U)
{
qdata_t value;
qul_pop_front(qul, &value);
}
}
int qul_push_back(struct queue_lst *qul, qdata_t value)
{
int status = EXIT_FAILURE;
if (qul->size == 0U)
{
status = EXIT_SUCCESS;
qul->first = malloc(sizeof(struct __qu_lst_node));
assert(qul->first != NULL);
qul->first->next = NULL;
qul->first->data = value;
qul->last = &(qul->first->next);
qul->size++;
}
else
{
status = EXIT_SUCCESS;
*(qul->last) = malloc(sizeof(struct __qu_lst_node));
assert(*(qul->last) != NULL);
(*(qul->last))->data = value;
(*(qul->last))->next = NULL;
qul->last = &((*qul->last)->next);
qul->size++;
}
return status;
}
int qul_pop_front(struct queue_lst *qul, qdata_t *value)
{
int status = EXIT_FAILURE;
if (qul->size != 0)
{
status = EXIT_SUCCESS;
struct __qu_lst_node *next = qul->first->next;
*value = qul->first->data;
free(qul->first);
qul->first = next;
qul->size--;
if (qul->size == 0U)
qul->last = NULL;
}
return status;
}
| [
"[email protected]"
] | |
96251e3b6b09c038ec4b24001dc6593ebe3923d1 | da295e77d9c97c3ef153e5a5464446238dc62460 | /2010/alife_screensaver.c | 08bd96e275875ae7f9a882dfc198666a6adba363 | [] | no_license | matthewtemple/asimpleprogram | de07c76f1d9387626ac4a5ded5729467ac5e486e | f4366a5d35ee1a6d0884ec7d5e7d1a9a6a75c843 | refs/heads/master | 2021-01-10T21:46:04.787823 | 2010-06-20T11:52:14 | 2010-06-20T11:52:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 443 | c | main(){int a[4],i,q,r,s=1839,t,x,y,z[1920*sizeof(int)];for(x=0;x<1920*sizeof(
int);z[x]=0,x++);z[1000]=1;z[1001]=1;z[1080]=2;z[1081]=2;f:putchar('\n');for(i=
0;i<1920;i++){putchar(z[i]+32);a[0]=i%80>0?i-1:i+79;a[1]=i%80<79?i+1:i-79;a[2]=
i>79?i-80:s+i+1;a[3]=i<s?i+80:i-s-1;x=random()%4;y=random()%16;q=z[a[x]];r=z
[i];if(q){if(r==q)z[a[0]]=(r+y+q)%16;else if(r>q){t=(r*q)%16;z[a[x]]=r;z[i]=t;}
}else{z[a[x]]=r;z[i]=0;}}usleep(48000);goto f;}
| [
"[email protected]"
] | |
2848d36964487ea6385f0b7aa2c712cde515ab69 | f5ddf37695623ed35ccfb4d3eb5b99d570161da0 | /code/bmad/h5hut/src/include/h5core/h5t_map.h | 2cf56d65189f4ea815c3741dd18b2a81d435b192 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | jasperhansel/fullbeamline | e778bd7fa2d11ad81f4cad6b4de5778f23b2dc33 | 0bca14a0cc504a564a17d4a07fc72e555a85f066 | refs/heads/master | 2021-08-07T20:21:28.167786 | 2017-11-08T23:31:04 | 2017-11-08T23:31:04 | 109,726,515 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,931 | h | #ifndef __H5T_MAP_H
#define __H5T_MAP_H
#ifdef __cplusplus
extern "C" {
#endif
h5_loc_idx_t
h5t_map_global_vertex_idx2local (
h5t_mesh_t* const m,
h5_glb_idx_t glb_idx
);
h5_err_t
h5t_map_global_vertex_indices2local (
h5t_mesh_t* f,
const h5_glb_id_t* const glb_indices,
const h5_size_t size,
h5_loc_idx_t* const loc_indices
);
h5_loc_idx_t
h5t_map_glb_elem_idx2loc (
h5t_mesh_t* const m,
const h5_glb_idx_t glb_idx
);
h5_err_t
h5t_map_glb_elem_indices2loc (
h5t_mesh_t* const m,
const h5_glb_idx_t* glb_indices,
const h5_size_t size,
h5_loc_idx_t* loc_indices
);
h5_err_t
h5t_get_vertex_index_of_vertex (
h5t_mesh_t* const m,
const h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_index
);
h5_err_t
h5t_get_vertex_index_of_vertex2 (
h5t_mesh_t* const m,
const h5_loc_idx_t face_idx,
const h5_loc_idx_t elem_idx,
h5_loc_idx_t* vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_edge (
h5t_mesh_t* const m,
const h5_loc_id_t entity_id,
h5_loc_idx_t *vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_edge2 (
h5t_mesh_t* const m,
const h5_loc_idx_t face_idx,
const h5_loc_idx_t elem_id,
h5_loc_idx_t* vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_triangle (
h5t_mesh_t* const m,
const h5_loc_id_t entity_id,
h5_loc_idx_t* vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_triangle2 (
h5t_mesh_t* const m,
const h5_loc_idx_t face_idx,
const h5_loc_idx_t elem_idx,
h5_loc_idx_t* vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_tet (
h5t_mesh_t* const m,
const h5_loc_id_t entity_id,
h5_loc_idx_t *vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_entity (
h5t_mesh_t* const m,
const h5_loc_id_t entity_id,
h5_loc_idx_t *vertex_indices
);
h5_err_t
h5t_get_vertex_indices_of_entity2 (
h5t_mesh_t* const m,
const int dim,
const h5_loc_idx_t face_idx,
const h5_loc_idx_t elem_idx,
h5_loc_idx_t* vertex_indices
);
#ifdef __cplusplus
}
#endif
#endif
| [
"[email protected]"
] | |
04916f85a44830fb17d4f1bb627051465274ca69 | 5c255f911786e984286b1f7a4e6091a68419d049 | /vulnerable_code/cfedd86d-9b5b-4e35-8d6c-ac9be526a351.c | f7725c45f1ada5ecae35cb938ac75c23543f3090 | [] | 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 | 592 | c | #include <string.h>
#include <stdio.h>
int main() {
int i=0;
int j=12;
int k;
int l;
k = 533;
l = 64;
k = i%j;
l = i/j;
l = j%j;
l = l%j;
k = k-k*i;
//variables
//random
/* START VULNERABILITY */
int a;
long b[21];
long c[65];
a = 0;
while (b[( a - 1 )] != 0) {
a++;
/* START BUFFER SET */
*((long *)c + ( a - 1 )) = *((long *)b + ( a - 1 ));
/* END BUFFER SET */
//random
}
/* END VULNERABILITY */
//random
printf("%d%d\n",k,l);
return 0;
}
| [
"[email protected]"
] | |
1710033500f73d3826f8cfd5432b9cc906a7d3d7 | 48914e4d0a55d537be6a0d359da7f79f4a1dbaf2 | /usr/spawnd/main.c | 0462d6405ef293dd3918c0f3ed05e5ae1584d1b4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | joe9/barrelfish | f1efbbbc5c345a96b649da2b2e0762d00e42ad52 | d084c900bedc914ff10cd6e31d6c73044ed255f4 | refs/heads/master | 2016-09-06T10:26:17.271774 | 2014-10-04T22:09:20 | 2014-10-04T22:09:20 | 24,802,206 | 4 | 0 | null | null | null | null | UTF-8 | C | false | false | 3,762 | c | /**
* \file
* \brief Spawn daemon for Barrelfish.
* At boot, decides which cores to boot and which domains to spawn.
* After boot, offers a service on each core to spawn programs from
* the file system.
*/
/*
* Copyright (c) 2010-2011, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#include <stdio.h>
#include <string.h>
#include <barrelfish/barrelfish.h>
#include <barrelfish/dispatch.h>
#include <barrelfish_kpi/cpu.h> // for cpu_type_to_archstr()
#include <barrelfish/cpu_arch.h> // for CURRENT_CPU_TYPE
#include <vfs/vfs.h>
#include <if/monitor_defs.h>
#include "internal.h"
coreid_t my_core_id;
bool is_bsp_core;
const char *gbootmodules;
/* set an initial default environment for our boot-time children */
static void init_environ(void)
{
int r;
/* PATH=/arch/sbin */
char pathstr[64];
snprintf(pathstr, sizeof(pathstr), "/%s/sbin",
cpu_type_to_archstr(CURRENT_CPU_TYPE));
pathstr[sizeof(pathstr) - 1] = '\0';
r = setenv("PATH", pathstr, 0);
if (r != 0) {
USER_PANIC("failed to set PATH");
}
/* HOME=/ */
r = setenv("HOME", "/", 0);
if (r != 0) {
USER_PANIC("failed to set HOME");
}
}
/* open bootmodules file and read it in */
static void get_bootmodules(void)
{
errval_t err;
// open bootmodules file and read it in
vfs_handle_t vh;
err = vfs_open("/bootmodules", &vh);
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "unable to open /bootmodules");
}
struct vfs_fileinfo info;
err = vfs_stat(vh, &info);
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "unable to stat /bootmodules");
}
char *bootmodules = malloc(info.size + 1);
if (bootmodules == NULL) {
USER_PANIC_ERR(LIB_ERR_MALLOC_FAIL,
"failed to allocate memory for bootmodules");
}
size_t bootmodules_len;
err = vfs_read(vh, bootmodules, info.size, &bootmodules_len);
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "unable to read /bootmodules");
} else if (bootmodules_len == 0) {
USER_PANIC_ERR(err, "/bootmodules is empty");
} else if (bootmodules_len != info.size) {
USER_PANIC_ERR(err, "unexpected short read of /bootmodules");
}
err = vfs_close(vh);
if (err_is_fail(err)) {
DEBUG_ERR(err, "could not close bottmodules file");
}
// terminate as a string
bootmodules[bootmodules_len] = '\0';
gbootmodules = bootmodules;
}
int main(int argc, const char *argv[])
{
errval_t err;
printf("Spawnd up.\n");
vfs_init();
my_core_id = disp_get_core_id();
#if 0
debug_printf("spawnd invoked on core %d as:", my_core_id);
for (int i = 0; i < argc; i++) {
printf(" %s", argv[i]);
}
printf("\n");
#endif
// read in the bootmodules file so that we know what to start
get_bootmodules();
// construct sane inital environment
init_environ();
if (argc >= 2 && strcmp(argv[1],"boot") == 0) {
debug_printf("we're bsp. start other cores.\n");
// if we're the BSP, bring up the other cores
is_bsp_core = true;
#if defined(USE_KALUGA_DVM) && (!defined(__arm__) && !defined(__scc__) &&!defined(__k1om__))
err = start_service();
#else
bsp_bootup(gbootmodules, argc, argv);
#endif
} else {
// otherwise offer the spawn service
err = start_service();
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "failed to start spawnd service loop");
}
}
messages_handler_loop();
}
| [
"[email protected]"
] | |
d25b6bc8cf7be005ee3cdd0101afc0ffd88033b9 | 7a248f95d87e004265751936901626bf5c21efb3 | /libft/libft/ft_putchar_fd.c | 57b23197b0b6db81ae9d14f71ef38dddc56d7501 | [] | no_license | gualnet/42-malloc | 83c6fd65b796daf28c2a779e6f08089de3d90755 | 3a926d372de520b6db7a63b0f426b0da2a87dc6a | refs/heads/master | 2021-03-24T12:12:12.416302 | 2019-10-14T18:58:46 | 2019-10-14T18:58:46 | 113,425,289 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 971 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putchar_fd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: galy <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/05 12:26:26 by galy #+# #+# */
/* Updated: 2016/11/05 13:27:08 by galy ### ########.fr */
/* */
/* ************************************************************************** */
#include <unistd.h>
void ft_putchar_fd(char c, int fd)
{
write(fd, &c, 1);
}
| [
"[email protected]"
] | |
d88c8560573c40940106a4cc71167c148febb082 | 5630b0a520e395b1224d80a04309ed9991a2ccbe | /getGemXCode/Classes/Native/Mono_Security_Mono_Security_Protocol_Tls_TlsStreamMethodDeclarations.h | 6976b2a459f2471ff689bad3879cc88e8e3d2fee | [] | no_license | WwinW/getGem | f762b538f9387a0e3adaacc2b55ac34e0dfb12df | 5b3cede71b7c50ffedf3a87f51003cb35db9b774 | refs/heads/master | 2018-12-29T19:25:51.948800 | 2015-12-07T03:16:48 | 2015-12-07T03:16:48 | 34,213,973 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 5,662 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <assert.h>
#include <exception>
// Mono.Security.Protocol.Tls.TlsStream
struct TlsStream_t1232;
// System.Byte[]
struct ByteU5BU5D_t337;
#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_IO_SeekOrigin.h"
// System.Void Mono.Security.Protocol.Tls.TlsStream::.ctor()
extern "C" void TlsStream__ctor_m7631 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::.ctor(System.Byte[])
extern "C" void TlsStream__ctor_m7632 (TlsStream_t1232 * __this, ByteU5BU5D_t337* ___data, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean Mono.Security.Protocol.Tls.TlsStream::get_EOF()
extern "C" bool TlsStream_get_EOF_m7633 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean Mono.Security.Protocol.Tls.TlsStream::get_CanWrite()
extern "C" bool TlsStream_get_CanWrite_m7634 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean Mono.Security.Protocol.Tls.TlsStream::get_CanRead()
extern "C" bool TlsStream_get_CanRead_m7635 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Boolean Mono.Security.Protocol.Tls.TlsStream::get_CanSeek()
extern "C" bool TlsStream_get_CanSeek_m7636 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int64 Mono.Security.Protocol.Tls.TlsStream::get_Position()
extern "C" int64_t TlsStream_get_Position_m7637 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::set_Position(System.Int64)
extern "C" void TlsStream_set_Position_m7638 (TlsStream_t1232 * __this, int64_t ___value, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int64 Mono.Security.Protocol.Tls.TlsStream::get_Length()
extern "C" int64_t TlsStream_get_Length_m7639 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Byte[] Mono.Security.Protocol.Tls.TlsStream::ReadSmallValue(System.Int32)
extern "C" ByteU5BU5D_t337* TlsStream_ReadSmallValue_m7640 (TlsStream_t1232 * __this, int32_t ___length, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Byte Mono.Security.Protocol.Tls.TlsStream::ReadByte()
extern "C" uint8_t TlsStream_ReadByte_m7641 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int16 Mono.Security.Protocol.Tls.TlsStream::ReadInt16()
extern "C" int16_t TlsStream_ReadInt16_m7642 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 Mono.Security.Protocol.Tls.TlsStream::ReadInt24()
extern "C" int32_t TlsStream_ReadInt24_m7643 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Byte[] Mono.Security.Protocol.Tls.TlsStream::ReadBytes(System.Int32)
extern "C" ByteU5BU5D_t337* TlsStream_ReadBytes_m7644 (TlsStream_t1232 * __this, int32_t ___count, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Write(System.Byte)
extern "C" void TlsStream_Write_m7645 (TlsStream_t1232 * __this, uint8_t ___value, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Write(System.Int16)
extern "C" void TlsStream_Write_m7646 (TlsStream_t1232 * __this, int16_t ___value, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::WriteInt24(System.Int32)
extern "C" void TlsStream_WriteInt24_m7647 (TlsStream_t1232 * __this, int32_t ___value, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Write(System.Int32)
extern "C" void TlsStream_Write_m7648 (TlsStream_t1232 * __this, int32_t ___value, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Write(System.Byte[])
extern "C" void TlsStream_Write_m7649 (TlsStream_t1232 * __this, ByteU5BU5D_t337* ___buffer, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Reset()
extern "C" void TlsStream_Reset_m7650 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Byte[] Mono.Security.Protocol.Tls.TlsStream::ToArray()
extern "C" ByteU5BU5D_t337* TlsStream_ToArray_m7651 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Flush()
extern "C" void TlsStream_Flush_m7652 (TlsStream_t1232 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::SetLength(System.Int64)
extern "C" void TlsStream_SetLength_m7653 (TlsStream_t1232 * __this, int64_t ___length, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int64 Mono.Security.Protocol.Tls.TlsStream::Seek(System.Int64,System.IO.SeekOrigin)
extern "C" int64_t TlsStream_Seek_m7654 (TlsStream_t1232 * __this, int64_t ___offset, int32_t ___loc, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Int32 Mono.Security.Protocol.Tls.TlsStream::Read(System.Byte[],System.Int32,System.Int32)
extern "C" int32_t TlsStream_Read_m7655 (TlsStream_t1232 * __this, ByteU5BU5D_t337* ___buffer, int32_t ___offset, int32_t ___count, const MethodInfo* method) IL2CPP_METHOD_ATTR;
// System.Void Mono.Security.Protocol.Tls.TlsStream::Write(System.Byte[],System.Int32,System.Int32)
extern "C" void TlsStream_Write_m7656 (TlsStream_t1232 * __this, ByteU5BU5D_t337* ___buffer, int32_t ___offset, int32_t ___count, const MethodInfo* method) IL2CPP_METHOD_ATTR;
| [
"[email protected]"
] | |
8086ff9192f4fecb563d66440b9b6c370512242f | a763f6505331d1c1823d0e8620cc2d5f83048486 | /wdm/capture/mini/tecra750/capstrm.h | 6ca3a1205357c3d552702c1d36958d20957adbb1 | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_drivers | 1dc9ccd83e38299f6643ecfd996a5df1357cc912 | 1b5d2672673ff31b60ee4a5b96922ddbcc203749 | refs/heads/master | 2023-04-11T08:18:29.881663 | 2021-04-14T04:30:34 | 2021-04-14T04:30:34 | 357,772,205 | 12 | 5 | null | null | null | null | UTF-8 | C | false | false | 30,055 | h | //==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
//
//==========================================================================;
#ifndef __CAPSTRM_H__
#define __CAPSTRM_H__
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
KSPIN_MEDIUM StandardMedium = {
STATIC_KSMEDIUMSETID_Standard,
0, 0
};
// ------------------------------------------------------------------------
// The master list of all streams supported by this driver
// ------------------------------------------------------------------------
typedef enum {
STREAM_Capture,
#ifndef TOSHIBA
STREAM_Preview,
STREAM_AnalogVideoInput
#endif//TOSHIBA
};
// ------------------------------------------------------------------------
// Property sets for all video capture streams
// ------------------------------------------------------------------------
DEFINE_KSPROPERTY_TABLE(VideoStreamConnectionProperties)
{
DEFINE_KSPROPERTY_ITEM
(
KSPROPERTY_CONNECTION_ALLOCATORFRAMING,
TRUE, // GetSupported or Handler
sizeof(KSPROPERTY), // MinProperty
sizeof(KSALLOCATOR_FRAMING), // MinData
FALSE, // SetSupported or Handler
NULL, // Values
0, // RelationsCount
NULL, // Relations
NULL, // SupportHandler
0 // SerializedSize
),
};
DEFINE_KSPROPERTY_TABLE(VideoStreamDroppedFramesProperties)
{
DEFINE_KSPROPERTY_ITEM
(
KSPROPERTY_DROPPEDFRAMES_CURRENT,
TRUE, // GetSupported or Handler
sizeof(KSPROPERTY_DROPPEDFRAMES_CURRENT_S),// MinProperty
sizeof(KSPROPERTY_DROPPEDFRAMES_CURRENT_S),// MinData
FALSE, // SetSupported or Handler
NULL, // Values
0, // RelationsCount
NULL, // Relations
NULL, // SupportHandler
0 // SerializedSize
),
};
// ------------------------------------------------------------------------
// Array of all of the property sets supported by video streams
// ------------------------------------------------------------------------
DEFINE_KSPROPERTY_SET_TABLE(VideoStreamProperties)
{
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_Connection, // Set
SIZEOF_ARRAY(VideoStreamConnectionProperties), // PropertiesCount
VideoStreamConnectionProperties, // PropertyItem
0, // FastIoCount
NULL // FastIoTable
),
DEFINE_KSPROPERTY_SET
(
&PROPSETID_VIDCAP_DROPPEDFRAMES, // Set
SIZEOF_ARRAY(VideoStreamDroppedFramesProperties), // PropertiesCount
VideoStreamDroppedFramesProperties, // PropertyItem
0, // FastIoCount
NULL // FastIoTable
),
};
#define NUMBER_VIDEO_STREAM_PROPERTIES (SIZEOF_ARRAY(VideoStreamProperties))
//---------------------------------------------------------------------------
// All of the video and vbi data formats we might use
//---------------------------------------------------------------------------
#define D_X 320
#define D_Y 240
#ifdef TOSHIBA
static KS_DATARANGE_VIDEO StreamFormatYVU9_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
(D_X * D_Y * 9)/8, // SampleSize
0, // Reserved
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
FOURCC_YVU9, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //MEDIASUBTYPE_YVU9
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // aka. FORMAT_VideoInfo
},
TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
0, // Reserved (was StreamDescriptionFlags)
0, // Reserved (was MemoryAllocationFlags (KS_VIDEO_ALLOC_*))
// _KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
#if 1
KS_AnalogVideo_None, // VideoStandard
#else
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
#endif
640,480, // InputSize, (the inherent size of the incoming signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect allowed
640,480, // MaxCroppingSize, largest rcSrc cropping rect allowed
2, // CropGranularityX, granularity of cropping size
2, // CropGranularityY
2, // CropAlignX, alignment of cropping rect
2, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
640, 480, // MaxOutputSize, largest bitmap stream can produce
16, // OutputGranularityX, granularity of output bitmap size
4, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
0, // StretchTapsY
2, // ShrinkTapsX
2, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
30 * 160 * 120 * 9, // MinBitsPerSecond;
30 * 640 * 480 * 9 // MaxBitsPerSecond;
},
// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
D_X * D_Y * 9 / 8 * 30, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME AvgTimePerFrame;
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;
D_Y, // LONG biHeight;
1, // WORD biPlanes;
9, // WORD biBitCount;
FOURCC_YVU9, // DWORD biCompression;
D_X * D_Y * 9 / 8, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
};
static KS_DATARANGE_VIDEO StreamFormatYUV12_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
(D_X * D_Y * 12)/8, // SampleSize
0, // Reserved
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
FOURCC_YUV12, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //MEDIASUBTYPE_YUV12
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // aka. FORMAT_VideoInfo
},
TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
0, // Reserved (was StreamDescriptionFlags)
0, // Reserved (was MemoryAllocationFlags (KS_VIDEO_ALLOC_*))
// _KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
#if 1
KS_AnalogVideo_None, // VideoStandard
#else
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
#endif
640,480, // InputSize, (the inherent size of the incoming signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect allowed
640,480, // MaxCroppingSize, largest rcSrc cropping rect allowed
2, // CropGranularityX, granularity of cropping size
2, // CropGranularityY
2, // CropAlignX, alignment of cropping rect
2, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
640, 480, // MaxOutputSize, largest bitmap stream can produce
16, // OutputGranularityX, granularity of output bitmap size
4, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
0, // StretchTapsY
2, // ShrinkTapsX
2, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
30 * 160 * 120 * 12, // MinBitsPerSecond;
30 * 640 * 480 * 12 // MaxBitsPerSecond;
},
// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
D_X * D_Y * 12 / 8 * 30, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME AvgTimePerFrame;
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;
D_Y, // LONG biHeight;
1, // WORD biPlanes;
12, // WORD biBitCount;
FOURCC_YUV12, // DWORD biCompression;
D_X * D_Y * 12 / 8, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
};
#else //TOSHIBA
static KS_DATARANGE_VIDEO StreamFormatRGB24Bpp_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
D_X * D_Y * 3, // SampleSize
0, // Reserved
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
0xe436eb7d, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70, //MEDIASUBTYPE_RGB24,
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // aka. FORMAT_VideoInfo
},
TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
0, // Reserved (was StreamDescriptionFlags)
0, // Reserved (was MemoryAllocationFlags (KS_VIDEO_ALLOC_*))
// _KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
720,480, // InputSize, (the inherent size of the incoming signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect allowed
720,480, // MaxCroppingSize, largest rcSrc cropping rect allowed
8, // CropGranularityX, granularity of cropping size
1, // CropGranularityY
8, // CropAlignX, alignment of cropping rect
1, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
720, 480, // MaxOutputSize, largest bitmap stream can produce
8, // OutputGranularityX, granularity of output bitmap size
1, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
0, // StretchTapsY
0, // ShrinkTapsX
0, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
8 * 3 * 30 * 160 * 120, // MinBitsPerSecond;
8 * 3 * 30 * 720 * 480 // MaxBitsPerSecond;
},
// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
D_X * D_Y * 3 * 30, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME AvgTimePerFrame;
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;
D_Y, // LONG biHeight;
1, // WORD biPlanes;
24, // WORD biBitCount;
KS_BI_RGB, // DWORD biCompression;
D_X * D_Y * 3, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
};
#undef D_X
#undef D_Y
#define D_X 320
#define D_Y 240
static KS_DATARANGE_VIDEO StreamFormatUYU2_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
D_X * D_Y * 2, // SampleSize
0, // Reserved
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //MEDIASUBTYPE_UYVY,
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // aka. FORMAT_VideoInfo
},
TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
0, // Reserved (was StreamDescriptionFlags)
0, // Reserved (was MemoryAllocationFlags (KS_VIDEO_ALLOC_*))
// _KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
720,480, // InputSize, (the inherent size of the incoming signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect allowed
720,480, // MaxCroppingSize, largest rcSrc cropping rect allowed
8, // CropGranularityX, granularity of cropping size
1, // CropGranularityY
8, // CropAlignX, alignment of cropping rect
1, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
720, 480, // MaxOutputSize, largest bitmap stream can produce
8, // OutputGranularityX, granularity of output bitmap size
1, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2 interp...)
0, // StretchTapsY
0, // ShrinkTapsX
0, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
8 * 2 * 30 * 160 * 120, // MinBitsPerSecond;
8 * 2 * 30 * 720 * 480 // MaxBitsPerSecond;
},
// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
D_X * D_Y * 2 * 30, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME AvgTimePerFrame;
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;
D_Y, // LONG biHeight;
1, // WORD biPlanes;
16, // WORD biBitCount;
FOURCC_YUV422, // DWORD biCompression;
D_X * D_Y * 2, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
};
#endif//TOSHIBA
#undef D_X
#undef D_Y
#ifndef TOSHIBA
static KS_DATARANGE_ANALOGVIDEO StreamFormatAnalogVideo =
{
// KS_DATARANGE_ANALOGVIDEO
{
sizeof (KS_DATARANGE_ANALOGVIDEO), // FormatSize
0, // Flags
sizeof (KS_TVTUNER_CHANGE_INFO), // SampleSize
0, // Reserved
STATIC_KSDATAFORMAT_TYPE_ANALOGVIDEO, // aka MEDIATYPE_AnalogVideo
STATIC_KSDATAFORMAT_SUBTYPE_NONE,
STATIC_KSDATAFORMAT_SPECIFIER_ANALOGVIDEO, // aka FORMAT_AnalogVideo
},
// KS_ANALOGVIDEOINFO
{
0, 0, 720, 480, // rcSource;
0, 0, 720, 480, // rcTarget;
720, // dwActiveWidth;
480, // dwActiveHeight;
0, // REFERENCE_TIME AvgTimePerFrame;
}
};
#endif//TOSHIBA
//---------------------------------------------------------------------------
// STREAM_Capture Formats
//---------------------------------------------------------------------------
static PKSDATAFORMAT Stream0Formats[] =
{
#ifdef TOSHIBA
(PKSDATAFORMAT) &StreamFormatYUV12_Capture,
(PKSDATAFORMAT) &StreamFormatYVU9_Capture,
#else //TOSHIBA
(PKSDATAFORMAT) &StreamFormatRGB24Bpp_Capture,
(PKSDATAFORMAT) &StreamFormatUYU2_Capture,
#endif//TOSHIBA
};
#define NUM_STREAM_0_FORMATS (SIZEOF_ARRAY(Stream0Formats))
#ifndef TOSHIBA
//---------------------------------------------------------------------------
// STREAM_Preview Formats
//---------------------------------------------------------------------------
static PKSDATAFORMAT Stream1Formats[] =
{
#ifdef TOSHIBA
(PKSDATAFORMAT) &StreamFormatYUV12_Capture,
(PKSDATAFORMAT) &StreamFormatYVU9_Capture,
#else //TOSHIBA
(PKSDATAFORMAT) &StreamFormatRGB24Bpp_Capture,
(PKSDATAFORMAT) &StreamFormatUYU2_Capture,
#endif//TOSHIBA
};
#define NUM_STREAM_1_FORMATS (SIZEOF_ARRAY (Stream1Formats))
//---------------------------------------------------------------------------
// STREAM_AnalogVideoInput Formats
//---------------------------------------------------------------------------
static PKSDATAFORMAT Stream2Formats[] =
{
(PKSDATAFORMAT) &StreamFormatAnalogVideo,
};
#define NUM_STREAM_2_FORMATS (SIZEOF_ARRAY (Stream2Formats))
#endif//TOSHIBA
//---------------------------------------------------------------------------
// Create an array that holds the list of all of the streams supported
//---------------------------------------------------------------------------
typedef struct _ALL_STREAM_INFO {
HW_STREAM_INFORMATION hwStreamInfo;
HW_STREAM_OBJECT hwStreamObject;
} ALL_STREAM_INFO, *PALL_STREAM_INFO;
static ALL_STREAM_INFO Streams [] =
{
// -----------------------------------------------------------------
// STREAM_Capture
// -----------------------------------------------------------------
{
// HW_STREAM_INFORMATION -------------------------------------------
{
1, // NumberOfPossibleInstances
KSPIN_DATAFLOW_OUT, // DataFlow
TRUE, // DataAccessible
NUM_STREAM_0_FORMATS, // NumberOfFormatArrayEntries
Stream0Formats, // StreamFormatsArray
0, // ClassReserved[0]
0, // ClassReserved[1]
0, // ClassReserved[2]
0, // ClassReserved[3]
NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
(PKSPROPERTY_SET) VideoStreamProperties,// StreamPropertiesArray
0, // NumStreamEventArrayEntries;
0, // StreamEventsArray;
(GUID *) &PINNAME_VIDEO_CAPTURE, // Category
(GUID *) &PINNAME_VIDEO_CAPTURE, // Name
1, // MediumsCount
&StandardMedium, // Mediums
FALSE, // BridgeStream
},
// HW_STREAM_OBJECT ------------------------------------------------
{
sizeof (HW_STREAM_OBJECT), // SizeOfThisPacket
0, // StreamNumber
0, // HwStreamExtension
VideoReceiveDataPacket, // HwReceiveDataPacket
VideoReceiveCtrlPacket, // HwReceiveControlPacket
{ NULL, 0 }, // HW_CLOCK_OBJECT
FALSE, // Dma
TRUE, // Pio
NULL, // HwDeviceExtension
sizeof (KS_FRAME_INFO), // StreamHeaderMediaSpecific
0, // StreamHeaderWorkspace
FALSE, // Allocator
NULL, // HwEventRoutine
{ 0, 0 }, // Reserved[2]
},
#ifndef TOSHIBA
},
// -----------------------------------------------------------------
// STREAM_Preview
// -----------------------------------------------------------------
{
// HW_STREAM_INFORMATION -------------------------------------------
{
1, // NumberOfPossibleInstances
KSPIN_DATAFLOW_OUT, // DataFlow
TRUE, // DataAccessible
NUM_STREAM_1_FORMATS, // NumberOfFormatArrayEntries
Stream1Formats, // StreamFormatsArray
0, // ClassReserved[0]
0, // ClassReserved[1]
0, // ClassReserved[2]
0, // ClassReserved[3]
NUMBER_VIDEO_STREAM_PROPERTIES, // NumStreamPropArrayEntries
(PKSPROPERTY_SET) VideoStreamProperties,// StreamPropertiesArray
0, // NumStreamEventArrayEntries;
0, // StreamEventsArray;
(GUID *) &PINNAME_VIDEO_PREVIEW, // Category
(GUID *) &PINNAME_VIDEO_PREVIEW, // Name
1, // MediumsCount
&StandardMedium, // Mediums
FALSE, // BridgeStream
},
// HW_STREAM_OBJECT ------------------------------------------------
{
sizeof (HW_STREAM_OBJECT), // SizeOfThisPacket
1, // StreamNumber
0, // HwStreamExtension
VideoReceiveDataPacket, // HwReceiveDataPacket
VideoReceiveCtrlPacket, // HwReceiveControlPacket
{ NULL, 0 }, // HW_CLOCK_OBJECT
FALSE, // Dma
TRUE, // Pio
0, // HwDeviceExtension
sizeof (KS_FRAME_INFO), // StreamHeaderMediaSpecific
0, // StreamHeaderWorkspace
FALSE, // Allocator
NULL, // HwEventRoutine
{ 0, 0 }, // Reserved[2]
},
},
// -----------------------------------------------------------------
// STREAM_AnalogVideoInput
// -----------------------------------------------------------------
{
// HW_STREAM_INFORMATION -------------------------------------------
{
1, // NumberOfPossibleInstances
KSPIN_DATAFLOW_IN, // DataFlow
TRUE, // DataAccessible
NUM_STREAM_2_FORMATS, // NumberOfFormatArrayEntries
Stream2Formats, // StreamFormatsArray
0, // ClassReserved[0]
0, // ClassReserved[1]
0, // ClassReserved[2]
0, // ClassReserved[3]
0, // NumStreamPropArrayEntries
0, // StreamPropertiesArray
0, // NumStreamEventArrayEntries;
0, // StreamEventsArray;
(GUID *) &PINNAME_VIDEO_ANALOGVIDEOIN, // Category
(GUID *) &PINNAME_VIDEO_ANALOGVIDEOIN, // Name
1, // MediumsCount
&CrossbarMediums[9], // Mediums
FALSE, // BridgeStream
},
// HW_STREAM_OBJECT ------------------------------------------------
{
sizeof (HW_STREAM_OBJECT), // SizeOfThisPacket
2, // StreamNumber
0, // HwStreamExtension
AnalogVideoReceiveDataPacket, // HwReceiveDataPacket
AnalogVideoReceiveCtrlPacket, // HwReceiveControlPacket
{ NULL, 0 }, // HW_CLOCK_OBJECT
FALSE, // Dma
TRUE, // Pio
0, // HwDeviceExtension
0, // StreamHeaderMediaSpecific
0, // StreamHeaderWorkspace
FALSE, // Allocator
NULL, // HwEventRoutine
{ 0, 0 }, // Reserved[2]
}
#endif//TOSHIBA
}
};
#define DRIVER_STREAM_COUNT (SIZEOF_ARRAY (Streams))
//---------------------------------------------------------------------------
// Topology
//---------------------------------------------------------------------------
// Categories define what the device does.
static const GUID Categories[] = {
#ifdef TOSHIBA
STATIC_KSCATEGORY_VIDEO,
STATIC_KSCATEGORY_CAPTURE,
#else //TOSHIBA
STATIC_KSCATEGORY_VIDEO,
STATIC_KSCATEGORY_CAPTURE,
STATIC_KSCATEGORY_TVTUNER,
STATIC_KSCATEGORY_CROSSBAR,
STATIC_KSCATEGORY_TVAUDIO
#endif//TOSHIBA
};
#define NUMBER_OF_CATEGORIES SIZEOF_ARRAY (Categories)
static KSTOPOLOGY Topology = {
NUMBER_OF_CATEGORIES, // CategoriesCount
(GUID*) &Categories, // Categories
0, // TopologyNodesCount
NULL, // TopologyNodes
0, // TopologyConnectionsCount
NULL, // TopologyConnections
NULL, // TopologyNodesNames
0, // Reserved
};
//---------------------------------------------------------------------------
// The Main stream header
//---------------------------------------------------------------------------
static HW_STREAM_HEADER StreamHeader =
{
DRIVER_STREAM_COUNT, // NumberOfStreams
sizeof (HW_STREAM_INFORMATION), // Future proofing
0, // NumDevPropArrayEntries set at init time
NULL, // DevicePropertiesArray set at init time
0, // NumDevEventArrayEntries;
NULL, // DeviceEventsArray;
&Topology // Pointer to Device Topology
};
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // __CAPSTRM_H__
| [
"[email protected]"
] | |
ccb58a9ee7391c66f1d320f5d0acbd48fc562dfd | c6aa5f5f3f08f2c4b3c0d9619ea56f15ba459cd9 | /Prototype/Prototype/src/RingBuff.h | 6b13e693d8e8fe20527efe10a7dd2d7e8d73e30a | [] | no_license | UAH-Cansat2-2019/Science-Payload | 5874924a89f3dc38b188944f08c82013ba006008 | 979af5f75f128958aa9ac274286fa251dbede389 | refs/heads/master | 2020-04-08T10:14:23.542286 | 2019-06-15T05:12:09 | 2019-06-15T05:12:09 | 159,260,116 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 461 | h | /*
* RingBuff.h
*
* Created: 5/4/2019 10:59:50 PM
* Author: natha
*/
#ifndef RINGBUFF_H_
#define RINGBUFF_H_
#define BUFSIZE 10
struct uint16RingBuff {
uint16_t * data;
uint8_t lastItem;
};
typedef struct uint16RingBuff* p_bstru;
void u16BuffInit(p_bstru * rstru);
void putu16(p_bstru d_struct,uint16_t data);
uint16_t getu16(p_bstru d_struct,int16_t index);
void array_recent(p_bstru bufStru,uint16_t * fRec,uint8_t N);
#endif /* RINGBUFF_H_ */ | [
"[email protected]"
] | |
f9c13e1b942a4306e993add84bb9454b4aecbed1 | ee7cf88c40c848d75b20136b55f7d273ce21d2f2 | /board/lars_pd/gpio.inc | e4ec89a0ba2526cbe77ccf1a4a025d429cb0fc25 | [
"BSD-3-Clause"
] | permissive | akappy7/ChromeOS_EC_LED_Diagnostics | 4e0dfbaf3103bbf8c34ab2c9a4c9c87a39cde3b8 | 73b8a148756a1aa723c8277e8475f0e43d703fbf | refs/heads/master | 2020-12-07T15:16:10.831477 | 2016-05-05T06:29:52 | 2016-05-05T06:29:52 | 57,103,470 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,760 | inc | /* -*- mode:c -*-
*
* Copyright 2015 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Interrupts */
GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(C, 14), GPIO_INT_BOTH, pd_vbus_evt_p0)
/* PD RX/TX */
GPIO(USB_C0_CC1_PD, PIN(A, 2), GPIO_ANALOG)
GPIO(USB_C_REF, PIN(A, 1), GPIO_ANALOG)
GPIO(USB_C0_CC2_PD, PIN(A, 4), GPIO_ANALOG)
GPIO(USB_C0_CC1_TX_DATA, PIN(B, 4), GPIO_INPUT)
GPIO(USB_C0_CC2_TX_DATA, PIN(A, 6), GPIO_INPUT)
GPIO(USB_PD_VBUS_WAKE, PIN(C, 13), GPIO_INPUT)
GPIO(PP3300_USB_PD_EN, PIN(A, 15), GPIO_OUT_HIGH)
GPIO(USB_C0_CC1_VCONN1_EN, PIN(B, 1), GPIO_OUT_LOW)
GPIO(USB_C0_CC2_VCONN1_EN, PIN(B, 2), GPIO_OUT_LOW)
GPIO(USB_C0_HOST_HIGH, PIN(A, 3), GPIO_OUT_LOW)
GPIO(USB_C0_CC1_ODL, PIN(A, 11), GPIO_ODR_LOW)
GPIO(USB_C0_CC2_ODL, PIN(A, 12), GPIO_ODR_LOW)
/*
* I2C pins should be configured as inputs until I2C module is
* initialized. This will avoid driving the lines unintentionally.
*/
GPIO(SLAVE_I2C_SCL, PIN(B, 6), GPIO_INPUT)
GPIO(SLAVE_I2C_SDA, PIN(B, 7), GPIO_INPUT)
GPIO(EC_INT, PIN(A, 14), GPIO_OUT_HIGH)
UNIMPLEMENTED(WP_L)
UNIMPLEMENTED(ENTERING_RW)
#if 0
/* Alternate functions */
GPIO(USB_C0_TX_CLKOUT, PIN(B, 8), GPIO_OUT_LOW)
GPIO(USB_C0_TX_CLKIN, PIN(B, 3), GPIO_OUT_LOW)
#endif
ALTERNATE(PIN_MASK(B, 0x0008), 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */
ALTERNATE(PIN_MASK(B, 0x0100), 2, MODULE_USB_PD, 0) /* TIM16_CH1: PB8 */
ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, 0) /* USART1: PA9/PA10 */
ALTERNATE(PIN_MASK(B, 0x00c0), 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */
| [
"[email protected]"
] | |
47241b41efc39d5462ac24039a9d50304011f594 | bb52bb55548d0720dedb1ad1ecc50776bf4ed9f5 | /schedule_data.c | 6a0836d0744e9703e5bf7abc27ccdebb7dba96b1 | [] | no_license | suokun/important_datastructure_in_Xen | 6b976a2a2637469fdac31258d3048f106f166bc3 | 7dd533e6149d06add066674ed8d2a1e9c32725c9 | refs/heads/master | 2021-01-19T10:49:11.909496 | 2015-09-30T02:43:54 | 2015-09-30T02:43:54 | 26,688,489 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 924 | c | //defined in include/xen/sched-if.h
/*
* In order to allow a scheduler to remap the lock->cpu mapping,
* we have a per-cpu pointer, along with a pre-allocated set of
* locks. The generic schedule init code will point each schedule lock
* pointer to the schedule lock; if the scheduler wants to remap them,
* it can simply modify the schedule locks.
*
* For cache betterness, keep the actual lock in the same cache area
* as the rest of the struct. Just have the scheduler point to the
* one it wants (This may be the one right in front of it).*/
struct schedule_data {
spinlock_t *schedule_lock,
_lock;
struct vcpu *curr; /* current task */
void *sched_priv;
struct timer s_timer; /* scheduling timer */
atomic_t urgent_count; /* how many urgent vcpus */
};
| [
"[email protected]"
] | |
8e6cf465c5a4fa724637840ca2492d774cc74830 | d5448f8c84b45b5d9636259bfb20d32775525e99 | /Project/STM32F4xx_StdPeriph_Examples/RTC/RTC_TimeStamp/stm32f4xx_it.c | df2706dde57646d139d08d694e0b80cd46ce7d0e | [] | no_license | lvniqi/STM32F4xx_DSP_StdPeriph_Lib_V1.3.0 | 1f83b88c33d5fa3a1ddebddc49d8b50263d49c6d | 44ca8109a9679aa408028299fcd259cc101f314c | refs/heads/master | 2021-01-10T07:38:47.295522 | 2015-10-28T16:51:57 | 2015-10-28T16:51:57 | 31,595,388 | 1 | 1 | null | null | null | null | UTF-8 | C | false | false | 5,901 | c | /**
******************************************************************************
* @file RTC/RTC_TimeStamp/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.3.0
* @date 13-November-2013
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
#include "main.h"
/** @addtogroup STM32F4xx_StdPeriph_Examples
* @{
*/
/** @addtogroup RTC_TimeStamp
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
uint32_t count = 0;
/* 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)
{
}
/******************************************************************************/
/* 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_stm32f40xx.s/startup_stm32f427x.s). */
/******************************************************************************/
/**
* @brief This function handles External line 0 interrupt request.
* @param None
* @retval None
*/
void EXTI0_IRQHandler(void)
{
/* Clear the TimeStamp registers */
if(EXTI_GetITStatus(WAKEUP_BUTTON_EXTI_LINE) != RESET)
{
/* Clear the Wakeup Button EXTI line pending bit */
EXTI_ClearITPendingBit(WAKEUP_BUTTON_EXTI_LINE);
/* Turn LED1 ON and LED2 OFF */
STM_EVAL_LEDOn(LED1);
STM_EVAL_LEDOff(LED2);
/* Clear The TSF Flag (Clear TimeStamp Registers) */
RTC_ClearFlag(RTC_FLAG_TSF);
LCD_ClearLine(LCD_LINE_2);
LCD_ClearLine(LCD_LINE_3);
LCD_ClearLine(LCD_LINE_8);
LCD_ClearLine(LCD_LINE_9);
LCD_ClearLine(LCD_LINE_10);
LCD_DisplayStringLine(LCD_LINE_3,(uint8_t *) "TimeStamp Event Cleared " );
}
}
/**
* @brief This function handles External lines 15 to 10 interrupt request.
* @param None
* @retval None
*/
void EXTI15_10_IRQHandler(void)
{
/* TimeStamp Event detected */
if(EXTI_GetITStatus(TAMPER_BUTTON_EXTI_LINE) != RESET)
{
count++;
/* Turn on LED2 and off LED1 */
STM_EVAL_LEDOn(LED2);
STM_EVAL_LEDOff(LED1);
/* LCD display */
LCD_ClearLine(LCD_LINE_2);
LCD_DisplayStringLine(LCD_LINE_3,(uint8_t *) "TimeStamp Event Occurred " );
/* Display the TimeStamp */
RTC_TimeStampShow();
/* Display the date */
RTC_DateShow();
/* Display the Time */
RTC_TimeShow();
/* Clear the TAMPER Button EXTI line pending bit */
EXTI_ClearITPendingBit(TAMPER_BUTTON_EXTI_LINE);
}
}
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| [
"[email protected]"
] | |
22beded1d8f8e0786aaa07275fd61a747ac9b0ef | c80614aeba1cc4164116964c0bdd146320fdb1f5 | /test/valid/mutual_recursion.c | 30bdb191bc94a2a8f2c95d5a879bb88acfc1771d | [
"Apache-2.0"
] | permissive | hoangpq/crust | 507436ae89f3f01e8d7529ce28aa0fcb29866d59 | 7da5688d9d5c5e44809b22911e5ba22fcca7cba1 | refs/heads/master | 2020-05-05T13:09:11.720909 | 2019-04-08T01:54:10 | 2019-04-08T01:54:10 | 180,062,725 | 1 | 0 | Apache-2.0 | 2019-04-08T03:29:11 | 2019-04-08T03:29:11 | null | UTF-8 | C | false | false | 214 | c | int main() {
return foo(5);
}
int foo(int a) {
if (a <= 0) {
return a;
}
return a + bar(a - 1);
}
int bar(int b) {
if (b <= 0) {
return b;
}
return b + bar(b / 2);
}
| [
"[email protected]"
] | |
e0904caf00db530b6c70b651e3ddbb44c4766230 | 0715947bc62b39a5a1d0049f2b159cf671c64997 | /user_process_kill/ci-hunter/ldasm.h | cb9c9224916810e19ac3036f5e9b1ba45ba6e1e9 | [] | no_license | sonwnja/kernel_delete_terminate | 12f9a28d1845a88d5781bee1dab96059392303de | 7bfb3402561a38dc78ca56220df6eeb4f8fb02e8 | refs/heads/main | 2022-12-28T08:43:04.962140 | 2020-10-12T02:14:35 | 2020-10-12T02:14:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 561 | h | #ifndef _LDASM_
#define _LDASM_
#include <stdint.h>
#define F_INVALID 0x01
#define F_PREFIX 0x02
#define F_REX 0x04
#define F_MODRM 0x08
#define F_SIB 0x10
#define F_DISP 0x20
#define F_IMM 0x40
#define F_RELATIVE 0x80
typedef struct _ldasm_data{
uint8_t flags;
uint8_t rex;
uint8_t modrm;
uint8_t sib;
uint8_t opcd_offset;
uint8_t opcd_size;
uint8_t disp_offset;
uint8_t disp_size;
uint8_t imm_offset;
uint8_t imm_size;
} ldasm_data;
unsigned int ldasm(void *code, ldasm_data *ld, uint32_t is64);
#endif /* _LDASM_ */
| [
"[email protected]"
] | |
3d8c2b3b2205bfb1e9cb8e05cf5ab26b4df6b1b1 | 76e07d3e6c025251cfcdfb459dd2c8bffb8e5f2b | /BSP-3.14/local_src/common/ltp_guf_tests/testcases/v4l2capture/framebuffer.h | 0b12d4af28c0b55c0bff4b2ea9ab4aed51c7d492 | [
"MIT"
] | permissive | DYNA-instruments-open-source/eco-g45-linux-bsp | fdfab1baf13716222ecfeb5c365cf819b4b79cc5 | c465c1e89c086ca6d42056c90b9eb177e778c1e1 | refs/heads/master | 2021-01-10T23:14:02.413921 | 2016-10-31T09:10:47 | 2016-10-31T09:10:47 | 70,607,352 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,593 | h | /******************************************************************************/
/* Copyright (C) 2011 Garz & Fricke GmbH */
/* No use or disclosure of this information in any form without */
/* the written permission of the author */
/******************************************************************************/
/******************************************************************************/
/* */
/* File: framebuffer.h */
/* */
/* Description: Header for the framebuffer module. */
/* */
/* Author: Carsten Behling <[email protected]> */
/* */
/******************************************************************************/
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include "v4l2capture.h"
extern char *conf_device_name_fb;
extern void *framebuffer;
extern int framebuffer_size;
extern struct fb_fix_screeninfo fixed_info;
extern struct fb_var_screeninfo var_info;
extern error_t open_framebuffer_device(void);
extern error_t init_framebuffer_device(void);
extern error_t uninit_framebuffer_device(void);
extern error_t close_framebuffer_device(void);
extern error_t switch_framebuffer(unsigned int buffer);
#endif /* FRAMEBUFFER_H */ | [
"[email protected]"
] | |
faac40e934ea064e41aa0eb5545c4e4d830ff538 | 754da994f390b233a49f16e62b1e8ae8f73b745b | /rpi/main.c | e2bb50080aa0db4d5e8270945938d532e0e6f5bb | [] | no_license | zenhack/nosix | bf5803237d2f6689b6fe9eea1d6567527c8e8704 | 750f6875325ef1aa04a5719dcf14f8b224f837c0 | refs/heads/master | 2023-09-03T21:49:20.957772 | 2013-08-28T03:48:04 | 2013-08-28T03:48:04 | 12,327,479 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 21 | c |
void main(void) {
}
| [
"[email protected]"
] | |
bb50ccfbf1b1d92091e4664c00635a86a5f36271 | b1d500a451cd9852089bf3d97e829df069daa9c8 | /Images/MC/Acceptance/truth/CorrectionResults/S12S18_HistAcceptanceWeightingVsMomentum.C | 5313dd20c9f8a65ec0d202a6c2fd8b9d269ed72a | [] | no_license | sam-grant/EDM | 486ea029bf766c968a3c7b41198ffcf9bc3c9b8a | 525e41de5f675c39014488c79144f47562910736 | refs/heads/master | 2022-10-30T22:35:42.979799 | 2022-10-19T18:44:54 | 2022-10-19T18:44:54 | 296,421,806 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 2,176 | c | void S12S18_HistAcceptanceWeightingVsMomentum()
{
//=========Macro generated from canvas: c/c
//========= (Wed May 4 12:58:04 2022) by ROOT version 6.24/06
TCanvas *c = new TCanvas("c", "c",0,0,800,600);
c->SetHighLightColor(2);
c->Range(0,0,1,1);
c->SetFillColor(0);
c->SetBorderMode(0);
c->SetBorderSize(2);
c->SetFrameBorderMode(0);
TH1D *S12S18_ratio__3 = new TH1D("S12S18_ratio__3","S12S18",7,750,2500);
S12S18_ratio__3->SetBinContent(1,0.528873);
S12S18_ratio__3->SetBinContent(2,0.5106426);
S12S18_ratio__3->SetBinContent(3,0.5456977);
S12S18_ratio__3->SetBinContent(4,0.5706427);
S12S18_ratio__3->SetBinContent(5,0.4231863);
S12S18_ratio__3->SetBinContent(6,0.6972563);
S12S18_ratio__3->SetBinContent(7,0.4321457);
S12S18_ratio__3->SetBinError(1,0.04150351);
S12S18_ratio__3->SetBinError(2,0.03907641);
S12S18_ratio__3->SetBinError(3,0.03875816);
S12S18_ratio__3->SetBinError(4,0.04001415);
S12S18_ratio__3->SetBinError(5,0.04168765);
S12S18_ratio__3->SetBinError(6,0.05597023);
S12S18_ratio__3->SetBinError(7,0.05700849);
S12S18_ratio__3->SetEntries(7);
S12S18_ratio__3->SetStats(0);
S12S18_ratio__3->SetLineWidth(3);
S12S18_ratio__3->GetXaxis()->SetTitle("Decay vertex momentum [MeV]");
S12S18_ratio__3->GetXaxis()->CenterTitle(true);
S12S18_ratio__3->GetXaxis()->SetLabelFont(42);
S12S18_ratio__3->GetXaxis()->SetTitleSize(0.04);
S12S18_ratio__3->GetXaxis()->SetTitleOffset(1.1);
S12S18_ratio__3->GetXaxis()->SetTitleFont(42);
S12S18_ratio__3->GetYaxis()->SetTitle("Vertical angle acceptance weighting / 250 MeV");
S12S18_ratio__3->GetYaxis()->CenterTitle(true);
S12S18_ratio__3->GetYaxis()->SetNdivisions(4000510);
S12S18_ratio__3->GetYaxis()->SetLabelFont(42);
S12S18_ratio__3->GetYaxis()->SetTitleSize(0.04);
S12S18_ratio__3->GetYaxis()->SetTitleOffset(1.1);
S12S18_ratio__3->GetYaxis()->SetTitleFont(42);
S12S18_ratio__3->GetZaxis()->SetLabelFont(42);
S12S18_ratio__3->GetZaxis()->SetTitleOffset(1);
S12S18_ratio__3->GetZaxis()->SetTitleFont(42);
S12S18_ratio__3->Draw("E");
c->Modified();
c->cd();
c->SetSelected(c);
}
| [
"[email protected]"
] | |
47169fecfc4136000ab846c4691e552b9ecd38ef | ae3f0e25bbbe1f646ae170c4bca029c101cd7dd6 | /weather_station/fb_app_ws.h | 5cb88d29958e69f06956d9caad1a90f5af0b56f0 | [] | no_license | proj2012/software-incubation | ba97073db457200fe84f364e7a7bca0d63daf98d | ec0be2bad5a3821f64d2ac96ac297dcc8dd02481 | refs/heads/master | 2020-06-13T15:53:19.340033 | 2017-02-14T21:03:11 | 2017-02-14T21:03:11 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C | false | false | 2,689 | h | /*
* __________ ________________ __ _______
* / ____/ __ \/ ____/ ____/ __ )/ / / / ___/
* / /_ / /_/ / __/ / __/ / __ / / / /\__ \
* / __/ / _, _/ /___/ /___/ /_/ / /_/ /___/ /
* /_/ /_/ |_/_____/_____/_____/\____//____/
*
* Copyright (c) 2013 Andreas Krieger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef FB_APP_LC
#define FB_APP_LC
#ifdef LPC936
#include <fb_lpc936_1.55.h>
#else
#include <fb_lpc922_1.55.h>
#endif
// Parameter-Adressen im EEPROM
// Adressen zum speichern von Applikations Daten
#define PORTSAVE 0x99 // Portzustände
#define TIMERANZ 0x04 // timeranzahl
#define REFRESH \
//P0= oldportbuffer; // refresh des Portzustandes in der hal
// für astabile Relaise
// SPI Konfiguration
#define IDATA_START 0xFE-37
extern __bit portchanged;// globale variable, sie ist 1 wenn sich portbuffer geändert hat
extern unsigned char portbuffer;
extern const unsigned int timerflagmask[];
extern const unsigned char bitmask_1[];
extern const unsigned char bitmask_0[];
extern const unsigned char shift_at_2bit[];
extern unsigned char __idata __at IDATA_START+21 stream[];
extern unsigned char stream_ptr;
extern unsigned char stream_bit_ctr;
extern __bit stream_comming_in;
extern __bit stream_arrived;
extern unsigned int updated_objects;
extern unsigned short __idata __at IDATA_START+13 wind_angle;
extern volatile unsigned char precounter0;
extern volatile unsigned char precounter1;
extern volatile unsigned char precounter2;
extern unsigned char debugport;
void keypad_isr (void) __interrupt (7);
void timer0_int(void) __interrupt (1);
void EX0_int (void) __interrupt(0);
void keypad_init(void);
__bit checksume(unsigned char package_nomber); // prüft die checksume,gibt 1 zurück wenn ok.
int eis5conversion(signed int zahl);
void delay_timer(void); // zählt alle 130ms die Variable Timer hoch und prüft Queue
void bus_return(void); // Aktionen bei Busspannungswiederkehr
void restart_app(void); // Alle Applikations-Parameter zurücksetzen
unsigned long read_obj_value(unsigned char objno); // gibt den Wert eines Objektes konvertiert zurueck
int read_obj_data(unsigned char objno);// gibt den Wert eines Objektes in Rohdaten zurueck
void write_obj_value(unsigned char objno,unsigned int objvalue); // schreibt den aktuellen Wert eines Objektes ins 'USERRAM'
void update(void);
void sendbychange(unsigned char objno,unsigned char val);
void write_send(unsigned char objno,unsigned int value);
#endif
| [
"[email protected]"
] | |
225abe9f754ef9f66ef388fb9e0f390aec822680 | c8cb6e273dd396be7ff00976e59ce55d9c132439 | /822 - Exame/822 - Exame.c | e398b2f18e766b74d24860d5b9969b8930ce5f93 | [] | no_license | The-Vitruvians/Reaper | e7cc915bbd819e9cd74e06ca81d2599a4a2d70ee | cfb1f552c87ccf4fcbea24c9b7a076227d8ee9bc | refs/heads/master | 2020-03-10T19:54:56.033721 | 2018-04-14T22:23:34 | 2018-04-14T22:23:34 | 128,146,140 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 190 | c | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int D, P, U, N;
scanf("%d %d %d %d", &D, &P, &U, &N);
printf("%d", D+U+N);
return 0;
} | [
"[email protected]"
] | |
c9026d9a9dab1dc3debfe88f8c6716f5f4cf35cc | 3d018912dbf4ebd229aa42e06ec58e733aac75eb | /fy3/d/fy/npc/scavenger.c | 91574ce3be19ccf4f6e25ca0ef648a09c3989b44 | [] | no_license | 15831944/FengYun2020 | 93fd7657a5d924e975771c6da83e3baca8c70795 | 81c0551fad5a77084df80165d45892717d2b7c28 | refs/heads/main | 2023-03-17T20:59:26.566095 | 2021-01-02T20:06:59 | 2021-01-02T20:06:59 | null | 0 | 0 | null | null | null | null | GB18030 | C | false | false | 1,383 | c | // scavenger.c
inherit NPC;
void create()
{
set_name("收破烂的", ({ "scavenger" }) );
set("gender", "男性" );
set("age", 47);
set("long", "这个人不但自己收破烂,身上也穿得破烂不堪。\n");
set("combat_exp", 10);
set_temp("kf_tufei",47);
set("pursuer", 1);
set("str", 27);
set("force", 30);
set("max_force", 30);
set("force_factor", 1);
setup();
set("chat_chance", 20);
set("chat_msg", ({
"收破烂的吆喝道:收~破~烂~哪~\n",
"收破烂的嘴里嘟哝著,不知道说些什麽。\n",
"收破烂的伸手捉住了身上的□子,一脚踩得扁扁的。 \n",
(: random_move :)
}) );
carry_object(__DIR__"obj/old_book2");
add_money("coin", 5);
}
int accept_object(object me, object obj)
{
object bonus;
if( obj->name() != "纯金叶子")
{ command("smile");
command("say 多谢这位" + RANK_D->query_respect(me) + "!");
return 1;
}
else
{
command("smile");
command("say 多谢这位" + RANK_D->query_respect(me)
+"!小的没有别的,给你一个小玩意!\n\n你得到一枚石棋");
bonus = new("/questobj/sq");
bonus->move(this_player());
return 1;
}
}
int accept_fight(object me)
{
command("say " + RANK_D->query_respect(me) + "饶命!小的这就离开!\n");
return 0;
}
| [
"[email protected]"
] | |
7bb20d5d0c8620c008c2a380dfe357b0a9ccc3c2 | be3d7c318d79cd33d306aba58a1159147cac91fd | /modules/hyperfun/src/hfcylinderx.c | 1c56e1e7a0eab3719d13b0f58c6b42ebd114a49a | [] | no_license | knicos/Cadence | 827149b53bb3e92fe532b0ad4234b7d0de11ca43 | 7e1e1cf1bae664f77afce63407b61c7b2b0a4fff | refs/heads/master | 2020-05-29T13:19:07.595099 | 2011-10-31T13:05:48 | 2011-10-31T13:05:48 | 1,238,039 | 2 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,271 | c | /*==============================================================================
Copyright 1998, 1999 Valery Adzhiev, Alexander Pasko, Ken Yoshikawa
Copyright 2003-2004 Benjamin Schmitt
This Work or file is part of the greater total Work, software or group of
files named HyperFun Polygonizer.
HyperFun Polygonizer can be redistributed and/or modified under the terms
of the CGPL, The Common Good Public License as published by and at CGPL.org
(http://CGPL.org). It is released under version 1.0 Beta of the License
until the 1.0 version is released after which either version 1.0 of the
License, or (at your option) any later version can be applied.
THIS WORK, OR SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED (See the
CGPL, The Common Good Public License for more information.)
You should have received a copy of the CGPL along with HyperFun Polygonizer;
if not, see - http://CGPL.org to get a copy of the License.
==============================================================================*/
/*
Core HyperFun Library
Primitive: Cylinder with x-axis
Definition: R^2-(y-y0)^2-(z-z0)^2
Call: hfCylinderX(x,center,R);
Parameters:
x - point coordinates array
center - sphere center array
R - cylinder radius
Test file: cylinder.hpf
C-parameters:
f_a[0] corresponds to R
f_a[1] corresponds to array center
f_a[2] corresponds to array x
Code by: Pasko, Adzhiev
Last revised: 5.8.98
*/
#include "general.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
extern int HF_Get_Runtime_Array(int index, double** array, int* size);
void HF_Fill_Error(PN_T* p_pn, int er_index, Error_Info_T* EI, int ic);
extern double EPS;
double hfCylinderX(double* f_a, String_Array_T* str_param)
{
double R,/*xt,*/yt,zt,f;
double* x;
double* center;
int array_index, dim;
R = f_a[0];
array_index = (int)f_a[1];
HF_Get_Runtime_Array(array_index, ¢er, &dim);
array_index = (int)f_a[2];
HF_Get_Runtime_Array(array_index, &x, &dim);
if (dim != 3)
return -1111111111111.0;
yt=x[1]-center[1];
zt=x[2]-center[2];
f = R*R - yt*yt - zt*zt;
return f;
}
| [
"nick@viglab-14.(none)"
] | nick@viglab-14.(none) |
55ffc243c807559f15cfad20ff43c00e44f6e278 | 5f456d162db494ae0fa76294e7f435aaa2ca4a68 | /libMachO/Core/Memory/memory_object.h | 92e50581e3169abff079206c28cd1435f4179033 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | iT0ny/MachO-Kit | 6032238837b8c7cce7ff92774450473ebc79c0be | 74c9fd3f128deaa24ad52941408b9511da149d69 | refs/heads/master | 2021-01-17T22:07:16.831423 | 2015-02-09T04:29:43 | 2015-02-09T04:29:43 | 30,690,259 | 1 | 0 | null | 2015-02-12T07:06:30 | 2015-02-12T07:06:30 | null | UTF-8 | C | false | false | 7,213 | h | //----------------------------------------------------------------------------//
//|
//| MachOKit - A Lightweight Mach-O Parsing Library
//! @file memory_object.h
//!
//! @author D.V.
//! @copyright Copyright (c) 2014-2015 D.V. All rights reserved.
//|
//| Permission is hereby granted, free of charge, to any person obtaining a
//| copy of this software and associated documentation files (the "Software"),
//| to deal in the Software without restriction, including without limitation
//| the rights to use, copy, modify, merge, publish, distribute, sublicense,
//| and/or sell copies of the Software, and to permit persons to whom the
//| Software is furnished to do so, subject to the following conditions:
//|
//| The above copyright notice and this permission notice shall be included
//| in all copies or substantial portions of the Software.
//|
//| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
//| OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
//| MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
//| IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
//| CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
//| TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
//| SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
//! @defgroup MEMORY_OBJECT Memory Object
//! @ingroup MEMORY
//----------------------------------------------------------------------------//
#ifndef _memory_object_h
#define _memory_object_h
//! @addtogroup MEMORY_OBJECT
//! @{
//!
//----------------------------------------------------------------------------//
#pragma mark - Types
//! @name Types
//----------------------------------------------------------------------------//
//◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦//
//! @internal
//
typedef struct mk_memory_object_s {
__MK_RUNTIME_BASE
// A pointer back to the memory map that initialized this object.
struct mk_memory_map_s *mapping;
// The context-relative address of the mapped memory.
mk_vm_address_t context_address;
// The in-memory address at which the target address has been mapped.
vm_address_t address;
// The total requested length of the mapping. This value is the literal
// requested length.
vm_size_t length;
// Implementation specific.
intptr_t reserved1;
intptr_t reserved2;
} mk_memory_object_t;
//◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦◦//
//! The Memory Object polymorphic type.
//
typedef union {
mk_type_ref type;
struct mk_memory_object_s *memory_object;
} mk_memory_object_ref __attribute__((__transparent_union__));
//----------------------------------------------------------------------------//
#pragma mark - Instance Methods
//! @name Instance Methods
//----------------------------------------------------------------------------//
//! Returns the base process-relative address of \a mobj.
//!
//! @param mobj
//! An initialized memory object.
_mk_export vm_address_t
mk_memory_object_address(mk_memory_object_ref mobj);
//! Returns the length of \a mobj.
//!
//! @param mobj
//! An initialized memory object.
_mk_export vm_size_t
mk_memory_object_length(mk_memory_object_ref mobj);
//! Returns the base context-relative address of \a mobj.
//!
//! @param mobj
//! An initialized memory object.
_mk_export mk_vm_address_t
mk_memory_object_base_address(mk_memory_object_ref mobj);
//! Verifies that \a length bytes starting at the process relative
//! (\a address + \a offset) is within \a mobj's mapped range.
//!
//! @param mobj
//! An initialized memory object.
//! @param address
//! A process-relative address.
//! @param offset
//! An offset to be applied to \a address prior to verifying the
//! address range.
//! @param length
//! The number of bytes that should be readable at
//! \a address + \a offset.
_mk_export bool
mk_memory_object_verify_local_pointer(mk_memory_object_ref mobj, vm_offset_t offset, vm_address_t address, vm_size_t length, mk_error_t* error);
//! Validates the availability of (\a address + \a offset) via \a mobj and
//! returns a pointer to the memory that is accessible from this process.
//!
//! @param mobj
//! An initialized memory object.
//! @param address
//! The base context-relative address to be read.
//! @param offset
//! An offset to be applied to \a address prior to verifying the
//! address range.
//! @param length
//! The total number of bytes that should be readable at \a address.
_mk_export vm_address_t
mk_memory_object_remap_address(mk_memory_object_ref mobj, mk_vm_offset_t offset, mk_vm_address_t address, mk_vm_size_t length, mk_error_t* error);
//! The reverse of the remap operation, verifies the process-relative \a address
//! then converts it into an address relative to the originating memory map.
//!
//! @param mobj
//! An initialized memory object.
//! @param address
//! The base process-relative address to be unmapped.
//! @param offset
//! An offset to be applied to \a address prior to verifying the
//! address range.
//! @param length
//! The total number of bytes that should be readable at \a address.
_mk_export mk_vm_address_t
mk_memory_object_unmap_address(mk_memory_object_ref mobj, vm_offset_t offset, vm_address_t address, vm_size_t length, mk_error_t* error);
//! Returns the byte at \a offset + \a address in \a mobj, performing
//! any necessary byte-swapping.
_mk_export uint8_t
mk_memory_object_read_byte(mk_memory_object_ref mobj, mk_vm_offset_t offset, mk_vm_address_t address, mk_data_model_ref data_model, mk_error_t *error);
//! Returns the word at \a offset + \a address in \a mobj, performing
//! any necessary byte-swapping.
_mk_export uint16_t
mk_memory_object_read_word(mk_memory_object_ref mobj, mk_vm_offset_t offset, mk_vm_address_t address, mk_data_model_ref data_model, mk_error_t *error);
//! Returns the dword at \a offset + \a address in \a mobj, performing
//! any necessary byte-swapping.
_mk_export uint32_t
mk_memory_object_read_dword(mk_memory_object_ref mobj, mk_vm_offset_t offset, mk_vm_address_t address, mk_data_model_ref data_model, mk_error_t *error);
//! Returns the dword at \a offset + \a address in \a mobj, performing
//! any necessary byte-swapping.
_mk_export uint64_t
mk_memory_object_read_qword(mk_memory_object_ref mobj, mk_vm_offset_t offset, mk_vm_address_t address, mk_data_model_ref data_model, mk_error_t *error);
//! @} MEMORY_OBJECT !//
#endif /* _memory_object_h */
| [
"[email protected]"
] | |
4285971eaea59b97c224c489fd0e7e0c1f1db54c | fd24fefa199630d6db15ee63181ee08660ca756a | /srcs/my_puthexamaj.c | 4b468269cdd5943b903eedab83bf8526b8b3c130 | [] | no_license | Srywards/MatchStick | 347d8b04317b9742003a7c4ea96ab36aee2179b3 | 4c39f769c6ff54fa6faf783d1a59789e38f5dfb7 | refs/heads/master | 2021-09-15T02:47:39.333387 | 2018-05-24T12:51:56 | 2018-05-24T12:51:56 | 119,555,140 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 571 | c | /*
** my_put_nbr.c for my_put_nbr in /home/da-pur_c/rendu/Piscine_C_J03
**
** Made by Clément DA PURIFICACAO
** Login <[email protected]>
**
** Started on Tue Oct 6 13:24:09 2015 Clément DA PURIFICACAO
** Last update Mon Nov 21 14:58:48 2016 Clem Da
*/
#include "my.h"
void my_hexamaj(int nb)
{
int res;
int div;
int i;
char *base;
base = "0123456789ABCDEF";
i = my_strlen(base);
div = 1;
while ((nb / div) >= i)
div = div * i;
while (div > 0)
{
res = (nb /div) % i;
my_putchar(base[res]);
div = div / i;
}
}
| [
"[email protected]"
] | |
fe37d688ed3d82be84b5095b5f44aac46141cb66 | a364f5e25e4ec3563c2a6e366069488786927948 | /sys/dev/pci/pciidereg.h | 84b31f66b7bc1ca1781804818659d85a9d8d39b6 | [] | no_license | noud/mouse-bsd | b044db5ba4085794b94ea729eb4148e1c86d73b5 | a16ee9b253dbd25c931216ef9be36611fb847411 | refs/heads/main | 2023-02-24T06:22:20.517329 | 2020-08-25T20:21:40 | 2020-08-25T20:21:40 | 334,500,331 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,320 | h | /* $NetBSD: pciidereg.h,v 1.4 1999/02/02 16:14:00 bouyer Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. 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 Christopher G. Demetriou
* for the NetBSD Project.
* 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.
*/
/*
* PCI IDE controller register definitions.
*
* Author: Christopher G. Demetriou, March 2, 1998.
*
* See "PCI IDE Controller Specification, Revision 1.0 3/4/94" and
* "Programming Interface for Bus Master IDE Controller, Revision 1.0
* 5/16/94" from the PCI SIG.
*/
/*
* Number of channels per chip. MUST NOT CHANGE (macros in pciide.c and
* this file depend on its value).
*/
#define PCIIDE_NUM_CHANNELS 2
/*
* PCI base address register locations (some are per-channel).
*/
#define PCIIDE_REG_CMD_BASE(chan) (0x10 + (8 * (chan)))
#define PCIIDE_REG_CTL_BASE(chan) (0x14 + (8 * (chan)))
#define PCIIDE_REG_BUS_MASTER_DMA 0x20
/*
* Bits in the PCI Programming Interface register (some are per-channel).
* Bits 6-4 are defined as read-only in PCI 2.1 specification.
* Microsoft proposed to use these bits for independant channels
* enable/disable. This feature is enabled based on the value of bit 6.
*/
#define PCIIDE_CHANSTATUS_EN 0x40
#define PCIIDE_CHAN_EN(chan) (0x20 >> (chan))
#define PCIIDE_INTERFACE_PCI(chan) (0x01 << (2 * (chan)))
#define PCIIDE_INTERFACE_SETTABLE(chan) (0x02 << (2 * (chan)))
#define PCIIDE_INTERFACE_BUS_MASTER_DMA 0x80
/*
* Compatibility address/IRQ definitions (some are per-channel).
*/
#define PCIIDE_COMPAT_CMD_BASE(chan) ((chan) == 0 ? 0x1f0 : 0x170)
#define PCIIDE_COMPAT_CMD_SIZE 8
#define PCIIDE_COMPAT_CTL_BASE(chan) ((chan) == 0 ? 0x3f6 : 0x376)
#define PCIIDE_COMPAT_CTL_SIZE 1
#define PCIIDE_COMPAT_IRQ(chan) ((chan) == 0 ? 14 : 15)
/*
* definitions for IDE DMA
* XXX maybe this should go elsewhere
*/
/* secondary channel registers offset */
#define IDEDMA_SCH_OFFSET 0x08
/* Bus master command register */
#define IDEDMA_CMD 0x00
#define IDEDMA_CMD_WRITE 0x08
#define IDEDMA_CMD_START 0x01
/* Bus master status register */
#define IDEDMA_CTL 0x02
#define IDEDMA_CTL_DRV_DMA(d) (0x20 << (d))
#define IDEDMA_CTL_INTR 0x04
#define IDEDMA_CTL_ERR 0x02
#define IDEDMA_CTL_ACT 0x01
/* Bus master table pointer register */
#define IDEDMA_TBL 0x04
#define IDEDMA_TBL_MASK 0xfffffffc
#define IDEDMA_TBL_ALIGN 0x00010000
/* bus master table descriptor */
struct idedma_table {
u_int32_t base_addr; /* physical base addr of memory region */
u_int32_t byte_count; /* memory region length */
#define IDEDMA_BYTE_COUNT_MASK 0x0000FFFF
#define IDEDMA_BYTE_COUNT_EOT 0x80000000
};
#define IDEDMA_BYTE_COUNT_MAX 0x00010000 /* Max I/O per table */
#define IDEDMA_BYTE_COUNT_ALIGN 0x00010000
/* Number of idedma table needed */
#define NIDEDMA_TABLES (MAXPHYS/NBPG + 1)
| [
"[email protected]"
] | |
1e08fc584c01de727cfde16d4d83ee6b0a74404e | a29cf1ddb29ff32c8782dbac1561d158e3a5118f | /ip/cmd_for/f5.c | 6a1b4fa394976ebfe00f2dd4f94e23c896bd7ab1 | [] | no_license | mariocesarf/PastaLeane | 9cdf0b0a27b7c734dd2a04570876023aa49e8cd9 | c86eb4f325e794c0677f2be508dc57981551e587 | refs/heads/master | 2023-06-06T23:20:28.193681 | 2021-07-04T21:48:26 | 2021-07-04T21:48:26 | 382,953,766 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 906 | c | #include <stdio.h>
#include <stdlib.h>
int main()
{
int numero;
int pares = 0, impares = 0;
int soma_pares = 0, soma_impares = 0, soma_arit = 0;
float media_pares = 0, media_impares = 0, media_arit = 0;
printf("Digite 10 numeros inteiros:\n");
for (int i = 0; i < 10; i++)
{
scanf("%d", &numero);
if (numero % 2 == 0)
{
pares++;
soma_pares = soma_pares + numero;
}
else
{
impares++;
soma_impares = soma_impares + numero;
}
soma_arit = soma_arit + numero;
}
media_pares = (float)soma_pares / pares;
media_impares = (float)soma_impares / impares;
media_arit = soma_arit / 10.0;
printf("Quantidade de pares= %d, Quantidade de impares= %d \n", pares, impares);
printf("Media dos pares= %.2f \n", media_pares);
printf("Media dos impares= %.2f \n", media_impares);
printf("Media aritmetica= %.2f", media_arit);
return 0;
}
| [
"[email protected]"
] | |
f376131d94cdfbfb5b2b54becf07de50be35f54c | 0f2e08cbbef0c05c70518df8cad012b5eb5e02b3 | /MC/lng1.h | 0afaabedba075689546efe5cc801ea4e52e0cf76 | [] | no_license | FTCr/sie-elf | fc216ee25dbaa0aebe4cf072b3d778a4d378bc6c | ad9d69759692aeb1c9b731c2e3498a942f4e6b34 | refs/heads/master | 2021-01-22T10:14:58.588076 | 2013-10-25T09:29:04 | 2013-10-25T09:29:04 | 13,273,863 | 1 | 2 | null | null | null | null | WINDOWS-1251 | C | false | false | 11,399 | h | #ifndef _LNG_H
#define _LNG_H
#define psz_savestate "Запоминать последнее состояние"
#define psz_backexit "В корне панелей: назад = выход"
#define psz_sconchk "Двигать курсор при выделении"
#define psz_free_png "Чистить png-кеш после выхода"
#define psz_show_ext "Показывать расширения у файлов"
#define psz_gui "GUI"
#define psz_font_setup "Настройки шрифта"
#define psz_font "Шрифты"
#define psz_font_head "Шрифт заголовока"
#define psz_font_soft "Шрифт софт-надписей"
#define psz_font_list "Шрифт файловых панелей"
#define psz_font_menunv "Шрифт меню"
#define psz_font_menuv "Шрифт выделеного пункта меню"
#define psz_font_prop "Шрифт в окнах свойств"
#define psz_font_msg "Шрифт в диалоговых окнах"
#define psz_scspeed "Скорость скроллинга"
#define psz_scwait "Задержка перед скроллингом"
#define psz_scrl_step "Шаг скроллинга"
#define psz_menu_opt "Настройки меню"
#define psz_savepoz "Сохр.поз.курс.в меню"
#define psz_softhead "Софт-надписи/заголовки"
#define psz_soft_on "Выводить софт-надписи"
#define psz_time_on "Отображать время"
#define psz_soft_smes "Смещение софт-надписей"
#define psz_put_in_head "Выводить путь в шапке"
#define psz_grafik_patch "Путь к графике"
#define psz_pp_cur "Полупрозрачный курсор"
#define psz_iconbar "Отображать иконбар"
#define psz_arc "Архивы"
#define psz_7z "7z"
#define psz_enable_7z "Поддержка 7z"
#define psz_detect_by "Определять формат по"
#define psz_jar_zip "*.jar > архив"
#define psz_sdt_zip "*.sdt > архив"
#define psz_opt_open "Ассоциации"
#define psz_music_on_elfpleer "Ассоциировать с плеерами"
#define psz_elfview "Путь к эльфу просмотрщику"
#define psz_loadicons "Загружать файл иконок"
#define psz_loadkeys "Загружать файл клавиш"
#define psz_loadmui "Загружать файл языка"
#define psz_loadcs "Загружать цветовую схему"
#define psz_configpath "Путь к файлу mcconfig.cfg"
#define psz_showhidden "Показывать скрытые файлы"
#define psz_showsystem "Показывать системные файлы"
#define psz_showhiddrv "Показывать системные диски"
#define psz_showmmc "Показывать карту памяти"
#define psz_confirmexit "При выходе"
#define psz_confirmdel "При удалении"
#define psz_confirmdelr "При RO удалении"
#define psz_confirmcopy "При копировании"
#define psz_confirmmove "При перемещении"
#define psz_confirmrepl "При замене"
#define psz_autoexit_after "Авто выход после (мин)"
#define psz_autoexit_on_background "Включить авто выход"
#define psz_zip_enable "Поддержка zip"
#define psz_temppath "Временная папка"
#define psz_cleartemp "Очищать временную папку"
#define psz_autors "© 2009 weclnt, greengo7, miha_r, Faust\n(r) Aru55, 1nvisible, captain_SISka, Vados"
#define psz_content "Содержимому"
#define psz_extension "Расширению"
#define psz_drv_0 "Data"
#define psz_drv_1 "Cache"
#define psz_drv_2 "Config"
#ifdef ELKA
#define psz_drv_4 "MicroSD"
#else
#define psz_drv_4 "MMC"
#endif
#define sz_mcvol "Закладки"
#define sz_mcsearch "Поиск"
#define psz_errfile "?"
#define psz_sm_common "Общее"
#define psz_sm_confirms "Подтверждения"
#define psz_sm_configs "Конфигурация"
#define psz_sm_disks "Диски и файлы"
#define psz_sm_gui "Текст"
#define psz_sm_autoexit "Авто выход"
#define psz_sm_zip "Zip"
#define sz_no "Нет"
#define sz_yes "Да"
#define sz_byte "б"
#define sz_kbyte "Кб"
#define sz_mbyte "Мб"
#define sz_gbyte "Гб"
#define sz_reconfig "Конфигурация обновлена!"
#define sz_lng "Язык"
#define sz_lngname "Русский"
#define sz_dirmking "Создание папок"
#define sz_copying "Копирование"
#define sz_moveing "Перемещение"
#define sz_deling "Удаление"
#define sz_empty "<Пусто>"
#define sz_pos "Размещение"
#define sz_mcmenu "Меню"
#define sz_select "Выбор"
#define sz_back "Назад"
#define sz_open "Открыть"
#define sz_altopen "Открыть с..."
#define sz_bt "Передача..."
#define sz_natexpl "Проводник"
#define sz_keyhelp "Наз. клавишь"
#define sz_file_m "Файл..."
#define sz_chk "Выделить"
#define sz_chkall "Выделить все"
#define sz_invchk "Инвертировать"
#define sz_unchall "Сбросить все"
#define sz_oper_m "Операции..."
#define sz_past "Вставить"
#define sz_cancel "Отменить"
#define sz_copy "Копировать"
#define sz_move "Переместить"
#define sz_del "Удалить"
#define sz_rename "Переименовать"
#define sz_newdir "Новая папка"
#define sz_newfile "Новый файл"
#define sz_prop "Атрибуты"
#define sz_view_m "Вид..."
#define sz_sort_m "Сортировка..."
#define sz_sortn "По имени"
#define sz_sorte "По типу"
#define sz_sorts "По размеру"
#define sz_sortd "По дате"
#define sz_sortr "Обратная"
#define sz_filter "Фильтр"
#define sz_refresh "Обновить"
#define sz_misc_m "Разное..."
#define sz_bm_m "Закладки..."
#define sz_add "Добавить"
#define sz_bml "Список"
#define sz_drvinf "Диски"
#define sz_settings "Настройки"
#define sz_about_m "Об эльфе..."
#define sz_exit "Выход"
#define sz_bm "Закладка"
#define sz_name "Имя"
#define sz_fullname "Полное имя"
#define sz_fullpatch "Полный путь"
#define sz_size "Размер"
#define sz_global "Общий"
#define sz_folders "Папок"
#define sz_files "Файлов"
#define sz_date "Cоздан"
#define sz_attr "Атрибуты"
#define sz_readonly "Только чтение"
#define sz_hidden "Скрытый"
#define sz_system "Системный"
#define sz_arh "Архивный"
#define sz_subdirs "Обр. подкаталоги"
#define sz_ncsize "Несжатый"
#define sz_csize "Сжатый"
#define sz_cglobal "Об. сжатый"
#define sz_pmt_del "Удалить?"
#define sz_pmt_rodel "Файл %s только для чтения. Удалить?"
#define sz_pmt_copy "Копировать?"
#define sz_pmt_move "Переместить?"
#define sz_pmt_stop "Прервать?"
#define sz_pmt_cancel "Очистить буфер?"
#define sz_pmt_exists "Файл %s существует. Заменить?"
#define sz_pmt_exit "Выйти из MC?"
#define sz_pmt_impcs "Применить цветовую схему?"
#define sz_pmt_implg "Применить язык?"
#define sz_err_attrset "Не удалось задать атрибуты!"
#define sz_err_makedir "Не удалось создать папку!"
#define sz_err_rename "Не удалось переименовать!"
#define sz_err_delete "Не удалось удалить!"
#define sz_err_badname_t "Неверное имя: %t"
#define sz_err_baddrv_t "Неверный диск! %t"
#define sz_err_resnok "Выполнено с ошибками!"
#define sz_err_nofiles "Нет файлов!"
#define sz_err_badname "Неверное имя!"
#define sz_err_badkey "Ошибка конфигурации кнопок!"
#define sz_err_badformat "Неверный формат или файл поврежден!"
#define sz_err_nomemory "Недостаточно оперативной памяти!"
#define sz_err_makefile "Не удалось создать новый файл!"
#define sz_err_ziperr "Ошибка Zip: %d в %t!"
#define sz_msg_zreading "Чтение архива"
#define sz_msg_showhid_files "Показывать скрытые файлы"
#define sz_msg_showsys_files "Показывать системные файлы"
#define sz_msg_showhidsys_files "Показывать скрытые и системные файлы"
#define sz_msg_showhid_drv "Показывать скрытые диски"
#define sz_drv_driver "Диск"
#define sz_drv_all "Всего"
#define sz_drv_free "Свободно"
#define sz_drv_percent "Проценты"
#define sz_ok "Ok"
#define sz_cncl "Отмена"
#define sz_time "Время"
#define sz_resol "Разрешение"
#define sz_artist "Исполнитель"
#define sz_title "Название"
#define sz_album "Альбом"
#define sz_year "Год"
#define sz_bitrate "Битрейт"
#define sz_treak "Трек"
#define sz_coment "Жанр"
#define sz_viz "Отображение"
#define sz_hid_file "Скрытые файлы"
#define sz_sys_file "Сист. файлы"
#define sz_hid_drv "Скрытые диски"
#define sz_do_arch "Архивация"
#define sz_create "Создать..."
#define sz_find "Поиск"
#define sz_arch "Архив"
#define sz_pass "Пароль"
#define sz_arh_name "Имя архива"
#define sz_info "Информация"
#define sz_support "Подтверждение"
#define sz_drv_info "Информация о дисках"
#define sz_drv_busy "Занято"
#define sz_err_search "Поиск не дал результатов!!!"
#define sz_sys_type "Систем.файлы"
#define sz_hid_type "Скрытые файлы"
#define sz_type "Расширение"
#define sz_in "в"
#define sz_met_compres "Метод сжатия"
#define sz_no_compres "Без сжатия"
#define sz_hi_speed "Скоростной"
#define sz_default "Обычный"
#define sz_hi_compress "Максимальный"
#define sz_noadd2arh "Не удалось добавить %d файл(ов) в архив!"
#define sz_thisdir "Текущ.папка"
#define sz_getff "Слить FF"
#define sz_rec "Запись"
#define sz_set_ass "Задать как..."
#define sz_wall "Обои"
#define sz_logo "Логотип"
#define sz_ss "Заставка"
#define sz_call "Вызов"
#define sz_mess "Сообщение"
#define sz_alarm "Будильник"
#define sz_org "Органайзер"
#define sz_md5 "MD5"
#define sz_md5_file "Величина хэша"
#define sz_cmd5 "Сравнить"
#define sz_corect "Сумма совпадает!"
#define sz_no_corect "Сумма не совпадает!"
#define sz_ms "Учитывать подкаталоги?"
#define sz_not_exist "Файл/папка не существует! Удалить закладку?"
#endif
| [
"[email protected]"
] | |
0f41e7cb00cbf0bce867b6880a5f00c70554b24e | de8c0ea84980b6d9bb6e3e23b87e6066a65f4995 | /3pp/linux/include/dt-bindings/usb/pd.h | 985f2bbd4d2458beb3973971f5e412d4ea950c9a | [
"MIT",
"Linux-syscall-note",
"GPL-2.0-only"
] | permissive | eerimoq/monolinux-example-project | 7cc19c6fc179a6d1fd3ec60f383f906b727e6715 | 57c4c2928b11cc04db59fb5ced962762099a9895 | refs/heads/master | 2021-02-08T10:57:58.215466 | 2020-07-02T08:04:25 | 2020-07-02T08:04:25 | 244,144,570 | 6 | 0 | MIT | 2020-07-02T08:15:50 | 2020-03-01T12:24:47 | C | UTF-8 | C | false | false | 3,458 | h | /* SPDX-License-Identifier: GPL-2.0 */
#ifndef __DT_POWER_DELIVERY_H
#define __DT_POWER_DELIVERY_H
/* Power delivery Power Data Object definitions */
#define PDO_TYPE_FIXED 0
#define PDO_TYPE_BATT 1
#define PDO_TYPE_VAR 2
#define PDO_TYPE_APDO 3
#define PDO_TYPE_SHIFT 30
#define PDO_TYPE_MASK 0x3
#define PDO_TYPE(t) ((t) << PDO_TYPE_SHIFT)
#define PDO_VOLT_MASK 0x3ff
#define PDO_CURR_MASK 0x3ff
#define PDO_PWR_MASK 0x3ff
#define PDO_FIXED_DUAL_ROLE (1 << 29) /* Power role swap supported */
#define PDO_FIXED_SUSPEND (1 << 28) /* USB Suspend supported (Source) */
#define PDO_FIXED_HIGHER_CAP (1 << 28) /* Requires more than vSafe5V (Sink) */
#define PDO_FIXED_EXTPOWER (1 << 27) /* Externally powered */
#define PDO_FIXED_USB_COMM (1 << 26) /* USB communications capable */
#define PDO_FIXED_DATA_SWAP (1 << 25) /* Data role swap supported */
#define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */
#define PDO_FIXED_CURR_SHIFT 0 /* 10mA units */
#define PDO_FIXED_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT)
#define PDO_FIXED_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT)
#define PDO_FIXED(mv, ma, flags) \
(PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \
PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma))
#define VSAFE5V 5000 /* mv units */
#define PDO_BATT_MAX_VOLT_SHIFT 20 /* 50mV units */
#define PDO_BATT_MIN_VOLT_SHIFT 10 /* 50mV units */
#define PDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */
#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT)
#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT)
#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT)
#define PDO_BATT(min_mv, max_mv, max_mw) \
(PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) | \
PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw))
#define PDO_VAR_MAX_VOLT_SHIFT 20 /* 50mV units */
#define PDO_VAR_MIN_VOLT_SHIFT 10 /* 50mV units */
#define PDO_VAR_MAX_CURR_SHIFT 0 /* 10mA units */
#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT)
#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT)
#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT)
#define PDO_VAR(min_mv, max_mv, max_ma) \
(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \
PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))
#define APDO_TYPE_PPS 0
#define PDO_APDO_TYPE_SHIFT 28 /* Only valid value currently is 0x0 - PPS */
#define PDO_APDO_TYPE_MASK 0x3
#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT)
#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17 /* 100mV units */
#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8 /* 100mV units */
#define PDO_PPS_APDO_MAX_CURR_SHIFT 0 /* 50mA units */
#define PDO_PPS_APDO_VOLT_MASK 0xff
#define PDO_PPS_APDO_CURR_MASK 0x7f
#define PDO_PPS_APDO_MIN_VOLT(mv) \
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_VOLT(mv) \
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_CURR(ma) \
((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT)
#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \
(PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \
PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \
PDO_PPS_APDO_MAX_CURR(max_ma))
#endif /* __DT_POWER_DELIVERY_H */
| [
"[email protected]"
] | |
0d8c1dda33c9ac89c0d1ceb286ed16e57bb0c398 | 633fa19397dd46a58b39c2240c68e2bee70148b2 | /attic/chooser-fu/beaglequery.h | 0e7e82c1502220fefb6698f9100f5ccfd3985181 | [] | no_license | joeshaw/beagle | 660e25604d9faea8c4caccc9fe4cd2dc12573ecd | 67306ce5bb971ed147f263ba8104e5ba8062a899 | refs/heads/master | 2021-01-25T12:13:22.987962 | 2011-02-15T03:22:20 | 2011-02-18T04:54:06 | 190,418 | 4 | 1 | null | null | null | null | UTF-8 | C | false | false | 2,035 | h | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* beaglequery.h
*
* Copyright (C) 2004 Novell, Inc.
*
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifndef __BEAGLEQUERY_H__
#define __BEAGLEQUERY_H__
#include <glib.h>
#include <time.h>
typedef struct _BeagleHit BeagleHit;
struct _BeagleHit {
char *uri;
char *type;
char *mime_type;
char *source;
float score;
time_t timestamp;
};
void beagle_hit_free (BeagleHit *);
#define beagle_hit_get_uri(hit) ((hit)->uri)
#define beagle_hit_get_type(hit) ((hit)->type)
#define beagle_hit_get_mime_type(hit) ((hit)->mime_type)
#define beagle_hit_get_source(hit) ((hit)->source)
#define beagle_hit_get_score(hit) ((hit)->score)
#define beagle_hit_get_timestamp(hit) ((hit)->timestamp)
typedef struct _BeagleQueryResult BeagleQueryResult;
struct _BeagleQueryResult {
int count;
GSList *all;
GHashTable *by_uri;
};
void beagle_query_result_free (BeagleQueryResult *bqr);
#define beagle_query_result_get_count(bqr) ((bqr)->count)
#define beagle_query_result_get_all(bqr) ((bqr)->all)
BeagleHit *beagle_query_result_get_by_uri (BeagleQueryResult *bqr,
const char *uri);
BeagleQueryResult *beagle_query (const char *query_string);
#endif /* __BEAGLEQUERY_H__ */
| [
"[email protected]"
] | |
e5649599a46dd8ac37f46ab375731609ae0cddf9 | 15b587300d806308731d398262b17883e7bbcab7 | /Proiect_CAL.X/asw_FollowDir.c | 0b4d21779f88755e1e03f7c2816e626d901e360d | [] | no_license | TheodoraG/CAL_2019TG | 6c1cd6d156996d639caa91fc3b7cd07596b30120 | 6e21c4134472eb945cf0999b890ab148aeda2133 | refs/heads/master | 2022-05-06T09:52:44.595027 | 2022-03-10T14:58:01 | 2022-03-10T14:58:01 | 220,296,833 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 2,051 | c | #include "asw_FollowDir.h"
#include "asw_lineFoll.h"
#include"asw_move.h"
void followDir()
{ //move_forward(T_F16 speed2)(T_F16 speed2)
/*
if(asw_getLineFollowerVal()==0b100000)
move_direction(65);
else
if(asw_getLineFollowerVal()==0b000000)
move(0);
else
if(asw_getLineFollowerVal()==0b110000)
move_direction(85);
else
if(asw_getLineFollowerVal()==0b000001)
move_direction(110);
else
if(asw_getLineFollowerVal()==0b000011)
move_direction(95);
else
move_forward(20);
*/
if(asw_getLineFollowerVal()){
if(asw_getLineFollowerVal()==0b000011)
move_direction(100);
else
if(asw_getLineFollowerVal()==0b110000)
move_direction(75);
else
if(asw_getLineFollowerVal()==0b000001)
move_direction(115);
else
if(asw_getLineFollowerVal()==0b100000)
move_direction(65);
else
if(asw_getLineFollowerVal()==0b001100)
move_direction(88);
else
if(asw_getLineFollowerVal()==0b001000)
move_direction(85);
else
if(asw_getLineFollowerVal()==0b000100)
move_direction(95);
else
// if(asw_getLineFollowerVal()==0b000000)
// move(0);
// else
if(asw_getLineFollowerVal()==0b000010)
move_direction(110);
else
if(asw_getLineFollowerVal()==0b010000)
move_direction(70);
}
else{
move(0,1);
}
}
| [
"[email protected]"
] | |
fe61e1adad565338ee1104259bc1074742fe43c6 | 0744dcc5394cebf57ebcba343747af6871b67017 | /os/arch/arm/src/s5j/sss/isp_custom.h | b2016493fdd40d7076f53bb3ce66db4c331a57d6 | [
"GPL-1.0-or-later",
"BSD-3-Clause",
"ISC",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"Apache-2.0"
] | permissive | Samsung/TizenRT | 96abf62f1853f61fcf91ff14671a5e0c6ca48fdb | 1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686 | refs/heads/master | 2023-08-31T08:59:33.327998 | 2023-08-08T06:09:20 | 2023-08-31T04:38:20 | 82,517,252 | 590 | 719 | Apache-2.0 | 2023-09-14T06:54:49 | 2017-02-20T04:38:30 | C | UTF-8 | C | false | false | 29,642 | h | /*!
* @file isp_custom.h
* @brief Headerfile : util functions to support memset, memcpy, memcmp
* @author joohwani.kim
* @version v0.1 : 2017.8.24 Init. release version
*/
#ifndef ISP_CUSTOM_H_
#define ISP_CUSTOM_H_
#include "isp_oid.h"
#include "isp_define.h"
// Secure Storage
#define SECURE_STORAGE_TYPE_FACTORYKEY_KEY (0x00)
#define SECURE_STORAGE_TYPE_FACTORYKEY_DATA (0x01)
#define SECURE_STORAGE_TYPE_KEY_AES (0x0A)
#define SECURE_STORAGE_TYPE_KEY_HMAC (0x0B)
#define SECURE_STORAGE_TYPE_KEY_RSA (0x0C)
#define SECURE_STORAGE_TYPE_KEY_DH (0x0D)
#define SECURE_STORAGE_TYPE_KEY_ECC (0x0E)
#define SECURE_STORAGE_TYPE_DATA (0x10)
#define SECURE_STORAGE_TYPE_CERT (0x11)
#define FACTORYKEY_ARTIK_PSK (0x80000100)
#define FACTORYKEY_ARTIK_DEVICE (0x00010120)
#define FACTORYKEY_ARTIK_CERT (0x00010122)
// AES Mode
#define AES_ECB_MODE (0x0008)
#define AES_CBC_MODE (0x0108)
#define AES_CTR_MODE (0x0208)
#define AES_XTS_MODE (0x0308)
#define AES_CCM_MODE (0x1008)
#define AES_GCM_MODE (0x1108)
#define AES_KW_MODE (0x1208)
#define SSTORAGE_DATA_SLOT_INDEX_MAX (32)
// ======================================
// Structure
// ======================================
//! @struct sECC_KEY
//! @brief struct of ECDSA Key parameter
struct sECC_KEY {
unsigned int curve;
unsigned char *privatekey;
unsigned char *publickey_x;
unsigned char x_byte_len;
unsigned char *publickey_y;
unsigned char y_byte_len;
};
//! @struct sECC_SIGN
//! @brief struct of ECDSA Signature
struct sECC_SIGN {
unsigned int sign_type;
unsigned char *r;
unsigned char r_byte_len;
unsigned char *s;
unsigned char s_byte_len;
};
//! @struct sRSA_KEY
//! @brief struct of RSA Key parameter
struct sRSA_KEY {
unsigned int object_id;
unsigned char *modules;
unsigned int modules_byte_len;
unsigned char *publickey;
unsigned int publickey_byte_len;
unsigned char *privatekey;
};
//! @struct sRSA_SIGN
//! @brief struct of RSA Signature
struct sRSA_SIGN {
unsigned int signature_byte_len;
unsigned char *signature;
unsigned int salt_byte_len;
unsigned int alg_type;
};
//! @struct sAES_PARAM
//! @brief struct of AES parameter
struct sAES_PARAM {
unsigned char *pu8Plaintext;
unsigned int u32Plaintext_byte_len;
unsigned char *pu8Ciphertext;
unsigned int u32Ciphertext_byte_len;
unsigned char *pu8iv;
unsigned int u32iv_byte_len;
unsigned char *pu8aad;
unsigned int u32aad_byte_len;
unsigned char *pu8Tag;
unsigned int u32Tag_byte_len;
unsigned int u32Mode;
};
//! @struct sHMAC_MSG
//! @brief struct of message for HMAC
struct sHMAC_MSG {
unsigned int addr_low;
unsigned int addr_high;
unsigned int descriptor_byte_len;
unsigned int msg_byte_len;
unsigned int msg_type;
};
//! @struct sHASH_MSG
//! @brief struct of message for Hash
struct sHASH_MSG {
unsigned int addr_low;
unsigned int addr_high;
unsigned int descriptor_byte_len;
unsigned int msg_byte_len;
unsigned int msg_type;
};
//! @struct sDH_PARAM
//! @brief struct of DH parameter
struct sDH_PARAM {
unsigned int object_id;
unsigned int modules_p_byte_len;
unsigned char *modules_p;
unsigned int generator_g_byte_len;
unsigned char *generator_g;
unsigned int order_q_byte_len;
unsigned char *order_q;
unsigned int publickey_byte_len;
unsigned char *publickey;
};
// ======================================
// Function
// ======================================
/*! @fn isp_get_status()
* @ingroup SECURITY_ISP
* @brief status function
* @version v0.50 : 2016.8.13 Init. release version
* @retval SUCCESS
* @retval ERROR_SYSTEM_MAILBOX_BUSY
*/
int isp_get_status(void);
/*! @fn isp_clear(unsigned int type)
* @ingroup SECURITY_ISP
* @brief clear function
* @version v0.50 : 2016.8.13 Init. release version
* @param type clear type
* @retval SUCCESS
* @retval Others(!=0) fail - error from sub-function
*/
int isp_clear(unsigned int type);
/*! @fn isp_read_cert(unsigned char *data, unsigned int *data_byte_len, unsigned int index)
* @ingroup SECURITY_ISP
* @brief read cert function for secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[out] data : array of data
* @param[out] data_byte_len : length of data
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_read_cert(unsigned char *data, unsigned int *data_byte_len, unsigned int index);
/*! @fn isp_set_factorykey_data(unsigned char *data, unsigned int data_byte_len, unsigned int data_id)
* @ingroup SECURITY_ISP
* @brief write data function for secure storage
* @version v0.50 : 2016.12.29 Init. release version
* @param[in] data : array of data
* @param[in] data_byte_len : length of data
* @param[in] data_id : id of data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_get_factorykey_data(unsigned char *data, unsigned int *data_byte_len, unsigned int data_id);
/*! @fn isp_generate_random(unsigned int *random, unsigned int wlen)
* @ingroup SECURITY_ISP
* @brief rng function
* @version v0.50 : 2016.8.13 Init. release version
* @param[out] random : array of random number
* @param[in] wlen : word length of random number to be generated
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_generate_random(unsigned int *random, unsigned int wlen);
/*! @fn isp_ecdsa_sign_md_securekey(struct sECC_SIGN * ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief ecdsa function for generating signature
* @version v0.10 : 2016.12.23 Init. release version
* @param[out] ecc_sign : struct of signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : length of hashed_message with byte unit
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_sign_md_securekey(struct sECC_SIGN *ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index);
/*!
* @ingroup SECURITY_ISP
* @brief ecdh function for computing shared secret using secure key storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Change factorykey id parameter, Set Null input for object_id
* @param[out] shared_secret : array of shared secret
* @param[out] shared_secret_byte_len : length of shared_secret_byte_len
* @param[in] ecc_publickey : struct of ecc key
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_compute_ecdh_securekey(unsigned char *shared_secret, unsigned int *shared_secret_byte_len, struct sECC_KEY ecc_publickey, unsigned int key_index);
/*! @fn isp_write_cert(unsigned char *data, unsigned int data_byte_len, unsigned int index)
* @ingroup SECURITY_ISP
* @brief write cert function for secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] data : array of data
* @param[in] data_byte_len : length of data
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_write_storage(unsigned char *data, unsigned int data_byte_len, unsigned int index);
/*! @fn isp_read_cert(unsigned char *data, unsigned int *data_byte_len, unsigned int index)
* @ingroup SECURITY_ISP
* @brief read cert function for secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[out] data : array of data
* @param[out] data_byte_len : length of data
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_read_storage(unsigned char *data, unsigned int *data_byte_len, unsigned int index);
/*! @fn int isp_get_factorykey_data(unsigned char *data, unsigned int *data_byte_len, unsigned int data_id)
* @ingroup SECURITY_ISP
* @brief read data function for secure storage
* @version v0.50 : 2016.12.29 Init. release version
* @param[out] data : array of data
* @param[out] data_byte_len : length of data
* @param[in] data_id : id of data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_get_factorykey_data(unsigned char *data, unsigned int *data_byte_len, unsigned int data_id);
/*! @fn isp_ecdsa_get_publickey_securekey(struct sECC_KEY *ecc_publickey, unsigned int key_index, unsigned int object_id)
* @ingroup SECURITY_ISP
* @brief ecc function for get publickey to secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.23 Change factorykey id parameter, Set Null input for object_id
* @param[out] ecc_publickey : public key from slot # in secure storage
* @param[in] key_index : slot # in secure storage
* @param[in] object_id : selection of algorithm
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_get_publickey_securekey(struct sECC_KEY *ecc_publickey, unsigned int key_index, unsigned int object_id);
/*! @fn isp_aes_generate_key_securekey(unsigned int key_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief aes key generation function to store in secure storage
* @version v0.10 : 2016.7.29
* @version v0.50 : 2016.8.13 Init. release version
* @param[in] key_byte_len : byte length of key
* @param[in] key_index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_aes_generate_key_securekey(unsigned int key_byte_len, unsigned int key_index);
/*! @fn isp_hmac_generate_key_securekey(unsigned int key_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief hmac key generation function to store in secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @param[in] key_byte_len : byte length of key
* @param[in] key_index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_hmac_generate_key_securekey(unsigned int key_byte_len, unsigned int key_index);
/*! @fn isp_rsa_generate_key_securekey(unsigned key_index, unsigned object_id, unsigned int pukey_e)
* @ingroup SECURITY_ISP
* @brief rsa function for verfication of signature
* @version v0.50 : 2016.8.13 Init. release version
* @param[in] key_index : secure storage index
* @param[in] object_id : algorithm selection
* @param[in] pukey_e : input pukey under 32bits-length (if 0, pukey will be randomly generated)
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_generate_key_securekey(unsigned key_index, unsigned object_id, unsigned int pukey_e);
/*! @fn isp_ecdsa_generate_key_securekey(unsigned int key_index, unsigned int object_id)
* @ingroup SECURITY_ISP
* @brief ecdsa function for generating key to secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @param[in] key_index : slot # in secure storage
* @param[in] object_id : selection of algorithm
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_generate_key_securekey(unsigned int key_index, unsigned int object_id);
/*! @fn isp_set_securekey( unsigned char *data, unsigned int data_byte_len, unsigned int key_type, unsigned int index)
* @ingroup SECURITY_ISP
* @brief set securekey function
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] data : array of data
* @param[in] data_byte_len : length of data
* @param[in] key_type : type of key
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_set_securekey(unsigned char *data, unsigned int data_byte_len, unsigned int key_type, unsigned int index);
/*! @fn isp_remove_key(unsigned int key_type, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief delete securekey function
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.29 Use Pre-Defined Variable for the readability, Secure Storage Map
* @param[in] key_type : type of key
* @param[in] key_index: slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_remove_key(unsigned int key_type, unsigned int index);
/*! @fn isp_aes_encrypt_securekey(struct sAES_PARAM * aes_param, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief aes encryption function using securekey
* @version v0.10 : 2016.7.29
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] aes_param : struct of aes parameters
* @param[in] key_index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_aes_encrypt_securekey(struct sAES_PARAM *aes_param, unsigned int key_index);
/*! @fn isp_aes_decrypt_securekey(struct sAES_PARAM * aes_param, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief aes decryption function using securekey
* @version v0.10 : 2016.7.29
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] aes_param : struct of aes parameters
* @param[in] key_index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_aes_decrypt_securekey(struct sAES_PARAM *aes_param, unsigned int key_index);
/*! @fn isp_hmac_securekey(unsigned char * mac, struct sHMAC_MSG * hmac_msg, unsigned int object_id, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief hmac function for key stored in secure storage slot
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Set Null input for object_id
* @param[out] mac : mac output
* @param[in] hmac_msg : struct sHMAC_MSG
* @param[in] object_id : algorithm selection
* @param[in] key_index : key index
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_hmac_securekey(unsigned char *mac, struct sHMAC_MSG *hmac_msg, unsigned int object_id, unsigned int key_index);
/*! @fn isp_hash(unsigned char * hash, struct sHASH_MSG * hash_msg, unsigned int object_id)
* @ingroup SECURITY_ISP
* @brief hash function
* @version v0.50 : 2016.8.13 Init. release version
* @param[out] hash : hash output
* @param[in] hash_msg : struct of message
* @param[in] object_id : algorithm selection
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_hash(unsigned char *hash, struct sHASH_MSG *hash_msg, unsigned int object_id);
/*! @fn isp_dh_generate_keypair_userparam_securestorage(struct sDH_PARAM *i_dh_param, unsigned int dh_param_index)
* @ingroup SECURITY_ISP
* @brief dh function for generate pvkey & pukey pair from user input parameter p & g
* @version v0.50 : 2016.8.13 Init. release version
* @param[out] i_dh_param : struct of DH param = {p, g, pukey}
* @param[in] dh_param_index: slot # in secure storage for p, g, pvkey
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_dh_generate_keypair_userparam_securestorage(struct sDH_PARAM *i_dh_param, unsigned int dh_param_index);
/*! @fn isp_dh_compute_shared_secret_securekey(unsigned char *shared_secret, struct sDH_KEY* dh_publickey, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief dh function for compute shared secret
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Set Null input for object_id
* @param[out] shared_secret : array of shared secret
* @param[in] dh_publickey : struct of DH publickey
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_dh_compute_shared_secret_securekey(unsigned char *shared_secret, unsigned int *shared_secret_byte_len, struct sDH_PARAM dh_publickey, unsigned int key_index);
/*! @fn isp_rsa_decrypt_securekey(unsigned char *output, unsigned int *output_byte_len, unsigned char *input, unsigned int input_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief rsa function for decryption using securekey
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Change factorykey id parameter, Set Null input for object_id
* @param[out] output : array of output message
* @param[out] output_byte_len : length of output message
* @param[in] input : array of input message
* @param[in] input_byte_len : length of input message
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_decrypt_securekey(unsigned char *output, unsigned int *output_byte_len, unsigned char *input, unsigned int input_byte_len, unsigned int key_index);
/*! @fn isp_rsa_encrypt_securekey(unsigned char *output, unsigned char *input, unsigned int input_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief rsa function for encryption using securekey
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Change factorykey id parameter, Set Null input for object_id
* @param[out] output : array of output message
* @param[in] input : array of input message
* @param[in] input_byte_len : length of input message
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_encrypt_securekey(unsigned char *output, unsigned int *output_byte_len, unsigned char *input, unsigned int input_byte_len, unsigned int key_index);
/*! @fn isp_rsa_sign_md_securekey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief rsa function for generating signature using securekey
* @version v0.10 : 2016.12.23 Init. release version
* @param[in] rsa_sign : struct of rsa signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : byte length of hashed_message
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_sign_md_securekey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index);
/*! @fn isp_rsa_verify_md_securekey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief rsa function for verification of signature using securekey
* @version v0.10 : 2016.12.23 Init. release version
* @param[in] rsa_sign : struct of rsa signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : byte length of hashed_message
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_verify_md_securekey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index);
/*! @fn isp_ecdsa_verify_md_securekey(struct sECC_SIGN * ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief ecdsa function for generating signature
* @version v0.10 : 2016.12.23 Init. release version
* @param[out] ecc_sign : struct of signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : length of hashed_message with byte unit
* @param[in] key_index : slot # in secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_verify_md_securekey(struct sECC_SIGN *ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index);
/*! @fn isp_write_cert(unsigned char *data, unsigned int data_byte_len, unsigned int index)
* @ingroup SECURITY_ISP
* @brief write cert function for secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] data : array of data
* @param[in] data_byte_len : length of data
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_write_cert(unsigned char *data, unsigned int data_byte_len, unsigned int index);
/*! @fn isp_read_cert(unsigned char *data, unsigned int *data_byte_len, unsigned int index)
* @ingroup SECURITY_ISP
* @brief read cert function for secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[out] data : array of data
* @param[out] data_byte_len : length of data
* @param[in] index : slot index of secure storage
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_read_cert(unsigned char *data, unsigned int *data_byte_len, unsigned int index);
/*!
* @ingroup SECURITY_ISP
* @brief ecdsa function for generating key to secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @param[in] object_id : selection of algorithm
* @param[out] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_generate_key_encryptedkey(unsigned int object_id, unsigned char *encryptedkey);
/*!
* @ingroup SECURITY_ISP
* @brief ecc function for get publickey to secure storage
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.23 Change factorykey id parameter, Set Null input for object_id
* @param[out] ecc_publickey : public key from slot # in secure storage
* @param[in] object_id : selection of algorithm
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_get_publickey_encryptedkey(struct sECC_KEY *ecc_publickey, unsigned int object_id, unsigned char *encryptedkey);
/*!
* @ingroup SECURITY_ISP
* @brief ecdh function for computing shared secret using userkey input
* @version v0.00 : 2017.1.19 Init. release version
* @param[out] shared_secret : array of shared secret
* @param[out] shared_secret_byte_len : length of shared_secret_byte_len
* @param[in] ecc_publickey : struct of ecc key
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_compute_ecdh_encryptedkey(unsigned char *shared_secret, unsigned int *shared_secret_byte_len, struct sECC_KEY ecc_publickey, unsigned char *encryptedkey);
/*!
* @ingroup SECURITY_ISP
* @brief dh function for generate pvkey & pukey pair from user input parameter p & g
* @version v0.50 : 2016.8.13 Init. release version
* @param[out] i_dh_param : struct of DH param = {p, g, pukey}
* @param[out] encryptedkey : encrypted key for p, g, pvkey
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_dh_generate_keypair_userparam_encryptedkey(struct sDH_PARAM *i_dh_param, unsigned char *encryptedkey);
/*!
* @ingroup SECURITY_ISP
* @brief dh function for compute shared secret
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Set Null input for object_id
* @param[out] shared_secret : array of shared secret
* @param[in] dh_publickey : struct of DH publickey
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_dh_compute_shared_secret_encryptedkey(unsigned char *shared_secret, unsigned int *shared_secret_byte_len, struct sDH_PARAM dh_publickey, unsigned char *encryptedkey);
/*!
* @ingroup SECURITY_ISP
* @brief set securekey function
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.51 : 2016.12.29 Use Pre-Defined Variable for the readability
* @param[in] data : array of data
* @param[in] data_byte_len : length of data
* @param[in] key_type : type of key
* @param[out] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_set_encryptedkey(unsigned char *key, unsigned int key_byte_len, unsigned int key_type, unsigned char *encryptedkey);
/*! @fn isp_ecdsa_verify_md_securekey(struct sECC_SIGN * ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief ecdsa function for generating signature
* @version v0.10 : 2016.12.23 Init. release version
* @param[out] ecc_sign : struct of signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : length of hashed_message with byte unit
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_ecdsa_verify_md_encryptedkey(struct sECC_SIGN *ecc_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned char *encryptedkey);
/*! @fn isp_rsa_verify_md_encryptedkey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned char *encryptedkey)
* @ingroup SECURITY_ISP
* @brief rsa function for verification of signature using securekey
* @version v0.10 : 2016.12.23 Init. release version
* @param[in] rsa_sign : struct of rsa signature
* @param[in] msg_digest : array of hashed_message
* @param[in] msg_digest_byte_len : byte length of hashed_message
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_verify_md_encryptedkey(struct sRSA_SIGN *rsa_sign, unsigned char *msg_digest, unsigned int msg_digest_byte_len, unsigned char *encryptedkey);
/*! @fn isp_rsa_encrypt_encryptedkey(unsigned char *output, unsigned char *input, unsigned int input_byte_len, unsigned int key_index)
* @ingroup SECURITY_ISP
* @brief rsa function for encryption using securekey
* @version v0.50 : 2016.8.13 Init. release version
* @version v0.60 : 2016.12.27 Change factorykey id parameter, Set Null input for object_id
* @param[out] output : array of output message
* @param[in] input : array of input message
* @param[in] input_byte_len : length of input message
* @param[in] encryptedkey : encrypted key data
* @retval SUCCESS : Success
* @retval Others(!=0) : fail - error from sub-function
*/
int isp_rsa_encrypt_encryptedkey(unsigned char *output, unsigned int *output_byte_len, unsigned char *input, unsigned int input_byte_len, unsigned char *encryptedkey);
#endif /* ISP_CUSTOM_H_ */
| [
"[email protected]"
] | |
259335d4afada461c345339f3e892df6c7fd7da2 | 9d9e4088862468b4ff8baf38431e603b101c02ef | /3D RUN/3DRun/Classes/Native/mscorlib_System_Reflection_MonoProperty_Getter_2_gen.h | 062fb22cdff9b80151f2c55be1c5c05af4243ff4 | [] | no_license | jmh6672/Run_3D | 22ca1ba59b8d7fe567df3781a31b80b28788e3aa | f72d30ce5ffbe493020a92b105a59c0fe348f747 | refs/heads/master | 2021-09-14T00:17:56.572759 | 2018-02-13T08:59:05 | 2018-02-13T08:59:05 | 115,467,966 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 452 | h | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
// System.Object
struct Object_t;
// System.IAsyncResult
struct IAsyncResult_t73;
// System.AsyncCallback
struct AsyncCallback_t74;
#include "mscorlib_System_MulticastDelegate.h"
// System.Reflection.MonoProperty/Getter`2<System.Object,System.Object>
struct Getter_2_t3039 : public MulticastDelegate_t72
{
};
| [
""
] | |
1182b152dd964988852a9b356308aec7ef6e8cf9 | c369112ef0c35ba28b6ecc495a3168d5518ac367 | /Magic/include/test2.h | 79198fd7b721135a3b3f6311bbb2dc985fcf4df5 | [] | no_license | windwing2016/MyMagic | b38ba547f5b19d323a26a69a34cea8b50c2b9824 | 1e799bfd7ec0e061564f6103a96b3514851a19c3 | refs/heads/master | 2021-01-10T02:18:46.723331 | 2016-03-24T13:30:33 | 2016-03-24T13:30:33 | 49,501,915 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 46 | h | #ifndef TEST2
#define TEST2
#endif // TEST2
| [
"[email protected]"
] | |
bf4a1e43beb71710f56c949d04c6ae4ae9e07989 | 2dad0794c2a35801d3cc4678ff7e595b3df3ccf3 | /src/remote-control/main/include/battery.h | 0adbb8ce4695a22dc61d188ed463b618359e554a | [
"MIT"
] | permissive | Marsu31/HomeAutomation-RemoteControl | ba544dbf60f711f3de0b4e1ea1087fe362f47102 | 4ff10daae5fbef2668d7238fcdc9180a7cfc1e0f | refs/heads/master | 2020-04-01T02:30:59.494289 | 2019-11-18T21:05:12 | 2019-11-18T21:05:12 | 152,782,258 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 270 | h | /*
* battery.h
*
* Created on: 11 nov. 2019
* Author: gabe
*/
#ifndef MAIN_INCLUDE_BATTERY_H_
#define MAIN_INCLUDE_BATTERY_H_
#include "freertos/FreeRTOS.h"
void init_battery();
BaseType_t init_battery_check_timer();
#endif /* MAIN_INCLUDE_BATTERY_H_ */
| [
"[email protected]"
] | |
950c8177ce95abbdb7079f93db103208cc731923 | 4ae150e065aa853efbc2e822aac534a72e75805a | /y.tab.h | 2e4528cfb8b50909d36bc84265db9fae284e5746 | [] | no_license | cstefann/lfachmwrk | 8b0c389198baf1d21d345384f6788730b9157f9b | ec927301cb25a573eea36611511e25d7875b6425 | refs/heads/master | 2022-04-01T07:54:52.380825 | 2020-01-06T13:29:58 | 2020-01-06T13:29:58 | 230,783,392 | 0 | 1 | null | null | null | null | UTF-8 | C | false | false | 3,514 | h | /* A Bison parser, made by GNU Bison 3.5. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Undocumented macros, especially those whose name start with YY_,
are private implementation details. Do not rely on them. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
ID = 258,
STARTCLASS = 259,
ENDCLASS = 260,
STARTFCT = 261,
ENDFCT = 262,
BGIN = 263,
END = 264,
VARS = 265,
FCT = 266,
CLASS = 267,
NR = 268,
String = 269,
LOOP = 270,
TIP = 271,
ARRAYTYPE = 272,
STARTSTR = 273,
ENDSTR = 274,
CHARTYPE = 275,
RET = 276,
ASSIGN = 277,
PLUS = 278,
OR = 279,
AND = 280,
MULTIPLY = 281,
DIVIDE = 282,
MODULO = 283,
MINUS = 284,
CONCAT = 285,
LENGTH = 286,
DECL = 287,
FUNC = 288,
CTRL = 289,
LOOPF = 290,
LOOPW = 291,
OPR = 292
};
#endif
/* Tokens. */
#define ID 258
#define STARTCLASS 259
#define ENDCLASS 260
#define STARTFCT 261
#define ENDFCT 262
#define BGIN 263
#define END 264
#define VARS 265
#define FCT 266
#define CLASS 267
#define NR 268
#define String 269
#define LOOP 270
#define TIP 271
#define ARRAYTYPE 272
#define STARTSTR 273
#define ENDSTR 274
#define CHARTYPE 275
#define RET 276
#define ASSIGN 277
#define PLUS 278
#define OR 279
#define AND 280
#define MULTIPLY 281
#define DIVIDE 282
#define MODULO 283
#define MINUS 284
#define CONCAT 285
#define LENGTH 286
#define DECL 287
#define FUNC 288
#define CTRL 289
#define LOOPF 290
#define LOOPW 291
#define OPR 292
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 13 "hmwrk.y"
int intval;
char* strval;
#line 136 "y.tab.h"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */
| [
"[email protected]"
] | |
f3d2a8706666c090530ed3b52e524fba751f2310 | 441f1d69b8dc09d769645c670d20edeb78714c2b | /include/config.h | a81ecbc03e4fbdb7027859c6af9f8e1a27db133d | [
"NTP"
] | permissive | aosm/ntp | fa0f7d764793b112440b9159774721a3aca58938 | 4f74cd7e007a808da6e0e5a9ec7858ec82a37e53 | refs/heads/master | 2023-08-28T08:48:46.140856 | 2014-10-31T07:59:14 | 2014-10-31T07:59:14 | 8,970,226 | 1 | 0 | null | null | null | null | UTF-8 | C | false | false | 35,711 | h | #include <TargetConditionals.h>
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#define AC_APPLE_UNIVERSAL_BUILD 1
/* Is adjtime() accurate? */
/* #undef ADJTIME_IS_ACCURATE */
/* CHU audio/decoder? */
/* #undef AUDIO_CHU */
/* Declare char *sys_errlist array */
/* #undef CHAR_SYS_ERRLIST */
/* ACTS modem service */
#define CLOCK_ACTS 1
/* Arbiter 1088A/B GPS receiver */
#define CLOCK_ARBITER 1
/* ARCRON support? */
#define CLOCK_ARCRON_MSF 1
/* Austron 2200A/2201A GPS receiver? */
#define CLOCK_AS2201 1
/* PPS interface? */
#define CLOCK_ATOM 1
/* Datum/Bancomm bc635/VME interface? */
/* #undef CLOCK_BANC */
/* Chronolog K-series WWVB receiver? */
#define CLOCK_CHRONOLOG 1
/* CHU modem/decoder */
#define CLOCK_CHU 1
/* Diems Computime Radio Clock? */
/* #undef CLOCK_COMPUTIME */
/* Datum Programmable Time System? */
#define CLOCK_DATUM 1
/* ELV/DCF7000 clock? */
/* #undef CLOCK_DCF7000 */
/* Dumb generic hh:mm:ss local clock? */
#define CLOCK_DUMBCLOCK 1
/* Forum Graphic GPS datating station driver? */
#define CLOCK_FG 1
/* TrueTime GPS receiver/VME interface? */
/* #undef CLOCK_GPSVME */
/* Heath GC-1000 WWV/WWVH receiver? */
#define CLOCK_HEATH 1
/* HOPF 6021 clock? */
/* #undef CLOCK_HOPF6021 */
/* HOPF PCI clock device? */
#define CLOCK_HOPF_PCI 1
/* HOPF serial clock device? */
#define CLOCK_HOPF_SERIAL 1
/* HP 58503A GPS receiver? */
#define CLOCK_HPGPS 1
/* IRIG audio decoder? */
/* #undef CLOCK_IRIG */
/* JJY receiver? */
#define CLOCK_JJY 1
/* Rockwell Jupiter GPS clock? */
/* #undef CLOCK_JUPITER */
/* Leitch CSD 5300 Master Clock System Driver? */
#define CLOCK_LEITCH 1
/* local clock reference? */
#define CLOCK_LOCAL 1
/* Meinberg clocks */
/* #undef CLOCK_MEINBERG */
/* Magnavox MX4200 GPS receiver */
/* #undef CLOCK_MX4200 */
/* NeoClock4X */
#define CLOCK_NEOCLOCK4X 1
/* NMEA GPS receiver */
#define CLOCK_NMEA 1
/* Motorola UT Oncore GPS */
/* #undef CLOCK_ONCORE */
/* Palisade clock */
#define CLOCK_PALISADE 1
/* PARSE driver interface */
/* #undef CLOCK_PARSE */
/* Conrad parallel port radio clock */
#define CLOCK_PCF 1
/* PCL 720 clock support */
/* #undef CLOCK_PPS720 */
/* PST/Traconex 1020 WWV/WWVH receiver */
#define CLOCK_PST 1
/* DCF77 raw time code */
/* #undef CLOCK_RAWDCF */
/* RCC 8000 clock */
/* #undef CLOCK_RCC8000 */
/* RIPE NCC Trimble clock */
/* #undef CLOCK_RIPENCC */
/* Schmid DCF77 clock */
/* #undef CLOCK_SCHMID */
/* clock thru shared memory */
#define CLOCK_SHM 1
/* Spectracom 8170/Netclock/2 WWVB receiver */
#define CLOCK_SPECTRACOM 1
/* KSI/Odetics TPRO/S GPS receiver/IRIG interface */
/* #undef CLOCK_TPRO */
/* Trimble GPS receiver/TAIP protocol */
/* #undef CLOCK_TRIMTAIP */
/* Trimble GPS receiver/TSIP protocol */
/* #undef CLOCK_TRIMTSIP */
/* Kinemetrics/TrueTime receivers */
#define CLOCK_TRUETIME 1
/* TrueTime 560 IRIG-B decoder? */
/* #undef CLOCK_TT560 */
/* Ultralink M320 WWVB receiver? */
#define CLOCK_ULINK 1
/* VARITEXT protocol */
/* #undef CLOCK_VARITEXT */
/* WHARTON 400A Series protocol */
/* #undef CLOCK_WHARTON_400A */
/* WWV audio driver */
/* #undef CLOCK_WWV */
/* Zyfer GPStarplus */
#define CLOCK_ZYFER 1
/* Enable ntpd debugging code? */
#define DEBUG 1
/* Enable processing time debugging? */
/* #undef DEBUG_TIMING */
/* Declaration style */
/* #undef DECL_ADJTIME_0 */
/* Declaration style */
/* #undef DECL_BCOPY_0 */
/* Declaration style */
/* #undef DECL_BZERO_0 */
/* Declaration style */
/* #undef DECL_CFSETISPEED_0 */
/* Declare errno? */
/* #undef DECL_ERRNO */
/* Declaration style */
/* #undef DECL_HSTRERROR_0 */
/* Declare h_errno? */
#define DECL_H_ERRNO 1
/* Declaration style */
/* #undef DECL_INET_NTOA_0 */
/* Declaration style */
/* #undef DECL_IOCTL_0 */
/* Declaration style */
/* #undef DECL_IPC_0 */
/* Declaration style */
/* #undef DECL_MEMMOVE_0 */
/* Declaration style */
/* #undef DECL_MKSTEMP_0 */
/* Declaration style */
/* #undef DECL_MKTEMP_0 */
/* Declaration style */
/* #undef DECL_NLIST_0 */
/* Declaration style */
/* #undef DECL_PLOCK_0 */
/* Declaration style */
/* #undef DECL_RENAME_0 */
/* Declaration style */
/* #undef DECL_SELECT_0 */
/* Declaration style */
/* #undef DECL_SETITIMER_0 */
/* Declaration style */
/* #undef DECL_SETPRIORITY_0 */
/* Declaration style */
/* #undef DECL_SETPRIORITY_1 */
/* Declaration style */
/* #undef DECL_SIGVEC_0 */
/* Declaration style */
/* #undef DECL_STDIO_0 */
/* Declaration style */
/* #undef DECL_STIME_0 */
/* Declaration style */
/* #undef DECL_STIME_1 */
/* Declaration style */
/* #undef DECL_STRERROR_0 */
/* Declaration style */
/* #undef DECL_STRTOL_0 */
/* Declare syscall()? */
/* #undef DECL_SYSCALL */
/* Declaration style */
/* #undef DECL_SYSLOG_0 */
/* Declaration style */
/* #undef DECL_TIMEOFDAY_0 */
/* Declaration style */
/* #undef DECL_TIME_0 */
/* Declaration style */
/* #undef DECL_TOLOWER_0 */
/* Declaration style */
/* #undef DECL_TOUPPER_0 */
/* What is the fallback value for HZ? */
#define DEFAULT_HZ 100
/* Directory separator character, usually / or \\ */
#define DIR_SEP '/'
/* use old autokey session key behavior? */
/* #undef DISABLE_BUG1243_FIX */
/* synch TODR hourly? */
/* #undef DOSYNCTODR */
/* The number of minutes in a DST adjustment */
#define DSTMINUTES 60
/* fopen(3) accepts a 'b' in the mode flag */
#define FOPEN_BINARY_FLAG "b"
/* fopen(3) accepts a 't' in the mode flag */
#define FOPEN_TEXT_FLAG "t"
/* Force deferred DNS lookups? */
/* #undef FORCE_DEFER_DNS */
/* force ntpdate to step the clock if !defined(STEP_SLEW) ? */
/* #undef FORCE_NTPDATE_STEP */
/* What is getsockname()'s socklen type? */
#define GETSOCKNAME_SOCKLEN_TYPE socklen_t
/* Do we have a routing socket (struct rt_msghdr)? */
#define HAS_ROUTING_SOCKET 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
/* Do we have audio support? */
/* #undef HAVE_AUDIO */
/* Define to 1 if you have the <bstring.h> header file. */
/* #undef HAVE_BSTRING_H */
/* Define to 1 if you have the `canonicalize_file_name' function. */
/* #undef HAVE_CANONICALIZE_FILE_NAME */
/* Do we have the CIOGETEV ioctl (SunOS, Linux)? */
/* #undef HAVE_CIOGETEV */
/* Define to 1 if you have the `clock_gettime' function. */
/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the `clock_settime' function. */
/* #undef HAVE_CLOCK_SETTIME */
/* Define to 1 if you have the `daemon' function. */
/* #undef HAVE_DAEMON */
/* Define this if /dev/zero is readable device */
#define HAVE_DEV_ZERO 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Use Rendezvous/DNS-SD registration */
/* #undef HAVE_DNSREGISTRATION */
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
/* #undef HAVE_DOPRNT */
/* Can we drop root privileges? */
/* #undef HAVE_DROPROOT */
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `finite' function. */
#define HAVE_FINITE 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the `getbootfile' function. */
/* #undef HAVE_GETBOOTFILE */
/* Define to 1 if you have the `getclock' function. */
/* #undef HAVE_GETCLOCK */
/* Define to 1 if you have the `getdtablesize' function. */
#define HAVE_GETDTABLESIZE 1
/* Define to 1 if you have the `getifaddrs' function. */
#define HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getpassphrase' function. */
/* #undef HAVE_GETPASSPHRASE */
/* Define to 1 if you have the `getrusage' function. */
#define HAVE_GETRUSAGE 1
/* Define to 1 if you have the `getuid' function. */
#define HAVE_GETUID 1
#if !TARGET_OS_EMBEDDED
/* Define to 1 if you have the <histedit.h> header file. */
#define HAVE_HISTEDIT_H 1
#endif
/* Define to 1 if you have the <history.h> header file. */
/* #undef HAVE_HISTORY_H */
/* Define to 1 if you have the `hstrerror' function. */
#define HAVE_HSTRERROR 1
/* Obvious... */
#define HAVE_HZ_IN_STRUCT_CLOCKINFO 1
/* Define to 1 if you have the <ieeefp.h> header file. */
/* #undef HAVE_IEEEFP_H */
/* have iflist_sysctl? */
#define HAVE_IFLIST_SYSCTL 1
/* inline keyword or macro available */
#define HAVE_INLINE 1
/* Define to 1 if the system has the type `int16_t'. */
#define HAVE_INT16_T 1
/* Define to 1 if the system has the type `int32_t'. */
#define HAVE_INT32_T 1
/* Define to 1 if the system has the type `int8_t'. */
#define HAVE_INT8_T 1
/* Define to 1 if the system has the type `intptr_t'. */
#define HAVE_INTPTR_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Do we have IPTOS support? */
#define HAVE_IPTOS_SUPPORT 1
/* Define to 1 if you have the `isfinite' function. */
/* #undef HAVE_ISFINITE */
/* Define to 1 if you have the <kvm.h> header file. */
/* #undef HAVE_KVM_H */
/* Define to 1 if you have the `kvm_open' function. */
/* #undef HAVE_KVM_OPEN */
/* Define to 1 if you have the `advapi32' library (-ladvapi32). */
/* #undef HAVE_LIBADVAPI32 */
/* Define to 1 if you have the `elf' library (-lelf). */
/* #undef HAVE_LIBELF */
/* Define to 1 if you have the `gen' library (-lgen). */
/* #undef HAVE_LIBGEN */
/* Define to 1 if you have the <libgen.h> header file. */
#define HAVE_LIBGEN_H 1
/* Define to 1 if you have the `kvm' library (-lkvm). */
/* #undef HAVE_LIBKVM */
/* Define to 1 if you have the `ld' library (-lld). */
/* #undef HAVE_LIBLD */
/* Define to 1 if you have the `mld' library (-lmld). */
/* #undef HAVE_LIBMLD */
/* Define to 1 if you have the `netsnmp' library (-lnetsnmp). */
/* #undef HAVE_LIBNETSNMP */
/* Define to 1 if you have the `posix4' library (-lposix4). */
/* #undef HAVE_LIBPOSIX4 */
/* Define to 1 if you have the `rt' library (-lrt). */
/* #undef HAVE_LIBRT */
/* Define to 1 if you have the <libscf.h> header file. */
/* #undef HAVE_LIBSCF_H */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Do we have Linux capabilities? */
/* #undef HAVE_LINUX_CAPABILITIES */
/* Define to 1 if you have the <machine/inline.h> header file. */
/* #undef HAVE_MACHINE_INLINE_H */
/* Define to 1 if you have the <machine/soundcard.h> header file. */
/* #undef HAVE_MACHINE_SOUNDCARD_H */
/* Define to 1 if you have the <math.h> header file. */
#define HAVE_MATH_H 1
/* Define to 1 if you have the `MD5Init' function. */
/* #undef HAVE_MD5INIT */
/* Define to 1 if you have the <md5.h> header file. */
/* #undef HAVE_MD5_H 1 */
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the `memlk' function. */
/* #undef HAVE_MEMLK */
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
#define HAVE_MEMSET 1
/* Define to 1 if you have the `mkstemp' function. */
#define HAVE_MKSTEMP 1
/* Define to 1 if you have the `mktime' function. */
#define HAVE_MKTIME 1
/* Define to 1 if you have the `mlockall' function. */
/* #undef HAVE_MLOCKALL */
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/in_system.h> header file. */
/* #undef HAVE_NETINET_IN_SYSTEM_H */
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
#define HAVE_NETINET_IN_SYSTM_H 1
/* Define to 1 if you have the <netinet/ip.h> header file. */
#define HAVE_NETINET_IP_H 1
/* NetInfo support? */
/* #undef HAVE_NETINFO */
/* Define to 1 if you have the <netinfo/ni.h> header file. */
/* #undef HAVE_NETINFO_NI_H */
/* Define to 1 if you have the <net/if6.h> header file. */
/* #undef HAVE_NET_IF6_H */
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
/* Define to 1 if you have the <net/route.h> header file. */
#define HAVE_NET_ROUTE_H 1
/* Define to 1 if you have the `nice' function. */
#define HAVE_NICE 1
/* Define to 1 if you have the `nlist' function. */
/* #undef HAVE_NLIST */
/* Define to 1 if you have the `ntp_adjtime' function. */
/* #undef HAVE_NTP_ADJTIME */
/* Define to 1 if you have the `ntp_gettime' function. */
/* #undef HAVE_NTP_GETTIME */
/* Do we want support for Samba's signing daemon? */
/* #undef HAVE_NTP_SIGND */
/* Define this if pathfind(3) works */
/* #undef HAVE_PATHFIND */
/* Define to 1 if the system has the type `pid_t'. */
#define HAVE_PID_T 1
/* Define to 1 if you have the `plock' function. */
/* #undef HAVE_PLOCK */
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Do we have the PPS API per the Draft RFC? */
/* #undef HAVE_PPSAPI */
/* Define to 1 if you have the `pututline' function. */
/* #undef HAVE_PUTUTLINE */
/* Define to 1 if you have the `pututxline' function. */
#define HAVE_PUTUTXLINE 1
/* Define to 1 if you have the <readline.h> header file. */
/* #undef HAVE_READLINE_H */
#if !TARGET_OS_EMBEDDED
/* Define if your readline library has \`add_history' */
/*#define HAVE_READLINE_HISTORY 1*/
/* Define to 1 if you have the <readline/history.h> header file. */
#define HAVE_READLINE_HISTORY_H 1
/* Define to 1 if you have the <readline/readline.h> header file. */
#define HAVE_READLINE_READLINE_H 1
#endif
/* Define to 1 if you have the `readlink' function. */
#define HAVE_READLINK 1
/* Define this if we have a functional realpath(3C) */
#define HAVE_REALPATH 1
/* Define to 1 if you have the `recvmsg' function. */
#define HAVE_RECVMSG 1
/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1
/* Define to 1 if you have the `res_init' function. */
#define HAVE_RES_INIT 1
/* Do we have Linux routing socket? */
/* #undef HAVE_RTNETLINK */
/* Define to 1 if you have the `rtprio' function. */
/* #undef HAVE_RTPRIO */
/* Define to 1 if you have the <runetype.h> header file. */
#define HAVE_RUNETYPE_H 1
/* Obvious... */
#define HAVE_SA_SIGACTION_IN_STRUCT_SIGACTION 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the `sched_setscheduler' function. */
/* #undef HAVE_SCHED_SETSCHEDULER */
/* Define to 1 if you have the <setjmp.h> header file. */
#define HAVE_SETJMP_H 1
/* Define to 1 if you have the `setlinebuf' function. */
#define HAVE_SETLINEBUF 1
/* Define to 1 if you have the `setpgid' function. */
#define HAVE_SETPGID 1
/* define if setpgrp takes 0 arguments */
#define HAVE_SETPGRP_0 1
/* Define to 1 if you have the `setpriority' function. */
#define HAVE_SETPRIORITY 1
/* Define to 1 if you have the `setrlimit' function. */
#define HAVE_SETRLIMIT 1
/* Define to 1 if you have the `setsid' function. */
#define HAVE_SETSID 1
/* Define to 1 if you have the `settimeofday' function. */
#define HAVE_SETTIMEOFDAY 1
/* Define to 1 if you have the `setvbuf' function. */
#define HAVE_SETVBUF 1
/* Define to 1 if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H 1
/* Define to 1 if you have the `sigaction' function. */
#define HAVE_SIGACTION 1
/* Can we use SIGIO for tcp and udp IO? */
#define HAVE_SIGNALED_IO 1
/* Define to 1 if you have the `sigset' function. */
#define HAVE_SIGSET 1
/* Define to 1 if you have the `sigsuspend' function. */
#define HAVE_SIGSUSPEND 1
/* Define to 1 if you have the `sigvec' function. */
#define HAVE_SIGVEC 1
/* Define to 1 if the system has the type `size_t'. */
#define HAVE_SIZE_T 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Are Solaris privileges available? */
/* #undef HAVE_SOLARIS_PRIVS */
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stime' function. */
/* #undef HAVE_STIME */
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the `strdup' function. */
#define HAVE_STRDUP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define this if strftime() works */
#define HAVE_STRFTIME 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strrchr' function. */
#define HAVE_STRRCHR 1
/* Define to 1 if you have the `strsignal' function. */
#define HAVE_STRSIGNAL 1
/* Define to 1 if you have the `strstr' function. */
#define HAVE_STRSTR 1
/* Do we have struct ntptimeval? */
/* #undef HAVE_STRUCT_NTPTIMEVAL */
/* Define to 1 if `time.tv_nsec' is a member of `struct ntptimeval'. */
/* #undef HAVE_STRUCT_NTPTIMEVAL_TIME_TV_NSEC */
/* Does a system header define struct ppsclockev? */
/* #undef HAVE_STRUCT_PPSCLOCKEV */
/* Do we have struct snd_size? */
/* #undef HAVE_STRUCT_SND_SIZE */
/* Does a system header define struct sockaddr_storage? */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Do we have struct timespec? */
#define HAVE_STRUCT_TIMESPEC 1
/* Define to 1 if you have the <sun/audioio.h> header file. */
/* #undef HAVE_SUN_AUDIOIO_H */
/* Define to 1 if you have the `sysconf' function. */
#define HAVE_SYSCONF 1
/* Define to 1 if you have the `sysctl' function. */
#define HAVE_SYSCTL 1
/* Define to 1 if you have the <sysexits.h> header file. */
#define HAVE_SYSEXITS_H 1
/* Define to 1 if you have the <sys/audioio.h> header file. */
/* #undef HAVE_SYS_AUDIOIO_H */
/* Define to 1 if you have the <sys/capability.h> header file. */
/* #undef HAVE_SYS_CAPABILITY_H */
/* Define to 1 if you have the <sys/clkdefs.h> header file. */
/* #undef HAVE_SYS_CLKDEFS_H */
/* Define to 1 if you have the <sys/clockctl.h> header file. */
/* #undef HAVE_SYS_CLOCKCTL_H */
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_DIR_H */
/* Define to 1 if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define to 1 if you have the <sys/i8253.h> header file. */
/* #undef HAVE_SYS_I8253_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/ipc.h> header file. */
#define HAVE_SYS_IPC_H 1
/* Define to 1 if you have the <sys/limits.h> header file. */
/* #undef HAVE_SYS_LIMITS_H */
/* Define to 1 if you have the <sys/lock.h> header file. */
#define HAVE_SYS_LOCK_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/modem.h> header file. */
/* #undef HAVE_SYS_MODEM_H */
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
/* #undef HAVE_SYS_NDIR_H */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/pcl720.h> header file. */
/* #undef HAVE_SYS_PCL720_H */
/* Define to 1 if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define to 1 if you have the <sys/ppsclock.h> header file. */
/* #undef HAVE_SYS_PPSCLOCK_H */
/* Define to 1 if you have the <sys/ppstime.h> header file. */
/* #undef HAVE_SYS_PPSTIME_H */
/* Define to 1 if you have the <sys/prctl.h> header file. */
/* #undef HAVE_SYS_PRCTL_H */
/* Define to 1 if you have the <sys/procset.h> header file. */
/* #undef HAVE_SYS_PROCSET_H */
/* Define to 1 if you have the <sys/proc.h> header file. */
#define HAVE_SYS_PROC_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/sched.h> header file. */
/* #undef HAVE_SYS_SCHED_H */
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/shm.h> header file. */
#define HAVE_SYS_SHM_H 1
/* Define to 1 if you have the <sys/signal.h> header file. */
#define HAVE_SYS_SIGNAL_H 1
/* Define to 1 if you have the <sys/sio.h> header file. */
/* #undef HAVE_SYS_SIO_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
#define HAVE_SYS_SOCKIO_H 1
/* Define to 1 if you have the <sys/soundcard.h> header file. */
/* #undef HAVE_SYS_SOUNDCARD_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/stream.h> header file. */
/* #undef HAVE_SYS_STREAM_H */
/* Define to 1 if you have the <sys/stropts.h> header file. */
/* #undef HAVE_SYS_STROPTS_H */
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/syssgi.h> header file. */
/* #undef HAVE_SYS_SYSSGI_H */
/* Define to 1 if you have the <sys/systune.h> header file. */
/* #undef HAVE_SYS_SYSTUNE_H */
/* Define to 1 if you have the <sys/termios.h> header file. */
#define HAVE_SYS_TERMIOS_H 1
/* Define to 1 if you have the <sys/timepps.h> header file. */
/* #undef HAVE_SYS_TIMEPPS_H */
/* Define to 1 if you have the <sys/timers.h> header file. */
/* #undef HAVE_SYS_TIMERS_H */
/* Define to 1 if you have the <sys/timex.h> header file. */
/* #undef HAVE_SYS_TIMEX_H */
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/tpro.h> header file. */
/* #undef HAVE_SYS_TPRO_H */
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Use sys/uio.h for struct iovec help */
/* #undef HAVE_SYS_UIO_H */
/* Define to 1 if you have the <sys/un.h> header file. */
#define HAVE_SYS_UN_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define to 1 if the system has the type `s_char'. */
/* #undef HAVE_S_CHAR */
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
/* Obvious... */
#define HAVE_TICKADJ_IN_STRUCT_CLOCKINFO 1
/* Define to 1 if you have the `timegm' function. */
#define HAVE_TIMEGM 1
/* Define to 1 if you have the <timepps.h> header file. */
/* #undef HAVE_TIMEPPS_H */
/* Define to 1 if you have the `timer_create' function. */
/* #undef HAVE_TIMER_CREATE */
/* Define to 1 if you have the `timer_settime' function. */
/* #undef HAVE_TIMER_SETTIME */
/* Define to 1 if you have the <timex.h> header file. */
/* #undef HAVE_TIMEX_H */
/* Do we have the TIOCGPPSEV ioctl (Solaris)? */
/* #undef HAVE_TIOCGPPSEV */
/* Do we have the TIOCSPPS ioctl (Solaris)? */
/* #undef HAVE_TIOCSPPS */
/* Do we have the TIO serial stuff? */
/* #undef HAVE_TIO_SERIAL_STUFF */
/* Does u_int64_t exist? */
#define HAVE_TYPE_U_INT64_T 1
/* Does u_int8_t exist? */
#define HAVE_TYPE_U_INT8_T 1
/* Define to 1 if the system has the type `uint16_t'. */
#define HAVE_UINT16_T 1
/* Define to 1 if the system has the type `uint32_t'. */
#define HAVE_UINT32_T 1
/* Define to 1 if the system has the type `uint8_t'. */
#define HAVE_UINT8_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
#define HAVE_UINTPTR_T 1
/* Define to 1 if the system has the type `uint_t'. */
/* #undef HAVE_UINT_T */
/* Define to 1 if you have the `umask' function. */
#define HAVE_UMASK 1
/* Define to 1 if you have the `uname' function. */
#define HAVE_UNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `updwtmp' function. */
/* #undef HAVE_UPDWTMP */
/* Define to 1 if you have the `updwtmpx' function. */
/* #undef HAVE_UPDWTMPX */
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if you have the <utmpx.h> header file. */
#define HAVE_UTMPX_H 1
/* Define to 1 if you have the <utmp.h> header file. */
/* #undef HAVE_UTMP_H */
/* Define to 1 if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define to 1 if you have the <varargs.h> header file. */
/* #undef HAVE_VARARGS_H */
/* Define to 1 if you have the `vfork' function. */
#define HAVE_VFORK 1
/* Define to 1 if you have the <vfork.h> header file. */
/* #undef HAVE_VFORK_H */
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `vsprintf' function. */
#define HAVE_VSPRINTF 1
/* Define to 1 if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
/* Define to 1 if the system has the type `wchar_t'. */
#define HAVE_WCHAR_T 1
/* Define to 1 if the system has the type `wint_t'. */
#define HAVE_WINT_T 1
/* Define to 1 if `fork' works. */
#define HAVE_WORKING_FORK 1
/* Define to 1 if `vfork' works. */
#define HAVE_WORKING_VFORK 1
/* Define to 1 if you have the </sys/sync/queue.h> header file. */
/* #undef HAVE__SYS_SYNC_QUEUE_H */
/* Define to 1 if you have the </sys/sync/sema.h> header file. */
/* #undef HAVE__SYS_SYNC_SEMA_H */
/* Define to 1 if you have the `__adjtimex' function. */
/* #undef HAVE___ADJTIMEX */
/* Define to 1 if you have the `__ntp_gettime' function. */
/* #undef HAVE___NTP_GETTIME */
/* Define to 1 if you have the `__res_init' function. */
/* #undef HAVE___RES_INIT */
/* Does struct sockaddr_storage have __ss_family? */
/* #undef HAVE___SS_FAMILY_IN_SS */
/* Handle sockaddr_storage.__ss_family */
#ifdef HAVE___SS_FAMILY_IN_SS
# define ss_family __ss_family
#endif /* HAVE___SS_FAMILY_IN_SS */
/* Does struct sockaddr_storage have __ss_len? */
/* #undef HAVE___SS_LEN_IN_SS */
/* Handle sockaddr_storage.__ss_len */
#ifdef HAVE___SS_LEN_IN_SS
# define ss_len __ss_len
#endif /* HAVE___SS_LEN_IN_SS */
/* [Retry queries on _any_ DNS error?] */
/* #undef IGNORE_DNS_ERRORS */
/* Should we use the IRIG sawtooth filter? */
/* #undef IRIG_SUCKS */
/* Do we need to fix in6isaddr? */
/* #undef ISC_PLATFORM_FIXIN6ISADDR */
/* ISC: do we have if_nametoindex()? */
#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1
/* have struct if_laddrconf? */
/* #undef ISC_PLATFORM_HAVEIF_LADDRCONF */
/* have struct if_laddrreq? */
/* #undef ISC_PLATFORM_HAVEIF_LADDRREQ */
#define __APPLE_USE_RFC_3542 1
/* have struct in6_pktinfo? */
#define ISC_PLATFORM_HAVEIN6PKTINFO /**/
/* have IPv6? */
#define ISC_PLATFORM_HAVEIPV6 /**/
/* struct sockaddr has sa_len? */
#define ISC_PLATFORM_HAVESALEN /**/
/* have sin6_scope_id? */
#define ISC_PLATFORM_HAVESCOPEID /**/
/* missing in6addr_any? */
/* #undef ISC_PLATFORM_NEEDIN6ADDRANY */
/* Do we need netinet6/in6.h? */
/* #undef ISC_PLATFORM_NEEDNETINET6IN6H */
/* ISC: provide inet_ntop() */
/* #undef ISC_PLATFORM_NEEDNTOP */
/* Declare in_port_t? */
/* #undef ISC_PLATFORM_NEEDPORTT */
/* ISC: provide inet_pton() */
/* #undef ISC_PLATFORM_NEEDPTON */
/* Does the kernel have an FLL bug? */
/* #undef KERNEL_FLL_BUG */
/* Does the kernel support precision time discipline? */
/* #undef KERNEL_PLL */
/* What is (probably) the name of DOSYNCTODR in the kernel? */
#define K_DOSYNCTODR_NAME "_dosynctodr"
/* What is (probably) the name of NOPRINTF in the kernel? */
#define K_NOPRINTF_NAME "_noprintf"
/* What is the name of TICKADJ in the kernel? */
#define K_TICKADJ_NAME "_tickadj"
/* What is the name of TICK in the kernel? */
#define K_TICK_NAME "_tick"
/* Should we align with the NIST lockclock scheme? */
/* #undef LOCKCLOCK */
/* Does the kernel support multicasting IP? */
#define MCAST 1
/* Should we recommend a minimum value for tickadj? */
/* #undef MIN_REC_TICKADJ */
/* Do we need HPUX adjtime() library support? */
/* #undef NEED_HPUX_ADJTIME */
/* Do we want the HPUX FindConfig()? */
/* #undef NEED_HPUX_FINDCONFIG */
/* We need to provide netsnmp_daemonize() */
/* #undef NEED_NETSNMP_DAEMONIZE */
/* Do we need the qnx adjtime call? */
/* #undef NEED_QNX_ADJTIME */
/* Do we need extra room for SO_RCVBUF? (HPUX <8) */
/* #undef NEED_RCVBUF_SLOP */
/* Do we need an s_char typedef? */
#define NEED_S_CHAR_TYPEDEF 1
/* Might nlist() values require an extra level of indirection (AIX)? */
/* #undef NLIST_EXTRA_INDIRECTION */
/* does struct nlist use a name union? */
/* #undef NLIST_NAME_UNION */
/* nlist stuff */
#define NLIST_STRUCT 1
/* Should we NOT read /dev/kmem? */
#define NOKMEM 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Define this if optional arguments are disallowed */
/* #undef NO_OPTIONAL_OPT_ARGS */
/* Should we avoid #warning on option name collisions? */
/* #undef NO_OPTION_NAME_WARNINGS */
/* Is there a problem using PARENB and IGNPAR (IRIX)? */
/* #undef NO_PARENB_IGNPAR */
/* Default location of crypto key info */
#define NTP_KEYSDIR "/usr/etc"
/* Path to sign daemon rendezvous socket */
/* #undef NTP_SIGND_PATH */
/* Do we have ntp_{adj,get}time in libc? */
/* #undef NTP_SYSCALLS_LIBC */
/* Do we have ntp_{adj,get}time in the kernel? */
/* #undef NTP_SYSCALLS_STD */
/* Do we have support for SHMEM_STATUS? */
#define ONCORE_SHMEM_STATUS 1
/* Use OpenSSL? */
/* #undef OPENSSL */
/* Should we open the broadcast socket? */
#define OPEN_BCAST_SOCKET 1
/* need to recreate sockets on changed routing? */
/* #undef OS_MISSES_SPECIFIC_ROUTE_UPDATES */
/* wildcard socket needs to set REUSEADDR when binding to interface addresses
*/
/* #undef OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */
/* Do we need to override the system's idea of HZ? */
/* #undef OVERRIDE_HZ */
/* Name of package */
#define PACKAGE "ntp"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME "ntp"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ntp 4.2.6"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntp"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.2.6"
/* Do we have the ppsclock streams module? */
/* #undef PPS */
/* PARSE kernel PLL PPS support */
/* #undef PPS_SYNC */
/* Preset a value for 'tick'? */
#define PRESET_TICK 1000000L/hz
/* Preset a value for 'tickadj'? */
#define PRESET_TICKADJ 500/hz
/* Does qsort expect to work on "void *" stuff? */
#define QSORT_USES_VOID_P 1
/* Should we not IGNPAR (Linux)? */
/* #undef RAWDCF_NO_IGNPAR */
/* Basic refclock support? */
#define REFCLOCK 1
/* name of regex header file */
#define REGEX_HEADER <regex.h>
/* Do we want the ReliantUNIX clock hacks? */
/* #undef RELIANTUNIX_CLOCK */
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* saveconfig mechanism */
#define SAVECONFIG 1
/* Do we want the SCO clock hacks? */
/* #undef SCO5_CLOCK */
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `signed char', as computed by sizeof. */
#define SIZEOF_SIGNED_CHAR 1
#define SIZEOF_TIME_T (sizeof(time_t))
/* Does SIOCGIFCONF return size in the buffer? */
/* #undef SIZE_RETURNED_IN_BUFFER */
/* Slew always? */
/* #undef SLEWALWAYS */
/* *s*printf() functions are char* */
/* #undef SPRINTF_CHAR */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Step, then slew the clock? */
/* #undef STEP_SLEW */
/* canonical system (cpu-vendor-os) of where we should run */
#define STR_SYSTEM "i686-apple-darwin10.0"
/* Buggy syscall() (Solaris2.4)? */
/* #undef SYSCALL_BUG */
/* Does Xettimeofday take 1 arg? */
/* #undef SYSV_TIMEOFDAY */
/* Do we need to #define _SVID3 when we #include <termios.h>? */
/* #undef TERMIOS_NEEDS__SVID3 */
/* Is K_TICKADJ_NAME in nanoseconds? */
/* #undef TICKADJ_NANO */
/* Is K_TICK_NAME in nanoseconds? */
/* #undef TICK_NANO */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Do we have the tty_clk line discipline/streams module? */
/* #undef TTYCLK */
/* Provide a typedef for uintptr_t? */
#ifndef HAVE_UINTPTR_T
typedef unsigned int uintptr_t;
#define HAVE_UINTPTR_T 1
#endif
/* What type to use for setsockopt */
#define TYPEOF_IP_MULTICAST_LOOP u_char
/* Do we set process groups with -pid? */
/* #undef UDP_BACKWARDS_SETOWN */
/* Must we have a CTTY for fsetown? */
#define USE_FSETOWNCTTY 1
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
/* Can we use SIGPOLL for tty IO? */
/* #undef USE_TTY_SIGPOLL */
/* Can we use SIGPOLL for UDP? */
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
#define VERSION "4.2.6"
/* configure --enable-ipv6 */
#define WANT_IPV6 /**/
/* Define this if a working libregex can be found */
#define WITH_LIBREGEX 1
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
/* # undef WORDS_BIGENDIAN */
# endif
#endif
/* Define to 1 if on MINIX. */
/* #undef _MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
/* # undef __CHAR_UNSIGNED__ */
#endif
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef gid_t */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to `long' if <sys/types.h> does not define. */
/* #undef time_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef uid_t */
/* Define as `fork' if `vfork' does not work. */
/* #undef vfork */
/* Does the compiler like "volatile"? */
/* #undef volatile */
| [
"[email protected]"
] | |
07007c12c42caaeb526c2cd2c429c1c6f491e12d | 4a6d75f6cbfd28a0713534326f3f55f91dd212ce | /trunk/human_reader/core/base_include.h | 0ad53d5100d33df646dc7f43c272fd372cdf069f | [] | no_license | BGCX261/zodiacdecoder-svn-to-git | e257ea7752f982304de34f7f8d8fe83a29762787 | 8bda82c29fb4c5ec613a0d9260301457d36821a3 | refs/heads/master | 2020-04-06T03:54:43.331552 | 2015-08-25T15:32:51 | 2015-08-25T15:32:51 | 42,317,683 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 337 | h | #ifndef __BASE_INCLUDE_H__
#define __BASE_INCLUDE_H__
// Switches
/// If INDEX_MANAGER_SAFE_RELEASE then CIndexManager class will safely release Indexes.
//#define INDEX_MANAGER_SAFE_RELEASE
#include <d3d9.h>
#include "logging.h"
typedef IDirect3DTexture9* TextureData;
typedef IDirect3DSurface9* SurfaceData;
#endif | [
"[email protected]"
] | |
e77c63e83c50bd591758acbb0600cd0e39b3f411 | 2e0f6ef7193746f82f581b7ebf4540dcc29c78a6 | /c00/ex08/ft_print_combn.c | b8359f9b95139c0e483b26895ccf190614ca83f0 | [] | no_license | biotbs44/42seoul | 36b2dccbdf91afa4d05462954197449f8ac84a9d | 66b6d2734d459fbcfe2c867e1332273b1371d330 | refs/heads/master | 2023-08-03T17:35:40.240105 | 2021-09-19T12:44:47 | 2021-09-19T12:44:47 | 407,246,444 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,226 | c | #include <unistd.h>
void ft_print_combn_plus(char *str, int n);
void ft_print_combn_prior(char *str, int n);
void ft_print_combn_write(char *str, int n);
void ft_print_combn(int n)
{
char str[10];
int idx;
idx = 0;
while (idx < 10)
{
if (idx >= n)
str[idx++] = '\0';
else
str[idx++] = '0';
}
ft_print_combn_plus(str, n);
}
void ft_print_combn_plus(char *str, int n)
{
int last_idx;
int first_idx;
last_idx = n - 1;
first_idx = 0;
while (1)
{
while (last_idx >= 0)
{
if (str[last_idx] != '9')
{
str[last_idx]++;
break ;
}
else
{
str[last_idx] = '0';
last_idx--;
}
}
ft_print_combn_prior(str, n);
if(str[0] == '9')
break ;
}
}
void ft_print_combn_prior(char *str, int n)
{
int first_idx;
int last_idx;
int flag;
flag = 0;
first_idx = 0;
last_idx = n - 1;
while (first_idx < n - 1)
{
if (str[first_idx] > str[first_idx + 1])
{
flag = 1;
break ;
}
}
if (flag == 0)
{
ft_print_combn_write(str, n);
}
}
void ft_print_combn_write(char *str, int n)
{
int first_idx;
first_idx = 0;
while (first_idx < n)
{
write(1, &str[first_idx++], 1);
}
if (str[0] == ((char) n) + 48)
write(1, "\n", 1);
else
write(1, ", ", 2);
}
| [
"[email protected]"
] | |
c7556effddc580124f49c85fed6f1024856a89eb | 9c567ace0b7d6fc5d65dd1658ee733d17a8d6678 | /FreeRTOS实验6-3_FreeRTOS任务挂起与恢复实验/USER/stm32f4xx_it.c | fac899b7ad8ada30dfb42d04b965e50f5351766e | [] | no_license | sz189981/FreeRTOS_notes | c0293c6bcefdc19c352f978f484b0603125c6a44 | 4b2152589d6792bb492025cb9649044a8ad5e2f8 | refs/heads/master | 2021-12-03T01:30:06.787932 | 2018-05-18T10:08:32 | 2018-05-18T10:08:32 | 133,311,368 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 4,569 | c | /**
******************************************************************************
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.4.0
* @date 04-August-2014
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
/** @addtogroup Template_Project
* @{
*/
/* 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
*/
//modified by sz 20180514 for compile error
//void SVC_Handler(void)
//{
//}
//end of modified
/**
* @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
*/
//modified by sz 20180514 for compile error
//void PendSV_Handler(void)
//{
//}
//end of modified
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
//modified by sz 20180514 for compile error
//void SysTick_Handler(void)
//{
//}
//end of modified
/******************************************************************************/
/* 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****/
| [
"[email protected]"
] | |
d774a9da782db57edbbaae24d2800cc29722c78e | 6b340cc662f7be85c3dbc48f6d55dd349acd66b7 | /libraries/libwidget/Icon.c | d2c4a517a680520c346ace5cf317fcd8f9a4cdc2 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ozkxr/skift | 998e70755c7ea4f1cdcb78fdfbf5c15c325ec6b5 | 17ddd638492587a2a4af79f66840606e95027f32 | refs/heads/master | 2022-07-08T11:59:43.195695 | 2020-05-10T12:01:08 | 2020-05-10T12:01:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,333 | c | #include <libgraphic/Painter.h>
#include <libwidget/Icon.h>
#include <libwidget/IconCache.h>
#include <libwidget/Window.h>
void icon_paint(Icon *widget, Painter *painter, Rectangle rectangle)
{
__unused(rectangle);
if (widget->bitmap)
{
Rectangle destination = rectangle_center_within(bitmap_bound(widget->bitmap), widget_content_bound(widget));
if (widget_is_enable(WIDGET(widget)))
{
painter_blit_icon(painter, widget->bitmap, destination, widget_get_color(widget, THEME_FOREGROUND));
}
else
{
painter_blit_icon(painter, widget->bitmap, destination, widget_get_color(widget, THEME_FOREGROUND_DISABLED));
}
}
}
Point icon_size(Icon *widget)
{
if (widget->bitmap)
{
return rectangle_expand(bitmap_bound(widget->bitmap), WIDGET(widget)->insets).size;
}
else
{
return widget_bound(widget).size;
}
}
Widget *icon_create(Widget *parent, const char *name)
{
Icon *icon = __create(Icon);
icon->bitmap = icon_cache_get_icon(name);
icon->bitmap->filtering = BITMAP_FILTERING_LINEAR;
WIDGET(icon)->paint = (WidgetPaintCallback)icon_paint;
WIDGET(icon)->size = (WidgetComputeSizeCallback)icon_size;
widget_initialize(WIDGET(icon), "Icon", parent);
return WIDGET(icon);
} | [
"[email protected]"
] | |
de8c16291addb0b84cbae2181fcec184beea9568 | 080368c3923a9dc6660de7186272304599b54e4b | /light.c | 8ba49174b2c8ce3c9992b4ec1c24ec01671107c4 | [] | no_license | Gauravjeetsingh/openGL_animation | b7001d4acd6b22ed43ceb1c2ebfacd1483d91026 | 7b9147d35fae1914d0fec2f3784d9bbf1228af83 | refs/heads/master | 2021-01-19T08:15:23.179483 | 2013-01-13T13:47:38 | 2013-01-13T13:47:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,691 | c | #include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
static GLfloat spin = 0.0;
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
}
void display(void)
{
GLfloat position[] = { 0.0, 0.0, 1.5, 1.0 };
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix ();
glTranslatef (0.0, 0.0, -5.0);
glPushMatrix ();
glRotatef(spin, 0.0, 1.0, 0.0);
glLightfv (GL_LIGHT0, GL_POSITION, position);
glTranslated (0.0, 0.0, 1.5);
glDisable (GL_LIGHTING);
glColor3f (1.0, 1.0,1.0);
glutSolidCube(0.1);
glEnable (GL_LIGHTING);
glPopMatrix ();
glRotatef(spin, 0.0, 0.0, 1.0);
glutSolidTorus (0.1, 1.0, 35.0, 20);
glPopMatrix ();
glFlush ();
}
void spinn()
{
spin = spin + 1.0;
if(spin > 360.0)
spin = spin - 360.0;;
glutPostRedisplay();
}
void keyboard(unsigned char key, int x, int y)
{
switch(key)
{
case 'w': glutIdleFunc(spinn);
break;
case 's': glutIdleFunc(NULL);
break;
default : break;
}
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
gluPerspective(40.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize (500, 500);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
}
| [
"[email protected]"
] | |
2846b8316c0522088f86c2cb4f595c95dc9426db | 6e8f170e93938e3d83f50f536e4e6bb79ca4b409 | /ft_strdel.c | 9ee49ed37945a1938593c8f9f3dc7d0a48aad2d9 | [] | no_license | smtolo/Libft | 6e4ba67735d6c8739724ae6edf6e29619bf0363f | be8649767676dd77825fa214d84012e1a54b076e | refs/heads/master | 2020-04-01T14:04:55.705743 | 2019-03-04T13:08:01 | 2019-03-04T13:08:01 | 153,279,607 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 980 | c | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strdel.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: smtolo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/06/22 15:35:03 by smtolo #+# #+# */
/* Updated: 2018/06/24 13:09:26 by smtolo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_strdel(char **s)
{
if (s)
{
free(*s);
*s = NULL;
}
}
| [
"[email protected]"
] | |
86f309deb9ee817244901b1e55e9fdbfa50c62a4 | 8d753bb8f19b5b1f526b0688d3cb199b396ed843 | /osp_sai_2.1.8/system/fea/lcm/lcmmsg/gen/LcChsmVcmStatusGetAck.h | d969e366420356d1ba0f269016482ced8ee15ce5 | [] | no_license | bonald/vim_cfg | f166e5ff650db9fa40b564d05dc5103552184db8 | 2fee6115caec25fd040188dda0cb922bfca1a55f | refs/heads/master | 2023-01-23T05:33:00.416311 | 2020-11-19T02:09:18 | 2020-11-19T02:09:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,014 | h | /*
* Generated by asn1c-0.9.20 (http://lionet.info/asn1c)
* From ASN.1 module "LCM"
* found in "../lcm.asn1"
*/
#ifndef _LcChsmVcmStatusGetAck_H_
#define _LcChsmVcmStatusGetAck_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeInteger.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct VcmStatus;
/* LcChsmVcmStatusGetAck */
typedef struct LcChsmVcmStatusGetAck {
long count;
struct vcmStatus {
A_SEQUENCE_OF(struct VcmStatus) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} vcmStatus;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} LcChsmVcmStatusGetAck_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_LcChsmVcmStatusGetAck;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include <VcmStatus.h>
#endif /* _LcChsmVcmStatusGetAck_H_ */
| [
"[email protected]"
] | |
95a2f627ee960346dfa07284e4fe73aab53a95b3 | 9cd1adc7518c844d6ec7b46c5513d626bb7908ab | /cat.c | b694849f6bad5fdc5eb6da07902727ac843dca45 | [] | no_license | bhavyanarang/My-Shell | 01e1658156436dbb95dfe8b64b9afea6edeea3c3 | a8da293a0c9c07f03f360a9e6373b4083294416d | refs/heads/master | 2023-06-08T17:22:26.849052 | 2021-06-26T17:54:33 | 2021-06-26T17:54:33 | 306,064,204 | 3 | 1 | null | null | null | null | UTF-8 | C | false | false | 1,725 | c | #include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
char cwd[1000];
void callGetcwd(){
getcwd(cwd,sizeof(cwd));
if(cwd==NULL){
printf("getcwd() error\n");
}
}
int main(int argc, char const* arg[]){
char* token=arg[0];
char stri[105];
strcpy(stri,arg[1]);
if(strcmp(token,"-n")==0){
char* vari=strtok(stri," ");
if(strcmp(vari,"cat")==0){
vari=strtok(NULL," ");
if(strcmp(vari,"-n")==0){
vari=strtok(NULL," ");
}
}
struct stat st={0}; //initalize status of file
int line=1;
callGetcwd();
strcat(cwd,"/");
strcat(cwd,vari);
if(stat(cwd,&st)==-1){
printf("File does not exist\n");
}
FILE *file=fopen(cwd,"r");
printf("%s/n",cwd);
if(file!=NULL){
char output[150];
while((fgets(output,sizeof(output),file))!=NULL){
printf("%d ",line);
line+=1;
fputs(output,stdout);
}
}
if(file==NULL){
printf("Error in opening file\n");
}
}
else if(strcmp(token,"-E")==0){
struct stat st={0}; //initalize status of file
char* vari=strtok(stri," ");
if(strcmp(vari,"cat")==0){
vari=strtok(NULL," ");
if(strcmp(vari,"-E")==0){
vari=strtok(NULL," ");
}
}
callGetcwd();
strcat(cwd,"/");
strcat(cwd,vari);
if(stat(cwd,&st)==-1){
printf("File does not exist\n");
}
FILE *file=fopen(cwd,"r");
if(file!=NULL){
char output[150];
while(fgets(output,sizeof(output),file)!=NULL){
strcat(output,"$");
fputs(output,stdout);
}
}
if(file==NULL){
printf("Error in opening file\n");
}
}
else if(strcmp(token,"--help")==0){
printf("Help in cat Command\n");
}
else{
printf("Command not supported\n");
}
} | [
"[email protected]"
] | |
edf9b44d4dd1ab45769ca6ed2d50492628d91a32 | f918c2fd76fe7be79f7cea5f4b6f4d13ed99d42d | /1516/ME218C_airbot/uploads/4/8/8/0/48809657/accelerometermodule.h | 510320588255895eadb43a8a381e783267d26dd7 | [] | no_license | SPDLDaemon/spdldaemon.github.io | 38695982250bc3b8b3bc01ea49542e8342e09280 | 2b384ad7c809e2c25b1520549e54503a349c51ef | refs/heads/master | 2023-05-24T02:02:02.189281 | 2023-05-22T21:39:24 | 2023-05-22T21:39:24 | 49,853,977 | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 305 | h | /*
* File: AccelerometerModule.h
* Author: jordanm1
*
* Created on May 15, 2016, 4:34 PM
*/
#ifndef ACCELEROMETERMODULE_H
#define ACCELEROMETERMODULE_H
void InitAccelerometer( void );
bool Accel_IOC_ISR(void);
void CheckForPair(void);
void IgnorePair(void);
#endif /* ACCELEROMETERMODULE_H */
| [
"[email protected]"
] | |
fb128ed9c9eb5c35c544c9b08bf350615b2f6cb0 | 6432ffa0649947cdb0c2045a3a7b2b2bee27e8c2 | /d/qingcheng/npc/dizi.c | 8dc087903b399458360db2418620aed7d44376f6 | [] | no_license | MudRen/xkx100 | f2e314a542e459502e28f311cd9f20ee7f7c6f43 | dfca57e056460d7c0532a6e19a5e4add94a5588d | refs/heads/main | 2022-03-05T00:08:01.398338 | 2022-01-25T09:00:27 | 2022-01-25T09:00:27 | 313,971,845 | 6 | 3 | null | null | null | null | UTF-8 | C | false | false | 1,086 | c | // dizi.c
inherit NPC;
//inherit F_SKILL;
void create()
{
set_name("青城弟子", ({ "qingcheng dizi", "dizi" }));
set("gender", "男性");
set("age", 20);
set("long", "他是「青城派」年轻一代弟子。\n");
set("combat_exp", 30000);
set("shen_type", -1);
set_skill("sword", 30);
set_skill("dodge", 30);
set_skill("parry", 30);
set_skill("strike", 30);
set_skill("unarmed", 30);
set_skill("force", 30);
set_skill("bixie-sword", 30);
set_skill("songfeng-jian", 30);
set_skill("chuanhua", 30);
set_skill("wuying-leg", 30);
set_skill("cuixin-strike", 30);
set_skill("qingming-xuangong", 30);
map_skill("force", "qingming-xuangong");
map_skill("unarmed", "wuying-leg");
map_skill("strike", "cuixin-strike");
map_skill("dodge", "chuanhua");
map_skill("parry", "bixie-sword");
map_skill("sword", "songfeng-jian");
prepare_skill("unarmed", "wuying-leg");
prepare_skill("strike", "cuixin-strike");
create_family("青城派", 6, "弟子");
setup();
carry_object("/clone/weapon/changjian")->wield();
carry_object("/d/wudang/obj/bluecloth")->wear();
}
| [
"[email protected]"
] | |
117dda825a48231066761cb4eff283458106c694 | 1c6d58e5b2bbce4a457350302fa9845f43f076a2 | /C Programming/Homework 004/HWK 003 - Number game .c | d362ca82b8d26ac66949e1396ba36277aa51a909 | [] | no_license | Daviswww/Toys | fa8b481bf5106a0f984c6bfd5260f3ec55ccee1d | 680c260ebb8d385a3dbcdd985a447fd5d2b74f3b | refs/heads/master | 2022-07-21T03:35:41.590248 | 2020-01-11T11:04:02 | 2020-01-11T11:04:02 | 144,127,014 | 0 | 0 | null | 2022-06-22T00:05:19 | 2018-08-09T08:57:15 | Python | WINDOWS-1252 | C | false | false | 1,660 | c | // ½sĶ¾¹¡GDev C++
// ¤é´Á¡G2016/12/18
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 100
void random_array(int a[], int n) {
int i, j;
for (i = 0; i < n; i++) {
a[i] = rand() % n + 1;
for (j = 0; j < i; j++)
if (a[i] == a[j]) {
--i;
break;
}
}
}
void print_array(int a[], int b[], int n) {
int i;
for (i = 0; i < n; i++) b[i] == 1 ? printf(" %d", a[i]) : printf(" *");
puts("");
}
int main(void) {
int a[SIZE], b[SIZE] = {0};
int n, i, p, q,r,comp = 0,play = 0;
srand(time(0));
printf("Enter n: ");
scanf("%d", &n);
random_array(a, n);
print_array(a, b, n);
/*
Enter n: 6
* * * * * *
*/
for(i = 0; i < n/2; i++) {
do {
printf("Pick a number: ");
scanf("%d", &p);
} while (b[p - 1] == 1);
b[p - 1] = 1;
//play Pick
do {
r = rand() % n + 1;
} while (b[r - 1] == 1);
b[r - 1] = 1;
//comp Pick
print_array(a, b, n);
printf("Player: %d Computer: %d\n", a[p - 1] , a[r - 1]); //Player: x Computer: x
if(a[p - 1] > a[r - 1]) {
play += a[p - 1] + a[r - 1];
printf("The player wins %d points.\n",play);
}//The player wins x points.
if(a[p - 1] < a[r - 1]) {
comp += a[p - 1] + a[r - 1];
printf("The computer wins %d points.\n",comp);
}//The computer wins x points.
}
printf("The player gets total %d points.\n",play);
printf("The computer gets total %d points.\n",comp);
if(play > comp) printf("The player wins the game.\n");
if(play < comp) printf("The computer wins the game.\n");
system("pause");
}
| [
"[email protected]"
] | |
9f33a1a8e28a43e5d562f8b0398e077b4ebbf832 | c88abbd5fae09a847d67c0d58778693467c725fc | /memory.c | fb583422c67bf4599cb320fc8a51b105f9c85a44 | [] | no_license | cuibo10/my-practice | e212bbfcdca7edd566db5cccaac52e17aa30d307 | be147a512d0e588f04dfe0f8d4e48b707f7e8393 | refs/heads/master | 2020-03-21T02:30:41.309653 | 2015-11-19T16:21:55 | 2015-11-19T16:21:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C | false | false | 1,481 | c | /* =============================================================================
* Filename : memory.c
* Summary : handle of memory
* Compiler : gcc
*
* Version :
* Update :
* Date :
* Author :
* Org :
*
* History :
*
* ============================================================================*/
/*==============================================================================
* Header files
*=============================================================================*/
#include "memory.h"
/*==============================================================================
* Name : void* safe_malloc(size_t size)
* Abstr : malloc and initialize
* Params : size_t size : size of memory need
* Return : void * : pointer of the new memory
* Modify :
*=============================================================================*/
void* safe_malloc(size_t size)
{
void* p;
p = NULL;
p = malloc(size);
if (p == NULL) {
log_fatal(log_cat, "malloc fault !!!");
abort();
} else {
memset(p, 0x00, size);
}
return p;
}
/*==============================================================================
* Name : void safe_free(void* p)
* Abstr : Free memory
* Params : void* p : pointer of memory want to free
* Return :
* Modify :
*=============================================================================*/
void safe_free(void* p)
{
if (p) {
free(p);
p = NULL;
}
}
| [
"root@CentOS.(none)"
] | root@CentOS.(none) |