Merge branch 'master' into fix/pm5-flash-mode-bpr-hick

Signed-off-by: Iceman <iceman@iuse.se>
This commit is contained in:
Iceman authored and GitHub committed 2026-08-20 21:52:08 +07:00
commit a7c696b9a0
34 files changed
+684 -310

No files matched your search

+2 -2
View File
@@ -43,12 +43,12 @@ OBJDIR = obj
INCLUDE = -I../include -I../common_arm -I../common_fpga -I../common -I.
INCLUDE += -I../common_arm/flash_code -I../common_arm/flash_data -I../common_arm/fpga -I../common_arm/gpio
INCLUDE += -I../common_arm/rssi -I../common_arm/sys -I../common_arm/ticks -I../common_arm/usb -I../common_arm/wdt
INCLUDE += -I../common_arm/rssi -I../common_arm/rgb -I../common_arm/sys -I../common_arm/ticks -I../common_arm/usb -I../common_arm/wdt
# Also search prerequisites in the common directory (for usb.c), the fpga directory (for fpga.bit), and the lz4 directory
VPATH = . ../common_arm ../common ../common/crapto1 ../common/mbedtls ../common/lz4 ../fpga ../armsrc/Standalone ../common/hitag2
VPATH += ../common_arm/flash_code ../common_arm/flash_data ../common_arm/fpga ../common_arm/gpio
VPATH += ../common_arm/rssi ../common_arm/sys ../common_arm/ticks ../common_arm/usb ../common_arm/wdt
VPATH += ../common_arm/rssi ../common_arm/rgb ../common_arm/sys ../common_arm/ticks ../common_arm/usb ../common_arm/wdt
INCLUDES = ../include/proxmark3_arm.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/pm3_cmd.h
+6
View File
@@ -196,10 +196,16 @@ ifneq (,$(findstring FLASH,$(PLATFORM_EXTRAS_TMP)))
PLATFORM_EXTRAS_TMP := $(strip $(filter-out FLASH,$(PLATFORM_EXTRAS_TMP)))
endif
ifneq (,$(findstring BTADDON,$(PLATFORM_EXTRAS_TMP)))
ifeq ($(PLATFORM),PM5)
$(error Incompatible PLATFORM_EXTRAS token BTADDON)
endif
PLATFORM_DEFS += -DWITH_FPC_USART_HOST
PLATFORM_EXTRAS_TMP := $(strip $(filter-out BTADDON,$(PLATFORM_EXTRAS_TMP)))
endif
ifneq (,$(findstring FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
ifeq ($(PLATFORM),PM5)
$(error Incompatible PLATFORM_EXTRAS token FPC_USART_DEV)
endif
PLATFORM_DEFS += -DWITH_FPC_USART_DEV
PLATFORM_EXTRAS_TMP := $(strip $(filter-out FPC_USART_DEV,$(PLATFORM_EXTRAS_TMP)))
endif
+5
View File
@@ -374,6 +374,11 @@ int FpgaStartConfig(bool configSram, uint32_t fileLength) {
// TODO DXL: Check the file length is valid in this platform?
// if not, return the PM3_EOVFLOW
// Make sure the FPGA is clocked/powered before we drive its JTAG. Previously
// a reader command (e.g. `hf 14a read`) had to be run first to bring the FPGA
// up, otherwise `hw fpga config` had nothing to talk to. Do it here instead.
FpgaSetup24MHzClk();
// Init jtag hardware link.
gpio_fpga_download_setup();
+15
View File
@@ -0,0 +1,15 @@
#ifndef RGB_APIS_H_
#define RGB_APIS_H_
#include "common.h"
//-----------------------------------------------------------------------------
// Antenna RGB LED control.
//
// Only implemented on platforms that actually have an RGB LED (currently PM5,
// driven by an I2C RGB controller). Other platforms don't build this module, so
// callers must guard usage accordingly (e.g. the CMD_PM5_RGB_SET handler).
//-----------------------------------------------------------------------------
void RgbLedSet(uint8_t r, uint8_t g, uint8_t b);
#endif // RGB_APIS_H_
+22
View File
@@ -0,0 +1,22 @@
#include "rgb_apis.h"
#include "i2c.h" // RGB LED is driven over I2C
#include "ticks_apis.h" // I2C timing needs ticks running
// PM5 antenna RGB LED, driven by an I2C RGB controller (7-bit address 0x48).
// Register map (from the QC/bring-up code):
// 0x02 = index (which LED)
// 0x01 = count (number of LEDs on the string; must be set or nothing lights)
// 0x03 = data (3 bytes RGB888 per LED)
#define RGB_I2C_ADDR (0x48 << 1) // 8-bit address form expected by the I2C_* API
#define RGB_REG_COUNT 0x01
#define RGB_REG_INDEX 0x02
#define RGB_REG_DATA 0x03
void RgbLedSet(uint8_t r, uint8_t g, uint8_t b) {
uint8_t rgb[3] = { r, g, b };
StartTicks();
I2C_init(true);
I2C_WriteByte(0, RGB_REG_INDEX, RGB_I2C_ADDR); // address LED index 0
I2C_WriteByte(1, RGB_REG_COUNT, RGB_I2C_ADDR); // 1 LED on the string
I2C_BufferWrite(rgb, sizeof(rgb), RGB_REG_DATA, RGB_I2C_ADDR);
}
+4 -2
View File
@@ -272,10 +272,12 @@ uint16_t RAMFUNC GetLoEdgeCaptureCount(void) {
}
lo_edge_t RAMFUNC GetLoEdgeCaptureStatus(void) {
if (AT91C_BASE_TC1->TC_SR & INPUT_CAPTURE_EVT_RISING_EDGE) {
// Read Once Only: Reading TC_SR will simultaneously clear status bits such as LDRAS/LDRBS.
uint32_t sr = AT91C_BASE_TC1->TC_SR;
if (sr & INPUT_CAPTURE_EVT_RISING_EDGE) {
return LO_EDGE_RISING;
}
if (AT91C_BASE_TC1->TC_SR & INPUT_CAPTURE_EVT_FALLING_EDGE) {
if (sr & INPUT_CAPTURE_EVT_FALLING_EDGE) {
return LO_EDGE_FALLING;
}
return LO_EDGE_NO;