// ============================================================================
// fXRESInitializeTargetForISSP()
// Implements the intialization vectors for the device.
// Returns:
//     0 if successful
//     INIT_ERROR if timed out on handshake to the device.
// ============================================================================
signed char fXRESInitializeTargetForISSP(void)
{
	// Configure the pins for initialization
	SetSDATAHiZ();
	SetSCLKStrong();
	SCLKLow();
	// Cycle reset and put the device in programming mode when it exits reset
	AssertXRES();
	DeassertXRES();
	// !!! NOTE:
	//  The timing spec that requires that the first Init-Vector happen within
	//  1 msec after the reset/power up. For this reason, it is not advisable
	//  to separate the above RESET_MODE or POWER_CYCLE_MODE code from the
	//  Init-Vector instructions below. Doing so could introduce excess delay
	//  and cause the target device to exit ISSP Mode.

	//PTJ: Send id_setup_1 instead of init1_v
	//PTJ: both send CA Test Key and do a Calibrate1 SROM function
	SendVector(id_setup_1, num_bits_id_setup_1);
	if (fIsError = fDetectHiLoTransition()) {
//        TX8SW_CPutString("\r\n fDetectHiLoTransition Error");
		printk(KERN_INFO "\r\n fDetectHiLoTransition Error\n");
		return (INIT_ERROR);
	}
	SendVector(wait_and_poll_end, num_bits_wait_and_poll_end);

	// NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3
	//       it does not occur (per spec).
	return (PASS);
}
/* ============================================================================
// fXRESInitializeTargetForISSP()
// Implements the intialization vectors for the device.
// Returns:
//     0 if successful
//     INIT_ERROR if timed out on handshake to the device.
 ============================================================================*/
signed char fXRESInitializeTargetForISSP(void)
{
	/* Configure the pins for initialization */
	SetSDATAHiZ();
	SetSCLKStrong();
	SCLKLow();

#ifdef ACTIVE_LOW_XRES
	AssertXRES();	/* assert XRES before setting XRES pin to strong */
	SetXRESStrong();
	DeassertXRES();
	/* Delay(XRES_CLK_DELAY); */
	mdelay(1);
	AssertXRES();
#else
	/* Cycle reset and put the device in programming mode when it exits reset */
	SetXRESStrong();
	AssertXRES();
	Delay(XRES_CLK_DELAY);
	DeassertXRES();
#endif

	/* !!! NOTE:
	//  The timing spec that requires that the first Init-Vector happen within
	//  1 msec after the reset/power up. For this reason, it is not advisable
	//  to separate the above RESET_MODE or POWER_CYCLE_MODE code from the
	//  Init-Vector instructions below. Doing so could introduce excess delay
	//  and cause the target device to exit ISSP Mode.
	 */

	SendVector(id_setup_1, num_bits_id_setup_1);
	fIsError = fDetectHiLoTransition();
	if (fIsError)
		return INIT_ERROR;

	SendVector(wait_and_poll_end, num_bits_wait_and_poll_end);

	/* NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3
	//       it does not occur (per spec). */
	return PASS;
}
// ============================================================================
// ReStartTarget()
// After programming, the target PSoC must be reset to take it out of
// programming mode. This routine performs a reset.
// ============================================================================
void ReStartTarget(void)
{
#ifdef RESET_MODE
	// Assert XRES, then release, then disable XRES-Enable
	AssertXRES();
	Delay(XRES_CLK_DELAY);
	DeassertXRES();
#else
	// Set all pins to highZ to avoid back powering the PSoC through the GPIO
	// protection diodes.
	SetSCLKHiZ();
	SetSDATAHiZ();
	// Cycle power on the target to cause a reset
	RemoveTargetVDD();
	mdelay(300);
	ApplyTargetVDD();
#endif
}
/* ============================================================================
// ReStartTarget()
// After programming, the target PSoC must be reset to take it out of
// programming mode. This routine performs a reset.
 ============================================================================*/
void ReStartTarget(void)
{
#ifdef RESET_MODE
	/* Assert XRES, then release, then disable XRES-Enable */
	AssertXRES();
	udelay(XRES_CLK_DELAY);
	DeassertXRES();
#else
	/* Set all pins to highZ to avoid back powering the PSoC through the GPIO */
	/* protection diodes. */
	SetSCLKHiZ();
	SetSDATAHiZ();
	/* Cycle power on the target to cause a reset */
	RemoveTargetVDD();
	udelay(POWER_CYCLE_DELAY);
	ApplyTargetVDD();
#endif
}
Exemple #5
0
void ReStartTarget(void)
{
	//int i;
	#ifdef RESET_MODE
	/* Assert XRES, then release, then disable XRES-Enable */
	AssertXRES();
	Delay(XRES_CLK_DELAY);
	DeassertXRES();
	#else
	/* Set all pins to highZ to avoid back powering
	   the PSoC through the GPIO protection diodes.
	*/
	SetSCLKHiZ();
	SetSDATAHiZ();
	/* Cycle power on the target to cause a reset */
	RemoveTargetVDD();
	// jjlee	for (i = 0; i < 100; i++)
			Delay(50000);
	ApplyTargetVDD();
	#endif
}
Exemple #6
0
 /*============================================================================
 fXRESInitializeTargetForISSP()
 Implements the intialization vectors for the device.
 Returns:
     0 if successful
     INIT_ERROR if timed out on handshake to the device.
 ============================================================================
*/
signed char fXRESInitializeTargetForISSP(void)
{
	 /*Configure the pins for initialization*/
	SetSDATAHiZ();
	SetSCLKStrong();
	SCLKLow();
	SetXRESStrong();

	/* Cycle reset and put the device
	  in programming mode when it exits reset */
	AssertXRES();
	Delay(XRES_CLK_DELAY);
	DeassertXRES();

	/*
	 !!! NOTE:
	  The timing spec that requires that the first Init-Vector happen within
	  1 msec after the reset/power up. For this reason, it is not advisable
	  to separate the above RESET_MODE or POWER_CYCLE_MODE code from the
	  Init-Vector instructions below. Doing so could introduce excess delay
	  and cause the target device to exit ISSP Mode.

	PTJ: Send id_setup_1 instead of init1_v
	PTJ: both send CA Test Key and do a Calibrate1 SROM function
	*/
	SendVector(id_setup_1, num_bits_id_setup_1);
	fIsError = fDetectHiLoTransition();
	if (fIsError != 0)
		return INIT_ERROR;
	SendVector(wait_and_poll_end, num_bits_wait_and_poll_end);

	/*
	 NOTE: DO NOT not wait for HiLo on SDATA after vector Init-3
		   it does not occur (per spec).
	*/
	return PASS;
}