mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 08:04:33 +02:00
mcpwm: added peripheral signal description list
This commit is contained in:
@@ -6,6 +6,7 @@ set(srcs
|
|||||||
"i2s_periph.c"
|
"i2s_periph.c"
|
||||||
"interrupts.c"
|
"interrupts.c"
|
||||||
"ledc_periph.c"
|
"ledc_periph.c"
|
||||||
|
"mcpwm_periph.c"
|
||||||
"pcnt_periph.c"
|
"pcnt_periph.c"
|
||||||
"rmt_periph.c"
|
"rmt_periph.c"
|
||||||
"rtc_io_periph.c"
|
"rtc_io_periph.c"
|
||||||
|
160
components/soc/esp32/mcpwm_periph.c
Normal file
160
components/soc/esp32/mcpwm_periph.c
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
// Copyright 2020 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.
|
||||||
|
|
||||||
|
#include "soc/soc.h"
|
||||||
|
#include "soc/mcpwm_periph.h"
|
||||||
|
#include "soc/gpio_sig_map.h"
|
||||||
|
|
||||||
|
const mcpwm_signal_conn_t mcpwm_periph_signals = {
|
||||||
|
.groups = {
|
||||||
|
[0] = {
|
||||||
|
.module = PERIPH_PWM0_MODULE,
|
||||||
|
.irq_id = ETS_PWM0_INTR_SOURCE,
|
||||||
|
.operators = {
|
||||||
|
[0] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT0A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT0B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT1A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT1B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT2A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT2B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.detectors = {
|
||||||
|
[0] = {
|
||||||
|
.fault_sig = PWM0_F0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.fault_sig = PWM0_F1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.fault_sig = PWM0_F2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.captures = {
|
||||||
|
[0] = {
|
||||||
|
.cap_sig = PWM0_CAP0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.cap_sig = PWM0_CAP1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.cap_sig = PWM0_CAP2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.ext_syncers = {
|
||||||
|
[0] = {
|
||||||
|
.sync_sig = PWM0_SYNC0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.sync_sig = PWM0_SYNC1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.sync_sig = PWM0_SYNC2_IN_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.module = PERIPH_PWM1_MODULE,
|
||||||
|
.irq_id = ETS_PWM1_INTR_SOURCE,
|
||||||
|
.operators = {
|
||||||
|
[0] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT0A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT0B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT1A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT1B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT2A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT2B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.detectors = {
|
||||||
|
[0] = {
|
||||||
|
.fault_sig = PWM1_F0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.fault_sig = PWM1_F1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.fault_sig = PWM1_F2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.captures = {
|
||||||
|
[0] = {
|
||||||
|
.cap_sig = PWM1_CAP0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.cap_sig = PWM1_CAP1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.cap_sig = PWM1_CAP2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.ext_syncers = {
|
||||||
|
[0] = {
|
||||||
|
.sync_sig = PWM1_SYNC0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.sync_sig = PWM1_SYNC1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.sync_sig = PWM1_SYNC2_IN_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@@ -9,6 +9,7 @@ set(srcs
|
|||||||
"interrupts.c"
|
"interrupts.c"
|
||||||
"lcd_periph.c"
|
"lcd_periph.c"
|
||||||
"ledc_periph.c"
|
"ledc_periph.c"
|
||||||
|
"mcpwm_periph.c"
|
||||||
"pcnt_periph.c"
|
"pcnt_periph.c"
|
||||||
"rmt_periph.c"
|
"rmt_periph.c"
|
||||||
"rtc_io_periph.c"
|
"rtc_io_periph.c"
|
||||||
|
160
components/soc/esp32s3/mcpwm_periph.c
Normal file
160
components/soc/esp32s3/mcpwm_periph.c
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
// Copyright 2020 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.
|
||||||
|
|
||||||
|
#include "soc/soc.h"
|
||||||
|
#include "soc/mcpwm_periph.h"
|
||||||
|
#include "soc/gpio_sig_map.h"
|
||||||
|
|
||||||
|
const mcpwm_signal_conn_t mcpwm_periph_signals = {
|
||||||
|
.groups = {
|
||||||
|
[0] = {
|
||||||
|
.module = PERIPH_PWM0_MODULE,
|
||||||
|
.irq_id = ETS_PWM0_INTR_SOURCE,
|
||||||
|
.operators = {
|
||||||
|
[0] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT0A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT0B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT1A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT1B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM0_OUT2A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM0_OUT2B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.detectors = {
|
||||||
|
[0] = {
|
||||||
|
.fault_sig = PWM0_F0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.fault_sig = PWM0_F1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.fault_sig = PWM0_F2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.captures = {
|
||||||
|
[0] = {
|
||||||
|
.cap_sig = PWM0_CAP0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.cap_sig = PWM0_CAP1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.cap_sig = PWM0_CAP2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.ext_syncers = {
|
||||||
|
[0] = {
|
||||||
|
.sync_sig = PWM0_SYNC0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.sync_sig = PWM0_SYNC1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.sync_sig = PWM0_SYNC2_IN_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.module = PERIPH_PWM1_MODULE,
|
||||||
|
.irq_id = ETS_PWM1_INTR_SOURCE,
|
||||||
|
.operators = {
|
||||||
|
[0] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT0A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT0B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT1A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT1B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.generators = {
|
||||||
|
[0] = {
|
||||||
|
.pwm_sig = PWM1_OUT2A_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.pwm_sig = PWM1_OUT2B_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.detectors = {
|
||||||
|
[0] = {
|
||||||
|
.fault_sig = PWM1_F0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.fault_sig = PWM1_F1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.fault_sig = PWM1_F2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.captures = {
|
||||||
|
[0] = {
|
||||||
|
.cap_sig = PWM1_CAP0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.cap_sig = PWM1_CAP1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.cap_sig = PWM1_CAP2_IN_IDX
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.ext_syncers = {
|
||||||
|
[0] = {
|
||||||
|
.sync_sig = PWM1_SYNC0_IN_IDX
|
||||||
|
},
|
||||||
|
[1] = {
|
||||||
|
.sync_sig = PWM1_SYNC1_IN_IDX
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
.sync_sig = PWM1_SYNC2_IN_IDX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@@ -13,5 +13,39 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "soc/soc_caps.h"
|
||||||
#include "soc/mcpwm_reg.h"
|
#include "soc/mcpwm_reg.h"
|
||||||
#include "soc/mcpwm_struct.h"
|
#include "soc/mcpwm_struct.h"
|
||||||
|
#include "soc/periph_defs.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
struct {
|
||||||
|
const periph_module_t module; // Peripheral module
|
||||||
|
const int irq_id;
|
||||||
|
struct {
|
||||||
|
struct {
|
||||||
|
const uint32_t pwm_sig;
|
||||||
|
} generators[SOC_MCPWM_GENERATORS_PER_OPERATOR];
|
||||||
|
} operators[SOC_MCPWM_OPERATORS_PER_GROUP];
|
||||||
|
struct {
|
||||||
|
const uint32_t fault_sig;
|
||||||
|
} detectors[SOC_MCPWM_FAULT_DETECTORS_PER_GROUP];
|
||||||
|
struct {
|
||||||
|
const uint32_t cap_sig;
|
||||||
|
} captures[SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER];
|
||||||
|
struct {
|
||||||
|
const uint32_t sync_sig;
|
||||||
|
} ext_syncers[SOC_MCPWM_EXT_SYNCERS_PER_GROUP];
|
||||||
|
} groups[SOC_MCPWM_GROUPS];
|
||||||
|
} mcpwm_signal_conn_t;
|
||||||
|
|
||||||
|
extern const mcpwm_signal_conn_t mcpwm_periph_signals;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user