Index: uspace/drv/nic/rtl8139/defs.h
===================================================================
--- uspace/drv/nic/rtl8139/defs.h	(revision 5c5f5228117293b2edfbcfce4e1366d6f745ee25)
+++ uspace/drv/nic/rtl8139/defs.h	(revision 3ce51623f5df17e7ebc1509fe49afc45b3b5a135)
@@ -29,33 +29,29 @@
 /** @file rtl8139_defs.h
  *
- * Registers, bit positions and masks definition
- * of the RTL8139 network family cards
- */
-
-#ifndef RTL8139_DEFS_H_
-#define RTL8139_DEFS_H_
-
+ *  Registers, bit positions and masks definition of the RTL8139 network family 
+ *  cards
+ */
+
+#ifndef RTL8139_DEFS_H_INCLUDED_
+#define RTL8139_DEFS_H_INCLUDED_
 #include <sys/types.h>
 #include <libarch/ddi.h>
 
-/** Size of RTL8139 registers address space */
-#define RTL8139_IO_SIZE  256
-
-/** Maximal transmitted frame length
- *
- * Maximal transmitted frame length in bytes
- * allowed according to the RTL8139 documentation
- * (see SIZE part of TSD documentation).
- *
- */
-#define RTL8139_FRAME_MAX_LENGTH  1792
+
+/** The size of RTL8139 registers address space */
+#define RTL8139_IO_SIZE 256
+
+/** The maximal transmitted frame length in bytes allowed according to RTL8139
+ *  documentation (see SIZE part of TSD documentation)
+ */
+#define RTL8139_FRAME_MAX_LENGTH 1792
+
 
 /** HW version
  *
- * As can be detected from HWVERID part of TCR
- * (Transmit Configuration Register).
- *
- */
-typedef enum {
+ *  as can be detected from HWVERID part of TCR
+ *  (Transmit Configuration Register)
+ */
+enum rtl8139_version_id {
 	RTL8139 = 0,          /**< RTL8139 */
 	RTL8139A,             /**< RTL8139A */
@@ -70,5 +66,7 @@
 	RTL8101,              /**< RTL8101 */
 	RTL8139_VER_COUNT     /**< Count of known RTL versions, the last value */
-} rtl8139_version_id_t;
+};
+
+extern const char* model_names[RTL8139_VER_COUNT];
 
 /** Registers of RTL8139 family card offsets from the memory address base */
@@ -77,5 +75,5 @@
 	MAC0  = IDR0,    /**< Alias for IDR0 */
 
-	// 0x06 - 0x07 reserved
+	// 0x6 - 0x7 reserved
 
 	MAR0    = 0x08,  /**< Multicast mask registers 8 1b registers sequence */
@@ -215,5 +213,4 @@
 	pio_write_8(io_base + CR9346, RTL8139_REGS_LOCKED);
 }
-
 /** Allow to change Config0-4 and BMCR register  */
 static inline void rtl8139_regs_unlock(void *io_base)
@@ -420,5 +417,5 @@
 
 /** Maximal runt frame size + 1 */
-#define RTL8139_RUNT_MAX_SIZE  64
+#define RTL8139_RUNT_MAX_SIZE 64
 
 /** Bits in frame header */
@@ -473,21 +470,19 @@
 
 /** Mapping of HW version -> version ID */
-struct rtl8139_hwver_map {
-	uint32_t hwverid;             /**< HW version value in the register */
-	rtl8139_version_id_t ver_id;  /**< appropriate version id */
+struct rtl8139_hwver_map { 
+	uint32_t hwverid;                /**< HW version value in the register */
+	enum rtl8139_version_id ver_id;  /**< appropriate version id */
 };
 
 /** Mapping of HW version -> version ID */
 extern const struct rtl8139_hwver_map rtl8139_versions[RTL8139_VER_COUNT + 1];
-extern const char* model_names[RTL8139_VER_COUNT];
 
 /** Size in the frame header while copying from RxFIFO to Rx buffer */
-#define RTL8139_EARLY_SIZE  UINT16_C(0xfff0)
-
+#define RTL8139_EARLY_SIZE UINT16_C(0xfff0)
 /** The only supported pause frame time value */
-#define RTL8139_PAUSE_VAL  UINT16_C(0xFFFF)
+#define RTL8139_PAUSE_VAL UINT16_C(0xFFFF)
 
 /** Size of the frame header in front of the received frame */
-#define RTL_FRAME_HEADER_SIZE  4
+#define RTL_FRAME_HEADER_SIZE 4
 
 /** 8k buffer */
Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision 5c5f5228117293b2edfbcfce4e1366d6f745ee25)
+++ uspace/drv/nic/rtl8139/driver.c	(revision 3ce51623f5df17e7ebc1509fe49afc45b3b5a135)
@@ -55,28 +55,21 @@
 /** Global mutex for work with shared irq structure */
 FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
-
 /** Lock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_LOCK() \
-	fibril_mutex_lock(&irq_reg_lock)
-
+#define RTL8139_IRQ_STRUCT_LOCK() fibril_mutex_lock(&irq_reg_lock)
 /** Unlock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_UNLOCK() \
-	fibril_mutex_unlock(&irq_reg_lock)
+#define RTL8139_IRQ_STRUCT_UNLOCK() fibril_mutex_unlock(&irq_reg_lock)
 
 /** PCI clock frequency in kHz */
-#define RTL8139_PCI_FREQ_KHZ  33000
-
-#define RTL8139_AUTONEG_CAPS (ETH_AUTONEG_10BASE_T_HALF | \
-	ETH_AUTONEG_10BASE_T_FULL | ETH_AUTONEG_100BASE_TX_HALF | \
-	ETH_AUTONEG_100BASE_TX_FULL | ETH_AUTONEG_PAUSE_SYMETRIC)
+#define RTL8139_PCI_FREQ_KHZ 33000
+
+#define RTL8139_AUTONEG_CAPS (ETH_AUTONEG_10BASE_T_HALF \
+    | ETH_AUTONEG_10BASE_T_FULL | ETH_AUTONEG_100BASE_TX_HALF \
+    | ETH_AUTONEG_100BASE_TX_FULL | ETH_AUTONEG_PAUSE_SYMETRIC)
 
 /** Lock transmitter and receiver data
- *
- * This function shall be called whenever
- * both transmitter and receiver locking
- * to force safe lock ordering (deadlock prevention)
- *
- * @param rtl8139 RTL8139 private data
- *
+ *  This function shall be called whenever both transmitter and receiver locking
+ *  to force safe lock ordering (deadlock prevention)
+ *
+ *  @param rtl8139  RTL8139 private data
  */
 inline static void rtl8139_lock_all(rtl8139_t *rtl8139)
@@ -89,6 +82,5 @@
 /** Unlock transmitter and receiver data
  *
- * @param rtl8139 RTL8139 private data
- *
+ *  @param rtl8139  RTL8139 private data
  */
 inline static void rtl8139_unlock_all(rtl8139_t *rtl8139)
@@ -465,5 +457,5 @@
 	pio_write_32(tsd, tsd_value);
 	return;
-	
+
 err_busy_no_inc:
 err_size:
@@ -521,5 +513,4 @@
  *
  * @return The frame list node (not connected)
- *
  */
 static nic_frame_t *rtl8139_read_frame(nic_t *nic_data,
@@ -1224,5 +1215,5 @@
 	ddf_msg(LVL_DEBUG, "The device is initialized");
 	return ret;
-	
+
 failed:
 	ddf_msg(LVL_ERROR, "The device initialization failed");
@@ -1351,5 +1342,5 @@
 
 	return EOK;
-	
+
 err_fun_bind:
 	ddf_fun_unbind(fun);
Index: uspace/drv/nic/rtl8139/driver.h
===================================================================
--- uspace/drv/nic/rtl8139/driver.h	(revision 5c5f5228117293b2edfbcfce4e1366d6f745ee25)
+++ uspace/drv/nic/rtl8139/driver.h	(revision 3ce51623f5df17e7ebc1509fe49afc45b3b5a135)
@@ -30,40 +30,36 @@
 #define RTL8139_DRIVER_H_
 
+#include "defs.h"
+#include "general.h"
 #include <sys/types.h>
 #include <stdint.h>
-#include "defs.h"
-#include "general.h"
 
 /** The driver name */
-#define NAME  "rtl8139"
-
+#define NAME "rtl8139"
 /** Transmittion buffers count */
-#define TX_BUFF_COUNT  4
-
-/** Size of buffer for one frame (2kB) */
-#define TX_BUFF_SIZE  (2 * 1024)
-
-/** Number of pages to allocate for TxBuffers */
-#define TX_PAGES  2
+#define TX_BUFF_COUNT 4
+/** Size of buffer for one frame
+ *  - 2kB
+ */
+#define TX_BUFF_SIZE (2 * 1024)
+/** Count of pages to allocate for TxBuffers */
+#define TX_PAGES 2
 
 /** Size of the CRC after the received frame in the receiver buffer */
-#define RTL8139_CRC_SIZE  4
+#define RTL8139_CRC_SIZE 4
 
 /** The default mode of accepting unicast frames */
-#define RTL8139_RCR_UCAST_DEFAULT  RCR_ACCEPT_PHYS_MATCH
-
+#define RTL8139_RCR_UCAST_DEFAULT RCR_ACCEPT_PHYS_MATCH
 /** The default mode of accepting multicast frames */
-#define RTL8139_RCR_MCAST_DEFAULT  0
-
+#define RTL8139_RCR_MCAST_DEFAULT 0
 /** The default mode of accepting broadcast frames */
-#define RTL8139_RCR_BCAST_DEFAULT  RCR_ACCEPT_BROADCAST
-
+#define RTL8139_RCR_BCAST_DEFAULT RCR_ACCEPT_BROADCAST
 /** The default mode of accepting defect frames */
-#define RTL8139_RCR_DEFECT_DEFAULT  0
+#define RTL8139_RCR_DEFECT_DEFAULT 0
 
 /** Mask for accepting all multicast */
-#define RTL8139_MCAST_MASK_PROMISC  UINT64_MAX
-
-/** Data */
+#define RTL8139_MCAST_MASK_PROMISC UINT64_MAX
+
+/** Data  */
 struct rtl8139_rcr_data {
 	/** Configuration part of RCR */
@@ -138,6 +134,7 @@
 
 	/** Version of RT8139 controller */
-	rtl8139_version_id_t hw_version;
+	enum rtl8139_version_id hw_version;
 } rtl8139_t;
+
 
 /* ***** Pointers casting - for both amd64 and ia32 ***** */
@@ -163,4 +160,6 @@
  */
 #define IOADDR_TO_PTR(ioaddr) ((void*)((size_t)(ioaddr)))
+
+
 
 /* ***** Bit operation macros ***** */
@@ -178,5 +177,5 @@
  * @return New value
  */
-#define bit_set_part_g(src, value, mask, type) \
+#define bit_set_part_g( src, value, mask, type ) \
 	((type)(((src) & ~((type)(mask))) | ((value) & (type)(mask))))
 
@@ -238,3 +237,4 @@
 	bit_set_part_32(tsd_value, (size) << TSD_SIZE_SHIFT, TSD_SIZE_MASK << TSD_SIZE_SHIFT)
 
+
 #endif
Index: uspace/drv/nic/rtl8139/general.h
===================================================================
--- uspace/drv/nic/rtl8139/general.h	(revision 5c5f5228117293b2edfbcfce4e1366d6f745ee25)
+++ uspace/drv/nic/rtl8139/general.h	(revision 3ce51623f5df17e7ebc1509fe49afc45b3b5a135)
@@ -37,30 +37,30 @@
 #include <unistd.h>
 
-/** Number of microseconds in second */
-#define RTL8139_USEC_IN_SEC  1000000
+extern void* rtl8139_memcpy_wrapped(void *dest, const void *src_buf,
+    size_t src_offset, size_t src_size, size_t data_size);
+
 
 /** Structure for HW timer control */
-typedef struct {
+typedef struct rtl8139_timer_act {
 	/** Register value set in the last timer period */
 	uint32_t last_val;
-	
 	/** Register value set in the common timer period */
 	uint32_t full_val;
-	
+
 	/** Amount of full register periods in timer period */
 	size_t full_skips;
-	
 	/** Remaining full register periods to the next period end */
 	size_t full_skips_remains;
-	
 	/** Mark if there is a last run */
 	int last_run;
 } rtl8139_timer_act_t;
 
-extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t,
-    size_t);
-extern int rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
-    const struct timeval *);
-extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *);
+/** Count of microseconds in second */
+#define RTL8139_USEC_IN_SEC 1000000
+
+extern int rtl8139_timer_act_init(rtl8139_timer_act_t *ta, uint32_t timer_freq,
+    const struct timeval *time);
+extern int rtl8139_timer_act_step(rtl8139_timer_act_t *ta, uint32_t *new_reg);
+
 
 #endif
