iSDIO library for FlashAir
Dependents: FlashAir_iSDIO_sample FlashAir_iSDIO_16seg_ADT7410_step1 FlashAir_iSDIO_16seg_ADT7410 FlashAir_iSDIO_sample_OS5_ ... more
Revision 2:b8b33621e7fe, committed 2019-01-19
- Comitter:
- hogejun
- Date:
- Sat Jan 19 04:31:16 2019 +0000
- Parent:
- 1:dc888b9028cf
- Commit message:
- modified debug output
Changed in this revision
FlashAir_iSDIO.cpp | Show annotated file Show diff for this revision Revisions of this file |
iSDIO.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dc888b9028cf -r b8b33621e7fe FlashAir_iSDIO.cpp --- a/FlashAir_iSDIO.cpp Wed Aug 29 04:04:52 2018 +0000 +++ b/FlashAir_iSDIO.cpp Sat Jan 19 04:31:16 2019 +0000 @@ -14,6 +14,7 @@ instance = this ; sequenceId = 0 ; _console = console ; + if (_console != NULL) _console->printf("new FlashAIr_iSDIO\n"); } @@ -30,6 +31,7 @@ //} uint8_t FlashAir_iSDIO::wlan_disconnect(uint32_t sequenceId) { + if (_console != NULL) _console->printf("\nDisconnect command: \n"); memset(cmdbuffer, 0, sizeof(cmdbuffer)); uint8_t* p = cmdbuffer; @@ -42,6 +44,7 @@ } uint8_t FlashAir_iSDIO::wlan_establish(uint32_t sequenceId, const uint8_t *ssid, const uint8_t *networkkey, const uint8_t encmode) { + if (_console != NULL) _console->printf("\nEstablish command: \n"); memset(cmdbuffer, 0, sizeof(cmdbuffer)); uint8_t* p = cmdbuffer; @@ -56,6 +59,7 @@ } uint8_t FlashAir_iSDIO::wlan_connect(uint32_t sequenceId, const uint8_t* ssid, const uint8_t* networkKey) { + if (_console != NULL) _console->printf("\nConnect command: \n"); memset(cmdbuffer, 0, sizeof(cmdbuffer)); uint8_t* p = cmdbuffer; @@ -70,6 +74,7 @@ uint8_t FlashAir_iSDIO::wlan_scan(uint32_t sequenceId) { + if (_console != NULL) _console->printf("\nScan: \n"); memset(cmdbuffer, 0, sizeof(cmdbuffer)); uint8_t *p = cmdbuffer; @@ -85,6 +90,7 @@ uint8_t ret ; ret = readExtMemory(MIO_IO, FUNC1, ISDIO_VENDOR+offset, length, dst); + if (_console != NULL) _console->printf("read_shared_memory:\n"); printHex((uint8_t*)dst, (uint32_t)length); return ret ; @@ -92,6 +98,7 @@ uint8_t FlashAir_iSDIO::write_shared_mem(uint32_t offset, uint8_t* src, uint16_t length) { + if (_console != NULL) _console->printf("write_shared_mem:\n"); printHex((uint8_t*)src, (uint32_t)length);
diff -r dc888b9028cf -r b8b33621e7fe iSDIO.cpp --- a/iSDIO.cpp Wed Aug 29 04:04:52 2018 +0000 +++ b/iSDIO.cpp Sat Jan 19 04:31:16 2019 +0000 @@ -49,6 +49,7 @@ instance = this; _console = console; sequenceId = 0; + if (_console != NULL) _console->printf("new iSDIO\n"); } @@ -63,6 +64,7 @@ uint32_t iSDIO::getSequenceId() { + if (_console != NULL) _console->printf("sequenceId: %d\n", sequenceId); return sequenceId; } @@ -70,6 +72,7 @@ uint32_t iSDIO::getNextSequenceId() { sequenceId++; + if (_console != NULL) _console->printf("Next sequenceId: %d\n", sequenceId); return sequenceId; } @@ -201,6 +204,7 @@ (((uint32_t)mio & 0x1) << 31) | (mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) | (((uint32_t)addr & 0x1FE00) << 9); + if (_console != NULL) _console->printf("arg = %08x\n", arg); return writeExt(arg, src, 512); } @@ -219,10 +223,13 @@ (mio ? (((uint32_t)func & 0x7) << 28) : (((uint32_t)func & 0xF) << 27)) | ((addr & 0x1FFFF) << 9) | ((count - 1) & 0x1FF); + if (_console != NULL) { _console->printf("writeExtMemory: "); _console->printf(" addr: %08x\n", addr); _console->printf(" src: "); + } printHex((uint8_t*)src, (uint32_t)count); + if (_console != NULL) _console->printf(" count: %d\n", count); return writeExt(arg, src, count); } @@ -249,7 +256,7 @@ uint8_t iSDIO::waitResponse(uint32_t sequenceId) { uint8_t buffer[ISDIO_STATUS_QUEUE_SIZE]; - + if(_console != NULL) _console->printf("\nWaiting response "); uint8_t prev = 0xFF; for (int i = 0; i < 20; ++i) { @@ -263,28 +270,36 @@ if (prev != resp) { switch (resp) { case 0x00: + if (_console != NULL) _console->printf("\n Initial"); break; case 0x01: + if (_console != NULL) _console->printf("\n Command Processing"); break; case 0x02: + if (_console != NULL) _console->printf("\n Command Rejected"); return false; case 0x03: + if (_console != NULL) _console->printf("\n Process Succeeded"); return true; case 0x04: + if (_console != NULL) _console->printf("\n Process Terminated"); return false; default: + if (_console != NULL) { _console->printf("\n Process Failed "); _console->printf("%x", resp); + } return false; } prev = resp; } } + if (_console != NULL) _console->printf("."); wait_ms(1000); } @@ -295,8 +310,10 @@ void iSDIO::printByte(uint8_t value) { + if (_console != NULL) { _console->printf("%x", value >> 4); _console->printf("%x", value & 0xF); + } } void iSDIO::printBytes(uint8_t* p, uint32_t len) { @@ -308,12 +325,15 @@ int i = 0; while (i < len) { if ((i & 0xf) == 0) { + if (_console != NULL) _console->printf("\n"); printByte(i >> 4); + if (_console != NULL) _console->printf(": "); } printByte(*p++); i++; } + if (_console != NULL) _console->printf("\n"); }