| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

isf_dm_protocol.c
Go to the documentation of this file.
1 /*
2 *
3 * Copyright (c) 2015, Freescale Semiconductor, Inc.
4 *
5 */
6 /*
7 * isf_dm_protocol.c
8 *
9 @file isf_dm_protocol.c
10 * @brief \b isf_dm_protocol.c defines the protocol tables and its types.
11 */
12 #include "isf_protocol_adapter.h"
13 #include <isf_sysconf_types.h>
14
15 #include "isf_i2c_master_adapter.h"
16 #include "isf_spi_master_adapter.h"
17 #include "isf_uart_adapter.h"
18
19
20 /**
21 * @brief Lookup table to find protocol-specific functions and properties.
22 * Indexed by ::sys_protocolType_t
23 *
24 * @details This table contains one entry for each type of supported protocol.
25 *
26 *
27 */
28 const protocol_t PROTOCOL[] = {
29 {
30 .fnInit = (fnInit_t) &i2c_master_adapter_init,
31 .fnGetState = (fnGetState_t) &i2c_master_adapter_get_state,
32 .fnGetConfig = (fnGetConfig_t) &i2c_master_adapter_get_config,
33 .fnConfigure = (fnConfigure_t) &i2c_master_adapter_configure,
34 .fnStart = (fnStart_t) &i2c_master_adapter_start,
35 .fnStop = (fnStop_t) &i2c_master_adapter_stop,
36 .fnGetEndPointAt = (fnConnectToEndpoint_t) &i2c_master_adapter_get_endpoint,
37 .fnDisEndPoint = (fnDisconnectEndpoint_t) &i2c_master_adapter_release_endpoint,
38 .fnAcquireLock = (fnAcquireLock_t) &i2c_master_adapter_acquire_lock,
39 .fnReleaseLock = (fnReleaseLock_t) &i2c_master_adapter_release_lock,
40 .fnRead = (fnRead_t) &i2c_master_adapter_read,
41 .fnWrite = (fnWrite_t) &i2c_master_adapter_write,
42 },
43 {
44 .fnInit = (fnInit_t) &spi_master_adapter_init,
45 .fnGetState = (fnGetState_t) &spi_master_adapter_get_state,
46 .fnGetConfig = (fnGetConfig_t) &spi_master_adapter_get_config,
47 .fnConfigure = (fnConfigure_t) &spi_master_adapter_configure,
48 .fnStart = (fnStart_t) &spi_master_adapter_start,
49 .fnStop = (fnStop_t) &spi_master_adapter_stop,
50 .fnGetEndPointAt = (fnConnectToEndpoint_t) &spi_master_adapter_get_endpoint,
51 .fnDisEndPoint = (fnDisconnectEndpoint_t) &spi_master_adapter_release_endpoint,
52 .fnAcquireLock = (fnAcquireLock_t) &spi_master_adapter_acquire_lock,
53 .fnReleaseLock = (fnReleaseLock_t) &spi_master_adapter_release_lock,
54 .fnRead = (fnRead_t) &spi_master_adapter_read,
55 .fnWrite = (fnWrite_t) &spi_master_adapter_write,
56 },
57 {
58 .fnInit = (fnInit_t) &uart_adapter_init,
59 .fnGetState = (fnGetState_t) &uart_adapter_get_state,
60 .fnGetConfig = (fnGetConfig_t) &uart_adapter_get_config,
61 .fnConfigure = (fnConfigure_t) &uart_adapter_configure,
62 .fnStart = (fnStart_t) &uart_adapter_start,
63 .fnStop = (fnStop_t) &uart_adapter_stop,
64 .fnGetEndPointAt = (fnConnectToEndpoint_t) &uart_adapter_get_endpoint,
65 .fnDisEndPoint = (fnDisconnectEndpoint_t) &uart_adapter_release_endpoint,
66 .fnAcquireLock = (fnAcquireLock_t) &uart_adapter_acquire_lock,
67 .fnReleaseLock = (fnReleaseLock_t) &uart_adapter_release_lock,
68 .fnRead = (fnRead_t) &uart_adapter_read,
69 .fnWrite = (fnWrite_t) &uart_adapter_write,
70 },
71 };
72
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:82
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
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:125
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:252
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:314
uart_adapter_configure
isf_status_t uart_adapter_configure(busHandle_t *apBusHandle, uart_user_config_t *apBusConfig)
This function reconfigures an already initialized bus.
Definition: isf_uart_adapter.c:75
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:110
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:268
protocol_t
This structure contains protocol-specific function pointers and properties.
Definition: isf_protocol_adapter.h:68
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:112
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:147
PROTOCOL
const protocol_t PROTOCOL[]
Lookup table to find protocol-specific functions and properties. Indexed by sys_protocolType_t.
Definition: isf_dm_protocol.c:28
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:225
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:185
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
uart_adapter_stop
isf_status_t uart_adapter_stop(busHandle_t *apBusHandle)
This function stops the given uart bus.
Definition: isf_uart_adapter.c:200
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:253
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
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:256
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:111
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:69
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:207
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:40
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:142
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:98
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:130
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:160
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:163
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:271
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_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:43
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:199
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:124
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:159
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
uart_adapter_start
isf_status_t uart_adapter_start(busHandle_t *apBusHandle)
This function starts a bus.
Definition: isf_uart_adapter.c:175
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
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
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:269
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:37
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
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
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
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
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:143
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:223
isf_uart_adapter.h
isf_uart_adapter.h defines the API definitions and types for the uart protocol adapter.
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
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:176
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:319
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:305
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.