ISF  2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
isf_protocol_adapter.h
Go to the documentation of this file.
1 /*!
2 ********************************************************************************
3 * File: isf_protocol_adapter.h
4 *
5 * Copyright (c) 2015, Freescale Semiconductor, Inc.
6 *
7 *******************************************************************************/
8 /*!
9 * @file isf_protocol_adapter.h
10 * @brief \b isf_protocol_adapter.h defines the general interface definition for the protocol adapter.
11 */
12 #ifndef ISF_PROTOCOL_ADAPTER_H_
13 #define ISF_PROTOCOL_ADAPTER_H_
14 #include "isf_types.h"
15 #include "isf_comm.h"
16 /**
17  * @brief This is the function pointer signature for bus initialization.
18  */
19 typedef isf_status_t (*fnInit_t) (comm_Id_t aBusId, void *apBusHandle);
20 /**
21  * @brief This is the function pointer signature for getting the state of the bus.
22  */
23 typedef comm_State_t (*fnGetState_t) (void *apBusHandle);
24 /**
25  * @brief This is the function pointer signature for getting the configuration of the bus.
26  */
27 typedef isf_status_t (*fnGetConfig_t) (void *apBusHandle, void *apBusConfig);
28 /**
29  * @brief This is the function pointer signature for setting the configuration of the bus.
30  */
31 typedef isf_status_t (*fnConfigure_t) (void *apBusHandle, void *apBusConfig);
32 /**
33  * @brief This is the function pointer signature for starting the bus.
34  */
35 typedef isf_status_t (*fnStart_t) (void *apBusHandle);
36 /**
37  * @brief This is the function pointer signature for stopping the bus.
38  */
39 typedef isf_status_t (*fnStop_t) (void *apBusHandle, isf_duration_t aTimeout);
40 /**
41  * @brief This is the function pointer signature for getting the Endpoint handle.
42  */
43 typedef isf_status_t (*fnConnectToEndpoint_t) (void *apBusHandle, void *apDevice , void **apEndpointHandle);
44 /**
45  * @brief This is the function pointer signature for closing the Endpoint.
46  */
47 typedef isf_status_t (*fnDisconnectEndpoint_t) (void *apEndpointHandle);
48 
49 /**
50  * @brief This is the function pointer signature for acquiring the lock for a particular bus.
51  */
52 typedef isf_status_t (*fnAcquireLock_t)(void *apBusHandle, isf_duration_t aTimeout);
53 /**
54  * @brief This is the function pointer signature for releasing the lock for a particular bus.
55  */
56 typedef isf_status_t (*fnReleaseLock_t)(void *apBusHandle);
57 /**
58  * @brief This is the function pointer signature for reading the data from a specified device.
59  */
60 typedef isf_status_t (*fnRead_t) (void *apEndpointHandle, int32 offset, void *apReadBuffer, uint32 buffsize, uint32 nBytesRead, comm_Flags_t aFlags);
61 /**
62  * @brief This is the the function pointer signature for writing the data to a specified device.
63  */
64 typedef isf_status_t (*fnWrite_t) (void *apEndpointHandle, int32 offset, uint8* pWriteBuffer, uint32 buffsize, uint32 nBytesWrite, comm_Flags_t aFlags);
65 /**
66  * @brief This structure contains protocol-specific function pointers and properties.
67  */
68 typedef struct {
69  fnInit_t fnInit; /*!< Initialize a channel. */
70  fnGetState_t fnGetState; /*!< Get the state of a channel. */
71  fnGetConfig_t fnGetConfig; /*!< Get the current channel configuration. */
72  fnConfigure_t fnConfigure; /*!< Reconfigure an already initialized channel. */
73  fnStart_t fnStart; /*!< Start a channel. */
74  fnStop_t fnStop; /*!< Stop a channel. */
75  fnConnectToEndpoint_t fnGetEndPointAt; /*!< Get the handle to a slave device at a known address.*/
76  fnDisconnectEndpoint_t fnDisEndPoint; /*!< Get the handle to a slave device at a known address.*/
77  fnAcquireLock_t fnAcquireLock; /*!< Lock the channel for exclusive access. */
78  fnReleaseLock_t fnReleaseLock; /*!< Release exclusive access. */
79  fnRead_t fnRead; /*!< Read from a device. */
80  fnWrite_t fnWrite; /*!< Write to a device. */
81 } protocol_t;
82 
83 /*! @brief This structure is a declaration of a BusHandle type.
84  *
85  */
86 typedef struct busHandle_struct {
87  void *pHandle; /*!< Protocol specific BusHandle. */
88  uint8 nLock; /*!< The lock count associated with the bus. */
89  void *pLock; /*!< The pointer to the lock. */
90  uint8 nRdLock; /*!< The lock count associated with the Read. */
91  void *pRdLock; /*!< The pointer to the Read lock. */
92 } busHandle_t;
93 
94 #endif /* ISF_PROTOCOL_ADAPTER_H_ */
95 
96 
unsigned char uint8
Definition: isf_types.h:76
fnGetState_t fnGetState
isf_status_t(* fnInit_t)(comm_Id_t aBusId, void *apBusHandle)
This is the function pointer signature for bus initialization.
This structure contains protocol-specific function pointers and properties.
uint32 comm_Id_t
This type is for a numeric channel identifier- index into an array of channels in the system...
Definition: isf_comm.h:50
isf_status_t(* fnConfigure_t)(void *apBusHandle, void *apBusConfig)
This is the function pointer signature for setting the configuration of the bus.
comm_State_t(* fnGetState_t)(void *apBusHandle)
This is the function pointer signature for getting the state of the bus.
struct busHandle_struct busHandle_t
This structure is a declaration of a BusHandle type.
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
isf_status_t(* fnWrite_t)(void *apEndpointHandle, int32 offset, uint8 *pWriteBuffer, uint32 buffsize, uint32 nBytesWrite, comm_Flags_t aFlags)
This is the the function pointer signature for writing the data to a specified device.
This structure is a declaration of a BusHandle type.
fnGetConfig_t fnGetConfig
uint8 comm_Flags_t
This is a bit array of flags governing device read/write behavior.
Definition: isf_comm.h:59
isf_status_t(* fnConnectToEndpoint_t)(void *apBusHandle, void *apDevice, void **apEndpointHandle)
This is the function pointer signature for getting the Endpoint handle.
fnReleaseLock_t fnReleaseLock
uint32 isf_duration_t
ISF time duration in microseconds.
Definition: isf.h:84
signed long int int32
Definition: isf_types.h:74
fnConfigure_t fnConfigure
isf_status_t(* fnRead_t)(void *apEndpointHandle, int32 offset, void *apReadBuffer, uint32 buffsize, uint32 nBytesRead, comm_Flags_t aFlags)
This is the function pointer signature for reading the data from a specified device.
isf_status_t(* fnReleaseLock_t)(void *apBusHandle)
This is the function pointer signature for releasing the lock for a particular bus.
fnConnectToEndpoint_t fnGetEndPointAt
isf_status_t(* fnGetConfig_t)(void *apBusHandle, void *apBusConfig)
This is the function pointer signature for getting the configuration of the bus.
isf_status_t(* fnStop_t)(void *apBusHandle, isf_duration_t aTimeout)
This is the function pointer signature for stopping the bus.
isf_status_t(* fnDisconnectEndpoint_t)(void *apEndpointHandle)
This is the function pointer signature for closing the Endpoint.
fnDisconnectEndpoint_t fnDisEndPoint
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
isf_status_t(* fnAcquireLock_t)(void *apBusHandle, isf_duration_t aTimeout)
This is the function pointer signature for acquiring the lock for a particular bus.
isf_comm.h defines the common types for the Communications Service Family of the Intelligent Sensing ...
enum comm_State_vals comm_State_t
This enum holds an enumerated value describing the state of a channel.
Definition: isf_comm.h:53
isf_status_t(* fnStart_t)(void *apBusHandle)
This is the function pointer signature for starting the bus.
unsigned long int uint32
Definition: isf_types.h:78
fnAcquireLock_t fnAcquireLock