XilinxProcessorIPLib/drivers/dp12txss/examples/src/com/xhdcp1x_debug.c
int XHdcp1xDebug_ProcessKey(char CmdKey)
{
	/* Locals */
	int CmdIsComplete = FALSE;

	/* Check for the start of a new command */
	if (!gCmdInProgress) {

		/* Check for character of interest */
		if ((CmdKey == 'h') || (CmdKey == 'k')) {

			/* Initialize gCmdBuf */
			memset(gCmdBuf, 0, MAX_CMD_LENGTH);
			gCmdBufIdx = 0;

			/* Update gCmdInProgress */
			gCmdInProgress = TRUE;
		}
		else {
			return (FALSE);
		}
	}

	/* Check for end-of-command */
	if ((CmdKey == '\r') || (CmdKey == '\n')) {

		/* Update CmdIsComplete */
		CmdIsComplete = TRUE;

	}
	/* Check for backspace */
	else if (CmdKey == '\b') {

		/* Check for something already in the command buffer */
		if (gCmdBufIdx > 0) {

			/* Delete the last character in the buffer */
			gCmdBuf[--gCmdBufIdx] = 0;

			#if defined(DO_ECHO)
			/* Echo it */
			PRINTF("\b");
			#endif

			/* Clear it off the screen */
			PRINTF(" \b");
		}
	}
	/* Check for room */
	else if (gCmdBufIdx < (MAX_CMD_LENGTH - 1)) {

		/* Check for ascii display-able character */
		if ((CmdKey >= 0x20) && (CmdKey <= 0x7E)) {

			/* Update gCmdBuf */
			gCmdBuf[gCmdBufIdx++] = CmdKey;

			#if defined(DO_ECHO)
			/* Echo it */
			PRINTF("%c", CmdKey);
			#endif
		}
	}
	/* Otherwise - assume done and hope for the best */
	else {

		/* Update CmdIsComplete */
		CmdIsComplete = TRUE;
	}

	/* Check theCmdIsComplete */
	if (CmdIsComplete) {

		/* Send CR/LF */
		PRINTF("\r\n");

		/* Dispatch it */
		DispatchCmd();

		/* Update gCmdInProgress */
		gCmdInProgress = FALSE;

		/* Send CR/LF */
		PRINTF("\r\n");
	}

//	return (TRUE);
	return (gCmdInProgress);
}
/*****************************************************************************/
/**
*
* This function services a hdcp debug command from the xilinx debug console
*
* @param CmdKey  the command key that was pressed
*
* @return
*   Truth value indicating if the key was consumed (TRUE) or not (FALSE)
*
* @note
*   None.
*
******************************************************************************/
This function services a hdcp debug command from the xilinx debug console
This function services a hdcp debug command from the xilinx debug console
int XHdcp1xDebug_ProcessKey(char CmdKey)
{
	int CmdIsComplete = FALSE;
	if (!gCmdInProgress) {
		if ((CmdKey == 'h') || (CmdKey == 'k')) {
			memset(gCmdBuf, 0, MAX_CMD_LENGTH);
			gCmdBufIdx = 0;
			gCmdInProgress = TRUE;
		}
		else {
			return (FALSE);
		}
	}
	if ((CmdKey == '\r') || (CmdKey == '\n')) {
		CmdIsComplete = TRUE;
	}
	else if (CmdKey == '\b') {
		if (gCmdBufIdx > 0) {
			gCmdBuf[--gCmdBufIdx] = 0;
			#if defined(DO_ECHO)
			PRINTF("\b");
			#endif
			PRINTF(" \b");
		}
	}
	else if (gCmdBufIdx < (MAX_CMD_LENGTH - 1)) {
		if ((CmdKey >= 0x20) && (CmdKey <= 0x7E)) {
			gCmdBuf[gCmdBufIdx++] = CmdKey;
			#if defined(DO_ECHO)
			PRINTF("%c", CmdKey);
			#endif
		}
	}
	else {
		CmdIsComplete = TRUE;
	}
	if (CmdIsComplete) {
		PRINTF("\r\n");
		DispatchCmd();
		gCmdInProgress = FALSE;
		PRINTF("\r\n");
	}
	return (gCmdInProgress);
}
int XHdcp1xDebug_ProcessKey ( char CmdKey ) { int CmdIsComplete = FALSE ; if ( ! gCmdInProgress ) { if ( ( CmdKey == ' ' ) || ( CmdKey == ' ' ) ) { memset ( gCmdBuf , 0 , MAX_CMD_LENGTH ) ; gCmdBufIdx = 0 ; gCmdInProgress = TRUE ; } else { return ( FALSE ) ; } } if ( ( CmdKey == ' \r ' ) || ( CmdKey == ' \n ' ) ) { CmdIsComplete = TRUE ; } else if ( CmdKey == ' \b ' ) { if ( gCmdBufIdx > 0 ) { gCmdBuf [ -- gCmdBufIdx ] = 0 ; #if defined ( DO_ECHO ) PRINTF ( " \b " ) ; #endif PRINTF ( " \b " ) ; } } else if ( gCmdBufIdx < ( MAX_CMD_LENGTH - 1 ) ) { if ( ( CmdKey >= 0x20 ) && ( CmdKey <= 0x7E ) ) { gCmdBuf [ gCmdBufIdx ++ ] = CmdKey ; #if defined ( DO_ECHO ) PRINTF ( " " , CmdKey ) ; #endif } } else { CmdIsComplete = TRUE ; } if ( CmdIsComplete ) { PRINTF ( " \r \n " ) ; DispatchCmd ( ) ; gCmdInProgress = FALSE ; PRINTF ( " \r \n " ) ; } return ( gCmdInProgress ) ; }
This function services a hdcp debug command from the xilinx debug console
This function services a hdcp debug command from the xilinx debug console
/* Locals */ /* Check for the start of a new command */ /* Check for character of interest */ /* Initialize gCmdBuf */ /* Update gCmdInProgress */ /* Check for end-of-command */ /* Update CmdIsComplete */ /* Check for backspace */ /* Check for something already in the command buffer */ /* Delete the last character in the buffer */ /* Echo it */ /* Clear it off the screen */ /* Check for room */ /* Check for ascii display-able character */ /* Update gCmdBuf */ /* Echo it */ /* Otherwise - assume done and hope for the best */ /* Update CmdIsComplete */ /* Check theCmdIsComplete */ /* Send CR/LF */ /* Dispatch it */ /* Update gCmdInProgress */ /* Send CR/LF */ //	return (TRUE);