aboutsummaryrefslogtreecommitdiff
path: root/laser-tag software/disk.h
blob: a8ddb205efb9786e47d0b0a6de76b084e3de1fe1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/**HEADER********************************************************************
 * 
 * Copyright (c) 2008, 2013 - 2014 Freescale Semiconductor;
 * All Rights Reserved
 *
 * Copyright (c) 1989-2008 ARC International;
 * All Rights Reserved
 *
 *************************************************************************** 
 *
 * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR 
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
 * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
 * THE POSSIBILITY OF SUCH DAMAGE.
 *
 **************************************************************************
 *
 * $FileName: disk.h$
 * $Version : 
 * $Date    : 
 *
 * Comments:
 *
 * @brief The file contains Macro's and functions needed by the disk 
 *        application
 *
 *****************************************************************************/

#ifndef _DISK_H
#define _DISK_H  1

#include "usb_descriptor.h"
/******************************************************************************
 * Constants - None
 *****************************************************************************/

/******************************************************************************
 * Macro's
 *****************************************************************************/
#define RAM_DISK_APP                        (1)
#define SD_CARD_APP                         (0)

#if RAM_DISK_APP
    /* Length of Each Logical Address Block */
    #define LENGTH_OF_EACH_LAB              (512)    
    /* total number of logical blocks present */
    #define TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL (4)
    /* Net Disk Size */
    #define DISK_SIZE_NORMAL (TOTAL_LOGICAL_ADDRESS_BLOCKS_NORMAL * LENGTH_OF_EACH_LAB)
#endif

#define LOGICAL_UNIT_SUPPORTED              (1)

#define SUPPORT_DISK_LOCKING_MECHANISM      (0) /*1: TRUE; 0:FALSE*/

#if SD_CARD_APP
    #define MUTILE_BUFFER                   (1)
#endif
#if MUTILE_BUFFER
    #define MSD_RECV_BUFFER_NUM             (2)
    #else
    #define MSD_RECV_BUFFER_NUM             (1)
#endif
#define MSD_RECV_BUFFER_SIZE                (512)
#define MSD_SEND_BUFFER_SIZE                (512)
/*****************************************************************************
 * Global variables
 *****************************************************************************/

/******************************************************************************
 * Types
 *****************************************************************************/
typedef struct _disk_variable_struct
{
    msd_handle_t app_handle;
    uint32_t start_app;
    uint16_t speed;
#if RAM_DISK_APP
    uint8_t storage_disk[DISK_SIZE_NORMAL];
#endif  
    uint8_t disk_lock;
    uint8_t read_write_error;
} disk_struct_t;

/*****************************************************************************
 * Global Functions
 *****************************************************************************/
extern void APP_init(void);
extern void Disk_App(void);

#endif

/* EOF */