[Add] 新增 F5Plus、Raspi4B支持

This commit is contained in:
yegaogang
2024-07-09 11:43:22 +08:00
parent 042721aab5
commit d7699d7e9a
4 changed files with 88 additions and 15 deletions

View File

@ -10,7 +10,7 @@
/* terms, then you may not retain, install, activate or otherwise use the */ /* terms, then you may not retain, install, activate or otherwise use the */
/* software. */ /* software. */
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/** \file /** \file
* Generic phDriver Component of Reader Library Framework. * Generic phDriver Component of Reader Library Framework.
* $Author$ * $Author$
@ -18,16 +18,19 @@
* $Date$ * $Date$
* *
*/ */
#ifndef BOARD_PIPN5180_H #ifndef BOARD_PIPN5180_H
#define BOARD_PIPN5180_H #define BOARD_PIPN5180_H
/******************************************************************* /*******************************************************************
* Enable User/Kernel space SPI. * Enable User/Kernel space SPI.
******************************************************************/ ******************************************************************/
/*#define PHDRIVER_LINUX_USER_SPI*/ # ifdef NXPBUILD__PHBAL_REG_LINUX_USER_SPI
#define PHDRIVER_LINUX_KERNEL_SPI #define PHDRIVER_LINUX_USER_SPI
# else
#define PHDRIVER_LINUX_KERNEL_SPI
#endif /* NXPBUILD__PHBAL_REG_LINUX_USER_SPI */
/****************************************************************** /******************************************************************
* Board Pin/Gpio configurations * Board Pin/Gpio configurations
******************************************************************/ ******************************************************************/
@ -35,7 +38,7 @@
#define PHDRIVER_PIN_IRQ 23 /**< "/sys/class/gpio/gpio23/" */ #define PHDRIVER_PIN_IRQ 23 /**< "/sys/class/gpio/gpio23/" */
#define PHDRIVER_PIN_BUSY 25 /**< "/sys/class/gpio/gpio25/" */ #define PHDRIVER_PIN_BUSY 25 /**< "/sys/class/gpio/gpio25/" */
#define PHDRIVER_PIN_DWL 18 /**< "/sys/class/gpio/gpio18/" */ #define PHDRIVER_PIN_DWL 18 /**< "/sys/class/gpio/gpio18/" */
/****************************************************************** /******************************************************************
* PIN Pull-Up/Pull-Down configurations. * PIN Pull-Up/Pull-Down configurations.
******************************************************************/ ******************************************************************/
@ -43,13 +46,13 @@
#define PHDRIVER_PIN_IRQ_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_IRQ_PULL_CFG PH_DRIVER_PULL_UP
#define PHDRIVER_PIN_BUSY_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_BUSY_PULL_CFG PH_DRIVER_PULL_UP
#define PHDRIVER_PIN_DWL_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_DWL_PULL_CFG PH_DRIVER_PULL_UP
/****************************************************************** /******************************************************************
* IRQ & BUSY PIN TRIGGER settings * IRQ & BUSY PIN TRIGGER settings
******************************************************************/ ******************************************************************/
#define PIN_IRQ_TRIGGER_TYPE PH_DRIVER_INTERRUPT_RISINGEDGE #define PIN_IRQ_TRIGGER_TYPE PH_DRIVER_INTERRUPT_RISINGEDGE
#define PIN_BUSY_TRIGGER_TYPE PH_DRIVER_INTERRUPT_FALLINGEDGE #define PIN_BUSY_TRIGGER_TYPE PH_DRIVER_INTERRUPT_FALLINGEDGE
/***************************************************************** /*****************************************************************
* Front End Reset logic level settings * Front End Reset logic level settings
****************************************************************/ ****************************************************************/
@ -57,7 +60,7 @@
#define PH_DRIVER_SET_LOW 0 /**< Logic Low. */ #define PH_DRIVER_SET_LOW 0 /**< Logic Low. */
#define RESET_POWERDOWN_LEVEL PH_DRIVER_SET_LOW #define RESET_POWERDOWN_LEVEL PH_DRIVER_SET_LOW
#define RESET_POWERUP_LEVEL PH_DRIVER_SET_HIGH #define RESET_POWERUP_LEVEL PH_DRIVER_SET_HIGH
/***************************************************************** /*****************************************************************
* SPI Configuration * SPI Configuration
****************************************************************/ ****************************************************************/
@ -69,25 +72,25 @@
# define PHDRIVER_USER_SPI_CFG_MODE SPI_MODE_0 # define PHDRIVER_USER_SPI_CFG_MODE SPI_MODE_0
# define PHDRIVER_USER_SPI_CFG_BITS_PER_WORD 8 # define PHDRIVER_USER_SPI_CFG_BITS_PER_WORD 8
#endif #endif
#ifdef PHDRIVER_LINUX_KERNEL_SPI #ifdef PHDRIVER_LINUX_KERNEL_SPI
# define PHDRIVER_KERNEL_SPI_ID 0x11U /**< ID for Linux Kernel Spi BAL component */ # define PHDRIVER_KERNEL_SPI_ID 0x11U /**< ID for Linux Kernel Spi BAL component */
# define PHDRIVER_KERNEL_SPI_CFG_DIR "/dev/bal" # define PHDRIVER_KERNEL_SPI_CFG_DIR "/dev/bal"
#endif #endif
/***************************************************************** /*****************************************************************
* Dummy entries * Dummy entries
* No functionality. To suppress build error in HAL. No pin functionality in SPI Linux BAL. * No functionality. To suppress build error in HAL. No pin functionality in SPI Linux BAL.
*****************************************************************/ *****************************************************************/
#define PHDRIVER_PIN_SSEL 0xFFFF #define PHDRIVER_PIN_SSEL 0xFFFF
#define PHDRIVER_PIN_NSS_PULL_CFG PH_DRIVER_PULL_UP #define PHDRIVER_PIN_NSS_PULL_CFG PH_DRIVER_PULL_UP
/***************************************************************** /*****************************************************************
* STATUS LED Configuration * STATUS LED Configuration
****************************************************************/ ****************************************************************/
#define PHDRIVER_LED_SUCCESS_DELAY 2 #define PHDRIVER_LED_SUCCESS_DELAY 2
#define PHDRIVER_LED_FAILURE_DELAY_MS 250 #define PHDRIVER_LED_FAILURE_DELAY_MS 250
#define PHDRIVER_LED_FAILURE_FLICKER 4 #define PHDRIVER_LED_FAILURE_FLICKER 4
#endif /* BOARD_PIPN5180_H */ #endif /* BOARD_PIPN5180_H */

View File

@ -0,0 +1,14 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(tools /opt/f5plus/aarch64-ca53-linux-gnueabihf-10.4.0)
set(CMAKE_C_COMPILER ${tools}/bin/aarch64-ca53-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/aarch64-ca53-linux-gnu-g++)
set(CMAKE_SYSROOT ${tools}/aarch64-ca53-linux-gnu/sysroot)
#set(CMAKE_STAGING_PREFIX ${HOME}/recycle/stage)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

View File

@ -0,0 +1,15 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(tools ${HOME}/recycle/gcc-4.7-linaro-rpi-gnueabihf)
set(CMAKE_SYSROOT ${HOME}/recycle/rasp-pi-rootfs)
set(CMAKE_STAGING_PREFIX ${HOME}/recycle/stage)
set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

41
ReadMe.md Normal file
View File

@ -0,0 +1,41 @@
## 编译
```shell
mkdir -p output && cd output/
# Cmake 生成 Makefile
cmake ../
# 编译
make all
```
## 环境
### 支持VScode下clang跳转
```shell
mkdir -p output && cd output/
# Cmake 生成 Makefile
cmake ../ -DCMAKE_EXPORT_COMPILE_COMMANDS=True
# 编译
make all
```
## 项目示例
### F5Plus + PN5180
```shell
cmake -DBUS_SPIUserMode=ON -DFRONTEND_PN5180=ON -DFRONTEND_PN5190=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=True --toolchain ../Platform/F5Plus/F5Plus-Toolchain.cmake ../
```
### Raspi4B + PN5180
```shell
cmake -DBUS_SPIUserMode=ON -DFRONTEND_PN5180=ON -DFRONTEND_PN5190=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=True --toolchain ../Platform/Raspi4B/F5Plus-Toolchain.cmake ../
```