]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan.c
changes to use the FRSH FSA module to do the analysis and spare capacity. TODO: finis...
[frescor/fna.git] / src_frescan / frescan.c
index 56531aecc8b0d46e2a7d88dedad111d6d7fbf1ed..3c6fc8ba5ec23dc3d8fa49e1f035dea30b1ba788 100644 (file)
@@ -119,7 +119,7 @@ int frescan_init(frescan_init_params_t *params)
 
         fd = open (can_path, O_RDWR);
         if (fd == -1) {
-                ERROR ("could not open /dev/can%u\n", params->net);
+                FRESCAN_ERROR ("could not open /dev/can%u\n", params->net);
                 return -1;
         }
 
@@ -141,7 +141,7 @@ int frescan_init(frescan_init_params_t *params)
 
         ret = ioctl(fd, CAN_IOCTL_SET_FILTERS, &ioctl_filters);
         if (ret == -1) {
-                ERROR ("ioctl CAN_IOCTL_SET_FILTERS failed /dev/can%u\n",
+                FRESCAN_ERROR ("ioctl CAN_IOCTL_SET_FILTERS failed /dev/can%u\n",
                        params->net);
                 return -1;
         }
@@ -150,21 +150,21 @@ int frescan_init(frescan_init_params_t *params)
 
         ret = ioctl(fd, CAN_IOCTL_SET_TX_HOOK, frescan_hook_frame_sent);
         if (ret == -1) {
-                ERROR ("ioctl CAN_IOCTL_SET_TX_HOOK failed /dev/can%u\n",
+                FRESCAN_ERROR ("ioctl CAN_IOCTL_SET_TX_HOOK failed /dev/can%u\n",
                        params->net);
                 return -1;
         }
 
         ret = ioctl(fd, CAN_IOCTL_SET_RX_HOOK, frescan_hook_frame_recv);
         if (ret == -1) {
-                ERROR ("ioctl CAN_IOCTL_SET_RX_HOOK failed /dev/can%u\n",
+                FRESCAN_ERROR ("ioctl CAN_IOCTL_SET_RX_HOOK failed /dev/can%u\n",
                        params->net);
                 return -1;
         }
 
         ret = ioctl(fd, CAN_IOCTL_SET_AB_HOOK, frescan_hook_frame_aborted);
         if (ret == -1) {
-                ERROR ("ioctl CAN_IOCTL_SET_AB_HOOK failed /dev/can%u\n",
+                FRESCAN_ERROR ("ioctl CAN_IOCTL_SET_AB_HOOK failed /dev/can%u\n",
                        params->net);
                 return -1;
         }
@@ -173,25 +173,25 @@ int frescan_init(frescan_init_params_t *params)
 
         ret = frescan_data_init(fd, params);
         if (ret != 0) {
-                ERROR("could not initialize the global data\n");
+                FRESCAN_ERROR("could not initialize the global data\n");
                 return -1;
         }
 
         ret = frescan_packets_init();
         if (ret != 0) {
-                ERROR("could not initialize the packets pool\n");
+                FRESCAN_ERROR("could not initialize the packets pool\n");
                 return -1;
         }
 
         ret = frescan_queues_init(&the_networks[params->net].queues, params);
         if (ret != 0) {
-                ERROR("could not initialize the queues\n");
+                FRESCAN_ERROR("could not initialize the queues\n");
                 return -1;
         }
 
         ret = frescan_servers_init(params->net);
         if (ret != 0) {
-                ERROR("could not initialize the servers\n");
+                FRESCAN_ERROR("could not initialize the servers\n");
                 return -1;
         }
 
@@ -221,7 +221,7 @@ int frescan_send(const frescan_send_params_t *params,
               "checking arguments (msg size=%d)\n", size);
 
         if ((params == NULL) || (msg == NULL) || (size == 0)) {
-                ERROR("arguments are not ok\n");
+                FRESCAN_ERROR("arguments are not ok\n");
                 return -1;
         }
 
@@ -232,7 +232,7 @@ int frescan_send(const frescan_send_params_t *params,
         FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
         if (packet == NULL) {
-                ERROR("could not allocate packet\n");
+                FRESCAN_ERROR("could not allocate packet\n");
                 return -1;
         }
         packet->flags = params->flags; // set the flags (to remember them)
@@ -244,7 +244,7 @@ int frescan_send(const frescan_send_params_t *params,
         FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
         if (packet->frame == NULL) {
-                ERROR("could not allocate frame\n");
+                FRESCAN_ERROR("could not allocate frame\n");
                 return -1;
         }
 
@@ -305,7 +305,7 @@ int frescan_send(const frescan_send_params_t *params,
                 FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
                 if (ret != 0) {
-                        ERROR("could not enqueue the packet\n");
+                        FRESCAN_ERROR("could not enqueue the packet\n");
                         return -1;
                 }
         } else {
@@ -314,7 +314,7 @@ int frescan_send(const frescan_send_params_t *params,
                 FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
                 if (ret != 0) {
-                        ERROR("could not enqueue the packet\n");
+                        FRESCAN_ERROR("could not enqueue the packet\n");
                         return -1;
                 }
         }
@@ -324,7 +324,7 @@ int frescan_send(const frescan_send_params_t *params,
         FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
         if (ret != 0) {
-                ERROR("could not update hw buffer\n");
+                FRESCAN_ERROR("could not update hw buffer\n");
                 return -1;
         }
 
@@ -372,7 +372,7 @@ int frescan_recv(const frescan_recv_params_t *params,
 
         ret = frescan_pqueue_dequeue(pqueue, &head, prio, blocking);
         if (ret != 0) {
-                ERROR ("could not dequeue packet\n");
+                FRESCAN_ERROR ("could not dequeue packet\n");
                 return -1;
         }
 
@@ -383,7 +383,7 @@ int frescan_recv(const frescan_recv_params_t *params,
                         *recv_bytes = 0;
                         return 0;
                 } else {
-                        ERROR ("blocking true, and packet = null\n");
+                        FRESCAN_ERROR ("blocking true, and packet = null\n");
                         return -1;
                 }
         }
@@ -410,13 +410,13 @@ int frescan_recv(const frescan_recv_params_t *params,
 
                 ret = can_framespool_free(packet->frame);
                 if (ret != 0) {
-                        ERROR("could not free frame\n");
+                        FRESCAN_ERROR("could not free frame\n");
                         return -1;
                 }
 
                 ret = frescan_packets_free(packet);
                 if (ret != 0) {
-                        ERROR("could not free packet\n");
+                        FRESCAN_ERROR("could not free packet\n");
                         return -1;
                 }
         }
@@ -426,7 +426,7 @@ int frescan_recv(const frescan_recv_params_t *params,
         FRESCAN_RELEASE_LOCK(&the_networks[params->net].lock);
 
         if (ret != 0) {
-                ERROR("could not free head packet\n");
+                FRESCAN_ERROR("could not free head packet\n");
                 return -1;
         }
 
@@ -519,7 +519,7 @@ static int frescan_hook_frame_recv (const struct can_chip_t *chip,
                 pqueue = the_networks[net].queues.rx_channel_queues[channel];
                 ret = frescan_pqueue_enqueue(pqueue, head, prio);
                 if (ret != 0) {
-                        ERROR("could not enqueue message in channel queue\n");
+                        FRESCAN_ERROR("could not enqueue message in channel queue\n");
                         return -1;
                 }
 
@@ -572,7 +572,7 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
 
                 ret = frescan_servers_frame_sent(chip->minor, id, packet);
                 if (ret != 0) {
-                        ERROR("could not let the server a frame was sent\n");
+                        FRESCAN_ERROR("could not let the server a frame was sent\n");
                         return -1;
                 }
         }
@@ -592,7 +592,7 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
                         pqueue = the_networks[chip->minor].queues.tx_fp_queue;
                         ret = frescan_pqueue_requeue(pqueue, packet, prio);
                         if (ret != 0) {
-                                ERROR("could not requeue the packet\n");
+                                FRESCAN_ERROR("could not requeue the packet\n");
                                 return -1;
                         }
                 } else if (packet->flags & FRESCAN_SS) {
@@ -600,11 +600,11 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
                               "requeue server %u packet\n", id);
                         ret = frescan_servers_requeue(chip->minor, id, packet);
                         if (ret != 0) {
-                                ERROR("could not requeue the packet\n");
+                                FRESCAN_ERROR("could not requeue the packet\n");
                                 return -1;
                         }
                 } else {
-                        ERROR("flags are not correct\n");
+                        FRESCAN_ERROR("flags are not correct\n");
                         return -1;
                 }
         } else {
@@ -613,13 +613,13 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
 
                 ret = can_framespool_free(packet->frame);
                 if (ret != 0)  {
-                        ERROR ("could not free the frame\n");
+                        FRESCAN_ERROR ("could not free the frame\n");
                         return ret;
                 }
 
                 ret = frescan_packets_free(packet);
                 if (ret != 0)  {
-                        ERROR ("could not free the packet\n");
+                        FRESCAN_ERROR ("could not free the packet\n");
                         return ret;
                 }
 
@@ -630,7 +630,7 @@ static int frescan_hook_frame_sent(const struct can_chip_t *chip)
 
         ret = frescan_hw_buffer_update(chip->minor);
         if (ret != 0) {
-                ERROR("could not update hw buffer\n");
+                FRESCAN_ERROR("could not update hw buffer\n");
                 return -1;
         }
 
@@ -672,7 +672,7 @@ static int frescan_hook_frame_aborted(const struct can_chip_t *chip)
                 pqueue = the_networks[chip->minor].queues.tx_fp_queue;
                 ret = frescan_pqueue_requeue(pqueue, packet, prio);
                 if (ret != 0) {
-                        ERROR("could not requeue the packet\n");
+                        FRESCAN_ERROR("could not requeue the packet\n");
                         return -1;
                 }
         } else if (packet->flags & FRESCAN_SS) {
@@ -681,11 +681,11 @@ static int frescan_hook_frame_aborted(const struct can_chip_t *chip)
 
                 ret = frescan_servers_requeue(chip->minor, id, packet);
                 if (ret != 0) {
-                        ERROR("could not requeue the packet\n");
+                        FRESCAN_ERROR("could not requeue the packet\n");
                         return -1;
                 }
         } else {
-                ERROR("flags are not correct\n");
+                FRESCAN_ERROR("flags are not correct\n");
                 return -1;
         }
 
@@ -693,7 +693,7 @@ static int frescan_hook_frame_aborted(const struct can_chip_t *chip)
 
         ret = frescan_hw_buffer_update(chip->minor);
         if (ret != 0) {
-                ERROR("could not update hw buffer\n");
+                FRESCAN_ERROR("could not update hw buffer\n");
                 return -1;
         }