xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/inc/driver/api/r_fmi_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_fmi_api.h
22  * Description  : FMI interface
23  **********************************************************************************************************************/
24 
25 /*******************************************************************************************************************//**
26  * @ingroup Interface_Library
27  * @defgroup FMI_API FMI Interface
28  *
29  * @brief Interface for reading on-chip factory information.
30  *
31  * @section FMI_API_SUMMARY Summary
32  * The FMI (Factory MCU Information) module provides a function for reading the Product Information record.
33  *
34  * Related SSP architecture topics:
35  *  - @ref ssp-interfaces
36  *  - @ref ssp-predefined-layers
37  *  - @ref using-ssp-modules
38  *
39  * FMI Interface description: @ref HALFMIInterface
40  * @{
41  **********************************************************************************************************************/
42 #ifndef DRV_FMI_API_H
43 #define DRV_FMI_API_H
44 
45 /***********************************************************************************************************************
46  * Includes
47  **********************************************************************************************************************/
48 /** Register definitions, common services and error codes. */
49 #include "bsp_api.h"
50 
51 /* Common macro for SSP header files. There is also a corresponding SSP_FOOTER macro at the end of this file. */
52 SSP_HEADER
53 
54 /**********************************************************************************************************************
55  * Macro definitions
56  **********************************************************************************************************************/
57 #define FMI_API_VERSION_MAJOR (1U)
58 #define FMI_API_VERSION_MINOR (4U)
59 
60 /**********************************************************************************************************************
61  * Typedef definitions
62  **********************************************************************************************************************/
63 typedef struct st_fmi_header
64 {
65     uint32_t contents :8; // [0:7]
66     uint32_t variant :8;  // [8:15]
67     uint32_t count :8;    // [16:23]
68     uint32_t minor :4;    // [24:27]
69     uint32_t major :4;    // [28:31]
70 } fmi_header_t;
71 
72 typedef struct st_fmi_product_info
73 {
74     fmi_header_t       header;
75     uint8_t            unique_id[16];       ///< DEPRECATED, use uniqueIdGet instead
76     uint8_t            product_name[16];    /* No guarantee of null terminator. */
77     uint8_t            product_marking[16]; /* No guarantee of null terminator. */
78     /*LDRA_INSPECTED 381 S Anonymous structures and unions are allowed in SSP code. */
79     struct
80     {
81         uint32_t mask_revision :8; /*  [0:7]  */
82         uint32_t pin_count :10;    /*  [8:17] */
83         uint32_t pkg_type :3;      /* [18:20] */
84         uint32_t temp_range :3;    /* [21:23] */
85         uint32_t quality_code :3;  /* [24:26] */
86         uint32_t reserved :5;      /* [27:32] */
87     };
88     /*LDRA_INSPECTED 381 S Anonymous structures and unions are allowed in SSP code. */
89     struct
90     {
91         uint32_t max_freq :8;       /* [0:7] */
92         uint32_t reserved1;
93     };
94 } fmi_product_info_t;
95 
96 typedef struct st_fmi_unique_id
97 {
98     uint32_t        unique_id[4];
99 } fmi_unique_id_t;
100 
101 typedef struct st_fmi_feature_info
102 {
103     void * ptr;
104     /*LDRA_INSPECTED 381 S Anonymous structures and unions are allowed in SSP code. */
105     struct
106     {
107         uint32_t channel_count:16; /* this is highest possible...not populated */
108         uint32_t variant_data: 16;
109         uint32_t extended_data_count:8;  /* the number of variant words for channel */
110         uint32_t version_major:8;
111         uint32_t version_minor:8;
112     };
113     void * ptr_extended_data;
114 } fmi_feature_info_t;
115 
116 typedef struct st_fmi_event_info
117 {
118     IRQn_Type   irq;
119     elc_event_t event;
120 } fmi_event_info_t;
121 
122 /** fmi driver structure. General fmi functions implemented at the HAL layer will follow this API. */
123 typedef struct st_fmi_api
124 {
125     /** Initialize the FMI base pointer.
126      * @par Implemented as
127      * - R_FMI_Init()
128      **/
129     ssp_err_t (* init)(void);
130 
131     /** Get product information record address into caller's pointer.
132      * @warning fmi_product_info_t::unique_id is deprecated and will not contain a unique ID if the factory
133      * MCU information is linked in by the application code.  Use fmi_api_t::uniqueIdGet for the unique ID.
134      * @param[in,out]  pp_product_info  Pointer to store pointer to product info.
135      *
136      * @par Implemented as
137      * - R_FMI_ProductInfoGet()
138      **/
139     ssp_err_t (* productInfoGet)(fmi_product_info_t ** pp_product_info);
140 
141     /** Copy unique ID into p_unique_id.
142      * @param[out]  p_unique_id  Pointer to unique ID.
143      *
144      * @par Implemented as
145      * - R_FMI_UniqueIdGet()
146      **/
147     ssp_err_t (* uniqueIdGet)(fmi_unique_id_t * p_unique_id);
148 
149     /** Get feature information and store it in p_info.
150      * @param[in]  p_feature  Definition of SSP feature.
151      * @param[out] p_info     Feature specific information.
152      *
153      * @par Implemented as
154      * - R_FMI_ProductFeatureGet()
155      **/
156     ssp_err_t (* productFeatureGet)(ssp_feature_t const * const p_feature, fmi_feature_info_t * const p_info);
157 
158     /** Get event information and store it in p_info.
159      * @param[in]  p_feature  Definition of SSP feature.
160      * @param[in]  signal     Feature signal ID.
161      * @param[out] p_info     Event information for feature signal.
162      *
163      * @par Implemented as
164      * - R_FMI_EventInfoGet()
165      **/
166     ssp_err_t (* eventInfoGet)(ssp_feature_t const * const p_feature, ssp_signal_t signal, fmi_event_info_t * const p_info);
167 
168     /** Get the driver version based on compile time macros.
169      * @par Implemented as
170      * - R_FMI_VersionGet()
171      **/
172     ssp_err_t (* versionGet)(ssp_version_t * const p_version);
173 } fmi_api_t;
174 
175 /** This structure encompasses everything that is needed to use an instance of this interface. */
176 typedef struct st_fmi_instance
177 {
178     fmi_api_t const * p_api;     ///< Pointer to the API structure for this instance
179 } fmi_instance_t;
180 
181 /* Common macro for SSP header files. There is also a corresponding SSP_HEADER macro at the top of this file. */
182 SSP_FOOTER
183 
184 #endif /* DRV_FMI_API_H */
185 
186 /*******************************************************************************************************************//**
187  * @} (end addtogroup FMI_API)
188  **********************************************************************************************************************/
189