<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><span>Hello,</span></div><div style="font-family: arial, helvetica, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span><font size="2">Will use rtems_vector_number</font><font face="times new roman, new york, times, serif">,an enum for uart_name and assert(0), or assert(</font></span><span style="font-size: 16px;">!"Message describing error due to invalid value of minor or uart_name"</span><span style="font-family: 'times new roman', 'new york', times, serif; background-color: transparent;">). How do I use two functions ? I don't understand which part of code do you refer by </span><span
 style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px;">receive and transmit interrupt. </span></div><div style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">Regards</div><div style="font-family: arial, helvetica, clean, sans-serif; font-size: 13px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color:transparent;line-height:1.22;">Vipul Nayyar </span></div><div style="font-family: arial, helvetica, clean, sans-serif; font-size: 12.727272033691406px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><br></div> 
 <div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Sebastian Huber <sebastian.huber@embedded-brains.de><br> <b><span style="font-weight: bold;">To:</span></b> rtems-devel@rtems.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, 8 July 2013 8:39 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [PATCH] Updated Legacy code in arm csb336<br> </font> </div> <div class="y_msg_container"><br>On 07/08/2013 03:43 PM, Vipul Nayyar wrote:<br>> ---<br>>   c/src/lib/libbsp/arm/csb336/console/uart.c    | 128 +++++++++++++++-----------<br>>   c/src/lib/libbsp/arm/csb336/network/network.c |  46 +++------<br>>   2 files changed, 86 insertions(+), 88
 deletions(-)<br>> <br>> diff --git a/c/src/lib/libbsp/arm/csb336/console/uart.c b/c/src/lib/libbsp/arm/csb336/console/uart.c<br>> index 4dc409b..8156921 100644<br>> --- a/c/src/lib/libbsp/arm/csb336/console/uart.c<br>> +++ b/c/src/lib/libbsp/arm/csb336/console/uart.c<br>[...]<br>>   /* Define this to use interrupt driver UART driver */<br>>   #define USE_INTERRUPTS 1<br>> +#define UART_TX 1<br>> +#define UART_RX 2<br>[...]<br>>   static ssize_t imx_uart_intr_write(int, const char *, size_t);<br>> +static rtems_irq_number imx_uart_set_name(int,int);<br><br>This rtems_irq_number is defined in <rtems/irq.h>.  This it belongs to the legacy API we want to get rid of.  Use rtems_vector_number instead.<br><br>[...]<br>> +static rtems_irq_number imx_uart_set_name(int minor,int uart_name)<br>> +{<br>> +    if (minor == 0) {<br>> +        if (uart_name ==
 UART_TX) return BSP_INT_UART1_TX;<br>> +        else if (uart_name == UART_RX)return BSP_INT_UART1_RX;<br>> +<br>> +    } else if (minor == 1) {<br>> +        if (uart_name == UART_TX) return BSP_INT_UART2_TX;<br>> +        else if (uart_name == UART_RX) return BSP_INT_UART2_RX;<br>> +    }<br>> +<br>> +    rtems_panic("%s:%d Unknown UART minor number %d\n",<br>> +                    __FUNCTION__, __LINE__, minor);<br>> +}<br>[...]<br><br>This function is better than the previous copy and paste approach.<br><br>If I naively read imx_uart_set_name() I think this function sets the name of the UART.  Instead this function returns an interrupt vector depending on a magic number uart_name.<br><br>I would use two functions for this, one for the receive and one for the transmit interrupt
 or use at least an enum instead of the int uart_name.  Since we already use assert(), you can replace the rtems_panic() (which is a very heavy weight function) with an assert(0).<br><br>-- Sebastian Huber, embedded brains GmbH<br><br>Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>Phone   : +49 89 189 47 41-16<br>Fax     : +49 89 189 47 41-09<br>E-Mail  : <a ymailto="mailto:sebastian.huber@embedded-brains.de" href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a><br>PGP     : Public key available on request.<br><br>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>_______________________________________________<br>rtems-devel mailing list<br><a ymailto="mailto:rtems-devel@rtems.org" href="mailto:rtems-devel@rtems.org">rtems-devel@rtems.org</a><br><a href="http://www.rtems.org/mailman/listinfo/rtems-devel"
 target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br><br><br></div> </div> </div>  </div></body></html>