pit.h (1973B)
1 #ifndef PC_PIT_PIT_H 2 #define PC_PIT_PIT_H 3 4 #define LIGNE_IRQ_PIT 0 5 #define PORT_PIT_CANAUX 0x40 6 #define PORT_PIT_CANAL_0 PORT_PIT_CANAUX + 0 7 #define PORT_PIT_CANAL_1 PORT_PIT_CANAUX + 1 8 #define PORT_PIT_CANAL_2 PORT_PIT_CANAUX + 2 9 #define PORT_PIT_COMMANDE 0x43 10 11 #define FREQUENCE_PIT_MILI_HZ 1193181667 12 13 typedef enum { 14 PIT_CANAL_0 = 0, 15 PIT_CANAL_1 = 1, 16 PIT_CANAL_2 = 2, 17 PIT_COMMANDE_LECTURE = 3, 18 } PitCanal; 19 20 typedef enum { 21 PIT_COMMANDE_VERROU = 0, 22 PIT_OCTET_BAS = 1, 23 PIT_OCTET_HAUT = 2, 24 PIT_OCTETS_HAUT_BAS = 3, 25 } PitModeAcces; 26 27 typedef enum { 28 /* Mauvaises traductions... */ 29 PIT_MODE_INTERRUPTION_FIN_COMPTEUR = 0, 30 PIT_MODE_UN_COUP_RE_ACTIVABLE = 1, 31 PIT_MODE_GENERATEUR_FREQUENCE = 2, 32 PIT_MODE_GENERATEUR_ONDE_CARREE = 3, 33 PIT_MODE_SIGNAL_A_DECLENCHEMENT_LOGICIEL = 4, 34 PIT_MODE_SIGNAL_A_DECLENCHEMENT_MATERIEL = 5, 35 } PitModeCanal; 36 37 typedef struct PitCommandeMode { 38 bool bcd:1; 39 PitModeCanal mode:3; 40 PitModeAcces acces:2; 41 PitCanal canal:2; 42 } PACKED PitCommandeMode; 43 44 typedef struct PitCommandeVerrou { 45 PitCanal canal:2; 46 uint8 zero:6; 47 } PitCommandeVerrou; 48 49 typedef struct PitCommandeLecture { 50 uint8 un:2; 51 bool nePasVerouillerCompteur:1; 52 bool nePasVerouillerEtat:1; 53 bool lectureCanal0:1; 54 bool lectureCanal1:1; 55 bool lectureCanal2:1; 56 uint8 zero:1; 57 } PitCommandeLecture; 58 59 typedef struct PitEtatCanal { 60 bool bcd:1; 61 PitModeCanal mode:3; 62 PitModeAcces acces:2; 63 bool attenteCopieRechargeCompteur:1; 64 bool etatSortie:1; 65 } PitEtatCanal; 66 67 typedef void (*GestionnairePit) (); 68 69 typedef struct EtatPit { 70 PitModeCanal modeCanal0; 71 PitModeCanal modeCanal1; 72 PitModeCanal modeCanal2; 73 PitModeAcces modeAcces; 74 75 GestionnairePit gestionnairePit; 76 } EtatPit; 77 78 uint32 definirFrequenceCanal(uint32 freq, PitCanal canal); 79 uint32 definirDelaiCanal(uint32 delai, PitCanal canal); 80 void definirCompteurCanal(uint16 compteur, PitCanal canal); 81 void definirModeCanal(PitModeCanal mode, PitCanal canal); 82 void definirGestionnairePit(GestionnairePit gestionnairePit); 83 84 #endif