bosko lekovic
/
ETHtoCOM_10
nova verzija tcp+udp->serial com
Diff: DataFlash/flashDataBlock.cpp
- Revision:
- 22:11279d24a105
- Parent:
- 13:03617f6ed112
- Child:
- 26:c14d034d7459
diff -r 2232f5a34eb4 -r 11279d24a105 DataFlash/flashDataBlock.cpp --- a/DataFlash/flashDataBlock.cpp Mon May 25 22:19:36 2020 +0200 +++ b/DataFlash/flashDataBlock.cpp Thu Jun 11 10:41:11 2020 +0200 @@ -18,19 +18,29 @@ int erase_size; int erase_value; int buffer_dimension = buffer_dimension; -void init_fdb( ) +int init_fdb( ) { // Initialize the flash IAP block device and print the memory layout int err = bd.init(); - printf("init err=%d \n\r", err); + if( err ) { printf("flash data block init err=%d \n\r", err); return 1; } + else printf("flash data block init OK \n\r"); + + device_size = bd.size(); + read_size = bd.get_read_size(); + program_size = bd.get_program_size(); + erase_size = bd.get_erase_size(); + erase_value = bd.get_erase_value(); - printf("Flash block device size: %x\n\r", device_size = bd.size()); - printf("Flash block device read size: %x\n\r", read_size = bd.get_read_size()); - printf("Flash block device program size: %x\n\r", program_size = bd.get_program_size()); - printf("Flash block device erase size: %x\n\r", erase_size = bd.get_erase_size()); - printf("Flash block device geterase value: %x\n\r", erase_value = bd.get_erase_value()); + // printf("Flash block device size: %x\n\r", device_size = bd.size()); + // printf("Flash block device read size: %x\n\r", read_size = bd.get_read_size()); + // printf("Flash block device program size: %x\n\r", program_size = bd.get_program_size()); + // printf("Flash block device erase size: %x\n\r", erase_size = bd.get_erase_size()); + // printf("Flash block device geterase value: %x\n\r", erase_value = bd.get_erase_value()); - if( bd.is_valid_read( 0, bd.get_read_size() ) ) printf(" read valid \n\r"); + if( bd.is_valid_read( 0, bd.get_read_size() ) ) printf(" flash data block read valid \n\r"); + else {printf(" flash data block read NOT valid \n\r"); return 2;} + + return 0; } void deinit_fdb( void )