| 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_sysconf_comms.c
Go to the documentation of this file.
1 /**
2 * @file isf_sysconf_comms.c
3 * @brief System Communications channel configuration
4 * @version 0.0
5 * @date 2012-08-01
6 *
7 * Copyright (c) 2012, Freescale, Inc.
8 */
9 #include <isf_user_config.h>
10 #include <isf_sysconf_types.h>
11 #include <isf_sysconf_comms.h>
12 #include "mutex.h"
13 /******************************************************************************
14 * I2C CHANNEL CONFIGURATION
15 ******************************************************************************/
16
17 #include "isf_i2c_master_types.h"
18 //I2C Bus configuration information
19 enum {
20 I2C_BUS_0 = 0,
21 I2C_NUM_BUS
22 };
23
24
25
26 const i2c_Master_BusConfig_t gSys_I2cBusConfig[] = {
27 {
28 .timeout = 1000,
29 .defaultSpeed = 400,
30 }
31 };
32
33 // Number of the I2C Buses of same type
34 const uint8 gSys_NumI2cBuses = I2C_NUM_BUS;
35 // Bus information structure for each bus, each field in the structure are updated dynamically, so no need to assign any value
36 i2c_Master_busHandle_t i2c_master_busHandle[I2C_NUM_BUS];
37 MUTEX_STRUCT i2c_Master_mutexHandler[I2C_NUM_BUS];
38
39
40 // Include the uart related configuration parameter.
41 /******************************************************************************
42 * UART configuration
43 ******************************************************************************/
44 #include "isf_uart_types.h"
45
46 //I2C Bus configuration information
47 enum {
48 UART_BUS_0 = 0,
49 UART_NUM_BUS
50 };
51
52 // i
53 const uart_BusConfig_t gSys_UartBusConfig[] = {
54 {
55 .timeout = 0,
56 .config.baudRate = 115200,
57 .config.parityMode = kUartParityDisabled,
58 .config.stopBitCount = kUartOneStopBit,
59 .config.bitCountPerChar = kUart8BitsPerChar,
60 }
61 };
62 // Number of the UART Buses of same type
63 const uint8 gSys_NumUARTBuses = UART_NUM_BUS;
64 uart_busHandle_t uart_busHandle[UART_NUM_BUS];
65 MUTEX_STRUCT uart_lock[UART_NUM_BUS];
66 MUTEX_STRUCT uart_rdlock[UART_NUM_BUS];
67
68
69
70
71
72
73 // Include the uart related configuration parameter.
74 /******************************************************************************
75 * SPI configuration
76 ******************************************************************************/
77 #include "isf_spi_master_types.h"
78
79 //I2C Bus configuration information
80 enum {
81 SPI_BUS_0 = 0,
82 SPI_NUM_BUS
83 };
84
85 // i
86 const spi_master_busConfig_t gSys_SpiMasterBusConfig[] = {
87 {
88 .timeout = 0,
89 .config.busFrequencyKHz = 500,
90 .config.polarity = kSpiClockPolarity_ActiveHigh,
91 .config.phase = kSpiClockPhase_FirstEdge,
92 .config.direction = kSpiMsbFirst,
93 }
94 };
95 // Number of the SPI Buses of same type
96 const uint8 gSys_NumSpiBuses = SPI_NUM_BUS;
97 spi_master_busHandle_t spi_master_busHandle[SPI_NUM_BUS];
98 MUTEX_STRUCT spi_master_lock[SPI_NUM_BUS];
99 MUTEX_STRUCT spi_master_rdlock[SPI_NUM_BUS];
100
101 /******************************************************************************
102 * CHANNELIST CONFIGURATION FOR THE SYSTEM
103 ******************************************************************************/
104
105 const sys_channelDescriptor_t gSys_ConfiguredChannelList[] = {
106 // COMM_CHANNEL_I2C_CH1 = 0,
107 {
108 .protocolType = PROTOCOL_TYPE_I2C,
109 .protocolInstanceId = I2C_BUS_0,
110 .pConfig = &gSys_I2cBusConfig[I2C_BUS_0]
111 },
112 // COMM_CHANNEL_UART_CH1 = 1,
113 {
114 .protocolType = PROTOCOL_TYPE_UART,
115 .protocolInstanceId = UART_BUS_0,
116 .pConfig = &gSys_UartBusConfig[UART_BUS_0]
117 },
118 // COMM_CHANNEL_SPI_CH1 = 2,
119 {
120 .protocolType = PROTOCOL_TYPE_SPI,
121 .protocolInstanceId = SPI_BUS_0,
122 .pConfig = &gSys_SpiMasterBusConfig[SPI_BUS_0]
123 },
124
125 };
126
127 // CI used UART by default now.
128 uint32 get_ci_comm(void)
129 {
130 return (uint32)(COMM_CHANNEL_UART_CH1);
131 }
132
133 const uint8 gSys_NumChannels = sizeof(gSys_ConfiguredChannelList)/sizeof(sys_channelDescriptor_t);
134
135
136
isf_i2c_master_types.h
isf_i2c_master_types.h defines the i2c master protocol adapter structure and types.
isf_sysconf_comms.h
This file defines the system configuration for the communication channel.
uint8
unsigned char uint8
This defines uint8 as unsigned char.
Definition: isf_types.h:18
kSpiClockPhase_FirstEdge
Definition: fsl_spi_hal.h:57
i2c_Master_BusHandle_struct
This structure defines the data bus handle.
Definition: isf_i2c_master_types.h:23
COMM_CHANNEL_UART_CH1
Definition: isf_sysconf_comms.h:31
gSys_NumUARTBuses
const uint8 gSys_NumUARTBuses
Definition: isf_sysconf_comms.c:63
uart_BusConfig_struct::timeout
isf_duration_t timeout
Definition: isf_uart_types.h:18
i2c_Master_BusConfig_struct::timeout
isf_duration_t timeout
Definition: isf_i2c_master_types.h:18
uart_BusHandle_struct
This structure defines the data bus handle.
Definition: isf_uart_types.h:23
spi_master_BusConfig_struct
Definition: isf_spi_master_types.h:17
isf_user_config.h
The isf_user_config.h file contains the user configurable settings to either include or exclude an IS...
gSys_NumChannels
const uint8 gSys_NumChannels
Definition: isf_sysconf_comms.c:133
uint32
unsigned long uint32
This defines uint32 as unsigned long.
Definition: isf_types.h:36
spi_master_rdlock
MUTEX_STRUCT spi_master_rdlock[SPI_NUM_BUS]
Definition: isf_sysconf_comms.c:99
uart_lock
MUTEX_STRUCT uart_lock[UART_NUM_BUS]
Definition: isf_sysconf_comms.c:65
PROTOCOL_TYPE_UART
Definition: isf_sysconf_types.h:25
kSpiClockPolarity_ActiveHigh
Definition: fsl_spi_hal.h:51
spi_master_lock
MUTEX_STRUCT spi_master_lock[SPI_NUM_BUS]
Definition: isf_sysconf_comms.c:98
kUartParityDisabled
Definition: fsl_uart_hal.h:62
kSpiMsbFirst
Definition: fsl_spi_hal.h:63
uart_busHandle
uart_busHandle_t uart_busHandle[UART_NUM_BUS]
Definition: isf_sysconf_comms.c:64
UART_BUS_0
Definition: isf_sysconf_comms.c:48
spi_master_busHandle
spi_master_busHandle_t spi_master_busHandle[SPI_NUM_BUS]
Definition: isf_sysconf_comms.c:97
sys_channelDescriptor_t::protocolType
sys_protocolType_t protocolType
Definition: isf_sysconf_types.h:35
SPI_BUS_0
Definition: isf_sysconf_comms.c:81
gSys_NumSpiBuses
const uint8 gSys_NumSpiBuses
Definition: isf_sysconf_comms.c:96
PROTOCOL_TYPE_I2C
Definition: isf_sysconf_types.h:24
UART_NUM_BUS
Definition: isf_sysconf_comms.c:49
PROTOCOL_TYPE_SPI
Definition: isf_sysconf_types.h:26
i2c_master_busHandle
i2c_Master_busHandle_t i2c_master_busHandle[I2C_NUM_BUS]
Definition: isf_sysconf_comms.c:36
gSys_SpiMasterBusConfig
const spi_master_busConfig_t gSys_SpiMasterBusConfig[]
Definition: isf_sysconf_comms.c:86
sys_channelDescriptor_t
This structure defines the channel descriptor.
Definition: isf_sysconf_types.h:33
gSys_ConfiguredChannelList
const sys_channelDescriptor_t gSys_ConfiguredChannelList[]
Definition: isf_sysconf_comms.c:105
isf_uart_types.h
isf_uart_types.h defines the uart protocol adapter structure and types.
gSys_UartBusConfig
const uart_BusConfig_t gSys_UartBusConfig[]
Definition: isf_sysconf_comms.c:53
gSys_NumI2cBuses
const uint8 gSys_NumI2cBuses
Definition: isf_sysconf_comms.c:34
uart_BusConfig_struct
Definition: isf_uart_types.h:17
uart_rdlock
MUTEX_STRUCT uart_rdlock[UART_NUM_BUS]
Definition: isf_sysconf_comms.c:66
isf_spi_master_types.h
isf_spi_master_types.h defines the spi protocol adapter structure and types.
gSys_I2cBusConfig
const i2c_Master_BusConfig_t gSys_I2cBusConfig[]
Definition: isf_sysconf_comms.c:26
i2c_Master_BusConfig_struct
Definition: isf_i2c_master_types.h:17
kUartOneStopBit
Definition: fsl_uart_hal.h:52
spi_master_BusConfig_struct::timeout
isf_duration_t timeout
Definition: isf_spi_master_types.h:18
I2C_BUS_0
Definition: isf_sysconf_comms.c:20
SPI_NUM_BUS
Definition: isf_sysconf_comms.c:82
kUart8BitsPerChar
Definition: fsl_uart_hal.h:75
spi_mater_BusHandle_struct
This structure defines the data bus handle.
Definition: isf_spi_master_types.h:23
I2C_NUM_BUS
Definition: isf_sysconf_comms.c:21
isf_sysconf_types.h
This file defines the configuration types and structures for the system communication channel...
i2c_Master_mutexHandler
MUTEX_STRUCT i2c_Master_mutexHandler[I2C_NUM_BUS]
Definition: isf_sysconf_comms.c:37
get_ci_comm
uint32 get_ci_comm(void)
Definition: isf_sysconf_comms.c:128
- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.