diff --git a/modules/hisio/gen/inc/x86/Dio_Cfg_Arch.h.php b/modules/hisio/gen/inc/x86/Dio_Cfg_Arch.h.php new file mode 100755 index 00000000..35379933 --- /dev/null +++ b/modules/hisio/gen/inc/x86/Dio_Cfg_Arch.h.php @@ -0,0 +1,144 @@ +/******************************************************** + * DO NOT CHANGE THIS FILE, IT IS GENERATED AUTOMATICALY* + ********************************************************/ + +/* Copyright 2015, Mariano Cerdeiro + * Copyright 2016, Juan Cecconi + * All rights reserved. + * + * This file is part of CIAA Firmware. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of 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. + * + */ + +#ifndef DIO_CFG_ARCH_H +#define DIO_CFG_ARCH_H +/** \brief DIO Driver Configuration File Arch + ** + ** This file contains the DIO Driver configuration Arch + ** + **/ + +/** \addtogroup CIAA_Firmware CIAA Firmware + ** @{ */ +/** \addtogroup HISIO HisIO Module + ** @{ */ + +/* + * Initials Name + * --------------------------- + * MaCe Mariano Cerdeiro + * JuCe Juan Cecconi + */ + +/* + * modification history (new versions first) + * ----------------------------------------------------------- + * 20151222 v0.0.1 MaCe initial version + */ + +/*==================[inclusions]=============================================*/ +#include "ciaaPOSIX_stdint.h" + +/*==================[cplusplus]==============================================*/ +#ifdef __cplusplus +extern "C" { +#endif + +/*==================[macros]=================================================*/ + +getList("/DIL", "DIO"); +foreach ($dios as $count=>$dio) { + if ($count != 0) { + $this->error("Maximal one configuration is supported."); + } +?> +/** \brief DIO Configuration pointer + ** + ** \remarks At the moment only one configuration is supported, so the + ** parameter is set to null pointer. + ** + **/ +getList("/DIL/" . $dio, "PIN"); + + foreach($pins as $count=>$pin) { + $pin_port = $config->getValue("/DIL/" . $dio . "/" . $pin, "PORT"); + $pin_pin = $config->getValue("/DIL/" . $dio . "/" . $pin, "PIN"); + print "/** \brief Port: " . $pin_port . " Pin: " . $pin_pin . " called " . $pin . " */\n"; + print "#define " . $pin . " " . $count . "\n"; + } + print "\n"; + print "/** \brief Dio Pins count */\n"; + print "#define DIO_PINS_COUNT " . count($pins) . "U\n\n"; + + $ports = $config->getList("/DIL/" . $dio, "PORT"); + + foreach($ports as $count=>$port) { + $port_port = $config->getValue("/DIL/" . $dio . "/" . $port, "PORT"); + print "/** \brief Port: " . $port_port. " called " . $port . " */\n"; + print "#define " . $port . " " . $count . "\n"; + } +} +?> + +/*==================[typedef]================================================*/ +typedef struct { + uint8_t Port; + uint8_t Pin; + uint32_t Flags; /* Inverted, Direction, I/O, etc */ +} Dio_PinConfigType; + +typedef struct { + Dio_PinConfigType Pins[DIO_PINS_COUNT]; + uint8_t foo; +} Dio_ConfigType; + +/*==================[external data declaration]==============================*/ +/** \brief Dio Config struct + ** + ** Contents the Dio Config settings + **/ +$dio) { + print "/** \brief Configration of Dio Driver: " . $dio . " */\n"; + print "extern const Dio_ConfigType Dio_Config;\n"; +} +?> + +/*==================[external functions declaration]=========================*/ + +/*==================[cplusplus]==============================================*/ +#ifdef __cplusplus +} +#endif +/** @} doxygen end group definition */ +/** @} doxygen end group definition */ +/*==================[end of file]============================================*/ +#endif /* #ifndef DIO_CFG_ARCH_H */ diff --git a/modules/hisio/gen/src/x86/Dio_Cfg_Arch.c.php b/modules/hisio/gen/src/x86/Dio_Cfg_Arch.c.php new file mode 100755 index 00000000..6c243ddf --- /dev/null +++ b/modules/hisio/gen/src/x86/Dio_Cfg_Arch.c.php @@ -0,0 +1,140 @@ +/******************************************************** + * DO NOT CHANGE THIS FILE, IT IS GENERATED AUTOMATICALY* + ********************************************************/ + +/* Copyright 2016, Juan Cecconi + * All rights reserved. + * + * This file is part of CIAA Firmware. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of 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. + * + */ + +/** \brief DIO Driver Configuration File + ** + ** This file contains the DIO Driver configuration + ** + **/ + +/** \addtogroup CIAA_Firmware CIAA Firmware + ** @{ */ +/** \addtogroup HISIO HisIO Module + ** @{ */ + +/* + * Initials Name + * --------------------------- + * JuCe Juan Cecconi + */ + +/* + * modification history (new versions first) + * ----------------------------------------------------------- + * 20160110 v0.0.1 JuCe initial version + */ + +/*==================[inclusions]=============================================*/ +#include "Dio_Cfg.h" +#include "Dio_Cfg_Arch.h" + +/*==================[macros and definitions]=================================*/ + +/*==================[internal data declaration]==============================*/ + +/*==================[internal functions declaration]=========================*/ + +/*==================[internal data definition]===============================*/ + +/*==================[external data declaration]==============================*/ + +/*==================[external data definition]==============================*/ + +getList("/DIL", "DIO"); +foreach ($dios as $count=>$dio) { + if ($count != 0) { + $this->log->error("Maximal one configuration is supported."); + } + $pins = $config->getList("/DIL/" . $dio, "PIN"); + + print "const Dio_ConfigType Dio_Config = {\n"; + print "{\n"; + foreach($pins as $count=>$pin) { + $pin_port = $config->getValue("/DIL/" . $dio . "/" . $pin, "PORT"); + $pin_pin = $config->getValue("/DIL/" . $dio . "/" . $pin, "PIN"); + + $pin_direction = $config->getValue("/DIL/" . $dio . "/" . $pin, "DIRECTION"); + switch ($pin_direction) + { + case "OUTPUT_INIT_LOW": + $pin_flags = "DIO_CONFIG_PIN_DIRECTION_OUTPUT_INIT_LOW"; + break; + case "OUTPUT_INIT_HIGH": + $pin_flags = "DIO_CONFIG_PIN_DIRECTION_OUTPUT_INIT_HIGH"; + break; + default: + $this->log->error("The pin $pin hasn't a defined direction!"); + break; + } + $pin_inverted = $config->getValue("/DIL/" . $dio . "/" . $pin, "INVERTED"); + switch ($pin_inverted) + { + case "TRUE": + $pin_flags = $pin_flags . " | DIO_CONFIG_PIN_INVERTED"; + break; + case "FALSE": + break; + default: + $this->log->error("The pin $pin hasn't a defined 'inverted' configuration!"); + break; + } + print "/** \brief Port: " . $pin_port . " Pin: " . $pin_pin . " called " . $pin . " */\n"; + print "{ " . $pin_port . ", " . $pin_pin . ", (" . $pin_flags . ")},\n"; + } + print "}\n"; + print ", 0 /* foo var */\n"; + print "};\n"; +} +?> + +/*==================[external functions declaration]=========================*/ + +/*==================[internal functions definition]==========================*/ + +/*==================[external functions definition]==========================*/ + +/** @} doxygen end group definition */ +/** @} doxygen end group definition */ +/*==================[end of file]============================================*/ + diff --git a/modules/hisio/mak/Makefile b/modules/hisio/mak/Makefile index 3530ad1b..01361168 100644 --- a/modules/hisio/mak/Makefile +++ b/modules/hisio/mak/Makefile @@ -46,6 +46,7 @@ hisio_INC_PATH = $(hisio_PATH)$(DS)inc $(hisio_PATH)$(DS)inc$(DS)$(ARCH)$(DS)$(CPUTYPE) \ $(hisio_PATH)$(DS)inc$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU) \ $(GEN_DIR)$(DS)inc \ + $(GEN_DIR)$(DS)inc$(DS)$(ARCH) \ $(GEN_DIR)$(DS)inc$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU) # library source files @@ -58,6 +59,8 @@ hisio_SRC_FILES = $(wildcard $(hisio_SRC_PATH)$(DS)*.c) # files to be generated # TODO see https://github.com/ciaa/Firmware/issues/277 -rtos_GEN_FILES += $(hisio_PATH)$(DS)gen$(DS)inc$(DS)IODriver_Cfg.h.php \ - $(hisio_PATH)$(DS)gen$(DS)inc$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU)$(DS)Dio_Cfg_Arch.h.php \ - $(hisio_PATH)$(DS)gen$(DS)src$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU)$(DS)Dio_Cfg_Arch.c.php +rtos_GEN_FILES += $(wildcard $(hisio_PATH)$(DS)gen$(DS)inc$(DS)*.php) \ + $(wildcard $(hisio_PATH)$(DS)gen$(DS)inc$(DS)$(ARCH)$(DS)*.php) \ + $(wildcard $(hisio_PATH)$(DS)gen$(DS)src$(DS)$(ARCH)$(DS)*.php) \ + $(wildcard $(hisio_PATH)$(DS)gen$(DS)inc$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU)$(DS)*.php) \ + $(wildcard $(hisio_PATH)$(DS)gen$(DS)src$(DS)$(ARCH)$(DS)$(CPUTYPE)$(DS)$(CPU)$(DS)*.php) diff --git a/modules/hisio/src/cortexM4/lpc43xx/lpc4337/Dio_Arch.c b/modules/hisio/src/cortexM4/lpc43xx/lpc4337/Dio_Arch.c index 305f4504..d0731b1f 100755 --- a/modules/hisio/src/cortexM4/lpc43xx/lpc4337/Dio_Arch.c +++ b/modules/hisio/src/cortexM4/lpc43xx/lpc4337/Dio_Arch.c @@ -34,7 +34,7 @@ /** \brief IO DIO Driver Arch source file ** - ** This file contains is the Dio driver Arch + ** This file contains is the Dio driver Arch CortexM4\lpc43xx\lpc4337 ** **/ @@ -149,4 +149,3 @@ extern void Dio_SetPortMaskedSync_Arch(IO_ChannelType channel, IO_ValueType valu /** @} doxygen end group definition */ /** @} doxygen end group definition */ /*==================[end of file]============================================*/ - diff --git a/modules/hisio/src/x86/Dio_Arch.c b/modules/hisio/src/x86/Dio_Arch.c new file mode 100755 index 00000000..ed117570 --- /dev/null +++ b/modules/hisio/src/x86/Dio_Arch.c @@ -0,0 +1,108 @@ +/* Copyright 2015, Mariano Cerdeiro + * Copyright 2016, Juan Cecconi + * All rights reserved. + * + * This file is part of CIAA Firmware. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of 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. + * + */ + +/** \brief IO DIO Driver Arch source file + ** + ** This file contains is the Dio driver Arch x86 + ** + **/ + +/** \addtogroup CIAA_Firmware CIAA Firmware + ** @{ */ +/** \addtogroup HISIO HisIO Module + ** @{ */ + +/* + * Initials Name + * --------------------------- + * MaCe Mariano Cerdeiro + * JuCe Juan Cecconi + */ + +/* + * modification history (new versions first) + * ----------------------------------------------------------- + * 20160111 v0.0.1 JuCe initial version + */ + +/*==================[inclusions]=============================================*/ +#include "IODriver_Base.h" +#include "Dio_Cfg.h" + +/*==================[macros and definitions]=================================*/ + +/*==================[internal data declaration]==============================*/ + +/*==================[internal functions declaration]=========================*/ + +/*==================[internal data definition]===============================*/ + +/*==================[external data definition]===============================*/ + +/*==================[internal functions definition]==========================*/ + +/*==================[external functions definition]==========================*/ +extern IO_ErrorType Dio_InitSync_Arch(void * address) +{ + return IO_E_OK; +} + +extern IO_ValueType Dio_GetSync_Arch(IO_ChannelType channel) +{ + return IO_LOW; +} + +extern void Dio_SetSync_Arch(IO_ChannelType channel, IO_ValueType value) +{ + +} + +extern IO_ValueType Dio_GetPortSync_Arch(IO_ChannelType channel) +{ + return 0xFF; +} + +extern void Dio_SetPortSync_Arch(IO_ChannelType channel, IO_ValueType value) +{ + +} + +extern void Dio_SetPortMaskedSync_Arch(IO_ChannelType channel, IO_ValueType value, IO_ValueType mask) +{ + +} + +/** @} doxygen end group definition */ +/** @} doxygen end group definition */ +/*==================[end of file]============================================*/