Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

sah_status_manager.h

Go to the documentation of this file.
/*
 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
 */

/*
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */

/**
* @file sah_status_manager.h
*
* @brief SAHARA Status Manager Types and Function Prototypes
*
* @author Stuart Holloway (SH)
*
*/

#ifndef STATUS_MANAGER_H
#define STATUS_MANAGER_H
#include "sah_driver_common.h"
#include "sahara.h"


/******************************************************************************
* User defined data types
******************************************************************************/
/**
******************************************************************************
* sah_Execute_Status
* Types read from SAHARA Status Register, with additional state for Op Status
******************************************************************************/
00037 typedef enum sah_Execute_Status
{
    /** Sahara is Idle. */
00040     SAH_EXEC_IDLE = 0,
    /** SAHARA is busy performing a resest or processing a decriptor chain. */
00042     SAH_EXEC_BUSY = 1,
    /** An error occurred while SAHARA executed the first descriptor. */
00044     SAH_EXEC_ERROR1 = 2,
    /** SAHARA has failed internally. */
00046     SAH_EXEC_FAULT = 3,
    /** SAHARA has finished processing a descriptor chain and is idle. */
00048     SAH_EXEC_DONE1 = 4,
    /** SAHARA has finished processing a descriptor chain, and is processing a
     *   second chain.  */
00051     SAH_EXEC_DONE1_BUSY2 = 5,
    /** SAHARA has finished processing a descriptor chain, but has generated an
     *   error while processing a second descriptor chain. */
00054     SAH_EXEC_DONE1_ERROR2 = 6,
    /** SAHARA has finished two descriptors. */
00056     SAH_EXEC_DONE1_DONE2 = 7,
    /** SAHARA has stopped, and first descriptor has Op Status, not Err  */
00058     SAH_EXEC_OPSTAT1 = 0x20,
} sah_Execute_Status;

/**
 * When this bit is on in a #sah_Execute_Status, it means that DONE1 is true.
 */
00064 #define SAH_EXEC_DONE1_BIT  4

/**
 * Bits which make up the Sahara State
 */
00069 #define SAH_EXEC_STATE_MASK 0x00000007

/**
*******************************************************************************
* sah_Execute_Error
* Types read from SAHARA Error Status Register
******************************************************************************/
00076 typedef enum sah_Execute_Error
{
    /** No Error */
00079     SAH_ERR_NONE = 0,
    /** Header is not valid. */
00081     SAH_ERR_HEADER = 1,
    /** Descriptor length is not correct. */
00083     SAH_ERR_DESC_LENGTH = 2,
    /** Length or pointer field is zero while the other is non-zero.  */
00085     SAH_ERR_DESC_POINTER = 3,
    /** Length of the link is not a multiple of 4 and is not the last link */
00087     SAH_ERR_LINK_LENGTH = 4,
    /** The data pointer in a link is zero */
00089     SAH_ERR_LINK_POINTER = 5,
    /** Input Buffer reported an overflow */
00091     SAH_ERR_INPUT_BUFFER = 6,
    /** Output Buffer reported an underflow */
00093     SAH_ERR_OUTPUT_BUFFER = 7,
    /** Incorrect data in output buffer after CHA's has signalled 'done'. */
00095     SAH_ERR_OUTPUT_BUFFER_STARVATION = 8,
    /** Internal Hardware Failure. */
00097     SAH_ERR_INTERNAL_STATE = 9,
    /** Current Descriptor was not legal, but cause is unknown. */
00099     SAH_ERR_GENERAL_DESCRIPTOR = 10,
    /** Reserved pointer fields have been set to 1. */
00101     SAH_ERR_RESERVED_FIELDS = 11,
    /** Descriptor address error */
00103     SAH_ERR_DESCRIPTOR_ADDRESS = 12,
    /** Link address error */
00105     SAH_ERR_LINK_ADDRESS = 13,
    /** Processing error in CHA module */
00107     SAH_ERR_CHA = 14,
    /** Processing error during DMA */
00109     SAH_ERR_DMA = 15
} sah_Execute_Error;


/**
*******************************************************************************
* sah_CHA_Error_Source
* Types read from SAHARA Error Status Register for CHA Error Source
*
******************************************************************************/
00119 typedef enum sah_CHA_Error_Source
{
    /** No Error indicated in Source CHA Error. */
00122     SAH_CHA_NO_ERROR = 0,
    /** Error in SKHA module. */
00124     SAH_CHA_SKHA_ERROR = 1,
    /** Error in MDHA module. */
00126     SAH_CHA_MDHA_ERROR = 2,
    /** Error in RNG module.  */
00128     SAH_CHA_RNG_ERROR = 3,
    /** Error in PKHA module.  */
00130     SAH_CHA_PKHA_ERROR = 4,
} sah_CHA_Error_Source;

/**
******************************************************************************
* sah_CHA_Error_Status
* Types read from SAHARA Error Status Register for CHA Error Status
*
******************************************************************************/
00139 typedef enum sah_CHA_Error_Status
{
    /** No CHA error detected */
00142     SAH_CHA_NO_ERR = 0x000,
    /** Non-empty input buffer when complete. */
00144     SAH_CHA_IP_BUF = 0x001,
    /** Illegal Address Error. */
00146     SAH_CHA_ADD_ERR = 0x002,
    /** Illegal Mode Error.  */
00148     SAH_CHA_MODE_ERR = 0x004,
    /** Illegal Data Size Error. */
00150     SAH_CHA_DATA_SIZE_ERR = 0x008,
    /** Illegal Key Size Error. */
00152     SAH_CHA_KEY_SIZE_ERR = 0x010,
    /** Mode/Context/Key written during processing. */
00154     SAH_CHA_PROC_ERR = 0x020,
    /** Context Read During Processing. */
00156     SAH_CHA_CTX_READ_ERR = 0x040,
    /** Internal Hardware Error. */
00158     SAH_CHA_INTERNAL_HW_ERR = 0x080,
    /** Input Buffer not enabled or underflow. */
00160     SAH_CHA_IP_BUFF_ERR = 0x100,
    /** Output Buffer not enabled or overflow. */
00162     SAH_CHA_OP_BUFF_ERR = 0x200,
    /** DES key parity error (SKHA) */
00164     SAH_CHA_DES_KEY_ERR = 0x400,
    /** Reserved error code. */
00166     SAH_CHA_RES = 0x800
} sah_CHA_Error_Status;

/**
*****************************************************************************
* sah_DMA_Error_Status
* Types read from SAHARA Error Status Register for DMA Error Status
******************************************************************************/
00174 typedef enum sah_DMA_Error_Status
{
    /** No DMA Error Code. */
00177     SAH_DMA_NO_ERR = 0,
    /** AHB terminated a bus cycle with an error. */
00179     SAH_DMA_AHB_ERR = 2,
    /** Internal IP bus cycle was terminated with an error termination. */
00181     SAH_DMA_IP_ERR = 4,
    /** Parity error detected on DMA command. */
00183     SAH_DMA_PARITY_ERR = 6,
    /** DMA was requested to cross a 256 byte internal address boundary. */
00185     SAH_DMA_BOUNDRY_ERR = 8,
    /** DMA controller is busy */
00187     SAH_DMA_BUSY_ERR = 10,
    /** Memory Bounds Error */
00189     SAH_DMA_RESERVED_ERR = 12,
    /** Internal DMA hardware error detected */
00191     SAH_DMA_INT_ERR = 14
} sah_DMA_Error_Status;

/**
*****************************************************************************
* sah_DMA_Error_Size
* Types read from SAHARA Error Status Register for DMA Error Size
*
******************************************************************************/
00200 typedef enum sah_DMA_Error_Size
{
    /** Error during Byte transfer.  */
00203     SAH_DMA_SIZE_BYTE = 0,
    /** Error during Half-word transfer. */
00205     SAH_DMA_SIZE_HALF_WORD = 1,
    /** Error during Word transfer. */
00207     SAH_DMA_SIZE_WORD = 2,
    /** Reserved DMA word size. */
00209     SAH_DMA_SIZE_RES = 3
} sah_DMA_Error_Size;




extern bool sah_dpm_flag;

/*************************
* Status Manager Functions
*************************/

unsigned long sah_Handle_Interrupt(sah_Execute_Status hw_status);
sah_Head_Desc *sah_Find_With_State (sah_Queue_Status status);
int sah_dpm_init(void);
void sah_dpm_close(void);
void sah_Queue_Manager_Prime (sah_Head_Desc *entry);


#endif  /* STATUS_MANAGER_H */

Generated by  Doxygen 1.6.0   Back to index