xref: /btstack/port/renesas-ek-ra6m4a-da14531/e2-project/ra/fsp/inc/instances/r_dtc.h (revision c30869498fb8e98c1408c9db0e7624f02f483b73)
1 /***********************************************************************************************************************
2  * Copyright [2020-2022] Renesas Electronics Corporation and/or its affiliates.  All Rights Reserved.
3  *
4  * This software and documentation are supplied by Renesas Electronics America Inc. and may only be used with products
5  * of Renesas Electronics Corp. and its affiliates ("Renesas").  No other uses are authorized.  Renesas products are
6  * sold pursuant to Renesas terms and conditions of sale.  Purchasers are solely responsible for the selection and use
7  * of Renesas products and Renesas assumes no liability.  No license, express or implied, to any intellectual property
8  * right is granted by Renesas. This software is protected under all applicable laws, including copyright laws. Renesas
9  * reserves the right to change or discontinue this software and/or this documentation. THE SOFTWARE AND DOCUMENTATION
10  * IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND TO THE FULLEST EXTENT
11  * PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY, INCLUDING WARRANTIES
12  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE SOFTWARE OR
13  * DOCUMENTATION.  RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.  TO THE MAXIMUM
14  * EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR DOCUMENTATION
15  * (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER, INCLUDING,
16  * WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY LOST PROFITS,
17  * OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY
18  * OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
19  **********************************************************************************************************************/
20 
21 /*******************************************************************************************************************//**
22  * @addtogroup DTC
23  * @{
24  **********************************************************************************************************************/
25 
26 #ifndef R_DTC_H
27 #define R_DTC_H
28 
29 /***********************************************************************************************************************
30  * Includes
31  **********************************************************************************************************************/
32 #include "bsp_api.h"
33 #include "r_transfer_api.h"
34 #include "r_dtc_cfg.h"
35 
36 /* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
37 FSP_HEADER
38 
39 /***********************************************************************************************************************
40  * Macro definitions
41  **********************************************************************************************************************/
42 
43 /** Max configurable number of transfers in NORMAL MODE */
44 #define DTC_MAX_NORMAL_TRANSFER_LENGTH    (0x10000)
45 
46 /** Max number of transfers per repeat for REPEAT MODE */
47 #define DTC_MAX_REPEAT_TRANSFER_LENGTH    (0x100)
48 
49 /** Max number of transfers per block in BLOCK MODE */
50 #define DTC_MAX_BLOCK_TRANSFER_LENGTH     (0x100)
51 
52 /** Max configurable number of blocks to transfer in BLOCK MODE */
53 #define DTC_MAX_BLOCK_COUNT               (0x10000)
54 
55 /***********************************************************************************************************************
56  * Typedef definitions
57  **********************************************************************************************************************/
58 
59 /** DTC transfer configuration extension. This extension is required. */
60 typedef struct st_dtc_extended_cfg
61 {
62     /** Select which IRQ will trigger the transfer. */
63     IRQn_Type activation_source;
64 } dtc_extended_cfg_t;
65 
66 /** Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in @ref transfer_api_t::open. */
67 typedef struct st_dtc_instance_ctrl
68 {
69     uint32_t  open;                    // Driver ID
70     IRQn_Type irq;                     // Transfer activation IRQ number.
71 } dtc_instance_ctrl_t;
72 
73 /**********************************************************************************************************************
74  * Exported global variables
75  **********************************************************************************************************************/
76 
77 /** @cond INC_HEADER_DEFS_SEC */
78 /** Filled in Interface API structure for this Instance. */
79 extern const transfer_api_t g_transfer_on_dtc;
80 
81 /** @endcond */
82 
83 /**********************************************************************************************************************
84  * Public Function Prototypes
85  **********************************************************************************************************************/
86 fsp_err_t R_DTC_Open(transfer_ctrl_t * const p_api_ctrl, transfer_cfg_t const * const p_cfg);
87 fsp_err_t R_DTC_Reconfigure(transfer_ctrl_t * const p_api_ctrl, transfer_info_t * p_info);
88 fsp_err_t R_DTC_Reset(transfer_ctrl_t * const p_api_ctrl,
89                       void const * volatile   p_src,
90                       void * volatile         p_dest,
91                       uint16_t const          num_transfers);
92 fsp_err_t R_DTC_SoftwareStart(transfer_ctrl_t * const p_api_ctrl, transfer_start_mode_t mode);
93 fsp_err_t R_DTC_SoftwareStop(transfer_ctrl_t * const p_api_ctrl);
94 fsp_err_t R_DTC_Enable(transfer_ctrl_t * const p_api_ctrl);
95 fsp_err_t R_DTC_Disable(transfer_ctrl_t * const p_api_ctrl);
96 fsp_err_t R_DTC_InfoGet(transfer_ctrl_t * const p_api_ctrl, transfer_properties_t * const p_properties);
97 fsp_err_t R_DTC_Close(transfer_ctrl_t * const p_api_ctrl);
98 
99 /* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
100 FSP_FOOTER
101 
102 #endif
103 
104 /*******************************************************************************************************************//**
105  * @} (end defgroup DTC)
106  **********************************************************************************************************************/
107