📄 csslib_dy4.c
字号:
STATUS cssGetVmeA24Image ( char **vmeA24Base, /* pointer to pointer to return A24 address */ UINT *vmeA24Size /* pointer to UINT to return A24 size */ ) { int ps; UINT32 temp = 0; if (cssInitialized == FALSE) { return (ERROR); } ps = intLock(); temp = sysInLong((UINT32)(UNIVERSE_VSI0_BS)); /* check if this is an A24 Address programmed by firmware */ if(temp <= (0x10000 + VME_A24_MSTR_SIZE)) { /* use this register set */ *vmeA24Size = (UINT) ((sysInLong((UINT32)(UNIVERSE_VSI0_BD))) - temp); } else { /* the vxWorks bootrom has already done the Job, so the result is in VSI1 */ temp = sysInLong((UINT32)(UNIVERSE_VSI1_BS)); *vmeA24Size = (UINT) ((sysInLong((UINT32)(UNIVERSE_VSI1_BD))) - temp); } *vmeA24Base = (char *)temp; intUnlock (ps); return (OK); }#endif/***************************************************************************** cssGetCardType - CSS Wrapper function for Get_card_type.** This routine provides a wrapper function for the CSS Service call ** RETURNS: OK always** SEE ALSO: {$BSP_DIR}/src/drv/vxCss/cssLib.c, cssInit()** History**/STATUS cssGetCardType ( UINT *form, /* DVME/SVME */ UINT *card, /* numeric type (162/163/144/180...) */ UINT *variant /* variant number */ ) { int ps; if (cssInitialized == FALSE) { return(ERROR); } ps = intLock(); /* TO DO: Add cssX CALL */ *form = 0; *variant = 0;#ifdef VME_182 *card = 182;#endif#ifdef CCA_145 *card = 145;#endif#ifdef CCA_146 *card = 146;#endif#ifdef VME_183 *card = 183;#endif#ifdef SCP_124 *card = 124;#endif intUnlock (ps); return (OK); }/***************************************************************************** cssNVM_erase - CSS Wrapper function for NVM_erase** This routine provides a wrapper function for the CSS Service call ** RETURNS: OK or ERROR depending on whether the CSS experienced an error.** SEE ALSO: {$BSP_DIR}/src/drv/vxCss/cssLib.c, cssInit().** History**/STATUS cssNVM_erase ( void *destAddress, /* Start address of Flash sector/block to erase */ UINT numOfBytes, /* Number of bytes to erase */ css_nvmp_memory_struct *bankInfo, /* Not Used */ void (*notifyRoutine) (UINT progress) /* only call at 100% complete */ ) { UINT32 ret = (UINT32) ERROR; if (cssNVMInit == FALSE) { /* init the nvmp routines */ ss_nvmInit(); cssNVMInit = TRUE; } if (semTake (flashBankLock, SEM_TIMEOUT) == ERROR) { return (ERROR); } else { ret = ss_nvmErase ((uint32)destAddress, (uint32)numOfBytes, bankInfo, (void*)notifyRoutine); semGive (flashBankLock); } if(ret == CSS_OK) { return OK; } else {#ifdef NVM_DEBUG ss_nvmPrintError(ret);#endif return ERROR; } }/***************************************************************************** cssNVM_get_info - CSS Wrapper function for CSS_NVM_getinfo** This routine provides a wrapper function for the CSS Service call ** RETURNS: information about an NVM device.** SEE ALSO: {$BSP_DIR}/src/drv/vxCss/cssLib.c, cssInit(),*** History* */UINT cssNVM_get_info ( UINT operation, /* Supported operations: */ void * destAddress, /* start address of Flash area to check */ UINT parameter, /* extra data needed for some operations */ css_nvmp_memory_struct * bankInfo, /* Not used */ void ** result /* */ ) { UINT ret = (UINT) ERROR; if (cssNVMInit == FALSE) { /* init the nvmp routines */ ss_nvmInit(); cssNVMInit = TRUE; } if (semTake (flashBankLock, SEM_TIMEOUT) == ERROR) { return (UINT) ERROR; } ret = (UINT)(ss_nvmGetInfo ((uint32)operation, destAddress, (uint32)parameter, bankInfo, result)); semGive (flashBankLock); return (ret); }/***************************************************************************** cssNVM_lock - CSS Wrapper function for NVM_lock** This routine provides a wrapper function for the CSS Service call ** RETURNS: OK or ERROR depending on whether the CSS experienced an error.** SEE ALSO: {$BSP_DIR}/src/drv/vxCss/cssLib.c, cssInit(), NVM_lock()** History* */STATUS cssNVM_lock ( void * destAddress, /* address within Flash bank to be locked/unlocked */ UINT numOfBytes, UINT status, /* FLASH_LOCK = 1 FLASH_UNLOCK = 2 */ css_nvmp_memory_struct * bankInfo /* legacy struct-not needed */ ) { UINT32 ret = (UINT32) ERROR; if (cssNVMInit == FALSE) { /* init the nvmp routines */ ss_nvmInit(); cssNVMInit = TRUE; } if (semTake (flashBankLock, SEM_TIMEOUT) == ERROR) { return (ERROR); } ret = ss_nvmLock ((uint32)destAddress, (uint32)numOfBytes, (uint32)status, bankInfo); semGive (flashBankLock); if(ret == CSS_OK) { return (OK); } else {#ifdef NVM_DEBUG ss_nvmPrintError(ret);#endif return (ERROR); } } /***************************************************************************** cssNVM_program - CSS Wrapper function for NVM_program** This routine provides a wrapper function for the CSS Service call ** RETURNS: OK or ERROR depending on whether the CSS experienced an error.** SEE ALSO: {$BSP_DIR}/src/drv/vxCss/cssLib.c, cssInit(), NVM_program()** History* */STATUS cssNVM_program ( void * sourceAddress, /* address of buffer with data to program */ void * destAddress, /* start address in Flash bank to program data to */ UINT numOfBytes, /* number of bytes to program */ css_nvmp_memory_struct * bankInfo, /* Not Used */ void * buffer, /* Not Used */ UINT size, /* Not Used */ UINT updateCS, /* Not Used */ void (*notifyRoutine)(UINT progress) /* will only at execute after 100% */ ) { error_code_t ret = (error_code_t) ERROR; if (cssNVMInit == FALSE) { /* init the nvmp routines */ ss_nvmInit(); cssNVMInit = TRUE; } if (semTake (flashBankLock, SEM_TIMEOUT) == ERROR) { return (ERROR); } else { ret = ss_nvmProgram ((uint32)sourceAddress, (uint32)destAddress, (uint32)numOfBytes, bankInfo, (uint32)buffer, size, (void*)notifyRoutine); semGive (flashBankLock); } if(ret == CSS_OK) { return (OK); } else {#ifdef NVM_DEBUG ss_nvmPrintError(ret);#endif return (ERROR); }}/*FUNCTION HEADER*************************************************************** Name : cssCheckSum* Description : Calculates a 32-bit checksum from 16-bit words of the specified range.* Only size multiples of 2 will be summed - extra byte not included.* Arguments : * Type Name In/Out Description* ================== ================= ====== ======================* void *pStartAddress in Start address* UINT32 uSize in size in bytes* Return Value : UINT32* None**END FUNCTION HEADER*********************************************************/UINT32 cssCheckSum( const void *pStartAddress, const UINT32 uSize){ UINT32 csResult; ss_checkSumCalculation(pStartAddress,uSize, &csResult); return(csResult);}#if 0 /* these functions are currently not available *//*FUNCTION HEADER*************************************************************** Name : cssIspExecute* Description : Start In-Circuit Service Programming process to the configuration PROM .** Arguments :* Type Name In/Out Description* ================== ==================== ====== ======================* UINT8 *startBufferAddress in Buffer Start address* Return Value : OK or ERROR if the Programming process failed.* None**END FUNCTION HEADER*********************************************************/STATUS cssIspExecute( UINT8 *startBufferAddress){ int ispStatus; ispStatus = xsvfExecute(startBufferAddress); if (ispStatus != 0) return(ERROR); else return(OK);}#endif/*end of file*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -