xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/inc/driver/api/r_elc_api.h (revision 3b5c872a8c45689e8cc17891f01530f5aa5e911c)
1 /***********************************************************************************************************************
2  * Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
3  *
4  * This file is part of Renesas SynergyTM Software Package (SSP)
5  *
6  * The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
7  * and/or its licensors ("Renesas") and subject to statutory and contractual protections.
8  *
9  * This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with
10  * Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
11  * or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
12  * MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
13  * "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
15  * CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
16  * CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
17  * included in this file may be subject to different terms.
18  **********************************************************************************************************************/
19 
20 /**********************************************************************************************************************
21  * File Name    : r_elc_api.h
22  * Description  : ELC Interface
23  **********************************************************************************************************************/
24 
25 /*******************************************************************************************************************//**
26  * @ingroup Interface_Library
27  * @defgroup ELC_API events and peripheral definitions
28  * @brief Interface for the Event Link Controller.
29  *
30  * Related SSP architecture topics:
31  *  - @ref ssp-interfaces
32  *  - @ref ssp-predefined-layers
33  *  - @ref using-ssp-modules
34  *
35  * Event Link Controller Interface description: @ref HALELCInterface
36  *
37  * @{
38  **********************************************************************************************************************/
39 
40 #ifndef DRV_ELC_API_H
41 #define DRV_ELC_API_H
42 
43 /***********************************************************************************************************************
44  * Includes
45  **********************************************************************************************************************/
46 /* Register definitions, common services and error codes. */
47 #include "bsp_api.h"
48 
49 /* Common macro for SSP header files. There is also a corresponding SSP_FOOTER macro at the end of this file. */
50 SSP_HEADER
51 
52 /**********************************************************************************************************************
53  * Macro definitions
54  **********************************************************************************************************************/
55 #define ELC_API_VERSION_MAJOR (1U)
56 #define ELC_API_VERSION_MINOR (3U)
57 
58 /**********************************************************************************************************************
59  * Typedef definitions
60  **********************************************************************************************************************/
61 
62 /** Individual event link. The actual peripheral definitions can be found in the MCU specific (ie. /mcu/S124/bsp_elc.h)
63  * bsp_elc.h files.*/
64 typedef struct st_elc_link
65 {
66     elc_peripheral_t  peripheral;     ///< Peripheral to receive the signal
67     elc_event_t       event;          ///< Signal that gets sent to the Peripheral
68 } elc_link_t;
69 
70 /** Main configuration structure for the Event Link Controller */
71 typedef struct st_elc_cfg
72 {
73     bool                autostart;   ///< Start operation and enable interrupts during open().
74     uint32_t            link_count;  ///< Number of event links
75     elc_link_t const  * link_list;   ///< Event links
76 } elc_cfg_t;
77 
78 /** Software event number */
79 typedef enum e_elc_software_event
80 {
81     ELC_SOFTWARE_EVENT_0,       ///< Software event 0
82     ELC_SOFTWARE_EVENT_1,       ///< Software event 1
83 } elc_software_event_t;
84 
85 /** ELC driver structure. General ELC functions implemented at the HAL layer follow this API. */
86 typedef struct st_elc_api
87 {
88     /** Initialize all links in the Event Link Controller.
89      * @par Implemented as
90      * - R_ELC_Init()
91      *
92      * @param[in]   p_cfg   Pointer to configuration structure.
93      **/
94     ssp_err_t (* init)(elc_cfg_t const * const p_cfg);
95 
96     /** Generate a software event in the Event Link Controller.
97      * @par Implemented as
98      * - R_ELC_SoftwareEventGenerate()
99      *
100      * @param[in]   eventNum           Software event number to be generated.
101      **/
102     ssp_err_t (* softwareEventGenerate)(elc_software_event_t event_num);
103 
104     /** Create a single event link.
105      * @par Implemented as
106      * - R_ELC_LinkSet()
107      *
108      * @param[in]   peripheral The peripheral block that will receive the event signal.
109      * @param[in]   signal     The event signal.
110      **/
111     ssp_err_t (* linkSet)(elc_peripheral_t peripheral, elc_event_t signal);
112 
113     /** Break an event link.
114      * @par Implemented as
115      * - R_ELC_LinkBreak()
116      *
117      * @param[in]   peripheral   The peripheral that should no longer be linked.
118      **/
119     ssp_err_t (* linkBreak)(elc_peripheral_t peripheral);
120 
121     /** Enable the operation of the Event Link Controller.
122      * @par Implemented as
123      * - R_ELC_Enable()
124      **/
125     ssp_err_t (* enable)(void);
126 
127     /** Disable the operation of the Event Link Controller.
128      * @par Implemented as
129      * - R_ELC_Disable()
130      **/
131     ssp_err_t (* disable)(void);
132 
133     /** Get the driver version based on compile time macros.
134      * @par Implemented as
135      * - R_ELC_VersionGet()
136      *
137      * @param[out]  p_version is value returned.
138      **/
139     ssp_err_t (* versionGet)(ssp_version_t * const p_version);
140 } elc_api_t;
141 
142 /** This structure encompasses everything that is needed to use an instance of this interface. */
143 typedef struct st_elc_instance
144 {
145     elc_cfg_t const * p_cfg;     ///< Pointer to the configuration structure for this instance
146     elc_api_t const * p_api;     ///< Pointer to the API structure for this instance
147 } elc_instance_t;
148 
149 /* Common macro for SSP header files. There is also a corresponding SSP_HEADER macro at the top of this file. */
150 SSP_FOOTER
151 
152 #endif /* DRV_ELC_API_H */
153 
154 /*******************************************************************************************************************//**
155  * @} (end addtogroup ELC_API)
156  **********************************************************************************************************************/
157