X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=UDI%2Fdrivers%2Fuart_16c550%2Fuart16c550.c;h=510bc47202e8b3a149a0e9d199d956fe45e407c4;hb=230612b2efeeb769f1d96193ec01b10bd36d9873;hp=0f7bdc9fd07e66da8ed2c87fc34d6df8dfe0ca16;hpb=78c3ffa5189daa66d7096eb0170203d743288967;p=tpg%2Facess2.git diff --git a/UDI/drivers/uart_16c550/uart16c550.c b/UDI/drivers/uart_16c550/uart16c550.c index 0f7bdc9f..510bc472 100644 --- a/UDI/drivers/uart_16c550/uart16c550.c +++ b/UDI/drivers/uart_16c550/uart16c550.c @@ -5,13 +5,22 @@ * uart16c550.c * - UDI initialisation */ +#define UDI_VERSION 0x101 +#define UDI_PCI_VERSION 0x101 +#define UDI_PHYSIO_VERSION 0x101 #include #include +#include #include "uart16c550_common.h" - #include "uart16c550_pio.h" +#if 0 +# define DEBUG_OUT(fmt, v...) udi_debug_printf("%s: "fmt"\n", __func__ ,## v) +#else +# define DEBUG_OUT(...) do{}while(0) +#endif + #define __EXPJOIN(a,b) a##b #define _EXPJOIN(a,b) __EXPJOIN(a,b) #define _EXPLODE(params...) params @@ -25,6 +34,7 @@ void uart_usage_ind(udi_usage_cb_t *cb, udi_ubit8_t resource_level) { rdata_t *rdata = UDI_GCB(cb)->context; + //udi_trace_write(rdata->init_context, UDI_TREVENT_LOCAL_PROC_ENTRY, 0, ); // TODO: Set up region data @@ -94,7 +104,7 @@ void uart_bus_dev_bus_bind_ack(udi_bus_bind_cb_t *cb, void uart_bus_dev_bind__pio_map(udi_cb_t *gcb, udi_pio_handle_t new_pio_handle) { rdata_t *rdata = gcb->context; - if( rdata->init.pio_index != -1 ) + if( rdata->init.pio_index != (udi_index_t)-1 ) { rdata->pio_handles[rdata->init.pio_index] = new_pio_handle; } @@ -187,7 +197,7 @@ void uart_bus_irq_intr_event_ind(udi_intr_event_cb_t *cb, udi_ubit8_t flags) udi_cb_t *gcb = UDI_GCB(cb); rdata_t *rdata = gcb->context; - udi_debug_printf("%s: flags=%x, intr_result=%x\n", __func__, flags, cb->intr_result); + DEBUG_OUT("flags=%x, intr_result=%x", flags, cb->intr_result); if( cb->intr_result == 0 ) { // An IRQ from something other than RX @@ -198,7 +208,7 @@ void uart_bus_irq_intr_event_ind(udi_intr_event_cb_t *cb, udi_ubit8_t flags) if( rdata->rx_buffer && rdata->rx_buffer->buf_size + cb->intr_result > MAX_RX_BUFFER_SIZE ) { // Drop, buffer is full - udi_debug_printf("%s: dropping %i bytes, full rx buffer\n", __func__, cb->intr_result); + DEBUG_OUT("dropping %i bytes, full rx buffer", cb->intr_result); udi_intr_event_rdy(cb); return ; } @@ -214,7 +224,7 @@ void uart_bus_irq_intr_event_ind(udi_intr_event_cb_t *cb, udi_ubit8_t flags) rdata->rx_buffer = new_buf; - udi_debug_printf("%s: copied %i bytes\n", __func__, cb->intr_result); + DEBUG_OUT("copied %i bytes", cb->intr_result); // Emit a signal to GIO client if( rdata->event_cb && !rdata->event_cb_used ) @@ -225,8 +235,8 @@ void uart_bus_irq_intr_event_ind(udi_intr_event_cb_t *cb, udi_ubit8_t flags) } else { - udi_debug_printf("%s: event_cb=%p, event_cb_used=%i - Queueing\n", - __func__, rdata->event_cb, rdata->event_cb_used); + DEBUG_OUT("event_cb=%p, event_cb_used=%i - Queueing", + rdata->event_cb, rdata->event_cb_used); rdata->event_pending = TRUE; } @@ -251,7 +261,7 @@ void uart_gio_prov_bind_req(udi_gio_bind_cb_t *cb) // TODO: Should this device allow multiple children? if( rdata->event_cb ) { - udi_debug_printf("%s: only one client allowed\n", __func__); + DEBUG_OUT("only one client allowed"); udi_gio_bind_ack(cb, 0, 0, UDI_STAT_CANNOT_BIND_EXCL); return; } @@ -293,7 +303,7 @@ void uart_gio_prov_xfer_req(udi_gio_xfer_cb_t *cb) len = cb->data_buf->buf_size; callback = uart_gio_read_complete; } - udi_debug_printf("%s: Read %i/%i bytes\n", __func__, len, rdata->rx_buffer->buf_size); + DEBUG_OUT("Read %i/%i bytes", len, rdata->rx_buffer->buf_size); // Replace entire destination buffer with `len` bytes from source udi_buf_copy(callback, gcb, rdata->rx_buffer, 0, len,