I'm writing a simple UART driver in linux for ARM926EJ-S. Inside the read function of the driver. If enter key (carriage return) was pressed, I want it to return the no. of bytes read till that point.
uart_data = (unsigned char)ioread8((void*)UART_DR(uart0_addr));
printk(KERN_ERR " %d ",(unsigned int)uart_data ); //prints 13 when pressing enter key
if ((unsigned char)13 == uart_data) //if carriage return
{
printk(KERN_ERR "Carriage Return\n");
goto out;
}
When I press enter key on the UART terminal, it receives it as a carriage return, but the control flow never gets inside the if block. Please help.