/** * @brief Check if any interface is available in a time limitation then lock it for usage. * @param[in] tCAN The pointer to CAN module base address. * @retval 0 IF0 is free * @retval 1 IF1 is free * @retval 2 No IF is free * @details Search the first free message interface, starting from 0. If no interface is * it will try again until time out. If a interface is available, set a flag to * lock the interface. */ static uint32_t LockIF_TL(CAN_T *tCAN) { uint32_t u32Count; uint32_t u32FreeIfNo; for(u32Count = 0; u32Count < RETRY_COUNTS; u32Count++) { if((u32FreeIfNo = LockIF(tCAN)) != 2) return u32FreeIfNo; } return u32FreeIfNo; }
/** * @brief Check if any interface is available in a time limitation then lock it for usage. * @param[in] tCAN The pointer to CAN module base address. * @retval 0 IF0 is free * @retval 1 IF1 is free * @retval 2 No IF is free * @details Search the first free message interface, starting from 0. If no interface is * it will try again until time out. If a interface is available, set a flag to * lock the interface. */ static uint32_t LockIF_TL(CAN_T *tCAN) { uint32_t u32Count; uint32_t u32FreeIfNo; for(u32Count = 0ul; u32Count < RETRY_COUNTS; u32Count++) { if((u32FreeIfNo = LockIF(tCAN)) != 2ul) { break; } else { } } return u32FreeIfNo; }