├── FreeRTOS ├── portable │ ├── MPLAB │ │ └── PIC18F │ │ │ └── stdio.h │ ├── Keil │ │ └── See-also-the-RVDS-directory.txt │ ├── Rowley │ │ ├── ARM7 │ │ │ └── readme.txt │ │ └── MSP430F449 │ │ │ └── portasm.h │ ├── IAR │ │ ├── AtmelSAM7S64 │ │ │ ├── lib_AT91SAM7X128.h │ │ │ └── lib_AT91SAM7X256.h │ │ ├── ARM_CM7 │ │ │ └── ReadMe.txt │ │ ├── AtmelSAM9XE │ │ │ ├── portasm.s79 │ │ │ └── ISR_Support.h │ │ ├── MSP430X │ │ │ └── data_model.h │ │ └── STR91x │ │ │ └── portasm.s79 │ ├── GCC │ │ ├── ARM7_AT91SAM7S │ │ │ └── lib_AT91SAM7X256.h │ │ ├── ARM_CM7 │ │ │ └── ReadMe.txt │ │ ├── PPC405_Xilinx │ │ │ └── FPU_Macros.h │ │ └── PPC440_Xilinx │ │ │ └── FPU_Macros.h │ ├── MemMang │ │ └── ReadMe.url │ ├── Softune │ │ ├── MB91460 │ │ │ └── __STD_LIB_sbrk.c │ │ └── MB96340 │ │ │ └── __STD_LIB_sbrk.c │ ├── readme.txt │ ├── RVDS │ │ └── ARM_CM7 │ │ │ └── ReadMe.txt │ ├── Renesas │ │ ├── RX600v2 │ │ │ └── port_asm.src │ │ ├── RX100 │ │ │ └── port_asm.src │ │ ├── RX200 │ │ │ └── port_asm.src │ │ ├── RX600 │ │ │ └── port_asm.src │ │ └── SH2A_FPU │ │ │ └── ISR_Support.inc │ ├── CCS │ │ └── MSP430X │ │ │ └── data_model.h │ └── WizC │ │ └── PIC18 │ │ └── addFreeRTOS.h ├── trace │ ├── readme.txt │ ├── trcUser.c │ ├── trcUser.h │ ├── CMakeLists.txt │ ├── trcRecorder.c │ └── trcTypes.h ├── openocd.c ├── readme.txt ├── include │ └── stdint.readme └── CMakeLists.txt ├── port ├── ucontroller │ ├── nxp │ │ └── lpc17xx │ │ │ ├── bootloader │ │ │ ├── .clang_complete │ │ │ ├── src │ │ │ │ ├── lpc17_progmem.c │ │ │ │ ├── start_app.h │ │ │ │ ├── lpc17_uart.h │ │ │ │ ├── start_app.c │ │ │ │ ├── lpc17_pincfg.h │ │ │ │ ├── lpc17_clock.h │ │ │ │ └── lpc17_iap.h │ │ │ ├── inc │ │ │ │ └── cmsis_version.h │ │ │ ├── README.md │ │ │ └── CMakeLists.txt │ │ │ ├── lpcopen │ │ │ ├── inc │ │ │ │ ├── usbd │ │ │ │ │ ├── usbd.h │ │ │ │ │ └── usbd_desc.h │ │ │ │ ├── sys_config.h │ │ │ │ └── cmsis.h │ │ │ └── src │ │ │ │ ├── gpio_17xx_40xx.c │ │ │ │ └── gpioint_17xx_40xx.c │ │ │ ├── arm_cm3_reset.h │ │ │ ├── port.h │ │ │ ├── lpc17_i2c.h │ │ │ ├── lpc17_uart.c │ │ │ ├── lpc17_spi.h │ │ │ ├── lpc17_pincfg.c │ │ │ ├── lpc17_hpm.h │ │ │ ├── lpc17_pincfg.h │ │ │ ├── lpc17_uart.h │ │ │ ├── lpc17_watchdog.h │ │ │ ├── lpc17_uartrb.h │ │ │ ├── lpc17_power.h │ │ │ └── lpc17_uartrb.c │ └── CMakeLists.txt └── board │ ├── rtm-8sfp │ ├── rtm_i2c_mapping.h │ ├── rtm_i2c_mapping.c │ ├── CMakeLists.txt │ ├── rtm_user.h │ └── rtm_user_fru.h │ ├── rtm-lamp │ ├── rtm_i2c_mapping.h │ ├── rtm_i2c_mapping.c │ ├── CMakeLists.txt │ ├── rtm_user.h │ └── rtm_user_fru.h │ ├── afc-common │ ├── CMakeLists.txt │ ├── board_led.h │ └── board_fru.c │ ├── afc-v4 │ ├── rtm.c │ ├── pin_mapping.c │ ├── board_config.h │ ├── i2c_mapping.h │ ├── board_config.c │ ├── ipmi_oem.h │ └── CMakeLists.txt │ ├── afc-v3 │ ├── rtm.c │ ├── i2c_mapping.h │ ├── ipmi_oem.h │ └── CMakeLists.txt │ └── CMakeLists.txt ├── docs ├── port.dox ├── modules.dox └── afc_i2c_buses.dox ├── modules ├── GitSHA1.h ├── pin_cfg.h ├── clock_config.h ├── clock_config.c ├── sensors │ ├── max11609.h │ ├── CMakeLists.txt │ ├── sensors.h │ ├── max11609.c │ └── lm75.h ├── scansta1101.h ├── GitSHA1.c.in ├── sys_utils.h ├── uart_debug.c ├── uart_debug.h ├── ad84xx.h ├── scansta1101.c ├── watchdog.c ├── rtm_fru.c ├── mmc_error.h ├── mmc_error.c ├── sys_utils.c ├── ad84xx.c ├── idt_8v54816.h ├── fru.h ├── rtm.h ├── task_priorities.h ├── watchdog.h ├── eeprom_24xx02.h ├── eeprom_24xx64.h ├── utils.c ├── flash_spi.h └── idt_8v54816.c ├── probe ├── openocd.cfg.in └── lpclink1-flash.sh ├── docker └── Dockerfile ├── toolchain ├── colors.cmake ├── cmake-modules │ ├── LICENSE_1_0.txt │ └── GetGitRevisionDescription.cmake.in ├── toolchain-arm-none-eabi.cmake └── PreventInSourceBuilds.cmake ├── .gitignore ├── test └── run_cmd.py ├── .github └── workflows │ └── build.yml ├── scripts ├── make-release.sh └── set-fru-info.py └── config └── lnls ├── afcv3.1-bpm-clk-cfg.json ├── afcv4-fofb-clk-cfg.json └── afcv3.1-timing-clk-cfg.json /FreeRTOS/portable/MPLAB/PIC18F/stdio.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/.clang_complete: -------------------------------------------------------------------------------- 1 | -I./inc/ -------------------------------------------------------------------------------- /docs/port.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * @defgroup BOARD_PORTS Board Ports 3 | */ 4 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Keil/See-also-the-RVDS-directory.txt: -------------------------------------------------------------------------------- 1 | Nothing to see here. -------------------------------------------------------------------------------- /modules/GitSHA1.h: -------------------------------------------------------------------------------- 1 | extern const char g_GIT_SHA1[]; 2 | extern const char g_GIT_TAG[]; 3 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Rowley/ARM7/readme.txt: -------------------------------------------------------------------------------- 1 | The Rowley ARM7 demo uses the GCC ARM7 port files. -------------------------------------------------------------------------------- /FreeRTOS/trace/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/trace/readme.txt -------------------------------------------------------------------------------- /FreeRTOS/trace/trcUser.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/trace/trcUser.c -------------------------------------------------------------------------------- /FreeRTOS/trace/trcUser.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/trace/trcUser.h -------------------------------------------------------------------------------- /modules/pin_cfg.h: -------------------------------------------------------------------------------- 1 | #ifndef PIN_CFG_H_ 2 | #define PIN_CFG_H_ 3 | 4 | #include "port.h" 5 | 6 | void pin_init( void ); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /docs/modules.dox: -------------------------------------------------------------------------------- 1 | // Some Doxygen commands to order the final documentation 2 | 3 | /** 4 | * @defgroup PERIPH_IC Peripheral ICs 5 | */ 6 | -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X128.h -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/portable/IAR/AtmelSAM7S64/lib_AT91SAM7X256.h -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/inc/usbd/usbd.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/port/ucontroller/nxp/lpc17xx/lpcopen/inc/usbd/usbd.h -------------------------------------------------------------------------------- /FreeRTOS/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lnls-dig/openMMC/HEAD/FreeRTOS/portable/GCC/ARM7_AT91SAM7S/lib_AT91SAM7X256.h -------------------------------------------------------------------------------- /FreeRTOS/portable/MemMang/ReadMe.url: -------------------------------------------------------------------------------- 1 | [{000214A0-0000-0000-C000-000000000046}] 2 | Prop3=19,2 3 | [InternetShortcut] 4 | URL=http://www.freertos.org/a00111.html 5 | IDList= 6 | -------------------------------------------------------------------------------- /modules/clock_config.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "ipmi.h" 4 | #include "fru.h" 5 | #include "payload.h" 6 | 7 | extern uint8_t clock_config[16]; 8 | -------------------------------------------------------------------------------- /probe/openocd.cfg.in: -------------------------------------------------------------------------------- 1 | ${OPENOCD_DEBUG_PROBE_CMD} 2 | 3 | transport select ${OPENOCD_TRANSPORT} 4 | 5 | source [find target/${OPENOCD_TARGET}.cfg] 6 | 7 | adapter speed 3000 8 | 9 | $_TARGETNAME configure -event gdb-attach { 10 | halt 11 | } 12 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/debian:12 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y \ 5 | make \ 6 | gcc-arm-none-eabi \ 7 | libnewlib-arm-none-eabi \ 8 | libstdc++-arm-none-eabi-dev \ 9 | binutils-arm-none-eabi \ 10 | cmake \ 11 | doxygen \ 12 | git \ 13 | g++ 14 | RUN arm-none-eabi-gcc -v 15 | -------------------------------------------------------------------------------- /docs/afc_i2c_buses.dox: -------------------------------------------------------------------------------- 1 | /** 2 | * @page AFC_I2C AFC I2C Buses 3 | * 4 | * @tableofcontents 5 | * 6 | * @section AFCv3 7 | * \dotfile afcv3_i2c_hierarchy.dot "AFCv3.1 I2C Bus hierarchy" 8 | * 9 | * @section AFCv4 10 | * \dotfile afcv4_cpu_i2c_hierarchy.dot "AFCv4 LPC1768 I2C Bus hierarchy" 11 | * 12 | * \dotfile afcv4_fpga_i2c_hierarchy.dot "AFCv4 FPGA I2C Bus hierarchy" 13 | */ 14 | -------------------------------------------------------------------------------- /port/board/rtm-8sfp/rtm_i2c_mapping.h: -------------------------------------------------------------------------------- 1 | #ifndef RTM_I2C_MAPPING_H_ 2 | #define RTM_I2C_MAPPING_H_ 3 | 4 | #include "i2c.h" 5 | 6 | enum { 7 | CHIP_ID_RTM_PCA9554 = 64, 8 | CHIP_ID_RTM_EEPROM, 9 | CHIP_ID_RTM_LM75_0, 10 | CHIP_ID_RTM_LM75_1 11 | }; 12 | 13 | #define I2C_CHIP_RTM_CNT 4 14 | 15 | extern i2c_chip_mapping_t i2c_chip_rtm_map[I2C_CHIP_RTM_CNT]; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/arm_cm3_reset.h: -------------------------------------------------------------------------------- 1 | #include "core_cm3.h" 2 | 3 | static inline void mcu_reset(void) 4 | { 5 | /* Issue a system reset */ 6 | SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | 7 | (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | 8 | SCB_AIRCR_SYSRESETREQ_Msk); 9 | /* Ensure completion of memory accesses */ 10 | __asm volatile ("dsb"); 11 | /* Wait for the reset */ 12 | while(1); 13 | } 14 | -------------------------------------------------------------------------------- /FreeRTOS/trace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TRACE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | set(PROJ_HDRS ${PROJ_HDRS} ${TRACE_PATH}) 4 | 5 | set(PROJ_SRCS ${PROJ_SRCS} ${TRACE_PATH}/trcBase.c 6 | ${TRACE_PATH}/trcHardwarePort.c 7 | ${TRACE_PATH}/trcKernel.c 8 | ${TRACE_PATH}/trcKernelPortFreeRTOS.c 9 | ${TRACE_PATH}/trcRecorder.c 10 | ${TRACE_PATH}/trcUser.c 11 | ) 12 | 13 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 14 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 15 | -------------------------------------------------------------------------------- /port/board/rtm-8sfp/rtm_i2c_mapping.c: -------------------------------------------------------------------------------- 1 | #include "i2c.h" 2 | #include "rtm_i2c_mapping.h" 3 | #include "i2c_mapping.h" 4 | #include "port.h" 5 | 6 | i2c_chip_mapping_t i2c_chip_rtm_map[I2C_CHIP_RTM_CNT] = { 7 | [CHIP_ID_RTM_PCA9554 - 64] = { I2C_BUS_RTM_ID, 0x20 }, 8 | [CHIP_ID_RTM_EEPROM - 64] = { I2C_BUS_RTM_ID, 0x50 }, 9 | [CHIP_ID_RTM_LM75_0 - 64] = { I2C_BUS_RTM_ID, 0x48 }, 10 | [CHIP_ID_RTM_LM75_1 - 64] = { I2C_BUS_RTM_ID, 0x49 }, 11 | }; 12 | -------------------------------------------------------------------------------- /port/board/rtm-lamp/rtm_i2c_mapping.h: -------------------------------------------------------------------------------- 1 | #ifndef RTM_I2C_MAPPING_H_ 2 | #define RTM_I2C_MAPPING_H_ 3 | 4 | #include "i2c.h" 5 | 6 | enum { 7 | CHIP_ID_RTM_PCA9554_LEDS = 64, 8 | CHIP_ID_RTM_PCA9554_PWR, 9 | CHIP_ID_RTM_EEPROM, 10 | CHIP_ID_RTM_LM75_0, 11 | CHIP_ID_RTM_LM75_1, 12 | CHIP_ID_RTM_LM75_2, 13 | CHIP_ID_RTM_MAX11609, 14 | CHIP_ID_RTM_CDCE906, 15 | }; 16 | 17 | #define I2C_CHIP_RTM_CNT 8 18 | 19 | extern i2c_chip_mapping_t i2c_chip_rtm_map[I2C_CHIP_RTM_CNT]; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /port/board/afc-common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BOARD_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 2 | 3 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/board_led.c) 4 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/board_ipmb.c) 5 | 6 | if (";${TARGET_MODULES};" MATCHES ";FRU;") 7 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/board_fru.c) 8 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_FRU") 9 | endif() 10 | 11 | set(PROJ_HDRS ${PROJ_HDRS} ${BOARD_PATH}) 12 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 13 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 14 | -------------------------------------------------------------------------------- /probe/lpclink1-flash.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | firmware="$1" 4 | device="$2" 5 | address="$3" 6 | 7 | if [ -z "$firmware" ] || [ -z "$device" ]; then 8 | printf "Usage: $0 firmware.bin device [address]\n" 9 | exit 1 10 | fi 11 | 12 | if [ -z "$address" ]; then 13 | address=0x0000 14 | fi 15 | 16 | if [ -z "$MCUXPRESSOIDE_BIN" ]; then 17 | MCUXPRESSOIDE_BIN=/usr/local/mcuxpressoide/ide/binaries/ 18 | fi 19 | 20 | "${MCUXPRESSOIDE_BIN}/boot_link1" 21 | 22 | set -e 23 | 24 | "${MCUXPRESSOIDE_BIN}/crt_emu_cm_redlink" -g -flash-load="$firmware" -load-base="$address" -p ${device} 25 | -------------------------------------------------------------------------------- /toolchain/colors.cmake: -------------------------------------------------------------------------------- 1 | # Color definitions 2 | if(NOT WIN32) 3 | string(ASCII 27 Esc) 4 | set(ColourReset "${Esc}[m") 5 | set(ColourBold "${Esc}[1m") 6 | set(Red "${Esc}[31m") 7 | set(Green "${Esc}[32m") 8 | set(Yellow "${Esc}[33m") 9 | set(Blue "${Esc}[34m") 10 | set(Magenta "${Esc}[35m") 11 | set(Cyan "${Esc}[36m") 12 | set(White "${Esc}[37m") 13 | set(BoldRed "${Esc}[1;31m") 14 | set(BoldGreen "${Esc}[1;32m") 15 | set(BoldYellow "${Esc}[1;33m") 16 | set(BoldBlue "${Esc}[1;34m") 17 | set(BoldMagenta "${Esc}[1;35m") 18 | set(BoldCyan "${Esc}[1;36m") 19 | set(BoldWhite "${Esc}[1;37m") 20 | endif() 21 | -------------------------------------------------------------------------------- /FreeRTOS/openocd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Since at least FreeRTOS V7.5.3 uxTopUsedPriority is no longer 3 | * present in the kernel, so it has to be supplied by other means for 4 | * OpenOCD's threads awareness. 5 | * 6 | * Add this file to your project, and, if you're using --gc-sections, 7 | * ``--undefined=uxTopUsedPriority'' (or 8 | * ``-Wl,--undefined=uxTopUsedPriority'' when using gcc for final 9 | * linking) to your LDFLAGS; same with all the other symbols you need. 10 | */ 11 | 12 | #include "FreeRTOS.h" 13 | 14 | #ifdef __GNUC__ 15 | #define USED __attribute__((used)) 16 | #else 17 | #define USED 18 | #endif 19 | 20 | volatile const int USED uxTopUsedPriority = configMAX_PRIORITIES - 1; 21 | -------------------------------------------------------------------------------- /port/board/rtm-lamp/rtm_i2c_mapping.c: -------------------------------------------------------------------------------- 1 | #include "i2c.h" 2 | #include "rtm_i2c_mapping.h" 3 | #include "i2c_mapping.h" 4 | #include "port.h" 5 | 6 | i2c_chip_mapping_t i2c_chip_rtm_map[I2C_CHIP_RTM_CNT] = { 7 | [CHIP_ID_RTM_PCA9554_LEDS - 64] = { I2C_BUS_RTM_ID, 0x20 }, 8 | [CHIP_ID_RTM_PCA9554_PWR - 64] = { I2C_BUS_RTM_ID, 0x21 }, 9 | [CHIP_ID_RTM_EEPROM - 64] = { I2C_BUS_RTM_ID, 0x50 }, 10 | [CHIP_ID_RTM_LM75_0 - 64] = { I2C_BUS_RTM_ID, 0x48 }, 11 | [CHIP_ID_RTM_LM75_1 - 64] = { I2C_BUS_RTM_ID, 0x49 }, 12 | [CHIP_ID_RTM_LM75_2 - 64] = { I2C_BUS_RTM_ID, 0x4B }, 13 | [CHIP_ID_RTM_MAX11609 - 64] = { I2C_BUS_RTM_ID, 0x33 }, 14 | [CHIP_ID_RTM_CDCE906 - 64] = { I2C_BUS_RTM_ID, 0x69 }, 15 | }; 16 | -------------------------------------------------------------------------------- /port/ucontroller/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | message(STATUS "Selected Controller: ${TARGET_CONTROLLER}") 2 | 3 | if(NOT TARGET_CONTROLLER) 4 | message(FATAL_ERROR "${BoldRed}Target controller was not selected! You can pass the flag -DTARGET_CONTROLLER= or set it on the board CMakeLists.txt${ColourReset}") 5 | endif() 6 | 7 | if(${TARGET_CONTROLLER} MATCHES "^(lpc|LPC)17") 8 | add_subdirectory(nxp/lpc17xx) 9 | 10 | else () 11 | message(FATAL_ERROR "${BoldRed}Selected Controller \"${TARGET_CONTROLLER}\" is not implemented!${ColourReset}") 12 | endif() 13 | 14 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" PARENT_SCOPE) 15 | set(UCONTROLLER_SRCS ${UCONTROLLER_SRCS} PARENT_SCOPE) 16 | set(UCONTROLLER_HDRS ${UCONTROLLER_HDRS} PARENT_SCOPE) 17 | set(UCONTROLLER_APP_LD_SCRIPT ${UCONTROLLER_APP_LD_SCRIPT} PARENT_SCOPE) 18 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Softune/MB91460/__STD_LIB_sbrk.c: -------------------------------------------------------------------------------- 1 | #include "FreeRTOSConfig.h" 2 | #include 3 | 4 | static long brk_siz = 0; 5 | // #if configTOTAL_HEAP_SIZE != 0 6 | typedef int _heep_t; 7 | #define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1)) 8 | static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)]; 9 | #define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE) 10 | /* #else 11 | extern char *_heep; 12 | extern long _heep_size; 13 | #endif 14 | */ 15 | extern char *sbrk(int size) 16 | { 17 | if (brk_siz + size > _heep_size || brk_siz + size < 0) 18 | 19 | return((char*)-1); 20 | brk_siz += size; 21 | return( (char*)_heep + brk_siz - size); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | # Debug files 32 | *.dSYM/ 33 | Debug/ 34 | *.launch 35 | *.xml 36 | .cproject 37 | .project 38 | 39 | #Temporary files 40 | *.swp 41 | *.map 42 | *~ 43 | *#* 44 | *.#* 45 | 46 | #Dependency files 47 | *.d 48 | 49 | #Binaries 50 | *.axf 51 | *.bin 52 | 53 | #Cmake files 54 | CMakeFiles/ 55 | *.dir/* 56 | Makefile 57 | *cmake_install.cmake 58 | CMakeCache.txt 59 | build/ 60 | 61 | #Output files 62 | out/* 63 | 64 | #Doxygen output 65 | *html* 66 | 67 | TAGS 68 | .dir-locals.el 69 | 70 | modules/GitSHA1.c -------------------------------------------------------------------------------- /port/board/afc-v4/rtm.c: -------------------------------------------------------------------------------- 1 | #include "i2c_mapping.h" 2 | #include "port.h" 3 | #include "hotswap.h" 4 | #include "pin_mapping.h" 5 | #include "mcp23016.h" 6 | 7 | void rtm_check_presence( uint8_t *status ) 8 | { 9 | *status = HOTSWAP_STATE_URTM_ABSENT; 10 | 11 | if (!gpio_read_pin(PIN_PORT(GPIO_RTM_PS), PIN_NUMBER(GPIO_RTM_PS))) { 12 | *status = HOTSWAP_STATE_URTM_PRSENT; 13 | } 14 | } 15 | 16 | mmc_err rtm_enable_payload_power( void ) 17 | { 18 | mmc_err err = mcp23016_write_pin(ext_gpios[EXT_GPIO_EN_RTM_PWR].port_num, ext_gpios[EXT_GPIO_EN_RTM_PWR].pin_num, true); 19 | rtm_enable_payload_power_post(); 20 | return err; 21 | } 22 | 23 | mmc_err rtm_disable_payload_power( void ) 24 | { 25 | rtm_disable_payload_power_pre(); 26 | return mcp23016_write_pin(ext_gpios[EXT_GPIO_EN_RTM_PWR].port_num, ext_gpios[EXT_GPIO_EN_RTM_PWR].pin_num, false); 27 | } 28 | -------------------------------------------------------------------------------- /FreeRTOS/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and or compiler. 4 | 5 | + The FreeRTOS/Source directory contains the three files that are common to 6 | every port - list.c, queue.c and tasks.c. The kernel is contained within these 7 | three files. croutine.c implements the optional co-routine functionality - which 8 | is normally only used on very memory limited systems. 9 | 10 | + The FreeRTOS/Source/Portable directory contains the files that are specific to 11 | a particular microcontroller and or compiler. 12 | 13 | + The FreeRTOS/Source/include directory contains the real time kernel header 14 | files. 15 | 16 | See the readme file in the FreeRTOS/Source/Portable directory for more 17 | information. -------------------------------------------------------------------------------- /modules/clock_config.c: -------------------------------------------------------------------------------- 1 | #include "clock_config.h" 2 | 3 | uint8_t clock_config[16]; 4 | 5 | /* 6 | * Function to configure the clock switch via ipmi. 7 | * The configuration is sent as an array in the data field. 8 | * 9 | */ 10 | IPMI_HANDLER(ipmi_custom_cmd_write_clock_config, NETFN_CUSTOM, IPMI_CUSTOM_CMD_WRITE_CLOCK_CONFIG, ipmi_msg *req, ipmi_msg *rsp) 11 | { 12 | memcpy(clock_config, req->data, req->data_len); 13 | payload_send_message(FRU_AMC, PAYLOAD_MESSAGE_CLOCK_CONFIG); 14 | rsp->completion_code = IPMI_CC_OK; 15 | } 16 | 17 | 18 | /* 19 | * Function to read the clock switch configuration via ipmi. 20 | */ 21 | IPMI_HANDLER(ipmi_custom_cmd_read_clock_config, NETFN_CUSTOM, IPMI_CUSTOM_CMD_READ_CLOCK_CONFIG, ipmi_msg *req, ipmi_msg *rsp) 22 | { 23 | rsp->data_len = 16; 24 | memcpy(rsp->data, clock_config, rsp->data_len); 25 | rsp->completion_code = IPMI_CC_OK; 26 | } 27 | -------------------------------------------------------------------------------- /FreeRTOS/portable/readme.txt: -------------------------------------------------------------------------------- 1 | Each real time kernel port consists of three files that contain the core kernel 2 | components and are common to every port, and one or more files that are 3 | specific to a particular microcontroller and/or compiler. 4 | 5 | 6 | + The FreeRTOS/Source/Portable/MemMang directory contains the five sample 7 | memory allocators as described on the http://www.FreeRTOS.org WEB site. 8 | 9 | + The other directories each contain files specific to a particular 10 | microcontroller or compiler, where the directory name denotes the compiler 11 | specific files the directory contains. 12 | 13 | 14 | 15 | For example, if you are interested in the [compiler] port for the [architecture] 16 | microcontroller, then the port specific files are contained in 17 | FreeRTOS/Source/Portable/[compiler]/[architecture] directory. If this is the 18 | only port you are interested in then all the other directories can be 19 | ignored. 20 | 21 | -------------------------------------------------------------------------------- /FreeRTOS/include/stdint.readme: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FREERTOS_STDINT 3 | #define FREERTOS_STDINT 4 | 5 | /******************************************************************************* 6 | * THIS IS NOT A FULL stdint.h IMPLEMENTATION - It only contains the definitions 7 | * necessary to build the FreeRTOS code. It is provided to allow FreeRTOS to be 8 | * built using compilers that do not provide their own stdint.h definition. 9 | * 10 | * To use this file: 11 | * 12 | * 1) Copy this file into the directory that contains your FreeRTOSConfig.h 13 | * header file, as that directory will already be in the compilers include 14 | * path. 15 | * 16 | * 2) Rename the copied file stdint.h. 17 | * 18 | */ 19 | 20 | typedef signed char int8_t; 21 | typedef unsigned char uint8_t; 22 | typedef short int16_t; 23 | typedef unsigned short uint16_t; 24 | typedef long int32_t; 25 | typedef unsigned long uint32_t; 26 | 27 | #endif /* FREERTOS_STDINT */ 28 | -------------------------------------------------------------------------------- /port/board/rtm-8sfp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #List all modules used by this board 2 | set(RTM_8SFP_MODULES 3 | "PCA9554" 4 | "EEPROM_24XX64" 5 | ) 6 | 7 | set(RTM_8SFP_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 8 | 9 | #Include the modules sources 10 | ##Sensors SDR list 11 | set( PROJ_SRCS ${PROJ_SRCS} 12 | ${RTM_8SFP_PATH}/rtm_user.c 13 | ${RTM_8SFP_PATH}/sdr_list.c 14 | ${RTM_8SFP_PATH}/rtm_i2c_mapping.c 15 | ) 16 | 17 | #Include headers path 18 | set(PROJ_HDRS ${PROJ_HDRS} ${RTM_8SFP_PATH}) 19 | 20 | if(${TARGET_BOARD_NAME} MATCHES "afc-v3") 21 | list(APPEND PROJ_HDRS ${RTM_8SFP_PATH}/../afc-v3/i2c_mapping.h) 22 | elseif(${TARGET_BOARD_NAME} MATCHES "afc-v4") 23 | list(APPEND PROJ_HDRS ${RTM_8SFP_PATH}/../afc-v4/i2c_mapping.h) 24 | endif() 25 | #Set the variables in the main scope 26 | set(TARGET_MODULES ${TARGET_MODULES} ${RTM_8SFP_MODULES} PARENT_SCOPE) 27 | 28 | #Set the variables in the main scope 29 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 30 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 31 | -------------------------------------------------------------------------------- /port/board/rtm-lamp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #List all modules used by this board 2 | set(RTM_LAMP_MODULES 3 | "PCA9554" 4 | "EEPROM_24XX64" 5 | "CDCE906" 6 | "MAX116XX" 7 | ) 8 | 9 | set(RTM_LAMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 10 | 11 | #Include the modules sources 12 | ##Sensors SDR list 13 | set( PROJ_SRCS ${PROJ_SRCS} 14 | ${RTM_LAMP_PATH}/rtm_user.c 15 | ${RTM_LAMP_PATH}/sdr_list.c 16 | ${RTM_LAMP_PATH}/rtm_i2c_mapping.c 17 | ) 18 | 19 | #Include headers path 20 | set(PROJ_HDRS ${PROJ_HDRS} ${RTM_LAMP_PATH}) 21 | 22 | if(${TARGET_BOARD_NAME} MATCHES "afc-v3") 23 | list(APPEND PROJ_HDRS ${RTM_8SFP_PATH}/../afc-v3/i2c_mapping.h) 24 | elseif(${TARGET_BOARD_NAME} MATCHES "afc-v4") 25 | list(APPEND PROJ_HDRS ${RTM_8SFP_PATH}/../afc-v4/i2c_mapping.h) 26 | endif() 27 | 28 | #Set the variables in the main scope 29 | set(TARGET_MODULES ${TARGET_MODULES} ${RTM_LAMP_MODULES} PARENT_SCOPE) 30 | 31 | #Set the variables in the main scope 32 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 33 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 34 | -------------------------------------------------------------------------------- /modules/sensors/max11609.h: -------------------------------------------------------------------------------- 1 | #ifndef MAX11609_ 2 | #define MAX11609_ 3 | 4 | /** 5 | * @brief Rate at which the MAX11609 sensors are read (in ms) 6 | */ 7 | #define MAX11609_UPDATE_PERIOD 200 8 | 9 | #define MAX11609_CHANNEL_0 0 10 | #define MAX11609_CHANNEL_1 1 11 | #define MAX11609_CHANNEL_2 2 12 | #define MAX11609_CHANNEL_3 3 13 | #define MAX11609_CHANNEL_4 4 14 | #define MAX11609_CHANNEL_5 5 15 | #define MAX11609_CHANNEL_6 6 16 | #define MAX11609_CHANNEL_7 7 17 | 18 | extern TaskHandle_t vTask11609_Handle; 19 | 20 | extern const SDR_type_01h_t SDR_MAX11609_12V_HP; 21 | 22 | void MAX11609_init( void ); 23 | 24 | /** 25 | * @brief Monitoring task for MAX11609 sensor 26 | * 27 | * This task unblocks after every #MAX11609_UPDATE_PERIOD ms and updates the read from all the MAX11609 sensors listed in this module's SDR table 28 | * 29 | * @param Parameters Pointer to parameter list passed to task upon initialization (not used here) 30 | */ 31 | void vTaskMAX11609( void* Parameters ); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /port/board/afc-v4/pin_mapping.c: -------------------------------------------------------------------------------- 1 | #include "pin_mapping.h" 2 | 3 | /** 4 | * @defgroup AFC_V4_0_PIN_MAPPING AFCv4.0 Pin Mapping 5 | * @ingroup AFC_V4_0 6 | * @{ 7 | */ 8 | const external_gpio_t ext_gpios[16] = { 9 | [EXT_GPIO_P1V5_VTT_EN] = { 1, 7 }, 10 | [EXT_GPIO_EN_P1V8] = { 1, 6 }, 11 | [EXT_GPIO_EN_P1V2] = { 1, 5 }, 12 | [EXT_GPIO_EN_FMC1_P12V] = { 1, 4 }, 13 | [EXT_GPIO_EN_FMC2_P12V] = { 1, 3 }, 14 | [EXT_GPIO_EN_FMC1_PVADJ] = { 1, 2 }, 15 | [EXT_GPIO_EN_FMC2_PVADJ] = { 1, 1 }, 16 | [EXT_GPIO_EN_FMC1_P3V3] = { 1, 0 }, 17 | [EXT_GPIO_EN_FMC2_P3V3] = { 0, 7 }, 18 | [EXT_GPIO_EN_P1V0] = { 0, 6 }, 19 | [EXT_GPIO_EN_P3V3] = { 0, 5 }, 20 | [EXT_GPIO_EN_RTM_PWR] = { 0, 4 }, 21 | [EXT_GPIO_EN_RTM_MP] = { 0, 3 }, 22 | [EXT_GPIO_FPGA_I2C_RESET] = { 0, 2 }, 23 | [EXT_GPIO_DAC_VADJ_RSTn] = { 0, 1 }, 24 | [EXT_GPIO_PROGRAM_B] = { 0, 0 } 25 | }; 26 | /** 27 | * @} 28 | */ 29 | -------------------------------------------------------------------------------- /port/board/afc-v4/board_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Krzysztof Macias 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef BOARD_CONFIG_H_ 23 | #define BOARD_CONFIG_H_ 24 | 25 | void board_init(); 26 | void board_config(); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /port/board/afc-v3/rtm.c: -------------------------------------------------------------------------------- 1 | #include "port.h" 2 | #include "rtm_i2c_mapping.h" 3 | #include "eeprom_24xx64.h" 4 | #include "hotswap.h" 5 | 6 | void rtm_check_presence( uint8_t *status ) 7 | { 8 | /* Due to a hardware limitation in the AFC board, we can't rely on reading the PS signal 9 | since this pin doesn't have a pull-up resistor, it's always read as 0. 10 | A very dirty workaround is to 'ping' the RTM EEPROM, if it responds, then the board is connected */ 11 | 12 | uint8_t dumb; 13 | *status = HOTSWAP_STATE_URTM_ABSENT; 14 | 15 | if(eeprom_24xx64_read(CHIP_ID_RTM_EEPROM, 0, &dumb, 1, 100)) { 16 | *status = HOTSWAP_STATE_URTM_PRSENT; 17 | } 18 | } 19 | 20 | mmc_err rtm_enable_payload_power( void ) 21 | { 22 | gpio_set_pin_state( PIN_PORT(GPIO_EN_RTM_PWR), PIN_NUMBER(GPIO_EN_RTM_PWR), 1 ); 23 | return rtm_enable_payload_power_post(); 24 | } 25 | 26 | mmc_err rtm_disable_payload_power( void ) 27 | { 28 | mmc_err error = rtm_disable_payload_power_pre(); 29 | gpio_set_pin_state( PIN_PORT(GPIO_EN_RTM_PWR), PIN_NUMBER(GPIO_EN_RTM_PWR), 0 ); 30 | return error; 31 | } 32 | -------------------------------------------------------------------------------- /FreeRTOS/portable/GCC/ARM_CM7/ReadMe.txt: -------------------------------------------------------------------------------- 1 | There are two options for running FreeRTOS on ARM Cortex-M7 microcontrollers. 2 | The best option depends on the revision of the ARM Cortex-M7 core in use. The 3 | revision is specified by an 'r' number, and a 'p' number, so will look something 4 | like 'r0p1'. Check the documentation for the microcontroller in use to find the 5 | revision of the Cortex-M7 core used in that microcontroller. If in doubt, use 6 | the FreeRTOS port provided specifically for r0p1 revisions, as that can be used 7 | with all core revisions. 8 | 9 | The first option is to use the ARM Cortex-M4F port, and the second option is to 10 | use the Cortex-M7 r0p1 port - the latter containing a minor errata workaround. 11 | 12 | If the revision of the ARM Cortex-M7 core is not r0p1 then either option can be 13 | used, but it is recommended to use the FreeRTOS ARM Cortex-M4F port located in 14 | the /FreeRTOS/Source/portable/GCC/ARM_CM4F directory. 15 | 16 | If the revision of the ARM Cortex-M7 core is r0p1 then use the FreeRTOS ARM 17 | Cortex-M7 r0p1 port located in the /FreeRTOS/Source/portable/GCC/ARM_CM7/r0p1 18 | directory. -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/ARM_CM7/ReadMe.txt: -------------------------------------------------------------------------------- 1 | There are two options for running FreeRTOS on ARM Cortex-M7 microcontrollers. 2 | The best option depends on the revision of the ARM Cortex-M7 core in use. The 3 | revision is specified by an 'r' number, and a 'p' number, so will look something 4 | like 'r0p1'. Check the documentation for the microcontroller in use to find the 5 | revision of the Cortex-M7 core used in that microcontroller. If in doubt, use 6 | the FreeRTOS port provided specifically for r0p1 revisions, as that can be used 7 | with all core revisions. 8 | 9 | The first option is to use the ARM Cortex-M4F port, and the second option is to 10 | use the Cortex-M7 r0p1 port - the latter containing a minor errata workaround. 11 | 12 | If the revision of the ARM Cortex-M7 core is not r0p1 then either option can be 13 | used, but it is recommended to use the FreeRTOS ARM Cortex-M4F port located in 14 | the /FreeRTOS/Source/portable/IAR/ARM_CM4F directory. 15 | 16 | If the revision of the ARM Cortex-M7 core is r0p1 then use the FreeRTOS ARM 17 | Cortex-M7 r0p1 port located in the /FreeRTOS/Source/portable/IAR/ARM_CM7/r0p1 18 | directory. -------------------------------------------------------------------------------- /FreeRTOS/portable/RVDS/ARM_CM7/ReadMe.txt: -------------------------------------------------------------------------------- 1 | There are two options for running FreeRTOS on ARM Cortex-M7 microcontrollers. 2 | The best option depends on the revision of the ARM Cortex-M7 core in use. The 3 | revision is specified by an 'r' number, and a 'p' number, so will look something 4 | like 'r0p1'. Check the documentation for the microcontroller in use to find the 5 | revision of the Cortex-M7 core used in that microcontroller. If in doubt, use 6 | the FreeRTOS port provided specifically for r0p1 revisions, as that can be used 7 | with all core revisions. 8 | 9 | The first option is to use the ARM Cortex-M4F port, and the second option is to 10 | use the Cortex-M7 r0p1 port - the latter containing a minor errata workaround. 11 | 12 | If the revision of the ARM Cortex-M7 core is not r0p1 then either option can be 13 | used, but it is recommended to use the FreeRTOS ARM Cortex-M4F port located in 14 | the /FreeRTOS/Source/portable/RVDS/ARM_CM4F directory. 15 | 16 | If the revision of the ARM Cortex-M7 core is r0p1 then use the FreeRTOS ARM 17 | Cortex-M7 r0p1 port located in the /FreeRTOS/Source/portable/RVDS/ARM_CM7/r0p1 18 | directory. -------------------------------------------------------------------------------- /modules/scansta1101.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef SCANSTA1101_H_ 23 | #define SCANSTA1101_H_ 24 | 25 | #include "pin_mapping.h" 26 | 27 | /** 28 | * @brief Initialize and configure SCANSTA1101 addr pins 29 | */ 30 | void scansta1101_init( void ); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/lpc17_progmem.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/lpc17_progmem.c 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | 26 | #include "LPC176x5x.h" 27 | 28 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/start_app.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/start_app.h 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | 26 | void start_app(const uint32_t* vtor); 27 | -------------------------------------------------------------------------------- /test/run_cmd.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import argparse 3 | from time import sleep 4 | 5 | parser = argparse.ArgumentParser() 6 | parser.add_argument('-t', '--target', help='I2C slave address of AFC Board') 7 | parser.add_argument('-i', '--ip', help='MCH IP address', default='10.0.18.192') 8 | parser.add_argument('-n', '--netfn', help='Net Function', required=True) 9 | parser.add_argument('-c', '--cmd', help='Command', required=True) 10 | parser.add_argument('-d', '--data', nargs='+', help='Data') 11 | args = parser.parse_args() 12 | 13 | ipmi_cmd = ['ipmitool'] 14 | ipmi_cmd.extend(['-I', 'lan']) 15 | ipmi_cmd.extend(['-H', args.ip]) 16 | ipmi_cmd.extend(['-P', '']) 17 | ipmi_cmd.extend(['-T', '0x82']) 18 | ipmi_cmd.extend(['-m', '0x20']) 19 | ipmi_cmd.extend(['-t', args.target]) 20 | ipmi_cmd.extend(['raw', args.netfn, args.cmd]) 21 | if (args.data): 22 | ipmi_cmd.extend(args.data) 23 | 24 | while 1: 25 | p = subprocess.Popen(ipmi_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 26 | out, err = p.communicate() 27 | model = ' 0a 02 05 50 02 1f 5a 31 00 01 01\n' 28 | if (out == model) : 29 | print 'Get_Device_ID has run successfully!' 30 | else: 31 | print 'Error!!' 32 | sleep(0.2) 33 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Softune/MB96340/__STD_LIB_sbrk.c: -------------------------------------------------------------------------------- 1 | /* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */ 2 | /* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */ 3 | /* ELIGIBILITY FOR ANY PURPOSES. */ 4 | /* (C) Fujitsu Microelectronics Europe GmbH */ 5 | /*--------------------------------------------------------------------------- 6 | __STD_LIB_sbrk.C 7 | - Used by heap_3.c for memory accocation and deletion. 8 | 9 | /*---------------------------------------------------------------------------*/ 10 | 11 | #include "FreeRTOSConfig.h" 12 | #include 13 | 14 | static long brk_siz = 0; 15 | typedef int _heep_t; 16 | #define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1)) 17 | static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)]; 18 | #define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE) 19 | 20 | extern char *sbrk(int size) 21 | { 22 | if (brk_siz + size > _heep_size || brk_siz + size < 0) 23 | 24 | return((char*)-1); 25 | brk_siz += size; 26 | return( (char*)_heep + brk_siz - size); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/AtmelSAM9XE/portasm.s79: -------------------------------------------------------------------------------- 1 | RSEG ICODE:CODE 2 | CODE32 3 | 4 | EXTERN vTaskSwitchContext 5 | 6 | PUBLIC vPortYieldProcessor 7 | PUBLIC vPortStartFirstTask 8 | 9 | #include "ISR_Support.h" 10 | 11 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12 | ; Starting the first task is just a matter of restoring the context that 13 | ; was created by pxPortInitialiseStack(). 14 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 15 | vPortStartFirstTask: 16 | portRESTORE_CONTEXT 17 | 18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 | ; Manual context switch function. This is the SWI hander. 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | vPortYieldProcessor: 22 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 23 | ; as if the context was saved during and IRQ 24 | ; handler. 25 | 26 | portSAVE_CONTEXT ; Save the context of the current task... 27 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 28 | mov lr, pc 29 | BX R0 30 | portRESTORE_CONTEXT ; Restore the context of the selected task. 31 | 32 | 33 | END 34 | 35 | -------------------------------------------------------------------------------- /modules/GitSHA1.c.in: -------------------------------------------------------------------------------- 1 | #define GIT_SHA1 "@GIT_SHA1@" 2 | #define GIT_TAG "@GIT_TAG@" 3 | const char g_GIT_SHA1[] = GIT_SHA1; 4 | const char g_GIT_TAG[] = GIT_TAG; 5 | 6 | #include 7 | #include 8 | #include 9 | #include "ipmi.h" 10 | 11 | static void hex_str_to_bin(const char* src, uint8_t* dest, size_t len) 12 | { 13 | for (size_t i = 0; src[i] && ((i / 2) < len); i++) 14 | { 15 | char c = src[i]; 16 | uint8_t nibble = 0; 17 | if (c >= '0' && c <= '9') 18 | { 19 | nibble = c & 0x0F; 20 | } 21 | else if (c >= 'A' && c <= 'F') 22 | { 23 | nibble = c - 'A' + 0x0A; 24 | } 25 | else if (c >= 'a' && c <= 'f') 26 | { 27 | nibble = c - 'a' + 0x0A; 28 | } 29 | if ((i % 2) == 0) 30 | { 31 | dest[i / 2] &= 0x0F; 32 | dest[i / 2] |= nibble << 4; 33 | } 34 | else 35 | { 36 | dest[i / 2] &= 0xF0; 37 | dest[i / 2] |= nibble; 38 | } 39 | } 40 | } 41 | 42 | IPMI_HANDLER(ipmi_custom_cmd_get_git_hash, NETFN_CUSTOM, IPMI_CUSTOM_CMD_GET_GIT_HASH, ipmi_msg *req, ipmi_msg *rsp) 43 | { 44 | hex_str_to_bin(GIT_SHA1, rsp->data, 20); 45 | rsp->data_len = 20; 46 | rsp->completion_code = IPMI_CC_OK; 47 | } 48 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/lpc17_uart.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/lpc17_uart.c 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | int lpc17_uart0_init(uint32_t baud, uint32_t cpu_clk); 28 | int lpc17_uart0_write_blocking(const uint8_t* buffer, size_t len); 29 | int lpc17_uart0_write_str_blocking(const char* buffer); 30 | -------------------------------------------------------------------------------- /modules/sys_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Augusto Fraga Giachero 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file sys_utils.c 24 | * @author Augusto Fraga Giachero 25 | * 26 | * @brief System utilities functions 27 | * 28 | * @ingroup sysutils 29 | */ 30 | 31 | /** 32 | * @brief Schedule a MCU reset 33 | * 34 | * @param[in] period_ms Reset the MCU after a period specified in milisseconds 35 | * 36 | * @return 0 if successful, non zero if there was an error 37 | */ 38 | int sys_schedule_reset(int period_ms); 39 | -------------------------------------------------------------------------------- /port/board/afc-v4/i2c_mapping.h: -------------------------------------------------------------------------------- 1 | #ifndef I2C_MAPPING_H_ 2 | #define I2C_MAPPING_H_ 3 | 4 | #include "i2c.h" 5 | 6 | #define I2CMODE_POOLING 1 7 | #define I2CMODE_INTERRUPT 0 8 | #define SPEED_100KHZ 100000 9 | 10 | enum { 11 | I2C_BUS_UNKNOWN_ID = 0x00, 12 | I2C_BUS_TEMP_SENSORS_ID, 13 | I2C_BUS_RTCE_ID, 14 | I2C_BUS_PORT2_ID, 15 | I2C_BUS_POWER_ID, 16 | I2C_BUS_CLOCK_ID, 17 | I2C_BUS_RTM_ID, 18 | I2C_BUS_FMC2_ID, 19 | I2C_BUS_FMC1_ID, 20 | I2C_BUS_MUX_ID, 21 | I2C_BUS_MCP_ID, 22 | I2C_BUS_CNT 23 | }; 24 | 25 | enum { 26 | CHIP_ID_MUX = 0, 27 | CHIP_ID_MAX6642, 28 | CHIP_ID_LM75AIM_0, 29 | CHIP_ID_LM75AIM_1, 30 | CHIP_ID_LM75AIM_2, 31 | CHIP_ID_LM75AIM_3, 32 | CHIP_ID_RTC_EEPROM, 33 | CHIP_ID_SRAM_RTCC, 34 | CHIP_ID_EEPROM, 35 | CHIP_ID_EUI, 36 | CHIP_ID_EEPROM_64K, 37 | CHIP_ID_INA_0, 38 | CHIP_ID_INA_1, 39 | CHIP_ID_INA_2, 40 | CHIP_ID_8V54816, 41 | CHIP_ID_FMC2_EEPROM, 42 | CHIP_ID_FMC2_LM75_0, 43 | CHIP_ID_FMC2_LM75_1, 44 | CHIP_ID_FMC1_EEPROM, 45 | CHIP_ID_FMC1_LM75_0, 46 | CHIP_ID_FMC1_LM75_1, 47 | CHIP_ID_MCP23016, 48 | I2C_CHIP_CNT 49 | }; 50 | 51 | #define I2C_MUX_CNT 2 52 | 53 | extern i2c_mux_state_t i2c_mux[I2C_MUX_CNT]; 54 | extern i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT]; 55 | extern i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT]; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/start_app.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/start_app.c 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include "LPC176x5x.h" 25 | 26 | void start_app(const uint32_t* vtor) 27 | { 28 | __disable_irq(); 29 | SCB->VTOR = (uint32_t)vtor; 30 | uint32_t sp = vtor[0]; 31 | uint32_t pc = vtor[1]; 32 | __asm__ volatile ( 33 | "mov sp, %0 \n" 34 | "bx %1 \n" 35 | : 36 | : "r"(sp), "r"(pc) 37 | : 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /port/board/afc-v4/board_config.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Krzysztof Macias 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /* Project Includes */ 23 | #include "port.h" 24 | 25 | void board_init() { 26 | /* I2C MUX Init */ 27 | gpio_set_pin_state(PIN_PORT(GPIO_I2C_MUX_ADDR1), PIN_NUMBER(GPIO_I2C_MUX_ADDR1), GPIO_LEVEL_LOW); 28 | gpio_set_pin_state(PIN_PORT(GPIO_I2C_MUX_ADDR2), PIN_NUMBER(GPIO_I2C_MUX_ADDR2), GPIO_LEVEL_LOW); 29 | gpio_set_pin_state(PIN_PORT(GPIO_I2C_SW_RESETn), PIN_NUMBER(GPIO_I2C_SW_RESETn), GPIO_LEVEL_HIGH); 30 | } 31 | 32 | void board_config() { 33 | } 34 | -------------------------------------------------------------------------------- /toolchain/cmake-modules/LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /port/board/afc-common/board_led.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef BOARD_LED_H_ 23 | #define BOARD_LED_H_ 24 | 25 | #define LED_CNT 3 26 | 27 | #include "port.h" 28 | 29 | enum LED_ID { 30 | LED_BLUE = 0, 31 | LED1, /* Red */ 32 | LED2, /* Green */ 33 | LED_MAX_CNT 34 | }; 35 | 36 | extern const uint32_t led_pincfg[LED_MAX_CNT]; 37 | extern const LEDConfig_t leds_config[LED_MAX_CNT]; 38 | #ifdef MODULE_RTM 39 | extern const LEDConfig_t rtm_leds_config[LED_MAX_CNT]; 40 | #endif 41 | 42 | #endif /* BOARD_LED_H_ */ 43 | -------------------------------------------------------------------------------- /toolchain/cmake-modules/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | else() 27 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 28 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 29 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 30 | set(HEAD_HASH "${CMAKE_MATCH_1}") 31 | endif() 32 | endif() 33 | else() 34 | # detached HEAD 35 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 36 | endif() 37 | 38 | if(NOT HEAD_HASH) 39 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 40 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 41 | endif() 42 | -------------------------------------------------------------------------------- /FreeRTOS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Build FreeRTOS library 2 | 3 | set(FREERTOS_INCDIR ${CMAKE_CURRENT_SOURCE_DIR}/include) 4 | 5 | set(FREERTOS_INC ${FREERTOS_INCDIR}) 6 | 7 | #Include FreeRTOS Trace module sources 8 | if(FREERTOS_TRACE) 9 | add_subdirectory(trace) 10 | endif() 11 | 12 | #Port files 13 | if(${TARGET_CONTROLLER} MATCHES "^(lpc|LPC)17") 14 | set(FREERTOS_INC ${FREERTOS_INC} ${CMAKE_CURRENT_SOURCE_DIR}/portable/GCC/ARM_CM3) 15 | set(LIBFREERTOS_SRCS ${LIBFREERTOS_SRCS} 16 | portable/GCC/ARM_CM3/port.c 17 | portable/MemMang/heap_4.c 18 | ) 19 | set(TARGET_ARCH "armv7-m" ) 20 | set(TARGET_CPU "cortex-m3") 21 | set(FREERTOS_FLAGS ${FREERTOS_FLAGS} -mcpu=${TARGET_CPU} -mtune=${TARGET_CPU}) 22 | set(FREERTOS_FLAGS ${FREERTOS_FLAGS} -march=${TARGET_ARCH}) 23 | set(FREERTOS_FLAGS ${FREERTOS_FLAGS} -mthumb -mthumb-interwork -mno-sched-prolog -mapcs-frame) 24 | else() 25 | message(FATAL_ERROR "${BoldRed}The specified controller doesn't have a supported FreeRTOS port!${ColourReset}") 26 | endif() 27 | 28 | #FreeRTOS common files 29 | set(LIBFREERTOS_SRCS ${LIBFREERTOS_SRCS} 30 | list.c 31 | queue.c 32 | timers.c 33 | tasks.c 34 | event_groups.c 35 | openocd.c 36 | ) 37 | 38 | include_directories(${UCONTROLLER_HDRS}) 39 | 40 | string(REGEX REPLACE ";" " " FREERTOS_FLAGS "${FREERTOS_FLAGS}") 41 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FREERTOS_FLAGS}") 42 | 43 | add_library(FreeRTOS STATIC ${LIBFREERTOS_SRCS}) 44 | target_include_directories(FreeRTOS PUBLIC ${FREERTOS_INC}) 45 | -------------------------------------------------------------------------------- /modules/uart_debug.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file uart_debug.c 24 | * @author Henrique Silva , LNLS 25 | * 26 | * @brief UART interface implementation 27 | */ 28 | 29 | /* Project includes */ 30 | #include "port.h" 31 | #include "uart_debug.h" 32 | #include "stdarg.h" 33 | 34 | char debug_buf[100]; 35 | 36 | 37 | void uart_printf( uint8_t id, const char *format, ... ) 38 | { 39 | va_list args; 40 | 41 | va_start( args, format ); 42 | ( void )vsprintf( debug_buf, format, args ); 43 | 44 | uart_send( id, debug_buf, strlen(debug_buf) ); 45 | } 46 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/lpc17_pincfg.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/lpc17_pincfg.h 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | 26 | enum pincfg_mode 27 | { 28 | pin_mode_pullup = 0, 29 | pin_mode_repeater = 1, 30 | pin_mode_none = 2, 31 | pin_mode_pulldown = 3, 32 | }; 33 | 34 | enum pincfg_func 35 | { 36 | pin_func_gpio = 0, 37 | pin_func_alt1 = 1, 38 | pin_func_alt2 = 2, 39 | pin_func_alt3 = 3, 40 | }; 41 | 42 | void lp17_pincfg(uint8_t port, uint8_t pin, enum pincfg_mode mode, enum pincfg_func func); 43 | -------------------------------------------------------------------------------- /toolchain/toolchain-arm-none-eabi.cmake: -------------------------------------------------------------------------------- 1 | include(CMakeForceCompiler) 2 | 3 | set(CMAKE_SYSTEM_NAME Generic) 4 | set(CMAKE_SYSTEM_VERSION 1) 5 | 6 | # Set a toolchain path. You only need to set this if the toolchain isn't in 7 | # your system path. Don't forget a trailing path separator! 8 | set( TC_PATH "" ) 9 | 10 | # The toolchain prefix for all toolchain executables 11 | set( CROSS_COMPILE arm-none-eabi- ) 12 | 13 | # specify the cross compiler. We force the compiler so that CMake doesn't 14 | # attempt to build a simple test program as this will fail without us using 15 | # the -nostartfiles option on the command line 16 | set(CMAKE_C_COMPILER ${CROSS_COMPILE}gcc) 17 | set(CMAKE_CXX_COMPILER ${CROSS_COMPILE}g++) 18 | set(CMAKE_ASM_COMPILER ${CROSS_COMPILE}gcc) 19 | 20 | # We must set the OBJCOPY setting into cache so that it's available to the 21 | # whole project. Otherwise, this does not get set into the CACHE and therefore 22 | # the build doesn't know what the OBJCOPY filepath is 23 | set( CMAKE_OBJCOPY ${TC_PATH}${CROSS_COMPILE}objcopy 24 | CACHE FILEPATH "The toolchain objcopy command " FORCE ) 25 | 26 | set( CMAKE_OBJDUMP ${TC_PATH}${CROSS_COMPILE}objdump 27 | CACHE FILEPATH "The toolchain objdump command " FORCE ) 28 | 29 | set(COMMON_FLAGS "-fno-common -fno-builtin-printf -ffunction-sections -fdata-sections -fno-strict-aliasing -fmessage-length=0") 30 | set(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99") 31 | set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=gnu++0x") 32 | set(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections,--undefined=uxTopUsedPriority --specs=nano.specs -nostartfiles") 33 | -------------------------------------------------------------------------------- /port/board/afc-v3/i2c_mapping.h: -------------------------------------------------------------------------------- 1 | #ifndef I2C_MAPPING_H_ 2 | #define I2C_MAPPING_H_ 3 | 4 | #include "i2c.h" 5 | 6 | #define I2CMODE_POOLING 1 7 | #define I2CMODE_INTERRUPT 0 8 | #define SPEED_100KHZ 100000 9 | 10 | // BUS_ID 11 | // 0 - FMC1 12 | // 1 - FMC2 13 | // 3 - CPU_ID 14 | // 15 | /////////////////////// 16 | 17 | enum { 18 | CARRIER_TYPE_AFC = 0x01, 19 | CARRIER_TYPE_AFCK, 20 | CARRIER_TYPE_UNKNOWN = 0xFF 21 | }; 22 | 23 | enum { 24 | I2C_BUS_UNKNOWN_ID = 0x00, 25 | I2C_BUS_FMC1_ID, 26 | I2C_BUS_FMC2_ID, 27 | I2C_BUS_CPU_ID, 28 | I2C_BUS_RTM_ID, 29 | I2C_BUS_CLOCK_ID, 30 | I2C_BUS_FPGA_ID 31 | }; 32 | 33 | enum { 34 | CHIP_ID_MUX = 0, 35 | CHIP_ID_LM75AIM_0, 36 | CHIP_ID_LM75AIM_1, 37 | CHIP_ID_LM75AIM_2, 38 | CHIP_ID_LM75AIM_3, 39 | CHIP_ID_MAX6642, 40 | CHIP_ID_RTC, 41 | CHIP_ID_RTC_EEPROM, 42 | CHIP_ID_EEPROM, 43 | CHIP_ID_EEPROM_ID, 44 | CHIP_ID_INA_0, 45 | CHIP_ID_INA_1, 46 | CHIP_ID_INA_2, 47 | CHIP_ID_INA_3, 48 | CHIP_ID_INA_4, 49 | CHIP_ID_INA_5, 50 | CHIP_ID_ADN, 51 | CHIP_ID_SI57x, 52 | CHIP_ID_FMC1_EEPROM, 53 | CHIP_ID_FMC1_LM75_1, 54 | CHIP_ID_FMC1_LM75_0, 55 | CHIP_ID_FMC2_EEPROM, 56 | CHIP_ID_FMC2_LM75_1, 57 | CHIP_ID_FMC2_LM75_0, 58 | }; 59 | 60 | #define I2C_MUX_CNT 2 61 | #define I2C_BUS_CNT 7 62 | #define I2C_CHIP_CNT 24 63 | 64 | extern i2c_mux_state_t i2c_mux[I2C_MUX_CNT]; 65 | extern i2c_bus_mapping_t i2c_bus_map[I2C_BUS_CNT]; 66 | extern i2c_chip_mapping_t i2c_chip_map[I2C_CHIP_CNT]; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /modules/uart_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file uart_debug.h 24 | * @author Henrique Silva , LNLS 25 | * 26 | * @brief UART interface implementation 27 | */ 28 | 29 | #ifndef UART_DEBUG_H_ 30 | #define UART_DEBUG_H_ 31 | 32 | #include "port.h" 33 | 34 | #undef putchar 35 | 36 | #ifdef MODULE_UART_DEBUG 37 | 38 | /** 39 | * @brief Macro to call uart debug printf function 40 | * 41 | * @warning When MODULE_UART_DEBUG is not defined, this macro simply throws out its args and do nothing 42 | * 43 | * @param msg Formatted string to print 44 | * 45 | */ 46 | #define putchar(c) uart_send(UART_DEBUG, &c, 1) 47 | 48 | #else 49 | 50 | #define putchar(c) (void)0 51 | 52 | #endif 53 | #endif 54 | -------------------------------------------------------------------------------- /port/board/afc-v4/ipmi_oem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2016 Henrique Silva 5 | * Copyright (C) 2015 Piotr Miedzik 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * @license GPL-3.0+ 21 | */ 22 | 23 | #ifndef IPMI_OEM_H_ 24 | #define IPMI_OEM_H_ 25 | 26 | /** 27 | * @file afc-v4/ipmi_oem.h 28 | * @brief Custom IPMI commands for AFC 29 | * 30 | * @ingroup AFC_V4_0_IPMI_OEM 31 | */ 32 | 33 | /** 34 | * @defgroup AFC_V4_0_IPMI_OEM AFCv4.0 IPMI OEM Commands 35 | * @ingroup AFC_V4_0 36 | * @{ 37 | */ 38 | 39 | #include "ipmi.h" 40 | 41 | /** 42 | * @brief Custom NetFN (User defined, value greater than 0x2C) 43 | */ 44 | #define NETFN_CUSTOM_OEM 0x30 45 | 46 | #define IPMI_OEM_CMD_I2C_TRANSFER 0x00 47 | #define IPMI_OEM_CMD_GPIO_PIN 0x04 48 | /** 49 | * @} 50 | */ 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/port.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file port.h 22 | * @author Henrique Silva , LNLS 23 | * @date September 2015 24 | * 25 | * @brief Port layer (includes all portable functions headers) 26 | */ 27 | 28 | #ifndef PORT_H_ 29 | #define PORT_H_ 30 | 31 | /* List of all LPC17xx specific headers to be included */ 32 | 33 | #include "chip_lpc175x_6x.h" 34 | #include "lpc17_gpio.h" 35 | #include "lpc17_i2c.h" 36 | #include "lpc17_ssp.h" 37 | #include "lpc17_spi.h" 38 | #include "lpc17_watchdog.h" 39 | #include "lpc17_interruptions.h" 40 | #include "lpc17_hpm.h" 41 | #include "lpc17_power.h" 42 | #include "lpc17_pincfg.h" 43 | #include "pin_mapping.h" 44 | #include "arm_cm3_reset.h" 45 | 46 | #ifdef UART_RINGBUFFER 47 | #include "lpc17_uartrb.h" 48 | #else 49 | #include "lpc17_uart.h" 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /port/board/afc-v3/ipmi_oem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2016 Henrique Silva 5 | * Copyright (C) 2015 Piotr Miedzik 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * @license GPL-3.0+ 21 | */ 22 | 23 | #ifndef IPMI_OEM_H_ 24 | #define IPMI_OEM_H_ 25 | 26 | /** 27 | * @file afc-timing/ipmi_oem.h 28 | * @brief Custom IPMI commands for AFC Timing 29 | * 30 | * @ingroup AFC_TIMING_IPMI_OEM 31 | */ 32 | 33 | /** 34 | * @defgroup AFC_TIMING_IPMI_OEM AFC-Timing IPMI OEM Commands 35 | * @ingroup AFC_TIMING 36 | * @{ 37 | */ 38 | 39 | #include "ipmi.h" 40 | 41 | /** 42 | * @brief Custom NetFN (User defined, value greater than 0x2C) 43 | */ 44 | #define NETFN_CUSTOM_OEM 0x30 45 | 46 | #define IPMI_OEM_CMD_I2C_TRANSFER 0x00 47 | #define IPMI_OEM_CMD_GPIO_PIN 0x04 48 | /** 49 | * @} 50 | */ 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_i2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_i2c.h 22 | * @author Henrique Silva , LNLS 23 | * @date March 2016 24 | * 25 | * @brief I2C driver for LPC17xx 26 | */ 27 | 28 | /*! @brief Max message length (in bits) used in I2C */ 29 | #define i2cMAX_MSG_LENGTH 32 30 | 31 | #define xI2CMasterWrite(id, addr, tx_buff, tx_len) Chip_I2C_MasterSend(id, addr, tx_buff, tx_len) 32 | #define xI2CMasterRead(id, addr, rx_buff, rx_len) Chip_I2C_MasterRead(id, addr, rx_buff, rx_len) 33 | 34 | uint8_t xI2CSlaveReceive( I2C_ID_T id, uint8_t * rx_buff, uint8_t buff_len, uint32_t timeout ); 35 | void vI2CSlaveSetup ( I2C_ID_T id, uint8_t slave_addr ); 36 | void vI2CConfig( I2C_ID_T id, uint32_t speed ); 37 | int xI2CMasterWriteRead(I2C_ID_T id, uint8_t addr, const uint8_t *tx_buff, int tx_len, uint8_t *rx_buff, int rx_len); 38 | -------------------------------------------------------------------------------- /modules/ad84xx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef AD84XX_H_ 23 | #define AD84XX_H_ 24 | 25 | /** 26 | * @brief Initializes AD84XX DAC interface 27 | * 28 | * @note This module uses legacy SPI and controls SSEL as a GPIO 29 | */ 30 | void dac_ad84xx_init( void ); 31 | 32 | /** 33 | * @brief Write a value to the AD84xx DAC output register 34 | * 35 | * @param addr Selects which potentiometer will be set 36 | * @param val Value to be set 37 | */ 38 | void dac_ad84xx_set_val( uint8_t addr, uint8_t val ); 39 | 40 | /** 41 | * @brief Converts a resistance value into a proportional divisor value for AD84xx 42 | * 43 | * @param addr Selects which potentiometer will be set 44 | * @param val Output resistance value [in Ohms] 45 | */ 46 | void dac_ad84xx_set_res( uint8_t addr, uint16_t res ); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Renesas/RX600v2/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | .GLB _vSoftwareInterruptISR 28 | .GLB _vSoftwareInterruptEntry 29 | 30 | .SECTION P,CODE 31 | 32 | _vSoftwareInterruptEntry: 33 | 34 | BRA _vSoftwareInterruptISR 35 | 36 | .RVECTOR 27, _vSoftwareInterruptEntry 37 | 38 | .END 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Renesas/RX100/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | .GLB _vSoftwareInterruptISR 28 | .GLB _vSoftwareInterruptEntry 29 | 30 | .SECTION P,CODE 31 | 32 | _vSoftwareInterruptEntry: 33 | 34 | BRA _vSoftwareInterruptISR 35 | 36 | .RVECTOR 27, _vSoftwareInterruptEntry 37 | 38 | .END 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Renesas/RX200/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | .GLB _vSoftwareInterruptISR 28 | .GLB _vSoftwareInterruptEntry 29 | 30 | .SECTION P,CODE 31 | 32 | _vSoftwareInterruptEntry: 33 | 34 | BRA _vSoftwareInterruptISR 35 | 36 | .RVECTOR 27, _vSoftwareInterruptEntry 37 | 38 | .END 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Renesas/RX600/port_asm.src: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | .GLB _vSoftwareInterruptISR 28 | .GLB _vSoftwareInterruptEntry 29 | 30 | .SECTION P,CODE 31 | 32 | _vSoftwareInterruptEntry: 33 | 34 | BRA _vSoftwareInterruptISR 35 | 36 | .RVECTOR 27, _vSoftwareInterruptEntry 37 | 38 | .END 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_uart.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_uart.c 22 | * @author Henrique Silva , LNLS 23 | * @date June 2016 24 | * 25 | * @brief 26 | */ 27 | 28 | #include "port.h" 29 | 30 | const lpc_uart_cfg_t usart_cfg[4] = { 31 | { LPC_UART0, UART0_IRQn, SYSCTL_PCLK_UART0 }, 32 | { LPC_UART1, UART1_IRQn, SYSCTL_PCLK_UART1 }, 33 | { LPC_UART2, UART2_IRQn, SYSCTL_PCLK_UART2 }, 34 | { LPC_UART3, UART3_IRQn, SYSCTL_PCLK_UART3 } 35 | }; 36 | 37 | void uart_init ( uint8_t id ) 38 | { 39 | Chip_Clock_SetPCLKDiv( usart_cfg[id].sysclk, SYSCTL_CLKDIV_2 ); 40 | 41 | Chip_UART_Init( usart_cfg[id].ptr ); 42 | 43 | /* Standard 115200 baud rate */ 44 | uart_set_baud( UART_DEBUG, 115200 ); 45 | 46 | /* Defaults to 8N1, no parity */ 47 | uart_config_data( UART_DEBUG, ( UART_LCR_WLEN8 | UART_LCR_SBS_1BIT | UART_LCR_PARITY_DIS ) ); 48 | 49 | uart_tx_enable ( UART_DEBUG ); 50 | } 51 | -------------------------------------------------------------------------------- /port/board/rtm-8sfp/rtm_user.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef RTM_USER_H_ 23 | #define RTM_USER_H_ 24 | 25 | /* PCA9554 outputs */ 26 | #define RTM_GPIO_HOTSWAP_HANDLE 0 27 | #define RTM_GPIO_OVERTEMP_SHUTDOWN 4 28 | #define RTM_GPIO_LED_RED 5 29 | #define RTM_GPIO_LED_GREEN 6 30 | #define RTM_GPIO_LED_BLUE 7 31 | 32 | #include "mmc_error.h" 33 | 34 | /* Mandatory RTM module functions */ 35 | mmc_err rtm_enable_payload_power_post( void ); 36 | mmc_err rtm_disable_payload_power_pre( void ); 37 | uint8_t rtm_get_hotswap_handle_status( uint8_t *state ); 38 | void rtm_hardware_init( void ); 39 | void rtm_ctrl_led( uint8_t id, uint8_t state ); 40 | uint8_t rtm_read_led( uint8_t id ); 41 | bool rtm_compatibility_check( void ); 42 | 43 | /* User defined functions */ 44 | void rtm_enable_i2c( void ); 45 | void rtm_disable_i2c( void ); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/inc/sys_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @note 3 | * Copyright(C) NXP Semiconductors, 2014 4 | * All rights reserved. 5 | * 6 | * @par 7 | * Software that is described herein is for illustrative purposes only 8 | * which provides customers with programming information regarding the 9 | * LPC products. This software is supplied "AS IS" without any warranties of 10 | * any kind, and NXP Semiconductors and its licensor disclaim any and 11 | * all warranties, express or implied, including all implied warranties of 12 | * merchantability, fitness for a particular purpose and non-infringement of 13 | * intellectual property rights. NXP Semiconductors assumes no responsibility 14 | * or liability for the use of the software, conveys no license or rights under any 15 | * patent, copyright, mask work right, or any other intellectual property rights in 16 | * or to any products. NXP Semiconductors reserves the right to make changes 17 | * in the software without notification. NXP Semiconductors also makes no 18 | * representation or warranty that such application will be suitable for the 19 | * specified use without further testing or modification. 20 | * 21 | * @par 22 | * Permission to use, copy, modify, and distribute this software and its 23 | * documentation is hereby granted, under NXP Semiconductors' and its 24 | * licensor's relevant copyrights in the software, without fee, provided that it 25 | * is used in conjunction with NXP Semiconductors microcontrollers. This 26 | * copyright, permission, and disclaimer notice must appear in all copies of 27 | * this code. 28 | */ 29 | 30 | #ifndef __SYS_CONFIG_H_ 31 | #define __SYS_CONFIG_H_ 32 | 33 | /* Build for 175x/6x chip family */ 34 | #define CHIP_LPC175X_6X 35 | 36 | #endif /* __SYS_CONFIG_H_ */ 37 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build for all targets 2 | on: 3 | push: 4 | branches: 5 | - master 6 | - devel 7 | pull_request: 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | container: 13 | image: ghcr.io/lnls-dig/openmmc-builder:latest 14 | strategy: 15 | matrix: 16 | build-flags: 17 | - { flags: -DBOARD=afc -DVERSION=3.1 -DBOARD_RTM=8sfp } 18 | - { flags: -DBOARD=afc -DVERSION=4.0 -DBOARD_RTM=lamp} 19 | - { flags: -DBOARD=afc -DVERSION=4.0 -DBOARD_RTM=lamp -DDEBUG_PROBE=jlink -DOPENOCD_TRANSPORT=swd } 20 | - { flags: -DBOARD=afc -DVERSION=4.0 -DBOARD_RTM=lamp -DDEBUG_PROBE=cmsis-dap -DOPENOCD_TRANSPORT=swd } 21 | - { flags: -DBOARD=afc -DVERSION=4.0 -DBOARD_RTM=lamp -DDEBUG_PROBE=digilent_jtag_hs3 -DOPENOCD_TRANSPORT=jtag } 22 | - { flags: -DBOARD=afc -DVERSION=4.0 -DBOARD_RTM=lamp -DDEBUG_PROBE=xvc -DOPENOCD_TRANSPORT=jtag -DXVC_HOST=host -DXVC_PORT=0000} 23 | steps: 24 | - uses: actions/checkout@v4 25 | with: 26 | submodules: true 27 | - name: Create build environment 28 | run: mkdir build 29 | - name: Configure CMake 30 | working-directory: build 31 | run: cmake .. -DCMAKE_BUILD_TYPE=RELWITHDEBINFO ${{matrix.build-flags.flags}} 32 | - name: Build for all targets 33 | working-directory: build 34 | run: make 35 | 36 | test_make_release: 37 | runs-on: ubuntu-latest 38 | container: 39 | image: ghcr.io/lnls-dig/openmmc-builder:latest 40 | steps: 41 | - uses: actions/checkout@v4 42 | with: 43 | submodules: true 44 | - name: Create build environment 45 | run: mkdir build 46 | - name: Run make-release.sh 47 | working-directory: scripts 48 | run: ./make-release.sh 49 | -------------------------------------------------------------------------------- /toolchain/PreventInSourceBuilds.cmake: -------------------------------------------------------------------------------- 1 | # Adapted from ITK solution 2 | # https://github.com/InsightSoftwareConsortium/ITK/blob/master/CMake/PreventInSourceBuilds.cmake 3 | 4 | # This function will prevent in-source builds 5 | function(AssureOutOfSourceBuilds) 6 | # make sure the user doesn't play dirty with symlinks 7 | get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) 8 | get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) 9 | 10 | # disallow in-source builds 11 | if("${srcdir}" STREQUAL "${bindir}") 12 | message("######################################################") 13 | message("# openMMC should not be configured & built in the root source directory") 14 | message("# You must run cmake in a build directory.") 15 | message("# For example:") 16 | message("# mkdir build") 17 | message("#") 18 | message("# Then you can proceed to configure and build") 19 | message("# by using the following commands") 20 | message("#") 21 | message("# cd build") 22 | message("# cmake && make ") 23 | message("#") 24 | message("# or:") 25 | message("# cmake -B -H ") 26 | message("#") 27 | message("# NOTE: Given that you already tried to make an in-source build") 28 | message("# CMake have already created several files & directories") 29 | message("# in your source tree. Run the folowing commands to remove them:") 30 | message("#") 31 | message("# cd ") 32 | message("# git clean -fdX -n") 33 | message("# git clean -fdX") 34 | message("#") 35 | message("######################################################") 36 | message(FATAL_ERROR "Quitting configuration") 37 | endif() 38 | endfunction() 39 | 40 | AssureOutOfSourceBuilds() 41 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_spi.h 22 | * @author Henrique Silva , LNLS 23 | * @date March 2016 24 | * 25 | * @brief Legacy SPI driver definitions for LPC17xx 26 | */ 27 | 28 | #ifndef LPC17xx_SPI_H_ 29 | #define LPC17xx_SPI_H_ 30 | 31 | #include "spi_17xx_40xx.h" 32 | 33 | #define spi_init(id) Chip_SPI_Init(id) 34 | #define spi_deinit(id) Chip_SPI_DeInit(id) 35 | #define spi_flush_rx(id) Chip_SPI_Int_FlushData(id) 36 | #define spi_set_bitrate(id, bitrate) Chip_SPI_SetBitRate(id, bitrate) 37 | 38 | #define SPI_SLAVE 0 39 | #define SPI_MASTER 1 40 | #define SPI_INTERRUPT 0 41 | #define SPI_POLLING 1 42 | 43 | void spi_config( uint32_t bitrate, uint8_t frame_sz, bool master_mode, bool poll ); 44 | uint32_t spi_write( uint8_t * buffer, uint32_t buffer_len ); 45 | void spi_assertSSEL(void); 46 | void spi_deassertSSEL(void); 47 | #endif 48 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_pincfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * @file lpc17_pincfg.c 22 | * @brief Pin Config functions redirection for LPC17xx 23 | * 24 | * @author Henrique Silva , LNLS 25 | */ 26 | 27 | #include "port.h" 28 | 29 | /** 30 | * @brief Sets I/O Control pin mux 31 | * @param port : GPIO port to mux 32 | * @param pin : GPIO pin to mux 33 | * @param cfg : Configuration bits to select pin mode/function 34 | * @see IOCON_17XX_40XX_MODE_FUNC 35 | */ 36 | 37 | void pin_init( void ) 38 | { 39 | uint8_t i; 40 | uint32_t cfg[] = { PIN_CFG_LIST }; 41 | uint8_t list_len = sizeof(cfg)/(sizeof(cfg[0])); 42 | 43 | for ( i = 0; i < list_len; i++ ) { 44 | Chip_IOCON_PinMuxSet(LPC_IOCON, PIN_PORT(cfg[i]), PIN_NUMBER(cfg[i]), PIN_FUNC(cfg[i])); 45 | if ( PIN_DIR(cfg[i]) != NON_GPIO ) { 46 | /* Config GPIO direction */ 47 | gpio_set_pin_dir( PIN_PORT(cfg[i]), PIN_NUMBER(cfg[i]), PIN_DIR(cfg[i])); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /modules/scansta1101.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #include "port.h" 23 | #include "scansta1101.h" 24 | 25 | void scansta1101_init( void ) 26 | { 27 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR0), PIN_NUMBER(GPIO_SCANSTA1101_ADDR0), GPIO_LEVEL_LOW ); 28 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR1), PIN_NUMBER(GPIO_SCANSTA1101_ADDR1), GPIO_LEVEL_LOW ); 29 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR2), PIN_NUMBER(GPIO_SCANSTA1101_ADDR2), GPIO_LEVEL_LOW ); 30 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR3), PIN_NUMBER(GPIO_SCANSTA1101_ADDR3), GPIO_LEVEL_LOW ); 31 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR4), PIN_NUMBER(GPIO_SCANSTA1101_ADDR4), GPIO_LEVEL_LOW ); 32 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR5), PIN_NUMBER(GPIO_SCANSTA1101_ADDR5), GPIO_LEVEL_LOW ); 33 | gpio_set_pin_state( PIN_PORT(GPIO_SCANSTA1101_ADDR6), PIN_NUMBER(GPIO_SCANSTA1101_ADDR6), GPIO_LEVEL_LOW ); 34 | } 35 | -------------------------------------------------------------------------------- /modules/sensors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Sensors 2 | set(SENSOR_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | include_directories(${SENSOR_PATH}) 5 | 6 | if (";${TARGET_MODULES};" MATCHES ";HOTSWAP_SENSOR;") 7 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/hotswap.c ) 8 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_HOTSWAP") 9 | endif() 10 | 11 | if (";${TARGET_MODULES};" MATCHES ";LM75;") 12 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/lm75.c) 13 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_LM75") 14 | endif() 15 | 16 | if (";${TARGET_MODULES};" MATCHES ";MAX6642;") 17 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/max6642.c) 18 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_MAX6642") 19 | endif() 20 | 21 | if (";${TARGET_MODULES};" MATCHES ";INA220_VOLTAGE;") 22 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220.c) 23 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_INA220_VOLTAGE") 24 | endif() 25 | 26 | if (";${TARGET_MODULES};" MATCHES ";INA220_CURRENT;") 27 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina220.c) 28 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_INA220_CURRENT") 29 | endif() 30 | 31 | if (";${TARGET_MODULES};" MATCHES ";INA3221_VOLTAGE;") 32 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina3221.c) 33 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_INA3221_VOLTAGE") 34 | endif() 35 | 36 | if (";${TARGET_MODULES};" MATCHES ";INA3221_CURRENT;") 37 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/ina3221.c) 38 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_INA3221_CURRENT") 39 | endif() 40 | 41 | if (";${TARGET_MODULES};" MATCHES ";MAX116XX;") 42 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH}/max11609.c) 43 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_MAX11609") 44 | endif() 45 | 46 | set(PROJ_SRCS ${PROJ_SRCS} ${SENSOR_PATH} PARENT_SCOPE) 47 | set(PROJ_HDRS ${PROJ_HDRS} ${SENSOR_PATH} PARENT_SCOPE) 48 | set(MODULES_FLAGS "${MODULES_FLAGS}" PARENT_SCOPE) 49 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/inc/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.4 5 | * @date 23. July 2019 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2019 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 4U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /modules/watchdog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file watchdog.c 24 | * @author Henrique Silva , LNLS 25 | * 26 | * @brief Reset the uC if it fails to reload the watchdog timer 27 | */ 28 | 29 | /* FreeRTOS includes */ 30 | #include "FreeRTOS.h" 31 | #include "task.h" 32 | #include "semphr.h" 33 | 34 | /* Project includes */ 35 | #include "port.h" 36 | #include "watchdog.h" 37 | #include "task_priorities.h" 38 | #include "uart_debug.h" 39 | 40 | void watchdog_init( void ) 41 | { 42 | wdt_init(); 43 | wdt_config(); 44 | wdt_set_timeout(((WATCHDOG_TIMEOUT/1000)*WATCHDOG_CLK_FREQ)); 45 | xTaskCreate( WatchdogTask, (const char *) "Watchdog Task", 60, (void * ) NULL, tskWATCHDOG_PRIORITY, ( TaskHandle_t * ) NULL); 46 | } 47 | 48 | void WatchdogTask (void * Parameters) 49 | { 50 | wdt_start(); 51 | for ( ;; ) { 52 | wdt_feed(); 53 | vTaskDelay(pdMS_TO_TICKS(WATCHDOG_FEED_DELAY)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /port/board/afc-common/board_fru.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /*! @file fru.c 23 | */ 24 | 25 | #include "port.h" 26 | #include "fru.h" 27 | #include "fru_editor.h" 28 | #include "at24mac.h" 29 | #include "eeprom_24xx64.h" 30 | #include "i2c_mapping.h" 31 | #ifdef MODULE_RTM 32 | #include "rtm_i2c_mapping.h" 33 | #endif 34 | fru_data_t fru[FRU_COUNT] = { 35 | [FRU_AMC] = { 36 | .cfg = { 37 | .eeprom_id = CHIP_ID_EEPROM, 38 | .build_f = amc_fru_info_build, 39 | .read_f = at24mac_read, 40 | .write_f = at24mac_write, 41 | }, 42 | .runtime = false 43 | }, 44 | #ifdef MODULE_RTM 45 | 46 | [FRU_RTM] = { 47 | .cfg = { 48 | .eeprom_id = CHIP_ID_RTM_EEPROM, 49 | .build_f = rtm_fru_info_build, 50 | .read_f = eeprom_24xx64_read, 51 | .write_f = eeprom_24xx64_write, 52 | }, 53 | .runtime = false 54 | } 55 | #endif 56 | }; 57 | -------------------------------------------------------------------------------- /modules/sensors/sensors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @defgroup SENSORS Sensors 24 | * @ingroup PERIPH_IC 25 | */ 26 | 27 | /** 28 | * @file sensors.h 29 | * @author Henrique Silva , LNLS 30 | * 31 | * @brief Shortcut to include all sensors headers (not mandatory, user can include each sensor separately) 32 | * 33 | * @ingroup SENSORS 34 | */ 35 | 36 | #ifndef SENSORS_H_ 37 | #define SENSORS_H_ 38 | 39 | #include "port.h" 40 | 41 | #if defined(MODULE_INA220_VOLTAGE) || defined(MODULE_INA220_CURRENT) 42 | #include "ina220.h" 43 | #endif 44 | 45 | #if defined(MODULE_INA3221_VOLTAGE) || defined(MODULE_INA3221_CURRENT) 46 | #include "ina3221.h" 47 | #endif 48 | 49 | #ifdef MODULE_HOTSWAP 50 | #include "hotswap.h" 51 | #endif 52 | 53 | #ifdef MODULE_LM75 54 | #include "lm75.h" 55 | #endif 56 | 57 | #ifdef MODULE_MAX6642 58 | #include "max6642.h" 59 | #endif 60 | 61 | #ifdef MODULE_MAX11609 62 | #include "max11609.h" 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /modules/rtm_fru.c: -------------------------------------------------------------------------------- 1 | #include "rtm_user_fru.h" 2 | 3 | size_t rtm_fru_info_build( uint8_t **buffer ) 4 | { 5 | uint8_t *hdr_ptr, *board_ptr, *product_ptr, *z3_ptr; 6 | uint8_t int_use_off = 0, chassis_off = 0, board_off = 0, product_off = 0, z3_compat_off = 0, multirec_off = 0; 7 | size_t int_use_sz = 0, chassis_sz = 0, board_sz = 0, product_sz = 0, z3_compat_sz = 0; 8 | size_t offset = 0; 9 | 10 | /* Skip the common header */ 11 | offset += 8; 12 | 13 | /* Board Information Area */ 14 | board_off = offset; 15 | board_sz = board_info_area_build( &board_ptr, RTM_LANG_CODE, RTM_BOARD_MANUFACTURING_TIME, RTM_BOARD_MANUFACTURER, RTM_BOARD_NAME, RTM_BOARD_SN, RTM_BOARD_PN, RTM_FRU_FILE_ID ); 16 | offset += board_sz; 17 | 18 | /* Product Information Area */ 19 | product_off = offset; 20 | product_sz = product_info_area_build( &product_ptr, RTM_LANG_CODE, RTM_PRODUCT_MANUFACTURER, RTM_PRODUCT_NAME, RTM_PRODUCT_PN, RTM_PRODUCT_VERSION, RTM_PRODUCT_SN, RTM_PRODUCT_ASSET_TAG, RTM_FRU_FILE_ID ); 21 | offset += product_sz; 22 | 23 | /* Multirecord Area */ 24 | multirec_off = offset; 25 | 26 | /* Zone3 Connector Compatibility */ 27 | z3_compat_off = offset; 28 | z3_compat_sz += zone3_compatibility_record_build( &z3_ptr, RTM_COMPATIBILITY_CODE ); 29 | offset += z3_compat_sz; 30 | 31 | /* Common Header */ 32 | fru_header_build( &hdr_ptr, int_use_off, chassis_off, board_off, product_off, multirec_off ); 33 | 34 | *buffer = pvPortMalloc(offset); 35 | 36 | memcpy( (*buffer)+0, hdr_ptr, 8); 37 | memcpy( (*buffer)+board_off, board_ptr, board_sz); 38 | memcpy( (*buffer)+product_off, product_ptr, product_sz); 39 | memcpy( (*buffer)+z3_compat_off, z3_ptr, z3_compat_sz); 40 | 41 | vPortFree(hdr_ptr); 42 | vPortFree(board_ptr); 43 | vPortFree(product_ptr); 44 | vPortFree(z3_ptr); 45 | 46 | return offset; 47 | } 48 | -------------------------------------------------------------------------------- /modules/mmc_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Augusto Fraga Giachero 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef MMC_ERROR_H_ 23 | #define MMC_ERROR_H_ 24 | 25 | #include 26 | 27 | /** 28 | * @file mmc_error.h 29 | * @author Augusto Fraga Giachero 30 | * 31 | * @brief Error handling functions and codes 32 | * 33 | * @ingroup error 34 | */ 35 | 36 | typedef enum { 37 | MMC_OK, 38 | MMC_OOM_ERR, 39 | MMC_IO_ERR, 40 | MMC_INVALID_ARG_ERR, 41 | MMC_TIMEOUT_ERR, 42 | MMC_RESOURCE_ERR, 43 | MMC_UNKNOWN_ERR, 44 | } mmc_err; 45 | 46 | /** 47 | * @brief Get the corresponding string for an error code 48 | * 49 | * @param[in] e Error code 50 | * 51 | * @return a pointer to a null-terminated string 52 | */ 53 | const char* get_error_str(mmc_err e); 54 | 55 | /** 56 | * @brief Print the file name, line number and error description 57 | * 58 | * @param[in] e Error code 59 | */ 60 | #define PRINT_ERR_LINE(e) printf("%s line %d: %s\n", __FILE__, __LINE__, get_error_str(e)) 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /modules/mmc_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Augusto Fraga Giachero 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file mmc_error.c 24 | * @author Augusto Fraga Giachero 25 | * 26 | * @brief Error handling functions 27 | * 28 | * @ingroup error 29 | */ 30 | #include 31 | #include "mmc_error.h" 32 | 33 | static const char* mmc_error_strings[] = { 34 | [MMC_OK] = "No error", 35 | [MMC_OOM_ERR] = "Out of memory", 36 | [MMC_IO_ERR] = "Input output error", 37 | [MMC_INVALID_ARG_ERR] = "Invalid arguments", 38 | [MMC_RESOURCE_ERR] = "Resource unavailable", 39 | [MMC_TIMEOUT_ERR] = "Timeout", 40 | [MMC_UNKNOWN_ERR] = "Unknown error", 41 | }; 42 | 43 | const char* get_error_str(mmc_err e) 44 | { 45 | const size_t eindex = (size_t) e; 46 | const char* err_str; 47 | 48 | if (eindex < (sizeof(mmc_error_strings) / sizeof(char*))) { 49 | err_str = mmc_error_strings[eindex]; 50 | } else { 51 | err_str = mmc_error_strings[MMC_UNKNOWN_ERR]; 52 | } 53 | 54 | return err_str; 55 | } 56 | -------------------------------------------------------------------------------- /modules/sys_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Augusto Fraga Giachero 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file sys_utils.c 24 | * @author Augusto Fraga Giachero 25 | * 26 | * @brief System utilities functions 27 | * 28 | * @ingroup sysutils 29 | */ 30 | 31 | /* FreeRTOS includes */ 32 | #include "FreeRTOS.h" 33 | #include "timers.h" 34 | 35 | /* Project includes */ 36 | #include "port.h" 37 | 38 | static void sys_reset_callback(TimerHandle_t timer) 39 | { 40 | xTimerDelete(timer, 0); 41 | mcu_reset(); 42 | } 43 | 44 | int sys_schedule_reset(int period_ms) 45 | { 46 | TimerHandle_t timer_sys_rst; 47 | int ret = 0; 48 | 49 | timer_sys_rst = xTimerCreate("System Reset", pdMS_TO_TICKS(period_ms), 50 | pdFALSE, (void*)0, sys_reset_callback); 51 | 52 | if (timer_sys_rst != NULL) { 53 | BaseType_t start_res = xTimerStart(timer_sys_rst, 0); 54 | if (start_res == pdFAIL) ret = -1; 55 | } else { 56 | ret = -1; 57 | } 58 | 59 | return ret; 60 | } 61 | -------------------------------------------------------------------------------- /port/board/afc-v3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Select which microcontroller and board are being used 2 | if (NOT TARGET_CONTROLLER) 3 | set(TARGET_CONTROLLER "LPC1764" CACHE STRING "Target MMC Controller") 4 | endif() 5 | 6 | if (NOT TARGET_BOARD_NAME) 7 | set(TARGET_BOARD_NAME "AFC v3.1" CACHE STRING "Board Name") 8 | endif() 9 | 10 | #List all modules used by this board 11 | set(TARGET_MODULES 12 | "FRU" 13 | "CLOCK_CONFIG" 14 | "PAYLOAD" 15 | "SDR" 16 | "SCANSTA1101" 17 | "ADN4604" 18 | "DAC_AD84XX" 19 | "HOTSWAP_SENSOR" 20 | "EEPROM_AT24MAC" 21 | "EEPROM_24XX02" 22 | "LM75" 23 | "MAX6642" 24 | "INA220_VOLTAGE" 25 | "INA220_CURRENT" 26 | "HPM" 27 | "RTM" 28 | "UART_DEBUG" 29 | "SYSUTILS" 30 | "FLASH_SPI" 31 | ) 32 | 33 | if (NOT DISABLE_WATCHDOG) 34 | list(APPEND TARGET_MODULES "WATCHDOG") 35 | endif() 36 | 37 | set(BOARD_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 38 | 39 | #Include the modules sources 40 | ##Sensors SDR list 41 | set( PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/sdr_list.c ) 42 | set( PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/i2c_mapping.c ) 43 | 44 | if (";${TARGET_MODULES};" MATCHES ";PAYLOAD;") 45 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/payload.c) 46 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_PAYLOAD") 47 | endif() 48 | 49 | if (";${TARGET_MODULES};" MATCHES ";RTM;") 50 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/rtm.c) 51 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_RTM") 52 | endif() 53 | 54 | #Extra definitions 55 | if (FRU_WRITE_EEPROM) 56 | message(STATUS "FRU EEPROM will be written if no valid data is found!") 57 | set(MODULES_FLAGS "${MODULES_FLAGS} -DFRU_WRITE_EEPROM") 58 | set(FRU_WRITE_EEPROM false CACHE BOOL "Set this flag to enable writing the board ID on the EEPROM" FORCE) 59 | endif() 60 | 61 | #Set the variables in the main scope 62 | set(TARGET_MODULES ${TARGET_MODULES} PARENT_SCOPE) 63 | set(MODULES_FLAGS ${MODULES_FLAGS} PARENT_SCOPE) 64 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 65 | set(PROJ_HDRS ${PROJ_HDRS} ${BOARD_PATH}) 66 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 67 | -------------------------------------------------------------------------------- /port/board/rtm-lamp/rtm_user.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef RTM_USER_H_ 23 | #define RTM_USER_H_ 24 | 25 | /* PCA9554 outputs */ 26 | #define RTM_GPIO_HOTSWAP_HANDLE 0 27 | #define RTM_GPIO_OVERTEMP_SHUTDOWN 4 28 | #define RTM_GPIO_LED_RED 5 29 | #define RTM_GPIO_LED_GREEN 6 30 | #define RTM_GPIO_LED_BLUE 7 31 | 32 | #define RTM_GPIO_VS1_EN 0 33 | #define RTM_GPIO_VS2_EN 1 34 | #define RTM_GPIO_7V_EN 2 35 | #define RTM_GPIO_5V_EN 3 36 | #define RTM_GPIO_NEG_7V_EN 4 37 | 38 | #include "mmc_error.h" 39 | 40 | /* Mandatory RTM module functions */ 41 | mmc_err rtm_enable_payload_power_post( void ); 42 | mmc_err rtm_disable_payload_power_pre( void ); 43 | uint8_t rtm_get_hotswap_handle_status( uint8_t *state ); 44 | void rtm_hardware_init( void ); 45 | void rtm_ctrl_led( uint8_t id, uint8_t state ); 46 | uint8_t rtm_read_led( uint8_t id ); 47 | bool rtm_compatibility_check( void ); 48 | 49 | /* User defined functions */ 50 | void rtm_enable_i2c( void ); 51 | void rtm_disable_i2c( void ); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /FreeRTOS/portable/CCS/MSP430X/data_model.h: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | 28 | .if $DEFINED( __LARGE_DATA_MODEL__ ) 29 | .define "pushm.a", pushm_x 30 | .define "popm.a", popm_x 31 | .define "push.a", push_x 32 | .define "pop.a", pop_x 33 | .define "mov.a", mov_x 34 | .else 35 | .define "pushm.w", pushm_x 36 | .define "popm.w", popm_x 37 | .define "push.w", push_x 38 | .define "pop.w", pop_x 39 | .define "mov.w", mov_x 40 | .endif 41 | 42 | .if $DEFINED( __LARGE_CODE_MODEL__ ) 43 | .define "calla", call_x 44 | .define "reta", ret_x 45 | .else 46 | .define "call", call_x 47 | .define "ret", ret_x 48 | .endif 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /scripts/make-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | openmmc_root=$(realpath ..) 4 | afc_v3_1_build_dir="${openmmc_root}/build/releases/afcv3.1" 5 | afc_v4_build_dir="${openmmc_root}/build/releases/afcv4.0" 6 | bin_dir="${openmmc_root}/build/releases/binaries" 7 | tag=$(git describe --tags) 8 | 9 | set -e 10 | 11 | rm -rf "${openmmc_root}/build/releases/" 12 | mkdir -p "$bin_dir" 13 | mkdir -p "$afc_v3_1_build_dir" 14 | mkdir -p "$afc_v4_build_dir" 15 | 16 | cd "$afc_v3_1_build_dir" 17 | cmake "$openmmc_root" -DBOARD=afc -DVERSION=3.1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDISABLE_WATCHDOG=OFF -DBOARD_RTM=8sfp 18 | make 19 | 20 | cd "$afc_v4_build_dir" 21 | cmake "$openmmc_root" -DBOARD=afc -DVERSION=4.0 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDISABLE_WATCHDOG=OFF -DBOARD_RTM=lamp 22 | make 23 | 24 | cp "${afc_v3_1_build_dir}/out/openMMC.elf" "${bin_dir}/openMMC-afcv3.1-8sfp-${tag}.elf" 25 | cp "${afc_v3_1_build_dir}/out/openMMC.bin" "${bin_dir}/openMMC-afcv3.1-8sfp-${tag}.bin" 26 | [ -e "${afc_v3_1_build_dir}/out/openMMC.hpm" ] && cp "${afc_v3_1_build_dir}/out/openMMC.hpm" "${bin_dir}/openMMC-afcv3.1-8sfp-${tag}.hpm" 27 | 28 | cp "${afc_v3_1_build_dir}/out/newboot.elf" "${bin_dir}/newboot-afcv3.1-${tag}.elf" 29 | cp "${afc_v3_1_build_dir}/out/newboot.bin" "${bin_dir}/newboot-afcv3.1-${tag}.bin" 30 | [ -e "${afc_v3_1_build_dir}/out/newboot.hpm" ] && cp "${afc_v3_1_build_dir}/out/newboot.hpm" "${bin_dir}/newboot-afcv3.1-${tag}.hpm" 31 | 32 | cp "${afc_v4_build_dir}/out/openMMC.elf" "${bin_dir}/openMMC-afcv4.0-lamp-${tag}.elf" 33 | cp "${afc_v4_build_dir}/out/openMMC.bin" "${bin_dir}/openMMC-afcv4.0-lamp-${tag}.bin" 34 | [ -e "${afc_v4_build_dir}/out/openMMC.hpm" ] && cp "${afc_v4_build_dir}/out/openMMC.hpm" "${bin_dir}/openMMC-afcv4.0-lamp-${tag}.hpm" 35 | 36 | cp "${afc_v4_build_dir}/out/newboot.elf" "${bin_dir}/newboot-afcv4.0-${tag}.elf" 37 | cp "${afc_v4_build_dir}/out/newboot.bin" "${bin_dir}/newboot-afcv4.0-${tag}.bin" 38 | [ -e "${afc_v4_build_dir}/out/newboot.hpm" ] && cp "${afc_v4_build_dir}/out/newboot.hpm" "${bin_dir}/newboot-afcv4.0-${tag}.hpm" 39 | 40 | cd "${bin_dir}" 41 | sha256sum * > SHA256SUMS 42 | -------------------------------------------------------------------------------- /modules/ad84xx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /* Project Includes */ 23 | #include "port.h" 24 | #include "ad84xx.h" 25 | 26 | #define DAC_AD84XX_SPI_BITRATE 10000000 27 | #define DAC_AD84XX_FRAME_SIZE 10 28 | 29 | void dac_ad84xx_init( void ) 30 | { 31 | /* Reset the AD84xx while initializing the SSP interface */ 32 | gpio_set_pin_state( PIN_PORT(GPIO_DAC_VADJ_RST), PIN_NUMBER(GPIO_DAC_VADJ_RST), GPIO_LEVEL_LOW); 33 | 34 | spi_config( DAC_AD84XX_SPI_BITRATE, DAC_AD84XX_FRAME_SIZE, SPI_MASTER, SPI_POLLING ); 35 | 36 | gpio_set_pin_state( PIN_PORT(GPIO_DAC_VADJ_RST), PIN_NUMBER(GPIO_DAC_VADJ_RST), GPIO_LEVEL_HIGH); 37 | } 38 | 39 | void dac_ad84xx_set_val( uint8_t addr, uint8_t val ) 40 | { 41 | uint16_t data = (addr << 8) | (val); 42 | spi_assertSSEL(); 43 | spi_write( (uint8_t *) &data, sizeof(data) ); 44 | spi_deassertSSEL(); 45 | } 46 | 47 | void dac_ad84xx_set_res( uint8_t addr, uint16_t res ) 48 | { 49 | uint16_t data = 0; 50 | 51 | if (res > 50) { 52 | data = ((res - 50)*256)/1000; 53 | } 54 | 55 | /* DAC value is limited to 256 steps */ 56 | data &= 0xFF; 57 | 58 | dac_ad84xx_set_val( addr, data ); 59 | } 60 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_hpm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AFCIPMI -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_hpm.h 22 | * @author Henrique Silva , LNLS 23 | * @date March 2016 24 | * 25 | * @brief Firmware update functions (HPM.1) 26 | */ 27 | 28 | #ifdef LPC17_HPM_H_ 29 | #undef LPC17_HPM_H_ 30 | #endif 31 | #define LPC17_HPM_H_ 32 | 33 | #define IPMC_UPDATE_SECTOR_START 0x10 34 | #define IPMC_UPDATE_SECTOR_END 0x11 35 | #define IPMC_UPDATE_ADDRESS_OFFSET (IPMC_UPDATE_SECTOR_START << 12) 36 | 37 | enum fw_type { 38 | APPLICATION = 1, 39 | BOOTLOADER = 2 40 | }; 41 | 42 | uint8_t ipmc_hpm_prepare_comp(void); 43 | uint8_t ipmc_hpm_upload_block(uint8_t *block, uint16_t size); 44 | uint8_t ipmc_hpm_finish_upload(uint32_t image_size); 45 | uint8_t ipmc_hpm_activate_firmware(void); 46 | uint8_t ipmc_hpm_get_upgrade_status(void); 47 | uint8_t program_page(uint32_t address, uint32_t *data, uint32_t size); 48 | uint8_t ipmc_erase_sector(uint32_t sector_start, uint32_t sector_end); 49 | 50 | 51 | uint8_t bootloader_hpm_prepare_comp(void); 52 | uint8_t bootloader_hpm_upload_block(uint8_t *block, uint16_t size); 53 | uint8_t bootloader_hpm_finish_upload(uint32_t image_size); 54 | uint8_t bootloader_hpm_activate_firmware(void); 55 | uint8_t bootloader_hpm_get_upgrade_status(void); 56 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_pincfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * @file lpc17_pincfg.h 22 | * @brief Pin Config functions redirection for LPC17xx 23 | * 24 | * @author Henrique Silva , LNLS 25 | */ 26 | 27 | #ifndef LPC17_PINCFG_H_ 28 | #define LPC17_PINCFG_H_ 29 | 30 | #include "port.h" 31 | 32 | /** 33 | * @brief Sets I/O Control pin mux 34 | * @param port : GPIO port to mux 35 | * @param pin : GPIO pin to mux 36 | * @param cfg : Configuration bits to select pin mode/function 37 | * @see IOCON_17XX_40XX_MODE_FUNC 38 | */ 39 | 40 | /* 32 bit value in the format -> [port][pin][func][dir] each field [] is one byte */ 41 | #define PIN_DEF( port, pin, func, dir ) ( (port << 24) | (pin << 16) | (func << 8) | dir ) 42 | 43 | #define PIN_PORT( pin_def ) ((pin_def & 0xFF000000) >> 24) 44 | #define PIN_NUMBER( pin_def ) ((pin_def & 0x00FF0000) >> 16) 45 | #define PIN_FUNC( pin_def ) ((pin_def & 0x0000FF00) >> 8) 46 | #define PIN_DIR( pin_def ) ((pin_def & 0x000000FF) >> 0) 47 | 48 | /* For other mcus like Atmel's it should be PORTA, PORTB, etc */ 49 | #define PORT0 0 50 | #define PORT1 1 51 | #define PORT2 2 52 | #define PORT3 3 53 | #define PORT4 4 54 | 55 | #define NON_GPIO 0xFF 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/lpc17_clock.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/lpc17_clock.h 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | 26 | enum lpc17_pll0_src 27 | { 28 | pll0_irc_src, 29 | pll0_osc_src, 30 | pll0_rtc_src, 31 | }; 32 | 33 | enum lpc17_pclk 34 | { 35 | /* PCLKSEL0 */ 36 | pclk_wdt, 37 | pclk_timer0, 38 | pclk_timer1, 39 | pclk_uart0, 40 | pclk_uart1, 41 | pclk_pwm1, 42 | pclk_i2c0, 43 | pclk_spi, 44 | pclk_ssp1, 45 | pclk_dac, 46 | pclk_adc, 47 | pclk_can1, 48 | pclk_can2, 49 | pclk_acf, 50 | /* PCLKSEL1 */ 51 | pclk_qei, 52 | pclk_gpioint, 53 | pclk_pcb, 54 | pclk_i2c1, 55 | pclk_ssp0, 56 | pclk_timer2, 57 | pclk_timer3, 58 | pclk_uart2, 59 | pclk_uart3, 60 | pclk_i2c2, 61 | pclk_i2s, 62 | pclk_rit, 63 | pclk_syscon, 64 | pclk_mc, 65 | }; 66 | 67 | enum lpc17_pclk_div 68 | { 69 | pclk_div1, 70 | pclk_div2, 71 | pclk_div4, 72 | pclk_can_div6, 73 | pclk_div8, 74 | }; 75 | 76 | int lpc17_set_pll0(uint16_t pll_div, uint16_t pll_mul, uint16_t cpu_div, enum lpc17_pll0_src src); 77 | void lpc17_set_pclk(enum lpc17_pclk pclk, enum lpc17_pclk_div div); 78 | -------------------------------------------------------------------------------- /modules/idt_8v54816.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Krzysztof Macias 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef IDT_8V54816_H_ 23 | #define IDT_8V54816_H_ 24 | 25 | #include "port.h" 26 | 27 | #define IDT_MASK_SRC 0xF 28 | #define IDT_MASK_POL 1<<5 29 | #define IDT_MASK_TERM 1<<6 30 | #define IDT_MASK_DIR 1<<7 31 | 32 | #define IDT_POL_N 0 33 | #define IDT_POL_P 1<<5 34 | 35 | #define IDT_TERM_OFF 0 36 | #define IDT_TERM_ON 1<<6 37 | 38 | #define IDT_DIR_IN 0 39 | #define IDT_DIR_OUT 1<<7 40 | 41 | 42 | enum IDT_CLK_SRC{ 43 | IDT_SRC_CH0, 44 | IDT_SRC_CH1, 45 | IDT_SRC_CH2, 46 | IDT_SRC_CH3, 47 | IDT_SRC_CH4, 48 | IDT_SRC_CH5, 49 | IDT_SRC_CH6, 50 | IDT_SRC_CH7, 51 | IDT_SRC_CH8, 52 | IDT_SRC_CH9, 53 | IDT_SRC_CH10, 54 | IDT_SRC_CH11, 55 | IDT_SRC_CH12, 56 | IDT_SRC_CH13, 57 | IDT_SRC_CH14, 58 | IDT_SRC_CH15 59 | }; 60 | 61 | uint8_t clock_switch_read_reg(uint8_t *rx_data); 62 | uint8_t clock_switch_write_reg(uint8_t *tx_data); 63 | uint8_t clock_switch_set_single_channel(uint8_t channel, uint8_t value); 64 | uint8_t clock_switch_read_single_channel(uint8_t channel, uint8_t *data); 65 | uint8_t clock_switch_default_config(); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /modules/fru.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Julian Mendez 5 | * Copyright (C) 2015-2016 Henrique Silva 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * @license GPL-3.0+ 21 | */ 22 | 23 | #ifndef FRU_H_ 24 | #define FRU_H_ 25 | 26 | #include 27 | #include 28 | 29 | enum { 30 | FRU_AMC, 31 | #ifdef MODULE_RTM 32 | FRU_RTM, 33 | #endif 34 | FRU_COUNT 35 | }; 36 | 37 | typedef size_t (* fru_build_t)(uint8_t **buffer); 38 | typedef size_t (* fru_st_read_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout); 39 | typedef size_t (* fru_st_write_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout); 40 | 41 | typedef struct fru_cfg { 42 | uint8_t eeprom_id; 43 | fru_build_t build_f; 44 | fru_st_read_t read_f; 45 | fru_st_write_t write_f; 46 | } fru_cfg_t; 47 | 48 | typedef struct fru_data { 49 | const fru_cfg_t cfg; 50 | uint8_t *buffer; 51 | size_t fru_size; 52 | bool runtime; 53 | } fru_data_t; 54 | 55 | void fru_init( uint8_t id ); 56 | size_t fru_read( uint8_t id, uint8_t *rx_buff, uint16_t offset, size_t len ); 57 | size_t fru_write( uint8_t id, uint8_t *tx_buff, uint16_t offset, size_t len ); 58 | uint8_t fru_check_integrity( uint8_t id, size_t *fru_size ); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/AtmelSAM9XE/ISR_Support.h: -------------------------------------------------------------------------------- 1 | EXTERN pxCurrentTCB 2 | EXTERN ulCriticalNesting 3 | 4 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 5 | ; Context save and restore macro definitions 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 7 | 8 | portSAVE_CONTEXT MACRO 9 | 10 | ; Push R0 as we are going to use the register. 11 | STMDB SP!, {R0} 12 | 13 | ; Set R0 to point to the task stack pointer. 14 | STMDB SP, {SP}^ 15 | NOP 16 | SUB SP, SP, #4 17 | LDMIA SP!, {R0} 18 | 19 | ; Push the return address onto the stack. 20 | STMDB R0!, {LR} 21 | 22 | ; Now we have saved LR we can use it instead of R0. 23 | MOV LR, R0 24 | 25 | ; Pop R0 so we can save it onto the system mode stack. 26 | LDMIA SP!, {R0} 27 | 28 | ; Push all the system mode registers onto the task stack. 29 | STMDB LR, {R0-LR}^ 30 | NOP 31 | SUB LR, LR, #60 32 | 33 | ; Push the SPSR onto the task stack. 34 | MRS R0, SPSR 35 | STMDB LR!, {R0} 36 | 37 | LDR R0, =ulCriticalNesting 38 | LDR R0, [R0] 39 | STMDB LR!, {R0} 40 | 41 | ; Store the new top of stack for the task. 42 | LDR R1, =pxCurrentTCB 43 | LDR R0, [R1] 44 | STR LR, [R0] 45 | 46 | ENDM 47 | 48 | 49 | portRESTORE_CONTEXT MACRO 50 | 51 | ; Set the LR to the task stack. 52 | LDR R1, =pxCurrentTCB 53 | LDR R0, [R1] 54 | LDR LR, [R0] 55 | 56 | ; The critical nesting depth is the first item on the stack. 57 | ; Load it into the ulCriticalNesting variable. 58 | LDR R0, =ulCriticalNesting 59 | LDMFD LR!, {R1} 60 | STR R1, [R0] 61 | 62 | ; Get the SPSR from the stack. 63 | LDMFD LR!, {R0} 64 | MSR SPSR_cxsf, R0 65 | 66 | ; Restore all system mode registers for the task. 67 | LDMFD LR, {R0-R14}^ 68 | NOP 69 | 70 | ; Restore the return address. 71 | LDR LR, [LR, #+60] 72 | 73 | ; And return - correcting the offset in the LR to obtain the 74 | ; correct address. 75 | SUBS PC, LR, #4 76 | 77 | ENDM 78 | 79 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/src/lpc17_iap.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * bootloader/src/lpc17_iap.h 3 | * 4 | * Copyright (C) 2020 Augusto Fraga Giachero. All rights reserved. 5 | * Author: Augusto Fraga Giachero 6 | * 7 | * This file is part of the RFFE firmware. 8 | * 9 | * RFFE is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * RFFE is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with RFFE. If not, see . 21 | * 22 | ****************************************************************************/ 23 | 24 | #include 25 | #include 26 | 27 | enum iap_err 28 | { 29 | iap_cmd_success = 0, 30 | iap_invalid_command, 31 | iap_src_addr_error, 32 | iap_dst_addr_error, 33 | iap_src_addr_not_mapped, 34 | iap_dst_addr_not_mapped, 35 | iap_count_error, 36 | iap_invalid_sector, 37 | iap_sector_not_blank, 38 | iap_sector_not_prepared_for_write, 39 | iap_compare_error, 40 | iap_busy, 41 | iap_param_error, 42 | iap_addr_error, 43 | iap_addr_not_mapped, 44 | iap_cmd_locked, 45 | iap_invalid_code, 46 | iap_invalid_baud_rate, 47 | iap_invalid_stop_bit, 48 | iap_code_read_protection_enabled, 49 | }; 50 | 51 | enum iap_err lpc17_iap_prepare_sectors(uint8_t start_sector, uint8_t end_sector); 52 | enum iap_err lpc17_iap_copy_ram_flash(const uint32_t* src_ram, const uint32_t* dest_flash, size_t len, uint32_t cpu_clk_khz); 53 | enum iap_err lpc17_iap_erase_sectors(uint8_t start_sector, uint8_t end_sector, uint32_t cpu_clk_khz); 54 | enum iap_err lpc17_iap_blank_check(uint8_t start_sector, uint8_t end_sector); 55 | -------------------------------------------------------------------------------- /modules/rtm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file rtm.h 24 | * @author Henrique Silva 25 | * 26 | * @brief Generic RTM Module management functions 27 | * 28 | * @ingroup RTM_Manage 29 | */ 30 | 31 | #ifndef RTM_H_ 32 | #define RTM_H_ 33 | 34 | #include "rtm_user.h" 35 | 36 | extern volatile bool rtm_present; 37 | 38 | /** 39 | * @brief Initialize RTM Manage task 40 | * 41 | * This task creates the RTM_Manage task and initialize some GPIO pins used to detect the RTM Board presence 42 | * 43 | * @return None 44 | */ 45 | void rtm_manage_init( void ); 46 | 47 | /** 48 | * @brief Check RTM Presence 49 | * 50 | * This task use some GPIO pins to detect the RTM Board presence 51 | * 52 | * @return None 53 | */ 54 | void rtm_check_presence(uint8_t *status); 55 | 56 | /** 57 | * @brief Enable payload power 58 | * 59 | * This function turn on the 12V payload power rail and initialise the RTM powered by it. 60 | * 61 | */ 62 | mmc_err rtm_enable_payload_power( void ); 63 | 64 | /** 65 | * @brief Disable payload power 66 | * 67 | * This function turn off the 12V payload power rail and de-initialise the RTM powered by it. 68 | * 69 | */ 70 | mmc_err rtm_disable_payload_power( void ); 71 | 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /port/board/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ##Include selected board files 2 | message(STATUS "Selected Board: ${BOARD}") 3 | if(NOT BOARD) 4 | message(FATAL_ERROR "${BoldRed}Target board was not selected! You must pass the flag -DBOARD=${ColourReset}") 5 | endif() 6 | 7 | if(${BOARD} MATCHES "^(afc)$") 8 | 9 | if(NOT VERSION) 10 | message(FATAL_ERROR "${BoldRed}AFC board version was not selected! You must pass the flag -DVERSION=.${ColourReset}") 11 | endif() 12 | 13 | message(STATUS "Selected Board version: ${VERSION}") 14 | if(${VERSION} MATCHES "(3.0)") 15 | message(FATAL_ERROR "${BoldRed}AFCv3.0 is not supported anymore. Use -DVERSION=3.1 instead.${ColourReset}") 16 | elseif(${VERSION} MATCHES "(3.1)") 17 | add_subdirectory(afc-v3) 18 | elseif(${VERSION} MATCHES "(4.0)") 19 | add_subdirectory(afc-v4) 20 | endif() 21 | 22 | elseif(${BOARD} MATCHES "^(afc-v4)$" ) 23 | add_subdirectory(afc-v4) 24 | 25 | else() 26 | message(FATAL_ERROR "${BoldRed}Selected board \"${BOARD}\" is not implemented!${ColourReset}") 27 | endif() 28 | 29 | if(${BOARD} MATCHES "^(afc)") 30 | add_subdirectory(afc-common) 31 | endif() 32 | 33 | #RTM Board 34 | if(BOARD_RTM AND (";${TARGET_MODULES};" MATCHES ";RTM;")) 35 | message(STATUS "Selected RTM Board support: ${BOARD_RTM}") 36 | if(${BOARD_RTM} MATCHES "(8sfp)") 37 | add_subdirectory(rtm-8sfp) 38 | elseif(${BOARD_RTM} MATCHES "(lamp)") 39 | add_subdirectory(rtm-lamp) 40 | else() 41 | message(FATAL_ERROR "${BoldRed}Selected RTM board \"${BOARD_RTM}\" is not implemented!${ColourReset}") 42 | endif() 43 | endif() 44 | 45 | #Normalize strings to upper case 46 | string(TOUPPER "${TARGET_CONTROLLER}" TARGET_CONTROLLER_UPPER) 47 | set(TARGET_CONTROLLER "${TARGET_CONTROLLER_UPPER}" CACHE STRING "Target Controller") 48 | string(TOUPPER "${TARGET_BOARD_NAME}" TARGET_BOARD_UPPER) 49 | set(TARGET_BOARD_NAME "${TARGET_BOARD_UPPER}" CACHE STRING "Target Board Name") 50 | 51 | #Set the modified variables in the main scope 52 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 53 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 54 | set(TARGET_MODULES ${TARGET_MODULES} PARENT_SCOPE) 55 | set(MODULES_FLAGS ${MODULES_FLAGS} PARENT_SCOPE) 56 | -------------------------------------------------------------------------------- /modules/task_priorities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef TASK_PRIORITIES_H_ 23 | #define TASK_PRIORITIES_H_ 24 | 25 | #ifndef tskIDLE_PRIORITY 26 | #define tskIDLE_PRIORITY (0) 27 | #endif 28 | 29 | #define tskLED_PRIORITY (tskIDLE_PRIORITY+1) 30 | #define tskFPGA_COMM_PRIORITY (tskIDLE_PRIORITY+1) 31 | #define tskWATCHDOG_PRIORITY (tskIDLE_PRIORITY+1) 32 | 33 | #define tskPAYLOAD_PRIORITY (tskIDLE_PRIORITY+2) 34 | #define tskRTM_MANAGE_PRIORITY (tskIDLE_PRIORITY+2) 35 | 36 | #define tskSENSOR_PRIORITY (tskIDLE_PRIORITY+3) 37 | #define tskHOTSWAP_PRIORITY (tskIDLE_PRIORITY+3) 38 | #define tskLM75SENSOR_PRIORITY (tskIDLE_PRIORITY+3) 39 | #define tskMAX6642SENSOR_PRIORITY (tskIDLE_PRIORITY+3) 40 | #define tskINA220SENSOR_PRIORITY (tskIDLE_PRIORITY+3) 41 | #define tskINA3221SENSOR_PRIORITY (tskIDLE_PRIORITY+3) 42 | #define tskMAX11609SENSOR_PRIORITY (tskIDLE_PRIORITY+3) 43 | 44 | #define tskIPMI_HANDLERS_PRIORITY (tskIDLE_PRIORITY+4) 45 | #define tskIPMI_PRIORITY (tskIDLE_PRIORITY+4) 46 | 47 | #define tskIPMB_RX_PRIORITY (tskIDLE_PRIORITY+5) 48 | #define tskIPMB_TX_PRIORITY (tskIDLE_PRIORITY+5) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /modules/watchdog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file watchdog.h 24 | * @author Henrique Silva 25 | * 26 | * @brief Watchdog module definitions 27 | * 28 | */ 29 | 30 | #ifndef WATCHDOG_H_ 31 | #define WATCHDOG_H_ 32 | 33 | /** 34 | * @brief Watchdog module clock frequency (in Hz) 35 | */ 36 | #define WATCHDOG_CLK_FREQ 8000000 37 | 38 | /** 39 | * @brief Watchdog timer timeout (in ms) 40 | */ 41 | #define WATCHDOG_TIMEOUT 1000 /* in milisseconds */ 42 | 43 | /** 44 | * @brief Watchdog timer feed delay 45 | * 46 | * We reload the watchdog timer at 2/3 of the max count 47 | */ 48 | #define WATCHDOG_FEED_DELAY (WATCHDOG_TIMEOUT/3)*2 49 | 50 | 51 | /** 52 | * @brief Initializes and configures Watchdog timer 53 | * 54 | * @return None 55 | */ 56 | void watchdog_init( void ); 57 | 58 | /** 59 | * @brief Schedules a Reset on the next run of the Watchdog task 60 | * 61 | * @return None 62 | */ 63 | void watchdog_reset_mcu( void ); 64 | 65 | /** 66 | * @brief Periodically feed the Watchdog timer and checks if there's any Reset requests 67 | * 68 | * @param Parameters Pointer to a buffer of parameters passed to the task upon initialization 69 | * 70 | * @return None 71 | */ 72 | void WatchdogTask( void * Parameters ); 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * @file lpc17_uart.h 22 | * @author Henrique Silva , LNLS 23 | * 24 | * @brief LPC17xx UART interface definitions 25 | */ 26 | 27 | #ifndef LPC17_UART_H_ 28 | #define LPC17_UART_H_ 29 | 30 | #include "string.h" 31 | #include "stdio.h" 32 | 33 | typedef struct lpc_uart_cfg { 34 | LPC_USART_T * ptr; 35 | IRQn_Type irq; 36 | CHIP_SYSCTL_PCLK_T sysclk; 37 | } lpc_uart_cfg_t; 38 | 39 | extern const lpc_uart_cfg_t usart_cfg[4]; 40 | 41 | #define uart_set_baud( id, baud ) Chip_UART_SetBaud( usart_cfg[id].ptr, baud ) 42 | #define uart_config_data( id, cfg ) Chip_UART_ConfigData( usart_cfg[id].ptr, cfg ) 43 | #define uart_tx_enable( id ) Chip_UART_TXEnable( usart_cfg[id].ptr ) 44 | #define uart_tx_disable( id ) Chip_UART_TXDisable( usart_cfg[id].ptr ) 45 | #define uart_int_enable( id, mask ) Chip_UART_IntEnable( usart_cfg[id].ptr, mask ) 46 | #define uart_int_disable( id, mask ) Chip_UART_IntDisable( usart_cfg[id].ptr, mask ) 47 | #define uart_send_char( id, ch ) Chip_UART_SendByte( usart_cfg[id].ptr, ch ) 48 | #define uart_read_char( id ) Chip_UART_ReadByte( usart_cfg[id].ptr ) 49 | #define uart_send( id, msg, len ) Chip_UART_SendBlocking( usart_cfg[id].ptr, msg, len ) 50 | #define uart_read( id, buf, len ) Chip_UART_ReadBlocking( usart_cfg[id].ptr, buf, len ) 51 | 52 | void uart_init ( uint8_t id ); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /modules/eeprom_24xx02.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2023 Gustavo Reis 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @defgroup 24xx02 24xx02 2kbit Serial EEPROM 24 | * @ingroup PERIPH_IC 25 | */ 26 | 27 | /** 28 | * @file eeprom_24xx02.h 29 | * @author Gustavo Reis 30 | * 31 | * @brief 24xx02 EEPROM module interface declarations 32 | * 33 | * @ingroup 24xx02 34 | */ 35 | 36 | #ifndef EEPROM_24XX02_H_ 37 | #define EEPROM_24XX02_H_ 38 | 39 | /** 40 | * @brief Read serial data from EEPROM_24XX02 EEPROM 41 | * 42 | * @param id EEPROM chip id 43 | * @param address Starting read address 44 | * @param rx_data Buffer to store the data 45 | * @param buf_len Buffer max length 46 | * @param timeout Read timeout 47 | * 48 | * @return Number of bytes actually received 49 | */ 50 | size_t eeprom_24xx02_read( uint8_t id, uint16_t address, uint8_t *rx_data, size_t buf_len, uint32_t timeout ); 51 | 52 | /** 53 | * @brief Write serial data to EEPROM 54 | * 55 | * @param id EEPROM chip id 56 | * @param address Write start address 57 | * @param tx_data Buffer holding the data to write 58 | * @param buf_len Buffer max len 59 | * @param timeout Write timout 60 | * 61 | * @return Number of bytes actually written 62 | */ 63 | size_t eeprom_24xx02_write( uint8_t id, uint16_t address, uint8_t *tx_data, size_t buf_len, uint32_t timeout ); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /FreeRTOS/portable/GCC/PPC405_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* When switching out a task, if the task tag contains a buffer address then 29 | save the flop context into the buffer. */ 30 | #define traceTASK_SWITCHED_OUT() \ 31 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 32 | { \ 33 | extern void vPortSaveFPURegisters( void * ); \ 34 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 35 | } 36 | 37 | /* When switching in a task, if the task tag contains a buffer address then 38 | load the flop context from the buffer. */ 39 | #define traceTASK_SWITCHED_IN() \ 40 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 41 | { \ 42 | extern void vPortRestoreFPURegisters( void * ); \ 43 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 44 | } 45 | 46 | -------------------------------------------------------------------------------- /FreeRTOS/portable/GCC/PPC440_Xilinx/FPU_Macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* When switching out a task, if the task tag contains a buffer address then 29 | save the flop context into the buffer. */ 30 | #define traceTASK_SWITCHED_OUT() \ 31 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 32 | { \ 33 | extern void vPortSaveFPURegisters( void * ); \ 34 | vPortSaveFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 35 | } 36 | 37 | /* When switching in a task, if the task tag contains a buffer address then 38 | load the flop context from the buffer. */ 39 | #define traceTASK_SWITCHED_IN() \ 40 | if( pxCurrentTCB->pxTaskTag != NULL ) \ 41 | { \ 42 | extern void vPortRestoreFPURegisters( void * ); \ 43 | vPortRestoreFPURegisters( ( void * ) ( pxCurrentTCB->pxTaskTag ) ); \ 44 | } 45 | 46 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_watchdog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AFCIPMI -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_watchdog.h 22 | * @author Henrique Silva , LNLS 23 | * @date December 2015 24 | * 25 | * @brief Definitions of Watchdog driver implementation for LPC17xx 26 | */ 27 | 28 | #ifdef LPC17_WATCHDOG_H_ 29 | #undef LPC17_WATCHDOG_H_ 30 | #endif 31 | #define LPC17_WATCHDOG_H_ 32 | 33 | #include "wwdt_17xx_40xx.h" 34 | 35 | /** 36 | * @brief Initialize the Watchdog timer 37 | * @return None 38 | */ 39 | #define wdt_init() Chip_WWDT_Init(LPC_WWDT) 40 | 41 | /** 42 | * @brief Start the Watchdog timer 43 | * @return None 44 | */ 45 | #define wdt_start() Chip_WWDT_Start(LPC_WWDT) 46 | 47 | /** 48 | * @brief Config the Watchdog timer to reset upon count end 49 | * @return None 50 | */ 51 | #define wdt_config() Chip_WWDT_SetOption(LPC_WWDT, WWDT_WDMOD_WDRESET) 52 | 53 | /** 54 | * @brief Set Watchdog Timer max count 55 | * 56 | * Select the max count for the timer, when this count reaches 0, the chip is reseted 57 | * 58 | * @param [in] timeout Max count for Watchdog timer 59 | * @return None 60 | */ 61 | #define wdt_set_timeout( timeout ) Chip_WWDT_SetTimeOut(LPC_WWDT, timeout) 62 | 63 | /** 64 | * @brief Reload the watchdog counter 65 | * @return None 66 | */ 67 | #define wdt_feed() Chip_WWDT_Feed(LPC_WWDT) 68 | -------------------------------------------------------------------------------- /modules/eeprom_24xx64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @defgroup 24xx64 24xx64 64kbit Serial EEPROM 24 | * @ingroup PERIPH_IC 25 | */ 26 | 27 | /** 28 | * @file eeprom_24xx64.h 29 | * @author Henrique Silva 30 | * 31 | * @brief 24xx64 EEPROM module interface declarations 32 | * 33 | * @ingroup 24xx64 34 | */ 35 | 36 | #ifndef EEPROM_24XX64_H_ 37 | #define EEPROM_24XX64_H_ 38 | 39 | /** 40 | * @brief Read serial data from EEPROM_24XX64 EEPROM 41 | * 42 | * @param id EEPROM chip id 43 | * @param address Starting read address 44 | * @param rx_data Buffer to store the data 45 | * @param buf_len Buffer max length 46 | * @param timeout Read timeout 47 | * 48 | * @return Number of bytes actually received 49 | */ 50 | size_t eeprom_24xx64_read( uint8_t id, uint16_t address, uint8_t *rx_data, size_t buf_len, uint32_t timeout ); 51 | 52 | /** 53 | * @brief Write serial data to EEPROM 54 | * 55 | * @param id EEPROM chip id 56 | * @param address Write start address 57 | * @param tx_data Buffer holding the data to write 58 | * @param buf_len Buffer max len 59 | * @param timeout Write timout 60 | * 61 | * @return Number of bytes actually written 62 | */ 63 | size_t eeprom_24xx64_write( uint8_t id, uint16_t address, uint8_t *tx_data, size_t buf_len, uint32_t timeout ); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/README.md: -------------------------------------------------------------------------------- 1 | # LPC17xx bootloader (newboot) 2 | 3 | This bootloader is responsible for copying the new firmware image from the firmware update area to the application or bootloader (self-update) area. It shouldn't be confused with the LPC17xx ROM bootloader (firmware programming via serial port). 4 | 5 | ## Flash layout 6 | 7 | The flash memory is divided in three regions defined in the linker script for each target. 8 | 9 | LPC1764: 10 | * Bootloader 0x00000000 - 0x00001FFF (8 KiB); 11 | * Application 0x00002000 - 0x000FFFF (56 KiB); 12 | * Firmware update 0x00010000 - 0x0001DFFF (56 KiB); 13 | * New firmware record address: 0x0001DF00. 14 | 15 | LPC1768: 16 | * Bootloader 0x00000000 - 0x00001FFF (8 KiB); 17 | * Application 0x00002000 - 0x0003FFFF (248 KiB); 18 | * Firmware update 0x00040000 - 0x0007DFFF (248 KiB); 19 | * New firmware record address: 0x0007FF00. 20 | 21 | ``` 22 | New firmware record: 23 | 24 | +-----------------+-----------------+-----------------+---------------+------------+ 25 | | Major version | Minor version | Build version | Firmware type | Magic word | 26 | | number (1 byte) | number (1 byte) | number (1 byte) | (1 byte) | (4 bytes) | 27 | +-----------------+-----------------+-----------------+---------------+------------+ 28 | 29 | ``` 30 | 31 | The bootloader checks if the magic word is equal to 0xAAAAAAAA (firmware update magic word), if it is, the new firmware will be copied from the firmware update region to the application or bootloader region depending on the firmware type (application or bootloader). After finishing the copying, the bootloader will erase the firmware update region. 32 | 33 | The Firmware type byte indicates what to update, (0x01: application, 0x02: bootloader). All flash writing logic is executed from SRAM to allow self updating. 34 | 35 | ## Migrating from the older openMMC versions 36 | 37 | newboot is not compatible with openMMC prior version 1.5.0, and the older bootloader doesn't support self update nor openMMC >= 1.5.0, so remote updates via HPM would require a special version of openMMC that updates the bootloader from the application side. This is not done yet, so the only way to safely update the bootloader and openMMC now is via the JTAG/SWD interface. 38 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_uartrb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * @file lpc17_uartrb.h 22 | * @author Henrique Silva , LNLS 23 | * 24 | * @brief LPC17xx UART interface with Ring Buffer definitions 25 | */ 26 | 27 | #ifndef LPC17_UART_H_ 28 | #define LPC17_UART_H_ 29 | 30 | #include "semphr.h" 31 | #include "string.h" 32 | #include "stdio.h" 33 | 34 | typedef struct lpc_uart_cfg { 35 | LPC_USART_T * ptr; 36 | IRQn_Type irq; 37 | } lpc_uart_cfg_t; 38 | 39 | volatile lpc_uart_cfg_t usart_cfg[4]; 40 | 41 | RINGBUFF_T rxring, txring; 42 | 43 | #define uart_set_baud( id, baud ) Chip_UART_SetBaud( usart_cfg[id].ptr, baud ) 44 | #define uart_config_data( id, cfg ) Chip_UART_ConfigData( usart_cfg[id].ptr, cfg ) 45 | #define uart_tx_enable( id ) Chip_UART_TXEnable( usart_cfg[id].ptr ) 46 | #define uart_tx_disable( id ) Chip_UART_TXDisable( usart_cfg[id].ptr ) 47 | #define uart_int_enable( id, mask ) Chip_UART_IntEnable( usart_cfg[id].ptr, mask ) 48 | #define uart_int_disable( id, mask ) Chip_UART_IntDisable( usart_cfg[id].ptr, mask ) 49 | #define uart_send_char( id, ch ) Chip_UART_SendByte( usart_cfg[id].ptr, ch ) 50 | #define uart_read_char( id ) Chip_UART_ReadByte( usart_cfg[id].ptr ) 51 | #define uart_send( id, msg, len ) Chip_UART_SendRB( usart_cfg[id].ptr, &txring, msg, len ) 52 | #define uart_read( id, buf, len ) Chip_UART_ReadRB( usart_cfg[id].ptr, &rxring, buf, len ) 53 | void uart_init( uint8_t id ); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /modules/utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @file utils.c 24 | * @brief General utilities functions 25 | * @author Henrique Silva 26 | */ 27 | 28 | /* Kernel includes. */ 29 | #include "FreeRTOS.h" 30 | #include "utils.h" 31 | 32 | TickType_t getTickDifference(TickType_t current_time, TickType_t start_time) 33 | { 34 | TickType_t result = 0; 35 | if (current_time < start_time) { 36 | result = start_time - current_time; 37 | result = portMAX_DELAY - result; 38 | } else { 39 | result = current_time - start_time; 40 | } 41 | return result; 42 | } 43 | 44 | uint8_t calculate_chksum ( uint8_t * buffer, uint8_t range ) 45 | { 46 | configASSERT( buffer != NULL ); 47 | uint8_t chksum = 0; 48 | uint8_t i; 49 | for ( i = 0; i < range; i++ ) { 50 | chksum -= buffer[i]; 51 | } 52 | return chksum; 53 | } 54 | 55 | uint8_t cmpBuffs( uint8_t *bufa, size_t len_a, uint8_t *bufb, size_t len_b ) 56 | { 57 | uint16_t i; 58 | if (len_a != len_b) { 59 | return 0xFF; 60 | } 61 | 62 | for( i = 0; inext) { 37 | if ( voltage_sensor->task_handle == NULL ) { 38 | continue; 39 | } 40 | /* Check if this task should update the selected SDR */ 41 | if ( *(voltage_sensor->task_handle) != xTaskGetCurrentTaskHandle() ) { 42 | continue; 43 | } 44 | 45 | max11609_cfg.channel_sel = ((SDR_type_01h_t*)voltage_sensor->sdr)->OEM; 46 | err = max116xx_set_config(voltage_sensor->chipid, &max11609_cfg); 47 | if(err != MMC_OK) continue; 48 | 49 | err = max116xx_read_uni(voltage_sensor->chipid, data_voltage, 1); 50 | if (err == MMC_OK) 51 | { 52 | voltage_sensor->readout_value = (uint16_t)(data_voltage[0] >> 2); 53 | } 54 | 55 | sensor_state_check(voltage_sensor); 56 | check_sensor_event(voltage_sensor); 57 | } 58 | vTaskDelay(update_period); 59 | } 60 | } 61 | 62 | void MAX11609_init() 63 | { 64 | xTaskCreate(vTaskMAX11609, "MAX11609", 256, (void *) NULL, tskMAX11609SENSOR_PRIORITY, &vTask11609_Handle); 65 | } 66 | -------------------------------------------------------------------------------- /config/lnls/afcv3.1-bpm-clk-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "afc_ver": "3.1", 3 | "in_cfg": { 4 | "FMC2_CLK3_BIDIR": { 5 | "POL": "POS" 6 | }, 7 | "FMC2_CLK1_M2": { 8 | "POL": "POS" 9 | }, 10 | "FMC2_CLK0_M2C": { 11 | "POL": "POS" 12 | }, 13 | "FMC2_CLK2_BIDIR": { 14 | "POL": "POS" 15 | }, 16 | "TCLKB": { 17 | "POL": "POS" 18 | }, 19 | "TCLKA": { 20 | "POL": "POS" 21 | }, 22 | "TCLKC": { 23 | "POL": "POS" 24 | }, 25 | "TCLKD": { 26 | "POL": "POS" 27 | }, 28 | "FCLKA": { 29 | "POL": "POS" 30 | }, 31 | "FMC1_CLK3_BIDIR": { 32 | "POL": "POS" 33 | }, 34 | "FMC1_CLK1_M2C": { 35 | "POL": "POS" 36 | }, 37 | "FMC1_CLK0_M2C": { 38 | "POL": "POS" 39 | }, 40 | "FMC1_CLK2_BIDIR": { 41 | "POL": "POS" 42 | }, 43 | "WR_PLL_CLK1": { 44 | "POL": "POS" 45 | }, 46 | "CLK20_VCXO": { 47 | "POL": "POS" 48 | }, 49 | "SI57X_CLK": { 50 | "POL": "POS" 51 | } 52 | }, 53 | "out_cfg": { 54 | "TCLKD": { 55 | "SRC": "FMC2_CLK3_BIDIR", 56 | "EN": false 57 | }, 58 | "TCLKC": { 59 | "SRC": "FMC2_CLK3_BIDIR", 60 | "EN": false 61 | }, 62 | "TCLKA": { 63 | "SRC": "FMC2_CLK3_BIDIR", 64 | "EN": false 65 | }, 66 | "TCLKB": { 67 | "SRC": "FMC2_CLK3_BIDIR", 68 | "EN": false 69 | }, 70 | "FPGA_CLK1": { 71 | "SRC": "WR_PLL_CLK1", 72 | "EN": true 73 | }, 74 | "FP2_CLK2": { 75 | "SRC": "FCLKA", 76 | "EN": false 77 | }, 78 | "LINK01_CLK": { 79 | "SRC": "TCLKA", 80 | "EN": true 81 | }, 82 | "FP2_CLK1": { 83 | "SRC": "SI57X_CLK", 84 | "EN": true 85 | }, 86 | "PCIE_CLK1": { 87 | "SRC": "FCLKA", 88 | "EN": true 89 | }, 90 | "LINK23_CLK": { 91 | "SRC": "TCLKA", 92 | "EN": false 93 | }, 94 | "FIN1_CLK3": { 95 | "SRC": "TCLKA", 96 | "EN": true 97 | }, 98 | "FIN1_CLK2": { 99 | "SRC": "TCLKA", 100 | "EN": true 101 | }, 102 | "RTM_SYNC_CLK": { 103 | "SRC": "CLK20_VCXO", 104 | "EN": false 105 | }, 106 | "OP15C": { 107 | "SRC": "TCLKA", 108 | "EN": true 109 | }, 110 | "FIN2_CLK2": { 111 | "SRC": "TCLKA", 112 | "EN": true 113 | }, 114 | "FIN2_CLK3": { 115 | "SRC": "TCLKA", 116 | "EN": true 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_power.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /** 21 | * @file lpc17_power.h 22 | * @author Henrique Silva , LNLS 23 | * 24 | * @brief Definitions of power mode selection for LPC17xx 25 | */ 26 | 27 | #ifdef LPC17_POWER_H_ 28 | #undef LPC17_POWER_H_ 29 | #endif 30 | #define LPC17_POWER_H_ 31 | 32 | #include "pmu_17xx_40xx.h" 33 | 34 | /** 35 | * @brief Enter MCU Sleep mode 36 | * @return None 37 | * @note The sleep mode effects differ between controllers, check the corresponding documentation 38 | */ 39 | #define pm_sleep() Chip_PMU_Sleep(LPC_PMU, PMU_MCU_SLEEP) 40 | 41 | /** 42 | * @brief Enter MCU Deep Sleep mode 43 | * @return None 44 | * @note The deep sleep mode effects differ between controllers, check the corresponding documentation 45 | */ 46 | #define pm_deep_sleep() Chip_PMU_Sleep(LPC_PMU, PMU_MCU_DEEP_SLEEP) 47 | 48 | /** 49 | * @brief Enter MCU Power Down mode 50 | * @return None 51 | * @note The power down mode effects differ between controllers, check the corresponding documentation 52 | */ 53 | #define pm_power_down() Chip_PMU_Sleep(LPC_PMU, PMU_MCU_POWER_DOWN) 54 | 55 | /** 56 | * @brief Enter MCU Deep Power Down mode 57 | * @return None 58 | * @note The deep power down mode effects differ between controllers, check the corresponding documentation 59 | */ 60 | #define pm_deep_power_down() Chip_PMU_Sleep(LPC_PMU, PMU_MCU_DEEP_PWRDOWN) 61 | -------------------------------------------------------------------------------- /modules/flash_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | #ifndef FLASH_SPI_H_ 23 | #define FLASH_SPI_H_ 24 | 25 | #define FLASH_SPI_BITRATE 1000000 26 | #define FLASH_SPI_FRAME_SIZE 8 27 | 28 | /* M25P128 Flash commands */ 29 | #define FLASH_WRITE_ENABLE 0x06 30 | #define FLASH_WRITE_DISABLE 0x04 31 | #define FLASH_READ_ID 0x9F 32 | #define FLASH_READ_STATUS_REG 0x05 33 | #define FLASH_WRITE_STATUS_REG 0x01 34 | #define FLASH_READ_LOCK_REG 0xE8 35 | #define FLASH_WRITE_LOCK_REG 0xE5 36 | #define FLASH_READ_DATA 0x03 37 | #define FLASH_FAST_READ_DATA 0x0B 38 | #define FLASH_PROGRAM_PAGE 0x02 39 | #define FLASH_SECTOR_ERASE 0xD8 40 | #define FLASH_BULK_ERASE 0xC7 41 | 42 | void flash_write_enable( void ); 43 | void flash_write_disable( void ); 44 | void flash_read_id( uint8_t * id_buffer, uint8_t buff_size ); 45 | uint8_t flash_read_status_reg( void ); 46 | void flash_write_status_reg( uint8_t data ); 47 | uint8_t flash_read_data( uint32_t address ); 48 | void flash_fast_read_data( uint32_t start_addr, uint8_t * dst, uint32_t size ); 49 | void flash_program_page( uint32_t address, uint8_t * data, uint16_t size ); 50 | void flash_sector_erase( uint32_t address ); 51 | void flash_bulk_erase( void ); 52 | uint8_t flash_read_lock_reg( uint32_t address ); 53 | void flash_write_lock_reg( uint32_t address, uint8_t data ); 54 | uint8_t is_flash_busy( void ); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/inc/usbd/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * $Id:: mw_usbd_desc.h 165 2011-04-14 17:41:11Z usb10131 $ 3 | * 4 | * Project: USB device ROM Stack 5 | * 6 | * Description: 7 | * USB Descriptors Definitions. 8 | * 9 | *********************************************************************** 10 | * Copyright(C) 2011, NXP Semiconductor 11 | * All rights reserved. 12 | * 13 | * Software that is described herein is for illustrative purposes only 14 | * which provides customers with programming information regarding the 15 | * products. This software is supplied "AS IS" without any warranties. 16 | * NXP Semiconductors assumes no responsibility or liability for the 17 | * use of the software, conveys no license or title under any patent, 18 | * copyright, or mask work right to the product. NXP Semiconductors 19 | * reserves the right to make changes in the software without 20 | * notification. NXP Semiconductors also make no representation or 21 | * warranty that such application will be suitable for the specified 22 | * use without further testing or modification. 23 | **********************************************************************/ 24 | 25 | #ifndef __USBDESC_H__ 26 | #define __USBDESC_H__ 27 | 28 | #include "usbd.h" 29 | 30 | #define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) 31 | #define B3VAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF),(((x) >> 16) & 0xFF) 32 | 33 | #define USB_DEVICE_DESC_SIZE (sizeof(USB_DEVICE_DESCRIPTOR)) 34 | #define USB_CONFIGUARTION_DESC_SIZE (sizeof(USB_CONFIGURATION_DESCRIPTOR)) 35 | #define USB_INTERFACE_DESC_SIZE (sizeof(USB_INTERFACE_DESCRIPTOR)) 36 | #define USB_ENDPOINT_DESC_SIZE (sizeof(USB_ENDPOINT_DESCRIPTOR)) 37 | #define USB_DEVICE_QUALI_SIZE (sizeof(USB_DEVICE_QUALIFIER_DESCRIPTOR)) 38 | #define USB_OTHER_SPEED_CONF_SIZE (sizeof(USB_OTHER_SPEED_CONFIGURATION)) 39 | 40 | //#define HID_DESC_SIZE (sizeof(HID_DESCRIPTOR)) 41 | //#define HID_REPORT_DESC_SIZE (sizeof(HID_ReportDescriptor)) 42 | 43 | extern const uint8_t HID_ReportDescriptor[]; 44 | extern const uint16_t HID_ReportDescSize; 45 | extern const uint16_t HID_DescOffset; 46 | 47 | 48 | #endif /* __USBDESC_H__ */ 49 | -------------------------------------------------------------------------------- /FreeRTOS/portable/WizC/PIC18/addFreeRTOS.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /* 29 | Changes from V3.0.0 30 | 31 | Changes from V3.0.1 32 | 33 | Changes from V4.0.1 34 | Uselib pragma added for Croutine.c 35 | */ 36 | 37 | /* 38 | * The installation script will automatically prepend this file to the default FreeRTOS.h. 39 | */ 40 | 41 | #ifndef WIZC_FREERTOS_H 42 | #define WIZC_FREERTOS_H 43 | 44 | #pragma noheap 45 | #pragma wizcpp expandnl on 46 | #pragma wizcpp searchpath "$__PATHNAME__/libFreeRTOS/Include/" 47 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Croutine.c" 48 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Tasks.c" 49 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Queue.c" 50 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/List.c" 51 | #pragma wizcpp uselib "$__PATHNAME__/libFreeRTOS/Modules/Port.c" 52 | 53 | #endif /* WIZC_FREERTOS_H */ 54 | -------------------------------------------------------------------------------- /config/lnls/afcv4-fofb-clk-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "afc_ver": "4.0", 3 | "cfg": { 4 | "AMC_CLK_RTM_CLK": { 5 | "SRC": "TCLKA", 6 | "POL": "POS", 7 | "TERM": "OFF", 8 | "DIR": "OUT" 9 | }, 10 | "FMC2_CLK1_M2C_FMC2_CLK3_BIDIR": { 11 | "SRC": "AMC_CLK_RTM_CLK", 12 | "POL": "POS", 13 | "TERM": "OFF", 14 | "DIR": "IN" 15 | }, 16 | "FMC1_CLK1_M2C_FMC1_CLK3_BIDIR": { 17 | "SRC": "AMC_CLK_RTM_CLK", 18 | "POL": "POS", 19 | "TERM": "OFF", 20 | "DIR": "IN" 21 | }, 22 | "FMC1_CLK0_M2C": { 23 | "SRC": "AMC_CLK_RTM_CLK", 24 | "POL": "POS", 25 | "TERM": "OFF", 26 | "DIR": "IN" 27 | }, 28 | "FMC1_CLK2_BIDIR": { 29 | "SRC": "AMC_CLK_RTM_CLK", 30 | "POL": "POS", 31 | "TERM": "OFF", 32 | "DIR": "IN" 33 | }, 34 | "SI57X_PRI": { 35 | "SRC": "AMC_CLK_RTM_CLK", 36 | "POL": "POS", 37 | "TERM": "ON", 38 | "DIR": "IN" 39 | }, 40 | "FMC2_CLK0_M2C": { 41 | "SRC": "AMC_CLK_RTM_CLK", 42 | "POL": "POS", 43 | "TERM": "OFF", 44 | "DIR": "IN" 45 | }, 46 | "FMC2_CLK2_BIDIR": { 47 | "SRC": "TCLKA", 48 | "POL": "POS", 49 | "TERM": "OFF", 50 | "DIR": "OUT" 51 | }, 52 | "TCLKD_FLEX_FPGA_CLK3": { 53 | "SRC": "AMC_CLK_RTM_CLK", 54 | "POL": "POS", 55 | "TERM": "OFF", 56 | "DIR": "IN" 57 | }, 58 | "TCLKC_FLEX_FPGA_CLK2": { 59 | "SRC": "AMC_CLK_RTM_CLK", 60 | "POL": "POS", 61 | "TERM": "OFF", 62 | "DIR": "IN" 63 | }, 64 | "TCLKA": { 65 | "SRC": "AMC_CLK_RTM_CLK", 66 | "POL": "POS", 67 | "TERM": "ON", 68 | "DIR": "IN" 69 | }, 70 | "TCLKB": { 71 | "SRC": "AMC_CLK_RTM_CLK", 72 | "POL": "POS", 73 | "TERM": "OFF", 74 | "DIR": "IN" 75 | }, 76 | "FLEX_GTP113_CLK0": { 77 | "SRC": "AMC_CLK_RTM_CLK", 78 | "POL": "POS", 79 | "TERM": "OFF", 80 | "DIR": "IN" 81 | }, 82 | "FLEX_GTP113_GTP216_CLK1": { 83 | "SRC": "SI57X_PRI", 84 | "POL": "POS", 85 | "TERM": "OFF", 86 | "DIR": "OUT" 87 | }, 88 | "FLEX_GTP116_CLK1_RTM_GTP03": { 89 | "SRC": "AMC_CLK_RTM_CLK", 90 | "POL": "POS", 91 | "TERM": "OFF", 92 | "DIR": "IN" 93 | }, 94 | "FLEX_GTP213_CLK1_RTM_GTP47": { 95 | "SRC": "TCLKA", 96 | "POL": "POS", 97 | "TERM": "OFF", 98 | "DIR": "OUT" 99 | } 100 | } 101 | } -------------------------------------------------------------------------------- /config/lnls/afcv3.1-timing-clk-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "afc_ver": "3.1", 3 | "in_cfg": { 4 | "FMC2_CLK3_BIDIR": { 5 | "POL": "POS" 6 | }, 7 | "FMC2_CLK1_M2": { 8 | "POL": "POS" 9 | }, 10 | "FMC2_CLK0_M2C": { 11 | "POL": "POS" 12 | }, 13 | "FMC2_CLK2_BIDIR": { 14 | "POL": "POS" 15 | }, 16 | "TCLKB": { 17 | "POL": "POS" 18 | }, 19 | "TCLKA": { 20 | "POL": "POS" 21 | }, 22 | "TCLKC": { 23 | "POL": "POS" 24 | }, 25 | "TCLKD": { 26 | "POL": "POS" 27 | }, 28 | "FCLKA": { 29 | "POL": "POS" 30 | }, 31 | "FMC1_CLK3_BIDIR": { 32 | "POL": "POS" 33 | }, 34 | "FMC1_CLK1_M2C": { 35 | "POL": "POS" 36 | }, 37 | "FMC1_CLK0_M2C": { 38 | "POL": "POS" 39 | }, 40 | "FMC1_CLK2_BIDIR": { 41 | "POL": "POS" 42 | }, 43 | "WR_PLL_CLK1": { 44 | "POL": "POS" 45 | }, 46 | "CLK20_VCXO": { 47 | "POL": "POS" 48 | }, 49 | "SI57X_CLK": { 50 | "POL": "POS" 51 | } 52 | }, 53 | "out_cfg": { 54 | "TCLKD": { 55 | "SRC": "FMC2_CLK3_BIDIR", 56 | "EN": false 57 | }, 58 | "TCLKC": { 59 | "SRC": "FMC2_CLK3_BIDIR", 60 | "EN": false 61 | }, 62 | "TCLKA": { 63 | "SRC": "FMC2_CLK3_BIDIR", 64 | "EN": false 65 | }, 66 | "TCLKB": { 67 | "SRC": "SI57X_CLK", 68 | "EN": true 69 | }, 70 | "FPGA_CLK1": { 71 | "SRC": "SI57X_CLK", 72 | "EN": true 73 | }, 74 | "FP2_CLK2": { 75 | "SRC": "FCLKA", 76 | "EN": false 77 | }, 78 | "LINK01_CLK": { 79 | "SRC": "WR_PLL_CLK1", 80 | "EN": true 81 | }, 82 | "FP2_CLK1": { 83 | "SRC": "FCLKA", 84 | "EN": false 85 | }, 86 | "PCIE_CLK1": { 87 | "SRC": "FCLKA", 88 | "EN": true 89 | }, 90 | "LINK23_CLK": { 91 | "SRC": "WR_PLL_CLK1", 92 | "EN": false 93 | }, 94 | "FIN1_CLK3": { 95 | "SRC": "CLK20_VCXO", 96 | "EN": false 97 | }, 98 | "FIN1_CLK2": { 99 | "SRC": "CLK20_VCXO", 100 | "EN": false 101 | }, 102 | "RTM_SYNC_CLK": { 103 | "SRC": "CLK20_VCXO", 104 | "EN": false 105 | }, 106 | "OP15C": { 107 | "SRC": "SI57X_CLK", 108 | "EN": true 109 | }, 110 | "FIN2_CLK2": { 111 | "SRC": "CLK20_VCXO", 112 | "EN": false 113 | }, 114 | "FIN2_CLK3": { 115 | "SRC": "FMC2_CLK2_BIDIR", 116 | "EN": false 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/src/gpio_17xx_40xx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @brief LPC17xx/40xx GPIO driver 3 | * 4 | * @note 5 | * Copyright(C) NXP Semiconductors, 2014 6 | * All rights reserved. 7 | * 8 | * @par 9 | * Software that is described herein is for illustrative purposes only 10 | * which provides customers with programming information regarding the 11 | * LPC products. This software is supplied "AS IS" without any warranties of 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and 13 | * all warranties, express or implied, including all implied warranties of 14 | * merchantability, fitness for a particular purpose and non-infringement of 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility 16 | * or liability for the use of the software, conveys no license or rights under any 17 | * patent, copyright, mask work right, or any other intellectual property rights in 18 | * or to any products. NXP Semiconductors reserves the right to make changes 19 | * in the software without notification. NXP Semiconductors also makes no 20 | * representation or warranty that such application will be suitable for the 21 | * specified use without further testing or modification. 22 | * 23 | * @par 24 | * Permission to use, copy, modify, and distribute this software and its 25 | * documentation is hereby granted, under NXP Semiconductors' and its 26 | * licensor's relevant copyrights in the software, without fee, provided that it 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This 28 | * copyright, permission, and disclaimer notice must appear in all copies of 29 | * this code. 30 | */ 31 | 32 | #include "chip.h" 33 | 34 | /***************************************************************************** 35 | * Private types/enumerations/variables 36 | ****************************************************************************/ 37 | 38 | 39 | /***************************************************************************** 40 | * Public types/enumerations/variables 41 | ****************************************************************************/ 42 | 43 | /***************************************************************************** 44 | * Private functions 45 | ****************************************************************************/ 46 | 47 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/src/gpioint_17xx_40xx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * @brief LPC17xx/40xx GPIO Interrupt driver 3 | * 4 | * @note 5 | * Copyright(C) NXP Semiconductors, 2014 6 | * All rights reserved. 7 | * 8 | * @par 9 | * Software that is described herein is for illustrative purposes only 10 | * which provides customers with programming information regarding the 11 | * LPC products. This software is supplied "AS IS" without any warranties of 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and 13 | * all warranties, express or implied, including all implied warranties of 14 | * merchantability, fitness for a particular purpose and non-infringement of 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility 16 | * or liability for the use of the software, conveys no license or rights under any 17 | * patent, copyright, mask work right, or any other intellectual property rights in 18 | * or to any products. NXP Semiconductors reserves the right to make changes 19 | * in the software without notification. NXP Semiconductors also makes no 20 | * representation or warranty that such application will be suitable for the 21 | * specified use without further testing or modification. 22 | * 23 | * @par 24 | * Permission to use, copy, modify, and distribute this software and its 25 | * documentation is hereby granted, under NXP Semiconductors' and its 26 | * licensor's relevant copyrights in the software, without fee, provided that it 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This 28 | * copyright, permission, and disclaimer notice must appear in all copies of 29 | * this code. 30 | */ 31 | 32 | #include "chip.h" 33 | 34 | /***************************************************************************** 35 | * Private types/enumerations/variables 36 | ****************************************************************************/ 37 | 38 | 39 | /***************************************************************************** 40 | * Public types/enumerations/variables 41 | ****************************************************************************/ 42 | 43 | /***************************************************************************** 44 | * Private functions 45 | ****************************************************************************/ 46 | 47 | -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/MSP430X/data_model.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef DATA_MODEL_H 29 | #define DATA_MODEL_H 30 | 31 | #if __DATA_MODEL__ == __DATA_MODEL_SMALL__ 32 | #define pushm_x pushm.w 33 | #define popm_x popm.w 34 | #define push_x push.w 35 | #define pop_x pop.w 36 | #define mov_x mov.w 37 | #define cmp_x cmp.w 38 | #endif 39 | 40 | #if __DATA_MODEL__ == __DATA_MODEL_MEDIUM__ 41 | #define pushm_x pushm.a 42 | #define popm_x popm.a 43 | #define push_x pushx.a 44 | #define pop_x popx.a 45 | #define mov_x mov.w 46 | #define cmp_x cmp.w 47 | #endif 48 | 49 | #if __DATA_MODEL__ == __DATA_MODEL_LARGE__ 50 | #define pushm_x pushm.a 51 | #define popm_x popm.a 52 | #define push_x pushx.a 53 | #define pop_x popx.a 54 | #define mov_x movx.a 55 | #define cmp_x cmpx.a 56 | #endif 57 | 58 | #ifndef pushm_x 59 | #error The assembler options must define one of the following symbols: __DATA_MODEL_SMALL__, __DATA_MODEL_MEDIUM__, or __DATA_MODEL_LARGE__ 60 | #endif 61 | 62 | #endif /* DATA_MODEL_H */ 63 | 64 | -------------------------------------------------------------------------------- /port/board/rtm-8sfp/rtm_user_fru.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Julian Mendez 5 | * Copyright (C) 2015-2016 Henrique Silva 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * @license GPL-3.0+ 21 | */ 22 | 23 | #include "fru_editor.h" 24 | 25 | /********************************************* 26 | * Common defines 27 | *********************************************/ 28 | #define RTM_LANG_CODE 0 29 | #define RTM_FRU_FILE_ID "RTMFRU" //Allows knowing the source of the FRU present in the memory 30 | 31 | /********************************************* 32 | * Board information area 33 | *********************************************/ 34 | #define RTM_BOARD_MANUFACTURING_TIME 10463040 /* Amount of minutes since 0:00 1/1/96 */ 35 | #define RTM_BOARD_MANUFACTURER "Creotech" 36 | #define RTM_BOARD_NAME "RTM-8-SFP" 37 | #define RTM_BOARD_SN "" 38 | #define RTM_BOARD_PN "RTM-8-SFP" 39 | 40 | /********************************************* 41 | * Product information area 42 | *********************************************/ 43 | #define RTM_PRODUCT_MANUFACTURER "LNLS" 44 | #define RTM_PRODUCT_NAME "AFC SFP Module" 45 | #define RTM_PRODUCT_PN "" 46 | #define RTM_PRODUCT_VERSION "v1.1" 47 | #define RTM_PRODUCT_SN "" 48 | #define RTM_PRODUCT_ASSET_TAG "Generic FRU" 49 | 50 | /********************************************* 51 | * RTM Compatibility Record 52 | *********************************************/ 53 | #define RTM_COMPATIBILITY_CODE 0x11223344 54 | -------------------------------------------------------------------------------- /port/board/rtm-lamp/rtm_user_fru.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015 Julian Mendez 5 | * Copyright (C) 2015-2016 Henrique Silva 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | * 20 | * @license GPL-3.0+ 21 | */ 22 | 23 | #include "fru_editor.h" 24 | 25 | /********************************************* 26 | * Common defines 27 | *********************************************/ 28 | #define RTM_LANG_CODE 0 29 | #define RTM_FRU_FILE_ID "RTMFRU" //Allows knowing the source of the FRU present in the memory 30 | 31 | /********************************************* 32 | * Board information area 33 | *********************************************/ 34 | #define RTM_BOARD_MANUFACTURING_TIME 10463040 /* Amount of minutes since 0:00 1/1/96 */ 35 | #define RTM_BOARD_MANUFACTURER "Creotech" 36 | #define RTM_BOARD_NAME "RTM-8-SFP" 37 | #define RTM_BOARD_SN "" 38 | #define RTM_BOARD_PN "RTM-8-SFP" 39 | 40 | /********************************************* 41 | * Product information area 42 | *********************************************/ 43 | #define RTM_PRODUCT_MANUFACTURER "LNLS" 44 | #define RTM_PRODUCT_NAME "AFC SFP Module" 45 | #define RTM_PRODUCT_PN "" 46 | #define RTM_PRODUCT_VERSION "v1.1" 47 | #define RTM_PRODUCT_SN "" 48 | #define RTM_PRODUCT_ASSET_TAG "Generic FRU" 49 | 50 | /********************************************* 51 | * RTM Compatibility Record 52 | *********************************************/ 53 | #define RTM_COMPATIBILITY_CODE 0x11223344 54 | -------------------------------------------------------------------------------- /port/board/afc-v4/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #Select which microcontroller and board are being used 2 | if (NOT TARGET_CONTROLLER) 3 | set(TARGET_CONTROLLER "LPC1768" CACHE STRING "Target MMC Controller") 4 | endif() 5 | 6 | if (NOT TARGET_BOARD_NAME) 7 | set(TARGET_BOARD_NAME "AFC v4.0" CACHE STRING "Board Name") 8 | endif() 9 | 10 | #List all modules used by this board 11 | set(TARGET_MODULES 12 | "FRU" 13 | "CLOCK_CONFIG" 14 | "EEPROM_24XX02" 15 | "PAYLOAD" 16 | "SDR" 17 | "DAC_AD84XX" 18 | "HOTSWAP_SENSOR" 19 | "EEPROM_AT24MAC" 20 | "LM75" 21 | "MAX6642" 22 | "INA3221_VOLTAGE" 23 | "INA3221_CURRENT" 24 | "UART_DEBUG" 25 | "MCP23016" 26 | "ADC" 27 | "BOARD_CONFIG" 28 | "IDT_8V54816" 29 | "HPM" 30 | "SYSUTILS" 31 | "RTM" 32 | ) 33 | 34 | if (NOT DISABLE_WATCHDOG) 35 | list(APPEND TARGET_MODULES "WATCHDOG") 36 | endif() 37 | 38 | set(BOARD_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 39 | 40 | #Include the modules sources 41 | ##Sensors SDR list 42 | set( PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/sdr_list.c ) 43 | set( PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/i2c_mapping.c ) 44 | set( PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/pin_mapping.c ) 45 | 46 | if (";${TARGET_MODULES};" MATCHES ";PAYLOAD;") 47 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/payload.c) 48 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_PAYLOAD") 49 | endif() 50 | 51 | if (";${TARGET_MODULES};" MATCHES ";RTM;") 52 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/rtm.c) 53 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_RTM") 54 | endif() 55 | 56 | if (";${TARGET_MODULES};" MATCHES ";ADC;") 57 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_ADC") 58 | endif() 59 | 60 | if (";${TARGET_MODULES};" MATCHES ";BOARD_CONFIG;") 61 | set(PROJ_SRCS ${PROJ_SRCS} ${BOARD_PATH}/board_config.c) 62 | set(MODULES_FLAGS "${MODULES_FLAGS} -DMODULE_BOARD_CONFIG") 63 | endif() 64 | 65 | #Extra definitions 66 | if (FRU_WRITE_EEPROM) 67 | message(STATUS "FRU EEPROM will be written if no valid data is found!") 68 | set(MODULES_FLAGS "${MODULES_FLAGS} -DFRU_WRITE_EEPROM") 69 | set(FRU_WRITE_EEPROM false CACHE BOOL "Set this flag to enable writing the board ID on the EEPROM" FORCE) 70 | endif() 71 | 72 | #Set the variables in the main scope 73 | set(TARGET_MODULES ${TARGET_MODULES} PARENT_SCOPE) 74 | set(MODULES_FLAGS ${MODULES_FLAGS} PARENT_SCOPE) 75 | set(PROJ_SRCS ${PROJ_SRCS} PARENT_SCOPE) 76 | set(PROJ_HDRS ${PROJ_HDRS} ${BOARD_PATH}) 77 | set(PROJ_HDRS ${PROJ_HDRS} PARENT_SCOPE) 78 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpc17_uartrb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- 3 | * 4 | * Copyright (C) 2015 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | /*! 21 | * @file lpc17_uart.c 22 | * @author Henrique Silva , LNLS 23 | * @date June 2016 24 | * 25 | * @brief 26 | */ 27 | 28 | #include "FreeRTOS.h" 29 | #include "port.h" 30 | #include "string.h" 31 | 32 | volatile lpc_uart_cfg_t usart_cfg[4] = { 33 | {LPC_UART0, UART0_IRQn}, 34 | {LPC_UART1, UART1_IRQn}, 35 | {LPC_UART2, UART2_IRQn}, 36 | {LPC_UART3, UART3_IRQn} 37 | }; 38 | 39 | /* Transmit and receive ring buffer sizes - MUST be power of 2 */ 40 | #define UART_SRB_SIZE 256 /* Send */ 41 | #define UART_RRB_SIZE 32 /* Receive */ 42 | 43 | /* Transmit and receive buffers */ 44 | static uint8_t rxbuff[UART_RRB_SIZE], txbuff[UART_SRB_SIZE]; 45 | 46 | void UART0_IRQHandler(void) 47 | { 48 | Chip_UART_IRQRBHandler(LPC_UART0, &rxring, &txring); 49 | } 50 | 51 | void UART1_IRQHandler(void) 52 | { 53 | Chip_UART_IRQRBHandler(LPC_UART1, &rxring, &txring); 54 | } 55 | 56 | void UART2_IRQHandler(void) 57 | { 58 | Chip_UART_IRQRBHandler(LPC_UART2, &rxring, &txring); 59 | } 60 | 61 | void UART3_IRQHandler(void) 62 | { 63 | Chip_UART_IRQRBHandler(LPC_UART3, &rxring, &txring); 64 | } 65 | 66 | void uart_init( uint8_t id ) 67 | { 68 | Chip_UART_Init( usart_cfg[id].ptr ); 69 | 70 | /* THR Interrupt enable */ 71 | uart_int_enable( id, UART_IER_THREINT ); 72 | 73 | RingBuffer_Init(&rxring, rxbuff, 1, UART_RRB_SIZE); 74 | RingBuffer_Init(&txring, txbuff, 1, UART_SRB_SIZE); 75 | 76 | /* Enable UARTn interruptions */ 77 | NVIC_SetPriority( usart_cfg[id].irq, configMAX_SYSCALL_INTERRUPT_PRIORITY ); 78 | NVIC_EnableIRQ( usart_cfg[id].irq ); 79 | } 80 | -------------------------------------------------------------------------------- /modules/idt_8v54816.c: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2021 Krzysztof Macias 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /* FreeRTOS includes */ 23 | #include "FreeRTOS.h" 24 | 25 | /* Project Includes */ 26 | #include "port.h" 27 | #include "idt_8v54816.h" 28 | #include "i2c.h" 29 | #include "i2c_mapping.h" 30 | 31 | uint8_t clock_switch_read_reg(uint8_t *rx_data) 32 | { 33 | uint8_t i2c_addr, i2c_interface; 34 | uint8_t rx_len = 0; 35 | 36 | if ( i2c_take_by_chipid( CHIP_ID_8V54816, &i2c_addr, &i2c_interface, portMAX_DELAY ) && ( rx_data != NULL ) ) { 37 | 38 | rx_len = xI2CMasterRead( i2c_interface, i2c_addr, rx_data, 16 ); 39 | i2c_give( i2c_interface ); 40 | } 41 | return rx_len; 42 | } 43 | 44 | uint8_t clock_switch_write_reg(uint8_t *tx_data) 45 | { 46 | uint8_t i2c_interf, i2c_addr; 47 | uint8_t tx_len = 0; 48 | if ( i2c_take_by_chipid( CHIP_ID_8V54816, &i2c_addr, &i2c_interf, portMAX_DELAY) == pdTRUE ) { 49 | tx_len = xI2CMasterWrite( i2c_interf, i2c_addr, tx_data, 16); 50 | i2c_give( i2c_interf ); 51 | } 52 | return tx_len; 53 | } 54 | 55 | uint8_t clock_switch_set_single_channel(uint8_t channel, uint8_t value) 56 | { 57 | uint8_t data[16] = {0}; 58 | if (clock_switch_read_reg(data)){ 59 | data[channel] = value; 60 | return clock_switch_write_reg(data); 61 | } 62 | return 0; 63 | } 64 | 65 | uint8_t clock_switch_read_single_channel(uint8_t channel, uint8_t *data) 66 | { 67 | uint8_t all_regs[16] = {0}; 68 | if (clock_switch_read_reg(all_regs)){ 69 | *data = all_regs[channel]; 70 | return 1; 71 | } 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /FreeRTOS/trace/trcRecorder.c: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Tracealyzer v2.7.8 Recorder Library 3 | * Percepio AB, www.percepio.com 4 | * 5 | * trcRecorder.c 6 | * 7 | * A "wrapper" for all .c files of the recorder, to make it easier to integrate 8 | * in an existing project. Just include this file to build the whole recorder. 9 | * 10 | * Terms of Use 11 | * This software is copyright Percepio AB. The recorder library is free for 12 | * use together with Percepio products. You may distribute the recorder library 13 | * in its original form, including modifications in trcHardwarePort.c/.h 14 | * given that these modification are clearly marked as your own modifications 15 | * and documented in the initial comment section of these source files. 16 | * This software is the intellectual property of Percepio AB and may not be 17 | * sold or in other ways commercially redistributed without explicit written 18 | * permission by Percepio AB. 19 | * 20 | * Disclaimer 21 | * The trace tool and recorder library is being delivered to you AS IS and 22 | * Percepio AB makes no warranty as to its use or performance. Percepio AB does 23 | * not and cannot warrant the performance or results you may obtain by using the 24 | * software or documentation. Percepio AB make no warranties, express or 25 | * implied, as to noninfringement of third party rights, merchantability, or 26 | * fitness for any particular purpose. In no event will Percepio AB, its 27 | * technology partners, or distributors be liable to you for any consequential, 28 | * incidental or special damages, including any lost profits or lost savings, 29 | * even if a representative of Percepio AB has been advised of the possibility 30 | * of such damages, or for any claim by any third party. Some jurisdictions do 31 | * not allow the exclusion or limitation of incidental, consequential or special 32 | * damages, or the exclusion of implied warranties or limitations on how long an 33 | * implied warranty may last, so the above limitations may not apply to you. 34 | * 35 | * Tabs are used for indent in this file (1 tab = 4 spaces) 36 | * 37 | * Copyright Percepio AB, 2012-2015. 38 | * www.percepio.com 39 | ******************************************************************************/ 40 | /* 41 | #include "trcUser.c" 42 | #include "trcBase.c" 43 | #include "trcHardwarePort.c" 44 | #include "trcKernel.c" 45 | #include "trcKernelPortFreeRTOS.c" 46 | */ 47 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/bootloader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(BOOTLOADER_INC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/inc) 2 | 3 | set(BOOTLOADER_SRCS 4 | ${CMAKE_CURRENT_SOURCE_DIR}/src/lpc17_clock.c 5 | ${CMAKE_CURRENT_SOURCE_DIR}/src/lpc17_iap.c 6 | ${CMAKE_CURRENT_SOURCE_DIR}/src/lpc17_pincfg.c 7 | ${CMAKE_CURRENT_SOURCE_DIR}/src/lpc17_progmem.c 8 | ${CMAKE_CURRENT_SOURCE_DIR}/src/lpc17_uart.c 9 | ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c 10 | ${CMAKE_CURRENT_SOURCE_DIR}/src/start_app.c 11 | ${CMAKE_CURRENT_SOURCE_DIR}/src/startup.s 12 | ) 13 | 14 | set(BOOTLOADER_SRCS ${BOOTLOADER_SRCS} PARENT_SCOPE) 15 | set(BOOTLOADER_INC_PATH ${BOOTLOADER_INC_PATH} PARENT_SCOPE) 16 | 17 | set(COMMON_FLAGS "") 18 | set(CMAKE_C_FLAGS "") 19 | set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") 20 | set(CMAKE_EXE_LINKER_FLAGS "") 21 | set(CMAKE_C_FLAGS_DEBUG "-Og -g3 -DDEBUG") 22 | set(CMAKE_C_FLAGS_RELEASE "-Os") 23 | set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -g3") 24 | 25 | set(CMAKE_ASM_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) 26 | set(CMAKE_ASM_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) 27 | set(CMAKE_ASM_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO}) 28 | 29 | set(LPC17_BOOT_FLAGS "-fno-tree-loop-distribute-patterns -fno-exceptions -fno-unwind-tables -fdata-sections -ffunction-sections -Wall -mcpu=cortex-m3 -mlittle-endian -mthumb -I \"${BOOTLOADER_INC_PATH}\" -mlong-calls") 30 | set(LPC17_BOOT_LINK_FLAGS "${LPC17_BOOT_FLAGS} -Wl,--gc-sections -nostdlib -nostartfiles -T \"${CMAKE_CURRENT_SOURCE_DIR}/../linker/${TARGET_CONTROLLER}_boot.ld\"") 31 | message(STATUS "LPC17_BOOT_FLAGS: ${LPC17_BOOT_FLAGS}") 32 | message(STATUS "LPC17_BOOT_LINK_FLAGS: ${LPC17_BOOT_LINK_FLAGS}") 33 | message(STATUS "LPC17_FLAGS: ${LPC17_FLAGS}") 34 | add_executable(newboot ${BOOTLOADER_SRCS}) 35 | set_target_properties(newboot PROPERTIES 36 | COMPILE_FLAGS ${LPC17_BOOT_FLAGS} 37 | SUFFIX ".elf" 38 | LINK_FLAGS ${LPC17_BOOT_LINK_FLAGS} 39 | ) 40 | add_custom_command(TARGET newboot POST_BUILD 41 | COMMAND ${CMAKE_OBJCOPY} -O binary newboot.elf newboot.bin 42 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 43 | COMMENT "Generate a raw binary image of the bootloader" 44 | ) 45 | 46 | ##Generate hpm files if bin2hpm is installed 47 | 48 | find_program(BIN2HPM NAMES "bin2hpm") 49 | if(BIN2HPM) 50 | add_custom_command(TARGET newboot POST_BUILD 51 | COMMAND bin2hpm -c 0 -n -m 0x315A -p 0x00 newboot.bin -o newboot.hpm 52 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 53 | COMMENT "Creating HPM file from binary" 54 | ) 55 | endif() 56 | -------------------------------------------------------------------------------- /modules/sensors/lm75.h: -------------------------------------------------------------------------------- 1 | /* 2 | * openMMC -- Open Source modular IPM Controller firmware 3 | * 4 | * Copyright (C) 2015-2016 Henrique Silva 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | * 19 | * @license GPL-3.0+ 20 | */ 21 | 22 | /** 23 | * @defgroup LM75 LM75 - Temperature Sensor 24 | * @ingroup SENSORS 25 | * 26 | * The LM75 is a temperature sensor, Delta-Sigma analog-to-digital converter, and digital over-temperature detector with I2C interface. 27 | * The host can query the LM75 at any time to read temperature.
28 | * The open-drain Overtemperature Shutdown (O.S.) output becomes active when the temperature exceeds a programmable limit. 29 | * This pin can operate in either “Comparator” or “Interrupt” mode. 30 | */ 31 | 32 | /** 33 | * @file lm75.h 34 | * @author Henrique Silva , LNLS 35 | * 36 | * @brief Definitions for LM75 I2C Temperature Sensor 37 | * 38 | * @ingroup LM75 39 | */ 40 | 41 | #ifndef LM75_H_ 42 | #define LM75_H_ 43 | 44 | /** 45 | * @brief Rate at which the LM75 sensors are read (in ms) 46 | */ 47 | #define LM75_UPDATE_RATE 500 48 | 49 | extern TaskHandle_t vTaskLM75_Handle; 50 | 51 | extern const SDR_type_01h_t SDR_LM75_uC; 52 | extern const SDR_type_01h_t SDR_LM75_ADN4604; 53 | extern const SDR_type_01h_t SDR_LM75_DCDC; 54 | extern const SDR_type_01h_t SDR_LM75_RAM; 55 | 56 | /** 57 | * @brief Initializes LM75 monitoring task 58 | * 59 | * @return None 60 | */ 61 | void LM75_init( void ); 62 | 63 | /** 64 | * @brief Monitoring task for LM75 sensor 65 | * 66 | * This task unblocks after every #LM75_UPDATE_RATE ms and updates the read from all the LM75 sensors listed in this module's SDR table 67 | * 68 | * @param Parameters Pointer to parameter list passed to task upon initialization (not used here) 69 | */ 70 | void vTaskLM75( void* Parameters ); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /scripts/set-fru-info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # AFCv4 FRU fix (serial number and Zone3InterfaceCompatibility fields) 4 | # Copyright (C) 2024 CNPEM LNLS 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | import frugy 20 | from frugy.fru import Fru 21 | import argparse 22 | 23 | parser = argparse.ArgumentParser(description="Corrects AFCv4 FRU records") 24 | parser.add_argument("--bin-in", type=str, help="Binary file from FRU read", required=True) 25 | parser.add_argument("--bin-out", type=str, help="Binary file for FRU write", required=True) 26 | parser.add_argument("--set-serial-number", metavar="serial_number", type=str, help="Serial Number", required=False) 27 | parser.add_argument("--set-board-version", metavar="board_version", type=str, help="Board Version", default='4.0.2' ,required=False) 28 | parser.add_argument("--save-yml", type=str, help="Save YML configuration file", required=False) 29 | 30 | args= parser.parse_args() 31 | 32 | fru = Fru() 33 | fru.load_bin(args.bin_in) 34 | yaml = fru.to_dict() 35 | yaml['BoardInfo']['manufacturer']='Creotech' 36 | yaml['BoardInfo']['product_name']='AFC:' + args.set_board_version 37 | yaml['BoardInfo']['part_number']='AFC' 38 | yaml['BoardInfo']['fru_file_id']='AFCFRU' 39 | yaml['BoardInfo']['manufacturer']='CNPEM' 40 | yaml['ProductInfo']['manufacturer']='CNPEM' 41 | yaml['ProductInfo']['product_name']='AFC' 42 | yaml['ProductInfo']['part_number']='AFC' 43 | yaml['ProductInfo']['version']=args.set_board_version 44 | yaml['ProductInfo']['asset_tag']='No tag' 45 | yaml['ProductInfo']['fru_file_id']='AFCFRU' 46 | yaml['MultirecordArea'][3]['identifier_type'] = 'CLASS_ID' 47 | yaml['MultirecordArea'][3]['identifier_body'] = ['D1.3'] 48 | if(args.set_serial_number != None): 49 | yaml['BoardInfo']['serial_number']=args.set_serial_number 50 | yaml['ProductInfo']['serial_number']=args.set_serial_number 51 | 52 | fru.update(yaml) 53 | 54 | if(args.save_yml): 55 | fru.save_yaml(args.save_yml) 56 | 57 | fru.save_bin(args.bin_out) 58 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Renesas/SH2A_FPU/ISR_Support.inc: -------------------------------------------------------------------------------- 1 | ;/* 2 | ; * FreeRTOS Kernel V10.0.1 3 | ; * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | ; * 5 | ; * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | ; * this software and associated documentation files (the "Software"), to deal in 7 | ; * the Software without restriction, including without limitation the rights to 8 | ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | ; * the Software, and to permit persons to whom the Software is furnished to do so, 10 | ; * subject to the following conditions: 11 | ; * 12 | ; * The above copyright notice and this permission notice shall be included in all 13 | ; * copies or substantial portions of the Software. 14 | ; * 15 | ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | ; * 22 | ; * http://www.FreeRTOS.org 23 | ; * http://aws.amazon.com/freertos 24 | ; * 25 | ; * 1 tab == 4 spaces! 26 | ; */ 27 | .macro portSAVE_CONTEXT 28 | 29 | ; Save r0 to r14 and pr. 30 | movml.l r15, @-r15 31 | 32 | ; Save mac1, mach and gbr 33 | sts.l macl, @-r15 34 | sts.l mach, @-r15 35 | stc.l gbr, @-r15 36 | 37 | ; Get the address of pxCurrentTCB 38 | mov.l #_pxCurrentTCB, r0 39 | 40 | ; Get the address of pxTopOfStack from the TCB. 41 | mov.l @r0, r0 42 | 43 | ; Save the stack pointer in pxTopOfStack. 44 | mov.l r15, @r0 45 | 46 | .endm 47 | 48 | ;----------------------------------------------------------- 49 | 50 | .macro portRESTORE_CONTEXT 51 | 52 | ; Get the address of the pxCurrentTCB variable. 53 | mov.l #_pxCurrentTCB, r0 54 | 55 | ; Get the address of the task stack from pxCurrentTCB. 56 | mov.l @r0, r0 57 | 58 | ; Get the task stack itself into the stack pointer. 59 | mov.l @r0, r15 60 | 61 | ; Restore system registers. 62 | ldc.l @r15+, gbr 63 | lds.l @r15+, mach 64 | lds.l @r15+, macl 65 | 66 | ; Restore r0 to r14 and PR 67 | movml.l @r15+, r15 68 | 69 | ; Pop the SR and PC to jump to the start of the task. 70 | rte 71 | nop 72 | 73 | .endm 74 | ;----------------------------------------------------------- -------------------------------------------------------------------------------- /FreeRTOS/trace/trcTypes.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Tracealyzer v2.7.8 Recorder Library 3 | * Percepio AB, www.percepio.com 4 | * 5 | * trcTypes.h 6 | * 7 | * Data types used by the trace recorder library. 8 | * 9 | * Terms of Use 10 | * This software is copyright Percepio AB. The recorder library is free for 11 | * use together with Percepio products. You may distribute the recorder library 12 | * in its original form, including modifications in trcHardwarePort.c/.h 13 | * given that these modification are clearly marked as your own modifications 14 | * and documented in the initial comment section of these source files. 15 | * This software is the intellectual property of Percepio AB and may not be 16 | * sold or in other ways commercially redistributed without explicit written 17 | * permission by Percepio AB. 18 | * 19 | * Disclaimer 20 | * The trace tool and recorder library is being delivered to you AS IS and 21 | * Percepio AB makes no warranty as to its use or performance. Percepio AB does 22 | * not and cannot warrant the performance or results you may obtain by using the 23 | * software or documentation. Percepio AB make no warranties, express or 24 | * implied, as to noninfringement of third party rights, merchantability, or 25 | * fitness for any particular purpose. In no event will Percepio AB, its 26 | * technology partners, or distributors be liable to you for any consequential, 27 | * incidental or special damages, including any lost profits or lost savings, 28 | * even if a representative of Percepio AB has been advised of the possibility 29 | * of such damages, or for any claim by any third party. Some jurisdictions do 30 | * not allow the exclusion or limitation of incidental, consequential or special 31 | * damages, or the exclusion of implied warranties or limitations on how long an 32 | * implied warranty may last, so the above limitations may not apply to you. 33 | * 34 | * Tabs are used for indent in this file (1 tab = 4 spaces) 35 | * 36 | * Copyright Percepio AB, 2012-2015. 37 | * www.percepio.com 38 | ******************************************************************************/ 39 | 40 | #ifndef TRCTYPES_H 41 | #define TRCTYPES_H 42 | 43 | #include 44 | #include 45 | 46 | typedef uint16_t traceLabel; 47 | 48 | typedef uint8_t UserEventChannel; 49 | 50 | #if (USE_16BIT_OBJECT_HANDLES == 1) 51 | typedef uint16_t objectHandleType; 52 | #else 53 | typedef uint8_t objectHandleType; 54 | #endif 55 | 56 | typedef uint8_t traceObjectClass; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /FreeRTOS/portable/IAR/STR91x/portasm.s79: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | RSEG ICODE:CODE 29 | CODE32 30 | 31 | EXTERN vTaskSwitchContext 32 | 33 | PUBLIC vPortYieldProcessor 34 | PUBLIC vPortStartFirstTask 35 | 36 | #include "ISR_Support.h" 37 | 38 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 39 | ; Starting the first task is just a matter of restoring the context that 40 | ; was created by pxPortInitialiseStack(). 41 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 42 | vPortStartFirstTask: 43 | portRESTORE_CONTEXT 44 | 45 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 46 | ; Manual context switch function. This is the SWI hander. 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48 | vPortYieldProcessor: 49 | ADD LR, LR, #4 ; Add 4 to the LR to make the LR appear exactly 50 | ; as if the context was saved during and IRQ 51 | ; handler. 52 | 53 | portSAVE_CONTEXT ; Save the context of the current task... 54 | LDR R0, =vTaskSwitchContext ; before selecting the next task to execute. 55 | MOV lr, pc 56 | BX R0 57 | portRESTORE_CONTEXT ; Restore the context of the selected task. 58 | 59 | END 60 | 61 | -------------------------------------------------------------------------------- /FreeRTOS/portable/Rowley/MSP430F449/portasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PORT_ASM_H 29 | #define PORT_ASM_H 30 | 31 | portSAVE_CONTEXT macro 32 | /* Save the remaining registers. */ 33 | push r4 34 | push r5 35 | push r6 36 | push r7 37 | push r8 38 | push r9 39 | push r10 40 | push r11 41 | push r12 42 | push r13 43 | push r14 44 | push r15 45 | mov.w &_usCriticalNesting, r14 46 | push r14 47 | mov.w &_pxCurrentTCB, r12 48 | mov.w r1, @r12 49 | endm 50 | /*-----------------------------------------------------------*/ 51 | 52 | portRESTORE_CONTEXT macro 53 | mov.w &_pxCurrentTCB, r12 54 | mov.w @r12, r1 55 | pop r15 56 | mov.w r15, &_usCriticalNesting 57 | pop r15 58 | pop r14 59 | pop r13 60 | pop r12 61 | pop r11 62 | pop r10 63 | pop r9 64 | pop r8 65 | pop r7 66 | pop r6 67 | pop r5 68 | pop r4 69 | 70 | /* The last thing on the stack will be the status register. 71 | Ensure the power down bits are clear ready for the next 72 | time this power down register is popped from the stack. */ 73 | bic.w #0xf0,0(SP) 74 | 75 | reti 76 | endm 77 | /*-----------------------------------------------------------*/ 78 | 79 | #endif 80 | 81 | -------------------------------------------------------------------------------- /port/ucontroller/nxp/lpc17xx/lpcopen/inc/cmsis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @brief LPC17xx/40xx selective CMSIS inclusion file 3 | * 4 | * @note 5 | * Copyright(C) NXP Semiconductors, 2014 6 | * All rights reserved. 7 | * 8 | * @par 9 | * Software that is described herein is for illustrative purposes only 10 | * which provides customers with programming information regarding the 11 | * LPC products. This software is supplied "AS IS" without any warranties of 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and 13 | * all warranties, express or implied, including all implied warranties of 14 | * merchantability, fitness for a particular purpose and non-infringement of 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility 16 | * or liability for the use of the software, conveys no license or rights under any 17 | * patent, copyright, mask work right, or any other intellectual property rights in 18 | * or to any products. NXP Semiconductors reserves the right to make changes 19 | * in the software without notification. NXP Semiconductors also makes no 20 | * representation or warranty that such application will be suitable for the 21 | * specified use without further testing or modification. 22 | * 23 | * @par 24 | * Permission to use, copy, modify, and distribute this software and its 25 | * documentation is hereby granted, under NXP Semiconductors' and its 26 | * licensor's relevant copyrights in the software, without fee, provided that it 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This 28 | * copyright, permission, and disclaimer notice must appear in all copies of 29 | * this code. 30 | */ 31 | 32 | #ifndef __CMSIS_H_ 33 | #define __CMSIS_H_ 34 | 35 | #include "lpc_types.h" 36 | #include "sys_config.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Select correct CMSIS include file based on CHIP_* definition */ 43 | #if defined(CHIP_LPC175X_6X) 44 | #include "cmsis_175x_6x.h" 45 | typedef LPC175X_6X_IRQn_Type IRQn_Type; 46 | #include "core_cm3.h" /*!< Cortex-M3 processor and core peripherals */ 47 | 48 | #elif defined(CHIP_LPC177X_8X) 49 | #include "cmsis_177x_8x.h" 50 | typedef LPC177X_8X_IRQn_Type IRQn_Type; 51 | #include "core_cm3.h" /*!< Cortex-M3 processor and core peripherals */ 52 | 53 | #elif defined(CHIP_LPC40XX) 54 | #include "cmsis_40xx.h" 55 | typedef LPC40XX_IRQn_Type IRQn_Type; 56 | #include "core_cm4.h" /*!< Cortex-M4 processor and core peripherals */ 57 | 58 | #else 59 | #error "No CHIP_* definition is defined" 60 | #endif 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* __CMSIS_H_ */ 67 | --------------------------------------------------------------------------------