/************************************************************************* $Archive: /PACS/OnBoard/l_pscgen.c $ $Revision: 1.10 $ $Date: 2009/04/23 13:51:12 $ $Author: amazy $ $Log: l_pscgen.c,v $ Revision 1.10 2009/04/23 13:51:12 amazy 6.029 * * 2 28/08/02 11:49 Amazy * Added the header with the history log *************************************************************************/ /***************************************************************************** * * Project name: Plank LFI REBA / Herschel PACS SPU * Product name: LLSW_DRV * Object name: l_pscgen * Filename: %M% * Language: C (ADSP-21020) * Compiler: G21K - r3.3 * Company: CRISA * Author: F. Torrero * Version: %I% * Creation date: 25/Jul/2001 * Last Modification date: %G% * * Description =============================================================== * * This module implements the lowest level functions related to management of * Data memory PSC and Program Memory PSC. * * Change log =============================================================== * * | DATE | NEW VERSION | AUTHOR | REASON FOR CHANGE | * =========================================================================== * * 25/Jul/01 1 F.Torrero Creation * * ****************************************************************************/ /***************************************************************************** INCLUDES *****************************************************************************/ #include "l_gendef.h" #include "l_memory.h" #include "l_pscgen.h" /***************************************************************************** PRIVATE CONSTANTS *****************************************************************************/ /***************************************************************************** PRIVATE TYPES *****************************************************************************/ /***************************************************************************** PRIVATE VARIABLES *****************************************************************************/ /***************************************************************************** DECLARATION OF PRIVATE FUNCTIONS *****************************************************************************/ /***************************************************************************** IMPLEMENTATION OF FUNCTIONS *****************************************************************************/ /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_ReadPMPSCReg * * DESCRIPTION * Read specified PMPSC register (32 bits) and return value * * INPUT ARGUMENTS: * PMPSC Register * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * Register value * * PSEUDOCODE * Read PMPSC register using l_memory module functions, take value from * 32MSBits * Return value *---------------------------------------------------------------------- $#$ */ T_UNSIGNED_32 PSC_ReadPMPSCReg(T_UNSIGNED_32 Register) { return(MEM_ReadPM32bitMSWord(Register)); } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_ReadPMPSCReg48Bits * * DESCRIPTION * Read specified PMPSC register and store the full 48bits in appropriate * output arguments. * * INPUT ARGUMENTS: * PMPSC Register * * OUTPUT ARGUMENTS: * 32MSBits of PMPSC register word * 16LSBits of PMPSC register word * * RETURNED VALUE: * None * * PSEUDOCODE * Read the full 48bits of PMPSC register using l_memory module * functions and store value in appropriate output arguments * * Note: Reading 48 bits is an exclusive feature of PMPSC (is not possible * in DMPSC) because of the size of the PM data bus (48bits wide). However * most of PMPSC register are only 32bits wide, thus reading 48bits is * necessary only in special cases. *---------------------------------------------------------------------- $#$ */ T_VOID PSC_ReadPMPSCReg48Bits(T_UNSIGNED_32 Register, T_UNSIGNED_32 *PMPSCRegWord32MSbits, T_UNSIGNED_16 *PMPSCRegWord16LSbits) { (*PMPSCRegWord32MSbits)=MEM_ReadPM32bitMSWord(Register); (*PMPSCRegWord16LSbits)=MEM_ReadPM16bitLSWord(Register); } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_ReadDMPSCReg * * DESCRIPTION * Read specified DMPSC register (32 bits) and return value * * INPUT ARGUMENTS: * DMPSC Register * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * Register value * * PSEUDOCODE * Read DMPSC register using l_memory module functions * Return value *---------------------------------------------------------------------- $#$ */ T_UNSIGNED_32 PSC_ReadDMPSCReg(T_UNSIGNED_32 Register) { return(MEM_ReadDMWord(Register)); } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_WritePMPSCReg * * DESCRIPTION * Write value to specified PMPSC register (32 bits) * * INPUT ARGUMENTS: * PMPSC Register * Register value * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * None * * PSEUDOCODE * Write value to PMPSC register, into the 32MSB bits, using l_memory * module functions *---------------------------------------------------------------------- $#$ */ T_VOID PSC_WritePMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 RegisterValue) { MEM_WritePMWord(Register,RegisterValue,0); return; } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_WriteDMPSCReg * * DESCRIPTION * Write value to specified DMPSC register (32 bits) * * INPUT ARGUMENTS: * DMPSC Register * Register value * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * None * * PSEUDOCODE * Write value to DMPSC register using l_memory module functions *---------------------------------------------------------------------- $#$ */ T_VOID PSC_WriteDMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 RegisterValue) { MEM_WriteDMWord(Register,RegisterValue); return; } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_WriteBitInPMPSCReg * * DESCRIPTION * Set specified bit of specified PMPSC 32bit register to specified * value (0=low, 1=high), keeping the value of the other bits * * INPUT ARGUMENTS: * PMPSC Register * Bit position * Bit value (high/low) * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * None * * PSEUDOCODE * Write bit in PMPSC reg. using l_memory functions *---------------------------------------------------------------------- $#$ */ T_VOID PSC_WriteBitInPMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 BitPosition, T_UNSIGNED_32 BitValue) { MEM_WriteBitInPM32bitMSWord(Register,BitPosition,BitValue); return; } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_WriteBitInDMPSCReg * * DESCRIPTION * Set specified bit of specified DMPSC 32bit register to specified * value (0=low, 1=high), keeping the value of the other bits * * INPUT ARGUMENTS: * DMPSC Register * Bit position * Bit value (high/low) * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * None * * PSEUDOCODE * Write bit in DMPSC reg. using l_memory functions *---------------------------------------------------------------------- $#$ */ T_VOID PSC_WriteBitInDMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 BitPosition, T_UNSIGNED_32 BitValue) { MEM_WriteBitInDMWord(Register,BitPosition,BitValue); return; } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_CheckBitInPMPSCReg * * DESCRIPTION * Check if specified bit in provided PMPSC reg. is 1 (returning K_TRUE) * or 0 (returning K_FALSE) * * INPUT ARGUMENTS: * PMPSC reg. * Bit position * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * Result (True/False) * * PSEUDOCODE * Check bit using l_memory module functions *---------------------------------------------------------------------- $#$ */ T_BOOLEAN PSC_CheckBitInPMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 BitPosition) { return(MEM_CheckBitInPM32bitMSWord(Register,BitPosition)); } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_CheckBitInDMPSCReg * * DESCRIPTION * Check if specified bit in provided DMPSC reg. is 1 (returning K_TRUE) * or 0 (returning K_FALSE) * * INPUT ARGUMENTS: * DMPSC reg. * Bit position * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * Result (True/False) * * PSEUDOCODE * Check bit using l_memory module functions *---------------------------------------------------------------------- $#$ */ T_BOOLEAN PSC_CheckBitInDMPSCReg(T_UNSIGNED_32 Register, T_UNSIGNED_32 BitPosition) { return(MEM_CheckBitInDMWord(Register,BitPosition)); } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_SetGPOutput * * DESCRIPTION * Set GPIO Output in appropriate PSC to high/low * * INPUT ARGUMENTS: * Output to be set * Level * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * None * * PSEUDOCODE * * Write bit in DMPSC reg. using l_memory functions * * Note: Currently all used outputs are through DMPSC and the constants * which must be used to access these outputs contain the appropriate bit. *---------------------------------------------------------------------- $#$ */ T_VOID PSC_SetGPOutput(T_UNSIGNED_32 GPOutput, T_LEVEL Level) { MEM_WriteBitInDMWord(K_DMADD_DMPSC_GPIOREG,GPOutput,Level); return; } /* #$# ----------------------------------------------------------------------- * FUNCTION NAME: PSC_GetDMPSCGPIOInput * * DESCRIPTION * Check if specified GPInput is 1 (returning K_TRUE) or 0 (returning K_FALSE) * * INPUT ARGUMENTS: * Input to be checked * * OUTPUT ARGUMENTS: * None * * RETURNED VALUE: * Result (true/false) * * PSEUDOCODE * * Check bit using l_memory module functions * * Note: Currently all used inputs are from the DMPSC and the constants * which must be used to access these inputs contain the appropriate bit. *---------------------------------------------------------------------- $#$ */ T_BOOLEAN PSC_CheckGPInput(T_UNSIGNED_32 GPInput) { return(MEM_CheckBitInDMWord(K_DMADD_DMPSC_GPIOREG,GPInput)); }