ctrl_access.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00002 /*! \file ctrl_access.h *******************************************************
00003  *
00004  * \brief
00005  *      This file contains the interface :
00006  *         - between USB <-> MEMORY
00007  *      OR
00008  *         - between USB <- Access Memory Ctrl -> Memory
00009  *
00010  *      This interface may be controled by a "Access Memory Control" for :
00011  *         - include a management of write protect global or specific
00012  *         - include a management of access password
00013  *
00014  * \addtogroup usbstick
00015  *
00016  * \author
00017  *      Atmel Corporation: http://www.atmel.com \n
00018  *      Support email: avr@atmel.com
00019  ******************************************************************************/
00020 /* 
00021    Copyright (c) 2004  ATMEL Corporation
00022    All rights reserved.
00023 
00024    Redistribution and use in source and binary forms, with or without
00025    modification, are permitted provided that the following conditions are met:
00026 
00027    * Redistributions of source code must retain the above copyright
00028      notice, this list of conditions and the following disclaimer.
00029    * Redistributions in binary form must reproduce the above copyright
00030      notice, this list of conditions and the following disclaimer in
00031      the documentation and/or other materials provided with the
00032      distribution.
00033    * Neither the name of the copyright holders nor the names of
00034      contributors may be used to endorse or promote products derived
00035      from this software without specific prior written permission.
00036 
00037   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00038   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00039   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00040   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00041   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00042   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00043   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00044   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00045   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00046   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00047   POSSIBILITY OF SUCH DAMAGE.
00048 */
00049 
00050 /**
00051  \addtogroup usbstorage
00052  @{
00053 */
00054 
00055 #ifndef _MEM_CTRL_H_
00056 #define _MEM_CTRL_H_
00057 
00058 #include "storage/conf_access.h"
00059 #include "storage/ctrl_status.h"
00060 
00061 // FYC: Memory = Logical Unit
00062 #if (LUN_0 == ENABLE)
00063    #include    LUN_0_INCLUDE
00064 #endif
00065 #if (LUN_1 == ENABLE)
00066    #include    LUN_1_INCLUDE
00067 #endif
00068 #if (LUN_2 == ENABLE)
00069    #include    LUN_2_INCLUDE
00070 #endif
00071 #if (LUN_3 == ENABLE)
00072    #include    LUN_3_INCLUDE
00073 #endif
00074 #if (LUN_4 == ENABLE)
00075    #include    LUN_4_INCLUDE
00076 #endif
00077 #if (LUN_5 == ENABLE)
00078    #include    LUN_5_INCLUDE
00079 #endif
00080 #if (LUN_6 == ENABLE)
00081    #include    LUN_6_INCLUDE
00082 #endif
00083 #if (LUN_7 == ENABLE)
00084    #include    LUN_7_INCLUDE
00085 #endif
00086 #if (LUN_USB == ENABLE)
00087    #include    LUN_USB_INCLUDE
00088 #endif
00089 
00090 
00091 //------- Test the configuration in conf_access.h
00092 
00093 // Specific option control access
00094 #ifndef  GLOBAL_WR_PROTECT
00095 #  error GLOBAL_WR_PROTECT must be defined with ENABLED or DISABLED in conf_access.h
00096 #endif
00097 //------- END OF Test the configuration in conf_access.h
00098 
00099 
00100 
00101 //_____ D E F I N I T I O N S ______________________________________________
00102 
00103 
00104 
00105 //!**** Listing of commun interface ****************************************
00106 
00107 U8             get_nb_lun();
00108 U8             get_cur_lun();
00109 Ctrl_status    mem_test_unit_ready( U8 lun );
00110 Ctrl_status    mem_read_capacity( U8 lun , U32 _MEM_TYPE_SLOW_ *u32_nb_sector );
00111 Bool           mem_wr_protect( U8 lun );
00112 Bool           mem_removal( U8 lun );
00113 U8 FLASH*       mem_name( U8 lun );
00114 
00115 
00116 //!**** Listing of READ/WRITE interface ************************************
00117 
00118 
00119 //---- Interface for USB ---------------------------------------------------
00120    Ctrl_status memory_2_usb( U8 lun , U32 addr , U16 nb_sector );
00121    Ctrl_status usb_2_memory( U8 lun , U32 addr , U16 nb_sector );
00122 #include "usb_drv.h"
00123 #include "conf_usb.h"
00124 //--------------------------------------------------------------------------
00125 
00126 //---- Interface for RAM to MEM --------------------------------------------
00127 Ctrl_status    memory_2_ram( U8 lun , const U32 _MEM_TYPE_SLOW_ *addr , U8 _MEM_TYPE_SLOW_ *ram );
00128 Ctrl_status    ram_2_memory( U8 lun , const U32 _MEM_TYPE_SLOW_ *addr , U8 _MEM_TYPE_SLOW_ * ram );
00129 //--------------------------------------------------------------------------
00130 
00131 
00132 //!---- Interface for streaming interface ----------------------------------
00133 #if (ACCESS_STREAM == ENABLED)
00134 
00135 #define  ID_STREAM_ERR        0xFF
00136 
00137 
00138 // RLE #include "dfc_mngt.h"
00139 
00140 #define  TYPE_STREAM_AUDIO    DFC_ID_AUDIOPROC1
00141 #define  TYPE_STREAM_AUDIO2   DFC_ID_AUDIOPROC2
00142 #define  TYPE_STREAM_SIO      DFC_ID_SIO
00143 #define  TYPE_STREAM_SPI      DFC_ID_SPI
00144 #define  TYPE_STREAM_DEVNULL  DFC_ID_NULL_DEV
00145 
00146    U8          stream_mem_to_mem       ( U8 src_lun , U32 src_addr , U8 dest_lun , U32 dest_addr , U16 nb_sector );
00147    U8          stream_read_10_start    ( U8 TypeStream , U8 lun , U32 addr , U16 nb_sector );
00148    U8          stream_write_10_start   ( U8 TypeStream , U8 lun , U32 addr , U16 nb_sector );
00149    U8          stream_to_stream_start  ( U8 TypeStream_src , U8 TypeStream_dest  , U16 nb_sector );
00150    Ctrl_status stream_state( U8 Id );
00151    U16         stream_stop( U8 Id );
00152 
00153 #endif   // (ACCESS_STREAM == ENABLED)
00154 //--------------------------------------------------------------------------
00155 
00156 #endif   // _MEM_CTRL_H_
00157 /**@}*/

Generated on Mon Apr 11 14:23:36 2011 for Contiki 2.5 by  doxygen 1.6.1