iLLD_TC27xD
1.0
IfxPort.h
Go to the documentation of this file.
1
/**
2
* \file IfxPort.h
3
* \brief PORT basic functionality
4
* \ingroup IfxLld_Port
5
*
6
* \version iLLD_1_0_0_11_0
7
* \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8
*
9
*
10
* IMPORTANT NOTICE
11
*
12
*
13
* Infineon Technologies AG (Infineon) is supplying this file for use
14
* exclusively with Infineon's microcontroller products. This file can be freely
15
* distributed within development tools that are supporting such microcontroller
16
* products.
17
*
18
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21
* INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22
* OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23
*
24
*
25
*
26
* \defgroup IfxLld_Port_Std_Enum Enumerations
27
* \ingroup IfxLld_Port_Std
28
* \defgroup IfxLld_Port_Std_DataStructures Data structures
29
* \ingroup IfxLld_Port_Std
30
* \defgroup IfxLld_Port_Std_SinglePin Single Pin Functions
31
* \ingroup IfxLld_Port_Std
32
* \defgroup IfxLld_Port_Std_PortGroup Group Access Functions
33
* \ingroup IfxLld_Port_Std
34
*/
35
36
#ifndef IFXPORT_H
37
#define IFXPORT_H 1
38
39
/******************************************************************************/
40
/*----------------------------------Includes----------------------------------*/
41
/******************************************************************************/
42
43
#include "
_Impl/IfxPort_cfg.h
"
44
#include "
Scu/Std/IfxScuWdt.h
"
45
46
/******************************************************************************/
47
/*--------------------------------Enumerations--------------------------------*/
48
/******************************************************************************/
49
50
/** \addtogroup IfxLld_Port_Std_Enum
51
* \{ */
52
/** \brief The LVDS RX_DIS control function can be selected from the Port (default) or
53
* HSCT module.declared in MODULE_PORTx.LPCRx
54
*/
55
typedef
enum
56
{
57
IfxPort_ControlledBy_port
= 0,
/**< \brief port controlled by PORT Module */
58
IfxPort_ControlledBy_hsct
= 1
/**< \brief Port controlled by HSCT Module */
59
}
IfxPort_ControlledBy
;
60
61
/** \brief Ifx_P output modification modes definition.
62
*/
63
typedef
enum
64
{
65
IfxPort_InputMode_undefined
= -1,
66
IfxPort_InputMode_noPullDevice
= 0 << 3,
67
IfxPort_InputMode_pullDown
= 1U << 3,
68
IfxPort_InputMode_pullUp
= 2U << 3
/**< \brief */
69
}
IfxPort_InputMode
;
70
71
/** \brief Ifx_P input / output mode definition.
72
*
73
* \see Ifx_P.IOCR, IfxPort_setPinMode()
74
*/
75
typedef
enum
76
{
77
IfxPort_Mode_inputNoPullDevice
= 0,
/**< \brief Input, No pull device connected. */
78
IfxPort_Mode_inputPullDown
= 8U,
/**< \brief Input, pull-down device connected. */
79
IfxPort_Mode_inputPullUp
= 0x10U,
/**< \brief Input, pull-up device connected. */
80
IfxPort_Mode_outputPushPullGeneral
= 0x80U,
/**< \brief Push-pull, General-purpose output */
81
IfxPort_Mode_outputPushPullAlt1
= 0x88U,
/**< \brief Push-pull, Alternate output function 1. */
82
IfxPort_Mode_outputPushPullAlt2
= 0x90U,
/**< \brief Push-pull, Alternate output function 2. */
83
IfxPort_Mode_outputPushPullAlt3
= 0x98U,
/**< \brief Push-pull, Alternate output function 3. */
84
IfxPort_Mode_outputPushPullAlt4
= 0xA0U,
/**< \brief Push-pull, Alternate output function 4. */
85
IfxPort_Mode_outputPushPullAlt5
= 0xA8U,
/**< \brief Push-pull, Alternate output function 5. */
86
IfxPort_Mode_outputPushPullAlt6
= 0xB0U,
/**< \brief Push-pull, Alternate output function 6. */
87
IfxPort_Mode_outputPushPullAlt7
= 0xB8U,
/**< \brief Push-pull, Alternate output function 7. */
88
IfxPort_Mode_outputOpenDrainGeneral
= 0xC0U,
/**< \brief Open-drain, General-purpose output. */
89
IfxPort_Mode_outputOpenDrainAlt1
= 0xC8U,
/**< \brief Open-drain, Alternate output function 1. */
90
IfxPort_Mode_outputOpenDrainAlt2
= 0xD0U,
/**< \brief Open-drain, Alternate output function 2. */
91
IfxPort_Mode_outputOpenDrainAlt3
= 0xD8U,
/**< \brief Open-drain, Alternate output function 3. */
92
IfxPort_Mode_outputOpenDrainAlt4
= 0xE0U,
/**< \brief Open-drain, Alternate output function 4. */
93
IfxPort_Mode_outputOpenDrainAlt5
= 0xE8U,
/**< \brief Open-drain, Alternate output function 5. */
94
IfxPort_Mode_outputOpenDrainAlt6
= 0xF0U,
/**< \brief Open-drain, Alternate output function 6. */
95
IfxPort_Mode_outputOpenDrainAlt7
= 0xF8U
/**< \brief Open-drain, Alternate output function 7. */
96
}
IfxPort_Mode
;
97
98
/** \brief Pin output alternate index
99
*/
100
typedef
enum
101
{
102
IfxPort_OutputIdx_general
= 0x10U << 3,
103
IfxPort_OutputIdx_alt1
= 0x11U << 3,
104
IfxPort_OutputIdx_alt2
= 0x12U << 3,
105
IfxPort_OutputIdx_alt3
= 0x13U << 3,
106
IfxPort_OutputIdx_alt4
= 0x14U << 3,
107
IfxPort_OutputIdx_alt5
= 0x15U << 3,
108
IfxPort_OutputIdx_alt6
= 0x16U << 3,
109
IfxPort_OutputIdx_alt7
= 0x17U << 3
110
}
IfxPort_OutputIdx
;
111
112
/** \brief Pin output mode definition
113
*/
114
typedef
enum
115
{
116
IfxPort_OutputMode_pushPull
= 0x10U << 3,
117
IfxPort_OutputMode_openDrain
= 0x18U << 3
118
}
IfxPort_OutputMode
;
119
120
/** \brief Pad driver mode definition (strength and slew rate).
121
*
122
* \see Ifx_P.PDR, IfxPort_setPinPadDriver()
123
*/
124
typedef
enum
125
{
126
IfxPort_PadDriver_cmosAutomotiveSpeed1
= 0,
/**< \brief Speed grade 1. */
127
IfxPort_PadDriver_cmosAutomotiveSpeed2
= 1,
/**< \brief Speed grade 2. */
128
IfxPort_PadDriver_cmosAutomotiveSpeed3
= 2,
/**< \brief Speed grade 3. */
129
IfxPort_PadDriver_cmosAutomotiveSpeed4
= 3,
/**< \brief Speed grade 4. */
130
IfxPort_PadDriver_lvdsSpeed1
= 4,
/**< \brief Lvds Speed grade 1 */
131
IfxPort_PadDriver_lvdsSpeed2
= 5,
/**< \brief Lvds Speed grade 2 */
132
IfxPort_PadDriver_lvdsSpeed3
= 6,
/**< \brief Lvds Speed grade 3 */
133
IfxPort_PadDriver_lvdsSpeed4
= 7,
/**< \brief Lvds Speed grade 4 */
134
IfxPort_PadDriver_ttlSpeed1
= 8,
/**< \brief Speed grade 1. */
135
IfxPort_PadDriver_ttlSpeed2
= 9,
/**< \brief Speed grade 2. */
136
IfxPort_PadDriver_ttlSpeed3
= 10,
/**< \brief Speed grade 3. */
137
IfxPort_PadDriver_ttlSpeed4
= 11
/**< \brief Speed grade 4. */
138
}
IfxPort_PadDriver
;
139
140
/** \brief MODULE_PORTx.LPCRx.B.PS1.Selects between 5v and 3.3v on Vext supply for the LVDSM pair
141
*/
142
typedef
enum
143
{
144
IfxPort_PadSupply_5v
= 0,
/**< \brief select, 5V supply */
145
IfxPort_PadSupply_3v
= 1
/**< \brief select, 3V supply */
146
}
IfxPort_PadSupply
;
147
148
/** \brief Ifx_P output modification modes definition.
149
*
150
* \see Ifx_P.OMR, IfxPort_setPinState()
151
*/
152
typedef
enum
153
{
154
IfxPort_State_notChanged
= (0 << 16) | (0 << 0),
/**< \brief Ifx_P pin is left unchanged. */
155
IfxPort_State_high
= (0 << 16) | (1U << 0),
/**< \brief Ifx_P pin is set to high. */
156
IfxPort_State_low
= (1U << 16) | (0 << 0),
/**< \brief Ifx_P pin is set to low. */
157
IfxPort_State_toggled
= (1U << 16) | (1U << 0)
/**< \brief Ifx_P pin is toggled. */
158
}
IfxPort_State
;
159
160
/** \} */
161
162
/******************************************************************************/
163
/*-----------------------------Data Structures--------------------------------*/
164
/******************************************************************************/
165
166
/** \addtogroup IfxLld_Port_Std_DataStructures
167
* \{ */
168
/** \brief Defines a pin
169
*/
170
typedef
struct
171
{
172
Ifx_P *
port
;
173
uint8
pinIndex
;
174
}
IfxPort_Pin
;
175
176
/** \brief To configure pins
177
*/
178
typedef
struct
179
{
180
Ifx_P *
port
;
181
uint8
pinIndex
;
182
IfxPort_OutputIdx
mode
;
183
IfxPort_PadDriver
padDriver
;
184
}
IfxPort_Pin_Config
;
185
186
/** \} */
187
188
/** \addtogroup IfxLld_Port_Std_SinglePin
189
* \{ */
190
191
/******************************************************************************/
192
/*-------------------------Inline Function Prototypes-------------------------*/
193
/******************************************************************************/
194
195
/** \brief Return the port state.
196
* \param port Pointer to the port which should be accessed.
197
* \param pinIndex Specifies the pin for which the state should be returned.
198
* \return Returns TRUE the pin is high; FALSE the pin is low
199
*
200
* Coding example:
201
* \code
202
* if( IfxPort_getPinState(&MODULE_P33, 0) ) {
203
* // ...
204
* }
205
* \endcode
206
*
207
*/
208
IFX_INLINE
boolean
IfxPort_getPinState
(Ifx_P *port,
uint8
pinIndex);
209
210
/** \brief Set the port output.
211
* \param port Pointer to the port which should be accessed.
212
* \param pinIndex Specifies the pin to be set.
213
* \return None
214
*
215
* Coding example:
216
* \code
217
* IfxPort_setPinHigh(&MODULE_P33, 0);
218
* \endcode
219
*
220
* \see IfxPort_setPinState(), IfxPort_setPinLow(), IfxPort_togglePin()
221
*
222
*/
223
IFX_INLINE
void
IfxPort_setPinHigh
(Ifx_P *port,
uint8
pinIndex);
224
225
/** \brief Reset the port output.
226
* \param port Pointer to the port which should be accessed.
227
* \param pinIndex Specifies the pin to be reset.
228
* \return None
229
*
230
* Coding example:
231
* \code
232
* IfxPort_setPinLow(&MODULE_P33, 0);
233
* \endcode
234
*
235
* \see IfxPort_setPinState(), IfxPort_setPinHigh(), IfxPort_togglePin()
236
*
237
*/
238
IFX_INLINE
void
IfxPort_setPinLow
(Ifx_P *port,
uint8
pinIndex);
239
240
/** \brief Configure the port input / output mode.
241
* \param port Pointer to the port which should be accessed.
242
* \param pinIndex Specifies the pin to be configured.
243
* \param mode Specifies the port pin mode.
244
* \return None
245
*
246
* Coding example:
247
* \code
248
* IfxPort_setPinModeInput(&MODULE_P33, 0, IfxPort_InputMode_pullUp);
249
* \endcode
250
*
251
*/
252
IFX_INLINE
void
IfxPort_setPinModeInput
(Ifx_P *port,
uint8
pinIndex,
IfxPort_InputMode
mode);
253
254
/** \brief Configure the port input / output mode.
255
* \param port Pointer to the port which should be accessed.
256
* \param pinIndex Specifies the pin to be configured.
257
* \param mode Specifies the port pin mode.
258
* \param index Specifies the alternate (or general purpose) output channel.
259
* \return None
260
*
261
* Coding example:
262
* \code
263
* IfxPort_setPinModeOutput(&MODULE_P33, 0, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
264
* \endcode
265
*
266
*/
267
IFX_INLINE
void
IfxPort_setPinModeOutput
(Ifx_P *port,
uint8
pinIndex,
IfxPort_OutputMode
mode,
IfxPort_OutputIdx
index);
268
269
/** \brief Set / Resets / Toggle the port output.
270
* \param port Pointer to the port which should be accessed.
271
* \param pinIndex Specifies the pin to modify.
272
* \param action Specifies the action: set, reset, toggle.
273
* \return None
274
*
275
* Coding example:
276
* \code
277
* IfxPort_setPinState(&MODULE_P33, 0, IfxPort_State_toggled);
278
* IfxPort_setPinState(&MODULE_P33, 0, IfxPort_State_toggled);
279
* IfxPort_setPinState(&MODULE_P33, 0, IfxPort_State_toggled);
280
* \endcode
281
*
282
*/
283
IFX_INLINE
void
IfxPort_setPinState
(Ifx_P *port,
uint8
pinIndex,
IfxPort_State
action);
284
285
/** \brief Toggle the port output.
286
* \param port Pointer to the port which should be accessed.
287
* \param pinIndex Specifies the pin to be toggled.
288
* \return None
289
*
290
* Coding example:
291
* \code
292
* IfxPort_togglePin(&MODULE_P33, 0);
293
* \endcode
294
*
295
* \see IfxPort_setPinState(), IfxPort_setPinLow(), IfxPort_setPinHigh()
296
*
297
*/
298
IFX_INLINE
void
IfxPort_togglePin
(Ifx_P *port,
uint8
pinIndex);
299
300
/******************************************************************************/
301
/*-------------------------Global Function Prototypes-------------------------*/
302
/******************************************************************************/
303
304
/** \brief Disable the emergency stop function.
305
* This function disables the emergency stop function. A check is done on port functionality.
306
* \param port Pointer to the port which should be accessed.
307
* \param pinIndex Specifies the pin for which the emergency stop function should be disabled.
308
* \return Returns TRUE if the emergency stop function has been disabled; FALSE if the emergency stop function could not be disabled
309
*
310
* Coding example:
311
* /code
312
* if( !IfxPort_disableEmergencyStop(&MODULE_P33, 0) )
313
* {
314
* // failed to disable emergency stop for P33.0
315
* }
316
* /endcode
317
*
318
* \see IfxPort_disableEmergencyStop(), IfxPort_resetESR()
319
*
320
*/
321
IFX_EXTERN
boolean
IfxPort_disableEmergencyStop
(Ifx_P *port,
uint8
pinIndex);
322
323
/** \brief Enable the emergency stop function.
324
* This function enables the emergency stop function. A check is done on port functionality.
325
* \param port Pointer to the port which should be accessed.
326
* \param pinIndex Specifies the pin for which the emergency stop function should be enabled.
327
* \return Returns TRUE if the emergency stop function has been enabled; FALSE if the emergency stop function could not be enabled
328
*
329
* Coding example:
330
* \code
331
* if( !IfxPort_enableEmergencyStop(&MODULE_P33, 0) ) {
332
* // failed to enable emergency stop for P33.0
333
* }
334
* \endcode
335
*
336
* \see IfxPort_disableEmergencyStop(), IfxPort_setESR()
337
*
338
*/
339
IFX_EXTERN
boolean
IfxPort_enableEmergencyStop
(Ifx_P *port,
uint8
pinIndex);
340
341
/** \brief Configure the port input / output mode.
342
* Also Configures the P40/P41 Port for digital functionality
343
* which bydefault support analog functionality.
344
* \param port Pointer to the port which should be accessed.
345
* \param pinIndex Specifies the pin to be configured.
346
* \param mode Specifies the port pin mode.
347
* \return None
348
*
349
* Coding example:
350
* \code
351
* IfxPort_setPinMode(&MODULE_P33, 0, IfxPort_Mode_outputPushPullGeneral);
352
* \endcode
353
*
354
*/
355
IFX_EXTERN
void
IfxPort_setPinMode
(Ifx_P *port,
uint8
pinIndex,
IfxPort_Mode
mode);
356
357
/** \brief Configure the pad driver mode.
358
* \param port Pointer to the port which should be accessed.
359
* \param pinIndex Specifies the pin for which the mode will be set.
360
* \param padDriver Specifies the driver mode.
361
* \return None
362
*
363
* Coding example:
364
* \code
365
* // enable strong 3.3V driver
366
* IfxPort_setPinPadDriver(&MODULE_P33, 0, IfxPort_PadDriver_cmosAutomotiveSpeed1);
367
* \endcode
368
*
369
*/
370
IFX_EXTERN
void
IfxPort_setPinPadDriver
(Ifx_P *port,
uint8
pinIndex,
IfxPort_PadDriver
padDriver);
371
372
/** \} */
373
374
/** \addtogroup IfxLld_Port_Std_PortGroup
375
* \{ */
376
377
/******************************************************************************/
378
/*-------------------------Inline Function Prototypes-------------------------*/
379
/******************************************************************************/
380
381
/** \brief Return the port group state
382
* \param port Pointer to the port which should be accessed.
383
* \param pinIndex start at the given pin
384
* \param mask selects the pins which should be read (starting from pinIndex)
385
* \return Returns the selected pin values
386
*
387
* Coding example:
388
* \code
389
* // read the current value of P33[7:0]
390
* uint16 value = IfxPort_getGroupState(&MODULE_P33, 0, 0xff);
391
* \endcode
392
*
393
*/
394
IFX_INLINE
uint32
IfxPort_getGroupState
(Ifx_P *port,
uint8
pinIndex,
uint16
mask);
395
396
/** \brief Set the port group state.
397
* \param port Pointer to the port which should be accessed.
398
* \param pinIndex start at the given pin
399
* \param mask selects the pins which should be modified (starting from pinIndex)
400
* \param data specifies the value which should be set
401
* \return None
402
*
403
* Coding example:
404
* \code
405
* // configure P33.[7:0] as GPIO outputs
406
* IfxPort_setGroupModeOutput(&MODULE_P33, 0, 0xff, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
407
*
408
* // set initial value
409
* IfxPort_setGroupState(&MODULE_P33, 0, 0xff, 0x42);
410
* \endcode
411
*
412
*/
413
IFX_INLINE
void
IfxPort_setGroupState
(Ifx_P *port,
uint8
pinIndex,
uint16
mask,
uint16
data);
414
415
/******************************************************************************/
416
/*-------------------------Global Function Prototypes-------------------------*/
417
/******************************************************************************/
418
419
/** \brief Return port index within IfxModule_IndexMap (defined in IfxPort_cfg.c)
420
* \param port Pointer to the port for which the index number in IfxModule_IndexMap should be retrieved.
421
* \return port index of IfxModule_IndexMap. return -1 in case of unknown portIndex.
422
*/
423
IFX_EXTERN
sint32
IfxPort_getIndex
(Ifx_P *port);
424
425
/** \brief Set pin modes to input at the pin location specified by '1' by the mask
426
* \param port Pointer to the port which should be accessed.
427
* \param pinIndex start at the given pin
428
* \param mask selects the pins which should be modified (starting from pinIndex)
429
* \param mode Specifies the port pin mode.
430
* \return None
431
*
432
* Coding example:
433
* \code
434
* // configure P33.[7:0] as GPIO inputs with Pull-Down enabled
435
* IfxPort_setGroupModeInput(&MODULE_P33, 0, 0xff, IfxPort_InputMode_pullDown);
436
* \endcode
437
*
438
*/
439
IFX_EXTERN
void
IfxPort_setGroupModeInput
(Ifx_P *port,
uint8
pinIndex,
uint16
mask,
IfxPort_InputMode
mode);
440
441
/** \brief Set pin modes to output at the pin location specified by '1' by the mask starting at pinIndex
442
* \param port Pointer to the port which should be accessed.
443
* \param pinIndex start at the given pin
444
* \param mask selects the pins which should be modified (starting from pinIndex)
445
* \param mode Specifies the port pin mode.
446
* \param index Specifies the alternate (or general purpose) output channel.
447
* \return None
448
*
449
* Coding example:
450
* \code
451
* // configure P33.[7:0] as GPIO outputs
452
* IfxPort_setGroupModeOutput(&MODULE_P33, 0, 0xff, IfxPort_OutputMode_pushPull, IfxPort_OutputIdx_general);
453
* \endcode
454
*
455
*/
456
IFX_EXTERN
void
IfxPort_setGroupModeOutput
(Ifx_P *port,
uint8
pinIndex,
uint16
mask,
IfxPort_OutputMode
mode,
IfxPort_OutputIdx
index);
457
458
/** \brief Set pad driver strength at the pin location specified by '1' by the mask
459
* \param port Pointer to the port which should be accessed.
460
* \param pinIndex start at the given pin
461
* \param mask selects the pins which should be modified (starting from pinIndex)
462
* \param padDriver Specifies the pad driver strength.
463
* \return None
464
*
465
* Coding example:
466
* \code
467
* // configure P33.[7:0] to use CMOS pad driver with speed 1
468
* IfxPort_setGroupPadDriver(&MODULE_P33, 0, 0xff, IfxPort_PadDriver_cmosAutomotiveSpeed1);
469
* \endcode
470
*
471
*/
472
IFX_EXTERN
void
IfxPort_setGroupPadDriver
(Ifx_P *port,
uint8
pinIndex,
uint16
mask,
IfxPort_PadDriver
padDriver);
473
474
/** \brief set LVDSM mode
475
* \param port Pointer to the port which should be accessed.
476
* \param pinIndex specifies pin to be modified
477
* \param lvdsPadDriver select speed grade of LVDS Pad
478
* \param padSupply select the PAD supply (5/3.3V)
479
* \return None
480
*/
481
IFX_EXTERN
void
IfxPort_setPinModeLvdsMedium
(Ifx_P *port,
uint8
pinIndex,
IfxPort_PadDriver
lvdsPadDriver,
IfxPort_PadSupply
padSupply);
482
483
/** \brief set LVDSH mode (configured for Port21)
484
* \param port Pointer to the port which should be accessed.
485
* \param pinIndex specifies pin to be modified
486
* \param mode specifes the mode of pin
487
* \param enablePortControlled specifies whether it is controlled by port or HSCT
488
* \return None
489
*/
490
IFX_EXTERN
void
IfxPort_setPinModeLvdsHigh
(Ifx_P *port,
uint8
pinIndex,
IfxPort_Mode
mode,
IfxPort_ControlledBy
enablePortControlled);
491
492
/** \} */
493
494
/******************************************************************************/
495
/*-------------------------Global Function Prototypes-------------------------*/
496
/******************************************************************************/
497
498
/** \brief Disable the emergency stop function.
499
* This function disables the emergency stop function. No check is done on port functionality.
500
* \param port Pointer to the port which should be accessed.
501
* \param pinIndex Specifies the pin for which the emergency stop function should be disabled.
502
* \return None
503
*
504
* \see IfxPort_disableEmergencyStop()
505
*
506
*/
507
IFX_EXTERN
void
IfxPort_resetESR
(Ifx_P *port,
uint8
pinIndex);
508
509
/** \brief Enable the emergency stop function.
510
* This function enables the emergency stop function. No check is done on port functionality.
511
* \param port Pointer to the port which should be accessed.
512
* \param pinIndex Specifies the pin for which the emergency stop function should be enabled.
513
* \return None
514
*
515
* \see IfxPort_enableEmergencyStop()
516
*
517
*/
518
IFX_EXTERN
void
IfxPort_setESR
(Ifx_P *port,
uint8
pinIndex);
519
520
/******************************************************************************/
521
/*---------------------Inline Function Implementations------------------------*/
522
/******************************************************************************/
523
524
IFX_INLINE
uint32
IfxPort_getGroupState
(Ifx_P *port,
uint8
pinIndex,
uint16
mask)
525
{
526
return
(
uint32
)((port->IN.U) >> (pinIndex)) & mask;
527
}
528
529
530
IFX_INLINE
boolean
IfxPort_getPinState
(Ifx_P *port,
uint8
pinIndex)
531
{
532
return
(
__getbit
(&port->IN.U, pinIndex) != 0) ?
TRUE
:
FALSE
;
533
}
534
535
536
IFX_INLINE
void
IfxPort_setGroupState
(Ifx_P *port,
uint8
pinIndex,
uint16
mask,
uint16
data)
537
{
538
port->OUT.U = (port->OUT.U & ~((
uint32
)(mask)) << pinIndex) | (data << pinIndex);
539
}
540
541
542
IFX_INLINE
void
IfxPort_setPinHigh
(Ifx_P *port,
uint8
pinIndex)
543
{
544
IfxPort_setPinState
(port, pinIndex,
IfxPort_State_high
);
545
}
546
547
548
IFX_INLINE
void
IfxPort_setPinLow
(Ifx_P *port,
uint8
pinIndex)
549
{
550
IfxPort_setPinState
(port, pinIndex,
IfxPort_State_low
);
551
}
552
553
554
IFX_INLINE
void
IfxPort_setPinModeInput
(Ifx_P *port,
uint8
pinIndex,
IfxPort_InputMode
mode)
555
{
556
IfxPort_setPinMode
(port, pinIndex, (
IfxPort_Mode
)mode);
557
}
558
559
560
IFX_INLINE
void
IfxPort_setPinModeOutput
(Ifx_P *port,
uint8
pinIndex,
IfxPort_OutputMode
mode,
IfxPort_OutputIdx
index)
561
{
562
IfxPort_setPinMode
(port, pinIndex, (
IfxPort_Mode
)(index | mode));
563
}
564
565
566
IFX_INLINE
void
IfxPort_setPinState
(Ifx_P *port,
uint8
pinIndex,
IfxPort_State
action)
567
{
568
port->OMR.U = action << pinIndex;
569
}
570
571
572
IFX_INLINE
void
IfxPort_togglePin
(Ifx_P *port,
uint8
pinIndex)
573
{
574
IfxPort_setPinState
(port, pinIndex,
IfxPort_State_toggled
);
575
}
576
577
578
#endif
/* IFXPORT_H */
home
mclld
Libraries
release
iLLD_1_0_0_11_0
src
ifx
TC27xD
Port
Std
IfxPort.h
Generated by
1.8.4