AnsweredAssumed Answered

Can't read directory from a separate task

Question asked by Stefan Gaertner on Dec 21, 2009
Latest reply on Dec 21, 2009 by Stefan Gaertner

Hi,

 

I'm using the ftp-usb example.

 

I'm trying to read the directory from the USB stick. Doing this with the code below, there's no problem. I'm using the code directly after installing the MFS in the USB_task.

 

Now, when I'm trying to read the directory periodically (e.g every minute) from a separate task i get a MQX_UNHANDLED_INTERRUPT at the ioctl command. All data needed to access the MFS at the USB stick are in a global struct (USB_st).

 

--- code start ----

 

sprintf (USB_st.filepath, "*.*");

 

USB_st.search.ATTRIBUTE = MFS_ATTR_READ_ONLY | MFS_ATTR_HIDDEN_FILE | MFS_ATTR_SYSTEM_FILE | MFS_ATTR_ARCHIVE;
USB_st.search.WILDCARD = USB_st.filepath;
USB_st.search.SEARCH_DATA_PTR = &USB_st.search_data;

 

USB_st.error_code_UL = ioctl(((USB_FILESYSTEM_STRUCT_PTR)(USB_st.usb_fs_handle->FS_FD_PTR)), IO_IOCTL_FIND_FIRST_FILE,(uint_32_ptr) &(USB_st.search));
while (USB_st.error_code_UL == MFS_NO_ERROR)
{
 USB_st.error_code_UL = _io_ioctl(USB_st.usb_fs_handle->FS_FD_PTR, IO_IOCTL_FIND_NEXT_FILE, (uint_32_ptr) &USB_st.search_data);
}

 

--- code end ----  

 

Anybody any idea? Thanks.

 

Stefan  

Outcomes