blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
357
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
58
| license_type
stringclasses 2
values | repo_name
stringlengths 4
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
58
| visit_date
timestamp[ns]date 2015-07-14 21:31:45
2023-09-06 10:45:08
| revision_date
timestamp[ns]date 1970-01-01 00:00:00
2023-09-05 23:26:37
| committer_date
timestamp[ns]date 1970-01-01 00:00:00
2023-09-05 23:26:37
| github_id
int64 966
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 24
values | gha_event_created_at
timestamp[ns]date 2012-06-07 00:51:45
2023-09-14 21:58:52
⌀ | gha_created_at
timestamp[ns]date 2008-02-03 21:17:16
2023-08-24 19:49:39
⌀ | gha_language
stringclasses 180
values | src_encoding
stringclasses 35
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 6
10.4M
| extension
stringclasses 121
values | filename
stringlengths 1
148
| content
stringlengths 6
10.4M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ea835f282cb71e5e2d18a1c986721f4621f9f80f
|
88fbe0d36c4ad56c27587aeba0f26f35351904dc
|
/Робота з DS18B20_HC12(безпровідна передача температури)/Test11/Test11/usart.c
|
77511127b06b0d0dc44db54df4e41d2d3ddf8c89
|
[] |
no_license
|
Vitech-UA/AVR-Libs
|
e5e66d4debce16562a86d335b383858f6eacbbaa
|
c668fd3a31975625f0fe481f1feba5e11507286b
|
refs/heads/main
| 2023-01-10T23:41:59.328123 | 2020-11-13T21:47:24 | 2020-11-13T21:47:24 | 312,690,722 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 1,187 |
c
|
usart.c
|
#include "usart.h"
void USART_ini (){
/*UBRRH = (unsigned char) (speed>>8);
UBRRL = (unsigned char) speed;
UCSRB = (1<<RXEN)|(1<<TXEN); // Вмикаємо прийом та передачу
UCSRB |=(0<<RXCIE); // Дозвіл переривання
UCSRA |=(1<<U2X);// Ввімкнення подвоєння частоти
UCSRC = (1<<URSEL)|(1<<USBS)|(1<<UCSZ1)|(1<<UCSZ0)|(0<<UPM1)|(0<<UPM0); //Звертаємось до UCSRC */
UBRRH = 0;
UBRRL = 51; //скорость обмена 9600 бод
//разр. прерыв при приеме, разр приема, разр передачи.
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
//обращаемся к регистру UCSRS, размер слова – 8 бит
UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0)|(1<<UPM0)|(1<<UPM1);
}
void USART_Transmit (unsigned char data){
while(!(UCSRA&(1<<UDRE)));
UDR=data;
}
void usart_putline(char *buffer)
{
while (*buffer!=0)
{
USART_Transmit(*buffer);
buffer++;
}
// Завершение строки символом возврата каретки, т.е. 0x0D и 0x0A
USART_Transmit(13);
USART_Transmit(10);
}
|
9c0fbc70ebb5d575d13aff31827669ce5fe6e1a3
|
54a87439b37140ae9a60e1fc30082b6d8e94c997
|
/doc/examples/rootlogon.C
|
55582c6c75d80515cc85677589a6db831dcf76ad
|
[] |
no_license
|
rhicspin/cnipol
|
4cf29b287186ac14852844ab3392edfd3f51f09b
|
506b26791215ad8acb5f9f526f072dcec35ca8dd
|
refs/heads/master
| 2022-01-19T03:06:35.558214 | 2019-02-28T18:37:33 | 2019-02-28T18:37:33 | 11,848,983 | 2 | 3 | null | 2021-11-02T23:44:37 | 2013-08-02T17:41:50 |
C++
|
UTF-8
|
C
| false | false | 275 |
c
|
rootlogon.C
|
void rootlogon()
{
char *cnipol_path = "../../";
gSystem->AddIncludePath(Form(" -I%sinc/ -I%scontrib/polarim-online/include/ -I%scontrib/root-helper/ ", cnipol_path, cnipol_path, cnipol_path));
gROOT->ProcessLine(Form(".L %sbuild/src/libcnipol.so", cnipol_path));
}
|
cfc6d3876d8596ac4e0775db9182e4e57ec58388
|
afc8d5a9b1c2dd476ea59a7211b455732806fdfd
|
/Configurations/WH3l/Full2017/toolkit/BDT/hww_WH3l_mvaBDT.C
|
2f121c5260cbd1b467fecc7db6e4337f443e74d2
|
[] |
no_license
|
latinos/PlotsConfigurations
|
6d88a5ad828dde4a7f45c68765081ed182fcda21
|
02417839021e2112e740607b0fb78e09b58c930f
|
refs/heads/master
| 2023-08-18T20:39:31.954943 | 2023-08-18T09:23:34 | 2023-08-18T09:23:34 | 39,819,875 | 10 | 63 | null | 2023-08-10T14:08:04 | 2015-07-28T07:36:50 |
Python
|
UTF-8
|
C
| false | false | 2,672 |
c
|
hww_WH3l_mvaBDT.C
|
#include <TMVA/Reader.h>
using namespace std;
TMVA::Reader* myreaderBDT = new TMVA::Reader();
float minmtw_wh3l_32 ;
float dphilllmet_32 ;
float pTWWW_32 ;
float mtwww_32 ;
float mindphi_lmet_32;
float pt1_32 ;
float pt2_32 ;
float pt3_32 ;
float zveto_3l_32 ;
float drllmin3l_32 ;
float mlll_32 ;
float mllmin3l_32 ;
float metPfType1_32 ;
float ptlll_32 ;
void initmyreaderBDT(){
myreaderBDT->AddVariable("minmtw_wh3l ",&minmtw_wh3l_32 );
myreaderBDT->AddVariable("dphilllmet ",&dphilllmet_32 );
myreaderBDT->AddVariable("pTWWW ",&pTWWW_32 );
myreaderBDT->AddVariable("mtwww ",&mtwww_32 );
myreaderBDT->AddVariable("mindphi_lmet",&mindphi_lmet_32);
myreaderBDT->AddVariable("pt1 ",&pt1_32 );
myreaderBDT->AddVariable("pt2 ",&pt2_32 );
myreaderBDT->AddVariable("pt3 ",&pt3_32 );
myreaderBDT->AddVariable("zveto_3l ",&zveto_3l_32 );
myreaderBDT->AddVariable("drllmin3l ",&drllmin3l_32 );
myreaderBDT->AddVariable("mlll ",&mlll_32 );
myreaderBDT->AddVariable("mllmin3l ",&mllmin3l_32 );
myreaderBDT->AddVariable("metPfType1 ",&metPfType1_32 );
myreaderBDT->AddVariable("ptlll ",&ptlll_32 );
TString direction = "";
direction = "/afs/cern.ch/work/p/pyu/HWAnalysis/wh3lFull2017/CMSSW_9_4_2/src/PlotsConfigurations/Configurations/WH3l/Full2017BDT/toolkit/BDT/weights/TMVAClassification_BDT.weights.xml";
cout<<direction<<endl;
myreaderBDT->BookMVA("BDT",direction);
}
float hww_VBF_mvaBDT(
float minmtw_wh3l_33 ,
float dphilllmet_33 ,
float pTWWW_33 ,
float mtwww_33 ,
float mindphi_lmet_33,
float pt1_33 ,
float pt2_33 ,
float pt3_33 ,
float zveto_3l_33 ,
float drllmin3l_33 ,
float mlll_33 ,
float mllmin3l_33 ,
float metPfType1_33 ,
float ptlll_33
){
minmtw_wh3l_32 = minmtw_wh3l_33 ;
dphilllmet_32 = dphilllmet_33 ;
pTWWW_32 = pTWWW_33 ;
mtwww_32 = mtwww_33 ;
mindphi_lmet_32 = mindphi_lmet_33;
pt1_32 = pt1_33 ;
pt2_32 = pt2_33 ;
pt3_32 = pt3_33 ;
zveto_3l_32 = zveto_3l_33 ;
drllmin3l_32 = drllmin3l_33 ;
mlll_32 = mlll_33 ;
mllmin3l_32 = mllmin3l_33 ;
metPfType1_32 = metPfType1_33 ;
ptlll_32 = ptlll_33 ;
return myreaderBDT->EvaluateMVA("BDT");
}
|
af9760f3a5d1c6164e0d9dd0d333682321e2969e
|
38cded05d80d8afc1968469f4f5c2b81be38697e
|
/src/d3d9/shaders/blit.vs.dxbc.h
|
7fc763dde1bf75df63b639f4b6cb63a17ddb00a7
|
[
"Zlib"
] |
permissive
|
dports/dxup
|
fd82b114cb1ed95df76be2703a62ec170c99c2db
|
e961838d3d0d5db02cd065b782ad890bf876ceef
|
refs/heads/master
| 2023-01-18T18:26:29.795663 | 2020-11-26T23:22:06 | 2020-11-26T23:22:06 | 316,339,822 | 0 | 0 |
NOASSERTION
| 2020-11-26T21:27:06 | 2020-11-26T21:26:18 | null |
UTF-8
|
C
| false | false | 5,755 |
h
|
blit.vs.dxbc.h
|
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_VertexID 0 x 0 VERTID uint x
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float xyzw
// TEXCOORD 0 xy 1 NONE float xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_input_sgv v0.x, vertex_id
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_temps 2
ieq r0.xy, v0.xxxx, l(3, 1, 0, 0)
movc r1.xyzw, r0.yyyy, l(-3.000000,-1.000000,0,1.000000), l(1.000000,-1.000000,0,1.000000)
movc o0.xyzw, r0.xxxx, l(1.000000,3.000000,0,1.000000), r1.xyzw
movc r0.yz, r0.yyyy, l(0,-1.000000,1.000000,0), l(0,1.000000,1.000000,0)
movc o1.xy, r0.xxxx, l(1.000000,-1.000000,0,0), r0.yzyy
ret
// Approximately 6 instruction slots used
#endif
const BYTE g_blit_vs[] =
{
68, 88, 66, 67, 69, 97,
255, 22, 169, 103, 36, 233,
18, 210, 147, 148, 123, 220,
208, 172, 1, 0, 0, 0,
20, 3, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
160, 0, 0, 0, 212, 0,
0, 0, 44, 1, 0, 0,
120, 2, 0, 0, 82, 68,
69, 70, 100, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
60, 0, 0, 0, 0, 5,
254, 255, 0, 1, 0, 0,
60, 0, 0, 0, 82, 68,
49, 49, 60, 0, 0, 0,
24, 0, 0, 0, 32, 0,
0, 0, 40, 0, 0, 0,
36, 0, 0, 0, 12, 0,
0, 0, 0, 0, 0, 0,
77, 105, 99, 114, 111, 115,
111, 102, 116, 32, 40, 82,
41, 32, 72, 76, 83, 76,
32, 83, 104, 97, 100, 101,
114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 49,
48, 46, 49, 0, 73, 83,
71, 78, 44, 0, 0, 0,
1, 0, 0, 0, 8, 0,
0, 0, 32, 0, 0, 0,
0, 0, 0, 0, 6, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 1, 1,
0, 0, 83, 86, 95, 86,
101, 114, 116, 101, 120, 73,
68, 0, 79, 83, 71, 78,
80, 0, 0, 0, 2, 0,
0, 0, 8, 0, 0, 0,
56, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
3, 0, 0, 0, 0, 0,
0, 0, 15, 0, 0, 0,
68, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 3, 12, 0, 0,
83, 86, 95, 80, 79, 83,
73, 84, 73, 79, 78, 0,
84, 69, 88, 67, 79, 79,
82, 68, 0, 171, 171, 171,
83, 72, 69, 88, 68, 1,
0, 0, 80, 0, 1, 0,
81, 0, 0, 0, 106, 8,
0, 1, 96, 0, 0, 4,
18, 16, 16, 0, 0, 0,
0, 0, 6, 0, 0, 0,
103, 0, 0, 4, 242, 32,
16, 0, 0, 0, 0, 0,
1, 0, 0, 0, 101, 0,
0, 3, 50, 32, 16, 0,
1, 0, 0, 0, 104, 0,
0, 2, 2, 0, 0, 0,
32, 0, 0, 10, 50, 0,
16, 0, 0, 0, 0, 0,
6, 16, 16, 0, 0, 0,
0, 0, 2, 64, 0, 0,
3, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 55, 0,
0, 15, 242, 0, 16, 0,
1, 0, 0, 0, 86, 5,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
64, 192, 0, 0, 128, 191,
0, 0, 0, 0, 0, 0,
128, 63, 2, 64, 0, 0,
0, 0, 128, 63, 0, 0,
128, 191, 0, 0, 0, 0,
0, 0, 128, 63, 55, 0,
0, 12, 242, 32, 16, 0,
0, 0, 0, 0, 6, 0,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
128, 63, 0, 0, 64, 64,
0, 0, 0, 0, 0, 0,
128, 63, 70, 14, 16, 0,
1, 0, 0, 0, 55, 0,
0, 15, 98, 0, 16, 0,
0, 0, 0, 0, 86, 5,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
0, 0, 0, 0, 128, 191,
0, 0, 128, 63, 0, 0,
0, 0, 2, 64, 0, 0,
0, 0, 0, 0, 0, 0,
128, 63, 0, 0, 128, 63,
0, 0, 0, 0, 55, 0,
0, 12, 50, 32, 16, 0,
1, 0, 0, 0, 6, 0,
16, 0, 0, 0, 0, 0,
2, 64, 0, 0, 0, 0,
128, 63, 0, 0, 128, 191,
0, 0, 0, 0, 0, 0,
0, 0, 150, 5, 16, 0,
0, 0, 0, 0, 62, 0,
0, 1, 83, 84, 65, 84,
148, 0, 0, 0, 6, 0,
0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
4, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0
};
|
122de41b0e0ead05a619e0dad889c0928d3851e9
|
dcf26a6bcf853a3f8f6f50f9379998ef4d8aad40
|
/vendor/hisi/hi35xx/third_party/uboot/arch/arm/cpu/arm926ejs/cpu.c
|
0ec9e173d4b685a69a0bcaecbb3f88647608006a
|
[] |
no_license
|
small-seven/testmem
|
c5f3202dce1c369e9d84cdaaccc2008b827c16d8
|
2771460c617439bd1be562ffdc94543ea170a736
|
refs/heads/main
| 2023-03-12T22:16:28.824577 | 2021-03-03T04:24:59 | 2021-03-03T04:24:59 | 343,847,762 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 194 |
c
|
cpu.c
|
#include <common.h>
#include <command.h>
#include <cpu_func.h>
#include <irq_func.h>
#include <asm/system.h>
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
#endif
|
4890c9825952700a88997b21a1c7fdde360572b6
|
e6d25584532901c58ad22ae8993e52b776879254
|
/CodingProject/m1_dice3.c
|
18accfe10ad7470707f2e58e130146f4fc2eda0b
|
[] |
no_license
|
nextop1029384756/coding
|
c8862fab999a171c9e8471ba93b45f66905cb32d
|
0b873deba48e4111975dac27939395a38391a043
|
refs/heads/main
| 2023-02-14T17:28:59.299714 | 2021-01-10T03:57:28 | 2021-01-10T03:57:28 | 303,025,825 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 370 |
c
|
m1_dice3.c
|
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int i, j, n;
char A[9];
for (j = 0; j < 3; j++)
{
int max = 0;
n = 1;
scanf("%s", A);
for (int i = 0; i < 8; i++) {
if (A[i] == A[i + 1])
{
n++;
}
else {
if (max < n) max = n;
n = 1;
}
}
printf("%d\n", max);
}
return 0;
}
|
da6e9e3f64fc189afff2ab73db70aa3687d0b28f
|
cfe69fc556729bdecf2118fa5bc329343c42ed80
|
/10.0.10240.16384/ntoskrnl/Functions/PopAllowAwayModeSettingCallback.c
|
5bd11232f8590528e7461c4c89c7e43286c4b590
|
[] |
no_license
|
Myprivateclonelibrary/W10M_unedited-decomp
|
8e5ec89a20e634ffc53457a40b0fd6d8a9e1757a
|
67b05851a3e262ff8a5d11ee50db34f28c350f16
|
refs/heads/main
| 2023-08-31T06:00:37.303105 | 2021-05-15T23:53:23 | 2021-05-15T23:53:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 443 |
c
|
PopAllowAwayModeSettingCallback.c
|
// PopAllowAwayModeSettingCallback
int __fastcall PopAllowAwayModeSettingCallback(unsigned int a1, _DWORD *a2, int a3)
{
int v3; // r5
v3 = -1073741811;
PopAcquirePolicyLock();
if ( !memcmp((unsigned int)&GUID_ALLOW_AWAYMODE, a1, 16) && a3 == 4 && a2 )
{
if ( *a2 )
return sub_81C538();
byte_61EC12 = 0;
if ( byte_61EC11 )
PopSetSystemState(4, 7);
v3 = 0;
}
PopReleasePolicyLock();
return v3;
}
|
fb85506a084a64875eb153757727769eaf99f85c
|
85b7a5cf7292d528339c35b4e84c9b90466edfd3
|
/programs/selectionsort.c
|
5eeab87a3b59040038bc6d526c43a552af0c6ce5
|
[] |
no_license
|
arnbsen/LearningSteps
|
37c24d11634f486ebe33b211d4c86fbb79ea9cbb
|
b099d22e1e2f5cecb23caeb74f4226506df6b7ef
|
refs/heads/master
| 2021-05-06T20:00:24.952100 | 2017-11-28T13:41:41 | 2017-11-28T13:41:41 | 112,245,157 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 954 |
c
|
selectionsort.c
|
//
// selectionsort.c
// programs
//
// Created by Arnab Sen on 29/02/16.
// Copyright © 2016 Arnab Sen. All rights reserved.
// Main difference b/w selection sort and bubble sort is that in bubble adjacent variables are changed but selection involves swapping.
// Does not work for same entries. Only for Different entries.Solved on 5/04/2016.
#include <stdio.h>
int main()
{
int a[100];
int i,j,k,l,m,n1,n2;
printf("Enter the lenght of the array \n");
scanf("%d",&n1);
printf(" Enter the Array \n");
for (i=0; i<n1; i++) {
printf("Enter a decimal for a[%d] ",i);
scanf("%d",&a[i]);
}
for (i=0; i<n1; i++) {
l=a[i];n2=i;k=a[i];
for (j=i+1; j<n1; j++) {
if (a[j]<k) {n2=j;k=a[j];}
}
a[i]=a[n2];a[n2]=l;
}
printf("Combined Array \n");
for (m=0; m<n1; m++) {
printf("%d \t",a[m]);
}
printf("\n");
}
|
b87955091f02d9e8bfd397f8dbb1f02036320006
|
3567309d3f25020ec7a0d59e0ef55da7be113085
|
/d/coronos/w/angel/scianthian/path.h
|
e672bbe6fe159eaab9c256d9b73164b898adf2c7
|
[] |
no_license
|
flyingstupid/gbapoclib
|
64ec8b3828201d7eb158b5371164765d1b65ce93
|
dea2a4be3399509c7df44d33b2a307db3821017d
|
refs/heads/master
| 2021-04-27T08:02:48.717277 | 2018-02-23T17:04:11 | 2018-02-23T17:04:11 | 122,640,255 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 95 |
h
|
path.h
|
#define PATH "d/coronos/w/angel/scianthian/"
#define OBJ "d/coronos/w/angel/scianthian/obj/"
|
e006cf47b7cd424be06d50563df454536af121ce
|
b8fddb6d48dec0a9cc8e41c7095bd8c2c759184b
|
/src/jhd_core.c
|
255f47dac223f7d5dc9be69344c78d4c15df0bf1
|
[] |
no_license
|
saga810203/jhd
|
d08f3d92b26bf97b5102685dce44f477a258841b
|
71ebb7f6f0273948354a97c6e3458f19b70f2161
|
refs/heads/master
| 2020-03-16T22:01:52.862578 | 2018-12-04T13:57:47 | 2018-12-04T13:57:47 | 133,023,987 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 3,016 |
c
|
jhd_core.c
|
/*
* jhd_core.c
*
* Created on: May 22, 2018
* Author: root
*/
#include <jhd_config.h>
#include <jhd_core.h>
#include <jhd_event.h>
#include <jhd_queue.h>
#include <jhd_time.h>
#include <jhd_connection.h>
#include <tls/jhd_tls_config.h>
uint32_t jhd_core_master_startup_time;
sig_atomic_t jhd_single;
sig_atomic_t jhd_process;
sig_atomic_t jhd_quit;
sig_atomic_t jhd_reap;
sig_atomic_t jhd_restart;
sig_atomic_t jhd_daemonized;
char jhd_pid_file[1024];
jhd_queue_t jhd_master_startup_queue;
jhd_queue_t jhd_master_shutdown_queue;
jhd_queue_t jhd_worker_startup_queue;
jhd_queue_t jhd_worker_shutdown_queue;
void jhd_core_init() {
jhd_quit = 0;
jhd_restart = 0;
jhd_reap = 0;
jhd_daemonized = 0;
jhd_queue_init(&jhd_master_startup_queue);
jhd_queue_init(&jhd_master_shutdown_queue);
jhd_queue_init(&jhd_worker_startup_queue);
jhd_queue_init(&jhd_worker_shutdown_queue);
jhd_core_master_startup_time = 1000 * 60;
jhd_tls_config_init();
strcpy((char*)jhd_pid_file , "/run/jhttpd.pid");
}
int jhd_run_master_startup_listener() {
uint64_t begin_time;
jhd_listener_t *lis;
jhd_queue_t *q;
int ret;
jhd_update_time();
jhd_connection_init();
jhd_event_init();
begin_time = jhd_current_msec;
while (jhd_queue_head(&jhd_master_startup_queue)) {
q = jhd_queue_head(&jhd_master_startup_queue);
jhd_queue_only_remove(q);
lis = jhd_queue_data(q, jhd_listener_t, queue);
ret = lis->handler(lis);
if (ret == JHD_AGAIN) {
jhd_queue_insert_tail(&jhd_master_startup_queue, q);
} else if (ret == JHD_ERROR) {
return JHD_ERROR;
}
if ((jhd_core_master_startup_time > 0)) {
jhd_update_time();
if ((jhd_current_msec - begin_time) > jhd_core_master_startup_time) {
return JHD_ERROR;
}
}
}
return JHD_OK;
}
int jhd_run_worker_startup_listener() {
jhd_listener_t *lis;
jhd_queue_t *q;
int ret;
while (jhd_queue_head(&jhd_worker_startup_queue)) {
q = jhd_queue_head(&jhd_worker_startup_queue);
jhd_queue_only_remove(q);
lis = jhd_queue_data(q, jhd_listener_t, queue);
ret = lis->handler(lis);
if (ret == JHD_AGAIN) {
jhd_queue_insert_tail(&jhd_master_startup_queue, q);
} else if (ret == JHD_ERROR) {
return JHD_ERROR;
}
}
return JHD_OK;
}
void jhd_run_master_shutdown_listener() {
jhd_listener_t *lis;
jhd_queue_t *q;
int ret;
while (jhd_queue_head(&jhd_master_shutdown_queue)) {
q = jhd_queue_head(&jhd_master_shutdown_queue);
jhd_queue_only_remove(q);
lis = jhd_queue_data(q, jhd_listener_t, queue);
ret = lis->handler(lis);
if (ret == JHD_AGAIN) {
jhd_queue_insert_tail(&jhd_master_startup_queue, q);
}
}
}
void jhd_run_worker_shutdown_listener() {
jhd_listener_t *lis;
jhd_queue_t *q;
int ret;
while (jhd_queue_head(&jhd_worker_shutdown_queue)) {
q = jhd_queue_head(&jhd_worker_shutdown_queue);
jhd_queue_only_remove(q);
lis = jhd_queue_data(q, jhd_listener_t, queue);
ret = lis->handler(lis);
if (ret == JHD_AGAIN) {
jhd_queue_insert_tail(&jhd_master_startup_queue, q);
}
}
}
|
be233332e0dfd7fcaa7e3325924b98df6fc6f343
|
f8c61dec448da9a1b9365eeee089d72d591c5b7c
|
/include/eqn.h
|
28f23fc050b529823db8b442a82b170d1c4b852e
|
[
"BSD-2-Clause"
] |
permissive
|
CavendishAstrophysics/anmap
|
c8a136f9ae32bb74b022ca14eac940b847286f6a
|
efb611d7f80a3d14dc55e46cd01e8a622f6fd294
|
refs/heads/master
| 2021-01-25T09:00:21.380522 | 2014-11-27T00:31:16 | 2014-11-27T00:31:16 | 27,201,930 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 6,634 |
h
|
eqn.h
|
/*
* Copyright I guess there should be some copywrite for this package,
*
* Copyright (c) 1992
*
* Liverpool University Department of Pure Mathematics,
* Liverpool, L69 3BX, England.
*
* Author Dr R. J. Morris.
*
* e-mail [email protected]
*
* This software is copyrighted as noted above. It may be freely copied,
* modified, and redistributed, provided that the copyright notice is
* preserved on all copies.
*
* There is no warranty or other guarantee of fitness for this software,
* it is provided solely "as is". Bug reports or fixes may be sent
* to the authors, who may or may not act on them as they desire.
*
* You may not include this software in a program or other software product
* without supplying the source, or without informing the end-user that the
* source is available for no extra charge.
*
* If you modify this software, you should include a notice giving the
* name of the person performing the modification, the date of modification,
* and the reason for such modification.
*
* All this software is public domain, as long as it is not used by any military
* establishment. Please note if you are a military establishment then a mutating
* virus has now escaped into you computer and is presently turning all your
* programs into socially useful, peaceful ones.
*
*/
#ifndef EQN_HEADER
#define EQN_HEADER
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/* Codes used for the operator in equations and rpe's */
/* Can also have '+' '-' '*' '/' '^' '=' ',' */
#define NAME -23
#define NUMBER -24
#define INTERVAL -25
#define BRACKET -26
#define FUNCTION 3
/* Special codes used in rpe calculator */
#define SUM1 5
#define SUM2 6
#define SUM3 7
#define SUB1 8
#define SUB2 9
#define SUB3 10
#define DOT2 11
#define DOT3 12
#define CROSS3 13
#define SCALE2 14
#define SCALE3 15
#define MULT1 16
#define DIV1 17
#define POW1 18
#define INT_POW 19
#define EQUALS1 20
/* Maximum order for polynomials */
#define MAXORDER 25
/* Where to read an equation from */
#define EQNFROM_STDIN 1
#define EQNFROM_FILE 2
#define EQNFROM_STRING 3
/* The main type for equations */
struct Fnode; /* Forward def */
typedef struct Eqnode
{
short int op; /* The operator */
union
{
struct
{
struct Eqnode *l, *r; /* left + right sub trees */
} n;
struct
{
struct Fnode *f; /* Function */
struct Eqnode *a; /* Its arguments */
} f;
double num; /* Value for NUMBERS */
char *str; /* String for NAMES */
} u;
} eqnode;
typedef eqnode eqn_node;
typedef eqnode * eqn_ptr;
#define VARIABLE 1
#define PARAMETER 2
typedef struct Nnode /* a node about the list of names */
{
int type; /* The type of name */
char *str; /* The name */
struct Nnode *next; /* next name in list */
} eqn_names;
/* The list of functions */
#define EXTERN_FUN 4
#define INTERN_FUN 5
#define CONSTANT_FUN 6
#define OPERATOR 7
#define EXTERN_MAP 8
#define INTERN_MAP 9
typedef struct Fnode
{
short type; /* The type of function */
char *name; /* The name */
short nvars; /* The number of arguments */
short dim; /* Dimension of target space */
char **vars; /* The list of varible names */
double (*fun)(); /* Pointer to single valued function */
double *(*vfun)(); /* Pointer to multivalued mapping */
eqn_ptr (*op)(); /* Pointer to operator */
int *rpe; /* Reverse polish string */
int *vrpe; /* Vetor rpe mappings */
double val; /* Value of constant */
eqnode *eqn; /* The equation for the function */
eqnode **diff; /* Equations for each derivative */
struct Fnode *next; /* The next function in the list. */
} eqn_funs;
typedef int rpeint; /* The type used in rpe strings */
/* Definitions from eqnbase.c */
extern eqnode *scan_eqn(), *fscan_eqn(), *sscan_eqn(), *duplicate();
extern display_eqn(), print_eqn(), fprint_eqn();
extern copy_node(), free_eqn_tree(), free_eqn_node();
extern int count_eqn_tree(), count_eqn_args();
extern eqnode *get_eqn_arg(), *join_dup_eqns(), *join_eqns();
/* Definitions from eqnexpand.c */
extern clean_eqn(),eval_funs(),eval_ops();
extern int expand(), multiply_out(), devide_out(), raise_out();
/* Definition from eqndiff.c */
extern diff_wrt(), diff_fun_wrt();
extern eqnode *diff_wrt_eqn();
/* Definitions from eqnsubst.c */
extern substitute();
extern eqnode *assign();
/* Definitions from eqnpoly.c */
extern fprint_poly2(), print_poly2(), init_poly2(), order_poly2();
extern fprint_poly3(), print_poly3(), init_poly3(), order_poly3();
extern int add_to_poly2(), sub_from_poly2();
extern int add_to_poly3(), sub_from_poly3();
extern int eval_term2(), eval_term3();
/* Definitions from eqnrpe.c */
extern int make_rpe2(), check_rpe();
extern rpeint *make_rpe();
extern fprint_rpe(), print_rpe(), clear_rpe_const();
extern double eval_rpe();
/* Definitions from eqnvrpe.c */
extern int make_vrpe2(), check_vrpe();
extern rpeint *make_vrpe();
extern fprint_vrpe(), print_vrpe(), clear_vrpe_const();
extern double *eval_vrpe();
/* Definitions from eqnnames.c */
extern eqn_names *add_eqn_names();
extern print_eqn_names();
extern fprint_eqn_names();
extern int num_parameters();
extern void free_eqn_names();
extern int make_variable();
extern char *get_parameter();
/* Definitions from eqnfunct.c */
extern eqn_funs *add_external_function();
extern eqn_funs *add_internal_function();
extern eqn_funs *add_standard_functions();
extern eqn_funs *add_constant();
extern eqn_funs *add_operator();
extern fprint_funs();
extern int use_functions();
extern set_input_functions();
extern eqn_funs *get_input_functions();
/* Macros */
#define eqn_op(eqn) (eqn == NULL ? NULL : (eqn)->op)
#define eqn_l(eqn) (eqn == NULL ? NULL :(eqn)->u.n.l)
#define eqn_r(eqn) (eqn == NULL ? NULL :(eqn)->u.n.r)
#define eqn_val(eqn) (eqn == NULL ? NULL : (eqn)->op == NUMBER ? (eqn)->u.num : NULL)
#define eqn_name(eqn) (eqn == NULL ? NULL : (eqn)->op == NAME ? (eqn)->u.str : NULL)
#define eqn_fun(eqn) (eqn == NULL ? NULL : (eqn)->op == FUNCTION ? (eqn)->u.f.f : NULL)
#define eqn_arg(eqn) (eqn == NULL ? NULL : (eqn)->op == FUNCTION ? (eqn)->u.f.a : NULL)
#define eqnop(eqn) ((eqn)->op)
#define eqnl(eqn) ((eqn)->u.n.l)
#define eqnr(eqn) ((eqn)->u.n.r)
#define eqnval(eqn) ((eqn)->u.num)
#define eqnname(eqn) ((eqn)->u.str)
#define eqnfun(eqn) ((eqn)->u.f.f)
#define eqnarg(eqn) ((eqn)->u.f.a )
#define remove_eqn_name(namelist,name) make_varible(namelist,name)
#define num_eqn_names(namelist) num_parameters(namelist)
#define get_eqn_name(namelist,i) get_parameter(namelist,i)
#endif /* EQN_HEADER */
|
d338297a7fe6b3365d7ab13c63194c221f00695e
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/microchip/samc21/bsp/hri/hri_sdadc_c21.h
|
286e91101fa5db77b051526ad63c2e65c0209eea
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801 | 2023-08-31T16:20:55 | 2023-08-31T16:20:55 | 7,408,108 | 9,599 | 5,805 |
Apache-2.0
| 2023-09-14T13:37:26 | 2013-01-02T14:49:21 |
C
|
UTF-8
|
C
| false | false | 79,657 |
h
|
hri_sdadc_c21.h
|
/**
* \file
*
* \brief SAM SDADC
*
* Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
*
* Subject to your compliance with these terms, you may use Microchip
* software and any derivatives exclusively with Microchip products.
* It is your responsibility to comply with third party license terms applicable
* to your use of third party software (including open source software) that
* may accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* \asf_license_stop
*
*/
#ifdef _SAMC21_SDADC_COMPONENT_
#ifndef _HRI_SDADC_C21_H_INCLUDED_
#define _HRI_SDADC_C21_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <hal_atomic.h>
#if defined(ENABLE_SDADC_CRITICAL_SECTIONS)
#define SDADC_CRITICAL_SECTION_ENTER() CRITICAL_SECTION_ENTER()
#define SDADC_CRITICAL_SECTION_LEAVE() CRITICAL_SECTION_LEAVE()
#else
#define SDADC_CRITICAL_SECTION_ENTER()
#define SDADC_CRITICAL_SECTION_LEAVE()
#endif
typedef uint16_t hri_sdadc_ctrlb_reg_t;
typedef uint16_t hri_sdadc_gaincorr_reg_t;
typedef uint32_t hri_sdadc_offsetcorr_reg_t;
typedef uint32_t hri_sdadc_result_reg_t;
typedef uint32_t hri_sdadc_syncbusy_reg_t;
typedef uint32_t hri_sdadc_winlt_reg_t;
typedef uint32_t hri_sdadc_winut_reg_t;
typedef uint8_t hri_sdadc_anactrl_reg_t;
typedef uint8_t hri_sdadc_ctrla_reg_t;
typedef uint8_t hri_sdadc_ctrlc_reg_t;
typedef uint8_t hri_sdadc_dbgctrl_reg_t;
typedef uint8_t hri_sdadc_evctrl_reg_t;
typedef uint8_t hri_sdadc_inputctrl_reg_t;
typedef uint8_t hri_sdadc_intenset_reg_t;
typedef uint8_t hri_sdadc_intflag_reg_t;
typedef uint8_t hri_sdadc_refctrl_reg_t;
typedef uint8_t hri_sdadc_seqctrl_reg_t;
typedef uint8_t hri_sdadc_seqstatus_reg_t;
typedef uint8_t hri_sdadc_shiftcorr_reg_t;
typedef uint8_t hri_sdadc_swtrig_reg_t;
typedef uint8_t hri_sdadc_winctrl_reg_t;
static inline void hri_sdadc_wait_for_sync(const void *const hw, hri_sdadc_syncbusy_reg_t reg)
{
while (((Sdadc *)hw)->SYNCBUSY.reg & reg) {
};
}
static inline bool hri_sdadc_is_syncing(const void *const hw, hri_sdadc_syncbusy_reg_t reg)
{
return ((Sdadc *)hw)->SYNCBUSY.reg & reg;
}
static inline bool hri_sdadc_get_INTFLAG_RESRDY_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_RESRDY) >> SDADC_INTFLAG_RESRDY_Pos;
}
static inline void hri_sdadc_clear_INTFLAG_RESRDY_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_RESRDY;
}
static inline bool hri_sdadc_get_INTFLAG_OVERRUN_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_OVERRUN) >> SDADC_INTFLAG_OVERRUN_Pos;
}
static inline void hri_sdadc_clear_INTFLAG_OVERRUN_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_OVERRUN;
}
static inline bool hri_sdadc_get_INTFLAG_WINMON_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_WINMON) >> SDADC_INTFLAG_WINMON_Pos;
}
static inline void hri_sdadc_clear_INTFLAG_WINMON_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_WINMON;
}
static inline bool hri_sdadc_get_interrupt_RESRDY_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_RESRDY) >> SDADC_INTFLAG_RESRDY_Pos;
}
static inline void hri_sdadc_clear_interrupt_RESRDY_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_RESRDY;
}
static inline bool hri_sdadc_get_interrupt_OVERRUN_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_OVERRUN) >> SDADC_INTFLAG_OVERRUN_Pos;
}
static inline void hri_sdadc_clear_interrupt_OVERRUN_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_OVERRUN;
}
static inline bool hri_sdadc_get_interrupt_WINMON_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTFLAG.reg & SDADC_INTFLAG_WINMON) >> SDADC_INTFLAG_WINMON_Pos;
}
static inline void hri_sdadc_clear_interrupt_WINMON_bit(const void *const hw)
{
((Sdadc *)hw)->INTFLAG.reg = SDADC_INTFLAG_WINMON;
}
static inline hri_sdadc_intflag_reg_t hri_sdadc_get_INTFLAG_reg(const void *const hw, hri_sdadc_intflag_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->INTFLAG.reg;
tmp &= mask;
return tmp;
}
static inline hri_sdadc_intflag_reg_t hri_sdadc_read_INTFLAG_reg(const void *const hw)
{
return ((Sdadc *)hw)->INTFLAG.reg;
}
static inline void hri_sdadc_clear_INTFLAG_reg(const void *const hw, hri_sdadc_intflag_reg_t mask)
{
((Sdadc *)hw)->INTFLAG.reg = mask;
}
static inline void hri_sdadc_set_INTEN_RESRDY_bit(const void *const hw)
{
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_RESRDY;
}
static inline bool hri_sdadc_get_INTEN_RESRDY_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTENSET.reg & SDADC_INTENSET_RESRDY) >> SDADC_INTENSET_RESRDY_Pos;
}
static inline void hri_sdadc_write_INTEN_RESRDY_bit(const void *const hw, bool value)
{
if (value == 0x0) {
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_RESRDY;
} else {
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_RESRDY;
}
}
static inline void hri_sdadc_clear_INTEN_RESRDY_bit(const void *const hw)
{
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_RESRDY;
}
static inline void hri_sdadc_set_INTEN_OVERRUN_bit(const void *const hw)
{
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_OVERRUN;
}
static inline bool hri_sdadc_get_INTEN_OVERRUN_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTENSET.reg & SDADC_INTENSET_OVERRUN) >> SDADC_INTENSET_OVERRUN_Pos;
}
static inline void hri_sdadc_write_INTEN_OVERRUN_bit(const void *const hw, bool value)
{
if (value == 0x0) {
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_OVERRUN;
} else {
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_OVERRUN;
}
}
static inline void hri_sdadc_clear_INTEN_OVERRUN_bit(const void *const hw)
{
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_OVERRUN;
}
static inline void hri_sdadc_set_INTEN_WINMON_bit(const void *const hw)
{
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_WINMON;
}
static inline bool hri_sdadc_get_INTEN_WINMON_bit(const void *const hw)
{
return (((Sdadc *)hw)->INTENSET.reg & SDADC_INTENSET_WINMON) >> SDADC_INTENSET_WINMON_Pos;
}
static inline void hri_sdadc_write_INTEN_WINMON_bit(const void *const hw, bool value)
{
if (value == 0x0) {
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_WINMON;
} else {
((Sdadc *)hw)->INTENSET.reg = SDADC_INTENSET_WINMON;
}
}
static inline void hri_sdadc_clear_INTEN_WINMON_bit(const void *const hw)
{
((Sdadc *)hw)->INTENCLR.reg = SDADC_INTENSET_WINMON;
}
static inline void hri_sdadc_set_INTEN_reg(const void *const hw, hri_sdadc_intenset_reg_t mask)
{
((Sdadc *)hw)->INTENSET.reg = mask;
}
static inline hri_sdadc_intenset_reg_t hri_sdadc_get_INTEN_reg(const void *const hw, hri_sdadc_intenset_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->INTENSET.reg;
tmp &= mask;
return tmp;
}
static inline hri_sdadc_intenset_reg_t hri_sdadc_read_INTEN_reg(const void *const hw)
{
return ((Sdadc *)hw)->INTENSET.reg;
}
static inline void hri_sdadc_write_INTEN_reg(const void *const hw, hri_sdadc_intenset_reg_t data)
{
((Sdadc *)hw)->INTENSET.reg = data;
((Sdadc *)hw)->INTENCLR.reg = ~data;
}
static inline void hri_sdadc_clear_INTEN_reg(const void *const hw, hri_sdadc_intenset_reg_t mask)
{
((Sdadc *)hw)->INTENCLR.reg = mask;
}
static inline bool hri_sdadc_get_SEQSTATUS_SEQBUSY_bit(const void *const hw)
{
return (((Sdadc *)hw)->SEQSTATUS.reg & SDADC_SEQSTATUS_SEQBUSY) >> SDADC_SEQSTATUS_SEQBUSY_Pos;
}
static inline hri_sdadc_seqstatus_reg_t hri_sdadc_get_SEQSTATUS_SEQSTATE_bf(const void *const hw,
hri_sdadc_seqstatus_reg_t mask)
{
return (((Sdadc *)hw)->SEQSTATUS.reg & SDADC_SEQSTATUS_SEQSTATE(mask)) >> SDADC_SEQSTATUS_SEQSTATE_Pos;
}
static inline hri_sdadc_seqstatus_reg_t hri_sdadc_read_SEQSTATUS_SEQSTATE_bf(const void *const hw)
{
return (((Sdadc *)hw)->SEQSTATUS.reg & SDADC_SEQSTATUS_SEQSTATE_Msk) >> SDADC_SEQSTATUS_SEQSTATE_Pos;
}
static inline hri_sdadc_seqstatus_reg_t hri_sdadc_get_SEQSTATUS_reg(const void *const hw,
hri_sdadc_seqstatus_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SEQSTATUS.reg;
tmp &= mask;
return tmp;
}
static inline hri_sdadc_seqstatus_reg_t hri_sdadc_read_SEQSTATUS_reg(const void *const hw)
{
return ((Sdadc *)hw)->SEQSTATUS.reg;
}
static inline bool hri_sdadc_get_SYNCBUSY_SWRST_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_SWRST) >> SDADC_SYNCBUSY_SWRST_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_ENABLE_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_ENABLE) >> SDADC_SYNCBUSY_ENABLE_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_CTRLC_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_CTRLC) >> SDADC_SYNCBUSY_CTRLC_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_INPUTCTRL_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_INPUTCTRL) >> SDADC_SYNCBUSY_INPUTCTRL_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_WINCTRL_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_WINCTRL) >> SDADC_SYNCBUSY_WINCTRL_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_WINLT_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_WINLT) >> SDADC_SYNCBUSY_WINLT_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_WINUT_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_WINUT) >> SDADC_SYNCBUSY_WINUT_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_OFFSETCORR_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_OFFSETCORR) >> SDADC_SYNCBUSY_OFFSETCORR_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_GAINCORR_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_GAINCORR) >> SDADC_SYNCBUSY_GAINCORR_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_SHIFTCORR_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_SHIFTCORR) >> SDADC_SYNCBUSY_SHIFTCORR_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_SWTRIG_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_SWTRIG) >> SDADC_SYNCBUSY_SWTRIG_Pos;
}
static inline bool hri_sdadc_get_SYNCBUSY_ANACTRL_bit(const void *const hw)
{
return (((Sdadc *)hw)->SYNCBUSY.reg & SDADC_SYNCBUSY_ANACTRL) >> SDADC_SYNCBUSY_ANACTRL_Pos;
}
static inline hri_sdadc_syncbusy_reg_t hri_sdadc_get_SYNCBUSY_reg(const void *const hw, hri_sdadc_syncbusy_reg_t mask)
{
uint32_t tmp;
tmp = ((Sdadc *)hw)->SYNCBUSY.reg;
tmp &= mask;
return tmp;
}
static inline hri_sdadc_syncbusy_reg_t hri_sdadc_read_SYNCBUSY_reg(const void *const hw)
{
return ((Sdadc *)hw)->SYNCBUSY.reg;
}
static inline hri_sdadc_result_reg_t hri_sdadc_get_RESULT_RESULT_bf(const void *const hw, hri_sdadc_result_reg_t mask)
{
return (((Sdadc *)hw)->RESULT.reg & SDADC_RESULT_RESULT(mask)) >> SDADC_RESULT_RESULT_Pos;
}
static inline hri_sdadc_result_reg_t hri_sdadc_read_RESULT_RESULT_bf(const void *const hw)
{
return (((Sdadc *)hw)->RESULT.reg & SDADC_RESULT_RESULT_Msk) >> SDADC_RESULT_RESULT_Pos;
}
static inline hri_sdadc_result_reg_t hri_sdadc_get_RESULT_RESERVED_bf(const void *const hw, hri_sdadc_result_reg_t mask)
{
return (((Sdadc *)hw)->RESULT.reg & SDADC_RESULT_RESERVED(mask)) >> SDADC_RESULT_RESERVED_Pos;
}
static inline hri_sdadc_result_reg_t hri_sdadc_read_RESULT_RESERVED_bf(const void *const hw)
{
return (((Sdadc *)hw)->RESULT.reg & SDADC_RESULT_RESERVED_Msk) >> SDADC_RESULT_RESERVED_Pos;
}
static inline hri_sdadc_result_reg_t hri_sdadc_get_RESULT_reg(const void *const hw, hri_sdadc_result_reg_t mask)
{
uint32_t tmp;
tmp = ((Sdadc *)hw)->RESULT.reg;
tmp &= mask;
return tmp;
}
static inline hri_sdadc_result_reg_t hri_sdadc_read_RESULT_reg(const void *const hw)
{
return ((Sdadc *)hw)->RESULT.reg;
}
static inline void hri_sdadc_set_CTRLA_SWRST_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg |= SDADC_CTRLA_SWRST;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_CTRLA_SWRST_bit(const void *const hw)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST);
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp = (tmp & SDADC_CTRLA_SWRST) >> SDADC_CTRLA_SWRST_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_set_CTRLA_ENABLE_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg |= SDADC_CTRLA_ENABLE;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_CTRLA_ENABLE_bit(const void *const hw)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp = (tmp & SDADC_CTRLA_ENABLE) >> SDADC_CTRLA_ENABLE_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_CTRLA_ENABLE_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp &= ~SDADC_CTRLA_ENABLE;
tmp |= value << SDADC_CTRLA_ENABLE_Pos;
((Sdadc *)hw)->CTRLA.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLA_ENABLE_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg &= ~SDADC_CTRLA_ENABLE;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLA_ENABLE_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg ^= SDADC_CTRLA_ENABLE;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_CTRLA_RUNSTDBY_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg |= SDADC_CTRLA_RUNSTDBY;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_CTRLA_RUNSTDBY_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp = (tmp & SDADC_CTRLA_RUNSTDBY) >> SDADC_CTRLA_RUNSTDBY_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_CTRLA_RUNSTDBY_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp &= ~SDADC_CTRLA_RUNSTDBY;
tmp |= value << SDADC_CTRLA_RUNSTDBY_Pos;
((Sdadc *)hw)->CTRLA.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLA_RUNSTDBY_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg &= ~SDADC_CTRLA_RUNSTDBY;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLA_RUNSTDBY_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg ^= SDADC_CTRLA_RUNSTDBY;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_CTRLA_ONDEMAND_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg |= SDADC_CTRLA_ONDEMAND;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_CTRLA_ONDEMAND_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp = (tmp & SDADC_CTRLA_ONDEMAND) >> SDADC_CTRLA_ONDEMAND_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_CTRLA_ONDEMAND_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp &= ~SDADC_CTRLA_ONDEMAND;
tmp |= value << SDADC_CTRLA_ONDEMAND_Pos;
((Sdadc *)hw)->CTRLA.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLA_ONDEMAND_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg &= ~SDADC_CTRLA_ONDEMAND;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLA_ONDEMAND_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg ^= SDADC_CTRLA_ONDEMAND;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_CTRLA_reg(const void *const hw, hri_sdadc_ctrla_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrla_reg_t hri_sdadc_get_CTRLA_reg(const void *const hw, hri_sdadc_ctrla_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
tmp = ((Sdadc *)hw)->CTRLA.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_CTRLA_reg(const void *const hw, hri_sdadc_ctrla_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLA_reg(const void *const hw, hri_sdadc_ctrla_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLA_reg(const void *const hw, hri_sdadc_ctrla_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLA.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrla_reg_t hri_sdadc_read_CTRLA_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SWRST | SDADC_SYNCBUSY_ENABLE);
return ((Sdadc *)hw)->CTRLA.reg;
}
static inline void hri_sdadc_set_REFCTRL_ONREFBUF_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg |= SDADC_REFCTRL_ONREFBUF;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_REFCTRL_ONREFBUF_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp = (tmp & SDADC_REFCTRL_ONREFBUF) >> SDADC_REFCTRL_ONREFBUF_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_REFCTRL_ONREFBUF_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp &= ~SDADC_REFCTRL_ONREFBUF;
tmp |= value << SDADC_REFCTRL_ONREFBUF_Pos;
((Sdadc *)hw)->REFCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_REFCTRL_ONREFBUF_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg &= ~SDADC_REFCTRL_ONREFBUF;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_REFCTRL_ONREFBUF_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg ^= SDADC_REFCTRL_ONREFBUF;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_REFCTRL_REFSEL_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg |= SDADC_REFCTRL_REFSEL(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_get_REFCTRL_REFSEL_bf(const void *const hw,
hri_sdadc_refctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp = (tmp & SDADC_REFCTRL_REFSEL(mask)) >> SDADC_REFCTRL_REFSEL_Pos;
return tmp;
}
static inline void hri_sdadc_write_REFCTRL_REFSEL_bf(const void *const hw, hri_sdadc_refctrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp &= ~SDADC_REFCTRL_REFSEL_Msk;
tmp |= SDADC_REFCTRL_REFSEL(data);
((Sdadc *)hw)->REFCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_REFCTRL_REFSEL_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg &= ~SDADC_REFCTRL_REFSEL(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_REFCTRL_REFSEL_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg ^= SDADC_REFCTRL_REFSEL(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_read_REFCTRL_REFSEL_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp = (tmp & SDADC_REFCTRL_REFSEL_Msk) >> SDADC_REFCTRL_REFSEL_Pos;
return tmp;
}
static inline void hri_sdadc_set_REFCTRL_REFRANGE_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg |= SDADC_REFCTRL_REFRANGE(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_get_REFCTRL_REFRANGE_bf(const void *const hw,
hri_sdadc_refctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp = (tmp & SDADC_REFCTRL_REFRANGE(mask)) >> SDADC_REFCTRL_REFRANGE_Pos;
return tmp;
}
static inline void hri_sdadc_write_REFCTRL_REFRANGE_bf(const void *const hw, hri_sdadc_refctrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp &= ~SDADC_REFCTRL_REFRANGE_Msk;
tmp |= SDADC_REFCTRL_REFRANGE(data);
((Sdadc *)hw)->REFCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_REFCTRL_REFRANGE_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg &= ~SDADC_REFCTRL_REFRANGE(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_REFCTRL_REFRANGE_bf(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg ^= SDADC_REFCTRL_REFRANGE(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_read_REFCTRL_REFRANGE_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp = (tmp & SDADC_REFCTRL_REFRANGE_Msk) >> SDADC_REFCTRL_REFRANGE_Pos;
return tmp;
}
static inline void hri_sdadc_set_REFCTRL_reg(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg |= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_get_REFCTRL_reg(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->REFCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_REFCTRL_reg(const void *const hw, hri_sdadc_refctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg = data;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_REFCTRL_reg(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg &= ~mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_REFCTRL_reg(const void *const hw, hri_sdadc_refctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->REFCTRL.reg ^= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_refctrl_reg_t hri_sdadc_read_REFCTRL_reg(const void *const hw)
{
return ((Sdadc *)hw)->REFCTRL.reg;
}
static inline void hri_sdadc_set_CTRLB_PRESCALER_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg |= SDADC_CTRLB_PRESCALER(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_get_CTRLB_PRESCALER_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_PRESCALER(mask)) >> SDADC_CTRLB_PRESCALER_Pos;
return tmp;
}
static inline void hri_sdadc_write_CTRLB_PRESCALER_bf(const void *const hw, hri_sdadc_ctrlb_reg_t data)
{
uint16_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp &= ~SDADC_CTRLB_PRESCALER_Msk;
tmp |= SDADC_CTRLB_PRESCALER(data);
((Sdadc *)hw)->CTRLB.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLB_PRESCALER_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg &= ~SDADC_CTRLB_PRESCALER(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLB_PRESCALER_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg ^= SDADC_CTRLB_PRESCALER(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_read_CTRLB_PRESCALER_bf(const void *const hw)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_PRESCALER_Msk) >> SDADC_CTRLB_PRESCALER_Pos;
return tmp;
}
static inline void hri_sdadc_set_CTRLB_OSR_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg |= SDADC_CTRLB_OSR(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_get_CTRLB_OSR_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_OSR(mask)) >> SDADC_CTRLB_OSR_Pos;
return tmp;
}
static inline void hri_sdadc_write_CTRLB_OSR_bf(const void *const hw, hri_sdadc_ctrlb_reg_t data)
{
uint16_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp &= ~SDADC_CTRLB_OSR_Msk;
tmp |= SDADC_CTRLB_OSR(data);
((Sdadc *)hw)->CTRLB.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLB_OSR_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg &= ~SDADC_CTRLB_OSR(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLB_OSR_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg ^= SDADC_CTRLB_OSR(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_read_CTRLB_OSR_bf(const void *const hw)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_OSR_Msk) >> SDADC_CTRLB_OSR_Pos;
return tmp;
}
static inline void hri_sdadc_set_CTRLB_SKPCNT_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg |= SDADC_CTRLB_SKPCNT(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_get_CTRLB_SKPCNT_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_SKPCNT(mask)) >> SDADC_CTRLB_SKPCNT_Pos;
return tmp;
}
static inline void hri_sdadc_write_CTRLB_SKPCNT_bf(const void *const hw, hri_sdadc_ctrlb_reg_t data)
{
uint16_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp &= ~SDADC_CTRLB_SKPCNT_Msk;
tmp |= SDADC_CTRLB_SKPCNT(data);
((Sdadc *)hw)->CTRLB.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLB_SKPCNT_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg &= ~SDADC_CTRLB_SKPCNT(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLB_SKPCNT_bf(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg ^= SDADC_CTRLB_SKPCNT(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_read_CTRLB_SKPCNT_bf(const void *const hw)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp = (tmp & SDADC_CTRLB_SKPCNT_Msk) >> SDADC_CTRLB_SKPCNT_Pos;
return tmp;
}
static inline void hri_sdadc_set_CTRLB_reg(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg |= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_get_CTRLB_reg(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
uint16_t tmp;
tmp = ((Sdadc *)hw)->CTRLB.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_CTRLB_reg(const void *const hw, hri_sdadc_ctrlb_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg = data;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLB_reg(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg &= ~mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLB_reg(const void *const hw, hri_sdadc_ctrlb_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLB.reg ^= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlb_reg_t hri_sdadc_read_CTRLB_reg(const void *const hw)
{
return ((Sdadc *)hw)->CTRLB.reg;
}
static inline void hri_sdadc_set_EVCTRL_FLUSHEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_FLUSHEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_FLUSHEI_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_FLUSHEI) >> SDADC_EVCTRL_FLUSHEI_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_FLUSHEI_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_FLUSHEI;
tmp |= value << SDADC_EVCTRL_FLUSHEI_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_FLUSHEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_FLUSHEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_FLUSHEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_FLUSHEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_STARTEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_STARTEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_STARTEI_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_STARTEI) >> SDADC_EVCTRL_STARTEI_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_STARTEI_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_STARTEI;
tmp |= value << SDADC_EVCTRL_STARTEI_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_STARTEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_STARTEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_STARTEI_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_STARTEI;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_FLUSHINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_FLUSHINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_FLUSHINV_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_FLUSHINV) >> SDADC_EVCTRL_FLUSHINV_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_FLUSHINV_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_FLUSHINV;
tmp |= value << SDADC_EVCTRL_FLUSHINV_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_FLUSHINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_FLUSHINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_FLUSHINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_FLUSHINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_STARTINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_STARTINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_STARTINV_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_STARTINV) >> SDADC_EVCTRL_STARTINV_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_STARTINV_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_STARTINV;
tmp |= value << SDADC_EVCTRL_STARTINV_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_STARTINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_STARTINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_STARTINV_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_STARTINV;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_RESRDYEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_RESRDYEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_RESRDYEO_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_RESRDYEO) >> SDADC_EVCTRL_RESRDYEO_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_RESRDYEO_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_RESRDYEO;
tmp |= value << SDADC_EVCTRL_RESRDYEO_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_RESRDYEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_RESRDYEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_RESRDYEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_RESRDYEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_WINMONEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= SDADC_EVCTRL_WINMONEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_EVCTRL_WINMONEO_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp = (tmp & SDADC_EVCTRL_WINMONEO) >> SDADC_EVCTRL_WINMONEO_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_EVCTRL_WINMONEO_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= ~SDADC_EVCTRL_WINMONEO;
tmp |= value << SDADC_EVCTRL_WINMONEO_Pos;
((Sdadc *)hw)->EVCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_WINMONEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~SDADC_EVCTRL_WINMONEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_WINMONEO_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= SDADC_EVCTRL_WINMONEO;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_EVCTRL_reg(const void *const hw, hri_sdadc_evctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg |= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_evctrl_reg_t hri_sdadc_get_EVCTRL_reg(const void *const hw, hri_sdadc_evctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->EVCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_EVCTRL_reg(const void *const hw, hri_sdadc_evctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg = data;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_EVCTRL_reg(const void *const hw, hri_sdadc_evctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg &= ~mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_EVCTRL_reg(const void *const hw, hri_sdadc_evctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->EVCTRL.reg ^= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_evctrl_reg_t hri_sdadc_read_EVCTRL_reg(const void *const hw)
{
return ((Sdadc *)hw)->EVCTRL.reg;
}
static inline void hri_sdadc_set_INPUTCTRL_MUXSEL_bf(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg |= SDADC_INPUTCTRL_MUXSEL(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_inputctrl_reg_t hri_sdadc_get_INPUTCTRL_MUXSEL_bf(const void *const hw,
hri_sdadc_inputctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->INPUTCTRL.reg;
tmp = (tmp & SDADC_INPUTCTRL_MUXSEL(mask)) >> SDADC_INPUTCTRL_MUXSEL_Pos;
return tmp;
}
static inline void hri_sdadc_write_INPUTCTRL_MUXSEL_bf(const void *const hw, hri_sdadc_inputctrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->INPUTCTRL.reg;
tmp &= ~SDADC_INPUTCTRL_MUXSEL_Msk;
tmp |= SDADC_INPUTCTRL_MUXSEL(data);
((Sdadc *)hw)->INPUTCTRL.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_INPUTCTRL_MUXSEL_bf(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg &= ~SDADC_INPUTCTRL_MUXSEL(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_INPUTCTRL_MUXSEL_bf(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg ^= SDADC_INPUTCTRL_MUXSEL(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_inputctrl_reg_t hri_sdadc_read_INPUTCTRL_MUXSEL_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->INPUTCTRL.reg;
tmp = (tmp & SDADC_INPUTCTRL_MUXSEL_Msk) >> SDADC_INPUTCTRL_MUXSEL_Pos;
return tmp;
}
static inline void hri_sdadc_set_INPUTCTRL_reg(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_inputctrl_reg_t hri_sdadc_get_INPUTCTRL_reg(const void *const hw,
hri_sdadc_inputctrl_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
tmp = ((Sdadc *)hw)->INPUTCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_INPUTCTRL_reg(const void *const hw, hri_sdadc_inputctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_INPUTCTRL_reg(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_INPUTCTRL_reg(const void *const hw, hri_sdadc_inputctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->INPUTCTRL.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_inputctrl_reg_t hri_sdadc_read_INPUTCTRL_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
return ((Sdadc *)hw)->INPUTCTRL.reg;
}
static inline void hri_sdadc_set_CTRLC_FREERUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg |= SDADC_CTRLC_FREERUN;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_CTRLC_FREERUN_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->CTRLC.reg;
tmp = (tmp & SDADC_CTRLC_FREERUN) >> SDADC_CTRLC_FREERUN_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_CTRLC_FREERUN_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->CTRLC.reg;
tmp &= ~SDADC_CTRLC_FREERUN;
tmp |= value << SDADC_CTRLC_FREERUN_Pos;
((Sdadc *)hw)->CTRLC.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLC_FREERUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg &= ~SDADC_CTRLC_FREERUN;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLC_FREERUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg ^= SDADC_CTRLC_FREERUN;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_CTRLC_reg(const void *const hw, hri_sdadc_ctrlc_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlc_reg_t hri_sdadc_get_CTRLC_reg(const void *const hw, hri_sdadc_ctrlc_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
tmp = ((Sdadc *)hw)->CTRLC.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_CTRLC_reg(const void *const hw, hri_sdadc_ctrlc_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_CTRLC_reg(const void *const hw, hri_sdadc_ctrlc_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_CTRLC_reg(const void *const hw, hri_sdadc_ctrlc_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->CTRLC.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_ctrlc_reg_t hri_sdadc_read_CTRLC_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
return ((Sdadc *)hw)->CTRLC.reg;
}
static inline void hri_sdadc_set_WINCTRL_WINMODE_bf(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg |= SDADC_WINCTRL_WINMODE(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winctrl_reg_t hri_sdadc_get_WINCTRL_WINMODE_bf(const void *const hw,
hri_sdadc_winctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->WINCTRL.reg;
tmp = (tmp & SDADC_WINCTRL_WINMODE(mask)) >> SDADC_WINCTRL_WINMODE_Pos;
return tmp;
}
static inline void hri_sdadc_write_WINCTRL_WINMODE_bf(const void *const hw, hri_sdadc_winctrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->WINCTRL.reg;
tmp &= ~SDADC_WINCTRL_WINMODE_Msk;
tmp |= SDADC_WINCTRL_WINMODE(data);
((Sdadc *)hw)->WINCTRL.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINCTRL_WINMODE_bf(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg &= ~SDADC_WINCTRL_WINMODE(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINCTRL_WINMODE_bf(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg ^= SDADC_WINCTRL_WINMODE(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winctrl_reg_t hri_sdadc_read_WINCTRL_WINMODE_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->WINCTRL.reg;
tmp = (tmp & SDADC_WINCTRL_WINMODE_Msk) >> SDADC_WINCTRL_WINMODE_Pos;
return tmp;
}
static inline void hri_sdadc_set_WINCTRL_reg(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winctrl_reg_t hri_sdadc_get_WINCTRL_reg(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
tmp = ((Sdadc *)hw)->WINCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_WINCTRL_reg(const void *const hw, hri_sdadc_winctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINCTRL_reg(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINCTRL_reg(const void *const hw, hri_sdadc_winctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINCTRL.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winctrl_reg_t hri_sdadc_read_WINCTRL_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
return ((Sdadc *)hw)->WINCTRL.reg;
}
static inline void hri_sdadc_set_WINLT_WINLT_bf(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg |= SDADC_WINLT_WINLT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winlt_reg_t hri_sdadc_get_WINLT_WINLT_bf(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
tmp = ((Sdadc *)hw)->WINLT.reg;
tmp = (tmp & SDADC_WINLT_WINLT(mask)) >> SDADC_WINLT_WINLT_Pos;
return tmp;
}
static inline void hri_sdadc_write_WINLT_WINLT_bf(const void *const hw, hri_sdadc_winlt_reg_t data)
{
uint32_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->WINLT.reg;
tmp &= ~SDADC_WINLT_WINLT_Msk;
tmp |= SDADC_WINLT_WINLT(data);
((Sdadc *)hw)->WINLT.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINLT_WINLT_bf(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg &= ~SDADC_WINLT_WINLT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINLT_WINLT_bf(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg ^= SDADC_WINLT_WINLT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winlt_reg_t hri_sdadc_read_WINLT_WINLT_bf(const void *const hw)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
tmp = ((Sdadc *)hw)->WINLT.reg;
tmp = (tmp & SDADC_WINLT_WINLT_Msk) >> SDADC_WINLT_WINLT_Pos;
return tmp;
}
static inline void hri_sdadc_set_WINLT_reg(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winlt_reg_t hri_sdadc_get_WINLT_reg(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
tmp = ((Sdadc *)hw)->WINLT.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_WINLT_reg(const void *const hw, hri_sdadc_winlt_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINLT_reg(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINLT_reg(const void *const hw, hri_sdadc_winlt_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINLT.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winlt_reg_t hri_sdadc_read_WINLT_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINLT);
return ((Sdadc *)hw)->WINLT.reg;
}
static inline void hri_sdadc_set_WINUT_WINUT_bf(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg |= SDADC_WINUT_WINUT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winut_reg_t hri_sdadc_get_WINUT_WINUT_bf(const void *const hw, hri_sdadc_winut_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
tmp = ((Sdadc *)hw)->WINUT.reg;
tmp = (tmp & SDADC_WINUT_WINUT(mask)) >> SDADC_WINUT_WINUT_Pos;
return tmp;
}
static inline void hri_sdadc_write_WINUT_WINUT_bf(const void *const hw, hri_sdadc_winut_reg_t data)
{
uint32_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->WINUT.reg;
tmp &= ~SDADC_WINUT_WINUT_Msk;
tmp |= SDADC_WINUT_WINUT(data);
((Sdadc *)hw)->WINUT.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINUT_WINUT_bf(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg &= ~SDADC_WINUT_WINUT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINUT_WINUT_bf(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg ^= SDADC_WINUT_WINUT(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winut_reg_t hri_sdadc_read_WINUT_WINUT_bf(const void *const hw)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
tmp = ((Sdadc *)hw)->WINUT.reg;
tmp = (tmp & SDADC_WINUT_WINUT_Msk) >> SDADC_WINUT_WINUT_Pos;
return tmp;
}
static inline void hri_sdadc_set_WINUT_reg(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winut_reg_t hri_sdadc_get_WINUT_reg(const void *const hw, hri_sdadc_winut_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
tmp = ((Sdadc *)hw)->WINUT.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_WINUT_reg(const void *const hw, hri_sdadc_winut_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_WINUT_reg(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_WINUT_reg(const void *const hw, hri_sdadc_winut_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->WINUT.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_winut_reg_t hri_sdadc_read_WINUT_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_WINUT);
return ((Sdadc *)hw)->WINUT.reg;
}
static inline void hri_sdadc_set_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg |= SDADC_OFFSETCORR_OFFSETCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_offsetcorr_reg_t hri_sdadc_get_OFFSETCORR_OFFSETCORR_bf(const void *const hw,
hri_sdadc_offsetcorr_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
tmp = ((Sdadc *)hw)->OFFSETCORR.reg;
tmp = (tmp & SDADC_OFFSETCORR_OFFSETCORR(mask)) >> SDADC_OFFSETCORR_OFFSETCORR_Pos;
return tmp;
}
static inline void hri_sdadc_write_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_sdadc_offsetcorr_reg_t data)
{
uint32_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->OFFSETCORR.reg;
tmp &= ~SDADC_OFFSETCORR_OFFSETCORR_Msk;
tmp |= SDADC_OFFSETCORR_OFFSETCORR(data);
((Sdadc *)hw)->OFFSETCORR.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg &= ~SDADC_OFFSETCORR_OFFSETCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_OFFSETCORR_OFFSETCORR_bf(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg ^= SDADC_OFFSETCORR_OFFSETCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_offsetcorr_reg_t hri_sdadc_read_OFFSETCORR_OFFSETCORR_bf(const void *const hw)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
tmp = ((Sdadc *)hw)->OFFSETCORR.reg;
tmp = (tmp & SDADC_OFFSETCORR_OFFSETCORR_Msk) >> SDADC_OFFSETCORR_OFFSETCORR_Pos;
return tmp;
}
static inline void hri_sdadc_set_OFFSETCORR_reg(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_offsetcorr_reg_t hri_sdadc_get_OFFSETCORR_reg(const void *const hw,
hri_sdadc_offsetcorr_reg_t mask)
{
uint32_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
tmp = ((Sdadc *)hw)->OFFSETCORR.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_OFFSETCORR_reg(const void *const hw, hri_sdadc_offsetcorr_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_OFFSETCORR_reg(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_OFFSETCORR_reg(const void *const hw, hri_sdadc_offsetcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->OFFSETCORR.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_offsetcorr_reg_t hri_sdadc_read_OFFSETCORR_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_OFFSETCORR);
return ((Sdadc *)hw)->OFFSETCORR.reg;
}
static inline void hri_sdadc_set_GAINCORR_GAINCORR_bf(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg |= SDADC_GAINCORR_GAINCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_gaincorr_reg_t hri_sdadc_get_GAINCORR_GAINCORR_bf(const void *const hw,
hri_sdadc_gaincorr_reg_t mask)
{
uint16_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
tmp = ((Sdadc *)hw)->GAINCORR.reg;
tmp = (tmp & SDADC_GAINCORR_GAINCORR(mask)) >> SDADC_GAINCORR_GAINCORR_Pos;
return tmp;
}
static inline void hri_sdadc_write_GAINCORR_GAINCORR_bf(const void *const hw, hri_sdadc_gaincorr_reg_t data)
{
uint16_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->GAINCORR.reg;
tmp &= ~SDADC_GAINCORR_GAINCORR_Msk;
tmp |= SDADC_GAINCORR_GAINCORR(data);
((Sdadc *)hw)->GAINCORR.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_GAINCORR_GAINCORR_bf(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg &= ~SDADC_GAINCORR_GAINCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_GAINCORR_GAINCORR_bf(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg ^= SDADC_GAINCORR_GAINCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_gaincorr_reg_t hri_sdadc_read_GAINCORR_GAINCORR_bf(const void *const hw)
{
uint16_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
tmp = ((Sdadc *)hw)->GAINCORR.reg;
tmp = (tmp & SDADC_GAINCORR_GAINCORR_Msk) >> SDADC_GAINCORR_GAINCORR_Pos;
return tmp;
}
static inline void hri_sdadc_set_GAINCORR_reg(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_gaincorr_reg_t hri_sdadc_get_GAINCORR_reg(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
uint16_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
tmp = ((Sdadc *)hw)->GAINCORR.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_GAINCORR_reg(const void *const hw, hri_sdadc_gaincorr_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_GAINCORR_reg(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_GAINCORR_reg(const void *const hw, hri_sdadc_gaincorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->GAINCORR.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_gaincorr_reg_t hri_sdadc_read_GAINCORR_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_GAINCORR);
return ((Sdadc *)hw)->GAINCORR.reg;
}
static inline void hri_sdadc_set_SHIFTCORR_SHIFTCORR_bf(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg |= SDADC_SHIFTCORR_SHIFTCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_shiftcorr_reg_t hri_sdadc_get_SHIFTCORR_SHIFTCORR_bf(const void *const hw,
hri_sdadc_shiftcorr_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
tmp = ((Sdadc *)hw)->SHIFTCORR.reg;
tmp = (tmp & SDADC_SHIFTCORR_SHIFTCORR(mask)) >> SDADC_SHIFTCORR_SHIFTCORR_Pos;
return tmp;
}
static inline void hri_sdadc_write_SHIFTCORR_SHIFTCORR_bf(const void *const hw, hri_sdadc_shiftcorr_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->SHIFTCORR.reg;
tmp &= ~SDADC_SHIFTCORR_SHIFTCORR_Msk;
tmp |= SDADC_SHIFTCORR_SHIFTCORR(data);
((Sdadc *)hw)->SHIFTCORR.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SHIFTCORR_SHIFTCORR_bf(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg &= ~SDADC_SHIFTCORR_SHIFTCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SHIFTCORR_SHIFTCORR_bf(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg ^= SDADC_SHIFTCORR_SHIFTCORR(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_shiftcorr_reg_t hri_sdadc_read_SHIFTCORR_SHIFTCORR_bf(const void *const hw)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
tmp = ((Sdadc *)hw)->SHIFTCORR.reg;
tmp = (tmp & SDADC_SHIFTCORR_SHIFTCORR_Msk) >> SDADC_SHIFTCORR_SHIFTCORR_Pos;
return tmp;
}
static inline void hri_sdadc_set_SHIFTCORR_reg(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_shiftcorr_reg_t hri_sdadc_get_SHIFTCORR_reg(const void *const hw,
hri_sdadc_shiftcorr_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
tmp = ((Sdadc *)hw)->SHIFTCORR.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_SHIFTCORR_reg(const void *const hw, hri_sdadc_shiftcorr_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SHIFTCORR_reg(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SHIFTCORR_reg(const void *const hw, hri_sdadc_shiftcorr_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SHIFTCORR.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_shiftcorr_reg_t hri_sdadc_read_SHIFTCORR_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_SHIFTCORR);
return ((Sdadc *)hw)->SHIFTCORR.reg;
}
static inline void hri_sdadc_set_SWTRIG_FLUSH_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg |= SDADC_SWTRIG_FLUSH;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_SWTRIG_FLUSH_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SWTRIG.reg;
tmp = (tmp & SDADC_SWTRIG_FLUSH) >> SDADC_SWTRIG_FLUSH_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_SWTRIG_FLUSH_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->SWTRIG.reg;
tmp &= ~SDADC_SWTRIG_FLUSH;
tmp |= value << SDADC_SWTRIG_FLUSH_Pos;
((Sdadc *)hw)->SWTRIG.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SWTRIG_FLUSH_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg &= ~SDADC_SWTRIG_FLUSH;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SWTRIG_FLUSH_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg ^= SDADC_SWTRIG_FLUSH;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_SWTRIG_START_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg |= SDADC_SWTRIG_START;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_SWTRIG_START_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SWTRIG.reg;
tmp = (tmp & SDADC_SWTRIG_START) >> SDADC_SWTRIG_START_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_SWTRIG_START_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->SWTRIG.reg;
tmp &= ~SDADC_SWTRIG_START;
tmp |= value << SDADC_SWTRIG_START_Pos;
((Sdadc *)hw)->SWTRIG.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SWTRIG_START_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg &= ~SDADC_SWTRIG_START;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SWTRIG_START_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg ^= SDADC_SWTRIG_START;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_SWTRIG_reg(const void *const hw, hri_sdadc_swtrig_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_swtrig_reg_t hri_sdadc_get_SWTRIG_reg(const void *const hw, hri_sdadc_swtrig_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
tmp = ((Sdadc *)hw)->SWTRIG.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_SWTRIG_reg(const void *const hw, hri_sdadc_swtrig_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SWTRIG_reg(const void *const hw, hri_sdadc_swtrig_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SWTRIG_reg(const void *const hw, hri_sdadc_swtrig_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SWTRIG.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_swtrig_reg_t hri_sdadc_read_SWTRIG_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
return ((Sdadc *)hw)->SWTRIG.reg;
}
static inline void hri_sdadc_set_SEQCTRL_SEQEN_bf(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg |= SDADC_SEQCTRL_SEQEN(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_seqctrl_reg_t hri_sdadc_get_SEQCTRL_SEQEN_bf(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SEQCTRL.reg;
tmp = (tmp & SDADC_SEQCTRL_SEQEN(mask)) >> SDADC_SEQCTRL_SEQEN_Pos;
return tmp;
}
static inline void hri_sdadc_write_SEQCTRL_SEQEN_bf(const void *const hw, hri_sdadc_seqctrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->SEQCTRL.reg;
tmp &= ~SDADC_SEQCTRL_SEQEN_Msk;
tmp |= SDADC_SEQCTRL_SEQEN(data);
((Sdadc *)hw)->SEQCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SEQCTRL_SEQEN_bf(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg &= ~SDADC_SEQCTRL_SEQEN(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SEQCTRL_SEQEN_bf(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg ^= SDADC_SEQCTRL_SEQEN(mask);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_seqctrl_reg_t hri_sdadc_read_SEQCTRL_SEQEN_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SEQCTRL.reg;
tmp = (tmp & SDADC_SEQCTRL_SEQEN_Msk) >> SDADC_SEQCTRL_SEQEN_Pos;
return tmp;
}
static inline void hri_sdadc_set_SEQCTRL_reg(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg |= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_seqctrl_reg_t hri_sdadc_get_SEQCTRL_reg(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->SEQCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_SEQCTRL_reg(const void *const hw, hri_sdadc_seqctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg = data;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_SEQCTRL_reg(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg &= ~mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_SEQCTRL_reg(const void *const hw, hri_sdadc_seqctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->SEQCTRL.reg ^= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_seqctrl_reg_t hri_sdadc_read_SEQCTRL_reg(const void *const hw)
{
return ((Sdadc *)hw)->SEQCTRL.reg;
}
static inline void hri_sdadc_set_ANACTRL_ONCHOP_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg |= SDADC_ANACTRL_ONCHOP;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_ANACTRL_ONCHOP_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp = (tmp & SDADC_ANACTRL_ONCHOP) >> SDADC_ANACTRL_ONCHOP_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_ANACTRL_ONCHOP_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp &= ~SDADC_ANACTRL_ONCHOP;
tmp |= value << SDADC_ANACTRL_ONCHOP_Pos;
((Sdadc *)hw)->ANACTRL.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_ANACTRL_ONCHOP_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg &= ~SDADC_ANACTRL_ONCHOP;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_ANACTRL_ONCHOP_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg ^= SDADC_ANACTRL_ONCHOP;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_ANACTRL_BUFTEST_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg |= SDADC_ANACTRL_BUFTEST;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_ANACTRL_BUFTEST_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp = (tmp & SDADC_ANACTRL_BUFTEST) >> SDADC_ANACTRL_BUFTEST_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_ANACTRL_BUFTEST_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp &= ~SDADC_ANACTRL_BUFTEST;
tmp |= value << SDADC_ANACTRL_BUFTEST_Pos;
((Sdadc *)hw)->ANACTRL.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_ANACTRL_BUFTEST_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg &= ~SDADC_ANACTRL_BUFTEST;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_ANACTRL_BUFTEST_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg ^= SDADC_ANACTRL_BUFTEST;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_ANACTRL_CTRSDADC_bf(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg |= SDADC_ANACTRL_CTRSDADC(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_anactrl_reg_t hri_sdadc_get_ANACTRL_CTRSDADC_bf(const void *const hw,
hri_sdadc_anactrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp = (tmp & SDADC_ANACTRL_CTRSDADC(mask)) >> SDADC_ANACTRL_CTRSDADC_Pos;
return tmp;
}
static inline void hri_sdadc_write_ANACTRL_CTRSDADC_bf(const void *const hw, hri_sdadc_anactrl_reg_t data)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp &= ~SDADC_ANACTRL_CTRSDADC_Msk;
tmp |= SDADC_ANACTRL_CTRSDADC(data);
((Sdadc *)hw)->ANACTRL.reg = tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_ANACTRL_CTRSDADC_bf(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg &= ~SDADC_ANACTRL_CTRSDADC(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_ANACTRL_CTRSDADC_bf(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg ^= SDADC_ANACTRL_CTRSDADC(mask);
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_anactrl_reg_t hri_sdadc_read_ANACTRL_CTRSDADC_bf(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp = (tmp & SDADC_ANACTRL_CTRSDADC_Msk) >> SDADC_ANACTRL_CTRSDADC_Pos;
return tmp;
}
static inline void hri_sdadc_set_ANACTRL_reg(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg |= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_anactrl_reg_t hri_sdadc_get_ANACTRL_reg(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
uint8_t tmp;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
tmp = ((Sdadc *)hw)->ANACTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_ANACTRL_reg(const void *const hw, hri_sdadc_anactrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg = data;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_ANACTRL_reg(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg &= ~mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_ANACTRL_reg(const void *const hw, hri_sdadc_anactrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->ANACTRL.reg ^= mask;
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_anactrl_reg_t hri_sdadc_read_ANACTRL_reg(const void *const hw)
{
hri_sdadc_wait_for_sync(hw, SDADC_SYNCBUSY_MASK);
return ((Sdadc *)hw)->ANACTRL.reg;
}
static inline void hri_sdadc_set_DBGCTRL_DBGRUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg |= SDADC_DBGCTRL_DBGRUN;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline bool hri_sdadc_get_DBGCTRL_DBGRUN_bit(const void *const hw)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->DBGCTRL.reg;
tmp = (tmp & SDADC_DBGCTRL_DBGRUN) >> SDADC_DBGCTRL_DBGRUN_Pos;
return (bool)tmp;
}
static inline void hri_sdadc_write_DBGCTRL_DBGRUN_bit(const void *const hw, bool value)
{
uint8_t tmp;
SDADC_CRITICAL_SECTION_ENTER();
tmp = ((Sdadc *)hw)->DBGCTRL.reg;
tmp &= ~SDADC_DBGCTRL_DBGRUN;
tmp |= value << SDADC_DBGCTRL_DBGRUN_Pos;
((Sdadc *)hw)->DBGCTRL.reg = tmp;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_DBGCTRL_DBGRUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg &= ~SDADC_DBGCTRL_DBGRUN;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_DBGCTRL_DBGRUN_bit(const void *const hw)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg ^= SDADC_DBGCTRL_DBGRUN;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_set_DBGCTRL_reg(const void *const hw, hri_sdadc_dbgctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg |= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_dbgctrl_reg_t hri_sdadc_get_DBGCTRL_reg(const void *const hw, hri_sdadc_dbgctrl_reg_t mask)
{
uint8_t tmp;
tmp = ((Sdadc *)hw)->DBGCTRL.reg;
tmp &= mask;
return tmp;
}
static inline void hri_sdadc_write_DBGCTRL_reg(const void *const hw, hri_sdadc_dbgctrl_reg_t data)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg = data;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_clear_DBGCTRL_reg(const void *const hw, hri_sdadc_dbgctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg &= ~mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline void hri_sdadc_toggle_DBGCTRL_reg(const void *const hw, hri_sdadc_dbgctrl_reg_t mask)
{
SDADC_CRITICAL_SECTION_ENTER();
((Sdadc *)hw)->DBGCTRL.reg ^= mask;
SDADC_CRITICAL_SECTION_LEAVE();
}
static inline hri_sdadc_dbgctrl_reg_t hri_sdadc_read_DBGCTRL_reg(const void *const hw)
{
return ((Sdadc *)hw)->DBGCTRL.reg;
}
#ifdef __cplusplus
}
#endif
#endif /* _HRI_SDADC_C21_H_INCLUDED */
#endif /* _SAMC21_SDADC_COMPONENT_ */
|
f8b28dbd6b1bb70510f1a7b60e117a55c1a1810c
|
32d404963376a396ee7ef518304b31f91694b79a
|
/Beta Weekend 1/DUMP/BP_VehicleSeat_classes.h
|
60bdfe1c35e6f660c899354219aeab4b0066617e
|
[] |
no_license
|
TammelTin/Icarus-Dump
|
af2d1899491444924636b3903d5ee327a87d97c9
|
148c92b73f02add701816fd51fafc041145a635a
|
refs/heads/main
| 2023-08-11T02:58:04.032131 | 2021-09-10T12:16:02 | 2021-09-10T12:16:02 | 401,130,226 | 2 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,953 |
h
|
BP_VehicleSeat_classes.h
|
// BlueprintGeneratedClass BP_VehicleSeat.BP_VehicleSeat_C
// Size: 0x368 (Inherited: 0x345)
struct ABP_VehicleSeat_C : ABP_SeatBase_C {
char pad_345[0x3]; // 0x345(0x03)
struct FPointerToUberGraphFrame UberGraphFrame; // 0x348(0x08)
struct USceneComponent* Exit_4; // 0x350(0x08)
struct USceneComponent* Exit_3; // 0x358(0x08)
struct USceneComponent* Exit_2; // 0x360(0x08)
void OnServerChangeSeat(int32_t SeatIndex); // Function BP_VehicleSeat.BP_VehicleSeat_C.OnServerChangeSeat // (Public|BlueprintCallable|BlueprintEvent) // @ game+0x1a05090
void InputChangeSeat(int32_t SeatIndex); // Function BP_VehicleSeat.BP_VehicleSeat_C.InputChangeSeat // (Public|BlueprintCallable|BlueprintEvent) // @ game+0x1a05090
void InpActEvt_ChangeSeat1_K2Node_InputActionEvent_4(struct FKey Key); // Function BP_VehicleSeat.BP_VehicleSeat_C.InpActEvt_ChangeSeat1_K2Node_InputActionEvent_4 // (BlueprintEvent) // @ game+0x1a05090
void InpActEvt_ChangeSeat2_K2Node_InputActionEvent_3(struct FKey Key); // Function BP_VehicleSeat.BP_VehicleSeat_C.InpActEvt_ChangeSeat2_K2Node_InputActionEvent_3 // (BlueprintEvent) // @ game+0x1a05090
void InpActEvt_ChangeSeat3_K2Node_InputActionEvent_2(struct FKey Key); // Function BP_VehicleSeat.BP_VehicleSeat_C.InpActEvt_ChangeSeat3_K2Node_InputActionEvent_2 // (BlueprintEvent) // @ game+0x1a05090
void InpActEvt_ChangeSeat4_K2Node_InputActionEvent_1(struct FKey Key); // Function BP_VehicleSeat.BP_VehicleSeat_C.InpActEvt_ChangeSeat4_K2Node_InputActionEvent_1 // (BlueprintEvent) // @ game+0x1a05090
void InpActEvt_V_K2Node_InputKeyEvent_1(struct FKey Key); // Function BP_VehicleSeat.BP_VehicleSeat_C.InpActEvt_V_K2Node_InputKeyEvent_1 // (BlueprintEvent) // @ game+0x1a05090
void OnRep_AttachedToVehicle(); // Function BP_VehicleSeat.BP_VehicleSeat_C.OnRep_AttachedToVehicle // (Event|Protected|BlueprintEvent) // @ game+0x1a05090
void ServerChangeSeat(int32_t SeatIndex); // Function BP_VehicleSeat.BP_VehicleSeat_C.ServerChangeSeat // (Net|NetReliableNetServer|BlueprintCallable|BlueprintEvent) // @ game+0x1a05090
void OpenVehicleInventory(); // Function BP_VehicleSeat.BP_VehicleSeat_C.OpenVehicleInventory // (Net|NetReliableNetServer|BlueprintCallable|BlueprintEvent) // @ game+0x1a05090
void AttachPlayerToSeat(struct AIcarusPlayerCharacter* PlayerCharacter, struct FRotator EnterRotation); // Function BP_VehicleSeat.BP_VehicleSeat_C.AttachPlayerToSeat // (Event|Public|HasOutParms|BlueprintEvent) // @ game+0x1a05090
void DetachPlayerFromSeat(struct AIcarusPlayerCharacter* PlayerCharacter, struct FVector ExitLocation, struct FRotator ExitRotation, bool bChangeSeat); // Function BP_VehicleSeat.BP_VehicleSeat_C.DetachPlayerFromSeat // (Event|Public|HasOutParms|BlueprintEvent) // @ game+0x1a05090
void ExecuteUbergraph_BP_VehicleSeat(int32_t EntryPoint); // Function BP_VehicleSeat.BP_VehicleSeat_C.ExecuteUbergraph_BP_VehicleSeat // (Final|UbergraphFunction|HasDefaults) // @ game+0x1a05090
};
|
d26cd33e7a74a59d4da9037e42ec6e03295dbcfe
|
8224da9b88946d5fdf0711f694ca2521ae3c06f8
|
/src/metric.h
|
98c9cdc116a1dd919a5f1bce4a9e55708128463a
|
[] |
no_license
|
diegojcmoreira/Simulador-AD
|
9f9e212c1ca4d43ed7ecee08becdc6edec3246e3
|
cc55abd9f290c7ff079173fad12a411d081c63b6
|
refs/heads/master
| 2020-05-25T04:57:13.825964 | 2019-07-12T01:52:50 | 2019-07-12T01:52:50 | 187,639,084 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 855 |
h
|
metric.h
|
#ifndef METRIC_H
#define METRIC_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "alglib/specialfunctions.h"
// Struct para metricas das rodadas
typedef struct {
double sumValuesSample; // somatorio das amostras até agora
double sumValuesSampleSquare; // (somatorio das amostras até agora)^2
double meanEstimator;
double varianceEstimator;
} SampleMetric;
SampleMetric createSampleMetric(void);
void chiSquareIC(double* sample, int sizeSample, int sizeRound, double* lower, double* upper, double* precision, double* centerIC);
void tStudentIC(double* sample, int sizeSample, double* lower, double* upper, double* precision, double* centerIC);
void sampleEstimator(SampleMetric* sampleMetric, double value, int sizeSample);
int valueIsInsideInterval(double lower, double upper, double value);
#endif
|
69bc8b5acae7570ca019a8d2b03a71611b58977e
|
8352a2fb6403893d4758c117cb944a9a4185418e
|
/user/C/string/head_2.h
|
32a59930e6a94617df486f6717fc0e5ee0f1b230
|
[] |
no_license
|
woshimayi/driver
|
d1510c21fac1807ec5d70fe586686764b599f180
|
53349dd6363a711449e1f1e3ab51eea3f7aea2ed
|
refs/heads/master
| 2023-08-31T16:22:31.247664 | 2023-08-30T11:24:58 | 2023-08-30T11:24:58 | 134,122,726 | 7 | 3 | null | null | null | null |
UTF-8
|
C
| false | false | 142 |
h
|
head_2.h
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int add(int a, int b)
{
printf("a * b = %d\n", a * b);
return 0;
}
|
16d0394cd3169c218719e26b067cb68d2c580474
|
9afb9ca920f5ac7dfb0cbda92d07df6a0f504af2
|
/plugin/trtt_3D_projectors_cubic.c
|
0fe6e6afc049b7532741f86d128800f33e0e68a8
|
[] |
no_license
|
fabienmomey/YorickTRTT
|
8f9af7b6595db5de9e0557d76ade7ce4cc080517
|
85f55787e2a2022925785de5254e47cfc9a146b5
|
refs/heads/master
| 2021-01-15T08:42:16.562047 | 2016-08-29T06:53:20 | 2016-08-29T06:53:20 | 51,507,894 | 2 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 27,542 |
c
|
trtt_3D_projectors_cubic.c
|
/*
* TR-TT : iTeraTive Reconstruction for Tomography
*
* trtt_3D_projectors.c --
*
* TRTT 3D projectors.
*
*-----------------------------------------------------------------------------
*
* Copyright (C) 2011, the MiTiV Team.
*
* This software is governed by the CeCILL-C license under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited liability.
*
* In this respect, the user's attention is drawn to the risks associated with
* loading, using, modifying and/or developing or reproducing the software by
* the user in light of its specific status of free software, that may mean
* that it is complicated to manipulate, and that also therefore means that it
* is reserved for developers and experienced professionals having in-depth
* computer knowledge. Users are therefore encouraged to load and test the
* software's suitability as regards their requirements in conditions enabling
* the security of their systems and/or data to be ensured and, more
* generally, to use and operate it in the same conditions as regards
* security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*
*-----------------------------------------------------------------------------
*
* $Id$
* $Log$
*/
/* PREPROCESSOR INCLUSIONS ============================================== */
#define ONE_TWENTY_FOURTH 0.0416666666666667
#define ONE_THIRD 0.3333333333333333
#define TWO_THIRD 0.6666666666666666
#define FOUR_THIRD 1.3333333333333333
#define ONE_EIGHTH 0.125
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <time.h>
#include "trtt_common.h"
#include "trtt_xform3d.h"
#include "trtt_3D_projectors_cubic.h"
/*
* Title: TRTT Radon projectors for tomography (details of implementation)
*
* Version 1.0
*
* Copyright (C) 2011, the MiTiV project.
*
* This package contains the projectors performing the algebraic Radon
* transform at several dimensions and geometries.
*
* The definitions are available by:
* > #include <trtt_3D_projectors.c>
*/
/*---------------------------------------------------------------------------*/
/* PREPROCESSOR MACROS ================================================== */
#define STATEMENT(code) do { code; } while (0)
/* PRIVATE FUNCTIONS ==================================================== */
////////////////////////////////////////
// PRIVATE FUNCTIONS FOR 3D OPERATORS //
////////////////////////////////////////
/* Function: _trtt_cubic_bspline_integrale_3D
*
* Description:
*
* This function calculates the integrale of monodimensional B-spline of
* degree 3 from minus infinity to the x position
*
* > _______
* > / | ' \
* > /| | ' |\
* > / | | ' | \
* > / | | ' | \
* > ____/ | | ' | \____
* > '
* >-Inf ---------> x
* >
* > -2 -1 0 1 2
* >
* > <h ><h ><h ><h >
*
* The considered B-spline is normalized : h=1. As a result x has to be
* passed normalized in this space, i.e. centered at the center of the
* B-spline and divided by the scale h (in this application the sampling
* step of voxels).
*
* Parameters:
*
* x - upper integration bound.
*
*/
static double _trtt_cubic_bspline_integrale_3D(double x)
{
double x_sqr = x*x;
double x_cub = x_sqr*x;
double y;
if (x<=-2.0) {
y = 0.0;
} else if (x>-2.0 && x<=-1.0) {
y = ONE_TWENTY_FOURTH*(x*x_cub) + ONE_THIRD*x_cub + x_sqr + FOUR_THIRD*x + TWO_THIRD;
} else if (x>-1.0 && x<=0.0) {
y = (-1.0)*ONE_EIGHTH*(x*x_cub) - ONE_THIRD*x_cub + TWO_THIRD*x + 0.5;
} else if (x>0.0 && x<=1.0) {
y = ONE_EIGHTH*(x*x_cub) - ONE_THIRD*x_cub + TWO_THIRD*x + 0.5;
} else if (x>1.0 && x<2.0) {
y = (-1.0)*ONE_TWENTY_FOURTH*(x*x_cub) + ONE_THIRD*x_cub - x_sqr + FOUR_THIRD*x + ONE_THIRD;
} else {
y = 1.0;
}
return y;
}
/*----------------*/
/*-Burn footprint-*/
/*----------------*/
/* Function: _trtt_3D_burn_footprint_3D
*
* Description:
*
* This function calculates the impact of a given voxel and its footprint
* (integration) (B-spline model based) on the detector pixels, in the
* direct projection sense.
*
* The footprint is assumed to be a 2D separable B-spline of degree 3,
* scaled by a magnification factor, and u-axis and v-axis distorsion
* factors (all embedded in a weighting factor normalization factors for
* coordinates on the detector plane).
*
* > |------|------|------|------| ^
* > | | | | | |
* > | | | | | |
* > |------|------|------|------|--- v_right |
* > | _|______|___ | | |
* > | / | | \ | | |
* > |---/--|------|----\-|------| | nv
* > | | | | || | |
* > | | | o--|-----||------|--- vc |
* > |--|---|---'--|-----||------| |
* > | \ | ' | / | | |
* > | \_|___'__|___/ | | |
* > |------|---'--|------|------|--- v_left v
* > ' ' '
* > ' ' '
* > ' ' '
* > u_left uc u_right
* >
* > <--------------------------->
* > nu
*
* The footprint being separable, the integration of the footprint is
* splitted into 2 mondimensional integrations. The mondimensional
* integration is calculated as the difference between the 2 cumulative
* integrations of the B-spline to the 2 detector pixel bounds normalized
* to the B-spline footprint frame (see
* <_trtt_cubic_bspline_integrale_3D>).
*
* Parameters:
*
* pix - data sinogram array to fill.
*
* vox - value of the current B-spline coefficient (current voxel value)
*
* uc - u-axis coordinate of the projection of the voxel center on the
* detector (homogeneous to detector pixels indexes).
*
* vc - v-axis coordinate of the projection of the voxel center on the
* detector (homogeneous to detector pixels indexes).
*
* u_left - u-axis index of the lower left corner detector pixel bound
* impinged by the footprint.
*
* u_right - u-axis index of the upper right corner detector pixel bound
* impinged by the footprint.
*
* v_left - v-axis index of the lower left corner detector pixel bound
* impinged by the footprint.
*
* v_right - v-axis index of the upper right corner detector pixel bound
* impinged by the footprint.
*
* nu - detector size in u-direction (equivalent to z-direction).
*
* rho0 - weighting factor for the footprint integration.
*
* scl_norm_u - u-axis normalization factor for writting coordinates in the
* centered normalized B-spline footprint frame.
*
* scl_norm_v - v-axis normalization factor for writting coordinates in the
* centered normalized B-spline footprint frame.
*
* Returns:
*
* A standard result: <TRTT_SUCCESS> on success; <TRTT_FAILURE> on error.
*
* See also:
*
* <_trtt_3D_burn_footprint_3D_transp>.
*
* MiTiV pages:
* <http://mitiv.univ-lyon1.fr/index.php?n=Tomographie.ModeleBspline3D>
*
*/
static int _trtt_3D_burn_footprint_3D(double *pix,
const double vox,
const double uc,
const double vc,
const double u_left,
const double u_right,
const double v_left,
const double v_right,
const long nu,
const double rho0,
const double scl_norm_u,
const double scl_norm_v)
{
long l, m;
double pu_first, u_next, pu_next;
double pv_first, v_next, pv_next;
long npix_u, npix_v;
double coord_footprint_start_u;
double coord_footprint_start_v;
double *c_integ_u;
double c_integ_v;
long bottom_left_corner_id = (long)v_left*nu + (long)u_left;
long pix_id;
// FIXME: we are in bound detector pixel coordinates
// FIXME: 0 ; 1 ; 2 ; ... ; nu-1 ; nu
// FIXME: 0 ; 1 ; 2 ; ... ; nv-1 ; nv
if (u_left<u_right && v_left<v_right) {
/* Get the position of left-hand side of the footprint in pixel detector
* space */
coord_footprint_start_u = (u_left-uc)*scl_norm_u;
coord_footprint_start_v = (v_left-vc)*scl_norm_v;
// FIXME: generic footprint coordinates for cubic b-spline
// FIXME: -2 ; -1 ; 0 ; 1 ; 2
npix_u = (long)(u_right - u_left);
npix_v = (long)(v_right - v_left);
/* Allocate "impact" coefficients in direction u */
c_integ_u = TRTT_NEW_ARRAY0(double, npix_u);
if (c_integ_u==NULL) return TRTT_FAILURE;
/* Calculate "impact" coefficients in direction u */
pu_first = _trtt_cubic_bspline_integrale_3D(coord_footprint_start_u);
for (l=0; l<npix_u; ++l) { // for each impinged detector pixel in direction u
/* Next detector pixel */
u_next = coord_footprint_start_u + (l+1)*scl_norm_u;
/* Cumulative integration to the pixel bound */
pu_next = _trtt_cubic_bspline_integrale_3D(u_next);
/* Calculate the impact */
c_integ_u[l] = pu_next-pu_first;
pu_first = pu_next;
}
/* Calculate "impact" coefficients in direction v */
pv_first = _trtt_cubic_bspline_integrale_3D(coord_footprint_start_v);
for (m=0; m<npix_v; ++m) { // for each impinged detector pixel in direction v
/* Next detector pixel */
v_next = coord_footprint_start_v + (m+1)*scl_norm_v;
/* Cumulative integration to the pixel bound */
pv_next = _trtt_cubic_bspline_integrale_3D(v_next);
/* Find the "3D" index of the impinged detector pixel */
pix_id = bottom_left_corner_id + m*nu;
/* Calculate the impact */
c_integ_v = pv_next-pv_first;
for (l=0; l<npix_u; ++l) { // for each impinged detector pixel in direction u
/* Accumulate in current detector pixel */
*(pix + pix_id + l) += c_integ_v*c_integ_u[l]*vox*rho0;
}
pv_first = pv_next;
}
free(c_integ_u);
}
return TRTT_SUCCESS;
}
/*----------------------------*/
/*-Burn footprint (transpose)-*/
/*----------------------------*/
/* Function: _trtt_3D_burn_footprint_3D_transp
*
* Description:
*
* This function calculates the impact of a given voxel and its footprint
* (integration) (B-spline model based) on the detector pixels, in the
* transpose projection sense.
*
* The footprint is assumed to be a 2D separable B-spline of degree 3,
* scaled by a magnification factor, and u-axis and v-axis distorsion
* factors (all embedded in a weighting factor normalization factors for
* coordinates on the detector plane).
*
* > |------|------|------|------| ^
* > | | | | | |
* > | | | | | |
* > |------|------|------|------|--- v_right |
* > | _|______|___ | | |
* > | / | | \ | | |
* > |---/--|------|----\-|------| | nv
* > | | | | || | |
* > | | | o--|-----||------|--- vc |
* > |--|---|---'--|-----||------| |
* > | \ | ' | / | | |
* > | \_|___'__|___/ | | |
* > |------|---'--|------|------|--- v_left v
* > ' ' '
* > ' ' '
* > ' ' '
* > u_left uc u_right
* >
* > <--------------------------->
* > nu
*
* The footprint being separable, the integration of the footprint is
* splitted into 2 mondimensional integrations. The mondimensional
* integration is calculated as the difference between the 2 cumulative
* integrations of the B-spline to the 2 detector pixel bounds normalized
* to the B-spline footprint frame (see
* <_trtt_cubic_bspline_integrale_3D>).
*
* Parameters:
*
* vox - voxels image array.
*
* pix - data sinogram array.
*
* uc - u-axis coordinate of the projection of the voxel center on the
* detector (homogeneous to detector pixels indexes).
*
* vc - v-axis coordinate of the projection of the voxel center on the
* detector (homogeneous to detector pixels indexes).
*
* u_left - u-axis index of the lower left corner detector pixel bound
* impinged by the footprint.
*
* u_right - u-axis index of the upper right corner detector pixel bound
* impinged by the footprint.
*
* v_left - v-axis index of the lower left corner detector pixel bound
* impinged by the footprint.
*
* v_right - v-axis index of the upper right corner detector pixel bound
* impinged by the footprint.
*
* nu - detector size in u-direction (equivalent to z-direction).
*
* nx - size of the voxels image in x-direction.
*
* ny - size of the voxels image in y-direction.
*
* id_x - x-axis index of the current voxel to update.
*
* id_y - y-axis index of the current voxel to update.
*
* id_z - z-axis index of the current voxel to update.
*
* rho0 - weighting factor for the footprint integration.
*
* scl_norm_u - u-axis normalization factor for writting coordinates in the
* centered normalized B-spline footprint frame.
*
* scl_norm_v - v-axis normalization factor for writting coordinates in the
* centered normalized B-spline footprint frame.
*
* Returns:
*
* A standard result: <TRTT_SUCCESS> on success; <TRTT_FAILURE> on error.
*
* See also:
*
* <_trtt_3D_burn_footprint_3D>.
*
* MiTiV pages:
* <http://mitiv.univ-lyon1.fr/index.php?n=Tomographie.ModeleBspline3D>
*
*/
static int _trtt_3D_burn_footprint_3D_transp(double *vox,
const double *pix,
const double uc,
const double vc,
const double u_left,
const double u_right,
const double v_left,
const double v_right,
const long nu,
const long nx,
const long ny,
const long id_x,
const long id_y,
const long id_z,
const double rho0,
const double scl_norm_u,
const double scl_norm_v)
{
long l, m;
double pu_first, u_next, pu_next;
double pv_first, v_next, pv_next;
long npix_u, npix_v;
double coord_footprint_start_u;
double coord_footprint_start_v;
double *c_integ_u;
double c_integ_v;
double *current_voxel = vox + (id_z*ny + id_y)*nx + id_x;
long bottom_left_corner_id = (long)v_left * nu + (long)u_left;
long pix_id;
// FIXME: we are in bound detector pixel coordinates
// FIXME: 0 ; 1 ; 2 ; ... ; nu-1 ; nu
// FIXME: 0 ; 1 ; 2 ; ... ; nv-1 ; nv
if (u_left<u_right && v_left<v_right) {
/* Get the position of left-hand side of the footprint in pixel detector
* space */
coord_footprint_start_u = (u_left-uc)*scl_norm_u;
coord_footprint_start_v = (v_left-vc)*scl_norm_v;
// FIXME: generic footprint coordinates for cubic b-spline
// FIXME: -2 ; -1 ; 0 ; 1 ; 2
npix_u = u_right - u_left;
npix_v = v_right - v_left;
/* Allocate "impact" coefficients in direction u */
c_integ_u = TRTT_NEW_ARRAY0(double, npix_u);
if (c_integ_u==NULL) return TRTT_FAILURE;
/* Calculate "impact" coefficients in direction u */
pu_first = _trtt_cubic_bspline_integrale_3D(coord_footprint_start_u);
for (l=0; l<npix_u; ++l) { // for each impinged detector pixel in direction u
/* Next detector pixel */
u_next = coord_footprint_start_u + (l+1)*scl_norm_u;
/* Cumulative integration to the pixel bound */
pu_next = _trtt_cubic_bspline_integrale_3D(u_next);
/* Calculate the impact */
c_integ_u[l] = pu_next - pu_first;
pu_first = pu_next;
}
/* Calculate "impact" coefficients in direction v */
pv_first = _trtt_cubic_bspline_integrale_3D(coord_footprint_start_v);
for (m=0; m<npix_v; ++m) { // for each impinged detector pixel in direction v
v_next = coord_footprint_start_v + (m+1)*scl_norm_v;
/* Cumulative integration to the pixel bound */
pv_next = _trtt_cubic_bspline_integrale_3D(v_next);
/* Find the "3D" index of the impinged detector pixel */
pix_id = bottom_left_corner_id + m*nu;
/* Calculate the impact */
c_integ_v = pv_next-pv_first;
for (l=0; l<npix_u; ++l) { // for each impinged detector pixel in direction u
/* Accumulate in current detector pixel */
*current_voxel += rho0 * c_integ_u[l] * c_integ_v * (*(pix + pix_id + l));
}
pv_first = pv_next;
}
free(c_integ_u);
}
return TRTT_SUCCESS;
}
/* PUBLIC FUNCTIONS =================================================== */
/*---------------------------------------------------------------*/
/* See NaturalDocs Documentation for the help of these functions */
/*---------------------------------------------------------------*/
//////////////////
// 3D OPERATORS //
//////////////////
/*------------------*/
/*-3D PARALLEL BEAM-*/
/*------------------*/
int trtt_PB3D_cubic(double *out, double *in, long nx, long ny, long nz, double s_scl, int s_deg, long nu, long nv, double u_scl, double v_scl, double *xos, double *xsd, int job)
{
/* Calculated parameters */
double in_ijk;
double uc, u_left, u_right, vc, v_left, v_right;
double uc_temp1, vc_temp1;
double uc_temp2, vc_temp2;
long i, j, k;
/* Extract some pre-calculated coefficients */
double a1=xsd[0]; double a2=xsd[1]; double a3=xsd[2]; double a4=xsd[3];
double a5=xsd[4]; double a6=xsd[5]; double a7=xsd[6]; double a8=xsd[7];
double a9=xsd[8]; double a10=xsd[9]; double a11=xsd[10]; double a12=xsd[11];
/* double o1=xos[0]; double o2=xos[1]; double o3=xos[2]; double o4=xos[3]; */
double o5=xos[4]; double o6=xos[5]; double o7=xos[6]; double o8=xos[7];
double o9=xos[8]; double o10=xos[9]; double o11=xos[10]; double o12=xos[11];
double a1inv = -1.0*(1.0/a1);
double b1 = a6 + a1inv*a5*a2; double c1 = a10 + a1inv*a9*a2;
double b2 = a7 + a1inv*a5*a3; double c2 = a11 + a1inv*a9*a3;
double b3 = a8 + a1inv*a5*a4; double c3 = a12 + a1inv*a9*a4;
double v_x = b1*o5 + b2*o9; double u_x = c1*o5 + c2*o9;
double v_y = b1*o6 + b2*o10; double u_y = c1*o6 + c2*o10;
double v_z = b1*o7 + b2*o11; double u_z = c1*o7 + c2*o11;
double v_c = b1*o8 + b2*o12 + b3; double u_c = c1*o8 + c2*o12 + c3;
double a1sqr = a1*a1;
double a5sqr = v_scl*v_scl*a5*a5; //FIXME: metric scale
double a9sqr = u_scl*u_scl*a9*a9; //FIXME: metric scale
/* Initialize scaling factors */
double delta_u = sqrt(1.0+(a9sqr/(a1sqr+a5sqr)));
double delta_v = sqrt(1.0+(a5sqr/a1sqr));
double rho0 = s_scl*s_scl*s_scl*delta_u*delta_v;
double h_norm_u = s_scl/u_scl;
double h_norm_v = s_scl/v_scl;
double scl_norm_u = 1.0/h_norm_u;
double scl_norm_v = 1.0/h_norm_v;
/* Retrieve the half support of the footprint on detector */
double half_support_init = 0.5*(s_deg+1);
double half_support_u = half_support_init*h_norm_u;
double half_support_v = half_support_init*h_norm_v;
for (k=0; k<nz; ++k) {
/* Projection of the voxel center */
vc_temp1 = v_z*k + v_c;
uc_temp1 = u_z*k + u_c;
for (j=0; j<ny; ++j) {
/* Projection of the voxel center */
vc_temp2 = vc_temp1 + v_y*j;
uc_temp2 = uc_temp1 + u_y*j;
for (i=0; i<nx; ++i) {
/* Projection of the voxel center */
vc = vc_temp2 + v_x*i;
uc = uc_temp2 + u_x*i;
/* Get the bounds positions of the footprint */
u_left = uc-half_support_u;
u_right = uc+half_support_u;
v_left = vc-half_support_v;
v_right = vc+half_support_v;
/* Constrain the bounds positions to the detector support */
if (u_left < 0.0) u_left = 0.0;
else if (u_left >= 0.0 && u_left <= (nu-1)) u_left = floor(u_left);
else u_left = nu-1;
if (u_right < 0.0) u_right = 0.0;
else if (u_right >= 0.0 && u_right <= (nu-1)) u_right = floor(u_right)+1;
else u_right = nu;
if (v_left < 0.0) v_left = 0.0;
else if (v_left >= 0.0 && v_left <= (nv-1)) v_left = floor(v_left);
else v_left = nv-1;
if (v_right < 0.0) v_right = 0.0;
else if (v_right >= 0.0 && v_right <= (nv-1)) v_right = floor(v_right)+1;
else v_right = nv;
/* Burn footprint on Detector */
if (job == 0) {
/* DIRECT OPERATOR */
/* Get voxel value */
in_ijk = TRTT_VOXEL_VALUE_ACCESS(in,nx,ny,i,j,k);
if (_trtt_3D_burn_footprint_3D(out, in_ijk, uc, vc, u_left, u_right, \
v_left, v_right, nu, rho0, scl_norm_u, \
scl_norm_v) == TRTT_FAILURE) {
return TRTT_FAILURE;
}
} else {
/* TRANSPOSE OPERATOR */
if (_trtt_3D_burn_footprint_3D_transp(out, in, uc, vc, u_left, u_right, \
v_left, v_right, nu, \
nx, ny, i, j, k, \
rho0, scl_norm_u, \
scl_norm_v) == TRTT_FAILURE) {
return TRTT_FAILURE;
}
}
}
}
}
return TRTT_SUCCESS;
}
/*--------------*/
/*-3D CONE BEAM-*/
/*--------------*/
int trtt_CB3D_cubic(double *out, double *in, long nx, long ny, long nz, double s_scl, int s_deg, long nu, long nv, double u_scl, double v_scl, double *xos, double *xsd, int job)
{
/* Calculated parameters */
double in_ijk;
double num_u, num_v, den, wk;
double num_u_temp1, num_v_temp1, den_temp1, wk_temp1;
double num_u_temp2, num_v_temp2, den_temp2, wk_temp2;
double uc, u_left, u_right, vc, v_left, v_right;
long i, j, k;
/* Extract some pre-calculated coefficients */
double a1=xsd[0]; double a2=xsd[1]; double a3=xsd[2]; double a4=xsd[3];
double a5=xsd[4]; double a6=xsd[5]; double a7=xsd[6]; double a8=xsd[7];
double a9=xsd[8]; double a10=xsd[9]; double a11=xsd[10]; double a12=xsd[11];
double o1=xos[0]; double o2=xos[1]; double o3=xos[2]; double o4=xos[3];
double o5=xos[4]; double o6=xos[5]; double o7=xos[6]; double o8=xos[7];
double o9=xos[8]; double o10=xos[9]; double o11=xos[10]; double o12=xos[11];
double a1inv = -1.0*(1.0/a1);
double b1 = a6 + a1inv*a5*a2; double c1 = a10 + a1inv*a9*a2;
double b2 = a7 + a1inv*a5*a3; double c2 = a11 + a1inv*a9*a3;
double b3 = a8 + a1inv*a5*a4; double c3 = a12 + a1inv*a9*a4;
double num_v_x = b1*o5 + b2*o9; double num_u_x = c1*o5 + c2*o9;
double num_v_y = b1*o6 + b2*o10; double num_u_y = c1*o6 + c2*o10;
double num_v_z = b1*o7 + b2*o11; double num_u_z = c1*o7 + c2*o11;
double num_v_c = b1*o8 + b2*o12; double num_u_c = c1*o8 + c2*o12;
double den_x = a1*o1 + a2*o5 + a3*o9;
double den_y = a1*o2 + a2*o6 + a3*o10;
double den_z = a1*o3 + a2*o7 + a3*o11;
double den_c = a1*o4 + a2*o8 + a3*o12;
double a4sqr = a4*a4;
double a4m = -1.0*a4;
/* Various intermediate variables */
double a4quot;
double uca12, vca8, vca8sqr;
/* Initialize scaling factors */
double rho0;
double rho0_init = s_scl*s_scl*s_scl;
double delta_u, delta_v, magn, magn_sqr;
/* Normalized b-spline step to pixel detector sampling */
double h_norm_u, h_norm_v;
double h_norm_u_init = s_scl/u_scl;
double h_norm_v_init = s_scl/v_scl;
double scl_norm_u, scl_norm_v;
/* Retrieve the half support of the footprint on detector */
double half_support_u, half_support_v;
double half_support_init = 0.5*(s_deg+1);
for (k=0; k<nz; ++k) {
/* Projection of the voxel center */
wk_temp1 = o3*k + o4;
num_u_temp1 = num_u_z*k + num_u_c;
num_v_temp1 = num_v_z*k + num_v_c;
den_temp1 = den_z*k + den_c;
for (j=0; j<ny; ++j) {
/* Projection of the voxel center */
wk_temp2 = wk_temp1 + o2*j;
num_u_temp2 = num_u_temp1 + num_u_y*j;
num_v_temp2 = num_v_temp1 + num_v_y*j;
den_temp2 = den_temp1 + den_y*j;
for (i=0; i<nx; ++i) {
/* Projection of the voxel center */
wk = wk_temp2 + o1*i;
num_u = num_u_temp2 + num_u_x*i;
num_v = num_v_temp2 + num_v_x*i;
den = den_temp2 + den_x*i;
/* Projection on Detector */
a4quot = a4m/den;
uc = a4quot*num_u + c3;
vc = a4quot*num_v + b3;
/* Calculate the scaling factors */
if (wk != 0) {
uca12 = (uc-a12)*u_scl; //FIXME: metric scale
vca8 = (vc-a8)*v_scl; //FIXME: metric scale
vca8sqr = vca8*vca8;
magn = a4m/wk;
magn_sqr = magn*magn;
delta_u = sqrt(1.0+((uca12*uca12)/(a4sqr+vca8sqr)));
delta_v = sqrt(1.0+((vca8sqr)/(a4sqr)));
rho0 = rho0_init*magn_sqr*delta_u*delta_v;
h_norm_u = h_norm_u_init*magn*delta_u;
h_norm_v = h_norm_v_init*magn*delta_v;
scl_norm_u = 1.0/h_norm_u;
scl_norm_v = 1.0/h_norm_v;
half_support_u = half_support_init * h_norm_u;
half_support_v = half_support_init * h_norm_v;
} else {
fprintf(stderr, "IT WAS SUPPOSED TO BE HIGHLY IMPOSSIBLE !!!\n");
return TRTT_FAILURE;
}
/* Get the bounds positions of the footprint */
u_left = uc-half_support_u;
u_right = uc+half_support_u;
v_left = vc-half_support_v;
v_right = vc+half_support_v;
/* Constrain the bounds positions to the detector support */
if (u_left < 0.0) u_left = 0.0;
else if (u_left >= 0.0 && u_left <= (nu-1)) u_left = floor(u_left);
else u_left = nu-1;
if (u_right < 0.0) u_right = 0.0;
else if (u_right >= 0.0 && u_right <= (nu-1)) u_right = floor(u_right)+1;
else u_right = nu;
if (v_left < 0.0) v_left = 0.0;
else if (v_left >= 0.0 && v_left <= (nv-1)) v_left = floor(v_left);
else v_left = nv-1;
if (v_right < 0.0) v_right = 0.0;
else if (v_right >= 0.0 && v_right <= (nv-1)) v_right = floor(v_right)+1;
else v_right = nv;
/* Burn footprint on Detector */
if (job == 0) {
/* DIRECT OPERATOR */
/* Get voxel value */
in_ijk = TRTT_VOXEL_VALUE_ACCESS(in,nx,ny,i,j,k);
if (_trtt_3D_burn_footprint_3D(out, in_ijk, uc, vc, u_left, u_right, \
v_left, v_right, nu, rho0, scl_norm_u, \
scl_norm_v) == TRTT_FAILURE) {
return TRTT_FAILURE;
}
} else {
/* TRANSPOSE OPERATOR */
if (_trtt_3D_burn_footprint_3D_transp(out, in, uc, vc, u_left, u_right, \
v_left, v_right, nu, nx, ny, i, j, k, \
rho0, scl_norm_u, \
scl_norm_v) == TRTT_FAILURE) {
return TRTT_FAILURE;
}
}
}
}
}
return TRTT_SUCCESS;
}
|
35f2c0e93712c967e88bd26ff598c8c70d9fad81
|
f6786f5f51c0a71a09213e2f729766d1a04dffa2
|
/C프로그래밍_한빛/06_Preprocessor/06_mecro_MAX_function.c
|
12a01304bb7cbfdb3b95f32031dcf2bf612b1ef4
|
[] |
no_license
|
SuperstarterJaeeun/Learn-Programming-Book
|
4f075fdec386a0449da8d0d08bb8f1b6d6b2f304
|
f768acfffcb20b9fc97946ca491f6ffb20671896
|
refs/heads/master
| 2023-07-24T07:13:24.374240 | 2021-09-06T14:56:02 | 2021-09-06T14:56:02 | null | 0 | 0 | null | null | null | null |
UHC
|
C
| false | false | 361 |
c
|
06_mecro_MAX_function.c
|
#include <stdio.h>
#define MAX(a, b, c) (((a)>(b)) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)))
int main() {
int a, b, c;
printf("a값 : ");
scanf_s("%d", &a);
printf("b값 : ");
scanf_s("%d", &b);
printf("c값 : ");
scanf_s("%d", &c);
printf("입력하신 값 중에서 가장 큰 값은 %d입니다. \n", MAX(a, b, c));
return 0;
}
|
8361e0f2150a34d37cb2f4a947ff97bcfdc9a7fe
|
0f5a6af679b82023b00a54a4685b4fc8aa29c4f1
|
/C++/Functions/program.c
|
98c1bceeaea2160e0ee274074374f9e52ea9ee5c
|
[] |
no_license
|
ryzenboi98/hacker-rank
|
354c3f9e6ecf89254e4ce4828f8878852e161eb3
|
00f45537e3fbb6623ecac503cc8aaabd123c1ddc
|
refs/heads/main
| 2023-03-03T22:53:06.481393 | 2021-02-17T18:48:22 | 2021-02-17T18:48:22 | 318,302,056 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 572 |
c
|
program.c
|
#include <iostream>
#include <cstdio>
using namespace std;
/*
Add `int max_of_four(int a, int b, int c, int d)` here.
*/
int max_of_four(int a, int b, int c, int d) {
int numbs[4];
numbs[0] = a;
numbs[1] = b;
numbs[2] = c;
numbs[3] = d;
int max = numbs[0];
for(int i = 1; i < sizeof(*numbs); i++)
if(max < numbs[i])
max = numbs[i];
return max;
}
int main() {
int a, b, c, d;
scanf("%d %d %d %d", &a, &b, &c, &d);
int ans = max_of_four(a, b, c, d);
printf("%d", ans);
return 0;
}
|
d36f217fe42c8b56f535fcbab29d5fa64af15467
|
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
|
/source/php-src/ext/ffi/extr_ffi.c_zend_ffi_validate_field_type.c
|
17130d863abcd3e1954362ce94e0b3395f3c31e8
|
[] |
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 | 1,510 |
c
|
extr_ffi.c_zend_ffi_validate_field_type.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 */
typedef struct TYPE_6__ TYPE_1__ ;
/* Type definitions */
struct TYPE_6__ {int attr; } ;
typedef TYPE_1__ zend_ffi_type ;
/* Variables and functions */
int FAILURE ;
int /*<<< orphan*/ FFI_G (int /*<<< orphan*/ ) ;
scalar_t__ SUCCESS ;
int ZEND_FFI_ATTR_INCOMPLETE_ARRAY ;
int ZEND_FFI_ATTR_UNION ;
int /*<<< orphan*/ line ;
int /*<<< orphan*/ zend_ffi_throw_parser_error (char*,int /*<<< orphan*/ ) ;
int zend_ffi_validate_prev_field_type (TYPE_1__*) ;
scalar_t__ zend_ffi_validate_var_type (TYPE_1__*,int) ;
__attribute__((used)) static int zend_ffi_validate_field_type(zend_ffi_type *type, zend_ffi_type *struct_type) /* {{{ */
{
if (type == struct_type) {
zend_ffi_throw_parser_error("struct/union can't contain an instance of itself at line %d", FFI_G(line));
return FAILURE;
} else if (zend_ffi_validate_var_type(type, 1) != SUCCESS) {
return FAILURE;
} else if (struct_type->attr & ZEND_FFI_ATTR_UNION) {
if (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
zend_ffi_throw_parser_error("flexible array member in union at line %d", FFI_G(line));
return FAILURE;
}
}
return zend_ffi_validate_prev_field_type(struct_type);
}
|
254901cca30063516b5e73902542369967117769
|
d230ff65f38852d7996f2c986f9993a5579e2007
|
/NetworkMonitorServer/NetworkMonitorGetLogName.c
|
1651b9b162e4ffc7bfcc1877d558e0ce29525f4e
|
[] |
no_license
|
gsaltis/NetMonitor
|
d5a5f684ff874950f556d133d0644172995d27a4
|
58cad542e3204d284d32d5e7f1081062da828a60
|
refs/heads/main
| 2023-03-06T06:30:56.522434 | 2021-02-11T21:48:38 | 2021-02-11T21:48:38 | 337,420,062 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 267 |
c
|
NetworkMonitorGetLogName.c
|
/*****************************************************************************!
* Function : NetworkMonitorGetLogName
*****************************************************************************/
string
NetworkMonitorGetLogName
()
{
return networkLogFilename;
}
|
a755b2bd57c535aa71a9c38365e0790c912507ed
|
864897e7c6c319de723200c62169e1ebb076867a
|
/PigRacing002/Classes/basic.h
|
fb518d07dcc5c90a29fbec05be1d4d3e609f4863
|
[] |
no_license
|
songfj/PigRacingTest
|
6c9d185d43fe88b17cf67384f0995894938c7723
|
3d0176a89bd5b64d80e83a27bb9b103dcf534edd
|
refs/heads/master
| 2020-12-24T13:27:57.165205 | 2014-03-07T14:32:30 | 2014-03-07T14:32:30 | 17,400,720 | 0 | 1 | null | null | null | null |
GB18030
|
C
| false | false | 616 |
h
|
basic.h
|
/**
* Date:2014-3-6 22:52:32
* Author:薛凯
* Instruction:公用常量,宏等
**/
123123123123
#ifndef __PIGRACING_BASIC_H__
#define __PIGRACING_BASIC_H__
#define PTM_RATIO 32.0
#define PI 3.1415926
enum EStringValues
{
//文件路径
MAP_FOLDER_PATH=0,
PIG_FOLDER_PATH,
DEFAULT_MAP_PATH,
PIG_CONFIG_PATH,
//瓦片地图 图层
TMX_LAYER_OBSTACLE,
TMX_OBJECT_OBSTACLE,
TMX_OBJECT_SIGN,
//发电机[Dynamotor]图片
BTN_DYNAMOTOR_NORMAL,
BTN_DYNAMOTOR_PRESSED,
STRING_VALUES_COUNT
};
extern const char *g_StringValues[STRING_VALUES_COUNT];
#endif
|
f1954dfc9ec81eddbb8b1c42a30aa89b0b28cd2e
|
b11b3acda11ab6e0efb5360502421f5d9eb613e3
|
/src/wasm-binary-writer.c
|
b27ced8b2ce6e05209c2a0ed7a4c1b8100151f4a
|
[
"Apache-2.0"
] |
permissive
|
creationix/wabt
|
50a0d16d8b9f6342744c8b80bd3a50e852cf7ffe
|
1492e6c7dab33b1692872610bfa3f88c579104cb
|
refs/heads/master
| 2023-07-20T19:36:54.308310 | 2016-09-27T15:57:46 | 2016-09-27T15:57:46 | 69,416,497 | 1 | 0 | null | 2016-09-28T02:13:35 | 2016-09-28T02:13:35 | null |
UTF-8
|
C
| false | false | 31,927 |
c
|
wasm-binary-writer.c
|
/*
* Copyright 2016 WebAssembly Community Group participants
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "wasm-binary-writer.h"
#include "wasm-config.h"
#include <assert.h>
#include <math.h>
#include <memory.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include "wasm-ast.h"
#include "wasm-binary.h"
#include "wasm-stream.h"
#include "wasm-writer.h"
#define PRINT_HEADER_NO_INDEX -1
#define MAX_U32_LEB128_BYTES 5
#define MAX_U64_LEB128_BYTES 10
#define ALLOC_FAILURE \
fprintf(stderr, "%s:%d: allocation failed\n", __FILE__, __LINE__)
WASM_STATIC_ASSERT(WASM_TYPE_VOID == 0);
WASM_STATIC_ASSERT(WASM_TYPE_I32 == 1);
WASM_STATIC_ASSERT(WASM_TYPE_I64 == 2);
WASM_STATIC_ASSERT(WASM_TYPE_F32 == 3);
WASM_STATIC_ASSERT(WASM_TYPE_F64 == 4);
static const char* s_type_names[] = {
"WASM_TYPE_VOID", "WASM_TYPE_I32", "WASM_TYPE_I64",
"WASM_TYPE_F32", "WASM_TYPE_F64",
};
WASM_STATIC_ASSERT(WASM_ARRAY_SIZE(s_type_names) == WASM_NUM_TYPES);
#define V(rtype, type1, type2, mem_size, code, NAME, text) \
[code] = "OPCODE_" #NAME,
static const char* s_opcode_name[] = {WASM_FOREACH_OPCODE(V)};
#undef V
typedef struct WasmLabelNode {
const WasmLabel* label;
int depth;
struct WasmLabelNode* next;
} WasmLabelNode;
typedef struct Context {
WasmAllocator* allocator;
WasmStream stream;
WasmStream* log_stream;
const WasmWriteBinaryOptions* options;
WasmLabelNode* top_label;
int max_depth;
size_t last_section_offset;
size_t last_section_leb_size_guess;
} Context;
static void write_header(Context* ctx, const char* name, int index) {
if (ctx->log_stream) {
if (index == PRINT_HEADER_NO_INDEX) {
wasm_writef(ctx->log_stream, "; %s\n", name);
} else {
wasm_writef(ctx->log_stream, "; %s %d\n", name, index);
}
}
}
#define LEB128_LOOP_UNTIL(end_cond) \
do { \
uint8_t byte = value & 0x7f; \
value >>= 7; \
if (end_cond) { \
data[i++] = byte; \
break; \
} else { \
data[i++] = byte | 0x80; \
} \
} while (1)
/* returns the length of the leb128 */
static uint32_t write_u32_leb128_at(WasmStream* stream,
uint32_t offset,
uint32_t value,
const char* desc) {
uint8_t data[MAX_U32_LEB128_BYTES];
uint32_t i = 0;
LEB128_LOOP_UNTIL(value == 0);
uint32_t length = i;
wasm_write_data_at(stream, offset, data, length, WASM_DONT_PRINT_CHARS, desc);
return length;
}
static uint32_t write_fixed_u32_leb128_at(WasmStream* stream,
uint32_t offset,
uint32_t value,
const char* desc) {
uint8_t data[MAX_U32_LEB128_BYTES];
data[0] = (value & 0x7f) | 0x80;
data[1] = ((value >> 7) & 0x7f) | 0x80;
data[2] = ((value >> 14) & 0x7f) | 0x80;
data[3] = ((value >> 21) & 0x7f) | 0x80;
data[4] = ((value >> 28) & 0x0f);
wasm_write_data_at(stream, offset, data, MAX_U32_LEB128_BYTES,
WASM_DONT_PRINT_CHARS, desc);
return MAX_U32_LEB128_BYTES;
}
static void write_u32_leb128(WasmStream* stream,
uint32_t value,
const char* desc) {
uint32_t length = write_u32_leb128_at(stream, stream->offset, value, desc);
stream->offset += length;
}
static void write_i32_leb128(WasmStream* stream,
int32_t value,
const char* desc) {
uint8_t data[MAX_U32_LEB128_BYTES];
uint32_t i = 0;
if (value < 0)
LEB128_LOOP_UNTIL(value == -1 && (byte & 0x40));
else
LEB128_LOOP_UNTIL(value == 0 && !(byte & 0x40));
uint32_t length = i;
wasm_write_data_at(stream, stream->offset, data, length,
WASM_DONT_PRINT_CHARS, desc);
stream->offset += length;
}
static void write_i64_leb128(WasmStream* stream,
int64_t value,
const char* desc) {
uint8_t data[MAX_U64_LEB128_BYTES];
uint32_t i = 0;
if (value < 0)
LEB128_LOOP_UNTIL(value == -1 && (byte & 0x40));
else
LEB128_LOOP_UNTIL(value == 0 && !(byte & 0x40));
int length = i;
wasm_write_data_at(stream, stream->offset, data, length,
WASM_DONT_PRINT_CHARS, desc);
stream->offset += length;
}
#undef LEB128_LOOP_UNTIL
static uint32_t size_u32_leb128(uint32_t value) {
uint32_t size = 0;
do {
value >>= 7;
size++;
} while (value != 0);
return size;
}
/* returns offset of leb128 */
static uint32_t write_u32_leb128_space(Context* ctx,
uint32_t leb_size_guess,
const char* desc) {
assert(leb_size_guess <= MAX_U32_LEB128_BYTES);
uint8_t data[MAX_U32_LEB128_BYTES] = {0};
uint32_t result = ctx->stream.offset;
uint32_t bytes_to_write =
ctx->options->canonicalize_lebs ? leb_size_guess : MAX_U32_LEB128_BYTES;
wasm_write_data(&ctx->stream, data, bytes_to_write, desc);
return result;
}
static void write_fixup_u32_leb128_size(Context* ctx,
uint32_t offset,
uint32_t leb_size_guess,
const char* desc) {
if (ctx->options->canonicalize_lebs) {
uint32_t size = ctx->stream.offset - offset - leb_size_guess;
uint32_t leb_size = size_u32_leb128(size);
if (leb_size != leb_size_guess) {
uint32_t src_offset = offset + leb_size_guess;
uint32_t dst_offset = offset + leb_size;
wasm_move_data(&ctx->stream, dst_offset, src_offset, size);
}
write_u32_leb128_at(&ctx->stream, offset, size, desc);
ctx->stream.offset += leb_size - leb_size_guess;
} else {
uint32_t size = ctx->stream.offset - offset - MAX_U32_LEB128_BYTES;
write_fixed_u32_leb128_at(&ctx->stream, offset, size, desc);
}
}
static void write_str(WasmStream* stream,
const char* s,
size_t length,
WasmPrintChars print_chars,
const char* desc) {
write_u32_leb128(stream, length, "string length");
wasm_write_data_at(stream, stream->offset, s, length, print_chars, desc);
stream->offset += length;
}
static void write_opcode(WasmStream* stream, uint8_t opcode) {
wasm_write_u8(stream, opcode, s_opcode_name[opcode]);
}
static void begin_section(Context* ctx,
const char* name,
size_t leb_size_guess) {
assert(ctx->last_section_leb_size_guess == 0);
char desc[100];
wasm_snprintf(desc, sizeof(desc), "section \"%s\"", name);
write_header(ctx, desc, PRINT_HEADER_NO_INDEX);
ctx->last_section_leb_size_guess = leb_size_guess;
wasm_snprintf(desc, sizeof(desc), "section id: \"%s\"", name);
write_str(&ctx->stream, name, strlen(name), WASM_DONT_PRINT_CHARS, desc);
ctx->last_section_offset =
write_u32_leb128_space(ctx, leb_size_guess, "section size (guess)");
}
static void end_section(Context* ctx) {
assert(ctx->last_section_leb_size_guess != 0);
write_fixup_u32_leb128_size(ctx, ctx->last_section_offset,
ctx->last_section_leb_size_guess,
"FIXUP section size");
ctx->last_section_leb_size_guess = 0;
}
static WasmLabelNode* find_label_by_name(WasmLabelNode* top_label,
const WasmStringSlice* name) {
WasmLabelNode* node = top_label;
while (node) {
if (node->label && wasm_string_slices_are_equal(node->label, name))
return node;
node = node->next;
}
return NULL;
}
static WasmLabelNode* find_label_by_var(WasmLabelNode* top_label,
const WasmVar* var) {
if (var->type == WASM_VAR_TYPE_NAME)
return find_label_by_name(top_label, &var->name);
WasmLabelNode* node = top_label;
int i = 0;
while (node && i != var->index) {
node = node->next;
i++;
}
return node;
}
static void push_unused_label(Context* ctx,
WasmLabelNode* node,
const WasmLabel* label) {
assert(label);
node->label = label;
node->next = ctx->top_label;
node->depth = ctx->max_depth;
ctx->top_label = node;
}
static void pop_unused_label(Context* ctx, const WasmLabel* label) {
if (ctx->top_label && ctx->top_label->label == label)
ctx->top_label = ctx->top_label->next;
}
static void push_label(Context* ctx,
WasmLabelNode* node,
const WasmLabel* label) {
push_unused_label(ctx, node, label);
ctx->max_depth++;
}
static void pop_label(Context* ctx, const WasmLabel* label) {
ctx->max_depth--;
pop_unused_label(ctx, label);
}
static void write_expr_list(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmExpr* first_expr);
static void write_expr_opt(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmExpr* expr);
static void write_expr(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmExpr* expr) {
switch (expr->type) {
case WASM_EXPR_TYPE_BINARY:
write_expr(ctx, module, func, expr->binary.left);
write_expr(ctx, module, func, expr->binary.right);
write_opcode(&ctx->stream, expr->binary.opcode);
break;
case WASM_EXPR_TYPE_BLOCK: {
WasmLabelNode node;
push_label(ctx, &node, &expr->block.label);
write_opcode(&ctx->stream, WASM_OPCODE_BLOCK);
write_expr_list(ctx, module, func, expr->block.first);
write_opcode(&ctx->stream, WASM_OPCODE_END);
pop_label(ctx, &expr->block.label);
break;
}
case WASM_EXPR_TYPE_BR: {
WasmLabelNode* node = find_label_by_var(ctx->top_label, &expr->br.var);
assert(node);
write_expr_opt(ctx, module, func, expr->br.expr);
write_opcode(&ctx->stream, WASM_OPCODE_BR);
wasm_write_u8(&ctx->stream, expr->br.expr ? 1 : 0, "br arity");
write_u32_leb128(&ctx->stream, ctx->max_depth - node->depth - 1,
"break depth");
break;
}
case WASM_EXPR_TYPE_BR_IF: {
WasmLabelNode* node = find_label_by_var(ctx->top_label, &expr->br_if.var);
assert(node);
write_expr_opt(ctx, module, func, expr->br_if.expr);
write_expr(ctx, module, func, expr->br_if.cond);
write_opcode(&ctx->stream, WASM_OPCODE_BR_IF);
wasm_write_u8(&ctx->stream, expr->br_if.expr ? 1 : 0, "br_if arity");
write_u32_leb128(&ctx->stream, ctx->max_depth - node->depth - 1,
"break depth");
break;
}
case WASM_EXPR_TYPE_BR_TABLE: {
write_expr_opt(ctx, module, func, expr->br_table.expr);
write_expr(ctx, module, func, expr->br_table.key);
write_opcode(&ctx->stream, WASM_OPCODE_BR_TABLE);
wasm_write_u8(&ctx->stream, expr->br_table.expr ? 1 : 0,
"br_table arity");
write_u32_leb128(&ctx->stream, expr->br_table.targets.size,
"num targets");
size_t i;
WasmLabelNode* node;
for (i = 0; i < expr->br_table.targets.size; ++i) {
const WasmVar* var = &expr->br_table.targets.data[i];
node = find_label_by_var(ctx->top_label, var);
wasm_write_u32(&ctx->stream, ctx->max_depth - node->depth - 1,
"break depth");
}
node = find_label_by_var(ctx->top_label, &expr->br_table.default_target);
wasm_write_u32(&ctx->stream, ctx->max_depth - node->depth - 1,
"break depth for default");
break;
}
case WASM_EXPR_TYPE_CALL: {
int index = wasm_get_func_index_by_var(module, &expr->call.var);
assert(index >= 0 && (size_t)index < module->funcs.size);
write_expr_list(ctx, module, func, expr->call.first_arg);
write_opcode(&ctx->stream, WASM_OPCODE_CALL_FUNCTION);
write_u32_leb128(&ctx->stream, expr->call.num_args, "call arity");
write_u32_leb128(&ctx->stream, index, "func index");
break;
}
case WASM_EXPR_TYPE_CALL_IMPORT: {
int index = wasm_get_import_index_by_var(module, &expr->call.var);
assert(index >= 0 && (size_t)index < module->imports.size);
write_expr_list(ctx, module, func, expr->call.first_arg);
write_opcode(&ctx->stream, WASM_OPCODE_CALL_IMPORT);
write_u32_leb128(&ctx->stream, expr->call.num_args, "call_import arity");
write_u32_leb128(&ctx->stream, index, "import index");
break;
}
case WASM_EXPR_TYPE_CALL_INDIRECT: {
int index =
wasm_get_func_type_index_by_var(module, &expr->call_indirect.var);
assert(index >= 0 && (size_t)index < module->func_types.size);
write_expr(ctx, module, func, expr->call_indirect.expr);
write_expr_list(ctx, module, func, expr->call_indirect.first_arg);
write_opcode(&ctx->stream, WASM_OPCODE_CALL_INDIRECT);
write_u32_leb128(&ctx->stream, expr->call_indirect.num_args,
"call_indirect arity");
write_u32_leb128(&ctx->stream, index, "signature index");
break;
}
case WASM_EXPR_TYPE_COMPARE:
write_expr(ctx, module, func, expr->compare.left);
write_expr(ctx, module, func, expr->compare.right);
write_opcode(&ctx->stream, expr->compare.opcode);
break;
case WASM_EXPR_TYPE_CONST:
switch (expr->const_.type) {
case WASM_TYPE_I32: {
write_opcode(&ctx->stream, WASM_OPCODE_I32_CONST);
write_i32_leb128(&ctx->stream, (int32_t)expr->const_.u32,
"i32 literal");
break;
}
case WASM_TYPE_I64:
write_opcode(&ctx->stream, WASM_OPCODE_I64_CONST);
write_i64_leb128(&ctx->stream, (int64_t)expr->const_.u64,
"i64 literal");
break;
case WASM_TYPE_F32:
write_opcode(&ctx->stream, WASM_OPCODE_F32_CONST);
wasm_write_u32(&ctx->stream, expr->const_.f32_bits, "f32 literal");
break;
case WASM_TYPE_F64:
write_opcode(&ctx->stream, WASM_OPCODE_F64_CONST);
wasm_write_u64(&ctx->stream, expr->const_.f64_bits, "f64 literal");
break;
default:
assert(0);
}
break;
case WASM_EXPR_TYPE_CONVERT:
write_expr(ctx, module, func, expr->convert.expr);
write_opcode(&ctx->stream, expr->convert.opcode);
break;
case WASM_EXPR_TYPE_CURRENT_MEMORY:
write_opcode(&ctx->stream, WASM_OPCODE_CURRENT_MEMORY);
break;
case WASM_EXPR_TYPE_GET_LOCAL: {
int index = wasm_get_local_index_by_var(func, &expr->get_local.var);
write_opcode(&ctx->stream, WASM_OPCODE_GET_LOCAL);
write_u32_leb128(&ctx->stream, index, "local index");
break;
}
case WASM_EXPR_TYPE_GROW_MEMORY:
write_expr(ctx, module, func, expr->grow_memory.expr);
write_opcode(&ctx->stream, WASM_OPCODE_GROW_MEMORY);
break;
case WASM_EXPR_TYPE_IF: {
WasmLabelNode node;
write_expr(ctx, module, func, expr->if_.cond);
write_opcode(&ctx->stream, WASM_OPCODE_IF);
push_label(ctx, &node, &expr->if_.true_.label);
write_expr_list(ctx, module, func, expr->if_.true_.first);
pop_label(ctx, &expr->if_.true_.label);
write_opcode(&ctx->stream, WASM_OPCODE_END);
break;
}
case WASM_EXPR_TYPE_IF_ELSE: {
WasmLabelNode node;
write_expr(ctx, module, func, expr->if_else.cond);
write_opcode(&ctx->stream, WASM_OPCODE_IF);
push_label(ctx, &node, &expr->if_else.true_.label);
write_expr_list(ctx, module, func, expr->if_else.true_.first);
pop_label(ctx, &expr->if_else.true_.label);
write_opcode(&ctx->stream, WASM_OPCODE_ELSE);
push_label(ctx, &node, &expr->if_else.false_.label);
write_expr_list(ctx, module, func, expr->if_else.false_.first);
pop_label(ctx, &expr->if_else.false_.label);
write_opcode(&ctx->stream, WASM_OPCODE_END);
break;
}
case WASM_EXPR_TYPE_LOAD: {
write_expr(ctx, module, func, expr->load.addr);
write_opcode(&ctx->stream, expr->load.opcode);
uint32_t align =
wasm_get_opcode_alignment(expr->load.opcode, expr->load.align);
uint8_t align_log = 0;
while (align > 1) {
align >>= 1;
align_log++;
}
wasm_write_u8(&ctx->stream, align_log, "alignment");
write_u32_leb128(&ctx->stream, (uint32_t)expr->load.offset,
"load offset");
break;
}
case WASM_EXPR_TYPE_LOOP: {
WasmLabelNode outer;
WasmLabelNode inner;
push_label(ctx, &outer, &expr->loop.outer);
push_label(ctx, &inner, &expr->loop.inner);
write_opcode(&ctx->stream, WASM_OPCODE_LOOP);
write_expr_list(ctx, module, func, expr->loop.first);
write_opcode(&ctx->stream, WASM_OPCODE_END);
pop_label(ctx, &expr->loop.inner);
pop_label(ctx, &expr->loop.outer);
break;
}
case WASM_EXPR_TYPE_NOP:
write_opcode(&ctx->stream, WASM_OPCODE_NOP);
break;
case WASM_EXPR_TYPE_RETURN:
write_expr_opt(ctx, module, func, expr->return_.expr);
write_opcode(&ctx->stream, WASM_OPCODE_RETURN);
wasm_write_u8(&ctx->stream, expr->return_.expr ? 1 : 0, "return arity");
break;
case WASM_EXPR_TYPE_SELECT:
write_expr(ctx, module, func, expr->select.true_);
write_expr(ctx, module, func, expr->select.false_);
write_expr(ctx, module, func, expr->select.cond);
write_opcode(&ctx->stream, WASM_OPCODE_SELECT);
break;
case WASM_EXPR_TYPE_SET_LOCAL: {
int index = wasm_get_local_index_by_var(func, &expr->get_local.var);
write_expr(ctx, module, func, expr->set_local.expr);
write_opcode(&ctx->stream, WASM_OPCODE_SET_LOCAL);
write_u32_leb128(&ctx->stream, index, "local index");
break;
}
case WASM_EXPR_TYPE_STORE: {
write_expr(ctx, module, func, expr->store.addr);
write_expr(ctx, module, func, expr->store.value);
write_opcode(&ctx->stream, expr->store.opcode);
uint32_t align =
wasm_get_opcode_alignment(expr->store.opcode, expr->store.align);
uint8_t align_log = 0;
while (align > 1) {
align >>= 1;
align_log++;
}
wasm_write_u8(&ctx->stream, align_log, "alignment");
write_u32_leb128(&ctx->stream, (uint32_t)expr->store.offset,
"store offset");
break;
}
case WASM_EXPR_TYPE_UNARY:
write_expr(ctx, module, func, expr->unary.expr);
write_opcode(&ctx->stream, expr->unary.opcode);
break;
case WASM_EXPR_TYPE_UNREACHABLE:
write_opcode(&ctx->stream, WASM_OPCODE_UNREACHABLE);
break;
}
}
static void write_expr_list(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmExpr* first) {
const WasmExpr* expr;
for (expr = first; expr; expr = expr->next)
write_expr(ctx, module, func, expr);
}
static void write_expr_opt(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmExpr* expr) {
if (expr)
write_expr(ctx, module, func, expr);
}
static void write_func_locals(Context* ctx,
const WasmModule* module,
const WasmFunc* func,
const WasmTypeVector* local_types) {
if (local_types->size == 0) {
write_u32_leb128(&ctx->stream, 0, "local decl count");
return;
}
uint32_t num_params = wasm_get_num_params(module, func);
#define FIRST_LOCAL_INDEX (num_params)
#define LAST_LOCAL_INDEX (num_params + local_types->size)
#define GET_LOCAL_TYPE(x) (local_types->data[x - num_params])
/* loop through once to count the number of local declaration runs */
WasmType current_type = GET_LOCAL_TYPE(FIRST_LOCAL_INDEX);
uint32_t local_decl_count = 1;
uint32_t i;
for (i = FIRST_LOCAL_INDEX + 1; i < LAST_LOCAL_INDEX; ++i) {
WasmType type = GET_LOCAL_TYPE(i);
if (current_type != type) {
local_decl_count++;
current_type = type;
}
}
/* loop through again to write everything out */
write_u32_leb128(&ctx->stream, local_decl_count, "local decl count");
current_type = GET_LOCAL_TYPE(FIRST_LOCAL_INDEX);
uint32_t local_type_count = 1;
for (i = FIRST_LOCAL_INDEX + 1; i <= LAST_LOCAL_INDEX; ++i) {
/* loop through an extra time to catch the final type transition */
WasmType type = i == LAST_LOCAL_INDEX ? WASM_TYPE_VOID : GET_LOCAL_TYPE(i);
if (current_type == type) {
local_type_count++;
} else {
write_u32_leb128(&ctx->stream, local_type_count, "local type count");
wasm_write_u8(&ctx->stream, current_type, s_type_names[current_type]);
local_type_count = 1;
current_type = type;
}
}
}
static void write_func(Context* ctx,
const WasmModule* module,
const WasmFunc* func) {
WasmLabelNode node;
WasmLabel label = wasm_empty_string_slice();
write_func_locals(ctx, module, func, &func->local_types);
push_label(ctx, &node, &label);
write_expr_list(ctx, module, func, func->first_expr);
pop_label(ctx, &label);
}
static void write_module(Context* ctx, const WasmModule* module) {
/* TODO(binji): better leb size guess. Some sections we know will only be 1
byte, but others we can be fairly certain will be larger. */
const size_t leb_size_guess = 1;
size_t i;
wasm_write_u32(&ctx->stream, WASM_BINARY_MAGIC, "WASM_BINARY_MAGIC");
wasm_write_u32(&ctx->stream, WASM_BINARY_VERSION, "WASM_BINARY_VERSION");
if (module->func_types.size) {
begin_section(ctx, WASM_SECTION_NAME_TYPE, leb_size_guess);
write_u32_leb128(&ctx->stream, module->func_types.size, "num types");
for (i = 0; i < module->func_types.size; ++i) {
const WasmFuncType* func_type = module->func_types.data[i];
const WasmFuncSignature* sig = &func_type->sig;
write_header(ctx, "type", i);
wasm_write_u8(&ctx->stream, WASM_BINARY_TYPE_FORM_FUNCTION,
"function form");
uint32_t num_params = sig->param_types.size;
write_u32_leb128(&ctx->stream, num_params, "num params");
size_t j;
for (j = 0; j < num_params; ++j)
wasm_write_u8(&ctx->stream, sig->param_types.data[j], "param type");
uint32_t num_results = sig->result_type == WASM_TYPE_VOID ? 0 : 1;
write_u32_leb128(&ctx->stream, num_results, "num results");
if (num_results)
wasm_write_u8(&ctx->stream, sig->result_type, "result_type");
}
end_section(ctx);
}
if (module->imports.size) {
begin_section(ctx, WASM_SECTION_NAME_IMPORT, leb_size_guess);
write_u32_leb128(&ctx->stream, module->imports.size, "num imports");
for (i = 0; i < module->imports.size; ++i) {
const WasmImport* import = module->imports.data[i];
write_header(ctx, "import header", i);
write_u32_leb128(&ctx->stream,
wasm_get_func_type_index_by_decl(module, &import->decl),
"import signature index");
write_str(&ctx->stream, import->module_name.start,
import->module_name.length, WASM_PRINT_CHARS,
"import module name");
write_str(&ctx->stream, import->func_name.start, import->func_name.length,
WASM_PRINT_CHARS, "import function name");
}
end_section(ctx);
}
if (module->funcs.size) {
begin_section(ctx, WASM_SECTION_NAME_FUNCTION, leb_size_guess);
write_u32_leb128(&ctx->stream, module->funcs.size, "num functions");
for (i = 0; i < module->funcs.size; ++i) {
const WasmFunc* func = module->funcs.data[i];
char desc[100];
wasm_snprintf(desc, sizeof(desc), "function %" PRIzd " signature index",
i);
write_u32_leb128(&ctx->stream,
wasm_get_func_type_index_by_decl(module, &func->decl),
desc);
}
end_section(ctx);
}
if (module->table && module->table->size) {
begin_section(ctx, WASM_SECTION_NAME_TABLE, leb_size_guess);
write_u32_leb128(&ctx->stream, module->table->size,
"num function table entries");
for (i = 0; i < module->table->size; ++i) {
int index = wasm_get_func_index_by_var(module, &module->table->data[i]);
assert(index >= 0 && (size_t)index < module->funcs.size);
write_u32_leb128(&ctx->stream, index, "function table entry");
}
end_section(ctx);
}
if (module->memory) {
WasmBool export_memory = module->export_memory != NULL;
begin_section(ctx, WASM_SECTION_NAME_MEMORY, leb_size_guess);
write_u32_leb128(&ctx->stream, (uint32_t)module->memory->initial_pages,
"min mem pages");
write_u32_leb128(&ctx->stream, (uint32_t)module->memory->max_pages,
"max mem pages");
wasm_write_u8(&ctx->stream, export_memory, "export mem");
end_section(ctx);
}
if (module->exports.size) {
begin_section(ctx, WASM_SECTION_NAME_EXPORT, leb_size_guess);
write_u32_leb128(&ctx->stream, module->exports.size, "num exports");
for (i = 0; i < module->exports.size; ++i) {
const WasmExport* export = module->exports.data[i];
int func_index = wasm_get_func_index_by_var(module, &export->var);
assert(func_index >= 0 && (size_t)func_index < module->funcs.size);
write_u32_leb128(&ctx->stream, func_index, "export func index");
write_str(&ctx->stream, export->name.start, export->name.length,
WASM_PRINT_CHARS, "export name");
}
end_section(ctx);
}
if (module->start) {
int start_func_index = wasm_get_func_index_by_var(module, module->start);
if (start_func_index != -1) {
begin_section(ctx, WASM_SECTION_NAME_START, leb_size_guess);
write_u32_leb128(&ctx->stream, start_func_index, "start func index");
end_section(ctx);
}
}
if (module->funcs.size) {
begin_section(ctx, WASM_SECTION_NAME_CODE, leb_size_guess);
write_u32_leb128(&ctx->stream, module->funcs.size, "num functions");
for (i = 0; i < module->funcs.size; ++i) {
write_header(ctx, "function body", i);
const WasmFunc* func = module->funcs.data[i];
/* TODO(binji): better guess of the size of the function body section */
const uint32_t leb_size_guess = 1;
uint32_t body_size_offset =
write_u32_leb128_space(ctx, leb_size_guess, "func body size (guess)");
write_func(ctx, module, func);
write_fixup_u32_leb128_size(ctx, body_size_offset, leb_size_guess,
"FIXUP func body size");
}
end_section(ctx);
}
if (module->memory && module->memory->segments.size) {
begin_section(ctx, WASM_SECTION_NAME_DATA, leb_size_guess);
write_u32_leb128(&ctx->stream, module->memory->segments.size,
"num data segments");
for (i = 0; i < module->memory->segments.size; ++i) {
const WasmSegment* segment = &module->memory->segments.data[i];
write_header(ctx, "segment header", i);
write_u32_leb128(&ctx->stream, segment->addr, "segment address");
write_u32_leb128(&ctx->stream, segment->size, "segment size");
write_header(ctx, "segment data", i);
wasm_write_data(&ctx->stream, segment->data, segment->size,
"segment data");
}
end_section(ctx);
}
if (ctx->options->write_debug_names) {
WasmStringSliceVector index_to_name;
WASM_ZERO_MEMORY(index_to_name);
char desc[100];
begin_section(ctx, WASM_SECTION_NAME_NAME, leb_size_guess);
write_u32_leb128(&ctx->stream, module->funcs.size, "num functions");
for (i = 0; i < module->funcs.size; ++i) {
const WasmFunc* func = module->funcs.data[i];
uint32_t num_params = wasm_get_num_params(module, func);
uint32_t num_locals = func->local_types.size;
uint32_t num_params_and_locals =
wasm_get_num_params_and_locals(module, func);
wasm_snprintf(desc, sizeof(desc), "func name %" PRIzd, i);
write_str(&ctx->stream, func->name.start, func->name.length,
WASM_PRINT_CHARS, desc);
write_u32_leb128(&ctx->stream, num_params_and_locals, "num locals");
if (num_params_and_locals) {
wasm_make_type_binding_reverse_mapping(
ctx->allocator, &func->decl.sig.param_types, &func->param_bindings,
&index_to_name);
size_t j;
for (j = 0; j < num_params; ++j) {
WasmStringSlice name = index_to_name.data[j];
wasm_snprintf(desc, sizeof(desc), "local name %" PRIzd, j);
write_str(&ctx->stream, name.start, name.length, WASM_PRINT_CHARS,
desc);
}
wasm_make_type_binding_reverse_mapping(
ctx->allocator, &func->local_types, &func->local_bindings,
&index_to_name);
for (j = 0; j < num_locals; ++j) {
WasmStringSlice name = index_to_name.data[j];
wasm_snprintf(desc, sizeof(desc), "local name %" PRIzd,
num_params + j);
write_str(&ctx->stream, name.start, name.length, WASM_PRINT_CHARS,
desc);
}
}
}
end_section(ctx);
wasm_destroy_string_slice_vector(ctx->allocator, &index_to_name);
}
}
static void write_commands(Context* ctx, const WasmScript* script) {
size_t i;
WasmBool wrote_module = WASM_FALSE;
for (i = 0; i < script->commands.size; ++i) {
const WasmCommand* command = &script->commands.data[i];
if (command->type != WASM_COMMAND_TYPE_MODULE)
continue;
write_module(ctx, &command->module);
wrote_module = WASM_TRUE;
break;
}
if (!wrote_module) {
/* just write an empty module */
WasmModule module;
WASM_ZERO_MEMORY(module);
write_module(ctx, &module);
}
}
WasmResult wasm_write_binary_module(WasmAllocator* allocator,
WasmWriter* writer,
const WasmModule* module,
const WasmWriteBinaryOptions* options) {
Context ctx;
WASM_ZERO_MEMORY(ctx);
ctx.allocator = allocator;
ctx.options = options;
ctx.log_stream = options->log_stream;
wasm_init_stream(&ctx.stream, writer, ctx.log_stream);
write_module(&ctx, module);
return ctx.stream.result;
}
WasmResult wasm_write_binary_script(WasmAllocator* allocator,
WasmWriter* writer,
const WasmScript* script,
const WasmWriteBinaryOptions* options) {
Context ctx;
WASM_ZERO_MEMORY(ctx);
ctx.allocator = allocator;
ctx.options = options;
ctx.log_stream = options->log_stream;
wasm_init_stream(&ctx.stream, writer, ctx.log_stream);
write_commands(&ctx, script);
return ctx.stream.result;
}
|
e5aaefc346880a13dea861bfa5f8daa967278095
|
94db0bd95a58fabfd47517ed7d7d819a542693cd
|
/client/ClientRes/IOSAPI/Classes/Native/mscorlib_System_Collections_Generic_Dictionary_2_E3851722287MethodDeclarations.h
|
0d260a410e45def5beeb4e03e568304f87a1f1d4
|
[] |
no_license
|
Avatarchik/card
|
9fc6efa058085bd25f2b8831267816aa12b24350
|
d18dbc9c7da5cf32c963458ac13731ecfbf252fa
|
refs/heads/master
| 2020-06-07T07:01:00.444233 | 2017-12-11T10:52:17 | 2017-12-11T10:52:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 7,811 |
h
|
mscorlib_System_Collections_Generic_Dictionary_2_E3851722287MethodDeclarations.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>
// System.Collections.Generic.Dictionary`2<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>
struct Dictionary_2_t2531697585;
// System.Object
struct Il2CppObject;
#include "codegen/il2cpp-codegen.h"
#include "mscorlib_System_Collections_Generic_Dictionary_2_E3851722287.h"
#include "mscorlib_System_Collections_DictionaryEntry3048875398.h"
#include "mscorlib_System_Collections_Generic_KeyValuePair_2_289042807.h"
#include "Photon3Unity3D_ExitGames_Client_Photon_ConnectionP3211808698.h"
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::.ctor(System.Collections.Generic.Dictionary`2<TKey,TValue>)
extern "C" void Enumerator__ctor_m3054604558_gshared (Enumerator_t3851722287 * __this, Dictionary_2_t2531697585 * ___dictionary0, const MethodInfo* method);
#define Enumerator__ctor_m3054604558(__this, ___dictionary0, method) (( void (*) (Enumerator_t3851722287 *, Dictionary_2_t2531697585 *, const MethodInfo*))Enumerator__ctor_m3054604558_gshared)(__this, ___dictionary0, method)
// System.Object System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::System.Collections.IEnumerator.get_Current()
extern "C" Il2CppObject * Enumerator_System_Collections_IEnumerator_get_Current_m71536175_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_System_Collections_IEnumerator_get_Current_m71536175(__this, method) (( Il2CppObject * (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_System_Collections_IEnumerator_get_Current_m71536175_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::System.Collections.IEnumerator.Reset()
extern "C" void Enumerator_System_Collections_IEnumerator_Reset_m3690677723_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_System_Collections_IEnumerator_Reset_m3690677723(__this, method) (( void (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_System_Collections_IEnumerator_Reset_m3690677723_gshared)(__this, method)
// System.Collections.DictionaryEntry System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::System.Collections.IDictionaryEnumerator.get_Entry()
extern "C" DictionaryEntry_t3048875398 Enumerator_System_Collections_IDictionaryEnumerator_get_Entry_m2694215320_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_System_Collections_IDictionaryEnumerator_get_Entry_m2694215320(__this, method) (( DictionaryEntry_t3048875398 (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_System_Collections_IDictionaryEnumerator_get_Entry_m2694215320_gshared)(__this, method)
// System.Object System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::System.Collections.IDictionaryEnumerator.get_Key()
extern "C" Il2CppObject * Enumerator_System_Collections_IDictionaryEnumerator_get_Key_m367812457_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_System_Collections_IDictionaryEnumerator_get_Key_m367812457(__this, method) (( Il2CppObject * (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_System_Collections_IDictionaryEnumerator_get_Key_m367812457_gshared)(__this, method)
// System.Object System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::System.Collections.IDictionaryEnumerator.get_Value()
extern "C" Il2CppObject * Enumerator_System_Collections_IDictionaryEnumerator_get_Value_m4008767369_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_System_Collections_IDictionaryEnumerator_get_Value_m4008767369(__this, method) (( Il2CppObject * (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_System_Collections_IDictionaryEnumerator_get_Value_m4008767369_gshared)(__this, method)
// System.Boolean System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::MoveNext()
extern "C" bool Enumerator_MoveNext_m3546636575_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_MoveNext_m3546636575(__this, method) (( bool (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_MoveNext_m3546636575_gshared)(__this, method)
// System.Collections.Generic.KeyValuePair`2<TKey,TValue> System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::get_Current()
extern "C" KeyValuePair_2_t289042807 Enumerator_get_Current_m2322974903_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_get_Current_m2322974903(__this, method) (( KeyValuePair_2_t289042807 (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_get_Current_m2322974903_gshared)(__this, method)
// TKey System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::get_CurrentKey()
extern "C" uint8_t Enumerator_get_CurrentKey_m1685687470_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_get_CurrentKey_m1685687470(__this, method) (( uint8_t (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_get_CurrentKey_m1685687470_gshared)(__this, method)
// TValue System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::get_CurrentValue()
extern "C" int32_t Enumerator_get_CurrentValue_m218725870_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_get_CurrentValue_m218725870(__this, method) (( int32_t (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_get_CurrentValue_m218725870_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::Reset()
extern "C" void Enumerator_Reset_m2840355764_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_Reset_m2840355764(__this, method) (( void (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_Reset_m2840355764_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::VerifyState()
extern "C" void Enumerator_VerifyState_m1768804213_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_VerifyState_m1768804213(__this, method) (( void (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_VerifyState_m1768804213_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::VerifyCurrent()
extern "C" void Enumerator_VerifyCurrent_m2003435587_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_VerifyCurrent_m2003435587(__this, method) (( void (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_VerifyCurrent_m2003435587_gshared)(__this, method)
// System.Void System.Collections.Generic.Dictionary`2/Enumerator<ExitGames.Client.Photon.ConnectionProtocol,System.Int32>::Dispose()
extern "C" void Enumerator_Dispose_m518877434_gshared (Enumerator_t3851722287 * __this, const MethodInfo* method);
#define Enumerator_Dispose_m518877434(__this, method) (( void (*) (Enumerator_t3851722287 *, const MethodInfo*))Enumerator_Dispose_m518877434_gshared)(__this, method)
|
989afa2dbb62bf8a5e0d480019a38dbbc59f47c4
|
8c780c0a389bf7e0612c5b91ab69cca41c172151
|
/product/PDFTextSDK/chelib/include/che_define.h
|
ea2a50a7119f0b320718583bf453920e35c30777
|
[] |
no_license
|
zencher/chelib
|
8de42915ecba4356b22dba022bdded98c913167d
|
dd559493b88a190063838c454efdff60ac7e4014
|
refs/heads/master
| 2020-03-09T17:12:52.799132 | 2017-12-20T11:37:52 | 2017-12-20T11:37:52 | 128,904,030 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,019 |
h
|
che_define.h
|
#ifndef _CHE_DEFINE_
#define _CHE_DEFINE_
typedef void HE_VOID;
//Pointer to any type.
typedef void * HE_LPVOID;
//Pointer to any constant type.
typedef void const * HE_LPCVOID;
//Byte (8 bits).
typedef unsigned char HE_BYTE;
//Pointer to a HE_BYTE.
typedef unsigned char * HE_LPBYTE;
//Pointer to a constant HE_BYTE.
typedef unsigned char const * HE_LPCBYTE;
//Short integer (16 bits).
typedef short HE_SHORT;
//16-bit unsigned integer.
typedef unsigned short HE_WORD;
//Pointer to a DWORD.
typedef unsigned short * HE_LPWORD;
//32-bit signed integer.
typedef int HE_INT32;
typedef unsigned int HE_UINT32;
//32-bit unsigned integer.
typedef unsigned long HE_DWORD;
//Pointer to a DWORD.
typedef unsigned long * HE_LPDWORD;
//Boolean variable (should be TRUE or FALSE).
typedef bool HE_BOOL;
//8-bit Windows (ANSI) character.
typedef char HE_CHAR;
//Pointer to 8-bit Windows (ANSI) characters.
typedef char * HE_LPSTR;
//Pointer to constant 8-bit Windows (ANSI) characters.
typedef char const * HE_LPCSTR;
#ifdef _MSC_VER
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#endif
#endif
//16-bit Unicode character.
typedef wchar_t HE_WCHAR;
//Pointer to 16-bit Unicode characters.
typedef wchar_t * HE_LPWSTR;
//Pointer to constant 16-bit Unicode characters.
typedef wchar_t const * HE_LPCWSTR;
typedef long HE_LONG;
//Signed 64-bit integer.
typedef long int HE_INT64;
//Unsigned 64-bit integer.
typedef unsigned long HE_UINT64;
//Signed integral type for pointer precision.
typedef int HE_INTPTR;
//Unsigned integral type for pointer precision.
typedef unsigned int HE_UINTPTR;
//32-bit floating-point number.
typedef float HE_FLOAT;
typedef double HE_DOUBLE;
#define FALSE 0
#define TRUE 1
#ifndef NULL
#define NULL 0
#endif
struct HE_RECT
{
HE_DWORD left;
HE_DWORD top;
HE_DWORD width;
HE_DWORD height;
};
#define HE_ABS abs
#endif
|
1a31305e7dac8ae186e2d6fce78ee93123e429d9
|
66c02294e9c4e81e4ab4b84b593cdcbd54dc6db8
|
/usage.c
|
00a90a92702159cefedda1173eb61dbadab0a97c
|
[] |
no_license
|
sechang11/42_lem-in
|
a591b4db95958e6e6cf04ff5fe1f537fc6e73068
|
99122f626eaffe68917d092be8dbc926a5f25440
|
refs/heads/master
| 2020-04-08T06:54:46.852894 | 2019-03-24T19:57:13 | 2019-03-24T19:57:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,519 |
c
|
usage.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* usage.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sechang <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/15 19:31:04 by sechang #+# #+# */
/* Updated: 2019/03/24 04:55:19 by sechang ### ########.fr */
/* */
/* ************************************************************************** */
#include "lem_in.h"
void usage_flags(t_lemin *input, t_rooms *r)
{
if (input->usage == 'b')
{
ft_printf("Number of Ants: %d\n", input->ants_in);
ft_printf("Number of Rooms: %d\n", input->nbrofrooms);
ft_printf("Starting Room: %s\n", input->start->name);
ft_printf("Ending Room: %s\n", input->end->name);
}
else if (input->usage == 'n' || input->usage == 'd')
print_usage(input, r);
exit(1);
}
void print_usage(t_lemin *input, t_rooms *r)
{
t_rooms *tmp;
t_links *tmp2;
tmp = r;
while (tmp)
{
if (input->usage == 'n')
{
if (tmp == input->start)
ft_printf(" - S:");
else if (tmp == input->end)
ft_printf(" - E:");
ft_printf("Room name: %s Neighbors:", tmp->name);
ft_printf("%s:%d:%d:%d , ", tmp->name, ((t_rooms *)
hash_lookup(tmp->name, input->hasht)->data)->dist, ((t_rooms *)hash_lookup(tmp->name, input->hasht)->data)->pathnbr,((t_rooms *)hash_lookup(tmp->name, input->hasht)->data)->occupied);
tmp2 = tmp->linx;
while (tmp2)
{
ft_printf("%s:%d:%d:%d, \n", tmp2->link, ((t_rooms *)
hash_lookup(tmp2->link, input->hasht)->data)->dist, ((t_rooms *)hash_lookup(tmp2->link, input->hasht)->data)->pathnbr, ((t_rooms *)hash_lookup(tmp2->link, input->hasht)->data)->occupied);
tmp2 = tmp2->next;
}
ft_printf("\n");
}
else if (input->usage == 'd')
{
ft_printf("Room name: %s, Distance: %d, Occupied: %d\n",
tmp->name, tmp->dist, tmp->occupied);
}
tmp = tmp->next;
}
ft_printf("Nbr of Ants: %d\n", input->ants_in);
ft_printf("Nbr paths taken: %d\n", input->paths_taken);
ft_printf("Nbr of Turns: %d\n", input->best_turn);
}
|
3057515f0afa658f505662284f60e800ae10f247
|
68c375dc78b5c42dbf425d091afd2403768dc3a2
|
/main.c
|
68d06c9f35003903cc2ba5093db520eeb7755c4d
|
[
"Apache-2.0"
] |
permissive
|
evairmarinho/C-Banking-System-Project
|
69a0c259f357092617666b4d82fd9644740d1c8b
|
e462b743c6e439bd262c77f6c217304e1b3a04e7
|
refs/heads/main
| 2023-03-18T10:34:03.139714 | 2021-03-03T22:44:46 | 2021-03-03T22:44:46 | 225,178,096 | 1 | 0 | null | null | null | null |
ISO-8859-1
|
C
| false | false | 5,402 |
c
|
main.c
|
#include<time.h>
#include"gerenciaClientes.h"
#include"banco.h"
#include"cliente.h"
#include"conta.h"
#include <stdio.h>
#include <stdlib.h>
//ATUALIZADO DESDE 07/07/2020
void menu() // função para interface de menu
{
printf("--------MENU--------\n\n");
printf("1 - CADASTRAR CLIENTE\n");
printf("2 - CADASTRAR CONTA\n");
printf("3 - LISTAR CONTA\n");
printf("4 - PESQUISAR CONTA\n");
printf("5 - DEPOSITAR\n");
printf("6 - DEBITAR(SACAR)\n");
printf("7 - TRANSFERIR\n");
printf("8 - REMOVER CONTA\n");
printf("9 - SAIR\n");
printf("Digite a opcao: \n");
}
int main()
{
char opcao;
do
{
menu();
scanf(" %c",&opcao);//leitura da opção escolhida pelo usuário
switch(opcao)
{
case '1':
adicionarCliente(getCliente());
break;
case '2':
adicionarConta(getConta1());
break;
case '3':
if(numeroConta > 0)
{
listarContas();
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '4':
if(numeroConta > 0)
{
printf("Digite o numero da sua conta\n");
int num;
scanf("%i",&num);
if(existeConta(num) == 1)
{
pesquisarConta(num);
}
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '5':
if(numeroConta > 0)
{
printf("Digite o numero da sua conta\n");
int num3;
scanf("%i",&num3);
if(existeConta(num3) == 1)
{
TConta conta;
conta.numero = num3;
printf("Digite o valor de deposito\n");
float quantia;
scanf("%f",&quantia);
depositar(conta,quantia);
}
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '6':
if(numeroConta > 0)
{
printf("Digite o numero da sua conta\n");
int num;
scanf("%i",&num);
if(existeConta(num) == 1)
{
printf("Digite o valor de saque\n");
float valor;
scanf("%f",&valor);
TConta conta;
conta.numero = num;
debitar(conta,valor);
}
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '7':
if(numeroConta > 0)
{
if(numeroConta > 1)
{
printf("Digite o numero da sua conta\n");
int num;
scanf("%i",&num);
if(existeConta(num) == 1)
{
TConta conta1;
conta1.numero = num;
printf("Digite o numero da conta que terá o valor transferido\n");
int num2;
scanf("%i",&num2);
if(existeConta(num2) == 1)
{
if(num2 != num)
{
TConta conta2;
conta2.numero = num2;
float valor;
printf("Digite a quantia que você quer transferir\n");
scanf("%f",&valor);
transferir(conta1,conta2,valor);
}
else
{
printf("VOCE NAO PODE TRANSFERIR PARA SUA PROPRIA CONTA!!!\n");
}
}
}
}
else
{
printf("CADASTRE NO MINIMO DUAS CONTAS!!!\n");
}
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '8':
if(numeroConta > 0)
{
printf("Digite o numero da conta que deseja remover\n");
int remover;
scanf("%i",&remover);
if(existeConta(remover) == 1)
{
removerConta(remover);
}
}
else
{
printf("CADASTRE UMA CONTA PRIMEIRO!!!\n");
}
break;
case '9':
printf("\nFIM DO PROGRAMA...\n");
break;
default:
printf("\nOPCAO INVALIDA!!!\n\n"); //mensagemn de erro
printf("Digite numeros de 1 a 9\n\n"); //recomendação para o usuário
}
}
while (opcao != '9'); // o loop rodará enquanto a opção não for igual a de número 9 - (Saída do Programa)
return 0;
}
|
988471bc25857a01f1a28173fb30f46a7e4d9b0e
|
1ee8742090e12352a7f2cb3bdfc97e3e8b917a8a
|
/teste/atvideo4l.c
|
d1ff477a25913487ebfcbac07d1709e26e45c595
|
[
"MIT"
] |
permissive
|
anderflash/atkv
|
4e246e880f63db8cee8d060b17be8ccd6f807fa0
|
f956445822fc8b554eb6c52efebb0012478cc39c
|
refs/heads/master
| 2021-01-17T17:06:47.891837 | 2014-09-20T21:46:39 | 2014-09-20T21:46:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,447 |
c
|
atvideo4l.c
|
#include "atvideo4l.h"
static int xioctl(int fh, int request, void *arg)
{
int r;
do {
r = ioctl(fh, request, arg);
} while (-1 == r && EINTR == errno);
return r;
}
int abrirDispositivo(ATDispositivoV4L* dispositivo)
{
struct stat st;
// Tentar identificar o dispositivo
if(-1 == stat(dispositivo->nome, &st))
{
fprintf(stderr, "Não pode identificar '%s': %d %s\n", dispositivo->nome, errno, strerror(errno));
return EXIT_FAILURE;
}
// Tentar verificar se é um dispositivo
if(!S_ISCHR(st.st_mode))
{
fprintf(stderr, "%s não é dispositivo\n", dispositivo->nome);
return EXIT_FAILURE;
}
// Tentar abrir o arquivo do dispositivo
dispositivo->arquivo = open(dispositivo->nome, O_RDWR | O_NONBLOCK, 0);
// Se não conseguiu, erro
if(-1 == dispositivo->arquivo)
{
fprintf(stderr, "Não pode abrir '%s': %d, %s\n", dispositivo->nome, errno, strerror(errno));
return EXIT_FAILURE;
}
return 0;
}
int iniciarDispositivo(ATDispositivoV4L* dispositivo)
{
struct v4l2_capability cap;
struct v4l2_cropcap cropcap;
struct v4l2_crop crop;
struct v4l2_format fmt;
if(-1 == xioctl(dispositivo->arquivo, VIDIOC_QUERYCAP, &cap))
{
if(EINVAL == errno)
{
fprintf(stderr, "%s não é um dispositivo V4L2\n", dispositivo->nome);
return EXIT_FAILURE;
}
}
if(!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
{
fprintf(stderr, "%s não é um dispositivo de captura de vídeo\n", dispositivo->nome);
return EXIT_FAILURE;
}
if(!(cap.capabilities & V4L2_CAP_READWRITE))
{
fprintf(stderr, "%s não suporta leitura e escrita\n", dispositivo->nome);
return EXIT_FAILURE;
}
CLEAR(cropcap);
cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if(0 == xioctl(dispositivo->arquivo, VIDIOC_CROPCAP, &cropcap))
{
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
crop.c = cropcap.defrect;
if(-1 == xioctl(dispositivo->arquivo, VIDIOC_S_CROP, &crop))
{
switch(errno)
{
case EINVAL: /* cropping não suportado*/ break;
default: /* erros ignorados */ break;
}
}
}else
{
/* erros ignorados */
}
CLEAR(fmt);
return 0;
}
void iniciarCaptura(ATDispositivoV4L* dispositivo)
{
}
void terminarDispositivo(ATDispositivoV4L* dispositivo)
{
}
void desligarDispositivo(ATDispositivoV4L* dispositivo)
{
}
void capturarQuadro(ATDispositivoV4L* dispositivo)
{
}
// Ir para um tempo
// void irPara(DispositivoV4L* dispositivo, /* tempo */)
// {
// }
|
672f0997cef0b8aae496802a9cfa2a5f43b0bf3f
|
5469e0ed533d56167ae4ec39016574e475ac8b68
|
/plugins/Arma_InlineHelper_Plugin_ECDSA_Replace/src/main.h
|
07245db1f1a696fcb020f0267708149d98419db6
|
[] |
no_license
|
pepeng/akt
|
89791a86acf9bdf3f64f0ad6308a935f27992391
|
b60be2d7c66fdc8cdc6cbabda01f44b43b9c3efc
|
refs/heads/master
| 2021-01-24T15:34:06.644129 | 2014-02-03T19:27:55 | 2014-02-03T19:27:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 550 |
h
|
main.h
|
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "resource.h"
#include "format.h"
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
const char* DLL_EXPORT PluginInfo(void);
void DLL_EXPORT PluginFunction(HINSTANCE hInst, HWND hwndDlg, const char* register_vp, const char* program_dir, unsigned int imagebase);
#ifdef __cplusplus
}
#endif
#endif
|
119a2c6f56b7bf5cc95141c068d458ff9f662d27
|
0b551347a29f4e01e9273615ce0c5242f9bdb63a
|
/pkg/inst/c_wrappers/call_R_function.h
|
e095f3e18be58269ff6485cd1844c76f5989c6cc
|
[] |
no_license
|
timemod/dynmdl
|
8088fecc6c2b84d50ecb7d7b762bddb2b1fcf629
|
8dc49923e2dcc60b15af2ae1611cb3a86f87b887
|
refs/heads/master
| 2023-04-07T21:30:53.271703 | 2023-03-03T13:02:30 | 2023-03-03T13:02:30 | 148,925,096 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 327 |
h
|
call_R_function.h
|
void init_call_R(void);
void close_call_R(void);
void call_R_function(const char *func_name, int narg, double *value,
double *jac, ...);
void call_R_function_jac(const char *func_name, int narg, double *jac, ...);
void call_jacob_element(const char *func_name, int narg, int index, double *jac_elem, ...);
|
916c09484cf79ad75fbb62823d5c398c50b5f5e1
|
7887994fa26906e56c81d8483d4f929901170f0f
|
/DUC_data/DUC2007/updateEval/BE/BEpeers/D0740-B.M.100.I.H
|
cd42b9bf86b7858ac01eddf85af61d2387cffdbc
|
[
"Apache-2.0"
] |
permissive
|
gsandeep1241/TextSummarizer
|
7f1c95eb43c39102111684a957986e2f06a28745
|
fc9af3cf3a74114db94a837d5d20c16a08f806be
|
refs/heads/master
| 2022-12-11T12:38:38.847154 | 2018-04-27T18:44:23 | 2018-04-27T18:44:23 | 162,769,959 | 0 | 0 |
Apache-2.0
| 2022-12-08T01:03:21 | 2018-12-22T00:43:20 |
Pan
|
UTF-8
|
C
| false | false | 1,186 |
h
|
D0740-B.M.100.I.H
|
departing|switzerland|obj
switzerland|march 1 , 1999 ,|on
team|swiss/british|nn
team|balloon|nn
after|drifted|comp1
drifted|team|subj
southwestward|north africa|to
north africa|catching|before
stream|favorable|mod
stream|jet|nn
catching|stream|obj
degrees|9.27|amount-value
longitude|degrees|nn
longitude|west|nn
stream|longitude|at
flew|there|from
flew|team|subj
flew|east|obj
east|asia|across
east|then|pnmod
then|pacific|over
days|six|amount-value
pacific|days|for
days|mexico|to
mexico|leaving|nn
mexico|team|appo
team|floated|vrel
floated|team|obj
floated|central america|over
floated|crossed|conj
crossed|team|subj
crossed|caribbean|obj
caribbean|jamaica|towards
crossed|and|punc
crossed|steered|conj
steered|team|subj
finish line|"|punc
steered|finish line|towards
steered|"|punc
steered|somewhere|mod
west|longitude|nn
degrees|9.27|amount-value
west|degrees|nn
somewhere|west|along
west|mauritania|in
day|their|gen
day|18th|mod
day|began|rel
began|day|obj
began|balloonists|subj
began|crossing|mod
crossing|balloonist|subj
crossing|atlantic|obj
leg|last|post
atlantic|leg|on
flight|successful|mod
flight|non-stop|mod
flight|around-the-world|mod
flight|balloon|nn
be|flight|pred
|
0443cf1cdddedb0fe6e90b59bef207f12ed90a02
|
6278226a46fe1160b820a23a561e295e8f1404bb
|
/code/peripheral/xDev_win32.c
|
6abe6217ac0ffc7b51286abe3b532c4d591b0ba8
|
[] |
no_license
|
qdleepo/ProjectAfcApp
|
60485b376c347866795f199a117cb5097c6c2c6a
|
9b5a5d710893cbdec8973fabd3353e011d2ea576
|
refs/heads/master
| 2021-05-23T19:10:45.914003 | 2018-09-23T01:43:37 | 2018-09-23T01:43:37 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 566 |
c
|
xDev_win32.c
|
#include "Macro_Proj.h"
#if WHICH_PLATFORM == _WIN32_PLATFORM_V
#include "xDev.h"
#include <windows.h>
#include <Tlhelp32.h>
static TFuncShowInUI s_funcShowInUi = NULL;
/**
* @Description - init device
*
*
* @Return (int,ERet_Code) - fail when less than 0, else is successful
*/
int xDev_Init(TFuncShowInUI funcShow) {
if (s_funcShowInUi == NULL) {
s_funcShowInUi = funcShow;
}
return Ret_OK;
}
void ShowInUI(int row, int column, char msg[], int textPosition) {
if (s_funcShowInUi != NULL) {
s_funcShowInUi(row, column, msg, textPosition);
}
}
#endif
|
01c5d84c2a5629652e92f0392bf1156ef336e25a
|
b2562b4ad097980258c2fb271b6810f1496d47da
|
/src/gl/formats.h
|
facdf6b5b5fc76dd61ab3c074fc6a8c0b1305116
|
[] |
no_license
|
zzb66666666x/CGAPI
|
c22647cd8276cc3615d401eb2cf3b53a088d8925
|
97b15579a2dd65fb7d24f440e282b649a7743b9a
|
refs/heads/master
| 2023-07-24T14:48:36.449871 | 2021-08-27T08:07:55 | 2021-08-27T08:07:55 | 370,940,508 | 3 | 1 | null | null | null | null |
UTF-8
|
C
| false | false | 680 |
h
|
formats.h
|
#ifndef _FORMATS_H
#define _FORMATS_H
// F: float
// U: unsigned
// C: channel
// <depth> <F|U> <C> <channel_num>
typedef struct{
float R;
float G;
float B;
}COLOR_32FC3;
typedef struct{
unsigned char R;
unsigned char G;
unsigned char B;
}COLOR_8UC3;
typedef struct{
float R;
float G;
float B;
float A;
}COLOR_32FC4;
typedef struct{
unsigned char R;
unsigned char G;
unsigned char B;
unsigned char A;
}COLOR_8UC4;
typedef struct{
float R;
}COLOR_32FC1;
#define FORMAT_COLOR_32FC3 1
#define FORMAT_COLOR_8UC3 2
#define FORMAT_COLOR_32FC4 3
#define FORMAT_COLOR_8UC4 4
#define FORMAT_COLOR_32FC1 5
#endif
|
d83ad5580a9ec2bee16dd0d8bfd643b65528c8da
|
439f12abbd1c0d93ba3fd5ba22b566197250a8ca
|
/stringsort/mem.c
|
6bfb1ccc2cba4ea37e45f712c1f094cc32e15a67
|
[] |
no_license
|
cruelnoise/krtoys
|
c2b38df046b8f8c159f79a67c55539b85107c0e9
|
f8d66dc4f63b500185abc4e8006ebe7c79193214
|
refs/heads/main
| 2023-01-14T03:17:32.240577 | 2020-11-18T21:44:27 | 2020-11-18T21:44:27 | 313,446,757 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 596 |
c
|
mem.c
|
#include "main.h"
static char membuf[MEMSIZE]; // storage for alloc
static char *memptr = membuf; // next free position
// retuns pointer to n characters of space.
char *alloc(int n) {
if (membuf + MEMSIZE - memptr >= n) {
// it fits
memptr += n; // set memptr to first item after space allocated
return memptr - n; // return the begginning of the allocated space
}
else {
// not enough space
return 0;
}
}
// frees everything after p.
void afree(char *p) {
if (p >= membuf && p < membuf + MEMSIZE) {
memptr = p;
}
}
|
4671c5ff8032209dad541b22c15454ce92ac67ed
|
58aa2455286cd4eb4147c5b0c4a9cfc8993f305f
|
/vcc/Test/testsuite/vscomp2010/vscomp2010_p5_v1.c
|
444f0df52dbd6a526b4615223e1a73b063b00150
|
[
"MIT"
] |
permissive
|
nchong-at-aws/vcc
|
0d3e82947739ed17e61dbd2d5a62e5f5ded2774c
|
fd7030f8f9c6d1a2842032464976178cad8b7e34
|
refs/heads/master
| 2021-01-06T23:48:32.719366 | 2020-02-19T02:47:53 | 2020-02-19T02:47:53 | 241,517,292 | 0 | 0 |
NOASSERTION
| 2020-02-19T02:46:32 | 2020-02-19T02:46:32 | null |
UTF-8
|
C
| false | false | 5,711 |
c
|
vscomp2010_p5_v1.c
|
#include <vcc.h>
#include <stdlib.h>
#define wrapped_dom(a) (\wrapped(a) && (a) \in \domain(a))
_(ghost typedef void *intMap[\integer])
typedef struct List {
void *head;
struct List *tail;
unsigned length;
_(ghost intMap val)
_(invariant \malloc_root(\this))
_(invariant val == \lambda \integer i; 0 <= i && i < length ? (i == 0 ? head : tail->val[i - 1]) : 0)
_(invariant length == 0 || length == tail->length + 1)
_(invariant length != 0 <==> \mine(tail))
} List, *PList;
PList ListNew()
_(ensures wrapped_dom(\result) && \fresh(\result))
_(ensures \result->length == 0)
{
PList l = malloc(sizeof(List));
_(assume l)
l->tail = NULL;
l->length = 0;
_(ghost l->val = \lambda \integer i; (void*)0)
_(wrap l)
return l;
}
PList Cons(List *l, void *d)
_(requires \wrapped(l))
_(requires l->length < UINT_MAX)
_(writes l)
_(ensures \wrapped(\result) && \fresh(\result))
_(ensures \result->length == \old(l->length) + 1)
_(ensures \result->val == \old(\lambda \integer i; i == 0 ? d : l->val[i - 1]))
{
PList r = malloc(sizeof(List));
_(assume r)
r->head = d;
r->tail = l;
r->length = l->length + 1;
_(ghost r->val = \lambda \integer i; i == 0 ? d : l->val[i - 1])
_(wrap r)
return r;
}
PList Concat(PList l, PList end)
_(requires \wrapped(l) && \wrapped(end) && l != end)
_(requires l->length + end->length <= UINT_MAX)
_(writes l, end)
_(ensures wrapped_dom(\result) && (\fresh(\result) || (\old(l->length == 0) && \result == end)))
_(ensures \result->length == \old(l->length + end->length))
_(ensures \result->val == \old(\lambda \integer i; i < l->length ? l->val[i] : end->val[i - l->length]))
{
_(unwrap l)
if (l->length == 0) {
free(l);
return end;
} else {
PList c = Concat(l->tail, end);
c = Cons(c, l->head);
free(l);
return c;
}
}
PList Reverse(PList l)
_(requires \wrapped(l))
_(writes l)
_(ensures wrapped_dom(\result) && (\fresh(\result) || (\result == l && \old(\result \in \domain(l)))))
_(ensures \result->val == \old(\lambda \integer i; l->val[(\integer) l->length - 1 - i]))
_(ensures \result->length == \old(l->length))
{
PList r;
if (l->length == 0) {
return l;
} else {
PList e, f;
_(unwrap l)
r = Reverse(l->tail);
e = ListNew();
f = Cons(e, l->head);
r = Concat(r, f);
return r;
}
}
PList Tail(PList l)
_(requires \wrapped(l) && l->length != 0)
_(writes l)
_(ensures \wrapped(\result) && \fresh(\result) && \old(\result \in \domain(l)))
_(ensures \result->length == \old(l->length) - 1)
_(ensures \result->val == \old(\lambda \integer i; i == -1 ? 0 : l->val[i + 1]))
{
_(unwrap l)
PList r = l->tail;
free(l);
return r;
}
typedef struct Queue {
PList front, rear;
_(invariant \malloc_root(\this))
_(invariant front != rear && \mine(front) && \mine(rear))
_(invariant rear->length <= front->length)
_(invariant front->length + rear->length <= UINT_MAX)
} Queue, *PQueue;
_(logic \integer QLen(Queue *q) = (q->front->length + q->rear->length))
_(ghost _(pure) intMap qv(PList front, PList rear)
_(reads \universe())
_(returns \lambda \integer i; i < front->length
? front->val[i]
: rear->val[_(\integer) rear->length + front->length - 1 - i]))
_(logic intMap QVal(Queue *q) = qv(q->front, q->rear))
Queue *QueueNew()
_(ensures \fresh(\result) && \wrapped(\result))
_(ensures QVal(\result) == \lambda \integer i; (void*)0)
{
Queue *r = malloc(sizeof(Queue));
_(assume r)
r->front = ListNew();
r->rear = ListNew();
_(wrap r)
return r;
}
Queue *QueueBuild(PList front, PList rear)
_(requires front->length + rear->length <= UINT_MAX)
_(requires \wrapped(front) && \wrapped(rear) && front != rear)
_(writes front, rear)
_(ensures wrapped_dom(\result) && \fresh(\result))
_(ensures QLen(\result) == \old(front->length + rear->length))
_(ensures QVal(\result) == \old(qv(front, rear)))
{
Queue *r = malloc(sizeof(Queue));
_(assume r)
if (rear->length <= front->length) {
r->front = front;
r->rear = rear;
} else {
PList f;
f = Reverse(rear);
r->front = Concat(front, f);
r->rear = ListNew();
}
_(wrap r)
return r;
}
void *QueueFront(Queue *q)
_(requires \wrapped(q) && QLen(q) > 0)
_(ensures \result == QVal(q)[0])
{
_(assert q->front \in \domain(q))
return q->front->head;
}
Queue *QueueTail(Queue *q)
_(requires \wrapped(q) && QLen(q) > 0)
_(writes q)
_(ensures \fresh(\result) && \wrapped(\result))
_(ensures QLen(\result) == \old(QLen(q) - 1))
_(ensures QVal(\result) == \old(\lambda \integer i; (i == -1 ? 0 : QVal(q)[i + 1])))
{
_(unwrap q)
_(assert wrapped_dom(q->front) && wrapped_dom(q->rear))
PList t = Tail(q->front);
Queue *r = QueueBuild(t, q->rear);
free(q);
return r;
}
Queue *Enqueue(Queue *q, void *item)
_(requires \wrapped(q))
_(requires QLen(q) + 1 <= UINT_MAX)
_(writes q)
_(ensures \fresh(\result) && \wrapped(\result))
_(ensures QLen(\result) == \old(QLen(q) + 1))
_(ensures QVal(\result) == \old(\lambda \integer i; i == QLen(q) ? item : QVal(q)[i]))
{
Queue *r;
_(unwrap q)
_(assert wrapped_dom(q->front) && wrapped_dom(q->rear))
q->rear = Cons(q->rear, item);
r = QueueBuild(q->front, q->rear);
return r;
}
/*`
Verification of List#adm succeeded.
Verification of Queue#adm succeeded.
Verification of ListNew succeeded.
Verification of Cons succeeded.
Verification of Concat succeeded.
Verification of Reverse succeeded.
Verification of Tail succeeded.
Verification of QueueNew succeeded.
Verification of QueueBuild succeeded.
Verification of QueueFront succeeded.
Verification of QueueTail succeeded.
Verification of Enqueue succeeded.
`*/
|
13bcf68e63ed23562465902f9b4d00199654c2cb
|
c90fcfcffe74bab0de35564dde19b552af70b8e2
|
/Aulas Teoricas/Aula_16_2-Funcoe/Ex2.c
|
c539b9fc3b3bc9e8b28f8c0c1628b6182d00aa43
|
[
"MIT"
] |
permissive
|
VictorOliveira02-zz/Programacao-SIN110
|
cf5e0b53ad10c4b2f4a3dd79a2abc4032c13d36c
|
e0c752962a58473e7aa5b57dd074492c6100c3ca
|
refs/heads/main
| 2023-05-09T04:00:43.002596 | 2021-05-20T15:19:26 | 2021-05-20T15:19:26 | 369,203,367 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 1,238 |
c
|
Ex2.c
|
// EXERCICIO 2
#include <stdio.h>
#include <stdlib.h>
const int tam = 5;
int maior(int *vet[], int len)
{
int num_maior = 0;
for (int cont = 0; cont < len; cont++)
{
if (vet[cont] > num_maior)
{
num_maior = vet[cont];
}
}
return printf("Maior: %d\n", num_maior);
}
int menor(int *vet[], int len)
{
int num_menor = 9999;
for (int cont = 0; cont < len; cont++)
{
if (vet[cont] < num_menor)
{
num_menor = vet[cont];
}
}
return printf("Menor: %d\n", num_menor);
}
int media(int vet[], int len)
{
int soma = 0, conta = 0;
for (int cont = 0; cont < len; cont++)
{
soma += vet[cont];
conta++;
}
return printf("Media: %d\n", soma / conta);
}
int main()
{
srand(time(NULL));
int vetor1[5];
for (int cont = 0; cont < tam; cont++)
{
vetor1[cont] = rand() % 10 + 1;
}
int vetor2[5];
for (int cont1 = 0; cont1 < tam; cont1++)
{
vetor2[cont1] = rand() % 10 + 1;
}
maior(vetor1, tam);
menor(vetor1, tam);
media(vetor1, tam);
printf("\n");
maior(vetor2, tam);
menor(vetor2, tam);
media(vetor2, tam);
return 0;
}
|
454298cf7ae1ddf754ee2cbf69672cc0e0336d24
|
610030172a8664266087a421adee144151198e95
|
/example_c/FailedCFiles/20150614-15:05:19/avrtest.c
|
d094e0d6b2433805d9e5b398e12a4e9f6b584a53
|
[] |
no_license
|
alon-e/AVR-GCC-bug-seeker
|
bb0945ccb2fade377bbcd30f2623467e0cacc028
|
40ecf9c576ab9784fd8cd693c1e2fbc0c7c4bba5
|
refs/heads/master
| 2021-08-07T15:20:16.696262 | 2017-11-08T12:05:44 | 2017-11-08T12:05:44 | 81,484,672 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 10,155 |
c
|
avrtest.c
|
/*
* This is a RANDOMLY GENERATED PROGRAM.
*
* Generator: csmith 2.2.0
* Git version: dcef523
* Options: --no-safe-math --no-math64 --no-bitfields --no-consts --no-float --no-divs --max-array-dim 2 --max-array-len-per-dim 8 --max-block-depth 2 --max-block-size 2 --max-expr-complexity 2 --max-funcs 4 --max-struct-fields 2 --max-union-fields 2 --output /specific/a/home/cc/students/cs/alonelmaliah//Desktop/avrTest/WorkFolder/avrtest.c
* Seed: 3868090329
*/
#include "csmith.h"
static long __undefined;
/* --- Struct/Union Declarations --- */
/* --- GLOBAL VARIABLES --- */
static uint8_t g_12 = 0x74L;
static int32_t g_21 = 0x6E9F0866L;
static int32_t g_24 = 0x4EA14C55L;
static volatile int8_t g_27 = 0xA2L;/* VOLATILE GLOBAL g_27 */
static uint32_t g_28[3][3] = {{1UL,1UL,1UL},{1UL,1UL,1UL},{1UL,1UL,1UL}};
static int32_t *g_36 = (void*)0;
static int32_t **g_35 = &g_36;
static int16_t g_73 = 1L;
static int8_t g_78[1] = {0x14L};
static uint8_t g_80 = 0xCCL;
static uint32_t g_85[1] = {18446744073709551615UL};
/* --- FORWARD DECLARATIONS --- */
static int16_t func_1(void);
static uint8_t func_6(uint32_t p_7, uint16_t p_8, uint16_t p_9);
static uint32_t func_37(uint32_t p_38, uint16_t p_39, int32_t * p_40, int8_t p_41, int32_t p_42);
static int32_t *** func_44(uint8_t p_45, int32_t p_46);
/* --- FUNCTIONS --- */
/* ------------------------------------------ */
/*
* reads : g_12 g_28 g_21 g_35 g_36 g_24 g_80 g_85 g_78 g_27
* writes: g_12 g_28 g_35 g_36 g_24 g_73 g_80 g_85
*/
static int16_t func_1(void)
{ /* block id: 0 */
uint32_t l_10 = 0x0F5872D9L;
uint8_t *l_11 = &g_12;
uint32_t l_13 = 0x4C59CDC3L;
int32_t l_14 = 0xFE662DB8L;
int32_t l_94 = 0xE2C43C23L;
l_94 = (((int16_t)(((uint8_t)func_6((((((*l_11) = l_10) ^ l_10) <= l_13) == 0L), l_10, l_14) % (uint8_t)0x9BL) > l_10) * (int16_t)g_21) < l_14);
for (g_80 = 25; (g_80 > 22); g_80 -= 2)
{ /* block id: 56 */
int32_t *l_97 = &l_94;
if (((*l_97) = l_94))
{ /* block id: 58 */
return g_85[0];
}
else
{ /* block id: 60 */
return l_94;
}
}
return l_94;
}
/* ------------------------------------------ */
/*
* reads : g_12 g_28 g_21 g_35 g_36 g_24 g_80 g_85 g_78 g_27
* writes: g_28 g_35 g_36 g_12 g_24 g_73 g_80 g_85
*/
static uint8_t func_6(uint32_t p_7, uint16_t p_8, uint16_t p_9)
{ /* block id: 2 */
uint32_t l_19 = 0x5F5B1B6FL;
int32_t l_25 = 0x0A9F4F9AL;
int32_t l_26 = 0xAE9F9034L;
int16_t l_43 = (-4L);
if (((uint32_t)((int8_t)l_19 << (int8_t)g_12) % (uint32_t)g_12))
{ /* block id: 3 */
int32_t *l_20 = &g_21;
int32_t *l_22 = &g_21;
int32_t *l_23[4][4] = {{&g_21,&g_21,&g_21,&g_21},{&g_21,(void*)0,&g_21,&g_21},{&g_21,&g_21,&g_21,&g_21},{&g_21,(void*)0,&g_21,&g_21}};
int32_t **l_33[2][6] = {{&l_20,&l_20,&l_20,&l_20,&l_20,&l_20},{&l_20,&l_20,&l_20,&l_20,&l_20,&l_20}};
int i, j;
--g_28[0][1];
for (p_8 = 23; (p_8 > 2); p_8--)
{ /* block id: 7 */
int32_t ***l_34[2];
int i;
for (i = 0; i < 2; i++)
l_34[i] = &l_33[0][3];
g_35 = l_33[0][3];
}
}
else
{ /* block id: 10 */
uint32_t *l_84[3][3] = {{(void*)0,&g_28[0][1],(void*)0},{&l_19,&l_19,&l_19},{(void*)0,&g_28[0][1],(void*)0}};
int i, j;
if ((((g_85[0] |= func_37(g_21, p_7, (*g_35), l_43, p_8)) ^ 0x0F1F8A70L) == g_28[1][2]))
{ /* block id: 42 */
uint16_t l_86[7][4] = {{0UL,0x95FEL,65535UL,0x95FEL},{0x4D57L,65534UL,65530UL,65535UL},{0x95FEL,65534UL,65534UL,0x95FEL},{65534UL,0x95FEL,0x4D57L,0UL},{65534UL,0x4D57L,65534UL,65530UL},{0x95FEL,0UL,65530UL,65530UL},{0x4D57L,0x4D57L,65535UL,0UL}};
int32_t l_87[3][3] = {{0L,0L,0L},{(-10L),1L,(-10L)},{0L,0L,0L}};
int i, j;
l_87[2][2] = ((l_86[1][3] ^= (g_78[0] && 0xFCA48CC9L)) != 0L);
(*g_35) = (p_9 , (void*)0);
}
else
{ /* block id: 46 */
int8_t *l_92[6];
int32_t l_93 = 0xED7DDA23L;
int i;
for (i = 0; i < 6; i++)
l_92[i] = &g_78[0];
(*g_35) = &l_25;
(**g_35) = ((int8_t)((int8_t)(l_93 = g_24) >> (int8_t)p_8) * (int8_t)g_27);
}
}
return g_85[0];
}
/* ------------------------------------------ */
/*
* reads : g_24 g_35 g_36 g_12 g_28 g_80
* writes: g_36 g_12 g_24 g_73 g_80
*/
static uint32_t func_37(uint32_t p_38, uint16_t p_39, int32_t * p_40, int8_t p_41, int32_t p_42)
{ /* block id: 11 */
int32_t ***l_56 = &g_35;
int32_t ****l_55 = &l_56;
int32_t l_58 = 0L;
int32_t l_79[8];
int16_t l_83 = 1L;
int i;
for (i = 0; i < 8; i++)
l_79[i] = 0xE041B8CDL;
if ((((*l_55) = func_44(p_38, g_24)) == (void*)0))
{ /* block id: 31 */
int32_t *l_57[1];
int i;
for (i = 0; i < 1; i++)
l_57[i] = &g_21;
l_58 |= 0x93B57206L;
l_57[0] = (*g_35);
}
else
{ /* block id: 34 */
uint32_t *l_63 = (void*)0;
uint16_t l_71 = 65530UL;
int16_t *l_72 = &g_73;
uint32_t l_74[4] = {18446744073709551614UL,18446744073709551614UL,18446744073709551614UL,18446744073709551614UL};
int32_t l_75 = 0x4BFA3C5BL;
int32_t *l_76 = (void*)0;
int32_t *l_77[7][5] = {{&l_75,&g_21,&l_58,&g_24,&l_58},{&l_75,(void*)0,&g_24,&g_21,&g_21},{&g_21,&g_21,&g_24,(void*)0,(void*)0},{&l_75,&l_58,&l_75,&g_24,&g_21},{&l_75,&l_58,&l_58,&g_21,(void*)0},{&g_24,&g_21,(void*)0,&g_24,&l_75},{&l_75,(void*)0,&l_58,(void*)0,&l_75}};
int i, j;
l_75 &= ((((int32_t)(((*l_72) = (~((-(int32_t)((++p_38) <= (((-(uint16_t)((((int32_t)((uint32_t)(((p_42 ^ 4L) >= p_42) < p_41) + (uint32_t)l_71) - (int32_t)p_41) & p_39) != g_28[0][1])) , l_71) || 3UL))) | l_71))) && p_42) - (int32_t)p_41) >= l_74[1]) >= 0x0C68L);
g_80++;
}
return l_83;
}
/* ------------------------------------------ */
/*
* reads : g_35 g_36 g_12 g_28
* writes: g_36 g_12 g_24
*/
static int32_t *** func_44(uint8_t p_45, int32_t p_46)
{ /* block id: 12 */
uint32_t l_49 = 0x0DA8F9E1L;
int32_t ***l_54 = &g_35;
for (p_45 = 0; (p_45 <= 2); p_45 += 1)
{ /* block id: 15 */
int16_t l_48[8] = {0xE73EL,0xE73EL,0xE73EL,0xE73EL,0xE73EL,0xE73EL,0xE73EL,0xE73EL};
int i;
(*g_35) = (*g_35);
for (g_12 = 0; (g_12 <= 2); g_12 += 1)
{ /* block id: 19 */
int32_t *l_47[3][3] = {{&g_24,&g_24,&g_24},{&g_24,&g_24,&g_24},{&g_24,&g_24,&g_24}};
int i, j;
l_49--;
g_24 = ((uint32_t)g_28[p_45][p_45] - (uint32_t)0x5D0BC5DEL);
}
for (g_12 = 0; (g_12 <= 2); g_12 += 1)
{ /* block id: 25 */
int i, j;
if (g_28[p_45][g_12])
break;
}
}
return l_54;
}
/* ---------------------------------------- */
int main (int argc, char* argv[])
{
int i, j;
int print_hash_value = 0;
if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
platform_main_begin();
crc32_gentab();
func_1();
transparent_crc(g_12, "g_12", print_hash_value);
transparent_crc(g_21, "g_21", print_hash_value);
transparent_crc(g_24, "g_24", print_hash_value);
transparent_crc(g_27, "g_27", print_hash_value);
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
transparent_crc(g_28[i][j], "g_28[i][j]", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);
}
}
transparent_crc(g_73, "g_73", print_hash_value);
for (i = 0; i < 1; i++)
{
transparent_crc(g_78[i], "g_78[i]", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
transparent_crc(g_80, "g_80", print_hash_value);
for (i = 0; i < 1; i++)
{
transparent_crc(g_85[i], "g_85[i]", print_hash_value);
if (print_hash_value) printf("index = [%d]\n", i);
}
platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return 0;
}
/************************ statistics *************************
XXX max struct depth: 0
breakdown:
depth: 0, occurrence: 28
XXX total union variables: 0
XXX max expression depth: 18
breakdown:
depth: 1, occurrence: 29
depth: 2, occurrence: 8
depth: 3, occurrence: 1
depth: 4, occurrence: 2
depth: 5, occurrence: 1
depth: 9, occurrence: 1
depth: 12, occurrence: 1
depth: 18, occurrence: 1
XXX total number of pointers: 22
XXX times a variable address is taken: 39
XXX times a pointer is dereferenced on RHS: 3
breakdown:
depth: 1, occurrence: 3
XXX times a pointer is dereferenced on LHS: 8
breakdown:
depth: 1, occurrence: 7
depth: 2, occurrence: 1
XXX times a pointer is compared with null: 0
XXX times a pointer is compared with address of another variable: 0
XXX times a pointer is compared with another pointer: 0
XXX times a pointer is qualified to be dereferenced: 186
XXX max dereference level: 4
breakdown:
level: 0, occurrence: 0
level: 1, occurrence: 10
level: 2, occurrence: 6
level: 3, occurrence: 5
level: 4, occurrence: 4
XXX number of pointers point to pointers: 7
XXX number of pointers point to scalars: 15
XXX number of pointers point to structs: 0
XXX percent of pointers has null in alias set: 36.4
XXX average alias set size: 1.64
XXX times a non-volatile is read: 56
XXX times a non-volatile is write: 36
XXX times a volatile is read: 1
XXX times read thru a pointer: 0
XXX times a volatile is write: 0
XXX times written thru a pointer: 0
XXX times a volatile is available for access: 31
XXX percentage of non-volatile access: 98.9
XXX forward jumps: 0
XXX backward jumps: 0
XXX stmts: 30
XXX max block depth: 2
breakdown:
depth: 0, occurrence: 9
depth: 1, occurrence: 11
depth: 2, occurrence: 10
XXX percentage a fresh-made variable is used: 29.8
XXX percentage an existing variable is used: 70.2
********************* end of statistics **********************/
|
42f67afa7df9df89b31aa1dc223b3a743723f6b0
|
f23c8b9abd7cf2531b1f938b6dceb78288ab4037
|
/forSubmit/s5-1.c
|
9667c5a77beef7a819d3d2306389c099142c09ea
|
[] |
no_license
|
yuanding717/PKU-Coursera-CPP-Programming
|
8ee3272b0676846f3ea9fe73a41a79407d1216d5
|
4daa59a232c38d6e36737d3457c2edcbf0e4b056
|
refs/heads/master
| 2022-03-19T12:32:57.343117 | 2019-11-11T03:01:37 | 2019-11-11T03:01:37 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 355 |
c
|
s5-1.c
|
#include <string>
class MyString: public string{
public:
MyString(const string &str) : string(str) {};
MyString(const char *str) : string(str){};
MyString(MyString &myStr) : string(myStr){};
MyString() : string(){};
MyString operator()(int s, int n)
{
return this->substr(s, n);
}
};
|
639fad32c5e48f0aa4cbf60940960b441ba110d7
|
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
|
/source/fastsocket/kernel/net/mac80211/extr_scan.c_ieee80211_request_sched_scan_stop.c
|
2a9679f40e7ce28d9a950c1b0d10e2cfccf34d0a
|
[] |
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 | 1,323 |
c
|
extr_scan.c_ieee80211_request_sched_scan_stop.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 */
typedef struct TYPE_2__ TYPE_1__ ;
/* Type definitions */
struct ieee80211_sub_if_data {struct ieee80211_local* local; } ;
struct ieee80211_local {int /*<<< orphan*/ mtx; int /*<<< orphan*/ sched_scan_sdata; TYPE_1__* ops; } ;
struct TYPE_2__ {int /*<<< orphan*/ sched_scan_stop; } ;
/* Variables and functions */
int ENOTSUPP ;
int /*<<< orphan*/ drv_sched_scan_stop (struct ieee80211_local*,struct ieee80211_sub_if_data*) ;
int /*<<< orphan*/ mutex_lock (int /*<<< orphan*/ *) ;
int /*<<< orphan*/ mutex_unlock (int /*<<< orphan*/ *) ;
scalar_t__ rcu_access_pointer (int /*<<< orphan*/ ) ;
int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
int ret = 0;
mutex_lock(&local->mtx);
if (!local->ops->sched_scan_stop) {
ret = -ENOTSUPP;
goto out;
}
if (rcu_access_pointer(local->sched_scan_sdata))
drv_sched_scan_stop(local, sdata);
out:
mutex_unlock(&local->mtx);
return ret;
}
|
4c8ed45c89c60e08b4b90422ac8f5c074b963b0c
|
30b7806f8f48c892894d99634152131eaf21b910
|
/C_Projects/lem-in/libft/ft_memcpy.c
|
45e660b342f4261502cb846adee2f04f59cf508b
|
[] |
no_license
|
artiom-gesp/42_projects
|
2188b4fc48aaa1b2be7e5ebcfd9e4ea611d1fae7
|
32dd441c211c8e86fde2769ce15ed259f761353c
|
refs/heads/master
| 2022-12-11T10:40:04.042851 | 2021-10-31T11:04:31 | 2021-10-31T11:04:31 | 156,675,129 | 1 | 0 | null | 2022-12-08T06:01:45 | 2018-11-08T08:34:13 |
Jupyter Notebook
|
UTF-8
|
C
| false | false | 1,143 |
c
|
ft_memcpy.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kecosmon <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/22 15:26:19 by kecosmon #+# #+# */
/* Updated: 2019/02/22 15:26:21 by kecosmon ### ########.fr */
/* */
/* ************************************************************************** */
#include <string.h>
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t i;
char *strdst;
const char *strsrc;
i = 0;
strdst = (char *)dst;
strsrc = (char *)src;
while (i < n)
{
strdst[i] = strsrc[i];
i++;
}
return (dst);
}
|
7c3107ace7aa72afaeab401cf41ad3a12bd841a6
|
04d0a997364ad1bab775fb920edfe5b60cf6d740
|
/src/init.c
|
dabcd30966304d7e1aefe331996633ce598db7c3
|
[] |
no_license
|
mainwaringb/DescTools
|
a2dd23ca1f727e8bbfc0e069ba46f44567e4be24
|
004f80118d463c3cb8fc2c6b3e934534049e8619
|
refs/heads/master
| 2020-12-22T15:12:41.335523 | 2020-03-21T17:30:52 | 2020-03-21T17:30:52 | 236,836,652 | 0 | 0 | null | 2020-01-28T20:40:03 | 2020-01-28T20:40:02 | null |
UTF-8
|
C
| false | false | 5,841 |
c
|
init.c
|
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <R_ext/Rdynload.h>
/*
The following symbols/expressions for .NAME have been omitted
_DescTools_compute_GCD
_DescTools_compute_LCM
_DescTools_n_pow_sum
_DescTools_conv_DecToBin
_DescTools_top_n
_DescTools_bottom_n
_DescTools_top_i
_DescTools_bottom_i
Most likely possible values need to be added below.
*/
/* FIXME:
Check these declarations against the C/Fortran source code.
*/
/* .C calls */
extern void ADprobApproxInf(void *, void *, void *);
extern void ADprobExactInf(void *, void *, void *);
extern void ADprobN(void *, void *, void *, void *);
extern void ADtestR(void *, void *, void *, void *);
extern void Barnard(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
extern void roman2int(void *, void *, void *);
extern void ScoreS(void *, void *, void *, void *, void *, void *, void *, void *);
extern void WaldS(void *, void *, void *, void *, void *, void *, void *, void *);
extern void wgt_himed(void *, void *, void *, void *);
extern void wgt_himed_i(void *, void *, void *, void *);
/* .Call calls */
extern SEXP _DescTools_divs(SEXP);
extern SEXP _DescTools_bottom_i(SEXP, SEXP);
extern SEXP _DescTools_bottom_n(SEXP, SEXP);
extern SEXP _DescTools_compute_GCD(SEXP, SEXP);
extern SEXP _DescTools_compute_LCM(SEXP, SEXP);
extern SEXP _DescTools_conv_DecToBin(SEXP);
extern SEXP _DescTools_n_pow_sum(SEXP);
extern SEXP _DescTools_top_i(SEXP, SEXP);
extern SEXP _DescTools_top_n(SEXP, SEXP);
extern SEXP between_num_(SEXP, SEXP, SEXP);
extern SEXP between_num_l(SEXP, SEXP, SEXP);
extern SEXP between_num_lm(SEXP, SEXP, SEXP);
extern SEXP between_num_lr(SEXP, SEXP, SEXP);
extern SEXP between_num_lrm(SEXP, SEXP, SEXP);
extern SEXP between_num_m(SEXP, SEXP, SEXP);
extern SEXP between_num_r(SEXP, SEXP, SEXP);
extern SEXP between_num_rm(SEXP, SEXP, SEXP);
extern SEXP conc(SEXP, SEXP, SEXP, SEXP);
extern SEXP pip(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP isnil(SEXP);
extern SEXP rkurt(SEXP, SEXP);
extern SEXP rskew(SEXP, SEXP);
extern SEXP tbrm(SEXP, SEXP);
extern SEXP _DescTools_dgompertz_work(SEXP, SEXP, SEXP, SEXP);
extern SEXP _DescTools_pgompertz_work(SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP _DescTools_check_gompertz(SEXP, SEXP);
extern SEXP _DescTools_fastMode(SEXP, SEXP);
extern SEXP _DescTools_fastModeX(SEXP, SEXP);
extern SEXP pKolmogorov2x(SEXP, SEXP);
/* .Fortran calls */
extern void F77_NAME(hoeffd)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *);
extern void F77_NAME(jtpdf)(void *, void *, void *, void *, void *, void *);
extern void F77_NAME(pan)(void *, void *, void *, void *, void *);
static const R_CMethodDef CEntries[] = {
{"ADprobApproxInf", (DL_FUNC) &ADprobApproxInf, 3},
{"ADprobExactInf", (DL_FUNC) &ADprobExactInf, 3},
{"ADprobN", (DL_FUNC) &ADprobN, 4},
{"ADtestR", (DL_FUNC) &ADtestR, 4},
{"Barnard", (DL_FUNC) &Barnard, 10},
{"roman2int", (DL_FUNC) &roman2int, 3},
{"ScoreS", (DL_FUNC) &ScoreS, 8},
{"WaldS", (DL_FUNC) &WaldS, 8},
{"wgt_himed", (DL_FUNC) &wgt_himed, 4},
{"wgt_himed_i", (DL_FUNC) &wgt_himed_i, 4},
{NULL, NULL, 0}
};
static const R_CallMethodDef CallEntries[] = {
{"_DescTools_divs", (DL_FUNC) &_DescTools_divs, 1},
{"_DescTools_bottom_i", (DL_FUNC) &_DescTools_bottom_i, 2},
{"_DescTools_bottom_n", (DL_FUNC) &_DescTools_bottom_n, 2},
{"_DescTools_compute_GCD", (DL_FUNC) &_DescTools_compute_GCD, 2},
{"_DescTools_compute_LCM", (DL_FUNC) &_DescTools_compute_LCM, 2},
{"_DescTools_conv_DecToBin", (DL_FUNC) &_DescTools_conv_DecToBin, 1},
{"_DescTools_n_pow_sum", (DL_FUNC) &_DescTools_n_pow_sum, 1},
{"_DescTools_top_i", (DL_FUNC) &_DescTools_top_i, 2},
{"_DescTools_top_n", (DL_FUNC) &_DescTools_top_n, 2},
{"_DescTools_pgompertz_work", (DL_FUNC) &_DescTools_pgompertz_work, 5},
{"_DescTools_dgompertz_work", (DL_FUNC) &_DescTools_dgompertz_work, 4},
{"_DescTools_check_gompertz", (DL_FUNC) &_DescTools_check_gompertz, 2},
{"_DescTools_fastMode", (DL_FUNC) &_DescTools_fastMode, 2},
{"_DescTools_fastModeX", (DL_FUNC) &_DescTools_fastModeX, 2},
{"between_num_", (DL_FUNC) &between_num_, 3},
{"between_num_l", (DL_FUNC) &between_num_l, 3},
{"between_num_lm", (DL_FUNC) &between_num_lm, 3},
{"between_num_lr", (DL_FUNC) &between_num_lr, 3},
{"between_num_lrm", (DL_FUNC) &between_num_lrm, 3},
{"between_num_m", (DL_FUNC) &between_num_m, 3},
{"between_num_r", (DL_FUNC) &between_num_r, 3},
{"between_num_rm", (DL_FUNC) &between_num_rm, 3},
{"conc", (DL_FUNC) &conc, 4},
{"pip", (DL_FUNC) &pip, 6},
{"isnil", (DL_FUNC) &isnil, 1},
{"rkurt", (DL_FUNC) &rkurt, 2},
{"rskew", (DL_FUNC) &rskew, 2},
{"tbrm", (DL_FUNC) &tbrm, 2},
{"pKolmogorov2x", (DL_FUNC) &pKolmogorov2x, 2},
{NULL, NULL, 0}
};
static const R_FortranMethodDef FortranEntries[] = {
{"hoeffd", (DL_FUNC) &F77_NAME(hoeffd), 12},
{"jtpdf", (DL_FUNC) &F77_NAME(jtpdf), 6},
{"pan", (DL_FUNC) &F77_NAME(pan), 5},
{NULL, NULL, 0}
};
void R_init_DescTools(DllInfo *dll)
{
R_registerRoutines(dll, CEntries, CallEntries, FortranEntries, NULL);
R_useDynamicSymbols(dll, FALSE);
}
|
a9b0dca65925ebba6043395a5e52267a0ef2c14a
|
2bb9ed50f077d41650c42964e7232eb86cc6f579
|
/listaPonteirosQuestao13.c
|
a13606976d6298eec5ef3d243445f4332b644862
|
[] |
no_license
|
diego2017003/ListaDePonteiros
|
009010317a5f40f3f6caec28b2d3d1aa3b1e2b15
|
ccda3167f3317d1db2d0519d1e9b6ebf47d8f3e7
|
refs/heads/master
| 2020-05-06T20:04:18.971640 | 2019-04-08T22:49:55 | 2019-04-08T22:49:55 | 180,220,138 | 0 | 0 | null | null | null | null |
ISO-8859-1
|
C
| false | false | 228 |
c
|
listaPonteirosQuestao13.c
|
#include<stdio.h>
int soma(int a,int b){
return (a+b);
}
int main(){
int (*p)(),s,a=2,b=4;//(*p)() é um ponteiro para uma função
p=soma;//atribui ao ponteiro p a função soma
s=p(a,b);
printf("%d",s);
return 0;
}
|
0c9ad07694287b121fa9e0040d87e44763b6da22
|
9bd5911dc84584e28ed133a0e9c338300ec7f7e2
|
/libgloss/socketselect.c
|
20b4e5c371239b2efad088b32a5cea6ca2f60da0
|
[] |
no_license
|
Sakura-IT/Newlib_WarpOS
|
b82dfd5dddcaf0898c0946ee2bfad7ed9b55dfbe
|
0c95b85f217246c4276d3284d216fe8743c220c3
|
refs/heads/master
| 2021-12-09T12:47:20.090375 | 2021-11-19T20:53:33 | 2021-11-19T20:53:33 | 156,069,576 | 3 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 509 |
c
|
socketselect.c
|
/*
* POSIX Compatibility Library for AmigaOS
*
* Written by Frank Wille <[email protected]> in 2005
*
* $Id$
*
* Adapted for NewLib3 by Dennis van der Boon in 2018
*/
#include "bsdsocket.h"
int __socket_select(int nfds,fd_set *rd,fd_set *wr,fd_set *ex,
struct timeval *timeout,unsigned long *sigmask)
{
int r;
if (__init_bsdsocket(-1) >= 0)
{
r = WaitSelect(nfds,rd,wr,ex,timeout,sigmask);
if (r == -1)
errno = Errno();
return r;
}
return 5;
}
|
1dec99ee06ce3dcd7ca4f6c317804ee318025f1e
|
3d3f18d989c2ac351719bbd167c80a757aeb1990
|
/jni/yuv2rgb.h
|
da76232b78ad6862e814c33e2cc1e228447e5a66
|
[] |
no_license
|
eriklupander/RsCamera
|
205f2bcb51b957f6b0e49c3ef13a7632974002db
|
cb3d059775a65411278398acfb104a8f4f7dac9c
|
refs/heads/master
| 2021-01-01T19:02:01.165523 | 2012-06-06T08:37:41 | 2012-06-06T08:37:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 164 |
h
|
yuv2rgb.h
|
static inline void color_convert_common(unsigned char *pY, unsigned char *pUV, int width, int height,
unsigned char *buffer, int size, int gray, int rotate);
|
d0e8378e38c414f9638bf17d08f3c2bdaf9a705d
|
755fe7650a3cf4ab4ca498e34d11b6cd8f19cbd4
|
/code/BLC/main.c
|
ab121733a0458b4dc5ddf58a5b98386661255ff0
|
[] |
no_license
|
CEE5/HORNET
|
ca929bab669e22390cfe25ecb13c932e4a047c90
|
6a85023bc177adc9d2e99785e232d1f69018c92e
|
refs/heads/master
| 2016-09-06T09:29:23.811847 | 2012-12-20T10:28:48 | 2012-12-20T10:28:48 | 3,011,532 | 2 | 2 | null | null | null | null |
UTF-8
|
C
| false | false | 3,646 |
c
|
main.c
|
/*
*/
#include <avr/io.h>
#include <util/delay.h>
#include <inttypes.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include <stdint.h>
#define H1 PD1
#define L1 PD5
#define H2 PC3
#define L2 PD4
#define H3 PD7
#define L3 PD3
#define LED1 PB0
#define LED2 PB1
uint8_t aktPos;
void setLED(uint8_t i);
void error();
void setMotor(uint8_t i);
void initPorts();
void error()
{
PORTD &= ~((1<<H1)|(1<<L1)|(1<<L2)|(1<<H3)|(1<<L3));
PORTC &= ~(1<<H2);
DDRD &= ~((1<<H1)|(1<<L1)|(1<<L2)|(1<<H3)|(1<<L3));
DDRC &= ~((1<<H2));
while (1)
{
uint8_t i;
for(i=0; i<4; i++)
{
setLED(i);
_delay_ms(10);
}
}
}
void setLED(uint8_t i)
{
switch(i)
{
case 0:
PORTB &= ~((1<<LED1)|(1<<LED2));
break;
case 1:
PORTB &= ~(1<<LED1);
PORTB |= (1<<LED2);
break;
case 2:
PORTB &= ~(1<<LED2);
PORTB |= (1<<LED1);
break;
case 3:
PORTB |= ((1<<LED2)|(1<<LED1));
break;
default:
error();
}
}
void setMotor(uint8_t i)
{
PORTD &= ~((1<<H1)|(1<<L1)|(1<<L2)|(1<<H3)|(1<<L3));
PORTC &= ~(1<<H2);
switch(i)
{
case 0:
PORTD |=((1<<H1)|(1<<L2));
break;
case 1:
PORTD |=((1<<L1)|(1<<H3));
break;
case 2:
PORTC |=(1<<H2);
PORTD |=(1<<L3);
break;
}
}
/**
Einstellung des Vergleichspins für AC
*/
void setMUX(int mux)
{
//AC Interrupt aus, damit kein falsches Interrupt ausgelöst wird
ACSR &= ~(1<<ACIE);
switch(mux)
{
/**
PHASE2
ADC1 */
case 1:
ADMUX &= ~(1<<MUX2);
ADMUX &= ~(1<<MUX1);
ADMUX |= (1<<MUX0);
//AC Interrupt ein
ACSR |= (1<<ACIE);
break;
/**
PHASE3
ADC0 */
case 0:
ADMUX &= ~(1<<MUX2);
ADMUX &= ~(1<<MUX1);
ADMUX &= ~(1<<MUX0);
//AC Interrupt ein
ACSR |= (1<<ACIE);
break;
/**
PHASE1
ADC2 */
case 2:
ADMUX &= ~(1<<MUX2);
ADMUX |= (1<<MUX1);
ADMUX &= ~(1<<MUX0);
//AC Interrupt ein
ACSR |= (1<<ACIE);
break;
}
}
/**
Initialisierung Analog Comparator
*/
void init_ANALOG_COMPARATOR()
{
//init_AC
ACSR &= ~(1<<ACD); //AnalogComparator ein
ACSR |= (1<<ACIE); //Interrupt enable ein
/**Flanke einstellen */
/**steigende Flanke*/
// ACSR |= (1<<ACIS1);
// ACSR |= (1<<ACIS0);
/**fallende Flanke*/
ACSR |= (1<<ACIS1);
ACSR &= ~(1<<ACIS0);
/** Toggle*/
// ACSR &= ~(1<<ACIS1);
// ACSR &= ~(1<<ACIS0);
SFIOR |= (1<<ACME); //Multiplexer für Analogkomparator ein
ADCSRA &= ~(1<<ADEN);
}
/**
Analog Comparator
Erkennung des Nulldurchgangs
*/
ISR(ANA_COMP_vect)
{
if(aktPos>1)
{
aktPos=0;
}
else
{
aktPos++;
}
setMUX(aktPos);
}
void initPorts()
{
//Motor
DDRD |= ((1<<H1)|(1<<L1)|(1<<L2)|(1<<H3)|(1<<L3));
DDRC |= ((1<<H2));
//LEDs
DDRB |=((1<<LED1)|(1<<LED2));
}
int main(void)
{
initPorts();
// setLED(1);while(1);
init_ANALOG_COMPARATOR();
aktPos = 0;
setMUX(0);
setMotor(0);
setLED(1);
_delay_ms(200);
setLED(0);
_delay_ms(200);
setLED(1);
_delay_ms(200);
setLED(0);
_delay_ms(200);
setLED(2);
_delay_ms(200);
setLED(0);
sei();
while(1)
{
setMotor(aktPos);
_delay_us(5);
setMotor(3);
_delay_us(20);
}
return 0;
}
|
5063aa28e42328eeba5da1a21f28e272852b2df5
|
b8f3aee093b4e62fabf67e888c1e4463d2530e3b
|
/a1q6.c
|
f1ccd6547588fcbac10943a3e5ed3c5d697f3fe8
|
[] |
no_license
|
CODERGARV/ASSIGNMENT1
|
5e6514e731f6b3fb931e695a4be74622097e6dae
|
b4cffd74b66256ba0e56c6b8aedd64c1edcf62f9
|
refs/heads/master
| 2020-07-29T22:05:29.344094 | 2019-09-22T09:18:45 | 2019-09-22T09:18:45 | 209,979,410 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 196 |
c
|
a1q6.c
|
#include<stdio.h>
int main()
{
long int x;
printf("print the last second digit of your number\nenter a number= ");
scanf("%ld",&x);
printf("\nlast 2nd digit= %ld\n",(x%100)/10);
}
|
554bf070e8bd2bbf090fe500099e5bc1a726be93
|
fa6220c83930719cfb26aa26c6c8b82401f89865
|
/src/practice/sin_meikai_CLang/p-122.c
|
e6a364e4ce78cc8d0bcabe9611986204f41a9216
|
[] |
no_license
|
ikasoumen4/ScientificCalculator
|
f6e7816f13d8b00f4a0337e20c7db498c0bc56b0
|
8147d232f2efa4494b877814f5dcfb8477ba9174
|
refs/heads/master
| 2021-01-21T11:39:29.848377 | 2016-06-03T02:40:35 | 2016-06-03T02:40:35 | 55,385,573 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 265 |
c
|
p-122.c
|
#include<stdio.h>
#include<string.h>
int main(void){
int i;
char s[10] = "ABCDEFGHI";
printf("%s\n","ABCDEF");
printf("%d\n",sizeof("ABCDEF"));
memset(s,'\0',sizeof(s) - 3);
for(i = 0; i < sizeof(s); i++)
printf("s[%d] = [%d]\n",i,s[i]);
return 0;
}
|
557aea88e65e0d8095ec217e4d7b4936c07a8844
|
5f2e2ebed566ecc67840d850da8f1105bc03a7ec
|
/enumChoose.h
|
0718bb9343b10837edb7677990a03eeecb1eb2ec
|
[
"Apache-2.0"
] |
permissive
|
oneflyingfish/Change-To-Icon
|
c8e902435d7a77dc619956edae3cf9fee9b2ea28
|
78dc7877719d60c7661f60cf65b09dd3afeed517
|
refs/heads/master
| 2021-09-22T03:25:57.912927 | 2021-09-20T16:55:51 | 2021-09-20T16:55:51 | 178,542,310 | 7 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 158 |
h
|
enumChoose.h
|
#ifndef ENUMCHOOSE_H
#define ENUMCHOOSE_H
enum AutoCut
{
yes,
no
};
enum SavePath
{
pivturePath,
desktop
};
enum NewFold
{
hasFold,
noFold
};
#endif
|
449c88b880766823f3cd1054e534e049a4509182
|
17095dc17ccfcdcbacf083c0f1d7583c6282c07d
|
/typechk.c
|
c2b85248822b2999e6f3bbf602fc092ec4327f35
|
[
"LicenseRef-scancode-public-domain",
"CC0-1.0"
] |
permissive
|
RyanMallon/hcc
|
3458f26ac86caf33b63e485e614d5a5596015b0c
|
22335d27532c868f2d6f18ed1023f5c28bb29498
|
refs/heads/master
| 2021-01-13T07:04:53.092733 | 2017-02-13T10:49:24 | 2017-02-13T10:49:24 | 81,814,667 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 36,988 |
c
|
typechk.c
|
/*
* Type Checker
*
* Ryan Mallon (2005)
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ast.h"
#include "icg.h"
#include "ast.h"
#include "symtable.h"
#include "typechk.h"
#include "utype.h"
#include "debug.h"
#include "cerror.h"
#include "cflags.h"
extern scope_node_t *global_scope, *current_scope;
static type_check_t *type_check_add(ast_node_t *);
static type_check_t *type_check_dereference(ast_node_t *);
static type_check_t *type_check_array(ast_node_t *);
static type_check_t *type_check_cast(ast_node_t *);
static type_check_t *type_check_assign_address(ast_node_t *);
static type_check_t *type_check_return(ast_node_t *);
static void munge_history(ast_node_t **);
/* Cflags */
extern compiler_options_t cflags;
/* Current struct name */
static name_record_t *current_struct = NULL;
/*
* Type check an addition node
*/
type_check_t *type_check_add(ast_node_t *node) {
type_check_t *e1, *e2, *check;
debug_printf(1, "Typechecking add\n");
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
e1 = type_check_node(node->node.children[0]);
e2 = type_check_node(node->node.children[1]);
/* Left hand side is a pointer or array type */
if(is_array_type(e1->type_info) || is_address_type(e1->type_info)) {
if(is_array_type(e2->type_info) ||
is_address_type(e2->type_info) ||
e2->type_info->length != 1 ||
e2->type_info->signature[0] != TYPE_INTEGER)
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid operands to binary +\n");
else {
copy_sig(e1->type_info, check->type_info);
if(is_array_type(e1->type_info)) {
remove_type_from_sig(&(check->type_info), TYPE_ARRAY);
add_to_type_sig(&(check->type_info), TYPE_ADDRESS);
}
check->type_info->decl_type = TYPE_LVALUE;
check->passed = 1;
return check;
}
}
/* Right hand side is a pointer */
if(is_array_type(e2->type_info) || is_address_type(e2->type_info)) {
if(is_array_type(e1->type_info) ||
is_address_type(e1->type_info) ||
e1->type_info->length != 1 ||
e1->type_info->signature[0] != TYPE_INTEGER)
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid operands to binary +\n");
else {
copy_sig(e2->type_info, check->type_info);
if(is_array_type(e2->type_info)) {
remove_type_from_sig(&(check->type_info), TYPE_ARRAY);
add_to_type_sig(&(check->type_info), TYPE_ADDRESS);
}
check->type_info->decl_type = TYPE_LVALUE;
check->passed = 1;
return check;
}
}
check->type_info = result_type(e1->type_info, e2->type_info, NODE_ADD);
check->passed = 1;
return check;
}
/*
* Type check an assignment
*
* The left hand side of the assignment must be a valid lvalue
*
*/
static type_check_t *type_check_assign(ast_node_t *node) {
type_check_t *lhs, *rhs, *check;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
lhs = type_check_node(node->node.children[0]);
rhs = type_check_node(node->node.children[1]);
debug_printf(1, "Type check assign: lhs: ");
print_type_signature(lhs->type_info);
#if 0
if(lhs->type_info->decl_type != TYPE_LVALUE)
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid lvalue in assignment\n");
#endif
check->type_info = result_type(lhs->type_info, rhs->type_info, NODE_BECOMES);
check->passed = 1;
return check;
}
/*
* Type check a dereference
*/
static type_check_t *type_check_dereference(ast_node_t *node) {
type_check_t *expr, *check;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
/* Type check the child and copy its signature */
expr = type_check_node(node->node.children[0]);
copy_sig(expr->type_info, check->type_info);
debug_printf(1, "Type checking dereference for: ");
print_type_signature(expr->type_info);
if(is_address_type(expr->type_info) || is_array_type(expr->type_info)) {
check->type_info = remove_type_from_sig(&(check->type_info), TYPE_ADDRESS);
check->type_info->indirect_levels++;
} else
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid operand to unary *\n");
check->passed = 1;
return check;
}
/*
* Type check the assign address operation
*/
static type_check_t *type_check_assign_address(ast_node_t *node) {
type_check_t *expr, *check;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
expr = type_check_node(node->node.children[0]);
copy_sig(expr->type_info, check->type_info);
if(expr->type_info->decl_type != TYPE_LVALUE &&
expr->type_info->decl_type != TYPE_VARIABLE &&
expr->type_info->decl_type != TYPE_ARGUMENT &&
expr->type_info->decl_type != TYPE_USER)
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid lvalue in assignment (tcaa) \n");
add_to_type_sig(&(check->type_info), TYPE_ADDRESS);
check->type_info->decl_type = TYPE_LVALUE;
check->passed = 1;
return check;
}
/*
* Type check an address of operation
*/
static type_check_t *type_check_address_of(ast_node_t *node) {
type_check_t *expr;
expr = type_check_node(node->node.children[0]);
if(expr->type_info->decl_type == TYPE_CONSTANT ||
expr->type_info->decl_type == TYPE_RVALUE ||
expr->type_info->indirect_levels == -1) {
compiler_error(CERROR_ERROR, node->src_line_num,
"Invalid operand to unary &\n");
} else {
debug_printf(1, "Unary &: ");
print_type_signature(expr->type_info);
}
expr->type_info->indirect_levels--;
expr->type_info->decl_type = TYPE_LVALUE;
add_to_type_sig(&(expr->type_info), TYPE_ADDRESS);
return expr;
}
/*
* Type check an array
*/
static type_check_t *type_check_array(ast_node_t *node) {
type_check_t *expr, *index, *check;
int i;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
expr = type_check_node(node->node.children[0]);
if(!is_array_type(expr->type_info) && !is_address_type(expr->type_info))
compiler_error(CERROR_ERROR, node->src_line_num,
"subscripted value is neither array nor pointer\n");
for(i = 1; i < node->node.num_children; i++) {
index = type_check_node(node->node.children[i]);
if(index->type_info->length != 1 ||
index->type_info->signature[0] != TYPE_INTEGER)
compiler_error(CERROR_ERROR, node->src_line_num,
"subscript is not an integer\n");
/* Set the type for the array node */
copy_sig(expr->type_info, check->type_info);
check->type_info = remove_type_from_sig(&(check->type_info), TYPE_ARRAY);
}
check->passed = 1;
return check;
}
/*
* Type check a member usage
*
* FIXME: This function is a freakin' mess. Having the global
* current_struct variable is a bit ugly.
*
*/
static type_check_t *type_check_member(ast_node_t *node) {
name_record_t *var, *member;
type_check_t *check = NULL;
/* Get the struct variable */
var = get_var_entry(get_name_from_node(node));
if(!var)
compiler_error(CERROR_ERROR, CERROR_UNKNOWN_LINE,
"Struct %s undeclared\n", get_name_from_node(node));
/* Type check the left hand side */
debug_printf(1, "LEFT\n");
type_check_node(node->node.children[0]);
/* Set the current struct */
if(!current_struct) {
current_struct = var;
debug_printf(1, "Setting current struct to %s\n", current_struct->name);
}
/* Type check the right hand side */
type_check_node(node->node.children[1]);
/* Get the member variable */
member = get_utype_member(current_struct,
get_name_from_node(node->node.children[1]));
if(!member)
compiler_error(CERROR_ERROR, CERROR_UNKNOWN_LINE,
"Struct %s has no member called %s\n",
current_struct->name,
get_name_from_node(node->node.children[1]));
/* Check if the member is also a struct */
if(is_struct_type(member->type_info)) {
char *name = get_name_from_node(node->node.children[1]);
current_struct = get_utype_member(var, name);
debug_printf(1, "Reset current struct to %s on RHS\n",
current_struct->name);
} else
current_struct = NULL;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
check->passed = 1;
check->type_info = copy_sig(member->type_info, check->type_info);
check->type_info->decl_type = TYPE_LVALUE;
return check;
}
/*
* Type check a cast.
*
* FIXME: This just assumes that all type casts are valid
*
*/
type_check_t *type_check_cast(ast_node_t *node) {
type_info_t *cast_type;
type_check_t *check;
ast_node_t *cast_node;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
/* Type check the uncast expression */
// original_type = type_check_node(node->node.children[1]);
cast_node = node->node.children[0]->node.children[0];
cast_type = create_type_signature(TYPE_LVALUE,
get_type(node->node.children[0]),
cast_node);
debug_printf(1, "Cast: New type = ");
print_type_signature(cast_type);
check->type_info = copy_sig(cast_type, check->type_info);
check->passed = 1;
return check;
}
/*
* Type check a return statement
*/
type_check_t *type_check_return(ast_node_t *node) {
type_check_t *check;
name_record_t *func;
if(node->node.num_children == 0) {
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
check->passed = 1;
check->type_info = create_type_signature(TYPE_RVALUE, TYPE_VOID, NULL);
return check;
}
/* Check for a return value from a void function */
func = get_func_entry(current_scope->name);
if(is_primitive(func->type_info) &&
primitive_type(func->type_info) == TYPE_VOID)
compiler_error(CERROR_ERROR, node->src_line_num,
"Attempt to return a value from void function %s\n",
func->name);
check = type_check_node(node->node.children[0]);
check->passed = 1;
return check;
}
type_check_t *type_check_node(ast_node_t *node) {
int i;
name_record_t *var;
type_check_t *check;
ast_node_t *name_node;
int entered_scope;
entered_scope = 0;
check = malloc(sizeof(type_check_t));
check->type_info = malloc(sizeof(type_info_t));
check->passed = 0;
switch(node->node_type) {
case NODE_LEAF_NUM:
check->passed = 1;
check->type_info->length = 1;
check->type_info->decl_type = TYPE_CONSTANT;
check->type_info->signature = malloc(sizeof(int));
check->type_info->signature[0] = TYPE_INTEGER;
debug_printf(1, "Type checked constant int, value = %d\n", node->leaf.val);
break;
case NODE_LEAF_ID:
if(current_struct) {
var = get_utype_member(current_struct, node->leaf.name);
if(!var)
compiler_error(CERROR_ERROR, node->src_line_num,
"User defined type %s has no member called %s\n",
current_struct->name, node->leaf.name);
} else {
var = get_var_entry(node->leaf.name);
if(!var)
compiler_error(CERROR_ERROR, node->src_line_num,
"Variable %s undeclared\n", node->leaf.name);
}
check->passed = 1;
check->type_info = type_sign_var(var, check->type_info);
/* Address types can be changed to lvalues immediately */
if(is_address_type(check->type_info))
check->type_info->decl_type = TYPE_LVALUE;
#if 0
if(check->type_info->decl_type == TYPE_USER) {
debug_printf(1, "Marking utype %s\n", node->leaf.name);
if(struct_name)
free(struct_name);
struct_name = malloc(strlen(node->leaf.name) + 1);
strcpy(struct_name, node->leaf.name);
}
#endif
/*
* History Variable Check
*
* If a variable has type history, its parent node in the AST is
* not a history node and it is on the right hand side of an assignment
* expression then the tree is altered to have a history zero node.
*/
if(is_history_type(check->type_info) &&
node->parent->node.op != NODE_HISTORY &&
node->parent->node.op != NODE_ADDRESS &&
(child_number(node, NODE_FUNC_CALL) != -1 ||
child_number(node, NODE_BECOMES) == 1)) {
munge_history(&node);
/* Redo the type checking from the new history node */
check = type_check_node(node->parent);
}
debug_printf(1, "Type checked variable %s, sig = ", node->leaf.name);
print_type_signature(check->type_info);
break;
case NODE_LEAF_CHAR:
check->passed = 1;
check->type_info->length = 1;
check->type_info->decl_type = TYPE_CONSTANT;
check->type_info->signature = malloc(sizeof(int));
check->type_info->signature[0] = TYPE_CHAR;
debug_printf(1, "Type checked constant char literal, value = '%c'\n",
(char)node->leaf.val);
break;
case NODE_LEAF_STRING:
check->passed = 1;
check->type_info->length = 1;
check->type_info->decl_type = TYPE_STRING_LITERAL;
check->type_info->signature = malloc(sizeof(int));
check->type_info->signature[0] = add_string_literal(node->leaf.name);
debug_printf(1, "Type checked constant string literal, value = \"%s\"\n",
node->leaf.name);
break;
case NODE_OPERATOR:
switch(node->node.op) {
case NODE_DECL:
check->passed = 1;
check->type_info->length = 1;
check->type_info->signature = malloc(sizeof(int));
check->type_info->signature[0] = TYPE_NONE;
return check;
case NODE_CAST:
check = type_check_cast(node);
break;
case NODE_FUNC:
name_node = get_name_node(node);
debug_printf(1, "Entering scope for function %s, prev = %p\n",
name_node->leaf.name, current_scope);
if(current_scope != global_scope)
compiler_error(CERROR_ERROR, node->src_line_num,
"AST is borken: Tried to enter a function body from"
" non-global scope\n");
/* TODO: This gets done lots. Turn it into a function? */
for(i = 0; i < current_scope->num_children; i++)
if(!strcmp(current_scope->children[i]->name, name_node->leaf.name))
current_scope = current_scope->children[i];
/* FIXME: This shouldn't be borken */
current_scope->prev = global_scope;
if(current_scope == global_scope)
compiler_error(CERROR_ERROR, node->src_line_num,
"Function %s undeclared\n", name_node->leaf.name);
for(i = 1; i < node->node.num_children; i++)
type_check_node(node->node.children[i]);
current_scope = global_scope;
break;
case NODE_BLOCK:
if(node->node.scope_tag != -1) {
current_scope = current_scope->children[node->node.scope_tag];
entered_scope = 1;
}
for(i = 0; i < node->node.num_children; i++)
type_check_node(node->node.children[i]);
if(entered_scope)
current_scope = current_scope->prev;
break;
case NODE_HISTORY:
check = type_check_node(node->node.children[0]);
remove_type_from_sig(&check->type_info, TYPE_HISTORY);
break;
case NODE_FUNC_CALL: {
char *func_name;
scope_node_t *func_scope;
type_info_t *arg_type, *expected_type;
/* Get the function info */
func_name = get_name_from_node(node);
func_scope = get_func_arg_scope(func_name);
/* Don't typecheck varidic functions */
if(get_func_entry(func_name) &&
get_func_entry(func_name)->num_args == FUNC_VAR_ARGS) {
debug_printf(1, "Typechecking varidic function %s\n", func_name);
for(i = 1; i < node->node.num_children; i++)
type_check_node(node->node.children[i]);
check = type_check_node(node->node.children[0]);
break;
}
for(i = 0; i < node->node.num_children; i++)
type_check_node(node->node.children[i]);
/* Check that the function arguments match its prototype */
for(i = 1; i < node->node.num_children; i++) {
arg_type = node->node.children[i]->type_check->type_info;
expected_type = func_scope->name_table[i - 1]->type_info;
/* Temp-copy method */
if(cflags.history_arg_setting == HISTORY_ARG_TEMP_COPY) {
if(is_history_type(arg_type) && is_address_type(expected_type)) {
remove_type_from_sig(&arg_type, TYPE_HISTORY);
debug_printf(1, "Converted by-ref history argument\n");
}
}
/*
* A variable of type: history->object can be auto-coerced into
* type object when passing to a function. This is not so straight
* forward if the type is pointer->history->object
*/
#if 0
if(is_history_type(arg_type) && !is_address_type(arg_type))
remove_type_from_sig(&arg_type, TYPE_HISTORY);
#endif
if(!compare_type_sigs(arg_type, expected_type)) {
debug_printf(1, "Expected type: ");
print_type_signature(expected_type);
debug_printf(1, "Found type: ");
print_type_signature(arg_type);
compiler_error(CERROR_ERROR, node->src_line_num,
"Function %s argument %d is wrong type\n",
func_name, i);
}
}
check = type_check_node(node->node.children[0]);
break;
}
case NODE_MEMBER:
check = type_check_member(node);
debug_printf(1, "NODE_MEMBER: ");
print_type_signature(check->type_info);
break;
case NODE_BECOMES:
check = type_check_assign(node);
break;
case NODE_ADD:
check = type_check_add(node);
break;
case NODE_POINTER:
check = type_check_dereference(node);
break;
case NODE_ADDRESS:
check = type_check_address_of(node);
break;
case NODE_ASSIGN_ADDRESS:
check = type_check_assign_address(node);
break;
case NODE_ARRAY:
check = type_check_array(node);
break;
case NODE_RETURN:
check = type_check_return(node);
break;
default:
/*
* Default operation: type check all the children and then assign
* the type of this node to the type of the first child
*/
for(i = 1; i < node->node.num_children; i++)
type_check_node(node->node.children[i]);
check = type_check_node(node->node.children[0]);
break;
}
break;
}
if(!check->passed) {
check->passed = 1;
check->type_info->length = 0;
check->type_info->decl_type = TYPE_NONE;
}
node->type_check = check;
return check;
}
/*
* Determine the resulting type, when the given operator
* is applied to the two given types
*
*/
type_info_t *result_type(type_info_t *t1, type_info_t *t2, int op) {
type_info_t *result;
result = malloc(sizeof(type_info_t));
if(t1->length == 1 && t2->length == 1) {
/*
* Both primitive types
* FIXME: Currently assuming both are integers
*/
if(is_string_type(t1) && is_string_type(t2)) {
/* Result of two strings/string literals is a string */
result->decl_type = TYPE_RVALUE;
result->length = 1;
result->signature = malloc(sizeof(int) * result->length);
result->signature[0] = TYPE_STRING;
return result;
}
result->decl_type = TYPE_RVALUE;
result->length = 1;
result->signature = malloc(sizeof(int) * result->length);
result->signature[0] = t1->signature[0];
return result;
}
if(op == NODE_BECOMES) {
/* FIXME: Assumes type is the same as lhs */
copy_sig(t1, result);
return result;
}
if(op == NODE_ADD || op == NODE_SUB) {
/* Can only have one 'address of' in an add or subtract */
if(t1->signature[0] == TYPE_ADDRESS && t2->signature[0] == TYPE_ADDRESS) {
fprintf(stderr, "Invalid operands to binary addop\n");
exit(EXIT_FAILURE);
}
if(t1->signature[0] == TYPE_ADDRESS) {
/* Cast the operation to the left hands type */
result = copy_sig(t1, result);
result->decl_type = TYPE_RVALUE;
return result;
}
if(t2->signature[0] == TYPE_ADDRESS) {
/* Cast the operation to the right hands type */
result = copy_sig(t2, result);
result->decl_type = TYPE_RVALUE;
return result;
}
}
if(op == NODE_MUL || op == NODE_DIV) {
/* Cannot use mulops with pointers */
if(t1->signature[0] == TYPE_ADDRESS || is_array_type(t1) ||
t2->signature[0] == TYPE_ADDRESS || is_array_type(t2)) {
fprintf(stderr, "Invalid operands to binary mulop\n");
exit(EXIT_FAILURE);
}
/* FIXME: Just assume both types are same and return left hands type */
result = copy_sig(t1, result);
result->decl_type = TYPE_RVALUE;
return result;
}
/* FIXME: Just assume both types are same and return left hands type */
result = copy_sig(t1, result);
result->decl_type = TYPE_RVALUE;
return result;
}
static void munge_history(ast_node_t **node) {
int i;
ast_node_t *history_node, *depth_node;
history_node = mk_node(NODE_HISTORY, (*node)->src_line_num);
depth_node = mk_num_leaf(0, (*node)->src_line_num);
/* Type info for the depth node */
depth_node->type_check = malloc(sizeof(type_check_t));
depth_node->type_check->passed = 1;
depth_node->type_check->type_info =
create_type_signature(TYPE_CONSTANT, TYPE_INTEGER, NULL);
/* Find the parent of the current node */
for(i = 0; i < (*node)->parent->node.num_children; i++)
if((*node)->parent->node.children[i] == *node) {
(*node)->parent->node.children[i] = history_node;
history_node->parent = (*node)->parent;
break;
}
append_child(history_node, *node);
append_child(history_node, depth_node);
}
/*
* Return the corresponding type qualifier for the given node type
*/
int get_type(ast_node_t *current) {
int type = -1;
switch(current->node.op) {
case NODE_VOID:
type = TYPE_VOID;
break;
case NODE_INT:
type = TYPE_INTEGER;
break;
case NODE_CHAR:
type = TYPE_CHAR;
break;
case NODE_STRING:
type = TYPE_STRING;
break;
case NODE_STRUCT:
type = utype_def_index(current->node.children[0]->leaf.name);
if(type != -1) {
type <<= TYPE_SHIFT;
type |= TYPE_UTYPE;
}
break;
}
return type;
}
/*
* Compare two type signatures
*
* Messy: TYPE_POINTER and TYPE_ADDRESS are regarded as being the same thing.
* This allows the signature of a variable usage to properly be compared
* against a variable definition signature.
*
* TODO: Because the two types are basically just different ways of saying the
* same thing, it would probably be better to rewrite it a single type. Perhaps
* just TYPE_INDIRECT?
*
*/
int compare_type_sigs(type_info_t *sig1, type_info_t *sig2) {
int i;
if(sig1->length != sig2->length)
return 0;
/* String literals are compatible with strings */
if((sig1->decl_type == TYPE_STRING_LITERAL && is_primitive(sig2) &&
primitive_type(sig2) == TYPE_STRING) ||
(sig2->decl_type == TYPE_STRING_LITERAL && is_primitive(sig1) &&
primitive_type(sig1) == TYPE_STRING))
return 1;
for(i = 0; i < sig1->length; i++) {
if(!((sig1->signature[i] == TYPE_POINTER &&
sig2->signature[i] == TYPE_ADDRESS) ||
(sig1->signature[i] == TYPE_ADDRESS &&
sig2->signature[i] == TYPE_POINTER)))
if(sig1->signature[i] != sig2->signature[i])
return 0;
}
return 1;
}
/*
* Remove the leftmost instance of the given type from the type string
*/
type_info_t *remove_type_from_sig(type_info_t **sig, int type) {
int i;
/* Remove the leftmost instance of type from the type signature */
for(i = 0; i < (*sig)->length; i++)
if(type == TYPE_ARRAY && ((*sig)->signature[i] & TYPE_MASK) == TYPE_ARRAY)
break;
else if(type == TYPE_HISTORY &&
((*sig)->signature[i] & TYPE_MASK) == TYPE_HISTORY)
break;
else if(type == TYPE_ADDRESS && (*sig)->signature[i] == TYPE_POINTER)
break;
else if((*sig)->signature[i] == type)
break;
if(i == (*sig)->length)
compiler_error(CERROR_ERROR, CERROR_NO_LINE,
"Attempt to nonexistent remove type %d from signature\n",
type);
(*sig)->length--;
for(; i < (*sig)->length; i++)
(*sig)->signature[i] = (*sig)->signature[i + 1];
(*sig)->signature = realloc((*sig)->signature,
sizeof(unsigned int) * (*sig)->length);
return *sig;
}
/*
* Add the given type to the left of the given type string
*/
type_info_t *add_to_type_sig(type_info_t **sig, int type) {
int i;
(*sig)->length++;
(*sig)->signature = realloc((*sig)->signature, sizeof(unsigned int) *
(*sig)->length);
for(i = (*sig)->length - 1; i > 0; i--)
(*sig)->signature[i] = (*sig)->signature[i - 1];
(*sig)->signature[i] = type;
return *sig;
}
/*
* Create a pointer to type. Used for history variable pointers
*/
type_info_t *create_ptr_to_type(int decl_type, int type, int levels) {
type_info_t *sig;
int i;
sig = malloc(sizeof(type_info_t));
sig->decl_type = decl_type;
sig->length = levels + 1;
sig->signature = malloc(sizeof(unsigned int) * sig->length);
for(i = 0; i < levels; i++)
sig->signature[i] = TYPE_POINTER;
sig->signature[levels] = type;
return sig;
}
/*
* Create an array type
*/
type_info_t *create_array_type(int decl_type, int type, int size) {
type_info_t *sig;
sig = malloc(sizeof(type_info_t));
sig->decl_type = decl_type;
sig->length = 2;
sig->signature = malloc(sizeof(unsigned int) * sig->length);
sig->signature[0] = TYPE_ARRAY;
sig->signature[0] |= (size << TYPE_SHIFT);
sig->signature[1] = type;
return sig;
}
/*
* Create a type signature
*/
type_info_t *create_type_signature(int decl_type, int type,
ast_node_t *subtree) {
int i, j, k, index = 0, num_indicies;
type_info_t *sig;
ast_node_t *current;
/*
* The type signature is a list of types, the primitive
* type is always stored last in the list. Arrays types
* have the size stored in the top 16 bits of the int.
*/
sig = malloc(sizeof(type_info_t));
if(subtree && subtree->node_type == NODE_OPERATOR) {
sig->length = count_nodes(subtree);
current = subtree;
while(current->node_type == NODE_OPERATOR) {
if(current->node.op == NODE_ARRAY || current->node.op == NODE_HISTORY) {
sig->length--;
}
current = current->node.children[0];
}
} else
sig->length = 1;
sig->decl_type = decl_type;
sig->signature = malloc(sizeof(unsigned int) * sig->length);
sig->signature[sig->length - 1] = type;
if(!subtree)
return sig;
for(i = 0; i < sig->length - 1; i++) {
switch(subtree->node.op) {
case NODE_POINTER:
sig->signature[i] = TYPE_POINTER;
break;
case NODE_ARRAY:
index = i;
for(j = 1; j < subtree->node.num_children; j++, i++) {
for(k = i; k > index + i; k--)
sig->signature[k] = sig->signature[k - 1];
sig->signature[index] = subtree->node.children[j]->leaf.val;
sig->signature[index] <<= 16;
sig->signature[index++] |= TYPE_ARRAY;
}
i--;
break;
case NODE_HISTORY:
sig->signature[i] = subtree->node.children[1]->leaf.val;
sig->signature[i] <<= 16;
sig->signature[i] |= TYPE_HISTORY;
break;
}
subtree = subtree->node.children[0];
}
return sig;
}
/*
* Copy a type signature
*/
type_info_t *copy_sig(type_info_t *src, type_info_t *dest) {
int i;
dest->decl_type = src->decl_type;
dest->length = src->length;
dest->signature = malloc(sizeof(int) * dest->length);
dest->indirect_levels = src->indirect_levels;
for(i = 0; i < dest->length; i++)
dest->signature[i] = src->signature[i];
return dest;
}
/*
* Type sign a usage of a variable.
*/
type_info_t *type_sign_var(name_record_t *var, type_info_t *sig) {
int i, base_type;
if(!var)
compiler_error(CERROR_ERROR, CERROR_NO_LINE,
"Attempting to type-check non-existant variable\n");
if(!var->type_info)
compiler_error(CERROR_ERROR, CERROR_NO_LINE,
"Variable %s has no associated type\n", var->name);
base_type = var->type_info->signature[var->type_info->length - 1];
debug_printf(1, "Var_record sig:");
print_type_signature(var->type_info);
sig->decl_type = var->type_info->decl_type;
sig->length = var->type_info->length;
sig->signature = malloc(sizeof(int) * sig->length);
sig->indirect_levels = 0;
sig->num_indicies = 0;
sig->indicies = NULL;
for(i = 0; i < sig->length; i++) {
if(var->type_info->signature[i] == TYPE_POINTER)
sig->signature[i] = TYPE_ADDRESS;
else
sig->signature[i] = var->type_info->signature[i];
}
return sig;
}
/*
* Return whether or not the given type is an array type
*/
int is_array_type(type_info_t *sig) {
int i;
if(!sig)
return 0;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_ARRAY)
return 1;
return 0;
}
/*
* Return whether or not a type signature represents an address type
*/
int is_address_type(type_info_t *sig) {
int i;
if(!sig)
return 0;
for(i = 0; i < sig->length; i++)
if(sig->signature[i] == TYPE_ADDRESS || sig->signature[i] == TYPE_POINTER)
return 1;
return 0;
}
/*
* Return whether or not a type signature represents a primitive type.
*
* FIXME: Why are address types primitive?
*
*/
int is_primitive(type_info_t *sig) {
if(!sig)
return 0;
if(sig->decl_type == TYPE_USER)
return 0;
if(sig->length == 1)
return 1;
if(sig->length == 2 && sig->signature[0] == TYPE_ADDRESS)
return 1;
return 0;
}
int is_string_type(type_info_t *sig) {
int i;
if(!sig)
return 0;
if(sig->decl_type == TYPE_STRING_LITERAL)
return 1;
for(i = 0; i < sig->length; i++)
if(sig->signature[i] == TYPE_STRING)
return 1;
return 0;
}
int is_struct_type(type_info_t *sig) {
int i;
if(!sig)
return 0;
if((sig->signature[sig->length - 1] & TYPE_MASK) == TYPE_UTYPE)
return 1;
return 0;
}
int is_history_type(type_info_t *sig) {
int i;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_HISTORY)
return 1;
return 0;
}
int history_array_type(type_info_t *sig) {
int i;
if(!sig)
return 0;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_HISTORY)
if(i > 0 && (sig->signature[i - 1] & TYPE_MASK) == TYPE_ARRAY)
return HISTORY_INDEX_WISE;
else
return HISTORY_ARRAY_WISE;
/* Oops */
return HISTORY_NONE;
}
int get_history_depth(type_info_t *sig) {
int i;
if(!sig)
return 0;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_HISTORY)
return sig->signature[i] >> 16;
return 0;
}
/*
* Return the primitive type for a given type
*/
int primitive_type(type_info_t *sig) {
if(!sig)
return TYPE_NONE;
return sig->signature[sig->length - 1];
}
/*
* Return the number of dimensions in an array type
*/
int get_num_dimensions(type_info_t *sig) {
int i, count = 0;
if(!sig)
return 0;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_ARRAY)
count++;
return count;
}
/*
* Get the size of the specified dimension
*
* Note: Dimensions start at one, not zero
*/
int get_dimension_size(type_info_t *sig, int index) {
int i;
for(i = 0; i < sig->length; i++)
if((sig->signature[i] & TYPE_MASK) == TYPE_ARRAY) {
index--;
if(index == 0)
return sig->signature[i] >> 16;
}
/* Shouldn't get here */
return 0;
}
/*
* Return the number of elements in an array
*/
int get_num_elements(type_info_t *sig) {
int i, elements = 0;
for(i = 0; i < get_num_dimensions(sig); i++)
elements += get_dimension_size(sig, i + 1);
return elements;
}
/*
* Cast an array type to the pointer equivalent
*/
type_info_t *cast_array_to_pointer(type_info_t *sig) {
int i;
type_info_t *cast;
cast = malloc(sizeof(type_info_t));
cast->length = sig->length;
cast->signature = malloc(sizeof(int) * cast->length);
for(i = 0; i < cast->length - 1; i++)
cast->signature[i] = TYPE_ADDRESS;
cast->signature[cast->length - 1] = sig->signature[sig->length - 1];
cast->indirect_levels = -1;
return cast;
}
/*
* TODO: print_type_signature should call sprint_type_signature and
* print to stdout, to prevent duplication of code.
*/
void print_type_signature(type_info_t *sig) {
int i;
debug_printf(1, "<%d> ", sig->length);
switch(sig->decl_type) {
case TYPE_VARIABLE:
debug_printf(1, "(variable) ");
break;
case TYPE_FUNCTION:
debug_printf(1, "(function) ");
break;
case TYPE_ARGUMENT:
debug_printf(1, "(argument) ");
break;
case TYPE_CONSTANT:
debug_printf(1, "(constant) ");
break;
case TYPE_STRING_LITERAL:
debug_printf(1, "(string literal) ");
break;
case TYPE_LVALUE:
debug_printf(1, "(lvalue) ");
break;
case TYPE_RVALUE:
debug_printf(1, "(rvalue) ");
break;
case TYPE_USER:
debug_printf(1, "(struct) ");
break;
case TYPE_MEMBER:
debug_printf(1, "(member) ");
break;
default:
debug_printf(1, "(unknown %d) ", sig->decl_type);
break;
}
for(i = 0; i < sig->length; i++) {
if(sig->decl_type == TYPE_STRING_LITERAL && i == sig->length - 1) {
debug_printf(1, "string literal, id = %d\n", sig->signature[i]);
break;
}
switch(sig->signature[i] & TYPE_MASK) {
case TYPE_VOID:
debug_printf(1, "void\n");
break;
case TYPE_INTEGER:
debug_printf(1, "int\n");
break;
case TYPE_CHAR:
debug_printf(1, "char\n");
break;
case TYPE_STRING:
debug_printf(1, "string\n");
break;
case TYPE_POINTER:
debug_printf(1, "pointer to ");
break;
case TYPE_ADDRESS:
debug_printf(1, "address of ");
break;
case TYPE_ARRAY:
debug_printf(1, "array (size %d) of ", (sig->signature[i] &
TYPE_VALUE_MASK) >> TYPE_SHIFT);
break;
case TYPE_UTYPE:
debug_printf(1, "user type (%d)\n", (sig->signature[i] &
TYPE_VALUE_MASK) >> TYPE_SHIFT);
break;
case TYPE_HISTORY:
debug_printf(1, "history of ");
break;
default:
debug_printf(1, "Unknown type (%d) of ", sig->signature[i]);
break;
}
}
}
char *sprint_type_signature(type_info_t *sig) {
int i;
char temp[64], *buf;
if(!sig || !sig->length)
return NULL;
/* Assumes that signatures are not longer than 64 characters */
buf = malloc(sig->length * 64);
sprintf(buf, "<%d> ", sig->length);
switch(sig->decl_type) {
case TYPE_NONE:
sprintf(buf, "(none)");
break;
case TYPE_VARIABLE:
sprintf(buf, "(variable) ");
break;
case TYPE_FUNCTION:
sprintf(buf, "(function) ");
break;
case TYPE_ARGUMENT:
sprintf(buf, "(argument) ");
break;
case TYPE_CONSTANT:
sprintf(buf, "(constant) ");
break;
case TYPE_STRING_LITERAL:
sprintf(buf, "(string literal) ");
break;
case TYPE_LVALUE:
sprintf(buf, "(lvalue) ");
break;
case TYPE_RVALUE:
sprintf(buf, "(rvalue) ");
break;
case TYPE_USER:
sprintf(buf, "(struct) ");
break;
case TYPE_MEMBER:
sprintf(buf, "(member) ");
break;
default:
sprintf(buf, "(unknown %d) ", sig->decl_type);
break;
}
for(i = 0; i < sig->length; i++) {
if(sig->decl_type == TYPE_STRING && i == sig->length - 1) {
sprintf(temp, "string literal, id = %d", sig->signature[i]);
break;
}
switch(sig->signature[i] & TYPE_MASK) {
case TYPE_VOID:
sprintf(temp, "void");
break;
case TYPE_INTEGER:
sprintf(temp, "int");
break;
case TYPE_CHAR:
sprintf(temp, "char");
break;
case TYPE_STRING:
sprintf(temp, "string");
break;
case TYPE_POINTER:
sprintf(temp, "pointer to ");
break;
case TYPE_ADDRESS:
sprintf(temp, "address of ");
break;
case TYPE_ARRAY:
sprintf(temp, "array (size %d) of ", (sig->signature[i] &
TYPE_VALUE_MASK) >> TYPE_SHIFT);
break;
case TYPE_UTYPE:
sprintf(temp, "user type (%d)", (sig->signature[i] &
TYPE_VALUE_MASK) >> TYPE_SHIFT);
break;
case TYPE_HISTORY:
sprintf(temp, "history (depth %d) ", (sig->signature[i] &
TYPE_HISTORY_MASK) >> 16);
break;
default:
sprintf(temp, "Unknown type (%d) of ", sig->signature[i]);
break;
}
strncat(buf, temp, strlen(temp));
}
return buf;
}
char *sprint_type_name(name_record_t *entry) {
char *buf = malloc(strlen(entry->name) + 64);
switch(entry->type_info->decl_type) {
case TYPE_FUNCTION:
sprintf(buf, "%s is a function returning ", entry->name);
break;
case TYPE_VARIABLE:
sprintf(buf, "%s is a variable of type ", entry->name);
break;
case TYPE_ARGUMENT:
sprintf(buf, "%s is a function argument of type ", entry->name);
break;
}
return buf;
}
/*
* Print out a type signature
*/
void print_type_name(name_record_t *entry) {
switch(entry->type_info->decl_type) {
case TYPE_FUNCTION:
debug_printf(1, "%s is a function returning ", entry->name);
break;
case TYPE_VARIABLE:
debug_printf(1, "%s is a variable of type ", entry->name);
break;
case TYPE_ARGUMENT:
debug_printf(1, "%s is a function argument of type ", entry->name);
break;
}
}
|
521fdf6280f2ca0c74f5ecc41a9fc925ab576f2a
|
8d5a4762fc883282b5262fa508c9a73e2ff518c4
|
/libpok/include/arinc653/blackboard.h
|
4a9d50a1bd4fa3d61da5175fe4051aaa775da3ab
|
[
"BSD-2-Clause"
] |
permissive
|
Lyanf/pok
|
1ead25a22cbf118d3072459e891a52cb286297d1
|
0b3fcf890181da5f8c5fc9e3b97f53fb20dd20c2
|
refs/heads/master
| 2020-09-12T06:45:51.294858 | 2019-12-21T14:32:01 | 2019-12-21T14:32:01 | 222,345,159 | 1 | 1 |
BSD-2-Clause
| 2019-11-18T02:15:05 | 2019-11-18T02:15:04 | null |
UTF-8
|
C
| false | false | 2,993 |
h
|
blackboard.h
|
/*
* POK header
*
* The following file is a part of the POK project. Any modification should
* made according to the POK licence. You CANNOT use this file or a part of
* this file is this part of a file for your own project
*
* For more information on the POK licence, please see our LICENCE FILE
*
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
*
* Copyright (c) 2007-2009 POK team
*
* Created by julien on Thu Jan 15 23:34:13 2009
*/
#ifdef POK_NEEDS_ARINC653_BLACKBOARD
/*-------------------------------------------------------------------*/
/* */
/* BLACKBOARD constant and type definitions and management services */
/* */
/*-------------------------------------------------------------------*/
#ifndef APEX_BLACKBOARD
#define APEX_BLACKBOARD
#ifndef POK_NEEDS_ARINC653_PROCESS
#define POK_NEEDS_ARINC653_PROCESS
#endif
#include <arinc653/types.h>
#include <arinc653/process.h>
#define MAX_NUMBER_OF_BLACKBOARDS SYSTEM_LIMIT_NUMBER_OF_BLACKBOARDS
typedef NAME_TYPE BLACKBOARD_NAME_TYPE;
typedef APEX_INTEGER BLACKBOARD_ID_TYPE;
typedef enum { EMPTY = 0, OCCUPIED = 1 } EMPTY_INDICATOR_TYPE;
typedef struct {
EMPTY_INDICATOR_TYPE EMPTY_INDICATOR;
MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE;
WAITING_RANGE_TYPE WAITING_PROCESSES;
} BLACKBOARD_STATUS_TYPE;
extern void CREATE_BLACKBOARD (
/*in */ BLACKBOARD_NAME_TYPE BLACKBOARD_NAME,
/*in */ MESSAGE_SIZE_TYPE MAX_MESSAGE_SIZE,
/*out*/ BLACKBOARD_ID_TYPE *BLACKBOARD_ID,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
extern void DISPLAY_BLACKBOARD (
/*in */ BLACKBOARD_ID_TYPE BLACKBOARD_ID,
/*in */ MESSAGE_ADDR_TYPE MESSAGE_ADDR, /* by reference */
/*in */ MESSAGE_SIZE_TYPE LENGTH,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
extern void READ_BLACKBOARD (
/*in */ BLACKBOARD_ID_TYPE BLACKBOARD_ID,
/*in */ SYSTEM_TIME_TYPE TIME_OUT,
/*out*/ MESSAGE_ADDR_TYPE MESSAGE_ADDR,
/*out*/ MESSAGE_SIZE_TYPE *LENGTH,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
extern void CLEAR_BLACKBOARD (
/*in */ BLACKBOARD_ID_TYPE BLACKBOARD_ID,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
extern void GET_BLACKBOARD_ID (
/*in */ BLACKBOARD_NAME_TYPE BLACKBOARD_NAME,
/*out*/ BLACKBOARD_ID_TYPE *BLACKBOARD_ID,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
extern void GET_BLACKBOARD_STATUS (
/*in */ BLACKBOARD_ID_TYPE BLACKBOARD_ID,
/*out*/ BLACKBOARD_STATUS_TYPE *BLACKBOARD_STATUS,
/*out*/ RETURN_CODE_TYPE *RETURN_CODE );
#endif
#endif
|
13077e6b49a6909b8ae9b5e8a9a69984fd51bf96
|
976093fd2797b6e553fd021bdecf61a8922a26e2
|
/c-programming-homework-master/V/04/20/04_memes.c
|
f5c319e37a5a31743fbd7ea996529931847550a2
|
[
"MIT"
] |
permissive
|
fabestine1/MyThing
|
8c8171bc5c0a3a85c79a4c6f664322f0c652958b
|
56ab84ef245ef04ce0c815d7c80a31c574c98967
|
refs/heads/main
| 2023-03-23T04:47:15.815014 | 2021-03-10T11:11:45 | 2021-03-10T11:11:45 | 346,363,847 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 434 |
c
|
04_memes.c
|
#include<stdio.h>
#include<math.h>
int main(){
float xD, kappa[64], shieet=0;
int lol=0, lol2, eksdee=0, ez=0;
for(lol=0;scanf("%f", &xD)!=EOF;lol++)
{
if(lol==0){
kappa[eksdee]=xD;
}else
{
for(lol2=0;lol2<(lol-1);lol2++)
{
if(kappa[lol2]==xD)ez=1;
}
if(ez==0){
eksdee++;
kappa[eksdee]=xD;
}
}
ez=0;
}
printf("%d\n", eksdee);
for(lol=0;lol<=eksdee;lol++)
{
shieet=shieet+fmod(kappa[lol],eksdee);
}
printf("%.3f", shieet);
return 0;
}
|
e0af8e21a0a9c7fc1cc8c74e834822cb884babdd
|
30e80626428c9642dceacf549dab60070f33b759
|
/main0103.c
|
3bd7c5e7dd02f5d1859db3be7053d25558a41548
|
[] |
no_license
|
wangsir9825/2020_C_code
|
2dfeb30985175d75e6552d21f5644ae5d6843af8
|
af1f966a42b08627b4d4ec03f5bf319da96939b9
|
refs/heads/main
| 2023-08-24T19:46:52.941437 | 2021-10-04T14:19:14 | 2021-10-04T14:19:14 | 315,399,878 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 314 |
c
|
main0103.c
|
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#define N 10
int main()
{
int arr[N] = { 0 };
int i = 0;
int pos = 0;
int neg = 0;
for (i = 0; i < N; i++)
{
scanf("%d", &arr[i]);
if (arr[i] > 0)
pos++;
if (arr[i] < 0)
neg++;
}
printf("positive:%d\nnegative:%d\n", pos, neg);
return 0;
}
|
02f6e5b1c76088239891b6d3c4806f8ff92c7fdc
|
ea9df02642afffb73b865ac5254aff684fa11707
|
/c/FINAL/funciones.h
|
fd4f6db43897bc74d4c034fa66fa81341b18d27b
|
[] |
no_license
|
ValentinMartino/proyecto-Final
|
7ff789c687c0e787f8cc5d48a43f64b711630652
|
ed3b4fd69cce361f95398557e62b7e8f36711fbf
|
refs/heads/master
| 2023-01-04T09:49:02.751027 | 2020-10-29T20:22:06 | 2020-10-29T20:22:06 | 298,267,592 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 3,001 |
h
|
funciones.h
|
#ifndef FUNCIONES_H
#define FUNCIONES_H
struct nodo{
float temp;
float hum;
float pres;
char hora[6];
char fecha[6];
struct nodo *ptrSig;
};
typedef struct nodo NODO;
typedef NODO *ptrNodo;
/*FUNCIONES*/
/*FUNCION1:
*
* esta funcion ingresa un nodo nuevo, en esta funcion
* esta la funcion que lee los datos del archivo.
* El int es la cantidad de datos que fueron recibidos
* del arduino */
void ingresar_cola(ptrNodo *,ptrNodo *, int);
/*FUNCION2:
*
* Esta funcion se comunica con el puerto serial de Arduino,
* lee todos los datos enviados por este y los guarda en un
* archivo (de texto o nose). Devuelve la cantidad de datos
* que fueron recibidos del arduino. Por ejemplo: si devuel-
* ve 50, luego en el main se va a llamar 50 veces a la fun-
* cion de ingresar cola.*/
int leer_puerto();
/*FUNCION 3:
*
* Esta funcion se encarga de leer el archivo donde estan
* los datos y guardarlos en el nodo correspondiente de la
* estructura de datos. Esta funcion solo se llama dentro
* de la funcion ingresar cola. Esta funcion recibe el
* ptrNuevo para guardarle los valores de presion, temp, etc*/
void leer_archivo(ptrNodo *, int);
/*FUNCION 4:
*
* Esta funcion encuentra al mayor dato, ya sea temp, hum o pres
* El entero que recibe es para especificar que va a encontrar
* si la temp mayor o la pres mayor o la hum mayor*/
int mayor_dato(ptrNodo, int);
/*FUNCION 5:
*
* Esta funcion encuentra al menor dato, ya sea temp, hum o pres
* El entero que recibe es para especificar que va a encontrar
* si la temp menor o la pres menor o la hum menor*/
int menor_dato(ptrNodo, int);
/*FUNCION 6:
*
* Esta funcion es por si el usuario quiere tener un archivo
* para leercon los datos obtenidos. Recibe como parametro
* el inicio a la cola. retorna 1 si los datos se guardaron
* en el archivo, y cero si hubo algun error*/
int archivo_usuario(ptrNodo);
/*FUNCION 7:
*
* Esta funcion muestra por pantalla los mismos datos que la
* funcion archivo_usuario*/
void mostrar(ptrNodo);
/*FUNCION 8:
*
* funcion que muestra el grafico de temperatura. */
void grafico_temp(ptrNodo, int);
/*FUNCION 9:
*
* funcion que muestra el grafico de humedad. */
void grafico_hum(ptrNodo, int);
/*FUNCION 10:
*
* funcion que muestra el grafico de presion. */
void grafico_pres(ptrNodo, int);
/* FUNCION 11:
*
* esta funcion cuenta las lineas del archivo datos.txt para
* saber cuantas veces llamar a la funcion de crear cola*/
int lineas();
/*FUNCION 12
* funcion que encuentra valores establecidos por el usuario
* esta funcion recibe un entero que determina si va a comparar
* la presion, la temperatura o la humedad. Otro entero que es
* el valor que va a compara, y un 0 si va a comparar para abajo
* o un 1 si va a comparar para arriba.*/
void rangos(int, int, int);
/*MENU
* recibe un numero entero de la cantidad de nodos que
* va a haber*/
void menu(int);
/*COLORES EN LA TERMINAL*/
#define FONDO_BLANCO "\e[107m"
#define LETRA_NEGRA "\033[22;30m"
#endif
|
5e12778bff4d4a1d52727658e2f5aa8ebf64c013
|
1fa309b90d73c6daad65a2604d07ddc120fa6f8e
|
/2022/timer_with_voice/firmware/thirdparty/sfud/sfud_port.c
|
0a17023004488b20f211467fcd4d8e69f535f734
|
[] |
no_license
|
tomzbj/diy
|
473e4c50288b88107deb7b41432979bd01e3ecb2
|
7287e609509e9d7f0ffa9e01e34414a49b568179
|
refs/heads/master
| 2023-07-21T02:47:47.710028 | 2023-07-10T03:32:36 | 2023-07-10T03:32:36 | 160,756,266 | 69 | 44 | null | null | null | null |
UTF-8
|
C
| false | false | 1,992 |
c
|
sfud_port.c
|
#include <sfud.h>
#include <stdarg.h>
#include "misc.h"
#include "platform.h"
static char log_buf[256];
void sfud_log_debug(const char* file, const long line, const char* format, ...);
#define SF_GPIO GPIOB
#define SF_PIN GPIO_Pin_12
static void set_cs(int cs)
{
(cs) ? ( SF_GPIO->BSRR = SF_PIN) : ( SF_GPIO->BRR = SF_PIN);
}
static sfud_err spi_write_read(const sfud_spi* spi, const uint8_t* write_buf,
size_t write_size, uint8_t* read_buf, size_t read_size)
{
sfud_err result = SFUD_SUCCESS;
if(write_size) {
SFUD_ASSERT(write_buf);
}
if(read_size) {
SFUD_ASSERT(read_buf);
}
set_cs(0);
for(int i = 0; i < write_size; i++)
SPI2_ReadWrite(*write_buf++);
if(read_size > 0) {
// for(int i = 0; i < read_size; i++) *read_buf++ = SPI2_ReadWrite(0xff);
SPI2_Read_DMA(read_buf, read_size);
}
set_cs(1);
return result;
}
static void spi_lock(const sfud_spi* spi)
{
__disable_irq();
}
static void spi_unlock(const sfud_spi* spi)
{
__enable_irq();
}
static void delay_f(void)
{
_delay_us(10);
}
sfud_err sfud_spi_port_init(sfud_flash* flash)
{
sfud_err result = SFUD_SUCCESS;
// initialized before here.
flash->spi.wr = spi_write_read;
flash->spi.lock = spi_lock;
flash->spi.unlock = spi_unlock;
flash->spi.user_data = NULL;
flash->retry.delay = delay_f;
flash->retry.times = 10000;
// flash->spi.qspi_read = qspi_read;
return result;
}
void sfud_log_debug(const char* file, const long line, const char* format, ...)
{
va_list args;
va_start(args, format);
printf("[SFUD](%s:%ld) ", file, line);
vsnprintf(log_buf, sizeof(log_buf), format, args);
printf("%s\n", log_buf);
va_end(args);
}
void sfud_log_info(const char* format, ...)
{
va_list args;
va_start(args, format);
printf("[SFUD]");
vsnprintf(log_buf, sizeof(log_buf), format, args);
printf("%s\n", log_buf);
va_end(args);
}
|
214dccb138d33870d71a1f271be5ef32900e09e5
|
82c2d6d6b2caef63af89b7bcacf8cf48ed9c989a
|
/stack.c
|
74163f03666397c9399ae5b5044c9a06f8d25005
|
[] |
no_license
|
kubira/ifj_2009_pr
|
2de2f03320a97b90ae4a0902d693e0a09f928406
|
3c9370caf0b6a614003c147367d45c51c8d5e623
|
refs/heads/master
| 2021-01-16T21:05:47.983036 | 2016-06-04T15:47:51 | 2016-06-04T15:47:51 | 60,417,681 | 0 | 0 | null | null | null | null |
WINDOWS-1250
|
C
| false | false | 4,328 |
c
|
stack.c
|
/*******************************************************************************
*
* Implementace prekladace imperativniho jazyka IFJ 09
*
* xkubis03 - Radim Kubis
* xbrene02 - Brenek Roman
* xblaho01 - Blaho Vojtech
* xlukas07 - Lukas Radek
*
*******************************************************************************/
//stack.c
#include <stdio.h>
#include <stdlib.h>
#include "str.h"
#include "bvs.h"
#include "stack.h"
#include "scaner.h"
#define SYNTAX_ERROR 1002
#define SEM_ERROR 1003
int counterVar = 1;
void generateVariable(string *var)
// generuje jedinecne nazvy identifikatoru
// nazev se sklada ze znaku $ nasledovanym cislem
// postupne se tu generuji prirozena cisla a do nazvu promenne se ukladaji
// v reverzovanem poradi - na funkcnost to nema vliv, ale je jednodussi implementace
{
int i;
strClear(var);
strAddChar(var, '$');
i = counterVar;
while (i != 0)
{
strAddChar(var, (char)(i % 10 + '0'));
i = i / 10;
}
counterVar ++;
}
char *znaky[17];
void udelejZnaky() {
znaky[ID] = "I";
znaky[PLUS] = "+";
znaky[MINUS] = "-";
znaky[MUL] = "*";
znaky[DIV] = "/";
znaky[LEFT_PARENTHESIS] = "(";
znaky[RIGHT_PARENTHESIS] = ")";
znaky[7] = "f";
znaky[STROKE] = ",";
znaky[LESSTHAN] = "<";
znaky[GREATTHAN] = ">";
znaky[LTOREQUAL] = "<=";
znaky[GTOREQUAL] = ">=";
znaky[EQUAL] = "==";
znaky[NOTEQUAL] = "!=";
znaky[ASSIGN] = "=";
znaky[DOLLAR] = "$";
}
void stackInit(stack *s) {
stackItemPtr helper;
helper = malloc(sizeof(struct stackItem));
helper->symbol = DOLLAR;
helper->term = TRUE;
helper->nextItem = NULL;
helper->tablePtr = NULL;
helper->nextNonTerm = NULL;
s->first = helper;
s->top = helper;
s->firstNonTerm = NULL;
udelejZnaky();
}
int push(stack *s, int symb, string *name, tSymbolTable *table) {
stackItemPtr helper; // Pomocná proměnné pro vložení nového prvku
helper = malloc(sizeof(struct stackItem)); // Alokace nového prvku
if(symb == FUNCTION) {
if(strCmpConstStr(name, "sort") == 0) {
helper->function = SORT;
} else if(strCmpConstStr(name, "find") == 0) {
helper->function = FIND;
} else {
return SYNTAX_ERROR;
}
}
helper->symbol = symb; // Symbol na zásobníku - index ve znacích
helper->nextItem = s->first; // Nastavení následujícího prvku
s->first = helper; // Nastavení prvního prvku na aktuální
//if(symb == 'E' || symb == ID) printf("\t\t\tPUSH: %s\n", strGetStr(name));
if(symb != 'E') {
helper->term = TRUE;
s->top = helper;
helper->nextNonTerm = NULL;
}
else {
helper->term = FALSE;
helper->nextNonTerm = s->firstNonTerm;
s->firstNonTerm = helper;
}
if((symb == 0) || (symb == 'E')) {
if((helper->tablePtr = tableSearch(table, name)) == NULL) { // nenasel v tabulce, treba vygenerovat promennou
return SEM_ERROR;
}
}
return 0;
}
int isEmpty(stack *s) {
if(!s->top) {
return TRUE;
}
else {
return FALSE;
}
}
stackItemPtr top(stack *s) {
return s->top;
}
void pop(stack *s, string *name) {
stackItemPtr helper;
helper = s->first;
if(helper->symbol == 'E' || helper->symbol == ID) {
//printf("POP: %s\n", s->first->tablePtr->key.str);
strCopyChar(name, helper->tablePtr->key.str);
}
if (helper->symbol == 'E')
if(s != NULL)
if(s->firstNonTerm != NULL)
if(s->firstNonTerm->nextNonTerm != NULL) // CHYBA!!!
s->firstNonTerm = s->firstNonTerm->nextNonTerm;
s->first = helper->nextItem;
if(helper == s->top) {
s->top = s->first;
}
free(helper);
}
void stackVypis(stack *s)
{
stackItemPtr helper;
helper = s->first;
while(helper) {
if(helper->symbol == '|') {
//printf("|");
}
else if(helper->symbol != 'E') {
//printf("%s", znaky[helper->symbol]);
}
//else printf("%c", helper->symbol);
helper = helper->nextItem;
}
//printf("\n");
}
void stackDispose(stack *s)
{
stackItemPtr helper;
while(s->first != NULL) {
helper = s->first;
s->first = helper->nextItem;
free(helper);
}
}
|
c44375c8f21f2cd71ba2e0b67c9b46e643400dbd
|
89a391e7061a4c46b9ba03f1753871e7cc0d81b1
|
/xv6-public/pwd.c
|
ceb3bdcc7bc33dfd7777639f8ab4c1913b124de2
|
[
"MIT"
] |
permissive
|
negineri/syspro
|
434b570cbe67592012ba990b4dedada1012b4802
|
123f385d0bd2095c9cda444704cd5a22a7611366
|
refs/heads/master
| 2022-11-12T04:19:55.353705 | 2020-07-05T13:30:06 | 2020-07-05T13:30:06 | 275,765,689 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 939 |
c
|
pwd.c
|
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "stat.h"
#include "fs.h"
#define MAX_PATH 256
int rp_to_ap(char *rp, char *ap) {
struct stat st;
struct dirent de;
int fd;
int le;
int rv;
if (stat(rp, &st) < 0) return -1;
strcpy(rp + strlen(rp), "/..");
if ((fd = open(rp, O_RDONLY)) < 0) return -1;
while (1) {
if ((read(fd, &de, sizeof(de))) != sizeof(de) || de.inum == 0) {
close(fd);
return -1;
}
if (de.inum == st.ino) break;
}
close(fd);
if (strcmp(de.name, ".") == 0 || strcmp(de.name, "..") == 0) {
strcpy(ap, "/");
return 1;
}
if ((rv = rp_to_ap(rp, ap)) < 0) return -1;
le = strlen(ap);
if (rv == 0) strcpy(ap + le++, "/");
strcpy(ap + le, de.name);
return 0;
}
int main() {
char rp[MAX_PATH] = ".";
char ap[MAX_PATH] = "";
if (rp_to_ap(rp, ap) < 0) {
printf(2, "rtp error\n");
exit();
}
printf(1, "%s\n", ap);
exit();
}
|
41e60e7dcdcd861558fcb10f9a0842caad916808
|
158059c348e49112a06cdfb929a136c62aabc306
|
/Include/FS/FSDirAlloc.h
|
872800157b69d69a146aaffdeab6b4fa8d67c613
|
[
"MIT"
] |
permissive
|
vikvych/hierarchy_base
|
f5be4066f7460593c719eb4e95991d65fbaf6907
|
fa2cfed8ca1ffe82b5665d4a615bd205849ae609
|
refs/heads/master
| 2021-01-22T02:17:50.921473 | 2017-05-25T01:25:50 | 2017-05-25T01:25:50 | 92,345,623 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 128 |
h
|
FSDirAlloc.h
|
#ifndef HIERARCHY_FS_DIR_ALLOC_H
#define HIERARCHY_FS_DIR_ALLOC_H
#include "FSEntryT.h"
ErrnoT FSDirAlloc(char *Dir);
#endif
|
419386454c70794dea29d89d394a59893651a949
|
e717e2019a627807628354c6aae9f5fb594cbb56
|
/File1.c
|
545e2f7f936fc9b20c1290c396f7f9f0197aec21
|
[] |
no_license
|
hkbiet/Test
|
c7e4c285b1be6b9de086e56c6d9cddca9edb924d
|
130392130a89114c6c7b665fe76482be3ea12e1b
|
refs/heads/master
| 2020-03-18T01:37:52.048600 | 2018-05-22T13:38:34 | 2018-05-22T13:38:34 | 134,151,640 | 0 | 0 | null | 2018-05-23T03:08:24 | 2018-05-20T13:10:15 |
C
|
UTF-8
|
C
| false | false | 287 |
c
|
File1.c
|
#TEST FILE 1 WITH NO CONTENT
#COMMENT ADDED BY fable
#include<stdio.h>
int fun(int,int)
int main(){
char a;
int b;
int sum = b + 100 + 3200;
printf("sum",%d)
printf("UNDER RIDE with OVER RIDE")
fun();
}
int fun(){
int a,b;
printf("OK TESTED FOR a and b")
}
|
0c9e7949f23ae9eca86ae64df789767ef609a92d
|
2e6937641601f2c28851332960eef424e5dc12ea
|
/SDK/Non-OS/KPI/src/libkpi_1x6_gpio.c
|
92c43d4954b5bc0fb9445c59cdfcc6d8ffaacdd0
|
[] |
no_license
|
ycyen0/N3291X
|
ce436aed66889241e0c5444b50eab0f5bda9bacc
|
642d6ded0d059f6b31f207c19a247441f8d67e60
|
refs/heads/master
| 2021-08-08T01:40:26.495169 | 2017-11-09T09:07:11 | 2017-11-09T09:07:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 3,697 |
c
|
libkpi_1x6_gpio.c
|
/****************************************************************************
* *
* Copyright (c) 2009 Nuvoton Tech. Corp. All rights reserved. *
* *
*****************************************************************************/
/****************************************************************************
* FILENAME
* libkpi.c
*
* VERSION
* 1.0
*
* DESCRIPTION
* KPI library source file
*
* DATA STRUCTURES
* None
*
* FUNCTIONS
*
* HISTORY
*
* REMARK
* None
****************************************************************************/
#include "w55fa95_gpio.h"
#include "w55fa95_kpi.h"
// latest key pressed recorded by ISR, might _not_ be the most updated status
static unsigned int _key;
// interrupt number for kpi
static unsigned char _int;
static unsigned char _opened = 0;
static BOOL bGetKey = TRUE;
static unsigned int readkey(void)
{
unsigned int read0, read1;
gpio_readport(GPIO_PORTA, (unsigned short *)&read0);
read0 = (read0 & 0x78) >> 3;
gpio_readport(GPIO_PORTB, (unsigned short *)&read1);
read1 = (read1 & 0xC00) >> 6;
read0 |= read1;
if(read0 == 0x3F)
return(0);
return (~read0 & 0x3F);
}
static void kpi_isr(void)
{
_key = readkey();
//(*(unsigned int volatile *)REG_AIC_SCCR) = (1 << (_int + 2));
gpio_cleartriggersrc(GPIO_PORTA);
gpio_cleartriggersrc(GPIO_PORTB);
return;
}
void kpi_init(void)
{
_opened = 1;
// PORTA[3,4,5,6]
gpio_setportdir(GPIO_PORTA, ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)), 0);
gpio_setportpull(GPIO_PORTA, ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)), ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)));
gpio_setintmode(GPIO_PORTA, ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)),
((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)), ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)));
//PORTB[10,11]
gpio_setportdir(GPIO_PORTB, ((1 << 10) | (1 << 11)), 0);
gpio_setportpull(GPIO_PORTB, ((1 << 10) | (1 << 11)), 0);
gpio_setintmode(GPIO_PORTB, ((1 << 10) | (1 << 11)),
((1 << 10) | (1 << 11)), ((1 << 10) | (1 << 11)));
return;
}
int kpi_open(unsigned int src)
{
if(_opened == 0)
kpi_init();
if(_opened != 1)
return(-1);
_opened = 2;
if(src > 3)
return(-1);
_int = src;
gpio_setsrcgrp(GPIO_PORTA, ((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6)), src);
gpio_setsrcgrp(GPIO_PORTB, ((1 << 10) | (1 << 11)), src);
gpio_setdebounce(128, 1 << src);
gpio_setlatchtrigger(1 << src);
sysInstallISR(IRQ_LEVEL_7, src + 2, (PVOID)kpi_isr);
sysSetInterruptType(src + 2, HIGH_LEVEL_SENSITIVE);
sysSetLocalInterrupt(ENABLE_IRQ);
return(0);
}
void kpi_close(void)
{
if(_opened != 2)
return;
_opened = 1;
sysDisableInterrupt(_int + 2);
return;
}
int kpi_read(unsigned char mode)
{
// add this var in case key released right before return.
int volatile k = 0;
if(_opened != 2)
return(-1);
if(mode != KPI_NONBLOCK && mode != KPI_BLOCK) {
//sysDisableInterrupt(_int + 2);
return(-1);
}
sysEnableInterrupt(_int + 2);
if(bGetKey == TRUE)
{
bGetKey = FALSE;
_key = readkey();
}
if(_key == 0) {
// not pressed, non blocking, return immediately
if(mode == KPI_NONBLOCK) {
sysDisableInterrupt(_int + 2);
return(0);
}
// not pressed, non blocking, wait for key pressed
#pragma O0
// ARMCC is tooooo smart to compile this line correctly, so ether set O0 or use pulling....
while((k = _key) == 0);
} else {
// read latest key(s) and return.
sysDisableInterrupt(_int + 2);
do {
k = readkey();
} while(k == 0 && mode != KPI_NONBLOCK);
}
return(k);
}
|
55319b15475dbe5da53e3237381c169c9682a197
|
c80e33331d55cb7029a29be1671f4cb03b0971e7
|
/interThermalPhaseFoam/TurbulenceModels/compressible/lnInclude/compressibleTransportModel.H
|
3075e12cc065178315547dc71fde06c3db44c023
|
[] |
no_license
|
mmgocmen/ITPCF_OpenFOAMv8
|
7aecf07bdf07fec758f2945513e22d2c2c8ec31f
|
0d15d513fc0fbf6f69f105d3f097439d53a46836
|
refs/heads/master
| 2023-05-02T20:41:54.642827 | 2021-05-23T17:16:05 | 2021-05-23T17:16:05 | 368,991,287 | 2 | 1 | null | null | null | null |
UTF-8
|
C
| false | false | 71 |
h
|
compressibleTransportModel.H
|
../compressible/compressibleTransportModel/compressibleTransportModel.H
|
6e193f75f59fce11c9cacecb27eb6e2a29c182bf
|
12ff66457562698e2ea1d5b65b585a7d75a9130e
|
/Functions.h
|
65bb49cfc7d4a95aa60e1dd145b81af359513cd3
|
[] |
no_license
|
sabs546/3rd-year-project
|
4d98a95d7872cb3f3a747d452522531c3f5d7bca
|
926b954c95d151490e6fe6be8d875fe3c53a4d0d
|
refs/heads/master
| 2020-11-27T20:47:20.894830 | 2019-12-22T16:21:57 | 2019-12-22T16:21:57 | 229,595,941 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 18,344 |
h
|
Functions.h
|
#pragma once
#include "Spine.h"
#include "Buttons.h"
void SpawnBlocksOptimised(IMesh* &cubeMesh, vector<IModel*> &cubeModel, IModel* &cubeModelNode,
IMesh* &treeMesh, IMesh* &darkTreeMesh, IMesh* &snowTreeMesh, vector<IModel*> &treeModel, vector<IModel*> &darkTreeModel, vector<IModel*> &snowTreeModel, IModel* &treeModelNode,
IMesh* &grassMesh, vector<IModel*> &grassModel,
const int &mapDistance, //Needed so convert the negative values to 0 so we know where the player is
const int &renderDistance, //So the algorithm knows where to start looking
const int &zModifier, //How far along the Z-Axis is the player currently
const int &xModifier //How far along the X-Axis is the player currently
)
{ // Only used at startup to spawn in all the necessary blocks
int Z = zModifier - renderDistance; //10 blocks behind your current spot on the Z-axis
int X = xModifier - renderDistance; //10 blocks behind your current spot on the X-axis
int zLimit = Z + (renderDistance << 1); //10 blocks ahead of your current spot on the Z-axis
int xLimit = X + (renderDistance << 1); //10 blocks ahead of your current spot on the X-axis
int j = 0;
int calc;
for (; Z < zLimit; Z++)
{ //Spawning along the Z axis
if (Z < -mapDistance) // Allows the map to loop along the Z-Axis
{
Z += mapDistance << 1;
zLimit += mapDistance << 1;
}
else if (Z > mapDistance)
{
Z -= mapDistance << 1;
zLimit -= mapDistance << 1;
}
for (; X < xLimit; X++, j++)
{ //Spawning along the X axis
if (X < -mapDistance) // Allows the map to loop along the X-Axis
{
X += mapDistance << 1;
xLimit += mapDistance << 1;
}
else if (X > mapDistance)
{
X -= mapDistance << 1;
xLimit -= mapDistance << 1;
}
calc = ((mapDistance << 1) * (Z + mapDistance)) + (X + mapDistance); // Convert the array to the map co-ordinate
cubeModelNode = cubeMesh->CreateModel((float)cube[calc].xBlock * 10, cube[calc].yPos, (float)cube[calc].zBlock * 10);
cubeModel.push_back(cubeModelNode);
if (cube[calc].tree == 1 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{ // Each one of these spawns a tree or grass depending on what is needed
treeModelNode = darkTreeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
darkTreeModel.push_back(treeModelNode);
}
else if (cube[calc].tree == 2 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{
treeModelNode = treeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
treeModel.push_back(treeModelNode);
}
else if (cube[calc].tree == 3 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{
treeModelNode = snowTreeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
snowTreeModel.push_back(treeModelNode);
}
else if (cube[calc].grass == 1 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{
treeModelNode = grassMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
grassModel.push_back(treeModelNode);
}
switch (cube[calc].biome)
{ // Set grass texture based off of biome
case 1:
cubeModel[j]->SetSkin("grass.png");
break;
case 2:
cubeModel[j]->SetSkin("darkGrass.png");
break;
case 3:
cubeModel[j]->SetSkin("snow.png");
break;
}
}
X -= (renderDistance << 1);
}
}
void OptimisedTerrain(vector<IModel*> &cubeModel,
const int &mapDistance, //Needed so convert the negative values to 0 so we know where the player is
const int &renderDistance, //So the algorithm knows where to start looking
const int &zModifier, //How far along the Z-Axis is the player currently
const int &xModifier, //How far along the X-Axis is the player currently
const int &oldZModifier, //How far along the Z-Axis was the player before
const int &oldXModifier, //How far along the X-Axis was the player before
const float &halfCubeSize, //Used to measure out the distance before getting to another cube position
const bool &heightMap, //Used to check what kind of texture mode the cube is on
const int &direction = 5 //0, 1, 2, 3, 5 = Left, Down, Right, Up, Still | Which way did the player move?
)
{ // Move the terrain with the player
int Z = zModifier - renderDistance; //All visible blocks behind your current spot on the Z-axis vector to grid conversion
int X = xModifier - renderDistance; //All visible blocks behind your current spot on the X-axis vector to grid conversion
int zLimit = Z + (renderDistance << 1); //10 blocks ahead of your current spot on the Z-axis
int xLimit = X + (renderDistance << 1); //10 blocks ahead of your current spot on the X-axis
int oldZ = oldZModifier - renderDistance; //All visible blocks behind your current spot on the Z-axis vector to grid conversion
int oldX = oldXModifier - renderDistance; //All visible blocks behind your current spot on the X-axis vector to grid conversion
int j = 0;
int oldCalc;
int calc;
for (; Z < zLimit; Z++, oldZ++)
{
if (Z < -mapDistance) // Repeats the map along the Z-Axis
{
Z += mapDistance << 1;
zLimit += mapDistance << 1;
}
else if (Z > mapDistance)
{
Z -= mapDistance << 1;
zLimit -= mapDistance << 1;
}
for (; X < xLimit; X++, oldX++, j++)
{
if (X < -mapDistance) // Repeats the map along the X-Axis
{
X += mapDistance << 1;
xLimit += mapDistance << 1;
}
else if (X > mapDistance)
{
X -= mapDistance << 1;
xLimit -= mapDistance << 1;
}
oldCalc = ((mapDistance << 1) * (oldZ + mapDistance)) + (oldX + mapDistance); // Calculate the position of the cube in the array before movement
calc = ((mapDistance << 1) * (Z + mapDistance)) + (X + mapDistance); // Calculate the position of the cube in the array
cubeModel[j]->SetY((cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4));
if (cube[calc].biome != cube[oldCalc].biome && !heightMap)
{ // Set the cubes biome skin
skin:
switch (cube[calc].biome)
{
case 1:
cubeModel[j]->SetSkin("darkGrass.png");
break;
case 2:
cubeModel[j]->SetSkin("grass.png");
break;
case 3:
cubeModel[j]->SetSkin("snow.png");
break;
}
}
else if (cube[calc].yTier != cube[oldCalc].yTier && heightMap)
{ // Set the cubes height skin
hSkin:
switch (cube[calc].yTier)
{
case 0:
cubeModel[j]->SetSkin("HeightMap_0.png");
break;
case 1:
cubeModel[j]->SetSkin("HeightMap_1.png");
break;
case 2:
cubeModel[j]->SetSkin("HeightMap_2.png");
break;
case 3:
cubeModel[j]->SetSkin("HeightMap_3.png");
break;
case 4:
cubeModel[j]->SetSkin("HeightMap_4.png");
break;
}
}
}
oldX -= renderDistance << 1;
X -= renderDistance << 1;
}
switch (direction)
{ // Move the cubes based on where the player moved
case 5:
return;
case 0: // Left
for (int i = 0; i != cubeModel.size(); i++)
cubeModel[i]->MoveLocalX(-halfCubeSize);
break;
case 1: // Down
for (int i = 0; i != cubeModel.size(); i++)
cubeModel[i]->MoveLocalZ(-halfCubeSize);
break;
case 2: // Right
for (int i = 0; i != cubeModel.size(); i++)
cubeModel[i]->MoveLocalX(halfCubeSize);
break;
case 3: // Up
for (int i = 0; i != cubeModel.size(); i++)
cubeModel[i]->MoveLocalZ(halfCubeSize);
break;
}
}
void PrepareResize(IMesh* &cubeMesh, vector<IModel*> &cubeModel, IModel* &cubeModelNode, const int &mapDistance, const int &renderDistance, const int &zModifier, const int &xModifier)
{
int Z = zModifier - renderDistance; //All visible blocks behind your current spot on the Z-axis vector to grid conversion
int X = xModifier - renderDistance; //All visible blocks behind your current spot on the X-axis vector to grid conversion
int zLimit = Z + (renderDistance << 1); //10 blocks ahead of your current spot on the Z-axis
int xLimit = X + (renderDistance << 1); //10 blocks ahead of your current spot on the X-axis
int j = 0;
int calc;
for (; Z < zLimit; Z++)
{
if (Z < -mapDistance) // Repeats the map along the Z-Axis
{
Z += mapDistance << 1;
zLimit += mapDistance << 1;
}
else if (Z > mapDistance)
{
Z -= mapDistance << 1;
zLimit -= mapDistance << 1;
}
for (; X < xLimit; X++, j++)
{
if (X < -mapDistance) // Repeats the map along the X-Axis
{
X += mapDistance << 1;
xLimit += mapDistance << 1;
}
else if (X > mapDistance)
{
X -= mapDistance << 1;
xLimit -= mapDistance << 1;
}
calc = ((mapDistance << 1) * (Z + mapDistance)) + (X + mapDistance); // Calculate the position of the cube in the array
if (j == cubeModel.size())
{
cubeModelNode = cubeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
cubeModel.push_back(cubeModelNode);
}
else
cubeModel[j]->SetPosition((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
}
X -= (renderDistance << 1);
}
while (j < cubeModel.size())
{
cubeMesh->RemoveModel(cubeModel.back());
cubeModel.pop_back();
}
}
void TextureSwap(vector<IModel*> &cubeModel,
const int &mapDistance, //Needed so convert the negative values to 0 so we know where the player is
const int &renderDistance, //So the algorithm knows where to start looking
const int &zModifier, //How far along the Z-Axis is the player currently
const int &xModifier, //How far along the X-Axis is the player currently
const bool &heightMap //Used to check what kind of texture mode the cube is on
)
{
int Z = zModifier - renderDistance; //10 blocks behind your current spot on the Z-axis
int X = xModifier - renderDistance; //10 blocks behind your current spot on the X-axis
int zLimit = Z + (renderDistance << 1); //10 blocks ahead of your current spot on the Z-axis
int xLimit = X + (renderDistance << 1); //10 blocks ahead of your current spot on the X-axis
int j = 0;
int calc;
for (; Z < zLimit; Z++)
{ //Spawning along the Z axis
if (Z < -mapDistance)
{
Z += mapDistance << 1;
zLimit += mapDistance << 1;
}
else if (Z > mapDistance)
{
Z -= mapDistance << 1;
zLimit -= mapDistance << 1;
}
for (; X < xLimit; X++, j++)
{ //Spawning along the X axis
if (X < -mapDistance)
{
X += mapDistance << 1;
xLimit += mapDistance << 1;
}
else if (X > mapDistance)
{
X -= mapDistance << 1;
xLimit -= mapDistance << 1;
}
calc = ((mapDistance << 1) * (Z + mapDistance)) + (X + mapDistance);
if (!heightMap)
{ // Set the cubes biome skin
switch (cube[calc].biome)
{
case 1:
cubeModel[j]->SetSkin("darkGrass.png");
break;
case 2:
cubeModel[j]->SetSkin("grass.png");
break;
case 3:
cubeModel[j]->SetSkin("snow.png");
break;
}
}
else
{ // Set the cubes height skin
switch (cube[calc].yTier)
{
case 0:
cubeModel[j]->SetSkin("HeightMap_0.png");
break;
case 1:
cubeModel[j]->SetSkin("HeightMap_1.png");
break;
case 2:
cubeModel[j]->SetSkin("HeightMap_2.png");
break;
case 3:
cubeModel[j]->SetSkin("HeightMap_3.png");
break;
case 4:
cubeModel[j]->SetSkin("HeightMap_4.png");
break;
}
}
}
X -= (renderDistance << 1);
}
}
void TreeSpawn(IMesh* &treeMesh, IMesh* &darkTreeMesh, IMesh* &snowTreeMesh, vector<IModel*> &treeModel, vector<IModel*> &darkTreeModel, vector<IModel*> &snowTreeModel, IModel* &treeModelNode,
IMesh* &grassMesh, vector<IModel*> &grassModel,
const int &mapDistance, //Needed so convert the negative values to 0 so we know where the player is
const int &renderDistance, //So the algorithm knows where to start looking
const int &zModifier, //How far along the Z-Axis is the player currently
const int &xModifier, //How far along the X-Axis is the player currently
const int &density //How many trees are spawning
)
{
int Z = zModifier - renderDistance; //10 blocks behind your current spot on the Z-axis
int X = xModifier - renderDistance; //10 blocks behind your current spot on the X-axis
int zLimit = Z + (renderDistance << 1); //10 blocks ahead of your current spot on the Z-axis
int xLimit = X + (renderDistance << 1); //10 blocks ahead of your current spot on the X-axis
int calc;
int i = 0;
int j = 0;
int l = 0;
int g = 0;
for (; Z < zLimit; Z++)
{ //Spawning along the Z axis
if (Z < -mapDistance)
{
Z += mapDistance << 1;
zLimit += mapDistance << 1;
}
else if (Z > mapDistance)
{
Z -= mapDistance << 1;
zLimit -= mapDistance << 1;
}
for (; X < xLimit; X++)
{ //Spawning along the X axis
if (X < -mapDistance)
{
X += mapDistance << 1;
xLimit += mapDistance << 1;
}
else if (X > mapDistance)
{
X -= mapDistance << 1;
xLimit -= mapDistance << 1;
}
calc = ((mapDistance << 1) * (Z + mapDistance)) + (X + mapDistance);
if (cube[calc].tree == 1 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{ // Forest tree
if (i == darkTreeModel.size())
{ // If there aren't enough trees on the map, it adds to them
treeModelNode = darkTreeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
darkTreeModel.push_back(treeModelNode);
}
else
darkTreeModel[i]->SetPosition((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
i++;
}
else if (cube[calc].tree == 2 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{ // Normal tree
if (j == treeModel.size())
{ // If there aren't enough trees on the map, it adds to them
treeModelNode = treeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
treeModel.push_back(treeModelNode);
}
else
treeModel[j]->SetPosition((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
j++;
}
else if (cube[calc].tree == 3 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{ // Snowy tree
if (l == snowTreeModel.size())
{ // If there aren't enough trees on the map, it adds to them
treeModelNode = snowTreeMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
snowTreeModel.push_back(treeModelNode);
}
else
snowTreeModel[l]->SetPosition((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
l++;
}
else if (cube[calc].grass == 1 && (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4) > -100)
{ // Tall grass
if (g == grassModel.size())
{ // If there isn't enough tall grass on the map, it adds to it
treeModelNode = grassMesh->CreateModel((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
grassModel.push_back(treeModelNode);
}
else
grassModel[g]->SetPosition((float)cube[calc].xBlock * 10, (cube[calc].yPos - (powf(CPerlin.GetOctaves(), 2) / 2)) - (CPerlin.GetBias() * 4), (float)cube[calc].zBlock * 10);
g++;
}
}
X -= (renderDistance << 1);
}
while (i < darkTreeModel.size())
{ // Shortening the tree array to compensate
darkTreeMesh->RemoveModel(darkTreeModel.back());
darkTreeModel.pop_back();
}
while (j < treeModel.size())
{
treeMesh->RemoveModel(treeModel.back());
treeModel.pop_back();
}
while (l < snowTreeModel.size())
{
snowTreeMesh->RemoveModel(snowTreeModel.back());
snowTreeModel.pop_back();
}
while (g < grassModel.size())
{
grassMesh->RemoveModel(grassModel.back());
grassModel.pop_back();
}
}
void Decelerate(const float &acceleration, float &cubeSpeed, const float &fTime)
{ // Slows the cube down
if (cubeSpeed > acceleration * fTime) //Anti-forward
cubeSpeed -= acceleration * fTime;
else if (cubeSpeed < -acceleration * fTime) //Anti-backward
cubeSpeed += acceleration * fTime;
else
cubeSpeed = 0.0f;
}
void FnButtonSwap(I3DEngine* &myEngine, ClButton* &button, ISprite* &sprite, bool &sprActive, const string &fileName, const float &xPos, const float &yPos)
{ // Changing the button from normal to down and back
if (button->FnButtonState())
if (sprActive)
{
myEngine->RemoveSprite(sprite);
sprite = myEngine->CreateSprite(fileName + " down.png", xPos, yPos);
sprActive = false;
}
if (!button->FnButtonState())
if (!sprActive)
{
myEngine->RemoveSprite(sprite);
sprite = myEngine->CreateSprite(fileName + ".png", xPos, yPos);
sprActive = true;
}
}
|
54c825cc148dae8ea1bf93542cf4b13a00b26d48
|
17dbc935e49b34de14486cab23938cb68bf814d8
|
/chapitre-22/exemple-lseek.c
|
1c684102adfaf09c52f396d1058040a80167dbbf
|
[] |
no_license
|
eavf/Developpement-systeme-sous-Linux
|
638a44207ec61081674b66ae6c54bfa1d9eab9b9
|
d338e65b6f061cb609ec175d61c6958158e7b7e2
|
refs/heads/master
| 2022-02-26T22:46:59.047522 | 2019-10-25T11:16:12 | 2019-10-25T11:16:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 1,599 |
c
|
exemple-lseek.c
|
// ------------------------------------------------------------------
// exemple-lseek.c
// Fichier d'exemple du livre "Developpement Systeme sous Linux"
// (C) 2000-2019 - Christophe BLAESS <[email protected]>
// https://www.blaess.fr/christophe/
// ------------------------------------------------------------------
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
int main (void)
{
int fd;
pid_t child_pid;
off_t position;
fd = open("essai.lseek", O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
perror("open");
exit(EXIT_FAILURE);
}
// On ecrit quelques octets
if (write(fd, "ABCDEFGHIJ", 10) != 10) {
perror("write");
exit(EXIT_FAILURE);
}
// Puis on separe les processus
if ((child_pid = fork()) < 0) {
perror("fork");
exit(EXIT_FAILURE);
}
if (child_pid != 0) {
// Processus parent
position = lseek(fd, 0, SEEK_CUR);
fprintf(stderr, "Parent : position = %ld\n", position);
sleep(1);
position = lseek(fd, 0, SEEK_CUR);
fprintf(stderr, "Parent : position = %ld\n", position);
lseek(fd, 5, SEEK_SET);
fprintf(stderr, "Parent : deplacement en position 5\n");
waitpid(child_pid, NULL, 0);
} else {
// Processus enfant
position = lseek(fd, 0, SEEK_CUR);
fprintf(stderr, "Enfant : position = %ld\n", position);
lseek(fd, 2, SEEK_SET);
fprintf(stderr, "Enfant : deplacement en position 2\n");
sleep(2);
position = lseek(fd, 0, SEEK_CUR);
fprintf(stderr, "Enfant : position = %ld\n", position);
}
close(fd);
return EXIT_SUCCESS;
}
|
56f778516e1969f92af3c537bae93dc8b2b70b0a
|
32c3099075a9cb4213dc78b73998f1b9ee145b4f
|
/ls00/aff_first_param.c
|
0ba3ca2c81e917af338a8f8664a00768cde73812
|
[] |
no_license
|
clbcabral/42c
|
efe73cd3df2576a2c0bb992af224cbb161fbbaa5
|
ca03c292bbd479203e3f1e330c6f03158f787d29
|
refs/heads/master
| 2021-05-21T06:48:16.787594 | 2020-04-20T21:45:26 | 2020-04-20T21:45:26 | 252,590,077 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 176 |
c
|
aff_first_param.c
|
#include <unistd.h>
int main(int argc, char *args[]) {
if (argc >= 2) {
int s = 0;
while (args[1][s]) s += 1;
write(1, args[1], s);
}
write(1, "\n", 1);
return 0;
}
|
86073ffb55b3860b77d9939695bce85f73bda76a
|
54187cabfedb24f9015e8712e7250257b58adace
|
/apps/sensorsunleashed/pairing.h
|
709ec6346ad45d5f1924140850b2c1aacb117d70
|
[
"BSD-3-Clause"
] |
permissive
|
SensorsUnleashed/Link
|
9a1967a0b4480e8a5f26d68e718dea259c6168a3
|
c0d98520ceeca3b1453b4e7493c7922b2827df83
|
refs/heads/master
| 2020-03-06T14:44:47.215709 | 2018-09-04T09:12:51 | 2018-09-04T09:12:51 | 126,941,250 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 3,826 |
h
|
pairing.h
|
/*******************************************************************************
* Copyright (c) 2018, Ole Nissen.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This file is part of the Sensors Unleashed project
*******************************************************************************/
#ifndef SENSORSUNLEASHED_PAIRING_H_
#define SENSORSUNLEASHED_PAIRING_H_
#include "contiki.h"
#include "mmem.h"
#include "net/ipv6/uiplib.h"
#include "lib/list.h"
#include "susensors.h"
//We need to have a way to keep track of which sensor a notification belongs to
enum datatype_e{
uartsensor,
susensor
};
struct __attribute__ ((__packed__)) joinpair_s{
struct joinpair_s *next; /* for LIST, points to next resource defined */
uint8_t id; //Used for identifying the pair in case of changes or deletion
uint8_t priority; //Highest priority (1) will have messages sent before lower priority ones
uint8_t localhost; //If this pair local only
char* dsturlAbove;
char* dsturlBelow;
char* dsturlChange;
struct mmem dsturl;
int8_t triggers[3]; //Which action is set to be triggered
int8_t triggerindex; //Used when we setup the pairs connection initially
eventhandler_ptr aboveEventhandler;
eventhandler_ptr belowEventhandler;
eventhandler_ptr changeEventhandler;
void* deviceptr; //Which device this pair belong to
void* localdeviceptr; //In case its a local pair, this is the device pointer
uip_ip6addr_t destip;
char nodediscuri[25];
};
typedef struct joinpair_s joinpair_t;
void pairing_init();
void pair_register_add_callback(void(*cb)(joinpair_t*));
void pair_register_rem_callback(void(*cb)(joinpair_t*));
int8_t parseMessage(joinpair_t* pair);
list_t pairing_get_pairs(void);
//joinpair_t* getUartSensorPair(uartsensors_device_t* p);
//void activateUartSensorPairing(uartsensors_device_t* p);
void activateSUSensorPairing(susensors_sensor_t* p);
uint8_t pairing_assembleMessage(const uint8_t* data, uint32_t len, uint32_t num);
int16_t pairing_getlist(susensors_sensor_t* s, uint8_t* buffer, uint16_t len, int32_t *offset);
uint8_t pairing_remove_all(susensors_sensor_t* s);
uint8_t pairing_remove(susensors_sensor_t* s, uint32_t len, uint8_t* indexbuffer);
int8_t pairing_handle(susensors_sensor_t* s);
int store_SensorPair(susensors_sensor_t* s, uint8_t* data, uint32_t len);
void restore_SensorPairs(susensors_sensor_t* s);
#endif /* SENSORSUNLEASHED_PAIRING_H_ */
|
cb5cc10fb7b565855320a5b1afa71f9cc6789027
|
e659eb25ae5f0a6e96fdf7dff57e772c2196741a
|
/sys/stand/efiboot/exec.c
|
2e773c09a04c442f045f7a5845c6377d2d16aa91
|
[] |
no_license
|
SauravPrakash98/netbsd-src
|
8403be2fc228d71e342e439cd60c555367598ae1
|
3cbd2ca4d5108c038b89356d784a86b03fd71532
|
refs/heads/master
| 2020-05-26T12:27:54.646339 | 2019-11-28T01:08:06 | 2019-11-28T01:08:06 | 188,210,806 | 3 | 0 | null | 2019-05-23T10:16:26 | 2019-05-23T10:16:25 | null |
UTF-8
|
C
| false | false | 9,356 |
c
|
exec.c
|
/* $NetBSD: exec.c,v 1.11 2019/07/24 11:40:36 jmcneill Exp $ */
/*-
* Copyright (c) 2019 Jason R. Thorpe
* Copyright (c) 2018 Jared McNeill <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "efiboot.h"
#include "efienv.h"
#include "efifdt.h"
#include "efiacpi.h"
#include <sys/reboot.h>
u_long load_offset = 0;
#define FDT_SPACE (4 * 1024 * 1024)
#define FDT_ALIGN ((2 * 1024 * 1024) - 1)
static EFI_PHYSICAL_ADDRESS initrd_addr, dtb_addr;
static u_long initrd_size = 0, dtb_size = 0;
static int
load_file(const char *path, u_long extra, bool quiet_errors,
EFI_PHYSICAL_ADDRESS *paddr, u_long *psize)
{
EFI_STATUS status;
struct stat st;
ssize_t len;
ssize_t expectedlen;
int fd;
if (strlen(path) == 0)
return 0;
fd = open(path, 0);
if (fd < 0) {
if (!quiet_errors) {
printf("boot: failed to open %s: %s\n", path,
strerror(errno));
}
return errno;
}
if (fstat(fd, &st) < 0) {
printf("boot: failed to fstat %s: %s\n", path, strerror(errno));
close(fd);
return errno;
}
if (st.st_size == 0) {
if (!quiet_errors) {
printf("boot: empty file %s\n", path);
}
close(fd);
return EINVAL;
}
expectedlen = st.st_size;
*psize = st.st_size + extra;
#ifdef EFIBOOT_ALLOCATE_MAX_ADDRESS
*paddr = EFIBOOT_ALLOCATE_MAX_ADDRESS;
status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress, EfiLoaderData,
EFI_SIZE_TO_PAGES(*psize), paddr);
#else
*paddr = 0;
status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData,
EFI_SIZE_TO_PAGES(*psize), paddr);
#endif
if (EFI_ERROR(status)) {
printf("Failed to allocate %lu bytes for %s (error %lu)\n",
*psize, path, (u_long)status);
close(fd);
*paddr = 0;
return ENOMEM;
}
printf("boot: loading %s ", path);
len = read(fd, (void *)(uintptr_t)*paddr, expectedlen);
close(fd);
if (len != expectedlen) {
if (len < 0) {
printf(": %s\n", strerror(errno));
} else {
printf(": returned %ld (expected %ld)\n", len,
expectedlen);
}
return EIO;
}
printf("done.\n");
efi_dcache_flush(*paddr, *psize);
return 0;
}
static const char default_efibootplist_path[] = "/etc/efiboot.plist";
/* This is here because load_file() is here. */
void
load_efibootplist(bool default_fallback)
{
EFI_PHYSICAL_ADDRESS plist_addr = 0;
u_long plist_size = 0;
prop_dictionary_t plist = NULL, oplist = NULL;
bool load_quietly = false;
const char *path = get_efibootplist_path();
if (path == NULL || strlen(path) == 0) {
if (!default_fallback)
return;
path = default_efibootplist_path;
load_quietly = true;
}
/*
* Fudge the size so we can ensure the resulting buffer
* is NUL-terminated for convenience.
*/
if (load_file(path, 1, load_quietly, &plist_addr, &plist_size) != 0 ||
plist_addr == 0) {
/* Error messages have already been displayed. */
goto out;
}
char *plist_buf = (char *)((uintptr_t)plist_addr);
plist_buf[plist_size - 1] = '\0';
plist = prop_dictionary_internalize(plist_buf);
if (plist == NULL) {
printf("boot: unable to parse plist '%s'\n", path);
goto out;
}
out:
oplist = efibootplist;
/*
* If we had a failure, create an empty one for
* convenience. But a failure should not clobber
* an in-memory plist we already have.
*/
if (plist == NULL &&
(oplist == NULL || prop_dictionary_count(oplist) == 0))
plist = prop_dictionary_create();
#ifdef EFIBOOT_DEBUG
printf(">> load_efibootplist: oplist = 0x%lx, plist = 0x%lx\n",
(u_long)oplist, (u_long)plist);
#endif
if (plist_addr) {
uefi_call_wrapper(BS->FreePages, 2, plist_addr,
EFI_SIZE_TO_PAGES(plist_size));
}
if (plist) {
efibootplist = plist;
efi_env_from_efibootplist();
if (oplist)
prop_object_release(oplist);
}
}
static void
apply_overlay(void *dtbo)
{
if (!efi_fdt_overlay_is_compatible(dtbo)) {
printf("boot: incompatible overlay\n");
}
int fdterr;
if (efi_fdt_overlay_apply(dtbo, &fdterr) != 0) {
printf("boot: error %d applying overlay\n", fdterr);
}
}
static void
apply_overlay_file(const char *path)
{
EFI_PHYSICAL_ADDRESS dtbo_addr;
u_long dtbo_size;
if (strlen(path) == 0)
return;
if (load_file(path, 0, false, &dtbo_addr, &dtbo_size) != 0 ||
dtbo_addr == 0) {
/* Error messages have already been displayed. */
goto out;
}
apply_overlay((void *)(uintptr_t)dtbo_addr);
out:
if (dtbo_addr) {
uefi_call_wrapper(BS->FreePages, 2, dtbo_addr,
EFI_SIZE_TO_PAGES(dtbo_size));
}
}
#define DT_OVERLAYS_PROP "device-tree-overlays"
static void
load_fdt_overlays(void)
{
/*
* We support loading device tree overlays specified in efiboot.plist
* using the following schema:
*
* <key>device-tree-overlays</key>
* <array>
* <string>/path/to/some/overlay.dtbo</string>
* <string>hd0e:/some/other/overlay.dtbo</string>
* </array>
*
* The overlays are loaded in array order.
*/
prop_array_t overlays = prop_dictionary_get(efibootplist,
DT_OVERLAYS_PROP);
if (overlays == NULL) {
#ifdef EFIBOOT_DEBUG
printf("boot: no device-tree-overlays\n");
#endif
return;
}
if (prop_object_type(overlays) != PROP_TYPE_ARRAY) {
printf("boot: invalid %s\n", DT_OVERLAYS_PROP);
return;
}
prop_object_iterator_t iter = prop_array_iterator(overlays);
prop_string_t pathobj;
while ((pathobj = prop_object_iterator_next(iter)) != NULL) {
if (prop_object_type(pathobj) != PROP_TYPE_STRING) {
printf("boot: invalid %s entry\n", DT_OVERLAYS_PROP);
continue;
}
apply_overlay_file(prop_string_cstring_nocopy(pathobj));
}
prop_object_iterator_release(iter);
}
int
exec_netbsd(const char *fname, const char *args)
{
EFI_PHYSICAL_ADDRESS addr;
u_long marks[MARK_MAX], alloc_size;
EFI_STATUS status;
int fd, ohowto;
load_file(get_initrd_path(), 0, false, &initrd_addr, &initrd_size);
load_file(get_dtb_path(), 0, false, &dtb_addr, &dtb_size);
memset(marks, 0, sizeof(marks));
ohowto = howto;
howto |= AB_SILENT;
fd = loadfile(fname, marks, COUNT_KERNEL | LOAD_NOTE);
howto = ohowto;
if (fd < 0) {
printf("boot: %s: %s\n", fname, strerror(errno));
return EIO;
}
close(fd);
marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) & (-sizeof(int));
alloc_size = marks[MARK_END] - marks[MARK_START] + FDT_SPACE + EFIBOOT_ALIGN;
#ifdef EFIBOOT_ALLOCATE_MAX_ADDRESS
addr = EFIBOOT_ALLOCATE_MAX_ADDRESS;
status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress, EfiLoaderData,
EFI_SIZE_TO_PAGES(alloc_size), &addr);
#else
addr = 0;
status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData,
EFI_SIZE_TO_PAGES(alloc_size), &addr);
#endif
if (EFI_ERROR(status)) {
printf("Failed to allocate %lu bytes for kernel image (error %lu)\n",
alloc_size, (u_long)status);
return ENOMEM;
}
memset(marks, 0, sizeof(marks));
load_offset = (addr + EFIBOOT_ALIGN) & ~(EFIBOOT_ALIGN - 1);
fd = loadfile(fname, marks, LOAD_KERNEL);
if (fd < 0) {
printf("boot: %s: %s\n", fname, strerror(errno));
goto cleanup;
}
close(fd);
load_offset = 0;
#ifdef EFIBOOT_ACPI
if (efi_acpi_available()) {
efi_acpi_create_fdt();
} else
#endif
if (dtb_addr && efi_fdt_set_data((void *)(uintptr_t)dtb_addr) != 0) {
printf("boot: invalid DTB data\n");
goto cleanup;
}
if (efi_fdt_size() > 0) {
efi_fdt_init((marks[MARK_END] + FDT_ALIGN) & ~FDT_ALIGN, FDT_ALIGN + 1);
load_fdt_overlays();
efi_fdt_initrd(initrd_addr, initrd_size);
efi_fdt_bootargs(args);
#ifdef EFIBOOT_ACPI
if (efi_acpi_available())
efi_fdt_gop();
#endif
efi_fdt_memory_map();
}
efi_cleanup();
if (efi_fdt_size() > 0) {
efi_fdt_fini();
}
efi_boot_kernel(marks);
/* This should not happen.. */
printf("boot returned\n");
cleanup:
uefi_call_wrapper(BS->FreePages, 2, addr, EFI_SIZE_TO_PAGES(alloc_size));
if (initrd_addr) {
uefi_call_wrapper(BS->FreePages, 2, initrd_addr, EFI_SIZE_TO_PAGES(initrd_size));
initrd_addr = 0;
initrd_size = 0;
}
if (dtb_addr) {
uefi_call_wrapper(BS->FreePages, 2, dtb_addr, EFI_SIZE_TO_PAGES(dtb_size));
dtb_addr = 0;
dtb_size = 0;
}
return EIO;
}
|
e72a1619e07d1d8f17288738f8efb2d285236cdd
|
1fabbdfd1ca9ea1b6808893e12bd907eb74de414
|
/xcode/Classes/Native/UnityEngine_UnityEngine_Events_CachedInvokableCall_1_gen_873.h
|
1b9f3f395199bab85e4c7370a77bc0eae97a74de
|
[] |
no_license
|
Klanly/TutorialPackageClient
|
6f889e96c40ab13c97d107708ae8f3c71a484301
|
b9d61ba2f287c491c9565b432f852980ec3fee28
|
refs/heads/master
| 2020-12-03T01:42:35.256114 | 2016-11-01T02:40:21 | 2016-11-01T02:40:21 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 477 |
h
|
UnityEngine_UnityEngine_Events_CachedInvokableCall_1_gen_873.h
|
#pragma once
#include <stdint.h>
// System.Object[]
struct ObjectU5BU5D_t142;
// UnityEngine.Events.InvokableCall`1<UnityEngine.GUIElement>
#include "UnityEngine_UnityEngine_Events_InvokableCall_1_gen_876.h"
// UnityEngine.Events.CachedInvokableCall`1<UnityEngine.GUIElement>
struct CachedInvokableCall_1_t24508 : public InvokableCall_1_t24509
{
// System.Object[] UnityEngine.Events.CachedInvokableCall`1<UnityEngine.GUIElement>::m_Arg1
ObjectU5BU5D_t142* ___m_Arg1;
};
|
548ce07a959a06043d08156cbf83d6d8e8c883d0
|
f9e7d65cb784c01a0200145ba8d289afe41d4a56
|
/chip/npcx/adc_chip.h
|
9c2de3000dbf93d87ab7794fa034bf8ec410e080
|
[
"BSD-3-Clause"
] |
permissive
|
FrameworkComputer/EmbeddedController
|
ad7086769e87d0a4179eae96a7c9ff5e383ff54e
|
f6d6b927eed71550d3475411cfc3e59abe5cef2a
|
refs/heads/hx20-hx30
| 2023-08-08T20:45:10.621169 | 2023-05-26T07:03:59 | 2023-05-26T07:03:59 | 447,021,040 | 846 | 48 |
BSD-3-Clause
| 2023-05-26T07:04:59 | 2022-01-12T00:11:14 |
C
|
UTF-8
|
C
| false | false | 3,106 |
h
|
adc_chip.h
|
/* Copyright 2014 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.
*/
/* NPCX-specific ADC module for Chrome EC */
#ifndef __CROS_EC_ADC_CHIP_H
#define __CROS_EC_ADC_CHIP_H
#include "adc.h"
/* Minimum and maximum values returned by raw ADC read. */
#define ADC_READ_MIN 0
#define ADC_READ_MAX 1023
#define ADC_MAX_VOLT 2816
/* ADC input channel select */
enum npcx_adc_input_channel {
NPCX_ADC_CH0 = 0,
NPCX_ADC_CH1,
NPCX_ADC_CH2,
NPCX_ADC_CH3,
NPCX_ADC_CH4,
#if NPCX_FAMILY_VERSION >= NPCX_FAMILY_NPCX7
NPCX_ADC_CH5,
NPCX_ADC_CH6,
NPCX_ADC_CH7,
NPCX_ADC_CH8,
NPCX_ADC_CH9,
#endif
#if NPCX_FAMILY_VERSION >= NPCX_FAMILY_NPCX9
NPCX_ADC_CH10,
NPCX_ADC_CH11,
#endif
NPCX_ADC_CH_COUNT
};
/* Data structure to define ADC channels. */
struct adc_t {
const char *name;
enum npcx_adc_input_channel input_ch;
int factor_mul;
int factor_div;
int shift;
};
/*
* Boards must provide this list of ADC channel definitions. This must match
* the enum adc_channel list provided by the board.
*/
extern const struct adc_t adc_channels[];
/*
* Boards may configure a ADC channel for use with thershold interrupts.
* The threshold levels may be set from 0 to ADC_MAX_VOLT inclusive.
*/
struct npcx_adc_thresh_t {
/* The ADC channel to monitor to generate threshold interrupts. */
enum adc_channel adc_ch;
/* Called when the interrupt fires */
void (*adc_thresh_cb)(void);
/* If set, threshold event is asserted when <= threshold level */
int lower_or_higher;
/* Desired threshold level in mV to assert. */
int thresh_assert;
};
/**
* Boards should call this function to register their threshold interrupt with
* one of the threshold detectors. 'threshold_idx' is 1-based.
*
* @param threshold_idx - 1-based threshold detector index
* @param thresh_cfg - Pointer to ADC threshold interrupt configuration
*/
void npcx_adc_register_thresh_irq(int threshold_idx,
const struct npcx_adc_thresh_t *thresh_cfg);
/**
* Configure an ADC channel for repetitive conversion.
*
* If you are using ADC threshold interrupts and the need is timing critical,
* you will want to enable this on the ADC channels you have configured for
* threshold interrupts.
*
* NOTE: Enabling this will prevent the EC from entering deep sleep and will
* increase power consumption!
*
* @param input_ch - The ADC channel you wish to configure
* @param enable - 1 to enable, 0 to disable
*/
void npcx_set_adc_repetitive(enum npcx_adc_input_channel input_ch, int enable);
/**
* Enable/Disable ADC threshold detector interrupt.
*
* @param threshold_idx - 1-based threshold detector index
* @param enable - 1 to enable, 0 to disable
*/
void npcx_adc_thresh_int_enable(int threshold_idx, int enable);
/**
* Return the ADC value from CHNDAT register directly when the channel is
* configured in the repetitive mode.
*
* @param input_ch channel number
* @return ADC data
*/
int adc_read_data(enum npcx_adc_input_channel input_ch);
#endif /* __CROS_EC_ADC_CHIP_H */
|
a8bef378cf756b44d9d70f2453a36b791c1261b1
|
8ba117c227676f800d75a0610a22182b644dd1b7
|
/Common/Sockets.h
|
1e1a53e2e6976cf2772c4bd61c6db91c21833bca
|
[] |
no_license
|
shiranmazor/PA1
|
e4e9436c109563a375a6fb0664f6f251a0f8495d
|
364a85e133f0fd44235b3e730fac7164f5ff7f36
|
refs/heads/master
| 2021-01-10T03:50:42.109368 | 2016-03-22T19:53:46 | 2016-03-22T19:53:46 | 53,590,713 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 762 |
h
|
Sockets.h
|
#ifndef _SOCKETS_H_
#define _SOCKETS_H_
#include <winsock2.h>
#include <Windows.h>
#include "Common.h"
#define MAX_CLIENTS 1
// Defines a pointer to a function used to search for free slots on the server
// to accept new clients
typedef struct
{
SOCKET clientSocket;
SOCKADDR_IN clientInfo;
} ClientSocketArgs;
Result Receive(SOCKET sd, char* OutBuffer, int BytedLeft, int* byteReceived);
Result Send(SOCKET sd, char* Buffer, int bytesLen);
//convert string address to IN_ADDR address
Ip getIpAddress(const char* ipStr);
bool InitWinSock();
int InitClientSocket(SOCKET* socket_c, Ip remoteIp, Port remotePort);
int InitServerSocket(SOCKET* mainSocket, Ip listeningAddress, Port listeningPort);
bool CleanupServerSocket(SOCKET socketToClose);
#endif
|
47392eaa1b0a7dc5cf67aeb900612ae6958b1656
|
26d3688d1839717de6edec3aa6fa60fb1fe3483d
|
/external/boost_1_60_0/qsboost/predef/make.h
|
8e18b2b9f516a02142e0223c94ae3c96061fc3d2
|
[
"MIT"
] |
permissive
|
wouterboomsma/quickstep
|
7d91c8070dca9f0d1d5ac30a38a9e159224a5e13
|
a33447562eca1350c626883f21c68125bd9f776c
|
refs/heads/master
| 2021-01-22T19:25:45.689105 | 2017-04-19T09:25:23 | 2017-04-19T09:25:23 | 88,726,115 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 4,669 |
h
|
make.h
|
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#include <qsboost/predef/detail/test.h>
#ifndef QSBOOST_PREDEF_MAKE_H
#define QSBOOST_PREDEF_MAKE_H
/*
Shorthands for the common version number formats used by vendors...
*/
/*`
[heading `BOOST_PREDEF_MAKE_..` macros]
These set of macros decompose common vendor version number
macros which are composed version, revision, and patch digits.
The naming convention indicates:
* The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for
hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits.
* The format of the vendor version number. Where "`V`" indicates the version digits,
"`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`"
indicates an ignored digit.
Macros are:
*/
/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VRP(V) QSBOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF))
/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VVRP(V) QSBOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF))
/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VRPP(V) QSBOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF))
/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VVRR(V) QSBOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0)
/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VRRPPPP(V) QSBOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF))
/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VVRRP(V) QSBOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF))
/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VRRPP000(V) QSBOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12)
/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */
#define QSBOOST_PREDEF_MAKE_0X_VVRRPP(V) QSBOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VPPP(V) QSBOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRP(V) QSBOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRP000(V) QSBOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRPP(V) QSBOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRR(V) QSBOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0)
/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRRPP(V) QSBOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100)
/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */
#define QSBOOST_PREDEF_MAKE_10_VRR000(V) QSBOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0)
/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */
#define QSBOOST_PREDEF_MAKE_10_VV00(V) QSBOOST_VERSION_NUMBER(((V)/100)%100,0,0)
/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */
#define QSBOOST_PREDEF_MAKE_10_VVRR(V) QSBOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VVRRPP(V) QSBOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */
#define QSBOOST_PREDEF_MAKE_10_VVRR0PP00(V) QSBOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */
#define QSBOOST_PREDEF_MAKE_10_VVRR0PPPP(V) QSBOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000)
/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */
#define QSBOOST_PREDEF_MAKE_10_VVRR00PP00(V) QSBOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100)
/*`
[heading `BOOST_PREDEF_MAKE_*..` date macros]
Date decomposition macros return a date in the relative to the 1970
Epoch date. If the month is not available, January 1st is used as the month and day.
If the day is not available, but the month is, the 1st of the month is used as the day.
*/
/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */
#define QSBOOST_PREDEF_MAKE_DATE(Y,M,D) QSBOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100)
/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */
#define QSBOOST_PREDEF_MAKE_YYYYMMDD(V) QSBOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100)
/*` `BOOST_PREDEF_MAKE_YYYY(V)` */
#define QSBOOST_PREDEF_MAKE_YYYY(V) QSBOOST_PREDEF_MAKE_DATE(V,1,1)
/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */
#define QSBOOST_PREDEF_MAKE_YYYYMM(V) QSBOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1)
#endif
|
0cebefe8a3af490e326e2d289f457a326af9c357
|
718506ad088a50df96cb0931547085b958c0d559
|
/Software/paperd.ink/config.h
|
277c334fadb27fde3b92a3dbd8b48c3d63dc9228
|
[
"MIT"
] |
permissive
|
smartboxchannel/paperdink
|
71af9e3cf526e02e17189b0786aa8185afedcbe9
|
bd835ce38753f13c67a452dec172a38f243fbd49
|
refs/heads/master
| 2023-06-11T23:23:21.904205 | 2021-07-11T15:36:12 | 2021-07-11T15:36:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,732 |
h
|
config.h
|
#ifndef CONFIG_H
#define CONFIG_H
#include <Adafruit_GFX.h>
#include <gfxfont.h>
#include "Gobold_Thin25pt7b.h"
#include "Gobold_Thin9pt7b.h"
#include "Gobold_Thin7pt7b.h"
// I2C pins
#define SDA 16
#define SCL 17
// SPI pins
// SD card pins
#define SD_CS 21
// E-paper pins
#define EPD_CS 22
#define EPD_DC 26
#define EPD_RST_DUM -1 // This is actually a dummy pin in this code, actually reset is controlled by the PCF8574
#define EPD_BUSY 35
// RGB pins
#define GREEN_LED_PIN 0
#define BLUE_LED_PIN 2
#define RED_LED_PIN 5
// LED Fade config
#define LEDC_CHANNEL_R 0
#define LEDC_CHANNEL_G 1
#define LEDC_CHANNEL_B 2
// use 13 bit precission for LEDC timer
#define LEDC_TIMER_13_BIT 13
// use 5000 Hz as a LEDC base frequency
#define LEDC_BASE_FREQ 5000
//extern int fade_amount;
// PCF8574 pins
#define EPD_EN P0
#define BATT_EN P1
#define SD_EN P2
#define EPD_RES P3
#define SD_CD P4 // input
#define EXT_GPIO1 P5
#define EXT_GPIO2 P6
#define EXT_GPIO3 P7
#define PCF_I2C_ADDR 0x20
// LiPo Charger
#define CHARGING_PIN 36
// Battry Voltage
#define BATTERY_VOLTAGE 34
// Fonts
#define LARGE_FONT &Gobold_Thin25pt7b
#define MED_FONT &Gobold_Thin9pt7b
#define SMALL_FONT &Gobold_Thin7pt7b
// Update interval
// Note: 0 should not be used!!
#define UPDATE_HOUR_INTERVAL 6 // update after every UPDATE_HOUR_INTERVAL hours, 0 should not be used
#define UPDATE_MIN_INTERVAL 60 // and at UPDATE_MIN mins, 0 should not be used
// for example to update afer every 6 hours, UPDATE_HOUR_INTERVAL = 6 and UPDATE_MIN = 60
// to update every 15 mins, UPDATE_HOUR_INTERVAL = 1 and UPDATE_MIN = 15
// todo list definitions
// memory allocated for getting json output from todoist
#define MAX_TODO_ITEMS 10
#define MAX_TODO_LENGTH 20
#define tasks_size MAX_TODO_ITEMS*500 // about 500 bytes per task
extern RTC_DATA_ATTR char todo_items[MAX_TODO_ITEMS][MAX_TODO_LENGTH];
extern uint16_t resp_pointer;
// memory to get the http response
extern char http_response[tasks_size]; // RGTODO: Make it dynamically allocated?
extern bool request_finished;
// weather definitions
#define weather_size 1000
extern RTC_DATA_ATTR char weather_icon[15];
// To keep track of config done
extern RTC_DATA_ATTR uint8_t config_done;
extern RTC_DATA_ATTR uint8_t first_boot;
extern uint8_t wifi_update;
extern String todoist_token_base;
extern String openweathermap_link_base;
extern RTC_DATA_ATTR char city_string[30];
extern RTC_DATA_ATTR char country_string[30];
extern RTC_DATA_ATTR char todoist_token_string[42];
extern RTC_DATA_ATTR char openweather_appkey_string[34];
extern RTC_DATA_ATTR char time_zone_string[7];
extern char buf[2048];
int8_t save_config(const char* config);
int8_t load_config();
#endif /* CONFIG_H */
|
0acdf7a51478e21da370b49fd945ea794b952aea
|
cac8e2899018858c6a2b654c9ae837359fa49752
|
/Fila e Pilha Modular/main.c
|
7a2c6848a5c78c9818af911292d6c9a8a9f2f5e2
|
[] |
no_license
|
antonio-abrantes/Estrutura_de_dados
|
e48d87bbb6d0dfce27ab5b31b455a0d35a77eb13
|
78f8183235a7bc546c96317970debf3943622de2
|
refs/heads/master
| 2021-06-12T14:26:16.815648 | 2016-12-23T18:05:09 | 2016-12-23T18:05:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 819 |
c
|
main.c
|
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include "teste.h"
int inicio, fim;
int main(){
zerar(filmes, 0);
int opcao = 0;
inicio = 0;
fim = 0;
while(opcao != 4){
system("cls");
menu();
scanf("%d", &opcao);
switch(opcao){
case 1:
printf("Digite a string: ");
adicionar(filmes);
break;
case 2:
retirarFila(filmes);
getch();
break;
case 3:
imprimir(filmes);
getch();
break;
case 4:
printf("Encerrando o sistema\n");
break;
default:
printf("Opcao invalida!\n");
getch();
break;
}
}
return 0;
}
|
99e7d4ba4d7864b9d82bd0b6c44a88fbb357d0ac
|
c138348131068362c4972d850e6689575e449550
|
/src/isr.c
|
e5e26fc3056fbfa9b7a6057c92731210390f9c7d
|
[] |
no_license
|
Zoreno/OS
|
e5d13fb4af666e194d156842b8e87453e3943e34
|
ba13f282a694b0d575aaa86480d9089869b51f80
|
refs/heads/master
| 2016-08-12T08:42:08.869311 | 2016-03-23T00:00:44 | 2016-03-23T00:00:44 | 53,627,040 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 736 |
c
|
isr.c
|
#include "isr.h"
#include "monitor.h"
#include "io-wrapper.h"
isr_t interrupt_handlers[256];
void isr_handler(registers_t regs)
{
if (interrupt_handlers[regs.int_no] != 0)
{
isr_t handler = interrupt_handlers[regs.int_no];
handler(regs);
}
else
{
monitor_write("unhandled interrupt: ");
monitor_write_dec(regs.int_no);
monitor_newline();
}
}
void irq_handler(registers_t regs)
{
if(regs.int_no >= 40)
{
outb_c(0xA0, 0x20);
}
outb_c(0x20, 0x20);
if(interrupt_handlers[regs.int_no] != 0)
{
isr_t handler = interrupt_handlers[regs.int_no];
handler(regs);
}
}
void register_interrupt_handler(unsigned char n, isr_t handler)
{
interrupt_handlers[n] = handler;
}
|
f3821ca6cd111e0d14695452cc84fc264533ab15
|
cc29dff78df13a9eaf75c6bfcc209576ba513715
|
/0x05-linked_list_palindrome/0-is_palindrome.c
|
cfd0fe8e6c7d19429a7b73cf2282cf5c59c3b0de
|
[] |
no_license
|
Miuywu/holbertonschool-interview
|
f5486db8af8ebd0d93ff66a87f5e259380a29b20
|
1e43acf1189c3c4a79e7dcdadbaa78855f42c63c
|
refs/heads/master
| 2023-01-13T07:33:45.778965 | 2020-11-05T07:23:42 | 2020-11-05T07:23:42 | 256,079,831 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 655 |
c
|
0-is_palindrome.c
|
#include <stdio.h>
#include <stdlib.h>
#include "lists.h"
/**
* is_palindrome - checks if listint_t is a palindrome
* @head: start of list
* Return: 0 if not palindrome, 1 if is palindrome
*/
int is_palindrome(listint_t **head)
{
listint_t *r;
int list_len, a, b, stop;
int *arr;
if (*head)
{
for (r = *head, list_len = 0; r; r = r->next)
list_len++;
arr = malloc(sizeof(int) * list_len);
for (a = 0, r = *head; a < list_len; a++, r = r->next)
arr[a] = r->n;
stop = list_len / 2;
for (a = 0, b = list_len - 1; a < stop; a++, b--)
if (arr[a] != arr[b])
{
free(arr);
return (0);
}
free(arr);
}
return (1);
}
|
a1edad413c604ec82228c0ec4701ac6e47419e06
|
4f9e6592373a8a9153682f643d1c99401ac00436
|
/physicsPerformance/simpleModel/efficiency/pidEfficiency.C
|
bbaf791f33a38bb2941ceee2a68985e47f9ba6a7
|
[] |
no_license
|
rbailhac/ALICE3-LoI-LMee
|
70017ab1d68cd8d5d4bf5c52e11114d97091ac14
|
5dc2343e7ec9cbf4f06e1efbb57b4890f62a7636
|
refs/heads/main
| 2023-04-16T03:53:45.586250 | 2021-04-19T11:43:37 | 2021-04-19T11:43:37 | 359,440,621 | 0 | 0 | null | 2021-04-19T11:50:22 | 2021-04-19T11:50:22 | null |
UTF-8
|
C
| false | false | 4,941 |
c
|
pidEfficiency.C
|
#include "genericTOF.h"
//===========================================================================
// Simple macro to extract electron efficiency
// (from Roberto Preghnella, modified by Michael Weber)
//
// in ROOT:
// > .L pidEfficiency.C
// > drawElectron()
// > drawElectronOptimized()
//===========================================================================
genericTOF TOF;
TF1 fres("fres", "TMath::Gaus(x, [0], [1], true)");
void setup()
{
TOF.setName("TOF");
TOF.setType(genericTOF::kBarrel);
TOF.setSigma(0.020); // [ns]
TOF.setLength(200.); // [cm]
TOF.setRadius(100.); // [cm]
TOF.setMagneticField(0.2); // [T]
}
double
pidEfficiency(double p, double eta, double imass, double jmass, double nsigma)
{
if (!TOF.isHit(eta, p)) return 0.;
auto length = TOF.trackLength(eta);
auto iflight = TOF.timeOfFlight(length, imass, p);
auto jflight = TOF.timeOfFlight(length, jmass, p);
auto sigma = TOF.getSigma();
fres.SetParameter(0, jflight);
fres.SetParameter(1, sigma);
return fres.Integral(iflight - nsigma * sigma, iflight + nsigma * sigma);
}
void
drawElectron()
{
setup();
auto c = new TCanvas("c", "c", 800, 800);
c->DrawFrame(0., 0., 10., 1.1, "electron ID (3#sigma cut);#it{p} (GeV/#it{c});efficiency");
auto fel = new TF1("fel", "pidEfficiency(x, 0., 0.00051099891, 0.00051099891, 3.)", 0., 10.);
auto fmu = new TF1("fmu", "pidEfficiency(x, 0., 0.00051099891, 0.10565800, 3.)", 0., 10.);
auto fpi = new TF1("fpi", "pidEfficiency(x, 0., 0.00051099891, 0.13957000, 3.)", 0., 10.);
auto fka = new TF1("fka", "pidEfficiency(x, 0., 0.00051099891, 0.49367700, 3.)", 0., 10.);
auto fpr = new TF1("fpr", "pidEfficiency(x, 0., 0.00051099891, 0.93827200, 3.)", 0., 10.);
fel->SetLineColor(1);
fmu->SetLineColor(2);
fpi->SetLineColor(4);
fka->SetLineColor(6);
fpr->SetLineColor(8);
fel->Draw("same");
fmu->Draw("same");
fpi->Draw("same");
fka->Draw("same");
fpr->Draw("same");
TLegend *l1 = new TLegend(0.65,0.15,0.85,0.45,"","brNDC");
l1->SetLineColor(0);
l1->SetFillColor(0);
l1->AddEntry(fel,"Electrons","lp");
l1->AddEntry(fmu,"Muons","lp");
l1->AddEntry(fpi,"Pions","lp");
l1->AddEntry(fka,"Kaons","lp");
l1->AddEntry(fpr,"Protons","lp");
l1->Draw();
}
void
drawPion()
{
setup();
auto c = new TCanvas("c", "c", 800, 800);
c->DrawFrame(0., 0., 10., 1.1, "electron ID (3#sigma cut);#it{p} (GeV/#it{c});efficiency");
auto fel = new TF1("fel", "pidEfficiency(x, 0., 0.13957000, 0.00051099891, 3.)", 0., 10.);
auto fmu = new TF1("fmu", "pidEfficiency(x, 0., 0.13957000, 0.10565800, 3.)", 0., 10.);
auto fpi = new TF1("fpi", "pidEfficiency(x, 0., 0.13957000, 0.13957000, 3.)", 0., 10.);
auto fka = new TF1("fka", "pidEfficiency(x, 0., 0.13957000, 0.49367700, 3.)", 0., 10.);
auto fpr = new TF1("fpr", "pidEfficiency(x, 0., 0.13957000, 0.93827200, 3.)", 0., 10.);
fel->SetLineColor(1);
fmu->SetLineColor(2);
fpi->SetLineColor(4);
fka->SetLineColor(6);
fpr->SetLineColor(8);
fel->Draw("same");
fmu->Draw("same");
fpi->Draw("same");
fka->Draw("same");
fpr->Draw("same");
TLegend *l1 = new TLegend(0.65,0.15,0.85,0.45,"","brNDC");
l1->SetLineColor(0);
l1->SetFillColor(0);
l1->AddEntry(fel,"Electrons","lp");
l1->AddEntry(fmu,"Muons","lp");
l1->AddEntry(fpi,"Pions","lp");
l1->AddEntry(fka,"Kaons","lp");
l1->AddEntry(fpr,"Protons","lp");
l1->Draw();
}
void
drawElectronOptimized(double pionEff = 0.001)
{
setup();
auto c = new TCanvas("c", "c", 800, 800);
c->DrawFrame(0., 0., 10., 1.1, Form("electron ID (%.1f%% pion efficiency);#it{p} (GeV/#it{c});efficiency",100.*pionEff));
auto hNSigmaThr = new TH1F("hNSigmaThr","",1000,0.,10.);
TF1* fpi[5000];
TF1* fel[5000];
double nsigma = 0.;
double mom = 0.;
double eff = 0.;
bool filled = false;
for(Int_t i = 0; i < 5000; i++){
nsigma = (1.+(double)i)*0.001;
fpi[i] = new TF1("fpi", "pidEfficiency(x, 0., 0.00051099891, 0.13957000,[0])", 0., 10.);
fel[i] = new TF1("fel", "pidEfficiency(x, 0., 0.00051099891, 0.00051099891,[0])", 0., 10.);
fpi[i]->SetParameter(0,nsigma);
fel[i]->SetParameter(0,nsigma);
}
for(Int_t j = 0; j < 1000; j++){
mom = (double)j*0.010;
filled = false;
for(Int_t i = 0; i < 5000; i++){
eff = fpi[i]->Eval(mom);
if (eff>=pionEff){
hNSigmaThr->SetBinContent(j+1,fel[i-1]->Eval(mom));
filled = true;
break;
}
}
if(filled==false)
hNSigmaThr->SetBinContent(j+1,1.);
}
hNSigmaThr->SetLineWidth(2);
hNSigmaThr->SetLineColor(2);
hNSigmaThr->Draw("same");
TLegend *l1 = new TLegend(0.65,0.75,0.85,0.85,"","brNDC");
l1->SetLineColor(0);
l1->SetFillColor(0);
l1->AddEntry(hNSigmaThr,"Electrons","lp");
l1->Draw();
auto fOut = TFile::Open("electronEff.root","RECREATE");
hNSigmaThr->Write();
fOut->Close();
}
|
ff9c1cdbdfefec8a30615d6fa18996f0d6c17503
|
60821605be474d9ae87ec078c76c3b0b5155757b
|
/AxmlParser.h
|
045875f928990a6eae0f9f56c1bde09bc73153f2
|
[
"Apache-2.0"
] |
permissive
|
xujiaba/AmBinaryEditor
|
1c5f2096e554e7066421414dfc91fbc3e8d162f0
|
1bddd123f3f1910ce9d1b7c7f3e78f9fe06bc63a
|
refs/heads/master
| 2020-12-10T06:51:22.105916 | 2020-01-13T07:00:23 | 2020-01-13T07:00:23 | 233,528,875 | 0 | 0 |
Apache-2.0
| 2020-01-13T06:42:12 | 2020-01-13T06:42:12 | null |
UTF-8
|
C
| false | false | 3,007 |
h
|
AxmlParser.h
|
#ifndef INCLUDE_AXMLPARSER_H
#define INCLUDE_AXMLPARSER_H
#include <stdint.h>
#include <stdlib.h>
#endif
enum{
CHUNK_HEAD = 0x00080003,
CHUNK_STRING = 0x001c0001,
CHUNK_RESOURCE = 0x00080180,
CHUNK_STARTNS = 0x00100100,
CHUNK_ENDNS = 0x00100101,
CHUNK_STARTTAG = 0x00100102,
CHUNK_ENDTAG = 0x00100103,
CHUNK_TEXT = 0x00100104,
};
/* attribute structure within tag */
typedef struct _ATTRIBUTE
{
uint32_t uri; /* uri of its namespace */
uint32_t name;
uint32_t string; /* attribute value if type == ATTR_STRING */
uint32_t type; /* attribute type, == ATTR_ */
uint32_t data; /* attribute value, encoded on type */
struct _ATTRIBUTE *prev;
struct _ATTRIBUTE *next;
} ATTRIBUTE;
typedef struct _HEADER
{
uint32_t magic_flag;
uint32_t size;
}HEADER;
/* StringChunk info */
typedef struct _STRING_CHUNK
{
uint32_t chunk_type;
uint32_t chunk_size;
uint32_t string_count;
uint32_t style_count;
uint32_t unknown_field;
uint32_t string_poll_offset;
uint32_t style_poll_offset;
uint32_t *string_offset;
uint32_t *style_offset;
unsigned char *string_poll_data; /* raw data block, contains all strings encoded by UTF-16LE */
size_t string_poll_len; /* length of raw data block */
unsigned char *style_poll_data;
size_t style_poll_len;
unsigned char **strings; /* string table, point to strings encoded by UTF-8 */
} STRING_CHUNK;
typedef struct _RESOURCEID_CHUNK
{
uint32_t chunk_type;
uint32_t chunk_size;
uint32_t *resourceids;
size_t resourceids_count;
} RESOURCEID_CHUNK;
typedef struct _START_NAMESPACE_CHUNK
{
uint32_t prefix;
uint32_t uri;
}START_NAMESPACE_CHUNK;
typedef struct _END_NAMESPACE_CHUNK
{
uint32_t prefix;
uint32_t uri;
}END_NAMESPACE_CHUNK;
typedef struct _START_TAG_CHUNK
{
uint32_t uri;
uint32_t name;
uint32_t flag;
uint32_t attr_count;
uint32_t attr_class;
struct _ATTRIBUTE *attr;
} START_TAG_CHUNK;
typedef struct _END_TAG_CHUNK
{
uint32_t uri;
uint32_t name;
}END_TAG_CHUNK;
typedef struct _TEXT_CHUNK
{
uint32_t name;
uint32_t unknown_field_1;
uint32_t unknown_field_2;
}TEXT_CHUNK;
typedef struct _XMLCONTENTCHUNK
{
uint32_t chunk_type;
uint32_t chunk_size;
uint32_t line_number;
uint32_t unknown_field;
struct _START_NAMESPACE_CHUNK *start_ns_chunk;
struct _END_NAMESPACE_CHUNK *end_ns_chunk;
struct _START_TAG_CHUNK *start_tag_chunk;
struct _END_TAG_CHUNK *end_tag_chunk;
struct _TEXT_CHUNK *text_chunk;
struct _XMLCONTENTCHUNK *child; /* parent->childs link */
struct _XMLCONTENTCHUNK *parent; /* child->parent link */
struct _XMLCONTENTCHUNK *last;
} XMLCONTENTCHUNK;
/* a parser, also a axml parser handle for user */
typedef struct
{
unsigned char *buf; /* origin raw data, to be parsed */
size_t size; /* size of raw data */
size_t cur; /* current parsing position in raw data */
HEADER *header;
STRING_CHUNK *string_chunk;
RESOURCEID_CHUNK *resourceid_chunk;
XMLCONTENTCHUNK *xmlcontent_chunk;
} PARSER;
int ParserAxml(PARSER *ap, char *in_buf, size_t in_size);
|
72d4aa81afe84cbfc9b2439a33b34a1910d25d2d
|
667989f334371af7e2c9920963a58a44f86c58da
|
/RoboticCircuit_INF1900/lib/minuterie.h
|
cc65666e175cf6f6376517a4b932cb126dbe6fe7
|
[] |
no_license
|
Andrew-Abdo/portfolio
|
6f8624f95eefbee205e0091c741561b9e513978b
|
b364f55fcf41754adcb8b20e3dd10078f3af1d98
|
refs/heads/main
| 2023-07-20T03:37:27.486138 | 2023-07-11T13:27:00 | 2023-07-11T13:27:00 | 352,485,668 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 235 |
h
|
minuterie.h
|
#ifndef MINUTERIE_H
#define MINUTERIE_H
#include "headers.h"
void startTimer0CTC(const uint8_t duration, const uint8_t PBx = PB2);
void stopTimer0CTC();
void partirMinuterie2CTC();
void arreterMinuterie2CTC();
#endif // MINUTERIE_H
|
932192a9b26ecb5cc099194340a8cb0f42aeda82
|
3008246a99bd50860f9e09e5e0d991a5055402cb
|
/code/07_19/tree.h
|
3bfa2d8dc25936d3379e4e5a65cdda878700f63a
|
[] |
no_license
|
sp4869/ECE264
|
093410646eae099f262507a6e2fd8db9e36fe485
|
eedd4e4450f1010fccef85d128b5a3029d496dc6
|
refs/heads/master
| 2021-09-03T14:13:21.135021 | 2018-01-09T18:04:43 | 2018-01-09T18:04:43 | 116,848,678 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 614 |
h
|
tree.h
|
#ifndef TREE_H
#define TREE_H
typedef struct treenode
{
struct treenode * left;
struct treenode * right;
char value; // character
int freq; // frequency
} TreeNode;
TreeNode * TreeNode_create(char val, int freq);
TreeNode * Tree_merge(TreeNode * tn1, TreeNode * tn2);
void Tree_print(TreeNode * tn, int level);
// find the maximum height of the leaf nodes
int Tree_height(TreeNode * tn);
// find the number of leaf nodes
int Tree_leaf(TreeNode * tn);
// save the header of a compressed file
void Tree_header(TreeNode * tn, unsigned int numChar, char * outfile);
void Tree_destroy(TreeNode * tn);
#endif
|
53d6c8a9d725f617742cb36ba99d861aeebf6db8
|
ec5d923a3c65301f6020b5ef219d420febbed7b2
|
/server/tools.c
|
7d7252aa4c7d8e240eefe22c5748f6938f3d2bd9
|
[] |
no_license
|
mdreem/d_ftp
|
249ffc7e6d0d7ddf9f307fb3b66f2e06eeb274fc
|
95c48cb0542c2715fe024c798185c482453a5c5a
|
refs/heads/master
| 2021-01-21T13:41:13.953481 | 2016-06-03T05:38:34 | 2016-06-03T05:38:34 | 50,870,061 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,524 |
c
|
tools.c
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include "tools.h"
int initialize_socket(int port)
{
int socket_desc;
struct sockaddr_in server;
socket_desc = socket(AF_INET, SOCK_STREAM, 0);
if (socket_desc == -1)
{
perror("Could not create socket");
exit(1);
}
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
server.sin_port = htons(port);
if (bind(socket_desc, (struct sockaddr *) &server, sizeof(server)) < 0)
{
perror("bind failed");
exit(1);
}
printf("bind done. port: %d\n", port);
return socket_desc;
}
int answer(struct state *s_state, int status_code, const char *message)
{
char buffer[256];
snprintf(buffer, 256, "%d %s\r\n", status_code, message);
int n = write(s_state->client_socket, buffer, strlen(buffer));
for (int i = 0; i < strlen(buffer) && i < 256; i++)
{
if (isnewline(buffer[i]))
buffer[i] = '@';
}
printf("Answered: \"%s\"\n", buffer);
return n;
}
int isnewline(char c)
{
return c == '\n' || c == '\r';
}
char *trim_whitespace(char *string_in)
{
while (isspace(string_in[0]))
string_in++;
if (string_in[0] == 0)
{
return string_in;
}
char *str_end = string_in + strlen(string_in) - 1;
while (isspace(str_end[0]) || isnewline(str_end[0]))
str_end--;
*(str_end + sizeof(char)) = 0;
return string_in;
}
int get_socket(struct state *s_state)
{
if (s_state->s_state == SERVER_STANDARD_MODE)
{
return s_state->active_socket;
}
else
{
struct sockaddr_in client;
int c = sizeof(struct sockaddr_in);
return accept(s_state->passive_socket,
(struct sockaddr *) &client, (socklen_t *) & c);
}
}
void get_sockaddr(int socket, struct sockaddr_in *addr)
{
socklen_t s_len = sizeof(struct sockaddr_in);
getsockname(socket, (struct sockaddr *) addr, &s_len);
}
void get_ip(int socket, struct ip *ip_addr)
{
struct sockaddr_in addr;
get_sockaddr(socket, &addr);
memcpy(ip_addr, &addr.sin_addr, sizeof(struct ip));
}
void get_port(int socket, struct port *port)
{
struct sockaddr_in addr;
get_sockaddr(socket, &addr);
memcpy(port, &addr.sin_port, sizeof(struct port));
}
void create_passive_connection(struct state *s_state)
{
close(s_state->passive_socket);
s_state->passive_socket = initialize_socket(0);
}
|
5989f764f451ae684ab9cf9557e029f677022f6d
|
63994d1dc30b585417ce5fd9a764df0b42064bd0
|
/include/internal/iutest_compiler_c.h
|
0cc24e74faeb6e6190e0a49c3d3f53686d36357d
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] |
permissive
|
srz-zumix/iutest_c
|
d5876abcb972f850a2b0a2e64326557fdf76e13a
|
7a97c9064fb2b1fda05f312969c6c509c62588e2
|
refs/heads/master
| 2020-04-14T20:37:33.174459 | 2017-04-11T22:59:00 | 2017-04-11T22:59:00 | 14,108,982 | 3 | 1 | null | 2017-04-11T22:59:01 | 2013-11-04T12:29:23 |
C
|
SHIFT_JIS
|
C
| false | false | 6,561 |
h
|
iutest_compiler_c.h
|
/*======================================================================
----------------------------------------------------------------------*/
/**
* @file iutest_compiler_c.h
* @brief iris unit test compiler
*
* @author t.sirayanagi
* @par copyright
* Copyright (C) 2012-2014, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
/*----------------------------------------------------------------------
======================================================================*/
#ifndef INCG_IRIS_IUTEST_COMPILER_C_H_6DDB27E8_E2FF_4754_80B0_F500025820C4_
#define INCG_IRIS_IUTEST_COMPILER_C_H_6DDB27E8_E2FF_4754_80B0_F500025820C4_
/* typedef ===========================================================*/
typedef int iuBOOL;
/* define ===========================================================*/
/* os */
#if defined(__CYGWIN__)
# define IUTEST_OS_CYGWIN 1
# define IUTEST_PLATFORM "CYGWIN"
#elif defined(_WIN32) || defined(WIN32) || defined(__WIN32__) || defined(WINAPI_FAMILY)
# define IUTEST_OS_WINDOWS 1
# if !defined(WIN32_LEAN_AND_MEAN)
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# if defined(_WIN32_WCE)
# define IUTEST_OS_WINDOWS_MOBILE 1
# define IUTEST_PLATFORM "Windows CE"
# elif defined(__MINGW__) || defined(__MINGW32__)
# define IUTEST_OS_WINDOWS_MINGW 1
# elif defined(__CUDACC__)
# define IUTEST_OS_WINDOWS_CUDA 1
# elif defined(WINAPI_FAMILY)
# if defined(WINAPI_FAMILY_PHONE_APP) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
# define IUTEST_OS_WINDOWS_PHONE 1
# define IUTEST_PLATFORM "Windows Phone"
# else
# define IUTEST_OS_WINDOWS_DESKTOP 1
# endif
# else
# define IUTEST_OS_WINDOWS_DESKTOP 1
# endif
# if !defined(IUTEST_PLATFORM)
# define IUTEST_PLATFORM "Windows"
# endif
#elif defined(__APPLE__)
# include "TargetConditionals.h"
# if TARGET_OS_IPHONE
# define IUTEST_OS_IOS 1
# if TARGET_IPHONE_SIMULATOR
# define IUTEST_OS_IOS_SIMULATOR 1
# define IUTEST_PLATFORM "iOS Simulator"
# else
# define IUTEST_PLATFORM "iOS"
# endif
# else
# define IUTEST_OS_MAC 1
# define IUTEST_PLATFORM "Mac OS"
# endif
#elif defined(sun) || defined(__sun)
# define IUTEST_OS_SOLARIS 1
# define IUTEST_PLATFORM "Solaris"
#elif defined(__linux__)
# define IUTEST_OS_LINUX 1
# ifdef ANDROID
# define IUTEST_OS_LINUX_ANDROID 1
# define IUTEST_PLATFORM "Android"
# else
# define IUTEST_PLATFORM "LINUX"
# endif
#elif defined(__native_client__)
# define IUTEST_OS_NACL 1
# define IUTEST_PLATFORM "Google Native Client"
#elif defined(__AVR32__) || defined(__avr32__)
# define IUTEST_OS_AVR32 1
# define IUTEST_PLATFORM "AVR32"
#elif defined(__arm__)
# define IUTEST_OS_ARM 1
# define IUTEST_PLATFORM "ARM"
#endif
#if defined(IUTEST_OS_LINUX_ANDROID)
# include <android/api-level.h>
#endif
/* stdc version */
#if !defined(IUTEST_STDC_VER)
# if defined(__STRICT_ANSI__) && defined(__STDC__) && (__STDC__ == 1)
# if defined(__STDC_VERSION__)
# define IUTEST_STDC_VER __STDC_VERSION__
# else
# define IUTEST_STDC_VER 199000L
# endif
# else
# define IUTEST_STDC_VER 0
# endif
#endif
#if !defined(IUTEST_C_HAS_C90)
# if IUTEST_STDC_VER == 199000L
# define IUTEST_C_HAS_C90 1
# else
# define IUTEST_C_HAS_C90 0
# endif
#endif
#if !defined(IUTEST_C_HAS_AMD1)
# if IUTEST_STDC_VER == 199409L
# define IUTEST_C_HAS_AMD1 1
# else
# define IUTEST_C_HAS_AMD1 0
# endif
#endif
#if !defined(IUTEST_C_HAS_C99)
# if IUTEST_STDC_VER == 199901L
# define IUTEST_C_HAS_C99 1
# else
# define IUTEST_C_HAS_C99 0
# endif
#endif
#if !defined(IUTEST_C_HAS_C11)
# if IUTEST_STDC_VER == 201112L
# define IUTEST_C_HAS_C11 1
# else
# define IUTEST_C_HAS_C11 0
# endif
#endif
/* attribute */
/** attribute unused */
#if !defined(IUTEST_ATTRIBUTE_UNUSED_)
# if defined(__GNUC__) && !defined(COMPILER_ICC)
# define IUTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
# else
# define IUTEST_ATTRIBUTE_UNUSED_
# endif
#endif
/* C11 */
/** has _Generic */
#if !defined(IUTEST_C_HAS_GENERIC)
# if defined(__clang__)
# if __has_feature(c_generic_selections)
# define IUTEST_C_HAS_GENERIC 1
# endif
# elif defined(__GNUC__)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))
# define IUTEST_C_HAS_GENERIC 1
# endif
# endif
#endif
#if !defined(IUTEST_C_HAS_GENERIC)
# define IUTEST_C_HAS_GENERIC 0
#endif
#if !defined(IUTEST_SECTION_)
# if defined(__GNUC__) && !defined(COMPILER_ICC)
# define IUTEST_SECTION_(name) IUTEST_SECTION_I_(name)
# define IUTEST_SECTION_I_(name) IUTEST_SECTION_D_("." #name)
# define IUTEST_SECTION2_(name1, name2) IUTEST_SECTION2_I_(name1,name2)
# define IUTEST_SECTION2_I_(name1, name2) IUTEST_SECTION_D_("." #name1 "." #name2)
# define IUTEST_SECTION_D_(name) __attribute__ ((section(name)))
# else
# define IUTEST_SECTION_(name)
# define IUTEST_SECTION2_(name1, name2)
# endif
#endif
/* 可変長引数マクロ */
#if !defined(IUTEST_C_NO_VARIADIC_MACROS)
# if defined(_MSC_VER) && (_MSC_VER < 1500)
# define IUTEST_C_NO_VARIADIC_MACROS
# elif !defined(__GNUC__) && IUTEST_HAS_C90
# define IUTEST_C_NO_VARIADIC_MACROS
# endif
#endif
/* __COUNTER__ マクロ */
#if !defined(IUTEST_C_HAS_COUNTER_MACRO)
# if defined(_MSC_VER) && (_MSC_VER >= 1300)
# define IUTEST_C_HAS_COUNTER_MACRO 1
# elif defined(__clang__)
# define IUTEST_C_HAS_COUNTER_MACRO 1
# elif defined(__GNUC__)
# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define IUTEST_HAS_COUNTER_MACRO 1
# endif
# endif
#endif
#if !defined(IUTEST_C_HAS_COUNTER_MACRO)
# define IUTEST_C_HAS_COUNTER_MACRO 0
#endif
#if defined(__cplusplus)
# define IUTEST_EXTERN_C_BEGIN() extern "C" {
# define IUTEST_EXTERN_C_END() }
#else
# define IUTEST_EXTERN_C_BEGIN()
# define IUTEST_EXTERN_C_END()
#endif
#if !defined(NULL)
# if defined(__cplusplus)
# define NULL 0
# else
# define NULL (void*)0
# endif
#endif
#if !defined(TRUE)
# define TRUE 1
#endif
#if !defined(FALSE)
# define FALSE 0
#endif
/* include ==========================================================*/
#include "iutest_pragma_c.h"
#endif
|
1d0576099c09012cf4d6b8c1f22c2a8107d03241
|
42485ac360220501f714f2b997540a860b03d179
|
/950_672_2053_20190531/NA51023_BSP/uitron/DrvExt/DrvExt_src/ModelExt/R2/PinmuxCfg.c
|
7d0574ebc29ee5efa92118c4ec90124f114198fc
|
[] |
no_license
|
nikitos1550/some_novatek_sdk
|
2a76a37c1dd32b69e358e1e4646f9bea7e43e846
|
1a4b7af327d4fdaa9527df7225a001d5009e52cb
|
refs/heads/master
| 2023-02-22T17:08:49.576697 | 2021-01-17T19:52:59 | 2021-01-17T19:52:59 | 330,468,587 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 2,153 |
c
|
PinmuxCfg.c
|
#include "PinmuxCfg.h"
#include "top.h"
#include "DrvExt.h"
///////////////////////////////////////////////////////////////////////////////
#define __MODULE__ DxDrv
#define __DBGLVL__ 1 // 0=OFF, 1=ERROR, 2=TRACE
#define __DBGFLT__ "*" //*=All, [mark]=CustomClass
#include "DebugModule.h"
///////////////////////////////////////////////////////////////////////////////
#if 0
const PIN_GROUP_CONFIG vTopConfig[] = {
// Module name pinmux config
//
// Storage configuration
//
{PIN_FUNC_SDIO, PIN_SDIO_CFG_4BITS},
{PIN_FUNC_SDIO2, PIN_SDIO_CFG_4BITS},
{PIN_FUNC_SDIO3, PIN_SDIO_CFG_4BITS | PIN_SDIO_CFG_1ST_PINMUX},
{PIN_FUNC_NAND, PIN_NAND_CFG_NONE},
//
// Sensor configuration
//
{PIN_FUNC_SENSOR, PIN_SENSOR_CFG_MIPI},
{PIN_FUNC_SENSOR2, PIN_SENSOR2_CFG_NONE},
{PIN_FUNC_MIPI_LVDS, PIN_MIPI_LVDS_CFG_CLK0 | PIN_MIPI_LVDS_CFG_DAT0 | PIN_MIPI_LVDS_CFG_DAT1 | PIN_MIPI_LVDS_CFG_DAT2 | PIN_MIPI_LVDS_CFG_DAT3},
//
// Serial interface configuration
//
{PIN_FUNC_I2C, PIN_I2C_CFG_CH1},
{PIN_FUNC_SIF, PIN_SIF_CFG_CH1},
{PIN_FUNC_UART, PIN_UART_CFG_CH1 | PIN_UART_CFG_CH2},
{PIN_FUNC_SPI, PIN_SPI_CFG_NONE},
{PIN_FUNC_REMOTE, PIN_REMOTE_CFG_NONE},
//
// PWM configuration
//
{PIN_FUNC_PWM, PIN_PWM_CFG_NONE},
//
// AUDIO configuration
//
{PIN_FUNC_AUDIO, PIN_AUDIO_CFG_NONE},
//
// Display configuration
//
{PIN_FUNC_LCD, PINMUX_DISPMUX_SEL_LCD | PINMUX_LCDMODE_RGB_SERIAL},
{PIN_FUNC_TV, PINMUX_TV_HDMI_CFG_NORMAL},
{PIN_FUNC_ETH, PIN_ETH_CFG_NONE}
};
#endif
void IO_InitPinmux(void)
{
MODELEXT_HEADER *header;
PIN_GROUP_CONFIG *vTopConfig;
vTopConfig = (PIN_GROUP_CONFIG *)Dx_GetModelExtCfg(MODELEXT_TYPE_PINMUX_CFG, &header);
if (!vTopConfig || !header) {
DBG_FATAL("Modelext: pinmux is null\n");
return;
}
#if defined(_CPU2_LINUX_)
pinmux_init_for_dualcore((PIN_GROUP_CONFIG *)vTopConfig, TRUE);
#else
pinmux_init((PIN_GROUP_CONFIG *)vTopConfig);
#endif
}
|
305a88dc30f615b325d0a3ecb1fc5f7883706284
|
2bbeed7134d60a27a55996c06ffc0167f141b9d0
|
/services/anilist/src/player/internal/implementation/aniparser.c
|
c34ff80cb8ae3e8bcec40506f1727842604c3aaa
|
[
"WTFPL"
] |
permissive
|
C4T-BuT-S4D/training-17-11-19
|
2bf42f998a7183cd0a5e1133dfe28b0a264919c3
|
5d2f825fd1bb866cf13c1b09ae4926e2a68a9abf
|
refs/heads/master
| 2021-06-24T06:44:17.446343 | 2020-02-02T15:04:54 | 2020-02-02T15:04:54 | 219,171,414 | 2 | 0 |
WTFPL
| 2021-05-11T07:42:54 | 2019-11-02T15:13:31 |
Python
|
UTF-8
|
C
| false | false | 4,107 |
c
|
aniparser.c
|
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "structmember.h"
const Py_ssize_t MAX_LEN = 100 * 1000;
const Py_ssize_t MAX_DEN = 255;
Py_ssize_t load(unsigned char *src, Py_ssize_t src_len, char* dst) {
Py_ssize_t dst_len = 0;
for (Py_ssize_t i = 0; i < src_len; i += 2) {
for (unsigned char j = 0; j < src[i]; ++j) {
dst[dst_len++] = src[i + 1];
}
}
return dst_len;
}
void dump(char *data, Py_ssize_t length, FILE *fp) {
char *result = alloca(2 * length);
Py_ssize_t cnt = 0;
char cur_length = 0;
char cur_char = 0;
for (int i = 0; i < length; ++i) {
if (cur_length && data[i] == cur_char) {
++cur_length;
} else if (!cur_length) {
cur_length = 1;
cur_char = data[i];
} else {
result[cnt++] = cur_length;
result[cnt++] = cur_char;
cur_length = 1;
cur_char = data[i];
}
if (cur_length == MAX_DEN) {
result[cnt++] = cur_length;
result[cnt++] = cur_char;
cur_length = 0;
}
}
if (cur_length) {
result[cnt++] = cur_length;
result[cnt++] = cur_char;
}
fwrite((char*)(&(cnt)), 1, sizeof(Py_ssize_t), fp);
fwrite(result, 1, cnt, fp);
}
typedef struct {
PyObject_HEAD
char* data;
char* fname;
Py_ssize_t length;
} Aniparser;
static PyModuleDef aniparser = {
PyModuleDef_HEAD_INIT,
.m_name = "custom",
.m_doc = "Aniparser module",
.m_size = -1,
};
static int
Aniparser_init(Aniparser *self, PyObject *args) {
char *s1;
char *s2;
Py_ssize_t len1;
Py_ssize_t len2;
if (!PyArg_ParseTuple(args, "s#s#", &s1, &len1, &s2, &len2))
{
return -1;
}
if (len1 < 8) {
PyErr_SetString(PyExc_ValueError, "Data too short");
return NULL;
}
self->data = malloc(len1 - 7);
self->fname = malloc(len2 + 1);
memcpy(self->data, s1 + 8, len1 - 8);
self->data[len1 - 8] = 0;
memcpy(self->fname, s2, len2);
self->fname[len2] = 0;
self->length = *((size_t*)s1);
if (self->length > MAX_LEN) {
self->length = MAX_LEN;
}
return 0;
}
static PyMemberDef Aniparser_members[] = {
{"data", T_STRING, offsetof(Aniparser, data), 0, "string with data to parse"},
{"fname", T_STRING, offsetof(Aniparser, fname), 0, "filename"},
{"length", T_PYSSIZET, offsetof(Aniparser, length), 0, "data length"},
{NULL} /* Sentinel */
};
static PyObject *
Aniparser_parse(Aniparser *self) {
unsigned char *buf = alloca(strlen(self->data));
memcpy(buf, self->data, self->length);
char* res = malloc(MAX_DEN * self->length);
Py_ssize_t res_len = load(buf, self->length, res);
PyObject *result = Py_BuildValue("y#", res, res_len);
return result;
}
static PyObject *
Aniparser_create(Aniparser *self) {
unsigned char *buf = alloca(strlen(self->data));
memcpy(buf, self->data, strlen(self->data));
FILE* fp = fopen(self->fname, "w");
if (!fp) {
Py_RETURN_NONE;
}
dump(buf, self->length, fp);
fclose(fp);
Py_RETURN_NONE;
}
static PyMethodDef Aniparser_methods[] = {
{"parse", (PyCFunction) Aniparser_parse, METH_NOARGS, "Parse data"},
{"create", (PyCFunction) Aniparser_create, METH_NOARGS, "Create data frame"},
{NULL} /* Sentinel */
};
static PyTypeObject AniparserType = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "aniparser.Aniparser",
.tp_doc = "Aniparser object",
.tp_basicsize = sizeof(Aniparser),
.tp_itemsize = 0,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_new = PyType_GenericNew,
.tp_init = (initproc) Aniparser_init,
.tp_members = Aniparser_members,
.tp_methods = Aniparser_methods,
};
PyMODINIT_FUNC
PyInit_aniparser(void)
{
PyObject *m;
if (PyType_Ready(&AniparserType) < 0)
return NULL;
m = PyModule_Create(&aniparser);
if (m == NULL)
return NULL;
Py_INCREF(&AniparserType);
PyModule_AddObject(m, "Aniparser", (PyObject *) &AniparserType);
return m;
}
|
8085e2da01d6b513b6fa779380b5af527f48ece7
|
3d8032cf92e858ca49b1a6a9a3284a2d9894dee5
|
/libft/src/ft_strjoin.c
|
ebfd65ea23767ba036ecbcf436dd820a477157cb
|
[] |
no_license
|
theof/wolf3d
|
d68369c59c5af5fbe0a720dc13ce6aba9ffcefc1
|
063cd178826e6113a480ae2e342907ed9d7f1998
|
refs/heads/master
| 2021-05-30T04:25:15.178246 | 2015-10-10T10:37:18 | 2015-10-10T10:37:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 1,515 |
c
|
ft_strjoin.c
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tvallee <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/05/03 22:20:05 by tvallee #+# #+# */
/* Updated: 2015/05/03 22:59:54 by tvallee ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
static int free_appropriately(char *s1, char *s2, int nb)
{
if (nb == 1)
free(s1);
if (nb == 2)
free(s2);
if (nb == 3)
{
free(s1);
free(s2);
}
return (0);
}
char *ft_strjoin(char const *s1, char const *s2, int nb)
{
char *r;
int i;
int j;
r = NULL;
if (!(i = 0) && s1 && s2)
{
r = ft_memalloc(sizeof(char) * (ft_strlen(s1) + ft_strlen(s2) + 2));
if (r && (j = 0) == 0)
{
while (s1[i])
{
r[i] = s1[i];
i++;
}
while (s2[j])
{
r[i + j] = s2[j];
j++;
}
r[i + j] = 0;
}
free_appropriately((char *)s1, (char *)s2, nb);
}
return (r);
}
|
2d6c94c69581c6b283466a73450874bb9309412b
|
f39734b5dd8a9b45b3f520dc5386465c2a263ea9
|
/c/gfx2d/ripple/fly.c
|
39cfdeeda7e8a7c9cf71902a4bfefa624f8f54e2
|
[] |
no_license
|
joeytwiddle/code
|
83c1bc44c752ff13692ccca27133090118dd30ad
|
17614a1138889be471a27054254dcb8962fb3673
|
refs/heads/master
| 2023-08-31T07:15:15.611512 | 2023-08-20T04:49:52 | 2023-08-20T04:56:03 | 12,212,352 | 30 | 13 | null | 2020-04-26T07:15:30 | 2013-08-19T09:21:28 |
HTML
|
ISO-8859-13
|
C
| false | false | 3,329 |
c
|
fly.c
|
/* All my source code is freely distributable under the GNU public licence.
If you make money with this code, please give me some!
If you find this code useful, or have any queries, please feel free to
contact me: [email protected] / [email protected]
Paul "Joey" Clark, hacking for humanity, Feb 1999
http://www.cs.bris.ac.uk/~pclark */
//////////////////////////////////////////////////////
/********** Fly.c by Micha³ W¹sowicz **********/
//////////////////////////////////////////////////////
/******************************************************/
/* It is a simple program using double buffering for */
/* displaying a randomly flying circle (I didn't want */
/* to use sprites, because "fly" is just a simple */
/* demonstration of random() function for begginers.) */
/******************************************************/
#include <stdlib.h>
#include <stdio.h>
#include "allegro.h" // I use ALLEGRO library
// by Shawn Hargreaves.
/* Pointer to a buffer, where the circle will be drawn. */
BITMAP *buffer;
int num;
int count = 0;
int radius = 2;
int flag = 1;
int x = 160; // Start position of the fly.
int y = 100;
main ()
{
int vx, vy, x1, y1;
int count = 0;
allegro_init ();
install_keyboard ();
install_timer ();
set_gfx_mode (GFX_AUTODETECT, 320, 240, 0, 0);
set_pallete (desktop_palette);
buffer = create_bitmap (320, 240);
for (;;)
{
count++;
clear (buffer);
circlefill (buffer, x, y, 3, 255);
textout_centre (buffer, font, "Press SPACE!", 60, 220, 4);
blit (buffer, screen, 0, 0, 0, 0, 320, 240);
vx = (random () % 3); // Randomize the next position
vy = (random () % 3); // of the fly.
x1 = (random () % 3);
y1 = (random () % 3);
vx -= x1; // Substracting allows negative numbers
vy -= y1; // (the fly can move up and to the left).
x += vx;
y += vy;
if (x <= 0) // Don't let the fly run away of the screen.
x = 2;
if (x >= 320)
x = 318;
if (y <= 0)
y = 2;
if (y >= 220)
y = 218;
if (count >= 1000) // After a period of time the fly gets tired.
{
count = 0;
num = 0;
tired ();
}
if (key[KEY_ESC])
{
destroy_bitmap (buffer);
exit (0);
}
else if (key[KEY_SPACE]) // You can also make the fly tired
count = 1000; // by pressing SPACE.
}
}
tired ()
{
for (num == 0; num <= 50; num++)
{
clear (buffer);
/* Put the text under the fly. */
textout_centre (buffer, font, "I'm tired!", x, y + 10, 5);
circlefill (buffer, x, y, radius, 1);
textout_centre (buffer, font, "Press ENTER!", 60, 220, 4);
blit (buffer, screen, 0, 0, 0, 0, 320, 240);
if (flag == 1)
{
radius += 1; // Change the size of the circle
flag = 2;
} // to get the effect of gasping.
else if (flag == 2)
{
radius += 1;
flag = 3;
}
else if (flag == 3)
{
radius -= 2;
flag = 1;
}
rest (120); // Delay a bit.
if (key[KEY_ENTER]) // Fly again by pressing ENTER.
break;
}
return;
}
//////////////////////////////////////////////////////////
|
974696c0b04db742890102165a9c031a46e1a1f6
|
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
|
/source/FFmpeg/libavformat/extr_amr.c_amr_read_packet.c
|
04c5a5b2924c2ec38a75cff1fa21f6e7b2197932
|
[] |
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 | 2,939 |
c
|
extr_amr.c_amr_read_packet.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 */
typedef struct TYPE_14__ TYPE_5__ ;
typedef struct TYPE_13__ TYPE_4__ ;
typedef struct TYPE_12__ TYPE_3__ ;
typedef struct TYPE_11__ TYPE_2__ ;
typedef struct TYPE_10__ TYPE_1__ ;
/* Type definitions */
typedef int /*<<< orphan*/ int64_t ;
struct TYPE_14__ {int cumulated_size; int block_count; } ;
struct TYPE_13__ {scalar_t__ codec_id; int bit_rate; } ;
struct TYPE_12__ {int /*<<< orphan*/ pb; TYPE_1__** streams; TYPE_5__* priv_data; } ;
struct TYPE_11__ {int* data; int duration; int /*<<< orphan*/ pos; scalar_t__ stream_index; } ;
struct TYPE_10__ {TYPE_4__* codecpar; } ;
typedef TYPE_2__ AVPacket ;
typedef TYPE_3__ AVFormatContext ;
typedef TYPE_4__ AVCodecParameters ;
typedef TYPE_5__ AMRContext ;
/* Variables and functions */
int AVERROR (int /*<<< orphan*/ ) ;
int AVERROR_EOF ;
scalar_t__ AV_CODEC_ID_AMR_NB ;
scalar_t__ AV_CODEC_ID_AMR_WB ;
int /*<<< orphan*/ EIO ;
int UINT64_MAX ;
int* amrnb_packed_size ;
int* amrwb_packed_size ;
scalar_t__ av_new_packet (TYPE_2__*,int) ;
int /*<<< orphan*/ av_packet_unref (TYPE_2__*) ;
scalar_t__ avio_feof (int /*<<< orphan*/ ) ;
int avio_r8 (int /*<<< orphan*/ ) ;
int avio_read (int /*<<< orphan*/ ,int*,int) ;
int /*<<< orphan*/ avio_tell (int /*<<< orphan*/ ) ;
__attribute__((used)) static int amr_read_packet(AVFormatContext *s, AVPacket *pkt)
{
AVCodecParameters *par = s->streams[0]->codecpar;
int read, size = 0, toc, mode;
int64_t pos = avio_tell(s->pb);
AMRContext *amr = s->priv_data;
if (avio_feof(s->pb)) {
return AVERROR_EOF;
}
// FIXME this is wrong, this should rather be in an AVParser
toc = avio_r8(s->pb);
mode = (toc >> 3) & 0x0F;
if (par->codec_id == AV_CODEC_ID_AMR_NB) {
size = amrnb_packed_size[mode];
} else if (par->codec_id == AV_CODEC_ID_AMR_WB) {
size = amrwb_packed_size[mode];
}
if (!size || av_new_packet(pkt, size))
return AVERROR(EIO);
if (amr->cumulated_size < UINT64_MAX - size) {
amr->cumulated_size += size;
/* Both AMR formats have 50 frames per second */
s->streams[0]->codecpar->bit_rate = amr->cumulated_size / ++amr->block_count * 8 * 50;
}
pkt->stream_index = 0;
pkt->pos = pos;
pkt->data[0] = toc;
pkt->duration = par->codec_id == AV_CODEC_ID_AMR_NB ? 160 : 320;
read = avio_read(s->pb, pkt->data + 1, size - 1);
if (read != size - 1) {
av_packet_unref(pkt);
if (read < 0)
return read;
return AVERROR(EIO);
}
return 0;
}
|
08bc38afd5bcf710edd6627d94d994a58bd3d154
|
5bdcc41c6a736736c9663307c84f303013140d6a
|
/mach-exynos/mach-tiny4412.c
|
f07fc05e05fd2dd07e1bd1631290be9e8117caaa
|
[
"MIT"
] |
permissive
|
ADu1975/ADu_Tiny4412
|
d682c46535e1adb883d765a9f6283aa4619c54cf
|
d35d1a39cd2acb3c4042616614693affda6e9cd9
|
refs/heads/master
| 2020-03-11T17:33:27.535469 | 2018-04-19T02:51:16 | 2018-04-19T02:51:16 | 130,150,206 | 0 | 1 | null | null | null | null |
UTF-8
|
C
| false | false | 117,799 |
c
|
mach-tiny4412.c
|
/* linux/arch/arm/mach-exynos/mach-tiny4412.c
*
* Copyright (c) 2015 FriendlyARM (www.arm9.net)
*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <linux/clk.h>
#include <linux/lcd.h>
#include <linux/gpio.h>
#include <linux/gpio_event.h>
#include <linux/i2c.h>
#include <linux/pwm_backlight.h>
#include <linux/input.h>
#include <linux/mmc/host.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h>
#include <linux/regulator/fixed.h>
#include <linux/mfd/wm8994/pdata.h>
#include <linux/mfd/max8997.h>
#include <linux/mfd/max77686.h>
#include <linux/v4l2-mediabus.h>
#include <linux/memblock.h>
#include <linux/delay.h>
#include <linux/smsc911x.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
#include <plat/regs-serial.h>
#include <plat/exynos4.h>
#include <plat/cpu.h>
#include <plat/clock.h>
#include <plat/keypad.h>
#include <plat/devs.h>
#include <plat/fb.h>
#include <plat/fb-s5p.h>
#include <plat/fb-core.h>
#include <plat/regs-fb-v4.h>
#include <plat/backlight.h>
#include <plat/gpio-cfg.h>
#include <plat/regs-adc.h>
#include <plat/adc.h>
#include <plat/iic.h>
#include <plat/pd.h>
#include <plat/sdhci.h>
#include <plat/mshci.h>
#include <plat/ehci.h>
#include <plat/usbgadget.h>
#include <plat/usb-switch.h>
#include <plat/s3c64xx-spi.h>
#if defined(CONFIG_VIDEO_FIMC)
#include <plat/fimc.h>
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
#include <plat/fimc-core.h>
#include <media/s5p_fimc.h>
#endif
#if defined(CONFIG_VIDEO_FIMC_MIPI)
#include <plat/csis.h>
#elif defined(CONFIG_VIDEO_S5P_MIPI_CSIS)
#include <plat/mipi_csis.h>
#endif
#include <plat/tvout.h>
#include <plat/media.h>
#include <plat/regs-srom.h>
#include <plat/s5p-sysmmu.h>
#include <plat/tv-core.h>
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC) || defined(CONFIG_VIDEO_MFC5X)
#include <plat/s5p-mfc.h>
#endif
#include <media/s5k4ba_platform.h>
#include <media/s5k4ea_platform.h>
#include <media/exynos_flite.h>
#include <media/exynos_fimc_is.h>
#include <video/platform_lcd.h>
#include <media/m5mo_platform.h>
#include <media/m5mols.h>
#include <mach/board_rev.h>
#include <mach/map.h>
#include <mach/spi-clocks.h>
#include <mach/exynos-ion.h>
#include <mach/regs-pmu.h>
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
#include <mach/dwmci.h>
#endif
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
#include <mach/secmem.h>
#endif
#include <mach/dev.h>
#include <mach/ppmu.h>
#ifdef CONFIG_EXYNOS_C2C
#include <mach/c2c.h>
#endif
#ifdef CONFIG_FB_S5P_MIPI_DSIM
#include <mach/mipi_ddi.h>
#include <mach/dsim.h>
#endif
#include <plat/fb-s5p.h>
#ifdef CONFIG_FB_S5P_EXTDSP
struct s3cfb_extdsp_lcd {
int width;
int height;
int bpp;
};
#endif
#include <plat/fimg2d.h>
#include <mach/dev-sysmmu.h>
#include <mach/board-revision.h>
#include <mach/board-bluetooth-bcm.h>
#include <mach/board-wlan.h>
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
#include <plat/fimc-core.h>
#include <media/s5p_fimc.h>
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
#include <plat/jpeg.h>
#endif
#ifdef CONFIG_REGULATOR_S5M8767
#include <linux/mfd/s5m87xx/s5m-core.h>
#include <linux/mfd/s5m87xx/s5m-pmic.h>
#endif
#if defined(CONFIG_EXYNOS_SETUP_THERMAL)
#include <plat/s5p-tmu.h>
#endif
#if defined(CONFIG_FB_S5P_TINY4412)
extern struct s3cfb_lcd *tiny4412_get_lcd(void);
#endif
#define REG_INFORM4 (S5P_INFORM4)
/* Following are default values for UCON, ULCON and UFCON UART registers */
#define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
S3C2410_UCON_RXILEVEL | \
S3C2410_UCON_TXIRQMODE | \
S3C2410_UCON_RXIRQMODE | \
S3C2410_UCON_RXFIFO_TOI | \
S3C2443_UCON_RXERR_IRQEN)
#define SMDK4X12_ULCON_DEFAULT S3C2410_LCON_CS8
#define SMDK4X12_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
S5PV210_UFCON_TXTRIG4 | \
S5PV210_UFCON_RXTRIG4)
static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
#ifdef CONFIG_BT_BCM20710
#ifdef GPIO_BT_WAKE
.wake_peer = bcm_bt_lpm_exit_lpm_locked,
#endif
#endif
},
[2] = {
.hwport = 2,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
[3] = {
.hwport = 3,
.flags = 0,
.ucon = SMDK4X12_UCON_DEFAULT,
.ulcon = SMDK4X12_ULCON_DEFAULT,
.ufcon = SMDK4X12_UFCON_DEFAULT,
},
};
static struct resource smdk4x12_smsc911x_resources[] = {
[0] = {
.start = EXYNOS4_PA_SROM_BANK(1),
.end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_EINT(5),
.end = IRQ_EINT(5),
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
},
};
static struct smsc911x_platform_config smsc9215_config = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
.flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
.phy_interface = PHY_INTERFACE_MODE_MII,
.mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
};
static struct platform_device smdk4x12_smsc911x = {
.name = "smsc911x",
.id = -1,
.num_resources = ARRAY_SIZE(smdk4x12_smsc911x_resources),
.resource = smdk4x12_smsc911x_resources,
.dev = {
.platform_data = &smsc9215_config,
},
};
#ifdef CONFIG_EXYNOS_MEDIA_DEVICE
struct platform_device exynos_device_md0 = {
.name = "exynos-mdev",
.id = -1,
};
#endif
#define WRITEBACK_ENABLED
#if defined(CONFIG_VIDEO_FIMC) || defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
/*
* External camera reset
* Because the most of cameras take i2c bus signal, so that
* you have to reset at the boot time for other i2c slave devices.
* This function also called at fimc_init_camera()
* Do optimization for cameras on your platform.
*/
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H2_CSI_C) || defined(CONFIG_S5K3H7_CSI_C) \
|| defined(CONFIG_S5K4E5_CSI_C) || defined(CONFIG_S5K6A3_CSI_C)
static int smdk4x12_cam0_reset(int dummy)
{
int err;
/* Camera A */
err = gpio_request(EXYNOS4_GPX1(2), "GPX1");
if (err)
printk(KERN_ERR "#### failed to request GPX1_2 ####\n");
s3c_gpio_setpull(EXYNOS4_GPX1(2), S3C_GPIO_PULL_NONE);
gpio_direction_output(EXYNOS4_GPX1(2), 0);
gpio_direction_output(EXYNOS4_GPX1(2), 1);
gpio_free(EXYNOS4_GPX1(2));
return 0;
}
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H2_CSI_D) || defined(CONFIG_S5K3H7_CSI_D) \
|| defined(CONFIG_S5K4E5_CSI_D) || defined(CONFIG_S5K6A3_CSI_D)
static int smdk4x12_cam1_reset(int dummy)
{
int err;
/* Camera B */
err = gpio_request(EXYNOS4_GPX1(0), "GPX1");
if (err)
printk(KERN_ERR "#### failed to request GPX1_0 ####\n");
s3c_gpio_setpull(EXYNOS4_GPX1(0), S3C_GPIO_PULL_NONE);
gpio_direction_output(EXYNOS4_GPX1(0), 0);
gpio_direction_output(EXYNOS4_GPX1(0), 1);
gpio_free(EXYNOS4_GPX1(0));
return 0;
}
#endif
#endif
#ifdef CONFIG_VIDEO_FIMC
#ifdef CONFIG_VIDEO_OV5640
#include <media/ov5640.h>
static int ov5640_power_en(int onoff)
{
printk(KERN_DEBUG "ov5640: power %s\n", onoff ? "ON" : "Off");
return 0;
}
static struct ov5640_platform_data ov5640_plat = {
.default_width = 640,
.default_height = 480,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 24000000,
.is_mipi = 0,
.s_power = NULL,
.set_xclk = NULL,
.configure_interface = NULL,
};
static struct i2c_board_info ov5640_sensor_info = {
I2C_BOARD_INFO("ov5640", (0x78 >> 1)),
.platform_data = &ov5640_plat,
};
static const char *ov5640_get_clk_name(void)
{
return "sclk_cam0";
}
static int ov5640_get_i2c_busnum(void)
{
return 0;
}
static struct s3c_platform_camera ov5640 = {
.id = CAMERA_PAR_A,
.type = CAM_TYPE_ITU,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.scanmode = 0,
.i2c_busnum = 0,
.info = &ov5640_sensor_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name = "xusbxti",
.clk_name = "sclk_cam0",
.clk_rate = 24000000,
.line_length = 1920,
.width = 2592,
.height = 1944,
.window = {
.left = 0,
.top = 0,
.width = 2592,
.height = 1944,
},
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
.cam_power = ov5640_power_en,
.get_clk_name = ov5640_get_clk_name,
.get_i2c_busnum = ov5640_get_i2c_busnum,
};
#endif /* End of OV5640 */
#ifdef CONFIG_VIDEO_S5K4BA
static struct s5k4ba_platform_data s5k4ba_plat = {
.default_width = 800,
.default_height = 600,
.pixelformat = V4L2_PIX_FMT_YUYV,
.freq = 24000000,
.is_mipi = 0,
};
static struct i2c_board_info s5k4ba_i2c_info = {
I2C_BOARD_INFO("S5K4BA", 0x2d),
.platform_data = &s5k4ba_plat,
};
static struct s3c_platform_camera s5k4ba = {
#ifdef CONFIG_ITU_A
.id = CAMERA_PAR_A,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_ITU_B
.id = CAMERA_PAR_B,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_ITU,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.info = &s5k4ba_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUYV,
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.line_length = 1920,
.width = 1600,
.height = 1200,
.window = {
.left = 0,
.top = 0,
.width = 1600,
.height = 1200,
},
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.reset_camera = 1,
.initialized = 0,
};
#endif
/* 2 MIPI Cameras */
#ifdef CONFIG_VIDEO_S5K4EA
static struct s5k4ea_platform_data s5k4ea_plat = {
.default_width = 1920,
.default_height = 1080,
.pixelformat = V4L2_PIX_FMT_UYVY,
.freq = 24000000,
.is_mipi = 1,
};
static struct i2c_board_info s5k4ea_i2c_info = {
I2C_BOARD_INFO("S5K4EA", 0x2d),
.platform_data = &s5k4ea_plat,
};
static struct s3c_platform_camera s5k4ea = {
#ifdef CONFIG_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.info = &s5k4ea_i2c_info,
.pixelformat = V4L2_PIX_FMT_UYVY,
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 32,
/* Polarity */
.inv_pclk = 0,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.initialized = 0,
};
#endif
#ifdef WRITEBACK_ENABLED
static struct i2c_board_info writeback_i2c_info = {
I2C_BOARD_INFO("WriteBack", 0x0),
};
static struct s3c_platform_camera writeback = {
.id = CAMERA_WB,
.fmt = ITU_601_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_CBYCRY,
.i2c_busnum = 0,
.info = &writeback_i2c_info,
.pixelformat = V4L2_PIX_FMT_YUV444,
.line_length = 800,
.width = 480,
.height = 800,
.window = {
.left = 0,
.top = 0,
.width = 480,
.height = 800,
},
.initialized = 0,
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
static struct i2c_board_info s5k3h2_sensor_info = {
.type = "S5K3H2",
};
static struct s3c_platform_camera s5k3h2 = {
#ifdef CONFIG_S5K3H2_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k3h2_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K3H2_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K3H2_CSI_C
.sensor_index = 1,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.sensor_index = 101,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct i2c_board_info s5k3h7_sensor_info = {
.type = "S5K3H7",
};
static struct s3c_platform_camera s5k3h7 = {
#ifdef CONFIG_S5K3H7_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k3h7_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K3H7_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K3H7_CSI_C
.sensor_index = 4,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.sensor_index = 104,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct i2c_board_info s5k4e5_sensor_info = {
.type = "S5K4E5",
};
static struct s3c_platform_camera s5k4e5 = {
#ifdef CONFIG_S5K4E5_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k4e5_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K4E5_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K4E5_CSI_C
.sensor_index = 3,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.sensor_index = 103,
#endif
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct i2c_board_info s5k6a3_sensor_info = {
.type = "S5K6A3",
};
static struct s3c_platform_camera s5k6a3 = {
#ifdef CONFIG_S5K6A3_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k6a3_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 1,
.mipi_settle = 18,
.mipi_align = 24,
.initialized = 0,
#ifdef CONFIG_S5K6A3_CSI_C
.flite_id = FLITE_IDX_A,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.flite_id = FLITE_IDX_B,
#endif
.use_isp = true,
#ifdef CONFIG_S5K6A3_CSI_C
.sensor_index = 2,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.sensor_index = 102,
#endif
};
#endif
#if defined(CONFIG_VIDEO_S5K6A3) && defined(CONFIG_S5K6A3_CSI_D)
static struct i2c_board_info s5k6a3_fd_sensor_info = {
.type = "S5K6A3_FD",
};
static struct s3c_platform_camera s5k6a3_fd = {
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.cam_power = smdk4x12_cam1_reset,
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_RAW10,
.info = &s5k6a3_fd_sensor_info,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.pixelformat = V4L2_PIX_FMT_UYVY,
.line_length = 1920,
.width = 1920,
.height = 1080,
.window = {
.left = 0,
.top = 0,
.width = 1920,
.height = 1080,
},
.srclk_name = "xusbxti",
.clk_rate = 24000000,
.mipi_lanes = 1,
.mipi_settle = 18,
.mipi_align = 24,
.initialized = 0,
.flite_id = FLITE_IDX_B,
.use_isp = true,
.sensor_index = 200
};
#endif
#endif
/* legacy M5MOLS Camera driver configuration */
#ifdef CONFIG_VIDEO_M5MO
#define CAM_CHECK_ERR_RET(x, msg) \
if (unlikely((x) < 0)) { \
printk(KERN_ERR "\nfail to %s: err = %d\n", msg, x); \
return x; \
}
#define CAM_CHECK_ERR(x, msg) \
if (unlikely((x) < 0)) { \
printk(KERN_ERR "\nfail to %s: err = %d\n", msg, x); \
}
static int m5mo_config_isp_irq(void)
{
s3c_gpio_cfgpin(EXYNOS4_GPX3(3), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX3(3), S3C_GPIO_PULL_NONE);
return 0;
}
static struct m5mo_platform_data m5mo_plat = {
.default_width = 640, /* 1920 */
.default_height = 480, /* 1080 */
.pixelformat = V4L2_PIX_FMT_UYVY,
.freq = 24000000,
.is_mipi = 1,
.config_isp_irq = m5mo_config_isp_irq,
.irq = IRQ_EINT(27),
};
static struct i2c_board_info m5mo_i2c_info = {
I2C_BOARD_INFO("M5MO", 0x1F),
.platform_data = &m5mo_plat,
.irq = IRQ_EINT(27),
};
static struct s3c_platform_camera m5mo = {
#ifdef CONFIG_CSI_C
.id = CAMERA_CSI_C,
.clk_name = "sclk_cam0",
.i2c_busnum = 4,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = CAMERA_CSI_D,
.clk_name = "sclk_cam1",
.i2c_busnum = 5,
.cam_power = smdk4x12_cam1_reset,
#endif
.type = CAM_TYPE_MIPI,
.fmt = MIPI_CSI_YCBCR422_8BIT,
.order422 = CAM_ORDER422_8BIT_YCBYCR,
.info = &m5mo_i2c_info,
.pixelformat = V4L2_PIX_FMT_UYVY,
.srclk_name = "xusbxti", /* "mout_mpll" */
.clk_rate = 24000000, /* 48000000 */
.line_length = 1920,
.width = 640,
.height = 480,
.window = {
.left = 0,
.top = 0,
.width = 640,
.height = 480,
},
.mipi_lanes = 2,
.mipi_settle = 12,
.mipi_align = 32,
/* Polarity */
.inv_pclk = 1,
.inv_vsync = 1,
.inv_href = 0,
.inv_hsync = 0,
.reset_camera = 0,
.initialized = 0,
};
#endif
/* Interface setting */
static struct s3c_platform_fimc fimc_plat = {
#ifdef CONFIG_ITU_A
.default_cam = CAMERA_PAR_A,
#endif
#ifdef CONFIG_ITU_B
.default_cam = CAMERA_PAR_B,
#endif
#ifdef CONFIG_CSI_C
.default_cam = CAMERA_CSI_C,
#endif
#ifdef CONFIG_CSI_D
.default_cam = CAMERA_CSI_D,
#endif
#ifdef WRITEBACK_ENABLED
.default_cam = CAMERA_WB,
#endif
#ifdef CONFIG_VIDEO_OV5640
.default_cam = CAMERA_PAR_A,
#endif
.camera = {
#ifdef CONFIG_VIDEO_OV5640
&ov5640,
#endif
#ifdef CONFIG_VIDEO_S5K4BA
&s5k4ba,
#endif
#ifdef CONFIG_VIDEO_S5K4EA
&s5k4ea,
#endif
#ifdef CONFIG_VIDEO_M5MO
&m5mo,
#endif
#ifdef CONFIG_VIDEO_S5K3H2
&s5k3h2,
#endif
#ifdef CONFIG_VIDEO_S5K3H7
&s5k3h7,
#endif
#ifdef CONFIG_VIDEO_S5K4E5
&s5k4e5,
#endif
#ifdef CONFIG_VIDEO_S5K6A3
&s5k6a3,
#endif
#ifdef WRITEBACK_ENABLED
&writeback,
#endif
#if defined(CONFIG_VIDEO_S5K6A3) && defined(CONFIG_S5K6A3_CSI_D)
&s5k6a3_fd,
#endif
},
.hw_ver = 0x51,
};
#endif /* CONFIG_VIDEO_FIMC */
/* for mainline fimc interface */
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
#ifdef WRITEBACK_ENABLED
struct writeback_mbus_platform_data {
int id;
struct v4l2_mbus_framefmt fmt;
};
static struct i2c_board_info __initdata writeback_info = {
I2C_BOARD_INFO("writeback", 0x0),
};
#endif
#ifdef CONFIG_VIDEO_S5K4BA
static struct s5k4ba_mbus_platform_data s5k4ba_mbus_plat = {
.id = 0,
.fmt = {
.width = 1600,
.height = 1200,
/*.code = V4L2_MBUS_FMT_UYVY8_2X8, */
.code = V4L2_MBUS_FMT_VYUY8_2X8,
},
.clk_rate = 24000000UL,
#ifdef CONFIG_ITU_A
.set_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_ITU_B
.set_power = smdk4x12_cam1_reset,
#endif
};
static struct i2c_board_info s5k4ba_info = {
I2C_BOARD_INFO("S5K4BA", 0x2d),
.platform_data = &s5k4ba_mbus_plat,
};
#endif
/* 2 MIPI Cameras */
#ifdef CONFIG_VIDEO_S5K4EA
static struct s5k4ea_mbus_platform_data s5k4ea_mbus_plat = {
#ifdef CONFIG_CSI_C
.id = 0,
.set_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_CSI_D
.id = 1,
.set_power = smdk4x12_cam1_reset,
#endif
.fmt = {
.width = 1920,
.height = 1080,
.code = V4L2_MBUS_FMT_VYUY8_2X8,
},
.clk_rate = 24000000UL,
};
static struct i2c_board_info s5k4ea_info = {
I2C_BOARD_INFO("S5K4EA", 0x2d),
.platform_data = &s5k4ea_mbus_plat,
};
#endif
#ifdef CONFIG_VIDEO_M5MOLS
static struct m5mols_platform_data m5mols_platdata = {
#ifdef CONFIG_CSI_C
.gpio_rst = EXYNOS4_GPX1(2), /* ISP_RESET */
#endif
#ifdef CONFIG_CSI_D
.gpio_rst = EXYNOS4_GPX1(0), /* ISP_RESET */
#endif
.enable_rst = true, /* positive reset */
.irq = IRQ_EINT(27),
};
static struct i2c_board_info m5mols_board_info = {
I2C_BOARD_INFO("M5MOLS", 0x1F),
.platform_data = &m5mols_platdata,
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
static struct i2c_board_info s5k3h2_sensor_info = {
.type = "S5K3H2",
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct i2c_board_info s5k3h7_sensor_info = {
.type = "S5K3H7",
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct i2c_board_info s5k4e5_sensor_info = {
.type = "S5K4E5",
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct i2c_board_info s5k6a3_sensor_info = {
.type = "S5K6A3",
};
#endif
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
/* This is for platdata of fimc-lite */
#ifdef CONFIG_VIDEO_S5K3H2
static struct s3c_platform_camera s5k3h2 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K3H7
static struct s3c_platform_camera s5k3h7 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K4E5
static struct s3c_platform_camera s5k4e5 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#ifdef CONFIG_VIDEO_S5K6A3
static struct s3c_platform_camera s5k6a3 = {
.type = CAM_TYPE_MIPI,
.use_isp = true,
.inv_pclk = 0,
.inv_vsync = 0,
.inv_href = 0,
.inv_hsync = 0,
};
#endif
#endif
#endif /* CONFIG_VIDEO_SAMSUNG_S5P_FIMC */
#ifdef CONFIG_S3C64XX_DEV_SPI
static struct s3c64xx_spi_csinfo spi0_csi[] = {
[0] = {
.line = EXYNOS4_GPB(1),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi0_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 0,
.chip_select = 0,
.mode = SPI_MODE_0,
.controller_data = &spi0_csi[0],
}
};
#ifndef CONFIG_FB_S5P_LMS501KF03
static struct s3c64xx_spi_csinfo spi1_csi[] = {
[0] = {
.line = EXYNOS4_GPB(5),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi1_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 1,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = &spi1_csi[0],
}
};
#endif
static struct s3c64xx_spi_csinfo spi2_csi[] = {
[0] = {
.line = EXYNOS4_GPC1(2),
.set_level = gpio_set_value,
.fb_delay = 0x2,
},
};
static struct spi_board_info spi2_board_info[] __initdata = {
{
.modalias = "spidev",
.platform_data = NULL,
.max_speed_hz = 10*1000*1000,
.bus_num = 2,
.chip_select = 0,
.mode = SPI_MODE_0,
.controller_data = &spi2_csi[0],
}
};
#endif
#ifdef CONFIG_FB_S3C
#if defined(CONFIG_LCD_AMS369FG06)
static int lcd_power_on(struct lcd_device *ld, int enable)
{
return 1;
}
static int reset_lcd(struct lcd_device *ld)
{
int err = 0;
err = gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
if (err) {
printk(KERN_ERR "failed to request GPX0 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4_GPX0(6), 0);
mdelay(1);
gpio_set_value(EXYNOS4_GPX0(6), 1);
gpio_free(EXYNOS4_GPX0(6));
return 1;
}
static struct lcd_platform_data ams369fg06_platform_data = {
.reset = reset_lcd,
.power_on = lcd_power_on,
.lcd_enabled = 0,
.reset_delay = 100, /* 100ms */
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "ams369fg06",
.platform_data = (void *)&ams369fg06_platform_data,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data ams369fg06_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s5p_device_fimd0.dev,
.platform_data = &ams369fg06_spi_gpio_data,
},
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 9,
.right_margin = 9,
.upper_margin = 5,
.lower_margin = 5,
.hsync_len = 2,
.vsync_len = 2,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_LMS501KF03)
static int lcd_power_on(struct lcd_device *ld, int enable)
{
return 1;
}
static int reset_lcd(struct lcd_device *ld)
{
int err = 0;
if (samsung_board_rev_is_0_1()) {
err = gpio_request_one(EXYNOS4212_GPM3(6),
GPIOF_OUT_INIT_HIGH, "GPM3");
if (err) {
printk(KERN_ERR "failed to request GPM3 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4212_GPM3(6), 0);
mdelay(1);
gpio_set_value(EXYNOS4212_GPM3(6), 1);
gpio_free(EXYNOS4212_GPM3(6));
} else {
err = gpio_request_one(EXYNOS4_GPX1(5),
GPIOF_OUT_INIT_HIGH, "GPX1");
if (err) {
printk(KERN_ERR "failed to request GPX1 for "
"lcd reset control\n");
return err;
}
gpio_set_value(EXYNOS4_GPX1(5), 0);
mdelay(1);
gpio_set_value(EXYNOS4_GPX1(5), 1);
gpio_free(EXYNOS4_GPX1(5));
}
return 1;
}
static struct lcd_platform_data lms501kf03_platform_data = {
.reset = reset_lcd,
.power_on = lcd_power_on,
.lcd_enabled = 0,
.reset_delay = 100, /* 100ms */
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "lms501kf03",
.platform_data = (void *)&lms501kf03_platform_data,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data lms501kf03_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s5p_device_fimd0.dev,
.platform_data = &lms501kf03_spi_gpio_data,
},
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 8, /* HBPD */
.right_margin = 8, /* HFPD */
.upper_margin = 6, /* VBPD */
.lower_margin = 6, /* VFPD */
.hsync_len = 6, /* HSPW */
.vsync_len = 4, /* VSPW */
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_WA101S)
static void lcd_wa101s_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
if (power) {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
} else {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
}
}
static struct plat_lcd_data smdk4x12_lcd_wa101s_data = {
.set_power = lcd_wa101s_set_power,
};
static struct platform_device smdk4x12_lcd_wa101s = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_lcd_wa101s_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 80,
.right_margin = 48,
.upper_margin = 14,
.lower_margin = 3,
.hsync_len = 32,
.vsync_len = 5,
.xres = 1360, /* real size : 1366 */
.yres = 768,
},
.virtual_x = 1360, /* real size : 1366 */
.virtual_y = 768 * 2,
.width = 223,
.height = 125,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_LTE480WV)
static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
if (power) {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
/* fire nRESET on power up */
gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
mdelay(100);
gpio_set_value(EXYNOS4_GPX0(6), 0);
mdelay(10);
gpio_set_value(EXYNOS4_GPX0(6), 1);
mdelay(10);
gpio_free(EXYNOS4_GPX0(6));
} else {
#if !defined(CONFIG_BACKLIGHT_PWM)
gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
gpio_free(EXYNOS4_GPD0(1));
#endif
}
}
static struct plat_lcd_data smdk4x12_lcd_lte480wv_data = {
.set_power = lcd_lte480wv_set_power,
};
static struct platform_device smdk4x12_lcd_lte480wv = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_lcd_lte480wv_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 13,
.right_margin = 8,
.upper_margin = 7,
.lower_margin = 5,
.hsync_len = 3,
.vsync_len = 1,
.xres = 800,
.yres = 480,
},
.virtual_x = 800,
.virtual_y = 960,
.width = 104,
.height = 62,
.max_bpp = 32,
.default_bpp = 24,
};
#elif defined(CONFIG_LCD_MIPI_S6E63M0)
static void mipi_lcd_set_power(struct plat_lcd_data *pd,
unsigned int power)
{
gpio_request_one(EXYNOS4_GPX2(7), GPIOF_OUT_INIT_HIGH, "GPX2");
mdelay(100);
if (power) {
/* fire nRESET on power up */
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
} else {
/* fire nRESET on power off */
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
}
}
static struct plat_lcd_data smdk4x12_mipi_lcd_data = {
.set_power = mipi_lcd_set_power,
};
static struct platform_device smdk4x12_mipi_lcd = {
.name = "platform-lcd",
.dev.parent = &s5p_device_fimd0.dev,
.dev.platform_data = &smdk4x12_mipi_lcd_data,
};
static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win1 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
static struct s3c_fb_pd_win smdk4x12_fb_win2 = {
.win_mode = {
.left_margin = 0x16,
.right_margin = 0x16,
.upper_margin = 0x1,
.lower_margin = 0x28,
.hsync_len = 0x2,
.vsync_len = 0x3,
.xres = 480,
.yres = 800,
},
.virtual_x = 480,
.virtual_y = 1600,
.width = 48,
.height = 80,
.max_bpp = 32,
.default_bpp = 24,
};
#endif
static struct s3c_fb_platdata smdk4x12_lcd0_pdata __initdata = {
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_WA101S) || \
defined(CONFIG_LCD_LTE480WV) || defined(CONFIG_LCD_LMS501KF03) || \
defined(CONFIG_LCD_MIPI_S6E63M0)
.win[0] = &smdk4x12_fb_win0,
.win[1] = &smdk4x12_fb_win1,
.win[2] = &smdk4x12_fb_win2,
#endif
.default_win = 2,
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
#if defined(CONFIG_LCD_AMS369FG06)
.vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN |
VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_LMS501KF03)
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_WA101S)
.vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_HSYNC |
VIDCON1_INV_VSYNC,
#elif defined(CONFIG_LCD_LTE480WV)
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
#endif
.setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
};
#endif
#ifdef CONFIG_FB_S5P
#ifdef CONFIG_FB_S5P_TINY4412
static struct s3c_platform_fb tiny4412_fb_data __initdata = {
.hw_ver = 0x70,
.clk_name = "sclk_lcd",
.nr_wins = 5,
.default_win = CONFIG_FB_S5P_DEFAULT_WINDOW,
.swap = FB_SWAP_HWORD | FB_SWAP_WORD,
};
#endif
#ifdef CONFIG_FB_S5P_LMS501KF03
static struct s3c_platform_fb lms501kf03_data __initdata = {
.hw_ver = 0x70,
.clk_name = "sclk_lcd",
.nr_wins = 5,
.default_win = CONFIG_FB_S5P_DEFAULT_WINDOW,
.swap = FB_SWAP_HWORD | FB_SWAP_WORD,
};
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "lms501kf03",
.platform_data = NULL,
.max_speed_hz = 1200000,
.bus_num = LCD_BUS_NUM,
.chip_select = 0,
.mode = SPI_MODE_3,
.controller_data = (void *)DISPLAY_CS,
}
};
static struct spi_gpio_platform_data lms501kf03_spi_gpio_data = {
.sck = DISPLAY_CLK,
.mosi = DISPLAY_SI,
.miso = -1,
.num_chipselect = 1,
};
static struct platform_device s3c_device_spi_gpio = {
.name = "spi_gpio",
.id = LCD_BUS_NUM,
.dev = {
.parent = &s3c_device_fb.dev,
.platform_data = &lms501kf03_spi_gpio_data,
},
};
#elif defined(CONFIG_FB_S5P_DUMMY_MIPI_LCD)
#define LCD_BUS_NUM 3
#define DISPLAY_CS EXYNOS4_GPB(5)
#define DISPLAY_CLK EXYNOS4_GPB(4)
#define DISPLAY_SI EXYNOS4_GPB(7)
static struct s3cfb_lcd dummy_mipi_lcd = {
.width = 480,
.height = 800,
.bpp = 24,
.freq = 60,
.timing = {
.h_fp = 0x16,
.h_bp = 0x16,
.h_sw = 0x2,
.v_fp = 0x28,
.v_fpe = 2,
.v_bp = 0x1,
.v_bpe = 1,
.v_sw = 3,
.cmd_allow_len = 0x4,
},
.polarity = {
.rise_vclk = 0,
.inv_hsync = 0,
.inv_vsync = 0,
.inv_vden = 0,
},
};
static struct s3c_platform_fb fb_platform_data __initdata = {
.hw_ver = 0x70,
.clk_name = "sclk_lcd",
.nr_wins = 5,
.default_win = CONFIG_FB_S5P_DEFAULT_WINDOW,
.swap = FB_SWAP_HWORD | FB_SWAP_WORD,
};
static void lcd_cfg_gpio(void)
{
return;
}
static int reset_lcd(void)
{
int err = 0;
/* fire nRESET on power off */
err = gpio_request(EXYNOS4_GPX3(1), "GPX3");
if (err) {
printk(KERN_ERR "failed to request GPX0 for lcd reset control\n");
return err;
}
#ifdef CONFIG_CPU_EXYNOS4212
gpio_direction_output(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX2(7), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX2(7));
#else
gpio_direction_output(EXYNOS4_GPX3(1), 1);
mdelay(100);
gpio_set_value(EXYNOS4_GPX3(1), 0);
mdelay(100);
gpio_set_value(EXYNOS4_GPX3(1), 1);
mdelay(100);
gpio_free(EXYNOS4_GPX3(1));
#endif
return 0;
}
static int lcd_power_on(void *pdev, int enable)
{
return 1;
}
static void __init mipi_fb_init(void)
{
struct s5p_platform_dsim *dsim_pd = NULL;
struct mipi_ddi_platform_data *mipi_ddi_pd = NULL;
struct dsim_lcd_config *dsim_lcd_info = NULL;
/* gpio pad configuration for rgb and spi interface. */
lcd_cfg_gpio();
/*
* register lcd panel data.
*/
dsim_pd = (struct s5p_platform_dsim *)
s5p_device_dsim.dev.platform_data;
strcpy(dsim_pd->lcd_panel_name, "dummy_mipi_lcd");
dsim_lcd_info = dsim_pd->dsim_lcd_info;
dsim_lcd_info->lcd_panel_info = (void *)&dummy_mipi_lcd;
mipi_ddi_pd = (struct mipi_ddi_platform_data *)
dsim_lcd_info->mipi_ddi_pd;
mipi_ddi_pd->lcd_reset = reset_lcd;
mipi_ddi_pd->lcd_power_on = lcd_power_on;
platform_device_register(&s5p_device_dsim);
s3cfb_set_platdata(&fb_platform_data);
printk(KERN_INFO "platform data of %s lcd panel has been registered.\n",
dsim_pd->lcd_panel_name);
}
#endif
#endif
static int exynos4_notifier_call(struct notifier_block *this,
unsigned long code, void *_cmd)
{
int mode = 0;
if ((code == SYS_RESTART) && _cmd)
if (!strcmp((char *)_cmd, "recovery"))
mode = 0xf;
__raw_writel(mode, REG_INFORM4);
return NOTIFY_DONE;
}
static struct notifier_block exynos4_reboot_notifier = {
.notifier_call = exynos4_notifier_call,
};
#if defined(CONFIG_BCMDHD) || defined(CONFIG_BCM4334)
/* Broadcom WI-FI support */
static DEFINE_MUTEX(notify_lock);
#define DEFINE_MMC_CARD_NOTIFIER(num) \
static void (*hsmmc##num##_notify_func)(struct platform_device *, int state); \
static int ext_cd_init_hsmmc##num(void (*notify_func)( \
struct platform_device *, int state)) \
{ \
mutex_lock(¬ify_lock); \
WARN_ON(hsmmc##num##_notify_func); \
hsmmc##num##_notify_func = notify_func; \
mutex_unlock(¬ify_lock); \
return 0; \
} \
static int ext_cd_cleanup_hsmmc##num(void (*notify_func)( \
struct platform_device *, int state)) \
{ \
mutex_lock(¬ify_lock); \
WARN_ON(hsmmc##num##_notify_func != notify_func); \
hsmmc##num##_notify_func = NULL; \
mutex_unlock(¬ify_lock); \
return 0; \
}
#ifdef CONFIG_S3C_DEV_HSMMC3
DEFINE_MMC_CARD_NOTIFIER(3)
#endif
/*
* call this when you need sd stack to recognize insertion or removal of card
* that can't be told by SDHCI regs
*/
void mmc_force_presence_change_onoff(struct platform_device *pdev, int val)
{
void (*notify_func)(struct platform_device *, int state) = NULL;
mutex_lock(¬ify_lock);
#ifdef CONFIG_S3C_DEV_HSMMC3
if (pdev == &s3c_device_hsmmc3)
notify_func = hsmmc3_notify_func;
#endif
if (notify_func)
notify_func(pdev, val);
else
pr_warn("%s: called for device with no notifier\n", __func__);
mutex_unlock(¬ify_lock);
}
EXPORT_SYMBOL_GPL(mmc_force_presence_change_onoff);
#endif
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
static void exynos_dwmci_cfg_gpio(int width)
{
unsigned int gpio;
for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
switch (width) {
case MMC_BUS_WIDTH_8:
for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
case MMC_BUS_WIDTH_4:
for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) {
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
}
break;
case MMC_BUS_WIDTH_1:
gpio = EXYNOS4_GPK0(3);
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
default:
break;
}
}
static struct dw_mci_board exynos_dwmci_pdata __initdata = {
.num_slots = 1,
.quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION | DW_MCI_QUIRK_HIGHSPEED,
.bus_hz = 100 * 1000 * 1000,
.caps = MMC_CAP_UHS_DDR50 | MMC_CAP_1_8V_DDR |
MMC_CAP_8_BIT_DATA | MMC_CAP_CMD23,
.fifo_depth = 0x80,
.detect_delay_ms = 200,
.hclk_name = "dwmci",
.cclk_name = "sclk_dwmci",
.cfg_gpio = exynos_dwmci_cfg_gpio,
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
static struct s3c_sdhci_platdata smdk4x12_hsmmc0_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#endif
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
static struct s3c_sdhci_platdata smdk4x12_hsmmc1_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
.cd_type = S3C_SDHCI_CD_INTERNAL,
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#endif
};
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = {
#if defined(CONFIG_BCMDHD) || defined(CONFIG_BCM4334)
.cd_type = S3C_SDHCI_CD_EXTERNAL,
.pm_flags = MMC_PM_KEEP_POWER | MMC_PM_IGNORE_PM_NOTIFY,
.ext_cd_init = ext_cd_init_hsmmc3,
.ext_cd_cleanup = ext_cd_cleanup_hsmmc3,
#else
.cd_type = S3C_SDHCI_CD_PERMANENT,
#endif
.clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
};
#endif
#ifdef CONFIG_S5P_DEV_MSHC
static struct s3c_mshci_platdata exynos4_mshc_pdata __initdata = {
.cd_type = S3C_MSHCI_CD_PERMANENT,
.has_wp_gpio = true,
.wp_gpio = 0xffffffff,
#if defined(CONFIG_EXYNOS4_MSHC_8BIT) && \
defined(CONFIG_EXYNOS4_MSHC_DDR)
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA | MMC_CAP_1_8V_DDR |
MMC_CAP_UHS_DDR50,
#elif defined(CONFIG_EXYNOS4_MSHC_8BIT)
.max_width = 8,
.host_caps = MMC_CAP_8_BIT_DATA,
#elif defined(CONFIG_EXYNOS4_MSHC_DDR)
.host_caps = MMC_CAP_1_8V_DDR | MMC_CAP_UHS_DDR50,
#endif
};
#endif
static void __init tiny4412_usbh_reset(void)
{
int err;
#define GPIO_USBH_RESET EXYNOS4212_GPM2(4)
err = gpio_request_one(GPIO_USBH_RESET,
GPIOF_OUT_INIT_HIGH, "USBH_RESET");
if (err)
pr_err("failed to request GPM2_4 for USB reset control\n");
s3c_gpio_setpull(GPIO_USBH_RESET, S3C_GPIO_PULL_UP);
gpio_set_value(GPIO_USBH_RESET, 0);
mdelay(1);
gpio_set_value(GPIO_USBH_RESET, 1);
gpio_free(GPIO_USBH_RESET);
}
#ifdef CONFIG_USB_EHCI_S5P
static struct s5p_ehci_platdata smdk4x12_ehci_pdata;
static void __init smdk4x12_ehci_init(void)
{
struct s5p_ehci_platdata *pdata = &smdk4x12_ehci_pdata;
s5p_ehci_set_platdata(pdata);
}
#endif
#ifdef CONFIG_USB_OHCI_S5P
static struct s5p_ohci_platdata smdk4x12_ohci_pdata;
static void __init smdk4x12_ohci_init(void)
{
struct s5p_ohci_platdata *pdata = &smdk4x12_ohci_pdata;
s5p_ohci_set_platdata(pdata);
}
#endif
/* USB GADGET */
#ifdef CONFIG_USB_GADGET
static struct s5p_usbgadget_platdata smdk4x12_usbgadget_pdata;
static void __init smdk4x12_usbgadget_init(void)
{
struct s5p_usbgadget_platdata *pdata = &smdk4x12_usbgadget_pdata;
s5p_usbgadget_set_platdata(pdata);
}
#endif
/* max8952 */
#if 0
static struct regulator_consumer_supply max8952_supply =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_init_data max8952_init_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1100000,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.uV = 1100000,
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8952_supply,
};
static struct max8649_platform_data exynos4_max8952_info = {
.mode = 1, /* VID1 = 0, VID0 = 1 */
.extclk = 0,
.ramp_timing = MAX8649_RAMP_32MV,
.regulator = &max8952_init_data,
};
#endif
/* max8997 */
#if 0
static struct regulator_consumer_supply max8997_buck1 =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply max8997_buck2 =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply max8997_buck3 =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_consumer_supply __initdata ldo2_consumer =
REGULATOR_SUPPLY("vdd_ldo2", NULL);
static struct regulator_consumer_supply __initdata ldo3_consumer =
REGULATOR_SUPPLY("vdd_ldo3", NULL);
static struct regulator_consumer_supply __initdata ldo4_consumer =
REGULATOR_SUPPLY("vdd_ldo4", NULL);
static struct regulator_consumer_supply __initdata ldo5_consumer =
REGULATOR_SUPPLY("vdd_ldo5", NULL);
static struct regulator_consumer_supply __initdata ldo6_consumer =
REGULATOR_SUPPLY("vdd_ldo6", NULL);
static struct regulator_consumer_supply __initdata ldo7_consumer =
REGULATOR_SUPPLY("vdd_ldo7", NULL);
static struct regulator_consumer_supply __initdata ldo8_consumer =
REGULATOR_SUPPLY("vdd_ldo8", NULL);
static struct regulator_consumer_supply __initdata ldo9_consumer =
REGULATOR_SUPPLY("vdd_ldo9", NULL);
static struct regulator_consumer_supply __initdata ldo10_consumer =
REGULATOR_SUPPLY("vdd_ldo10", NULL);
static struct regulator_consumer_supply __initdata ldo11_consumer =
REGULATOR_SUPPLY("vdd_ldo11", NULL);
static struct regulator_consumer_supply __initdata ldo12_consumer =
REGULATOR_SUPPLY("vdd_adc", NULL);
static struct regulator_consumer_supply __initdata ldo14_consumer =
REGULATOR_SUPPLY("vdd_ldo14", NULL);
static struct regulator_consumer_supply __initdata ldo21_consumer =
REGULATOR_SUPPLY("vdd_ldo21", NULL);
static struct regulator_init_data __initdata max8997_ldo2_data = {
.constraints = {
.name = "vdd_ldo2 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo2_consumer,
};
static struct regulator_init_data __initdata max8997_ldo3_data = {
.constraints = {
.name = "vdd_ldo3 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo3_consumer,
};
static struct regulator_init_data __initdata max8997_ldo4_data = {
.constraints = {
.name = "vdd_ldo4 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo4_consumer,
};
static struct regulator_init_data __initdata max8997_ldo5_data = {
.constraints = {
.name = "vdd_ldo5 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo5_consumer,
};
static struct regulator_init_data __initdata max8997_ldo6_data = {
.constraints = {
.name = "vdd_ldo6 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo6_consumer,
};
static struct regulator_init_data __initdata max8997_ldo7_data = {
.constraints = {
.name = "vdd_ldo7 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo7_consumer,
};
static struct regulator_init_data __initdata max8997_ldo8_data = {
.constraints = {
.name = "vdd_ldo8 range",
.min_uV = 3300000,
.max_uV = 3300000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo8_consumer,
};
static struct regulator_init_data __initdata max8997_ldo9_data = {
.constraints = {
.name = "vdd_ldo9 range",
.min_uV = 2800000,
.max_uV = 2800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo9_consumer,
};
static struct regulator_init_data __initdata max8997_ldo10_data = {
.constraints = {
.name = "vdd_ldo10 range",
.min_uV = 1000000,
.max_uV = 1000000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo10_consumer,
};
static struct regulator_init_data __initdata max8997_ldo11_data = {
.constraints = {
.name = "vdd_ldo11 range",
.min_uV = 2800000,
.max_uV = 2800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo11_consumer,
};
static struct regulator_init_data __initdata max8997_ldo12_data = {
.constraints = {
.name = "vdd_adc range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo12_consumer,
};
static struct regulator_init_data __initdata max8997_ldo14_data = {
.constraints = {
.name = "vdd_ldo14 range",
.min_uV = 1800000,
.max_uV = 1800000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo14_consumer,
};
static struct regulator_init_data __initdata max8997_ldo21_data = {
.constraints = {
.name = "vdd_ldo21 range",
.min_uV = 1200000,
.max_uV = 1200000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &ldo21_consumer,
};
static struct regulator_init_data __initdata max8997_buck1_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1500000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck1,
};
static struct regulator_init_data __initdata max8997_buck2_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck2,
};
static struct regulator_init_data __initdata max8997_buck3_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 800000,
.max_uV = 1200000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max8997_buck3,
};
static struct max8997_regulator_data __initdata max8997_regulators[] = {
{ MAX8997_LDO2, &max8997_ldo2_data, },
{ MAX8997_LDO3, &max8997_ldo3_data, },
{ MAX8997_LDO4, &max8997_ldo4_data, },
{ MAX8997_LDO5, &max8997_ldo5_data, },
{ MAX8997_LDO6, &max8997_ldo6_data, },
{ MAX8997_LDO7, &max8997_ldo7_data, },
{ MAX8997_LDO8, &max8997_ldo8_data, },
{ MAX8997_LDO9, &max8997_ldo9_data, },
{ MAX8997_LDO10, &max8997_ldo10_data, },
{ MAX8997_LDO11, &max8997_ldo11_data, },
{ MAX8997_LDO12, &max8997_ldo12_data, },
{ MAX8997_LDO14, &max8997_ldo14_data, },
{ MAX8997_LDO21, &max8997_ldo21_data, },
{ MAX8997_BUCK1, &max8997_buck1_data, },
{ MAX8997_BUCK2, &max8997_buck2_data, },
{ MAX8997_BUCK3, &max8997_buck3_data, },
};
static struct max8997_platform_data __initdata exynos4_max8997_info = {
.num_regulators = ARRAY_SIZE(max8997_regulators),
.regulators = max8997_regulators,
.buck1_voltage[0] = 1300000, /* 1.25V */
.buck1_voltage[1] = 1100000, /* 1.1V */
.buck1_voltage[2] = 1100000, /* 1.1V */
.buck1_voltage[3] = 1100000, /* 1.1V */
.buck1_voltage[4] = 1100000, /* 1.1V */
.buck1_voltage[5] = 1100000, /* 1.1V */
.buck1_voltage[6] = 1000000, /* 1.0V */
.buck1_voltage[7] = 950000, /* 0.95V */
.buck2_voltage[0] = 1037500, /* 1.0375V */
.buck2_voltage[1] = 1000000, /* 1.0V */
.buck2_voltage[2] = 950000, /* 0.95V */
.buck2_voltage[3] = 900000, /* 0.9V */
.buck2_voltage[4] = 1000000, /* 1.0V */
.buck2_voltage[5] = 1000000, /* 1.0V */
.buck2_voltage[6] = 950000, /* 0.95V */
.buck2_voltage[7] = 900000, /* 0.9V */
.buck5_voltage[0] = 1100000, /* 1.1V */
.buck5_voltage[1] = 1100000, /* 1.1V */
.buck5_voltage[2] = 1100000, /* 1.1V */
.buck5_voltage[3] = 1100000, /* 1.1V */
.buck5_voltage[4] = 1100000, /* 1.1V */
.buck5_voltage[5] = 1100000, /* 1.1V */
.buck5_voltage[6] = 1100000, /* 1.1V */
.buck5_voltage[7] = 1100000, /* 1.1V */
};
#endif
/* max77686 */
#if 0
static struct regulator_consumer_supply max77686_buck1 =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_consumer_supply max77686_buck2 =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply max77686_buck3 =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply max77686_buck4 =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_consumer_supply max77686_ldo11_consumer =
REGULATOR_SUPPLY("vdd_ldo11", NULL);
static struct regulator_consumer_supply max77686_ldo14_consumer =
REGULATOR_SUPPLY("vdd_ldo14", NULL);
static struct regulator_init_data max77686_buck1_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1050000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck1,
};
static struct regulator_init_data max77686_buck2_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1350000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck2,
};
static struct regulator_init_data max77686_buck3_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.always_on = 1,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck3,
};
static struct regulator_init_data max77686_buck4_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 850000,
.max_uV = 1200000,
.boot_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_buck4,
};
static struct regulator_init_data max77686_ldo11_data = {
.constraints = {
.name = "vdd_ldo11 range",
.min_uV = 1900000,
.max_uV = 1900000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_ldo11_consumer,
};
static struct regulator_init_data max77686_ldo14_data = {
.constraints = {
.name = "vdd_ldo14 range",
.min_uV = 1900000,
.max_uV = 1900000,
.apply_uV = 1,
.always_on = 1,
.state_mem = {
.enabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &max77686_ldo14_consumer,
};
static struct max77686_regulator_data max77686_regulators[] = {
{MAX77686_BUCK1, &max77686_buck1_data,},
{MAX77686_BUCK2, &max77686_buck2_data,},
{MAX77686_BUCK3, &max77686_buck3_data,},
{MAX77686_BUCK4, &max77686_buck4_data,},
{MAX77686_LDO11, &max77686_ldo11_data,},
{MAX77686_LDO14, &max77686_ldo14_data,},
};
struct max77686_opmode_data max77686_opmode_data[MAX77686_REG_MAX] = {
[MAX77686_LDO11] = {MAX77686_LDO11, MAX77686_OPMODE_STANDBY},
[MAX77686_LDO14] = {MAX77686_LDO14, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK1] = {MAX77686_BUCK1, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK2] = {MAX77686_BUCK2, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK3] = {MAX77686_BUCK3, MAX77686_OPMODE_STANDBY},
[MAX77686_BUCK4] = {MAX77686_BUCK4, MAX77686_OPMODE_STANDBY},
};
static struct max77686_platform_data exynos4_max77686_info = {
.num_regulators = ARRAY_SIZE(max77686_regulators),
.regulators = max77686_regulators,
.irq_gpio = 0,
.irq_base = 0,
.wakeup = 0,
.opmode_data = max77686_opmode_data,
.ramp_rate = MAX77686_RAMP_RATE_27MV,
.buck2_voltage[0] = 1300000, /* 1.3V */
.buck2_voltage[1] = 1000000, /* 1.0V */
.buck2_voltage[2] = 950000, /* 0.95V */
.buck2_voltage[3] = 900000, /* 0.9V */
.buck2_voltage[4] = 1000000, /* 1.0V */
.buck2_voltage[5] = 1000000, /* 1.0V */
.buck2_voltage[6] = 950000, /* 0.95V */
.buck2_voltage[7] = 900000, /* 0.9V */
.buck3_voltage[0] = 1037500, /* 1.0375V */
.buck3_voltage[1] = 1000000, /* 1.0V */
.buck3_voltage[2] = 950000, /* 0.95V */
.buck3_voltage[3] = 900000, /* 0.9V */
.buck3_voltage[4] = 1000000, /* 1.0V */
.buck3_voltage[5] = 1000000, /* 1.0V */
.buck3_voltage[6] = 950000, /* 0.95V */
.buck3_voltage[7] = 900000, /* 0.9V */
.buck4_voltage[0] = 1100000, /* 1.1V */
.buck4_voltage[1] = 1000000, /* 1.0V */
.buck4_voltage[2] = 950000, /* 0.95V */
.buck4_voltage[3] = 900000, /* 0.9V */
.buck4_voltage[4] = 1000000, /* 1.0V */
.buck4_voltage[5] = 1000000, /* 1.0V */
.buck4_voltage[6] = 950000, /* 0.95V */
.buck4_voltage[7] = 900000, /* 0.9V */
};
#endif
#ifdef CONFIG_REGULATOR_S5M8767
/* S5M8767 Regulator */
static int s5m_cfg_irq(void)
{
/* AP_PMIC_IRQ: EINT26 */
s3c_gpio_cfgpin(EXYNOS4_GPX3(2), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX3(2), S3C_GPIO_PULL_UP);
return 0;
}
static struct regulator_consumer_supply s5m8767_buck1_consumer =
REGULATOR_SUPPLY("vdd_mif", NULL);
static struct regulator_consumer_supply s5m8767_buck2_consumer =
REGULATOR_SUPPLY("vdd_arm", NULL);
static struct regulator_consumer_supply s5m8767_buck3_consumer =
REGULATOR_SUPPLY("vdd_int", NULL);
static struct regulator_consumer_supply s5m8767_buck4_consumer =
REGULATOR_SUPPLY("vdd_g3d", NULL);
static struct regulator_init_data s5m8767_buck1_data = {
.constraints = {
.name = "vdd_mif range",
.min_uV = 800000,
.max_uV = 1100000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck1_consumer,
};
static struct regulator_init_data s5m8767_buck2_data = {
.constraints = {
.name = "vdd_arm range",
.min_uV = 800000,
.max_uV = 1350000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck2_consumer,
};
static struct regulator_init_data s5m8767_buck3_data = {
.constraints = {
.name = "vdd_int range",
.min_uV = 800000,
.max_uV = 1150000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.uV = 1100000,
.mode = REGULATOR_MODE_NORMAL,
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck3_consumer,
};
static struct regulator_init_data s5m8767_buck4_data = {
.constraints = {
.name = "vdd_g3d range",
.min_uV = 850000,
.max_uV = 1200000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = 1,
.consumer_supplies = &s5m8767_buck4_consumer,
};
static struct s5m_regulator_data pegasus_regulators[] = {
{ S5M8767_BUCK1, &s5m8767_buck1_data },
{ S5M8767_BUCK2, &s5m8767_buck2_data },
{ S5M8767_BUCK3, &s5m8767_buck3_data },
{ S5M8767_BUCK4, &s5m8767_buck4_data },
};
static struct s5m_platform_data exynos4_s5m8767_pdata = {
.device_type = S5M8767X,
.irq_base = IRQ_BOARD_START,
.num_regulators = ARRAY_SIZE(pegasus_regulators),
.regulators = pegasus_regulators,
.cfg_pmic_irq = s5m_cfg_irq,
.wakeup = 1,
.opmode_data = s5m8767_opmode_data,
.wtsr_smpl = 1,
.buck2_voltage[0] = 1250000,
.buck2_voltage[1] = 1200000,
.buck2_voltage[2] = 1150000,
.buck2_voltage[3] = 1100000,
.buck2_voltage[4] = 1050000,
.buck2_voltage[5] = 1000000,
.buck2_voltage[6] = 950000,
.buck2_voltage[7] = 900000,
.buck3_voltage[0] = 1100000,
.buck3_voltage[1] = 1000000,
.buck3_voltage[2] = 950000,
.buck3_voltage[3] = 900000,
.buck3_voltage[4] = 1100000,
.buck3_voltage[5] = 1000000,
.buck3_voltage[6] = 950000,
.buck3_voltage[7] = 900000,
.buck4_voltage[0] = 1200000,
.buck4_voltage[1] = 1150000,
.buck4_voltage[2] = 1200000,
.buck4_voltage[3] = 1100000,
.buck4_voltage[4] = 1100000,
.buck4_voltage[5] = 1100000,
.buck4_voltage[6] = 1100000,
.buck4_voltage[7] = 1100000,
.buck_default_idx = 3,
.buck_gpios[0] = EXYNOS4_GPX2(3),
.buck_gpios[1] = EXYNOS4_GPX2(4),
.buck_gpios[2] = EXYNOS4_GPX2(5),
.buck_ramp_delay = 25,
.buck2_ramp_enable = true,
.buck3_ramp_enable = true,
.buck4_ramp_enable = true,
};
/* End of S5M8767 */
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
static struct regulator_consumer_supply mipi_csi_fixed_voltage_supplies[] = {
REGULATOR_SUPPLY("mipi_csi", "s5p-mipi-csis.0"),
REGULATOR_SUPPLY("mipi_csi", "s5p-mipi-csis.1"),
};
static struct regulator_init_data mipi_csi_fixed_voltage_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(mipi_csi_fixed_voltage_supplies),
.consumer_supplies = mipi_csi_fixed_voltage_supplies,
};
static struct fixed_voltage_config mipi_csi_fixed_voltage_config = {
.supply_name = "DC_5V",
.microvolts = 5000000,
.gpio = -EINVAL,
.init_data = &mipi_csi_fixed_voltage_init_data,
};
static struct platform_device mipi_csi_fixed_voltage = {
.name = "reg-fixed-voltage",
.id = 3,
.dev = {
.platform_data = &mipi_csi_fixed_voltage_config,
},
};
#endif
#ifdef CONFIG_VIDEO_M5MOLS
static struct regulator_consumer_supply m5mols_fixed_voltage_supplies[] = {
REGULATOR_SUPPLY("core", NULL),
REGULATOR_SUPPLY("dig_18", NULL),
REGULATOR_SUPPLY("d_sensor", NULL),
REGULATOR_SUPPLY("dig_28", NULL),
REGULATOR_SUPPLY("a_sensor", NULL),
REGULATOR_SUPPLY("dig_12", NULL),
};
static struct regulator_init_data m5mols_fixed_voltage_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(m5mols_fixed_voltage_supplies),
.consumer_supplies = m5mols_fixed_voltage_supplies,
};
static struct fixed_voltage_config m5mols_fixed_voltage_config = {
.supply_name = "CAM_SENSOR",
.microvolts = 1800000,
.gpio = -EINVAL,
.init_data = &m5mols_fixed_voltage_init_data,
};
static struct platform_device m5mols_fixed_voltage = {
.name = "reg-fixed-voltage",
.id = 4,
.dev = {
.platform_data = &m5mols_fixed_voltage_config,
},
};
#endif
static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
REGULATOR_SUPPLY("AVDD2", "1-001a"),
REGULATOR_SUPPLY("CPVDD", "1-001a"),
};
static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
};
static struct regulator_consumer_supply wm8994_fixed_voltage2_supplies =
REGULATOR_SUPPLY("DBVDD", "1-001a");
static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
.consumer_supplies = wm8994_fixed_voltage0_supplies,
};
static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
.consumer_supplies = wm8994_fixed_voltage1_supplies,
};
static struct regulator_init_data wm8994_fixed_voltage2_init_data = {
.constraints = {
.always_on = 1,
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_fixed_voltage2_supplies,
};
static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
.supply_name = "VDD_1.8V",
.microvolts = 1800000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage0_init_data,
};
static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
.supply_name = "DC_5V",
.microvolts = 5000000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage1_init_data,
};
static struct fixed_voltage_config wm8994_fixed_voltage2_config = {
.supply_name = "VDD_3.3V",
.microvolts = 3300000,
.gpio = -EINVAL,
.init_data = &wm8994_fixed_voltage2_init_data,
};
static struct platform_device wm8994_fixed_voltage0 = {
.name = "reg-fixed-voltage",
.id = 0,
.dev = {
.platform_data = &wm8994_fixed_voltage0_config,
},
};
static struct platform_device wm8994_fixed_voltage1 = {
.name = "reg-fixed-voltage",
.id = 1,
.dev = {
.platform_data = &wm8994_fixed_voltage1_config,
},
};
static struct platform_device wm8994_fixed_voltage2 = {
.name = "reg-fixed-voltage",
.id = 2,
.dev = {
.platform_data = &wm8994_fixed_voltage2_config,
},
};
static struct regulator_consumer_supply wm8994_avdd1_supply =
REGULATOR_SUPPLY("AVDD1", "1-001a");
static struct regulator_consumer_supply wm8994_dcvdd_supply =
REGULATOR_SUPPLY("DCVDD", "1-001a");
static struct regulator_init_data wm8994_ldo1_data = {
.constraints = {
.name = "AVDD1",
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_avdd1_supply,
};
static struct regulator_init_data wm8994_ldo2_data = {
.constraints = {
.name = "DCVDD",
},
.num_consumer_supplies = 1,
.consumer_supplies = &wm8994_dcvdd_supply,
};
static struct wm8994_pdata wm8994_platform_data = {
/* configure gpio1 function: 0x0001(Logic level input/output) */
.gpio_defaults[0] = 0x0001,
/* If the i2s0 and i2s2 is enabled simultaneously */
.gpio_defaults[7] = 0x8100, /* GPIO8 DACDAT3 in */
.gpio_defaults[8] = 0x0100, /* GPIO9 ADCDAT3 out */
.gpio_defaults[9] = 0x0100, /* GPIO10 LRCLK3 out */
.gpio_defaults[10] = 0x0100,/* GPIO11 BCLK3 out */
.ldo[0] = { 0, NULL, &wm8994_ldo1_data },
.ldo[1] = { 0, NULL, &wm8994_ldo2_data },
};
static struct s3c2410_platform_i2c tiny4412_i2c0_data __initdata = {
.flags = 0,
.bus_num = 0,
.slave_addr = 0x10,
.frequency = 200*1000,
.sda_delay = 100,
};
#ifdef CONFIG_SND_SOC_WM8960_TINY4412
#include <sound/wm8960.h>
static struct wm8960_data wm8960_pdata = {
.capless = 0,
.dres = WM8960_DRES_400R,
};
#endif
static struct i2c_board_info i2c_devs0[] __initdata = {
#ifdef CONFIG_SND_SOC_WM8960_TINY4412
{
I2C_BOARD_INFO("wm8960", 0x1a),
.platform_data = &wm8960_pdata,
},
#endif
#ifdef CONFIG_REGULATOR_S5M8767
{
I2C_BOARD_INFO("s5m87xx", 0xCC >> 1),
.platform_data = &exynos4_s5m8767_pdata,
.irq = IRQ_EINT(26),
},
#else
#if 0
{
I2C_BOARD_INFO("max8997", 0x66),
.platform_data = &exynos4_max8997_info,
}, {
I2C_BOARD_INFO("max77686", (0x12 >> 1)),
.platform_data = &exynos4_max77686_info,
},
#endif
#endif
};
#ifdef CONFIG_TOUCHSCREEN_FT5X0X
#include <plat/ft5x0x_touch.h>
static struct ft5x0x_i2c_platform_data ft5x0x_pdata = {
.gpio_irq = EXYNOS4_GPX1(6),
.irq_cfg = S3C_GPIO_SFN(0xf),
.screen_max_x = 800,
.screen_max_y = 1280,
.pressure_max = 255,
};
#endif
static struct s3c2410_platform_i2c tiny4412_i2c1_data __initdata = {
.flags = 0,
.bus_num = 1,
.slave_addr = 0x10,
.frequency = 200*1000,
.sda_delay = 100,
};
#include <../../../drivers/input/touchscreen/sitronix_i2c_touch.h>
#define MULTITOUCH_RESET_GPIO EXYNOS4_GPB(1)
static void sitronix_reset_ic(void){
printk("gg%s\n", __FUNCTION__);
gpio_request(MULTITOUCH_RESET_GPIO, "Multitouch Reset"); // use gpio
gpio_direction_output(MULTITOUCH_RESET_GPIO, 1); // set output
gpio_set_value(MULTITOUCH_RESET_GPIO, 0); // pull low
mdelay(1);
gpio_set_value(MULTITOUCH_RESET_GPIO, 1); // pull high
//gpio_free(MULTITOUCH_RESET_GPIO);
mdelay(150);
}
struct sitronix_i2c_touch_platform_data touch_i2c_conf ={
.reset_ic = sitronix_reset_ic, // return reset function, call bak for driver
};
#define SITRONIX_I2C_TOUCH_DRV_NAME "sitronix"
static struct i2c_board_info i2c_devs1[] __initdata = {
#ifdef CONFIG_TOUCHSCREEN_FT5X0X
{
I2C_BOARD_INFO("ft5x0x_ts", (0x70 >> 1)),
.platform_data = &ft5x0x_pdata,
},
#endif
{
I2C_BOARD_INFO(SITRONIX_I2C_TOUCH_DRV_NAME, 0x55), // slave addr= 0x55
//.irq = OMAP_GPIO_IRQ(MULTITOUCH_INT_GPIO), // gpio2irq
.platform_data = &touch_i2c_conf, // return reset and int status function for driver
},
{
I2C_BOARD_INFO("wm8994", 0x1a),
.platform_data = &wm8994_platform_data,
},
};
static struct i2c_board_info i2c_devs2[] __initdata = {
/* nothing here yet */
};
#ifdef CONFIG_SENSORS_MMA7660
#include <linux/mma7660.h>
static struct mma7660_platform_data mma7660_pdata = {
.irq = IRQ_EINT(25),
.poll_interval = 100,
.input_fuzz = 4,
.input_flat = 4,
};
#endif
static struct s3c2410_platform_i2c tiny4412_i2c3_data __initdata = {
.flags = 0,
.bus_num = 3,
.slave_addr = 0x10,
.frequency = 200*1000,
.sda_delay = 100,
};
static struct i2c_board_info i2c_devs3[] __initdata = {
#ifdef CONFIG_SENSORS_MMA7660
{
I2C_BOARD_INFO("mma7660", 0x4c),
.platform_data = &mma7660_pdata,
},
#endif
#if 0
{
I2C_BOARD_INFO("max8952", 0x60),
.platform_data = &exynos4_max8952_info,
},
#endif
};
static struct i2c_board_info i2c_devs7[] __initdata = {
#ifdef CONFIG_VIDEO_TVOUT
{
I2C_BOARD_INFO("s5p_ddc", (0x74 >> 1)),
},
#endif
};
#ifdef CONFIG_BATTERY_SAMSUNG
static struct platform_device samsung_device_battery = {
.name = "samsung-fake-battery",
.id = -1,
};
#endif
/* Bluetooth */
#ifdef CONFIG_BT_BCM20710
static struct platform_device bcm20710_bluetooth_device = {
.name = "bcm20710_bluetooth",
.id = -1,
};
#endif
#ifdef CONFIG_W1_MASTER_GPIO
#include <linux/w1-gpio.h>
static struct w1_gpio_platform_data w1_gpio_pdata = {
.pin = EXYNOS4_GPX1(6),
.is_open_drain = 0,
};
static struct platform_device user_w1_device = {
.name = "w1-gpio",
.id = -1,
.dev.platform_data = &w1_gpio_pdata,
};
static void __init user_w1_init(void)
{
int gpio = w1_gpio_pdata.pin;
s3c_gpio_cfgpin(gpio, S3C_GPIO_INPUT);
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV3);
}
#endif
#ifdef CONFIG_VIDEO_OV5640
static void __init camera_ov5640_init(void)
{
int gpio;
/* powerdown */
gpio = EXYNOS4_GPX1(3);
gpio_set_value(gpio, 0);
s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
udelay(50);
/* reset */
gpio = EXYNOS4212_GPM2(3);
s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV2);
gpio_set_value(gpio, 0);
udelay(10);
gpio_set_value(gpio, 1);
printk("\nCamera: ov5640 initialized.\n");
}
#endif
#ifdef CONFIG_INPUT_GPIO
static struct gpio_event_direct_entry tiny4412_key_map[] = {
{
.gpio = EXYNOS4_GPX3(2),
.code = KEY_MENU,
}, {
.gpio = EXYNOS4_GPX3(3),
.code = KEY_HOME,
}, {
.gpio = EXYNOS4_GPX3(4),
.code = KEY_BACK,
}, {
.gpio = EXYNOS4_GPX3(5),
.code = 353, /* DPAD_CENTER */
},
};
static struct gpio_event_input_info tiny4412_key_info = {
.info.func = gpio_event_input_func,
.info.no_suspend = true,
.debounce_time.tv64 = 20 * NSEC_PER_MSEC,
.type = EV_KEY,
.keymap = tiny4412_key_map,
.keymap_size = ARRAY_SIZE(tiny4412_key_map)
};
static struct gpio_event_info *tiny4412_input_info[] = {
&tiny4412_key_info.info,
};
static struct gpio_event_platform_data tiny4412_input_data = {
.names = {
"tiny4412-key",
NULL,
},
.info = tiny4412_input_info,
.info_count = ARRAY_SIZE(tiny4412_input_info),
};
static struct platform_device tiny4412_input_device = {
.name = GPIO_EVENT_DEV_NAME,
.id = 0,
.dev = {
.platform_data = &tiny4412_input_data,
},
};
static void tiny4412_key_info_fixup(void)
{
/* Remove 2 hard key for special board */
tiny4412_key_info.keymap_size -= 2;
}
#endif
#ifdef CONFIG_IR_GPIO_CIR
#include <media/gpio-ir-recv.h>
static struct gpio_ir_recv_platform_data tiny4412_rc_data = {
.gpio_nr = EXYNOS4_GPX2(7),
.active_low = 1,
};
static struct platform_device tiny4412_device_gpiorc = {
.name = "gpio-rc-recv",
.id = -1,
.dev = {
.platform_data = &tiny4412_rc_data,
},
};
#endif
static struct platform_device tiny4412_device_1wire = {
.name = "tiny4412_1wire",
.id = -1,
.num_resources = 0,
};
static struct platform_device tiny4412_device_adc = {
.name = "tiny4412_adc",
.id = -1,
.num_resources = 0,
};
#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
static uint32_t smdk4x12_keymap[] __initdata = {
/* KEY(row, col, keycode) */
KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3),
KEY(1, 6, KEY_4), KEY(1, 7, KEY_5),
KEY(2, 5, KEY_D), KEY(2, 6, KEY_A), KEY(2, 7, KEY_B),
KEY(0, 7, KEY_E), KEY(0, 5, KEY_C)
};
static struct matrix_keymap_data smdk4x12_keymap_data __initdata = {
.keymap = smdk4x12_keymap,
.keymap_size = ARRAY_SIZE(smdk4x12_keymap),
};
static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = {
.keymap_data = &smdk4x12_keymap_data,
.rows = 3,
.cols = 8,
};
#endif
#ifdef CONFIG_WAKEUP_ASSIST
static struct platform_device wakeup_assist_device = {
.name = "wakeup_assist",
};
#endif
#ifdef CONFIG_VIDEO_FIMG2D
static struct fimg2d_platdata fimg2d_data __initdata = {
.hw_ver = 0x41,
.parent_clkname = "mout_g2d0",
.clkname = "sclk_fimg2d",
.gate_clkname = "fimg2d",
.clkrate = 201 * 1000000, /* 200 Mhz */
};
#endif
/* usb phy0 mode */
static int uhost0 = 0;
static int __init tiny4412_setup_uhost(char *str)
{
if (!strcasecmp(str, "y") || !strcmp(str, "1") ||
!strcasecmp(str, "yes")) {
printk("USB PHY0 configured as HOST mode\n");
uhost0 = 1;
}
return 0;
}
early_param("uhost0", tiny4412_setup_uhost);
#ifdef CONFIG_USB_EXYNOS_SWITCH
static struct s5p_usbswitch_platdata smdk4x12_usbswitch_pdata;
static void __init smdk4x12_usbswitch_init(void)
{
struct s5p_usbswitch_platdata *pdata = &smdk4x12_usbswitch_pdata;
int err;
pdata->gpio_host_detect = EXYNOS4_GPX3(5); /* low active */
err = gpio_request_one(pdata->gpio_host_detect, GPIOF_IN, "HOST_DETECT");
if (err) {
printk(KERN_ERR "failed to request gpio_host_detect\n");
return;
}
s3c_gpio_cfgpin(pdata->gpio_host_detect, S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(pdata->gpio_host_detect, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_host_detect);
pdata->gpio_device_detect = EXYNOS4_GPX3(4); /* high active */
err = gpio_request_one(pdata->gpio_device_detect, GPIOF_IN, "DEVICE_DETECT");
if (err) {
printk(KERN_ERR "failed to request gpio_host_detect for\n");
return;
}
s3c_gpio_cfgpin(pdata->gpio_device_detect, S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(pdata->gpio_device_detect, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_device_detect);
if (samsung_board_rev_is_0_0())
pdata->gpio_host_vbus = 0;
else {
pdata->gpio_host_vbus = EXYNOS4_GPL2(0);
err = gpio_request_one(pdata->gpio_host_vbus, GPIOF_OUT_INIT_LOW, "HOST_VBUS_CONTROL");
if (err) {
printk(KERN_ERR "failed to request gpio_host_vbus\n");
return;
}
s3c_gpio_setpull(pdata->gpio_host_vbus, S3C_GPIO_PULL_NONE);
gpio_free(pdata->gpio_host_vbus);
}
s5p_usbswitch_set_platdata(pdata);
}
#endif
#ifdef CONFIG_BUSFREQ_OPP
/* BUSFREQ to control memory/bus*/
static struct device_domain busfreq;
#endif
static struct platform_device exynos4_busfreq = {
.id = -1,
.name = "exynos-busfreq",
};
static struct platform_device *smdk4412_devices[] __initdata = {
&s3c_device_adc,
};
static struct platform_device *smdk4x12_devices[] __initdata = {
/* Samsung Power Domain */
&exynos4_device_pd[PD_MFC],
&exynos4_device_pd[PD_G3D],
&exynos4_device_pd[PD_LCD0],
&exynos4_device_pd[PD_CAM],
&exynos4_device_pd[PD_TV],
&exynos4_device_pd[PD_GPS],
&exynos4_device_pd[PD_GPS_ALIVE],
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&exynos4_device_pd[PD_ISP],
#endif
#ifdef CONFIG_FB_MIPI_DSIM
&s5p_device_mipi_dsim,
#endif
/* mainline fimd */
#ifdef CONFIG_FB_S3C
&s5p_device_fimd0,
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_LMS501KF03)
&s3c_device_spi_gpio,
#elif defined(CONFIG_LCD_WA101S)
&smdk4x12_lcd_wa101s,
#elif defined(CONFIG_LCD_LTE480WV)
&smdk4x12_lcd_lte480wv,
#elif defined(CONFIG_LCD_MIPI_S6E63M0)
&smdk4x12_mipi_lcd,
#endif
#endif
/* legacy fimd */
#ifdef CONFIG_FB_S5P
&s3c_device_fb,
#ifdef CONFIG_FB_S5P_LMS501KF03
&s3c_device_spi_gpio,
#endif
#endif
&s3c_device_wdt,
&s3c_device_rtc,
#ifdef CONFIG_TINY4412_BUZZER
&s3c_device_timer[0],
#endif
&s3c_device_i2c0,
&s3c_device_i2c1,
#ifndef CONFIG_BT_BCM20710
&s3c_device_i2c2,
#endif
&s3c_device_i2c3,
&s3c_device_i2c4,
&s3c_device_i2c7,
#ifdef CONFIG_USB_EHCI_S5P
&s5p_device_ehci,
#endif
#ifdef CONFIG_USB_OHCI_S5P
&s5p_device_ohci,
#endif
#ifdef CONFIG_USB_ANDROID_RNDIS
&s3c_device_rndis,
#endif
#ifdef CONFIG_USB_ANDROID
&s3c_device_android_usb,
&s3c_device_usb_mass_storage,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
&s3c_device_hsmmc0,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
&s3c_device_hsmmc1,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
&s3c_device_hsmmc2,
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
&s3c_device_hsmmc3,
#endif
#ifdef CONFIG_S5P_DEV_MSHC
&s3c_device_mshci,
#endif
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
&exynos_device_dwmci,
#endif
#ifdef CONFIG_SND_SAMSUNG_AC97
&exynos_device_ac97,
#endif
#ifdef CONFIG_SND_SAMSUNG_I2S
&exynos_device_i2s0,
#endif
#ifdef CONFIG_SND_SAMSUNG_PCM
&exynos_device_pcm0,
#endif
#ifdef CONFIG_SND_SAMSUNG_SPDIF
&exynos_device_spdif,
#endif
#if defined(CONFIG_SND_SAMSUNG_RP) || defined(CONFIG_SND_SAMSUNG_ALP)
&exynos_device_srp,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&exynos4_device_fimc_is,
#endif
#ifdef CONFIG_VIDEO_TVOUT
&s5p_device_tvout,
&s5p_device_cec,
&s5p_device_hpd,
#endif
#ifdef CONFIG_FB_S5P_EXTDSP
&s3c_device_extdsp,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_TV
&s5p_device_i2c_hdmiphy,
&s5p_device_hdmi,
&s5p_device_sdo,
&s5p_device_mixer,
&s5p_device_cec,
#endif
#if defined(CONFIG_VIDEO_FIMC)
&s3c_device_fimc0,
&s3c_device_fimc1,
&s3c_device_fimc2,
&s3c_device_fimc3,
/* CONFIG_VIDEO_SAMSUNG_S5P_FIMC is the feature for mainline */
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
&s5p_device_fimc0,
&s5p_device_fimc1,
&s5p_device_fimc2,
&s5p_device_fimc3,
#endif
#if defined(CONFIG_VIDEO_FIMC_MIPI)
&s3c_device_csis0,
&s3c_device_csis1,
#elif defined(CONFIG_VIDEO_S5P_MIPI_CSIS)
&s5p_device_mipi_csis0,
&s5p_device_mipi_csis1,
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
&mipi_csi_fixed_voltage,
#endif
#ifdef CONFIG_VIDEO_M5MOLS
&m5mols_fixed_voltage,
#endif
#if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
&s5p_device_mfc,
#endif
#ifdef CONFIG_S5P_SYSTEM_MMU
&SYSMMU_PLATDEV(g2d_acp),
&SYSMMU_PLATDEV(fimc0),
&SYSMMU_PLATDEV(fimc1),
&SYSMMU_PLATDEV(fimc2),
&SYSMMU_PLATDEV(fimc3),
&SYSMMU_PLATDEV(jpeg),
&SYSMMU_PLATDEV(mfc_l),
&SYSMMU_PLATDEV(mfc_r),
&SYSMMU_PLATDEV(tv),
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
&SYSMMU_PLATDEV(is_isp),
&SYSMMU_PLATDEV(is_drc),
&SYSMMU_PLATDEV(is_fd),
&SYSMMU_PLATDEV(is_cpu),
#endif
#endif /* CONFIG_S5P_SYSTEM_MMU */
#ifdef CONFIG_ION_EXYNOS
&exynos_device_ion,
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
&exynos_device_flite0,
&exynos_device_flite1,
#endif
#ifdef CONFIG_VIDEO_FIMG2D
&s5p_device_fimg2d,
#endif
#ifdef CONFIG_EXYNOS_MEDIA_DEVICE
&exynos_device_md0,
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
&s5p_device_jpeg,
#endif
&wm8994_fixed_voltage0,
&wm8994_fixed_voltage1,
&wm8994_fixed_voltage2,
&samsung_asoc_dma,
&samsung_asoc_idma,
#ifdef CONFIG_BATTERY_SAMSUNG
&samsung_device_battery,
#endif
#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
&samsung_device_keypad,
#endif
#ifdef CONFIG_WAKEUP_ASSIST
&wakeup_assist_device,
#endif
&tiny4412_device_1wire,
&tiny4412_device_adc,
#ifdef CONFIG_INPUT_GPIO
&tiny4412_input_device,
#endif
#ifdef CONFIG_IR_GPIO_CIR
&tiny4412_device_gpiorc,
#endif
&smdk4x12_smsc911x,
#ifdef CONFIG_S3C64XX_DEV_SPI
&exynos_device_spi0,
#ifndef CONFIG_FB_S5P_LMS501KF03
&exynos_device_spi1,
#endif
&exynos_device_spi2,
#endif
#ifdef CONFIG_BT_BCM20710
&bcm20710_bluetooth_device,
#endif
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
&exynos_device_tmu,
#endif
#ifdef CONFIG_S5P_DEV_ACE
&s5p_device_ace,
#endif
&exynos4_busfreq,
#ifdef CONFIG_W1_MASTER_GPIO
&user_w1_device,
#endif
};
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
/* below temperature base on the celcius degree */
struct tmu_data exynos_tmu_data __initdata = {
.ts = {
.stop_throttle = 82,
.start_throttle = 85,
.stop_warning = 95,
.start_warning = 103,
.start_tripping = 110, /* temp to do tripping */
},
.efuse_value = 55,
.slope = 0x10008802,
.mode = 0,
};
#endif
#if defined(CONFIG_VIDEO_TVOUT)
static struct s5p_platform_hpd hdmi_hpd_data __initdata = {
};
static struct s5p_platform_cec hdmi_cec_data __initdata = {
};
#endif
#ifdef CONFIG_VIDEO_EXYNOS_HDMI_CEC
static struct s5p_platform_cec hdmi_cec_data __initdata = {
};
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
static struct s5p_fimc_isp_info isp_info[] = {
#if defined(CONFIG_VIDEO_S5K4BA)
{
.board_info = &s5k4ba_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_ITU_601,
#ifdef CONFIG_ITU_A
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_ITU_B
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_VSYNC,
},
#endif
#if defined(CONFIG_VIDEO_S5K4EA)
{
.board_info = &s5k4ea_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_VSYNC,
.csi_data_align = 32,
},
#endif
#if defined(CONFIG_VIDEO_M5MOLS)
{
.board_info = &m5mols_board_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_CSI_C
.i2c_bus_num = 4,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
#endif
#ifdef CONFIG_CSI_D
.i2c_bus_num = 5,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
#endif
.flags = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
.csi_data_align = 32,
},
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#if defined(CONFIG_VIDEO_S5K3H2)
{
.board_info = &s5k3h2_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K3H2_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H2_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.flags = 0,
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K3H7)
{
.board_info = &s5k3h7_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K3H7_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K3H7_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K4E5)
{
.board_info = &s5k4e5_sensor_info,
.clk_frequency = 24000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K4E5_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K4E5_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.csi_data_align = 24,
.use_isp = true,
},
#endif
#if defined(CONFIG_VIDEO_S5K6A3)
{
.board_info = &s5k6a3_sensor_info,
.clk_frequency = 12000000UL,
.bus_type = FIMC_MIPI_CSI2,
#ifdef CONFIG_S5K6A3_CSI_C
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_A,
.cam_power = smdk4x12_cam0_reset,
#endif
#ifdef CONFIG_S5K6A3_CSI_D
.i2c_bus_num = 1,
.mux_id = 1, /* A-Port : 0, B-Port : 1 */
.flite_id = FLITE_IDX_B,
.cam_power = smdk4x12_cam1_reset,
#endif
.flags = 0,
.csi_data_align = 12,
.use_isp = true,
},
#endif
#endif
#if defined(WRITEBACK_ENABLED)
{
.board_info = &writeback_info,
.bus_type = FIMC_LCD_WB,
.i2c_bus_num = 0,
.mux_id = 0, /* A-Port : 0, B-Port : 1 */
.flags = FIMC_CLK_INV_VSYNC,
},
#endif
};
static void __init smdk4x12_subdev_config(void)
{
s3c_fimc0_default_data.isp_info[0] = &isp_info[0];
s3c_fimc0_default_data.isp_info[0]->use_cam = true;
s3c_fimc0_default_data.isp_info[1] = &isp_info[1];
s3c_fimc0_default_data.isp_info[1]->use_cam = true;
/* support using two fimc as one sensore */
{
static struct s5p_fimc_isp_info camcording1;
static struct s5p_fimc_isp_info camcording2;
memcpy(&camcording1, &isp_info[0], sizeof(struct s5p_fimc_isp_info));
memcpy(&camcording2, &isp_info[1], sizeof(struct s5p_fimc_isp_info));
s3c_fimc1_default_data.isp_info[0] = &camcording1;
s3c_fimc1_default_data.isp_info[0]->use_cam = false;
s3c_fimc1_default_data.isp_info[1] = &camcording2;
s3c_fimc1_default_data.isp_info[1]->use_cam = false;
}
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
#ifdef CONFIG_VIDEO_S5K3H2
#ifdef CONFIG_S5K3H2_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K3H2_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K3H7
#ifdef CONFIG_S5K3H7_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K3H7_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K4E5
#ifdef CONFIG_S5K4E5_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 2;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K4E5_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 2;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K6A3
#ifdef CONFIG_S5K6A3_CSI_C
s5p_mipi_csis0_default_data.clk_rate = 160000000;
s5p_mipi_csis0_default_data.lanes = 1;
s5p_mipi_csis0_default_data.alignment = 24;
s5p_mipi_csis0_default_data.hs_settle = 12;
#endif
#ifdef CONFIG_S5K6A3_CSI_D
s5p_mipi_csis1_default_data.clk_rate = 160000000;
s5p_mipi_csis1_default_data.lanes = 1;
s5p_mipi_csis1_default_data.alignment = 24;
s5p_mipi_csis1_default_data.hs_settle = 12;
#endif
#endif
#endif
}
static void __init smdk4x12_camera_config(void)
{
/* CAM A port(b0010) : PCLK, VSYNC, HREF, DATA[0-4] */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPJ0(0), 8, S3C_GPIO_SFN(2));
/* CAM A port(b0010) : DATA[5-7], CLKOUT(MIPI CAM also), FIELD */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPJ1(0), 5, S3C_GPIO_SFN(2));
/* CAM B port(b0011) : PCLK, DATA[0-6] */
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM0(0), 8, S3C_GPIO_SFN(3));
/* CAM B port(b0011) : FIELD, DATA[7]*/
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM1(0), 2, S3C_GPIO_SFN(3));
/* CAM B port(b0011) : VSYNC, HREF, CLKOUT*/
s3c_gpio_cfgrange_nopull(EXYNOS4212_GPM2(0), 3, S3C_GPIO_SFN(3));
/* note : driver strength to max is unnecessary */
#ifdef CONFIG_VIDEO_M5MOLS
s3c_gpio_cfgpin(EXYNOS4_GPX2(6), S3C_GPIO_SFN(0xF));
s3c_gpio_setpull(EXYNOS4_GPX2(6), S3C_GPIO_PULL_NONE);
#endif
}
#endif /* CONFIG_VIDEO_SAMSUNG_S5P_FIMC */
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
static void __set_flite_camera_config(struct exynos_platform_flite *data,
u32 active_index, u32 max_cam)
{
data->active_cam_index = active_index;
data->num_clients = max_cam;
}
static void __init smdk4x12_set_camera_flite_platdata(void)
{
int flite0_cam_index = 0;
int flite1_cam_index = 0;
#ifdef CONFIG_VIDEO_S5K3H2
#ifdef CONFIG_S5K3H2_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k3h2;
#endif
#ifdef CONFIG_S5K3H2_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k3h2;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K3H7
#ifdef CONFIG_S5K3H7_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k3h7;
#endif
#ifdef CONFIG_S5K3H7_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k3h7;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K4E5
#ifdef CONFIG_S5K4E5_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k4e5;
#endif
#ifdef CONFIG_S5K4E5_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k4e5;
#endif
#endif
#ifdef CONFIG_VIDEO_S5K6A3
#ifdef CONFIG_S5K6A3_CSI_C
exynos_flite0_default_data.cam[flite0_cam_index++] = &s5k6a3;
#endif
#ifdef CONFIG_S5K6A3_CSI_D
exynos_flite1_default_data.cam[flite1_cam_index++] = &s5k6a3;
#endif
#endif
__set_flite_camera_config(&exynos_flite0_default_data, 0, flite0_cam_index);
__set_flite_camera_config(&exynos_flite1_default_data, 0, flite1_cam_index);
}
#endif
#if defined(CONFIG_CMA)
static void __init exynos4_reserve_mem(void)
{
static struct cma_region regions[] = {
#ifdef CONFIG_EXYNOS_C2C
{
.name = "c2c_shdmem",
.size = C2C_SHAREDMEM_SIZE,
{
.alignment = C2C_SHAREDMEM_SIZE,
},
.start = 0
},
#endif
#ifndef CONFIG_VIDEOBUF2_ION
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_TV
{
.name = "tv",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_TV * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
{
.name = "jpeg",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_AUDIO_SAMSUNG_MEMSIZE_SRP
{
.name = "srp",
.size = CONFIG_AUDIO_SAMSUNG_MEMSIZE_SRP * SZ_1K,
.start = 0,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D
{
.name = "fimg2d",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMG2D * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD
{
.name = "fimd",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0
{
.name = "fimc0",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2
{
.name = "fimc2",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K,
.start = 0
},
#endif
#if !defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION)
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
{
.name = "fimc3",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
{
.name = "fimc1",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
.start = 0
},
#endif
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_NORMAL
{
.name = "mfc-normal",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_NORMAL * SZ_1K,
{ .alignment = 1 << 17 },
#ifdef CONFIG_USE_MFC_CMA
.start = 0x50000000,
#endif
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
{
.name = "mfc1",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
{
.alignment = 1 << 17,
},
.start = 0,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
{
.name = "mfc0",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
{
.alignment = 1 << 17,
}
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
{
.name = "mfc",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC * SZ_1K,
{
.alignment = 1 << 17,
},
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
{
.name = "fimc_is",
.size = CONFIG_VIDEO_EXYNOS_MEMSIZE_FIMC_IS * SZ_1K,
{
.alignment = 1 << 26,
},
.start = 0
},
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS_BAYER
{
.name = "fimc_is_isp",
.size = CONFIG_VIDEO_EXYNOS_MEMSIZE_FIMC_IS_ISP * SZ_1K,
.start = 0
},
#endif
#endif
#if !defined(CONFIG_EXYNOS_CONTENT_PATH_PROTECTION) && \
defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
{
.name = "b2",
.size = 32 << 20,
{ .alignment = 128 << 10 },
},
{
.name = "b1",
.size = 32 << 20,
{ .alignment = 128 << 10 },
},
{
.name = "fw",
.size = 1 << 20,
{ .alignment = 128 << 10 },
},
#endif
#else /* !CONFIG_VIDEOBUF2_ION */
#ifdef CONFIG_FB_S5P
#error CONFIG_FB_S5P is defined. Select CONFIG_FB_S3C, instead
#endif
{
.name = "ion",
.size = CONFIG_ION_EXYNOS_CONTIGHEAP_SIZE * SZ_1K,
},
#endif /* !CONFIG_VIDEOBUF2_ION */
{
.size = 0
},
};
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
static struct cma_region regions_secure[] = {
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
{
.name = "fimc3",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
{
.name = "fimc1",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
.start = 0
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD_VIDEO
{
.name = "video",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD_VIDEO * SZ_1K,
},
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_SECURE
{
.name = "mfc-secure",
.size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC_SECURE * SZ_1K,
#ifdef CONFIG_USE_MFC_CMA
.start = 0x42100000,
#endif
},
#endif
{
.name = "sectbl",
.size = SZ_1M,
},
{
.size = 0
},
};
#else /* !CONFIG_EXYNOS_CONTENT_PATH_PROTECTION */
struct cma_region *regions_secure = NULL;
#endif
static const char map[] __initconst =
#ifdef CONFIG_EXYNOS_C2C
"samsung-c2c=c2c_shdmem;"
#endif
"s3cfb.0/fimd=fimd;exynos4-fb.0/fimd=fimd;samsung-pd.1=fimd;"
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
"s3cfb.0/video=video;exynos4-fb.0/video=video;"
#endif
"s3c-fimc.0=fimc0;s3c-fimc.1=fimc1;s3c-fimc.2=fimc2;s3c-fimc.3=fimc3;"
"exynos4210-fimc.0=fimc0;exynos4210-fimc.1=fimc1;exynos4210-fimc.2=fimc2;exynos4210-fimc.3=fimc3;"
#ifdef CONFIG_VIDEO_MFC5X
"s3c-mfc/A=mfc0,mfc-secure;"
"s3c-mfc/B=mfc1,mfc-normal;"
"s3c-mfc/AB=mfc;"
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
"s5p-mfc/f=fw;"
"s5p-mfc/a=b1;"
"s5p-mfc/b=b2;"
#endif
"samsung-rp=srp;"
"s5p-jpeg=jpeg;"
"exynos4-fimc-is/f=fimc_is;"
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS_BAYER
"exynos4-fimc-is/i=fimc_is_isp;"
#endif
"s5p-mixer=tv;"
"s5p-fimg2d=fimg2d;"
"ion-exynos=ion,fimd,fimc0,fimc1,fimc2,fimc3,mfc,mfc0,mfc1,fw,b1,b2;"
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
"s5p-smem/video=video;"
"s5p-smem/sectbl=sectbl;"
#endif
"s5p-smem/mfc=mfc0,mfc-secure;"
"s5p-smem/fimc=fimc3;"
"s5p-smem/mfc-shm=mfc1,mfc-normal;"
"s5p-smem/fimd=fimd;";
s5p_cma_region_reserve(regions, regions_secure, 0, map);
}
#else
static inline void exynos4_reserve_mem(void)
{
}
#endif /* CONFIG_CMA */
/* LCD Backlight data */
static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
.no = EXYNOS4_GPD0(1),
.func = S3C_GPIO_SFN(2),
};
static struct platform_pwm_backlight_data smdk4x12_bl_data = {
.pwm_id = 1,
#ifdef CONFIG_FB_S5P_LMS501KF03
.pwm_period_ns = 1000,
#endif
};
static void __init smdk4x12_map_io(void)
{
clk_xusbxti.rate = 24000000;
s5p_init_io(NULL, 0, S5P_VA_CHIPID);
s3c24xx_init_clocks(24000000);
s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
exynos4_reserve_mem();
}
#ifdef CONFIG_SMC911X
static void __init smdk4x12_smsc911x_init(void)
{
u32 cs1;
/* configure nCS1 width to 16 bits */
cs1 = __raw_readl(S5P_SROM_BW) &
~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
(1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
(1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
S5P_SROM_BW__NCS1__SHIFT;
__raw_writel(cs1, S5P_SROM_BW);
/* set timing for nCS1 suitable for ethernet chip */
__raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
(0x9 << S5P_SROM_BCX__TACP__SHIFT) |
(0xc << S5P_SROM_BCX__TCAH__SHIFT) |
(0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
(0x6 << S5P_SROM_BCX__TACC__SHIFT) |
(0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
(0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
}
#endif
static void __init exynos_sysmmu_init(void)
{
ASSIGN_SYSMMU_POWERDOMAIN(fimc0, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc1, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc2, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(fimc3, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(jpeg, &exynos4_device_pd[PD_CAM].dev);
ASSIGN_SYSMMU_POWERDOMAIN(mfc_l, &exynos4_device_pd[PD_MFC].dev);
ASSIGN_SYSMMU_POWERDOMAIN(mfc_r, &exynos4_device_pd[PD_MFC].dev);
ASSIGN_SYSMMU_POWERDOMAIN(tv, &exynos4_device_pd[PD_TV].dev);
#ifdef CONFIG_VIDEO_FIMG2D
sysmmu_set_owner(&SYSMMU_PLATDEV(g2d_acp).dev, &s5p_device_fimg2d.dev);
#endif
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC) || defined(CONFIG_VIDEO_MFC5X)
sysmmu_set_owner(&SYSMMU_PLATDEV(mfc_l).dev, &s5p_device_mfc.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(mfc_r).dev, &s5p_device_mfc.dev);
#endif
#if defined(CONFIG_VIDEO_FIMC)
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc0).dev, &s3c_device_fimc0.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc1).dev, &s3c_device_fimc1.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc2).dev, &s3c_device_fimc2.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc3).dev, &s3c_device_fimc3.dev);
#elif defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC)
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc0).dev, &s5p_device_fimc0.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc1).dev, &s5p_device_fimc1.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc2).dev, &s5p_device_fimc2.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(fimc3).dev, &s5p_device_fimc3.dev);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_TV
sysmmu_set_owner(&SYSMMU_PLATDEV(tv).dev, &s5p_device_mixer.dev);
#endif
#ifdef CONFIG_VIDEO_TVOUT
sysmmu_set_owner(&SYSMMU_PLATDEV(tv).dev, &s5p_device_tvout.dev);
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
sysmmu_set_owner(&SYSMMU_PLATDEV(jpeg).dev, &s5p_device_jpeg.dev);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
ASSIGN_SYSMMU_POWERDOMAIN(is_isp, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_drc, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_fd, &exynos4_device_pd[PD_ISP].dev);
ASSIGN_SYSMMU_POWERDOMAIN(is_cpu, &exynos4_device_pd[PD_ISP].dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_isp).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_drc).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_fd).dev,
&exynos4_device_fimc_is.dev);
sysmmu_set_owner(&SYSMMU_PLATDEV(is_cpu).dev,
&exynos4_device_fimc_is.dev);
#endif
}
#ifdef CONFIG_FB_S5P_EXTDSP
struct platform_device s3c_device_extdsp = {
.name = "s3cfb_extdsp",
.id = 0,
};
static struct s3cfb_extdsp_lcd dummy_buffer = {
.width = 1280,
.height = 720,
.bpp = 16,
};
static struct s3c_platform_fb default_extdsp_data __initdata = {
.hw_ver = 0x70,
.nr_wins = 1,
.default_win = 0,
.swap = FB_SWAP_WORD | FB_SWAP_HWORD,
.lcd = &dummy_buffer
};
void __init s3cfb_extdsp_set_platdata(struct s3c_platform_fb *pd)
{
struct s3c_platform_fb *npd;
int i;
if (!pd)
pd = &default_extdsp_data;
npd = kmemdup(pd, sizeof(struct s3c_platform_fb), GFP_KERNEL);
if (!npd)
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
else {
for (i = 0; i < npd->nr_wins; i++)
npd->nr_buffers[i] = 1;
s3c_device_extdsp.dev.platform_data = npd;
}
}
#endif
/* HW revision */
static int tiny4412_hw_rev;
static void __init tiny4412_hwrev_init(void)
{
struct gpio hw_rev_gpios[] = {
{ EXYNOS4212_GPM3(5), GPIOF_IN, "hw_rev0" },
{ EXYNOS4212_GPM3(6), GPIOF_IN, "hw_rev1" },
{ EXYNOS4212_GPM3(7), GPIOF_IN, "hw_rev2" },
};
int i, ret;
ret = gpio_request_array(hw_rev_gpios,
ARRAY_SIZE(hw_rev_gpios));
BUG_ON(ret);
for (i = 0; i < ARRAY_SIZE(hw_rev_gpios); i++)
tiny4412_hw_rev |= gpio_get_value(hw_rev_gpios[i].gpio) << i;
printk("HW revision: %d\n", tiny4412_hw_rev);
}
int board_get_revision(void)
{
return tiny4412_hw_rev;
}
static void __init smdk4x12_machine_init(void)
{
#ifdef CONFIG_S3C64XX_DEV_SPI
struct clk *sclk = NULL;
struct clk *prnt = NULL;
struct device *spi0_dev = &exynos_device_spi0.dev;
#ifndef CONFIG_FB_S5P_LMS501KF03
struct device *spi1_dev = &exynos_device_spi1.dev;
#endif
struct device *spi2_dev = &exynos_device_spi2.dev;
#endif
#ifdef CONFIG_TOUCHSCREEN_FT5X0X
struct s3cfb_lcd *lcd = tiny4412_get_lcd();
ft5x0x_pdata.screen_max_x = lcd->width;
ft5x0x_pdata.screen_max_y = lcd->height;
#endif
tiny4412_hwrev_init();
if (is_board_rev_B()) {
#ifdef CONFIG_INPUT_GPIO
tiny4412_key_info_fixup();
#endif
}
/* Initialize system Revision & Serial */
system_rev = board_get_revision();
system_serial_high = 0xFA4412DB;
system_serial_low = 0xA4120433;
#if defined(CONFIG_EXYNOS_DEV_PD) && defined(CONFIG_PM_RUNTIME)
exynos_pd_disable(&exynos4_device_pd[PD_MFC].dev);
exynos_pd_disable(&exynos4_device_pd[PD_G3D].dev);
exynos_pd_disable(&exynos4_device_pd[PD_LCD0].dev);
exynos_pd_disable(&exynos4_device_pd[PD_CAM].dev);
exynos_pd_disable(&exynos4_device_pd[PD_TV].dev);
exynos_pd_disable(&exynos4_device_pd[PD_GPS].dev);
exynos_pd_disable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
exynos_pd_disable(&exynos4_device_pd[PD_ISP].dev);
#elif defined(CONFIG_EXYNOS_DEV_PD)
/*
* These power domains should be always on
* without runtime pm support.
*/
exynos_pd_enable(&exynos4_device_pd[PD_MFC].dev);
exynos_pd_enable(&exynos4_device_pd[PD_G3D].dev);
exynos_pd_enable(&exynos4_device_pd[PD_LCD0].dev);
exynos_pd_enable(&exynos4_device_pd[PD_CAM].dev);
exynos_pd_enable(&exynos4_device_pd[PD_TV].dev);
exynos_pd_enable(&exynos4_device_pd[PD_GPS].dev);
exynos_pd_enable(&exynos4_device_pd[PD_GPS_ALIVE].dev);
exynos_pd_enable(&exynos4_device_pd[PD_ISP].dev);
#endif
s3c_i2c0_set_platdata(&tiny4412_i2c0_data);
i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
s3c_i2c1_set_platdata(&tiny4412_i2c1_data);
i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
#ifndef CONFIG_BT_BCM20710
s3c_i2c2_set_platdata(NULL);
i2c_register_board_info(2, i2c_devs2, ARRAY_SIZE(i2c_devs2));
#endif
s3c_i2c3_set_platdata(&tiny4412_i2c3_data);
i2c_register_board_info(3, i2c_devs3, ARRAY_SIZE(i2c_devs3));
s3c_i2c4_set_platdata(NULL);
s3c_i2c7_set_platdata(NULL);
i2c_register_board_info(7, i2c_devs7, ARRAY_SIZE(i2c_devs7));
#if defined(CONFIG_FB_S5P_MIPI_DSIM)
mipi_fb_init();
#endif
#ifdef CONFIG_FB_S3C
dev_set_name(&s5p_device_fimd0.dev, "s3cfb.0");
clk_add_alias("lcd", "exynos4-fb.0", "lcd", &s5p_device_fimd0.dev);
clk_add_alias("sclk_fimd", "exynos4-fb.0", "sclk_fimd", &s5p_device_fimd0.dev);
s5p_fb_setname(0, "exynos4-fb");
#if defined(CONFIG_LCD_AMS369FG06) || defined(CONFIG_LCD_LMS501KF03)
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
#endif
s5p_fimd0_set_platdata(&smdk4x12_lcd0_pdata);
#ifdef CONFIG_FB_MIPI_DSIM
s5p_device_mipi_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_FB_S5P
#ifdef CONFIG_FB_S5P_TINY4412
tiny4412_fb_data.lcd = tiny4412_get_lcd();
s3cfb_set_platdata(&tiny4412_fb_data);
#elif defined(CONFIG_FB_S5P_LMS501KF03)
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
s3cfb_set_platdata(&lms501kf03_data);
#else
s3cfb_set_platdata(NULL);
#endif
#ifdef CONFIG_FB_S5P_MIPI_DSIM
s5p_device_dsim.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_fb.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
tiny4412_usbh_reset();
#ifdef CONFIG_USB_EHCI_S5P
smdk4x12_ehci_init();
#endif
#ifdef CONFIG_USB_OHCI_S5P
smdk4x12_ohci_init();
#endif
#ifdef CONFIG_USB_GADGET
smdk4x12_usbgadget_init();
#endif
#ifdef CONFIG_USB_EXYNOS_SWITCH
smdk4x12_usbswitch_init();
#endif
samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data);
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
exynos_dwmci_set_platdata(&exynos_dwmci_pdata, 0);
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_IS
exynos4_fimc_is_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
exynos4_device_fimc_is.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_S3C_DEV_HSMMC
s3c_sdhci0_set_platdata(&smdk4x12_hsmmc0_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
s3c_sdhci1_set_platdata(&smdk4x12_hsmmc1_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata);
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);
#endif
#ifdef CONFIG_S5P_DEV_MSHC
s3c_mshci_set_platdata(&exynos4_mshc_pdata);
#endif
#if defined(CONFIG_VIDEO_EXYNOS_TV) && defined(CONFIG_VIDEO_EXYNOS_HDMI)
dev_set_name(&s5p_device_hdmi.dev, "exynos4-hdmi");
clk_add_alias("hdmi", "s5p-hdmi", "hdmi", &s5p_device_hdmi.dev);
clk_add_alias("hdmiphy", "s5p-hdmi", "hdmiphy", &s5p_device_hdmi.dev);
s5p_tv_setup();
/* setup dependencies between TV devices */
s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev;
s5p_i2c_hdmiphy_set_platdata(NULL);
#ifdef CONFIG_VIDEO_EXYNOS_HDMI_CEC
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#endif
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
smdk4x12_set_camera_flite_platdata();
s3c_set_platdata(&exynos_flite0_default_data,
sizeof(exynos_flite0_default_data), &exynos_device_flite0);
s3c_set_platdata(&exynos_flite1_default_data,
sizeof(exynos_flite1_default_data), &exynos_device_flite1);
#ifdef CONFIG_EXYNOS_DEV_PD
exynos_device_flite0.dev.parent = &exynos4_device_pd[PD_ISP].dev;
exynos_device_flite1.dev.parent = &exynos4_device_pd[PD_ISP].dev;
#endif
#endif
#ifdef CONFIG_EXYNOS_SETUP_THERMAL
s5p_tmu_set_platdata(&exynos_tmu_data);
#endif
#ifdef CONFIG_VIDEO_FIMC
s3c_fimc0_set_platdata(&fimc_plat);
s3c_fimc1_set_platdata(&fimc_plat);
s3c_fimc2_set_platdata(&fimc_plat);
s3c_fimc3_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
secmem.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#ifdef CONFIG_VIDEO_FIMC_MIPI
s3c_csis0_set_platdata(NULL);
s3c_csis1_set_platdata(NULL);
#ifdef CONFIG_EXYNOS_DEV_PD
s3c_device_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s3c_device_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
|| defined(CONFIG_S5K6A3_CSI_C)
smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
|| defined(CONFIG_S5K6A3_CSI_D)
smdk4x12_cam1_reset(1);
#endif
#endif /* CONFIG_VIDEO_FIMC */
#ifdef CONFIG_FB_S5P_EXTDSP
s3cfb_extdsp_set_platdata(&default_extdsp_data);
#endif
#ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
smdk4x12_camera_config();
smdk4x12_subdev_config();
dev_set_name(&s5p_device_fimc0.dev, "s3c-fimc.0");
dev_set_name(&s5p_device_fimc1.dev, "s3c-fimc.1");
dev_set_name(&s5p_device_fimc2.dev, "s3c-fimc.2");
dev_set_name(&s5p_device_fimc3.dev, "s3c-fimc.3");
clk_add_alias("fimc", "exynos4210-fimc.0", "fimc", &s5p_device_fimc0.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.0", "sclk_fimc",
&s5p_device_fimc0.dev);
clk_add_alias("fimc", "exynos4210-fimc.1", "fimc", &s5p_device_fimc1.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.1", "sclk_fimc",
&s5p_device_fimc1.dev);
clk_add_alias("fimc", "exynos4210-fimc.2", "fimc", &s5p_device_fimc2.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.2", "sclk_fimc",
&s5p_device_fimc2.dev);
clk_add_alias("fimc", "exynos4210-fimc.3", "fimc", &s5p_device_fimc3.dev);
clk_add_alias("sclk_fimc", "exynos4210-fimc.3", "sclk_fimc",
&s5p_device_fimc3.dev);
s3c_fimc_setname(0, "exynos4210-fimc");
s3c_fimc_setname(1, "exynos4210-fimc");
s3c_fimc_setname(2, "exynos4210-fimc");
s3c_fimc_setname(3, "exynos4210-fimc");
/* FIMC */
s3c_set_platdata(&s3c_fimc0_default_data,
sizeof(s3c_fimc0_default_data), &s5p_device_fimc0);
s3c_set_platdata(&s3c_fimc1_default_data,
sizeof(s3c_fimc1_default_data), &s5p_device_fimc1);
s3c_set_platdata(&s3c_fimc2_default_data,
sizeof(s3c_fimc2_default_data), &s5p_device_fimc2);
s3c_set_platdata(&s3c_fimc3_default_data,
sizeof(s3c_fimc3_default_data), &s5p_device_fimc3);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
dev_set_name(&s5p_device_mipi_csis0.dev, "s3c-csis.0");
dev_set_name(&s5p_device_mipi_csis1.dev, "s3c-csis.1");
clk_add_alias("csis", "s5p-mipi-csis.0", "csis",
&s5p_device_mipi_csis0.dev);
clk_add_alias("sclk_csis", "s5p-mipi-csis.0", "sclk_csis",
&s5p_device_mipi_csis0.dev);
clk_add_alias("csis", "s5p-mipi-csis.1", "csis",
&s5p_device_mipi_csis1.dev);
clk_add_alias("sclk_csis", "s5p-mipi-csis.1", "sclk_csis",
&s5p_device_mipi_csis1.dev);
dev_set_name(&s5p_device_mipi_csis0.dev, "s5p-mipi-csis.0");
dev_set_name(&s5p_device_mipi_csis1.dev, "s5p-mipi-csis.1");
s3c_set_platdata(&s5p_mipi_csis0_default_data,
sizeof(s5p_mipi_csis0_default_data), &s5p_device_mipi_csis0);
s3c_set_platdata(&s5p_mipi_csis1_default_data,
sizeof(s5p_mipi_csis1_default_data), &s5p_device_mipi_csis1);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
s5p_device_mipi_csis1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
#endif
#endif
#if defined(CONFIG_ITU_A) || defined(CONFIG_CSI_C) \
|| defined(CONFIG_S5K3H1_CSI_C) || defined(CONFIG_S5K3H2_CSI_C) \
|| defined(CONFIG_S5K6A3_CSI_C)
smdk4x12_cam0_reset(1);
#endif
#if defined(CONFIG_ITU_B) || defined(CONFIG_CSI_D) \
|| defined(CONFIG_S5K3H1_CSI_D) || defined(CONFIG_S5K3H2_CSI_D) \
|| defined(CONFIG_S5K6A3_CSI_D)
smdk4x12_cam1_reset(1);
#endif
#endif
#if defined(CONFIG_VIDEO_TVOUT)
s5p_hdmi_hpd_set_platdata(&hdmi_hpd_data);
s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_tvout.dev.parent = &exynos4_device_pd[PD_TV].dev;
exynos4_device_pd[PD_TV].dev.parent = &exynos4_device_pd[PD_LCD0].dev;
#endif
#endif
#ifdef CONFIG_VIDEO_JPEG_V2X
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_jpeg.dev.parent = &exynos4_device_pd[PD_CAM].dev;
exynos4_jpeg_setup_clock(&s5p_device_jpeg.dev, 160000000);
#endif
#endif
#ifdef CONFIG_ION_EXYNOS
exynos_ion_set_platdata();
#endif
#if defined(CONFIG_VIDEO_MFC5X) || defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
#ifdef CONFIG_EXYNOS_DEV_PD
s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
#endif
if (soc_is_exynos4412() && samsung_rev() >= EXYNOS4412_REV_1_0)
exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 200 * MHZ);
else
exynos4_mfc_setup_clock(&s5p_device_mfc.dev, 267 * MHZ);
#endif
#if defined(CONFIG_VIDEO_SAMSUNG_S5P_MFC)
dev_set_name(&s5p_device_mfc.dev, "s3c-mfc");
clk_add_alias("mfc", "s5p-mfc", "mfc", &s5p_device_mfc.dev);
s5p_mfc_setname(&s5p_device_mfc, "s5p-mfc");
#endif
#ifdef CONFIG_VIDEO_FIMG2D
s5p_fimg2d_set_platdata(&fimg2d_data);
#endif
#ifdef CONFIG_SAMSUNG_DEV_KEYPAD
samsung_keypad_set_platdata(&smdk4x12_keypad_data);
#endif
#ifdef CONFIG_SMC911X
smdk4x12_smsc911x_init();
#endif
#ifdef CONFIG_WIFI_CONTROL_FUNC
brcm_wlan_init();
#endif
exynos_sysmmu_init();
platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices));
if (soc_is_exynos4412())
platform_add_devices(smdk4412_devices, ARRAY_SIZE(smdk4412_devices));
#ifdef CONFIG_USB_GADGET
if (!uhost0)
platform_device_register(&s3c_device_usbgadget);
#endif
#ifdef CONFIG_FB_S3C
exynos4_fimd0_setup_clock(&s5p_device_fimd0.dev, "mout_mpll_user",
800 * MHZ);
#endif
#ifdef CONFIG_S3C64XX_DEV_SPI
sclk = clk_get(spi0_dev, "dout_spi0");
if (IS_ERR(sclk))
dev_err(spi0_dev, "failed to get sclk for SPI-0\n");
prnt = clk_get(spi0_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi0_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPB(1), "SPI_CS0")) {
gpio_direction_output(EXYNOS4_GPB(1), 1);
s3c_gpio_cfgpin(EXYNOS4_GPB(1), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPB(1), S3C_GPIO_PULL_UP);
exynos_spi_set_info(0, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi0_csi));
}
spi_register_board_info(spi0_board_info, ARRAY_SIZE(spi0_board_info));
#ifndef CONFIG_FB_S5P_LMS501KF03
sclk = clk_get(spi1_dev, "dout_spi1");
if (IS_ERR(sclk))
dev_err(spi1_dev, "failed to get sclk for SPI-1\n");
prnt = clk_get(spi1_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi1_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPB(5), "SPI_CS1")) {
gpio_direction_output(EXYNOS4_GPB(5), 1);
s3c_gpio_cfgpin(EXYNOS4_GPB(5), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPB(5), S3C_GPIO_PULL_UP);
exynos_spi_set_info(1, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi1_csi));
}
spi_register_board_info(spi1_board_info, ARRAY_SIZE(spi1_board_info));
#endif
sclk = clk_get(spi2_dev, "dout_spi2");
if (IS_ERR(sclk))
dev_err(spi2_dev, "failed to get sclk for SPI-2\n");
prnt = clk_get(spi2_dev, "mout_mpll_user");
if (IS_ERR(prnt))
dev_err(spi2_dev, "failed to get prnt\n");
if (clk_set_parent(sclk, prnt))
printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
prnt->name, sclk->name);
clk_set_rate(sclk, 800 * 1000 * 1000);
clk_put(sclk);
clk_put(prnt);
if (!gpio_request(EXYNOS4_GPC1(2), "SPI_CS2")) {
gpio_direction_output(EXYNOS4_GPC1(2), 1);
s3c_gpio_cfgpin(EXYNOS4_GPC1(2), S3C_GPIO_SFN(1));
s3c_gpio_setpull(EXYNOS4_GPC1(2), S3C_GPIO_PULL_UP);
exynos_spi_set_info(2, EXYNOS_SPI_SRCCLK_SCLK,
ARRAY_SIZE(spi2_csi));
}
spi_register_board_info(spi2_board_info, ARRAY_SIZE(spi2_board_info));
#endif
#ifdef CONFIG_BUSFREQ_OPP
dev_add(&busfreq, &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_DMC0], &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_DMC1], &exynos4_busfreq.dev);
ppmu_init(&exynos_ppmu[PPMU_CPU], &exynos4_busfreq.dev);
#endif
register_reboot_notifier(&exynos4_reboot_notifier);
#ifdef CONFIG_W1_MASTER_GPIO
user_w1_init();
#endif
#ifdef CONFIG_VIDEO_OV5640
camera_ov5640_init();
#endif
}
static void __init exynos4_reserve(void)
{
int ret = 0;
#ifdef CONFIG_DMA_CMA
#if defined(CONFIG_USE_MFC_CMA)
ret = dma_declare_contiguous(&s5p_device_mfc.dev,
0x02800000, 0x42800000, 0);
#endif
if (ret != 0)
printk(KERN_ERR "%s Fail\n", __func__);
#endif
}
MACHINE_START(TINY4412, "TINY4412")
/* Maintainer: FriendlyARM (www.arm9.net) */
.boot_params = S5P_PA_SDRAM + 0x100,
.init_irq = exynos4_init_irq,
.map_io = smdk4x12_map_io,
.init_machine = smdk4x12_machine_init,
.timer = &exynos4_timer,
.reserve = &exynos4_reserve,
MACHINE_END
|
52951303382ceb09f997f3a2f4c262fb42d10695
|
bdc651cdc17077de207911ea3b475602702a2ea2
|
/CS1412FinalProject/src/server_test.c
|
b9a858776f4dd0345af56d167d8a35140b644585
|
[] |
no_license
|
HarperH/ProgPrincFinal
|
267018bbdf0c79fece52b1c46d0aca03c3ad3835
|
4ef5429b03d783cb571cbb6c7a4dbdc778ce1564
|
refs/heads/main
| 2023-08-04T08:05:32.767843 | 2021-09-17T18:30:37 | 2021-09-17T18:30:37 | 386,771,932 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 763 |
c
|
server_test.c
|
#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "serverheader.h"
int main(int argc, char **argv)
{
SOCKET sock, client_socket;
WSADATA winsock;
init_winsock(&winsock);
create_socket(&sock);
bind_socket(&sock);
set_server_to_listen(&sock, 1);
accept_socket_request(&sock, &client_socket);
recieve_information(&client_socket);
closesocket(sock);
closesocket(client_socket);
WSACleanup();
return 0;
}
|
df239b7a0abed7b0f97a148ae5fb28c861a2470e
|
ea357f11b3f7c74750800e1e1703208160353143
|
/tiny-vmi/os/linux/memory.c
|
452b31a20471d4a5e951338e764e3e99b94ed456
|
[] |
no_license
|
tinyvmi/tinyvmi
|
921d327893662fda8bc742e2ccce0434932cf9d6
|
1a59b5bbf44a9b4b9c6205aa14b8afc376aa5868
|
refs/heads/master
| 2021-06-11T06:37:42.874000 | 2021-05-22T19:03:14 | 2021-05-22T19:03:14 | 133,390,420 | 11 | 1 | null | null | null | null |
UTF-8
|
C
| false | false | 7,667 |
c
|
memory.c
|
/* The LibVMI Library is an introspection library that simplifies access to
* memory in a target virtual machine or in a file containing a dump of
* a system's physical memory. LibVMI is based on the XenAccess Library.
*
* Copyright 2011 Sandia Corporation. Under the terms of Contract
* DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
* retains certain rights in this software.
*
* Author: Bryan D. Payne ([email protected])
*
* This file is part of LibVMI.
*
* LibVMI 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 3 of the License, or (at your
* option) any later version.
*
* LibVMI 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 LibVMI. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include "tiny_private.h"
#include "os/linux/linux.h"
#include "driver/driver_wrapper.h"
/* finds the task struct for a given pid */
static addr_t
linux_get_taskstruct_addr_from_pid(
vmi_instance_t vmi,
vmi_pid_t pid)
{
addr_t list_head = 0, next_process = 0;
vmi_pid_t task_pid = -1;
linux_instance_t linux_instance = NULL;
int pid_offset = 0;
int tasks_offset = 0;
if (vmi->os_data == NULL) {
errprint("VMI_ERROR: No os_data initialized\n");
return 0;
}
linux_instance = vmi->os_data;
pid_offset = linux_instance->pid_offset;
tasks_offset = linux_instance->tasks_offset;
/* First we need a pointer to the initial entry in the tasks list.
* Note that this is task_struct->tasks, not the base addr
* of task_struct: task_struct base = $entry - tasks_offset.
*/
next_process = vmi->init_task;
list_head = next_process;
do {
vmi_read_32_va(vmi, next_process + pid_offset, 0, (uint32_t*)&task_pid);
/* if pid matches, then we found what we want */
if (task_pid == pid) {
return next_process;
}
vmi_read_addr_va(vmi, next_process + tasks_offset, 0, &next_process);
next_process -= tasks_offset;
/* if we are back at the list head, we are done */
} while(list_head != next_process);
return 0;
}
static addr_t
linux_get_taskstruct_addr_from_pgd(
vmi_instance_t vmi,
addr_t pgd)
{
addr_t list_head = 0, next_process = 0;
addr_t task_pgd = 0;
uint8_t width = 0;
int tasks_offset = 0;
int mm_offset = 0;
int pgd_offset = 0;
linux_instance_t os = NULL;
// DBG_LINE;
if (vmi->os_data == NULL) {
errprint("VMI_ERROR: No os_data initialized\n");
return 0;
}
os = vmi->os_data;
tasks_offset = os->tasks_offset;
mm_offset = os->mm_offset;
pgd_offset = os->pgd_offset;
/* First we need a pointer to the initial entry in the tasks list.
* Note that this is task_struct->tasks, not the base addr
* of task_struct: task_struct base = $entry - tasks_offset.
*/
next_process = vmi->init_task;
list_head = next_process;
width = vmi_get_address_width(vmi);
dbprint(VMI_DEBUG_TEST, "%s: addr width: %d\n", __FUNCTION__, width);
do {
addr_t ptr = 0;
vmi_read_addr_va(vmi, next_process + mm_offset, 0, &ptr);
/* task_struct->mm is NULL when Linux is executing on the behalf
* of a task, or if the task represents a kthread. In this context,
* task_struct->active_mm is non-NULL and we can use it as
* a fallback. task_struct->active_mm can be found very reliably
* at task_struct->mm + 1 pointer width
*/
if(!ptr && width)
vmi_read_addr_va(vmi, next_process + mm_offset + width, 0, &ptr);
vmi_read_addr_va(vmi, ptr + pgd_offset, 0, &task_pgd);
if ( VMI_SUCCESS == vmi_translate_kv2p(vmi, task_pgd, &task_pgd) &&
task_pgd == pgd)
return next_process;
vmi_read_addr_va(vmi, next_process + tasks_offset, 0, &next_process);
next_process -= tasks_offset;
/* if we are back at the list head, we are done */
} while (list_head != next_process);
return 0;
}
/* finds the address of the page global directory for a given pid */
status_t
linux_pid_to_pgd(
vmi_instance_t vmi,
vmi_pid_t pid,
addr_t *pgd)
{
addr_t ts_addr = 0, ptr = 0;
uint8_t width = 0;
status_t rc = VMI_FAILURE;
linux_instance_t linux_instance = NULL;
int mm_offset = 0;
int pgd_offset = 0;
if (!vmi->os_data) {
errprint("VMI_ERROR: No os_data initialized\n");
return VMI_FAILURE;
}
linux_instance = vmi->os_data;
mm_offset = linux_instance->mm_offset;
pgd_offset = linux_instance->pgd_offset;
/* first we the address of this PID's task_struct */
ts_addr = linux_get_taskstruct_addr_from_pid(vmi, pid);
if (!ts_addr) {
errprint("Could not find task struct for pid = %d.\n", pid);
return VMI_FAILURE;
}
/* now follow the pointer to the memory descriptor and grab the pgd value */
rc = vmi_read_addr_va(vmi, ts_addr + mm_offset, 0, &ptr);
/* task_struct->mm is NULL when Linux is executing on the behalf
* of a task, or if the task represents a kthread. In this context,
* task_struct->active_mm is non-NULL and we can use it as
* a fallback. task_struct->active_mm can be found very reliably
* at task_struct->mm + 1 pointer width
*/
if(!ptr)
{
switch(vmi->page_mode)
{
case VMI_PM_AARCH64:// intentional fall-through
case VMI_PM_IA32E:
width = 8;
break;
case VMI_PM_AARCH32:// intentional fall-through
case VMI_PM_LEGACY: // intentional fall-through
case VMI_PM_PAE:
width = 4;
break;
default:
return 0;
};
rc = vmi_read_addr_va(vmi, ts_addr + mm_offset + width, 0, &ptr);
if( VMI_FAILURE == rc || !ptr )
return rc;
}
rc = vmi_read_addr_va(vmi, ptr + pgd_offset, 0, pgd);
if ( VMI_FAILURE == rc )
return rc;
/* convert pgd into a machine address */
return vmi_translate_kv2p(vmi, *pgd, pgd);
}
status_t
linux_pgd_to_pid(
vmi_instance_t vmi,
addr_t pgd,
vmi_pid_t *pid)
{
addr_t ts_addr = 0;
linux_instance_t linux_instance = NULL;
int pid_offset = 0;
DBG_START;
if (!vmi->os_data) {
errprint("VMI_ERROR: No os_data initialized\n");
return VMI_FAILURE;
}
linux_instance = vmi->os_data;
pid_offset = linux_instance->pid_offset;
dbprint(VMI_DEBUG_TEST, "get pid offset from vmi: %d\n", pid_offset);
/* first we the address of the task_struct with this PGD */
ts_addr = linux_get_taskstruct_addr_from_pgd(vmi, pgd);
dbprint(VMI_DEBUG_TEST, "get ts_addr of linux: %p\n", ts_addr);
if (!ts_addr) {
errprint("Could not find task struct for pgd = 0x%"PRIx64".\n", pgd);
return VMI_FAILURE;
}
/* now follow the pointer to the memory descriptor and grab the pid value */
// return vmi_read_32_va(vmi, ts_addr + pid_offset, 0, (uint32_t*)pid);
status_t ret = vmi_read_32_va(vmi, ts_addr + pid_offset, 0, (uint32_t*)pid);
DBG_DONE;
return ret;
}
|
b6473299f3cbdbfc36e9352b9790d63be489249f
|
8557c39b6b981d4cc977ca26de9bd99b87a510e9
|
/src/cmd_base/test/test.c
|
8541ccb3c446f6ba93a26b48c6bd605ed3378f20
|
[] |
no_license
|
mi53/cmd
|
0a2ede4c97d6db0ca71fe814a764e0763cac1a25
|
5964a3dad19f0d586983db3dbe48ec14906e5f73
|
refs/heads/master
| 2021-06-12T15:24:19.371927 | 2020-06-29T13:52:36 | 2020-06-29T13:52:36 | 128,719,152 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 27,512 |
c
|
test.c
|
#include "test.h"
#include "cmd.h"
#include "util.h"
#include <stdlib.h>
#include <string.h>
#include "case_example.h"
/***************************************************************************
* 描述: 存储全部定义好的用例。
***************************************************************************/
static CaseSt** s_apstCases = NULL;
//解析后的用例条件。
typedef struct _CaseCdtPSt
{
int iCdtNum;
ParasSt* pstCdtTypes;
} CaseCdtPSt;
static bool _Tst_CdtParse(CaseSt* pstCase);
static void _Tst_CdtParseCls(CaseCdtPSt* pstCdtP);
typedef struct _CdtAndValItrSt
{
int iCdtItr;
int iCdtValItr;
} CdtAndValItrSt;
static int _Tst_ScenceRun(CaseSt* pstCase, int* aiCdtIdxs);
//此处索引位外部编号,从1开始编号。
static int _Tst_ChkCdtInSet(unsigned int uiCdt,
const char* pcSetDesc,
int iStrLen,
bool* pbRslt);
static int _Tst_GetExpectRslt(CaseSt* pstCase, int* piCdts, int* piExpect);
//解析一个符号|隔开的段。
static int _Tst_ChkCdtInSeg(unsigned int uiCdt,
const char* pcSegStart,
const char* pcSegEnd,
bool* pbRslt);
/***************************************************************************
* 描述: 设置用例。
***************************************************************************/
int Tst_SetCase(CaseSt** apstCase)
{
int idx = 0;
ParasSt stParas = {0};
if (NULL == apstCase || NULL == apstCase[0])
{
return RET_OK;
}
//检测有效性。
while (NULL != apstCase[idx])
{
//基函数、基础用例名及描述均不允许为空。
if (NULL == apstCase[idx]->fnBase
|| NULL == apstCase[idx]->pcBase
|| NULL == apstCase[idx]->pcDesc)
{
LOG_INFO("传入的case无效,注意: 有效的用例中基函数、"
"基础用例名、基础用例描述不能为空。");
return RET_ERR;
}
//检验条件。
if ((0 == apstCase[idx]->stCdtDesc.iNum
&& NULL != apstCase[idx]->stCdtDesc.pstParas)
|| (0 != apstCase[idx]->stCdtDesc.iNum
&& NULL == apstCase[idx]->stCdtDesc.pstParas)
|| (0 == apstCase[idx]->stCdts.iNum
&& NULL != apstCase[idx]->stCdts.pstCdts)
|| (0 != apstCase[idx]->stCdts.iNum
&& NULL == apstCase[idx]->stCdts.pstCdts))
{
LOG_INFO("条件数目与对应的内容只能同为0或NULL。");
return RET_ERR;
}
else if (0 == apstCase[idx]->stCdtDesc.iNum
&& 0 != apstCase[idx]->stCdts.iNum)
{
LOG_INFO("条件描述为空,而条件域不为空。");
return RET_ERR;
}
//检验场景-结果表。
if ((0 == apstCase[idx]->stRslt.iNum
&& NULL != apstCase[idx]->stRslt.pstRslts)
|| (0 != apstCase[idx]->stRslt.iNum
&& NULL == apstCase[idx]->stRslt.pstRslts))
{
LOG_INFO("场景-结果匹配表中数目与对应的内容只能同为0或NULL。");
return RET_ERR;
}
//解析条件。
if (!_Tst_CdtParse(apstCase[idx]))
{
LOG_INFO("解析条件域失败。");
return RET_ERR;
}
++idx;
}
s_apstCases = apstCase;
return RET_OK;
}
/***************************************************************************
* 描述: 清理用例。
***************************************************************************/
void Tst_ClsCase()
{
CaseSt* pstCase;
if (NULL != s_apstCases)
{
int idx = 0;
pstCase = s_apstCases[idx];
while (pstCase != NULL)
{
_Tst_CdtParseCls((CaseCdtPSt*)pstCase->pCdtsAftP);
pstCase->pCdtsAftP = NULL;
pstCase = s_apstCases[++idx];
}
s_apstCases = NULL;
}
}
/***************************************************************************
* 描述: 测试入口函数。
***************************************************************************/
void Tst_CaseRun(const char* pcBase, const char* pcCdt)
{
int iRet = RET_OK;
int idx = 0;
bool bRunAllCase = !(pcBase);
bool bRunAllSecense = !(pcCdt);
int iCmp;
ParasDescSt* pstCdtDesc;
CaseCdtSt* pstCdtItr;
int idxCdt;
int* aiCdtIdxs;//当前场景。
CaseCdtPSt* pstCdtsP;
int iSuccessNum = 0;
int iFailNum = 0;
if (NULL == s_apstCases)
{
LOG_INFO("no case.");
return;
}
/***********************************************************
* 遍历查找并执行对应的测试用例。
***********************************************************/
while (NULL != s_apstCases[idx])
{
//判断当前基函数是否需要运行。
if (!bRunAllCase)
{
iCmp = Util_StrCmpIgrUp(pcBase, s_apstCases[idx]->pcBase);
if (0 != iCmp)
{
++idx;
continue;
}
}
/***********************************************************
* 没有条件因子的用例,直接执行基函数。
***********************************************************/
if (0 == s_apstCases[idx]->stCdtDesc.iNum)
{
iRet = _Tst_ScenceRun(s_apstCases[idx], NULL);
if (RET_OK != iRet)
{
++iFailNum;
LOG(FMT_SEG1"- - - - - %d\n", iFailNum);
}
else
{ ++iSuccessNum; }
//判断是否需要继续。
if (!bRunAllCase)
{ break; }
++idx;
continue;
}
/***********************************************************
* 遍历查找对应条件,并执行对应场景。
***********************************************************/
pstCdtDesc = &(s_apstCases[idx]->stCdtDesc);
pstCdtItr = s_apstCases[idx]->stCdts.pstCdts;
//获取并执行对应场景。-- 条件类别为0.
aiCdtIdxs = (int*)malloc(s_apstCases[idx]->stCdtDesc.iNum * sizeof(int));
memset(aiCdtIdxs, 0, s_apstCases[idx]->stCdtDesc.iNum * sizeof(int));
if (!bRunAllSecense)
{
for (idxCdt = 0; idxCdt < s_apstCases[idx]->stCdtDesc.iNum; ++idxCdt)
{
aiCdtIdxs[idxCdt] = 0;
//后续未输入的数字,默认为0.
while (*pcCdt >= '0' && *pcCdt <= '9')
{
aiCdtIdxs[idxCdt] *= 10;
aiCdtIdxs[idxCdt] += (*pcCdt - '0');
++pcCdt;
}
while (*pcCdt != '\0'
&& (*pcCdt < '0' || *pcCdt > '9'))
{
++pcCdt;
}
//外部编号从1开始。0,也当做第一项处理。
if (aiCdtIdxs[idxCdt] > 0)
{ --aiCdtIdxs[idxCdt]; }
}
}
//初始化条件参数。
pstCdtsP = (CaseCdtPSt*)s_apstCases[idx]->pCdtsAftP;
//执行场景。
do
{
iRet = _Tst_ScenceRun(s_apstCases[idx], aiCdtIdxs);
if (RET_OK != iRet)
{
++iFailNum;
LOG(FMT_SEG1"- - - - - %d\n", iFailNum);
}
else
{ ++iSuccessNum; }
//迭代下一个场景。
++aiCdtIdxs[0];
for (idxCdt = 0; idxCdt < s_apstCases[idx]->stCdtDesc.iNum; ++idxCdt)
{
if (aiCdtIdxs[idxCdt] < pstCdtsP->pstCdtTypes[idxCdt].iNum)
{
break;
}
else//进位
{
aiCdtIdxs[idxCdt] = 0;
if (idxCdt + 1 < s_apstCases[idx]->stCdtDesc.iNum)
{
++aiCdtIdxs[idxCdt + 1];
}
}
}
if (idxCdt == s_apstCases[idx]->stCdtDesc.iNum)
{
break;
}
}
while (bRunAllSecense);
Util_Free(aiCdtIdxs);
//判断是否需要继续。
if (!bRunAllCase)
{ break; }
++idx;
}
/***********************************************************
* 显示运行结果。
***********************************************************/
LOG(FMT_SEG4_E);
LOG("%16s:%05d | %s:%05d\n", "成功", iSuccessNum, "失败", iFailNum);
LOG(FMT_SEG4_E);
}
static void _Tst_CdtParseCls(CaseCdtPSt* pstCdtP)
{
int idxCdt;
if (NULL != pstCdtP)
{
for (idxCdt = 0; idxCdt < pstCdtP->iCdtNum; ++idxCdt)
{
Para_Cls(pstCdtP->pstCdtTypes + idxCdt);
}
memset(pstCdtP->pstCdtTypes, 0, sizeof(ParasSt*) * pstCdtP->iCdtNum);
Util_Free(pstCdtP->pstCdtTypes);
Util_Free(pstCdtP);
}
}
static bool _Tst_CdtParse(CaseSt* pstCase)
{
CaseCdtPSt* pstOut;
int iCmp;
CdtAndValItrSt* astCdtValItr;
int idxCdt;
int idxDesc;
int idxDescStart;
ParasDescSt stSingleCdt;
ParasSt stCdtVal;
int iRet;
UTIL_CHK(NULL != pstCase);
pstCase->pCdtsAftP = NULL;
//校验条件类别描述。
if (0 != pstCase->stCdtDesc.iNum)
{
if (NULL == pstCase->stCdtDesc.pstParas)
{
LOG_ERR("条件类别不为0,却不存在确切的条件。");
return false;
}
}
else
{ return true; }
//创建解析对象。
pstOut = (CaseCdtPSt*)malloc(sizeof(CaseCdtPSt));
pstOut->iCdtNum = pstCase->stCdtDesc.iNum;
pstOut->pstCdtTypes = (ParasSt*)malloc(sizeof(ParasSt) * pstOut->iCdtNum);
memset(pstOut->pstCdtTypes, 0, sizeof(ParasSt) * pstOut->iCdtNum);
//获取全部条件因子的条件数目。
for (idxCdt = 0; idxCdt < pstCase->stCdts.iNum; ++idxCdt)
{
//获取对应的条件描述。一般而言相同条件存储在邻近位。
iCmp = -1;
for (idxDesc = 0; idxDesc < pstCase->stCdtDesc.iNum; ++idxDesc)
{
iCmp = strcmp(pstCase->stCdtDesc.pstParas[idxDesc].pcName,
pstCase->stCdts.pstCdts[idxCdt].pcCdtName);
if (0 == iCmp)
{
idxDescStart = idxDesc;
++(pstOut->pstCdtTypes[idxDesc].iNum);
break;
}
}
if (idxDesc == pstCase->stCdtDesc.iNum)
{
LOG_ERR("用例:%s, 中存在无效条件%s。",
pstCase->pcBase,
pstCase->stCdts.pstCdts[idxCdt].pcCdtName);
goto LAB_ERR;
}
}
//创建条件值存储对象。
for (idxDesc = 0; idxDesc < pstCase->stCdtDesc.iNum; ++idxDesc)
{
if (0 != pstOut->pstCdtTypes[idxDesc].iNum)
{
pstOut->pstCdtTypes[idxDesc].pstParas = (ParaSt*)malloc(
sizeof(ParaSt) * pstOut->pstCdtTypes[idxDesc].iNum);
memset(pstOut->pstCdtTypes[idxDesc].pstParas,
0,
sizeof(ParaSt) * pstOut->pstCdtTypes[idxDesc].iNum);
}
else
{
LOG_ERR("用例:%s, 中条件因子:%s,不存在任何条件值。",
pstCase->pcBase,
pstCase->stCdts.pstCdts[idxCdt].pcCdtName);
goto LAB_ERR;
}
}
//填充值。
astCdtValItr = (CdtAndValItrSt*)malloc(
sizeof(CdtAndValItrSt) * pstCase->stCdtDesc.iNum);
memset(astCdtValItr, 0, sizeof(CdtAndValItrSt) * pstCase->stCdtDesc.iNum);
idxDesc = 0;
idxDescStart = 0;
for (idxCdt = 0; idxCdt < pstCase->stCdts.iNum; ++idxCdt)
{
//获取对应的条件描述。一般而言相同条件存储在邻近位。
idxDesc = idxDescStart;
iCmp = -1;
while (idxDesc >= 0)
{
iCmp = strcmp(pstCase->stCdtDesc.pstParas[idxDesc].pcName,
pstCase->stCdts.pstCdts[idxCdt].pcCdtName);
if (0 == iCmp)
{
idxDescStart = idxDesc;
break;
}
//先遍历本身及后序,再遍历前序。
if (idxDescStart > 0)
{
if (idxDesc >= idxDescStart)
{
if (idxDesc < pstCase->stCdtDesc.iNum - 1)
{ ++idxDesc; }
else
{ idxDesc = idxDescStart; }
}
else
{
--idxDesc;
}
}
else
{
if (idxDesc < pstCase->stCdtDesc.iNum - 1)
{ ++idxDesc; }
else
{ idxDesc = -1; }
}
}
UTIL_CHK(0 == iCmp);//在前段解析条件数目已保证必定匹配成功。
stSingleCdt.iNum = 1;
stSingleCdt.pstParas = pstCase->stCdtDesc.pstParas + idxDesc;
//解析条件值。
iRet = Para_Parse(&stSingleCdt,
pstCase->stCdts.pstCdts[idxCdt].pcCdtVal,
&stCdtVal);
if (stSingleCdt.iNum != iRet)
{
LOG_ERR("解析用例:%s,条因子:%s的条件值:%s 失败。",
pstCase->pcBase,
stSingleCdt.pstParas->pcName,
pstCase->stCdts.pstCdts[idxCdt].pcCdtVal);
goto LAB_ERR;
}
//赋值。写到尾部。
Util_DataWrite(&(pstOut->pstCdtTypes[idxDesc].pstParas[astCdtValItr[idxDesc].iCdtValItr].stVal),
stCdtVal.pstParas->stVal.eType,
stCdtVal.pstParas->stVal.pData,
0);
Para_Cls(&stCdtVal);
++astCdtValItr[idxDesc].iCdtValItr;
}
pstCase->pCdtsAftP = pstOut;
Util_Free(astCdtValItr);
return true;
LAB_ERR:
_Tst_CdtParseCls(pstOut);
Util_Free(astCdtValItr);
return false;
}
static int _Tst_ScenceRun(CaseSt* pstCase, int* aiCdtIdxs)
{
int iRet;
ParasSt stCntScence = {0};
int iScenceRslt;
int idxCdt;
CaseCdtPSt* pstCdtsP;
int iRsltExpect;
UTIL_CHK(NULL != pstCase);
//显示用例信息
LOG(FMT_SEG4_E);
LOG_FIX_LINE("说 明: %s.\n", pstCase->pcDesc);
LOG("用 例: %s ", pstCase->pcBase);
for (idxCdt = 0; idxCdt < pstCase->stCdtDesc.iNum; ++idxCdt)
{ LOG("%d ", aiCdtIdxs[idxCdt] + 1); }
LOG("\n");
LOG(FMT_SEG4_E);
//场景转换: 将编号转为为具体条件。
if (pstCase->stCdtDesc.iNum != 0 && NULL != aiCdtIdxs)
{
pstCdtsP = (CaseCdtPSt*)pstCase->pCdtsAftP;
stCntScence.iNum = pstCase->stCdtDesc.iNum;
stCntScence.pstParas = (ParaSt*)malloc(sizeof(ParaSt) * stCntScence.iNum);
memset(stCntScence.pstParas, 0, sizeof(ParaSt) * stCntScence.iNum);
//组装条件成对应的场景。
for (idxCdt = 0; idxCdt < pstCase->stCdtDesc.iNum; ++idxCdt)
{
if (aiCdtIdxs[idxCdt] < pstCdtsP->pstCdtTypes[idxCdt].iNum)
{
memcpy(stCntScence.pstParas + idxCdt,
pstCdtsP->pstCdtTypes[idxCdt].pstParas + aiCdtIdxs[idxCdt],
sizeof(ParaSt));
}
else
{
LOG("用 例: %s ", pstCase->pcBase);
for (idxCdt = 0; idxCdt < pstCase->stCdtDesc.iNum; ++idxCdt)
{ LOG("%d ", aiCdtIdxs[idxCdt] + 1); }
LOG("无效\n");
Util_Free(stCntScence.pstParas);
return RET_ERR;
}
}
}
//输出条件名称和值
for (idxCdt = 0; idxCdt < stCntScence.iNum; ++idxCdt)
{
LOG("条件[%s]: ", pstCase->stCdtDesc.pstParas[idxCdt].pcName);
switch (stCntScence.pstParas[idxCdt].stVal.eType)
{
case TYPE_INT:
LOG("%d \n", stCntScence.pstParas[idxCdt].stVal.pData);
break;
case TYPE_STR:
LOG("%s \n", stCntScence.pstParas[idxCdt].stVal.pData);
break;
default:
LOG_ERR("data type invalid.");
return RET_ERR;
}
}
//执行并验证结果。
iRet = pstCase->fnBase(&stCntScence, &iScenceRslt);
if (RET_OK == iRet)
{
iRet = _Tst_GetExpectRslt(pstCase,
aiCdtIdxs,
&iRsltExpect);
if (RET_OK == iRet && iScenceRslt != iRsltExpect)
{ iRet = RET_ERR; }
}
//打印结果。
LOG("\n"FMT_SEG0_E);
if (RET_OK != iRet)
{ LOG("结 果: 失败。\n"); }
else
{ LOG("结 果: 成功。\n"); }
LOG(FMT_SEG0_E);
Util_Free(stCntScence.pstParas);
return iRet;
}
//结果集定义:
//1. 条件因子使用定义时的序号做代指。从1开始编号,编号0做编号1处理。
//2. 以分号隔开单个条件因子的定义域。条件因子取交集作为总体因子集。
//3. 支持! [] & |.
// ! : 取非,作用域为一个竖线隔开的数据段。
// []: 数据范围,如:[1-3]表示数据1/2/3.也支持单个数据,如:[3]。
// 单个数据可以不适用中括号。
// & : 竖线隔开的数据段内数据累加操作。主要为了支持!同时否定多个
// 数据域。
// 例1: 1&2&3 表示只要编号为1或2或3均可。此时与竖线意义相同。
// 例2: !1&2&3 表示编号不为1/2/3中任何一个才匹配成功。
// | : 一个数据段。只需要成功匹配一个数据段,便匹配成功。
//4. 结果也使用整数描述。建议定义结果集时使用某一枚举统一表示。
//
//本处只解析单个条件是否满足要求。从条件名+冒号后续的内容开始解析。
//此处索引位外部编号,从1开始编号。
static int _Tst_ChkCdtInSet(unsigned int uiCdt,
const char* pcSetDesc,
int iStrLen,
bool* pbRslt)
{
int itr = 0;
int iSubStart;
int iSubEnd;
int iRet;
UTIL_CHK(NULL != pbRslt);
*pbRslt = false;
//编号从1开始,0做1处理。
if (0 == uiCdt)
{ uiCdt = 1; }
//如果字符串为空,按照默认适配成功处理。
if (0 == iStrLen || NULL == pcSetDesc)
{ return RET_OK; }
//进行匹配校验。
while (itr < iStrLen)
{
//1. 得到一个用竖线隔开的条件子段。多个竖线做一个竖线处理。
while (itr < iStrLen
&& (UTIL_IS_EMPTY_SYB(pcSetDesc[itr])
|| '|' == pcSetDesc[itr]))
{ ++itr; }
iSubStart = itr;
while ('|' != pcSetDesc[itr] && itr < iStrLen)
{ ++itr; }
iSubEnd = itr - 1;
if (iSubEnd < iSubStart)
{
LOG_INFO_FIX("条件集中存在空的条件描述段:\"%s\" - \"%s\".",
pcSetDesc);
*pbRslt = true;
return RET_OK;
}
//2. 校验该子段是否能成功匹配。
iRet = _Tst_ChkCdtInSeg(uiCdt,
pcSetDesc + iSubStart,
pcSetDesc + iSubEnd,
pbRslt);
if (RET_OK != iRet)
{ return RET_ERR; }
if (*pbRslt)
{ return RET_OK; }
//3. 迭代下一个子段。
}
return RET_OK;
}
static int _Tst_ChkCdtInSeg(unsigned int uiCdt,
const char* pcSegStart,
const char* pcSegEnd,
bool* pbRslt)
{
const char* pcItr = pcSegStart;
//整个段是否需要取非。
bool bReverse = false;
//数据域。
unsigned long ulFieldStart;
unsigned long ulFieldEnd;
//一个临时解析段。
const char* pcStart;
const char* pcEnd;
//依据&字符分隔出的数据域。
const char* pcSubStart;
const char* pcSubEnd;
UTIL_CHK(NULL != pcSegStart && NULL != pcSegEnd && pcSegEnd >= pcSegStart
&& NULL != pbRslt);
*pbRslt = false;
//感叹号只能出现于段第一个字符。
while (pcItr <= pcSegEnd && ('!' == *pcItr || UTIL_IS_EMPTY_SYB(*pcItr)))
{
if ('!' == *pcItr)
{ bReverse = !bReverse; }
++pcItr;
}
if (pcItr > pcSegEnd)
{
LOG_INFO_FIX("条件集中存在只包含取非字符的描述段.");
return RET_OK;
}
while (pcItr <= pcSegEnd)
{
//根据&符号截取出子段。
while (pcItr <= pcSegEnd && '&' == *pcItr)
{ ++pcItr; }
pcSubStart = pcItr;
while (pcItr <= pcSegEnd && '&' != *pcItr)
{ ++pcItr; }
pcSubEnd = pcItr - 1;
if (pcSubStart > pcSegEnd)
{ break; }
//解析数据域。
pcItr = pcSubStart;
if ('[' == *pcItr)
{
++pcItr;
//中括号内可以是单个数据,也可以是一个数据段。无需支持负数。
pcStart = pcItr;
while (pcItr <= pcSubEnd && *pcItr != '-' && *pcItr != ']')
{ ++pcItr; }
if (pcItr > pcSubEnd)
{
LOG_INFO_FIX("无效条件集,数据域不存在结束符\']\':\"%s\".",
pcSubStart);
return RET_ERR;
}
pcEnd = pcItr - 1;
if (!Util_StrNGetLong(pcStart, pcEnd - pcStart + 1, (long*)&ulFieldStart))
{
LOG_INFO_FIX("无效条件集,期待一个整数:\"%s\" - \"%s\".",
pcSubStart,
pcStart);
return RET_ERR;
}
ulFieldEnd = ulFieldStart;
if ('-' == *pcItr)
{
++pcItr;
pcStart = pcItr;
while (pcItr <= pcSubEnd && *pcItr != ']')
{ ++pcItr; }
if (pcItr > pcSubEnd)
{
LOG_INFO_FIX("无效条件集,数据域不存在结束符\']\':\"%s\" - \"%s\".",
pcSegStart,
pcStart);
}
pcEnd = pcItr - 1;
if (!Util_StrNGetLong(pcStart, pcEnd - pcStart + 1, (long*)&ulFieldEnd))
{
LOG_INFO_FIX("无效条件集,期待一个整数:\"%s\" - \"%s\".",
pcSegStart,
pcStart);
return RET_ERR;
}
}
}
else
{
if (!Util_StrNGetLong(pcSubStart, pcSubEnd - pcSubStart + 1, (long*)&ulFieldStart))
{
LOG_INFO_FIX("无效条件集,期待一个整数:\"%s\" - \"%s\".",
pcSegStart,
pcSubStart);
return RET_ERR;
}
ulFieldEnd = ulFieldStart;
}
//域判断
if (uiCdt >= ulFieldStart && uiCdt <= ulFieldEnd)
{
if (bReverse)
{ return RET_OK; }
else
{
*pbRslt = true;
return RET_OK;
}
}
pcItr = pcSubEnd + 1;
}
if (bReverse)
{ *pbRslt = true; }
return RET_OK;
}
static int _Tst_GetExpectRslt(CaseSt* pstCase, int* piCdts, int* piExpect)
{
int idxCdt;
int idxRslt;
const char* pcCdtStart;
int iCdtLen;
const char* pcItr;
const char* pcCdtName;
int iCdtNameLen;
int iTmp;
bool bMatchOk;
UTIL_CHK(NULL != pstCase && NULL != piExpect);
*piExpect = pstCase->stRslt.iDfltRslt;
//若未有指定结果集,按默认值处理。
if (0 == pstCase->stRslt.iNum || 0 == pstCase->stCdtDesc.iNum)
{ return RET_OK; }
if (NULL == piCdts)
{
LOG_ERR("未指定场景条件。");
return RET_ERR;
}
//遍历匹配全部条件集。
for (idxRslt = 0; idxRslt < pstCase->stRslt.iNum; ++idxRslt)
{
pcItr = pstCase->stRslt.pstRslts[idxRslt].pcCdtSet;
bMatchOk = true;
//验证单个条件集。对以未指定的条件因子按照匹配处理。
while (*pcItr != '\0')
{
//得到并校验单个条件段。条件段以分号隔开。
pcCdtStart = pcItr;
while (';' != *pcItr && '\0' != *pcItr)
{ ++pcItr; }
iCdtLen = pcItr - pcCdtStart;
if (';' == *pcItr)
{ ++pcItr; }
//找到对应的条件索引。
//先得到条件名。
pcCdtName = pcCdtStart;
iCdtNameLen = iCdtLen;
while (UTIL_IS_EMPTY_SYB(*pcCdtName))
{
++pcCdtName;
--iCdtNameLen;
}
iTmp = 0;
while (pcCdtName[iTmp] != ':' && iTmp <= iCdtNameLen)
{ ++iTmp; }
if (iTmp >= iCdtNameLen)
{
LOG_INFO_FIX("条件集子段缺乏条件头:\"%s\" - \"%s\"",
pcCdtStart,
pcCdtName);
return RET_ERR;
}
iCdtLen -= (pcCdtName + iTmp + 1 - pcCdtStart);
pcCdtStart = pcCdtName + iTmp + 1;
--iTmp;
while (UTIL_IS_EMPTY_SYB(pcCdtName[iTmp]))
{ --iTmp; }
iCdtNameLen = iTmp + 1;
//找到条件索引。
idxCdt = 0;
while (idxCdt < pstCase->stCdtDesc.iNum)
{
if (0 == Util_StrNCmpIgrUp(pcCdtName,
pstCase->stCdtDesc.pstParas[idxCdt].pcName,
iCdtNameLen)
&& '\0' == pstCase->stCdtDesc.pstParas[idxCdt].pcName[iCdtNameLen])
{ break; }
++idxCdt;
}
if (idxCdt == pstCase->stCdtDesc.iNum)
{
LOG_INFO_FIX("字符串\"%s\"中存在无效条件因子。", pcCdtName);
return RET_ERR;
}
//匹配单个条件段。外部描述从1开始编号,序号需要加1.
if (RET_OK != _Tst_ChkCdtInSet(piCdts[idxCdt] + 1,
pcCdtStart,
iCdtLen,
&bMatchOk))
{
bMatchOk = false;
break;
}
if (!bMatchOk)
{ break; }
}
//返回匹配结果。
if (bMatchOk)
{
*piExpect = pstCase->stRslt.pstRslts[idxRslt].iRslt;
return RET_OK;
}
}
//使用默认结果。
if (pstCase->stRslt.bUseDflt)
{
*piExpect = pstCase->stRslt.iDfltRslt;
return RET_OK;
}
else
{ LOG_INFO_FIX("条件、结果转换表中未定义该场景,且不允许使用默认结果。"); }
return RET_ERR;
}
|
fb4baab6caef56d68aa12a468be519e2a732f1a2
|
c9acf16fa187640c936deb31ed2b7c7316b15377
|
/Phase_2/Software/Si4463_Example/spi.h
|
1892e3fd9e66a2793d305e618132bc52caeff02d
|
[
"MIT"
] |
permissive
|
ONLYA/Jumping_Robot
|
94e96ae2c893cbf94cb5a9113c95173b4eeab51b
|
f198c9a58211234dc6348de2b8e55a660ea1783e
|
refs/heads/master
| 2021-07-15T22:29:28.909063 | 2021-07-02T21:58:16 | 2021-07-02T21:58:16 | 190,989,431 | 6 | 1 |
MIT
| 2019-06-22T17:03:00 | 2019-06-09T09:49:06 |
Batchfile
|
UTF-8
|
C
| false | false | 999 |
h
|
spi.h
|
/*
** ============================================================================
**
** FILE
** spi.h
**
** DESCRIPTION
** Header file for SPI routines
**
** CREATED
** Silicon Laboratories Hungary Ltd
**
** COPYRIGHT
** Copyright 2011 Silicon Laboratories, Inc.
** http://www.silabs.com
**
** ============================================================================
*/
#ifndef SPI_H
#define SPI_H
extern SEGMENT_VARIABLE(fSelectState, U8, SEG_DATA);
extern BIT fSPIDisabled;
/* ======================================= *
* F U N C T I O N P R O T O T Y P E S *
* ======================================= */
U8 Spi1ReadWrite(U8 data_in);
void Spi1Enable(void);
void Spi1Disable(void);
void SpiClearNsel(U8 sel);
void SpiSetNsel(U8 sel);
U8 bSpi_SendDataNoResp(U8 bDataInLength, U8 *pbDataIn);
U8 bSpi_SendDataGetResp(U8 bDataOutLength, U8 *pbDataOut);
U8 bSpi_SendDataByte(U8 bDataIn);
#endif
|
9e7a2092846a70a73f35f84fdc903664349b155e
|
359c15f41d4bfd1bd0ed398c3c14184d2f962b32
|
/Return with argument.c
|
67f0b189e28d3a86de51c23b47b917f337b2cfc3
|
[] |
no_license
|
MANZ-RZL/Assignment-V
|
7e49a12b0c00855eb24625744aede733dde0e93b
|
e08a2306b7b21eb0a84c7713aefcb078c37b0c3c
|
refs/heads/master
| 2021-01-19T08:17:07.769983 | 2017-02-15T18:19:59 | 2017-02-15T18:19:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 437 |
c
|
Return with argument.c
|
//WAP to check whether the number is divisible by 5 and 7 with Return with argument
#include <stdio.h>
int div(int num)
{
if (num%5==0&&num%7==0)
{
return 1;
}
else
{
return 0;
}
}
void main()
{
int num,dis;
printf("Enter number : ");
scanf("%d",&num);
dis = div(num);
if (dis == 1)
{
printf("It is divisible by 5 and 7");
}
else
{
printf("It is NOT divisible by 5 and 7");
}
return 0;
}
|
8dae5a4dfd40fd37ffba41888f07684c9d2a82e6
|
71c1045b32199d8249e1ec403f629e43d93243b0
|
/sys/arch/mvme68k/include/ptrace.h
|
62e928c3822fcc383881cd9458d3f8506896d5f3
|
[] |
no_license
|
syuu1228/openbsd-src
|
0aa248304d626bcca640070915fcf3b7a4eb4753
|
ca0d3073d059b7237a1392dde772265698465272
|
refs/heads/master
| 2020-06-03T17:15:44.787020 | 2012-07-05T04:23:33 | 2012-07-05T04:23:33 | 4,901,793 | 2 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 162 |
h
|
ptrace.h
|
/* $OpenBSD: src/sys/arch/mvme68k/include/ptrace.h,v 1.3 1996/04/28 10:56:30 deraadt Exp $ */
/* Just use the common m68k definition */
#include <m68k/ptrace.h>
|
c297db4c5285f9d89f608651275edb2aa368d4f9
|
85a6fc22fbe7694eed37465b8e3fb3805f7e489f
|
/test-programs/test.c
|
173572e41cdc334066a591987b3fc604dd6a50db
|
[] |
no_license
|
jhalak/c_tutorial
|
2ec9dc316b7474de874c5be92fb7df75466df362
|
05154c5757ae40d73a3e246a9901a74458be35ad
|
refs/heads/master
| 2021-01-23T05:36:06.239565 | 2013-06-04T16:20:53 | 2013-06-04T16:20:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 95 |
c
|
test.c
|
#include <stdio.h>
int main (void) {
printf("jhalak \n nanda \n beli \n");
return 0;
}
|
2cd7510b76860044f8a49ce84ef6b1b9a8ff12e2
|
ae47bfe3f057fffd2592982e7c14a072190515e2
|
/imxrt1050_Project/imxSDK/SDK_2.6.1_ArchMix/boards/evkbimxrt1050/driver_examples/qtmr/timer/qtmr_timer.c
|
6c7e6287fb2d4a210e687b4f0a966273a74069a1
|
[] |
no_license
|
marxw3179/PMSM_Control_source
|
4ecf4f12d0472e0a2f7a133393e03a14e39d925c
|
600ac632da8c312fba3acf5f3f33827a1b8cb894
|
refs/heads/master
| 2022-07-23T16:50:23.997717 | 2020-05-17T16:27:41 | 2020-05-17T16:27:41 | 281,535,794 | 1 | 0 | null | 2020-07-22T00:39:59 | 2020-07-22T00:39:59 | null |
UTF-8
|
C
| false | false | 5,714 |
c
|
qtmr_timer.c
|
/*
* Copyright 2017 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*******************************************************************************
* Includes
******************************************************************************/
#include "fsl_debug_console.h"
#include "board.h"
#include "fsl_qtmr.h"
#include "pin_mux.h"
#include "clock_config.h"
/*******************************************************************************
* Definitions
******************************************************************************/
/* The QTMR instance/channel used for board */
#define BOARD_QTMR_BASEADDR TMR3
#define BOARD_FIRST_QTMR_CHANNEL kQTMR_Channel_0
#define BOARD_SECOND_QTMR_CHANNEL kQTMR_Channel_1
#define QTMR_ClockCounterOutput kQTMR_ClockCounter0Output
/* Interrupt number and interrupt handler for the QTMR instance used */
#define QTMR_IRQ_ID TMR3_IRQn
#define QTMR_IRQ_HANDLER TMR3_IRQHandler
/* Get source clock for QTMR driver */
#define QTMR_SOURCE_CLOCK CLOCK_GetFreq(kCLOCK_IpgClk)
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
volatile bool qtmrIsrFlag = false;
/*******************************************************************************
* Code
******************************************************************************/
void QTMR_IRQ_HANDLER(void)
{
/* Clear interrupt flag.*/
QTMR_ClearStatusFlags(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_CompareFlag);
qtmrIsrFlag = true;
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
exception return operation might vector to incorrect interrupt */
#if defined __CORTEX_M && (__CORTEX_M == 4U)
__DSB();
#endif
}
/*!
* @brief Main function
*/
int main(void)
{
uint8_t i = 0;
qtmr_config_t qtmrConfig;
/* Board pin, clock, debug console init */
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
PRINTF("\r\n*********QUADTIMER EXAMPLE START*********");
/*
* qtmrConfig.debugMode = kQTMR_RunNormalInDebug;
* qtmrConfig.enableExternalForce = false;
* qtmrConfig.enableMasterMode = false;
* qtmrConfig.faultFilterCount = 0;
* qtmrConfig.faultFilterPeriod = 0;
* qtmrConfig.primarySource = kQTMR_ClockDivide_2;
* qtmrConfig.secondarySource = kQTMR_Counter0InputPin;
*/
QTMR_GetDefaultConfig(&qtmrConfig);
/* Use IP bus clock div by 128 */
qtmrConfig.primarySource = kQTMR_ClockDivide_128;
PRINTF("\r\n****Timer use-case, 50 millisecond tick.****\n");
QTMR_Init(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, &qtmrConfig);
/* Set timer period to be 50 millisecond */
QTMR_SetTimerPeriod(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, MSEC_TO_COUNT(50U, (QTMR_SOURCE_CLOCK / 128)));
/* Enable at the NVIC */
EnableIRQ(QTMR_IRQ_ID);
/* Enable timer compare interrupt */
QTMR_EnableInterrupts(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_CompareInterruptEnable);
/* Start the second channel to count on rising edge of the primary source clock */
QTMR_StartTimer(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_PriSrcRiseEdge);
for (i = 0; i < 10; i++)
{
/* Check whether occur interupt */
while (!(qtmrIsrFlag))
{
}
PRINTF("\r\n Timer interrupt has occurred !");
qtmrIsrFlag = false;
}
QTMR_Deinit(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL);
PRINTF("\r\n****Chain Timer use-case, 10 second tick.****\n");
/* Init the first channel to use the IP Bus clock div by 128 */
qtmrConfig.primarySource = kQTMR_ClockDivide_128;
QTMR_Init(BOARD_QTMR_BASEADDR, BOARD_FIRST_QTMR_CHANNEL, &qtmrConfig);
/* Init the second channel to use output of the first channel as we are chaining the first channel and the second
* channel */
qtmrConfig.primarySource = QTMR_ClockCounterOutput;
QTMR_Init(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, &qtmrConfig);
/* Set the first channel period to be 1 millisecond */
QTMR_SetTimerPeriod(BOARD_QTMR_BASEADDR, BOARD_FIRST_QTMR_CHANNEL, MSEC_TO_COUNT(1U, (QTMR_SOURCE_CLOCK / 128)));
/* Set the second channel count which increases every millisecond, set compare event for 10 second */
QTMR_SetTimerPeriod(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, 10000);
/* Enable the second channel compare interrupt */
QTMR_EnableInterrupts(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_CompareInterruptEnable);
/* Start the second channel in cascase mode, chained to the first channel as set earlier via the primary source
* selection */
QTMR_StartTimer(BOARD_QTMR_BASEADDR, BOARD_SECOND_QTMR_CHANNEL, kQTMR_CascadeCount);
/* Start the first channel to count on rising edge of the primary source clock */
QTMR_StartTimer(BOARD_QTMR_BASEADDR, BOARD_FIRST_QTMR_CHANNEL, kQTMR_PriSrcRiseEdge);
for (i = 0; i < 5; i++)
{
/* Check whether occur interupt */
while (!(qtmrIsrFlag))
{
}
PRINTF("\r\n Timer interrupt has occurred !");
qtmrIsrFlag = false;
}
PRINTF("\r\n*********QUADTIMER EXAMPLE END.*********");
while (1)
{
}
}
|
12ee05011564fa879d1dd35a11ae8b367d4b595b
|
45216c54e06e6c7a895a3672a9ac01010362e67f
|
/Games/Space_Intercept_Joseph_Weisbecker_1978.h
|
7c0fc91befb561880bd418cdba5511472be3b04c
|
[
"MIT",
"BSD-3-Clause",
"CC-BY-4.0",
"ISC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
jockm/KeyCadeNano
|
995608b0966e2f9c02638896ed0e78d5d5c47af3
|
7eb36582fee0bf0d1b40139f864944106f52a913
|
refs/heads/master
| 2021-05-01T21:03:44.500168 | 2018-02-23T23:27:08 | 2018-02-23T23:27:08 | 120,970,254 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 1,316 |
h
|
Space_Intercept_Joseph_Weisbecker_1978.h
|
const uint8_t Space_Intercept_Joseph_Weisbecker_1978_ch8[] = {
0xf0, 0x0a, 0x30, 0x02, 0x12, 0x0a, 0xa2, 0xba, 0x12, 0x0c, 0xa2, 0xb4,
0xf5, 0x65, 0xa2, 0xc0, 0xf3, 0x55, 0xa2, 0xc0, 0x66, 0x00, 0xd6, 0x33,
0xa0, 0x06, 0x67, 0x1d, 0x68, 0x1f, 0xd7, 0x81, 0x69, 0x00, 0x6a, 0x0f,
0x22, 0x86, 0x22, 0x90, 0x4a, 0x00, 0x12, 0x2a, 0x67, 0x1e, 0x68, 0x1c,
0xa2, 0xb1, 0xd7, 0x83, 0x6e, 0x00, 0x6b, 0x80, 0x6d, 0x04, 0xed, 0xa1,
0x6b, 0xff, 0x6d, 0x05, 0xed, 0xa1, 0x6b, 0x00, 0x6d, 0x06, 0xed, 0xa1,
0x6b, 0x01, 0x4b, 0x80, 0x12, 0x52, 0x6e, 0x01, 0xfd, 0x18, 0xa2, 0xc0,
0xd6, 0x33, 0x86, 0x44, 0xd6, 0x33, 0x3f, 0x00, 0x12, 0x74, 0x4e, 0x00,
0x12, 0x36, 0xa2, 0xb1, 0xd7, 0x83, 0x48, 0x00, 0x12, 0x80, 0x78, 0xff,
0x87, 0xb4, 0xd7, 0x83, 0x3f, 0x01, 0x12, 0x52, 0xfd, 0x18, 0x22, 0x86,
0x89, 0x54, 0x22, 0x86, 0xa2, 0xb1, 0xd7, 0x83, 0x22, 0x90, 0x7a, 0xff,
0x12, 0x26, 0xa2, 0xc3, 0xf9, 0x33, 0x6c, 0x00, 0x22, 0x9a, 0x00, 0xee,
0xa2, 0xc3, 0xfa, 0x33, 0x6c, 0x32, 0x22, 0x9a, 0x00, 0xee, 0x6d, 0x1b,
0xf2, 0x65, 0xf0, 0x29, 0xdc, 0xd5, 0x7c, 0x05, 0xf1, 0x29, 0xdc, 0xd5,
0x7c, 0x05, 0xf2, 0x29, 0xdc, 0xd5, 0x00, 0xee, 0x01, 0x40, 0xe0, 0xa0,
0x7c, 0xfe, 0x7c, 0x08, 0x01, 0x05, 0x60, 0xf0, 0x60, 0x03, 0x01, 0x0f
};
unsigned int Space_Intercept_Joseph_Weisbecker_1978_ch8_len = 192;
|
64ca953d2a5ae1207a927f68cb5362db94b748ea
|
2bc835b044f306fca1affd1c61b8650b06751756
|
/connectionwizard/inet32/global.h
|
7a6c2398ddbc78f7e0e288bb741afbaa1a8f3094
|
[] |
no_license
|
KernelPanic-OpenSource/Win2K3_NT_inetcore
|
bbb2354d95a51a75ce2dfd67b18cfb6b21c94939
|
75f614d008bfce1ea71e4a727205f46b0de8e1c3
|
refs/heads/master
| 2023-04-04T02:55:25.139618 | 2021-04-14T05:25:01 | 2021-04-14T05:25:01 | 357,780,123 | 1 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 3,618 |
h
|
global.h
|
//*********************************************************************
//* Microsoft Windows **
//* Copyright(c) Microsoft Corp., 1994-1995 **
//*********************************************************************
//
// GLOBAL.H - central header file for Internet config library
//
// HISTORY:
//
// 96/05/22 markdu Created (from inetcfg.dll)
//
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#define STRICT // Use strict handle types
#define _SHELL32_
#ifdef DEBUG
// component name for debug spew
#define SZ_COMPNAME "ICFG32: "
#endif // DEBUG
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <prsht.h>
#include <regstr.h>
#include "..\inc\oharestr.h"
// various RNA header files
#include <ras.h>
//#include <rnaph.h>
#include "..\inc\wizglob.h"
#include "..\inc\wizdebug.h"
#undef DATASEG_READONLY
#define DATASEG_READONLY ".rdata"
#include "inetcfg.h"
#include "cfgapi.h"
#include "clsutil.h"
#include "tcpcmn.h"
#include "ids.h"
#include "strings.h"
// Terminology: ISP - Internet Service Provider
// Defines
#define MAX_RES_LEN 255 // max length of string resources
#define SMALL_BUF_LEN 48 // convenient size for small text buffers
// Globals
extern HINSTANCE ghInstance; // global module instance handle
extern LPSTR gpszLastErrorText; // hold text of last error
// Defines
// error class defines for PrepareErrorMessage
#define ERRCLS_STANDARD 0x0001
#define ERRCLS_SETUPX 0x0002
#define ERRCLS_RNA 0x0003
#define ERRCLS_MAPI 0x0004
#define OK 0 // success code for SETUPX class errors
// functions in PROPMGR.C
UINT GetConfig(CLIENTCONFIG * pClientConfig,DWORD * pdwErrCls);
// functions in CALLOUT.C
UINT InstallTCPIP(HWND hwndParent);
UINT InstallPPPMAC(HWND hwndParent);
// functions in UTIL.C
int MsgBox(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons);
int MsgBoxSz(HWND hWnd,LPSTR szText,UINT uIcon,UINT uButtons);
//int _cdecl MsgBoxParam(HWND hWnd,UINT nMsgID,UINT uIcon,UINT uButtons,...);
LPSTR LoadSz(UINT idString,LPTSTR lpszBuf,UINT cbBuf);
VOID _cdecl PrepareErrorMessage(UINT uStrID,UINT uError,
UINT uErrorClass,UINT uIcon,...);
VOID GetErrorDescription(CHAR * pszErrorDesc,UINT cbErrorDesc,
UINT uError,UINT uErrorClass);
DWORD RunMlsetExe(HWND hwndOwner);
VOID RemoveRunOnceEntry(UINT uResourceID);
BOOL GenerateDefaultName(CHAR * pszName,DWORD cbName,CHAR * pszRegValName,
UINT uIDDefName);
BOOL GenerateComputerNameIfNeeded(VOID);
DWORD MsgWaitForMultipleObjectsLoop(HANDLE hEvent);
// 10/24/96 jmazner Normandy 6968
// No longer neccessary thanks to Valdon's hooks for invoking ICW.
//BOOL SetDesktopInternetIconToBrowser(VOID);
VOID PrepareForRunOnceApp(VOID);
// functions in INETAPI.C
BOOL DoDNSCheck(HWND hwndParent,BOOL * pfNeedRestart);
// functions in WIZDLL.C
RETERR GetClientConfig(CLIENTCONFIG * pClientConfig);
UINT InstallComponent(HWND hwndParent,DWORD dwComponent,DWORD dwParam);
RETERR RemoveUnneededDefaultComponents(HWND hwndParent);
RETERR RemoveProtocols(HWND hwndParent,DWORD dwRemoveFromCardType,DWORD dwProtocols);
RETERR BeginNetcardTCPIPEnum(VOID);
BOOL GetNextNetcardTCPIPNode(LPSTR pszTcpNode,WORD cbTcpNode,DWORD dwFlags);
// structure for getting proc addresses of api functions
typedef struct APIFCN {
PVOID * ppFcnPtr;
LPCSTR pszName;
} APIFCN;
#undef DATASEG_PERINSTANCE
#define DATASEG_PERINSTANCE ".instance"
#define DATASEG_SHARED ".data"
#define DATASEG_DEFAULT DATASEG_SHARED
#endif // _GLOBAL_H_
|
4398869fb9d83cb97750c7b341772f7e4393e296
|
a33aac97878b2cb15677be26e308cbc46e2862d2
|
/program_data/PKU_raw/56/2224.c
|
8c4771b72112941b166dc9a4504199a51d423ca3
|
[] |
no_license
|
GabeOchieng/ggnn.tensorflow
|
f5d7d0bca52258336fc12c9de6ae38223f28f786
|
7c62c0e8427bea6c8bec2cebf157b6f1ea70a213
|
refs/heads/master
| 2022-05-30T11:17:42.278048 | 2020-05-02T11:33:31 | 2020-05-02T11:33:31 | null | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 136 |
c
|
2224.c
|
int main(){
int a,i=1,j=1;
scanf("%d",&a);
while(i*=10)
if(a/i==0) break;
while(j<i){
printf("%d",(a/j)%10);
j*=10;
}
}
|
17ed98cf474504bd177cfb3fd1566df3adbf77df
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/net/dccp/feat.h
|
90b957d34d2602987d49175ef483af3463f9c523
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792 | 2023-04-03T07:18:12 | 2023-04-03T07:18:12 | 80,094,055 | 507 | 92 |
Apache-2.0
| 2023-04-03T07:05:59 | 2017-01-26T07:25:50 |
C
|
UTF-8
|
C
| false | false | 4,750 |
h
|
feat.h
|
#ifndef _DCCP_FEAT_H
#define _DCCP_FEAT_H
/*
* net/dccp/feat.h
*
* Feature negotiation for the DCCP protocol (RFC 4340, section 6)
* Copyright (c) 2008 Gerrit Renker <[email protected]>
* Copyright (c) 2005 Andrea Bittau <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/types.h>
#include "dccp.h"
/*
* Known limit values
*/
/* Ack Ratio takes 2-byte integer values (11.3) */
#define DCCPF_ACK_RATIO_MAX 0xFFFF
/* Wmin=32 and Wmax=2^46-1 from 7.5.2 */
#define DCCPF_SEQ_WMIN 32
#define DCCPF_SEQ_WMAX 0x3FFFFFFFFFFFull
/* Maximum number of SP values that fit in a single (Confirm) option */
#define DCCP_FEAT_MAX_SP_VALS (DCCP_SINGLE_OPT_MAXLEN - 2)
enum dccp_feat_type {
FEAT_AT_RX = 1, /* located at RX side of half-connection */
FEAT_AT_TX = 2, /* located at TX side of half-connection */
FEAT_SP = 4, /* server-priority reconciliation (6.3.1) */
FEAT_NN = 8, /* non-negotiable reconciliation (6.3.2) */
FEAT_UNKNOWN = 0xFF /* not understood or invalid feature */
};
enum dccp_feat_state {
FEAT_DEFAULT = 0, /* using default values from 6.4 */
FEAT_INITIALISING, /* feature is being initialised */
FEAT_CHANGING, /* Change sent but not confirmed yet */
FEAT_UNSTABLE, /* local modification in state CHANGING */
FEAT_STABLE /* both ends (think they) agree */
};
/**
* dccp_feat_val - Container for SP or NN feature values
* @nn: single NN value
* @sp.vec: single SP value plus optional preference list
* @sp.len: length of @sp.vec in bytes
*/
typedef union {
u64 nn;
struct {
u8 *vec;
u8 len;
} sp;
} dccp_feat_val;
/**
* struct feat_entry - Data structure to perform feature negotiation
* @val: feature's current value (SP features may have preference list)
* @state: feature's current state
* @feat_num: one of %dccp_feature_numbers
* @needs_mandatory: whether Mandatory options should be sent
* @needs_confirm: whether to send a Confirm instead of a Change
* @empty_confirm: whether to send an empty Confirm (depends on @needs_confirm)
* @is_local: feature location (1) or feature-remote (0)
* @node: list pointers, entries arranged in FIFO order
*/
struct dccp_feat_entry {
dccp_feat_val val;
enum dccp_feat_state state:8;
u8 feat_num;
bool needs_mandatory,
needs_confirm,
empty_confirm,
is_local;
struct list_head node;
};
static inline u8 dccp_feat_genopt(struct dccp_feat_entry *entry)
{
if (entry->needs_confirm)
return entry->is_local ? DCCPO_CONFIRM_L : DCCPO_CONFIRM_R;
return entry->is_local ? DCCPO_CHANGE_L : DCCPO_CHANGE_R;
}
/**
* struct ccid_dependency - Track changes resulting from choosing a CCID
* @dependent_feat: one of %dccp_feature_numbers
* @is_local: local (1) or remote (0) @dependent_feat
* @is_mandatory: whether presence of @dependent_feat is mission-critical or not
* @val: corresponding default value for @dependent_feat (u8 is sufficient here)
*/
struct ccid_dependency {
u8 dependent_feat;
bool is_local:1,
is_mandatory:1;
u8 val;
};
/*
* Sysctls to seed defaults for feature negotiation
*/
extern unsigned long sysctl_dccp_sequence_window;
extern int sysctl_dccp_rx_ccid;
extern int sysctl_dccp_tx_ccid;
extern int dccp_feat_init(struct sock *sk);
extern void dccp_feat_initialise_sysctls(void);
extern int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local,
u8 const *list, u8 len);
extern int dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
u8 mand, u8 opt, u8 feat, u8 *val, u8 len);
extern int dccp_feat_clone_list(struct list_head const *, struct list_head *);
/*
* Encoding variable-length options and their maximum length.
*
* This affects NN options (SP options are all u8) and other variable-length
* options (see table 3 in RFC 4340). The limit is currently given the Sequence
* Window NN value (sec. 7.5.2) and the NDP count (sec. 7.7) option, all other
* options consume less than 6 bytes (timestamps are 4 bytes).
* When updating this constant (e.g. due to new internet drafts / RFCs), make
* sure that you also update all code which refers to it.
*/
#define DCCP_OPTVAL_MAXLEN 6
extern void dccp_encode_value_var(const u64 value, u8 *to, const u8 len);
extern u64 dccp_decode_value_var(const u8 *bf, const u8 len);
extern u64 dccp_feat_nn_get(struct sock *sk, u8 feat);
extern int dccp_insert_option_mandatory(struct sk_buff *skb);
extern int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat,
u8 *val, u8 len, bool repeat_first);
#endif /* _DCCP_FEAT_H */
|
1abd855c8528c24b2e99ba3f6bd2c7d1b44e90df
|
0d4a93ad98f06b5722426c48d0ab15016c1a4403
|
/common/random.c
|
9264cbecbe8a04a1029205eaffa0ad617b406899
|
[
"MIT"
] |
permissive
|
kurazu/baremetal
|
2325868dd46d01044683c1e0945cef61c03da465
|
a4c6e13546d22934903b3cb6c1def7a287d6ef2e
|
refs/heads/master
| 2021-01-11T00:28:12.451949 | 2016-10-10T21:17:14 | 2016-10-10T21:17:14 | 70,528,563 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 854 |
c
|
random.c
|
#include "mem.h"
#include "random.h"
volatile unsigned * setup_random() {
return setup_memory(RANDOM_BASE);
}
void teardown_random(volatile unsigned * const random_generator) {
return teardown_memory(random_generator);
}
void start_random(volatile unsigned * const random_generator) {
*random_generator = RANDOM_NORMAL_SPEED;
}
int random_has_data(volatile unsigned * const random_generator) {
volatile unsigned * const random_status_word = random_generator + 1;
const unsigned status = *random_status_word;
const unsigned valid_words_count = (status & 0xff000000) >> 24;
return valid_words_count > 0;
}
unsigned get_random(volatile unsigned * const random_generator) {
while (!random_has_data(random_generator));
volatile unsigned * const random_data_word = random_generator + 2;
return *random_data_word;
}
|
b20df48658a242452ea3352a75ddb14ae1b50121
|
f7910d61ef9ff49016ae631775a1138502b04afc
|
/cw04/zad1/header.h
|
9da3f7d51443a0571e0ced97e1c4511d9d26777d
|
[] |
no_license
|
JanickiJ/Sysopy
|
d1b9084f8baad3b435b6a56ab99395a3eaf6e44d
|
655b09ff0b895d513f6bbaf15ee12eef59de0281
|
refs/heads/master
| 2023-05-31T22:39:34.056695 | 2021-06-29T20:10:11 | 2021-06-29T20:10:11 | 381,485,026 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 979 |
h
|
header.h
|
//
// Created by ja on 13.04.2021.
//
#ifndef CW04_HADER_H
#define CW04_HADER_H
#include <string.h>
void handler(int signum){
printf("Signal SIGUSR1 received by handler\n");
}
enum option{
IGNORE,
HANDLER,
MASK,
PENDING
};
enum function{
FORK,
EXEC
};
enum option assign_option(char* input){
if(strcmp("ignore", input) == 0){
return IGNORE;
}
else if(strcmp("handler", input) == 0){
return HANDLER;
}
else if(strcmp("mask", input) == 0){
return MASK;
}
else if(strcmp("pending", input) == 0){
return PENDING;
} else{
fprintf(stderr,"Incorrect input: %s", input);
exit(1);
}
};
enum function assign_function(char* input){
if(strcmp("fork", input) == 0){
return FORK;
}
else if(strcmp("exec", input) == 0){
return EXEC;
}else{
fprintf(stderr,"Incorrect input: %s", input);
exit(1);
}
}
#endif //CW04_HADER_H
|
4a354da349a096eacb3106e1824b328cb7b999bc
|
4c71a4458bc7d7ea83c9ef2445655916d0dccc70
|
/levels.h
|
cb347c3255f5d8ee4b3cdcd14e5f3bce205f8a1f
|
[] |
no_license
|
luozikuan/HuaRongDao
|
33066201208394c3af6c88d62e86dcbb76171f25
|
5d7ecdec87419ea0a0141cdd306c66bb7ea8f6c6
|
refs/heads/main
| 2023-03-02T22:53:01.433153 | 2021-02-14T03:00:38 | 2021-02-14T03:00:38 | 338,720,093 | 0 | 0 | null | null | null | null |
UTF-8
|
C
| false | false | 563 |
h
|
levels.h
|
#ifndef LEVELS_H
#define LEVELS_H
#include <QStringList>
QStringList puzzle {
"--",
// 1
"a00b.00cdeefghifghi.",
"a00bc00bdeefghhf.ii.",
"a00ba00bcddecfgeh..i",
"a00fb00fyggcymmd.hh.",
"...a00fy00fyhmgghmii",
// 6
"a00bc00df.ggf.mmhhww",
"00fy00fyggabhmcdhm..",
"gg00hh00mmzza.bfc.df",
"f00af00bggcdyhhmy..m",
"00af00bfgghhzzmmc..d",
// 11
"fyhmfyhm.00.a00bggcd",
".abc00fy00fygghdmmh.",
"f00yf00yhggahmmbc..d",
"f00af00bygghymmhc..d",
"f00yf00yah.bch.dggmm",
};
#endif // LEVELS_H
|
fc337d31ad82ed5a33514d301a3d29b2b3a421da
|
2ee3a0c398cb452fe3b20391c476e8462586dadf
|
/libIPLAY/libSrc/mac80211_3/include/linux/compat-2.6.36.h
|
91de463af66653dc1bd78f6b969fa3c3fd488c5c
|
[] |
no_license
|
gradliang/fusion1
|
a08f8f0b8a15716628db412d6db0fa664eba3f29
|
07972a0da8cc09faf3ebe801283c87430c71804b
|
refs/heads/master
| 2021-07-18T03:00:41.118177 | 2020-08-11T02:08:30 | 2020-08-11T02:08:30 | 203,027,101 | 1 | 1 | null | null | null | null |
UTF-8
|
C
| false | false | 3,298 |
h
|
compat-2.6.36.h
|
#ifndef LINUX_26_36_COMPAT_H
#define LINUX_26_36_COMPAT_H
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
#include <linux/usb.h>
#include <linux/pm_qos_params.h>
#include <linux/smp_lock.h>
#define kparam_block_sysfs_write(a)
#define kparam_unblock_sysfs_write(a)
struct va_format {
const char *fmt;
va_list *va;
};
#define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
#define usb_scuttle_anchored_urbs(anchor) compat_usb_scuttle_anchored_urbs(anchor)
#define usb_get_from_anchor(anchor) compat_usb_get_from_anchor(anchor)
#define usb_unlink_anchored_urbs(anchor) compat_usb_unlink_anchored_urbs(anchor)
extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor);
extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor);
extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
#endif
struct pm_qos_request_list {
u32 qos;
void *request;
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
#define pm_qos_add_request(_req, _class, _value) do { \
(_req)->request = #_req; \
(_req)->qos = _class; \
pm_qos_add_requirement((_class), (_req)->request, (_value)); \
} while(0)
#define pm_qos_update_request(_req, _value) \
pm_qos_update_requirement((_req)->qos, (_req)->request, (_value))
#define pm_qos_remove_request(_req) \
pm_qos_remove_requirement((_req)->qos, (_req)->request)
#else
#define pm_qos_add_request(_req, _class, _value) do { \
(_req)->request = pm_qos_add_request((_class), (_value)); \
} while (0)
#define pm_qos_update_request(_req, _value) \
pm_qos_update_request((_req)->request, (_value))
#define pm_qos_remove_request(_req) \
pm_qos_remove_request((_req)->request)
#endif
/*
* Dummy printk for disabled debugging statements to use whilst maintaining
* gcc's format and side-effect checking.
*/
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }
#ifndef alloc_workqueue
#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
#endif
#define EXTPROC 0200000
#define TIOCPKT_IOCTL 64
static inline void tty_lock(void) __acquires(kernel_lock)
{
#ifdef CONFIG_LOCK_KERNEL
/* kernel_locked is 1 for !CONFIG_LOCK_KERNEL */
WARN_ON(kernel_locked());
#endif
lock_kernel();
}
static inline void tty_unlock(void) __releases(kernel_lock)
{
unlock_kernel();
}
#define tty_locked() (kernel_locked())
#define usleep_range(_min, _max) msleep((_max) / 1000)
#define __rcu
static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
{
return false;
}
static inline void skb_tx_timestamp(struct sk_buff *skb)
{
}
extern struct workqueue_struct *system_nrt_wq;
void compat_system_workqueue_create(void);
void compat_system_workqueue_destroy(void);
#else
static inline void compat_system_workqueue_create(void)
{
}
static inline void compat_system_workqueue_destroy(void)
{
}
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
#endif /* LINUX_26_36_COMPAT_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.