CCS/FinalCode/main.c
//Note - expects flash segment to be erased first
expects flash segment to be erased first
expects flash segment to be erased first
void CopyFlashFromTmp(char MsgIndex, unsigned int Len)
{
	char *Flash_ptr;                          
	char *Flash_ptr_tmp = (char *) STARTTMP;
	EraseFlashGroup(MsgIndex); 
	if(MsgIndex == 1)
		Flash_ptr = (char *) START0;              
	else if(MsgIndex == 2)
		Flash_ptr = (char *) START1;              
	else if (MsgIndex == 3)
		Flash_ptr = (char *) START2;              
	FCTL1 = FWKEY + WRT;
	FCTL3 = FWKEY;
	unsigned int i;
	for(i = 0;i<Len;i++)
	{
		*Flash_ptr++ = (char)(*Flash_ptr_tmp++);
	}
	FCTL1 = FWKEY;                            
	FCTL3 = FWKEY + LOCK;                     
}
void CopyFlashFromTmp ( char MsgIndex , unsigned int Len ) { char * Flash_ptr ; char * Flash_ptr_tmp = ( char * ) STARTTMP ; EraseFlashGroup ( MsgIndex ) ; if ( MsgIndex == 1 ) Flash_ptr = ( char * ) START0 ; else if ( MsgIndex == 2 ) Flash_ptr = ( char * ) START1 ; else if ( MsgIndex == 3 ) Flash_ptr = ( char * ) START2 ; FCTL1 = FWKEY + WRT ; FCTL3 = FWKEY ; unsigned int i ; for ( i = 0 ; i < Len ; i ++ ) { * Flash_ptr ++ = ( char ) ( * Flash_ptr_tmp ++ ) ; } FCTL1 = FWKEY ; FCTL3 = FWKEY + LOCK ; }
Note - expects flash segment to be erased first
Note - expects flash segment to be erased first
// Flash pointer //clean out destination first // Initialize Flash pointer // Initialize Flash pointer // Initialize Flash pointer //	FCTL1 = FWKEY + ERASE;                      // Set WRT bit for write operation //	FCTL3 = FWKEY;                            // Clear Lock bit //copy from temporary flash memory // Clear WRT bit // Set LOCK bit