int ccci_modem_sysresume(void)
{
    CCCI_INF_MSG(0, TAG, "ccci_modem_sysresume\n");
    struct ccci_modem *md;
    md = ccci_get_modem_by_id(0);
    if(md!=NULL){
        ccci_modem_restore_reg(md);
    }
    return 0;
}
Exemplo n.º 2
0
int ccmni_send_pkt(int md_id, int tx_ch, void *data)
{
	struct ccci_modem *md = ccci_get_modem_by_id(md_id);
	struct ccci_port *port = NULL;
	/* struct ccci_request *req = NULL; */
	struct ccci_header *ccci_h;
	struct sk_buff *skb = (struct sk_buff *)data;
	int tx_ch_to_port, tx_queue;
	int ret;
#ifdef PORT_NET_TRACE
	unsigned long long send_time = 0;
	unsigned long long get_port_time = 0;
	unsigned long long total_time = 0;

	total_time = sched_clock();
#endif
	if (!md)
		return CCMNI_ERR_TX_INVAL;
	if (unlikely(md->md_state != READY))
		return CCMNI_ERR_MD_NO_READY;

	if (tx_ch == CCCI_CCMNI1_DL_ACK)
		tx_ch_to_port = CCCI_CCMNI1_TX;
	else if (tx_ch == CCCI_CCMNI2_DL_ACK)
		tx_ch_to_port = CCCI_CCMNI2_TX;
	else if (tx_ch == CCCI_CCMNI3_DL_ACK)
		tx_ch_to_port = CCCI_CCMNI3_TX;
	else
		tx_ch_to_port = tx_ch;
#ifdef PORT_NET_TRACE
	get_port_time = sched_clock();
#endif
	port = md->ops->get_port_by_channel(md, tx_ch_to_port);
#ifdef PORT_NET_TRACE
	get_port_time = sched_clock() - get_port_time;
#endif
	if (!port) {
		CCCI_ERR_MSG(0, NET, "port==NULL\n");
		return CCMNI_ERR_TX_INVAL;
	}
	/* req_alloc_time=sched_clock(); */
	/* req = ccci_alloc_req(OUT, -1, 1, 0); */
	/* req_alloc_time=sched_clock()-req_alloc_time; */
	/* if(!req) { */
	/* return CCMNI_ERR_TX_BUSY; */
	/* } */
	if (tx_ch == CCCI_CCMNI1_DL_ACK || tx_ch == CCCI_CCMNI2_DL_ACK || tx_ch == CCCI_CCMNI3_DL_ACK)
		tx_queue = NET_ACK_TXQ_INDEX(port);
	else
		tx_queue = NET_DAT_TXQ_INDEX(port);

	/* req->skb = skb; */
	/* req->policy = FREE; */
	ccci_h = (struct ccci_header *)skb_push(skb, sizeof(struct ccci_header));
	ccci_h = (struct ccci_header *)skb->data;
	ccci_h->channel = tx_ch;
	ccci_h->data[0] = 0;
	ccci_h->data[1] = skb->len;	/* as skb->len already included ccci_header after skb_push */
/* #ifndef FEATURE_SEQ_CHECK_EN */
/* ccci_h->reserved = nent->tx_seq_num++; */
/* #else */
	ccci_h->reserved = 0;
/* #endif */
	CCCI_DBG_MSG(md_id, NET, "port %s send txq=%d: %08X, %08X, %08X, %08X\n", port->name, tx_queue,
		     ccci_h->data[0], ccci_h->data[1], ccci_h->channel, ccci_h->reserved);
#ifdef PORT_NET_TRACE
	send_time = sched_clock();
#endif
	ret = port->modem->ops->send_request(port->modem, tx_queue, NULL, skb);
#ifdef PORT_NET_TRACE
	send_time = sched_clock() - send_time;
#endif
	if (ret) {
		skb_pull(skb, sizeof(struct ccci_header));
			/* undo header, in next retry, we'll reserve header again */
		ret = CCMNI_ERR_TX_BUSY;
	} else {
		ret = CCMNI_ERR_TX_OK;
	}
#ifdef PORT_NET_TRACE
	if (ret == CCMNI_ERR_TX_OK) {
		total_time = sched_clock() - total_time;
		trace_port_net_tx(md_id, tx_queue, tx_ch, (unsigned int)get_port_time, (unsigned int)send_time,
				  (unsigned int)(total_time));
	} else {
		trace_port_net_error(port->modem->index, tx_queue, port->tx_ch, port->tx_busy_count, __LINE__);
	}
#endif
	return ret;
}