Example #1
0
uint32_t z8002_device::RDMEM_L(address_spacenum spacenum, uint32_t addr)
{
	uint32_t result;
	addr = adjust_addr_for_nonseg_mode(addr);
	addr &= ~1;
	if (spacenum == AS_PROGRAM)
	{
		result = m_program->read_word(addr) << 16;
		return result + m_program->read_word(addr_add(addr, 2));
	}
	else
	{
		result = m_data->read_word(addr) << 16;
		return result + m_data->read_word(addr_add(addr, 2));
	}
}
Example #2
0
INLINE UINT32 RDMEM_L(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr)
{
	UINT32 result;
	addr = adjust_addr_for_nonseg_mode(cpustate, addr);
	addr &= ~1;
	if (spacenum == AS_PROGRAM)
	{
		result = cpustate->program->read_word(addr) << 16;
		return result + cpustate->program->read_word(addr_add(cpustate, addr, 2));
	}
	else
	{
		result = cpustate->data->read_word(addr) << 16;
		return result + cpustate->data->read_word(addr_add(cpustate, addr, 2));
	}
}
Example #3
0
void z8002_device::WRMEM_L(address_spacenum spacenum, uint32_t addr, uint32_t value)
{
	addr = adjust_addr_for_nonseg_mode(addr);
	addr &= ~1;
	if (spacenum == AS_PROGRAM)
	{
		m_program->write_word(addr, value >> 16);
		m_program->write_word(addr_add(addr, 2), value & 0xffff);
	}
Example #4
0
INLINE void WRMEM_L(z8000_state *cpustate, address_spacenum spacenum, UINT32 addr, UINT32 value)
{
	addr = adjust_addr_for_nonseg_mode(cpustate, addr);
	addr &= ~1;
	if (spacenum == AS_PROGRAM)
	{
		cpustate->program->write_word(addr, value >> 16);
		cpustate->program->write_word(addr_add(cpustate, addr, 2), value & 0xffff);
	}
bool nrf_802154_ack_pending_bit_for_addr_set(const uint8_t * p_addr, bool extended)
{
    uint8_t location = 0;

    if (addr_index_find(p_addr, &location, extended))
    {
        return true;
    }
    else
    {
        return addr_add(p_addr, location, extended);
    }
}
Example #6
0
static int
parse_address(struct nlmsghdr *nh)
{
    int len;
    struct kernel_address kaddr;
    struct ifaddrmsg *ifa = NULL;
    struct rtattr *rta = NULL;
    unsigned int rta_len;
    int is_v4 = 0;

    len = nh->nlmsg_len;

    ifa = (struct ifaddrmsg*)NLMSG_DATA(nh);
    len -= NLMSG_LENGTH(0);

    memset(&kaddr, 0, sizeof(kaddr));
    kaddr.sa.sa_family = ifa->ifa_family;

    if (kaddr.sa.sa_family != AF_INET && kaddr.sa.sa_family != AF_INET6) {
        log_dbg(LOG_DEBUG_KERNEL, "Unknown family: %d\n", kaddr.sa.sa_family);
        return -1;
    }
    is_v4 = kaddr.sa.sa_family == AF_INET;

    rta = IFA_RTA(ifa);
    len -= NLMSG_ALIGN(sizeof(*ifa));

#define COPY_ADDR(d, s)                                                 \
    do {                                                                \
        if(!is_v4) {                                                    \
            assert(rta_len >= 16);                                      \
            memcpy(&d.sin6.sin6_addr, s, 16);                           \
        }else {                                                         \
            assert(rta_len >= 4);                                       \
            memcpy(&d.sin.sin_addr, s, 4);                              \
        }                                                               \
    } while(0)

    for(; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
        rta_len = RTA_PAYLOAD(rta);
        switch (rta->rta_type) {
        case IFA_UNSPEC: break;
        case IFA_ADDRESS:
            COPY_ADDR(kaddr, RTA_DATA(rta));
            break;

        case IFA_LOCAL:
            COPY_ADDR(kaddr, RTA_DATA(rta));
            kaddr.flags |= ADDR_LOCAL;
            break;
        default:
            break;
        }
    }
#undef COPY_ADDR
#undef GET_PLEN

    if (nh->nlmsg_type == RTM_NEWADDR)
        addr_add(&addresses, &kaddr);
    else
        addr_del(addresses, &kaddr);

    return 0;
}