Commit afe4ee24 authored by julien.delange's avatar julien.delange

* po-hi-c/src/drivers/po_hi_driver_rasta_serial.c

   po-hi-c/src/drivers/po_hi_driver_rasta_common.c
   po-hi-c/src/drivers/po_hi_driver_linux_serial.c
   - Adapt files to new debug levels



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@1694 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent df001e82
......@@ -59,6 +59,7 @@ void __po_hi_c_driver_serial_linux_poller (void)
n = read (po_hi_c_driver_serial_fd_read, &(msg.content[0]), __PO_HI_MESSAGES_MAX_SIZE);
#ifdef __PO_HI_DEBUG_INFO
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Message: 0x");
for (ts = 0 ; ts < __PO_HI_MESSAGES_MAX_SIZE ; ts++)
......@@ -66,6 +67,7 @@ void __po_hi_c_driver_serial_linux_poller (void)
__PO_HI_DEBUG_INFO ("%x", msg.content[ts]);
}
__PO_HI_DEBUG_INFO ("\n");
#endif
if (n == -1)
{
......@@ -87,6 +89,7 @@ void __po_hi_c_driver_serial_linux_poller (void)
swap_value = *swap_pointer;
*swap_pointer = __po_hi_swap_byte (swap_value);
#ifdef __PO_HI_DEBUG_INFO
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Message after swapped port: 0x");
for (ts = 0 ; ts < msg.length ; ts++)
{
......@@ -95,6 +98,7 @@ void __po_hi_c_driver_serial_linux_poller (void)
__PO_HI_DEBUG_INFO ("\n");
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Received: %s\n", msg.content);
#endif
__po_hi_unmarshall_request (&request, &msg);
......@@ -400,6 +404,7 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
n = write (po_hi_c_driver_serial_fd_write, &msg, __PO_HI_MESSAGES_MAX_SIZE);
#ifdef __PO_HI_DEBUG_INFO
__PO_HI_DEBUG_INFO ("[LINUX SERIAL] Message sent: 0x");
for (ts = 0 ; ts < __PO_HI_MESSAGES_MAX_SIZE ; ts++)
......@@ -407,6 +412,7 @@ int __po_hi_c_driver_serial_linux_sender (__po_hi_task_id task_id, __po_hi_port
__PO_HI_DEBUG_INFO ("%x", msg.content[ts]);
}
__PO_HI_DEBUG_INFO ("\n");
#endif
return 1;
}
......
......@@ -44,6 +44,9 @@
#define GPIO1_OFF 0x200700
void rasta_interrrupt_register(void *handler, int irqno, void *arg);
int apbuart_rasta_register(amba_confarea_type *bus);
int __po_hi_c_driver_rasta_common_is_init = 0;
......@@ -196,19 +199,28 @@ int __po_hi_rasta_get_gpio(amba_confarea_type *abus, int index, struct gpio_reg
amba_apb_device dev;
int cores;
if ( !abus )
if (! abus)
{
__PO_HI_DEBUG_CRITICAL ("[RASTA COMMON] NULL abus\n");
return -1;
}
/* Scan PnP info for GPIO port number 'index' */
cores = amba_find_next_apbslv(abus,VENDOR_GAISLER,GAISLER_GPIO,&dev,index);
if ( cores < 1 )
{
return -1;
}
if ( regs )
{
*regs = (struct gpio_reg *)dev.start;
}
if ( irq )
{
*irq = dev.irq;
}
return 0;
}
......@@ -317,20 +329,22 @@ int __po_hi_rasta_register(void)
memset(&abus,0,sizeof(abus));
/* Start AMBA PnP scan at first AHB bus */
amba_scan(&abus,__po_hi_driver_rasta_bar0+(AHB1_IOAREA_BASE_ADDR&~0xf0000000),&amba_maps[0]);
amba_scan (&abus,__po_hi_driver_rasta_bar0+(AHB1_IOAREA_BASE_ADDR&~0xf0000000),&amba_maps[0]);
__PO_HI_DEBUG_DEBUG ("abus addr=%x\n", &abus);
/* Find GPIO0 address */
if ( __po_hi_rasta_get_gpio(&abus,0,&gpio0,NULL) ){
printk("Failed to get address for RASTA GPIO0\n\r");
return -1;
printk("Failed to get address for RASTA GPIO0\n\r");
return -1;
}
/* Find GPIO1 address */
if ( __po_hi_rasta_get_gpio(&abus,1,&gpio1,NULL) ){
printk("Failed to get address for RASTA GPIO1\n\r");
__PO_HI_DEBUG_DEBUG ("Failed to get address for RASTA GPIO1\n\r");
return -1;
}
DBG ("Successful init of the RASTA\n");
__PO_HI_DEBUG_DEBUG ("Successful init of the RASTA\n");
/* Successfully registered the RASTA board */
return 0;
}
......@@ -352,7 +366,7 @@ void __po_hi_c_driver_rasta_common_init ()
}
*/
if (rasta_register() ){
__DEBUGMSG(" ERROR !\n");
__PO_HI_DEBUG_DEBUG(" ERROR !\n");
return;
}
......
......@@ -69,6 +69,7 @@ void __po_hi_c_driver_serial_rasta_poller (void)
tr += n;
}
#ifdef __PO_HI_DEBUG_INFO
__PO_HI_DEBUG_INFO ("[RASTA SERIAL] read() returns total %d, max message size=%d\n", tr, __PO_HI_MESSAGES_MAX_SIZE);
__PO_HI_DEBUG_INFO ("[RASTA SERIAL] Message received by poller: 0x");
......@@ -77,6 +78,7 @@ void __po_hi_c_driver_serial_rasta_poller (void)
__PO_HI_DEBUG_INFO ("%x", __po_hi_c_driver_rasta_serial_msg.content[ts]);
}
__PO_HI_DEBUG_INFO ("\n");
#endif
__po_hi_c_driver_rasta_serial_msg.length = tr;
......@@ -99,8 +101,7 @@ void __po_hi_c_driver_serial_rasta_init (__po_hi_device_id id)
__PO_HI_DEBUG_INFO ("[RASTA SERIAL] Initialization starts !\n");
/*
apbuart_rasta_int_reg=__po_hi_rasta_interrrupt_register;
if ( apbuart_rasta_register(__po_hi_driver_rasta_common_get_bus ()) )
if ( apbuart_rasta_register (__po_hi_driver_rasta_common_get_bus ()) )
{
__PO_HI_DEBUG_CRITICAL ("[RASTA SERIAL] Failed to register RASTA APBUART driver\n\r");
}
......@@ -112,6 +113,7 @@ void __po_hi_c_driver_serial_rasta_init (__po_hi_device_id id)
{
__PO_HI_DEBUG_CRITICAL ("[RASTA SERIAL] Error while opening device %s\n", __po_hi_get_device_naming (id));
}
__PO_HI_DEBUG_DEBUG ("[RASTA SERIAL] Device open, fd=%d\n", po_hi_c_driver_rasta_serial_fd);
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_BAUDRATE, __PO_HI_DRIVER_SERIAL_RASTA_BAUDRATE); /* stream mode */
__PO_HI_DRIVERS_RTEMS_UTILS_IOCTL(po_hi_c_driver_rasta_serial_fd, APBUART_SET_BLOCKING, APBUART_BLK_RX | APBUART_BLK_TX | APBUART_BLK_FLUSH);
......@@ -150,10 +152,12 @@ int __po_hi_c_driver_serial_rasta_sender (const __po_hi_task_id task_id, const _
__po_hi_marshall_request (request, &msg);
__PO_HI_DEBUG_INFO ("[RASTA SERIAL] Message sent: 0x");
#ifdef __PO_HI_DEBUG_LEVEL_INFO
for (ts = 0 ; ts < __PO_HI_MESSAGES_MAX_SIZE ; ts++)
{
__PO_HI_DEBUG_INFO ("%x", msg.content[ts]);
}
#endif
__PO_HI_DEBUG_INFO ("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment