diff --git a/platform/targets/DM-1801/platform.c b/platform/targets/DM-1801/platform.c index 86a36f22..89ddd9b0 100644 --- a/platform/targets/DM-1801/platform.c +++ b/platform/targets/DM-1801/platform.c @@ -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() diff --git a/platform/targets/GD-77/platform.c b/platform/targets/GD-77/platform.c index 9da28449..04e5ecdc 100644 --- a/platform/targets/GD-77/platform.c +++ b/platform/targets/GD-77/platform.c @@ -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() diff --git a/platform/targets/MD-3x0/platform.c b/platform/targets/MD-3x0/platform.c index 1b936a95..98501ff5 100644 --- a/platform/targets/MD-3x0/platform.c +++ b/platform/targets/MD-3x0/platform.c @@ -30,7 +30,7 @@ #include md3x0Calib_t calibration; -hwInfo_t hwInfo; +static hwInfo_t hwInfo; void platform_init() { diff --git a/platform/targets/MD-9600/platform.c b/platform/targets/MD-9600/platform.c index 8d7b0645..7ace6a37 100644 --- a/platform/targets/MD-9600/platform.c +++ b/platform/targets/MD-9600/platform.c @@ -33,7 +33,18 @@ #include #include -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 */ diff --git a/platform/targets/MD-UV3x0/platform.c b/platform/targets/MD-UV3x0/platform.c index e4986d40..9a9f6cc5 100644 --- a/platform/targets/MD-UV3x0/platform.c +++ b/platform/targets/MD-UV3x0/platform.c @@ -34,7 +34,7 @@ #endif mduv3x0Calib_t calibration; -hwInfo_t hwInfo; +static hwInfo_t hwInfo; void platform_init() { diff --git a/platform/targets/Module17/platform.c b/platform/targets/Module17/platform.c index c9f4ddf0..e163e512 100644 --- a/platform/targets/Module17/platform.c +++ b/platform/targets/Module17/platform.c @@ -33,7 +33,17 @@ #include 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 diff --git a/platform/targets/linux/platform.c b/platform/targets/linux/platform.c index 69ecad0d..03ac81d9 100644 --- a/platform/targets/linux/platform.c +++ b/platform/targets/linux/platform.c @@ -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(); }