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