#define PORT_CREDIT_RX_LOW 8
#endif
-/*
- * If an application like BTA, Java or script test engine is running on other
- * than BTU thread, PORT_SCHEDULE_LOCK shall be defined as mutex_global_lock()
- */
-#ifndef PORT_SCHEDULE_LOCK
-#define PORT_SCHEDULE_LOCK mutex_global_lock()
-#endif
-
-/*
- * If an application like BTA, Java or script test engine is running on other
- * than BTU thread, PORT_SCHEDULE_UNLOCK shall be defined as
- * mutex_global_unlock()
- */
-#ifndef PORT_SCHEDULE_UNLOCK
-#define PORT_SCHEDULE_UNLOCK mutex_global_unlock()
-#endif
-
/******************************************************************************
**
** OBEX
if (purge_flags & PORT_PURGE_RXCLEAR)
{
- PORT_SCHEDULE_LOCK; /* to prevent missing credit */
+ mutex_global_lock(); /* to prevent missing credit */
count = fixed_queue_length(p_port->rx.queue);
p_port->rx.queue_size = 0;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
/* If we flowed controlled peer based on rx_queue size enable data again */
if (count)
if (purge_flags & PORT_PURGE_TXCLEAR)
{
- PORT_SCHEDULE_LOCK; /* to prevent tx.queue_size from being negative */
+ mutex_global_lock(); /* to prevent tx.queue_size from being negative */
while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->tx.queue)) != NULL)
osi_freebuf(p_buf);
p_port->tx.queue_size = 0;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
events = PORT_EV_TXEMPTY;
*p_len += max_len;
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
p_port->rx.queue_size -= max_len;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
break;
}
*p_len += p_buf->len;
max_len -= p_buf->len;
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
p_port->rx.queue_size -= p_buf->len;
osi_freebuf(fixed_queue_try_dequeue(p_port->rx.queue));
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
count++;
}
return (PORT_LINE_ERR);
}
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->rx.queue);
if (p_buf)
{
p_port->rx.queue_size -= p_buf->len;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
/* If rfcomm suspended traffic from the peer based on the rx_queue_size */
/* check if it can be resumed now */
}
else
{
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
}
*pp_buf = p_buf;
/* If there are buffers scheduled for transmission check if requested */
/* data fits into the end of the queue */
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
if (((p_buf = (BT_HDR *)fixed_queue_try_peek_last(p_port->tx.queue)) != NULL)
&& (((int)p_buf->len + available) <= (int)p_port->peer_mtu)
{
error("p_data_co_callback DATA_CO_CALLBACK_TYPE_OUTGOING failed, available:%d", available);
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
return (PORT_UNKNOWN_ERROR);
}
//memcpy ((UINT8 *)(p_buf + 1) + p_buf->offset + p_buf->len, p_data, max_len);
*p_len = available;
p_buf->len += (UINT16)available;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
return (PORT_SUCCESS);
}
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
//int max_read = length < p_port->peer_mtu ? length : p_port->peer_mtu;
/* If there are buffers scheduled for transmission check if requested */
/* data fits into the end of the queue */
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
if (((p_buf = (BT_HDR *)fixed_queue_try_peek_last(p_port->tx.queue)) != NULL)
&& ((p_buf->len + max_len) <= p_port->peer_mtu)
*p_len = max_len;
p_buf->len += max_len;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
return (PORT_SUCCESS);
}
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
while (max_len)
{
}
}
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
fixed_queue_enqueue(p_port->rx.queue, p_buf);
p_port->rx.queue_size += p_buf->len;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
/* perform flow control procedures if necessary */
port_flow_control_peer(p_port, FALSE, 0);
while (!p_port->tx.peer_fc && p_port->rfc.p_mcb && p_port->rfc.p_mcb->peer_ready)
{
/* get data from tx queue and send it */
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
if ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->tx.queue)) != NULL)
{
p_port->tx.queue_size -= p_buf->len;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
RFCOMM_TRACE_DEBUG ("Sending RFCOMM_DataReq tx.queue_size=%d", p_port->tx.queue_size);
/* queue is empty-- all data sent */
else
{
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
events |= PORT_EV_TXEMPTY;
break;
tPORT_CALLBACK *p_port_cb;
tPORT_STATE user_port_pars;
- PORT_SCHEDULE_LOCK;
+ mutex_global_lock();
RFCOMM_TRACE_DEBUG("port_release_port, p_port:%p", p_port);
while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->rx.queue)) != NULL)
osi_freebuf(p_buf);
p_port->tx.queue_size = 0;
- PORT_SCHEDULE_UNLOCK;
+ mutex_global_unlock();
p_port->state = PORT_STATE_CLOSED;