function rename

This commit is contained in:
hathach 2018-06-20 17:03:38 +07:00
parent dc3e204406
commit 19eb8652e7
3 changed files with 20 additions and 17 deletions

View File

@ -337,7 +337,7 @@ int main(void)
(void) bootloader_init(); (void) bootloader_init();
// Init msc flash, must be after bootloader_init(), before SD init // Init msc flash, must be after bootloader_init(), before SD init
msc_flash_init(); msc_uf2_init();
if (bootloader_dfu_sd_in_progress()) if (bootloader_dfu_sd_in_progress())
{ {
@ -541,13 +541,13 @@ void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
void tud_mount_cb(uint8_t rhport) void tud_mount_cb(uint8_t rhport)
{ {
(void) rhport; (void) rhport;
msc_flash_mount(); msc_uf2_mount();
} }
void tud_umount_cb(uint8_t rhport) void tud_umount_cb(uint8_t rhport)
{ {
(void) rhport; (void) rhport;
msc_flash_umount(); msc_uf2_umount();
} }
uint32_t tusb_hal_millis(void) uint32_t tusb_hal_millis(void)

View File

@ -267,13 +267,13 @@ static void fat_pstorage_cb(pstorage_handle_t * p_handle, uint8_t op_code, uint3
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* API /* API
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
void msc_flash_init(void) void msc_uf2_init(void)
{ {
pstorage_module_param_t fat_psp = { .cb = fat_pstorage_cb}; pstorage_module_param_t fat_psp = { .cb = fat_pstorage_cb};
pstorage_register(&fat_psp, &_fat_psh); pstorage_register(&fat_psp, &_fat_psh);
} }
void msc_flash_mount(void) void msc_uf2_mount(void)
{ {
_wr10_state = WRITE10_IDLE; _wr10_state = WRITE10_IDLE;
@ -281,7 +281,7 @@ void msc_flash_mount(void)
fat12_mkfs(); fat12_mkfs();
} }
void msc_flash_umount(void) void msc_uf2_umount(void)
{ {
} }
@ -389,17 +389,20 @@ int32_t tud_msc_read10_cb (uint8_t rhport, uint8_t lun, uint32_t lba, uint32_t o
{ {
memcpy(buffer, ((uint8_t*) &_disk_ram) + lba*MSC_FLASH_BLOCK_SIZE, bufsize); memcpy(buffer, ((uint8_t*) &_disk_ram) + lba*MSC_FLASH_BLOCK_SIZE, bufsize);
} }
else if ( lba < SECTOR_DATA + arrcount_(info)) else
{ {
// INFO_UF2.TXT & INDEX.HTM contents lba -= SECTOR_DATA;
strcpy(buffer, info[lba-SECTOR_DATA].content);
// uint32_t addr = lba2addr(lba) + offset; if ( lba < arrcount_(info) - 1 )
// memcpy(buffer, (uint8_t*) addr, bufsize); {
strcpy(buffer, info[lba].content); // INFO_UF2.TXT & INDEX.HTM contents
} }
else else
{ {
lba -= (arrcount_(info) - 1);
}
} }
return bufsize; return bufsize;

View File

@ -63,9 +63,9 @@ VERIFY_STATIC( MSC_FLASH_ADDR_START+MSC_FLASH_SIZE == BOOTLOADER_REGION_START-DF
/* Note ATTR_WEAK is used when CFG_TUD_MSC = 0 /* Note ATTR_WEAK is used when CFG_TUD_MSC = 0
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
ATTR_WEAK void msc_flash_init(void); ATTR_WEAK void msc_uf2_init(void);
ATTR_WEAK void msc_flash_mount(void); ATTR_WEAK void msc_uf2_mount(void);
ATTR_WEAK void msc_flash_umount(void); ATTR_WEAK void msc_uf2_umount(void);
#ifdef __cplusplus #ifdef __cplusplus