1 #ifndef _INTERFACE_H_
2 #define _INTERFACE_H_
3 
4 #include "ble_arch.h"
5 #include "Eif_debug.h"
6 #include <stdbool.h>
7 
8 #define BLEINFO_ADDR        0X801C800
9 ///Base address of Flash on system bus
10 #define FLASH_BASE_ADDR         (BLEINFO_ADDR)
11 #define FLASH_BLE_SIZE          (0x0400)
12 
13 
14 const struct rwip_eif_api *rwip_eif_get(uint8_t );
15 void        eif_delay_us(uint32_t);
16 void        eif_delay_ms(uint32_t);
17 
18 
19 void        ble_system_Init(void);
20 bool        wait_for_status_enable(void);
21 
22 
23 enum read_state
24 {
25     READ_STATE_RX_START,
26     READ_STATE_RX_HDR,
27     READ_STATE_RX_PAYL,
28     READ_STATE_RX_OUT_OF_SYNC
29 };
30 
31 extern uint8_t read_state_flag;
32 
33 struct interface_sys_tag
34 {
35     //timer
36     void        (*set_timesout)(uint32_t to);
37     uint32_t    (*get_time)(void);
38     void        (*enable_timer)(bool enable);
39 
40    ///flash
41     void        (*flash_init)(void);
42     uint8_t     (*flash_erase)( uint32_t offset, uint32_t size);
43     uint8_t     (*flash_write)(uint32_t offset, uint32_t length, uint8_t *buffer);
44     uint8_t     (*falsh_read)( uint32_t offset, uint32_t length, uint8_t *buffer);
45 
46    ///feature init
47     void        (*user_feature_init)(void);
48 };
49 extern struct interface_sys_tag interface_sys;
50 
51 
52 
53 void SetIPR(uint8_t num,uint8_t pri);
54 
55 int32_t ble_interface_init(void);
56 int32_t ble_hardware_init(void);
57 
58 int32_t ble_initdata_down(void);
59 int32_t ble_host_init(void);
60 int32_t ble_hardware_reinit(void);
61 
62 #endif // _INTERFACE_H_
63 
64