chg: remove warnings on coverity

chg: encapsule flasmem function calls
This commit is contained in:
Chris 2018-09-16 20:47:23 +02:00
commit 02cc278e19
4 changed files with 18 additions and 20 deletions

View file

@ -153,8 +153,7 @@ void SpinUp(uint32_t speed)
LED_D_OFF(); LED_D_OFF();
} }
void TestFlashmemSpeed(size_t buffersize, uint32_t spibaudrate) void TestFlashmemSpeed(size_t buffersize, uint32_t spibaudrate) {
{
FLASHMEM_SPIBAUDRATE = spibaudrate*1000000; FLASHMEM_SPIBAUDRATE = spibaudrate*1000000;
DbprintfEx(FLAG_NOLOG, "%s---+----[ %s %s[%dKB] %s] (%d)", _GREEN_, _WHITE_, _YELLOW_, buffersize / 1024, _WHITE_, FLASHMEM_SPIBAUDRATE); DbprintfEx(FLAG_NOLOG, "%s---+----[ %s %s[%dKB] %s] (%d)", _GREEN_, _WHITE_, _YELLOW_, buffersize / 1024, _WHITE_, FLASHMEM_SPIBAUDRATE);
@ -230,9 +229,7 @@ void TestFlashmemRoutine()
return; return;
} }
void ReadLastTagFromFlash() void ReadLastTagFromFlash() {
{
SpinOff(0); SpinOff(0);
LED_A_ON(); LED_A_ON();
LED_B_ON(); LED_B_ON();
@ -248,8 +245,7 @@ void ReadLastTagFromFlash()
size_t size = len; size_t size = len;
uint8_t *mem = BigBuf_malloc(size); uint8_t *mem = BigBuf_malloc(size);
if (!FlashInit()) if (!FlashInit()) {
{
return; return;
} }
Flash_CheckBusy(BUSY_TIMEOUT); Flash_CheckBusy(BUSY_TIMEOUT);
@ -309,9 +305,7 @@ void WriteTagToFlash(uint8_t index, size_t size)
// cnt = 0; // cnt = 0;
emlGetMem(data, 0, (size * 64)/1024); emlGetMem(data, 0, (size * 64)/1024);
//if (!FlashFastReadInit()){ if (!FlashInit()){
if (!FlashInit())
{
return; return;
} }

View file

@ -38,6 +38,10 @@
#include "usart.h" #include "usart.h"
#endif #endif
#ifdef WITH_FLASH
#include "flashmem.h"
#endif
//============================================================================= //=============================================================================
// A buffer where we can queue things up to be sent through the FPGA, for // A buffer where we can queue things up to be sent through the FPGA, for
// any purpose (fake tag, as reader, whatever). We go MSB first, since that // any purpose (fake tag, as reader, whatever). We go MSB first, since that
@ -387,7 +391,9 @@ void printUSBSpeed(void) {
void SendStatus(void) { void SendStatus(void) {
BigBuf_print_status(); BigBuf_print_status();
Fpga_print_status(); Fpga_print_status();
#ifdef WITH_FLASH
Flashmem_print_status(); Flashmem_print_status();
#endif
#ifdef WITH_SMARTCARD #ifdef WITH_SMARTCARD
I2C_print_status(); I2C_print_status();
#endif #endif
@ -1222,7 +1228,9 @@ void UsbPacketReceived(uint8_t *packet, int len) {
uint8_t *mem = BigBuf_malloc(size); uint8_t *mem = BigBuf_malloc(size);
FlashInit(); if (!FlashInit()) {
break;
}
//Flash_CheckBusy(BUSY_TIMEOUT); //Flash_CheckBusy(BUSY_TIMEOUT);
for(size_t i = 0; i < len; i += size) { for(size_t i = 0; i < len; i += size) {
@ -1251,8 +1259,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
uint32_t tmp = startidx + len; uint32_t tmp = startidx + len;
if (!FlashInit()) if (!FlashInit()) {
{
break; break;
} }
@ -1322,8 +1329,10 @@ void UsbPacketReceived(uint8_t *packet, int len) {
// arg0 = startindex // arg0 = startindex
// arg1 = length bytes to transfer // arg1 = length bytes to transfer
// arg2 = RFU // arg2 = RFU
FlashInit(); if (!FlashInit()) {
break;
}
for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) { for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) {
len = MIN((numofbytes - i), USB_CMD_DATA_SIZE); len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);

View file

@ -485,9 +485,6 @@ void Flash_EraseChip(void) {
FlashSendLastByte(CHIPERASE); FlashSendLastByte(CHIPERASE);
} }
void Flashmem_print_status(void) { void Flashmem_print_status(void) {
DbpString("Flash memory"); DbpString("Flash memory");
Dbprintf(" Baudrate................%dMHz",FLASHMEM_SPIBAUDRATE/1000000); Dbprintf(" Baudrate................%dMHz",FLASHMEM_SPIBAUDRATE/1000000);

View file

@ -1815,7 +1815,6 @@ void setupIclassReader() {
SetAdcMuxFor(GPIO_MUXSEL_HIPKD); SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
// Reset trace buffer
clear_trace(); clear_trace();
set_tracing(true); set_tracing(true);
@ -1824,7 +1823,6 @@ void setupIclassReader() {
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_READER_MOD); FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_READER_MOD);
SpinDelay(300); SpinDelay(300);
// Start the timer
StartCountSspClk(); StartCountSspClk();
LED_A_ON(); LED_A_ON();