blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
357
content_id
stringlengths
40
40
detected_licenses
listlengths
0
58
license_type
stringclasses
2 values
repo_name
stringlengths
4
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-14 21:31:45
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
committer_date
timestamp[ns]date
1970-01-01 00:00:00
2023-09-05 23:26:37
github_id
int64
966
689M
โŒ€
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
24 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
โŒ€
gha_created_at
timestamp[ns]date
2008-02-03 21:17:16
2023-08-24 19:49:39
โŒ€
gha_language
stringclasses
180 values
src_encoding
stringclasses
35 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
6
10.4M
extension
stringclasses
121 values
filename
stringlengths
1
148
content
stringlengths
6
10.4M
aee1849937673a370fb490271fccd04c22fcbc4c
47d596285429c4e152e90082d7011dab36568cae
/lib/ksr_pinout/ksr_pinout.h
48e4b272fc7377a7cc9f6d32d7dc3fdc3387d752
[]
no_license
mykolaf/KSRobot0428
b1d04e8a6670540de03725c4a877199b2c685ed6
cca53d9a74a7396dd54413f9eebedac5073a3c75
refs/heads/master
2023-03-02T02:23:34.384217
2021-02-11T22:31:25
2021-02-11T22:31:25
null
0
0
null
null
null
null
UTF-8
C
false
false
515
h
ksr_pinout.h
#ifndef KSR_pinout #define KSR_pinout #include "Arduino.h" enum Pin : uint8_t { /* KS007 motor shield */ motor_rb_speed = 11, motor_la_speed = 3, motor_rb_dir = 13, motor_la_dir = 12, /* KS007 sensor shield v5 */ ult_sonic_echo = 4, ult_sonic_tr1g = 5, servo = 9, ir_receiver = A0, photo_res_l = A1, photo_res_r = A2, i2c_sda = A4, i2c_scl = A5 }; #endif // KSR_pinout
dc73ed7dd4ce23795ab024e8fec94cc84b126f4c
a0638ca86e71ef880efea28039d2c12df5043e50
/ft_putstr.c
24201df5c916b9e8120bab84337a316f20c736ae
[]
no_license
Vaynn/libft
e7c7c6e880e0bd94490271bacef398009d5869b4
9ce2dd23b08892656e00848cc297de5b934d205b
refs/heads/master
2022-12-21T05:16:17.768307
2020-09-16T15:02:44
2020-09-16T15:02:44
296,063,002
0
0
null
null
null
null
UTF-8
C
false
false
1,119
c
ft_putstr.c
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_putstr.c .:: .:/ . .:: */ /* +:+:+ +: +: +:+:+ */ /* By: yvmartor <marvin@le-101.fr> +:+ +: +: +:+ */ /* #+# #+ #+ #+# */ /* Created: 2018/10/05 17:20:42 by yvmartor #+# ## ## #+# */ /* Updated: 2018/10/06 16:09:28 by yvmartor ### #+. /#+ ###.fr */ /* / */ /* / */ /* ************************************************************************** */ #include "libft.h" void ft_putstr(char const *s) { int i; i = 0; if (s) { while (s[i] != '\0') { ft_putchar(s[i]); i++; } } }
2b660daac1c600e6e494b2c82bf19d785dae716c
7b29dd52eb4600157e37d6f1dcdc5f1264751b1d
/Algorithms_and_data_structure/101/pa5/Graph.c
f292a30cbadb660e665e65571f854c21a8e1ff1d
[]
no_license
rickstao/Snippets
2b8360a92d5b650d6f07e7c90bb89df13ae220ed
7ddc5a018234d750137191ada8bdc614ec28e8d8
refs/heads/master
2021-08-07T22:57:02.174167
2017-11-09T05:32:01
2017-11-09T05:32:01
110,070,233
0
0
null
null
null
null
UTF-8
C
false
false
5,846
c
Graph.c
// Ruikang Tao // rtao6 // PA5 #include <stdio.h> #include <stdlib.h> #include"Graph.h" #define WHITE 'w' #define GREY 'g' #define BLACK 'b' int time; /*** structs ***/ typedef struct GraphObj{ List* neighbors; char* color; int* discover; int* parent; int* finish; int order; int size; }GraphObj; typedef GraphObj* Graph; /*** Constructors-Destructors ***/ // newGraph() // returns a new Graph with proper allocated memory and initial values Graph newGraph(int n){ Graph G = malloc(sizeof(GraphObj)); G->neighbors = calloc(n+1, sizeof(List)); G->color = calloc(n+1, sizeof(char)); G->discover = calloc(n+1, sizeof(int)); G->parent = calloc(n+1, sizeof(int)); G->finish = calloc(n+1, sizeof(int)); G->order = n; G->size = 0; for(int i=1; i<=n; i++){ G->neighbors[i] = newList(); G->color[i] = WHITE; G->discover[i] = UNDEF; G->parent[i] = NIL; G->finish[i] = UNDEF; } return G; } // freeGraph() // frees all memory allocated void freeGraph(Graph *pG){ for(int i=1; i<=getOrder(*pG); i++){ freeList(&(*pG)->neighbors[i]); } free((*pG)->neighbors); //G->neighbors = NULL; free((*pG)->discover); //G->distance = NULL; free((*pG)->color); free((*pG)->finish); //G->color = NULL; free((*pG)->parent); //G->parent = NULL; free(*pG); *pG = NULL; } /*** Access functions ***/ // getOrder() // returns the order of the Graph int getOrder(Graph G){ if(G == NULL) { printf("Graph Error: getOrder() called on NULL Graph reference\n"); exit(1); } return G->order; } // getSize() // returns the size of the Graph int getSize(Graph G){ if(G == NULL) { printf("Graph Error: getSize() called on NULL Graph reference\n"); exit(1); } return G->size; } // getDiscover() // returns the discover of the Graph int getDiscover(Graph G, int u){ if(G == NULL) { printf("Graph Error: getDiscover() called on NULL Graph reference\n"); exit(1); } return G->discover[u]; } // getParent() // returns the parent of u int getParent(Graph G, int u){ if(G == NULL){ printf("Graph Error: getParent() called on NULL Graph reference\n"); exit(1); } if(u < 1 || u > getOrder(G)){ printf("Graph Error: getParent() called on invalid u value.\n"); exit(1); } return G->parent[u]; } // getFinish() // returns the finish from u to source int getFinish(Graph G, int u){ if(G == NULL){ printf("Graph Error: getFinish() called on NULL Graph reference\n"); exit(1); } if(u < 1 || u > getOrder(G)){ printf("Graph Error: getFinish() called on invalid u value.\n"); exit(1); } return G->finish[u]; } /*** Manipulation procedures ***/ // addEdge() // inserts an undirectioinal edge to the Graph joining u and v void addEdge(Graph G, int u, int v){ if(u<1 || u>getOrder(G)){ printf("Graph Error: addEdge() called on invalid u value.\n"); exit(1); } if(v<1 || v>getOrder(G)){ printf("Graph Error: addEdge() called on invalid v value.\n"); exit(1); } addArc(G, u, v); addArc(G, v, u); G->size--; } // addArc() // inserts a directed edge to the Graph joining u and v void addArc(Graph G, int u, int v){ int temp; if(u<1 || u>getOrder(G)){ printf("Graph Error: addEdge() called on invalid u value.\n"); exit(1); } if(v<1 || v>getOrder(G)){ printf("Graph Error: addEdge() called on invalid v value.\n"); exit(1); } if(length(G->neighbors[u]) == 0){ append(G->neighbors[u], v); } else{ moveFront(G->neighbors[u]); while(index(G->neighbors[u]) >= 0){ temp = get(G->neighbors[u]); if(v < temp){ insertBefore(G->neighbors[u],v); moveBack(G->neighbors[u]); } moveNext(G->neighbors[u]); } if(v > temp && index(G->neighbors[u]) == -1){ append(G->neighbors[u],v); } } G->size++; } // DFS() // performs DFS algorithm to find SCC void DFS(Graph G, List S){ if(getOrder(G) != length(S)){ printf("Graph Error: DFS() called on invalid graph order number.\n"); exit(1); } time=1; List L = copyList(S); for(int i=1; i<=length(S); i++){ G->color[i]=WHITE; G->parent[i]=NIL; } for(moveFront(L); index(L) != -1; moveNext(L)){ int x = get(L); if(G->color[x] == WHITE){ Visit(G,x,S); } } freeList(&L); } /*** Other operations ***/ // Visit() // helper function for DFS void Visit(Graph G, int x, List S){ G->color[x] = GREY; G->discover[x] = time++; for(moveFront(G->neighbors[x]); index(G->neighbors[x]) != -1; moveNext(G->neighbors[x])){ int y = get(G->neighbors[x]); if(G->color[y] == WHITE){ G->parent[y]=x; Visit(G,y,S); } } G->color[x]=BLACK; G->finish[x]=time++; prepend(S,x); deleteBack(S); } // transpose() // returns the transpose of target graph Graph transpose(Graph G){ if (G == NULL) { printf("Error: transpose() called on NULL Graph pointer.\n"); exit(1); } Graph T = newGraph(getOrder(G)); for(int i = 1; i <= getOrder(G); i++){ moveFront(G->neighbors[i]); while(index(G->neighbors[i]) != -1){ addArc(T, get(G->neighbors[i]), i); moveNext(G->neighbors[i]); } } return T; } // copyGraph() // makes a copy of the target graph Graph copyGraph(Graph G){ if (G == NULL) { printf("Error: copyGraph() called on NULL Graph pointer.\n"); exit(1); } Graph copy = newGraph(getOrder(G)); for(int i = 1; i <= getOrder(G); i++){ moveFront(G->neighbors[i]); while(index(G->neighbors[i]) != -1){ addArc(copy, i, get(G->neighbors[i])); moveNext(G->neighbors[i]); } } return copy; } // printGraph() // prints the vertices and their neighbors void printGraph(FILE* out, Graph G){ if(G == NULL || out == NULL){ printf("Error: printGraph() called on NULL Graph pointer.\n"); exit(1); } for(int i=1; i<=getOrder(G); i++){ fprintf(out, "%d: ", i); printList(out, G->neighbors[i]); fprintf(out, "\n"); } }
174d9bc18ddb0b8c483abcf28304959de3a59897
1f856cef5691c8bc1c21be37b0fd58cde409b728
/Animate.h
d65bdff47254f41599a412ea3dd7e092b5fad384
[]
no_license
mlopeza/GLUT-Animation-Project
35ed9c847825561a4eca6002eac99e74f7d68cbc
bada29b0291fc6a9c89c4a266540b23da408a68a
refs/heads/master
2021-01-13T01:55:48.130065
2011-11-23T21:40:19
2011-11-23T21:40:19
2,599,760
0
0
null
null
null
null
UTF-8
C
false
false
1,999
h
Animate.h
int speed = 200; char *animatedNodes[13]; int numAnimatedNodes; int keyFrames; int aniMatrix[100][13][3]; int animateMatrix = 0; int direccion = 1; void animateModel(int id){ if(id == keyFrames-1){ direccion = -1; } if(id == -1){ direccion = 1; animateMatrix = 0; return; } Elemento *nodo; for(int i=0;i<numAnimatedNodes;i++){ nodo = seleccionaElemento(raiz,animatedNodes[i]); if(i == 1) printf("%s %d %d %d\n",animatedNodes[i],aniMatrix[id][i][0],aniMatrix[id][i][1],aniMatrix[id][i][2]); nodo->theta[0] = aniMatrix[id][i][0]; nodo->theta[1] = aniMatrix[id][i][1]; nodo->theta[2] = aniMatrix[id][i][2]; } glutTimerFunc(speed,animateModel,id+direccion); } void changeColor(int id){ matAsign = ((matAsign + 1) == 7)?0:matAsign+1; texAct = (texAct == 1)? 2 : 1; glutTimerFunc(3000,changeColor,0); return; } void animation(int id){ glutTimerFunc(500,animation,0); } void leeAnimacion(char *direccion){ printf("Hola\n"); char buffer[1024],trash[2]; FILE *file; if(!(file = fopen(direccion,"r"))){ fprintf(stderr,"No se pudo abrir el archivo %s\n",direccion); return; } while(!feof(file)){ fgets(buffer,1024,file); sscanf(buffer,"%d %d",&numAnimatedNodes,&keyFrames); printf("Buffer 6: %d %d",numAnimatedNodes,keyFrames); for(int i =0; i<numAnimatedNodes && !feof(file);i++){ animatedNodes[i]=(char *) malloc(6*sizeof(char)); fgets(buffer,1024,file); sscanf(buffer,"%s [^\n]",animatedNodes[i]); } int x = 0; for(int i =0;i<numAnimatedNodes;i++){ for(int j=0;j<keyFrames;j++){ fgets(buffer,1024,file); sscanf(buffer,"%d %d %d [^\n]",&aniMatrix[j][i][0],&aniMatrix[j][i][1],&aniMatrix[j][i][2]); x++; } } printf("X:%d\n",x); break; } for(int i =0;i<numAnimatedNodes;i++){ for(int j=1;j<keyFrames;j++){ printf("%d %d %d\n",aniMatrix[j][i][0],aniMatrix[j][i][1],aniMatrix[j][i][2]); } } printf("%d\n",keyFrames); animateMatrix = 1; glutTimerFunc(1000,animateModel,0); }
878f523511c0967ac700dcc09a7c09337ba0b9ad
9b9a4a39f8c8382a68f15aecfe4e711c47bd45ec
/itp1/8c_countingcharacters.c
5f8d92f691341ad671a3fba3674a1bbb557182e4
[]
no_license
ktateish/aoj
960e7d09563a38cec7326d9cc6a3a7ab9d26f8c3
e4b6c07983172c551937ffdce40ae4b8e0a61461
refs/heads/master
2021-01-24T16:09:52.790700
2017-10-13T07:59:26
2017-10-13T07:59:26
34,558,118
0
0
null
null
null
null
UTF-8
C
false
false
481
c
8c_countingcharacters.c
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__) #define dpri(x) dbg(#x ": %d\n", x) #define dprs(x) dbg(#x ": %s\n", x) #include <stdio.h> #include <ctype.h> typedef long long ll; const int MYINF = 1e9+7; #define len 30 static int count[len]; int main(int argc, char **argv) { int c, i; while ((c = getchar()) != EOF) { if (isalpha(c)) { count[tolower(c) - 'a']++; } } for (i = 0; i <= 'z' - 'a'; i++) { printf("%c : %d\n", 'a' + i, count[i]); } return 0; }
62a2b38927916f52b9f9d0a7aef6c3a6c56d962c
6d162c19c9f1dc1d03f330cad63d0dcde1df082d
/qrenderdoc/3rdparty/qt/include/QtWidgets/qtwidgets-config.h
3229c5626be0e4705b873ce9acd7b09975b41bcf
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "LGPL-3.0-only", "GPL-3.0-only", "Python-2.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-mit-old-style", "LGPL-2.1-or-later", "LGPL-2.1-only", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-sc...
permissive
baldurk/renderdoc
24efbb84446a9d443bb9350013f3bfab9e9c5923
a214ffcaf38bf5319b2b23d3d014cf3772cda3c6
refs/heads/v1.x
2023-08-16T21:20:43.886587
2023-07-28T22:34:10
2023-08-15T09:09:40
17,253,131
7,729
1,358
MIT
2023-09-13T09:36:53
2014-02-27T15:16:30
C++
UTF-8
C
false
false
2,499
h
qtwidgets-config.h
#define QT_FEATURE_abstractbutton 1 #define QT_FEATURE_abstractslider 1 #define QT_FEATURE_groupbox 1 #define QT_FEATURE_buttongroup 1 #define QT_FEATURE_label 1 #define QT_FEATURE_pushbutton 1 #define QT_FEATURE_menu 1 #define QT_FEATURE_lineedit 1 #define QT_FEATURE_spinbox 1 #define QT_FEATURE_slider 1 #define QT_FEATURE_scrollbar 1 #define QT_FEATURE_scrollarea 1 #define QT_FEATURE_itemviews 1 #define QT_FEATURE_tableview 1 #define QT_FEATURE_toolbutton 1 #define QT_FEATURE_calendarwidget 1 #define QT_FEATURE_checkbox 1 #define QT_FEATURE_dialog 1 #define QT_FEATURE_dialogbuttonbox 1 #define QT_FEATURE_colordialog 1 #define QT_FEATURE_listview 1 #define QT_FEATURE_columnview 1 #define QT_FEATURE_combobox 1 #define QT_FEATURE_commandlinkbutton 1 #define QT_FEATURE_completer 1 #define QT_FEATURE_contextmenu 1 #define QT_FEATURE_datawidgetmapper 1 #define QT_FEATURE_datetimeedit 1 #define QT_FEATURE_dial 1 #define QT_FEATURE_filesystemmodel 1 #define QT_FEATURE_dirmodel 1 #define QT_FEATURE_resizehandler 1 #define QT_FEATURE_mainwindow 1 #define QT_FEATURE_dockwidget 1 #define QT_FEATURE_textedit 1 #define QT_FEATURE_errormessage 1 #define QT_FEATURE_splitter 1 #define QT_FEATURE_stackedwidget 1 #define QT_FEATURE_treeview 1 #define QT_FEATURE_filedialog 1 #define QT_FEATURE_fontcombobox 1 #define QT_FEATURE_fontdialog 1 #define QT_FEATURE_formlayout 1 #define QT_FEATURE_fscompleter 1 #define QT_FEATURE_graphicsview 1 #define QT_FEATURE_graphicseffect 1 #define QT_FEATURE_inputdialog 1 #define QT_FEATURE_keysequenceedit 1 #define QT_FEATURE_lcdnumber 1 #define QT_FEATURE_listwidget 1 #define QT_FEATURE_mdiarea 1 #define QT_FEATURE_menubar 1 #define QT_FEATURE_messagebox 1 #define QT_FEATURE_paint_debug 1 #define QT_FEATURE_progressbar 1 #define QT_FEATURE_progressdialog 1 #define QT_FEATURE_radiobutton 1 #define QT_FEATURE_rubberband 1 #define QT_FEATURE_scroller 1 #define QT_FEATURE_sizegrip 1 #define QT_FEATURE_splashscreen 1 #define QT_FEATURE_statusbar 1 #define QT_FEATURE_statustip 1 #define QT_FEATURE_style_stylesheet 1 #define QT_FEATURE_syntaxhighlighter 1 #define QT_FEATURE_tabbar 1 #define QT_FEATURE_tablewidget 1 #define QT_FEATURE_tabwidget 1 #define QT_FEATURE_textbrowser 1 #define QT_FEATURE_toolbar 1 #define QT_FEATURE_toolbox 1 #define QT_FEATURE_tooltip 1 #define QT_FEATURE_treewidget 1 #define QT_FEATURE_undocommand 1 #define QT_FEATURE_undostack 1 #define QT_FEATURE_undogroup 1 #define QT_FEATURE_undoview 1 #define QT_FEATURE_wizard 1
61ec94e13d458101241de6163a665a82704eef14
161f2bda0a29e59cc5eeae306e54d326f4765fa7
/S32K144/Mcal/Spi_TS_T40D2M10I1R0/src/Spi.c
92f4981fc1e11b7db9ae6d580a3b8bce6ed578c8
[]
no_license
hao507/S32K144
cfecb97ee9357d4c8175d4a6b50e71b20eabaac0
bd59a2638b4f6851f3c934200817c8644765d219
refs/heads/master
2022-08-01T01:10:55.337924
2020-05-19T03:17:49
2020-05-19T03:17:49
266,337,378
0
1
null
2020-05-23T12:59:55
2020-05-23T12:59:54
null
UTF-8
C
false
false
122,379
c
Spi.c
/** * @file Spi.c * @implements Spi.c_Artifact * @version 1.0.1 * * @brief AUTOSAR Spi - Implements the AUTOSAR SPI driver functionality. * @details Implements the AUTOSAR SPI driver. All the API functions are described by AUTOSAR * * @addtogroup [SPI_MODULE] * @{ */ /*================================================================================================== * Project : AUTOSAR 4.3 MCAL * Platform : ARM * Peripheral : LPSPI,FLEXIO * Dependencies : * * Autosar Version : 4.3.1 * Autosar Revision : ASR_REL_4_3_REV_0001 * Autosar Conf.Variant : * SW Version : 1.0.1 * Build Version : S32K14x_MCAL_1_0_1_RTM_ASR_REL_4_3_REV_0001_20190621 * * (c) Copyright 2006-2016 Freescale Semiconductor, Inc. * Copyright 2017-2019 NXP * All Rights Reserved. ==================================================================================================*/ /*================================================================================================== ==================================================================================================*/ #ifdef __cplusplus extern "C" { #endif /** * @page misra_violations MISRA-C:2004 violations * * @section [global] * Violates MISRA 2004 Required Rule 5.1, Identifiers (internal and external) shall not rely * on the significance of more than 31 characters. * * @section Spi_c_REF_1 * Violates MISRA 2004 Advisory Rule 19.1, #include statements in a file should only be preceded by other * preprocessor directives or comments. * AUTOSAR imposes the specification of the sections in which certain parts of the driver must be placed. * * @section Spi_c_REF_2 * Violates MISRA 2004 Required Rule 19.15, Precautions shall be taken in order to prevent the contents * of a header file being included twice. * This comes from the order of includes in the .c file and from include dependencies. As a safe * approach, any file must include all its dependencies. Header files are already protected against * double inclusions. The inclusion of MemMap.h is as per Autosar requirement MEMMAP003. * * @section Spi_c_REF_3 * Violates MISRA 2004 Advisory Rule 11.4, A cast should not be performed between a pointer to object type * and a different pointer to object type. * 'Spi_ChannelConfigType.BufferDescriptor' field is defined as P2CONST(), while the * referenced Spi_BufferDescriptorType instance may be a variable, in the case of * external buffers. * * @section Spi_c_REF_4 * Violates MISRA 2004 Required Rule 8.10, All declarations and definitions of objects or functions * at file scope shall * have internal linkage unless external linkage is required. * State variables may be used by LLD layer. * * @section Spi_c_REF_5 * Violates MISRA 2004 Required Rule 1.4, The compiler/linker shall be checked to ensure that 31 character * significance and case sensitivity are * supported for external identifiers. * This violation is due to the requirement that requests to have a file version check. * * @section Spi_c_REF_6 * Violates MISRA 2004 Required Rule 17.4, Array indexing shall be the only allowed form of pointer arithmetic. * Gain in generated code speed * * @section Spi_c_REF_7 * Violates MISRA 2004 Required Rule 11.5, A cast shall not be performed that removes any const or volatile * qualification from the type addressed by a pointer. * * @section Spi_c_REF_9 * Violates MISRA 2004 Required Rule 16.10, If a function returns error information, * then that error information shall be tested. * * @section Spi_c_REF_10 * Violates MISRA 2004 Required Rule 8.7,Objects %s shall be defined at block scope if they are * only accessed from within a single function %s. * */ /*================================================================================================== * INCLUDE FILES * 1) system and project includes * 2) needed interfaces from external units * 3) internal and external interfaces from this unit ==================================================================================================*/ #include "Spi.h" #include "Spi_IPW.h" #if (SPI_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) #include "Dem.h" #endif #if (SPI_DEV_ERROR_DETECT == STD_ON) #include "Det.h" #endif #include "SchM_Spi.h" /*================================================================================================== * SOURCE FILE VERSION INFORMATION ==================================================================================================*/ #define SPI_MODULE_ID_C 83 #define SPI_VENDOR_ID_C 43 #define SPI_AR_RELEASE_MAJOR_VERSION_C 4 #define SPI_AR_RELEASE_MINOR_VERSION_C 3 /* * @violates @ref Spi_c_REF_5 The compiler/linker shall be checked to ensure that 31 character * significance and case sensitivity are supported for external identifiers. */ #define SPI_AR_RELEASE_REVISION_VERSION_C 1 #define SPI_SW_MAJOR_VERSION_C 1 #define SPI_SW_MINOR_VERSION_C 0 #define SPI_SW_PATCH_VERSION_C 1 /*================================================================================================== * FILE VERSION CHECKS ==================================================================================================*/ /* Check if this file and Spi.h are of the same vendor */ #if (SPI_VENDOR_ID_C != SPI_VENDOR_ID) #error "Spi.c and Spi.h have different vendor ids" #endif /* Check if this header file and Spi_IPW_Types.h are of the same vendor */ #if (SPI_VENDOR_ID_C != SPI_IPW_VENDOR_ID) #error "Spi.h and Spi_IPW.h have different vendor ids" #endif /* Check if current file and Spi header file are of the same Autosar version */ #if ((SPI_AR_RELEASE_MAJOR_VERSION_C != SPI_AR_RELEASE_MAJOR_VERSION) || \ (SPI_AR_RELEASE_MINOR_VERSION_C != SPI_AR_RELEASE_MINOR_VERSION) || \ (SPI_AR_RELEASE_REVISION_VERSION_C != SPI_AR_RELEASE_REVISION_VERSION)) #error "AutoSar Version Numbers of Spi.c and Spi.h are different" #endif /* Check if current file and Spi header file are of the same Software version */ #if ((SPI_SW_MAJOR_VERSION_C != SPI_SW_MAJOR_VERSION) || \ (SPI_SW_MINOR_VERSION_C != SPI_SW_MINOR_VERSION) || \ (SPI_SW_PATCH_VERSION_C != SPI_SW_PATCH_VERSION)) #error "Software Version Numbers of Spi.c and Spi.h are different" #endif /* Check if current file and Spi_IPW header file are of the same Autosar version */ #if ((SPI_AR_RELEASE_MAJOR_VERSION_C != SPI_IPW_AR_RELEASE_MAJOR_VERSION) || \ (SPI_AR_RELEASE_MINOR_VERSION_C != SPI_IPW_AR_RELEASE_MINOR_VERSION) || \ (SPI_AR_RELEASE_REVISION_VERSION_C != SPI_IPW_AR_RELEASE_REVISION_VERSION)) #error "AutoSar Version Numbers of Spi.c and Spi_IPW.h are different" #endif /* Check if current file and Spi_IPW header file are of the same Software version */ #if ((SPI_SW_MAJOR_VERSION_C != SPI_IPW_SW_MAJOR_VERSION) || \ (SPI_SW_MINOR_VERSION_C != SPI_IPW_SW_MINOR_VERSION) || \ (SPI_SW_PATCH_VERSION_C != SPI_IPW_SW_PATCH_VERSION)) #error "Software Version Numbers of Spi.c and Spi_IPW.h are different" #endif #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK #if (SPI_DEV_ERROR_DETECT == STD_ON) #if ((SPI_AR_RELEASE_MAJOR_VERSION != DET_AR_RELEASE_MAJOR_VERSION) || \ (SPI_AR_RELEASE_MINOR_VERSION != DET_AR_RELEASE_MINOR_VERSION)) #error "AutoSar Version Numbers of SPI.h and Det.h are different" #endif #endif #if (SPI_DISABLE_DEM_REPORT_ERROR_STATUS == STD_OFF) #if ((SPI_AR_RELEASE_MAJOR_VERSION_C != DEM_AR_RELEASE_MAJOR_VERSION) || \ (SPI_AR_RELEASE_MINOR_VERSION_C != DEM_AR_RELEASE_MINOR_VERSION)) #error "AutoSar Version Numbers of Spi.c and Dem.h are different" #endif #endif #endif /*================================================================================================== * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS) ==================================================================================================*/ /** * @brief This structure holds the HWUnit scheduling queue. * @details For async transmissions, this structure holds the HWUnit scheduling queue . * For sync transmissions, only HWUnit Status is managed. * */ typedef struct { #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /**< @brief Array of the IDs of jobs to be scheduled, for each priority level. */ VAR(Spi_JobType, SPI_VAR) aScheduledJobsListHead[SPI_JOB_PRIORITY_LEVELS_COUNT]; /**< @brief Array of the IDs of last jobs in queues, for each priority level. */ VAR(Spi_JobType, SPI_VAR) aScheduledJobsListTail[SPI_JOB_PRIORITY_LEVELS_COUNT]; /**< @brief Array of the IDs of last jobs in queues, for each priority level. */ VAR(sint8, SPI_VAR) s8MaxScheduledPriority; #endif /* ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) */ VAR(Spi_StatusType, SPI_VAR) Status; /**< @brief DSPI state. */ } Spi_HWUnitQueue; /*================================================================================================== * LOCAL MACROS ==================================================================================================*/ /*================================================================================================== * LOCAL CONSTANTS ==================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /** * @brief Values used to denote NULL indexes. */ #define SPI_JOB_NULL ((Spi_JobType)(-1)) #define SPI_SEQUENCE_NULL ((Spi_SequenceType)(-1)) #endif /* ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) */ /*================================================================================================== * LOCAL VARIABLES ==================================================================================================*/ #define SPI_START_SEC_VAR_NO_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /** * @brief Array of HW units queues. */ static VAR(Spi_HWUnitQueue, SPI_VAR) Spi_aSpiHWUnitQueueArray[SPI_MAX_HWUNIT]; #define SPI_STOP_SEC_VAR_NO_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /*================================================================================================== * GLOBAL CONSTANTS ==================================================================================================*/ /*================================================================================================== * GLOBAL VARIABLES ==================================================================================================*/ #define SPI_START_SEC_VAR_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /** * @brief Pointer initialized during init with the address of the received configuration structure. * @details Will be used by all functions to access the configuration data. */ P2CONST(Spi_ConfigType, SPI_VAR, SPI_APPL_CONST) Spi_pcSpiConfigPtr = NULL_PTR; #define SPI_STOP_SEC_VAR_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" #define SPI_START_SEC_VAR_NO_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /** * @brief Spi State. */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ VAR(Spi_SequenceStateType, SPI_VAR) Spi_aSpiSequenceState[SPI_MAX_SEQUENCE]; /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ VAR(Spi_JobStateType, SPI_VAR) Spi_aSpiJobState[SPI_MAX_JOB]; /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ VAR(Spi_ChannelStateType, SPI_VAR) Spi_aSpiChannelState[SPI_MAX_CHANNEL]; #if (SPI_MAX_HWUNIT > 32u) #error "Too many HW Units in configuration (max 32 units allowed)" #endif #define SPI_STOP_SEC_VAR_NO_INIT_UNSPECIFIED /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" #define SPI_START_SEC_VAR_NO_INIT_32 /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /** * @note Array of used HW units per sequence: * The element corresponding to a given sequence will have asserted the bits * corresponding to the used HW units. */ #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) static VAR(uint32, SPI_VAR) Spi_au32SpiSeqUsedHWUnits[SPI_MAX_SEQUENCE]; #endif #define SPI_STOP_SEC_VAR_NO_INIT_32 /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" #define SPI_START_SEC_VAR_INIT_32 /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /** * @brief Spi Sync Transmit Running HWUnits Status. */ static volatile VAR(uint32, SPI_VAR) Spi_u32SpiBusySyncHWUnitsStatus[SPI_MAX_HWUNIT] = {0u}; #define SPI_STOP_SEC_VAR_INIT_32 /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" /*================================================================================================== * LOCAL FUNCTION PROTOTYPES ==================================================================================================*/ #define SPI_START_SEC_CODE /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) LOCAL_INLINE FUNC(void, SPI_CODE) Spi_ScheduleJob ( P2VAR(Spi_HWUnitQueue, AUTOMATIC, SPI_APPL_DATA) pHWUnitQueue, VAR(Spi_JobType, AUTOMATIC) Job, P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig ); #endif #if (SPI_LEVEL_DELIVERED == LEVEL2) LOCAL_INLINE FUNC(Spi_StatusType, SPI_CODE) Spi_GetAsyncStatus(void); #endif #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) LOCAL_INLINE FUNC(Std_ReturnType, SPI_CODE) Spi_LockJobs ( VAR(Spi_SequenceType, AUTOMATIC) Sequence, P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequence ); #endif #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) #if (SPI_CANCEL_API == STD_ON) LOCAL_INLINE FUNC(void, SPI_CODE) Spi_UnlockRemainingJobs ( VAR(Spi_JobType, AUTOMATIC) RemainingJobs, P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequence ); #endif #endif #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) static FUNC(void, SPI_CODE) Spi_ScheduleNextJob ( P2VAR(Spi_HWUnitQueue, AUTOMATIC, SPI_APPL_DATA) pHWUnitQueue ); #endif /*================================================================================================== * LOCAL FUNCTIONS ==================================================================================================*/ /** * @brief This function returns the status of the SPI driver related to async HW Units. * @details Return SPI_BUSY if at least one async HW unit is busy. * * @return Spi_StatusType * @retval SPI_UNINIT The driver is un-initialized * @retval SPI_IDLE The driver has no pending transfers * @retval SPI_BUSY The driver is busy * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL2. */ /*================================================================================================*/ #if (SPI_LEVEL_DELIVERED == LEVEL2) LOCAL_INLINE FUNC(Spi_StatusType, SPI_CODE) Spi_GetAsyncStatus(void) { VAR(Spi_StatusType, AUTOMATIC) StatusFlag = SPI_IDLE; VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; for (HWUnit = 0u; HWUnit < (Spi_HWUnitType)SPI_MAX_HWUNIT; HWUnit++) { if ((SPI_BUSY == Spi_aSpiHWUnitQueueArray[HWUnit].Status) && /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ (SPI_PHYUNIT_ASYNC_U32 == Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u32IsSync)) { StatusFlag = SPI_BUSY; break; } else { /* Do nothing */ } } return StatusFlag; } #endif /* (SPI_LEVEL_DELIVERED == LEVEL2) */ /*================================================================================================*/ /** * @brief This function is called in order to mark the jobs of a sequence as ready to be transmitted. * @details For each job in sequence, the function checks if it is already * linked to another pending sequence. * If at least one job is already linked, the function returns E_NOT_OK. * Elsewhere, all jobs in sequence are locked (linked to the current * sequence) * * @param[in] Sequence The sequence ID. * @param[in] pcSequence The sequence configuration. * * @return Std_ReturnType * @retval E_OK The given sequence does not share its jobs with some * other sequences, and all its jobs were successfully * locked. * @retval E_NOT_OK The given sequence shares its jobs with some other * sequences. No lock performed for its jobs. * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * */ /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) LOCAL_INLINE FUNC(Std_ReturnType, SPI_CODE) Spi_LockJobs ( VAR(Spi_SequenceType, AUTOMATIC) Sequence, P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequence ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; VAR(Spi_JobType, AUTOMATIC) JobCount = pcSequence->NumJobs; P2CONST(Spi_JobType, AUTOMATIC, SPI_APPL_CONST) pcJobs = pcSequence->pcJobIndexList; P2VAR(Spi_JobStateType, AUTOMATIC, SPI_APPL_DATA) pJobState; P2VAR(Spi_SequenceStateType, AUTOMATIC, SPI_APPL_DATA) pSequenceState; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_05(); /* use an optimized implementation for one job sequences */ if (1u == JobCount) { pJobState = &Spi_aSpiJobState[*pcJobs]; if (NULL_PTR == pJobState->pAsyncCrtSequenceState) { /* job not yet linked => link it to the current sequence */ pJobState->pAsyncCrtSequenceState = &Spi_aSpiSequenceState[Sequence]; } else { /* the job is already locked by a pending sequence */ Status = (Std_ReturnType)E_NOT_OK; } } else { pSequenceState = &Spi_aSpiSequenceState[Sequence]; while (0u < JobCount) { pJobState = &Spi_aSpiJobState[*pcJobs]; if (NULL_PTR == pJobState->pAsyncCrtSequenceState) { /* job not yet linked => link it to the current sequence */ pJobState->pAsyncCrtSequenceState = pSequenceState; } else { /* the job is already locked by a pending sequence => rollback all the previous locks */ if (JobCount < pcSequence->NumJobs) { do { JobCount++; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pcJobs--; Spi_aSpiJobState[*pcJobs].pAsyncCrtSequenceState = NULL_PTR; } while (JobCount < pcSequence->NumJobs); } else { /* Do nothing */ } Status = (Std_ReturnType)E_NOT_OK; break; } /* next job */ JobCount--; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pcJobs++; } } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_05(); return Status; } #endif /* ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) */ /*================================================================================================*/ /** * @brief This function is called to release the jobs at the end of an async sequence transmission. * @details Mark the linked sequence for all jobs as NULL_PTR. * * @param[in] RemainingJobs The starting job * @param[in] pcSequence The sequence configuration * * @pre Pre-compile parameter SPI_CANCEL_API shall be STD_ON. * */ /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) #if (SPI_CANCEL_API == STD_ON) LOCAL_INLINE FUNC(void, SPI_CODE) Spi_UnlockRemainingJobs ( VAR(Spi_JobType, AUTOMATIC) RemainingJobs, P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequence ) { VAR(Spi_JobType, AUTOMATIC) NumJobsInSeq = pcSequence->NumJobs; VAR(Spi_JobType, AUTOMATIC) JobIdx; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_06(); for (JobIdx = NumJobsInSeq-RemainingJobs; JobIdx < NumJobsInSeq; JobIdx++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Spi_aSpiJobState[pcSequence->pcJobIndexList[JobIdx]].pAsyncCrtSequenceState = NULL_PTR; } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_06(); } #endif /* (SPI_CANCEL_API == STD_ON) */ #endif /* (SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2) */ /*================================================================================================*/ /** * @brief This function will schedule a job for a given HW unit. * @details If the HWUnit is not busy, the transfer is started and the HW unit is * marked as busy. * If the HWUnit is not busy (another job is in progress), the new job is * scheduled in a waiting job list, according to its priority. * * @param[in] pHWUnitQueue HW Unit to be used by the job * @param[in] Job ID of the scheduled job * @param[in] pcJobConfig Configuration of the scheduled job * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * */ /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) LOCAL_INLINE FUNC(void, SPI_CODE) Spi_ScheduleJob ( P2VAR(Spi_HWUnitQueue, AUTOMATIC, SPI_APPL_DATA) pHWUnitQueue, VAR(Spi_JobType, AUTOMATIC) Job, P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig ) { VAR(sint8, AUTOMATIC) s8Priority; P2VAR(Spi_JobType, AUTOMATIC, SPI_APPL_DATA) pJobListTail; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_03(); if (SPI_IDLE == pHWUnitQueue->Status) { /* idle unit => the job can be started */ pHWUnitQueue->Status = SPI_BUSY; SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_03(); /* mark the job as pending */ Spi_aSpiJobState[Job].Result = SPI_JOB_PENDING; Spi_Ipw_JobTransfer(pcJobConfig); } else { /* add the job to the scheduling corresponding queue */ /* retrieve the tail of the scheduling queue for the job priority */ s8Priority = pcJobConfig->s8Priority; pJobListTail = &pHWUnitQueue->aScheduledJobsListTail[s8Priority]; if (SPI_JOB_NULL == *pJobListTail) { /* the list is empty => set also the head of the list */ pHWUnitQueue->aScheduledJobsListHead[s8Priority] = Job; } else { /* add the item at the end of the list */ Spi_aSpiJobState[*pJobListTail].AsyncNextJob = Job; } /* set the new tail of the list */ *pJobListTail = Job; /* the new item will be the last element in the list */ Spi_aSpiJobState[Job].AsyncNextJob = SPI_JOB_NULL; if (pHWUnitQueue->s8MaxScheduledPriority < s8Priority) { pHWUnitQueue->s8MaxScheduledPriority = s8Priority; } else { /* Do nothing */ } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_03(); } } #endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2) ) */ /*================================================================================================== * GLOBAL FUNCTIONS ==================================================================================================*/ #if (SPI_VERSION_INFO_API == STD_ON) /*================================================================================================*/ /** * @brief This function returns the version information for the SPI driver. * @details This function returns the version information for the SPI driver. * - Service ID: 0x09 * - Sync or Async: Synchronous * - Reentrancy: Non-Reentrant * * @param[in,out] VersionInfo Pointer to where to store the version * information of this module. * * @pre Pre-compile parameter SPI_VERSION_INFO_API shall be STD_ON. * * @implements Spi_GetVersionInfo_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(void, SPI_CODE) Spi_GetVersionInfo ( P2VAR(Std_VersionInfoType, AUTOMATIC, SPI_APPL_DATA) versioninfo ) { #if( SPI_DEV_ERROR_DETECT == STD_ON ) if(NULL_PTR == versioninfo) { /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16)SPI_MODULE_ID,(uint8)0,SPI_GETVERSIONINFO_ID,SPI_E_PARAM_POINTER); } else { #endif /* SPI_DEV_ERROR_DETECT == STD_ON */ versioninfo->vendorID = (uint16)SPI_VENDOR_ID; versioninfo->moduleID = (uint8)SPI_MODULE_ID; versioninfo->sw_major_version = (uint8)SPI_SW_MAJOR_VERSION; versioninfo->sw_minor_version = (uint8)SPI_SW_MINOR_VERSION; versioninfo->sw_patch_version = (uint8)SPI_SW_PATCH_VERSION; #if(SPI_DEV_ERROR_DETECT == STD_ON) } #endif /* SPI_DEV_ERROR_DETECT == STD_ON */ } #endif /* (SPI_VERSION_INFO_API == STD_ON) */ /*================================================================================================*/ /** * @brief This function initializes the SPI driver. * @details This function initializes the SPI driver using the * pre-established configurations * - Service ID: 0x00 * - Sync or Async: Synchronous * - Reentrancy: Non-Reentrant * * @param[in] ConfigPtr Specifies the pointer to the configuration set * * @implements Spi_Init_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(void, SPI_CODE) Spi_Init ( P2CONST(Spi_ConfigType, AUTOMATIC, SPI_APPL_CONST) ConfigPtr ) { VAR(uint32, AUTOMATIC) u32Channel; VAR(uint32, AUTOMATIC) u32Job; VAR(uint32, AUTOMATIC) u32Sequence; VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) VAR(sint8, AUTOMATIC) s8Priority; #endif P2CONST(Spi_ChannelConfigType, AUTOMATIC, SPI_APPL_CONST) pcChannelConfig; #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL1) || \ ((SPI_LEVEL_DELIVERED == LEVEL0) && (SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT == STD_ON))) P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequenceConfig; #endif #if (SPI_PRECOMPILE_SUPPORT == STD_OFF) #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if ConfigPtr */ /* is passed as a NULL Pointer */ if (NULL_PTR != Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_INIT_ID,SPI_E_ALREADY_INITIALIZED); } else if (NULL_PTR == ConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_INIT_ID,SPI_E_UNINIT); } else { #endif /* These defines use for fix compiler warning in the case that the */ /* right operand is higher */ u32Channel = (uint32)(ConfigPtr->Spi_Max_Channel); u32Job = (uint32)(ConfigPtr->Spi_Max_Job); u32Sequence = (uint32)(ConfigPtr->Spi_Max_Sequence); if ((u32Channel >= SPI_MAX_CHANNEL) || (u32Job >= SPI_MAX_JOB) || (u32Sequence >= SPI_MAX_SEQUENCE)) { /* configuration sizes must be checked for Post Build & Link Time configurations */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_INIT_ID,SPI_E_CONFIG_OUT_OF_RANGE); #endif } else { #else /* (SPI_CONFIG_VARIANT == SPI_VARIANT_PRECOMPILE) */ if (NULL_PTR != Spi_pcSpiConfigPtr) { #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_INIT_ID,SPI_E_ALREADY_INITIALIZED); #endif } else if (NULL_PTR == ConfigPtr) { Spi_pcSpiConfigPtr = &Spi_PBCfgVariantPredefined; } else #endif { Spi_pcSpiConfigPtr = ConfigPtr; } /* initialize buffer pointers to zero */ for (u32Channel = 0u; u32Channel <= (uint32)(Spi_pcSpiConfigPtr->Spi_Max_Channel); u32Channel++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcChannelConfig = &Spi_pcSpiConfigPtr->pcChannelConfig[u32Channel]; /* Check if configured buffers are External (EB) */ if (EB == pcChannelConfig->BufferType) { /* Initialize all buffers */ pcChannelConfig->pcBufferDescriptor->pBufferTX = NULL_PTR; pcChannelConfig->pcBufferDescriptor->pBufferRX = NULL_PTR; /* Channel length is zero for unconfigured external buffers */ Spi_aSpiChannelState[u32Channel].Length = (Spi_NumberOfDataType) 0; } else { /* Setup channel length according to configuration */ Spi_aSpiChannelState[u32Channel].Length = pcChannelConfig->Length; } Spi_aSpiChannelState[u32Channel].u8Flags = (VAR(uint8, AUTOMATIC))SPI_CHANNEL_FLAG_TX_DEFAULT_U8; } /* initialize job results */ for (u32Job = 0u; u32Job <= (uint32)( Spi_pcSpiConfigPtr->Spi_Max_Job); u32Job++) { Spi_aSpiJobState[u32Job].Result = SPI_JOB_OK; #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /* mark the job as unlocked / not linked to a pending async sequence */ Spi_aSpiJobState[u32Job].pAsyncCrtSequenceState = NULL_PTR; #endif } for (u32Sequence = 0u; u32Sequence <= (uint32)(Spi_pcSpiConfigPtr->Spi_Max_Sequence); u32Sequence++) { #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcSequenceConfig = &Spi_pcSpiConfigPtr->pcSequenceConfig[u32Sequence]; Spi_aSpiSequenceState[u32Sequence].pcSequence = pcSequenceConfig; #endif /* initialize sequence results */ Spi_aSpiSequenceState[u32Sequence].Result = SPI_SEQ_OK; #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) #if (SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT == STD_ON) /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcSequenceConfig = &Spi_pcSpiConfigPtr->pcSequenceConfig[u32Sequence]; /* initialize the map of used HWUnits per sequence */ Spi_au32SpiSeqUsedHWUnits[u32Sequence] = (uint32)0; for (u32Job = 0u;(VAR(Spi_JobType, AUTOMATIC))u32Job < pcSequenceConfig->NumJobs; u32Job++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ HWUnit = Spi_pcSpiConfigPtr->pcJobConfig[pcSequenceConfig->pcJobIndexList[u32Job]].HWUnit; Spi_au32SpiSeqUsedHWUnits[u32Sequence] |= /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ (uint32)((uint32)1 << (Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u8Offset)); } #else /* (SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT == STD_OFF) */ /* SPI135: Spi_SyncTransmit() must fail if an other sync transmission is ongoing.*/ /* mark all HW units as used by the sync transmission, in order to force the mutual exclusion of Spi_SyncTransmit() calls */ Spi_au32SpiSeqUsedHWUnits[u32Sequence] = 0xFFFFFFFFU; #endif /* (SPI_SUPPORT_CONCURRENT_SYNC_TRANSMIT == STD_OFF) */ #endif /* ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) */ } #ifdef SPI_ENABLE_USER_MODE_SUPPORT #if (STD_ON == SPI_ENABLE_USER_MODE_SUPPORT) #ifdef SPI_DSPI_REG_PROT_AVAILABLE Spi_Ipw_SetUserAccessAllowed(); #endif #endif #endif /* De-initialize all physical HWUnits */ for (HWUnit = (VAR(Spi_HWUnitType, AUTOMATIC)) 0; HWUnit < (VAR(Spi_HWUnitType, AUTOMATIC)) SPI_MAX_HWUNIT; HWUnit++) { Spi_Ipw_DeInit(HWUnit); } /* initialize all physical HWUnits */ for (HWUnit = (VAR(Spi_HWUnitType, AUTOMATIC)) 0; HWUnit < (VAR(Spi_HWUnitType, AUTOMATIC)) SPI_MAX_HWUNIT; HWUnit++) { Spi_Ipw_Init(HWUnit, &Spi_aSpiHWUnitQueueArray[HWUnit].Status); #if (SPI_LEVEL_DELIVERED == LEVEL1) /* handler uses interrupt mode only if LEVEL 1 is selected */ Spi_Ipw_IrqConfig(HWUnit, SPI_INTERRUPT_MODE); #endif #if (SPI_LEVEL_DELIVERED == LEVEL2) /* handler uses polling mode only if LEVEL 2 is selected */ Spi_Ipw_IrqConfig(HWUnit, SPI_POLLING_MODE); #endif #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /* initialize the Job lists => no scheduled job for the unit */ for (s8Priority = 0; s8Priority < SPI_JOB_PRIORITY_LEVELS_COUNT; s8Priority++) { Spi_aSpiHWUnitQueueArray[HWUnit].aScheduledJobsListHead[s8Priority] = SPI_JOB_NULL; Spi_aSpiHWUnitQueueArray[HWUnit].aScheduledJobsListTail[s8Priority] = SPI_JOB_NULL; } /* no scheduled job => s8MaxScheduledPriority is -1 */ Spi_aSpiHWUnitQueueArray[HWUnit].s8MaxScheduledPriority = -1; #endif Spi_aSpiHWUnitQueueArray[HWUnit].Status = SPI_IDLE; } #if ((SPI_LEVEL_DELIVERED != LEVEL1) && (SPI_OPTIMIZE_ONE_JOB_SEQUENCES == STD_ON)) /* cache information for sequences having only one job */ Spi_Ipw_PrepareCacheInformation(); #endif #if (SPI_PRECOMPILE_SUPPORT == STD_OFF) } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif #endif } /*================================================================================================*/ /** * @brief This function de-initializes the SPI driver. * @details This function de-initializes the SPI driver using the * pre-established configurations * - Service ID: 0x01 * - Sync or Async: Synchronous * - Reentrancy: Non-Reentrant * * @return Std_ReturnType * @retval E_OK de-initialisation command has been accepted * @retval E_NOT_OK de-initialisation command has not been accepted * * @pre The driver needs to be initialized before calling Spi_DeInit() * otherwise, the function Spi_DeInit() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * * @implements Spi_DeInit_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_DeInit(void) { VAR(Std_ReturnType, AUTOMATIC) tempExit = (Std_ReturnType)E_OK; VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_DEINIT_ID,SPI_E_UNINIT); tempExit = (Std_ReturnType)E_NOT_OK; } else { #endif /* Check if Spi Status is Busy */ if (SPI_BUSY == Spi_GetStatus()) { tempExit = (VAR(Std_ReturnType, AUTOMATIC)) E_NOT_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_DEINIT_ID,SPI_E_SEQ_PENDING); #endif } else { /* de-initialize all physical HWUnits */ for (HWUnit = (VAR(Spi_HWUnitType, AUTOMATIC)) 0; HWUnit < (VAR(Spi_HWUnitType, AUTOMATIC)) SPI_MAX_HWUNIT; HWUnit++) { Spi_Ipw_DeInit(HWUnit); Spi_aSpiHWUnitQueueArray[HWUnit].Status = SPI_UNINIT; } /* reset configuration pointer */ Spi_pcSpiConfigPtr = NULL_PTR; } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return tempExit; } /*================================================================================================*/ #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE0) || \ (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) /** * @brief This function writes the given data into the buffer of a specific channel. * @details This function writes the given data into the buffer of a specific channel. * - Service ID: 0x02 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] Channel Channel ID * @param[in] DataBufferPtr Pointer to source data buffer * * @return Std_ReturnType * @retval E_OK Command has been accepted * @retval E_NOT_OK Command has not been accepted * * @pre The driver needs to be initialized before calling Spi_WriteIB() * otherwise, the function Spi_WriteIB() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_CHANNEL_BUFFERS_ALLOWED shall be USAGE0 or USAGE2. * * @implements Spi_WriteIB_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_WriteIB ( VAR(Spi_ChannelType, AUTOMATIC) Channel, P2CONST(Spi_DataBufferType, AUTOMATIC, SPI_APPL_CONST) DataBufferPtr ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; VAR(uint16, AUTOMATIC) u16Index; P2VAR(Spi_ChannelStateType, AUTOMATIC, SPI_APPL_DATA) pChannelState; P2CONST(Spi_ChannelConfigType, AUTOMATIC, SPI_APPL_CONST) pcChannelConfig; P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA) pDataBufferDes; P2CONST(Spi_DataBufferType, AUTOMATIC, SPI_APPL_CONST) pcDataBufferSrc=NULL_PTR; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_WRITEIB_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } /* If Development Error Detection is enabled, report error if invalid channel */ else if (Channel > (Spi_pcSpiConfigPtr->Spi_Max_Channel)) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_WRITEIB_ID,SPI_E_PARAM_CHANNEL); Status = (Std_ReturnType)E_NOT_OK; } else { #endif pChannelState = &Spi_aSpiChannelState[Channel]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcChannelConfig = &Spi_pcSpiConfigPtr->pcChannelConfig[Channel]; /* exit early if this is the wrong buffer type */ if (EB == pcChannelConfig->BufferType) { Status = (Std_ReturnType)E_NOT_OK; /* Call Det_ReportError */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_WRITEIB_ID,SPI_E_PARAM_CHANNEL); #endif } else { /* if DataBufferPtr is zero, then transmit default value */ if (NULL_PTR == DataBufferPtr) { pChannelState->u8Flags |= SPI_CHANNEL_FLAG_TX_DEFAULT_U8; } /* otherwise, copy data from DataBufferPtr to IB */ else { pDataBufferDes = pcChannelConfig->pcBufferDescriptor->pBufferTX; pcDataBufferSrc = DataBufferPtr; for (u16Index = 0u; u16Index < pcChannelConfig->Length; u16Index++) { *pDataBufferDes=*pcDataBufferSrc; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pDataBufferDes++; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pcDataBufferSrc++; } pChannelState->u8Flags = (uint8)(pChannelState->u8Flags & ((uint8)(~SPI_CHANNEL_FLAG_TX_DEFAULT_U8))); } } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif /* Return status */ return Status; } #endif /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /** * @brief This function triggers the asynchronous transmission for the given sequence. * @details This function triggers the asynchronous transmission for the given sequence. * - Service ID: 0x03 * - Sync or Async: Asynchronous * - Reentrancy: Reentrant * * @param[in] Sequence Sequence ID * * @return Std_ReturnType * @retval E_OK Transmission command has been accepted * @retval E_NOT_OK Transmission command has not been accepted * * @pre The driver needs to be initialized before calling Spi_AsyncTransmit() * otherwise, the function Spi_AsyncTransmit() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * * @implements Spi_AsyncTransmit_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_AsyncTransmit ( VAR(Spi_SequenceType, AUTOMATIC) Sequence ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; VAR(Spi_JobType, AUTOMATIC) NumJobsInSequence; VAR(Spi_JobType, AUTOMATIC) JobIndex; VAR(Spi_JobType, AUTOMATIC) Job; P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequenceConfig; P2VAR(Spi_SequenceStateType, AUTOMATIC, SPI_APPL_DATA) pSequenceState; P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig; P2CONST(Spi_JobType, AUTOMATIC, SPI_APPL_CONST) pcJob; P2CONST(Spi_JobType, AUTOMATIC, SPI_APPL_CONST) pcJobCount; #if (SPI_DEV_ERROR_DETECT == STD_ON) VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) VAR(Spi_ChannelType, AUTOMATIC) ChannelID; VAR(Spi_ChannelType, AUTOMATIC) NumChannelsInJob; VAR(Spi_ChannelType, AUTOMATIC) ChannelIndex; #endif #endif #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } /* Sequence Valid Range */ else if (Sequence > (Spi_pcSpiConfigPtr->Spi_Max_Sequence)) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_PARAM_SEQ); Status = (Std_ReturnType)E_NOT_OK; } else { #endif /* (SPI_DEV_ERROR_DETECT == STD_OFF) */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcSequenceConfig = &Spi_pcSpiConfigPtr->pcSequenceConfig[Sequence]; /* Get the number of jobs in the sequence */ NumJobsInSequence = pcSequenceConfig->NumJobs; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* check for empty sequence */ if (0u == NumJobsInSequence) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_SEQ_EMPTY); Status = (Std_ReturnType)E_NOT_OK; } else { /* Do nothing */ } #endif /* (SPI_DEV_ERROR_DETECT == STD_OFF) */ JobIndex = 0u; while(JobIndex < NumJobsInSequence) { /* Get the job id */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Job = pcSequenceConfig->pcJobIndexList[JobIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[Job]; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* check for empty jobs */ if (0u == pcJobConfig->NumChannels) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_JOB_EMPTY); Status = (Std_ReturnType)E_NOT_OK; } else { /* Do nothing */ } /* Logical Spi HWUnit */ HWUnit = pcJobConfig->HWUnit; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ if (SPI_PHYUNIT_ASYNC_U32 != Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u32IsSync) { /* HwUnit is not prearranged for dedicated Asynchronous transmission */ /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_PARAM_UNIT); Status = (Std_ReturnType)E_NOT_OK; } else { /* Do nothing */ } #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) if ((Std_ReturnType)E_OK == Status) { /* Check if all EBs have been setup */ NumChannelsInJob = pcJobConfig->NumChannels; for(ChannelIndex=(Spi_ChannelType)0;ChannelIndex < NumChannelsInJob; ChannelIndex++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ ChannelID = pcJobConfig->pcChannelIndexList[ChannelIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ if (EB == Spi_pcSpiConfigPtr->pcChannelConfig[ChannelID].BufferType) { /* Length is 0 for unconfigured ext. buffers */ if (0U == Spi_aSpiChannelState[ChannelID].Length) { /* An used EB not initialized */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_PARAM_EB_UNIT); Status = (Std_ReturnType)E_NOT_OK; break; } else { /* Do nothing */ } } else { /* Do nothing */ } } } else { /* Do nothing */ } #endif /* ((SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) */ if ((Std_ReturnType)E_OK != Status) { /* break */ break; } else { /* Do nothing */ } #endif /* (SPI_DEV_ERROR_DETECT == STD_OFF) */ JobIndex++; } #if (SPI_DEV_ERROR_DETECT == STD_ON) if ((Std_ReturnType)E_OK == Status) { #endif /* (SPI_DEV_ERROR_DETECT == STD_OFF) */ Status = Spi_LockJobs(Sequence, pcSequenceConfig); if ((Std_ReturnType)E_OK == Status) { pSequenceState = &Spi_aSpiSequenceState[Sequence]; /* Mark sequence pending */ pSequenceState->Result = SPI_SEQ_PENDING; /* Initialize job related information */ pSequenceState->RemainingJobs = pcSequenceConfig->NumJobs - 1u; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJob = &pcSequenceConfig->pcJobIndexList[0]; pSequenceState->pcCurrentJobIndexPointer = pcJob; for(JobIndex = 0u; JobIndex < NumJobsInSequence; JobIndex++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobCount = &pcSequenceConfig->pcJobIndexList[JobIndex]; Spi_aSpiJobState[*pcJobCount].Result = SPI_JOB_QUEUED; } /* Schedule transmission of the first job */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[*pcJob]; Spi_ScheduleJob(&Spi_aSpiHWUnitQueueArray[pcJobConfig->HWUnit], *pcJob, pcJobConfig); } #if (SPI_DEV_ERROR_DETECT == STD_ON) else { /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_ASYNCTRANSMIT_ID,SPI_E_SEQ_PENDING); } } else { /* Do nothing */ } } #endif /* (SPI_DEV_ERROR_DETECT == STD_OFF) */ return Status; } #endif /*================================================================================================*/ #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE0) || \ (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) /** * @brief This function reads the data from the buffer of a channel and puts at the memory location. * @details This function reads the data from the buffer of a specific channel * and puts at the specified memory location. * - Service ID: 0x04 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * * @param[in] Channel Channel ID * @param[in,out] DataBufferPointer Pointer to the memory location that will * be written with the data in the internal * buffer * * @return Std_ReturnType * @retval E_OK read command has been accepted * @retval E_NOT_OK read command has not been accepted * * @pre The driver needs to be initialized before calling Spi_ReadIB() * otherwise, the function Spi_ReadIB() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_CHANNEL_BUFFERS_ALLOWED shall be USAGE0 or USAGE2. * * @implements Spi_ReadIB_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_ReadIB ( VAR(Spi_ChannelType, AUTOMATIC) Channel, P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA) DataBufferPointer ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; VAR(Spi_NumberOfDataType, AUTOMATIC) Index; P2CONST(Spi_ChannelConfigType, AUTOMATIC, SPI_APPL_CONST) pcChannelConfig; P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA) pDataBufferSrc; P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA) pDataBufferDes; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_READIB_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } /* Channel valid range - Channels range is from 0 to Spi_Max_Channel */ else if (Channel > Spi_pcSpiConfigPtr->Spi_Max_Channel) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_READIB_ID,SPI_E_PARAM_CHANNEL); Status = (Std_ReturnType)E_NOT_OK; } else { #endif /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcChannelConfig = &Spi_pcSpiConfigPtr->pcChannelConfig[Channel]; /* exit early if this is the wrong buffer type or destination is invalid */ if (EB == pcChannelConfig->BufferType) { /* Call Det_ReportError */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_READIB_ID,SPI_E_PARAM_CHANNEL); #endif Status = (Std_ReturnType)E_NOT_OK; } else if (NULL_PTR == DataBufferPointer) { /* Call Det_ReportError */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_READIB_ID,SPI_E_PARAM_CHANNEL); #endif Status = (Std_ReturnType)E_NOT_OK; } else { /* Copy Rx buffer to IB buffer */ pDataBufferSrc = pcChannelConfig->pcBufferDescriptor->pBufferRX; pDataBufferDes = DataBufferPointer; for (Index = 0u; Index < pcChannelConfig->Length; Index++) { *pDataBufferDes=*pDataBufferSrc; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pDataBufferDes++; /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pDataBufferSrc++; } } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /*================================================================================================*/ #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || \ (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) /** * @brief This function setup an external buffer to be used by a specific channel. * @details This function setup an external buffer to be used by a specific channel. * - Service ID: 0x05 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] Channel Channel ID * @param[in] SrcDataBufferPtr Pointer to the memory location that will hold * the transmitted data * @param[in] Length Length of the data in the external buffer * @param[out] DesDataBufferPtr Pointer to the memory location that will hold * the received data * * @return Std_ReturnType * @retval E_OK Setup command has been accepted * @retval E_NOT_OK Setup command has not been accepted * * @pre The driver needs to be initialized before calling Spi_SetupEB() * otherwise, the function Spi_SetupEB() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_CHANNEL_BUFFERS_ALLOWED shall be USAGE1 or USAGE2. * * @implements Spi_SetupEB_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_SetupEB ( VAR(Spi_ChannelType, AUTOMATIC) Channel, P2CONST(Spi_DataBufferType, AUTOMATIC, SPI_APPL_CONST) SrcDataBufferPtr, P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA) DesDataBufferPtr, VAR(Spi_NumberOfDataType, AUTOMATIC) Length ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; P2VAR(Spi_ChannelStateType, AUTOMATIC, SPI_APPL_DATA) pChannelState; P2CONST(Spi_ChannelConfigType, AUTOMATIC, SPI_APPL_CONST) pcChannelConfig; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETUPEB_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } /* Channel ID - Valid channels range is from 0 to Spi_Max_Channel*/ else if (Channel > Spi_pcSpiConfigPtr->Spi_Max_Channel) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETUPEB_ID,SPI_E_PARAM_CHANNEL); Status = (Std_ReturnType)E_NOT_OK; } /* Length - Valid range */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ else if ((Length > Spi_pcSpiConfigPtr->pcChannelConfig[Channel].Length) || (0u == Length)) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETUPEB_ID,SPI_E_PARAM_LENGTH); Status = (Std_ReturnType)E_NOT_OK; } else { #endif pChannelState = &Spi_aSpiChannelState[Channel]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcChannelConfig = &Spi_pcSpiConfigPtr->pcChannelConfig[Channel]; /* exit early if this is the wrong buffer type */ if (IB == pcChannelConfig->BufferType) { /* Call Det_ReportError */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETUPEB_ID,SPI_E_PARAM_CHANNEL); #endif Status = (Std_ReturnType)E_NOT_OK; } else { pcChannelConfig->pcBufferDescriptor->pBufferTX = /* * @violates @ref Spi_c_REF_3 A cast should not be performed between a pointer * to object type and a different pointer to object type. */ /* * @violates @ref Spi_c_REF_7 A cast shall not be performed that removes any const or volatile * qualification from the type addressed by a pointer. */ (P2VAR(Spi_DataBufferType, AUTOMATIC, SPI_APPL_DATA)) SrcDataBufferPtr; pcChannelConfig->pcBufferDescriptor->pBufferRX = DesDataBufferPtr; pChannelState->Length = Length; /* if source data pointer is zero, transmit default value */ if (NULL_PTR == SrcDataBufferPtr) { pChannelState->u8Flags |= SPI_CHANNEL_FLAG_TX_DEFAULT_U8; } else { pChannelState->u8Flags &= (uint8) (~SPI_CHANNEL_FLAG_TX_DEFAULT_U8); } /* if destination data pointer is zero, discard receiving data */ if (NULL_PTR == DesDataBufferPtr) { pChannelState->u8Flags |= SPI_CHANNEL_FLAG_RX_DISCARD_U8; } else { pChannelState->u8Flags &= (uint8) (~SPI_CHANNEL_FLAG_RX_DISCARD_U8); } } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /*================================================================================================*/ /** * @brief This function returns the status of the SPI driver. * @details This function returns the status of the SPI driver. * - Service ID: 0x06 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @return Spi_StatusType * @retval SPI_UNINIT The driver is un-initialized * @retval SPI_IDLE The driver has no pending transfers * @retval SPI_BUSY The driver is busy * * @pre The driver needs to be initialized before calling Spi_GetStatus() * otherwise, the function Spi_GetStatus() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * * @implements Spi_GetStatus_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Spi_StatusType, SPI_CODE) Spi_GetStatus(void) { VAR(Spi_StatusType, AUTOMATIC) StatusFlag = SPI_IDLE; VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; if (NULL_PTR == Spi_pcSpiConfigPtr) { #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETSTATUS_ID,SPI_E_UNINIT); #endif StatusFlag = SPI_UNINIT; } else { /* The SPI Handler Driver software module shall be busy when any HWUnit is busy */ for (HWUnit = 0u; HWUnit < (Spi_HWUnitType)SPI_MAX_HWUNIT; HWUnit++) { if (1u == Spi_u32SpiBusySyncHWUnitsStatus[HWUnit]) { StatusFlag = SPI_BUSY; break; } else { /* Do nothing */ } } /* check for busy HWUnit in async transmissions*/ if (SPI_BUSY != StatusFlag) { /* Note: Checking for IsSync attribute for HWUnit is not really needed It is preferable to skip this check in order to have a more compact code */ for (HWUnit = 0u; HWUnit < (Spi_HWUnitType)SPI_MAX_HWUNIT; HWUnit++) { if (SPI_BUSY == Spi_aSpiHWUnitQueueArray[HWUnit].Status) { StatusFlag = SPI_BUSY; break; } else { /* Do nothing */ } } } else { /* Do notthing */ } } return StatusFlag; } /*================================================================================================*/ /** * @brief This function is used to request the status of a specific job. * @details This function is used to request the status of a specific job. * - Service ID: 0x07 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] Job Job ID * * @return Spi_JobResultType * @retval SPI_JOB_OK The job ended successfully * @retval SPI_JOB_PENDING The job is pending * @retval SPI_JOB_FAILED The job has failed * * @pre The driver needs to be initialized before calling Spi_GetJobResult() * otherwise, the function Spi_GetJobResult() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * * @implements Spi_GetJobResult_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Spi_JobResultType, SPI_CODE) Spi_GetJobResult ( VAR(Spi_JobType, AUTOMATIC) Job ) { VAR(Spi_JobResultType, AUTOMATIC) JobResult; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { JobResult = SPI_JOB_FAILED; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETJOBRESULT_ID,SPI_E_UNINIT); } /* Job Valid Range - from 0 to Spi_Max_Job*/ else if (Job > Spi_pcSpiConfigPtr->Spi_Max_Job) { JobResult = SPI_JOB_FAILED; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETJOBRESULT_ID,SPI_E_PARAM_JOB); } else { #endif JobResult = Spi_aSpiJobState[Job].Result; #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return JobResult; } /*================================================================================================*/ /** * @brief This function is used to request the status of a specific sequence. * @details This function is used to request the status of a specific sequence. * - Service ID: 0x08 * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] Sequence Sequence ID * * @return Spi_SeqResultType * @retval SPI_SEQ_OK The sequence ended successfully * @retval SPI_SEQ_PENDING The sequence is pending * @retval SPI_SEQ_FAILED The sequence has failed * * @pre The driver needs to be initialized before calling Spi_GetSequenceResult() * otherwise, the function Spi_GetSequenceResult() shall raise the development * error if SPI_DEV_ERROR_DETECT is STD_ON. * * @implements Spi_GetSequenceResult_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Spi_SeqResultType, SPI_CODE) Spi_GetSequenceResult ( VAR(Spi_SequenceType, AUTOMATIC) Sequence ) { VAR(Spi_SeqResultType, AUTOMATIC) SequenceResult; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { SequenceResult = SPI_SEQ_FAILED; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETSEQUENCERESULT_ID,SPI_E_UNINIT); } /* Sequence Valid Range from 0 to Spi_Max_Sequence*/ else if (Sequence > Spi_pcSpiConfigPtr->Spi_Max_Sequence) { SequenceResult = SPI_SEQ_FAILED; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETSEQUENCERESULT_ID,SPI_E_PARAM_SEQ); } else { #endif SequenceResult = Spi_aSpiSequenceState[Sequence].Result; #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return SequenceResult; } #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) /*================================================================================================*/ /** * @brief This function is used for synchronous transmission of a given sequence. * @details This function is used for synchronous transmission of a given sequence. * - Service ID: 0x0a * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] Sequence Sequence ID * * @return Std_ReturnType * @retval E_OK Transmission command has been completed successfully * @retval E_NOT_OK Transmission command has not been accepted * * @pre The driver needs to be initialized before calling Spi_SyncTransmit(). * otherwise, the function Spi_SyncTransmit() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL0 or LEVEL2 * * @implements Spi_SyncTransmit_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_SyncTransmit ( VAR(Spi_SequenceType, AUTOMATIC) Sequence ) { P2VAR(Spi_SequenceStateType, AUTOMATIC, SPI_APPL_DATA) pSequenceState; VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; VAR(uint32, AUTOMATIC) u32SpiSequenceUsedHWUnits; VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; VAR(Spi_JobType, AUTOMATIC) JobIndex; P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequenceConfig; VAR(Spi_JobType, AUTOMATIC) NumJobsInSequence; VAR(Spi_JobType, AUTOMATIC) Job; P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig; #if (SPI_DEV_ERROR_DETECT == STD_ON) VAR(uint32, AUTOMATIC) u32UnitIsSync; #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) VAR(Spi_ChannelType, AUTOMATIC)ChannelID; VAR(Spi_ChannelType, AUTOMATIC) NumChannelsInJob; VAR(Spi_ChannelType, AUTOMATIC)ChannelIndex; #endif #endif #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SYNCTRANSMIT_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } /* Sequence Valid Range */ else if (Sequence > Spi_pcSpiConfigPtr->Spi_Max_Sequence) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SYNCTRANSMIT_ID,SPI_E_PARAM_SEQ); Status = (Std_ReturnType)E_NOT_OK; } else { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcSequenceConfig = &Spi_pcSpiConfigPtr->pcSequenceConfig[Sequence]; /* Get the number of jobs in the sequence */ NumJobsInSequence = pcSequenceConfig->NumJobs; for (JobIndex = 0u; JobIndex < NumJobsInSequence; JobIndex++) { /* Get the job id */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Job = pcSequenceConfig->pcJobIndexList[JobIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[Job]; /* Logical Spi HWUnit */ HWUnit = pcJobConfig->HWUnit; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ u32UnitIsSync = Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u32IsSync; if ((uint32)(SPI_PHYUNIT_ASYNC_U32) == (u32UnitIsSync)) { /* HwUnit is not prearranged for dedicated Synchronous transmission */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SYNCTRANSMIT_ID,SPI_E_PARAM_UNIT); Status = (Std_ReturnType)E_NOT_OK; } else { /* Do nothing */ } #if ( (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) if ((Std_ReturnType)E_OK == Status) { /* Check if all EBs have been setup */ NumChannelsInJob = pcJobConfig->NumChannels; for(ChannelIndex=(Spi_ChannelType)0;ChannelIndex < NumChannelsInJob; ChannelIndex++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ ChannelID = pcJobConfig->pcChannelIndexList[ChannelIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ if (EB == Spi_pcSpiConfigPtr->pcChannelConfig[ChannelID].BufferType) { /* Channel length is 0 for unconfigured ext. buffers */ if (0U == Spi_aSpiChannelState[ChannelID].Length) { /* An used EB not initialized */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID, (uint8) 0,SPI_SYNCTRANSMIT_ID,SPI_E_PARAM_EB_UNIT); Status = (Std_ReturnType)E_NOT_OK; break; } else { /* Do nothing */ } } else { /* Do nothing */ } } } else { /* Do nothing */ } #endif /* ((SPI_CHANNEL_BUFFERS_ALLOWED == USAGE1) || (SPI_CHANNEL_BUFFERS_ALLOWED == USAGE2) ) */ if ((Std_ReturnType)E_NOT_OK == Status) { /* break */ break; } else { /* Do nothing */ } } if ((Std_ReturnType)E_NOT_OK != Status) { #endif /* (SPI_DEV_ERROR_DETECT == STD_ON) */ u32SpiSequenceUsedHWUnits = Spi_au32SpiSeqUsedHWUnits[Sequence]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcSequenceConfig = &Spi_pcSpiConfigPtr->pcSequenceConfig[Sequence]; /* Get the number of jobs in the sequence */ NumJobsInSequence = pcSequenceConfig->NumJobs; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_01(); /* check if there are HW units already running */ for (HWUnit = 0u; HWUnit < (Spi_HWUnitType)SPI_MAX_HWUNIT; HWUnit++) { /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ if(0u != ((Spi_u32SpiBusySyncHWUnitsStatus[HWUnit] << Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u8Offset) & u32SpiSequenceUsedHWUnits)) { Status = (Std_ReturnType)E_NOT_OK; } else { /* Do notthing */ } } if ((Std_ReturnType)E_NOT_OK != Status) { /* Set the sequence as pending */ pSequenceState = &Spi_aSpiSequenceState[Sequence]; pSequenceState->Result = SPI_SEQ_PENDING; /* set used HW units as busy */ for (JobIndex = 0u; JobIndex < NumJobsInSequence; JobIndex++) { /* Get the job id */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Job = pcSequenceConfig->pcJobIndexList[JobIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[Job]; /* Logical Spi HWUnit */ HWUnit = pcJobConfig->HWUnit; Spi_u32SpiBusySyncHWUnitsStatus[HWUnit] = 1u; } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_01(); /* Call IPW function to transfer */ Status = Spi_Ipw_SyncTransmit(Sequence); SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_02(); if ((Std_ReturnType)E_OK == Status) { /* Set the sequence as OK */ pSequenceState->Result = SPI_SEQ_OK; } else { /* Set the sequence as FAILED */ pSequenceState->Result = SPI_SEQ_FAILED; } /* set used HW units as idle */ for (JobIndex = 0u; JobIndex < NumJobsInSequence; JobIndex++) { /* Get the job id */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Job = pcSequenceConfig->pcJobIndexList[JobIndex]; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[Job]; /* Logical Spi HWUnit */ HWUnit = pcJobConfig->HWUnit; Spi_u32SpiBusySyncHWUnitsStatus[HWUnit] = 0u; } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_02(); } else { SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_01(); #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_3 If a function returns error information, * then that error information shall be tested. */ (void)Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SYNCTRANSMIT_ID,SPI_E_SEQ_IN_PROCESS); #endif } #if (SPI_DEV_ERROR_DETECT == STD_ON) } else { /* Do nothing */ } } #endif return Status; } #endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL2) || (SPI_LEVEL_DELIVERED == LEVEL0) ) */ /*================================================================================================*/ #if (SPI_HW_STATUS_API == STD_ON) /** * @brief This function is used to request the status of a specific SPI peripheral unit. * @details This function is used to request the status of a specific SPI peripheral unit. * - Service ID: 0x0b * - Sync or Async: Synchronous * - Reentrancy: Reentrant * * @param[in] HWUnit The HW peripheral for which we need the status * * @return Spi_StatusType * @retval SPI_UNINIT The peripheral is un-initialized * @retval SPI_IDLE The peripheral is in idle state * @retval SPI_BUSY The peripheral is busy * * @pre The driver needs to be initialized before calling Spi_GetHWUnitStatus() * otherwise, the function Spi_GetHWUnitStatus() shall raise the development * error if SPI_DEV_ERROR_DETECT is STD_ON. * @pre SPI_HW_STATUS_API == STD_ON * * @implements Spi_GetHWUnitStatus_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Spi_StatusType, SPI_CODE) Spi_GetHWUnitStatus ( VAR(Spi_HWUnitType, AUTOMATIC) HWUnit ) { VAR(Spi_StatusType, AUTOMATIC) Status; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (Spi_pcSpiConfigPtr == NULL_PTR) { Status = SPI_UNINIT; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETHWUNITSTATUS_ID,SPI_E_UNINIT); } else if (HWUnit >= SPI_MAX_HWUNIT) { Status = SPI_UNINIT; /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_GETHWUNITSTATUS_ID,SPI_E_PARAM_UNIT); } else { #endif Status = Spi_aSpiHWUnitQueueArray[HWUnit].Status; #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /*================================================================================================*/ #if (SPI_CANCEL_API == STD_ON) /** * @brief This function is used to request the cancelation of the given sequence. * @details This function is used to request the cancelation of the given sequence. * - Service ID: 0x0c * - Sync or Async: Asynchronous * - Reentrancy: Reentrant * * @param[in] Sequence Sequence ID * * @pre The driver needs to be initialized before calling Spi_Cancel() * otherwise, the function Spi_Cancel() shall raise the development error * if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_CANCEL_API shall be STD_ON * @post The SPI Handler Driver is not responsible on external devices damages or * undefined state due to cancelling a sequence transmission. * * @implements Spi_Cancel_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(void, SPI_CODE) Spi_Cancel(VAR(Spi_SequenceType, AUTOMATIC) Sequence) { #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (Spi_pcSpiConfigPtr == NULL_PTR) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_CANCEL_ID,SPI_E_UNINIT); } /* Sequence Valid Range from 0 to Spi_Max_Sequence*/ else if (Sequence > Spi_pcSpiConfigPtr->Spi_Max_Sequence) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_CANCEL_ID,SPI_E_PARAM_SEQ); } else { #endif /* Set sequence state to Cancel */ Spi_aSpiSequenceState[Sequence].Result = SPI_SEQ_CANCELLED; /* In Slave mode: Stop sequence immediately */ #if (SPI_SLAVE_SUPPORT == STD_ON) Spi_Ipw_SlaveCancel(Sequence); #endif #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif } #endif /*================================================================================================*/ #if (SPI_LEVEL_DELIVERED == LEVEL2) /** * @brief This function specifies the asynchronous mode for the SPI busses handled asynchronously. * @details This function specifies the asynchronous mode for the SPI busses * handled asynchronously. * - Service ID: 0x0d * - Sync or Async: Synchronous * - Reentrancy: Non-Reentrant * * @param[in] AsyncMode This parameter specifies the asynchronous * operating mode (SPI_POLLING_MODE or * SPI_INTERRUPT_MODE) * * @return Std_ReturnType * @retval E_OK The command ended successfully * @retval E_NOT_OK The command has failed * * @pre The driver needs to be initialized before calling Spi_SetAsyncMode() * otherwise, the function Spi_SetAsyncMode() shall raise the development * error if SPI_DEV_ERROR_DETECT is STD_ON. * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL2 * * @implements Spi_SetAsyncMode_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_SetAsyncMode ( VAR(Spi_AsyncModeType, AUTOMATIC) AsyncMode ) { VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (Spi_pcSpiConfigPtr == NULL_PTR) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETASYNCMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else { #endif if (SPI_BUSY == Spi_GetAsyncStatus()) { #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETASYNCMODE_ID,SPI_E_SEQ_PENDING); #endif Status = (Std_ReturnType)E_NOT_OK; } else { /* set the async mode for each HW Unit; activate/deactivate EOQ interrupts for Async HWUnits */ for (HWUnit = 0u; HWUnit < (Spi_HWUnitType) SPI_MAX_HWUNIT; HWUnit++) { Spi_Ipw_IrqConfig(HWUnit, AsyncMode); } } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL2) && (SPI_HWUNIT_ASYNC_MODE == STD_ON)) /** * @brief This function specifies the asynchronous mode for a given HWUnit. * @details This function specifies the asynchronous mode for the SPI busses * handled asynchronously. * For synchronous HW units, the function has no impact. * The function will fail in two cases: * - driver not initialised (SPI_E_UNINIT reported by DET) * - a sequence transmission is pending the the asynchronous HW unit * (SPI_E_SEQ_PENDING reported by DET) * * @param[in] HWUnit The ID of the HWUnit to be configured * @param[in] AsyncMode This parameter specifies the asynchronous * operating mode (SPI_POLLING_MODE or * SPI_INTERRUPT_MODE) * * @return Std_ReturnType * @retval E_OK The command ended successfully * @retval E_NOT_OK The command has failed * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL2 and * SPI_HWUNIT_ASYNC_MODE should be on STD_ON * * @implements Spi_SetHWUnitAsyncMode_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_SetHWUnitAsyncMode ( VAR(Spi_HWUnitType, AUTOMATIC) HWUnit, VAR(Spi_AsyncModeType, AUTOMATIC) AsyncMode ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (Spi_pcSpiConfigPtr == NULL_PTR) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETHWUNITASYNCMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else if (HWUnit >= SPI_MAX_HWUNIT) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETHWUNITASYNCMODE_ID,SPI_E_PARAM_UNIT); Status = (Std_ReturnType)E_NOT_OK; } else { #endif /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ if (SPI_PHYUNIT_ASYNC_U32 != Spi_pcSpiConfigPtr->pcHWUnitConfig[HWUnit].u32IsSync) { /* return E_NOT_OK if HWUnit is Sync */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETHWUNITASYNCMODE_ID,SPI_E_PARAM_UNIT); #endif Status = (Std_ReturnType)E_NOT_OK; } else if (SPI_BUSY == Spi_aSpiHWUnitQueueArray[HWUnit].Status) { /* return E_NOT_OK if HWUnit is Async and Busy */ #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETHWUNITASYNCMODE_ID,SPI_E_SEQ_PENDING); #endif Status = (Std_ReturnType)E_NOT_OK; } else { /* set the async mode & activate/deactivate the interrupts for the HW Unit */ Spi_Ipw_IrqConfig(HWUnit, AsyncMode); } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /* (SPI_LEVEL_DELIVERED == LEVEL2) && (SPI_HWUNIT_ASYNC_MODE == STD_ON) */ /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /** * @brief This function shall asynchronously poll SPI interrupts and call ISR if appropriate. * @details This function shall asynchronously poll SPI interrupts and call * ISR if appropriate. * - Service ID: 0x10 * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * * @implements Spi_MainFunction_Handling_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(void, SPI_CODE) Spi_MainFunction_Handling(void) { VAR(Spi_HWUnitType, AUTOMATIC) HWUnit; if (NULL_PTR != Spi_pcSpiConfigPtr) { for (HWUnit = 0u; HWUnit < (Spi_HWUnitType) SPI_MAX_HWUNIT; HWUnit++) { if (SPI_BUSY == Spi_aSpiHWUnitQueueArray[HWUnit].Status) { Spi_Ipw_IrqPoll(HWUnit); } else { /* Do nothing */ } } } } #endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2) ) */ /*================================================================================================*/ /** * @brief This function starts the transfer of the first scheduled job for a given HW unit. * @details If the list of scheduled jobs is not empty, pop the first job and * start the transfer. Elsewhere, mark the HW unit as IDLE. * * @param[in] pHWUnitQueue The HW Unit used for scheduling * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * */ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) static FUNC(void, SPI_CODE) Spi_ScheduleNextJob ( P2VAR(Spi_HWUnitQueue, AUTOMATIC, SPI_APPL_DATA) pHWUnitQueue ) { VAR(Spi_JobType, AUTOMATIC) Job; P2VAR(Spi_JobType, AUTOMATIC, SPI_APPL_DATA) pJobListHead; VAR(sint8, AUTOMATIC) s8Priority; VAR(sint8, AUTOMATIC) s8MaxScheduledPriority = pHWUnitQueue->s8MaxScheduledPriority; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_04(); if (0 > s8MaxScheduledPriority) { /* no job waiting => mark the HWUnit as IDLE */ pHWUnitQueue->Status = SPI_IDLE; SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_04(); } else { /* a job is waiting => get the job ID from the highest priority queue */ pJobListHead = &pHWUnitQueue->aScheduledJobsListHead[s8MaxScheduledPriority]; Job = *pJobListHead; /* set the new head of the list */ *pJobListHead = Spi_aSpiJobState[Job].AsyncNextJob; /* if the list is empty, set the tail accordingly and adjust the scheduled priority level */ if (SPI_JOB_NULL == *pJobListHead) { /* reset the tail */ pHWUnitQueue->aScheduledJobsListTail[s8MaxScheduledPriority] = SPI_JOB_NULL; /* find the first non empty scheduling queue */ for (s8Priority = s8MaxScheduledPriority - 1; s8Priority >= 0; s8Priority--) { if (SPI_JOB_NULL != pHWUnitQueue->aScheduledJobsListHead[s8Priority]) { /* there is a scheduled Job for this priority level */ break; } else { /* Do nothing */ } } /* Priority is set on the highest priority queue having scheduled jobs, or -1 if no other jobs scheduled */ pHWUnitQueue->s8MaxScheduledPriority = s8Priority; } else { /* Do nothing */ } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_04(); /* mark the job as pending */ Spi_aSpiJobState[Job].Result = SPI_JOB_PENDING; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ Spi_Ipw_JobTransfer(&Spi_pcSpiConfigPtr->pcJobConfig[Job]); } } #endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2) ) */ /*================================================================================================*/ #if ((SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2)) /** * @brief This function is called after a Job has been executed. * @details The function calls Job and Sequence end notifications and schedules * the next job of the sequence or on the liberated HW Unit. * * @param[in] pcJobConfig The just transmited job pointer. * * @pre Pre-compile parameter SPI_LEVEL_DELIVERED shall be LEVEL1 or LEVEL2. * * @implements Spi_JobTransferFinished_Activity */ FUNC(void, SPI_CODE) Spi_JobTransferFinished ( P2CONST(Spi_JobConfigType, AUTOMATIC, SPI_APPL_CONST) pcJobConfig ) { VAR(Spi_HWUnitType, AUTOMATIC) HWUnit = pcJobConfig->HWUnit; P2VAR(Spi_HWUnitQueue, AUTOMATIC, SPI_APPL_DATA) pHWUnitQueue = &Spi_aSpiHWUnitQueueArray[HWUnit]; P2VAR(Spi_JobStateType, AUTOMATIC, SPI_APPL_DATA) pJobState = pcJobConfig->pJobState; P2VAR(Spi_SequenceStateType, AUTOMATIC, SPI_APPL_DATA) pSequenceState = pJobState->pAsyncCrtSequenceState; P2CONST(Spi_SequenceConfigType, AUTOMATIC, SPI_APPL_CONST) pcSequenceConfig = pSequenceState->pcSequence; P2CONST(Spi_JobType, AUTOMATIC, SPI_APPL_CONST) pcJob; VAR(Spi_JobType, AUTOMATIC) Job; SchM_Enter_Spi_SPI_EXCLUSIVE_AREA_07(); pJobState->Result = SPI_JOB_OK; /* unlink the job from its sequence */ pJobState->pAsyncCrtSequenceState = NULL_PTR; /* Perform job EndNotification (if there is one) */ if (NULL_PTR != pcJobConfig->pfEndNotification) { pcJobConfig->pfEndNotification(); } else { /* Do nothing */ } #if (SPI_CANCEL_API == STD_ON) /* Check if current sequence has been cancelled */ if (SPI_SEQ_CANCELLED == pSequenceState->Result) { /* unlock jobs */ Spi_UnlockRemainingJobs(pSequenceState->RemainingJobs, pcSequenceConfig); SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_07(); if (NULL_PTR != pcSequenceConfig->pfEndNotification) { pcSequenceConfig->pfEndNotification(); } else { /* Do nothing */ } Spi_ScheduleNextJob(pHWUnitQueue); } else { #endif /* Check if this job is the last one */ if (0u == pSequenceState->RemainingJobs) { /* Reset sequence state */ pSequenceState->Result = SPI_SEQ_OK; SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_07(); /* SeqEndNotification */ if (NULL_PTR != pcSequenceConfig->pfEndNotification) { pcSequenceConfig->pfEndNotification(); } else { /* Do nothing */ } Spi_ScheduleNextJob(pHWUnitQueue); } else { /* advance to the next job */ /* * @violates @ref Spi_c_REF_6 Array indexing shall be * the only allowed form of pointer arithmetic. */ pSequenceState->pcCurrentJobIndexPointer++; pcJob = pSequenceState->pcCurrentJobIndexPointer; Job = *pcJob; pSequenceState->RemainingJobs--; /* * @violates @ref Spi_c_REF_6 Array indexing shall be the only allowed form of pointer arithmetic. */ pcJobConfig = &Spi_pcSpiConfigPtr->pcJobConfig[Job]; if (HWUnit != pcJobConfig->HWUnit) { /* schedule the next job on the new DSPI unit */ Spi_ScheduleJob(&Spi_aSpiHWUnitQueueArray[pcJobConfig->HWUnit], Job, pcJobConfig); /* transmit the next scheduled job on the current DSPI unit */ Spi_ScheduleNextJob(pHWUnitQueue); } else { /* the next job uses the same DSPI unit */ #if (SPI_INTERRUPTIBLE_SEQ_ALLOWED == STD_ON) if (pcSequenceConfig->u8Interruptible) { /* if the sequence is interruptible, then schedule the next job */ /* DSPI is marked as BUSY => the new job is scheduled only */ Spi_ScheduleJob(pHWUnitQueue, Job, pcJobConfig); /* run the first eligible job */ Spi_ScheduleNextJob(pHWUnitQueue); } else #endif { /* non-interruptible sequence => start transmission without scheduling */ /* mark the job as pending */ Spi_aSpiJobState[Job].Result = SPI_JOB_PENDING; Spi_Ipw_JobTransfer(pcJobConfig); } } SchM_Exit_Spi_SPI_EXCLUSIVE_AREA_07(); } #if (SPI_CANCEL_API == STD_ON) } #endif } #endif /* #if ( (SPI_LEVEL_DELIVERED == LEVEL1) || (SPI_LEVEL_DELIVERED == LEVEL2) ) */ #if (SPI_DUAL_CLOCK_MODE == STD_ON) /*================================================================================================*/ /** * @brief This function shall set different MCU clock configuration . * @details This function shall set different MCU clock configuration . * * @param[in] ClockMode Clock mode to be set (SPI_NORMAL | SPI_ALTERNATE). * * @return Std_ReturnType * @retval E_OK The driver is initialised and in an IDLE state. The clock * mode can be changed. * @retval E_NOT_OK The driver is NOT initialised OR is NOT in an IDLE state. * The clock mode can NOT be changed. * * @pre Pre-compile parameter SPI_DUAL_CLOCK_MODE shall be STD_ON. * * @implements Spi_SetClockMode_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_SetClockMode ( VAR(Spi_DualClockModeType,AUTOMATIC) ClockMode ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* If Development Error Detection is enabled, report error if not */ /* initialized */ if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETCLOCKMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else { #endif /* Check if Spi Status is Busy */ if (SPI_BUSY == Spi_GetStatus()) { Status = (VAR(Std_ReturnType, AUTOMATIC)) E_NOT_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) /* Call Det_ReportRuntimeError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportRuntimeError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETCLOCKMODE_ID,SPI_E_SEQ_PENDING); #endif } else { SPI_IPW_SET_CLOCK_MODE(ClockMode); } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /* #if (SPI_DUAL_CLOCK_MODE == STD_ON) */ #ifdef TSB_MODE_SUPPORTED #if (SPI_TSB_MODE == STD_ON) /*================================================================================================*/ /** * @brief This function shall to enable user to access the Micro Second Bus functionality . * @details A non-Autosar API to support the configuration of the TSB * to enable user to access the Micro Second Bus functionality * * @param[in] Spi_JobType Specifies the job configured in TSB mode * * @return Std_ReturnType * @retval E_OK The driver is initialised . The TSB mode can be configured. * @retval E_NOT_OK The driver is NOT initialised * * @pre Pre-compile parameter SPI_TSB_MODE shall be STD_ON. * * @implements Spi_TSBStart_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_TSBStart ( VAR(Spi_JobType, AUTOMATIC) TSBJob ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else if (TSBJob > SPI_MAX_TSBJOBS) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_TSBJOB); Status = (Std_ReturnType)E_NOT_OK; } else { #endif { Spi_Ipw_SetTSBMode(TSBJob); } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } /*================================================================================================*/ /** * @brief This function shall to stop teh transfer in TSB mode. * @details A non-Autosar API to support the configuartion of the TSB * Hardware is deinitialized to master and SPI mode. * * @param[in] Spi_JobType Job configured in TSB mode * * @return Std_ReturnType * @retval E_OK The driver is initialised . The TSB mode can be configured. * @retval E_NOT_OK The driver is NOT initialised * * @pre Pre-compile parameter SPI_TSB_MODE shall be STD_ON. * * @implements Spi_TSBStop_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_TSBStop ( VAR(Spi_JobType, AUTOMATIC) TSBJob ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else if (TSBJob > SPI_MAX_TSBJOBS) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_TSBJOB); Status = (Std_ReturnType)E_NOT_OK; } else { #endif { Spi_Ipw_StopTSBMode(TSBJob); } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } /*================================================================================================*/ /** * @brief This function shall to enable user to write data in ASDR while using Micro Second Bus. * @details A non-Autosar API to support the configuartion of the TSB * to enable user to access the Micro Second Bus functionality * * @param[in] Spi_JobType Specifies the job confgiured in TSB mode * * @return Std_ReturnType * @retval E_OK The driver is initialised . The TSB mode can be configured. * @retval E_NOT_OK The driver is NOT initialised * * @pre Pre-compile parameter SPI_TSB_MODE shall be STD_ON. * * @implements Spi_TSB_ASDR_DataUpdate_Activity */ /* * @violates @ref Spi_c_REF_4 All declarations and definitions of objects or * functions at file scope shall have internal linkage unless external linkage is required. */ FUNC(Std_ReturnType, SPI_CODE) Spi_TSB_ASDR_DataUpdate ( VAR(Spi_JobType, AUTOMATIC) TSBJob, P2CONST(uint32, AUTOMATIC,SPI_APPL_CONST) pcASDR_Data ) { VAR(Std_ReturnType, AUTOMATIC) Status = (Std_ReturnType)E_OK; #if (SPI_DEV_ERROR_DETECT == STD_ON) if (NULL_PTR == Spi_pcSpiConfigPtr) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_UNINIT); Status = (Std_ReturnType)E_NOT_OK; } else if (TSBJob > SPI_MAX_TSBJOBS) { /* Call Det_ReportError */ /* * @violates @ref Spi_c_REF_9 If a function returns error information, * then that error information shall be tested. */ Det_ReportError((uint16) SPI_MODULE_ID,(uint8) 0,SPI_SETTSBMODE_ID,SPI_E_TSBJOB); Status = (Std_ReturnType)E_NOT_OK; } else { #endif { Spi_Ipw_TSB_ASDR_DataUpdate(TSBJob, pcASDR_Data); } #if (SPI_DEV_ERROR_DETECT == STD_ON) } #endif return Status; } #endif /*SPI_TSB_MODE == STD_ON*/ #endif /*TSB_MODE_SUPPORTED*/ /*================================================================================================*/ #define SPI_STOP_SEC_CODE /* * @violates @ref Spi_c_REF_1 #include statements in a file should only be preceded * by other preprocessor directives or comments. * @violates @ref Spi_c_REF_2 Precautions shall be taken in order to prevent the contents * of a header file being included twice. */ #include "Spi_MemMap.h" #ifdef __cplusplus } #endif /** @} */
a6c515b78552071d1f4d4a18fcd8a80f7cc05c8e
fb91185c9a7f0d12981d3321b15571685dd266fd
/3.19/source/main.c
c8263f644c33fdff9e886f274110f764a4f78566
[]
no_license
gun1205/C-homework02
3f6b5858321dc6e9c612e84a2b928243d9f9e370
dc0359d34b6b718b0d7563f675523cbcc097753c
refs/heads/master
2023-08-25T14:59:21.479429
2021-10-27T10:48:48
2021-10-27T10:48:48
null
0
0
null
null
null
null
UTF-8
C
false
false
551
c
main.c
#include <stdio.h> #include <stdlib.h> int main(void) { float principal, rate, days, charge; printf("Enter loan principal (-1 to 100):"); scanf_s("%f", &principal); while (principal != -1) { printf("Enter interest rate:"); scanf_s("%f", &rate); printf("Enter term of the loan in days:"); scanf_s("%f", &days); charge = principal*rate*days / 365; printf("The interest charge is $ %.2f\n", charge); printf("Enter loan principal (-1 to 100):"); scanf_s("%f", &principal); } if (principal == -1) { return 0; } }
0171bcb1424e3e9eb12dd711967abac62726eb44
7aafe04b3be9e3e8e7485ce3a0ad4414be1e1384
/BinarySearchTree/bstMaker.c
17516fb6f5fedfbc702160a00b3eefb289ad7ec3
[]
no_license
Adam-Makaoui/Low-Level-Programming
5d512c5bf79a919600620169aa6b3b451064a24d
cdcf1c0b4a8b1d1b5fbb536792eb469052dcce17
refs/heads/master
2023-06-04T07:42:27.767179
2021-06-26T17:57:34
2021-06-26T17:57:34
156,791,351
0
0
null
null
null
null
UTF-8
C
false
false
961
c
bstMaker.c
/** * This class creates a bst given any data * * @author Adam M., 250726961 */ #include <stdio.h> #include "bst.h" int main(void) { BStree bst; //pointer to the BST int size, id, data; char quit, name[256]; printf("Enter the size of the tree: \n"); scanf("%d", &size); bst = bstree_ini(size); //creating the bst //printf("Enter "); while (scanf("%s %d %d", name, &id, &data)==3) { printf("enter the new key (str) then the data (int) separated by whitespace: \n"); bstree_insert(bst, key_construct(name,id), data); printf("Add was successful!\n"); printf("Enter Q/q if you wish to stop inserting \n"); scanf(" %c", &quit); if(quit == 'Q' || quit == 'q') break; } bstree_traversal(bst); bstree_free(bst); return 0; }
d625fd710c065045d313195a6a268ab3f429a2cf
e40003253b3108ce10fa1407cadca8e0bc4eac7e
/sprites/final_c_arrays/bmp_arsh_slide.c
256d21b6b8584bf536a5b8690b06d0d123ac8f93
[ "MIT" ]
permissive
jvaneg/ARSH
8ba162f439b6c83626d5d1e7095752264d198275
c6eab54bec50802838e3abc0bc38795c8e7e20d5
refs/heads/master
2020-12-30T11:39:52.523850
2019-01-08T09:11:47
2019-01-08T09:11:47
91,514,979
2
1
null
null
null
null
UTF-8
C
false
false
2,313
c
bmp_arsh_slide.c
/* Name: arsh_slide Size: UINT32 Width: 96 Height: 60 */ UINT32 bmp_arsh_slide_96 [] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000F80, 0x00000000, 0x00000000, 0x00003040, 0x00000000, 0x00000000, 0x00004020, 0x00000000, 0x00000000, 0x0003E010, 0x00000000, 0x00000000, 0x000C1008, 0x00000000, 0x00000000, 0x00300004, 0x00000000, 0x00000000, 0x00C00002, 0x70000000, 0x00000000, 0x03000001, 0x8E3FF000, 0x00000000, 0x06000000, 0x82FFF800, 0x00000000, 0x0C000000, 0x83E01800, 0x00000000, 0x08000000, 0xC1801800, 0x00000000, 0x08000003, 0xC1001800, 0x00000000, 0x0800000F, 0xE1001800, 0x00000000, 0x0800003F, 0x01003800, 0x00000000, 0x080000FC, 0x06003000, 0x00000000, 0x080003F0, 0x0C007000, 0x00000000, 0x08000FC0, 0x3F007000, 0x00000000, 0x0801FF00, 0xFF80E000, 0x00000000, 0x080600F3, 0x8FC1E000, 0x00000000, 0x0818000E, 0x07FFFFFF, 0xF8000000, 0x04600018, 0x07FFFFFF, 0xFE000000, 0x05800060, 0x03FFFFFF, 0xFF000000, 0x06000180, 0x03FFFFFF, 0xFF000000, 0x04000600, 0x03FFFFFF, 0xFF803000, 0x18001800, 0x07FFFFFF, 0xFF80F800, 0x30007800, 0x07FFFFFF, 0xFF83FC00, 0x6001F000, 0x0FFFFFFF, 0xFF9FDE00, 0x4007F000, 0x1FFFFFFF, 0xFFFF0E00, 0x801FF000, 0x3FFFFFFF, 0xFFF80700, 0x807FF800, 0x7FFFFFFF, 0xFFE00300, 0x7BFFF800, 0xFFFFFFFF, 0xFF800180, 0x04FFFC01, 0xFFFFFFFF, 0xFF8001C0, 0x00FFFE03, 0xFFFFFFFF, 0xFF8003E7, 0x007FFF8F, 0xFFFFFFFF, 0xFF80017F, 0x003FFFFF, 0xFFFFFFFF, 0xFF80007E, 0x001FFFFF, 0xFFFFFFFF, 0xFF80003C, 0x000FFFFF, 0xFFFFFFFF, 0xFF800018, 0x0007FFFF, 0xFFFFFFFF, 0xFF800000, 0x0003FFFF, 0xFFFFFFFF, 0xFF800000, 0x0001FFFF, 0xFFFFFFFF, 0xFF803000, 0x0000FFFF, 0xFFFFFFFF, 0xFF80F800, 0x00007FFF, 0xFFFFFFFF, 0xFF83FC00, 0x00007FFF, 0xFFFFFFFF, 0xFF9F9C00, 0x0000FFFF, 0xFFFFFFFF, 0xFFFF0E00, 0x0001FFFF, 0xFFFFFFFF, 0xFFF80700, 0x0003C7FF, 0xFFFFFFFF, 0xFFE00300, 0x000781FF, 0xFFFFFFFF, 0xFF800180, 0x000F00FF, 0xFFFFFFFF, 0xFF8001C7, 0x000E007F, 0xFFFFFFFF, 0xFF8003FF, 0x001C003F, 0xFFFFFFFF, 0xFF00017E, 0x001E019F, 0xFFFFFFFF, 0xFF00003C, 0x001FFF8F, 0xFFFFFFFF, 0xFE000018, 0x0007FE03, 0xFFFFFFFF, 0xF8000000 };
ccc56aa6b0ce474e2106283857e38dcf1b41e513
f99f7594cc9e62d1a4b8cc8b6ae2fbc84381b44c
/user/modules/vpn/bin/sslvpn/sslvpn_web_acc_rewrite.c
71da977039c23b01cf8f1f0684a435e36cb191a2
[]
no_license
xianlimei/zhuxianB30
be06c7d14e5f71f62f18b84474ca626f6fbc97c9
b5cb7cfbb2909832dd9795cedd9fb4afb93824a5
refs/heads/master
2017-05-11T12:46:11.019820
2015-10-22T02:47:33
2015-10-22T02:47:33
null
0
0
null
null
null
null
GB18030
C
false
false
115,916
c
sslvpn_web_acc_rewrite.c
/******************************************************************************* Copyright (C) 2012 Hangzhou DPTech Technologies Co.,Ltd. All Rights Reserved. -------------------------------------------------------------------------------- ๆ–‡ไปถๅ็งฐ: sslvpn_web_acc_rewrite.c ๅŠŸ่ƒฝๆ่ฟฐ: sslvpn็š„webๆŽฅๅ…ฅๅฎžไฝ“ๆ”นๅ†™ *******************************************************************************/ #include "sslvpn_config.h" #include "sslvpn_syshead.h" #include <linux/types.h> #include <sys/socket.h> #include <conplat/error_code.h> #include <conplat/sqlite_pub.h> #include <conplat/ipsec_kmod.h> #include <conplat/sslvpn_config_submit.h> #include <pthread.h> #include <execinfo.h> #include <sslvpn_rewrite.h> #include "sslvpn_socket.h" #include "sslvpn_ip_acc_ctl.h" #include "sslvpn_cfg_process.h" #include "sslvpn_web_acc.h" #include "sslvpn_web_acc_rewrite.h" #include "sslvpn_web_acc_rewrite_chr_handle.h" #include "sslvpn_mem.h" static s32 sslvpn_js_get_obj(s8 *, s32, s32 *); static s32 sslvpn_js_get_path(s8 *, s32, s32 *); s32 g_sslvpn_web_rewrite_method = 0; //0ไปฃ่กจ่€็š„ๆ”นๅ†™๏ผŒ1ไปฃ่กจๆ–ฐ็š„ๆ”นๅ†™ extern u32 mpsa_ac_compile (mpsa_ac_s * ac); sslvpn_file_type_s sslvpn_file[] = { { SSLVPN_FILE_HTML, ".html", sslvpn_rewrite_file_html }, { SSLVPN_FILE_XML, ".xml", sslvpn_rewrite_file_xml }, { SSLVPN_FILE_XSL, ".xsl", sslvpn_rewrite_file_xsl }, { SSLVPN_FILE_JSP, ".jsp", sslvpn_rewrite_file_html }, { SSLVPN_FILE_CSS, ".css", sslvpn_rewrite_file_css }, { SSLVPN_FILE_JS, ".js", sslvpn_rewrite_file_js }, { SSLVPN_FILE_ASHX, ".ashx", sslvpn_rewrite_file_js }, { SSLVPN_FILE_PDF, ".pdf", NULL }, { SSLVPN_FILE_TYPE_MAX, NULL, NULL }, }; sslvpn_js_label_function_s js_label_function[] = { { JS_KW_SRC, sslvpn_js_rewrite_attribute_set , "DP_write_src" }, { JS_KW_PROTOCOL, sslvpn_js_rewrite_attribute_set, "DP_write_protocol" }, { JS_KW_HOSTNAME, sslvpn_js_rewrite_attribute_set, "DP_write_hostname" }, { JS_KW_PATHNAME, sslvpn_js_rewrite_attribute_set, "DP_write_pathname" }, { JS_KW_LOCATION, sslvpn_js_rewrite_attribute_set, "DP_write_location" }, { JS_KW_HREF, sslvpn_js_rewrite_attribute_set, "DP_write_href" }, { JS_KW_COOKIE, sslvpn_js_rewrite_attribute_set, "DP_write_cookie" }, { JS_KW_URL, sslvpn_js_rewrite_attribute_set, "DP_write_URL" }, { JS_KW_HOST, sslvpn_js_rewrite_attribute_set, "DP_write_host" }, { JS_KW_PORT, sslvpn_js_rewrite_attribute_set, "DP_write_port" }, { JS_KW_DOMAIN, sslvpn_js_rewrite_attribute_set, "DP_write_domain" }, { JS_KW_WINDOW_OPEN, sslvpn_js_rewrite_method, "DP_OL_window_open" }, { JS_KW_WINDOW_EXECSCRIPT, sslvpn_js_rewrite_method, "DP_OL_window_execScript" }, { JS_KW_WINDOW_NAVIGATE, sslvpn_js_rewrite_method, "DP_OL_window_navigate" }, { JS_KW_WINDOW_SETINTERVAL, sslvpn_js_rewrite_method, "DP_OL_window_setInterval" }, { JS_KW_WINDOW_SETTIMEOUT, sslvpn_js_rewrite_method, "DP_OL_window_setTimeout" }, { JS_KW_WINDOW_SHOWHELP, sslvpn_js_rewrite_method, "DP_OL_window_showHelp" }, { JS_KW_WINDOW_SHOWMODALDIALOG, sslvpn_js_rewrite_method, "DP_OL_window_showModalDialog" }, { JS_KW_WINDOW_SHOWMODELESSDIALOG, sslvpn_js_rewrite_method, "DP_OL_window_showModelessDialog" }, { JS_KW_EVAL, sslvpn_js_rewrite_method, "DP_OL_window_eval" }, { JS_KW_APPENDCHILD, sslvpn_js_rewrite_method, "DP_OL_appendChild" }, { JS_KW_INSERTBEFORE, sslvpn_js_rewrite_method, "DP_OL_insertBefore" }, { JS_KW_WRITELN, sslvpn_js_rewrite_method, "DP_OL_writeLn" }, { JS_KW_REPLACE, sslvpn_js_rewrite_method, "DP_OL_location_replace" }, { JS_KW_RELOAD, sslvpn_js_rewrite_method, "DP_OL_location_reload" }, { JS_KW_ASSIGN, sslvpn_js_rewrite_method, "DP_OL_location_assign" }, { JS_KW_GO, sslvpn_js_rewrite_method, "DP_OL_go" }, { JS_KW_INSERTADJACENTHTML, sslvpn_js_rewrite_method, "DP_OL_insertAdjacentHTML" }, { JS_KW_CREATESTYLESHEET, sslvpn_js_rewrite_method, "DP_OL_createStyleSheet" }, { JS_KW_WRITE, sslvpn_js_rewrite_method, "DP_OL_write" }, { JS_KW_SETATTRIBUTE, sslvpn_js_rewrite_method, "DP_OL_write_attribute" }, { JS_KW_GETATTRIBUTE, sslvpn_js_rewrite_method, "DP_OL_read_attribute" }, { JS_KW_BACKGROUNDIMAGE, sslvpn_js_rewrite_attribute_set, "DP_write_backgroundImage" }, { JS_KW_BACKGROUND, sslvpn_js_rewrite_attribute_set, "DP_write_background" }, { JS_KW_CSSTEXT, sslvpn_js_rewrite_attribute_set, "DP_write_cssText" }, { JS_KW_INNERHTML, sslvpn_js_rewrite_attribute_set, "DP_write_innerHTML" }, { JS_KW_OUTERHTML, sslvpn_js_rewrite_attribute_set, "DP_write_outerHTML" }, { JS_KW_ACTION, sslvpn_js_rewrite_attribute_set, "DP_write_action" } }; /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_init_buffer_s ๅŠŸ่ƒฝๆ่ฟฐ : ๅˆๅง‹ๅŒ–sslvpn_js_buffer_s็ป“ๆž„ไฝ“ ่พ“ๅ…ฅๅ‚ๆ•ฐ : buffer ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 11-09-2010 *******************************************************************************/ static inline void sslvpn_js_init_buffer_s(sslvpn_js_buffer_s *buffer) { buffer->buf = NULL; buffer->used = 0; buffer->size = 0; return; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_free_buffer ๅŠŸ่ƒฝๆ่ฟฐ : ้‡Šๆ”พsslvpn_js_buffer_s็ป“ๆž„็š„ๆˆๅ‘˜ ่พ“ๅ…ฅๅ‚ๆ•ฐ : buffer ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 11-08-2010 *******************************************************************************/ static inline void sslvpn_js_free_buffer(sslvpn_js_buffer_s *buffer) { SSLVPN_free(buffer->buf); buffer->size = 0; buffer->used = 0; return; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_realloc_buffer ๅŠŸ่ƒฝๆ่ฟฐ : ็”ณ่ฏท้•ฟๅบฆไธบbuf_length็š„็ฉบ้—ด๏ผŒbuffer->bufๆŒ‡ๅ‘่ฟ™็‰‡็ฉบ้—ด ่พ“ๅ…ฅๅ‚ๆ•ฐ : buffer, buf_length ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 11-08-2010 *******************************************************************************/ static inline void sslvpn_js_realloc_buffer(sslvpn_js_buffer_s *buffer, u32 buf_length) { buffer->buf = SSLVPN_realloc(buffer->buf, buf_length); buffer->size = buf_length; return; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_realloc_buffer ๅŠŸ่ƒฝๆ่ฟฐ : ๅฐ†ๅญ—็ฌฆไธฒbuf๏ผŒ้•ฟๅบฆไธบbuf_length็š„ๅญ—็ฌฆcopyๅˆฐbuffer->bufไธญ ่พ“ๅ…ฅๅ‚ๆ•ฐ : buffer, buf, buf_length ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 11-08-2010 *******************************************************************************/ static inline void sslvpn_js_cpy_to_buffer(sslvpn_js_buffer_s *buffer, s8 *buf, u32 buf_length) { memcpy(buffer->buf, buf, buf_length); buffer->buf[buf_length] = '\0'; buffer->used = buf_length; return; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_make_tag_node ๅŠŸ่ƒฝๆ่ฟฐ : ็”Ÿๆˆไธ€ไธชๆ–‡ไปถๅˆ†ๆฎต่Š‚็‚น ่พ“ๅ…ฅๅ‚ๆ•ฐ : start : ่Š‚็‚นๅผ€ๅง‹ไฝ็ฝฎ end : ่Š‚็‚น็ป“ๆŸไฝ็ฝฎ type : ่Š‚็‚น็ฑปๅž‹ rewrite_func: ๅ›ž่ฐƒๅ‡ฝๆ•ฐ ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๆ–น็š“ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 08-20-2010 *******************************************************************************/ static sslvpn_tag_list_s * sslvpn_make_tag_node(s32 start, s32 end, u32 type, s32 (*rewrite_func)(void *, void *, sslvpn_tag_list_s *)) { sslvpn_tag_list_s *tag_node = NULL; tag_node = SSLVPN_malloc(sizeof(sslvpn_tag_list_s)); if(NULL == tag_node) { TTY_DEBUG("malloc faile!!\n"); return NULL; } tag_node->start = start; tag_node->end = end; tag_node->type = type; tag_node->rewrite_seg_func = rewrite_func; tag_node->next = NULL; return tag_node; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_skip_char ๅŠŸ่ƒฝๆ่ฟฐ : ้€š่ฟ‡flagๆ ‡่ฏ†ๆฅ่ทณ่ฟ‡ไธ€ไบ›ๅญ—็ฌฆ ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, begin, flag ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return 1่กจ็คบ่ทณ่ฟ‡ไบ†ๅญ—็ฌฆไธ”buf==tmpไบ† return 0 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 09-03-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 10-15-2010 *******************************************************************************/ s32 sslvpn_js_skip_char(s8 *tmp, s8 **buf, u32 flag) { s8 *var = *buf; switch(flag) { case JS_SKIP_SPACE_BEFORE: do{ if( tmp > var ) { return -1; } var--; }while( tmp <= var && isspace(*var) ); break; case JS_SKIP_SPACE_AFTER: do{ if( tmp <= var) { return -1; } var++; }while( tmp > var && isspace(*var) ); break; case JS_SKIP_VARIABLE_BEFORE: do{ if( tmp > var) { return -1; } var--; }while( tmp <= var && ('$' == *var || '_' == *var\ || ('A' <= *var && *var <= 'Z')\ || ('a' <= *var && *var <= 'z')\ || ('0' <= *var && *var <= '9')) ); break; case JS_SKIP_VARIABLE_AFTER: do{ if( tmp <= var) { return -1; } var++; }while( tmp > var && ('$' == *var || '_' == *var\ || ('A' <= *var && *var <= 'Z')\ || ('a' <= *var && *var <= 'z')\ || ('0' <= *var && *var <= '9')) ); break; default: return -1; } *buf = var; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_match_char ๅŠŸ่ƒฝๆ่ฟฐ : ้€š่ฟ‡flagๆ ‡่ฏ†ๆฅ่ทณ่ฟ‡ไธ€ไบ›ๅญ—็ฌฆ ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, begin, flag ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return 1่กจ็คบ่ทณ่ฟ‡ไบ†ๅญ—็ฌฆไธ”buf==tmpไบ† return 0 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 10-15-2010 *******************************************************************************/ s32 sslvpn_js_match_char(s8 *tmp, s8 **buf, u32 flag) { s32 stack_flag = 1; s8 *var = NULL; s8 *pre_char = NULL; u8 end_char; u8 nch; u8 i = 0; var = *buf; pre_char = var-1; switch(flag) { case JS_MATCH_BRACKETS_AFTER: do { var++; if( tmp <= var && stack_flag > 0 ) { return -1; } if( *var == '\'' || *var == '\"' ) { end_char = *var ; var++; while( *var != end_char && *var != (u8)0 ) { if( *var == '\\' ) var++; var++; } } else if(*var == '/' && !is_name_inside_char(*(var-1))) { do{ nch = *(var++); if( nch==(u8)0 || nch == '\r' || nch=='\n' ) { break; } if( nch == '\\' ) var++; }while( *var != '/' ) ; while( *var == 'g'|| *var == 'i'||*var == 'm') var++; } else if(*var == '(') { stack_flag++; } else if(*var == ')' ) { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_BRACKETS_BEFORE: do { var--; if( var < tmp && stack_flag > 0) { return -1; } if( *var == '\'' || *var == '\"') { end_char = *var ; var--; while( (*var != end_char && *var != (u8)0) || (*var == end_char && *(var-1) == '\\')) { if( *(var-1) == '\\' ) var--; var--; } } else if(*var == '/' && *(var-1) != '\\' && (*(var+1) == 'i'||*(var+1) == 'm'||*(var+1) == 'g'||*(var+1) == ','||(*(var+1) != '=' && !is_name_inside_char(*(var+1))))) { do{ if(*var == '/' && *(var-1)=='\\') { i =0; while(*(var-1-i) == '\\') i++; if(1 == i%2) { var -= i; continue; } else { var -= i; break; } } nch = *(var--); if( nch==(u8)0 || nch == '\r' || nch=='\n' ) { break; } }while( *var != '/' || (*var == '/' && *(var-1) == '\\')); } else if(*var == ')') { stack_flag++; } else if(*var == '(') { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_BRACES_AFTER: do { var++; if( tmp <= var && stack_flag > 0 ) { return -1; } if( *var == '[' && (*(var - 1) != '\\' || (*(var - 1) == '\\' && *(var - 2) == '\\'))) { stack_flag++; } else if( *var == ']' && ((*pre_char != '\\' && *(var - 1) != '\\') || (*pre_char == '\\' && *(var - 1) == '\\')) ) { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_BRACES_BEFORE: do { var--; if( var < tmp && stack_flag > 0) { return -1; } if( *var == ']' && (*(var - 1) != '\\' || (*(var - 1) == '\\' && *(var - 2) == '\\'))) { stack_flag++; } else if( *var == '[' && *(var - 1) != '\\' ) { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_AGGREGATION_AFTER: do { var++; if( tmp <= var && stack_flag > 0 ) { return -1; } if( *var == '{' && (*(var - 1) != '\\' || (*(var - 1) == '\\' && *(var - 2) == '\\'))) { stack_flag++; } else if( *var == '}' && ((*pre_char != '\\' && *(var - 1) != '\\') || (*pre_char == '\\' && *(var - 1) == '\\')) ) { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_SINGLE_AFTER: do { var++; if( tmp <= var && stack_flag > 0 ) { return -1; } if( *var == '\'' && ((*pre_char != '\\' && *(var - 1) != '\\') || (*pre_char == '\\' && *(var - 1) == '\\'))) { stack_flag--; } }while( stack_flag > 0 ); break; case JS_MATCH_DOUBLE_AFTER: do { var++; if( tmp <= var && stack_flag > 0 ) { return -1; } if( *var == '"' && (*(var - 1) != '\\' || (*(var - 1) == '\\' && *(var - 2) == '\\'))) { stack_flag--; } }while( stack_flag > 0 ); break; default: return -1; } *buf = var; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_calloc_copy ๅŠŸ่ƒฝๆ่ฟฐ : ็”ณ่ฏทbuf_end - buf_start + 32ๅคงๅฐ็š„ๅ†…ๅญ˜๏ผŒไธ”copyไปŽbuf_startไฝ็ฝฎๅผ€ๅง‹ ้•ฟๅบฆไธบbuf_end - buf_start ็š„ๅญ—็ฌฆๅˆฐ*tmp ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, buf_start, buf_end ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return 0 ่กจ็คบ็”ณ่ฏทๅ†…ๅญ˜ไธŽcopyๆˆๅŠŸ -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 10-15-2010 *******************************************************************************/ s32 sslvpn_js_calloc_copy(s8 **tmp, s8 *buf_start, s8 *buf_end) { s8 *var = NULL; SSLVPN_ASSERT((buf_end - buf_start) > 0); var = SSLVPN_calloc(1, buf_end - buf_start + 32); memcpy(var, buf_start, buf_end - buf_start); var[buf_end - buf_start] = '\0'; *tmp = var; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_judge_obj ๅŠŸ่ƒฝๆ่ฟฐ : ๆŸฅๆ‰พๅŒน้…ๅญ—็ฌฆๅ‰้ข็š„obj ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, begin ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1่กจ็คบไธ้œ€่ฆๆ›ดๆ–ฐ*begin็š„ๅ€ผ return 0่กจ็คบๆ›ดๆ–ฐ*begin็š„ๅ€ผ -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-06-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 08-21-2010 *******************************************************************************/ s32 sslvpn_js_get_obj(s8 *tmp, s32 tmp_length, s32 *begin) { s8 *buf = NULL; u32 i = 0; u32 length =0; s32 isComplete = 0; buf = tmp + *begin; /* 111.222.333. src = url ไปฅไธ‹่ฏดๅˆฐ็š„ๅ•ๅ…ƒ่กจ็คบ(xxx. ) ่ฟ™ไธชไพ‹ๅญไธญๆœ‰ไธ‰ไธชๅ•ๅ…ƒ ไปฅไธ‹่ฏดๅˆฐ็š„ๅ˜้‡ไธŽๅฏน่ฑกๆ˜ฏไธ€ไธชๆ„ๆ€*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf, JS_SKIP_SPACE_BEFORE) ); /*็ฌฌไธ€ๆฌกๆŸฅๆ‰พ๏ผŒๅฆ‚ๆžœๆ‰พๅˆฐไบ†ๅผ€ๅง‹ไฝ็ฝฎ ๆˆ–่€…่ฟ™ไธชๅญ—็ฌฆไธๆ˜ฏ' . ', ่ฏดๆ˜Žไธ้œ€่ฆไฟฎๆ”น*/ if( tmp > buf ) { return -1; } if( *buf != '.' ) { return -1; } /* ไธบไบ†้€‚ๅบ”do{}while()ๅพช็Žฏ่€Œ" ่‡ชๅŠ  " */ buf++; /*do{}while(1) ๆ˜ฏไปฅๅ•ๅ…ƒไธบๅ•ไฝๆŸฅๆ‰พobj*/ do{ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf, JS_SKIP_SPACE_BEFORE) ); /*่กจ็คบๆ‰พๅˆฐไบ†tmp็š„ๅผ€ๅง‹ไฝ็ฝฎๆˆ–่€…ไธๆ˜ฏ' . 'ๅญ—็ฌฆ ่ฎคไธบๆ‰พๅˆฐไบ†obj*/ if( tmp > buf ) { *begin = buf - tmp; return 0; } /*ไธๆ˜ฏ' . '่กจ็คบobjๆ‰พๅˆฐไบ† ๆ‰พ็ฌฌไธ€ๅ•ๅ…ƒ็š„ๆ—ถๅ€™๏ผŒไธ‹้ข็š„if ่ฏญๅฅไธ€ๅฎšไธๆˆ็ซ‹*/ if( *buf != '.' && *buf != '[') { length = buf - tmp; while(i<length&&(*(buf-i)==' ' || *(buf-i)=='\t')) i++; if(i== length) { *begin = buf - tmp; } else if(length-i==2 && 0==strncmp(tmp, "new", 3)) { *begin = 0; } else if(*(buf-i) == 'w' && *(buf-i-1) == 'e' && *(buf-i-2) == 'n' && !is_name_inside_char(*(buf-i-3))) { *begin = (buf-i-3) - tmp; } else { *begin = buf - tmp; } return 0; } if(*buf == '[') { if(!isComplete) { *begin = buf - tmp; return 0; } else { isComplete--; } } /*ๅฆ‚ๆžœๆ˜ฏ' . ' ๅˆ™ๅŽปๆމ' . 'ๅ‰้ข็š„็บฟๆ€ง็ฉบ็™ฝ*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf, JS_SKIP_SPACE_BEFORE) ); /*่ฟ™็งๆƒ…ๅ†ต่กจ็คบไธ้œ€่ฆไฟฎๆ”น่ฟ™ไธชๅŒน้… ๆ‰พๅˆฐไบ†tmp็š„ๅผ€ๅง‹ไฝ็ฝฎ้ƒฝๆฒกๆœ‰ๆ‰พๅˆฐๅญ—็ฌฆ*/ if( tmp > buf ) { return -1; } /*ๅฏน [ ] ๅญ—็ฌฆๅŒน้…็š„ๆŸฅๆ‰พ*/ if( ']' == *buf ) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp, &buf, JS_MATCH_BRACES_BEFORE) ); isComplete++; /*่กจ็คบๆ‰พๅˆฐไบ†tmp็š„ๅผ€ๅง‹ไฝ็ฝฎ ่ฎคไธบๆ‰พๅˆฐไบ†obj*/ if( tmp > buf ) { *begin = buf - tmp; return 0; } } /* ๆŸฅๆ‰พ333 */ /*ๅฏน( ) ๅญ—็ฌฆๅŒน้…็š„ๆŸฅๆ‰พ*/ else if( ')' == *buf ) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp, &buf, JS_MATCH_BRACKETS_BEFORE) ); /*ๅญ˜ๅœจไธ€ไธชbug๏ผŒไธพไพ‹fun().src = url , ' n 'ไธŽ' ( ' ไน‹้—ดไธ่ƒฝๆœ‰็บฟๆ€ง็ฉบ็™ฝ*/ buf--; SSLVPN_ASSERT( tmp <= buf ); /*ๅ˜้‡็š„ๅ‘ฝๅ่ง„ๅˆ™๏ผŒ่ทณ่ฟ‡ๅ˜้‡*/ if( '$' == *buf || ('A' <= *buf && *buf <= 'Z') || ('a' <= *buf && *buf <= 'z') || ('0' <= *buf && *buf <= '9') || '_' == *buf ) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf, JS_SKIP_VARIABLE_BEFORE) ); if( tmp > buf ) { *begin = buf - tmp; return 0; } } /* "( )" ๅ‰้ขไธๆ˜ฏ" ็บฟๆ€ง็ฉบ็™ฝ"ไธŽ ' . ' ่กจ็คบ"( )"ไธญ็š„ๅญ—็ฌฆไธฒไธบๆ•ดไธชobj*/ else if( (tmp > buf) || ( !isspace(*buf) && '.' != *buf && '"' != *buf && '\'' != *buf)) { *begin = buf - tmp; return 0; } } /*่กจ็คบ' . 'ๅ‰้ข่ทŸ็š„ๆ˜ฏไธ€ไธชๅ˜้‡*/ else { /*ๅ˜้‡็š„ๅ‘ฝๅ่ง„ๅˆ™๏ผŒ่ทณ่ฟ‡ๅ˜้‡*/ if( ('A' <= *buf && *buf <= 'Z') || ('a' <= *buf && *buf <= 'z') || ('0' <= *buf && *buf <= '9') || '_' == *buf ) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf, JS_SKIP_VARIABLE_BEFORE) ); if( tmp > buf ) { *begin = buf - tmp; return 0; } } /* ' . 'ๅ‰้ขไธๆ˜ฏๅ˜้‡ๅฐฑ่กจ็คบไธ้œ€่ฆไฟฎๆ”น*/ else { /*่ฟ™ไธชๅŒน้…ไธ้œ€่ฆไฟฎๆ”น*/ return -1; } } /*่ทณๅˆฐไธŠ้ขๅพช็Žฏๆ—ถ๏ผŒๅ…ˆ" ่‡ชๅŠ "ๆŒ‡ๅ‘ๅŽ้ขไธ€ไธชๅญ—็ฌฆ*/ buf++; if( tmp > buf ) { *begin = buf - tmp; return 0; } }while(1); } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_get_method_parameter ๅŠŸ่ƒฝๆ่ฟฐ : ๆ‰พๅˆฐๆ–นๆณ•ไธญ็š„ๅ‚ๆ•ฐ ๅฆ‚:obj.open(parameter) urlๆ˜ฏๆˆ‘ไปฌ้œ€่ฆๆŸฅๆ‰พๅ‡บๆฅ็š„ๅ€ผ ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, end ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1่กจ็คบไธ้œ€่ฆไฟฎๆ”น*end return 0่กจ็คบ้œ€่ฆไฟฎๆ”น*end -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 07-01-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไบŒๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 08-21-2010 *******************************************************************************/ s32 sslvpn_js_get_method_parameter(s8 *tmp, s32 tmp_length, s32 *end) { s8 *buf = NULL; buf = tmp + *end - 1; /*ๅŽปๆމๅŽ้ข็š„็บฟๆ€ง็ฉบ็™ฝobj.open () openไธŽ()ไน‹้—ด็š„็บฟๆ€ง็ฉบ็™ฝ ๆ‰พๅˆฐopenๅŽ้ข็š„"ๅทฆๆ‹ฌๅท"*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { return -1; } /* ่ฟ™ไธชๅŒน้…ไธ้œ€่ฆไฟฎๆ”นๅฆ‚ๆžœif()ไธๆˆ็ซ‹*/ /*if( *buf != '(' || *(buf + 1) == ')')*/ if( *buf != '(' ) { return -1; } /*ๆ‰พๅˆฐopenๅŽ้ข็š„"ๅทฆๆ‹ฌๅท" ๅŒน้…็š„"ๅณๆ‹ฌๅท"*/ SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_BRACKETS_AFTER) ); /* *endๆŒ‡ๅ‘' ) '่ฟ™ไธชๅญ—็ฌฆ*/ *end = buf - tmp; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_skip_statement ๅŠŸ่ƒฝๆ่ฟฐ : ่ทณ่ฟ‡ไธ€ๆกๅฎŒๆ•ด็š„JavaScript่ฏญๅฅ ่พ“ๅ…ฅๅ‚ๆ•ฐ : buf ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 08-25-2010 *******************************************************************************/ s32 sslvpn_js_skip_statement(s8 *tmp, s32 tmp_length, s8 **var) { s32 flag = 0; s8 *buf = *var; s32 interrogation=0,condition=0; //็”จไบŽ้—ฎๅทๅŒน้… /* ไปฅobj.src = statement + statement + statement;ไธบไพ‹ๅญ ไปฅstatement + ไธบๅ•ๅ…ƒๆŸฅๆ‰พ */ while( *buf != ';' && *buf != '}' && *buf != '{') { /*ๅฏนไบŽ่ฟ™็งๆƒ…ๅ†ต็š„ๅค„็† DOM_a.href = "javascript:void(null);"; */ if(*buf == '"' && (*(buf - 1) != '\\' || (*(buf - 1) == '\\' && *(buf - 2) == '\\'))) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_DOUBLE_AFTER) ); SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { goto out; } if( *buf != '+' && *buf != ':' && *buf != '?' && *buf != '.') { //่ฟ™้‡Œๆ˜ฏไธบไบ†ๅค„็†vbscriptไธญๅญ—็ฌฆไธฒ่ฟžๆŽฅ้—ฎ้ข˜ //vbscriptไธญๅญ—็ฌฆไธฒ่ฟžๆŽฅ็”จ็š„ๆ˜ฏ"&",ไธ่ฟ‡่ฆ่ทณ่ฟ‡ //javascriptไธญ้€ป่พ‘ไธŽ(&&)็š„ๆƒ…ๅ†ต if('&' == *buf && '&' != *(buf+1)) { flag = 1; continue; } else { break; } } flag = 1; buf--; } else if( *buf == '(' && (*(buf - 1) != '\\' || (*(buf - 1) == '\\' && *(buf - 2) == '\\'))) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_BRACKETS_AFTER) ); flag = 0; } else if( *buf == '[' && (*(buf - 1) != '\\' || (*(buf - 1) == '\\' && *(buf - 2) == '\\'))) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_BRACES_AFTER) ); flag = 0; } else if( *buf == '\'' && (*(buf - 1) != '\\' || (*(buf - 1) == '\\' && *(buf - 2) == '\\'))) { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_SINGLE_AFTER) ); SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { goto out; } if( *buf != '+' && *buf != ':' && *buf != '?' && *buf != '.') { //่ฟ™้‡Œๆ˜ฏไธบไบ†ๅค„็†vbscriptไธญๅญ—็ฌฆไธฒ่ฟžๆŽฅ้—ฎ้ข˜ //vbscriptไธญๅญ—็ฌฆไธฒ่ฟžๆŽฅ็”จ็š„ๆ˜ฏ"&",ไธ่ฟ‡่ฆ่ทณ่ฟ‡ //javascriptไธญ้€ป่พ‘ไธŽ(&&)็š„ๆƒ…ๅ†ต if('&' == *buf && '&' != *(buf+1)) { flag = 1; continue; } else { break; } } flag = 1; buf--; } else if( *buf == '\n' && flag == 0 ) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { goto out; } /*ๅœจ่ฟ™็งๆƒ…ๅ†ตไธ‹ๅ‡บ็Žฐไบ†ๆข่กŒ๏ผŒๅˆ™ไธๆ˜ฏ่ฏญๅฅ็š„็ป“ๆŸ*/ if( *buf == '+' || *buf == '?' || *buf == '.' || *buf == ':') { flag = 1; } else { break; } } else if( '+'==*buf || '?'==*buf || '.'==*buf || ':' == *buf) { if( '?' == *buf) { interrogation++; condition=1; } else if( ':' == *buf && 0 < interrogation) { interrogation--; } else if( ':' == *buf && 0 == interrogation) { if( 0 == condition) { goto out; } } flag = 1; } else if( ',' == *buf) { goto out; } else if( flag == 1 && !isspace(*buf) ) { flag = 0; } else if( (*buf == ')' || *buf == ']') && (*(buf - 1) != '\\' || (*(buf - 1) == '\\' && *(buf - 2) == '\\'))) { goto out; } SSLVPN_ASSERT(buf < (tmp + tmp_length)); buf++; if(buf == (tmp + tmp_length) ) { break; } /*ๅฏน่ฟ™็งๆƒ…ๅ†ต็š„ๅค„็† baidu.url=baidu.url||{}; */ if( *buf == '|') { buf++; if( *buf == '|' ) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { SSLVPN_ASSERT(0); } else if(*buf == '{') { SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_AGGREGATION_AFTER) ); SSLVPN_ASSERT( buf < (tmp + tmp_length) ); buf++; goto out; } } } } out: *var = buf; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_judge_url ๅŠŸ่ƒฝๆ่ฟฐ : ๆŸฅๆ‰พๅŒน้…ๅญ—็ฌฆๅŽ้ข้ข็š„url ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, end, append ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1่กจ็คบไธ้œ€่ฆๆ›ดๆ–ฐ*end็š„ๅ€ผ return 0่กจ็คบๆ›ดๆ–ฐ*end็š„ๅ€ผ -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-07-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 08-22-2010 *******************************************************************************/ s32 sslvpn_js_get_path(s8 *tmp, s32 tmp_length, s32 *end) { s8 *buf = NULL; buf = tmp + *end - 1; /*ๅŽปๆމๅŽ้ข็š„็บฟๆ€ง็ฉบ็™ฝ*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { return -1; } /*่ทณ่ฟ‡'+', '='ๅญ—็ฌฆ*/ while('+' == *buf || '=' == *buf) { buf++; } buf--; /*ๅŽปๆމ' = 'ๅŽ้ข็š„็บฟๆ€ง็ฉบ็™ฝ*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { return -1; } /*obj.addr = function(parm){} ็š„ๅค„็†*/ if( 0 == strncasecmp(buf, "function", strlen("function") ) ) { buf = buf + strlen("function") - 1; SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { SSLVPN_ASSERT(0); return -1; } if( *buf != '(' ) { SSLVPN_ASSERT(0); return -1; } SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_BRACKETS_AFTER) ); SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf, JS_SKIP_SPACE_AFTER) ); if( buf == tmp + tmp_length ) { SSLVPN_ASSERT(0); return -1; } if( *buf != '{' ) { return -1; } SSLVPN_ASSERT( 0 == sslvpn_js_match_char(tmp + tmp_length, &buf, JS_MATCH_AGGREGATION_AFTER) ); *end = buf - tmp + 1; return 0; } /* ่ฟ™็งๆƒ…ๅ†ต็š„ๅค„็†UD.host = { userId:135335489, \ userName:'mikesakai',\ nickName:'ๅถๅฐ”ไธ€็ฌ”',\ baseUrl:'http://mikesakai.blog.163.com/', gender:'ไป–' };*/ else if( '{' == *buf || '}' == *buf || ';' == *buf) { return -1; } /*' = 'ไน‹ๅŽ็š„ๅญ—็ฌฆๅค„็† ไธพไพ‹obj.src = url; javascriptไธญไปฅ" ; "ๆˆ–่€…" \n " ไธบไธ€ๆก่ฏญๅฅ็š„็ป“ๆŸ " \n " ๅฏไปฅๅ‡บ็Žฐๅœจ' . ' , ' + '็ญ‰ไธ€ไบ›็ฌฆๅท็š„ๅŽ้ขไธ่กจ็คบ็ป“ๆŸ่ฏญๅฅ ไนŸๅฏไปฅๅ‡บ็Žฐfunc() ็š„' c 'ไธŽ' ( 'ไน‹้—ดไนŸไธ่กจ็คบ็ป“ๆŸไธ€ๆก่ฏญๅฅ*/ /*ๆ‰พๅˆฐ่ฟ™ๆก่ฏญๅฅ็š„็ป“ๆŸไฝ็ฝฎๅฏน'\n'็š„ๆƒ…ๅ†ตไปฅๅŽๅค„็†*/ SSLVPN_ASSERT(0 == sslvpn_js_skip_statement(tmp, tmp_length, &buf)); *end = buf - tmp; return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_rewrite_attribute_set ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญJSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ :tmp, tmp_length, start, end, link, link_length, func_name ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1; ่กจ็คบไธ้œ€่ฆไฟฎๆ”น่ฟ™ไธชๅŒน้… return 0; ่กจ็คบไฟฎๆ”น่ฟ™ไธชๅŒน้… -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-04-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไบŒๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 11-09-2010 *******************************************************************************/ s32 sslvpn_js_rewrite_attribute_set(s8 *tmp, s32 tmp_length, s32 *start, s32 *end, sslvpn_js_buffer_s *buffer, s8 *func_name) { s32 begin = *start; s32 finish = *end; s32 length = 0; s8 *buf_start = NULL; s8 *buf_end = NULL; s8 *obj = NULL; s8 *url = NULL; s32 append = 0; s32 ret = 0; buf_start = tmp + *end - 1; /*ๅˆคๆ–ญobj.hrefๆ˜ฏๅœจๅทฆๅ€ผ๏ผŒ่ฟ˜ๆ˜ฏๅœจๅณๅ€ผ ไธพไพ‹obj.href = url obj.hrefๅœจๅทฆๅ€ผ url = obj.href obj.hrefๅœจๅณๅ€ผ*/ SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf_start, JS_SKIP_SPACE_AFTER) ); SSLVPN_ASSERT( buf_start < (tmp + tmp_length) ); if( 0 == strncasecmp(buf_start, "==", strlen("==")) ) { if( (NULL != strstr(func_name, "DP_write_location"))\ || (NULL != strstr(func_name, "DP_write_src"))\ || (NULL != strstr(func_name, "DP_write_action"))\ || (NULL != strstr(func_name, "DP_write_backgroundImage"))\ || (NULL != strstr(func_name, "DP_write_background"))\ || (NULL != strstr(func_name, "DP_write_cssText"))\ || (NULL != strstr(func_name, "HTML"))\ || (NULL != strstr(func_name, "DP_write_domain")) ) { return -1; } /*ๅฐ†Setๅฑžๆ€งๆ”นไธบGetๅฑžๆ€ง */ ret = sslvpn_js_rewrite_attribute_get(tmp, tmp_length, start, end, buffer, func_name); return ret; } else if( 0 == strncasecmp(buf_start, "\"", strlen("\"")) ) { return -1; } else if( 0 == strncasecmp(buf_start, "\'", strlen("\'")) ) { return -1; } else if( 0 == strncasecmp(buf_start, "+=", strlen("+=")) ) { append = 1; buf_start = NULL; } else if( 0 == strncasecmp(buf_start, "=", strlen("=")) ) { append = 0; buf_start = NULL; } else { /*location, src, action, innterHTML, outerHTML ๅชๆœ‰Set ๅฑžๆ€ง*/ if( (NULL != strstr(func_name, "DP_write_location"))\ || (NULL != strstr(func_name, "DP_write_src"))\ || (NULL != strstr(func_name, "DP_write_action"))\ || (NULL != strstr(func_name, "DP_write_backgroundImage"))\ || (NULL != strstr(func_name, "DP_write_background"))\ || (NULL != strstr(func_name, "DP_write_cssText"))\ || (NULL != strstr(func_name, "HTML"))\ || (NULL != strstr(func_name, "DP_write_domain")) ) { return -1; } /*ๅฐ†Setๅฑžๆ€งๆ”นไธบGetๅฑžๆ€ง */ ret = sslvpn_js_rewrite_attribute_get(tmp, tmp_length, start, end, buffer, func_name); return ret; } /*ๆ‰พๅˆฐ.srcๅ‰้ข็š„obj */ ret = sslvpn_js_get_obj(tmp, tmp_length, &begin); /*่กจ็คบ่ฟ™ไธช.srcไธ้œ€่ฆไฟฎๆ”น*/ if( ret < 0 ) { buffer->used = 0; return -1; } if(begin<0) begin=0; /*ๆ‰พๅˆฐ.srcๅŽ้ข็š„url*/ ret = sslvpn_js_get_path(tmp, tmp_length, &finish); /*่กจ็คบ่ฟ™ไธช.srcไธ้œ€่ฆไฟฎๆ”น*/ if( ret < 0 ) { buffer->used = 0; return -1; } /*ๅŽปๆމ็บฟๆ€ง็ฉบ็™ฝ๏ผŒbuf_startๆŒ‡ๅ‘obj็š„ๅผ€ๅง‹ไฝ็ฝฎ*/ buf_start= tmp + begin; if(begin > 0||(begin==0 && !is_name_inside_char(*tmp))) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf_start, JS_SKIP_SPACE_AFTER) ); SSLVPN_ASSERT( buf_start < (tmp + tmp_length) ); } /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ" ไธŽ " . "๏ผŒbuf_endๆŒ‡ๅ‘obj็š„็ป“ๆŸไฝ็ฝฎ*/ buf_end = tmp + *start; do{ buf_end--; }while( isspace(*buf_end) || '.' == *buf_end ); buf_end++; /* copy objๅˆฐๆ•ฐ็ป„objไธญ*/ SSLVPN_ASSERT(buf_start < buf_end); sslvpn_js_calloc_copy( &obj, buf_start, buf_end ); length += strlen(obj); /*ๆ”นๅ˜result[i].start็š„ไฝ็ฝฎ*/ *start = buf_start - tmp; /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ" ไธŽ " . " , " = " , " + " ๏ผŒbuf_startๆŒ‡ๅ‘url็š„ๅผ€ๅง‹ไฝ็ฝฎ*/ buf_start= tmp + *end - 1; do{ buf_start++; }while( isspace(*buf_start) || '=' == *buf_start || '+' == *buf_start ); /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ๏ผŒbuf_endๆŒ‡ๅ‘url็š„็ป“ๆŸไฝ็ฝฎ็š„ไธ‹ไธ€ไธชๅญ—็ฌฆ*/ buf_end = tmp + finish; SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf_end, JS_SKIP_SPACE_BEFORE) ); SSLVPN_ASSERT( buf_start > tmp ); buf_end++; /* copy urlๅˆฐๆ•ฐ็ป„urlไธญ*/ SSLVPN_ASSERT(buf_start < buf_end); sslvpn_js_calloc_copy( &url, buf_start, buf_end ); length += strlen(url); /*ๆ”นๅ˜result[i].end็š„ไฝ็ฝฎ*/ *end = buf_end - tmp; length += strlen(func_name); if(buffer->size < length + 64) { sslvpn_js_realloc_buffer(buffer, length + 64); } if( 0 == strncasecmp( func_name, "DP_write_cookie", strlen("DP_write_cookie") ) ) { buffer->used = snprintf(buffer->buf, buffer->size, "%s(%s, %s)", func_name, obj, url); } else { buffer->used = snprintf(buffer->buf, buffer->size, "%s(%s, %d, %s)", func_name, obj, append, url); } SSLVPN_free(obj); SSLVPN_free(url); return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_handle_Gethref ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญJSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ :tmp, tmp_length, start, end, link, link_length, func_name ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1; ่กจ็คบไธ้œ€่ฆไฟฎๆ”น่ฟ™ไธชๅŒน้… return 0; ่กจ็คบไฟฎๆ”น่ฟ™ไธชๅŒน้… -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-04-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไบŒๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 12-07-2010 *******************************************************************************/ s32 sslvpn_js_rewrite_attribute_get(s8 *tmp, s32 tmp_length, s32 *start, s32 *end, sslvpn_js_buffer_s *buffer, s8 *func_name) { s32 begin = *start; s32 length = 0; s8 *buf_start = NULL; s8 *buf_end = NULL; s8 *obj = NULL; s8 tmp_func_name[64] = {0}; s32 ret = 0; snprintf(tmp_func_name, 64, "DP_read%s", func_name + strlen("DP_write")); /*ๆ‰พๅˆฐ.hrefๅ‰้ข็š„obj */ ret = sslvpn_js_get_obj(tmp, tmp_length, &begin); /*่กจ็คบ่ฟ™ไธช.hrefไธ้œ€่ฆไฟฎๆ”น*/ if( ret < 0 ) { buffer->used = 0; return -1; } if(begin<0) begin=0; /*ๅฏน่ฟ™็งๆƒ…ๅ†ต็š„ๅค„็†delete obj.attribute*/ s8 *parm = tmp + begin + 1; SSLVPN_ASSERT( 0 == sslvpn_js_skip_char( tmp, &parm, JS_SKIP_VARIABLE_BEFORE) ); if( 0 == strncasecmp(parm + 1, "delete", strlen("delete")) ) { return -1; } /*ๅˆคๆ–ญ.hrefๅŽ้ขๆ˜ฏๅฆๆ˜ฏไธ€ไบ›็‰นๆฎŠ็š„ๅญ—็ฌฆ*/ buf_start = tmp + *end; /*ๅŽ้ข่ทŸ็š„ไธๆ˜ฏๅญ—ๆฏๅฐฑ้œ€่ฆๆ”นๅ†™*/ if( !( ('A' <= *buf_start && *buf_start <= 'Z') || ('a' <= *buf_start && *buf_start <= 'z') || ('0' <= *buf_start && *buf_start <= '9') || '_' == *buf_start) ) { *end = buf_start - tmp; } /*่กจ็คบ่ฟ™ไธช.hrefไธ้œ€่ฆไฟฎๆ”น*/ else { buffer->used = 0; return -1; } /*ๅŽปๆމ็บฟๆ€ง็ฉบ็™ฝ๏ผŒbuf_startๆŒ‡ๅ‘obj็š„ๅผ€ๅง‹ไฝ็ฝฎ*/ buf_start= tmp + begin; if(begin > 0||(begin==0 && !is_name_inside_char(*tmp))) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char( tmp + tmp_length, &buf_start, JS_SKIP_SPACE_AFTER) ); SSLVPN_ASSERT( buf_start < tmp + tmp_length ); } /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ" ไธŽ " . "๏ผŒbuf_endๆŒ‡ๅ‘obj็š„็ป“ๆŸไฝ็ฝฎไธ‹ไธ€ไธชๅญ—็ฌฆ*/ buf_end = tmp + *start; do{ buf_end--; }while( isspace(*buf_end) || '.' == *buf_end ); buf_end++; /* copy objๅˆฐๆ•ฐ็ป„objไธญ*/ SSLVPN_ASSERT(buf_start < buf_end); sslvpn_js_calloc_copy( &obj, buf_start, buf_end ); length += strlen(obj); /*ๆ”นๅ˜result[i].start็š„ไฝ็ฝฎ*/ *start = buf_start - tmp; length += strlen(tmp_func_name); if(buffer->size < length + 64) { sslvpn_js_realloc_buffer(buffer, length + 64); } buffer->used = snprintf(buffer->buf, buffer->size, "%s(%s)", tmp_func_name, obj); SSLVPN_free(obj); return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_rewrite_method ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญJSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : tmp, tmp_length, start, end, link, link_length, func_name ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : return -1; ่กจ็คบไธ้œ€่ฆไฟฎๆ”น่ฟ™ไธชๅŒน้… return 0; ่กจ็คบไฟฎๆ”น่ฟ™ไธชๅŒน้… -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-30-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไบŒๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 11-09-2010 *******************************************************************************/ s32 sslvpn_js_rewrite_method(s8 *tmp, s32 tmp_length, s32 *start, s32 *end, sslvpn_js_buffer_s *buffer, s8 *func_name) { s32 begin = *start; s32 finish = *end; s32 length = 0; s32 ret = 0; s8 *buf_start = NULL; s8 *buf_end = NULL; s8 *obj = NULL; s8 *parameter = NULL; s32 re_flag =0; s32 win_flag = 0; buf_start = tmp + *end; /*ๅˆคๆ–ญ่ฟ™ไธชๅŒน้…็š„็ป“ๆžœๆ˜ฏobj.writeln(parameter) ่ฟ˜ๆ˜ฏobj.write(parameter); */ if( 0 == strncmp(func_name, "DP_OL_write", strlen("DP_OL_write"))\ && 0 == strncmp(buf_start, "ln(", strlen("ln(")) ) { /*ๅฟฝ็•ฅ่ฟ™ๆฌกๅŒน้…*/ return -1; } if(0 == strncmp(func_name, "DP_OL_window_eval", strlen("DP_OL_window_eval"))) { if(0 == strncmp(tmp+finish, "(DP_OL_window_eval", strlen("(DP_OL_window_eval"))) return -1; } /*ๆ‰พๅˆฐ.openๅ‰้ข็š„obj */ ret = sslvpn_js_get_obj(tmp, tmp_length, &begin); if(ret<0 && NULL != strstr(func_name, "DP_OL_window_")) { if(begin>0 && is_name_inside_char(*(tmp+begin-1))) { return -1; } win_flag = 1; } /*่กจ็คบ่ฟ™ไธช.openไธ้œ€่ฆไฟฎๆ”น*/ if( ret < 0 && !win_flag) { buffer->used = 0; return -1; } if(begin<0) begin=0; ret = sslvpn_js_get_method_parameter(tmp, tmp_length, &finish); /*่กจ็คบ่ฟ™ไธช.openไธ้œ€่ฆไฟฎๆ”น*/ if( ret < 0 ) { buffer->used = 0; return -1; } /*ๅฏนobj.reload()็š„ๅค„็†,ๅ‚ๆ•ฐไธบ็ฉบ็š„ๆƒ…ๅ†ตไธ่ฆไฟฎๆ”น*/ buf_start = tmp + finish; SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp, &buf_start, JS_SKIP_SPACE_BEFORE) ); SSLVPN_ASSERT( buf_start > tmp ); if( *buf_start =='(' ) { return -1; } if(!win_flag) { /*ๅŽปๆމ็บฟๆ€ง็ฉบ็™ฝ๏ผŒbuf_startๆŒ‡ๅ‘obj็š„ๅผ€ๅง‹ไฝ็ฝฎ*/ buf_start= tmp + begin; if(begin > 0||(begin==0 && !is_name_inside_char(*tmp))) { SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf_start, JS_SKIP_SPACE_AFTER) ); SSLVPN_ASSERT( buf_start < tmp + tmp_length ); } /*ๅฏน่ฟ™็งๆƒ…ๅ†ต็š„ๅค„็†return(obj).replace(re);*/ if( 0 == strncmp(buf_start, "return", strlen("return")) ) { buf_start += strlen("return"); re_flag = 1; } /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ" ไธŽ " . "๏ผŒbuf_endๆŒ‡ๅ‘obj็š„็ป“ๆŸไฝ็ฝฎ*/ buf_end = tmp + *start; do{ buf_end--; }while( isspace(*buf_end) || '.' == *buf_end ); buf_end++; /* copy objๅˆฐๆ•ฐ็ป„objไธญ*/ SSLVPN_ASSERT(buf_start < buf_end); sslvpn_js_calloc_copy( &obj, buf_start, buf_end ); length += strlen(obj); /*ๆ”นๅ˜result[i].start็š„ไฝ็ฝฎ*/ *start = buf_start - tmp; } else { obj = SSLVPN_calloc(1, strlen("window") + 32); strncpy(obj, "window", strlen("window")); length += strlen(obj); } /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ ๏ผŒbuf_startๆŒ‡ๅ‘' ( '็š„ไธ‹ไธ€ไธชไฝ็ฝฎ*/ buf_start= tmp + *end - 1; SSLVPN_ASSERT( 0 == sslvpn_js_skip_char(tmp + tmp_length, &buf_start, JS_SKIP_SPACE_AFTER) ); SSLVPN_ASSERT( buf_start < tmp + tmp_length ); SSLVPN_ASSERT(*buf_start == '('); buf_start++; /*ๅŽปๆމ"็บฟๆ€ง็ฉบ็™ฝ๏ผŒbuf_endๆŒ‡ๅ‘' ) '็š„ไฝ็ฝฎ*/ buf_end = tmp + finish; /* copy parameterๅˆฐๆ•ฐ็ป„parameterไธญ*/ SSLVPN_ASSERT(buf_start < buf_end); sslvpn_js_calloc_copy( &parameter, buf_start, buf_end ); length += strlen(parameter); /*ๆ”นๅ˜result[i].end็š„ไฝ็ฝฎ*/ *end = buf_end - tmp + 1; length += strlen(func_name); if(buffer->size < length + 64) { sslvpn_js_realloc_buffer(buffer, length + 64); } if(!strcmp(func_name, "DP_OL_window_eval")) { buffer->used = snprintf(buffer->buf, buffer->size, "eval(%s(%s, %s))", func_name, obj, parameter); } else if( 1 == re_flag ) { buffer->used = snprintf(buffer->buf, buffer->size, " %s(%s, %s)", func_name, obj, parameter); } else { buffer->used = snprintf(buffer->buf, buffer->size, "%s(%s, %s)", func_name, obj, parameter); } SSLVPN_free(obj); SSLVPN_free(parameter); return 0; } /****************************************************************************** ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_tag_list_init ๅŠŸ่ƒฝๆ่ฟฐ : ๅˆๅง‹ๅŒ–้“พ่กจ ่พ“ๅ…ฅๅ‚ๆ•ฐ : ้“พ่กจๅคดๆŒ‡้’ˆlist_head ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 06-01-2010 *******************************************************************************/ s32 sslvpn_tag_list_init(sslvpn_tag_list_head_s *list_entry) { list_entry->list_head = NULL; return 0; } /****************************************************************************** ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_tag_list_destroy ๅŠŸ่ƒฝๆ่ฟฐ : ้‡Šๆ”พ้“พ่กจ ่พ“ๅ…ฅๅ‚ๆ•ฐ : ้“พ่กจๅคดๆŒ‡้’ˆlist_head ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-29-2010 *******************************************************************************/ s32 sslvpn_tag_list_destroy(sslvpn_tag_list_s *list_head) { sslvpn_tag_list_s *list_node = NULL; sslvpn_tag_list_s *tmp_list_node = NULL; list_node = list_head; while(list_node != NULL) { tmp_list_node = list_node; list_node = list_node->next; tmp_list_node->rewrite_seg_func = NULL; tmp_list_node->next = NULL; SSLVPN_free(tmp_list_node); } return 0; } /****************************************************************************** ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_tag_list_traversal ๅŠŸ่ƒฝๆ่ฟฐ : ้ๅކ็”ฑๆŠฅๆ–‡ไธๅŒ็ฑปๅž‹็š„่Š‚็‚นๆž„ๆˆ็š„ๅ…จๅฑ€้“พ่กจ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-29-2010 *******************************************************************************/ s32 sslvpn_tag_list_traversal(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn, sslvpn_tag_list_s *list_head) { s32 ret = 0; sslvpn_tag_list_s *list_node = NULL; list_node = list_head; while(list_node != NULL) { if((ret = list_node->rewrite_seg_func(ip_node, conn, list_node)) < 0) { sslvpn_tag_list_destroy(list_head); conn->g_tag_list_entry.list_head = NULL; return ret; } list_node = list_node->next; } return 0; } /****************************************************************************** ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_html_rewrite_seg_func ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญHTMLๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 *******************************************************************************/ s32 sslvpn_html_rewrite_seg_func(void *ip_node_parm, void *ptr, sslvpn_tag_list_s *list_node) { sslvpn_conn_s *conn = (sslvpn_conn_s *)ptr; sslvpn_thread_ip_node_s *ip_node = (sslvpn_thread_ip_node_s*)ip_node_parm; s32 ret = 0; s32 i = 0; s32 chpos = 0; s32 offset = 0; s32 ac_offset = 0; s32 js_offset = 0; s32 seg_size = 0; u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; s32 ssologurl_len = 0; s8 *entry = conn->resp->entry; s8 tmp_buf[512] = {0}; s8 submitID_buf[64] = {0}; s8 submitName_buf[64] = {0}; s8 *point = NULL; s32 isHtml = 0; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; seg_size = list_node->end - list_node->start; /*ๅฆ‚ๆžœๆ•ดไธช่Š‚็‚น้ƒฝๆ˜ฏ็บฟๆ€ง็ฉบ็™ฝ๏ผŒๅˆ™ไธ้œ€ACๅŒน้…๏ผŒ็›ดๆŽฅๆ‹ท่ดๅˆฐentry_new*/ while(i < seg_size) { if((*(entry + list_node->start + i) == ' ') || (*(entry + list_node->start + i) == '\t') || (*(entry + list_node->start + i) == '\r') || (*(entry + list_node->start + i) == '\n')) { i++; } else { break; } } if(i == seg_size) { SSLVPN_ASSERT((conn->resp->entry_length_new + seg_size) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start, seg_size); conn->resp->entry_length_new += seg_size; offset += seg_size; goto out; } while(offset < seg_size) { mpsa_ac_search(g_html_rewrite_ac_engine, 0, (u8 *)entry + list_node->start + offset, seg_size - offset, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); if(0 == result_num || result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); break; } for(i = 0; i < result_num; i++) { if(result[i].id == LABLE_HTML) isHtml = 1; if(isHtml&&(0 == conn->ssl_js_lib_flag) && (LABLE_HEAD == result[i].id) && list_node->type != XML_TAG) { /*ๅฐ†js libไธญๆ‰€ไฝฟ็”จ็š„ๅ˜้‡ๅŠ ๅˆฐๆ–‡ไปถไธญ*/ js_offset = snprintf(tmp_buf, 512, "<script type=\"text/javascript\"> var DP_GW_URL_S = \"%s\"; var DP_GW_URL_L = \"%s\"; var DP_ORG_HOST = \"%s%s:%d/\"; var ssoaccount = \"%s\"; var ssopasswd = \"%s\";</script>\r\n", conn->abs_prefix, conn->rel_prefix, conn->real_protocol, conn->real_host, conn->real_port, conn->sso_account, conn->sso_passwd); SSLVPN_ASSERT((conn->resp->entry_length_new + js_offset) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, tmp_buf, js_offset); conn->resp->entry_length_new += js_offset; conn->ssl_js_lib_flag = 1; /*็ฌฌไธ€ๆฌกๅ‡บ็Žฐ<html>ๆ ‡่ฎฐๆ—ถ๏ผŒ้œ€่ฆๅผ•ๅ…ฅjs libๆ–‡ไปถ*/ /*ๅฐ†่ฏทๆฑ‚ๆœฌๅœฐlib script ๅŠ ๅˆฐๆ–‡ไปถไธญ*/ SSLVPN_ASSERT((conn->resp->entry_length_new + strlen(ip_node->ssl_js_lib)) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, ip_node->ssl_js_lib, strlen(ip_node->ssl_js_lib)); conn->resp->entry_length_new += strlen(ip_node->ssl_js_lib); if(1 == conn->sso_type) { memset(tmp_buf, 0, 512); js_offset = snprintf(tmp_buf, 512, "<script type=\"text/javascript\" src=\"/sslvpn/pub/sslvpn_sso_lib.js\"></script>\r\n"); SSLVPN_ASSERT((conn->resp->entry_length_new + js_offset) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, tmp_buf, js_offset); conn->resp->entry_length_new += js_offset; } } /*ๅฏปๆ‰พๆ ‡็ญพไน‹ๅŽ็ฌฌไธ€ไธชๅ‡บ็Žฐ็š„'>'ๅญ—็ฌฆ*/ SSLVPN_ASSERT((conn->resp->entry_length_new + result[i].start - ac_offset) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start + offset + ac_offset, result[i].start - ac_offset); conn->resp->entry_length_new += (result[i].start - ac_offset); ac_offset += (result[i].start - ac_offset); sslvpn_check_chr(entry + list_node->start + offset + result[i].start, '>', seg_size - offset - result[i].start, &chpos); if(-1 != chpos) { /*ไฟฎๆ”นๆ ‡็ญพไธญ็š„ๅฑžๆ€ง*/ if( ( ret = sslvpn_html_lable_attr_rewrite(ip_node, conn, entry + list_node->start + offset + result[i].start, chpos + 1, result[i].id) )) { goto out; } ac_offset += (chpos + 1); } else { ac_offset += seg_size - offset - result[i].start; break; } } offset += ac_offset; ac_offset = 0; } /*ๅฐ†buf็š„ๅ‰ฉไฝ™ๅ†…ๅฎนๆ‹ท่ดๅˆฐentry_newไธญ*/ SSLVPN_ASSERT((conn->resp->entry_length_new + seg_size - offset) <= conn->send_buf.buf_size); if(-1 == chpos && seg_size == offset) { memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start+result[i].start, seg_size -result[i].start); conn->resp->entry_length_new += (seg_size-result[i].start); } else { memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start + offset, seg_size - offset); conn->resp->entry_length_new += (seg_size - offset); } if((1 == conn->sso_type)&& list_node->type != XML_TAG) { ssologurl_len = strlen(conn->sso_logurl); snprintf(submitID_buf, 64, "id=\"%s\"", conn->sso_submitID); snprintf(submitName_buf, 64, "name=\"%s\"", conn->sso_submitID); if(strlen(conn->resp->req_real_uri) == ssologurl_len && (0 == strcasecmp(conn->resp->req_real_uri, conn->sso_logurl))) { if(NULL != strcasestr(conn->resp->entry_new, submitID_buf) || NULL != strcasestr(conn->resp->entry_new, submitName_buf)) { point = strcasestr(conn->resp->entry_new, "</html>"); if( NULL != point) { offset = sprintf(point, "\r\n<script type=\"text/javascript\"> var username =\"%s\"; var password =\"%s\"; var ssoLogin =\"%s\"; var ssoAction =\"%s\"; sslvpnFormSSOLogin(username, password, ssoLogin, ssoAction);</script>\r\n</html>",\ conn->sso_accountID, conn->sso_passwdID, conn->sso_submitID, conn->sso_action); offset -= strlen("</html>"); conn->resp->entry_length_new += offset; } } } } out: return ret; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_handle_link ๅŠŸ่ƒฝๆ่ฟฐ : ๅฏนlinkๅญ—็ฌฆไธญๅ‡บ็Žฐ็š„ๅŒน้…่ฟ›่กŒๅค„็† ่พ“ๅ…ฅๅ‚ๆ•ฐ : buf, buf_length ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… :ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 09-04-2010 *******************************************************************************/ s32 sslvpn_js_handle_rewritten(sslvpn_js_buffer_s *buffer, sslvpn_js_buffer_s *buffer_rewritten) { /* a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;") ่ฟ›่ฟ™ไธชๅ‡ฝๆ•ฐ็š„ๅ‚ๆ•ฐๆ˜ฏsslLocationReplace(a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"), /"/g,"&quot;")*/ u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; u32 length = (buffer->used)/3; s32 i = 0; s32 ret = 0; s32 store_start = 0; s32 store_end = 0; static s32 s_malloc_flag = 0; mpsa_ac_result_s *result = NULL; result = (mpsa_ac_result_s *)SSLVPN_malloc(sizeof(mpsa_ac_result_s)*length); SSLVPN_ASSERT( NULL != result ); mpsa_ac_search(g_js_keyword_rewrite_ac_engine, 0, (u8 *)buffer->buf, buffer->used, length, result, &result_num, &res_state, &res_length); if( 0 == s_malloc_flag && buffer->size < buffer->used + result_num*30 ) { sslvpn_js_realloc_buffer(buffer, buffer->used + result_num*30); s_malloc_flag = 1; } for(i = 0; i < result_num; i++) { store_start = result[i].start; store_end = result[i].end; if(0==strncmp(g_js_keyword_rewrite_ac_pattern[result[i].id - 1].pattern, buffer->buf+store_start, g_js_keyword_rewrite_ac_pattern[result[i].id - 1].length)) ret = js_label_function[result[i].id - 1].function(buffer->buf, buffer->used, &store_start, &store_end, buffer_rewritten, js_label_function[result[i].id - 1].func_name); else continue; /*ret == 0 ่กจ็คบๅŒน้…้œ€่ฆๅค„็†ๅฏนๆฏๆฌกlink็š„ๅค„็†ๅชๅŒน้…ไธ€ๆฌกไธ”ๅค„็†*/ if ( 0 == ret ) { SSLVPN_ASSERT( buffer->size >= (store_start + buffer_rewritten->used + buffer->used - store_end) ); memmove( buffer->buf + store_start + buffer_rewritten->used, buffer->buf + store_end, buffer->used - store_end ); memcpy( buffer->buf + store_start, buffer_rewritten->buf, buffer_rewritten->used); buffer->used = buffer->used - store_end + store_start + buffer_rewritten->used; buffer->buf[buffer->used]= '\0'; buffer_rewritten->used = 0; SSLVPN_free(result); sslvpn_js_handle_rewritten(buffer, buffer_rewritten); return 0; } } s_malloc_flag = 0; SSLVPN_free(result); return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_js_rewrite_seg_func ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญJSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… :ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… :ๅผ ่™Ž ไฟฎๆ”น็›ฎ็š„ : modify ไฟฎๆ”นๆ—ฅๆœŸ : 11-09-2010 *******************************************************************************/ s32 sslvpn_js_rewrite_seg_func(void *ip_node, void *ptr, sslvpn_tag_list_s *list_node) { sslvpn_conn_s *conn = (sslvpn_conn_s *)ptr; s32 i = 0; s32 ret = 0; s32 offset = 0; s32 flag = 0; u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; s8 *prior = NULL; s8 *next = NULL; s8 *entry_new = NULL; s32 entry_length_new = 0; s8 *js_entry = NULL; s32 js_entry_length = 0; s32 store_start_next = 0; s32 store_end_next = 0; s32 match_offset = 0; /* i ๆ˜ฏไธ€ไธชๆœ‰ๆ•ˆ็š„ๅŒน้…็š„ไฝ็ฝฎ*/ s32 store_start = 0; s32 store_end = 0; sslvpn_js_buffer_s buffer_rewritten; sslvpn_js_buffer_s buffer_rewritten_next; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; js_entry = conn->resp->entry + list_node->start; js_entry_length = list_node->end - list_node->start; entry_new = conn->resp->entry_new; entry_length_new = conn->resp->entry_length_new; sslvpn_js_init_buffer_s(&buffer_rewritten); sslvpn_js_init_buffer_s(&buffer_rewritten_next); if(NULL == entry_new) { return SSLVPN_ERROR_FLAG_REALLOC; } do { mpsa_ac_search(g_js_keyword_rewrite_ac_engine, 0, (u8 *)js_entry, js_entry_length, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); if(result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); break; } for(i = 0; i < result_num; i++) { /*ไธพไพ‹xxx.src= "https://192.168.2.254"; link่ฟ”ๅ›ž็š„ๆ˜ฏDP_write_src(xxx, append, "https://192.168.2.254") ๅนถไธ”result[i].startๆŒ‡ๅ‘็ฌฌไธ€ไธชx, result[i].endๆŒ‡ๅ‘' ; 'ๅญ—็ฌฆ*/ store_start = result[i].start; store_end = result[i].end; if(store_end <= offset) { continue; } SSLVPN_ASSERT(JS_KW_SRC <= result[i].id && result[i].id <= JS_KW_ACTION); if(0==strncmp(g_js_keyword_rewrite_ac_pattern[result[i].id - 1].pattern, js_entry+store_start, g_js_keyword_rewrite_ac_pattern[result[i].id - 1].length)) ret = js_label_function[result[i].id - 1].function(js_entry, js_entry_length, &store_start, &store_end, &buffer_rewritten, js_label_function[result[i].id - 1].func_name); else continue; /*ret == 0 ่กจ็คบๅŒน้…้œ€่ฆๅค„็†*/ if ( 0 == ret ) { match_offset = i; /*่งฃๅ†ณ่ฟ™็ง้—ฎ้ข˜(str + '').replace(this.src = url).replace(/^\s+/g, ''); ๆ‰พๅˆฐไธ‹ไธ€ไธชๆœ‰ๆ•ˆ็š„ๅŒน้…(่ฟ™ไธชๆœ‰ๆ•ˆๅŒน้…ไธๅœจ่ฟ™ๆฌกๅŒน้…ไธญ) ไธŽ่ฟ™ๆฌกๅŒน้…ๆ˜ฏๅฆๆœ‰ๅ…ณ็ณป*/ if( i < result_num - 1 ) { store_start_next = store_start; store_end_next = store_end; while(i < result_num - 1) { /*่ฟ‡ๆปคๅˆฐ่ฟ™็งๆƒ…ๅ†ต(str + '').replace(this.src = url) ไธญ็š„srcๅŒน้…*/ do { i++; /*่งฃๅ†ณ้œ€ๆ‰พไธ‹ไธ€ๆฌกๆœ‰ๆ•ˆๅŒน้…๏ผŒobj.writeln(html_statment) ็•™ไธ‹็š„dubug*/ if( i < result_num && \ ((0 == strncasecmp(js_label_function[result[i].id - 1].func_name, "DP_OL_writeLn", strlen("DP_OL_writeLn") ))\ || (0 == strncasecmp(js_label_function[result[i].id - 1].func_name, "DP_write_backgroundImage", strlen("DP_write_backgroundImage") )))) { break; } }while( result[i].start < store_end_next && i < result_num ); if( i == result_num ) { break; } store_start_next = result[i].start; store_end_next = result[i].end; if(0==strncmp(g_js_keyword_rewrite_ac_pattern[result[i].id - 1].pattern, js_entry+store_start_next, g_js_keyword_rewrite_ac_pattern[result[i].id - 1].length)) ret = js_label_function[result[i].id - 1].function(js_entry, js_entry_length, &store_start_next, &store_end_next, &buffer_rewritten_next, js_label_function[result[i].id - 1].func_name); else continue; /*่กจ็คบ่ฟ™ไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…ไธŽไธŠไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…ๆœ‰ๅ…ณ็ณป*/ if( 0 == ret && store_start_next <= result[match_offset].end ) { /*ๆ”นๅ˜ๆœ‰ๆ•ˆๅŒน้…็š„ไฝ็ฝฎ*/ match_offset = i; store_start = store_start_next; store_end = store_end_next; if(buffer_rewritten.size < buffer_rewritten_next.used + 1) { sslvpn_js_realloc_buffer(&buffer_rewritten, buffer_rewritten_next.used + 1); } sslvpn_js_cpy_to_buffer(&buffer_rewritten, buffer_rewritten_next.buf, buffer_rewritten_next.used); buffer_rewritten_next.used = 0; } /*่กจ็คบ่ฟ™ๆฌกๆœ‰ๆ•ˆๅŒน้…ไธŽไธŠๆฌกๆฒกๅ…ณ็ณป;ๅฏไปฅcopyไธŠไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…*/ else if( 0 == ret ) { break; } } i--; } if( AC_RESULT_MAX_NUMBER == result_num && (result_num - 1 == i || store_end >= result[result_num - 1].start) ) { js_entry += offset; js_entry_length -= offset; conn->resp->entry_length_new = entry_length_new; offset = 0; flag = 1; break; } sslvpn_js_handle_rewritten(&buffer_rewritten, &buffer_rewritten_next); memcpy(entry_new + entry_length_new, js_entry + offset, store_start - offset); entry_length_new += store_start - offset; memcpy(entry_new + entry_length_new, buffer_rewritten.buf, buffer_rewritten.used); entry_length_new += buffer_rewritten.used; offset = store_end; buffer_rewritten.used = 0; } } if( 1 == flag ) { flag = 0; continue; } /*copy ๆœ€ๅŽไธ€ไธชๆœ‰ๆ•ˆๅŒน้…็š„end ( ็ญ‰ไบŽoffset็š„ๅ€ผ) ไธŽentry็ป“ๆŸ่ฟ™ๆฎตๅญ—็ฌฆ ๅˆฐentry_newไธญ ๆˆ–่€…่กจ็คบ่ฟ™ๆฎตentryๆฒกๆœ‰ๅŒน้…็ป“ๆžœ๏ผŒ็›ดๆŽฅcopy่ฟ™ๆฎตๅˆฐentry_new๏ผŒๆญคๆ—ถoffset=0*/ /*่กจ็คบ็ฌฌ512ไธชๅŒน้…ไธŽๆœ€ๅŽไธ€ๆฌกๆœ‰ๆ•ˆๅŒน้…ไธๅ…ณ่”*/ if( AC_RESULT_MAX_NUMBER == result_num ) { prior = NULL; next = js_entry + offset; while( (next = strpbrk(next, ";{}")) != NULL ) { if( next < js_entry + result[AC_RESULT_MAX_NUMBER - 1].start ) { prior = next; next++; } else { break; } } if( NULL != prior ) { if( 0 == offset && prior < js_entry + result[0].start) { prior = js_entry + result[AC_RESULT_MAX_NUMBER - 2].end; } memcpy(entry_new + entry_length_new, js_entry + offset, prior - (js_entry + offset)); entry_length_new += prior - (js_entry + offset); offset = prior - js_entry; } /*ๆฒกๆœ‰่ฟ™ไธชelse if ไผšๆญปๅพช็Žฏ*/ else if( 0 == offset ) { memcpy(entry_new + entry_length_new, js_entry, result[AC_RESULT_MAX_NUMBER - 2].end); entry_length_new += result[AC_RESULT_MAX_NUMBER - 2].end; offset += result[AC_RESULT_MAX_NUMBER - 2].end; } js_entry += offset; js_entry_length -= offset; conn->resp->entry_length_new = entry_length_new; offset = 0; continue; } memcpy(entry_new + entry_length_new, js_entry + offset, js_entry_length - offset); entry_length_new += js_entry_length - offset; conn->resp->entry_length_new = entry_length_new; }while( AC_RESULT_MAX_NUMBER == result_num ); sslvpn_js_free_buffer(&buffer_rewritten); sslvpn_js_free_buffer(&buffer_rewritten_next); return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_VBScript_rewrite_seg_func ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญJSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… :ๅบทๆ™บๅ‹‡ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 08-09-2011 *******************************************************************************/ s32 sslvpn_VBScript_rewrite_seg_func(void *ip_node, void *ptr, sslvpn_tag_list_s *list_node) { sslvpn_conn_s *conn = (sslvpn_conn_s *)ptr; s32 i = 0; s32 ret = 0; s32 offset = 0; s32 flag = 0; u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; s8 *prior = NULL; s8 *next = NULL; s8 *entry_new = NULL; s8 *buf_temp = NULL; s32 entry_length_new = 0; s8 *js_entry = NULL; s32 js_entry_length = 0; s32 store_start_next = 0; s32 store_end_next = 0; s32 match_offset = 0; /* i ๆ˜ฏไธ€ไธชๆœ‰ๆ•ˆ็š„ๅŒน้…็š„ไฝ็ฝฎ*/ s32 store_start = 0; s32 store_end = 0; sslvpn_js_buffer_s buffer_rewritten; sslvpn_js_buffer_s buffer_rewritten_next; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; js_entry = conn->resp->entry + list_node->start; js_entry_length = list_node->end - list_node->start; entry_new = conn->resp->entry_new; entry_length_new = conn->resp->entry_length_new; sslvpn_js_init_buffer_s(&buffer_rewritten); sslvpn_js_init_buffer_s(&buffer_rewritten_next); if(NULL == entry_new) { return SSLVPN_ERROR_FLAG_REALLOC; } do { mpsa_ac_search(g_js_keyword_rewrite_ac_engine, 0, (u8 *)js_entry, js_entry_length, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); if(result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); break; } for(i = 0; i < result_num; i++) { /*ไธพไพ‹xxx.src= "https://192.168.2.254"; link่ฟ”ๅ›ž็š„ๆ˜ฏsslSetSrc(xxx, append, "https://192.168.2.254") ๅนถไธ”result[i].startๆŒ‡ๅ‘็ฌฌไธ€ไธชx, result[i].endๆŒ‡ๅ‘' ; 'ๅญ—็ฌฆ*/ store_start = result[i].start; store_end = result[i].end; if(store_end <= offset) { continue; } SSLVPN_ASSERT(JS_KW_SRC <= result[i].id && result[i].id <= JS_KW_ACTION); buf_temp = (s8 *)SSLVPN_malloc((strlen(js_label_function[result[i].id - 1].func_name)+5) * sizeof(s8)); /* *ๅœจๅŽŸๆฅ็š„jsๅ‡ฝๆ•ฐๅ‰้ขๆทปๅŠ ไธŠcallๆ˜ฏไธบไบ†ๅœจVBScript *่„šๆœฌๆ–‡ไปถไธญๆ‰ง่กŒjs่„šๆœฌ๏ผŒไธ‹้ข็š„ๆ“ไฝœๅ’Œ่ฟ™้‡Œ็š„ไฝœ็”จไธ€ๆ ท */ sprintf(buf_temp, "call %s", js_label_function[result[i].id - 1].func_name); if(0==strncmp(g_js_keyword_rewrite_ac_pattern[result[i].id - 1].pattern, js_entry+store_start, g_js_keyword_rewrite_ac_pattern[result[i].id - 1].length)) ret = js_label_function[result[i].id - 1].function(js_entry, js_entry_length, &store_start, &store_end, &buffer_rewritten, buf_temp); else continue; SSLVPN_free(buf_temp); /*ret == 0 ่กจ็คบๅŒน้…้œ€่ฆๅค„็†*/ if ( 0 == ret ) { match_offset = i; /*่งฃๅ†ณ่ฟ™็ง้—ฎ้ข˜(str + '').replace(this.src = url).replace(/^\s+/g, ''); ๆ‰พๅˆฐไธ‹ไธ€ไธชๆœ‰ๆ•ˆ็š„ๅŒน้…(่ฟ™ไธชๆœ‰ๆ•ˆๅŒน้…ไธๅœจ่ฟ™ๆฌกๅŒน้…ไธญ) ไธŽ่ฟ™ๆฌกๅŒน้…ๆ˜ฏๅฆๆœ‰ๅ…ณ็ณป*/ if( i < result_num - 1 ) { store_start_next = store_start; store_end_next = store_end; while(i < result_num - 1) { /*่ฟ‡ๆปคๅˆฐ่ฟ™็งๆƒ…ๅ†ต(str + '').replace(this.src = url) ไธญ็š„srcๅŒน้…*/ do { i++; /*่งฃๅ†ณ้œ€ๆ‰พไธ‹ไธ€ๆฌกๆœ‰ๆ•ˆๅŒน้…๏ผŒobj.writeln(html_statment) ็•™ไธ‹็š„dubug*/ if( i < result_num && \ 0 == strncasecmp(js_label_function[result[i].id - 1].func_name, "sslWriteLn", strlen("sslWriteLn") ) ) { break; } }while( result[i].start < store_end_next && i < result_num ); if( i == result_num ) { break; } store_start_next = result[i].start; store_end_next = result[i].end; buf_temp = (s8 *)SSLVPN_malloc((strlen(js_label_function[result[i].id - 1].func_name)+5) * sizeof(s8)); sprintf(buf_temp, "call %s", js_label_function[result[i].id - 1].func_name); if(0==strncmp(g_js_keyword_rewrite_ac_pattern[result[i].id - 1].pattern, js_entry+store_start_next, g_js_keyword_rewrite_ac_pattern[result[i].id - 1].length)) ret = js_label_function[result[i].id - 1].function(js_entry, js_entry_length, &store_start_next, &store_end_next, &buffer_rewritten_next, buf_temp); else continue; SSLVPN_free(buf_temp); /*่กจ็คบ่ฟ™ไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…ไธŽไธŠไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…ๆœ‰ๅ…ณ็ณป*/ if( 0 == ret && store_start_next <= result[match_offset].end ) { /*ๆ”นๅ˜ๆœ‰ๆ•ˆๅŒน้…็š„ไฝ็ฝฎ*/ match_offset = i; store_start = store_start_next; store_end = store_end_next; if(buffer_rewritten.size < buffer_rewritten_next.used + 1) { sslvpn_js_realloc_buffer(&buffer_rewritten, buffer_rewritten_next.used + 1); } sslvpn_js_cpy_to_buffer(&buffer_rewritten, buffer_rewritten_next.buf, buffer_rewritten_next.used); buffer_rewritten_next.used = 0; } /*่กจ็คบ่ฟ™ๆฌกๆœ‰ๆ•ˆๅŒน้…ไธŽไธŠๆฌกๆฒกๅ…ณ็ณป;ๅฏไปฅcopyไธŠไธ€ๆฌก็š„ๆœ‰ๆ•ˆๅŒน้…*/ else if( 0 == ret ) { break; } } i--; } if( AC_RESULT_MAX_NUMBER == result_num && (result_num - 1 == i || store_end >= result[result_num - 1].start) ) { js_entry += offset; js_entry_length -= offset; conn->resp->entry_length_new = entry_length_new; offset = 0; flag = 1; break; } sslvpn_js_handle_rewritten(&buffer_rewritten, &buffer_rewritten_next); memcpy(entry_new + entry_length_new, js_entry + offset, store_start - offset); entry_length_new += store_start - offset; memcpy(entry_new + entry_length_new, buffer_rewritten.buf, buffer_rewritten.used); entry_length_new += buffer_rewritten.used; offset = store_end; buffer_rewritten.used = 0; } } if( 1 == flag ) { flag = 0; continue; } /*copy ๆœ€ๅŽไธ€ไธชๆœ‰ๆ•ˆๅŒน้…็š„end ( ็ญ‰ไบŽoffset็š„ๅ€ผ) ไธŽentry็ป“ๆŸ่ฟ™ๆฎตๅญ—็ฌฆ ๅˆฐentry_newไธญ ๆˆ–่€…่กจ็คบ่ฟ™ๆฎตentryๆฒกๆœ‰ๅŒน้…็ป“ๆžœ๏ผŒ็›ดๆŽฅcopy่ฟ™ๆฎตๅˆฐentry_new๏ผŒๆญคๆ—ถoffset=0*/ /*่กจ็คบ็ฌฌ512ไธชๅŒน้…ไธŽๆœ€ๅŽไธ€ๆฌกๆœ‰ๆ•ˆๅŒน้…ไธๅ…ณ่”*/ if( AC_RESULT_MAX_NUMBER == result_num ) { prior = NULL; next = js_entry + offset; while( (next = strpbrk(next, ";{}")) != NULL ) { if( next < js_entry + result[AC_RESULT_MAX_NUMBER - 1].start ) { prior = next; next++; } else { break; } } if( NULL != prior ) { if( 0 == offset && prior < js_entry + result[0].start) { prior = js_entry + result[AC_RESULT_MAX_NUMBER - 2].end; } memcpy(entry_new + entry_length_new, js_entry + offset, prior - (js_entry + offset)); entry_length_new += prior - (js_entry + offset); offset = prior - js_entry; } /*ๆฒกๆœ‰่ฟ™ไธชelse if ไผšๆญปๅพช็Žฏ*/ else if( 0 == offset ) { memcpy(entry_new + entry_length_new, js_entry, result[AC_RESULT_MAX_NUMBER - 2].end); entry_length_new += result[AC_RESULT_MAX_NUMBER - 2].end; offset += result[AC_RESULT_MAX_NUMBER - 2].end; } js_entry += offset; js_entry_length -= offset; conn->resp->entry_length_new = entry_length_new; offset = 0; continue; } memcpy(entry_new + entry_length_new, js_entry + offset, js_entry_length - offset); entry_length_new += js_entry_length - offset; conn->resp->entry_length_new = entry_length_new; }while( AC_RESULT_MAX_NUMBER == result_num ); sslvpn_js_free_buffer(&buffer_rewritten); sslvpn_js_free_buffer(&buffer_rewritten_next); return 0; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_css_rewrite_seg_func ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญCSSๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 *******************************************************************************/ s32 sslvpn_css_rewrite_seg_func(void *ip_node, void *ptr, sslvpn_tag_list_s *list_node) { sslvpn_conn_s *conn = (sslvpn_conn_s *)ptr; s32 ret = 0; s32 i = 0; s32 j = 0; s32 chpos = 0; s32 offset = 0; s32 ac_offset = 0; s32 seg_size = 0; u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; s8 *buffer = NULL; s32 buffer_len = 0; sslvpn_symbol_pair_s quote; s8 *entry = conn->resp->entry; seg_size = list_node->end - list_node->start; while(offset < seg_size) { buffer = entry + list_node->start + offset; buffer_len = seg_size - offset; mpsa_ac_search(g_css_keyword_rewrite_ac_engine, 0, (u8 *)entry + list_node->start + offset, seg_size - offset, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); if(0 == result_num || result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); break; } for(i = 0; i < result_num; i++) { /*ๅฏปๆ‰พๆ ‡็ญพไน‹ๅŽ็ฌฌไธ€ไธชๅ‡บ็Žฐ็š„')'ๅญ—็ฌฆ*/ SSLVPN_ASSERT((conn->resp->entry_length_new + result[i].start - ac_offset) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start + offset + ac_offset, result[i].start - ac_offset); conn->resp->entry_length_new += (result[i].start - ac_offset); ac_offset += (result[i].start - ac_offset); switch(result[i].id) { case CSS_KW_URL: { sslvpn_check_chr(buffer + result[i].start, ')', buffer_len - result[i].start, &chpos); break; } case CSS_KW_SRC: { for(j = 0; j < (buffer_len - result[i].end); j++) { if(!isspace(*(buffer + result[i].end + j)))break; } if(j == buffer_len - result[i].end) { if((i + 1) == result_num)goto REMAIN_COPY; continue; } if('=' == *(buffer + result[i].end + j)) { sslvpn_check_chr(buffer + result[i].start, '"', buffer_len - result[i].start, &(quote.pair_left)); if(-1 != quote.pair_left) { sslvpn_check_chr(buffer + result[i].start + quote.pair_left + 1, '"', buffer_len - result[i].start - quote.pair_left, &(quote.pair_right)); if(-1 != quote.pair_right) { chpos = quote.pair_left + quote.pair_right + 1; } else { chpos = -1; } } else { sslvpn_check_chr(buffer + result[i].start, '\'', buffer_len - result[i].start, &(quote.pair_left)); if(-1 != quote.pair_left) { sslvpn_check_chr(buffer + result[i].start + quote.pair_left + 1, '\'', buffer_len - result[i].start - quote.pair_left, &(quote.pair_right)); if(-1 != quote.pair_right) { chpos = quote.pair_left + quote.pair_right + 1; } else { chpos = -1; } } } } else {if((i + 1) == result_num)goto REMAIN_COPY;continue;} break; } case CSS_KW_IMPORT: { for(j = 0; j < (buffer_len - result[i].end); j++) { if(!isspace(*(buffer + result[i].end + j)))break; } if(j == buffer_len - result[i].end) {if((i + 1) == result_num)goto REMAIN_COPY;continue;} if((i + 1 < result_num) && (result[i].end + j) != result[i + 1].start) { sslvpn_check_chr(buffer + result[i].start, '"', buffer_len - result[i].start, &(quote.pair_left)); if(-1 != quote.pair_left) { sslvpn_check_chr(buffer + result[i].start + quote.pair_left + 1, '"', buffer_len - result[i].start - quote.pair_left, &(quote.pair_right)); if(-1 != quote.pair_right) { chpos = quote.pair_left + quote.pair_right + 1; quote.pair_right = result[i].start + chpos; } else { chpos = -1; } } else { chpos = -1; } } else {if((i + 1) == result_num)goto REMAIN_COPY;continue;} break; } } if(-1 != chpos) { /*ไฟฎๆ”นๆ ‡็ญพไธญ็š„ๅฑžๆ€ง*/ if( (ret = sslvpn_css_keyword_rewrite(conn, buffer + result[i].start, chpos + 1) ) ) { goto out; } ac_offset += (chpos + 1); } else { ac_offset += seg_size - offset - result[i].start; break; } while((i + 1 < result_num) && (result[i + 1].end < quote.pair_right))i++; } offset += ac_offset; ac_offset = 0; } /*ๅฐ†buf็š„ๅ‰ฉไฝ™ๅ†…ๅฎนๆ‹ท่ดๅˆฐentry_newไธญ*/ REMAIN_COPY: SSLVPN_ASSERT((conn->resp->entry_length_new + seg_size - offset) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start + offset, seg_size - offset); conn->resp->entry_length_new += (seg_size - offset); out: return ret; } /****************************************************************************** ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_xsl_rewrite_seg_func ๅŠŸ่ƒฝๆ่ฟฐ : ไฟฎๆ”น็ผ“ๅญ˜ไธญxslๆ ‡็ญพ ่พ“ๅ…ฅๅ‚ๆ•ฐ : conn๏ผŒlist_node ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ้™ˆๆ—ญ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 *******************************************************************************/ s32 sslvpn_xsl_rewrite_seg_func(void *ip_node, void *ptr, sslvpn_tag_list_s *list_node) { sslvpn_conn_s *conn = (sslvpn_conn_s *)ptr; s8 *tmp_buf = NULL; s32 tmp_buf_len = 0; s32 tmp_buf_size = 0; s32 ret = 0; s32 i = 0; s32 chpos = 0; s32 offset = 0; s32 ac_offset = 0; s32 seg_size = 0; u32 result_num = 0; u32 res_state = 0; u16 res_length = 0; s8 *entry = conn->resp->entry; sslvpn_tag_list_s tmp_list_node; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; seg_size = list_node->end - list_node->start; tmp_buf_size = 2 * seg_size; tmp_buf = SSLVPN_calloc(sizeof(s8), tmp_buf_size); if(NULL == tmp_buf) { ret = SSLVPN_ERROR_FLAG_REALLOC; goto out; } /*ๅฆ‚ๆžœๆ•ดไธช่Š‚็‚น้ƒฝๆ˜ฏ็บฟๆ€ง็ฉบ็™ฝ๏ผŒๅˆ™ไธ้œ€ACๅŒน้…๏ผŒ็›ดๆŽฅๆ‹ท่ดๅˆฐentry_new*/ while(i < seg_size) { if((*(entry + list_node->start + i) == ' ') || (*(entry + list_node->start + i) == '\t') || (*(entry + list_node->start + i) == '\r') || (*(entry + list_node->start + i) == '\n')) { i++; } else { break; } } if(i == seg_size) { SSLVPN_ASSERT((conn->resp->entry_length_new + seg_size) <= conn->send_buf.buf_size); memcpy(conn->resp->entry_new + conn->resp->entry_length_new, entry + list_node->start, seg_size); conn->resp->entry_length_new += seg_size; offset += seg_size; goto out; } while(offset < seg_size) { mpsa_ac_search(g_html_rewrite_ac_engine, 0, (u8 *)entry + list_node->start + offset, seg_size - offset, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); if(0 == result_num || result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); break; } for(i = 0; i < result_num; i++) { /*ๅฏปๆ‰พๆ ‡็ญพไน‹ๅŽ็ฌฌไธ€ไธชๅ‡บ็Žฐ็š„'>'ๅญ—็ฌฆ*/ SSLVPN_ASSERT((tmp_buf_len + result[i].start - ac_offset) <= conn->send_buf.buf_size); memcpy(tmp_buf + tmp_buf_len, entry + list_node->start + offset + ac_offset, result[i].start - ac_offset); tmp_buf_len += (result[i].start - ac_offset); ac_offset += (result[i].start - ac_offset); sslvpn_check_chr(entry + list_node->start + offset + result[i].start, '>', seg_size - offset - result[i].start, &chpos); if(-1 != chpos) { /*ไฟฎๆ”นๆ ‡็ญพไธญ็š„ๅฑžๆ€ง*/ if( ( ret = sslvpn_xsl_lable_attr_rewrite(conn, &tmp_buf, &tmp_buf_size, &tmp_buf_len, entry + list_node->start + offset + result[i].start, chpos + 1) )) { goto out; } ac_offset += (chpos + 1); } else { ac_offset += seg_size - offset - result[i].start; break; } } offset += ac_offset; ac_offset = 0; } /*ๅฐ†buf็š„ๅ‰ฉไฝ™ๅ†…ๅฎนๆ‹ท่ดๅˆฐtmp_bufไธญ*/ SSLVPN_ASSERT((tmp_buf_len + seg_size - offset) <= conn->send_buf.buf_size); memcpy(tmp_buf + tmp_buf_len, entry + list_node->start + offset, seg_size - offset); tmp_buf_len += (seg_size - offset); /*็”จHTMLๆ–นๆณ•ๆ”นๅ†™่ฟ‡ไธ€้ๅŽ๏ผŒ้œ€่ฆๅฏนtemp_bufไธญ็š„ๅ†…ๅฎนๅ†่ฟ›่กŒไธ€ๆฌกjsๆ”นๅ†™ ๆ‰€ไปฅ้œ€่ฆๅฐ†entryๆŒ‡้’ˆๆŒ‡ๅ‘tmp_buf */ conn->resp->entry = tmp_buf; tmp_list_node.start = 0; tmp_list_node.end = tmp_buf_len; tmp_list_node.type = JS_IN_XSLT_TAG; tmp_list_node.rewrite_seg_func = sslvpn_js_rewrite_seg_func; /*่ฐƒ็”จjsๆ”นๅ†™ๅ‡ฝๆ•ฐ*/ sslvpn_js_rewrite_seg_func(ip_node, conn, &tmp_list_node); SSLVPN_free(tmp_buf); /*ๆ”นๅ†™ๅฎŒๆˆๅŽ,entry ๆŒ‡ๅ‘ๅŽŸไฝ็ฝฎ,ไพ›้“พ่กจ็š„ๅ…ถไป–่Š‚็‚นไฝฟ็”จ*/ conn->resp->entry = entry; out: return ret; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_ac_engine_init ๅŠŸ่ƒฝๆ่ฟฐ : ๅˆๅง‹ๅŒ–ACๅผ•ๆ“Ž ่พ“ๅ…ฅๅ‚ๆ•ฐ : AC็‰นๅพ็ป“ๆž„ไฝ“ๆ•ฐ็ป„,ๆ•ฐ็ป„้•ฟๅบฆ ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ็ผ–่ฏ‘ๆˆๅŠŸ็š„ACๅผ•ๆ“Ž -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๆ–น็š“ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 *******************************************************************************/ mpsa_ac_s *sslvpn_ac_engine_init(sslvpn_ac_pattern_s *pattern, s32 count) { s32 i = 0; s32 rc = 0; mpsa_ac_s *ac_engine = NULL; /*่Žทๅ–AC ๅผ•ๆ“Ž*/ ac_engine = mpsa_ac_new(MPSA_AC_DFA_FULL, AC_THRESHOLD_MAX); if(NULL == ac_engine) { return NULL; } /*ๆทปๅŠ ็‰นๅพ*/ for(i = 0; i < count; i++) { rc = mpsa_ac_add_pattern(ac_engine, (u8 *)pattern[i].pattern, pattern[i].length, pattern[i].id); if(0 != rc) { return NULL; } } /*ๅผ•ๆ“Ž็ผ–่ฏ‘*/ rc = mpsa_ac_compile(ac_engine); if (0 != rc) { return NULL; } /*่ฟ”ๅ›ž็ผ–่ฏ‘ๅฅฝๅŠ ๅ…ฅ็‰นๅพ็š„ๅผ•ๆ“Ž*/ return ac_engine; } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_strtolower ๅŠŸ่ƒฝๆ่ฟฐ :ๅฐ†็ป™ๅฎšๅญ—็ฌฆไธฒๆ”นไธบๅฐๅ†™่ฟ”ๅ›ž ่พ“ๅ…ฅๅ‚ๆ•ฐ : str ่พ“ๅ‡บๅ‚ๆ•ฐ : dst ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅบทๆ™บๅ‹‡ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 08-12-2011 *******************************************************************************/ s8* sslvpn_strtolower(s8 *str , s8 *dst) { s32 i = 0; if(NULL != str && NULL != dst) { for(i = 0; i<strlen(str); i++) { *(dst+i) = tolower(*(str+i)); } return dst; } else { return NULL; } } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_strntolower ๅŠŸ่ƒฝๆ่ฟฐ :ๅฐ†็ป™ๅฎšๅญ—็ฌฆไธฒไธญๅ‰nไธชๅญ—็ฌฆๆ”นไธบๅฐๅ†™่ฟ”ๅ›ž ่พ“ๅ…ฅๅ‚ๆ•ฐ : str ่พ“ๅ‡บๅ‚ๆ•ฐ : dst ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅบทๆ™บๅ‹‡ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 08-12-2011 *******************************************************************************/ s8* sslvpn_strntolower(s8 *str , s8 *dst, s32 count) { if(NULL != str && NULL != dst && count >0 && count <= strlen(str)) { s32 i = 0; for(i = 0; i < count; i++) { *(dst+i) = tolower(*(str+i)); } return dst; } else { return NULL; } } /******************************************************************************* ๅ‡ฝๆ•ฐๅ็งฐ : sslvpn_add_seg_to_list ๅŠŸ่ƒฝๆ่ฟฐ : ๅฐ†ๆŠฅๆ–‡ไธญไธๅŒ็ฑปๅž‹็š„่Š‚็‚น็š„่ตทๅง‹็ป“ๆŸไฝ็ฝฎๆŒ‚ๅˆฐๅ…จๅฑ€้“พ่กจไธŠ ่พ“ๅ…ฅๅ‚ๆ•ฐ : read_buf:ๆ‰€้œ€่ฆๅค„็†็š„buf, count:buf้•ฟๅบฆ ่พ“ๅ‡บๅ‚ๆ•ฐ : ๆ—  ่ฟ” ๅ›ž ๅ€ผ : ๆ—  -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๆ–น็š“ ไฟฎๆ”น็›ฎ็š„ : create ไฟฎๆ”นๆ—ฅๆœŸ : 05-18-2010 -------------------------------------------------------------------------------- ๆœ€่ฟ‘ไธ€ๆฌกไฟฎๆ”น่ฎฐๅฝ• : ไฟฎๆ”นไฝœ่€… : ๅบทๆ™บๅ‹‡ ไฟฎๆ”น็›ฎ็š„ : alter ไฟฎๆ”นๆ—ฅๆœŸ : 08-10-2011 *******************************************************************************/ s32 sslvpn_add_pkt_seg_to_list(sslvpn_conn_s *conn, s8 *read_buf, s32 count, s32 (*xsl_or_html_rewrite_func)(void *, void *, sslvpn_tag_list_s *)) { s32 i = 0; s32 chpos = 0; u32 result_num = 0; u32 res_state = 0; u32 tag_type = JS_TAG; u16 res_length = 0; sslvpn_tag_list_s *tag_node = NULL; sslvpn_tag_list_s *last = NULL; sslvpn_tag_list_s *html_tag_node = NULL; sslvpn_tag_list_s *js_tag_node = NULL; mpsa_ac_result_s result[AC_RESULT_MAX_NUMBER + 1]; s8 *buf_tmp = NULL; s8 *vbspos = NULL; TTY_DEBUG("sslvpn_add_pkt_seg_to_list entry!!\n"); /*ๅŒน้…ac็‰นๅพ*/ mpsa_ac_search(g_pkt_seg_ac_engine, 0, (u8 *)read_buf, count, AC_RESULT_MAX_NUMBER, result, &result_num, &res_state, &res_length); /*ๅฆ‚ๆžœๆฒกๆœ‰ๅŒน้…ๅˆฐCSS็ฑปๅž‹ๆˆ–JS็ฑปๅž‹็š„ๆ ‡็ญพ๏ผŒๅˆ™ๆ•ดไธชentryไธบhtmlๆˆ–่€…xsl็ฑปๅž‹*/ if(result_num > AC_RESULT_MAX_NUMBER) { TTY_DEBUG("*************************************\n\nresult_num=%d\n\n****************************************\n", result_num); return 0; } if(result_num == 0) { tag_node = sslvpn_make_tag_node(0, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } conn->g_tag_list_entry.list_head = tag_node; return 0; } /*ๅฆ‚ๆžœๅŒน้…ๅˆฐไบ†CSSๆ ‡็ญพๆˆ–่€…JSๆ ‡็ญพ๏ผŒ่ฟ›่กŒไปฅไธ‹ๅค„็†*/ /*็ฌฌไธ€ไธชๆ ‡็ญพไน‹ๅ‰็š„ๅ†…ๅฎนๅฑžไบŽhtml*/ tag_node = sslvpn_make_tag_node(0, result[0].start, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } conn->g_tag_list_entry.list_head = tag_node; last = tag_node; /*้ๅކๅทฒๅŒน้…ๅ‡บๆ ‡็ญพ็š„resultๆ•ฐ็ป„๏ผŒ็”Ÿๆˆๅฏนๅบ”็š„้“พ่กจ่Š‚็‚น*/ for(i = 0; i < result_num; i++) { /*ๅค„็†CSS็ฑปๅž‹ๆ ‡็ญพ*/ if(CSS_START_ID == result[i].id) { /******************ๅค„็†ไปฅไธ‹ๆƒ…ๅ†ต******************************** 1): ๅฝขๅฆ‚<style xxxxxxxxxxxxxxxxxxxx /> ๅŽ่ทŸhtml 2): ๅฝขๅฆ‚<style xxxxxxxxxxxxxxxxxxxxxx>ๅŽ่ทŸhtml 3): ๅฝขๅฆ‚<style xxxxxxxxxxxxxxxxxxxx> xxxxxxxxxxxx </style> *******************************************************************/ /*ๅฏปๆ‰พ<style ๅŽ็ฌฌไธ€ไธชๅณๅฐ–ๆ‹ฌๅท*/ sslvpn_check_chr(read_buf + result[i].end, '>', count - result[i].end, &chpos); /*็”ฑไบŽๆ–‡ไปถๆ˜ฏๅฎŒๆ•ด็š„,ไธ€ๅฎš่ƒฝๆ‰พๅˆฐ*/ SSLVPN_ASSERT(chpos != -1); if(i < (result_num - 1)) { /*ๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพๆ˜ฏCSS็ป“ๆŸๆ ‡็ญพ*/ if(CSS_END_ID == result[i + 1].id) { html_tag_node = sslvpn_make_tag_node(result[i].start, result[i].end + chpos + 1, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; last = html_tag_node; tag_node = sslvpn_make_tag_node(result[i].end + chpos + 2, result[i + 1].end, CSS_TAG, sslvpn_css_rewrite_seg_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = tag_node; last = tag_node; /*i++ๆ˜ฏไธบไบ†ๆŒ‡ๅ‘end่Š‚็‚น๏ผŒๅœจๆญคๆฌกๅพช็Žฏ็ป“ๆŸๅŽๅฐฑๅค„็†ไธค่Š‚็‚นไน‹้—ด็š„html*/ i++; } /*ๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพไธๆ˜ฏCSS็ป“ๆŸๆ ‡็ญพ*/ else { tag_node = sslvpn_make_tag_node(result[i].start, result[i].end + chpos + 1, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = tag_node; last = tag_node; /*ๅฆ‚ๆžœๅฝ“ๅ‰ๆ ‡็ญพ็ป“ๆŸไธŽไธ‹ไธ€ไธชๆ ‡็ญพๅผ€ๅง‹ไน‹้—ดๆœ‰ๆ•ฐๆฎ*/ if(((CSS_START_ID == result[i + 1].id) || (JS_START_ID == result[i + 1].id)) && (0 != (result[i + 1].start - tag_node->end))) { html_tag_node = sslvpn_make_tag_node(result[i].end + chpos + 1, result[i + 1].start, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; last = html_tag_node; } } } /*ๅฆ‚ๆžœๅฝ“ๅ‰<style>ๆ ‡่ฎฐๅทฒๆ˜ฏๆ–‡ไปถๆœ€ๅŽไธ€ไธช*/ else { tag_node = sslvpn_make_tag_node(result[i].start, result[i].end + chpos + 1, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = tag_node; last = tag_node; /*ๅฆ‚ๆžœๅฝ“ๅ‰ๆ ‡็ญพ็ป“ๆŸไธŽๆ–‡ไปถ็ป“ๆŸไน‹้—ดๆ•ฐๆฎ*/ if(0 != count - tag_node->end) { html_tag_node = sslvpn_make_tag_node(result[i].end + chpos + 1, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; } return 0; } } /*ๅค„็†js็ฑปๅž‹ๆ ‡็ญพ*/ else if(JS_START_ID == result[i].id) { /******************ๅค„็†ไปฅไธ‹ๆƒ…ๅ†ต******************************** 1): ๅฝขๅฆ‚<script xxxxxxxxxxxxxxxxxxxx /> ๅŽ่ทŸhtml 2): ๅฝขๅฆ‚<script xxxxxxxxxxxxxxxxxxxx> xxxxxxxxxxxxxxxxxxx </script> 3): ๅฝขๅฆ‚<script xxxxxxxxxxxxxxxxxxxx>ๅŽ่ทŸhtml,ไธๅˆๆณ• 4): <script></script>ไน‹้—ดๅตŒๅ…ฅ<style></style>ๆ ‡็ญพ *******************************************************************/ /*ๅฏปๆ‰พ<script ๅŽ็ฌฌไธ€ไธชๅณๅฐ–ๆ‹ฌๅท*/ sslvpn_check_chr(read_buf + result[i].end, '>', count - result[i].end, &chpos); if(chpos > 0) { buf_tmp = (s8 *)SSLVPN_calloc(1, chpos * sizeof(s8) + 1); vbspos = (s8 *)SSLVPN_calloc(1, chpos * sizeof(s8) + 1); if(NULL != buf_tmp && NULL != vbspos) { strncpy(buf_tmp, read_buf + result[i].end, chpos); sslvpn_strntolower(buf_tmp, vbspos, strlen(buf_tmp)); if(NULL != vbspos) { if(NULL != strstr(vbspos, "vbs")) { tag_type = VBSCRIPT_TAG; } else { tag_type = JS_TAG; } } } else { return SSLVPN_ERROR_FLAG_REALLOC; } SSLVPN_free(buf_tmp); SSLVPN_free(vbspos); } /*็”ฑไบŽๆ–‡ไปถๆ˜ฏๅฎŒๆ•ด็š„,ไธ€ๅฎš่ƒฝๆ‰พๅˆฐ*/ SSLVPN_ASSERT(chpos != -1); /*็”ฑไบŽ<scriptxxxxxxxxxxxxxxxx> ไธญๅฏ่ƒฝๅŒ…ๅซsrcๅฑžๆ€ง๏ผŒ้œ€่ฆๆŠŠๅ…ถ ๅฝ“ๅšไธ€ไธช่Š‚็‚นๅ•็‹ฌๅค„็†*/ tag_node = sslvpn_make_tag_node(result[i].start, result[i].end + chpos + 1, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = tag_node; last = tag_node; if(i < result_num -1) { /*ๅค„็†ๅฝขๅฆ‚<script xxxxxxxxxxxxxxxxxxxx /> ็š„ๆƒ…ๅ†ต*/ if(*(read_buf + result[i].end + chpos - 1) == '/') { /*ๅฆ‚ๆžœๅฝ“ๅ‰ๆ ‡็ญพ็ป“ๆŸไธŽไธ‹ไธ€ไธชๆ ‡็ญพๅผ€ๅง‹ไน‹้—ดๆœ‰ๆ•ฐๆฎ*/ if(((JS_START_ID == result[i + 1].id) || (CSS_START_ID == result[i + 1].id)) && (0 != (result[i + 1].start - tag_node->end))) { html_tag_node = sslvpn_make_tag_node(last->end, result[i + 1].start, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; last = html_tag_node; } } /*ๅค„็†ๅฝขๅฆ‚<script xxxxxxxxxxxxxxxxxxxx > ็š„ๆƒ…ๅ†ต,็”ฑไบŽ<script>ๅ’Œ</script>ๆ ‡่ฎฐไน‹้—ดๅฏ่ƒฝๅตŒๅ…ฅ ไฝฟ็”จdocument.writeๅ†™ๅ…ฅ็š„<script>,</script>,<style></style>ๆ ‡่ฎฐ๏ผŒ้œ€่ฆ็‰นๆฎŠๅค„็† */ else if(JS_TAG == tag_type) { /*ๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพๆ˜ฏscript็ป“ๆŸๆ ‡็ญพ*/ /*ๆณจ: ็”ฑไบŽไน‹้—ด็š„</sciprt> ๆ ‡่ฎฐๆ˜ฏ่ขซๅ†™ไธบ<\/script>็š„ ,ๅ› ๆญคๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพไธบjs็ป“ๆŸ ๆ ‡็ญพ๏ผŒๅˆ™ๅ…ถไธ€ๅฎšๅ’Œๅ‰ไธ€ไธชjsๅผ€ๅง‹ๆ ‡็ญพๆ˜ฏ้…ๅฏน็š„*/ if(JS_END_ID == result[i + 1].id ) { js_tag_node = sslvpn_make_tag_node(last->end, result[i + 1].end, JS_TAG, sslvpn_js_rewrite_seg_func); if(NULL == js_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = js_tag_node; last = js_tag_node; } /*ๅค„็†<script></script>ๅตŒๅ…ฅๅ…ถไป–ๆ ‡็ญพ็š„ๆƒ…ๅ†ต*/ else { /*ๆ‰พๅˆฐJS็ป“ๆŸๆ ‡็ญพ*/ while((i < (result_num - 1)) && (JS_END_ID != result[i + 1].id)) { i++; } /*ๆ‰พๅˆฐไบ†*/ if(i < result_num - 1) { js_tag_node = sslvpn_make_tag_node(last->end, result[i + 1].end, JS_TAG, sslvpn_js_rewrite_seg_func); if(NULL == js_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = js_tag_node; last = js_tag_node; i++; } /*ๆ‰พไธๅˆฐ,ๆŠŠไน‹ๅŽ็š„้ƒฝๅฝ’ไธบhtml*/ else { html_tag_node = sslvpn_make_tag_node(last->end, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; return 0; } } } else if(VBSCRIPT_TAG == tag_type) { /*ๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพๆ˜ฏscript็ป“ๆŸๆ ‡็ญพ*/ /*ๆณจ: ็”ฑไบŽไน‹้—ด็š„</sciprt> ๆ ‡่ฎฐๆ˜ฏ่ขซๅ†™ไธบ<\/script>็š„ ,ๅ› ๆญคๅฆ‚ๆžœไธ‹ไธ€ไธชๆ ‡็ญพไธบjs็ป“ๆŸ ๆ ‡็ญพ๏ผŒๅˆ™ๅ…ถไธ€ๅฎšๅ’Œๅ‰ไธ€ไธชjsๅผ€ๅง‹ๆ ‡็ญพๆ˜ฏ้…ๅฏน็š„*/ if(JS_END_ID == result[i + 1].id ) { js_tag_node = sslvpn_make_tag_node(last->end, result[i + 1].end, VBSCRIPT_TAG, sslvpn_VBScript_rewrite_seg_func); if(NULL == js_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = js_tag_node; last = js_tag_node; } /*ๅค„็†<script></script>ๅตŒๅ…ฅๅ…ถไป–ๆ ‡็ญพ็š„ๆƒ…ๅ†ต*/ else { /*ๆ‰พๅˆฐJS็ป“ๆŸๆ ‡็ญพ*/ while((i < (result_num - 1)) && (JS_END_ID != result[i + 1].id)) { i++; } /*ๆ‰พๅˆฐไบ†*/ if(i < result_num - 1) { js_tag_node = sslvpn_make_tag_node(last->end, result[i + 1].end, VBSCRIPT_TAG, sslvpn_VBScript_rewrite_seg_func); if(NULL == js_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = js_tag_node; last = js_tag_node; i++; } /*ๆ‰พไธๅˆฐ,ๆŠŠไน‹ๅŽ็š„้ƒฝๅฝ’ไธบhtml*/ else { html_tag_node = sslvpn_make_tag_node(last->end, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; return 0; } } } } /*ๅฆ‚ๆžœๅฝ“ๅ‰<script>ๆ ‡่ฎฐๅทฒๆ˜ฏๆ–‡ไปถๆœ€ๅŽไธ€ไธช,ๅฐ†ไน‹ๅŽ็š„ๅฝ’ไธบhtml*/ else { html_tag_node = sslvpn_make_tag_node(last->end, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; return 0; } } /*ไธ€ไธช็ป“ๆŸๆ ‡็ญพๅ’Œไธ‹ไธ€ไธชๅผ€ๅง‹ๆ ‡็ญพไน‹้—ด่ฎพ็ฝฎไธบhtmlๆˆ–xsl่Š‚็‚น*/ if(i < result_num - 1) { if((0 != (result[i + 1].start - result[i].end)) && ((JS_END_ID == result[i].id) || (CSS_END_ID == result[i].id))) { /*้˜ฒๆญข่ฟž็ปญๅ‡บ็Žฐไธคไธช็ป“ๆŸๆ ‡่ฎฐ็š„ๆƒ…ๅ†ต*/ if((JS_END_ID == result[i + 1].id) || (CSS_END_ID == result[i + 1].id)) { html_tag_node = sslvpn_make_tag_node(result[i].end, result[i + 1].end, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); } else { html_tag_node = sslvpn_make_tag_node(result[i].end, result[i + 1].start, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); } if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last->next = html_tag_node; last = html_tag_node; } } } /* ๅฆ‚ๆžœๆœ€ๅŽไธ€ไธชๆ ‡็ญพ่ฟ˜ไธๅˆฐbufๅฐพ๏ผŒๅฐ†ๆœ€ๅŽไธ€ๆฎตๅ†…ๅฎนๆทปๅŠ ่ฟ›่Š‚็‚น*/ if((result[result_num - 1].id == CSS_END_ID || result[result_num - 1].id == JS_END_ID) && result[result_num - 1].end < count) { html_tag_node = sslvpn_make_tag_node(result[result_num - 1].end, count, HTML_OR_XSLT_TAG, xsl_or_html_rewrite_func); if(NULL == html_tag_node) { TTY_DEBUG("Make tag node faild!\n"); return 0; } last ->next = html_tag_node; } TTY_DEBUG("Success return!!\n"); return 0; } s32 sslvpn_rewrite_file_html(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn) { s32 ret = 0; TTY_DEBUG("sslvpn_rewrite_file_html entry!!\n"); /*ๅฐ†ไธๅŒ็š„ๆฎตๆŒ‚ๅ…ฅ้“พ่กจ*/ if(sslvpn_add_pkt_seg_to_list(conn, conn->resp->entry, conn->resp->entry_length, sslvpn_html_rewrite_seg_func)) { return SSLVPN_ERROR_FLAG_ERROR; } /*้ๅކ้“พ่กจ๏ผŒๆ นๆฎๅ›ž่ฐƒๅ‡ฝๆ•ฐๅค„็†ไธๅŒ็š„ๆฎต*/ if( ( ret = sslvpn_tag_list_traversal(ip_node, conn, conn->g_tag_list_entry.list_head) ) < 0 ) { return ret; } /*ๅฐ†ๅ…จๅฑ€้“พ่กจๆ‰€ๅ ็š„ๅ†…ๅญ˜็ฉบ้—ด้‡Šๆ”พ*/ sslvpn_tag_list_destroy(conn->g_tag_list_entry.list_head); conn->g_tag_list_entry.list_head = NULL; TTY_DEBUG("Success return!!\n"); return ret; } s32 sslvpn_rewrite_file_xml(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn) { s32 ret = 0; sslvpn_tag_list_s *p = NULL; p = SSLVPN_malloc(sizeof(sslvpn_tag_list_s)); if(NULL == p) { return SSLVPN_ERROR_FLAG_REALLOC; } p->type = XML_TAG; p->start = 0; p->end = conn->resp->entry_length; p->rewrite_seg_func = &sslvpn_html_rewrite_seg_func; p->next = NULL; if((ret = p->rewrite_seg_func(ip_node, conn, p)) < 0) { p->rewrite_seg_func = NULL; SSLVPN_free(p); return ret; } p->rewrite_seg_func = NULL; SSLVPN_free(p); return 0; } s32 sslvpn_rewrite_file_xsl(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn) { s32 ret = 0; if(sslvpn_add_pkt_seg_to_list(conn, conn->resp->entry, conn->resp->entry_length, sslvpn_xsl_rewrite_seg_func)) { return SSLVPN_ERROR_FLAG_ERROR; } /*้ๅކ้“พ่กจ๏ผŒๆ นๆฎๅ›ž่ฐƒๅ‡ฝๆ•ฐๅค„็†ไธๅŒ็š„ๆฎต*/ if( ( ret = sslvpn_tag_list_traversal(ip_node, conn, conn->g_tag_list_entry.list_head) ) < 0 ) { return ret; } /*ๅฐ†ๅ…จๅฑ€้“พ่กจๆ‰€ๅ ็š„ๅ†…ๅญ˜็ฉบ้—ด้‡Šๆ”พ*/ sslvpn_tag_list_destroy(conn->g_tag_list_entry.list_head); conn->g_tag_list_entry.list_head = NULL; return 0; } s32 sslvpn_rewrite_file_css(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn) { s32 ret = 0; sslvpn_tag_list_s *p = NULL; p = SSLVPN_malloc(sizeof(sslvpn_tag_list_s)); if(NULL == p) { return SSLVPN_ERROR_FLAG_REALLOC; } p->type = CSS_TAG; p->start = 0; p->end = conn->resp->entry_length; p->rewrite_seg_func = &sslvpn_css_rewrite_seg_func; p->next = NULL; if((ret = p->rewrite_seg_func(ip_node, conn, p)) < 0) { p->rewrite_seg_func = NULL; SSLVPN_free(p); return ret; } p->rewrite_seg_func = NULL; SSLVPN_free(p); return 0; } s32 sslvpn_rewrite_file_js(sslvpn_thread_ip_node_s *ip_node, sslvpn_conn_s *conn) { s32 ret = 0; sslvpn_tag_list_s *p = NULL; p = malloc(sizeof(sslvpn_tag_list_s)); if(NULL == p) { return SSLVPN_ERROR_FLAG_REALLOC; } p->type = JS_TAG; p->start = 0; p->end = conn->resp->entry_length; p->rewrite_seg_func = &sslvpn_js_rewrite_seg_func; p->next = NULL; if((ret = p->rewrite_seg_func(ip_node, conn, p)) < 0) { p->rewrite_seg_func = NULL; SSLVPN_free(p); return ret; } p->rewrite_seg_func = NULL; SSLVPN_free(p); return 0; } /*********************************************** s32 sslvpn_rewrite_file_other(sslvpn_conn_s *conn) { s8 *content_type = conn->resp->content_type; TTY_DEBUG("in sslvpn_rewrite_file_other, content_type = %s\n", content_type); if( NULL == content_type) { if(sslvpn_rewrite_file_html(conn)) { return -1; } } else if(strncasecmp(content_type, "text/html", strlen("text/html")) == 0) { if(sslvpn_rewrite_file_html(conn)) { return -1; } } else if(strncasecmp(content_type, "text/css", strlen("text/css")) == 0) { if(sslvpn_rewrite_file_css(conn)) { return -1; } } else if(strncasecmp(content_type, "text/javascript", strlen("text/javascript")) == 0) { if(sslvpn_rewrite_file_js(conn)) { return -1; } } else if(strncasecmp(content_type, "text/xml", strlen("text/xml")) == 0) { if(sslvpn_rewrite_file_xml(conn)) { return -1; } } return 0; } **************************************************/
b1bc57ae9e682f199e268ce5c4b5fdd6ed789591
b39417ab35af25c224407746ccb349c564b475a5
/include/pthread_rdwr.h
ef45c1d1b68e5b488e85692b5e9abc93e72b77ab
[ "MIT" ]
permissive
colinw7/CThread
db1eaf80ddc9af240dea6a157bb65893798dbfc5
90616f0283521ddecd32485863ea18109b015a81
refs/heads/master
2023-01-28T07:58:23.303586
2023-01-16T14:45:03
2023-01-16T14:45:03
12,322,164
1
1
null
null
null
null
UTF-8
C
false
false
667
h
pthread_rdwr.h
#ifndef PTHREAD_RDWR_H #define PTHREAD_RDWR_H typedef struct pthread_rdwr_t pthread_rdwr_t; struct pthread_rdwr_t { int readers_reading; int writer_writing; pthread_mutex_t mutex; pthread_cond_t lock_free; }; typedef void *pthread_rdwrattr_t; #define pthread_rdwrattr_default NULL; int pthread_rdwr_init_np (pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp); int pthread_rdwr_destroy_np(pthread_rdwr_t *rdwrp); int pthread_rdwr_rlock_np (pthread_rdwr_t *rdwrp); int pthread_rdwr_runlock_np(pthread_rdwr_t *rdwrp); int pthread_rdwr_wlock_np (pthread_rdwr_t *rdwrp); int pthread_rdwr_wunlock_np(pthread_rdwr_t *rdwrp); #endif
41b2269faa4b70e140a6c719b99803b06d280271
299fbad28cde120b4d46948fe07e2d78c3e8459d
/New folder/C-Programing-master skillup sudhir sir/con_ones.c
b8ac8d9255e89c7f4d9605bfee79e5c43dce74e7
[]
no_license
subbareddykovvuri/100-days-coding
ae29a3e1c332f519cf9b96e4a883dfd7881f805c
138ba60ad8746ae90d60d90bf92d51d3f8a19c10
refs/heads/master
2023-01-12T21:06:29.914441
2020-11-01T17:13:32
2020-11-01T17:13:32
292,535,750
0
0
null
null
null
null
UTF-8
C
false
false
232
c
con_ones.c
#include<stdio.h> int lcos(int n) { int c=0; while(n) { n=n&(n>>1); c++; } return c; } int main() { int c,n; scanf("%d",&n); c=lcos(n); printf("%d",c); } /* lonest con ones 10101010 01010101 -------- 00000000 c++ */
6ccfdc8e0f29cf376a0cfc4f4c96bddbd94fe743
1847cc51095bef9d50f8134d1c1e736991eef12e
/buaa_2017/2017_5_3.c
dd08de0c2c9b35767b9b48e9f8f4a3f43051cf3a
[]
no_license
a422478514/c-algorithm-gitlab
7c0f65e663ec5d49095acfb341cf05b3284b1a6b
b357b0dffaad1665134047c89fae17cfdd93303a
refs/heads/master
2022-11-02T20:17:14.437121
2020-06-15T11:38:19
2020-06-15T11:38:19
272,405,323
0
0
null
null
null
null
UTF-8
C
false
false
363
c
2017_5_3.c
#include <stdio.h> #include <string.h> #include <ctype.h> #include <malloc.h> int accul(int base,int factor,int max){ int i,result = 0; for (int i = 1; i <= max; ++i) { if(i%factor==0){ continue; } result+=base; } return result; } int main(int argc, char const *argv[]) { int result; result = accul(10,3,6); printf("%d\n", result); return 0; }
05e66f201ef6cbde8cdeeb803a1bf4d638985da4
dc6d8843d4964f1a260c5232040b6adb3091227b
/main.c
4b2103d0e3b735d6c1661f092d05d7390018b008
[ "MIT" ]
permissive
artursg/benfords-law-checker
e235640eae2e24ca561e05b9a2f5bafe0dee86bf
5545b340951f211f3d44c5fb850f2f39784ed0d6
refs/heads/master
2021-01-19T05:39:11.328819
2016-08-09T11:52:07
2016-08-09T11:52:07
65,290,278
0
0
null
null
null
null
UTF-8
C
false
false
671
c
main.c
#include <stdio.h> #include <string.h> char accumulator[10]; int main(int argc, char ** argv) { if (argc != 2) { printf("Benford law checker.\nUsage: ./benford [filename]\n"); return -1; } FILE * f = fopen(argv[1], "r"); memset(accumulator, 0, 10); if (f == NULL) { printf("Error. File is not available.\n"); return -1; } char c = 0; int total = 0; while((c = fgetc(f)) != EOF) { if (c >= '0' && c <= '9') { accumulator[c - '0'] += 1; total++; } } printf("Total digits: %d\n", total); int i = 0; for (i; i < 10; i++) printf("%d: %d\n", i, accumulator[i]); fclose(f); return 0; }
09d02f3b6555b96de469189607dd3cffd751edcd
262d82c2325aa1a479704f3a1263499392b3724f
/isim/MCU_tb_isim_beh.exe.sim/work/a_4266264580_1486280680.c
f768c4f2fdf34c2ab16b457811a150eb17f9712b
[]
no_license
pcielecki/Softcore-ATMega8535
25d1e5e25e77e17d11aa14aa842433cd31e20b1c
1c6c24907443703523a62fe55d024dab53a4191e
refs/heads/master
2023-01-24T17:12:36.946255
2016-01-24T17:16:14
2016-01-24T17:16:14
null
0
0
null
null
null
null
UTF-8
C
false
false
6,917
c
a_4266264580_1486280680.c
/**********************************************************************/ /* ____ ____ */ /* / /\/ / */ /* /___/ \ / */ /* \ \ \/ */ /* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */ /* / / All Right Reserved. */ /* /---/ /\ */ /* \ \ / \ */ /* \___\/\___\ */ /***********************************************************************/ /* This file is designed for use with ISim build 0x8ef4fb42 */ #define XSI_HIDE_SYMBOL_SPEC true #include "xsi.h" #include <memory.h> #ifdef __GNUC__ #include <stdlib.h> #else #include <malloc.h> #define alloca _alloca #endif static const char *ng0 = "C:/Users/Piotr/workspace/vlsi/vlsi_mcu/VLSI_MCU/AT8535.vhd"; extern char *IEEE_P_3620187407; char *ieee_p_3620187407_sub_767668596_3965413181(char *, char *, char *, char *, char *, char *); static void work_a_4266264580_1486280680_p_0(char *t0) { char t11[16]; char t15[16]; unsigned char t1; char *t2; unsigned char t3; char *t4; char *t5; unsigned char t6; unsigned char t7; char *t8; unsigned char t9; unsigned char t10; char *t12; char *t13; char *t14; char *t16; char *t17; int t18; unsigned int t19; char *t20; unsigned int t21; unsigned char t22; char *t23; char *t24; char *t25; char *t26; char *t27; LAB0: xsi_set_current_line(87, ng0); t2 = (t0 + 660U); t3 = xsi_signal_has_event(t2); if (t3 == 1) goto LAB5; LAB6: t1 = (unsigned char)0; LAB7: if (t1 != 0) goto LAB2; LAB4: LAB3: t2 = (t0 + 3296); *((int *)t2) = 1; LAB1: return; LAB2: xsi_set_current_line(88, ng0); t4 = (t0 + 1144U); t8 = *((char **)t4); t9 = *((unsigned char *)t8); t10 = (t9 == (unsigned char)3); if (t10 != 0) goto LAB8; LAB10: xsi_set_current_line(90, ng0); t2 = xsi_get_transient_memory(16U); memset(t2, 0, 16U); t4 = t2; memset(t4, (unsigned char)2, 16U); t5 = (t0 + 3356); t8 = (t5 + 32U); t12 = *((char **)t8); t13 = (t12 + 40U); t14 = *((char **)t13); memcpy(t14, t2, 16U); xsi_driver_first_trans_fast(t5); LAB9: goto LAB3; LAB5: t4 = (t0 + 684U); t5 = *((char **)t4); t6 = *((unsigned char *)t5); t7 = (t6 == (unsigned char)3); t1 = t7; goto LAB7; LAB8: xsi_set_current_line(89, ng0); t4 = (t0 + 1604U); t12 = *((char **)t4); t4 = (t0 + 7008U); t13 = (t0 + 7300); t16 = (t15 + 0U); t17 = (t16 + 0U); *((int *)t17) = 0; t17 = (t16 + 4U); *((int *)t17) = 15; t17 = (t16 + 8U); *((int *)t17) = 1; t18 = (15 - 0); t19 = (t18 * 1); t19 = (t19 + 1); t17 = (t16 + 12U); *((unsigned int *)t17) = t19; t17 = ieee_p_3620187407_sub_767668596_3965413181(IEEE_P_3620187407, t11, t12, t4, t13, t15); t20 = (t11 + 12U); t19 = *((unsigned int *)t20); t21 = (1U * t19); t22 = (16U != t21); if (t22 == 1) goto LAB11; LAB12: t23 = (t0 + 3356); t24 = (t23 + 32U); t25 = *((char **)t24); t26 = (t25 + 40U); t27 = *((char **)t26); memcpy(t27, t17, 16U); xsi_driver_first_trans_fast(t23); goto LAB9; LAB11: xsi_size_not_matching(16U, t21, 0); goto LAB12; } static void work_a_4266264580_1486280680_p_1(char *t0) { char *t1; char *t2; char *t3; unsigned char t4; char *t5; char *t6; char *t7; char *t8; char *t9; char *t10; static char *nl0[] = {&&LAB6, &&LAB6, &&LAB6, &&LAB5, &&LAB6, &&LAB6, &&LAB6, &&LAB6, &&LAB6}; LAB0: t1 = (t0 + 2956U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(95, ng0); t2 = (t0 + 1144U); t3 = *((char **)t2); t4 = *((unsigned char *)t3); t2 = (char *)((nl0) + t4); goto **((char **)t2); LAB4: xsi_set_current_line(95, ng0); LAB9: t2 = (t0 + 3304); *((int *)t2) = 1; *((char **)t1) = &&LAB10; LAB1: return; LAB5: xsi_set_current_line(96, ng0); t5 = (t0 + 1236U); t6 = *((char **)t5); t5 = (t0 + 3392); t7 = (t5 + 32U); t8 = *((char **)t7); t9 = (t8 + 40U); t10 = *((char **)t9); memcpy(t10, t6, 16U); xsi_driver_first_trans_fast(t5); goto LAB4; LAB6: xsi_set_current_line(96, ng0); t2 = xsi_get_transient_memory(16U); memset(t2, 0, 16U); t3 = t2; memset(t3, (unsigned char)4, 16U); t5 = (t0 + 3392); t6 = (t5 + 32U); t7 = *((char **)t6); t8 = (t7 + 40U); t9 = *((char **)t8); memcpy(t9, t2, 16U); xsi_driver_first_trans_fast(t5); goto LAB4; LAB7: t3 = (t0 + 3304); *((int *)t3) = 0; goto LAB2; LAB8: goto LAB7; LAB10: goto LAB8; } static void work_a_4266264580_1486280680_p_2(char *t0) { char *t1; char *t2; char *t3; unsigned char t4; char *t5; char *t6; char *t7; char *t8; char *t9; char *t10; static char *nl0[] = {&&LAB6, &&LAB6, &&LAB6, &&LAB5, &&LAB6, &&LAB6, &&LAB6, &&LAB6, &&LAB6}; LAB0: t1 = (t0 + 3100U); t2 = *((char **)t1); if (t2 == 0) goto LAB2; LAB3: goto *t2; LAB2: xsi_set_current_line(99, ng0); t2 = (t0 + 1144U); t3 = *((char **)t2); t4 = *((unsigned char *)t3); t2 = (char *)((nl0) + t4); goto **((char **)t2); LAB4: xsi_set_current_line(99, ng0); LAB9: t2 = (t0 + 3312); *((int *)t2) = 1; *((char **)t1) = &&LAB10; LAB1: return; LAB5: xsi_set_current_line(100, ng0); t5 = (t0 + 1604U); t6 = *((char **)t5); t5 = (t0 + 3428); t7 = (t5 + 32U); t8 = *((char **)t7); t9 = (t8 + 40U); t10 = *((char **)t9); memcpy(t10, t6, 16U); xsi_driver_first_trans_fast(t5); goto LAB4; LAB6: xsi_set_current_line(100, ng0); t2 = (t0 + 1512U); t3 = *((char **)t2); t2 = (t0 + 3428); t5 = (t2 + 32U); t6 = *((char **)t5); t7 = (t6 + 40U); t8 = *((char **)t7); memcpy(t8, t3, 16U); xsi_driver_first_trans_fast(t2); goto LAB4; LAB7: t3 = (t0 + 3312); *((int *)t3) = 0; goto LAB2; LAB8: goto LAB7; LAB10: goto LAB8; } extern void work_a_4266264580_1486280680_init() { static char *pe[] = {(void *)work_a_4266264580_1486280680_p_0,(void *)work_a_4266264580_1486280680_p_1,(void *)work_a_4266264580_1486280680_p_2}; xsi_register_didat("work_a_4266264580_1486280680", "isim/MCU_tb_isim_beh.exe.sim/work/a_4266264580_1486280680.didat"); xsi_register_executes(pe); }
fdd4fdc47684f6d501ad3c21167636b8932ceba9
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
/www/qt5-webengine/files/patch-src_3rdparty_chromium_third__party_libXNVCtrl_NVCtrl.c
ac5f5048d107a87d963811870fb709de6f37d907
[ "BSD-2-Clause" ]
permissive
freebsd/freebsd-ports
86f2e89d43913412c4f6b2be3e255bc0945eac12
605a2983f245ac63f5420e023e7dce56898ad801
refs/heads/main
2023-08-30T21:46:28.720924
2023-08-30T19:33:44
2023-08-30T19:33:44
1,803,961
916
918
NOASSERTION
2023-09-08T04:06:26
2011-05-26T11:15:35
null
UTF-8
C
false
false
601
c
patch-src_3rdparty_chromium_third__party_libXNVCtrl_NVCtrl.c
--- src/3rdparty/chromium/third_party/libXNVCtrl/NVCtrl.c.orig 2018-11-13 18:25:11 UTC +++ src/3rdparty/chromium/third_party/libXNVCtrl/NVCtrl.c @@ -27,10 +27,6 @@ * libXNVCtrl library properly protects the Display connection. */ -#if !defined(XTHREADS) -#define XTHREADS -#endif /* XTHREADS */ - #define NEED_EVENTS #define NEED_REPLIES #include <stdint.h> @@ -39,6 +35,11 @@ #include <X11/Xutil.h> #include <X11/extensions/Xext.h> #include <X11/extensions/extutil.h> + +#if !defined(XTHREADS) +#define XTHREADS +#endif /* XTHREADS */ + #include "NVCtrlLib.h" #include "nv_control.h"
014a7150ac825fd5d24a94d65dfa8ff77c071c50
42547f4cb0c3a60eac18474a186848f48af47509
/main.c
dad9a71eac3294a3662f49696bf30bd8b85c8662
[]
no_license
willcannings/protoio
00e7f120200444ef9e9ea1fcea97a0aec698300d
5697e44c074e1ba888d33db2f1a22f0455b8b1db
refs/heads/master
2021-01-20T01:03:44.357279
2009-03-19T03:13:27
2009-03-19T03:13:27
151,991
4
1
null
null
null
null
UTF-8
C
false
false
327
c
main.c
#include <stdio.h> #include "http.h" #include "listener.h" #include "event_queue.h" int main (int argc, const char * argv[]) { http_connection connection; int port = 80; connection.context = 0; start_listener(port); start_event_queue(); for(int i = 0; i < 1000; i++) process_http(&connection); return 0; }
c367aefb33f9041fd0151992fe78227ff1cac072
6931c4c695f2883cd455c90a920ab18b34ce2a32
/ponteiro62.c
36b6f839d016b9b1b4c26ea559ad4e5f9b5308ef
[]
no_license
DheymeGitCompetitions/Faculdade-algoritmos
2f87f1454a37ab294d82b27be5c7c73c21e8869c
52879fca9a3db6544c6be920009e5fc4772fad89
refs/heads/main
2023-05-03T08:19:53.851688
2021-05-25T22:01:16
2021-05-25T22:01:16
370,834,276
0
0
null
null
null
null
UTF-8
C
false
false
334
c
ponteiro62.c
#include <stdio.h> int main () { int x = 10; double y = 20.50; char z = 'a'; int *pX = &x; double *pY = &y; char *pZ = &z; int *valor = 10; int *ponteiro; ponteiro = 2686616; printf ("Resultado = %i \n", &x); getchar(); return 0; }
29e2d872c34a6fb475655327ff5202bf260b035e
fc214bfc7caf6050eec8ec5201e7f7eb568e3a17
/Windows/Qt/Qt5.12-msvc2019_static_64/5.12/msvc2019_static_64/include/QtFontDatabaseSupport/qtfontdatabasesupportversion.h
0c1dbf5da7ce1f493e127a28fa5aa3e6d238dd1b
[]
no_license
MediaArea/MediaArea-Utils-Binaries
44402a1dacb43e19ef6857da46a48289b106137d
5cde31480dba6092e195dfae96478c261018bf32
refs/heads/master
2023-09-01T04:54:34.216269
2023-04-11T08:44:15
2023-04-11T08:44:15
57,366,211
4
1
null
2023-04-11T08:44:16
2016-04-29T07:51:36
C++
UTF-8
C
false
false
274
h
qtfontdatabasesupportversion.h
/* This file was generated by syncqt. */ #ifndef QT_QTFONTDATABASESUPPORT_VERSION_H #define QT_QTFONTDATABASESUPPORT_VERSION_H #define QTFONTDATABASESUPPORT_VERSION_STR "5.12.12" #define QTFONTDATABASESUPPORT_VERSION 0x050C0C #endif // QT_QTFONTDATABASESUPPORT_VERSION_H
3020969dfcfb0b059ec75f330b1f43ed32a46380
0fb306192d1c715f50e7c20f55f0f0e4273ef32e
/cqsa/utilities/orion/SIM_router_power.h
f54fee0571e18f08daab5451e4b7da517f9c4f3b
[]
no_license
archfp/floorplan
e168d3c96f10d3f63e802d908aeb0ac290b02b83
b3646f1d523687f27a767b100f5ea89edef40b5b
refs/heads/master
2021-01-22T08:28:33.950842
2014-02-10T02:28:20
2014-02-10T02:28:20
8,962,309
2
0
null
null
null
null
UTF-8
C
false
false
723
h
SIM_router_power.h
#ifndef _SIM_ROUTER_POWER_H #define _SIM_ROUTER_POWER_H #include "SIM_port.h" #if (PARM(POWER_STATS)) #include <SIM_power_router.h> /* global variables */ extern GLOBDEF(SIM_power_router_t, router_power); extern GLOBDEF(SIM_power_router_info_t, router_info); /* function prototypes */ extern int FUNC(SIM_router_power_init, SIM_power_router_info_t *info, SIM_power_router_t *router); extern int FUNC(SIM_buf_power_data_read, SIM_power_array_info_t *info, SIM_power_array_t *arr, LIB_Type_max_uint data); extern int FUNC(SIM_buf_power_data_write, SIM_power_array_info_t *info, SIM_power_array_t *arr, char *data_line, char *old_data, char *new_data); #endif /* PARM(POWER_STATS) */ #endif /* _SIM_ROUTER_POWER_H */
4f586543a166f2ceed38c5fa040e284c3cfe80b2
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/message/fusion/extr_mptbase.c_mpt_read_ioc_pg_3.c
9ad14a404caf1ef92af38e943493c4886e85262b
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
3,096
c
extr_mptbase.c_mpt_read_ioc_pg_3.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_13__ TYPE_5__ ; typedef struct TYPE_12__ TYPE_4__ ; typedef struct TYPE_11__ TYPE_3__ ; typedef struct TYPE_10__ TYPE_2__ ; typedef struct TYPE_9__ TYPE_1__ ; /* Type definitions */ typedef int /*<<< orphan*/ u8 ; typedef int dma_addr_t ; struct TYPE_9__ {TYPE_4__* hdr; } ; struct TYPE_13__ {int physAddr; int /*<<< orphan*/ action; scalar_t__ timeout; scalar_t__ dir; scalar_t__ pageAddr; TYPE_1__ cfghdr; } ; struct TYPE_12__ {int PageLength; int PageNumber; int /*<<< orphan*/ PageType; scalar_t__ PageVersion; } ; struct TYPE_10__ {int /*<<< orphan*/ * pIocPg3; } ; struct TYPE_11__ {int /*<<< orphan*/ pcidev; TYPE_2__ raid_data; } ; typedef TYPE_3__ MPT_ADAPTER ; typedef int /*<<< orphan*/ IOCPage3_t ; typedef TYPE_4__ ConfigPageHeader_t ; typedef TYPE_5__ CONFIGPARMS ; /* Variables and functions */ int /*<<< orphan*/ GFP_KERNEL ; int /*<<< orphan*/ MPI_CONFIG_ACTION_PAGE_HEADER ; int /*<<< orphan*/ MPI_CONFIG_ACTION_PAGE_READ_CURRENT ; int /*<<< orphan*/ MPI_CONFIG_PAGETYPE_IOC ; int /*<<< orphan*/ kfree (int /*<<< orphan*/ *) ; int /*<<< orphan*/ * kmalloc (int,int /*<<< orphan*/ ) ; int /*<<< orphan*/ memcpy (int /*<<< orphan*/ *,int /*<<< orphan*/ *,int) ; scalar_t__ mpt_config (TYPE_3__*,TYPE_5__*) ; int /*<<< orphan*/ * pci_alloc_consistent (int /*<<< orphan*/ ,int,int*) ; int /*<<< orphan*/ pci_free_consistent (int /*<<< orphan*/ ,int,int /*<<< orphan*/ *,int) ; __attribute__((used)) static int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) { IOCPage3_t *pIoc3; u8 *mem; CONFIGPARMS cfg; ConfigPageHeader_t header; dma_addr_t ioc3_dma; int iocpage3sz = 0; /* Free the old page */ kfree(ioc->raid_data.pIocPg3); ioc->raid_data.pIocPg3 = NULL; /* There is at least one physical disk. * Read and save IOC Page 3 */ header.PageVersion = 0; header.PageLength = 0; header.PageNumber = 3; header.PageType = MPI_CONFIG_PAGETYPE_IOC; cfg.cfghdr.hdr = &header; cfg.physAddr = -1; cfg.pageAddr = 0; cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; cfg.dir = 0; cfg.timeout = 0; if (mpt_config(ioc, &cfg) != 0) return 0; if (header.PageLength == 0) return 0; /* Read Header good, alloc memory */ iocpage3sz = header.PageLength * 4; pIoc3 = pci_alloc_consistent(ioc->pcidev, iocpage3sz, &ioc3_dma); if (!pIoc3) return 0; /* Read the Page and save the data * into malloc'd memory. */ cfg.physAddr = ioc3_dma; cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; if (mpt_config(ioc, &cfg) == 0) { mem = kmalloc(iocpage3sz, GFP_KERNEL); if (mem) { memcpy(mem, (u8 *)pIoc3, iocpage3sz); ioc->raid_data.pIocPg3 = (IOCPage3_t *) mem; } } pci_free_consistent(ioc->pcidev, iocpage3sz, pIoc3, ioc3_dma); return 0; }
2ebc6cce2dd29a3b4aeaf4af50f5ebf03c96ec25
cdbdb0d6974ac8b601922e1e8d17506b232b9d4b
/5_Multiporgramacion_2daU1/multiporgramacion_2da.c
28d92dac28cbc350d7241afeb1968a00a612d762
[]
no_license
Sahad16/SAHAD_JOSHELINE_MENDOZA_TAFOLLA_IC_0602_TALLER_SO
1d336ed6c7a92b1e1ad7f37e03788b9dd7834081
59d1d9afc35815551bb262d470b574877e8c747a
refs/heads/main
2023-06-05T06:55:01.754366
2021-06-29T22:45:04
2021-06-29T22:45:04
344,251,180
2
0
null
null
null
null
UTF-8
C
false
false
710
c
multiporgramacion_2da.c
//Programa multiprogramacion en c 2da oportunidad #include <stdio.h> #include <stdlib.h> #include <time.h> void tarea1(){ printf("Tarea 1\n"); } void tarea2(){ printf("Tarea 2\n"); } void tarea3(){ printf("Tarea 3\n"); } void main () { time_t t1; double tiempo_inicial = time(&t1); printf("Presiona Enter para iniciar\n"); printf("Presiona Ctrl+C para finalizar el bucle\n"); getchar(); while(1){ time_t t2; double tiempo_final = time(&t1); int tiempo_transcurrido = tiempo_final - tiempo_inicial; if ((tiempo_transcurrido % 2)==0) tarea1(); if ((tiempo_transcurrido % 3)==0) tarea2(); if ((tiempo_transcurrido % 4)==0) tarea3(); } }
0a360ec6b9657d8adf2a1739c834d6f83f25fb97
9073f87d41fa9e89ed20dcba082245c35ab8ec79
/src/ft_total_test.c
30a6d768c9a561d1ce8da8a3ed229c57db3192ae
[]
no_license
msicot/ft_ls
e03446fd60690c0f5836228f08ece75be6add80d
46a811dac65141d6248331507281e6e2576daf70
refs/heads/master
2021-04-30T04:42:25.634634
2018-08-29T09:28:10
2018-08-29T09:28:10
121,542,991
0
0
null
null
null
null
UTF-8
C
false
false
1,053
c
ft_total_test.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_total_test.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: msicot <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/03/08 14:40:53 by msicot #+# #+# */ /* Updated: 2018/03/08 14:45:45 by msicot ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_ls.h" int ft_total(t_name *tmp) { while (tmp != NULL) { if (tmp->d_name[0] == '.') tmp = tmp->next; else return (0); } return (1); }
00711725c0dcb52b7dc057188240132ed5930d14
4e5d752b5cb443c5bff0ec66f8c17538828c60d1
/f&d/Fillet.c
17a43272bde6e4e52dcfa7362c5815ae9ed21ec8
[]
no_license
JensenDied/Sinbyen
7c0cb2387b707661ffa91cdb9881281f5862e0db
a061fa1923b7bd50b3becb2c397f77c22fc2e51b
refs/heads/master
2021-01-18T03:15:08.349442
2014-04-19T05:41:45
2014-04-19T05:41:45
18,931,868
0
1
null
null
null
null
UTF-8
C
false
false
806
c
Fillet.c
#include <Sinbyen.h> #include <item.h> inherit "/std/comestible"; void configure() { ::configure(); set_creator(({ "kenobi" })); set_comestible_type("food"); set_pleasure(0.30); set_food(24); set_portable(True); set_consume_message("The fresh fish is soft and tasty."); add_proportion(([ Element_Type : Material_Flesh, Element_Proportion : 1.0, Element_Flags : Element_Flag_Provide_Default_Color | Element_Flag_Suppress_Material_Adjectives, ])); add_proportion(([ Element_Type : Material_Vinegar, Element_Proportion : 0.01, Element_Part : Part_Coat, Element_Flags : Element_Flag_Secondary, ])); }
3302a6442e9ede33e401aee9d2157577d0730054
cc74a392ef3292a226d75afd69e4efb0a8cbf57a
/RCT2/rct2_chunk.h
cf5586c689bb9522b3dce338ac5653b80fdc530c
[]
no_license
janisozaur/rct2lib
55304b845a66402fdba4c9b3f119dbabeadb59ca
d4ae9d95e0515d2e93cdce11bddbe56cb48fbede
refs/heads/master
2021-01-15T10:42:04.757288
2017-08-07T15:40:36
2017-08-07T15:50:59
99,593,854
0
0
null
null
null
null
UTF-8
C
false
false
277
h
rct2_chunk.h
#ifndef RCT2_CHUNK__H #define RCT2_CHUNK__H #if 0 typedef enum { ET_LITERAL, ET_RLE, ET_RLE_STRING, ET_ROTATE_1357, ET_AUTODETECT=0xff, } SV6_ENCODETYPE; #endif typedef struct { BYTE encodeType; DWORD chunkSize_Encoded; } SV6_CHUNKHEADER; #endif RCT2_CHUNK__H
f5f39c708ba948cf940d95722ee909bea3fc8696
26a141ac81324c544793cd417c23e510f5bb4b77
/src/BB.h
f3ba1d279490860f411be415bffe7d27d149d1de
[]
no_license
christianfriedl/BabelBarbe
26c75977a9eba1da9eede89e87f4c8bd1f854e03
f5a3d7c20e06e22bb178ce997fe8c5150cec1d5b
refs/heads/master
2021-01-19T10:38:45.162979
2012-07-20T14:36:03
2012-07-20T14:36:03
null
0
0
null
null
null
null
UTF-8
C
false
false
201
h
BB.h
#ifndef _BB_H #define _BB_H #define bool int #define true (-1) #define false (0) #define bool__to_string(a) (((a) == true) ? "true" : "false") #define BB_INDENTATION_SIZE (2) #undef DEBUG #endif
40381efbb624188ca7cff411f63b639bf4222c5c
8f2b2bc234849a20d4ec2dd7c1e12956bb8199e3
/include/push_swap.h
c9fb07d9c057b5dfa366f62cf9b824e59f9a0e7d
[]
no_license
f-huang/push_swap
255042f1b33fd6232f8812a43ae54cbdf8c231e7
c502643db63c160aff2450fd220462c47cd5b047
refs/heads/master
2021-05-07T08:46:45.720537
2017-11-03T15:30:18
2017-11-03T15:30:18
109,411,814
0
0
null
null
null
null
UTF-8
C
false
false
1,435
h
push_swap.h
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* push_swap.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: fhuang <fhuang@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 15:25:31 by fhuang #+# #+# */ /* Updated: 2017/09/29 17:36:08 by fhuang ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PUSH_SWAP_H # define PUSH_SWAP_H # include <inttypes.h> # include <stddef.h> int get_biggest_number_in_pile(t_pile pile); int get_tab_median(int *tab, uint16_t len); int is_a_correctly_sorted(t_game *game); void is_middle_of_a_is_sorted(t_game *game, int nb_rotate); int is_there_numbers_greater_than_median(t_pile pile, int median); void print_piles(t_game game); void resolve_game(t_game *game, uint16_t len, int from_sort_b); void sort_a_if_three_items(t_game *game); void swap_if_needed(t_game *game, int nb_rotate); #endif
5770c290afdefd7be1607f8ee2ef084cc4018f9d
e86fc96ecdff6d8ae5884ab75bc5bbf82e0c5961
/NUC97x/Driver/NUC97x_NAND.c
393298bae269daf1f8eff1c660edcef990d064c5
[]
no_license
gdgly/NUC97X_JS
80dcf3e749d836ed12ea5bdffba289b0db0ae3f6
b8a5193b1d447f25864483a55bad4befe441b956
refs/heads/master
2022-12-05T11:14:52.268951
2020-08-18T11:26:04
2020-08-18T11:26:04
null
0
0
null
null
null
null
GB18030
C
false
false
62,641
c
NUC97x_NAND.c
#if MainProtocol==376 #include "../../STM32F4xx/Head/Project.h" #endif #if MainProtocol==698 #include "../../STM32F4xx/H698/Project698.h" #endif #if MainProtocol==CSG #include "../../STM32F4xx/Hcsg/ProjectCSG.h" #endif #include "../../STM32F4xx/Device/NAND.h" #include "../../STM32F4xx/STM32F4xx/STM32F4xx_SoftDelay.h" #include "../../STM32F4xx/STM32F4xx/STM32F4xx_CRC.h" #include "../../STM32F4xx/Device/MEMRW.h" #include "../NUC97x/NUC97x_AIC.h" #include "../../STM32F4xx/STM32F4xx/STM32F4xx_WDG.h" #include "../MS/yaffsAPP.h" #define BlockMax_NandBuff 128//nand็ผ“ๅ†ฒๆœ€ๅคง็ผ“ๅ†ฒๆ•ฐๆฎๅ—ๆ•ฐ void Init_NAND(void)//ๅคไฝnand { u32 i; u32 CS0_disable; u32 CS1_disable; u32 *p32; u32 irq; //่จญ็ฝฎCLK_HCLKENๅฏ„ๅญ˜ๅ™จFMI๏ผŒNANDไฝ p32=(u32*)(REG_CLK_HCLKEN); i=p32[0]; i|=3<<20; p32[0]=i; //AHB IP Reset p32=(u32*)(REG_SYS_AHBIPRST); p32[0]=1<<20;//FMI controller reset enabled. p32[0]=0; //้ธๆ“‡ๅคšๅŠŸ่ƒฝๆŽงๅˆถ๏ผŒNANDๆœ‰ไบŒ็ต„๏ผšGPC0~14ๅ’ŒGPI1~15 if (inpw(REG_SYS_PWRON) & 0x08000000) {//NUC975 or NUC978 //Set GPI1~15 for NAND CS0_disable=0; CS1_disable=1; p32=(u32*)(REG_SYS_GPI_MFPL); irq=off_irq(); i=p32[0]; i&=0x0000000f; i|=0x55555550;//Ctrl p32[0]=i; destore_irq(irq); p32=(u32*)(REG_SYS_GPI_MFPH); p32[0]=0x55555555;//D0-D7 } else {//NUC972 //Set GPC0~14 for NAND CS0_disable=0; CS1_disable=1; p32=(u32*)(REG_SYS_GPC_MFPL); p32[0]=0x55555555;//D0-D7 p32=(u32*)(REG_SYS_GPC_MFPH); p32[0]=0x05555555;//Ctrl } //Timing Control(Reset Value 0x0001_0105,NOTE1: The reset value calculated based on 100MHz AHB Clock) p32=(u32*)(REG_NANDTMCTL); p32[0]= //[31:23] Reserved Reserved. //[22:16] CALE_SH //CLE/ALE Setup/Hold Time //This field controls the CLE/ALE setup/hold time to โ€“WE. //The setup/hold time can be calculated using following equation: //tCLS = (CALE_SH+1)*TAHB. //tCLH = ((CALE_SH*2)+2)*TAHB. //tALS = (CALE_SH+1)*TAHB. //tALH = ((CALE_SH*2)+2)*TAHB. (2<<16)| //[15:8] HI_WID //Read/Write Enable Signal High Pulse Width //This field controls the high pulse width of signals โ€“RE and โ€“WE while H/W mode page access //is enabled. The pulse width is a multiple of period of AHB bus clock. ( The actual width time //will be [clock period*(HI_WID+1)] ) (3<<8)| //[7:0] LO_WID //Read/Write Enable Signal Low Pulse Width //This field controls the low pulse width of signals โ€“RE and โ€“WE while H/W mode page access //is enabled. The pulse width is a multiple of period of AHB bus clock. ( The actual width time //will be [clock period*(LO_WID+1)] ) 5; //ไฝฟ่ƒฝFMI(Reset Value 0x0000_0000) p32=(u32*)(REG_FMI_CTL); p32[0]= //[31:4]Reserved //[3]NAND_EN //NAND Flash Functionality Enable //0 = Disable NAND flash functionality of FMI. //1 = Enable NAND flash functionality of FMI. (1<<3)| //[2]Reserved //[1]eMMC_EN //eMMC Functionality Enable //0 = Disable eMMC functionality of FMI. //1 = Enable eMMC functionality of FMI. //[0]SW_RST //Software Engine Reset //0 = Writing 0 to this bit has no effect. //1 = Writing 1 to this bit will reset all FMI engines. The contents of control register will not be cleared. This bit will auto clear after few clock cycles. 1; while(p32[0]&1); //Redundant Area Control(Reset Value 0x0000_0000) p32=(u32*)(REG_NANDRACTL); p32[0]= //31:16]MECC //Mask ECC During Write Page Data //These 16 bits registers indicate NAND controller to write out ECC parity or just 0xFF for each field (every 512 bytes) the real parity data will be write out to FMI_NANDRAx. //0x00 = Do not mask the ECC parity for each field. //0x01 = Mask ECC parity and write out FF to NAND ECC parity for 512 Bytes page size or 2K/4K/8K page size first 512 field. //0x02 = Mask ECC parity and write out FF to NAND ECC parity for 512 Bytes page size or 2K/4K/8K page size second 512 field. //0xxx = Mask ECC parity and write out FF to NAND ECC parity for 512 Bytes page size or 2K/4K/8K page size each 512 field. //[15:9]Reserved //[8:0]RA128EN //Redundant Area 128 Byte Enable //These bits indicate NAND flash extended redundant area. //If PSIZE (FMI_NANDCTL[17:16]) = 2โ€™b00, this field will be set 0x10 (16bytes) automatically. //If PSIZE (FMI_NANDCTL[17:16]) = 2โ€™b01, this field will be set 0x40 (64bytes) automatically. //If PSIZE (FMI_NANDCTL[17:16]) = 2โ€™b10, this field will be set 0x80 (128 bytes) automatically. //If PSIZE (FMI_NANDCTL[17:16]) = 2โ€™b11, this field will be set 0x100 (256bytes) automatically. //Note: The REA128EN must be 4 byte aligned, so bit1 and bit0 canโ€™t be filled 1 to it. //The maximum redundant area of the controller is 472Bytes. 0x40; //DMA Control(Reset Value 0x0000_0000) p32=(u32*)(REG_FMI_DMACTL); //while(p32[0]&0x200);//FMI_BUSY p32[0]= //[31:10]Reserved. //[9]FMI_BUSY //FMI DMA Transfer is in progress //This bit indicates if FMI is granted and doing DMA transfer or not. //0 = FMI DMA transfer is not in progress. //1 = FMI DMA transfer is in progress. //[8:4]//Reserved. //[3]//SG_EN //Enable Scatter-Gather Function for FMI //Enable DMA scatter-gather function or not. //0 = Normal operation. DMAC will treat the starting address in FMI_DMASA as starting pointer of a single block memory. //1 = Enable scatter-gather operation. DMAC will treat the starting address in FMI_DMASA as a starting address of Physical Address Descriptor (PAD) table. The format of these Padsโ€™ will be described later. //[2]//Reserved. //[1]//SW_RST //Software Engine Reset //0 = Writing 0 to this bit has no effect. //1 = Writing 1 to this bit will reset the internal state machine and pointers. The contents of control register will not be cleared. This bit will auto clear after few clock cycles. //NOTE: The software reset DMA region. (1<<1)| //[0]//DMACEN //DMAC Engine Enable //Setting this bit to 1 enables DMACโ€™s operation. If this bit is cleared, DMAC will ignore all DMA request from FMI and force Bus Master into IDLE state. //0 = Disable DMAC. //1 = Enable DMAC. //NOTE: If target abort is occurred, DMACEN will be cleared. 1; while(p32[0]&(1<<1)); //DMA Interrupt Enable(Reset Value 0x0000_0000) p32=(u32*)(REG_FMI_DMAINTEN); p32[0]=0; //NAND Flash Control(Reset Value 0x1E88_0090) p32=(u32*)(REG_NANDCTL); p32[0]= //[31:27]Reserved 0x1E88_0090) //[26]CS1 //NAND Flash Chip Select 1 Enable //0 = Chip select 1 enable. //1 = Chip select 1 disable. (CS1_disable<<26)| //[25]CS0 //NAND Flash Chip Select 0 Enable //0 = Chip select 0 enable. //1 = Chip select 0 disable. (CS0_disable<<25)| //[24]Reserved //[23]ECC_EN //ECC Algorithm Enable //This field is used to select the ECC algorithm for data protecting. The BCH algorithm can correct 4 or 8 or 12 or 15 or 24 bits. //0 = Disable BCH code encode/decode. //1 = Enable BCH code encode/decode. //Note: If disable ECC_EN and when read data from NAND, NAND controller will ignore its ECC check result. When write data to NAND, NAND controller will write out 0xFF to every parity field. //Note: The ECC algorithm only protects data area and hardware ECC parity code in default. By setting PROT_3BEN (FMI_NANDCTL[8]) high, the first 3 bytes of redundant data are also protected by ECC algorithm. (1<<23)| //[22:18]BCH_TSEL //BCH Correct Bit Selection //This field is used to select BCH correct bits for data protecting. For BCH algorithm, T can be 4 or 8 or 12 or 15 or 24 for choosing (correct 4 or 8 or 12 or 15 or 24 bits). //00001 = Using BCH T24 to encode/decode (T24).(1024 Bytes per block) //00010 = Using BCH T4 to encode/decode (T4). //00100 = Using BCH T8 to encode/decode (T8). //01000 = Using BCH T12 to encode/decode (T12). //10000 = Using BCH T15 to encode/decode (T15). #ifndef LINUX (4<<18)| #else (2<<18)| #endif //[17:16]PSIZE //Page Size of NAND //This bit indicates the page size of NAND. There are four page sizes for choose, 512bytes/page, 2048bytes/page, 4096bytes/page and 8192bytes/page. Before setting PSIZE register, user must set BCH_TSEL register at first. //00 = Page size is 512bytes/page. //01 = Page size is 2048bytes/page. //10 = Page size is 4096bytes/page. //11 = Page size is 8192bytes/page. (1<<16)| //[15:10]Reserved. //[9]SRAM_INT //SRAM Initial //0 = Writing 0 to this bit has no effect. //1 = Writing 1 to this bit will reset the internal FMI_NANDRA0~FMI_NANDRA1 to 0xFFFF_FFFF. //The contents of control register will not be cleared. This bit will be auto cleared after few clock cycles. //[8]PROT_3BEN //Protect_3Byte Software Data Enable //The ECC algorithm only protects data area and hardware ECC parity code. User can choose to protect software redundant data first 3 bytes by setting this bit high. //0 = Software redundant data is not protected by ECC algorithm. //1 = Software redundant data first 3 bytes protected by ECC algorithm. (0<<8)| //[7]ECC_CHK //None Used Field ECC Check After Read Page Data //0 = Disable. NAND controller will always check ECC result for each field, no matter it is used or not. //1 = Enable. NAND controller will check 1โ€™s count for byte 2, 3 of redundant data of the ECC in each field. If count value is greater than 8, NAND controller will treat this field as none used field; otherwise, itโ€™s used. If that field is none used field, NAND controller will ignore its ECC check result. (0<<7)| //[6]Reserved //[5]PROT_REGION_EN //Protect Region Enable //This field is used to protect NAND Flash region from address 0 to address {FMI_NANDPRTOA1, FMI_NANDPROTA0} not be written. //0 = Disable. //1 = Enable. //[4]REDUN_AUTO_WEN //Redundant Area Auto Write Enable //This field is used to auto write redundant data out to NAND Flash. The redundant data area is dependent on FMI_NANDRACTL register. //0 = Disable auto write redundant data out to NAND flash. //1 = Enable auto write redundant data out to NAND flash. (1<<4)| //[3]REDUN_REN //Redundant Area Read Enable //This bit enables NAND controller to transfer redundant data from NAND Flash into FMI_NANDRA, the data size is dependent on FMI_NANDRACTL register. //0 = No effect. //1 = Enable read redundant data transfer. //NOTE: When transfer completed, this bit will be cleared automatically. //[2]DWR_EN //DMA Write Data Enable //This bit enables NAND controller to transfer data (1 page) from DMACโ€™s embedded frame buffer into NAND Flash or NAND type flash. //0 = No effect. //1 = Enable DMA write data transfer. //NOTE: When DMA transfer completed, this bit will be cleared automatically. //[1]DRD_EN //DMA Read Data Enable //This bit enables NAND controller to transfer data (1 page) from NAND Flash or NAND type flash into DMACโ€™s embedded frame buffer. //0 = No effect. //1 = Enable DMA read data transfer. //NOTE: When DMA transfer completed, this bit will be cleared automatically. //[0]SW_RST //Software Engine Reset //0 = Writing 0 to this bit has no effect. //1 = Writing 1 to this bit will reset the internal state machine and counters (include DWR_EN (FMI_NANDCTL[2]) and DRD_EN (FMI_NANDCTL[1])). The contents of control register will not be cleared. This bit will be auto cleared after few clock cycles. 1; while(p32[0]&1); //Extend Control(Reset Value 0x0000_0000) p32=(u32*)(REG_NANDECTL); p32[0]= //[31:1]Reserved. //[0]WP //NAND Flash Write Protect Control (Low Active) //Set this bit low to make NAND_nWP functional pin low to prevent the write to NAND flash device. //0 = NAND flash is write-protected and is not writeable. //1 = NAND flash is not write-protected and is writeable. 1; //Interrupt Enable(Reset Value 0x0000_0000) p32=(u32*)(REG_NANDINTEN); p32[0]=0; } u32 Wait_NAND(u32 usMax)//่ฏปNAND็Šถๆ€ๅฏ„ๅญ˜ๅ™จ็ญ‰ๅพ…ๅฝ“ๅ‰ๅ‘ฝไปคๅฎŒๆˆ,่ฟ”ๅ›ž:0=ๆญฃ็กฎ,!=0่ฏปๅ–็š„็Šถๆ€ๅญ— { u32 i; u32 t; u32 *p32CMD; u32 *p32DATA; p32CMD=(u32*)(REG_NANDCMD); p32DATA=(u32*)(REG_NANDDATA); while(1)//ๅธธ่ง„ๆต‹่ฏ•ๆ—ถๅ€ผi=9;ๅฝ“ๅ‰ๆœ€ๅคงๅ€ผ100 { //Status Register Definition //SR Program Program Page Page Read Page Read Block Erase Description //Bit Page Cache Mode Cache Mode //7 Write protect Write protect Write protect Write protect Write protect 0 = Protected,1 = Not protected //6 RDY RDY cache RDY RDY cache RDY 0 = Busy,1 = Ready //5 ARDY ARDY ARDY ARDY ARDY Don't Care //4 โ€“ โ€“ โ€“ โ€“ โ€“ Don't Care //3 โ€“ โ€“ Rewrite โ€“ โ€“ 0 = Normal or uncorrectable,1 = Rewrite recommended // recommended //2 โ€“ โ€“ โ€“ โ€“ โ€“ Don't Care //1 FAILC(N-1) FAILC(N-1) Reserved โ€“ โ€“ Don't Care //0 FAIL FAIL (N) FAIL โ€“ FAIL 0 = Successful PROGRAM/ERASE/READ,1 = Error in PROGRAM/ERASE/READ *p32CMD=0x70; i=*p32DATA; if((i&0x40)==0x40) { *p32CMD=0x00;//1st Cycle Page Read Command t=4;//่‡ณๅฐ‘ๅปถๆ—ถtWHR=60ns while(t--); return 0; } SoftDelayUS(1);//่ฝฏไปถusๅปถๆ—ถ if(usMax==0) { break; } usMax--; } *p32CMD=0x00;//1st Cycle Page Read Command t=4;//่‡ณๅฐ‘ๅปถๆ—ถtWHR=60ns while(t--); return i; } u64 ID_NAND(void)//่ฏปๅ™จไปถID,ๅŒๆ—ถnandๆ•ฐๆฎไฝๅฎฝๅบฆ่‡ชๅŠจ่ฏ†ๅˆซ { u64 id; u32 *p32CMD; u32 *p32ADDR; u32 *p32DATA; Init_NAND();//ๅคไฝnand p32CMD=(u32*)(REG_NANDCMD); p32ADDR=(u32*)(REG_NANDADDR); p32DATA=(u32*)(REG_NANDDATA); *p32CMD=0x90; *p32ADDR=0x0|0x80000000; id=*p32DATA;//1st id<<=8; id|=*p32DATA;//2nd id<<=8; id|=*p32DATA;//3rd id<<=8; id|=*p32DATA;//4th id<<=8; id|=*p32DATA;//5th *p32CMD=0;//Page Read Command FileDownload->NAND_BUSBIT=8;//nandๆ•ฐๆฎไฝๅฎฝๅบฆ่‡ชๅŠจ่ฏ†ๅˆซ:8=8bit,16=16bit return id; } void Enable_Internal_ECC(void)//ๅ…่ฎธnandๅ†…้ƒจECC { } void Disable_Internal_ECC(void)//ๅ–ๆถˆnandๅ†…้ƒจECC { } void BlockErase_NAND(u32 ADDR_Dest,u32 Busy_Wait)//NAND_FLASH ๆ“ฆ้™คๅฝ“ๅ‰1ไธชๅ—;ๆฒกๅ—ๆ›ฟๆข;ๅ…ฅๅฃ:Busy_Wait=1 NANDๅฟ™ๆ—ถ็ญ‰ๅพ…Busy_Wait=0ไธ็ญ‰ๅพ… { u32 ReNum; u32 Err; u32 *p32CMD; u32 *p32ADDR; // u32 *p32DATA; Init_NAND();//ๅคไฝnand p32CMD=(u32*)(REG_NANDCMD); p32ADDR=(u32*)(REG_NANDADDR); // p32DATA=(u32*)(REG_NANDDATA); ReNum=2; while(ReNum--) { *p32CMD=0x60; *p32ADDR=(ADDR_Dest>>11);//Row Add. 1 #if (NAND_2G|NAND_4G|NAND_8G) *p32ADDR=(ADDR_Dest>>19);//Row Add. 2 *p32ADDR=(ADDR_Dest>>27)|0x80000000;//Row Add. 3 #else *p32ADDR=(ADDR_Dest>>19)|0x80000000;//Row Add. 2 #endif *p32CMD=0xD0;//Command Err=Wait_NAND(3000*3);//่ฏปNAND็Šถๆ€ๅฏ„ๅญ˜ๅ™จ็ญ‰ๅพ…ๅฝ“ๅ‰ๅ‘ฝไปคๅฎŒๆˆ,่ฟ”ๅ›ž:0=ๆญฃ็กฎ,!=0่ฏปๅ–็š„็Šถๆ€ๅญ— if(Err==0) { break; } } } u32 Read_Page(u32 ADDR_Dest,u32 ADDR_Sour)//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป้กตๆ•ฐๆฎ;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ { u32 i; u32 x; u32 n; u32 m; u32 *p32NANDCTL; u32 *p32DMA; u32 *p32CMD; u32 *p32ADDR; u32 ErrStatus; u32 ErrBitNUM; u32* p32ErrAddr; u32* p32ErrData; u32 ErrData; u32 ErrRead; u8* p8SOUR; u32* p32s; u32* p32d; // u32 *p32DATA; p32CMD=(u32*)(REG_NANDCMD); p32ADDR=(u32*)(REG_NANDADDR); // p32DATA=(u32*)(REG_NANDDATA); ErrRead=0; //ๅ…ˆ่ฏป้กตๆ ก้ชŒๅŒบ(64byte) i=ADDR_Sour; *p32CMD=0x00;//1st Cycle Page Read Command *p32ADDR=0;//i;//Col.Add.1 *p32ADDR=0x08;//(i>>8)&0x07;//Col.Add.2 *p32ADDR=(i>>11);//Row Add. 1 #if (NAND_2G|NAND_4G|NAND_8G) *p32ADDR=(i>>19);//Row Add. 2 *p32ADDR=(i>>27)|0x80000000;//Row Add. 3 #else *p32ADDR=(i>>19)|0x80000000;//Row Add. 2 #endif *p32CMD=0x30;//2nd Cycle Cycle Page Read Command Wait_NAND(70*3);//่ฏปNAND็Šถๆ€ๅฏ„ๅญ˜ๅ™จ็ญ‰ๅพ…ๅฝ“ๅ‰ๅ‘ฝไปคๅฎŒๆˆ,่ฟ”ๅ›ž:0=ๆญฃ็กฎ,!=0่ฏปๅ–็š„็Šถๆ€ๅญ— p32NANDCTL=(u32*)(REG_NANDCTL); i=p32NANDCTL[0]; i|= (0<<4)|//[4]REDUN_AUTO_WEN Redundant Area Auto Write Enable (1<<3)|//[3]REDUN_REN NOTE: When transfer completed, this bit will be cleared automatically. (0<<2)|//[2]DWR_EN DMA Write Data Enable (0<<1);//[1]DRD_EN DMA Read Data Enable p32NANDCTL[0]=i; while(p32NANDCTL[0]&(1<<3)); //่ฏป้กตๆ•ฐๆฎ i=ADDR_Sour; *p32CMD=0x00;//1st Cycle Page Read Command *p32ADDR=0;//i;//Col.Add.1 *p32ADDR=0;//(i>>8)&0x07;//Col.Add.2 *p32ADDR=(i>>11);//Row Add. 1 #if (NAND_2G|NAND_4G|NAND_8G) *p32ADDR=(i>>19);//Row Add. 2 *p32ADDR=(i>>27)|0x80000000;//Row Add. 3 #else *p32ADDR=(i>>19)|0x80000000;//Row Add. 2 #endif *p32CMD=0x30;//2nd Cycle Cycle Page Read Command Wait_NAND(70*3);//่ฏปNAND็Šถๆ€ๅฏ„ๅญ˜ๅ™จ็ญ‰ๅพ…ๅฝ“ๅ‰ๅ‘ฝไปคๅฎŒๆˆ,่ฟ”ๅ›ž:0=ๆญฃ็กฎ,!=0่ฏปๅ–็š„็Šถๆ€ๅญ— //while(!p32s[0]&0x400); p32s=(u32*)(REG_NANDINTSTS); p32s[0]|=0x405;//ๆธ…[10]RB0_IF,[2]ECC_FLD_IF,[0]DMA_IFไฝ p32DMA=(u32*)(REG_FMI_DMASA); p32DMA[0]=ADDR_Dest; p32NANDCTL=(u32*)(REG_NANDCTL); i=p32NANDCTL[0]; i|= (0<<4)|//[4]REDUN_AUTO_WEN Redundant Area Auto Write Enable (0<<3)|//[3]REDUN_REN NOTE: When transfer completed, this bit will be cleared automatically. (0<<2)|//[2]DWR_EN DMA Write Data Enable (1<<1);//[1]DRD_EN DMA Read Data Enable p32NANDCTL[0]=i; while(1) { p32s=(u32*)(REG_NANDINTSTS); x=p32s[0]; if(x&4) {//[2]ECC_FLD_IF,้œ€ๆธ…0ๅฆๅˆ™DMAไผšๅœๆญขไธๅ†ไผ ่พ“ sysFlushCache(D_CACHE);//I_CACHE,D_CACHE,I_D_CACHE p32d=(u32*)(REG_NANDECCES0); for(n=0;n<4;n++) { ErrStatus=p32d[n]; for(m=0;m<4;m++) { if(ErrStatus&3) { if((ErrStatus&3)!=0x1) {//ไธ่ƒฝไฟฎๆญฃ ErrRead=1; break; } else {//่ƒฝไฟฎๆญฃ ErrBitNUM=(ErrStatus>>2)&0x1f;//้”™่ฏฏไฝๆ•ฐ p32ErrAddr=(u32*)(REG_NANDECCEA0);//0-11 p32ErrData=(u32*)(REG_NANDECCED0);//0-5 while(ErrBitNUM) { if(ErrBitNUM) { ErrBitNUM--; p8SOUR=(u8*)(ADDR_Dest+(((n*4)+m)*512)+(p32ErrAddr[0]&0x3ff)); ErrData=p32ErrData[0]&0xff; p8SOUR[0]^=ErrData; } if(ErrBitNUM) { ErrBitNUM--; p8SOUR=(u8*)(ADDR_Dest+(((n*4)+m)*512)+((p32ErrAddr[0]>>16)&0x3ff)); ErrData=(p32ErrData[0]>>8)&0xff; p8SOUR[0]^=ErrData; p32ErrAddr++; } if(ErrBitNUM) { ErrBitNUM--; p8SOUR=(u8*)(ADDR_Dest+(((n*4)+m)*512)+(p32ErrAddr[0]&0x3ff)); ErrData=(p32ErrData[0]>>16)&0xff; p8SOUR[0]^=ErrData; } if(ErrBitNUM) { ErrBitNUM--; p8SOUR=(u8*)(ADDR_Dest+(((n*4)+m)*512)+((p32ErrAddr[0]>>16)&0x3ff)); ErrData=(p32ErrData[0]>>24)&0xff; p8SOUR[0]^=ErrData; p32ErrAddr++; p32ErrData++; } } } } ErrStatus>>=8; } } p32s=(u32*)(REG_NANDINTSTS); p32s[0]=4;//ๆธ…ECC_FLD_IF } if(x&1) {//[0]DMA_IFไฝ break; } } sysFlushCache(D_CACHE);//I_CACHE,D_CACHE,I_D_CACHE return ErrRead; } u32 Read_NAND(u32 ADDR_Dest,u32 ADDR_Sour,u32 Byte)//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ { u32 i; u32 x; u32 PageByte; u8* p8SOUR; u8* p8DEST; u16* p16SOUR; u16* p16DEST; u32 ErrRead; Init_NAND(); ErrRead=0; p8DEST=(u8*)ADDR_Dest; while(Byte!=0) { while(1)//ๆމ็”ตไธญๆ–ญๅ†ฒ็ช้‡่ฏป { PageByte=2048-(ADDR_Sour&0x7FF);//ๅฝ“ๅ‰Page่ƒฝ่ฏปๅญ—่Š‚ if(PageByte>Byte) { PageByte=Byte; } if(((ADDR_Sour&0x7FF)==0)&&(Byte>=2048)) {//้œ€่ฏป็š„nand้กตๅฏน้ฝ,ๅŒๆ—ถ้œ€ๅ–ๆ•ฐ>=้กตๅญ—่Š‚2048 ErrRead|=Read_Page((u32)p8DEST,ADDR_Sour);//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป้กตๆ•ฐๆฎ;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ p8DEST+=PageByte; } else { ErrRead|=Read_Page(ADDR_NAND_PAGEREAD_BUFF,ADDR_Sour);//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป้กตๆ•ฐๆฎ;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ //ๅ–ๆ•ฐๆฎ p8SOUR=(u8*)ADDR_NAND_PAGEREAD_BUFF+(ADDR_Sour&0x7ff); i=PageByte; if((((u32)p8SOUR&1)==0)&&(((u32)p8DEST&1)==0)) {//ๅŒๆ—ถไธบๅถ p16SOUR=(u16*)p8SOUR; p16DEST=(u16*)p8DEST; while(i>=2) { *p16DEST=*p16SOUR; p16SOUR++; p16DEST++; i-=2; } p8SOUR=(u8*)p16SOUR; p8DEST=(u8*)p16DEST; if(i) { *p8DEST=*p8SOUR; } } else { if(((u32)p8SOUR&1)&&((u32)p8DEST&1)) {//ๅŒๆ—ถไธบๅฅ‡ if(i) { *p8DEST=*p8SOUR; p8SOUR++; p8DEST++; i--; } p16SOUR=(u16*)p8SOUR; p16DEST=(u16*)p8DEST; while(i>=2) { *p16DEST=*p16SOUR; p16SOUR++; p16DEST++; i-=2; } p8SOUR=(u8*)p16SOUR; p8DEST=(u8*)p16DEST; if(i) { *p8DEST=*p8SOUR; } } else { for(i=0;i<PageByte;i++) { x=p8SOUR[i]; *p8DEST=x; p8DEST++; } } } } p8DEST-=PageByte; if(Comm_Ram->IntFlags&0x08)//ไธญๆ–ญๆœๅŠกไธญไฝฟ็”จๅ†ฒ็ชๆ ‡ๅฟ— { Comm_Ram->IntFlags=0;//ไธญๆ–ญๆœๅŠกไธญไฝฟ็”จๅ†ฒ็ชๆ ‡ๅฟ— continue; } break; } ADDR_Sour+=PageByte; p8DEST+=PageByte; Byte-=PageByte; } return ErrRead;//่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ } u32 BLOCK_Write_NAND(u32 ADDR_Dest)//ๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ;่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ;ๆฒกๅ—ๆ›ฟๆข { u32 i; u32 x; u32 y; u32 *p32s; u32 *p32d; u32 Page; u32 ReNum; u32 *p32CMD; u32 *p32ADDR; // u32 *p32DATA; u32* p32DMA; u32 *p32NANDCTL; //---ๆต‹่ฏ•nandๆ›ฟๆขๅ—ๆ—ถ--- // if(ADDR_Dest==(ADDR_Download_ENTRY-ADDR_EFLASH_Start)) // { // return 1;//ๆต‹่ฏ•nandๆ›ฟๆขๅ—ๆ—ถ // } //---ๆต‹่ฏ•nandๆ›ฟๆขๅ—ๆ—ถ END--- Init_NAND();//ๅคไฝnand p32CMD=(u32*)(REG_NANDCMD); p32ADDR=(u32*)(REG_NANDADDR); // p32DATA=(u32*)(REG_NANDDATA); ADDR_Dest&=0xfffe0000; //ๅ—ๅ†™ ReNum=2;//ๅ†™ๅ…ฅ้”™่ฏฏ้‡ๅคๆฌกๆ•ฐ while(ReNum--) { //ๅ—ๆ“ฆ้™ค BlockErase_NAND(ADDR_Dest,0);//NAND_FLASH ๅ—ๆ“ฆ้™ค;ๆฒกๅ—ๆ›ฟๆข //ๅ—ๅ†™ๅ›ž(ๆฏๅˆ†้กต2048ๅญ—่Š‚) sysFlushCache(D_CACHE);//I_CACHE,D_CACHE,I_D_CACHE for(Page=0;Page<64;Page++) { while(1)//ๆމ็”ตไธญๆ–ญๅ†ฒ็ช้‡ๅ†™ { i=ADDR_Dest+(Page*2048); *p32CMD=0x80;//Command *p32ADDR=i;//Col.Add.1 *p32ADDR=(i>>8)&0x7;//Col.Add.2 *p32ADDR=(i>>11);//Row Add. 1 #if (NAND_2G|NAND_4G|NAND_8G) *p32ADDR=(i>>19);//Row Add. 2 *p32ADDR=(i>>27)|0x80000000;//Row Add. 3 #else *p32ADDR=(i>>19)|0x80000000;//Row Add. 2 #endif p32s=(u32*)(REG_NANDINTSTS); p32s[0]|=0x405;//ๆธ…[10]RB0_IF,[2]ECC_FLD_IF,[0]DMA_IFไฝ p32DMA=(u32*)(REG_FMI_DMASA); p32DMA[0]=ADDR_128KWRITE_BUFF+(Page*2048); p32NANDCTL=(u32*)(REG_NANDCTL); i=p32NANDCTL[0]; i|= (1<<4)|//[4]REDUN_AUTO_WEN Redundant Area Auto Write Enable (0<<3)|//[3]REDUN_REN NOTE: When transfer completed, this bit will be cleared automatically. (1<<2)|//[2]DWR_EN DMA Write Data Enable (0<<1);//[1]DRD_EN DMA Read Data Enable p32NANDCTL[0]=i; while(1) { p32s=(u32*)(REG_NANDINTSTS); i=p32s[0]; if(i&1) {//[0]DMA_IFไฝ break; } } //__disable_irq(); if(Comm_Ram->IntFlags&0x08)//ไธญๆ–ญๆœๅŠกไธญไฝฟ็”จๅ†ฒ็ชๆ ‡ๅฟ— { Comm_Ram->IntFlags=0;//ไธญๆ–ญๆœๅŠกไธญไฝฟ็”จๅ†ฒ็ชๆ ‡ๅฟ— //__enable_irq(); continue; } *p32CMD=0x10;//Command //__enable_irq(); break; } Wait_NAND(600*3);//่ฏปNAND็Šถๆ€ๅฏ„ๅญ˜ๅ™จ็ญ‰ๅพ…ๅฝ“ๅ‰ๅ‘ฝไปคๅฎŒๆˆ,่ฟ”ๅ›ž:0=ๆญฃ็กฎ,!=0่ฏปๅ–็š„็Šถๆ€ๅญ— } //่ฏปๆฏ”่พƒ for(Page=0;Page<64;Page++) { Read_Page(ADDR_NAND_PAGEREAD_BUFF,ADDR_Dest+(Page*2048));//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป้กตๆ•ฐๆฎ;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,!=0้”™่ฏฏ p32s=(u32*)(ADDR_128KWRITE_BUFF+(Page*2048)); p32d=(u32*)(ADDR_NAND_PAGEREAD_BUFF); for(i=0;i<(2048/4);i++) { x=p32s[i]; y=p32d[i]; if(x!=y) { break; } } if(i<(2048/4)) { break; } } if(Page>=64) { return 0;//่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ } } return 1;//่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ } u32 RePlace_BLOCK_ADDR(u32 ADDR)//ๅ–ๆ›ฟๆขๅ—ๅœฐๅ€ { u32 i; u8 *p8EEPROM; p8EEPROM=(u8*)(ADDR_NANDFLASH_BLOCK_REPLACE-ADDR_IEEPROM_START)+ADDR_SPI_MAP; i=ADDR/(128*1024);//ๅฝ“ๅ‰ๅ—่ฎกๆ•ฐ i=p8EEPROM[i]; if((i>=1)&&(i<=NAND_REPLACE_BLOCK_COUNT)) {//ๆœ‰ๆ›ฟๆข i--; ADDR=((NAND_FILE_BLOCK_COUNT+i)*128*1024)+(ADDR&0x1ffff); } return ADDR; } u32 RePlace_Read_NAND(u32 ADDR_Dest,u32 ADDR_Sour,u32 Byte)//NAND_FLASH ๆœ‰ๆ›ฟๆข่ฏป;่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,1=้”™่ฏฏ { u32 i; u32 BlockByte; u32 Err; Err=0; while(Byte!=0) { BlockByte=(128*1024)-(ADDR_Sour&0x1FFFF);//ๅฝ“ๅ‰Page่ฆ่ฏปๅญ—่Š‚ if(BlockByte>Byte) { BlockByte=Byte; } i=RePlace_BLOCK_ADDR(ADDR_Sour); i=Read_NAND(ADDR_Dest,i,BlockByte);//NAND_FLASH ๆฒกๆ›ฟๆข่ฏป if(i>Err) { Err=i;//่ฟ”ๅ›ž:0=ๆฒก้”™่ฏฏ,1=1ไฝ้”™่ฏฏ,2=ๆ— ๆณ•ๆ กๆญฃ็š„2ไฝไปฅไธŠ้”™่ฏฏ } ADDR_Dest+=BlockByte; ADDR_Sour+=BlockByte; Byte-=BlockByte; } return Err; } void RePlace_BLOCK_Write_NAND(u32 ADDR_Dest)//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— { u32 i; u32 x; u32 BLOCK_COUNT; u32 RePlace_BLOCK_COUNT; u8 *p8EEPROM; p8EEPROM=(u8*)(ADDR_NANDFLASH_BLOCK_REPLACE-ADDR_IEEPROM_START)+ADDR_SPI_MAP; BLOCK_COUNT=ADDR_Dest/(128*1024);//ๅฝ“ๅ‰ๅ—่ฎกๆ•ฐ if(BLOCK_COUNT<(NAND_FILE_BLOCK_COUNT+NAND_REPLACE_BLOCK_COUNT)) {//ๆ˜ฏๆ–‡ไปถ็ณป็ปŸๅ—ๆˆ–็”จไบŽๆ›ฟๆขๅ—็š„ๅ—;ๆต‹่ฏ•ๆ—ถๆ‰ๆ“ไฝœ่ฟ™ไบ›ๅ—,ไธ้œ€ๆ›ฟๆข,ๅช้œ€ๆ ‡ๅฟ—้”™่ฏฏ //็”จๆœฌ่บซๅ— x=BLOCK_Write_NAND(ADDR_Dest);//ๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ;่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ if(x==0) {//ๆญฃ็กฎ MC(0xFD,ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT,1);//EEPROMๆธ…้™ค } else { MC(0xFE,ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT,1);//EEPROMๆธ…้™ค } return; } //่‹ฅๆœ‰ๅ—ๆ›ฟๆข,ๅˆ™็”จๆ›ฟๆขๅ— x=ADDR_Dest; i=p8EEPROM[BLOCK_COUNT]; if((i>=1)&&(i<=NAND_REPLACE_BLOCK_COUNT)) {//ๆœ‰ๆ›ฟๆข i--; x=((NAND_FILE_BLOCK_COUNT+i)*128*1024); i++; } x=BLOCK_Write_NAND(x);//ๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ;่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ if(x==0) {//ๆญฃ็กฎ if((i>=1)&&(i<=NAND_REPLACE_BLOCK_COUNT)) {//ๆœ‰ๆ›ฟๆข,ๆ›ฟๆขๅ—ๅทฒ็”จๆ ‡ๆณจ i--; i+=ADDR_NANDFLASH_BLOCK_REPLACE+NAND_FILE_BLOCK_COUNT; p8EEPROM=(u8*)(i-ADDR_IEEPROM_START)+ADDR_SPI_MAP; if(p8EEPROM[0]!=0xFD) { MC(0xFD,i,1);//EEPROMๆธ…้™ค } } else { i=ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT; p8EEPROM=(u8*)(i-ADDR_IEEPROM_START)+ADDR_SPI_MAP; if(p8EEPROM[0]!=0xFD) { MC(0xFD,i,1);//EEPROMๆธ…้™ค } } } else {//้”™่ฏฏ if((i>=1)&&(i<=NAND_REPLACE_BLOCK_COUNT)) {//ๆœ‰ๆ›ฟๆข,ๆ›ฟๆขๅ—ไนŸ้”™่ฏฏ i--; i+=ADDR_NANDFLASH_BLOCK_REPLACE+NAND_FILE_BLOCK_COUNT; MC(0xFE,i,1);//EEPROMๆธ…้™ค } //ๆ‰พ็ฉบ็š„ๆ›ฟๆขๅ—ๅ†™ RePlace_BLOCK_COUNT=0; while(1) { p8EEPROM=(u8*)(ADDR_NANDFLASH_BLOCK_REPLACE-ADDR_IEEPROM_START)+ADDR_SPI_MAP+NAND_FILE_BLOCK_COUNT; for(;RePlace_BLOCK_COUNT<NAND_REPLACE_BLOCK_COUNT;RePlace_BLOCK_COUNT++) { x=p8EEPROM[RePlace_BLOCK_COUNT];//ๆ›ฟๆข็”จ็š„ๅ—ๅชๆœ‰2ไธช่กจ็คบๅ€ผ0xFDๅ’Œ0xFEๅฆๅˆ™่กจ็คบๆœชๅˆๅง‹ๅŒ– if(x!=0xFD) {//ๆ‰พๅˆฐ็ฉบๆˆ–ๅŽŸๅทฒๆ ‡ๆณจไธบ้”™่ฏฏ็š„ๅ— break; } } if(RePlace_BLOCK_COUNT<NAND_REPLACE_BLOCK_COUNT) {//ๆ›ฟๆขๅ—่ฟ˜ๆœ‰็ฉบ x=((NAND_FILE_BLOCK_COUNT+RePlace_BLOCK_COUNT)*128*1024); x=BLOCK_Write_NAND(x);//ๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ;่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ if(x==0) {//ๆญฃ็กฎ //ๅ†™ๆ›ฟๆขๅ—ๅท MC(RePlace_BLOCK_COUNT+1,ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT,1);//EEPROMๆธ…้™ค //ๆ›ฟๆขๅ—ๅทฒ็”จๆ ‡ๆณจ i=ADDR_NANDFLASH_BLOCK_REPLACE+NAND_FILE_BLOCK_COUNT+RePlace_BLOCK_COUNT; MC(0xFD,i,1);//EEPROMๆธ…้™ค break; } //ๆ›ฟๆขๅ†ๆฌก้”™ i=ADDR_NANDFLASH_BLOCK_REPLACE+NAND_FILE_BLOCK_COUNT+RePlace_BLOCK_COUNT; MC(0xFE,i,1);//EEPROMๆธ…้™ค RePlace_BLOCK_COUNT++; } else {//ๆ›ฟๆขๅ—ๅทฒๆฒก็ฉบ,็”จๆœฌ่บซๅ—ๅ†™ x=BLOCK_Write_NAND(ADDR_Dest);//ๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ;่ฟ”ๅ›ž;0=ๆญฃ็กฎ,1=้”™่ฏฏ if(x==0) {//ๆญฃ็กฎ MC(0xFD,ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT,1);//EEPROMๆธ…้™ค } else {//้”™่ฏฏ MC(0xFE,ADDR_NANDFLASH_BLOCK_REPLACE+BLOCK_COUNT,1);//EEPROMๆธ…้™ค } return; } } } } void RePlace_Write_NAND(u32 ADDR_Sour,u32 ADDR_Dest,u32 Byte)//NAND_FLASHๅ†™;่‹ฅ้”™่ฏฏๅˆ™ๅ—ๆ›ฟๆข { u32 i; u32 BlockByte; u8 *pSOUR; u8 *pBUFF; u32 Same; pSOUR=(u8*)ADDR_Sour; while(Byte!=0) { WWDT_Enable_Feed(WDTTimerOutVal);//ๅ…่ฎธ็œ‹้—จ็‹—ๅ’Œๅ–‚็‹—;ๆœ€ๅคงTimerOutMS=(0xfff*256)/32=32768ms //่ฏปๅŽŸ128Kๅ—ๆ•ฐๆฎ RePlace_Read_NAND(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//NAND_FLASH S34MLxxG2ๆœ‰ๆ›ฟๆข่ฏป //BUFFไธญๆ›ดๆ–ฐๆ•ฐๆฎๅŒๆ—ถๆฏ”่พƒ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte) { BlockByte=Byte; } pBUFF=(u8*)(ADDR_128KWRITE_BUFF); pBUFF+=(ADDR_Dest&0x1ffff);//ๅ็งป Same=1;//็›ธๅŒ for(i=0;i<BlockByte;i++) { if(*pBUFF!=*pSOUR) { Same=0;//ไธ็›ธๅŒ for(;i<BlockByte;i++) { *pBUFF=*pSOUR; pSOUR++; pBUFF++; } break; } pSOUR++; pBUFF++; } if(Same==0) { RePlace_BLOCK_Write_NAND(ADDR_Dest);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— } ADDR_Dest+=BlockByte; Byte-=BlockByte; } } void RePlace_Clr_NAND(u32 Data,u32 ADDR_Dest,u32 Byte)//NAND_FLASHๆธ…0;่‹ฅ้”™่ฏฏๅˆ™ๅ—ๆ›ฟๆข { u32 i; u32 BlockByte; u8 *p8BUFF; u32 Same; while(Byte!=0) { WWDT_Enable_Feed(WDTTimerOutVal);//ๅ…่ฎธ็œ‹้—จ็‹—ๅ’Œๅ–‚็‹—;ๆœ€ๅคงTimerOutMS=(0xfff*256)/32=32768ms //่ฏปๅŽŸ128Kๅ—ๆ•ฐๆฎ RePlace_Read_NAND(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//NAND_FLASH S34MLxxG2ๆœ‰ๆ›ฟๆข่ฏป //ๆ›ดๆ–ฐๆ•ฐๆฎๅŒๆ—ถๆฏ”่พƒ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰Back่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte) { BlockByte=Byte; } p8BUFF=(u8*)(ADDR_128KWRITE_BUFF); p8BUFF+=(ADDR_Dest&0x1ffff);//ๅ็งป Same=1;//็›ธๅŒ for(i=0;i<BlockByte;i++) { if(*p8BUFF!=Data) { Same=0;//ไธ็›ธๅŒ for(;i<BlockByte;i++) { *p8BUFF=Data; p8BUFF++; } break; } p8BUFF++; } if(Same==0) { RePlace_BLOCK_Write_NAND(ADDR_Dest);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— } ADDR_Dest+=BlockByte; Byte-=BlockByte; } } void RePlace_BlockErase_NAND(u32 ADDR_Dest,u32 Byte)//NAND_FLASH ๅ—ๆ“ฆ้™ค;ๆœ‰ๅ—ๆ›ฟๆข { u32 i; while(Byte) { i=RePlace_BLOCK_ADDR(ADDR_Dest); BlockErase_NAND(i,1);//NAND_FLASH ๅ—ๆ“ฆ้™ค;ๆฒกๅ—ๆ›ฟๆข if(Byte>=(128*1024)) { ADDR_Dest+=(128*1024); Byte-=(128*1024); } else { Byte=0; } } } //NAND_BUFF #if NAND128kBuff==0//ๅฎšไน‰128k nandๅ†™็ผ“ๅ†ฒ u32 Check_4kNandBuff(void)//ๆฃ€ๆŸฅ4K(BKPSRAM) NAND FLASH็š„ๅ†™็ผ“ๅ†ฒ,่‹ฅๆ— ๆ•ˆๅˆ™ๆธ…0;่ฟ”ๅ›ž:0=้”™่ฏฏ,1=ๆญฃ็กฎ { u32 i; u32 x; u32 Block; u32 Byte; u32 LENmax; u16 *p16; u32* p32; u8 *p832; u32 Err; // u8 *p8; // u32 ADDR_BASE; //---ๆމ็”ตไฟๆŒๆต‹่ฏ•--------------------- /* p8=(u8*)ADDR_Characteristics_NO; i=p8[0]; if(i>2) { i=0; } ADDR_BASE=ADDR_Characteristics_BASE1+(i*LEN_BASE_Characteristics); p8=(u8*)ADDR_BASE; p8+=OFFSET_POWER_DOWN_Characteristics; if(p8[0]==0x55)//1BYTE 4K(BKPSRAM)ๆމ็”ตไฟๆŒ,0=OK,1=ERR,0xff=ๆฒกๆต‹่ฏ•,0x55=่ฟ›่กŒๆต‹่ฏ• { p32=(u32*)(ADDR_BKPSRAM); for(i=0;i<(4096/4);i++) { if(p32[i]!=i) { break; } } if(i<((4096-4)/4)) {//้”™่ฏฏ MWR(1,ADDR_BASE+(OFFSET_POWER_DOWN_Characteristics),1); p8=(u8*)ADDR_BASE+(OFFSET_TestResult_Characteristics);//1BYTE ๆ€ปๆต‹่ฏ•็ป“ๆžœ0=ๅˆๆ ผ,1=ไธๅˆๆ ผ,0xff=ๆ— ็ป“่ฎบ if(p8[0]==0) { MWR(1,ADDR_BASE+(OFFSET_TestResult_Characteristics),1); } } else { MWR(0,ADDR_BASE+(OFFSET_POWER_DOWN_Characteristics),1); } } */ //---ๆމ็”ตไฟๆŒๆต‹่ฏ•End------------------------- //ๆฃ€ๆŸฅ Err=0; p16=(u16*)(ADDR_BKPSRAM); if((p16[1]>4096)||(p16[1]<4)) {//้”™,ๆ€ปๅญ—่Š‚ๆ•ฐ(ๅ…จ้ƒจๅญ—่Š‚,ไนŸๅณไธ‹ๅ—็š„ๅผ€ๅง‹ๅœฐๅ€) Block=0; Err=1; } Block=p16[0]; Byte=4; LENmax=4096-4-8; for(i=0;i<Block;i++) { if(Byte>4096) { Err=1; break; } p832=(u8*)(ADDR_BKPSRAM+Byte); p16=(u16*)(ADDR_BKPSRAM+Byte+4); x=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if((x<0x30000000)||(x>0xA0000000)||(p16[1]>p16[0])) {//้”™ Err=1; break; } if(p16[0]>LENmax) { Err=1; break; } Byte+=8+p16[0]; LENmax-=8+p16[0]; } p16=(u16*)(ADDR_BKPSRAM); if(Byte!=p16[1]) { Err=1; } else { if(Byte<=(4096-4)) { i=RAM_CRC32(ADDR_BKPSRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— p32=(u32*)(ADDR_BKPSRAM+(4096-4)); if(p32[0]!=i) { Err=1; } } } if(Err) { p32=(u32*)(ADDR_BKPSRAM); p32[0]=0x40000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=4 p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,4);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— Err=0; } else { Err=1; } return Err;//0=้”™่ฏฏ,1=ๆญฃ็กฎ } void NR_4kBuff(u32 ADDR_Dest,u32 ADDR_Sour,u32 Byte)//่ฏปNAND_FLASH็š„ๅ†™ๅ…ฅ็ผ“ๅ†ฒ { u32 i; u32 x; u32 ReadByte; u32 ADDR_BUFF; u32 TBlock; u8 *p816; u8 *p832; u32* p32; u8 *p8s; u8 *p8d; p816=(u8*)(ADDR_BKPSRAM); TBlock=p816[0]|(p816[1]<<8); ADDR_BUFF=ADDR_BKPSRAM+4; while(TBlock--) { if(ADDR_BUFF>=(ADDR_BKPSRAM+4096)) {//ๅ—ๆ•ฐไธŽ้•ฟๅบฆไธ้…้”™่ฏฏ p32=(u32*)(ADDR_BKPSRAM); p32[0]=0x40000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=4 p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,4);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— return; } p832=(u8*)(ADDR_BUFF); p816=(u8*)(ADDR_BUFF+4); i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); x=p816[0]|(p816[1]<<8); ReadByte=0; //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€>=่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((i>=ADDR_Sour)&&(i<(ADDR_Sour+Byte))) { p8s=(u8*)ADDR_BUFF+8; p8d=(u8*)ADDR_Dest+(i-ADDR_Sour); ReadByte=(ADDR_Sour+Byte)-i;//่ฏปๅญ—่Š‚ๆ•ฐ if(ReadByte>x) { ReadByte=x;//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ } } else { //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€<่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((ADDR_Sour>=i)&&(ADDR_Sour<(i+x))) { p8s=(u8*)ADDR_BUFF+8+(ADDR_Sour-i); p8d=(u8*)ADDR_Dest; ReadByte=x-(ADDR_Sour-i);//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ if(ReadByte>Byte) { ReadByte=Byte;//่ฏปๅญ—่Š‚ๆ•ฐ } } } if((((u32)p8s)+ReadByte)<=(ADDR_BKPSRAM+4096)) { for(i=0;i<ReadByte;i++) { p8d[i]=p8s[i]; } } ADDR_BUFF+=8+x; } } void NB_4kBuff(u32 ADDR_Dest,u32 Byte)//ๆ“ฆ้™คNAND_FLASHๆ—ถๅŒๆ—ถๆ›ดๆ–ฐๅ†™ๅ…ฅ็ผ“ๅ†ฒ { u32 i; u32 x; u32 WriteByte; u32 ADDR_BUFF; u32 TBlock; u8 *p816; u8 *p832; u32* p32; u8 *p8d; p816=(u8*)(ADDR_BKPSRAM); TBlock=p816[0]|(p816[1]<<8); ADDR_BUFF=ADDR_BKPSRAM+4; while(TBlock--) { p832=(u8*)(ADDR_BUFF); p816=(u8*)(ADDR_BUFF+4); i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); x=p816[0]|(p816[1]<<8); WriteByte=0; //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€>=่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((i>=ADDR_Dest)&&(i<(ADDR_Dest+Byte))) { p8d=(u8*)ADDR_BUFF+8; WriteByte=Byte-(i-ADDR_Dest);//ๅ†™ๅญ—่Š‚ๆ•ฐ if(WriteByte>x) { WriteByte=x;//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ } } else { //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€<่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((ADDR_Dest>=i)&&(ADDR_Dest<(i+x))) { p8d=(u8*)ADDR_BUFF+8+(ADDR_Dest-i); WriteByte=x-(ADDR_Dest-i);//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ if(WriteByte>Byte) { WriteByte=Byte;//ๅ†™ๅญ—่Š‚ๆ•ฐ } } } for(i=0;i<WriteByte;i++) { p8d[i]=0xff; } ADDR_BUFF+=8+x; } p816=(u8*)(ADDR_BKPSRAM+2); Byte=p816[0]|(p816[1]<<8); if(Byte<=(4096-4)) { p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } void NAND4kBuff_Write_NAND(u32 ADDR_Sour0,u32 ADDR_Dest0,u32 Byte0)//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH { u32 i; u32 x; u32 n; u32 TBlock; u32 ADDR_SRAM; u32 ADDR_Dest; u32 ADDR_DestX; u32 BlockByte; u8 *p816; u8 *p832; u8 *p8s; u8 *p8d; u32* p32; p816=(u8*)(ADDR_BKPSRAM); TBlock=p816[0]|(p816[1]<<8); if(TBlock==0) { if(Byte0!=0) {//่‡ณๅฐ‘1ไธชๅ— TBlock=1; //ๆ•ฐๆฎๅ—1 //4BYTE ๅ†™ๅ…ฅNAND FLASH็š„็›ฎ็š„ๅœฐๅ€ //2BYTE ๆ•ฐๆฎๅญ—่Š‚ๆ•ฐ //2BYTE ๅทฒ้ƒจๅˆ†ๅ†™ๅ…ฅ็š„ๅญ—่Š‚ๆ•ฐ p32=(u32*)(ADDR_BKPSRAM+4); p32[0]=0; p32[1]=0; } } ADDR_SRAM=ADDR_BKPSRAM+4; for(x=0;x<TBlock;x++) { if(Comm_Ram->POWER<3)//็”ตๆบ:0=็”ตๆฑ ไพ›็”ต,1=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต้‡ๅฏๅŠจ,2=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต,3=็”ต็ฝ‘ไพ›็”ต {//ๆމ็”ต if(Byte0==0) { p816=(u8*)(ADDR_BKPSRAM+2); x=p816[0]|(p816[1]<<8); if(x<=(4096-4)) { p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,x);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ return;//ๆš‚ๅœๅ†™ } } p816=(u8*)(ADDR_SRAM+4); n=p816[0]|(p816[1]<<8);//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n-=p816[2]|(p816[3]<<8); if(n|Byte0) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ p832=(u8*)(ADDR_SRAM); ADDR_Dest=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p816[2]|(p816[3]<<8));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if(((ADDR_Dest>=0x30000000)&&(ADDR_Dest<0xA0000000))||Byte0) {//NAND if(Byte0!=0) { ADDR_Dest=ADDR_Dest0; MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ } else { MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+8+(p816[2]|(p816[3]<<8)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=p816[2]|(p816[3]<<8);//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ i+=BlockByte; p816[2]=i; p816[3]=i>>8; ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8;//ไธ‹ๅ— x++; } for(;x<TBlock;x++) { p832=(u8*)ADDR_SRAM; p816=(u8*)(ADDR_SRAM+4); ADDR_DestX=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p816[2]|(p816[3]<<8));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if((ADDR_Dest&0xfffe0000)==(ADDR_DestX&0xfffe0000)) {//ๅ—ๅœฐๅ€็›ธๅŒ n=p816[0]|(p816[1]<<8);//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n-=p816[2]|(p816[3]<<8); if(n) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ BlockByte=(128*1024)-(ADDR_DestX&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+8+(p816[2]|(p816[3]<<8)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_DestX&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=p816[2]|(p816[3]<<8);//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ i+=BlockByte; p816[2]=i; p816[3]=i>>8; } } ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8;//ไธ‹ๅ— } //ๆœ€ๅŽๆ•ฐๆฎๆœ€ๅŽๆ›ดๆ–ฐ if(Byte0!=0) { BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte0) { BlockByte=Byte0; } p8s=(u8*)ADDR_Sour0; p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } ADDR_Sour0+=BlockByte; ADDR_Dest0+=BlockByte; Byte0-=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ } RePlace_BLOCK_Write_NAND(ADDR_Dest-ADDR_EFLASH_Start);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— ADDR_SRAM=ADDR_BKPSRAM+4; x=0xffffffff; continue; } } ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8; } p32=(u32*)(ADDR_BKPSRAM); p32[0]=0x40000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=4 p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,4);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ } void NAND4kBuff_Clr_NAND(u32 Data0,u32 ADDR_Dest0,u32 Byte0)//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH { u32 i; u32 x; u32 n; u32 TBlock; u32 ADDR_SRAM; u32 ADDR_Dest; u32 ADDR_DestX; u32 BlockByte; u8 *p816; u8 *p832; u8 *p8s; u8 *p8d; u32* p32; p816=(u8*)(ADDR_BKPSRAM); TBlock=p816[0]|(p816[1]<<8); if(TBlock==0) { if(Byte0!=0) {//่‡ณๅฐ‘1ไธชๅ— TBlock=1; //ๆ•ฐๆฎๅ—1 //4BYTE ๅ†™ๅ…ฅNAND FLASH็š„็›ฎ็š„ๅœฐๅ€ //2BYTE ๆ•ฐๆฎๅญ—่Š‚ๆ•ฐ //2BYTE ๅทฒ้ƒจๅˆ†ๅ†™ๅ…ฅ็š„ๅญ—่Š‚ๆ•ฐ p32=(u32*)(ADDR_BKPSRAM+4); p32[0]=0; p32[1]=0; } } ADDR_SRAM=ADDR_BKPSRAM+4; for(x=0;x<TBlock;x++) { if(Comm_Ram->POWER<3)//็”ตๆบ:0=็”ตๆฑ ไพ›็”ต,1=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต้‡ๅฏๅŠจ,2=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต,3=็”ต็ฝ‘ไพ›็”ต {//ๆމ็”ต if(Byte0==0) { p816=(u8*)(ADDR_BKPSRAM+2); x=p816[0]|(p816[1]<<8); if(x<=(4096-4)) { p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,x);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ return;//ๆš‚ๅœๅ†™ } } p816=(u8*)(ADDR_SRAM+4); n=p816[0]|(p816[1]<<8);//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n-=p816[2]|(p816[3]<<8); if(n|Byte0) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ p832=(u8*)(ADDR_SRAM); ADDR_Dest=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p816[2]|(p816[3]<<8));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if(((ADDR_Dest>=0x30000000)&&(ADDR_Dest<0xA0000000))||Byte0) {//NAND if(Byte0!=0) { ADDR_Dest=ADDR_Dest0; MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ } else { MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+8+(p816[2]|(p816[3]<<8)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=p816[2]|(p816[3]<<8);//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ i+=BlockByte; p816[2]=i; p816[3]=i>>8; ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8;//ไธ‹ๅ— x++; } for(;x<TBlock;x++) { p832=(u8*)ADDR_SRAM; p816=(u8*)(ADDR_SRAM+4); ADDR_DestX=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p816[2]|(p816[3]<<8));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if((ADDR_Dest&0xfffe0000)==(ADDR_DestX&0xfffe0000)) {//ๅ—ๅœฐๅ€็›ธๅŒ n=p816[0]|(p816[1]<<8);//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n-=p816[2]|(p816[3]<<8); if(n) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ BlockByte=(128*1024)-(ADDR_DestX&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+8+(p816[2]|(p816[3]<<8)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_DestX&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=p816[2]|(p816[3]<<8);//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ i+=BlockByte; p816[2]=i; p816[3]=i>>8; } } ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8;//ไธ‹ๅ— } //ๆœ€ๅŽๆ•ฐๆฎๆœ€ๅŽๆ›ดๆ–ฐ if(Byte0!=0) { BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte0) { BlockByte=Byte0; } p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=Data0; } ADDR_Dest0+=BlockByte; Byte0-=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ } RePlace_BLOCK_Write_NAND(ADDR_Dest-ADDR_EFLASH_Start);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— ADDR_SRAM=ADDR_BKPSRAM+4; x=0xffffffff; continue; } } ADDR_SRAM+=(p816[0]|(p816[1]<<8))+8; } p32=(u32*)(ADDR_BKPSRAM); p32[0]=0x40000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=4 p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,4);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ } void NW_4kBuff(u32 ADDR_Sour,u32 ADDR_Dest,u32 Byte)//ๅ†™4k Nand FLASH็ผ“ๅ†ฒ { u32 i; u8 *p8s; u8 *p8d; u8 *p816; u8 *p832; u32* p32; p816=(u8*)(ADDR_BKPSRAM); i=p816[2]|(p816[3]<<8); if((i+8+Byte)>4096) {//็ผ“ๅ†ฒๅŒบไธๅคŸ NAND4kBuff_Write_NAND(ADDR_Sour,ADDR_Dest,Byte);//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } i=p816[0]|(p816[1]<<8); if(i>=BlockMax_NandBuff) {//ๆ€ปๅ—ๆ•ฐ ๅ—ไธบไธๅŒnandๅ—ๆ—ถ64*20ms=1280ms NAND4kBuff_Write_NAND(ADDR_Sour,ADDR_Dest,Byte);//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } p832=(u8*)(ADDR_BKPSRAM+(p816[2]|(p816[3]<<8))); p832[0]=ADDR_Dest; p832[1]=ADDR_Dest>>8; p832[2]=ADDR_Dest>>16; p832[3]=ADDR_Dest>>24; p832[4]=Byte; p832[5]=Byte>>8; p832[6]=Byte>>16; p832[7]=Byte>>24; p8s=(u8*)ADDR_Sour; p8d=(u8*)(ADDR_BKPSRAM+(p816[2]|(p816[3]<<8))+8); for(i=0;i<Byte;i++) { p8d[i]=p8s[i]; } i=p816[0]|(p816[1]<<8); i++; Byte+=(p816[2]|(p816[3]<<8))+8; i|=(Byte<<16); p32=(u32*)(ADDR_BKPSRAM); p32[0]=i;//ๅ—ๆ•ฐๅ’Œๆ€ปๅญ—่Š‚ๆ•ฐ้œ€32ไฝไธ€่ตทๅ†™ๅ…ฅ๏ผŒ้ฟๅ…ๆމ็”ตไธญๆ–ญ็ญ‰ๅผ•่ตทไธๅŒๆญฅ! if(Byte<=(4096-4)) { p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } void NC_4kBuff(u32 Data,u32 ADDR_Dest,u32 Byte)//ๆธ…้™คๅ†™ๅ…ฅNand FLASH็š„ๆ•ฐๆฎๅ…ˆๅˆฐ4kBuff { u32 i; u8 *p8d; u8 *p816; u8 *p832; u32* p32; p816=(u8*)(ADDR_BKPSRAM); i=p816[2]|(p816[3]<<8); if((i+8+Byte)>4096) {//็ผ“ๅ†ฒๅŒบไธๅคŸ NAND4kBuff_Clr_NAND(Data,ADDR_Dest,Byte);//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } i=p816[0]|(p816[1]<<8); if(i>=BlockMax_NandBuff) {//ๆ€ปๅ—ๆ•ฐ ๅ—ไธบไธๅŒnandๅ—ๆ—ถ64*20ms=1280ms NAND4kBuff_Clr_NAND(Data,ADDR_Dest,Byte);//่ฟžๅŒ4K(BKPSRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } p832=(u8*)(ADDR_BKPSRAM+(p816[2]|(p816[3]<<8))); p832[0]=ADDR_Dest; p832[1]=ADDR_Dest>>8; p832[2]=ADDR_Dest>>16; p832[3]=ADDR_Dest>>24; p832[4]=Byte; p832[5]=Byte>>8; p832[6]=Byte>>16; p832[7]=Byte>>24; p8d=(u8*)(ADDR_BKPSRAM+(p816[2]|(p816[3]<<8))+8); for(i=0;i<Byte;i++) { p8d[i]=Data; } i=p816[0]|(p816[1]<<8); i++; Byte+=(p816[2]|(p816[3]<<8))+8; i|=(Byte<<16); p32=(u32*)(ADDR_BKPSRAM); p32[0]=i;//ๅ—ๆ•ฐๅ’Œๆ€ปๅญ—่Š‚ๆ•ฐ้œ€32ไฝไธ€่ตทๅ†™ๅ…ฅ๏ผŒ้ฟๅ…ๆމ็”ตไธญๆ–ญ็ญ‰ๅผ•่ตทไธๅŒๆญฅ! if(Byte<=(4096-4)) { p32=(u32*)(ADDR_BKPSRAM+(4096-4)); p32[0]=RAM_CRC32(ADDR_BKPSRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } #else//#if NAND128kBuff==0//ๅฎšไน‰128k nandๅ†™็ผ“ๅ†ฒ u32 Check_128kNandBuff(void)//ๆฃ€ๆŸฅ128K(BKPSDRAM) NAND FLASH็š„ๅ†™็ผ“ๅ†ฒ,่‹ฅๆ— ๆ•ˆๅˆ™ๆธ…0;่ฟ”ๅ›ž:0=้”™่ฏฏ,1=ๆญฃ็กฎ { u32 i; u32 x; u32 y; u32 Block; u32 Byte; u32 LENmax; u8 *p816; u8 *p832; u32 Err; u32* p32; Err=0; p816=(u8*)(ADDR_BKPSDRAM); p832=(u8*)(ADDR_BKPSDRAM+2); LENmax=(128*1024)-6-12; i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if((i>(128*1024))||(i<6)) {//้”™,ๆ€ปๅญ—่Š‚ๆ•ฐ(ๅ…จ้ƒจๅญ—่Š‚,ไนŸๅณไธ‹ๅ—็š„ๅผ€ๅง‹ๅœฐๅ€) Err=1; } Block=p816[0]|(p816[1]<<8); if(Block>(((128*1024)-6)/12)) { Block=0; Err=1; } Byte=6; for(i=0;i<Block;i++) { if(Byte>(128*1024)) { Err=1; break; } p832=(u8*)(ADDR_BKPSDRAM+Byte); x=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if((x<0x30000000)||(x>0xA0000000)) {//้”™ Err=1; break; } x=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); y=p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24); if(y>x) { Err=1; break; } if(x>LENmax) { Err=1; break; } Byte+=12+x; LENmax-=12+x; } p832=(u8*)(ADDR_BKPSDRAM+2); i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if(Byte!=i) { Err=1; } else { if(Byte<=((128*1024)-4)) { if(Byte>(4096-4)) { Byte=(4096-4); } i=RAM_CRC32(ADDR_BKPSDRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(p32[0]!=i) { Err=1; } } } if(Err) { p32=(u32*)(ADDR_BKPSDRAM); p32[0]=0x60000; p32[1]=0; p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); p32[0]=RAM_CRC32(ADDR_BKPSDRAM,6);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— Err=0; } else { Err=1; } return Err;//0=้”™่ฏฏ,1=ๆญฃ็กฎ } void NR_128kBuff(u32 ADDR_Dest,u32 ADDR_Sour,u32 Byte)//่ฏปNAND_FLASH็š„ๅ†™ๅ…ฅ็ผ“ๅ†ฒ { u32 i; u32 x; u32 ReadByte; u32 ADDR_BUFF; u32 TBlock; u8 *p832; u8 *p8s; u8 *p8d; u32* p32; p832=(u8*)(ADDR_BKPSDRAM); TBlock=p832[0]|(p832[1]<<8); ADDR_BUFF=ADDR_BKPSDRAM+6; while(TBlock--) { if(ADDR_BUFF>=(ADDR_BKPSDRAM+(128*1024))) {//ๅ—ๆ•ฐไธŽ้•ฟๅบฆไธ้…้”™่ฏฏ p32=(u32*)(ADDR_BKPSDRAM); p32[0]=0x60000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=6 p32[1]=0; p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); p32[0]=RAM_CRC32(ADDR_BKPSDRAM,6);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— return; } p832=(u8*)(ADDR_BUFF); i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); x=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); ReadByte=0; //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€>=่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((i>=ADDR_Sour)&&(i<(ADDR_Sour+Byte))) { p8s=(u8*)ADDR_BUFF+12; p8d=(u8*)ADDR_Dest+(i-ADDR_Sour); ReadByte=(ADDR_Sour+Byte)-i;//่ฏปๅญ—่Š‚ๆ•ฐ if(ReadByte>x) { ReadByte=x;//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ } } else { //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€<่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((ADDR_Sour>=i)&&(ADDR_Sour<(i+x))) { p8s=(u8*)ADDR_BUFF+12+(ADDR_Sour-i); p8d=(u8*)ADDR_Dest; ReadByte=x-(ADDR_Sour-i);//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ if(ReadByte>Byte) { ReadByte=Byte;//่ฏปๅญ—่Š‚ๆ•ฐ } } } if((((u32)p8s)+ReadByte)<=(ADDR_BKPSDRAM+(128*1024))) { for(i=0;i<ReadByte;i++) { p8d[i]=p8s[i]; } } ADDR_BUFF+=12+x; } } void NB_128kBuff(u32 ADDR_Dest,u32 Byte)//ๆ“ฆ้™คNAND_FLASHๆ—ถๅŒๆ—ถๆ›ดๆ–ฐๅ†™ๅ…ฅ็ผ“ๅ†ฒ { u32 i; u32 x; u32 WriteByte; u32 ADDR_BUFF; u32 TBlock; u8 *p832; u8 *p8d; u32* p32; p832=(u8*)(ADDR_BKPSDRAM); TBlock=p832[0]|(p832[1]<<8); ADDR_BUFF=ADDR_BKPSDRAM+6; while(TBlock--) { p832=(u8*)(ADDR_BUFF); i=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); x=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); WriteByte=0; //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€>=่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((i>=ADDR_Dest)&&(i<(ADDR_Dest+Byte))) { p8d=(u8*)ADDR_BUFF+12; WriteByte=Byte-(i-ADDR_Dest);//ๅ†™ๅญ—่Š‚ๆ•ฐ if(WriteByte>x) { WriteByte=x;//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ } } else { //BUFFไธญๆ•ฐๆฎๅผ€ๅง‹ๅœฐๅ€<่ฆ่ฏป็š„NANDๅผ€ๅง‹ๅœฐๅ€ if((ADDR_Dest>=i)&&(ADDR_Dest<(i+x))) { p8d=(u8*)ADDR_BUFF+12+(ADDR_Dest-i); WriteByte=x-(ADDR_Dest-i);//็ผ“ๅ†ฒไธญๅญ—่Š‚ๆ•ฐ if(WriteByte>Byte) { WriteByte=Byte;//ๅ†™ๅญ—่Š‚ๆ•ฐ } } } for(i=0;i<WriteByte;i++) { p8d[i]=0xff; } ADDR_BUFF+=12+x; } p832=(u8*)(ADDR_BKPSDRAM+2); Byte=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if(Byte<=((128*1024)-4)) { p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(Byte>(4096-4)) { Byte=(4096-4); } p32[0]=RAM_CRC32(ADDR_BKPSDRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } void NAND128kBuff_Write_NAND(u32 ADDR_Sour0,u32 ADDR_Dest0,u32 Byte0)//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH { u32 i; u32 x; u32 n; u32 TBlock; u32 ADDR_SRAM; u32 ADDR_Dest; u32 ADDR_DestX; u32 BlockByte; u8 *p832; u8 *p8s; u8 *p8d; u32* p32; p832=(u8*)(ADDR_BKPSDRAM); TBlock=p832[0]|(p832[1]<<8); if(TBlock==0) { if(Byte0!=0) {//่‡ณๅฐ‘1ไธชๅ— TBlock=1; //ๆ•ฐๆฎๅ—1 //4BYTE ๅ†™ๅ…ฅNAND FLASH็š„็›ฎ็š„ๅœฐๅ€ //4BYTE ๆ•ฐๆฎๅญ—่Š‚ๆ•ฐ //4BYTE ๅทฒ้ƒจๅˆ†ๅ†™ๅ…ฅ็š„ๅญ—่Š‚ๆ•ฐ p32=(u32*)(ADDR_BKPSDRAM+6); p32[0]=0; p32[1]=0; p32[2]=0; } } ADDR_SRAM=ADDR_BKPSDRAM+6; for(x=0;x<TBlock;x++) { if(Comm_Ram->POWER<3)//็”ตๆบ:0=็”ตๆฑ ไพ›็”ต,1=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต้‡ๅฏๅŠจ,2=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต,3=็”ต็ฝ‘ไพ›็”ต {//ๆމ็”ต if(Byte0==0) { p832=(u8*)(ADDR_BKPSDRAM+2); x=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if(x<=((128*1024)-4)) { p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(x>(4096-4)) { x=(4096-4); } p32[0]=RAM_CRC32(ADDR_BKPSDRAM,x);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ return;//ๆš‚ๅœๅ†™ } } p832=(u8*)(ADDR_SRAM); //n=p32[1]-p32[2];//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); n-=p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24); if(n|Byte0) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ ADDR_Dest=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24)) + (p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if(((ADDR_Dest>=0x30000000)&&(ADDR_Dest<0xA0000000))||Byte0) {//NAND if(Byte0!=0) { ADDR_Dest=ADDR_Dest0; MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ } else { MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+12+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); i+=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ p832[8]=i; p832[9]=i>>8; p832[10]=i>>16; p832[11]=i>>24; ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12;//ไธ‹ๅ— x++; } for(;x<TBlock;x++) { p832=(u8*)ADDR_SRAM; ADDR_DestX=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24)) + (p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if((ADDR_Dest&0xfffe0000)==(ADDR_DestX&0xfffe0000)) {//ๅ—ๅœฐๅ€็›ธๅŒ //n=p32[1]-p32[2];//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); n-=p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24); if(n) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ BlockByte=(128*1024)-(ADDR_DestX&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+12+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_DestX&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); i+=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ p832[8]=i; p832[9]=i>>8; p832[10]=i>>16; p832[11]=i>>24; } } ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12;//ไธ‹ๅ— } //ๆœ€ๅŽๆ•ฐๆฎๆœ€ๅŽๆ›ดๆ–ฐ if(Byte0!=0) { BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte0) { BlockByte=Byte0; } p8s=(u8*)ADDR_Sour0; p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } ADDR_Sour0+=BlockByte; ADDR_Dest0+=BlockByte; Byte0-=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ } RePlace_BLOCK_Write_NAND(ADDR_Dest-ADDR_EFLASH_Start);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— ADDR_SRAM=ADDR_BKPSDRAM+6; x=0xffffffff; continue; } } ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12; } p32=(u32*)(ADDR_BKPSDRAM); p32[0]=0x60000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=6 p32[1]=0; p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); p32[0]=RAM_CRC32(ADDR_BKPSDRAM,6);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ } void NAND128kBuff_Clr_NAND(u32 Data0,u32 ADDR_Dest0,u32 Byte0)//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH { u32 i; u32 x; u32 n; u32 TBlock; u32 ADDR_SRAM; u32 ADDR_Dest; u32 ADDR_DestX; u32 BlockByte; u8 *p832; u8 *p8s; u8 *p8d; u32* p32; p832=(u8*)(ADDR_BKPSDRAM); TBlock=p832[0]|(p832[1]<<8); if(TBlock==0) { if(Byte0!=0) {//่‡ณๅฐ‘1ไธชๅ— TBlock=1; //ๆ•ฐๆฎๅ—1 //4BYTE ๅ†™ๅ…ฅNAND FLASH็š„็›ฎ็š„ๅœฐๅ€ //2BYTE ๆ•ฐๆฎๅญ—่Š‚ๆ•ฐ //2BYTE ๅทฒ้ƒจๅˆ†ๅ†™ๅ…ฅ็š„ๅญ—่Š‚ๆ•ฐ p32=(u32*)(ADDR_BKPSDRAM+6); p32[0]=0; p32[1]=0; p32[2]=0; } } ADDR_SRAM=ADDR_BKPSDRAM+6; for(x=0;x<TBlock;x++) { if(Comm_Ram->POWER<3)//็”ตๆบ:0=็”ตๆฑ ไพ›็”ต,1=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต้‡ๅฏๅŠจ,2=็”ต็ฝ‘ไพ›็”ต่ฝฌ็”ตๆฑ ไพ›็”ต,3=็”ต็ฝ‘ไพ›็”ต {//ๆމ็”ต if(Byte0==0) { p832=(u8*)(ADDR_BKPSDRAM+2); x=p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24); if(x<=((128*1024)-4)) { p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(x>(4096-4)) { x=(4096-4); } p32[0]=RAM_CRC32(ADDR_BKPSDRAM,x);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ return;//ๆš‚ๅœๅ†™ } } p832=(u8*)(ADDR_SRAM); //n=p32[1]-p32[2];//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); n-=p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24); if(n|Byte0) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ ADDR_Dest=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if(((ADDR_Dest>=0x30000000)&&(ADDR_Dest<0xA0000000))||Byte0) {//NAND if(Byte0!=0) { ADDR_Dest=ADDR_Dest0; MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ } else { MR(ADDR_128KWRITE_BUFF,ADDR_Dest&0xfffe0000,128*1024);//่ฏปๆ•ดๅ—128Kๆ•ฐๆฎ BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+12+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); i+=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ p832[8]=i; p832[9]=i>>8; p832[10]=i>>16; p832[11]=i>>24; ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12;//ไธ‹ๅ— x++; } for(;x<TBlock;x++) { p832=(u8*)ADDR_SRAM; ADDR_DestX=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24));//ๅผ€ๅง‹ๅœฐๅ€+ๅทฒๅ†™ๅญ—่Š‚ if((ADDR_Dest&0xfffe0000)==(ADDR_DestX&0xfffe0000)) {//ๅ—ๅœฐๅ€็›ธๅŒ //n=p32[1]-p32[2];//่ฟ˜้œ€ๅ†™ๅญ—่Š‚ n=p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24); n-=p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24); if(n) {//ๆœ‰ๅญ—่Š‚้œ€ๅ†™ๅ…ฅ BlockByte=(128*1024)-(ADDR_DestX&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>n) { BlockByte=n; } p8s=(u8*)ADDR_SRAM+12+(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_DestX&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=p8s[n]; } i=(p832[8]|(p832[9]<<8)|(p832[10]<<16)|(p832[11]<<24)); i+=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ p832[8]=i; p832[9]=i>>8; p832[10]=i>>16; p832[11]=i>>24; } } ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12;//ไธ‹ๅ— } //ๆœ€ๅŽๆ•ฐๆฎๆœ€ๅŽๆ›ดๆ–ฐ if(Byte0!=0) { BlockByte=(128*1024)-(ADDR_Dest&0x1ffff);//ๅฝ“ๅ‰ๅ—่ƒฝๅ†™ๅญ—่Š‚ if(BlockByte>Byte0) { BlockByte=Byte0; } p8d=(u8*)ADDR_128KWRITE_BUFF+(ADDR_Dest&0x1ffff); for(n=0;n<BlockByte;n++) { p8d[n]=Data0; } ADDR_Dest0+=BlockByte; Byte0-=BlockByte;//ๅทฒๅ†™ๅญ—่Š‚ๆ•ฐ } RePlace_BLOCK_Write_NAND(ADDR_Dest-ADDR_EFLASH_Start);//ๆœ‰ๆ›ฟๆขๅ—ๅ†™ADDR_128KWRITE_BUFFไธญๆ•ฐๆฎๅˆฐFLASHๅ—,ๅŒๆ—ถ่ฏปๅ‡บๆฏ”่พƒ่‹ฅ้”™่ฏฏๅˆ™็”จๆ›ฟๆขๅ— ADDR_SRAM=ADDR_BKPSDRAM+6; x=0xffffffff; continue; } } ADDR_SRAM+=(p832[4]|(p832[5]<<8)|(p832[6]<<16)|(p832[7]<<24))+12; } p32=(u32*)(ADDR_BKPSDRAM); p32[0]=0x60000;//ๅˆๅง‹ไธบๆ€ปๅ—ๆ•ฐ=0,ๆ€ปๅญ—่Š‚ๆ•ฐ=6 p32[1]=0; p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); p32[0]=RAM_CRC32(ADDR_BKPSDRAM,6);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— YAFFS_FMI_SET();//nand FMIๅœจyaffsไธญ็š„้…็ฝฎ } void NW_128kBuff(u32 ADDR_Sour,u32 ADDR_Dest,u32 Byte)//ๅ†™ๅ…ฅNand FLASH็š„ๆ•ฐๆฎๅ…ˆๅˆฐ128kBuff { u32 i; u8 *p8s; u8 *p8d; u8 *p816; u8 *p832; u32* p32; u32 irq; p816=(u8*)(ADDR_BKPSDRAM); p832=(u8*)(ADDR_BKPSDRAM+2); i=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24));//ๆ€ปๅญ—่Š‚ๆ•ฐ if((i+12+Byte)>(128*1024)) {//็ผ“ๅ†ฒๅŒบไธๅคŸ NAND128kBuff_Write_NAND(ADDR_Sour,ADDR_Dest,Byte);//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } if((p816[0]|(p816[1]<<8))>=BlockMax_NandBuff) {//ๆ€ปๅ—ๆ•ฐ ๅ—ไธบไธๅŒnandๅ—ๆ—ถ64*20ms=1280ms NAND128kBuff_Write_NAND(ADDR_Sour,ADDR_Dest,Byte);//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } p832=(u8*)(ADDR_BKPSDRAM+i); p832[0]=ADDR_Dest; p832[1]=ADDR_Dest>>8; p832[2]=ADDR_Dest>>16; p832[3]=ADDR_Dest>>24; p832[4]=Byte; p832[5]=Byte>>8; p832[6]=Byte>>16; p832[7]=Byte>>24; p832[8]=0; p832[9]=0; p832[10]=0; p832[11]=0; p8s=(u8*)ADDR_Sour; p8d=(u8*)(ADDR_BKPSDRAM+i+12); for(i=0;i<Byte;i++) { p8d[i]=p8s[i]; } i=p816[0]|(p816[1]<<8); i++; p832=(u8*)(ADDR_BKPSDRAM+2); Byte+=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+12; //ๅ—ๆ•ฐๅ’Œๆ€ปๅญ—่Š‚ๆ•ฐ้œ€32ไฝไธ€่ตทๅ†™ๅ…ฅ๏ผŒ้ฟๅ…ๆމ็”ตไธญๆ–ญ็ญ‰ๅผ•่ตทไธๅŒๆญฅ! irq=off_irq();//ๅ…ณIRQไธญๆ–ญ,่ฟ”ๅ›ž:ๅ…ณ้—ญๅ‰ๅ…่ฎธ็Šถๆ€ p816[0]=i; p816[1]=i>>8; p832[0]=Byte; p832[1]=Byte>>8; p832[2]=Byte>>16; p832[3]=Byte>>24; destore_irq(irq);//ๆขๅคIRQไธญๆ–ญ,ๅ…ฅๅฃ:ๅ…ณ้—ญๅ‰ๅ…่ฎธ็Šถๆ€ if(Byte<=((128*1024)-4)) { p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(Byte>(4096-4)) { Byte=(4096-4); } p32[0]=RAM_CRC32(ADDR_BKPSDRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } void NC_128kBuff(u32 Data,u32 ADDR_Dest,u32 Byte)//ๆธ…้™คๅ†™ๅ…ฅNand FLASH็š„ๆ•ฐๆฎๅ…ˆๅˆฐ128kBuff { u32 i; u8 *p8d; u8 *p816; u8 *p832; u32* p32; u32 irq; p816=(u8*)(ADDR_BKPSDRAM); p832=(u8*)(ADDR_BKPSDRAM+2); i=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24));//ๆ€ปๅญ—่Š‚ๆ•ฐ if((i+12+Byte)>(128*1024)) {//็ผ“ๅ†ฒๅŒบไธๅคŸ NAND128kBuff_Clr_NAND(Data,ADDR_Dest,Byte);//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } if((p816[0]|(p816[1]<<8))>=BlockMax_NandBuff) {//ๆ€ปๅ—ๆ•ฐ ๅ—ไธบไธๅŒnandๅ—ๆ—ถ64*20ms=1280ms NAND128kBuff_Clr_NAND(Data,ADDR_Dest,Byte);//่ฟžๅŒ128K(BKPSDRAM)็ผ“ๅ†ฒๆ•ฐๆฎๅ†™ๅˆฐNAND FLASH return; } p832=(u8*)(ADDR_BKPSDRAM+i); p832[0]=ADDR_Dest; p832[1]=ADDR_Dest>>8; p832[2]=ADDR_Dest>>16; p832[3]=ADDR_Dest>>24; p832[4]=Byte; p832[5]=Byte>>8; p832[6]=Byte>>16; p832[7]=Byte>>24; p832[8]=0; p832[9]=0; p832[10]=0; p832[11]=0; p8d=(u8*)(ADDR_BKPSDRAM+i+12); for(i=0;i<Byte;i++) { p8d[i]=Data; } i=p816[0]|(p816[1]<<8); i++; p832=(u8*)(ADDR_BKPSDRAM+2); Byte+=(p832[0]|(p832[1]<<8)|(p832[2]<<16)|(p832[3]<<24))+12; //ๅ—ๆ•ฐๅ’Œๆ€ปๅญ—่Š‚ๆ•ฐ้œ€32ไฝไธ€่ตทๅ†™ๅ…ฅ๏ผŒ้ฟๅ…ๆމ็”ตไธญๆ–ญ็ญ‰ๅผ•่ตทไธๅŒๆญฅ! irq=off_irq();//ๅ…ณIRQไธญๆ–ญ,่ฟ”ๅ›ž:ๅ…ณ้—ญๅ‰ๅ…่ฎธ็Šถๆ€ p816[0]=i; p816[1]=i>>8; p832[0]=Byte; p832[1]=Byte>>8; p832[2]=Byte>>16; p832[3]=Byte>>24; destore_irq(irq);//ๆขๅคIRQไธญๆ–ญ,ๅ…ฅๅฃ:ๅ…ณ้—ญๅ‰ๅ…่ฎธ็Šถๆ€ if(Byte<=((128*1024)-4)) { p32=(u32*)(ADDR_BKPSDRAM+((128*1024)-4)); if(Byte>(4096-4)) { Byte=(4096-4); } p32[0]=RAM_CRC32(ADDR_BKPSDRAM,Byte);//RAMไธญๆ•ฐๆฎCRC32่ฎก็ฎ— } } #endif //1st cycle A7-A0 //2nd cycle A11-A8 //3rd cycle A19-A12 //4th cycle A27-A20 //5th cycle A28
905f58156f90aa370d6581ee27ada5fb0c0906a7
727ac22b930225eb8e1c87e4a2289ff978cb4570
/HARDWARE/keyboard.c
8b2a4a51fe1d09892115d319731c41fa255e2a97
[]
no_license
gdgly/JK525N
5374cabfd90df37f13ade646c938e0502da8ea52
f89067538622ea4ab4ddff4ed24767d8aa0c102a
refs/heads/master
2022-04-01T18:11:22.407642
2020-02-03T00:10:52
2020-02-03T00:10:52
null
0
0
null
null
null
null
GB18030
C
false
false
21,106
c
keyboard.c
#include "pbdata.h" //#include "touchscreen.h" //========================================================== //ๅ…จๅฑ€ๅ˜้‡ Key_TypeDef Keyboard;//้”ฎ็ ็ป“ๆž„ไฝ“ static u8 LastKeyVal;//ไธŠๆฌก้”ฎๅ€ผ static u8 LastKeyTicks;//ๆŒ‰้”ฎ่Š‚ๆ‹ static u8 ContinueKeyTicks;//ๆŒ็ปญๆŒ‰้”ฎ่Š‚ๆ‹ const u8 Scan_Value[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; void Key_Delay(u32 num) { while(num) { num--; } } void Key_GPIO_Config(void) { GPIO_InitTypeDef GPIO_InitStructure; // EXTI_InitTypeDef EXTI_InitStructure; RCC_AHB1PeriphClockCmd(P1_GPIO_CLK|P2_GPIO_CLK|P3_GPIO_CLK|P4_GPIO_CLK|P5_GPIO_CLK|P6_GPIO_CLK,ENABLE); /*ๅผ€ๅฏๆŒ‰้”ฎGPIOๅฃ็š„ๆ—ถ้’Ÿ*/ // /* ้…็ฝฎ NVIC */ // NVIC_Configuration(); GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P6_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P6_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ } void Keyboard_Init(void) { Key_GPIO_Config(); Keyboard.value=KEY_NONE;//้”ฎๅ€ผไธบ็ฉบ Keyboard.state=FALSE; //ๆŒ‰้”ฎๆ— ๆ•ˆ Keyboard.continuance=FALSE;//ๆŒ็ปญๆŒ‰้”ฎๆ— ๆ•ˆ LastKeyVal=KEY_NONE;//ไธŠๆฌก้”ฎๅ€ผ LastKeyTicks=0;//ๆŒ‰้”ฎ่Š‚ๆ‹ ContinueKeyTicks=0;//ๆŒ็ปญๆŒ‰้”ฎ่Š‚ๆ‹ Key_Up_flag=0; } void _164Delaay(void) { u16 i; for(i=0;i<10;i--) ; }; void HW_Sendvalueto164(u8 value) { uint8_t i; _Hc164CpL; for(i=0;i<8;i++) { if((value&0x80)==0x80) _Hc164DH; else _Hc164DL; _Hc164CpH; _164Delaay(); _Hc164CpL; value<<=1; //_164Delaay(); } } //========================================================== //ๅ‡ฝๆ•ฐๅ็งฐ๏ผšKey_Read //ๅ‡ฝๆ•ฐๅŠŸ่ƒฝ๏ผš่ฏปๅ–ๆŒ‰้”ฎ //ๅ…ฅๅฃๅ‚ๆ•ฐ๏ผšๆ—  //ๅ‡บๅฃๅ‚ๆ•ฐ๏ผšๆ—  //ๅˆ›ๅปบๆ—ฅๆœŸ๏ผš2014.09.29 //ไฟฎๆ”นๆ—ฅๆœŸ๏ผš2014.09.29 10:50 //ๅค‡ๆณจ่ฏดๆ˜Ž๏ผšๆ—  //========================================================== u8 Key_Read(void) { if (Keyboard.state) //ๆœ‰้”ฎๆŒ‰ไธ‹ { Keyboard.state=FALSE; //Beep_One(); //่œ‚้ธฃๅ™จๅ“ไธ€ๅฃฐ Key_beep(); return (Keyboard.value); } //ๅฏ็›ดๆŽฅๅค„็†็”ตๆบ็ญ‰้€š็”จๆŒ‰้”ฎ return (KEY_NONE); } //========================================================== //ๅ‡ฝๆ•ฐๅ็งฐ๏ผšKey_Read_WithTimeOut //ๅ‡ฝๆ•ฐๅŠŸ่ƒฝ๏ผš้˜ปๅกžๅผ่ฏปๅ–ๆŒ‰้”ฎ //ๅ…ฅๅฃๅ‚ๆ•ฐ๏ผšticks:็ญ‰ๅพ…่Š‚ๆ‹ๆ•ฐ(50msๅ‘จๆœŸ) //ๅ‡บๅฃๅ‚ๆ•ฐ๏ผšๆŒ‰้”ฎๅ€ผ //ๅˆ›ๅปบๆ—ฅๆœŸ๏ผš2014.09.29 //ไฟฎๆ”นๆ—ฅๆœŸ๏ผš2014.09.29 10:56 //ๅค‡ๆณจ่ฏดๆ˜Ž๏ผš็›ดๅˆฐๆŒ‰้”ฎๅ“ๅบ”ๆˆ–้™ๆ—ถๅˆฐ //========================================================== u8 Key_Read_WithTimeOut(u8 ticks) { // u8 i=1; // if (ticks)//ๅฎšๆ—ถ็ญ‰ๅพ…ๆŒ‰้”ฎ // { SetSoftTimer(KEYBOARD_SOFTTIMER,ticks);//่ฎพ็ฝฎๆŒ‰้”ฎๅปถๆ—ถๅ‘จๆœŸ(ๅณ่ฝฏๅฎšๆ—ถๅ™จ่ฎพ็ฝฎ,50msๅ‘จๆœŸ) // while ((!GetSoftTimerOut(KEYBOARD_SOFTTIMER))&&(!Keyboard.state)) //่ฎกๆ—ถๆœชๅˆฐๅนถไธ”ๆ— ๆŒ‰้”ฎๆŒ‰ไธ‹ // { //// RunOnKeyFree();//ๅœจๆŒ‰้”ฎ็ญ‰ๅพ…่ฟ‡็จ‹ไธญๅค„็†ๅ…ถไป–ไธšๅŠก // //i=GetSoftTimerOut(KEYBOARD_SOFTTIMER); // } // } // else//ๆ— ้™็ญ‰ๅพ…ๆŒ‰้”ฎ // { // while (!Keyboard.state) // { // RunOnKeyFree();//ๅœจๆŒ‰้”ฎ็ญ‰ๅพ…่ฟ‡็จ‹ไธญๅค„็†ๅ…ถไป–ไธšๅŠก // } // } return Key_Read();//ๆŒ‰้”ฎๆ›ดๆ–ฐ } //่ฏป่งฆๆ‘ธ้”ฎๅ€ผ u8 Touch_Identiry(u8 page,u8 item)//pageๆ˜ฏ่ฎพ็ฝฎ้กน itemๆ˜ฏไบŒ็บง็•Œ้ข { // u8 i; u8 touch_key=KEY_NONE; // if(page==SYS_STATUS_TEST)//ๆต‹่ฏ•็•Œ้ขFIRSTLINE+i*HIGH1 // { // for(i=0;i<6;i++) // { // if(i<3) // { // if((XCOOR>DISPX1&&XCOOR<LIST2)&&((YCOOR>(FIRSTLINE+i*HIGH1))&&(YCOOR<(FIRSTLINE+(i+1)*HIGH1)))) // return 0x70+i; // } // else // { // if((XCOOR>DISPX1&&XCOOR<LIST2)&&((YCOOR>(FIRSTLINE+(i-3)*HIGH1))&&(YCOOR<(FIRSTLINE+(i-3+1)*HIGH1)))) // return 0x70+i; // // // } // // } // // // }else if(page==SYS_STATUS_SYSSET)//็ณป็ปŸ่ฎพ็ฝฎ // { // // }else if(page==SYS_STATUS_SYS)//็ณป็ปŸไฟกๆฏ // { // // }else if(page==SYS_STATUS_SETUP)//่ฎพ็ฝฎ็•Œ้ข // { // // // } return touch_key; } //ๆ‰ซๆ้”ฎๅ€ผ u8 Key_Identiry(void) { u8 key_value; GPIO_InitTypeDef GPIO_InitStructure; GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P6_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P6_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ– ๆŒ‰้”ฎ*/ GPIO_SetBits(P1_GPIO_PORT,P1_PIN);/*P1่„š็ฝฎ้ซ˜*/ GPIO_SetBits(P2_GPIO_PORT,P2_PIN);/*P2่„š็ฝฎ้ซ˜*/ GPIO_SetBits(P3_GPIO_PORT,P3_PIN);/*P3่„š็ฝฎ้ซ˜*/ GPIO_SetBits(P4_GPIO_PORT,P4_PIN);/*P4่„š็ฝฎ้ซ˜*/ GPIO_SetBits(P5_GPIO_PORT,P5_PIN);/*P5่„š็ฝฎ้ซ˜*/ // Key_Delay(0XFFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ Key_Delay(0XFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { key_value = 22;//ESC return key_value; } } else if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { key_value = 12;//right//// return key_value; } } else if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { key_value = 17;//enter/////////// return key_value; } } else if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { key_value = 23;//left//// return key_value; } } else if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { key_value = 13;//FUNC_5 return key_value; } } } GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_SetBits(P2_GPIO_PORT,P2_PIN);/*P2่„š็ฝฎ้ซ˜*/ GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ Key_Delay(0xFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { key_value = 20;//f4////////// return key_value; } } else if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { key_value = 25;//down return key_value; } } else if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { key_value = '0';//0///////////////// return key_value; } } else if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { key_value = 14;//dot return key_value; } } else if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { key_value = 10;//BACKSPACE return key_value; } } } GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_SetBits(P3_GPIO_PORT,P3_PIN);/*P2่„š็ฝฎ้ซ˜*/ GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ Key_Delay(0XFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { key_value = 11;//FUNC_3 return key_value; } } else if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { key_value = '2';//2/////// return key_value; } } else if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { key_value = '5';//5/////// return key_value; } } else if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { key_value ='8';//8/////////////// return key_value; } } else if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { key_value = 15;//up return key_value; } } } GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_SetBits(P4_GPIO_PORT,P4_PIN);/*P2่„š็ฝฎ้ซ˜*/ GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ Key_Delay(0XFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { key_value = 16;//FUNC_2 return key_value; } } else if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { key_value = '3';//3///////////////// return key_value; } } else if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { key_value = 18;//ok//// return key_value; } } else if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P5_GPIO_PORT,P5_PIN)) { key_value = '9';//9/////////// return key_value; } } else if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { key_value = '6';//6 return key_value; } } } GPIO_InitStructure.GPIO_Pin = P5_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ‡บๆจกๅผ*/ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;/*่ฎพ็ฝฎๅผ•่„š็š„่พ“ๅ‡บ็ฑปๅž‹ไธบๆŽจๆŒฝ่พ“ๅ‡บ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; /*่ฎพ็ฝฎๅผ•่„šไธบไธŠๆ‹‰ๆจกๅผ*/ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;/*่ฎพ็ฝฎๅผ•่„š้€Ÿ็އไธบ2MHz */ GPIO_Init(P5_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_SetBits(P5_GPIO_PORT,P5_PIN);/*P2่„š็ฝฎ้ซ˜*/ GPIO_InitStructure.GPIO_Pin = P1_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;/*่ฎพ็ฝฎๅผ•่„šไธบ่พ“ๅ…ฅๆจกๅผ*/ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;/*่ฎพ็ฝฎๅผ•่„šไธ‹ๆ‹‰*/ GPIO_Init(P1_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P2_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P2_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P3_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P3_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ GPIO_InitStructure.GPIO_Pin = P4_PIN;/*้€‰ๆ‹ฉๆŒ‰้”ฎ็š„ๅผ•่„š*/ GPIO_Init(P4_GPIO_PORT, &GPIO_InitStructure);/*ไฝฟ็”จไธŠ้ข็š„็ป“ๆž„ไฝ“ๅˆๅง‹ๅŒ–ๆŒ‰้”ฎ*/ Key_Delay(0XFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P1_GPIO_PORT,P1_PIN)) { key_value = 21;//FUNC_1 return key_value; } } else if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P2_GPIO_PORT,P2_PIN)) { key_value = '1';//1////////////////// return key_value; } } else if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P3_GPIO_PORT,P3_PIN)) { key_value = 23;//left return key_value; } } else if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P4_GPIO_PORT,P4_PIN)) { key_value = '4';////////////////////// return key_value; } } else if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { // Key_Delay(0x9FFFF); if(GPIO_ReadInputDataBit(P6_GPIO_PORT,P6_PIN)) { key_value = '7';//7//////// return key_value; } } } } key_value=Touch_Identiry(GetSystemStatus(),Touch_Item);//่งฆๆ‘ธๆŒ‰้”ฎๆ‰ซๆ if(key_value!=KEY_NONE) return key_value; /// ๅŠ ไธ€ไธช้”ฎๅ€ผ่ฝฌๆข return KEY_NONE; } //========================================================== //ๅ‡ฝๆ•ฐๅ็งฐ๏ผšKey_Scan //ๅ‡ฝๆ•ฐๅŠŸ่ƒฝ๏ผšๆŒ‰้”ฎๆ‰ซๆ //ๅ…ฅๅฃๅ‚ๆ•ฐ๏ผšๆ—  //ๅ‡บๅฃๅ‚ๆ•ฐ๏ผšๆ—  //ๅˆ›ๅปบๆ—ฅๆœŸ๏ผš2014.09.28 //ไฟฎๆ”นๆ—ฅๆœŸ๏ผš2014.09.28 11:01 //ๅค‡ๆณจ่ฏดๆ˜Ž๏ผš็”ฑ10mSไธญๆ–ญ่ฐƒ็”จ //========================================================== // u8 Key_Identiry(void) //{ //// u8 key; //// key=Key_Scan(); // return Key_Scan() // // // //} void Key_Scan(void) { u8 keyval; keyval = Key_Identiry();//ๆŒ‰้”ฎ่ฏ†ๅˆซ๏ผŒ่ฟ”ๅ›ž้”ฎๅ€ผKey_Up_flag,Touch_Up_flag //Touch_Scan(); //ๆŒ‰้”ฎ้•ฟ็Ÿญ่ฏ†ๅˆซ if (keyval==KEY_NONE)//ๆ— ้”ฎ { if (LastKeyVal!=KEY_NONE) //ไธŠๆฌกๆœ‰้”ฎ๏ผŒ็ŸญๆŒ‰้”ฎๅˆคๅˆซ { if ( (LastKeyTicks>SHORTKEYCOUNT) && (LastKeyTicks<LONGKEYCOUNT) ) { Keyboard.value=LastKeyVal; //้”ฎๅ€ผ Keyboard.state=TRUE; //ๆœ‰ๆŒ‰้”ฎ } } LastKeyVal=KEY_NONE; LastKeyTicks=0; Keyboard.continuance=FALSE; //ๆŒ็ปญๆŒ‰้”ฎ } else //ๆœ‰้”ฎ { if (LastKeyVal==keyval)//ไธŠๆฌกๆŒ‰้”ฎๅ’ŒๆœฌๆฌกๆŒ‰้”ฎ็›ธๅŒ { if (LastKeyTicks<LONGKEYCOUNT+1)//้•ฟๆŒ‰้”ฎ่Š‚ๆ‹ๆ•ฐ100x10mS LastKeyTicks++; if (LastKeyTicks==LONGKEYCOUNT)//็ญ‰ไบŽ้•ฟๆŒ‰้”ฎ่Š‚ๆ‹ๆ•ฐ { ContinueKeyTicks=0;//ๆŒ็ปญๆŒ‰้”ฎ่Š‚ๆ‹ //keyval|=LONG_PRESS; //้•ฟๆŒ‰้”ฎ Keyboard.value=keyval; //้”ฎๅ€ผ Keyboard.state=TRUE; //ๆœ‰ๆŒ‰้”ฎ // Keyboard.continuance=FALSE; //ๆŒ็ปญๆŒ‰้”ฎ Keyboard.continuance=TRUE; //ๆŒ็ปญๆŒ‰้”ฎ } else if (LastKeyTicks>LONGKEYCOUNT)//ๅคงไบŽ้•ฟๆŒ‰้”ฎ่Š‚ๆ‹ๆ•ฐ { if(HW_KEYBOARD_CONTINUE_SUPPORT)//ๆŒ็ปญๆŒ‰้”ฎๆœ‰ๆ•ˆๅˆคๅˆซ { //keyval|=LONG_PRESS; //้•ฟๆŒ‰้”ฎ Keyboard.value=keyval;//้”ฎๅ€ผ // Keyboard.state=TRUE;//ๆœ‰ๆŒ‰้”ฎ Keyboard.continuance=TRUE; //ๆŒ็ปญๆŒ‰้”ฎ ContinueKeyTicks++; if(ContinueKeyTicks>CONTINUEKEYCOUNT)//ๆŒ็ปญๆŒ‰้”ฎ่Š‚ๆ‹ๆ•ฐ { ContinueKeyTicks=0;//ๆŒ็ปญๆŒ‰้”ฎ่Š‚ๆ‹ if(Keyboard.state==FALSE)//ๆŒ‰้”ฎๅทฒ่ฏปๅ– Keyboard.state=TRUE;//ๆœ‰ๆŒ‰้”ฎ } } } } else//ไธŠๆฌกๆŒ‰้”ฎๅ’ŒๆœฌๆฌกๆŒ‰้”ฎไธๅŒ { LastKeyVal=keyval; LastKeyTicks=0; } } }
12b23b65e20533c50d5e8789382904b972f51fe7
7ee9ffe15051dbca8409955c6c8fef392024a527
/src/clock/queue.c
0e69dfa78a64ccc5650e5e6cdd0c952279e0d0aa
[]
no_license
parkernewton/Page-Replacement-Algorithms
41374dd198e9fda1117b8ab76847eb5c7ba89377
f7b4b8fbaa8bf206690aa01dff9aa6bda2e8f953
refs/heads/master
2021-01-10T05:26:03.851955
2015-11-18T22:28:41
2015-11-18T22:28:41
46,451,393
0
0
null
null
null
null
UTF-8
C
false
false
2,082
c
queue.c
// // queue.c // // // Created by Parker Newton on 11/8/15. // // #include "queue.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> QUEUE* createQueue(unsigned long long size) { QUEUE *q = (QUEUE *)malloc(sizeof(QUEUE)); assert(q != NULL); q->size = size; q->count = 0; q->pHead = 0; q->elts = (NODE **)malloc(size * sizeof(NODE *)); assert(q->elts != NULL); return q; } void destroyQueue(QUEUE *q) { assert(q != NULL && q->elts != NULL); for(unsigned long long i = 0; i < q->count; i++) free(q->elts[i]); free(q->elts); free(q); } void enqueue(QUEUE *q, unsigned long long val, unsigned char ref) { assert(q != NULL && q->elts != NULL); if(!isQueueFull(q)) { NODE *pNew = (NODE *)malloc(sizeof(NODE)); assert(pNew != NULL); pNew->val = val; pNew->ref = ref; q->elts[(q->pHead + q->count++) % q->size] = pNew; } } unsigned long long dequeue(QUEUE *q) { unsigned long long val = 0; assert(q != NULL && q->elts != NULL); if(!isQueueEmpty(q)) { val = q->elts[q->pHead]->val; q->elts[q->pHead] = NULL; q->pHead = (q->pHead + 1) % q->size; q->count--; } return val; } unsigned char topReferenceBit(QUEUE *q) { assert(q != NULL && q->elts != NULL); return !isQueueEmpty(q) ? q->elts[q->pHead]->ref : 0; } unsigned char isQueueFull(QUEUE *q) { assert(q != NULL && q->elts != NULL); return q->count == q->size; } unsigned char isQueueEmpty(QUEUE *q) { assert(q != NULL && q->elts != NULL); return q->count == 0; } unsigned char findNode(QUEUE *q, unsigned long long val) { assert(q != NULL && q->elts != NULL); for(unsigned long long i = 0; i < q->count; i++) { if(q->elts[i]->val == val) return 1; } return 0; } void setReferenceBit(QUEUE *q, unsigned long long val) { assert(q != NULL && q->elts != NULL); for(unsigned long long i = 0; i < q->count; i++) { if(q->elts[i]->val == val) q->elts[i]->ref = 1; } }
a71b93ccf94c45cff0fb0da2649e6eee9f572e53
02b414889b4460daf8b407a16efa194f1ac928cc
/models/static/objects/lunchtable/model_lunchtable.c
f795d259c8855aa3413af70982c01c31c9771e3a
[]
no_license
zestydevy/birdjam
f55705bf51d5d9d5e7e0097df06d4217ba19ad45
df75b4fcac132428194a72a1f12963947b66a765
refs/heads/master
2023-03-18T21:52:17.923304
2021-03-07T00:42:09
2021-03-07T00:42:09
304,097,213
5
2
null
2020-12-12T04:10:05
2020-10-14T18:08:11
C
UTF-8
C
false
false
13,456
c
model_lunchtable.c
#include <ultra64.h> Lights1 lunchtable_metal_f3d_lights = gdSPDefLights1( 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28, 0x28, 0x28); Lights1 lunchtable_plastic_f3d_lights = gdSPDefLights1( 0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); Lights1 lunchtable_tableleg_f3d_lights = gdSPDefLights1( 0x7F, 0x7F, 0x7F, 0xFE, 0xFE, 0xFE, 0x28, 0x28, 0x28); Gfx lunchtable_tableleg_ia8_aligner[] = {gsSPEndDisplayList()}; u8 lunchtable_tableleg_ia8[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0xF, 0xF, 0xF, 0xF, 0xF, 0x0, 0x0, 0x0, 0x0, 0x0, }; Vtx lunchtable_Table_mesh_vtx_0[34] = { {{{0, 92, -213},0, {1008, 496},{0x0, 0xB2, 0x9B, 0xFF}}}, {{{0, 101, -213},0, {1008, -16},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{184, 101, -106},0, {837, -16},{0x57, 0x4D, 0xCD, 0xFF}}}, {{{184, 92, -106},0, {837, 496},{0x57, 0xB3, 0xCD, 0xFF}}}, {{{184, 101, 106},0, {667, -16},{0x57, 0x4D, 0x33, 0xFF}}}, {{{184, 92, 106},0, {667, 496},{0x57, 0xB3, 0x33, 0xFF}}}, {{{0, 101, 213},0, {496, -16},{0x0, 0x4E, 0x65, 0xFF}}}, {{{0, 92, 213},0, {496, 496},{0x0, 0xB2, 0x65, 0xFF}}}, {{{-184, 101, 106},0, {325, -16},{0xA9, 0x4D, 0x33, 0xFF}}}, {{{-184, 92, 106},0, {325, 496},{0xA9, 0xB3, 0x33, 0xFF}}}, {{{-184, 101, -106},0, {155, -16},{0xA9, 0x4D, 0xCD, 0xFF}}}, {{{-184, 92, -106},0, {155, 496},{0xA9, 0xB3, 0xCD, 0xFF}}}, {{{0, 101, -213},0, {-16, -16},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{0, 92, -213},0, {-16, 496},{0x0, 0xB2, 0x9B, 0xFF}}}, {{{0, 93, -17},0, {1008, 496},{0x0, 0x0, 0x81, 0xFF}}}, {{{0, 107, -17},0, {1008, -16},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{15, 107, -9},0, {837, -16},{0x57, 0x4D, 0xCD, 0xFF}}}, {{{15, 93, -9},0, {837, 496},{0x6E, 0x0, 0xC1, 0xFF}}}, {{{15, 107, 9},0, {667, -16},{0x57, 0x4D, 0x33, 0xFF}}}, {{{15, 93, 9},0, {667, 496},{0x6E, 0x0, 0x3F, 0xFF}}}, {{{0, 107, 17},0, {496, -16},{0x0, 0x4E, 0x65, 0xFF}}}, {{{0, 93, 17},0, {496, 496},{0x0, 0x0, 0x7F, 0xFF}}}, {{{-15, 107, 9},0, {325, -16},{0xA9, 0x4D, 0x33, 0xFF}}}, {{{-15, 93, 9},0, {325, 496},{0x92, 0x0, 0x3F, 0xFF}}}, {{{-15, 107, -9},0, {155, -16},{0xA9, 0x4D, 0xCD, 0xFF}}}, {{{-15, 93, -9},0, {155, 496},{0x92, 0x0, 0xC1, 0xFF}}}, {{{0, 107, -17},0, {-16, -16},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{0, 93, -17},0, {-16, 496},{0x0, 0x0, 0x81, 0xFF}}}, {{{15, 107, 9},0, {453, 875},{0x57, 0x4D, 0x33, 0xFF}}}, {{{15, 107, -9},0, {453, 629},{0x57, 0x4D, 0xCD, 0xFF}}}, {{{0, 107, -17},0, {240, 506},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{-15, 107, 9},0, {27, 875},{0xA9, 0x4D, 0x33, 0xFF}}}, {{{-15, 107, -9},0, {27, 629},{0xA9, 0x4D, 0xCD, 0xFF}}}, {{{0, 107, 17},0, {240, 998},{0x0, 0x4E, 0x65, 0xFF}}}, }; Gfx lunchtable_Table_mesh_tri_0[] = { gsSPVertex(lunchtable_Table_mesh_vtx_0 + 0, 14, 0), gsSP1Triangle(0, 1, 2, 0), gsSP1Triangle(0, 2, 3, 0), gsSP1Triangle(3, 2, 4, 0), gsSP1Triangle(3, 4, 5, 0), gsSP1Triangle(5, 4, 6, 0), gsSP1Triangle(5, 6, 7, 0), gsSP1Triangle(7, 6, 8, 0), gsSP1Triangle(7, 8, 9, 0), gsSP1Triangle(9, 8, 10, 0), gsSP1Triangle(9, 10, 11, 0), gsSP1Triangle(11, 10, 12, 0), gsSP1Triangle(11, 12, 13, 0), gsSPVertex(lunchtable_Table_mesh_vtx_0 + 14, 14, 0), gsSP1Triangle(0, 1, 2, 0), gsSP1Triangle(0, 2, 3, 0), gsSP1Triangle(3, 2, 4, 0), gsSP1Triangle(3, 4, 5, 0), gsSP1Triangle(5, 4, 6, 0), gsSP1Triangle(5, 6, 7, 0), gsSP1Triangle(7, 6, 8, 0), gsSP1Triangle(7, 8, 9, 0), gsSP1Triangle(9, 8, 10, 0), gsSP1Triangle(9, 10, 11, 0), gsSP1Triangle(11, 10, 12, 0), gsSP1Triangle(11, 12, 13, 0), gsSPVertex(lunchtable_Table_mesh_vtx_0 + 28, 6, 0), gsSP1Triangle(0, 1, 2, 0), gsSP1Triangle(2, 3, 0, 0), gsSP1Triangle(2, 4, 3, 0), gsSP1Triangle(3, 5, 0, 0), gsSPEndDisplayList(), };Vtx lunchtable_Table_mesh_vtx_1[12] = { {{{184, 101, 106},0, {453, 875},{0x57, 0x4D, 0x33, 0xFF}}}, {{{184, 101, -106},0, {453, 629},{0x57, 0x4D, 0xCD, 0xFF}}}, {{{0, 101, -213},0, {240, 506},{0x0, 0x4E, 0x9B, 0xFF}}}, {{{-184, 101, 106},0, {27, 875},{0xA9, 0x4D, 0x33, 0xFF}}}, {{{-184, 101, -106},0, {27, 629},{0xA9, 0x4D, 0xCD, 0xFF}}}, {{{0, 101, 213},0, {240, 998},{0x0, 0x4E, 0x65, 0xFF}}}, {{{-184, 92, -106},0, {539, 629},{0xA9, 0xB3, 0xCD, 0xFF}}}, {{{0, 92, -213},0, {752, 506},{0x0, 0xB2, 0x9B, 0xFF}}}, {{{184, 92, -106},0, {965, 629},{0x57, 0xB3, 0xCD, 0xFF}}}, {{{0, 92, 213},0, {752, 998},{0x0, 0xB2, 0x65, 0xFF}}}, {{{184, 92, 106},0, {965, 875},{0x57, 0xB3, 0x33, 0xFF}}}, {{{-184, 92, 106},0, {539, 875},{0xA9, 0xB3, 0x33, 0xFF}}}, }; Gfx lunchtable_Table_mesh_tri_1[] = { gsSPVertex(lunchtable_Table_mesh_vtx_1 + 0, 12, 0), gsSP1Triangle(0, 1, 2, 0), gsSP1Triangle(2, 3, 0, 0), gsSP1Triangle(2, 4, 3, 0), gsSP1Triangle(3, 5, 0, 0), gsSP1Triangle(6, 7, 8, 0), gsSP1Triangle(8, 9, 6, 0), gsSP1Triangle(8, 10, 9, 0), gsSP1Triangle(9, 11, 6, 0), gsSPEndDisplayList(), };Vtx lunchtable_Table_mesh_vtx_2[16] = { {{{-67, -115, 2},0, {1008, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, {{{67, -115, 2},0, {-16, 1008},{0x0, 0x0, 0x7F, 0xFF}}}, {{{67, 89, 2},0, {-16, -16},{0x0, 0x0, 0x7F, 0xFF}}}, {{{-67, 89, 2},0, {1008, -16},{0x0, 0x0, 0x7F, 0xFF}}}, {{{-67, -115, -2},0, {1008, 1008},{0x0, 0x0, 0x81, 0xFF}}}, {{{-67, 89, -2},0, {1008, -16},{0x0, 0x0, 0x81, 0xFF}}}, {{{67, 89, -2},0, {-16, -16},{0x0, 0x0, 0x81, 0xFF}}}, {{{67, -115, -2},0, {-16, 1008},{0x0, 0x0, 0x81, 0xFF}}}, {{{2, -115, 67},0, {1008, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, {{{2, -115, -67},0, {-16, 1008},{0x7F, 0x0, 0x0, 0xFF}}}, {{{2, 89, -67},0, {-16, -16},{0x7F, 0x0, 0x0, 0xFF}}}, {{{2, 89, 67},0, {1008, -16},{0x7F, 0x0, 0x0, 0xFF}}}, {{{-2, -115, 67},0, {1008, 1008},{0x81, 0x0, 0x0, 0xFF}}}, {{{-2, 89, 67},0, {1008, -16},{0x81, 0x0, 0x0, 0xFF}}}, {{{-2, 89, -67},0, {-16, -16},{0x81, 0x0, 0x0, 0xFF}}}, {{{-2, -115, -67},0, {-16, 1008},{0x81, 0x0, 0x0, 0xFF}}}, }; Gfx lunchtable_Table_mesh_tri_2[] = { gsSPVertex(lunchtable_Table_mesh_vtx_2 + 0, 16, 0), gsSP1Triangle(0, 1, 2, 0), gsSP1Triangle(0, 2, 3, 0), gsSP1Triangle(4, 5, 6, 0), gsSP1Triangle(4, 6, 7, 0), gsSP1Triangle(8, 9, 10, 0), gsSP1Triangle(8, 10, 11, 0), gsSP1Triangle(12, 13, 14, 0), gsSP1Triangle(12, 14, 15, 0), gsSPEndDisplayList(), }; Gfx mat_lunchtable_metal_f3d[] = { gsDPPipeSync(), gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), gsSPTexture(65535, 65535, 0, 0, 1), gsSPSetLights1(lunchtable_metal_f3d_lights), gsSPEndDisplayList(), }; Gfx mat_lunchtable_plastic_f3d[] = { gsDPPipeSync(), gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), gsSPTexture(65535, 65535, 0, 0, 1), gsSPSetLights1(lunchtable_plastic_f3d_lights), gsSPEndDisplayList(), }; Gfx mat_lunchtable_tableleg_f3d[] = { gsDPPipeSync(), gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, SHADE, 0, TEXEL0, 0, ENVIRONMENT, 0), //gsSPClearGeometryMode(G_CULL_BACK), gsSPTexture(65535, 65535, 0, 0, 1), gsDPTileSync(), gsDPSetTextureImage(G_IM_FMT_IA, G_IM_SIZ_8b, 32, lunchtable_tableleg_ia8), gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), gsDPLoadSync(), gsDPLoadTile(7, 0, 0, 124, 124), gsDPPipeSync(), gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0, G_TX_WRAP | G_TX_NOMIRROR, 5, 0), gsDPSetTileSize(0, 0, 0, 124, 124), gsSPSetLights1(lunchtable_tableleg_f3d_lights), gsSPEndDisplayList(), }; Gfx mat_revert_lunchtable_tableleg_f3d[] = { gsDPPipeSync(), gsSPSetGeometryMode(G_CULL_BACK), gsSPEndDisplayList(), }; Gfx lunchtable_Table_mesh[] = { gsSPDisplayList(mat_lunchtable_metal_f3d), gsSPDisplayList(lunchtable_Table_mesh_tri_0), gsSPDisplayList(mat_lunchtable_plastic_f3d), gsSPDisplayList(lunchtable_Table_mesh_tri_1), gsDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_AA_ZB_TEX_EDGE2), gsSPDisplayList(mat_lunchtable_tableleg_f3d), gsSPDisplayList(lunchtable_Table_mesh_tri_2), gsSPDisplayList(mat_revert_lunchtable_tableleg_f3d), gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), gsDPPipeSync(), gsSPSetGeometryMode(G_LIGHTING), gsSPClearGeometryMode(G_TEXTURE_GEN), gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT, 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT), gsSPTexture(65535, 65535, 0, 0, 0), gsSPEndDisplayList(), };
31c32eafbe03ba44a7828a0dff4550ad1ecaff6c
a8e3dabe3221b4e26f02961bf3f446b29700b212
/TCP_socket/server.c
3150843bd3ad7557af08991b5a3a63b34b047400
[]
no_license
TungYu/TCPIP_pratice
b52c22ef68e00994251562b18da7ed651a5fe2c4
c909a1b44ce9bb7a442d4ef3e2353088bca13fb9
refs/heads/master
2021-01-21T04:40:26.046604
2016-06-20T09:13:35
2016-06-20T09:13:35
54,955,286
0
1
null
null
null
null
UTF-8
C
false
false
1,486
c
server.c
#include <stdio.h> #include <stdlib.h> #include <string.h> //for bzero() #include <unistd.h> //for close() #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define PortNumber 5555 #define Packet_Num 20 int main(int argc, char *argv[]) { struct sockaddr_in server_addr,client_addr; int sock, byte_recv, server_addr_length = sizeof(server_addr), client_addr_length=sizeof(client_addr), recfd; char buffer[50]; int i = 0; sock = socket(PF_INET, SOCK_STREAM, 0); if (sock < 0) printf("Error creating socket\n"); bzero(&server_addr, server_addr_length); server_addr.sin_family = AF_INET; server_addr.sin_port = htons(PortNumber); server_addr.sin_addr.s_addr = INADDR_ANY; /*#define INADDR_ANY ((unsigned long int) 0x00000000) INADDR_ANY allows the server to accept a client connection on any interface, in case the server host has multiple interfaces.*/ if (bind(sock,(struct sockaddr *)&server_addr, server_addr_length) == -1) { printf("error binding!\n"); close(sock);} if (listen(sock, 20) == -1) { printf("listen failed!\n"); close(sock);} if((recfd = accept(sock,(struct sockaddr *)&client_addr,&client_addr_length))==-1) { printf("accept failed!\n"); close(sock); } else { for (i=0;i<Packet_Num;i++) { byte_recv = recv(recfd, buffer, sizeof(buffer),0); if (byte_recv < 0) printf("Error recving packet\n"); else printf("data: %s\n",buffer); } } close(sock); }
c9f7a533c73343b76171ae55d76e3122df0ce9b8
5c3d1f90985a6e9f71b4c07c8c12736d9629529f
/src/pro_document.c
a0c1aa4e409aa1c6d513c7f88ba008d4ddf63990
[]
no_license
hackerlank/documents_hens
9539648232058b5ea2fce0610ff0dd16c053353f
0caf53a63e30ea2fc7e46ca8def35bbe9f629220
refs/heads/master
2021-01-13T14:40:17.797367
2011-11-26T06:56:43
2011-11-26T06:56:43
null
0
0
null
null
null
null
UTF-8
C
false
false
692
c
pro_document.c
#include <stdio.h> #include <stdlib.h> #include <string.h> int pro_document_manager(const char *path, char ch) { char buf[256]; memset(buf, 0, 256); if(ch == 'f') { sprintf(buf, "touch %sๅฏ่กŒๆ€งๅˆ†ๆž.odt %s้œ€ๆฑ‚ๅˆ†ๆž.odt %sๆฆ‚่ฆ่ฎพ่ฎก.odt %s่ฏฆ็ป†่ฎพ่ฎก.odt %sๆต‹่ฏ•่ฎกๅˆ’ๅŠ็ป“ๆžœ.odt %sไฝฟ็”จๆ‰‹ๅ†Œ.odt", path, path, path, path, path, path); return system(buf); } else if(ch == 'u') { sprintf(buf, "rm %sๅฏ่กŒๆ€งๅˆ†ๆž.odt %s้œ€ๆฑ‚ๅˆ†ๆž.odt %sๆฆ‚่ฆ่ฎพ่ฎก.odt %s่ฏฆ็ป†่ฎพ่ฎก.odt %sๆต‹่ฏ•่ฎกๅˆ’ๅŠ็ป“ๆžœ.odt %sไฝฟ็”จๆ‰‹ๅ†Œ.odt", path, path, path, path, path, path); return system(buf); } return 0; }
fcdcbedd85dcd8339289eaa67c0a04ca83b886eb
a953e57eb65d231aee259fab9cdf8e69ae6482e9
/array1.c
9181881adc63bc78154ff4fd756ae9863d515720
[]
no_license
adityasunny1189/C-programming-codes
bb3ffd5db2b0169eed7e12f7566fc5be69927052
4f3d65eeaa7be49b0ac3aa296ec314c9f5aedd11
refs/heads/master
2020-06-12T15:06:42.307403
2019-08-29T17:28:38
2019-08-29T17:28:38
194,340,537
1
0
null
null
null
null
UTF-8
C
false
false
744
c
array1.c
#include<stdio.h> int main() { int a[100],n,i,s; printf("enter the no of elements you want in the given array\n"); scanf("%d",&n); printf("write the desired elements\n"); for (i=0;i<n;i++) { printf("the %d element is : ",i+1); scanf("%d",&a[i]); } printf("the given array is : "); printf("{ "); for (i=0;i<n;i++) { printf("%d ",a[i]); } printf("}\n"); printf("the element you want to search is : "); scanf("%d",&s); //LINEAR SEARCH for (i=0;i<n;i++) { if (a[i]==s) { printf("element found at position %d",i+1); exit (0); } } //END OF LINEAR SEARCH LOGIC printf("element not found"); }
b8c027db0368039232bff3aeaf54373176ea7c7a
d186513444c448660ab8829bab2ee4aea473f225
/code/visualstudio/vs2005/Visual Studio 2005/Projects/base/base/Include/Mp3Lib.h
606c8de4e039145f2934969cd77ed3932d9c1262
[]
no_license
pkxpp/Study
bc4844bda1bd1113deb68ba3a616cf28d94afeff
88498ba5dcd8e0b4b843766eebbc60f0f62e287a
refs/heads/master
2023-03-02T04:33:45.527441
2023-02-08T09:27:57
2023-02-08T09:27:57
19,522,370
6
5
null
2020-10-16T18:59:38
2014-05-07T05:26:18
C
UTF-8
C
false
false
2,198
h
Mp3Lib.h
//--------------------------------------------------------------------------- // Sword3 Engine (c) 1999-2000 by Kingsoft // // File: Mp3lib.h // Desc: MP3 Decoder //--------------------------------------------------------------------------- #ifndef Mp3lib_H #define Mp3lib_H //--------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif //--------------------------------------------------------------------------- // mpeg audio header typedef struct { int sync; // 0xFFF=mpeg1.0 & 2.0 0xFFE=mpeg2.5 int ver; // 1=mpeg1.0 0=mpeg2.0 int layer; // 1=LayerIII 2=LayerII 3=LayerI int prot; // error protection 0=yes, 1=no int br_index; // bitrate index int sr_index; // sampling rate int pad; // padding int extension; // extension int mode; // 0=stereo 1=joint stereo 2=dual channel 3=single channel int mode_ext; // 0=MPG_MD_LR_LR 1=MPG_MD_LR_I 2=MPG_MD_MS_LR 3=MPG_MD_MS_I int copyright; // 0=no 1=yes int original; // 0=no 1=yes int emphasis; // 0=none 1=50/15 microsecs 2=reserved 3=CCITT J 17 } MPEG_HEAD; //--------------------------------------------------------------------------- // mp3 decode info typedef struct { int channels; // channels = 1,2 int outvalues; // out value int samprate; // sample rate int bits; // bits per sample = 8,16,24,32 int framebytes; // frame size in bytes } DEC_INFO; //--------------------------------------------------------------------------- // portable mpeg audio decoder, decoder functions typedef struct { int in_bytes; int out_bytes; } IN_OUT; //--------------------------------------------------------------------------- int mp3_decode_head(unsigned char *buf, MPEG_HEAD* head); int mp3_decode_init(MPEG_HEAD *head, int framebytes_arg, int reduction_code, int transform_code, int convert_code, int freq_limit); void mp3_decode_info(DEC_INFO *info); IN_OUT mp3_decode_frame(unsigned char *mp3, unsigned char *pcm); //--------------------------------------------------------------------------- #ifdef __cplusplus } #endif //--------------------------------------------------------------------------- #endif // Mp3lib_H
4834ee6b6c9da8c8d94cde325e68ed59f7f02c58
1c3dbc033229e622642a6acc1d7dcfae94f51cba
/LAB-I/PILHA/pilha.h
75bec1a6245dd3f894a2fae2c3589b8e310b4927
[]
no_license
nathaliafialho/unipampa-disc
5fe3c965c855df40bfde09479cfa672899c1beae
8cb08d7ab12a4b5cc817c7cfbba8c06b3574a252
refs/heads/master
2023-08-20T11:17:50.565006
2021-09-08T03:43:55
2021-09-08T03:43:55
374,699,840
0
0
null
null
null
null
UTF-8
C
false
false
270
h
pilha.h
#include <stdio.h> #include <stdlib.h> typedef struct info { char nome[50]; float nota; struct info *prox; } elem; typedef struct pilha { elem *topo; }tpilha; void inicializa(tpilha *p); void push(tpilha *p); void pop(tpilha *p); void mostra_pilha(tpilha *p);
fbadc7ea583bd1c8de3f0d0faf0fa15663de328f
813028300811cf135f96e302eb4de86f1f5e5eb1
/linux/home/radar/ros.3.6/doc/html/base/src.lib/task/convert/src/ConvertFwriteInt.c
204d4dd1f89854778314f331807dd169b0635512
[ "MIT" ]
permissive
UAF-SuperDARN-OPS/SuperDARN_MSI_ROS
228b864fe2b69c6bbbfad3a7df968168ebca1498
c6c3ae2fccd4694a9c8e6047e9df5febcb3c391b
refs/heads/master
2022-11-22T07:58:52.415306
2013-07-30T06:29:50
2013-07-30T06:29:50
39,792,221
1
3
MIT
2022-11-17T18:45:31
2015-07-27T18:58:01
C
UTF-8
C
false
false
384
c
ConvertFwriteInt.c
/* ConvertFwriteInt.c ================== Author: R.J.Barnes */ #include <stdio.h> #include <stdlib.h> #include "rtypes.h" #include "rconvert.h" #define FNAME "test.dat" int main(int argc,char *argv[]) { int i; int32 val[8]={2,4,4,-5,6,3,10,-8}; FILE *fp; fp=fopen(FNAME,"w"); for (i=0;i<8;i++) ConvertFwriteInt(fp,val[i]); fclose(fp); return 0; }
f3fe51029d61feb9950186a0ea741db2f333e856
3243039d0f10935581a8cac5db5a60971f8c28b8
/fabric_management/librio/test/rio_standard_test.c
321b4653325e1dc06870415777fa08a38cfc0267
[ "BSD-3-Clause" ]
permissive
RapidIO/rapidio_sw
9a7c7e6f37edd0beaa51223f18cd61ed2832f9d5
2d862bc1725c95228d1b43f6d32c2e01cd704890
refs/heads/master
2023-05-10T00:36:14.243626
2019-03-08T05:01:42
2019-03-08T05:01:42
36,737,050
0
0
null
null
null
null
UTF-8
C
false
false
22,359
c
rio_standard_test.c
/* ************************************************************************ Copyright (c) 2017, Integrated Device Technology Inc. Copyright (c) 2017, RapidIO Trade Association All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this l of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this l of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ************************************************************************* */ #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <stdarg.h> #include <setjmp.h> #include "cmocka.h" #include "rio_standard.h" #include "did.h" #ifdef __cplusplus extern "C" { #endif static void assumptions(void **state) { assert_int_equal(sizeof(RIO_PE_FEAT_T), sizeof(uint32_t)); assert_int_equal(sizeof(RIO_PE_ADDR_T), sizeof(uint32_t)); assert_int_equal(PE_IS_SW(RIO_PE_FEAT_SW), 0x10000000); assert_int_equal(PE_IS_PROC(RIO_PE_FEAT_PROC), 0x20000000); assert_int_equal(PE_IS_MEM(RIO_PE_FEAT_MEM), 0x40000000); assert_int_equal(PE_IS_BRIDGE(RIO_PE_FEAT_BRDG), 0x80000000); assert_int_equal(RIO_EFB_T_SP_EP, 0x01); assert_int_equal(RIO_EFB_T_SP_EP_SAER, 0x02); assert_int_equal(RIO_EFB_T_SP_NOEP, 0x03); assert_int_equal(RIO_EFB_T_SP_NOEP_SAER, 0x09); assert_int_equal(RIO_EFB_T_SP_EP3, 0x11); assert_int_equal(RIO_EFB_T_SP_EP3_SAER, 0x12); assert_int_equal(RIO_EFB_T_SP_NOEP3, 0x13); assert_int_equal(RIO_EFB_T_SP_NOEP3_SAER, 0x19); assert_int_equal(RIO_EFB_T_EMHS, 0x07); assert_int_equal(RIO_EFB_T_HS, 0x17); assert_int_equal(RIO_EFB_T_VC, 0x0A); assert_int_equal(RIO_EFB_T_VOQ, 0x0B); assert_int_equal(RIO_EFB_T_LANE, 0x0D); assert_int_equal(RIO_EFB_T_RT, 0x0E); assert_int_equal(RIO_EFB_T_TS, 0x0F); assert_int_equal(RIO_EFB_T_MISC, 0x10); assert_int_equal(0x08000000, RIO_SPX_ERR_STAT_TXFC); assert_int_equal(0x00001000, RIO_SPX_CTL2_GB_12P5_EN); assert_int_equal(0x00002000, RIO_SPX_CTL2_GB_12P5); assert_int_equal(0x00004000, RIO_SPX_CTL2_GB_10P3_EN); assert_int_equal(0x00008000, RIO_SPX_CTL2_GB_10P3); assert_int_equal(0x00010000, RIO_SPX_CTL2_GB_6P25_EN); assert_int_equal(0x00020000, RIO_SPX_CTL2_GB_6P25); assert_int_equal(0x00040000, RIO_SPX_CTL2_GB_5P0_EN); assert_int_equal(0x00080000, RIO_SPX_CTL2_GB_5P0); assert_int_equal(0x00100000, RIO_SPX_CTL2_GB_3P125_EN); assert_int_equal(0x00200000, RIO_SPX_CTL2_GB_3P125); assert_int_equal(0x00400000, RIO_SPX_CTL2_GB_2P5_EN); assert_int_equal(0x00800000, RIO_SPX_CTL2_GB_2P5); assert_int_equal(0x01000000, RIO_SPX_CTL2_GB_1P25_EN); assert_int_equal(0x02000000, RIO_SPX_CTL2_GB_1P25); assert_int_equal(0x02000000, RIO_SPX_CTL2_GB_1P25); assert_int_equal(0x07000000, RIO_SPX_CTL_PTW_OVER); assert_int_equal(0x38000000, RIO_SPX_CTL_PTW_INIT); assert_int_equal(0xc0000000, RIO_SPX_CTL_PTW_MAX); assert_int_equal(0x00000000, RIO_SPX_CTL_PTW_INIT_1X_L0); assert_int_equal(0x08000000, RIO_SPX_CTL_PTW_INIT_1X_LR); assert_int_equal(0x10000000, RIO_SPX_CTL_PTW_INIT_4X); assert_int_equal(0x18000000, RIO_SPX_CTL_PTW_INIT_2X); assert_int_equal(0x00000000, RIO_SPX_CTL_PTW_OVER_NONE); assert_int_equal(0x01000000, RIO_SPX_CTL_PTW_OVER_RSVD); assert_int_equal(0x02000000, RIO_SPX_CTL_PTW_OVER_1X_L0); assert_int_equal(0x03000000, RIO_SPX_CTL_PTW_OVER_1X_LR); assert_int_equal(0x04000000, RIO_SPX_CTL_PTW_OVER_IMP_SPEC); assert_int_equal(0x05000000, RIO_SPX_CTL_PTW_OVER_2X_NO_4X); assert_int_equal(0x06000000, RIO_SPX_CTL_PTW_OVER_4X_NO_2X); assert_int_equal(0x07000000, RIO_SPX_CTL_PTW_OVER_NONE_2); assert_int_equal(0x80000000, RIO_SPX_CTL_PTW_MAX_2X); assert_int_equal(0x40000000, RIO_SPX_CTL_PTW_MAX_4X); assert_int_equal(3000000000, THREE_SECS_IN_NSECS); assert_int_equal(6000000000, SIX_SECS_IN_NSECS); assert_int_equal(0x00FFFFFF, RIO_SP_LT_CTL_TVAL_MAX); assert_int_equal(3000000000/0xFFFFFF, RIO_SP_LT_CTL_MIN_GRAN); assert_int_equal(6000000000/0xFFFFFF, RIO_SP_LT_CTL_MAX_GRAN); assert_int_equal(0x00FFFFFF, RIO_SP_RTO_CTL_TVAL_MAX); assert_int_equal(3000000000/0xFFFFFF, RIO_SP_RTO_CTL_MIN_GRAN); assert_int_equal(6000000000/0xFFFFFF, RIO_SP_RTO_CTL_MAX_GRAN); assert_int_equal(RIO_SPX_LM_REQ_CMD_RST_PT, 0x2); assert_int_equal(RIO_SPX_LM_REQ_CMD_RST_DEV, 0x3); assert_int_equal(RIO_SPX_LM_REQ_CMD_LR_IS, 0x4); assert_int_equal(sizeof(RIO_SW_PORT_INF_T), sizeof(uint32_t)); assert_int_equal(sizeof(RIO_SRC_OPS_T), sizeof(uint32_t)); assert_int_equal(sizeof(RIO_DST_OPS_T), sizeof(uint32_t)); assert_int_equal(sizeof(pe_rt_val), sizeof(uint32_t)); assert_int_equal(sizeof(RIO_SPX_LM_RESP_STAT_T), sizeof(uint32_t)); assert_int_equal(sizeof(RIO_SPX_ERR_STAT_T), sizeof(uint32_t)); (void)state; // unused } static void macros(void **state) { assert_int_equal(RIO_ACCESS_PORT(0x9911), 0x11); assert_int_equal(RIO_AVAIL_PORTS(0x9911), 0x99); assert_true(RIO_PORT_IS_VALID(0x00, 0x9911)); assert_true(RIO_PORT_IS_VALID(0x10, 0x9911)); assert_true(RIO_PORT_IS_VALID(0x98, 0x9911)); assert_false(RIO_PORT_IS_VALID(0x99, 0x9911)); assert_int_equal(RIO_LCS_ADDR34(0x12345678, 0x71111111), 0x388888888); assert_int_equal(RIO_LCS_ADDR50(0x12347111, 0x11111111), 0x3888888888888); assert_int_equal(RIO_LCS_ADDR66M(0x60000000), 0x3); assert_int_equal(RIO_LCS_ADDR66L(0xF1111111, 0x11111111), 0x8888888888888888); assert_int_equal(GET_DEV8_FROM_HW(0x00FF0000), 0xFF); assert_int_equal(GET_DEV16_FROM_HW(0x0000FFFF), 0xFFFF); assert_int_equal(MAKE_HW_FROM_DEV8(0x000000FF), 0x00FF0000); assert_int_equal(MAKE_HW_FROM_DEV16(0x0000FFFF), 0x0000FFFF); assert_int_equal(MAKE_HW_FROM_DEV8N16(0x12, 0x00003456), 0x00123456); assert_int_equal(RIO_RTE_VAL, 0x3FF); assert_true(RIO_RTV_IS_PORT(RIO_RTE_PT_0)); assert_true(RIO_RTV_IS_PORT(RIO_RTE_PT_LAST)); assert_false(RIO_RTV_IS_PORT(RIO_RTE_PT_0 - 1)); assert_false(RIO_RTV_IS_PORT(RIO_RTE_PT_LAST + 1)); assert_true(RIO_RTV_IS_MC_MSK(RIO_RTE_MC_0)); assert_true(RIO_RTV_IS_MC_MSK(RIO_RTE_MC_LAST)); assert_false(RIO_RTV_IS_MC_MSK(RIO_RTE_MC_0 - 1)); assert_false(RIO_RTV_IS_MC_MSK(RIO_RTE_MC_LAST + 1)); assert_true(RIO_RTV_IS_LVL_GRP(RIO_RTE_LVL_G0)); assert_true(RIO_RTV_IS_LVL_GRP(RIO_RTE_LVL_GLAST)); assert_false(RIO_RTV_IS_LVL_GRP(RIO_RTE_LVL_G0 - 1)); assert_false(RIO_RTV_IS_LVL_GRP(RIO_RTE_LVL_GLAST + 1)); assert_int_equal(RIO_RTV_PORT(0), RIO_RTE_PT_0); assert_int_equal(RIO_RTV_PORT(0xFF), RIO_RTE_PT_LAST); assert_int_equal(RIO_RTV_PORT(0x100), 0x0FFFFFFF); assert_int_equal(RIO_RTV_PORT(0x100), RIO_RTE_BAD); assert_int_equal(RIO_RTV_MC_MSK(0), RIO_RTE_MC_0); assert_int_equal(RIO_RTV_MC_MSK(0xFF), RIO_RTE_MC_LAST); assert_int_equal(RIO_RTV_MC_MSK(0x100), 0x0FFFFFFF); assert_int_equal(RIO_RTV_MC_MSK(0x100), RIO_RTE_BAD); assert_int_equal(RIO_RTV_LVL_GRP(0), RIO_RTE_LVL_G0); assert_int_equal(RIO_RTV_LVL_GRP(0xFF), RIO_RTE_LVL_GLAST); assert_int_equal(RIO_RTV_LVL_GRP(0x100), 0x0FFFFFFF); assert_int_equal(RIO_RTV_LVL_GRP(0x100), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_PORT(RIO_RTE_PT_0), 0); assert_int_equal(RIO_RTV_GET_PORT(RIO_RTE_PT_LAST), 0xFF); assert_int_equal(RIO_RTV_GET_PORT(RIO_RTE_PT_0 - 1), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_PORT(RIO_RTE_PT_LAST + 1), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_MC_MSK(RIO_RTE_MC_0), 0); assert_int_equal(RIO_RTV_GET_MC_MSK(RIO_RTE_MC_LAST), 0xFF); assert_int_equal(RIO_RTV_GET_MC_MSK(RIO_RTE_MC_0 - 1), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_MC_MSK(RIO_RTE_MC_LAST + 1), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_LVL_GRP(RIO_RTE_LVL_G0), 0); assert_int_equal(RIO_RTV_GET_LVL_GRP(RIO_RTE_LVL_GLAST), 0xFF); assert_int_equal(RIO_RTV_GET_LVL_GRP(RIO_RTE_LVL_G0 - 1), RIO_RTE_BAD); assert_int_equal(RIO_RTV_GET_LVL_GRP(RIO_RTE_LVL_GLAST + 1), RIO_RTE_BAD); assert_true(RIO_SP3_VLD(RIO_EFB_T_SP_EP3)); assert_true(RIO_SP3_VLD(RIO_EFB_T_SP_EP3_SAER)); assert_true(RIO_SP3_VLD(RIO_EFB_T_SP_NOEP3)); assert_true(RIO_SP3_VLD(RIO_EFB_T_SP_NOEP3_SAER)); assert_false(RIO_SP3_VLD(RIO_EFB_T_SP_EP)); assert_false(RIO_SP3_VLD(RIO_EFB_T_SP_EP_SAER)); assert_false(RIO_SP3_VLD(RIO_EFB_T_SP_NOEP)); assert_false(RIO_SP3_VLD(RIO_EFB_T_SP_NOEP_SAER)); assert_false(RIO_SP3_VLD(RIO_EFB_T_EMHS)); assert_false(RIO_SP3_VLD(RIO_EFB_T_HS)); assert_false(RIO_SP3_VLD(RIO_EFB_T_VC)); assert_false(RIO_SP3_VLD(RIO_EFB_T_VOQ)); assert_false(RIO_SP3_VLD(RIO_EFB_T_LANE)); assert_false(RIO_SP3_VLD(RIO_EFB_T_RT)); assert_false(RIO_SP3_VLD(RIO_EFB_T_TS)); assert_false(RIO_SP3_VLD(RIO_EFB_T_MISC)); assert_int_equal(RIO_EFB_GET_NEXT(0xFFFF0000), 0xFFFF); assert_int_equal(RIO_EFB_GET_NEXT(0x0000FFFF), 0x0000); assert_int_equal(RIO_EFB_ID(0xFFFF0000), 0x0000); assert_int_equal(RIO_EFB_ID(0x0000FFFF), 0xFFFF); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_EP3), 0x40); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_EP3_SAER), 0x40); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_NOEP3), 0x40); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_NOEP3_SAER), 0x40); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_EP), 0x20); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_EP_SAER), 0x20); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_NOEP), 0x20); assert_int_equal(RIO_SP_STEP(RIO_EFB_T_SP_NOEP_SAER), 0x20); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_EP3)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_EP3_SAER)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_NOEP3)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_NOEP3_SAER)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_EP)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_EP_SAER)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_NOEP)); assert_true(RIO_SP_VLD(RIO_EFB_T_SP_NOEP_SAER)); assert_false(RIO_SP_VLD(RIO_EFB_T_EMHS)); assert_false(RIO_SP_VLD(RIO_EFB_T_HS)); assert_false(RIO_SP_VLD(RIO_EFB_T_VC)); assert_false(RIO_SP_VLD(RIO_EFB_T_VOQ)); assert_false(RIO_SP_VLD(RIO_EFB_T_LANE)); assert_false(RIO_SP_VLD(RIO_EFB_T_RT)); assert_false(RIO_SP_VLD(RIO_EFB_T_TS)); assert_false(RIO_SP_VLD(RIO_EFB_T_MISC)); assert_true(RIO_SP_SAER(RIO_EFB_T_SP_EP_SAER)); assert_true(RIO_SP_SAER(RIO_EFB_T_SP_NOEP_SAER)); assert_true(RIO_SP_SAER(RIO_EFB_T_SP_EP3_SAER)); assert_true(RIO_SP_SAER(RIO_EFB_T_SP_NOEP3_SAER)); assert_false(RIO_SP_SAER(RIO_EFB_T_SP_EP)); assert_false(RIO_SP_SAER(RIO_EFB_T_SP_NOEP)); assert_false(RIO_SP_SAER(RIO_EFB_T_SP_EP3)); assert_false(RIO_SP_SAER(RIO_EFB_T_SP_NOEP3)); assert_false(RIO_SP_SAER(RIO_EFB_T_EMHS)); assert_false(RIO_SP_SAER(RIO_EFB_T_HS)); assert_false(RIO_SP_SAER(RIO_EFB_T_VC)); assert_false(RIO_SP_SAER(RIO_EFB_T_VOQ)); assert_false(RIO_SP_SAER(RIO_EFB_T_LANE)); assert_false(RIO_SP_SAER(RIO_EFB_T_RT)); assert_false(RIO_SP_SAER(RIO_EFB_T_TS)); assert_false(RIO_SP_SAER(RIO_EFB_T_MISC)); assert_int_equal(RIO_SP_EFB_HEAD(0x100), 0x100); assert_int_equal(RIO_SP_LT_CTL(0x100), 0x120); assert_int_equal(RIO_SP_RTO_CTL(0x100), 0x124); assert_int_equal(RIO_SP_GEN_CTL(0x100), 0x13c); assert_int_equal(RIO_SPX_LM_REQ(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_LM_RESP(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_ACKID_ST(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_CTL2(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_ERR_STAT(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_CTL(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_OUT_ACKID(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_IN_ACKID(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_PWR_MGMT(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_LAT_OPT(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL2(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL3(0x100, RIO_EFB_T_LANE, 1), 0); assert_int_equal(RIO_SPX_LM_REQ(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_LM_RESP(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_ACKID_ST(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_CTL2(0x100, RIO_EFB_T_SP_EP, 1), 0x174); assert_int_equal(RIO_SPX_ERR_STAT(0x100, RIO_EFB_T_SP_EP, 1), 0x178); assert_int_equal(RIO_SPX_CTL(0x100, RIO_EFB_T_SP_EP, 1), 0x17C); assert_int_equal(RIO_SPX_OUT_ACKID(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_IN_ACKID(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_PWR_MGMT(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_LAT_OPT(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL2(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL3(0x100, RIO_EFB_T_SP_EP, 1), 0); assert_int_equal(RIO_SPX_LM_REQ(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x160); assert_int_equal(RIO_SPX_LM_RESP(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x164); assert_int_equal(RIO_SPX_ACKID_ST(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x168); assert_int_equal(RIO_SPX_CTL2(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x174); assert_int_equal(RIO_SPX_ERR_STAT(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x178); assert_int_equal(RIO_SPX_CTL(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0x17C); assert_int_equal(RIO_SPX_OUT_ACKID(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_IN_ACKID(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_PWR_MGMT(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_LAT_OPT(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL2(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_TMR_CTL3(0x100, RIO_EFB_T_SP_EP_SAER, 1), 0); assert_int_equal(RIO_SPX_LM_REQ(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x180); assert_int_equal(RIO_SPX_LM_RESP(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x184); assert_int_equal(RIO_SPX_ACKID_ST(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0); assert_int_equal(RIO_SPX_CTL2(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x194); assert_int_equal(RIO_SPX_ERR_STAT(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x198); assert_int_equal(RIO_SPX_CTL(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x19C); assert_int_equal(RIO_SPX_OUT_ACKID(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1A0); assert_int_equal(RIO_SPX_IN_ACKID(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1A4); assert_int_equal(RIO_SPX_PWR_MGMT(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1A8); assert_int_equal(RIO_SPX_LAT_OPT(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1AC); assert_int_equal(RIO_SPX_TMR_CTL(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1B0); assert_int_equal(RIO_SPX_TMR_CTL2(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1B4); assert_int_equal(RIO_SPX_TMR_CTL3(0x100, RIO_EFB_T_SP_EP3_SAER, 1), 0x1B8); assert_true(RIO_SPX_LM_RESP_IS_VALID(0x80000000)); assert_false(RIO_SPX_LM_RESP_IS_VALID(0x7FFFFFFF)); assert_int_equal(RIO_SPX_LM_RESP_ACK_ID(3, 0x0001FFE0), 0x00000FFF); assert_int_equal(RIO_SPX_LM_RESP_ACK_ID(2, 0x000007E0), 0x0000003F); assert_int_equal(RIO_SPX_LM_RESP_ACK_ID(1, 0x000003E0), 0x0000001F); assert_int_equal(RIO_SPX_LM_RESP_ACK_ID(0, 0x000003E0), 0x07FFFFFF); assert_true(RIO_PORT_OK(2)); assert_false(RIO_PORT_OK(~2)); assert_int_equal(4, RIO_SPX_CTL_PTW_MAX_LANES(0xC0000000)); assert_int_equal(2, RIO_SPX_CTL_PTW_MAX_LANES(0x80000000)); assert_int_equal(1, RIO_SPX_CTL_PTW_MAX_LANES(0x00000000)); assert_int_equal(RIO_EMHS_EFB_HEAD(0x1000), 0x1000); assert_int_equal(RIO_EMHS_INFO(0x1000), 0x1004); assert_int_equal(RIO_EMHS_LL_DET(0x1000), 0x1008); assert_int_equal(RIO_EMHS_LL_EN(0x1000), 0x100C); assert_int_equal(RIO_EMHS_LL_H_ADDR(0x1000), 0x1010); assert_int_equal(RIO_EMHS_LL_ADDR(0x1000), 0x1014); assert_int_equal(RIO_EMHS_LL_ID(0x1000), 0x1018); assert_int_equal(RIO_EMHS_LL_CTRL(0x1000), 0x101C); assert_int_equal(RIO_EMHS_DEV32_DEST(0x1000), 0x1020); assert_int_equal(RIO_EMHS_DEV32_SRC(0x1000), 0x1024); assert_int_equal(RIO_EMHS_PW_DESTID(0x1000), 0x1028); assert_int_equal(RIO_EMHS_TTL(0x1000), 0x102C); assert_int_equal(RIO_EMHS_PW_DEV32(0x1000), 0x1030); assert_int_equal(RIO_EMHS_PW_TRAN_CTL(0x1000), 0x1034); assert_int_equal(RIO_EMHS_SPX_ERR_DET(0x1000, 1), 0x1080); assert_int_equal(RIO_EMHS_SPX_RATE_EN(0x1000, 1), 0x1084); assert_int_equal(RIO_EMHS_SPX_ATTR(0x1000, RIO_EFB_T_EMHS, 1), 0x1088); assert_int_equal(RIO_EMHS_SPX_CAPT0(0x1000, RIO_EFB_T_EMHS, 1), 0x108C); assert_int_equal(RIO_EMHS_SPX_CAPT1(0x1000, RIO_EFB_T_EMHS, 1), 0x1090); assert_int_equal(RIO_EMHS_SPX_CAPT2(0x1000, RIO_EFB_T_EMHS, 1), 0x1094); assert_int_equal(RIO_EMHS_SPX_CAPT3(0x1000, RIO_EFB_T_EMHS, 1), 0x1098); assert_int_equal(RIO_EMHS_SPX_CAPT4(0x1000, RIO_EFB_T_EMHS, 1), 0x109C); assert_int_equal(RIO_EMHS_SPX_RATE(0x1000, RIO_EFB_T_EMHS, 1), 0x10A8); assert_int_equal(RIO_EMHS_SPX_THRESH(0x1000, RIO_EFB_T_EMHS, 1), 0x10AC); assert_int_equal(RIO_EMHS_SPX_DLT(0x1000, 1), 0x10B0); assert_int_equal(RIO_EMHS_SPX_FIFO(0x1000, RIO_EFB_T_EMHS, 1), 0x10BC); assert_int_equal(RIO_EMHS_SPX_ATTR(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_CAPT0(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_CAPT1(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_CAPT2(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_CAPT3(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_CAPT4(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_RATE(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_THRESH(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(RIO_EMHS_SPX_FIFO(0x1000, RIO_EFB_T_HS, 1), 0); assert_int_equal(GET_DEV8_FROM_PW_TGT_HW(0x00810000), 0x81); assert_int_equal(GET_DEV8_FROM_PW_TGT_HW(0x00818000), 0xFF); assert_int_equal(GET_DEV16_FROM_PW_TGT_HW(0x80018000), 0x8001); assert_int_equal(GET_DEV16_FROM_PW_TGT_HW(0x80010000), 0xFFFF); assert_int_equal(RIO_LN_EFB_HEAD(0x300), 0x300); assert_int_equal(RIO_LNX_ST0(0x300, 1), 0x330); assert_int_equal(RIO_LNX_ST1(0x300, 1), 0x334); assert_int_equal(RIO_LNX_ST2(0x300, 1), 0x338); assert_int_equal(RIO_LNX_ST3(0x300, 1), 0x33C); assert_int_equal(RIO_LNX_ST4(0x300, 1), 0x340); assert_int_equal(RIO_LNX_ST5(0x300, 1), 0x344); assert_int_equal(RIO_LNX_ST6(0x300, 1), 0x348); assert_int_equal(RIO_LNX_ST7(0x300, 1), 0x34C); assert_int_equal(RIO_RT_EFB_HEAD(0x800), 0x800); assert_int_equal(RIO_RT_BC_CTL(0x800), 0x820); assert_int_equal(RIO_RT_BC_MC(0x800), 0x828); assert_int_equal(RIO_RT_BC_LVL0(0x800), 0x830); assert_int_equal(RIO_RT_BC_LVL1(0x800), 0x834); assert_int_equal(RIO_RT_BC_LVL2(0x800), 0x838); assert_int_equal(RIO_RT_SPX_CTL(0x800, 1), 0x860); assert_int_equal(RIO_RT_SPX_MC(0x800, 1), 0x868); assert_int_equal(RIO_RT_SPX_LVL0(0x800, 1), 0x870); assert_int_equal(RIO_RT_SPX_LVL1(0x800, 1), 0x874); assert_int_equal(RIO_RT_SPX_LVL2(0x800, 1), 0x878); assert_int_equal(RIO_RT_RTE_ADDR(0x00800400, 0, 0), 0x00800400); assert_int_equal(RIO_RT_RTE_ADDR(0x00800400, 2, 2), 0x00800C08); assert_int_equal(RIO_RT_RTE_ADDR(0x00801400, 4, 4), 0x00802410); assert_int_equal(RIO_RT_RTE_ADDR(0x00800000, 0xFF, 0xFF), 0x0083FFFC); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ8, 0), 0x800400); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ16, 0), 0x800400); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ32, 0), 0x800400); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ64, 0), 0x800400); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ8, 1), 0x800008); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ16, 1), 0x800010); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ32, 1), 0x800020); assert_int_equal(RIO_RT_MC_SET_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ64, 1), 0x800040); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ8, 0), 0x800404); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ16, 0), 0x800408); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ32, 0), 0x800410); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800400, RIO_RT_SPX_CTL_MC_MASK_SZ64, 0), 0x800420); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ8, 1), 0x80000C); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ16, 1), 0x800018); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ32, 1), 0x800030); assert_int_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800000, RIO_RT_SPX_CTL_MC_MASK_SZ64, 1), 0x800060); assert_int_not_equal(RIO_RT_MC_CLR_MASK_ADDR(0x00800000, 0x04000000, 0), 0x00800000); (void)state; // unused } int main(int argc, char** argv) { (void)argv; // not used argc++; // not used const struct CMUnitTest tests[] = { cmocka_unit_test(assumptions), cmocka_unit_test(macros), }; return cmocka_run_group_tests(tests, NULL, NULL); } #ifdef __cplusplus } #endif
835e90c4b1c75aa36b121d3f284396cd4fa43976
ec0dfe948a7585cd255a6ddcd213940a752c0031
/uri-problem-solutions/1960.c
0234e8765b4da17ab55120e02f3baaf146cb7b14
[]
no_license
iqbal17115/URI-Solutions
2a081413d64589cb08b36757bd37c3b3a4a2e745
f800158fa9ef29a19dea57a3acdac3e0d3490459
refs/heads/master
2020-12-02T08:33:59.056521
2019-12-30T15:59:52
2019-12-30T15:59:52
230,943,070
2
0
null
null
null
null
UTF-8
C
false
false
2,757
c
1960.c
#include <stdio.h> #include <string.h> int main(){ char n[4]; int length; gets(n); length=strlen(n); if(length==3){ if(n[0]=='9'){ printf("CM"); }else if(n[0]=='8'){ printf("DCCC"); }else if(n[0]=='7'){ printf("DCC"); }else if(n[0]=='6'){ printf("DC"); }else if(n[0]=='5'){ printf("D"); }else if(n[0]=='4'){ printf("CD"); }else if(n[0]=='3'){ printf("CCC"); }else if(n[0]=='2'){ printf("CC"); }else if(n[0]=='1'){ printf("C"); } if(n[1]=='9'){ printf("XC"); }else if(n[1]=='8'){ printf("LXX"); }else if(n[1]=='7'){ printf("LXX"); }else if(n[1]=='6'){ printf("LX"); }else if(n[1]=='5'){ printf("L"); }else if(n[1]=='4'){ printf("XL"); }else if(n[1]=='3'){ printf("XXX"); }else if(n[1]=='2'){ printf("XX"); }else if(n[1]=='1'){ printf("X"); } if(n[2]=='9'){ printf("IX"); }else if(n[2]=='8'){ printf("VIII"); }else if(n[2]=='7'){ printf("VII"); }else if(n[2]=='6'){ printf("VI"); }else if(n[2]=='5'){ printf("V"); }else if(n[2]=='4'){ printf("IV"); }else if(n[2]=='3'){ printf("III"); }else if(n[2]=='2'){ printf("II"); }else if(n[2]=='1'){ printf("I"); } } if(length==2){ if(n[0]=='9'){ printf("XC"); }else if(n[0]=='8'){ printf("LXXX"); }else if(n[0]=='7'){ printf("LXX"); }else if(n[0]=='6'){ printf("LX"); }else if(n[0]=='5'){ printf("L"); }else if(n[0]=='4'){ printf("XL"); }else if(n[0]=='3'){ printf("XXX"); }else if(n[0]=='2'){ printf("XX"); }else if(n[0]=='1'){ printf("X"); } if(n[1]=='9'){ printf("IX"); }else if(n[1]=='8'){ printf("VIII"); }else if(n[1]=='7'){ printf("VII"); }else if(n[1]=='6'){ printf("VI"); }else if(n[1]=='5'){ printf("V"); }else if(n[1]=='4'){ printf("IV"); }else if(n[1]=='3'){ printf("III"); }else if(n[1]=='2'){ printf("II"); }else if(n[1]=='1'){ printf("I"); } } if(length==1){ if(n[0]=='9'){ printf("IX"); }else if(n[0]=='8'){ printf("VIII"); }else if(n[0]=='7'){ printf("VII"); }else if(n[0]=='6'){ printf("VI"); }else if(n[0]=='5'){ printf("V"); }else if(n[0]=='4'){ printf("IV"); }else if(n[0]=='3'){ printf("III"); }else if(n[0]=='2'){ printf("II"); }else if(n[0]=='1'){ printf("I"); } } printf("\n"); return 0; }
1fea3e7911dd9628b7ab140b1276f112521e8b99
184f1bbd1068ae5cd59c1c4ee9e09b4f13d05b79
/assignment4/src/shapes.c
9dfe48186f94be828699a8043e7d15d6724249ba
[ "Zlib", "MIT" ]
permissive
felipecustodio/cg
316085cae20597bfd5d686fbc142c40e485989ee
7cb4d209ba9eec8f87772fab2fdd8490b08718c5
refs/heads/master
2021-01-11T08:48:38.311715
2018-03-27T16:22:03
2018-03-27T16:22:03
76,828,861
1
0
null
null
null
null
UTF-8
C
false
false
15,713
c
shapes.c
#include "../includes/shapes.h" /* ----------------------------- TEXTURES ------------------------------ */ GLuint loadTexture(const char *filename) { // Load texture with RGBA // Transparency enabled GLuint tex = SOIL_load_OGL_texture(filename, SOIL_LOAD_RGBA, SOIL_CREATE_NEW_ID, SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y); if (!tex) { return EXIT_FAILURE; } // Texture parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); return tex; } /* ----------------------------- TEXTURES ------------------------------ */ /* ---------------------------------- TEXT ---------------------------------- */ Text *createText(void *font, const char *string) { Text *newTxt = (Text *) malloc(sizeof(Text)); newTxt->font = font; newTxt->string = string; newTxt->x = 0.0; newTxt->y = 0.0; newTxt->z = 0.0; return newTxt; } void drawText(Text *text, int x, int y) { if(text == NULL || text->font == NULL || text->string == NULL) return; text->x = x; text->y = y; int strsize = strlen(text->string); glRasterPos3f(text->x, text->y, text->z); int i = 0; for(i = 0; i < strsize; i++) { glutBitmapCharacter(text->font, text->string[i]); } } void freeText(Text *text) { if(text) { free(text); text = NULL; } } /* ---------------------------------- TEXT ---------------------------------- */ /* ---------------------------------- PLANE --------------------------------- */ // Plane Coordinates Plane* createPlane(){ Plane *plane = (Plane *) malloc(sizeof(Plane)); plane->thickness = 1.0f; plane->color[0] = 1.0; plane->color[1] = 1.0; plane->color[2] = 1.0; plane->texture = 0; plane->x[0] = 0.0; plane->y[0] = 0.0; plane->z[0] = 0.0; plane->x[1] = 0.0; plane->y[1] = 0.0; plane->z[1] = 0.0; plane->x[2] = 0.0; plane->y[2] = 0.0; plane->z[2] = 0.0; plane->x[3] = 0.0; plane->y[3] = 0.0; plane->z[3] = 0.0; return plane; } void setPlaneCoordinates(Plane *plane, GLfloat x1, GLfloat y1, GLfloat z1, GLfloat x2, GLfloat y2, GLfloat z2, GLfloat x3, GLfloat y3, GLfloat z3, GLfloat x4, GLfloat y4, GLfloat z4) { if (plane == NULL) return; plane->x[0] = x1; plane->y[0] = y1; plane->z[0] = z1; plane->x[1] = x2; plane->y[1] = y2; plane->z[1] = z2; plane->x[2] = x3; plane->y[2] = y3; plane->z[2] = z3; plane->x[3] = x4; plane->y[3] = y4; plane->z[3] = z4; } void setPlaneThickness(Plane *plane, float thickness){ if (plane == NULL) return; plane->thickness = thickness; } void setPlaneColor(Plane *plane, float r, float g, float b){ if (plane == NULL) return; plane->color[0] = r; plane->color[1] = g; plane->color[2] = b; } void setPlaneTexture(Plane *plane, GLuint texture){ if (plane == NULL) return; plane->texture = texture; } void drawPlaneHollow(Plane* plane) { if (plane == NULL) return; glLineWidth(plane->thickness); glBegin(GL_LINE_LOOP); glVertex3f(plane->x[0], plane->y[0], plane->z[0]); glVertex3f(plane->x[1], plane->y[1], plane->z[1]); glVertex3f(plane->x[2], plane->y[2], plane->z[2]); glVertex3f(plane->x[3], plane->y[3], plane->z[3]); glEnd(); } void drawPlaneFilled(Plane* plane) { if (plane == NULL) return; glBegin(GL_QUADS); glVertex3f(plane->x[0], plane->y[0], plane->z[0]); glVertex3f(plane->x[1], plane->y[1], plane->z[1]); glVertex3f(plane->x[2], plane->y[2], plane->z[2]); glVertex3f(plane->x[3], plane->y[3], plane->z[3]); glEnd(); } void drawPlaneTextured(Plane *plane){ if (plane == NULL) return; glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glBindTexture(GL_TEXTURE_2D, plane->texture); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor3f(plane->color[0], plane->color[1], plane->color[2]); glBegin(GL_QUADS); glTexCoord2f(0, 0); glVertex3f(plane->x[0], plane->y[0], plane->z[0]); glTexCoord2f(0, 1); glVertex3f(plane->x[1], plane->y[1], plane->z[1]); glTexCoord2f(1, 1); glVertex3f(plane->x[2], plane->y[2], plane->z[2]); glTexCoord2f(1, 0); glVertex3f(plane->x[3], plane->y[3], plane->z[3]); glEnd(); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); } void freePlane(Plane *plane) { if(plane){ free(plane); plane = NULL; } } /* ---------------------------------- PLANE --------------------------------- */ /* ---------------------------------- CUBE ---------------------------------- */ Cube *createCube(){ Cube *cube = (Cube *) malloc(sizeof(Cube)); cube->thickness = 1.0f; cube->color[0] = 1.0; cube->color[1] = 1.0; cube->color[2] = 1.0; cube->texture = 0; cube->x = 0.0; cube->y = 0.0; cube->z = 0.0; cube->sizeX = 0.0; cube->sizeY = 0.0; cube->sizeZ = 0.0; return cube; } void setCubeColor(Cube *cube, float r, float g, float b){ if (cube == NULL) return; cube->color[0] = r; cube->color[1] = g; cube->color[2] = b; } void setCubeCoordinates(Cube *cube, GLfloat x, GLfloat y, GLfloat z){ if (cube == NULL) return; cube->x = x; cube->y = y; cube->z = z; } void setCubeThickness(Cube *cube, float thickness){ if (cube == NULL) return; cube->thickness = thickness; } void setCubeSize(Cube *cube, GLfloat x, GLfloat y, GLfloat z){ if (cube == NULL) return; cube->sizeX = x; cube->sizeY = y; cube->sizeZ = z; } void setCubeTexture(Cube *cube, GLuint texture){ cube->texture = texture; } void drawCubeHollow(Cube *cube){ if (cube == NULL) return; Plane *plane = createPlane(); setPlaneThickness(plane, cube->thickness); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); setPlaneCoordinates(plane, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneHollow(plane); freePlane(plane); } void drawCubeFilled(Cube *cube){ if (cube == NULL) return; Plane *plane = createPlane(); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); setPlaneCoordinates(plane, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneFilled(plane); freePlane(plane); } void drawCubeTextured(Cube *cube){ if (cube == NULL) return; Plane *plane = createPlane(); setPlaneTexture(plane, cube->texture); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); setPlaneCoordinates(plane, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, (cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); setPlaneCoordinates(plane, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, (cube->sizeZ/2) + cube->z, (cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z, -(cube->sizeX/2) + cube->x, -(cube->sizeY/2) + cube->y, -(cube->sizeZ/2) + cube->z); drawPlaneTextured(plane); freePlane(plane); } void freeCube(Cube *cube){ if(cube){ free(cube); cube = NULL; } } /* ---------------------------------- CUBE ---------------------------------- */
97a5f86fc0d5cfa4c04ce80b712680aadaab797f
b6a26569f334ba847e474427ecf81b50b0362cea
/Intel/ServerSecurityPkg/Library/AppAdapterSgx3v0InternalLib/AppAdapterSgx3v0InternalLib.c
ef2c59a48f3cbc3056ab0852a8ba0e64e77afc57
[]
no_license
marktsai0316/Transformer
fd553728daa5aaa5b3f3fed9b9a2352d70dcd51c
e39ec3030ef0fd1841c6d916bdb77cddaaebc6ad
refs/heads/master
2022-12-10T22:30:54.984958
2020-09-10T05:55:24
2020-09-10T05:55:24
null
0
0
null
null
null
null
UTF-8
C
false
false
2,781
c
AppAdapterSgx3v0InternalLib.c
/** @file @copyright INTEL CONFIDENTIAL Copyright 2020 Intel Corporation. <BR> The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material may contain trade secrets and proprietary and confidential information of Intel Corporation and its suppliers and licensors, and is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intel's prior express written permission. No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing. Unless otherwise agreed by Intel in writing, you may not remove or alter this notice or any other notice embedded in Materials by Intel or Intel's suppliers or licensors in any way. **/ #include "AppAdapterSgx3v0InternalLib.h" // Might need a static global to speed things up FRU_CPU_FEATURE_SGX_3V0_PPI *mFruCpuFeatureSgx3v0 = NULL; EFI_STATUS EFIAPI _RetrievePrmrr ( IN APP_SGX_3V0_PPI *This, IN CONST EFI_PEI_SERVICES **PeiServices ) { This->PrmrrData.PrmrrBase[0] = 0; This->PrmrrData.PrmrrMask = 0; return EFI_UNSUPPORTED; } EFI_STATUS EFIAPI _ProgramPrmrr ( IN APP_SGX_3V0_PPI *This, IN CONST EFI_PEI_SERVICES **PeiServices ) { EFI_STATUS Status = EFI_UNSUPPORTED; DEBUG ((EFI_D_INFO, "[APP_ADAPTER] %a BEGIN\n", __FUNCTION__)); // // Locate Ppi // if (mFruCpuFeatureSgx3v0 == NULL) { Status = (*PeiServices)->LocatePpi ( PeiServices, &gSecurityFruCpuFeatureSgx3v0PpiGuid, 0, NULL, &mFruCpuFeatureSgx3v0 ); } if (EFI_ERROR(Status)) { goto Return_AppAdapterSgx3v0InternalLib_ProgramPrmrr; } // Initialize internal structures CopyMem (&mFruCpuFeatureSgx3v0->PrmrrData, &This->PrmrrData, sizeof(mFruCpuFeatureSgx3v0->PrmrrData)); Status = mFruCpuFeatureSgx3v0->ProgramPrmrr (mFruCpuFeatureSgx3v0, PeiServices); Return_AppAdapterSgx3v0InternalLib_ProgramPrmrr: DEBUG ((EFI_D_INFO, "[APP_ADAPTER] %a END Status: %r\n", __FUNCTION__, Status)); return Status; } EFI_STATUS EFIAPI _LockPrmrr ( IN APP_SGX_3V0_PPI *This, IN CONST EFI_PEI_SERVICES **PeiServices ) { return EFI_UNSUPPORTED; }
206090a370e4e0727db0cd1b08b56802823d67d3
63b4a698bc22fd54857c8fa097b1331f79c39e5a
/src/gdb/gdb-8.3/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
90c9671c80bc00a58edc39f6d9ea47fce86bb781
[ "Apache-2.0", "GPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "GPL-1.0-or-later", "LicenseRef-scancode-unknown-license-reference", "AGPL-3.0-or-later", "GPL-3.0-or-later", "LGPL-3.0-only", "GPL-2.0-only", "LGPL-2.0-or-later", "LicenseRef-scancode-other-copyleft", "LGPL-2.0-only", ...
permissive
MinimSecure/unum-sdk
67e04e2b230f9afb3ae328501a16afa4b94cdac6
30c63f0eccddba39a760671a831be3602842f3f4
refs/heads/master
2023-07-13T07:33:43.078672
2023-07-07T13:52:05
2023-07-07T13:52:05
143,209,329
33
22
Apache-2.0
2021-03-05T22:56:59
2018-08-01T21:13:43
C
UTF-8
C
false
false
3,004
c
watchpoint-fork-child.c
/* Test case for forgotten hw-watchpoints after fork()-off of a process. Copyright 2012-2019 Free Software Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "watchpoint-fork.h" #include <string.h> #include <errno.h> #include <unistd.h> #include <assert.h> #include <signal.h> #include <stdio.h> /* `pid_t' may not be available. */ static volatile int usr1_got; static void handler_usr1 (int signo) { usr1_got++; } void forkoff (int nr) { int child, save_parent = getpid (); int i; struct sigaction act, oldact; #ifdef THREAD void *thread_result; #endif memset (&act, 0, sizeof act); act.sa_flags = SA_RESTART; act.sa_handler = handler_usr1; sigemptyset (&act.sa_mask); i = sigaction (SIGUSR1, &act, &oldact); assert (i == 0); child = fork (); switch (child) { case -1: assert (0); default: printf ("parent%d: %d\n", nr, (int) child); /* Sleep for a while to possibly get incorrectly ATTACH_THREADed by GDB tracing the child fork with no longer valid thread/lwp entries of the parent. */ i = sleep (2); assert (i == 0); /* We must not get caught here (against a forgotten breakpoint). */ var++; marker (); #ifdef THREAD /* And neither got caught our thread. */ step = 99; i = pthread_join (thread, &thread_result); assert (i == 0); assert (thread_result == (void *) 99UL); #endif /* Be sure our child knows we did not get caught above. */ i = kill (child, SIGUSR1); assert (i == 0); /* Sleep for a while to check GDB's `info threads' no longer tracks us in the child fork. */ i = sleep (2); assert (i == 0); _exit (0); case 0: printf ("child%d: %d\n", nr, (int) getpid ()); /* Let the parent signal us about its success. Be careful of races. */ for (;;) { /* Parent either died (and USR1_GOT is zero) or it succeeded. */ if (getppid () != save_parent) break; if (kill (getppid (), 0) != 0) break; /* Parent succeeded? */ if (usr1_got) break; #ifdef THREAD i = pthread_yield (); assert (i == 0); #endif } assert (usr1_got); /* We must get caught here (against a false watchpoint removal). */ marker (); } i = sigaction (SIGUSR1, &oldact, NULL); assert (i == 0); }
871d18560f46d6964ef6fd497bbf2322cac0853d
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/mpv/stream/extr_stream_dvb.c_dvb_strtok_r.c
430877ee7fa983413ba08850df9357bc0214f52f
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
923
c
extr_stream_dvb.c_dvb_strtok_r.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ /* Type definitions */ /* Variables and functions */ int strcspn (char*,char const*) ; int /*<<< orphan*/ strspn (char*,char const*) ; __attribute__((used)) static char *dvb_strtok_r(char *s, const char *sep, char **p) { if (!s && !(s = *p)) return NULL; /* Skip leading separators. */ s += strspn(s, sep); /* s points at first non-separator, or end of string. */ if (!*s) return *p = 0; /* Move *p to next separator. */ *p = s + strcspn(s, sep); if (**p) { *(*p)++ = 0; } else { *p = 0; } return s; }
9279666c377895e7a25e8201f9b95400ff96483d
a12efc266b1105d0a56878bd66d6fe40942719df
/memorypark/pop/walk/omsg.h
163d314b22fc5ae5913f5b1cd0713fc4fb0de8a0
[]
no_license
adderly/cmoon
11df92b45e5d383aea4f133832ab627bfc17c140
5a48bfa85f3a1bafd50a560d8de08ccfb2c22528
refs/heads/master
2020-12-07T03:49:57.240112
2014-04-03T10:18:40
2014-04-03T10:18:40
null
0
0
null
null
null
null
UTF-8
C
false
false
182
h
omsg.h
#ifndef __OMSG_H__ #define __OMSG_H__ #include "mheads.h" __BEGIN_DECLS NEOERR* msg_data_get(CGI *cgi, HASH *dbh, HASH *evth, session_t *ses); __END_DECLS #endif /* __OMSG_H__ */
4893a74228de59ba9d6e93c9f5ad032a622fd896
2ef91f4f949a514fa33157a807730d7f4bed6185
/src/gametypes.h
f73dc0721aee63e5501e211befe2e0d7fa3e7320
[ "MIT" ]
permissive
jsdf/goose64
329798d1f83a46fe23d04d5aa84e762fee8808ba
9462834c7581ea36679927abbc5dbc1a4e1dcfda
refs/heads/master
2023-08-13T00:03:12.853788
2022-05-21T18:57:22
2022-05-21T18:57:22
214,956,666
72
7
null
null
null
null
UTF-8
C
false
false
2,401
h
gametypes.h
#ifndef _GAMETYPES_H_ #define _GAMETYPES_H_ #include "animation.h" #include "characterstate.h" #include "gameobject.h" #include "pathfinding.h" #include "physics.h" typedef enum ItemHolderType { PlayerItemHolder, CharacterItemHolder, } ItemHolderType; struct ItemStruct; // composable struct for players and characters which hold things typedef struct ItemHolder { ItemHolderType itemHolderType; void* owner; unsigned int acquiredTick; struct ItemStruct* heldItem; } ItemHolder; typedef struct Player { ItemHolder itemHolder; GameObject* goose; AnimationState animState; unsigned int lastPickupTick; } Player; typedef struct Character { ItemHolder itemHolder; GameObject* obj; AnimationState animState; struct ItemStruct* targetItem; struct ItemStruct* defaultActivityItem; Vec3d defaultActivityLocation; Vec3d movementTarget; // immediate goal for local movement/steering Vec3d targetLocation; // high level movement goal (eg. last seen/heard loc) CharacterTarget targetType; CharacterState state; PathfindingState* pathfindingResult; // index of target node in path, or pathlength+1 for final target int pathProgress; float pathSegmentProgress; // param between segments, used by path smoothing float speedScaleForHeading; float speedMultiplier; float speedScaleForArrival; float turningSpeedScaleForHeading; unsigned int enteredStateTick; unsigned int startedActivityTick; } Character; typedef struct ItemStruct { GameObject* obj; ItemHolder* holder; unsigned int lastPickedUpTick; Vec3d initialLocation; } Item; // this is here because of mutual dependency between game methods and objects // with update methods which take Game arg typedef struct Game { unsigned int tick; // this will overflow if you run the game for 829 days :) int paused; Vec3d viewPos; Vec3d viewRot; Vec3d viewTarget; float viewZoom; int freeView; GameObject* worldObjects; int worldObjectsCount; Item* items; int itemsCount; Character* characters; int charactersCount; PhysBody* physicsBodies; int physicsBodiesCount; Player player; PhysState physicsState; Graph* pathfindingGraph; PathfindingState* pathfindingState; AABB* worldObjectsBounds; // profiling float profTimeCharacters; float profTimePhysics; float profTimeDraw; float profTimePath; } Game; #endif /* !_GAMETYPES_H_ */
21aa7161bd80643954247cc4cc3b1e3344ad0b4c
79d296b4ee7ae4255d1105a2a70ea1ffe4351f76
/arifpucit-spvl-repo/28/sender.c
27e8ca270a937b39f5f5635cb0bb2356961472a1
[]
no_license
usmanfcit/SP-VLecs
d876b410078e5b3f84aae8c5e8104b48f75a9501
cdb35ac04dfbf92f118cf801d8213c1851524a18
refs/heads/master
2023-08-22T15:54:05.024449
2021-09-27T11:55:47
2021-09-27T11:55:47
null
0
0
null
null
null
null
UTF-8
C
false
false
838
c
sender.c
/* * Video Lecture: 28 * Programmer: Arif Butt * Course: System Programming with Linux * Program creates a message queue, * sends two messages in that queue and terminate * usage: ./sender */ #include <stdio.h> #include <sys/msg.h> #include <sys/ipc.h> #include <stdlib.h> #include <string.h> #define SIZE 512 struct msgbuf{ long mtype; char mtext[SIZE]; }; int main(){ key_t key = ftok("./myfile", 65); int qid = msgget(key, IPC_CREAT | 0666); //place first message on this message queue struct msgbuf msg1; msg1.mtype = 10; strcpy(msg1.mtext, "Learning is fun with Arif\n"); msgsnd(qid, &msg1, sizeof msg1.mtext, 0); //place second message on this message queue struct msgbuf msg2; msg2.mtype = 20; strcpy(msg2.mtext, "This is GR8\n"); msgsnd(qid, &msg2, sizeof msg2.mtext, 0); return 0; }
9024c8e11405b2b339f15042a74a8f8a3804acbb
bf547590c7e2099d2c80c949a1925ba6f30a83c2
/tetris_uart.c
a4a3bc2f89464b4a25fbc488e316f217e82dab31
[]
no_license
mhlyv/pico-tetris
7a90520e83e67a99ef2b69711bee0ba50eef65fc
53d44c68146695ff5cd2a6476323cc46a140da72
refs/heads/main
2023-04-21T15:59:30.540801
2021-05-12T23:25:26
2021-05-12T23:25:26
363,734,731
0
0
null
null
null
null
UTF-8
C
false
false
945
c
tetris_uart.c
#include <stdbool.h> #include "hardware/uart.h" #include "pico/stdlib.h" #include "tetris.h" #include "tetris_uart.h" // initialize uart void tetris_uart_init() { gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART); gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART); uart_init(UART_ID, UART_BAUD_RATE); uart_set_hw_flow(UART_ID, false, false); // disable CTS/RTS uart_set_fifo_enabled(UART_ID, true); } // print the tetris board void tetris_uart_print(struct Tetris *tetris) { for (uint8_t i = 0; i < BOARD_H; i++) { for (uint8_t j = 0; j < BOARD_W; j++) { uart_putc(UART_ID, tetris_get_board_block(tetris, j, i) ? '#' : '.'); uart_putc(UART_ID, ' '); } uart_puts(UART_ID, "\r\n"); } } // read commands from the uart, and write them to the command buffer void tetris_uart_handle_rx() { while (uart_is_readable(UART_ID)) { char c = uart_getc(UART_ID); while (!command_buffer_write(c)) { tight_loop_contents(); } } }
02b9d30c41d627d9175381ddba81c6ab2b82fa5d
938ccf596552d4a098a38c7d9c647ef5144533e5
/C/Greplace.c
eed614cfe6922ff5b54b855ce2ae0429f06641ec
[]
no_license
jamesrwelch/BToolkit
07aa14418cd4765eeabc6683e99685d30ef12122
fb199a70f4648a90bb9f5a9ccf57f32e3195687c
refs/heads/master
2021-01-24T01:01:06.505985
2012-06-19T21:44:00
2012-06-19T21:44:00
null
0
0
null
null
null
null
UTF-8
C
false
false
8,516
c
Greplace.c
/* Copyright (c) 1985-2012, B-Core (UK) Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #define print_string_pairs \ printf ( "tot_pairs %d:\n", tot_pairs ); \ for ( i = 0 ; i < tot_pairs ; i++ ) { \ printf ( " |%s| |%s|\n", orig_string [ i ], repl_string [ i ] ); \ } #define print_word \ if ( ( strcmp ( "", word ) != 0 ) ) printf ( "word: |%s|\n", word ) #include <stdio.h> /**/ #include <string.h> /**/ #include <stdlib.h> #define max_pairs 1000 #define max_string 255 char in_file_name [ 255 ]; char out_file_name [ 255 ]; FILE * file_in; FILE * file_out; char word [ max_string + 1 ]; int i, c, found; char orig_string [ max_pairs + 1 ] [ max_string + 1 ]; char repl_string [ max_pairs + 1 ] [ max_string + 1 ]; int tot_pairs; int space_equate; int code_rewrite; int array_rewrite; void format_error ( err ) int err; { printf ( "\n Greplace: format error %d\n\n", err ); exit ( 1 ); } void check_replace_word () { i = 0; found = 0; while ( ! found && i < tot_pairs ) { found = ( strcmp ( word, orig_string [ i ] ) == 0 ); if ( ! found ) { i++; } }; if ( found ) { fputs ( repl_string [ i ], file_out ); } else { fputs ( word, file_out ); } } void process_next_word () { i = 0; while ( ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || /* ( c == '.' ) || leave this out, else 0ub! */ ( c == '_' ) ) && i < max_string ) { word [ i ] = c; c = getc ( file_in ); i++; }; if ( i == max_string ) { format_error ( 5 ); }; word [ i ] = '\0'; /*** print_word; ***/ check_replace_word (); if ( c != EOF ) { putc ( c, file_out ); c = getc ( file_in ); } } void process_next_html_word () { i = 0; while ( ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || ( c == '.' ) || ( c == '_' ) ) && i < max_string ) { word [ i ] = c; c = getc ( file_in ); i++; }; if ( i == max_string ) { format_error ( 5 ); }; word [ i ] = '\0'; /*** print_word; ***/ check_replace_word (); if ( c != EOF ) { putc ( c, file_out ); c = getc ( file_in ); } } void process_next_num_word () { i = 0; while ( ( ( c >= '0' && c <= '9' ) || ( c == '+' ) || ( c == '-' ) || ( c == '*' ) || ( c == '/' ) ) && i < max_string ) { word [ i ] = c; c = getc ( file_in ); i++; }; if ( i == max_string ) { format_error ( 5 ); }; word [ i ] = '\0'; /*** print_word; ***/ check_replace_word (); if ( c != EOF ) { putc ( c, file_out ); c = getc ( file_in ); } } int main ( argc, argv ) int argc; char *argv[]; { if ( argc != 6 ) { format_error ( 0 ); }; /*** { int i; printf ( "Greplace (%s -> %s) argc: %d\n", argv [ 1 ], argv [ 2 ], argc ); for ( i = 0 ; i < argc ; i++ ) { printf ( " %d: %s\n", i, argv [ i ] ); } } ***/ array_rewrite = 0; if ( strcmp ( argv [ 4 ], "1" ) == 0 ) code_rewrite = 0; else if ( strcmp ( argv [ 4 ], "0" ) == 0 ) code_rewrite = 1; else if ( strcmp ( argv [ 4 ], "2" ) == 0 ) array_rewrite = 1; else format_error ( 7 ); strcpy ( in_file_name, argv [ 1 ] ); strcpy ( out_file_name, argv [ 2 ] ); if ( strcmp ( argv [ 3 ], "0" ) == 0 ) { space_equate = 0; } else if ( strcmp ( argv [ 3 ], "0" ) == 1 ) { space_equate = 1; } else { format_error ( 6 ); }; file_in = fopen ( ".Bcom", "r" ); if ( file_in == NULL ) { printf ( "\n Greplace: can't open \"%s\" for reading\n\n", ".Bcom" ); exit ( 1 ); } tot_pairs = 0; c = getc ( file_in ); while ( c != EOF && tot_pairs < max_pairs ) { i = 0; while ( c != ',' && c != EOF ) { orig_string [ tot_pairs ] [ i ] = c; c = getc ( file_in ); i++; }; if ( i == max_string ) { format_error ( 1 ); }; if ( c != ',' ) { format_error ( 2 ); }; orig_string [ tot_pairs ] [ i ] = '\0'; c = getc ( file_in ); i = 0; while ( c != '\n' && c != EOF ) { repl_string [ tot_pairs ] [ i ] = c; c = getc ( file_in ); i++; }; if ( i == max_string ) { format_error ( 3 ); }; if ( c != '\n' ) { format_error ( 4 ); }; repl_string [ tot_pairs ] [ i ] = '\0'; c = getc ( file_in ); tot_pairs++; }; if ( c != EOF ) { format_error ( 3 ); }; fclose ( file_in ); /*** print_string_pairs; ***/ file_in = fopen ( in_file_name, "r" ); if ( file_in == NULL ) { printf ( "\n Greplace: can't open \"%s\" for reading\n\n", in_file_name ); exit ( 1 ); } file_out = fopen ( out_file_name, "w" ); if ( file_out == NULL ) { printf ( "\n Greplace: can't open \"%s\" for writing\n\n", out_file_name ); exit ( 1 ); }; /*** if PASP skip to MODULE or MAIN if present ***/ if ( strcmp ( argv [ 5 ], "1" ) == 0 ) { char buf [ 1000 ]; int MODULE_OR_MAIN_found = 0; int i; /*** printf ( "argv [ 5 ] is 1\n" ); fflush ( stdout ); ***/ c = getc ( file_in ); putc ( c, file_out ); while ( ( c != EOF ) && ( ! MODULE_OR_MAIN_found ) ) { i = 0; while ( ( c != EOF ) && ( c != 'M' ) ) { c = getc ( file_in ); putc ( c, file_out ); } if ( c == 'M' ) { while ( ( c >= 'A' ) && ( c <= 'U' ) ) { buf [ i++ ] = c; c = getc ( file_in ); putc ( c, file_out ); } buf [ i ] = '\0'; if ( ( strcmp ( buf, "MODULE" ) == 0 ) || ( strcmp ( buf, "MAIN" ) == 0 ) ) MODULE_OR_MAIN_found = 1; } if ( ( c != EOF ) && ( ! MODULE_OR_MAIN_found ) ) { c = getc ( file_in ); putc ( c, file_out ); } } if ( ! MODULE_OR_MAIN_found ) { fclose ( file_in ); file_in = fopen ( in_file_name, "r" ); if ( file_in == NULL ) { printf ( "\n Greplace: can't open \"%s\" for reading\n\n", in_file_name ); exit ( 1 ); } fclose ( file_out ); file_out = fopen ( out_file_name, "w" ); if ( file_out == NULL ) { printf ( "\n Greplace: can't open \"%s\" for writing\n\n", out_file_name ); exit ( 1 ); } } /*** printf ( "\nMODULE_OR_MAIN_found %d\n", MODULE_OR_MAIN_found ); if ( ! MODULE_OR_MAIN_found ) { char buf [ 250 ]; printf ( "\n---------------------------------------------------\n" ); fflush ( stdout ); sprintf ( buf, "cat %s", argv [ 1 ] ); system ( buf ); fflush ( stdout ); printf ( "\n---------------------------------------------------\n" ); fflush ( stdout ); } ***/ } /* argv [ 5 ] is "1" */ c = getc ( file_in ); while ( c != EOF ) { if ( ! array_rewrite ) { if ( code_rewrite ) process_next_word (); else process_next_html_word (); } else { process_next_num_word (); } }; fclose ( file_in ); fclose ( file_out ); exit ( 0 ); }
e92084d75793f11cf940384970b57839440cc25a
a066f4086325b60a96f5e6e1ac8f628dd65fd3ed
/src/ms_ia_full.c
438df18a3bce64863ab008af0f449246010dda9f
[ "MIT" ]
permissive
JosephCHS/Matchstick
3693f0c730850d912d64b3374d4d53d5da539123
d37d46caeba29b533ca1c308410399e6ba4da6ce
refs/heads/master
2021-04-30T04:19:06.519983
2018-02-15T13:09:21
2018-02-15T13:09:21
121,534,107
0
0
null
null
null
null
UTF-8
C
false
false
907
c
ms_ia_full.c
/* ** EPITECH PROJECT, 2018 ** ia play full ** File description: ** made by Joseph Chartois */ #include "my.h" int ia_play_full(char **map, int nb_max_matches, int idx, int *line) { int nb_m = nb_max_matches; *line = find_line_ia(map, idx); while (nb_max_matches != 0) { (*map)[idx] = ' '; --nb_max_matches; --idx; } return (nb_m); } int ia_play_one(char **map, int idx, int *line) { *line = find_line_ia(map, idx); (*map)[idx] = ' '; return (1); } int ia_play_dispo_less_one(char **map, int nb_matches_line, int idx, int *line) { int nb_m = 0; *line = find_line_ia(map, idx); --nb_matches_line; nb_m = nb_matches_line; --idx; while (nb_matches_line != 0) { (*map)[idx] = ' '; --nb_matches_line; --idx; } return (nb_m); } int find_line_ia(char **map, int idx) { int cnt = 0; while (idx != 0) { if ((*map)[idx] == '\n') { ++cnt; } --idx; } return (cnt); }
ba973f3084c493846a70e9972b3624783e30a9eb
8101c7bcc07bb1f9013f915474d9ec742a864da8
/src/sqltest.h
208600e0fc7ac07e4d659d45d65959156d2bdfae
[ "MIT" ]
permissive
w5292c/test
9360ec07c09444f1aab66b3f418f397495e0821e
0db5b28d30514726f7eb301e7cb1d8ec26a173a6
refs/heads/master
2021-01-18T22:35:36.881970
2017-12-08T12:53:07
2017-12-08T12:53:07
4,491,481
0
0
null
null
null
null
UTF-8
C
false
false
96
h
sqltest.h
#ifndef TEST_SQL_TEST_H #define TEST_SQL_TEST_H void test_sql(); #endif /* TEST_SQL_TEST_H */
fc642abc79e34278cceec60a0d84366872c28d20
187e6ef891d00e91de2b564bbdbeeb92204a00d1
/src/main.h
1fbd3481a3e3eeb596027096ade413f21bbc7f83
[]
no_license
SilentFlyBy/quadroino-flight-controller
6d3d07a09e6c0827d723c7d950f29e4444a36b40
a65eef1b774f8b2373bbc67ccf70a0f722a564ea
refs/heads/master
2021-01-22T19:48:23.883133
2017-03-16T20:47:35
2017-03-16T20:47:35
85,239,222
0
0
null
null
null
null
UTF-8
C
false
false
68
h
main.h
#ifndef MAIN_H_ #define MAIN_H_ void setup(); void loop(); #endif
b36a39acb48937b9003f7930152593f98f716d9a
2000c8ffbd1fe786c47804a9df7cc2ab4476181d
/hafta 4/address7.c
87268ffe796e19cb8b6df1aee51efbce241e1700
[]
no_license
berkcangumusisik/CS50
49f4207aff1eb494b305af3bd39e1684ac16219e
362ecc63813f6e41c1dc0cbc939fa88536fdb689
refs/heads/main
2023-07-08T20:22:41.589793
2021-08-14T14:37:52
2021-08-14T14:37:52
352,071,672
6
1
null
null
null
null
UTF-8
C
false
false
273
c
address7.c
#include <stdio.h> int main(void) { char *s = "Merhaba!"; printf("%c\n",*s); printf("%c\n", *(s+1)); printf("%c\n", *(s+2)); printf("%c\n", *(s+3)); printf("%c\n", *(s+4)); printf("%c\n", *(s+5)); printf("%c\n", *(s+6)); printf("%c\n", *(s+7)); }
ff13747896b25cfa004f988afecdce70e6268642
cd7998b413fa64b5d7d51b15b29da2781c4160f9
/MotionController/peripherals/DSP2833x_Xintf.c
9e3f68f21f9d5cc0b485880ade36de23ab9265c2
[]
no_license
ImQUENTIN/MotionController
5da951e14b9f8d8ffc1a158144313678f10ae3cf
9334ec438e7fe78fc1e56057196d34260ef8d127
refs/heads/master
2021-01-02T08:31:27.416723
2017-03-22T10:26:09
2017-03-22T10:26:09
99,017,776
1
0
null
null
null
null
UTF-8
C
false
false
17,743
c
DSP2833x_Xintf.c
// TI File $Revision: /main/5 $ // Checkin $Date: August 16, 2007 11:06:26 $ //########################################################################### // // FILE: DSP2833x_Xintf.c // // TITLE: DSP2833x Device External Interface Init & Support Functions. // // DESCRIPTION: // // Example initialization function for the external interface (XINTF). // This example configures the XINTF to its default state. For an // example of how this function being used refer to the // examples/run_from_xintf project. // //########################################################################### // $TI Release: DSP2833x Header Files V1.01 $ // $Release Date: September 26, 2007 $ //########################################################################### #include "DSP2833x_Device.h" // DSP2833x Headerfile Include File #include "DSP2833x_Examples.h" // DSP2833x Examples Include File //--------------------------------------------------------------------------- // InitXINTF: //--------------------------------------------------------------------------- // This function initializes the External Interface the default reset state. // // Do not modify the timings of the XINTF while running from the XINTF. Doing // so can yield unpredictable results void ConfigureXTIMING( volatile union XTIMING_REG *zone, struct XTIMING_BITS *cfg ) { // Zone 6------------------------------------ // When using ready, ACTIVE must be 1 or greater // Lead must always be 1 or greater // ---------------------------------------------------------------------------------------------------- // Description X2TIMING = 0 X2TIMING = 1 // ---------------------------------------------------------------------------------------------------- // LR Lead period, read access XRDLEAD x tc(xtim) (XRDLEADx2) x tc(xtim) // AR Active period, read access (XRDACTIVE+WS+1) x tc(xtim) (XRDACTIVEx2+WS+1) x tc(xtim) // TR Trail period, read access XRDTRAIL x tc(xtim) (XRDTRAILx2) x tc(xtim) // LW Lead period, write access // AW Active period, write access // TW Trail period, write access // ---------------------------------------------------------------------------------------------------- // // (1) tc(xtim) - Cycle time, XTIMCLK // (2) WS refers to the number of wait states inserted by hardware when using XREADY. If the zone is configured to ignore XREADY // (USEREADY= 0) then WS = 0. EALLOW; // Zone write timing zone->bit.XWRLEAD = cfg->XWRLEAD; zone->bit.XWRACTIVE = cfg->XWRACTIVE; zone->bit.XWRTRAIL = cfg->XWRTRAIL; // Zone read timing zone->bit.XRDLEAD = cfg->XRDLEAD; zone->bit.XRDACTIVE = cfg->XRDACTIVE; zone->bit.XRDTRAIL = cfg->XRDTRAIL; // double all Zone read/write lead/active/trail timing zone->bit.X2TIMING = cfg->X2TIMING; // Zone will sample XREADY signal zone->bit.USEREADY = cfg->USEREADY; zone->bit.READYMODE = cfg->READYMODE; // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved zone->bit.XSIZE = cfg->XSIZE; EDIS; } void InitZone7(void) { #if(USE_XINTF_ZONE7) struct XTIMING_BITS cfg; // Zone 7------------------------------------ // ๆฉ็‚ดๅธด้จๅ‹ฌๆงธFLASH, SST39VF800A-70, ้—๏ฟฝ0ns #if(SYSCLKOUT_MHZ == 150) // F28335้”›ๅญฒYSCLK=150Mhz -> 6.7ns // Zone write timing cfg.XWRLEAD = 1; // one XTIMCLK cycle. cfg.XWRACTIVE = 1; // two XTIMCLK cycle. cfg.XWRTRAIL = 0; // Zone read timing cfg.XRDLEAD = 1; cfg.XRDACTIVE = 1; cfg.XRDTRAIL = 0; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 0; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #elif(SYSCLKOUT_MHZ == 90) // SYSCLK=90Mhz -> 11.11ns // Zone write timing cfg.XWRLEAD = 1; // one XTIMCLK cycle. cfg.XWRACTIVE = 2; // two XTIMCLK cycle. cfg.XWRTRAIL = 0; // Zone read timing cfg.XRDLEAD = 1; cfg.XRDACTIVE = 2; cfg.XRDTRAIL = 0; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 0; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #endif ConfigureXTIMING(&XintfRegs.XTIMING7, &cfg); // Bank switching // Assume Zone 7 is slow, so add additional BCYC cycles // when ever switching from Zone 6 to another Zone. // This will help avoid bus contention. // EALLOW; // XintfRegs.XBANK.bit.BANK = 7; // XintfRegs.XBANK.bit.BCYC = 7; // EDIS; //Force a pipeline flush to ensure that the write to //the last register configured occurs before returning. #endif } void InitZone6(void) { #if(USE_XINTF_ZONE6) struct XTIMING_BITS cfg; // Zone 6------------------------------------ #if(SYSCLKOUT_MHZ == 150) // ๅฏฎ๏ฟฝๅฝ‚้‰่ทจๆฎ‘zone7ๆฉ็‚ตๆฎ‘้„็–ชAM้‘บ๎ˆœๅข–้”›ๆฌผS61LV256(512)16-10, 10ns // ๅฏฎ๏ฟฝๅฝ‚้‰่ทจๆฎ‘้ขใ„งๆฎ‘F28335้”›ๅญฒYSCLK=150Mhz -> 6.7ns // Zone write timing cfg.XWRLEAD = 1; // one XTIMCLK cycle. cfg.XWRACTIVE = 7; // two XTIMCLK cycle. cfg.XWRTRAIL = 1; // Zone read timing cfg.XRDLEAD = 1; cfg.XRDACTIVE = 7; cfg.XRDTRAIL = 1; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 1; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #elif(SYSCLKOUT_MHZ == 90) // SYSCLK=90Mhz -> 11.11ns // Zone write timing cfg.XWRLEAD = 1; // one XTIMCLK cycle. cfg.XWRACTIVE = 1; // two XTIMCLK cycle. cfg.XWRTRAIL = 0; // Zone read timing cfg.XRDLEAD = 1; cfg.XRDACTIVE = 1; cfg.XRDTRAIL = 0; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 0; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #endif // Zone 6------------------------------------ ConfigureXTIMING(&XintfRegs.XTIMING6, &cfg); // Bank switching // Assume Zone 6 is slow, so add additional BCYC cycles // when ever switching from Zone 6 to another Zone. // This will help avoid bus contention. // EALLOW; // XintfRegs.XBANK.bit.BANK = 6; // XintfRegs.XBANK.bit.BCYC = 6; // EDIS; #endif } void InitZone0(void) { #if(USE_XINTF_ZONE0) struct XTIMING_BITS cfg; // Zone 0------------------------------------ #if(SYSCLKOUT_MHZ == 150) // ๅฏฎ๏ฟฝๅฝ‚้‰่ทจๆฎ‘zone7ๆฉ็‚ตๆฎ‘้„็–ชAM้‘บ๎ˆœๅข–้”›ๆฌผS01LV256(512)16-10, 10ns // ๅฏฎ๏ฟฝๅฝ‚้‰่ทจๆฎ‘้ขใ„งๆฎ‘F28335้”›ๅญฒYSCLK=150Mhz -> 6.7ns // Zone write timing cfg.XWRLEAD = 1; // one XTIMCLK cycle. cfg.XWRACTIVE = 7; // two XTIMCLK cycle. cfg.XWRTRAIL = 1; // Zone read timing cfg.XRDLEAD = 1; cfg.XRDACTIVE = 7; cfg.XRDTRAIL = 1; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 1; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #elif(SYSCLKOUT_MHZ == 90) // SYSCLK=90Mhz -> 11.11ns // Zone write timing cfg.XWRLEAD = 2; // one XTIMCLK cycle. cfg.XWRACTIVE = 2; // two XTIMCLK cycle. cfg.XWRTRAIL = 0; // Zone read timing cfg.XRDLEAD = 2; cfg.XRDACTIVE = 2; cfg.XRDTRAIL = 0; // double all Zone read/write lead/active/trail timing cfg.X2TIMING = 1; // Zone will sample XREADY signal cfg.USEREADY = 0; cfg.READYMODE = 1; // sample asynchronous // Size must be either: // 0,1 = x32 or // 1,1 = x16 other values are reserved cfg.XSIZE = 3; #endif // Zone 0------------------------------------ ConfigureXTIMING(&XintfRegs.XTIMING0, &cfg); // Bank switching // Assume Zone 0 is slow, so add additional BCYC cycles // when ever switching from Zone 0 to another Zone. // This will help avoid bus contention. // EALLOW; // XintfRegs.XBANK.bit.BANK = 0; // XintfRegs.XBANK.bit.BCYC = 0; // EDIS; #endif } void InitXintf(void) { // ------------------------------------------------------- // Step 2. Make sure the XINTF clock is enabled // EALLOW; SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1; // ------------------------------------------------------ // Step 3. Configure the XTIMCLK and XCLKOUT // // XTIMCLK: // 000 XTIMCLK = SYSCLKOUT/1 // 001 XTIMCLK = SYSCLKOUT/2 (default) XintfRegs.XINTCNF2.bit.XTIMCLK = 0; // ็’ๅ‰ง็–†้Žต๏ฟฝๆนๆพถๆ ญๅ„ด้–ๅ“„็…™ XTIMCLK = SYSCLKOUT // 3ๆถ“๎„ๅ•“็ผ‚ๆ’ณๅ•ฟ XintfRegs.XINTCNF2.bit.WRBUFF = 3; // XCLKOUT็š๎‚กๅจ‡้‘ณ๏ฟฝ XintfRegs.XINTCNF2.bit.CLKOFF = 0; // CLKMODE: // 0 XCLKOUT is equal to XTIMCLK // 1 XCLKOUT is a divide by 2 of XTIMCLK (default) XintfRegs.XINTCNF2.bit.CLKMODE = 0; // XCLKOUT = XTIMCLK EDIS; // ------------------------------------------------------ // Step 4. Initialize the specific zone. // // InitZone0(); // ่ฟๅŠจๅก็š„FPGA็”จ็š„zone0๏ผŒ InitZone6(); // ่ฟๅŠจๅก็š„EXTRAM็”จ็š„zone6๏ผŒ InitZone7(); // EXTFLASH็”จ็š„zone7๏ผŒ ไธ็”จXINTFใ€‚ InitXintf16Gpio(); // InitXintf32Gpio(); asm(" RPT #7 || NOP"); } void InitXintf32Gpio() { EALLOW; GpioCtrlRegs.GPBMUX2.bit.GPIO48 = 3; // XD31 GpioCtrlRegs.GPBMUX2.bit.GPIO49 = 3; // XD30 GpioCtrlRegs.GPBMUX2.bit.GPIO50 = 3; // XD29 GpioCtrlRegs.GPBMUX2.bit.GPIO51 = 3; // XD28 GpioCtrlRegs.GPBMUX2.bit.GPIO52 = 3; // XD27 GpioCtrlRegs.GPBMUX2.bit.GPIO53 = 3; // XD26 GpioCtrlRegs.GPBMUX2.bit.GPIO54 = 3; // XD25 GpioCtrlRegs.GPBMUX2.bit.GPIO55 = 3; // XD24 GpioCtrlRegs.GPBMUX2.bit.GPIO56 = 3; // XD23 GpioCtrlRegs.GPBMUX2.bit.GPIO57 = 3; // XD22 GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 3; // XD21 GpioCtrlRegs.GPBMUX2.bit.GPIO59 = 3; // XD20 GpioCtrlRegs.GPBMUX2.bit.GPIO60 = 3; // XD19 GpioCtrlRegs.GPBMUX2.bit.GPIO61 = 3; // XD18 GpioCtrlRegs.GPBMUX2.bit.GPIO62 = 3; // XD17 GpioCtrlRegs.GPBMUX2.bit.GPIO63 = 3; // XD16 GpioCtrlRegs.GPBQSEL2.bit.GPIO48 = 3; // XD31 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO49 = 3; // XD30 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO50 = 3; // XD29 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO51 = 3; // XD28 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO52 = 3; // XD27 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO53 = 3; // XD26 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO54 = 3; // XD25 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO55 = 3; // XD24 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO56 = 3; // XD23 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO57 = 3; // XD22 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO58 = 3; // XD21 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO59 = 3; // XD20 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO60 = 3; // XD19 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO61 = 3; // XD18 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO62 = 3; // XD17 asynchronous input GpioCtrlRegs.GPBQSEL2.bit.GPIO63 = 3; // XD16 asynchronous input InitXintf16Gpio(); } void InitXintf16Gpio() { EALLOW; GpioCtrlRegs.GPCMUX1.bit.GPIO64 = 3; // XD15 GpioCtrlRegs.GPCMUX1.bit.GPIO65 = 3; // XD14 GpioCtrlRegs.GPCMUX1.bit.GPIO66 = 3; // XD13 GpioCtrlRegs.GPCMUX1.bit.GPIO67 = 3; // XD12 GpioCtrlRegs.GPCMUX1.bit.GPIO68 = 3; // XD11 GpioCtrlRegs.GPCMUX1.bit.GPIO69 = 3; // XD10 GpioCtrlRegs.GPCMUX1.bit.GPIO70 = 3; // XD19 GpioCtrlRegs.GPCMUX1.bit.GPIO71 = 3; // XD8 GpioCtrlRegs.GPCMUX1.bit.GPIO72 = 3; // XD7 GpioCtrlRegs.GPCMUX1.bit.GPIO73 = 3; // XD6 GpioCtrlRegs.GPCMUX1.bit.GPIO74 = 3; // XD5 GpioCtrlRegs.GPCMUX1.bit.GPIO75 = 3; // XD4 GpioCtrlRegs.GPCMUX1.bit.GPIO76 = 3; // XD3 GpioCtrlRegs.GPCMUX1.bit.GPIO77 = 3; // XD2 GpioCtrlRegs.GPCMUX1.bit.GPIO78 = 3; // XD1 GpioCtrlRegs.GPCMUX1.bit.GPIO79 = 3; // XD0 GpioCtrlRegs.GPBMUX1.bit.GPIO40 = 3; // XA0/XWE1n GpioCtrlRegs.GPBMUX1.bit.GPIO41 = 3; // XA1 GpioCtrlRegs.GPBMUX1.bit.GPIO42 = 3; // XA2 GpioCtrlRegs.GPBMUX1.bit.GPIO43 = 3; // XA3 GpioCtrlRegs.GPBMUX1.bit.GPIO44 = 3; // XA4 GpioCtrlRegs.GPBMUX1.bit.GPIO45 = 3; // XA5 GpioCtrlRegs.GPBMUX1.bit.GPIO46 = 3; // XA6 GpioCtrlRegs.GPBMUX1.bit.GPIO47 = 3; // XA7 GpioCtrlRegs.GPCMUX2.bit.GPIO80 = 3; // XA8 GpioCtrlRegs.GPCMUX2.bit.GPIO81 = 3; // XA9 GpioCtrlRegs.GPCMUX2.bit.GPIO82 = 3; // XA10 GpioCtrlRegs.GPCMUX2.bit.GPIO83 = 3; // XA11 GpioCtrlRegs.GPCMUX2.bit.GPIO84 = 3; // XA12 GpioCtrlRegs.GPCMUX2.bit.GPIO85 = 3; // XA13 GpioCtrlRegs.GPCMUX2.bit.GPIO86 = 3; // XA14 GpioCtrlRegs.GPCMUX2.bit.GPIO87 = 3; // XA15 GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 3; // XA16 GpioCtrlRegs.GPAMUX2.bit.GPIO31 = 3; // XA17 GpioCtrlRegs.GPAMUX2.bit.GPIO30 = 3; // XA18 GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 3; // XA19 GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 3; // XREADY GpioCtrlRegs.GPBMUX1.bit.GPIO35 = 3; // XRNW GpioCtrlRegs.GPBMUX1.bit.GPIO38 = 3; // XWE0 GpioCtrlRegs.GPBMUX1.bit.GPIO36 = 3; // XZCS0 GpioCtrlRegs.GPBMUX1.bit.GPIO37 = 3; // XZCS7 GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 3; // XZCS6 EDIS; } // // SRC/DST_ADDR // The value written into the shadow register // // is the start address of the first location where data is read or written to. // // SRC/DST_BEG_ADDR// On a wrap condition, the active register will be incremented by the signed value in the // // appropriate SRC/DST_WRAP_STEP register prior to being loaded into the active SRC/DST_ADDR register. // // BURST_SIZE // 16 or 32, the smallest amount of data that can be transferred at one time // // This specifies the number of words to be transferred in a burst. // // This value is loaded into the BURST_COUNT register at the beginning of each burst. // // TRANSFER_SIZE // How many bursts are performed in the entire transfer. // // This specifies the number of bursts to be transferred before per CPU interrupt (if enabled). // // This value is loaded into the TRANSFER_COUNT register at the beginning of each transfer. // // DATASIZE // NOTE: The value written to the SIZE registers is one less than the intended size. So, to transfer // three 16-bit words, the value 2 should be placed in the SIZE register. // Regardless of the state of the DATASIZE bit, the value specified in the SIZE registers are for // 16-bit addresses. So, to transfer three 32-bit words, the value 5 should be placed in the SIZE // register. // // MODE.CHx[CONTINUOUS] // MODE.CHx[ONESHOT] // DMA transfers one burst of data each time // MODE.CHx[CHINTMODE] // DMA interrupt // Whether this interrupt is generated at the beginning or the end of the transfer is defined in the // CHINTMODE bit in the MODE register. Whether the channel remains enabled or not after the // transfer is completed is defined by the CONTINUOUS bit in the MODE register. // // SRC/DST_WRAP_SIZE // This specifies the number of bursts to be transferred before the current address pointer wraps around to the beginning. // // To disable the wrap function, assign the value of these registers to be larger than the TRANSFER_SIZE. // // // For each source/destination pointer, the address changes can be controlled with the following step values: // SRC/DST_BURST_STEP // Within each burst transfer, the address source and destination step sizes are specified by these registers. // This value is a signed 2's compliment number. If no increment is desired, // such as when accessing the McBSP data, the value of these registers should be set to zero. // // // SRC/DST_TRANSFER_STEP // This specifies the address offset to start the next burst transfer after completing the current burst transfer. // // SRC/DST_WRAP_STEP // When the wrap counter reaches zero, this value specifies the number of words to add/subtract // // from the BEG_ADDR pointer and hence sets the new start address. // // // // The appropriate active SRC/DST_BEG_ADDR register is incremented by the signed value contained // in the SRC/DST_WRAP_STEP register, then // // ้ˆฅ๏ฟฝThe new active SRC/DST_BEG_ADDR register is loaded into the active SRC/DST_ADDR register. // // SRC/DST_BEG_ADDR // SRC/DST_TRANSFER_STEP //=========================================================================== // No more. //===========================================================================
f3337e462ecad83ea292392943ecab1305ebff69
a1c504ff289f7b1d18d2e2485a43346a3711554b
/src/corewar/operation/loadindex_op.c
12738355559ef0588e531196e9712fa4e19d8ff6
[]
no_license
nvd-ros/corewar
227288154843bd67c175c3872dfa5c11a487c863
4a2a68a6571bf29e95d01c4428ca1e56217587b8
refs/heads/master
2021-10-18T05:06:08.361967
2019-02-13T16:48:52
2019-02-13T16:48:52
null
0
0
null
null
null
null
UTF-8
C
false
false
1,920
c
loadindex_op.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* loadindex_op.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rnovodra <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/23 16:37:59 by rnovodra #+# #+# */ /* Updated: 2018/11/23 16:37:59 by rnovodra ### ########.fr */ /* */ /* ************************************************************************** */ #include "corewar.h" inline static void print_info(t_process *const pc, int reg, int *val, int res) { ft_printf("P %4u | %s %d %d r%d\n" " | -> load from %d + %d = %d ", pc->id, g_op_tab[pc->opcode].name, val[0], val[1], reg, val[0], val[1], val[0] + val[1]); if (pc->opcode == 10) ft_printf("(with pc and mod %d)\n", pc->pos + res); else ft_printf("(with pc %d)\n", pc->pos + res); } void loadindex_op(t_data *d, t_process *const pc) { unsigned char arg[MAX_ARGS_NUMBER]; short int reg; short int offset; int val[2]; int res; offset = 2; if (hanlde_codage(arg, pc->opcode, d->memory[PC_POS(1)]) == 0) { val[0] = get_arg_val(d, pc, arg[0], &offset); val[1] = get_arg_val(d, pc, arg[1], &offset); reg = get_reg(d, pc, &offset); if (reg != -1 && !pc->error) { res = (val[0] + val[1]); if (pc->opcode == 10) res %= IDX_MOD; set_reg(pc, reg, get_arg(d, PC_POS(res), 4)); if (d->info & 4) print_info(pc, reg, val, res); } } change_pc_pos(pc, pc->opcode, arg); }
e878206a0b6ce124179fa4cdeb355bc5ac0ee674
c45d4b198b86c70e8dba8480ef80e3476dafc988
/WarShipBoard/Driver/DriverBoard/BoardRS232.c
75747b385b67c46e09934b6d6ac057f289b5b5bb
[ "MIT" ]
permissive
lkdingbao/STM32F407
802f92e34bbd9d666276e656b20279ce91ef0808
bed4d3b114f45b5690650f2fd91557f42e81cbd6
refs/heads/master
2022-12-29T19:48:09.403612
2020-10-06T14:42:05
2020-10-06T14:42:05
null
0
0
null
null
null
null
UTF-8
C
false
false
1,468
c
BoardRS232.c
/******************************************************************* **Description: Copyright(c) 2018-2090 DengXiaojun,All rights reserved. **Author: DengXiaoJun **Date: 2020-09-26 14:36:49 **LastEditors: DengXiaoJun **LastEditTime: 2020-10-05 20:41:51 **FilePath: \HardWareCheckUCOS3.08d:\DinkGitHub\STM32F407\WarShipBoard\Driver\DriverBoard\BoardRS232.c **ModifyRecord1: ******************************************************************/ #include "BoardRS232.h" //ไธฒๅฃๅˆๅง‹ๅŒ– void BoardRS232_Init(RS232_NAME rsPort,uint32_t baud, MCU_UART_LENGTH length, MCU_UART_STOPBIT stopBit,MCU_UART_CHECK_MODE checkMode, MCU_UART_HARD_CONTROL hardWareControl, MCU_UartRecvIntProcFunc rxCallBack) { if(rsPort == RS232_COM2) { MCU_Uart2Init(baud,length,stopBit,checkMode,hardWareControl,rxCallBack); } else { MCU_Uart3Init(baud,length,stopBit,checkMode,hardWareControl,rxCallBack); } } //ไธฒๅฃๅ‘้€ๆ•ฐ็ป„ void BoardRS232_SendBuffer(RS232_NAME rsPort,uint8_t* bufferStartPtr,uint16_t sendLength) { if(rsPort == RS232_COM2) { MCU_Uart2SendBuffer(bufferStartPtr,sendLength); } else { MCU_Uart3SendBuffer(bufferStartPtr,sendLength); } } //ไธฒๅฃๅ‘้€ๅญ—็ฌฆไธฒ void BoardRS232_SendString(RS232_NAME rsPort,uint8_t* stringStartPtr) { if(rsPort == RS232_COM2) { MCU_Uart2SendString(stringStartPtr); } else { MCU_Uart3SendString(stringStartPtr); } }
90b052875c02755502e0d9a7b80aebebe3d08b20
6000d2a9432e00f24ec9d76dcebb2038195016df
/Fitel/CommonLibrary/Category/CGRectAdditions.h
837e29f4562ff1957b26c709dacbd67c2c14b415
[]
no_license
JamesChenGithub/Fitel
3e3246cefe753ed9eb7d4b9d37ef4a17b36199c4
f92b43a44d5c193a33bb12d321475d02f2fa315c
refs/heads/master
2016-09-05T16:24:28.873177
2015-03-20T15:07:48
2015-03-20T15:07:48
31,307,149
3
0
null
null
null
null
UTF-8
C
false
false
825
h
CGRectAdditions.h
// // CGRectAdditions.h // FitelCommon // // Created by ้™ˆ่€€ๆญฆ on 14-2-21. // Copyright (c) 2014ๅนด Fitel. All rights reserved. // #ifndef FitelCommon_CGRectAdditions_h #define FitelCommon_CGRectAdditions_h static __inline__ CGRect CGRectFromCGSize( CGSize size ) { return CGRectMake( 0, 0, size.width, size.height ); }; static __inline__ CGRect CGRectMakeWithCenterAndSize( CGPoint center, CGSize size ) { return CGRectMake( center.x - size.width/2, center.y - size.height/2, size.width, size.height); }; static __inline__ CGRect CGRectMakeWithOriginAndSize( CGPoint origin, CGSize size ) { return CGRectMake( origin.x, origin.y, size.width, size.height ); }; static __inline__ CGPoint CGRectCenter( CGRect rect ) { return CGPointMake( CGRectGetMidX( rect ), CGRectGetMidY( rect ) ); }; #endif
420410976866ff33e076292a3c3e3886aa6c05cc
032122f0a1848d48cfd16dd94357bf92eaf4af23
/leetcode/1034_coloring_a_border.h
7c862d2dbcc571135e1ec51ecdcd179a735405f9
[]
no_license
runningrunning/wasteland
380510a0074b19bcd281ad3711cf43cbd30a5070
f25148816cfe3ae0709e795be2a69e55630975f2
refs/heads/master
2023-03-11T03:01:13.794859
2021-02-26T08:50:11
2021-02-26T08:50:11
184,945,993
2
0
null
null
null
null
UTF-8
C
false
false
1,745
h
1034_coloring_a_border.h
/** * Return an array of arrays of size *returnSize. * The sizes of the arrays are returned as *returnColumnSizes array. * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free(). */ void _color(int** g, int r, int c, int x, int y, int oc, int nc) { if (x < 0 || x >= r || y < 0 || y >= c) return; if (g[x][y] == nc || g[x][y] != oc) return; g[x][y] = nc; _color(g, r, c, x - 1, y, oc, nc); _color(g, r, c, x + 1, y, oc, nc); _color(g, r, c, x, y - 1, oc, nc); _color(g, r, c, x, y + 1, oc, nc); } int** colorBorder(int** grid, int gridSize, int* gridColSize, int r0, int c0, int color, int* returnSize, int** returnColumnSizes) { *returnSize = gridSize; *returnColumnSizes = gridColSize; if (!gridSize || !gridColSize || !gridColSize[0]) return grid; int oc = grid[r0][c0]; int nc = color; _color(grid, gridSize, gridColSize[0], r0, c0, oc, -nc); for (int i = 1; i < gridSize - 1; i ++) for (int j = 1; j < gridColSize[0] - 1; j ++) { if (grid[i][j] != - nc) continue; // careful here !!!!! if ((grid[i - 1][j] == - nc || grid[i - 1][j] == - oc) && (grid[i + 1][j] == - nc || grid[i + 1][j] == - oc) && (grid[i][j - 1] == - nc || grid[i][j - 1] == - oc) && (grid[i][j + 1] == - nc || grid[i][j + 1] == - oc)) grid[i][j] = - oc; } for (int i = 0; i < gridSize; i ++) for (int j = 0; j < gridColSize[0]; j ++) { if (grid[i][j] == -oc) grid[i][j] = oc; else if (grid[i][j] == -nc) grid[i][j] = nc; } return grid; }
3a6b2ea346b78ddaf9d15631b4ba48d0cebc3056
0c846407b8c1356580208e2fff8c86e5e54f5b47
/original/GenProg/schedule/rds/v4/8/result/processor.c
c3555b1a654cf875c0f125522ae71469d3517cee
[]
no_license
ymxl85/MRs-based-test-suite-for-APR
3522691bab1b8f126ed47ee930895e7b98a222a3
b6c6e7e027629fef00e737726161970760a2d560
refs/heads/master
2020-11-29T22:26:05.610363
2020-04-27T02:59:34
2020-04-27T02:59:34
230,019,140
0
0
null
null
null
null
UTF-8
C
false
false
898
c
processor.c
#include <stdio.h> #include "processor.h" float getOperand(char * str) { float r=0.0; char b[10]; int i,j,len; int minus=0; int value; i=strlen(str)-1; while(i>=0 && str[i]=='0') { i--; minus++; } /*if(i<0) { b[0]=0;b[1]='\0'; value=atoi(b); r=value*1.00; return r; }*/ i=0; while(str[i]!='\0' && str[i]=='0') { i++; } j=0; while(str[i]!='\0') { b[j]=str[i]; j++; i++; } b[j]='\0'; len=i-minus; value=atoi(b); r=value*1.00; for(j=0;j<len;j++) { r=r*0.1; } // printf("%f\n",r); return r; } //----------------------------------------------------------------- void getAdata(char * str,int *pos, char * s) { int i=0; while(str[*pos]!='\0' && str[*pos]!=' ' && str[*pos]!='\n') { s[i]=str[*pos]; i++; (*pos)++; } s[i]='\0'; while(str[*pos]==' ') { (*pos)++; } }
cca74dd560bfae72ef8b8866e1d3e597f5e702c2
51635684d03e47ebad12b8872ff469b83f36aa52
/external/gcc-12.1.0/gcc/testsuite/gcc.target/msp430/pr78818-data-region.c
5b0721e728a4521eede85d25293ba326cd8857ad
[ "LGPL-2.1-only", "FSFAP", "LGPL-3.0-only", "GPL-3.0-only", "GPL-2.0-only", "GCC-exception-3.1", "LGPL-2.0-or-later", "Zlib", "LicenseRef-scancode-public-domain" ]
permissive
zhmu/ananas
8fb48ddfe3582f85ff39184fc7a3c58725fe731a
30850c1639f03bccbfb2f2b03361792cc8fae52e
refs/heads/master
2022-06-25T10:44:46.256604
2022-06-12T17:04:40
2022-06-12T17:04:40
30,108,381
59
8
Zlib
2021-09-26T17:30:30
2015-01-31T09:44:33
C
UTF-8
C
false
false
285
c
pr78818-data-region.c
/* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } { "" } } */ /* { dg-options "-mlarge -mdata-region=either" } */ /* { dg-final { scan-assembler-not "\\.either\\.data" } } */ /* { dg-final { scan-assembler-not "\\.either\\.bss" } } */ #include "pr78818-real.c"
6d70c392baba5c9958782975f73978bf0684e215
1a325b810a9488dc82934ce9809dd8954d8ce06c
/utils.h
9ffb7a2520feb958933a34f164a5a210be7f00c4
[ "BSD-2-Clause" ]
permissive
Fruneau/libcommon
91aeade5371a5649cd90f24ef76cf461fc11383d
29ae0bdd18c52577baaa7641147ad6c1f2d21c9c
refs/heads/master
2021-01-02T09:08:08.662294
2017-01-08T21:55:41
2017-01-08T21:55:41
5,222,156
7
2
null
2017-01-08T21:55:42
2012-07-29T12:24:26
C
UTF-8
C
false
false
5,064
h
utils.h
/****************************************************************************/ /* pfixtools: a collection of postfix related tools */ /* ~~~~~~~~~ */ /* ______________________________________________________________________ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* 1. Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* 2. Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* 3. The names of its contributors may not be used to endorse or promote */ /* products derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY */ /* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */ /* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE */ /* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */ /* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */ /* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */ /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE */ /* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /* Copyright (c) 2006-2014 the Authors */ /* see AUTHORS and source files for details */ /****************************************************************************/ #ifndef PFIXTOOLS_UTILS_H #define PFIXTOOLS_UTILS_H #include "common.h" #include "buffer.h" typedef uint32_t ip4_t; typedef uint8_t ip6_t[16]; typedef union ip_t { ip4_t v4; ip6_t v6; } ip_t; typedef uint8_t cidrlen_t; /** Parse an IPv4 from a string. */ __attribute__((nonnull)) bool ip_parse_4(ip4_t *restrict ip, const char* restrict txt, ssize_t len); /** Read an IPv4 from a buffer in network order. */ __attribute__((nonnull)) static inline ip4_t ip_read_4(const uint8_t *restrict data); /** Compute the IPv4 network mask for the given CIDR length */ __attribute__((pure)) static ip4_t ip_mask_4(cidrlen_t cidr_len); /** Compare two IPv4 with the given cidr mask len. */ static inline bool ip_compare_4(ip4_t ip1, ip4_t ip2, cidrlen_t cidr_len); /** Print an IPv4 in the buffer. */ bool ip_print_4(buffer_t *buffer, ip4_t ip, bool display, bool reverse); /** Parse an IPv6 from a string. */ __attribute__((nonnull)) bool ip_parse_6(ip6_t ip, const char* restrict txt, ssize_t len); /** Compare two IPv6 with the given cird mask len. */ static inline bool ip_compare_6(const ip6_t ip1, const ip6_t ip2, cidrlen_t cidr_len); /** Print an IPv6 in the buffer. */ bool ip_print_6(buffer_t *buffer, const ip6_t ip, bool display, bool reverse); static inline ip4_t ip_mask_4(cidrlen_t cidr_len) { if (likely(cidr_len > 0 && cidr_len <= 32)) { return (0xffffffff) << (32 - cidr_len); } else if (likely(cidr_len == 0)) { return 0; } else { return 0xffffffff; } } static inline bool ip_compare_4(ip4_t ip1, ip4_t ip2, cidrlen_t cidr_len) { const ip4_t mask = ip_mask_4(cidr_len); return (ip1 & mask) == (ip2 & mask); } static inline bool ip_compare_6(const ip6_t ip1, const ip6_t ip2, cidrlen_t cidr_len) { size_t bytes = cidr_len >> 3; int bits = cidr_len & 7; if (bytes > 0) { if (memcmp(ip1, ip2, bytes) != 0) { return false; } } if (bits > 0) { return (ip1[bytes] >> (8 - bits)) == (ip2[bytes] >> (8 - bits)); } return true; } static inline ip4_t ip_read_4(const uint8_t *restrict data) { return (ip4_t)(data[0] << 24) | (ip4_t)((data[1]) << 16) | (ip4_t)((data[2]) << 8) | (ip4_t)data[3]; } #endif /* vim:set et sw=4 sts=4 sws=4: */
4f4e89a3e7a83549bb448b36b29016704b41a237
6a7a4794224ac8c8025201cbb9abd9af7f5e590d
/src/LCDShiftReg.c
3eb7289494569e51cd2124a947487902bfc768e5
[]
no_license
ideras/pic-lcd-library
d214659f59e33cffb4ac112aeaf680f89f916b4f
1ae51460019d09cda3bbd52d402b2ba66dbc8be0
refs/heads/master
2021-01-15T13:44:47.012915
2015-06-26T02:41:08
2015-06-26T02:41:08
5,574,489
4
2
null
null
null
null
UTF-8
C
false
false
4,991
c
LCDShiftReg.c
// Original library created by Francisco Malpartida on 20/08/11. // Copyright 2011 - Under creative commons license 3.0: // Attribution-ShareAlike CC BY-SA // // Ported to PIC microcontrollers by Ivan de Jesus Deras (ideras@gmail.com) // // You can find more information of the original library at: // https://github.com/marcmerlin/NewLiquidCrystal #include <stdio.h> #include "LCD.h" // bitmasks for control bits on shift register #define SR_EN_BIT 0b00010000 // LCD Data enable bit. #define SR_RW_BIT 0b00100000 // RW can be pinned low since we only send #define SR_RS_BIT 0b01000000 // LOW: command. HIGH: character. static void shiftOut(volatile uint8_t *port, uint8_t dataPin, uint8_t clockPin, uint8_t val) { uint8_t i; for (i = 0; i < 8; i++) { if ((val & (1 << i)) != 0) setBit(port, dataPin); else clearBit(port, dataPin); setBit(port, clockPin); clearBit(port, clockPin); } } static void _pushOut(struct LCD *this, uint8_t nibble) { // Make data available for pushing to the LCD. shiftOut(this->i.sri.sr_port, this->i.sri.srdata_pin, this->i.sri.srclock_pin, nibble); // Make new data active. setBit(this->i.sri.sr_port, this->i.sri.strobe_pin); waitUsec(1); // strobe pulse must be >450ns (old code had 10ms) clearBit(this->i.sri.sr_port, this->i.sri.strobe_pin); waitUsec(40); // commands need > 37us to settle } static void write4bits(struct LCD *this, uint8_t nibble) { nibble &= ~SR_RW_BIT; // set RW LOW (we do this always since we only write). // Send a High transition to display the data that was pushed nibble |= SR_EN_BIT; // LCD Data Enable HIGH _pushOut(this, nibble); nibble &= ~SR_EN_BIT; // LCD Data Enable LOW _pushOut(this, nibble); } // Parallel Send Data/Command to the LCD static void LCD_shiftRegSend(struct LCD *this, uint8_t value, uint8_t mode) { uint8_t nibble; mode = mode ? SR_RS_BIT : 0; // RS bit; LOW: command. HIGH: character. nibble = value >> 4; // Get high nibble. write4bits(this, nibble | mode); //delay(1); // This was in the LCD3 code but does not seem needed -- merlin nibble = value & 0x0f; // Get low nibble write4bits(this, nibble | mode); } void LCD_beginShiftReg(struct LCD *this, uint8_t cols, uint8_t lines, uint8_t dotsize) { uint8_t i; if (lines > 1) { this->displayfunction |= LCD_2LINE; } this->numlines = lines; this->cols = cols; // for some 1 line displays you can select a 10 pixel high font // ------------------------------------------------------------ if ((dotsize != 0) && (lines == 1)) { this->displayfunction |= LCD_5x10DOTS; } // SEE PAGE 45/46 FOR INITIALIZATION SPECIFICATION! // according to datasheet, we need at least 40ms after power rises above 2.7V // before sending commands. Arduino can turn on way before 4.5V so we'll wait // 50. // Note from Ivan Deras: I don't know if this is necessary in PIC, but it shouldn't matter anyway. // --------------------------------------------------------------------------- for (i=0; i<5; i++) { __delay_ms(10); } // This init is copied verbatim from the spec sheet. // 8 bit codes are shifted to 4 bit write4bits(this, (LCD_FUNCTIONSET | LCD_8BITMODE) >> 4); __delay_us(4500); // wait more than 4.1ms // Second try write4bits(this, (LCD_FUNCTIONSET | LCD_8BITMODE) >> 4); __delay_us(150); // Third go write4bits(this, (LCD_FUNCTIONSET | LCD_8BITMODE) >> 4); // And finally, set to 4-bit interface write4bits(this, (LCD_FUNCTIONSET | LCD_4BITMODE) >> 4); // Set # lines, font size, etc. LCD_command(this, LCD_FUNCTIONSET | this->displayfunction); // Turn the display on with no cursor or blinking default this->displaycontrol = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; LCD_display(this); // Clear it off LCD_clear(this); // Initialize to default text direction (for romance languages) this->displaymode = LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; // set the entry mode LCD_command(this, LCD_ENTRYMODESET | this->displaymode); LCD_home(this); } void LCD_initShiftReg(struct LCD *this, volatile uint8_t *sr_port, uint8_t srdata, uint8_t srclock, uint8_t strobe) { this->displayfunction = LCD_4BITMODE | LCD_1LINE | LCD_5x10DOTS; // Initialize private variables this->i.sri.sr_port = sr_port; this->i.sri.srdata_pin = srdata; this->i.sri.srclock_pin = srclock; this->i.sri.strobe_pin = strobe; // Initialize _strobe_pin at low. clearBit(sr_port, strobe); // Little trick to force a pulse of the LCD enable bit and make sure it is // low before we start further writes since this is assumed. write4bits(this, 0); this->send = &LCD_shiftRegSend; this->begin = &LCD_beginShiftReg; }
7490b2c643d57ff8e0dc1aaf45677199e8522f68
1802fdcd9763c40f4dcb2d5bfefdc7e1627430b9
/examples/xenomai3/userspace_programs/isr/isr.c
f3e6f78760291dd36baa6f74754b853a233d4881
[]
no_license
capitaneanu/xenomai3_rpi_gpio
2cabad23651c329ffed0e870cb5481788d4fd6a3
a506f6d87b906aa0757df0111671484fe1d3b0dc
refs/heads/master
2023-03-16T11:51:18.306232
2020-04-08T10:09:29
2020-04-08T10:09:29
null
0
0
null
null
null
null
UTF-8
C
false
false
3,596
c
isr.c
#include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <alchemy/task.h> #include <alchemy/timer.h> #include <rtdm/gpio.h> #define IN 0 #define OUT 1 #define LOW 0 #define HIGH 1 #define POUT 22 #define PIN 23 RTIME SEC = 1000000000llu; RTIME MSEC = 1000000llu; RTIME USEC = 1000llu; RT_TASK blink_task, hello_task, startTasks; RT_TASK isr_task; #define VALUE_MAX 33 static int fd_in=0; static int GPIOInterruptInit(int pin) { int fd=0; int do_select = 0; //int trigger = GPIO_TRIGGER_LEVEL_LOW; int trigger = GPIO_TRIGGER_EDGE_FALLING; /* } trigger_types[] = { { .name = "edge", .flag = GPIO_TRIGGER_EDGE_RISING }, { .name = "edge-rising", .flag = GPIO_TRIGGER_EDGE_RISING }, { .name = "edge-falling", .flag = GPIO_TRIGGER_EDGE_FALLING }, { .name = "edge-both", .flag = GPIO_TRIGGER_EDGE_FALLING|GPIO_TRIGGER_EDGE_RISING }, { .name = "level", .flag = GPIO_TRIGGER_LEVEL_LOW }, { .name = "level-low", .flag = GPIO_TRIGGER_LEVEL_LOW }, { .name = "level-high", .flag = GPIO_TRIGGER_LEVEL_HIGH }, */ char path[VALUE_MAX]; snprintf(path, VALUE_MAX, "/dev/rtdm/pinctrl-bcm2835/gpio%d", pin); rt_printf("open device rdwr for interrupt: %s ---\n",path ); fd = open(path, O_RDWR); if (-1 == fd) { int errsv = errno; rt_printf("Failed to open gpio pin %d , return %d errno %d [%s]\n", pin,fd,errsv,strerror(-errsv)); // rt_printf("failed listening to gpio pin %d [%s]\n", pin, strerror(ret)); return -1 ; } rt_printf("Succes to open pin %d \n", pin); int ret = ioctl(fd, GPIO_RTIOC_IRQEN, &trigger); if (ret) { //ret = -errno; //warning("GPIO_RTIOC_IRQEN failed on %s [%s]", device, strerror(ret)); int errsv = errno; rt_printf("GPIO_RTIOC_IRQEN failed on gpio pin %d , return %d errno %d\n", pin,fd,errsv); return ret; } return fd; } void runIsr(void *args) { // NOTE: initialization code is within linux : none-realtime => should be done in advance int value; int ret; int fd=fd_in; int pin=PIN; int switch_count=0; int count=0; RTIME lasttime,now,lastbounce; lasttime =rt_timer_read(); lastbounce=lasttime; for (;;) { // wait for interrupt ret = read(fd, &value, sizeof(value)); count++; if (ret < 0) { ret = -errno; rt_printf("failed reading from gpio pin %d [%s]\n", pin, strerror(ret)); break; } // handle interrupt now =rt_timer_read(); // if ( now > lasttime + 300000000) { if ( now > lasttime ) { // new interrupt (no bounce) rt_printf("bounce time=%llu\n",lastbounce-lasttime); lasttime =now; // on new interrupt we assume switch is triggered and we toggle output rt_printf("\nINTERRUPT: received irq, GPIO state=%d count=%d\n", value,count); switch_count++; } else { // bounce: ignore bounce interrupts lastbounce=now; printf("BOUNCE: count=%d, time=%llu\n", count, now); } } } int main(int argc, char *argv[]) { fd_in=GPIOInterruptInit(PIN); rt_task_create(&isr_task, "IsrTask", 0, 40, 0); rt_task_start(&isr_task, &runIsr, NULL); getchar(); close(fd_in); return 0 ; }
2cf6e2e384453eac43358efc14e8c6ff8e12d247
419691817a8ff17fa003fa3d7575fa5d66fba170
/libft/ft_strrchr.c
7ff09fb34f900e1231ca7ba2512a29700ce0ff62
[]
no_license
BretzelLudique/get_next_line
1cba6c3eb99d657e5492d95f3ee1a03d5a1bb411
a240999149af18955d6b103cb90a989f5923a048
refs/heads/main
2022-12-27T22:16:05.063503
2020-10-18T07:31:25
2020-10-18T07:31:25
305,046,494
0
0
null
null
null
null
UTF-8
C
false
false
1,156
c
ft_strrchr.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strrchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: czhang <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/16 04:53:41 by czhang #+# #+# */ /* Updated: 2018/11/20 23:56:29 by czhang ### ########.fr */ /* */ /* ************************************************************************** */ char *ft_strrchr(const char *s, int c) { char c0; int i; int last; c0 = (char)c; i = -1; last = 0; while (s[++i]) if (s[i] == c0) last = i; if (s[i] == c0) return ((char*)(s + i)); if (s[last] == c0) return ((char*)(s + last)); return (0); }
8ca897b5ae8efdd388735017c69c07e78a12ff62
53a807507449594cb2aa4fe165c976ef3b5a6ef0
/Libft/ft_lstmap.c
99492e61d1bf7ffe53a52ff087943929b51fb522
[]
no_license
CheeseB/42SEOUL
4f575a4c6e6ef9d966806c5a045fa61bad750d18
3a00c29270c6cce30e655a48ab3fba0ac52afc27
refs/heads/master
2021-01-09T11:52:56.237430
2020-10-22T04:17:15
2020-10-22T04:17:15
242,290,650
0
0
null
null
null
null
UTF-8
C
false
false
1,245
c
ft_lstmap.c
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstmap.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: seongkim <seongki@student.42seoul.kr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/15 17:54:11 by seongkim #+# #+# */ /* Updated: 2020/04/20 20:56:55 by seongkim ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) { t_list *ptr; t_list *nxt; void *f_content; ptr = 0; while (lst) { f_content = f(lst->content); if (!(nxt = ft_lstnew(f_content))) { ft_lstclear(&ptr, del); return (0); } ft_lstadd_back(&ptr, nxt); lst = lst->next; } return (ptr); }
e7556e8bb4f46adfcaade9d34891c7134bdf25cc
9d4ebe19586fc61ad9a742a69f2827cf8e32161b
/Implementacoes/filacesar/filacomnodescritor/fila.c
12d6429b118e0a1f9b00cf998e63bd205df73c95
[]
no_license
italoneves/Estrutura.de.Dados-C
f4e21812cb7088152677bfc18d64df8645bf07b8
6f27ded1f4ee262708b1aec5c26a4e25e13d5aba
refs/heads/master
2023-05-26T07:46:20.593525
2021-06-11T14:17:03
2021-06-11T14:17:03
244,164,391
0
0
null
null
null
null
ISO-8859-1
C
false
false
1,823
c
fila.c
#include <stdlib.h> #include <stdio.h> #include "fila.h" head_fila * criar_fila( ){ head_fila * f = (head_fila*) malloc(sizeof(head_fila)); f->final = f->inicio = NULL; f->tam_fila = 0; return f; } int tamanho_fila( head_fila * f ){ // VERIFICA O TAMANHO DA FILA return f->tam_fila; } void elementoFrente( head_fila * f, int *valor ){ node * aux = f->inicio; *valor = aux->dado; } void enfileirar ( head_fila * f, int x ){ // ADICIONA NO FINAL DA FILA node * new_node = (node*)malloc(sizeof(node)); if(f->inicio==NULL){ // CONDIร‡รƒO DE FILA VAZIA f->inicio = f->final = new_node; // INICIO E FINAL APONTA PARA O NOVO NODE f->tam_fila++; // ATUALIZA O TAMANHO DA FILA new_node->next = NULL; new_node->dado = x; } else{ (f->final)->next = new_node; // BOTA O NOVO NODE NA FILA (COMO TEMOS O FINAL NรƒO PRECISAMOS PERCORRER ATร‰ NULL) f->final = new_node; // ATUALIZA O HEAD_FINAL new_node->next = NULL; new_node->dado = x; f->tam_fila++; // ATUALIZA O TAMANHO DA FILA } } void desenfileirar ( head_fila * f, int * x ){ // REMOVE DO รNICIO DA FILA *x = (f->inicio)->dado; // COPIA DO ELEMENTO QUE VAI SER RETIRADO node * aux = f->inicio; // SALVA A CABEร‡A DA LISTA PARA DEPOIS LIBERAR(FREE) if(f->inicio==f->final){ // CASO DE UM รšNICO ELEMENTO NA FILA f->inicio = f->final =NULL; } else{ f->inicio = (f->inicio)->next; // Ou aux->next // Da no mesmo } free(aux); // LIBEREI MEMร“RIA DO NODE QUE FOI RETIRADO f->tam_fila--; // DIMINUI TAMANHO DA FILA } void print_fila( head_fila * f ){ node * aux = f->inicio; printf("["); while(aux!=NULL){ printf("%d ", aux->dado); aux = aux->next; } printf("]"); }
a90fdd15be326fc121b8b04139152129018945de
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/sound/usb/line6/extr_driver.c_line6_hwdep_push_message.c
522a86d776eb3a65638c0fa272e63133db50ce95
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,272
c
extr_driver.c_line6_hwdep_push_message.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct TYPE_2__ {int /*<<< orphan*/ wait_queue; int /*<<< orphan*/ fifo; int /*<<< orphan*/ active; } ; struct usb_line6 {scalar_t__ message_length; TYPE_1__ messages; int /*<<< orphan*/ buffer_message; } ; /* Variables and functions */ scalar_t__ kfifo_avail (int /*<<< orphan*/ *) ; int /*<<< orphan*/ kfifo_in (int /*<<< orphan*/ *,int /*<<< orphan*/ ,scalar_t__) ; int /*<<< orphan*/ wake_up_interruptible (int /*<<< orphan*/ *) ; __attribute__((used)) static void line6_hwdep_push_message(struct usb_line6 *line6) { if (!line6->messages.active) return; if (kfifo_avail(&line6->messages.fifo) >= line6->message_length) { /* No race condition here, there's only one writer */ kfifo_in(&line6->messages.fifo, line6->buffer_message, line6->message_length); } /* else TODO: signal overflow */ wake_up_interruptible(&line6->messages.wait_queue); }
a4670de1e15836be1e726db37a2a99f863d7a2eb
e7f314ab4fe6b063a026cb9af0eb0ad0933f335d
/ZNuQ2Pt2eta_aa_all_allPt2_UML_bkgExpPol1_full_Tvz/data_FeD_Fe/rspic/hM1_4.C
c5fcfc9614ff96b84fe1efce8545927ca1804057
[]
no_license
orsosa/EG2_analysis
016f91bb3761b0cf309523837ebf2124944f8341
08cea395b98d050ea9ffbca866e267158578f147
refs/heads/master
2021-01-21T22:35:47.935595
2018-10-03T19:06:10
2018-10-03T19:06:10
102,161,447
0
0
null
null
null
null
UTF-8
C
false
false
58,171
c
hM1_4.C
{ //=========Macro generated from canvas: c/The canvas //========= (Thu May 3 15:53:21 2018) by ROOT version5.34/34 TCanvas *c = new TCanvas("c", "The canvas",1,1,920,666); gStyle->SetOptStat(0); c->SetHighLightColor(2); c->Range(0,0,1,1); c->SetBorderSize(2); c->SetFrameFillColor(0); // ------------>Primitives in pad: c_1 TPad *c_1 = new TPad("c_1", "c_1",0,0.4,1,1); c_1->Draw(); c_1->cd(); c_1->Range(0.125,-8.921671,0.875,883.2454); c_1->SetBorderSize(2); c_1->SetGridx(); c_1->SetGridy(); c_1->SetTopMargin(0.05); c_1->SetBottomMargin(0.01); c_1->SetFrameFillColor(0); TH1D *frame_3e5a840__9 = new TH1D("frame_3e5a840__9","",100,0.2,0.8); frame_3e5a840__9->SetBinContent(1,838.6371); frame_3e5a840__9->SetMaximum(838.6371); frame_3e5a840__9->SetEntries(4); frame_3e5a840__9->SetDirectory(0); frame_3e5a840__9->SetStats(0); frame_3e5a840__9->SetLineWidth(2); frame_3e5a840__9->GetXaxis()->SetTitle("M(#gamma#gamma)"); frame_3e5a840__9->GetXaxis()->SetLabelFont(22); frame_3e5a840__9->GetXaxis()->SetLabelSize(0.03); frame_3e5a840__9->GetXaxis()->SetTitleSize(0.035); frame_3e5a840__9->GetXaxis()->SetTitleFont(22); frame_3e5a840__9->GetYaxis()->SetTitle("Events / ( 0.006 )"); frame_3e5a840__9->GetYaxis()->SetLabelFont(22); frame_3e5a840__9->GetYaxis()->SetLabelSize(0.03); frame_3e5a840__9->GetYaxis()->SetTitleSize(0.8); frame_3e5a840__9->GetYaxis()->SetTitleFont(22); frame_3e5a840__9->GetZaxis()->SetLabelFont(22); frame_3e5a840__9->GetZaxis()->SetLabelSize(0.03); frame_3e5a840__9->GetZaxis()->SetTitleSize(0.035); frame_3e5a840__9->GetZaxis()->SetTitleFont(22); frame_3e5a840__9->Draw("FUNC"); TGraphAsymmErrors *grae = new TGraphAsymmErrors(100); grae->SetName("h_ds"); grae->SetTitle("Histogram of ds_plot__meta"); grae->SetFillColor(1); grae->SetMarkerStyle(8); grae->SetPoint(0,0.203,654); grae->SetPointError(0,0.003,0.003,25.07831,26.07831); grae->SetPoint(1,0.209,683); grae->SetPointError(1,0.003,0.003,25.63905,26.63905); grae->SetPoint(2,0.215,629); grae->SetPointError(2,0.003,0.003,24.58486,25.58486); grae->SetPoint(3,0.221,705); grae->SetPointError(3,0.003,0.003,26.05654,27.05654); grae->SetPoint(4,0.227,637); grae->SetPointError(4,0.003,0.003,24.74381,25.74381); grae->SetPoint(5,0.233,630); grae->SetPointError(5,0.003,0.003,24.60478,25.60478); grae->SetPoint(6,0.239,618); grae->SetPointError(6,0.003,0.003,24.36463,25.36463); grae->SetPoint(7,0.245,596); grae->SetPointError(7,0.003,0.003,23.91823,24.91823); grae->SetPoint(8,0.251,538); grae->SetPointError(8,0.003,0.003,22.70022,23.70022); grae->SetPoint(9,0.257,569); grae->SetPointError(9,0.003,0.003,23.35896,24.35896); grae->SetPoint(10,0.263,550); grae->SetPointError(10,0.003,0.003,22.95741,23.95741); grae->SetPoint(11,0.269,556); grae->SetPointError(11,0.003,0.003,23.08495,24.08495); grae->SetPoint(12,0.275,533); grae->SetPointError(12,0.003,0.003,22.59221,23.59221); grae->SetPoint(13,0.281,499); grae->SetPointError(13,0.003,0.003,21.8439,22.8439); grae->SetPoint(14,0.287,499); grae->SetPointError(14,0.003,0.003,21.8439,22.8439); grae->SetPoint(15,0.293,511); grae->SetPointError(15,0.003,0.003,22.11084,23.11084); grae->SetPoint(16,0.299,461); grae->SetPointError(16,0.003,0.003,20.97673,21.97673); grae->SetPoint(17,0.305,460); grae->SetPointError(17,0.003,0.003,20.95344,21.95344); grae->SetPoint(18,0.311,425); grae->SetPointError(18,0.003,0.003,20.12159,21.12159); grae->SetPoint(19,0.317,410); grae->SetPointError(19,0.003,0.003,19.75463,20.75463); grae->SetPoint(20,0.323,457); grae->SetPointError(20,0.003,0.003,20.8834,21.8834); grae->SetPoint(21,0.329,402); grae->SetPointError(21,0.003,0.003,19.55617,20.55617); grae->SetPoint(22,0.335,380); grae->SetPointError(22,0.003,0.003,19,20); grae->SetPoint(23,0.341,419); grae->SetPointError(23,0.003,0.003,19.9756,20.9756); grae->SetPoint(24,0.347,398); grae->SetPointError(24,0.003,0.003,19.4562,20.4562); grae->SetPoint(25,0.353,400); grae->SetPointError(25,0.003,0.003,19.50625,20.50625); grae->SetPoint(26,0.359,352); grae->SetPointError(26,0.003,0.003,18.26832,19.26832); grae->SetPoint(27,0.365,356); grae->SetPointError(27,0.003,0.003,18.37459,19.37459); grae->SetPoint(28,0.371,325); grae->SetPointError(28,0.003,0.003,17.53469,18.53469); grae->SetPoint(29,0.377,328); grae->SetPointError(29,0.003,0.003,17.61767,18.61767); grae->SetPoint(30,0.383,306); grae->SetPointError(30,0.003,0.003,17,18); grae->SetPoint(31,0.389,284); grae->SetPointError(31,0.003,0.003,16.35972,17.35972); grae->SetPoint(32,0.395,276); grae->SetPointError(32,0.003,0.003,16.12077,17.12077); grae->SetPoint(33,0.401,293); grae->SetPointError(33,0.003,0.003,16.62454,17.62454); grae->SetPoint(34,0.407,286); grae->SetPointError(34,0.003,0.003,16.41892,17.41892); grae->SetPoint(35,0.413,300); grae->SetPointError(35,0.003,0.003,16.82772,17.82772); grae->SetPoint(36,0.419,307); grae->SetPointError(36,0.003,0.003,17.02855,18.02855); grae->SetPoint(37,0.425,224); grae->SetPointError(37,0.003,0.003,14.47498,15.47498); grae->SetPoint(38,0.431,296); grae->SetPointError(38,0.003,0.003,16.71191,17.71191); grae->SetPoint(39,0.437,281); grae->SetPointError(39,0.003,0.003,16.27051,17.27051); grae->SetPoint(40,0.443,292); grae->SetPointError(40,0.003,0.003,16.59532,17.59532); grae->SetPoint(41,0.449,251); grae->SetPointError(41,0.003,0.003,15.35087,16.35087); grae->SetPoint(42,0.455,235); grae->SetPointError(42,0.003,0.003,14.83786,15.83786); grae->SetPoint(43,0.461,233); grae->SetPointError(43,0.003,0.003,14.77252,15.77252); grae->SetPoint(44,0.467,236); grae->SetPointError(44,0.003,0.003,14.87043,15.87043); grae->SetPoint(45,0.473,225); grae->SetPointError(45,0.003,0.003,14.50833,15.50833); grae->SetPoint(46,0.479,260); grae->SetPointError(46,0.003,0.003,15.63227,16.63227); grae->SetPoint(47,0.485,249); grae->SetPointError(47,0.003,0.003,15.28765,16.28765); grae->SetPoint(48,0.491,225); grae->SetPointError(48,0.003,0.003,14.50833,15.50833); grae->SetPoint(49,0.497,238); grae->SetPointError(49,0.003,0.003,14.93535,15.93535); grae->SetPoint(50,0.503,252); grae->SetPointError(50,0.003,0.003,15.38238,16.38238); grae->SetPoint(51,0.509,243); grae->SetPointError(51,0.003,0.003,15.09647,16.09647); grae->SetPoint(52,0.515,256); grae->SetPointError(52,0.003,0.003,15.50781,16.50781); grae->SetPoint(53,0.521,290); grae->SetPointError(53,0.003,0.003,16.53673,17.53673); grae->SetPoint(54,0.527,253); grae->SetPointError(54,0.003,0.003,15.41383,16.41383); grae->SetPoint(55,0.533,234); grae->SetPointError(55,0.003,0.003,14.80523,15.80523); grae->SetPoint(56,0.539,267); grae->SetPointError(56,0.003,0.003,15.84778,16.84778); grae->SetPoint(57,0.545,252); grae->SetPointError(57,0.003,0.003,15.38238,16.38238); grae->SetPoint(58,0.551,219); grae->SetPointError(58,0.003,0.003,14.30709,15.30709); grae->SetPoint(59,0.557,247); grae->SetPointError(59,0.003,0.003,15.22419,16.22419); grae->SetPoint(60,0.563,246); grae->SetPointError(60,0.003,0.003,15.19235,16.19235); grae->SetPoint(61,0.569,194); grae->SetPointError(61,0.003,0.003,13.43736,14.43736); grae->SetPoint(62,0.575,196); grae->SetPointError(62,0.003,0.003,13.50893,14.50893); grae->SetPoint(63,0.581,173); grae->SetPointError(63,0.003,0.003,12.66245,13.66245); grae->SetPoint(64,0.587,195); grae->SetPointError(64,0.003,0.003,13.47319,14.47319); grae->SetPoint(65,0.593,165); grae->SetPointError(65,0.003,0.003,12.35496,13.35496); grae->SetPoint(66,0.599,161); grae->SetPointError(66,0.003,0.003,12.19843,13.19843); grae->SetPoint(67,0.605,149); grae->SetPointError(67,0.003,0.003,11.71679,12.71679); grae->SetPoint(68,0.611,130); grae->SetPointError(68,0.003,0.003,10.91271,11.91271); grae->SetPoint(69,0.617,132); grae->SetPointError(69,0.003,0.003,11,12); grae->SetPoint(70,0.623,103); grae->SetPointError(70,0.003,0.003,9.661201,10.6612); grae->SetPoint(71,0.629,132); grae->SetPointError(71,0.003,0.003,11,12); grae->SetPoint(72,0.635,103); grae->SetPointError(72,0.003,0.003,9.661201,10.6612); grae->SetPoint(73,0.641,98); grae->SetPointError(73,0.003,0.003,9.882579,10.93319); grae->SetPoint(74,0.647,97); grae->SetPointError(74,0.003,0.003,9.831854,10.88273); grae->SetPoint(75,0.653,88); grae->SetPointError(75,0.003,0.003,9.362975,10.41639); grae->SetPoint(76,0.659,90); grae->SetPointError(76,0.003,0.003,9.469177,10.522); grae->SetPoint(77,0.665,68); grae->SetPointError(77,0.003,0.003,8.225883,9.28666); grae->SetPoint(78,0.671,85); grae->SetPointError(78,0.003,0.003,9.201374,10.25573); grae->SetPoint(79,0.677,74); grae->SetPointError(79,0.003,0.003,8.582844,9.641101); grae->SetPoint(80,0.683,67); grae->SetPointError(80,0.003,0.003,8.164873,9.226102); grae->SetPoint(81,0.689,61); grae->SetPointError(81,0.003,0.003,7.788779,8.852952); grae->SetPoint(82,0.695,62); grae->SetPointError(82,0.003,0.003,7.852713,8.916365); grae->SetPoint(83,0.701,63); grae->SetPointError(83,0.003,0.003,7.916129,8.979274); grae->SetPoint(84,0.707,68); grae->SetPointError(84,0.003,0.003,8.225883,9.28666); grae->SetPoint(85,0.713,61); grae->SetPointError(85,0.003,0.003,7.788779,8.852952); grae->SetPoint(86,0.719,62); grae->SetPointError(86,0.003,0.003,7.852713,8.916365); grae->SetPoint(87,0.725,47); grae->SetPointError(87,0.003,0.003,6.831172,7.904289); grae->SetPoint(88,0.731,54); grae->SetPointError(88,0.003,0.003,7.32564,8.39385); grae->SetPoint(89,0.737,51); grae->SetPointError(89,0.003,0.003,7.117933,8.188122); grae->SetPoint(90,0.743,46); grae->SetPointError(90,0.003,0.003,6.757581,7.831489); grae->SetPoint(91,0.749,48); grae->SetPointError(91,0.003,0.003,6.903979,7.97633); grae->SetPoint(92,0.755,39); grae->SetPointError(92,0.003,0.003,6.218102,7.298372); grae->SetPoint(93,0.761,42); grae->SetPointError(93,0.003,0.003,6.454831,7.53218); grae->SetPoint(94,0.767,36); grae->SetPointError(94,0.003,0.003,5.971996,7.055545); grae->SetPoint(95,0.773,40); grae->SetPointError(95,0.003,0.003,6.298,7.377261); grae->SetPoint(96,0.779,43); grae->SetPointError(96,0.003,0.003,6.531834,7.608278); grae->SetPoint(97,0.785,36); grae->SetPointError(97,0.003,0.003,5.971996,7.055545); grae->SetPoint(98,0.791,39); grae->SetPointError(98,0.003,0.003,6.218102,7.298372); grae->SetPoint(99,0.797,41); grae->SetPointError(99,0.003,0.003,6.376898,7.455185); TH1F *Graph_h_ds9 = new TH1F("Graph_h_ds9","Histogram of ds_plot__meta",100,0.14,0.86); Graph_h_ds9->SetMinimum(0); Graph_h_ds9->SetMaximum(802.2594); Graph_h_ds9->SetDirectory(0); Graph_h_ds9->SetStats(0); Graph_h_ds9->SetLineWidth(2); Graph_h_ds9->GetXaxis()->SetLabelFont(22); Graph_h_ds9->GetXaxis()->SetLabelSize(0.03); Graph_h_ds9->GetXaxis()->SetTitleSize(0.035); Graph_h_ds9->GetXaxis()->SetTitleFont(22); Graph_h_ds9->GetYaxis()->SetLabelFont(22); Graph_h_ds9->GetYaxis()->SetLabelSize(0.03); Graph_h_ds9->GetYaxis()->SetTitleSize(0.035); Graph_h_ds9->GetYaxis()->SetTitleFont(22); Graph_h_ds9->GetZaxis()->SetLabelFont(22); Graph_h_ds9->GetZaxis()->SetLabelSize(0.03); Graph_h_ds9->GetZaxis()->SetTitleSize(0.035); Graph_h_ds9->GetZaxis()->SetTitleFont(22); grae->SetHistogram(Graph_h_ds9); grae->Draw("p"); TGraph *graph = new TGraph(204); graph->SetName("model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]"); graph->SetTitle(""); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#ffcc00"); graph->SetFillColor(ci); ci = TColor::GetColor("#00ffff"); graph->SetLineColor(ci); graph->SetPoint(0,0.200000003,798.7019931); graph->SetPoint(1,0.2060000031,774.5853877); graph->SetPoint(2,0.2120000032,751.1911872); graph->SetPoint(3,0.2180000032,728.4979707); graph->SetPoint(4,0.2240000033,706.4849644); graph->SetPoint(5,0.2300000034,685.1320242); graph->SetPoint(6,0.2360000035,664.4196193); graph->SetPoint(7,0.2420000036,644.3288181); graph->SetPoint(8,0.2480000037,624.8412749); graph->SetPoint(9,0.2540000038,605.9392195); graph->SetPoint(10,0.2600000039,587.6054489); graph->SetPoint(11,0.266000004,569.8233244); graph->SetPoint(12,0.2720000041,552.5767736); graph->SetPoint(13,0.2780000041,535.8503023); graph->SetPoint(14,0.2840000042,519.6290218); graph->SetPoint(15,0.2900000043,503.8986997); graph->SetPoint(16,0.2960000044,488.6458555); graph->SetPoint(17,0.3020000045,473.8579342); graph->SetPoint(18,0.3080000046,459.5236349); graph->SetPoint(19,0.3140000047,445.6335603); graph->SetPoint(20,0.3200000048,432.1815914); graph->SetPoint(21,0.3260000049,419.168068); graph->SetPoint(22,0.3320000049,406.6079925); graph->SetPoint(23,0.338000005,394.5546795); graph->SetPoint(24,0.3440000051,383.1676028); graph->SetPoint(25,0.3500000052,372.7865387); graph->SetPoint(26,0.3560000053,363.5306275); graph->SetPoint(27,0.3620000054,354.993382); graph->SetPoint(28,0.3680000055,346.8543406); graph->SetPoint(29,0.3740000056,338.987463); graph->SetPoint(30,0.3800000057,331.3453968); graph->SetPoint(31,0.3860000058,323.9103693); graph->SetPoint(32,0.3920000058,316.6789098); graph->SetPoint(33,0.3980000059,309.6573637); graph->SetPoint(34,0.404000006,302.8611366); graph->SetPoint(35,0.4100000061,296.3153985); graph->SetPoint(36,0.4160000062,290.0563139); graph->SetPoint(37,0.4220000063,284.1322305); graph->SetPoint(38,0.4280000064,278.6043264); graph->SetPoint(39,0.4340000065,273.5462157); graph->SetPoint(40,0.4400000066,269.0420574); graph->SetPoint(41,0.4460000066,265.1828302); graph->SetPoint(42,0.4520000067,262.060669); graph->SetPoint(43,0.4580000068,259.761436); graph->SetPoint(44,0.4640000069,258.3559442); graph->SetPoint(45,0.470000007,257.8903359); graph->SetPoint(46,0.4760000071,258.3759653); graph->SetPoint(47,0.4820000072,259.7788063); graph->SetPoint(48,0.4880000073,262.008222); graph->SetPoint(49,0.4940000074,264.9055077); graph->SetPoint(50,0.5000000075,268.2344455); graph->SetPoint(51,0.5060000075,271.6786289); graph->SetPoint(52,0.5120000076,274.8513799); graph->SetPoint(53,0.5180000077,277.3216173); graph->SetPoint(54,0.5240000078,278.6537331); graph->SetPoint(55,0.5300000079,278.4547041); graph->SetPoint(56,0.536000008,276.4197955); graph->SetPoint(57,0.5420000081,272.3690902); graph->SetPoint(58,0.5480000082,266.2692386); graph->SetPoint(59,0.5540000083,258.2372285); graph->SetPoint(60,0.5600000083,248.5253699); graph->SetPoint(61,0.5660000084,237.4891618); graph->SetPoint(62,0.5720000085,225.542572); graph->SetPoint(63,0.5780000086,213.1085501); graph->SetPoint(64,0.5840000087,200.5751829); graph->SetPoint(65,0.5900000088,188.2669604); graph->SetPoint(66,0.5960000089,176.4344593); graph->SetPoint(67,0.602000009,165.2578228); graph->SetPoint(68,0.6080000091,154.8558692); graph->SetPoint(69,0.6140000091,145.2950217); graph->SetPoint(70,0.6200000092,136.5965177); graph->SetPoint(71,0.6260000093,128.7428691); graph->SetPoint(72,0.6320000094,121.6848358); graph->SetPoint(73,0.6380000095,115.3494199); graph->SetPoint(74,0.6440000096,109.6485561); graph->SetPoint(75,0.6500000097,104.4876864); graph->SetPoint(76,0.6560000098,99.77330465); graph->SetPoint(77,0.6620000099,95.4187722); graph->SetPoint(78,0.66800001,91.3480853); graph->SetPoint(79,0.67400001,87.49767284); graph->SetPoint(80,0.6800000101,83.81659233); graph->SetPoint(81,0.6860000102,80.26563468); graph->SetPoint(82,0.6920000103,76.81585991); graph->SetPoint(83,0.6980000104,73.44703037); graph->SetPoint(84,0.7040000105,70.14637064); graph->SetPoint(85,0.7100000106,66.90819839); graph->SetPoint(86,0.7160000107,63.73557721); graph->SetPoint(87,0.7220000108,60.64738673); graph->SetPoint(88,0.7280000108,57.70148474); graph->SetPoint(89,0.7340000109,55.04873271); graph->SetPoint(90,0.740000011,52.88466635); graph->SetPoint(91,0.7460000111,51.14139221); graph->SetPoint(92,0.7520000112,49.62035966); graph->SetPoint(93,0.7580000113,48.21929267); graph->SetPoint(94,0.7640000114,46.89799309); graph->SetPoint(95,0.7700000115,45.639003); graph->SetPoint(96,0.7760000116,44.43344942); graph->SetPoint(97,0.7820000117,43.27815019); graph->SetPoint(98,0.7880000117,42.2613262); graph->SetPoint(99,0.7940000118,41.32202936); graph->SetPoint(100,0.8000000119,40.44466249); graph->SetPoint(101,0.8000000119,40.44466249); graph->SetPoint(102,0.8000000119,20.4493223); graph->SetPoint(103,0.8000000119,20.4493223); graph->SetPoint(104,0.7940000118,23.45963138); graph->SetPoint(105,0.7880000117,26.48763482); graph->SetPoint(106,0.7820000117,29.49721429); graph->SetPoint(107,0.7760000116,32.42924264); graph->SetPoint(108,0.7700000115,35.37382513); graph->SetPoint(109,0.7640000114,38.32973649); graph->SetPoint(110,0.7580000113,41.29014864); graph->SetPoint(111,0.7520000112,44.23976317); graph->SetPoint(112,0.7460000111,47.14070165); graph->SetPoint(113,0.740000011,49.89324498); graph->SetPoint(114,0.7340000109,52.30176424); graph->SetPoint(115,0.7280000108,54.30185867); graph->SetPoint(116,0.7220000108,56.09345228); graph->SetPoint(117,0.7160000107,57.83318713); graph->SetPoint(118,0.7100000106,59.58683083); graph->SetPoint(119,0.7040000105,61.38435972); graph->SetPoint(120,0.6980000104,63.24458616); graph->SetPoint(121,0.6920000103,65.18417989); graph->SetPoint(122,0.6860000102,67.22180754); graph->SetPoint(123,0.6800000101,69.38077354); graph->SetPoint(124,0.67400001,71.69120198); graph->SetPoint(125,0.66800001,74.19204844); graph->SetPoint(126,0.6620000099,76.93293552); graph->SetPoint(127,0.6560000098,79.97564094); graph->SetPoint(128,0.6500000097,83.39493174); graph->SetPoint(129,0.6440000096,87.27829353); graph->SetPoint(130,0.6380000095,91.72394537); graph->SetPoint(131,0.6320000094,96.83639864); graph->SetPoint(132,0.6260000093,102.7188033); graph->SetPoint(133,0.6200000092,109.4615615); graph->SetPoint(134,0.6140000091,117.1272988); graph->SetPoint(135,0.6080000091,125.7333172); graph->SetPoint(136,0.602000009,135.2340518); graph->SetPoint(137,0.5960000089,145.5075539); graph->SetPoint(138,0.5900000088,156.3510369); graph->SetPoint(139,0.5840000087,167.4898931); graph->SetPoint(140,0.5780000086,178.6010812); graph->SetPoint(141,0.5720000085,189.3458935); graph->SetPoint(142,0.5660000084,199.4027044); graph->SetPoint(143,0.5600000083,208.4916562); graph->SetPoint(144,0.5540000083,216.3892519); graph->SetPoint(145,0.5480000082,222.9356971); graph->SetPoint(146,0.5420000081,228.0384393); graph->SetPoint(147,0.536000008,231.673517); graph->SetPoint(148,0.5300000079,233.8847998); graph->SetPoint(149,0.5240000078,234.7808714); graph->SetPoint(150,0.5180000077,234.5296771); graph->SetPoint(151,0.5120000076,233.3513619); graph->SetPoint(152,0.5060000075,231.50939); graph->SetPoint(153,0.5000000075,229.2990025); graph->SetPoint(154,0.4940000074,227.0312292); graph->SetPoint(155,0.4880000073,225.0115661); graph->SetPoint(156,0.4820000072,223.515521); graph->SetPoint(157,0.4760000071,222.7663893); graph->SetPoint(158,0.470000007,222.9209528); graph->SetPoint(159,0.4640000069,224.0659219); graph->SetPoint(160,0.4580000068,226.224199); graph->SetPoint(161,0.4520000067,229.3676447); graph->SetPoint(162,0.4460000066,233.4325188); graph->SetPoint(163,0.4400000066,238.3345009); graph->SetPoint(164,0.4340000065,243.9813698); graph->SetPoint(165,0.4280000064,250.2825186); graph->SetPoint(166,0.4220000063,257.1552742); graph->SetPoint(167,0.4160000062,264.5284434); graph->SetPoint(168,0.4100000061,272.3436889); graph->SetPoint(169,0.404000006,280.5553499); graph->SetPoint(170,0.3980000059,289.1292293); graph->SetPoint(171,0.3920000058,298.0407353); graph->SetPoint(172,0.3860000058,307.2725862); graph->SetPoint(173,0.3800000057,316.8120134); graph->SetPoint(174,0.3740000056,326.6468474); graph->SetPoint(175,0.3680000055,336.7583697); graph->SetPoint(176,0.3620000054,347.1039154); graph->SetPoint(177,0.3560000053,357.5661517); graph->SetPoint(178,0.3500000052,367.8361703); graph->SetPoint(179,0.3440000051,377.5210591); graph->SetPoint(180,0.338000005,386.7549997); graph->SetPoint(181,0.3320000049,395.8939145); graph->SetPoint(182,0.3260000049,405.1143037); graph->SetPoint(183,0.3200000048,414.4872547); graph->SetPoint(184,0.3140000047,424.0462154); graph->SetPoint(185,0.3080000046,433.810608); graph->SetPoint(186,0.3020000045,443.7940196); graph->SetPoint(187,0.2960000044,454.007384); graph->SetPoint(188,0.2900000043,464.4603656); graph->SetPoint(189,0.2840000042,475.1620236); graph->SetPoint(190,0.2780000041,486.1211574); graph->SetPoint(191,0.2720000041,497.3464995); graph->SetPoint(192,0.266000004,508.8468311); graph->SetPoint(193,0.2600000039,520.6310549); graph->SetPoint(194,0.2540000038,532.708244); graph->SetPoint(195,0.2480000037,545.0876767); graph->SetPoint(196,0.2420000036,557.7788626); graph->SetPoint(197,0.2360000035,570.7915633); graph->SetPoint(198,0.2300000034,584.1358103); graph->SetPoint(199,0.2240000033,597.8219195); graph->SetPoint(200,0.2180000032,611.8605055); graph->SetPoint(201,0.2120000032,626.2624942); graph->SetPoint(202,0.2060000031,641.0391354); graph->SetPoint(203,0.200000003,656.2020147); TH1F *Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13 = new TH1F("Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13","",204,0.14,0.86); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->SetMinimum(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->SetMaximum(876.5273); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->SetDirectory(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->SetStats(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->SetLineWidth(2); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetXaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetXaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetXaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetXaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetYaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetYaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetYaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetYaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetZaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetZaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetZaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13->GetZaxis()->SetTitleFont(22); graph->SetHistogram(Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]_errorband_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]13); graph->Draw("f"); graph = new TGraph(102); graph->SetName("model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]"); graph->SetTitle("Projection of gauss + exp + pol1"); graph->SetFillColor(1); ci = TColor::GetColor("#0000ff"); graph->SetLineColor(ci); graph->SetLineStyle(2); graph->SetLineWidth(3); graph->SetPoint(0,0.200000003,727.4520039); graph->SetPoint(1,0.2060000031,707.8122616); graph->SetPoint(2,0.2120000032,688.7268407); graph->SetPoint(3,0.2180000032,670.1792381); graph->SetPoint(4,0.2240000033,652.153442); graph->SetPoint(5,0.2300000034,634.6339172); graph->SetPoint(6,0.2360000035,617.6055913); graph->SetPoint(7,0.2420000036,601.0538403); graph->SetPoint(8,0.2480000037,584.9644758); graph->SetPoint(9,0.2540000038,569.3237317); graph->SetPoint(10,0.2600000039,554.1182519); graph->SetPoint(11,0.266000004,539.3350777); graph->SetPoint(12,0.2720000041,524.9616363); graph->SetPoint(13,0.2780000041,510.9857293); graph->SetPoint(14,0.2840000042,497.3955214); graph->SetPoint(15,0.2900000043,484.1795297); graph->SetPoint(16,0.2960000044,471.3266131); graph->SetPoint(17,0.3020000045,458.8259621); graph->SetPoint(18,0.3080000046,446.6670894); graph->SetPoint(19,0.3140000047,434.8398194); graph->SetPoint(20,0.3200000048,423.3342798); graph->SetPoint(21,0.3260000049,412.1408922); graph->SetPoint(22,0.3320000049,401.2503632); graph->SetPoint(23,0.338000005,390.6536761); graph->SetPoint(24,0.3440000051,380.3420829); graph->SetPoint(25,0.3500000052,370.3070957); graph->SetPoint(26,0.3560000053,360.5404796); graph->SetPoint(27,0.3620000054,351.0342446); graph->SetPoint(28,0.3680000055,341.7806387); graph->SetPoint(29,0.3740000056,332.7721407); graph->SetPoint(30,0.3800000057,324.0014534); graph->SetPoint(31,0.3860000058,315.4614966); graph->SetPoint(32,0.3920000058,307.1454012); graph->SetPoint(33,0.3980000059,299.0465024); graph->SetPoint(34,0.404000006,291.1583339); graph->SetPoint(35,0.4100000061,283.4746218); graph->SetPoint(36,0.4160000062,275.9892791); graph->SetPoint(37,0.4220000063,268.6964001); graph->SetPoint(38,0.4280000064,261.5902547); graph->SetPoint(39,0.4340000065,254.6652836); graph->SetPoint(40,0.4400000066,247.9160929); graph->SetPoint(41,0.4460000066,241.3374493); graph->SetPoint(42,0.4520000067,234.9242753); graph->SetPoint(43,0.4580000068,228.6716445); graph->SetPoint(44,0.4640000069,222.5747775); graph->SetPoint(45,0.470000007,216.6290366); graph->SetPoint(46,0.4760000071,210.8299228); graph->SetPoint(47,0.4820000072,205.1730706); graph->SetPoint(48,0.4880000073,199.6542447); graph->SetPoint(49,0.4940000074,194.2693358); graph->SetPoint(50,0.5000000075,189.0143569); graph->SetPoint(51,0.5060000075,183.8854398); graph->SetPoint(52,0.5120000076,178.8788314); graph->SetPoint(53,0.5180000077,173.9908904); graph->SetPoint(54,0.5240000078,169.2180838); graph->SetPoint(55,0.5300000079,164.5569839); graph->SetPoint(56,0.536000008,160.0042649); graph->SetPoint(57,0.5420000081,155.5567003); graph->SetPoint(58,0.5480000082,151.2111593); graph->SetPoint(59,0.5540000083,146.9646045); graph->SetPoint(60,0.5600000083,142.814089); graph->SetPoint(61,0.5660000084,138.7567535); graph->SetPoint(62,0.5720000085,134.7898238); graph->SetPoint(63,0.5780000086,130.9106084); graph->SetPoint(64,0.5840000087,127.116496); graph->SetPoint(65,0.5900000088,123.4049528); graph->SetPoint(66,0.5960000089,119.7735205); graph->SetPoint(67,0.602000009,116.2198143); graph->SetPoint(68,0.6080000091,112.74152); graph->SetPoint(69,0.6140000091,109.3363924); graph->SetPoint(70,0.6200000092,106.0022534); graph->SetPoint(71,0.6260000093,102.7369893); graph->SetPoint(72,0.6320000094,99.5385498); graph->SetPoint(73,0.6380000095,96.40494528); graph->SetPoint(74,0.6440000096,93.33424552); graph->SetPoint(75,0.6500000097,90.32457774); graph->SetPoint(76,0.6560000098,87.37412491); graph->SetPoint(77,0.6620000099,84.48112409); graph->SetPoint(78,0.66800001,81.64386485); graph->SetPoint(79,0.67400001,78.86068765); graph->SetPoint(80,0.6800000101,76.12998237); graph->SetPoint(81,0.6860000102,73.45018684); graph->SetPoint(82,0.6920000103,70.81978539); graph->SetPoint(83,0.6980000104,68.23730747); graph->SetPoint(84,0.7040000105,65.7013263); graph->SetPoint(85,0.7100000106,63.2104576); graph->SetPoint(86,0.7160000107,60.76335829); graph->SetPoint(87,0.7220000108,58.35872529); graph->SetPoint(88,0.7280000108,55.99529428); graph->SetPoint(89,0.7340000109,53.67183863); graph->SetPoint(90,0.740000011,51.38716819); graph->SetPoint(91,0.7460000111,49.14012825); graph->SetPoint(92,0.7520000112,46.9295985); graph->SetPoint(93,0.7580000113,44.75449196); graph->SetPoint(94,0.7640000114,42.61375402); graph->SetPoint(95,0.7700000115,40.50636146); graph->SetPoint(96,0.7760000116,38.43132154); graph->SetPoint(97,0.7820000117,36.38767106); graph->SetPoint(98,0.7880000117,34.3744755); graph->SetPoint(99,0.7940000118,32.39082817); graph->SetPoint(100,0.8000000119,30.44699145); graph->SetPoint(101,0.8000000119,30.44699145); TH1F *Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14 = new TH1F("Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14","Projection of gauss + exp + pol1",102,0.14,0.86); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->SetMinimum(0); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->SetMaximum(797.1525); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->SetDirectory(0); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->SetStats(0); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->SetLineWidth(2); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetXaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetXaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetXaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetXaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetYaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetYaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetYaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetYaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetZaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetZaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetZaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14->GetZaxis()->SetTitleFont(22); graph->SetHistogram(Graph_model_Norm[meta]_Comp[bkg]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]14); graph->Draw("l"); graph = new TGraph(102); graph->SetName("model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]"); graph->SetTitle("Projection of gauss + exp + pol1"); graph->SetFillColor(1); ci = TColor::GetColor("#ff0000"); graph->SetLineColor(ci); graph->SetLineWidth(3); graph->SetPoint(0,0.200000003,727.4520039); graph->SetPoint(1,0.2060000031,707.8122616); graph->SetPoint(2,0.2120000032,688.7268407); graph->SetPoint(3,0.2180000032,670.1792381); graph->SetPoint(4,0.2240000033,652.153442); graph->SetPoint(5,0.2300000034,634.6339172); graph->SetPoint(6,0.2360000035,617.6055913); graph->SetPoint(7,0.2420000036,601.0538403); graph->SetPoint(8,0.2480000037,584.9644758); graph->SetPoint(9,0.2540000038,569.3237317); graph->SetPoint(10,0.2600000039,554.1182519); graph->SetPoint(11,0.266000004,539.3350777); graph->SetPoint(12,0.2720000041,524.9616365); graph->SetPoint(13,0.2780000041,510.9857298); graph->SetPoint(14,0.2840000042,497.3955227); graph->SetPoint(15,0.2900000043,484.1795326); graph->SetPoint(16,0.2960000044,471.3266197); graph->SetPoint(17,0.3020000045,458.8259769); graph->SetPoint(18,0.3080000046,446.6671215); graph->SetPoint(19,0.3140000047,434.8398879); graph->SetPoint(20,0.3200000048,423.334423); graph->SetPoint(21,0.3260000049,412.1411858); graph->SetPoint(22,0.3320000049,401.2509535); graph->SetPoint(23,0.338000005,390.6548396); graph->SetPoint(24,0.3440000051,380.344331); graph->SetPoint(25,0.3500000052,370.3113545); graph->SetPoint(26,0.3560000053,360.5483896); graph->SetPoint(27,0.3620000054,351.0486487); graph->SetPoint(28,0.3680000055,341.8063552); graph->SetPoint(29,0.3740000056,332.8171552); graph->SetPoint(30,0.3800000057,324.0787051); graph->SetPoint(31,0.3860000058,315.5914777); graph->SetPoint(32,0.3920000058,307.3598226); graph->SetPoint(33,0.3980000059,299.3932965); graph->SetPoint(34,0.404000006,291.7082433); graph->SetPoint(35,0.4100000061,284.3295437); graph->SetPoint(36,0.4160000062,277.2923786); graph->SetPoint(37,0.4220000063,270.6437524); graph->SetPoint(38,0.4280000064,264.4434225); graph->SetPoint(39,0.4340000065,258.7637928); graph->SetPoint(40,0.4400000066,253.6882792); graph->SetPoint(41,0.4460000066,249.3076745); graph->SetPoint(42,0.4520000067,245.7141569); graph->SetPoint(43,0.4580000068,242.9928175); graph->SetPoint(44,0.4640000069,241.210933); graph->SetPoint(45,0.470000007,240.4056443); graph->SetPoint(46,0.4760000071,240.5711773); graph->SetPoint(47,0.4820000072,241.6471636); graph->SetPoint(48,0.4880000073,243.5098941); graph->SetPoint(49,0.4940000074,245.9683684); graph->SetPoint(50,0.5000000075,248.766724); graph->SetPoint(51,0.5060000075,251.5940095); graph->SetPoint(52,0.5120000076,254.1013709); graph->SetPoint(53,0.5180000077,255.9256472); graph->SetPoint(54,0.5240000078,256.7173023); graph->SetPoint(55,0.5300000079,256.1697519); graph->SetPoint(56,0.536000008,254.0466562); graph->SetPoint(57,0.5420000081,250.2037648); graph->SetPoint(58,0.5480000082,244.6024678); graph->SetPoint(59,0.5540000083,237.3132402); graph->SetPoint(60,0.5600000083,228.508513); graph->SetPoint(61,0.5660000084,218.4459331); graph->SetPoint(62,0.5720000085,207.4442328); graph->SetPoint(63,0.5780000086,195.8548156); graph->SetPoint(64,0.5840000087,184.032538); graph->SetPoint(65,0.5900000088,172.3089986); graph->SetPoint(66,0.5960000089,160.9710066); graph->SetPoint(67,0.602000009,150.2459373); graph->SetPoint(68,0.6080000091,140.2945932); graph->SetPoint(69,0.6140000091,131.2111602); graph->SetPoint(70,0.6200000092,123.0290396); graph->SetPoint(71,0.6260000093,115.7308362); graph->SetPoint(72,0.6320000094,109.2606172); graph->SetPoint(73,0.6380000095,103.5366826); graph->SetPoint(74,0.6440000096,98.46342481); graph->SetPoint(75,0.6500000097,93.94130905); graph->SetPoint(76,0.6560000098,89.8744728); graph->SetPoint(77,0.6620000099,86.17585386); graph->SetPoint(78,0.66800001,82.77006687); graph->SetPoint(79,0.67400001,79.59443741); graph->SetPoint(80,0.6800000101,76.59868294); graph->SetPoint(81,0.6860000102,73.74372111); graph->SetPoint(82,0.6920000103,71.0000199); graph->SetPoint(83,0.6980000104,68.34580826); graph->SetPoint(84,0.7040000105,65.76536518); graph->SetPoint(85,0.7100000106,63.24751461); graph->SetPoint(86,0.7160000107,60.78438217); graph->SetPoint(87,0.7220000108,58.3704195); graph->SetPoint(88,0.7280000108,56.00167171); graph->SetPoint(89,0.7340000109,53.67524848); graph->SetPoint(90,0.740000011,51.38895567); graph->SetPoint(91,0.7460000111,49.14104693); graph->SetPoint(92,0.7520000112,46.93006142); graph->SetPoint(93,0.7580000113,44.75472065); graph->SetPoint(94,0.7640000114,42.61386479); graph->SetPoint(95,0.7700000115,40.50641407); graph->SetPoint(96,0.7760000116,38.43134603); graph->SetPoint(97,0.7820000117,36.38768224); graph->SetPoint(98,0.7880000117,34.37448051); graph->SetPoint(99,0.7940000118,32.39083037); graph->SetPoint(100,0.8000000119,30.44699239); graph->SetPoint(101,0.8000000119,30.44699239); TH1F *Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15 = new TH1F("Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15","Projection of gauss + exp + pol1",102,0.14,0.86); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->SetMinimum(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->SetMaximum(797.1525); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->SetDirectory(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->SetStats(0); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->SetLineWidth(2); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetXaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetXaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetXaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetXaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetYaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetYaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetYaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetYaxis()->SetTitleFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetZaxis()->SetLabelFont(22); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetZaxis()->SetLabelSize(0.03); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetZaxis()->SetTitleSize(0.035); Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15->GetZaxis()->SetTitleFont(22); graph->SetHistogram(Graph_model_Norm[meta]_Range[fit_nll_model_ds]_NormRange[fit_nll_model_ds]15); graph->Draw("l"); grae = new TGraphAsymmErrors(100); grae->SetName("h_ds"); grae->SetTitle("Histogram of ds_plot__meta"); grae->SetFillColor(1); grae->SetMarkerStyle(8); grae->SetPoint(0,0.203,654); grae->SetPointError(0,0.003,0.003,25.07831,26.07831); grae->SetPoint(1,0.209,683); grae->SetPointError(1,0.003,0.003,25.63905,26.63905); grae->SetPoint(2,0.215,629); grae->SetPointError(2,0.003,0.003,24.58486,25.58486); grae->SetPoint(3,0.221,705); grae->SetPointError(3,0.003,0.003,26.05654,27.05654); grae->SetPoint(4,0.227,637); grae->SetPointError(4,0.003,0.003,24.74381,25.74381); grae->SetPoint(5,0.233,630); grae->SetPointError(5,0.003,0.003,24.60478,25.60478); grae->SetPoint(6,0.239,618); grae->SetPointError(6,0.003,0.003,24.36463,25.36463); grae->SetPoint(7,0.245,596); grae->SetPointError(7,0.003,0.003,23.91823,24.91823); grae->SetPoint(8,0.251,538); grae->SetPointError(8,0.003,0.003,22.70022,23.70022); grae->SetPoint(9,0.257,569); grae->SetPointError(9,0.003,0.003,23.35896,24.35896); grae->SetPoint(10,0.263,550); grae->SetPointError(10,0.003,0.003,22.95741,23.95741); grae->SetPoint(11,0.269,556); grae->SetPointError(11,0.003,0.003,23.08495,24.08495); grae->SetPoint(12,0.275,533); grae->SetPointError(12,0.003,0.003,22.59221,23.59221); grae->SetPoint(13,0.281,499); grae->SetPointError(13,0.003,0.003,21.8439,22.8439); grae->SetPoint(14,0.287,499); grae->SetPointError(14,0.003,0.003,21.8439,22.8439); grae->SetPoint(15,0.293,511); grae->SetPointError(15,0.003,0.003,22.11084,23.11084); grae->SetPoint(16,0.299,461); grae->SetPointError(16,0.003,0.003,20.97673,21.97673); grae->SetPoint(17,0.305,460); grae->SetPointError(17,0.003,0.003,20.95344,21.95344); grae->SetPoint(18,0.311,425); grae->SetPointError(18,0.003,0.003,20.12159,21.12159); grae->SetPoint(19,0.317,410); grae->SetPointError(19,0.003,0.003,19.75463,20.75463); grae->SetPoint(20,0.323,457); grae->SetPointError(20,0.003,0.003,20.8834,21.8834); grae->SetPoint(21,0.329,402); grae->SetPointError(21,0.003,0.003,19.55617,20.55617); grae->SetPoint(22,0.335,380); grae->SetPointError(22,0.003,0.003,19,20); grae->SetPoint(23,0.341,419); grae->SetPointError(23,0.003,0.003,19.9756,20.9756); grae->SetPoint(24,0.347,398); grae->SetPointError(24,0.003,0.003,19.4562,20.4562); grae->SetPoint(25,0.353,400); grae->SetPointError(25,0.003,0.003,19.50625,20.50625); grae->SetPoint(26,0.359,352); grae->SetPointError(26,0.003,0.003,18.26832,19.26832); grae->SetPoint(27,0.365,356); grae->SetPointError(27,0.003,0.003,18.37459,19.37459); grae->SetPoint(28,0.371,325); grae->SetPointError(28,0.003,0.003,17.53469,18.53469); grae->SetPoint(29,0.377,328); grae->SetPointError(29,0.003,0.003,17.61767,18.61767); grae->SetPoint(30,0.383,306); grae->SetPointError(30,0.003,0.003,17,18); grae->SetPoint(31,0.389,284); grae->SetPointError(31,0.003,0.003,16.35972,17.35972); grae->SetPoint(32,0.395,276); grae->SetPointError(32,0.003,0.003,16.12077,17.12077); grae->SetPoint(33,0.401,293); grae->SetPointError(33,0.003,0.003,16.62454,17.62454); grae->SetPoint(34,0.407,286); grae->SetPointError(34,0.003,0.003,16.41892,17.41892); grae->SetPoint(35,0.413,300); grae->SetPointError(35,0.003,0.003,16.82772,17.82772); grae->SetPoint(36,0.419,307); grae->SetPointError(36,0.003,0.003,17.02855,18.02855); grae->SetPoint(37,0.425,224); grae->SetPointError(37,0.003,0.003,14.47498,15.47498); grae->SetPoint(38,0.431,296); grae->SetPointError(38,0.003,0.003,16.71191,17.71191); grae->SetPoint(39,0.437,281); grae->SetPointError(39,0.003,0.003,16.27051,17.27051); grae->SetPoint(40,0.443,292); grae->SetPointError(40,0.003,0.003,16.59532,17.59532); grae->SetPoint(41,0.449,251); grae->SetPointError(41,0.003,0.003,15.35087,16.35087); grae->SetPoint(42,0.455,235); grae->SetPointError(42,0.003,0.003,14.83786,15.83786); grae->SetPoint(43,0.461,233); grae->SetPointError(43,0.003,0.003,14.77252,15.77252); grae->SetPoint(44,0.467,236); grae->SetPointError(44,0.003,0.003,14.87043,15.87043); grae->SetPoint(45,0.473,225); grae->SetPointError(45,0.003,0.003,14.50833,15.50833); grae->SetPoint(46,0.479,260); grae->SetPointError(46,0.003,0.003,15.63227,16.63227); grae->SetPoint(47,0.485,249); grae->SetPointError(47,0.003,0.003,15.28765,16.28765); grae->SetPoint(48,0.491,225); grae->SetPointError(48,0.003,0.003,14.50833,15.50833); grae->SetPoint(49,0.497,238); grae->SetPointError(49,0.003,0.003,14.93535,15.93535); grae->SetPoint(50,0.503,252); grae->SetPointError(50,0.003,0.003,15.38238,16.38238); grae->SetPoint(51,0.509,243); grae->SetPointError(51,0.003,0.003,15.09647,16.09647); grae->SetPoint(52,0.515,256); grae->SetPointError(52,0.003,0.003,15.50781,16.50781); grae->SetPoint(53,0.521,290); grae->SetPointError(53,0.003,0.003,16.53673,17.53673); grae->SetPoint(54,0.527,253); grae->SetPointError(54,0.003,0.003,15.41383,16.41383); grae->SetPoint(55,0.533,234); grae->SetPointError(55,0.003,0.003,14.80523,15.80523); grae->SetPoint(56,0.539,267); grae->SetPointError(56,0.003,0.003,15.84778,16.84778); grae->SetPoint(57,0.545,252); grae->SetPointError(57,0.003,0.003,15.38238,16.38238); grae->SetPoint(58,0.551,219); grae->SetPointError(58,0.003,0.003,14.30709,15.30709); grae->SetPoint(59,0.557,247); grae->SetPointError(59,0.003,0.003,15.22419,16.22419); grae->SetPoint(60,0.563,246); grae->SetPointError(60,0.003,0.003,15.19235,16.19235); grae->SetPoint(61,0.569,194); grae->SetPointError(61,0.003,0.003,13.43736,14.43736); grae->SetPoint(62,0.575,196); grae->SetPointError(62,0.003,0.003,13.50893,14.50893); grae->SetPoint(63,0.581,173); grae->SetPointError(63,0.003,0.003,12.66245,13.66245); grae->SetPoint(64,0.587,195); grae->SetPointError(64,0.003,0.003,13.47319,14.47319); grae->SetPoint(65,0.593,165); grae->SetPointError(65,0.003,0.003,12.35496,13.35496); grae->SetPoint(66,0.599,161); grae->SetPointError(66,0.003,0.003,12.19843,13.19843); grae->SetPoint(67,0.605,149); grae->SetPointError(67,0.003,0.003,11.71679,12.71679); grae->SetPoint(68,0.611,130); grae->SetPointError(68,0.003,0.003,10.91271,11.91271); grae->SetPoint(69,0.617,132); grae->SetPointError(69,0.003,0.003,11,12); grae->SetPoint(70,0.623,103); grae->SetPointError(70,0.003,0.003,9.661201,10.6612); grae->SetPoint(71,0.629,132); grae->SetPointError(71,0.003,0.003,11,12); grae->SetPoint(72,0.635,103); grae->SetPointError(72,0.003,0.003,9.661201,10.6612); grae->SetPoint(73,0.641,98); grae->SetPointError(73,0.003,0.003,9.882579,10.93319); grae->SetPoint(74,0.647,97); grae->SetPointError(74,0.003,0.003,9.831854,10.88273); grae->SetPoint(75,0.653,88); grae->SetPointError(75,0.003,0.003,9.362975,10.41639); grae->SetPoint(76,0.659,90); grae->SetPointError(76,0.003,0.003,9.469177,10.522); grae->SetPoint(77,0.665,68); grae->SetPointError(77,0.003,0.003,8.225883,9.28666); grae->SetPoint(78,0.671,85); grae->SetPointError(78,0.003,0.003,9.201374,10.25573); grae->SetPoint(79,0.677,74); grae->SetPointError(79,0.003,0.003,8.582844,9.641101); grae->SetPoint(80,0.683,67); grae->SetPointError(80,0.003,0.003,8.164873,9.226102); grae->SetPoint(81,0.689,61); grae->SetPointError(81,0.003,0.003,7.788779,8.852952); grae->SetPoint(82,0.695,62); grae->SetPointError(82,0.003,0.003,7.852713,8.916365); grae->SetPoint(83,0.701,63); grae->SetPointError(83,0.003,0.003,7.916129,8.979274); grae->SetPoint(84,0.707,68); grae->SetPointError(84,0.003,0.003,8.225883,9.28666); grae->SetPoint(85,0.713,61); grae->SetPointError(85,0.003,0.003,7.788779,8.852952); grae->SetPoint(86,0.719,62); grae->SetPointError(86,0.003,0.003,7.852713,8.916365); grae->SetPoint(87,0.725,47); grae->SetPointError(87,0.003,0.003,6.831172,7.904289); grae->SetPoint(88,0.731,54); grae->SetPointError(88,0.003,0.003,7.32564,8.39385); grae->SetPoint(89,0.737,51); grae->SetPointError(89,0.003,0.003,7.117933,8.188122); grae->SetPoint(90,0.743,46); grae->SetPointError(90,0.003,0.003,6.757581,7.831489); grae->SetPoint(91,0.749,48); grae->SetPointError(91,0.003,0.003,6.903979,7.97633); grae->SetPoint(92,0.755,39); grae->SetPointError(92,0.003,0.003,6.218102,7.298372); grae->SetPoint(93,0.761,42); grae->SetPointError(93,0.003,0.003,6.454831,7.53218); grae->SetPoint(94,0.767,36); grae->SetPointError(94,0.003,0.003,5.971996,7.055545); grae->SetPoint(95,0.773,40); grae->SetPointError(95,0.003,0.003,6.298,7.377261); grae->SetPoint(96,0.779,43); grae->SetPointError(96,0.003,0.003,6.531834,7.608278); grae->SetPoint(97,0.785,36); grae->SetPointError(97,0.003,0.003,5.971996,7.055545); grae->SetPoint(98,0.791,39); grae->SetPointError(98,0.003,0.003,6.218102,7.298372); grae->SetPoint(99,0.797,41); grae->SetPointError(99,0.003,0.003,6.376898,7.455185); TH1F *Graph_h_ds10 = new TH1F("Graph_h_ds10","Histogram of ds_plot__meta",100,0.14,0.86); Graph_h_ds10->SetMinimum(0); Graph_h_ds10->SetMaximum(802.2594); Graph_h_ds10->SetDirectory(0); Graph_h_ds10->SetStats(0); Graph_h_ds10->SetLineWidth(2); Graph_h_ds10->GetXaxis()->SetLabelFont(22); Graph_h_ds10->GetXaxis()->SetLabelSize(0.03); Graph_h_ds10->GetXaxis()->SetTitleSize(0.035); Graph_h_ds10->GetXaxis()->SetTitleFont(22); Graph_h_ds10->GetYaxis()->SetLabelFont(22); Graph_h_ds10->GetYaxis()->SetLabelSize(0.03); Graph_h_ds10->GetYaxis()->SetTitleSize(0.035); Graph_h_ds10->GetYaxis()->SetTitleFont(22); Graph_h_ds10->GetZaxis()->SetLabelFont(22); Graph_h_ds10->GetZaxis()->SetLabelSize(0.03); Graph_h_ds10->GetZaxis()->SetTitleSize(0.035); Graph_h_ds10->GetZaxis()->SetTitleFont(22); grae->SetHistogram(Graph_h_ds10); grae->Draw("p"); TH1D *frame_3e5a840__10 = new TH1D("frame_3e5a840__10","",100,0.2,0.8); frame_3e5a840__10->SetBinContent(1,838.6371); frame_3e5a840__10->SetMaximum(838.6371); frame_3e5a840__10->SetEntries(4); frame_3e5a840__10->SetDirectory(0); frame_3e5a840__10->SetStats(0); frame_3e5a840__10->SetLineWidth(2); frame_3e5a840__10->GetXaxis()->SetTitle("M(#gamma#gamma)"); frame_3e5a840__10->GetXaxis()->SetLabelFont(22); frame_3e5a840__10->GetXaxis()->SetLabelSize(0.03); frame_3e5a840__10->GetXaxis()->SetTitleSize(0.035); frame_3e5a840__10->GetXaxis()->SetTitleFont(22); frame_3e5a840__10->GetYaxis()->SetTitle("Events / ( 0.006 )"); frame_3e5a840__10->GetYaxis()->SetLabelFont(22); frame_3e5a840__10->GetYaxis()->SetLabelSize(0.03); frame_3e5a840__10->GetYaxis()->SetTitleSize(0.8); frame_3e5a840__10->GetYaxis()->SetTitleFont(22); frame_3e5a840__10->GetZaxis()->SetLabelFont(22); frame_3e5a840__10->GetZaxis()->SetLabelSize(0.03); frame_3e5a840__10->GetZaxis()->SetTitleSize(0.035); frame_3e5a840__10->GetZaxis()->SetTitleFont(22); frame_3e5a840__10->Draw("AXISSAME"); c_1->Modified(); c->cd(); // ------------>Primitives in pad: c_2 c_2 = new TPad("c_2", "c_2",0,0,1,0.38); c_2->Draw(); c_2->cd(); c_2->Range(0.125,-8.571429,0.875,5.714286); c_2->SetBorderSize(2); c_2->SetGridx(); c_2->SetGridy(); c_2->SetTopMargin(0.05); c_2->SetBottomMargin(0.25); c_2->SetFrameFillColor(0); TH1F *hratio = new TH1F("hratio","",100,0.2,0.8); hratio->SetBinContent(1,-2.486245); hratio->SetBinContent(2,-0.5824064); hratio->SetBinContent(3,-2.009809); hratio->SetBinContent(4,1.652596); hratio->SetBinContent(5,-0.2515686); hratio->SetBinContent(6,0.1563072); hratio->SetBinContent(7,0.350447); hratio->SetBinContent(8,0.1241648); hratio->SetBinContent(9,-1.685935); hratio->SetBinContent(10,0.3067402); hratio->SetBinContent(11,0.1411414); hratio->SetBinContent(12,1.013046); hratio->SetBinContent(13,0.6523553); hratio->SetBinContent(14,-0.2308678); hratio->SetBinContent(15,0.3690898); hratio->SetBinContent(16,1.472145); hratio->SetBinContent(17,-0.1884363); hratio->SetBinContent(18,0.3395669); hratio->SetBinContent(19,-0.7627733); hratio->SetBinContent(20,-0.941282); hratio->SetBinContent(21,1.837861); hratio->SetBinContent(22,-0.2329237); hratio->SetBinContent(23,-0.8170755); hratio->SetBinContent(24,1.637796); hratio->SetBinContent(25,1.137642); hratio->SetBinContent(26,1.729662); hratio->SetBinContent(27,-0.2012583); hratio->SetBinContent(28,0.5085179); hratio->SetBinContent(29,-0.6817118); hratio->SetBinContent(30,-0.02351152); hratio->SetBinContent(31,-0.7896046); hratio->SetBinContent(32,-1.628973); hratio->SetBinContent(33,-1.646339); hratio->SetBinContent(34,-0.1473655); hratio->SetBinContent(35,-0.1174757); hratio->SetBinContent(36,1.110044); hratio->SetBinContent(37,1.887764); hratio->SetBinContent(38,-2.90585); hratio->SetBinContent(39,2.002898); hratio->SetBinContent(40,1.482301); hratio->SetBinContent(41,2.375215); hratio->SetBinContent(42,0.2263568); hratio->SetBinContent(43,-0.6031765); hratio->SetBinContent(44,-0.5888249); hratio->SetBinContent(45,-0.3054322); hratio->SetBinContent(46,-1.025076); hratio->SetBinContent(47,1.177818); hratio->SetBinContent(48,0.4120919); hratio->SetBinContent(49,-1.312402); hratio->SetBinContent(50,-0.6060877); hratio->SetBinContent(51,0.113081); hratio->SetBinContent(52,-0.6362028); hratio->SetBinContent(53,0.0544672); hratio->SetBinContent(54,1.968467); hratio->SetBinContent(55,-0.2285177); hratio->SetBinContent(56,-1.393971); hratio->SetBinContent(57,0.8964306); hratio->SetBinContent(58,0.2754136); hratio->SetBinContent(59,-1.49791); hratio->SetBinContent(60,0.8849161); hratio->SetBinContent(61,1.426776); hratio->SetBinContent(62,-1.367486); hratio->SetBinContent(63,-0.4075851); hratio->SetBinContent(64,-1.289181); hratio->SetBinContent(65,1.207068); hratio->SetBinContent(66,-0.12306); hratio->SetBinContent(67,0.4315258); hratio->SetBinContent(68,0.3137497); hratio->SetBinContent(69,-0.4950782); hratio->SetBinContent(70,0.4342352); hratio->SetBinContent(71,-1.603675); hratio->SetBinContent(72,1.70596); hratio->SetBinContent(73,-0.3265489); hratio->SetBinContent(74,-0.2957489); hratio->SetBinContent(75,0.08708589); hratio->SetBinContent(76,-0.4113961); hratio->SetBinContent(77,0.2122315); hratio->SetBinContent(78,-1.993998); hratio->SetBinContent(79,0.4165963); hratio->SetBinContent(80,-0.4741673); hratio->SetBinContent(81,-0.9966273); hratio->SetBinContent(82,-1.454691); hratio->SetBinContent(83,-0.973428); hratio->SetBinContent(84,-0.5101294); hratio->SetBinContent(85,0.4243199); hratio->SetBinContent(86,-0.1294748); hratio->SetBinContent(87,0.3082049); hratio->SetBinContent(88,-1.485225); hratio->SetBinContent(89,-0.1136087); hratio->SetBinContent(90,-0.2140563); hratio->SetBinContent(91,-0.6283539); hratio->SetBinContent(92,-0.004671325); hratio->SetBinContent(93,-1.095163); hratio->SetBinContent(94,-0.2594257); hratio->SetBinContent(95,-0.9261983); hratio->SetBinContent(96,0.08443348); hratio->SetBinContent(97,0.8529714); hratio->SetBinContent(98,0.1036135); hratio->SetBinContent(99,0.8999286); hratio->SetBinContent(100,1.497599); hratio->SetMinimum(-5); hratio->SetMaximum(5); hratio->SetEntries(26575); hratio->SetStats(0); ci = TColor::GetColor("#666699"); hratio->SetFillColor(ci); hratio->SetLineWidth(2); ci = TColor::GetColor("#666699"); hratio->SetMarkerColor(ci); hratio->GetXaxis()->SetTitle("M(#gamma#gamma) (GeV)"); hratio->GetXaxis()->SetLabelFont(22); hratio->GetXaxis()->SetLabelSize(0.06); hratio->GetXaxis()->SetTitleSize(0.09); hratio->GetXaxis()->SetTitleFont(22); hratio->GetYaxis()->SetTitle("(data-model)/error"); hratio->GetYaxis()->SetLabelFont(22); hratio->GetYaxis()->SetLabelSize(0.06); hratio->GetYaxis()->SetTitleSize(0.06); hratio->GetYaxis()->SetTitleOffset(0.4); hratio->GetYaxis()->SetTitleFont(22); hratio->GetZaxis()->SetLabelFont(22); hratio->GetZaxis()->SetLabelSize(0.03); hratio->GetZaxis()->SetTitleSize(0.035); hratio->GetZaxis()->SetTitleFont(22); hratio->Draw("bar"); TLine *line = new TLine(0.2,3,0.8,3); ci = TColor::GetColor("#ff0000"); line->SetLineColor(ci); line->SetLineStyle(2); line->SetLineWidth(3); line->Draw(); line = new TLine(0.2,-3,0.8,-3); ci = TColor::GetColor("#ff0000"); line->SetLineColor(ci); line->SetLineStyle(2); line->SetLineWidth(3); line->Draw(); line = new TLine(0.2,-3,0.2,3); ci = TColor::GetColor("#ff0000"); line->SetLineColor(ci); line->SetLineStyle(2); line->SetLineWidth(3); line->Draw(); line = new TLine(0.8,-3,0.8,3); ci = TColor::GetColor("#ff0000"); line->SetLineColor(ci); line->SetLineStyle(2); line->SetLineWidth(3); line->Draw(); c_2->Modified(); c->cd(); c->Modified(); c->cd(); c->SetSelected(c); }
2cddf5f9ed29540453836ef53e11cae8ff5312ae
4ac81025610b3c51a0f4cdfa741c6e6e75ae925f
/HARDWARE/MOTOR/motor.c
a9fd3f3e83b337f3e56999055f89d1c3297cf609
[]
no_license
yisea123/MOTOR-CODE-OF-SMART-SIGNPOST
a330665857d6a25af75addd4f7a29a08dcb5b746
c32d378fc1d400dcfb999e222607e1016e534354
refs/heads/master
2020-06-17T00:22:53.571068
2019-05-16T10:02:31
2019-05-16T10:02:31
null
0
0
null
null
null
null
GB18030
C
false
false
10,429
c
motor.c
/***************************************************************************/ /***************************************************************************/ /***************************************************************************/ /**********็”ตๆœบ็›ธๅ…ณๅ‡ฝๆ•ฐ*****************************************************/ /**********zflyไบŽ2017ๅนด11ๆœˆ13ๆ—ฅๅฎŒๆˆ***********************************/ /**********็‰ˆๆƒๆ‰€ๆœ‰๏ผš่ฅฟๅ—็ง‘ๆŠ€ๅคงๅญฆ**********************************/ #include "can.h" #include "motor.h" #include "stm32f2xx.h" #include "encoder.h" #include "math.h" #include "key.h" float vmx=0; float t=0; float f=1000; u32 motor_time=0; u32 motor_plus=0; char CANTxData[8]; float vmn; u32 all_pus; /****************************/ /****************************/ /******ๆ•ฐๆฎไธŠๅ‘ๅ‡ฝๆ•ฐ**********/ void CanSend(){ u16 angle_int,angle_float; u32 tmp=Prameter.angle_current*1000; u16 tmp1=vmx; angle_int=tmp/1000; angle_float=tmp%1000; CANTxData[0]=0x5a; CANTxData[1]=tmp1/256; CANTxData[2]=tmp%256; CANTxData[3]=angle_int/256; CANTxData[4]=angle_int%256; CANTxData[5]=angle_float/256; CANTxData[6]=angle_float%256; CANTxData[7]=0xa5; Can_Send(CANTxData); } /***********************/ /**********************/ /****ๅ›ž้›ถๅฎŒๆˆไธŠไผ ๅ‡ฝๆ•ฐ***/ void SennZeroFinish(void){ CANTxData[0]=0x0F; CANTxData[1]=0x00; CANTxData[2]=0x00; CANTxData[3]=0x00; CANTxData[4]=0x00; CANTxData[5]=0x00; CANTxData[6]=0x00; CANTxData[7]=0xF0; Can_Send(CANTxData); } /***********************/ /***********************/ /*******็”ตๆœบioๅˆๅง‹ๅŒ–********/ void MotorGpioInit(){ GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC, ENABLE); //ไฝฟ่ƒฝPB,PC็ซฏๅฃๆ—ถ้’Ÿ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14; //LEDR-->PB.0 ็ซฏๅฃ้…็ฝฎ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //ๆŽจๆŒฝ่พ“ๅ‡บ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IOๅฃ้€Ÿๅบฆไธบ50MHz GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); //ๆ นๆฎ่ฎพๅฎšๅ‚ๆ•ฐๅˆๅง‹ๅŒ–GPIOB.0 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8|GPIO_Pin_9; GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure); } /***********************/ /***********************/ /*****PWMๅˆๅง‹ๅŒ–*********/ void TIM1_PWM_Init(u32 arr,u32 psc) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1,ENABLE); RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,ENABLE); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_Init(GPIOA,&GPIO_InitStructure); GPIO_PinAFConfig(GPIOA,GPIO_PinSource8,GPIO_AF_TIM1); TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_Prescaler = psc; TIM_TimeBaseStructure.TIM_RepetitionCounter = 0; TIM_TimeBaseStructure.TIM_Period = arr; TIM_TimeBaseInit(TIM1,&TIM_TimeBaseStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable; TIM_OCInitStructure.TIM_Pulse = (arr+1)/2; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCPolarity_High; TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set; TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Reset; TIM_OC1Init(TIM1,&TIM_OCInitStructure); TIM_CtrlPWMOutputs(TIM1,DISABLE); TIM_Cmd(TIM1,DISABLE); } void TIM3_Int_Init(u16 arr,u16 psc) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //ๆ—ถ้’Ÿไฝฟ่ƒฝ //ๅฎšๆ—ถๅ™จTIM3ๅˆๅง‹ๅŒ– TIM_TimeBaseStructure.TIM_Period = arr; //่ฎพ็ฝฎๅœจไธ‹ไธ€ไธชๆ›ดๆ–ฐไบ‹ไปถ่ฃ…ๅ…ฅๆดปๅŠจ็š„่‡ชๅŠจ้‡่ฃ…่ฝฝๅฏ„ๅญ˜ๅ™จๅ‘จๆœŸ็š„ๅ€ผ TIM_TimeBaseStructure.TIM_Prescaler =psc; //่ฎพ็ฝฎ็”จๆฅไฝœไธบTIMxๆ—ถ้’Ÿ้ข‘็އ้™คๆ•ฐ็š„้ข„ๅˆ†้ข‘ๅ€ผ TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //่ฎพ็ฝฎๆ—ถ้’Ÿๅˆ†ๅ‰ฒ:TDTS = Tck_tim TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIMๅ‘ไธŠ่ฎกๆ•ฐๆจกๅผ TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //ๆ นๆฎๆŒ‡ๅฎš็š„ๅ‚ๆ•ฐๅˆๅง‹ๅŒ–TIMx็š„ๆ—ถ้—ดๅŸบๆ•ฐๅ•ไฝ TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE ); //ไฝฟ่ƒฝๆŒ‡ๅฎš็š„TIM3ไธญๆ–ญ,ๅ…่ฎธๆ›ดๆ–ฐไธญๆ–ญ //ไธญๆ–ญไผ˜ๅ…ˆ็บงNVIC่ฎพ็ฝฎ NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; //TIM3ไธญๆ–ญ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; //ๅ…ˆๅ ไผ˜ๅ…ˆ็บง0็บง NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3; //ไปŽไผ˜ๅ…ˆ็บง3็บง NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //IRQ้€š้“่ขซไฝฟ่ƒฝ NVIC_Init(&NVIC_InitStructure); //ๅˆๅง‹ๅŒ–NVICๅฏ„ๅญ˜ๅ™จ TIM_Cmd(TIM3,DISABLE); } /***********************/ /***********************/ /*****้€Ÿๅบฆ่ฎพ็ฝฎๅบ•ๅฑ‚ๅ‡ฝๆ•ฐ****/ /*****ๅ‚ๆ•ฐไธบๅˆ†้ข‘็ณปๆ•ฐ******/ void Speed_Change(u16 time) { u16 CCR4_Val=(time+1)/2; TIM1->ARR=time; TIM1->CCR1=CCR4_Val; } /***********************/ /***********************/ /****็”ตๆœบๅœๆญขๅ‡ฝๆ•ฐ*******/ void PAUSE(void) { TIM_ARRPreloadConfig(TIM1,DISABLE);//ไฝฟ่ƒฝTIM1้‡่ฃ… TIM_Cmd(TIM1,DISABLE); TIM_CtrlPWMOutputs(TIM1,DISABLE); } /***********************/ /***********************/ /*****่ฎกๆ—ถๅฎšๆ—ถๅ™จไธญๆ–ญๆœๅŠก็จ‹ๅบ******/ void TIM3_IRQHandler(void) //TIM3ไธญๆ–ญ { if (TIM_GetITStatus(TIM3, TIM_IT_Update) != RESET) //ๆฃ€ๆŸฅTIM3ๆ›ดๆ–ฐไธญๆ–ญๅ‘็”ŸไธŽๅฆ { //ๆธ…้™คTIMxๆ›ดๆ–ฐไธญๆ–ญๆ ‡ๅฟ— motor_time++; t=motor_time*0.0001; } TIM_ClearITPendingBit(TIM3, TIM_IT_Update ); } /***********************/ /***********************/ /******ๅฏๅŠจ็”ตๆœบๅ‡ฝๆ•ฐ*****/ void Motor_Start(){ Speed_Change(60000); TIM_ARRPreloadConfig(TIM1,ENABLE);//ไฝฟ่ƒฝTIM1้‡่ฃ… TIM_Cmd(TIM1,ENABLE); TIM_CtrlPWMOutputs(TIM1,ENABLE); } /***********************/ /***********************/ /*****็”ตๆœบๅคไฝๅ‡ฝๆ•ฐ******/ void motortest(){ motor_time=0; motor_plus=0; t=0; Motor_Start(); TIM_Cmd(TIM3,ENABLE); Speed_Change(30000); } /********************************************************/ /********************************************************/ /********************************************************/ /*******็”ตๆœบๅŠ ๅ‡้€Ÿๆ ธๅฟƒๅ‡ฝๆ•ฐ(้‡‡็”จsๆ›ฒ็บฟๅŠ ๅ‡้€Ÿ)**************/ /*******ๅ‚ๆ•ฐ1๏ผšๅผ€ๅง‹้ข‘็އๅ’Œ็ป“ๆŸใ€้ข‘็އ็›ธ็ญ‰******************/ /*******ๅ‚ๆ•ฐ2๏ผšๆœ€ๅคง็š„้ข‘็އ********************************/ /*******ๅ‚ๆ•ฐ3๏ผš้œ€่ฆๆ—‹่ฝฌ็š„่ง’ๅบฆ(ๅ•ไฝ๏ผšๅผงๅบฆ)****************/ void speed_accandc(u32 startf,u32 maxf,u32 pus,float ang){ u16 div = 0; //ๅˆ†้ข‘็ณปๆ•ฐ float error = 0; //ๅŠ ๅ‡้€Ÿ็š„ๅทฎๅ€ผ float l; //ๆŒ‰ๆœ€ๅคง้€Ÿๅบฆ่ฆๆฑ‚่ฎก็ฎ—็š„ไฝ็งป float T = 0; //ๅŒ€้€Ÿๆ—ถ้—ด float T1 = 0; //ๅŠ ๅŠ ้€Ÿ้˜ถๆฎต็š„ๆ—ถ้—ด float T2,T3,T4,T5; l = (maxf * maxf - startf * startf) * 2.0 / am; /******************************************/ /******************************************/ /******ๆ นๆฎๅฎž้™…ๆƒ…ๅ†ต้‡ๆ–ฐ่ฎก็ฎ—ๆœ€ๅคง้€Ÿๅบฆ********/ if(l > pus){ maxf = sqrt(am * pus / 2.0 + startf * startf); T = 0; } else T = (pus - l) / maxf; T1 = (maxf - startf) / (am); T2 = 2 * T1; T3 = T2 + T; T4 = T3 + T1; T5 = T4 + T1; motor_time = 0; motor_plus = 0; t = 0; Motor_Start(); f=1000; TIM_Cmd(TIM3,ENABLE); Prameter.staus = 0; error = maxf - startf; /***************************************/ /****ๅผ€ๅง‹ๅŠ ๅ‡้€Ÿ************************/ while(1){ if( Prameter.staus == 1){ Prameter.staus = 0; break; } if(t <= T1) f = 0.5 * am2 * t * t / error + startf; else if(t <= T2) f = maxf - am2 * 0.5 * (T2 - t) * (T2 - t) / error; else if(t <= T3) f = maxf; else if(t <= T4) f = maxf - am2 * 0.5 * (t - T3) * (t - T3) / error; else if(t <= T5) f = am2 * (T5 - t) * (T5 - t) / error * 0.5 + startf; else break; div = (1000000 / f); Speed_Change(div); } } /****************************************/ /****************************************/ /********็”ตๆœบๅŠ ๅ‡้€Ÿๅผ€ๅง‹็จ‹ๅบ**************/ /****vmax:ๅŠ ้€Ÿๅ…่ฎธ็š„ๆœ€ๅคง้€Ÿๅบฆ,ๅ•ไฝ:r/min***/ /****vmin:ๅŠ ๅ‡้€Ÿ็š„่ตทๅง‹้€Ÿๅบฆ,ๅ•ไฝ:r/min****/ /****ang:ๅŠ ๅ‡้€ŸๅฎŒๆˆ็š„่ง’ๅบฆ,ๅ•ไฝ๏ผšๅผงๅบฆ*****/ void start_acc(float vmax,float vmin,float ang){ u32 pu; u32 stf,maf; stf = vmin / 60.0 * PUS_PER; maf = vmax / 60.0 * PUS_PER; pu = ang / 360.0 * PUS_PER * DE_RATE; speed_accandc(stf ,maf,pu,ang); } void ID_GPIOInit(){ GPIO_InitTypeDef GPIO_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); //ไฝฟ่ƒฝPB,PC็ซฏๅฃๆ—ถ้’Ÿ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3; //LEDR-->PB.0 ็ซฏๅฃ้…็ฝฎ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //ๆŽจๆŒฝ่พ“ๅ‡บ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IOๅฃ้€Ÿๅบฆไธบ50MHz GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOC, &GPIO_InitStructure); } u32 Get_ID() { u32 res; u8 in1=0,in2=0,in3=0,in4=0; in1=!GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_0); in2=(!GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_1))<<1; in3=(!GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_2))<<2; in4=(!GPIO_ReadInputDataBit(GPIOC,GPIO_Pin_3))<<3; res=in1+in2+in3+in4; return res; }
b209ec7aecd16f73c178dc1236356753ab94e756
98ee5bc94e754d9b1802d66d7b5c5fcf184a6c90
/lib/include/snow3g_submit.h
1f7293115a012087d15475d4addc8aef67c5dbf0
[ "BSD-3-Clause" ]
permissive
intel/intel-ipsec-mb
f180701ca3dbdc26f310c5706cb3e8577defa2df
9e17d6cad1f99e64f3534053a3ff096c46646058
refs/heads/main
2023-08-30T13:20:47.709185
2023-08-28T13:17:46
2023-08-29T13:14:00
73,856,328
255
89
BSD-3-Clause
2023-08-30T08:42:45
2016-11-15T21:22:17
C
UTF-8
C
false
false
2,958
h
snow3g_submit.h
/******************************************************************************* Copyright (c) 2012-2023, Intel Corporation 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 Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #ifndef SNOW3G_SUBMIT_H #define SNOW3G_SUBMIT_H #include "intel-ipsec-mb.h" static inline IMB_JOB *def_submit_snow3g_uea2_job(IMB_MGR *state, IMB_JOB *job) { const snow3g_key_schedule_t *key = job->enc_keys; const uint32_t bitlen = (uint32_t) job->msg_len_to_cipher_in_bits; const uint32_t bitoff = (uint32_t) job->cipher_start_offset_in_bits; /* Use bit length API if * - msg length is not a multiple of bytes * - bit offset is not a multiple of bytes */ if ((bitlen & 0x07) || (bitoff & 0x07)) { IMB_SNOW3G_F8_1_BUFFER_BIT(state, key, job->iv, job->src, job->dst, bitlen, bitoff); } else { const uint32_t bytelen = bitlen >> 3; const uint32_t byteoff = bitoff >> 3; const void *src = job->src + byteoff; void *dst = job->dst + byteoff; IMB_SNOW3G_F8_1_BUFFER(state, key, job->iv, src, dst, bytelen); } job->status |= IMB_STATUS_COMPLETED_CIPHER; return job; } static inline IMB_JOB *def_flush_snow3g_uea2_job(IMB_MGR *state) { (void) state; return NULL; } #endif /* SNOW3G_SUBMIT_H */
73bf6a4d7da1e572b123305cd73a8327c7b96c1c
3499b1145f0827498625ec0ac71ba82bbbbda4ed
/board-package-source/libraries/Arduboy/src/ab_logo.c
3718e5cde969f5bb9c3970dd3d85dca135af7bd7
[ "BSD-3-Clause", "BSD-2-Clause", "CC0-1.0" ]
permissive
MrBlinky/Arduboy-homemade-package
09120974a9c6a9ad1871ac68cbf852bb253bbd8e
3b71be313e1a4daaa745a15cdf2b58c92b101441
refs/heads/master
2023-07-22T18:36:15.664481
2023-07-15T22:08:51
2023-07-15T22:08:51
121,283,656
104
31
CC0-1.0
2023-01-02T08:24:54
2018-02-12T18:16:15
C++
UTF-8
C
false
false
1,246
c
ab_logo.c
#include <avr/pgmspace.h> #ifndef ARDUBOY_LOGO_CREATED #define ARDUBOY_LOGO_CREATED // arduboy_logo.png // 88x16 PROGMEM const unsigned char arduboy_logo[] = { 0xF0, 0xF8, 0x9C, 0x8E, 0x87, 0x83, 0x87, 0x8E, 0x9C, 0xF8, 0xF0, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFE, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xC7, 0xEE, 0x7C, 0x38, 0x00, 0x00, 0xF8, 0xFC, 0x0E, 0x07, 0x03, 0x03, 0x03, 0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0x3F, 0x7F, 0xE0, 0xC0, 0x80, 0x80, 0xC0, 0xE0, 0x7F, 0x3F, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0x3E, 0x77, 0xE3, 0xC1, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00, 0x1F, 0x3F, 0x70, 0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00, 0x7F, 0xFF, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xE3, 0x77, 0x3E, 0x1C, 0x00, 0x00, 0x1F, 0x3F, 0x70, 0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00 }; #endif
ccc9dee273b29502ee66d57654c14f21c731fe35
a990004e8263ed825eb4ee21c7eb842dd886cde2
/src/lib/crypto/test/iso8859.c
bed724491092ca4f2aae0a77314378aac318f6ca
[ "BSD-2-Clause" ]
permissive
opendnssec/SoftHSMv2
8233f100f47c62f3b091c00706d9d13bfd1486bc
f4661af6680e187f220921c0a91d17d71a680345
refs/heads/develop
2023-08-04T23:48:24.514490
2023-08-02T20:51:58
2023-08-02T20:51:58
10,314,787
643
327
NOASSERTION
2023-09-01T07:23:24
2013-05-27T12:54:47
C++
UTF-8
C
false
false
878
c
iso8859.c
/* This code was taken from http://www.fourmilab.ch/random/ where it states that: This software is in the public domain. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided โ€œas isโ€ without express or implied warranty. */ /* ISO 8859/1 Latin-1 alphabetic and upper and lower case bit vector tables. */ /* LINTLIBRARY */ unsigned char isoalpha[32] = { 0,0,0,0,0,0,0,0,127,255,255,224,127,255,255,224,0,0,0,0,0,0,0,0,255,255, 254,255,255,255,254,255 }; unsigned char isoupper[32] = { 0,0,0,0,0,0,0,0,127,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,255,255,254,254, 0,0,0,0 }; unsigned char isolower[32] = { 0,0,0,0,0,0,0,0,0,0,0,0,127,255,255,224,0,0,0,0,0,0,0,0,0,0,0,1,255,255, 254,255 };
265bc0ecfae49576f44a6964c915080afeb1be40
004fc94631b8b8572200eef17ed0eb04adddc6f1
/lcd1602.c
c2c3a1bb3f35f4f49dab8d6e68485e28dbce1a27
[]
no_license
Vincent-Canada/lcd1602-i2c-stm32-hal
1ac094b336bce352a7ba358f415fef5372ce11e0
afbdc0d08b6f33469949d3e6226dfd3ddf184ec9
refs/heads/main
2023-03-20T16:22:09.129128
2021-03-18T20:02:06
2021-03-18T20:02:06
349,196,101
0
0
null
null
null
null
UTF-8
C
false
false
3,770
c
lcd1602.c
/* * lcd1602.c * * Created on: Mar 18, 2021 * Author: Janmay */ #include "stm32f4xx_hal.h" #include "lcd1602.h" #include "i2c.h" /*This function is used to send commands to lcd1602 through PCF8574 * lcd1602 is using 4 bit connection mode, and one byte needs to be sent two times. Upper 4 bits first. * EN=1 to send data to lcd1602. */ void lcd_send_cmd (uint8_t cmd) { uint8_t data_u, data_l; uint8_t data_t[4]; data_u = (cmd&0xf0); data_l = ((cmd<<4)&0xf0); data_t[0] = data_u|0x0C; //EN=1, RS=0 data_t[1] = data_u|0x08; //EN=0, RS=0 data_t[2] = data_l|0x0C; //EN=1, RS=0 data_t[3] = data_l|0x08; //EN=0, RS=0 HAL_I2C_Master_Transmit (&lcd1602_hi2c, lcd1602_address,(uint8_t *) data_t, 4, 2); } /*This function is used to send data to lcd1602 through PCF8574 * lcd1602 is using 4 bit connection mode, and one byte needs to be sent two times. Upper 4 bits first. * EN=1 to send data to lcd1602. */ void lcd_send_data (uint8_t data) { uint8_t data_u; uint8_t data_l; uint8_t data_t[4]; data_u = (data&0xf0); data_l = ((data<<4)&0xf0); data_t[0] = data_u|0x0D; //en=1, rs=1 data_t[1] = data_u|0x09; //en=0, rs=1 data_t[2] = data_l|0x0D; //en=1, rs=1 data_t[3] = data_l|0x09; //en=0, rs=1 HAL_I2C_Master_Transmit (&lcd1602_hi2c, lcd1602_address,(uint8_t *) data_t, 4, 2); } /*This function is used to display strings in lcd1602. * needs to set cursor befroe using this function. */ void lcd_display_string (char *str) { while (*str) lcd_send_data (*str++); } /*This function is used to display strings in lcd1602. * needs to provide cursor position using this function. */ void lcd_display(uint8_t row, uint8_t col, char *str) { lcd_set_cursor(row, col); while (*str) lcd_send_data (*str++); } /*This function is used to do the initialization. * The sequence is described in lcd1602 data sheet */ void lcd_init (void) { // 4 bit initialization: needs to set to 8 bit first and change it to 4 bit after. HAL_Delay(50); // wait for >40ms lcd_send_cmd (0x30); HAL_Delay(5); // wait for >4.1ms lcd_send_cmd (0x30); HAL_Delay(1); // wait for >100us lcd_send_cmd (0x30); HAL_Delay(10); lcd_send_cmd (0x20); // 4bit mode HAL_Delay(10); // screen display initialization lcd_send_cmd (0x28); // Function set --> DL=0 (4 bit mode), N = 1 (2 line display) F = 0 (5x8 characters) HAL_Delay(1); lcd_send_cmd (0x08); //Display on/off control --> D=0,C=0, B=0 ---> display off HAL_Delay(1); lcd_send_cmd (0x01); // clear display HAL_Delay(1); HAL_Delay(1); lcd_send_cmd (0x06); //Entry mode set --> I/D = 1 (increment cursor) & S = 0 (no shift) HAL_Delay(1); lcd_send_cmd (0x0C); //Display on/off control --> D = 1, C and B = 0. (Cursor and blink, last two bits) } /*This function is used to set cursor position. * row: 0, 1; col: 0 - 15 */ void lcd_set_cursor(uint8_t row, uint8_t col) { uint8_t address; switch (row) { case 0: address=0x00+col; break; case 1: address=0x40+col; break; default: break; } address=address|0x80; lcd_send_cmd(address); } /*This function is used to turn display on and off. * can yurn on display, cursor and cursor blink on and off. */ void lcd_display_on_off(uint8_t display_on, uint8_t cursor_on, uint8_t cursor_blink_on) { uint8_t data_t=0; data_t=data_t|(display_on<<2)|(cursor_on<<1)|(cursor_blink_on<<0); data_t=data_t|0x08; lcd_send_cmd(data_t); } /*This function is used to turn back-light on/off. */ void lcd_backlight_on_off(uint8_t light_on) { uint8_t data_t=0; data_t=data_t|(light_on<<3); HAL_I2C_Master_Transmit (&lcd1602_hi2c, lcd1602_address,(uint8_t *) &data_t, 1, 2); } /*This function is used to clear display. */ void lcd_display_clear(void) { uint8_t data_t; data_t=0x01; lcd_send_cmd(data_t); }
e9864f1557db208cc8b6585c937ba6a3360721ca
ad8d01ab8e6b409d706484350bc6664618548051
/project/blink/stateMachines.c
e04d8e84be1d330dd7d848cc248d894f3ed06095
[]
no_license
utep-cs-arch-classes/proj2-blinky-toy-naescobedo
7f24ddbef1f893b6e641cd9280b3e0c51bd720ce
8c390407568d6352ea2be6e6e9e6488e6fbc1e06
refs/heads/master
2023-04-09T20:48:23.736178
2021-04-15T12:20:45
2021-04-15T12:20:45
352,481,270
0
0
null
2021-03-29T01:29:42
2021-03-29T01:29:38
null
UTF-8
C
false
false
785
c
stateMachines.c
#include <msp430.h> #include "stateMachines.h" #include "led.h" char toggle_red() /* always toggle! */ { static char state = 0; switch (state) { case 0: red_on = 1; state = 1; break; case 1: red_on = 0; state = 0; break; } return 1; /* always changes an led */ } char toggle_green() /* only toggle green if red is on! */ { char changed = 0; if (red_on) { green_on ^= 1; changed = 1; } return changed; } void state_advance() /* toggles red and green alternating them */ { char changed = 0; static enum {R=0, G=1} color = G; switch (color) { case R: green_on=1; red_on=0; color = G; break; case G: red_on =1; green_on = 0; color = R; break; } changed =1; led_changed = changed; led_update(); }
372df1adb1a618ec927736dee3d9310560c78e29
8239a5b618fce4f1f137d674eaee74e706e665ee
/tp6ex1.c
cd15e9373bad90c22628c5b9e49f59a1775121a9
[]
no_license
ISET-Charguia/tp6-hamzayaakoubi
fabf4dccbe75036c75ed62365603186269c0cf6c
e497d8623c9f6824c37e0fb5e693c373867e357c
refs/heads/master
2021-08-20T05:59:42.169836
2017-11-28T10:51:56
2017-11-28T10:51:56
111,579,851
0
0
null
null
null
null
UTF-8
C
false
false
861
c
tp6ex1.c
#include <stdio.h> #include <string.h> int nbmot(char ch[]); int separateur(char c); char majus(char c); void main () { char ch[30]; printf("Donner une chaine " ); gets(ch); printf("nombre de mot %d \n", nbmot(ch)); printf("%s\n",ch ); } int separateur (char c) { char caractere[]=" .,;!?"; if (strchr(caractere,c)!=NULL) { return 1; }else return 0; } char majus(char c) { c-=32; return c; } int nbmot (char ch[]) { int i=0, nb_mot=0; while (separateur(ch[i])==1) { i++; } ch[i]=majus(ch[i]); for(i ;i<strlen(ch);i++) { if ((separateur(ch[i])==1)&&(ch[i]!=ch[i+1])) { nb_mot++; } if ((separateur(ch[i])==0)&&(separateur(ch[i-1])==1)) { ch[i]=majus(ch[i]); } } if ((separateur(ch[strlen(ch)-1]))==NULL) { nb_mot+=1; } return nb_mot; }
3cd16ba49e5ff9ddb8589c83355ae3164ebdc2a1
1e074e828ca4bd5e4ee239c81745b6b2b818a6c7
/apv5sdk-v15/autelan/wtpd_ng/src/wcpss/src/app/pub/CWCommon.h
8d409a9632ef0eebdf5fbda9f3f6b7be092da2f2
[]
no_license
hades13/apv5sdk-v15
51698f727b17f0cc05cbfd0df6ffff3da31d5b6e
56b8a22a93e026580ecc8b33d18267e4ace4e02a
refs/heads/master
2020-03-18T11:34:29.809253
2016-05-03T10:45:27
2016-05-03T10:45:27
null
0
0
null
null
null
null
UTF-8
C
false
false
4,479
h
CWCommon.h
/******************************************************************************************* * Copyright (c) 2006-7 Laboratorio di Sistemi di Elaborazione e Bioingegneria Informatica * * Universita' Campus BioMedico - Italy * * * * This program is free software; you can redistribute it and/or modify it under the terms * * of the GNU General Public License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License along with this * * program; if not, write to the: * * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * * MA 02111-1307, USA. * * * * --------------------------------------------------------------------------------------- * * Project: Capwap * * * * Author : Ludovico Rossi (ludo@bluepixysw.com) * * Del Moro Andrea (andrea_delmoro@libero.it) * * Giovannini Federica (giovannini.federica@gmail.com) * * Massimo Vellucci (m.vellucci@unicampus.it) * * Mauro Bisson (mauro.bis@gmail.com) * *******************************************************************************************/ #ifndef __CAPWAP_CWCommon_HEADER__ #define __CAPWAP_CWCommon_HEADER__ #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/time.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <signal.h> #include <unistd.h> #include <linux/if_ether.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/file.h> #include <sys/stat.h> #include "wireless_copy.h" #include "../wtpdlib/common.h" #include "../wtpdlib/wtpd_mib.h" #include "../wtpdlib/wtpd_platform.h" #include "../wtpdlib/wtpd_product.h" // make sure the types really have the right sizes #define CW_COMPILE_TIME_ASSERT(name, x) typedef int CWDummy_ ## name[(x) * 2 - 1] // if you get a compile error, change types (NOT VALUES!) according to your system CW_COMPILE_TIME_ASSERT(int_size, sizeof(int) == 4); CW_COMPILE_TIME_ASSERT(char_size, sizeof(char) == 1); #define DEFAULT_LOG_SIZE 1000000 typedef enum { CW_ENTER_SULKING, CW_ENTER_DISCOVERY, CW_ENTER_JOIN, CW_ENTER_CONFIGURE, CW_ENTER_DATA_CHECK, CW_ENTER_RUN, CW_ENTER_RESET, CW_QUIT, CW_ENTER_IMAGE_DATA, CW_BAK_RUN } CWStateTransition; extern const char *CW_CONFIG_FILE; extern int gCWForceMTU; extern int gCWRetransmitTimer; extern int gCWNeighborDeadInterval; extern int gCWMaxRetransmit; extern int gMaxLogFileSize; extern int gMaxWTPLogFileSize; extern int gEnabledLog; #include "CWStevens.h" #include "config.h" #include "CWLog.h" #include "CWErrorHandling.h" #include "CWRandom.h" //#include "CWTimer.h" #include "timerlib.h" #include "CWThread.h" #include "CWNetwork.h" #include "CWList.h" #include "CWSafeList.h" #include "CWProtocol.h" #include "CWSecurity.h" #include "CWConfigFile.h" int CWTimevalSubtract(struct timeval *res, const struct timeval *x, const struct timeval *y); CWBool CWParseSettingsFile(); void CWErrorHandlingInitLib(); extern CWThreadMutex gCreateIDMutex; #define RADIO_ID_OFFSET 1 #if 0 int sem_timedwait(CWThreadTimedSem *, struct timespec *); #endif #endif
9b7e84420dd686ce370f5a804fd6a6eacf843642
e3ddebd5c8cf9b2c7af2c0b70beb6faeb14b8209
/LimeSDR-Mini_lms7_trx/software/lms_ctr_bsp/HAL/inc/nios2.h
663810a20268bd6cd2bc186b6d731f8e44bf1cb5
[ "Apache-2.0" ]
permissive
myriadrf/LimeSDR-Mini_GW
7537053cc5a98664fc0334e81bb203131bc7277b
05820628809ea4a10fa7eab5388766ed5de97812
refs/heads/master
2022-09-06T15:14:14.456399
2022-08-27T13:43:30
2022-08-27T13:43:30
95,960,868
51
40
Apache-2.0
2022-06-09T13:33:27
2017-07-01T11:42:38
VHDL
UTF-8
C
false
false
10,841
h
nios2.h
#ifndef __NIOS2_H__ #define __NIOS2_H__ /****************************************************************************** * * * License Agreement * * * * Copyright (c) 2008 Altera Corporation, San Jose, California, USA. * * All rights reserved. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the "Software"), * * to deal in the Software without restriction, including without limitation * * the rights to use, copy, modify, merge, publish, distribute, sublicense, * * and/or sell copies of the Software, and to permit persons to whom the * * Software is furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * * DEALINGS IN THE SOFTWARE. * * * * This agreement shall be governed in all respects by the laws of the State * * of California and by the laws of the United States of America. * * * ******************************************************************************/ /* * This header provides processor specific macros for accessing the Nios2 * control registers. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * Number of available IRQs in internal interrupt controller. */ #define NIOS2_NIRQ 32 /* * Macros for accessing select Nios II general-purpose registers. */ /* ET (Exception Temporary) register */ #define NIOS2_READ_ET(et) \ do { __asm ("mov %0, et" : "=r" (et) ); } while (0) #define NIOS2_WRITE_ET(et) \ do { __asm volatile ("mov et, %z0" : : "rM" (et)); } while (0) /* SP (Stack Pointer) register */ #define NIOS2_READ_SP(sp) \ do { __asm ("mov %0, sp" : "=r" (sp) ); } while (0) /* * Macros for useful processor instructions. */ #define NIOS2_BREAK() \ do { __asm volatile ("break"); } while (0) #define NIOS2_REPORT_STACK_OVERFLOW() \ do { __asm volatile("break 3"); } while (0) /* * Macros for accessing Nios II control registers. */ #define NIOS2_READ_STATUS(dest) \ do { dest = __builtin_rdctl(0); } while (0) #define NIOS2_WRITE_STATUS(src) \ do { __builtin_wrctl(0, src); } while (0) #define NIOS2_READ_ESTATUS(dest) \ do { dest = __builtin_rdctl(1); } while (0) #define NIOS2_READ_BSTATUS(dest) \ do { dest = __builtin_rdctl(2); } while (0) #define NIOS2_READ_IENABLE(dest) \ do { dest = __builtin_rdctl(3); } while (0) #define NIOS2_WRITE_IENABLE(src) \ do { __builtin_wrctl(3, src); } while (0) #define NIOS2_READ_IPENDING(dest) \ do { dest = __builtin_rdctl(4); } while (0) #define NIOS2_READ_CPUID(dest) \ do { dest = __builtin_rdctl(5); } while (0) #define NIOS2_READ_EXCEPTION(dest) \ do { dest = __builtin_rdctl(7); } while (0) #define NIOS2_READ_PTEADDR(dest) \ do { dest = __builtin_rdctl(8); } while (0) #define NIOS2_WRITE_PTEADDR(src) \ do { __builtin_wrctl(8, src); } while (0) #define NIOS2_READ_TLBACC(dest) \ do { dest = __builtin_rdctl(9); } while (0) #define NIOS2_WRITE_TLBACC(src) \ do { __builtin_wrctl(9, src); } while (0) #define NIOS2_READ_TLBMISC(dest) \ do { dest = __builtin_rdctl(10); } while (0) #define NIOS2_WRITE_TLBMISC(src) \ do { __builtin_wrctl(10, src); } while (0) #define NIOS2_READ_ECCINJ(dest) \ do { dest = __builtin_rdctl(11); } while (0) #define NIOS2_WRITE_ECCINJ(src) \ do { __builtin_wrctl(11, src); } while (0) #define NIOS2_READ_BADADDR(dest) \ do { dest = __builtin_rdctl(12); } while (0) #define NIOS2_WRITE_CONFIG(src) \ do { __builtin_wrctl(13, src); } while (0) #define NIOS2_READ_CONFIG(dest) \ do { dest = __builtin_rdctl(13); } while (0) #define NIOS2_WRITE_MPUBASE(src) \ do { __builtin_wrctl(14, src); } while (0) #define NIOS2_READ_MPUBASE(dest) \ do { dest = __builtin_rdctl(14); } while (0) #define NIOS2_WRITE_MPUACC(src) \ do { __builtin_wrctl(15, src); } while (0) #define NIOS2_READ_MPUACC(dest) \ do { dest = __builtin_rdctl(15); } while (0) /* * Nios II control registers that are always present */ #define NIOS2_STATUS status #define NIOS2_ESTATUS estatus #define NIOS2_BSTATUS bstatus #define NIOS2_IENABLE ienable #define NIOS2_IPENDING ipending #define NIOS2_CPUID cpuid /* * Bit masks & offsets for Nios II control registers. * The presence and size of a field is sometimes dependent on the Nios II * configuration. Bit masks for every possible field and the maximum size of * that field are defined. * * All bit-masks are expressed relative to the position * of the data with a register. To read data that is LSB- * aligned, the register read data should be masked, then * right-shifted by the designated "OFST" macro value. The * opposite should be used for register writes when starting * with LSB-aligned data. */ /* STATUS, ESTATUS, BSTATUS, and SSTATUS registers */ #define NIOS2_STATUS_PIE_MSK (0x00000001) #define NIOS2_STATUS_PIE_OFST (0) #define NIOS2_STATUS_U_MSK (0x00000002) #define NIOS2_STATUS_U_OFST (1) #define NIOS2_STATUS_EH_MSK (0x00000004) #define NIOS2_STATUS_EH_OFST (2) #define NIOS2_STATUS_IH_MSK (0x00000008) #define NIOS2_STATUS_IH_OFST (3) #define NIOS2_STATUS_IL_MSK (0x000003f0) #define NIOS2_STATUS_IL_OFST (4) #define NIOS2_STATUS_CRS_MSK (0x0000fc00) #define NIOS2_STATUS_CRS_OFST (10) #define NIOS2_STATUS_PRS_MSK (0x003f0000) #define NIOS2_STATUS_PRS_OFST (16) #define NIOS2_STATUS_NMI_MSK (0x00400000) #define NIOS2_STATUS_NMI_OFST (22) #define NIOS2_STATUS_RSIE_MSK (0x00800000) #define NIOS2_STATUS_RSIE_OFST (23) #define NIOS2_STATUS_SRS_MSK (0x80000000) #define NIOS2_STATUS_SRS_OFST (31) /* EXCEPTION register */ #define NIOS2_EXCEPTION_REG_CAUSE_MASK (0x0000007c) #define NIOS2_EXCEPTION_REG_CAUSE_OFST (2) #define NIOS2_EXCEPTION_REG_ECCFTL_MASK (0x80000000) #define NIOS2_EXCEPTION_REG_ECCFTL_OFST (31) /* PTEADDR (Page Table Entry Address) register */ #define NIOS2_PTEADDR_REG_VPN_OFST 2 #define NIOS2_PTEADDR_REG_VPN_MASK 0x3ffffc #define NIOS2_PTEADDR_REG_PTBASE_OFST 22 #define NIOS2_PTEADDR_REG_PTBASE_MASK 0xffc00000 /* TLBACC (TLB Access) register */ #define NIOS2_TLBACC_REG_PFN_OFST 0 #define NIOS2_TLBACC_REG_PFN_MASK 0xfffff #define NIOS2_TLBACC_REG_G_OFST 20 #define NIOS2_TLBACC_REG_G_MASK 0x100000 #define NIOS2_TLBACC_REG_X_OFST 21 #define NIOS2_TLBACC_REG_X_MASK 0x200000 #define NIOS2_TLBACC_REG_W_OFST 22 #define NIOS2_TLBACC_REG_W_MASK 0x400000 #define NIOS2_TLBACC_REG_R_OFST 23 #define NIOS2_TLBACC_REG_R_MASK 0x800000 #define NIOS2_TLBACC_REG_C_OFST 24 #define NIOS2_TLBACC_REG_C_MASK 0x1000000 #define NIOS2_TLBACC_REG_IG_OFST 25 #define NIOS2_TLBACC_REG_IG_MASK 0xfe000000 /* TLBMISC (TLB Miscellaneous) register */ #define NIOS2_TLBMISC_REG_D_OFST 0 #define NIOS2_TLBMISC_REG_D_MASK 0x1 #define NIOS2_TLBMISC_REG_PERM_OFST 1 #define NIOS2_TLBMISC_REG_PERM_MASK 0x2 #define NIOS2_TLBMISC_REG_BAD_OFST 2 #define NIOS2_TLBMISC_REG_BAD_MASK 0x4 #define NIOS2_TLBMISC_REG_DBL_OFST 3 #define NIOS2_TLBMISC_REG_DBL_MASK 0x8 #define NIOS2_TLBMISC_REG_PID_OFST 4 #define NIOS2_TLBMISC_REG_PID_MASK 0x3fff0 #define NIOS2_TLBMISC_REG_WE_OFST 18 #define NIOS2_TLBMISC_REG_WE_MASK 0x40000 #define NIOS2_TLBMISC_REG_RD_OFST 19 #define NIOS2_TLBMISC_REG_RD_MASK 0x80000 #define NIOS2_TLBMISC_REG_WAY_OFST 20 #define NIOS2_TLBMISC_REG_WAY_MASK 0xf00000 #define NIOS2_TLBMISC_REG_EE_OFST 24 #define NIOS2_TLBMISC_REG_EE_MASK 0x1000000 /* ECCINJ (ECC Inject) register */ #define NIOS2_ECCINJ_REG_RF_OFST 0 #define NIOS2_ECCINJ_REG_RF_MASK 0x3 #define NIOS2_ECCINJ_REG_ICTAG_OFST 2 #define NIOS2_ECCINJ_REG_ICTAG_MASK 0xc #define NIOS2_ECCINJ_REG_ICDAT_OFST 4 #define NIOS2_ECCINJ_REG_ICDAT_MASK 0x30 #define NIOS2_ECCINJ_REG_DCTAG_OFST 6 #define NIOS2_ECCINJ_REG_DCTAG_MASK 0xc0 #define NIOS2_ECCINJ_REG_DCDAT_OFST 8 #define NIOS2_ECCINJ_REG_DCDAT_MASK 0x300 #define NIOS2_ECCINJ_REG_TLB_OFST 10 #define NIOS2_ECCINJ_REG_TLB_MASK 0xc00 #define NIOS2_ECCINJ_REG_DTCM0_OFST 12 #define NIOS2_ECCINJ_REG_DTCM0_MASK 0x3000 #define NIOS2_ECCINJ_REG_DTCM1_OFST 14 #define NIOS2_ECCINJ_REG_DTCM1_MASK 0xc000 #define NIOS2_ECCINJ_REG_DTCM2_OFST 16 #define NIOS2_ECCINJ_REG_DTCM2_MASK 0x30000 #define NIOS2_ECCINJ_REG_DTCM3_OFST 18 #define NIOS2_ECCINJ_REG_DTCM3_MASK 0xc0000 /* CONFIG register */ #define NIOS2_CONFIG_REG_PE_MASK (0x00000001) #define NIOS2_CONFIG_REG_PE_OFST (0) #define NIOS2_CONFIG_REG_ANI_MASK (0x00000002) #define NIOS2_CONFIG_REG_ANI_OFST (1) #define NIOS2_CONFIG_REG_ECCEN_MASK (0x00000004) #define NIOS2_CONFIG_REG_ECCEN_OFST (2) #define NIOS2_CONFIG_REG_ECCEXC_MASK (0x00000008) #define NIOS2_CONFIG_REG_ECCEXC_OFST (3) /* MPUBASE (MPU Base Address) Register */ #define NIOS2_MPUBASE_D_MASK (0x00000001) #define NIOS2_MPUBASE_D_OFST (0) #define NIOS2_MPUBASE_INDEX_MASK (0x0000003e) #define NIOS2_MPUBASE_INDEX_OFST (1) #define NIOS2_MPUBASE_BASE_ADDR_MASK (0xffffffc0) #define NIOS2_MPUBASE_BASE_ADDR_OFST (6) /* MPUACC (MPU Access) Register */ #define NIOS2_MPUACC_LIMIT_MASK (0xffffffc0) #define NIOS2_MPUACC_LIMIT_OFST (6) #define NIOS2_MPUACC_MASK_MASK (0xffffffc0) #define NIOS2_MPUACC_MASK_OFST (6) #define NIOS2_MPUACC_C_MASK (0x00000020) #define NIOS2_MPUACC_C_OFST (5) #define NIOS2_MPUACC_PERM_MASK (0x0000001c) #define NIOS2_MPUACC_PERM_OFST (2) #define NIOS2_MPUACC_RD_MASK (0x00000002) #define NIOS2_MPUACC_RD_OFST (1) #define NIOS2_MPUACC_WR_MASK (0x00000001) #define NIOS2_MPUACC_WR_OFST (0) #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __NIOS2_H__ */
83b6089636fc0e89481320e75b8b77fa5832a4e0
148d0c150fc4e8320cefe290e3016279facfeb07
/Array/arrat sum+avg.c
807402b65771e809cb8fdac87b976454aaf0a198
[]
no_license
Arnab1899/Competitve-Programming
78b15dcb4dcf492478ddf6a7ddcede0f256796e6
244b64363f0f45ba6126f25c13b2a3f063b91914
refs/heads/master
2023-03-23T07:16:13.960200
2021-03-14T17:35:22
2021-03-14T17:35:22
347,706,485
0
0
null
null
null
null
UTF-8
C
false
false
303
c
arrat sum+avg.c
#include<stdio.h> int main() { float arr[10],avg,sum=0; int i; for(i=0; i<10; i++) { scanf("%f",&arr[i]); sum=sum+arr[i]; } { printf("Simulation= %.2f\n",sum); } avg=sum/10; { printf("Average = %.2f",avg); } return 0; }
ec187fd16ed8c7858e65c6ab428485ea9a29fb7e
cbea49eecad8f9e13d7c6170b496ca5db4147cb2
/Introduction-to-Programming/ZSR6/Z3/main.c
ec830f880f95d7d8f20ac510ed59d6f9da259abb
[]
no_license
amsiljak/c9-Projects
ea53221a9d83f955d8225797950783db8ae7be8f
60a8242cd6dbf8edefc47bde3b0daa0f15993cdc
refs/heads/main
2023-04-21T03:05:41.851590
2021-05-02T23:02:57
2021-05-02T23:02:57
363,766,433
2
0
null
null
null
null
UTF-8
C
false
false
186
c
main.c
#include <stdio.h> int main() { int niz[2]; int i=0; FILE* ulaz=fopen("Ime","r"); while(i<2 && fscanf(ulaz, "%d", &niz[i] )==1) i++; printf("%d el",i); fclose(ulaz); return 0; }
7d1e33e58ea4acef50a59f9809c8b76549602161
750ed0e697a2c6e418d5d8cfddab6f184b00b154
/3.ybx/20.ds/11.DSAAC/binheap.h
dfedd34c76e6c7e4cedb20cb749fcebf0ffd781e
[]
no_license
wcybxzj/shang
35b08b42d2534f414d15a7ba732c61dc99d8ac4b
559e4173683c9949d5e82f915afd39b9d191f83b
refs/heads/master
2021-06-05T15:57:08.178390
2021-04-20T05:08:52
2021-04-20T05:08:52
41,600,858
3
0
null
null
null
null
UTF-8
C
false
false
528
h
binheap.h
#ifndef _BINHEAP_H_ #define _BINHEAP_H_ typedef int ElementType; struct HeapStruct;//ๅœจtestheap.cไธญๅฎšไน‰ struct HeapStruct { int capacity;//ๅฎน้‡ int size;//ๅฝ“ๅ‰ไธชๆ•ฐ ElementType * arr; }; typedef struct HeapStruct *PriorityQueue; PriorityQueue Init(int max); void Destroy(PriorityQueue H); void MakeEmpty(PriorityQueue H); void Insert(ElementType val, PriorityQueue H); ElementType DeleteMin(PriorityQueue H); ElementType FindMin(PriorityQueue H); int IsEmpty(PriorityQueue H); int IsFull(PriorityQueue H); #endif
706a9e9ea1b292b7ecd52ed1478869e04a5642a4
144fdeec6dec6ed22e702f8902f94d77ba0d6059
/tests/com.oracle.truffle.llvm.tests.sulong/c/truffle-c/allDatatypeLiterals/longTest.c
8c4867433c2b292e2e658e22ee1aad03be022acd
[ "BSD-3-Clause", "NCSA", "MIT" ]
permissive
pointhi/sulong
cb9dc61f54a113e988911f1e3654d6e5792c2859
5446c54d360f486f9e97590af5f466cf1f5cd1f7
refs/heads/master
2021-01-16T22:17:36.966183
2018-07-03T16:12:12
2018-07-03T16:12:12
67,107,046
1
1
null
2016-09-01T07:06:28
2016-09-01T07:06:28
null
UTF-8
C
false
false
47
c
longTest.c
int main() { long a = 4L; return (int)a; }
40b63e526921c9e54140b4c79487580876947e2e
d6afaba8a7c3cdfcae78fb2eabc8589b4512d241
/operator/connector.c
605edf5c743bbe8903f65f93acedbfdc1370197f
[]
no_license
lkiversonlk/netsimulator
85df16bcd7a11d486912ec8a4596a2794dca057d
ae35ea7d11616839ba7b11bab914b2cc77a03726
refs/heads/master
2021-01-22T23:15:59.717083
2013-04-28T06:35:41
2013-04-28T06:35:41
null
0
0
null
null
null
null
UTF-8
C
false
false
266
c
connector.c
#include "operator/connector.h" inline void connector_connect(Net *net, Connector *conn){ //clear the net's situation net_reset(net_default_cap(net), net); conn->connect(net, conn); } inline void connector_destroy(Connector *conn){ conn->destroy(conn); }
7ee89c81bec861ff5a8d74f5ecc60c8f5e98c860
98dd5a3f2a5cd1949e9284d204a0a353e256aad6
/test/main.c
f04625dd7b1834fc1e6c12d5dfaccef173146bba
[ "MIT" ]
permissive
topfreegames/libpitaya
ba4e2b141879f1b527a1a6137db88c05516d8e11
86b2f882c058e5bba0fbe6c37fe44842531d3eca
refs/heads/master
2023-06-25T15:31:11.352779
2023-05-05T17:46:09
2023-05-05T17:46:09
128,069,735
64
39
MIT
2023-06-09T15:06:47
2018-04-04T13:56:25
C
UTF-8
C
false
false
3,045
c
main.c
#include <stdio.h> #include <pitaya.h> #include "test_common.h" // HACK(leo): DO NOT EDIT THE LINES BETWEEN SUITES_START AND SUITES_END // In order to update the number of suites automatically when a new suite is added, // we compute the number of suites based on the number of lines between SUITES_START // and SUITES_END. Therefore, adding a blank line between the two delimiters will incorrectly // count the number of suites. So do not edit it! static const int SUITES_START = __LINE__; extern const MunitSuite pc_client_suite; extern const MunitSuite tcp_suite; extern const MunitSuite tls_suite; extern const MunitSuite session_suite; extern const MunitSuite reconnection_suite; extern const MunitSuite compression_suite; extern const MunitSuite kick_suite; extern const MunitSuite request_suite; extern const MunitSuite notify_suite; extern const MunitSuite stress_suite; extern const MunitSuite protobuf_suite; extern const MunitSuite push_suite; static const int SUITES_END = __LINE__; const MunitSuite null_suite = { NULL, NULL, NULL, 0, MUNIT_SUITE_OPTION_NONE }; static void quiet_log(int level, const char *msg, ...) { Unused(level); Unused(msg); // Use an empty log to avoid messing up the output of the tests. // TODO: maybe print only logs of a certain level? } static MunitSuite * make_suites() { const int NUM_SUITES = SUITES_END - SUITES_START - 1; MunitSuite *suites_array = (MunitSuite*)calloc(NUM_SUITES+1, sizeof(MunitSuite)); size_t i = 0; suites_array[i++] = pc_client_suite; suites_array[i++] = tcp_suite; suites_array[i++] = tls_suite; suites_array[i++] = session_suite; suites_array[i++] = reconnection_suite; suites_array[i++] = compression_suite; suites_array[i++] = kick_suite; suites_array[i++] = request_suite; suites_array[i++] = notify_suite; suites_array[i++] = stress_suite; suites_array[i++] = protobuf_suite; suites_array[i++] = push_suite; // IMPORTANT: always has to end with a null suite suites_array[i++] = null_suite; return suites_array; } int main(int argc, char **argv) { MunitSuite *suites_array = make_suites(); MunitSuite main_suite; main_suite.prefix = ""; main_suite.tests = NULL; main_suite.suites = suites_array; main_suite.iterations = 1; main_suite.options = MUNIT_SUITE_OPTION_NONE; pc_lib_client_info_t client_info; client_info.platform = "mac"; client_info.build_number = "20"; client_info.version = "2.1"; // Run this function only one time, otherwise things break. #if 0 pc_lib_init(quiet_log, NULL, NULL, NULL, client_info); #else pc_lib_init(NULL, NULL, NULL, NULL, client_info); #endif // By default, skip all checks of key pinning on tests. // If the tests wants to check the key pinning functionality, // it will explicitly set the check to false. pc_lib_skip_key_pin_check(true); int ret = munit_suite_main(&main_suite, NULL, argc, argv); pc_lib_cleanup(); free(suites_array); return ret; }
4d3630af30f244f64bec1cb580c003af5b87033c
f8429058e3d73c62096ec1fbc219cd42ad5f9270
/inicializacao.h
975bca9bce8fe1d8874c0b88492640f9d91fba48
[]
no_license
vanessavieira/SokobanBrBa
e7aba62ced8394a15bdb2c6a8898d2bfcb3bb116
741177cf24a6055f969aec699b6367534295f257
refs/heads/master
2020-04-17T08:24:36.612763
2015-11-16T13:33:11
2015-11-16T13:33:11
37,697,858
0
0
null
null
null
null
UTF-8
C
false
false
1,657
h
inicializacao.h
volatile int exit_program = FALSE; void keyboard_input() { int x; for(x = 0; x < KEY_MAX; x++) teclas_anteriores[x] = key[x]; poll_keyboard(); } int apertou(int TECLA) { return(teclas_anteriores[TECLA] == 0 && key[TECLA] != 0); } int segurou(int TECLA) { return(teclas_anteriores[TECLA] != 0 && key[TECLA] != 0); } int soltou(int TECLA) { return(teclas_anteriores[TECLA] != 0 && key[TECLA] == 0); } void fecha_programa() { exit_program = TRUE; } END_OF_FUNCTION(fecha_programa); void close_program() { exit_program = TRUE; } END_OF_FUNCTION(close_program); void inicializacao() { allegro_init(); install_timer(); install_keyboard(); set_color_depth(32); set_gfx_mode(GFX_AUTODETECT_WINDOWED, 600, 450, 0, 0); set_window_title("Breaking Sokoban"); LOCK_VARIABLE(exit_program); LOCK_FUNCTION(close_program); set_close_button_callback(close_program); INICIO(); } END_OF_FUNCTION(inicializacao); INICIO() { ///BITMAPS BITMAP* buffer = create_bitmap(SCREEN_W, SCREEN_H); BITMAP* tela_inicio = load_bitmap("sprites/InicioMenu/INICIAL.bmp", NULL); ///GAME LOOP while(!exit_program) { //INPUT keyboard_input(); if(key[KEY_ESC]) { fecha_programa(); } if(key[KEY_SPACE]) { menu(); } //DRAW draw_sprite(buffer, tela_inicio, 0, 0); draw_sprite(screen, buffer, 0, 0); clear_to_color(buffer, makecol(255,255,255)); } ///FINALIZACAO destroy_bitmap(tela_inicio); destroy_bitmap(buffer); } END_OF_FUNCTION(INICIO);
8b204ac67036899e1b726948d7e2ad0143bbe1ba
c395b3f43bd6e03ad09e8d2cb3d865517012ad98
/ip.h
dd80b327db57e4a9d6dfd5a59110d57fe38e9550
[]
no_license
birdatdotty/dhcp
0b27824200bbc07b2e231fffd563c964ef827781
634186bd06665ca09c749a73c021dae54d4f7484
refs/heads/master
2016-08-11T20:47:06.118051
2016-04-07T05:32:26
2016-04-07T05:32:26
54,829,859
0
0
null
null
null
null
UTF-8
C
false
false
699
h
ip.h
#ifndef IP_H #define IP_H #include "server.h" struct host_ip { unsigned int oct0:8; unsigned int oct1:8; unsigned int oct2:8; unsigned int oct3:8; }; struct host_ip* host_ip_create (char *str); char* get_ip (struct host_ip* ip); char* get_arpa_ip (struct host_ip* ip); int host_ip_destroy (struct host_ip* ip); char* host_ip_dhcp_add_ip (struct host_ip* ip, struct server_setting* server, char* host); char* host_ip_dhcp_add_arpa (struct host_ip* ip, struct server_setting* srv, char* host); char* host_ip_dhcp_delete_ip (struct host_ip* ip, struct server_setting* server, char* host); char* host_ip_dhcp_delete_arpa (struct host_ip* ip, struct server_setting* srv, char* host); #endif
6e216c25f033ef9b36ec3641a1eba8cd6035f1e0
f01be269423465bbb764ae27ea15e958146f2cea
/kernel/kernel.c
f657350bdaac2d456c4396107e2993d94f35f0af
[]
no_license
MyEyes/Nos-ARM
93a06712472f0ec97a0abe8b75654f6417b5fbf4
edf4004764c16975a4625c74f57329d433e9f9bb
refs/heads/master
2020-04-15T12:42:40.236653
2017-08-03T12:15:40
2017-08-03T12:15:40
65,037,269
4
0
null
null
null
null
UTF-8
C
false
false
4,479
c
kernel.c
#if !defined(__cplusplus) #include <stdbool.h> #endif #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include __PLATFORM__ #include "kernel/init.h" #include "kernel/mem/mem.h" #include "kernel/mem/paging.h" #include "kernel/hw/reset.h" #include "kernel/hw/devmap.h" #include "kernel/proc/elf.h" #include "kernel/proc/sysmap.h" #include "kernel/mod/kernel_uart.h" #include "kernel/cpu/cpu.h" #include "kernel/cpu/clock.h" #include "kernel/mem/mmu.h" #include "kernel/proc/proc.h" #include "kernel/proc/thread.h" #include "kernel/proc/schd.h" #include "kernel/res/res_mgr.h" #if defined(__cplusplus) extern "C" /* Use C linkage for kernel_main. */ #endif extern unsigned char uart_getc(); extern void uart_putc(unsigned char c); extern void uart_mod_init(void*, uint32_t); extern unsigned int __start; extern unsigned int __end; extern FILE stdout; void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) { (void) r0; __asm__("add sp, sp, %0\n"::"r"(0xc0000000):); uart_mod_init(0, 0); printf("Starting init\r\n"); kernel_init(); printf("Hello, kernel World!\r\n\r\n"); if(r1==PLATFORM_CPU_MACHINE_TYPE) printf("Found correct CPU type\r\n"); else { printf("Unexpected CPU type detected\r\n"); printf("Expected:"); printf("%x", PLATFORM_CPU_MACHINE_TYPE); printf("\r\nDetected:"); printf("%x", r1); printf("\r\n\r\n"); } printf("ATAGS: %x \r\n\r\n", atags); //printf("Look mommy, I'm running on real hardware!\r\n"); //mem_dsb(); //mem_dmb(); //Change to user mode printf("Domain Flags: %x\r\n", domain_get_flags()); mem_dsb(); mem_dmb(); printf("Processor state: %x\r\n", cpu_get_state()); printf("Control registers: %x\r\n", cpu_get_ctrl_regs()); printf("UART0 mapped to: %x(%x)\r\n", pg_get_phys(&kernel_page, (void*)0x20201000), pg_get_entry(&kernel_page, (void*)0x20201000)); printf("printf at %x\r\n", printf); //pg_fld_sld_dbg(&kernel_page, (void*)printf); domain_user_set(); printf("Processor state: %x\r\n", cpu_get_state()); printf("Control registers: %x\r\n", cpu_get_ctrl_regs()); void* kern_end = &__end; #ifdef __DEV_MAP set_devmap((devmap_t*)kern_end); parse_devmap(); printf("Devmap at %x\r\n", devmap); for(uint32_t x=0; x<devmap->num_devs; x++) printf("\t%x %s\t%s\r\n", devmap->devs[x].addr, devmap->devs[x].type, devmap->devs[x].name); kern_end += devmap->total_size; res_tbl_dbg(); #endif printf("Memory page: %x\r\n", pg_get_entry(&kernel_page, (void*)0xc0000000)); pg_tbl_t* test_tbl = proc_create((char*)0x100000, (char*)0x200000, 0x8000); printf("tbl_entry: %x\r\n", pg_get_entry(test_tbl, (void*)0x000FFFC4)); char* phys = pg_get_phys(test_tbl, (char*)0x100000); printf("Test proc table set up at %x\r\n", test_tbl); printf("Test proc phys entry at %x\r\n", phys); printf("Copying image from %x to %x\r\n", kern_end, phys); printf("__end:%x\r\n", (uint32_t)kern_end); v_addr_t tgt_addr = (v_addr_t)TO_KERNEL_ADDR_SPACE(phys); memcpy((char*)tgt_addr, (char*)kern_end, 0x100000); proc_hdr_t* test_proc = malloc(sizeof(proc_hdr_t)); proc_init(test_proc, test_tbl, 0x100000, 0x200000, 0); thread_t* test_thread = malloc(sizeof(thread_t)); thread_init(test_thread, test_proc, (char*)0x100000, (char*)0x100000-0x8000, (char*)0x100000, 1, 0); thread_ready(test_thread); schd_add_thread(test_thread); p_addr_t test_addr = pg_get_phys(&kernel_page, tgt_addr); printf("Mapping of user_init image: %x\r\n", test_addr); printf("First byte of image to run: %x\r\n", *((char*)TO_KERNEL_ADDR_SPACE(test_addr))); printf("Running\r\n"); clock_enable(); __asm__("swi 16"); //switch process syscall printf("Returned to kernel\r\n"); printf("Rebooting\r\n"); reset(); } void kernel_panic(uint32_t sp, uint32_t pc) { mem_dsb(); mem_dmb(); mmu_set_user_pgtbl(kernel_page.addr); uart_mod_init(0,0); printf("An interrupt happened and I don't know what to do.\r\nAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHH\r\n"); printf("sp: %x\tpc: %x\r\n", sp, pc); printf("Processor state: %x\r\n", cpu_get_state()); printf("Saved processor state: %x\r\n", cpu_get_saved_state()); for(uint32_t x=10; x>0; x--) { printf("Restart in: %x\r", x); delay(0x1000000); } reset(); }
924e8ef2cb0981cbe5a034917bda4f3f5573b74e
558018e099bf2fe74d938ea0e889efbcd14c0b67
/src/pbr/utils/diagnostic.h
e56c0d636a1161f834cd12874b62d0c35dc897ce
[ "MIT" ]
permissive
moddyz/PBR
1b4676da088a7e287fa1f0c241ebcbd8a5e610b4
fa92b09a98d07503e1dc381fcb0e9d9b6ae88915
refs/heads/master
2021-01-27T19:07:42.068046
2020-08-17T08:53:04
2020-08-17T08:53:04
243,485,708
0
0
MIT
2020-07-26T11:49:03
2020-02-27T09:53:46
C++
UTF-8
C
false
false
4,555
h
diagnostic.h
#pragma once #include <pbr/pbr.h> #include <pbr/utils/log.h> #include <pbr/utils/stacktrace.h> #include <stdarg.h> /// \file utils/diagnostic.h /// /// Diagnostic utilities. /// \def PBR_ASSERT( expr ) /// /// Asserts that the expression \p expr is \em true in debug builds. If \p expr evalutes \em false, /// an error message will be printed with contextual information including the failure site. /// /// In release builds, this is compiled out. #ifdef PBR_DEBUG #define PBR_ASSERT( expr ) \ if ( !( expr ) ) \ { \ PBR_NS::_Assert( #expr, __FILE__, __LINE__ ); \ pbr::PrintStacktrace(); \ } #else #define PBR_ASSERT( expr, ... ) void() #endif /// \def PBR_ASSERT_MSG( expr, format, ... ) /// /// Similar to \ref PBR_ASSERT, with the addition of a formatted message when the expression \p expr fails to evaluate /// in debug builds. #ifdef PBR_DEBUG #define PBR_ASSERT_MSG( expr, format, ... ) \ if ( !( expr ) ) \ { \ PBR_NS::_Assert( #expr, __FILE__, __LINE__ ); \ PBR_LOG_ERROR( format, ##__VA_ARGS__ ); \ pbr::PrintStacktrace(); \ } #else #define PBR_ASSERT_MSG( expr, format, ... ) void() #endif /// \def PBR_VERIFY( expr ) /// /// Verifies that the expression \p expr evaluates to \em true at runtime. If \p expr evalutes \em false, /// an error message will be printed with contextual information including the failure site. /// /// PBR_VERIFY is different from \ref PBR_ASSERT in that it does \em not get compiled out for release builds, /// so use sparingly! #define PBR_VERIFY( expr ) \ if ( !( expr ) ) \ { \ PBR_NS::_Assert( #expr, __FILE__, __LINE__ ); \ pbr::PrintStacktrace(); \ } /// \def PBR_VERIFY_MSG( expr, format, ... ) /// /// Similar to \ref PBR_VERIFY, with the addition of a formatted message when the expression \p expr fails to evaluate. #define PBR_VERIFY_MSG( expr, format, ... ) \ if ( !( expr ) ) \ { \ PBR_NS::_Verify( #expr, __FILE__, __LINE__ ); \ PBR_LOG_ERROR( format, ##__VA_ARGS__ ); \ pbr::PrintStacktrace(); \ } PBR_NS_OPEN /// Not intended to be used directly, \ref PBR_ASSERT instead. inline void _Assert( const char* i_expression, const char* i_file, size_t i_line ) { PBR_LOG_ERROR( "Assertion failed for expression: %s, at %s:%lu\n", i_expression, i_file, i_line ); } /// Not intended to be used directly, \ref PBR_VERIFY instead. inline void _Verify( const char* i_expression, const char* i_file, size_t i_line ) { PBR_LOG_ERROR( "Verification failed for expression: %s, at %s:%lu\n", i_expression, i_file, i_line ); } PBR_NS_CLOSE
186708a1e7a61a03429c7afae140c65437a19899
824bed58a8dccf77d5f0db715f4767fa6894ac9a
/2.socket_project/ไธ€ไธชๅฐๆธธๆˆ/UDP_FootBall_Game/common/show_strength.c
9328d9aa9de4e059a072cfb97146591731608203
[]
no_license
hello-sources/Linux_OS
da93f8790a97ad21656c1dd19eeca80e09b73bf2
4ba5c9d7329393ffdaf88645076311b9991a60f7
refs/heads/master
2021-12-28T20:07:46.704105
2021-12-15T12:15:00
2021-12-15T12:15:00
247,025,132
4
0
null
null
null
null
UTF-8
C
false
false
2,331
c
show_strength.c
/************************************************************ File Name : show_strength.c Author: Ginakira Mail: ginakira@outlook.com Github: https://github.com/Ginakira Created Time: 2020/06/30 19:54:35 ************************************************************/ #include "head.h" extern WINDOW *Write; extern int sockfd; void show_strength() { int mousex = 2, offset = 1; int maxx, maxy; getmaxyx(Write, maxy, maxx); for (int i = 2; i < maxx - 2; ++i) { if (i < maxx / 5 || i > maxx - maxx / 5) { wattron(Write, COLOR_PAIR(7)); } else if ((i < (maxx / 5) * 2) || i > (maxx / 5) * 3) { wattron(Write, COLOR_PAIR(9)); } else { wattron(Write, COLOR_PAIR(8)); } mvwprintw(Write, 2, i, " "); } wattron(Write, COLOR_PAIR(3)); make_nonblock(STDIN_FILENO); while (1) { int c = getchar(); if (c != -1) { if (c == ' ' || c == 'k') { break; } } usleep(30000); if (mousex >= maxx - 2) { offset = -1; } else if (mousex <= 2) { offset = 1; } mvwprintw(Write, 1, mousex, " "); mvwprintw(Write, 3, mousex, " "); mousex += offset; mvwprintw(Write, 1, mousex, "|"); mvwprintw(Write, 3, mousex, "|"); mvwprintw(Write, 4, maxx, " "); wrefresh(Write); } int arr[5] = {1, 2, 3, 2, 1}; struct FootBallMsg msg; bzero(&msg, sizeof(msg)); msg.type = FT_CTL; msg.ctrl.action = ACTION_KICK; msg.ctrl.strength = arr[mousex / (maxx / 5)]; send(sockfd, &msg, sizeof(msg), 0); make_block(STDIN_FILENO); return; } void stop_ball() { struct FootBallMsg msg; bzero(&msg, sizeof(msg)); msg.type = FT_CTL; msg.ctrl.action = ACTION_STOP; send(sockfd, &msg, sizeof(msg), 0); return; } void kick_ball() { struct FootBallMsg msg; bzero(&msg, sizeof(msg)); msg.type = FT_CTL; msg.ctrl.action = ACTION_KICK; msg.ctrl.strength = 1; send(sockfd, &msg, sizeof(msg), 0); return; } void carry_ball() { struct FootBallMsg msg; bzero(&msg, sizeof(msg)); msg.type = FT_CTL; msg.ctrl.action = ACTION_CARRY; send(sockfd, &msg, sizeof(msg), 0); return; }
68740367f6f47032a701e4a64f39cbb8b905b147
88e2e389e1fbfd981249025447fc0887037b081e
/CPE-practice/22801-doomsday.c
e924e531369e7101b313082c6f833c9fc4d616bc
[]
no_license
TMYuan/Cpp-practices
6ece9935769b432e1bb14615b5c7a9ac5ffbb8bd
e417ed78f031570623c7d253d247ddcd3b39a5d2
refs/heads/master
2021-06-30T08:52:04.342361
2017-09-19T17:25:55
2017-09-19T17:25:55
103,153,932
0
0
null
null
null
null
UTF-8
C
false
false
1,600
c
22801-doomsday.c
#include <stdlib.h> #include <stdio.h> int main(){ int num; scanf("%d", &num); while(num--){ int month, day, start_day, count=0; scanf("%d %d", &month, &day); if(month == 3){ day += 28; month = 2; } switch(month){ case 5: start_day = 9; break; case 9: start_day = 5; break; case 7: start_day = 11; break; case 11: start_day = 7; break; case 1: start_day = 10; break; case 2: start_day = 21; break; default: start_day = month; break; } while(day < start_day){ day += 7; } while(start_day < day){ ++count; ++start_day; } switch(count % 7){ case 0: printf("Monday\n"); break; case 1: printf("Tuesday\n"); break; case 2: printf("Wednesday\n"); break; case 3: printf("Thursday\n"); break; case 4: printf("Friday\n"); break; case 5: printf("Saturday\n"); break; case 6: printf("Sunday\n"); break; } } return 0; }
4baf3860520829e8cba03a9c4212fdd6dc80ae7f
976f5e0b583c3f3a87a142187b9a2b2a5ae9cf6f
/source/linux/drivers/iio/humidity/extr_hdc100x.c_hdc100x_set_it_time.c
6868534d0f9244d519b7870a4022799e43060167
[]
no_license
isabella232/AnghaBench
7ba90823cf8c0dd25a803d1688500eec91d1cf4e
9a5f60cdc907a0475090eef45e5be43392c25132
refs/heads/master
2023-04-20T09:05:33.024569
2021-05-07T18:36:26
2021-05-07T18:36:26
null
0
0
null
null
null
null
UTF-8
C
false
false
1,158
c
extr_hdc100x.c_hdc100x_set_it_time.c
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward declarations */ typedef struct TYPE_2__ TYPE_1__ ; /* Type definitions */ struct hdc100x_data {int* adc_int_us; } ; struct TYPE_2__ {int shift; int mask; } ; /* Variables and functions */ int ARRAY_SIZE (int*) ; int EINVAL ; int** hdc100x_int_time ; TYPE_1__* hdc100x_resolution_shift ; int hdc100x_update_config (struct hdc100x_data*,int,int) ; __attribute__((used)) static int hdc100x_set_it_time(struct hdc100x_data *data, int chan, int val2) { int shift = hdc100x_resolution_shift[chan].shift; int ret = -EINVAL; int i; for (i = 0; i < ARRAY_SIZE(hdc100x_int_time[chan]); i++) { if (val2 && val2 == hdc100x_int_time[chan][i]) { ret = hdc100x_update_config(data, hdc100x_resolution_shift[chan].mask << shift, i << shift); if (!ret) data->adc_int_us[chan] = val2; break; } } return ret; }
7ce5c6ea75084e5bec22da87f129b4a1f14e4dae
39d8ece183f84c6dc0c3ee45df8c3c8fa356163f
/liancancai/20160905/2016-12-09/test/test1.c
18c50f4dcc8bd35feec658f7d020f43d44bb647f
[]
no_license
cyysu/Study
2f785943334e51f8b70e1fb057a880a408347374
489bbf11d03940007d37e3e77eeb0bf5da2f5cb9
refs/heads/master
2021-01-12T05:37:49.346902
2016-12-11T09:19:50
2016-12-11T09:19:50
77,150,994
4
0
null
2016-12-22T14:29:47
2016-12-22T14:29:46
null
UTF-8
C
false
false
767
c
test1.c
#include <stdio.h> #include "va_arg.h" void function(int a , ...); //getchar //putchar int main(void) { 0; 4832904; 32; function(10,20,'C',"hello",60,70); return 0 ; } void function(int a , ...) { va_list ap ; va_start(ap , a); int number ; number = va_arg(ap , int); printf("number:%d \n" , number); char ch ; ch = va_arg(ap , char); printf("ch:%c \n" , ch); char *str = NULL; str = va_arg(ap , char *); printf("str:%s \n" , str); va_end(ap); #if 0 int *p = &a ; printf("%d \n" , *(p+1)); printf("%c \n" , *(p+2)); printf("%lf \n" , *((double*)(p+3))); // int i = 0 ; // for( i = 0 ; i < 6 ; i++) // { // printf("%d \n" ,*(p+i+2)); // } // printf("%s \n" , (char *)*(p+4)); // printf("%d \n" , *(p+5)); #endif }
345aa486f6af03cdfab674fb3c84e912635ac201
091864a78f5e0efe326c824b897d870a9f0d3560
/factors.c
f16717fd4cd69469df0718d4f6b9c7d64fde44b9
[ "MIT" ]
permissive
AshokKumarAK/Basic-programs-using-C
084cd2550321edcaaf63a25c21b0688539e526be
d48ad4a22d732f56a2d93c040e5f694becff2759
refs/heads/master
2020-03-20T18:33:18.245733
2018-06-16T16:31:09
2018-06-16T16:31:09
137,593,408
1
0
null
null
null
null
UTF-8
C
false
false
176
c
factors.c
#include<stdio.h> void main(){ int num=124,end,ctr; end=num/2; for(ctr=2;ctr<=end;ctr++){ if (num%ctr==0){ printf("%d ",ctr); } } }
57154331f66ef1921c4dfe17370ee4978bb97a09
a91796ab826878e54d91c32249f45bb919e0c149
/3rdparty/libtiff/tif_fax3sm.c
ba2fc532e8014ba7842da95821e6ad95ead1f87d
[ "libtiff", "IJG", "Zlib", "BSD-3-Clause", "Libpng", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
opencv/opencv
8f1c8b5a16980f78de7c6e73a4340d302d1211cc
a308dfca9856574d37abe7628b965e29861fb105
refs/heads/4.x
2023-09-01T12:37:49.132527
2023-08-30T06:53:59
2023-08-30T06:53:59
5,108,051
68,495
62,910
Apache-2.0
2023-09-14T17:37:48
2012-07-19T09:40:17
C++
UTF-8
C
false
false
104,760
c
tif_fax3sm.c
/* WARNING, this file was automatically generated by the mkg3states program */ #include <stdint.h> #include "tiff.h" #include "tif_fax3.h" const TIFFFaxTabEnt TIFFFaxMainTable[128] = { {12,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{5,6,2},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{5,7,3},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,6,2},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{6,7,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {5,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0}, {5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0},{4,7,3},{3,1,0},{5,3,1},{3,1,0}, {2,3,0},{3,1,0},{4,3,1},{3,1,0},{1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0}, {4,3,1},{3,1,0},{4,6,2},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0}, {1,4,0},{3,1,0},{5,3,1},{3,1,0},{2,3,0},{3,1,0},{4,3,1},{3,1,0} }; const TIFFFaxTabEnt TIFFFaxWhiteTable[4096] = { {12,11,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5}, {7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17}, {9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2112},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5}, {7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2368},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17}, {9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,12,1984},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5}, {7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17}, {9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2240},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2496},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{12,11,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5}, {7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1792},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17}, {9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,11,1856},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2176},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1600},{7,4,5}, {7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6}, {7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3}, {7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15}, {7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5},{7,8,43},{7,6,17}, {9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128}, {7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5}, {7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,768},{7,4,6}, {7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2432},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6},{7,7,19},{7,5,8}, {7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5}, {7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17},{9,9,1408},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14}, {7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16}, {9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128}, {7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9}, {9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4}, {7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,960},{7,4,6}, {7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15}, {9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {11,12,2048},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6}, {7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7}, {7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6},{7,8,32},{7,5,8}, {7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16}, {9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128}, {7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1536},{7,4,5}, {7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3}, {7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,11,1920},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4}, {7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,896},{7,4,6}, {7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3}, {7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15}, {7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5},{7,8,44},{7,6,17}, {9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128}, {7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5}, {7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6}, {7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7}, {7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8}, {7,8,55},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5}, {7,8,53},{7,5,9},{9,8,448},{7,4,6},{7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1472},{7,4,5},{7,8,43},{7,6,17},{9,9,1216},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14}, {7,8,61},{7,4,4},{7,4,2},{7,4,7},{7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16}, {9,9,960},{7,4,6},{7,8,31},{7,5,8},{7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,9,704},{7,4,6},{7,8,37},{9,5,128}, {7,7,25},{7,6,15},{9,8,320},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5}, {7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{11,12,2304},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,7,20},{9,5,128},{7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3}, {7,7,27},{7,4,5},{7,8,40},{7,6,16},{9,9,832},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9}, {9,8,512},{7,4,6},{7,8,36},{9,5,128},{7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{9,9,1600},{7,4,5},{7,8,44},{7,6,17},{9,9,1344},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5}, {7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4}, {7,4,2},{7,4,7},{7,8,48},{7,4,3},{7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1088},{7,4,6}, {7,8,32},{7,5,8},{7,8,58},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3}, {7,5,11},{7,4,5},{7,7,26},{7,5,9},{9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15}, {9,8,384},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17}, {9,7,256},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {0,0,0},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128}, {7,7,24},{7,6,14},{7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5}, {7,8,39},{7,6,16},{9,8,576},{7,4,6},{7,7,19},{7,5,8},{7,8,55},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,45},{7,4,3},{7,5,11},{7,4,5},{7,8,53},{7,5,9},{9,8,448},{7,4,6}, {7,8,35},{9,5,128},{7,8,51},{7,6,15},{7,8,63},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3}, {9,9,1536},{7,4,5},{7,8,43},{7,6,17},{9,9,1280},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,8,29},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9}, {9,6,1664},{7,4,6},{7,8,33},{9,5,128},{7,8,49},{7,6,14},{7,8,61},{7,4,4},{7,4,2},{7,4,7}, {7,8,47},{7,4,3},{7,8,59},{7,4,5},{7,8,41},{7,6,16},{9,9,1024},{7,4,6},{7,8,31},{7,5,8}, {7,8,57},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5}, {7,7,26},{7,5,9},{9,9,768},{7,4,6},{7,8,37},{9,5,128},{7,7,25},{7,6,15},{9,8,320},{7,4,4}, {7,4,2},{7,4,7},{7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6}, {7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7},{11,12,2560},{7,4,3}, {7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6},{7,7,20},{9,5,128},{7,7,24},{7,6,14}, {7,7,28},{7,4,4},{7,4,2},{7,4,7},{7,7,23},{7,4,3},{7,7,27},{7,4,5},{7,8,40},{7,6,16}, {9,9,896},{7,4,6},{7,7,19},{7,5,8},{7,8,56},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7}, {7,8,46},{7,4,3},{7,5,11},{7,4,5},{7,8,54},{7,5,9},{9,8,512},{7,4,6},{7,8,36},{9,5,128}, {7,8,52},{7,6,15},{7,8,0},{7,4,4},{7,4,2},{7,4,7},{7,6,13},{7,4,3},{9,9,1728},{7,4,5}, {7,8,44},{7,6,17},{9,9,1408},{7,4,6},{7,6,1},{7,5,8},{9,6,192},{9,5,64},{7,5,10},{7,4,4}, {7,4,2},{7,4,7},{7,8,30},{7,4,3},{7,5,11},{7,4,5},{7,6,12},{7,5,9},{9,6,1664},{7,4,6}, {7,8,34},{9,5,128},{7,8,50},{7,6,14},{7,8,62},{7,4,4},{7,4,2},{7,4,7},{7,8,48},{7,4,3}, {7,8,60},{7,4,5},{7,8,42},{7,6,16},{9,9,1152},{7,4,6},{7,8,32},{7,5,8},{7,8,58},{9,5,64}, {7,5,10},{7,4,4},{7,4,2},{7,4,7},{7,7,22},{7,4,3},{7,5,11},{7,4,5},{7,7,26},{7,5,9}, {9,8,640},{7,4,6},{7,8,38},{9,5,128},{7,7,25},{7,6,15},{9,8,384},{7,4,4},{7,4,2},{7,4,7}, {7,6,13},{7,4,3},{7,7,18},{7,4,5},{7,7,21},{7,6,17},{9,7,256},{7,4,6},{7,6,1},{7,5,8}, {9,6,192},{9,5,64},{7,5,10},{7,4,4},{7,4,2},{7,4,7} }; const TIFFFaxTabEnt TIFFFaxBlackTable[8192] = { {12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,56},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,30},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2112},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,44},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,60},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,1984},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,34},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1664},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1408},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,61},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,1024},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,768},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,62},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,38},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,512},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2496},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,25},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,12,192},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1280},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,31},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,21},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,896},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,640},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,45},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,12,448},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1536},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,41},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2048},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,51},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,59},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1152},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,63},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,2304},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,39},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,128},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,56},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,30},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,11,1856},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,57},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,54},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,52},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,48},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2112},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,44},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,36},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,384},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,28},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,60},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,40},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,12,2368},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,1984},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,50},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,34},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,1728},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,26},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,1472},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,32},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,61},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,42},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1088},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,832},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,62},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2240},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,46},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,38},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,576},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2496},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{12,11,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,18},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1792},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,23},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,20},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,25},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,192},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1344},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,31},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,11,1856},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,58},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,21},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{10,13,960},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,13,704},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,49},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2176},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,45},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,37},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,448},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,29},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1600},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,41},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {11,12,2432},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,18},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,17},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2048},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,51},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,35},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {10,12,320},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,27},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,59},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,33},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{11,11,1920},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,12,256},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,43},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,13,1216},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {0,0,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,8,13},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,9,15},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,55},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,63},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2304},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,12,47},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,12,39},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,12,53},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,12},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{0,0,0},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,8,13},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,11,19},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,11,24},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,11,22},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{11,12,2560},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,7,10},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,10,16},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2},{8,10,0},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2}, {8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{10,10,64},{8,2,3}, {8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,9},{8,2,3},{8,3,1},{8,2,2}, {8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,11},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3}, {8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2}, {8,8,14},{8,2,3},{8,3,1},{8,2,2},{8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,6,8},{8,2,3}, {8,3,1},{8,2,2},{8,4,5},{8,2,3},{8,3,4},{8,2,2},{8,7,12},{8,2,3},{8,3,1},{8,2,2}, {8,4,6},{8,2,3},{8,3,4},{8,2,2},{8,5,7},{8,2,3},{8,3,1},{8,2,2},{8,4,5},{8,2,3}, {8,3,4},{8,2,2} }; /* * Local Variables: * mode: c * c-basic-offset: 8 * fill-column: 78 * End: */
fcda887822a711f12b4c17bfb36d53b04dc4c2df
51218fe80b2c18823449915dc4a51f30a34ecbd7
/user_defined.c
49b1955d03282b8decb102e14676228ca6ab44b5
[]
no_license
Ruanfc/a_la_ursa
0ec158901aea830eb495b46372b0de81ab79beae
6a78e169edbb4d307f766d079c895f92e2414230
refs/heads/master
2023-05-19T20:53:06.294219
2021-06-14T00:38:15
2021-06-14T00:38:15
372,588,707
0
0
null
null
null
null
UTF-8
C
false
false
834
c
user_defined.c
#include "user_defined.h" #include <msp430g2553.h> //#include "multi.o" // =============================================================== // --- Declaraรงรฃo de funรงรตes definidas pelo assembler --- int mult(int a, int b); int ab(int x); int div(int dividendo, int divisor); // =============================================================== // --- Declaraรงรฃo de funรงรตes definidas no source file --- void flash_ww(int *Data_ptr, int word); int comparar(int x, int y); void flash_ww(int *Data_ptr, int word) { FCTL3 = 0x0a500; // LOCK = 0 FCTL1 = 0X0a540; // WRT = 1 *Data_ptr = word; // program flash word FCTL1 = 0x0A500; // WRT = 0; FCTL3 = 0x0A510; //Lock = 1 } int comparar(int x, int y) { int boolean = LOW; if ((x ^ y) < 0) {if (x < 0) boolean = HIGH;} else if (x > y) boolean = HIGH; return boolean; }
cbec6872703063bbb0d708174d26ebc363f0ad58
08bfdbd06384ce5587e2947821f3b26a824eae9f
/secp256k1-zkp-sys/depend/secp256k1/src/ecmult_gen_impl.h
901c477f2b64b3ed1937b3da14413db6053f051d
[ "CC0-1.0", "MIT" ]
permissive
rishflab/rust-secp256k1-zkp
499786cba0e8fe3ab248a5f7cd05388a1692f208
5e21a5f1e3de678a21bc6173b3d5cce031b41fe7
refs/heads/master
2023-06-06T17:59:17.834024
2021-05-04T21:41:17
2021-05-04T21:41:17
386,136,371
0
0
CC0-1.0
2021-07-21T04:31:59
2021-07-15T02:25:08
null
UTF-8
C
false
false
10,047
h
ecmult_gen_impl.h
/*********************************************************************** * Copyright (c) 2013, 2014, 2015 Pieter Wuille, Gregory Maxwell * * Distributed under the MIT software license, see the accompanying * * file COPYING or https://www.opensource.org/licenses/mit-license.php.* ***********************************************************************/ #ifndef SECP256K1_ECMULT_GEN_IMPL_H #define SECP256K1_ECMULT_GEN_IMPL_H #include "util.h" #include "scalar.h" #include "group.h" #include "ecmult_gen.h" #include "hash_impl.h" #ifdef USE_ECMULT_STATIC_PRECOMPUTATION #include "ecmult_static_context.h" #endif #ifndef USE_ECMULT_STATIC_PRECOMPUTATION static const size_t SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE = ROUND_TO_ALIGN(sizeof(*((rustsecp256k1zkp_v0_4_0_ecmult_gen_context*) NULL)->prec)); #else static const size_t SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE = 0; #endif static void rustsecp256k1zkp_v0_4_0_ecmult_gen_context_init(rustsecp256k1zkp_v0_4_0_ecmult_gen_context *ctx) { ctx->prec = NULL; } static void rustsecp256k1zkp_v0_4_0_ecmult_gen_context_build(rustsecp256k1zkp_v0_4_0_ecmult_gen_context *ctx, void **prealloc) { #ifndef USE_ECMULT_STATIC_PRECOMPUTATION rustsecp256k1zkp_v0_4_0_ge prec[ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G]; rustsecp256k1zkp_v0_4_0_gej gj; rustsecp256k1zkp_v0_4_0_gej nums_gej; int i, j; size_t const prealloc_size = SECP256K1_ECMULT_GEN_CONTEXT_PREALLOCATED_SIZE; void* const base = *prealloc; #endif if (ctx->prec != NULL) { return; } #ifndef USE_ECMULT_STATIC_PRECOMPUTATION ctx->prec = (rustsecp256k1zkp_v0_4_0_ge_storage (*)[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G])manual_alloc(prealloc, prealloc_size, base, prealloc_size); /* get the generator */ rustsecp256k1zkp_v0_4_0_gej_set_ge(&gj, &rustsecp256k1zkp_v0_4_0_ge_const_g); /* Construct a group element with no known corresponding scalar (nothing up my sleeve). */ { static const unsigned char nums_b32[33] = "The scalar for this x is unknown"; rustsecp256k1zkp_v0_4_0_fe nums_x; rustsecp256k1zkp_v0_4_0_ge nums_ge; int r; r = rustsecp256k1zkp_v0_4_0_fe_set_b32(&nums_x, nums_b32); (void)r; VERIFY_CHECK(r); r = rustsecp256k1zkp_v0_4_0_ge_set_xo_var(&nums_ge, &nums_x, 0); (void)r; VERIFY_CHECK(r); rustsecp256k1zkp_v0_4_0_gej_set_ge(&nums_gej, &nums_ge); /* Add G to make the bits in x uniformly distributed. */ rustsecp256k1zkp_v0_4_0_gej_add_ge_var(&nums_gej, &nums_gej, &rustsecp256k1zkp_v0_4_0_ge_const_g, NULL); } /* compute prec. */ { rustsecp256k1zkp_v0_4_0_gej precj[ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G]; /* Jacobian versions of prec. */ rustsecp256k1zkp_v0_4_0_gej gbase; rustsecp256k1zkp_v0_4_0_gej numsbase; gbase = gj; /* PREC_G^j * G */ numsbase = nums_gej; /* 2^j * nums. */ for (j = 0; j < ECMULT_GEN_PREC_N; j++) { /* Set precj[j*PREC_G .. j*PREC_G+(PREC_G-1)] to (numsbase, numsbase + gbase, ..., numsbase + (PREC_G-1)*gbase). */ precj[j*ECMULT_GEN_PREC_G] = numsbase; for (i = 1; i < ECMULT_GEN_PREC_G; i++) { rustsecp256k1zkp_v0_4_0_gej_add_var(&precj[j*ECMULT_GEN_PREC_G + i], &precj[j*ECMULT_GEN_PREC_G + i - 1], &gbase, NULL); } /* Multiply gbase by PREC_G. */ for (i = 0; i < ECMULT_GEN_PREC_B; i++) { rustsecp256k1zkp_v0_4_0_gej_double_var(&gbase, &gbase, NULL); } /* Multiply numbase by 2. */ rustsecp256k1zkp_v0_4_0_gej_double_var(&numsbase, &numsbase, NULL); if (j == ECMULT_GEN_PREC_N - 2) { /* In the last iteration, numsbase is (1 - 2^j) * nums instead. */ rustsecp256k1zkp_v0_4_0_gej_neg(&numsbase, &numsbase); rustsecp256k1zkp_v0_4_0_gej_add_var(&numsbase, &numsbase, &nums_gej, NULL); } } rustsecp256k1zkp_v0_4_0_ge_set_all_gej_var(prec, precj, ECMULT_GEN_PREC_N * ECMULT_GEN_PREC_G); } for (j = 0; j < ECMULT_GEN_PREC_N; j++) { for (i = 0; i < ECMULT_GEN_PREC_G; i++) { rustsecp256k1zkp_v0_4_0_ge_to_storage(&(*ctx->prec)[j][i], &prec[j*ECMULT_GEN_PREC_G + i]); } } #else (void)prealloc; ctx->prec = (rustsecp256k1zkp_v0_4_0_ge_storage (*)[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G])rustsecp256k1zkp_v0_4_0_ecmult_static_context; #endif rustsecp256k1zkp_v0_4_0_ecmult_gen_blind(ctx, NULL); } static int rustsecp256k1zkp_v0_4_0_ecmult_gen_context_is_built(const rustsecp256k1zkp_v0_4_0_ecmult_gen_context* ctx) { return ctx->prec != NULL; } static void rustsecp256k1zkp_v0_4_0_ecmult_gen_context_finalize_memcpy(rustsecp256k1zkp_v0_4_0_ecmult_gen_context *dst, const rustsecp256k1zkp_v0_4_0_ecmult_gen_context *src) { #ifndef USE_ECMULT_STATIC_PRECOMPUTATION if (src->prec != NULL) { /* We cast to void* first to suppress a -Wcast-align warning. */ dst->prec = (rustsecp256k1zkp_v0_4_0_ge_storage (*)[ECMULT_GEN_PREC_N][ECMULT_GEN_PREC_G])(void*)((unsigned char*)dst + ((unsigned char*)src->prec - (unsigned char*)src)); } #else (void)dst, (void)src; #endif } static void rustsecp256k1zkp_v0_4_0_ecmult_gen_context_clear(rustsecp256k1zkp_v0_4_0_ecmult_gen_context *ctx) { rustsecp256k1zkp_v0_4_0_scalar_clear(&ctx->blind); rustsecp256k1zkp_v0_4_0_gej_clear(&ctx->initial); ctx->prec = NULL; } static void rustsecp256k1zkp_v0_4_0_ecmult_gen(const rustsecp256k1zkp_v0_4_0_ecmult_gen_context *ctx, rustsecp256k1zkp_v0_4_0_gej *r, const rustsecp256k1zkp_v0_4_0_scalar *gn) { rustsecp256k1zkp_v0_4_0_ge add; rustsecp256k1zkp_v0_4_0_ge_storage adds; rustsecp256k1zkp_v0_4_0_scalar gnb; int bits; int i, j; memset(&adds, 0, sizeof(adds)); *r = ctx->initial; /* Blind scalar/point multiplication by computing (n-b)G + bG instead of nG. */ rustsecp256k1zkp_v0_4_0_scalar_add(&gnb, gn, &ctx->blind); add.infinity = 0; for (j = 0; j < ECMULT_GEN_PREC_N; j++) { bits = rustsecp256k1zkp_v0_4_0_scalar_get_bits(&gnb, j * ECMULT_GEN_PREC_B, ECMULT_GEN_PREC_B); for (i = 0; i < ECMULT_GEN_PREC_G; i++) { /** This uses a conditional move to avoid any secret data in array indexes. * _Any_ use of secret indexes has been demonstrated to result in timing * sidechannels, even when the cache-line access patterns are uniform. * See also: * "A word of warning", CHES 2013 Rump Session, by Daniel J. Bernstein and Peter Schwabe * (https://cryptojedi.org/peter/data/chesrump-20130822.pdf) and * "Cache Attacks and Countermeasures: the Case of AES", RSA 2006, * by Dag Arne Osvik, Adi Shamir, and Eran Tromer * (https://www.tau.ac.il/~tromer/papers/cache.pdf) */ rustsecp256k1zkp_v0_4_0_ge_storage_cmov(&adds, &(*ctx->prec)[j][i], i == bits); } rustsecp256k1zkp_v0_4_0_ge_from_storage(&add, &adds); rustsecp256k1zkp_v0_4_0_gej_add_ge(r, r, &add); } bits = 0; rustsecp256k1zkp_v0_4_0_ge_clear(&add); rustsecp256k1zkp_v0_4_0_scalar_clear(&gnb); } /* Setup blinding values for rustsecp256k1zkp_v0_4_0_ecmult_gen. */ static void rustsecp256k1zkp_v0_4_0_ecmult_gen_blind(rustsecp256k1zkp_v0_4_0_ecmult_gen_context *ctx, const unsigned char *seed32) { rustsecp256k1zkp_v0_4_0_scalar b; rustsecp256k1zkp_v0_4_0_gej gb; rustsecp256k1zkp_v0_4_0_fe s; unsigned char nonce32[32]; rustsecp256k1zkp_v0_4_0_rfc6979_hmac_sha256 rng; int overflow; unsigned char keydata[64] = {0}; if (seed32 == NULL) { /* When seed is NULL, reset the initial point and blinding value. */ rustsecp256k1zkp_v0_4_0_gej_set_ge(&ctx->initial, &rustsecp256k1zkp_v0_4_0_ge_const_g); rustsecp256k1zkp_v0_4_0_gej_neg(&ctx->initial, &ctx->initial); rustsecp256k1zkp_v0_4_0_scalar_set_int(&ctx->blind, 1); } /* The prior blinding value (if not reset) is chained forward by including it in the hash. */ rustsecp256k1zkp_v0_4_0_scalar_get_b32(nonce32, &ctx->blind); /** Using a CSPRNG allows a failure free interface, avoids needing large amounts of random data, * and guards against weak or adversarial seeds. This is a simpler and safer interface than * asking the caller for blinding values directly and expecting them to retry on failure. */ memcpy(keydata, nonce32, 32); if (seed32 != NULL) { memcpy(keydata + 32, seed32, 32); } rustsecp256k1zkp_v0_4_0_rfc6979_hmac_sha256_initialize(&rng, keydata, seed32 ? 64 : 32); memset(keydata, 0, sizeof(keydata)); /* Accept unobservably small non-uniformity. */ rustsecp256k1zkp_v0_4_0_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); overflow = !rustsecp256k1zkp_v0_4_0_fe_set_b32(&s, nonce32); overflow |= rustsecp256k1zkp_v0_4_0_fe_is_zero(&s); rustsecp256k1zkp_v0_4_0_fe_cmov(&s, &rustsecp256k1zkp_v0_4_0_fe_one, overflow); /* Randomize the projection to defend against multiplier sidechannels. */ rustsecp256k1zkp_v0_4_0_gej_rescale(&ctx->initial, &s); rustsecp256k1zkp_v0_4_0_fe_clear(&s); rustsecp256k1zkp_v0_4_0_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); rustsecp256k1zkp_v0_4_0_scalar_set_b32(&b, nonce32, NULL); /* A blinding value of 0 works, but would undermine the projection hardening. */ rustsecp256k1zkp_v0_4_0_scalar_cmov(&b, &rustsecp256k1zkp_v0_4_0_scalar_one, rustsecp256k1zkp_v0_4_0_scalar_is_zero(&b)); rustsecp256k1zkp_v0_4_0_rfc6979_hmac_sha256_finalize(&rng); memset(nonce32, 0, 32); rustsecp256k1zkp_v0_4_0_ecmult_gen(ctx, &gb, &b); rustsecp256k1zkp_v0_4_0_scalar_negate(&b, &b); ctx->blind = b; ctx->initial = gb; rustsecp256k1zkp_v0_4_0_scalar_clear(&b); rustsecp256k1zkp_v0_4_0_gej_clear(&gb); } #endif /* SECP256K1_ECMULT_GEN_IMPL_H */
80ef642686790af0fc8d7822656eb18c1a10091e
2f4e5097509015d70d80f538f67d99f4638703ca
/1BIT/letnรญ/IJC/DU1/error.h
a4c68f8cd72c256587f39de14b5422ed0abf01a9
[]
no_license
matejMitas/VUT_FIT_BIT
c36c33bf9158097074be9b2504afa69d1775689d
45cfa3f593c15f264a9c8a484eeb07546a3eb661
refs/heads/master
2022-11-05T17:31:00.998989
2019-06-23T09:52:48
2019-06-23T09:52:48
193,276,025
0
0
null
2022-10-05T23:59:19
2019-06-22T20:18:59
C++
UTF-8
C
false
false
308
h
error.h
// error.h // ล˜eลกenรญ IJC-DU1, pล™รญklad a), 28.02.2017 // Autor: Matฤ›j Mitaลก, FIT // Pล™eloลพeno: gcc 4.9 #ifndef errors_h #define errors_h #include <stdio.h> #include <stdarg.h> #include <stdlib.h> #endif /* errors_h */ void warning_msg(const char *fmt, ...); void error_msg(const char *fmt, ...);
9fe7329fd84e5891b385b924f799e98a9210145c
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
/SOFTWARE/A64-TERES/linux-a64/arch/um/drivers/cow.h
6673508f342603554c4fbe874511ab6df14af45f
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "Linux-syscall-note", "GPL-2.0-only", "GPL-1.0-or-later" ]
permissive
OLIMEX/DIY-LAPTOP
ae82f4ee79c641d9aee444db9a75f3f6709afa92
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
refs/heads/rel3
2023-08-04T01:54:19.483792
2023-04-03T07:18:12
2023-04-03T07:18:12
80,094,055
507
92
Apache-2.0
2023-04-03T07:05:59
2017-01-26T07:25:50
C
UTF-8
C
false
false
1,037
h
cow.h
#ifndef __COW_H__ #define __COW_H__ #include <asm/types.h> extern int init_cow_file(int fd, char *cow_file, char *backing_file, int sectorsize, int alignment, int *bitmap_offset_out, unsigned long *bitmap_len_out, int *data_offset_out); extern int file_reader(__u64 offset, char *buf, int len, void *arg); extern int read_cow_header(int (*reader)(__u64, char *, int, void *), void *arg, __u32 *version_out, char **backing_file_out, time_t *mtime_out, unsigned long long *size_out, int *sectorsize_out, __u32 *align_out, int *bitmap_offset_out); extern int write_cow_header(char *cow_file, int fd, char *backing_file, int sectorsize, int alignment, unsigned long long *size); extern void cow_sizes(int version, __u64 size, int sectorsize, int align, int bitmap_offset, unsigned long *bitmap_len_out, int *data_offset_out); #endif /* * --------------------------------------------------------------------------- * Local variables: * c-file-style: "linux" * End: */
376a88be1be6169640bdd580f85776143232fe45
c31e42dd14bf642571957dac82bc656ad7174c75
/Whitebook/Ch2/3_Constants.c
267233159b79dfd31d30ec5aed49df1385096bfb
[]
no_license
Jaeeunykim/CodingTrip
9434f9b5799daeb7b5dd52a1a38cce1016ed1572
607376c25c84afcf9b93dc23ba47616aff2c3cad
refs/heads/master
2020-12-02T19:17:26.214139
2017-07-13T08:53:37
2017-07-13T08:53:37
96,318,922
0
0
null
null
null
null
UTF-8
C
false
false
1,052
c
3_Constants.c
2.3 Constants int์— ๋“ค์–ด๊ฐ€์ง€ ์•Š์„๋งŒํผ ํฐ ์ •์ˆ˜๋Š” long์œผ๋กœ ๊ฐ„์ฃผ Unsigned ์ƒ์ˆ˜(๋ถ€ํ˜ธ๊ฐ€ ์—†๋Š” ์ƒ์ˆ˜)๋Š” ํ„ฐ๋ฏธ๋„uํ˜น์€ U๋กœ ์“ด๋‹ค Unsigned long๋Š” ul๋˜๋Š” UL๋กœ ํ‘œ์‹œํ•œ๋‹ค ๋ถ€๋™์†Œ์ˆ˜์  ์ƒ์ˆ˜์—๋Š” ์†Œ์ˆ˜์ (123.4)๋˜๋Š” ์ง€์ˆ˜ (1e-2) ๋‘˜๋‹ค ํฌํ•จ๋œ๋‹ค ์ ‘๋ฏธ์‚ฌ f๋˜๋Š” F๋ถ€๋™์†Œ์ˆ˜์  ์ƒ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค ์ ‘๋ฏธ์‚ฌ l๋˜๋Š” L๋Š” long double์„ ๋‚˜ํƒ€๋‚ธ๋‹ค // ๋ฌธ์ž์—ด์˜ ๊ธธ์ด ๊ตฌํ•˜๊ธฐ ํ•จ์ˆ˜์ •์˜ : charํ˜• string๋ฐฐ์—ด์„ ์ธ์ž๋กœ ๊ฐ€์ง€๊ณ  ์žˆ๊ณ  return ํƒ€์ž…์ด int์ธ strlen ํ•จ์ˆ˜ ํ•จ์ˆ˜๊ตฌํ˜„ : ์ •์ˆ˜ํ˜•์ธ ๋ณ€์ˆ˜ i ์„ ์–ธ, string๋ฐฐ์—ด i๋ฒˆ์งธ ์บ๋ฆญํ„ฐ๊ฐ€ null์ด์•„๋‹ˆ๋ฉด ๋ณ€์ˆ˜i๋ฅผ ํ•˜๋‚˜ ์ฆ๊ฐ€ ์‹œํ‚ค๊ณ (while๋ฌธ) sttrig๋ฐฐ์—ด i๋ฒˆ์งธ ์บ๋ฆญํ„ฐ๊ฐ€ null์ด๋ฉด ๋ณ€์ˆ˜ i๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋ผ int strlen (char s[]) { int i; while( char s[] != '\0') ++i; return i; } enum์€ ์—ด๊ฑฐ์ƒ์ˆ˜๋กœ ์ •์ˆ˜ํ˜• ๊ฐ’์„ ๋‚˜์—ดํ•œ๋‹ค 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•˜๊ณ  ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ๊ฐ’์„ ์ง€์ •ํ• ์ˆ˜ ์žˆ๋‹ค enum months { JAN = 1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC }; FEB๋Š” 2, MAR๋Š” 3 etc..
941d5b5cd6219cd21c1074233822da015511d849
fd5c9a04dce47ffb7c04679ba0aa3c881ac9a9e8
/edk2_LG_G7_THINQ/workspace/Build/LgG7ThinQPkg/DEBUG_GCC5/AARCH64/EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib/DEBUG/AutoGen.h
8d40a0704f3b2724ef537107984e58a0a80f4adc
[]
no_license
vicenteicc2008/Lg_G7_EDK2
806d989be213be958ede975a70216ecc73c7fc2f
1210b68969df4d6e3d7490e203f1b19acf4ad8e8
refs/heads/master
2023-05-01T15:15:35.497559
2021-05-25T23:48:38
2021-05-25T23:48:38
null
0
0
null
null
null
null
UTF-8
C
false
false
1,226
h
AutoGen.h
/** DO NOT EDIT FILE auto-generated Module name: AutoGen.h Abstract: Auto-generated AutoGen.h for building module or library. **/ #ifndef _AUTOGENH_36F6E94E_6E8E_488E_89A4_7AD911C5AFB1 #define _AUTOGENH_36F6E94E_6E8E_488E_89A4_7AD911C5AFB1 #ifdef __cplusplus extern "C" { #endif #include <Base.h> #include <Library/PcdLib.h> extern GUID gEfiCallerIdGuid; extern CHAR8 *gEfiCallerBaseName; // Guids extern GUID gEfiMdePkgTokenSpaceGuid; // Definition of SkuId Array extern UINT64 _gPcd_SkuId_Array[]; // PCD definitions #define _PCD_TOKEN_PcdMaximumGuidedExtractHandler 46U extern const UINT32 _gPcd_FixedAtBuild_PcdMaximumGuidedExtractHandler; #define _PCD_GET_MODE_32_PcdMaximumGuidedExtractHandler _gPcd_FixedAtBuild_PcdMaximumGuidedExtractHandler //#define _PCD_SET_MODE_32_PcdMaximumGuidedExtractHandler ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD #define _PCD_VALUE_PcdMaximumGuidedExtractHandler 0x10 #define _PCD_SIZE_PcdMaximumGuidedExtractHandler 4 #define _PCD_GET_MODE_SIZE_PcdMaximumGuidedExtractHandler _PCD_SIZE_PcdMaximumGuidedExtractHandler RETURN_STATUS EFIAPI ExtractGuidedSectionLibConstructor ( VOID ); #ifdef __cplusplus } #endif #endif
10f9148d08611acd4ae2ae5c0bc9a9e3a5c7fe55
9077cc094b39b88ae2dec76a4dc0335f11822c54
/parseoEntrada.c
4e0879e0a3ae11e1f67d318c0b272ed64a205076
[]
no_license
nachochiappe/7541-carolo-tp2
27c66c8de0a1c8cae2329021693df51626886fb9
0b8ffdb96c800e6905ccef6c7b040bb29cfb0fe7
refs/heads/master
2021-07-21T17:07:50.121963
2017-11-01T15:48:50
2017-11-01T15:48:50
105,069,567
2
0
null
null
null
null
UTF-8
C
false
false
2,655
c
parseoEntrada.c
/* * parserXML.c * * Created on: 28 oct. 2017 * Author: fernando */ #include "parseoEntrada.h" #include <string.h> #include <stdlib.h> void parseaClienteXML(TElemCliente *clienteNuevo, char *lineaXML) { char *inicio, *token; char cadenaAuxiliar[4]; char *cadenaTemp = malloc(strlen(lineaXML) + 1); if (!cadenaTemp) return; /* COPIA ID */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<id>") + 4; token = strtok(inicio, "<"); strcpy(cadenaAuxiliar, token); clienteNuevo->idCliente = atoi(cadenaAuxiliar); /* COPIA NOMBRE */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<Nombre>") + 8; token = strtok(inicio, "<"); strcpy(clienteNuevo->Nombre, token); /* COPIA APELLIDO */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<Apellido>") + 10; token = strtok(inicio, "<"); strcpy(clienteNuevo->Apellido, token); /* COPIA TELEFONO */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<Telefono>") + 10; token = strtok(inicio, "<"); strcpy(clienteNuevo->Telefono, token); /* COPIA MAIL */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<Mail>") + 6; token = strtok(inicio, "<"); strcpy(clienteNuevo->mail, token); /* COPIA FECHA */ strcpy(cadenaTemp, lineaXML); inicio = strstr(cadenaTemp, "<Time>") + 6; token = strtok(inicio, "<"); strcpy(clienteNuevo->fecha, token); free(cadenaTemp); } void parseaClienteJSON(TElemCliente *clienteNuevo, char *lineaJSON) { char *token; char cadenaAuxiliar[4]; char *inicio; char *cadenaTemp = malloc(strlen(lineaJSON) + 1); if (!cadenaTemp) return; /* COPIA ID */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "id:") + 3; token = strtok(inicio, ","); strcpy(cadenaAuxiliar, token); clienteNuevo->idCliente = atoi(cadenaAuxiliar); /* COPIA NOMBRE */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "Nombre:") + 7; token = strtok(inicio, ","); strcpy(clienteNuevo->Nombre, token); /* COPIA APELLIDO */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "Apellido:") + 9; token = strtok(inicio, ","); strcpy(clienteNuevo->Apellido, token); /* COPIA TELEFONO */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "Telefono:") + 9; token = strtok(inicio, ","); strcpy(clienteNuevo->Telefono, token); /* COPIA MAIL */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "Mail:") + 5; token = strtok(inicio, ","); strcpy(clienteNuevo->mail, token); /* COPIA FECHA */ strcpy(cadenaTemp, lineaJSON); inicio = strstr(cadenaTemp, "Time:") + 5; token = strtok(inicio, "}"); strcpy(clienteNuevo->fecha, token); free(cadenaTemp); }