mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 14:56:03 +00:00
dfu: add callback for flush and initiated operation
Add weak callback to allow board specific behavior - flush - initiated This patch prepare usage of DFU back end for communication with STM32CubeProgrammer on stm32mp1 platform with stm32prog command. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
ec44cace4b
commit
067c13c70b
3 changed files with 49 additions and 0 deletions
|
@ -143,6 +143,14 @@ Commands:
|
||||||
mtd <dev>=<alt1>;....;<altN>
|
mtd <dev>=<alt1>;....;<altN>
|
||||||
virt <dev>=<alt1>;....;<altN>
|
virt <dev>=<alt1>;....;<altN>
|
||||||
|
|
||||||
|
Callbacks:
|
||||||
|
The weak callback functions can be implemented to manage specific behavior
|
||||||
|
- dfu_initiated_callback : called when the DFU transaction is started,
|
||||||
|
used to initiase the device
|
||||||
|
- dfu_flush_callback : called at the end of the DFU write after DFU
|
||||||
|
manifestation, used to manage the device when
|
||||||
|
DFU transaction is closed
|
||||||
|
|
||||||
Host tools:
|
Host tools:
|
||||||
When U-Boot runs the dfu stack, the DFU host tools can be used
|
When U-Boot runs the dfu stack, the DFU host tools can be used
|
||||||
to send/receive firmwares on each configurated alternate.
|
to send/receive firmwares on each configurated alternate.
|
||||||
|
|
|
@ -22,6 +22,22 @@ static int dfu_alt_num;
|
||||||
static int alt_num_cnt;
|
static int alt_num_cnt;
|
||||||
static struct hash_algo *dfu_hash_algo;
|
static struct hash_algo *dfu_hash_algo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The purpose of the dfu_flush_callback() function is to
|
||||||
|
* provide callback for dfu user
|
||||||
|
*/
|
||||||
|
__weak void dfu_flush_callback(struct dfu_entity *dfu)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The purpose of the dfu_initiated_callback() function is to
|
||||||
|
* provide callback for dfu user
|
||||||
|
*/
|
||||||
|
__weak void dfu_initiated_callback(struct dfu_entity *dfu)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The purpose of the dfu_usb_get_reset() function is to
|
* The purpose of the dfu_usb_get_reset() function is to
|
||||||
* provide information if after USB_DETACH request
|
* provide information if after USB_DETACH request
|
||||||
|
@ -263,6 +279,7 @@ int dfu_transaction_initiate(struct dfu_entity *dfu, bool read)
|
||||||
}
|
}
|
||||||
|
|
||||||
dfu->inited = 1;
|
dfu->inited = 1;
|
||||||
|
dfu_initiated_callback(dfu);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +299,8 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
|
||||||
printf("\nDFU complete %s: 0x%08x\n", dfu_hash_algo->name,
|
printf("\nDFU complete %s: 0x%08x\n", dfu_hash_algo->name,
|
||||||
dfu->crc);
|
dfu->crc);
|
||||||
|
|
||||||
|
dfu_flush_callback(dfu);
|
||||||
|
|
||||||
dfu_transaction_cleanup(dfu);
|
dfu_transaction_cleanup(dfu);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -183,6 +183,28 @@ int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
|
||||||
int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
|
int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
|
||||||
int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
|
int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dfu_initiated_callback - weak callback called on DFU transaction start
|
||||||
|
*
|
||||||
|
* It is a callback function called by DFU stack when a DFU transaction is
|
||||||
|
* initiated. This function allows to manage some board specific behavior on
|
||||||
|
* DFU targets.
|
||||||
|
*
|
||||||
|
* @param dfu - pointer to the dfu_entity, which should be initialized
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void dfu_initiated_callback(struct dfu_entity *dfu);
|
||||||
|
/**
|
||||||
|
* dfu_flush_callback - weak callback called at the end of the DFU write
|
||||||
|
*
|
||||||
|
* It is a callback function called by DFU stack after DFU manifestation.
|
||||||
|
* This function allows to manage some board specific behavior on DFU targets
|
||||||
|
*
|
||||||
|
* @param dfu - pointer to the dfu_entity, which should be flushed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void dfu_flush_callback(struct dfu_entity *dfu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dfu_defer_flush - pointer to store dfu_entity for deferred flashing.
|
* dfu_defer_flush - pointer to store dfu_entity for deferred flashing.
|
||||||
* It should be NULL when not used.
|
* It should be NULL when not used.
|
||||||
|
|
Loading…
Add table
Reference in a new issue