[PATCH] Fixed errors check in mpc5200_psc_interrupt_handler()

Gedare Bloom gedare at rtems.org
Wed Feb 12 15:14:07 UTC 2014


Can someone with powerpc / mpc5200 knowledge please check this out?

On Tue, Feb 4, 2014 at 9:22 AM, Aleksandr Platonov <pam at wolpike.com> wrote:
> Hi.
>
>  - We should check error bits in psc->sr_csr (not in psc->isr_imr)
>  - SR_ERROR should also contains SR_RB bit
>
> P.S. Changes were made according with linux code
> (http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/serial/mpc52xx_uart.c
> function mpc52xx_uart_int_rx_chars()) and MPC5200b user's manual (chapter
> 15.2.2.3))
>
>
>   c/src/lib/libbsp/powerpc/gen5200/console/console.c |   12 +++++++-----
>  c/src/lib/libbsp/powerpc/gen5200/include/mpc5200.h |   11 ++++++-----
>  2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
> b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
> index a70e06d..ed86bdd 100644
> --- a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
> +++ b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
> @@ -284,6 +284,7 @@ static void
> mpc5200_psc_interrupt_handler(rtems_irq_hdl_param handle)
>  {
>    unsigned char c;
>    uint16_t isr;
> +  uint16_t sr;
>    int minor = (int)handle;
>    struct mpc5200_psc *psc =
>      (struct mpc5200_psc *)(&mpc5200.psc[psc_minor_to_regset[minor]]);
> @@ -344,14 +345,15 @@ static void
> mpc5200_psc_interrupt_handler(rtems_irq_hdl_param handle)
>      }
>    }
>
> -  if(isr & ISR_ERROR) {
> -    if(isr & ISR_RB)
> +  sr = psc->sr_csr;
> +  if(sr & SR_ERROR) {
> +    if(sr & SR_RB)
>        channel_info[minor].breaks_detected++;
> -    if(isr & ISR_FE)
> +    if(sr & SR_FE)
>        channel_info[minor].framing_errors++;
> -    if(isr & ISR_PE)
> +    if(sr & SR_PE)
>        channel_info[minor].parity_errors++;
> -    if(isr & ISR_OE)
> +    if(sr & SR_OE)
>        channel_info[minor].overrun_errors++;
>
>      /*
> diff --git a/c/src/lib/libbsp/powerpc/gen5200/include/mpc5200.h
> b/c/src/lib/libbsp/powerpc/gen5200/include/mpc5200.h
> index 89e3968..318c54a 100644
> --- a/c/src/lib/libbsp/powerpc/gen5200/include/mpc5200.h
> +++ b/c/src/lib/libbsp/powerpc/gen5200/include/mpc5200.h
> @@ -977,6 +977,12 @@ typedef struct mpc5200_ {
>      volatile uint8_t  mr;            /* + 0x00 */
>      volatile uint8_t  res1[3];
>      volatile uint16_t sr_csr;        /* + 0x04 */
> +#define SR_RB      (1 << 15)
> +#define SR_FE          (1 << 14)
> +#define SR_PE          (1 << 13)
> +#define SR_OE          (1 << 12)
> +#define SR_ERROR       (SR_RB | SR_FE | SR_PE | SR_OE)
> +
>      volatile uint16_t res2[1];
>      volatile uint16_t cr;            /* + 0x08 */
>      volatile uint16_t res3[1];
> @@ -986,11 +992,6 @@ typedef struct mpc5200_ {
>      volatile uint16_t isr_imr;       /* + 0x14 */
>  #define ISR_TX_RDY      (1 << 8)
>  #define ISR_RX_RDY_FULL (1 << 9)
> -#define ISR_RB      (1 << 15)
> -#define ISR_FE          (1 << 14)
> -#define ISR_PE          (1 << 13)
> -#define ISR_OE          (1 << 12)
> -#define ISR_ERROR       (ISR_FE | ISR_PE | ISR_OE)
>
>  #define IMR_TX_RDY      (1 << 8)
>  #define IMR_RX_RDY_FULL (1 << 9)
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel



More information about the devel mailing list