summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/main.c9
-rw-r--r--firmware/common/disk.c9
-rw-r--r--firmware/common/disk.h5
3 files changed, 12 insertions, 11 deletions
diff --git a/apps/main.c b/apps/main.c
index 1e2f44faad..727e58dfe9 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -53,6 +53,7 @@ extern int poolend[];
53int init(void) 53int init(void)
54{ 54{
55 int rc; 55 int rc;
56 struct partinfo* pinfo;
56 57
57 system_init(); 58 system_init();
58 59
@@ -73,11 +74,11 @@ int init(void)
73 if(rc) 74 if(rc)
74 panicf("ata: %d",rc); 75 panicf("ata: %d",rc);
75 76
76 rc = disk_init(); 77 pinfo = disk_init();
77 if (rc) 78 if (!pinfo)
78 panicf("disk: %d",rc); 79 panicf("disk: NULL");
79 80
80 rc = fat_mount(part[0].start); 81 rc = fat_mount(pinfo[0].start);
81 if(rc) 82 if(rc)
82 panicf("mount: %d",rc); 83 panicf("mount: %d",rc);
83 84
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 9572f115e5..b662072d5f 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -16,6 +16,7 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include <stdio.h>
19#include "ata.h" 20#include "ata.h"
20#include "debug.h" 21#include "debug.h"
21#include "disk.h" 22#include "disk.h"
@@ -38,9 +39,9 @@
38 (array[pos] | (array[pos+1] << 8 ) | \ 39 (array[pos] | (array[pos+1] << 8 ) | \
39 (array[pos+2] << 16 ) | (array[pos+3] << 24 )) 40 (array[pos+2] << 16 ) | (array[pos+3] << 24 ))
40 41
41struct partinfo part[8]; 42static struct partinfo part[8];
42 43
43int disk_init(void) 44struct partinfo* disk_init(void)
44{ 45{
45 int i; 46 int i;
46 unsigned char sector[512]; 47 unsigned char sector[512];
@@ -51,7 +52,7 @@ int disk_init(void)
51 if ( (sector[510] != 0x55) || 52 if ( (sector[510] != 0x55) ||
52 (sector[511] != 0xaa)) { 53 (sector[511] != 0xaa)) {
53 DEBUGF("Bad boot sector signature\n"); 54 DEBUGF("Bad boot sector signature\n");
54 return -1; 55 return NULL;
55 } 56 }
56 57
57 /* parse partitions */ 58 /* parse partitions */
@@ -70,5 +71,5 @@ int disk_init(void)
70 } 71 }
71 } 72 }
72 73
73 return 0; 74 return part;
74} 75}
diff --git a/firmware/common/disk.h b/firmware/common/disk.h
index 1e95c73c6b..8a78386c6c 100644
--- a/firmware/common/disk.h
+++ b/firmware/common/disk.h
@@ -25,8 +25,7 @@ struct partinfo {
25 unsigned char type; 25 unsigned char type;
26}; 26};
27 27
28extern struct partinfo part[8]; 28/* returns a pointer to an array of 8 partinfo structs */
29 29struct partinfo* disk_init(void);
30int disk_init(void);
31 30
32#endif 31#endif