1  | void getECUData(can_mb_conf_t *p_sc_mailbox_rx, can_mb_conf_t *p_sc_mailbox_tx) {    
 | 
2  |     
  | 
3  |     /* Note: The CAN transceiver should be configured before initializing the CAN module. */
  | 
4  |     can_reset_all_mailbox(CAN0);    
  | 
5  |     reset_mailbox_conf(p_sc_mailbox_rx);
  | 
6  | 
  | 
7  |     /* Init CAN0 Mailbox 1 to Reception Mailbox. */
  | 
8  |     p_sc_mailbox_rx->ul_mb_idx = TEST1_CAN_COMM_MB_IDX + 1;  //mailbox 1
  | 
9  |     p_sc_mailbox_rx->uc_obj_type = CAN_MB_RX_MODE;
  | 
10  |     p_sc_mailbox_rx->ul_id_msk = CAN_MAM_MIDvA_Msk | CAN_MAM_MIDvB_Msk; //CAN 2.0A + B    
  | 
11  |     if (!eepromData[EEPROM_CAN_11_29_BIT_ID]){
 | 
12  |       p_sc_mailbox_rx->ul_id = CAN_MID_MIDvA(0x7E8);  //get 7E8 from engine control module
  | 
13  |       p_sc_mailbox_rx->uc_id_ver = 0; // 0/1: standard/extended frame  
  | 
14  |     }
  | 
15  |     else  {
 | 
16  |       p_sc_mailbox_rx->ul_id = CAN_MID_MIDvB(0x7E8);  //get 7E8 from engine control module    
  | 
17  |       p_sc_mailbox_rx->uc_id_ver = 1; // 0/1: standard/extended frame
  | 
18  |     }  
  | 
19  |     can_mailbox_init(CAN0, p_sc_mailbox_rx);
  | 
20  |     
  | 
21  | 
  | 
22  | // RELEVANTE SENDEROUTINE AB HIER --------------------------------
  | 
23  | 
  | 
24  | 
  | 
25  |     /* Init CAN0 Mailbox 0 to Transmit Mailbox. */
  | 
26  |     p_sc_mailbox_tx->ul_mb_idx = TEST1_CAN_COMM_MB_IDX;    //mailbox 0
  | 
27  |     p_sc_mailbox_tx->uc_obj_type = CAN_MB_TX_MODE;
  | 
28  |     p_sc_mailbox_tx->uc_tx_prio = TEST1_CAN0_TX_PRIO;
  | 
29  |     p_sc_mailbox_tx->ul_id_msk = CAN_MAM_MIDvA_Msk | CAN_MAM_MIDvB_Msk; //CAN 2.0A + B
  | 
30  |     can_mailbox_init(CAN0, p_sc_mailbox_tx);
  | 
31  | 
  | 
32  |     /* Write transmit information into mailbox. */
  | 
33  |     if (!eepromData[EEPROM_CAN_11_29_BIT_ID]){
 | 
34  |       p_sc_mailbox_tx->ul_id = CAN_MID_MIDvA(0x7DF);  // engine control module
  | 
35  |        p_sc_mailbox_tx->uc_id_ver = 0; // 0/1: standard/extended frame
  | 
36  |     }
  | 
37  |     else {
 | 
38  |       p_sc_mailbox_tx->ul_id = CAN_MID_MIDvB(0x7DF);  // engine control module
  | 
39  |        p_sc_mailbox_tx->uc_id_ver = 1; // 0/1: standard/extended frame
  | 
40  |       printf ("DEBUG: in getECUData(); 29bit frame mode\r\n");       
 | 
41  |     }
  | 
42  |     //p_sc_mailbox_tx->ul_datal = ...; set by caller
  | 
43  |     //p_sc_mailbox_tx->ul_datah = ...;
  | 
44  |     p_sc_mailbox_tx->uc_length = MAX_CAN_FRAME_DATA_LEN; // 8bytes
  | 
45  |     can_mailbox_write(CAN0, p_sc_mailbox_tx);
  | 
46  |     can_enable_interrupt(CAN0, CAN_IER_MB1);
  | 
47  |     
  | 
48  |     /* Send out the information in the mailbox. */
  | 
49  |     can_global_send_transfer_cmd(CAN0, CAN_TCR_MB0);
  | 
50  | 
  | 
51  | 
  | 
52  | // RELEVANTE SENDEROUTINE BIS HIER --------------------------------
  | 
53  | 
  | 
54  | 
  | 
55  | }
  |