Пример #1
0
void adl_main(adl_InitType_e initType) {
    s8 flashHandle = -1;
    u8 counter = 1;

    flashHandle = adl_flhSubscribe(PERSISTENT_COUNTER, 1);
    if (adl_flhExist(PERSISTENT_COUNTER, 0) == 0) {
        adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
    } else {
        adl_flhRead(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
        counter++;
        adl_flhWrite(PERSISTENT_COUNTER, 0, sizeof(counter), &counter);
    }

    if (initType == ADL_INIT_REBOOT_FROM_EXCEPTION) {
        wm_sprintf(ltsc_Temp, "\r\nA Fatal Error Occurred Test is restarting (%d)", counter);
        adl_atSendResponse(ADL_AT_UNS, ltsc_Temp);
    } else {
        wm_sprintf(ltsc_Temp, "\r\nTest modbus starting(%d) in 15s...'%d'", counter, initType);
        adl_atSendResponse(ADL_AT_UNS, ltsc_Temp);
    }

    UART_Init();

    // The application will switch the UART to data mode n seconds later, so the user has 15s to enter
    adl_tmrSubscribe(FALSE, 150, ADL_TMR_TYPE_100MS, MAIN_StartAppTimerHandler);
}
Пример #2
0
/** @brief Calls the adl_flhExist function on the provided handle and check to see if the ID exists
 *
 * @param flhHandle
 * @param flhId
 * @return < 0 on failure
 * @return >= 0 on Success
 */
s8 FlashExists(char const *const flhHandle, u16 flhId)
{
	s32 RetCode = 0;
	RetCode = adl_flhExist((char *)flhHandle, flhId);

	TRACE((1, "FlashExist "));
	TRACE((1, "Ids %x", flhId));

	if (RetCode < 0)
	{
		DisplayErrorCode("adl_flhExist", __FILE__, __LINE__ - 7, RetCode);
	}
	else
	{
		TRACE((1, "Successfully found the flash ID and its length is %d", RetCode));
	}
	return RetCode;
}