@ -3,10 +3,10 @@
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					namespace  can_space  { 
 
					 
					 
					 
					namespace  can_space  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : transmitMsg ( Uint16   boxNumber ,  const  CANMessage &  message ,  bool  writeDataLength ) { 
 
					 
					 
					 
					void  CAN : : transmitMsg ( uint16_t   boxNumber ,  const  CANMessage &  message ,  bool  writeDataLength ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -36,10 +36,10 @@ void CAN::transmitMsg(Uint16 boxNumber, const CANMessage& message, bool writeDat
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : transmitMsg ( Uint16  boxNumber ,  const  Uint64 &  message ,  const  Uint16   dlc ) { 
 
					 
					 
					 
					void  CAN : : transmitMsg ( uint16_t  boxNumber ,  const  uint64_t &  message ,  const  uint16_t   dlc ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -69,10 +69,10 @@ void CAN::transmitMsg(Uint16 boxNumber, const Uint64& message, const Uint16 dlc)
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : transmitMsg ( Uint16  boxNumber ,  const  Uint64 &  message ) { 
 
					 
					 
					 
					void  CAN : : transmitMsg ( uint16_t  boxNumber ,  const  uint64_t &  message ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -100,7 +100,7 @@ void CAN::transmitMsg(Uint16 boxNumber, const Uint64& message){
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : updateTXMessage ( Uint16   boxNumber ,  const  CANMessage &  message ) {  // TODO check trs bit and set it at the end if it was here. Once the TRS bit is set for a mailbox and then data is changed in the mailbox using the CDR
 
 
					 
					 
					 
					void  CAN : : updateTXMessage ( uint16_t   boxNumber ,  const  CANMessage &  message ) {  // TODO check trs bit and set it at the end if it was here. Once the TRS bit is set for a mailbox and then data is changed in the mailbox using the CDR
 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					                                                                        // bit, the CAN module fails to transmit the new data and transmits the old data instead. To avoid this,
 
 
					 
					 
					 
					                                                                        // bit, the CAN module fails to transmit the new data and transmits the old data instead. To avoid this,
 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                                                                        // reset transmission in that mailbox using the TRRn bit and set the TRSn bit again. The new data is
 
 
					 
					 
					 
					                                                                        // reset transmission in that mailbox using the TRRn bit and set the TRSn bit again. The new data is
 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					                                                                        // then transmitted.
 
 
					 
					 
					 
					                                                                        // then transmitted.
 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -123,13 +123,13 @@ void CAN::updateTXMessage(Uint16 boxNumber, const CANMessage& message){ // TODO
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : sendRemoteRequest ( Uint16   boxNumber ) { 
 
					 
					 
					 
					void  CAN : : sendRemoteRequest ( uint16_t   boxNumber ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  return ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    p_MailBox  =  & ( _p_CanMBoxes - > MBOX0 )  +  boxNumber ; 
 
					 
					 
					 
					    p_MailBox  =  & ( _p_CanMBoxes - > MBOX0 )  +  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    // Mailbox disable
 
 
					 
					 
					 
					    // Mailbox disable
 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -152,10 +152,10 @@ void CAN::sendRemoteRequest(Uint16 boxNumber){
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					int16  CAN : : receiveMsg ( Uint16   boxNumber ,  CANMessage &  rxMessage ) { 
 
					 
					 
					 
					int16_t  CAN : : receiveMsg ( uint16_t   boxNumber ,  CANMessage &  rxMessage ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return  - 1 ;  } 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return  - 1 ;  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  MBOX *  p_MailBox ( 0 ) ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -191,10 +191,10 @@ bool CAN::isNewMessage(){
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					bool  CAN : : isNewMessage ( Uint16   boxNumber ) { 
 
					 
					 
					 
					bool  CAN : : isNewMessage ( uint16_t   boxNumber ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return  0 ;  } 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return  0 ;  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   mboxControl ( 0 ) ; 
 
					 
					 
					 
					    uint32_t   mboxControl ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    mboxControl  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    bool  isNewMessageInBox  =  _p_CanRegs - > CANRMP . all  &  mboxControl ; 
 
					 
					 
					 
					    bool  isNewMessageInBox  =  _p_CanRegs - > CANRMP . all  &  mboxControl ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -209,10 +209,10 @@ void CAN::resetTimeStampCounter(){
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : setTimeOutValue ( Uint16  boxNumber ,  Uint32   canBitsNumber ) { 
 
					 
					 
					 
					void  CAN : : setTimeOutValue ( uint16_t  boxNumber ,  uint32_t   canBitsNumber ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return ;  } 
 
					 
					 
					 
					    if  ( boxNumber  >  31 )  {  return ;  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    volatile  Uint32 *  p_MailBox ( 0 ) ; 
 
					 
					 
					 
					    volatile  uint32_t *  p_MailBox ( 0 ) ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    p_MailBox  =  & ( _p_CanMotoRegs - > MOTO0 )  +  boxNumber ; 
 
					 
					 
					 
					    p_MailBox  =  & ( _p_CanMotoRegs - > MOTO0 )  +  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    * p_MailBox  =  canBitsNumber ; 
 
					 
					 
					 
					    * p_MailBox  =  canBitsNumber ; 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -220,15 +220,15 @@ void CAN::setTimeOutValue(Uint16 boxNumber, Uint32 canBitsNumber){
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
					 
					 
					 
					# pragma CODE_SECTION("ramfuncs"); 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					bool  CAN : : isTimeOut ( Uint16   boxNumber ) { 
 
					 
					 
					 
					bool  CAN : : isTimeOut ( uint16_t   boxNumber ) { 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    bool  mBOXTimeOut  =  false ; 
 
					 
					 
					 
					    bool  mBOXTimeOut  =  false ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    mBOXTimeOut  =  _p_CanRegs - > CANTOS . all  &  ( 1ul  < <  boxNumber ) ; 
 
					 
					 
					 
					    mBOXTimeOut  =  _p_CanRegs - > CANTOS . all  &  ( 1ul  < <  boxNumber ) ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    return  mBOXTimeOut ; 
 
					 
					 
					 
					    return  mBOXTimeOut ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					void  CAN : : clearTimeOutFlag ( Uint16   boxNumber ) { 
 
					 
					 
					 
					void  CAN : : clearTimeOutFlag ( uint16_t   boxNumber ) { 
 
				
			 
			
				
				
			
		
	
		
		
			
				
					
					 
					 
					 
					    Uint32   clearFlag  =  0 ; 
 
					 
					 
					 
					    uint32_t   clearFlag  =  0 ; 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					    clearFlag  =  1ul  < <  boxNumber ; 
 
					 
					 
					 
					    clearFlag  =  1ul  < <  boxNumber ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    _p_CanRegs - > CANTOS . all  =  clearFlag ; 
 
					 
					 
					 
					    _p_CanRegs - > CANTOS . all  =  clearFlag ; 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					}