forked from gotaproblem/ST_HD_Emulator
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathemuscsi.c
59 lines (43 loc) · 1.13 KB
/
emuscsi.c
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
59
/*
* ATARI ST HDC Emulator
*
* File: emuscsi.c
* Author: Steve Bradford
* Created: September 2022
*
* SCSI commands
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pico/stdlib.h>
#include "emuscsi.h"
#include "emu.h"
void modeSense0 ( char *buf, DRIVES *pdrv, int lun )
{
uint32_t blocks = pdrv->pSD->sectors - 1; //pdrv->luns [0].sectorCount;
memset ( buf, 0, 16 );
// Values got from the Hatari emulator
buf [1] = 14;
buf [3] = 8;
// Send the number of blocks of the SD card
buf [5] = (blocks >> 16) & 0xff;
buf [6] = (blocks >> 8) & 0xff;
buf [7] = (blocks) & 0xff;
// Sector size middle byte
buf [10] = 2;
}
void modeSense4 ( char *buf, DRIVES *pdrv, int lun )
{
uint32_t blocks = pdrv->pSD->sectors - 1; //pdrv->luns [0].sectorCount;
memset ( buf, 0, 16 );
// Values got from the Hatari emulator
buf [0] = 4;
buf [1] = 22;
// Send the number of blocks in CHS format
buf [2] = (blocks >> 23) & 0xff;
buf [3] = (blocks >> 15) & 0xff;
buf [4] = (blocks >> 7) & 0xff;
// Hardcode 128 heads
buf [5] = 128;
}