Runtime error when call a function from out of task

Hi to all,

in RTX mode when i call a function to read mmc card from out of task then compiler go to Runtime error but when i wrote the function content during the task  it work fine?Does any one know whats the problem? i copy the code in the function below:

void load_music(){
	    os_dly_wait(10);
	    os_mut_wait (&mut_CAN, 0xffff);	
		  music_selection();
		  tsk_lock ();									
      fp = fopen (next1,"rb");            	
		  tsk_unlock ();       
      os_mut_release (&mut_CAN);		     			      
      if (fp == NULL){
			os_dly_wait(10);
      os_mut_wait (&mut_CAN, 0xffff);
		  tsk_lock ();		
		  init_card ();
		  tsk_unlock ();       
      os_mut_release (&mut_CAN); 
			}
}

More questions in this forum