1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __HAL_CMD_H__
5 #define __HAL_CMD_H__
6 
7 #include "stdint.h"
8 
9 // typedef enum {
10 //         HAL_CMD_ERR_NONE = 0x00,
11 //         HAL_CMD_ERR_LEN = 0x01,
12 //         HAL_CMD_ERR_CHECKSUM = 0x02,
13 //         HAL_CMD_ERR_NOT_SYNC = 0x03,
14 
15 //         HAL_CMD_ERR_CMD = 0x06,
16 
17 //         HAL_CMD_ERR_BURN_OK = 0x60,
18 //         HAL_CMD_ERR_SECTOR_SIZE = 0x61,
19 
20 //         HAL_CMD_ERR_BURN_INFO_MISSING = 0x63,
21 //         HAL_CMD_ERR_SECTOR_DATA_LEN = 0x64,
22 //         HAL_CMD_ERR_SECTOR_DATA_CRC = 0x65,
23 //         HAL_CMD_ERR_SECTOR_SEQ = 0x66,
24 //         HAL_CMD_ERR_ERASE_FLSH = 0x67,
25 //         HAL_CMD_ERR_BURN_FLSH = 0x68,
26 // } HAL_CMD_ERR_T;
27 
28 // typedef enum {
29 //         HAL_CMD_GET_PARA = 0x00,
30 //         HAL_CMD_SET_PARA,
31 //         HAL_CMD_SAVE_PARA,
32 //         HAL_CMD_PUSH_PARA,
33 
34 //         HAL_CMD_PLAYBACK_SWITCH = 0x08,
35 //         HAL_CMD_CAPTURE_SWITCH,
36 
37 //         HAL_CMD_BURN_HANDSHAKE = 0x10,
38 //         HAL_CMD_BURN_START,
39 //         HAL_CMD_BURN_DATA,
40 
41 //         HAL_CMD_HANDSHAKE = 0x18,
42 //         HAL_CMD_SHUTDOWN,
43 //         HAL_CMD_REBOOT,
44 //         HAL_CMD_NOTIFICATION,
45 
46 //         HAL_CMD_INVALID = 0xff
47 // } EL_CMD_E;
48 
49 // typedef enum {
50 //         HAL_CMD_PARA_SOUND_VOLUME,
51 //         HAL_CMD_PARA_LC_SWITCH,
52 //         HAL_CMD_PARA_EQ_GAIN,
53 //         HAL_CMD_PARA_ANC_SWITCH,
54 //         HAL_CMD_PARA_ANC_GAIN,
55 
56 //         HAL_CMD_PARA_INVALID
57 // } EL_PARA_E;
58 
59 typedef enum {
60     HAL_CMD_RX_START,
61     HAL_CMD_RX_STOP,
62     HAL_CMD_RX_DONE
63 } hal_cmd_rx_status_t;
64 
65 typedef int (*hal_cmd_callback_t)(uint8_t *buf, uint32_t  len);
66 typedef void (*CMD_CALLBACK_HANDLER_T)(hal_cmd_rx_status_t status);
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 int hal_cmd_init (void);
72 int hal_cmd_open (void);
73 int hal_cmd_close (void);
74 
75 #ifdef USB_AUDIO_APP
76 void hal_cmd_run (hal_cmd_rx_status_t status);
77 #else
78 int hal_cmd_run (hal_cmd_rx_status_t status);
79 #endif
80 void hal_cmd_set_callback(CMD_CALLBACK_HANDLER_T handler);
81 int hal_cmd_register(char *name, hal_cmd_callback_t callback);
82 
83 #ifdef USB_EQ_TUNING
84 int hal_cmd_list_process(uint8_t *buf);
85 void hal_cmd_tx_process (uint8_t** ppbuf, uint16_t* plen);
86 #endif
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 // hal_cmd_t *hal_cmd_get_ptr(void);
92 
93 #endif