]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/pcan_dongle.c
The first round of I/O space pointers separation.
[lincan.git] / lincan / src / pcan_dongle.c
index ca7ef798152fc3a19934464f769336f5ed47ce0c..d2a896850d5e848f59ce5bfd77c9e8aa6b651cff 100644 (file)
@@ -140,13 +140,13 @@ char dongle_type[] = "epp_dongle";
 static void _parport_disable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
 static void _parport_disable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
-  outb(inb(_PC_) & ~0x10, _PC_);
+  can_outb(can_inb(_PC_) & ~0x10, _PC_);
 }
 
 static void _parport_enable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
 }
 
 static void _parport_enable_irq(struct DONGLE_PORT *dng)
 {
   u16 _PC_ = (u16)dng->dwPort + 2;
-  outb(inb(_PC_) | 0x10, _PC_);
+  can_outb(can_inb(_PC_) | 0x10, _PC_);
 }
 
 
 }
 
 
@@ -157,18 +157,18 @@ static u8 pcan_dongle_sp_readreg(struct DONGLE_PORT *dng, u8 port) // read a reg
   u16 _PB_ = _PA_ + 1;
   u16 _PC_ = _PB_ + 1;
   u8  b0, b1 ;
   u16 _PB_ = _PA_ + 1;
   u16 _PC_ = _PB_ + 1;
   u8  b0, b1 ;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
-  outb((port & 0x1F) | 0x80,      _PA_);
-  outb((0x0B ^ 0x0C) | irqEnable, _PC_);
-  b1=nibble_decode[inb(_PB_)>>3];
-  outb(0x40, _PA_);
-  b0=nibble_decode[inb(_PB_)>>3];
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((port & 0x1F) | 0x80,      _PA_);
+  can_outb((0x0B ^ 0x0C) | irqEnable, _PC_);
+  b1=nibble_decode[can_inb(_PB_)>>3];
+  can_outb(0x40, _PA_);
+  b0=nibble_decode[can_inb(_PB_)>>3];
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
@@ -179,16 +179,16 @@ static void pcan_dongle_writereg(struct DONGLE_PORT *dng, u8 port, u8 data) // w
 {
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
 {
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
-  outb(port & 0x1F,               _PA_);
-  outb((0x0B ^ 0x0C) | irqEnable, _PC_);
-  outb(data,                      _PA_);
-  outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+  can_outb(port & 0x1F,               _PA_);
+  can_outb((0x0B ^ 0x0C) | irqEnable, _PC_);
+  can_outb(data,                      _PA_);
+  can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 }
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 }
@@ -199,16 +199,16 @@ static u8 pcan_dongle_epp_readreg(struct DONGLE_PORT *dng, u8 port) // read a re
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
   u8  wert;
   u16 _PA_ = (u16)dng->dwPort;
   u16 _PC_ = _PA_ + 2;
   u8  wert;
-  u8  irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
+  u8  irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
   can_spin_irqflags_t flags;
 
   can_spin_lock_irqsave(&pcan_lock, flags);
 
-  outb((0x0B ^ 0x0F) | irqEnable, _PC_);
-  outb((port & 0x1F) | 0x80,      _PA_);
-  outb((0x0B ^ 0x2E) | irqEnable, _PC_);
-  wert = inb(_PA_);
-  outb((0x0B ^ 0x0F) | irqEnable, _PC_);
+  can_outb((0x0B ^ 0x0F) | irqEnable, _PC_);
+  can_outb((port & 0x1F) | 0x80,      _PA_);
+  can_outb((0x0B ^ 0x2E) | irqEnable, _PC_);
+  wert = can_inb(_PA_);
+  can_outb((0x0B ^ 0x0F) | irqEnable, _PC_);
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
 
   can_spin_unlock_irqrestore(&pcan_lock, flags);
 
@@ -260,8 +260,8 @@ static void setECR(struct DONGLE_PORT *dng)
 {
        u16 wEcr = dng->wEcr;
 
 {
        u16 wEcr = dng->wEcr;
 
-       dng->ucOldECRContent = inb(wEcr);
-       outb((dng->ucOldECRContent & 0x1F) | 0x20, wEcr);
+       dng->ucOldECRContent = can_inb(wEcr);
+       can_outb((dng->ucOldECRContent & 0x1F) | 0x20, wEcr);
 
        if (dng->ucOldECRContent == 0xff)
                DEBUGMSG("%s: realy ECP mode configured?\n", DEVICE_NAME);
 
        if (dng->ucOldECRContent == 0xff)
                DEBUGMSG("%s: realy ECP mode configured?\n", DEVICE_NAME);
@@ -271,7 +271,7 @@ static void restoreECR(struct DONGLE_PORT *dng)
 {
   u16 wEcr = dng->wEcr;
 
 {
   u16 wEcr = dng->wEcr;
 
-  outb(dng->ucOldECRContent, wEcr);
+  can_outb(dng->ucOldECRContent, wEcr);
 
   DEBUGMSG("%s: restore ECR\n", DEVICE_NAME);
 }
 
   DEBUGMSG("%s: restore ECR\n", DEVICE_NAME);
 }
@@ -337,8 +337,8 @@ static int pcan_dongle_open(struct DONGLE_PORT *dng)
       wPort    = (u16)dng->dwPort;
          
      // save old port contents
       wPort    = (u16)dng->dwPort;
          
      // save old port contents
-     dng->ucOldDataContent     = inb(wPort);
-     dng->ucOldControlContent  = inb(wPort + 2);
+     dng->ucOldDataContent     = can_inb(wPort);
+     dng->ucOldControlContent  = can_inb(wPort + 2);
          
      // switch to epp mode if possible
      if (dng->wType == HW_DONGLE_SJA_EPP)
          
      // switch to epp mode if possible
      if (dng->wType == HW_DONGLE_SJA_EPP)
@@ -364,8 +364,8 @@ static int pcan_dongle_release(struct DONGLE_PORT *dng)
     restoreECR(dng);
     
   // restore port state
     restoreECR(dng);
     
   // restore port state
-  outb(dng->ucOldDataContent, wPort);
-  outb(dng->ucOldControlContent, wPort + 2);
+  can_outb(dng->ucOldDataContent, wPort);
+  can_outb(dng->ucOldControlContent, wPort + 2);
       
   parport_release(dng->pardev);
   
       
   parport_release(dng->pardev);
   
@@ -605,7 +605,7 @@ int pcan_dongle_init_chip_data(struct candevice_t *candev, int chipnr)
 
 
        candev->chip[chipnr]->chip_type=CHIP_TYPE;
 
 
        candev->chip[chipnr]->chip_type=CHIP_TYPE;
-       candev->chip[chipnr]->chip_base_addr=candev->io_addr;
+       candev->chip[chipnr]->chip_base_addr=can_ioport2ioptr(candev->io_addr);
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
        candev->chip[chipnr]->int_bus_reg = 0x0;
        candev->chip[chipnr]->clock = 16000000;
        candev->chip[chipnr]->int_clk_reg = 0x0;
        candev->chip[chipnr]->int_bus_reg = 0x0;
@@ -679,7 +679,7 @@ int pcan_dongle_program_irq(struct candevice_t *candev)
  * Return Value: The function does not return a value
  * File: src/template.c
  */
  * Return Value: The function does not return a value
  * File: src/template.c
  */
-void pcan_dongle_write_register(unsigned data, unsigned long address)
+void pcan_dongle_write_register(unsigned data, can_ioptr_t address)
 {
    address -= dongle_port.chip->chip_base_addr;  // it's in mutiplexed mode
 
 {
    address -= dongle_port.chip->chip_base_addr;  // it's in mutiplexed mode
 
@@ -698,7 +698,7 @@ void pcan_dongle_write_register(unsigned data, unsigned long address)
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
  * Return Value: The function returns the value stored in @address
  * File: src/template.c
  */
-unsigned pcan_dongle_read_register(unsigned long address)
+unsigned pcan_dongle_read_register(can_ioptr_t address)
 {
    u8 val;
 
 {
    u8 val;