1 /*
2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 
7 /*******************************************************************************************************************//**
8  * @addtogroup DTC
9  * @{
10  **********************************************************************************************************************/
11 
12 #ifndef R_DTC_H
13 #define R_DTC_H
14 
15 /***********************************************************************************************************************
16  * Includes
17  **********************************************************************************************************************/
18 #include "bsp_api.h"
19 #include "r_transfer_api.h"
20 #include "r_dtc_cfg.h"
21 
22 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
23 FSP_HEADER
24 
25 /***********************************************************************************************************************
26  * Macro definitions
27  **********************************************************************************************************************/
28 
29 /** Max configurable number of transfers in NORMAL MODE */
30 #define DTC_MAX_NORMAL_TRANSFER_LENGTH    (0x10000)
31 
32 /** Max number of transfers per repeat for REPEAT MODE */
33 #define DTC_MAX_REPEAT_TRANSFER_LENGTH    (0x100)
34 
35 /** Max number of transfers per block in BLOCK MODE */
36 #define DTC_MAX_BLOCK_TRANSFER_LENGTH     (0x100)
37 
38 /** Max configurable number of blocks to transfer in BLOCK MODE */
39 #define DTC_MAX_BLOCK_COUNT               (0x10000)
40 
41 /***********************************************************************************************************************
42  * Typedef definitions
43  **********************************************************************************************************************/
44 
45 /** DTC transfer configuration extension. This extension is required. */
46 typedef struct st_dtc_extended_cfg
47 {
48     /** Select which IRQ will trigger the transfer. */
49     IRQn_Type activation_source;
50 } dtc_extended_cfg_t;
51 
52 /** Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in @ref transfer_api_t::open. */
53 typedef struct st_dtc_instance_ctrl
54 {
55     uint32_t  open;                    // Driver ID
56     IRQn_Type irq;                     // Transfer activation IRQ number.
57 } dtc_instance_ctrl_t;
58 
59 /**********************************************************************************************************************
60  * Exported global variables
61  **********************************************************************************************************************/
62 
63 /** @cond INC_HEADER_DEFS_SEC */
64 /** Filled in Interface API structure for this Instance. */
65 extern const transfer_api_t g_transfer_on_dtc;
66 
67 /** @endcond */
68 
69 /**********************************************************************************************************************
70  * Public Function Prototypes
71  **********************************************************************************************************************/
72 fsp_err_t R_DTC_Open(transfer_ctrl_t * const p_api_ctrl, transfer_cfg_t const * const p_cfg);
73 fsp_err_t R_DTC_Reconfigure(transfer_ctrl_t * const p_api_ctrl, transfer_info_t * p_info);
74 fsp_err_t R_DTC_Reset(transfer_ctrl_t * const p_api_ctrl,
75                       void const * volatile   p_src,
76                       void * volatile         p_dest,
77                       uint16_t const          num_transfers);
78 fsp_err_t R_DTC_SoftwareStart(transfer_ctrl_t * const p_api_ctrl, transfer_start_mode_t mode);
79 fsp_err_t R_DTC_SoftwareStop(transfer_ctrl_t * const p_api_ctrl);
80 fsp_err_t R_DTC_Enable(transfer_ctrl_t * const p_api_ctrl);
81 fsp_err_t R_DTC_Disable(transfer_ctrl_t * const p_api_ctrl);
82 fsp_err_t R_DTC_InfoGet(transfer_ctrl_t * const p_api_ctrl, transfer_properties_t * const p_properties);
83 fsp_err_t R_DTC_Reload(transfer_ctrl_t * const p_api_ctrl,
84                        void const            * p_src,
85                        void                  * p_dest,
86                        uint32_t const          num_transfers);
87 fsp_err_t R_DTC_CallbackSet(transfer_ctrl_t * const          p_api_ctrl,
88                             void (                         * p_callback)(transfer_callback_args_t *),
89                             void const * const               p_context,
90                             transfer_callback_args_t * const p_callback_memory);
91 fsp_err_t R_DTC_Close(transfer_ctrl_t * const p_api_ctrl);
92 
93 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
94 FSP_FOOTER
95 
96 #endif
97 
98 /*******************************************************************************************************************//**
99  * @} (end defgroup DTC)
100  **********************************************************************************************************************/
101