Dataset Viewer
Auto-converted to Parquet
blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
268
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
5
118
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
802 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
2.31k
677M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
148 values
src_encoding
stringclasses
33 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.3M
extension
stringclasses
118 values
content
stringlengths
3
10.3M
authors
sequencelengths
1
1
author_id
stringlengths
0
228
32004cd6aee41c08905cd5b705ab6f8ff0bb6507
cdf75036c20eed12b54f9110c95588652899fa4c
/Others/atoi_2.c
1845ab7cbe713cde67484b57a0fe4dd8bbf74bd5
[]
no_license
M1c17/C_Programming_Language
6ca585297ab6014a8a5a86ec1e4be8fb58f01e39
15c3074a7876dea9615a3d4a5dd0bb8120abf180
refs/heads/main
2023-03-06T05:41:51.665000
2021-02-07T04:41:49
2021-02-07T04:41:49
323,505,241
0
0
null
null
null
null
UTF-8
C
false
false
862
c
#include <stdio.h> #include <ctype.h> #include <string.h> /* atoi: convert s to integer; version 2 */ int atoi(char line[]); int main(){ int val; char str[10]; strcpy(str, "-93284927"); val = atoi(str); printf("String value = %s, Int value = %d\n", str, val); strcpy(str, "hello"); val = atoi(str); printf("String value = %s, Int value = %d\n", str, val); return 0; } int atoi(char line[]){ //Initialize variables int i, n, sign; //skip white space, if any for (i = 0; isspace(line[i]); ++i){ ; } //get sign, if any sign = (line[i] == '-') ? -1 : 1; //skip sign, if any if (line[i] == '+' || line[i] == '-'){ ++i; } //get integer part and convert it for (n = 0; isdigit(line[i]); ++i){ n = 10 * n + (line[i] - '0'); } return sign * n; }
[ "pictor117@gmail.com" ]
pictor117@gmail.com
87b393e0e37d196a9779122a7240425d0269f0da
3c406f63a82affe48a40c6e4312ad071aebcf62e
/static/test.c
d6839978199fc1bb3d5e211d972bd5e850265b0f
[]
no_license
vivek703/OWN_EXP
d1a2c78ea69a7114088783e373660d2d39ed317e
fe0f7359693d8822b52121e07d808495f1c93e5e
refs/heads/master
2022-05-29T13:37:09.261000
2020-05-04T18:23:16
2020-05-04T18:23:16
257,104,389
0
0
null
null
null
null
UTF-8
C
false
false
125
c
#include "test.h" #include <stdio.h> static int static_1(void) { printf("HI\n"); } void test(void) { static_1(); }
[ "vivekp9922@gmail.com" ]
vivekp9922@gmail.com
7474d91708e166196a92071abed55e4358790a6c
33a6448e047d43eeeebe36f11cec5863c4d237c9
/FileReadWriteCharacter/main.c
f73b56c824db77ca9043f16bbc2c6f2800163b97
[]
no_license
Qianfinland/C
fca683f4e503a63435f43d1c82d1b5704b954bcf
00f6530d1282149b5d218e4ab4069562c145fd8e
refs/heads/master
2021-01-10T16:08:32.115000
2015-08-16T19:52:21
2015-08-16T19:52:21
36,993,923
0
0
null
null
null
null
UTF-8
C
false
false
1,026
c
#include <stdio.h> int main() { FILE *file = fopen("/home/qxzhou/NetBeansProjects/daydaylearning/FileReadWriteCharacter/read.txt", "r"); if(file == NULL) { printf("Error on open the file !"); return 1; } while(1) { int ch = fgetc(file); if(ch == EOF) break; printf("%c", ch); } FILE *file2 = fopen("/home/qxzhou/NetBeansProjects/daydaylearning/FileReadWriteCharacter/write.txt", "w"); if(file2 == NULL) { printf("Error on open the file !"); return 1; } /*char c[1000]; printf("Enter a sentence to the file!\n"); fgets(c, sizeof(c), stdin); //gets(c);//dangerous to use fprintf(file2, "%s", c);*/ printf("Enter multiple lines of strings and end by ctrl+D\n"); while(1) { char ch; ch = getchar(); //putchar(ch);// if(ch == EOF) break; putc(ch, file2); } fclose(file); fclose(file2); return 0; }
[ "qianfinland@gmail.com" ]
qianfinland@gmail.com
cf438c03fe427b18d5ef0c3ee6b083cbcaf7fb89
2837f8a4e1c618f00ad7ba5cf4c248232ea1743b
/1012.c
13ca81f31503b51ffd86f58d4a77bd3cf3a1fc50
[]
no_license
jorgeduartejr/URI-online-judge---C
c56a2e887db097725694bef25ac390e9edb38b26
d913288c68870f1058bd7fb0ce754ebc3a015ef8
refs/heads/main
2023-07-17T19:04:10.937000
2021-08-24T22:33:49
2021-08-24T22:33:49
399,618,839
0
0
null
null
null
null
UTF-8
C
false
false
610
c
#include <stdio.h> int main() { double A,B,C; double areaTriangulo, areaCirculo, areaTrapezio, areaQuadrado, areaRetangulo; double pi = 3.14159; scanf("%lf""%lf""%lf", &A,&B,&C); areaTriangulo = (A * C)/2; areaCirculo = C * C * pi; areaTrapezio = ((A + B) * C)/2; areaQuadrado = B * B; areaRetangulo = A * B; printf("TRIANGULO: %.3lf\n", areaTriangulo); printf("CIRCULO: %.3lf\n",areaCirculo); printf("TRAPEZIO: %.3lf\n",areaTrapezio); printf("QUADRADO: %.3lf\n", areaQuadrado); printf("RETANGULO: %.3lf\n", areaRetangulo); return 0; }
[ "migueljunior1000@gmail.com" ]
migueljunior1000@gmail.com
e4ca123d176646b4ad4c5e6601e1ec61881ef2b6
eb127d545b1aa5d4f6dfe7b900613678a061ed8e
/clip/libclipmain/_util/clip_CLIP_HOSTCS.c
68fd4dedfca7aaaf9947cfc9d259df1827c1ab7f
[]
no_license
amery/clip-angelo
a41fccb525b2fb311b2e179508b8ec50457ee7ae
556fb1d40645d4c8fc33cda4014ab31a5b6500ea
refs/heads/master
2020-05-05T04:12:01.911000
2010-12-25T10:42:00
2011-01-01T13:08:14
null
0
0
null
null
null
null
UTF-8
C
false
false
119
c
int clip_CLIP_HOSTCS(ClipMachine * ClipMachineMemory) { _clip_retc(ClipMachineMemory, _clip_hostcs); return 0; }
[ "amery@geeks.cl" ]
amery@geeks.cl
681714c9a7576083efca3998c82af18ed07b3562
99166976f3e170ad5d9fb2840b1c0ade2182a2c3
/libs/rh4n_ldaparser/src/rh4n_lda_array.c
18cc3aecdc99a46678399d32d905ecce91675310
[]
no_license
audacity363/natAWSWrapper
18acda09518788ae22c78b797e65ec3e3cd0531a
e99ed02d465ba9e6a3234ac30563b00d612d4d46
refs/heads/master
2020-06-15T08:49:09.333000
2019-08-25T17:35:27
2019-08-25T17:35:27
195,252,545
1
0
null
null
null
null
UTF-8
C
false
false
1,119
c
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include "rh4n.h" #include "rh4n_ldaparser.h" int rh4nldaGetArrayType(char *line, int *dimensions, int length[3], RH4nProperties *props, char *errorstr) { *dimensions= 0; char *end_var_params = NULL, *comma = NULL, *double_collon = NULL; if((end_var_params = strchr(line, ')')) == NULL) { sprintf(errorstr, "Can not find array parms end"); rh4n_log_error(props->logging, "%s", errorstr); return(RH4N_RET_LDA_PARSE_ERR); } *end_var_params = 0x00; comma = rh4nldastrtok(line, ','); while(comma) { (*dimensions)++; //Check if a lower bound is specified if((double_collon = strchr(comma, ':')) != NULL) { *double_collon = 0x00; double_collon++; length[(*dimensions)-1] = atoi(double_collon); } else { length[(*dimensions)-1] = atoi(comma); } comma = rh4nldastrtok(NULL, ','); } return(RH4N_RET_OK); }
[ "tom@engemann.me" ]
tom@engemann.me
0a8e0289152e8c5ddde56fb7659d8c479c4582cf
e4a1f59a825748852406246ad4a0a7e58c0c756b
/code/functs.h
be49b077ece743129c59d76e88d82e6b23007194
[]
no_license
MVour/diseaseAggregator
19d46631f1982a407cc243431392c9f1bdc13094
acb9b05c4d6fe73ccbc063f0d4e9132352c9e97d
refs/heads/master
2023-02-11T03:08:55.542000
2021-01-15T20:48:48
2021-01-15T20:48:48
330,018,961
0
0
null
null
null
null
UTF-8
C
false
false
975
h
// #include "myList.h" #include "myHash.h" #include "heap.h" #include "filesStats.h" ////// FUNCTS void printMenu(); char* act(int, hashTable*, hashTable*, infoNode*, StatsList*, char* buf); // void act_1(hashTable*, char*, char*); char* act_2(hashTable*, char*, char*, char*, char*); char* act_3(StatsList* myStats, int, char*, char*, char*, char*); char* act_4(infoNode*, char*); char* act_5(StatsList*, char*, char*, char*, char*); char* act_6(hashTable* , char*, char*, char*, char*); // void act_3_4(hashTable*, char*, char*, char*, int, int); // void act_5(hashTable*, hashTable*, infoNode*, myPatient*); // void act_6(infoNode*, char*, char*); // void act_7(hashTable*, char*); // void act_8(hashTable* cHash, hashTable* dHash, infoNode* pList); int isDate(char*); void treeToHeap(RBT*, maxHeap*, RBnode*, char*, char*, char*); int statsToHeap(StatsList*, maxHeap*, char* country, char* disease, char*, char*); // int count_keys(RBnode* n, char* date1, char* date2);
[ "m.vourtzoumis@gmail.com" ]
m.vourtzoumis@gmail.com
25021c56cbd311feb2474cce81be4758cf5ee5d8
394c1965d2300d06df1a72868670397d4ac262c5
/Libft/srcs/ft_putchar_fd.c
df6248e83b11873e2ab6dcb3898dc37e6be95fa4
[]
no_license
lterrail/minishell
f0584386ca9f9184ab21f32ad900610ddb75f090
a2221f74445c526eec356b672efee4640fd7aefb
refs/heads/master
2021-07-25T16:39:30.554000
2020-04-30T15:55:05
2020-04-30T15:55:05
158,931,545
0
0
null
null
null
null
UTF-8
C
false
false
970
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putchar_fd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lterrail <lterrail@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/04/03 16:24:20 by lterrail #+# #+# */ /* Updated: 2018/04/11 17:00:53 by lterrail ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_putchar_fd(char c, int fd) { write(fd, &c, 1); }
[ "lterrail@e1r10p17.42.fr" ]
lterrail@e1r10p17.42.fr
ff3959dcfefc32276c08841c6534ca13f08bec63
d24750e5c892c961ebc316484e27de11774db135
/Src/VL53l1X.c
9130b1f3476a4024ec8ee467dd98e7873227adac
[]
no_license
MarcusCorbin1/Number12
3bc4f46a59bfd1f29a3ac61c214409eb43e2cdae
0069173892eb944d12c0b6c9ee8a8dd2b52c481b
refs/heads/master
2022-03-03T14:58:26.731000
2019-06-17T16:33:27
2019-06-17T16:33:27
192,381,912
0
0
null
null
null
null
UTF-8
C
false
false
950
c
#include "stm32l4xx_hal.h" #include "VL53l1X.h" //Start the Data Initializer void VL53L1_DataInit(I2C_HandleTypeDef i2cHandle) { uint8_t buffer[12]; buffer[0] = 0x88; buffer[1] = 0x00; HAL_I2C_Master_Transmit(&i2cHandle, 0x52, buffer, 2, 100); HAL_Delay(20); } //Start the Static Initializer void VL53L1_StaticInit(I2C_HandleTypeDef i2cHandle) { uint8_t buffer[12]; buffer[0] = 0xFF; buffer[1] = 0x01; HAL_I2C_Master_Transmit(&i2cHandle, 0x52, buffer, 2, 100); uint16_t tempword = 0; buffer[0] = 0xFF; buffer[1] = tempword; HAL_I2C_Master_Receive(&i2cHandle, 0x53, buffer, 2, 100); buffer[0] = 0xFF; buffer[1] = 0x00; HAL_I2C_Master_Transmit(&i2cHandle, 0x52, buffer, 2, 100); } // This function will get the measurement ready void VL53L1_StartMeasurement(I2C_HandleTypeDef i2cHandle) { uint8_t buffer[64]; buffer[0] = 0x000; buffer[1] = 0x01; HAL_I2C_Master_Transmit(&i2cHandle, 0x52, buffer, 2, 100); }
[ "marcus.corbin@itron.com" ]
marcus.corbin@itron.com
9b15002d5bd412d9ae808f94e24062e867912908
79b2d3126476fe7c997ebc5b8f0a1298b34630fd
/PROG/Sem1/Lab4/logo.h
f18a8f5846e8655b25d16b0468fe9ed466ff3075
[]
no_license
DenisVasenin/Labs
13ba28d4c29cbe8899cd20ac9cc1f1dbdd825659
4b96ea12987d2a0046f58fe8b6d36e775769233b
refs/heads/master
2020-03-18T20:20:16.447000
2018-05-28T15:57:45
2018-05-28T15:57:45
null
0
0
null
null
null
null
UTF-8
C
false
false
646
h
int logo() { puts(""); puts(" ============================"); puts(" "); puts(" XX XX YY YY NN NN "); puts(" XXXX YYYY NNNN NN "); puts(" XX YY NN NN NN "); puts(" XXXX YY NN NNNN "); puts(" XX XX YY NN NN "); puts(" "); puts(" "); puts(" Пенкин Станислав гр ИВТ-11 "); puts(" "); puts(" ============================"); puts(""); return(0); }
[ "ps.smartbox@gmail.com" ]
ps.smartbox@gmail.com
0ddad1251dcd4016b4c526efeafe716af3f5026e
ef9a2839953f3586e66c1cf824c9de199f52d088
/mcc_generated_files/X2CCode/Library/Math/Controller/inc/Sqrt_FiP16.h
b83fa9c934f92a6452ef0773f0ae3be8fd299024
[]
no_license
MCHP-X2Cdemos/mc_foc_sl_fip_dsPIC33ck_mclv2.x
72f1e06eb18738796d59938474c6d533bd07bb1e
d77e18983439d895b83b6d63fdaad4c8fdb028e7
refs/heads/master
2023-03-20T10:54:54.157000
2021-03-11T22:01:12
2021-03-11T22:01:12
288,478,027
2
0
null
null
null
null
UTF-8
C
false
false
3,510
h
/* * Copyright (c) 2013, Linz Center of Mechatronics GmbH (LCM) http://www.lcm.at/ * All rights reserved. */ /* * This file is licensed according to the BSD 3-clause license as follows: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the "Linz Center of Mechatronics GmbH" and "LCM" nor * the names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL "Linz Center of Mechatronics GmbH" 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 X2C. http://x2c.lcm.at/ * $LastChangedRevision: 1603 $ */ /* USERCODE-BEGIN:Description */ /** Description: Square Root Computation **/ /** Calculation: **/ /** y = sqrt((abs(u)) **/ /** **/ /* USERCODE-END:Description */ #ifndef SQRT_FIP16_H #define SQRT_FIP16_H #ifdef __cplusplus extern "C" { #endif #include "CommonFcts.h" #if !defined(SQRT_FIP16_ISLINKED) #define SQRT_FIP16_ID ((uint16)4817) typedef struct { uint16 ID; int16 *In; int16 Out; } SQRT_FIP16; #define SQRT_FIP16_FUNCTIONS { \ SQRT_FIP16_ID, \ (void (*)(void*))Sqrt_FiP16_Update, \ (void (*)(void*))Sqrt_FiP16_Init, \ (tLoadImplementationParameter)Common_Load, \ (tSaveImplementationParameter)Common_Save, \ (void* (*)(const void*, uint16))Sqrt_FiP16_GetAddress } /**********************************************************************************************************************/ /** Public prototypes **/ /**********************************************************************************************************************/ void Sqrt_FiP16_Update(SQRT_FIP16 *pTSqrt_FiP16); void Sqrt_FiP16_Init(SQRT_FIP16 *pTSqrt_FiP16); void* Sqrt_FiP16_GetAddress(const SQRT_FIP16 *block, uint16 elementId); #endif #ifdef __cplusplus } #endif #endif
[ "christoph.baumgartner@microchipcom" ]
christoph.baumgartner@microchipcom
a6268cf05d542102a4e024b55ddb4478cd60d8ce
e250176d7fc2d1d1ac604aa843543afe91e8843e
/chapter1/fold.c
0e37e96d78aa3e77a5172cc49be766743550f4ba
[]
no_license
alicewriteswrongs/programminginc
3ea2ebd1a4622856eecb1b49e8011d5fb2cc4ed8
69f17bfede6ccfea70677eb06c6dd76305429ca8
refs/heads/master
2021-08-27T15:31:10.765000
2015-07-14T19:53:23
2015-07-14T19:53:23
null
0
0
null
null
null
null
UTF-8
C
false
false
1,419
c
#include <stdio.h> /* this is program to 'fold' long lines onto two lines, and I think we're going to do 80 * characters/line * */ #define MAXLINE 1000 // not going to bother with lines longer than 1000 #define OUTPUTMAXLINE 1020 // longer incase input is actually 1000 characters #define SPLIT 79 // number of characters per output line (indexed from 0, so 79 == 80 characters per line int mygetline(char line[], int maxline); void foldit(char old[], char new[], int length); main() { int lim = MAXLINE; int len; char before[MAXLINE]; char after[OUTPUTMAXLINE]; while ((len = mygetline(before, lim)) > 0) { foldit(before,after,len); printf("%s", after); } } int mygetline(char before[], int maxline) { int c, i; for (i = 0; i < maxline && (c = getchar()) != EOF && c != '\n'; i++) before[i] = c; if (c == '\n') { before[i] = c; i++; } before[i] = '\0'; return i; } void foldit(char old[], char new[], int length) { int i, offset, count; offset = count = 0; for (i = 0; i <= length; i++) { if (count != SPLIT) { new[i+offset] = old[i]; count += 1; } else if (count == SPLIT) { new[i+offset] = old[i]; offset += 1; new[i+offset] = '\n'; count = 0; } } } // I think it works! hahahaha!
[ "alice.writes.wrongs@gmail.com" ]
alice.writes.wrongs@gmail.com
ae6588ae9020907de235f7dc4c83350dbf925003
60cddbbb30ef7614070f6e1691ab9a3f0ce407e4
/robo2-xsdk/libs/phymod/chip/falcon16/falcon16_diagnostics_dispatch.c
12ba0238027635ff729ee0e14f43ab82c3db76e5
[]
no_license
David-Croose/Broadcom-Compute-Connectivity-Software-robo2-xsdk
f2a1fe9a704e1a1873eac2fba02125ba7cb1570f
25b15c851d6e8a5a70715603e4f8d8a9af8f66fe
refs/heads/master
2022-11-27T00:00:23.553000
2020-08-03T07:36:34
2020-08-03T07:36:34
null
0
0
null
null
null
null
UTF-8
C
false
false
1,555
c
/* * * $Id: phymod.xml,v 1.1.2.5 Broadcom SDK $ * * * This license is set out in https://github.com/Broadcom/Broadcom-Compute-Connectivity-Software-robo2-xsdk/master/Legal/LICENSE file. * * $Copyright: (c) 2020 Broadcom Inc. * Broadcom Proprietary and Confidential. All rights reserved.$ * * * DO NOT EDIT THIS FILE! * */ #include <phymod/phymod.h> #include <phymod/phymod_diagnostics.h> #include <phymod/phymod_diagnostics_dispatch.h> #ifdef PHYMOD_FALCON16_SUPPORT #include <phymod/chip/falcon16_diagnostics.h> __phymod_diagnostics__dispatch__t__ phymod_diagnostics_falcon16_diagnostics_driver = { falcon16_phy_rx_slicer_position_set, falcon16_phy_rx_slicer_position_get, falcon16_phy_rx_slicer_position_max_get, falcon16_phy_prbs_config_set, falcon16_phy_prbs_config_get, falcon16_phy_prbs_enable_set, falcon16_phy_prbs_enable_get, falcon16_phy_prbs_status_get, falcon16_phy_pattern_config_set, falcon16_phy_pattern_config_get, falcon16_phy_pattern_enable_set, falcon16_phy_pattern_enable_get, falcon16_core_diagnostics_get, falcon16_phy_diagnostics_get, falcon16_phy_pmd_info_dump, NULL, /* phymod_phy_pcs_info_dump */ falcon16_phy_eyescan_run, NULL, /* phymod_phy_link_mon_enable_set */ NULL, /* phymod_phy_link_mon_enable_get */ NULL, /* phymod_phy_link_mon_status_get */ NULL, /* phymod_phy_fec_correctable_counter_get */ NULL, /* phymod_phy_fec_uncorrectable_counter_get */ }; #endif /* PHYMOD_FALCON16_SUPPORT */
[ "murali.policharla@broadcom.com" ]
murali.policharla@broadcom.com
ad6c47c43213451cd6735ee31d3b8c2cb5b854d4
fd0137df01992ad3153ba9658e71e6c763760b7f
/Emu48/DDESERV.C
6478426a222253dd6a1def7b7c0fb139a99e39fc
[]
no_license
tolkien/Emu48
b22a61dc952d70f9fd93e32a9a8a95c103f96e4b
777d5a9c399f4b2d800e8376bf2e62431bda71a0
refs/heads/master
2021-06-20T01:36:10.050000
2017-05-12T18:11:34
2017-05-12T18:11:34
null
0
0
null
null
null
null
ISO-8859-1
C
false
false
4,855
c
/* * DdeServ.c * * This file is part of Emu48 * * Copyright (C) 1998 Christoph Gießelink * */ #include "pch.h" #include "Emu48.h" #include "io.h" HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv, HSZ hsz1,HSZ hsz2,HDDEDATA hData, DWORD dwData1,DWORD dwData2) { TCHAR *psz,szBuffer[32]; HDDEDATA hReturn; LPBYTE lpData,lpHeader; DWORD dwAddress,dwSize,dwLoop,dwIndex; UINT nStkLvl; BOOL bSuccess; // disable stack loading items on HP38G, HP39/40G BOOL bStackEnable = cCurrentRomType!='6' && cCurrentRomType!='A' && cCurrentRomType!='E'; switch (iType) { case XTYP_CONNECT: // get service name DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0); if (0 != lstrcmp(szBuffer,szAppName)) return (HDDEDATA) FALSE; // get topic name DdeQueryString(idDdeInst,hsz1,szBuffer,ARRAYSIZEOF(szBuffer),0); return (HDDEDATA) (INT_PTR) (0 == lstrcmp(szBuffer,szTopic)); case XTYP_POKE: // quit on models without stack or illegal data format or not in running state if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN) return (HDDEDATA) DDE_FNOTPROCESSED; // get item name DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0); nStkLvl = _tcstoul(szBuffer,&psz,10); if (*psz != 0 || nStkLvl < 1) // invalid number format return (HDDEDATA) DDE_FNOTPROCESSED; SuspendDebugger(); // suspend debugger bDbgAutoStateCtrl = FALSE; // disable automatic debugger state control if (!(Chipset.IORam[BITOFFSET]&DON)) // HP off { // turn on HP KeyboardEvent(TRUE,0,0x8000); Sleep(dwWakeupDelay); KeyboardEvent(FALSE,0,0x8000); } if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state { hReturn = DDE_FNOTPROCESSED; goto cancel; } while (nState!=nNextState) Sleep(0); _ASSERT(nState==SM_SLEEP); bSuccess = FALSE; // get data and size lpData = DdeAccessData(hData,&dwSize); // has object length header if (lpData && dwSize >= sizeof(DWORD)) { dwIndex = *(LPDWORD) lpData; // object length if (dwIndex <= dwSize - sizeof(DWORD)) { // reserve unpacked object length memory LPBYTE pbyMem = (LPBYTE) malloc(dwIndex * 2); if (pbyMem != NULL) { // copy data and write to stack CopyMemory(pbyMem+dwIndex,lpData+sizeof(DWORD),dwIndex); bSuccess = (WriteStack(nStkLvl,pbyMem,dwIndex) == S_ERR_NO); free(pbyMem); // free memory } } } DdeUnaccessData(hData); SwitchToState(SM_RUN); // run state while (nState!=nNextState) Sleep(0); _ASSERT(nState==SM_RUN); if (bSuccess == FALSE) { hReturn = DDE_FNOTPROCESSED; goto cancel; } KeyboardEvent(TRUE,0,0x8000); Sleep(dwWakeupDelay); KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode while (Chipset.Shutdn == FALSE) Sleep(0); hReturn = (HDDEDATA) DDE_FACK; cancel: bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control ResumeDebugger(); return hReturn; case XTYP_REQUEST: // quit on models without stack or illegal data format or not in running state if (!bStackEnable || iFmt != uCF_HpObj || nState != SM_RUN) return NULL; // get item name DdeQueryString(idDdeInst,hsz2,szBuffer,ARRAYSIZEOF(szBuffer),0); nStkLvl = _tcstoul(szBuffer,&psz,10); if (*psz != 0 || nStkLvl < 1) // invalid number format return NULL; if (WaitForSleepState()) // wait for cpu SHUTDN then sleep state return NULL; while (nState!=nNextState) Sleep(0); _ASSERT(nState==SM_SLEEP); dwAddress = RPL_Pick(nStkLvl); // pick address of stack level "item" object if (dwAddress == 0) { SwitchToState(SM_RUN); // run state return NULL; } dwLoop = dwSize = (RPL_SkipOb(dwAddress) - dwAddress + 1) / 2; lpHeader = (Chipset.type != 'X') ? (LPBYTE) BINARYHEADER48 : (LPBYTE) BINARYHEADER49; // length of binary header dwIndex = (DWORD) strlen((LPCSTR) lpHeader); // size of objectsize + header + object dwSize += dwIndex + sizeof(DWORD); // reserve memory if ((lpData = (LPBYTE) malloc(dwSize)) == NULL) { SwitchToState(SM_RUN); // run state return NULL; } // save data length *(DWORD *)lpData = dwLoop + dwIndex; // copy header memcpy(lpData + sizeof(DWORD),lpHeader,dwIndex); // copy data for (dwIndex += sizeof(DWORD);dwLoop--;++dwIndex,dwAddress += 2) lpData[dwIndex] = Read2(dwAddress); // write data hReturn = DdeCreateDataHandle(idDdeInst,lpData,dwSize,0,hsz2,iFmt,0); free(lpData); SwitchToState(SM_RUN); // run state while (nState!=nNextState) Sleep(0); _ASSERT(nState==SM_RUN); return hReturn; } return NULL; UNREFERENCED_PARAMETER(hConv); UNREFERENCED_PARAMETER(dwData1); UNREFERENCED_PARAMETER(dwData2); }
[ "ryanbee@microsoft.com" ]
ryanbee@microsoft.com
26393171c0093670884c0ea4829ff4beaea2848e
fda015cc078e877754e4cd5a48e970f0a1159ada
/src/sources/shared/system_support/os_specifics.h
aee560f47e775860f7a101ac20eaaa04456aeddf
[]
no_license
cran/liquidSVM
886e0487104a434d3854120a774ebe120e1ddeae
35b8af219f5d52df5513789793c1e5cf07d310b8
refs/heads/master
2020-04-06T04:12:26.063000
2019-09-14T17:20:02
2019-09-14T17:20:02
83,014,436
2
0
null
null
null
null
UTF-8
C
false
false
4,395
h
// Copyright 2015, 2016, 2017 Ingo Steinwart // // This file is part of liquidSVM. // // liquidSVM is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // liquidSVM 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 Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with liquidSVM. If not, see <http://www.gnu.org/licenses/>. #if !defined (OS_SPECIFICS_H) #define OS_SPECIFICS_H #include "sources/shared/system_support/compiler_specifics.h" //********************************************************************************************************************************** // Linux and Mac //********************************************************************************************************************************** #if defined __linux__ || defined __MACH__ #define POSIX_OS__ #define THREADING_IMPLEMENTED #ifdef __SSE2__ #define SSE2__ #endif #ifdef __AVX__ #define AVX__ #endif #ifdef __AVX2__ #define AVX2__ #endif #define sync_add_and_fetch __sync_add_and_fetch #define Tmutex pthread_mutex_t #define Tthread_handle pthread_t #define atomic_unsigned unsigned #define thread__ __thread #define restrict__ __restrict__ #endif //********************************************************************************************************************************** // Windows //********************************************************************************************************************************** #if defined _WIN32 #if !defined (NOMINMAX) #define NOMINMAX #endif #include <malloc.h> // Has to come before windows.h #include <windows.h> // Has to come before emmintrin.h/immintrin.h in simd_basics.h ! #include <iso646.h> #define THREADING_IMPLEMENTED #undef COMPILE_WITH_CUDA__ // The next line repeats the default of MS Visual Studio 2012++ // Basically, it assumes that Windows is not running on a CPU built before 2004 or so. #define SSE2__ #ifdef __AVX__ #define AVX__ #endif #ifdef __AVX2__ #define AVX2__ #endif #define Tmutex HANDLE #define Tthread_handle HANDLE #ifdef __MINGW32__ #define sync_add_and_fetch __sync_add_and_fetch #define atomic_unsigned unsigned #define thread__ __thread #else #define sync_add_and_fetch atomic_fetch_add #if defined(MSVISUAL_LEGACY) #define atomic_unsigned unsigned #else #define atomic_unsigned atomic_uint #endif #define thread__ __declspec(thread) #endif #define restrict__ __restrict #endif //********************************************************************************************************************************** // Other Operating Systems //********************************************************************************************************************************** #if !defined(POSIX_OS__) && !defined(_WIN32) #define UNKNOWN_OS__ #undef THREADING_IMPLEMENTED // The following definitions are meant as safeguards. Depending on the // situtation they may or may not be necessary. #undef SSE2__ #undef AVX__ #undef AVX2__ #undef COMPILE_WITH_CUDA__ #define Tmutex unsigned #define Tthread_handle void* #define atomic_unsigned unsigned #define thread__ #define restrict__ #endif //********************************************************************************************************************************** // More safeguards //********************************************************************************************************************************** // Make sure that simd instructions are only used on systems on which we can // safely alloc aligned memory. Currently, this is true for MS Windows and // systems supporting POSIX with optional posix_memalign commands. #if defined _WIN32 #define SIMD_ACTIVATED #else #include <unistd.h> #if defined(_POSIX_ADVISORY_INFO) && _POSIX_ADVISORY_INFO > 0 #define SIMD_ACTIVATED #else #undef SIMD_ACTIVATED #undef AVX2__ #undef AVX__ #undef SSE2__ #endif #endif #endif
[ "csardi.gabor+cran@gmail.com" ]
csardi.gabor+cran@gmail.com
e68b09ef487cfbc95b0472becf08661d8f918a67
93f2b5dc75142b5d6f5cb31e1e02f1c5aac130a0
/srcs_lem/get_next_line1.c
9a771719bb18a1137c4edc964beaab2d64290170
[]
no_license
Enshertid/lem-in_school21
d869541fb45c6c6f9d8f96bb047d489aed895b26
3b326ec0c41cefe4af28eb46d76817ad89612a33
refs/heads/master
2022-05-07T23:49:00.736000
2020-03-15T16:34:49
2020-03-15T16:34:49
null
0
0
null
null
null
null
UTF-8
C
false
false
3,150
c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line1.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ymanilow <ymanilow@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/02 14:42:04 by dbendu #+# #+# */ /* Updated: 2020/02/13 21:25:11 by ymanilow ### ########.fr */ /* */ /* ************************************************************************** */ #include "lem_in.h" #define GNL_BUFF 1024 void ft_lstappend(t_list **list, t_list *new) { if (!list || !new) return ; if (!*list) { *list = new; new->end = new; } else { (*list)->end->next = new; (*list)->end = new; } } static void add_in_bufs(t_list **bufs, const char *src, size_t strlen, int fd) { char *str; str = ft_strnew(strlen); ft_memcpy(str, src, strlen); ft_lstappend(bufs, ft_lstnew(str, strlen + 1)); (*bufs)->end->content_size = fd; free(str); } static int check_bufs(t_list **bufs, t_list **buf, int fd) { t_list *iter; char *npos; char *temp; iter = *bufs; while (iter && (int)iter->content_size != fd) iter = iter->next; if (!iter) return (0); npos = (char*)ft_memchr(iter->content, '\n', ft_strlen(iter->content)); ft_lstappend(buf, ft_lstnew(iter->content, npos ? (size_t)(npos - (char*)iter->content) : (size_t)ft_strlen(iter->content))); if (!npos || (npos && !npos[1])) ft_lstdelete(bufs, &iter); else if (npos[1]) { temp = ft_strdup(npos + 1); free(iter->content); iter->content = temp; } return (npos ? 1 : 0); } static char *lst_to_str(const t_list *list) { char *str; char *striter; const t_list *lstiter; size_t len; len = 0; lstiter = list; while (lstiter) { len += lstiter->content_size; lstiter = lstiter->next; } str = ft_strnew(len); if (!str) return (NULL); striter = str; while (list) { ft_memcpy(striter, list->content, list->content_size); striter += list->content_size; list = list->next; } return (str); } int get_next_line(const int fd, char **line) { static t_list *bufs = NULL; t_list *buf; ssize_t ret; char *npos; char str[GNL_BUFF]; if (fd < 0 || !GNL_BUFF || read(fd, str, 0) < 0 || (buf = NULL)) return (-1); if (!check_bufs(&bufs, &buf, fd)) { while ((ret = read(fd, str, GNL_BUFF))) { npos = (char*)ft_memchr(str, '\n', ret); ft_lstappend(&buf, ft_lstnew(str, npos ? npos - str : ret)); if (npos) break ; } if (!ret && !buf) return (0); if (ret && npos && npos - str != ret - 1) add_in_bufs(&bufs, npos + 1, ret - 1 - (npos - str), fd); } *line = lst_to_str(buf); ft_lstpurge(&buf); return (*line ? 1 : -1); }
[ "enshertid@icloud.com" ]
enshertid@icloud.com
435d938de995c245d164b32e935ec8b55a8bc340
bb762a49e4f5324de253d6287438899a4c645632
/Lista9/Questao1/tadArvoreBB3.c
9f8071a9ac77eb7d89a79a9acd91267be9385138
[]
no_license
RaquelBelmiro/estruturas-de-dados-c
7de2defe4ffaf1849eb5408c533658c0637a1366
f38f6e6758a897a24e8091e773b6651f02e09a45
refs/heads/master
2023-08-01T07:46:45.736000
2021-09-21T21:42:25
2021-09-21T21:42:25
408,981,056
0
0
null
null
null
null
UTF-8
C
false
false
3,945
c
#include<stdio.h> #include<stdlib.h> struct reg_no_arvore { struct reg_no_arvore *ptrEsquerda; int chave; struct reg_no_arvore *ptrDireita; }; typedef struct reg_no_arvore **tipo_no_arvore; tipo_no_arvore inicializar_arvore(tipo_no_arvore sub_raiz) { sub_raiz = (struct reg_no_arvore**)malloc(sizeof(struct reg_no_arvore*)); *sub_raiz = NULL; } void incluir_no_arvore(tipo_no_arvore sub_raiz, int chave) { if (*sub_raiz == NULL) { *sub_raiz = malloc(sizeof(struct reg_no_arvore)); (*sub_raiz)->chave = chave; (*sub_raiz)->ptrEsquerda = NULL; (*sub_raiz)->ptrDireita = NULL; } else { if (chave < (*sub_raiz)->chave) { incluir_no_arvore(&((*sub_raiz)->ptrEsquerda), chave); } else { if (chave > (*sub_raiz)->chave) { incluir_no_arvore(&((*sub_raiz)->ptrDireita), chave); } } } } void percurso_em_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { percurso_em_ordem(&((*sub_raiz)->ptrEsquerda)); printf("%d ", (*sub_raiz)->chave); percurso_em_ordem(&((*sub_raiz)->ptrDireita)); } } void percurso_em_pre_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { printf("%d ", (*sub_raiz)->chave); percurso_em_pre_ordem(&((*sub_raiz)->ptrEsquerda)); percurso_em_pre_ordem(&((*sub_raiz)->ptrDireita)); } } void percurso_em_pos_ordem(tipo_no_arvore sub_raiz) { if (*sub_raiz != NULL) { percurso_em_pos_ordem(&((*sub_raiz)->ptrEsquerda)); percurso_em_pos_ordem(&((*sub_raiz)->ptrDireita)); printf("%d ", (*sub_raiz)->chave); } } int encontrar_elemento(tipo_no_arvore sub_raiz, int chave) { if ((*sub_raiz) == NULL) { return 0; } else { if (chave == (*sub_raiz)->chave) { return 1; } else { if (chave < (*sub_raiz)->chave) { return encontrar_elemento(&((*sub_raiz)->ptrEsquerda), chave); } else { if (chave > (*sub_raiz)->chave) { return encontrar_elemento(&((*sub_raiz)->ptrDireita), chave); } } } } } int numero_nos(tipo_no_arvore sub_raiz){ if (*sub_raiz != NULL) { return 1+numero_nos(&((*sub_raiz)->ptrEsquerda))+numero_nos(&((*sub_raiz)->ptrDireita)); } return 0; } int qtdFolha(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { if(((*sub_raiz)->ptrEsquerda==NULL) && ((*sub_raiz)->ptrDireita==NULL)) return 1+qtdFolha(&(*sub_raiz)->ptrEsquerda) + qtdFolha(&(*sub_raiz)->ptrDireita); else return qtdFolha(&(*sub_raiz)->ptrDireita) + qtdFolha(&(*sub_raiz)->ptrEsquerda); } else return 0; } int qtdNull(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { return qtdNull(&(*sub_raiz)->ptrEsquerda)+qtdNull(&(*sub_raiz)->ptrDireita); } else return 1; } int altura(tipo_no_arvore sub_raiz){ if (*sub_raiz !=NULL) { if( altura(&((*sub_raiz)->ptrEsquerda)) > altura(&((*sub_raiz)->ptrDireita))) return 1+altura(&(*sub_raiz)->ptrEsquerda); else return 1+altura(&(*sub_raiz)->ptrDireita); } return 0; } void copiarArvore(tipo_no_arvore sub_raiz_original, tipo_no_arvore sub_raiz_copia){ if(*sub_raiz_original!=NULL){ incluir_no_arvore(sub_raiz_copia,(*sub_raiz_original)->chave); copiarArvore(&((*sub_raiz_original)->ptrDireita),sub_raiz_copia); copiarArvore(&((*sub_raiz_original)->ptrEsquerda),sub_raiz_copia); } }
[ "raquelsilvabelmiro@gmail.com" ]
raquelsilvabelmiro@gmail.com
85535a4d92f8f2666b9a5170975b7e8728e2f10d
bd1fea86d862456a2ec9f56d57f8948456d55ee6
/000/246/087/CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13.c
820a233fd4b7e26bdeed91be32983bf04da283ab
[]
no_license
CU-0xff/juliet-cpp
d62b8485104d8a9160f29213368324c946f38274
d8586a217bc94cbcfeeec5d39b12d02e9c6045a2
refs/heads/master
2021-03-07T15:44:19.446000
2020-03-10T12:45:40
2020-03-10T12:45:40
246,275,244
0
1
null
null
null
null
UTF-8
C
false
false
6,999
c
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-13.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Fixed string * Sink: w32_execv * BadSink : execute command with execv * Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=5) * * */ #include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else /* NOT _WIN32 */ #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define COMMAND_ARG1 "-c" #define COMMAND_ARG2 "ls " #define COMMAND_ARG3 data #endif #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 #include <process.h> #define EXECV _execv #ifndef OMITBAD void CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_bad() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE==5) { { #ifdef _WIN32 WSADATA wsaData; int wsaDataInit = 0; #endif int recvResult; struct sockaddr_in service; char *replace; SOCKET listenSocket = INVALID_SOCKET; SOCKET acceptSocket = INVALID_SOCKET; size_t dataLen = strlen(data); do { #ifdef _WIN32 if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { break; } wsaDataInit = 1; #endif /* POTENTIAL FLAW: Read data using a listen socket */ listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listenSocket == INVALID_SOCKET) { break; } memset(&service, 0, sizeof(service)); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(TCP_PORT); if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR) { break; } if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR) { break; } acceptSocket = accept(listenSocket, NULL, NULL); if (acceptSocket == SOCKET_ERROR) { break; } /* Abort on error or the connection was closed */ recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(char) * (100 - dataLen - 1), 0); if (recvResult == SOCKET_ERROR || recvResult == 0) { break; } /* Append null terminator */ data[dataLen + recvResult / sizeof(char)] = '\0'; /* Eliminate CRLF */ replace = strchr(data, '\r'); if (replace) { *replace = '\0'; } replace = strchr(data, '\n'); if (replace) { *replace = '\0'; } } while (0); if (listenSocket != INVALID_SOCKET) { CLOSE_SOCKET(listenSocket); } if (acceptSocket != INVALID_SOCKET) { CLOSE_SOCKET(acceptSocket); } #ifdef _WIN32 if (wsaDataInit) { WSACleanup(); } #endif } } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the GLOBAL_CONST_FIVE==5 to GLOBAL_CONST_FIVE!=5 */ static void goodG2B1() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { char * data; char dataBuffer[100] = COMMAND_ARG2; data = dataBuffer; if(GLOBAL_CONST_FIVE==5) { /* FIX: Append a fixed string to data (not user / external input) */ strcat(data, "*.*"); } { char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG3, NULL}; /* execv - specify the path where the command is located */ /* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */ EXECV(COMMAND_INT_PATH, args); } } void CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE78_OS_Command_Injection__char_listen_socket_w32_execv_13_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
[ "frank@fischer.com.mt" ]
frank@fischer.com.mt
140d8434c9645707bed4716235e4ff9dc4315eca
c9eccf85f19371a3843911c1480e761de4773722
/src/lvgl/src/lv_misc/lv_bidi.h
f3f758b43ab14b9f6180db943b44a41d1f39df7d
[ "MIT" ]
permissive
mibus/TTGO_TWatch_Library
7d3c04ca2358b181264ea744a1bcd8338f508d91
bd77e6edba3baf9c5c68de4683a01b81f6b3a8b3
refs/heads/master
2022-11-25T03:04:40.292000
2020-07-25T03:15:55
2020-07-25T03:15:55
275,497,118
0
0
MIT
2020-06-28T03:13:55
2020-06-28T03:13:54
null
UTF-8
C
false
false
4,064
h
/** * @file lv_bifi.h * */ #ifndef LV_BIDI_H #define LV_BIDI_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <stdbool.h> #include <stdint.h> /********************* * DEFINES *********************/ /* Special non printable strong characters. * They can be inserted to texts to affect the run's direction*/ #define LV_BIDI_LRO "\xE2\x80\xAD" /*U+202D*/ #define LV_BIDI_RLO "\xE2\x80\xAE" /*U+202E*/ /********************** * TYPEDEFS **********************/ enum { /*The first 4 values are stored in `lv_obj_t` on 2 bits*/ LV_BIDI_DIR_LTR = 0x00, LV_BIDI_DIR_RTL = 0x01, LV_BIDI_DIR_AUTO = 0x02, LV_BIDI_DIR_INHERIT = 0x03, LV_BIDI_DIR_NEUTRAL = 0x20, LV_BIDI_DIR_WEAK = 0x21, }; typedef uint8_t lv_bidi_dir_t; /********************** * GLOBAL PROTOTYPES **********************/ #if LV_USE_BIDI /** * Convert a text to get the characters in the correct visual order according to * Unicode Bidirectional Algorithm * @param str_in the text to process * @param str_out store the result here. Has the be `strlen(str_in)` length * @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir); /** * Auto-detect the direction of a text based on the first strong character * @param txt the text to process * @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt); /** * Get the logical position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param vicual_pos the visual character position which logical position should be get * @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context * @return the logical character position */ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, uint32_t visual_pos, bool * is_rtl); /** * Get the visual position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param logical_pos the logical character position which visual position should be get * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context * @return the visual character position */ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, uint32_t logical_pos, bool * is_rtl); /** * Bidi process a paragraph of text * @param str_in the string to process * @param str_out store the result here * @param len length of teh text * @param base_dir base dir of the text * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. * Can be `NULL` is unused * @param pos_conv_len length of `pos_conv_out` in element count */ void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir, uint16_t * pos_conv_out, uint16_t pos_conv_len); /********************** * MACROS **********************/ #endif /*LV_USE_BIDI*/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_BIDI_H*/
[ "lewisxhe@outlook.com" ]
lewisxhe@outlook.com
4e6ed1901fc0f9319647713b68b5b6b327930a06
3f309b1dd9774ca1eef2c7bb7626447e6c3dbe70
/apps/evsys/evsys_trigger/firmware/src/config/sam_l10_xpro/peripheral/clock/plib_clock.c
e3a6e5298e13415f391dd1c25b0e3d7d7fe6eb46
[ "LicenseRef-scancode-unknown-license-reference", "ISC", "LicenseRef-scancode-public-domain" ]
permissive
Unitek-KL/csp
30892ddf1375f5191173cafdfba5f098245a0ff7
2ac7ba59465f23959e51d2f16a5712b57b79ef5f
refs/heads/master
2020-12-10T13:42:26.878000
2019-10-14T17:55:22
2019-10-14T17:56:20
233,609,402
0
0
NOASSERTION
2020-01-13T14:04:51
2020-01-13T14:04:51
null
UTF-8
C
false
false
4,781
c
/******************************************************************************* CLOCK PLIB Company: Microchip Technology Inc. File Name: plib_clock.c Summary: CLOCK PLIB Implementation File. Description: None *******************************************************************************/ /******************************************************************************* * Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries. * * Subject to your compliance with these terms, you may use Microchip software * and any derivatives exclusively with Microchip products. It is your * responsibility to comply with third party license terms applicable to your * use of third party software (including open source software) that may * accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A * PARTICULAR PURPOSE. * * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. *******************************************************************************/ #include "plib_clock.h" #include "device.h" static void OSCCTRL_Initialize(void) { /**************** OSC16M IniTialization *************/ OSCCTRL_REGS->OSCCTRL_OSC16MCTRL = OSCCTRL_OSC16MCTRL_FSEL(0x0) | OSCCTRL_OSC16MCTRL_ENABLE_Msk; } static void OSC32KCTRL_Initialize(void) { OSC32KCTRL_REGS->OSC32KCTRL_RTCCTRL = OSC32KCTRL_RTCCTRL_RTCSEL(0); } static void FDPLL_Initialize(void) { GCLK_REGS->GCLK_PCHCTRL[0] = GCLK_PCHCTRL_GEN(0x1) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[0] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } /****************** DPLL Initialization *********************************/ /* Configure DPLL */ OSCCTRL_REGS->OSCCTRL_DPLLCTRLB = OSCCTRL_DPLLCTRLB_FILTER(0) | OSCCTRL_DPLLCTRLB_LTIME(0)| OSCCTRL_DPLLCTRLB_REFCLK(2) ; OSCCTRL_REGS->OSCCTRL_DPLLRATIO = OSCCTRL_DPLLRATIO_LDRFRAC(0) | OSCCTRL_DPLLRATIO_LDR(63); while((OSCCTRL_REGS->OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_DPLLRATIO_Msk) == OSCCTRL_DPLLSYNCBUSY_DPLLRATIO_Msk) { /* Waiting for the synchronization */ } /* Selection of the DPLL Enable */ OSCCTRL_REGS->OSCCTRL_DPLLCTRLA = OSCCTRL_DPLLCTRLA_ENABLE_Msk ; while((OSCCTRL_REGS->OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk) == OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk ) { /* Waiting for the DPLL enable synchronization */ } while((OSCCTRL_REGS->OSCCTRL_DPLLSTATUS & (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk)) != (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk)) { /* Waiting for the Ready state */ } } static void GCLK0_Initialize(void) { GCLK_REGS->GCLK_GENCTRL[0] = GCLK_GENCTRL_DIV(2) | GCLK_GENCTRL_SRC(7) | GCLK_GENCTRL_GENEN_Msk; while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL0_Msk) == GCLK_SYNCBUSY_GENCTRL0_Msk) { /* wait for the Generator 0 synchronization */ } } static void GCLK1_Initialize(void) { GCLK_REGS->GCLK_GENCTRL[1] = GCLK_GENCTRL_DIV(4) | GCLK_GENCTRL_SRC(5) | GCLK_GENCTRL_GENEN_Msk; while((GCLK_REGS->GCLK_SYNCBUSY & GCLK_SYNCBUSY_GENCTRL1_Msk) == GCLK_SYNCBUSY_GENCTRL1_Msk) { /* wait for the Generator 1 synchronization */ } } void CLOCK_Initialize (void) { /* Function to Initialize the Oscillators */ OSCCTRL_Initialize(); /* Function to Initialize the 32KHz Oscillators */ OSC32KCTRL_Initialize(); GCLK1_Initialize(); FDPLL_Initialize(); GCLK0_Initialize(); /* Selection of the Generator and write Lock for EIC */ GCLK_REGS->GCLK_PCHCTRL[3] = GCLK_PCHCTRL_GEN(0x0) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[3] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } /* Selection of the Generator and write Lock for EVSYS_0 */ GCLK_REGS->GCLK_PCHCTRL[6] = GCLK_PCHCTRL_GEN(0x0) | GCLK_PCHCTRL_CHEN_Msk; while ((GCLK_REGS->GCLK_PCHCTRL[6] & GCLK_PCHCTRL_CHEN_Msk) != GCLK_PCHCTRL_CHEN_Msk) { /* Wait for synchronization */ } }
[ "http://support.microchip.com" ]
http://support.microchip.com
872d8f0e8f79d8d3cc847d279d797bd59b047c8a
bfb77baec8635ec547dcab598fa537785a03d3fb
/MDK-ARM/Lora.c
f4632170ad1e6ae45ecaa5aa22ab3d9fc338799b
[]
no_license
huynd98/SENSOR1_DATN
6fd4dc6eaae9665b738c86c31dd83b432823d140
6faedbe233ec30f4f1c79f0368cafcbe2a9ff678
refs/heads/main
2023-02-13T04:16:59.856000
2021-01-11T15:20:07
2021-01-11T15:20:07
318,145,813
0
0
null
null
null
null
UTF-8
C
false
false
8,661
c
#include "Lora.h" uint8_t readRegLora_8Bit(uint8_t address){ uint8_t result=0; HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_RESET); HAL_Delay(1); while ( HAL_SPI_Transmit(&hspi2,&address,1,100) != HAL_OK ); while ( HAL_SPI_Receive(&hspi2,&result,1,100) != HAL_OK ); HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_SET); return result; } /*****************************************************************/ void readRegLora(uint8_t address, uint8_t *receiveData, uint8_t length){ HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_RESET); HAL_Delay(1); while ( HAL_SPI_Transmit(&hspi2,&address,1,100) != HAL_OK ); while ( HAL_SPI_Receive(&hspi2,receiveData,length,100) != HAL_OK ); HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_SET); } /*****************************************************************/ void writeRegLora(uint8_t address, uint8_t data){ uint8_t add; add = address | 0x80; HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_RESET); HAL_Delay(1); while ( HAL_SPI_Transmit(&hspi2,&add,1,100) != HAL_OK ); while ( HAL_SPI_Transmit(&hspi2,&data,1,100) != HAL_OK ); HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_SET); } /*****************************************************************/ void writeToFIFO(uint8_t *data, uint8_t length){ uint8_t add= REG_FIFO | 0x80; HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_RESET); HAL_Delay(1); while ( HAL_SPI_Transmit(&hspi2,&add,1,100) != HAL_OK ); while ( HAL_SPI_Transmit(&hspi2,data,length,100) != HAL_OK ); HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_SET); } /*****************************************************************/ void LoraSetFreq(uint32_t frequency){ uint64_t frf = ((uint64_t)frequency << 19) / 32000000; writeRegLora(REG_FRF_MSB, (uint8_t)(frf >> 16)); writeRegLora(REG_FRF_MID, (uint8_t)(frf >> 8)); writeRegLora(REG_FRF_LSB, (uint8_t)(frf >> 0)); } /*****************************************************************/ void LoraSleep(void){ writeRegLora(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } /*****************************************************************/ void LoraIdle(void){ writeRegLora(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_STDBY); } //********************************************************** uint16_t LoraBegin(void){ //Blink Reset Pin HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8,GPIO_PIN_SET); HAL_Delay(10); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8,GPIO_PIN_RESET); HAL_Delay(10); HAL_GPIO_WritePin(GPIOB, GPIO_PIN_8,GPIO_PIN_SET); HAL_Delay(10); //Blink Slave Selection HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_RESET); HAL_Delay(10); HAL_GPIO_WritePin(GPIOA, LORA_NSS_Pin, GPIO_PIN_SET); HAL_Delay(10); //Check Version uint8_t version = readRegLora_8Bit(REG_VERSION); if (version != 0x12) return 0; //put in sleep mode LoraSleep(); //Set Frequency LoraSetFreq(FREQUENCY); //Set base address FIFO writeRegLora(REG_FIFO_TX_BASE_ADDR, 0); writeRegLora(REG_FIFO_RX_BASE_ADDR, 0); //set explicitheader mode //writeRegLora(REG_MODEM_CONFIG_1, readRegLora_8Bit(REG_MODEM_CONFIG_1) & 0xfe); LoraExplicitHeaderMode(); // set LNA boost writeRegLora(REG_LNA, readRegLora_8Bit(REG_LNA) | 0x03); // set auto AGC writeRegLora(REG_MODEM_CONFIG_3, 0x04); //ocpTrim writeRegLora(REG_OCP, 0x20 | (0x1F & 0x0B)); //TX power writeRegLora(REG_PA_CONFIG, PA_BOOST | (17 - 2)); //put in standby Mode LoraIdle(); return 1; } //***************************************************** void LoraEnd(void){ LoraSleep(); } //**************************************************** void LoraSetLdoFlag(void){ // Section 4.1.1.5 long symbolDuration = 1000 / ( LoraGetSignalBW() / (1L << LoraGetSpreadingFactor()) ) ; uint8_t config3 = readRegLora_8Bit(REG_MODEM_CONFIG_3); // Section 4.1.1.6 if(symbolDuration > 16) config3 = config3 | 0x08; else config3 = config3 & 0xF7; // bitWrite(config3, 3, ldoOn); writeRegLora(REG_MODEM_CONFIG_3, config3); } //**************************************************** //set Spreading Factor void LoraSetSpreadingFactor(uint8_t sf){ if (sf < 6) { sf = 6; } else if (sf > 12) { sf = 12; } if (sf == 6) { writeRegLora(REG_DETECTION_OPTIMIZE, 0xc5); writeRegLora(REG_DETECTION_THRESHOLD, 0x0c); } else { writeRegLora(REG_DETECTION_OPTIMIZE, 0xc3); writeRegLora(REG_DETECTION_THRESHOLD, 0x0a); } writeRegLora(REG_MODEM_CONFIG_2, (readRegLora_8Bit(REG_MODEM_CONFIG_2) & 0x0f) | ((sf << 4) & 0xf0)); LoraSetLdoFlag(); } //****************************************************** uint16_t LoraGetSpreadingFactor(void){ return readRegLora_8Bit(REG_MODEM_CONFIG_2) >> 4; } //*************************************************** //get Signal Band Width uint32_t LoraGetSignalBW(void){ uint8_t bw = (readRegLora_8Bit(REG_MODEM_CONFIG_1) >> 4); switch (bw) { case 0: return 7800; case 1: return 10400; case 2: return 15600; case 3: return 20800; case 4: return 31250; case 5: return 41700; case 6: return 62500; case 7: return 125000; case 8: return 250000; case 9: return 500000; } return 0; } //***************************************************** //set Signal BandWidth void LoraSetSignalBW(uint32_t bandwidth){ int bw; if (bandwidth <= 7.8E3) { bw = 0; } else if (bandwidth <= 10400) { bw = 1; } else if (bandwidth <= 15600) { bw = 2; } else if (bandwidth <= 20800) { bw = 3; } else if (bandwidth <= 31250) { bw = 4; } else if (bandwidth <= 41700) { bw = 5; } else if (bandwidth <= 62500) { bw = 6; } else if (bandwidth <= 125000) { bw = 7; } else if (bandwidth <= 250000) { bw = 8; } else /*if (bandwidth <= 250E3)*/ { bw = 9; } writeRegLora(REG_MODEM_CONFIG_1, (readRegLora_8Bit(REG_MODEM_CONFIG_1) & 0x0f) | (bw << 4)); LoraSetLdoFlag(); } //******************************************************** //set Coding Rate void LoraSetCodingRate(int denominator){ if (denominator < 5) { denominator = 5; } else if (denominator > 8) { denominator = 8; } int cr = denominator - 4; writeRegLora(REG_MODEM_CONFIG_1, (readRegLora_8Bit(REG_MODEM_CONFIG_1) & 0xf1) | (cr << 1)); } //*********************************************************** //Lora is Transmitting uint8_t LoraIsTransmitting(void){ if ((readRegLora_8Bit(REG_OP_MODE) & MODE_TX) == MODE_TX) { return 1; } if (readRegLora_8Bit(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) { // clear IRQ's writeRegLora(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK); } return 0; } //*********************************************************** //Set imlicit Header Mode void LoraImplicitHeaderMode(void){ writeRegLora(REG_MODEM_CONFIG_1, readRegLora_8Bit(REG_MODEM_CONFIG_1) | 0x01); } //*********************************************************** //Set explicit Header Mode void LoraExplicitHeaderMode(void){ writeRegLora(REG_MODEM_CONFIG_1, readRegLora_8Bit(REG_MODEM_CONFIG_1) & 0xFE); } /********************************************************/ // set Lora into Rx mode : Continous or Single void LoraRxMode(uint8_t RxMode){ writeRegLora(REG_OP_MODE, MODE_LONG_RANGE_MODE | RxMode); } /********************************************************/ // set Lora into Rx mode : Continous or Single void LoraTxMode(){ writeRegLora(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX); } /**************************************************************/ void LoraRead(uint8_t *arrayReadData){ uint8_t packetLength = 0; uint8_t i; uint8_t irqFlag = readRegLora_8Bit(REG_IRQ_FLAGS); writeRegLora(REG_IRQ_FLAGS, irqFlag); if((irqFlag & 0x40) != 0){ packetLength = readRegLora_8Bit(REG_RX_NB_BYTES); writeRegLora(REG_FIFO_ADDR_PTR, readRegLora_8Bit(REG_FIFO_RX_CURRENT_ADDR)); for(i = 0; i <packetLength; i++){ arrayReadData[i]=readRegLora_8Bit(REG_FIFO); } //powerReadInt = ( arrayReadData[0]-48)*10 + (arrayReadData[1] -48); //neu doc dc HAL_GPIO_WritePin(GPIOB,GPIO_PIN_8,GPIO_PIN_RESET); HAL_Delay(200); HAL_GPIO_WritePin(GPIOB,GPIO_PIN_8,GPIO_PIN_SET); HAL_Delay(200); } } /**************************************************************/ //Transfer Data have first address = buffer, and length = uint8_t Size //return Size transfered uint8_t LoraTransfer(uint8_t *buffer, uint8_t size){ // reset FIFO address and paload length writeRegLora(REG_FIFO_ADDR_PTR, 0); writeRegLora(REG_PAYLOAD_LENGTH, 0); writeToFIFO(buffer,size); writeRegLora(REG_PAYLOAD_LENGTH, size); // put in TX mode LoraTxMode(); // wait for TX done while ((readRegLora_8Bit(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0) {} // clear IRQ's writeRegLora(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK); return 1; } //convert read data to int
[ "nguyendanghuy247@gmail.com" ]
nguyendanghuy247@gmail.com
dfa01ea86a2bce6ee9052f2c25dae843b063fff3
f99fe5e7d6b160cef405cba7775899a81ed2a5e5
/src/cmptr3.c
f8f7532066b3e512f34a811e1517283e6b79cdc7
[]
no_license
rajdipnayek/cslatec
83122616f72769b36fa7b6d00b3ec988bbb35fe3
c2a4301febfe44e2d1e0c0fa3a73ca49e44780db
refs/heads/master
2021-01-06T16:47:40.152000
2015-05-01T20:03:32
2015-05-01T20:17:48
null
0
0
null
null
null
null
UTF-8
C
false
false
8,360
c
/* cmptr3.f -- translated by f2c (version 12.02.01). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include <stdlib.h> /* For exit() */ #include <f2c.h> /* Table of constant values */ static complex c_b10 = {1.f,0.f}; /* DECK CMPTR3 */ /* Subroutine */ int cmptr3_(integer *m, complex *a, complex *b, complex *c__, integer *k, complex *y1, complex *y2, complex *y3, complex *tcos, complex *d__, complex *w1, complex *w2, complex *w3) { /* System generated locals */ integer i__1, i__2, i__3, i__4, i__5, i__6; complex q__1, q__2, q__3, q__4; /* Local variables */ static integer i__, n; static complex x, z__; static integer k1, k2, k3, k4, l1, l2, l3, ip; static complex xx; static integer mm1, k1p1, k2p1, k3p1, k4p1, k2k3k4, kint1, lint1, lint2, lint3, kint2, kint3; /* ***BEGIN PROLOGUE CMPTR3 */ /* ***SUBSIDIARY */ /* ***PURPOSE Subsidiary to CMGNBN */ /* ***LIBRARY SLATEC */ /* ***TYPE COMPLEX (TRI3-S, CMPTR3-C) */ /* ***AUTHOR (UNKNOWN) */ /* ***DESCRIPTION */ /* Subroutine to solve tridiagonal systems. */ /* ***SEE ALSO CMGNBN */ /* ***ROUTINES CALLED (NONE) */ /* ***REVISION HISTORY (YYMMDD) */ /* 801001 DATE WRITTEN */ /* 890206 REVISION DATE from Version 3.2 */ /* 891214 Prologue converted to Version 4.0 format. (BAB) */ /* 900402 Added TYPE section. (WRB) */ /* ***END PROLOGUE CMPTR3 */ /* ***FIRST EXECUTABLE STATEMENT CMPTR3 */ /* Parameter adjustments */ --w3; --w2; --w1; --d__; --tcos; --y3; --y2; --y1; --k; --c__; --b; --a; /* Function Body */ mm1 = *m - 1; k1 = k[1]; k2 = k[2]; k3 = k[3]; k4 = k[4]; k1p1 = k1 + 1; k2p1 = k2 + 1; k3p1 = k3 + 1; k4p1 = k4 + 1; k2k3k4 = k2 + k3 + k4; if (k2k3k4 == 0) { goto L101; } l1 = k1p1 / k2p1; l2 = k1p1 / k3p1; l3 = k1p1 / k4p1; lint1 = 1; lint2 = 1; lint3 = 1; kint1 = k1; kint2 = kint1 + k2; kint3 = kint2 + k3; L101: i__1 = k1; for (n = 1; n <= i__1; ++n) { i__2 = n; x.r = tcos[i__2].r, x.i = tcos[i__2].i; if (k2k3k4 == 0) { goto L107; } if (n != l1) { goto L103; } i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; w1[i__3].r = y1[i__4].r, w1[i__3].i = y1[i__4].i; /* L102: */ } L103: if (n != l2) { goto L105; } i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; w2[i__3].r = y2[i__4].r, w2[i__3].i = y2[i__4].i; /* L104: */ } L105: if (n != l3) { goto L107; } i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; w3[i__3].r = y3[i__4].r, w3[i__3].i = y3[i__4].i; /* L106: */ } L107: q__2.r = b[1].r - x.r, q__2.i = b[1].i - x.i; c_div(&q__1, &c_b10, &q__2); z__.r = q__1.r, z__.i = q__1.i; q__1.r = c__[1].r * z__.r - c__[1].i * z__.i, q__1.i = c__[1].r * z__.i + c__[1].i * z__.r; d__[1].r = q__1.r, d__[1].i = q__1.i; q__1.r = y1[1].r * z__.r - y1[1].i * z__.i, q__1.i = y1[1].r * z__.i + y1[1].i * z__.r; y1[1].r = q__1.r, y1[1].i = q__1.i; q__1.r = y2[1].r * z__.r - y2[1].i * z__.i, q__1.i = y2[1].r * z__.i + y2[1].i * z__.r; y2[1].r = q__1.r, y2[1].i = q__1.i; q__1.r = y3[1].r * z__.r - y3[1].i * z__.i, q__1.i = y3[1].r * z__.i + y3[1].i * z__.r; y3[1].r = q__1.r, y3[1].i = q__1.i; i__2 = *m; for (i__ = 2; i__ <= i__2; ++i__) { i__3 = i__; q__3.r = b[i__3].r - x.r, q__3.i = b[i__3].i - x.i; i__4 = i__; i__5 = i__ - 1; q__4.r = a[i__4].r * d__[i__5].r - a[i__4].i * d__[i__5].i, q__4.i = a[i__4].r * d__[i__5].i + a[i__4].i * d__[i__5] .r; q__2.r = q__3.r - q__4.r, q__2.i = q__3.i - q__4.i; c_div(&q__1, &c_b10, &q__2); z__.r = q__1.r, z__.i = q__1.i; i__3 = i__; i__4 = i__; q__1.r = c__[i__4].r * z__.r - c__[i__4].i * z__.i, q__1.i = c__[ i__4].r * z__.i + c__[i__4].i * z__.r; d__[i__3].r = q__1.r, d__[i__3].i = q__1.i; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ - 1; q__3.r = a[i__5].r * y1[i__6].r - a[i__5].i * y1[i__6].i, q__3.i = a[i__5].r * y1[i__6].i + a[i__5].i * y1[i__6].r; q__2.r = y1[i__4].r - q__3.r, q__2.i = y1[i__4].i - q__3.i; q__1.r = q__2.r * z__.r - q__2.i * z__.i, q__1.i = q__2.r * z__.i + q__2.i * z__.r; y1[i__3].r = q__1.r, y1[i__3].i = q__1.i; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ - 1; q__3.r = a[i__5].r * y2[i__6].r - a[i__5].i * y2[i__6].i, q__3.i = a[i__5].r * y2[i__6].i + a[i__5].i * y2[i__6].r; q__2.r = y2[i__4].r - q__3.r, q__2.i = y2[i__4].i - q__3.i; q__1.r = q__2.r * z__.r - q__2.i * z__.i, q__1.i = q__2.r * z__.i + q__2.i * z__.r; y2[i__3].r = q__1.r, y2[i__3].i = q__1.i; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ - 1; q__3.r = a[i__5].r * y3[i__6].r - a[i__5].i * y3[i__6].i, q__3.i = a[i__5].r * y3[i__6].i + a[i__5].i * y3[i__6].r; q__2.r = y3[i__4].r - q__3.r, q__2.i = y3[i__4].i - q__3.i; q__1.r = q__2.r * z__.r - q__2.i * z__.i, q__1.i = q__2.r * z__.i + q__2.i * z__.r; y3[i__3].r = q__1.r, y3[i__3].i = q__1.i; /* L108: */ } i__2 = mm1; for (ip = 1; ip <= i__2; ++ip) { i__ = *m - ip; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ + 1; q__2.r = d__[i__5].r * y1[i__6].r - d__[i__5].i * y1[i__6].i, q__2.i = d__[i__5].r * y1[i__6].i + d__[i__5].i * y1[i__6] .r; q__1.r = y1[i__4].r - q__2.r, q__1.i = y1[i__4].i - q__2.i; y1[i__3].r = q__1.r, y1[i__3].i = q__1.i; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ + 1; q__2.r = d__[i__5].r * y2[i__6].r - d__[i__5].i * y2[i__6].i, q__2.i = d__[i__5].r * y2[i__6].i + d__[i__5].i * y2[i__6] .r; q__1.r = y2[i__4].r - q__2.r, q__1.i = y2[i__4].i - q__2.i; y2[i__3].r = q__1.r, y2[i__3].i = q__1.i; i__3 = i__; i__4 = i__; i__5 = i__; i__6 = i__ + 1; q__2.r = d__[i__5].r * y3[i__6].r - d__[i__5].i * y3[i__6].i, q__2.i = d__[i__5].r * y3[i__6].i + d__[i__5].i * y3[i__6] .r; q__1.r = y3[i__4].r - q__2.r, q__1.i = y3[i__4].i - q__2.i; y3[i__3].r = q__1.r, y3[i__3].i = q__1.i; /* L109: */ } if (k2k3k4 == 0) { goto L115; } if (n != l1) { goto L111; } i__ = lint1 + kint1; i__2 = i__; q__1.r = x.r - tcos[i__2].r, q__1.i = x.i - tcos[i__2].i; xx.r = q__1.r, xx.i = q__1.i; i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; q__2.r = xx.r * y1[i__4].r - xx.i * y1[i__4].i, q__2.i = xx.r * y1[i__4].i + xx.i * y1[i__4].r; i__5 = i__; q__1.r = q__2.r + w1[i__5].r, q__1.i = q__2.i + w1[i__5].i; y1[i__3].r = q__1.r, y1[i__3].i = q__1.i; /* L110: */ } ++lint1; l1 = lint1 * k1p1 / k2p1; L111: if (n != l2) { goto L113; } i__ = lint2 + kint2; i__2 = i__; q__1.r = x.r - tcos[i__2].r, q__1.i = x.i - tcos[i__2].i; xx.r = q__1.r, xx.i = q__1.i; i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; q__2.r = xx.r * y2[i__4].r - xx.i * y2[i__4].i, q__2.i = xx.r * y2[i__4].i + xx.i * y2[i__4].r; i__5 = i__; q__1.r = q__2.r + w2[i__5].r, q__1.i = q__2.i + w2[i__5].i; y2[i__3].r = q__1.r, y2[i__3].i = q__1.i; /* L112: */ } ++lint2; l2 = lint2 * k1p1 / k3p1; L113: if (n != l3) { goto L115; } i__ = lint3 + kint3; i__2 = i__; q__1.r = x.r - tcos[i__2].r, q__1.i = x.i - tcos[i__2].i; xx.r = q__1.r, xx.i = q__1.i; i__2 = *m; for (i__ = 1; i__ <= i__2; ++i__) { i__3 = i__; i__4 = i__; q__2.r = xx.r * y3[i__4].r - xx.i * y3[i__4].i, q__2.i = xx.r * y3[i__4].i + xx.i * y3[i__4].r; i__5 = i__; q__1.r = q__2.r + w3[i__5].r, q__1.i = q__2.i + w3[i__5].i; y3[i__3].r = q__1.r, y3[i__3].i = q__1.i; /* L114: */ } ++lint3; l3 = lint3 * k1p1 / k4p1; L115: ; } return 0; } /* cmptr3_ */
[ "rf@rufflewind.com" ]
rf@rufflewind.com
f3aba8ef613f6ee571dcd7583931e508a0734276
99bdb3251fecee538e0630f15f6574054dfc1468
/bsp/lm3s8962/Libraries/driverlib/lpc.h
15023178da16496a198e68242b6002c3aa35a2e2
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "Zlib", "MIT", "BSD-3-Clause", "X11", "BSD-4-Clause-UC", "LicenseRef-scancode-unknown-license-reference" ]
permissive
RT-Thread/rt-thread
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
3602f891211904a27dcbd51e5ba72fefce7326b2
refs/heads/master
2023-09-01T04:10:20.295000
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
26,535
h
//***************************************************************************** // // lpc.h - Prototypes for the Low Pin Count (LPC) driver. // // Copyright (c) 2010-2011 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 8264 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __LPC_H__ #define __LPC_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to LPCConfigSet as the ulConfig value, and // returned from LPCConfigGet. // //***************************************************************************** #define LPC_CFG_WAKE 0x00000100 // Restart the LPC Bus //***************************************************************************** // // Values that can be returned from LPCStatus. // //***************************************************************************** #define LPC_STATUS_RST 0x00000400 // LPC is in Reset #define LPC_STATUS_BUSY 0x00000200 // LPC is Busy #define LPC_STATUS_SLEEP 0x00000100 // LPC is in Sleep Mode #define LPC_STATUS_CA7 0x00000080 // Channel 7 Active #define LPC_STATUS_CA6 0x00000040 // Channel 6 Active #define LPC_STATUS_CA5 0x00000020 // Channel 5 Active #define LPC_STATUS_CA4 0x00000010 // Channel 4 Active #define LPC_STATUS_CA3 0x00000008 // Channel 3 Active #define LPC_STATUS_CA2 0x00000004 // Channel 2 Active #define LPC_STATUS_CA1 0x00000002 // Channel 1 Active #define LPC_STATUS_CA0 0x00000001 // Channel 0 Active //***************************************************************************** // // Values that can be passed to LPCIRQSet and LPCIRQClear in the ulIRQ // parameter and returned from LPCIRQGet. // //***************************************************************************** #define LPC_IRQ15 0x80000000 // Serial IRQ15 #define LPC_IRQ14 0x40000000 // Serial IRQ14 #define LPC_IRQ13 0x20000000 // Serial IRQ13 #define LPC_IRQ12 0x10000000 // Serial IRQ12 #define LPC_IRQ11 0x08000000 // Serial IRQ11 #define LPC_IRQ10 0x04000000 // Serial IRQ10 #define LPC_IRQ9 0x02000000 // Serial IRQ9 #define LPC_IRQ8 0x01000000 // Serial IRQ8 #define LPC_IRQ7 0x00800000 // Serial IRQ7 #define LPC_IRQ6 0x00400000 // Serial IRQ6 #define LPC_IRQ5 0x00200000 // Serial IRQ5 #define LPC_IRQ4 0x00100000 // Serial IRQ4 #define LPC_IRQ3 0x00080000 // Serial IRQ3 #define LPC_IRQ2 0x00040000 // Serial IRQ2 #define LPC_IRQ1 0x00020000 // Serial IRQ1 #define LPC_IRQ0 0x00010000 // Serial IRQ0 //***************************************************************************** // // Addition values that can be returned from LPCIRQGet. // //***************************************************************************** #define LPC_IRQ_BUSY 0x00000004 // SERIRQ frame in progress #define LPC_IRQ_CONT 0x00000001 // SERIRQ in Continuous Mode //***************************************************************************** // // Values that can be passed as the ulChannel parameter in LPCChannel... // API calls. // //***************************************************************************** #define LPC_CHAN_CH0 0 // LPC Channel 0 #define LPC_CHAN_CH1 1 // LPC Channel 1 #define LPC_CHAN_CH2 2 // LPC Channel 2 #define LPC_CHAN_CH3 3 // LPC Channel 3 #define LPC_CHAN_CH4 4 // LPC Channel 4 #define LPC_CHAN_CH5 5 // LPC Channel 5 #define LPC_CHAN_CH6 6 // LPC Channel 6 #define LPC_CHAN_CH7 7 // LPC Channel 7 (COMx) #define LPC_CHAN_COMx 7 // LPC Channel 7 (COMx) //***************************************************************************** // // Values that can be passed as part of the ulConfig parameter in the // LPCChannelConfig... functions. // //***************************************************************************** #define LPC_CHAN_IRQSEL2_NONE 0x00000000 // LPC Channel IRQSEL2 Disabled #define LPC_CHAN_IRQSEL2_IRQ0 0x00080000 // LPC Channel IRQSEL2 IRQ0 #define LPC_CHAN_IRQSEL2_IRQ1 0x10080000 // LPC Channel IRQSEL2 IRQ1 #define LPC_CHAN_IRQSEL2_IRQ2 0x20080000 // LPC Channel IRQSEL2 IRQ2 #define LPC_CHAN_IRQSEL2_IRQ3 0x30080000 // LPC Channel IRQSEL2 IRQ3 #define LPC_CHAN_IRQSEL2_IRQ4 0x40080000 // LPC Channel IRQSEL2 IRQ4 #define LPC_CHAN_IRQSEL2_IRQ5 0x50080000 // LPC Channel IRQSEL2 IRQ5 #define LPC_CHAN_IRQSEL2_IRQ6 0x60080000 // LPC Channel IRQSEL2 IRQ6 #define LPC_CHAN_IRQSEL2_IRQ7 0x70080000 // LPC Channel IRQSEL2 IRQ7 #define LPC_CHAN_IRQSEL2_IRQ8 0x80080000 // LPC Channel IRQSEL2 IRQ8 #define LPC_CHAN_IRQSEL2_IRQ9 0x90080000 // LPC Channel IRQSEL2 IRQ9 #define LPC_CHAN_IRQSEL2_IRQ10 0xA0080000 // LPC Channel IRQSEL2 IRQ10 #define LPC_CHAN_IRQSEL2_IRQ11 0xB0080000 // LPC Channel IRQSEL2 IRQ11 #define LPC_CHAN_IRQSEL2_IRQ12 0xC0080000 // LPC Channel IRQSEL2 IRQ12 #define LPC_CHAN_IRQSEL2_IRQ13 0xD0080000 // LPC Channel IRQSEL2 IRQ13 #define LPC_CHAN_IRQSEL2_IRQ14 0xE0080000 // LPC Channel IRQSEL2 IRQ14 #define LPC_CHAN_IRQSEL2_IRQ15 0xF0080000 // LPC Channel IRQSEL2 IRQ15 #define LPC_CHAN_COMxIRQ_DISABLE \ 0x00000000 // LCP Channel COMx IRQ Disabled #define LPC_CHAN_COMxIRQ_ENABLE 0x00080000 // LCP Channel COMx IRQ Enabled #define LPC_CHAN_IRQSEL1_NONE 0x00000000 // LPC Channel IRQSEL1 Disabled #define LPC_CHAN_IRQSEL1_IRQ0 0x00040000 // LPC Channel IRQSEL1 IRQ0 #define LPC_CHAN_IRQSEL1_IRQ1 0x01040000 // LPC Channel IRQSEL1 IRQ1 #define LPC_CHAN_IRQSEL1_IRQ2 0x02040000 // LPC Channel IRQSEL1 IRQ2 #define LPC_CHAN_IRQSEL1_IRQ3 0x03040000 // LPC Channel IRQSEL1 IRQ3 #define LPC_CHAN_IRQSEL1_IRQ4 0x04040000 // LPC Channel IRQSEL1 IRQ4 #define LPC_CHAN_IRQSEL1_IRQ5 0x05040000 // LPC Channel IRQSEL1 IRQ5 #define LPC_CHAN_IRQSEL1_IRQ6 0x06040000 // LPC Channel IRQSEL1 IRQ6 #define LPC_CHAN_IRQSEL1_IRQ7 0x07040000 // LPC Channel IRQSEL1 IRQ7 #define LPC_CHAN_IRQSEL1_IRQ8 0x08040000 // LPC Channel IRQSEL1 IRQ8 #define LPC_CHAN_IRQSEL1_IRQ9 0x09040000 // LPC Channel IRQSEL1 IRQ9 #define LPC_CHAN_IRQSEL1_IRQ10 0x0A040000 // LPC Channel IRQSEL1 IRQ10 #define LPC_CHAN_IRQSEL1_IRQ11 0x0B040000 // LPC Channel IRQSEL1 IRQ11 #define LPC_CHAN_IRQSEL1_IRQ12 0x0C040000 // LPC Channel IRQSEL1 IRQ12 #define LPC_CHAN_IRQSEL1_IRQ13 0x0D040000 // LPC Channel IRQSEL1 IRQ13 #define LPC_CHAN_IRQSEL1_IRQ14 0x0E040000 // LPC Channel IRQSEL1 IRQ14 #define LPC_CHAN_IRQSEL1_IRQ15 0x0F040000 // LPC Channel IRQSEL1 IRQ15 #define LPC_CHAN_IRQSEL0_NONE 0x00000000 // LPC Channel IRQSEL0 Disabled #define LPC_CHAN_IRQSEL0_IRQ0 0x00000000 // LPC Channel IRQSEL0 IRQ0 #define LPC_CHAN_IRQSEL0_IRQ1 0x00100000 // LPC Channel IRQSEL0 IRQ1 #define LPC_CHAN_IRQSEL0_IRQ2 0x00200000 // LPC Channel IRQSEL0 IRQ2 #define LPC_CHAN_IRQSEL0_IRQ3 0x00300000 // LPC Channel IRQSEL0 IRQ3 #define LPC_CHAN_IRQSEL0_IRQ4 0x00400000 // LPC Channel IRQSEL0 IRQ4 #define LPC_CHAN_IRQSEL0_IRQ5 0x00500000 // LPC Channel IRQSEL0 IRQ5 #define LPC_CHAN_IRQSEL0_IRQ6 0x00600000 // LPC Channel IRQSEL0 IRQ6 #define LPC_CHAN_IRQSEL0_IRQ7 0x00700000 // LPC Channel IRQSEL0 IRQ7 #define LPC_CHAN_IRQSEL0_IRQ8 0x00800000 // LPC Channel IRQSEL0 IRQ8 #define LPC_CHAN_IRQSEL0_IRQ9 0x00900000 // LPC Channel IRQSEL0 IRQ9 #define LPC_CHAN_IRQSEL0_IRQ10 0x00A00000 // LPC Channel IRQSEL0 IRQ10 #define LPC_CHAN_IRQSEL0_IRQ11 0x00B00000 // LPC Channel IRQSEL0 IRQ11 #define LPC_CHAN_IRQSEL0_IRQ12 0x00C00000 // LPC Channel IRQSEL0 IRQ12 #define LPC_CHAN_IRQSEL0_IRQ13 0x00D00000 // LPC Channel IRQSEL0 IRQ13 #define LPC_CHAN_IRQSEL0_IRQ14 0x00E00000 // LPC Channel IRQSEL0 IRQ14 #define LPC_CHAN_IRQSEL0_IRQ15 0x00F00000 // LPC Channel IRQSEL0 IRQ15 #define LPC_CHAN_IRQEN0_OFF 0x00000000 // LPC Channel IRQEN0 Disabled #define LPC_CHAN_IRQEN0_TRG1 0x00010000 // LPC Channel IRQEN0 Trigger 1 #define LPC_CHAN_IRQEN0_TRG2 0x00020000 // LPC Channel IRQEN0 Trigger 2 #define LPC_CHAN_IRQEN0_TRG3 0x00030000 // LPC Channel IRQEN0 Trigger 3 #define LPC_CHAN_MBARB_ENABLED 0x00000000 // LPC Channel Mailbox Arbritration // enabled. #define LPC_CHAN_MBARB_DISABLED 0x00008000 // LPC Channel Mailbox Arbritration // disabled. #define LPC_CHAN_SIZE_4 0x00000000 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_8 0x00000004 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_16 0x00000008 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_32 0x0000000C // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_64 0x00000010 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_128 0x00000014 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_256 0x00000018 // Mailbox IO/Memory Window size // is 4 Bytes. #define LPC_CHAN_SIZE_512 0x0000001C // Mailbox IO/Memory Window size // is 4 Bytes. //***************************************************************************** // // Values that can be passed to LCPChannelConfigCOMxSet as the ulCOMxMode // parameter or returned from LPCChannelConfigGet in the pulCOMxMode // parameter. // //***************************************************************************** #define LPC_COMx_MODE_FRMHNML 0x00000000 // Normal From Host model. #define LPC_COMx_MODE_FRMHIGN 0x00020000 // Ignore From Host data. #define LPC_COMx_MODE_FRMHDMA 0x00040000 // COMx DMA on From Host data to // memory #define LPC_COMx_MODE_UARTDMA 0x00060000 // COMx DMA on From Host data to // UART1 //***************************************************************************** // // Additinal values that can be returned from LPCChannelConfigGet in the // pulCOMxMode parameter. // //***************************************************************************** #define LPC_COMx_ENABLED 0x00010000 // COMx mode enabled. //***************************************************************************** // // Values that can be passed to LPCIntEnable, LPCIntDisable, and LPCIntClear // as the ulIntFlags parameter and returned by LPCIntStatus. // //***************************************************************************** #define LPC_INT_RST 0x80000000 // LPC Bus Enters or Exits // Reset State. #define LPC_INT_SLEEP 0x40000000 // LPC Bus Enters or Exits // Sleep State. #define LPC_INT_COMx 0x20000000 // COMx has read/written // data. #define LPC_INT_SIRQ 0x10000000 // SERIRQ frame has completed #define LPC_INT_CH6_EP_TO_HOST (1 << 24) // To-Host has been read. #define LPC_INT_CH6_EP_FROM_DATA \ (2 << 24) // From-Host has been written as // data. #define LPC_INT_CH6_EP_FROM_CMD (4 << 24) // From-Host has been written as // command. #define LPC_INT_CH6_MB_HOST_WON (1 << 24) // Host Won (HW1ST) #define LPC_INT_CH6_MB_HOST_WRITE \ (2 << 24) // Host Wrote Last Byte. #define LPC_INT_CH6_MB_HOST_READ \ (4 << 24) // Host Read Last Byte #define LPC_INT_CH6_MB_MCU_LOST (8 << 24) // MCU Lost (when host had HW1ST). #define LPC_INT_CH5_EP_TO_HOST (1 << 20) // To-Host has been read. #define LPC_INT_CH5_EP_FROM_DATA \ (2 << 20) // From-Host has been written as // data. #define LPC_INT_CH5_EP_FROM_CMD (4 << 20) // From-Host has been written as // command. #define LPC_INT_CH5_MB_HOST_WON (1 << 20) // Host Won (HW1ST) #define LPC_INT_CH5_MB_HOST_WRITE \ (2 << 20) // Host Wrote Last Byte. #define LPC_INT_CH5_MB_HOST_READ \ (4 << 20) // Host Read Last Byte #define LPC_INT_CH5_MB_MCU_LOST (8 << 20) // MCU Lost (when host had HW1ST). #define LPC_INT_CH4_EP_TO_HOST (1 << 16) // To-Host has been read. #define LPC_INT_CH4_EP_FROM_DATA \ (2 << 16) // From-Host has been written as // data. #define LPC_INT_CH4_EP_FROM_CMD (4 << 16) // From-Host has been written as // command. #define LPC_INT_CH4_MB_HOST_WON (1 << 16) // Host Won (HW1ST) #define LPC_INT_CH4_MB_HOST_WRITE \ (2 << 16) // Host Wrote Last Byte. #define LPC_INT_CH4_MB_HOST_READ \ (4 << 16) // Host Read Last Byte #define LPC_INT_CH4_MB_MCU_LOST (8 << 16) // MCU Lost (when host had HW1ST). #define LPC_INT_CH3_EP_TO_HOST (1 << 12) // To-Host has been read. #define LPC_INT_CH3_EP_FROM_DATA \ (2 << 12) // From-Host has been written as // data. #define LPC_INT_CH3_EP_FROM_CMD (4 << 12) // From-Host has been written as // command. #define LPC_INT_CH3_MB_HOST_WON (1 << 12) // Host Won (HW1ST) #define LPC_INT_CH3_MB_HOST_WRITE \ (2 << 12) // Host Wrote Last Byte. #define LPC_INT_CH3_MB_HOST_READ \ (4 << 12) // Host Read Last Byte #define LPC_INT_CH3_MB_MCU_LOST (8 << 12) // MCU Lost (when host had HW1ST). #define LPC_INT_CH2_EP_TO_HOST (1 << 8) // To-Host has been read. #define LPC_INT_CH2_EP_FROM_DATA \ (2 << 8) // From-Host has been written as // data. #define LPC_INT_CH2_EP_FROM_CMD (4 << 8) // From-Host has been written as // command. #define LPC_INT_CH2_MB_HOST_WON (1 << 8) // Host Won (HW1ST) #define LPC_INT_CH2_MB_HOST_WRITE \ (2 << 8) // Host Wrote Last Byte. #define LPC_INT_CH2_MB_HOST_READ \ (4 << 8) // Host Read Last Byte #define LPC_INT_CH2_MB_MCU_LOST (8 << 8) // MCU Lost (when host had HW1ST). #define LPC_INT_CH1_EP_TO_HOST (1 << 4) // To-Host has been read. #define LPC_INT_CH1_EP_FROM_DATA \ (2 << 4) // From-Host has been written as // data. #define LPC_INT_CH1_EP_FROM_CMD (4 << 4) // From-Host has been written as // command. #define LPC_INT_CH1_MB_HOST_WON (1 << 4) // Host Won (HW1ST) #define LPC_INT_CH1_MB_HOST_WRITE \ (2 << 4) // Host Wrote Last Byte. #define LPC_INT_CH1_MB_HOST_READ \ (4 << 4) // Host Read Last Byte #define LPC_INT_CH1_MB_MCU_LOST (8 << 4) // MCU Lost (when host had HW1ST). #define LPC_INT_CH0_EP_TO_HOST (1 << 0) // To-Host has been read. #define LPC_INT_CH0_EP_FROM_DATA \ (2 << 0) // From-Host has been written as // data. #define LPC_INT_CH0_EP_FROM_CMD (4 << 0) // From-Host has been written as // command. #define LPC_INT_CH0_MB_HOST_WON (1 << 0) // Host Won (HW1ST) #define LPC_INT_CH0_MB_HOST_WRITE \ (2 << 0) // Host Wrote Last Byte. #define LPC_INT_CH0_MB_HOST_READ \ (4 << 0) // Host Read Last Byte #define LPC_INT_CH0_MB_MCU_LOST (8 << 0) // MCU Lost (when host had HW1ST). //***************************************************************************** // // Values that can be passed to LPCCOMxInt... functions as the ulIntFlags // parameter and returned by LPCIntStatus. // //***************************************************************************** #define LPC_COMx_INT_CX 0x02000000 // Raw Event State for COMx #define LPC_COMx_INT_CXTX 0x01000000 // Raw Event State for COMx TX #define LPC_COMx_INT_CXRX 0x00800000 // Raw Event State for COMx RX #define LPC_COMx_MASK_CX 0x00200000 // Event Mask for COMx #define LPC_COMx_MASK_CXTX 0x00100000 // Event Mask for COMx TX #define LPC_COMx_MASK_CXRX 0x00080000 // Event Mask for COMx RX //***************************************************************************** // // Values that can be passed to the LPCChannelDMAConfigSet function as part // of the ulConfig or ulMask parameter, or can be returned from the // LPCChannelConfigGet function. // //***************************************************************************** #define LPC_DMA_CH3_WEN 0x00000080 // Trigger DMA for "To Host" data // buffer is empty. #define LPC_DMA_CH3_REN 0x00000040 // Trigger DMA when "From Host" // data buffer is full. #define LPC_DMA_CH2_WEN 0x00000020 // Trigger DMA for "To Host" data // buffer is empty. #define LPC_DMA_CH2_REN 0x00000010 // Trigger DMA when "From Host" // data buffer is full. #define LPC_DMA_CH1_WEN 0x00000008 // Trigger DMA for "To Host" data // buffer is empty. #define LPC_DMA_CH1_REN 0x00000004 // Trigger DMA when "From Host" // data buffer is full. #define LPC_DMA_CH0_WEN 0x00000002 // Trigger DMA for "To Host" data // buffer is empty. #define LPC_DMA_CH0_REN 0x00000001 // Trigger DMA when "From Host" // data buffer is full. //***************************************************************************** // // Values that can be passed to the LPCChannelStatusSet and // LPCChannelStatusClear function, and returned by the LPCChannelStatusGet // function. // //***************************************************************************** #define LPC_CH_ST_USER0 0x00000100 // User Status Bit 0 #define LPC_CH_ST_USER1 0x00000200 // User Status Bit 1 #define LPC_CH_ST_USER2 0x00000400 // User Status Bit 2 #define LPC_CH_ST_USER3 0x00000800 // User Status Bit 3 #define LPC_CH_ST_USER4 0x00001000 // User Status Bit 4 //***************************************************************************** // // Additinoal values that can be returned by the LPCChannelStatusGet function. // //***************************************************************************** #define LPC_CH_ST_LASTHW 0x00000080 // Last Host Write #define LPC_CH_ST_HW1ST 0x00000040 // First Host Write #define LPC_CH_ST_LASTSW 0x00000020 // Last Slave Write #define LPC_CH_ST_SW1ST 0x00000010 // First Slave Write #define LPC_CH_ST_CMD 0x00000008 // Command or Data #define LPC_CH_ST_FRMH 0x00000002 // From-Host Transaction #define LPC_CH_ST_TOH 0x00000001 // To-Host Transaction //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void LPCConfigSet(unsigned long ulBase, unsigned long ulConfig); extern unsigned long LPCConfigGet(unsigned long ulBase); extern unsigned long LPCStatusGet(unsigned long ulBase, unsigned long *pulCount, unsigned long *pulPoolSize); extern void LPCStatusBlockAddressSet(unsigned long ulBase, unsigned long ulAddress, tBoolean bEnabled); extern unsigned LPCStatusBlockAddressGet(unsigned long ulBase); extern void LPCSCIAssert(unsigned long ulBase, unsigned long ulCount); extern void LPCIRQConfig(unsigned long ulBase, tBoolean bIRQPulse, tBoolean bIRQOnChange); extern void LPCIRQSet(unsigned long ulBase, unsigned long ulIRQ); extern void LPCIRQClear(unsigned long ulBase, unsigned long ulIRQ); extern unsigned long LPCIRQGet(unsigned long ulBase); extern void LPCIRQSend(unsigned long ulBase); extern void LPCIntRegister(unsigned long ulBase, void (*pfnHandler)(void)); extern void LPCIntUnregister(unsigned long ulBase); extern void LPCIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void LPCIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long LPCIntStatus(unsigned long ulBase, tBoolean bMasked); extern void LPCIntClear(unsigned long ulBase, unsigned long ulIntFlags); extern void LPCChannelEnable(unsigned long ulBase, unsigned long ulChannel); extern void LPCChannelDisable(unsigned long ulBase, unsigned long ulChannel); extern void LPCChannelConfigEPSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig, unsigned long ulAddress, unsigned long ulOffset); extern void LPCChannelConfigMBSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig, unsigned long ulAddress, unsigned long ulOffset); extern void LPCChannelConfigCOMxSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulConfig, unsigned long ulAddress, unsigned long ulOffset, unsigned long ulCOMxMode); extern unsigned long LPCChannelConfigGet(unsigned long ulBase, unsigned long ulChannel, unsigned long *pulAddress, unsigned long *pulOffset, unsigned long *pulCOMxMode); extern unsigned long LPCChannelPoolAddressGet(unsigned long ulBase, unsigned long ulChannel); extern unsigned long LPCChannelStatusGet(unsigned long ulBase, unsigned long ulChannel); extern void LPCChannelStatusSet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus); extern void LPCChannelStatusClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus); extern void LPCChannelDMAConfigSet(unsigned long ulBase, unsigned long ulConfig, unsigned long ulMask); extern unsigned long LPCChannelDMAConfigGet(unsigned long ulBase); extern unsigned char LPCByteRead(unsigned long ulBase, unsigned long ulOffset); extern void LPCByteWrite(unsigned long ulBase, unsigned long ulOffset, unsigned char ucData); extern unsigned short LPCHalfWordRead(unsigned long ulBase, unsigned long ulOffset); extern void LPCHalfWordWrite(unsigned long ulBase, unsigned long ulOffset, unsigned short usData); extern unsigned long LPCWordRead(unsigned long ulBase, unsigned long ulOffset); extern void LPCWordWrite(unsigned long ulBase, unsigned long ulOffset, unsigned long ulData); extern void LPCCOMxIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void LPCCOMxIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long LPCCOMxIntStatus(unsigned long ulBase, tBoolean bMasked); extern void LPCCOMxIntClear(unsigned long ulBase, unsigned long ulIntFlags); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __LPC_H__
[ "mbbill@gmail.com" ]
mbbill@gmail.com
04fea91c01ee1587f19ad32ee856fa3859d09f22
ade70089afe2f9bd496985fe67d46c5372042ab0
/nvm/versions/node/v16.14.0/include/node/openssl/opensslv.h
afe0161c9ca2dc78a4eac5c0a5319f30e43aba74
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "LicenseRef-scancode-openssl", "LicenseRef-scancode-unicode", "Artistic-2.0", "BSD-3-Clause", "Zlib", "NAIST-2003", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "NTP", "LicenseRef-scancode-public-domain-disclaimer", "ICU" ]
permissive
gn0rt0n/dotfiles
96e37a87cec555cbfd222795466c140eb502c892
35f01242e7ac73a8b21b5e62398f1185102b7ee9
refs/heads/master
2023-02-23T03:02:35.212000
2023-02-19T02:53:00
2023-02-19T02:53:00
299,629,236
0
1
null
2022-10-16T02:07:11
2020-09-29T13:40:38
C
UTF-8
C
false
false
4,110
h
/* * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #ifndef HEADER_OPENSSLV_H # define HEADER_OPENSSLV_H #ifdef __cplusplus extern "C" { #endif /*- * Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ # define OPENSSL_VERSION_NUMBER 0x101010dfL # define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1m+quic 14 Dec 2021" /*- * The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major version number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ # define SHLIB_VERSION_HISTORY "" # define SHLIB_VERSION_NUMBER "81.1.1" #ifdef __cplusplus } #endif #endif /* HEADER_OPENSSLV_H */
[ "gary@odindev.com" ]
gary@odindev.com
a2ee19d7d87b6949e20292b2a52ca26dc7dd75dd
0b98befdd49f707ed1923703bcdac9740bb4d699
/priv/codegolf/Draw the Sawtooth Alphabet.c
de85b8d2d1997998ac9bef46d8908dbbd40b99cb
[]
no_license
jbebe/all-my-projects
a957f2ae70d3ca09d49e1efc52c3cd9f6f786094
32a8b12b17d48c0138005eb54cb1ed9745baa737
refs/heads/master
2021-01-10T08:55:55.291000
2015-05-29T20:16:05
2015-05-29T20:16:05
35,968,468
0
0
null
null
null
null
UTF-8
C
false
false
884
c
/* A simple one today. Write the shortest program that draws a "sawtooth alphabet" given a positive integer for the height. You must write the name of your programming language when you come to the letter it starts with. For example, if your language is Python and the input is 1 the output should be: ABCDEFGHIJKLMNOPythonQRSTUVWXYZ If the input is 2 the output should be: B D F H J L N Python R T V X Z A C E G I K M O Q S U W Y If the input is 4 the output should be: D J Python V C E I K O Q U W B F H L N R T X Z A G M S Y */ /* if n holds the height: */ // C + escape codes: 81 x;main(y){for(y=n--;x<26;x++)printf("\033[%d;%dH%c",n?x/n&1?y++:y--:y,x+1,x+65);} // C 110 x;char a[702]={[0 ...701]=32};main(y){for(y=--n;x<26;a[x*27-1]=10)a[27*(n?x/n&1?y++:y--:y)+x]=x+++65;puts(a);}
[ "juhasz.balint.bebe@gmail.com" ]
juhasz.balint.bebe@gmail.com
b9311b53de5dc8ddfc8a8845a13274fc158e332a
263589b8c63adc45a5dcecf5ba7178a0f40a8646
/samd21a/include/component/dsu.h
7a51d9b738c4439d7a787fd8ff031b5446822a17
[]
no_license
joaofl/xdense-cortexm1
c6b1f181305726c951e352eccb4b50c0f4a7d994
224e9aae27f39692dd98a5c10057b32b9958792a
refs/heads/main
2023-03-14T21:23:42.979000
2021-02-28T14:58:28
2021-02-28T14:58:28
343,129,986
0
0
null
null
null
null
UTF-8
C
false
false
34,693
h
/** * \file * * \brief Component description for DSU * * Copyright (c) 2016 Atmel Corporation, * a wholly owned subsidiary of Microchip Technology Inc. * * \asf_license_start * * \page License * * 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 Licence 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. * * \asf_license_stop * */ #ifndef _SAMD21_DSU_COMPONENT_ #define _SAMD21_DSU_COMPONENT_ /* ========================================================================== */ /** SOFTWARE API DEFINITION FOR DSU */ /* ========================================================================== */ /** \addtogroup SAMD21_DSU Device Service Unit */ /*@{*/ #define DSU_U2209 #define REV_DSU 0x200 /* -------- DSU_CTRL : (DSU Offset: 0x0000) ( /W 8) Control -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t SWRST:1; /*!< bit: 0 Software Reset */ uint8_t :1; /*!< bit: 1 Reserved */ uint8_t CRC:1; /*!< bit: 2 32-bit Cyclic Redundancy Check */ uint8_t MBIST:1; /*!< bit: 3 Memory Built-In Self-Test */ uint8_t CE:1; /*!< bit: 4 Chip Erase */ uint8_t :3; /*!< bit: 5.. 7 Reserved */ } bit; /*!< Structure used for bit access */ uint8_t reg; /*!< Type used for register access */ } DSU_CTRL_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_CTRL_OFFSET 0x0000 /**< \brief (DSU_CTRL offset) Control */ #define DSU_CTRL_RESETVALUE _U(0x00) /**< \brief (DSU_CTRL reset_value) Control */ #define DSU_CTRL_SWRST_Pos 0 /**< \brief (DSU_CTRL) Software Reset */ #define DSU_CTRL_SWRST (_U(0x1) << DSU_CTRL_SWRST_Pos) #define DSU_CTRL_CRC_Pos 2 /**< \brief (DSU_CTRL) 32-bit Cyclic Redundancy Check */ #define DSU_CTRL_CRC (_U(0x1) << DSU_CTRL_CRC_Pos) #define DSU_CTRL_MBIST_Pos 3 /**< \brief (DSU_CTRL) Memory Built-In Self-Test */ #define DSU_CTRL_MBIST (_U(0x1) << DSU_CTRL_MBIST_Pos) #define DSU_CTRL_CE_Pos 4 /**< \brief (DSU_CTRL) Chip Erase */ #define DSU_CTRL_CE (_U(0x1) << DSU_CTRL_CE_Pos) #define DSU_CTRL_MASK _U(0x1D) /**< \brief (DSU_CTRL) MASK Register */ /* -------- DSU_STATUSA : (DSU Offset: 0x0001) (R/W 8) Status A -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t DONE:1; /*!< bit: 0 Done */ uint8_t CRSTEXT:1; /*!< bit: 1 CPU Reset Phase Extension */ uint8_t BERR:1; /*!< bit: 2 Bus Error */ uint8_t FAIL:1; /*!< bit: 3 Failure */ uint8_t PERR:1; /*!< bit: 4 Protection Error */ uint8_t :3; /*!< bit: 5.. 7 Reserved */ } bit; /*!< Structure used for bit access */ uint8_t reg; /*!< Type used for register access */ } DSU_STATUSA_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_STATUSA_OFFSET 0x0001 /**< \brief (DSU_STATUSA offset) Status A */ #define DSU_STATUSA_RESETVALUE _U(0x00) /**< \brief (DSU_STATUSA reset_value) Status A */ #define DSU_STATUSA_DONE_Pos 0 /**< \brief (DSU_STATUSA) Done */ #define DSU_STATUSA_DONE (_U(0x1) << DSU_STATUSA_DONE_Pos) #define DSU_STATUSA_CRSTEXT_Pos 1 /**< \brief (DSU_STATUSA) CPU Reset Phase Extension */ #define DSU_STATUSA_CRSTEXT (_U(0x1) << DSU_STATUSA_CRSTEXT_Pos) #define DSU_STATUSA_BERR_Pos 2 /**< \brief (DSU_STATUSA) Bus Error */ #define DSU_STATUSA_BERR (_U(0x1) << DSU_STATUSA_BERR_Pos) #define DSU_STATUSA_FAIL_Pos 3 /**< \brief (DSU_STATUSA) Failure */ #define DSU_STATUSA_FAIL (_U(0x1) << DSU_STATUSA_FAIL_Pos) #define DSU_STATUSA_PERR_Pos 4 /**< \brief (DSU_STATUSA) Protection Error */ #define DSU_STATUSA_PERR (_U(0x1) << DSU_STATUSA_PERR_Pos) #define DSU_STATUSA_MASK _U(0x1F) /**< \brief (DSU_STATUSA) MASK Register */ /* -------- DSU_STATUSB : (DSU Offset: 0x0002) (R/ 8) Status B -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint8_t PROT:1; /*!< bit: 0 Protected */ uint8_t DBGPRES:1; /*!< bit: 1 Debugger Present */ uint8_t DCCD0:1; /*!< bit: 2 Debug Communication Channel 0 Dirty */ uint8_t DCCD1:1; /*!< bit: 3 Debug Communication Channel 1 Dirty */ uint8_t HPE:1; /*!< bit: 4 Hot-Plugging Enable */ uint8_t :3; /*!< bit: 5.. 7 Reserved */ } bit; /*!< Structure used for bit access */ struct { uint8_t :2; /*!< bit: 0.. 1 Reserved */ uint8_t DCCD:2; /*!< bit: 2.. 3 Debug Communication Channel x Dirty */ uint8_t :4; /*!< bit: 4.. 7 Reserved */ } vec; /*!< Structure used for vec access */ uint8_t reg; /*!< Type used for register access */ } DSU_STATUSB_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_STATUSB_OFFSET 0x0002 /**< \brief (DSU_STATUSB offset) Status B */ #define DSU_STATUSB_RESETVALUE _U(0x10) /**< \brief (DSU_STATUSB reset_value) Status B */ #define DSU_STATUSB_PROT_Pos 0 /**< \brief (DSU_STATUSB) Protected */ #define DSU_STATUSB_PROT (_U(0x1) << DSU_STATUSB_PROT_Pos) #define DSU_STATUSB_DBGPRES_Pos 1 /**< \brief (DSU_STATUSB) Debugger Present */ #define DSU_STATUSB_DBGPRES (_U(0x1) << DSU_STATUSB_DBGPRES_Pos) #define DSU_STATUSB_DCCD0_Pos 2 /**< \brief (DSU_STATUSB) Debug Communication Channel 0 Dirty */ #define DSU_STATUSB_DCCD0 (1 << DSU_STATUSB_DCCD0_Pos) #define DSU_STATUSB_DCCD1_Pos 3 /**< \brief (DSU_STATUSB) Debug Communication Channel 1 Dirty */ #define DSU_STATUSB_DCCD1 (1 << DSU_STATUSB_DCCD1_Pos) #define DSU_STATUSB_DCCD_Pos 2 /**< \brief (DSU_STATUSB) Debug Communication Channel x Dirty */ #define DSU_STATUSB_DCCD_Msk (_U(0x3) << DSU_STATUSB_DCCD_Pos) #define DSU_STATUSB_DCCD(value) (DSU_STATUSB_DCCD_Msk & ((value) << DSU_STATUSB_DCCD_Pos)) #define DSU_STATUSB_HPE_Pos 4 /**< \brief (DSU_STATUSB) Hot-Plugging Enable */ #define DSU_STATUSB_HPE (_U(0x1) << DSU_STATUSB_HPE_Pos) #define DSU_STATUSB_MASK _U(0x1F) /**< \brief (DSU_STATUSB) MASK Register */ /* -------- DSU_ADDR : (DSU Offset: 0x0004) (R/W 32) Address -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t :2; /*!< bit: 0.. 1 Reserved */ uint32_t ADDR:30; /*!< bit: 2..31 Address */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_ADDR_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_ADDR_OFFSET 0x0004 /**< \brief (DSU_ADDR offset) Address */ #define DSU_ADDR_RESETVALUE _U(0x00000000) /**< \brief (DSU_ADDR reset_value) Address */ #define DSU_ADDR_ADDR_Pos 2 /**< \brief (DSU_ADDR) Address */ #define DSU_ADDR_ADDR_Msk (_U(0x3FFFFFFF) << DSU_ADDR_ADDR_Pos) #define DSU_ADDR_ADDR(value) (DSU_ADDR_ADDR_Msk & ((value) << DSU_ADDR_ADDR_Pos)) #define DSU_ADDR_MASK _U(0xFFFFFFFC) /**< \brief (DSU_ADDR) MASK Register */ /* -------- DSU_LENGTH : (DSU Offset: 0x0008) (R/W 32) Length -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t :2; /*!< bit: 0.. 1 Reserved */ uint32_t LENGTH:30; /*!< bit: 2..31 Length */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_LENGTH_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_LENGTH_OFFSET 0x0008 /**< \brief (DSU_LENGTH offset) Length */ #define DSU_LENGTH_RESETVALUE _U(0x00000000) /**< \brief (DSU_LENGTH reset_value) Length */ #define DSU_LENGTH_LENGTH_Pos 2 /**< \brief (DSU_LENGTH) Length */ #define DSU_LENGTH_LENGTH_Msk (_U(0x3FFFFFFF) << DSU_LENGTH_LENGTH_Pos) #define DSU_LENGTH_LENGTH(value) (DSU_LENGTH_LENGTH_Msk & ((value) << DSU_LENGTH_LENGTH_Pos)) #define DSU_LENGTH_MASK _U(0xFFFFFFFC) /**< \brief (DSU_LENGTH) MASK Register */ /* -------- DSU_DATA : (DSU Offset: 0x000C) (R/W 32) Data -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t DATA:32; /*!< bit: 0..31 Data */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_DATA_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_DATA_OFFSET 0x000C /**< \brief (DSU_DATA offset) Data */ #define DSU_DATA_RESETVALUE _U(0x00000000) /**< \brief (DSU_DATA reset_value) Data */ #define DSU_DATA_DATA_Pos 0 /**< \brief (DSU_DATA) Data */ #define DSU_DATA_DATA_Msk (_U(0xFFFFFFFF) << DSU_DATA_DATA_Pos) #define DSU_DATA_DATA(value) (DSU_DATA_DATA_Msk & ((value) << DSU_DATA_DATA_Pos)) #define DSU_DATA_MASK _U(0xFFFFFFFF) /**< \brief (DSU_DATA) MASK Register */ /* -------- DSU_DCC : (DSU Offset: 0x0010) (R/W 32) Debug Communication Channel n -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t DATA:32; /*!< bit: 0..31 Data */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_DCC_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_DCC_OFFSET 0x0010 /**< \brief (DSU_DCC offset) Debug Communication Channel n */ #define DSU_DCC_RESETVALUE _U(0x00000000) /**< \brief (DSU_DCC reset_value) Debug Communication Channel n */ #define DSU_DCC_DATA_Pos 0 /**< \brief (DSU_DCC) Data */ #define DSU_DCC_DATA_Msk (_U(0xFFFFFFFF) << DSU_DCC_DATA_Pos) #define DSU_DCC_DATA(value) (DSU_DCC_DATA_Msk & ((value) << DSU_DCC_DATA_Pos)) #define DSU_DCC_MASK _U(0xFFFFFFFF) /**< \brief (DSU_DCC) MASK Register */ /* -------- DSU_DID : (DSU Offset: 0x0018) (R/ 32) Device Identification -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t DEVSEL:8; /*!< bit: 0.. 7 Device Select */ uint32_t REVISION:4; /*!< bit: 8..11 Revision */ uint32_t DIE:4; /*!< bit: 12..15 Die Identification */ uint32_t SERIES:6; /*!< bit: 16..21 Product Series */ uint32_t :1; /*!< bit: 22 Reserved */ uint32_t FAMILY:5; /*!< bit: 23..27 Product Family */ uint32_t PROCESSOR:4; /*!< bit: 28..31 Processor */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_DID_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_DID_OFFSET 0x0018 /**< \brief (DSU_DID offset) Device Identification */ #define DSU_DID_DEVSEL_Pos 0 /**< \brief (DSU_DID) Device Select */ #define DSU_DID_DEVSEL_Msk (_U(0xFF) << DSU_DID_DEVSEL_Pos) #define DSU_DID_DEVSEL(value) (DSU_DID_DEVSEL_Msk & ((value) << DSU_DID_DEVSEL_Pos)) #define DSU_DID_REVISION_Pos 8 /**< \brief (DSU_DID) Revision */ #define DSU_DID_REVISION_Msk (_U(0xF) << DSU_DID_REVISION_Pos) #define DSU_DID_REVISION(value) (DSU_DID_REVISION_Msk & ((value) << DSU_DID_REVISION_Pos)) #define DSU_DID_DIE_Pos 12 /**< \brief (DSU_DID) Die Identification */ #define DSU_DID_DIE_Msk (_U(0xF) << DSU_DID_DIE_Pos) #define DSU_DID_DIE(value) (DSU_DID_DIE_Msk & ((value) << DSU_DID_DIE_Pos)) #define DSU_DID_SERIES_Pos 16 /**< \brief (DSU_DID) Product Series */ #define DSU_DID_SERIES_Msk (_U(0x3F) << DSU_DID_SERIES_Pos) #define DSU_DID_SERIES(value) (DSU_DID_SERIES_Msk & ((value) << DSU_DID_SERIES_Pos)) #define DSU_DID_FAMILY_Pos 23 /**< \brief (DSU_DID) Product Family */ #define DSU_DID_FAMILY_Msk (_U(0x1F) << DSU_DID_FAMILY_Pos) #define DSU_DID_FAMILY(value) (DSU_DID_FAMILY_Msk & ((value) << DSU_DID_FAMILY_Pos)) #define DSU_DID_PROCESSOR_Pos 28 /**< \brief (DSU_DID) Processor */ #define DSU_DID_PROCESSOR_Msk (_U(0xF) << DSU_DID_PROCESSOR_Pos) #define DSU_DID_PROCESSOR(value) (DSU_DID_PROCESSOR_Msk & ((value) << DSU_DID_PROCESSOR_Pos)) #define DSU_DID_MASK _U(0xFFBFFFFF) /**< \brief (DSU_DID) MASK Register */ /* -------- DSU_ENTRY : (DSU Offset: 0x1000) (R/ 32) Coresight ROM Table Entry n -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t EPRES:1; /*!< bit: 0 Entry Present */ uint32_t FMT:1; /*!< bit: 1 Format */ uint32_t :10; /*!< bit: 2..11 Reserved */ uint32_t ADDOFF:20; /*!< bit: 12..31 Address Offset */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_ENTRY_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_ENTRY_OFFSET 0x1000 /**< \brief (DSU_ENTRY offset) Coresight ROM Table Entry n */ #define DSU_ENTRY_RESETVALUE _U(0x00000002) /**< \brief (DSU_ENTRY reset_value) Coresight ROM Table Entry n */ #define DSU_ENTRY_EPRES_Pos 0 /**< \brief (DSU_ENTRY) Entry Present */ #define DSU_ENTRY_EPRES (_U(0x1) << DSU_ENTRY_EPRES_Pos) #define DSU_ENTRY_FMT_Pos 1 /**< \brief (DSU_ENTRY) Format */ #define DSU_ENTRY_FMT (_U(0x1) << DSU_ENTRY_FMT_Pos) #define DSU_ENTRY_ADDOFF_Pos 12 /**< \brief (DSU_ENTRY) Address Offset */ #define DSU_ENTRY_ADDOFF_Msk (_U(0xFFFFF) << DSU_ENTRY_ADDOFF_Pos) #define DSU_ENTRY_ADDOFF(value) (DSU_ENTRY_ADDOFF_Msk & ((value) << DSU_ENTRY_ADDOFF_Pos)) #define DSU_ENTRY_MASK _U(0xFFFFF003) /**< \brief (DSU_ENTRY) MASK Register */ /* -------- DSU_END : (DSU Offset: 0x1008) (R/ 32) Coresight ROM Table End -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t END:32; /*!< bit: 0..31 End Marker */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_END_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_END_OFFSET 0x1008 /**< \brief (DSU_END offset) Coresight ROM Table End */ #define DSU_END_RESETVALUE _U(0x00000000) /**< \brief (DSU_END reset_value) Coresight ROM Table End */ #define DSU_END_END_Pos 0 /**< \brief (DSU_END) End Marker */ #define DSU_END_END_Msk (_U(0xFFFFFFFF) << DSU_END_END_Pos) #define DSU_END_END(value) (DSU_END_END_Msk & ((value) << DSU_END_END_Pos)) #define DSU_END_MASK _U(0xFFFFFFFF) /**< \brief (DSU_END) MASK Register */ /* -------- DSU_MEMTYPE : (DSU Offset: 0x1FCC) (R/ 32) Coresight ROM Table Memory Type -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t SMEMP:1; /*!< bit: 0 System Memory Present */ uint32_t :31; /*!< bit: 1..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_MEMTYPE_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_MEMTYPE_OFFSET 0x1FCC /**< \brief (DSU_MEMTYPE offset) Coresight ROM Table Memory Type */ #define DSU_MEMTYPE_RESETVALUE _U(0x00000000) /**< \brief (DSU_MEMTYPE reset_value) Coresight ROM Table Memory Type */ #define DSU_MEMTYPE_SMEMP_Pos 0 /**< \brief (DSU_MEMTYPE) System Memory Present */ #define DSU_MEMTYPE_SMEMP (_U(0x1) << DSU_MEMTYPE_SMEMP_Pos) #define DSU_MEMTYPE_MASK _U(0x00000001) /**< \brief (DSU_MEMTYPE) MASK Register */ /* -------- DSU_PID4 : (DSU Offset: 0x1FD0) (R/ 32) Peripheral Identification 4 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t JEPCC:4; /*!< bit: 0.. 3 JEP-106 Continuation Code */ uint32_t FKBC:4; /*!< bit: 4.. 7 4KB Count */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_PID4_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_PID4_OFFSET 0x1FD0 /**< \brief (DSU_PID4 offset) Peripheral Identification 4 */ #define DSU_PID4_RESETVALUE _U(0x00000000) /**< \brief (DSU_PID4 reset_value) Peripheral Identification 4 */ #define DSU_PID4_JEPCC_Pos 0 /**< \brief (DSU_PID4) JEP-106 Continuation Code */ #define DSU_PID4_JEPCC_Msk (_U(0xF) << DSU_PID4_JEPCC_Pos) #define DSU_PID4_JEPCC(value) (DSU_PID4_JEPCC_Msk & ((value) << DSU_PID4_JEPCC_Pos)) #define DSU_PID4_FKBC_Pos 4 /**< \brief (DSU_PID4) 4KB Count */ #define DSU_PID4_FKBC_Msk (_U(0xF) << DSU_PID4_FKBC_Pos) #define DSU_PID4_FKBC(value) (DSU_PID4_FKBC_Msk & ((value) << DSU_PID4_FKBC_Pos)) #define DSU_PID4_MASK _U(0x000000FF) /**< \brief (DSU_PID4) MASK Register */ /* -------- DSU_PID0 : (DSU Offset: 0x1FE0) (R/ 32) Peripheral Identification 0 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PARTNBL:8; /*!< bit: 0.. 7 Part Number Low */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_PID0_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_PID0_OFFSET 0x1FE0 /**< \brief (DSU_PID0 offset) Peripheral Identification 0 */ #define DSU_PID0_RESETVALUE _U(0x000000D0) /**< \brief (DSU_PID0 reset_value) Peripheral Identification 0 */ #define DSU_PID0_PARTNBL_Pos 0 /**< \brief (DSU_PID0) Part Number Low */ #define DSU_PID0_PARTNBL_Msk (_U(0xFF) << DSU_PID0_PARTNBL_Pos) #define DSU_PID0_PARTNBL(value) (DSU_PID0_PARTNBL_Msk & ((value) << DSU_PID0_PARTNBL_Pos)) #define DSU_PID0_MASK _U(0x000000FF) /**< \brief (DSU_PID0) MASK Register */ /* -------- DSU_PID1 : (DSU Offset: 0x1FE4) (R/ 32) Peripheral Identification 1 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PARTNBH:4; /*!< bit: 0.. 3 Part Number High */ uint32_t JEPIDCL:4; /*!< bit: 4.. 7 Low part of the JEP-106 Identity Code */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_PID1_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_PID1_OFFSET 0x1FE4 /**< \brief (DSU_PID1 offset) Peripheral Identification 1 */ #define DSU_PID1_RESETVALUE _U(0x000000FC) /**< \brief (DSU_PID1 reset_value) Peripheral Identification 1 */ #define DSU_PID1_PARTNBH_Pos 0 /**< \brief (DSU_PID1) Part Number High */ #define DSU_PID1_PARTNBH_Msk (_U(0xF) << DSU_PID1_PARTNBH_Pos) #define DSU_PID1_PARTNBH(value) (DSU_PID1_PARTNBH_Msk & ((value) << DSU_PID1_PARTNBH_Pos)) #define DSU_PID1_JEPIDCL_Pos 4 /**< \brief (DSU_PID1) Low part of the JEP-106 Identity Code */ #define DSU_PID1_JEPIDCL_Msk (_U(0xF) << DSU_PID1_JEPIDCL_Pos) #define DSU_PID1_JEPIDCL(value) (DSU_PID1_JEPIDCL_Msk & ((value) << DSU_PID1_JEPIDCL_Pos)) #define DSU_PID1_MASK _U(0x000000FF) /**< \brief (DSU_PID1) MASK Register */ /* -------- DSU_PID2 : (DSU Offset: 0x1FE8) (R/ 32) Peripheral Identification 2 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t JEPIDCH:3; /*!< bit: 0.. 2 JEP-106 Identity Code High */ uint32_t JEPU:1; /*!< bit: 3 JEP-106 Identity Code is used */ uint32_t REVISION:4; /*!< bit: 4.. 7 Revision Number */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_PID2_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_PID2_OFFSET 0x1FE8 /**< \brief (DSU_PID2 offset) Peripheral Identification 2 */ #define DSU_PID2_RESETVALUE _U(0x00000009) /**< \brief (DSU_PID2 reset_value) Peripheral Identification 2 */ #define DSU_PID2_JEPIDCH_Pos 0 /**< \brief (DSU_PID2) JEP-106 Identity Code High */ #define DSU_PID2_JEPIDCH_Msk (_U(0x7) << DSU_PID2_JEPIDCH_Pos) #define DSU_PID2_JEPIDCH(value) (DSU_PID2_JEPIDCH_Msk & ((value) << DSU_PID2_JEPIDCH_Pos)) #define DSU_PID2_JEPU_Pos 3 /**< \brief (DSU_PID2) JEP-106 Identity Code is used */ #define DSU_PID2_JEPU (_U(0x1) << DSU_PID2_JEPU_Pos) #define DSU_PID2_REVISION_Pos 4 /**< \brief (DSU_PID2) Revision Number */ #define DSU_PID2_REVISION_Msk (_U(0xF) << DSU_PID2_REVISION_Pos) #define DSU_PID2_REVISION(value) (DSU_PID2_REVISION_Msk & ((value) << DSU_PID2_REVISION_Pos)) #define DSU_PID2_MASK _U(0x000000FF) /**< \brief (DSU_PID2) MASK Register */ /* -------- DSU_PID3 : (DSU Offset: 0x1FEC) (R/ 32) Peripheral Identification 3 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t CUSMOD:4; /*!< bit: 0.. 3 ARM CUSMOD */ uint32_t REVAND:4; /*!< bit: 4.. 7 Revision Number */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_PID3_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_PID3_OFFSET 0x1FEC /**< \brief (DSU_PID3 offset) Peripheral Identification 3 */ #define DSU_PID3_RESETVALUE _U(0x00000000) /**< \brief (DSU_PID3 reset_value) Peripheral Identification 3 */ #define DSU_PID3_CUSMOD_Pos 0 /**< \brief (DSU_PID3) ARM CUSMOD */ #define DSU_PID3_CUSMOD_Msk (_U(0xF) << DSU_PID3_CUSMOD_Pos) #define DSU_PID3_CUSMOD(value) (DSU_PID3_CUSMOD_Msk & ((value) << DSU_PID3_CUSMOD_Pos)) #define DSU_PID3_REVAND_Pos 4 /**< \brief (DSU_PID3) Revision Number */ #define DSU_PID3_REVAND_Msk (_U(0xF) << DSU_PID3_REVAND_Pos) #define DSU_PID3_REVAND(value) (DSU_PID3_REVAND_Msk & ((value) << DSU_PID3_REVAND_Pos)) #define DSU_PID3_MASK _U(0x000000FF) /**< \brief (DSU_PID3) MASK Register */ /* -------- DSU_CID0 : (DSU Offset: 0x1FF0) (R/ 32) Component Identification 0 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PREAMBLEB0:8; /*!< bit: 0.. 7 Preamble Byte 0 */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_CID0_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_CID0_OFFSET 0x1FF0 /**< \brief (DSU_CID0 offset) Component Identification 0 */ #define DSU_CID0_RESETVALUE _U(0x0000000D) /**< \brief (DSU_CID0 reset_value) Component Identification 0 */ #define DSU_CID0_PREAMBLEB0_Pos 0 /**< \brief (DSU_CID0) Preamble Byte 0 */ #define DSU_CID0_PREAMBLEB0_Msk (_U(0xFF) << DSU_CID0_PREAMBLEB0_Pos) #define DSU_CID0_PREAMBLEB0(value) (DSU_CID0_PREAMBLEB0_Msk & ((value) << DSU_CID0_PREAMBLEB0_Pos)) #define DSU_CID0_MASK _U(0x000000FF) /**< \brief (DSU_CID0) MASK Register */ /* -------- DSU_CID1 : (DSU Offset: 0x1FF4) (R/ 32) Component Identification 1 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PREAMBLE:4; /*!< bit: 0.. 3 Preamble */ uint32_t CCLASS:4; /*!< bit: 4.. 7 Component Class */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_CID1_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_CID1_OFFSET 0x1FF4 /**< \brief (DSU_CID1 offset) Component Identification 1 */ #define DSU_CID1_RESETVALUE _U(0x00000010) /**< \brief (DSU_CID1 reset_value) Component Identification 1 */ #define DSU_CID1_PREAMBLE_Pos 0 /**< \brief (DSU_CID1) Preamble */ #define DSU_CID1_PREAMBLE_Msk (_U(0xF) << DSU_CID1_PREAMBLE_Pos) #define DSU_CID1_PREAMBLE(value) (DSU_CID1_PREAMBLE_Msk & ((value) << DSU_CID1_PREAMBLE_Pos)) #define DSU_CID1_CCLASS_Pos 4 /**< \brief (DSU_CID1) Component Class */ #define DSU_CID1_CCLASS_Msk (_U(0xF) << DSU_CID1_CCLASS_Pos) #define DSU_CID1_CCLASS(value) (DSU_CID1_CCLASS_Msk & ((value) << DSU_CID1_CCLASS_Pos)) #define DSU_CID1_MASK _U(0x000000FF) /**< \brief (DSU_CID1) MASK Register */ /* -------- DSU_CID2 : (DSU Offset: 0x1FF8) (R/ 32) Component Identification 2 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PREAMBLEB2:8; /*!< bit: 0.. 7 Preamble Byte 2 */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_CID2_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_CID2_OFFSET 0x1FF8 /**< \brief (DSU_CID2 offset) Component Identification 2 */ #define DSU_CID2_RESETVALUE _U(0x00000005) /**< \brief (DSU_CID2 reset_value) Component Identification 2 */ #define DSU_CID2_PREAMBLEB2_Pos 0 /**< \brief (DSU_CID2) Preamble Byte 2 */ #define DSU_CID2_PREAMBLEB2_Msk (_U(0xFF) << DSU_CID2_PREAMBLEB2_Pos) #define DSU_CID2_PREAMBLEB2(value) (DSU_CID2_PREAMBLEB2_Msk & ((value) << DSU_CID2_PREAMBLEB2_Pos)) #define DSU_CID2_MASK _U(0x000000FF) /**< \brief (DSU_CID2) MASK Register */ /* -------- DSU_CID3 : (DSU Offset: 0x1FFC) (R/ 32) Component Identification 3 -------- */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef union { struct { uint32_t PREAMBLEB3:8; /*!< bit: 0.. 7 Preamble Byte 3 */ uint32_t :24; /*!< bit: 8..31 Reserved */ } bit; /*!< Structure used for bit access */ uint32_t reg; /*!< Type used for register access */ } DSU_CID3_Type; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ #define DSU_CID3_OFFSET 0x1FFC /**< \brief (DSU_CID3 offset) Component Identification 3 */ #define DSU_CID3_RESETVALUE _U(0x000000B1) /**< \brief (DSU_CID3 reset_value) Component Identification 3 */ #define DSU_CID3_PREAMBLEB3_Pos 0 /**< \brief (DSU_CID3) Preamble Byte 3 */ #define DSU_CID3_PREAMBLEB3_Msk (_U(0xFF) << DSU_CID3_PREAMBLEB3_Pos) #define DSU_CID3_PREAMBLEB3(value) (DSU_CID3_PREAMBLEB3_Msk & ((value) << DSU_CID3_PREAMBLEB3_Pos)) #define DSU_CID3_MASK _U(0x000000FF) /**< \brief (DSU_CID3) MASK Register */ /** \brief DSU hardware registers */ #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) typedef struct { __O DSU_CTRL_Type CTRL; /**< \brief Offset: 0x0000 ( /W 8) Control */ __IO DSU_STATUSA_Type STATUSA; /**< \brief Offset: 0x0001 (R/W 8) Status A */ __I DSU_STATUSB_Type STATUSB; /**< \brief Offset: 0x0002 (R/ 8) Status B */ RoReg8 Reserved1[0x1]; __IO DSU_ADDR_Type ADDR; /**< \brief Offset: 0x0004 (R/W 32) Address */ __IO DSU_LENGTH_Type LENGTH; /**< \brief Offset: 0x0008 (R/W 32) Length */ __IO DSU_DATA_Type DATA; /**< \brief Offset: 0x000C (R/W 32) Data */ __IO DSU_DCC_Type DCC[2]; /**< \brief Offset: 0x0010 (R/W 32) Debug Communication Channel n */ __I DSU_DID_Type DID; /**< \brief Offset: 0x0018 (R/ 32) Device Identification */ RoReg8 Reserved2[0xFE4]; __I DSU_ENTRY_Type ENTRY[2]; /**< \brief Offset: 0x1000 (R/ 32) Coresight ROM Table Entry n */ __I DSU_END_Type END; /**< \brief Offset: 0x1008 (R/ 32) Coresight ROM Table End */ RoReg8 Reserved3[0xFC0]; __I DSU_MEMTYPE_Type MEMTYPE; /**< \brief Offset: 0x1FCC (R/ 32) Coresight ROM Table Memory Type */ __I DSU_PID4_Type PID4; /**< \brief Offset: 0x1FD0 (R/ 32) Peripheral Identification 4 */ RoReg8 Reserved4[0xC]; __I DSU_PID0_Type PID0; /**< \brief Offset: 0x1FE0 (R/ 32) Peripheral Identification 0 */ __I DSU_PID1_Type PID1; /**< \brief Offset: 0x1FE4 (R/ 32) Peripheral Identification 1 */ __I DSU_PID2_Type PID2; /**< \brief Offset: 0x1FE8 (R/ 32) Peripheral Identification 2 */ __I DSU_PID3_Type PID3; /**< \brief Offset: 0x1FEC (R/ 32) Peripheral Identification 3 */ __I DSU_CID0_Type CID0; /**< \brief Offset: 0x1FF0 (R/ 32) Component Identification 0 */ __I DSU_CID1_Type CID1; /**< \brief Offset: 0x1FF4 (R/ 32) Component Identification 1 */ __I DSU_CID2_Type CID2; /**< \brief Offset: 0x1FF8 (R/ 32) Component Identification 2 */ __I DSU_CID3_Type CID3; /**< \brief Offset: 0x1FFC (R/ 32) Component Identification 3 */ } Dsu; #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ /*@}*/ #endif /* _SAMD21_DSU_COMPONENT_ */
[ "joaofl@gmail.com" ]
joaofl@gmail.com
6e4b62fc82e9d7f43ce043d45c270328142a1c71
dec6419e67295954f5c526d9631685d9d8499342
/src/xoip_messages.c
7d8d11f458027296451ce911469b4db64fdc59bf
[]
no_license
vassilux/xoip2
23029e19221f98fbb24368259ba0770541cdb8e2
4893d31a9dbad1fc585b515c3a371ce59f752180
refs/heads/master
2021-01-01T05:49:33.621000
2014-08-21T14:12:06
2014-08-21T14:12:06
null
0
0
null
null
null
null
UTF-8
C
false
false
10,909
c
/* * XoIP -- telephony toolkit. * * Copyright (C) <2014>, <vassilux> * * <Vassili Gontcharov> <v.gontcharov@gmail.com> * */ /*! \file * * \brief Xoipeton application * * \author\verbatim <Vassili Gontcharov> <vassili.gontcharov@esifrance.net> \endverbatim * * This is a Xoip for development of an Asterisk application * \ingroup applications */ /*** MODULEINFO <defaultenabled>no</defaultenabled> <support_level>core</support_level> ***/ #include <stdio.h> #include <stdlib.h> #include "asterisk.h" #include "asterisk/logger.h" //#include "asterisk/astmm.h" #include "xoip_messages.h" int do_process_message (const char *buf, int size, struct f1_messages_handlers *handlers); static void do_process_message_fa(int track, int callref, char *code, struct f1_messages_handlers *handlers) { if(code == NULL){ return; } if(code[0] == 'M'){ handlers->mute_micro_operator(track, callref, true); }else if(code[0] == 'N'){ handlers->mute_micro_operator(track, callref, false); } } /*! * \brief Intiaialize the emmessions configuration for the given communication. * * \param track The track number. * \param callref The call reference. * \param messages The string array of parameters. * \param handlers The pointer to the wrapper of the app_xoip functions. */ static void do_process_message_fc(int track, int callref, char messages[10][255], struct f1_messages_handlers *handlers) { char *emmission_type = messages[3]; int dtmf_duration = 0; int silence_duration = 0; int loudness = 0; if(emmission_type != NULL &&(strcmp(emmission_type, "DTMF") == 0)){ if(messages[4] != NULL){ /* * pay an attention cause the F1 send packege without , between DTMF * and duration */ dtmf_duration = atoi(messages[4] + 4); // move 4 to skip DTMF string } if(messages[5] != NULL){ silence_duration = atoi(messages[5]); } if(messages[6] != NULL){ loudness = atoi(messages[6]); } } } /*! * \brief Send the frequencies to th] channel identified by the given track and callref */ static void do_process_message_ff(int track, int callref, char messages[10][255], struct f1_messages_handlers *handlers) { int freq; int duration; int level; char *mode = NULL; char *break_record; if(messages[3] != NULL){ freq = atoi(messages[3]); } if(messages[4] != NULL){ duration = atoi(messages[4]); } if(messages[5] != NULL){ level = atoi(messages[5]); } mode = messages[6]; break_record = messages[6]; handlers->send_freq(track, callref, freq, duration, level, mode, break_record); } /*! * \brief Process FL message. Send data to the channel identificated by the given track and callref */ static void do_process_message_fl(int track, int callref, char messages[10][255], struct f1_messages_handlers *handlers) { int mode_transfer; char *data; char *mode_operator = NULL; char *break_record; if(messages[3] != NULL){ mode_transfer = atoi(messages[3]); } data = messages[4]; mode_operator = messages[5]; break_record = messages[6]; handlers->send_data(track, callref, mode_transfer, data, mode_operator, break_record); } /*! * */ int do_process_message (const char *buf, int size, struct f1_messages_handlers *handlers) { int res = 0; char *buffer = strdup (buf); const char *sep = ","; char messages[10][255] = { '\0' }; int count = 0; ast_verb(5, "Get packet from f1 endpoint : [%s\n]", buffer); char *token = NULL; for (token = strtok (buffer, sep); token; token = strtok (NULL, sep)) { if (token != NULL) { strcpy (messages[count], token); count++; } } char type = messages[0][2]; /* this is special case for ithe polling and mode request messages */ if(messages[0][0] == 'R' && type == 'S'){ handlers->request_reboot(); goto goout; }else if(type == 'N'){ /* skip this one */ handlers->request_mode_normal(); goto goout; }else if(messages[0][0]== 'V' && type == 'R'){ goto goout; }else if(type == 'P'){ ast_verb(5, "Get polling [%s].\n", messages[3]); handlers->polling(messages[3]); goto goout; } int track = atoi (messages[1]); long callref = 0; sscanf(messages[2], "%04X", &callref); /* so far sor good */ switch (type) { case 'A': do_process_message_fa(track, callref, messages[3], handlers); break; case 'C': do_process_message_fc(track, callref, messages, handlers); break; case 'F': do_process_message_ff(track, callref, messages, handlers); break; case 'G': { char proto = messages[3][0]; int level = 0; if (messages[4] != NULL) { level = atoi (messages[4]); } handlers->answer (track, callref, proto, level); } break; case 'H': { char *callee = messages[3]; char *caller = messages[4]; char *volum = messages[5]; handlers->commut (track, callref, callee, caller, volum); } break; case 'I': { char proto = messages[3][0]; int loudness = 0; if(messages[4] != NULL){ loudness = atoi(messages[4]); } handlers->switch_protocol(track, callref, proto, loudness); } break; case 'K': handlers->ack_alarm(track, callref); break; case 'L': do_process_message_fl(track, callref, messages, handlers); break; case 'M': { int record_track = 0; if(messages[3] != NULL){ record_track = atoi(messages[4]); } handlers->record_request(track, callref, record_track); } break; case 'r': case 'R': //ast_log(AST_LOG_VERBOSE, " Processing R.\n"); handlers->hangup (track, callref); break; case 'V': { int volume; if(messages[3] != NULL){ volume = atoi(messages[3]); } handlers->volume_adjust(track, callref, volume); } break; case 'W': handlers->queuing_call(track, callref, messages[3]); break; case 'U': break; default: ast_log (AST_LOG_VERBOSE, " Processing but type not found : [%c]..\n", buf); break; } goto goout; goout: res = size; free (buffer); return res; } /*! * */ int xoip_build_XC_msg (int voie, int callref, const char *did, const char *caller, const char *transfered, char *dest, int size) { snprintf (dest, size - 1, "X C,%02d,%04X,%s,%s,T%s\r", voie, callref, did, caller, transfered); if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_Xg_msg (int voie, int callref, int state, int res, char *dest, int size) { if(res != 0){ snprintf (dest, size - 1, "X g,%02d,%04X,1,%01d\r", voie, callref, res); }else{ snprintf (dest, size - 1, "X g,%02d,%04X,%d\r", voie, callref,state); } if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_XL_msg (int voie, int callref, int res, char *dest, int size) { if(res != 0){ snprintf (dest, size - 1, "X L,%02d,%04X,1,%01d\r", voie, callref, res); }else{ snprintf (dest, size - 1, "X L,%02d,%04d\r", voie, callref); } if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_Xm_msg(int voie, int callref, int state, int res, char *dest, int size) { if(res != 0){ snprintf (dest, size - 1, "X m,%02d,%04X,1,%01d\r", voie, callref, res); }else{ snprintf (dest, size - 1, "X m,%02d,%04d\r", voie, callref); } if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_XE_msg(int status, char *dest, int size) { snprintf (dest, size - 1, "X E,%01d,%s\r", status, "XoIP Alarms-V0.2.0.80,Dem V0000,Mod V0000"); if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_Xr_msg (int voie, int callref, char *dest, int size) { snprintf (dest, size, "X r,%02d,%04d\r", voie, callref); return 0; } /*! * */ int xoip_build_Xh_msg (int voie, int callref, int state, const char *callee, char *dest, int size) { snprintf (dest, size, "X h,%02d,%04X,%01d,%s\r", voie, callref, state, callee); return 0; } /*! * */ int xoip_build_Xi_msg(int voie, int callref, int state, int res, char *dest, int size) { snprintf (dest, size - 1, "X i,%02d,%04X,%01d,%01d\r", voie, callref, state, res); if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_Xk_msg(int voie, int callref, int state, int res, char *dest, int size) { snprintf (dest, size - 1, "X k,%02d,%04X,%01d,%01d\r", voie, callref, state, res); if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_Xf_msg (int voie, int callref, int state, int res, char *dest, int size) { snprintf (dest, size - 1, "X f,%02d,%04X,%01d,%01d\r", voie, callref, state, res); if(strlen(dest) == 0){ return -1; } return 0; } /*! * */ int xoip_build_XA_msg (int voie, int callref, const char *data, char *dest, int size) { snprintf (dest, size, "X A,%02d,%04X,%s\r", voie, callref, data); return 0; } /*! * \brief Build X w message. * The response for f1 F W request : qeueuing a call */ int xoip_build_Xw_msg(int voie, int callref, int res, char *dest, int size) { snprintf (dest, size - 1, "X w,%02d,%04X,%01d\r", voie, callref, res); if(strlen(dest) == 0){ return -1; } return 0; } /*! * \brief Parsing message from the given buffer. * Buffer can content few messges * * \param buf messages buffer * \param size the length of the buffer * \params handlers the structur of callback for each type of message * * \retval -1 on error * \retval > 0 the lenth of processing messages */ int process_message (const char *buf, int size, struct f1_messages_handlers *handlers) { int res = 0; int i = 0; int count = 0; char *buffer = strdup (buf); const char *sep = "\r"; char *token = NULL; /* must be changed */ char messages[10][255] = { '\0' }; for (token = strtok (buffer, sep); token; token = strtok (NULL, sep)) { strcpy (messages[count], token); count++; } res = 0; for (i = 0; i < count; i++) { /* increment by the token length */ res += do_process_message (messages[i], strlen (messages[i]), handlers); } /* add to the result the number of tokens. May be addt length(sep) can be good idea */ res += count; free (buffer); return res; }
[ "v.gontcharov@gmail.com" ]
v.gontcharov@gmail.com
26f23f68c2d65c91dbf7731ee589f62a41d27d8a
7da6ed1e31f4dd92d923cc867f21b33a74e0ebc1
/src/createregion.c
4743ff3cf0a3b2c59883d6f6f024f8bc1946adb9
[]
no_license
freudshow/practice
2f672a460ea9d61135b6ac26919fdd3d9fab5224
6801ea586c5db2f30a268040f3390e303cf0fb89
refs/heads/master
2021-07-05T00:47:14.143000
2021-06-09T06:03:17
2021-06-09T06:03:17
90,633,429
0
2
null
null
null
null
UTF-8
C
false
false
159
c
#include "shm.h" int rand(void); int rand_r(unsigned int *seedp); void srand(unsigned int seed); int main() { init_sem_set(); init_region(); exit(0); }
[ "s_baoshan@163.com" ]
s_baoshan@163.com
f8a07ef6a3923daba641e7ac3c0fd7ad2ecbfc87
1fabbdfd1ca9ea1b6808893e12bd907eb74de414
/xcode/Classes/Native/AssemblyU2DCSharp_SPacket_SocketInstance_GC_SYNC_REACHEDSCENMethodDeclarations.h
cc71e70250fd75fada95620a65e6af4003c60645
[]
no_license
Klanly/TutorialPackageClient
6f889e96c40ab13c97d107708ae8f3c71a484301
b9d61ba2f287c491c9565b432f852980ec3fee28
refs/heads/master
2020-12-03T01:42:35.256000
2016-11-01T02:40:21
2016-11-01T02:40:21
null
0
0
null
null
null
null
UTF-8
C
false
false
743
h
#pragma once #include <stdint.h> #include <assert.h> #include <exception> #include "codegen/il2cpp-codegen.h" // SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler struct GC_SYNC_REACHEDSCENEHandler_t2847; // PacketDistributed struct PacketDistributed_t2209; // System.Void SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler::.ctor() void GC_SYNC_REACHEDSCENEHandler__ctor_m16033 (GC_SYNC_REACHEDSCENEHandler_t2847 * __this, MethodInfo* method) IL2CPP_METHOD_ATTR; // System.UInt32 SPacket.SocketInstance.GC_SYNC_REACHEDSCENEHandler::Execute(PacketDistributed) uint32_t GC_SYNC_REACHEDSCENEHandler_Execute_m16034 (GC_SYNC_REACHEDSCENEHandler_t2847 * __this, PacketDistributed_t2209 * ___ipacket, MethodInfo* method) IL2CPP_METHOD_ATTR;
[ "bu213200@gmail.com" ]
bu213200@gmail.com
8b39fe097d9a0ad75f4e8e176acbcd3e9e6ce47c
5c255f911786e984286b1f7a4e6091a68419d049
/code/24fbc88b-b066-449c-ae5b-a5acd378d8ab.c
6c6cfa7dc48bd7868bbeecf6b19c39cd6bf27ae4
[]
no_license
nmharmon8/Deep-Buffer-Overflow-Detection
70fe02c8dc75d12e91f5bc4468cf260e490af1a4
e0c86210c86afb07c8d4abcc957c7f1b252b4eb2
refs/heads/master
2021-09-11T19:09:59.944000
2018-04-06T16:26:34
2018-04-06T16:26:34
125,521,331
0
0
null
null
null
null
UTF-8
C
false
false
217
c
#include <stdio.h> int main() { int i=0; int j=14; int k; int l; k = 53; l = 64; k = i/j; l = i/j; l = l/j; l = k-j*i; printf("vulnerability"); printf("%d%d\n",l,l); return 0; }
[ "nharmon8@gmail.com" ]
nharmon8@gmail.com
00b89f8c82ebde7fba9cca6124b9592cc534c8af
a0d6b2c2dd8bcbe03e5c6fb35f766bd2af9a1d5c
/dynix.3.2.0/src/ucb/tftp/main.c
a7f804e9f48afbb7a6089aad2297032b45976d5f
[]
no_license
legacy-codedigger/Dynix.3.2.Source
593485f234eee4de75c0e23fe689f247471c83f8
2789373c94bc57e4c4a915bcba354f2243e12ca4
refs/heads/master
2022-04-25T22:49:00.493000
2020-04-25T00:49:59
2020-04-25T00:49:59
258,656,640
0
0
null
null
null
null
UTF-8
C
false
false
13,184
c
/* $Copyright: $ * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 * Sequent Computer Systems, Inc. All rights reserved. * * This software is furnished under a license and may be used * only in accordance with the terms of that license and with the * inclusion of the above copyright notice. This software may not * be provided or otherwise made available to, or used by, any * other person. No title to or ownership of the software is * hereby transferred. */ #ifndef lint static char rcsid[] = "$Header: main.c 2.3 90/04/05 $"; #endif /* * Copyright (c) 1983 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the University of California, Berkeley. The name of the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef lint char copyright[] = "@(#) Copyright (c) 1983 Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)main.c 5.7 (Berkeley) 6/29/88"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ /* * TFTP User Program -- Command Interface. */ #include <sys/types.h> #include <sys/socket.h> #include <sys/file.h> #include <netinet/in.h> #include <signal.h> #include <stdio.h> #include <errno.h> #include <setjmp.h> #include <ctype.h> #include <netdb.h> #define TIMEOUT 5 /* secs between rexmt's */ struct sockaddr_in sin; int f; short port; int trace; int verbose; int connected; char mode[32]; char line[200]; int margc; char *margv[20]; char *prompt = "tftp"; jmp_buf toplevel; int intr(); struct servent *sp; int quit(), help(), setverbose(), settrace(), status(); int get(), put(), setpeer(), modecmd(), setrexmt(), settimeout(); int setbinary(), setascii(); #define HELPINDENT (sizeof("connect")) struct cmd { char *name; char *help; int (*handler)(); }; char vhelp[] = "toggle verbose mode"; char thelp[] = "toggle packet tracing"; char chelp[] = "connect to remote tftp"; char qhelp[] = "exit tftp"; char hhelp[] = "print help information"; char shelp[] = "send file"; char rhelp[] = "receive file"; char mhelp[] = "set file transfer mode"; char sthelp[] = "show current status"; char xhelp[] = "set per-packet retransmission timeout"; char ihelp[] = "set total retransmission timeout"; char ashelp[] = "set mode to netascii"; char bnhelp[] = "set mode to octet"; struct cmd cmdtab[] = { { "connect", chelp, setpeer }, { "mode", mhelp, modecmd }, { "put", shelp, put }, { "get", rhelp, get }, { "quit", qhelp, quit }, { "verbose", vhelp, setverbose }, { "trace", thelp, settrace }, { "status", sthelp, status }, { "binary", bnhelp, setbinary }, { "ascii", ashelp, setascii }, { "rexmt", xhelp, setrexmt }, { "timeout", ihelp, settimeout }, { "?", hhelp, help }, 0 }; struct cmd *getcmd(); char *tail(); char *index(); char *rindex(); main(argc, argv) char *argv[]; { struct sockaddr_in sin; int top; sp = getservbyname("tftp", "udp"); if (sp == 0) { fprintf(stderr, "tftp: udp/tftp: unknown service\n"); exit(1); } f = socket(AF_INET, SOCK_DGRAM, 0); if (f < 0) { perror("tftp: socket"); exit(3); } bzero((char *)&sin, sizeof (sin)); sin.sin_family = AF_INET; if (bind(f, &sin, sizeof (sin)) < 0) { perror("tftp: bind"); exit(1); } strcpy(mode, "netascii"); signal(SIGINT, intr); if (argc > 1) { if (setjmp(toplevel) != 0) exit(0); setpeer(argc, argv); } top = setjmp(toplevel) == 0; for (;;) command(top); } char hostname[100]; setpeer(argc, argv) int argc; char *argv[]; { struct hostent *host; if (argc < 2) { strcpy(line, "Connect "); printf("(to) "); gets(&line[strlen(line)]); makeargv(); argc = margc; argv = margv; } if (argc > 3) { printf("usage: %s host-name [port]\n", argv[0]); return; } host = gethostbyname(argv[1]); if (host) { sin.sin_family = host->h_addrtype; bcopy(host->h_addr, &sin.sin_addr, host->h_length); strcpy(hostname, host->h_name); } else { sin.sin_family = AF_INET; sin.sin_addr.s_addr = inet_addr(argv[1]); if (sin.sin_addr.s_addr == -1) { connected = 0; printf("%s: unknown host\n", argv[1]); return; } strcpy(hostname, argv[1]); } port = sp->s_port; if (argc == 3) { port = atoi(argv[2]); if (port < 0) { printf("%s: bad port number\n", argv[2]); connected = 0; return; } port = htons(port); } connected = 1; } struct modes { char *m_name; char *m_mode; } modes[] = { { "ascii", "netascii" }, { "netascii", "netascii" }, { "binary", "octet" }, { "image", "octet" }, { "octet", "octet" }, /* { "mail", "mail" }, */ { 0, 0 } }; modecmd(argc, argv) char *argv[]; { register struct modes *p; char *sep; if (argc < 2) { printf("Using %s mode to transfer files.\n", mode); return; } if (argc == 2) { for (p = modes; p->m_name; p++) if (strcmp(argv[1], p->m_name) == 0) break; if (p->m_name) { setmode(p->m_mode); return; } printf("%s: unknown mode\n", argv[1]); /* drop through and print usage message */ } printf("usage: %s [", argv[0]); sep = " "; for (p = modes; p->m_name; p++) { printf("%s%s", sep, p->m_name); if (*sep == ' ') sep = " | "; } printf(" ]\n"); return; } setbinary(argc, argv) char *argv[]; { setmode("octet"); } setascii(argc, argv) char *argv[]; { setmode("netascii"); } setmode(newmode) char *newmode; { strcpy(mode, newmode); if (verbose) printf("mode set to %s\n", mode); } /* * Send file(s). */ put(argc, argv) char *argv[]; { int fd; register int n; register char *cp, *targ; if (argc < 2) { strcpy(line, "send "); printf("(file) "); gets(&line[strlen(line)]); makeargv(); argc = margc; argv = margv; } if (argc < 2) { putusage(argv[0]); return; } targ = argv[argc - 1]; if (index(argv[argc - 1], ':')) { char *cp; struct hostent *hp; for (n = 1; n < argc - 1; n++) if (index(argv[n], ':')) { putusage(argv[0]); return; } cp = argv[argc - 1]; targ = index(cp, ':'); *targ++ = 0; hp = gethostbyname(cp); if (hp == 0) { printf("%s: Unknown host.\n", cp); return; } bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); sin.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); port = sp->s_port; } if (!connected) { printf("No target machine specified.\n"); return; } if (argc < 4) { cp = argc == 2 ? tail(targ) : argv[1]; fd = open(cp, O_RDONLY); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); return; } if (verbose) printf("putting %s to %s:%s [%s]\n", cp, hostname, targ, mode); sin.sin_port = port; sendfile(fd, targ, mode); return; } /* this assumes the target is a directory */ /* on a remote unix system. hmmmm. */ cp = index(targ, '\0'); *cp++ = '/'; for (n = 1; n < argc - 1; n++) { strcpy(cp, tail(argv[n])); fd = open(argv[n], O_RDONLY); if (fd < 0) { fprintf(stderr, "tftp: "); perror(argv[n]); continue; } if (verbose) printf("putting %s to %s:%s [%s]\n", argv[n], hostname, targ, mode); sin.sin_port = port; sendfile(fd, targ, mode); } } putusage(s) char *s; { printf("usage: %s file ... host:target, or\n", s); printf(" %s file ... target (when already connected)\n", s); } /* * Receive file(s). */ get(argc, argv) char *argv[]; { int fd; register int n; register char *cp; char *src; if (argc < 2) { strcpy(line, "get "); printf("(files) "); gets(&line[strlen(line)]); makeargv(); argc = margc; argv = margv; } if (argc < 2) { getusage(argv[0]); return; } if (!connected) { for (n = 1; n < (argc - 1); n++) if (index(argv[n], ':') == 0) { getusage(argv[0]); return; } } for (n = 1; n < argc ; n++) { src = index(argv[n], ':'); if (src == NULL) src = argv[n]; else { struct hostent *hp; *src++ = 0; hp = gethostbyname(argv[n]); if (hp == 0) { printf("%s: Unknown host.\n", argv[n]); continue; } bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); sin.sin_family = hp->h_addrtype; connected = 1; strcpy(hostname, hp->h_name); port = sp->s_port; } if (argc < 4) { cp = argc == 3 ? argv[2] : tail(src); fd = creat(cp, 0644); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); return; } if (verbose) printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); sin.sin_port = port; recvfile(fd, src, mode); break; } cp = tail(src); /* new .. jdg */ fd = creat(cp, 0644); if (fd < 0) { fprintf(stderr, "tftp: "); perror(cp); continue; } if (verbose) printf("getting from %s:%s to %s [%s]\n", hostname, src, cp, mode); sin.sin_port = port; recvfile(fd, src, mode); } } getusage(s) char * s; { printf("usage: %s host:file host:file ... file, or\n", s); printf(" %s file file ... file if connected\n", s); } int rexmtval = TIMEOUT; setrexmt(argc, argv) char *argv[]; { int t; if (argc < 2) { strcpy(line, "Rexmt-timeout "); printf("(value) "); gets(&line[strlen(line)]); makeargv(); argc = margc; argv = margv; } if (argc != 2) { printf("usage: %s value\n", argv[0]); return; } t = atoi(argv[1]); if (t < 0) printf("%s: bad value\n", t); else rexmtval = t; } int maxtimeout = 5 * TIMEOUT; settimeout(argc, argv) char *argv[]; { int t; if (argc < 2) { strcpy(line, "Maximum-timeout "); printf("(value) "); gets(&line[strlen(line)]); makeargv(); argc = margc; argv = margv; } if (argc != 2) { printf("usage: %s value\n", argv[0]); return; } t = atoi(argv[1]); if (t < 0) printf("%s: bad value\n", t); else maxtimeout = t; } status(argc, argv) char *argv[]; { if (connected) printf("Connected to %s.\n", hostname); else printf("Not connected.\n"); printf("Mode: %s Verbose: %s Tracing: %s\n", mode, verbose ? "on" : "off", trace ? "on" : "off"); printf("Rexmt-interval: %d seconds, Max-timeout: %d seconds\n", rexmtval, maxtimeout); } intr() { signal(SIGALRM, SIG_IGN); alarm(0); longjmp(toplevel, -1); } char * tail(filename) char *filename; { register char *s; while (*filename) { s = rindex(filename, '/'); if (s == NULL) break; if (s[1]) return (s + 1); *s = '\0'; } return (filename); } /* * Command parser. */ command(top) int top; { register struct cmd *c; if (!top) putchar('\n'); for (;;) { printf("%s> ", prompt); if (gets(line) == 0) { if (feof(stdin)) { quit(); } else { continue; } } if (line[0] == 0) continue; makeargv(); c = getcmd(margv[0]); if (c == (struct cmd *)-1) { printf("?Ambiguous command\n"); continue; } if (c == 0) { printf("?Invalid command\n"); continue; } (*c->handler)(margc, margv); } } struct cmd * getcmd(name) register char *name; { register char *p, *q; register struct cmd *c, *found; register int nmatches, longest; longest = 0; nmatches = 0; found = 0; for (c = cmdtab; p = c->name; c++) { for (q = name; *q == *p++; q++) if (*q == 0) /* exact match? */ return (c); if (!*q) { /* the name was a prefix */ if (q - name > longest) { longest = q - name; nmatches = 1; found = c; } else if (q - name == longest) nmatches++; } } if (nmatches > 1) return ((struct cmd *)-1); return (found); } /* * Slice a string up into argc/argv. */ makeargv() { register char *cp; register char **argp = margv; margc = 0; for (cp = line; *cp;) { while (isspace(*cp)) cp++; if (*cp == '\0') break; *argp++ = cp; margc += 1; while (*cp != '\0' && !isspace(*cp)) cp++; if (*cp == '\0') break; *cp++ = '\0'; } *argp++ = 0; } /*VARARGS*/ quit() { exit(0); } /* * Help command. */ help(argc, argv) int argc; char *argv[]; { register struct cmd *c; if (argc == 1) { printf("Commands may be abbreviated. Commands are:\n\n"); for (c = cmdtab; c->name; c++) printf("%-*s\t%s\n", HELPINDENT, c->name, c->help); return; } while (--argc > 0) { register char *arg; arg = *++argv; c = getcmd(arg); if (c == (struct cmd *)-1) printf("?Ambiguous help command %s\n", arg); else if (c == (struct cmd *)0) printf("?Invalid help command %s\n", arg); else printf("%s\n", c->help); } } /*VARARGS*/ settrace() { trace = !trace; printf("Packet tracing %s.\n", trace ? "on" : "off"); } /*VARARGS*/ setverbose() { verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); }
[ "zahir.meddour@protonmail.com" ]
zahir.meddour@protonmail.com
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
94