rename common_area typedef and global

This commit is contained in:
Philippe Teuwen 2021-08-21 23:23:54 +02:00
commit d56d8f0f65
5 changed files with 38 additions and 38 deletions

View file

@ -71,7 +71,7 @@ int g_dbglevel = DBG_ERROR;
uint8_t g_trigger = 0;
bool g_hf_field_active = false;
extern uint32_t _stack_start[], _stack_end[];
struct common_area common_area __attribute__((section(".commonarea")));
common_area_t g_common_area __attribute__((section(".commonarea")));
static int button_status = BUTTON_NO_CLICK;
static bool allow_send_wtx = false;
uint16_t g_tearoff_delay_us = 0;
@ -303,7 +303,7 @@ static void SendVersion(void) {
#ifndef WITH_NO_COMPRESSION
// Send Chip ID and used flash memory
uint32_t text_and_rodata_section_size = (uint32_t)__data_src_start__ - (uint32_t)_flash_start;
uint32_t compressed_data_section_size = common_area.arg1;
uint32_t compressed_data_section_size = g_common_area.arg1;
#endif
struct p {
@ -2413,8 +2413,8 @@ static void PacketReceived(PacketCommandNG *packet) {
break;
}
case CMD_START_FLASH: {
if (common_area.flags.bootrom_present) {
common_area.command = COMMON_AREA_COMMAND_ENTER_FLASH_MODE;
if (g_common_area.flags.bootrom_present) {
g_common_area.command = COMMON_AREA_COMMAND_ENTER_FLASH_MODE;
}
usb_disable();
AT91C_BASE_RSTC->RSTC_RCR = RST_CONTROL_KEY | AT91C_RSTC_PROCRST;
@ -2424,7 +2424,7 @@ static void PacketReceived(PacketCommandNG *packet) {
}
case CMD_DEVICE_INFO: {
uint32_t dev_info = DEVICE_INFO_FLAG_OSIMAGE_PRESENT | DEVICE_INFO_FLAG_CURRENT_MODE_OS;
if (common_area.flags.bootrom_present) {
if (g_common_area.flags.bootrom_present) {
dev_info |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;
}
reply_old(CMD_DEVICE_INFO, dev_info, 0, 0, 0, 0);

View file

@ -20,7 +20,7 @@
#include "BigBuf.h"
#include "string.h"
extern struct common_area common_area;
extern common_area_t g_common_area;
extern uint32_t __data_src_start__[], __data_start__[], __data_end__[], __bss_start__[], __bss_end__[];
#ifndef WITH_NO_COMPRESSION
@ -35,7 +35,7 @@ static void uncompress_data_section(void) {
if (res < 0)
return;
// save the size of the compressed data section
common_area.arg1 = avail_in;
g_common_area.arg1 = avail_in;
}
#endif
@ -43,13 +43,13 @@ void __attribute__((section(".startos"))) Vector(void);
void Vector(void) {
/* Stack should have been set up by the bootloader */
if (common_area.magic != COMMON_AREA_MAGIC || common_area.version != 1) {
if (g_common_area.magic != COMMON_AREA_MAGIC || g_common_area.version != 1) {
/* Initialize common area */
memset(&common_area, 0, sizeof(common_area));
common_area.magic = COMMON_AREA_MAGIC;
common_area.version = 1;
memset(&g_common_area, 0, sizeof(g_common_area));
g_common_area.magic = COMMON_AREA_MAGIC;
g_common_area.version = 1;
}
common_area.flags.osimage_present = 1;
g_common_area.flags.osimage_present = 1;
/* Set up data segment: Copy from flash to ram */
#ifdef WITH_NO_COMPRESSION