host_ms_task.c File Reference

#include "config.h"
#include "conf_usb.h"
#include "modules/file_system/fat.h"
#include "modules/file_system/fs_com.h"
#include "modules/file_system/navigation.h"
#include "modules/file_system/file.h"
#include "modules/file_system/nav_utils.h"
#include "firm_upgrade.h"
#include "host_ms_task.h"
#include "lib_mem/host_mem/host_mem.h"
#include "modules/usb/host_chap9/usb_host_task.h"

Include dependency graph for host_ms_task.c:

Go to the source code of this file.

Defines

#define HOST_SYNC_MODE   DISABLE
#define HOST_UPGRADE_MODE   DISABLE

Functions

void host_ms_task_init (void)
void host_ms_task (void)
void host_sof_action (void)

Variables

volatile U8 host_cpt_sof
 Host start of frame counter incremented under SOF interrupt.
U8 code dir_usb_out_name [] = "B:/OUT/"
 directory name for USB out synchro
U8 code dir_usb_in_name [] = "B:/IN/"
 directory name for USB in synchro
U8 code dir_local_out_name [] = "A:/OUT/"
 directory name for LOCAL out synchro
U8 code dir_local_in_name [] = "A:/IN/"
 directory name for LOCAL in synchro
U8 sync_on_going = 0
 Flag set when sync operation is on-going.
U8 ms_str_ram [MAX_FILE_LENGHT]
 Intermediate ram unicode file name buffer for sync operation.
Bool b_new_msc_connected = FALSE


Detailed Description

This file contains the function declarations for usb host mass storage task application - Compiler: IAR EWAVR and GNU GCC for AVR

Definition in file host_ms_task.c.


Define Documentation

#define HOST_SYNC_MODE   DISABLE

Definition at line 48 of file host_ms_task.c.

#define HOST_UPGRADE_MODE   DISABLE

Definition at line 53 of file host_ms_task.c.


Function Documentation

void host_ms_task_init ( void   ) 

This function initializes the Host Mass Storage application

Definition at line 103 of file host_ms_task.c.

References host_mem_init(), Joy_init, and Leds_init.

00104 {
00105    Leds_init();
00106 #if (HOST_SYNC_MODE==ENABLE)
00107    Joy_init();
00108 #endif
00109    host_mem_init();
00110 }

Here is the call graph for this function:

void host_ms_task ( void   ) 

This function manages the HOST mass storage application

Definition at line 115 of file host_ms_task.c.

References b_new_msc_connected, copy_dir(), dir_local_in_name, dir_local_out_name, dir_usb_in_name, dir_usb_out_name, FALSE, firm_upgrade_run(), host_mem_get_lun(), host_mem_install(), host_mem_uninstall(), Is_device_disconnection_event, Is_host_ready, Is_joy_left, Is_joy_right, Is_new_device_connection_event, Led3_off, sync_on_going, and TRUE.

00116 {
00117    if( Is_host_ready() )   
00118    {
00119       // Here, Enumeration successfull, device is operationnal
00120       if(Is_new_device_connection_event())
00121       {
00122          // Update MS driver in case of
00123 #if (HOST_UPGRADE_MODE==ENABLE)
00124          if( host_mem_install() )
00125             b_new_msc_connected = TRUE;
00126 #else
00127          host_mem_install();
00128 #endif
00129       }
00130 
00131 #if (HOST_SYNC_MODE==ENABLE)  // Sync operating mode(if available)
00132       if( 0 != host_mem_get_lun() )
00133       {
00134          if(Is_joy_right())   // Sync device to host stream
00135          {
00136             sync_on_going=1;
00137             copy_dir( (U8 code *)dir_usb_out_name, (U8 code *)dir_local_in_name, 1 );
00138             sync_on_going=0;
00139             Led3_off();
00140          }
00141          if(Is_joy_left())    // Sync host to device stream
00142          {
00143             sync_on_going=1;
00144             copy_dir( (U8 code *)dir_local_out_name, (U8 code *)dir_usb_in_name, 1 );
00145             sync_on_going=0;
00146             Led3_off();
00147          }
00148       }
00149 #endif
00150 
00151 #if (HOST_UPGRADE_MODE==ENABLE)
00152       if( b_new_msc_connected )
00153       {
00154          // A new MSC is connected then start upgrade routine
00155          b_new_msc_connected = FALSE;
00156          firm_upgrade_run();
00157       }
00158 #endif
00159 
00160    }
00161 
00162    // Device disconnection...
00163    if( Is_device_disconnection_event() )
00164    {
00165       // Update MS driver in case of
00166       host_mem_uninstall();
00167    }
00168 }

Here is the call graph for this function:


Variable Documentation

volatile U8 host_cpt_sof

Host start of frame counter incremented under SOF interrupt.

Definition at line 80 of file host_ms_task.c.

Referenced by host_sof_action().

U8 code dir_usb_out_name[] = "B:/OUT/"

directory name for USB out synchro

Definition at line 84 of file host_ms_task.c.

Referenced by host_ms_task().

U8 code dir_usb_in_name[] = "B:/IN/"

directory name for USB in synchro

Definition at line 86 of file host_ms_task.c.

Referenced by host_ms_task().

U8 code dir_local_out_name[] = "A:/OUT/"

directory name for LOCAL out synchro

Definition at line 88 of file host_ms_task.c.

Referenced by host_ms_task().

U8 code dir_local_in_name[] = "A:/IN/"

directory name for LOCAL in synchro

Definition at line 90 of file host_ms_task.c.

Referenced by host_ms_task().

U8 sync_on_going = 0

Flag set when sync operation is on-going.

Definition at line 92 of file host_ms_task.c.

Referenced by host_ms_task(), and host_sof_action().

U8 ms_str_ram[MAX_FILE_LENGHT]

Intermediate ram unicode file name buffer for sync operation.

Definition at line 94 of file host_ms_task.c.

Bool b_new_msc_connected = FALSE

Definition at line 98 of file host_ms_task.c.

Referenced by host_ms_task().


Generated on Fri May 15 15:41:42 2009 for ATMEL by  doxygen 1.5.3