spdlmotor.c 944 Bytes

#include <ultra64.h>

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

extern s32	__leoActive;

s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq)
{
  
  /* 
   * Check for existence of Leo Manager 
   */
  if (!__leoActive) {
    return(-1);
  }
  
  /*
   * Fill up command block
   */
  cmdBlock->header.command 	= LEO_COMMAND_START_STOP;
  cmdBlock->header.reserve1	= 0;
  switch(mode)
  {
  case ACTIVE:
    cmdBlock->header.control 	= LEO_CONTROL_START;
    break;

  case STANDBY:
    cmdBlock->header.control 	= LEO_CONTROL_STBY;
    break;
    
  case SLEEP:
    cmdBlock->header.control	= 0;
    break;

  case BRAKE:
    cmdBlock->header.control	= LEO_CONTROL_BRAKE;
    break;
  }
  cmdBlock->header.reserve3 	= 0;

  if (mq != NULL)
  {
    cmdBlock->header.control	|= LEO_CONTROL_POST;
    cmdBlock->header.post	= mq;
  }

  leoCommand((void *)cmdBlock);

  return 0;
  
} /* LeoSpdlMotor */