Skip to content

Commit

Permalink
serial: 新增 CMD_READ_FLASH_ID 以读取 flash id
Browse files Browse the repository at this point in the history
  • Loading branch information
xychen committed Aug 8, 2022
1 parent 2b173bb commit d1fe5f9
Show file tree
Hide file tree
Showing 8 changed files with 2,326 additions and 2,299 deletions.
Binary file modified libcskburn_serial/burner_4.img
Binary file not shown.
Binary file modified libcskburn_serial/burner_6.img
Binary file not shown.
1 change: 1 addition & 0 deletions libcskburn_serial/include/cskburn_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bool cskburn_serial_verify(
cskburn_serial_device_t *dev, uint32_t addr, uint32_t size, uint8_t *md5);

bool cskburn_serial_read_chip_id(cskburn_serial_device_t *dev, uint64_t *chip_id);
bool cskburn_serial_read_flash_id(cskburn_serial_device_t *dev, uint32_t *flash_id);

bool cskburn_serial_reset(cskburn_serial_device_t *dev, uint32_t reset_delay);

Expand Down
3,368 changes: 1,686 additions & 1,682 deletions libcskburn_serial/src/burner_4_img.c

Large diffs are not rendered by default.

1,240 changes: 624 additions & 616 deletions libcskburn_serial/src/burner_6_img.c

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions libcskburn_serial/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#ifdef FEATURE_MD5_CHALLENGE
#define CMD_FLASH_MD5_CHALLENGE 0xF2
#endif // FEATURE_MD5_CHALLENGE
#define CMD_READ_FLASH_ID 0xF3

#define CHECKSUM_MAGIC 0xef
#define CHECKSUM_NONE 0
Expand Down Expand Up @@ -294,6 +295,12 @@ cmd_read_reg(cskburn_serial_device_t *dev, uint32_t reg, uint32_t *val)
return !check_command(dev, CMD_READ_REG, sizeof(reg), CHECKSUM_NONE, val, TIMEOUT_DEFAULT);
}

bool
cmd_read_flash_id(cskburn_serial_device_t *dev, uint32_t *id)
{
return !check_command(dev, CMD_READ_FLASH_ID, 0, CHECKSUM_NONE, id, TIMEOUT_DEFAULT);
}

bool
cmd_mem_begin(cskburn_serial_device_t *dev, uint32_t size, uint32_t blocks, uint32_t block_size,
uint32_t offset)
Expand Down
3 changes: 2 additions & 1 deletion libcskburn_serial/src/cmd.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef __LIB_CSKBURN_SERIAL_CMD__
#define __LIB_CSKBURN_SERIAL_CMD__

#include <cskburn_serial.h>
#include <stdbool.h>
#include <stdint.h>
#include <cskburn_serial.h>

typedef struct {
uint8_t direction;
Expand Down Expand Up @@ -39,6 +39,7 @@ typedef struct {
bool cmd_sync(cskburn_serial_device_t *dev, uint16_t timeout);

bool cmd_read_reg(cskburn_serial_device_t *dev, uint32_t reg, uint32_t *val);
bool cmd_read_flash_id(cskburn_serial_device_t *dev, uint32_t *id);

bool cmd_mem_begin(cskburn_serial_device_t *dev, uint32_t size, uint32_t blocks,
uint32_t block_size, uint32_t offset);
Expand Down
6 changes: 6 additions & 0 deletions libcskburn_serial/src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ cskburn_serial_read_chip_id(cskburn_serial_device_t *dev, uint64_t *chip_id)
return true;
}

bool
cskburn_serial_read_flash_id(cskburn_serial_device_t *dev, uint32_t *flash_id)
{
return cmd_read_flash_id(dev, flash_id);
}

bool
cskburn_serial_reset(cskburn_serial_device_t *dev, uint32_t reset_delay)
{
Expand Down

0 comments on commit d1fe5f9

Please sign in to comment.