|
@@ -6,6 +6,214 @@
|
|
|
#define ADC_TRIGGER_ADC0_B ADC_TRIGGER_SYNC_ELC
|
|
|
#define ADC_TRIGGER_ADC1 ADC_TRIGGER_SYNC_ELC
|
|
|
#define ADC_TRIGGER_ADC1_B ADC_TRIGGER_SYNC_ELC
|
|
|
+gpt_instance_ctrl_t g_timer8_ctrl;
|
|
|
+#if 0
|
|
|
+const gpt_extended_pwm_cfg_t g_timer8_pwm_extend =
|
|
|
+{
|
|
|
+ .trough_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT8_COUNTER_UNDERFLOW)
|
|
|
+ .trough_irq = VECTOR_NUMBER_GPT8_COUNTER_UNDERFLOW,
|
|
|
+#else
|
|
|
+ .trough_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+ .poeg_link = GPT_POEG_LINK_POEG0,
|
|
|
+ .output_disable = GPT_OUTPUT_DISABLE_NONE,
|
|
|
+ .adc_trigger = GPT_ADC_TRIGGER_NONE,
|
|
|
+ .dead_time_count_up = 0,
|
|
|
+ .dead_time_count_down = 0,
|
|
|
+ .adc_a_compare_match = 0,
|
|
|
+ .adc_b_compare_match = 0,
|
|
|
+ .interrupt_skip_source = GPT_INTERRUPT_SKIP_SOURCE_NONE,
|
|
|
+ .interrupt_skip_count = GPT_INTERRUPT_SKIP_COUNT_0,
|
|
|
+ .interrupt_skip_adc = GPT_INTERRUPT_SKIP_ADC_NONE,
|
|
|
+ .gtioca_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtiocb_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+};
|
|
|
+#endif
|
|
|
+const gpt_extended_cfg_t g_timer8_extend =
|
|
|
+{
|
|
|
+ .gtioca = { .output_enabled = true,
|
|
|
+ .stop_level = GPT_PIN_LEVEL_LOW
|
|
|
+ },
|
|
|
+ .gtiocb = { .output_enabled = true,
|
|
|
+ .stop_level = GPT_PIN_LEVEL_LOW
|
|
|
+ },
|
|
|
+ .start_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .stop_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .clear_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .count_up_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .count_down_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_a_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_b_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_a_ipl = (BSP_IRQ_DISABLED),
|
|
|
+ .capture_b_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT8_CAPTURE_COMPARE_A)
|
|
|
+ .capture_a_irq = VECTOR_NUMBER_GPT8_CAPTURE_COMPARE_A,
|
|
|
+#else
|
|
|
+ .capture_a_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+#if defined(VECTOR_NUMBER_GPT8_CAPTURE_COMPARE_B)
|
|
|
+ .capture_b_irq = VECTOR_NUMBER_GPT8_CAPTURE_COMPARE_B,
|
|
|
+#else
|
|
|
+ .capture_b_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+ .capture_filter_gtioca = GPT_CAPTURE_FILTER_NONE,
|
|
|
+ .capture_filter_gtiocb = GPT_CAPTURE_FILTER_NONE,
|
|
|
+#if 0
|
|
|
+ .p_pwm_cfg = &g_timer8_pwm_extend,
|
|
|
+#else
|
|
|
+ .p_pwm_cfg = NULL,
|
|
|
+#endif
|
|
|
+#if 0
|
|
|
+ .gtior_setting.gtior_b.gtioa = (0U << 4U) | (0U << 2U) | (0U << 0U),
|
|
|
+ .gtior_setting.gtior_b.oadflt = (uint32_t) GPT_PIN_LEVEL_LOW,
|
|
|
+ .gtior_setting.gtior_b.oahld = 0U,
|
|
|
+ .gtior_setting.gtior_b.oae = (uint32_t) true,
|
|
|
+ .gtior_setting.gtior_b.oadf = (uint32_t) GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtior_setting.gtior_b.nfaen = ((uint32_t) GPT_CAPTURE_FILTER_NONE & 1U),
|
|
|
+ .gtior_setting.gtior_b.nfcsa = ((uint32_t) GPT_CAPTURE_FILTER_NONE >> 1U),
|
|
|
+ .gtior_setting.gtior_b.gtiob = (0U << 4U) | (0U << 2U) | (0U << 0U),
|
|
|
+ .gtior_setting.gtior_b.obdflt = (uint32_t) GPT_PIN_LEVEL_LOW,
|
|
|
+ .gtior_setting.gtior_b.obhld = 0U,
|
|
|
+ .gtior_setting.gtior_b.obe = (uint32_t) true,
|
|
|
+ .gtior_setting.gtior_b.obdf = (uint32_t) GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtior_setting.gtior_b.nfben = ((uint32_t) GPT_CAPTURE_FILTER_NONE & 1U),
|
|
|
+ .gtior_setting.gtior_b.nfcsb = ((uint32_t) GPT_CAPTURE_FILTER_NONE >> 1U),
|
|
|
+#else
|
|
|
+ .gtior_setting.gtior = 0U,
|
|
|
+#endif
|
|
|
+};
|
|
|
+const timer_cfg_t g_timer8_cfg =
|
|
|
+{
|
|
|
+ .mode = TIMER_MODE_PWM,
|
|
|
+ /* Actual period: 35.791394133333334 seconds. Actual duty: 50%. */ .period_counts = (uint32_t) 0x100000000, .duty_cycle_counts = 0x80000000, .source_div = (timer_source_div_t)0,
|
|
|
+ .channel = 8,
|
|
|
+ .p_callback = NULL,
|
|
|
+ /** If NULL then do not add & */
|
|
|
+#if defined(NULL)
|
|
|
+ .p_context = NULL,
|
|
|
+#else
|
|
|
+ .p_context = &NULL,
|
|
|
+#endif
|
|
|
+ .p_extend = &g_timer8_extend,
|
|
|
+ .cycle_end_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT8_COUNTER_OVERFLOW)
|
|
|
+ .cycle_end_irq = VECTOR_NUMBER_GPT8_COUNTER_OVERFLOW,
|
|
|
+#else
|
|
|
+ .cycle_end_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+};
|
|
|
+/* Instance structure to use this module. */
|
|
|
+const timer_instance_t g_timer8 =
|
|
|
+{
|
|
|
+ .p_ctrl = &g_timer8_ctrl,
|
|
|
+ .p_cfg = &g_timer8_cfg,
|
|
|
+ .p_api = &g_timer_on_gpt
|
|
|
+};
|
|
|
+gpt_instance_ctrl_t g_timer0_ctrl;
|
|
|
+#if 0
|
|
|
+const gpt_extended_pwm_cfg_t g_timer0_pwm_extend =
|
|
|
+{
|
|
|
+ .trough_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT0_COUNTER_UNDERFLOW)
|
|
|
+ .trough_irq = VECTOR_NUMBER_GPT0_COUNTER_UNDERFLOW,
|
|
|
+#else
|
|
|
+ .trough_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+ .poeg_link = GPT_POEG_LINK_POEG0,
|
|
|
+ .output_disable = GPT_OUTPUT_DISABLE_NONE,
|
|
|
+ .adc_trigger = GPT_ADC_TRIGGER_NONE,
|
|
|
+ .dead_time_count_up = 0,
|
|
|
+ .dead_time_count_down = 0,
|
|
|
+ .adc_a_compare_match = 0,
|
|
|
+ .adc_b_compare_match = 0,
|
|
|
+ .interrupt_skip_source = GPT_INTERRUPT_SKIP_SOURCE_NONE,
|
|
|
+ .interrupt_skip_count = GPT_INTERRUPT_SKIP_COUNT_0,
|
|
|
+ .interrupt_skip_adc = GPT_INTERRUPT_SKIP_ADC_NONE,
|
|
|
+ .gtioca_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtiocb_disable_setting = GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+};
|
|
|
+#endif
|
|
|
+const gpt_extended_cfg_t g_timer0_extend =
|
|
|
+{
|
|
|
+ .gtioca = { .output_enabled = true,
|
|
|
+ .stop_level = GPT_PIN_LEVEL_LOW
|
|
|
+ },
|
|
|
+ .gtiocb = { .output_enabled = false,
|
|
|
+ .stop_level = GPT_PIN_LEVEL_LOW
|
|
|
+ },
|
|
|
+ .start_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .stop_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .clear_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .count_up_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .count_down_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_a_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_b_source = (gpt_source_t) ( GPT_SOURCE_NONE),
|
|
|
+ .capture_a_ipl = (BSP_IRQ_DISABLED),
|
|
|
+ .capture_b_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT0_CAPTURE_COMPARE_A)
|
|
|
+ .capture_a_irq = VECTOR_NUMBER_GPT0_CAPTURE_COMPARE_A,
|
|
|
+#else
|
|
|
+ .capture_a_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+#if defined(VECTOR_NUMBER_GPT0_CAPTURE_COMPARE_B)
|
|
|
+ .capture_b_irq = VECTOR_NUMBER_GPT0_CAPTURE_COMPARE_B,
|
|
|
+#else
|
|
|
+ .capture_b_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+ .capture_filter_gtioca = GPT_CAPTURE_FILTER_NONE,
|
|
|
+ .capture_filter_gtiocb = GPT_CAPTURE_FILTER_NONE,
|
|
|
+#if 0
|
|
|
+ .p_pwm_cfg = &g_timer0_pwm_extend,
|
|
|
+#else
|
|
|
+ .p_pwm_cfg = NULL,
|
|
|
+#endif
|
|
|
+#if 0
|
|
|
+ .gtior_setting.gtior_b.gtioa = (0U << 4U) | (0U << 2U) | (0U << 0U),
|
|
|
+ .gtior_setting.gtior_b.oadflt = (uint32_t) GPT_PIN_LEVEL_LOW,
|
|
|
+ .gtior_setting.gtior_b.oahld = 0U,
|
|
|
+ .gtior_setting.gtior_b.oae = (uint32_t) true,
|
|
|
+ .gtior_setting.gtior_b.oadf = (uint32_t) GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtior_setting.gtior_b.nfaen = ((uint32_t) GPT_CAPTURE_FILTER_NONE & 1U),
|
|
|
+ .gtior_setting.gtior_b.nfcsa = ((uint32_t) GPT_CAPTURE_FILTER_NONE >> 1U),
|
|
|
+ .gtior_setting.gtior_b.gtiob = (0U << 4U) | (0U << 2U) | (0U << 0U),
|
|
|
+ .gtior_setting.gtior_b.obdflt = (uint32_t) GPT_PIN_LEVEL_LOW,
|
|
|
+ .gtior_setting.gtior_b.obhld = 0U,
|
|
|
+ .gtior_setting.gtior_b.obe = (uint32_t) false,
|
|
|
+ .gtior_setting.gtior_b.obdf = (uint32_t) GPT_GTIOC_DISABLE_PROHIBITED,
|
|
|
+ .gtior_setting.gtior_b.nfben = ((uint32_t) GPT_CAPTURE_FILTER_NONE & 1U),
|
|
|
+ .gtior_setting.gtior_b.nfcsb = ((uint32_t) GPT_CAPTURE_FILTER_NONE >> 1U),
|
|
|
+#else
|
|
|
+ .gtior_setting.gtior = 0U,
|
|
|
+#endif
|
|
|
+};
|
|
|
+const timer_cfg_t g_timer0_cfg =
|
|
|
+{
|
|
|
+ .mode = TIMER_MODE_PWM,
|
|
|
+ /* Actual period: 35.791394133333334 seconds. Actual duty: 50%. */ .period_counts = (uint32_t) 0x100000000, .duty_cycle_counts = 0x80000000, .source_div = (timer_source_div_t)0,
|
|
|
+ .channel = 0,
|
|
|
+ .p_callback = NULL,
|
|
|
+ /** If NULL then do not add & */
|
|
|
+#if defined(NULL)
|
|
|
+ .p_context = NULL,
|
|
|
+#else
|
|
|
+ .p_context = &NULL,
|
|
|
+#endif
|
|
|
+ .p_extend = &g_timer0_extend,
|
|
|
+ .cycle_end_ipl = (BSP_IRQ_DISABLED),
|
|
|
+#if defined(VECTOR_NUMBER_GPT0_COUNTER_OVERFLOW)
|
|
|
+ .cycle_end_irq = VECTOR_NUMBER_GPT0_COUNTER_OVERFLOW,
|
|
|
+#else
|
|
|
+ .cycle_end_irq = FSP_INVALID_VECTOR,
|
|
|
+#endif
|
|
|
+};
|
|
|
+/* Instance structure to use this module. */
|
|
|
+const timer_instance_t g_timer0 =
|
|
|
+{
|
|
|
+ .p_ctrl = &g_timer0_ctrl,
|
|
|
+ .p_cfg = &g_timer0_cfg,
|
|
|
+ .p_api = &g_timer_on_gpt
|
|
|
+};
|
|
|
gpt_instance_ctrl_t g_timer2_ctrl;
|
|
|
#if 0
|
|
|
const gpt_extended_pwm_cfg_t g_timer2_pwm_extend =
|