[PATCH 2/2] libbsp/or1ksim: Fix warnings.
Hesham Moustafa
heshamelmatary at gmail.com
Mon Oct 13 18:30:08 UTC 2014
On Mon, Oct 13, 2014 at 8:24 PM, Joel Sherrill <joel.sherrill at oarcorp.com>
wrote:
>
> On 10/13/2014 1:06 PM, Hesham Moustafa wrote:
>
> Please have a look at this patch.
>
> On Fri, Oct 10, 2014 at 6:45 PM, Hesham ALMatary <heshamelmatary at gmail.com
> > wrote:
>
>> ---
>> c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c | 2 +-
>> c/src/lib/libbsp/or1k/or1ksim/console/uart.c | 15 +++++++++++----
>> 2 files changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>> b/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>> index ad49d07..4169a11 100644
>> --- a/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>> +++ b/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>> @@ -137,8 +137,8 @@ CPU_Counter_ticks _CPU_Counter_difference(
>>
>> #define Clock_driver_support_install_isr(isr, old_isr) \
>> do { \
>> - or1ksim_clock_handler_install(isr, old_isr); \
>> old_isr = NULL; \
>> + or1ksim_clock_handler_install(isr, old_isr); \
>> } while (0)
>>
>> Is old_isr an ISR or a pointer to an ISR method? I was wondering
> if that should be *old_isr and be set in or1k_clock_handler_install.
>
It's a pointer to the ISR method, and initially 0 (Null) within the ISR
vector table. Since Clock_driver_support_install_isr is first called when
installing the clock driver, old_isr would be always Null. Other BSPs do
the same thing.
>
> #define Clock_driver_support_shutdown_hardware()
>> or1ksim_clock_cleanup()
>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>> b/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>> index 7ceca81..31cdce6 100644
>> --- a/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>> +++ b/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>>
> This all looks right. I did this same thing to a LOT of BSPs. :(
>
> @@ -21,6 +21,14 @@
>> #include <bsp/uart.h>
>> #include <rtems/score/isr.h>
>>
>> +static void uart_initialize(int minor);
>> +static int uart_first_open(int major, int minor, void *arg);
>> +static int uart_last_close(int major, int minor, void *arg);
>> +static int uart_read_polled(int minor);
>> +static ssize_t uart_write(int minor, const char *buf, size_t len);
>> +static void uart_write_polled(int minor, char c);
>> +static int uart_set_attributes(int minor, const struct termios *t);
>> +
>> static rtems_vector_number uart_get_irq_number(const console_tbl *ct)
>> {
>> return ct->ulIntVector;
>> @@ -86,10 +94,9 @@ static int uart_last_close(int major, int minor, void
>> *arg)
>> return 0;
>> }
>>
>> -static char uart_read_polled(int minor)
>> +static int uart_read_polled(int minor)
>> {
>> unsigned char lsr;
>> - char c;
>>
>> /* Get a character when avaiable */
>> do {
>> @@ -120,7 +127,7 @@ static void uart_write_polled(int minor, char c)
>> } while ( (lsr & transmit_finished) != transmit_finished );
>> }
>>
>> -static ssize_t uart_write_support_polled(
>> +static ssize_t uart_write(
>> int minor,
>> const char *s,
>> size_t n
>> @@ -145,7 +152,7 @@ const console_fns or1ksim_uart_fns = {
>> .deviceFirstOpen = uart_first_open,
>> .deviceLastClose = uart_last_close,
>> .deviceRead = uart_read_polled,
>> - .deviceWrite = uart_write_support_polled,
>> + .deviceWrite = uart_write,
>> .deviceInitialize = uart_initialize,
>> .deviceWritePolled = uart_write_polled,
>> .deviceSetAttributes = uart_set_attributes,
>> --
>> 1.9.3
>>
>>
>
> --
> Joel Sherrill, Ph.D. Director of Research & Developmentjoel.sherrill at OARcorp.com On-Line Applications Research
> Ask me about RTEMS: a free RTOS Huntsville AL 35805
> Support Available (256) 722-9985
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20141013/dad92930/attachment-0002.html>
More information about the devel
mailing list