Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

IdeDebug.h File Reference

IDE driver::Debug header. More...

#include <const.h>

Go to the source code of this file.

Data Structures

struct  CmdNames_Struct
struct  ErrNames_Struct

Defines

#define DBG_SHOWMAT_ASCII   1
#define DBG_SHOWMAT_HEX   2

Typedefs

typedef CmdNames_Struct CmdNames_Struct
typedef ErrNames_Struct ErrNames_Struct

Functions

char * GetIdeErrorMessage (int Err)
void ShowIdeErrorMessage (int Err, int Dump)
void ShowIdeRegisterDump ()
void PrintByteHex (byte Data)
void ShowMatrixData (char *DataBuffer, int Col, int BytePerCol, int RowToWait, int Len, int Mode)


Detailed Description

IDE driver::Debug header.

Author:
Luca Giovacchini
Date:
Last update: 2003-11-07
Note:
Copyright (©) 2003 Luca Giovacchini
This driver is based on Atadrv by Hale Landis but it is completely rearranged for the minirighi32.
IMPORTANT!!!
Here you can find code for debugging and showing errors.

Definition in file IdeDebug.h.


Define Documentation

#define DBG_SHOWMAT_ASCII   1
 

Definition at line 20 of file IdeDebug.h.

#define DBG_SHOWMAT_HEX   2
 

Definition at line 21 of file IdeDebug.h.


Typedef Documentation

typedef struct CmdNames_Struct CmdNames_Struct
 

typedef struct ErrNames_Struct ErrNames_Struct
 


Function Documentation

char* GetIdeErrorMessage int    Err
 

Definition at line 132 of file IdeDebug.c.

00133 {
00134         int i=0;
00135         while (ErrNames[i].ErrCode != 0x00 && ErrNames[i].ErrCode != Err)
00136                 i++;
00137 
00138         return ErrNames[i].ErrName;
00139 }

void PrintByteHex byte    Data
 

Definition at line 200 of file IdeDebug.c.

00201 {
00202         kputchar(hex_table[(Data>>4) & 0xF]);
00203         kputchar(hex_table[(Data) & 0xF]);
00204 }

void ShowIdeErrorMessage int    Err,
int    Dump
 

Definition at line 146 of file IdeDebug.c.

00147 {
00148         int i=0;
00149         int j=0;
00150 
00151         if (Err!=0x00)
00152         {
00153                 while (ErrNames[i].ErrCode != 0x00 && ErrNames[i].ErrCode != Err)
00154                         i++;
00155 
00156                 kprintf("\n\rIde Driver Error: ");
00157 
00158                 if (ErrNames[i].ErrCode != 0x00)
00159                         kprintf("%s",ErrNames[j].ErrName);
00160                 else
00161                         // if we are here the error code is not 0 and is not found
00162                         kprintf("Unknow Error");
00163 
00164                 if (Dump)
00165                         ShowIdeRegisterDump();
00166         }       
00167 }

void ShowIdeRegisterDump  
 

Definition at line 172 of file IdeDebug.c.

00173 {
00174         kprintf("\n\rIDE REGISTER DUMP");
00175 
00176         kprintf("\n\rSTATUS  =0x");
00177         PrintByteHex(InPortAta(CC_ASTAT));
00178         gotoxy(20,-1);
00179         kprintf("ERROR   =0x");
00180         PrintByteHex(InPortAta(CC_ERR));
00181 
00182         kprintf("\n\rSEC CNT =0x");
00183         PrintByteHex(InPortAta(CC_SECC));
00184         gotoxy(20,-1);
00185         kprintf("SEC NUM =0x");
00186         PrintByteHex(InPortAta(CC_SECN));
00187         
00188         kprintf("\n\rCYL LOW =0x");
00189         PrintByteHex(InPortAta(CC_CYLL));
00190         gotoxy(20,-1);
00191         kprintf("CYL HIGH=0x");
00192         PrintByteHex(InPortAta(CC_CYLH));
00193         gotoxy(40,-1);
00194         kprintf("DEV HEAD=0x");
00195         PrintByteHex(InPortAta(CC_DEVH));
00196 
00197         kprintf("\n\r");
00198 }

void ShowMatrixData char *    DataBuffer,
int    Col,
int    BytePerCol,
int    RowToWait,
int    Len,
int    Mode
 

Definition at line 206 of file IdeDebug.c.

00207 {
00208         int i=0;
00209         int j=0;
00210         int z=0;
00211         int RowCount=0;
00212         int CrtWidth=k_get_crt_width();
00213 
00214         while(i<Len)            
00215         {
00216                 RowCount++;             
00217                 kprintf("\n\r");
00218                 j=0;
00219                 // Print a Row
00220                 while (i<Len && j<Col)
00221                 {
00222                         gotoxy(j*(CrtWidth/Col),-1);
00223                         kprintf("[");
00224                         PrintByteHex( (byte)i );
00225                         kprintf("]");
00226                         z=0;
00227 
00228                         // Print a Column
00229                         while (i<Len && z<BytePerCol)
00230                         {               
00231                                 switch (Mode)
00232                                 {
00233                                         case DBG_SHOWMAT_ASCII:
00234                                         kprintf("%c",DataBuffer[i]);
00235                                         break;
00236                                         case DBG_SHOWMAT_HEX:
00237                                         default:                                        
00238                                         kprintf(" ");
00239                                         PrintByteHex(DataBuffer[i]);                                    
00240                                         break;                                                          
00241                                 }
00242                                 z++;
00243                                 i++;
00244                         }                       
00245                         j++;
00246                 }
00247                 if ( (i<Len) && ((RowCount % RowToWait) == 0) )
00248                         WaitKeyPress(MSG_PRESSKEY);
00249         }
00250 }


Generated on Fri Feb 20 15:32:18 2004 for Minirighi by doxygen1.2.18