readcapacity.c 842 Bytes

#include <ultra64.h>
#include "../org/include/leodefine.h"
#include "../org/include/leodrive.h"

#ifndef	_LONGCMD
#include <leo.h>
#else
#include <leosp.h>
#endif

extern 	s32	__leoActive;

extern u16    LEORAM_START_LBA[DISK_TYPES];
extern u32    LEORAM_BYTE[DISK_TYPES];

extern u8     LEOdisk_type;

s32 LeoReadCapacity(LEOCapacity *cap, s32 dir)
{
  /* 
   * Check for existence of Leo Manager 
   */
  if (!__leoActive) {
    return(-1);
  }
  
  if (dir == OS_WRITE)
  {
    /* WRITE CAPACITY */
    cap->startLBA	= (u32)LEORAM_START_LBA[LEOdisk_type] - SYSTEM_LBAS;
    cap->endLBA		= MAX_L_LBA;
    cap->nbytes		= LEORAM_BYTE[LEOdisk_type];
  }
  else
  {
    /* READ CAPACITY */
    cap->startLBA	= (u32)0x00;
    cap->endLBA		= MAX_L_LBA;
    cap->nbytes		= RD_BYTES_PER_DRV;
  }

  return LEO_ERROR_GOOD;

} /* LeoReadCapacity */