mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 06:04:28 +08:00
driver/sensor: replace lower->buffer_size with lower->buffer_number
more efficient Change-Id: I0823b10248caf75e4dd6a5086ad230ba4a7298f6 Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
6edeb9ebd9
commit
54ea96da6b
@@ -261,16 +261,14 @@
|
||||
|
||||
#define SNIOC_GET_NEVENTBUF _SNIOC(0x0070)
|
||||
|
||||
/* Command: SNIOC_SET_BUFFER_SIZE
|
||||
* Description: Set size of intermediate circualr buffer in upper half
|
||||
* driver.
|
||||
* Argument: This is the size of buffer pointer.
|
||||
* Note: The application layer can set size of intermediate circualr
|
||||
* buffer
|
||||
* by this ioctl command. The size is in bytes, it should be a
|
||||
* multiple of an event.
|
||||
/* Command: SNIOC_SET_BUFFER_NUMBER
|
||||
* Description: Set the number of events intermediate circualr buffer can
|
||||
* hold in upper half driver.
|
||||
* Argument: This is the number of events that buffer can hold.
|
||||
* Note: The application layer can set number of events intermediate
|
||||
* circualr buffer can hold by this ioctl command.
|
||||
*/
|
||||
|
||||
#define SNIOC_SET_BUFFER_SIZE _SNIOC(0x0071)
|
||||
#define SNIOC_SET_BUFFER_NUMBER _SNIOC(0x0071)
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_IOCTL_H */
|
||||
|
||||
@@ -573,18 +573,16 @@ struct sensor_lowerhalf_s
|
||||
|
||||
int type;
|
||||
|
||||
/* The size of the circular buffer used, in bytes units.
|
||||
* This sensor circular buffer is used to solve the issue where the
|
||||
* application can't read sensor event in time. If this length of buffer
|
||||
* is too large, the latency of the sensor event will be too large.
|
||||
* If the length of buffer is too small, the events will be overwriten
|
||||
* before the application can read them.
|
||||
* So, it's recommended to set the size according to sensor ODR. If ODR is
|
||||
* low, you can set to a length of sensor event. If ODR is high, you can
|
||||
* set to two or three times the length of sensor event.
|
||||
/* The number of events that the circular buffer can hold.
|
||||
* This sensor circular buffer is used to slove issue that application
|
||||
* can't read sensor event in time. If this number of events is too large,
|
||||
* the latency of sensor event will be too larage. If the number of events
|
||||
* is too small, the event will be overwrite before application read them.
|
||||
* So, it's recommended to set according to sensor odr. If odr is low, you
|
||||
* can set to one. If odr is high, you can set to two or three.
|
||||
*/
|
||||
|
||||
uint32_t buffer_size;
|
||||
uint32_t buffer_number;
|
||||
|
||||
/* The uncalibrated use to describe whether the sensor event is
|
||||
* uncalibrated. True is uncalibrated data, false is calibrated data,
|
||||
|
||||
Reference in New Issue
Block a user