1 /*******************************************************************************
2 * \file cybt_prm.c
3 *
4 * \brief
5 * Provides API to download BT firmware.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2018-2019 Cypress Semiconductor Corporation
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 *     http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *******************************************************************************/
24 
25 #ifndef CYBT_PRM_H
26 #define CYBT_PRM_H
27 
28 /*****************************************************************************
29  *                           Type Definitions
30  *****************************************************************************/
31 /**
32  * Patch ram download status
33  */
34 enum
35 {
36     CYBT_PRM_STS_CONTINUE = 0,
37     CYBT_PRM_STS_COMPLETE,
38     CYBT_PRM_STS_ABORT
39 };
40 typedef uint8_t cybt_prm_status_t;
41 
42 /**
43  * patch ram format type
44  */
45 #define CYBT_PRM_FORMAT_BIN    0x00
46 #define CYBT_PRM_FORMAT_HCD    0x01
47 typedef uint8_t cybt_prm_format_t;
48 
49 /**
50  * Patch ram download status callback
51  *
52  * @param[out]    status : download status
53  *
54  * @returns       void
55  */
56 typedef void (cybt_prm_cback_t) (cybt_prm_status_t status);
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 /*****************************************************************************
64  *                           Function Declarations
65  *****************************************************************************/
66 
67 /**
68  * Register patch ram callback, and start the patch ram
69  *                  download process.
70  * @param[in]      p_cb          : callback for download status
71  * @param[in]      p_patch_buf   : address of patch ram buffer
72  * @param[in]      patch_buf_len : length of patch ram buffer
73  * @param[in]      address       : address of patch ram to be written,
74  * @param[in]      format_type   : patch format type ( bin, hcd ...)
75  * @param[in]      download_mini_drv  : enable to download minidriver
76  *
77  * @returns        true if successful,
78  *                 false otherwise
79  *
80  */
81 bool cybt_prm_download (cybt_prm_cback_t *p_cb,
82                         const uint8_t *p_patch_buf,
83                         uint32_t patch_buf_len,
84                         uint32_t address,
85                         uint8_t  format_type,
86                         bool download_mini_drv
87                         );
88 
89 #ifdef __cplusplus
90 } /* extern "C" */
91 #endif
92 
93 #endif
94 
95