Ejemplo n.º 1
0
/*
 * Initializes the PDU Router.
 */
void PduR_Init (const PduR_PBConfigType* ConfigPtr) {

	//Enter(0);

	// Make sure the PDU Router is uninitialized.
	// Otherwise raise an error.
	if (PduRState != PDUR_UNINIT) {
		// Raise error and return.
		PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, 0x00, PDUR_E_INVALID_REQUEST);
	}

	else if (ConfigPtr == NULL) {
		PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, 0x00, PDUR_E_CONFIG_PTR_INVALID);
	} else {
		PduRConfig = ConfigPtr;

		// Start initialization!
		DEBUG_PRINT0(DEBUG_LOW,"--Initialization of PDU router--\n");

		//uint8 failed = 0;

		// Initialize buffers.

		/*if (failed) {
			// TODO Report PDUR_E_INIT_FAILED to Dem.
			PduRState = PDUR_REDUCED;
			DEBUG_PRINT0(DEBUG_LOW,"--Initialization of PDU router failed--\n");
		}*/

		// The initialization succeeded!
			PduRState = PDUR_ONLINE;
			DEBUG_PRINT0(DEBUG_LOW,"--Initialization of PDU router completed --\n");
	}

}
Ejemplo n.º 2
0
/*
 * Initializes the PDU Router.
 */
void PduR_Init (const PduR_PBConfigType* ConfigPtr) {

	/* !req PDUR106 */
	/* !req PDUR709 */

	// Make sure the PDU Router is uninitialized.
	// Otherwise raise an error.
	if (PduRState != PDUR_UNINIT) {
		// Raise error and return.
		PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, 0x00, PDUR_E_INVALID_REQUEST);
	}

	/* @req PDUR0776 */
	else if (ConfigPtr == NULL) {
		PDUR_DET_REPORTERROR(MODULE_ID_PDUR, PDUR_INSTANCE_ID, 0x00, PDUR_E_NULL_POINTER);
	} else {
		PduRConfig = ConfigPtr;

		// Start initialization!
		DEBUG(DEBUG_LOW,"--Initialization of PDU router--\n");

        // Initialize buffers
        /* @req PDUR308 */
        if (PduRConfig->DefaultValues != NULL && PduRConfig->DefaultValueLengths != NULL) {
            for (uint32 i = 0u; i < PduR_RamBufCfg.NTxBuffers; i++) {
                if (*PduRConfig->DefaultValueLengths[i] > 0u) {
                    memcpy(PduR_RamBufCfg.TxBuffers[i], PduRConfig->DefaultValues[i], *PduRConfig->DefaultValueLengths[i]);
                }
            }
        }

        /* @req PDUR326 */
        PduRState = PDUR_ONLINE;
        DEBUG(DEBUG_LOW,"--Initialization of PDU router completed --\n");
	}

}