NTSTATUS abort_endpoint(libusb_device_t *dev, int endpoint, int timeout)
{
  NTSTATUS status = STATUS_SUCCESS;
  URB urb;

  DEBUG_PRINT_NL();
  DEBUG_MESSAGE("abort_endpoint(): endpoint 0x%02x\n", endpoint);
  DEBUG_MESSAGE("abort_endpoint(): timeout %d\n", timeout);

  memset(&urb, 0, sizeof(struct _URB_PIPE_REQUEST));

  if(!dev->config.value)
    {
      DEBUG_ERROR("abort_endpoint(): invalid configuration 0");
      return STATUS_INVALID_DEVICE_STATE;
    }

  if(!get_pipe_handle(dev, endpoint, &urb.UrbPipeRequest.PipeHandle))
    {
      DEBUG_ERROR("abort_endpoint(): getting endpoint pipe failed");
      return STATUS_INVALID_PARAMETER;
    }

  urb.UrbHeader.Length = (USHORT) sizeof(struct _URB_PIPE_REQUEST);
  urb.UrbHeader.Function = URB_FUNCTION_ABORT_PIPE;

  status = call_usbd(dev, &urb, IOCTL_INTERNAL_USB_SUBMIT_URB, timeout);
  
  if(!NT_SUCCESS(status) || !USBD_SUCCESS(urb.UrbHeader.Status))
    {
      DEBUG_ERROR("abort_endpoint(): request failed: status: 0x%x, "
                  "urb-status: 0x%x", status, urb.UrbHeader.Status);
    }
  
  return status;
}
G_GNUC_INTERNAL
void
_mdw_default_player_display_finalize(MdwDefaultPlayerDisplay** p_display)
{
    g_assert(p_display != NULL && *p_display != NULL);
    MdwDefaultPlayerDisplay* display = *p_display;

    DEBUG_INFO("Deinitializing DirectFB"); 
    if (display->directfb_thread) {
        MdwMessage* m = mdw_message_new(MDW_MESSAGE_TYPE_FINALIZE, 0);
        mdw_message_put(m, display->directfb_queue);
        g_assert(display->main_queue != NULL);
        m = mdw_message_get(display->main_queue, TRUE);
        if (m->type == MDW_MESSAGE_TYPE_FINALIZED) {
            /* deinitialized */
            /* g_thread_join ? */
        } else {
            DEBUG_ERROR("directfb_thread did not return MDW_MESSAGE_TYPE_FINALIZED");
            g_assert_not_reached();
        }
        g_assert(g_async_queue_length(display->main_queue) == 0);
        g_assert(g_async_queue_length(display->directfb_queue) == 0);
    }
    if (display->surface) {
        display->surface->Release(display->surface);
    }
    if (display->window) {
        display->window->Release(display->window);
    }
    if (display->layer) {
        display->layer->Release(display->layer);
    }
    if (display->dfb) {
        display->dfb->Release(display->dfb);
    }
    DEBUG_INFO("DirectFB released"); 
    if (display->main_queue) {
        g_assert(g_async_queue_length(display->main_queue) == 0);
        g_async_queue_unref(display->main_queue);
    }
    if (display->directfb_queue) {
        g_assert(g_async_queue_length(display->directfb_queue) == 0);
        g_async_queue_unref(display->directfb_queue);
    }
    g_free(display);
    *p_display = NULL;

}
Ejemplo n.º 3
0
S32 CNetObj::SndData(S8 *Buf, S32 Len, S32 Times)
{
	S32 Timeout = 0, Sent = 0, SndSize = Len;

	while (SndSize > 0 && m_bRuning) 
	{
		Sent = m_Sock.Send(Buf + (Len - SndSize), SndSize, 0);
		if (Sent == SOCK_HANDLE_ERROR)
		{
			//if (m_bClient)
			//{
			//	ResetSock();
			//} 
			//else
			//{
			//	Stop();
			//}
			if (m_ObjInitInfo.MsgCb)
			{
				ADP::Msg_t Msg;
				Msg.Magic     = ADP_MSG_MAGIC;
				Msg.Type      = ADP::ADP_MSG_NET_STOP;
				Msg.Live      = GET_TICKS();
				Msg.Body.rVal = Sent;
				m_ObjInitInfo.MsgCb(Msg, m_ObjInitInfo.pMsgCbParam);
			}
			Stop();
			DEBUG_ERROR("[ %s:%d Sock err:%d ] \n", __FILE__, __LINE__, Sent);
			return MW_FAILED;
		}
		else if (Sent == SOCK_HANDLE_BUFFULL)
		{
			if (Times == 0) // send all
			{
				continue;
			}
			if (Timeout++ > Times) 
			{
				return (Len - SndSize);
			}
			continue;
		}
		Timeout = 0;
		SndSize -= Sent;
	}

	return (Len - SndSize);
}
Ejemplo n.º 4
0
/* ********************************************************************      */
void davicom_pre_interrupt(int minor_no)
{
PDAVICOM_SOFTC softc;

    softc = off_to_davicom_softc(minor_no);

    if (!softc)
    {
        DEBUG_ERROR("davicom_pre_interrupt: no softc", NOVAR, 0, 0);
        return;
    }

    /* The isr will be masked on again when the strategy routine called      */
    /* from the interrupt task returns                                       */
    DRIVER_MASK_ISR_OFF(softc->dav_irq)
}
Ejemplo n.º 5
0
void FBGfx::staticConstruct()
{
#if DEBUG_SHOULD_ERROR_CHECK
	if (!glfwInit()) DEBUG_ERROR("Unable to initialize GLFW");
#else
	glfwInit();
#endif	
#ifdef __APPLE__
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
	glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#endif
	has_context = false;
	recorded_key_press = false;
}
Ejemplo n.º 6
0
static int add2epoll(int efd, int flags, int fd)
{
	struct epoll_event event;
	int ret;

	event.data.fd = fd;
	event.events = flags;
	
	ret = epoll_ctl(efd, EPOLL_CTL_ADD, fd, &event);
	if (0 != ret)
	{
		DEBUG_ERROR(" add to epoll error\n");
	}

	return ret;
}
Ejemplo n.º 7
0
/*
 * 	AHB clock gating for suspend
 */
int s3c_udc_suspend_clock_gating(void)
{
/*	for 6410
	u32	uReg;
	DEBUG_PM("[%s]\n", __func__);

	
	uReg = readl(S3C_UDC_OTG_PCGCCTL);

	writel(uReg|1<<STOP_PCLK_BIT|1<<GATE_HCLK_BIT, S3C_UDC_OTG_PCGCCTL); 
	DEBUG_PM("[%s] : S3C_UDC_OTG_PCGCCTL 0x%x \n", __func__, uReg);	
*/
	DEBUG_ERROR("[%s] : Not Implemented \n", __func__); 

	return 0;
}
Ejemplo n.º 8
0
PVOID DymArrayPopBack(PUTILS_DYM_ARRAY Array)
{
   PVOID ret = NULL;
   DEBUG_ENTER_FUNCTION("Array=0x%p", Array);

   if (Array->ValidLength > 0) {
      ret = Array->Data[Array->ValidLength - 1];
      Array->ValidLength--;
   } else {
      DEBUG_ERROR("Attempt to remove an item from an empty array (0x%p)", Array);
      KeBugCheck(0);
   }

   DEBUG_EXIT_FUNCTION("0x%p", ret);
   return ret;
}
Ejemplo n.º 9
0
/* Implement this only if you will have handshaking capability in your UART.
 If you won't, then turn off UART_SUPPORTS_HANDSHAKING for your target. 
 This function should return TRUE if the remote host is ready to receive
 data, FALSE otherwise. This function is called from the ISR. */
RTIP_BOOLEAN uart_hw_poll_tx_handshake(PUART_INFO uinfo)
{
dword msr_reg;
#if (UART_16550)
/*  return ((RTIP_BOOLEAN)(INBYTE(uinfo->port_base + MSR) & uinfo->handshake_mask));   */
    msr_reg = INBYTE(uinfo->port_base + MSR);
    if (!(msr_reg & uinfo->handshake_mask))
    {
        DEBUG_ERROR("uart_hw_poll_tx_handshake: msr, mask = ",
            DINT2, msr_reg, uinfo->handshake_mask);
    }
    return ((RTIP_BOOLEAN)(msr_reg & uinfo->handshake_mask));
#else
#error Implement checking if remote can recv
#endif
}
Ejemplo n.º 10
0
/* 
 * until it becomes enabled, this UDC should be completely invisible
 * to any USB host.
 */
static int s3c_udc_enable(struct s3c_udc *dev)
{
	u32 reg_val;
	DEBUG_SETUP("%s: %p\n", __func__, dev);

#if USING_MACH_OTG_PHY
	otg_phy_init();
#else

	writel(1, S5P_USB_PHY_CONTROL);
	writel(0xa0, S3C_USBOTG_PHYPWR);				/* Power up */
	writel(OTGH_PHY_CLK_VALUE, S3C_USBOTG_PHYCLK);
	writel(0x1, S3C_USBOTG_RSTCON);
	udelay(50);
	writel(0x0, S3C_USBOTG_RSTCON);
	udelay(50);

#endif
	
	dev->udc_state = USB_STATE_POWERED;
	dev->gadget.speed = USB_SPEED_UNKNOWN;
	
	/* 14. Initialize OTG Link Core. */
	writel(GAHBCFG_INIT, S3C_UDC_OTG_GAHBCFG);
	
	writel( 0<<15		// PHY Low Power Clock sel
		|1<<14		// Non-Periodic TxFIFO Rewind Enable
		|0x5<<10	// Turnaround time
		|0<<9|0<<8	// [0:HNP disable, 1:HNP enable][ 0:SRP disable, 1:SRP enable] H1= 1,1
		|0<<7		// Ulpi DDR sel
		|0<<6		// 0: high speed utmi+, 1: full speed serial
		|0<<4		// 0: utmi+, 1:ulpi
		|1<<3		// phy i/f	0:8bit, 1:16bit
		|0x7<<0,	// HS/FS Timeout*
		S3C_UDC_OTG_GUSBCFG);

	s3c_udc_initialize(dev);

	//change proper register instead of S3C_UDC_OTG_GINTMSK
	reg_val = readl(S3C_UDC_OTG_GINTMSK);
	if(!reg_val)
	{
		DEBUG_ERROR("[%s] Fail to set GINTMSK 0x%x\n", __func__, reg_val);
		return -1;
	}
	return 0;
}
Ejemplo n.º 11
0
static gboolean 
_iface_mdw_demux_set_ts_source (MdwDemux *iface, MdwTsSource* source) 
{
    g_return_val_if_fail(iface != NULL, FALSE);
    //g_return_val_if_fail(source != NULL, FALSE);

    MdwDvbDemuxPrivate *priv = MDW_DVB_DEMUX_GET_PRIVATE(iface);

    /* there's a dependency between source and handlers and the source cannot be changed to a incompatible type*/
    if (source != NULL && priv->source != NULL ) {
        //g_return_val_if_fail(priv->source == NULL, FALSE);
        //return FALSE;
        if (!(MDW_IS_TS_SOURCE(priv->source) && MDW_IS_TS_SOURCE(source))) {
            return FALSE;
        }

    }
    if (source && MDW_IS_TS_FILE_SOURCE(source)) {
        if (priv->dvr_fd == -1) {
            gint fd;
            if (G_UNLIKELY((fd = open(priv->dvr_device, O_WRONLY | O_NONBLOCK))== -1)) {
                gchar err_msg[1024];
                g_snprintf(err_msg, 1024, 
                    "Cannot open demux dvr_device '%s':%s", 
                    priv->dvr_device, g_strerror(errno));
                //g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), err_msg);
                DEBUG_ERROR(err_msg);
                return FALSE;
            }
            priv->dvr_fd = fd;
        }
    }

    if (priv->source) {
        g_object_unref(priv->source);
    }

    if (source) {
        g_object_ref(source);
    }

    priv->source = source;

    return TRUE;


}
Ejemplo n.º 12
0
ADP::RspStreamOpen_t CNetObj::Open(ADP::ReqStreamOpen_t Req, InitObjInfo_t Info, S32 mSec)
{
	ADP::RspStreamOpen_t RspVal;

	RspVal.rVal = m_Sock.SetClient(Req.URL);
	if (RspVal.rVal != MW_SUCC)
	{
		DEBUG_ERROR("Connect err\n");
		return RspVal;
	}
	m_ObjInitInfo  = Info;
	m_StrUrl       = Req.URL;
	m_bResetSock   = false;
	m_bRuning      = true;
	m_tNetHandle   = ::CreateNormalThread(NetThreadProc, this, 512 * 1024);
	
	ADP::Msg_t Msg;
	Msg.Type = ADP::ADP_CMD_REQ_STREAM_OPEN;
	Msg.Body.ReqStreamOpen = Req; 
	Msg.RspId = m_MsgRspId++;
	RspVal.rVal = SndMsg(Msg, mSec);
	if (RspVal.rVal != MW_SUCC)
	{
		goto ERR_EXIT;
	}

	RspVal.rVal = RcvMsg(Msg, mSec);
	if (RspVal.rVal != MW_SUCC)
	{
		RspVal.rVal = NET_MSG_TIME_OUT;
		goto ERR_EXIT;
	}
	if (MW_SUCC != Msg.Body.RspStreamOpen.rVal)
	{
		Msg.Type = ADP::ADP_CMD_REQ_STREAM_OPEN;
		Msg.Body.ReqStreamClose.Token = Msg.Body.RspStreamOpen.Token;
		SndMsg(Msg, mSec);
		RspVal.rVal = Msg.Body.RspStreamOpen.rVal;
		goto ERR_EXIT;
	}
	
	return Msg.Body.RspStreamOpen;

ERR_EXIT:
	Stop();
	return RspVal;
}
Ejemplo n.º 13
0
int gpio_set_level(int fd, IOCTL_GPIO_ARG_ST *parg)
{
    int i;
    int ret = RET_SUCCESS;

    if (NULL == parg)
	{
        return RET_FAILED;
	}
	if ((GPIO_LEVEL_LOW != parg->gpio_level) && (GPIO_LEVEL_HIGHT != parg->gpio_level))
    	{
        DEBUG_ERROR("Invalid argument!\n"); 
        return RET_FAILED;
	}	
    ret = ioctl(fd, IOCTL_GPIO_LEVEL_SET, parg);
   return ret;
}
Ejemplo n.º 14
0
unsigned int Resources::audio(const std::string &audioFile)
{
	std::string fullpath;
	if (audioMap.find(audioFile) == audioMap.end()) {
		DEBUG_PRINT("loading " << audioFile);
		if (search_path(audioFile, fullpath)) {
			audioMap[audioFile] = load_wav(fullpath);
		}
		else {
			DEBUG_ERROR("file " << audioFile << " doesnt exist or not reachable");
		}
	}
	else {
		DEBUG_PRINT("using already loaded " << audioFile);
	}
	return audioMap[audioFile];
}
Ejemplo n.º 15
0
unsigned int Resources::texture(const std::string &textureFile)
{
	std::string fullpath;
	if (textureMap.find(textureFile) == textureMap.end()) {
		DEBUG_PRINT("loading " << textureFile);
		if (search_path(textureFile, fullpath)) {
			textureMap[textureFile] = load_tga(fullpath);
		}
		else {
			DEBUG_ERROR("file " << textureFile << " doesnt exist or not reachable");
		}
	}
	else {
		DEBUG_PRINT("using already loaded " << textureFile);
	}
	return textureMap[textureFile];
}
Ejemplo n.º 16
0
ObjModel *Resources::mesh(const std::string &meshFile)
{
	std::string fullpath;
	if (meshMap.find(meshFile) == meshMap.end()) {
		DEBUG_PRINT("loading " << meshFile);
		if (search_path(meshFile, fullpath)) {
			meshMap[meshFile] = load_obj(fullpath);
		}
		else {
			DEBUG_ERROR("file " << meshFile << " doesnt exist or not reachable");
		}
	}
	else {
		DEBUG_PRINT("using already loaded " << meshFile);
	}
	return meshMap[meshFile];
}
Ejemplo n.º 17
0
/* 
 * until it becomes enabled, this UDC should be completely invisible
 * to any USB host.
 */
static int s3c_udc_enable(struct s3c_udc *dev)
{
	u32 reg_val;
	DEBUG_SETUP("%s: %p\n", __func__, dev);

	reg_val = readl(S3C_OTHERS);
	reg_val |= (1<<16);   // USB_SIG_MASK
	writel(reg_val, S3C_OTHERS);
	
	// 1. Initializes OTG Phy.
	writel(0x0, S3C_USBOTG_PHYPWR);
	writel(0x20, S3C_USBOTG_PHYCLK);
	writel(0x1, S3C_USBOTG_RSTCON);
	// confirm delay time with thinking pm logic
	udelay(50);
	writel(0x0, S3C_USBOTG_RSTCON);
	udelay(50);
	
	dev->udc_state = USB_STATE_POWERED;
	dev->gadget.speed = USB_SPEED_UNKNOWN;
	
	/* 14. Initialize OTG Link Core. */
	writel(GAHBCFG_INIT, S3C_UDC_OTG_GAHBCFG);
	
	writel( 0<<15		// PHY Low Power Clock sel
		|1<<14		// Non-Periodic TxFIFO Rewind Enable
		|0x5<<10	// Turnaround time
		|0<<9|0<<8	// [0:HNP disable, 1:HNP enable][ 0:SRP disable, 1:SRP enable] H1= 1,1
		|0<<7		// Ulpi DDR sel
		|0<<6		// 0: high speed utmi+, 1: full speed serial
		|0<<4		// 0: utmi+, 1:ulpi
		|1<<3		// phy i/f	0:8bit, 1:16bit
		|0x7<<0,	// HS/FS Timeout*
		S3C_UDC_OTG_GUSBCFG);

	s3c_udc_initialize(dev);

	//change proper register instead of S3C_UDC_OTG_GINTMSK
	reg_val = readl(S3C_UDC_OTG_GINTMSK);
	if(!reg_val)
	{
		DEBUG_ERROR("[%s] Fail to set GINTMSK 0x%x\n", __func__, reg_val);
		return -1;
	}
	return 0;
}
Ejemplo n.º 18
0
/* ********************************************************************   */
PFBYTE debug_ks_malloc(int num_elements, int size, int who)
{
PFBYTE ptr;
int i;

    ptr = _ks_malloc(num_elements, size+GUARD_MALLOC_SIZE);

    if (ptr)
    {
        for (i=0; i < CFG_DEBUG_MALLOC_SIZE; i++)
        {
            if (debug_malloc_info[i].addr == 0)
            {
                debug_malloc_info[i].addr = ptr;
                debug_malloc_info[i].size = size;
                debug_malloc_info[i].num_ele = num_elements;
                debug_malloc_info[i].who  = who;
                break;
            }
        }
        if (i == CFG_DEBUG_MALLOC_SIZE)
        {
            DEBUG_ERROR("debug_malloc: CFG_DEBUG_MALLOC_SIZE too small", NOVAR, 0, 0);
        }
#if (INCLUDE_GUARD_MALLOC)
        tc_memset((PFBYTE)ptr+(size*num_elements), GUARD_BYTE,
            GUARD_MALLOC_SIZE);
#endif

        /* update stats   */
        {
            int idx = who - CONFIG_WHO_BASE_MALLOC;
            if (idx < 0 ||
                idx >= sizeof(debug_malloc_totals_info)/sizeof(debug_malloc_totals_info[0]))
            {
                idx = 0;
            }
            debug_malloc_totals_info[idx] += (size*num_elements);
            if (debug_malloc_totals_info[idx] > debug_malloc_max_info[idx])
                debug_malloc_max_info[idx] = debug_malloc_totals_info[idx];
        }
    }

    return(ptr);
}
Ejemplo n.º 19
0
/**
 * @brief Wait for message received
 *
 * @param msg_handler 	Callback for message processing
 * @param msg_info		Handler for epoll and listen socket
 */
void msg_run(struct msg_info *msg_info, msg_handler_fn_t msg_handler)
{
	struct epoll_event events[MAXEVENTS];
	struct epoll_event *event;
	int n, i;
	int fd;
	int ret = -1;
	int efd = msg_info->efd;
	int listen_fd = msg_info->listen_fd;

	while (1)
	{
		n = epoll_wait(efd, events, MAXEVENTS, -1);
		if (-1 == n)
		{
			DEBUG_ERROR("epoll wait error\n");	
			break;
		}

		for (i = 0; i < n; i++)
		{
			event = &events[i];
			fd = event->data.fd;

			if (listen_fd == fd)
			{
				ret = new_connect(listen_fd, efd);
				if (0 != ret)
				{
					printf("accept error\n");
				}
			}
			else
			{
				ret = dispatch_msg(efd, event, msg_handler);
				if (0 != ret)
				{
					printf("Dispatch message failed\n");
				}
			}

		}

	}
}
DWORD WINAPI UninitializedHeapVariableThread(LPVOID Parameter) {
    CONST PTCHAR Message =
        "\t                                                            \t\n"
        "\t            + - + - + - + - + - + - + - + - + - +           \t\n"
        "\t            | C | H | A | L | L | E | N | G | E |           \t\n"
        "\t            + - + - + - + - + - + - + - + - + - +           \t\n"
        "\t                                                            \t\n"
        "\t  Write the exploit for use of Uninitialized Heap Variable  \t\n"
        "\t                                                            \t\n"
        "\t                          Need Help?                        \t\n"
        "\t                                                            \t\n"
        "\t                   ashfaq[at]payatu[dot]com                 \t\n"
        "\t                                                            \t\n";

        DEBUG_ERROR(Message);

    return EXIT_FAILURE;
}
Ejemplo n.º 21
0
static err_t
low_level_output(struct netif *netif, struct pbuf *p)
{
	struct ethernetif *ethernetif = netif->state;
	struct pbuf *q;
	uint8 result;
	uint8 index = 0;
	err_t err = ERR_OK;
	TCPIP_PACKET_INFO_T	tcpip_packet;
	TCPIP_PACKET_INFO_T	*p_packet = &tcpip_packet;

#if ETH_PAD_SIZE
	pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif

	p_packet->packet_len = 0;
	for(q = p; q != NULL; q = q->next) {
		/* Send the data from the pbuf to the interface, one pbuf at a
		   time. The size of the data in each pbuf is kept in the ->len
		   variable. */
		p_packet->data_ptr[index] = q->payload;
	   	p_packet->data_len[index] = q->len;
	   	p_packet->packet_len += q->len;
	   	index++;
	}
	p_packet->pbuf_num = index;

	if (ethernetif->tcpip_wifi_xmit) {
		result = ethernetif->tcpip_wifi_xmit(&tcpip_packet);
		if (result != 0) {
			DEBUG_ERROR("the xmit packet is dropped!");
			err = ERR_IF;
		}
	}


#if ETH_PAD_SIZE
	pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif

	LINK_STATS_INC(link.xmit);

	return err;
}
Ejemplo n.º 22
0
S32 CNetObj::RcvData(S8 *Buf, S32 Len, S32 Times)
{
	S32 Cnt = 0, Size = SOCK_HANDLE_NODATA, rVal = 0;

	while (Cnt++ < Times && m_bRuning) 
	{
		Size = m_Sock.Recv(Buf, Len, 0);
		if (SOCK_HANDLE_NODATA == Size)
		{
			continue;
		}
		else if (SOCK_HANDLE_CLOSE == Size || SOCK_HANDLE_ERROR == Size)
		{
			//if (m_bClient)
			//{
			//	ResetSock();
			//} 
			//else
			//{
			//	Stop();
			//}
			if (m_ObjInitInfo.MsgCb)
			{
				ADP::Msg_t Msg;
				Msg.Magic     = ADP_MSG_MAGIC;
				Msg.Type      = ADP::ADP_MSG_NET_STOP;
				Msg.Live      = GET_TICKS();
				Msg.Body.rVal = Size;
				m_ObjInitInfo.MsgCb(Msg, m_ObjInitInfo.pMsgCbParam);
			}
			Stop();
			rVal = MW_FAILED;
			DEBUG_ERROR("[ %s:%d Sock err:%d ] \n", __FILE__, __LINE__, Size);
			break;
		}
		else if (Size > 0)
		{
			rVal = Size;
			break;
		}
	}

	return rVal;
}
Ejemplo n.º 23
0
CWERROR db_cont_update(CW_DB_CONNECTION *db, CW_CONTACT *cont)
{
    static const char query[] = "UPDATE contacts SET sid=?,uid=?,name=?,mname=?,lname=?,addr=?,phone=?,mphone=?,fax=?,www=?,email=?,company=?,notes=? WHERE cid=?";

	CW_DB_VALUE        binds[14] = {{DB_INT64, (CW_INT64)cont->sid},
                                    {DB_INT64, (CW_INT64)cont->uid},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_INT64, (CW_INT64)cont->cid}};
	CWERROR	           err = CW_ER_OK;

	binds[2].value.as_blob.sz = (wcslen(cont->name) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[2].value.as_blob.blob = cont->name;
	binds[3].value.as_blob.sz = (wcslen(cont->mname) * sizeof(wchar_t))  + sizeof(wchar_t);
	binds[3].value.as_blob.blob = cont->mname;
	binds[4].value.as_blob.sz = (wcslen(cont->lname)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[4].value.as_blob.blob = cont->lname;
	binds[5].value.as_blob.sz = (wcslen(cont->addr)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[5].value.as_blob.blob = cont->addr;
	binds[6].value.as_blob.sz = (wcslen(cont->phone)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[6].value.as_blob.blob = cont->phone;
	binds[7].value.as_blob.sz = (wcslen(cont->mphone)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[7].value.as_blob.blob = cont->mphone;
	binds[8].value.as_blob.sz = (wcslen(cont->fax)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[8].value.as_blob.blob = cont->fax;
	binds[9].value.as_blob.sz = (wcslen(cont->www)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[9].value.as_blob.blob = cont->www;
	binds[10].value.as_blob.sz = (wcslen(cont->email)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[10].value.as_blob.blob = cont->email;
	binds[11].value.as_blob.sz = (wcslen(cont->comp)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[11].value.as_blob.blob = cont->comp;
	binds[12].value.as_blob.sz = (wcslen(cont->notes)  * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[12].value.as_blob.blob = cont->notes;

	if ((err = db_query(db, NULL, query, sizeof(query)-1, &binds[0], 14)) != CW_ER_OK) {
        DEBUG_ERROR();
        return err;
    }

	return CW_ER_OK;   
}
Ejemplo n.º 24
0
//pthread_mutex_t PCPrinterMutex;
//pthread_mutex_t PrinterPCMutex;
int GPIO_Init()
{
    IOCTL_GPIO_ARG_ST gpio_arg;
    GPIOFD = open(DEV_GPIO, O_RDWR);
    if (GPIOFD < 0)
        {
            DEBUG_ERROR("open gpio device failed!!\n");
            return -1;
        }
    gpio_arg.gpio_index = AT91_PIN_PA22;
    gpio_arg.gpio_level = GPIO_LEVEL_LOW;
    gpio_set_level(GPIOFD, &gpio_arg);
    gpio_arg.gpio_index = AT91_PIN_PA21;
    gpio_arg.gpio_level = GPIO_LEVEL_LOW;
    gpio_set_level(GPIOFD, &gpio_arg);
    close(GPIOFD);
    
    
}
// Verifies that file exists at specified path
// // #### this should probably just return a bool
//-----------------------------------------------------------------------------
CPUTResult CPUTFileSystem::DoesFileExist(const cString &pathAndFilename)
{
#ifdef CPUT_OS_ANDROID
    DEBUG_PRINT("DoesFileExist stubbed");
#else
    struct stat fileAttributes;
    
    int result = stat(pathAndFilename.c_str(), &fileAttributes);
    if (result == -1) {
        DEBUG_ERROR(strerror(errno));
        result = CPUT_ERROR; 
    }
	
    if (S_ISREG(fileAttributes.st_mode)) {
        return CPUT_SUCCESS;
    }
#endif    
    return CPUT_ERROR;
}
Ejemplo n.º 26
0
bool CD10VertexBuffer::LockDynamic(D3D10_MAP _eD10LockFlag, void** _ppVertexData)
{
	HRESULT hResult = S_OK;
	bool bReturn = false;

	hResult = m_pVertexBuffer->Map(_eD10LockFlag, 0, _ppVertexData);

	if (FAILED(hResult))
	{
		DEBUG_ERROR("Failed to lock");
	}
	else
	{
		bReturn = true;
		m_bLocked = true;
	}

	return (bReturn);
}
Ejemplo n.º 27
0
CWERROR db_report_add(CW_DB_CONNECTION *db,
					  const CW_UINT32 rcpt_sid,
					  const CW_UINT32 rcpt_uid,
					  const CW_UINT32 code)
{
	static const char query[] = "INSERT INTO reports (sid,uid,code) VALUES(?,?,?)";
				  
	CW_DB_VALUE        binds[4] = {{DB_INT64, (CW_INT64)rcpt_sid},
                                   {DB_INT64, (CW_INT64)rcpt_uid},
                                   {DB_INT64, (CW_INT64)code}};
	CWERROR	           err = CW_ER_OK;

	if ((err = db_query(db, NULL, query, sizeof(query)-1, &binds[0], 3)) != CW_ER_OK) {
        DEBUG_ERROR();
        return err;
    }

	return CW_ER_OK;
}
Ejemplo n.º 28
0
/* Enable the transmit interrupt.  Called when data is ready to be sent.
   This routine should be ISR safe. */
void uart_hw_enable_tx_int(PUART_INFO uinfo)
{
#if (UART_16550)
    if (!uinfo->is_16550 || !uinfo->xmit_on)
    {
#if (DEBUG_XMIT)
        DEBUG_ERROR("uart_hw_enable_tx_int: start xmit", NOVAR, 0, 0);
#endif

        /* Start tranmitting by toggling xmit reg empty in interrupt enable reg   */
        OUTBYTE(uinfo->port_base + IER, THRE_OFF);  /* THRE off */
        io_delay();
        OUTBYTE(uinfo->port_base + IER, THRE_ON);  /* THRE on */
        io_delay();
    }
#else
#error: Implement uart enable tx interrupts
#endif
}
Ejemplo n.º 29
0
CWERROR db_cont_add(CW_DB_CONNECTION *db, CW_CONTACT *cont)
{
    static const char query[] = "INSERT INTO contacts (sid,uid,name,mname,lname,addr,phone,mphone,fax,www,email,company,notes) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)";

	CW_DB_VALUE        binds[13] = {{DB_INT64, (CW_INT64)cont->sid},
                                    {DB_INT64, (CW_INT64)cont->uid},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}, {DB_BLOB, 0},
                                    {DB_BLOB, 0}, {DB_BLOB, 0}};
	CWERROR	           err = CW_ER_OK;
	
	binds[2].value.as_blob.sz = (wcslen(cont->name) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[2].value.as_blob.blob = cont->name;
	binds[3].value.as_blob.sz = (wcslen(cont->mname) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[3].value.as_blob.blob = cont->mname;
	binds[4].value.as_blob.sz = (wcslen(cont->lname) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[4].value.as_blob.blob = cont->lname;
	binds[5].value.as_blob.sz = (wcslen(cont->addr) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[5].value.as_blob.blob = cont->addr;
	binds[6].value.as_blob.sz = (wcslen(cont->phone) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[6].value.as_blob.blob = cont->phone;
	binds[7].value.as_blob.sz = (wcslen(cont->mphone) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[7].value.as_blob.blob = cont->mphone;
	binds[8].value.as_blob.sz = (wcslen(cont->fax) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[8].value.as_blob.blob = cont->fax;
	binds[9].value.as_blob.sz = (wcslen(cont->www) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[9].value.as_blob.blob = cont->www;
	binds[10].value.as_blob.sz = (wcslen(cont->email) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[10].value.as_blob.blob = cont->email;
	binds[11].value.as_blob.sz = (wcslen(cont->comp) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[11].value.as_blob.blob = cont->comp;
	binds[12].value.as_blob.sz = (wcslen(cont->notes) * sizeof(wchar_t)) + sizeof(wchar_t);
	binds[12].value.as_blob.blob = cont->notes;
	
	if ((err = db_query(db, NULL, query, sizeof(query)-1, &binds[0], 13)) != CW_ER_OK) {
        DEBUG_ERROR();
        return err;
    }

	return CW_ER_OK;
}
Ejemplo n.º 30
0
PVOID DymArrayPopFront(PUTILS_DYM_ARRAY Array)
{   
   SIZE_T i = 0;
   PVOID ret = NULL;
   DEBUG_ENTER_FUNCTION("Array=0x%p", Array);

   if (Array->ValidLength > 0) {
      ret = Array->Data[0];
      for (i = 0; i < Array->ValidLength - 1; i++)
         Array->Data[i] = Array->Data[i + 1];

      Array->ValidLength--;
   } else {
      DEBUG_ERROR("Attempt to remove an item from an empty array (0x%p)", Array);
      KeBugCheck(0);
   }

   DEBUG_EXIT_FUNCTION("0x%p", ret);
   return ret;
}