S32 SDK
trgmux_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #ifndef TRGMUX_DRIVER_H
20 #define TRGMUX_DRIVER_H
21 
44 #include <stdint.h>
45 #include <stdbool.h>
46 #include "status.h"
47 #include "device_registers.h"
48 
54 /*******************************************************************************
55  * Variables
56  ******************************************************************************/
57 
58 /*******************************************************************************
59  * Definitions
60  ******************************************************************************/
68 typedef enum
69 {
125 #if FEATURE_TRGMUX_HAS_EXTENDED_NUM_TRIGS
126  TRGMUX_TRIG_SOURCE_LPI2C1_MASTER_TRIG = 0x43U,
127  TRGMUX_TRIG_SOURCE_LPI2C1_SLAVE_TRIG = 0x44U,
128  TRGMUX_TRIG_SOURCE_FTM4_INIT_TRIG = 0x45U,
129  TRGMUX_TRIG_SOURCE_FTM4_EXT_TRIG = 0x46U,
130  TRGMUX_TRIG_SOURCE_FTM5_INIT_TRIG = 0x47U,
131  TRGMUX_TRIG_SOURCE_FTM5_EXT_TRIG = 0x48U,
132  TRGMUX_TRIG_SOURCE_FTM6_INIT_TRIG = 0x49U,
133  TRGMUX_TRIG_SOURCE_FTM6_EXT_TRIG = 0x4AU,
134  TRGMUX_TRIG_SOURCE_FTM7_INIT_TRIG = 0x4BU,
135  TRGMUX_TRIG_SOURCE_FTM7_EXT_TRIG = 0x4CU
136 #endif /* FEATURE_TRGMUX_HAS_EXTENDED_NUM_TRIGS */
138 
145 typedef enum
146 {
200 #if FEATURE_TRGMUX_HAS_EXTENDED_NUM_TRIGS
201  TRGMUX_TARGET_MODULE_LPI2C1_TRG = 108U,
202  TRGMUX_TARGET_MODULE_FTM4_HWTRIG0 = 112U,
203  TRGMUX_TARGET_MODULE_FTM5_HWTRIG0 = 116U,
204  TRGMUX_TARGET_MODULE_FTM6_HWTRIG0 = 120U,
205  TRGMUX_TARGET_MODULE_FTM7_HWTRIG0 = 124U
206 #endif /* FEATURE_TRGMUX_HAS_EXTENDED_NUM_TRIGS */
208 
217 typedef struct
218 {
224 
233 typedef struct
234 {
238 
239 /*******************************************************************************
240  * API
241  ******************************************************************************/
242 
243 #if defined(__cplusplus)
244 extern "C" {
245 #endif
246 
247 
276 status_t TRGMUX_DRV_Init(const uint32_t instance,
277  const trgmux_user_config_t * const trgmuxUserConfig);
278 
288 status_t TRGMUX_DRV_Deinit(const uint32_t instance);
289 
302 status_t TRGMUX_DRV_SetTrigSourceForTargetModule(const uint32_t instance,
303  const trgmux_trigger_source_t triggerSource,
304  const trgmux_target_module_t targetModule);
305 
317  const trgmux_target_module_t targetModule);
318 
331 void TRGMUX_DRV_SetLockForTargetModule(const uint32_t instance,
332  const trgmux_target_module_t targetModule);
333 
345 bool TRGMUX_DRV_GetLockForTargetModule(const uint32_t instance,
346  const trgmux_target_module_t targetModule);
347 
348 #if defined(__cplusplus)
349 }
350 #endif
351 
354 #endif /* TRGMUX_DRIVER_H */
355 /*******************************************************************************
356  * EOF
357  ******************************************************************************/
trgmux_trigger_source_t
Describes all possible inputs (trigger sources) of the TRGMUX IP Note: entries in this enum are aff...
Definition: trgmux_driver.h:68
trgmux_trigger_source_t TRGMUX_DRV_GetTrigSourceForTargetModule(const uint32_t instance, const trgmux_target_module_t targetModule)
Get the source trigger configured for a target module.
User configuration structure for the TRGMUX driver.
status_t TRGMUX_DRV_SetTrigSourceForTargetModule(const uint32_t instance, const trgmux_trigger_source_t triggerSource, const trgmux_target_module_t targetModule)
Configure a source trigger for a selected target module.
status_t TRGMUX_DRV_Deinit(const uint32_t instance)
Reset to default values the source triggers corresponding to all target modules, if none of the targe...
bool TRGMUX_DRV_GetLockForTargetModule(const uint32_t instance, const trgmux_target_module_t targetModule)
Get the Lock bit status of the TRGMUX register of a target module.
const trgmux_inout_mapping_config_t * inOutMappingConfig
uint8_t numInOutMappingConfigs
Configuration structure for pairing source triggers with target modules.
trgmux_trigger_source_t triggerSource
trgmux_target_module_t
Describes all possible outputs (target modules) of the TRGMUX IP Note: entries in this enum are aff...
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
status_t TRGMUX_DRV_Init(const uint32_t instance, const trgmux_user_config_t *const trgmuxUserConfig)
Initialize a TRGMUX instance for operation.
Definition: trgmux_driver.c:75
trgmux_target_module_t targetModule
void TRGMUX_DRV_SetLockForTargetModule(const uint32_t instance, const trgmux_target_module_t targetModule)
Locks the TRGMUX register of a target module.