コード例 #1
0
void spin_lock_release(volatile swlock_t *lock,
                                     hwlock_t hwlock)
{
  __hwlock_acquire(hwlock);
  *lock = 0;
  __hwlock_release(hwlock);
}
コード例 #2
0
ファイル: mii_queue.c プロジェクト: rubencp/sc_ethernet
int get_queue_entry(mii_queue_t *q)
{
    int i=0;
    int rdIndex, wrIndex;

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_acquire((swlock_t *) q->lock);
#else
    __hwlock_acquire(ethernet_memory_lock);
#endif

    rdIndex = q->rdIndex;
    wrIndex = q->wrIndex;

    if (rdIndex == wrIndex)
        i = 0;
    else {
        i = q->fifo[rdIndex];
        rdIndex++;
        rdIndex *= (rdIndex != MAC_MAX_ENTRIES);
        q->rdIndex = rdIndex;
    }
#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_release((swlock_t *) q->lock);
#else
    __hwlock_release(ethernet_memory_lock);
#endif
    return i;
}
コード例 #3
0
void media_input_fifo_enable_fifos(unsigned int enable)
{
    if (!enable_lock) return;
    __hwlock_acquire(enable_lock);
    enable_request_state |= enable;
    __hwlock_release(enable_lock);
}
コード例 #4
0
void media_input_fifo_update_enable_ind_state(unsigned int enable, unsigned int mask)
{
    if (!enable_lock) return;
    __hwlock_acquire(enable_lock);
    enable_indication_state = (enable_indication_state & ~mask) | enable;
    __hwlock_release(enable_lock);
}
コード例 #5
0
int spin_lock_try_acquire(volatile swlock_t *lock,
                                 hwlock_t hwlock)
{
  int value;
  __hwlock_acquire(hwlock);
  value = *lock;
  *lock = 1;
  __hwlock_release(hwlock);
  return !value;
}
コード例 #6
0
void spin_lock_acquire(volatile swlock_t *lock, 
                       hwlock_t hwlock)
{
  int value;
  do {
    asm(".xtaloop 1\n");
    __hwlock_acquire(hwlock);
    value = *lock;
    *lock = 1;
    __hwlock_release(hwlock);
  } while (value);
}
コード例 #7
0
ファイル: mii_queue.c プロジェクト: rubencp/sc_ethernet
void incr_transmit_count(int buf0, int incr)
{
    mii_packet_t *buf = (mii_packet_t *) buf0;
#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_acquire(&tc_lock);
#else
    __hwlock_acquire(ethernet_memory_lock);
#endif
    buf->tcount += incr;

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_release(&tc_lock);
#else
    __hwlock_release(ethernet_memory_lock);
#endif
}
コード例 #8
0
ファイル: mii_queue.c プロジェクト: rubencp/sc_ethernet
int get_and_dec_transmit_count(int buf0)
{
    mii_packet_t *buf = (mii_packet_t *) buf0;
    int count;
#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_acquire(&tc_lock);
#else
    __hwlock_acquire(ethernet_memory_lock);
#endif
    count = buf->tcount;
    if (count)
        buf->tcount = count - 1;
#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_release(&tc_lock);
#else
    __hwlock_release(ethernet_memory_lock);
#endif
    return count;
}
コード例 #9
0
ファイル: mii_queue.c プロジェクト: rubencp/sc_ethernet
int mii_packet_get_and_clear_forwarding(int buf0, int ifnum)
{
    mii_packet_t *buf = (mii_packet_t *) buf0;
    int mask = (1<<ifnum);
    int ret = (buf->forwarding & mask);

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_acquire(&tc_lock);
#else
    __hwlock_acquire(ethernet_memory_lock);
#endif

    buf->forwarding &= (~mask);

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_release(&tc_lock);
#else
    __hwlock_release(ethernet_memory_lock);
#endif
    return ret;
}
コード例 #10
0
ファイル: mii_queue.c プロジェクト: rubencp/sc_ethernet
void add_queue_entry(mii_queue_t *q, int i)
{
    int wrIndex;

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_acquire((swlock_t *) q->lock);
#else
    __hwlock_acquire(ethernet_memory_lock);
#endif

    wrIndex = q->wrIndex;
    q->fifo[wrIndex] = i;
    wrIndex++;
    wrIndex *= (wrIndex != MAC_MAX_ENTRIES);
    q->wrIndex = wrIndex;

#ifndef ETHERNET_USE_HARDWARE_LOCKS
    swlock_release((swlock_t *) q->lock);
#else
    __hwlock_release(ethernet_memory_lock);
#endif
    return;
}