image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
 
Loading...
Searching...
No Matches
FileTransfer.c
Go to the documentation of this file.
1
32#include "Platform.h"
33#include "EVE_CoCmd.h"
34
35#include "FileIo.h"
36#include "FileTransfer.h"
37#include "Common.h"
38
40#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
41#define ALIGN(x,a) __ALIGN_MASK(x, a - 1)
42
43#define FREAD_BLOCK (8 * 1024)
44
45#define BLOBSIZE 4096
46
47#if defined(MSVC_PLATFORM) || defined(BT8XXEMU_PLATFORM)
48#define EVE_FLASH_DIR __FILE__ "\\..\\..\\..\\common\\eve_flash"
49#else
50#define EVE_FLASH_DIR "/Test/common/eve_flash"
51#endif
52
53#if defined(BT815_ENABLE)
54#define FILE_BLOB (EVE_FLASH_DIR "\\BT815-unified.blob")
55#elif defined(BT817_ENABLE)
56#define FILE_BLOB (EVE_FLASH_DIR "\\BT817-unified.blob")
57#else
59#define FILE_BLOB (EVE_FLASH_DIR "\\BT815-unified.blob")
60#endif
61
62#if defined(EVE_FLASH_AVAILABLE)
69uint32_t Ftf_Flash_Erase(EVE_HalContext* phost) {
70 // Try switch full mode
73 // Try update blob and switch full mode again
74 Ftf_Write_Blob_Default(phost);
77 return 0;
78 }
79 }
80
81 /* Erase the flash */
83 EVE_Cmd_waitFlush(phost);
84
85 return 1;
86}
87
94uint32_t Ftf_Flash_ClearCache(EVE_HalContext* phost) {
95 EVE_CoCmd_dlStart(phost);
96 EVE_CoCmd_swap(phost);
97 EVE_Cmd_waitFlush(phost);
98
99 EVE_CoCmd_dlStart(phost);
100 EVE_CoCmd_swap(phost);
101 EVE_Cmd_waitFlush(phost);
102
104 EVE_Cmd_waitFlush(phost);
105 return 1;
106}
107
121uint32_t Ftf_Update_Blob(EVE_HalContext* phost, const char* pbuff) {
122 printf("Updating blob\n");
123
124 FlashHelper_SwitchState(phost, FLASH_STATUS_BASIC); // basic mode
125 EVE_Hal_wrMem(phost, RAM_G, pbuff, BLOBSIZE);
126 EVE_Cmd_waitFlush(phost);
128 EVE_Cmd_waitFlush(phost);
129
130 int ret = FlashHelper_SwitchFullMode(phost);
131
132 if (ret == 1) {
133 printf("Blob updated successful\n");
134 return 1;
135 }
136 else {
137 printf("Failed to update Blob\n");
138 }
139
140 return 0;
141}
142
150uint32_t Ftf_Write_BlobFile(EVE_HalContext* phost, const char* blobfile) {
151 char pBuff[BLOBSIZE];
152
153 printf("Writing blob from file %s\n", blobfile);
154
155 int ret = FileIO_File_To_Buffer(blobfile, pBuff, 0, BLOBSIZE, NULL);
156 if (!ret) {
157 printf("Unable to open file: %s\n", blobfile);
158 }
159
160 ret = Ftf_Update_Blob(phost, pBuff);
161
163 if (!ret) {
164 return Ftf_Write_Blob_Default(phost);
165 }
166
167 return 1;
168}
169
176uint32_t Ftf_Write_Blob_Default(EVE_HalContext* phost) {
177 char pBuff[BLOBSIZE];
178 printf("Writing blob default\n");
179
180 int ret = FileIO_File_To_Buffer(FILE_BLOB, pBuff, 0, BLOBSIZE, NULL);
181 if (!ret) {
182 printf("Unable to open file: %s\n", FILE_BLOB);
183 }
184
185 return Ftf_Update_Blob(phost, pBuff);
186}
187
192void Ftf_Progress_Close() {
194}
195
206Ftf_Progress_t* Ftf_Progress_Init(EVE_HalContext* phost, const char* filePath, const char* fileName, uint32_t addr, uint8_t direction) {
207 static Ftf_Progress_t progress;
208 uint32_t range = 0;
209 int32_t fileSize = 0;
210
211 progress.sent = 0;
212 progress.addr = addr;
213 progress.direction = direction;
214#pragma warning(push)
215#pragma warning(disable : 4996)
216 strcpy(progress.file, filePath);
217 strcpy(progress.fileName, fileName);
218#pragma warning(pop)
219
220 if (direction == FTF_PROGESS_READ) {
221 fileSize = FileIO_File_Open(filePath, FILEIO_E_FOPEN_WRITE);
222 if (0 >= fileSize) {
223 printf("Unable to open file: %s\n", filePath);
224 return 0;
225 }
226 snprintf(progress.message, MSG_SIZE, "Reading %s from flash", progress.fileName);
227 }
228 else {
229 // update blob from file first
230 if (addr == 0) {
231 Ftf_Write_BlobFile(phost, filePath);
232 }
233 else {
234 Ftf_Write_Blob_Default(phost);
235 }
236
237 fileSize = FileIO_File_Open(filePath, FILEIO_E_FOPEN_READ);
238
239 if (0 >= fileSize) {
240 printf("Unable to open file: %s\n", filePath);
241 return 0;
242 }
243
244 // Jump to real data
245 if (addr == 0) {
246 progress.sent = progress.addr = BLOBSIZE;
248 }
249
250 snprintf(progress.message, MSG_SIZE, "Writing %s to flash", progress.fileName);
251 progress.fileSize = fileSize;
252
253 }
254
256 progress.bytesPerPercent = ALIGN(fileSize / 100, 4096);
257
258 if (progress.bytesPerPercent < FREAD_BLOCK) {
259 progress.bytesPerPercent = FREAD_BLOCK;
260 }
261
262 return &progress;
263}
264
272uint32_t Ftf_Progress_Write_Next(EVE_HalContext* phost, Ftf_Progress_t* progress) {
273 uint8_t pbuff[FREAD_BLOCK];
274 uint32_t bytes;
275 uint32_t sent = 0;
276 uint32_t ramGSent = 0;
277 uint32_t blockSize = 0;
278
279 // Tranfer 1 percent of file
280 while (progress->sent < progress->fileSize && sent < progress->bytesPerPercent) {
281 blockSize = FREAD_BLOCK > progress->bytesPerPercent ? progress->bytesPerPercent : FREAD_BLOCK;
282
283 // Tranfer to ram_g
284 while (ramGSent < RAM_G_SIZE && progress->sent < progress->fileSize && sent < progress->bytesPerPercent) {
285 bytes = FileIO_File_Read(pbuff, blockSize);
286
287 if (0 == bytes) {
288 printf("Error on reading file: %s\n", progress->file);
289 return 0;
290 }
291 EVE_Hal_wrMem(phost, ramGSent, pbuff, bytes);
292 EVE_Cmd_waitFlush(phost);
293 ramGSent += bytes;
294 sent += bytes;
295 progress->sent += bytes;
296 }
297
298 // Update flash from ram_g
299 ramGSent = (ramGSent + 4095) & (~4095);//to ensure 4KB alignment
300 FlashHelper_Update(phost, progress->addr, 0, ramGSent);
301 progress->addr += ramGSent;
302 }
303
304 return progress->sent * 100 / progress->fileSize; /* Percent */
305}
306
314uint32_t Ftf_Progress_Read_Next(EVE_HalContext* phost, Ftf_Progress_t* progress) {
315 const uint32_t bufferSize = FREAD_BLOCK;
316 uint8_t pbuff[FREAD_BLOCK];
317 uint32_t sent = 0;
318 uint32_t blockSize = 0;
319 uint32_t gramaddr = RAM_G;
320 uint32_t fileWriteBlock = 0;
321
322 while (progress->sent < progress->fileSize && sent < progress->bytesPerPercent) {
323 fileWriteBlock = bufferSize > progress->bytesPerPercent ? progress->bytesPerPercent : bufferSize;
324
325 if ((progress->fileSize - progress->sent) < fileWriteBlock) {
326 fileWriteBlock = progress->fileSize - progress->sent;
327 }
328
329 // source address in flash memory Must be 64-byte aligned.
330 blockSize = ALIGN(fileWriteBlock, 64);
331
332 uint32_t fret = FlashHelper_Read(phost, gramaddr, progress->addr, blockSize, pbuff);
333
334 if (FLASH_CMD_SUCCESS != fret) {
335 printf("Error when reading flash\n");
336 return 0;
337 }
338
339 sent += blockSize;
340 progress->sent += blockSize;
341 progress->addr += blockSize;
342 if (0 == FileIO_File_Write(pbuff, blockSize)) {
343 printf("Unable to write file: %s\n", progress->file);
344 return 0;
345 }
346 }
347 return progress->sent * 100 / progress->fileSize; /* Percent */
348}
349
358uint32_t Ftf_Progress_Ui(EVE_HalContext* phost, const Ftf_Progress_t* progress) {
359 char s[100];
360 uint16_t x;
361 uint16_t y;
362 uint16_t w;
363 uint16_t h;
364 uint16_t opt;
365 uint16_t font = 29;
366 uint16_t val;
367 const uint32_t range = 1000;
368 uint64_t sent64 = progress->sent;
369
370 if (progress->fileSize == 0) {
371 return 1;
372 }
373 opt = 0;
374 val = (uint16_t)(sent64 * 1000 / progress->fileSize);
375
376 w = (uint16_t)(DispWidth * 8 / 10);
377 h = (uint16_t)(DispHeight * 1 / 10);
378 x = (uint16_t)((DispWidth - w) / 2);
379 y = (uint16_t)((DispHeight - h) / 2);
380
381 EVE_CoCmd_dlStart(phost);
382 EVE_Cmd_wr32(phost, CLEAR(1, 1, 1));
383 EVE_Cmd_wr32(phost, CLEAR_COLOR_RGB(0, 0, 0));
384
385 EVE_CoCmd_text(phost, x, y - 50, font, opt, progress->message);
386 EVE_CoCmd_progress(phost, x, y, w, h, opt, val, range);
387
388 snprintf(s, 100, "%u %%", val * 100 / range);
389 EVE_Cmd_wr32(phost, COLOR_RGB(0, 200, 0));
390 EVE_CoCmd_text(phost, x + w / 2, y + 5, font, opt, s);
391 EVE_Cmd_wr32(phost, COLOR_RGB(255, 255, 255));
392
393 EVE_Cmd_wr32(phost, DISPLAY());
394 EVE_CoCmd_swap(phost);
395 EVE_Cmd_waitFlush(phost);
396
397 return 1;
398}
399
409uint32_t Ftf_Write_File_To_Flash_With_Progressbar(EVE_HalContext* phost, const char* filePath, const char* fileName, uint32_t address) {
410 Ftf_Progress_t* progress = Ftf_Progress_Init(phost, filePath, fileName, address, FTF_PROGESS_WRITE);
411
412 if (!progress) {
413 return -1;
414 }
415 while (1) {
416 uint32_t pc = Ftf_Progress_Write_Next(phost, progress);
417 Ftf_Progress_Ui(phost, progress);
418
419 if (pc >= 100) {
420 break;
421 }
422 }
423 Ftf_Progress_Close();
424
425 return progress->fileSize;
426}
427
438uint32_t Ftf_Read_File_From_Flash_With_Progressbar(EVE_HalContext* phost, uint8_t* filePath, const char* fileName,
439 uint32_t address, uint32_t size) {
440 Ftf_Progress_t* progress = Ftf_Progress_Init(phost, filePath, fileName, address, FTF_PROGESS_READ);
441 progress->fileSize = size;
442 while (1) {
443 uint32_t pc = Ftf_Progress_Read_Next(phost, progress);
444 Ftf_Progress_Ui(phost, progress);
445
446 if (pc >= 100) {
447 break;
448 }
449 }
450 Ftf_Progress_Close();
451 return progress->fileSize;
452}
453
463uint32_t Ftf_Write_File_To_Flash_By_Cmd_Fifo(EVE_HalContext* phost, const char* fileName, uint32_t addr, int isErase) {
464 char pBuff[EVE_CMD_FIFO_SIZE];
465 int32_t fileSize = 0;
466 int32_t blocklen = 0;
467
468 //Erase Flash
469 if (isErase && !Ftf_Flash_Erase(phost)) {
470 return 0;
471 }
472
473 // Check flash status
476 return 0;
477 }
478
479 fileSize = FileIO_File_Open(fileName, FILEIO_E_FOPEN_READ);
480
481 if (0 >= fileSize) {
482 printf("Unable to open file: %s\n", fileName);
483 return 0;
484 }
485
487 EVE_Cmd_wr32(phost, addr);
488 EVE_Cmd_wr32(phost, ALIGN(fileSize, FLASH_WRITE_ALIGN_BYTE));
489
491 blocklen = FileIO_File_Read(pBuff, EVE_CMD_FIFO_SIZE);
492 while (blocklen > 0) {
493 int bytes = ALIGN(blocklen, FLASH_WRITE_ALIGN_BYTE);
494 EVE_Cmd_wrMem(phost, pBuff, bytes);
495 blocklen = FileIO_File_Read(pBuff, EVE_CMD_FIFO_SIZE);
496 }
498
499 return fileSize; /* File size */
500}
501
510uint32_t Ftf_Write_FileArr_To_Flash_By_Cmd_Fifo(EVE_HalContext* phost, const char* file[], uint32_t addr) {
511 int i = 0;
512 uint32_t allSize = 0;
513 uint32_t sent = 0;
514 char pBuff[EVE_CMD_FIFO_SIZE];
515 int32_t fileSize = 0;
516 uint32_t blocklen = 0;
517
518 // Erase Flash
519 if (!Ftf_Flash_Erase(phost)) {
520 exit(0);
521 }
522
523 // Check flash status
526 return 0;
527 }
528
529 i = 0;
530 while (file[i] != NULL) {
531 allSize += FileIO_File_Open(file[i], FILEIO_E_FOPEN_READ);
533 i++;
534 }
535
537 EVE_Cmd_wr32(phost, addr);
538 EVE_Cmd_wr32(phost, ALIGN(allSize, FLASH_WRITE_ALIGN_BYTE));
539
540 i = 0;
541 while (file[i] != NULL) {
542 fileSize = FileIO_File_Open(file[i], FILEIO_E_FOPEN_READ);
543
544 if (0 >= fileSize) {
545 printf("Unable to open file: %s\n", file[i]);
546 return sent;
547 }
548
550 do {
551 blocklen = FileIO_File_Read(pBuff, EVE_CMD_FIFO_SIZE);
552 EVE_Cmd_wrMem(phost, pBuff, blocklen);
553 sent += blocklen;
554 } while (blocklen > 0);
555
557
558 i++;
559 }
560
561 int remain = ALIGN(allSize, FLASH_WRITE_ALIGN_BYTE) - sent;
562 if (remain) {
563 memset(pBuff, 0, sizeof(pBuff));
564 EVE_Cmd_wrMem(phost, pBuff, remain);
565 }
566
567 return allSize;
568}
569
578uint32_t Ftf_Write_File_To_Flash_By_RAM_G(EVE_HalContext* phost, const char* fileName, uint32_t addr) {
579 const uint32_t bufferSize = FREAD_BLOCK;
580 uint8_t pbuff[FREAD_BLOCK];
581 uint32_t bytes;
582 uint32_t sent = 0;
583 uint32_t ramGSent = 0;
584
585 // update blob from file first
586 if (addr < BLOBSIZE) {
587 Ftf_Write_BlobFile(phost, fileName);
588 }
589 else {
591 int ret = FlashHelper_SwitchState(phost, FLASH_STATUS_FULL); // full mode
592 if (ret != 0) {
593 Ftf_Write_Blob_Default(phost);
594
595 ret = FlashHelper_SwitchState(phost, FLASH_STATUS_FULL); // full mode
596 if (ret != 0) {
597 printf("Cannot switch flash to fullmode\n");
598 return 0;
599 }
600 }
601 }
602
603 uint32_t fileSize = FileIO_File_Open(fileName, FILEIO_E_FOPEN_READ);
604
605 if (0 >= fileSize) {
606 printf("Unable to open file: %s\n", fileName);
607 return 0;
608 }
609
610 // Ignore Blob data part of file
611 if (addr < BLOBSIZE) {
612 sent = addr = BLOBSIZE;
614 }
615
617 while (sent < fileSize) {
618 // Fill up RAM_G
619 while (ramGSent < RAM_G_SIZE && sent < fileSize) {
620 bytes = FileIO_File_Read(pbuff, bufferSize);
621 if (0 == bytes) {
622 printf("Error on reading file: %s\n", fileName);
623 return 0;
624 }
625 EVE_Hal_wrMem(phost, ramGSent, pbuff, bytes);
626
627 ramGSent += bytes;
628 sent += bytes;
629 }
630
631 // Send RAM_G to Flash
632 ramGSent = (ramGSent + 4095) & (~4095);//to ensure 4KB alignment
633 FlashHelper_Update(phost, addr, 0, ramGSent);
634 addr += ramGSent;
635 }
637
638 return sent; /* File size */
639}
640
649uint32_t Ftf_Write_FileArr_To_Flash_By_RAM_G(EVE_HalContext* phost, const char* file[], uint32_t addr) {
650 int i = 0;
651 uint32_t bytes = 0;
652 uint32_t sent = 0;
653 while (file[i] != NULL) {
654 bytes = Ftf_Write_File_To_Flash_By_RAM_G(phost, file[i], addr);
655 if (!bytes) {
656 printf("Error when write file %s to RAM_G", file[i]);
657 return 0;
658 }
659 addr += bytes;
660 sent += bytes;
661 i++;
662 }
663
664 return sent;
665}
666
676uint32_t Ftf_Read_File_From_Flash(EVE_HalContext* phost, const uint8_t* output, uint32_t address, uint32_t size) {
677 const uint32_t gramaddr = 0;
678 const uint32_t blockSize = 4 * 1024;
679 uint8_t* buff = (char*)malloc(4 * 1024);
680 address = ALIGN(address, 64);
681 size = ALIGN(size, 4);
682 if (!buff) {
683 printf("Unable to malloc\n");
684 return 0;
685 }
686
687 if (-1 == FileIO_File_Open(output, FILEIO_E_FOPEN_WRITE)) {
688 printf("Unable to open file: %s\n", output);
689 free(buff);
690 return 0;
691 }
692
693 uint32_t sent = 0;
694 while (size > 0) {
695 memset(buff, 0, 4 * 1024);
696 uint32_t bytes = blockSize > size ? size : blockSize;
697 FlashHelper_Read(phost, gramaddr, address, bytes, buff);
698 size -= bytes;
699 sent += bytes;
700 address += bytes;
701
702 if (0 == FileIO_File_Write(buff, bytes)) {
703 printf("Unable to write file: %s\n", output);
704 free(buff);
705 return 0;
706 }
707 }
708
710 free(buff);
711
712 return 1;
713}
714
720uint32_t Ftf_Flash_Get_Size(EVE_HalContext* phost) {
722 int32_t size = EVE_Hal_rd32(phost, REG_FLASH_SIZE);
723
724 return size;
725}
726
727#endif
738uint32_t Ftf_Write_File_nBytes_To_RAM_G(EVE_HalContext* phost, const char* file, uint32_t addr, int nbytes, int offset) {
739 const uint32_t BufferSize = FREAD_BLOCK;
740 int32_t bytes;
741 int32_t sent = 0;
742 int32_t fileSize = 0;
743 uint8_t pbuff[FREAD_BLOCK];
744
745 fileSize = FileIO_File_Open(file, FILEIO_E_FOPEN_READ);
746 if (nbytes == 0){
747 nbytes = fileSize;
748 }
749
750 if (offset) {
751 FileIO_File_Seek(offset);
752 }
753
754 if (0 >= fileSize) {
755 printf("Unable to open file: %s\n", file);
756 return 0;
757 }
758 while (fileSize > 0 && sent < nbytes) {
759 bytes = FileIO_File_Read(pbuff, BufferSize);
760 if (bytes == 0) {
761 printf("Error on f_read\n");
762 break;
763 }
764 if ((sent + bytes) > nbytes) {
765 bytes = nbytes - sent;
766 }
767 EVE_Hal_wrMem(phost, addr, pbuff, bytes);
768 fileSize -= bytes;
769 sent += bytes;
770 addr += bytes;
771 }
772
774
775 return sent;
776}
777
787 return Ftf_Write_File_nBytes_To_RAM_G(phost, file, addr, 0, 0);
788}
789
799 int i = 0;
800 uint32_t bytes;
801 uint32_t sent = 0;
802 while (file[i] != NULL) {
803 bytes = Ftf_Write_File_To_RAM_G(phost, file[i], addr);
804 if (0 == bytes) {
805 printf("Error when write file: %s\n", file[i]);
806 return 0;
807 }
808
809 sent += bytes;
810 i++;
811 }
812
813 return sent;
814}
815
825uint32_t Ftf_Read_File_From_RAM_G(EVE_HalContext* phost, const uint8_t* output, uint32_t startAddress, uint32_t size) {
826 if (-1 == FileIO_File_Open(output, FILEIO_E_FOPEN_WRITE)) {
827 printf("Unable to open file: %s\n", output);
828 return 0;
829 }
830
831 uint8_t pbuff[FREAD_BLOCK];
832 uint32_t block = 0;
833 uint32_t offset = 0;
834
835 while (size > 0) {
836 block = size > FREAD_BLOCK ? FREAD_BLOCK : size;
837 EVE_Hal_rdMem(phost, pbuff, startAddress + offset, block);
838 offset += block;
839 size -= block;
840
841 if (0 == FileIO_File_Write(pbuff, block)) {
842 printf("Unable to write file: %s\n", output);
843 return 0;
844 }
845
846 }
848
849 return 1;
850}
Common functions.
EVE_HAL_EXPORT bool EVE_Cmd_wrMem(EVE_HalContext *phost, const uint8_t *buffer, uint32_t size)
Write buffer to Coprocessor's comand fifo.
Definition EVE_Cmd.c:291
EVE_HAL_EXPORT bool EVE_Cmd_wr32(EVE_HalContext *phost, uint32_t value)
Write 4 bytes to Coprocessor's command fifo.
Definition EVE_Cmd.c:394
EVE's co-processor commmands.
static void EVE_CoCmd_clearCache(EVE_HalContext *phost)
Send CMD_CLEARCACHE.
Definition EVE_CoCmd.h:244
static void EVE_CoCmd_flashErase(EVE_HalContext *phost)
Send CMD_FLASHERASE.
Definition EVE_CoCmd.h:644
static void EVE_CoCmd_swap(EVE_HalContext *phost)
Send CMD_SWAP.
Definition EVE_CoCmd.h:170
EVE_HAL_EXPORT void EVE_CoCmd_text(EVE_HalContext *phost, int16_t x, int16_t y, int16_t font, uint16_t options, const char *s,...)
Send CMD_TEXT.
static void EVE_CoCmd_dlStart(EVE_HalContext *phost)
Send CMD_DLSTART.
Definition EVE_CoCmd.h:159
static void EVE_CoCmd_progress(EVE_HalContext *phost, int16_t x, int16_t y, int16_t w, int16_t h, uint16_t options, uint16_t val, uint16_t range)
Send CMD_PROGRESS.
Definition EVE_CoCmd.h:1396
#define CLEAR(c, s, t)
#define DISPLAY()
#define EVE_CMD_FIFO_SIZE
Definition EVE_GpuDefs.h:58
#define COLOR_RGB(red, green, blue)
#define FLASH_STATUS_BASIC
#define REG_FLASH_SIZE
#define FLASH_STATUS_FULL
#define RAM_G_SIZE
Definition EVE_GpuDefs.h:98
#define CMD_FLASHWRITE
#define RAM_G
Definition EVE_GpuDefs.h:77
#define CLEAR_COLOR_RGB(red, green, blue)
#define REG_FLASH_STATUS
EVE_HAL_EXPORT uint32_t EVE_Hal_rd32(EVE_HalContext *phost, uint32_t addr)
Read 4 bytes from Coprocessor's memory.
Definition EVE_Hal.c:189
EVE_HAL_EXPORT void EVE_Hal_rdMem(EVE_HalContext *phost, uint8_t *result, uint32_t addr, uint32_t size)
Read a block data from Coprocessor's memory.
Definition EVE_Hal.c:206
EVE_HAL_EXPORT void EVE_Hal_wrMem(EVE_HalContext *phost, uint32_t addr, const uint8_t *buffer, uint32_t size)
Write a buffer to Coprocessor's memory.
Definition EVE_Hal.c:263
EVE_HAL_EXPORT uint8_t EVE_Hal_rd8(EVE_HalContext *phost, uint32_t addr)
Read 8 bits from Coprocessor's memory.
Definition EVE_Hal.c:157
unsigned short uint16_t
int int32_t
unsigned int uint32_t
unsigned long long uint64_t
unsigned char uint8_t
static ft_uint32_t addr
Definition FT_Gpu_Hal.h:139
int FileIO_File_Read(char *buffer, long bytes)
Definition FileIo.c:509
int FileIO_File_Seek(unsigned long offset)
Definition FileIo.c:506
int FileIO_File_Write(const char *buffer, long buffersize)
Definition FileIo.c:510
int FileIO_File_Open(const char *filePath, enum _FILEIO_E_FOPEN e)
Definition FileIo.c:508
int FileIO_File_Close()
Definition FileIo.c:505
int FileIO_File_To_Buffer(const char *file, char *buff, long offset, int size, int *byteCount)
Read a whole file to a buffer.
Definition FileIo.c:525
File read-write library for Eve application, support a unique interface for every platform.
@ FILEIO_E_FOPEN_READ
Definition FileIo.h:40
@ FILEIO_E_FOPEN_WRITE
Definition FileIo.h:40
uint32_t Ftf_Write_File_nBytes_To_RAM_G(EVE_HalContext *phost, const char *file, uint32_t addr, int nbytes, int offset)
Transfer a file to RAM_G.
uint32_t Ftf_Write_File_To_RAM_G(EVE_HalContext *phost, const char *file, uint32_t addr)
Transfer a file to RAM_G.
#define BLOBSIZE
#define FILE_BLOB
Use BT815 blob as default.
#define ALIGN(x, a)
#define FREAD_BLOCK
uint32_t Ftf_Write_FileArr_To_RAM_G(EVE_HalContext *phost, char *file[], uint32_t addr)
Transfer a file list into RAM_G.
uint32_t Ftf_Read_File_From_RAM_G(EVE_HalContext *phost, const uint8_t *output, uint32_t startAddress, uint32_t size)
Read data on RAM_G into a file.
File transfer interface from host to flash.
#define FTF_PROGESS_WRITE
#define FTF_PROGESS_READ
#define MSG_SIZE
uint32_t FlashHelper_SwitchFullMode(EVE_HalContext *phost)
Flash_Cmd_Status_t FlashHelper_Read(EVE_HalContext *phost, uint32_t dest_ram, uint32_t src_flash, uint32_t num, uint8_t *read_data)
uint32_t FlashHelper_SwitchState(EVE_HalContext *phost, uint8_t nextState)
Flash_Cmd_Status_t FlashHelper_Update(EVE_HalContext *phost, uint32_t dest_flash, uint32_t src_ram, uint32_t num)
void EVE_Cmd_waitFlush(EVE_HalContext *host)
Definition Gpu_Hal.cpp:775
#define DispHeight
Definition Gpu_Hal.h:106
@ FLASH_CMD_SUCCESS
Definition Gpu_Hal.h:414
#define DispWidth
Definition Gpu_Hal.h:105
#define FLASH_WRITE_ALIGN_BYTE
Definition Gpu_Hal.h:418
uint32_t addr
char fileName[100]
char file[300]
char message[200]
uint32_t fileSize
uint32_t bytesPerPercent
uint32_t sent
uint8_t direction