]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/commitdiff
can: Rename bit_index to bit_mask
authorMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 8 Sep 2014 14:28:58 +0000 (16:28 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Mon, 8 Sep 2014 14:28:58 +0000 (16:28 +0200)
It is a better name for it.

rpp/src/rpp/can.c

index 1743f5c895916f225e8336286b888e7e8eb7e6ca..918ee7315d53adfe27033694b23a8601a20fe7cd 100644 (file)
@@ -534,7 +534,7 @@ int8_t rpp_can_init(const struct rpp_can_config *config)
 
 int8_t rpp_can_write(rpp_can_hw_obj hw_obj, const struct rpp_can_pdu *pdu)
 {
-    uint32_t reg_index, bit_index;
+    uint32_t reg_index, bit_mask;
     uint8_t i;
     canBASE_t *controller;
     struct rpp_can_tx_config *tx_cfg = &can_config->tx_config[hw_obj];
@@ -545,10 +545,10 @@ int8_t rpp_can_write(rpp_can_hw_obj hw_obj, const struct rpp_can_pdu *pdu)
     }
 
     reg_index = (tx_cfg->msg_obj - 1) >> 5;
-    bit_index = 1 << ((tx_cfg->msg_obj - 1) & 0x1FU);
+    bit_mask = 1 << ((tx_cfg->msg_obj - 1) & 0x1FU);
 
     // FIXME: Check whether sending should be aborted or message overwritten
-    if (controller->TXRQx[reg_index] & bit_index)
+    if (controller->TXRQx[reg_index] & bit_mask)
     {
         return FAILURE;
     }
@@ -590,7 +590,7 @@ int8_t rpp_can_write(rpp_can_hw_obj hw_obj, const struct rpp_can_pdu *pdu)
 
 int8_t rpp_can_check_tx_con(rpp_can_hw_obj hw_obj, bool *tx_con)
 {
-    uint32_t reg_index, bit_index;
+    uint32_t reg_index, bit_mask;
     canBASE_t *controller;
 
     if (!(controller = map_controller(can_config->tx_config[hw_obj].controller)))
@@ -599,16 +599,16 @@ int8_t rpp_can_check_tx_con(rpp_can_hw_obj hw_obj, bool *tx_con)
     }
 
     reg_index = can_config->tx_config[hw_obj].msg_obj >> 5;
-    bit_index = 1 << ((can_config->tx_config[hw_obj].msg_obj - 1) & 0x1FU);
+    bit_mask = 1 << ((can_config->tx_config[hw_obj].msg_obj - 1) & 0x1FU);
 
-    *tx_con = controller->TXRQx[reg_index] & bit_index;
+    *tx_con = controller->TXRQx[reg_index] & bit_mask;
 
     return SUCCESS;
 }
 
 int8_t rpp_can_read(rpp_can_hw_obj hw_obj, struct rpp_can_pdu *pdu)
 {
-    uint32_t reg_index, bit_index;
+    uint32_t reg_index, bit_mask;
     uint32_t i;
     canBASE_t *controller;
 
@@ -618,10 +618,10 @@ int8_t rpp_can_read(rpp_can_hw_obj hw_obj, struct rpp_can_pdu *pdu)
     }
 
     reg_index = (can_config->rx_config[hw_obj].msg_obj - 1) >> 5;
-    bit_index = 1 << ((can_config->rx_config[hw_obj].msg_obj - 1) & 0x1FU);
+    bit_mask = 1 << ((can_config->rx_config[hw_obj].msg_obj - 1) & 0x1FU);
 
     // FIXME: Check whether to abort if there are no new data
-    if (!(controller->NWDATx[reg_index] & bit_index))
+    if (!(controller->NWDATx[reg_index] & bit_mask))
     {
         return FAILURE;
     }
@@ -663,7 +663,7 @@ int8_t rpp_can_read(rpp_can_hw_obj hw_obj, struct rpp_can_pdu *pdu)
 
 int8_t rpp_can_check_rx_ind(rpp_can_hw_obj hw_obj, bool *rx_ind)
 {
-    uint32_t reg_index, bit_index;
+    uint32_t reg_index, bit_mask;
     canBASE_t *controller;
 
     if (!(controller = map_controller(can_config->rx_config[hw_obj].controller)))
@@ -672,9 +672,9 @@ int8_t rpp_can_check_rx_ind(rpp_can_hw_obj hw_obj, bool *rx_ind)
     }
 
     reg_index = (can_config->rx_config[hw_obj].msg_obj - 1) >> 5;
-    bit_index = 1 << ((can_config->rx_config[hw_obj].msg_obj - 1) & 0x1FU);
+    bit_mask = 1 << ((can_config->rx_config[hw_obj].msg_obj - 1) & 0x1FU);
 
-    *rx_ind = controller->NWDATx[reg_index] & bit_index;
+    *rx_ind = controller->NWDATx[reg_index] & bit_mask;
 
     return SUCCESS;
 }