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

📄 csl_pmx.h

📁 TI达芬奇dm644x各硬件模块测试代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */ 

/** @mainpage PMX CSL 3.x
 *
 * @section Introduction
 *
 * @subsection xxx Purpose and Scope
 * The purpose of this document is to identify a set of common CSL APIs for
 * the Pin Muxing module across various devices. The CSL developer is expected to
 * refer to this document while designing APIs for these modules. Some of the
 * listed APIs may not be applicable to a given PMX module. While other cases
 * this list of APIs may not be sufficient to cover all the features of a
 * particular PMX Module. The CSL developer should use his discretion designing
 * new APIs or extending the existing ones to cover these.
 *
 * @subsection aaa Terms and Abbreviations
 *   -# CSL:  Chip Support Library
 *   -# API:  Application Programmer Interface
 *
 *
 */

/**
 *  @file  csl_pmx.h
 *
 *  @brief PMX functional layer API header file
 *
 *  Path: \\(CSLPATH)\\ipmodules\\pmx\\src
 *
 *  @internal
 *  @date 18th dec, 2004
 *  @author BRN
 */


#ifndef _CSL_PMX_H_
#define _CSL_PMX_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <soc.h>
#include <cslr.h>
#include <csl_error.h>
#include <csl_types.h>
#include <cslr_pmx.h>

/**************************************************************************\
* PMX global typedef declarations
\**************************************************************************/

/**
  * @brief This is the CSL_PinMux0Setup, used in the CSL_PmxHwSetup
  *  structure. This structure consists of the parameters used to control the
  *  APMX, VLYNQ, ATA, VideoOut and CCD control muxing.
  */
typedef struct CSL_PinMux0Setup {
    /** Enable EMAC module pins */
    Uint16  emacEn;

    /** Enable 1394 module pins (if EMAC not enabled) */
    Uint16  En1394;

    /** Enable UHPI module pins */
    Uint16  hpiEn;

    /** Enable CCD C_FIELD pin function on GPIO4 */
    Uint16  cfldEn;

    /** Enable CCD _C_WEN function on GPIO3 */
    Uint16  cwEn;

    /** Enable LCD_FIELD pin function on GPIO1 */
    Uint16  lfldEn;

    /** Enable LCD_OE pin function on GPIO0 */
    Uint16  loeEn;

    /** Enable VideoOut extended RGB888 mode outputs */
    Uint16  rgb888;

    /** Enable ATA module pins */
    Uint16  ataEn;

    /** Enable ATADIR DIR output */
    Uint16  hdirEn;

    /** Enable VLYNQ module pins */
    Uint16  vlynqEn;

    /** Enable VLYNQ SCRUN pin function */
    Uint16  vlscrEn;

    /** Set VLYNQ data width */
    Uint16  vlynqWd;

    /** Enable APMX ECS5 chip select */
    Uint16  aeCs5;

    /** Enable APMX ECS4 chip select */
    Uint16  aeCs4;

    /** APMX address width selection */
    Uint16  aeAw;
} CSL_PinMux0Setup;


/**
  * @brief This is the CSL_PinMux1Setup, used in the CSL_PmxHwSetup
  *  structure. This structure consists of the parameters to control TIMIN on
  *  GPIO, CLK of GPIO, McBSP, MSTK, SPI, PMX, PWM2, PWM1, PWM0, UART2 flow
  *  control UART2, UART1 and UART0 peripherals.
  */
typedef struct CSL_PinMux1Setup {
    /** TIMIN Enable TIM_IN on */
    Uint16  timin;

    /** Enable CLKOUT1 on */
    Uint16  clk1;

    /** CLK0 Enable CLKOUT0 on GPIO */
    Uint16  clk0;

    /** Enable McBSP */
    Uint16  mcbsp;

    /** Enable Memory Stick */
    Uint16  mstk;

    /** Enable SPI */
    Uint16  spi;

	 /** Enable I2C */
    Uint16  i2c;
    /** Enable PMX */
    Uint16  Pmx;

    /** Enable PWM2 */
    Uint16  pwm2;

    /** Enable PWM1 */
    Uint16  pwm1;

    /** Enable PWM0 */
    Uint16  pwm0;

    /** Enable UART2 flow control */
    Uint16  u2Flo;

    /** UART2 Enable UART2 */
    Uint16  uart2;

    /** Enable UART1 */
    Uint16  uart1;

    /** Enable UART0 */
    Uint16  uart0;
} CSL_PinMux1Setup;


/** Contorl commands for PMX used in CSL_HwControl.c function */
typedef enum {
    /**
     *  @brief set the Pinmux0 of PMX which controls APMX, VLYNQ, ATA,
     *   VideoOut and CCD.
     */
    CSL_PMX_CMD_SET_PIN_MUX0        = 1,

    /**
     *  @brief sets Pinmux1 of PMX which controls to controls TIMIN on GPIO,
     *   CLK of GPIO, McBSP, MSTK, SPI, PMX, PWM2, PWM1, PWM0, UART2 flow
     *   control UART2, UART1 and UART0 peripherals.
     *
     */
    CSL_PMX_CMD_SET_PIN_MUX1       = 2
} CSL_PmxHwControlCmd;


/**
 *  @brief Enumeration for queries passed to \a CSL_PmxGetHwStatus()
 *
 * This is used to get the status of different operations.The arguments
 * to be passed with each enumeration if any are specified next to
 * the enumeration
 */
typedef enum {
    /**
     *  @brief Queries to get the status of Pinmux0
     */
    CSL_PMX_QUERY_PIN_MUX0_STAT   = 1,

    /**
     *  @brief Queries to get the status of Pinmux1
     *   Selection
     */
    CSL_PMX_QUERY_PIN_MUX1_STAT   = 2
} CSL_PmxHwStatusQuery;


/**
 *  @brief CSL_PmxHwSetup structure is a used in \a CSL_pmxHwSetup() to
 *  setup the PMX
 */
typedef struct CSL_PmxHwSetup {
    /** Pinmux0 Group Function Selection setup structure parameter */
    CSL_PinMux0Setup                pinMux0Setup;

    /** Pinmux1 Group Function Selection setup structure parameter */
    CSL_PinMux1Setup                pinMux1Setup;
} CSL_PmxHwSetup;

/** The Defaults values for  PinMux0 Group Function Selection setup
  *  structure
  */
#define PIN_MUX0_SETUP_DEFAULTS { \
    CSL_PMX_PINMUX0_EMACEN_RESETVAL, \
    CSL_PMX_PINMUX0_1394EN_RESETVAL, \
    CSL_PMX_PINMUX0_HPIEN_RESETVAL, \
    CSL_PMX_PINMUX0_RESERVED_RESETVAL, \
    CSL_PMX_PINMUX0_CFLDEN_RESETVAL, \
    CSL_PMX_PINMUX0_CWEN_RESETVAL, \
    CSL_PMX_PINMUX0_LFLDEN_RESETVAL, \
    CSL_PMX_PINMUX0_RGB888_RESETVAL, \
    CSL_PMX_PINMUX0_ATAEN_RESETVAL, \
    CSL_PMX_PINMUX0_HDIREN_RESETVAL, \
    CSL_PMX_PINMUX0_VLYNQEN_RESETVAL, \
    CSL_PMX_PINMUX0_VLSCREN_RESETVAL, \
    CSL_PMX_PINMUX0_VLYNQWD_RESETVAL, \
    CSL_PMX_PINMUX0_AECS5_RESETVAL, \
    CSL_PMX_PINMUX0_AECS4_RESETVAL, \
    CSL_PMX_PINMUX0_AEAW_RESETVAL \
}

/** The Defaults values for PinMux1 Pin Function Selection setup structure
  * paramenter
  */
#define PIN_MUX1_SETUP_DEFAULTS { \
    CSL_PMX_PINMUX1_TIMIN_RESETVAL,\
    CSL_PMX_PINMUX1_CLK1_RESETVAL, \
    CSL_PMX_PINMUX1_CLK0_RESETVAL, \
    CSL_PMX_PINMUX1_MCBSP_RESETVAL, \
    CSL_PMX_PINMUX1_MSTK_RESETVAL, \
    CSL_PMX_PINMUX1_SPI_RESETVAL, \
    CSL_PMX_PINMUX1_I2C_RESETVAL, \
    CSL_PMX_PINMUX1_PWM2_RESETVAL, \
    CSL_PMX_PINMUX1_PWM1_RESETVAL, \
    CSL_PMX_PINMUX1_PWM0_RESETVAL, \
    CSL_PMX_PINMUX1_U2FLO_RESETVAL, \
    CSL_PMX_PINMUX1_UART2_RESETVAL, \
    CSL_PMX_PINMUX1_UART1_RESETVAL, \
    CSL_PMX_PINMUX1_UART0_RESETVAL  \
}


/**
 *  @brief This object contains the reference to the instance of PMX
 *  opened using the @a CSL_pmxOpen()
 *  The pointer to this is passed to all PMX CSL APIs
 *  This structure has the fields required to configure PMX for any test
 *  case/application. It should be initialized as per requirements of a
 *  test case/application and passed on to the setup function
 */
typedef struct CSL_PmxObj {
    /**
     * This is a pointer to the registers of the
     * instance of PMX referred to by this object
     */
    CSL_PmxRegsOvly regs;

    /**
     * This is the instance of PMX being referred to
     * by this object
     */
    CSL_InstNum  perNum;

} CSL_PmxObj;


/** @brief this is a pointer to @a CSL_PmxObj and is passed as the first
 *  parameter to all PMX CSL APIs
 */
typedef CSL_PmxObj       *CSL_PmxHandle;


/**
 * @brief Config structure which is used in HwSetupRaw fuction
 */
typedef struct CSL_PmxConfig {
    /** PMX PINMUX0 Function Selection register */
    volatile Uint32 PINMUX0;

    /** PMX PINMUX1 Pin Function Selection register */
    volatile Uint32 PINMUX1;
} CSL_PmxConfig;


/**
 * @brief The default values for PMX config structure
 */
#define CSL_PMX_CONFIG_DEFAULTS { \
    CSL_PMX_PINMUX0_RESETVAL,    \
    CSL_PMX_PINMUX1_RESETVAL     \
};


/**
  * @brief PMX param structure containing module
  *        specific parameters
  */
typedef struct CSL_PmxParam {
    /**
     *Bit mask to be used for module specific parameters
     */
    CSL_BitMask16         flags;

} CSL_PmxParam;


/**
  *  @brief PMX module specific context structure
  */
typedef struct CSL_PmxContext {
    /**
     * Context information of PMX
     */
    Uint16                contextInfo;

} CSL_PmxContext;


/**
  * @brief This will have the base-address information for the
  * peripheral instance
  */
typedef struct CSL_PmxBaseAddress {
    /**
     *Base-address of the Configuration registers of the peripheral
     */
    CSL_PmxRegsOvly       regs;

} CSL_PmxBaseAddress;


/*****************************************************************************\
          CSL3.x mandatory function prototype definitions
\*****************************************************************************/


/** ===========================================================================
 *	 @func   CSL_pmxInit
 *
 *   @desc
 *   This function is idempotent in that calling it many times is same as
 *   calling it once. This function initializes the PMX CSL data structures.
 *
 *   @b Arguments
     @verbatim
            pContext   Context information for the instance. Should be NULL
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK - Always returns
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n  None
 *
 * <b> Usage Constraints: </b>
 * CSL system initialization must be successfully completed by invoking
 * @a CSL_sysInit() before calling this function. This function should be
 * called before using any of the CSL APIs
 *
 * @b Example:
 * @verbatim
   ...
   CSL_sysInit( NULL );
   if (CSL_SOK != CSL_pmxInit( NULL )) {
       return;
   }
   @endverbatim
 *
 * @return returns the status of the operation
 *
 * ============================================================================
 */
CSL_Status CSL_pmxInit (
   CSL_PmxContext         *pContext
);

/*
 * =============================================================================
 *   @func   CSL_pmxOpen
 *
 *   @desc
 *   @n This function returns the handle to the PMX instance. This
 *      handle is passed to all other CSL APIs.
 *
 *   @arg  pmxObj
 *              Pointer to the PMX object - to be allocated by the
 *                                                     user
 *   @arg  instNum
 *              Instance number of the PMX to be opened
 *
 *   @arg  pPmxParam
 *              PMX module specific parameters.
 *   @arg  status
 *              Pointer to CSL Error Status. Possible values for status after
 *              function call returns are:
 *              CSL_SOK            : Open call is successful
 *              CSL_ESYS_FAIL      : Invalid Instance
 *
 *   @ret  CSL_PmxHandle
 *              Valid handle, if status is CSL_SOK
 *
 *   @eg
 *          CSL_status          status;
 *          CSL_PmxObj          pmxObj;
 *          CSL_PmxHandle       hPmx;
 *
 *          ...
 *
 *          hPmx = CSL_pmxOpen (&pmxtObj, CSL_PMX, NULL, &status);

⌨️ 快捷键说明

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