Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/x86_64/périphériques/RTC.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,27 @@ Elle peut être utilisée pour avoir la date et heure précise. (voir ACPI pour
# Lire le temps
Il est possible de lire depuis la RTC en utilisant les fonctions suivantes:
```c

enum
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the documentation, put a markdown table instead of a C code enum, it's better for reading

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and add other register, like STATUS_REGISTER_B, week, day, hour, ... in the table (maybe ?)

CMOS_ADDRESS = 0x70,
CMOS_DATA = 0x71,
STATUS_REGISTER_A = 0x0A
};

/* Vérifier si la RTC est en train de se mettre à jour */
int rtc_is_updating()
{
outb(0x70, 0x0A);
return inb(0x71) & 0x80;
outb(CMOS_ADDRESS, STATUS_REGISTER_A);
return inb(CMOS_DATA) & 0x80;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a signification of the last bit ?

}

unsigned char rtc_read(int reg)
{
while (rtc_is_updating()); /* Attendre que l'update finisse */
outb(0x70, reg);
outb(CMOS_ADDRESS, reg);

return inb(0x71);
return inb(CMOS_DATA);
}
```
Voici la table des éléments à lire depuis la RTC et leur registre CMOS
Expand Down