kopia lustrzana https://github.com/OpenRTX/OpenRTX
Made hwInfo struct const and statically initialized where dynamic loading is not needed.
Changed the hwInfo variable to static const in all the platformw where the information are not loaded from NVM. Doing so puts the variable in .rodata section and spares a tiny amount of RAM and FLASH.pull/147/head
rodzic
ec62bda31a
commit
933d291154
|
@ -32,9 +32,19 @@
|
|||
|
||||
/* Mutex for concurrent access to ADC0 */
|
||||
pthread_mutex_t adc_mutex;
|
||||
|
||||
gdxCalibration_t calibration;
|
||||
hwInfo_t hwInfo;
|
||||
|
||||
static const hwInfo_t hwInfo =
|
||||
{
|
||||
.vhf_maxFreq = 174,
|
||||
.vhf_minFreq = 136,
|
||||
.vhf_band = 1,
|
||||
.uhf_maxFreq = 470,
|
||||
.uhf_minFreq = 400,
|
||||
.uhf_band = 1,
|
||||
.hw_version = 0,
|
||||
.name = "DM-1801"
|
||||
};
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -69,17 +79,6 @@ void platform_init()
|
|||
*/
|
||||
nvm_init();
|
||||
memset(&calibration, 0x00, sizeof(gdxCalibration_t));
|
||||
|
||||
/* Initialise hardware information structure */
|
||||
hwInfo.vhf_maxFreq = 174;
|
||||
hwInfo.vhf_minFreq = 136;
|
||||
hwInfo.vhf_band = 1;
|
||||
hwInfo.uhf_maxFreq = 470;
|
||||
hwInfo.uhf_minFreq = 400;
|
||||
hwInfo.uhf_band = 1;
|
||||
hwInfo.hw_version = 0;
|
||||
memcpy(hwInfo.name, "DM-1801", 7);
|
||||
hwInfo.name[7] = '\0';
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
|
|
@ -33,7 +33,18 @@
|
|||
pthread_mutex_t adc_mutex;
|
||||
|
||||
gdxCalibration_t calibration;
|
||||
hwInfo_t hwInfo;
|
||||
|
||||
static const hwInfo_t hwInfo =
|
||||
{
|
||||
.vhf_maxFreq = 174,
|
||||
.vhf_minFreq = 136,
|
||||
.vhf_band = 1,
|
||||
.uhf_maxFreq = 470,
|
||||
.uhf_minFreq = 400,
|
||||
.uhf_band = 1,
|
||||
.hw_version = 0,
|
||||
.name = "GD-77"
|
||||
};
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -68,17 +79,6 @@ void platform_init()
|
|||
*/
|
||||
nvm_init();
|
||||
memset(&calibration, 0x00, sizeof(gdxCalibration_t));
|
||||
|
||||
/* Initialise hardware information structure */
|
||||
hwInfo.vhf_maxFreq = 174;
|
||||
hwInfo.vhf_minFreq = 136;
|
||||
hwInfo.vhf_band = 1;
|
||||
hwInfo.uhf_maxFreq = 470;
|
||||
hwInfo.uhf_minFreq = 400;
|
||||
hwInfo.uhf_band = 1;
|
||||
hwInfo.hw_version = 0;
|
||||
memcpy(hwInfo.name, "GD-77", 5);
|
||||
hwInfo.name[5] = '\0';
|
||||
}
|
||||
|
||||
void platform_terminate()
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <interfaces/audio.h>
|
||||
|
||||
md3x0Calib_t calibration;
|
||||
hwInfo_t hwInfo;
|
||||
static hwInfo_t hwInfo;
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
|
|
@ -33,7 +33,18 @@
|
|||
#include <SPI2.h>
|
||||
#include <chSelector.h>
|
||||
|
||||
hwInfo_t hwInfo;
|
||||
/* TODO: Hardcoded hwInfo until we implement reading from flash */
|
||||
static const hwInfo_t hwInfo
|
||||
{
|
||||
.vhf_maxFreq = 174,
|
||||
.vhf_minFreq = 136,
|
||||
.vhf_band = 1,
|
||||
.uhf_maxFreq = 480,
|
||||
.uhf_minFreq = 400,
|
||||
.uhf_band = 1,
|
||||
.hw_version = 0,
|
||||
.name = "MD-9600"
|
||||
}
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -62,18 +73,6 @@ void platform_init()
|
|||
|
||||
spi2_init();
|
||||
|
||||
/* TODO: Hardcode hwInfo until we implement reading from flash */
|
||||
memset(&hwInfo, 0x00, sizeof(hwInfo));
|
||||
hwInfo.vhf_maxFreq = 174;
|
||||
hwInfo.vhf_minFreq = 136;
|
||||
hwInfo.vhf_band = 1;
|
||||
hwInfo.uhf_maxFreq = 480;
|
||||
hwInfo.uhf_minFreq = 400;
|
||||
hwInfo.uhf_band = 1;
|
||||
hwInfo.hw_version = 0;
|
||||
memcpy(hwInfo.name, "MD-9600", 7);
|
||||
hwInfo.name[8] = '\0';
|
||||
|
||||
nvm_init(); /* Initialise non volatile memory manager */
|
||||
toneGen_init(); /* Initialise tone generator */
|
||||
rtc_init(); /* Initialise RTC */
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
mduv3x0Calib_t calibration;
|
||||
hwInfo_t hwInfo;
|
||||
static hwInfo_t hwInfo;
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
|
|
@ -33,7 +33,17 @@
|
|||
#include <MCP4551.h>
|
||||
|
||||
mod17Calib_t mod17CalData;
|
||||
static hwInfo_t hwInfo;
|
||||
static hwInfo_t hwInfo =
|
||||
{
|
||||
.vhf_maxFreq = 0,
|
||||
.vhf_minFreq = 0,
|
||||
.vhf_band = 0,
|
||||
.uhf_maxFreq = 0,
|
||||
.uhf_minFreq = 0,
|
||||
.uhf_band = 0,
|
||||
.hw_version = 0,
|
||||
.name = "Module17"
|
||||
};
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
|
@ -69,10 +79,6 @@ void platform_init()
|
|||
mod17CalData.rx_invert = 0;
|
||||
mod17CalData.mic_gain = 0;
|
||||
|
||||
/* Init hardware info data. */
|
||||
memset(&hwInfo, 0x00, sizeof(hwInfo));
|
||||
memcpy(hwInfo.name, "Module17", 8);
|
||||
|
||||
/*
|
||||
* Hardware version is set using a voltage divider on PA3.
|
||||
* - 0V: rev. 0.1d or lower
|
||||
|
|
|
@ -25,24 +25,21 @@
|
|||
/* Custom SDL Event to adjust backlight */
|
||||
extern Uint32 SDL_Backlight_Event;
|
||||
|
||||
hwInfo_t hwInfo;
|
||||
static const hwInfo_t hwInfo =
|
||||
{
|
||||
.vhf_maxFreq = 174,
|
||||
.vhf_minFreq = 136,
|
||||
.vhf_band = 1,
|
||||
.uhf_maxFreq = 480,
|
||||
.uhf_minFreq = 400,
|
||||
.uhf_band = 1,
|
||||
.name = "Linux"
|
||||
};
|
||||
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
nvm_init();
|
||||
|
||||
// Fill hwinfo struct
|
||||
memset(&hwInfo, 0x00, sizeof(hwInfo));
|
||||
snprintf(hwInfo.name, 10, "Linux");
|
||||
|
||||
// Frequencies are in MHz
|
||||
hwInfo.vhf_maxFreq = 174;
|
||||
hwInfo.vhf_minFreq = 136;
|
||||
hwInfo.vhf_band = 1;
|
||||
hwInfo.uhf_maxFreq = 480;
|
||||
hwInfo.uhf_minFreq = 400;
|
||||
hwInfo.uhf_band = 1;
|
||||
|
||||
emulator_start();
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue