Esempio n. 1
0
 /*******************************************************************************
 *  Function Name: LCD_Char_PrintInt8
 ********************************************************************************
 *
 * Summary:
 *  Print a byte as two ASCII characters.
 *
 * Parameters:
 *  value: The byte to be printed out as ASCII characters.
 *
 * Return:
 *  None.
 *
 *******************************************************************************/
 void LCD_Char_PrintInt8(uint8 value) 
 {
     static char8 const CYCODE LCD_Char_hex[16u] = "0123456789ABCDEF";
     
     LCD_Char_PutChar((char8) LCD_Char_hex[value >> LCD_Char_BYTE_UPPER_NIBBLE_SHIFT]);
     LCD_Char_PutChar((char8) LCD_Char_hex[value & LCD_Char_BYTE_LOWER_NIBBLE_MASK]);
 }
Esempio n. 2
0
signed char fVerifySiliconID(void)
{
	SendVector(id_setup_2, num_bits_id_setup_2);
	fIsError = fDetectHiLoTransition();
	if (fIsError != 0) {
		#ifdef TX_ON
			TX8SW_PutCRLF();
			TX8SW_CPutString("fDetectHiLoTransition Error");
		#endif

		#ifdef LCD_ON
			LCD_Char_PrintString("fDetectHiLoTransition Error");
		#endif

		return SiID_ERROR;
	}
	SendVector(wait_and_poll_end, num_bits_wait_and_poll_end);

 /*   Send Read ID vector and get Target ID */
	SendVector(read_id_v, 11); /*Read-MSB Vector is the first 11-Bits */
	RunClock(2);  /*Two SCLK cycles between write & read */
	bTargetID[0] = bReceiveByte();
	RunClock(1);
	 /* 1+11 bits starting from the 3rd byte */
	SendVector(read_id_v + 2, 12);
	RunClock(2);                    /* Read-LSB Command */
	bTargetID[1] = bReceiveByte();

	RunClock(1);
	SendVector(read_id_v+4, 1); /*1 bit starting from the 5th byte */


    #ifdef TX_ON
		 /*Print READ-ID */
		TX8SW_PutCRLF();
		TX8SW_CPutString("Silicon-ID : ");
		TX8SW_PutChar(' ');
		TX8SW_PutSHexByte(bTargetID[0]);
		TX8SW_PutChar(' ');
		TX8SW_PutSHexByte(bTargetID[1]);
		TX8SW_PutChar(' ');

		/* See the latest spec. 40-95002, 40-95004, 001-15870, AN2026d*/
		switch (bTargetID[0]) {
		case 0x00:
			TX8SW_CPutString(
				"\r\nPSoC1 = 00xx (including Ovation-ONS)");
			switch (bTargetID[1]) {
			case 0x68:
				TX8SW_CPutString(
					"\r\nCY8C20234 8K, 512B(Quark)");
				TargetDatabufLen = 64;
				NumBanks = 1;
				BlocksPerBank = 128;
				SecurityBytesPerBank = 64;
				break;
			case 0xAD:
				TX8SW_CPutString(
					"\r\nCY8C20446A-24LQXI 16K, 2K(Krypton)");
				TargetDatabufLen = 128;
				NumBanks = 1;
				BlocksPerBank = 128;
				SecurityBytesPerBank = 64;
				break;
			case 0x37:
				TX8SW_CPutString(
					"\r\nCY8C21334 Automotive(Neutron) 8K,512B");
				TargetDatabufLen = 64;
				NumBanks = 1;
				BlocksPerBank = 128;
				SecurityBytesPerBank = 64;
				break;
			case 0x38:
				TX8SW_CPutString(
					"\r\nCY8C21434 Neutron");
				TargetDatabufLen = 64;
				NumBanks = 1;
				BlocksPerBank = 128;
				SecurityBytesPerBank = 64;
				break;
			default:
				break;
			}
			break;
		case 0x01:
			TX8SW_CPutString(
				"\r\nPSoC1 = 01xx(continued family and mask set growth");
			break;
		case 0x02:
			TX8SW_CPutString(
				"\r\nPSoC1 + SmartSense = 02xx");
			break;
		case 0x03:
			TX8SW_CPutString("\r\nUnallocated = 03xx");
			break;
		case 0x04:
			TX8SW_CPutString("\r\nPower PSoC = 04xx");
			break;
		case 0x05:
			TX8SW_CPutString(
				"\r\nTrueTouch Multi-Touch All Points(TMA) = 05xx");
			switch (bTargetID[1]) {
			case 0x9A:
				TX8SW_CPutString(
					"\r\nCY8CTMA340-LQI-01");
				TargetDatabufLen = 128;
				NumBanks = 1;
				BlocksPerBank = 256;
				SecurityBytesPerBank = 64;
				break;
			default:
				break;
			}

			break;
		case 0x06:
			TX8SW_CPutString(
				"\r\nTrueTouch Single Touch(TST) = 06xx");
			break;
		case 0x07:
			TX8SW_CPutString(
				"\r\nTrueTouch Multi-Touch Gesture(TMG) = 07xx");
			break;
		case 0x08:
			TX8SW_CPutString(
				"\r\nPSoC1 Value = 08xx");
			break;
		case 0x09:
			TX8SW_CPutString(
				"\r\nPSoC1 PLC = 09xx");
			break;
		case 0x0A:
			TX8SW_CPutString(
				"\r\nPSoC1 PLC + Ez Color = 0Axx");
			break;
		case 0x0B:
			TX8SW_CPutString(
				"\r\nPSoC1 + SmartSense_EMC = 0Bxx");
			break;
		case 0x0C:
			TX8SW_CPutString(
				"\r\nHaptics Only = 0Cxx");
			break;
		case 0x0D:
			TX8SW_CPutString(
				"\r\nHaptics + TrueTouch Multi-Touch All Points(TMA) = 0Dxx");
			break;
		case 0x0E:
			TX8SW_CPutString(
				"\r\nHaptics + TrueTouch Single Touch(TST = 0Exx");
			break;
		case 0x0F:
			TX8SW_CPutString(
				"\r\nHaptics + TrueTouch Multi-Touch Gesture(TMG) = 0Fxx");
			break;
		default:
			TX8SW_CPutString("\r\nUnknown Silicon ID !!");
			while (1)
				;
			break;
		}
	  #endif

		target_id_v[0] = bTargetID[0];
		target_id_v[1] = bTargetID[1];

	#ifdef LCD_ON
		LCD_Char_Position(1, 0);
		LCD_Char_PrintString("ID : ");
		LCD_Char_PrintInt8(bTargetID[0]);
		LCD_Char_PutChar(' ');
		LCD_Char_PrintInt8(bTargetID[1]);
		LCD_Char_PutChar(' ');
	#endif



	if (bTargetID[0] != target_id_v[0] || bTargetID[1] != target_id_v[1])
		return SiID_ERROR;
	else
		return PASS;
}
Esempio n. 3
0
// ============================================================================
// fVerifySiliconID()
// Returns:
//     0 if successful
//     Si_ID_ERROR if timed out on handshake to the device.
// ============================================================================
signed char fVerifySiliconID(void)
{
	SendVector(id_setup_2, num_bits_id_setup_2);

	fIsError = fDetectHiLoTransition();
	if (fIsError)
	{
#ifdef TX_ON
		UART_PutCRLF();
		UART_CPutString("fDetectHiLoTransition Error");
#endif
		return(SiID_ERROR);
	}
	SendVector(wait_and_poll_end, num_bits_wait_and_poll_end);

	SendVector(tsync_enable, num_bits_tsync_enable);

	//Send Read ID vector and get Target ID
	SendVector(read_id_v, 11);      // Read-MSB Vector is the first 11-Bits
	RunClock(2);                    // Two SCLK cycles between write & read
	bTargetID[0] = bReceiveByte();
	RunClock(1);
	SendVector(read_id_v+2, 12);    // 1+11 bits starting from the 3rd byte

	RunClock(2);                    // Read-LSB Command
	bTargetID[1] = bReceiveByte();

	RunClock(1);
	SendVector(read_id_v+4, 1);     // 1 bit starting from the 5th byte

	//read Revision ID from Accumulator A and Accumulator X
	//SendVector(read_id_v+5, 11);	//11 bits starting from the 6th byte
	//RunClock(2);
	//bTargetID[2] = bReceiveByte();	//Read from Acc.X
	//RunClock(1);
	//SendVector(read_id_v+7, 12);    //1+11 bits starting from the 8th byte
	//
	//RunClock(2);
	//bTargetID[3] = bReceiveByte();	//Read from Acc.A
	//
	//RunClock(1);
	//SendVector(read_id_v+4, 1);     //1 bit starting from the 5th byte,

	SendVector(tsync_disable, num_bits_tsync_disable);


#ifdef TX_ON
	// Print READ-ID
	UART_PutCRLF();
	UART_CPutString("Silicon-ID : ");
	UART_PutChar(' ');
	UART_PutHexByte(bTargetID[0]);
	UART_PutChar(' ');
	UART_PutHexByte(bTargetID[1]);
	UART_PutChar(' ');
#endif

#ifdef LCD_ON
	LCD_Char_Position(1, 0);
	LCD_Char_PrintString("ID : ");
	LCD_Char_PrintInt8(bTargetID[0]);
	LCD_Char_PutChar(' ');
	LCD_Char_PrintInt8(bTargetID[1]);
	LCD_Char_PutChar(' ');
#endif

	if (bTargetID[0] == target_id_v[0] && bTargetID[1] == target_id_v[1])
	{
		return(PASS);
	}
	else if (bTargetID[0] == target_id_v2[0] && bTargetID[1] == target_id_v2[1])	
	{
		return(PASS);
	}
	else
	{
		printk("%x %x \n", bTargetID[0], bTargetID[1]);
		return(SiID_ERROR);
	}
}