diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 07a5370..67c8b98 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -32,3 +32,9 @@ - [Multitâche](x86_64/premiers-pas/06-multitache.md) - [Tache utilisateur](x86_64/premiers-pas/06-tache-utilisateur.md) - [Epilogue](x86_64/premiers-pas/06-epilogue.md) +- [périphériques]() + - [cartes réseaux]() + - [e1000](périphériques/cartes-réseaux/E1000.md) + - [RTL8139](périphériques/cartes-réseaux/RTL8139.md) + - [communication série]() + - [UART8250](périphériques/communication-serie/UART8250.md) diff --git "a/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/E1000.md" "b/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/E1000.md" new file mode 100644 index 0000000..e95cd63 --- /dev/null +++ "b/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/E1000.md" @@ -0,0 +1,7 @@ +# E1000 + +# Références + +- [Intel i217 datasheet](https://www.mouser.com/datasheet/2/612/i217-ethernet-controller-datasheet-257741.pdf) +- [Intel 82540EM datasheet](https://www.intel.com/content/dam/doc/manual/pci-pci-x-family-gbe-controllers-software-dev-manual.pdf) + diff --git "a/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/RTL8139.md" "b/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/RTL8139.md" new file mode 100644 index 0000000..617ef79 --- /dev/null +++ "b/src/p\303\251riph\303\251riques/cartes-r\303\251seaux/RTL8139.md" @@ -0,0 +1,5 @@ +# RTL8139 + +# Référence + +- [RTL8139D Datasheet](http://realtek.info/pdf/rtl8139d.pdf) \ No newline at end of file diff --git "a/src/p\303\251riph\303\251riques/communication-serie/UART8250.md" "b/src/p\303\251riph\303\251riques/communication-serie/UART8250.md" new file mode 100644 index 0000000..4b555c6 --- /dev/null +++ "b/src/p\303\251riph\303\251riques/communication-serie/UART8250.md" @@ -0,0 +1,112 @@ +# UART8250 / UART16550 + +
+ +[![NS 8250B](https://upload.wikimedia.org/wikipedia/commons/c/ce/UART_chip_NS_8250B.jpg)](https://commons.wikimedia.org/wiki/File:UART_chip_NS_8250B.jpg) + +
+ +## Les registres + +| Offset | Nom | Ecriture | Lecture | +| -----------------|-----------------------------------------|-----------|---------| +| 0x0 (DLAB == 0) | Transmit Holding Register (THR) | ✔️ | ❌ | +| 0x0 (DLAB == 0) | Receive Buffer Register (RBR) | ❌ | ✔️ | +| 0x1 (DLAB == 0) | Interrupt Enable Register (IER) | ✔️ | ✔️ | +| 0x2 (⚠️UART16550 seulement) | FIFO Control Register (FCR) | ✔️ | ❌ | +| 0x2 | Interrupt Identification Register (IIR) | ❌ | ✔️ | +| 0x3 | Line Control Register (LCR) | ✔️ | ✔️ | +| 0x4 | Modem Control Register (MCR) | ✔️ | ✔️ | +| 0x5 | Line Status Register (LSR) | ✔️ | ✔️ | +| 0x6 | Modem Status Register (MSR) | ✔️ | ✔️ | +| 0x7 | Scratch Register (SCR) | ✔️ | ✔️ | +| 0x0 (DLAB == 1) | Divisor Latch LSB (DLL) | ✔️ | ✔️ | +| 0x1 (DLAB == 1) | Divisor Latch MSB (DLH) | ✔️ | ✔️ | + +### Transmit Holding Register (THR) + +Tout ce qui sera ecrit sur ce registre sera transmis par l'UART. + +### Receive Buffer Register (RBR) + +Tout ce qui est reçu par l'UART sur la laison série sera accessible sur ce registre. + +### Interrupt Enable Register (IER) + +| 7-4 | 3 | 2 | 1 | 0 | +|---------|--------------|----------------------|-----------|-------------------------| +| reservé | MODEM Status | Receiver Line Status | THR Empty | Received Data Available | + +- **__Received Data Available__**: Si le bit est à 1 alors une interruption sera généré à la réception d'un charactère. +- **__THR Empty__**: si le bit est à 1 alors une interruption sera généré quand il sera possible d'écrire à nouveau dans le registre **THR** + +### Interrupt Identification Register (IIR) + +| 7-3 | 2-1 | 0 | +|---------|--------------|-------------------| +| reservé | Interrupt ID | Interrupt pending | + +### Line Control Register (LCR) + +| 7 | 6 | 5 | 4 | 3 | 2 | 1-0 | +|------|-----------|--------------|--------------------|---------------|-----------|-----------------| +| DLAB | Set Break | Stick parity | Even Parity Select | Parity enable | Stop Bits | Word length | + +### Modem Control Register (MCR) + +### Line Status Register (LSR) + +### Modem Status Register (MSR) + +### Scratch Register (SCR) + +### Divisor Latch LSB (DLL) & Divisor Latch MSB (DLH) + +| Baud Rate | 1.8432Mhz | 3.072 MHz | 8.0 MHz | +|-----------|-----------|-----------|---------| +| 50 | 2304 | 3840 | 10000 | +| 75 | 1536 | 2560 | 6667 | +| 110 | 1047 | 1745 | 4545 | +| 134.5 | 857 | 1428 | 3717 | +| 150 | 768 | 1280 | 3333 | +| 300 | 384 | 640 | 1667 | +| 600 | 192 | 320 | 833 | +| 1200 | 96 | 160 | 417 | +| 1800 | 64 | 107 | 277 | +| 2000 | 58 | 96 | 250 | +| 2400 | 48 | 80 | 208 | +| 3600 | 32 | 53 | 139 | +| 4800 | 24 | 40 | 104 | +| 7200 | 16 | 27 | 69 | +| 9600 | 12 | 20 | 52 | +| 19200 | 6 | 10 | 26 | +| 38400 | 3 | 5 | 13 | +| 56000 | 2 | - | 9 | +| 128000 | - | - | 4 | + +Pour l'IBM PC la clock est de 1.8432Mhz + +## Exemple (en pseudo C) + +Partons du principe que nous avont `uart8250_write` permetant d'ecrire une valeur dans un registre et `uart8250_read` permetant de lire la valeur d'un registre. + +### Initialisation de l'UART + +```c + /* on desactive les interuptions en metant IER à zero */ + uart8250_write(IER, 0x0); + + /* DLAB à 1 */ + uart8250_write(LCR, (1 << 7)); + + /* 9600 baud donc un diviseur de 12 (voir le tableau) */ + uart8250_write(DLH, 0x0); + uart8250_write(DLL, 0xC); + + /* TODO */ +``` + +## Références + +- [8250A UART datasheet](https://web.archive.org/web/20160503070506/http://archive.pcjs.org/pubs/pc/datasheets/8250A-UART.pdf) +- [PC16550D UART datasheet](https://web.archive.org/web/20180826215135/http://www.ti.com/lit/ds/symlink/pc16550d.pdf) \ No newline at end of file