F
fazulu deen
hi all,
I am working in ARM9(AT91rm9200),I need to develop small diagniostic
code to test the configured gpio lines through loopback test(one end I
will write somthing in other end i need to read the same through
registers).
I am not able to print the datatypes (Other than character),While i am
trying to print some garbage value are printed.
with the following lines :
diag_printf ("\r\nConfigured Port A= %x", *(VULONG*)0XFFFFF418);
int gpio_data_counter = 0;
diag_printf("\r\n %d Noordeen\r\n",gpio_data_counter);
void
diag_printf (const char *format,...)
{
int *dataptr = (int *) &format;
char c, str[16];
unsigned long mask = 0xFFFFFFFF;
dataptr++;
while ((c = *(format++)) != 0)
{
if (c != '%')
diag_putchar (c);
else
switch (c = *(format++))
{
case 'b':
mask = 0xFF;
/* Fall down intentionally! */
case 'd':
case 'x':
case 'X':
case 'u':
*convert_to_ascii (str, c , *((unsigned long *) dataptr++) &
mask )= 0;
diag_putstr (str);
break;
case 'c':
diag_putchar ((*(dataptr++)) & 0xff);
break;
case 's':
diag_putstr ((char *) *(dataptr++));
break;
}
}
}
Kindly suggest...
regards,
fazal
I am working in ARM9(AT91rm9200),I need to develop small diagniostic
code to test the configured gpio lines through loopback test(one end I
will write somthing in other end i need to read the same through
registers).
I am not able to print the datatypes (Other than character),While i am
trying to print some garbage value are printed.
with the following lines :
diag_printf ("\r\nConfigured Port A= %x", *(VULONG*)0XFFFFF418);
int gpio_data_counter = 0;
diag_printf("\r\n %d Noordeen\r\n",gpio_data_counter);
void
diag_printf (const char *format,...)
{
int *dataptr = (int *) &format;
char c, str[16];
unsigned long mask = 0xFFFFFFFF;
dataptr++;
while ((c = *(format++)) != 0)
{
if (c != '%')
diag_putchar (c);
else
switch (c = *(format++))
{
case 'b':
mask = 0xFF;
/* Fall down intentionally! */
case 'd':
case 'x':
case 'X':
case 'u':
*convert_to_ascii (str, c , *((unsigned long *) dataptr++) &
mask )= 0;
diag_putstr (str);
break;
case 'c':
diag_putchar ((*(dataptr++)) & 0xff);
break;
case 's':
diag_putstr ((char *) *(dataptr++));
break;
}
}
}
Kindly suggest...
regards,
fazal