summaryrefslogtreecommitdiff
path: root/touch/ftm5/fts_lib/ftsTime.h
blob: f2b99a83cd5e524570915f0a5304b3504f6964f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
  *
  **************************************************************************
  **                        STMicroelectronics				 **
  **************************************************************************
  **                        marco.cali@st.com				 **
  **************************************************************************
  *                                                                        *
  *                  FTS Utility for measuring/handling the time	   *
  *                                                                        *
  **************************************************************************
  **************************************************************************
  *
  */

/*!
  * \file ftsTime.h
  * \brief Contains all the definitions and structs to handle and measure the
  * time in the driver
  */

#ifndef FTS_TIME_H
#define FTS_TIME_H


#include <linux/time.h>

/* TIMEOUT */
/** @defgroup timeouts	 Timeouts
  * Definitions of all the Timeout used in several operations
  * @{
  */
#define TIMEOUT_RESOLUTION			50
/* /< timeout resolution in ms (all timeout should be multiples of this unit) */
#define GENERAL_TIMEOUT				(15 * TIMEOUT_RESOLUTION)
/* /< general timeout in ms */
#define RELEASE_INFO_TIMEOUT			(2 * TIMEOUT_RESOLUTION)
/* /< timeout to request release info in ms */

#define TIMEOUT_CMD_CUSTOM_W			(1 * TIMEOUT_RESOLUTION)
/* /< timeout to perform custom write cmd in ms */
#define TIMEOUT_CMD_SCAN_MODE			(1 * TIMEOUT_RESOLUTION)
/* /< timeout to perform scan mode cmd in ms */
#define TIMEOUT_REQU_COMP_DATA			(4 * TIMEOUT_RESOLUTION)
/* /< timeout to request compensation data in ms */
#define TIMEOUT_REQU_DATA			(8 * TIMEOUT_RESOLUTION)
/* /< timeout to request data in ms */
#define TIMEOUT_ITO_TEST_RESULT			(4 * TIMEOUT_RESOLUTION)
/* /< timeout to perform ito test in ms */
#define TIMEOUT_INITIALIZATION_TEST_RESULT	(5000 * TIMEOUT_RESOLUTION)
/* /< timeout to perform initialization test in ms */
#define TIEMOUT_ECHO 				(50 * TIMEOUT_RESOLUTION)
/* /< timeout of the echo command,*/
#define TIMEOUT_ECHO_FLUSH			(TIMEOUT_RESOLUTION)
/* /< timeout of the flush echo command,*/
#define TIMEOUT_ECHO_FPI			(200  * TIMEOUT_RESOLUTION)
/* /< timeout of the Full panel Init echo command */
#define TIMEOUT_ECHO_SINGLE_ENDED_SPECIAL_AUTOTUNE \
	(100  * TIMEOUT_RESOLUTION)
/** @}*/


/**
  * Struct used to measure the time elapsed between a starting and ending point.
  */
typedef struct {
	struct timespec64 start;	/* /< store the starting time */
	struct timespec64 end;		/* /< store the finishing time */
} StopWatch;


void startStopWatch(StopWatch *w);
void stopStopWatch(StopWatch *w);
int elapsedMillisecond(StopWatch *w);
int elapsedNanosecond(StopWatch *w);

#endif