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

📄 ixsspacc.h

📁 u-boot 源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
/** * @file IxSspAcc.h * * @brief  Header file for the IXP400 SSP Serial Port Access (IxSspAcc) * * @version $Revision: 0.1 $ *  * @par * IXP400 SW Release version 2.0 *  * -- Copyright Notice -- *  * @par * Copyright 2001-2005, Intel Corporation. * All rights reserved. *  * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. *  * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *  * @par * -- End of Copyright Notice -- *//** * @defgroup IxSspAcc IXP400 SSP Serial Port Access (IxSspAcc) API  * * @brief IXP400 SSP Serial Port Access Public API * * @{ */#ifndef IXSSPACC_H#define IXSSPACC_H#ifdef __ixp46X#include "IxOsal.h"/* * Section for enum *//** * @ingroup IxSspAcc *  * @enum IxSspAccDataSize * * @brief The data sizes in bits that are supported by the protocol */typedef enum{	DATA_SIZE_TOO_SMALL = 0x2,	DATA_SIZE_4 = 0x3,	DATA_SIZE_5,	DATA_SIZE_6,	DATA_SIZE_7,	DATA_SIZE_8,	DATA_SIZE_9,	DATA_SIZE_10,	DATA_SIZE_11,	DATA_SIZE_12,	DATA_SIZE_13,	DATA_SIZE_14,	DATA_SIZE_15,	DATA_SIZE_16,	DATA_SIZE_TOO_BIG} IxSspAccDataSize;/** * @ingroup IxSspAcc *  * @enum IxSspAccPortStatus * * @brief The status of the SSP port to be set to enable/disable */typedef enum{	SSP_PORT_DISABLE = 0x0,	SSP_PORT_ENABLE,	INVALID_SSP_PORT_STATUS} IxSspAccPortStatus;/** * @ingroup IxSspAcc *  * @enum IxSspAccFrameFormat * * @brief The frame format that is to be used - SPI, SSP, or Microwire */typedef enum{	SPI_FORMAT = 0x0,	SSP_FORMAT,	MICROWIRE_FORMAT,	INVALID_FORMAT} IxSspAccFrameFormat;/** * @ingroup IxSspAcc *  * @enum IxSspAccClkSource * * @brief The source to produce the SSP serial clock */typedef enum{	ON_CHIP_CLK = 0x0,	EXTERNAL_CLK,	INVALID_CLK_SOURCE} IxSspAccClkSource;/** * @ingroup IxSspAcc *  * @enum IxSspAccSpiSclkPhase * * @brief The SPI SCLK Phase:  * 0 - SCLK is inactive one cycle at the start of a frame and 1/2 cycle at the *		end of a frame. * 1 - SCLK is inactive 1/2 cycle at the start of a frame and one cycle at the *		end of a frame. */typedef enum{	START_ONE_END_HALF = 0x0,	START_HALF_END_ONE,	INVALID_SPI_PHASE} IxSspAccSpiSclkPhase;/** * @ingroup IxSspAcc *  * @enum IxSspAccSpiSclkPolarity * * @brief The SPI SCLK Polarity can be set to either low or high. */typedef enum{	SPI_POLARITY_LOW = 0x0,	SPI_POLARITY_HIGH,	INVALID_SPI_POLARITY} IxSspAccSpiSclkPolarity;/** * @ingroup IxSspAcc *  * @enum IxSspAccMicrowireCtlWord * * @brief The Microwire control word can be either 8 or 16 bit. */typedef enum{	MICROWIRE_8_BIT = 0x0,	MICROWIRE_16_BIT,	INVALID_MICROWIRE_CTL_WORD} IxSspAccMicrowireCtlWord;/** * @ingroup IxSspAcc *  * @enum IxSspAccFifoThreshold * * @brief The threshold in frames (each frame is defined by IxSspAccDataSize) *			that can be set for the FIFO to trigger a threshold exceed when *			checking with the ExceedThresholdCheck functions or an interrupt *			when it is enabled. */typedef enum{	FIFO_TSHLD_1 =	0x0,	FIFO_TSHLD_2,	FIFO_TSHLD_3,	FIFO_TSHLD_4,	FIFO_TSHLD_5,	FIFO_TSHLD_6,	FIFO_TSHLD_7,	FIFO_TSHLD_8,	FIFO_TSHLD_9,	FIFO_TSHLD_10,	FIFO_TSHLD_11,	FIFO_TSHLD_12,	FIFO_TSHLD_13,	FIFO_TSHLD_14,	FIFO_TSHLD_15,	FIFO_TSHLD_16,	INVALID_FIFO_TSHLD} IxSspAccFifoThreshold;/** * @ingroup IxSspAcc *  * @enum IX_SSP_STATUS * * @brief The statuses that can be returned in a SSP Serial Port Access */typedef enum{	IX_SSP_SUCCESS = IX_SUCCESS, /**< Success status */	IX_SSP_FAIL, /**< Fail status */	IX_SSP_RX_FIFO_OVERRUN_HANDLER_MISSING, /**<						Rx FIFO Overrun handler is NULL. */	IX_SSP_RX_FIFO_HANDLER_MISSING, /**<					Rx FIFO threshold hit or above handler is NULL					*/	IX_SSP_TX_FIFO_HANDLER_MISSING, /**<					Tx FIFO threshold hit or below handler is NULL					*/	IX_SSP_FIFO_NOT_EMPTY_FOR_SETTING_CTL_CMD, /**<					Tx FIFO not empty and therefore microwire					control command size setting is not allowed.	*/	IX_SSP_INVALID_FRAME_FORMAT_ENUM_VALUE, /**<					frame format selected is invalid. */	IX_SSP_INVALID_DATA_SIZE_ENUM_VALUE, /**<					data size selected is invalid. */	IX_SSP_INVALID_CLOCK_SOURCE_ENUM_VALUE, /**<					source clock selected is invalid. */	IX_SSP_INVALID_TX_FIFO_THRESHOLD_ENUM_VALUE, /**<					Tx FIFO threshold selected is invalid. */	IX_SSP_INVALID_RX_FIFO_THRESHOLD_ENUM_VALUE, /**<					Rx FIFO threshold selected is invalid. */	IX_SSP_INVALID_SPI_PHASE_ENUM_VALUE, /**<					SPI phase selected is invalid. */	IX_SSP_INVALID_SPI_POLARITY_ENUM_VALUE, /**<					SPI polarity selected is invalid. */	IX_SSP_INVALID_MICROWIRE_CTL_CMD_ENUM_VALUE, /**<					Microwire control command selected is invalid					*/	IX_SSP_INT_UNBIND_FAIL, /**< Interrupt unbind fail to unbind SSP	                interrupt */	IX_SSP_INT_BIND_FAIL, /**< Interrupt bind fail during init */	IX_SSP_RX_FIFO_NOT_EMPTY, /**<					Rx FIFO not empty while trying to change data					size. */	IX_SSP_TX_FIFO_NOT_EMPTY, /**<					Rx FIFO not empty while trying to change data					size or microwire control command size.	*/	IX_SSP_POLL_MODE_BLOCKING, /**<					poll mode selected blocks interrupt mode from					being selected.	*/	IX_SSP_TX_FIFO_HIT_BELOW_THRESHOLD, /**<					Tx FIFO level hit or below threshold. */	IX_SSP_TX_FIFO_EXCEED_THRESHOLD, /**<					Tx FIFO level exceeded threshold. */	IX_SSP_RX_FIFO_HIT_ABOVE_THRESHOLD, /**<					Rx FIFO level hit or exceeded threshold. */	IX_SSP_RX_FIFO_BELOW_THRESHOLD, /**<					Rx FIFO level below threshold. */	IX_SSP_BUSY, /**< SSP is busy. */	IX_SSP_IDLE, /**< SSP is idle. */	IX_SSP_OVERRUN_OCCURRED, /**<					SSP has experienced an overrun. */	IX_SSP_NO_OVERRUN, /**<					SSP did not experience an overrun. */	IX_SSP_NOT_SUPORTED, /**< hardware does not support SSP */	IX_SSP_NOT_INIT, /**< SSP Access not intialized */	IX_SSP_NULL_POINTER /**< parameter passed in is NULL */} IX_SSP_STATUS;/** * @ingroup IxSspAcc * * @brief SSP Rx FIFO Overrun handler * * This function is called for the client to handle Rx FIFO Overrun that occurs * in the SSP hardware */typedef void (*RxFIFOOverrunHandler)(void);/** * @ingroup IxSspAcc *  * @brief SSP Rx FIFO Threshold hit or above handler * * This function is called for the client to handle Rx FIFO threshold hit or * or above that occurs in the SSP hardware */typedef void (*RxFIFOThresholdHandler)(void);/** * @ingroup IxSspAcc *  * @brief SSP Tx FIFO Threshold hit or below handler * * This function is called for the client to handle Tx FIFO threshold hit or * or below that occurs in the SSP hardware */typedef void (*TxFIFOThresholdHandler)(void);/* * Section for struct *//** * @ingroup IxSspAcc * * @brief contains all the variables required to initialize the SSP serial port *		hardware. *  * Structure to be filled and used for calling initialization */typedef struct{	IxSspAccFrameFormat FrameFormatSelected;/**<Select between SPI, SSP and												Microwire. */	IxSspAccDataSize DataSizeSelected;		/**<Select between 4 and 16. */	IxSspAccClkSource ClkSourceSelected;	/**<Select clock source to be												on-chip or external. */	IxSspAccFifoThreshold TxFIFOThresholdSelected;											/**<Select Tx FIFO threshold												between 1 to 16. */	IxSspAccFifoThreshold RxFIFOThresholdSelected;											/**<Select Rx FIFO threshold												between 1 to 16. */	BOOL RxFIFOIntrEnable;					/**<Enable/disable Rx FIFO												threshold interrupt. Disabling												this interrupt will require												the use of the polling function												RxFIFOExceedThresholdCheck. */	BOOL TxFIFOIntrEnable;					/**<Enable/disable Tx FIFO												threshold interrupt. Disabling												this interrupt will require												the use of the polling function												TxFIFOExceedThresholdCheck. */	RxFIFOThresholdHandler RxFIFOThsldHdlr;	/**<Pointer to function to handle												a Rx FIFO interrupt. */	TxFIFOThresholdHandler TxFIFOThsldHdlr;	/**<Pointer to function to handle												a Tx FIFO interrupt. */	RxFIFOOverrunHandler RxFIFOOverrunHdlr;	/**<Pointer to function to handle												a Rx FIFO overrun interrupt. */	BOOL LoopbackEnable;					/**<Select operation mode to be												normal or loopback mode. */	IxSspAccSpiSclkPhase SpiSclkPhaseSelected;											/**<Select SPI SCLK phase to start												with one inactive cycle and end												with 1/2 inactive cycle or												start with 1/2 inactive cycle												and end with one inactive												cycle. (Only used in												SPI format). */	IxSspAccSpiSclkPolarity SpiSclkPolaritySelected;											/**<Select SPI SCLK idle state												to be low or high. (Only used in												SPI format). */	IxSspAccMicrowireCtlWord MicrowireCtlWordSelected;											/**<Select Microwire control												format to be 8 or 16-bit. (Only												used in Microwire format). */	UINT8 SerialClkRateSelected;			/**<Select between 0 (1.8432Mbps)												and 255 (7.2Kbps). The												formula used is	Bit rate = 												3.6864x10^6 / 												(2 x (SerialClkRateSelect + 1))												*/} IxSspInitVars;/** * @ingroup IxSspAcc * * @brief contains counters of the SSP statistics *  * Structure contains all values of counters and associated overflows. */typedef struct{	UINT32 ixSspRcvCounter;		/**<Total frames received. */	UINT32 ixSspXmitCounter;	/**<Total frames transmitted. */	UINT32 ixSspOverflowCounter;/**<Total occurrences of overflow. */} IxSspAccStatsCounters;/* * Section for prototypes interface functions *//** * @ingroup IxSspAcc *  * @fn ixSspAccInit (	IxSspInitVars *initVarsSelected); * * @brief Initializes the SSP Access module. * * @param "IxSspAccInitVars [in] *initVarsSelected" - struct containing required *			variables for initialization  * * Global Data	: *		- None. *                         * This API will initialize the SSP Serial Port hardware to the user specified * configuration. Then it will enable the SSP Serial Port. * *NOTE*: Once interrupt or polling mode is selected, the mode cannot be * changed via the interrupt enable/disable function but the init needs to be * called again to change it. * * @return  *      - IX_SSP_SUCCESS - Successfully initialize and enable the SSP *									serial port. *		- IX_SSP_RX_FIFO_HANDLER_MISSING - interrupt mode is selected but RX FIFO *									handler pointer is NULL *		- IX_SSP_TX_FIFO_HANDLER_MISSING - interrupt mode is selected but TX FIFO *									handler pointer is NULL *		- IX_SSP_RX_FIFO_OVERRUN_HANDLER_MISSING - interrupt mode is selected but *									RX FIFO Overrun handler pointer is NULL

⌨️ 快捷键说明

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