blob: d7f2b26f8406686ca111e2c88722f1e03f9a8645 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
diff --git a/src/mempak.c b/src/mempak.c
index 35e55e8..c5ffddb 100644
--- a/src/mempak.c
+++ b/src/mempak.c
@@ -116,6 +116,26 @@ int write_mempak_sector( int controller, int sector, uint8_t *sector_data )
}
/**
+ * @brief Calculate the checksum of a header
+ *
+ * @param[in] block
+ * A block at the start of a header
+ *
+ * @return The 16 bit checksum over the header
+ */
+ static uint16_t __get_header_checksum( uint16_t *block )
+ {
+ uint32_t sum = 0;
+
+ for ( int i = 0; i < 14; i++ )
+ {
+ sum += *(block++);
+ }
+
+ return sum & 0xFFFF;
+ }
+
+/**
* @brief Check a mempak header for validity
*
* @param[in] sector
@@ -154,26 +174,6 @@ static int __validate_header( uint8_t *sector )
}
/**
- * @brief Calculate the checksum of a header
- *
- * @param[in] block
- * A block at the start of a header
- *
- * @return The 16 bit checksum over the header
- */
-static uint16_t __get_header_checksum( uint16_t *block )
-{
- uint32_t sum = 0;
-
- for ( int i = 0; i < 14; i++ )
- {
- sum += *(block++);
- }
-
- return sum & 0xFFFF;
-}
-
-/**
* @brief Calculate the checksum over a TOC sector
*
* @param[in] sector
|