示例#1
0
文件: packet.c 项目: Endt4sk/sebek
int
process_ip_packet(int direction, int iface, UCHAR *ip_packet, UINT size)
{
	struct ip_hdr *ip_hdr;
	UINT hdr_len;
	
	if(!ip_packet) {
		DBGOUT(("process_ip_packet: NULL ip_packet passed!\n"));
		return FILTER_UNKNOWN;
	}

	if (size < sizeof(struct ip_hdr)) {
		DBGOUT(("process_ip_packet: too small buffer for ip_hdr! (%u)\n", size));
		return FILTER_UNKNOWN;
	}

	ip_hdr = (struct ip_hdr *)ip_packet;
	if(!ip_hdr)
		return FILTER_UNKNOWN;

	hdr_len = ip_hdr->ip_hl * 4;

	if (size < hdr_len) {
		DBGOUT(("process_ip_packet: too small buffer for ip_hdr! (%u vs. %u)\n",
			size, hdr_len));
		return FILTER_UNKNOWN;
	}

	return process_transp(direction, iface, ip_hdr->ip_p, ip_hdr,
		ip_packet + hdr_len, size - hdr_len);
}
uint32 mhmakefileparser::CreateEnvMd5_32() const
{
  md5_context ctx;
  string Md5;
  string EnvVars=ExpandVar(USED_ENVVARS);
  const char *pTmp=EnvVars.c_str();

  // Now create the md5 string
  md5_starts( &ctx );

  DBGOUT(cout << "MD5 of " << m_MakeDir->GetQuotedFullFileName() << endl);

  while (*pTmp)
  {
    string Var;
    pTmp=NextItem(pTmp,Var,";");
    if (!SkipVar(Var))
    {
      string Val=ExpandVar(Var);
      transform(Val.begin(),Val.end(),Val.begin(),(int(__CDECL *)(int))toupper);
      DBGOUT(cout << GetMakeDir()->GetQuotedFullFileName() << " -> Setting GetFromEnv var " << Var << " to " << Val << endl);
      md5_update( &ctx, (uint8 *) Var.c_str(), (unsigned long)Var.size());
      md5_update( &ctx, (uint8 *) "=", 1);
      md5_update( &ctx, (uint8 *) Val.c_str(), (unsigned long)Val.size());
    }
  }

  return md5_finish32( &ctx);
}
示例#3
0
void SafeListView::populate(SafeGroup *group, SafeListViewGroup *view)
{
  if(group) {
    DBGOUT("populate");
    SafeGroup::Iterator iter(group);
    while(iter.current()) {
      SafeItem *item = iter.current();
      if(item->rtti() == SafeEntry::RTTI) {
	DBGOUT("Adding item: " << ((SafeEntry *)item)->name());
	if(view == NULL)
	  (void)new SafeListViewEntry(this, (SafeEntry *)item);
	else
	  (void)new SafeListViewEntry(view, (SafeEntry *)item);
      }
      else if(item->rtti() == SafeGroup::RTTI) {
	SafeListViewGroup *g = NULL;
	DBGOUT("Adding group: " << ((SafeGroup *)item)->name());
	if(view == NULL)
	  g = new SafeListViewGroup(this, (SafeGroup *)item);
	else
	  g = new SafeListViewGroup(view, (SafeGroup *)item);
	populate((SafeGroup *)item, g);
      }
      else {
	DBGOUT("Unknown item");
      }
      ++iter;
    }
  }
}
示例#4
0
// BUGBUG: Arguments are reversed from as documented in April '96 MSDN!
NDIS_STATUS MiniportReset(PBOOLEAN AddressingReset, NDIS_HANDLE MiniportAdapterContext)
{
	IrDevice *dev, *thisDev = CONTEXT_TO_DEV(MiniportAdapterContext);
	NDIS_STATUS result = NDIS_STATUS_SUCCESS;

	DBGOUT(("MiniportReset(0x%x)", (UINT)MiniportAdapterContext));

	/*  BUGBUG: fixed; REMOVE ???
	 *  Verify that the context is not bogus.
	 *  I've seen bad contexts getting passed in when the system gets corrupted.
	 */
	for (dev = firstIrDevice; dev && (dev != thisDev); dev = dev->next){ }
	if (!dev){
		DBGERR(("Bad context in MiniportReset"));
		return NDIS_STATUS_FAILURE;
	}

	DoClose(thisDev);
	CloseDevice(thisDev);
	OpenDevice(thisDev);
	DoOpen(thisDev);

	*AddressingReset = TRUE;       

	DBGOUT(("MiniportReset done."));
	return result;
}
示例#5
0
struct postfix *
check(struct prefix *p)
{
	struct postfix *pd;

	if (p->magic != MAGIC) {
		DBGOUT(("memtrack: check: invalid pre-magic! 0x%x\n", p));
		INT_3;
		return NULL;
	}

	pd = (struct postfix *)(p->data + p->size);

	if (pd->magic != MAGIC) {
		DBGOUT(("memtrack: memtrack_free: invalid post-magic! 0x%x\n", pd));
		INT_3;
		return NULL;
	}

	if (p->size != pd->size) {
		DBGOUT(("memtrack: memtracl_free: invalid post-size! 0x%x 0x%x\n", p, pd));
		INT_3;
		return NULL;
	}

	return pd;
}
示例#6
0
void
mempool_fini()
{
	KIRQL irql;
	ULONG total = 0;

	KeAcquireSpinLock(&guard, &irql);

	if (first != NULL) {
		struct prefix *p;
		for (p = first; p; p = p->next) {
			check(p);

			DBGOUT(("memtrack: memory leak detected! %s:%u (%u bytes)\n",
				p->file, p->line, p->size));

			total += p->size;
		}
	}

	KeReleaseSpinLock(&guard, irql);
	DBGOUT(("memtrack: Total memory leakage: %u bytes (%u blocks)\n", total, count));

	if (total) INT_3;
}
示例#7
0
文件: board.c 项目: projectnano/zeus
/*------------------------------------------------------------------------------
 * intialize nexell soc and board status.
 */
static void set_gpio_strenth(U32 Group, U32 BitNumber, U32 mA)
{
	U32 drv1=0, drv0=0;
	U32 drv1_value, drv0_value;

	switch( mA )
	{
		case 0 : drv0 = 0; drv1 = 0; break;
		case 1 : drv0 = 0; drv1 = 1; break;
		case 2 : drv0 = 1; drv1 = 0; break;
		case 3 : drv0 = 1; drv1 = 1; break;
		default: drv0 = 0; drv1 = 0; break;
	}
	DBGOUT("DRV Strength : GRP : i %x Bit: %x  ma :%d  \n",
				Group, BitNumber, mA);

	drv1_value = NX_GPIO_GetDRV1(Group) & ~(1 << BitNumber);
	drv0_value = NX_GPIO_GetDRV0(Group) & ~(1 << BitNumber);

	if (drv1) drv1_value |= (drv1 << BitNumber);
	if (drv0) drv0_value |= (drv0 << BitNumber);

	DBGOUT(" Value : drv1 :%8x  drv0 %8x \n ",drv1_value, drv0_value);

	NX_GPIO_SetDRV0 ( Group, drv0_value );
	NX_GPIO_SetDRV1 ( Group, drv1_value );
}
示例#8
0
static int stop_dma_ch(struct snd_pcm_substream *substream)
{
	struct nx_runtime_data *rtd = substream->runtime->private_data;
	struct dma_trans 	   *tr  = rtd->dma_tr;
	volatile int wait = 0;
	int ret = 0;

	DBGOUT("%s\n", __func__);

	if (! tr)
		return -1;

	rtd->dma_run = false;

	while (soc_dma_check_run(tr) && DMA_STOP_TIMEOUT > wait) {
			wait++;
			udelay(1000);
	}

	if (wait >= DMA_STOP_TIMEOUT) {
		printk(KERN_ERR "%s, dma stop wait time out %d\n", __func__, wait);
		soc_dma_trans_stop(tr);
		ret = -1;
	}

	DBGOUT("%s wait=%d\n", __func__, wait);
	return ret;
}
示例#9
0
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
	NTSTATUS result = STATUS_SUCCESS, stat;
	NDIS_HANDLE wrapperHandle;
	NDIS40_MINIPORT_CHARACTERISTICS info;

	DBGOUT(("==> IRMINI_Entry()"));

	NdisMInitializeWrapper(	(PNDIS_HANDLE)&wrapperHandle,
							DriverObject,
							RegistryPath,
							NULL
							);
	DBGOUT(("Wrapper handle is %xh", (UINT)wrapperHandle));

	info.MajorNdisVersion			=	(UCHAR)NDIS_MAJOR_VERSION;		
	info.MinorNdisVersion			=	(UCHAR)NDIS_MINOR_VERSION;	
//	info.Flags						=	0; 
	info.CheckForHangHandler		=	MiniportCheckForHang; 	
	info.HaltHandler				=	MiniportHalt; 	
	info.InitializeHandler			=	MiniportInitialize;  
	info.QueryInformationHandler	=	MiniportQueryInformation; 
	info.ReconfigureHandler			=	MiniportReconfigure;  
	info.ResetHandler				=	MiniportReset; 
	info.SendHandler				=	MiniportSend;  
	info.SetInformationHandler		=	MiniportSetInformation; 
	info.TransferDataHandler		=	MiniportTransferData; 

	info.HandleInterruptHandler		=	MiniportHandleInterrupt;
	info.ISRHandler					=	MiniportISR;  
	info.DisableInterruptHandler	=	MiniportDisableInterrupt;
	info.EnableInterruptHandler		=	MiniportEnableInterrupt; 

	
	/*
	 *  New NDIS 4.0 fields
	 */
	info.ReturnPacketHandler		=	ReturnPacketHandler;   
    info.SendPacketsHandler			=	SendPacketsHandler;	
	info.AllocateCompleteHandler	=	AllocateCompleteHandler;


	stat = NdisMRegisterMiniport(	wrapperHandle,
									(PNDIS_MINIPORT_CHARACTERISTICS)&info,
									sizeof(NDIS_MINIPORT_CHARACTERISTICS));
	if (stat != NDIS_STATUS_SUCCESS){
		DBGERR(("NdisMRegisterMiniport failed in DriverEntry"));
		result = STATUS_UNSUCCESSFUL;
		goto _entryDone;
	}

 _entryDone:	
	DBGOUT(("<== IRMINI_Entry %s", (PUCHAR)((result == NDIS_STATUS_SUCCESS) ? "succeeded" : "failed")));
	return result;

}
示例#10
0
void SafeListView::contentsDragMoveEvent(QDragMoveEvent *e)
{
  DBGOUT("Move event:");
  DBGOUT("\tAction: " << e->action());

  Q3ListView::contentsDragMoveEvent(e);

  if(e->action() == QDropEvent::Move)
    e->acceptAction();
}
示例#11
0
void dump_register_dpc(int module)
{
#if (DUMP_REGISTER)
#define DBGOUT(args...)  printk(args)
    struct NX_DPC_RegisterSet *pREG =
        (struct NX_DPC_RegisterSet*)NX_DPC_GetBaseAddress(module);
		NX_DPC_SetBaseAddress(module, (void *)IO_ADDRESS(NX_DPC_GetPhysicalAddress(module)));
	
    DBGOUT("DPC%d BASE ADDRESS: %p\n", module, pREG);
    DBGOUT(" DPCCTRL0     = 0x%04x\r\n", pREG->DPCCTRL0);
#endif
}
示例#12
0
/*
 *************************************************************************
 *  MiniportSend
 *************************************************************************
 *
 *
 *  Transmits a packet through the network interface card onto the medium.
 *
 *
 *
 */
NDIS_STATUS MiniportSend(
							IN NDIS_HANDLE MiniportAdapterContext,
							IN PNDIS_PACKET Packet,
							IN UINT Flags
						)
{
	IrDevice *thisDev = CONTEXT_TO_DEV(MiniportAdapterContext);	
	NDIS_STATUS result;

	DBGOUT(("MiniportSend(thisDev=0x%x)", (UINT)thisDev));



	/*
	 *  Put this packet at the end of our send queue.
	 *  We use the packet's MiniportReserved field as the
	 *  'next' pointer.
	 */
	DBGPKT(("Queueing send packet 0x%x.", (UINT)Packet));
	if (thisDev->firstSendPacket){
		*(PNDIS_PACKET *)thisDev->lastSendPacket->MiniportReserved = Packet;
	}
	else {
		thisDev->firstSendPacket = Packet;
	}
	thisDev->lastSendPacket = Packet;
	*(PNDIS_PACKET *)Packet->MiniportReserved = NULL;


	/*
	 *  Try to send the first queued send packet.
	 */
	if (IsCommReadyForTransmit(thisDev)){
		BOOLEAN isSynchronousSend, xmitSucceeded;

		isSynchronousSend = (BOOLEAN)(Packet == thisDev->firstSendPacket);

		xmitSucceeded = PortReadyForWrite(thisDev, isSynchronousSend);

		if (isSynchronousSend){
			result = xmitSucceeded ? NDIS_STATUS_SUCCESS : NDIS_STATUS_FAILURE;
		}
		else {
			result = NDIS_STATUS_PENDING;
		}
	}
	else {
		result = NDIS_STATUS_PENDING;
	}

	DBGOUT(("MiniportSend returning %s", DBG_NDIS_RESULT_STR(result)));
	return result;
}
示例#13
0
void SchedViz::Visit_Msg( const Semantics::Msg &message, TVTrace* trace ) {
	std::string messageName = message.name();
	DBGOUT("\tMessage: " << messageName << " -> ")

	// Create a new schedulable in the traceViz
	TVSchedulable* sched = new TVSchedulable( Message, messageName, true );
	// Determine the sending task
	Semantics::Transmits transmits = message.msgTransmitter();
	Semantics::Task sendingTask = transmits.sendingTask();
	// Determine the receiving tasks
	ReceivesSet receivesSet = message.msgListeners();

	// Loop through all of the scheduling info
	ExecInfoSet execSet = message.info();
	// Make sure there is one ( TTSchedule )
	if (execSet.size() == 1 ) {
		Semantics::ExecInfo execInfo = *execSet.begin();
		// Get the children of various types
		Semantics::Schedule schedChild = execInfo.Schedule_child();
		Semantics::Duration durationChild = execInfo.Duration_child();
		double duration = durationChild.exectimesecs();
		// See if child is a TTSchedule
		if ( Semantics::TTSchedule::meta == schedChild.type() ) {
			// Cast to a TTSchedule
			Semantics::TTSchedule ttSched = Semantics::TTSchedule::Cast( schedChild );
			// Grab the schedule info
			std::string schedule = ttSched.sched();
			// Convert the string to a nice vector
			std::vector< double > schedTimes = ConvertToVector( schedule );
			// Now create visual blocks for each sending
			std::vector< double >::iterator timesIter = schedTimes.begin();
			for ( ; timesIter != schedTimes.end(); timesIter++ ) {
				DBGOUT(*timesIter << " ")
				// Add an instance to the traceViz
				sched->AddInstance( trace, *timesIter, duration );
			}
		}
		// ExecInfo type not supported
		else {
			std::cout << "*** Message: ExecInfo type not currently supported.\n";
		}
	}
	// Debug some info
	else {
		std::cout << "*** Message: Not able to find appropriate ExecInfo.\n";
	}
	// Clean up the command output
	DBGOUT(std::endl)
}
示例#14
0
文件: pbc.cpp 项目: EFLql/conet
static inline int  pb_add(pb_buff_t *b, const void *buf, size_t count)
{
    if((size_t)b->left < count)
        PB_RETURN_ERROR(b, -1, "buf overflow");

    DBGOUT("add(len=%u):", count);
//    int i; 
//    for(i=0; i<count; i++) DBGOUT(" %02x", ((uint8_t*)buf)[i]);
    DBGOUT("\n");
    memcpy(b->ptr, buf, count);
    b->ptr += count;
    b->left -= count;

    return 0;
}
static int OSPDaemon_queue_driver_send(struct OSPDaemon_output *out)
{
	DBGOUT("Queue Driver send");
	int err = 0;

	if (0 == OSPDaemon_queue_isempty(&out->q)) {
		err = sem_post(&osp_sync);
		if (-1 == err) {
			DBGOUT("Sem post failed error - %s", strerror(errno));
			return err;
		}
	}

	return 0;
}
示例#16
0
SafeListViewGroup *SafeListView::addGroup(const QString &group_name)
{
  // if the group's name is empty,
  if(group_name.isEmpty())
    return NULL;
  // if name has zero seperators or
  else {
    QString group_path(group_name);

    if(group_path.at(0) == '/') {
      for(int i = 0; i < group_path.length(); i++) {
	if(group_path.at(i) != '/') {
	  group_path.remove(0, i);
	  break;
	}
      }
      DBGOUT("Group path: " << group_path);
    }

    SafeListViewGroup *group = findGroup(group_path);
    if(group != NULL) {
      DBGOUT("Found group " << group_path);
      return group;
    }

    DBGOUT("adding group: " << group_path);

    // FIXME: doesn't divide the group's name right if GroupSeperator
    // is escaped
    QString this_group = thisGroup(group_path);
    QString parent_group = parentGroup(group_path);
    DBGOUT("this_group = " << this_group);

    if(parent_group.isEmpty()) {
      return new SafeListViewGroup(this, this_group);
    }
    else {
      DBGOUT("parent = " << parent_group);
      // search for the parent
      // if it doesn't exist add it
      SafeListViewGroup *parent = addGroup(parent_group);
      parent->setOpen(true);
      return new SafeListViewGroup(parent, this_group);
    }
  }

  return NULL;
}
示例#17
0
	HProgram CreateProgram( const ProgramDescription& pd )
	{
		mxTODO("Prevent creation of duplicate shader programs?");
		const HProgram handle = driverCreateProgram(pd);
		DBGOUT("CreateProgram(%s) -> %u\n", pd.name.c_str(), handle.id);
		return handle;
	}
示例#18
0
文件: pbc.cpp 项目: EFLql/conet
static inline int  pb_decode_tag(pb_field_t *f)
{
    if (pb_decode_varint(f))
    {
        if(f->left == 0)
            f->eom = 1; // signal end-of-message
        return -1;
    }

    if (f->val.i64 == 0)
    {
        f->eom = 1; // Allow 0-terminated messages.
        PB_RETURN_ERROR(f, -2, "0-terminated msg");
    }

    f->tag = f->val.i64 >> 3;
    f->type = (pb_wire_type_t)(f->val.i32 & 7);

    DBGOUT("tag %u, type %u\n", f->tag, f->type);
    switch (f->type)
    {
        case PB_WT_VARINT: return pb_decode_varint(f);
        case PB_WT_FIXED64: return pb_decode_fixed64(f);
        case PB_WT_STRING: return pb_decode_string(f);
        case PB_WT_FIXED32: return pb_decode_fixed32(f);
        default: PB_RETURN_ERROR(f, -3, "invalid wire_type");
    }

    return 0;
}
示例#19
0
/*------------------------------------------------------------------------------
 * board interface
 */
void __init board_init(void)
{
	init_gpio_pad();
	init_alive_pad();
	init_bus_pad();

	__g_pRegister = (struct NX_MCUD_RegisterSet *)IO_ADDRESS(NX_MCUD_GetPhysicalAddress());

#if 0
	/*
	    for EMI control set MEMCFG's DS bit for Weak.

		DDR Memory PAD ODT : (Disable, 50, 75, 150ohm)
		NXP2120 DDR PAD ODT : (50, 75, 150ohm)
		DDR Memory PAD Strength : (Normal, Weak)
		NXP2120 DDR PAD Strength : (300, 150, 100, 75, 60, 50, 42.8, 37.5ohm impedence driver)
	*/
	NX_MCUD_SetDIC( NX_MCUD_DIC_WEAK);		// DDR Memory PAD Strength
	/* Set MEMCFG's RTT bit */
	NX_MCUD_SetODT( NX_MCUDRAM_ODT_DISABLE );	// DDR Memory PAD ODT
	/* Apply Mode Register */
	NX_MCUD_ApplyModeSetting();
	while( NX_MCUD_IsBusyModeSetting() );
	/* Set Phy's ODT */
	NX_MCUD_PHYZQ_SetODT( NX_MCUDPHY_ODT_75 );  // NXP2120 DDR PAD ODT (Default 75)
#endif
	printk ("MEMCFG = %08X MEMTIME0 = %08X MEMTIME1 = %08X PHYTERMCTRL = %08X\n", 
                __g_pRegister->MEMCFG, __g_pRegister->MEMTIME0, __g_pRegister->MEMTIME1, __g_pRegister->PHYTERMCTRL) ;

	DBGOUT("%s : done board initialize ...\n", CFG_SYS_BOARD_NAME);
}
示例#20
0
	void Deserialize_Class(
		const Json::Value& srcValue,
		const mxClass& classInfo,
		void *rawMem
	)
	{
#if MX_DEBUG_SERIALIZATION
		DBGOUT("Deserialize_Class '%s' (size %u, align %u)\n"
			, classInfo.m_name, (UINT)classInfo.m_instanceSize, (UINT)classInfo.m_alignment);
#endif // MX_DEBUG_SERIALIZATION

		const mxClass* parentClass = classInfo.GetParent();
		if( parentClass != nil )
		{
			Deserialize_Parent_Class( srcValue, *parentClass, rawMem );
		}

		const mxClassMembers& classMembers = classInfo.GetMembers();
		Deserialize_Class_Members( srcValue, classMembers, rawMem );

#if MX_DEBUG_SERIALIZATION
		if( DEBUGGED_CLASS::StaticClass() == classInfo )
		{
			DEBUGGED_CLASS* pInstance = (DEBUGGED_CLASS*) rawMem;
			(void)pInstance;
			mxDEBUG_BREAK;
		}
#endif // MX_DEBUG_SERIALIZATION
	}
示例#21
0
static int nand_dev_ready(struct mtd_info *mtd)
{
	int ret;
	CLEAR_RnB(ret);
	DBGOUT("[%s, RnB=%d]\n", ret?"READY":"BUSY", NX_MCUS_IsNFReady());
	return ret;
}
示例#22
0
文件: packet.c 项目: Endt4sk/sebek
int
process_udp(int direction, int iface, struct ip_hdr *ip_hdr, struct udp_hdr *udp_hdr, UCHAR *pointer, UINT buffer_len)
{
	UINT hdr_len = UDP_HEADER_LEN;
	struct sebek_hdr *sbk_hdr;

	if(udp_hdr && (udp_hdr->uh_dport == g_usDestPort)) {
		// go to the next header
		if (buffer_len > hdr_len) {
			pointer = (UCHAR *)udp_hdr + hdr_len;
			buffer_len -= hdr_len;			
		}

		if (buffer_len < sizeof(struct sebek_hdr)) {
			DBGOUT(("filter_packet: too small buffer for sebek_hdr! (%u)\n",	buffer_len));
			return FILTER_ALLOW;
		}

		sbk_hdr = (struct sebek_hdr *)pointer;
		if(!sbk_hdr)
			return FILTER_UNKNOWN;

		if(sbk_hdr->magic == g_uiMagic)
			return FILTER_DENY;
	}

	return FILTER_ALLOW;
}
示例#23
0
static int nx_rtc_ops_set_time(struct device *dev, struct rtc_time *tm)
{
	unsigned long rtc, curr_sec;

	spin_lock_irq(&rtc_lock);

	curr_sec = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
	             tm->tm_hour, tm->tm_min, tm->tm_sec);

	rtc = curr_sec - rtc_time_offs;

	DBGOUT("set time %02d.%02d.%02d %02d/%02d/%02d, rtc 0x%x\n",
		 tm->tm_year, tm->tm_mon, tm->tm_mday,
		 tm->tm_hour, tm->tm_min, tm->tm_sec, (u_int)rtc);

	/* set hw rtc */
	NX_RTC_SetRTCCounterWriteEnable(CTRUE);
	NX_RTC_SetRTCCounter(rtc);
	while(NX_RTC_IsBusyRTCCounter())
	{
		;
	}

	NX_RTC_SetRTCCounterWriteEnable(CFALSE);

	/* Confirm the write value. */
	while(NX_RTC_IsBusyRTCCounter())
	{
		;
	}

	spin_unlock_irq(&rtc_lock);

	return 0;
}
示例#24
0
static int nx_rtc_ops_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{
	int ret = 0;

	spin_lock_irq(&rtc_lock);
	DBGOUT("%s cmd=%08x, arg=%08lx \n", __func__, cmd, arg);

	switch (cmd) {
	case RTC_AIE_OFF:
		nx_rtc_alarm_irq_enable(dev, 0);
		break;
	case RTC_AIE_ON:
		nx_rtc_alarm_irq_enable(dev, 1);
		break;
	case RTC_UIE_OFF:
		nx_rtc_count_irq_enable(dev, 0);
		break;
	case RTC_UIE_ON:
		nx_rtc_count_irq_enable(dev, 1);
		break;
	case RTC_IRQP_SET:
		ret = ENOTTY;
		break;
	default:
		ret = -ENOIOCTLCMD;
	}

	spin_unlock_irq(&rtc_lock);

	return ret;
}
示例#25
0
文件: board.c 项目: projectnano/zeus
int board_init(void)
{
	bd_lcd_init();

	DBGOUT("%s : done board init ...\n", CFG_SYS_BOARD_NAME);
	return 0;
}
示例#26
0
/*
 *************************************************************************
 *  ReturnPacketHandler
 *************************************************************************
 *
 *  When NdisMIndicateReceivePacket returns asynchronously, 
 *  the protocol returns ownership of the packet to the miniport via this function.
 *
 */
VOID ReturnPacketHandler(NDIS_HANDLE MiniportAdapterContext, PNDIS_PACKET Packet)
{
	IrDevice *thisDev = CONTEXT_TO_DEV(MiniportAdapterContext);
	UINT rcvBufIndex;

	DBGOUT(("ReturnPacketHandler(0x%x)", (UINT)MiniportAdapterContext));

	/*
	 *  The rcv buffer index is cached in the MiniportReserved field of the packet.
	 */
	rcvBufIndex = *(UINT *)Packet->MiniportReserved;

	if (rcvBufIndex < NUM_RCV_BUFS){
		if (thisDev->rcvBufs[rcvBufIndex].state == STATE_PENDING){
			PNDIS_BUFFER ndisBuf;

			DBGPKT(("Reclaimed rcv packet 0x%x.", (UINT)Packet));

			NdisUnchainBufferAtFront(Packet, &ndisBuf);
			if (ndisBuf){
				NdisFreeBuffer(ndisBuf);
			}

			thisDev->rcvBufs[rcvBufIndex].state = STATE_FREE;
		}
		else {
			DBGERR(("Packet in ReturnPacketHandler was not PENDING."));
		}
	}
	else {
		DBGERR(("Bad rcvBufIndex (from corrupted MiniportReserved) in ReturnPacketHandler."));
	}

	
}
示例#27
0
文件: packet.c 项目: Endt4sk/sebek
/* process TCP, UDP or ICMP header */
int
process_transp(int direction, int iface, UCHAR proto, struct ip_hdr *ip_hdr,
			   UCHAR *pointer, UINT buffer_len)
{
	struct udp_hdr *udp_hdr;

	switch (proto) {
		case IPPROTO_UDP:
			/* process udp_hdr */

			if (buffer_len < sizeof(struct udp_hdr)) {
				DBGOUT(("filter_packet: too small buffer for udp_hdr! (%u)\n", buffer_len));
				return FILTER_UNKNOWN;
			}

			udp_hdr = (struct udp_hdr *)pointer;

			return process_udp(direction, iface, ip_hdr, udp_hdr, pointer, buffer_len);

		default:
			return FILTER_UNKNOWN;
	}

	/* UNREACHED */
}
示例#28
0
/*
 *************************************************************************
 *  MiniportHandleInterrupt
 *************************************************************************
 *
 *
 *  This is the deferred interrupt processing routine (DPC) which is 
 *  optionally called following an interrupt serviced by MiniportISR.
 *
 */
VOID MiniportHandleInterrupt(NDIS_HANDLE MiniportAdapterContext)
{
	IrDevice *thisDev = CONTEXT_TO_DEV(MiniportAdapterContext);

	DBGOUT(("==> MiniportHandleInterrupt(0x%x)", (UINT)MiniportAdapterContext));


	/*
	 *  If we have just started receiving a packet, 
	 *  indicate media-busy to the protocol.
	 */
	if (thisDev->mediaBusy && !thisDev->haveIndicatedMediaBusy){
		NdisMIndicateStatus(thisDev->ndisAdapterHandle, NDIS_STATUS_MEDIA_BUSY, NULL, 0);
		NdisMIndicateStatusComplete(thisDev->ndisAdapterHandle);
		thisDev->haveIndicatedMediaBusy = TRUE;
	}


	/*
	 *  Deliver all undelivered receive packets to the protocol.
	 */
	DeliverFullBuffers(thisDev);


	/*
	 *  Update the rcv queue 'first' and 'last' pointers.
	 *
	 *  We cannot use a spinlock to coordinate accesses to the rcv buffers
	 *  with the ISR, since ISR's are not allowed to acquire spinlocks.
	 *  So instead, we synchronize with the ISR using this special mechanism.
	 *  MiniportSyncHandleInterrupt will do our work for us with the IRQ
	 *  masked out in the PIC.
	 */
	NdisMSynchronizeWithInterrupt(	&thisDev->interruptObj,
									MiniportSyncHandleInterrupt,
									(PVOID)MiniportAdapterContext);


	/*
	 *  Send any pending write packets if possible. 
	 */
	if (IsCommReadyForTransmit(thisDev)){
		PortReadyForWrite(thisDev, FALSE);
	}

	DBGOUT(("<== MiniportHandleInterrupt"));
}
示例#29
0
void SchedViz::Visit_Task( const Semantics::Task &task, TVSuperblock *superblock ) {
	std::string taskName = task.name();
	DBGOUT("\tTask: " << taskName << " -> ")

	// Need to create a Task trace
	TVTrace* trace = superblock->AddTrace( taskName );
	// Create a new schedulable in the traceViz
	TVSchedulable* sched = new TVSchedulable( Task, taskName, false );

	// Loop through all of the scheduling info
	ExecInfoSet execSet = task.info();
	// Make sure there is one ( TTSchedule )
	if (execSet.size() == 1 ) {
		Semantics::ExecInfo execInfo = *execSet.begin();
		// Get the children of various types
		Semantics::Schedule schedChild = execInfo.Schedule_child();
		Semantics::Duration durationChild = execInfo.Duration_child();
		double duration = durationChild.exectimesecs();
		// See if child is a TTSchedule
		if ( Semantics::TTSchedule::meta == schedChild.type() ) {
			// Cast to a TTSchedule
			Semantics::TTSchedule ttSched = Semantics::TTSchedule::Cast( schedChild );
			// Grab the schedule info
			std::string schedule = ttSched.sched();
			// Convert the string to a nice vector
			std::vector< double > schedTimes = ConvertToVector( schedule );
			// Now create visual blocks for each invocation
			std::vector< double >::iterator timesIter = schedTimes.begin();
			for ( ; timesIter != schedTimes.end(); timesIter++ ) {
				// Add the task as a trace to the traceViz
				DBGOUT(*timesIter << " ")
				// Add an instance to the traceViz
				sched->AddInstance( trace, *timesIter, duration );
			}
		}
		// ExecInfo type not supported
		else {
			std::cout << "*** Task: ExecInfo type not currently supported.\n";
		}
	}
	// Debug some info
	else {
		std::cout << "*** Task: Not able to find appropriate ExecInfo.\n";
	}
	// Clean up the output
	DBGOUT(std::endl)
}
示例#30
0
/*
 *************************************************************************
 * MiniportISR
 *************************************************************************
 *
 *
 *  This is the miniport's interrupt service routine (ISR).
 *
 *
 */
VOID MiniportISR	(	PBOOLEAN InterruptRecognized,
						PBOOLEAN QueueMiniportHandleInterrupt,
						NDIS_HANDLE MiniportAdapterContext)
{

	IrDevice *thisDev = CONTEXT_TO_DEV(MiniportAdapterContext);	

	DBGOUT(("MiniportISR(0x%x, interrupt #%d)", (UINT)thisDev, ++thisDev->interruptCount));

	/*
	 *  Service the interrupt.
	 */
	COM_ISR(thisDev, InterruptRecognized, QueueMiniportHandleInterrupt);

	DBGOUT(("... MiniportISR done."));

}