Pret
Joined: 18 Jul 2006 Posts: 92 Location: Iasi, Romania
|
CCS drivers reliability (MMC/SD) |
Posted: Sun Jan 20, 2008 1:00 pm |
|
|
During my experience in CCS compiler, i have found some bugs in their driver implementations. Is not really a shock, but what is really troubles me is that they are not testing some code paths at all. For example, taking the mmcsd.c driver. Regarding CRC checks i have found: Code: | // if the CRC is enabled we have to calculate it, otherwise just send an 0xFFFF
if(g_CRC_enabled)
spi_xfer(mmcsd_spi, mmcsd_crc16(ptr, size));
else
{
spi_xfer(mmcsd_spi, 0xFF);
spi_xfer(mmcsd_spi, 0xFF);
} | If Crc is enabled, does spi_xfer sends two bytes of crc16 or just the low order byte? The spi_xfer documentation says that Code: | data is the variable or constant to transfer via SPI. The pin used to transfer data is defined in the DO=pin option in #use spi. | and nothing more related with the size. In #use statement appears BITS=8.
Moreover, in Code: | if(make16(spi_xfer(mmcsd_spi, 0xFF), spi_xfer(mmcsd_spi, 0xFF)) != mmcsd_crc16(g_mmcsd_buffer, MMCSD_MAX_BLOCK_SIZE)) | where Code: | #define MMCSD_MAX_BLOCK_SIZE 512 | and Code: | unsigned int16 mmcsd_crc16(char *data, unsigned int8 length); | We have an int8 length and 512 value passed. Not commenting the fact that CRC is disabled by default in the very first initialization routine.
This gives me some "emotions" when i'm delivering projects that contains CCS drivers like usb, i2c, lcd and who knows... build-in functions that you really dont know what's in there... |
|