SGDK
A free and open development kit for the Sega Mega Drive
Loading...
Searching...
No Matches
ssf_ed_x7.h
1/************************************************************************
2 * \brief Simple SSF driver to Everdrive X7.
3 *
4 * \author Juan Antonio Ruiz (PaCHoN)
5 * \date 2024-2025
6 * \defgroup SSF SSF
7 * \brief
8 * USB IO
9 * 0xA130E2 [........ DDDDDDDD] read/write
10 * D data bits
11 *
12 * IO status
13 * 0xA130E4 [.C...... .....RWS] read only
14 * S SPI controller ready. Not used on WIFI.
15 * W USB fifo ready to write
16 * R USB fifo ready to read
17 * C SD card type. 0=SD, 1=SDHC. Not used on WIFI.
18*************************************** */
19#ifndef _SSF_ED_X7_H_
20#define _SSF_SSF_ED_X7_H_
21
22#include "types.h"
23
24//#define SSF_CTRL_P 0x8000 //register accesss protection bit. should be set, otherwise register will ignore any attempts to write
25//#define SSF_CTRL_X 0x4000 //32x mode
26//#define SSF_CTRL_W 0x2000 //ROM memory write protection
27//#define SSF_CTRL_L 0x1000 //led
28
29//#define USB_RD_BUSY while ((REG_STE & STE_USB_RD_RDY) == 0)
30//#define USB_WR_BUSY while ((REG_STE & STE_USB_WR_RDY) == 0)
31/**************************************** */
32
33
35#define X7_UART_BASE 0xA13000
36
38#define X7_UART_DATA (*((volatile u16*)(X7_UART_BASE + 226)))
39#define X7_UART_STE (*((volatile u16*)(X7_UART_BASE + 228)))
40#define X7_UART_REG_CFG (*((volatile u16*)(X7_UART_BASE + 230)))
41#define X7_UART_REG_SSF_CTRL (*((volatile u16*)(X7_UART_BASE + 240)))
42
43#define SSF_CTRL_P 0x8000 //register accesss protection bit. should be set, otherwise register will ignore any attempts to write
44#define SSF_CTRL_X 0x4000 //32x mode
45#define SSF_CTRL_W 0x2000 //ROM memory write protection
46#define SSF_CTRL_L 0x1000 //led
47
48#define X7_UART_SPR X7_UART_DATA
49
50#define X7_UART_STE_WR_RDY 2//usb write ready bit
51#define X7_UART_STE_RD_RDY 4//usb read ready bit
52
53//spi chip select signal
54#define CFG_SPI_SS 1
55#define CFG_SPI_QRD 6
56#define CFG_SPI_QWR 2
57
58#define MW_EDX7_BUFLEN 1436
59#define MW_EDX7_TXFIFO_LEN 1
60
61bool ssf_ed_x7_is_present(void);
62void ssf_ed_x7_write(u8 data);
63bool ssf_ed_x7_read_ready(void);
64bool ssf_ed_x7_write_ready(void);
65u8 ssf_ed_x7_read(void);
66
67/************************************************************************/
70void ssf_ed_x7_init(void);
71
72#endif /*_SSF_ED_X7_H_*/
73
Types definition.
unsigned char u8
Definition types.h:95