예제 #1
0
void Swdp::seq_out_parity (uint32_t MS, int ticks) {

    uint32_t parity = 0;

    turnaround (false);

    while (ticks--) {
        bit_out (MS & 1);
        parity ^= MS;
        MS >>= 1;
    }
    bit_out (parity & 1);
}
예제 #2
0
void Swdp::seq_out (uint32_t MS, int ticks) {

    turnaround (false);

    while(ticks--) {
        bit_out (MS & 1);
        MS >>= 1;
    }
}
예제 #3
0
/********************************************************************
 * Function:        uint8_t byte_in(uint8_t ack)
 *
 * Description:     This function inputs a byte from the I2C bus.
 *                  Depending on the value of ack, it will also
 *                  transmit either an ACK or a NAK bit.
 *******************************************************************/
uint8_t byte_in(uint8_t ack)
{
	uint8_t i;                      // Loop counter
	uint8_t retval;                 // Return value

	retval = 0;
	for (i = 0; i < 8; i++)         // Loop through each bit
	{
		retval = retval << 1;       // Shift left for next bit
		bit_in(&retval);            // Input bit
	}
	bit_out(ack);                   // Output ACK/NAK bit

	return retval;
}
예제 #4
0
/********************************************************************
 * Function:        uint8_t byte_out(uint8_t data)
 *
 * Description:     This function outputs a byte to the I2C bus.
 *                  It also receives the ACK bit and returns 0 if
 *                  successfully received, or 1 if not.
 *******************************************************************/
uint8_t byte_out(uint8_t data)
{
	uint8_t i;                      // Loop counter
	uint8_t ack;                    // ACK bit

	ack = 0;
	for (i = 0; i < 8; i++)         // Loop through each bit
	{
		bit_out(data);              // Output bit
		data = data << 1;           // Shift left for next bit
	}
	bit_in(&ack);                   // Input ACK bit

	return ack;
}
예제 #5
0
void Swdp::reset (void) {
    turnaround (false);
    /* 50 clocks with TMS high */
    for (int i = 0; i < 50; i++) bit_out (true);
}