/** * MIL-STD 1553B Library - Carlo Gavazzi Space * * Filename : \file MilInit.h * * Purposes : \brief MIL-STD 1553B Library - Carlo Gavazzi Space * * Logical Task : * * Author : CGSpace * * Last Developer : $Author: lorenzo $ * * Revision : $Revision: 1.3 * * Checkout Tag : $Name: $ * * Last Modification : $Date: 2006/10/20 09:22:14 $ * * Location : $RCSfile: MilInit.h,v $ * * \version : $Header: /home/local/cvsrep/OBS_FM/1553_Lib/MilInit.h,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. */ // ---------------------------------------------------------------------------// /* Milinit.h - */ /* Purpose: The module contains the routine for the dynamic allocation of ACE memory Content: The module contains the following functions: - SUBHEADINGS Project : HSO/FIRST BASIC S/W Component : HSO/FIRST DRIVERS S/W Filename : $RCSfile: MilInit.h,v $ CI Number : Revision : Revision: 1.3 Company : Carlo Gavazzi Space S.P.A. Author : Andrea Bertoli Creation Date : 2000/05/15 Last ChangeDate: $Date: 2006/10/20 09:22:14 $ SEE ALSO: ADD Ref: Inserted here reference with Architectural Design and Detail Document. Other Ref: Notes: */ #ifndef __MILINIT__ #define __MILINIT__ /* ACE CONSTANTS -----------------------------------------------------------*/ /* Base address and register */ /* BS Base AD address */ #define BS_AD_CHIP_SELECT_7 0x8F000000 /* Base Address of the MIL-STD-1553B Register */ #define BS_AD_MIL_1553_DPRAM BS_AD_CHIP_SELECT_7 /* Offset respect to the DPRAM Base Address */ #define OFFSET_REG 0x4000 /* Base Address of the MIL-STD_1553B DPRAM */ #define BS_AD_MIL_1553_REG BS_AD_CHIP_SELECT_7 + OFFSET_REG /* INTERNAL RAM SIZE */ #define MIL_1553_RAM_SIZE 0x1000 /* ACE register addresses: the ACE chip has 17 internal register for normal operation, mapped starting from the base 1553 register address */ /* this register is used to enable disable the interrupt request for various condition */ #define ACE_INT_MASK_RW_REG BS_AD_MIL_1553_REG #define ACE_CONF_1_RW_REG BS_AD_MIL_1553_REG + 1 #define ACE_CONF_2_RW_REG BS_AD_MIL_1553_REG + 2 //The start reset register is used for "command" type functions, //such as software reset #define ACE_START_RST_W_REG BS_AD_MIL_1553_REG + 3 //The Stack Pointer Register allows the host CPU to determine //the pointer location for the current or most messages #define ACE_CMD_STK_PNT_R_REG BS_AD_MIL_1553_REG + 3 //The Subaddress control word register allows the host processor access //to the current or most recent messages #define ACE_RT_SA_CNT_RW_REG BS_AD_MIL_1553_REG + 4 //the time tag register maintains the value of the real time clock. the //resolution of this register is programmable from 2microsec to 64 microsec #define ACE_TIME_TAG_RW_REG BS_AD_MIL_1553_REG + 5 //the interrupt status register mirrors the interrupt mask register and //contains the master Interrupt bit. It allows to host processor to determine //the cause of the interrupt request #define ACE_INT_ST_RW_REG BS_AD_MIL_1553_REG + 6 //the configuration register are used to enable many ACE mini ace //advanced features: for example the ENHANCED mode feature #define ACE_CONF_3_RW_REG BS_AD_MIL_1553_REG + 7 #define ACE_CONF_4_RW_REG BS_AD_MIL_1553_REG + 8 #define ACE_CONF_5_RW_REG BS_AD_MIL_1553_REG + 9 //the RT monitor data stack register provide a pointer to the //current address location in shared RAM #define ACE_RT_DATA_STK_RW_REG BS_AD_MIL_1553_REG + 10 //the Frame time register provides a read write indication of the //time remaining in the current Bus controller frame #define ACE_BC_FRM_TM__RW_REG BS_AD_MIL_1553_REG + 11 //The message time remaining register provide read only indication of the //time remaining before the start of the next mesage #define ACE_BC_TM_NEXT_MSG_R_REG BS_AD_MIL_1553_REG + 12 //this register stores the current 1553 Control word processed #define ACE_RT_LAST_CMD_RW_REG BS_AD_MIL_1553_REG + 13 //this register provides read only indications of the RT status #define ACE_RT_ST_WD_R_REG BS_AD_MIL_1553_REG + 14 //the bit word register provide read only indications of the ACE //RT and bit words #define ACE_RT_BIT_WD_R_REG BS_AD_MIL_1553_REG + 15 //test mode register #define ACE_TEST_MODE_0_REG BS_AD_MIL_1553_REG + 16 #define ACE_TEST_MODE_1_REG BS_AD_MIL_1553_REG + 17 #define ACE_TEST_MODE_2_REG BS_AD_MIL_1553_REG + 18 #define ACE_TEST_MODE_3_REG BS_AD_MIL_1553_REG + 19 #define ACE_TEST_MODE_4_REG BS_AD_MIL_1553_REG + 20 #define ACE_TEST_MODE_5_REG BS_AD_MIL_1553_REG + 21 #define ACE_TEST_MODE_6_REG BS_AD_MIL_1553_REG + 22 #define ACE_TEST_MODE_7_REG BS_AD_MIL_1553_REG + 23 //DPRAM constants for memory management: I and E at the end of the //name of the constant indicate the INIT of the segment and the //End of the segment (see pag #define MIL_STACK_A_I BS_AD_MIL_1553_DPRAM #define MIL_STACK_A_E BS_AD_MIL_1553_DPRAM + 0x00FF #define MIL_RT_CMD_STK_PNT_A BS_AD_MIL_1553_DPRAM + 0x0100 #define MIL_RESERVED_AREA1_I BS_AD_MIL_1553_DPRAM + 0x0101 #define MIL_RESERVED_AREA1_E BS_AD_MIL_1553_DPRAM + 0x0103 #define MIL_RT_CMD_STK_PNT_B BS_AD_MIL_1553_DPRAM + 0x0104 #define MIL_RESERVED_AREA2_I BS_AD_MIL_1553_DPRAM + 0x0105 #define MIL_RESERVED_AREA2_E BS_AD_MIL_1553_DPRAM + 0x0107 #define MIL_MD_CD_SEL_INT_TBL_I BS_AD_MIL_1553_DPRAM + 0x0108 #define MIL_MD_CD_SEL_INT_TBL_E BS_AD_MIL_1553_DPRAM + 0x010F #define MIL_MD_CD_DATA_I BS_AD_MIL_1553_DPRAM + 0x0110 #define MIL_MD_CD_DATA_E BS_AD_MIL_1553_DPRAM + 0x013F #define MIL_LOOK_UP_TABLE_A_I BS_AD_MIL_1553_DPRAM + 0x0140 #define MIL_LOOK_UP_TABLE_A_E BS_AD_MIL_1553_DPRAM + 0x01BF #define MIL_LOOK_UP_TABLE_B_I BS_AD_MIL_1553_DPRAM + 0x01C0 #define MIL_LOOK_UP_TABLE_B_E BS_AD_MIL_1553_DPRAM + 0x023F #define MIL_BUSY_BIT_LK_TBL_I BS_AD_MIL_1553_DPRAM + 0x0240 #define MIL_BUSY_BIT_LK_TBL_E BS_AD_MIL_1553_DPRAM + 0x0247 #define MIL_NOT_USER_AREA_I BS_AD_MIL_1553_DPRAM + 0x0248 #define MIL_NOT_USER_AREA_E BS_AD_MIL_1553_DPRAM + 0x025F #define MIL_DATA_BLOCK_AREA1_I BS_AD_MIL_1553_DPRAM + 0x0260 #define MIL_DATA_BLOCK_AREA1_E BS_AD_MIL_1553_DPRAM + 0x02FF #define MIL_CMD_ILL_TBL_I BS_AD_MIL_1553_DPRAM + 0x0300 #define MIL_CMD_ILL_TBL_E BS_AD_MIL_1553_DPRAM + 0x03FF #define MIL_DATA_BLOCK_AREA2_I BS_AD_MIL_1553_DPRAM + 0x0400 #define MIL_DATA_BLOCK_AREA2_E BS_AD_MIL_1553_DPRAM + 0x0EFF #define MIL_STACK_B_I BS_AD_MIL_1553_DPRAM + 0x0F00 #define MIL_STACK_B_E BS_AD_MIL_1553_DPRAM + 0x0FFF //Remote Terminal Look up table A address #define MIL_LK_TBL_A_RX_SA0 MIL_LOOK_UP_TABLE_A_I #define MIL_LK_TBL_A_RX_SA31 MIL_LOOK_UP_TABLE_A_I + 0x001F #define MIL_LK_TBL_A_TX_SA0 MIL_LOOK_UP_TABLE_A_I + 0x0020 #define MIL_LK_TBL_A_TX_SA31 MIL_LOOK_UP_TABLE_A_I + 0x003F #define MIL_LK_TBL_A_BCST_SA0 MIL_LOOK_UP_TABLE_A_I + 0x0040 #define MIL_LK_TBL_A_BCST_SA31 MIL_LOOK_UP_TABLE_A_I + 0x005F #define MIL_LK_TBL_A_SACW_SA0 MIL_LOOK_UP_TABLE_A_I + 0x0060 #define MIL_LK_TBL_A_SACW_SA31 MIL_LOOK_UP_TABLE_A_I + 0x007F //Remote Terminal Look up table B address #define MIL_LK_TBL_B_RX_SA0 MIL_LOOK_UP_TABLE_B_I #define MIL_LK_TBL_B_RX_SA31 MIL_LOOK_UP_TABLE_B_I + 0x001F #define MIL_LK_TBL_B_TX_SA0 MIL_LOOK_UP_TABLE_B_I + 0x0020 #define MIL_LK_TBL_B_TX_SA31 MIL_LOOK_UP_TABLE_B_I + 0x003F #define MIL_LK_TBL_B_BCST_SA0 MIL_LOOK_UP_TABLE_B_I + 0x0040 #define MIL_LK_TBL_B_BCST_SA31 MIL_LOOK_UP_TABLE_B_I + 0x005F #define MIL_LK_TBL_B_SACW_SA0 MIL_LOOK_UP_TABLE_B_I + 0x0060 #define MIL_LK_TBL_B_SACW_SA31 MIL_LOOK_UP_TABLE_B_I + 0x007F //Illegalization Map Constant #define MIL_ILL_MAP_BCST_RX_I MIL_CMD_ILL_TBL_I #define MIL_ILL_MAP_BCST_RX_E MIL_CMD_ILL_TBL_I + 0x003F #define MIL_ILL_MAP_BCST_TX_I MIL_CMD_ILL_TBL_I + 0x0040 #define MIL_ILL_MAP_BCST_TX_E MIL_CMD_ILL_TBL_I + 0x007F #define MIL_ILL_MAP_TX_I MIL_CMD_ILL_TBL_I + 0x0080 #define MIL_ILL_MAP_TX_E MIL_CMD_ILL_TBL_I + 0x00BF #define MIL_ILL_MAP_RX_I MIL_CMD_ILL_TBL_I + 0x00C0 #define MIL_ILL_MAP_RX_E MIL_CMD_ILL_TBL_I + 0x00FF /* used in the interpretation of the message type */ #define MODESADDRVAL1 0x00 #define MODESADDRVAL2 0x1F #define BRDCSTRTADDRVAL 0x1F /* 1553 message type constants - the values assigned to these constants * are from a the below bitmap. * * t/~r = bit 10 of cmd word 1 * mode? = saddr = MODESADDRVAL1 or MODESADDRVAL2 * bcrst? = rtaddr = BRDCSTRTADDRVAL * 2ndCmd? = if there is another cmd word? * DataWmode? = (for mode codes only) is there data? */ /* t/~r mode? bcrst? 2ndCmd/DataWmode? */ #define BCTORT 0 /* 0 0 0 0 */ #define RTTORT 1 /* 0 0 0 1 */ #define BRDCST 2 /* 0 0 1 0 */ #define BRDCSTRTTORT 3 /* 0 0 1 1 */ #define MODEDATARX 5 /* 0 1 0 1 */ #define BRDCSTMODEDATA 7 /* 0 1 1 1 */ #define RTTOBC 8 /* 1 0 0 0 */ #define MODENODATA 12 /* 1 1 0 0 */ #define MODEDATATX 13 /* 1 1 0 1 */ #define BRDCSTMODENODATA 14 /* 1 1 1 0 */ #define INVALID 15 /* 1 1 1 1 */ /* string associated with message type */ #define MsgTypeString {"BC to RT ", \ "RT to RT ", \ "Broadcast ", \ "Bcst RT to RT ", \ "Invalid ", \ "Mode Rx Data ", \ "Invalid ", \ "Bcst Mode Data", \ "RT to BC ", \ "Invalid ", \ "Invalid ", \ "Invalid ", \ "Mode No Data ", \ "Mode Tx Data ", \ "Bcst Mode ", \ "Invalid "} \ /* parameter for BuTimeout */ #define RESPONSE_185 0x0000 /* 18.5 uS for response timeout */ #define RESPONSE_225 0x0200 /* 22.5 uS for response timeout */ #define RESPONSE_505 0x0400 /* 50.5 uS for response timeout */ #define RESPONSE_130 0x0600 /* 130 uS for response timeout */ /* parameter for BuTimeTagResolution */ #define MIL_TIMETAG_2 0x0280 /* 2 uS */ #define MIL_TIMETAG_4 0x0200 /* 4 uS */ #define MIL_TIMETAG_8 0x0180 /* 8 uS */ #define MIL_TIMETAG_16 0x0100 /* 16 uS */ #define MIL_TIMETAG_32 0x0080 /* 32 uS */ #define MIL_TIMETAG_64 0x0000 /* 64 uS */ #define MIL_TIMETAG_TEST 0x0300 /* test clock */ #define MIL_TIMETAG_EXT_CLOCK 0x0380 /* external clock */ /* parameter constant for BuClockSel */ #define CLOCK_16 1 /* to be verified */ #define CLOCK_12 0 /* parameter constant for BuSamplingSel */ #define SINGLE_EDGE 0 #define DOUBLE_EDGE 1 /* parameter constant for BuGetMsgType */ #define BCmode 0 #define MTmode 1 #define RTmode 2 /* ACE TYPE DEFINITIONS AND STRUCTURES -------------------------------------*/ /* structure to store a 1553 message */ typedef struct MsgStruct { unsigned char d_Type; unsigned char d_DataLength; unsigned char d_WordCount; unsigned char d_CmdWord1flag; unsigned char d_CmdWord2flag; unsigned char d_Status1flag; unsigned char d_Status2flag; unsigned char d_LoopBack1flag; unsigned char d_LoopBack2flag; unsigned int j_TimeTag; unsigned int j_GapTime; unsigned int j_BlockStatus; unsigned int j_CmdWord1; unsigned int j_CmdWord2; unsigned int j_Status1; unsigned int j_Status2; unsigned int j_LoopBack1; unsigned int j_LoopBack2; unsigned int j_ControlWord; unsigned int aj_Data[32]; } MsgType; /* ACE FUNCTION PROTOTYPES -------------------------------------------------*/ /* enables 1553A/1553B mode code handling */ MilError_t Mil1553AModeCd(MilConf_p pw_MilConf, unsigned char d_Selection); /* enables or disables word boundaries */ MilError_t MilWordBoundaries( MilConf_p pw_MilConf, unsigned char d_Selection); /* enables or disables ram parity checking */ MilError_t MilRamParityCheck( MilConf_p pw_MilConf, unsigned char d_Selection); /* setup ACE for 12 or 16 mhz clock */ MilError_t MilClockSel( MilConf_p pw_MilConf, unsigned char d_Selection); /* setup ACE for single or double clock edge sampling */ MilError_t MilSamplingSel( MilConf_p pw_MilConf, unsigned char d_Selection); /* returns the value of the timetag register */ unsigned int MilReadTimeTag( MilConf_p pw_MilConf); /* sets the response timeout time for an rt */ MilError_t MilTimeout( MilConf_p pw_MilConf, unsigned int j_Value); /* sets the time tag resoultion */ MilError_t MilTimeTagResolution( MilConf_p pw_MilConf, unsigned int j_Value); /* increment tt clock by 1 lsb if in test mode */ MilError_t MilTimeTagTest( MilConf_p pw_MilConf); /* resets time tag register to 0 */ MilError_t MilTimeTagReset( MilConf_p pw_MilConf); /* reset ACE, all registers go to 0000h */ MilError_t MilReset( MilConf_p pw_MilConf); /* message valid if message error bit an no data */ MilError_t MilValidMENoData(MilConf_p pw_MilConf, unsigned int j_Selection); /* message valid if Milsy bit an no data */ MilError_t MilValidBUSYNoData(MilConf_p pw_MilConf, unsigned int j_Selection); /* enables or disables enhanced ACE features mode */ MilError_t MilEnhancedMode( MilConf_p pw_MilConf, unsigned char d_Selection); unsigned int MilCreateCmdWord(MilConf_p pw_MilConf, unsigned int j_Rt, unsigned int j_Tr, unsigned int j_Sa, unsigned int j_Wc); /* preset ACE to library defaults */ MilError_t MilPreset( MilConf_p pw_MilConf); /* splits command word into sub-words */ void MilParseCmdWord(MilConf_p pw_MilConf, unsigned int j_CmdWord, unsigned int *j_Rt, unsigned int *j_Tr, unsigned int *j_Sa, unsigned int *j_Wc); /* Mil autotest */ MilError_t MilRTSelfTest(MilConf_p pw_MilConf); #endif /* __MILINIT__ */ // ---------------------------------------------------------------------------// /* * modification history * -------------------- * $Log: MilInit.h,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/04/27 10:21:44 scige * Some more Comment alignement before STRONG COMMENTING * * Revision 1.5 2006/02/15 14:56:56 scige * Abstract comment reformatted * History log replaced or moved at end of file */