cmd: fastboot: test the fastboot memory space availability
Use the sysmem to test fastboot memory is available or not. Change-Id: I021152827b6948fabd5ea41e111ea20adf43167f Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
parent
727ebf6de1
commit
562a66d432
|
|
@ -13,6 +13,7 @@
|
|||
#include <g_dnl.h>
|
||||
#include <net.h>
|
||||
#include <usb.h>
|
||||
#include <sysmem.h>
|
||||
|
||||
static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||
{
|
||||
|
|
@ -21,7 +22,6 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
|||
char *usb_controller;
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
if (argc < 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
|
|
@ -65,6 +65,13 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (!sysmem_alloc_base("fastboot",
|
||||
CONFIG_FASTBOOT_BUF_ADDR,
|
||||
CONFIG_FASTBOOT_BUF_SIZE)) {
|
||||
printf("The fastboot memory space is unusable!\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
while (1) {
|
||||
|
|
@ -78,6 +85,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
|||
ret = CMD_RET_SUCCESS;
|
||||
|
||||
exit:
|
||||
sysmem_free(CONFIG_FASTBOOT_BUF_ADDR);
|
||||
g_dnl_unregister();
|
||||
g_dnl_clear_detach();
|
||||
board_usb_cleanup(controller_index, USB_INIT_DEVICE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue