M74.9: add placeholer for future port (#4924)

This commit is contained in:
Andrey G 2023-01-01 18:51:22 +03:00 committed by GitHub
parent e643515357
commit a3fb51f17e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 154 additions and 0 deletions

View File

@ -0,0 +1,11 @@
/**
* @file boards/m74_9/board.c
*
* @date Jan 01, 2023
* @author Andrey Gusakov, 2023
*/
/* this is empty file. Keep it to avoid using board.c file from $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY
* that is added to build by ports/stm32/stm32f4/hw_ports.m
* as we need our own boardInit()
* boardInit() is defined in board_configuration.cpp */

View File

@ -0,0 +1,15 @@
# List of all the board related files.
BOARDCPPSRC = $(PROJECT_DIR)/config/boards/m74_9/board_configuration.cpp
BOARDINC = $(PROJECT_DIR)/config/boards/m74_9
DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::G14
# This is an F429!
IS_STM32F429 = yes
# This board has no storage
DDEFS += -DEFI_FILE_LOGGING=FALSE
USE_FATFS = no
DDEFS += -DFIRMWARE_ID=\"m74_9\"
DDEFS += -DDEFAULT_ENGINE_TYPE=MINIMAL_PINS

View File

@ -0,0 +1,87 @@
#include "pch.h"
#include "smart_gpio.h"
#include "drivers/gpio/l9779.h"
void setBoardConfigOverrides() {
// PB14 is error LED, configured in board.mk
// blue, LD2
engineConfiguration->communicationLedPin = Gpio::B7;
// green, LD1
engineConfiguration->runningLedPin = Gpio::B0;
// Board only has 3 LEDs
engineConfiguration->warningLedPin = Gpio::Unassigned;
}
void preHalInit() {
// leftovers from Nucleo board...
efiSetPadMode("Ethernet", Gpio::A1, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::A2, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::A7, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::B13, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::C1, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::C4, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::C5, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::G11, PAL_MODE_ALTERNATE(0xb));
efiSetPadMode("Ethernet", Gpio::G13, PAL_MODE_ALTERNATE(0xb));
}
static struct l9779_config l9779_cfg = {
.spi_bus = &SPID1,
.spi_config = {
.circular = false,
.end_cb = NULL,
.ssport = NULL,
.sspad = 0,
.cr1 =
SPI_CR1_16BIT_MODE |
SPI_CR1_SSM |
SPI_CR1_SSI |
SPI_CR1_LSBFIRST | //LSB first
((3 << SPI_CR1_BR_Pos) & SPI_CR1_BR) | // div = 16
SPI_CR1_MSTR |
SPI_CR1_CPHA |
0,
.cr2 = SPI_CR2_16BIT_MODE
},
.direct_gpio = {
/* ignition pre-dirvers */
[0] = {.port = NULL, .pad = 0},
[1] = {.port = NULL, .pad = 0},
[2] = {.port = NULL, .pad = 0},
[3] = {.port = NULL, .pad = 0},
/* IN1 .. IN7 */
[4] = {.port = NULL, .pad = 0},
[5] = {.port = NULL, .pad = 0},
[6] = {.port = NULL, .pad = 0},
[7] = {.port = NULL, .pad = 0},
[8] = {.port = NULL, .pad = 0},
[9] = {.port = NULL, .pad = 0},
[10] = {.port = NULL, .pad = 0},
},
/* PWM signal */
.pwm_gpio = {.port = NULL, .pad = 0}
};
static void board_init_ext_gpios()
{
int ret;
ret = l9779_add(Gpio::L9779_IGN_1, 0, &l9779_cfg);
if (ret < 0) {
/* error */
}
}
/**
* @brief Board-specific initialization code.
* @todo Add your board-specific code, if any.
*/
void boardInit(void)
{
board_init_ext_gpios();
}

View File

@ -0,0 +1,8 @@
#!/bin/bash
# STM32F4...
SCRIPT_NAME="compile_m74_9.sh"
echo "Entering $SCRIPT_NAME"
bash ../common_make.sh m74_9 ARCH_STM32F4

View File

@ -0,0 +1,14 @@
/**
* @file boards/m74_9/efifeatures.h
*
* @brief In this header we can override efifeatures.h.
*
* @date Jan 01, 2023
* @author Andrey Gusakov, 2023
*/
/* Override some settings */
#define HAL_USE_MMC_SPI FALSE
#define EFI_FILE_LOGGING FALSE
#include "../../stm32f4ems/efifeatures.h"

View File

@ -0,0 +1,19 @@
/**
* @file boards/m74_9/halconf.h
*
* @brief In this header we can override halconf.h.
*
* @date Jan 01, 2023
* @author Andrey Gusakov, 2023
*/
#ifndef _HALCONF_M74_9_H_
#define _HALCONF_M74_9_H_
#define HAL_USE_SDC FALSE
#define HAL_USE_MMC_SPI FALSE
#include "../../../hw_layer/ports/stm32/stm32f4/cfg/halconf.h"
#endif /* _HALCONF_M74_9_H_ */