Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
841 Views

Printing 32bit signed long data alt_32

Hi,

 

I'm trying to print out returned alt_32 data from functions defined in drivers via the JTAG UART in a Nios II system. Execuse me for being newbie on this, here are my code lines:

 

alt_32 ret_code;

 

ret_code = altera_epcq_controller_init ("/dev/epcq_controller_0");

 

printf("ret_code     = %x \n", (unsigned int) ret_code);

 

it returns an hexa value but I need to print out the following format:

-EINVAL

-EIO

 

Thank you for telling me what I suppose to write for printing out the alt_32 data.

Tags (2)
0 Kudos
2 Replies
Highlighted
New Contributor II

Re: Printing 32bit signed long data alt_32

Hello,

The only solution is do something like

#include "ErrNo.h"

 

if (ret_code == EIO) printf("EIO");

 

EIO is a symbol that is defined in one of the header files. (ERRNO.H)

The preprocessor replaces EIO with a decimal or hex value of 5 before compiling.

 

See below an extract of the file:

/*

 * Error numbers.

 * TODO: Can't be sure of some of these assignments, I guessed from the

 * names given by strerror and the defines in the Cygnus errno.h. A lot

 * of the names from the Cygnus errno.h are not represented, and a few

 * of the descriptions returned by strerror do not obviously match

 * their error naming.

 */

#define EPERM 1 /* Operation not permitted */

#define ENOFILE 2 /* No such file or directory */

#define ENOENT 2

#define ESRCH 3 /* No such process */

#define EINTR 4 /* Interrupted function call */

#define EIO 5 /* Input/output error */

#define ENXIO 6 /* No such device or address */

#define E2BIG 7 /* Arg list too long */

#define ENOEXEC 8 /* Exec format error */

#define EBADF 9 /* Bad file descriptor */

#define ECHILD 10 /* No child processes */

#define EAGAIN 11 /* Resource temporarily unavailable */

#define ENOMEM 12 /* Not enough space */

#define EACCES 13 /* Permission denied */

#define EFAULT 14 /* Bad address */

/* 15 - Unknown Error */

 

 

Best regards,

Johi.

Highlighted
Beginner

Re: Printing 32bit signed long data alt_32

Hi JOHI,

 

Thank you for your reply, this helped me too much..

 

Best regards

CR

0 Kudos