mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Added led management on HD fw upgrade
This commit is contained in:
parent
320cbb37b5
commit
c9db55006f
Binary file not shown.
Binary file not shown.
@ -144,6 +144,7 @@
|
||||
/*! \name AT45DB081 Memories
|
||||
*/
|
||||
//! @{
|
||||
#define AT45DB021D_DENSITY 0x14 //!< Device density value.
|
||||
#define AT45DBX_DENSITY 0x24 //!< Device density value.
|
||||
#define AT45DBX_BYTE_ADDR_BITS 9 //!< Address bits for byte position within buffer.
|
||||
|
||||
@ -291,11 +292,11 @@ Bool at45dbx_mem_check(void)
|
||||
at45dbx_chipselect_df(df, FALSE);
|
||||
|
||||
// Unexpected device density value.
|
||||
if ((status & AT45DBX_MSK_DENSITY) < AT45DBX_DENSITY)
|
||||
if ((status & AT45DBX_MSK_DENSITY) < AT45DB021D_DENSITY)
|
||||
{
|
||||
//printk("Unexpected device density value: %d (0x%x)\n", (status & AT45DBX_MSK_DENSITY), status);
|
||||
//return KO;
|
||||
}
|
||||
printk("Unexpected device density value: %d (0x%x)\n", (status & AT45DBX_MSK_DENSITY), status);
|
||||
return KO;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -33,18 +33,54 @@
|
||||
#include "wl_fw.h"
|
||||
#include "startup.h"
|
||||
#include "nor_flash.h"
|
||||
#include "gpio.h"
|
||||
|
||||
#define GREEN_OFF() gpio_set_gpio_pin(LED0_GPIO)
|
||||
#define GREEN_ON() gpio_clr_gpio_pin(LED0_GPIO)
|
||||
#define GREEN_BLINK() gpio_tgl_gpio_pin(LED0_GPIO)
|
||||
#define RED_OFF() gpio_set_gpio_pin(LED1_GPIO)
|
||||
#define RED_ON() gpio_clr_gpio_pin(LED1_GPIO)
|
||||
#define RED_BLINK() gpio_tgl_gpio_pin(LED1_GPIO)
|
||||
#define BLUE_OFF() gpio_set_gpio_pin(LED2_GPIO)
|
||||
#define BLUE_ON() gpio_clr_gpio_pin(LED2_GPIO)
|
||||
#define BLUE_BLINK() gpio_tgl_gpio_pin(LED2_GPIO)
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void
|
||||
led_init(void)
|
||||
{
|
||||
gpio_enable_gpio_pin(LED0_GPIO);
|
||||
gpio_enable_gpio_pin(LED1_GPIO);
|
||||
gpio_enable_gpio_pin(LED2_GPIO);
|
||||
GREEN_OFF();
|
||||
RED_OFF();
|
||||
BLUE_OFF();
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
U32 pos, len;
|
||||
|
||||
startup_init();
|
||||
printk("*** HD chip firmware upgrade ver 2.7 ***\n");
|
||||
led_init();
|
||||
flash_init();
|
||||
printk("Memory check...");
|
||||
GREEN_ON();
|
||||
if (at45dbx_mem_check() == OK)
|
||||
printk(" OK\n");
|
||||
{
|
||||
printk("Memory check... [ OK ]\n");
|
||||
}
|
||||
else
|
||||
printk(" FAIL\n");
|
||||
{
|
||||
RED_ON();
|
||||
GREEN_OFF();
|
||||
printk("Memory check... [FAIL]\n");
|
||||
return 0;
|
||||
}
|
||||
printk("Writing firmware data to flash\n");
|
||||
pos = 0;
|
||||
while (pos < fw_len) {
|
||||
@ -72,6 +108,8 @@ int main(void)
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (*(page_buf + i) != *(fw_buf + pos + i)) {
|
||||
RED_ON();
|
||||
GREEN_OFF();
|
||||
printk("Verify failed at byte %d, 0x%02x != 0x%02x\n",
|
||||
pos + i, *(page_buf + i), *(fw_buf + pos + i));
|
||||
return 0;
|
||||
@ -80,7 +118,8 @@ int main(void)
|
||||
|
||||
pos += len;
|
||||
}
|
||||
|
||||
GREEN_OFF();
|
||||
BLUE_ON();
|
||||
printk("Firmware successfully stored in flash!\n");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user