DMPAPI(void) i2c_ClearResetPin(void) { // clear the Reset pin on I2C connector of RB-110 & RB-050 to 0 io_outpb(GPIO2_DIR, io_inpb(GPIO2_DIR) | 0x80); io_outpb(GPIO2_DATA, io_inpb(GPIO2_DATA) & 0x7f); }
DMPAPI(void) i2cmaster_WriteAddrREG(int dev, unsigned char addr, unsigned char rwbit) { io_outpb(I2C_ADDR_REG(dev), (addr << 1) + rwbit); }
DMPAPI(void) i2cslave_EnableNAK(int dev) { io_outpb(I2C_CTRL_REG(dev), io_inpb(I2C_CTRL_REG(dev)) | 0x01); }
DMPAPI(void) i2c_WriteDataREG(int dev, unsigned char val) { io_outpb(I2C_DATA_REG(dev), val); }
DMPAPI(void) i2cmaster_ClearARLoss(int dev) { io_outpb(I2C_STAT_REG(dev), 0x08); }
DMPAPI(void) i2c_DisableINT(int dev, unsigned char i2cints) { io_outpb(I2C_CTRL_REG(dev), io_inpb(I2C_CTRL_REG(dev)) & (~i2cints)); }
DMPAPI(void) i2c_ClearTXDone(int dev) { io_outpb(I2C_STAT_REG(dev), 0x20); }
static void RX_LED_OFF(void) { io_outpb(rx_led_data, io_inpb(rx_led_data) | (1 << rx_led_pin)); }
static int USB_ISR(int irq, void* data) { DWORD isr; USB_Device *usb; usb = (USB_Device *)data; if ((isr = io_inpdw(usb->ISR)) != 0x00L) { // Bus reset interrupt if (isr & IBRST) { io_outpdw(usb->ISR, IALL); usb_Reset(usb); } // SOF interrupt if (isr & ISOF) { io_outpdw(usb->ISR, ISOF); if (usb->ReadySetAddr == true) { io_outpb(usb->DAR, usb->DevAddr | 0x80); usb->ReadySetAddr = false; } #ifdef DMP_86DUINO_MODE if(tx_led_count && !(--tx_led_count)) TX_LED_OFF(); if(rx_led_count && !(--rx_led_count)) RX_LED_OFF(); #endif } // Suspend interrupt if (isr & ISUSP) { io_outpdw(usb->ISR, ISUSP); usb->IsSet = 0; usb->state = USB_DEV_POWERED; #ifdef DMP_86DUINO_MODE TX_LED_OFF(); RX_LED_OFF(); #endif } // Resume interrupt if (isr & IRESM) { io_outpdw(usb->ISR, IRESM); } // System error interrupt if (isr & SYSERR) { io_outpdw(usb->ISR, SYSERR); } // EP0 Setup interrupt if (isr & IEP0SETUP) { io_outpdw(usb->ISR, IEP0SETUP); EP0_SetupHandler(usb); } // EP0 RX interrupt if (isr & IEP0RX) { io_outpdw(usb->ISR, IEP0RX); EP0_OutHandler(usb); } // EP0 TX interrupt if (isr & IEP0TX) { io_outpdw(usb->ISR, IEP0TX); EP0_InHandler(usb); } // EP1 RX interrupt if (isr & IEP1RX) { io_outpdw(usb->ISR, IEP1RX); } // EP1 TX interrupt if (isr & IEP1TX) { io_outpdw(usb->ISR, IEP1TX); EP1_InHandler(usb); } // EP2 RX interrupt if (isr & IEP2RX) { io_outpdw(usb->ISR, IEP2RX); EP2_OutHandler(usb); } // EP2 TX interrupt if (isr & IEP2TX) { io_outpdw(usb->ISR, IEP2TX); usb->bulk_in_transmitting = false; EP2_InHandler(usb); } // EP3 RX interrupt if (isr & IEP3RX) { io_outpdw(usb->ISR, IEP3RX); } // EP3 TX interrupt if (isr & IEP3TX) { io_outpdw(usb->ISR, IEP3TX); } #ifdef DMP_86DUINO_MODE // the below behavier is only for compatible of Arduino Leonado (windows) if(usb->ling_coding.dwDTERate == 1200 && (usb->control_line_state & 0x01) == 0) { io_outpb(usb_on_off_data, io_inpb(usb_on_off_data) | (1 << usb_on_off_pin)); io_outpb(0xf21A, 0x5a); // write soft reset key io_outpb(0x64, 0xfe); // reboot } #endif } else return ISR_NONE; return ISR_HANDLED; }
static void RX_LED_ON(void) { io_outpb(rx_led_data, io_inpb(rx_led_data) & ~(1 << rx_led_pin)); rx_led_count = LED_MAX_COUNT; }
static void TX_LED_OFF(void) { io_outpb(tx_led_data, io_inpb(tx_led_data) | (1 << tx_led_pin)); }
static void TX_LED_ON(void) { io_outpb(tx_led_data, io_inpb(tx_led_data) & ~(1 << tx_led_pin)); tx_led_count = LED_MAX_COUNT; }
static void USB_Disconnect(void) { io_outpb(usb_on_off_data, io_inpb(usb_on_off_data) | (1 << usb_on_off_pin)); }
DMPAPI(bool) usb_Init(void *vusb) { #if defined DMP_DOS_DJGPP static bool locked = false; int size_temp; #endif USB_Device *usb = (USB_Device *)vusb; if (usb->InUse == 1) return true; // if (USB_IsAttached() == false) return false; USB_Connect(); if (irq_Init() == false) { err_print((char*)"%s: IRQ init fail.\n", __FUNCTION__); io_Close(); return false; } #if defined DMP_DOS_DJGPP if (locked == false) { int i, str_size; DPMI_LOCK_FUNC(SetEPnDLR); DPMI_LOCK_FUNC(Set_Address); DPMI_LOCK_FUNC(Get_Descriptor); DPMI_LOCK_FUNC(Set_Descriptor); DPMI_LOCK_FUNC(Get_Configuration); DPMI_LOCK_FUNC(Set_Configuration); DPMI_LOCK_FUNC(Get_Interface); DPMI_LOCK_FUNC(Set_Interface); DPMI_LOCK_FUNC(Synch_Frame); DPMI_LOCK_FUNC(USB_Standard_Request); DPMI_LOCK_FUNC(Set_Line_Coding); DPMI_LOCK_FUNC(Get_Line_Coding); DPMI_LOCK_FUNC(Set_Control_Line_State); DPMI_LOCK_FUNC(Send_Break); DPMI_LOCK_FUNC(USB_CDC_Request); DPMI_LOCK_FUNC(EP0_SetupHandler); DPMI_LOCK_FUNC(EP0_InHandler); DPMI_LOCK_FUNC(EP0_OutHandler); DPMI_LOCK_FUNC(EP1_InHandler); DPMI_LOCK_FUNC(EP2_InHandler); DPMI_LOCK_FUNC(EP2_OutHandler); DPMI_LOCK_FUNC(usb_Reset); DPMI_LOCK_FUNC(USB_ISR); DPMI_LOCK_VAR(desc_Device); DPMI_LOCK_VAR(desc_Config_Set); DPMI_LOCK_VAR(StringDescTable[0]); DPMI_LOCK_VAR(StringDescTable[1]); DPMI_LOCK_VAR(StringDescTable[2]); DPMI_LOCK_VAR(StringDescTable[3]); DPMI_LOCK_VAR(StringDescTable[4]); DPMI_LOCK_VAR(StringDescTable[5]); DPMI_LOCK_VAR(StringDescTable[6]); locked = true; } #endif io_outpb(usb->CFR, 0x02); // Soft reset while (io_inpb(usb->CFR) & 0x02); if ((usb->EP[0].SetupBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP0_MAX_PACKET_SIZE)) == NULL) goto EP0_SETUP_FAIL; if ((usb->EP[0].InBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP0_MAX_PACKET_SIZE)) == NULL) goto EP0_IN_FAIL; if ((usb->EP[0].OutBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP0_MAX_PACKET_SIZE)) == NULL) goto EP0_OUT_FAIL; if ((usb->EP[1].InBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP1_MAX_PACKET_SIZE_IN)) == NULL) goto EP1_IN_FAIL; if ((usb->EP[2].InBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP2_MAX_PACKET_SIZE_IN)) == NULL) goto EP2_IN_FAIL; if ((usb->EP[2].OutBuf = (BYTE *)ker_Malloc(sizeof(BYTE)*EP2_MAX_PACKET_SIZE_OUT)) == NULL) goto EP2_OUT_FAIL; #if defined DMP_DOS_DJGPP if ((dma_handle = dma_Alloc(EP0_MAX_PACKET_SIZE + EP0_MAX_PACKET_SIZE + EP0_MAX_PACKET_SIZE + EP1_MAX_PACKET_SIZE_IN + EP2_MAX_PACKET_SIZE_IN + EP2_MAX_PACKET_SIZE_OUT, &dma_addr)) == DMA_FAIL) goto EP2_OUT_FAIL; size_temp = 0; usb->EP[0].SetupPhysical = dma_addr; usb->EP[0].InPhysical = dma_addr + (size_temp += EP0_MAX_PACKET_SIZE); usb->EP[0].OutPhysical = dma_addr + (size_temp += EP0_MAX_PACKET_SIZE); usb->EP[1].InPhysical = dma_addr + (size_temp += EP0_MAX_PACKET_SIZE); usb->EP[2].InPhysical = dma_addr + (size_temp += EP1_MAX_PACKET_SIZE_IN); usb->EP[2].OutPhysical = dma_addr + (size_temp += EP2_MAX_PACKET_SIZE_IN); #else usb->EP[0].SetupPhysical = GrabPhysicalMEM((void *)usb->EP[0].SetupBuf); usb->EP[0].InPhysical = GrabPhysicalMEM((void *)usb->EP[0].InBuf); usb->EP[0].OutPhysical = GrabPhysicalMEM((void *)usb->EP[0].OutBuf); usb->EP[1].InPhysical = GrabPhysicalMEM((void *)usb->EP[1].InBuf); usb->EP[2].InPhysical = GrabPhysicalMEM((void *)usb->EP[2].InBuf); usb->EP[2].OutPhysical = GrabPhysicalMEM((void *)usb->EP[2].OutBuf); #endif // usb->DevAddr = 0x00; // usb->ReadySetAddr = false; // io_outpb(usb->DAR, 0x00); // enable USB device io_outpdw(usb->EP[0].SetupDSR, usb->EP[0].SetupPhysical); io_outpdw(usb->EP[0].InDSR , usb->EP[0].InPhysical); io_outpdw(usb->EP[0].OutDSR , usb->EP[0].OutPhysical); io_outpdw(usb->EP[1].InDSR , usb->EP[1].InPhysical); io_outpdw(usb->EP[2].InDSR , usb->EP[2].InPhysical); io_outpdw(usb->EP[2].OutDSR , usb->EP[2].OutPhysical); io_outpw(usb->EP[0].CtrlTR , 0x2000 | EP0_MAX_PACKET_SIZE); io_outpw(usb->EP[1].InTR , 0x3800 | EP1_MAX_PACKET_SIZE_IN); io_outpw(usb->EP[2].InTR , 0x3000 | EP2_MAX_PACKET_SIZE_IN); io_outpw(usb->EP[2].OutTR , 0x3000 | EP2_MAX_PACKET_SIZE_OUT); SetEPnDLR(usb, EP0, SETUP, ENABLE); // io_outpb(usb->DAR, 0x80); // enable USB device // while (!(io_inpb(usb->DAR) & 0x80)); // ClearQueue(usb->rcvd); // ClearQueue(usb->xmit); // io_DisableINT(); // { // io_outpb(usb->CFR, io_inpb(usb->CFR) & 0xFE); // io_outpdw(usb->IER, ISOF + IBRST + ISUSP + IRESM + SYSERR + // IEP0SETUP + IEP0RX + IEP0TX + IEP1TX + IEP2RX + IEP2TX); // io_outpb(usb->CFR, io_inpb(usb->CFR) | 0x01); // } // io_RestoreINT(); // usb->state = USB_DEV_DEFAULT; io_outpb(usb->DAR, 0x80); // enable USB device while (!(io_inpb(usb->DAR) & 0x80)); io_outpdw(usb->ISR, 0xFFFFFFFFL); io_DisableINT(); { io_outpb(usb->CFR, io_inpb(usb->CFR) & 0xFE); irq_Setting(usb->nIRQ, IRQ_LEVEL_TRIGGER); irq_InstallISR(usb->nIRQ, USB_ISR, (void *)usb); io_outpdw(usb->IER, ISOF + IBRST + ISUSP + IRESM + SYSERR + IEP0SETUP + IEP0RX + IEP0TX + IEP1TX + IEP2RX + IEP2TX); io_outpb(usb->CFR, io_inpb(usb->CFR) | 0x01); } io_RestoreINT(); usb->state = USB_DEV_POWERED; usb->InUse = 1; return true; EP2_OUT_FAIL: ker_Mfree(usb->EP[2].InBuf); EP2_IN_FAIL: ker_Mfree(usb->EP[1].InBuf); EP1_IN_FAIL: ker_Mfree(usb->EP[0].OutBuf); EP0_OUT_FAIL: ker_Mfree(usb->EP[0].InBuf); EP0_IN_FAIL: ker_Mfree(usb->EP[0].SetupBuf); EP0_SETUP_FAIL: err_print((char*)"%s: Alloc endpoint buffers error!!\n", __FUNCTION__); irq_Close(); io_Close(); return false; }
DMPAPI(void) i2c_EnableStandardHSM(int dev) { //enable the standard high-speed mode that is compatible with Philips' SPEC. if (vx86_CpuID() == CPU_VORTEX86DX_A) return; io_outpb(I2C_EXCTRL_REG(dev), io_inpb(I2C_EXCTRL_REG(dev)) & 0xef); }
bool init() { int i, crossbarBase, gpioBase; if(io_Init() == false) return false; timer_NowTime(); // initialize timer CLOCKS_PER_MICROSEC = vx86_CpuCLK(); VORTEX86EX_CLOCKS_PER_MS = CLOCKS_PER_MICROSEC*1000UL; // Set IRQ4 as level-trigger io_outpb(0x4D0, io_inpb(0x4D0) | 0x10); //set corssbar Base Address crossbarBase = sb_Read16(SB_CROSSBASE) & 0xfffe; if(crossbarBase == 0 || crossbarBase == 0xfffe) sb_Write16(SB_CROSSBASE, CROSSBARBASE | 0x01); // Force set HIGH speed ISA on SB sb_Write(SB_FCREG, sb_Read(SB_FCREG) | 0x8000C000L); //set SB GPIO Base Address gpioBase = sb_Read16(SB_GPIOBASE) & 0xfffe; if(gpioBase == 0 || gpioBase == 0xfffe) { sb_Write16(SB_GPIOBASE, GPIOCTRLBASE | 0x01); gpioBase = GPIOCTRLBASE; } // Enable GPIO 0 ~ 7 io_outpdw(gpioBase, 0x00ff); // set GPIO Port 0~7 dircetion & data Address for(i=0;i<8;i++) io_outpdw(gpioBase + (i+1)*4,((GPIODIRBASE + i*4)<<16) + GPIODATABASE + i*4); // set ADC Base Address sb_Write(0xbc, sb_Read(0xbc) & (~(1L<<28))); // active adc sb1_Write16(0xde, sb1_Read16(0xde) | 0x02); // not Available for 8051A Access ADC sb1_Write(0xe0, 0x0050fe00L); // baseaddr = 0xfe00, disable irq // set MCM Base Address set_MMIO(); mc_setbaseaddr(); for(i=0; i<4; i++) mc_SetMode(i, MCMODE_PWM_SIFB); if(Global_irq_Init == false) { // set MCM IRQ if(irq_Init() == false) { printf("MCM IRQ init fail\n"); return false; } if(irq_Setting(GetMCIRQ(), IRQ_LEVEL_TRIGGER + IRQ_DISABLE_INTR) == false) { printf("MCM IRQ Setting fail\n"); return false; } Set_MCIRQ(GetMCIRQ()); Global_irq_Init = true; } //CDC USBDEV = CreateUSBDevice(); if(USBDEV == NULL) { printf("init error\n"); return false; } usb_SetUSBPins(USBDEV, 7, 0, 7, 1); usb_SetTimeOut(USBDEV, 0L, 500L); // USB RX timerout is 0ms and TX timeout is 500ms if(usb_Init(USBDEV) == false) { printf("init2 error\n"); return false; } //io_Close(); return true; }
DMPAPI(void) i2c_DisableStandardHSM(int dev) { //note: this will force SCL pin to be always open drained if (vx86_CpuID() == CPU_VORTEX86DX_A) return; io_outpb(I2C_EXCTRL_REG(dev), io_inpb(I2C_EXCTRL_REG(dev)) | 0x10); }
DMPAPI(void) i2cslave_ClearSlaveWREQ(int dev) { io_outpb(I2C_STAT_REG(dev), 0x80); }
DMPAPI(void) i2c_ClearSTAT(int dev, unsigned char i2cstats) { io_outpb(I2C_STAT_REG(dev), i2cstats); }
static int rtczero_isr_handler(int irq, void* data) { unsigned char tmp, atm, ath; unsigned long nowtimes; bool match = false; time_t tnow, talarm; struct tm *tnow_m, *talarm_m; io_outpb(0x70, 0x0C); // enable NMI and read RTC register C tmp = io_inpb(0x71); // clear RTC interrupt state if((tmp & 0x20) == 0) return ISR_NONE; // only see alarm interrupt status bit if(alarmType == ALARMOFF) return ISR_HANDLED; nowtimes = _getNowAllSeconds(); tnow = nowtimes; talarm = AlarmTime; // check match condition int s, m, h, d, mm, y; tnow_m = gmtime(&tnow); s = tnow_m->tm_sec; m = tnow_m->tm_min; h = tnow_m->tm_hour; d = tnow_m->tm_mday; mm = tnow_m->tm_mon; y = tnow_m->tm_year; talarm_m = gmtime(&talarm); if(alarmType == ALARMSEC) { if(s >= talarm_m->tm_sec) match = true; } else if(alarmType == ALARMMINSEC) { if(s >= talarm_m->tm_sec && m == talarm_m->tm_min) match = true; } else if(alarmType == ALARMHOURMINSEC) { if(s >= talarm_m->tm_sec && m == talarm_m->tm_min && h == talarm_m->tm_hour) match = true; } else if(alarmType == ALARMDAYHOURMINSEC) { if(s >= talarm_m->tm_sec && m == talarm_m->tm_min && h == talarm_m->tm_hour && d == talarm_m->tm_mday) match = true; } else if(alarmType == ALARMMONDAYHOURMINSEC) { if(s >= talarm_m->tm_sec && m == talarm_m->tm_min && h == talarm_m->tm_hour && d == talarm_m->tm_mday && mm == talarm_m->tm_mon) match = true; } else if(alarmType == ALARMYEARMONDAYHOURMINSEC) { if(s >= talarm_m->tm_sec && m == talarm_m->tm_min && h == talarm_m->tm_hour && d == talarm_m->tm_mday && mm == talarm_m->tm_mon && y == talarm_m->tm_year) match = true; } else match = false; if(match == true) { if(isrCallback != NULL) isrCallback(); AlarmFlag = true; } _setAlarm(nowtimes + 60); // trigger next alarm signal after 60 sec return ISR_HANDLED; }
DMPAPI(void) i2c_ClearRXRdy(int dev) { io_outpb(I2C_STAT_REG(dev), 0x40); }
DMP_INLINE(void) outpb_cmos(unsigned char reg, unsigned char data) { io_DisableINT(); io_outpb(0x70, 0x80 | reg); // disable NMI (by setting the 0x80 bit) and assign a RTC register address io_outpb(0x71, data); io_RestoreINT(); }
/******************* Master Functions for Individual Module *****************/ DMPAPI(void) i2cmaster_SetStopBit(int dev) { io_outpb(I2C_CTRL_REG(dev), io_inpb(I2C_CTRL_REG(dev)) | 0x02); }
DMPAPI(void) attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { #if defined (DMP_LINUX) if( mode < 0 || mode > 4 ) { printf("Not support this mode\n"); return; } if( interruptNum > MAX_INTR_NUM ) { printf("Not support this interruptNum\n"); return; } if( idc.intr[interruptNum].used == true ) { printf("This pin was attached before\n"); return; } addIRQEntry(interruptNum, userFunc, mode, 0); #elif defined (DMP_DOS_DJGPP) int i; unsigned short crossbar_ioaddr; if(interruptNum >= EXTERNAL_NUM_INTERRUPTS) { printf("This interrupt%d has no one pin to use\n", interruptNum); return; } mc = interruptNum/3; md = MCSIF_MODULEB; if(_userfunc[interruptNum] != NULL) return; if(interrupt_init() == -1) return; mcmsif_init(mc); clear_INTSTATUS(); enable_MCINT(0xfc); // SIFB FAULT INT3/2/1 + STAT3/2/1 = 6 bits crossbar_ioaddr = sb_Read16(0x64)&0xfffe; if (mc == 0) io_outpb(crossbar_ioaddr + 2, 0x01); // GPIO port2: 0A, 0B, 0C, 3A else if (mc == 1) io_outpb(crossbar_ioaddr + 3, 0x02); // GPIO port3: 1A, 1B, 1C, 3B else if(mc == 2) io_outpb(crossbar_ioaddr, 0x03); // GPIO port0: 2A, 2B, 2C, 3C else if(mc == 3) { io_outpb(crossbar_ioaddr + 2, 0x01); io_outpb(crossbar_ioaddr + 3, 0x02); io_outpb(crossbar_ioaddr, 0x03); } mcsif_Disable(mc, md); io_DisableINT(); _userfunc[interruptNum] = userFunc; io_RestoreINT(); switch (mode) { case LOW: sifSetPol[interruptNum%3](mc, md, MCPFAU_POL_INVERSE); sifSetMask[interruptNum%3](mc, md, MCPFAU_MASK_INACTIVE); sifSetRelease[interruptNum%3](mc, md, MCPFAU_FAURELS_FSTAT0); sifClearStat[interruptNum%3](mc, md); _usedMode[mc][interruptNum%3] = MCPFAU_CAP_LEVEL0; clear_INTSTATUS(); break; case HIGH: sifSetMask[interruptNum%3](mc, md, MCPFAU_MASK_INACTIVE); sifSetRelease[interruptNum%3](mc, md, MCPFAU_FAURELS_FSTAT0); sifClearStat[interruptNum%3](mc, md); _usedMode[mc][interruptNum%3] = MCPFAU_CAP_LEVEL1; clear_INTSTATUS(); break; case CHANGE: sifIntMode[interruptNum%3](mc, md, MCPFAU_CAP_BOTH); _usedMode[mc][interruptNum%3] = MCPFAU_CAP_BOTH; break; case FALLING: sifIntMode[interruptNum%3](mc, md, MCPFAU_CAP_1TO0); _usedMode[mc][interruptNum%3] = MCPFAU_CAP_1TO0; break; case RISING: sifIntMode[interruptNum%3](mc, md, MCPFAU_CAP_0TO1); _usedMode[mc][interruptNum%3] = MCPFAU_CAP_0TO1; break; default: printf("No support this mode\n"); return; } // switch crossbar to MCM_SIF_PIN io_outpb(crossbar_ioaddr + 0x90 + pin_offset[interruptNum], 0x08);//RICH IO mcsif_Enable(mc, md); // If select level-trigger, switch the MASK to "NONE" after sif is enabled. switch (mode) { case LOW: case HIGH: sifSetMask[interruptNum%3](mc, md, MCPFAU_MASK_NONE); break; default: break; } #endif }
DMPAPI(void) i2cmaster_ClearAckErr(int dev) { io_outpb(I2C_STAT_REG(dev), 0x10); }
DMPAPI(void) wdt_reset(void) { if(wdt1_init_f == false) return; io_outpb(0xae, 0xff); // WDT1 reload register }
/******************** Slave Functions for Individual Module *****************/ DMPAPI(void) i2cslave_EnableACK(int dev) { io_outpb(I2C_CTRL_REG(dev), io_inpb(I2C_CTRL_REG(dev)) & 0xfe); }
DMPAPI(void) i2c_DisableNoiseFilter(int dev) { if (vx86_CpuID() == CPU_VORTEX86DX_A) return; io_outpb(I2C_EXCTRL_REG(dev), io_inpb(I2C_EXCTRL_REG(dev)) | 0x20); }
DMPAPI(void) i2cslave_SetAddr(int dev, unsigned char addr) { io_outpb(I2C_MYADDR_REG(dev), (addr << 1));// | 0x01); // Default: Enable TCE bit }
DMPAPI(void) i2c_SetResetPin(void) { // set the Reset pin on I2C connector of RB-110 & RB-050 to 1 io_outpb(GPIO2_DIR, io_inpb(GPIO2_DIR) | 0x80); io_outpb(GPIO2_DATA, io_inpb(GPIO2_DATA) | 0x80); }