StdCan_Ret_t StdCan_Init(Node_Desc_t* node_desc) { #endif StdCan_Ret_t retval; /* Reset all queue variables. */ RxQ_Rd_idx = 0; RxQ_Wr_idx = 0; RxQ_Len = 0; #if (STDCAN_TX_QUEUE_SIZE > 1) TxQ_Rd_idx = 0; TxQ_Wr_idx = 0; TxQ_Len = 0; #endif #if defined(_AVRLIB_BIOS_) /* Initialize BIOS' interface for CAN. */ BIOS_CanCallback = Can_Process; retval = StdCan_Ret_OK; #else /* Initialize CAN driver. */ if (Can_Init() == CAN_OK) retval = StdCan_Ret_OK; else retval = StdCan_Ret_Fail; #endif //TODO: Do something with the Node Descriptor. //(why have constats passed as parameters? they are defined at compiletime /arune) #if defined(_AVRLIB_BIOS_) /* TODO: When a Tx queue is implemented, the startup message should * be sent via StdCan_Put instead of directly to lower layer. */ Can_Message_t Startup; /* Set up Startup message format. */ Startup.ExtendedFlag = 1; Startup.RemoteFlag = 0; Startup.DataLength = 4; #ifdef MODULE_APPLICATION Startup.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE); Startup.Data.bytes[0] = NODE_HW_ID&0xff; Startup.Data.bytes[1] = (NODE_HW_ID>>8)&0xff; Startup.Data.bytes[2] = (NODE_HW_ID>>16)&0xff; Startup.Data.bytes[3] = (NODE_HW_ID>>24)&0xff; #else Startup.Id = (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE) | (NODE_ID << CAN_SHIFT_NMT_SID); Startup.Data.bytes[1] = APP_TYPE&0xff; Startup.Data.bytes[0] = (APP_TYPE>>8)&0xff; Startup.Data.bytes[3] = APP_VERSION&0xff; Startup.Data.bytes[2] = (APP_VERSION>>8)&0xff; #endif /* Try to send it. */ Can_Send(&Startup); #endif return retval; }
/* Dcm Example Initialise Routine. * 初始化Can、CanIf、PduR和DCM , * 需要使用“dcm_ex1.arxml”生成其相应配置文件。*/ void DcmEx1Init(void) { Can_Init(&Can_ConfigData); CanIf_Init(&CanIf_Config); CanTp_Init(); PduR_Init(&PduR_Config); Dcm_Init(); //启动配置的两个CAN通道 CAN_CTRL_0 和 CAN_CTRL_1 CanIf_SetControllerMode(vCanIf_Channel_0,CANIF_CS_STARTED); CanIf_SetControllerMode(vCanIf_Channel_1,CANIF_CS_STARTED); }
int main(void) { // Enable interrupts as early as possible sei(); Timer_Init(); Serial_Init(); uint8_t returnval = Can_Init(); if (returnval != CAN_OK) { } Can_Message_t txMsg; txMsg.Id = (CAN_NMT_APP_START << CAN_SHIFT_NMT_TYPE) | (NODE_ID << CAN_SHIFT_NMT_SID); txMsg.DataLength = 4; txMsg.RemoteFlag = 0; txMsg.ExtendedFlag = 1; txMsg.Data.words[0] = APP_TYPE; txMsg.Data.words[1] = APP_VERSION; // Set up callback for CAN reception, this is optional if only sending is required. BIOS_CanCallback = &can_receive; // Send CAN_NMT_APP_START BIOS_CanSend(&txMsg); while (1) { if (extRxMsgFull) { txMsg.Id = extRxMsg.Id; txMsg.DataLength = extRxMsg.DataLength; txMsg.RemoteFlag = extRxMsg.RemoteFlag; txMsg.ExtendedFlag = extRxMsg.ExtendedFlag; for (uint8_t i = 0; i < txMsg.DataLength; i++) { txMsg.Data.bytes[i] = extRxMsg.Data.bytes[i]; } BIOS_CanSend(&txMsg); extRxMsgFull = 0; // } if (rxMsgFull) { extTxMsg.Id = rxMsg.Id; extTxMsg.DataLength = rxMsg.DataLength; extTxMsg.RemoteFlag = rxMsg.RemoteFlag; extTxMsg.ExtendedFlag = rxMsg.ExtendedFlag; for (uint8_t i = 0; i < extTxMsg.DataLength; i++) { extTxMsg.Data.bytes[i] = rxMsg.Data.bytes[i]; } Can_Send(&extTxMsg); rxMsgFull = 0; // } } return 0; }
void StartupHook(void) { /* Add Code Here */ (void)SetRelAlarm(ID_vAlarmReceiver,50,10); (void)SetRelAlarm(ID_vAlarmSender,100,200); (void)SetRelAlarm(ID_vAlarmMainFunction,200,1); //so cyclic 1 Ticks = 4ms Can_Init(&Can_ConfigData); CanIf_Init(&CanIf_Config); CanNm_Init(&CanNm_Config); CanSM_Init(&CanSM_Cfg); Nm_Init(&Nm_Config); ComM_Init(&ComM_Cfg); CanIf_SetControllerMode(vCanIf_Channel_0,CANIF_CS_STARTED); CanIf_SetControllerMode(vCanIf_Channel_1,CANIF_CS_STARTED); Nm_PassiveStartUp(vNm_Channel_0); ComM_RequestComMode(vComM_User_0,COMM_FULL_COMMUNICATION); CanNm_NetworkRequest(vCanNm_Channel_0); }
void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr) { (void)ConfigPtr; #if defined(USE_SPI) // Setup SPI Spi_Init(ConfigPtr->SpiConfig); #endif #if defined(USE_EEP) // Setup EEP NO_DRIVER(Eep_Init(ConfigPtr->EepConfig)); #endif #if defined(USE_FLS) // Setup Flash NO_DRIVER(Fls_Init(ConfigPtr->FlashConfig)); #endif #if defined(USE_FEE) // Setup FEE NO_DRIVER(Fee_Init()); #endif #if defined(USE_EA) // Setup EA NO_DRIVER(Ea_Init()); #endif #if defined(USE_NVM) // Setup NVRAM Manager and start the read all job NO_DRIVER(NvM_Init()); NO_DRIVER(NvM_ReadAll()); #endif #if defined(USE_LIN) // Setup Lin driver Lin_Init(ConfigPtr->LinConfig); #endif #if defined(USE_LINIF) // Setup LinIf LinIf_Init(ConfigPtr->LinIfConfig); #endif #if defined(USE_LINSM) // Setup LinSM LinSM_Init(ConfigPtr->LinSMConfig); #endif // Setup CAN tranceiver // NOTE: Add when adding supoprt for CanTranceiver #if defined(USE_CAN) // Setup Can driver Can_Init(ConfigPtr->CanConfig); #endif #if defined(USE_CANIF) // Setup CanIf NO_DRIVER(CanIf_Init(ConfigPtr->PostBuildConfig->CanIf_ConfigPtr)); #endif #if defined(USE_CANTP) // Setup CAN TP NO_DRIVER(CanTp_Init(ConfigPtr->PostBuildConfig->CanTp_ConfigPtr)); #endif #if defined(USE_CANSM) NO_DRIVER(CanSM_Init(ConfigPtr->CanSMConfig)); #endif #if defined(USE_J1939TP) // Setup J1939Tp NO_DRIVER(J1939Tp_Init(ConfigPtr->J1939TpConfig)); #endif #if defined(USE_PDUR) // Setup PDU Router NO_DRIVER(PduR_Init(ConfigPtr->PostBuildConfig->PduR_ConfigPtr)); #endif #if defined(USE_CANNM) // Setup Can Network Manager NO_DRIVER(CanNm_Init(ConfigPtr->PostBuildConfig->CanNm_ConfigPtr)); #endif #if defined(USE_UDPNM) // Setup Udp Network Manager NO_DRIVER(UdpNm_Init(ConfigPtr->UdpNmConfig)); #endif #if defined(USE_NM) // Setup Network Management Interface NO_DRIVER(Nm_Init()); #endif #if defined(USE_COM) // Setup COM layer NO_DRIVER(Com_Init(ConfigPtr->PostBuildConfig->ComConfigurationPtr)); #endif #if defined(USE_DCM) // Setup DCM NO_DRIVER(Dcm_Init(ConfigPtr->DcmConfig)); #endif #if defined(USE_IOHWAB) // Setup IO hardware abstraction layer IoHwAb_Init(); #endif #if defined(USE_XCP) // Setup XCP NO_DRIVER(Xcp_Init(ConfigPtr->XcpConfig)); #endif }
void EcuM_Callout_DriverInitListTwo(void) { /* status of NvM initialization */ NvM_RequestResultType Result; BswM_Init(BswM_ConfigPtr); Fls_Init(NULL_PTR); #ifdef BASE_EA_ENABLED EA_INIT_FUNC(); #endif #ifdef BASE_FEE_ENABLED FEE_INIT_FUNC(); /* wait for FEE to complete the init sequence */ do { Fee_MainFunction(); Fls_MainFunction(); } while (MEMIF_IDLE != Fee_GetStatus()); #endif #ifdef BASE_NVM_ENABLED NVM_INIT_FUNC(); NvM_ReadAll(); /* wait for the NvM_ReadAll() to complete - some of the remaining modules need valid NvRam data... */ do { NvM_MainFunction(); Fee_MainFunction(); Fls_MainFunction(); (void)NvM_GetErrorStatus(NvMConf_NvMBlockDescriptor_NvMBlock_ConfigID, &Result); } while (Result == NVM_REQ_PENDING); #endif LinEmuUart_Init(); Can_InitMemory(); Can_Init(&CanConfigSet); CanIf_InitMemory(); CanIf_Init(&CanIf_Config); //CanNm_Init(&CanNmGlobalConfig); //Nm_Init(&Nm_Configuration0); PduR_InitMemory(); PduR_Init(&PduRGlobalConfig); Com_InitMemory(); Com_Init(&ComConfig); CanSM_InitMemory(); CanSM_Init(); CanTp_InitMemory(); CanTp_Init(); ComM_InitMemory(); ComM_Init(&ComMConfig); Xcp_Init(NULL); FiM_Init(&FiM_Config_0); DiagMeas_Init(); DiagCtrl_Init(); SCI_B6Bridge_Init(); SCI_Pfc_Init(); SCI_IOHW_Init(); #ifdef BASE_DEM_ENABLED DEM_INIT_FUNC(); /* start the standard operation cycle */ /* (void) Dem_SetOperationCycleState(DEM_OPCYC_POWER, DEM_CYCLE_STATE_START); */ #endif Dcm_Init(); }
/*----------------------------------------------------------------------------- * Main Program *---------------------------------------------------------------------------*/ int main(void) { Mcu_Init(); Timebase_Init(); sei(); #if defined(UART_OUTPUT) Serial_Init(); printf("\n------------------------------------------------------------\n"); printf( " CAN Test:\n"); printf( " Periodic Transmission on CAN\n"); printf( " CAN Dump\n"); printf( " CAN Echo\n"); printf( "------------------------------------------------------------\n"); printf("CanInit..."); if (Can_Init() != CAN_OK) { printf("FAILED!\n"); printf("Check wires between AVR and MCP2515 and the MCP speed (xtal)."); } else { printf("OK!\n"); printf("MCP2515 working fine\n"); } #elif defined(LED_OUTPUT) Can_Init(); #else Can_Init(); #endif uint32_t timeStamp = 0; Can_Message_t txMsg; Can_Message_t rxMsg; txMsg.RemoteFlag = 0; txMsg.ExtendedFlag = 1; txMsg.Id = SENDING_ID; txMsg.DataLength = 2; txMsg.Data.bytes[0] = 0x12; txMsg.Data.bytes[1] = 0x34; /* main loop */ while (1) { /* service the CAN routines */ Can_Service(); /* send CAN message and check for CAN errors once every second */ if (Timebase_PassedTimeMillis(timeStamp) >= 1000) { timeStamp = Timebase_CurrentTime(); /* send txMsg */ txMsg.Id = SENDING_ID; Can_Send(&txMsg); } /* check if any messages have been received */ while (Can_Receive(&rxMsg) == CAN_OK) { #if defined(UART_OUTPUT) /* Dump message data on uart */ printf("\nPKT %#lx %u %u", rxMsg.Id, (uint16_t)(rxMsg.ExtendedFlag), (uint16_t)(rxMsg.RemoteFlag)); for (uint8_t i=0; i<rxMsg.DataLength; i++) { printf(" %#x", rxMsg.Data.bytes[i]); } #endif /* Echo function */ if(rxMsg.Id == ECHO_RECEIVE_ID){ #if defined(UART_OUTPUT) printf("\n\"ping\" received"); txMsg.Id = ECHO_SENDING_ID; /* Send reply */ Can_Send(&txMsg); printf("\nreply sent"); #else txMsg.Id = ECHO_SENDING_ID; /* Send reply */ Can_Send(&txMsg); #endif } } } return 0; }
/*----------------------------------------------------------------------------- * Main Program *---------------------------------------------------------------------------*/ int main(void) { // For calibrating internal oscillator // OSCCAL = eeprom_read_byte(0); Timebase_Init(); Serial_Init(); #if MCP_CS_BIT != PB2 /* If slave select is not set as output it might change SPI hw to slave * See ch 18.3.2 (18.3 SS Pin Functionality) in ATmega48/88/168-datasheet */ DDRB |= (1<<PB2); #endif #if USE_STDCAN == 0 Can_Init(); #else StdCan_Init(0); #endif DDRC |= 1<<PC1 | 1<<PC0; PORTC |= (1<<PC1) | (1<<PC0); sei(); #if SENDTIMESTAMP == 1 #if USE_STDCAN == 0 Can_Message_t timeMsg; #else StdCan_Msg_t timeMsg; #endif uint32_t time = Timebase_CurrentTime(); uint32_t time1 = time; uint32_t unixtime = 0; #endif uint16_t rxByte; uint8_t i = 0; #if SENDTIMESTAMP == 1 #if USE_STDCAN == 0 timeMsg.ExtendedFlag = 1; timeMsg.RemoteFlag = 0; timeMsg.DataLength = 8; #else /* Jag orkar inte fixa in datan i paketen, sätter längd till 0 sålänge */ timeMsg.Length = 0; #endif timeMsg.Id = (CAN_NMT << CAN_SHIFT_CLASS) | (CAN_NMT_TIME << CAN_SHIFT_NMT_TYPE); //timeMsg.Id = 0; //Same thing, and lib's can.h is not updated. #endif #if USE_STDCAN == 1 StdCan_Msg_t rxMsg; #endif /* main loop */ while (1) { /* any new CAN messages received? */ #if USE_STDCAN == 0 if (rxMsgFull) { #else if (StdCan_Get(&rxMsg) == StdCan_Ret_OK) { #endif // Toggle activity LED PORTC ^= (1<<PC1); /* send message to CanWatcher */ uart_putc(UART_START_BYTE); uart_putc((uint8_t)rxMsg.Id); uart_putc((uint8_t)(rxMsg.Id>>8)); uart_putc((uint8_t)(rxMsg.Id>>16)); uart_putc((uint8_t)(rxMsg.Id>>24)); #if USE_STDCAN == 0 uart_putc(rxMsg.ExtendedFlag); uart_putc(rxMsg.RemoteFlag); uart_putc(rxMsg.DataLength); for (i=0; i<8; i++) { uart_putc(rxMsg.Data.bytes[i]); } #else uart_putc(1); uart_putc(0); uart_putc(rxMsg.Length); for (i=0; i<8; i++) { uart_putc(rxMsg.Data[i]); } #endif uart_putc(UART_END_BYTE); #if USE_STDCAN == 0 rxMsgFull = 0; #endif } /* any UART bytes received? */ rxByte = uart_getc(); while (rxByte != UART_NO_DATA) { /* parse byte! */ UartParseByte((uint8_t)(rxByte & 0x00FF)); /* receive next */ rxByte = uart_getc(); } #if SENDTIMESTAMP == 1 time1 = Timebase_CurrentTime(); if ((time1 - time) > 1000) { time = time1; #if USE_STDCAN == 0 timeMsg.Data.dwords[0] = ++unixtime; IncTime(); timeMsg.Data.dwords[1] = date.packed; Can_Send(&timeMsg); #else /* Jag orkar inte fixa in datan i paketen, sätter längd till 0 sålänge */ StdCan_Put(&timeMsg); #endif } #endif } return 0; }
/*----------------------------------------------------------------------------- * Main Program *---------------------------------------------------------------------------*/ int main(void) { uint32_t timeStamp = 0, timeStampTurn = 0; uint8_t buffering = FALSE, gpsMsg_received = FALSE, rxGps_element; char buffer[100], rxGps; /* GPGGA, Global positioning system fix data */ char gga_utc[7], gga_latitude[9], gga_latitude_NS, gga_longitude[10], gga_longitude_EW; /* GPVTG, Course over ground and speed */ char vtg_course_true[6], vtg_course_magnetic[6], vtg_speed_kmh[6]; /* GPZDA, Time & Date */ char zda_time[7], zda_day[3], zda_month[3], zda_year[5]; char *pch; Timebase_Init(); Serial_Init(); sei(); #if DEBUG printf("\n------------------------------------------------------------\n"); printf( " CAN: GPS\n"); printf( "------------------------------------------------------------\n"); printf("CanInit..."); if (Can_Init() != CAN_OK) { printf("FAILED!\n"); }else{ printf("OK!\n"); } #else Can_Init(); #endif Can_Message_t txMsg; Can_Message_t rxMsg; txMsg.Id = GPS_CMD_SEND; txMsg.RemoteFlag = 0; txMsg.ExtendedFlag = 1; txMsg.DataLength = 3; /* main loop */ while (1) { /* service the CAN routines */ Can_Service(); /* check if any messages have been received */ while (Can_Receive(&rxMsg) == CAN_OK) { /* This node that control a servo is adressed */ if( rxMsg.Id == GPS_CMD_GET ){ } } if( Timebase_PassedTimeMillis(timeStamp) >= STATUS_SEND_PERIOD ){ timeStamp = Timebase_CurrentTime(); /* Send blinds status to CAN */ } /* Get data from GPS */ rxGps = uart_getc(); while( rxGps != UART_NO_DATA ){ /* '$' indicates start of message, start buffering */ if( rxGps == '$' ){ buffering = TRUE; rxGps_element = 0; }else if( rxGps == CR ){ /* End of message */ buffer[rxGps_element]='\0'; buffering = FALSE; gpsMsg_received = TRUE; } if( buffering ){ buffer[ rxGps_element ] = rxGps; rxGps_element++; } /* Get next character */ rxGps = uart_getc(); } if( gpsMsg_received ){ /* One whole msg is completed, start compare and parse */ if( !strncmp(buffer, "GPGGA", 5) ){ /* Standard NMEA message, $GPGGA */ strtok(buffer, GPS_MSG_DELIMITER); /* Throw away "GPGGA" */ /* Get UTC */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(gga_utc, pch); /* Get latitude */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(gga_latitude, pch); /* Get latitude N/S */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(gga_latitude_NS, pch); /* Get longitude */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(gga_longitude, pch); /* Get longitude E/W */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(gga_longitude_EW, pch); }else if( !strncmp(buffer, "GPVTG", 5) ){ /* Standard NMEA message, $GPVTG */ strtok(buffer, GPS_MSG_DELIMITER); /* Throw away "GPVTG" */ /* Get course over ground, true degree */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(vtg_course_true, pch); /* Get course over ground, magnetic degree */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(vtg_course_magnetic, pch); /* Get speed over ground, km/h */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(vtg_speed_kmh, pch); }else if( !strncmp(buffer, "GPZDA", 5) ){ /* Standard NMEA message, $GPZDA */ strtok(buffer, GPS_MSG_DELIMITER); /* Throw away "GPZDA" */ /* Get time */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(zda_time, pch); /* Get day, 0-31 */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(zda_day, pch); /* Get month, 1-12 */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(zda_month, pch); /* Get year */ pch = strtok(NULL, GPS_MSG_DELIMITER); strcpy(zda_year, pch); } gpsMsg_received = FALSE; /* Get ready for next message */ } } return 0; }
int init_can(void) { return Can_Init(); }
/*----------------------------------------------------------------------------- * Main Program *---------------------------------------------------------------------------*/ int main(void) { uint8_t nSensors, i; uint8_t subzero, cel, cel_frac_bits; Mcu_Init(); Timebase_Init(); Serial_Init(); sei(); printf( "\nDS18X20 1-Wire-Reader\n" ); printf( "-----------------------" ); nSensors = search_sensors(); printf( "%i DS18X20 Sensor(s) available:\n", (int) nSensors ); for (i=0; i<nSensors; i++) { printf("Sensor# %i is a ", (int) i+1); if ( gSensorIDs[i][0] == DS18S20_ID) printf("DS18S20/DS1820"); else printf("DS18B20"); printf(" which is "); if ( DS18X20_get_power_status( &gSensorIDs[i][0] ) == DS18X20_POWER_PARASITE ) printf( "parasite" ); else printf( "externally" ); printf( " powered\n" ); } printf("CanInit...\n"); if (Can_Init() != CAN_OK) { printf("FAILED!\n"); } else { printf("OK!\n"); } uint32_t timeStamp = 0; Can_Message_t txMsg; Can_Message_t rxMsg; txMsg.DataLength = 2; txMsg.Id = 0; txMsg.RemoteFlag = 0; txMsg.ExtendedFlag = 1; /* main loop */ while (1) { /* service the CAN routines */ Can_Service(); /* check if any messages have been received */ while (Can_Receive(&rxMsg) == CAN_OK) { } /* check temperature and send on CAN once every other second */ if (Timebase_PassedTimeMillis(timeStamp) >= 2000) { timeStamp = Timebase_CurrentTime(); if ( DS18X20_start_meas( DS18X20_POWER_PARASITE, NULL ) == DS18X20_OK) { printf("Measuring temperature... "); delay_ms(DS18B20_TCONV_12BIT); for ( i=0; i<nSensors; i++ ) { if ( DS18X20_read_meas( &gSensorIDs[i][0], &subzero, &cel, &cel_frac_bits) == DS18X20_OK ) { //txMsg.Data.bytes[0] = subzero; if (subzero) { txMsg.Data.bytes[i*2] = -cel; txMsg.Data.bytes[i*2+1] = ~(cel_frac_bits<<4); } else { txMsg.Data.bytes[i*2] = cel; txMsg.Data.bytes[i*2+1] = (cel_frac_bits<<4); } } else printf("CRC Error (lost connection?)\n"); } txMsg.DataLength = nSensors*2; printf("sending...\n"); /* send txMsg */ Can_Send(&txMsg); } else printf("Start meas. failed (short circuit?)\n"); } } return 0; }
void EcuM_AL_DriverInitTwo(const EcuM_ConfigType* ConfigPtr) { (void)ConfigPtr; //lint --e{715} PC-Lint (715) - ConfigPtr usage depends on configuration of modules // VALIDATE_STATE(ECUM_STATE_STARTUP_TWO); #if defined(USE_ETH) buffer_init(); Eth_Init(); #endif //#undef USE_USB #if defined(USE_USB) // usb_heap_init(); // mailboxInit(); // usb_sem_init(); usbinit(); #endif #if defined(USE_SPI) // Setup SPI Spi_Init(ConfigPtr->SpiConfig); #endif #if defined(USE_EEP) // Setup EEP NO_DRIVER(Eep_Init(ConfigPtr->EepConfig)); #endif #if defined(USE_FLS) // Setup Flash NO_DRIVER(Fls_Init(ConfigPtr->FlashConfig)); #endif #if defined(USE_FEE) // Setup FEE NO_DRIVER(Fee_Init()); #endif #if defined(USE_EA) // Setup EA NO_DRIVER(Ea_Init()); #endif #if defined(USE_NVM) // Setup NVRAM Manager and start the read all job NO_DRIVER(NvM_Init()); NO_DRIVER(NvM_ReadAll()); #endif #if defined(USE_LIN) // Setup Lin driver Lin_Init(ConfigPtr->LinConfig); #endif #if defined(USE_LINIF) // Setup LinIf LinIf_Init(ConfigPtr->LinIfConfig); #endif #if defined(USE_LINSM) // Setup LinSM LinSM_Init(ConfigPtr->LinSMConfig); #endif // Setup CAN tranceiver // TODO #if defined(USE_CAN) // Setup Can driver Can_Init(ConfigPtr->CanConfig); #endif #if defined(USE_CANIF) // Setup CanIf NO_DRIVER(CanIf_Init(ConfigPtr->PostBuildConfig->CanIf_ConfigPtr)); #endif #if defined(USE_CANTP) // Setup CAN TP NO_DRIVER(CanTp_Init(ConfigPtr->PostBuildConfig->CanTp_ConfigPtr)); #endif #if defined(USE_CANSM) NO_DRIVER(CanSM_Init(ConfigPtr->CanSMConfig)); #endif #if defined(USE_J1939TP) // Setup J1939Tp NO_DRIVER(J1939Tp_Init(ConfigPtr->J1939TpConfig)); #endif // Setup LIN // TODO #if defined(USE_PDUR) // Setup PDU Router NO_DRIVER(PduR_Init(ConfigPtr->PostBuildConfig->PduR_ConfigPtr)); #endif #if defined(USE_CANNM) // Setup Can Network Manager NO_DRIVER(CanNm_Init(ConfigPtr->PostBuildConfig->CanNm_ConfigPtr)); #endif #if defined(USE_UDPNM) // Setup Udp Network Manager NO_DRIVER(UdpNm_Init(ConfigPtr->UdpNmConfig)); #endif #if defined(USE_NM) // Setup Network Management Interface NO_DRIVER(Nm_Init()); #endif #if defined(USE_COM) // Setup COM layer NO_DRIVER(Com_Init(ConfigPtr->PostBuildConfig->ComConfigurationPtr)); #endif #if defined(USE_DCM) // Setup DCM NO_DRIVER(Dcm_Init(ConfigPtr->DcmConfig)); #endif #if defined(USE_IOHWAB) // Setup IO hardware abstraction layer IoHwAb_Init(); #endif }