Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources
This commit is contained in:
99
sdk/include/dev/tk/hg_touchKey.h
Normal file
99
sdk/include/dev/tk/hg_touchKey.h
Normal file
@@ -0,0 +1,99 @@
|
||||
#ifndef __HG_TOUCHKEY_H
|
||||
#define __HG_TOUCHKEY_H
|
||||
enum tk_ioctl_cmd
|
||||
{
|
||||
//硬件寄存器配置
|
||||
TK_IOCTL_CSRST_SET,
|
||||
TK_IOCTL_CMPEN_SET,
|
||||
TK_IOCTL_CMPRB_SET,
|
||||
TK_IOCTL_RES_SET,
|
||||
TK_IOCTL_CURR_SET,
|
||||
TK_IOCTL_ANA_TEN_SET,
|
||||
TK_IOCTL_VOLT_REF_SET,
|
||||
TK_IOCTL_PSR_CNT_SET,
|
||||
TK_IOCTL_PRE_CHARGE_TIME,
|
||||
TK_IOCTL_PRE_DISCHARGE_TIME,
|
||||
TK_IOCTL_CONV_TIME,
|
||||
TK_IOCTL_CHANNLE_MODE,
|
||||
TK_IOCTL_CHARGE_FRE_DIV,
|
||||
TK_IOCTL_CHARGE_FRE0_DIV,
|
||||
TK_IOCTL_CHARGE_FRE1_DIV,
|
||||
TK_IOCTL_CHARGE_FRE2_DIV,
|
||||
TK_IOCTL_CHARGE_FRE3_DIV,
|
||||
TK_IOCTL_SHIELD_SET,
|
||||
TK_IOCTL_SSC_BW,
|
||||
TK_IOCTL_SSC_TYPE_SEL,
|
||||
TK_IOCTL_AUTO_SCAN_EN,
|
||||
TK_IOCTL_ADDR_SET,
|
||||
TK_IOCTL_KICK,
|
||||
|
||||
//算法参数配置
|
||||
TK_IOCTL_ADJUST_TIME,
|
||||
TK_IOCTL_LONG_KEY_TIME,
|
||||
TK_IOCTL_ADJUST_LINE,
|
||||
TK_IOCTL_ADJUST_DIFF_VALU,
|
||||
TK_IOCTL_USE_NUM,
|
||||
TK_IOCTL_WATER_MODE,
|
||||
TK_IOCTL_NM_NUM,
|
||||
TK_IOCTL_NM_LEAVE_CNT,
|
||||
TK_IOCTL_TP_EN,
|
||||
TK_IOCTL_NOISE_VALUE,
|
||||
TK_IOCTL_NM_CM_CNT,
|
||||
TK_IOCTL_NM_CM_VALUE,
|
||||
|
||||
//系统级别的配置(类似信号量,timer等等)
|
||||
TK_SCAN_SEM_HANDL,
|
||||
TK_TIMER_HANDL,
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum tk_irq_flag
|
||||
{
|
||||
TK_SG_CONV_FLAG = BIT(0),
|
||||
TK_CH_DONE_FLAG = BIT(1),
|
||||
TK_SCAN_DONE_FLAG = BIT(2),
|
||||
TK_DMA_FLAG = BIT(3),
|
||||
TK_DMA_ERR_FLAG = BIT(4),
|
||||
};
|
||||
typedef int32 (*tk_irq_hdl)(uint32 irq, uint32 irq_data, uint32 param1, uint32 param2);
|
||||
|
||||
struct tk_device {
|
||||
struct dev_obj dev;
|
||||
int32(*open)(struct tk_device *tk);
|
||||
int32(*close)(struct tk_device *tk);
|
||||
int32(*ioctl)(struct tk_device *tk, uint32 cmd, uint32 param1, uint32 param2);
|
||||
int32(*request_irq)(struct tk_device *tk, enum tk_irq_flag irq_flag, tk_irq_hdl irq_hdl, uint32 data);
|
||||
int32(*release_irq)(struct tk_device *tk, enum tk_irq_flag irq_flag);
|
||||
};
|
||||
|
||||
//tk算法私有结构体
|
||||
struct hgtk_algorithm
|
||||
{
|
||||
uint16 __tk_adjust_time;
|
||||
uint16 __tk_valid_time;
|
||||
uint16 __tk_adjust_line;
|
||||
uint16 __tk_adjust_diff_valu;
|
||||
uint16 __tk_use_num;
|
||||
uint16 __tk_water_mode;
|
||||
uint16 __tk_nm_num;
|
||||
uint16 __tk_nm_leave_cnt;
|
||||
uint16 __tk_tp_en;
|
||||
uint16 __tk_noise_value;
|
||||
uint16 __tk_nm_cm_cnt;
|
||||
uint16 __tk_nm_cm_value;
|
||||
};
|
||||
|
||||
struct hgtk_device {
|
||||
struct tk_device dev ;
|
||||
uint32 hw ;
|
||||
tk_irq_hdl irq_hdl ;
|
||||
uint32 irq_data;
|
||||
uint32 irq_num ;
|
||||
uint32 opened ;
|
||||
void* timer;
|
||||
void* sem;
|
||||
struct hgtk_algorithm tk_pri;
|
||||
};
|
||||
|
||||
#endif
|
||||
123
sdk/include/dev/tk/hg_touchkey_v2.h
Normal file
123
sdk/include/dev/tk/hg_touchkey_v2.h
Normal file
@@ -0,0 +1,123 @@
|
||||
#ifndef _HGTOUCHKEY_V2_H
|
||||
#define _HGTOUCHKEY_V2_H
|
||||
#include "hal/tk.h"
|
||||
#include "osal/work.h"
|
||||
//#include "../driver/tk/hg_touchkey_v2_hw.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef union _u_16 {
|
||||
uint16 w;
|
||||
struct {
|
||||
uint8 h;
|
||||
uint8 l;
|
||||
} b;
|
||||
} TYPE_U16;
|
||||
|
||||
typedef union _s_16 {
|
||||
int16 w;
|
||||
struct {
|
||||
uint8 h;
|
||||
uint8 l;
|
||||
} b;
|
||||
} TYPE_S16;
|
||||
|
||||
typedef struct _DW {
|
||||
TYPE_S16 MSW;
|
||||
TYPE_U16 LSW;
|
||||
} TYPE_DW;
|
||||
|
||||
typedef union _u_32 {
|
||||
uint32 w;
|
||||
struct {
|
||||
uint8 h_32;
|
||||
uint8 h_24;
|
||||
uint8 l_16;
|
||||
uint8 l_8;
|
||||
} b;
|
||||
} TYPE_u32;
|
||||
|
||||
typedef union _u_32_bit {
|
||||
uint32 w;
|
||||
struct {
|
||||
uint16 count;
|
||||
uint16 scan_done_pend : 1,
|
||||
data_normal_flag : 1,
|
||||
baseline_int_flag :1,
|
||||
cal_finsh_flag : 1,
|
||||
adjust_done_peng : 1,
|
||||
reserved : 11;
|
||||
} b;
|
||||
} TYPE_U32_BIT;
|
||||
|
||||
typedef enum {
|
||||
TK_INIT = 0,
|
||||
ADJUST_DONE,
|
||||
DATA_INIT_DONE,
|
||||
SCAN_DONE,
|
||||
RE_ADJUST_DONE,
|
||||
} TYPE_ENUM_STA;
|
||||
|
||||
typedef struct {
|
||||
int16 b[3]; // 分子多项式的系数Numerator
|
||||
int16 a[2]; // 分母多项式的系数Denominator
|
||||
int16 fixed_point_num; // 移位bit数
|
||||
} TYPE_BIQUAD_FILTER;
|
||||
|
||||
struct hgtk_algor{
|
||||
uint8 __tk_long_key_flag;
|
||||
uint8 __tk_ch_inc_flag;
|
||||
uint8 __tk_mult_confirm_cnt;
|
||||
uint8 __tk_noise_confirm_cnt;
|
||||
uint8 __tk_next;
|
||||
uint8 __tk_cm_cnt;
|
||||
uint8 __tk_muli_key_cnt;
|
||||
uint8 __tk_mult_noise_cnt;
|
||||
int16 __tk_data_temp;
|
||||
uint16 __tk_ms_cnt;
|
||||
uint32 __tk_ch_en;
|
||||
uint32 __tk_key_debug_flag;
|
||||
uint32 __tk_key_flag;
|
||||
uint32 __tk_key_flag_temp;
|
||||
uint32 __tk_key_data;
|
||||
|
||||
TYPE_DW MUL_RES_1 ; // 4byte
|
||||
TYPE_DW MUL_RES_2 ;
|
||||
TYPE_DW MUL_RES_3 ;
|
||||
TYPE_u32 UNION_ADDR;
|
||||
TYPE_BIQUAD_FILTER iir_param;
|
||||
TYPE_ENUM_STA __tk_run_sta;
|
||||
TYPE_U32_BIT __tk_flag;
|
||||
};
|
||||
|
||||
|
||||
struct hgtouchkey_v2 {
|
||||
struct tk_device dev;
|
||||
uint32 hw;
|
||||
uint32 alg;
|
||||
tk_irq_hdl irq_hdl;
|
||||
uint32 irq_data;
|
||||
uint32 irq_num;
|
||||
uint32 opened:1, dsleep:1, printf_flag:1;
|
||||
uint32 tk_config;
|
||||
struct os_work tk_kick_work;
|
||||
struct os_work tk_scan_work;
|
||||
struct hgtk_algor tk_algori;
|
||||
|
||||
#ifdef CONFIG_SLEEP
|
||||
uint32 *bp_regs;
|
||||
uint32 bp_irq_flags;
|
||||
os_mutex_t bp_suspend_lock;
|
||||
os_mutex_t bp_resume_lock;
|
||||
#endif
|
||||
};
|
||||
|
||||
int32 hgtouchkey_v2_attach(uint32 dev_id, struct hgtouchkey_v2 *touchkey);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
52
sdk/include/dev/tk/tk_simplify_algorithm.h
Normal file
52
sdk/include/dev/tk/tk_simplify_algorithm.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tk_simplify_algorithm.h
|
||||
* @author TAIXIN-IC Application Team
|
||||
* @version V1.0.0
|
||||
* @date 01-05-2021
|
||||
* @brief This file contains all the GPIO LL firmware functions.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 用户不允许修改
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __LIB_TK_ALGORITHM_H
|
||||
#define __LIB_TK_ALGORITHM_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "dev/tk/hg_touchkey_v2.h"
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
// 用户不允许修改
|
||||
extern void __tk_lib_init(struct hgtouchkey_v2 *tk);
|
||||
extern int32 __tk_scan(struct os_work *work);
|
||||
extern int32 __tk_ms_handler(struct os_work *work);
|
||||
|
||||
#define __CPU_NOP() {__NOP(); __NOP(); __NOP(); __NOP();}
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __LIB_TK_ALGORITHM_H__
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*************************** (C) COPYRIGHT 2021 TAIXIN-IC ***** END OF FILE ****/
|
||||
Reference in New Issue
Block a user