Skip to content

Commit c9db550

Browse files
committed
Added led management on HD fw upgrade
1 parent 320cbb3 commit c9db550

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

binary/wifi_dnld.elf

305 Bytes
Binary file not shown.

wifi_dnld/Release/wifi_dnld.elf

305 Bytes
Binary file not shown.

wifi_dnld/src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX/at45dbx.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
/*! \name AT45DB081 Memories
145145
*/
146146
//! @{
147+
#define AT45DB021D_DENSITY 0x14 //!< Device density value.
147148
#define AT45DBX_DENSITY 0x24 //!< Device density value.
148149
#define AT45DBX_BYTE_ADDR_BITS 9 //!< Address bits for byte position within buffer.
149150

@@ -291,11 +292,11 @@ Bool at45dbx_mem_check(void)
291292
at45dbx_chipselect_df(df, FALSE);
292293

293294
// Unexpected device density value.
294-
if ((status & AT45DBX_MSK_DENSITY) < AT45DBX_DENSITY)
295+
if ((status & AT45DBX_MSK_DENSITY) < AT45DB021D_DENSITY)
295296
{
296-
//printk("Unexpected device density value: %d (0x%x)\n", (status & AT45DBX_MSK_DENSITY), status);
297-
//return KO;
298-
}
297+
printk("Unexpected device density value: %d (0x%x)\n", (status & AT45DBX_MSK_DENSITY), status);
298+
return KO;
299+
}
299300
}
300301

301302
return OK;

wifi_dnld/src/flash_fw.c

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,54 @@
3333
#include "wl_fw.h"
3434
#include "startup.h"
3535
#include "nor_flash.h"
36+
#include "gpio.h"
37+
38+
#define GREEN_OFF() gpio_set_gpio_pin(LED0_GPIO)
39+
#define GREEN_ON() gpio_clr_gpio_pin(LED0_GPIO)
40+
#define GREEN_BLINK() gpio_tgl_gpio_pin(LED0_GPIO)
41+
#define RED_OFF() gpio_set_gpio_pin(LED1_GPIO)
42+
#define RED_ON() gpio_clr_gpio_pin(LED1_GPIO)
43+
#define RED_BLINK() gpio_tgl_gpio_pin(LED1_GPIO)
44+
#define BLUE_OFF() gpio_set_gpio_pin(LED2_GPIO)
45+
#define BLUE_ON() gpio_clr_gpio_pin(LED2_GPIO)
46+
#define BLUE_BLINK() gpio_tgl_gpio_pin(LED2_GPIO)
47+
48+
49+
/**
50+
*
51+
*/
52+
void
53+
led_init(void)
54+
{
55+
gpio_enable_gpio_pin(LED0_GPIO);
56+
gpio_enable_gpio_pin(LED1_GPIO);
57+
gpio_enable_gpio_pin(LED2_GPIO);
58+
GREEN_OFF();
59+
RED_OFF();
60+
BLUE_OFF();
61+
}
62+
3663

3764
int main(void)
3865
{
3966
U32 pos, len;
4067

4168
startup_init();
69+
printk("*** HD chip firmware upgrade ver 2.7 ***\n");
70+
led_init();
4271
flash_init();
43-
printk("Memory check...");
72+
GREEN_ON();
4473
if (at45dbx_mem_check() == OK)
45-
printk(" OK\n");
74+
{
75+
printk("Memory check... [ OK ]\n");
76+
}
4677
else
47-
printk(" FAIL\n");
78+
{
79+
RED_ON();
80+
GREEN_OFF();
81+
printk("Memory check... [FAIL]\n");
82+
return 0;
83+
}
4884
printk("Writing firmware data to flash\n");
4985
pos = 0;
5086
while (pos < fw_len) {
@@ -72,6 +108,8 @@ int main(void)
72108

73109
for (i = 0; i < len; i++)
74110
if (*(page_buf + i) != *(fw_buf + pos + i)) {
111+
RED_ON();
112+
GREEN_OFF();
75113
printk("Verify failed at byte %d, 0x%02x != 0x%02x\n",
76114
pos + i, *(page_buf + i), *(fw_buf + pos + i));
77115
return 0;
@@ -80,7 +118,8 @@ int main(void)
80118

81119
pos += len;
82120
}
83-
121+
GREEN_OFF();
122+
BLUE_ON();
84123
printk("Firmware successfully stored in flash!\n");
85124
return 0;
86125
}

0 commit comments

Comments
 (0)