lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /***********************************************************************
|
| 2 | * Copyright (C) 2001, ZTE Corporation.
|
| 3 | *
|
| 4 | * File Name: earpiece_api.h
|
| 5 | * File Mark:
|
| 6 | * Description: Provide earpiece module function prototype declaration and type declaration.
|
| 7 | * Others:
|
| 8 | * Version: v0.5
|
| 9 | * Author: LvWenhua
|
| 10 | * Date: 2007-10-25
|
| 11 | *
|
| 12 | * History 1:
|
| 13 | * Date:
|
| 14 | * Version:
|
| 15 | * Author:
|
| 16 | * Modification:
|
| 17 | * History 2:
|
| 18 | **********************************************************************/
|
| 19 |
|
| 20 | #ifndef _EARPIECE_API_H
|
| 21 | #define _EARPIECE_API_H
|
| 22 |
|
| 23 | /**************************************************************************
|
| 24 | * Include files *
|
| 25 | **************************************************************************/
|
| 26 |
|
| 27 | /**************************************************************************
|
| 28 | * Macro *
|
| 29 | **************************************************************************/
|
| 30 | #define ZDRV_DEV_EARP "earpiece" /*The device name of earpiece driver.*/
|
| 31 |
|
| 32 | /**************************************************************************
|
| 33 | * Types *
|
| 34 | **************************************************************************/
|
| 35 | /*Information from driver to upper application.*/
|
| 36 | typedef enum {
|
| 37 | EARP_INFO_PLUG = 0, /*Earpiece is plugged.*/
|
| 38 | EARP_INFO_UNPLUG , /*Earpiece is unplugged.*/
|
| 39 | EARP_INFO_HOOK_SWITCH , /*Earpiece hook key is pressed and released.*/
|
| 40 |
|
| 41 | MAX_EARP_INFO
|
| 42 | } T_ZDrvEarp_Info;
|
| 43 |
|
| 44 | typedef enum {
|
| 45 | EARP_STATE_PLUG = 0, /*Earpiece is plugged.*/
|
| 46 | EARP_STATE_UNPLUG , /*Earpiece is unplugged.*/
|
| 47 |
|
| 48 | MAX_EARP_STATE
|
| 49 | } T_ZDrvEarp_State;
|
| 50 |
|
| 51 | typedef void (*T_ZDrvEarp_CallbackFunc) (T_ZDrvEarp_Info);
|
| 52 |
|
| 53 | #if 0
|
| 54 | typedef enum
|
| 55 | {
|
| 56 | IOCTL_EARP_SET_CALLBACK = 0, /*Set callback function, it is used to register the callback function which will send the earpiece switch status to user.*/
|
| 57 | IOCTL_EARP_GET_PLUG_STATUS , /*Get earpiece plug status, replace the read function.*/
|
| 58 | IOCTL_EARP_SET_HOOK_ENABLE,
|
| 59 | IOCTL_EARP_SET_HOOK_DISABLE,
|
| 60 | MAX_IOCTL_EARP
|
| 61 | }T_ZDrvEarp_IoCtl;
|
| 62 | #endif
|
| 63 |
|
| 64 | /**************************************************************************
|
| 65 | * Global Variable *
|
| 66 | **************************************************************************/
|
| 67 |
|
| 68 | /**************************************************************************
|
| 69 | * Function Prototypes *
|
| 70 | **************************************************************************/
|
| 71 |
|
| 72 | /**************************************************************************
|
| 73 | * Function: zDrv_Open
|
| 74 | * Description: This function is used to open device according to device name.
|
| 75 | * Parameters:
|
| 76 | * Input:
|
| 77 | pathname:device name, ZDRV_DEV_EARP in earpiece
|
| 78 | * flags: no use, 0
|
| 79 | * Output: None
|
| 80 | * Returns:
|
| 81 | * device file descriptor if successed. [1, ZDRV_MAX_DEV_FILE_NUM), please refer to dal_api.h
|
| 82 | * DRV_ERR_NO_THIS_DEVICE: this device hasn't been installed yet
|
| 83 | * DRV_ERR_FD_OVERFLOW: no free fd entry
|
| 84 | * DRV_ERR_NOT_SUPPORTED: this device don't support open operation.
|
| 85 | * DRV_ERR_OPEN_TIMES: has been opened already.
|
| 86 | * others: others error code. for detailed information, please refer to the header file of hal layer
|
| 87 | * Others: None
|
| 88 | **************************************************************************/
|
| 89 | /*SINT32 zDrv_Open (const CHAR *pathname, SINT32 flags)*/
|
| 90 |
|
| 91 | /**************************************************************************
|
| 92 | * Function: zDrv_Close
|
| 93 | * Description: This function is used to close a device according to device file descriptor.
|
| 94 | * Parameters:
|
| 95 | * Input:
|
| 96 | * fd :device file descriptor
|
| 97 | * Output:None
|
| 98 | * Returns:
|
| 99 | * DRV_SUCCESS: successed.
|
| 100 | * DRV_ERR_NOT_OPENED: has not been opend yet.
|
| 101 | * DRV_ERR_FD_TABLE: device driver table has been invalid.
|
| 102 | * DRV_ERR_NOT_SUPPORTED: this device don't support close operation.
|
| 103 | * others: others error code. for detailed information, please refer to the header file of hal layer
|
| 104 | * Others: None
|
| 105 | **************************************************************************/
|
| 106 | /*SINT32 zDrv_Close(UINT32 fd)*/
|
| 107 |
|
| 108 | /**************************************************************************
|
| 109 | * Function: zDrv_Ioctl
|
| 110 | * Description: This function is used to control device according to fd(device file descriptor).
|
| 111 | * Parameters:
|
| 112 | * Input:
|
| 113 | * fd:device file descriptor
|
| 114 | * cmd:command code
|
| 115 | * arg:command parameters
|
| 116 | * Output:None
|
| 117 | * Returns:
|
| 118 | * DRV_SUCCESS: successed.
|
| 119 | * DRV_ERR_INVALID_PARAM: the input parameters are invalid
|
| 120 | * DRV_ERR_NOT_OPENED: has not been opend yet.
|
| 121 | * DRV_ERR_FD_TABLE: device driver table has been invalid.
|
| 122 | * DRV_ERR_NOT_SUPPORTED: this device don't support ioctrl operation.
|
| 123 | * DRV_ERR_INVALID_IOCTL_CMD: this command has not been supported yet.
|
| 124 | * others: for detailed information, please refer to the header file of hal layer
|
| 125 | *
|
| 126 | * Others: None
|
| 127 | **************************************************************************/
|
| 128 | /*SINT32 zDrv_Ioctl(UINT32 fd, UINT32 cmd, VOID* arg)*/
|
| 129 |
|
| 130 | /**************************************************************************
|
| 131 | * Function: zDrvEarp_Init
|
| 132 | * Description: This function is used to install earpiece driver.
|
| 133 | * Parameters:
|
| 134 | * Input:None
|
| 135 | * Output:None
|
| 136 | * Returns:
|
| 137 | * DRV_SUCCESS: successed.
|
| 138 | * DRV_ERROR: error
|
| 139 | * DRV_ERR_DEV_OVERFLOW: no free device driver entry in table
|
| 140 | * DRV_ERR_MEM_ALLOC: failed to alloc memory
|
| 141 | * Others: None
|
| 142 | **************************************************************************/
|
| 143 | SINT32 zDrvEarp_Init(VOID);
|
| 144 |
|
| 145 | /**************************************************************************
|
| 146 | * Function: zDrvEarp_Exit
|
| 147 | * Description: This function is used to uninstall earpiece driver.
|
| 148 | * Parameters:
|
| 149 | * Input:None
|
| 150 | * Output:None
|
| 151 | * Returns:
|
| 152 | * DRV_SUCCESS: successed.
|
| 153 | * DRV_ERROR: error
|
| 154 | * DRV_ERR_DEV_TABLE: device driver table has been invalid.
|
| 155 | * DRV_ERR_NO_THIS_DEVICE: this device hasn't been installed yet
|
| 156 | * Others: None
|
| 157 | **************************************************************************/
|
| 158 | SINT32 zDrvEarp_Exit(VOID);
|
| 159 |
|
| 160 | #endif /* _EARPIECE_API_H */
|
| 161 |
|