Microchip® Advanced Software Framework

udi_msc.c File Reference

USB Device Mass Storage Class (MSC) interface.

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

#include "conf_usb.h"
#include "usb_protocol.h"
#include "usb_protocol_msc.h"
#include "spc_protocol.h"
#include "sbc_protocol.h"
#include "udd.h"
#include "udc.h"
#include "udi_msc.h"
#include "ctrl_access.h"
#include <string.h>

Macros

#define UDI_MSC_BLOCK_SIZE   512L
 Static block size for all memories. More...
 
#define UDI_MSC_NOTIFY_TRANS_EXT()
 

Functions

bool udi_msc_enable (void)
 
Routines manage SCSI Commands

Number of lun

void udi_msc_disable (void)
 
bool udi_msc_setup (void)
 
uint8_t udi_msc_getsetting (void)
 
static void udi_msc_cbw_invalid (void)
 
static void udi_msc_csw_invalid (void)
 
static void udi_msc_cbw_wait (void)
 
static void udi_msc_cbw_received (udd_ep_status_t status, iram_size_t nb_received, udd_ep_id_t ep)
 
static bool udi_msc_cbw_validate (uint32_t alloc_len, uint8_t dir_flag)
 
static void udi_msc_data_send (uint8_t *buffer, uint8_t buf_size)
 
static void udi_msc_data_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 
static void udi_msc_csw_process (void)
 
void udi_msc_csw_send (void)
 
static void udi_msc_csw_sent (udd_ep_status_t status, iram_size_t nb_sent, udd_ep_id_t ep)
 
static void udi_msc_clear_sense (void)
 
static void udi_msc_sense_fail (uint8_t sense_key, uint16_t add_sense, uint32_t lba)
 
static void udi_msc_sense_pass (void)
 
static void udi_msc_sense_fail_not_present (void)
 
static void udi_msc_sense_fail_busy_or_change (void)
 
static void udi_msc_sense_fail_hardware (void)
 
static void udi_msc_sense_fail_protected (void)
 
static void udi_msc_sense_fail_cdb_invalid (void)
 
static void udi_msc_sense_command_invalid (void)
 
static void udi_msc_spc_requestsense (void)
 
static void udi_msc_spc_inquiry (void)
 
static bool udi_msc_spc_testunitready_global (void)
 
static void udi_msc_spc_testunitready (void)
 
static void udi_msc_spc_mode_sense (bool b_sense10)
 
static void udi_msc_spc_prevent_allow_medium_removal (void)
 
static void udi_msc_sbc_start_stop (void)
 
static void udi_msc_sbc_read_capacity (void)
 
static void udi_msc_sbc_trans (bool b_read)
 
bool udi_msc_process_trans (void)
 Process the background read/write commands. More...
 
static void udi_msc_trans_ack (udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep)
 
bool udi_msc_trans_block (bool b_read, uint8_t *block, iram_size_t block_size, void(*callback)(udd_ep_status_t status, iram_size_t n, udd_ep_id_t ep))
 Transfers data to/from USB MSC endpoints. More...
 
Variables to manage SCSI requests
 UDC_BSS (4)
 Structure to receive a CBW packet. More...
 

Variables

UDC_DESC_STORAGE udi_api_t udi_api_msc
 Global structure which contains standard UDI API for UDC. More...
 

#define UDI_MSC_NOTIFY_TRANS_EXT ( )

Referenced by udi_msc_sbc_trans().