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
解決済! 解決策の投稿を見る。
Hi,
the data are in a struct like this:
--- code start ---
typedef struct
{
unit8 test;
USB_FILESYSTEM_STRUCT_PTR USB_fs_ptr;
}USB_ST;
USB_ST Usb_st;
--- code end ---
The struct beginns at a adress, that is devidable through 4 (32 bit). When I'm trying to get "inner" adress from the USB_FILESYSTEM_STRUCT_PTR, the pointer to the adress begins at address that is devideable through 4 +1, becaus of the variable test.
Example:
values:
test = 0xFF
Usb_st.USB_fs_ptr->FS_FD_PTR = 0x20001000
If you want to give Usb_st.USB_fs_ptr->FS_FD_PTR to the ioctl function:
ioctl(Usb_st.USB_fs_ptr->FS_FD_PTR, ..., ...) the function receive the adress 0xFF200010.
cu,
Stefan
Hi,
the data are in a struct like this:
--- code start ---
typedef struct
{
unit8 test;
USB_FILESYSTEM_STRUCT_PTR USB_fs_ptr;
}USB_ST;
USB_ST Usb_st;
--- code end ---
The struct beginns at a adress, that is devidable through 4 (32 bit). When I'm trying to get "inner" adress from the USB_FILESYSTEM_STRUCT_PTR, the pointer to the adress begins at address that is devideable through 4 +1, becaus of the variable test.
Example:
values:
test = 0xFF
Usb_st.USB_fs_ptr->FS_FD_PTR = 0x20001000
If you want to give Usb_st.USB_fs_ptr->FS_FD_PTR to the ioctl function:
ioctl(Usb_st.USB_fs_ptr->FS_FD_PTR, ..., ...) the function receive the adress 0xFF200010.
cu,
Stefan