Пример #1
0
static LONG bios_4(WORD r_w, UBYTE *adr, WORD numb, WORD first, WORD drive, LONG lfirst)
{
    LONG ret;
    KDEBUG(("BIOS rwabs(rw = %d, addr = 0x%08lx, count = 0x%04x, "
            "sect = 0x%04x, dev = 0x%04x, lsect = 0x%08lx)",
            r_w, adr, numb, first, drive, lfirst));
    ret = lrwabs(r_w, adr, numb, first, drive, lfirst);
    KDEBUG((" = 0x%08lx\n", ret));
    return ret;
}
Пример #2
0
/*
 *  xmgetmd - get an MD
 *
 *  To create a single pool for all osmem requests, MDs are grouped in
 *  blocks of 3 called MDBLOCKs which occupy 58 bytes.  MDBLOCKs are
 *  handled as follows:
 *    . they are linked in a chain, initially empty
 *    . when the first MD is required, an MDBLOCK is obtained via
 *      xmgetblk() and put on the chain, and the first slot is allocated
 *    . MDs are obtained from existing partially-used MDBLOCKS
 *    . when an MDBLOCK is full, it is removed from the chain
 *    . when an MD in a full MDBLOCK is freed, the MDBLOCK is put back
 *      on the chain
 *    . when the MDBLOCK is totally unused, it is put back on the normal
 *      free chain
 */
MD *xmgetmd(void)
{
    MDBLOCK *mdb = mdbroot;
    MD *md;
    WORD i, avail;

    if (!mdb)
    {
        mdb = MGET(MDBLOCK);
        if (!mdb)
            return NULL;

        /* initialise new MDBLOCK */
        mdb->mdb_next = NULL;
        for (i = 0; i < MDS_PER_BLOCK; i++)
            mdb->entry[i].index = -1;   /* unused */
        mdbroot = mdb;
        KDEBUG(("xmgetmd(): got new MDBLOCK at %p\n",mdb));
    }

    /*
     * allocate MD from MDBLOCK
     */
    for (i = 0, avail = 0, md = NULL; i < MDS_PER_BLOCK; i++)
    {
        if (mdb->entry[i].index < 0)
        {
            if (!md)                /* not yet allocated */
            {
                mdb->entry[i].index = i;
                md = &mdb->entry[i].md;
                KDEBUG(("xmgetmd(): got MD at %p\n",md));
            }
            else avail++;
        }
    }

    if (!md)
    {
        KDEBUG(("xmgetmd(): MDBLOCK at %p is invalid, no free entries\n",mdb));
        return NULL;
    }

    /*
     * remove full MDBLOCK from mdb chain
     */
    if (avail == 0)
    {
        KDEBUG(("xmgetmd(): MDBLOCK at %p is now full\n",mdb));
        if (unlink_mdblock(mdb) == 0)
            KDEBUG(("xmgetmd(): removed MDBLOCK at %p from mdb chain\n",mdb));
    }

    return md;
}
Пример #3
0
static void run_auto_program(const char* filename)
{
    char path[30];

    strcpy(path, "\\AUTO\\");
    strcat(path, filename);

    KDEBUG(("Loading %s ...\n", path));
    trap1_pexec(PE_LOADGO, path, "", default_env);  /* Pexec */
    KDEBUG(("[OK]\n"));
}
Пример #4
0
void Line::mousePressEvent(QMouseEvent *e)
{
#if 0
  int x, y;
#endif
  QPainter paint;

  KDEBUG(KDEBUG_INFO, 3000, "RubberLine::mousePressEvent() handler called\n");

  if (isActive()) {
    if (drawing) {
      KDEBUG(KDEBUG_INFO, 3000, "Line: Warning button press received while drawing\n");
    }
    else {
      startx= (e->pos()).x();
      starty= (e->pos()).y();
      activeButton= e->button();
      lastx= startx;
      lasty= starty;
      drawing= TRUE;
    }
  }

#if 0
  // This code used to allow multi segment lines (badly)
  // It is being replaced by a seperate polyline tool.
  else if (isActive() && (e->button() == RightButton) && drawing) {
    x= (e->pos()).x();
    y= (e->pos()).y();

    // Erase old line
    paint.begin(canvas->zoomedPixmap());
    paint.setPen(leftpen);
    paint.setRasterOp(XorROP);
    paint.drawLine(startx, starty, lastx, lasty);
    paint.setRasterOp(CopyROP);
    // Draw new line
    paint.drawLine(startx, starty, lastx, lasty);
    paint.end();

    startx= x;
    starty= y;
    lastx= startx;
    lasty= starty;
  }

  canvas->repaint(0);
#endif
  
  if (!isActive()) {
KDEBUG(KDEBUG_WARN, 3000, "Line: Warning event received when inactive (ignoring)\n");
  }
}
static int download_client_probe(struct platform_device *pdev)
{
	int ret = -1;
	struct download_client *download_client_data;
	struct m4sensorhub_data *m4sensorhub = m4sensorhub_client_get_drvdata();

	if (!m4sensorhub) {
		printk(KERN_WARNING "m4sensorhub is null\n");
		return -EFAULT;
	}

	download_client_data =
		kzalloc(sizeof(*download_client_data), GFP_KERNEL);
	if (!download_client_data)
		return -ENOMEM;

	download_client_data->m4sensorhub = m4sensorhub;
	platform_set_drvdata(pdev, download_client_data);

	ret = misc_register(&download_client_miscdrv);
	if (ret < 0) {
		KDEBUG(M4SH_ERROR, "Error registering %s driver\n",
				 DOWNLOAD_CLIENT_DRIVER_NAME);
		goto free_memory;
	}
	misc_download_data = download_client_data;
	ret = m4sensorhub_register_initcall(download_driver_init,
						download_client_data);
	if (ret < 0) {
		KDEBUG(M4SH_ERROR, "Unable to register init function "
			"for download client = %d\n", ret);
		goto unregister_misc_device;
	}
	init_waitqueue_head(&download_wq);
	atomic_set(&m4_dlcmd_resp_ready, false);
	atomic_set(&download_client_entry, 0);

	KDEBUG(M4SH_INFO, "Initialized %s driver\n",
		DOWNLOAD_CLIENT_DRIVER_NAME);
	return 0;

unregister_misc_device:
	misc_download_data = NULL;
	misc_deregister(&download_client_miscdrv);
free_memory:
	platform_set_drvdata(pdev, NULL);
	download_client_data->m4sensorhub = NULL;
	kfree(download_client_data);
	download_client_data = NULL;
	return ret;
}
Пример #6
0
void Pen::mousePressEvent(QMouseEvent *e)
{
  int x,y;
  QPainter painter1;
  QPainter painter2;
  QWMatrix m;

  KDEBUG(KDEBUG_INFO, 3000, "Pen::mousePressEvent() handler called\n");
  
  if (isActive()) {
    if (drawing) {
      KDEBUG(KDEBUG_INFO, 3000, "Pen: Warning button press received while drawing\n");
    }
    x= (e->pos()).x();
    y= (e->pos()).y();
    activeButton= e->button();

    m.scale((float) 100/(canvas->zoom()), (float) 100/(canvas->zoom()));

    painter1.begin(canvas->pixmap());

    if (activeButton == LeftButton)
      painter1.setPen(leftpen);
    else
      painter1.setPen(rightpen);
    painter1.setWorldMatrix(m);

    painter2.begin(canvas->zoomedPixmap());

    if (activeButton == LeftButton)
      painter2.setPen(leftpen);
    else
      painter2.setPen(rightpen);

    painter1.drawPoint(x, y);
    painter2.drawPoint(x, y);

    painter1.end();
    painter2.end();

    canvas->repaint(0);
    lastx= x;
    lasty= y;
    drawing= TRUE;
  } 
  if (!isActive()) {
    KDEBUG(KDEBUG_WARN, 3000, "Warning event received when inactive (ignoring)\n");
  }
}
Пример #7
0
/*
 * wait for access to IDE registers
 */
static int wait_for_not_BSY(volatile struct IDE *interface,LONG timeout)
{
    LONG next = hz_200 + timeout;

    KDEBUG(("wait_for_not_BSY(0x%08lx, %ld)\n", (ULONG)interface, timeout));

    DELAY_400NS;
    while(hz_200 < next) {
        if ((IDE_READ_ALT_STATUS() & IDE_STATUS_BSY) == 0)
            return 0;
    }

    KDEBUG(("Timeout in wait_for_not_BSY(%p,%ld)\n",interface,timeout));
    return 1;
}
static int display_client_open(struct inode *inode, struct file *file)
{
	int ret = -EFAULT;
	KDEBUG(M4SH_DEBUG, "%s:\n", __func__);
	if (global_display_data) {
		ret = nonseekable_open(inode, file);
		if (ret >= 0) {
			file->private_data = global_display_data;
			ret = 0;
		}
	}
	if (ret)
		KDEBUG(M4SH_ERROR, "%s: failed, err=%d\n", __func__, -ret);
	return ret;
}
static int download_client_close(struct inode *inode, struct file *file)
{
	int entry = atomic_dec_return(&download_client_entry);
	file->private_data = NULL;
	KDEBUG(M4SH_DEBUG, "%s: entry = %d\n", __func__, entry);
	return 0;
}
Пример #10
0
static int ach_ch_open(struct inode *inode, struct file *file)
{
    int ret = 0;
    struct ach_ch_device *device;

    /* Synchronize to protect refcounting */
    if (rt_mutex_lock_interruptible(&ctrl_data.lock)) {
        ret = -ERESTARTSYS;
        goto out;
    }

    device = &ctrl_data.devices[iminor(inode)];

    if (unlikely(device->minor != iminor(inode))) {
        printk(KERN_ERR "ach: Internal data problem\n");
        ret = -ERESTARTSYS;
        goto out_unlock;
    }

    file->private_data = ach_ch_file_alloc(device);

    if (!file->private_data) {
        printk(KERN_ERR "ach: Failed allocating file data\n");
        ret = -ENOBUFS;
        goto out_unlock;
    }

    KDEBUG( "ach: opened device %s\n", ach_ch_device_name(device) );

out_unlock:
    rt_mutex_unlock(&ctrl_data.lock);
out:
    return ret;
}
Пример #11
0
void net_habitue_device_SC101::prepareAndDoAsyncReadWrite(OSData *addr, IOMemoryDescriptor *buffer, UInt32 block, UInt32 nblks, IOStorageCompletion completion)
{
  bool isWrite = (buffer->getDirection() == kIODirectionOut);
  const OSSymbol *ioMaxKey = (isWrite ? gSC101DeviceIOMaxWriteSizeKey : gSC101DeviceIOMaxReadSizeKey);
  UInt64 ioMaxSize = OSDynamicCast(OSNumber, getProperty(ioMaxKey))->unsigned64BitValue();
  UInt64 ioSize = (nblks * SECTOR_SIZE);
  
#if WRITEPROTECT
  if (isWrite)
    panic();
#endif

  if (ioSize > ioMaxSize || ioSize & (ioSize - 1))
  {
    KDEBUG("%s size=%llu, deblocking", (isWrite ? "write" : "read"), ioSize);
    deblock(addr, buffer, block, nblks, completion);
    return;
  }
  
  outstanding_io *io = IONewZero(outstanding_io, 1);
  io->addr = addr;
  io->buffer = buffer;
  io->block = block;
  io->nblks = nblks;
  io->completion = completion;
  io->attempt = 0;
  io->timeout_ms = getNextTimeoutMS(io->attempt, isWrite);
  
  io->addr->retain();
  
  getWorkLoop()->runAction(OSMemberFunctionCast(Action, this, &net_habitue_device_SC101::submitIO), this, io);
}
static int m4pas_driver_init(struct init_calldata *p_arg)
{
	struct iio_dev *iio = p_arg->p_data;
	struct m4pas_driver_data *dd = iio_priv(iio);
	int err = 0;

	mutex_lock(&(dd->mutex));

	dd->m4 = p_arg->p_m4sensorhub_data;
	if (dd->m4 == NULL) {
		m4pas_err("%s: M4 sensor data is NULL.\n", __func__);
		err = -ENODATA;
		goto m4pas_driver_init_fail;
	}

	err = m4sensorhub_irq_register(dd->m4,
		M4SH_IRQ_PASSIVE_BUFFER_FULL, m4pas_isr, iio, 1);
	if (err < 0) {
		m4pas_err("%s: Failed to register M4 IRQ.\n", __func__);
		goto m4pas_driver_init_fail;
	}

	err = m4sensorhub_panic_register(dd->m4, PANICHDL_PASSIVE_RESTORE,
					 m4pas_panic_restore, dd);
	if (err < 0)
		KDEBUG(M4SH_ERROR, "Passive panic callback register failed\n");
	goto m4pas_driver_init_exit;

m4pas_driver_init_fail:
	m4pas_err("%s: Init failed with error code %d.\n", __func__, err);
m4pas_driver_init_exit:
	mutex_unlock(&(dd->mutex));
	return err;
}
/* Sync M4 clock with current kernel time */
static int m4_display_sync_clock(void)
{
	int retry = 0;
	do {
		u32 m4_time = m4_display_get_clock();
		u32 kernel_time = m4_display_get_kernel_clock();
		u32 diff_time = m4_time > kernel_time \
			? m4_time-kernel_time : kernel_time-m4_time;
#ifdef	DEBUG_CLOCK
		print_time("M4 :", m4_time);
		print_time("KNL:", kernel_time);
#endif
		/* it needs adjust M4 time if different large than 1 second */
		if (diff_time < 2) {
			if (retry) {
				print_time("Synced M4 clock to", m4_time);
				m4_notify_clock_change();
			}
			return 0;
		}
		m4_display_set_clock(kernel_time);
	} while (retry++ < SYNC_CLOCK_RETRY_TIMES);
	KDEBUG(M4SH_ERROR, "%s: Failed to sync M4 clock!\n",  __func__);
	return -EIO;
}
Пример #14
0
// uiAddr = addr
static int do_spi_erase(unsigned int  addr, unsigned int uiChip)
{
	unsigned int uiRet;
	uiRet = spi_flash_info[uiChip].pfErase(uiChip, addr);
	KDEBUG("do_spi_erase: addr=%x;\n", addr);
	return 0;
}
Пример #15
0
// uiAddr = from; pucBuffer = to; uiLen = size
static unsigned int do_spi_read(unsigned int from, unsigned int to, unsigned int size, unsigned int uiChip)
{
	unsigned int uiRet;
	uiRet = spi_flash_info[uiChip].pfRead(uiChip, from, size, (unsigned char*)to);
	KDEBUG("do_spi_read: from=%x; to=%x; size=%x; uiRet=%x\n", from, to, size, uiRet);
	return 0;
}
void ns_net_rx(struct sk_buff *skb, struct net_device *dev)
{
   struct nano_pci_card *card = (struct nano_pci_card *)dev;

   if(down_interruptible(&card->sem)) {
      kfree_skb(skb);
      return;
   }

   if(skb_queue_len(&card->rx_queue)>300) {
      up(&card->sem);
      KDEBUG(ERROR, "more then 300 pkt's in rx queue; dropping frame of size %d",skb->len);
      kfree_skb(skb);
      return;
   }

   if(!test_bit(DEVST_OPEN, &card->devst)) {
      kfree_skb(skb);
      up(&card->sem);
      return;
   }

   skb_queue_tail(&card->rx_queue, skb);
   up(&card->sem);
   card->status.irq_count++;
   wake_up_interruptible(&card->rx_waitqueue);
   return;
}
Пример #17
0
// SPI Flash Erase Block
unsigned int spi_block_erase(unsigned int uiChip, unsigned int uiAddr)
{
	KDEBUG("spi_block_erase: uiChip=%x; uiAddr=%x\n", uiChip, uiAddr);
	unsigned int uiRet;
	uiRet = ComSrlCmd_BE(uiChip, uiAddr);
	return uiRet;
}
Пример #18
0
// Chip Erase (CE) Sequence (Command 60 or C7)
unsigned int ComSrlCmd_CE(unsigned char ucChip)
{
	SeqCmd_Order(ucChip,  IOWIDTH_SINGLE, SPICMD_WREN);
	SeqCmd_Order(ucChip,  IOWIDTH_SINGLE, SPICMD_CE);	
	KDEBUG("ComSrlCmd_CE: ucChip=%x; SPICMD_CE=%x\n", ucChip, SPICMD_CE);
	return spiFlashReady(ucChip);
}
Пример #19
0
// Block Erase (BE) Sequence (Command D8)
unsigned int ComSrlCmd_BE(unsigned char ucChip, unsigned int uiAddr)
{
	SeqCmd_Order(ucChip,  IOWIDTH_SINGLE, SPICMD_WREN);
	SeqCmd_Write(ucChip,  IOWIDTH_SINGLE, SPICMD_BE, uiAddr, 3);	
	KDEBUG("ComSrlCmd_BE: ucChip=%x; uiBlock=%x; uiBlockSize=%x; SPICMD_BE=%x\n", ucChip, uiAddr, spi_flash_info[ucChip].block_size, SPICMD_BE);
	return spiFlashReady(ucChip);
}
Пример #20
0
// Sector Erase (SE) Sequence (Command 20)
unsigned int ComSrlCmd_SE(unsigned char ucChip, unsigned int uiAddr)
{
	SeqCmd_Order(ucChip,  IOWIDTH_SINGLE, SPICMD_WREN);
	SeqCmd_Write(ucChip,  IOWIDTH_SINGLE, SPICMD_SE, uiAddr, 3);
	KDEBUG("ComSrlCmd_SE: ucChip=%x; uiSector=%x; uiSectorSize=%x; SPICMD_SE=%x\n", ucChip, uiAddr, spi_flash_info[ucChip].sector_size, SPICMD_SE);	
	return spiFlashReady(ucChip);
}
Пример #21
0
int
nrx_wxevent_ap(struct net_device *dev)
{
   struct sockaddr sa;
   int status;
   int sa_len;
   m80211_mac_addr_t bssid;

   KDEBUG(TRACE, "ENTRY");

   nrx_wxevent_assoc_req_ie(dev);
   nrx_wxevent_assoc_resp_ie(dev);

   sa.sa_family = ARPHRD_ETHER;
   sa_len = sizeof(sa.sa_data);
   status = WiFiEngine_GetBSSID(&bssid);
   memcpy(sa.sa_data, bssid.octet, sizeof(bssid.octet));

   if(status != WIFI_ENGINE_SUCCESS) {
       memset(sa.sa_data, 0, sizeof(sa.sa_data));
       printk("[nano] NULL BSSID sent\n");
   }
   else
       printk("[nano] BSSID sent - 0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:0x%02x\n",
              bssid.octet[0], bssid.octet[1], bssid.octet[2],
              bssid.octet[3], bssid.octet[4], bssid.octet[5]);
   
   wireless_send_event(dev, SIOCGIWAP, (union iwreq_data*)&sa, NULL);

   return 0;
}
Пример #22
0
/*
 *  unlink_mdblock - unlinks an MDBLOCK from the mdb chain
 *
 *  returns -1 iff the MDBLOCK is not on the mdb chain
 */
static WORD unlink_mdblock(MDBLOCK *mdb)
{
    MDBLOCK *prev, *next;

    next = mdb->mdb_next;
    mdb->mdb_next = NULL;   /* neatness */

    if (mdb == mdbroot)     /* first on mdb chain? */
    {
        mdbroot = next;     /* yes, just point root to next */
        return 0;
    }

    /*
     * find previous MDBLOCK
     */
    for (prev = mdbroot; prev; prev = prev->mdb_next)
    {
        if (prev->mdb_next == mdb)
        {
            prev->mdb_next = next; /* just snip it out */
            return 0;
        }
    }

    KDEBUG(("unlink_mdblock(): cannot unlink MDBLOCK at %p, not on mdb chain\n",mdb));
    return -1;
}
Пример #23
0
struct spi_chip_info *spi_probe_flash_chip(struct map_info *map, struct chip_probe *cp)
{
	struct spi_chip_info *chip_info = NULL;
	unsigned int chip_select=0; // 0 or 1

	if (!strcmp(cp->name,"SPI2"))
		chip_select=1;
	
	spi_cp_probe(chip_select);
	chip_info = spi_suzaku_setup(map);
	KDEBUG("spi_probe_flash_chip\n");
	if (chip_info) 
	{
		chip_info->name = cp->name;
		chip_info->chip_select = chip_select;
		chip_info->flash	= &spi_probe_mtd;
		chip_info->destroy	= spi_suzaku_destroy; 
	 	chip_info->read		= do_spi_read;
		chip_info->write	= do_spi_write;
		chip_info->erase	= do_spi_erase;
		return chip_info;
	}
	else
	{
		return NULL;
	}
}
Пример #24
0
/*
 * get data from IDE device
 */
static void ide_get_data(volatile struct IDE *interface,UBYTE *buffer,ULONG bufferlen,int need_byteswap)
{
    XFERWIDTH *p = (XFERWIDTH *)buffer;
    XFERWIDTH *end = (XFERWIDTH *)(buffer + bufferlen);

    KDEBUG(("ide_get_data(0x%08lx, 0x%08lx, %lu, %d)\n", (ULONG)interface, (ULONG)buffer, bufferlen, need_byteswap));

    while (p < end)
        *p++ = interface->data;

    if (need_byteswap)
    {
        KDEBUG(("byteswap(0x%08lx, %lu)\n", (ULONG)buffer, bufferlen));
        byteswap(buffer,bufferlen);
    }
}
Пример #25
0
// uiAddr = to; pucBuffer = from; uiLen = size (stupid!!!)
static unsigned int do_spi_write(unsigned int from, unsigned int to, unsigned int size, unsigned int uiChip)
{
	unsigned int uiStartAddr, uiStartLen, uiPageAddr, uiPageCount, uiEndAddr, uiEndLen, i, uiRet;
	unsigned char* puc = (unsigned char*)from;
	KDEBUG("do_spi_write:from=%x; to=%x; size=%x;\n", from, to, size);
	calAddr(to, size, spi_flash_info[uiChip].page_size, &uiStartAddr, &uiStartLen, &uiPageAddr, &uiPageCount, &uiEndAddr, &uiEndLen);
	if((uiPageCount == 0x00) && (uiEndLen == 0x00))	// all data in the same page
	{
		uiRet = spi_flash_info[uiChip].pfPageWrite(uiChip, uiStartAddr, uiStartLen, puc);
	}
	else
	{
		if(uiStartLen > 0)
		{
			uiRet = spi_flash_info[uiChip].pfPageWrite(uiChip, uiStartAddr, uiStartLen, puc);
			puc += uiStartLen;
		}
		for(i = 0; i < uiPageCount; i++)
		{
			uiRet = spi_flash_info[uiChip].pfPageWrite(uiChip, uiPageAddr, spi_flash_info[uiChip].page_size, puc);
			puc += spi_flash_info[uiChip].page_size;
			uiPageAddr += spi_flash_info[uiChip].page_size;
		}
		if(uiEndLen > 0)
		{
			uiRet = spi_flash_info[uiChip].pfPageWrite(uiChip, uiEndAddr, uiEndLen, puc);
		}
	}
	//ComSrlCmd_WRDI(0);
	return 0;
}
/*!
 * @brief Writes a specified number of bytes to current position in stream.
 *
 * @param stream References the stream.
 * @param buf The buffer that holds the data to write.
 * @param len Size of buf.
 *
 * @return Number of bytes written, or a negative errno number.
 */
ssize_t nrx_stream_write(struct nrx_stream *stream, const void *buf, size_t len)
{
   KDEBUG(TRACE, "len = %lu", (unsigned long)len);
   if(stream->write == NULL)
      return -EOPNOTSUPP;
   return (*stream->write)(stream, buf, len);
}
Пример #27
0
// ------------------------------------------------------------------------- //
//	*�FlushOutput( void )
// ------------------------------------------------------------------------- //
void
TDCLBufferedPipe::FlushOutput( void )
{
	KDEBUG( "FlushOutput" );

	// Ecriture des donn�es.
	KUInt32 actualAmountWritten = mBufferSize;
	if (actualAmountWritten > 0)
	{
		try {
			GetSubPipe()->Write( mBuffer, &actualAmountWritten );
		} catch (...) {
			if (actualAmountWritten != mBufferSize)
			{
				// D�placement des donn�es.
				(void) ::memmove(
							(void*) mBuffer,
							&((const KUInt8*) mBuffer)[actualAmountWritten],
							mBufferSize - actualAmountWritten );
				mBufferSize -= actualAmountWritten;
			}
			throw;	// Rethrow
		}

		// Tout a �t� �crit avec succ�s.
		mBufferSize = 0;
	}
	
	// On vide la m�moire tampon du flux fils.
	GetSubPipe()->FlushOutput();
}
Пример #28
0
/*
 *  xmfree - Function 0x49 (Mfree)
 */
long xmfree(void *addr)
{
    MD *p,**q;
    MPB *mpb;

    KDEBUG(("BDOS: Mfree(0x%08lx)\n",(ULONG)addr));

    if (((UBYTE *)addr >= start_stram) && ((UBYTE *)addr <= end_stram)) {
        mpb = &pmd;
#if CONF_WITH_ALT_RAM
    } else if (has_alt_ram) {
        mpb = &pmdalt;
#endif
    } else {
        return EIMBA;
    }

    for (p = *(q = &mpb->mp_mal); p; p = *(q = &p->m_link))
        if ((UBYTE *)addr == p->m_start)
            break;

    if (!p)
        return EIMBA;

    *q = p->m_link;
    freeit(p,mpb);
    dump_mem_map();

    return E_OK;
}
Пример #29
0
void net_habitue_device_SC101::handleAsyncIOTimeout(outstanding *out, void *ctx)
{
  outstanding_io *io = (outstanding_io *)ctx;
  IOStorageCompletion completion = io->completion;
  bool isWrite = (io->buffer->getDirection() == kIODirectionOut);
  
  io->attempt++;
  io->timeout_ms = getNextTimeoutMS(io->attempt, isWrite);
  
  if (io->timeout_ms)
  {
    if (io->attempt > 3)
      KINFO("retry IO (%p, %d, %d)", io, io->attempt, io->timeout_ms);
    else
      KDEBUG("retry IO (%p, %d, %d)", io, io->attempt, io->timeout_ms);
    // IOBlockStorageDriver::incrementRetries(isWrite)
    
    doSubmitIO(io);
    return;
  }
  
  KINFO("abort IO %p", io);
  // IOBlockStorageDriver::incrementErrors(isWrite)
  
  completeIO(io);
  io->addr->release();
  IODelete(io, outstanding_io, 1);

  IOStorage::complete(completion, kIOReturnNotResponding, 0);
}
Пример #30
0
int
nrx_wxevent_pmkid_candidate(struct net_device *dev,
			 void *bssid,
			 int32_t rssi,
			 uint16_t caps)
{
   union iwreq_data wrqu;

   struct iw_pmkid_cand cand;
   
   KDEBUG(TRACE, "ENTRY");

   wrqu.data.length = sizeof(cand);
   wrqu.data.flags = 0;

   memset(&cand, 0, sizeof(cand));

   cand.bssid.sa_family = ARPHRD_ETHER;
   memcpy(cand.bssid.sa_data, bssid, 6);

   cand.flags = 0;
   if(caps & 1) /* PREAUTH */
      cand.flags |= IW_PMKID_CAND_PREAUTH;

   ASSERT(rssi >= -128 && rssi <= 127);
   cand.index = 127 - rssi; /* smaller is better */

   wireless_send_event(dev, IWEVPMKIDCAND, &wrqu, (char*)&cand);

   return 0;
}