This module is in charge of defining the USB objects and starting the USB tasks.
Definition in file usbsys.h.
#include <time.h>
#include "FreeRTOS.h"
#include "supervisor.h"
Go to the source code of this file.
Functions | |
Bool | b_usbsys_start (void) |
eExecStatus | e_usbsys_cp_cfg_to_local (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
In host mode, copy the /CFG directory content of the USB MS key to the Control Panel /CFG directory. No parameters. Format: cp_cfg_to_local. | |
eExecStatus | e_usbsys_cp_logs_to_key (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
In host mode, copy the /LOG directory to the USB MS key. No parameters. Format: cp_logs_to_ukey. | |
eExecStatus | e_usbsys_cp_web_to_local (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
In host mode, copy the /WEB directory content of the USB MS key to the Control Panel /WEB directory. No parameters. Format: cp_web_to_local. | |
eExecStatus | e_usbsys_lsusb (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
In host mode, display basic low-level information about the connected device. No parameters. Format: lsusb. | |
eExecStatus | e_usbsys_mv_logs_to_key (eModId xModId, signed short FsNavId, int ac, signed portCHAR *av[], signed portCHAR **ppcStringReply) |
In host mode, move the /LOG directory content to the USB MS key. No parameters. Format: mv_logs_to_ukey. |
Bool b_usbsys_start | ( | void | ) |
Start the USB module.
Definition at line 112 of file usbsys.c.
References device_mass_storage_task_init(), and host_mass_storage_task_init().
Referenced by portTASK_FUNCTION().
00113 { 00114 // Create the usb_tsk_semphr and launch the usb_task() task. 00115 usb_task_init(); 00116 #if USB_DEVICE_FEATURE == ENABLED 00117 // Init the device Mass Storage module and 00118 // create the device_mass_storage_task() task 00119 device_mass_storage_task_init(); 00120 #endif 00121 #if USB_HOST_FEATURE == ENABLED 00122 // Init the host Mass Storage module and 00123 // create the host_mass_storage_task() task 00124 host_mass_storage_task_init(); 00125 #endif 00126 00127 return( TRUE ); 00128 }
eExecStatus e_usbsys_cp_cfg_to_local | ( | eModId | xModId, | |
signed short | FsNavId, | |||
int | ac, | |||
signed portCHAR * | av[], | |||
signed portCHAR ** | ppcStringReply | |||
) |
In host mode, copy the /CFG directory content of the USB MS key to the Control Panel /CFG directory. No parameters. Format: cp_cfg_to_local.
xModId | Input. The module that is calling this function. | |
FsNavId | Input. The file system navigator id to use. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string may be performed here; the caller must thus free this string. |
Definition at line 307 of file usbsys.c.
References DEVICE_TO_HOST, MSG_COPY_CFG_TO_LOCAL, and prv_e_usbsys_sync_cp_ukey().
Referenced by b_USBHostCopyCfg().
00310 { 00311 return( prv_e_usbsys_sync_cp_ukey( xModId, FsNavId, ppcStringReply, 00312 (signed portCHAR *)MSG_COPY_CFG_TO_LOCAL, 00313 DEVICE_TO_HOST, "CFG/", FALSE ) ); 00314 }
eExecStatus e_usbsys_cp_logs_to_key | ( | eModId | xModId, | |
signed short | FsNavId, | |||
int | ac, | |||
signed portCHAR * | av[], | |||
signed portCHAR ** | ppcStringReply | |||
) |
In host mode, copy the /LOG directory to the USB MS key. No parameters. Format: cp_logs_to_ukey.
xModId | Input. The module that is calling this function. | |
FsNavId | Input. The file system navigator id to use. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string may be performed here; the caller must thus free this string. |
Definition at line 246 of file usbsys.c.
References HOST_TO_DEVICE, MSG_COPY_LOGS_TO_KEY, and prv_e_usbsys_sync_cp_ukey().
Referenced by b_USBHostCopyLogs().
00249 { 00250 return( prv_e_usbsys_sync_cp_ukey( xModId, FsNavId, ppcStringReply, 00251 (signed portCHAR *)MSG_COPY_LOGS_TO_KEY, 00252 HOST_TO_DEVICE, "LOG/", FALSE ) ); 00253 }
eExecStatus e_usbsys_cp_web_to_local | ( | eModId | xModId, | |
signed short | FsNavId, | |||
int | ac, | |||
signed portCHAR * | av[], | |||
signed portCHAR ** | ppcStringReply | |||
) |
In host mode, copy the /WEB directory content of the USB MS key to the Control Panel /WEB directory. No parameters. Format: cp_web_to_local.
xModId | Input. The module that is calling this function. | |
FsNavId | Input. The file system navigator id to use. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string may be performed here; the caller must thus free this string. |
Definition at line 339 of file usbsys.c.
References DEVICE_TO_HOST, MSG_COPY_WEB_TO_LOCAL, and prv_e_usbsys_sync_cp_ukey().
Referenced by b_USBHostCopyWeb().
00342 { 00343 return( prv_e_usbsys_sync_cp_ukey( xModId, FsNavId, ppcStringReply, 00344 (signed portCHAR *)MSG_COPY_WEB_TO_LOCAL, 00345 DEVICE_TO_HOST, "WEB/", FALSE ) ); 00346 }
eExecStatus e_usbsys_lsusb | ( | eModId | xModId, | |
signed short | FsNavId, | |||
int | ac, | |||
signed portCHAR * | av[], | |||
signed portCHAR ** | ppcStringReply | |||
) |
In host mode, display basic low-level information about the connected device. No parameters. Format: lsusb.
xModId | Input. The module that is calling this function. | |
FsNavId | Ignored. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
xModId | Input. The module that is calling this function. | |
FsNavId | Ignored. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string is performed here; the caller must free this string. |
Definition at line 150 of file usbsys.c.
References CRLF, MSG_BUS_POWERED, MSG_DEVICE_FULL_SPEED, MSG_DEVICE_LOW_SPEED, MSG_NO_DEVICE, MSG_REMOTE_WAKEUP_KO, MSG_REMOTE_WAKEUP_OK, MSG_SELF_POWERED, MSG_USB_SUSPENDED, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, SHELL_MAX_MSGOUT_LEN, sprintf(), and v_shell_Print_String_To_Requester_Stream().
00153 { 00154 #if USB_HOST_FEATURE == ENABLED 00155 signed portCHAR *pcStringToPrint; 00156 U8 i, j; 00157 00158 00159 if( NULL != ppcStringReply ) 00160 *ppcStringReply = NULL; 00161 00162 if (!Is_host_ready() && !Is_host_suspended()) 00163 { 00164 v_shell_Print_String_To_Requester_Stream( xModId, (signed portCHAR *)MSG_NO_DEVICE ); 00165 return SHELL_EXECSTATUS_KO; 00166 } 00167 00168 pcStringToPrint = (signed portCHAR *)pvPortMalloc( SHELL_MAX_MSGOUT_LEN ); // Alloc 00169 if( NULL == pcStringToPrint ) 00170 { 00171 return( SHELL_EXECSTATUS_KO ); 00172 } 00173 00174 if (Is_host_suspended()) 00175 { 00176 v_shell_Print_String_To_Requester_Stream( xModId, (signed portCHAR *)MSG_USB_SUSPENDED CRLF ); 00177 } 00178 00179 sprintf( (char *)pcStringToPrint, "VID: 0x%.4X, PID: 0x%.4X\r\n" 00180 "Device MaxPower is %d mA\r\n" 00181 "%s" 00182 "%s", 00183 Get_VID(), Get_PID(), 00184 2 * Get_maxpower(), 00185 Is_device_self_powered() ? MSG_SELF_POWERED : MSG_BUS_POWERED, 00186 Is_usb_full_speed_mode() ? MSG_DEVICE_FULL_SPEED : MSG_DEVICE_LOW_SPEED ); 00187 v_shell_Print_String_To_Requester_Stream( xModId, pcStringToPrint ); 00188 sprintf( (char *)pcStringToPrint, "%s" 00189 "Supported interface(s): %u", 00190 Is_device_supports_remote_wakeup() ? MSG_REMOTE_WAKEUP_OK : MSG_REMOTE_WAKEUP_KO, 00191 Get_nb_supported_interface() ); 00192 v_shell_Print_String_To_Requester_Stream( xModId, pcStringToPrint ); 00193 00194 for (i = 0; i < Get_nb_supported_interface(); i++) 00195 { 00196 sprintf( (char *)pcStringToPrint, "\r\nInterface nb: %u, AltS nb: %u, Class: 0x%.2X," 00197 " SubClass: 0x%.2X, Protocol: 0x%.2X\r\n" "\tAssociated Ep Nbrs:", 00198 Get_interface_number(i), Get_altset_nb(i), Get_class(i), 00199 Get_subclass(i), Get_protocol(i) ); 00200 v_shell_Print_String_To_Requester_Stream( xModId, pcStringToPrint ); 00201 00202 if (Get_nb_ep(i)) 00203 { 00204 for (j = 0; j < Get_nb_ep(i); j++) 00205 { 00206 sprintf( (char *)pcStringToPrint, " %u", (U16)Get_ep_nbr(i, j) ); 00207 v_shell_Print_String_To_Requester_Stream( xModId, pcStringToPrint ); 00208 } 00209 } 00210 else 00211 { 00212 v_shell_Print_String_To_Requester_Stream( xModId, (signed portCHAR *)"None" ); 00213 } 00214 } 00215 00216 vPortFree( pcStringToPrint ); 00217 00218 v_shell_Print_String_To_Requester_Stream( xModId, (signed portCHAR *)CRLF ); 00219 #else 00220 v_shell_Print_String_To_Requester_Stream( xModId, (signed portCHAR *)MSG_NO_DEVICE ); 00221 #endif 00222 return( SHELL_EXECSTATUS_OK ); 00223 }
eExecStatus e_usbsys_mv_logs_to_key | ( | eModId | xModId, | |
signed short | FsNavId, | |||
int | ac, | |||
signed portCHAR * | av[], | |||
signed portCHAR ** | ppcStringReply | |||
) |
In host mode, move the /LOG directory content to the USB MS key. No parameters. Format: mv_logs_to_ukey.
xModId | Input. The module that is calling this function. | |
FsNavId | Input. The file system navigator id to use. | |
ac | Input. The argument counter. Ignored. | |
av | Input. The argument vector. Ignored | |
ppcStringReply | Input/Output. The response string. If Input is NULL, no response string will be output. Else a malloc for the response string may be performed here; the caller must thus free this string. |
Definition at line 276 of file usbsys.c.
References HOST_TO_DEVICE, MSG_MOVE_LOGS_TO_KEY, and prv_e_usbsys_sync_cp_ukey().
Referenced by b_USBHostMoveLogs().
00279 { 00280 return( prv_e_usbsys_sync_cp_ukey( xModId, FsNavId, ppcStringReply, 00281 (signed portCHAR *)MSG_MOVE_LOGS_TO_KEY, 00282 HOST_TO_DEVICE, "LOG/", TRUE ) ); 00283 }