I'm running Android 4.0.4 (ICS) on Google/Samsung Galaxy Nexus S phone (rooted). I want to save the state of the software and hardware, disable the MMU, program the UART for serial communication with external Linux PC, re-enable the MMU, and restore the software and hardware context and continue to run Android as usual. I'm stuck at the point where MMU has to be disabled, UART programmed, serial communication initiated. I programmed the MMU to disable it.
How do I setup the MMU and UART for non-interrupt-driven serial transmit/receive.
Thanks.
--shahed
/*!************************************************************************
* \fn void setup_uart(void)
* \param
* \brief
**************************************************************************/
void setup_uart(void)
{
uint32_t baud_divisor = 1843200/16/115200;
OMAP_UART_IER = 0x0;
OMAP_UART_LCR = 0xBF;
OMAP_UART_FCR = 0x10;
OMAP_UART_MCR &= 0x7F;
OMAP_UART_LCR = 0x80 | 0x03;
OMAP_UART_RHR = baud_divisor & 0xff;
OMAP_UART_IER = (baud_divisor >> 8) & 0xff;
OMAP_UART_LCR = 0x3;
OMAP_UART_MCR = 0x1 | 0x2;
OMAP_UART_FCR = 0x1 |0x2 | 0x4;
}
/*!************************************************************************
* \fn int omap_serial_putc(char inC )
* \param inC
* \brief
**************************************************************************/
int omap_serial_putc(char inC)
{
while ((OMAP_UART_LSR & OMAP_UART_LSR_THRE) == 0) {
/*waiting */
}
OMAP_UART_THR = inC;
return 0;
}
/*!************************************************************************
* \fn int omap_serial_puts(char *buf, int size)
* \param buf,size
* \brief
**************************************************************************/
int omap_serial_puts(char *buf, int size)
{
int idx = 0;
for (idx = 0; idx < size; idx++) {
while ((OMAP_UART_LSR & OMAP_UART_LSR_THRE) == 0) {
/*waiting */
}
OMAP_UART_THR = buf[idx];
}
return 0;
}
/*!************************************************************************
* \fn int omap_serial_gets( char *buf, int size )
* \param buf,size
* \brief
**************************************************************************/
int omap_serial_gets(char *buf, int size)
{
int i = 0;
if (NULL == buf) {
return -1;
}
for (i = 0; i < size; i++) {
while ((OMAP_UART_LSR & OMAP_UART_LSR_DR) == 0) {
/* waiting for port to be ready */
}
buf[i] = OMAP_UART_RHR;
}
return 0;
}
/*!************************************************************************
* \fn int omap_serial_getc( void )
* \brief
**************************************************************************/
int omap_serial_getc(void)
{
while ((OMAP_UART_LSR & OMAP_UART_LSR_DR) == 0) {
/* waiting for port to be ready */
}
return (OMAP_UART_RHR);
}