1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef VIBRATOR_DRIVER_H 10 #define VIBRATOR_DRIVER_H 11 12 #include "osal_mutex.h" 13 #include "hdf_device_desc.h" 14 #include "hdf_workqueue.h" 15 #include "vibrator_driver_type.h" 16 17 struct VibratorOps { 18 int32_t (*Start)(void); 19 int32_t (*StartEffect)(uint32_t effectType); 20 int32_t (*Stop)(void); 21 }; 22 23 typedef int32_t (*VibratorCmdHandle)(struct HdfSBuf *reqData, struct HdfSBuf *reply); 24 25 struct VibratorCmdHandleList { 26 int32_t cmd; 27 VibratorCmdHandle func; 28 }; 29 30 struct VibratorDriverData { 31 struct IDeviceIoService ioService; 32 struct HdfDeviceObject *device; 33 HdfWorkQueue workQueue; 34 HdfWork work; 35 struct OsalMutex mutex; 36 enum VibratorConfigMode mode; 37 enum VibratorState state; 38 struct VibratorOps ops; 39 }; 40 41 void StartTimeVibrator(void); 42 void StopVibrator(void); 43 void SetEffectVibrator(uint32_t type); 44 int32_t RegisterVibrator(struct VibratorOps *ops); 45 46 #endif /* VIBRATOR_DRIVER_H */ 47