Ejemplo n.º 1
0
int main() {
        int ret; 
	int i; 
	int passed = 0;
	int failed = 0;
        slog_init(NULL, 0);
        struct aura_node *n = aura_open("simpleusb", "../simpleusbconfigs/susb-test.conf");

        if (!n) { 
                printf("err\n");
                return -1;
        }

	i = 100; 
	while (i--) { 
		printf("Testing %d remaining\r", i);
		fflush(stdout);
		aura_wait_status(n, AURA_STATUS_ONLINE);
		struct aura_buffer *retbuf; 
		ret = aura_call(n, "led_ctl", &retbuf, 0x100, 0x100);
		if (0 == ret) {
			aura_buffer_release(retbuf); 
			passed++;
		} else
			failed++;
	}

        aura_close(n);

	printf("Stability test (no data): %d succeeded, %d failed total %d\n",
	       passed, failed, passed + failed);

        return failed;
}
Ejemplo n.º 2
0
long run_first(struct aura_node *n)
{
	struct aura_buffer *retbuf;
	int i;
	long start = current_time();
	for (i=0; i<90000; i++) {
		aura_call(n, "echo_u16", &retbuf, 0x0102);
		aura_buffer_release(retbuf);
		aura_call(n, "echo_u8", &retbuf, 0x0102);
		aura_buffer_release(retbuf);
		aura_call(n, "echo_u32", &retbuf, 0x0102);
		aura_buffer_release(retbuf);
		aura_call(n, "echo_u64", &retbuf, 0x0102);
		aura_buffer_release(retbuf);
	}
	return current_time() - start;

}
Ejemplo n.º 3
0
void nmppsFFTFree(NmppsFFTSpec* spec )
{
	int ret;	
	struct aura_buffer *retbuf; 
	ret = aura_call(n, "nmppsFFTFree", &retbuf, spec); 
	if (ret != 0) 
	    BUG(n, "Call nmppsFFTFree failed!"); 
	aura_buffer_release( retbuf); 
	slog(3, SLOG_INFO, "ARM: Call nmppsFFTFree ok"); 

}	
Ejemplo n.º 4
0
int main() {
        int ret; 
        int i = 2; 
        slog_init(NULL, 88);
        struct aura_node *n = aura_open("simpleusb", "./simpleusbconfigs/pw-ctl.conf");

        if (!n) { 
                printf("err\n");
                return -1;
        }
        aura_wait_status(n, AURA_STATUS_ONLINE);

        struct aura_buffer *retbuf; 
        ret = aura_call(n, "bit_set", &retbuf, 12<<8 | 1, 1);
        slog(0, SLOG_DEBUG, "call ret %d", ret);
        if (0 == ret) {
                printf("====> buf pos %d len %d\n", retbuf->pos, retbuf->size);
		aura_buffer_release(n, retbuf); 
        }

	int v = 1; 	
	while(1) {
		v = !v;
		printf("<=================>\n");
		ret = aura_call(n, "bit_set", &retbuf, 12<<8, v);
		slog(0, SLOG_DEBUG, "call ret %d", ret);
		if (0 == ret) {
			printf("====> buf pos %d len %d\n", retbuf->pos, retbuf->size);
			aura_buffer_release(n, retbuf); 
		} else {
			aura_wait_status(n, AURA_STATUS_ONLINE);
			i--;
			if (!i)
				goto bailout;
		}
		sleep(1);
        }
bailout:
        aura_close(n);
        return 0;
}
Ejemplo n.º 5
0
void test_u64(struct aura_node *n)
{
    int ret;
    struct aura_buffer *retbuf;
    ret = aura_call(n, "echo64", &retbuf, 0xbeefc0deb00bc0de);
    if (ret != 0)
        BUG(n, "Call failed!");

    uint64_t v = aura_buffer_get_u64(retbuf);
    if (v != 0xbeefc0deb00bc0de)
        slog(0, SLOG_ERROR, "U64 test NOT ok: %llx vs %llx", v, 0xbeefc0deb00bc0de);
    aura_buffer_release(n, retbuf);
    slog(0, SLOG_INFO, "U64 echo test passed");
}
Ejemplo n.º 6
0
void test_u32(struct aura_node *n)
{
    int ret;
    struct aura_buffer *retbuf;
    ret = aura_call(n, "echo32", &retbuf, 0xbeefc0de);
    if (ret != 0)
        BUG(n, "Call failed!");

    uint32_t v = aura_buffer_get_u32(retbuf);
    if (v != 0xbeefc0de) {
        slog(0, SLOG_ERROR, "U32 test NOT ok: %llx vs %llx", v, 0xbeefc0de);
    }
    aura_buffer_release(n, retbuf);
    slog(0, SLOG_INFO, "U32 echo test passed");
}
Ejemplo n.º 7
0
int main() {
	slog_init(NULL, 18);

	int ret; 
	struct aura_node *n = aura_open("dummy", NULL);
	struct aura_buffer *retbuf; 

	ret = aura_call(n, "echo_u16", &retbuf, 0x0102);
	slog(0, SLOG_DEBUG, "call ret %d", ret);
	aura_hexdump("Out buffer", retbuf->data, retbuf->size);
	aura_buffer_release(n, retbuf);
	aura_close(n);

	return 0;
}
Ejemplo n.º 8
0
int nmppsMax_16sm (const nm16s*  src, int size, int16b*  pMaxValue, nm32s* tmp)
{
	int ret;	
	struct aura_buffer *iobuf_src = aura_buffer_request(n, size*2);	
	memcpy(iobuf_src->data,src,size*2);	
	struct aura_buffer *retbuf; 
	ret = aura_call(n, "nmppsMax_16sm", &retbuf,  iobuf_src, size); 
	if (ret != 0) {
		BUG(n, "Call:nmppsMax_16sm failed!"); 
	}
	*pMaxValue = aura_buffer_get_u32(retbuf);
	ret = aura_buffer_get_u32(retbuf);
	aura_buffer_release( iobuf_src);
	aura_buffer_release( retbuf); 
	slog(3, SLOG_INFO, "ARM: Call nmppsMax_16sm -ok"); 
	return ret;
}	
Ejemplo n.º 9
0
	int nmppsFFT512InvInitAlloc(NmppsFFTSpec** spec, const void* src,const void* dst, int settings)
	{
		struct aura_buffer *iobuf_src = aura_buffer_request(n, 512*8);	
		struct aura_buffer *iobuf_dst = aura_buffer_request(n, 512*8);	
		struct aura_buffer *retbuf; 
		int ret =  aura_call(n, "nmppsFFT512InvInitAlloc", &retbuf,  iobuf_src, iobuf_dst, settings); 
		if (ret != 0) {
			slog(0, SLOG_ERROR, "call failed, reason: %d\n", ret);
			BUG(n, "Call nmppsFFT512InvInitAlloc failed!"); 
		}
		*spec = (NmppsFFTSpec*) aura_buffer_get_u32(retbuf);
		ret   = aura_buffer_get_u32(retbuf);
		aura_buffer_release( iobuf_src); 
		aura_buffer_release( iobuf_dst); 
		aura_buffer_release( retbuf); 
		slog(3, SLOG_INFO, "ARM: Call nmppsFFT512InvInitAlloc -ok"); 
		return ret;
	}
Ejemplo n.º 10
0
int nmppsCmpNeC_8s8um (const nm8s* src,  int8b  nCmpVal, nm8u* dst,  int size, struct NmppsTmpSpec* spec)
{
	int ret;	
	struct aura_buffer *iobuf_src = aura_buffer_request(n, size*1);	
	struct aura_buffer *iobuf_dst = aura_buffer_request(n, size*1);	
	memcpy(iobuf_src->data,src,size*1);	
	struct aura_buffer *retbuf; 
	ret = aura_call(n, "nmppsCmpNeC_8s8um", &retbuf,  iobuf_src, nCmpVal, iobuf_dst, size); 
	if (ret != 0) {
		BUG(n, "Call:nmppsCmpNeC_8s8um failed!"); 
	}
	memcpy(dst,iobuf_dst->data,size); 
	aura_buffer_release( iobuf_dst); 
	aura_buffer_release( iobuf_src);
	aura_buffer_release( retbuf); 
	slog(3, SLOG_INFO, "ARM: Call nmppsCmpNeC_8s8um -ok"); 
	return 0;
}
Ejemplo n.º 11
0
void test_u32u32(struct aura_node *n)
{
    int ret;
    struct aura_buffer *retbuf;
    ret = aura_call(n, "echou32u32", &retbuf, 0xbeefc0de, 0xdeadc0de);
    if (ret != 0)
        BUG(n, "Call failed!");

    uint32_t v1 = aura_buffer_get_u32(retbuf);
    uint32_t v2 = aura_buffer_get_u32(retbuf);

    if ((v1 != 0xbeefc0de) && (v2 != 0xdeadc0de)) {
        slog(0, SLOG_ERROR, "U32 test NOT ok: %llx,%llx vs %llx,%llx",
             v1, v2, 0xbeefc0de, 0xdeadc0de);
    }

    aura_buffer_release(n, retbuf);
    slog(0, SLOG_INFO, "U32U32 echo test passed");
}
Ejemplo n.º 12
0
void test_bin(struct aura_node *n)
{
    char buf[64];
    int ret;
    FILE *fd = fopen("/dev/urandom", "r+");
    fread(buf, 64, 1, fd);
    fclose(fd);
    struct aura_buffer *retbuf;

    ret = aura_call(n, "echobin", &retbuf, buf);
    if (ret != 0)
        BUG(n, "Call failed!");

    if (0 != memcmp(buf, retbuf->data, 64))
        slog(0, SLOG_ERROR, "BIN test NOT ok");
    aura_hexdump("Out buffer", buf, 64);
    aura_hexdump("In buffer", retbuf->data, 64);
    slog(0, SLOG_INFO, "BIN test passed");
}
Ejemplo n.º 13
0
	void nmppsFFT512Inv(const nm32sc* src, nm32sc* dst, const NmppsFFTSpec* spec)
	{
		int ret;	
		int size=512;
		int k=8;
		struct aura_buffer *iobuf_src = aura_buffer_request(n, size*k);	
		struct aura_buffer *iobuf_dst = aura_buffer_request(n, size*k);	
		memcpy(iobuf_src->data,src,size*k);	
		struct aura_buffer *retbuf; 
		ret = aura_call(n, "nmppsFFT512Inv", &retbuf,  iobuf_src, iobuf_dst, spec); 
		if (ret != 0) {
			slog(0, SLOG_ERROR, "call nmppsFFT512Inv  failed, reason: %d\n", ret);
			BUG(n, "Call nmppsFFT512Inv failed!"); 
		}
		memcpy(dst,iobuf_dst->data,size*k);
		aura_buffer_release( iobuf_dst); 
		aura_buffer_release( iobuf_src); 
		aura_buffer_release( retbuf); 
		slog(3, SLOG_INFO, "ARM: Call nmppsFFT512Inv -ok"); 
	}
Ejemplo n.º 14
0
void test_buf(struct aura_node *n)
{
    int ret;
    struct aura_buffer *retbuf;
    struct aura_buffer *iobuf = aura_buffer_request(n, 80);
    uint32_t test = 0xdeadf00d;
    memcpy(iobuf->data, &test, sizeof(test));

    ret = aura_call(n, "echo_buf", &retbuf, iobuf);
    slog(0, SLOG_DEBUG, "call ret %d", ret);
    if (ret)
        BUG(n, "call failed");

    struct aura_buffer *tmp = aura_buffer_get_buf(retbuf);
    if (tmp != iobuf)
        BUG(n, "test not ok");

    aura_buffer_release(n, retbuf);
    aura_buffer_release(n, tmp);
    slog(0, SLOG_INFO, "BUF test passed");
}
Ejemplo n.º 15
0
int main() {
	slog_init(NULL, 18);

	int ret; 
	struct aura_node *n = aura_open("dummy", NULL);
	struct aura_buffer *retbuf; 
	struct aura_buffer *iobuf = aura_buffer_request(n, 80);

	ret = aura_call(n, "echo_buf", &retbuf, iobuf);
	slog(0, SLOG_DEBUG, "call ret %d", ret);
	if (ret)
		BUG(n, "call failed");
	struct aura_buffer *tmp = aura_buffer_get_buf(retbuf);
	if (tmp != iobuf)
		BUG(n, "test not ok");

	aura_buffer_release(n, retbuf);
	aura_buffer_release(n, tmp);
	aura_close(n);

	return 0;
}