| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
isf_dm_protocol.c
Go to the documentation of this file.
1 /*
2 * isf_dm_protocol.c
3 *
4 @file isf_dm_protocol.c
5 * @brief \b isf_dm_protocol.c defines the protocol tables and its types.
6 */
7 #include "isf_protocol_adapter.h"
8 #include <isf_sysconf_types.h>
9
10 #include "isf_i2c_master_adapter.h"
11 #include "isf_uart_adapter.h"
12 #include "isf_spi_master_adapter.h"
13
14
15 /**
16 * @brief Lookup table to find protocol-specific functions and properties.
17 * Indexed by ::sys_protocolType_t
18 *
19 * @details This table contains one entry for each type of supported protocol.
20 *
21 *
22 */
23 const protocol_t PROTOCOL[] = {
24 {
25 .fnInit = (fnInit_t) &i2c_master_adapter_init,
26 .fnGetState = (fnGetState_t) &i2c_master_adapter_get_state,
27 .fnGetConfig = (fnGetConfig_t) &i2c_master_adapter_get_config,
28 .fnConfigure = (fnConfigure_t) &i2c_master_adapter_configure,
29 .fnStart = (fnStart_t) &i2c_master_adapter_start,
30 .fnStop = (fnStop_t) &i2c_master_adapter_stop,
31 .fnGetEndPointAt = (fnConnectToEndpoint_t) &i2c_master_adapter_get_endpoint,
32 .fnDisEndPoint = (fnDisconnectEndpoint_t) &i2c_master_adapter_release_endpoint,
33 .fnAcquireLock = (fnAcquireLock_t) &i2c_master_adapter_acquire_lock,
34 .fnReleaseLock = (fnReleaseLock_t) &i2c_master_adapter_release_lock,
35 .fnRead = (fnRead_t) &i2c_master_adapter_read,
36 .fnWrite = (fnWrite_t) &i2c_master_adapter_write,
37 },
38 {
39 .fnInit = (fnInit_t) &uart_adapter_init,
40 .fnGetState = (fnGetState_t) &uart_adapter_get_state,
41 .fnGetConfig = (fnGetConfig_t) &uart_adapter_get_config,
42 .fnConfigure = (fnConfigure_t) &uart_adapter_configure,
43 .fnStart = (fnStart_t) &uart_adapter_start,
44 .fnStop = (fnStop_t) &uart_adapter_stop,
45 .fnGetEndPointAt = (fnConnectToEndpoint_t) &uart_adapter_get_endpoint,
46 .fnDisEndPoint = (fnDisconnectEndpoint_t) &uart_adapter_release_endpoint,
47 .fnAcquireLock = (fnAcquireLock_t) &uart_adapter_acquire_lock,
48 .fnReleaseLock = (fnReleaseLock_t) &uart_adapter_release_lock,
49 .fnRead = (fnRead_t) &uart_adapter_read,
50 .fnWrite = (fnWrite_t) &uart_adapter_write,
51 },
52 {
53 .fnInit = (fnInit_t) &spi_master_adapter_init,
54 .fnGetState = (fnGetState_t) &spi_master_adapter_get_state,
55 .fnGetConfig = (fnGetConfig_t) &spi_master_adapter_get_config,
56 .fnConfigure = (fnConfigure_t) &spi_master_adapter_configure,
57 .fnStart = (fnStart_t) &spi_master_adapter_start,
58 .fnStop = (fnStop_t) &spi_master_adapter_stop,
59 .fnGetEndPointAt = (fnConnectToEndpoint_t) &spi_master_adapter_get_endpoint,
60 .fnDisEndPoint = (fnDisconnectEndpoint_t) &spi_master_adapter_release_endpoint,
61 .fnAcquireLock = (fnAcquireLock_t) &spi_master_adapter_acquire_lock,
62 .fnReleaseLock = (fnReleaseLock_t) &spi_master_adapter_release_lock,
63 .fnRead = (fnRead_t) &spi_master_adapter_read,
64 .fnWrite = (fnWrite_t) &spi_master_adapter_write,
65 },
66 };
67
68
69
spi_master_adapter_configure
isf_status_t spi_master_adapter_configure(busHandle_t *apBusHandle, spi_master_busConfig_t *apBusConfig)
This function reconfigures an already initialized bus.
Definition: isf_spi_master_adapter.c:95
spi_master_adapter_get_config
isf_status_t spi_master_adapter_get_config(busHandle_t *apBusHandle, void *apBusConfig)
This function returns the current bus configuration.
Definition: isf_spi_master_adapter.c:138
i2c_master_adapter_release_endpoint
isf_status_t i2c_master_adapter_release_endpoint(i2c_Endpoint_t *apEndpoint)
This function closes a particular endpoint.
Definition: isf_i2c_master_adapter.c:262
spi_master_adapter_read
isf_status_t spi_master_adapter_read(void *apEndpointHandle, int32 offset, void *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead, spi_master_readFlags_t aFlags)
This function reads from a spi device.
Definition: isf_spi_master_adapter.c:328
fnWrite_t
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.
Definition: isf_protocol_adapter.h:64
uart_adapter_get_state
comm_State_t uart_adapter_get_state(busHandle_t *apBusHandle)
This function returns the current bus state.
Definition: isf_uart_adapter.c:127
uart_adapter_write
isf_status_t uart_adapter_write(void *apEndpointHandle, int32 offset, void *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite, uart_writeFlags_t aFlags)
This function writes to a uart device.
Definition: isf_uart_adapter.c:283
protocol_t
This structure contains protocol-specific function pointers and properties.
Definition: isf_protocol_adapter.h:68
uart_adapter_configure
isf_status_t uart_adapter_configure(busHandle_t *apBusHandle, uart_config_t *apBusConfig)
This function reconfigures an already initialized bus.
Definition: isf_uart_adapter.c:95
i2c_master_adapter_get_config
isf_status_t i2c_master_adapter_get_config(busHandle_t *apBusHandle, void *apBusConfig)
This function returns the current bus configuration.
Definition: isf_i2c_master_adapter.c:127
i2c_master_adapter_release_lock
isf_status_t i2c_master_adapter_release_lock(busHandle_t *apBusHandle)
This function releases exclusive bus access.
Definition: isf_i2c_master_adapter.c:162
PROTOCOL
const protocol_t PROTOCOL[]
Lookup table to find protocol-specific functions and properties. Indexed by sys_protocolType_t.
Definition: isf_dm_protocol.c:23
uart_adapter_get_endpoint
isf_status_t uart_adapter_get_endpoint(busHandle_t *apBusHandle, void *apDevice, void **apEndpointHandle)
This function creates a endpoint at a already initialized bus.
Definition: isf_uart_adapter.c:239
fnDisconnectEndpoint_t
isf_status_t(* fnDisconnectEndpoint_t)(void *apEndpointHandle)
This is the function pointer signature for closing the Endpoint.
Definition: isf_protocol_adapter.h:47
fnStart_t
isf_status_t(* fnStart_t)(void *apBusHandle)
This is the function pointer signature for starting the bus.
Definition: isf_protocol_adapter.h:35
fnConnectToEndpoint_t
isf_status_t(* fnConnectToEndpoint_t)(void *apBusHandle, void *apDevice, void **apEndpointHandle)
This is the function pointer signature for getting the Endpoint handle.
Definition: isf_protocol_adapter.h:43
isf_spi_master_adapter.h
isf_spi_master_adapter.h defines the API definitions and types for the spi master protocol adapter...
i2c_master_adapter_stop
isf_status_t i2c_master_adapter_stop(busHandle_t *apBusHandle)
This function stops the given i2c bus.
Definition: isf_i2c_master_adapter.c:199
uart_adapter_stop
isf_status_t uart_adapter_stop(busHandle_t *apBusHandle)
This function stops the given uart bus.
Definition: isf_uart_adapter.c:215
fnGetState_t
comm_State_t(* fnGetState_t)(void *apBusHandle)
This is the function pointer signature for getting the state of the bus.
Definition: isf_protocol_adapter.h:23
uart_adapter_release_endpoint
isf_status_t uart_adapter_release_endpoint(uart_Endpoint_t *apEndpoint)
This function closes a particular endpoint.
Definition: isf_uart_adapter.c:268
protocol_t::fnInit
fnInit_t fnInit
Definition: isf_protocol_adapter.h:69
spi_master_adapter_release_endpoint
isf_status_t spi_master_adapter_release_endpoint(spi_master_Endpoint_t *apEndpoint)
This function closes a particular endpoint.
Definition: isf_spi_master_adapter.c:267
spi_master_adapter_get_state
comm_State_t spi_master_adapter_get_state(busHandle_t *apBusHandle)
This function returns the current bus state.
Definition: isf_spi_master_adapter.c:124
i2c_master_adapter_configure
isf_status_t i2c_master_adapter_configure(busHandle_t *apBusHandle, void *apBusConfig)
This function reconfigures an already initialized bus.
Definition: isf_i2c_master_adapter.c:84
i2c_master_adapter_get_endpoint
isf_status_t i2c_master_adapter_get_endpoint(busHandle_t *apBusHandle, void *apDevice, void **apEndpointHandle)
This function creates a endpoint for a device at a specified bus address.
Definition: isf_i2c_master_adapter.c:220
spi_master_adapter_init
isf_status_t spi_master_adapter_init(comm_Id_t aBusId, busHandle_t *apBusHandle)
This function initializes a spi bus.
Definition: isf_spi_master_adapter.c:45
uart_adapter_acquire_lock
isf_status_t uart_adapter_acquire_lock(busHandle_t *apBusHandle, isf_duration_t aTimeout)
This function locks the bus for exclusive access.
Definition: isf_uart_adapter.c:159
i2c_master_adapter_get_state
comm_State_t i2c_master_adapter_get_state(busHandle_t *apBusHandle)
This function returns the current bus state.
Definition: isf_i2c_master_adapter.c:113
i2c_master_adapter_acquire_lock
isf_status_t i2c_master_adapter_acquire_lock(busHandle_t *apBusHandle, isf_duration_t aTimeout)
This function locks the bus for exclusive access.
Definition: isf_i2c_master_adapter.c:145
fnInit_t
isf_status_t(* fnInit_t)(comm_Id_t aBusId, void *apBusHandle)
This is the function pointer signature for bus initialization.
Definition: isf_protocol_adapter.h:19
fnStop_t
isf_status_t(* fnStop_t)(void *apBusHandle, isf_duration_t aTimeout)
This is the function pointer signature for stopping the bus.
Definition: isf_protocol_adapter.h:39
fnReleaseLock_t
isf_status_t(* fnReleaseLock_t)(void *apBusHandle)
This is the function pointer signature for releasing the lock for a particular bus.
Definition: isf_protocol_adapter.h:56
isf_protocol_adapter.h
isf_protocol_adapter.h defines the general interface definition for the protocol adapter.
spi_master_adapter_release_lock
isf_status_t spi_master_adapter_release_lock(busHandle_t *apBusHandle)
This function releases exclusive bus access.
Definition: isf_spi_master_adapter.c:173
i2c_master_adapter_start
isf_status_t i2c_master_adapter_start(busHandle_t *apBusHandle)
This function starts a bus.
Definition: isf_i2c_master_adapter.c:178
isf_i2c_master_adapter.h
isf_i2c_master_adapter.h defines the API definitions and types for the i2c master protocol adapter...
spi_master_adapter_write
isf_status_t spi_master_adapter_write(void *apEndpointHandle, int32 offset, void *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite, spi_master_writeFlags_t aFlags)
This function writes to a spi device.
Definition: isf_spi_master_adapter.c:282
uart_adapter_init
isf_status_t uart_adapter_init(comm_Id_t aBusId, busHandle_t *apBusHandle)
This function initializes a uart bus.
Definition: isf_uart_adapter.c:45
spi_master_adapter_stop
isf_status_t spi_master_adapter_stop(busHandle_t *apBusHandle)
This function stops the given spi bus.
Definition: isf_spi_master_adapter.c:211
uart_adapter_get_config
isf_status_t uart_adapter_get_config(busHandle_t *apBusHandle, void *apBusConfig)
This function returns the current bus configuration.
Definition: isf_uart_adapter.c:141
uart_adapter_release_lock
isf_status_t uart_adapter_release_lock(busHandle_t *apBusHandle)
This function releases exclusive bus access.
Definition: isf_uart_adapter.c:176
uart_adapter_start
isf_status_t uart_adapter_start(busHandle_t *apBusHandle)
This function starts a bus.
Definition: isf_uart_adapter.c:192
i2c_master_adapter_write
isf_status_t i2c_master_adapter_write(void *apEndpointHandle, int32 offset, void *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite, i2c_writeFlags_t aFlags)
This function writes to a i2c device.
Definition: isf_i2c_master_adapter.c:277
fnConfigure_t
isf_status_t(* fnConfigure_t)(void *apBusHandle, void *apBusConfig)
This is the function pointer signature for setting the configuration of the bus.
Definition: isf_protocol_adapter.h:31
i2c_master_adapter_init
isf_status_t i2c_master_adapter_init(comm_Id_t aBusId, busHandle_t *apBusHandle)
This function initializes a i2c bus.
Definition: isf_i2c_master_adapter.c:43
fnRead_t
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.
Definition: isf_protocol_adapter.h:60
spi_master_adapter_acquire_lock
isf_status_t spi_master_adapter_acquire_lock(busHandle_t *apBusHandle, isf_duration_t aTimeout)
This function locks the bus for exclusive access.
Definition: isf_spi_master_adapter.c:156
spi_master_adapter_get_endpoint
isf_status_t spi_master_adapter_get_endpoint(busHandle_t *apBusHandle, void *apDevice, void **apEndpointHandle)
This function creates a endpoint for a device at a specified bus address.
Definition: isf_spi_master_adapter.c:235
isf_uart_adapter.h
isf_uart_adapter.h defines the API definitions and types for the uart protocol adapter.
spi_master_adapter_start
isf_status_t spi_master_adapter_start(busHandle_t *apBusHandle)
This function starts a bus.
Definition: isf_spi_master_adapter.c:189
uart_adapter_read
isf_status_t uart_adapter_read(void *apEndpointHandle, int32 offset, void *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead, uart_readFlags_t aFlags)
This function reads from a uart device.
Definition: isf_uart_adapter.c:322
isf_sysconf_types.h
This file defines the configuration types and structures for the system communication channel...
i2c_master_adapter_read
isf_status_t i2c_master_adapter_read(void *apEndpointHandle, int32 offset, void *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead, i2c_readFlags_t aFlags)
This function reads from a i2c device.
Definition: isf_i2c_master_adapter.c:312
fnAcquireLock_t
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.
Definition: isf_protocol_adapter.h:52
fnGetConfig_t
isf_status_t(* fnGetConfig_t)(void *apBusHandle, void *apBusConfig)
This is the function pointer signature for getting the configuration of the bus.
Definition: isf_protocol_adapter.h:27
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.