iLLD_TC27xC  1.0
IfxAsclin_Asc.h
Go to the documentation of this file.
1 /**
2  * \file IfxAsclin_Asc.h
3  * \brief ASCLIN ASC details
4  * \ingroup IfxLld_Asclin
5  *
6  * \version iLLD_0_1_0_10
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  * \defgroup IfxLld_Asclin_Asc_Usage How to use the ASCLIN ASC Interface driver?
25  * \ingroup IfxLld_Asclin
26  *
27  * The ASC interface driver provides a default ASCLIN configuration for asynchronous serial communication in 8bit mode, and a set of data transfer routines.
28  *
29  * Data transfers are buffered by the hardware based FIFOs, and in addition by software based FIFOs with a configurable size. Incoming and outgoing data is transfered in background from/to the ASCLIN peripheral by interrupt service handlers, which are part of this driver as well. This allows a nonblocking communication without stalling the thread(s) from where data is sent and received.
30  *
31  * In the following sections it will be described, how to integrate the driver into the application framework.
32  *
33  * \section IfxLld_Asclin_Asc_Preparation Preparation
34  * \subsection IfxLld_Asclin_Asc_Include Include Files
35  *
36  * Include following header file into your C code:
37  * \code
38  * #include <Asclin/Asc/IfxAsclin_Asc.h>
39  * \endcode
40  *
41  * \subsection IfxLld_Asclin_Asc_Variables Variables
42  *
43  * Declare the ASC handle and the FIFOs as global variables in your C code:
44  *
45  * \code
46  * // used globally
47  * static IfxAsclin_Asc asc;
48  *
49  * #define ASC_TX_BUFFER_SIZE 64
50  * static uint8 ascTxBuffer[ASC_TX_BUFFER_SIZE + sizeof(Fifo) + 8];
51  *
52  * #define ASC_RX_BUFFER_SIZE 64
53  * static uint8 ascRxBuffer[ASC_RX_BUFFER_SIZE + sizeof(Fifo) + 8];
54  * \endcode
55  *
56  * As you can see above, the transfer buffers allocate not only memory for the data itself, but also for FIFO runtime variables. 8 bytes have to be added to ensure a proper circular buffer handling independent from the address to which the buffers have been located.
57  *
58  * \subsection IfxLld_Asclin_Asc_Interrupt Interrupt Handler Installation
59  *
60  * See also \ref IfxLld_Cpu_Irq_Usage
61  *
62  * Define priorities for the Interrrupt handlers. This is normally done in the Ifx_IntPrioDef.h file:
63  * \code
64  * // priorities are normally defined in Ifx_IntPrioDef.h
65  * #define IFX_INTPRIO_ASCLIN0_TX 1
66  * #define IFX_INTPRIO_ASCLIN0_RX 2
67  * #define IFX_INTPRIO_ASCLIN0_ER 3
68  * \endcode
69  *
70  * Add the interrupt service routines to your C code. They have to call the ASC interrupt handlers by passing the asc handle:
71  * \code
72  * IFX_INTERRUPT(asclin0TxISR, 0, IFX_INTPRIO_ASCLIN0_TX)
73  * {
74  * IfxAsclin_Asc_isrTransmit(&asc);
75  * }
76  *
77  * IFX_INTERRUPT(asclin0RxISR, 0, IFX_INTPRIO_ASCLIN0_RX)
78  * {
79  * IfxAsclin_Asc_isrReceive(&asc);
80  * }
81  *
82  * IFX_INTERRUPT(asclin0ErISR, 0, IFX_INTPRIO_ASCLIN0_ER)
83  * {
84  * IfxAsclin_Asc_isrError(&asc);
85  * }
86  * \endcode
87  *
88  * Finally install the interrupt handlers in your initialisation function:
89  * \code
90  * // install interrupt handlers
91  * IfxCpu_Irq_installInterruptHandler(&asclin0TxISR, IFX_INTPRIO_ASCLIN0_TX);
92  * IfxCpu_Irq_installInterruptHandler(&asclin0RxISR, IFX_INTPRIO_ASCLIN0_RX);
93  * IfxCpu_Irq_installInterruptHandler(&asclin0ErISR, IFX_INTPRIO_ASCLIN0_ER);
94  * IfxCpu_enableInterrupts();
95  * \endcode
96  *
97  * \subsection IfxLld_Asclin_Asc_Init Module Initialisation
98  *
99  * The module initialisation can be done in the same function. Here an example:
100  * \code
101  * // create module config
102  * IfxAsclin_Asc_Config ascConfig;
103  * IfxAsclin_Asc_initModuleConfig(&ascConfig, &MODULE_ASCLIN0);
104  *
105  * // set the desired baudrate
106  * ascConfig.baudrate.prescaler = 1;
107  * ascConfig.baudrate.baudrate = 1000000; // FDR values will be calculated in initModule
108  *
109  * // ISR priorities and interrupt target
110  * ascConfig.interrupt.txPriority = IFX_INTPRIO_ASCLIN0_TX;
111  * ascConfig.interrupt.rxPriority = IFX_INTPRIO_ASCLIN0_RX;
112  * ascConfig.interrupt.erPriority = IFX_INTPRIO_ASCLIN0_ER;
113  * ascConfig.interrupt.typeOfService = (IfxSrc_Tos)IfxCpu_getCoreId();
114  *
115  * // FIFO configuration
116  * ascConfig.txBuffer = &ascTxBuffer;
117  * ascConfig.txBufferSize = ASC_TX_BUFFER_SIZE;
118  *
119  * ascConfig.rxBuffer = &ascRxBuffer;
120  * ascConfig.rxBufferSize = ASC_RX_BUFFER_SIZE;
121  *
122  * // pin configuration
123  * const IfxAsclin_Asc_Pins pins = {
124  * NULL, IfxPort_InputMode_pullUp, // CTS pin not used
125  * &IfxAsclin0_RXA_P14_1_IN, IfxPort_InputMode_pullUp, // Rx pin
126  * NULL, IfxPort_OutputMode_pushPull, // RTS pin not used
127  * &IfxAsclin0_TX_P14_0_OUT, IfxPort_OutputMode_pushPull, // Tx pin
128  * IfxPort_PadDriver_cmosAutomotiveSpeed1
129  * };
130  * ascConfig.pins = &pins;
131  *
132  * // initialize module
133  * //IfxAsclin_Asc asc; // defined globally
134  * IfxAsclin_Asc_initModule(&asc, &ascConfig);
135  * \endcode
136  *
137  * The ASC is ready for use now!
138  *
139  *
140  * \section IfxLld_Asclin_Asc_DataTransfers Data Transfers
141  *
142  * \subsection IfxLld_Asclin_Asc_DataSimple Simple Transfers
143  *
144  * The ASC driver provides simple to use transfer functions, which are blocking.
145  *
146  * This means: you can send as much data as you want without taking care for the fill state of the FIFO. If the FIFO is full, the blocking function will wait until the next byte has been transfered to ASCLIN before putting the new byte into the FIFO:
147  * \code
148  * // send 3 bytes
149  * IfxAsclin_Asc_blockingWrite(&asc, 0x01);
150  * IfxAsclin_Asc_blockingWrite(&asc, 0x02);
151  * IfxAsclin_Asc_blockingWrite(&asc, 0x03);
152  * \endcode
153  *
154  * A simple to use receive function is available as well. If no data is in the receive FIFO, it will wait until the next byte has been received:
155  * \code
156  * // receive a byte
157  * uint8 data = IfxAsclin_Asc_blockingRead(&asc);
158  * \endcode
159  *
160  *
161  * \subsection IfxLld_Asclin_Asc_DataStream Streamed Transfers
162  *
163  * Streamed transfers are handled faster by the ASC driver and therefore they are recommended whenever a large bulk of data should be sent. Here an example:
164  * \code
165  * uint8 txData[9] = { 0x49, 0x6e, 0x66, 0x69, 0x6e, 0x65, 0x6f, 0x6e, 0x0a };
166  * Ifx_SizeT count = 9;
167  * IfxAsclin_Asc_write(&asc, txData, &count, TIME_INFINITE);
168  * \endcode
169  *
170  *
171  * Data can be received the following way:
172  * \code
173  * uint8 rxData[5];
174  *
175  * // wait until 5 bytes have been received
176  * Ifx_SizeT count = 5;
177  * IfxAsclin_Asc_read(&asc, rxData, &count, TIME_INFINITE);
178  * \endcode
179  *
180  * Or alternatively with:
181  * \code
182  * uint8 rxData[5];
183  *
184  * // how many bytes have been received?
185  * Ifx_SizeT count = IfxAsclin_Asc_getReadCount(&asc);
186  *
187  * // limit to our buffer size
188  * count = count < 5 ? count : 5;
189  *
190  * // transfer received data into buffer
191  * IfxAsclin_Asc_read(&asc, rxData, &count, TIME_INFINITE);
192  * \endcode
193  *
194  * \defgroup IfxLld_Asclin_Asc ASC
195  * \ingroup IfxLld_Asclin
196  * \defgroup IfxLld_Asclin_Asc_DataStructures Data Structures
197  * \ingroup IfxLld_Asclin_Asc
198  * \defgroup IfxLld_Asclin_Asc_InterruptFunctions Interrupt Functions
199  * \ingroup IfxLld_Asclin_Asc
200  * \defgroup IfxLld_Asclin_Asc_SimpleCom Simple Communication
201  * \ingroup IfxLld_Asclin_Asc
202  * \defgroup IfxLld_Asclin_Asc_StreamCom Stream based Communication (STDIO)
203  * \ingroup IfxLld_Asclin_Asc
204  * \defgroup IfxLld_Asclin_Asc_ModuleFunctions Module Functions
205  * \ingroup IfxLld_Asclin_Asc
206  */
207 
208 #ifndef IFXASCLIN_ASC_H
209 #define IFXASCLIN_ASC_H 1
210 
211 /******************************************************************************/
212 /*----------------------------------Includes----------------------------------*/
213 /******************************************************************************/
214 
215 #include "Asclin/Std/IfxAsclin.h"
218 #include "StdIf/IfxStdIf_DPipe.h"
219 
220 /******************************************************************************/
221 /*-----------------------------Data Structures--------------------------------*/
222 /******************************************************************************/
223 
224 /** \brief Structure for Error Flags
225  */
226 typedef struct
227 {
228  uint8 parityError : 1; /**< \brief parity error */
229  uint8 frameError : 1; /**< \brief transmit complete/pending error */
230  uint8 rxFifoOverflow : 1; /**< \brief receive FIFO overflow error */
231  uint8 rxFifoUnderflow : 1; /**< \brief receive FIFO underflow error */
232  uint8 txFifoOverflow : 1; /**< \brief transmit FIFO overflow error */
234 
235 /** \addtogroup IfxLld_Asclin_Asc_DataStructures
236  * \{ */
237 /** \brief Structure for baudrate
238  */
239 typedef struct
240 {
241  float32 baudrate; /**< \brief value of the required baudrate */
242  uint16 prescaler; /**< \brief BITCON.PRESCALER, the division ratio of the predevider */
243  IfxAsclin_OversamplingFactor oversampling; /**< \brief BITCON.OVERSAMPLING, division ratio of the baudrate post devider */
245 
246 /** \brief Structure for bit timings
247  */
248 typedef struct
249 {
250  IfxAsclin_SamplesPerBit medianFilter; /**< \brief BITCON.SM, number of samples per bit (1 or 3), sample mode/median filter */
251  IfxAsclin_SamplePointPosition samplePointPosition; /**< \brief BITCON.SAMPLEPOINT, sample point position */
253 
254 /** \brief Structure for FIFO control
255  */
256 typedef struct
257 {
258  IfxAsclin_TxFifoInletWidth inWidth; /**< \brief TXFIFOCON.INW, transmit FIFO inlet width */
259  IfxAsclin_RxFifoOutletWidth outWidth; /**< \brief RXFIFOCON.OTW, receive FIFO oulet width */
260  IfxAsclin_TxFifoInterruptLevel txFifoInterruptLevel; /**< \brief TXFIFOCON.INTLEVEL, Tx FIFO interrupt level */
261  IfxAsclin_RxFifoInterruptLevel rxFifoInterruptLevel; /**< \brief RXFIFOCON.INTLEVEL, Rx FIFO interrupt level */
262  IfxAsclin_ReceiveBufferMode buffMode; /**< \brief RXFIFOCON.BUFF, receive buffer mode (Rx FIFO or Rx buffer) */
264 
265 /** \brief Structure for frame control
266  */
267 typedef struct
268 {
269  IfxAsclin_IdleDelay idleDelay; /**< \brief FRAMECON.IDLE, idle delay */
270  IfxAsclin_StopBit stopBit; /**< \brief FRAMECON.STOP, number of stop bits */
271  IfxAsclin_FrameMode frameMode; /**< \brief FRAMECON.MODE, mode of operation of the module */
272  IfxAsclin_ShiftDirection shiftDir; /**< \brief FRAMECON.MSB, shift direction */
273  IfxAsclin_ParityType parityType; /**< \brief FRAMECON.ODD, parity type (even or odd) */
274  IfxAsclin_DataLength dataLength; /**< \brief DATCON.DATALENGTH, data length, number of bits per transfer */
275  boolean parityBit; /**< \brief FRAMECON.PEN, parity enable */
277 
278 /** \brief Structure for interrupt configuration
279  */
280 typedef struct
281 {
282  uint16 txPriority; /**< \brief transmit interrupt priority */
283  uint16 rxPriority; /**< \brief receive interrupt priority */
284  uint16 erPriority; /**< \brief error interrupt priority */
285  IfxSrc_Tos typeOfService; /**< \brief type of interrupt service */
287 
288 /** \brief Structure for ASC pin configuration
289  */
290 typedef struct
291 {
292  const IfxAsclin_Cts_In *cts; /**< \brief ASC clear to send (CTS) pin */
293  IfxPort_InputMode ctsMode; /**< \brief Cts pin as input */
294  const IfxAsclin_Rx_In *rx; /**< \brief ASC Rx pin */
295  IfxPort_InputMode rxMode; /**< \brief Rx pin as input */
296  const IfxAsclin_Rts_Out *rts; /**< \brief ASC (request to send) RTS pin */
297  IfxPort_OutputMode rtsMode; /**< \brief Rts as output */
298  const IfxAsclin_Tx_Out *tx; /**< \brief ASC Tx pin */
299  IfxPort_OutputMode txMode; /**< \brief Tx as output */
300  IfxPort_PadDriver pinDriver; /**< \brief pad driver */
302 
303 /** \} */
304 
305 /** \brief This union contains the error flags. In addition it allows to write and read to/from all flags as once via the ALL member.
306  */
307 typedef union
308 {
312 
313 /** \addtogroup IfxLld_Asclin_Asc_DataStructures
314  * \{ */
315 /** \brief Module Handle
316  */
317 typedef struct
318 {
319  Ifx_ASCLIN *asclin; /**< \brief pointer to ASCLIN registers */
320  Ifx_Fifo *tx; /**< \brief Transmit FIFO buffer */
321  Ifx_Fifo *rx; /**< \brief Receive FIFO buffer */
322  volatile boolean txInProgress; /**< \brief Ongoing transfer. Will be set by IfxAsclin_Asc_initiateTransmission, and cleared by IfxAsclin_Asc_isrTransmit */
323  volatile boolean rxSwFifoOverflow; /**< \brief Will be set by IfxAsclin_Asc_isrReceive if the SW Fifo overflowed */
324  IfxAsclin_Asc_ErrorFlagsUnion errorFlags; /**< \brief error reported by ASCLIN during runtime (written by IfxAsclin_Asc_isrError) */
325  Ifx_DataBufferMode dataBufferMode; /**< \brief Rx buffer mode */
326  volatile uint32 sendCount; /**< \brief Number of byte that are send out, this value is reset with the function Asc_If_resetSendCount() */
327  volatile Ifx_TickTime txTimestamp; /**< \brief Time stamp of the latest send byte */
328 } IfxAsclin_Asc;
329 
330 /** \brief Configuration structure of the module
331  */
332 typedef struct
333 {
334  Ifx_ASCLIN *asclin; /**< \brief pointer to ASCLIN registers */
335  IfxAsclin_Asc_BaudRate baudrate; /**< \brief structure for baudrate */
336  IfxAsclin_Asc_BitTimingControl bitTiming; /**< \brief structure for bit timings */
337  IfxAsclin_Asc_FrameControl frame; /**< \brief structure for frame control */
338  IfxAsclin_Asc_FifoControl fifo; /**< \brief structure for FIFO control */
339  IfxAsclin_Asc_InterruptConfig interrupt; /**< \brief structure for interrupt configuration */
340  const IfxAsclin_Asc_Pins *pins; /**< \brief structure for ASC pins */
341  IfxAsclin_ClockSource clockSource; /**< \brief CSR.CLKSEL, clock source selection */
342  IfxAsclin_Asc_ErrorFlagsUnion errorFlags; /**< \brief structure for error flags */
343  Ifx_SizeT txBufferSize; /**< \brief Size of the tx buffer */
344  void *txBuffer; /**< \brief The buffer parameter must point on a free memory location where the buffer object will be Initialised.
345  *
346  * The Size of this area must be at least equals to "txBufferSize + sizeof(Fifo) + 8". Not tacking this in account may result in unpredictable behavior.
347  *
348  * If set to NULL_PTR, the buffer will be allocated dynamically according to txBufferSize */
349  Ifx_SizeT rxBufferSize; /**< \brief Size of the rx buffer */
350  void *rxBuffer; /**< \brief The buffer parameter must point on a free memory location where the buffer object will be Initialised.
351  *
352  * The Size of this area must be at least equals to "rxBufferSize + sizeof(Fifo) + 8". Not tacking this in account may result in unpredictable behavior.
353  *
354  * If set to NULL, the buffer will be allocated dynamically according to rxBufferSize */
355  boolean loopBack; /**< \brief IOCR.LB, loop back mode selection, 0 for disable, 1 for enable */
356  Ifx_DataBufferMode dataBufferMode; /**< \brief Rx buffer mode */
358 
359 /** \} */
360 
361 /** \addtogroup IfxLld_Asclin_Asc_InterruptFunctions
362  * \{ */
363 
364 /******************************************************************************/
365 /*-------------------------Global Function Prototypes-------------------------*/
366 /******************************************************************************/
367 
368 /** \brief ISR error routine.
369  * \see IfxSdtIf_DPipe_OnError
370  *
371  * Currently it only stores error flags in the handle (asclin->errorFlags) whenever an error happened.
372  * The user software could react on these flags, e.g. it could re-initialize the module.
373  * \param asclin module handler
374  * \return None
375  */
377 
378 /** \brief ISR receive routine
379  * \see IfxSdtIf_DPipe_OnReceive
380  * \param asclin module handler
381  * \return None
382  */
384 
385 /** \brief ISR transmit routine
386  * \see IfxSdtIf_DPipe_OnTransmit
387  * \param asclin module handler
388  * \return None
389  */
391 
392 /** \} */
393 
394 /** \addtogroup IfxLld_Asclin_Asc_SimpleCom
395  * \{ */
396 
397 /******************************************************************************/
398 /*-------------------------Global Function Prototypes-------------------------*/
399 /******************************************************************************/
400 
401 /** \brief Reads data from the Rx FIFO
402  * \param asclin module handle
403  * \return number of received data words
404  *
405  * Usage Example:
406  * \code
407  * // receive a byte
408  * uint8 data = IfxAsclin_Asc_blockingRead(&asc);
409  * \endcode
410  *
411  */
413 
414 /** \brief Writes data into the Tx FIFO
415  * \param asclin module handle
416  * \param data the data byte which should be sent
417  * \return Returns TRUE if data could be written
418  *
419  * Usage Example:
420  * \code
421  * // send 3 bytes
422  * IfxAsclin_Asc_blockingWrite(&asc, 0x01);
423  * IfxAsclin_Asc_blockingWrite(&asc, 0x02);
424  * IfxAsclin_Asc_blockingWrite(&asc, 0x03);
425  * \endcode
426  *
427  */
429 
430 /** \} */
431 
432 /** \addtogroup IfxLld_Asclin_Asc_StreamCom
433  * \{ */
434 
435 /******************************************************************************/
436 /*-------------------------Global Function Prototypes-------------------------*/
437 /******************************************************************************/
438 
439 /** \brief \see IfxStdIf_DPipe_CanReadCount
440  * \param asclin module handle
441  * \param count Count of data which should be checked (in bytes)
442  * \param timeout in system timer ticks
443  * \return Returns TRUE if at least count bytes are available for read in the rx buffer, if not the Event is armed to be set when the buffer count is bigger or equal to the requested count.
444  */
446 
447 /** \brief \see IfxStdIf_DPipe_CanWriteCount
448  * \param asclin module handle
449  * \param count Count of data which should be checked (in bytes)
450  * \param timeout in system timer ticks
451  * \return Returns TRUE if at least count bytes can be written to the tx buffer, if not the Event is armed to be set when the buffer free count is bigger or equal to the requested count
452  */
454 
455 /** \brief \see IfxStdIf_DPipe_ClearRx
456  * \param asclin module handle
457  * \return None
458  */
460 
461 /** \brief \see IfxStdIf_DPipe_ClearTx
462  * \param asclin module handle
463  * \return None
464  */
466 
467 /** \brief \see IfxStdIf_DPipe_FlushTx
468  * \param asclin module handle
469  * \param timeout in system timer ticks
470  * \return Returns TRUE if the FIFO is empty
471  */
473 
474 /** \brief \see IfxStdIf_DPipe_GetReadCount
475  * \param asclin module handle
476  * \return The number of bytes in the rx buffer
477  */
479 
480 /** \brief \see IIfxStdIf_DPipe_GetReadEvent
481  * \param asclin module handle
482  * \return Read event object
483  */
485 
486 /** \brief \see IfxStdIf_DPipe_GetSendCount
487  * \param asclin module handle
488  * \return number of bytes send
489  */
491 
492 /** \brief \see IfxStdIf_DPipe_GetTxTimeStamp
493  * \param asclin module handle
494  * \return Time in ticks
495  */
497 
498 /** \brief \see IfxStdIf_DPipe_GetWriteCount
499  * \param asclin module handle
500  * \return The number of free bytes in the tx buffer
501  */
503 
504 /** \brief \see IIfxStdIf_DPipe_GetWriteEvent
505  * \param asclin module handle
506  * \return Write event object
507  */
509 
510 /** \brief \see IfxStdIf_DPipe_Read
511  * \param asclin module handle
512  * \param data Pointer to the start of data
513  * \param count Pointer to the count of data (in bytes).
514  * \param timeout in system timer ticks
515  * \return Returns TRUE if all items could be read\n
516  * Returns FALSE if not all the items could be read
517  *
518  * Usage Example:
519  * \code
520  * uint8 rxData[5];
521  *
522  * // wait until 5 bytes have been received
523  * Ifx_SizeT count = 5;
524  * IfxAsclin_Asc_read(&asc, rxData, &count, TIME_INFINITE);
525  * \endcode
526  *
527  * Alternative Usage Example:
528  * \code
529  * uint8 rxData[5];
530  *
531  * // how many bytes have been received?
532  * Ifx_SizeT count = IfxAsclin_Asc_getReadCount(&asc);
533  *
534  * // limit to our buffer size
535  * count = count < 5 ? count : 5;
536  *
537  * // transfer received data into buffer
538  * IfxAsclin_Asc_read(&asc, rxData, &count, TIME_INFINITE);
539  * \endcode
540  *
541  */
542 IFX_EXTERN boolean IfxAsclin_Asc_read(IfxAsclin_Asc *asclin, void *data, Ifx_SizeT *count, Ifx_TickTime timeout);
543 
544 /** \brief \see IfxStdIf_DPipe_ResetSendCount
545  * \param asclin module handle
546  * \return None
547  */
549 
550 /** \brief \see IfxStdIf_DPipe_Write
551  * \param asclin module handle
552  * \param data Pointer to the start of data
553  * \param count Pointer to the count of data (in bytes).
554  * \param timeout in system timer ticks
555  * \return Returns TRUE if all items could be written\n
556  * Returns FALSE if not all the items could be written
557  *
558  * Usage Example:
559  * \code
560  * uint8 txData[5] = { 1, 2, 3, 4, 5 };
561  * Ifx_SizeT count = 5;
562  * IfxAsclin_Asc_write(&asc, txData, &count, TIME_INFINITE);
563  * \endcode
564  *
565  */
566 IFX_EXTERN boolean IfxAsclin_Asc_write(IfxAsclin_Asc *asclin, void *data, Ifx_SizeT *count, Ifx_TickTime timeout);
567 
568 /** \} */
569 
570 /** \addtogroup IfxLld_Asclin_Asc_ModuleFunctions
571  * \{ */
572 
573 /******************************************************************************/
574 /*-------------------------Global Function Prototypes-------------------------*/
575 /******************************************************************************/
576 
577 /** \brief Disables the module
578  * \param asclin module handle
579  * \return None
580  */
582 
583 /** \brief Initialises the module
584  * \param asclin module handle
585  * \param config predefined configuration structure of the module
586  * \return Status
587  *
588  * Usage Example:
589  * \code
590  * // create module config
591  * IfxAsclin_Asc_Config ascConfig;
592  * IfxAsclin_Asc_initModuleConfig(&ascConfig, &MODULE_ASCLIN0);
593  *
594  * // set the desired baudrate
595  * ascConfig.baudrate.prescaler = 1;
596  * ascConfig.baudrate.baudrate = 1000000; // FDR values will be calculated in initModule
597  *
598  * // ISR priorities and interrupt target
599  * ascConfig.interrupt.txPriority = IFX_INTPRIO_ASCLIN0_TX; // see also \ref IfxLld_Asclin
600  * ascConfig.interrupt.rxPriority = IFX_INTPRIO_ASCLIN0_RX; // see also \ref IfxLld_Asclin
601  * ascConfig.interrupt.erPriority = IFX_INTPRIO_ASCLIN0_ER; // see also \ref IfxLld_Asclin
602  * ascConfig.interrupt.typeOfService = (IfxSrc_Tos)IfxCpu_getCoreId();
603  *
604  * // FIFO configuration
605  * ascConfig.txBuffer = &ascTxBuffer;
606  * ascConfig.txBufferSize = ASC_TX_BUFFER_SIZE;
607  *
608  * ascConfig.rxBuffer = &ascRxBuffer;
609  * ascConfig.rxBufferSize = ASC_RX_BUFFER_SIZE;
610  *
611  * // pin configuration
612  * const IfxAsclin_Asc_Pins pins = {
613  * NULL, IfxPort_InputMode_pullUp, // CTS pin not used
614  * &IfxAsclin0_RXA_P14_1_IN, IfxPort_InputMode_pullUp, // Rx pin
615  * NULL, IfxPort_OutputMode_pushPull, // RTS pin not used
616  * &IfxAsclin0_TX_P14_0_OUT, IfxPort_OutputMode_pushPull, // Tx pin
617  * IfxPort_PadDriver_cmosAutomotiveSpeed1
618  * };
619  * ascConfig.pins = &pins;
620  *
621  * // initialize module
622  * //IfxAsclin_Asc asc; // defined globally
623  * IfxAsclin_Asc_initModule(&asc, &ascConfig);
624  * \endcode
625  *
626  */
628 
629 /** \brief Fills the config structure with default values
630  * \param config configuration structure of the module
631  * \param asclin pointer to ASCLIN registers
632  * \return None
633  *
634  * Usage example: see \ref IfxAsclin_Asc_initModule
635  *
636  */
637 IFX_EXTERN void IfxAsclin_Asc_initModuleConfig(IfxAsclin_Asc_Config *config, Ifx_ASCLIN *asclin);
638 
639 /** \} */
640 
641 /******************************************************************************/
642 /*-------------------------Global Function Prototypes-------------------------*/
643 /******************************************************************************/
644 
645 /** \brief Initiate the data transmission
646  * \param asclin module handle
647  * \return None
648  *
649  * Usage Example:
650  * \code
651  * // can be called when ever data needs to be transmitted after initialising the module
652  *
653  * // initialise the data that needs to be transmitted
654  * uint8 txData[5] = { 1, 2, 3, 4, 5 };
655  *
656  * // transmit data
657  * IfxAsclin_Asc_transmit(&asc, txData, 5);
658  * \endcode
659  *
660  */
662 
663 /** \brief Initialize the standard interface to the device driver
664  * \param stdif standard interface object, will be initialized by the function
665  * \param asclin module handle
666  * \return
667  */
669 
670 #endif /* IFXASCLIN_ASC_H */