ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
isf_rli.h
Go to the documentation of this file.
1 /*
2  * isf_rli.h
3  *
4  @file isf_rli.h
5 * @brief \b isf_rli.c defines the macros and structures for register level interface (RLI).
6 * The Register Level interface is a light-weight interface that allows register level access
7 * for users to the Sensor registers where read and write can be performed directly to these registers.
8  */
9 
10 #ifndef ISF_RLI_H_
11 #define ISF_RLI_H_
12 
13 typedef void RLI_CHANNEL_HANDLE;
14 typedef void RLI_DEV_HANDLE;
15 
16 /*!
17  * @brief This enumerates the error types returned by the RLI interface.
18  */
19 typedef enum isf_rli_error_types
20 {
21  /*!< RLI initialize error. */
23  /*!< RLI open interface error. */
25  /*!< RLI read error. */
27  /*!< RLI write error. */
29  /*!< RLI close error. */
31  /*!< RLI null pointer error. */
34 /*! @brief This function initializes a register level interface.
35  *
36  * @details The Initialization creates the RLI channel and initializes the data structures required to manage the channel.
37  *
38  * @param[in] aChannelId The ID of the channel to initialize.
39  *
40  * @return ::isf_rli_init() returns a RLI channel handle to specified channel.
41  * @retval :: a valid channel handle is returned when it successfully initialized.
42  * @retval :: NULL is returned when channel could be created.
43  *
44  * @Reentrant Yes
45  * @Libs None
46  */
47 
49 /*! @brief This function creates a RLI connection handle at a specified device address.
50  *
51  * @details The isf_rli_open() function may be used to get a handle to a device at a known device information.
52  *
53  * @param[in] apRLIChannelHandle The handle of the RLI channel.
54  * @param[in] apSlaveInfo The known information of a slave device.
55  *
56  * @return ::isf_rli_open() returns a RLI device handle.
57  *
58  * @retval :: a valid device handle is returned when it successfully opened.
59  * @retval :: NULL is returned when device could be opened.
60  *
61  * @Reentrant Yes
62  * @Libs None
63  */
64 RLI_DEV_HANDLE* isf_rli_open(RLI_CHANNEL_HANDLE *apRLIChannelHandle, void *apSlaveInfo);
65 /*! @brief This function writes to the device registers.
66  *
67  * @details isf_rli_write() writes data to the specified device registers.
68  *
69  * @param[in] apRLIDeviceHandle The handle of the device to which to write.
70  * @param[in] startAddress The offset/sub address to which the write is performed.
71  * @param[in] apWriteBuffer The Buffer address where any write data is placed.
72  * @param[in] aNbyteWrite The number of bytes to write.
73  * @return ::dm_device_write() returns a value of type ::isf_status_t indicating whether the operation was successful or unsuccessful.
74  * @retval ::ISF_SUCCESS is returned when the device was written successfully.
75  * @retval ::COMM_ERROR_INIT is returned when the channel handle refers to a non-initialized channel.
76  * @retval ::COMM_ERROR_STOP is returned when the write is invoked on a stopped channel.
77  * @retval ::COMM_ERROR_NO_ACK is returned when no acknowledgement was received from the device.
78  * @retval ::COMM_ERROR_NULL_PTR is returned when a NULL pointer argument was passed into the function.
79  * @retval ::COMM_ERROR_TIME_OUT is returned when the request could not be fulfilled in the specified timeout period.
80  * @retval ::COMM_ERROR_LOCK is returned when a lock could not be acquired properly.
81  * @retval ::COMM_ERROR_DEV_CLOSED is returned when the write is invoked on a closed device.
82  *
83  *
84  * @Reentrant Yes
85  * @Libs None
86  */
87 isf_status_t isf_rli_write(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteWrite , uint8* apWriteBuffer);
88 /*! @brief This function reads from the device registers.
89  *
90  * @details isf_rli_read() reads data from the specified device registers.
91  *
92  * @param[in] apRLIDeviceHandle The RLI handle to the device from which to read.
93  * @param[in] startAddress The offset/sub address from which the read is performed.
94  * @param[in] apReadBuffer The Buffer address where any returned data is placed.
95  * @param[in] aNbyteRead The number of bytes to read.
96  * @return ::isf_rli_read() returns a value of type ::isf_status_t indicating whether the operation was successful or unsuccessful.
97  *
98  * @retval ::ISF_SUCCESS is returned when data from the device was read successfully.
99  * @retval ::COMM_ERROR_INIT is returned when the channel handle refers to a non-initialized channel.
100  * @retval ::COMM_ERROR_BUF_SIZE is returned when the provided buffer is too small to hold all the data or the number of bytes read is zero.
101  * @retval ::COMM_ERROR_NO_ACK is returned when no acknowledgement was received from the device.
102  * @retval ::COMM_ERROR_NULL_PTR is returned when a NULL pointer argument was passed into the function.
103  * @retval ::COMM_ERROR_TIME_OUT is returned when the request could not be fulfilled in the specified timeout period.
104  * @retval ::COMM_ERROR_LOCK is returned when a lock could not be acquired properly.
105  * @retval ::COMM_ERROR_DEV_CLOSED is returned when the read is invoked on a closed device.
106  *
107  *
108  * @Reentrant Yes
109  * @Libs None
110  */
111 isf_status_t isf_rli_read(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteRead, uint8* apReadBuffer);
112 /*! @brief This function closes the RLI connection.
113  *
114  * @details The isf_rli_close() function is used when no further communication with the device is needed using RLI. A closed device should not be
115  * passed to ::isf_rli_write() or ::isf_rli_write().
116  *
117  * @param[in] apRLIDeviceHandle The address of the RLI connection handle to be closed.
118  * @return ::isf_rli_close() returns a value of type ::isf_status_t indicating whether the operation was successful or unsuccessful.
119  * @retval ::ISF_SUCCESS is returned when the device is closed.
120  * @retval ::ISF_RLI_ERR_NULLPTR is returned when a NULL pointer argument was passed into the function.
121  *
122  * @Reentrant Yes
123  * @Libs None
124  */
125 isf_status_t isf_rli_close(RLI_DEV_HANDLE *apRLIDeviceHandle);
126 /*! @brief This function de-initialize the RLI channel.
127  *
128  * @details The isf_rli_deint() function is used when no further communication with the device is needed using RLI for the specified channel.
129  *
130  * @param[in] apRLIChannelHandle The address of the RLI connection handle to be closed.
131  * @return ::isf_rli_deint() returns a value of type ::isf_status_t indicating whether the operation was successful or unsuccessful.
132  * @retval ::ISF_SUCCESS is returned when the device is closed.
133  * @retval ::ISF_RLI_ERR_NULLPTR is returned when a NULL pointer argument was passed into the function.
134  *
135  * @Reentrant Yes
136  * @Libs None
137  */
138 isf_status_t isf_rli_deint(RLI_CHANNEL_HANDLE *apRLIChannelHandle);
139 
140 #endif /* ISF_RLI_H_ */
enum isf_rli_error_types isf_rli_err_t
This enumerates the error types returned by the RLI interface.
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
isf_status_t isf_rli_close(RLI_DEV_HANDLE *apRLIDeviceHandle)
This function closes the RLI connection.
Definition: isf_rli.c:93
void RLI_CHANNEL_HANDLE
Definition: isf_rli.h:13
RLI_CHANNEL_HANDLE * isf_rli_init(uint32 aChannelId)
This function initializes a register level interface.
Definition: isf_rli.c:20
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
isf_status_t isf_rli_write(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteWrite, uint8 *apWriteBuffer)
This function writes to the device registers.
Definition: isf_rli.c:64
isf_rli_error_types
This enumerates the error types returned by the RLI interface.
Definition: isf_rli.h:19
isf_status_t isf_rli_deint(RLI_CHANNEL_HANDLE *apRLIChannelHandle)
This function de-initialize the RLI channel.
Definition: isf_rli.c:106
long int32
This defines int32 as long.
Definition: isf_types.h:32
int32 isf_status_t
ISF return status type.
Definition: isf.h:51
void RLI_DEV_HANDLE
Definition: isf_rli.h:14
isf_status_t isf_rli_read(RLI_DEV_HANDLE *apRLIDeviceHandle, int32 startAddress, uint32 aNbyteRead, uint8 *apReadBuffer)
This function reads from the device registers.
Definition: isf_rli.c:79
RLI_DEV_HANDLE * isf_rli_open(RLI_CHANNEL_HANDLE *apRLIChannelHandle, void *apSlaveInfo)
This function creates a RLI connection handle at a specified device address.
Definition: isf_rli.c:43