⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwm.h

📁 实时嵌入式操作系统内部关于定时器的应用
💻 H
字号:
/*
 * pwm.h
 *
 * Copyright (C) STMicroelectronics Limited 2004. All rights reserved.
 *
 * Register definition for the PWMs found in ST20C1-C10x cores.
 */

#if ! defined(PWM_H)
#define PWM_H

/*
 * PWM register definitions.
 *
 * Two PWM module types are supported. They are named pwm_3 and pwm_4.
 * The postfixes 3 and 4 denote the number of capture/ compare units
 * contained in the pwm.
 *
 * Registers defined as 8 or 16 bits wide all occupy a 4 byte word
 * aligned field, so 32 bit ints can be used to map onto thes fields.
 * 
 */

/*
 * PWM control register bit field definition (identical on PWM3 and PWM4)
 */
typedef struct pwm_control_s {
    volatile int PWMClkValue:4;
    volatile int CaptureClkValue:5;
    volatile int PWMEnable:1;
    volatile int CaptureEnable:1;
} pwm_control_t;

/*
 * PWM 3 Interrupts bit field definition.
 * Register layout is the same for interrupt enable, status and acknowledge registers.
 */
typedef struct pwm3_interrupt_s {
    volatile int PWMInt:1;	/* 0  */
    volatile int Reserved:2;	/* 1,2  */
    volatile int CaptureInt0:1;	/* 3  */
    volatile int CaptureInt1:1;	/* 4  */
    volatile int CaptureInt2:1;	/* 5  */
    volatile int CompareInt0:1;	/* 6  */
    volatile int CompareInt1:1;	/* 7  */
    volatile int CompareInt2:1;	/* 8  */
} pwm3_interrupt_t;

/*
 * PWM 3 register set definition.
 * Registers with bit fields use C bit field definitions.
 */
typedef struct pwm3_s 
{
  volatile int PWMVal0;         /* 00 */
  volatile int PWMVal1;         /* 04 */
  volatile int PWMVal2;         /* 08 */

  volatile int CaptureVal0;     /* 0c */
  volatile int CaptureVal1;     /* 10 */
  volatile int CaptureVal2;     /* 14 */

  volatile int CompareVal0;     /* 18 */
  volatile int CompareVal1;     /* 1c */
  volatile int CompareVal2;     /* 20 */

  pwm_control_t Control;        /* 24 */

  volatile int CaptureEdge0;    /* 28 */
  volatile int CaptureEdge1;    /* 2c */
  volatile int CaptureEdge2;    /* 30 */

  volatile int CompareOutVal0;  /* 34 */
  volatile int CompareOutVal1;  /* 38 */
  volatile int CompareOutVal2;  /* 3c */

  pwm3_interrupt_t IntEnable;   /* 40 */
  pwm3_interrupt_t IntStatus;   /* 44 */
  pwm3_interrupt_t IntAck;      /* 48 */

  volatile int PWMCount;        /* 4c */
  volatile int CaptureCount;    /* 50 */
} pwm3_t;


/*
 * PWM 4 Interrupts bit field definition.
 * Register layout is the same for interrupt enable, status and acknowledge registers.
 */ 
typedef struct pwm4_interrupt_s {
    volatile int PWMInt:1;	/* 0  */
    volatile int CaptureInt0:1;	/* 1  */
    volatile int CaptureInt1:1;	/* 2  */
    volatile int CaptureInt2:1;	/* 3  */
    volatile int CaptureInt3:1;	/* 4  */
    volatile int CompareInt0:1;	/* 5  */
    volatile int CompareInt1:1;	/* 6  */
    volatile int CompareInt2:1;	/* 7  */
    volatile int CompareInt3:1;	/* 8  */
} pwm4_interrupt_t;

/*
 * PWM 4 register set definition.
 * Registers with bit fields use C bit field definitions.
 */
typedef struct pwm4_s {
    volatile int PWMVal0;
    volatile int PWMVal1;	/* 04 */
    volatile int PWMVal2;
    volatile int PWMVal3;	/* 0c */

    volatile int CaptureVal0;	/* 10 */
    volatile int CaptureVal1;	/* 14 */
    volatile int CaptureVal2;	/* 18 */
    volatile int CaptureVal3;	/* 1C */

    volatile int CompareVal0;	/* 20 */
    volatile int CompareVal1;	/* 24 */
    volatile int CompareVal2;	/* 28 */
    volatile int CompareVal3;	/* 2C */

    volatile int CaptureEdge0;	/* 30 */
    volatile int CaptureEdge1;	/* 34 */
    volatile int CaptureEdge2;	/* 38 */
    volatile int CaptureEdge3;	/* 3C */

    volatile int CompareOutVal0;/* 40 */
    volatile int CompareOutVal1;/* 44 */
    volatile int CompareOutVal2;/* 48 */
    volatile int CompareOutVal3;/* 4C */

    pwm_control_t Control;	/* 50 */

    pwm4_interrupt_t IntEnable; /* 54 */
    pwm4_interrupt_t IntStatus; /* 58 */
    pwm4_interrupt_t IntAck;    /* 5C */

    volatile int PWMCount;	/* 60 */
    volatile int CaptureCount;	/* 64 */
} pwm4_t;

#endif /* ! defined(PWM_H) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -