demOS
 All Data Structures Files Modules Pages
LOAD.H
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------ -----------------
2  Copyright J.Hubert 2015
3 
4  This file is part of demOS
5 
6  demOS is free software: you can redistribute it and/or modify it under the terms of
7  the GNU Lesser General Public License as published by the Free Software Foundation,
8  either version 3 of the License, or (at your option) any later version.
9 
10  demOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ;
11  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  See the GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License along with demOS.
15  If not, see <http://www.gnu.org/licenses/>.
16 ------------------------------------------------------------------------------------------------- */
17 
38 #ifndef LOAD_H
39 #define LOAD_H
40 
41 #include "DEMOSDK\BASTYPES.H"
42 
62 STRUCT(LOADmetaData)
63 {
64  u32 offset;
65  u32 size;
66  s32 originalsize;
67 };
68 
69 STRUCT(LOADresource)
70 {
71  u16 nbsectors; /* : 10; */
72  u8 startsector; /* : 5; */
73  u8 side; /* : 1; */
74  u8 track; /* : 8; */
75  s16 metadataIndex; /* : 16; */
76 };
77 
78 STRUCT(LOADdisk)
79 {
80  LOADresource* FAT;
81  u16 nbEntries;
82  LOADmetaData* metaData;
83  u16 nbMetaData;
84  u8 preferedDrive;
85 
86 # ifdef DEMOS_DEBUG
87  char* filename;
88  FILE* file;
89 # endif
90 };
91 
101 STRUCT(LOADrequest)
102 {
103  bool allocated;
104  volatile bool processed;
105  volatile u16 sector;
106  u16 reserved;
107  volatile u16 side_drive;
108  volatile u16 track;
109  u16 nbsectors;
110  void* address;
111  u16 order;
112 };
113 
114 
115 #define LOAD_SECTORSIZE 512UL
116 #define LOADroundBufferSize(SIZE) ((SIZE + 511UL) & 0xFFFFFE00UL)
117 
118 #define LOAD_PRIOTITY_HIGH 0
119 #define LOAD_PRIORITY_INORDER (LOADorder++)
120 
121 #define LOAD_NOTPACKED -1L
122 
123 #ifndef LOAD_C
124 extern u16 LOADorder;
125 #endif
126 
127 void LOADinit (void);
128 LOADrequest* LOADrequestLoad (LOADdisk* _media, u16 _resource, void* _buffer, u16 _order);
129 void LOADwaitRequestCompleted (LOADrequest* request);
130 void LOADwaitFDCIdle (void);
131 #define LOADfreeRequest(_request) _request->allocated = false;
132 u32 LOADgetEntrySize (LOADdisk* _media, u16 _entryIndex);
133 
134 #ifdef DEMOS_DEBUG
135 u16 LOADtrace (void* _image, u16 _pitch, u16 _planePitch, u16 _y);
136 #endif
137 
138 #ifdef DEMOS_UNITTEST
139 
140 #include "DEMOSDK\FSM.H"
141 
142 void LOADunitTestInit (FSM* _fsm);
143 void LOADunitTestUpdate (FSM* _fsm);
144 #endif
145 
146 #endif
Definition: FSM.H:31
FSM
Definition: LOAD.H:69
Definition: LOAD.H:62
BASTYPES
Definition: LOAD.H:78
Definition: LOAD.H:101