From ba94a1bba3600d387edba7eb451990d9891e1c2f Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Tue, 30 May 2006 15:56:48 +0200 Subject: * Update Intel IXP4xx support - Add IXP4xx NPE ethernet MAC support - Add support for Intel IXDPG425 board - Add support for Prodrive PDNB3 board - Add IRQ support Patch by Stefan Roese, 23 May 2006 [This patch does not include cpu/ixp/npe/IxNpeMicrocode.c which still sufferes from licensing issues. Blame Intel.] --- cpu/ixp/npe/include/IxSspAcc.h | 1271 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1271 insertions(+) create mode 100644 cpu/ixp/npe/include/IxSspAcc.h (limited to 'cpu/ixp/npe/include/IxSspAcc.h') diff --git a/cpu/ixp/npe/include/IxSspAcc.h b/cpu/ixp/npe/include/IxSspAcc.h new file mode 100644 index 0000000..35e7abf --- /dev/null +++ b/cpu/ixp/npe/include/IxSspAcc.h @@ -0,0 +1,1271 @@ +/** + * @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;/**