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 51 of file host_ms_task.c.

#define HOST_UPGRADE_MODE   DISABLE

Definition at line 56 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 106 of file host_ms_task.c.

References host_mem_init(), Joy_init, and Leds_init.

00107 {
00108    Leds_init();
00109 #if (HOST_SYNC_MODE==ENABLE)
00110    Joy_init();
00111 #endif
00112    host_mem_init();
00113 }

Here is the call graph for this function:

void host_ms_task ( void   ) 

This function manages the HOST mass storage application

Definition at line 118 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, Led0_off, Led0_on, Led1_off, Led1_on, Led3_off, sync_on_going, and TRUE.

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

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 83 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 87 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 89 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 91 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 93 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 95 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 97 of file host_ms_task.c.

Bool b_new_msc_connected = FALSE

Definition at line 101 of file host_ms_task.c.

Referenced by host_ms_task().


Generated on Wed Sep 23 09:37:15 2009 for ATMEL by  doxygen 1.5.3