// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _SOC_PCNT_STRUCT_H_
#define _SOC_PCNT_STRUCT_H_
typedefvolatilestruct{
struct{
union{
struct{
uint32_tfilter_thres:10;/*This register is used to filter pulse whose width is smaller than this value for unit0.*/
uint32_tfilter_en:1;/*This is the enable bit for filtering input signals for unit0.*/
uint32_tthr_zero_en:1;/*This is the enable bit for comparing unit0's count with 0 value.*/
uint32_tthr_h_lim_en:1;/*This is the enable bit for comparing unit0's count with thr_h_lim value.*/
uint32_tthr_l_lim_en:1;/*This is the enable bit for comparing unit0's count with thr_l_lim value.*/
uint32_tthr_thres0_en:1;/*This is the enable bit for comparing unit0's count with thres0 value.*/
uint32_tthr_thres1_en:1;/*This is the enable bit for comparing unit0's count with thres1 value .*/
uint32_tch0_neg_mode:2;/*This register is used to control the mode of channel0's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/
uint32_tch0_pos_mode:2;/*This register is used to control the mode of channel0's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/
uint32_tch0_hctrl_mode:2;/*This register is used to control the mode of channel0's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
uint32_tch0_lctrl_mode:2;/*This register is used to control the mode of channel0's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
uint32_tch1_neg_mode:2;/*This register is used to control the mode of channel1's input neg-edge signal for unit0. 2'd1:increase at the negedge of input signal 2'd2:decrease at the negedge of input signal others:forbidden*/
uint32_tch1_pos_mode:2;/*This register is used to control the mode of channel1's input pos-edge signal for unit0. 2'd1:increase at the posedge of input signal 2'd2:decrease at the posedge of input signal others:forbidden*/
uint32_tch1_hctrl_mode:2;/*This register is used to control the mode of channel1's high control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
uint32_tch1_lctrl_mode:2;/*This register is used to control the mode of channel1's low control signal for unit0. 2'd0:increase when control signal is low 2'd1:decrease when control signal is high others:forbidden*/
};
uint32_tval;
}conf0;
union{
struct{
uint32_tcnt_thres0:16;/*This register is used to configure thres0 value for unit0.*/
uint32_tcnt_thres1:16;/*This register is used to configure thres1 value for unit0.*/
};
uint32_tval;
}conf1;
union{
struct{
uint32_tcnt_h_lim:16;/*This register is used to configure thr_h_lim value for unit0.*/
uint32_tcnt_l_lim:16;/*This register is used to configure thr_l_lim value for unit0.*/
};
uint32_tval;
}conf2;
}conf_unit[8];
union{
struct{
uint32_tcnt_val:16;/*This register stores the current pulse count value for unit0.*/
uint32_treserved16:16;
};
uint32_tval;
}cnt_unit[8];
union{
struct{
uint32_tcnt_thr_event_u0:1;/*This is the interrupt raw bit for channel0 event.*/
uint32_tcnt_thr_event_u1:1;/*This is the interrupt raw bit for channel1 event.*/
uint32_tcnt_thr_event_u2:1;/*This is the interrupt raw bit for channel2 event.*/
uint32_tcnt_thr_event_u3:1;/*This is the interrupt raw bit for channel3 event.*/
uint32_tcnt_thr_event_u4:1;/*This is the interrupt raw bit for channel4 event.*/
uint32_tcnt_thr_event_u5:1;/*This is the interrupt raw bit for channel5 event.*/
uint32_tcnt_thr_event_u6:1;/*This is the interrupt raw bit for channel6 event.*/
uint32_tcnt_thr_event_u7:1;/*This is the interrupt raw bit for channel7 event.*/
uint32_treserved8:24;
};
uint32_tval;
}int_raw;
union{
struct{
uint32_tcnt_thr_event_u0:1;/*This is the interrupt status bit for channel0 event.*/
uint32_tcnt_thr_event_u1:1;/*This is the interrupt status bit for channel1 event.*/
uint32_tcnt_thr_event_u2:1;/*This is the interrupt status bit for channel2 event.*/
uint32_tcnt_thr_event_u3:1;/*This is the interrupt status bit for channel3 event.*/
uint32_tcnt_thr_event_u4:1;/*This is the interrupt status bit for channel4 event.*/
uint32_tcnt_thr_event_u5:1;/*This is the interrupt status bit for channel5 event.*/
uint32_tcnt_thr_event_u6:1;/*This is the interrupt status bit for channel6 event.*/
uint32_tcnt_thr_event_u7:1;/*This is the interrupt status bit for channel7 event.*/
uint32_treserved8:24;
};
uint32_tval;
}int_st;
union{
struct{
uint32_tcnt_thr_event_u0:1;/*This is the interrupt enable bit for channel0 event.*/
uint32_tcnt_thr_event_u1:1;/*This is the interrupt enable bit for channel1 event.*/
uint32_tcnt_thr_event_u2:1;/*This is the interrupt enable bit for channel2 event.*/
uint32_tcnt_thr_event_u3:1;/*This is the interrupt enable bit for channel3 event.*/
uint32_tcnt_thr_event_u4:1;/*This is the interrupt enable bit for channel4 event.*/
uint32_tcnt_thr_event_u5:1;/*This is the interrupt enable bit for channel5 event.*/
uint32_tcnt_thr_event_u6:1;/*This is the interrupt enable bit for channel6 event.*/
uint32_tcnt_thr_event_u7:1;/*This is the interrupt enable bit for channel7 event.*/
uint32_treserved8:24;
};
uint32_tval;
}int_ena;
union{
struct{
uint32_tcnt_thr_event_u0:1;/*Set this bit to clear channel0 event interrupt.*/
uint32_tcnt_thr_event_u1:1;/*Set this bit to clear channel1 event interrupt.*/
uint32_tcnt_thr_event_u2:1;/*Set this bit to clear channel2 event interrupt.*/
uint32_tcnt_thr_event_u3:1;/*Set this bit to clear channel3 event interrupt.*/
uint32_tcnt_thr_event_u4:1;/*Set this bit to clear channel4 event interrupt.*/
uint32_tcnt_thr_event_u5:1;/*Set this bit to clear channel5 event interrupt.*/
uint32_tcnt_thr_event_u6:1;/*Set this bit to clear channel6 event interrupt.*/
uint32_tcnt_thr_event_u7:1;/*Set this bit to clear channel7 event interrupt.*/