#include "fw_download.h"
#include "nor_flash.h"
Go to the source code of this file.
Functions | |
void | fw_download_cb (void *ctx, uint32_t addr, uint8_t **buf, uint32_t *len) |
int | fw_download_init (void) |
void fw_download_cb | ( | void * | ctx, | |
uint32_t | addr, | |||
uint8_t ** | buf, | |||
uint32_t * | len | |||
) |
Definition at line 38 of file fw_download_extflash.c.
References flash_read(), and SECTOR_SIZE.
00039 { 00040 /* remember accross different calls */ 00041 static uint8_t* fw_buf = NULL; 00042 00043 /* first call? Then allocate a buffer */ 00044 if (!fw_buf) { 00045 fw_buf = malloc(SECTOR_SIZE); 00046 Assert(fw_buf); 00047 } 00048 00049 /* transfer done? then free the buffer */ 00050 if (*len == 0) { 00051 free(fw_buf); 00052 return; 00053 } 00054 00055 uint32_t fw_len = *len > SECTOR_SIZE ? SECTOR_SIZE : *len; 00056 flash_read(addr, fw_buf, fw_len); 00057 *buf = fw_buf; 00058 *len = fw_len; 00059 }
int fw_download_init | ( | void | ) |
Definition at line 32 of file fw_download_extflash.c.
References flash_init().
00033 { 00034 flash_init(); 00035 return 0; 00036 }