Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 432 → Rev 433

/trunk/fat16.c
304,21 → 304,6
#define FSTATE_UNUSED 0
#define FSTATE_USED 1
 
typedef struct
{
u8 IsValid; // 0 means invalid, else valid
u8 SectorsPerCluster; // how many sectors does a cluster contain?
u8 FatCopies; // Numbers of copies of the FAT
u16 MaxRootEntries; // Possible number of entries in the root directory.
u16 SectorsPerFat; // how many sectors does a fat16 contain?
u32 FirstFatSector; // sector of the start of the fat
u32 FirstRootDirSector; // sector of the rootdirectory
u32 FirstDataSector; // sector of the first cluster containing data (cluster2).
u32 LastDataSector; // the last data sector of the partition
u8 VolumeLabel[12]; // the volume label
u32 CurrentWorkingDirectory;// A pointer to the directory we are actual using
s8 PathToCwd[256]; // a string containing the complete path to the current working directory
} __attribute__((packed)) Partition_t;
 
Partition_t Partition; // Structure holds partition information
 
/trunk/fat16.h
66,6 → 66,26
u8 attribmask;
} __attribute__((packed)) Find_t;
 
 
 
typedef struct
{
u8 IsValid; // 0 means invalid, else valid
u8 SectorsPerCluster; // how many sectors does a cluster contain?
u8 FatCopies; // Numbers of copies of the FAT
u16 MaxRootEntries; // Possible number of entries in the root directory.
u16 SectorsPerFat; // how many sectors does a fat16 contain?
u32 FirstFatSector; // sector of the start of the fat
u32 FirstRootDirSector; // sector of the rootdirectory
u32 FirstDataSector; // sector of the first cluster containing data (cluster2).
u32 LastDataSector; // the last data sector of the partition
u8 VolumeLabel[12]; // the volume label
u32 CurrentWorkingDirectory;// A pointer to the directory we are actual using
s8 PathToCwd[256]; // a string containing the complete path to the current working directory
} __attribute__((packed)) Partition_t;
 
extern Partition_t Partition; // Structure holds partition information
 
//________________________________________________________________________________________________________________________________________
//
// API to the FAT16 filesystem
/trunk/ftphelper.h
2,6 → 2,12
#define _FTPHELPER_H
 
#define FTP_CMD_ERROR 255 // global ERROR - CMD
#define FTP_ERROR_NONE 0
#define FTP_ERROR_NO_SDCARD 1
#define FTP_ERROR_MOTOR_RUN 2
 
 
#define FTP_CMD_NONE 0
#define FTP_CMD_FINDFIRST 1
#define FTP_CMD_FINDNEXT 2
19,6 → 25,7
 
 
 
 
#define DATA_TRANSFER_SIZE 750 // size of 1 data block for filetransfer
 
char FTP_data[DATA_TRANSFER_SIZE+10]; // parameter from FTP_CMD_SET_CWD
/trunk/uart1.c
78,7 → 78,9
#include "spi_slave.h"
#include "ftphelper.h"
#include "led.h"
#include "fat16.h"
 
 
#define FALSE 0
#define TRUE 1
 
405,7 → 407,7
{
case 'f': // ftp command
if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) break; // not if the motors are running
UART1_Request_FTP = SerialMsg.pData[0];
//if (UART1_Request_FTP == FTP_CMD_SET_CWD || UART1_Request_FTP == FTP_CMD_GET_FILE)
memcpy(&FTP_data, &SerialMsg.pData[1], sizeof(FTP_data)); // copy ftp parameter
702,7 → 704,17
}
else if(UART1_Request_FTP && (UART1_tx_buffer.Locked == FALSE))
{
CheckFTPCommand(UART1_Request_FTP);
u8 errorcode = FTP_ERROR_NONE;
if(FC.StatusFlags & FC_STATUS_MOTOR_RUN) errorcode = FTP_ERROR_MOTOR_RUN;
else if (!Partition.IsValid) errorcode = FTP_ERROR_NO_SDCARD;
 
if (!errorcode) CheckFTPCommand(UART1_Request_FTP);
else
{
u8 cmd = FTP_CMD_ERROR;
MKProtocol_CreateSerialFrame(&UART1_tx_buffer, 'F', NC_ADDRESS, 2, &cmd, 1, &errorcode, 1);
}
 
UART1_Request_FTP = FALSE;
}
else if((UART1_Request_WritePoint!= 0xFF) && (UART1_tx_buffer.Locked == FALSE))