Skip to content

Instantly share code, notes, and snippets.

@goog
Created April 16, 2019 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goog/3da34a64eff11902579df333cfd1d863 to your computer and use it in GitHub Desktop.
Save goog/3da34a64eff11902579df333cfd1d863 to your computer and use it in GitHub Desktop.
uint32_t *USART2_SR = (uint32_t *)0x40004400;
uint32_t *USART2_DR = (uint32_t *)0x40004404;
rtems_isr USART2_handler(rtems_vector_number vector)
{
uint32_t temp = temp;
if((*USART2_SR) & (1<<5))
{
//printk("into int\n");
if(uart2_index < 100)
uart2_buf[uart2_index++] = (uint8_t)(*USART2_DR)&0xff;
else
temp = *USART2_DR;
//printk("%02X ", uart2_buf[uart2_index - 1]);
//if(uart2_index == 100)
// return;
#if 0
if(uart2_buf[uart2_index - 1] == '\n')
{
uart2_rev_flag = 1;
}
if(uart2_buf[uart2_index - 1] == '>')
{
uart2_rev_flag = 1;
uart2_buf[uart2_index++] = '\r';
uart2_buf[uart2_index++] = '\n';
}
#endif
}
if((*USART2_SR) & (1<<4)) // idle
{
temp &= (*USART2_SR);
temp &= (*USART2_DR);
temp = temp;
uart2_rev_flag = 1;
printk("fla");
}
if((*USART2_SR) & (1<<3))
{
//int temp = (*USART2_DR)&0xff;
temp = *USART2_SR;
temp = *USART2_DR;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment