mirror of https://github.com/g4klx/MMDVM.git
Add UDID support.
This commit is contained in:
parent
81518bf74c
commit
99d2a0d822
4
IO.h
4
IO.h
|
@ -58,6 +58,10 @@ public:
|
|||
void resetWatchdog();
|
||||
uint32_t getWatchdog();
|
||||
|
||||
uint8_t getCPU() const;
|
||||
|
||||
void getUDID(uint8_t* buffer);
|
||||
|
||||
void selfTest();
|
||||
|
||||
private:
|
||||
|
|
20
IODue.cpp
20
IODue.cpp
|
@ -291,4 +291,24 @@ void CIO::delayInt(unsigned int dly)
|
|||
delay(dly);
|
||||
}
|
||||
|
||||
uint8_t CIO::getCPU() const
|
||||
{
|
||||
return 0U;
|
||||
}
|
||||
|
||||
// Code taken from https://github.com/emagii/at91sam3s/blob/master/examples/eefc_uniqueid/main.c
|
||||
void CIO::getUDID(uint8_t* buffer)
|
||||
{
|
||||
EFC->EEFC_FCR = (0x5A << 24) | EFC_FCMD_STUI;
|
||||
|
||||
::memcpy(buffer, (void *)IFLASH_ADDR, 16U);
|
||||
|
||||
EFC->EEFC_FCR = (0x5A << 24) | EFC_FCMD_SPUI;
|
||||
|
||||
do {
|
||||
status = EFC->EEFC_FSR ;
|
||||
} while ((status & EEFC_FSR_FRDY) != EEFC_FSR_FRDY);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
17
IOSTM.cpp
17
IOSTM.cpp
|
@ -545,4 +545,21 @@ void CIO::delayInt(unsigned int dly)
|
|||
}
|
||||
}
|
||||
|
||||
uint8_t CIO::getCPU() const
|
||||
{
|
||||
return 2U;
|
||||
}
|
||||
|
||||
void CIO::getUDID(uint8_t* buffer)
|
||||
{
|
||||
#if defined(STM32F4XX)
|
||||
::memcpy(buffer, (void *)0x1FFF7A10, 12U);
|
||||
#elif defined(STM32F722xx)
|
||||
::memcpy(buffer, (void *)0x1FF07A10, 12U);
|
||||
#elif defined(STM32F767xx)
|
||||
::memcpy(buffer, (void *)0x1FF0F420, 12U);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "Globals.h"
|
||||
#include "IO.h"
|
||||
|
||||
|
||||
#if defined(STM32F1)
|
||||
|
||||
#if defined(STM32F1_POG)
|
||||
|
@ -485,4 +484,17 @@ void CIO::delayInt(unsigned int dly)
|
|||
delay(dly);
|
||||
}
|
||||
|
||||
uint8_t CIO::getCPU() const
|
||||
{
|
||||
return 2U;
|
||||
}
|
||||
|
||||
void CIO::getUDID(uint8_t* buffer)
|
||||
{
|
||||
#if defined(STM32F105xC)
|
||||
::memcpy(buffer, (void *)0x1FFFF7E8, 12U);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
11
IOTeensy.cpp
11
IOTeensy.cpp
|
@ -275,4 +275,15 @@ void CIO::delayInt(unsigned int dly)
|
|||
delay(dly);
|
||||
}
|
||||
|
||||
uint8_t CIO::getCPU() const
|
||||
{
|
||||
return 1U;
|
||||
}
|
||||
|
||||
void CIO::getUDID(uint8_t* buffer)
|
||||
{
|
||||
::memcpy(buffer, (void *)0x4058, 16U);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ const uint8_t MMDVM_DEBUG5 = 0xF5U;
|
|||
#define HW_TYPE "MMDVM"
|
||||
#endif
|
||||
|
||||
#define DESCRIPTION "20201108 (D-Star/DMR/System Fusion/P25/NXDN/M17/POCSAG/FM/AX.25)"
|
||||
#define DESCRIPTION "20201109 (D-Star/DMR/System Fusion/P25/NXDN/M17/POCSAG/FM/AX.25)"
|
||||
|
||||
#if defined(GITVERSION)
|
||||
#define concat(h, a, b, c) h " " a " " b " GitID #" c ""
|
||||
|
@ -290,7 +290,7 @@ void CSerialPort::getStatus()
|
|||
|
||||
void CSerialPort::getVersion()
|
||||
{
|
||||
uint8_t reply[150U];
|
||||
uint8_t reply[200U];
|
||||
|
||||
reply[0U] = MMDVM_FRAME_START;
|
||||
reply[1U] = 0U;
|
||||
|
@ -298,7 +298,13 @@ void CSerialPort::getVersion()
|
|||
|
||||
reply[3U] = PROTOCOL_VERSION;
|
||||
|
||||
uint8_t count = 4U;
|
||||
reply[4U] = io.getCPU();
|
||||
|
||||
// Reserve 16 bytes for the UDID
|
||||
::memcpy(reply + 5U, 0x00U, 16U);
|
||||
io.getUDID(reply + 5U);
|
||||
|
||||
uint8_t count = 21U;
|
||||
for (uint8_t i = 0U; HARDWARE[i] != 0x00U; i++, count++)
|
||||
reply[count] = HARDWARE[i];
|
||||
|
||||
|
|
Loading…
Reference in New Issue