Please note that the environment is read-only until the monitor
has been relocated to RAM and a RAM copy of the environment has been
-created; also, when using EEPROM you will have to use getenv_r()
+created; also, when using EEPROM you will have to use getenv_f()
until then to read environment variables.
The environment is protected by a CRC32 checksum. Before the monitor
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r ("baudrate", tmp, sizeof (tmp));
+ int i = getenv_f("baudrate", tmp, sizeof (tmp));
gd->bd->bi_baudrate = gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
: CONFIG_BAUDRATE;
char tmp[64];
int i;
- i = getenv_r("baudrate", tmp, sizeof(tmp));
+ i = getenv_f("baudrate", tmp, sizeof(tmp));
if (i > 0) {
gd->baudrate = simple_strtoul(tmp, NULL, 10);
} else {
static int init_baudrate(void)
{
char baudrate[15];
- int i = getenv_r("baudrate", baudrate, sizeof(baudrate));
+ int i = getenv_f("baudrate", baudrate, sizeof(baudrate));
gd->bd->bi_baudrate = gd->baudrate = (i > 0)
? simple_strtoul(baudrate, NULL, 10)
: CONFIG_BAUDRATE;
}
for (i = 0; i < varnum; i++) {
- if (getenv_r(var[i], list, sizeof(list)) <= 0)
+ if (getenv_f(var[i], list, sizeof(list)) <= 0)
continue;
for (j = 0; j < post_list_size; j++) {
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r("baudrate", tmp, 64);
+ int i = getenv_f("baudrate", tmp, 64);
gd->baudrate = (i != 0)
? (int) simple_strtoul (tmp, NULL, 10)
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r ("baudrate", tmp, sizeof (tmp));
+ int i = getenv_f("baudrate", tmp, sizeof (tmp));
gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
/*
* reserve protected RAM
*/
- i = getenv_r ("pram", tmp, sizeof (tmp));
+ i = getenv_f("pram", tmp, sizeof (tmp));
reg = (i > 0) ? simple_strtoul (tmp, NULL, 10) : CONFIG_PRAM;
addr -= (reg << 10); /* size is in kB */
debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
* Fill in missing fields of bd_info.
* We do this here, where we have "normal" access to the
* environment; we used to do this still running from ROM,
- * where had to use getenv_r(), which can be pretty slow when
+ * where had to use getenv_f(), which can be pretty slow when
* the environment is in EEPROM.
*/
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
char tmp[64];
ulong cpuclk;
- if (getenv_r ("cpuclk", tmp, sizeof (tmp)) > 0) {
+ if (getenv_f("cpuclk", tmp, sizeof (tmp)) > 0) {
cpuclk = simple_strtoul (tmp, NULL, 10) * 1000000;
cgu_init (cpuclk);
ebu_init (cpuclk);
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r ("baudrate", tmp, sizeof (tmp));
+ int i = getenv_f("baudrate", tmp, sizeof (tmp));
gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
long cpuclk = 0;
long sccr_reg;
- if (getenv_r ("cpuclk", tmp, sizeof (tmp)) > 0)
+ if (getenv_f("cpuclk", tmp, sizeof (tmp)) > 0)
cpuclk = simple_strtoul (tmp, NULL, 10) * 1000000;
if ((CONFIG_SYS_8xx_CPUCLK_MIN > cpuclk) || (CONFIG_SYS_8xx_CPUCLK_MAX < cpuclk))
puts(str);
#if defined(DEBUG_PPC4xx_DDR_AUTOCALIBRATION)
- i = getenv_r("autocalib", tmp, sizeof(tmp));
+ i = getenv_f("autocalib", tmp, sizeof(tmp));
if (i < 0)
strcpy(tmp, CONFIG_AUTOCALIB);
static int init_baudrate (void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r ("baudrate", tmp, sizeof (tmp));
+ int i = getenv_f("baudrate", tmp, sizeof (tmp));
gd->baudrate = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
/*
* reserve protected RAM
*/
- i = getenv_r ("pram", (char *)tmp, sizeof (tmp));
+ i = getenv_f("pram", (char *)tmp, sizeof (tmp));
reg = (i > 0) ? simple_strtoul ((const char *)tmp, NULL, 10) : CONFIG_PRAM;
addr -= (reg << 10); /* size is in kB */
debug ("Reserving %ldk for protected RAM at %08lx\n", reg, addr);
* Fill in missing fields of bd_info.
* We do this here, where we have "normal" access to the
* environment; we used to do this still running from ROM,
- * where had to use getenv_r(), which can be pretty slow when
+ * where had to use getenv_f(), which can be pretty slow when
* the environment is in EEPROM.
*/
static int init_baudrate(void)
{
char tmp[64]; /* long enough for environment variables */
- int i = getenv_r("baudrate", tmp, sizeof(tmp));
+ int i = getenv_f("baudrate", tmp, sizeof(tmp));
gd->baudrate = (i > 0)
? (int)simple_strtoul(tmp, NULL, 10)
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
{
char tmp[64];
char *s, *e;
- int i = getenv_r("serial", tmp, sizeof(tmp));
+ int i = getenv_f("serial", tmp, sizeof(tmp));
if (i < 0) {
printf("Avnet Virtex4 FX12 with no serial #");
uint *pend = (uint *) L1_MEMSIZE;
uint *p;
- if (getenv_r("booted",NULL,0) <= 0)
+ if (getenv_f("booted",NULL,0) <= 0)
{
printf ("testdram..");
/*AA*/
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int index;
int len;
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
const unsigned char *fpga;
puts ("Board: ");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int index;
int len;
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
puts ("Board: ");
- if (getenv_r("serial#", str, sizeof(str)) == -1) {
+ if (getenv_f("serial#", str, sizeof(str)) == -1) {
puts ("### No HW ID - assuming CMS700");
} else {
puts(str);
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int len;
#endif
char str[64];
- int i = getenv_r("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
unsigned short ver;
puts("Board: ");
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
int index;
int len;
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
int index;
int len;
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
int fpga;
unsigned short val;
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
unsigned char trans[16] = {0x0,0x8,0x4,0xc,0x2,0xa,0x6,0xe,
0x1,0x9,0x5,0xd,0x3,0xb,0x7,0xf};
unsigned char id1, id2, rev;
int index;
int len;
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
puts("Board: DU440");
- if (getenv_r("serial#", serno, sizeof(serno)) > 0) {
+ if (getenv_f("serial#", serno, sizeof(serno)) > 0) {
puts(", serial# ");
puts(serno);
}
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
puts(str);
}
- if (getenv_r("bd_type", str, sizeof(str)) != -1) {
+ if (getenv_f("bd_type", str, sizeof(str)) != -1) {
printf(" (%s", str);
} else {
puts(" (Missing bd_type!");
{
char str[64];
char str2[64];
- int i = getenv_r("serial#", str2, sizeof(str));
+ int i = getenv_f("serial#", str2, sizeof(str));
if (line_number == 1) {
sprintf(str, " Board: ");
strcat(str, str2);
}
- if (getenv_r("bd_type", str2, sizeof(str2)) != -1) {
+ if (getenv_f("bd_type", str2, sizeof(str2)) != -1) {
strcat(str, " (");
strcat(str, str2);
} else {
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
puts(str);
}
- if (getenv_r("bd_type", str, sizeof(str)) != -1) {
+ if (getenv_f("bd_type", str, sizeof(str)) != -1) {
printf(" (%s", str);
} else {
puts(" (Missing bd_type!");
puts("Board: EtherCAN/2 Gateway");
break;
}
- if (getenv_r("serial#", str, sizeof(str)) > 0) {
+ if (getenv_f("serial#", str, sizeof(str)) > 0) {
puts(", serial# ");
puts(str);
}
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
char str[32];
puts("Board: esd ARM9 HMI Panel - OTC570");
- if (getenv_r("serial#", str, sizeof(str)) > 0) {
+ if (getenv_f("serial#", str, sizeof(str)) > 0) {
puts(", serial# ");
puts(str);
}
printf("USART0: ");
- if (getenv_r("usart0", str, sizeof(str)) == -1) {
+ if (getenv_f("usart0", str, sizeof(str)) == -1) {
printf("No entry - assuming 1-wire\n");
/* CTS pin, works as mode select pin (0 = 1-wire; 1 = RS485) */
at91_set_pio_output(AT91_PIO_PORTA, 29, 0);
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard(void)
{
char str[64];
- int i = getenv_r("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts("Board: ");
{
ulong val;
char str[64];
- int i = getenv_r("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
puts(str);
}
- if (getenv_r("bd_type", str, sizeof(str)) != -1) {
+ if (getenv_f("bd_type", str, sizeof(str)) != -1) {
printf(" (%s)", str);
} else {
puts(" (Missing bd_type!)");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
int flashcnt;
int delay;
u8 *led_reg = (u8 *)(CAN_BA + 0x1000);
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
return;
}
- temp = getenv_r (s, buf, sizeof(buf));
+ temp = getenv_f(s, buf, sizeof(buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
char buf[64];
int i;
- i = getenv_r ("board_id", buf, sizeof (buf));
+ i = getenv_f("board_id", buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
if (s) {
printf ("<unknown> ");
}
- i = getenv_r ("serial#", buf, sizeof (buf));
+ i = getenv_f("serial#", buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
if (s) {
/*
* Read the environment to see what to do with the beeper
*/
- i = getenv_r ("beeper", buf, sizeof (buf));
+ i = getenv_f("beeper", buf, sizeof (buf));
if (i > 0) {
do_beeper (buf);
}
char tmp[10];
int i, br;
- i = getenv_r("brightness", tmp, sizeof(tmp));
+ i = getenv_f("brightness", tmp, sizeof(tmp));
br = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
: CONFIG_SYS_BRIGHTNESS;
puts ("Board: ");
- i = getenv_r ("serial#", (char *)buf, sizeof (buf));
+ i = getenv_f("serial#", (char *)buf, sizeof (buf));
s = (i > 0) ? buf : NULL;
if (!s || strncmp ((char *)s, "IP860", 5)) {
}
- n = getenv_r ("lcd", tmp, sizeof (tmp));
+ n = getenv_f("lcd", tmp, sizeof (tmp));
if (n > 0) {
if (!strcmp ("tft", tmp))
tft = 1;
((S1D_VALUE *) fb_info.RegAddr)[s1dReg / sizeof(S1D_VALUE)] =
s1dValue;
}
- n = getenv_r ("contrast", tmp, sizeof (tmp));
+ n = getenv_f("contrast", tmp, sizeof (tmp));
((S1D_VALUE *) fb_info.RegAddr)[0xB3] =
(n > 0) ? (uchar) simple_strtoul (tmp, NULL, 10) * 255 / 100 : 0xA0;
switch (bd->bi_busfreq) {
}
}
memcpy(back.signature,"MPL\0",4);
- i = getenv_r("serial#",back.serial_name,16);
+ i = getenv_f("serial#",back.serial_name,16);
if(i < 0) {
puts("Not possible to write Backup\n");
return;
}
back.serial_name[16]=0;
- i = getenv_r("ethaddr",back.eth_addr,20);
+ i = getenv_f("ethaddr",back.eth_addr,20);
if(i < 0) {
puts("Not possible to write Backup\n");
return;
unsigned char s[32];
int i;
- i = getenv_r ("testmem", s, 32);
+ i = getenv_f("testmem", s, 32);
if (i != 0) {
i = (int) simple_strtoul (s, NULL, 10);
if ((i > 0) && (i < 0xf)) {
puts ("Board: ");
get_pcbrev_var(&bc,&var);
- i = getenv_r ("serial#", (char *)s, 32);
+ i = getenv_f("serial#", (char *)s, 32);
if ((i == 0) || strncmp ((char *)s, BOARD_NAME,sizeof(BOARD_NAME))) {
get_backup_values (b);
if (strncmp (b->signature, "MPL\0", 4) != 0) {
puts ("\nBoard: ");
reg=in32(PLD_CONFIG_BASE+PLD_BOARD_TIMING);
rev=(char)(SYSCNTR_BREV(reg)+'A');
- i = getenv_r ("serial#", s, 32);
+ i = getenv_f("serial#", s, 32);
if ((i == -1)) {
puts ("### No HW ID - assuming " BOARD_NAME);
printf(" Rev. %c\n",rev);
puts ("Board: ");
- i = getenv_r ("serial#", (char *)s, 32);
+ i = getenv_f("serial#", (char *)s, 32);
if ((i == 0) || strncmp ((char *)s, "PIP405", 6)) {
get_backup_values (b);
if (strncmp (b->signature, "MPL\0", 4) != 0) {
int i;
backup_t *b = (backup_t *) s;
- i = getenv_r("serial#", s, 32);
+ i = getenv_f("serial#", s, 32);
if ((i < 0) || strncmp (s, "VCMA9", 5)) {
get_backup_values (b);
if (strncmp (b->signature, "MPL\0", 4) != 0) {
char s[50];
int i;
- if ((i = getenv_r("serial#", s, 32)) < 0) {
+ if ((i = getenv_f("serial#", s, 32)) < 0) {
puts ("### No HW ID - assuming VCMA9");
printf("i %d", i*24);
} else {
int res;
if ((ds != 0) && (ds != 0xff)) {
- res = getenv_r ("ethaddr", (char *)tmp, sizeof (tmp));
+ res = getenv_f("ethaddr", (char *)tmp, sizeof (tmp));
if (res > 0) {
ss = ((ds >> 4) & 0x0f);
ss += ss < 0x0a ? '0' : ('a' - 10);
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
return;
}
- temp = getenv_r (s, buf, sizeof (buf));
+ temp = getenv_f(s, buf, sizeof (buf));
s = (temp > 0) ? buf : NULL;
#ifdef DEBUG
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
int res;
if ((ds != 0) && (ds != 0xff)) {
- res = getenv_r ("ethaddr", tmp, sizeof (tmp));
+ res = getenv_f("ethaddr", tmp, sizeof (tmp));
if (res > 0) {
ss = ((ds >> 4) & 0x0f);
ss += ss < 0x0a ? '0' : ('a' - 10);
unsigned char *s;
unsigned char buf[64];
- s = (getenv_r ("serial#", (char *)&buf, sizeof(buf)) > 0) ? buf : NULL;
+ s = (getenv_f("serial#", (char *)&buf, sizeof(buf)) > 0) ? buf : NULL;
puts ("Board: Siemens CCM");
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
char buf[64];
int i;
- i = getenv_r("serial#", buf, sizeof(buf));
+ i = getenv_f("serial#", buf, sizeof(buf));
s = (i>0) ? buf : NULL;
if (!s || strncmp(s, BOARD_IDENTITY, 5)) {
char buf[64];
int i;
- i = getenv_r("serial#", buf, sizeof(buf));
+ i = getenv_f("serial#", buf, sizeof(buf));
s = (i>0) ? buf : NULL;
if (!s || strncmp(s, "QS860T", 6)) {
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof (str));
+ int i = getenv_f("serial#", str, sizeof (str));
puts ("Board: ");
spi_init();
tsc2000_write(1, 2, 0x0); /* Power up DAC */
- i = getenv_r("brightness", tmp, sizeof(tmp));
+ i = getenv_f("brightness", tmp, sizeof(tmp));
br = (i > 0)
? (int) simple_strtoul (tmp, NULL, 10)
: CONFIG_SYS_BRIGHTNESS;
int checkboard (void)
{
char str[64];
- int i = getenv_r ("serial#", str, sizeof(str));
+ int i = getenv_f("serial#", str, sizeof(str));
puts ("Board: ");
return (NULL);
}
-int getenv_r (char *name, char *buf, unsigned len)
+int getenv_f(char *name, char *buf, unsigned len)
{
int i, nxt;
#ifdef CONFIG_SYS_FLASH_PROTECTION
/* read environment from EEPROM */
char s[64];
- getenv_r ("unlock", s, sizeof(s));
+ getenv_f("unlock", s, sizeof(s));
#endif
#define BANK_BASE(i) (((phys_addr_t [CFI_MAX_FLASH_BANKS])CONFIG_SYS_FLASH_BANKS_LIST)[i])
void env_relocate (void);
int envmatch (uchar *, int);
char *getenv (char *);
-int getenv_r (char *name, char *buf, unsigned len);
+int getenv_f (char *name, char *buf, unsigned len);
int saveenv (void);
#ifdef CONFIG_PPC /* ARM version to be fixed! */
int inline setenv (char *, char *);
}
for (i = 0; i < varnum; i++) {
- if (getenv_r (var[i], list, sizeof (list)) <= 0)
+ if (getenv_f(var[i], list, sizeof (list)) <= 0)
continue;
for (j = 0; j < post_list_size; j++) {