/*******************************************************************************
* FILE NAME: etpu_pwmmdc.c COPYRIGHT (c) Freescale Semiconductor 2005
* All Rights Reserved
*
* DESCRIPTION:
* This file contains the eTPU function PWM Master For DC Motors (PWMMDC),
* PWM Full Range (PWMF) and PWM Commutated (PWMC) API.
================================================================================
* REV AUTHOR DATE DESCRIPTION OF CHANGE
* --- ----------- ---------- ---------------------
* 2.0 M. Brejl 02/Mar/05 Initial version derived from PWMM func.
* M. Princ
* 2.1 M. Brejl 22/Mar/05 New PWMMDC API state flow:
* M. Princ init -> enable <-> disable.
*******************************************************************************/
#include "etpu_util.h" /* Utility routines for working with the eTPU */
#include "etpu_pwmmdc.h" /* eTPU PWMMDC API */
extern uint32_t fs_etpu_data_ram_start;
/*******************************************************************************
*FUNCTION : fs_etpu_pwmmdc_init_3ph
*PURPOSE : To initialize eTPU channels to implement PWMMDC with 3 phases.
*INPUTS NOTES : This function has 20 parameters:
* channel - This is the PWMMDC master channel number.
* 0-31 for ETPU_A and 64-95 for ETPU_B.
* priority - This is the priority to assign to the PWMMDC
* channel.
* This parameter should be assigned a value of:
* FS_ETPU_PRIORITY_HIGH, FS_ETPU_PRIORITY_MIDDLE or
* FS_ETPU_PRIORITY_LOW.
* phaseA_channel - This parameter determines the channel number
* of phase A.
* 0-31 for ETPU_A and 64-95 for ETPU_B
* phaseA_negate_duty - This parameter sets the "Negate duty-cycle"
* option.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_DUTY_POS or
* FS_ETPU_PWMMDC_DUTY_NEG
* phaseB_channel - This parameter determines the channel number
* of phase B. Applies only if num_phases >= 2.
* 0-31 for ETPU_A and 64-95 for ETPU_B
* phaseB_negate_duty - This parameter sets the "Negate duty-cycle"
* option.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_DUTY_POS or
* FS_ETPU_PWMMDC_DUTY_NEG
* phaseC_channel - This parameter determines the channel number
* of phase C. Applies only if num_phases >= 3.
* 0-31 for ETPU_A and 64-95 for ETPU_B
* phaseC_negate_duty - This parameter sets the "Negate duty-cycle"
* option.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_DUTY_POS or
* FS_ETPU_PWMMDC_DUTY_NEG
* modulation - This parameter determines the type of modulation.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_MOD_NO or
* FS_ETPU_PWMMDC_MOD_VOLTAGE_UNSIGNED or
* FS_ETPU_PWMMDC_MOD_VOLTAGE_SIGNED or
* update - This parameter determines the type of update.
* This parameter should be assigned value of
* FS_ETPU_PWMMDC_NORMAL or
* FS_ETPU_PWMMDC_HALF_CYCLE.
* alignment - This parameter determines the type of PWM.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_EDGE_ALIGNED or
* FS_ETPU_PWMMDC_CENTER_ALIGNED
* phases_type - This parameter determines the type of all
* PWMF or PWMC phases.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_FULL_RANGE_SINGLE_CHANNELS or
* FS_ETPU_PWMMDC_FULL_RANGE_COMPL_PAIRS or
* FS_ETPU_PWMMDC_COMMUTATED_SINGLE_CHANNELS or
* FS_ETPU_PWMMDC_COMMUTATED_COMPL_PAIRS
* swap - This parameter sets the
* "Swap dead-time insertion" option.
* This parameter should be assigned a value of:
* FS_ETPU_PWMMDC_NO_SWAP or
* FS_ETPU_PWMMDC_SWAP
* base_ch_disable_pin_state - This is the required output state of the base
* channel pin, after initialization.
* This parameter should be assigned a value of
* FS_ETPU_PWMMDC_PIN_LOW or
* FS_ETPU_PWMMDC_PIN_HIGH.
* compl_ch_disable_pin_state - This is the required output state of the
* complementary channel pin, after initialization.
* This parameter should be assigned a value of
* FS_ETPU_PWMMDC_PIN_LOW or
* FS_ETPU_PWMMDC_PIN_HIGH.
* This parameter applies only if phase_type is
* FS_ETPU_PWMMDC_COMPL_PAIRS.
* start_offset - This parameter is used to synchronize
* various eTPU functions that generate a signal.
* The first PWM period starts start_offset
* TCR1 clocks after initialization.
* period - This parameter determines the PWM period
* as number of TCR1 cycles.
* update_time - This parameter determines the time that is
* necessary to perform the update of all PWM
* phases as number of TCR1 cycles.
* dead_time - This parameter determines the dead-time
* as number of TCR1 cycles.
* min_pw - This parameter determines the minimum pulse
* width as number of TCR1 cycles.
*
*RETURNS NOTES: Error code is channel could not be initialized. Error code that
* can be returned are: FS_ETPU_ERROR_VALUE, FS_ETPU_ERROR_MALLOC.
*******************************************************************************/
int32_t fs_etpu_pwmmdc_init_3ph( uint8_t channel,
uint8_t priority,
uint8_t phaseA_channel,
uint8_t phaseA_negate_duty,
uint8_t phaseB_channel,
uint8_t phaseB_negate_duty,
uint8_t phaseC_channel,
uint8_t phaseC_negate_duty,
uint8_t modulation,
uint8_t update,
uint8_t alignment,
uint8_t phases_type,
uint8_t swap,
uint8_t base_ch_disable_pin_state,
uint8_t compl_ch_disable_pin_state,
uint24_t start_offset,
很好powerpc源码,从事汽车ecu开发的值得一看,本部分为etpu部分源码....zip
版权申诉
51 浏览量
2023-05-09
20:13:56
上传
评论
收藏 96KB ZIP 举报
N201871643
- 粉丝: 795
- 资源: 2280
最新资源
- Screenshot_2024-05-21-17-06-42-64_2332cb9b27b851b548ba47a91682926c.jpg
- 毕业设计参考 - 基于树莓派、OpenCV及Python的人脸识别
- node-v18.20.2-linux-arm64
- 222222222222
- 16张相机标定图片,可复现本文畸变矫正
- dbeaver-ce-23.3.1-x86_64-setup.zip
- 基于X86 AVX2指令的快速卷积实现
- VMware-ESXi-7.0U3n-21930508-depot.zip文件
- MySQL 在 Windows 系统下的安装教程.zip
- Access文件数据库访问的客户端
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈