소스 검색

rename types

David Voswinkel 15 년 전
부모
커밋
e1567d81da
7개의 변경된 파일1919개의 추가작업 그리고 1901개의 파일을 삭제
  1. 40 40
      avr/usbload/fat.c
  2. 36 36
      avr/usbload/fat.h
  3. 1791 1743
      avr/usbload/loader.c
  4. 2 2
      avr/usbload/loader.h
  5. 2 4
      avr/usbload/main.c
  6. 38 56
      avr/usbload/mmc.c
  7. 10 20
      avr/usbload/mmc.h

+ 40 - 40
avr/usbload/fat.c

@@ -11,10 +11,10 @@
  */
 
 #include "fat.h"
-unsigned char cluster_size;
-unsigned int fat_offset;
-unsigned int cluster_offset;
-unsigned int volume_boot_record_addr;
+uint8_t cluster_size;
+uint16_t fat_offset;
+uint16_t cluster_offset;
+uint16_t volume_boot_record_addr;
 
     // ############################################################################
     // Auslesen Cluster Size der MMC/SD Karte und Speichern der größe ins EEprom
@@ -24,7 +24,7 @@ void fat_init(uint8_t * Buffer)
 {
     struct BootSec *bootp;      // Zeiger auf Bootsektor Struktur
 
-    // unsigned char Buffer[BlockSize];
+    // uint8_t Buffer[BlockSize];
 
     // volume_boot_record_addr = fat_addr (Buffer); 
     mmc_read_sector(MASTER_BOOT_RECORD, Buffer);        // Read Master Boot Record 
@@ -55,11 +55,11 @@ void fat_init(uint8_t * Buffer)
 }
     // ############################################################################
     // Auslesen der Adresse des First Root Directory von Volume Boot Record
-unsigned int fat_root_dir_addr(unsigned char *Buffer)
+uint16_t fat_root_dir_addr(uint8_t *Buffer)
 // ############################################################################
 {
     struct BootSec *bootp;      // Zeiger auf Bootsektor Struktur
-    unsigned int FirstRootDirSecNum;
+    uint16_t FirstRootDirSecNum;
 
     // auslesen des Volume Boot Record von der MMC/SD Karte 
     mmc_read_sector(volume_boot_record_addr, Buffer);
@@ -77,20 +77,20 @@ unsigned int fat_root_dir_addr(unsigned char *Buffer)
     // ist kein Eintrag vorhanden, ist der Eintrag im 
     // Rückgabe Cluster 0xFFFF. Es wird immer nur ein Eintrag ausgegeben
     // um Speicherplatz zu sparen um es auch für kleine Atmels zu benutzen
-unsigned int fat_read_dir_ent(unsigned int dir_cluster, // Angabe Dir Cluster
-                              unsigned char Entry_Count,        // Angabe welcher Direintrag
-                              unsigned long *Size,      // Rückgabe der File Größe
-                              unsigned char *Dir_Attrib,        // Rückgabe des Dir Attributs
-                              unsigned char *Buffer)    // Working Buffer
+uint16_t fat_read_dir_ent(uint16_t dir_cluster, // Angabe Dir Cluster
+                              uint8_t Entry_Count,        // Angabe welcher Direintrag
+                              uint32_t *Size,      // Rückgabe der File Größe
+                              uint8_t *Dir_Attrib,        // Rückgabe des Dir Attributs
+                              uint8_t *Buffer)    // Working Buffer
 // ############################################################################
 {
-    unsigned char *pointer;
-    unsigned int TMP_Entry_Count = 0;
-    unsigned long Block = 0;
+    uint8_t *pointer;
+    uint16_t TMP_Entry_Count = 0;
+    uint32_t Block = 0;
     struct DirEntry *dir;       // Zeiger auf einen Verzeichniseintrag
-    unsigned int blk;
-    unsigned int a;
-    unsigned char b;
+    uint16_t blk;
+    uint16_t a;
+    uint8_t b;
     pointer = Buffer;
     if (dir_cluster == 0) {
         Block = fat_root_dir_addr(Buffer);
@@ -159,20 +159,20 @@ unsigned int fat_read_dir_ent(unsigned int dir_cluster, // Angabe Dir Cluster
     // Bei größeren Files muß der Buffer größer definiert
     // werden! (Ready)
     // Cluster = Start Clusterangabe aus dem Directory 
-void fat_load(unsigned int Cluster,     // Angabe Startcluster
-              unsigned long *Block, unsigned char *TMP_Buffer)  // Workingbuffer
+void fat_load(uint16_t Cluster,     // Angabe Startcluster
+              uint32_t *Block, uint8_t *TMP_Buffer)  // Workingbuffer
 // ############################################################################
 {
 
     // Zum Überprüfen ob der FAT Block schon geladen wurde
-    unsigned int FAT_Block_Store = 0;
+    uint16_t FAT_Block_Store = 0;
 
     // Byte Adresse innerhalb des Fat Blocks
-    unsigned int FAT_Byte_Addresse;
+    uint16_t FAT_Byte_Addresse;
 
     // FAT Block Adresse
-    unsigned int FAT_Block_Addresse;
-    unsigned int a;
+    uint16_t FAT_Block_Addresse;
+    uint16_t a;
 
     // Berechnung für den ersten FAT Block (FAT Start Addresse)
     for (a = 0;; a++) {
@@ -208,16 +208,16 @@ void fat_load(unsigned int Cluster,     // Angabe Startcluster
 
     // ############################################################################
     // Lesen eines 512Bytes Blocks von einem File
-void fat_read_file(unsigned int Cluster,        // Angabe des Startclusters vom File
-                   unsigned char *Buffer,       // Workingbuffer
-                   unsigned long BlockCount)    // Angabe welcher Bock vom File geladen 
+void fat_read_file(uint16_t Cluster,        // Angabe des Startclusters vom File
+                   uint8_t *Buffer,       // Workingbuffer
+                   uint32_t BlockCount)    // Angabe welcher Bock vom File geladen 
                                                                                       // werden soll a 512 Bytes
 // ############################################################################
 {
 
     // Berechnung des Blocks aus BlockCount und Cluster aus FATTabelle
     // Berechnung welcher Cluster zu laden ist
-    unsigned long Block = (BlockCount / cluster_size);
+    uint32_t Block = (BlockCount / cluster_size);
 
     // Auslesen der FAT - Tabelle
     fat_load(Cluster, &Block, Buffer);
@@ -233,17 +233,17 @@ void fat_read_file(unsigned int Cluster,        // Angabe des Startclusters vom
 
     // ############################################################################
     // Lesen eines 512Bytes Blocks von einem File
-void fat_write_file(unsigned int cluster,       // Angabe des Startclusters vom File
-                    unsigned char *buffer,      // Workingbuffer
-                    unsigned long blockCount)   // Angabe welcher Bock vom File gespeichert 
+void fat_write_file(uint16_t cluster,       // Angabe des Startclusters vom File
+                    uint8_t *buffer,      // Workingbuffer
+                    uint32_t blockCount)   // Angabe welcher Bock vom File gespeichert 
                                                                           // werden soll a 512 Bytes
 // ############################################################################
 {
 
     // Berechnung des Blocks aus BlockCount und Cluster aus FATTabelle
     // Berechnung welcher Cluster zu speichern ist
-    unsigned char tmp_buffer[513];
-    unsigned long block = (blockCount / cluster_size);
+    uint8_t tmp_buffer[513];
+    uint32_t block = (blockCount / cluster_size);
 
     // Auslesen der FAT - Tabelle
     fat_load(cluster, &block, tmp_buffer);
@@ -259,19 +259,19 @@ void fat_write_file(unsigned int cluster,       // Angabe des Startclusters vom
 
     // ####################################################################################
     // Sucht ein File im Directory
-unsigned char fat_search_file(unsigned char *File_Name, // Name des zu suchenden Files
-                              unsigned int *Cluster,    // Angabe Dir Cluster welches
+uint8_t fat_search_file(uint8_t *File_Name, // Name des zu suchenden Files
+                              uint16_t *Cluster,    // Angabe Dir Cluster welches
                               // durchsucht werden soll
                               // und Rückgabe des clusters
                               // vom File welches gefunden
                               // wurde
-                              unsigned long *Size,      // Rückgabe der File Größe
-                              unsigned char *Dir_Attrib,        // Rückgabe des Dir Attributs
-                              unsigned char *Buffer)    // Working Buffer
+                              uint32_t *Size,      // Rückgabe der File Größe
+                              uint8_t *Dir_Attrib,        // Rückgabe des Dir Attributs
+                              uint8_t *Buffer)    // Working Buffer
 // ####################################################################################
 {
-    unsigned int Dir_Cluster_Store = *Cluster;
-    unsigned char a ;
+    uint16_t Dir_Cluster_Store = *Cluster;
+    uint8_t a ;
     for (a = 0; a < 100; a++) {
         *Cluster =
             fat_read_dir_ent(Dir_Cluster_Store, a, Size, Dir_Attrib, Buffer);

+ 36 - 36
avr/usbload/fat.h

@@ -13,17 +13,17 @@
     // #define FAT_DEBUG(...) 
 
     // Prototypes
-extern unsigned int fat_root_dir_addr(unsigned char *);
-extern unsigned int fat_read_dir_ent(unsigned int, unsigned char,
-                                     unsigned long *, unsigned char *,
-                                     unsigned char *);
-extern void fat_load(unsigned int, unsigned long *, unsigned char *);
-extern void fat_read_file(unsigned int, unsigned char *, unsigned long);
-extern void fat_write_file(unsigned int, unsigned char *, unsigned long);
+extern uint16_t fat_root_dir_addr(uint8_t *);
+extern uint16_t fat_read_dir_ent(uint16_t, uint8_t,
+                                     uint32_t *, uint8_t *,
+                                     uint8_t *);
+extern void fat_load(uint16_t, uint32_t *, uint8_t *);
+extern void fat_read_file(uint16_t, uint8_t *, uint32_t);
+extern void fat_write_file(uint16_t, uint8_t *, uint32_t);
 extern void fat_init(uint8_t * Buffer);
-extern unsigned char fat_search_file(unsigned char *, unsigned int *,
-                                     unsigned long *, unsigned char *,
-                                     unsigned char *);
+extern uint8_t fat_search_file(uint8_t *, uint16_t *,
+                                     uint32_t *, uint8_t *,
+                                     uint8_t *);
 
     // Block Size in Bytes
 #define BlockSize			512
@@ -49,20 +49,20 @@ extern unsigned char fat_search_file(unsigned char *, unsigned int *,
 #define ATTR_DIRECTORY		0x10
 #define ATTR_ARCHIVE		0x20
 struct BootSec {
-    unsigned char BS_jmpBoot[3];
-    unsigned char BS_OEMName[8];
-    unsigned int BPB_BytesPerSec;       // 2 bytes
-    unsigned char BPB_SecPerClus;
-    unsigned int BPB_RsvdSecCnt;        // 2 bytes
-    unsigned char BPB_NumFATs;
-    unsigned int BPB_RootEntCnt;        // 2 bytes
-    unsigned int BPB_TotSec16;  // 2 bytes
-    unsigned char BPB_Media;
-    unsigned int BPB_FATSz16;   // 2 bytes
-    unsigned int BPB_SecPerTrk; // 2 bytes
-    unsigned int BPB_NumHeads;  // 2 bytes
-    unsigned long BPB_HiddSec;  // 4 bytes
-    unsigned long BPB_TotSec32; // 4 bytes
+    uint8_t BS_jmpBoot[3];
+    uint8_t BS_OEMName[8];
+    uint16_t BPB_BytesPerSec;       // 2 bytes
+    uint8_t BPB_SecPerClus;
+    uint16_t BPB_RsvdSecCnt;        // 2 bytes
+    uint8_t BPB_NumFATs;
+    uint16_t BPB_RootEntCnt;        // 2 bytes
+    uint16_t BPB_TotSec16;  // 2 bytes
+    uint8_t BPB_Media;
+    uint16_t BPB_FATSz16;   // 2 bytes
+    uint16_t BPB_SecPerTrk; // 2 bytes
+    uint16_t BPB_NumHeads;  // 2 bytes
+    uint32_t BPB_HiddSec;  // 4 bytes
+    uint32_t BPB_TotSec32; // 4 bytes
 };
 
     // FAT12 and FAT16 Structure Starting at Offset 36
@@ -90,18 +90,18 @@ struct BootSec {
 #define FAT32_BS_FILSYSTYPE	82
     // End of Boot Sctor and BPB Structure
 struct DirEntry {
-    unsigned char DIR_Name[11]; // 8 chars filename
-    unsigned char DIR_Attr;     // file attributes RSHA, Longname, Drive Label, Directory
-    unsigned char DIR_NTRes;    // set to zero
-    unsigned char DIR_CrtTimeTenth;     // creation time part in milliseconds
-    unsigned int DIR_CrtTime;   // creation time
-    unsigned int DIR_CrtDate;   // creation date
-    unsigned int DIR_LastAccDate;       // last access date
-    unsigned int DIR_FstClusHI; // first cluster high word 
-    unsigned int DIR_WrtTime;   // last write time
-    unsigned int DIR_WrtDate;   // last write date
-    unsigned int DIR_FstClusLO; // first cluster low word 
-    unsigned long DIR_FileSize;
+    uint8_t DIR_Name[11]; // 8 chars filename
+    uint8_t DIR_Attr;     // file attributes RSHA, Longname, Drive Label, Directory
+    uint8_t DIR_NTRes;    // set to zero
+    uint8_t DIR_CrtTimeTenth;     // creation time part in milliseconds
+    uint16_t DIR_CrtTime;   // creation time
+    uint16_t DIR_CrtDate;   // creation date
+    uint16_t DIR_LastAccDate;       // last access date
+    uint16_t DIR_FstClusHI; // first cluster high word 
+    uint16_t DIR_WrtTime;   // last write time
+    uint16_t DIR_WrtDate;   // last write date
+    uint16_t DIR_FstClusLO; // first cluster low word 
+    uint32_t DIR_FileSize;
 };
 
 #endif                          // _FAT_H_

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1791 - 1743
avr/usbload/loader.c


+ 2 - 2
avr/usbload/loader.h

@@ -2,8 +2,8 @@
 #ifndef __FIFO_H__
 #define __FIFO_H__
 
-#define ROM_BUFFER_SIZE  30344
+#define ROM_BUFFER_SIZE  31091
 #define ROM_HUFFMAN_SIZE 0
-#define ROM_RLE_SIZE     30344
+#define ROM_RLE_SIZE     31091
 
 #endif

+ 2 - 4
avr/usbload/main.c

@@ -312,7 +312,7 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
 /*
  * ------------------------------------------------------------------------- 
  */
- 
+#define ENABLE_TEST
 #ifdef ENABLE_TEST
  
 void test_sdcard(){
@@ -535,12 +535,10 @@ int main(void)
     stdout = &uart_stdout;
 
     info("Sytem start\n");
-
-
     system_init();
+    test_sdcard();
 
 #if 0
-    test_sdcard();
     test_read_write();
     test_bulk_read_write();
     test_crc();

+ 38 - 56
avr/usbload/mmc.c

@@ -1,49 +1,32 @@
-/*
- * ####################################################################################### Connect AVR to MMC/SD   Copyright (C) 2004
- * Ulrich Radig  Bei Fragen und Verbesserungen wendet euch per EMail an  mail@ulrichradig.de  oder im Forum meiner Web Page :
- * www.ulrichradig.de  Dieses Programm ist freie Software. Sie können es unter den Bedingungen der  GNU General Public License, wie von
- * der Free Software Foundation veröffentlicht,  weitergeben und/oder modifizieren, entweder gemäß Version 2 der Lizenz oder  (nach Ihrer 
- * Option) jeder späteren Version.   Die Veröffentlichung dieses Programms erfolgt in der Hoffnung,  daß es Ihnen von Nutzen sein wird,
- * aber OHNE IRGENDEINE GARANTIE,  sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT  FÜR EINEN BESTIMMTEN ZWECK.
- * Details finden Sie in der GNU General Public License.   Sie sollten eine Kopie der GNU General Public License zusammen mit diesem 
- * Programm erhalten haben.  Falls nicht, schreiben Sie an die Free Software Foundation,  Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307, USA.  #######################################################################################
- */
-
 #include "mmc.h"
 #include <util/delay.h>
-
-    // ############################################################################
-    // Routine zur Initialisierung der MMC/SD-Karte (SPI-MODE)
-unsigned char mmc_init()
-// ############################################################################
+uint8_t mmc_init()
 {
-    unsigned int Timeout = 0, i;
+    uint16_t Timeout = 0, i;
 
     // Konfiguration des Ports an der die MMC/SD-Karte angeschlossen wurde
-    DDRC |= ((1 << MMC_DO) | (1 << MMC_CS) | (1 << MMC_CLK));
-    DDRC &= ~(1 << MMC_DI);
-    PORTC |= ((1 << MMC_DO) | (1 << MMC_DI) | (1 << MMC_CS));
+    DDRB |= ((1 << MMC_DO) | (1 << MMC_CS) | (1 << MMC_CLK));
+    DDRB &= ~(1 << MMC_DI);
+    PORTB |= ((1 << MMC_DO) | (1 << MMC_DI) | (1 << MMC_CS));
 
     // Wartet eine kurze Zeit
-    _delay_ms(10);
+    _delay_ms(20);
 
     // Initialisiere MMC/SD-Karte in den SPI-Mode
     for (i = 0; i < 250; i++) {
-        PORTC ^= (1 << MMC_CLK);
+        PORTB ^= (1 << MMC_CLK);
         _delay_us(4);
     }
-    PORTC &= ~(1 << MMC_CLK);
+    PORTB &= ~(1 << MMC_CLK);
     _delay_us(10);
-    PORTC &= ~(1 << MMC_CS);
+    PORTB &= ~(1 << MMC_CS);
     _delay_us(3);
 
     // Sendet Commando CMD0 an MMC/SD-Karte
-    unsigned char CMD[] = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x95 };
+    uint8_t CMD[] = { 0x40, 0x00, 0x00, 0x00, 0x00, 0x95 };
     while (mmc_write_command(CMD) != 1) {
         if (Timeout++ > 20) {
             MMC_Disable();
-            printf("fail1\n");
             return (1);         // Abbruch bei Commando1 (Return Code1)
         }
     }
@@ -55,7 +38,6 @@ unsigned char mmc_init()
     while (mmc_write_command(CMD) != 0) {
         if (Timeout++ > 800) {
             MMC_Disable();
-            printf("fail2\n");
             return (9);         // Abbruch bei Commando2 (Return Code2)
         }
     }
@@ -64,12 +46,12 @@ unsigned char mmc_init()
 
     // ############################################################################
     // Sendet ein Commando an die MMC/SD-Karte
-unsigned char mmc_write_command(unsigned char *cmd)
+uint8_t mmc_write_command(uint8_t *cmd)
 // ############################################################################
 {
-    unsigned char tmp = 0xff;
-    unsigned int Timeout = 0;
-    unsigned char a;
+    uint8_t tmp = 0xff;
+    uint16_t Timeout = 0;
+    uint8_t a;
 
     // sendet 6 Byte Commando
     for (a = 0; a < 0x06; a++)  // sendet 6 Byte Commando zur MMC/SD-Karte
@@ -89,22 +71,22 @@ unsigned char mmc_write_command(unsigned char *cmd)
 
     // ############################################################################
     // Routine zum Empfangen eines Bytes von der MMC-Karte 
-unsigned char mmc_read_byte(void)
+uint8_t mmc_read_byte(void)
 // ############################################################################
 {
     uint8_t Byte = 0, j;
     for (j = 0; j < 8; j++) {
         Byte = (Byte << 1);
-        PORTC |= (1 << MMC_CLK);
+        PORTB |= (1 << MMC_CLK);
         _delay_us(4);
-        if (PINC & (1 << MMC_DI)) {
+        if (PINB & (1 << MMC_DI)) {
             Byte |= 1;
         }
 
         else {
             Byte &= ~1;
         }
-        PORTC &= ~(1 << MMC_CLK);
+        PORTB &= ~(1 << MMC_CLK);
         _delay_us(4);
     }
     return (Byte);
@@ -112,38 +94,38 @@ unsigned char mmc_read_byte(void)
 
     // ############################################################################
     // Routine zum Senden eines Bytes zur MMC-Karte
-void mmc_write_byte(unsigned char Byte)
+void mmc_write_byte(uint8_t Byte)
 // ############################################################################
 {
     uint8_t i;
     for (i = 0; i < 8; i++) {
         if (Byte & 0x80) {
-            PORTC |= (1 << MMC_DO);
+            PORTB |= (1 << MMC_DO);
         }
 
         else {
-            PORTC &= ~(1 << MMC_DO);
+            PORTB &= ~(1 << MMC_DO);
         }
         Byte = (Byte << 1);
-        PORTC |= (1 << MMC_CLK);
+        PORTB |= (1 << MMC_CLK);
         _delay_us(4);
-        PORTC &= ~(1 << MMC_CLK);
+        PORTB &= ~(1 << MMC_CLK);
         _delay_us(4);
     }
-    PORTC |= (1 << MMC_DO);
+    PORTB |= (1 << MMC_DO);
 }
 
     // ############################################################################
     // Routine zum schreiben eines Blocks(512Byte) auf die MMC/SD-Karte
-unsigned char mmc_write_sector(unsigned long addr, unsigned char *Buffer)
+uint8_t mmc_write_sector(uint32_t addr, uint8_t *Buffer)
 // ############################################################################
 {
-    unsigned char tmp;
+    uint8_t tmp;
 
     // Commando 24 zum schreiben eines Blocks auf die MMC/SD - Karte
-    unsigned char cmd[] = { 0x58, 0x00, 0x00, 0x00, 0x00, 0xFF };
-    unsigned char a;
-    unsigned int i;
+    uint8_t cmd[] = { 0x58, 0x00, 0x00, 0x00, 0x00, 0xFF };
+    uint8_t a;
+    uint16_t i;
 
     /*
      * Die Adressierung der MMC/SD-Karte wird in Bytes angegeben, addr wird von Blocks zu Bytes umgerechnet danach werden  diese in
@@ -188,11 +170,11 @@ unsigned char mmc_write_sector(unsigned long addr, unsigned char *Buffer)
 
     // ############################################################################
     // Routine zum lesen des CID Registers von der MMC/SD-Karte (16Bytes)
-void mmc_read_block(unsigned char *cmd, unsigned char *Buffer,
-                    unsigned int Bytes)
+void mmc_read_block(uint8_t *cmd, uint8_t *Buffer,
+                    uint16_t Bytes)
 // ############################################################################
 {
-    unsigned int a;
+    uint16_t a;
 
     // Sendet Commando cmd an MMC/SD-Karte
     if (mmc_write_command(cmd) != 0) {
@@ -215,12 +197,12 @@ void mmc_read_block(unsigned char *cmd, unsigned char *Buffer,
 
     // ############################################################################
     // Routine zum lesen eines Blocks(512Byte) von der MMC/SD-Karte
-unsigned char mmc_read_sector(unsigned long addr, unsigned char *Buffer)
+uint8_t mmc_read_sector(uint32_t addr, uint8_t *Buffer)
 // ############################################################################
 {
 
     // Commando 16 zum lesen eines Blocks von der MMC/SD - Karte
-    unsigned char cmd[] = { 0x51, 0x00, 0x00, 0x00, 0x00, 0xFF };
+    uint8_t cmd[] = { 0x51, 0x00, 0x00, 0x00, 0x00, 0xFF };
 
     /*
      * Die Adressierung der MMC/SD-Karte wird in Bytes angegeben, addr wird von Blocks zu Bytes umgerechnet danach werden  diese in
@@ -236,24 +218,24 @@ unsigned char mmc_read_sector(unsigned long addr, unsigned char *Buffer)
 
     // ############################################################################
     // Routine zum lesen des CID Registers von der MMC/SD-Karte (16Bytes)
-unsigned char mmc_read_cid(unsigned char *Buffer)
+uint8_t mmc_read_cid(uint8_t *Buffer)
 // ############################################################################
 {
 
     // Commando zum lesen des CID Registers
-    unsigned char cmd[] = { 0x4A, 0x00, 0x00, 0x00, 0x00, 0xFF };
+    uint8_t cmd[] = { 0x4A, 0x00, 0x00, 0x00, 0x00, 0xFF };
     mmc_read_block(cmd, Buffer, 16);
     return (0);
 }
 
     // ############################################################################
     // Routine zum lesen des CSD Registers von der MMC/SD-Karte (16Bytes)
-unsigned char mmc_read_csd(unsigned char *Buffer)
+uint8_t mmc_read_csd(uint8_t *Buffer)
 // ############################################################################
 {
 
     // Commando zum lesen des CSD Registers
-    unsigned char cmd[] = { 0x49, 0x00, 0x00, 0x00, 0x00, 0xFF };
+    uint8_t cmd[] = { 0x49, 0x00, 0x00, 0x00, 0x00, 0xFF };
     mmc_read_block(cmd, Buffer, 16);
     return (0);
 }

+ 10 - 20
avr/usbload/mmc.h

@@ -1,15 +1,8 @@
-/*
- * ####################################################################################### Connect ARM to MMC/SD   Copyright (C) 2004
- * Ulrich Radig #######################################################################################
- */
-
 #ifndef _MMC_H_
 #define _MMC_H_
 
 #include <avr/io.h>
 
-    // #define SPI_Mode 1 //1 = Hardware SPI | 0 = Software SPI
-//#define SPI_Mode			1
 
 #define MMC_Write			PORTB   // Port an der die MMC/SD-Karte angeschlossen ist also des SPI
 #define MMC_Read			PINB
@@ -19,18 +12,15 @@
 #define MMC_DO  PB6
 #define MMC_DI  PB5
 #define MMC_CLK PB7
-//#define SPI_SS  PC4             // Nicht Benutz muß aber definiert werden
-
-    // Prototypes
-extern unsigned char mmc_read_byte(void);
-extern void mmc_write_byte(unsigned char);
-extern void mmc_read_block(unsigned char *, unsigned char *, unsigned in);
-extern unsigned char mmc_init(void);
-extern unsigned char mmc_read_sector(unsigned long, unsigned char *);
-extern unsigned char mmc_write_sector(unsigned long, unsigned char *);
-extern unsigned char mmc_write_command(unsigned char *);
-extern unsigned char mmc_read_csd(unsigned char *);
-extern unsigned char mmc_read_cid(unsigned char *);
+extern uint8_t mmc_read_byte(void);
+extern void mmc_write_byte(uint8_t);
+extern void mmc_read_block(uint8_t *, uint8_t *, unsigned in);
+extern uint8_t mmc_init(void);
+extern uint8_t mmc_read_sector(uint32_t, uint8_t *);
+extern uint8_t mmc_write_sector(uint32_t, uint8_t *);
+extern uint8_t mmc_write_command(uint8_t *);
+extern uint8_t mmc_read_csd(uint8_t *);
+extern uint8_t mmc_read_cid(uint8_t *);
 
     // set MMC_Chip_Select to high (MMC/SD-Karte Inaktiv)
 #define MMC_Disable() MMC_Write|= (1<<MMC_CS);
@@ -40,4 +30,4 @@ extern unsigned char mmc_read_cid(unsigned char *);
 
 #define nop()  __asm__ __volatile__ ("nop" ::)
 
-#endif                          // _MMC_H_
+#endif

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.