contquery.c 1.9 KB
/**************************************************************************
 *                                                                        *
 *               Copyright (C) 1995, Silicon Graphics, Inc.               *
 *                                                                        *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright law.  They  may  not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *                                                                        *
 **************************************************************************/

#include "osint.h"
#include "controller.h"
#include "siint.h"

/*
 * This call issues a query command to controllers to get  the status 
 * and controller type information.
 * A value of 0 is returned if the calls succeed, otherwise
 * -1 is returned
 */
s32
osContStartQuery(OSMesgQueue *mq)
{
	s32	ret = 0;

	/* Block to get resource token */
	__osSiGetAccess();

	if (CONT_REQUEST != __osContLastCmd) {

		/* Set up request command format for all channels */
		__osPackRequestData(CONT_REQUEST);
		ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam);
		(void)osRecvMesg(mq, (OSMesg *)NULL, OS_MESG_BLOCK);
	}

	/* trigger pifmacro */

	ret = __osSiRawStartDma(OS_READ, &__osContPifRam);

        /* 
         * Always make the last command an illegal one, so we never optimize
         * out the DMA write
         */
	__osContLastCmd = CONT_SETCH - 1;
	
	/* Return resource token */
	__osSiRelAccess();
	return(ret);
}

/*
 * Reformat the 64 bytes RAM data into RequestData format 
 * and check error code.
 */
void
osContGetQuery(OSContStatus *data)
{
	u8 pattern;

	__osContGetInitData(&pattern, data);
}