drivers/can/can.c: Fix errors with pointers when using internal OS interface (#118)

Author: Gregory Nutt <gnutt@nuttx.org>

    Run all .c and .h files in last PR through tools/nxstyle and correct all coding standard complaints.

Author: Oleg <ev.mipt@gmail.com>

    * Fix CAN driver to work with internal OS interfaces.  Store internal file pointer in f_priv and use it then to distinct readers (See issue #111)
    * Store reader pointer in f_priv instead of filep
    * Don't need in filep in can_reader_s
This commit is contained in:
Oleg
2020-01-17 09:46:39 -06:00
committed by Gregory Nutt
parent e0cd10b7d5
commit 41efa2ae72
2 changed files with 36 additions and 53 deletions
+8 -10
View File
@@ -561,7 +561,6 @@ struct can_reader_s
{
struct list_node list;
sem_t read_sem;
FAR struct file *filep;
struct can_rxfifo_s fifo; /* Describes receive FIFO */
};
@@ -590,6 +589,7 @@ struct can_dev_s
};
/* Structures used with ioctl calls */
/* CANIOC_RTR: */
struct canioc_rtr_s
@@ -598,8 +598,9 @@ struct canioc_rtr_s
FAR struct can_msg_s *ci_msg; /* The location to return the RTR response */
};
/* CANIOC_GET_BITTIMING/CANIOC_SET_BITTIMING: */
/* Bit time = Tquanta * (Sync_Seg + Prop_Seq + Phase_Seg1 + Phase_Seg2)
/* CANIOC_GET_BITTIMING/CANIOC_SET_BITTIMING:
*
* Bit time = Tquanta * (Sync_Seg + Prop_Seq + Phase_Seg1 + Phase_Seg2)
* = Tquanta * (TSEG1 + TSEG2 + 1)
* Where
* TSEG1 = Prop_Seq + Phase_Seg1
@@ -614,8 +615,9 @@ struct canioc_bittiming_s
uint8_t bt_sjw; /* Synchronization Jump Width in time quanta */
};
/* CANIOC_GET_CONNMODES/CANIOC_SET_CONNMODES: */
/* A CAN device may support loopback and silent mode. Both modes may not be
/* CANIOC_GET_CONNMODES/CANIOC_SET_CONNMODES:
*
* A CAN device may support loopback and silent mode. Both modes may not be
* settable independently.
*/
@@ -654,11 +656,7 @@ struct canioc_stdfilter_s
};
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Functions
* Public Function Prototypes
************************************************************************************/
#undef EXTERN