• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  ****************************************************************************************
18  *
19  * @file sonata_ble_hook.h
20  *
21  * @brief Header file - This file contains application specific hooks
22  *
23  ****************************************************************************************
24  */
25 
26 #ifndef _SONATA_BLE_HOOK_H_
27 #define _SONATA_BLE_HOOK_H_
28 
29 #include <stdint.h>    // standard integer definition
30 
31 /*
32  * TYPEDEF
33  *****************************************************************************************
34  */
35 typedef void (*PF_APP_INIT)(void);
36 typedef void (*PF_PLF_RESET)(uint32_t error);
37 typedef uint16_t (*PF_GET_STACK_USAGE)(void);
38 typedef int (*PF_PRINTF)(const char *format, ...);
39 typedef void (*PF_APP_PRF_API_INIT)(void);
40 
41 typedef struct sonata_ble_hook {
42 #ifdef CFG_PLF_SONATA
43     void (*pf_assert_err)(uint16_t id, int cond);
44     void (*pf_assert_param)(uint16_t id, int param0, int param1);
45     void (*pf_assert_warn)(uint16_t id, int param0, int param1);
46 #endif // CFG_PLF_SONATA
47 
48 #ifdef CFG_PLF_DUET
49     void (*pf_assert_err)(int cond);
50     void (*pf_assert_param)(int param0, int param1);
51     void (*pf_assert_warn)(int param0, int param1);
52 #endif // CFG_PLF_DUET
53 
54     PF_APP_INIT pf_app_init;
55     PF_PLF_RESET pf_platform_reset;
56     PF_GET_STACK_USAGE pf_get_stack_usage;
57     PF_PRINTF pf_printf;
58     PF_APP_PRF_API_INIT pf_app_prf_api_init;
59 
60 #ifdef SONATA_RTOS_SUPPORT
61     int (*pf_init_semaphore)(void **semaphore, int value);
62     int (*pf_get_semaphore)(void **semaphore, uint32_t timeout_ms);
63     int (*pf_set_semaphore)(void **semaphore);
64 #endif // (SONATA_RTOS_SUPPORT)
65 } sonata_ble_hook_t;
66 
67 /*
68  * VARIABLE DECLARATION
69  *****************************************************************************************
70  */
71 extern void (*pf_sonata_assert_err)(uint16_t id, int cond);
72 extern void (*pf_sonata_assert_param)(uint16_t id, int param0, int param1);
73 extern void (*pf_sonata_assert_warn)(uint16_t id, int param0, int param1);
74 extern PF_APP_INIT pf_app_init;
75 extern PF_PLF_RESET pf_platform_reset;
76 extern PF_GET_STACK_USAGE pf_get_stack_usage;
77 extern PF_PRINTF pf_printf;
78 extern PF_APP_PRF_API_INIT pf_app_prf_api_init;
79 
80 /*
81  * FUNCTION DECLARATION
82  *****************************************************************************************
83  */
84 extern void sonata_ble_hook_register(sonata_ble_hook_t hook);
85 
86 #endif // _SONATA_BLE_HOOK_H_
87 
88