amiga-bootcamp/12_networking/sana2.md
Ilia Sharin 21751c0025 docs(amiga): complete AmigaOS 3.1/3.2 developer reference — 172 files across 17 sections
Comprehensive technical documentation covering:
- Hardware: OCS/ECS/AGA custom chip registers, Copper & Blitter deep dives
- Boot sequence: cold boot through startup-sequence
- Binary format: HUNK executable spec, relocation, debug info
- Linking & ABI: .fd files, LVO tables, register calling conventions
- Exec kernel: tasks, interrupts, memory, signals, semaphores
- AmigaDOS: file I/O, FFS/OFS layout, CLI/Shell scripting
- Graphics: planar bitmaps, Copper programming, HAM/EHB modes
- Intuition: screens, windows, IDCMP, BOOPSI
- Devices: trackdisk, SCSI, serial, timer, audio, keyboard
- Libraries: utility, expansion, IFFParse, locale, ARexx
- Networking: bsdsocket API, SANA-II, TCP/IP stack comparison
- Toolchain: GCC, vasm/vlink, SAS/C, NDK, debugging
- Reverse engineering: IDA/Ghidra setup, compiler fingerprints, case studies
- CPU & MMU: 68040/060 emulation libs, PMMU, cache management
- Driver development: SANA-II, Picasso96/RTG, AHI audio

All files include breadcrumb navigation. No local paths or proprietary content.
2026-04-23 12:17:35 -04:00

78 lines
1.8 KiB
Markdown

[← Home](../README.md) · [Networking](README.md)
# SANA-II — Standard Amiga Network Architecture
## Overview
SANA-II is the standard device driver interface for network hardware on AmigaOS. It defines a uniform API that TCP/IP stacks use to communicate with any network card (Ethernet, WiFi, PPP, etc.).
---
## Architecture
```
Application
bsdsocket.library (TCP/IP stack)
SANA-II device driver (e.g., prism2.device, a2065.device)
Network hardware
```
---
## Opening a SANA-II Device
```c
struct IOSana2Req *s2req = (struct IOSana2Req *)
CreateIORequest(port, sizeof(struct IOSana2Req));
/* Provide buffer management hooks: */
static struct TagItem s2tags[] = {
{ S2_CopyToBuff, (ULONG)CopyToBuff },
{ S2_CopyFromBuff, (ULONG)CopyFromBuff },
{ TAG_DONE, 0 }
};
s2req->ios2_BufferManagement = s2tags;
OpenDevice("a2065.device", 0, (struct IORequest *)s2req, 0);
```
---
## Commands
| Code | Constant | Description |
|---|---|---|
| 2 | `CMD_READ` | Read a packet |
| 3 | `CMD_WRITE` | Send a packet |
| 9 | `S2_DEVICEQUERY` | Query hardware capabilities |
| 10 | `S2_GETSTATIONADDRESS` | Get MAC address |
| 11 | `S2_CONFIGINTERFACE` | Configure interface (set MAC) |
| 14 | `S2_ONLINE` | Bring interface online |
| 15 | `S2_OFFLINE` | Take interface offline |
| 21 | `S2_GETGLOBALSTATS` | Get packet statistics |
| 16 | `S2_ADDMULTICASTADDRESS` | Add multicast address |
| 17 | `S2_DELMULTICASTADDRESS` | Remove multicast address |
---
## Packet Reading
```c
s2req->ios2_Req.io_Command = CMD_READ;
s2req->ios2_WireError = 0;
s2req->ios2_PacketType = 0x0800; /* IPv4 */
SendIO((struct IORequest *)s2req);
/* wait for packet... */
WaitIO((struct IORequest *)s2req);
/* s2req->ios2_Data* contains the received packet */
```
---
## References
- SANA-II Network Device Driver Specification (Commodore)
- NDK39: `devices/sana2.h`