/************************************************************************************************** * @fn crcCheck * * @brief Calculate the image CRC and set it ready-to-run if it is good. * * input parameters * * @param page - Flash page on which to beging the CRC calculation. * * output parameters * * None. * * @return None, but no return from this function if the CRC check is good. ************************************************************************************************** */ static void crcCheck(uint8 page, uint16 *crc) { HAL_BOARD_INIT(); /* This is in place of calling HalDmaInit() which would require init of the other 4 DMA * descriptors in addition to just Channel 0. */ //P0DIR |= 1; //P0_0 = 0; //P0_0 = 1; //P0_0 = 0; //P0_0 = 1; //P0_0 = 0; //P0_0 = 1; if (crc[0] == crcCalcDMA(page)) { //P0_0 = 0; uint16 addr = page * (HAL_FLASH_PAGE_SIZE / HAL_FLASH_WORD_SIZE) + BIM_CRC_OSET / HAL_FLASH_WORD_SIZE; crc[1] = crc[0]; crc[0] = 0xFFFF; HAL_DMA_SET_ADDR_DESC0(&dmaCh0); HalFlashWrite(addr, (uint8 *)crc, 1); HAL_SYSTEM_RESET(); } }
/************************************************************************************************** * @fn crcCheck * * @brief Calculate the image CRC and set it ready-to-run if it is good. * * input parameters * * @param page - Flash page on which to beging the CRC calculation. * * output parameters * * None. * * @return None, but no return from this function if the CRC check is good. ************************************************************************************************** */ static void crcCheck(uint8 page, uint16 *crc) { HAL_BOARD_INIT(); if (crc[0] == crcCalcDMA(page)) { //P0_0 = 0; uint16 addr = page * (HAL_FLASH_PAGE_SIZE / HAL_FLASH_WORD_SIZE) + BIM_CRC_OSET / HAL_FLASH_WORD_SIZE; crc[1] = crc[0]; crc[0] = 0xFFFF; HAL_DMA_SET_ADDR_DESC0(&dmaCh0); HalFlashWrite(addr, (uint8 *)crc, 1); HAL_SYSTEM_RESET(); } }