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 CCS Technical Support

Error Codes <errno.h> where are they?

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



Joined: 09 Sep 2009
Posts: 7

View user's profile Send private message

Error Codes <errno.h> where are they?
PostPosted: Mon Jan 13, 2014 3:46 pm     Reply with quote

I am writing some code for PIC24 target, and I am interest to know whether or not spi_xfer() failed or not. Since this is a canned function something may go wrong and I want to report that. Using errno.h header file the variable errno gets written by the error code which caused the error which will be a number other than 0.

1. How do I find out a list of error codes within CCS compiler? I want to know if the number is 2233 maybe that mean the SPITXBUF got overwritten or something like that. Does anyone know the error codes?

regards,

rjrodrig
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue Jan 14, 2014 2:04 am     Reply with quote

Errno.h, is for maths errors. Nothing to do with spi.
For rs232, there is a single variable RS232_ERRORS, with a couple of bits reflecting the hardware error bits. Nothing more.
For SPI, the only errors are the hardware bits.

You need to understand, that the CCS functions, are not high level functions talking to an OS, but really basic low level functions talking just directly to the port hardware. As such, there is no library of error numbers, but just what the hardware gives you.

So there are no 'error codes'. Just direct testing of the hardware error bits. If you want to generate error codes, then your software will have to generate them.

You can see what is done, by looking at the assembler generated for an spi_xfer. The presence of errno.h, makes no difference to the code generated.

Best Wishes
rjrodrig



Joined: 09 Sep 2009
Posts: 7

View user's profile Send private message

PostPosted: Tue Jan 14, 2014 10:22 am     Reply with quote

Well I was talking more in a generic sense. For example the canned function could look at the SPISTAT register and look at what happened there and report a a flag into a variable. That is all I am asking. I was trying to avoid doing this redundantly if the function already did it. For all peripherals there are hardware stats one can query. Since it is no where in the manuals I had to resort to posting. I will just do it myself I was just hoping someone at CCS had done the leg work, and I was just trying to piggy back on it.
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