Atmel Software Framework

uhi_msc_mem.c File Reference

USB host Mass Storage interface for control access module.

Copyright (C) 2011-2012 Atmel Corporation. All rights reserved.

#include "uhi_msc.h"
#include "uhi_msc_mem.h"

Functions

Internal functions
static void uhi_msc_mem_stop_pooling (bool b_success)
 Callback to update volatile variable used by pooling. More...
 
static Ctrl_status uhi_msc_mem_translate_status (lun_status_t status)
 Translates the LUN status from UHI MSC to CTRL ACCESS module. More...
 
External functions
uint8_t uhi_msc_mem_get_lun (void)
 Gives the number of available LUN. More...
 
Ctrl_status uhi_msc_mem_test_unit_ready (uint8_t lun)
 Checks and update the status of the LUN. More...
 
Ctrl_status uhi_msc_mem_read_capacity (uint8_t lun, uint32_t *u32_nb_sector)
 Returns the capacity of the LUN. More...
 
uint8_t uhi_msc_mem_read_sector_size (uint8_t lun)
 Returns the sector size of the LUN. More...
 
bool uhi_msc_mem_wr_protect (uint8_t lun)
 Checks if the LUN is write protected. More...
 
bool uhi_msc_mem_removal (void)
 Checks if the device is removed. More...
 
Ctrl_status uhi_msc_mem_read_10_ram (uint32_t addr, void *ram)
 Reads 512 bytes from the current LUN. More...
 
Ctrl_status uhi_msc_mem_write_10_ram (uint32_t addr, const void *ram)
 Writes 512 bytes to the current LUN. More...
 

Variables

Internal variables
static uint8_t uhi_msc_mem_lun
 Current LUN selected. More...
 
Volatile flag tested by functions in pooling mode and updated by a callback
static volatile bool uhi_msc_mem_command_ongoing
 
static volatile bool uhi_msc_mem_command_status
 

static void uhi_msc_mem_stop_pooling ( bool  b_success)
static

Callback to update volatile variable used by pooling.

Parameters
b_successtrue, if the scsi command is successful

References uhi_msc_mem_command_ongoing, and uhi_msc_mem_command_status.

Referenced by uhi_msc_mem_read_10_ram(), uhi_msc_mem_test_unit_ready(), and uhi_msc_mem_write_10_ram().

static Ctrl_status uhi_msc_mem_translate_status ( lun_status_t  status)
static

Translates the LUN status from UHI MSC to CTRL ACCESS module.

Parameters
statusUHI MSC LUN status
Returns
CTRL ACCESS LUN status

References CTRL_BUSY, CTRL_FAIL, CTRL_GOOD, CTRL_NO_PRESENT, LUN_BUSY, LUN_FAIL, LUN_GOOD, and LUN_NOT_PRESENT.

Referenced by uhi_msc_mem_read_10_ram(), uhi_msc_mem_read_capacity(), uhi_msc_mem_test_unit_ready(), and uhi_msc_mem_write_10_ram().