Microchip® Advanced Software Framework

common/services/usb/class/composite/host/example2/main.c File Reference

Main functions for USB host mass storage and mouse composite example.

Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "conf_usb_host.h"
#include "ui.h"
#include "main.h"
#include "string.h"

Macros

#define MAX_DRIVE   _VOLUMES
 
#define MSG_TEST   "Test UHI MSC\n"
 
#define TEST_FILE_NAME   "0:uhi_msc_test.txt"
 

Typedefs

typedef enum test_state test_state_t
 

Enumerations

enum  test_state {
  TEST_NULL,
  TEST_OK,
  TEST_NO_PRESENT,
  TEST_ERROR,
  TEST_NULL,
  TEST_OK,
  TEST_NO_PRESENT,
  TEST_ERROR
}
 

Functions

int main (void)
 Main function. Execution starts here. More...
 
static int main_count_states (test_state_t state)
 
static void main_reset_states (void)
 
void main_usb_connection_event (uhc_device_t *dev, bool b_present)
 Notify that a USB device has been connected or disconnected. More...
 
void main_usb_sof_event (void)
 Notify that a SOF has been sent (each 1 ms) More...
 

Variables

static FIL file_object
 
static FATFS fs
 
static test_state_t lun_states [MAX_DRIVE]
 
static volatile uint16_t main_usb_sof_counter = 0
 
static char test_file_name []
 

#define MAX_DRIVE   _VOLUMES
#define MSG_TEST   "Test UHI MSC\n"

Referenced by main().

#define TEST_FILE_NAME   "0:uhi_msc_test.txt"

typedef enum test_state test_state_t

enum test_state
Enumerator
TEST_NULL 
TEST_OK 
TEST_NO_PRESENT 
TEST_ERROR 
TEST_NULL 
TEST_OK 
TEST_NO_PRESENT 
TEST_ERROR 

static int main_count_states ( test_state_t  state)
static

References count, i, lun_states, and MAX_DRIVE.

Referenced by main().

static void main_reset_states ( void  )
static

References i, lun_states, MAX_DRIVE, and TEST_NULL.

Referenced by main_usb_connection_event().

void main_usb_connection_event ( uhc_device_t dev,
bool  b_present 
)

Notify that a USB device has been connected or disconnected.

Parameters
devPointer on USB device information
b_presenttrue, if the device has been connected

References main_reset_states(), and ui_usb_connection_event().

void main_usb_sof_event ( void  )

Notify that a SOF has been sent (each 1 ms)

References main_usb_sof_counter, and ui_usb_sof_event().

FIL file_object
static

Referenced by main().

FATFS fs
static
test_state_t lun_states[MAX_DRIVE]
static
volatile uint16_t main_usb_sof_counter = 0
static

Referenced by main(), and main_usb_sof_event().

char test_file_name[]
static
Initial value:
= {
}
#define TEST_FILE_NAME
Definition: common/services/usb/class/composite/host/example2/main.c:44

Referenced by main().