hal_diag.h File Reference


Detailed Description

HAL Support for Kernel Diagnostic Routines.

Author:
yoshinori sato, Uwe Kindler
Date:
2003-12-06
Diagnostic routines for use during kernel development.

Usage: #include <cyg/hal/hal_diag.h>

Definition in file hal_diag.h.

Go to the source code of this file.

Functions

externC void hal_plf_diag_init (void)
 Initializes diagnostic channels (Virtual Vectors not present).

externC void hal_diag_read_char (char *c)
 Read character from diagnostic device.

externC void hal_diag_write_char (char c)
 Write char to diagnostic device.

externC int hal_diag_put_buf (const char *pbuf_in, int len_in)
 Outputs a buffer of len_in bytes via diagnostic device.

externC void hal_diag_put_string (unsigned char *pstr_in)
 Sends zero terminated string through diagnostic device.

externC void hal_diag_put_long (unsigned long l_in)
 Send long value through diagnostic serial channel.

externC void hal_diag_put_long_hex (long l_in)
 Converts long into hex string and sends it through diagnostic device.


Function Documentation

externC int hal_diag_put_buf const char *  pbuf_in,
int  len_in
 

Outputs a buffer of len_in bytes via diagnostic device.

Parameters:
pbuf_in Points to buffer with date to be sent
len_in Number of bytes to be sent
Returns:
A simple checksum.

Definition at line 209 of file hal_diag.c.

References hal_diag_write_char().

Referenced by hal_diag_put_long_hex().

00210 {
00211    unsigned char sum;
00212 
00213 
00214    sum = 0;
00215    while (len_in--)
00216    {
00217       sum += *(unsigned char*)pbuf_in;
00218       hal_diag_write_char(*pbuf_in++);
00219    }
00220 
00221    return sum;
00222 }

Here is the call graph for this function:

externC void hal_diag_put_long unsigned long  l_in  ) 
 

Send long value through diagnostic serial channel.

Converts long number into a number string and sends it through serial channel.

Parameters:
l_in Long number to be send

Definition at line 250 of file hal_diag.c.

References hal_diag_write_char().

00251 {
00252    unsigned char charbuf[10];
00253    unsigned char i;
00254 
00255 
00256    //
00257    // A zero value is a special case - we send zero char and leave
00258    //
00259    if (l_in == 0)
00260    {
00261        hal_diag_write_char('0');
00262        return;
00263    }
00264 
00265    //
00266    // Here we calculate the entries for the char buffer. We start with
00267    // the least significant number and devide by 10 until l_in = zero.
00268    // An ASCII offset is added to get a char from a numeric value.
00269    //
00270    i = 9;
00271    while (l_in > 0)
00272    {
00273       charbuf[i] = (l_in % 10) + '0';
00274       i--;
00275       l_in = l_in / 10;
00276    }
00277 
00278    //
00279    // This part sends the content of the charbuffer out through serial
00280    // interface
00281    //
00282    i++;
00283    while (i < 10)
00284    {
00285       hal_diag_write_char(charbuf[i]);
00286       i++;
00287    }
00288 }

Here is the call graph for this function:

externC void hal_diag_put_long_hex long  l_in  ) 
 

Converts long into hex string and sends it through diagnostic device.

Parameters:
l_in Long number to be sent

Definition at line 356 of file hal_diag.c.

References hal_diag_put_buf(), and hal_long_to_hexbuf().

00357 {
00358     unsigned char hexbuf[10] = "0x";
00359     unsigned char len = 2;
00360 
00361 
00362     len += hal_long_to_hexbuf(l_in, &hexbuf[2]);
00363     hal_diag_put_buf(hexbuf, len);
00364 }

Here is the call graph for this function:

externC void hal_diag_put_string unsigned char *  pstr_in  ) 
 

Sends zero terminated string through diagnostic device.

Parameters:
pstr_in Pointer to zero terminated string

Definition at line 232 of file hal_diag.c.

References hal_diag_write_char().

00233 {
00234    while (*pstr_in != '\0')       // repeat until detection of terminating zero
00235    {
00236       hal_diag_write_char(*pstr_in++);
00237    }
00238 }

Here is the call graph for this function:

externC void hal_diag_read_char char *  c  ) 
 

Read character from diagnostic device.

If we do not use virtual vector comm channels then we have to use this function.

Parameters:
c Stores received character

Definition at line 193 of file hal_diag.c.

References hal_sci_getc(), and pchannel.

00194 {
00195     *c = (char) hal_sci_getc((void *)pchannel);
00196 }

Here is the call graph for this function:

externC void hal_diag_write_char char  c  ) 
 

Write char to diagnostic device.

If we do not use virtual vector comm channels then we have to use this function.

Parameters:
c Char to be written to diagostic device

Definition at line 178 of file hal_diag.c.

References hal_sci_putc(), and pchannel.

Referenced by hal_diag_put_buf(), hal_diag_put_long(), and hal_diag_put_string().

00179 {
00180     hal_sci_putc((void *)pchannel, c);
00181 }

Here is the call graph for this function:

externC void hal_plf_diag_init void   ) 
 

Initializes diagnostic channels (Virtual Vectors not present).

If we do not use virtual vector comm channels then we have to initialize the hardwired debug channel manual. We use the common diagnostic code provided by H8S architecture HAL

Definition at line 166 of file plf_diag.c.

References channel, and hal_diag_init().

00167 {
00168     hal_diag_init(&channel);
00169 }

Here is the call graph for this function:


Generated on Tue Feb 17 09:06:16 2004 for eCos EDOSK-2674 HAL by doxygen 1.3.5