/usr/bin/avos:SysInfo GetProductName()

From ArchosDocs

Jump to: navigation, search

Description

Returns the product name stored in flash memory at offset 0x10000.

The Code

char ProductName[16];
 
int SysInfo_GetProductName()
{
char *ret; // -0x18
struct {
int addr; // -0x10
int size; // -0x0C
int buf; // -0x08
} argp;
 
if(is_ProductName_Loaded)
ret = ProductName;
else {
argp.addr = 0x10000;
argp.buf = &ProductName;
argp.size = 16;
 
if(FLASH_Init() == 0 && FLASH_Read(&argp) == 0) {
FLASH_Exit();
ProductName[15] = 0;
is_ProductName_Loaded = 1;
ret = ProductName;
}
else {
FLASH_Exit();
ret = "a004"; // default product name
}
}
return ret;
}
Personal tools