diff options
Diffstat (limited to '2.3-1')
79 files changed, 953 insertions, 97 deletions
diff --git a/2.3-1/builder.sce b/2.3-1/builder.sce new file mode 100644 index 00000000..71523a6b --- /dev/null +++ b/2.3-1/builder.sce @@ -0,0 +1,34 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// +//mode(-1); +lines(0); +try + getversion('scilab'); +catch + error(gettext('Scilab 5.0 or more is required.')); +end; +// ==================================================================== +if ~with_module('development_tools') then + error(msprintf(gettext('%s module not installed."),'development_tools')); +end +// ==================================================================== +TOOLBOX_NAME = 'scilab2c'; +TOOLBOX_TITLE = 'Scilab 2 C Converter'; +// ==================================================================== +toolbox_dir = get_absolute_file_path('builder.sce'); + +tbx_builder_macros(toolbox_dir); +//tbx_builder_help(toolbox_dir); +tbx_build_loader(TOOLBOX_NAME, toolbox_dir); + +clear toolbox_dir TOOLBOX_NAME TOOLBOX_TITLE; +// ==================================================================== diff --git a/2.3-1/etc/scilab2c.start b/2.3-1/etc/scilab2c.start index 14feb3c2..47554ab5 100644 --- a/2.3-1/etc/scilab2c.start +++ b/2.3-1/etc/scilab2c.start @@ -20,6 +20,7 @@ sci2c_GenFunctionslib = lib(pathmacros + "GeneralFunctions" + filesep()); sci2c_SymbolTablelib = lib(pathmacros + "SymbolTable" + filesep()); sci2c_ToolInitlib = lib(pathmacros + "ToolInitialization" + filesep()); sci2c_finDeps = lib(pathmacros + "findDeps" + filesep()); +sci2c_AVRlib = lib(pathmacros + "Hardware\AVR" + filesep()); clear pathmacros; // Load and add help chapter diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index aa6a9cc6..b9820bcd 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -330,6 +330,7 @@ #include "types.h" /*Scilab-arduino toolbox*/ +#ifdef ARDUINO #include "int_cmd_digital_out.h" #include "cmd_digital_out.h" #include "int_cmd_digital_in.h" @@ -340,5 +341,15 @@ #include "cmd_analog_in.h" #include "int_sleep.h" #include "sleep.h" +#endif + +/*AVR*/ +#ifdef AVR +#include "int_AVRPeripheralGPIO.h" +#include "AVRPeripheralGPIO.h" +#include "int_AVRPeripheralADC.h" +#include "AVRPeripheralADC.h" + +#endif #endif /* !__SCI2CLIB_H__ */ diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin Binary files differindex 12f738d4..8b3ce654 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index 69fbb82e..f9515cd1 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -40,12 +40,13 @@ SCI2CNInArgCheck(argn(2),3,3); // ----------------------- // --- Initialization. --- // ----------------------- -nxtscifunname = SharedInfo.NextSCIFunName; -nxtscifunnumber = SharedInfo.NextSCIFunNumber; -ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; -Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; -FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; -CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; +FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; +CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; +PeripheralInitListFile = FileInfo.PeripheralInitListFile; Flag_FunAlreadyCalled = 0; // #RNU_RES_B @@ -101,6 +102,11 @@ elseif (ASTFunName == 'global') PrintStringInfo(' ',ReportFileName,'both','y'); error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.'); end +//elseif(IsAVRSupportFunction(ASTFunName)) + //Get the peripheral from function name and input arguements, insert it in + //list of used peripherals. + // PeripheralUsed=GetPeripheral(ASTFunName,InArg); + // InsertPeripheralInList(PeripheralUsed,PeripheralInitListFile); end // #RNU_RES_B diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib Binary files differindex ccecc91e..4cd697ce 100644 --- a/2.3-1/macros/ASTManagement/lib +++ b/2.3-1/macros/ASTManagement/lib diff --git a/2.3-1/macros/ASTManagement/names b/2.3-1/macros/ASTManagement/names index 3e6bfa8c..7f6d053d 100644 --- a/2.3-1/macros/ASTManagement/names +++ b/2.3-1/macros/ASTManagement/names @@ -1,44 +1,44 @@ -AST_ParseOperStruct -AST_HandleEOL -AST_ReadEqualRhsNames -AST_HandleFor +%comment_string +%cste_string +%equal_string +%for_string +%funcall_string +%ifthenel_string +%operatio_string +%program_p +%program_string %variable_string -AST_GetASTFile -AST_HandleEndFor +%while_string AST2Ccode -AST_GetFuncallPrm -AST_HandleEndGenFun +AST_CheckCommonInOutArgs +AST_CheckLastFunc AST_CheckLineLength -SciFile2ASTFile AST_CheckPrecSpecifier -%operatio_string -AST_HandleIfElse +AST_DisplayStack +AST_ExtractNameAndScope +AST_GetASTFile +AST_GetFuncallPrm +AST_GetPrecAndLhsArg +AST_HandleEOL +AST_HandleEndFor +AST_HandleEndGenFun +AST_HandleEndProgram AST_HandleEndWhile -AST_CheckCommonInOutArgs -AST_HandleWhileStatem +AST_HandleFor AST_HandleForStatem -%ifthenel_string +AST_HandleHeader +AST_HandleIfElse +AST_HandleWhileExpr +AST_HandleWhileStatem AST_ParseEqualStruct -%while_string -AST_GetPrecAndLhsArg -AST_ExtractNameAndScope -objectlist2string -%comment_string +AST_ParseFuncallStruct +AST_ParseIfExprStruct +AST_ParseOperStruct AST_PopASTStack -AST_CheckLastFunc -GenOutArgNames -%equal_string -AST_ReadASTHeader -%cste_string -AST_HandleEndProgram AST_PushASTStack -AST_DisplayStack -%funcall_string -AST_HandleWhileExpr -AST_ParseFuncallStruct +AST_ReadASTHeader +AST_ReadEqualRhsNames +GenOutArgNames Operator2FunName -%program_p -AST_HandleHeader -AST_ParseIfExprStruct -%program_string -%for_string +SciFile2ASTFile +objectlist2string diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differindex e262750a..40a8771d 100644 --- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.sci b/2.3-1/macros/CCodeGeneration/C_Funcall.sci index b130a622..166799e6 100644 --- a/2.3-1/macros/CCodeGeneration/C_Funcall.sci +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.sci @@ -35,7 +35,7 @@ CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; CInitVarsFileName = FileInfo.Funct(nxtscifunnumber).CInitVarsFileName; IndentLevel = SharedInfo.NIndent; CCall = ''; - +OutFormat = SharedInfo.OutFormat; // --- Extract Function Info. --- FunctionName = FunInfo.SCIFunctionName; CFunName = FunInfo.CFunctionName; @@ -371,7 +371,7 @@ else if (FlagCall == 0) // Add prototype to the header file - C_InitHeader(CCall+';',HeaderFileName,SharedInfo.Sci2CLibMainHeaderFName); + C_InitHeader(CCall+';',HeaderFileName,SharedInfo.Sci2CLibMainHeaderFName,OutFormat); // Add { at the beginning of the function. PrintStringInfo(' {',ReportFileName,'file','y'); diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex eb01ef65..98734690 100644 --- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin Binary files differindex 45bb3564..72c7943e 100644 --- a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.sci b/2.3-1/macros/CCodeGeneration/C_InitHeader.sci index 41e13e45..1c2efd6a 100644 --- a/2.3-1/macros/CCodeGeneration/C_InitHeader.sci +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.sci @@ -1,4 +1,4 @@ -function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) +function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName,OutFormat) // function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) // ----------------------------------------------------------------- // //NUT: add description here @@ -51,6 +51,12 @@ PrintStringInfo('extern ""C"" {',HeaderFileName,'file','y'); PrintStringInfo('#endif',HeaderFileName,'file','y'); PrintStringInfo('/*',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** ----- Target ------ ',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo('# define ' + OutFormat + '1' ,HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('** --- Prototypes. --- ',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('*/',HeaderFileName,'file','y'); diff --git a/2.3-1/macros/CCodeGeneration/C_Type.bin b/2.3-1/macros/CCodeGeneration/C_Type.bin Binary files differindex 00c10704..c2ff6e65 100644 --- a/2.3-1/macros/CCodeGeneration/C_Type.bin +++ b/2.3-1/macros/CCodeGeneration/C_Type.bin diff --git a/2.3-1/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin b/2.3-1/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin Binary files differindex 026863b2..61f446f3 100644 --- a/2.3-1/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin +++ b/2.3-1/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib Binary files differindex 78fb2f09..50f6251b 100644 --- a/2.3-1/macros/FunctionAnnotation/lib +++ b/2.3-1/macros/FunctionAnnotation/lib diff --git a/2.3-1/macros/FunctionAnnotation/names b/2.3-1/macros/FunctionAnnotation/names index e95bff5f..d9300d20 100644 --- a/2.3-1/macros/FunctionAnnotation/names +++ b/2.3-1/macros/FunctionAnnotation/names @@ -1,55 +1,55 @@ -FA_SZ_OPRC -FA_SZ_OPLOGEQ -FA_SZ_OPLOGLT +FA_ADD FA_DIV -FA_SZ_OPCC -FA_SZ_OPPLUS -FA_TP_Z -FA_SZ_OPLOGGE -FA_MIN -FA_MUL -FA_SZ_OPLOGOR -FA_SZ_OPSTAR -FA_SZ_OPMINUS -FA_SZ_SEL1 -FA_SZ_OPLOGNE -FA_SZ_OPSLASH -FA_SZ_OPDOTAPEX -FA_SZ_OPBACKSLASH -FA_GetFunAnn -FA_SZ_OPDOTSLASH -FA_SZ_OPPLUSA -FA_MAX FA_GetDefaultPrecision -FA_SZ_OPHAT -FA_TP_C +FA_GetFunAnn +FA_GetOutArgInfo +FA_GetResizeApproach FA_INT -FA_TP_REAL -FA_TP_USER +FA_MAX +FA_MIN +FA_MUL FA_REAL -FA_TP_COMPLEX -FA_ADD -FA_TP_MIN_REAL +FA_SUB FA_SZ_1 -FA_SZ_OPDOTHAT -FA_SZ_OPDOTBACKSLASH -FA_TP_I +FA_SZ_2 FA_SZ_FROM_VAL +FA_SZ_OPAPEX +FA_SZ_OPBACKSLASH +FA_SZ_OPCC +FA_SZ_OPDOTAPEX +FA_SZ_OPDOTBACKSLASH +FA_SZ_OPDOTHAT +FA_SZ_OPDOTSLASH +FA_SZ_OPDOTSTAR +FA_SZ_OPHAT FA_SZ_OPLOGAND -FA_GetOutArgInfo -FA_TP_S -FA_TP_D -FA_TP_MAX -FA_SZ_2 -FA_SZ_SEL2 -FA_GetResizeApproach +FA_SZ_OPLOGEQ +FA_SZ_OPLOGGE FA_SZ_OPLOGGT -FA_SZ_OPDOTSTAR -FA_SUB -FA_SZ_OPLOGNOT FA_SZ_OPLOGLE -FA_SZ_OPAPEX -FA_TP_UINT8 +FA_SZ_OPLOGLT +FA_SZ_OPLOGNE +FA_SZ_OPLOGNOT +FA_SZ_OPLOGOR +FA_SZ_OPMINUS +FA_SZ_OPPLUS +FA_SZ_OPPLUSA +FA_SZ_OPRC +FA_SZ_OPSLASH +FA_SZ_OPSTAR +FA_SZ_SEL1 +FA_SZ_SEL2 +FA_TP_C +FA_TP_COMPLEX +FA_TP_D +FA_TP_I +FA_TP_INT16 FA_TP_INT8 +FA_TP_MAX +FA_TP_MIN_REAL +FA_TP_REAL +FA_TP_S +FA_TP_UINT16 FA_TP_UINT8 -FA_TP_INT16 +FA_TP_USER +FA_TP_Z diff --git a/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci b/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci new file mode 100644 index 00000000..d9897fc3 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRADCSetup.sci @@ -0,0 +1,32 @@ +function AVRADCSetup(prescalar,adc_ref) +// Function to initialise ADC of AVR +// +// Calling Sequence +// AVRSetupADC(uint8 prescalar, uint8 adc_ref) +// +// Parameters +// prescalar: prescalar to be used for generating ADC clock (0-7) +// adc_ref : reference voltage to be used for ADC conversion +// 0 -> Voltage on VREF pin +// 1 -> Voltage on AVCC pin +// 2 -> Internal 2.56 reference voltage +// +// Description +// This function initialises ADc of AVR with given parameters. 'prescalar' is +// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz +// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending +// on MCU clock. 'adc_ref' selects one of the available reference voltage sources +// available +// Examples +// AVRADCSetup(128,0) + +// See also +// AVRReadADC +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin Binary files differnew file mode 100644 index 00000000..7a09b0d8 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalOut.sci b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.sci new file mode 100644 index 00000000..f17c8a07 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalOut.sci @@ -0,0 +1,32 @@ +function AVRDigitalOut(port,pin,state) +// Function to change state (high\low) of a digital output pin on AVR +// +// Calling Sequence +// AVRDigitalOut(port,pin,state) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// state : state to be outputed on pin (HIGH\LOW) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port as +// digital output. Also, desired output state must be specified as +// 'HIGH' or 'LOW'. +// +// Examples +// AVRDigitalOut('A',0,HIGH) +// +// See also +// AVRDigitalIn +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin Binary files differnew file mode 100644 index 00000000..98a592e3 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.bin diff --git a/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.sci b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.sci new file mode 100644 index 00000000..3de56c21 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRDigitalSetup.sci @@ -0,0 +1,32 @@ +function AVRDigitalSetup(port,pin,direction) +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalSetup(port,pin,direction) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// direction : direction to be set for pin (INPUT\OUTPUT) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalSetup('A',0,OUTPUT) +// +// See also +// AVRDigitalIn AVRDigitalOut +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/2.3-1/macros/Hardware/AVR/AVRReadADC.sci b/2.3-1/macros/Hardware/AVR/AVRReadADC.sci new file mode 100644 index 00000000..f9dfdac0 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/AVRReadADC.sci @@ -0,0 +1,31 @@ +function AVRReadADC(channel) +// Function to get voltage on analog pin on AVR +// +// Calling Sequence +// u8AVRReadADCs(channel) +// +// Parameters +// channel : Select which channel is to be read. Values from 0-7 select one +// of the pins ADC0-ADC7. For other possible channel values refer +// datasheet +// Returns-> +// result : Digital value for the voltage present on channel selected +// +// Description +// This function returns digital value for present on adc pins. 'channel' +// selects which of the ADC0-ADC7 is to be used for reading analog value. +// Apart from reading just ADC0-ADC7 other it can also read differential +// voltages between some pins. For channel values for those options, please +// refer datasheet. +// +// Examples +// adc_result = u8AVRReadADC(0) //Read ADC0 +// +// Authors +// Siddhesh Wani +// + + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin Binary files differnew file mode 100644 index 00000000..eed8be3b --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.bin diff --git a/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci new file mode 100644 index 00000000..50a913fa --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetAVRSupportFunctions.sci @@ -0,0 +1,16 @@ +function AVRSupportFunctions = GetAVRSupportFunctions() +// ----------------------------------------------------------------- +// Get list of AVR peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +AVRSupportFunctions = ["AVRDigitalOut"]; + +endfunction diff --git a/2.3-1/macros/Hardware/AVR/GetPeripheral.bin b/2.3-1/macros/Hardware/AVR/GetPeripheral.bin Binary files differnew file mode 100644 index 00000000..b496bbb0 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetPeripheral.bin diff --git a/2.3-1/macros/Hardware/AVR/GetPeripheral.sci b/2.3-1/macros/Hardware/AVR/GetPeripheral.sci new file mode 100644 index 00000000..73e9f19e --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/GetPeripheral.sci @@ -0,0 +1,21 @@ +function Peripheral = GetPeripheral(FunName,InArg) +// ----------------------------------------------------------------- +// Get an acronym for peripheral being used to be inserted in list of +// used peripherals +// +// Input data: +// FunName: Name of the function to be checked +// InArg:Input arguements passed to function 'FunName' +// +// Output data: +// Peripheral: Acronym for peripheral to be initialised +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//select FunName + +//case AVRDigitalOut: +// Peripheral = list('PORT', InArg(1),InArg(2)]; +//end +endfunction diff --git a/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin Binary files differnew file mode 100644 index 00000000..c49f4e04 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.bin diff --git a/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.sci b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.sci new file mode 100644 index 00000000..bafc5935 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/InsertPeripheralInList.sci @@ -0,0 +1,17 @@ +function InsertPeripheralInList(Peripheral,PeripheralListFile) +// ----------------------------------------------------------------- +// Insert input peripheral in peripherals' list +// +// Input data: +// Peripheral: Peripheral of type 'list' to be instertd in list +// PeripheralListFile: Name of file containing list of peripheral used +// +// Output data: +// None +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +load(PeripheralListFile,'PheripheralList'); + +endfunction diff --git a/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin Binary files differnew file mode 100644 index 00000000..e2382308 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.bin diff --git a/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.sci b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.sci new file mode 100644 index 00000000..a4cbbc88 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/IsAVRSupportFunction.sci @@ -0,0 +1,22 @@ +function Output = IsAVRSupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is an AVR support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is an AVR +// support functions or not +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +AVRSupportFunctions = GetAVRSupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInAVRSupport = members(FunName,AVRSupportFunctions); +Output = bool2s(FunNameInAVRSupport~=0); + +endfunction diff --git a/2.3-1/macros/Hardware/AVR/buildmacros.sce b/2.3-1/macros/Hardware/AVR/buildmacros.sce new file mode 100644 index 00000000..60fd2843 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differnew file mode 100644 index 00000000..097a89f0 --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/lib diff --git a/2.3-1/macros/Hardware/AVR/names b/2.3-1/macros/Hardware/AVR/names new file mode 100644 index 00000000..4b941e9b --- /dev/null +++ b/2.3-1/macros/Hardware/AVR/names @@ -0,0 +1,6 @@ +AVRDigitalOut +AVRDigitalSetup +GetAVRSupportFunctions +GetPeripheral +InsertPeripheralInList +IsAVRSupportFunction diff --git a/2.3-1/macros/Hardware/buildmacros.sce b/2.3-1/macros/Hardware/buildmacros.sce new file mode 100644 index 00000000..88f0fb2a --- /dev/null +++ b/2.3-1/macros/Hardware/buildmacros.sce @@ -0,0 +1,19 @@ +// This file is released into the public domain + +Directories = [ "AVR" ]; + + +current_path_buildmacros = get_absolute_file_path("buildmacros.sce"); + +for K=1:size(Directories,"*") + myfile = current_path_buildmacros + filesep() + Directories(K) + filesep() + "buildmacros.sce"; + if isfile(myfile) then + exec(myfile); + end +end + +clear current_path_buildmacros; + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/2.3-1/macros/ToolInitialization/INIT_CreateDirs.bin b/2.3-1/macros/ToolInitialization/INIT_CreateDirs.bin Binary files differindex 5c17670b..14dfb49c 100644 --- a/2.3-1/macros/ToolInitialization/INIT_CreateDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_CreateDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex 68968b59..a85721c0 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 792ef653..6a4c8773 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -3885,6 +3885,62 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---Functions for AVR ---------------
+//------------------------------------
+
+
+//------------------------------------
+//---- Class AVRDigitalSetup ---------
+//------------------------------------
+ClassName = 'AVRDigitalSetup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class AVRDigitalOut -----------
+//------------------------------------
+ClassName = 'AVRDigitalOut';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalOut';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
// /////////////////////////////////////////////
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin b/2.3-1/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin Binary files differindex 6220b291..f80837e1 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin Binary files differindex dc4c3fe9..db8c34ba 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci index 743f6471..753509e3 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci +++ b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci @@ -108,4 +108,10 @@ FileInfo.GeneralReport = fullfile(FileInfo.WorkingDir,'SCI2CGeneralReport.txt'); FileInfo.CStyleSCI2CMainDir = pathconvert(FileInfo.SCI2CMainDir, %f, %f, 'u');
FileInfo.CStyleOutCCCodeDir = pathconvert(OutCCCodeDir, %f, %f, 'u');
FileInfo.MakefileFilename = fullfile(FileInfo.CStyleOutCCCodeDir,'Makefile');
+
+//-------------------------
+//----Hardware related-----
+//-------------------------
+FileInfo.PeripheralInitListFile = fullfile(FileInfo.WorkingDir,'PeripheralInit.dat');
+
endfunction
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenLibraries.bin b/2.3-1/macros/ToolInitialization/INIT_GenLibraries.bin Binary files differindex 2df9a4fd..f6059c98 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenLibraries.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenLibraries.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin Binary files differindex ce14906c..42b16627 100644 --- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin +++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin Binary files differindex 0a48d061..fbbb6414 100644 --- a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin +++ b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.bin b/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.bin Binary files differindex fc036951..0740d242 100644 --- a/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.bin +++ b/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin b/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin Binary files differindex 22ac0148..b0b849b8 100644 --- a/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin +++ b/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin diff --git a/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci b/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci index 4065d047..0340d6ff 100644 --- a/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci +++ b/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci @@ -144,6 +144,12 @@ SharedInfoDatFile = FileInfo.SharedInfoDatFile; global anscounter; //NUT: just to fix problem with ans variables.
anscounter = 0;
+//--------------------------------------------
+//---Hardware related initialisation----------
+//--------------------------------------------
+PeripheralList = list();
+save(FileInfo.PeripheralInitListFile, 'PeripheralList');
+
endfunction
// #RNU_RES_B
//NUT: quando genero il c della funzione utente devo anche generare il corrispondente file delle includes.
diff --git a/2.3-1/macros/ToolInitialization/INIT_SharedInfoEqual.bin b/2.3-1/macros/ToolInitialization/INIT_SharedInfoEqual.bin Binary files differindex 55ef7bbc..5aeaa274 100644 --- a/2.3-1/macros/ToolInitialization/INIT_SharedInfoEqual.bin +++ b/2.3-1/macros/ToolInitialization/INIT_SharedInfoEqual.bin diff --git a/2.3-1/macros/ToolInitialization/ManageNextConversion.bin b/2.3-1/macros/ToolInitialization/ManageNextConversion.bin Binary files differindex 60555762..75360d7b 100644 --- a/2.3-1/macros/ToolInitialization/ManageNextConversion.bin +++ b/2.3-1/macros/ToolInitialization/ManageNextConversion.bin diff --git a/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.bin b/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.bin Binary files differindex 4a06ba27..3acb88aa 100644 --- a/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.bin +++ b/2.3-1/macros/ToolInitialization/UpdateSCI2CInfo.bin diff --git a/2.3-1/macros/ToolInitialization/lib b/2.3-1/macros/ToolInitialization/lib Binary files differindex 3db49c1c..6d909b02 100644 --- a/2.3-1/macros/ToolInitialization/lib +++ b/2.3-1/macros/ToolInitialization/lib diff --git a/2.3-1/macros/ToolInitialization/names b/2.3-1/macros/ToolInitialization/names index 0c264f0f..71a724d3 100644 --- a/2.3-1/macros/ToolInitialization/names +++ b/2.3-1/macros/ToolInitialization/names @@ -1 +1,14 @@ +INIT_CreateDirs INIT_FillSCI2LibCDirs +INIT_GenAnnFLFunctions +INIT_GenFileInfo +INIT_GenLibraries +INIT_GenSharedInfo +INIT_LoadLibraries +INIT_RemoveDirs +INIT_SCI2C +INIT_SharedInfoEqual +ManageNextConversion +UpdateSCI2CInfo +doublecomplex +floatcomplex diff --git a/2.3-1/macros/buildmacros.sce b/2.3-1/macros/buildmacros.sce index 41e3ace0..627e6384 100644 --- a/2.3-1/macros/buildmacros.sce +++ b/2.3-1/macros/buildmacros.sce @@ -8,7 +8,8 @@ Directories = [ "ASTManagement", ... "FunctionList", ... "GeneralFunctions", ... "SymbolTable", ... - "ToolInitialization" ]; + "ToolInitialization"... + "Hardware" ]; current_path_buildmacros = get_absolute_file_path("buildmacros.sce"); diff --git a/2.3-1/macros/cb_sci2c_gui.bin b/2.3-1/macros/cb_sci2c_gui.bin Binary files differindex a1e97832..00bf3684 100644 --- a/2.3-1/macros/cb_sci2c_gui.bin +++ b/2.3-1/macros/cb_sci2c_gui.bin diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin Binary files differindex e9992fd4..6c4c15f7 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.bin +++ b/2.3-1/macros/findDeps/getAllHeaders.bin diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index e152514b..f5c74bd0 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -136,10 +136,17 @@ function allHeaders = getAllHeaders(OutFormat) "src/c/scilab-arduino/includes/cmd_analog_in.h" "src/c/scilab-arduino/includes/sleep.h"]; + AVR_headers = [ + "src/c/hardware/avr/includes/AVRPeripheralGPIO.h" + "src/c/hardware/avr/includes/AVRPeripheralADC.h" + ]; + if OutFormat == "StandAlone" allHeaders = Standalone_headers; elseif OutFormat == "Arduino" allHeaders = cat(1,Standalone_headers, Arduino_headers); + elseif OutFormat == "AVR" + allHeaders = cat(1,Standalone_headers, AVR_headers); end endfunction diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin Binary files differindex c607ea19..ec75338c 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.bin +++ b/2.3-1/macros/findDeps/getAllInterfaces.bin diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index b32bb652..5b52c71a 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -129,10 +129,18 @@ function allInterfaces = getAllInterfaces(OutFormat) "src/c/scilab-arduino/interfaces/int_cmd_analog_in.h" "src/c/scilab-arduino/interfaces/int_sleep.h"]; + //Interface files required for "AVR" output + AVR_interfaces = [ + "src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h" + "src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h" + ]; + if OutFormat == "StandAlone" allInterfaces = Standalone_interfaces; elseif OutFormat == "Arduino" allInterfaces = cat(1,Standalone_interfaces, Arduino_interfaces); + elseif OutFormat == "AVR" + allInterfaces = cat(1,Standalone_interfaces, AVR_interfaces); end endfunction diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin Binary files differindex 1d698a0e..6c3f91f5 100644 --- a/2.3-1/macros/findDeps/getAllSources.bin +++ b/2.3-1/macros/findDeps/getAllSources.bin diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 356ba38e..956f7be1 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -823,10 +823,24 @@ function allSources = getAllSources(OutFormat) "src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c" "src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c" "src/c/scilab-arduino/sleep/u16sleeps.c"]; + + //Files to be inserted only if output format selected is 'AVR'. + AVR_files = [ + "src/c/hardware/avr/gpio/u8AVRDigitalSetups.c" + "src/c/hardware/avr/gpio/u8AVRDigitalOuts.c" + "src/c/hardware/avr/gpio/u8AVRDigitalIns.c" + "src/c/hardware/avr/adc/u8AVRADCSetups.c" + "src/c/hardware/avr/adc/u8AVRReadADCs.c" + "src/c/scilab-arduino/sleep/u16sleeps.c" + ]; + + if OutFormat == "StandAlone" allSources = Standalone_files; elseif OutFormat == "Arduino" allSources = cat(1,Standalone_files, Arduino_files); + elseif OutFormat == "AVR" + allSources = cat(1,Standalone_files, AVR_files); end endfunction diff --git a/2.3-1/macros/findDeps/getArduinoFiles.bin b/2.3-1/macros/findDeps/getArduinoFiles.bin Binary files differindex 3becbac7..c762c303 100644 --- a/2.3-1/macros/findDeps/getArduinoFiles.bin +++ b/2.3-1/macros/findDeps/getArduinoFiles.bin diff --git a/2.3-1/macros/lib b/2.3-1/macros/lib Binary files differindex 419931c4..8fbf4888 100644 --- a/2.3-1/macros/lib +++ b/2.3-1/macros/lib diff --git a/2.3-1/macros/names b/2.3-1/macros/names index b7a78575..a126347e 100644 --- a/2.3-1/macros/names +++ b/2.3-1/macros/names @@ -1,6 +1,6 @@ cb_sci2c_gui getScilab2cVersion runsci2c +runscicode sci2c_gui scilab2c -runscicode diff --git a/2.3-1/macros/runsci2c.bin b/2.3-1/macros/runsci2c.bin Binary files differindex 2cc69e9e..053c3311 100644 --- a/2.3-1/macros/runsci2c.bin +++ b/2.3-1/macros/runsci2c.bin diff --git a/2.3-1/macros/runsci2c.sci b/2.3-1/macros/runsci2c.sci index 880cc9d8..ac826a3a 100644 --- a/2.3-1/macros/runsci2c.sci +++ b/2.3-1/macros/runsci2c.sci @@ -105,7 +105,7 @@ mkdir(SCI2COutputPath+"/interfaces/"); PrintStepInfo('Copying sources', FileInfo.GeneralReport,'both');
for i = 1:size(allSources, "*")
// DEBUG only
- //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
+ disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
copyfile(allSources(i), SCI2COutputPath+"/src/c/");
end
@@ -113,7 +113,7 @@ end PrintStepInfo('Copying headers', FileInfo.GeneralReport,'both');
for i = 1:size(allHeaders, "*")
// DEBUG only
- // disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
+ disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
copyfile(allHeaders(i), SCI2COutputPath+"/includes/");
end
@@ -121,7 +121,7 @@ end PrintStepInfo('Copying interfaces', FileInfo.GeneralReport,'both');
for i = 1:size(allInterfaces, "*")
// DEBUG only
- //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
+ disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/");
end
diff --git a/2.3-1/macros/sci2c_gui.bin b/2.3-1/macros/sci2c_gui.bin Binary files differindex 1c1b69c9..9bdf607c 100644 --- a/2.3-1/macros/sci2c_gui.bin +++ b/2.3-1/macros/sci2c_gui.bin diff --git a/2.3-1/macros/scilab2c.bin b/2.3-1/macros/scilab2c.bin Binary files differindex 7416eb5f..e9fb5faa 100644 --- a/2.3-1/macros/scilab2c.bin +++ b/2.3-1/macros/scilab2c.bin diff --git a/2.3-1/macros/scilab2c.sci b/2.3-1/macros/scilab2c.sci index 1d4675e3..64d5753f 100644 --- a/2.3-1/macros/scilab2c.sci +++ b/2.3-1/macros/scilab2c.sci @@ -143,9 +143,9 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), // --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- - if OutFormat == "StandAlone" - runscicode(UserScilabMainFile, UserSciFilesPaths); - end +// if OutFormat == "StandAlone" +// runscicode(UserScilabMainFile, UserSciFilesPaths); +// end // --- ASK USER FOR CONTINUATION. --- // Do not open confirmation box if we are not in STD mode. @@ -156,7 +156,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), end if (userchoice == 1) // --- LAUNCH SCI2C --- - runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool,OutFormat); + runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool,'AVR'); end endfunction diff --git a/2.3-1/src/c/hardware/avr/adc/u8AVRADCSetups.c b/2.3-1/src/c/hardware/avr/adc/u8AVRADCSetups.c new file mode 100644 index 00000000..620f80fe --- /dev/null +++ b/2.3-1/src/c/hardware/avr/adc/u8AVRADCSetups.c @@ -0,0 +1,42 @@ +// Function to initialise ADC of AVR +// +// Calling Sequence +// AVRSetupADC(uint8 prescalar, uint8 adc_ref) +// +// Parameters +// prescalar: prescalar to be used for generating ADC clock (0-7) +// adc_ref : reference voltage to be used for ADC conversion +// 0 -> Voltage on VREF pin +// 1 -> Voltage on AVCC pin +// 2 -> Internal 2.56 reference voltage +// +// Description +// This function initialises ADc of AVR with given parameters. 'prescalar' is +// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz +// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending +// on MCU clock. 'adc_ref' selects one of the available reference voltage sources +// available +// Examples +// AVRADCSetup(128,0) +// +// Authors +// Siddhesh Wani +// + +#include "AVRPeripheralADC.h" + + +uint8 u8AVRADCSetups(uint8 prescalar, uint8 adc_ref) +{ + /*Set the prescalar value*/ + ADCSRA |= (prescalar & 0x07); + + /*Set the adc reference voltage*/ + ADMUX |= ((adc_ref & 0x03) << 6); + + /*Enable ADC hardware. Set ADEN bit*/ + ADCSRA |= (1<<7); + + return 0; +} + diff --git a/2.3-1/src/c/hardware/avr/adc/u8AVRReadADCs.c b/2.3-1/src/c/hardware/avr/adc/u8AVRReadADCs.c new file mode 100644 index 00000000..71fe1363 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/adc/u8AVRReadADCs.c @@ -0,0 +1,46 @@ +// Function to get voltage on analog pin on AVR +// +// Calling Sequence +// u8AVRReadADCs(channel) +// +// Parameters +// channel : Select which channel is to be read. Values from 0-7 select one +// of the pins ADC0-ADC7. For other possible channel values refer +// datasheet +// Returns-> +// result : Digital value for the voltage present on channel selected +// +// Description +// This function returns digital value for present on adc pins. 'channel' +// selects which of the ADC0-ADC7 is to be used for reading analog value. +// Apart from reading just ADC0-ADC7 other it can also read differential +// voltages between some pins. For channel values for those options, please +// refer datasheet. +// +// Examples +// adc_result = u8AVRReadADC(0) //Read ADC0 +// +// Authors +// Siddhesh Wani +// + + +#include "AVRPeripheralADC.h" + +uint16 u8AVRReadADCs(uint8 channel) +{ + /*Set ADC conversion channel*/ + ADMUX |= (channel & 0x1F); + + /*Start ADC conversion. Set 'ADSC' bit*/ + ADCSRA |= (1<<6); + + /*Wait for conversion to complete. Check 'ADIF' bit*/ + while(!(ADCSRA & (1<<4))); + + /*Clear ADIF flag*/ + ADCSRA |= (1<<4); + + /*ADC conversion result is stored in ADCH/L registers*/ + return (ADC); +} diff --git a/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalIns.c b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalIns.c new file mode 100644 index 00000000..6b61a56b --- /dev/null +++ b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalIns.c @@ -0,0 +1,54 @@ +// Function to get current state (high\low) of a digital pin on AVR +// +// Calling Sequence +// u8AVRDigitalIns(port,pin) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// Returns-> +// state : state of the pin (0 for low and 1 for high) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port is to +// be read. Function returns current state of the pin '1' (high) or '0' (low). +// +// +// Examples +// state = u8AVRDigitalIns(1,0) +// +// Authors +// Siddhesh Wani +// + + +#include "AVRPeripheralGPIO.h" + +uint8 u8AVRDigitalIns(uint8 port,uint8 pin) +{ + uint8 state = 0; + if(port == PORT_A) + { + state = (uint8)(PINA & (1<<pin)); + return state; + } + if(port == PORT_B) + { + state = (uint8)(PINB & (1<<pin)); + return state; + } + if(port == PORT_C) + { + state = (uint8)(PINC & (1<<pin)); + return state; + } + if(port == PORT_D) + { + state = (uint8)(PIND & (1<<pin)); + return state; + } + +//return state; +} diff --git a/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c new file mode 100644 index 00000000..5ee84a80 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalOuts.c @@ -0,0 +1,69 @@ +// Function to change state (high\low) of a digital output pin on AVR +// +// Calling Sequence +// u8AVRDigitalOuts(port,pin,state) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// state : state to be outputed on pin (0 for low and 1 for high) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port as +// digital output. Also, desired output state must be specified as +// '1' (high) or '0' (low). +// +// Examples +// u8AVRDigitalOuts(1,0,1) +// +// Authors +// Siddhesh Wani +// + + +#include "AVRPeripheralGPIO.h" + +uint8 u8AVRDigitalOuts(uint8 port,uint8 pin,uint8 state) +{ + if(state == LOW) + {/*Make output pin high*/ + if(port == PORT_A) + { + PORTA = PORTA & ~(1<<pin); + } + if(port == PORT_B) + { + PORTB = PORTB & ~(1<<pin); + } + if(port == PORT_C) + { + PORTC = PORTC & ~(1<<pin); + } + if(port == PORT_D) + { + PORTD = PORTD & ~(1<<pin); + } + } + else + {/*Make output pin high*/ + if(port == PORT_A) + { + PORTA = PORTA | (1<<pin); + } + if(port == PORT_B) + { + PORTB = PORTB | (1<<pin); + } + if(port == PORT_C) + { + PORTC = PORTC | (1<<pin); + } + if(port == PORT_D) + { + PORTD = PORTD | (1<<pin); + } + } +return 0; +} diff --git a/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c new file mode 100644 index 00000000..46697f70 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/gpio/u8AVRDigitalSetups.c @@ -0,0 +1,71 @@ +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalSetup(port,pin,direction) +// +// Parameters +// port : port of microcontroller to be used (1 for PORTA, 2 for PORTB,...) +// pin : pin of port (mentioned above) to be used +// direction : direction to be set for pin (0 for input, 1 for output) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalSetup(1,0,1) +// +// Authors +// Siddhesh Wani +// + +#include "AVRPeripheralGPIO.h" + + +uint8 u8AVRDigitalSetups(uint8 port,uint8 pin,uint8 direction) +{ + + if (direction == INPUT) + {/*Set pin as input*/ + if(port == PORT_A) + { + DDRA = DDRA & ~(1<<pin); + } + if(port == PORT_B) + { + DDRB = DDRB & ~(1<<pin); + } + if(port == PORT_C) + { + DDRC = DDRC & ~(1<<pin); + } + if(port == PORT_D) + { + DDRD = DDRD & ~(1<<pin); + } + } + else + {/*Set pin as output*/ + if(port == PORT_A) + { + DDRA = DDRA | (1<<pin); + } + if(port == PORT_B) + { + DDRB = DDRB | (1<<pin); + } + if(port == PORT_C) + { + DDRC = DDRC | (1<<pin); + } + if(port == PORT_D) + { + DDRD = DDRD | (1<<pin); + } + } +return 0; +} + diff --git a/2.3-1/src/c/hardware/avr/includes/AVRPeripheralADC.h b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralADC.h new file mode 100644 index 00000000..e343de63 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralADC.h @@ -0,0 +1,27 @@ +//This file defines constants corresponding to gpios and digital input functions. +// +// Authors +// Siddhesh Wani +// + +#ifndef __AVRPERIPHERALADC_H__ +#define __AVRPERIPHERALADC_H__ + +#include <avr/io.h> +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//Function prototypes +uint8 u8AVRADCSetups(uint8 prescalar, uint8 adc_ref); + +uint16 u8AVRReadADCs(uint8 channel); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/2.3-1/src/c/hardware/avr/includes/AVRPeripheralGPIO.h b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralGPIO.h new file mode 100644 index 00000000..ddbeb2d8 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/includes/AVRPeripheralGPIO.h @@ -0,0 +1,45 @@ +//This file defines constants corresponding to gpios and digital input functions. +// +// Authors +// Siddhesh Wani +// + +#ifndef __AVRPERIPHERALGPIO_H__ +#define __AVRPERIPHERALGPIO_H__ + +#include <avr/io.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +#include <avr/io.h> +#include "types.h" + +//Port definitions +#define PORT_A 1 +#define PORT_B 2 +#define PORT_C 3 +#define PORT_D 4 + +//Direction definitions +#define INPUT 0 +#define OUTPUT 1 + +//Pin state definitions +#define LOW 0 +#define HIGH 1 + +//Function prototypes +uint8 u8AVRDigitalSetups(uint8 port,uint8 pin,uint8 direction); + +uint8 u8AVRDigitalIns(uint8 port,uint8 pin); + +uint8 u8AVRDigitalOuts(uint8 port,uint8 pin,uint8 state); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h new file mode 100644 index 00000000..073f8a0c --- /dev/null +++ b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h @@ -0,0 +1,26 @@ +//This file defines constants corresponding to gpios. +// +// Authors +// Siddhesh Wani +// + +#ifndef __INT_AVRPERIPHERALADC_H__ +#define __INT_AVRPERIPHERALADC_H__ + +#include <avr/io.h> +#include "AVRPeripheralADC.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0AVRDigitalSetupu80(in1,in2) u8AVRADCSetups((uint8) in1,\ + (uint8) in2); + +#define d0AVRDigitalOutu160(in1) u8AVRReadADC((uint8) in1); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALADC_H__ */ diff --git a/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h new file mode 100644 index 00000000..88e4c635 --- /dev/null +++ b/2.3-1/src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h @@ -0,0 +1,30 @@ +//This file defines constants corresponding to gpios. +// +// Authors +// Siddhesh Wani +// + +#ifndef __INT_AVRPERIPHERALGPIO_H__ +#define __INT_AVRPERIPHERALGPIO_H__ + +#include <avr/io.h> +#include "AVRPeripheralGPIO.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define d0d0d0AVRDigitalSetupu80(in1,in2,in3) u8AVRDigitalSetups((uint8) in1,\ + (uint8) in2, (uint8) in3); + +#define d0d0AVRDigitalOutu80(in1,in2) u8AVRDigitalIns((uint8) in1,\ + (uint8) in2); + +#define d0d0d0AVRDigitalOutu80(in1,in2,in3) u8AVRDigitalOuts((uint8) in1,\ + (uint8) in2, (uint8) in3); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* !__AVRPERIPHERALGPIO_H__ */ diff --git a/2.3-1/src/c/operations/addition/i8adda.c b/2.3-1/src/c/operations/addition/i8adda.c new file mode 100644 index 00000000..2417bda7 --- /dev/null +++ b/2.3-1/src/c/operations/addition/i8adda.c @@ -0,0 +1,20 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "addition.h" + +void i8adda(int8* in1, int size1, int8* in2, int size2, int8* out) { + int i = 0; + for (i = 0; i < size1 && i < size2; ++i) { + out[i] = i8adds(in1[i], in2[i]); + } +} diff --git a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h index fdc1728d..4585f12a 100644 --- a/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h +++ b/2.3-1/src/c/scilab-arduino/interfaces/int_cmd_digital_out.h @@ -25,7 +25,7 @@ extern "C" { //Required when input from one pin is directed to other output pin. #define d0d0u80cmd_digital_outu80(in1,in2,in3) u8cmd_digital_outs((uint8)in1,\ - (uint8)in2, in3) + (uint8)in2, (uint8)in3) #ifdef __cplusplus diff --git a/2.3-1/unloader.sce b/2.3-1/unloader.sce new file mode 100644 index 00000000..a8bf1673 --- /dev/null +++ b/2.3-1/unloader.sce @@ -0,0 +1,14 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +// Generated by builder.sce: Please, do not edit this file + +try + getversion("scilab"); +catch + error("Scilab 5.4 or more is required."); +end; + +fileQuit = get_absolute_file_path("unloader.sce") + "etc/" + "scilab2c.quit"; +if isfile(fileQuit) then + exec(fileQuit); +end + |