Skip to content

Commit

Permalink
AT32F435: Fix QuickDisk window calculation.
Browse files Browse the repository at this point in the history
The relationship between STK and SAMPLECLK must be included as a factor.
  • Loading branch information
keirf committed Aug 2, 2022
1 parent 19042f2 commit 2d31c04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/image/qd.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ static void qd_seek_track(struct image *im, uint16_t track)
im->qd.trk_len = le32toh(thdr.len);

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

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

0 comments on commit 2d31c04

Please sign in to comment.