ATMEL: host_ms_task.c File Reference

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# 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 "host_ms_task.h"`
`#include "lib_mem/host_mem/host_mem.h"`
`#include "modules/usb/host_chap9/usb_host_task.h"`
`#include "modules/file_system/nav_utils.h"`

Include dependency graph for host_ms_task.c:

Go to the source code of this file.

## Defines

#define | HOST_SYNC_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.

## Detailed Description

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

- Supported devices: AT90USB1287, AT90USB1286, AT90USB647, AT90USB646
  Author:
    Atmel Corporation: http://www.atmel.com
    Support and FAQ: http://support.atmel.no/

Definition in file host_ms_task.c.

## Define Documentation

#define HOST_SYNC_MODE DISABLE

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

References host_mem_init(), Joy_init, and Leds_init.

    00096 {
    00097    Leds_init();
    00098 #if (HOST_SYNC_MODE==ENABLE)
    00099    Joy_init();
    00100 #endif
    00101    host_mem_init();
    00102 }

Here is the call graph for this function:

void host_ms_task | ( | void |  | ) |

This function manages the HOST mass storage application

Definition at line 107 of file host_ms_task.c.

References copy_dir(), dir_local_in_name, dir_local_out_name, dir_usb_in_name, dir_usb_out_name, 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, and sync_on_going.

    00108 {
    00109    if( Is_host_ready() )
    00110    {
    00111       // Here, Enumeration successfull, device is operationnal
    00112       if(Is_new_device_connection_event())
    00113       {
    00114          // Update MS driver in case of
    00115          if( host_mem_install() )
    00116          {
    00117             Led1_on();
    00118          }
    00119       }
    00120
    00121 #if (HOST_SYNC_MODE==ENABLE)  // Sync operating mode(if available)
    00122       if( 0 != host_mem_get_lun() )
    00123       {
    00124          if(Is_joy_right())   // Sync device to host stream
    00125          {
    00126             Led0_on();
    00127             sync_on_going=1;
    00128             copy_dir( (U8 code *)dir_usb_out_name, (U8 code *)dir_local_in_name, 1 );
    00129             sync_on_going=0;
    00130             Led3_off();
    00131             Led0_off();
    00132          }
    00133          if(Is_joy_left())    // Sync host to device stream
    00134          {
    00135             Led0_on();
    00136             sync_on_going=1;
    00137             copy_dir( (U8 code *)dir_local_out_name, (U8 code *)dir_usb_in_name, 1 );
    00138             sync_on_going=0;
    00139             Led0_off();
    00140             Led3_off();
    00141          }
    00142       }
    00143 #endif
    00144    }
    00145
    00146    // Device disconnection...
    00147    if( Is_device_disconnection_event() )
    00148    {
    00149       // Update MS driver in case of
    00150       host_mem_uninstall();
    00151       Led1_off();
    00152    }
    00153 }

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 75 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 79 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 81 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 83 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 85 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 87 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 89 of file host_ms_task.c.