├── ECUHost Atmel Kernel.atsln ├── ECUHost Atmel Kernel ├── API │ ├── ADCAPI.h │ ├── CEMAPI.h │ ├── CTRLAPI.h │ ├── DACAPI.h │ ├── DIAGAPI.h │ ├── IICAPI.h │ ├── IOAPI.h │ ├── MAPSAPI.h │ ├── PIMAPI.h │ ├── PROTAPI.h │ ├── RESAPI.h │ ├── SPREADSAPI.h │ ├── SYSAPI.h │ ├── TABLESAPI.h │ ├── TASKAPI.h │ └── TEPMAPI.h ├── Client │ ├── 2NR_FE_CAL.h │ ├── AFM.c │ ├── AFM.h │ ├── ATS.c │ ├── ATS.h │ ├── BOOSTED.c │ ├── BOOSTED.h │ ├── BVM.c │ ├── BVM.h │ ├── C18_CAL.h │ ├── CAM.c │ ├── CAM.h │ ├── CLO2.c │ ├── CLO2.h │ ├── CONV.c │ ├── CONV.h │ ├── CTS.c │ ├── CTS.h │ ├── EST.c │ ├── EST.h │ ├── FILM.c │ ├── FILM.h │ ├── FUEL.c │ ├── FUEL.h │ ├── GENDATA.c │ ├── GENDATA.h │ ├── IAC.c │ ├── IAC.h │ ├── LSU4X.c │ ├── LSU4X.h │ ├── LSUH.c │ ├── LSUH.h │ ├── MAP.c │ ├── MAP.h │ ├── MCP23S08.c │ ├── MCP23S08.h │ ├── RELAYS.c │ ├── RELAYS.h │ ├── SENSORS.c │ ├── SENSORS.h │ ├── SETUP.c │ ├── SETUP.h │ ├── TPS.c │ ├── TPS.h │ ├── UNITS.c │ ├── USER.c │ ├── USERCAL.c │ ├── USERMAIN.c │ ├── USERMATH.c │ ├── USERMATH.h │ ├── diag.c │ ├── diag.h │ ├── units.h │ ├── user.h │ └── usercal.h ├── Device_Startup │ ├── sam3x8e_flash.ld │ ├── sam3x8e_sram.ld │ ├── sam3xa_flash.ld │ ├── sam3xa_sram.ld │ ├── startup_sam3xa.c │ └── system_sam3xa.c ├── ECUHost Atmel Kernel.componentinfo.xml ├── ECUHost Atmel Kernel.cproj ├── ECUHostEFI.c ├── GenericDrivers │ └── include │ │ ├── diskio.h │ │ ├── ff.h │ │ └── ffconf.h ├── KernelServices │ ├── DISK.c │ ├── DISK.h │ ├── DLL.c │ ├── DLL.h │ ├── DSCRIO.c │ ├── DSCRIO.h │ ├── DSCRIOHA.c │ ├── DSCRIOHA.h │ ├── KERNELDIAG.c │ ├── KERNELDIAG.h │ ├── KERNELIO.c │ ├── KERNELIO.h │ ├── PACKEDDLL.c │ ├── PACKEDDLL.h │ ├── PIM.c │ ├── PIM.h │ ├── PIMHA.c │ ├── PIMHA.h │ ├── PIT.c │ ├── PIT.h │ ├── SIM.c │ ├── SIM.h │ ├── SIMHA.c │ ├── SIMHA.h │ ├── WIFI.c │ ├── WIFI.h │ ├── cbytequeue.h │ ├── commonNL.h │ ├── regset.c │ ├── regset.h │ ├── resm.c │ ├── resm.h │ ├── timer.c │ ├── timer.h │ ├── tqueue.c │ ├── tqueue.h │ └── tqueueHA.c ├── OS.c ├── OS │ ├── CLIENT.h │ ├── MSG.c │ ├── MSG.h │ ├── OS.h │ ├── OSHA.h │ ├── OSTASKS.h │ ├── client.c │ ├── stack.c │ ├── stack.h │ ├── task.c │ ├── task.h │ ├── thread.c │ ├── thread.h │ ├── tqueue.c │ ├── tqueue.h │ ├── tqueueHA.c │ └── tqueueHA.h ├── OSHA.c ├── Peripherals │ ├── ADCHA.c │ ├── ADCHA.h │ ├── CANHA.c │ ├── CANHA.h │ ├── CRC16.c │ ├── CRC16.h │ ├── CRC16HA.c │ ├── CRC16HA.h │ ├── DAC.c │ ├── DAC.h │ ├── DACHA.c │ ├── DACHA.h │ ├── ENE.c │ ├── ENE.h │ ├── ENEHA.c │ ├── ENEHA.h │ ├── FEE.c │ ├── FEE.h │ ├── FEEHA.c │ ├── FEEHA.h │ ├── FLASHHA.c │ ├── FLASHHA.h │ ├── IIC.c │ ├── IIC.h │ ├── IICHA.c │ ├── IICHA.h │ ├── PERADC.c │ ├── PERCAN.c │ ├── PERCAN.h │ ├── PERSPI.c │ ├── PERSPI.h │ ├── PERUART.c │ ├── PERUART.h │ ├── PERUSB.c │ ├── PERUSB.h │ ├── PERWDT.c │ ├── PERWDT.h │ ├── SDHC.c │ ├── SDHC.h │ ├── SDHCHA.c │ ├── SDHCHA.h │ ├── SPIHA.c │ ├── SPIHA.h │ ├── SRLTFR.c │ ├── SRLTFR.h │ ├── UARTHA.c │ ├── UARTHA.h │ ├── USBHA.c │ ├── USBHA.h │ ├── WDTHA.c │ ├── WDTHA.h │ ├── WIFI.c │ ├── WIFI.h │ ├── peradc.h │ ├── time.c │ └── time.h ├── README.txt ├── Suites │ └── UDS │ │ ├── UDSAL.c │ │ ├── UDSNL.c │ │ ├── UDSSL.c │ │ └── include │ │ ├── UDSAL.h │ │ ├── UDSNL.h │ │ └── UDSSL.h ├── Support │ ├── MATH.c │ ├── MATH.h │ ├── build.h │ ├── cqueue.h │ ├── declarations.h │ └── macros.h ├── System │ ├── CPUAbstract.c │ ├── CPUAbstract.h │ ├── IRQ.c │ ├── IRQ.h │ ├── IRQHA.c │ ├── IRQHA.h │ ├── SYSAPI.c │ ├── SYSAbstract.h │ ├── sys.h │ └── types.h ├── UserServices │ ├── CEM.c │ ├── CEM.h │ ├── CTRL.c │ ├── CTRL.h │ ├── TEPM.c │ ├── TEPM.h │ ├── TEPMHA.c │ ├── TEPMHA.h │ ├── maps.c │ ├── maps.h │ ├── spreads.c │ ├── spreads.h │ ├── tables.c │ └── tables.h ├── atmel_devices_cdc.cat ├── atmel_devices_cdc.inf ├── main.c └── src │ ├── ASF │ ├── common │ │ ├── boards │ │ │ └── board.h │ │ ├── services │ │ │ ├── clock │ │ │ │ ├── genclk.h │ │ │ │ ├── osc.h │ │ │ │ ├── pll.h │ │ │ │ ├── sam3x │ │ │ │ │ ├── genclk.h │ │ │ │ │ ├── osc.h │ │ │ │ │ ├── pll.h │ │ │ │ │ ├── sysclk.c │ │ │ │ │ └── sysclk.h │ │ │ │ └── sysclk.h │ │ │ ├── gpio │ │ │ │ ├── gpio.h │ │ │ │ └── sam_gpio │ │ │ │ │ └── sam_gpio.h │ │ │ ├── ioport │ │ │ │ ├── ioport.h │ │ │ │ └── sam │ │ │ │ │ └── ioport_pio.h │ │ │ ├── serial │ │ │ │ ├── sam_uart │ │ │ │ │ └── uart_serial.h │ │ │ │ ├── serial.h │ │ │ │ └── usart_serial.c │ │ │ ├── sleepmgr │ │ │ │ ├── sam │ │ │ │ │ ├── sleepmgr.c │ │ │ │ │ └── sleepmgr.h │ │ │ │ └── sleepmgr.h │ │ │ └── usb │ │ │ │ ├── class │ │ │ │ └── cdc │ │ │ │ │ ├── device │ │ │ │ │ ├── udi_cdc.c │ │ │ │ │ ├── udi_cdc.c.bak │ │ │ │ │ ├── udi_cdc.h │ │ │ │ │ ├── udi_cdc_conf.h │ │ │ │ │ └── udi_cdc_desc.c │ │ │ │ │ └── usb_protocol_cdc.h │ │ │ │ ├── udc │ │ │ │ ├── udc.c │ │ │ │ ├── udc.h │ │ │ │ ├── udc_desc.h │ │ │ │ ├── udd.h │ │ │ │ └── udi.h │ │ │ │ ├── usb_atmel.h │ │ │ │ └── usb_protocol.h │ │ └── utils │ │ │ ├── interrupt.h │ │ │ ├── interrupt │ │ │ ├── interrupt_sam_nvic.c │ │ │ └── interrupt_sam_nvic.h │ │ │ ├── parts.h │ │ │ └── stdio │ │ │ ├── read.c │ │ │ ├── stdio_serial │ │ │ └── stdio_serial.h │ │ │ └── write.c │ ├── sam │ │ ├── boards │ │ │ └── arduino_due_x │ │ │ │ ├── arduino_due_x.h │ │ │ │ └── init.c │ │ ├── drivers │ │ │ ├── adc │ │ │ │ ├── adc.c │ │ │ │ ├── adc.h │ │ │ │ └── adc_sam3u.c │ │ │ ├── can │ │ │ │ ├── can.c │ │ │ │ └── can.h │ │ │ ├── efc │ │ │ │ ├── efc.c │ │ │ │ └── efc.h │ │ │ ├── pio │ │ │ │ ├── pio.c │ │ │ │ ├── pio.h │ │ │ │ ├── pio_handler.c │ │ │ │ └── pio_handler.h │ │ │ ├── pmc │ │ │ │ ├── pmc.c │ │ │ │ ├── pmc.h │ │ │ │ ├── sleep.c │ │ │ │ └── sleep.h │ │ │ ├── pwm │ │ │ │ ├── pwm.c │ │ │ │ └── pwm.h │ │ │ ├── spi │ │ │ │ ├── spi.c │ │ │ │ └── spi.h │ │ │ ├── tc │ │ │ │ ├── tc.c │ │ │ │ └── tc.h │ │ │ ├── uart │ │ │ │ ├── uart.c │ │ │ │ └── uart.h │ │ │ ├── uotghs │ │ │ │ ├── uotghs_device.c │ │ │ │ ├── uotghs_device.h │ │ │ │ └── uotghs_otg.h │ │ │ ├── usart │ │ │ │ ├── usart.c │ │ │ │ └── usart.h │ │ │ └── wdt │ │ │ │ ├── wdt.c │ │ │ │ └── wdt.h │ │ └── utils │ │ │ ├── cmsis │ │ │ └── sam3x │ │ │ │ ├── include │ │ │ │ ├── component │ │ │ │ │ ├── component_adc.h │ │ │ │ │ ├── component_can.h │ │ │ │ │ ├── component_chipid.h │ │ │ │ │ ├── component_dacc.h │ │ │ │ │ ├── component_dmac.h │ │ │ │ │ ├── component_efc.h │ │ │ │ │ ├── component_emac.h │ │ │ │ │ ├── component_gpbr.h │ │ │ │ │ ├── component_hsmci.h │ │ │ │ │ ├── component_matrix.h │ │ │ │ │ ├── component_pdc.h │ │ │ │ │ ├── component_pio.h │ │ │ │ │ ├── component_pmc.h │ │ │ │ │ ├── component_pwm.h │ │ │ │ │ ├── component_rstc.h │ │ │ │ │ ├── component_rtc.h │ │ │ │ │ ├── component_rtt.h │ │ │ │ │ ├── component_sdramc.h │ │ │ │ │ ├── component_smc.h │ │ │ │ │ ├── component_spi.h │ │ │ │ │ ├── component_ssc.h │ │ │ │ │ ├── component_supc.h │ │ │ │ │ ├── component_tc.h │ │ │ │ │ ├── component_trng.h │ │ │ │ │ ├── component_twi.h │ │ │ │ │ ├── component_uart.h │ │ │ │ │ ├── component_uotghs.h │ │ │ │ │ ├── component_usart.h │ │ │ │ │ └── component_wdt.h │ │ │ │ ├── instance │ │ │ │ │ ├── instance_adc.h │ │ │ │ │ ├── instance_can0.h │ │ │ │ │ ├── instance_can1.h │ │ │ │ │ ├── instance_chipid.h │ │ │ │ │ ├── instance_dacc.h │ │ │ │ │ ├── instance_dmac.h │ │ │ │ │ ├── instance_efc0.h │ │ │ │ │ ├── instance_efc1.h │ │ │ │ │ ├── instance_emac.h │ │ │ │ │ ├── instance_gpbr.h │ │ │ │ │ ├── instance_hsmci.h │ │ │ │ │ ├── instance_matrix.h │ │ │ │ │ ├── instance_pioa.h │ │ │ │ │ ├── instance_piob.h │ │ │ │ │ ├── instance_pioc.h │ │ │ │ │ ├── instance_piod.h │ │ │ │ │ ├── instance_pioe.h │ │ │ │ │ ├── instance_piof.h │ │ │ │ │ ├── instance_pmc.h │ │ │ │ │ ├── instance_pwm.h │ │ │ │ │ ├── instance_rstc.h │ │ │ │ │ ├── instance_rtc.h │ │ │ │ │ ├── instance_rtt.h │ │ │ │ │ ├── instance_sdramc.h │ │ │ │ │ ├── instance_smc.h │ │ │ │ │ ├── instance_spi0.h │ │ │ │ │ ├── instance_spi1.h │ │ │ │ │ ├── instance_ssc.h │ │ │ │ │ ├── instance_supc.h │ │ │ │ │ ├── instance_tc0.h │ │ │ │ │ ├── instance_tc1.h │ │ │ │ │ ├── instance_tc2.h │ │ │ │ │ ├── instance_trng.h │ │ │ │ │ ├── instance_twi0.h │ │ │ │ │ ├── instance_twi1.h │ │ │ │ │ ├── instance_uart.h │ │ │ │ │ ├── instance_uotghs.h │ │ │ │ │ ├── instance_usart0.h │ │ │ │ │ ├── instance_usart1.h │ │ │ │ │ ├── instance_usart2.h │ │ │ │ │ ├── instance_usart3.h │ │ │ │ │ └── instance_wdt.h │ │ │ │ ├── pio │ │ │ │ │ ├── pio_sam3x8e.h │ │ │ │ │ └── pio_sam3x8h.h │ │ │ │ └── sam3x8e.h │ │ │ │ └── source │ │ │ │ └── templates │ │ │ │ ├── desktop.ini │ │ │ │ ├── exceptions.c │ │ │ │ ├── exceptions.h │ │ │ │ ├── gcc │ │ │ │ └── startup_sam3x.c │ │ │ │ ├── system_sam3x.c │ │ │ │ └── system_sam3x.h │ │ │ ├── compiler.h │ │ │ ├── header_files │ │ │ └── io.h │ │ │ ├── linker_scripts │ │ │ └── sam3x │ │ │ │ └── sam3x8 │ │ │ │ └── gcc │ │ │ │ └── flash.ld │ │ │ ├── make │ │ │ └── Makefile.sam.in │ │ │ ├── preprocessor │ │ │ ├── mrepeat.h │ │ │ ├── preprocessor.h │ │ │ ├── stringz.h │ │ │ └── tpaste.h │ │ │ ├── status_codes.h │ │ │ └── syscalls │ │ │ └── gcc │ │ │ └── syscalls.c │ └── thirdparty │ │ ├── CMSIS │ │ ├── ATMEL-disclaimer.txt │ │ ├── CMSIS_END_USER_LICENCE_AGREEMENT.pdf │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_const_structs.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cmFunc.h │ │ │ └── core_cmInstr.h │ │ ├── Lib │ │ │ ├── GCC │ │ │ │ └── libarm_cortexM3l_math.a │ │ │ └── license.txt │ │ └── README.txt │ │ └── wireless │ │ └── addons │ │ └── sio2host │ │ └── uart │ │ ├── sio2host.c │ │ └── sio2host.h │ ├── asf.h │ ├── config │ ├── conf_board.h │ ├── conf_clock.h │ ├── conf_sio2host.h │ ├── conf_sleepmgr.h │ ├── conf_uart_serial.h │ └── conf_usb.h │ └── main.c └── README.md /ECUHost Atmel Kernel.atsln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "ECUHost Atmel Kernel", "ECUHost Atmel Kernel\ECUHost Atmel Kernel.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Release|ARM = Release|ARM 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.ActiveCfg = Debug|ARM 15 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.Build.0 = Debug|ARM 16 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.ActiveCfg = Release|ARM 17 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.Build.0 = Release|ARM 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/ADCAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: ADCAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed AD conversion */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: ADCAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef ADCAPI_H 16 | #define ADCAPI_H 17 | 18 | #include "types.h" 19 | #include "IOAPI.h" 20 | 21 | 22 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 23 | typedef void (*ADCAPI_tpfResultCB)(IOAPI_tenEHIOResource, uint32);/*CR1_83*/ 24 | 25 | typedef enum 26 | { 27 | ADCAPI_en1Sample, 28 | ADCAPI_en4Samples, 29 | ADCAPI_en8Samples, 30 | ADCAPI_en16Samples, 31 | ADCAPI_en32Samples 32 | } ADCAPI_tenSamplesAv; 33 | 34 | typedef enum 35 | { 36 | ADCAPI_enDiffGain1, 37 | ADCAPI_enDiffGain2, 38 | ADCAPI_enDiffGain4, 39 | ADCAPI_enDiffGain8, 40 | ADCAPI_enDiffGain16, 41 | ADCAPI_enDiffGain32, 42 | ADCAPI_enDiffGain64 43 | } ADCAPI_tenDiffGain; 44 | 45 | typedef enum 46 | { 47 | ADCAPI_en1000Hz = 0, 48 | ADCAPI_en500Hz = 1, 49 | ADCAPI_en250Hz = 2, 50 | ADCAPI_en125Hz = 3, 51 | ADCAPI_en64Hz = 4, 52 | ADCAPI_en32Hz = 5, 53 | ADCAPI_en16Hz = 6, 54 | ADCAPI_en8Hz = 7, 55 | ADCAPI_en4Hz = 8, 56 | ADCAPI_en2Hz = 9, 57 | ADCAPI_en1Hz = 10, 58 | ADCAPI_enTrigger1 = 11, 59 | ADCAPI_enTrigger2 = 12, 60 | ADCAPI_enTrigger3 = 13, 61 | ADCAPI_enTrigger4 = 14, 62 | ADCAPI_enTriggerCount 63 | } ADCAPI_tenTrigger; 64 | 65 | typedef struct 66 | { 67 | ADCAPI_tenSamplesAv enSamplesAv; 68 | ADCAPI_tenDiffGain enDiffGain; 69 | ADCAPI_tpfResultCB pfResultCB; 70 | ADCAPI_tenTrigger enTrigger; 71 | } ADCAPI_tstADCCB; 72 | 73 | 74 | #endif //ADCAPI_H 75 | 76 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/CEMAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: CEMAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel Cyclic Event Manager */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: CEMAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef CEMAPI_H 16 | #define CEMAPI_H 17 | 18 | 19 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 20 | 21 | 22 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 23 | typedef uint16 CEMAPI_ttEventTime; 24 | typedef void (*CEMAPI_tpfEventCB)(IOAPI_tenEHIOResource, CEMAPI_ttEventTime); 25 | 26 | typedef enum 27 | { 28 | CEMAPI_enHardwareRising, 29 | CEMAPI_enHardwareFalling, 30 | CEMAPI_enHardwareAny 31 | } CEMAPI_tenEventTrigger; 32 | 33 | typedef struct 34 | { 35 | uint32 u32TriggerType; 36 | IOAPI_tenEdgePolarity enEdgePolarity; 37 | Bool boFirstEdgeRising; 38 | } CEM_tstPatternSetupCB; 39 | 40 | typedef struct 41 | { 42 | uint32 u32CycleDuration; 43 | puint32 pu32EventProgram; 44 | puint32 pu32CallbackProgram; 45 | IOAPI_tenEHIOResource enIOHardwareTrigger; 46 | } IOAPI_tenCEMCycleCB; 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | #endif //CEMAPI_H 59 | 60 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/CTRLAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: CtrlAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed controllers */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: CtrlAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef CTRLAPI_H 16 | #define CTRLAPI_H 17 | 18 | #include "types.h" 19 | 20 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 21 | typedef void (*CTRLAPI_pfPIDResultCB)(uint32); 22 | typedef sint16 CTRLAPI_ttPIDIDX;/*CR1_95*/ 23 | 24 | typedef enum 25 | { 26 | CTRLAPI_enPID, 27 | CTRLAPI_enFIC 28 | } CTRLAPI_tenCTRLType; 29 | 30 | typedef enum 31 | { 32 | CTRLAPI_enPID1ms = 0, 33 | CTRLAPI_enPID2ms = 1, 34 | CTRLAPI_enPID4ms = 2, 35 | CTRLAPI_enPID8ms = 3, 36 | CTRLAPI_enPID16ms = 4, 37 | CTRLAPI_enPID32ms = 5, 38 | CTRLAPI_enPID64ms = 6, 39 | CTRLAPI_enPID128ms = 7, 40 | CTRLAPI_enPID256ms = 8, 41 | CTRLAPI_enPID512ms = 9, 42 | CTRLAPI_enPID1024ms = 10, 43 | CTRLAPI_enPIDCall = 11, 44 | } CTRLAPI_tenPIDRate; 45 | 46 | 47 | typedef struct 48 | { 49 | sint32* pi32Target; 50 | sint32* pi32Feedback; 51 | sint32 i32Error; 52 | sint32 i32OldError; 53 | sint32 i32Integral; 54 | sint32 i32IntegralInput; 55 | uint8 u8PTerm; 56 | uint8 u8ITerm; 57 | uint8 u8DTerm; 58 | sint32* pi32Output; 59 | sint32 i32OutputMin; 60 | sint32 i32OutputMax; 61 | Bool boNoWindUp; 62 | Bool boResetIntegrator; 63 | Bool boRun; 64 | Bool boReset; 65 | CTRLAPI_tenPIDRate enPIDRate; 66 | CTRLAPI_pfPIDResultCB pfResultCB; 67 | } CTRLAPI_tstPIDCB; 68 | 69 | 70 | #endif //CTRLAPI_H 71 | 72 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/DIAGAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: DiagAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed diagnostics */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: DiagAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef DIAGAPI_H 16 | #define DIAGAPI_H 17 | 18 | #include "types.h" 19 | 20 | 21 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 22 | typedef enum 23 | { 24 | DIAGAPI_enNoSession, 25 | DIAGAPI_enDefaultSession, 26 | DIAGAPI_enExtendedSession, 27 | DIAGAPI_enProgrammingSession 28 | } DIAGAPI_tenSession; 29 | 30 | typedef enum 31 | { 32 | DIAGAPI_enSecLevelInactive, 33 | DIAGAPI_enSecLevelOEM, 34 | DIAGAPI_enSecLevelMDAC 35 | } DIAGAPI_tenDiagSecurityLevel; 36 | 37 | typedef enum 38 | { 39 | DIAGAPI_enStartRoutine, 40 | DIAGAPI_enStopRoutine, 41 | DIAGAPI_enResultsRoutine 42 | } DIAGAPI_tenRoutineAction; 43 | 44 | typedef struct 45 | { 46 | Bool boTransferComplete; 47 | uint16 u16CID; 48 | puint8 pu8Data; 49 | uint8 u8DataCount; 50 | } DIAGAPI_tstDataTransferCB; 51 | 52 | typedef enum 53 | { 54 | DIAGAPI_enDataWriteCB, 55 | DIAGAPI_enDataReadCB, 56 | DIAGAPI_enRoutineCB 57 | } DIAGAPI_tenCallBackType; 58 | 59 | typedef enum 60 | { 61 | DIAGAPI_enCBOK, 62 | DIAGAPI_enRWSecurityError, 63 | DIAGAPI_enRWParamNotFound, 64 | DIAGAPI_enRWGenFail 65 | } DIAGAPI_tenCBResult; 66 | 67 | 68 | typedef DIAGAPI_tenCBResult (*DIAGAPI_tDataWriteCB)(uint16, puint8, uint8); 69 | typedef DIAGAPI_tenCBResult (*DIAGAPI_tReadWriteCB)(uint16, puint8, uint8); 70 | typedef DIAGAPI_tenCBResult (*DIAGAPI_tRoutineCB)(DIAGAPI_tenRoutineAction, puint8, uint8); 71 | 72 | #endif //DIAGAPI_H 73 | 74 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/IICAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: IICAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed IIC resources */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: IICAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef IICAPI_H 16 | #define IICAPI_H 17 | 18 | 19 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 20 | typedef struct 21 | { 22 | uint32 u32BaudRateHz; 23 | uint8 u8SlaveAddress; 24 | } IICAPI_tstIICConfig; 25 | 26 | 27 | #endif //IICAPI_H 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/MAPSAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: MapsAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed maps */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: MapsAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef MAPSAPI_H 16 | #define MAPSAPI_H 17 | 18 | #include "types.h" 19 | #include "SPREADSAPI.h" 20 | 21 | 22 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 23 | typedef sint16 MAPSAPI_ttMapIDX;/*CR1_118*/ 24 | typedef void (*MAPSAPI_pfPIDResultCB)(sint32); 25 | 26 | #pragma GCC diagnostic push 27 | #pragma GCC diagnostic ignored "-Wattributes" 28 | 29 | typedef struct 30 | { 31 | void* pvMapData; 32 | void* pvOutputData; 33 | TYPE_tenDataType enDataType; 34 | sint16 i16MapSizeX; 35 | sint16 i16MapSizeY; 36 | SPREADAPI_ttSpreadIDX tSpreadIDXX; 37 | SPREADAPI_ttSpreadIDX tSpreadIDXY; 38 | MAPSAPI_pfPIDResultCB pfResultCB; 39 | } MAPSAPI_tstMapCB; 40 | 41 | #pragma GCC diagnostic pop 42 | 43 | #endif //MAPSAPI_H 44 | 45 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/PROTAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: ProtAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed protocol */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: ProtAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef PROTAPI_H 16 | #define PROTAPI_H 17 | 18 | #include "sys.h" 19 | 20 | 21 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 22 | typedef enum 23 | { 24 | PROTAPI_enTLKWP, 25 | PROTAPI_enTLUDS, 26 | PROTAPI_enTLUDS_UDP, 27 | PROTAPI_enTLJ1939, 28 | PROTAPI_enTLUDP, 29 | PROTAPI_enTLNone 30 | } PROTAPI_tenTLProtocol; 31 | /*CR1_109*/ 32 | 33 | typedef enum 34 | { 35 | PROTAPI_enISO15765, 36 | PROTAPI_enISO15765_IP, 37 | PROTAPI_enNLNone 38 | } PROTAPI_tenNLProtocol; 39 | /*CR1_109*/ 40 | 41 | typedef enum 42 | { 43 | PROTAPI_enLLUARTPacked, 44 | PROTAPI_enLLUARTSZDelim, 45 | PROTAPI_enLLCAN11, 46 | PROTAPI_enLLCAN29, 47 | PROTAPI_enLL802_3, 48 | PROTAPI_enUSB2, 49 | PROTAPI_enLLNone 50 | } PROTAPI_tenLLProtocol; 51 | /*CR1_109*/ 52 | 53 | typedef struct 54 | { 55 | uint8 u8DLC; 56 | uint32 u32ID; 57 | uint32 u32DWH; 58 | uint32 u32DWL; 59 | } PROTAPI_tstCANMsg; 60 | 61 | #endif //PROTAPI_H 62 | 63 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/RESAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: ResourceAPI */ 7 | /* DESCRIPTION: This API provides type definitions for off micro */ 8 | /* resources */ 9 | /* */ 10 | /* */ 11 | /* FILE NAME: SpreadsAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #include "sys.h" 16 | 17 | 18 | #ifndef RESAPI_H 19 | #define RESAPI_H 20 | 21 | #include "types.h" 22 | 23 | typedef enum 24 | { 25 | SDHC_MEM, 26 | SPI_MEM, 27 | RES_Count 28 | } RES_tenResource; 29 | 30 | #endif //RESM_H 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/SPREADSAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: SpreadsAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed spreads */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: SpreadsAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef SPREADSAPI_H 16 | #define SPREADSAPI_H 17 | 18 | #include "types.h" 19 | 20 | 21 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 22 | typedef sint16 SPREADAPI_ttSpreadIDX;/*CR1_111*/ 23 | 24 | typedef struct 25 | { 26 | uint16 u16SpreadIndex; 27 | uint16 u16SpreadOffset; 28 | } tstSpreadResult; 29 | 30 | typedef struct 31 | { 32 | union 33 | { 34 | tstSpreadResult stSpreadResult; 35 | uint32 u32Data; 36 | } uSpreadData; 37 | } SPREADAPI_tstSpreadResult; 38 | 39 | typedef void (*SPREADAPI_pfPIDResultCB)(SPREADAPI_tstSpreadResult); 40 | 41 | typedef enum 42 | { 43 | SPREADAPI_enSpread1ms = 0, 44 | SPREADAPI_enSpread2ms = 1, 45 | SPREADAPI_enSpread4ms = 2, 46 | SPREADAPI_enSpread8ms = 3, 47 | SPREADAPI_enSpread16ms = 4, 48 | SPREADAPI_enSpread32ms = 5, 49 | SPREADAPI_enSpread64ms = 6, 50 | SPREADAPI_enSpread128ms = 7, 51 | SPREADAPI_enSpread256ms = 8, 52 | SPREADAPI_enSpread512ms = 9, 53 | SPREADAPI_enSpread1024ms = 10, 54 | SPREADAPI_enSpreadCall = 11, 55 | } SPREADAPI_tenSpreadRate; 56 | 57 | typedef struct 58 | { 59 | void* pvSourceData; 60 | void* pvSpreadData; 61 | TYPE_tenDataType enDataType; 62 | sint16 s16SpreadSize; 63 | SPREADAPI_tenSpreadRate enSpreadRate; 64 | SPREADAPI_pfPIDResultCB pfResultCB; 65 | } SPREADAPI_tstSpreadCB; 66 | 67 | #endif //SPREADSAPI_H 68 | 69 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/TABLESAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: TablesAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed tables */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: TablesAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef TABLESAPI_H 16 | #define TABLESAPI_H 17 | 18 | #include "types.h" 19 | #include "SPREADSAPI.h" 20 | 21 | 22 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 23 | typedef sint16 TABLEAPI_ttTableIDX;/*CR1_118*/ 24 | typedef void (*TABLEAPI_pfPIDResultCB)(sint32); 25 | 26 | typedef struct 27 | { 28 | void* pvTableData; 29 | void* pvOutputData; 30 | TYPE_tenDataType enDataType; 31 | sint16 i16TableSize; 32 | SPREADAPI_ttSpreadIDX tSpreadIDX;/*CR1_119*/ 33 | TABLEAPI_pfPIDResultCB pfResultCB; 34 | } TABLEAPI_tstTableCB; 35 | 36 | #endif //TABLESAPI_H 37 | 38 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/API/TASKAPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* API TITLE: TaskAPI */ 7 | /* DESCRIPTION: This API provides type definitions for objects and */ 8 | /* functions required by Kernel managed application tasks */ 9 | /* initialisation, functions and events */ 10 | /* */ 11 | /* FILE NAME: TaskAPI.h */ 12 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 13 | /* */ 14 | /******************************************************************************/ 15 | #ifndef TASKAPI_H 16 | #define TASKAPI_H 17 | 18 | #include "types.h" 19 | 20 | 21 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 22 | typedef enum 23 | { 24 | TASKAPI_enTaskPrMaxAll = 0u, 25 | TASKAPI_enTaskPrMaxCyc = 128u, 26 | TASKAPI_enTaskPrLowest = 255u, 27 | } TASKAPI_tenPriority;/*CR1_120*/ 28 | 29 | typedef enum 30 | { 31 | TASKAPI_enTaskCycBad = 0u, 32 | TASKAPI_enTask1ms = 1u, 33 | TASKAPI_enTask2ms = 2u, 34 | TASKAPI_enTask5ms = 5u, 35 | TASKAPI_enTask10ms = 10u, 36 | TASKAPI_enTask20ms = 20u, 37 | TASKAPI_enTask25ms = 25u, 38 | TASKAPI_enTask50ms = 50u, 39 | TASKAPI_enTask100ms = 100u, 40 | TASKAPI_enTask200ms = 200u, 41 | TASKAPI_enTask250ms = 250u, 42 | TASKAPI_enTaskCycNot = 255u 43 | } TASKAPI_tenRateMs;/*CR1_120*/ 44 | 45 | 46 | #endif //TASKAPI_H 47 | 48 | 49 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/ATS.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Coolant Temperature Header File */ 7 | /* DESCRIPTION: This code module initialises the required ADC */ 8 | /* resources and functions for coolant temperature */ 9 | /* measurement */ 10 | /* FILE NAME: ATS.c */ 11 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #ifndef ATS_H 15 | #define ATS_H 16 | 17 | #include 18 | #include "IOAPI.h" 19 | #include "SENSORS.h" 20 | #include "USER.h" 21 | 22 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 23 | #define ATS_nADFiltVal (0x40) 24 | 25 | #ifdef EXTERN 26 | #undef EXTERN 27 | #endif 28 | #ifdef _ATS_C 29 | #define EXTERN 30 | #else 31 | #define EXTERN extern 32 | #endif 33 | 34 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 35 | EXTERN uint32 ATS_u32ADCRaw; 36 | EXTERN uint32 ATS_u32ADCFiltered; 37 | //ASAM mode=readvalue name="Air Sensor Filtered ADC" type=uint32 offset=0 min=0 max=1048575 m=1 b=0 units="counts" format=5.3 help="ATS Sensor ADC" 38 | EXTERN GPM6_ttVolts ATS_tSensorVolts;/*CR1_88*/ 39 | //ASAM mode=readvalue name="ATS Sensor Voltage" type=uint32 offset=0 min=0 max=5 m=0.001 b=0 units="V" format=3.2 help="ATS Sensor Voltage" 40 | EXTERN GPM6_ttTempC ATS_tTempCRaw; 41 | EXTERN GPM6_ttTempC ATS_tTempCPort; 42 | EXTERN GPM6_ttTempC ATS_tTempCFiltered; 43 | //ASAM mode=readvalue name="Air Temperature" type=uint32 offset=0 min=0 max=200 m=0.001 b=0 units="degrees C" format=4.1 help="Air Temperature" 44 | EXTERN uint32 ATS_u32FuelMultiplier; 45 | EXTERN Bool ATS_boATSReady; 46 | 47 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 48 | void ATS_vStart(uint32 * const pu32Arg); 49 | void ATS_vRun(uint32* const pu32Arg); 50 | void ATS_vTerminate(uint32* const pu32Arg); 51 | void ATS_vThread(void); 52 | void ATS_vCallBack(puint32 const pu32Arg); 53 | 54 | #endif // ATS_H 55 | 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/BOOSTED.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Setup Header */ 7 | /* DESCRIPTION: This code assist with the setup of kernel managed */ 8 | /* resources */ 9 | /* */ 10 | /* FILE NAME: BOOSTED.c */ 11 | /* REVISION HISTORY: 14-04-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #ifndef BOOSTED_H 15 | #define BOOSTED_H 16 | 17 | #include 18 | #include "IOAPI.h" 19 | #include "MAPSAPI.h" 20 | #include "USER.h" 21 | #include "SYS.h" 22 | #include "SPREADSAPI.h" 23 | #include "TABLESAPI.h" 24 | #include "TEPMAPI.h" 25 | 26 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 27 | 28 | 29 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 30 | 31 | 32 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 33 | Bool BOOSTED_boIndexAndCalculateMap(SPREADAPI_ttSpreadIDX, SPREADAPI_ttSpreadIDX, MAPSAPI_ttMapIDX); 34 | Bool BOOSTED_boIndexAndCalculateTable(SPREADAPI_ttSpreadIDX, TABLEAPI_ttTableIDX); 35 | SPREADAPI_tstSpreadResult* BOOSTED_pstGetSpread(SPREADAPI_ttSpreadIDX); 36 | void BOOSTED_vEnableWatchdog(uint16 u16ReloadCount, uint16 u16WindowCount); 37 | 38 | #endif // BOOSTED_H 39 | 40 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/BVM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Battery Voltage Header File */ 7 | /* DESCRIPTION: This code module initialises the required ADC */ 8 | /* resources and functions for battery voltage */ 9 | /* measurement */ 10 | /* FILE NAME: BVM.h */ 11 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /* */ 14 | /* */ 15 | /* */ 16 | /******************************************************************************/ 17 | #ifndef BVM_H 18 | #define BVM_H 19 | 20 | #include "ADCAPI.h" 21 | #include "CONV.h" 22 | #include "declarations.h" 23 | #include "IOAPI.h" 24 | #include "SYSAPI.h" 25 | #include "UNITS.h" 26 | #include "USER.h" 27 | #include "USERMATH.h" 28 | 29 | 30 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 31 | #define BVM_nVoltsFilteredInitVal (uint32)(1000 * 12) 32 | #define BVM_nSecondDerivativeChangeLimit 1 33 | /*CR1_87*/ 34 | 35 | #define BVM_nADInput EH_IO_ADD11 36 | 37 | #ifdef EXTERN 38 | #undef EXTERN 39 | #endif 40 | #ifdef _BVM_C 41 | #define EXTERN 42 | #else 43 | #define EXTERN extern 44 | #endif 45 | 46 | 47 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 48 | EXTERN GPM6_ttVolts BVM_tBattVolts;/*CR1_88*/ 49 | //ASAM mode=readvalue name="Battery Voltage" type=uint32 offset=0 min=0 max=20 m=0.001 b=0 units="V" format=5.3 help="Battery Voltage" 50 | 51 | 52 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 53 | void BVM_vStart(uint32* const pu32Arg); 54 | void BVM_vRun(uint32* const pu32Arg); 55 | void BVM_vTerminate(uint32* const pu32Arg); 56 | void BVM_vCallBack(uint32* const pu32Arg); 57 | void BVM_vThread(void); 58 | 59 | #endif // BVM_H 60 | 61 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/CAM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Cyclic Activity Manager Header File */ 7 | /* DESCRIPTION: This code module initialises the required */ 8 | /* resources and functions for cyclic activites */ 9 | /* */ 10 | /* FILE NAME: MAP.c */ 11 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #ifndef CAM_H 15 | #define CAM_H 16 | 17 | #include 18 | #include "FUEL.h" 19 | #include "IOAPI.h" 20 | #include "SENSORS.h" 21 | #include "TEPMAPI.h" 22 | #include "USER.h" 23 | 24 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 25 | #define CAM_xTicksToRPM(x) ((60u * SENSORS_nSlowFTMFreq) / ((4u * x))) 26 | #define CAM_nPeriodMs (10u) 27 | #define CAM_nPeriodRPMTimeout (600u) 28 | #define CAM_nRPMTransitionCount (10) 29 | 30 | #ifdef EXTERN 31 | #undef EXTERN 32 | #endif 33 | #ifdef _CAM_C 34 | #define EXTERN 35 | #else 36 | #define EXTERN extern 37 | #endif 38 | 39 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 40 | EXTERN uint32 CAM_u32RPMRawOld; 41 | EXTERN uint32 CAM_u32RPMRaw; 42 | //ASAM mode=readvalue name="Engine Speed Raw" type=uint32 offset=0 min=0 max=10000 m=1 b=0 units="RPM" format=4.0 help="Engine Speed" 43 | EXTERN uint32 CAM_u32RPMFiltered; 44 | //ASAM mode=readvalue name="RPM Transition Counter" type=uint32 offset=0 min=0 max=10000 m=1 b=0 units="RPM" format=4.0 help="RPM Transition Counter" 45 | EXTERN uint32 CAM_u32RPMTransitionCounter; 46 | 47 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 48 | void CAM_vStart(uint32 * const pu32Arg); 49 | void CAM_vRun(uint32* const pu32Arg); 50 | void CAM_vTerminate(uint32* const pu32Arg); 51 | void CAM_vCallBack(puint32 const pu32Arg); 52 | void CAM_vEngineSpeedCB(TEPMAPI_ttEventTime tEventTime); 53 | 54 | #endif // MAP_H 55 | 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/FILM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Fuel Film Model Header File */ 7 | /* DESCRIPTION: This code module calculates the fuel film load */ 8 | /* for manifold wetting compensation */ 9 | /* */ 10 | /* FILE NAME: FILM.h */ 11 | /* REVISION HISTORY: 28-04-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #ifndef FILM_H 15 | #define FILM_H 16 | 17 | #include 18 | #include "IOAPI.h" 19 | #include "USER.h" 20 | 21 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 22 | 23 | 24 | #ifdef EXTERN 25 | #undef EXTERN 26 | #endif 27 | #ifdef _FILM_C 28 | #define EXTERN 29 | #else 30 | #define EXTERN extern 31 | #endif 32 | 33 | 34 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 35 | EXTERN sint32 FILM_s32FilmLoadUgDeltaApplied; 36 | 37 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 38 | void FILM_vStart(uint32 * const pu32Arg); 39 | void FILM_vRun(uint32* const pu32Arg); 40 | void FILM_vTerminate(uint32* const pu32Arg); 41 | void FILM_vCallBack(puint32 const pu32Arg); 42 | 43 | #endif // MAP_H 44 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/IAC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Idle Air Control Header File */ 7 | /* DESCRIPTION: This code module initialises the required */ 8 | /* resources and functions for idle air control */ 9 | /* */ 10 | /* FILE NAME: IAC.c */ 11 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #ifndef IAC_H 15 | #define IAC_H 16 | 17 | #include 18 | #include "CTS.h" 19 | #include "TPS.h" 20 | #include "IOAPI.h" 21 | #include "SETUP.h" 22 | #include "USER.h" 23 | 24 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 25 | 26 | #ifdef EXTERN 27 | #undef EXTERN 28 | #endif 29 | #ifdef _IAC_C 30 | #define EXTERN 31 | #else 32 | #define EXTERN extern 33 | #endif 34 | 35 | #define IAC_LEARN_COUNTS 400 36 | 37 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 38 | 39 | typedef enum 40 | { 41 | IAC_enResetHome, 42 | IAC_enNormal 43 | } IAC_tenStepperState; 44 | 45 | typedef enum 46 | { 47 | IAC_enOpenLoop, 48 | IAC_enClosedLoop 49 | } IAC_tenControlState; 50 | 51 | /* GLOBAL VARIABLE DECLARATIONS ***********************************************/ 52 | EXTERN uint32 IAC_u32ISCDuty; 53 | EXTERN IAC_tenControlState IAC_enControlState; 54 | EXTERN Bool IAC_boOverrunCutRPMEnable; 55 | EXTERN sint32 IAC_s32ISCESTTrim[2]; 56 | 57 | 58 | /* GLOBAL FUNCTION DECLARATIONS ***********************************************/ 59 | void IAC_vStart(uint32 * const pu32Arg); 60 | void IAC_vRun(uint32* const pu32Arg); 61 | void IAC_vTerminate(uint32* const pu32Arg); 62 | void IAC_vCallBack(puint32 const pu32Arg); 63 | 64 | #endif // MAP_H 65 | 66 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/UNITS.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: Units File */ 7 | /* DESCRIPTION: This code module SI typedefs for variables with */ 8 | /* various resolutions */ 9 | /* */ 10 | /* FILE NAME: units.h */ 11 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /* */ 14 | /* */ 15 | /* */ 16 | /******************************************************************************/ 17 | #if BUILD_KERNEL_APP 18 | 19 | #include 20 | #include "sys.h" 21 | #include "declarations.h" 22 | #include "types.h" 23 | 24 | #endif //BUILD_KERNEL_APP 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Client/USERMAIN.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:USER_APP */ 6 | /* PACKAGE TITLE: USERMAIN */ 7 | /* DESCRIPTION: This code module provides the user application entry */ 8 | /* point */ 9 | /* */ 10 | /* FILE NAME: USERMAIN.c */ 11 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | #include "build.h" 15 | #include "user.h" 16 | 17 | /* LOCAL VARIABLE DEFINITIONS (STATIC) ****************************************/ 18 | uint32 USER_u32Stat; 19 | 20 | /* GLOBAL FUNCTION DEFINITIONS ************************************************/ 21 | int usermain(void); 22 | 23 | #if (BUILD_USER == 1) 24 | int usermain(void) 25 | { 26 | (void)USER_vStart(&OS_stSVCDataStruct); 27 | 28 | return (int)USER_u32Stat;/*CR1_6*/ 29 | } 30 | #endif //BUILD_USER 31 | 32 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/ECUHostEFI.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: ECUHOSTEFI */ 7 | /* DESCRIPTION: This code provides the entry point for the kernel */ 8 | /* FILE NAME: ECUHOSTEFI.c */ 9 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "build.h" 13 | #include "CPUAbstract.h" 14 | #include "declarations.h" 15 | #include "CPUAbstract.h" 16 | #include "OS.h" 17 | #include "IRQ.h" 18 | #include "sys.h" 19 | #include "tqueue.h" 20 | #include "task.h" 21 | #include "types.h" 22 | 23 | 24 | Bool boGlobalTickFlag; 25 | extern void SystemCoreClockUpdate(void); 26 | volatile uint32_t msTicks; /* counts 1ms timeTicks */ 27 | extern uint32 OS_u32SysTickInterval; 28 | 29 | /*---------------------------------------------------------------------------- 30 | MAIN function 31 | *----------------------------------------------------------------------------*/ 32 | int EFIMain(void) 33 | { 34 | uint32 u32Stat; 35 | puint32 pu32PBLWord = (puint32)PBL_WORD_ADDR; 36 | 37 | if (0xAA550001 != *pu32PBLWord) 38 | { 39 | SystemCoreClockUpdate(); /* Get Core Clock Frequency */ 40 | SysTick_Config(SYS_FREQ_BUS / 1000); /* Generate interrupt each 1 ms */ 41 | } 42 | else 43 | { 44 | IRQ_vReset(); 45 | CPU_xExitCritical(); 46 | } 47 | 48 | OS_u32SysTickInterval = SYS_FREQ_BUS / 1000; 49 | OS_vStart(&u32Stat); 50 | 51 | while(1) 52 | { 53 | OS_vRun((uint32*)&u32Stat); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/DISK.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: DISK */ 7 | /* DESCRIPTION: This code provides functions to support NVM disk */ 8 | /* functionality with a FATFS */ 9 | /* FILE NAME: DISK.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include "types.h" 15 | #include "CPUAbstract.h" 16 | #include "regset.h" 17 | #include "declarations.h" 18 | #include "OS.h" 19 | #include "disk.h" 20 | #include "diskio.h" 21 | //#include "integer.h" 22 | #include "sdhc.h" 23 | #include "types.h" 24 | 25 | #ifdef BUILD_MK60 26 | #include "sdhc1.h" 27 | #endif //BUILD_MK60 28 | 29 | #include "ff.h" 30 | 31 | FATFS DISK_stFATFS; 32 | 33 | void DISK_vStart(uint32* const u32Stat) 34 | { 35 | //SDHC_vCard_Initialise(); 36 | OS_xModuleStartOK(*u32Stat); 37 | } 38 | 39 | void DISK_vRun(uint32* const u32Stat) 40 | { 41 | static Bool run = false; 42 | FIL stFIL; 43 | FRESULT enResult; 44 | 45 | if(false == run) 46 | { 47 | // run = true; 48 | // f_mount(&DISK_stFATFS, "", 0); 49 | // enResult = f_open(&stFIL, "ASCII.TXT", FA_READ); 50 | // f_close(&stFIL); 51 | } 52 | } 53 | 54 | void DISK_vTerminate(uint32* const u32Stat) 55 | { 56 | 57 | } 58 | 59 | DSTATUS disk_initialize(BYTE pdrv) 60 | { 61 | return 0; 62 | } 63 | 64 | DSTATUS disk_status(BYTE pdrv) 65 | { 66 | return 0; 67 | } 68 | 69 | DRESULT disk_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count) 70 | { 71 | return SDHC_u8DiskRead(buff, sector, count); 72 | } 73 | 74 | DRESULT disk_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) 75 | { 76 | return SDHC_u8DiskWrite((uint8* const)buff, sector, count); 77 | } 78 | 79 | DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) 80 | { 81 | return 0; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/DISK.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: DISK Header File */ 7 | /* DESCRIPTION: This code provides enum definitions for disk support */ 8 | /* */ 9 | /* FILE NAME: DISK.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef DISK_H 14 | #define DISK_H 15 | 16 | #include 17 | #include "sys.h" 18 | #include "types.h" 19 | 20 | #define DISK_nDISKS 1 21 | 22 | typedef enum 23 | { 24 | enDiskSDCard, 25 | enDiskFlash, 26 | enDiskEEPROM 27 | } DISK_tenDiskIndex; 28 | 29 | void DISK_vStart(uint32* const); 30 | void DISK_vRun(uint32* const); 31 | void DISK_vTerminate(uint32* const); 32 | 33 | #endif //DSCRIO_H 34 | 35 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/DSCRIO.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: DSCRIO */ 7 | /* DESCRIPTION: This code provides support for kernel managed resource */ 8 | /* discrete I/O only (e.g. Ethernet controller) */ 9 | /* FILE NAME: DSCRIO.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "DSCRIO.h" 14 | 15 | 16 | void DSCRIO_vStart(uint32* const pu32Stat) 17 | { 18 | DSCRIOHA_vStart(pu32Stat); 19 | } 20 | 21 | void DSCRIO_vRun(uint32* const pu32Stat) 22 | { 23 | 24 | } 25 | 26 | void DSCRIO_vTerminate(uint32* const pu32Stat) 27 | { 28 | 29 | } 30 | 31 | void DSCRIO_vSetDiscrete(DSCRIO_tenIOFunction enIOFunction, DSCRIO_tenLogicLevel enLogicLevel) 32 | { 33 | DSCRIOHA_vSetDiscrete(enIOFunction, enLogicLevel); 34 | } 35 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/DSCRIO.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: DSCRIO Header File */ 7 | /* DESCRIPTION: This code provides macros for discrete I/O setup */ 8 | /* and enum definitions */ 9 | /* FILE NAME: DSCRIO.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef DSCRIO_H 14 | #define DSCRIO_H 15 | 16 | #include 17 | #include "CPUAbstract.h" 18 | #include "declarations.h" 19 | #include "DSCRIOHA.h" 20 | #include "OS.h" 21 | #include "regset.h" 22 | #include "types.h" 23 | 24 | 25 | typedef struct 26 | { 27 | tstGPIOModule* pstGPIO; 28 | uint32 u32Bit; 29 | } DSCRIO_tstIOFunctionPortConfig; 30 | 31 | 32 | typedef enum 33 | { 34 | enCOMSRESET, 35 | enSYSTELLTALE, 36 | enFIFOPRS, 37 | enWIFIMS, 38 | enIOFunctionCount 39 | } DSCRIO_tenIOFunction; 40 | 41 | typedef enum 42 | { 43 | enLow, 44 | enHigh, 45 | enToggle, 46 | enHighZ 47 | } DSCRIO_tenLogicLevel; 48 | 49 | void DSCRIO_vStart(uint32* const); 50 | void DSCRIO_vRun(uint32* const); 51 | void DSCRIO_vTerminate(uint32* const); 52 | void DSCRIO_vSetDiscrete(DSCRIO_tenIOFunction, DSCRIO_tenLogicLevel); 53 | void DSCRIOHA_vSetDiscrete(DSCRIO_tenIOFunction, DSCRIO_tenLogicLevel); 54 | 55 | #endif //DSCRIO_H 56 | 57 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/DSCRIOHA.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: DSCRIO Hardware Adaption */ 7 | /* DESCRIPTION: This code provides support for kernel managed resource */ 8 | /* discrete I/O only (e.g. Ethernet controller) */ 9 | /* FILE NAME: DSCRIOHA.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "declarations.h" 14 | #include "dscrio.h" 15 | #include "CPUAbstract.h" 16 | 17 | const REGSET_tstReg32Val DSCRIOHA_rastDSCRIOReg32Val[] = DSCRIOHA_nReg32Set; 18 | const DSCRIO_tstIOFunctionPortConfig DSCRIO_stIOFunctionPortConfig[enIOFunctionCount] 19 | = DSCRIOHA_nIOFunctionConfig; 20 | 21 | void DSCRIOHA_vStart(uint32* const u32Stat) 22 | { 23 | REGSET_vInitReg32(&DSCRIOHA_rastDSCRIOReg32Val[0]); 24 | OS_xModuleStartOK(*u32Stat); 25 | } 26 | 27 | void DSCRIOHA_vRun(uint32* const u32Stat) 28 | { 29 | 30 | } 31 | 32 | void DSCRIOHA_vTerminate(uint32* const u32Stat) 33 | { 34 | 35 | } 36 | 37 | void DSCRIOHA_vSetDiscrete(DSCRIO_tenIOFunction enIOFunction, DSCRIO_tenLogicLevel enLogicLevel) 38 | { 39 | switch (enLogicLevel) 40 | { 41 | case enLow: 42 | #ifdef BUILD_MK60 43 | DSCRIO_stIOFunctionPortConfig[enIOFunction].pstGPIO->PCOR = 44 | DSCRIO_stIOFunctionPortConfig[enIOFunction].u32Bit; 45 | #endif 46 | break; 47 | 48 | case enHigh: 49 | #ifdef BUILD_MK60 50 | DSCRIO_stIOFunctionPortConfig[enIOFunction].pstGPIO->PSOR = 51 | DSCRIO_stIOFunctionPortConfig[enIOFunction].u32Bit; 52 | #endif 53 | break; 54 | 55 | case enToggle: 56 | #ifdef BUILD_MK60 57 | DSCRIO_stIOFunctionPortConfig[enIOFunction].pstGPIO->PTOR = 58 | DSCRIO_stIOFunctionPortConfig[enIOFunction].u32Bit; 59 | #endif 60 | break; 61 | 62 | case enHighZ: 63 | #ifdef BUILD_MK60 64 | DSCRIO_stIOFunctionPortConfig[enIOFunction].pstGPIO->PDDR &= 65 | ~DSCRIO_stIOFunctionPortConfig[enIOFunction].u32Bit; 66 | #endif 67 | break; 68 | } 69 | 70 | if(enHighZ != enLogicLevel) 71 | { 72 | #ifdef BUILD_MK60 73 | DSCRIO_stIOFunctionPortConfig[enIOFunction].pstGPIO->PDDR |= 74 | DSCRIO_stIOFunctionPortConfig[enIOFunction].u32Bit; 75 | #endif 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/KERNELDIAG.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #define _DIAG_C 13 | 14 | #include 15 | #include "KERNELDIAG.h" 16 | 17 | void DIAG_vStart(void) 18 | { 19 | uint32 u32IDX; 20 | 21 | DIAG_DataWriteCB = NULL; 22 | DIAG_ReadWriteCB = NULL; 23 | DIAG_RoutineCB = NULL; 24 | 25 | for (u32IDX = 0; u32IDX < DIAG_DDDI_COUNT; u32IDX++) 26 | { 27 | memset((void*)&DIAG_astDDDI[u32IDX], 0, sizeof(DIAG_tstDDDI)); 28 | } 29 | } 30 | 31 | void DIAG_vSetCallBack(DIAGAPI_tenCallBackType enCallBackType, void* pfFunction) 32 | { 33 | // #if BUILD_SBL 34 | // OS_stSVCDataStruct.enSVCResult = SYSAPI_enOK; 35 | // 36 | // switch (enCallBackType) 37 | // { 38 | // case DIAGAPI_enDataWriteCB: 39 | // { 40 | // DIAG_DataWriteCB = (DIAGAPI_tDataWriteCB)pfFunction; 41 | // break; 42 | // } 43 | // 44 | // case DIAGAPI_enDataReadCB: 45 | // { 46 | // break; 47 | // } 48 | // 49 | // case DIAGAPI_enRoutineCB: 50 | // { 51 | // break; 52 | // } 53 | // 54 | // default: 55 | // { 56 | // OS_stSVCDataStruct.enSVCResult = SYSAPI_enBadCallback; 57 | // break; 58 | // } 59 | // } 60 | // #endif 61 | #if defined(BUILD_KERNEL) 62 | OS_stSVCDataStruct.enSVCResult = SYSAPI_enOK; 63 | 64 | switch (enCallBackType) 65 | { 66 | case DIAGAPI_enDataWriteCB: 67 | { 68 | DIAG_DataWriteCB = (DIAGAPI_tDataWriteCB)pfFunction; 69 | break; 70 | } 71 | 72 | case DIAGAPI_enDataReadCB: 73 | { 74 | break; 75 | } 76 | 77 | case DIAGAPI_enRoutineCB: 78 | { 79 | break; 80 | } 81 | 82 | default: 83 | { 84 | OS_stSVCDataStruct.enSVCResult = SYSAPI_enBadCallback; 85 | break; 86 | } 87 | } 88 | #endif 89 | } 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/KERNELDIAG.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef DIAG_H 13 | #define DIAG_H 14 | 15 | #include "declarations.h" 16 | #include "build.h" 17 | #include "OS.h" 18 | #include "DIAGAPI.h" 19 | 20 | #define DIAG_DDDI_COUNT 20 21 | #define DIAG_DDDI_DATA_COUNT 200 22 | 23 | typedef struct 24 | { 25 | uint16 u16DDI; 26 | uint8 u8AddressAndLength; 27 | uint8 u8RecsCount; 28 | uint8 u8ByteCount; 29 | uint8 u8Data[DIAG_DDDI_DATA_COUNT]; 30 | } DIAG_tstDDDI; 31 | 32 | 33 | #ifdef EXTERN 34 | #undef EXTERN 35 | #endif 36 | #ifdef _DIAG_C 37 | #define EXTERN 38 | #else 39 | #define EXTERN extern 40 | #endif 41 | 42 | EXTERN DIAG_tstDDDI DIAG_astDDDI[DIAG_DDDI_COUNT]; 43 | EXTERN DIAGAPI_tDataWriteCB DIAG_DataWriteCB; 44 | EXTERN DIAGAPI_tReadWriteCB DIAG_ReadWriteCB; 45 | EXTERN DIAGAPI_tRoutineCB DIAG_RoutineCB; 46 | 47 | void DIAG_vStart(void); 48 | void DIAG_vSetCallBack(DIAGAPI_tenCallBackType, void*); 49 | 50 | #endif //DIAG_H 51 | 52 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/PACKEDDLL.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef PACKEDDLL_H 13 | #define PACKEDDLL_H 14 | 15 | #define TXRX_MSB_DELIM_SIZE 12u 16 | 17 | void PACKEDDLL_vPack(puint8); 18 | void PACKEDDLL_vUnpack(DLL_tstRXDLLData*); 19 | 20 | #endif //PACKEDDLL_H 21 | 22 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/PIM.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: PIM Port Integration Module purpose is to provide */ 7 | /* bit I/O service to the application layer */ 8 | /* DESCRIPTION: */ 9 | /* FILE NAME: PIM.c */ 10 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "OS.h" 14 | #include "PIM.h" 15 | #include "PIMHA.h" 16 | 17 | uint32 PIM_u32PortClockRequested; 18 | 19 | void PIM_vStart(uint32* const u32Stat) 20 | { 21 | PIMHA_vStart(u32Stat); 22 | OS_xModuleStartOK(*u32Stat); 23 | } 24 | 25 | void PIM_vRun(uint32* const u32Stat) 26 | { 27 | 28 | } 29 | 30 | void PIM_vTerminate(uint32* const u32Stat) 31 | { 32 | 33 | } 34 | 35 | void PIM_vInitPortBit(PIMAPI_tenPort enPort, IOAPI_tenEHIOType enIOType, uint32 u32PortBit) 36 | { 37 | PIMHA_vInitPortBit(enPort, enIOType, u32PortBit); 38 | } 39 | 40 | void PIM_vAssertPortBit(PIMAPI_tenPort enPort, uint32 u32PortBit, IOAPI_tenTriState enTriState) 41 | { 42 | PIMHA_vAssertPortBit(enPort, u32PortBit, enTriState); 43 | } 44 | 45 | 46 | Bool PIM_boGetPortBitState(PIMAPI_tenPort enPort, uint32 u32PortBit) 47 | { 48 | return PIMHA_boGetPortBitState(enPort, u32PortBit); 49 | } 50 | 51 | void PIM_vSetPortMux(PIMAPI_tenPort enPort, IOAPI_tenEHIOType enIOType, uint32 u32PortBit, uint32 u32MuxSel) 52 | { 53 | PIMHA_vSetPortMux(enPort, enIOType, u32PortBit, u32MuxSel); 54 | } 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/PIM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: PIM Header File */ 7 | /* DESCRIPTION: Port Integration Module */ 8 | /* FILE NAME: PIM.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef PIM_H 13 | #define PIM_H 14 | 15 | #include "types.h" 16 | #include "PIMAPI.h" 17 | #include "IOAPI.h" 18 | 19 | void PIM_vStart(uint32* const); 20 | void PIM_vRun(uint32* const); 21 | void PIM_vTerminate(uint32* const); 22 | void PIM_vInitPortBit(PIMAPI_tenPort, IOAPI_tenEHIOType, uint32); 23 | void PIM_vAssertPortBit(PIMAPI_tenPort, uint32, IOAPI_tenTriState); 24 | void PIM_vSetPortMux(PIMAPI_tenPort, IOAPI_tenEHIOType, uint32, uint32); 25 | Bool PIM_boGetPortBitState(PIMAPI_tenPort, uint32); 26 | 27 | #endif //PIM_H 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/PIT.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | 13 | #include 14 | #include "CPUAbstract.h" 15 | 16 | #include "IOAPI.h" 17 | #include "regset.h" 18 | #include "sys.h" 19 | #include "declarations.h" 20 | #include "os.h" 21 | #include "PIT.h" 22 | #include "IRQ.h" 23 | 24 | extern void PIT3_Handler(void); 25 | 26 | const REGSET_tstReg32Val PIT_rastPITReg32Val[] = PIT_nReg32Set; 27 | 28 | void PIT_vStart(uint32* const u32Stat) 29 | { 30 | REGSET_vInitReg32(&PIT_rastPITReg32Val[0]); 31 | 32 | //Activate_IRQ(IRQ_enIRQIDX_PIT4_RTI, IRQ_enICRSoftPrio15, PIT4_RTI_Handler); /* Setup PIT3 interrupt */ 33 | 34 | OS_xModuleStartOK(*u32Stat); 35 | } 36 | 37 | void PIT_vRun(uint32* const u32Stat) 38 | { 39 | 40 | } 41 | 42 | void PIT_vTerminate(uint32* const u32Stat) 43 | { 44 | 45 | } 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/PIT.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef PIT_H 13 | #define PIT_H 14 | 15 | #include "sys.h" 16 | 17 | #define PIT_TLVAL0_val (SYS_PERIOD_RTI_nS / SYS_PERIOD_OSC_nS) 18 | 19 | /**/ 20 | #define PIT_nReg32Set \ 21 | { \ 22 | { NULL, 0, REGSET_enOverwrite } \ 23 | }; 24 | /**/ 25 | 26 | void PIT_vStart(uint32* const); 27 | void PIT_vRun(uint32* const); 28 | void PIT_vTerminate(uint32* const); 29 | 30 | #endif //PIT_H 31 | 32 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/SIM.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SIM */ 7 | /* DESCRIPTION: This code is provides functions for clock register */ 8 | /* setting in future will support low power clocking */ 9 | /* for power modes and shutdown etc */ 10 | /* FILE NAME: SIM.c */ 11 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 12 | /* */ 13 | /******************************************************************************/ 14 | 15 | #include "CPUAbstract.h" 16 | #include "OS.h" 17 | #include "SIM.h" 18 | #include "regset.h" 19 | 20 | static void SIM_vSetRegAddress(SIMHA_tenReg, REGSET_tstReg32Val*); 21 | REGSET_tstReg32Val SIM_astSIMReg32Val[2]; 22 | 23 | void SIM_vSetReg32(SIMHA_tenReg enReg, uint32 u32RegMask) 24 | { 25 | SIM_vSetRegAddress(enReg, &SIM_astSIMReg32Val[0]); 26 | SIM_astSIMReg32Val[0].val = u32RegMask; 27 | SIM_astSIMReg32Val[0].writeMode = REGSET_enOr; 28 | SIM_astSIMReg32Val[1].reg = NULL; 29 | REGSET_vInitReg32(&SIM_astSIMReg32Val[0]); 30 | } 31 | 32 | void SIM_vClrReg32(SIMHA_tenReg enReg, uint32 u32RegMask) 33 | { 34 | SIM_vSetRegAddress(enReg, &SIM_astSIMReg32Val[0]); 35 | SIM_astSIMReg32Val[0].val = ~u32RegMask; 36 | SIM_astSIMReg32Val[0].writeMode = REGSET_enAnd; 37 | SIM_astSIMReg32Val[1].reg = NULL; 38 | REGSET_vInitReg32(&SIM_astSIMReg32Val[0]); 39 | } 40 | 41 | Bool SIM_boEnablePeripheralClock(IRQn_Type IRQn) 42 | { 43 | return SIMHA_boEnablePeripheralClock(IRQn); 44 | } 45 | 46 | static void SIM_vSetRegAddress(SIMHA_tenReg enReg, REGSET_tstReg32Val* pstReg32Val) 47 | { 48 | SIMHA_vSetRegAddress(enReg, pstReg32Val); 49 | } 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/SIM.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SIM Header File */ 7 | /* DESCRIPTION: This code is provides enum definitions */ 8 | /* */ 9 | /* FILE NAME: SIM.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef SIM_H 14 | #define SIM_H 15 | 16 | #include "SIMHA.h" 17 | #include "regset.h" 18 | #include "sys.h" 19 | #include "types.h" 20 | 21 | 22 | void SIM_vSetReg32(SIMHA_tenReg, uint32); 23 | void SIM_vClrReg32(SIMHA_tenReg, uint32); 24 | Bool SIM_boEnablePeripheralClock(IRQn_Type); 25 | 26 | #endif //SIM_H 27 | 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/SIMHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SIM Hardware Adaption Header File */ 7 | /* DESCRIPTION: This code is provides enum definitions */ 8 | /* */ 9 | /* FILE NAME: SIMHA.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef SIMHA_H 14 | #define SIMHA_H 15 | 16 | #include "regset.h" 17 | 18 | #ifdef BUILD_SAM3X8E 19 | #include "pmc.h" 20 | #endif //BUILD_SAM3X8E 21 | 22 | #ifdef BUILD_MK60 23 | typedef enum 24 | { 25 | SIM_SCGC1, 26 | SIM_SCGC2, 27 | SIM_SCGC3, 28 | SIM_SCGC4, 29 | SIM_SCGC5, 30 | SIM_SCGC6, 31 | SIM_SCGC7, 32 | SIM_SOPT1, 33 | SIM_SOPT2, 34 | SIM_SOPT4, 35 | SIM_SOPT5, 36 | SIM_SOPT6, 37 | SIM_SOPT7 38 | } SIMHA_tenReg; 39 | #endif //BUILD_MK60 40 | 41 | #ifdef BUILD_SAM3X8E 42 | typedef enum 43 | { 44 | SIM_PC0, 45 | SIM_PC1 46 | } SIMHA_tenReg; 47 | #endif //BUILD_SAM3X8E 48 | 49 | void SIMHA_vSetRegAddress(SIMHA_tenReg, REGSET_tstReg32Val*); 50 | Bool SIMHA_boEnablePeripheralClock(IRQn_Type); 51 | 52 | #endif //SIMHA_H 53 | 54 | 55 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/cbytequeue.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "sys.h" 13 | #include "types.h" 14 | 15 | 16 | #ifndef CBYTEQUEUE_H 17 | #define CBYTEQUEUE_H 18 | 19 | typedef struct 20 | { 21 | uint32 u32Head; 22 | uint32 u32Tail; 23 | uint32 u32Size; 24 | puint8 pu8Data; 25 | } CBYTEQUEUE_tstQueue; 26 | 27 | 28 | #endif //CBYTEQUEUE_H 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/commonNL.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef COMMONNL_H 13 | #define COMMONNL_H 14 | 15 | #include "TYPES.h" 16 | 17 | #define COMMONNL_RX_BUFF_LARGE_SIZE 1030u 18 | #define COMMONNL_TX_BUFF_LARGE_SIZE 258u 19 | #define COMMONNL_RX_BUFF_SMALL_SIZE 128u 20 | #define COMMONNL_TX_BUFF_SMALL_SIZE 128u 21 | 22 | typedef struct 23 | { 24 | uint8 u8Data[COMMONNL_RX_BUFF_LARGE_SIZE]; 25 | uint8* pu8RX; 26 | uint16 u16RXRequestedCount; 27 | uint16 u16RXReceivedCount; 28 | uint8 u8SeqNumber; 29 | uint8 u8RXBlock; 30 | uint8 biRXErr : 1; 31 | uint8 biRXOK : 1; 32 | uint8 biSpare : 6; 33 | } COMMONNL_tstRXLargeBuffer; 34 | 35 | typedef struct 36 | { 37 | uint8 u8Data[COMMONNL_TX_BUFF_LARGE_SIZE]; 38 | uint8* pu8TX; 39 | uint16 u16TXRequestedCount; 40 | uint16 u16TXTransmittedCount; 41 | uint8 u8SeqNumber; 42 | uint8 u8TXBlock; 43 | uint8 biTXErr : 1; 44 | uint8 biTXOK : 1; 45 | uint8 biSpare : 6; 46 | } COMMONNL_tstTXLargeBuffer; 47 | 48 | typedef struct 49 | { 50 | uint8 u8Data[COMMONNL_RX_BUFF_SMALL_SIZE]; 51 | puint8 pu8RX; 52 | uint8 u8RXRequestedCount; 53 | uint8 u8RXReceivedCount; 54 | } COMMONNL_tstRXSmallBuffer; 55 | 56 | typedef struct 57 | { 58 | uint8 u8Data[COMMONNL_TX_BUFF_SMALL_SIZE]; 59 | puint8 pu8TX; 60 | uint8 u8TXRequestedCount; 61 | uint8 u8TXReceivedCount; 62 | } COMMONNL_tstTXSmallBuffer; 63 | 64 | #endif //COMMONNL_H 65 | 66 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/regset.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: REGSET Header File */ 7 | /* DESCRIPTION: This code is definitions for register setup structs */ 8 | /* */ 9 | /* FILE NAME: REGSET.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef REGSET_H 14 | #define REGSET_H 15 | 16 | #include "OS.h" 17 | #include "types.h" 18 | 19 | typedef enum 20 | { 21 | REGSET_enOverwrite, 22 | REGSET_enAnd, 23 | REGSET_enOr, 24 | REGSET_enXor 25 | } REGSET_tenRegWriteMode; 26 | 27 | typedef struct 28 | { 29 | volatile uint32* reg; 30 | uint32 val; 31 | REGSET_tenRegWriteMode writeMode; 32 | } REGSET_tstReg32Val; 33 | 34 | typedef struct 35 | { 36 | volatile uint16* reg; 37 | uint16 val; 38 | REGSET_tenRegWriteMode writeMode; 39 | } REGSET_tstReg16Val; 40 | 41 | typedef struct 42 | { 43 | volatile uint8* reg; 44 | uint8 val; 45 | REGSET_tenRegWriteMode writeMode; 46 | } REGSET_tstReg8Val; 47 | 48 | 49 | void REGSET_vStart(uint32* const); 50 | void REGSET_vRun(uint32* const); 51 | void REGSET_vTerminate(uint32* const); 52 | void REGSET_vInitReg32(const REGSET_tstReg32Val*); 53 | void REGSET_vInitReg16(const REGSET_tstReg16Val*); 54 | void REGSET_vInitReg8(const REGSET_tstReg8Val*); 55 | 56 | #endif //REGSET_H 57 | 58 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/resm.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #define _RESM_C 13 | 14 | #include "sys.h" 15 | #include "build.h" 16 | #include 17 | 18 | 19 | #include "IOAPI.h" 20 | #include "types.h" 21 | #include "TEPM.h" 22 | #include "RESM.h" 23 | 24 | RESM_tstResource RESM_astResource[IO_Total_Count + RES_Count]; 25 | 26 | void RESM_vStart(uint32* const u32Stat) 27 | { 28 | uint32 u32IDX; 29 | 30 | for (u32IDX = 0; u32IDX < (IO_Total_Count + RES_Count); u32IDX++) 31 | { 32 | RESM_astResource[u32IDX].tClientHandle = (SYSAPI_ttClientHandle)NULL; 33 | } 34 | } 35 | 36 | void RESM_vRun(uint32* const u32Stat) 37 | { 38 | 39 | } 40 | 41 | void RESM_vTerminate(uint32* const u32Stat) 42 | { 43 | 44 | } 45 | 46 | SYSAPI_ttClientHandle RESM_RequestEHIOResource(IOAPI_tenEHIOResource enEHIO, SYSAPI_ttClientHandle tClientHandle) 47 | { 48 | if (((uint32)NULL == RESM_astResource[enEHIO].tClientHandle) 49 | ||(tClientHandle == RESM_astResource[enEHIO].tClientHandle)) 50 | { 51 | RESM_astResource[enEHIO].tClientHandle = tClientHandle; 52 | } 53 | else 54 | { 55 | tClientHandle = (uint32)NULL; 56 | } 57 | 58 | return tClientHandle; 59 | } 60 | 61 | SYSAPI_ttClientHandle RESM_u32GetMasterEHIOResource(IOAPI_tenEHIOResource enEHIOResource) 62 | { 63 | return RESM_astResource[enEHIOResource].tClientHandle; 64 | } 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/resm.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "sys.h" 13 | #include "RESAPI.h" 14 | #include "IOAPI.h" 15 | #include "SYSAPI.h" 16 | 17 | 18 | 19 | #ifndef RESM_H 20 | #define RESM_H 21 | 22 | #include "types.h" 23 | 24 | typedef struct 25 | { 26 | SYSAPI_ttClientHandle tClientHandle; 27 | } RESM_tstResource; 28 | 29 | #define RESM_nMastersMax 10u 30 | 31 | #undef EXTERN 32 | #ifdef _RESM_C 33 | #define EXTERN 34 | #else 35 | #define EXTERN extern 36 | #endif 37 | 38 | EXTERN SYSAPI_ttClientHandle SYSAPI_atMasterHandle[RESM_nMastersMax]; 39 | 40 | void RESM_vStart(uint32* const u32Stat); 41 | void RESM_vRun(uint32* const u32Stat); 42 | void RESM_vTerminate(uint32* const u32Stat); 43 | SYSAPI_ttClientHandle RESM_RequestEHIOResource(IOAPI_tenEHIOResource, SYSAPI_ttClientHandle); 44 | SYSAPI_ttClientHandle RESM_u32GetMasterEHIOResource(IOAPI_tenEHIOResource); 45 | 46 | #endif //RESM_H 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/timer.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TIMER Header File */ 7 | /* DESCRIPTION: This code provides enum definitions for kernel timers */ 8 | /* */ 9 | /* FILE NAME: TIMER.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef TIMER_H 14 | #define TIMER_H 15 | 16 | #include 17 | #include "sys.h" 18 | #include "types.h" 19 | 20 | #define TIMER_nTimerCount 10u 21 | 22 | typedef void ( *tpfTimerCallBack )( void ); 23 | 24 | typedef enum 25 | { 26 | enReset, 27 | enPending, 28 | enExpired 29 | } TIMER_tenState; 30 | 31 | typedef struct 32 | { 33 | TIMER_tenState enState; 34 | uint32 u32AlarmPoint; 35 | tpfTimerCallBack pfCallBack; 36 | } TIMER_tstTimer; 37 | 38 | void TIMER_vStart( uint32* const ); 39 | void TIMER_vRun( uint32* const ); 40 | void TIMER_vTerminate( uint32* const ); 41 | uint32 TIMER_vConfigureAlarm( uint32 const, tpfTimerCallBack ); 42 | uint32 TIMER_vResetAlarm( uint32 const ); 43 | uint32 TIMER_vSetAlarm( uint32 const, sint32 const ); 44 | 45 | #endif // TIMER_H 46 | 47 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/KernelServices/tqueue.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TQUEUE Header File */ 7 | /* DESCRIPTION: This code provides definitions of task queue structs */ 8 | /* */ 9 | /* FILE NAME: TQUEUE.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef _TQUEUE_H 14 | #define _TQUEUE_H 15 | 16 | #include "types.h" 17 | #include "task.h" 18 | #include "TASKAPI.h" 19 | 20 | /* modified linux task queue header */ 21 | typedef void (*pfInterTaskFunction)(void); 22 | 23 | typedef __packed struct 24 | { 25 | struct tq_struct* next; /* linked list of queued tasks */ 26 | struct tq_struct* prev; /* doubly linked list for removal and insertion */ 27 | TASK_tstTask stTask; /* the task */ 28 | } tq_struct; 29 | 30 | typedef struct tq_struct* task_queue; 31 | 32 | 33 | void queue_task(tq_struct* task_pointer, task_queue* task_list); 34 | void run_cooperative_task_queue(task_queue* list, pfInterTaskFunction, uint32* pu32Stat); 35 | void run_thread_task_queue(task_queue* list, pfInterTaskFunction); 36 | 37 | #endif /* _TQUEUE_H */ 38 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/CLIENT.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CLIENT Header File */ 7 | /* DESCRIPTION: This code provides struct and enum definitions for */ 8 | /* client queues and callbacks */ 9 | /* FILE NAME: CLIENT.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef CLIENT_H 14 | #define CLIENT_H 15 | 16 | //#include "PERADC.h" 17 | //#include "ADCAPI.h" 18 | #include "build.h" 19 | #include "CPUAbstract.h" 20 | #include "CQUEUE.h" 21 | #include "declarations.h" 22 | #include "IOAPI.h" 23 | #include "MSG.h" 24 | #include "OS.h" 25 | #include "sys.h" 26 | #include "SYSAPI.h" 27 | #include "task.h" 28 | #include "TASKAPI.h" 29 | #include "TEPM.h" 30 | #include "TEPMAPI.h" 31 | #include "types.h" 32 | //#include "USER.h" 33 | 34 | 35 | #define CLIENT_nUserCBMax 20u 36 | #define CLIENT_nUserAppImageBase 0x00050000u 37 | /*CR1_90*/ 38 | 39 | typedef void (*tpfClientCB)(void*); 40 | typedef int (*tpfUserStart)(void); 41 | 42 | typedef enum 43 | { 44 | TaskQueue_Start, 45 | TaskQueue_Run, 46 | TaskQueue_Terminate, 47 | } CLIENT_tenTaskQueue; 48 | 49 | typedef enum 50 | { 51 | CLIENT_enOK, 52 | CLIENT_enFailQueueFull, 53 | CLIENT_enErrUNK 54 | } CLIENT_tenErr; 55 | 56 | typedef struct 57 | { 58 | tpfClientCB pfCB; 59 | MSG_tstMBX* pstMBX; 60 | } CLIENT_tstCBInfo; 61 | 62 | 63 | void CLIENT_vStart(uint32* const); 64 | CLIENT_tenErr CLIENT_enEnqueueCB(MSG_tstMBX*, tpfClientCB); 65 | SYSAPI_tenSVCResult CLIENT_enAddTask(OS_tenQueueType, SYSAPI_tpfUserTaskFunction, TASKAPI_tenPriority, TASKAPI_tenRateMs); 66 | void CLIENT_vRunUserCBQueue(void); 67 | 68 | #endif //CLIENT_H 69 | 70 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/MSG.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: MSG Header File */ 7 | /* DESCRIPTION: This code provides message struct and enum */ 8 | /* definitions */ 9 | /* FILE NAME: MSG.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef MSG_H 14 | #define MSG_H 15 | 16 | #include "declarations.h" 17 | #include "CPUAbstract.h" 18 | #include "sys.h" 19 | #include "types.h" 20 | 21 | typedef enum 22 | { 23 | MSG_enNone, 24 | MSG_enADCResult, 25 | MSG_enUSERCB, 26 | MSG_enLWIP, 27 | MSG_enTEPMEvent, 28 | MSG_enDiagDataRead, 29 | MSG_enDiagDataWrite, 30 | MSG_enDiagFunctionReq, 31 | MSG_enMSGTypeCount 32 | } MSG_tenMSGType; 33 | 34 | typedef enum 35 | { 36 | MSG_enOK, 37 | MSG_enMBXQueueFull, 38 | MSG_enMBXFull, 39 | MSG_enMBXTimeout, 40 | MSG_enNoMSG, 41 | MSG_enBadMBX, 42 | MSG_enBadMSGType 43 | } MSG_tenMBXErr; 44 | 45 | typedef struct 46 | { 47 | MSG_tenMSGType enMSGType; 48 | void* pstMSG; 49 | } MSG_tstMBX; 50 | 51 | #define MSG_nMBXCount 128u 52 | 53 | 54 | /* Public function definitions */ 55 | void MSG_vStart(uint32* const); 56 | void MSG_vRun(uint32* const); 57 | void MSG_vTerminate(uint32* const); 58 | MSG_tenMBXErr MSG_enMBXNew(MSG_tstMBX**, MSG_tenMSGType); 59 | void MSG_vMBXFree(MSG_tstMBX* const); 60 | void MSG_vMBXPost(MSG_tstMBX* const, void* const); 61 | MSG_tenMBXErr MSG_vMBXTryPost(MSG_tstMBX* const, void* const); 62 | MSG_tenMBXErr MSG_enMBXTryFetchWait(MSG_tstMBX* const, void*); 63 | MSG_tenMBXErr MSG_enMBXTryFetch(MSG_tstMBX* const, void*); 64 | Bool MSG_boMBXValid(MSG_tstMBX* const); 65 | void MSG_boMBXInvalidate(MSG_tstMBX* const); 66 | 67 | #endif //MSG_H 68 | 69 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/OSHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: OS Header File */ 7 | /* DESCRIPTION: This code provides macros that describe the OS task */ 8 | /* schedule and OS enums */ 9 | /* FILE NAME: OS.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef OSHA_H 14 | #define OSHA_H 15 | 16 | #include "tqueue.h" 17 | 18 | void OSHA_vLoadProcessStack(struct tq_struct*); 19 | 20 | 21 | #endif //OSHA_H 22 | 23 | 24 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/stack.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: STACK */ 7 | /* DESCRIPTION: This code is a dummy for future stack functions */ 8 | /* */ 9 | /* FILE NAME: STACK.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include "stack.h" 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/stack.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: STACK Header File */ 7 | /* DESCRIPTION: This code provides struct definition for thread stack */ 8 | /* */ 9 | /* FILE NAME: STACK.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef STACK_H 14 | #define STACK_H 15 | 16 | #include "types.h" 17 | 18 | typedef struct 19 | { 20 | uint32 u32R0; 21 | uint32 u32R1; 22 | uint32 u32R2; 23 | uint32 u32R3; 24 | uint32 u32R12; 25 | uint32 u32LR; 26 | uint32 u32PC; 27 | uint32 u32xPSR; 28 | } STACK_tstStackFrame; 29 | 30 | #endif //STACK_H 31 | 32 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/task.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TASK */ 7 | /* DESCRIPTION: This code provides functions for reporting of tasks */ 8 | /* */ 9 | /* FILE NAME: TASK.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include "TASKAPI.h" 15 | #include "task.h" 16 | 17 | TASK_tsTime TASK_vReportRunTime(struct TASK_tstTask* const pstTask) 18 | { 19 | return pstTask->tsTaskFinished - pstTask->tsTaskStarted; 20 | } 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/task.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TASK Header File */ 7 | /* DESCRIPTION: This code provides definitions of task structs and */ 8 | /* enums */ 9 | /* FILE NAME: TASK.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef TASK_H 14 | #define TASK_H 15 | 16 | #include "types.h" 17 | #include "TASKAPI.h" 18 | 19 | typedef enum 20 | { 21 | enTaskNew, 22 | enTaskRunning, 23 | enTaskReady, 24 | enTaskFinished, 25 | enTaskBlocked 26 | } TASK_tenState; 27 | 28 | typedef enum 29 | { 30 | enTaskFunction, 31 | enTaskCyclic, 32 | enTaskThread 33 | } TASK_tenType; 34 | 35 | typedef enum 36 | { 37 | enTaskPrivileged = 0, 38 | enTaskUnprivileged = 1 39 | } TASK_tenPrivilege; 40 | 41 | typedef uint16 TASK_tID; 42 | typedef uint32 TASK_tsTime; 43 | typedef void* TASK_tProgramCounter; 44 | typedef void* TASK_tStackPointer; 45 | typedef void (*TASK_pfTaskFunction)(uint32* const); 46 | 47 | #pragma GCC diagnostic push 48 | #pragma GCC diagnostic ignored "-Wattributes" 49 | 50 | typedef struct TASK_tstTask 51 | { 52 | TASK_tID tTaskID; //0 53 | TASK_tenType enTaskType; //2 54 | TASKAPI_tenPriority enTaskPriority; //3 55 | TASK_tenState enTaskState; //4 56 | TASKAPI_tenRateMs enTaskRateMS; //5 57 | TASK_pfTaskFunction pfTaskFunction; //6 58 | TASK_tStackPointer tTaskStackPointer; //10 59 | TASK_tProgramCounter tTaskProgramCounter; //14 60 | TASK_tsTime tsTaskQueued; //18 61 | TASK_tsTime tsTaskStarted; //22 62 | TASK_tsTime tsTaskFinished; //26 63 | TASK_tsTime tsTaskAccumulated; //30 64 | TASK_tenPrivilege enPrivilege; //34 65 | } BUILDPACKEDATMEL BUILDTASK_tstTask; 66 | 67 | #pragma GCC diagnostic pop 68 | 69 | TASK_tsTime TASK_vReportRunTime(struct TASK_tstTask* const); 70 | 71 | #endif //TASK_H 72 | 73 | 74 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/thread.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: THREAD */ 7 | /* DESCRIPTION: This code provides thread stack functions */ 8 | /* */ 9 | /* FILE NAME: THREAD.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include "thread.h" 15 | #include "declarations.h" 16 | #include "stack.h" 17 | 18 | typedef struct 19 | { 20 | uint32 u32ThreadStack[SYS_THREAD_STACK_SIZE]; 21 | } THREAD_tastThreadStack; 22 | 23 | THREAD_tastThreadStack THREAD_astThreadStack[SYS_THREAD_MAX]; 24 | tq_struct* THREAD_pstStackOwner[SYS_THREAD_MAX] = { NULL }; 25 | 26 | uint32* THREAD_pu32GetThreadStack(tq_struct* pstStackOwnerTask) 27 | { 28 | uint32 u32StackIDX; 29 | uint32* pu32StackPointer = NULL; 30 | STACK_tstStackFrame* pstStackFrame; 31 | 32 | for(u32StackIDX = 0; u32StackIDX < SYS_THREAD_MAX; u32StackIDX++) 33 | { 34 | if (NULL == THREAD_pstStackOwner[u32StackIDX]) 35 | { 36 | THREAD_pstStackOwner[u32StackIDX] = pstStackOwnerTask; 37 | pu32StackPointer = (uint32*)((uint32)&THREAD_astThreadStack[u32StackIDX] + 38 | (uint32)SYS_THREAD_STACK_SIZE * sizeof(uint32)); 39 | break; 40 | } 41 | } 42 | 43 | /* set the thread entry point at the stack frame program counter 44 | ready for the initial thread context restore */ 45 | pu32StackPointer -= (sizeof(STACK_tstStackFrame) / sizeof(uint32)); 46 | pstStackFrame = (STACK_tstStackFrame*)pu32StackPointer; 47 | pstStackFrame->u32PC = (uint32)pstStackOwnerTask->stTask.tTaskProgramCounter; 48 | 49 | return pu32StackPointer; 50 | } 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/thread.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: THREAD Header File */ 7 | /* DESCRIPTION: This code provides thread stack function declarations */ 8 | /* */ 9 | /* FILE NAME: THREAD.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef THREAD_H 14 | #define THREAD_H 15 | 16 | #include "sys.h" 17 | #include "types.h" 18 | #include "task.h" 19 | #include "TASKAPI.h" 20 | #include "tqueue.h" 21 | 22 | uint32* THREAD_pu32GetThreadStack(struct tq_struct*); 23 | 24 | #endif //THREAD_H 25 | 26 | 27 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/tqueue.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TQUEUE */ 7 | /* DESCRIPTION: This code provides functions for running task queues */ 8 | /* */ 9 | /* FILE NAME: TQUEUE.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include 14 | #include "tqueue.h" 15 | #include "tqueueHA.h" 16 | #include "types.h" 17 | #include "task.h" 18 | #include "CPUAbstract.h" 19 | 20 | void queue_task(tq_struct* task_pointer, task_queue* task_list) 21 | { 22 | task_pointer->next = *task_list; 23 | *task_list = (task_queue)task_pointer; 24 | } 25 | 26 | /* 27 | * Call all tasks in a given list. 28 | */ 29 | void run_cooperative_task_queue(task_queue* list, pfInterTaskFunction pfInterTask, uint32* pu32Stat) 30 | { 31 | tq_struct* p; 32 | tq_struct* save_p; 33 | void (*f)(uint32*); 34 | 35 | p = (struct tq_struct*)*list; 36 | while (p != NULL) 37 | { 38 | f = p -> stTask.pfTaskFunction; // copy the task function pointer 39 | p -> stTask.tsTaskStarted = CPUA_OS_u32GetSysTimeStamp(); 40 | save_p = p; // save the tq_struct 41 | p = (tq_struct*)p -> next; // point to next node 42 | (*f)(pu32Stat); // run the task function 43 | save_p -> stTask.tsTaskFinished = CPUA_OS_u32GetSysTimeStamp(); 44 | *list = (task_queue)p; // update the list 45 | save_p -> next = NULL; // set the old tq_struct->next to NULL 46 | if (NULL != pfInterTask) pfInterTask(); // run the intertask function 47 | } 48 | } 49 | 50 | void TQUEUE_vRunThreadTaskQueue(task_queue* list, pfInterTaskFunction pfInterThread) 51 | { 52 | TQUEUEHA_vRunThreadTaskQueue(list, pfInterThread); 53 | } -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/tqueue.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TQUEUE Header File */ 7 | /* DESCRIPTION: This code provides definitions of task queue structs */ 8 | /* */ 9 | /* FILE NAME: TQUEUE.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef _TQUEUE_H 14 | #define _TQUEUE_H 15 | 16 | #include "types.h" 17 | #include "task.h" 18 | #include "TASKAPI.h" 19 | 20 | /* modified linux task queue header */ 21 | typedef void (*pfInterTaskFunction)(void); 22 | 23 | #pragma GCC diagnostic push 24 | #pragma GCC diagnostic ignored "-Wattributes" 25 | #pragma GCC diagnostic ignored "-Wpacked" 26 | 27 | typedef struct tq_struct 28 | { 29 | struct tq_struct* next; /* linked list of queued tasks */ 30 | struct tq_struct* prev; /* doubly linked list for removal and insertion */ 31 | struct TASK_tstTask stTask; /* the task */ 32 | } BUILDPACKEDATMEL tq_struct; 33 | 34 | #pragma GCC diagnostic pop 35 | 36 | typedef struct tq_struct* task_queue; 37 | 38 | 39 | void queue_task(struct tq_struct* task_pointer, task_queue* task_list); 40 | void run_cooperative_task_queue(task_queue* list, pfInterTaskFunction, uint32* pu32Stat); 41 | void TQUEUE_vRunThreadTaskQueue(task_queue* list, pfInterTaskFunction); 42 | 43 | #endif /* _TQUEUE_H */ 44 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/OS/tqueueHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TQUEUE Header File */ 7 | /* DESCRIPTION: This code provides definitions of task queue structs */ 8 | /* */ 9 | /* FILE NAME: TQUEUEHA.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef _TQUEUEHA_H 14 | #define _TQUEUEHA_H 15 | 16 | #include "tqueue.h" 17 | 18 | void TQUEUEHA_vRunThreadTaskQueue(task_queue* list, pfInterTaskFunction pfInterThread); 19 | 20 | #endif /* _TQUEUEHA_H */ 21 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/CRC16.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CRC16 */ 7 | /* DESCRIPTION: This code provides CRC16 functions */ 8 | /* */ 9 | /* FILE NAME: CRC16.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "CRC16.h" 14 | 15 | uint16 CRC16_u16CRC; 16 | 17 | void CRC16_vStart(uint32* const u32Stat) 18 | { 19 | CRC16HA_vStart(u32Stat); 20 | } 21 | 22 | void CRC16_vRun(uint32* const u32Stat) 23 | { 24 | 25 | } 26 | 27 | void CRC16_vTerminate(uint32* const u32Stat) 28 | { 29 | 30 | } 31 | 32 | uint16 CRC16_u16CalcCRC(uint16 u16CRC, uint8* pu8Data, uint16 u16Len) 33 | { 34 | return CRC16HA_u16CalcCRC(u16CRC, pu8Data, u16Len); 35 | } 36 | 37 | puint16 CRC16_pu16CalcCRC(uint16 u16CRC, uint8* pu8Data, uint16 u16Len) 38 | { 39 | return CRC16HA_pu16CalcCRC(u16CRC, pu8Data, u16Len); 40 | } 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/CRC16.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CRC16 Header Fil */ 7 | /* DESCRIPTION: This code provides CRC16 function definitions */ 8 | /* */ 9 | /* FILE NAME: CRC16.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef CRC16_H 14 | #define CRC16_H 15 | 16 | #include "CRC16HA.h" 17 | #include "types.h" 18 | 19 | void CRC16_vStart(uint32* const); 20 | void CRC16_vRun(uint32* const); 21 | void CRC16_vTerminate(uint32* const); 22 | puint16 CRC16_pu16CalcCRC(uint16, puint8, uint16); 23 | uint16 CRC16_u16CalcCRC(uint16, puint8, uint16); 24 | 25 | #endif //CRC16_H 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/DAC.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "DAC.h" 13 | 14 | DACAPI_tpfEventCB DAC_apfEvent[DACHA_nDACCount]; 15 | 16 | 17 | void DAC_vStart(puint32 const pu32Stat) 18 | { 19 | uint32 u32DACIDX; 20 | 21 | for (u32DACIDX = 0; u32DACIDX < DACHA_nDACCount; u32DACIDX++) 22 | { 23 | DAC_apfEvent[u32DACIDX] = NULL; 24 | } 25 | } 26 | 27 | void DAC_vRun(puint32 const pu32Stat) 28 | { 29 | DACHA_vRun(pu32Stat); 30 | } 31 | 32 | void DAC_vTerminate(puint32 const pu32Stat) 33 | { 34 | 35 | } 36 | 37 | SYSAPI_tenSVCResult DAC_vInitDACResource(IOAPI_tenEHIOResource enEHIOResource, DACAPI_tstDACCB* pstDACCB) 38 | { 39 | return DACHA_vInitDACResource(enEHIOResource, pstDACCB); 40 | } 41 | 42 | void DAC_vWriteDACQueue(IOAPI_tenEHIOResource enEHIOResource, DACAPI_ttOutputVoltage* pOutputVoltage) 43 | { 44 | DACHA_vWriteDACQueue(enEHIOResource, pOutputVoltage); 45 | } 46 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/DAC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef DAC_H 13 | #define DAC_H 14 | 15 | #include "CPUAbstract.h" 16 | #include "DACAPI.h" 17 | #include "DACHA.h" 18 | #include "declarations.h" 19 | #include "IOAPI.h" 20 | #include "os.h" 21 | #include "regset.h" 22 | #include "SIM.h" 23 | #include "SYSAPI.h" 24 | #include "sys.h" 25 | #include "types.h" 26 | 27 | #define DAC_nQueueSize 16u 28 | 29 | void DAC_vStart(puint32 const); 30 | void DAC_vRun(puint32 const); 31 | void DAC_vTerminate(puint32 const); 32 | SYSAPI_tenSVCResult DAC_vInitDACResource(IOAPI_tenEHIOResource, DACAPI_tstDACCB*); 33 | void DAC_vWriteDACQueue(IOAPI_tenEHIOResource, DACAPI_ttOutputVoltage*); 34 | #endif //DAC_H 35 | 36 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/DACHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef DACHA_H 13 | #define DACHA_H 14 | 15 | #include "CPUAbstract.h" 16 | #include "regset.h" 17 | #include "sys.h" 18 | #include "declarations.h" 19 | #include "os.h" 20 | #include "IOAPI.h" 21 | #include "DACAPI.h" 22 | #include "SYSAPI.h" 23 | #include "types.h" 24 | #include "SIM.h" 25 | 26 | #define DACHA_nDACCount 2u 27 | 28 | #ifdef BUILD_MK60 29 | #include "mk60f12.h" 30 | typedef DAC_Type tstDACModule; 31 | #endif 32 | #ifdef BUILD_SAM3X8E 33 | #include "sam3x8e.h" 34 | typedef struct Dacc tstDACModule; 35 | #endif 36 | 37 | void DACHA_vStart(puint32 const); 38 | void DACHA_vRun(puint32 const); 39 | void DACHA_vTerminate(puint32 const); 40 | SYSAPI_tenSVCResult DACHA_vInitDACResource(IOAPI_tenEHIOResource, DACAPI_tstDACCB*); 41 | void DACHA_vWriteDACQueue(IOAPI_tenEHIOResource, DACAPI_ttOutputVoltage*); 42 | #endif //DACHA_H 43 | 44 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/IIC.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "IIC.h" 13 | #include "IICHA.h" 14 | #include "SYSAPI.h" 15 | 16 | 17 | void IIC_vStart(puint32 const pu32Stat) 18 | { 19 | IICHA_vStart(pu32Stat); 20 | } 21 | 22 | void IIC_vRun(puint32 const pu32Stat) 23 | { 24 | 25 | } 26 | 27 | void IIC_vTerminate(puint32 const pu32Stat) 28 | { 29 | 30 | } 31 | 32 | SYSAPI_tenSVCResult IIC_enInitBus(IOAPI_tenEHIOResource enEHIOResource, IOAPI_tstPortConfigCB* pstPortConfigCB) 33 | { 34 | return IICHA_enInitBus(enEHIOResource, pstPortConfigCB); 35 | } 36 | 37 | void IIC_vInitTransfer(IOAPI_tstTransferCB* pstTransferCB) 38 | { 39 | IICHA_vInitTransfer(pstTransferCB); 40 | } 41 | 42 | void IIC_vInterrupt(IOAPI_tenEHIOResource enEHIOResource) 43 | { 44 | IICHA_vInterrupt(enEHIOResource); 45 | } 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/IIC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef IIC_H 13 | #define IIC_H 14 | 15 | #include "IOAPI.h" 16 | #include "SYSAPI.h" 17 | #include "types.h" 18 | 19 | void IIC_vStart(puint32 const); 20 | void IIC_vRun(puint32 const); 21 | void IIC_vTerminate(puint32 const); 22 | SYSAPI_tenSVCResult IIC_enInitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 23 | void IIC_vInitTransfer(IOAPI_tstTransferCB*); 24 | void IIC_vInterrupt(IOAPI_tenEHIOResource); 25 | 26 | #endif //IIC_H 27 | 28 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERCAN.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CAN */ 7 | /* DESCRIPTION: This code provides functions for interacting with */ 8 | /* the CAN hardware module/s */ 9 | /* FILE NAME: CAN.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "PERCAN.h" 14 | 15 | void CAN_vStart(uint32* const u32Stat) 16 | { 17 | 18 | } 19 | 20 | SYSAPI_tenSVCResult CAN_u32InitBus(IOAPI_tenEHIOResource enEHIOResource, IOAPI_tstPortConfigCB* pstPortConfigCB) 21 | { 22 | return CANHA_u32InitBus(enEHIOResource, pstPortConfigCB); 23 | } 24 | 25 | void CAN_vRun(uint32* const u32Stat) 26 | { 27 | //static int i; 28 | //IOAPI_tstTransferCB stTransferCB; 29 | //uint8 au8Data[16] = {8,0,0,0, 0x58,0x7,0,0, 0,0,2,0x7e, 0,0,0,0}; 30 | 31 | //stTransferCB.enEHIOResource = EH_VIO_CAN1; 32 | //stTransferCB.enTransferType = IOAPI_IO_TX; 33 | //stTransferCB.pfCB = NULL; 34 | //stTransferCB.pvData = (void*)&au8Data; 35 | //stTransferCB.u32ByteCount = 12; 36 | 37 | //if (0 == (++i % 0x10)) 38 | //{ 39 | //CANHA_vInitTransfer(&stTransferCB); 40 | //} 41 | } 42 | 43 | Bool CAN_boReadMB(tstCANModule* pstCAN, CANHA_tstCANMB* pstCANMB) 44 | { 45 | return CANHA_boReadMB(pstCAN, pstCANMB); 46 | } 47 | 48 | void CAN_vInterrupt(IOAPI_tenEHIOResource enEHIOResource, void* pvData) 49 | { 50 | CANHA_vInterrupt(enEHIOResource); 51 | } 52 | 53 | void CAN_vInitTransfer(IOAPI_tstTransferCB* pstTransferCB) 54 | { 55 | CANHA_vInitTransfer(pstTransferCB); 56 | } 57 | 58 | void CAN_vTerminate(uint32* const u32Stat) 59 | { 60 | 61 | } 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERCAN.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CAN Header File */ 7 | /* DESCRIPTION: This code provides functions for interacting with */ 8 | /* the CAN hardware module/s */ 9 | /* FILE NAME: CAN.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef CAN_H 14 | #define CAN_H 15 | 16 | #include 17 | #include "CANHA.h" 18 | #include "CPUAbstract.h" 19 | #include "declarations.h" 20 | #include "DLL.h" 21 | #include "IOAPI.h" 22 | #include "IRQ.h" 23 | #include "MATH.h" 24 | #include "CPUAbstract.h" 25 | #include "os.h" 26 | #include "protapi.h" 27 | #include "regset.h" 28 | #include "SIM.h" 29 | #include "types.h" 30 | 31 | 32 | void CAN_vStart(uint32* const); 33 | void CAN_vRun(uint32* const); 34 | void CAN_vTerminate(uint32* const); 35 | void CAN_vInitTransfer(IOAPI_tstTransferCB*); 36 | Bool CAN_boReadMB(tstCANModule*, CANHA_tstCANMB*); 37 | SYSAPI_tenSVCResult CAN_u32InitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 38 | void CAN_vInterrupt(IOAPI_tenEHIOResource, void*); 39 | 40 | #endif //CAN_H 41 | 42 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERSPI.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "PERSPI.h" 13 | #include "SPIHA.h" 14 | #include "SYSAPI.h" 15 | 16 | 17 | void SPI_vStart(puint32 const pu32Stat) 18 | { 19 | SPIHA_vStart(pu32Stat); 20 | } 21 | 22 | void SPI_vRun(puint32 const pu32Stat) 23 | { 24 | 25 | } 26 | 27 | void SPI_vTerminate(puint32 const pu32Stat) 28 | { 29 | 30 | } 31 | 32 | uint32 SPI_u32InitBus(IOAPI_tenEHIOResource enEHIOResource, IOAPI_tstPortConfigCB* pstPortConfigCB) 33 | { 34 | return SPIHA_u32InitBus(enEHIOResource, pstPortConfigCB); 35 | } 36 | 37 | void SPI_vInitTransfer(IOAPI_tstTransferCB* pstTransferCB) 38 | { 39 | SPIHA_vInitTransfer(pstTransferCB); 40 | } 41 | 42 | void SPI_vInterrupt(IOAPI_tenEHIOResource enEHIOResource, void* pvData) 43 | { 44 | SPIHA_vInterruptHandler(enEHIOResource); 45 | } 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERSPI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef SPI_H 13 | #define SPI_H 14 | 15 | #include "IOAPI.h" 16 | #include "SYSAPI.h" 17 | #include "types.h" 18 | 19 | void SPI_vStart(puint32 const); 20 | void SPI_vRun(puint32 const); 21 | void SPI_vTerminate(puint32 const); 22 | uint32 SPI_u32InitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 23 | void SPI_vInitTransfer(IOAPI_tstTransferCB*); 24 | void SPI_vInterrupt(IOAPI_tenEHIOResource, void*); 25 | 26 | #endif //SPI_H 27 | 28 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERUART.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | 13 | #include 14 | #include "CPUAbstract.h" 15 | #include "peruart.h" 16 | 17 | #include "regset.h" 18 | #include "sys.h" 19 | #include "IRQ.h" 20 | #include "declarations.h" 21 | #include "os.h" 22 | #include "DLL.h" 23 | #include "types.h" 24 | #include "SIM.h" 25 | 26 | 27 | void UART_vStart(uint32* const u32Stat) 28 | { 29 | OS_xModuleStartOK(*u32Stat); 30 | } 31 | 32 | void UART_vRun(uint32* const u32Stat) 33 | { 34 | 35 | } 36 | 37 | void UART_vTerminate(uint32* const u32Stat) 38 | { 39 | 40 | } 41 | 42 | SYSAPI_tenSVCResult UART_enInitBus(IOAPI_tenEHIOResource enEHIOResource, IOAPI_tstPortConfigCB* pstPortConfigCB) 43 | { 44 | SYSAPI_tenSVCResult enSVCResult; 45 | 46 | enSVCResult = UARTHA_enInitBus(enEHIOResource, pstPortConfigCB); 47 | 48 | return enSVCResult; 49 | } 50 | 51 | void UART_vSendChar(IOAPI_tenEHIOResource enEHIOResource, uint8 ucData) 52 | { 53 | UARTHA_vSendChar(enEHIOResource, ucData); 54 | } 55 | 56 | uint8 UART_u8GetChar(IOAPI_tenEHIOResource enEHIOResource) 57 | { 58 | return UARTHA_u8GetChar(enEHIOResource); 59 | } 60 | 61 | void UART_vDisableTXInterrupt(IOAPI_tenEHIOResource enEHIOResource) 62 | { 63 | UARTHA_vDisableTXInterrupt(enEHIOResource); 64 | } 65 | 66 | void UART_vEnableTXInterrupt(IOAPI_tenEHIOResource enEHIOResource) 67 | { 68 | UARTHA_vEnableTXInterrupt(enEHIOResource); 69 | } 70 | 71 | void UART_vDisableRXInterrupt(IOAPI_tenEHIOResource enEHIOResource) 72 | { 73 | UARTHA_vDisableRXInterrupt(enEHIOResource); 74 | } 75 | 76 | void UART_vEnableRXInterrupt(IOAPI_tenEHIOResource enEHIOResource) 77 | { 78 | UART_vEnableRXInterrupt(enEHIOResource); 79 | } 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERUART.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef UART_H 13 | #define UART_H 14 | 15 | #include 16 | #include "CPUAbstract.h" 17 | #include "DLL.h" 18 | #include "IOAPI.h" 19 | #include "SIMHA.h" 20 | #include "sys.h" 21 | #include "types.h" 22 | #include "UARTHA.h" 23 | 24 | 25 | typedef struct 26 | { 27 | uint32 u32SourceClockHz; 28 | SIMHA_tenReg enSIMReg; 29 | uint32 u32SIMRegMask; 30 | tstUARTModule* pstUART; 31 | IRQn_Type IRQn; 32 | } UART_tstUARTCB; 33 | 34 | void UART_vStart(uint32* const); 35 | void UART_vRun(uint32* const); 36 | void UART_vTerminate(uint32* const); 37 | SYSAPI_tenSVCResult UART_enInitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 38 | void UART_vSendChar(IOAPI_tenEHIOResource, uint8); 39 | uint8 UART_u8GetChar(IOAPI_tenEHIOResource); 40 | void UART_vDisableTXInterrupt(IOAPI_tenEHIOResource); 41 | void UART_vEnableTXInterrupt(IOAPI_tenEHIOResource); 42 | void UART_vDisableRXInterrupt(IOAPI_tenEHIOResource); 43 | void UART_vEnableRXInterrupt(IOAPI_tenEHIOResource); 44 | 45 | #endif //UART_H 46 | 47 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERUSB.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | 13 | #include 14 | #include "CPUAbstract.h" 15 | #include "perusb.h" 16 | 17 | #include "regset.h" 18 | #include "sys.h" 19 | #include "IRQ.h" 20 | #include "declarations.h" 21 | #include "os.h" 22 | #include "DLL.h" 23 | #include "types.h" 24 | #include "SIM.h" 25 | 26 | 27 | void USB_vStart(uint32* const u32Stat) 28 | { 29 | OS_xModuleStartOK(*u32Stat); 30 | } 31 | 32 | void USB_vRun(uint32* const u32Stat) 33 | { 34 | 35 | } 36 | 37 | void USB_vTerminate(uint32* const u32Stat) 38 | { 39 | 40 | } 41 | 42 | SYSAPI_tenSVCResult USB_enInitBus(IOAPI_tenEHIOResource enEHIOResource, IOAPI_tstPortConfigCB* pstPortConfigCB) 43 | { 44 | SYSAPI_tenSVCResult enSVCResult; 45 | 46 | enSVCResult = USBHA_enInitBus(enEHIOResource, pstPortConfigCB); 47 | 48 | return enSVCResult; 49 | } 50 | 51 | void USB_vSend(IOAPI_tenEHIOResource enEHIOResource, uint8* pu8Data, uint32 u32TXByteCount) 52 | { 53 | USBHA_vSend(enEHIOResource, pu8Data, u32TXByteCount); 54 | } 55 | 56 | puint8 USB_pu8Receive(IOAPI_tenEHIOResource enEHIOResource) 57 | { 58 | return USBHA_pu8Receive(enEHIOResource); 59 | } 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERUSB.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef PERUSB_H 13 | #define PERUSB_H 14 | 15 | #include 16 | #include "CPUAbstract.h" 17 | #include "DLL.h" 18 | #include "IOAPI.h" 19 | #include "SIMHA.h" 20 | #include "sys.h" 21 | #include "types.h" 22 | #include "USBHA.h" 23 | 24 | 25 | typedef struct 26 | { 27 | uint32 u32SourceClockHz; 28 | SIMHA_tenReg enSIMReg; 29 | uint32 u32SIMRegMask; 30 | IRQn_Type IRQn; 31 | } USB_tstUSBCB; 32 | 33 | void USB_vStart(uint32* const); 34 | void USB_vRun(uint32* const); 35 | void USB_vTerminate(uint32* const); 36 | SYSAPI_tenSVCResult USB_enInitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 37 | void USB_vSend(IOAPI_tenEHIOResource, puint8, uint32); 38 | puint8 USB_pu8Receive(IOAPI_tenEHIOResource); 39 | 40 | 41 | #endif //PERUSB_H 42 | 43 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERWDT.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: WDT */ 7 | /* DESCRIPTION: This code provides watchdog functions */ 8 | /* */ 9 | /* FILE NAME: PERWDT.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "PERWDT.h" 14 | 15 | void WDT_vStart(uint16 u16ResetVal, uint16 u16WindowVal) 16 | { 17 | WDTHA_vStart(u16ResetVal, u16WindowVal); 18 | } 19 | 20 | Bool WDT_boReset(uint16 u16InputVal) 21 | { 22 | return WDTHA_boReset(u16InputVal); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/PERWDT.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: WDT header file */ 7 | /* DESCRIPTION: This code provides wathdog functions */ 8 | /* */ 9 | /* FILE NAME: PERWDT.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef PERWDT_H 14 | #define PERWDT_H 15 | 16 | #include "types.h" 17 | #include "WDTHA.h" 18 | 19 | void WDT_vStart(uint16, uint16); 20 | Bool WDT_boReset(uint16); 21 | 22 | #endif //PERWDT_H 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/SDHC.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SDHC */ 7 | /* DESCRIPTION: This code provides setup and functions for the SDHC */ 8 | /* hardware module */ 9 | /* FILE NAME: SDHC.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "types.h" 14 | #include "CPUAbstract.h" 15 | #include "regset.h" 16 | #include "declarations.h" 17 | //#include "OS.h" 18 | #include "disk.h" 19 | #include "sdhc.h" 20 | #include "timer.h" 21 | #include "sim.h" 22 | #include "SDHCHA.h" 23 | 24 | 25 | void SDHC_vStart(uint32* const pu32Stat) 26 | { 27 | SDHCHA_vStart(pu32Stat) ; 28 | OS_xModuleStartOK(*pu32Stat); 29 | //SDHC__vCardInitialise(); 30 | } 31 | 32 | void SDHC_vRun(uint32* const pu32Stat) 33 | { 34 | SDHCHA_vRun(pu32Stat); 35 | } 36 | 37 | void SDHC_vTerminate(uint32* const pu32Stat) 38 | { 39 | SDHC_vTerminate(pu32Stat); 40 | } 41 | 42 | void SDHC_vHWInit(void) 43 | { 44 | SDHCHA_vHWInit(); 45 | } 46 | 47 | void SDHC_vHWDeInit(void) 48 | { 49 | SDHC_vHWDeInit(); 50 | } 51 | 52 | uint8 SDHC_u8DiskRead(uint8* const pu8Buf, const uint32 u32Sector, const uint16 u16SectorCount) 53 | { 54 | SDHC_u8DiskRead(pu8Buf, u32Sector, u16SectorCount); 55 | 56 | return 0; 57 | } 58 | 59 | uint8 SDHC_u8DiskWrite(uint8* const pu8Buf, const uint32 u32Sector, const uint16 u16SectorCount) 60 | { 61 | return 0; 62 | } 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/SDHC.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SDHC Header File */ 7 | /* DESCRIPTION: This code provides macros for setup and control of the */ 8 | /* SDHC hardware module */ 9 | /* FILE NAME: SDHC.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef SDHC_H 14 | #define SDHC_H 15 | 16 | #include "types.h" 17 | 18 | 19 | void SDHC_vStart(uint32* const); 20 | void SDHC_vRun(uint32* const); 21 | void SDHC_vTerminate(uint32* const); 22 | void SDHC_vHWInit(void); 23 | void SDHC_vHWDeInit(void); 24 | uint8 SDHC_u8DiskRead(uint8* const, const uint32, const uint16); 25 | uint8 SDHC_u8DiskWrite(uint8* const, const uint32, const uint16); 26 | 27 | 28 | #endif //SDHC_H 29 | 30 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/SRLTFR.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SRLTFR */ 7 | /* DESCRIPTION: Serial Transfer header file */ 8 | /* FILE NAME: SRLTFR.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef SRLTFR_H 13 | #define SRLTFR_H 14 | 15 | #include 16 | #include "sys.h" 17 | #include "types.h" 18 | #include "CQUEUE.h" 19 | 20 | #define SRLTFR_nTransfersMax 256u 21 | 22 | #ifdef _SRLTFR_C 23 | #define EXTERN 24 | #else 25 | #define EXTERN extern 26 | #endif 27 | 28 | EXTERN IOAPI_tstTransferCB astTransferInfo[SRLTFR_nTransfersMax]; 29 | EXTERN CQUEUE_tstQueue stTransferQueue; 30 | 31 | void SRLTFR_vStart(uint32* const); 32 | void SRLTFR_vRun(uint32* const); 33 | void SRLTFR_vTerminate(uint32* const); 34 | SYSAPI_tenSVCResult SRLTFR_enEnqueue(IOAPI_tstTransferCB*); 35 | void SRLTFR_vNotifyCB(IOAPI_tenEHIOResource); 36 | 37 | 38 | #endif //CAN_H 39 | 40 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/UARTHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: UARTHA Header File */ 7 | /* DESCRIPTION: UART Hardware Adaption */ 8 | /* FILE NAME: UART.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef UARTHA_H 13 | #define UARTHA_H 14 | 15 | #ifdef BUILD_MK60 16 | #include "mk60f12.h" 17 | typedef UART_Type tstUARTModule; 18 | #endif 19 | 20 | #ifdef BUILD_SAM3X8E 21 | //#include "sam3x8e.h" 22 | typedef struct Uart tstUARTModule; 23 | #endif 24 | 25 | #ifdef BUILD_MK60 26 | #define UARTHA_nDataCB \ 27 | { \ 28 | {SYS_FREQ_CORE, SIM_SCGC4, SIM_SCGC4_UART0_MASK, UART0, UART0_RX_TX_IRQn}, \ 29 | {SYS_FREQ_BUS, SIM_SCGC4, SIM_SCGC4_UART1_MASK, UART1, UART1_RX_TX_IRQn}, \ 30 | {SYS_FREQ_BUS, SIM_SCGC4, SIM_SCGC4_UART2_MASK, UART2, UART2_RX_TX_IRQn}, \ 31 | {SYS_FREQ_BUS, SIM_SCGC4, SIM_SCGC4_UART3_MASK, UART3, UART3_RX_TX_IRQn}, \ 32 | {SYS_FREQ_BUS, SIM_SCGC1, SIM_SCGC1_UART4_MASK, UART4, UART4_RX_TX_IRQn}, \ 33 | {SYS_FREQ_BUS, SIM_SCGC1, SIM_SCGC1_UART5_MASK, UART5, UART5_RX_TX_IRQn} \ 34 | } 35 | #endif 36 | 37 | #ifdef BUILD_SAM3X8E 38 | #define UARTHA_nDataCB \ 39 | { \ 40 | {0, 0, 0, 0, 0} \ 41 | } 42 | #endif //BUILD_SAM3X8E 43 | 44 | void UARTHA_vStart(uint32* const); 45 | void UARTHA_vRun(uint32* const); 46 | void UARTHA_vTerminate(uint32* const); 47 | SYSAPI_tenSVCResult UARTHA_enInitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 48 | void UARTHA_vSendChar(IOAPI_tenEHIOResource, uint8); 49 | uint8 UARTHA_u8GetChar(IOAPI_tenEHIOResource); 50 | void UARTHA_vDisableTXInterrupt(IOAPI_tenEHIOResource); 51 | void UARTHA_vEnableTXInterrupt(IOAPI_tenEHIOResource); 52 | void UARTHA_vDisableRXInterrupt(IOAPI_tenEHIOResource); 53 | void UARTHA_vEnableRXInterrupt(IOAPI_tenEHIOResource); 54 | 55 | 56 | #endif //UARTHA_H 57 | 58 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/USBHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: USBHA Header File */ 7 | /* DESCRIPTION: USB Hardware Adaption */ 8 | /* FILE NAME: USB.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef USBHA_H 13 | #define USBHA_H 14 | 15 | #ifdef BUILD_MK60 16 | #include "mk60f12.h" 17 | typedef USB_Type tstUARTModule; 18 | #endif 19 | 20 | #ifdef BUILD_SAM3X8E 21 | //#include "sam3x8e.h" 22 | typedef struct Uart tstUARTModule; 23 | #endif 24 | 25 | #ifdef BUILD_MK60 26 | #define USBHA_nDataCB \ 27 | { \ 28 | } 29 | #endif 30 | 31 | #ifdef BUILD_SAM3X8E 32 | #define UARTHA_nDataCB \ 33 | { \ 34 | {0, 0, 0, 0, 0} \ 35 | } 36 | #endif //BUILD_SAM3X8E 37 | 38 | void USBHA_vStart(uint32* const); 39 | void USBHA_vRun(uint32* const); 40 | void USBHA_vTerminate(uint32* const); 41 | SYSAPI_tenSVCResult USBHA_enInitBus(IOAPI_tenEHIOResource, IOAPI_tstPortConfigCB*); 42 | void USBHA_vSend(IOAPI_tenEHIOResource, puint8, uint32); 43 | puint8 USBHA_pu8Receive(IOAPI_tenEHIOResource); 44 | 45 | 46 | 47 | #endif //USBHA_H 48 | 49 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/WDTHA.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: WDTHA */ 7 | /* DESCRIPTION: This code provides watchdog functions abstraction */ 8 | /* layer */ 9 | /* FILE NAME: WDTHA.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "WDTHA.h" 14 | 15 | void WDTHA_vStart(uint16 u16ResetVal, uint16 u16WindowVal) 16 | { 17 | Wdt* pstWDT = WDT; 18 | uint32 u32Mode = 0; 19 | 20 | if (0 == u16ResetVal) 21 | { 22 | u32Mode = WDT_MR_WDDIS; 23 | } 24 | 25 | wdt_init(pstWDT, u32Mode, u16ResetVal, u16WindowVal); 26 | } 27 | 28 | Bool WDTHA_boReset(uint16 u32InputVal) 29 | { 30 | Wdt* pstWDT = WDT; 31 | 32 | wdt_restart(pstWDT); 33 | 34 | return TRUE; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/WDTHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: WDTHA header file */ 7 | /* DESCRIPTION: This code provides watchdog functions abstraction */ 8 | /* layer */ 9 | /* FILE NAME: WDTHA.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef WDTHA_H 14 | #define WDTHA_H 15 | 16 | #include "types.h" 17 | #include "declarations.h" 18 | #include "wdt.h" 19 | 20 | void WDTHA_vStart(uint16, uint16); 21 | Bool WDTHA_boReset(uint16); 22 | 23 | #endif //WDTHA_H 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/WIFI.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "WIFI.h" 13 | 14 | void WIFI_vStart(uint32* const u32Stat) 15 | { 16 | 17 | } 18 | 19 | void WIFI_vRun(uint32* const u32Stat) 20 | { 21 | 22 | } 23 | 24 | void WIFI_vTerminate(uint32* const u32Stat) 25 | { 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/WIFI.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef WIFI_H 13 | #define WIFI_H 14 | 15 | #include "types.h" 16 | 17 | void WIFI_vStart(uint32* const); 18 | void WIFI_vRun(uint32* const); 19 | void WIFI_vTerminate(uint32* const); 20 | 21 | 22 | #endif // WIFI_H 23 | 24 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/peradc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: ADC Header File */ 7 | /* DESCRIPTION: ADC */ 8 | /* FILE NAME: ADC.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef PERADC_H 13 | #define PERADC_H 14 | 15 | #include "ADCAPI.h" 16 | #include "IOAPI.h" 17 | #include "SYSAPI.h" 18 | #include "types.h" 19 | 20 | #define ADC_nCalFromRecord 1 21 | 22 | typedef enum 23 | { 24 | ADC_enqueueChannelErr, 25 | ADC_enqueueQueueFullErr 26 | } ADC_tenEnqueueErr; 27 | 28 | 29 | typedef struct 30 | { 31 | IOAPI_tenEHIOResource enEHIOResource; 32 | uint32 u32Result; 33 | } ADC_tstADCResult; 34 | 35 | 36 | #define ADC_nConversionsMax 10u 37 | #define ADC_nChannels IO_AD_Count 38 | 39 | void ADC_vStart(uint32* const); 40 | void ADC_vRun(uint32* const); 41 | void ADC_vTerminate(uint32* const); 42 | void ADC_vInterruptHandler(IOAPI_tenEHIOResource, void*); 43 | SYSAPI_tenSVCResult ADC_vInitADCResource(IOAPI_tenEHIOResource, IOAPI_tenEHIOType, ADCAPI_tstADCCB*); 44 | Bool ADC_vTriggerQueue(ADCAPI_tenTrigger); 45 | Bool ADC_boBackupCalibrations(void); 46 | void ADC_vRunConversionQueueHAs(void); 47 | 48 | #endif //PERADC_H 49 | 50 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/time.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TIME */ 7 | /* DESCRIPTION: This code provides setup and functions for the RTC */ 8 | /* hardware module */ 9 | /* FILE NAME: TIME.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include 15 | #include "TIME.h" 16 | 17 | void TIME_vStart(uint32* const pu32Stat) 18 | { 19 | OS_xModuleStartOK(*pu32Stat); 20 | } 21 | 22 | void TIME_vRun(uint32* const pu32Stat) 23 | { 24 | 25 | } 26 | 27 | void TIME_vTerminate(uint32* const pu32Stat) 28 | { 29 | 30 | } 31 | 32 | Bool TIME_stGetTime(tstTime* const pstTime) 33 | { 34 | return true; 35 | } 36 | 37 | uint32 TIME_u32GetFATTime(void) 38 | { 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Peripherals/time.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: TIME Header File */ 7 | /* DESCRIPTION: This code provides struct definitions for the RTC */ 8 | /* hardware module */ 9 | /* FILE NAME: TIME.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef TIME_H 14 | #define TIME_H 15 | 16 | #include "declarations.h" 17 | #include "CPUAbstract.h" 18 | #include "os.h" 19 | #include "sys.h" 20 | #include "time.h" 21 | 22 | 23 | typedef struct 24 | { 25 | uint32 biYear:7; 26 | uint32 biMonth:4; 27 | uint32 biDay:5; 28 | uint32 biHours:5; 29 | uint32 biMinutes:6; 30 | uint32 biSeconds:5; 31 | } tstTime; 32 | 33 | 34 | void TIME_vStart(uint32* const); 35 | void TIME_vRun(uint32* const); 36 | void TIME_vTerminate(uint32* const); 37 | Bool TIME_stGetTime(tstTime* const); 38 | uint32 TIME_u32GetFATTime(void); 39 | 40 | #endif //TIME_H 41 | 42 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/README.txt: -------------------------------------------------------------------------------- 1 | This code is the operating system files for the ECUHost open automotive operating system. The first release is for Kinetis MK60, future revisions will be incorporate other ARM Cortex micros. 2 | The code compiles to a monolithic kernel that provides all of the services needed for an automotive controller such as timers, analog I/O, comms, memory, RT tasks, threads, etc. 3 | The application code resides in a seperate project. The interraction between application code and kernel is via system calls, pointers to shared data and callbacks. This project was compiled in Keil UV4 for MK60. -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Suites/UDS/include/UDSNL.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef UDSNL_H 13 | #define UDSNL_H 14 | 15 | #include "COMMONNL.h" 16 | #include "UDSAL.h" 17 | 18 | #define UDSNL_SMALL_BUFF_SIZE 8u 19 | #define UDSNL_RX_BUFF_LARGE_SIZE 1030u 20 | #define UDSNL_TX_BUFF_LARGE_SIZE 258u 21 | #define UDSNL_nActiveResourceTimeout 5000u 22 | 23 | 24 | typedef enum 25 | { 26 | UDSNL_enSegRXModeSmall, 27 | UDSNL_enSegRXModeLarge, 28 | UDSNL_enSegRXModeInvalid, 29 | USDNL_enSegRXErr 30 | } UDSNL_tenSegRXMode; 31 | 32 | #ifdef EXTERN 33 | #undef EXTERN 34 | #endif 35 | #ifdef _UDSNL_C 36 | #define EXTERN 37 | #else 38 | #define EXTERN extern 39 | #endif 40 | 41 | EXTERN COMMONNL_tstRXLargeBuffer UDSNL_stRXLargeBuffer; 42 | EXTERN COMMONNL_tstTXLargeBuffer UDSNL_stTXLargeBuffer; 43 | EXTERN COMMONNL_tstRXSmallBuffer UDSNL_stRXSmallBuffer; 44 | EXTERN COMMONNL_tstTXSmallBuffer UDSNL_stTXSmallBuffer; 45 | 46 | void UDSNL_vStart(void); 47 | void UDSNL_vReceiveFrame(IOAPI_tenEHIOResource, puint8, puint8, puint32, uint32); 48 | void UDSNL_vActiveResourceTimeout(void); 49 | uint32 UDSNL_u32GetTransmissionBytesRequired(uint32); 50 | 51 | #endif //UDSNL_H 52 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Suites/UDS/include/UDSSL.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef UDSSL_H 13 | #define UDSSL_H 14 | 15 | #include "COMMONNL.h" 16 | #include "DECLARATIONS.h" 17 | #include "DIAGAPI.h" 18 | #include "DLL.h" 19 | #include "TIMER.h" 20 | #include "TYPES.h" 21 | #include "OS.h" 22 | #include "UDSAL.h" 23 | #include "UDSNL.h" 24 | 25 | //buffer index breakdown 26 | #define UDSSL_IDX_LEN 0x00 27 | #define UDSSL_IDX_SID 0x01 28 | #define UDSSL_IDX_SUBSID 0x02 29 | 30 | //UDS session definitions 31 | #define UDSSL_SESS_DFLT 0x81 32 | #define UDSSL_SESS_PGM 0x85 33 | #define UDSSL_SESS_EXT 0x87 34 | 35 | #define UDSSL_nSessionTimeout 5000u 36 | 37 | 38 | typedef struct 39 | { 40 | uint32 u32TimerIDX; 41 | DIAGAPI_tenSession enSession; 42 | } UDSSL_tstSessionCB; 43 | 44 | void UDSSL_vStart(void); 45 | void UDSSL_vProcessBufferCB(puint8, uint32, puint8, puint32, uint32); 46 | DIAGAPI_tenSession UDSSL_enGetSession(void); 47 | void UDSSL_vResetSessionTimer(void); 48 | void UDSSL_vSessionTimeout(void); 49 | 50 | #endif //UDSSL_H 51 | 52 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Support/MATH.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: MATH */ 7 | /* DESCRIPTION: This code provides math support for indexing etc */ 8 | /* */ 9 | /* FILE NAME: MATH.c */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | 14 | #include "MATH.h" 15 | 16 | const uint32 MATH_rau32B[] = 17 | { 0xAAAAAAAA, 18 | 0xCCCCCCCC, 19 | 0xF0F0F0F0, 20 | 0xFF00FF00, 21 | 0xFFFF0000 }; 22 | 23 | const uint32 MATH_rauIDXToMask[] = 24 | { 25 | 0x00000001, 26 | 0x00000002, 27 | 0x00000004, 28 | 0x00000008, 29 | 0x00000010, 30 | 0x00000020, 31 | 0x00000040, 32 | 0x00000080, 33 | 0x00000100, 34 | 0x00000200, 35 | 0x00000400, 36 | 0x00000800, 37 | 0x00001000, 38 | 0x00002000, 39 | 0x00004000, 40 | 0x00008000, 41 | 0x00010000, 42 | 0x00020000, 43 | 0x00040000, 44 | 0x00080000, 45 | 0x00100000, 46 | 0x00200000, 47 | 0x00400000, 48 | 0x00800000, 49 | 0x01000000, 50 | 0x02000000, 51 | 0x04000000, 52 | 0x08000000, 53 | 0x10000000, 54 | 0x20000000, 55 | 0x40000000, 56 | 0x80000000 57 | }; 58 | 59 | uint32 MATH_u32MaskToIDX(uint32 u32Mask) 60 | { 61 | uint32 u32R = ( u32Mask & MATH_rau32B[0]) != 0; 62 | 63 | u32R |= ((u32Mask & MATH_rau32B[4]) != 0) << 4; 64 | u32R |= ((u32Mask & MATH_rau32B[3]) != 0) << 3; 65 | u32R |= ((u32Mask & MATH_rau32B[2]) != 0) << 2; 66 | u32R |= ((u32Mask & MATH_rau32B[1]) != 0) << 1; 67 | 68 | return u32R; 69 | } 70 | 71 | uint32 MATH_u32IDXToMask(uint32 u32IDX) 72 | { 73 | return MATH_rauIDXToMask[u32IDX]; 74 | } 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Support/MATH.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: MATH Header File */ 7 | /* DESCRIPTION: This code provides math support function declarations */ 8 | /* */ 9 | /* FILE NAME: MATH.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef MATH_H 14 | #define MATH_H 15 | 16 | #include "types.h" 17 | 18 | uint32 MATH_u32MaskToIDX(uint32); 19 | uint32 MATH_u32IDXToMask(uint32); 20 | #endif //MATH_H 21 | 22 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Support/declarations.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: Declarations Header File */ 7 | /* DESCRIPTION: This code provides various required declarations */ 8 | /* */ 9 | /* FILE NAME: declarations.h */ 10 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef DECLARATIONS_H 14 | #define DECLARATIONS_H 15 | 16 | 17 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 18 | #ifndef NULL 19 | #define NULL ((void*)0) 20 | #endif 21 | /*CR1_98*/ 22 | 23 | #ifndef true 24 | #define true 1 25 | #endif 26 | /*CR1_99*/ 27 | 28 | #ifndef false 29 | #define false 0 30 | #endif 31 | /*CR1_99*/ 32 | 33 | 34 | #ifndef FALSE 35 | #define FALSE false 36 | #endif 37 | 38 | #ifndef TRUE 39 | #define TRUE true 40 | #endif 41 | 42 | #define nASCII_CR 0x0d 43 | #define nASCII_LF 0x0a 44 | 45 | 46 | #define MIN(a, b) ((a) > (b)) ? (b) : (a) 47 | #define MAX(a, b) ((a) < (b)) ? (b) : (a) 48 | #define ABS(a) (((a) > 0) ? (a) : (-a)) 49 | 50 | 51 | #endif //DECLARATIONS_H 52 | 53 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/Support/macros.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef MACROS_H 13 | #define MACROS_H 14 | 15 | #include "types.h" 16 | 17 | //TODO porting does not belong here 18 | #define PORT_HOSTNETWORK_ENDIANSWITCH 19 | 20 | #define U32TOBYTE3(x) (uint8)(((uint32)(x) >> 24) & 0xff) 21 | #define U32TOBYTE2(x) (uint8)(((uint32)(x) >> 16) & 0xff) 22 | #define U32TOBYTE1(x) (uint8)(((uint32)(x) >> 8) & 0xff) 23 | #define U32TOBYTE0(x) (uint8)(((uint32)(x) >> 0) & 0xff) 24 | 25 | #define U16TOBYTE1(x) (uint8)(((uint16)(x) >> 8) & 0xff) 26 | #define U16TOBYTE0(x) (uint8)(((uint16)(x) >> 0) & 0xff) 27 | 28 | #ifdef PORT_HOSTNETWORK_ENDIANSWITCH 29 | #define HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) 30 | #define NTOHS(x) HTONS(x) 31 | #define HTONL(x) ((((x) & 0xff) << 24) | \ 32 | (((x) & 0xff00) << 8) | \ 33 | (((x) & 0xff0000UL) >> 8) | \ 34 | (((x) & 0xff000000UL) >> 24)) 35 | #define NTOHL(x) HTONL(x) 36 | #else 37 | #define HTONS(x) (x) 38 | #define NTOHS(x) (x) 39 | #define HTONL(x) (x) 40 | #define NTOHL(x) (x) 41 | #endif //PORT_HOSTNETWORK_ENDIANSWITCH 42 | 43 | #endif //MACROS_H 44 | 45 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/CPUAbstract.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.c */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | 13 | #include "CPUAbstract.h" 14 | #include "types.h" 15 | 16 | Bool CPU_boCriticalNestCounter; 17 | 18 | void CPU_vStart(void) 19 | { 20 | CPU_boCriticalNestCounter = 0; 21 | } 22 | 23 | void CPU_vEnterCritical(void) 24 | { 25 | CPU_xEnterCritical(); 26 | //CPU_boCriticalNestCounter++; 27 | } 28 | 29 | void CPU_vExitCritical(void) 30 | { 31 | //if (1 == CPU_boCriticalNestCounter) 32 | //{ 33 | CPU_xExitCritical(); 34 | // CPU_boCriticalNestCounter = 0; 35 | //} 36 | //else 37 | //{ 38 | // CPU_boCriticalNestCounter--; 39 | //} 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/CPUAbstract.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: CPUAbstract Header File */ 7 | /* DESCRIPTION: This code provides high level CPU abstraction macros */ 8 | /* */ 9 | /* FILE NAME: CPUAbstract.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "sys.h" 14 | #include "types.h" 15 | 16 | #ifndef HARDABSTRACT_H 17 | #define HARDABSTRACT_H 18 | 19 | #ifdef BUILD_MK60 20 | #include "mk60f12.h" 21 | #endif 22 | #ifdef BUILD_SAM3X8E 23 | #include "sam3xa.h" 24 | #endif 25 | 26 | #define CPUA_OS_u32GetSysTimeStamp() 0xFFFFFF; //TODO 27 | 28 | #define CPU_xEnterCritical() __disable_irq() 29 | #define CPU_xExitCritical() __enable_irq() 30 | 31 | void CPU_vStart(void); 32 | void CPU_vEnterCritical(void); 33 | void CPU_vExitCritical(void); 34 | 35 | #endif //HARDABSTRACT_H 36 | 37 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/IRQ.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: IRQ Header File */ 7 | /* DESCRIPTION: This code is interrupt common function definitions */ 8 | /* */ 9 | /* FILE NAME: IRQ.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef IRQ_H 14 | #define IRQ_H 15 | 16 | #include "build.h" 17 | #include "CANHA.h" 18 | #include "CPUAbstract.h" 19 | #include "declarations.h" 20 | #include "dll.h" 21 | #include "IOAPI.h" 22 | #include "math.h" 23 | #include "PERCAN.h" 24 | #include "SYSAPI.h" 25 | #include "UARTHA.h" 26 | #include "uotghs_device.h" 27 | 28 | typedef void (*IRQRXCallBack)(IOAPI_tenEHIOResource, void*); 29 | typedef void (*IRQTXCallBack)(IOAPI_tenEHIOResource, void*); 30 | 31 | typedef enum 32 | { 33 | IRQ_enPRIO_0, 34 | IRQ_enPRIO_1, 35 | IRQ_enPRIO_2, 36 | IRQ_enPRIO_3, 37 | IRQ_enPRIO_4, 38 | IRQ_enPRIO_5, 39 | IRQ_enPRIO_6, 40 | IRQ_enPRIO_7, 41 | IRQ_enPRIO_8, 42 | IRQ_enPRIO_9, 43 | IRQ_enPRIO_10, 44 | IRQ_enPRIO_11, 45 | IRQ_enPRIO_12, 46 | IRQ_enPRIO_13, 47 | IRQ_enPRIO_14, 48 | IRQ_enPRIO_15 49 | } IRQ_tenPRIO; 50 | 51 | void IRQ_vEnableIRQ(IRQn_Type, IRQ_tenPRIO, IRQRXCallBack, IRQTXCallBack); 52 | void IRQ_vDisableIRQ(IRQn_Type); 53 | void IRQ_vReset(void); 54 | void IRQ_vEnableRTOS(Bool boEnable); 55 | 56 | #endif //IRQ_H 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/IRQHA.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: IRQ Header File */ 7 | /* DESCRIPTION: This code is interrupt common function definitions */ 8 | /* */ 9 | /* FILE NAME: IRQ.h */ 10 | /* REVISION HISTORY: 28-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #include "sys.h" 14 | #ifdef KERNEL 15 | 16 | #ifndef IRQ_H 17 | #define IRQ_H 18 | 19 | #include "ADC.h" 20 | #include "build.h" 21 | #include "CANHA.h" 22 | #include "CLIENT.h" 23 | #include "declarations.h" 24 | #include "dll.h" 25 | #include "ENE.h" 26 | #include "IOAPI.h" 27 | #include "IIC.h" 28 | #include "math.h" 29 | #include "MSG.h" 30 | #include "OS.h" 31 | #include "SYSAPI.h" 32 | #include "TEPM.h" 33 | #include "timer.h" 34 | #include "tqueue.h" 35 | #include "UART.h" 36 | //#include "UDSAL.h" 37 | 38 | 39 | void IRQ_vEnableIRQ(IRQn_Type); 40 | void IRQ_vDisableIRQ(IRQn_Type); 41 | void IRQ_vCommonUART(tstUARTModule*, IOAPI_tenEHIOResource); 42 | void IRQ_vCommonCAN(CAN_Type*, IOAPI_tenEHIOResource); 43 | 44 | #endif // IRQ_H 45 | 46 | #endif // KERNEL 47 | 48 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/SYSAbstract.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #include "sys.h" 13 | #include "time.h" 14 | 15 | 16 | #ifndef SYSABSTRACT_H 17 | #define SYSABSTRACT_H 18 | 19 | #include "CPUAbstract.h" 20 | #define get_fattime TIME_u32GetFATTime 21 | 22 | 23 | #endif //SYSABSTRACT_H 24 | 25 | 26 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/sys.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: SYS Header File */ 7 | /* DESCRIPTION: This code various system for oscillator and bus */ 8 | /* frequencies, kernel thread memory usage etc */ 9 | /* FILE NAME: sys.h */ 10 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef SYS_H 14 | #define SYS_H 15 | 16 | #include "types.h" 17 | 18 | 19 | /* GLOBAL MACRO DEFINITIONS ***************************************************/ 20 | #define KERNEL 21 | //#define DEBUG 22 | #define SYS_TASK_PRIORITISE 23 | 24 | #if defined(BUILD_SAM3X8E) && defined(BUILD_ARDUINO_DUE) 25 | #define SYS_FREQ_OSC (12000000u) 26 | #define SYS_FREQ_PLL (168000000u) 27 | #define SYS_BUS_CLK_DIV (2u) 28 | #endif 29 | 30 | #if defined(BUILD_MK60) && defined(BUILD_ECUHOST_1_4) 31 | #define SYS_FREQ_OSC (50000000u) 32 | #define SYS_FREQ_PLL (100000000u) 33 | #define SYS_BUS_CLK_DIV (2u) 34 | #define SYS_FLEXBUS_CLK_DIV (2u) 35 | #define SYS_FLASH_CLK_DIV (4u) 36 | #define SYS_FREQ_FLEXBUS (SYS_FREQ_PLL / SYS_FLEXBUS_CLK_DIV) 37 | #define SYS_FREQ_FLASH (SYS_FREQ_PLL / SYS_FLASH_CLK_DIV) 38 | #endif 39 | 40 | #define SYS_FREQ_NS_IN_1S (1000000000u) 41 | #define SYS_FREQ_BUS (SYS_FREQ_PLL / SYS_BUS_CLK_DIV) 42 | 43 | 44 | #define SYS_PERIOD_OSC_nS (SYS_FREQ_NS_IN_1S / SYS_FREQ_OSC) 45 | #define SYS_PERIOD_PLL_nS (SYS_FREQ_NS_IN_1S / SYS_FREQ_PLL) 46 | #define SYS_PERIOD_RTI_nS (1000000u) 47 | /*CR1_113*/ 48 | 49 | #define SYS_THREAD_STACK_SIZE (512u) 50 | #define SYS_THREAD_MAX (5u) 51 | #define SYS_CLIENT_MODULES_MAX (10u) 52 | /*CR1_114*/ 53 | 54 | #endif //SYS_H 55 | 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/System/types.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: Types Header File */ 7 | /* DESCRIPTION: This code provides various required types */ 8 | /* declarations */ 9 | /* FILE NAME: types.h */ 10 | /* REVISION HISTORY: 07-03-2016 | 1.0 | Initial revision */ 11 | /* */ 12 | /******************************************************************************/ 13 | #ifndef TYPES_H 14 | #define TYPES_H 15 | 16 | #include "build.h" 17 | #include //avoid redefinition of standard types error! 18 | 19 | #ifdef BUILD_PACKED 20 | #define BUILDPACKEDKEIL 21 | #define BUILDPACKEDATMEL __attribute__ ((packed)) 22 | #endif 23 | #ifndef BUILD_PACKED 24 | #define BUILDPACKEDKEIL 25 | #define BUILDPACKEDATMEL 26 | #endif 27 | 28 | /* GLOBAL TYPE DEFINITIONS ****************************************************/ 29 | typedef unsigned int uint32; 30 | typedef unsigned short uint16; 31 | typedef unsigned char uint8; 32 | 33 | typedef unsigned int* puint32; 34 | typedef unsigned short* puint16; 35 | typedef unsigned char* puint8; 36 | 37 | typedef int* psint32; 38 | typedef short* psint16; 39 | typedef char* psint8; 40 | 41 | typedef volatile unsigned int* vpuint32; 42 | typedef volatile unsigned short* vpuint16; 43 | typedef volatile unsigned char* vpuint8; 44 | 45 | typedef unsigned char Bool; 46 | //typedef unsigned char Bool; 47 | typedef signed char sint8; 48 | typedef short sint16; 49 | typedef int sint32; 50 | #ifndef _SYS__STDINT_H 51 | typedef unsigned int uint32_t; 52 | #endif 53 | typedef unsigned short uint16_t; 54 | typedef unsigned char uint8_t; 55 | typedef unsigned int* puint32_t; 56 | typedef unsigned short* puint16_t; 57 | typedef unsigned char* puint8_t; 58 | typedef short int16_t; 59 | #ifndef _SYS__STDINT_H 60 | typedef int int32_t; 61 | #endif 62 | 63 | typedef unsigned char BYTE; 64 | typedef unsigned int DWORD; 65 | typedef unsigned int UINT; 66 | typedef unsigned short WORD; 67 | 68 | typedef enum 69 | { 70 | TYPE_enUInt8, 71 | TYPE_enUInt16, 72 | TYPE_enUInt32, 73 | TYPE_enInt8, 74 | TYPE_enInt16, 75 | TYPE_enInt32 76 | } TYPE_tenDataType; 77 | 78 | 79 | #endif //TYPES_H 80 | 81 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/UserServices/CTRL.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef CTRL_H 13 | #define CTRL_H 14 | 15 | #include "sys.h" 16 | #include "CTRLAPI.h" 17 | 18 | #define CTRL_nPIDCTRLCount 10u 19 | #define CTRL_nPIDUserCount 10u 20 | 21 | #define CTRL_xAddSigned32(x, y) \ 22 | if ((0 < y) && (0 < x)) \ 23 | { \ 24 | if ((INT32_MAX - x) > y) \ 25 | { \ 26 | x += y; \ 27 | } \ 28 | else \ 29 | { \ 30 | x = INT32_MAX; \ 31 | } \ 32 | } \ 33 | else if ((0 > y) && (0 > x)) \ 34 | { \ 35 | if ((x - INT32_MIN) > (~y + 1)) \ 36 | { \ 37 | x += y; \ 38 | } \ 39 | else \ 40 | { \ 41 | x = INT32_MIN; \ 42 | } \ 43 | } \ 44 | else \ 45 | { \ 46 | x += y; \ 47 | } \ 48 | 49 | #define CTRL_xCalcTermResult(x, y) \ 50 | i32Temp = \ 51 | (0 < y) ? (0x7FFFFFFF / (y)) : 0x7FFFFFFF; \ 52 | if (0 <= x) \ 53 | { \ 54 | i32ResultTerm = (i32Temp < x) ? \ 55 | INT32_MAX : x * y; \ 56 | } \ 57 | else \ 58 | { \ 59 | i32ResultTerm = (i32Temp < (~x + 1)) ? \ 60 | INT32_MIN : x * y; \ 61 | } \ 62 | 63 | void CTRL_vStart(puint32 const); 64 | void CTRL_vRun(puint32 const); 65 | void CTRL_vTerminate(puint32 const); 66 | CTRLAPI_ttPIDIDX CTRL_tRequestKernelPIDController(CTRLAPI_tstPIDCB* pstPIDCBReq); 67 | void CTRL_vIteratePIDCB(CTRLAPI_tstPIDCB*); 68 | void CTRL_vIteratePID(CTRLAPI_ttPIDIDX); 69 | 70 | #endif //CTRL_H 71 | 72 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/UserServices/maps.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef MAPS_H 13 | #define MAPS_H 14 | 15 | #include "MAPSAPI.h" 16 | #include "SYSAPI.h" 17 | 18 | #define MAP_nKernelMapCount 10u 19 | #define MAP_nUserMapCount 10u 20 | 21 | void MAPS_vStart(puint32 const pu32Arg); 22 | void MAPS_vRun(puint32 const pu32Arg); 23 | void MAPS_vTerminate(puint32 const pu32Arg); 24 | MAPSAPI_ttMapIDX MAP_tRequestKernelMap(MAPSAPI_tstMapCB*); 25 | Bool MAP_vCalculate(MAPSAPI_ttMapIDX); 26 | 27 | #endif //MAPS_H 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/UserServices/spreads.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef SPREADS_H 13 | #define SPREADS_H 14 | 15 | #include "SPREADSAPI.h" 16 | #include "SYSAPI.h" 17 | 18 | #define SPREAD_nKernelSpreadCount 50u 19 | #define SPREAD_nUserSpreadCount 50u 20 | 21 | void SPREADS_vStart(puint32 const pu32Arg); 22 | void SPREADS_vRun(puint32 const pu32Arg); 23 | void SPREADS_vTerminate(puint32 const pu32Arg); 24 | SPREADAPI_ttSpreadIDX SPREAD_tRequestKernelSpread(SPREADAPI_tstSpreadCB*); 25 | Bool SPREAD_vCalculate(SPREADAPI_ttSpreadIDX); 26 | SPREADAPI_tstSpreadResult* SPREAD_pstGetSpread(SPREADAPI_ttSpreadIDX); 27 | 28 | #endif //TEPM_H 29 | 30 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/UserServices/tables.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************/ 2 | /* Copyright (c) 2016 MD Automotive Controls. Original Work. */ 3 | /* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ 4 | /******************************************************************************/ 5 | /* CONTEXT:KERNEL */ 6 | /* PACKAGE TITLE: XXX Header File */ 7 | /* DESCRIPTION: XXX */ 8 | /* FILE NAME: XXX.h */ 9 | /* REVISION HISTORY: 19-08-2016 | 1.0 | Initial revision */ 10 | /* */ 11 | /******************************************************************************/ 12 | #ifndef TABLES_H 13 | #define TABLES_H 14 | 15 | #include "TABLESAPI.h" 16 | #include "SYSAPI.h" 17 | 18 | #define TABLE_nKernelTableCount 30u 19 | #define TABLE_nUserTableCount 30u 20 | 21 | void TABLES_vStart(puint32 const pu32Arg); 22 | void TABLES_vRun(puint32 const pu32Arg); 23 | void TABLES_vTerminate(puint32 const pu32Arg); 24 | TABLEAPI_ttTableIDX TABLE_tRequestKernelTable(TABLEAPI_tstTableCB*); 25 | Bool TABLE_vCalculate(TABLEAPI_ttTableIDX); 26 | 27 | #endif //TABLES_H 28 | 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/atmel_devices_cdc.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitECUProject/RabbitECUOpenHALTrunk/64cd5cfdcb8a2b2b11950dc6177580a21227c3a8/ECUHost Atmel Kernel/atmel_devices_cdc.cat -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ECUHost Atmel Kernel.c 3 | * 4 | * Created: 8/28/2016 8:32:19 PM 5 | * Author : Matthew 6 | */ 7 | 8 | #include "PERWDT.h" 9 | 10 | extern int EFIMain(void); 11 | extern void SystemInit(void); 12 | 13 | int main(void) 14 | { 15 | /* Initialize the SAM system */ 16 | SystemInit(); 17 | 18 | WDT_vStart(0xff,0xff); 19 | 20 | /* Replace with your application code */ 21 | while (1) 22 | { 23 | EFIMain(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/common/services/sleepmgr/sam/sleepmgr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief SAM3/SAM4 Sleep manager implementation. 5 | * 6 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | 47 | #include 48 | #include 49 | 50 | #if defined(CONFIG_SLEEPMGR_ENABLE) || defined(__DOXYGEN__) 51 | 52 | uint8_t sleepmgr_locks[SLEEPMGR_NR_OF_MODES]; 53 | 54 | #endif /* CONFIG_SLEEPMGR_ENABLE */ 55 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/drivers/pio/pio_handler.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Parallel Input/Output (PIO) interrupt handler for SAM. 5 | * 6 | * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | 47 | #ifndef PIO_HANDLER_H_INCLUDED 48 | #define PIO_HANDLER_H_INCLUDED 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | void pio_handler_process(Pio *p_pio, uint32_t ul_id); 55 | void pio_handler_set_priority(Pio *p_pio, IRQn_Type ul_irqn, uint32_t ul_priority); 56 | uint32_t pio_handler_set(Pio *p_pio, uint32_t ul_id, uint32_t ul_mask, 57 | uint32_t ul_attr, void (*p_handler) (uint32_t, uint32_t)); 58 | uint32_t pio_handler_set_pin(uint32_t ul_pin, uint32_t ul_flag, 59 | void (*p_handler) (uint32_t, uint32_t)); 60 | 61 | #if (SAM3S || SAM4S || SAM4E) 62 | void pio_capture_handler_set(void (*p_handler)(Pio *)); 63 | #endif 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* PIO_HANDLER_H_INCLUDED */ 70 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/drivers/wdt/wdt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Watchdog Timer (WDT) driver for SAM. 5 | * 6 | * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | 47 | #ifndef WDT_H_INCLUDED 48 | #define WDT_H_INCLUDED 49 | 50 | #include "compiler.h" 51 | 52 | /// @cond 0 53 | /**INDENT-OFF**/ 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | /**INDENT-ON**/ 58 | /// @endcond 59 | 60 | #define WDT_INVALID_ARGUMENT 0xFFFF 61 | 62 | uint32_t wdt_get_timeout_value(uint32_t ul_us, uint32_t ul_sclk); 63 | void wdt_init(Wdt *p_wdt, uint32_t ul_mode, uint16_t us_counter, 64 | uint16_t us_delta); 65 | void wdt_disable(Wdt *p_wdt); 66 | void wdt_restart(Wdt *p_wdt); 67 | uint32_t wdt_get_status(Wdt *p_wdt); 68 | uint32_t wdt_get_us_timeout_period(Wdt *p_wdt, uint32_t ul_sclk); 69 | 70 | /// @cond 0 71 | /**INDENT-OFF**/ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | /**INDENT-ON**/ 76 | /// @endcond 77 | 78 | #endif /* WDT_H_INCLUDED */ 79 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/cmsis/sam3x/include/instance/instance_chipid.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. 5 | * 6 | * \asf_license_start 7 | * 8 | * \page License 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 20 | * 3. The name of Atmel may not be used to endorse or promote products derived 21 | * from this software without specific prior written permission. 22 | * 23 | * 4. This software may only be redistributed and used in connection with an 24 | * Atmel microcontroller product. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | /* 42 | * Support and FAQ: visit Atmel Support 43 | */ 44 | 45 | #ifndef _SAM3XA_CHIPID_INSTANCE_ 46 | #define _SAM3XA_CHIPID_INSTANCE_ 47 | 48 | /* ========== Register definition for CHIPID peripheral ========== */ 49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 50 | #define REG_CHIPID_CIDR (0x400E0940U) /**< \brief (CHIPID) Chip ID Register */ 51 | #define REG_CHIPID_EXID (0x400E0944U) /**< \brief (CHIPID) Chip ID Extension Register */ 52 | #else 53 | #define REG_CHIPID_CIDR (*(RoReg*)0x400E0940U) /**< \brief (CHIPID) Chip ID Register */ 54 | #define REG_CHIPID_EXID (*(RoReg*)0x400E0944U) /**< \brief (CHIPID) Chip ID Extension Register */ 55 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 56 | 57 | #endif /* _SAM3XA_CHIPID_INSTANCE_ */ 58 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/cmsis/sam3x/include/instance/instance_gpbr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. 5 | * 6 | * \asf_license_start 7 | * 8 | * \page License 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 20 | * 3. The name of Atmel may not be used to endorse or promote products derived 21 | * from this software without specific prior written permission. 22 | * 23 | * 4. This software may only be redistributed and used in connection with an 24 | * Atmel microcontroller product. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | /* 42 | * Support and FAQ: visit Atmel Support 43 | */ 44 | 45 | #ifndef _SAM3XA_GPBR_INSTANCE_ 46 | #define _SAM3XA_GPBR_INSTANCE_ 47 | 48 | /* ========== Register definition for GPBR peripheral ========== */ 49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 50 | #define REG_GPBR_GPBR (0x400E1A90U) /**< \brief (GPBR) General Purpose Backup Register */ 51 | #else 52 | #define REG_GPBR_GPBR (*(RwReg*)0x400E1A90U) /**< \brief (GPBR) General Purpose Backup Register */ 53 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 54 | 55 | #endif /* _SAM3XA_GPBR_INSTANCE_ */ 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/cmsis/sam3x/include/instance/instance_wdt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. 5 | * 6 | * \asf_license_start 7 | * 8 | * \page License 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 20 | * 3. The name of Atmel may not be used to endorse or promote products derived 21 | * from this software without specific prior written permission. 22 | * 23 | * 4. This software may only be redistributed and used in connection with an 24 | * Atmel microcontroller product. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * \asf_license_stop 39 | * 40 | */ 41 | /* 42 | * Support and FAQ: visit Atmel Support 43 | */ 44 | 45 | #ifndef _SAM3XA_WDT_INSTANCE_ 46 | #define _SAM3XA_WDT_INSTANCE_ 47 | 48 | /* ========== Register definition for WDT peripheral ========== */ 49 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 50 | #define REG_WDT_CR (0x400E1A50U) /**< \brief (WDT) Control Register */ 51 | #define REG_WDT_MR (0x400E1A54U) /**< \brief (WDT) Mode Register */ 52 | #define REG_WDT_SR (0x400E1A58U) /**< \brief (WDT) Status Register */ 53 | #else 54 | #define REG_WDT_CR (*(WoReg*)0x400E1A50U) /**< \brief (WDT) Control Register */ 55 | #define REG_WDT_MR (*(RwReg*)0x400E1A54U) /**< \brief (WDT) Mode Register */ 56 | #define REG_WDT_SR (*(RoReg*)0x400E1A58U) /**< \brief (WDT) Status Register */ 57 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 58 | 59 | #endif /* _SAM3XA_WDT_INSTANCE_ */ 60 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/cmsis/sam3x/source/templates/desktop.ini: -------------------------------------------------------------------------------- 1 | [ViewState] 2 | Mode= 3 | Vid= 4 | FolderType=Documents 5 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/cmsis/sam3x/source/templates/exceptions.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief This file contains the interface for default exception handlers. 5 | * 6 | * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | 47 | #ifndef EXCEPTIONS_H_INCLUDED 48 | #define EXCEPTIONS_H_INCLUDED 49 | 50 | #include "sam3xa.h" 51 | 52 | /* @cond 0 */ 53 | /**INDENT-OFF**/ 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | /**INDENT-ON**/ 58 | /* @endcond */ 59 | 60 | /* Function prototype for exception table items (interrupt handler). */ 61 | typedef void (*IntFunc) (void); 62 | 63 | /* Default empty handler */ 64 | void Dummy_Handler(void); 65 | 66 | /* @cond 0 */ 67 | /**INDENT-OFF**/ 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | /**INDENT-ON**/ 72 | /* @endcond */ 73 | 74 | #endif /* EXCEPTIONS_H_INCLUDED */ 75 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/sam/utils/preprocessor/preprocessor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Preprocessor utils. 5 | * 6 | * Copyright (c) 2010-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | 47 | #ifndef _PREPROCESSOR_H_ 48 | #define _PREPROCESSOR_H_ 49 | 50 | #include "tpaste.h" 51 | #include "stringz.h" 52 | #include "mrepeat.h" 53 | 54 | 55 | #endif // _PREPROCESSOR_H_ 56 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/ATMEL-disclaimer.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Only the CMSIS required parts for ASF are included here, go to the below 3 | * address for the full package: 4 | * http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php 5 | * 6 | * The library file thirdparty/CMSIS/Lib/GCC/libarm_cortexM4lf_math_softfp.a was generated by ATMEL, which 7 | * is support -mfloat-abi=softfp compiler flag, and this is also the default selection for device that 8 | * have FPU module and enabled. 9 | * If customer want to use -mfloat-abi=hard compiler flag, the project compile/link flag and link library 10 | * should be manual modified. The library thirdparty/CMSIS/Lib/GCC/libarm_cortexM4lf_math.a is used for 11 | * -mfloat-abi=hard configration. 12 | * 13 | * __CORTEX_SC is not defined for cortex-m0+, and may cause compiler warning, so the include file 14 | * thirdparty/CMSIS/Include/core_cmInstr.h was modified to void such warning. 15 | * Modified from: 16 | * #if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) 17 | * to: 18 | * #if (__CORTEX_M >= 0x03) || ((defined(__CORTEX_SC)) && (__CORTEX_SC >= 300)) 19 | * 20 | */ 21 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitECUProject/RabbitECUOpenHALTrunk/64cd5cfdcb8a2b2b11950dc6177580a21227c3a8/ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/CMSIS_END_USER_LICENCE_AGREEMENT.pdf -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM3l_math.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitECUProject/RabbitECUOpenHALTrunk/64cd5cfdcb8a2b2b11950dc6177580a21227c3a8/ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/Lib/GCC/libarm_cortexM3l_math.a -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/Lib/license.txt: -------------------------------------------------------------------------------- 1 | All pre-build libraries contained in the folders "ARM" and "GCC" 2 | are guided by the following license: 3 | 4 | Copyright (C) 2009-2014 ARM Limited. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | - Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | - Neither the name of ARM nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/ASF/thirdparty/CMSIS/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2014 ARM Limited. All rights reserved. 3 | * 4 | * Date: 17 February 2014 5 | * Revision: V4.00 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS_END_USER_LICENCE_AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | Driver - CMSIS Peripheral Driver Interface. 38 | 39 | Pack - CMSIS Software Packs. 40 | Mechanism to install software, device support, APIs, and example projects. 41 | 42 | SVD - CMSIS SVD Schema files and Conversion Utility. 43 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/config/conf_sleepmgr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Chip-specific sleep manager configuration 5 | * 6 | * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | /* 44 | * Support and FAQ: visit Atmel Support 45 | */ 46 | #ifndef CONF_SLEEPMGR_H 47 | #define CONF_SLEEPMGR_H 48 | 49 | // Sleep manager options 50 | #define CONFIG_SLEEPMGR_ENABLE 51 | 52 | #endif /* CONF_SLEEPMGR_H */ 53 | -------------------------------------------------------------------------------- /ECUHost Atmel Kernel/src/main.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Empty user application template 5 | * 6 | */ 7 | 8 | /** 9 | * \mainpage User Application template doxygen documentation 10 | * 11 | * \par Empty user application template 12 | * 13 | * Bare minimum empty user application template 14 | * 15 | * \par Content 16 | * 17 | * -# Include the ASF header files (through asf.h) 18 | * -# "Insert system clock initialization code here" comment 19 | * -# Minimal main function that starts with a call to board_init() 20 | * -# "Insert application code here" comment 21 | * 22 | */ 23 | 24 | /* 25 | * Include header files for all drivers that have been imported from 26 | * Atmel Software Framework (ASF). 27 | */ 28 | /* 29 | * Support and FAQ: visit Atmel Support 30 | */ 31 | //#include 32 | 33 | //int main (void) 34 | //{ 35 | /* Insert system clock initialization code here (sysclk_init()). */ 36 | 37 | //board_init(); 38 | 39 | /* Insert application code here, after the board has been initialized. */ 40 | //} 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RabbitECUOpenHALTrunk 2 | ECUHost OS For Rabbit ECU With HAL And Arduino Due Controller Port 3 | --------------------------------------------------------------------------------