• Stars
    star
    165
  • Rank 228,906 (Top 5 %)
  • Language
    C
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Linux kernel driver for PATA bit-banging over GPIOs

pata-gpio

Adapter PCB dmesg Output

Overview

DISCLAIMER: This driver was developed for fun and learning ATA internals. If you're looking for a practical way to use PATA devices, look for commercial USB adapters.

pata-gpio is a Linux kernel driver for GPIO bitbanged PATA (also known as ATA/ATAPI or IDE).
Pin configuration can be set via device tree, the regular ATA framework is used.

IDE Primary/Secondary device support is implemented.

Performance

On a Raspberry Pi 4 (with direct GPIO) about 800 KiB/s reading, 500 KiB/s writing speed is possible. Most of the performance bottleneck is down to the usage of libgpiod (kernel gpio abstraction), which is optimized for tasks like switching LEDs. Data transmission is well outside the design scope of libgpiod.

DMA and interrupts are not implemented at the moment.

Device tree configuration

Pin configuration can be specified in the device tree.
An example device tree is provided as atapi-direct.dts.
This includes the pin configuration for the schematic linked at the bottom of this readme.

The following device tree properties are present:

Property Usage Required
databus-gpios list of 16 GPIO pins, connected to ATA D0 - D15 in this order yes
cs-gpios list of 2 GPIO pins, connected to ATA CS0 and CS1 in this order yes
address-gpios list of 3 GPIO pins, connected to ATA DA0, DA1 and DA2 in this order yes
strobe-write-gpio GPIO pin, connected to ATA IOW line yes
strobe-read-gpio GPIO pin, connected to ATA IOR line yes
reset-gpio GPIO pin, connected to ATA RESET line no

Interrupts

The driver has experimental interrupt support. An example configuration with GPIO interrupts is outlined in atapi-direct-irq.dts.
Interrupts are configured via the generic interrupts property. If the interrupts property is not specified the driver falls back to polling.

Compiling

Before loading (and running) the kernel module, make sure to load the device tree overlay.
This can be done via the config.txt (on a Raspberry Pi): dtoverlay=atapi-direct, or by running ./loaddt.sh.
The latter script will also compile and save the device tree to /boot/overlays/atapi-direct.dtbo.

This module needs kernel headers, regular build dependencies and a kernel with the config option CONFIG_ATA_SFF=y set.
The ATA_SFF option is not the default on Raspberry Pis, so you will need to build a custom kernel.

Compile the module using:
make

Load the module using:
insmod pata-gpio.ko

A helper script called ./run.sh is provided, which will remove any loaded pata-gpio module, compile it and load the resulting module.
Further status information can be shown by running dmesg.

Additional info

Adapter PCB
Adapter schematic

Older schematic (not SMI-ready)
Video: Audio CD streaming
Twitter: Project presentation

Credits

Thanks to @Toble_Miner for a lot of help in the development of this driver!

More Repositories

1

fxIP

TCP/IP for Casio fx-9860 graphical calculators (with SLIP support, uIP stack)
C
221
star
2

FMBerry

Build an open source fm radio station with your raspberry pi
C
143
star
3

nvme-int13h-optionrom

Option ROM to boot x86 PCs from NVMe drives (legacy BIOS, INT 13h)
C
122
star
4

ISA8019

RTL8019-based ISA network card, NE2000-compatible
HTML
107
star
5

ISASTM

STM32-based ISA-over-USB-adapter
HTML
107
star
6

sdrsharp-plutosdr

ADALM-PLUTO frontend for SDRSharp
C#
102
star
7

rock_lobster

Linux kernel module for providing /proc/lobster
C
31
star
8

headsetcontrol-notificationd

Logitech G933 battery notification daemon for Linux
PHP
29
star
9

Gigaset-Debug-Adapter

OpenSCAD
28
star
10

ESP32_VirtualPrinter

ESP32 emulator for LPT/parallel port printers
C++
25
star
11

ISASTM-Firmware

C
24
star
12

PHPPLD

Use EEPROMs as programmable logic with PHP
PHP
22
star
13

AnotterKiosk

Just an-otter kiosk OS for Raspberry Pis and x86 PCs
Shell
21
star
14

ESP8266-HTTP

semi-HTTP-compliant lua libary to download files and send GET requests
Lua
20
star
15

ISAMega

ISA-bus implementation for Arduino Mega 2560 / AVR processors
C++
19
star
16

ATAPIMega-Firmware

Firmware for standalone (P)ATA/ATAPI CD Player
C++
14
star
17

RC2014-Ethernet

RTL8019 Ethernet card for the RC2014 Z80 computer
13
star
18

plutosdr-readsb-fr24feed

PlutoSDR standalone ADS-B decoder and FR24 feeder (using readsb)
Shell
13
star
19

PC104-ISA-Card

Adapter for mounting a PC104 module onto an ISA card (for use with a 16bit backplane)
12
star
20

ATAPIHat-SMI

High-speed ATAPIHat for BCM2835 Secondary Memory Interface
HTML
11
star
21

ATAPIMega

Standalone (P)ATA/ATAPI CD Player
HTML
10
star
22

SolarCamPi

solar-powered WiFi webcam
HTML
9
star
23

CMM2-JLC

Colour Maximite 2 - unofficial PCB design for automated assembly
HTML
8
star
24

RC2014-Ethernet-Firmware

Z80 software for RTL8019-based Ethernet adapter
C
8
star
25

cloudlog-rigctl-interface

Connects Cloudlog to rigctld / hamlib via PHP
PHP
8
star
26

FMBerryRDSMPD

Allows you to stream MPD song information via FM radio
JavaScript
8
star
27

ISAMega-x86Emuator

libx86emu-based emulator to run ISA VGA bioses
C
8
star
28

ESP32-IrDA-MCP2120

ESP32-based IrDA adapter (emulating MCP2120 protocol)
C++
6
star
29

PAL-GAL-CI

Continuous integration build scripts for Atmel/Microchip GAL/PAL (like 22V10, 16V8, etc.)
6
star
30

Gigaset-Ringtone-Converter

Gigaset propritary ringtone format (L22 / 722) encoder/decoder, written in PHP
PHP
6
star
31

unifirespondd

UniFi respondd bridge using SNMP
PHP
5
star
32

switchconf

YAML-based ethernet switch automation tool for consumer/home-use (TP-Link TL-SG105, etc.)
Python
5
star
33

RC2014-MIDISynth

MIDI synthesizer for the RC2014, using YM2149/AY-3-8910
C
5
star
34

NeonMatrix

neon bulb matrix, very dangerous, pretty deadly!
5
star
35

LipoSolder

AVR-based PID-regulated soldering station
Arduino
4
star
36

RC2014-CFBootloader

RC2014/Z80 CF card bootloader (and small OS)
C
4
star
37

gigaset-c430-modding

Firmware hacking on the Gigaset C430 DECT phones (custom ringtones, etc.)
Shell
4
star
38

Vortex-X-ISA-Card

Adapter for mounting a Vortex86DX module onto an ISA card (for use with a 16bit backplane)
3
star
39

slirpNG

fixed version of slirp (PPP/SLIP) emulator for compiling on newer *nix versions
C
3
star
40

internetconnectionwizard-server

Server for vintage Windows Internet Connection Wizard auto dial-up ISP discovery
PHP
3
star
41

Thinkpad820

Linux on ThinkPad PowerSeries 820/850
C
3
star
42

ATAPIHat

[experimental, very slow] ATA/ATAPI hat for Raspberry Pi
3
star
43

dn42info

bird peering status page written in PHP -- Initial idea and design by @Sammy8806
PHP
3
star
44

AVRAMTransmitter

Allows you to transmit great music via AM band just with an arduino and some stuff vom RadioShack!
Arduino
3
star
45

ATXflip

soft-powerswitching for ATX power supplies
Makefile
2
star
46

IrDA_RS232

IrDA to RS232, using MCP2155, can be embedded into Modems, ISDN TAs, printers, etc.
2
star
47

freifunkClients

Munin plugin for monitoring wifi clients in Freifunk networks
2
star
48

nRFPowerMonitor

Control a MingHe VAC-1030A wireless power monitor with a Raspberry Pi
PHP
2
star
49

ImagePost

Java
2
star
50

NeonMatrix-Firmware

firmware for 74HC595 neon bulb indicator matrix
C++
2
star
51

sq-1000-terminal

AVR firmware to convert an old typewriter to a teletype
C++
2
star
52

Z80-CF-Driver

RC2014/Z80 CF card implementation in C / z88dk
C
2
star
53

HB-Sen-Env-I-Firmware

Firmware for HB-Sen-Env temperature, humidity and pressure sensor
C++
1
star
54

pulso-r500-membrane

OpenSCAD model of the membrane for a Pulso R500 pulse jet
OpenSCAD
1
star
55

typo3-4.5-mysqli-adapter

experimental mysqli_* database adapter for Typo3. YMMV!
PHP
1
star
56

RC2014-MX29F001

MX29F001B 128KiB Flash board, compatible with RC2014
1
star
57

warehouseTurtles

Fully automated ComputerCraft-turtle warehouse with sorting, indexing and a graphic terminal
1
star
58

ras

open source ISDN/synchronous network access server (similar to PortMaster, etc.)
C
1
star
59

pdfsandwich-txt-output

Hacked version of pdfsandwich with additional txt-file-output
OCaml
1
star
60

RC2014-CFHexLoader

RC2014/Z80 Intel .hex to CF card uploader with FAT16/32 support
C
1
star
61

FreifunkFlasher

Windows utility for flashing Ubiquiti AC-wifi devices with Freifunk firmware
1
star
62

CCPDATaxi

ComputerCraft - ImmibisAMI -- PDA-based Waypoint teleport
Lua
1
star
63

NE2PI-Node

Analogue cable/terrestrial TV headend, based on a Raspberry Pi cluster (node firmware)
Shell
1
star
64

RTTTLGrubInitTunes

run play.sh.
C
1
star
65

odroid-go-a2dp-bt-speaker

Odroid Go - A2DP Bluetooth speaker
C
1
star
66

RC2014-LPT

1
star
67

dhltrack_cs

C# (windows) version of dhltrack
C#
1
star
68

hm-i2c-dimmer

STM32-based I2C PWM LED dimming controller
Makefile
1
star
69

SMAPHPConnect

fetches data from SMA solar inverters via ModBus
PHP
1
star