|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Bannato
Iscritto dal: Jan 2003
Città:
Messaggi: 4423
|
[c] conversione codice IO
...avrei la necessità di gestire l'IO di una scheda madre...ho trovato uno stralcio di codice che dovrei convertire da turbo c 3.0 a c per linux...il codice è lunghetto ma basa il suo funzionamento su questi due metodi e un terzo metodo di sleep/delay...
Codice:
int SMBUS_Read_Byte(int offset,int DEVID)
{
int RetVal=0;
outportb(SMBus_Port,0x0fe);
outportb(SMBus_Port+0x04,DEVID+1);
outportb(SMBus_Port+0x03,offset+0);
outportb(SMBus_Port+0x02,0x48);
delay(200);
if(WaitReady(SMBus_Port))
{
RetVal = inp(SMBus_Port+0x05);
}
return RetVal;
}
Codice:
void SMBUS_Write_Byte(int Dev_id,int Reg_index,int Value)
{
outportb(SMBus_Port+0x04,Dev_id);
delay(5);
Chk_SMBUS_Ready();
outportb(SMBus_Port+0x03,Reg_index);
delay(5);
outportb(SMBus_Port+0x05,(Value & 0xFF));
delay(5);
outportb(SMBus_Port+0x02,0x48);
delay(25);
Chk_SMBUS_Ready();
}
Codice:
ioperm(0x2e, 0x2e, 1) |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 21:35.



















