CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Strange code in FAT_spi.c

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
eskimobob



Joined: 07 Feb 2009
Posts: 40

View user's profile Send private message

Strange code in FAT_spi.c
PostPosted: Mon Feb 16, 2009 3:50 pm     Reply with quote

Can anyone who is familiar with using SD/MMC cards with the CCS drivers FAT_pic.c and FAT_spi.c tell me if this code is sensible:

In "FAT_spi.c", there is the function "mmc_send_cmd". At the end of this function, there is the following code:

Code:

   for(i = 1; i < bytes; i++)
      out[i] = spi_read(0xFF);


The strange thing is that a few lines above this, we find:

Code:

   bytes = 1;


Which means that the for loop will never be executed.

Surely there is a mistake in the driver? - Either that bit of code is pointless and should not be included or the variable "bytes" should sometimes not be set to 1.

Unless someone can shed some light on this, I will have to delve into the MMC specification Confused

Edit - This is odd. I thought I'd just ensure that the drivers I'm using (supplied with the Ethernet dev kit) are up to date with those in the CCS installation directory and it appears they are significantly different!

What I have as FAT_pic.c appears to be very similar to fat.c and what I have as FAT_spi.c appears to be similar to mmc_spi.c. The question I posed seems only to apply to the driver versions supplied with the dev kit Confused

Off to investigate further...
KONAMI



Joined: 29 Aug 2010
Posts: 11

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Wed Mar 14, 2012 8:25 am     Reply with quote

I can help u
but i should see code(complet) before help you.
So thing I am asking you is to post entire code here so I will read and then help you.
I am talking of the fat_pic.c fat_pic.h and then your code.


+++++++++++++++++++++++
No, Konami. See forum rule #10:

10. Don't post the CCS example code or drivers, or ask for such code and drivers.

Forum Rules:
http://www.ccsinfo.com/forum/viewtopic.php?t=26245

- Forum Moderator
+++++++++++++++++++++++
eskimobob



Joined: 07 Feb 2009
Posts: 40

View user's profile Send private message

PostPosted: Wed Mar 14, 2012 8:41 am     Reply with quote

It's the standard CCS code so you will already have it - I can't post it here anyway ;-)

This thread is over 3 years old so it may well have been modified in the latest CCS code - have a look 8-)

Edit: moderator beat me to it...
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Mar 14, 2012 11:26 am     Reply with quote

The code is part of the CCS TCP/IP Examples, that are not presently available for download. You are right about the respective code block. Apparently, it has been originally intended to read longer responses in mmc_send_cmd(). Because CCS C isn't able to detect it as dead code, you should comment it.

The version of FAT_SPI.c I have has a file date of 2007. I don't think that this version of the MHCP TCP/IP stack and MDD file system will be further maintained by CCS.
eskimobob



Joined: 07 Feb 2009
Posts: 40

View user's profile Send private message

PostPosted: Wed Mar 14, 2012 4:07 pm     Reply with quote

FvM wrote:
Because CCS C isn't able to detect it as dead code, you should comment it.


I'm not actually using it ;-) I was experimenting with the CCS web dev kit back when I first posted this 3 years ago.

FvM wrote:
The version of FAT_SPI.c I have has a file date of 2007. I don't think that this version of the MHCP TCP/IP stack and MDD file system will be further maintained by CCS.


I remember a CCS comment before V4 was released along the lines that they expected the MCHP TCP/IP stack to compile under V4 so we would have access to the latest version. I've not checked since but presumably that didn't come to anything?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Mar 15, 2012 12:40 am     Reply with quote

Quote:
I remember a CCS comment before V4 was released along the lines that they expected the MCHP TCP/IP stack to compile under V4 so we would have access to the latest version. I've not checked since but presumably that didn't come to anything?

I didn't yet plan to use the MCHP stack with PIC 18 or PIC24 and CCS C. I'm only using it with PIC32. As all MHCP code, I would expect it to be portable to CCS C somehow, but some adaptions are most likely required. I don't think, that it applies as beginners project.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group