xref: /btstack/port/renesas-ek-ra6m4a-da14531/e2-project/ra/fsp/src/bsp/mcu/all/bsp_mcu_api.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 #ifndef BSP_MCU_API_H
22 #define BSP_MCU_API_H
23 
24 /** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
25 FSP_HEADER
26 
27 typedef struct st_bsp_event_info
28 {
29     IRQn_Type   irq;
30     elc_event_t event;
31 } bsp_event_info_t;
32 
33 typedef enum e_bsp_clocks_octaclk_div
34 {
35     BSP_CLOCKS_OCTACLK_DIV_1 = 0,      ///< Divide OCTA source clock by 1
36     BSP_CLOCKS_OCTACLK_DIV_2,          ///< Divide OCTA source clock by 2
37     BSP_CLOCKS_OCTACLK_DIV_4,          ///< Divide OCTA source clock by 4
38     BSP_CLOCKS_OCTACLK_DIV_6,          ///< Divide OCTA source clock by 6
39     BSP_CLOCKS_OCTACLK_DIV_8           ///< Divide OCTA source clock by 8
40 } bsp_clocks_octaclk_div_t;
41 
42 typedef enum e_bsp_clocks_source
43 {
44     BSP_CLOCKS_CLOCK_HOCO = 0,         ///< The high speed on chip oscillator.
45     BSP_CLOCKS_CLOCK_MOCO,             ///< The middle speed on chip oscillator.
46     BSP_CLOCKS_CLOCK_LOCO,             ///< The low speed on chip oscillator.
47     BSP_CLOCKS_CLOCK_MAIN_OSC,         ///< The main oscillator.
48     BSP_CLOCKS_CLOCK_SUBCLOCK,         ///< The subclock oscillator.
49     BSP_CLOCKS_CLOCK_PLL,              ///< The PLL oscillator.
50     BSP_CLOCKS_CLOCK_PLL2,             ///< The PLL2 oscillator.
51 } bsp_clocks_source_t;
52 
53 typedef struct st_bsp_octaclk_settings
54 {
55     bsp_clocks_source_t      source_clock; ///< OCTACLK source clock
56     bsp_clocks_octaclk_div_t divider;      ///< OCTACLK divider
57 } bsp_octaclk_settings_t;
58 
59 void      R_BSP_RegisterProtectEnable(bsp_reg_protect_t regs_to_protect);
60 void      R_BSP_RegisterProtectDisable(bsp_reg_protect_t regs_to_unprotect);
61 fsp_err_t R_BSP_GroupIrqWrite(bsp_grp_irq_t irq, void (* p_callback)(bsp_grp_irq_t irq));
62 void      R_BSP_OctaclkUpdate(bsp_octaclk_settings_t * p_octaclk_setting);
63 void      R_BSP_SoftwareDelay(uint32_t delay, bsp_delay_units_t units);
64 
65 /** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
66 FSP_FOOTER
67 
68 #endif
69