/** * MIL-STD 1553B Library - Carlo Gavazzi Space * * Filename : \file MilIrq.c * * Purposes : \brief MIL-STD 1553B Library - Carlo Gavazzi Space * * Logical Task : N/A * * Author : CGSpace * * Last Developer : $Author: lorenzo $ * * Revision : $Revision: 1.3 * * Checkout Tag : $Name: $ * * Last Modification : $Date: 2006/10/20 09:22:14 $ * * Location : $RCSfile: MilIrq.c,v $ * * \version : $Header: /home/local/cvsrep/OBS_FM/1553_Lib/MilIrq.c,v 1.10 2006/10/20 09:22:14 lorenzo Exp $ */ /** * Commitments History : * As reported in Main cvs Documentation * ( https://www.cvshome.org/docs/manual/cvs-1.11.18/cvs_12.html#SEC102 ) * The Modification Log has been posted at End Of File. */ // ---------------------------------------------------------------------------// /* Milirq.c - The routines in this module involve the control and servicing of * interrupt requests */ /* Purpose: The module contains the routines for managing the ACE chip in RT mode. Content: The module contains the following functions: SUBHEADINGS Project : HSO/FIRST BASIC S/W Component : HSO/FIRST DRIVERS S/W Filename : $RCSfile: MilIrq.c,v $ CI Number : Revision : Revision: 1.3 Company : Carlo Gavazzi Space S.P.A. Author : Andrea Bertoli Creation Date : 2000/05/15 SEE ALSO: ADD Ref: Inserted here reference with Architectural Design and Detail Document. Other Ref: Notes: */ #include "MilDef.h" /******************************************************************** * * MilIrqAutoClear - Enables Disables autoclearing of the Interrupt * status register * * Description * Enables or disables autoclearing of the interrupt and * whether an irq generates a level or pulse request on * the irq line. * * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * - d_selection TRUE enables autoclear of the Irq * * Output Parameters * N/A * * Global Variables * N/A * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ MilError_t MilIrqAutoClear(MilConf_p pw_MilConf,unsigned char d_Selection) { /* set reset bit 4 in CONFIG 2 */ return(MilWriteReg(pw_MilConf, CONFIG_2, (MilReadReg(pw_MilConf, CONFIG_2)&0xffef)|((d_Selection)?0x0010:0))); } /******************************************************************** * * MilIrqType - Selects whether an irq generates a level or pulse request * * Description * Selects whether an irq generates a level or pulse request on * the irq line * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * - d_Sel PULSE(0) a pulse irq request is generated * LEVEL(1) a level irq request is generated * * Output Parameters * N/A * * Global Variables * * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ MilError_t MilIrqType(MilConf_p pw_MilConf,unsigned char d_Selection) { /* bit 3 level pulse interrupt request */ return(MilWriteReg(pw_MilConf, CONFIG_2, (MilReadReg(pw_MilConf, CONFIG_2)&0xfff7)|((d_Selection)?0x0008:0))); } /******************************************************************** * * MilIrqEnable - Enables different events to generate an interrupt * * Description * Enables different events to generate an interrupt aas defined * in the inteerupt mask register (00h) * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * - j_Mask value indicate which interrupt should be enables * * * Output Parameters * N/A * * Global Variables * * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ MilError_t MilIrqEnable(MilConf_p pw_MilConf,unsigned int j_Mask) { /* set the interrupt mask register */ return(MilWriteReg(pw_MilConf,INTRPT_MASK,MilReadReg(pw_MilConf,INTRPT_MASK)|j_Mask)); } /******************************************************************** * * MilIrqDisable - Disables different events from generating an interrupt * * Description * Disables different events from generating an interrupt as * defined in the interrupt mask register * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * - j_Mask value indicates which interrupts should be disabled * * Output Parameters * N/A * * Global Variables * N/A * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ MilError_t MilIrqDisable(MilConf_p pw_MilConf,unsigned int j_Mask) { /* set the Interrupt mask register */ return(MilWriteReg(pw_MilConf,INTRPT_MASK,MilReadReg(pw_MilConf,INTRPT_MASK)&(~j_Mask))); } /******************************************************************** * * MilGetIrqStatus - Reads the interrupts status register and returns the value * * Description * Reads the interrupts status register and returns the value * if interrupt status autoclear is enable, this function will * clear the interrupt. * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * * Output Parameters * N/A * * Global Variables * N/A * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ unsigned int MilGetIrqStatus(MilConf_p pw_MilConf) { return(MilReadReg(pw_MilConf, INTRPT_STATUS)); } /******************************************************************** * * MilIrqReset - Resets the value of the interrupt status register * * Description * Resets the value of the interrupt status register and * clears a level interrupt (INT* output to logic 1). * * ARGUMENTS * Input Parameters * - pw_MilConf Mil1553 management structure * * Output Parameters * N/A * * Global Variables * * * RETURNS: error condition * * SEE ALSO: * * * INTERNAL * This section will not appear in the generated manual entry. * */ MilError_t MilIrqReset(MilConf_p pw_MilConf) { /* reset interrupt status register */ return(MilWriteReg(pw_MilConf,CONTROL,0x0004)); } // ---------------------------------------------------------------------------// /* modification history -------------------- $Log: MilIrq.c,v $ Revision 1.10 2006/10/20 09:22:14 lorenzo 1553 library updated Revision 1.7 2006/06/07 11:44:55 scige Some More Comment by Scige John Liu IFSI Revision 1.6 2006/02/15 14:56:57 scige Abstract comment reformatted History log replaced or moved at end of file Revision 1.5 2006/02/15 14:34:03 scige Some more comments restored Revision 1.3 2005/09/16 13:09:39 scige *** empty log message *** Revision 1.1 2005/08/10 12:53:39 scige Communication Library: 1553 com1553 Base Common Version of Spire/Pacs OBS */