versadac  1
versadac - Scalable Recorder Firmware
device_interface.h
1 /*****************************************************************************
2 FILE : device_interface.h
3 AUTHOR : Karl Wakeham
4 SYSTEM : GNU C++ for ARM 6
5 DESCRIPTION : Header file for the device interface task
6 *****************************************************************************/
7 
8 #ifndef __DEVICEINTERACE_H
9 #define __DEVICEINTERACE_H
10 
11 #include "stdtypes.h"
12 
13 #define DI_MAX_NUMBER_OF_FILES_TO_LIST 100
14 #define DI_MAX_FILENAME_LENGTH 60
15 
16 // Device types
17 #define DEVICE_USB 0
18 #define DEVICE_FTP 1
19 #define DEVICE_PROGRAM 2
20 
21 // Request types
22 #define DEVICE_WAITING 0
23 #define DEVICE_GET_LISTING 1
24 #define DEVICE_DELETE 2
25 #define DEVICE_RENAME 3
26 #define DEVICE_COPY_TO_USB 4
27 #define DEVICE_COPY_TO_FTP 5
28 #define DEVICE_COPY_TO_LOCAL 6
29 #define DEVICE_PREVIEW 7
30 #define DEVICE_EXISTS 8
31 #define DEVICE_CD 9
32 
33 // Request status
34 #define DEVICE_IN_PROGRESS 1
35 #define DEVICE_SUCCESS 2
36 #define DEVICE_FAILED 3
37 #define DEVICE_FAILED_DELETE 4
38 #define DEVICE_FAILED_COPY 5
39 #define DEVICE_FAILED_RENAME 6
40 #define DEVICE_FAILED_COPY_TO_USB 7
41 #define DEVICE_FAILED_COPY_TO_LOCAL 8
42 #define DEVICE_FAILED_COPY_TO_FTP 9
43 #define DEVICE_FAILED_NOT_EXISTS 10
44 #define DEVICE_FAILED_IN_PROGRESS 11
45 
46 // File attributes
47 #define FILE_CLEAR_ATTRIBUTES 0x00
48 #define FILE_READWRITE 0x01
49 #define FILE_READONLY 0x02
50 #define FILE_SUBDIRECTORY 0x04
51 #define FILE_NEW 0x80 // Special case for identifying the option for creating a new file
52 
53 typedef struct drive_t
54 {
55  uint8 count;
56  uint8 attributes[DI_MAX_NUMBER_OF_FILES_TO_LIST];
57  string_60 label;
58  uc_string_60 listing[DI_MAX_NUMBER_OF_FILES_TO_LIST];
59 
60 } drive_t;
61 
62 typedef struct file_listing_t
63 {
64  uint8 status; // Current status of the request
65  uint8 device; // Type of device request is for ie, USB, program, FTP
66  uint8 request; // The current action being performed
67 
68  uint8 arg6; // Variable set of arguments (differ for each request for each device)
69  string_100 arg1;
70  string_100 arg2;
71  string_100 arg3;
72  string_100 arg4;
73  string_100 arg5;
74 
75  string_200 cwd; // Current working directory
76 
77  drive_t ftp; // FTP device data
78  drive_t usb; // USB device data
79  drive_t program; // program device data
80 
82 
83 #if __cplusplus
84 extern "C"
85 {
86 #endif
87 
88 file_listing_t * device_interface_request(uint8 z_device, uint8 z_request, char * z_arg1,
89  char * z_arg2, char * z_arg3, char * z_arg4,
90  char * z_arg5, uint8 z_arg6);
91 
92 void device_interface_run_task (void);
93 void device_interface_stop_task (void);
94 
95 // This should be externed for anyone wnating to use it (please note there is no locking on this structure!!)
96 file_listing_t g_file_list;
97 
98 #if __cplusplus
99 }
100 #endif
101 
102 #endif
103 
Definition: device_interface.h:53
Definition: device_interface.h:62