Skip to content

Commit 2d31c04

Browse files
committed
AT32F435: Fix QuickDisk window calculation.
The relationship between STK and SAMPLECLK must be included as a factor.
1 parent 19042f2 commit 2d31c04

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/image/qd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ static void qd_seek_track(struct image *im, uint16_t track)
6161
im->qd.trk_len = le32toh(thdr.len);
6262

6363
/* Read/write window limits in STK ticks from data start. */
64-
im->qd.win_start = le32toh(thdr.win_start) * im->write_bc_ticks;
65-
im->qd.win_end = le32toh(thdr.win_end) * im->write_bc_ticks;
64+
im->qd.win_start = (le32toh(thdr.win_start) * im->write_bc_ticks
65+
* ((8 * STK_MHZ) / SAMPLECLK_MHZ));
66+
im->qd.win_end = (le32toh(thdr.win_end) * im->write_bc_ticks
67+
* ((8 * STK_MHZ) / SAMPLECLK_MHZ));
6668

6769
im->tracklen_bc = im->qd.trk_len * 8;
6870
im->stk_per_rev = stk_sampleclk(im->tracklen_bc * im->write_bc_ticks);

0 commit comments

Comments
 (0)