📄 pit_b.h
字号:
/**********************************************************************/
/* File: pit_b.h File containing the structures and prototypes */
/* for the PIT_B */
/* */
/* Design Reference: Doc. Name Version */
/* --------------------------- ------- */
/* PIT_B Level 1 Service 1.0 */
/* Functional Design Specification */
/* */
/* (C) Copyright Motorola Inc, 2000. All rights reserved. */
/* */
/* $RCSfile: pit_b.h,v $ */
/* $Revision: 1.1 $ */
/* $Date: 2000/06/23 20:22:21 $ */
/* $Author: jeffk $ */
/**********************************************************************/
#ifndef _PIT_B_H
#define _PIT_B_H
#include "mcore.h"
/*--------------------------------------------------------------------*/
/* PIT_B Register Definitions */
/*--------------------------------------------------------------------*/
typedef struct
{
volatile UINT16 PCSR; /* PIT Control/Status Register */
UINT16 PMR; /* PIT Modulus Register */
volatile UINT16 PCNTR; /* PIT Count Register */
} PIT_B_t, *pPIT_B_t;
/*--------------------------------------------------------------------*/
/* Enumerations
/*--------------------------------------------------------------------*/
typedef enum
{
PIT_B_PCSR, /* Select PIT Control/Status Register */
PIT_B_PMR, /* Select PIT Modulus Register */
PIT_B_PCNTR /* Select PIT Count Register */
} PIT_B_Register_t;
typedef enum
{
PIT_B_FUNCTION_DISABLE,
PIT_B_FUNCTION_ENABLE
} PIT_B_PITEnable_t;
typedef enum
{
PIT_B_COUNTER_RELOAD_ROLLS_OVER,
PIT_B_COUNTER_RELOAD_FROM_MODULUS
} PIT_B_CounterReloadControl_t;
typedef enum
{
PIT_B_NO_INTERRUPT_PRESENT, /* No PIT interrupt is present */
PIT_B_INTERRUPT_PRESENT /* PIT interrupt is present */
} PIT_B_PITInterruptFlag_t;
typedef enum
{
PIT_B_INTERRUPT_FLAG_NOT_ALLOWED, /* Interrupt flag is inhibited from */
/* reaching the CPU */
PIT_B_INTERRUPT_FLAG_ALLOWED /* Interrupt flag is allowed to */
/* request an interrupt */
} PIT_B_InterruptEnable_t;
typedef enum
{
PIT_B_DISABLE_COUNTER_OVERWRITE, /* Modulus latch holds register */
PIT_B_ENABLE_COUNTER_OVERWRITE /* Modulus latch is transparent */
} PIT_B_CounterOverwriteEnable_t;
typedef enum
{
PIT_B_ENABLE_IN_DEBUG, /* PIT function is not affected in */
/* DEBUG mode */
PIT_B_DISABLE_IN_DEBUG /* PIT function is stopped in */
/* DEBUG mode */
} PIT_B_DEBUGModeControl_t;
typedef enum
{
PIT_B_ENABLE_IN_DOZE, /* PIT function is not affected in DOZE mode */
PIT_B_DISABLE_IN_DOZE /* PIT function is stopped in DOZE mode */
} PIT_B_DOZEModeControl_t;
typedef enum
{
PIT_B_SCALAR_00 = 0x0, /* Pre-Scaler select value is equal to the*/
/* system clock */
PIT_B_SCALAR_01 = 0x1, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 2 */
PIT_B_SCALAR_02 = 0x2, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 4 */
PIT_B_SCALAR_03 = 0x3, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 8 */
PIT_B_SCALAR_04 = 0x4, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 16 */
PIT_B_SCALAR_05 = 0x5, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 32 */
PIT_B_SCALAR_06 = 0x6, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 64 */
PIT_B_SCALAR_07 = 0x7, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 128 */
PIT_B_SCALAR_08 = 0x8, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 256 */
PIT_B_SCALAR_09 = 0x9, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 512 */
PIT_B_SCALAR_10 = 0xA, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 1024 */
PIT_B_SCALAR_11 = 0xB, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 2048 */
PIT_B_SCALAR_12 = 0xC, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 4096 */
PIT_B_SCALAR_13 = 0xD, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 8192 */
PIT_B_SCALAR_14 = 0xE, /* Pre-Scaler select value is equal to the*/
/* (system clock) / 16384 */
PIT_B_SCALAR_15 = 0xF /* Pre-Scaler select value is equal to the*/
/* (system clock) / 32768 */
} PIT_B_PreScalarSelect_t;
typedef enum{
PIT_B_ERR_NONE,
PIT_B_ERR_INVALID_HANDLE,
PIT_B_ERR_INVALID_COUNTER_RELOAD_CONTROL,
PIT_B_ERR_INVALID_COUNTER_OVERWRITE_ENABLE,
PIT_B_ERR_INVALID_DEBUG_MODE_CONTROL,
PIT_B_ERR_INVALID_DOZE_MODE_CONTROL,
PIT_B_ERR_INVALID_PIT_INTERRUPT_ENABLE,
PIT_B_ERR_INVALID_PRE_SCALAR_SELECT,
PIT_B_ERR_INVALID_PIT_ENABLE,
PIT_B_ERR_BAD_RESULT_ADDR,
PIT_B_ERR_INVALID_REGISTER
} PIT_B_ReturnCode_t; /*Pit_B return codes */
typedef enum {
PIT_B_FALSE,
PIT_B_TRUE
} PIT_B_Boolean_t;
/*--------------------------------------------------------------------*/
/* Structures */
/*--------------------------------------------------------------------*/
typedef struct
{
UINT16 CounterVal;
PIT_B_Boolean_t InterruptFlag;
} PIT_B_Status_t, *pPIT_B_Status_t;
/*--------------------------------------------------------------------*/
/* PIT_B PICSR Bits & Masks */
/*--------------------------------------------------------------------*/
#define PCSR_EN_BITNO 0
#define PCSR_EN_MASK (1 << PCSR_EN_BITNO)
#define PCSR_RLD_BITNO 1
#define PCSR_RLD_MASK (1 << PCSR_RLD_BITNO)
#define PCSR_PIF_BITNO 2
#define PCSR_PIF_MASK (1 << PCSR_PIF_BITNO)
#define PCSR_PIE_BITNO 3
#define PCSR_PIE_MASK (1 << PCSR_PIE_BITNO)
#define PCSR_OVW_BITNO 4
#define PCSR_OVW_MASK (1 << PCSR_OVW_BITNO)
#define PCSR_DBG_BITNO 5
#define PCSR_DBG_MASK (1 << PCSR_DBG_BITNO)
#define PCSR_DOZE_BITNO 6
#define PCSR_DOZE_MASK (1 << PCSR_DOZE_BITNO)
#define PCSR_PRE_BITNO 8
#define PCSR_PRE_MAX 0xF
#define PCSR_PRE_MASK (PCSR_PRE_MAX << PCSR_PRE_BITNO)
#define PCSR_RESET_MASK 0x0
#define PMR_PM_BITNO 0
#define PMR_PM_MAX 0xFFFF
#define PMR_PM_MASK (PMR_PM_MAX << PMR_PM_BITNO)
#define PCNTR_PC_BITNO 0
#define PCNTR_PC_MAX 0xFFFF
#define PCNTR_PC_MASK (PCNTR_PC_MAX << PCNTR_PC_BITNO)
#define PMR_RESET_MASK 0xFFFF
/*--------------------------------------------------------------------*/
/* Prototypes */
/*--------------------------------------------------------------------*/
PIT_B_ReturnCode_t PIT_B_Init_f(
pPIT_B_t PITPtr,
PIT_B_CounterReloadControl_t CounterReloadControl,
PIT_B_CounterOverwriteEnable_t CounterOverwriteEnable,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -