Index: proj/include/errors.h
===================================================================
--- proj/include/errors.h	(revision 260)
+++ proj/include/errors.h	(revision 261)
@@ -18,6 +18,9 @@
     ALLOC_ERROR,        /** @brief Memory allocation error */
     LOGIC_ERROR,        /** @brief Logic error */
     INVALID_ARG,        /** @brief Invalid argument */
+    NOK,                /** @brief Not OK */
+    TRANS_REFUSED,      /** @brief Transmission refused */
+    TRANS_FAILED,       /** @brief Transmission failed */
     OTHER_ERROR         /** @brief Unspecified error */
 };
 
Index: proj/include/graph.h
===================================================================
--- proj/include/graph.h	(revision 260)
+++ proj/include/graph.h	(revision 261)
@@ -1,6 +1,15 @@
 #ifndef GRAPH_H_INCLUDED
 #define GRAPH_H_INCLUDED
 
+// Graphics modes
+#define INDEXED_1024_768        0x105
+#define DIRECT_640_480_888      0x110
+#define DIRECT_800_600_888      0x115
+#define DIRECT_1024_768_888     0x118
+#define DIRECT_1280_1024_565    0x11A
+#define DIRECT_1280_1024_888    0x11B
+#define LINEAR_FRAME_BUFFER_MD  BIT(14)
+
 // Colors in RBG (8 bit)
 #define GRAPH_BLACK               0x000000
 #define GRAPH_WHITE               0xFFFFFF
Index: proj/include/uart.h
===================================================================
--- proj/include/uart.h	(revision 260)
+++ proj/include/uart.h	(revision 261)
@@ -47,7 +47,4 @@
 int uart_enable_int_tx (int base_addr);
 int uart_disable_int_tx(int base_addr);
 
-int uart_get_char_poll   (int base_addr, uint8_t *p);
-int uart_send_char_poll  (int base_addr, uint8_t  c);
-
 #endif //UART_H_INCLUDED
Index: proj/src/graph.c
===================================================================
--- proj/src/graph.c	(revision 260)
+++ proj/src/graph.c	(revision 261)
@@ -22,19 +22,6 @@
 #define AH_FUNC_NOT_SUPP    0x02    /** @brief Function call is not supported in current HW configuration */
 #define AH_FUNC_INVALID     0x03    /** @brief Invalid function in current video mode */
 
-// Graphics modes
-#define INDEXED_1024_768        0x105
-#define DIRECT_640_480_888      0x110
-#define DIRECT_800_600_888      0x115
-#define DIRECT_1024_768_888     0x118
-#define DIRECT_1280_1024_565    0x11A
-#define DIRECT_1280_1024_888    0x11B
-#define LINEAR_FRAME_BUFFER_MD  BIT(14)
-
-
-
-
-
 /// MACROS
 #define FAR2PHYS(n)         ((((n)>>12) & 0xFFFFFFF0) + ((n) & 0x0000FFFF))
 
Index: proj/src/proj.c
===================================================================
--- proj/src/proj.c	(revision 260)
+++ proj/src/proj.c	(revision 261)
@@ -52,306 +52,231 @@
 int(proj_main_loop)(int argc, char *argv[]) {
 
     int r;
-    #ifndef DIOGO
-        font_t *consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2");
-        if(consolas == NULL){ printf("Failed to load consolas\n"); return 1; }
 
-        /// subscribe interrupts
-        if (subscribe_all()) { return 1; }
+    font_t *consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2");
+    if(consolas == NULL){ printf("Failed to load consolas\n"); return 1; }
 
-        /// initialize graphics
-        if(graph_init(GRAPH_MODE)){
-            printf("%s: failed to initalize graphics.\n", __func__);
-            if (cleanup()) printf("%s: failed to cleanup.\n", __func__);
-            return 1;
-        }
+    /// subscribe interrupts
+    if (subscribe_all()) { return 1; }
 
-        /// Load stuff
-        basic_sprite_t       *bsp_crosshair = NULL;
-        basic_sprite_t       *bsp_shooter   = NULL;
-        basic_sprite_t       *bsp_pistol    = NULL;
-        basic_sprite_t       *bsp_nothing   = NULL;
-        basic_sprite_t       *bsp_bullet    = NULL;
-        map_t                *map1          = NULL;
-        sprite_t             *sp_crosshair  = NULL;
-        {
-            graph_clear_screen();
-            text_t *txt = text_ctor(consolas, "Loading...");
-            text_draw(txt);
-            text_dtor(txt);
-            graph_draw();
+    /// initialize graphics
+    if(graph_init(GRAPH_MODE)){
+        printf("%s: failed to initalize graphics.\n", __func__);
+        if (cleanup()) printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
 
-            bsp_crosshair = get_crosshair(); if(bsp_crosshair == NULL) printf("Failed to get crosshair\n");
-            bsp_shooter   = get_shooter  (); if(bsp_shooter   == NULL) printf("Failed to get shooter\n");
-            bsp_pistol    = get_pistol   (); if(bsp_pistol    == NULL) printf("Failed to get pistol\n");
-            bsp_nothing   = get_nothing  (); if(bsp_nothing   == NULL) printf("Failed to get nothing\n");
-            bsp_bullet    = get_bullet   (); if(bsp_bullet    == NULL) printf("Failed to get bullet\n");
-            map1          = get_map1     (); if(map1          == NULL) printf("Failed to get map1\n");
-
-            sp_crosshair = sprite_ctor(bsp_crosshair); if(sp_crosshair == NULL) printf("Failed to get crosshair sprite\n");
-        }
-    #endif
-
-    #ifdef DIOGO
-        /*
+    /// Load stuff
+    basic_sprite_t       *bsp_crosshair = NULL;
+    basic_sprite_t       *bsp_shooter   = NULL;
+    basic_sprite_t       *bsp_pistol    = NULL;
+    basic_sprite_t       *bsp_nothing   = NULL;
+    basic_sprite_t       *bsp_bullet    = NULL;
+    map_t                *map1          = NULL;
+    sprite_t             *sp_crosshair  = NULL;
+    {
         graph_clear_screen();
-
-        rectangle_t *rect = rectangle_ctor(0,0,400,100);
-        rectangle_set_pos(rect,
-                          graph_get_XRes()/2    - rectangle_get_w(rect)/2,
-                          graph_get_YRes()*0.25 - rectangle_get_h(rect)/2);
-        rectangle_set_fill_color(rect, BLACK);
-        rectangle_set_outline_width(rect, 2);
-        rectangle_set_outline_color(rect, WHITE);
-        rectangle_draw(rect);
-
-        text_t *txt  = text_ctor(consolas, "Hello world!");
-        text_set_color(txt, 0x888888);
-
-        text_set_pos(txt, rectangle_get_x(rect)+rectangle_get_w(rect)/2,
-                          rectangle_get_y(rect)+rectangle_get_h(rect)/2);
-        text_set_valign(txt, text_valign_center);
-        text_set_halign(txt, text_halign_center);
+        text_t *txt = text_ctor(consolas, "Loading...");
         text_draw(txt);
         text_dtor(txt);
-
         graph_draw();
-        rectangle_dtor(rect);
 
-        list_t *l = list_ctor();
-        int *p = NULL;
-        for(int i = 10; i < 20; ++i){
-            p = malloc(sizeof(int));
-            *p = i;
-            printf("INSERTING %d\n", i);
-            list_insert(l, list_end(l), p);
-            printf("INSERTED, SIZE=%d\n", list_size(l));
-        }
-        list_node_t *it = list_begin(l);
-        while(it != list_end(l)){
-            printf("%d\n", **(int**)list_node_val(it));
-            it = list_node_next(it);
-        }
-        while(list_size(l) > 0){
-            printf("ERASING\n");
-            void *p = list_erase(l, list_begin(l));
-            printf("ERASED %d, SIZE=%d\n", *(int*)p, list_size(l));
-            free(p);
-        }
-        printf("DONE\n");
-        if(list_dtor(l)) printf("COULD NOT DESTRUCT LIST\n");
+        bsp_crosshair = get_crosshair(); if(bsp_crosshair == NULL) printf("Failed to get crosshair\n");
+        bsp_shooter   = get_shooter  (); if(bsp_shooter   == NULL) printf("Failed to get shooter\n");
+        bsp_pistol    = get_pistol   (); if(bsp_pistol    == NULL) printf("Failed to get pistol\n");
+        bsp_nothing   = get_nothing  (); if(bsp_nothing   == NULL) printf("Failed to get nothing\n");
+        bsp_bullet    = get_bullet   (); if(bsp_bullet    == NULL) printf("Failed to get bullet\n");
+        map1          = get_map1     (); if(map1          == NULL) printf("Failed to get map1\n");
 
+        sp_crosshair = sprite_ctor(bsp_crosshair); if(sp_crosshair == NULL) printf("Failed to get crosshair sprite\n");
+    }
 
-        tickdelay(micros_to_ticks(1000000));*/
+    ent_set_scale(DEFAULT_SCALE);
 
-        // RTC
-        /*
-        uint8_t date[4], time[3];
+    text_timer_t *in_game_timer = timer_ctor(consolas);
 
-        if (rtc_read_time(time)) return 1;
+    menu_t *main_menu = menu_ctor(consolas);
 
-        if (rtc_read_date(date)) return 1;
+    list_t *shooter_list = list_ctor();
 
-        printf("Hour: %02d:%02d:%02d\n", time[2], time[1], time[0]);
+    gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol); if(shooter1 == NULL) printf("Failed to get shooter1\n");
+    gunner_set_spawn(shooter1, 75, 75);
+    gunner_set_pos(shooter1, 75, 75);
 
-        printf("Date: %d, %02d/%02d/%02d\n", date[0], date[1], date[2], date[3]);
-        */
-        //UART
-        unsigned long bits = 8;
-        unsigned long stop = 2;
-        long parity = 0;
-        unsigned long rate = 9600;
-        unsigned char tx = 0; (void)tx;
-        int stringc = 2; (void)stringc;
-        char *strings[] = {"Hello", "world"}; (void)strings;
-        //if((r = ser_test_set(COM1_ADDR, bits, stop, parity, rate))) return r;
-        //if((r = ser_test_conf(COM1_ADDR))) return r;
-        if((r = ser_test_poll(COM1_ADDR, tx, bits, stop, parity, rate, stringc, strings))) return r;
-        printf("DONE\n");
-    #endif
-    #ifndef DIOGO
-        ent_set_scale(DEFAULT_SCALE);
+    gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing);
+    gunner_set_spawn(shooter2, 975, 75);
+    gunner_set_pos(shooter2, 775, 75);
 
-        text_timer_t *in_game_timer = timer_ctor(consolas);
+    list_insert(shooter_list, list_end(shooter_list), shooter1);
+    list_insert(shooter_list, list_end(shooter_list), shooter2);
 
-        menu_t *main_menu = menu_ctor(consolas);
+    list_t *bullet_list  = list_ctor();
 
-        list_t *shooter_list = list_ctor();
+    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
 
-        gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol); if(shooter1 == NULL) printf("Failed to get shooter1\n");
-        gunner_set_spawn(shooter1, 75, 75);
-        gunner_set_pos(shooter1, 75, 75);
+    //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
+    double angle; // mouse angle
+    int32_t *mouse_x = get_mouse_X(), *mouse_y = get_mouse_Y();
+    uint8_t last_lb = 0;
+    struct packet pp;
+    keys_t *keys = get_key_presses();
+    /// loop stuff
+    int ipc_status;
+    message msg;
+    int game_state = MENU, click = 0; (void)click;
 
-        gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing);
-        gunner_set_spawn(shooter2, 975, 75);
-        gunner_set_pos(shooter2, 775, 75);
+    while (game_state != EXIT) {
+        /* Get a request message. */
+        if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
+            printf("driver_receive failed with %d", r);
+            continue;
+        }
+        if (is_ipc_notify(ipc_status)) { /* received notification */
+            switch (_ENDPOINT_P(msg.m_source)) {
+                case HARDWARE: /* hardware interrupt notification */
+                    for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) {
+                        if (msg.m_notify.interrupts & n) {
+                            interrupt_handler(i);
+                            switch (i) {
+                            #ifndef DIOGO
+                            case TIMER0_IRQ:
+                                switch (game_state) {
+                                case MENU:
+                                    if (no_interrupts % 2 == 0){
+                                        graph_clear_screen();
+                                        game_state = menu_update_state(main_menu, click);
+                                        menu_draw(main_menu);
 
-        list_insert(shooter_list, list_end(shooter_list), shooter1);
-        list_insert(shooter_list, list_end(shooter_list), shooter2);
+                                        click = 0;
 
-        list_t *bullet_list  = list_ctor();
+                                        sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
+                                        sprite_draw(sp_crosshair);
+                                        graph_draw();
+                                    }
+                                    break;
+                                case GAME:
+                                    if (no_interrupts % 60 == 0) timer_update(in_game_timer);
+                                    update_movement(map1, shooter1, keys, shooter_list);
 
-        ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                       gunner_get_y(shooter1)-ent_get_YLength()/2.0);
+                                    update_game_state(map1, shooter_list, bullet_list);
 
-        //uint32_t refresh_count_value = sys_hz() / REFRESH_RATE;
-        double angle; // mouse angle
-        int32_t *mouse_x = get_mouse_X(), *mouse_y = get_mouse_Y();
-        uint8_t last_lb = 0;
-        struct packet pp;
-        keys_t *keys = get_key_presses();
+                                    //update_scale();
+                                    angle = get_mouse_angle(shooter1);
+                                    gunner_set_angle(shooter1, angle - M_PI_2);
 
-        /// loop stuff
-        int ipc_status;
-        message msg;
-        int game_state = MENU, click = 0;
+                                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
+                                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
 
-        while (game_state != EXIT) {
-            /* Get a request message. */
-            if ((r = driver_receive(ANY, &msg, &ipc_status)) != 0) {
-                printf("driver_receive failed with %d", r);
-                continue;
-            }
-            if (is_ipc_notify(ipc_status)) { /* received notification */
-                switch (_ENDPOINT_P(msg.m_source)) {
-                    case HARDWARE: /* hardware interrupt notification */
-                        for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) {
-                            if (msg.m_notify.interrupts & n) {
-                                interrupt_handler(i);
-                                switch (i) {
-                                case TIMER0_IRQ:
-                                    switch (game_state) {
-                                    case MENU:
-                                        if (no_interrupts % 2 == 0){
-                                            graph_clear_screen();
-                                            game_state = menu_update_state(main_menu, click);
-                                            menu_draw(main_menu);
+                                    graph_clear_screen();
+                                    map_draw   (map1);
+                                    gunner_draw_list(shooter_list);
+                                    bullet_draw_list(bullet_list);
 
-                                            click = 0;
+                                    text_draw(in_game_timer->text);
 
-                                            sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
-                                            sprite_draw(sp_crosshair);
-                                            graph_draw();
+                                    sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
+                                    sprite_draw(sp_crosshair);
+                                    graph_draw();
+                                    break;
+                                }
+                                break;
+                            case KBC_IRQ:
+                                switch (game_state) {
+                                case MENU:
+                                    if ((scancode[0]) == ESC_BREAK_CODE) game_state = EXIT;
+                                    break;
+                                case GAME:
+                                    if ((scancode[0]) == ESC_BREAK_CODE) {
+                                        game_state = MENU;
+                                        // reset game
+                                        while(list_size(bullet_list) > 0){
+                                            bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+                                            bullet_dtor(p);
                                         }
-                                        break;
-                                    case GAME:
-                                        if (no_interrupts % 60 == 0) timer_update(in_game_timer);
-                                        update_movement(map1, shooter1, keys, shooter_list);
-
-                                        update_game_state(map1, shooter_list, bullet_list);
-
-                                        //update_scale();
-                                        angle = get_mouse_angle(shooter1);
-                                        gunner_set_angle(shooter1, angle - M_PI_2);
-
-                                        ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
-                                                       gunner_get_y(shooter1)-ent_get_YLength()/2.0);
-
-                                        graph_clear_screen();
-                                        map_draw   (map1);
-                                        gunner_draw_list(shooter_list);
-                                        bullet_draw_list(bullet_list);
-
-                                        text_draw(in_game_timer->text);
-
-                                        sprite_set_pos(sp_crosshair, *mouse_x, *mouse_y);
-                                        sprite_draw(sp_crosshair);
-                                        graph_draw();
-                                        break;
+                                        list_node_t *it = list_begin(shooter_list);
+                                        while (it != list_end(shooter_list)) {
+                                            gunner_t *p = *(gunner_t**)list_node_val(it);
+                                            get_random_spawn(map1, p);
+                                            gunner_set_curr_health(p, gunner_get_health(p));
+                                            it = list_node_next(it);
+                                        }
+                                        timer_reset(in_game_timer);
                                     }
                                     break;
-                                case KBC_IRQ:
+                                }
+                                break;
+                            case MOUSE_IRQ:
+                                if (counter_mouse_ih >= 3) {
+                                    mouse_parse_packet(packet_mouse_ih, &pp);
+                                    update_mouse(&pp);
                                     switch (game_state) {
                                     case MENU:
-                                        if ((scancode[0]) == ESC_BREAK_CODE) game_state = EXIT;
+                                        if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
                                         break;
                                     case GAME:
-                                        if ((scancode[0]) == ESC_BREAK_CODE) {
-                                            game_state = MENU;
-                                            // reset game
-                                            while(list_size(bullet_list) > 0){
-                                                bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-                                                bullet_dtor(p);
-                                            }
-                                            list_node_t *it = list_begin(shooter_list);
-                                            while (it != list_end(shooter_list)) {
-                                                gunner_t *p = *(gunner_t**)list_node_val(it);
-                                                get_random_spawn(map1, p);
-                                                gunner_set_curr_health(p, gunner_get_health(p));
-                                                it = list_node_next(it);
-                                            }
-                                            timer_reset(in_game_timer);
-                                        }
+                                        if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
+                                            shoot_bullet(shooter1, bullet_list, bsp_bullet);
                                         break;
                                     }
-                                    break;
-                                case MOUSE_IRQ:
-                                    if (counter_mouse_ih >= 3) {
-                                        mouse_parse_packet(packet_mouse_ih, &pp);
-                                        update_mouse(&pp);
-                                        switch (game_state) {
-                                        case MENU:
-                                            if (!click) click = last_lb ^ keys->lb_pressed && keys->lb_pressed;
-                                            break;
-                                        case GAME:
-                                            if (last_lb ^ keys->lb_pressed && keys->lb_pressed)
-                                                shoot_bullet(shooter1, bullet_list, bsp_bullet);
-                                            break;
-                                        }
-                                        last_lb = keys->lb_pressed;
-                                        counter_mouse_ih = 0;
+                                    last_lb = keys->lb_pressed;
+                                    counter_mouse_ih = 0;
 
-                                    }
-                                    break;
                                 }
+                                break;
+                            #endif
+                            #ifdef DIOGO
+                            case COM1_IRQ:
+                                printf("You've got mail.\n");
+                                break;
+                            #endif
                             }
                         }
+                    }
 
-                        break;
-                    default:
-                        break; /* no other notifications expected: do nothing */
-                }
-            } else { /* received standart message, not a notification */
-                /* no standart message expected: do nothing */
+                    break;
+                default:
+                    break; /* no other notifications expected: do nothing */
             }
+        } else { /* received standart message, not a notification */
+            /* no standart message expected: do nothing */
         }
+    }
 
-        while(list_size(shooter_list) > 0){
-            gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
-            gunner_dtor(p);
-        }
+    while(list_size(shooter_list) > 0){
+        gunner_t *p = list_erase(shooter_list, list_begin(shooter_list));
+        gunner_dtor(p);
+    }
 
-        while(list_size(bullet_list) > 0){
-            bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
-            bullet_dtor(p);
-        }
-        if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
-        if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
+    while(list_size(bullet_list) > 0){
+        bullet_t *p = (bullet_t*)list_erase(bullet_list, list_begin(bullet_list));
+        bullet_dtor(p);
+    }
+    if(list_dtor(shooter_list)) printf("COULD NOT DESTRUCT SHOOTER LIST\n");
+    if(list_dtor(bullet_list)) printf("COULD NOT DESTRUCT BULLET LIST\n");
 
-        timer_dtor(in_game_timer); in_game_timer = NULL;
+    timer_dtor(in_game_timer); in_game_timer = NULL;
 
-        basic_sprite_dtor      (bsp_crosshair); bsp_crosshair = NULL;
-        basic_sprite_dtor      (bsp_shooter  ); bsp_shooter   = NULL;
-        sprite_dtor            (sp_crosshair ); sp_crosshair  = NULL;
-        basic_sprite_dtor      (bsp_pistol   ); bsp_pistol    = NULL;
-        basic_sprite_dtor      (bsp_nothing  ); bsp_nothing   = NULL;
-        map_dtor               (map1         ); map1          = NULL;
-        font_dtor              (consolas     ); consolas      = NULL;
+    basic_sprite_dtor      (bsp_crosshair); bsp_crosshair = NULL;
+    basic_sprite_dtor      (bsp_shooter  ); bsp_shooter   = NULL;
+    sprite_dtor            (sp_crosshair ); sp_crosshair  = NULL;
+    basic_sprite_dtor      (bsp_pistol   ); bsp_pistol    = NULL;
+    basic_sprite_dtor      (bsp_nothing  ); bsp_nothing   = NULL;
+    map_dtor               (map1         ); map1          = NULL;
+    font_dtor              (consolas     ); consolas      = NULL;
 
-        // Unsubscribe interrupts
-        if (unsubscribe_all()) {
-            if (cleanup())
-                printf("%s: failed to cleanup.\n", __func__);
-            return 1;
-        }
+    // Unsubscribe interrupts
+    if (unsubscribe_all()) {
+        if (cleanup())
+            printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
 
 
-        if (cleanup()) {
-            printf("%s: failed to cleanup.\n", __func__);
-            return 1;
-        }
-    #endif
+    if (cleanup()) {
+        printf("%s: failed to cleanup.\n", __func__);
+        return 1;
+    }
 
-
     return 0;
 }
Index: proj/src/rtc.c
===================================================================
--- proj/src/rtc.c	(revision 260)
+++ proj/src/rtc.c	(revision 261)
@@ -1,7 +1,7 @@
+#include <lcom/lcf.h>
+
 #include "rtc.h"
 
-#include <lcom/lcf.h>
-
 #include "utils.h"
 #include "errors.h"
 
Index: proj/src/test7.c
===================================================================
--- proj/src/test7.c	(revision 260)
+++ proj/src/test7.c	(revision 261)
@@ -1,7 +1,7 @@
 #include <lcom/lcf.h>
 
 #include "errors.h"
-#include "uart.h"
+#include "nctp.h"
 
 int ser_test_conf(unsigned short base_addr) {
 	int ret = SUCCESS;
@@ -37,22 +37,23 @@
 	if((ret = uart_disable_int_rx(base_addr))) return ret;
 	if((ret = uart_disable_int_tx(base_addr))) return ret;
 	if(tx == 0){
-		uint8_t c;
-		if((ret = uart_get_char_poll(base_addr, &c))) return ret;
-		while((char)c != '.'){
-			printf("%c", (char)c);
-			if((ret = uart_get_char_poll(base_addr, &c))) return ret;
+		uint8_t c = ' ';
+		int r;
+		while(c != '.'){
+			r = nctp_get_char_poll(base_addr, &c);
+			if(r == TIMEOUT_ERROR) continue;
+			else if(r != SUCCESS ) return r;
+			printf("%c", c);
 		}
-		printf("%c\n", (char)c);
 	}else{
 		for(int i = 0; i < stringc; ++i){
 			for(int j = 0; strings[i][j] != 0; ++j)
-				if((ret = uart_send_char_poll(base_addr, strings[i][j])))
+				if((ret = nctp_send_char_poll(base_addr, strings[i][j])))
 					return ret;
 			if(i+1 != stringc)
-				if((ret = uart_send_char_poll(base_addr, ' '))) return ret;
+				if((ret = nctp_send_char_poll(base_addr, ' '))) return ret;
 		}
-		if((ret = uart_send_char_poll(base_addr, '.'))) return ret;
+		if((ret = nctp_send_char_poll(base_addr, '.'))) return ret;
 	}
 	return SUCCESS;
 }
Index: proj/src/uart.c
===================================================================
--- proj/src/uart.c	(revision 260)
+++ proj/src/uart.c	(revision 261)
@@ -61,12 +61,21 @@
 
 /// LSR
 #define UART_RECEIVER_READY_POS                 0
+#define UART_OVERRUN_ERROR_POS                  1
+#define UART_PARITY_ERROR_POS                   2
+#define UART_FRAMING_ERROR_POS                  3
 #define UART_TRANSMITTER_EMPTY_POS              5
 
 #define UART_RECEIVER_READY                     (BIT(0))
+#define UART_OVERRUN_ERROR                      (BIT(1))
+#define UART_PARITY_ERROR                       (BIT(2))
+#define UART_FRAMING_ERROR                      (BIT(3))
 #define UART_TRANSMITTER_EMPTY                  (BIT(5))
 
 #define UART_GET_RECEIVER_READY(n)              (((n)&UART_RECEIVER_READY           )>>UART_RECEIVER_READY_POS           )
+#define UART_GET_OVERRUN_ERROR                  (((n)&UART_OVERRUN_ERROR            )>>UART_OVERRUN_ERROR_POS            )
+#define UART_GET_PARITY_ERROR                   (((n)&UART_PARITY_ERROR             )>>UART_PARITY_ERROR_POS             )
+#define UART_GET_FRAMING_ERROR                  (((n)&UART_FRAMING_ERROR            )>>UART_FRAMING_ERROR_POS            )
 #define UART_GET_TRANSMITTER_EMPTY(n)           (((n)&UART_TRANSMITTER_EMPTY        )>>UART_TRANSMITTER_EMPTY_POS        )
 
 static void uart_parse_config(uart_config *config){
@@ -241,15 +250,124 @@
     return uart_set_ier(base_addr, ier);
 }
 
-int uart_get_char_poll(int base_addr, uint8_t *p){
+static int uart_has_communication_error(int base_addr){
     int ret;
-    while(!uart_receiver_ready(base_addr)){}
-    if((ret = uart_get_char(base_addr, p))) return ret;
+    uint8_t lsr;
+    if((ret = uart_get_lsr(base_addr, &lsr))) return 1;
+    lsr &= (UART_OVERRUN_ERROR &
+            UART_PARITY_ERROR  &
+            UART_FRAMING_ERROR);
+    return (lsr ? 1 : 0);
+}
+
+#include "nctp.h"
+
+#define NCTP_START      0x80
+#define NCTP_END        0xFF
+#define NCTP_TRIES      3
+#define NCTP_OK         0xFF
+#define NCTP_NOK        0x00
+#define NCTP_MAX_SIZE   1024 //in bytes
+
+int nctp_send_char_poll(int base_addr, uint8_t  c){
+    for(int i = 0; i < NCTP_TRIES; ++i)
+        if(uart_transmitter_empty(base_addr))
+            return uart_send_char(base_addr, c);
+    return TIMEOUT_ERROR;
+}
+int nctp_get_char_poll (int base_addr, uint8_t *p){
+    for(int i = 0; i < NCTP_TRIES; ++i)
+        if(uart_receiver_ready(base_addr))
+            return uart_get_char(base_addr, p);
+    return TIMEOUT_ERROR;
+}
+
+int nctp_expect_ok(int base_addr){
+    int ret;
+    uint8_t ok;
+    if((ret = nctp_get_char_poll(base_addr, &ok))) return ret;
+    int cnt = 0;
+    while(ok){
+        cnt += ok&1;
+        ok >>= 1;
+    }
+    if(cnt > 4) return SUCCESS;
+    else        return NOK;
+}
+
+int nctp_send_char_try(int base_addr, uint8_t  c){
+    int ret;
+    for(size_t k = 0; k < NCTP_TRIES; ++k){
+        if((ret = nctp_send_char_poll(base_addr, c))) return ret;
+        if(nctp_expect_ok(base_addr) == SUCCESS) return SUCCESS;
+    }
+    return TRANS_FAILED;
+}
+int nctp_get_char_try (int base_addr, uint8_t *p){
+    int ret;
+    for(size_t k = 0; k < NCTP_TRIES; ++k){
+        if((ret = nctp_get_char_poll (base_addr, p))) return ret;
+        if(!uart_has_communication_error(base_addr))
+            return nctp_send_char_try(base_addr, NCTP_OK ); //If it does not have any errors
+    }
+    if((ret = nctp_send_char_poll(base_addr, NCTP_NOK))) return ret;
+    return TRANS_FAILED;
+}
+
+int nctp_send(int port, size_t num, uint8_t* ptr[], size_t sz[]){
+    {
+        int cnt = 0;
+        for(size_t i = 0; i < num; ++i){
+            cnt += sz[i];
+            if(cnt > NCTP_MAX_SIZE) return TRANS_REFUSED;
+        }
+    }
+
+    int base_addr;{
+        switch(port){
+            case 1: base_addr = COM1_ADDR; break;
+            case 2: base_addr = COM2_ADDR; break;
+            default: return INVALID_ARG;
+        }
+    }
+
+    int ret;
+
+    if((ret = uart_disable_int_rx(base_addr))) return ret;
+    if((ret = uart_disable_int_tx(base_addr))) return ret;
+
+    if((ret = nctp_send_char_try(base_addr, NCTP_START))) return ret;
+    for(size_t i = 0; i < num; ++i){
+        uint8_t *p = ptr[i]; size_t s = sz[i];
+        for(size_t j = 0; j < s; ++j, ++p)
+            if((ret = nctp_send_char_try(base_addr, *p)))
+                return ret;
+    }
+    if((ret = nctp_send_char_try(base_addr, NCTP_END))) return ret;
+
     return SUCCESS;
 }
-int uart_send_char_poll(int base_addr, uint8_t  c){
+int ntcp_get(int port, uint8_t *dest){
+    int base_addr;{
+        switch(port){
+            case 1: base_addr = COM1_ADDR; break;
+            case 2: base_addr = COM2_ADDR; break;
+            default: return INVALID_ARG;
+        }
+    }
+
     int ret;
-    while(!uart_transmitter_empty(base_addr)){}
-    if((ret = uart_send_char(base_addr, c))) return ret;
+    free(dest);
+    dest = malloc(NCTP_MAX_SIZE*sizeof(uint8_t)); size_t i = 0;
+    if(dest == NULL) return NULL_PTR;
+    uint8_t c;
+    if((ret = nctp_get_char_try (base_addr, &c     ))) return ret;
+    while(true){
+        if(i >= NCTP_MAX_SIZE) return TRANS_REFUSED;
+        if((ret = nctp_get_char_try (base_addr, &c))) return ret;
+        if(c == NCTP_END) break;
+        else              dest[i] = c;
+        ++i;
+    }
     return SUCCESS;
 }
