Ejemplo n.º 1
0
static inline Std_ReturnType ComM_Internal_UpdateFromFullCom(const ComM_ChannelType* ChannelConf,
					ComM_Internal_ChannelType* ChannelInternal, boolean isRequest) {
	Std_ReturnType status = E_OK;
	if (ChannelInternal->NmIndicationMask & COMM_NM_INDICATION_BUS_SLEEP) {
		// "bus sleep" indication
		status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM637 */
		ChannelInternal->NmIndicationMask &= ~(COMM_NM_INDICATION_BUS_SLEEP);
	} else if ((ChannelInternal->NmIndicationMask & COMM_NM_INDICATION_PREPARE_BUS_SLEEP) &&
				((ChannelInternal->SubMode == COMM_FULL_COM_NETWORK_REQUESTED && ChannelConf->NmVariant == COMM_NM_VARIANT_PASSIVE) || ChannelInternal->SubMode == COMM_FULL_COM_READY_SLEEP)) {
		// "prepare bus sleep" indication
		status = ComM_Internal_Enter_SilentCom(ChannelConf, ChannelInternal);  /**< @req COMM299.partially */ /** @req COMM900 */
		ChannelInternal->NmIndicationMask &= ~(COMM_NM_INDICATION_PREPARE_BUS_SLEEP);
	} else {
		if (((ChannelInternal->InhibitionStatus & COMM_INHIBITION_STATUS_NO_COMMUNICATION) ||
			(ComM_Internal.NoCommunication == TRUE)) && ChannelInternal->DCM_Requested == FALSE) { /** @req COMM182 */
			// Inhibition is active
			if (ComM_Internal_FullComMinTime_AllowsExit(ChannelConf, ChannelInternal)) {
				if (ChannelInternal->SubMode == COMM_FULL_COM_READY_SLEEP) {
					if ((ChannelConf->NmVariant == COMM_NM_VARIANT_LIGHT) &&
						(ChannelInternal->LightTimeoutTimeLeft == 0)) {
						status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM610 */
					}
				} else {
					/** @req COMM303  @req COMM215.1 */
					status = ComM_Internal_Enter_ReadySleep(ChannelConf, ChannelInternal);
				}
			}
			if (isRequest){
				/* @req COMM142 */
				if (ComM_Internal.InhibitCounter < 65535)
				{
					ComM_Internal.InhibitCounter++;
				}
			}
		} else {
			if (ChannelInternal->UserRequestMask == 0 && ChannelInternal->DCM_Requested == FALSE) {
				// Channel no longer requested
				if (ComM_Internal_FullComMinTime_AllowsExit(ChannelConf, ChannelInternal)) {
					if (ChannelInternal->SubMode == COMM_FULL_COM_READY_SLEEP) {
						if ((ChannelConf->NmVariant == COMM_NM_VARIANT_LIGHT) &&
							(ChannelInternal->LightTimeoutTimeLeft == 0)) {
							status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM610 */
						}
					} else {
						status = ComM_Internal_Enter_ReadySleep(ChannelConf, ChannelInternal); /** @req COMM889 */ /** @req COMM888 */ /** @req COMM890 */
					}
				}
			} else {
				// Channel is requested
				if (ChannelInternal->SubMode != COMM_FULL_COM_NETWORK_REQUESTED) { /** @req COMM842 */
					status = ComM_Internal_Enter_NetworkRequested(ChannelConf, ChannelInternal);  /** @req COMM882 */ /* @req COMM883 */
				}
			}
		}
	}
	return status;
}
Ejemplo n.º 2
0
static inline Std_ReturnType ComM_Internal_UpdateFromFullCom(const ComM_ChannelType* ChannelConf,
					ComM_Internal_ChannelType* ChannelInternal, boolean isRequest) {
	Std_ReturnType status = E_OK;
	if (ChannelInternal->NmIndicationMask & COMM_NM_INDICATION_BUS_SLEEP) {
		// "bus sleep" indication
		status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM637 */
		ChannelInternal->NmIndicationMask &= ~(COMM_NM_INDICATION_BUS_SLEEP);
	} else if ((ChannelInternal->NmIndicationMask & COMM_NM_INDICATION_PREPARE_BUS_SLEEP) &&
				(ChannelInternal->SubMode == COMM_SUBMODE_READY_SLEEP)) {
		// "prepare bus sleep" indication
		status = ComM_Internal_Enter_SilentCom(ChannelConf, ChannelInternal);  /**< @req COMM299 */
		ChannelInternal->NmIndicationMask &= ~(COMM_NM_INDICATION_PREPARE_BUS_SLEEP);
	} else {
		if ((ChannelInternal->InhibitionStatus & COMM_INHIBITION_STATUS_NO_COMMUNICATION) ||
			(ComM_Internal.NoCommunication == TRUE)) {
			// Inhibition is active
			if (ComM_Internal_FullComMinTime_AllowsExit(ChannelConf, ChannelInternal)) {  /**< @req COMM205.1 */
				if (ChannelInternal->SubMode == COMM_SUBMODE_READY_SLEEP) {
					if ((ChannelConf->NmVariant == COMM_NM_VARIANT_LIGHT) &&
						(ChannelInternal->LightTimeoutTimeLeft == 0)) {
						status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM610.1 */
					}
				} else {
					/** @req COMM478.seeAlsoCOMM52  @req COMM303  @req COMM215.1  @req COMM216.1 */
					status = ComM_Internal_Enter_ReadySleep(ChannelConf, ChannelInternal);
				}
			}
			if (isRequest){
				ComM_Internal.InhibitCounter++;
			}
		} else {
			if (ChannelInternal->UserRequestMask == 0) {
				// Channel no longer requested
				if (ComM_Internal_FullComMinTime_AllowsExit(ChannelConf, ChannelInternal)) {  /**< @req COMM205.1 */
					if (ChannelInternal->SubMode == COMM_SUBMODE_READY_SLEEP) {
						if ((ChannelConf->NmVariant == COMM_NM_VARIANT_LIGHT) &&
							(ChannelInternal->LightTimeoutTimeLeft == 0)) {
							status = ComM_Internal_Enter_NoCom(ChannelConf, ChannelInternal);  /**< @req COMM610.2 */
						}
					} else {
						status = ComM_Internal_Enter_ReadySleep(ChannelConf, ChannelInternal);
					}
				}
			} else {
				// Channel is requested
				if (ChannelInternal->SubMode != COMM_SUBMODE_NETWORK_REQUESTED) {
					status = ComM_Internal_Enter_NetworkRequested(ChannelConf, ChannelInternal);  /**< @req COMM479 */
				}
			}
		}
	}
	return status;
}