/****************************************************************************
*
* (C) 2000 by BECK IPC GmbH
*
*  BECK IPC GmbH
*  Garbenheimerstr. 38
*  D-35578 Wetzlar
*
*  Phone : (49)-6441-905-240
*  Fax   : (49)-6441-905-245
*
* ---------------------------------------------------------------------------

 $Header: ide.h, 6, 16.07.2002 13:24:45, Christoph Stoidner$

 $Log:
  4    IPC@CHIP  1.3         05.09.2001 11:53:54  Andre Pribil    Added a debug
       output, code now more readable
  3    IPC@CHIP  1.2         03.09.2001 17:52:55  Andre Pribil    16-Bit
       interface added (from Marco Nesseldreher)
  2    IPC@CHIP  1.1         15.02.2001 15:16:52  Christoph Stoidner
  1    IPC@CHIP  1.0         15.02.2001 10:50:03  Christoph Stoidner
 $

 ****************************************************************************/
#ifdef _MSC_VER /* If Microsoft C Compiler is used, define new FP_SEG and FP_OFF Macro */
	#ifdef FP_SEG
  		#undef FP_SEG
	#endif
	#define FP_SEG(ptr)    ((unsigned int)(((unsigned long)ptr)>>16))

	#ifdef FP_OFF
  		#undef FP_OFF
	#endif
	#define FP_OFF(ptr)    ((unsigned int)(((unsigned long)ptr)&0xFFFF))
#endif

typedef struct
{
  int   id;
  int   sector_size;
  int   cylinders;
  int   heads;
  int   sectors;
} T_DRIVE_PARAM;

extern T_DRIVE_PARAM drive;  // filled by call to IDE_identify

void IDE_reset( void );

int IDE_ReadSRAM(unsigned char *bfr); // return 1 if ok, 0 if error
int IDE_WriteSRAM(unsigned char *bfr); // return 1 if ok, 0 if error


int IDE_identify(void);  // ret 1 if o.k.

// read n sectors,  ret 1 if o.k.
int IDE_read( int cyl,
              int head,
              int sect,
              int cnt,
              unsigned char *buf );

// write n sectors,  ret 1 if o.k.
int IDE_write( int cyl,
               int head,
               int sect,
               int cnt,
               unsigned char *buf );


// ************ Read sectors in LBA mode *************
// *** ret 1 if o.k.,  0 if error
int IDE_LBA_read( unsigned long sector, int cnt, unsigned char *buf);

// ************ write sectors in LBA mode *************
// *** ret 1 if o.k.,  0 if error
int IDE_LBA_write( unsigned long sector, int cnt, unsigned char *buf );



