Index: soft/giet_vm/sys/drivers.c
===================================================================
--- soft/giet_vm/sys/drivers.c	(revision 226)
+++ soft/giet_vm/sys/drivers.c	(revision 228)
@@ -103,5 +103,5 @@
 
 //////////////////////////////////////////////////////////////////////////////
-// 	Timers driver
+//     Timers driver
 //////////////////////////////////////////////////////////////////////////////
 // The timers can be implemented in a vci_timer component or in a vci_xicu 
@@ -119,6 +119,6 @@
 
 #if (NB_TIMERS_MAX > 0)
-in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS*NB_TIMERS_MAX] 
-         = { [0 ... ((NB_CLUSTERS*NB_TIMERS_MAX)-1)] = 0 };
+in_unckdata volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX] 
+= { [0 ... ((NB_CLUSTERS * NB_TIMERS_MAX) - 1)] = 0 };
 #endif
 
@@ -131,27 +131,27 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////
-unsigned int _timer_start( unsigned int	cluster_id,
-                           unsigned int	local_id,
-                           unsigned int	period )
-{
+unsigned int _timer_start(unsigned int cluster_id, unsigned int local_id, unsigned int period) {
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS)	return 1;
-    if ( local_id >= NB_TIMERS_MAX) return 2;
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (local_id >= NB_TIMERS_MAX) {
+        return 2;
+    }
 
 #if USE_XICU
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
-                                  (cluster_id * CLUSTER_SIZE) );
+    unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base + (cluster_id * CLUSTER_SIZE));
 
     timer_address[XICU_REG(XICU_PTI_PER, local_id)] = period;
 #else
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 
-                                  (cluster_id * CLUSTER_SIZE) );
+    unsigned int* timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE));
 
     timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period;
-    timer_address[local_id * TIMER_SPAN + TIMER_MODE]   = 0x3;
-#endif
-
-    return 0;
-}
+    timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0x3;
+#endif
+    return 0;
+}
+
+
 //////////////////////////////////////////////////////////////////////////////
 //     _timer_stop()
@@ -160,25 +160,25 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////
-unsigned int _timer_stop( unsigned int	cluster_id,
-                          unsigned int	local_id )
-{
+unsigned int _timer_stop(unsigned int cluster_id, unsigned int local_id) {
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS)	 return 1;
-    if ( local_id >= NB_TIMERS_MAX ) return 2;
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (local_id >= NB_TIMERS_MAX) {
+        return 2;
+    }
 
 #if USE_XICU
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
-                                  (cluster_id * CLUSTER_SIZE) );
+    unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base + (cluster_id * CLUSTER_SIZE));
 
     timer_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;
 #else
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 
-                                  (cluster_id * CLUSTER_SIZE) );
-
+    unsigned int* timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * CLUSTER_SIZE));
     timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0;
 #endif
-
-    return 0;
-}
+    return 0;
+}
+
+
 //////////////////////////////////////////////////////////////////////////////
 //     _timer_reset_irq()
@@ -189,20 +189,22 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////
-unsigned int _timer_reset_irq( unsigned int	cluster_id,
-                               unsigned int	local_id )
-{
+unsigned int _timer_reset_irq(unsigned int cluster_id, unsigned int local_id) {
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS)	 return 1;
-    if ( local_id >= NB_TIMERS_MAX ) return 2;
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (local_id >= NB_TIMERS_MAX) {
+        return 2;
+    }
 
 #if USE_XICU
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
-                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
+    unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base +
+            (cluster_id * (unsigned) CLUSTER_SIZE));
 
     unsigned int bloup = timer_address[XICU_REG(XICU_PTI_ACK, local_id)];
-    bloup++;	// to avoid a warning 
+    bloup++; // to avoid a warning 
 #else
-    unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 
-                                  (cluster_id * CLUSTER_SIZE) );
+    unsigned int * timer_address = (unsigned int *)((char *) &seg_tim_base + 
+            (cluster_id * CLUSTER_SIZE));
 
     timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0;
@@ -212,6 +214,7 @@
 }
 
+
 /////////////////////////////////////////////////////////////////////////////////
-// 	VciMultiTty driver
+//     VciMultiTty driver
 /////////////////////////////////////////////////////////////////////////////////
 // There is only one multi_tty controler in the architecture.
@@ -226,25 +229,28 @@
 // TTY variables
 in_unckdata volatile unsigned char _tty_get_buf[NB_TTYS];
-in_unckdata volatile unsigned char _tty_get_full[NB_TTYS] = { [0 ... NB_TTYS-1] = 0 };
-in_unckdata unsigned int           _tty_put_lock = 0;  // protect kernel TTY[0]
+in_unckdata volatile unsigned char _tty_get_full[NB_TTYS] = { [0 ... NB_TTYS - 1] = 0 };
+in_unckdata unsigned int _tty_put_lock = 0;  // protect kernel TTY[0]
 
 ////////////////////////////////////////////////////////////////////////////////
 //      _tty_error()
 ////////////////////////////////////////////////////////////////////////////////
-void _tty_error( unsigned int tty_id, unsigned int task_id )
-{
+void _tty_error(unsigned int tty_id, unsigned int task_id) {
     unsigned int proc_id = _procid();
 
     _get_lock(&_tty_put_lock);
-    if( tty_id == 0xFFFFFFFF )
+    if (tty_id == 0xFFFFFFFF) {
         _puts("\n[GIET ERROR] no TTY assigned to the task ");
-    else
+    }
+    else {
         _puts("\n[GIET ERROR] TTY index too large for task ");
-    _putd( task_id );
+    }
+    _putd(task_id);
     _puts(" on processor ");
-    _putd( proc_id );
+    _putd(proc_id);
     _puts("\n");
     _release_lock(&_tty_put_lock);
 }
+
+
 /////////////////////////////////////////////////////////////////////////////////
 //      _tty_write()
@@ -256,31 +262,30 @@
 // The function returns  the number of characters that have been written.
 /////////////////////////////////////////////////////////////////////////////////
-unsigned int _tty_write( const char		*buffer, 
-                         unsigned int	length)
-{
-    unsigned int	nwritten;
-
-    unsigned int task_id  = _get_current_task_id();
-    unsigned int tty_id   = _get_context_slot(task_id, CTX_TTY_ID);
-
-    if ( tty_id >= NB_TTYS )
-    {
-        _tty_error( tty_id , task_id );
+unsigned int _tty_write(const char * buffer, unsigned int length) {
+    unsigned int nwritten;
+    unsigned int task_id = _get_current_task_id();
+    unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID);
+
+    if (tty_id >= NB_TTYS) {
+        _tty_error(tty_id , task_id);
         return 0;
     }
 
-    unsigned int*	tty_address = (unsigned int*) &seg_tty_base;
-
-    for (nwritten = 0; nwritten < length; nwritten++)
-    {
+    unsigned int * tty_address = (unsigned int *) &seg_tty_base;
+
+    for (nwritten = 0; nwritten < length; nwritten++) {
         // check tty's status 
-        if ((tty_address[tty_id*TTY_SPAN + TTY_STATUS] & 0x2) == 0x2)
+        if ((tty_address[tty_id * TTY_SPAN + TTY_STATUS] & 0x2) == 0x2) {
             break;
-        else
+        }
+        else {
             // write character 
-            tty_address[tty_id*TTY_SPAN + TTY_WRITE] = (unsigned int)buffer[nwritten];
+            tty_address[tty_id * TTY_SPAN + TTY_WRITE] = (unsigned int) buffer[nwritten];
+        }
     }
     return nwritten;
 }
+
+
 //////////////////////////////////////////////////////////////////////////////
 //      _tty_read()
@@ -294,27 +299,24 @@
 // Returns 0 if the kernel buffer is empty, 1 if the buffer is full.
 //////////////////////////////////////////////////////////////////////////////
-unsigned int _tty_read( char			*buffer, 
-                        unsigned int	length)
-{
-    unsigned int task_id  = _get_current_task_id();
-    unsigned int tty_id   = _get_context_slot(task_id, CTX_TTY_ID);
-
-    if ( tty_id >= NB_TTYS )
-    {
-        _tty_error( tty_id, task_id );
+unsigned int _tty_read(char * buffer, unsigned int length) {
+    unsigned int task_id = _get_current_task_id();
+    unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID);
+
+    if (tty_id >= NB_TTYS) {
+        _tty_error(tty_id, task_id);
         return 0;
     }
 
-    if (_tty_get_full[tty_id] == 0) 
-    {
+    if (_tty_get_full[tty_id] == 0) {
         return 0;
     }
-    else
-    {
+    else {
         *buffer = _tty_get_buf[tty_id];
         _tty_get_full[tty_id] = 0;
         return 1;
     }
-} 
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //     _tty_get_char()
@@ -324,19 +326,20 @@
 // Returns 0 if success, 1 if tty_id too large. 
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int _tty_get_char( unsigned int	tty_id,
-                            unsigned char*  buffer )
-{
+unsigned int _tty_get_char(unsigned int tty_id, unsigned char * buffer) {
     // checking argument
-    if ( tty_id >= NB_TTYS ) return 1;
+    if (tty_id >= NB_TTYS) {
+        return 1;
+    }
 
     // compute terminal base address 
-    unsigned int *tty_address = (unsigned int*) &seg_tty_base; 
-
-    *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ];
-    return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// 	VciMultiIcu and VciXicu drivers
+    unsigned int * tty_address = (unsigned int *) &seg_tty_base; 
+
+    *buffer = (unsigned char) tty_address[tty_id * TTY_SPAN + TTY_READ];
+    return 0;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//     VciMultiIcu and VciXicu drivers
 ////////////////////////////////////////////////////////////////////////////////
 // There is one vci_multi_icu (or vci_xicu) component per cluster, 
@@ -352,18 +355,26 @@
 // Returns 0 if success, > 0 if error.
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int _icu_set_mask( unsigned int cluster_id,
-                            unsigned int proc_id,
-                            unsigned int value,
-                            unsigned int is_timer )
-{
+unsigned int _icu_set_mask(
+        unsigned int cluster_id,
+        unsigned int proc_id,
+        unsigned int value,
+        unsigned int is_timer) {
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS)		return 1;
-    if ( proc_id    >= NB_PROCS_MAX )   return 1;
-
-    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 
-                                (cluster_id * (unsigned)CLUSTER_SIZE) );
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (proc_id >= NB_PROCS_MAX) {
+        return 1;
+    }
+
+    unsigned int * icu_address = (unsigned int *) ((char *) &seg_icu_base + 
+            (cluster_id * (unsigned) CLUSTER_SIZE));
 #if USE_XICU
-    if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
-    else            icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value;
+    if (is_timer) {
+        icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
+    }
+    else {
+        icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value;
+    }
 #else
     icu_address[proc_id * ICU_SPAN + ICU_MASK_SET] = value; 
@@ -372,4 +383,6 @@
     return 0;
 }
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //     _icu_get_index()
@@ -379,16 +392,17 @@
 // Returns 0 if success, > 0 if error.
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int _icu_get_index(  unsigned int cluster_id,
-                              unsigned int proc_id,
-                              unsigned int* buffer )
-{
+unsigned int _icu_get_index(unsigned int cluster_id, unsigned int proc_id, unsigned int * buffer) {
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS)		return 1;
-    if ( proc_id    >= NB_PROCS_MAX )   return 1;
-
-    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 
-                                (cluster_id * (unsigned)CLUSTER_SIZE) );
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (proc_id >= NB_PROCS_MAX) {
+        return 1;
+    }
+
+    unsigned int * icu_address = (unsigned int *) ((char *) &seg_icu_base + 
+            (cluster_id * (unsigned) CLUSTER_SIZE));
 #if USE_XICU
-    unsigned int prio   = icu_address[XICU_REG(XICU_PRIO, proc_id)];
+    unsigned int prio = icu_address[XICU_REG(XICU_PRIO, proc_id)];
     unsigned int pti_ok = (prio & 0x00000001);
     unsigned int hwi_ok = (prio & 0x00000002);
@@ -397,8 +411,16 @@
     unsigned int hwi_id = (prio & 0x001F0000) >> 16;
     unsigned int swi_id = (prio & 0x1F000000) >> 24;
-    if      (pti_ok)	*buffer = pti_id;
-    else if (hwi_ok)	*buffer = hwi_id;
-    else if (swi_ok)	*buffer = swi_id;
-    else                *buffer = 32;
+    if (pti_ok) {
+        *buffer = pti_id;
+    }
+    else if (hwi_ok) {
+        *buffer = hwi_id;
+    }
+    else if (swi_ok) {
+        *buffer = swi_id;
+    }
+    else {
+        *buffer = 32;
+    }
 #else
     *buffer = icu_address[proc_id * ICU_SPAN + ICU_IT_VECTOR]; 
@@ -408,6 +430,7 @@
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// 	VciGcd driver
+
+////////////////////////////////////////////////////////////////////////////////
+//     VciGcd driver
 ////////////////////////////////////////////////////////////////////////////////
 // The Greater Dommon Divider is a -very- simple hardware coprocessor
@@ -421,16 +444,17 @@
 // Returns 0 if success, > 0 if error.
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int _gcd_write( unsigned int register_index, 
-                         unsigned int value)
-{
+unsigned int _gcd_write(unsigned int register_index, unsigned int value) {
     // parameters checking
-    if (register_index >= GCD_END)
-        return 1;
-
-    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
+    if (register_index >= GCD_END) {
+        return 1;
+    }
+
+    unsigned int * gcd_address = (unsigned int *) &seg_gcd_base;
 
     gcd_address[register_index] = value; // write word
     return 0;
 }
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //     _gcd_read()
@@ -438,12 +462,11 @@
 // Returns 0 if success, > 0 if error.
 ////////////////////////////////////////////////////////////////////////////////
-unsigned int _gcd_read( unsigned int register_index, 
-                        unsigned int *buffer)
-{
+unsigned int _gcd_read(unsigned int register_index, unsigned int * buffer) {
     // parameters checking 
-    if (register_index >= GCD_END)
-        return 1;
-
-    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
+    if (register_index >= GCD_END) {
+        return 1;
+    }
+
+    unsigned int * gcd_address = (unsigned int *) &seg_gcd_base;
 
     *buffer = gcd_address[register_index]; // read word
@@ -502,9 +525,9 @@
 
 // IOC global variables
-in_unckdata volatile unsigned int	_ioc_status       = 0;
-in_unckdata volatile unsigned int	_ioc_done         = 0;
-in_unckdata unsigned int			_ioc_lock         = 0;
-in_unckdata unsigned int			_ioc_iommu_ix1    = 0;
-in_unckdata unsigned int			_ioc_iommu_npages; 
+in_unckdata volatile unsigned int _ioc_status= 0;
+in_unckdata volatile unsigned int _ioc_done = 0;
+in_unckdata unsigned int _ioc_lock = 0;
+in_unckdata unsigned int _ioc_iommu_ix1 = 0;
+in_unckdata unsigned int _ioc_iommu_npages; 
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -519,67 +542,78 @@
 // Returns 0 if success, > 0 if error.
 ///////////////////////////////////////////////////////////////////////////////
-unsigned int _ioc_access( unsigned int  to_mem,
-                          unsigned int 	lba,
-                          unsigned int  user_vaddr,
-                          unsigned int 	count )
-{
-    unsigned int		user_vpn_min;	// first virtuel page index in user space
-    unsigned int		user_vpn_max;	// last virtual page index in user space
-    unsigned int		vpn;			// current virtual page index in user space
-    unsigned int		ppn;			// physical page number
-    unsigned int		flags;			// page protection flags
-    unsigned int		ix2;			// page index in IOMMU PT1 page table
-    unsigned int		addr;			// buffer address for IOC peripheral
-    unsigned int		ppn_first;		// first physical page number for user buffer
-        
+unsigned int _ioc_access(
+        unsigned int to_mem,
+        unsigned int lba,
+        unsigned int user_vaddr,
+        unsigned int count) {
+    unsigned int user_vpn_min; // first virtuel page index in user space
+    unsigned int user_vpn_max; // last virtual page index in user space
+    unsigned int vpn;          // current virtual page index in user space
+    unsigned int ppn;          // physical page number
+    unsigned int flags;        // page protection flags
+    unsigned int ix2;          // page index in IOMMU PT1 page table
+    unsigned int addr;         // buffer address for IOC peripheral
+    unsigned int ppn_first;    // first physical page number for user buffer
+
     // check buffer alignment
-    if ( (unsigned int)user_vaddr & 0x3 ) return 1;
-
-    unsigned int*	ioc_address = (unsigned int*) &seg_ioc_base ;
-
-    unsigned int	block_size   = ioc_address[BLOCK_DEVICE_BLOCK_SIZE];
-    unsigned int	length       = count*block_size;
+    if ((unsigned int) user_vaddr & 0x3) {
+        return 1;
+    }
+
+    unsigned int * ioc_address = (unsigned int *) &seg_ioc_base ;
+
+    unsigned int block_size = ioc_address[BLOCK_DEVICE_BLOCK_SIZE];
+    unsigned int length = count * block_size;
 
     // get user space page table virtual address
-    unsigned int task_id       = _get_current_task_id();
-    unsigned int user_pt_vbase = _get_context_slot( task_id, CTX_PTAB_ID );
-    
+    unsigned int task_id = _get_current_task_id();
+    unsigned int user_pt_vbase = _get_context_slot(task_id, CTX_PTAB_ID);
+
     user_vpn_min = user_vaddr >> 12;
     user_vpn_max = (user_vaddr + length - 1) >> 12;
-    ix2          = 0;
+    ix2 = 0;
 
     // loop on all virtual pages covering the user buffer
-    for ( vpn = user_vpn_min ; vpn <= user_vpn_max ; vpn++ )
-    {
+    for (vpn = user_vpn_min; vpn <= user_vpn_max; vpn++) {
         // get ppn and flags for each vpn
-        unsigned int ko = _v2p_translate( (page_table_t*)user_pt_vbase,
-                                           vpn,
-                                           &ppn,
-                                           &flags );
+        unsigned int ko = _v2p_translate((page_table_t *) user_pt_vbase, vpn, &ppn, &flags);
 
         // check access rights
-        if ( ko )								  return 2;		// unmapped
-        if ( (flags & PTE_U) == 0 )				  return 3;		// not in user space
-        if ( ( (flags & PTE_W) == 0 ) && to_mem ) return 4;		// not writable
+        if (ko) {
+            return 2; // unmapped
+        }
+        if ((flags & PTE_U) == 0) {
+            return 3; // not in user space
+        }
+        if (((flags & PTE_W) == 0 ) && to_mem) {
+            return 4; // not writable
+        }
 
         // save first ppn value
-        if ( ix2 == 0 ) ppn_first = ppn;
-
-        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
-        {
+        if (ix2 == 0) {
+            ppn_first = ppn;
+        }
+
+        if (IOMMU_ACTIVE) {
+            // the user buffer must be remapped in the I/0 space
             // check buffer length < 2 Mbytes
-            if ( ix2 > 511 ) return 2;
+            if (ix2 > 511) {
+                return 2;
+            }
 
             // map the physical page in IOMMU page table
-            _iommu_add_pte2( _ioc_iommu_ix1,	// PT1 index
-                             ix2,				// PT2 index
-					         ppn,				// Physical page number	
-                             flags );			// Protection flags
+            _iommu_add_pte2(
+                    _ioc_iommu_ix1,    // PT1 index
+                    ix2,               // PT2 index
+                    ppn,               // Physical page number    
+                    flags);            // Protection flags
         }
-        else			// no IOMMU : check that physical pages are contiguous
-        {
-            if ( (ppn - ppn_first) != ix2 )	      return 5;		// split physical buffer  
+        else {
+            // no IOMMU : check that physical pages are contiguous
+            if ((ppn - ppn_first) != ix2) {
+                return 5; // split physical buffer
+            }
         }
-        
+
         // increment page index
         ix2++;
@@ -590,22 +624,34 @@
 
     // invalidate data cache in case of memory write
-    if ( to_mem ) _dcache_buf_invalidate( (void*)user_vaddr, length );
+    if (to_mem) {
+        _dcache_buf_invalidate((void *) user_vaddr, length);
+    }
 
     // compute buffer base address for IOC depending on IOMMU activation
-    if ( IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
-    else                     addr = (ppn_first << 12) | (user_vaddr & 0xFFF);
+    if (IOMMU_ACTIVE) {
+        addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
+    }
+    else {
+        addr = (ppn_first << 12) | (user_vaddr & 0xFFF);
+    }
 
     // get the lock on ioc device 
-    _get_lock( &_ioc_lock );
+    _get_lock(&_ioc_lock);
 
     // peripheral configuration  
-    ioc_address[BLOCK_DEVICE_BUFFER]     = addr;
-    ioc_address[BLOCK_DEVICE_COUNT]      = count;
-    ioc_address[BLOCK_DEVICE_LBA]        = lba;
-    if ( to_mem == 0 ) ioc_address[BLOCK_DEVICE_OP] = BLOCK_DEVICE_WRITE;
-    else               ioc_address[BLOCK_DEVICE_OP] = BLOCK_DEVICE_READ;
-
-    return 0;
-}
+    ioc_address[BLOCK_DEVICE_BUFFER] = addr;
+    ioc_address[BLOCK_DEVICE_COUNT] = count;
+    ioc_address[BLOCK_DEVICE_LBA] = lba;
+    if (to_mem == 0) {
+        ioc_address[BLOCK_DEVICE_OP] = BLOCK_DEVICE_WRITE;
+    }
+    else {
+        ioc_address[BLOCK_DEVICE_OP] = BLOCK_DEVICE_READ;
+    }
+
+    return 0;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////////
 // _ioc_completed()
@@ -617,23 +663,22 @@
 // Returns 0 if success, > 0 if error.
 /////////////////////////////////////////////////////////////////////////////////
-unsigned int _ioc_completed()
-{
-    unsigned int	ret;
-    unsigned int	ix2;
+unsigned int _ioc_completed() {
+    unsigned int ret;
+    unsigned int ix2;
 
     // busy waiting
-    while (_ioc_done == 0)
+    while (_ioc_done == 0) {
         asm volatile("nop");
+    }
 
     // unmap the buffer from IOMMU page table if IOMMU is activated
-    if ( IOMMU_ACTIVE )
-    {
-        unsigned int* iob_address = (unsigned int*) &seg_iob_base;
-
-        for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ )
-        {
+    if (IOMMU_ACTIVE) {
+        unsigned int * iob_address = (unsigned int *) &seg_iob_base;
+
+        for (ix2 = 0; ix2 < _ioc_iommu_npages; ix2++) {
             // unmap the page in IOMMU page table
-            _iommu_inval_pte2( _ioc_iommu_ix1,	// PT1 index 
-                              ix2 );			// PT2 index
+            _iommu_inval_pte2(
+                    _ioc_iommu_ix1, // PT1 index 
+                    ix2 );          // PT2 index
 
             // clear IOMMU TLB
@@ -644,14 +689,20 @@
     // test IOC status 
     if ((_ioc_status != BLOCK_DEVICE_READ_SUCCESS)
-            && (_ioc_status != BLOCK_DEVICE_WRITE_SUCCESS)) ret = 1;	// error
-    else                                                    ret = 0;	// success
+            && (_ioc_status != BLOCK_DEVICE_WRITE_SUCCESS)) {
+        ret = 1; // error
+    }
+    else {
+        ret = 0; // success
+    }
 
     // reset synchronization variables
     _ioc_done = 0;
-    asm volatile ("sync");
+    asm volatile("sync");
     _ioc_lock = 0;
 
     return ret;
 }
+
+
 ///////////////////////////////////////////////////////////////////////////////
 //     _ioc_read()
@@ -662,13 +713,13 @@
 // Returns 0 if success, > 0 if error.
 ///////////////////////////////////////////////////////////////////////////////
-unsigned int _ioc_read( unsigned int 	lba, 
-                        void*		    buffer, 
-                        unsigned int	count )
-{
-    return _ioc_access( 1,		// read access
-                        lba,
-                        (unsigned int)buffer,
-                        count );
-}
+unsigned int _ioc_read(unsigned int lba, void * buffer, unsigned int count) {
+    return _ioc_access(
+            1,        // read access
+            lba,
+            (unsigned int) buffer,
+            count);
+}
+
+
 ///////////////////////////////////////////////////////////////////////////////
 //     _ioc_write()
@@ -679,13 +730,13 @@
 // Returns 0 if success, > 0 if error.
 ///////////////////////////////////////////////////////////////////////////////
-unsigned int _ioc_write( unsigned int 	lba, 
-                         const void*	buffer, 
-                         unsigned int	count )
-{
-    return _ioc_access( 0,		// write access
-                        lba,
-                        (unsigned int)buffer,
-                        count );
-}
+unsigned int _ioc_write(unsigned int lba, const void * buffer, unsigned int count) {
+    return _ioc_access(
+            0, // write access
+            lba,
+            (unsigned int) buffer,
+            count);
+}
+
+
 ///////////////////////////////////////////////////////////////////////////////
 //     _ioc_get_status()
@@ -693,12 +744,12 @@
 // Returns 0 if success, > 0 if error.
 ///////////////////////////////////////////////////////////////////////////////
-unsigned int _ioc_get_status(unsigned int* status)
-{
+unsigned int _ioc_get_status(unsigned int * status) {
     // get IOC base address
-    unsigned int* ioc_address = (unsigned int*) &seg_ioc_base;
+    unsigned int * ioc_address = (unsigned int *) &seg_ioc_base;
 
     *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ 
     return 0;
 }
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -719,15 +770,15 @@
 
 #if NB_DMAS_MAX > 0
-in_unckdata unsigned int			_dma_lock[NB_DMAS_MAX * NB_CLUSTERS]
-                                       = { [0 ... (NB_DMAS_MAX * NB_CLUSTERS)-1] = 0 };
-
-in_unckdata volatile unsigned int	_dma_done[NB_DMAS_MAX * NB_CLUSTERS]
-                                       = { [0 ... (NB_DMAS_MAX * NB_CLUSTERS)-1] = 0 };
-
-in_unckdata volatile unsigned int	_dma_status[NB_DMAS_MAX * NB_CLUSTERS];
-
-in_unckdata unsigned int			_dma_iommu_ix1 = 1;
-
-in_unckdata unsigned int            _dma_iommu_npages[NB_DMAS_MAX * NB_CLUSTERS];
+in_unckdata unsigned int            _dma_lock[NB_DMAS_MAX * NB_CLUSTERS] = {
+    [0 ... (NB_DMAS_MAX * NB_CLUSTERS) - 1] = 0
+};
+
+in_unckdata volatile unsigned int    _dma_done[NB_DMAS_MAX * NB_CLUSTERS] = {
+    [0 ... (NB_DMAS_MAX * NB_CLUSTERS) - 1] = 0
+};
+
+in_unckdata volatile unsigned int _dma_status[NB_DMAS_MAX * NB_CLUSTERS];
+in_unckdata unsigned int _dma_iommu_ix1 = 1;
+in_unckdata unsigned int _dma_iommu_npages[NB_DMAS_MAX * NB_CLUSTERS];
 #endif
 
@@ -735,17 +786,19 @@
 // _dma_reset_irq()
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _dma_reset_irq( unsigned int	cluster_id,
-                             unsigned int	channel_id )
-{
+unsigned int _dma_reset_irq(unsigned int cluster_id, unsigned int channel_id) {
 #if NB_DMAS_MAX > 0
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS ) return 1;
-    if ( channel_id >= NB_DMAS_MAX ) return 1;
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (channel_id >= NB_DMAS_MAX) {
+        return 1;
+    }
 
     // compute DMA base address
-    unsigned int*	dma_address = (unsigned int*)( (char*)&seg_dma_base + 
-                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
-
-    dma_address[channel_id*DMA_SPAN + DMA_RESET] = 0;			
+    unsigned int * dma_address = (unsigned int *) ((char *) &seg_dma_base + 
+            (cluster_id * (unsigned) CLUSTER_SIZE));
+
+    dma_address[channel_id * DMA_SPAN + DMA_RESET] = 0;            
     return 0;
 #else
@@ -754,21 +807,23 @@
 }
 
+
 //////////////////////////////////////////////////////////////////////////////////
 // _dma_get_status()
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _dma_get_status( unsigned int	cluster_id,
-                              unsigned int	channel_id,
-                              unsigned int* status )
-{
+unsigned int _dma_get_status(unsigned int cluster_id, unsigned int channel_id, unsigned int * status) {
 #if NB_DMAS_MAX > 0
     // parameters checking 
-    if ( cluster_id >= NB_CLUSTERS ) return 1;
-    if ( channel_id >= NB_DMAS_MAX ) return 1;
+    if (cluster_id >= NB_CLUSTERS) {
+        return 1;
+    }
+    if (channel_id >= NB_DMAS_MAX) {
+        return 1;
+    }
 
     // compute DMA base address
-    unsigned int*	dma_address = (unsigned int*)( (char*)&seg_dma_base + 
-                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
-
-    *status = dma_address[channel_id*DMA_SPAN + DMA_LEN];
+    unsigned int * dma_address = (unsigned int *) ((char *) &seg_dma_base + 
+            (cluster_id * (unsigned) CLUSTER_SIZE));
+
+    *status = dma_address[channel_id * DMA_SPAN + DMA_LEN];
     return 0;
 #else
@@ -776,4 +831,5 @@
 #endif
 }
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -798,21 +854,20 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _dma_transfer(  unsigned int   dev_type,
-                             unsigned int   to_user,
-                             unsigned int   offset,
-                             unsigned int   user_vaddr,
-                             unsigned int   length )
-{
+unsigned int _dma_transfer(
+        unsigned int dev_type,
+        unsigned int to_user,
+        unsigned int offset,
+        unsigned int user_vaddr,
+        unsigned int length) {
 #if NB_DMAS_MAX > 0
-    unsigned int	ko;				        // unsuccessfull V2P translation
-    unsigned int	flags;			        // protection flags
-    unsigned int	ppn;			        // physical page number
-    unsigned int    user_pbase;		        // user buffer pbase address
-    unsigned int    device_pbase;			// frame buffer pbase address
-    unsigned int	device_vaddr;			// device buffer vbase address
+    unsigned int ko;           // unsuccessfull V2P translation
+    unsigned int flags;        // protection flags
+    unsigned int ppn;          // physical page number
+    unsigned int user_pbase;   // user buffer pbase address
+    unsigned int device_pbase; // frame buffer pbase address
+    unsigned int device_vaddr; // device buffer vbase address
 
     // check user buffer address and length alignment
-    if ( (user_vaddr & 0x3) || (length & 0x3) )
-    {
+    if ((user_vaddr & 0x3) || (length & 0x3)) {
         _get_lock(&_tty_put_lock);
         _puts("\n[GIET ERROR] in _dma_transfer : user buffer not word aligned\n");
@@ -822,25 +877,25 @@
 
     // get DMA channel and compute DMA vbase address
-    unsigned int	task_id    = _get_current_task_id();
-    unsigned int    dma_id     = _get_context_slot( task_id, CTX_DMA_ID );
-    unsigned int    cluster_id = dma_id / NB_DMAS_MAX;
-    unsigned int    loc_id     = dma_id % NB_DMAS_MAX;
-    unsigned int*	dma_base   = (unsigned int*)( (char*)&seg_dma_base + 
-                                    (cluster_id * (unsigned)CLUSTER_SIZE) );
+    unsigned int task_id    = _get_current_task_id();
+    unsigned int dma_id     = _get_context_slot(task_id, CTX_DMA_ID);
+    unsigned int cluster_id = dma_id / NB_DMAS_MAX;
+    unsigned int loc_id     = dma_id % NB_DMAS_MAX;
+    unsigned int * dma_base = (unsigned int *) ((char *) &seg_dma_base + 
+            (cluster_id * (unsigned) CLUSTER_SIZE));
 
     // get page table address
-    unsigned int	user_ptab = _get_context_slot( task_id, CTX_PTAB_ID );
+    unsigned int user_ptab = _get_context_slot( task_id, CTX_PTAB_ID);
 
     // get peripheral buffer virtual address
-    if ( dev_type)  device_vaddr = (unsigned int)&seg_nic_base + offset;
-    else            device_vaddr = (unsigned int)&seg_fbf_base + offset;
+    if ( dev_type) {
+        device_vaddr = (unsigned int) &seg_nic_base + offset;
+    }
+    else {
+        device_vaddr = (unsigned int) &seg_fbf_base + offset;
+    }
 
     // get device buffer physical address
-    ko = _v2p_translate( (page_table_t*)user_ptab,
-                         (device_vaddr >> 12),
-                         &ppn,
-                         &flags );
-    if ( ko )
-    {
+    ko = _v2p_translate((page_table_t *) user_ptab, (device_vaddr >> 12), &ppn, &flags);
+    if (ko) {
         _get_lock(&_tty_put_lock);
         _puts("\n[GIET ERROR] in _dma_transfer : device buffer unmapped\n");
@@ -851,10 +906,6 @@
 
     // Compute user buffer physical address
-    ko = _v2p_translate( (page_table_t*)user_ptab,
-                         (user_vaddr >> 12),
-                         &ppn,
-                         &flags );
-    if ( ko )
-    {
+    ko = _v2p_translate( (page_table_t*)user_ptab, (user_vaddr >> 12), &ppn, &flags);
+    if (ko) {
         _get_lock(&_tty_put_lock);
         _puts("\n[GIET ERROR] in _dma_transfer() : user buffer unmapped\n");
@@ -862,6 +913,5 @@
         return 3;
     } 
-    if ( (flags & PTE_U) == 0 )
-    {
+    if ((flags & PTE_U) == 0) {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] in _dma_transfer() : user buffer not in user space\n");
@@ -869,6 +919,5 @@
         return 4; 
     }
-    if ( ( (flags & PTE_W) == 0 ) && to_user ) 
-    {
+    if (((flags & PTE_W) == 0 ) && to_user) {
         _get_lock(&_tty_put_lock);
         _puts("\n[GIET ERROR] in _dma_transfer() : user buffer not writable\n");
@@ -878,6 +927,6 @@
     user_pbase = (ppn << 12) | (user_vaddr & 0x00000FFF);
 
-/*  This is a draft for IOMMU support
-    
+    /*  This is a draft for IOMMU support
+
     // loop on all virtual pages covering the user buffer
     unsigned int user_vpn_min = user_vaddr >> 12;
@@ -888,36 +937,36 @@
     for ( vpn = user_vpn_min ; vpn <= user_vpn_max ; vpn++ )
     {
-        // get ppn and flags for each vpn
-        unsigned int ko = _v2p_translate( (page_table_t*)user_pt_vbase,
-                                          vpn,
-                                          &ppn,
-                                          &flags );
-
-        // check access rights
-        if ( ko )                                 return 3;     // unmapped
-        if ( (flags & PTE_U) == 0 )               return 4;     // not in user space
-        if ( ( (flags & PTE_W) == 0 ) && to_user ) return 5;     // not writable
-
-        // save first ppn value
-        if ( ix2 == 0 ) ppn_first = ppn;
-
-        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
-        {
-            // check buffer length < 2 Mbytes
-            if ( ix2 > 511 ) return 2;
-
-            // map the physical page in IOMMU page table
-            _iommu_add_pte2( ix1,		// PT1 index
-                             ix2,		// PT2 index
-                             ppn,		// physical page number 
-                             flags );	// protection flags
-        }
-        else            // no IOMMU : check that physical pages are contiguous
-        {
-            if ( (ppn - ppn_first) != ix2 )       return 6;     // split physical buffer  
-        }
-
-        // increment page index
-        ix2++;
+    // get ppn and flags for each vpn
+    unsigned int ko = _v2p_translate( (page_table_t*)user_pt_vbase,
+    vpn,
+    &ppn,
+    &flags );
+
+    // check access rights
+    if ( ko )                                 return 3;     // unmapped
+    if ( (flags & PTE_U) == 0 )               return 4;     // not in user space
+    if ( ( (flags & PTE_W) == 0 ) && to_user ) return 5;     // not writable
+
+    // save first ppn value
+    if ( ix2 == 0 ) ppn_first = ppn;
+
+    if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
+    {
+    // check buffer length < 2 Mbytes
+    if ( ix2 > 511 ) return 2;
+
+    // map the physical page in IOMMU page table
+    _iommu_add_pte2( ix1,        // PT1 index
+    ix2,        // PT2 index
+    ppn,        // physical page number 
+    flags );    // protection flags
+    }
+    else            // no IOMMU : check that physical pages are contiguous
+    {
+    if ( (ppn - ppn_first) != ix2 )       return 6;     // split physical buffer  
+    }
+
+    // increment page index
+    ix2++;
     } // end for vpn
 
@@ -928,30 +977,28 @@
 
     // invalidate data cache in case of memory write
-    if ( to_user ) _dcache_buf_invalidate( (void*)user_vaddr, length );
-    
+    if (to_user) {
+        _dcache_buf_invalidate((void *) user_vaddr, length);
+    }
+
     // get the lock 
-    _get_lock( &_dma_lock[dma_id] );
+    _get_lock(&_dma_lock[dma_id]);
 
     // DMA configuration 
-    if ( to_user )
-    {
-        dma_base[loc_id*DMA_SPAN + DMA_SRC] = (unsigned int)device_pbase;
-        dma_base[loc_id*DMA_SPAN + DMA_DST] = (unsigned int)user_pbase;
-    }
-    else
-    {
-        dma_base[loc_id*DMA_SPAN + DMA_SRC] = (unsigned int)user_pbase;
-        dma_base[loc_id*DMA_SPAN + DMA_DST] = (unsigned int)device_pbase;
-    }
-    dma_base[loc_id*DMA_SPAN + DMA_LEN] = (unsigned int)length;
-    
-    return 0;
-
+    if (to_user) {
+        dma_base[loc_id * DMA_SPAN + DMA_SRC] = (unsigned int) device_pbase;
+        dma_base[loc_id * DMA_SPAN + DMA_DST] = (unsigned int) user_pbase;
+    }
+    else {
+        dma_base[loc_id * DMA_SPAN + DMA_SRC] = (unsigned int) user_pbase;
+        dma_base[loc_id * DMA_SPAN + DMA_DST] = (unsigned int) device_pbase;
+    }
+    dma_base[loc_id * DMA_SPAN + DMA_LEN] = (unsigned int) length;
+
+    return 0;
 #else //NB_DMAS_MAX == 0
-
     return -1;
-
 #endif
 }  // end _dma_transfer()  
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -963,45 +1010,44 @@
 // (1 == read error / 2 == DMA idle error / 3 == write error)
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _dma_completed()
-{
+unsigned int _dma_completed() {
 #if NB_DMAS_MAX > 0
-    unsigned int    task_id = _get_current_task_id();
-    unsigned int    dma_id  = _get_context_slot( task_id, CTX_DMA_ID );
-    unsigned int    dma_ret;
+    unsigned int task_id = _get_current_task_id();
+    unsigned int dma_id  = _get_context_slot(task_id, CTX_DMA_ID);
+    unsigned int dma_ret;
 
     // busy waiting with a pseudo random delay between bus access
-    while (_dma_done[dma_id] == 0)
-    {
-        unsigned int delay = (( _proctime() ^ _procid()<<4 ) & 0x3F) + 1;
-        asm volatile("move  $3,   %0		        \n"
-                     "loop_nic_completed:	        \n"
-                     "addi  $3, $3, -1	            \n"
-                     "bnez  $3,	loop_nic_completed	\n"
-                     "nop			                \n"
-                     :
-                     : "r"(delay)
-                     : "$3" ); 
-    }
-    
-/* draft support for IOMMU
+    while (_dma_done[dma_id] == 0) {
+        unsigned int delay = (( _proctime() ^ _procid() << 4) & 0x3F) + 1;
+        asm volatile(
+                "move  $3,   %0                 \n"
+                "loop_nic_completed:            \n"
+                "addi  $3,   $3, -1             \n"
+                "bnez  $3,   loop_nic_completed \n"
+                "nop                            \n"
+                :
+                : "r" (delay)
+                : "$3"); 
+    }
+
+    /* draft support for IOMMU
     // unmap the buffer from IOMMU page table if IOMMU is activated
     if ( GIET_IOMMU_ACTIVE )
     {
-        unsigned int* iob_address = (unsigned int*)&seg_iob_base;
-
-        unsigned int  ix1         = _dma_iommu_ix1 + dma_id;
-        unsigned int  ix2;
-
-        for ( ix2 = 0 ; ix2 < _dma_iommu_npages[dma_id] ; ix2++ )
-        {
-            // unmap the page in IOMMU page table
-            _iommu_inval_pte2( ix1,		// PT1 index 
-                               ix2 );   // PT2 index
-
-            // clear IOMMU TLB
-            iob_address[IOB_INVAL_PTE] = (ix1 << 21) | (ix2 << 12);
-        }
-    }
-*/
+    unsigned int* iob_address = (unsigned int*)&seg_iob_base;
+
+    unsigned int  ix1         = _dma_iommu_ix1 + dma_id;
+    unsigned int  ix2;
+
+    for ( ix2 = 0 ; ix2 < _dma_iommu_npages[dma_id] ; ix2++ )
+    {
+    // unmap the page in IOMMU page table
+    _iommu_inval_pte2( ix1,        // PT1 index 
+    ix2 );   // PT2 index
+
+    // clear IOMMU TLB
+    iob_address[IOB_INVAL_PTE] = (ix1 << 21) | (ix2 << 12);
+    }
+    }
+    */
 
     // reset synchronization variables
@@ -1019,5 +1065,5 @@
 
 //////////////////////////////////////////////////////////////////////////////////
-// 	VciFrameBuffer driver
+//     VciFrameBuffer driver
 //////////////////////////////////////////////////////////////////////////////////
 // The vci_frame_buffer device can be accessed directly by software with memcpy(),
@@ -1041,12 +1087,10 @@
 // - length : number of bytes to be transfered.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _fb_sync_write( unsigned int	offset, 
-                             const void* 	buffer, 
-                             unsigned int 	length )
-{
-    unsigned char *fb_address = (unsigned char*)&seg_fbf_base + offset;
-    memcpy((void*)fb_address, (void*)buffer, length);
-    return 0;
-}
+unsigned int _fb_sync_write(unsigned int offset, const void * buffer, unsigned int length) {
+    unsigned char * fb_address = (unsigned char *) &seg_fbf_base + offset;
+    memcpy((void *) fb_address, (void *) buffer, length);
+    return 0;
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1057,12 +1101,10 @@
 // - length : number of bytes to be transfered.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _fb_sync_read( unsigned int 	offset, 
-                            const void*		buffer, 
-                            unsigned int 	length )
-{
-    unsigned char *fb_address = (unsigned char*)&seg_fbf_base + offset;
-    memcpy((void*)buffer, (void*)fb_address, length);
-    return 0;
-}
+unsigned int _fb_sync_read(unsigned int offset, const void * buffer, unsigned int length) {
+    unsigned char * fb_address = (unsigned char *) &seg_fbf_base + offset;
+    memcpy((void *) buffer, (void *) fb_address, length);
+    return 0;
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1074,14 +1116,13 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _fb_write( unsigned int 	offset, 
-                        const    void*	buffer, 
-                        unsigned int 	length )
-{
-    return _dma_transfer( 0,						// frame buffer
-                          0,						// write 
-		                  offset,
-		                  (unsigned int)buffer,
-		                  length );	
-}
+unsigned int _fb_write(unsigned int offset, const void * buffer, unsigned int length) {
+    return _dma_transfer(
+            0,             // frame buffer
+            0,             // write 
+            offset,
+            (unsigned int) buffer,
+            length);
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1093,14 +1134,13 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _fb_read( unsigned int 	offset, 
-                       const void*		buffer, 
-                       unsigned int 	length )
-{
-    return _dma_transfer( 0,						// frame buffer
-                          1,						// read 
-		                  offset,
-		                  (unsigned int)buffer,
-		                  length );	
-}
+unsigned int _fb_read(unsigned int offset, const void * buffer, unsigned int length) {
+    return _dma_transfer(
+            0,    // frame buffer
+            1,    // read 
+            offset,
+            (unsigned int) buffer,
+            length);
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1111,11 +1151,10 @@
 // (1 == read error / 2 == DMA idle error / 3 == write error)
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _fb_completed()
-{
+unsigned int _fb_completed() {
     return _dma_completed();
 }
 
 //////////////////////////////////////////////////////////////////////////////////
-// 	VciMultiNic driver
+//     VciMultiNic driver
 //////////////////////////////////////////////////////////////////////////////////
 // The VciMultiNic device can be accessed directly by software with memcpy(),
@@ -1139,12 +1178,10 @@
 // - length : number of bytes to be transfered.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _nic_sync_write( unsigned int	offset, 
-                              const void* 	buffer, 
-                              unsigned int 	length )
-{
-    unsigned char *nic_address = (unsigned char*)&seg_nic_base + offset;
-    memcpy((void*)nic_address, (void*)buffer, length);
-    return 0;
-}
+unsigned int _nic_sync_write(unsigned int offset, const void * buffer, unsigned int length) {
+    unsigned char * nic_address = (unsigned char *) &seg_nic_base + offset;
+    memcpy((void *) nic_address, (void *) buffer, length);
+    return 0;
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1155,12 +1192,10 @@
 // - length : number of bytes to be transfered.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _nic_sync_read( unsigned int 	offset, 
-                             const void*	buffer, 
-                             unsigned int 	length )
-{
-    unsigned char *nic_address = (unsigned char*)&seg_nic_base + offset;
-    memcpy((void*)buffer, (void*)nic_address, length);
-    return 0;
-}
+unsigned int _nic_sync_read(unsigned int offset, const void * buffer, unsigned int length) {
+    unsigned char *nic_address = (unsigned char *) &seg_nic_base + offset;
+    memcpy((void *) buffer, (void *) nic_address, length);
+    return 0;
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1172,14 +1207,13 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _nic_write( unsigned int 	offset, 
-                         const void*	buffer, 
-                         unsigned int 	length )
-{
-    return _dma_transfer( 1,            // NIC
-                          0,			// write
-			              offset,
-			              (unsigned int)buffer,
-			              length );	
-}
+unsigned int _nic_write(unsigned int offset, const void * buffer, unsigned int length) {
+    return _dma_transfer(
+            1,            // NIC
+            0,            // write
+            offset,
+            (unsigned int) buffer,
+            length );    
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1191,14 +1225,13 @@
 // Returns 0 if success, > 0 if error.
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _nic_read( unsigned int 	offset, 
-                        const void*		buffer, 
-                        unsigned int 	length )
-{
-    return _dma_transfer( 1,            // NIC
-                          1,			// read
-                          offset,
-			              (unsigned int)buffer,
-			              length );	
-}
+unsigned int _nic_read(unsigned int offset, const void * buffer, unsigned int length) {
+    return _dma_transfer(
+            1,            // NIC
+            1,            // read
+            offset,
+            (unsigned int) buffer,
+            length );    
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -1209,7 +1242,14 @@
 // (1 == read error / 2 == DMA idle error / 3 == write error)
 //////////////////////////////////////////////////////////////////////////////////
-unsigned int _nic_completed()
-{
+unsigned int _nic_completed() {
     return _dma_completed();
 }
 
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
