/**
* Wait until flash memory is ready.
*/
-static void flash25_waitReady(KFileFlash25 *fd)
+static void flash25_waitReady(Flash25 *fd)
{
uint8_t stat;
/**
* Send a single command to serial flash memory.
*/
-static void flash25_sendCmd(KFileFlash25 *fd, Flash25Opcode cmd)
+static void flash25_sendCmd(Flash25 *fd, Flash25Opcode cmd)
{
CS_ENABLE();
* try to read manufacturer id of serial memory,
* then check if is equal to selected type.
*/
-static bool flash25_pin_init(KFileFlash25 *fd)
+static bool flash25_pin_init(Flash25 *fd)
{
uint8_t device_id;
uint8_t manufacturer;
*/
static KFile * flash25_reopen(struct KFile *_fd)
{
- KFileFlash25 *fd = KFILEFLASH25(_fd);
+ Flash25 *fd = FLASH25_CAST(_fd);
fd->fd.seek_pos = 0;
fd->fd.size = FLASH25_MEM_SIZE;
{
uint8_t *data = (uint8_t *)buf;
- KFileFlash25 *fd = KFILEFLASH25(_fd);
+ Flash25 *fd = FLASH25_CAST(_fd);
ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size);
size = MIN((kfile_size_t)size, fd->fd.size - fd->fd.seek_pos);
flash25Size_t wr_len;
const uint8_t *data = (const uint8_t *) _buf;
- KFileFlash25 *fd = KFILEFLASH25(_fd);
+ Flash25 *fd = FLASH25_CAST(_fd);
ASSERT(fd->fd.seek_pos + (kfile_size_t)size <= fd->fd.size);
total_write += wr_len;
}
- kprintf("written %u bytes\n", total_write);
+ kprintf("written %lu bytes\n", total_write);
return total_write;
}
* \note A sector size is FLASH25_SECTOR_SIZE.
* This operation could take a while.
*/
-void flash25_sectorErase(KFileFlash25 *fd, Flash25Sector sector)
+void flash25_sectorErase(Flash25 *fd, Flash25Sector sector)
{
/*
*/
flash25_waitReady(fd);
- DB(kprintf("Erased sector [%d] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
+ DB(kprintf("Erased sector [%ld] in %d ms\n", sector, ticks_to_ms(timer_clock() - start_time)));
}
*
* \note This operation could take a while.
*/
-void flash25_chipErase(KFileFlash25 *fd)
+void flash25_chipErase(Flash25 *fd)
{
/*
* Erase all chip could take a while,
*/
flash25_waitReady(fd);
- DB(kprintf("Erased all memory in %d ms\n", ticks_to_ms(timer_clock() - start_time)));
+ DB(kprintf("Erased all memory in %ld ms\n", ticks_to_ms(timer_clock() - start_time)));
}
/**
* Init data flash memory interface.
*/
-void flash25_init(KFileFlash25 *fd, KFile *ch)
+void flash25_init(Flash25 *fd, KFile *ch)
{
ASSERT(fd);