/** * jornada_ssp_reverse - reverses input byte * @byte: input byte to reverse * * we need to reverse all data we receive from the mcu due to its physical location * returns : 01110111 -> 11101110
*/ inline u8 jornada_ssp_reverse(u8 byte)
{ return
((0x80 & byte) >> 7) |
((0x40 & byte) >> 5) |
((0x20 & byte) >> 3) |
((0x10 & byte) >> 1) |
((0x08 & byte) << 1) |
((0x04 & byte) << 3) |
((0x02 & byte) << 5) |
((0x01 & byte) << 7);
};
EXPORT_SYMBOL(jornada_ssp_reverse);
/** * jornada_ssp_byte - waits for ready ssp bus and sends byte * @byte: input byte to transmit * * waits for fifo buffer to clear and then transmits, if it doesn't then we will * timeout after <timeout> rounds. Needs mcu running before its called. * * returns : %mcu output on success * : %-ETIMEDOUT on timeout
*/ int jornada_ssp_byte(u8 byte)
{ int timeout = 400000;
u16 ret;
while ((GPLR & GPIO_GPIO10)) { if (!--timeout) {
printk(KERN_WARNING "SSP: timeout while waiting for transmit\n"); return -ETIMEDOUT;
}
cpu_relax();
}
/** * jornada_ssp_inout - decide if input is command or trading byte * @byte: input byte to send (may be %TXDUMMY) * * returns : (jornada_ssp_byte(byte)) on success * : %-ETIMEDOUT on timeout failure
*/ int jornada_ssp_inout(u8 byte)
{ int ret, i;
/* true means command byte */ if (byte != TXDUMMY) {
ret = jornada_ssp_byte(byte); /* Proper return to commands is TxDummy */ if (ret != TXDUMMY) { for (i = 0; i < 256; i++)/* flushing bus */ if (jornada_ssp_byte(TXDUMMY) == -1) break; return -ETIMEDOUT;
}
} else/* Exchange TxDummy for data */
ret = jornada_ssp_byte(TXDUMMY);
/* all fine */
printk(KERN_INFO "SSP: device initialized\n"); return 0;
};
staticvoid jornada_ssp_remove(struct platform_device *dev)
{ /* Note that this doesn't actually remove the driver, since theres nothing to remove
* It just makes sure everything is turned off */
GPSR = GPIO_GPIO25;
ssp_exit();
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.