Rev 368 | Rev 397 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 368 | Rev 396 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /*#######################################################################################*/ |
1 | /*#######################################################################################*/ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
2 | /* !!! THIS IS NOT FREE SOFTWARE !!! */ |
3 | /*#######################################################################################*/ |
3 | /*#######################################################################################*/ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
- | 5 | // + Copyright (c) 2008 Ingo Busker, Holger Buss |
|
- | 6 | // + Nur für den privaten Gebrauch / NON-COMMERCIAL USE ONLY |
|
- | 7 | // + FOR NON COMMERCIAL USE ONLY |
|
5 | // + www.MikroKopter.com |
8 | // + www.MikroKopter.com |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
9 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7 | // + Software Nutzungsbedingungen (english version: see below) |
- | |
8 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
10 | // + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
9 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
11 | // + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
10 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
12 | // + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
11 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
13 | // + bzgl. der Nutzungsbedingungen aufzunehmen. |
12 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
14 | // + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
- | 15 | // + Verkauf von Luftbildaufnahmen, usw. |
|
13 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
16 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
14 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
17 | // + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
15 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
18 | // + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
16 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
19 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
17 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
20 | // + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
18 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
21 | // + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
19 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
22 | // + eindeutig als Ursprung verlinkt werden |
20 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
23 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
21 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
24 | // + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
22 | // + des Mitverschuldens offen. |
25 | // + Benutzung auf eigene Gefahr |
23 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
- | |
24 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
- | |
25 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
26 | // + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
26 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
- | |
27 | // + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt. |
27 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software. |
28 | // + Die Portierung oder Nutzung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
29 | // + #### ENDE DER NUTZUNGSBEDINGUNGEN ####' |
29 | // + mit unserer Zustimmung zulässig |
30 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
- | |
31 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
32 | // + Software LICENSING TERMS |
31 | // + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
33 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
32 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
34 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
33 | // + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
35 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
34 | // + this list of conditions and the following disclaimer. |
36 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
35 | // + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
37 | // + The Software may only be used with the Licensor's products. |
36 | // + from this software without specific prior written permission. |
38 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
37 | // + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
- | 38 | // + for non-commercial use (directly or indirectly) |
|
39 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
39 | // + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
40 | // + agreement shall be the property of the Licensor. |
40 | // + with our written permission |
41 | // + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other |
41 | // + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
- | 42 | // + clearly linked as origin |
|
42 | // + features that can be used to identify the program may not be altered or defaced by the customer. |
43 | // + * porting the sources to other systems or using the software on other systems (except hardware from www.mikrokopter.de) is not allowed |
- | 44 | // |
|
43 | // + The customer shall be responsible for taking reasonable precautions |
45 | // + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
44 | // + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the |
46 | // + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
45 | // + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and |
47 | // + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
46 | // + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product |
48 | // + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
47 | // + liability. However, the Licensor shall be entitled to the defense of contributory negligence. |
49 | // + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
48 | // + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test |
50 | // + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
49 | // + the software for his purpose before any operational usage. The customer will backup his data before using the software. |
51 | // + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
50 | // + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data |
52 | // + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
51 | // + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations. |
53 | // + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
52 | // + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
54 | // + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
53 | // + #### END OF LICENSING TERMS #### |
55 | // + POSSIBILITY OF SUCH DAMAGE. |
54 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
- | |
55 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
56 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 56... | Line 57... | ||
56 | 57 | ||
57 | #include <stdio.h> |
58 | #include <stdio.h> |
58 | #include <stdarg.h> |
59 | #include <stdarg.h> |
Line 75... | Line 76... | ||
75 | 76 | ||
Line 76... | Line 77... | ||
76 | } __attribute__((packed)) FTP_direntry_t; |
77 | } __attribute__((packed)) FTP_direntry_t; |
Line 77... | Line 78... | ||
77 | 78 | ||
Line 78... | Line 79... | ||
78 | FTP_direntry_t FTP_direntry; |
79 | FTP_direntry_t FTP_direntry; |
79 | 80 | ||
80 | char FTP_data[DATA_TRANSFER_SIZE+1]; // rx & tx buffer to avoid 2 buffers |
81 | char FTP_data[DATA_TRANSFER_SIZE+10]; // rx & tx buffer to avoid 2 buffers |
Line 130... | Line 131... | ||
130 | return (count); |
131 | return (count); |
131 | } |
132 | } |
132 | // -------------------------------------------------------------------- |
133 | // -------------------------------------------------------------------- |
133 | void CheckFTPCommand(u8 FTP_command) |
134 | void CheckFTPCommand(u8 FTP_command) |
134 | { |
135 | { |
135 | /* |
- | |
136 | static Find_t fe; |
136 | static Find_t fe; |
137 | static File_t *fp = NULL; |
137 | static File_t *fp = NULL; |
138 | static u8 blockindex, compressLevel = 0; |
138 | static u8 blockindex, compressLevel = 0; |
Line 139... | Line 139... | ||
139 | |
139 | |
Line 176... | Line 176... | ||
176 | } |
176 | } |
Line 177... | Line 177... | ||
177 | |
177 | |
Line 178... | Line 178... | ||
178 | break; |
178 | break; |
- | 179 | ||
- | 180 | case FTP_CMD_SET_CWD: |
|
179 | |
181 | { |
180 | case FTP_CMD_SET_CWD: |
182 | u8 cmd_successful; |
- | 183 | ||
- | 184 | cmd_successful = chdir_(FTP_data); |
|
181 | |
185 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &FTP_command, 1, &cmd_successful, 1); |
Line 182... | Line 186... | ||
182 | chdir_(FTP_data); |
186 | } |
- | 187 | break; |
|
- | 188 | ||
- | 189 | case FTP_CMD_DELETE_FILE: // delete file |
|
- | 190 | { |
|
- | 191 | u8 cmd_successful = 1; |
|
- | 192 | ||
- | 193 | Debug(&FTP_data[0]); |
|
- | 194 | ||
- | 195 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &FTP_command, 1, &cmd_successful, 1); |
|
- | 196 | ||
- | 197 | if (fdelete_(&FTP_data[0])) |
|
- | 198 | { |
|
- | 199 | cmd_successful = 1; |
|
- | 200 | } |
|
- | 201 | else cmd_successful = 0; |
|
- | 202 | ||
183 | break; |
203 | } |
184 | |
204 | break; |
Line 185... | Line 205... | ||
185 | case FTP_CMD_OPEN_FILE: |
205 | case FTP_CMD_OPEN_FILE: // open the file for reading |
186 | { |
206 | { |
Line 241... | Line 261... | ||
241 | fclose_(fp); |
261 | fclose_(fp); |
242 | Debug("ftp: CloseFile"); |
262 | Debug("ftp: CloseFile"); |
Line 243... | Line 263... | ||
243 | 263 | ||
Line -... | Line 264... | ||
- | 264 | break; |
|
- | 265 | ||
- | 266 | case FTP_CMD_CREATE_FILE: // open the file for writing |
|
- | 267 | { |
|
- | 268 | u16 size = DATA_TRANSFER_SIZE; |
|
- | 269 | ||
- | 270 | //compressLevel = FTP_data[0]; |
|
- | 271 | compressLevel = 0; // no compression for writing |
|
- | 272 | ||
- | 273 | ||
- | 274 | fp = fopen_(&FTP_data[5], 'w'); |
|
- | 275 | if (fp != NULL) |
|
- | 276 | { |
|
- | 277 | blockindex = 0; // reset index counter |
|
- | 278 | } |
|
- | 279 | else size = 0; // this means, no valid file for transfer (maybe readonly) |
|
- | 280 | ||
- | 281 | if (size == 0) Debug("ftp: create ERR "); |
|
- | 282 | ||
- | 283 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &FTP_command, 1, &size, 2); |
|
- | 284 | } |
|
- | 285 | break; |
|
- | 286 | ||
- | 287 | case FTP_CMD_SEND_FILE_DATA: |
|
- | 288 | { |
|
- | 289 | u16 size = (u8)FTP_data[2]; |
|
- | 290 | size *= 0x100; |
|
- | 291 | size += (u8) FTP_data[1]; |
|
- | 292 | ||
- | 293 | ||
- | 294 | if (FTP_data[0] == blockindex) // next block is requested |
|
- | 295 | { |
|
- | 296 | blockindex++; |
|
- | 297 | fwrite_(&FTP_data[3], size, 1, fp); // write data block to buffer); |
|
- | 298 | } |
|
- | 299 | MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &FTP_command, 1, &blockindex, 1 ); |
|
- | 300 | } |
|
244 | break; |
301 | break; |
245 | 302 | ||
246 | case FTP_CMD_NONE: |
303 | case FTP_CMD_NONE: |
247 | default: |
304 | default: |
248 | FTP_command = FTP_CMD_NONE; |
305 | FTP_command = FTP_CMD_NONE; |
249 | Debug("ftp: CMD None"); |
306 | Debug("ftp: CMD None"); |
250 | break; |
- | |
251 | } |
307 | break; |
Line -... | Line 308... | ||
- | 308 | } |