mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #1347 from SGSSGene/cleanup_signature_fix
unification of flash write signature
This commit is contained in:
commit
0675a0f096
@ -37,5 +37,5 @@ void config_load(void)
|
||||
uint8_t config_save(void)
|
||||
{
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (char *) &mem, sizeof(mem)));
|
||||
return (flashrom_erase((uint8_t *) INFOMEM) && flashrom_write((uint8_t *) INFOMEM, (uint8_t *) &mem, sizeof(mem)));
|
||||
}
|
||||
|
@ -38,5 +38,5 @@ void config_load(void) {
|
||||
|
||||
uint8_t config_save(void) {
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (char*) &mem, sizeof(mem)));
|
||||
return (flashrom_erase((uint8_t*) &configmem) && flashrom_write((uint8_t*) &configmem, (uint8_t*) &mem, sizeof(mem)));
|
||||
}
|
||||
|
@ -22,5 +22,5 @@ void config_load(void) {
|
||||
|
||||
uint8_t config_save(void) {
|
||||
configmem_t mem = { CONFIG_KEY, sysconfig };
|
||||
return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (char*) &mem, sizeof(mem)));
|
||||
return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (uint8_t*) &mem, sizeof(mem)));
|
||||
}
|
||||
|
@ -34,9 +34,10 @@ uint8_t flashrom_erase(uint8_t *addr)
|
||||
return 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void flashrom_write(uint8_t *dst, uint8_t *src, size_t size)
|
||||
uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size)
|
||||
{
|
||||
// TODO implement this function
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -53,7 +53,7 @@ static uint32_t iap(uint32_t code, uint32_t p1, uint32_t p2, uint32_t p3, uint32
|
||||
/******************************************************************************
|
||||
* P U B L I C F U N C T I O N S
|
||||
*****************************************************************************/
|
||||
uint8_t flashrom_write(uint8_t *dst, char *src, size_t size)
|
||||
uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size)
|
||||
{
|
||||
(void) size; /* unused */
|
||||
|
||||
|
@ -46,7 +46,7 @@ uint8_t flashrom_erase(uint8_t *addr)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void flashrom_write(uint8_t *dst, uint8_t *src, size_t size)
|
||||
uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size)
|
||||
{
|
||||
unsigned int i;
|
||||
FCTL3 = FWKEY; /* Lock = 0 */
|
||||
@ -64,6 +64,7 @@ void flashrom_write(uint8_t *dst, uint8_t *src, size_t size)
|
||||
busy_wait();
|
||||
FCTL1 = FWKEY; /* WRT = 0 */
|
||||
FCTL3 = FWKEY | LOCK; /* Lock = 1 */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -32,7 +32,7 @@ uint8_t flashrom_erase(uint8_t *addr);
|
||||
*
|
||||
* @return 1 on success, 0 otherwise
|
||||
*/
|
||||
uint8_t flashrom_write(uint8_t *dst, char *src, size_t size);
|
||||
uint8_t flashrom_write(uint8_t *dst, const uint8_t *src, size_t size);
|
||||
|
||||
/** @} */
|
||||
#endif /* FLASHROM_H */
|
||||
|
Loading…
Reference in New Issue
Block a user