From c95df4d43738e1597c348bc7f98ff2902574d720 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Jun 2011 01:26:14 +0200 Subject: Move to new FPGA design --- ipecamera/image.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ipecamera/image.c') diff --git a/ipecamera/image.c b/ipecamera/image.c index 9718e85..4d55069 100644 --- a/ipecamera/image.c +++ b/ipecamera/image.c @@ -136,12 +136,13 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) { ctx->buffer_size = IPECAMERA_DEFAULT_BUFFER_SIZE; ctx->dim.bpp = sizeof(ipecamera_pixel_t) * 8; - +/* ctx->data = pcilib_resolve_data_space(pcilib, 0, &ctx->size); if (!ctx->data) { err = -1; pcilib_error("Unable to resolve the data space"); } +*/ FIND_REG(status_reg, "fpga", "status"); FIND_REG(control_reg, "fpga", "control"); @@ -240,8 +241,10 @@ int ipecamera_reset(pcilib_context_t *vctx) { if (err) return err; // This is temporary for verification purposes - memset(ctx->data, 0, ctx->size); + if (ctx->data) memset(ctx->data, 0, ctx->size); + usleep(10000); + err = pcilib_read_register_by_id(pcilib, status, &value); if (err) { pcilib_error("Error reading status register"); @@ -249,7 +252,7 @@ int ipecamera_reset(pcilib_context_t *vctx) { } if (value != IPECAMERA_EXPECTED_STATUS) { - pcilib_error("Unexpected value (%lx) of status register", value); + pcilib_error("Unexpected value (%lx) of status register, expected %lx", value, IPECAMERA_EXPECTED_STATUS); return PCILIB_ERROR_VERIFY; } @@ -477,6 +480,8 @@ static int ipecamera_get_image(ipecamera_t *ctx) { ipecamera_payload_t *linebuf = (ipecamera_payload_t*)malloc(max_size * sizeof(ipecamera_payload_t)); if (!linebuf) return PCILIB_ERROR_MEMORY; + if (!ctx->data) return PCILIB_ERROR_NOTSUPPORTED; + #ifdef IPECAMERA_WRITE_RAW FILE *f = fopen("raw/image.raw", "w"); if (f) fclose(f); -- cgit v1.2.3